diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..397a4c3e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,64 @@ +name: Build + +on: [push, pull_request] + +jobs: + build-host: + env: + MACOSX_DEPLOYMENT_TARGET: 10.14 + strategy: + fail-fast: false + matrix: + include: + - name: macOS + os: macos-latest + artifact: true + autotools: true + cmake: true + - name: Ubuntu + os: ubuntu-latest + artifact: true + autotools: true + cmake: true + - name: MSVC + os: windows-latest + cmake: true + + name: "Build - ${{ matrix.name }}" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v6 + - name: Install autotools + if: ${{ matrix.autotools }} + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + brew update + brew install automake autoconf + fi + - name: Autogen (autotools) + if: ${{ matrix.autotools }} + run: ./autogen.sh + - name: Build (autotools) + if: ${{ matrix.autotools }} + run: make + - name: Check (autotools) + if: ${{ matrix.autotools }} + run: make check + - name: Dist (autotools) + id: make-dist + if: ${{ matrix.autotools }} + run: make dist + + - name: Configure (CMake) + if: ${{ matrix.cmake }} + run: cmake -S . -B build + - name: Build (CMake) + if: ${{ matrix.cmake }} + run: cmake --build build + + - uses: actions/upload-artifact@v7 + if: ${{ matrix.artifact && always() && steps.make-dist.outcome == 'success' }} + with: + name: ${{ matrix.name }} + path: yasm-*.tar.gz + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..97d43572 --- /dev/null +++ b/.gitignore @@ -0,0 +1,64 @@ +autom4te.cache +stamp-h* +libyasm-stdint.h +nasm-token.c +nasm-macros.c +yapp-token.c +gas-token.c +license.c +module.c +x86parse.c +lc3bid.c +re2c-parser.c +re2c-parser.h +cleanup +test_hd +version.mac +*_test +configure +configure.scan +configure.lineno +./config.* +aclocal.m4 +*.tar.gz +*.la +*.lo +*.o +*.a +.libs +.deps +libtool +*.bb +*.bbg +*.da +results +./Makefile +Makefile.in +.*.swp +python-setup.txt +yasm_python.c +.python-build +_yasm.pxi +yasm.pyx +build +yasm.so +x86cpu.c +x86insn_nasm.gperf +x86insn_nasm.c +x86insn_gas.gperf +x86insn_gas.c +x86insns.c +x86regtmod.c +nasm-version.c +win64-gas.c +win64-nasm.c +YASM-VERSION-FILE +YASM-VERSION.h +.sw* +./*.s +./*.asm +x64 +*.log +*.trs +.dirstamp +*.user diff --git a/ABOUT-NLS b/ABOUT-NLS index ec20977e..b1de1b68 100644 --- a/ABOUT-NLS +++ b/ABOUT-NLS @@ -18,35 +18,7 @@ explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and work on translations can contact the appropriate team. - When reporting bugs in the `intl/' directory or bugs which may be -related to internationalization, you should tell about the version of -`gettext' which is used. The information can be found in the -`intl/VERSION' file, in internationalized packages. - -1.1 Quick configuration advice -============================== - -If you want to exploit the full power of internationalization, you -should configure it using - - ./configure --with-included-gettext - -to force usage of internationalizing routines provided within this -package, despite the existence of internationalizing capabilities in the -operating system where this package is being installed. So far, only -the `gettext' implementation in the GNU C library version 2 provides as -many features (such as locale alias, message inheritance, automatic -charset conversion or plural form handling) as the implementation here. -It is also not possible to offer this additional functionality on top -of a `catgets' implementation. Future versions of GNU `gettext' will -very likely convey even more functionality. So it might be a good idea -to change to GNU `gettext' as soon as possible. - - So you need _not_ provide this option if you are using GNU libc 2 or -you have installed a recent copy of the GNU gettext package with the -included `libintl'. - -1.2 INSTALL Matters +1.1 INSTALL Matters =================== Some packages are "localizable" when properly installed; the programs @@ -56,36 +28,19 @@ internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already -provides the GNU `gettext' functions. If not, the included GNU -`gettext' library will be used. This library is wholly contained -within this package, usually in the `intl/' subdirectory, so prior -installation of the GNU `gettext' package is _not_ required. -Installers may use special options at configuration time for changing -the default behaviour. The commands: +provides the GNU `gettext' functions. Installers may use special +options at configuration time for changing the default behaviour. The +command: - ./configure --with-included-gettext ./configure --disable-nls -will, respectively, bypass any pre-existing `gettext' to use the -internationalizing routines provided within this package, or else, -_totally_ disable translation of messages. +will _totally_ disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will -probably detect the previously built and installed `libintl.a' file and -will decide to use this. This might not be desirable. You should use -the more recent version of the GNU `gettext' library. I.e. if the file -`intl/VERSION' shows that the library which comes with this package is -more recent, you should use - - ./configure --with-included-gettext - -to prevent auto-detection. - - The configuration process will not test for the `catgets' function -and therefore it will not be used. The reason is that even an -emulation of `gettext' on top of `catgets' could not provide all the -extensions of the GNU `gettext' library. +probably detect the previously built and installed `libintl' library +and will decide to use it. If not, you may have to to use the +`--with-libintl-prefix' option to tell `configure' where to look for it. Internationalized packages usually have many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless @@ -96,13 +51,16 @@ may be set, prior to configuration, to limit the installed set. `LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. -1.3 Using This Package +1.2 Using This Package ====================== As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate -`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, -and `CC' is an ISO 3166 two-letter country code. For example, let's +`LL_CC' combination. If you happen to have the `LC_ALL' or some other +`LC_xxx' environment variables set, you should unset them before +setting `LANG', otherwise the setting of `LANG' will not have the +desired effect. Here `LL' is an ISO 639 two-letter language code, and +`CC' is an ISO 3166 two-letter country code. For example, let's suppose that you speak German and live in Germany. At the shell prompt, merely execute `setenv LANG de_DE' (in `csh'), `export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). @@ -145,7 +103,7 @@ to denote the language's main dialect. For example, `de' is equivalent to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' (Portuguese as spoken in Portugal) in this context. -1.4 Translating Teams +1.3 Translating Teams ===================== For the Free Translation Project to be a success, we need interested @@ -153,8 +111,7 @@ people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of teams can be found at the Free Translation Project's homepage, -`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" -area. +`http://translationproject.org/', in the "Teams" area. If you'd like to volunteer to _work_ at translating messages, you should become a member of the translating team for your own language. @@ -168,901 +125,1125 @@ message to `sv-request@li.org', having this message body: _actively_ in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to -get started, please write to `translation@iro.umontreal.ca' to reach the -coordinator for all translator teams. +get started, please write to `coordinator@translationproject.org' to +reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology in use. Proven linguistic skills are praised more than programming skills, here. -1.5 Available Packages +1.4 Available Packages ====================== Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of October -2006. The matrix shows, in regard of each package, for which languages +matrix shows the current state of internationalization, as of June +2010. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination, with a translation percentage of at least 50%. - Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo - +----------------------------------------------------+ - GNUnet | [] | - a2ps | [] [] [] [] [] | - aegis | () | - ant-phone | () | - anubis | [] | - ap-utils | | - aspell | [] [] [] [] [] | - bash | [] [] [] | - batchelor | [] | - bfd | | - bibshelf | [] | - binutils | [] | - bison | [] [] | - bison-runtime | | - bluez-pin | [] [] [] [] [] | - cflow | [] | - clisp | [] [] | - console-tools | [] [] | - coreutils | [] [] [] | - cpio | | - cpplib | [] [] [] | - cryptonit | [] | - darkstat | [] () [] | - dialog | [] [] [] [] [] [] | - diffutils | [] [] [] [] [] [] | - doodle | [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] | - error | [] [] [] [] | - fetchmail | [] [] () [] | - fileutils | [] [] | - findutils | [] [] [] | - flex | [] [] [] | - fslint | [] | - gas | | - gawk | [] [] [] | - gbiff | [] | - gcal | [] | - gcc | [] | - gettext-examples | [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] | - gimp-print | [] [] [] [] | - gip | [] | - gliv | [] | - glunarclock | [] | - gmult | [] [] | - gnubiff | () | - gnucash | () () [] | - gnucash-glossary | [] () | - gnuedu | | - gnulib | [] [] [] [] [] [] | - gnunet-gtk | | - gnutls | | - gpe-aerial | [] [] | - gpe-beam | [] [] | - gpe-calendar | | - gpe-clock | [] [] | - gpe-conf | [] [] | - gpe-contacts | | - gpe-edit | [] | - gpe-filemanager | | - gpe-go | [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-package | | - gpe-sketchbook | [] [] | - gpe-su | [] [] | - gpe-taskmanager | [] [] | - gpe-timesheet | [] | - gpe-today | [] [] | - gpe-todo | | - gphoto2 | [] [] [] [] | - gprof | [] [] | - gpsdrive | () () | - gramadoir | [] [] | - grep | [] [] [] [] [] [] | - gretl | | - gsasl | | - gss | | - gst-plugins | [] [] [] [] | - gst-plugins-base | [] [] [] | - gst-plugins-good | [] [] [] [] [] [] [] | - gstreamer | [] [] [] [] [] [] [] | - gtick | () | - gtkam | [] [] [] | - gtkorphan | [] [] | - gtkspell | [] [] [] [] | - gutenprint | [] | - hello | [] [] [] [] [] | - id-utils | [] [] | - impost | | - indent | [] [] [] | - iso_3166 | [] [] | - iso_3166_2 | | - iso_4217 | [] | - iso_639 | [] [] | - jpilot | [] | - jtag | | - jwhois | | - kbd | [] [] [] [] | - keytouch | | - keytouch-editor | | - keytouch-keyboa... | | - latrine | () | - ld | [] | - leafpad | [] [] [] [] [] | - libc | [] [] [] [] [] | - libexif | [] | - libextractor | [] | - libgpewidget | [] [] [] | - libgpg-error | [] | - libgphoto2 | [] [] | - libgphoto2_port | [] [] | - libgsasl | | - libiconv | [] [] | - libidn | [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | [] | - make | [] [] | - man-db | [] () [] [] | - minicom | [] [] [] | - mysecretdiary | [] [] | - nano | [] [] [] | - nano_1_0 | [] () [] [] | - opcodes | [] | - parted | | - pilot-qof | [] | - psmisc | [] | - pwdutils | | - python | | - qof | | - radius | [] | - recode | [] [] [] [] [] [] | - rpm | [] [] | - screem | | - scrollkeeper | [] [] [] [] [] [] [] [] | - sed | [] [] [] | - sh-utils | [] [] | - shared-mime-info | [] [] [] [] | - sharutils | [] [] [] [] [] [] | - shishi | | - silky | | - skencil | [] () | - sketch | [] () | - solfege | | - soundtracker | [] [] | - sp | [] | - stardict | [] | - system-tools-ba... | [] [] [] [] [] [] [] [] [] | - tar | [] | - texinfo | [] [] [] | - textutils | [] [] [] | - tin | () () | - tp-robot | [] | - tuxpaint | [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] [] [] | - vorbis-tools | [] [] [] [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] | - xchat | [] [] [] [] [] [] | - xkeyboard-config | | - xpad | [] [] | - +----------------------------------------------------+ - af am ar az be bg bs ca cs cy da de el en en_GB eo - 10 0 1 2 9 22 1 42 41 2 60 95 16 1 17 16 - - es et eu fa fi fr ga gl gu he hi hr hu id is it + Ready PO files af am an ar as ast az be be@latin bg bn_IN bs ca +--------------------------------------------------+ - GNUnet | | - a2ps | [] [] [] () | + a2ps | [] [] | aegis | | - ant-phone | [] | - anubis | [] | - ap-utils | [] [] | - aspell | [] [] [] | - bash | [] [] [] | - batchelor | [] [] | - bfd | [] | - bibshelf | [] [] [] | - binutils | [] [] [] | - bison | [] [] [] [] [] [] | - bison-runtime | [] [] [] [] [] | - bluez-pin | [] [] [] [] [] | - cflow | [] | - clisp | [] [] | - console-tools | | - coreutils | [] [] [] [] [] [] | - cpio | [] [] [] | - cpplib | [] [] | - cryptonit | [] | - darkstat | [] () [] [] [] | - dialog | [] [] [] [] [] [] [] [] | - diffutils | [] [] [] [] [] [] [] [] [] | - doodle | [] [] | - e2fsprogs | [] [] [] | - enscript | [] [] [] | - error | [] [] [] [] [] | - fetchmail | [] | - fileutils | [] [] [] [] [] [] | - findutils | [] [] [] [] | - flex | [] [] [] | - fslint | [] | - gas | [] [] | - gawk | [] [] [] [] | - gbiff | [] | - gcal | [] [] | - gcc | [] | - gettext-examples | [] [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] [] | - gettext-tools | [] [] [] | - gimp-print | [] [] | - gip | [] [] [] | - gliv | () | - glunarclock | [] [] [] | - gmult | [] [] [] | - gnubiff | () () | - gnucash | () () () | - gnucash-glossary | [] [] | - gnuedu | [] | - gnulib | [] [] [] [] [] [] [] [] | + ant-phone | | + anubis | | + aspell | [] [] | + bash | | + bfd | | + bibshelf | [] | + binutils | | + bison | | + bison-runtime | [] | + bluez-pin | [] [] | + bombono-dvd | | + buzztard | | + cflow | | + clisp | | + coreutils | [] [] | + cpio | | + cppi | | + cpplib | [] | + cryptsetup | | + dfarc | | + dialog | [] [] | + dico | | + diffutils | [] | + dink | | + doodle | | + e2fsprogs | [] | + enscript | [] | + exif | | + fetchmail | [] | + findutils | [] | + flex | [] | + freedink | | + gas | | + gawk | [] [] | + gcal | [] | + gcc | | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] | + gettext-tools | [] [] | + gip | [] | + gjay | | + gliv | [] | + glunarclock | [] [] | + gnubiff | | + gnucash | [] | + gnuedu | | + gnulib | | + gnunet | | gnunet-gtk | | gnutls | | - gpe-aerial | [] [] | - gpe-beam | [] [] | + gold | | + gpe-aerial | | + gpe-beam | | + gpe-bluetooth | | gpe-calendar | | - gpe-clock | [] [] [] [] | - gpe-conf | [] | - gpe-contacts | [] [] | - gpe-edit | [] [] [] [] | - gpe-filemanager | [] | - gpe-go | [] [] [] | - gpe-login | [] [] [] | - gpe-ownerinfo | [] [] [] [] [] | - gpe-package | [] | - gpe-sketchbook | [] [] | - gpe-su | [] [] [] [] | - gpe-taskmanager | [] [] [] | - gpe-timesheet | [] [] [] [] | - gpe-today | [] [] [] [] | - gpe-todo | [] | - gphoto2 | [] [] [] [] [] | - gprof | [] [] [] [] | - gpsdrive | () () [] () | - gramadoir | [] [] | - grep | [] [] [] [] [] [] [] [] [] [] [] [] | - gretl | [] [] [] | - gsasl | [] [] | - gss | [] | - gst-plugins | [] [] [] | - gst-plugins-base | [] [] | - gst-plugins-good | [] [] [] | - gstreamer | [] [] [] | - gtick | [] | - gtkam | [] [] [] [] | - gtkorphan | [] [] | - gtkspell | [] [] [] [] [] [] | - gutenprint | [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] [] [] | - impost | [] [] | - indent | [] [] [] [] [] [] [] [] [] [] | - iso_3166 | [] [] [] | - iso_3166_2 | [] | - iso_4217 | [] [] [] [] | - iso_639 | [] [] [] [] [] | - jpilot | [] [] | - jtag | [] | - jwhois | [] [] [] [] [] | - kbd | [] [] | - keytouch | [] | - keytouch-editor | [] | - keytouch-keyboa... | [] | - latrine | [] [] [] | - ld | [] [] | - leafpad | [] [] [] [] [] [] | - libc | [] [] [] [] [] | - libexif | [] | - libextractor | [] | - libgpewidget | [] [] [] [] [] | + gpe-clock | [] | + gpe-conf | | + gpe-contacts | | + gpe-edit | | + gpe-filemanager | | + gpe-go | | + gpe-login | | + gpe-ownerinfo | [] | + gpe-package | | + gpe-sketchbook | | + gpe-su | [] | + gpe-taskmanager | [] | + gpe-timesheet | [] | + gpe-today | [] | + gpe-todo | | + gphoto2 | | + gprof | [] | + gpsdrive | | + gramadoir | | + grep | | + grub | [] [] | + gsasl | | + gss | | + gst-plugins-bad | [] | + gst-plugins-base | [] | + gst-plugins-good | [] | + gst-plugins-ugly | [] | + gstreamer | [] [] [] | + gtick | | + gtkam | [] | + gtkorphan | [] | + gtkspell | [] [] [] | + gutenprint | | + hello | [] | + help2man | | + hylafax | | + idutils | | + indent | [] [] | + iso_15924 | | + iso_3166 | [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | | + iso_639 | [] [] [] [] | + iso_639_3 | | + jwhois | | + kbd | | + keytouch | [] | + keytouch-editor | | + keytouch-keyboa... | [] | + klavaro | [] | + latrine | | + ld | [] | + leafpad | [] [] | + libc | [] [] | + libexif | () | + libextractor | | + libgnutls | | + libgpewidget | | libgpg-error | | - libgphoto2 | [] [] [] | - libgphoto2_port | [] [] | - libgsasl | [] [] | - libiconv | [] [] | - libidn | [] [] | - lifelines | () | - lilypond | [] | - lingoteach | [] [] [] | - lynx | [] [] [] | - m4 | [] [] [] [] | - mailutils | [] [] | - make | [] [] [] [] [] [] [] [] | - man-db | () | - minicom | [] [] [] [] | - mysecretdiary | [] [] [] | - nano | [] [] [] [] [] [] | - nano_1_0 | [] [] [] [] [] | - opcodes | [] [] [] [] | - parted | [] [] [] [] | - pilot-qof | | - psmisc | [] [] [] | + libgphoto2 | | + libgphoto2_port | | + libgsasl | | + libiconv | [] | + libidn | | + lifelines | | + liferea | [] [] | + lilypond | | + linkdr | [] | + lordsawar | | + lprng | | + lynx | [] | + m4 | | + mailfromd | | + mailutils | | + make | | + man-db | | + man-db-manpages | | + minicom | | + mkisofs | | + myserver | | + nano | [] [] | + opcodes | | + parted | | + pies | | + popt | | + psmisc | | + pspp | [] | pwdutils | | - python | | - qof | [] | - radius | [] [] | - recode | [] [] [] [] [] [] [] [] | - rpm | [] [] | + radius | [] | + recode | [] [] | + rosegarden | | + rpm | | + rush | | + sarg | | screem | | - scrollkeeper | [] [] [] | - sed | [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] [] | - shared-mime-info | [] [] [] [] [] [] | - sharutils | [] [] [] [] [] [] [] [] | + scrollkeeper | [] [] [] | + sed | [] [] | + sharutils | [] [] | shishi | | - silky | [] | - skencil | [] [] | - sketch | [] [] | - solfege | [] | - soundtracker | [] [] [] | - sp | [] | - stardict | [] | - system-tools-ba... | [] [] [] [] [] [] [] [] | - tar | [] [] [] [] [] [] [] | - texinfo | [] [] | - textutils | [] [] [] [] [] | - tin | [] () | - tp-robot | [] [] [] [] | - tuxpaint | [] [] | + skencil | | + solfege | | + solfege-manual | | + soundtracker | | + sp | | + sysstat | | + tar | [] | + texinfo | | + tin | | unicode-han-tra... | | - unicode-transla... | [] [] | - util-linux | [] [] [] [] [] [] [] | - vorbis-tools | [] [] | - wastesedge | () | - wdiff | [] [] [] [] [] [] [] [] | - wget | [] [] [] [] [] [] [] [] | - xchat | [] [] [] [] [] [] [] [] | - xkeyboard-config | [] [] [] [] | - xpad | [] [] [] | + unicode-transla... | | + util-linux-ng | [] | + vice | | + vmm | | + vorbis-tools | | + wastesedge | | + wdiff | | + wget | [] [] | + wyslij-po | | + xchat | [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] | +--------------------------------------------------+ - es et eu fa fi fr ga gl gu he hi hr hu id is it - 88 22 14 2 40 115 61 14 1 8 1 6 59 31 0 52 + af am an ar as ast az be be@latin bg bn_IN bs ca + 6 0 1 2 3 19 1 10 3 28 3 1 38 - ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + crh cs da de el en en_GB en_ZA eo es et eu fa +-------------------------------------------------+ - GNUnet | | - a2ps | () [] [] () | - aegis | () | - ant-phone | [] | - anubis | [] [] [] | - ap-utils | [] | - aspell | [] [] | - bash | [] | - batchelor | [] [] | - bfd | | - bibshelf | [] | - binutils | | - bison | [] [] [] | - bison-runtime | [] [] [] | - bluez-pin | [] [] [] | - cflow | | - clisp | [] | - console-tools | | - coreutils | [] | + a2ps | [] [] [] [] [] [] [] | + aegis | [] [] [] | + ant-phone | [] () | + anubis | [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] | + bison | [] [] | + bison-runtime | [] [] [] [] | + bluez-pin | [] [] [] [] [] [] | + bombono-dvd | [] | + buzztard | [] [] [] | + cflow | [] [] | + clisp | [] [] [] [] | + coreutils | [] [] [] [] | cpio | | - cpplib | [] | - cryptonit | [] | - darkstat | [] [] | - dialog | [] [] | - diffutils | [] [] [] | - doodle | | - e2fsprogs | [] | - enscript | [] | - error | [] | - fetchmail | [] [] | - fileutils | [] [] | - findutils | [] | - flex | [] [] | - fslint | [] [] | - gas | | - gawk | [] [] | - gbiff | [] | - gcal | | - gcc | | - gettext-examples | [] [] | - gettext-runtime | [] [] [] | - gettext-tools | [] [] | - gimp-print | [] [] | - gip | [] [] | - gliv | [] | - glunarclock | [] [] | - gmult | [] [] | - gnubiff | | - gnucash | () () | - gnucash-glossary | [] | - gnuedu | | - gnulib | [] [] [] [] | - gnunet-gtk | | - gnutls | | - gpe-aerial | [] | - gpe-beam | [] | - gpe-calendar | [] | - gpe-clock | [] [] [] | - gpe-conf | [] [] | - gpe-contacts | [] | - gpe-edit | [] [] [] | - gpe-filemanager | [] [] | - gpe-go | [] [] [] | - gpe-login | [] [] [] | - gpe-ownerinfo | [] [] | - gpe-package | [] [] | - gpe-sketchbook | [] [] | - gpe-su | [] [] [] | - gpe-taskmanager | [] [] [] [] | - gpe-timesheet | [] | - gpe-today | [] [] | - gpe-todo | [] | - gphoto2 | [] [] | - gprof | | - gpsdrive | () () () | - gramadoir | () | - grep | [] [] [] [] | - gretl | | - gsasl | [] | + cppi | | + cpplib | [] [] [] | + cryptsetup | [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] [] [] | + dink | [] [] [] | + doodle | [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + exif | () [] [] | + fetchmail | [] [] () [] [] [] | + findutils | [] [] [] | + flex | [] [] | + freedink | [] [] [] | + gas | [] | + gawk | [] [] [] | + gcal | [] | + gcc | [] [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] [] | + gip | [] [] [] [] | + gjay | [] | + gliv | [] [] [] | + glunarclock | [] [] | + gnubiff | () | + gnucash | [] () () () () | + gnuedu | [] [] | + gnulib | [] [] | + gnunet | | + gnunet-gtk | [] | + gnutls | [] [] | + gold | [] | + gpe-aerial | [] [] [] [] | + gpe-beam | [] [] [] [] | + gpe-bluetooth | [] [] | + gpe-calendar | [] | + gpe-clock | [] [] [] [] | + gpe-conf | [] [] [] | + gpe-contacts | [] [] [] | + gpe-edit | [] [] | + gpe-filemanager | [] [] [] | + gpe-go | [] [] [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] [] [] | + gpe-package | [] [] [] | + gpe-sketchbook | [] [] [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] [] [] | + gphoto2 | [] [] () [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] [] | + grep | [] | + grub | [] [] | + gsasl | [] | gss | | - gst-plugins | [] | - gst-plugins-base | | - gst-plugins-good | [] | - gstreamer | [] | - gtick | | - gtkam | [] | - gtkorphan | [] | - gtkspell | [] [] | - gutenprint | | - hello | [] [] [] [] [] [] | - id-utils | [] | - impost | | - indent | [] [] | - iso_3166 | [] | - iso_3166_2 | [] | - iso_4217 | [] [] [] | - iso_639 | [] [] | - jpilot | () () () | - jtag | | - jwhois | [] | - kbd | [] | - keytouch | [] | - keytouch-editor | | - keytouch-keyboa... | | - latrine | [] | - ld | | - leafpad | [] [] | - libc | [] [] [] [] [] | - libexif | | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] () [] | + gtkam | [] [] () [] [] | + gtkorphan | [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] | + gutenprint | [] [] [] | + hello | [] [] [] [] | + help2man | [] | + hylafax | [] [] | + idutils | [] [] | + indent | [] [] [] [] [] [] [] | + iso_15924 | [] () [] [] | + iso_3166 | [] [] [] [] () [] [] [] () | + iso_3166_2 | () | + iso_4217 | [] [] [] () [] [] | + iso_639 | [] [] [] [] () [] [] | + iso_639_3 | [] | + jwhois | [] | + kbd | [] [] [] [] [] | + keytouch | [] [] | + keytouch-editor | [] [] | + keytouch-keyboa... | [] | + klavaro | [] [] [] [] | + latrine | [] () | + ld | [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] [] () | libextractor | | - libgpewidget | [] | - libgpg-error | | - libgphoto2 | [] | - libgphoto2_port | [] | - libgsasl | [] | - libiconv | | - libidn | [] [] | - lifelines | [] | - lilypond | | - lingoteach | [] | - lynx | [] [] | - m4 | [] [] | - mailutils | | - make | [] [] [] | - man-db | () | - minicom | [] | - mysecretdiary | [] | - nano | [] [] [] | - nano_1_0 | [] [] [] | - opcodes | [] | - parted | [] [] | - pilot-qof | | - psmisc | [] [] [] | - pwdutils | | - python | | - qof | | - radius | | - recode | [] | - rpm | [] [] | - screem | [] | - scrollkeeper | [] [] [] [] | - sed | [] [] | - sh-utils | [] [] | - shared-mime-info | [] [] [] [] [] | - sharutils | [] [] | + libgnutls | [] | + libgpewidget | [] [] | + libgpg-error | [] [] | + libgphoto2 | [] () | + libgphoto2_port | [] () [] | + libgsasl | | + libiconv | [] [] [] [] [] | + libidn | [] [] [] | + lifelines | [] () | + liferea | [] [] [] [] [] | + lilypond | [] [] [] | + linkdr | [] [] [] | + lordsawar | [] | + lprng | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailfromd | | + mailutils | [] | + make | [] [] [] | + man-db | | + man-db-manpages | | + minicom | [] [] [] [] | + mkisofs | | + myserver | | + nano | [] [] [] | + opcodes | [] [] | + parted | [] [] | + pies | | + popt | [] [] [] [] [] | + psmisc | [] [] [] | + pspp | [] | + pwdutils | [] | + radius | [] | + recode | [] [] [] [] [] [] | + rosegarden | () () () | + rpm | [] [] [] | + rush | | + sarg | | + screem | | + scrollkeeper | [] [] [] [] [] | + sed | [] [] [] [] [] [] | + sharutils | [] [] [] [] | shishi | | - silky | [] | - skencil | | - sketch | | - solfege | | - soundtracker | | - sp | () | - stardict | [] [] | - system-tools-ba... | [] [] [] [] | - tar | [] [] [] | - texinfo | [] [] [] | - textutils | [] [] [] | - tin | | - tp-robot | [] | - tuxpaint | [] | + skencil | [] () [] | + solfege | [] [] [] | + solfege-manual | [] [] | + soundtracker | [] [] [] | + sp | [] | + sysstat | [] [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] | + tin | [] [] | unicode-han-tra... | | unicode-transla... | | - util-linux | [] [] | - vorbis-tools | [] | - wastesedge | [] | - wdiff | [] [] | - wget | [] [] | - xchat | [] [] [] [] | - xkeyboard-config | [] | - xpad | [] [] [] | + util-linux-ng | [] [] [] [] | + vice | () () | + vmm | [] | + vorbis-tools | [] [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] [] | + wyslij-po | | + xchat | [] [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] | +-------------------------------------------------+ - ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no - 52 24 2 2 1 3 0 2 3 21 0 15 1 97 5 1 + crh cs da de el en en_GB en_ZA eo es et eu fa + 5 64 105 117 18 1 8 0 28 89 18 19 0 - nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta - +------------------------------------------------------+ - GNUnet | | - a2ps | () [] [] [] [] [] [] | - aegis | () () | - ant-phone | [] [] | - anubis | [] [] [] | - ap-utils | () | - aspell | [] [] | - bash | [] [] [] | - batchelor | [] [] | - bfd | | - bibshelf | [] | - binutils | [] [] | - bison | [] [] [] [] [] | - bison-runtime | [] [] [] [] | - bluez-pin | [] [] [] [] [] [] [] [] [] | - cflow | [] | - clisp | [] | - console-tools | [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - cpplib | [] | - cryptonit | [] [] | - darkstat | [] [] [] [] [] [] | - dialog | [] [] [] [] [] [] [] [] [] | - diffutils | [] [] [] [] [] [] | - doodle | [] [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] [] | - error | [] [] [] [] | - fetchmail | [] [] [] | - fileutils | [] [] [] [] [] | - findutils | [] [] [] [] [] [] | - flex | [] [] [] [] [] | - fslint | [] [] [] [] | - gas | | - gawk | [] [] [] [] | - gbiff | [] | - gcal | [] | - gcc | [] | - gettext-examples | [] [] [] [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] [] [] [] | - gettext-tools | [] [] [] [] [] [] [] | - gimp-print | [] [] | - gip | [] [] [] [] | - gliv | [] [] [] [] | - glunarclock | [] [] [] [] [] [] | - gmult | [] [] [] [] | - gnubiff | () | - gnucash | () [] | - gnucash-glossary | [] [] [] | - gnuedu | | - gnulib | [] [] [] [] [] | - gnunet-gtk | [] | - gnutls | [] [] | - gpe-aerial | [] [] [] [] [] [] [] | - gpe-beam | [] [] [] [] [] [] [] | - gpe-calendar | [] | - gpe-clock | [] [] [] [] [] [] [] [] | - gpe-conf | [] [] [] [] [] [] [] | - gpe-contacts | [] [] [] [] [] | - gpe-edit | [] [] [] [] [] [] [] [] | - gpe-filemanager | [] [] | - gpe-go | [] [] [] [] [] [] | - gpe-login | [] [] [] [] [] [] [] [] | - gpe-ownerinfo | [] [] [] [] [] [] [] [] | - gpe-package | [] [] | - gpe-sketchbook | [] [] [] [] [] [] [] [] | - gpe-su | [] [] [] [] [] [] [] [] | - gpe-taskmanager | [] [] [] [] [] [] [] [] | - gpe-timesheet | [] [] [] [] [] [] [] [] | - gpe-today | [] [] [] [] [] [] [] [] | - gpe-todo | [] [] [] [] | - gphoto2 | [] [] [] [] [] | - gprof | [] [] [] | - gpsdrive | [] [] [] | - gramadoir | [] [] | - grep | [] [] [] [] [] [] [] [] | - gretl | [] | - gsasl | [] [] [] | - gss | [] [] [] | - gst-plugins | [] [] [] [] | - gst-plugins-base | [] | - gst-plugins-good | [] [] [] [] | - gstreamer | [] [] [] | - gtick | [] | - gtkam | [] [] [] [] | - gtkorphan | [] | - gtkspell | [] [] [] [] [] [] [] [] | - gutenprint | [] | - hello | [] [] [] [] [] [] [] [] | - id-utils | [] [] [] [] | - impost | [] | - indent | [] [] [] [] [] [] | - iso_3166 | [] [] [] [] [] [] | - iso_3166_2 | | - iso_4217 | [] [] [] [] | - iso_639 | [] [] [] [] | - jpilot | | - jtag | [] | - jwhois | [] [] [] [] | - kbd | [] [] [] | - keytouch | [] | - keytouch-editor | [] | - keytouch-keyboa... | [] | - latrine | [] [] | - ld | [] | - leafpad | [] [] [] [] [] [] | - libc | [] [] [] [] [] | - libexif | [] | - libextractor | [] [] | - libgpewidget | [] [] [] [] [] [] [] | - libgpg-error | [] [] | - libgphoto2 | [] | - libgphoto2_port | [] [] [] | - libgsasl | [] [] [] [] | - libiconv | [] [] | - libidn | [] [] () | - lifelines | [] [] | - lilypond | | - lingoteach | [] | - lynx | [] [] [] | - m4 | [] [] [] [] [] | - mailutils | [] [] [] [] | - make | [] [] [] [] | - man-db | [] [] | - minicom | [] [] [] [] [] | - mysecretdiary | [] [] [] [] | - nano | [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] | - parted | [] | - pilot-qof | [] | - psmisc | [] [] | - pwdutils | [] [] | - python | | - qof | [] [] | - radius | [] [] | - recode | [] [] [] [] [] [] [] | - rpm | [] [] [] [] | - screem | | - scrollkeeper | [] [] [] [] [] [] [] | - sed | [] [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] | - shared-mime-info | [] [] [] [] [] | - sharutils | [] [] [] [] | - shishi | [] | - silky | [] | - skencil | [] [] [] | - sketch | [] [] [] | - solfege | [] | - soundtracker | [] [] | - sp | | - stardict | [] [] [] | - system-tools-ba... | [] [] [] [] [] [] [] [] [] | - tar | [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] | - tin | () | - tp-robot | [] | - tuxpaint | [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] [] [] | - vorbis-tools | [] [] | - wastesedge | | - wdiff | [] [] [] [] [] [] | - wget | [] [] [] [] | - xchat | [] [] [] [] [] [] [] | - xkeyboard-config | [] [] | - xpad | [] [] [] | - +------------------------------------------------------+ - nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta - 0 2 3 58 30 54 5 73 72 4 40 46 11 50 128 2 + fi fr ga gl gu he hi hr hu hy id is it ja ka kn + +----------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | [] [] | + ant-phone | [] [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] [] | + bibshelf | [] [] [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] | + bison-runtime | [] [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] | + bombono-dvd | [] | + buzztard | [] | + cflow | [] [] [] | + clisp | [] | + coreutils | [] [] [] [] [] | + cpio | [] [] [] [] | + cppi | [] [] | + cpplib | [] [] [] | + cryptsetup | [] [] [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] [] [] [] [] [] | + dink | [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] | + freedink | [] [] [] | + gas | [] [] | + gawk | [] [] [] [] () [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] | + gip | [] [] [] [] [] [] | + gjay | [] | + gliv | [] () | + glunarclock | [] [] [] [] | + gnubiff | () [] () | + gnucash | () () () () () [] | + gnuedu | [] [] | + gnulib | [] [] [] [] [] [] | + gnunet | | + gnunet-gtk | [] | + gnutls | [] [] | + gold | [] [] | + gpe-aerial | [] [] [] | + gpe-beam | [] [] [] [] | + gpe-bluetooth | [] [] [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] [] [] [] | + gpe-conf | [] [] [] [] | + gpe-contacts | [] [] [] [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] [] [] | + gpe-go | [] [] [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] [] [] | + gpe-sketchbook | [] [] [] [] | + gpe-su | [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] | + gpe-todo | [] [] [] | + gphoto2 | [] [] [] [] [] [] | + gprof | [] [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] [] | + grep | [] [] | + grub | [] [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] | + gtkorphan | [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] | + gutenprint | [] [] [] [] | + hello | [] [] [] | + help2man | [] [] | + hylafax | [] | + idutils | [] [] [] [] [] [] | + indent | [] [] [] [] [] [] [] [] | + iso_15924 | [] () [] [] | + iso_3166 | [] () [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | () [] [] [] | + iso_4217 | [] () [] [] [] [] | + iso_639 | [] () [] [] [] [] [] [] [] | + iso_639_3 | () [] [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] [] [] [] [] [] | + keytouch-editor | [] [] [] [] [] | + keytouch-keyboa... | [] [] [] [] [] | + klavaro | [] [] | + latrine | [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] () | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | | + libgnutls | [] [] | + libgpewidget | [] [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] [] | + libidn | [] [] [] [] | + lifelines | () | + liferea | [] [] [] [] | + lilypond | [] [] | + linkdr | [] [] [] [] [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] [] | + m4 | [] [] [] [] [] [] | + mailfromd | | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] [] | + man-db | [] [] | + man-db-manpages | [] | + minicom | [] [] [] [] [] | + mkisofs | [] [] [] [] | + myserver | | + nano | [] [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] [] | + pies | | + popt | [] [] [] [] [] [] [] [] [] | + psmisc | [] [] [] | + pspp | | + pwdutils | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rosegarden | () () () () () | + rpm | [] [] | + rush | | + sarg | [] | + screem | [] [] | + scrollkeeper | [] [] [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] | + shishi | [] | + skencil | [] | + solfege | [] [] [] [] | + solfege-manual | [] [] | + soundtracker | [] [] | + sp | [] () | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] [] [] | + texinfo | [] [] [] [] | + tin | [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux-ng | [] [] [] [] [] [] | + vice | () () () | + vmm | [] | + vorbis-tools | [] | + wastesedge | () () | + wdiff | [] | + wget | [] [] [] [] [] [] [] [] | + wyslij-po | [] [] [] | + xchat | [] [] [] [] [] [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] | + +----------------------------------------------------+ + fi fr ga gl gu he hi hr hu hy id is it ja ka kn + 105 121 53 20 4 8 3 5 53 2 120 5 84 67 0 4 - tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne + +-----------------------------------------------+ + a2ps | [] | + aegis | | + ant-phone | | + anubis | [] [] | + aspell | [] | + bash | | + bfd | | + bibshelf | [] [] | + binutils | | + bison | [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + bombono-dvd | | + buzztard | | + cflow | | + clisp | | + coreutils | [] | + cpio | | + cppi | | + cpplib | | + cryptsetup | | + dfarc | [] | + dialog | [] [] [] [] [] | + dico | | + diffutils | [] [] | + dink | | + doodle | | + e2fsprogs | | + enscript | | + exif | [] | + fetchmail | | + findutils | | + flex | | + freedink | [] | + gas | | + gawk | | + gcal | | + gcc | | + gettext-examples | [] [] [] [] | + gettext-runtime | [] | + gettext-tools | [] | + gip | [] [] | + gjay | | + gliv | | + glunarclock | [] | + gnubiff | | + gnucash | () () () () | + gnuedu | | + gnulib | | + gnunet | | + gnunet-gtk | | + gnutls | [] | + gold | | + gpe-aerial | [] | + gpe-beam | [] | + gpe-bluetooth | [] [] | + gpe-calendar | [] | + gpe-clock | [] [] [] [] [] | + gpe-conf | [] [] | + gpe-contacts | [] [] | + gpe-edit | [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] | + gpe-login | [] | + gpe-ownerinfo | [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] | + gpe-timesheet | [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] [] | + gphoto2 | | + gprof | [] | + gpsdrive | | + gramadoir | | + grep | | + grub | | + gsasl | | + gss | | + gst-plugins-bad | [] [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | | + gtick | | + gtkam | [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] [] | + gutenprint | | + hello | [] [] [] | + help2man | | + hylafax | | + idutils | | + indent | | + iso_15924 | [] [] | + iso_3166 | [] [] () [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] | + iso_639 | [] [] | + iso_639_3 | [] | + jwhois | [] | + kbd | | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + klavaro | [] | + latrine | [] | + ld | | + leafpad | [] [] [] | + libc | [] | + libexif | | + libextractor | | + libgnutls | [] | + libgpewidget | [] [] | + libgpg-error | | + libgphoto2 | | + libgphoto2_port | | + libgsasl | | + libiconv | | + libidn | | + lifelines | | + liferea | | + lilypond | | + linkdr | | + lordsawar | | + lprng | | + lynx | | + m4 | | + mailfromd | | + mailutils | | + make | [] | + man-db | | + man-db-manpages | | + minicom | [] | + mkisofs | | + myserver | | + nano | [] [] | + opcodes | | + parted | | + pies | | + popt | [] [] [] | + psmisc | | + pspp | | + pwdutils | | + radius | | + recode | | + rosegarden | | + rpm | | + rush | | + sarg | | + screem | | + scrollkeeper | [] [] | + sed | | + sharutils | | + shishi | | + skencil | | + solfege | [] | + solfege-manual | | + soundtracker | | + sp | | + sysstat | [] | + tar | [] | + texinfo | [] | + tin | | + unicode-han-tra... | | + unicode-transla... | | + util-linux-ng | | + vice | | + vmm | | + vorbis-tools | | + wastesedge | | + wdiff | | + wget | [] | + wyslij-po | | + xchat | [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +-----------------------------------------------+ + ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne + 20 5 10 1 13 48 4 2 2 4 24 10 20 3 1 + + nl nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr +---------------------------------------------------+ - GNUnet | [] | 2 - a2ps | [] [] [] | 19 - aegis | | 0 - ant-phone | [] [] | 6 - anubis | [] [] [] | 11 - ap-utils | () [] | 4 - aspell | [] [] [] | 15 - bash | [] | 11 - batchelor | [] [] | 9 - bfd | | 1 - bibshelf | [] | 7 - binutils | [] [] [] | 9 - bison | [] [] [] | 19 - bison-runtime | [] [] [] | 15 - bluez-pin | [] [] [] [] [] [] | 28 - cflow | [] [] | 5 - clisp | | 6 - console-tools | [] [] | 5 - coreutils | [] [] | 16 - cpio | [] [] [] | 9 - cpplib | [] [] [] [] | 11 - cryptonit | | 5 - darkstat | [] () () | 15 - dialog | [] [] [] [] [] | 30 - diffutils | [] [] [] [] | 28 - doodle | [] | 6 - e2fsprogs | [] [] | 10 - enscript | [] [] [] | 16 - error | [] [] [] [] | 18 - fetchmail | [] [] | 12 - fileutils | [] [] [] | 18 - findutils | [] [] [] | 17 - flex | [] [] | 15 - fslint | [] | 9 - gas | [] | 3 - gawk | [] [] | 15 - gbiff | [] | 5 - gcal | [] | 5 - gcc | [] [] [] | 6 - gettext-examples | [] [] [] [] [] [] | 27 - gettext-runtime | [] [] [] [] [] [] | 28 - gettext-tools | [] [] [] [] [] | 19 - gimp-print | [] [] | 12 - gip | [] [] | 12 - gliv | [] [] | 8 - glunarclock | [] [] [] | 15 - gmult | [] [] [] [] | 15 - gnubiff | [] | 1 - gnucash | () | 2 - gnucash-glossary | [] [] | 9 - gnuedu | [] | 2 - gnulib | [] [] [] [] [] | 28 - gnunet-gtk | | 1 - gnutls | | 2 - gpe-aerial | [] [] | 14 - gpe-beam | [] [] | 14 - gpe-calendar | [] | 3 - gpe-clock | [] [] [] [] | 21 - gpe-conf | [] [] | 14 - gpe-contacts | [] [] | 10 - gpe-edit | [] [] [] [] | 20 - gpe-filemanager | [] | 6 - gpe-go | [] [] | 15 - gpe-login | [] [] [] [] [] | 21 - gpe-ownerinfo | [] [] [] [] | 21 - gpe-package | [] | 6 - gpe-sketchbook | [] [] | 16 - gpe-su | [] [] [] | 20 - gpe-taskmanager | [] [] [] | 20 - gpe-timesheet | [] [] [] [] | 18 - gpe-today | [] [] [] [] [] | 21 - gpe-todo | [] | 7 - gphoto2 | [] [] [] [] | 20 - gprof | [] [] | 11 - gpsdrive | | 4 - gramadoir | [] | 7 - grep | [] [] [] [] | 34 - gretl | | 4 - gsasl | [] [] | 8 - gss | [] | 5 - gst-plugins | [] [] [] | 15 - gst-plugins-base | [] [] [] | 9 - gst-plugins-good | [] [] [] [] [] | 20 - gstreamer | [] [] [] | 17 - gtick | [] | 3 - gtkam | [] | 13 - gtkorphan | [] | 7 - gtkspell | [] [] [] [] [] [] | 26 - gutenprint | | 3 - hello | [] [] [] [] [] | 37 - id-utils | [] [] | 14 - impost | [] | 4 - indent | [] [] [] [] | 25 - iso_3166 | [] [] [] [] | 16 - iso_3166_2 | | 2 - iso_4217 | [] [] | 14 - iso_639 | [] | 14 - jpilot | [] [] [] [] | 7 - jtag | [] | 3 - jwhois | [] [] [] | 13 - kbd | [] [] | 12 - keytouch | [] | 4 - keytouch-editor | | 2 - keytouch-keyboa... | [] | 3 - latrine | [] [] | 8 - ld | [] [] [] [] | 8 - leafpad | [] [] [] [] | 23 - libc | [] [] [] | 23 - libexif | [] | 4 - libextractor | [] | 5 - libgpewidget | [] [] [] | 19 - libgpg-error | [] | 4 - libgphoto2 | [] | 8 - libgphoto2_port | [] [] [] | 11 - libgsasl | [] | 8 - libiconv | [] | 7 - libidn | [] [] | 10 - lifelines | | 4 - lilypond | | 2 - lingoteach | [] | 6 - lynx | [] [] [] | 15 - m4 | [] [] [] | 18 - mailutils | [] | 8 - make | [] [] [] | 20 - man-db | [] | 6 - minicom | [] | 14 - mysecretdiary | [] [] | 12 - nano | [] [] | 17 - nano_1_0 | [] [] [] | 18 - opcodes | [] [] | 10 - parted | [] [] [] | 10 - pilot-qof | [] | 3 - psmisc | [] | 10 - pwdutils | [] | 3 - python | | 0 - qof | [] | 4 - radius | [] | 6 - recode | [] [] [] | 25 - rpm | [] [] [] [] | 14 - screem | [] | 2 - scrollkeeper | [] [] [] [] | 26 - sed | [] [] [] | 22 - sh-utils | [] | 15 - shared-mime-info | [] [] [] [] | 24 - sharutils | [] [] [] | 23 - shishi | | 1 - silky | [] | 4 - skencil | [] | 7 - sketch | | 6 - solfege | | 2 - soundtracker | [] [] | 9 - sp | [] | 3 - stardict | [] [] [] [] | 11 - system-tools-ba... | [] [] [] [] [] [] [] | 37 - tar | [] [] [] [] | 20 - texinfo | [] [] [] | 15 - textutils | [] [] [] | 17 - tin | | 1 - tp-robot | [] [] [] | 10 - tuxpaint | [] [] [] | 16 + a2ps | [] [] [] [] [] [] [] [] | + aegis | [] [] [] | + ant-phone | [] [] | + anubis | [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] | + bfd | [] | + bibshelf | [] [] | + binutils | [] [] | + bison | [] [] [] | + bison-runtime | [] [] [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] | + bombono-dvd | [] () | + buzztard | [] [] | + cflow | [] | + clisp | [] [] | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cppi | [] | + cpplib | [] | + cryptsetup | [] | + dfarc | [] | + dialog | [] [] [] [] | + dico | [] | + diffutils | [] [] [] [] [] [] | + dink | () | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + exif | [] [] [] () [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] [] | + freedink | [] [] | + gas | | + gawk | [] [] [] [] | + gcal | | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] | + gip | [] [] [] [] [] | + gjay | | + gliv | [] [] [] [] [] [] | + glunarclock | [] [] [] [] [] | + gnubiff | [] () | + gnucash | [] () () () | + gnuedu | [] | + gnulib | [] [] [] [] | + gnunet | | + gnunet-gtk | | + gnutls | [] [] | + gold | | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-bluetooth | [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] [] | + gpe-go | [] [] [] [] [] [] [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] [] | + gphoto2 | [] [] [] [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] | + gramadoir | [] [] | + grep | [] [] [] [] | + grub | [] [] [] | + gsasl | [] [] [] [] | + gss | [] [] [] | + gst-plugins-bad | [] [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] [] [] | + gutenprint | [] [] | + hello | [] [] [] [] | + help2man | [] [] | + hylafax | [] | + idutils | [] [] [] [] [] | + indent | [] [] [] [] [] [] [] | + iso_15924 | [] [] [] [] | + iso_3166 | [] [] [] [] [] () [] [] [] [] [] [] [] [] | + iso_3166_2 | [] [] [] | + iso_4217 | [] [] [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] [] [] | + keytouch-editor | [] [] [] | + keytouch-keyboa... | [] [] [] | + klavaro | [] [] | + latrine | [] [] | + ld | | + leafpad | [] [] [] [] [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] [] () [] | + libextractor | | + libgnutls | [] [] | + libgpewidget | [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | [] [] | + lifelines | [] [] | + liferea | [] [] [] [] [] () () [] | + lilypond | [] | + linkdr | [] [] [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] | + make | [] [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] [] | + minicom | [] [] [] [] | + mkisofs | [] [] [] | + myserver | | + nano | [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] | + pies | [] | + popt | [] [] [] [] | + psmisc | [] [] [] | + pspp | [] [] | + pwdutils | [] | + radius | [] [] [] | + recode | [] [] [] [] [] [] [] [] | + rosegarden | () () | + rpm | [] [] [] | + rush | [] [] | + sarg | | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + skencil | [] [] | + solfege | [] [] [] [] | + solfege-manual | [] [] [] | + soundtracker | [] | + sp | | + sysstat | [] [] [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + tin | [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux-ng | [] [] [] [] [] | + vice | [] | + vmm | [] | + vorbis-tools | [] [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] [] [] [] [] [] | + wyslij-po | [] [] [] | + xchat | [] [] [] [] [] [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +---------------------------------------------------+ + nl nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + 135 10 4 7 105 1 29 62 47 91 3 54 46 9 37 + + sv sw ta te tg th tr uk vi wa zh_CN zh_HK zh_TW + +---------------------------------------------------+ + a2ps | [] [] [] [] [] | 27 + aegis | [] | 9 + ant-phone | [] [] [] [] | 9 + anubis | [] [] [] [] | 15 + aspell | [] [] [] | 20 + bash | [] [] [] | 12 + bfd | [] | 6 + bibshelf | [] [] [] | 16 + binutils | [] [] | 8 + bison | [] [] | 12 + bison-runtime | [] [] [] [] [] [] | 29 + bluez-pin | [] [] [] [] [] [] [] [] | 37 + bombono-dvd | [] | 4 + buzztard | [] | 7 + cflow | [] [] [] | 9 + clisp | | 10 + coreutils | [] [] [] [] | 22 + cpio | [] [] [] [] [] [] | 13 + cppi | [] [] | 5 + cpplib | [] [] [] [] [] [] | 14 + cryptsetup | [] [] | 7 + dfarc | [] | 9 + dialog | [] [] [] [] [] [] [] | 30 + dico | [] | 2 + diffutils | [] [] [] [] [] [] | 30 + dink | | 4 + doodle | [] [] | 7 + e2fsprogs | [] [] [] | 11 + enscript | [] [] [] [] | 17 + exif | [] [] [] | 16 + fetchmail | [] [] [] | 17 + findutils | [] [] [] [] [] | 20 + flex | [] [] [] [] | 15 + freedink | [] | 10 + gas | [] | 4 + gawk | [] [] [] [] | 18 + gcal | [] [] | 5 + gcc | [] [] [] | 7 + gettext-examples | [] [] [] [] [] [] [] | 34 + gettext-runtime | [] [] [] [] [] [] [] | 29 + gettext-tools | [] [] [] [] [] [] | 22 + gip | [] [] [] [] | 22 + gjay | [] | 3 + gliv | [] [] [] | 14 + glunarclock | [] [] [] [] [] | 19 + gnubiff | [] [] | 4 + gnucash | () [] () [] () | 10 + gnuedu | [] [] | 7 + gnulib | [] [] [] [] | 16 + gnunet | [] | 1 + gnunet-gtk | [] [] [] | 5 + gnutls | [] [] [] | 10 + gold | [] | 4 + gpe-aerial | [] [] [] | 18 + gpe-beam | [] [] [] | 19 + gpe-bluetooth | [] [] [] | 13 + gpe-calendar | [] [] [] [] | 12 + gpe-clock | [] [] [] [] [] | 28 + gpe-conf | [] [] [] [] | 20 + gpe-contacts | [] [] [] | 17 + gpe-edit | [] [] [] | 12 + gpe-filemanager | [] [] [] [] | 16 + gpe-go | [] [] [] [] [] | 25 + gpe-login | [] [] [] | 11 + gpe-ownerinfo | [] [] [] [] [] | 25 + gpe-package | [] [] [] | 13 + gpe-sketchbook | [] [] [] | 20 + gpe-su | [] [] [] [] [] | 30 + gpe-taskmanager | [] [] [] [] [] | 29 + gpe-timesheet | [] [] [] [] [] | 25 + gpe-today | [] [] [] [] [] [] | 30 + gpe-todo | [] [] [] [] | 17 + gphoto2 | [] [] [] [] [] | 24 + gprof | [] [] [] | 15 + gpsdrive | [] [] [] | 11 + gramadoir | [] [] [] | 11 + grep | [] [] [] | 10 + grub | [] [] [] | 14 + gsasl | [] [] [] [] | 14 + gss | [] [] [] | 11 + gst-plugins-bad | [] [] [] [] | 26 + gst-plugins-base | [] [] [] [] [] | 24 + gst-plugins-good | [] [] [] [] | 24 + gst-plugins-ugly | [] [] [] [] [] | 29 + gstreamer | [] [] [] [] | 22 + gtick | [] [] [] | 13 + gtkam | [] [] [] | 20 + gtkorphan | [] [] [] | 14 + gtkspell | [] [] [] [] [] [] [] [] [] | 45 + gutenprint | [] | 10 + hello | [] [] [] [] [] [] | 21 + help2man | [] [] | 7 + hylafax | [] | 5 + idutils | [] [] [] [] | 17 + indent | [] [] [] [] [] [] | 30 + iso_15924 | () [] () [] [] | 16 + iso_3166 | [] [] () [] [] () [] [] [] () | 53 + iso_3166_2 | () [] () [] | 9 + iso_4217 | [] () [] [] () [] [] | 26 + iso_639 | [] [] [] () [] () [] [] [] [] | 38 + iso_639_3 | [] () | 8 + jwhois | [] [] [] [] [] | 16 + kbd | [] [] [] [] [] | 15 + keytouch | [] [] [] | 16 + keytouch-editor | [] [] [] | 14 + keytouch-keyboa... | [] [] [] | 14 + klavaro | [] | 11 + latrine | [] [] [] | 10 + ld | [] [] [] [] | 11 + leafpad | [] [] [] [] [] [] | 33 + libc | [] [] [] [] [] | 21 + libexif | [] () | 7 + libextractor | [] | 1 + libgnutls | [] [] [] | 9 + libgpewidget | [] [] [] | 14 + libgpg-error | [] [] [] | 9 + libgphoto2 | [] [] | 8 + libgphoto2_port | [] [] [] [] | 14 + libgsasl | [] [] [] | 13 + libiconv | [] [] [] [] | 21 + libidn | () [] [] | 11 + lifelines | [] | 4 + liferea | [] [] [] | 21 + lilypond | [] | 7 + linkdr | [] [] [] [] [] | 17 + lordsawar | | 1 + lprng | [] | 3 + lynx | [] [] [] [] | 17 + m4 | [] [] [] [] | 19 + mailfromd | [] [] | 3 + mailutils | [] | 5 + make | [] [] [] [] | 21 + man-db | [] [] [] | 8 + man-db-manpages | | 4 + minicom | [] [] | 16 + mkisofs | [] [] | 9 + myserver | | 0 + nano | [] [] [] [] | 21 + opcodes | [] [] [] | 11 + parted | [] [] [] [] [] | 15 + pies | [] [] | 3 + popt | [] [] [] [] [] [] | 27 + psmisc | [] [] | 11 + pspp | | 4 + pwdutils | [] [] | 6 + radius | [] [] | 9 + recode | [] [] [] [] | 28 + rosegarden | () | 0 + rpm | [] [] [] | 11 + rush | [] [] | 4 + sarg | | 1 + screem | [] | 3 + scrollkeeper | [] [] [] [] [] | 27 + sed | [] [] [] [] [] | 30 + sharutils | [] [] [] [] [] | 22 + shishi | [] | 3 + skencil | [] [] | 7 + solfege | [] [] [] [] | 16 + solfege-manual | [] | 8 + soundtracker | [] [] [] | 9 + sp | [] | 3 + sysstat | [] [] | 15 + tar | [] [] [] [] [] [] | 23 + texinfo | [] [] [] [] [] | 17 + tin | | 4 unicode-han-tra... | | 0 unicode-transla... | | 2 - util-linux | [] [] [] | 20 - vorbis-tools | [] [] | 11 - wastesedge | | 1 - wdiff | [] [] | 22 - wget | [] [] [] | 19 - xchat | [] [] [] [] | 29 - xkeyboard-config | [] [] [] [] | 11 - xpad | [] [] [] | 14 + util-linux-ng | [] [] [] [] | 20 + vice | () () | 1 + vmm | [] | 4 + vorbis-tools | [] | 6 + wastesedge | | 2 + wdiff | [] [] | 7 + wget | [] [] [] [] [] | 26 + wyslij-po | [] [] | 8 + xchat | [] [] [] [] [] [] | 36 + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | 63 + xkeyboard-config | [] [] [] | 22 +---------------------------------------------------+ - 77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu - 170 domains 0 1 1 77 39 0 136 10 1 48 5 54 0 2028 + 85 teams sv sw ta te tg th tr uk vi wa zh_CN zh_HK zh_TW + 178 domains 119 1 3 3 0 10 65 51 155 17 98 7 41 2618 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are @@ -1075,12 +1256,12 @@ distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. - If October 2006 seems to be old, you may fetch a more recent copy of + If June 2010 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at -`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. +`http://translationproject.org/extra/matrix.html'. -1.6 Using `gettext' in new packages +1.5 Using `gettext' in new packages =================================== If you are writing a freely available program and want to @@ -1096,6 +1277,6 @@ the use of `gettext' the only thing missing are the translations. The Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact -`translation@iro.umontreal.ca' to make the `.pot' files available to -the translation teams. +`coordinator@translationproject.org' to make the `.pot' files available +to the translation teams. diff --git a/BSD.txt b/BSD.txt index ae21308f..03476b75 100644 --- a/BSD.txt +++ b/BSD.txt @@ -42,3 +42,33 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------- +NASM is now licensed under the 2-clause BSD license, also known as the +simplified BSD license. + + Copyright 1996-2009 the NASM Authors - All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following + conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..9e1bb76b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.4...4.0) +PROJECT(yasm) +if (COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) +endif (COMMAND cmake_policy) + +OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON) + +# Where to look first for cmake modules +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") + +INCLUDE(YasmMacros) +INCLUDE(VersionGen) + +OPTION(ENABLE_NLS "Enable message translations" OFF) + +OPTION(YASM_BUILD_TESTS "Enable building of tests" ON) + +IF(YASM_BUILD_TESTS) + ENABLE_TESTING() +ENDIF(YASM_BUILD_TESTS) + +# Default build type to debug if not set +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE Debug CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) +ENDIF(NOT CMAKE_BUILD_TYPE) + +VERSION_GEN(PACKAGE_VERSION "${CMAKE_BINARY_DIR}/YASM-VERSION-FILE" "1.3.0") + +set (PACKAGE_STRING "yasm ${PACKAGE_VERSION}") + +INCLUDE_DIRECTORIES(AFTER ${CMAKE_BINARY_DIR} ${yasm_SOURCE_DIR}) + +INCLUDE(ConfigureChecks.cmake) + +ADD_SUBDIRECTORY(tools) +ADD_SUBDIRECTORY(libyasm) +ADD_SUBDIRECTORY(modules) +ADD_SUBDIRECTORY(frontends) + +INSTALL(FILES + libyasm.h + ${CMAKE_BINARY_DIR}/libyasm-stdint.h + DESTINATION include + ) diff --git a/COPYING b/COPYING index 5e9221f9..430673b7 100644 --- a/COPYING +++ b/COPYING @@ -1,15 +1,17 @@ -Yasm is Copyright (c) 2001-2007 Peter Johnson and other Yasm developers. +Yasm is Copyright (c) 2001-2014 Peter Johnson and other Yasm developers. Yasm developers and/or contributors include: Peter Johnson Michael Urman - Brian Gladman (VC8 build files, other fixes) + Brian Gladman (Visual Studio build files, other fixes) Stanislav Karchebny (options parser) - Mathieu Monnier (SSE4 instruction patches) + Mathieu Monnier (SSE4 instruction patches, NASM preprocessor additions) Anonymous "NASM64" developer (NASM preprocessor fixes) Stephen Polkowski (x86 instruction patches) Henryk Richter (Mach-O object format) Ben Skeggs (patches, bug reports) + Alexei Svitkine (GAS preprocessor) + Samuel Thibault (TASM parser and frontend) ----------------------------------- Yasm licensing overview and summary @@ -38,8 +40,7 @@ bitvect) are fulfilled. ------- Modules ------- -The modules are 2-clause or 3-clause BSD licensed, with the exception of: - preprocs/nasm - LGPL licensed +The modules are 2-clause or 3-clause BSD licensed. --------- Frontends diff --git a/ChangeLog b/ChangeLog index e69de29b..1f6ad37d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -0,0 +1,11 @@ +2014-08-10 gettextize + + * m4/gettext.m4: Upgrade to gettext-0.18.3. + * m4/iconv.m4: Upgrade to gettext-0.18.3. + * m4/lib-ld.m4: Upgrade to gettext-0.18.3. + * m4/lib-link.m4: Upgrade to gettext-0.18.3. + * m4/lib-prefix.m4: Upgrade to gettext-0.18.3. + * m4/nls.m4: Upgrade to gettext-0.18.3. + * m4/po.m4: Upgrade to gettext-0.18.3. + * m4/progtest.m4: Upgrade to gettext-0.18.3. + diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 00000000..1eb43acf --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,76 @@ +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckCCompilerFlag) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckIncludeFile) +INCLUDE(CheckSymbolExists) +INCLUDE(CheckTypeSize) +INCLUDE(CheckLibraryExists) + +FIND_PROGRAM(CPP_PROG NAMES cpp) + +# Platform-specific include files (POSIX, Win32) +CHECK_INCLUDE_FILE(locale.h HAVE_LOCALE_H) +CHECK_INCLUDE_FILE(libgen.h HAVE_LIBGEN_H) +CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILE(direct.h HAVE_DIRECT_H) +CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) + +CHECK_SYMBOL_EXISTS(abort "stdlib.h" HAVE_ABORT) + +CHECK_FUNCTION_EXISTS(getcwd HAVE_GETCWD) +CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP) +CHECK_FUNCTION_EXISTS(toascii HAVE_TOASCII) + +CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) + +IF (HAVE_LIBDL) + SET(LIBDL "dl") +ELSE (HAVE_LIBDL) + SET(LIBDL "") +ENDIF (HAVE_LIBDL) + +CONFIGURE_FILE(libyasm-stdint.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libyasm-stdint.h) +CONFIGURE_FILE(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +ADD_DEFINITIONS(-DHAVE_CONFIG_H) + +FIND_PACKAGE(Python3 REQUIRED COMPONENTS Interpreter) +set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") +IF (NOT PYTHON_EXECUTABLE) + MESSAGE(FATAL_ERROR "Could not find Python executable") +ENDIF (NOT PYTHON_EXECUTABLE) + +IF (CMAKE_COMPILER_IS_GNUCXX) + CHECK_C_COMPILER_FLAG(-pipe C_ACCEPTS_PIPE) + CHECK_C_COMPILER_FLAG(-ansi C_ACCEPTS_ANSI) + CHECK_C_COMPILER_FLAG(-pedantic C_ACCEPTS_PEDANTIC) + CHECK_C_COMPILER_FLAG(-Wall C_ACCEPTS_WALL) + CHECK_C_COMPILER_FLAG(-Wno-unused-parameter C_ACCEPTS_WNOUNUSEDPARAM) + + IF (C_ACCEPTS_PIPE) + ADD_DEFINITIONS(-pipe) + ENDIF (C_ACCEPTS_PIPE) + + IF (C_ACCEPTS_ANSI) + ADD_DEFINITIONS(-ansi) + ENDIF (C_ACCEPTS_ANSI) + + IF (C_ACCEPTS_PEDANTIC) + ADD_DEFINITIONS(-pedantic) + ENDIF (C_ACCEPTS_PEDANTIC) + + IF (C_ACCEPTS_WALL) + ADD_DEFINITIONS(-Wall) + ENDIF (C_ACCEPTS_WALL) + + IF (C_ACCEPTS_WNOUNUSEDPARAM) + ADD_DEFINITIONS(-Wno-unused-parameter) + ENDIF (C_ACCEPTS_WNOUNUSEDPARAM) +ENDIF (CMAKE_COMPILER_IS_GNUCXX) + +# Disable some annoying Visual Studio warnings +IF (MSVC) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) + ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS) +ENDIF (MSVC) diff --git a/HACKING b/HACKING index bc85acc5..0c565b87 100644 --- a/HACKING +++ b/HACKING @@ -1,5 +1,3 @@ -$Id$ - If you are contributing code to the YASM project or trying to compile YASM from a CVS checkout, please read this first. @@ -66,7 +64,7 @@ requires in a packaged distribution. Programs required: * m4 * gettext * make (GNU preferred) - * bison + * Python * gcc To rebuild the manpages from the DocBook XML files, the program "xmlto" and diff --git a/INSTALL b/INSTALL index b42a17ac..29a2b29e 100644 --- a/INSTALL +++ b/INSTALL @@ -51,6 +51,18 @@ The simplest way to compile this package is: all sorts of other programs in order to regenerate files that came with the distribution. +Installation using vcpkg +================== +You can build and install yasm using [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: + + `git clone https://github.com/Microsoft/vcpkg.git' + `cd vcpkg' + `./bootstrap-vcpkg.sh' # `./bootstrap-vcpkg.bat' for Windows + `./vcpkg integrate install' + `./vcpkg install yasm' + +The yasm port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + Compilers and Options ===================== diff --git a/Makefile.am b/Makefile.am index 31af44d8..d955a229 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,12 +1,12 @@ -# $Id$ - SUBDIRS = po . +ACLOCAL_AMFLAGS = -I m4 AM_YFLAGS = -d AM_CFLAGS = @MORE_CFLAGS@ bin_PROGRAMS = dist_man_MANS = +notrans_dist_man_MANS = TESTS = TESTS_ENVIRONMENT = noinst_PROGRAMS = genstring @@ -21,6 +21,9 @@ nodist_include_HEADERS = libyasm-stdint.h noinst_HEADERS = util.h BUILT_SOURCES = +MAINTAINERCLEANFILES = +DISTCLEANFILES = +SUFFIXES = # configure.lineno doesn't clean up after itself? CLEANFILES = configure.lineno @@ -28,9 +31,8 @@ EXTRA_DIST = config/config.rpath # libyasm-stdint.h doesn't clean up after itself? CONFIG_CLEAN_FILES = libyasm-stdint.h - -# automake doesn't distribute mkinstalldirs? -EXTRA_DIST += config/mkinstalldirs +CONFIG_CLEAN_FILES += YASM-VERSION-FILE +CONFIG_CLEAN_FILES += YASM-VERSION.h EXTRA_DIST += tools/Makefile.inc EXTRA_DIST += libyasm/Makefile.inc @@ -55,54 +57,78 @@ EXTRA_DIST += BSD.txt EXTRA_DIST += GNU_GPL-2.0 EXTRA_DIST += GNU_LGPL-2.0 EXTRA_DIST += splint.sh +EXTRA_DIST += YASM-VERSION-GEN.sh +EXTRA_DIST += CMakeLists.txt +EXTRA_DIST += ConfigureChecks.cmake +EXTRA_DIST += config.h.cmake +EXTRA_DIST += libyasm-stdint.h.cmake +EXTRA_DIST += cmake/CMakeLists.txt +EXTRA_DIST += cmake/modules/CMakeLists.txt +EXTRA_DIST += cmake/modules/DummyCFile.c +EXTRA_DIST += cmake/modules/VersionGen.cmake +EXTRA_DIST += cmake/modules/YasmMacros.cmake +EXTRA_DIST += frontends/CMakeLists.txt +EXTRA_DIST += frontends/tasm/CMakeLists.txt +EXTRA_DIST += frontends/vsyasm/CMakeLists.txt +EXTRA_DIST += frontends/yasm/CMakeLists.txt +EXTRA_DIST += frontends/yasm/genstring.py +EXTRA_DIST += frontends/yasm/yasm-plugin.c +EXTRA_DIST += frontends/yasm/yasm-plugin.h +EXTRA_DIST += libyasm/CMakeLists.txt +EXTRA_DIST += libyasm/cmake-module.c +EXTRA_DIST += modules/arch/CMakeLists.txt +EXTRA_DIST += modules/arch/lc3b/CMakeLists.txt +EXTRA_DIST += modules/arch/x86/CMakeLists.txt +EXTRA_DIST += modules/CMakeLists.txt +EXTRA_DIST += modules/dbgfmts/CMakeLists.txt +EXTRA_DIST += modules/dbgfmts/codeview/CMakeLists.txt +EXTRA_DIST += modules/dbgfmts/dwarf2/CMakeLists.txt +EXTRA_DIST += modules/dbgfmts/null/CMakeLists.txt +EXTRA_DIST += modules/dbgfmts/stabs/CMakeLists.txt +EXTRA_DIST += modules/listfmts/CMakeLists.txt +EXTRA_DIST += modules/listfmts/nasm/CMakeLists.txt +EXTRA_DIST += modules/objfmts/bin/CMakeLists.txt +EXTRA_DIST += modules/objfmts/CMakeLists.txt +EXTRA_DIST += modules/objfmts/coff/CMakeLists.txt +EXTRA_DIST += modules/objfmts/dbg/CMakeLists.txt +EXTRA_DIST += modules/objfmts/elf/CMakeLists.txt +EXTRA_DIST += modules/objfmts/macho/CMakeLists.txt +EXTRA_DIST += modules/objfmts/rdf/CMakeLists.txt +EXTRA_DIST += modules/objfmts/xdf/CMakeLists.txt +EXTRA_DIST += modules/parsers/CMakeLists.txt +EXTRA_DIST += modules/parsers/gas/CMakeLists.txt +EXTRA_DIST += modules/parsers/nasm/CMakeLists.txt +EXTRA_DIST += modules/preprocs/CMakeLists.txt +EXTRA_DIST += modules/preprocs/cpp/CMakeLists.txt +EXTRA_DIST += modules/preprocs/gas/CMakeLists.txt +EXTRA_DIST += modules/preprocs/nasm/CMakeLists.txt +EXTRA_DIST += modules/preprocs/raw/CMakeLists.txt +EXTRA_DIST += plugins/README +EXTRA_DIST += plugins/dbg/CMakeLists.txt +EXTRA_DIST += plugins/dbg/dbg-objfmt.c +EXTRA_DIST += plugins/dbg/init_plugin.c +EXTRA_DIST += plugins/dbg/README +EXTRA_DIST += plugins/x86/CMakeLists.txt +EXTRA_DIST += plugins/x86/init_plugin.c +EXTRA_DIST += plugins/x86/README +EXTRA_DIST += tools/CMakeLists.txt +EXTRA_DIST += tools/genmacro/CMakeLists.txt +EXTRA_DIST += tools/genperf/CMakeLists.txt +EXTRA_DIST += tools/re2c/CMakeLists.txt EXTRA_DIST += Mkfiles/Makefile.flat EXTRA_DIST += Mkfiles/Makefile.dj EXTRA_DIST += Mkfiles/dj/config.h EXTRA_DIST += Mkfiles/dj/libyasm-stdint.h -EXTRA_DIST += Mkfiles/vc/yasm.sln -EXTRA_DIST += Mkfiles/vc/yasm.vcproj -EXTRA_DIST += Mkfiles/vc/config.h -EXTRA_DIST += Mkfiles/vc/libyasm-stdint.h -EXTRA_DIST += Mkfiles/vc/genmacro/genmacro.vcproj -EXTRA_DIST += Mkfiles/vc/genmacro/run.bat -EXTRA_DIST += Mkfiles/vc/genmodule/genmodule.vcproj -EXTRA_DIST += Mkfiles/vc/genmodule/run.bat -EXTRA_DIST += Mkfiles/vc/genstring/genstring.vcproj -EXTRA_DIST += Mkfiles/vc/genstring/run.bat -EXTRA_DIST += Mkfiles/vc/genversion/genversion.vcproj -EXTRA_DIST += Mkfiles/vc/genversion/run.bat -EXTRA_DIST += Mkfiles/vc/libyasm/libyasm.vcproj -EXTRA_DIST += Mkfiles/vc/modules/modules.vcproj -EXTRA_DIST += Mkfiles/vc/re2c/re2c.vcproj -EXTRA_DIST += Mkfiles/vc/re2c/run.bat -EXTRA_DIST += Mkfiles/vc/gap/gap.vcproj -EXTRA_DIST += Mkfiles/vc/gap/run.bat -EXTRA_DIST += Mkfiles/vc8/crt_secure_no_deprecate.vsprops -EXTRA_DIST += Mkfiles/vc8/yasm.sln -EXTRA_DIST += Mkfiles/vc8/yasm.vcproj -EXTRA_DIST += Mkfiles/vc8/config.h -EXTRA_DIST += Mkfiles/vc8/libyasm-stdint.h -EXTRA_DIST += Mkfiles/vc8/readme.vc8.txt -EXTRA_DIST += Mkfiles/vc8/yasm.rules -EXTRA_DIST += Mkfiles/vc8/genmacro/genmacro.vcproj -EXTRA_DIST += Mkfiles/vc8/genmacro/run.bat -EXTRA_DIST += Mkfiles/vc8/genmodule/genmodule.vcproj -EXTRA_DIST += Mkfiles/vc8/genmodule/run.bat -EXTRA_DIST += Mkfiles/vc8/genstring/genstring.vcproj -EXTRA_DIST += Mkfiles/vc8/genstring/run.bat -EXTRA_DIST += Mkfiles/vc8/genversion/genversion.vcproj -EXTRA_DIST += Mkfiles/vc8/genversion/run.bat -EXTRA_DIST += Mkfiles/vc8/libyasm/libyasm.vcproj -EXTRA_DIST += Mkfiles/vc8/modules/modules.vcproj -EXTRA_DIST += Mkfiles/vc8/re2c/re2c.vcproj -EXTRA_DIST += Mkfiles/vc8/re2c/run.bat -EXTRA_DIST += Mkfiles/vc8/gap/gap.vcproj -EXTRA_DIST += Mkfiles/vc8/gap/run.bat # Until this gets fixed in automake -DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]* +DISTCLEANFILES += libyasm/stamp-h libyasm/stamp-h[0-9]* -ACLOCAL_AMFLAGS = -I m4 +dist-hook: YASM-VERSION-FILE YASM-VERSION.h + cp YASM-VERSION-FILE $(distdir)/version + cp YASM-VERSION.h $(distdir)/Mkfiles/dj/ + +YASM-VERSION-FILE: $(top_srcdir)/YASM-VERSION-GEN.sh + $(top_srcdir)/YASM-VERSION-GEN.sh distclean-local: -rm -rf results @@ -110,12 +136,14 @@ if HAVE_PYTHON -rm -rf build endif +# Until gets fixed libyasm cross-build for target system +# use fixinstall-yasm-XXX make targets all-local: python-build install-exec-hook: python-install uninstall-hook: python-uninstall if BUILD_MAN -MAINTAINERCLEANFILES = $(dist_man_MANS) +MAINTAINERCLEANFILES += $(dist_man_MANS) $(notrans_dist_man_MANS) endif # genstring build diff --git a/Mkfiles/Makefile.dj b/Mkfiles/Makefile.dj index dab4a5ff..34773036 100644 --- a/Mkfiles/Makefile.dj +++ b/Mkfiles/Makefile.dj @@ -1,5 +1,3 @@ -# $Id$ -# # Ultra-flat Makefile for DJGPP (also works for Cygwin). # Does NOT depend on or use configure. # @@ -13,16 +11,14 @@ CFLAGS=-DHAVE_CONFIG_H -IMkfiles/dj -O -I. CC?=gcc BUILDCC?=$(CC) -all: yasm +all: yasm ytasm vsyasm LIBYASM_OBJS= \ - libyasm/arch.o \ libyasm/assocdat.o \ libyasm/bitvect.o \ libyasm/bc-align.o \ libyasm/bc-data.o \ libyasm/bc-incbin.o \ - libyasm/bc-insn.o \ libyasm/bc-org.o \ libyasm/bc-reserve.o \ libyasm/bytecode.o \ @@ -31,6 +27,7 @@ LIBYASM_OBJS= \ libyasm/file.o \ libyasm/floatnum.o \ libyasm/hamt.o \ + libyasm/insn.o \ libyasm/intnum.o \ libyasm/inttree.o \ libyasm/linemap.o \ @@ -51,18 +48,20 @@ MODULES_ARCH_X86_OBJS= \ modules/arch/x86/x86arch.o \ modules/arch/x86/x86bc.o \ modules/arch/x86/x86expr.o \ - modules/arch/x86/x86id.o + modules/arch/x86/x86id.o \ + x86cpu.o \ + x86regtmod.o YASM_MODULES=arch_x86 -#MODULES_ARCH_LC3B_OBJS= \ -# modules/arch/lc3b/lc3barch.o \ -# modules/arch/lc3b/lc3bbc.o \ -# lc3bid.o -#YASM_MODULES+=arch_lc3b +MODULES_ARCH_LC3B_OBJS= \ + modules/arch/lc3b/lc3barch.o \ + modules/arch/lc3b/lc3bbc.o \ + lc3bid.o +YASM_MODULES+=arch_lc3b MODULES_ARCH_OBJS= \ $(MODULES_ARCH_X86_OBJS) \ -# $(MODULES_ARCH_LC3B_OBJS) + $(MODULES_ARCH_LC3B_OBJS) MODULES_DBGFMTS_OBJS= \ modules/dbgfmts/null/null-dbgfmt.o \ @@ -96,9 +95,9 @@ MODULES_OBJFMTS_OBJS= \ modules/objfmts/rdf/rdf-objfmt.o \ modules/objfmts/xdf/xdf-objfmt.o YASM_MODULES+=objfmt_dbg -YASM_MODULES+=objfmt_bin +YASM_MODULES+=objfmt_bin objfmt_dosexe YASM_MODULES+=objfmt_coff objfmt_win32 objfmt_win64 objfmt_x64 -YASM_MODULES+=objfmt_elf objfmt_elf32 objfmt_elf64 +YASM_MODULES+=objfmt_elf objfmt_elf32 objfmt_elf64 objfmt_elfx32 YASM_MODULES+=objfmt_macho objfmt_macho32 objfmt_macho64 YASM_MODULES+=objfmt_rdf YASM_MODULES+=objfmt_xdf @@ -108,9 +107,10 @@ MODULES_PARSERS_OBJS= \ modules/parsers/nasm/nasm-parse.o \ nasm-token.o \ modules/parsers/gas/gas-parser.o \ + modules/parsers/gas/gas-parse-intel.o \ modules/parsers/gas/gas-parse.o \ gas-token.o -YASM_MODULES+=parser_nasm +YASM_MODULES+=parser_nasm parser_tasm YASM_MODULES+=parser_gas parser_gnu MODULES_PREPROCS_NASM_OBJS= \ @@ -118,15 +118,26 @@ MODULES_PREPROCS_NASM_OBJS= \ modules/preprocs/nasm/nasm-pp.o \ modules/preprocs/nasm/nasm-preproc.o \ modules/preprocs/nasm/nasmlib.o -YASM_MODULES+=preproc_nasm +YASM_MODULES+=preproc_nasm preproc_tasm MODULES_PREPROCS_RAW_OBJS = \ modules/preprocs/raw/raw-preproc.o YASM_MODULES+=preproc_raw +MODULES_PREPROCS_CPP_OBJS = \ + modules/preprocs/cpp/cpp-preproc.o +YASM_MODULES+=preproc_cpp + +MODULES_PREPROCS_GAS_OBJS = \ + modules/preprocs/gas/gas-eval.o \ + modules/preprocs/gas/gas-preproc.o +YASM_MODULES+=preproc_gas + MODULES_PREPROCS_OBJS = \ $(MODULES_PREPROCS_NASM_OBJS) \ - $(MODULES_PREPROCS_RAW_OBJS) + $(MODULES_PREPROCS_RAW_OBJS) \ + $(MODULES_PREPROCS_CPP_OBJS) \ + $(MODULES_PREPROCS_GAS_OBJS) MODULES_OBJS = \ $(MODULES_ARCH_OBJS) \ @@ -143,6 +154,18 @@ YASM_OBJS= \ $(LIBYASM_OBJS) \ $(MODULES_OBJS) +YTASM_OBJS= \ + frontends/tasm/tasm.o \ + frontends/tasm/tasm-options.o \ + $(LIBYASM_OBJS) \ + $(MODULES_OBJS) + +VSYASM_OBJS= \ + frontends/vsyasm/vsyasm.o \ + frontends/yasm/yasm-options.o \ + $(LIBYASM_OBJS) \ + $(MODULES_OBJS) + genstring: genstring.c $(BUILDCC) -o $@ $< @@ -151,13 +174,25 @@ license.c: COPYING genstring frontends/yasm/yasm.c: license.c -genmacro: modules/preprocs/nasm/genmacro.c +genmacro: tools/genmacro/genmacro.c $(BUILDCC) -o $@ $< -nasm-macros.c: modules/preprocs/nasm/standard.mac version.mac genmacro - ./genmacro modules/preprocs/nasm/standard.mac version.mac +nasm-version.c: version.mac genmacro + ./genmacro $@ nasm_version_mac version.mac -modules/preprocs/nasm/nasm-pp.c: nasm-macros.c +modules/preprocs/nasm/nasm-pp.c: nasm-version.c + +nasm-macros.c: modules/parsers/nasm/nasm-std.mac genmacro + ./genmacro $@ nasm_standard_mac modules/parsers/nasm/nasm-std.mac + +modules/parsers/nasm/nasm-parser.c: nasm-macros.c + +win64-nasm.c: modules/objfmts/coff/win64-nasm.mac genmacro + ./genmacro $@ win64_nasm_stdmac modules/objfmts/coff/win64-nasm.mac +win64-gas.c: modules/objfmts/coff/win64-gas.mac genmacro + ./genmacro $@ win64_gas_stdmac modules/objfmts/coff/win64-gas.mac + +modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c genversion: modules/preprocs/nasm/genversion.c $(BUILDCC) -IMkfiles/dj -o $@ $< @@ -171,10 +206,23 @@ genmodule: libyasm/genmodule.c module.c: libyasm/module.in genmodule ./genmodule libyasm/module.in Mkfiles/Makefile.dj -x86parse.c: modules/arch/x86/x86parse.gap gap - ./gap modules/arch/x86/x86parse.gap $@ +x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: modules/arch/x86/gen_x86_insn.py + # ignore error in case python is not installed + -python modules/arch/x86/gen_x86_insn.py -modules/arch/x86/x86id.c: x86parse.c +x86insn_nasm.c: x86insn_nasm.gperf genperf + ./genperf x86insn_nasm.gperf $@ + +x86insn_gas.c: x86insn_gas.gperf genperf + ./genperf x86insn_gas.gperf $@ + +x86cpu.c: modules/arch/x86/x86cpu.gperf genperf + ./genperf modules/arch/x86/x86cpu.gperf $@ + +x86regtmod.c: modules/arch/x86/x86regtmod.gperf genperf + ./genperf modules/arch/x86/x86regtmod.gperf $@ + +modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c lc3bid.c: modules/arch/lc3b/lc3bid.re re2c ./re2c -s -o $@ modules/arch/lc3b/lc3bid.re @@ -199,19 +247,25 @@ RE2C_SRCS= \ re2c: $(RE2C_SRCS) $(BUILDCC) -I. -o re2c $(RE2C_SRCS) -GAP_SRCS= \ - tools/gap/gap.c \ - tools/gap/perfect.c \ +GENPERF_SRCS= \ + tools/genperf/genperf.c \ + tools/genperf/perfect.c \ libyasm/phash.c \ libyasm/xmalloc.c \ libyasm/xstrdup.c -gap: $(GAP_SRCS) - $(BUILDCC) -I. -o gap $(GAP_SRCS) +genperf: $(GENPERF_SRCS) + $(BUILDCC) -I. -o genperf $(GENPERF_SRCS) yasm: $(YASM_OBJS) $(CC) -o yasm $(YASM_OBJS) +ytasm: $(YTASM_OBJS) + $(CC) -o ytasm $(YTASM_OBJS) + +vsyasm: $(VSYASM_OBJS) + $(CC) -o vsyasm $(VSYASM_OBJS) + .c.o: $(CC) -c $(CFLAGS) -o $@ $< diff --git a/Mkfiles/Makefile.flat b/Mkfiles/Makefile.flat index 9160a245..e4d5b219 100644 --- a/Mkfiles/Makefile.flat +++ b/Mkfiles/Makefile.flat @@ -1,5 +1,3 @@ -# $Id$ -# # Ultra-flat Makefile "prototype" for non-Unix platforms. # Does NOT depend on or use configure. # @@ -16,16 +14,14 @@ CFLAGS=-DHAVE_CONFIG_H -IMkfiles -I. CC?=gcc BUILDCC?=$(CC) -all: yasm +all: yasm ytasm vsyasm LIBYASM_OBJS= \ - libyasm/arch.o \ libyasm/assocdat.o \ libyasm/bitvect.o \ libyasm/bc-align.o \ libyasm/bc-data.o \ libyasm/bc-incbin.o \ - libyasm/bc-insn.o \ libyasm/bc-org.o \ libyasm/bc-reserve.o \ libyasm/bytecode.o \ @@ -34,6 +30,7 @@ LIBYASM_OBJS= \ libyasm/file.o \ libyasm/floatnum.o \ libyasm/hamt.o \ + libyasm/insn.o \ libyasm/intnum.o \ libyasm/inttree.o \ libyasm/linemap.o \ @@ -54,18 +51,20 @@ MODULES_ARCH_X86_OBJS= \ modules/arch/x86/x86arch.o \ modules/arch/x86/x86bc.o \ modules/arch/x86/x86expr.o \ - modules/arch/x86/x86id.o + modules/arch/x86/x86id.o \ + x86cpu.o \ + x86regtmod.o YASM_MODULES=arch_x86 -#MODULES_ARCH_LC3B_OBJS= \ -# modules/arch/lc3b/lc3barch.o \ -# modules/arch/lc3b/lc3bbc.o \ -# lc3bid.o -#YASM_MODULES+=arch_lc3b +MODULES_ARCH_LC3B_OBJS= \ + modules/arch/lc3b/lc3barch.o \ + modules/arch/lc3b/lc3bbc.o \ + lc3bid.o +YASM_MODULES+=arch_lc3b MODULES_ARCH_OBJS= \ $(MODULES_ARCH_X86_OBJS) \ -# $(MODULES_ARCH_LC3B_OBJS) + $(MODULES_ARCH_LC3B_OBJS) MODULES_DBGFMTS_OBJS= \ modules/dbgfmts/null/null-dbgfmt.o \ @@ -99,9 +98,9 @@ MODULES_OBJFMTS_OBJS= \ modules/objfmts/rdf/rdf-objfmt.o \ modules/objfmts/xdf/xdf-objfmt.o YASM_MODULES+=objfmt_dbg -YASM_MODULES+=objfmt_bin +YASM_MODULES+=objfmt_bin objfmt_dosexe YASM_MODULES+=objfmt_coff objfmt_win32 objfmt_win64 objfmt_x64 -YASM_MODULES+=objfmt_elf objfmt_elf32 objfmt_elf64 +YASM_MODULES+=objfmt_elf objfmt_elf32 objfmt_elf64 objfmt_elfx32 YASM_MODULES+=objfmt_macho objfmt_macho32 objfmt_macho64 YASM_MODULES+=objfmt_rdf YASM_MODULES+=objfmt_xdf @@ -111,9 +110,10 @@ MODULES_PARSERS_OBJS= \ modules/parsers/nasm/nasm-parse.o \ nasm-token.o \ modules/parsers/gas/gas-parser.o \ + modules/parsers/gas/gas-parse-intel.o \ modules/parsers/gas/gas-parse.o \ gas-token.o -YASM_MODULES+=parser_nasm +YASM_MODULES+=parser_nasm parser_tasm YASM_MODULES+=parser_gas parser_gnu MODULES_PREPROCS_NASM_OBJS= \ @@ -121,15 +121,26 @@ MODULES_PREPROCS_NASM_OBJS= \ modules/preprocs/nasm/nasm-pp.o \ modules/preprocs/nasm/nasm-preproc.o \ modules/preprocs/nasm/nasmlib.o -YASM_MODULES+=preproc_nasm +YASM_MODULES+=preproc_nasm preproc_tasm MODULES_PREPROCS_RAW_OBJS = \ modules/preprocs/raw/raw-preproc.o YASM_MODULES+=preproc_raw +MODULES_PREPROCS_CPP_OBJS = \ + modules/preprocs/cpp/cpp-preproc.o +YASM_MODULES+=preproc_cpp + +MODULES_PREPROCS_GAS_OBJS = \ + modules/preprocs/gas/gas-eval.o \ + modules/preprocs/gas/gas-preproc.o +YASM_MODULES+=preproc_gas + MODULES_PREPROCS_OBJS = \ $(MODULES_PREPROCS_NASM_OBJS) \ - $(MODULES_PREPROCS_RAW_OBJS) + $(MODULES_PREPROCS_RAW_OBJS) \ + $(MODULES_PREPROCS_CPP_OBJS) \ + $(MODULES_PREPROCS_GAS_OBJS) MODULES_OBJS = \ $(MODULES_ARCH_OBJS) \ @@ -146,6 +157,18 @@ YASM_OBJS= \ $(LIBYASM_OBJS) \ $(MODULES_OBJS) +YTASM_OBJS= \ + frontends/tasm/tasm.o \ + frontends/tasm/tasm-options.o \ + $(LIBYASM_OBJS) \ + $(MODULES_OBJS) + +VSYASM_OBJS= \ + frontends/vsyasm/vsyasm.o \ + frontends/yasm/yasm-options.o \ + $(LIBYASM_OBJS) \ + $(MODULES_OBJS) + genstring: genstring.c $(BUILDCC) -o $@ $< @@ -154,16 +177,28 @@ license.c: COPYING genstring frontends/yasm/yasm.c: license.c -genmacro: modules/preprocs/nasm/genmacro.c +genmacro: tools/genmacro/genmacro.c $(BUILDCC) -o $@ $< -nasm-macros.c: modules/preprocs/nasm/standard.mac version.mac genmacro - ./genmacro modules/preprocs/nasm/standard.mac version.mac +nasm-version.c: version.mac genmacro + ./genmacro $@ nasm_version_mac version.mac -modules/preprocs/nasm/nasm-pp.c: nasm-macros.c +modules/preprocs/nasm/nasm-pp.c: nasm-version.c -genversion: modules/preprocs/nasm/genversion.c - $(BUILDCC) -IMkfiles -o $@ $< +nasm-macros.c: modules/parsers/nasm/nasm-std.mac genmacro + ./genmacro $@ nasm_standard_mac modules/parsers/nasm/nasm-std.mac + +modules/parsers/nasm/nasm-parser.c: nasm-macros.c + +win64-nasm.c: modules/objfmts/coff/win64-nasm.mac genmacro + ./genmacro $@ win64_nasm_stdmac modules/objfmts/coff/win64-nasm.mac +win64-gas.c: modules/objfmts/coff/win64-gas.mac genmacro + ./genmacro $@ win64_gas_stdmac modules/objfmts/coff/win64-gas.mac + +modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c + +genversion: modules/preprocs/nasm/genversion.c YASM-VERSION.h + $(BUILDCC) -IMkfiles -I. -o $@ $< version.mac: genversion ./genversion $@ @@ -174,10 +209,23 @@ genmodule: libyasm/genmodule.c module.c: libyasm/module.in genmodule ./genmodule libyasm/module.in Mkfiles/Makefile.flat -x86parse.c: modules/arch/x86/x86parse.gap gap - ./gap modules/arch/x86/x86parse.gap $@ +x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: modules/arch/x86/gen_x86_insn.py + # ignore error in case python is not installed + -python modules/arch/x86/gen_x86_insn.py -modules/arch/x86/x86id.c: x86parse.c +x86insn_nasm.c: x86insn_nasm.gperf genperf + ./genperf x86insn_nasm.gperf $@ + +x86insn_gas.c: x86insn_gas.gperf genperf + ./genperf x86insn_gas.gperf $@ + +x86cpu.c: modules/arch/x86/x86cpu.gperf genperf + ./genperf modules/arch/x86/x86cpu.gperf $@ + +x86regtmod.c: modules/arch/x86/x86regtmod.gperf genperf + ./genperf modules/arch/x86/x86regtmod.gperf $@ + +modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c lc3bid.c: modules/arch/lc3b/lc3bid.re re2c ./re2c -s -o $@ modules/arch/lc3b/lc3bid.re @@ -202,19 +250,30 @@ RE2C_SRCS= \ re2c: $(RE2C_SRCS) $(BUILDCC) -I. -o re2c $(RE2C_SRCS) -GAP_SRCS= \ - tools/gap/gap.c \ - tools/gap/perfect.c \ +GENPERF_SRCS= \ + tools/genperf/genperf.c \ + tools/genperf/perfect.c \ libyasm/phash.c \ libyasm/xmalloc.c \ libyasm/xstrdup.c -gap: $(GAP_SRCS) - $(BUILDCC) -I. -o gap $(GAP_SRCS) +genperf: $(GENPERF_SRCS) + $(BUILDCC) -I. -o genperf $(GENPERF_SRCS) yasm: $(YASM_OBJS) $(CC) -o yasm $(YASM_OBJS) +ytasm: $(YTASM_OBJS) + $(CC) -o ytasm $(YTASM_OBJS) + +vsyasm: $(VSYASM_OBJS) + $(CC) -o vsyasm $(VSYASM_OBJS) + .c.o: $(CC) -c $(CFLAGS) -o $@ $< +$(YASM_OBJS) $(YTASM_OBJS) $(VSYASM_OBJS): YASM-VERSION.h + +YASM-VERSION.h: YASM-VERSION-GEN.sh + sh YASM-VERSION-GEN.sh + diff --git a/Mkfiles/dj/config.h b/Mkfiles/dj/config.h index 759ced57..b33554ac 100644 --- a/Mkfiles/dj/config.h +++ b/Mkfiles/dj/config.h @@ -1,9 +1,11 @@ -/* $Id$ */ - +#include "YASM-VERSION.h" #define yasm__splitpath(path, tail) yasm__splitpath_win(path, tail) #define yasm__abspath(path) yasm__abspath_win(path) #define yasm__combpath(from, to) yasm__combpath_win(from, to) +/* Command name to run C preprocessor */ +#define CPP_PROG "gcc -E" + /* */ /* #undef ENABLE_NLS */ @@ -13,12 +15,23 @@ /* */ /* #undef HAVE_CATGETS */ +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + /* Define if the GNU dcgettext() function is already present or preinstalled. */ /* #undef HAVE_DCGETTEXT */ -/* Define if you don't have `vprintf' but do have `_doprnt'. */ -/* #undef HAVE_DOPRNT */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRECT_H */ + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 @@ -41,21 +54,15 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBGEN_H */ -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - /* Define if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define if you have the `mergesort function. */ /* #undef HAVE_MERGESORT */ +/* Define to 1 if you have the `popen' function. */ +#define HAVE_POPEN 1 + /* Define if you have the header file. */ #define HAVE_STDINT_H 1 @@ -83,59 +90,44 @@ /* Define if you have the `strncasecmp' function. */ #define HAVE_STRNCASECMP 1 -/* Define if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - /* Define if you have the `strsep' function. */ #define HAVE_STRSEP 1 -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - /* Define if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define if you have the header file. */ #define HAVE_SYS_TYPES_H 1 -/* Define if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - /* Define if you have the `toascii' function. */ #define HAVE_TOASCII 1 /* Define if you have the header file. */ #define HAVE_UNISTD_H 1 -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - /* Define to 1 if you have the `vsnprintf' function. */ /* #undef HAVE_VSNPRINTF */ +/* Define to 1 if you have the `_stricmp' function. */ +/* #undef HAVE__STRICMP */ + /* Name of package */ #define PACKAGE "yasm" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-yasm@tortall.net" -/* Define to build version of this package. */ -#define PACKAGE_BUILD "HEAD" - -/* Define to internal version of this package. */ -#define PACKAGE_INTVER "0.6.99" - /* Define to the full name of this package. */ #define PACKAGE_NAME "yasm" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "yasm HEAD" +/*#define PACKAGE_STRING "yasm HEAD"*/ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "yasm" /* Define to the version of this package. */ -#define PACKAGE_VERSION "HEAD" +/*#define PACKAGE_VERSION "HEAD"*/ /* Define if the C compiler supports function prototypes. */ #define PROTOTYPES 1 diff --git a/Mkfiles/nightly-build.pl b/Mkfiles/nightly-build.pl deleted file mode 100644 index 1ac17a29..00000000 --- a/Mkfiles/nightly-build.pl +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl -# $Id$ -use POSIX qw(strftime); - -$|++; - -my $version = '0.0.1'; -my $todaydate = strftime "%Y%m%d", localtime; -my $snapshot_dir = "/home/yasm/public_html/snapshots/$todaydate"; -my $cvs_dir = '/usr/local/cvs2/yasm/chrooted-cvs/cvs'; -my $build_dir = '/home/yasm/build'; - -# Create snapshot directory -system('mkdir', $snapshot_dir); -# Relink "latest" symlink -system('rm', "$snapshot_dir/../latest"); -system('ln', '-s', $snapshot_dir, "$snapshot_dir/../latest"); -system('rm', "$snapshot_dir/../../latest"); -system('ln', '-s', $snapshot_dir, "$snapshot_dir/../../latest"); - -# Build CVS tree tarball -chdir("$cvs_dir/..") || die "Could not change to CVS directory"; -system('tar', '-czf', "$snapshot_dir/yasm-cvstree.tar.gz", 'cvs') == 0 - or die "CVS tree tarball build failed: $?."; - -# Build CVS checkout tarball -chdir($build_dir) || die "Could not change to build directory"; -system('chmod', '-R', 'u+w', 'yasm') == 0 - or die "Could not chmod old CVS checkout directory: $?."; -system('rm', '-Rf', 'yasm') == 0 - or die "Could not remove old CVS checkout directory: $?."; -system('mkdir', 'yasm') == 0 - or die "Could not create CVS checkout directory: $?."; -chdir('yasm') || die "Could not change to CVS checkout directory."; -system('cvs', '-q', "-d$cvs_dir", 'checkout', '.') == 0 - or die "CVS checkout failed: $?."; -chdir('..'); -system('tar', '-czf', "$snapshot_dir/yasm-cvs.tar.gz", 'yasm') == 0 - or die "CVS checkout tarball build failed: $?."; -chdir('yasm'); - -# Update and build distribution tarball -system("./autogen.sh >$snapshot_dir/autogen-log.txt 2>$snapshot_dir/autogen-errwarn.txt") == 0 - or die "autogen.sh failed: $?."; -system("gmake distcheck >$snapshot_dir/make-log.txt 2>$snapshot_dir/make-errwarn.txt") == 0 - or die "build failed: $?."; -system("cp *.tar.gz $snapshot_dir/") == 0 - or die "dist tarball copy failed."; diff --git a/Mkfiles/vc/gap/gap.vcproj b/Mkfiles/vc/gap/gap.vcproj deleted file mode 100644 index ee7c8770..00000000 --- a/Mkfiles/vc/gap/gap.vcproj +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/gap/run.bat b/Mkfiles/vc/gap/run.bat deleted file mode 100644 index d5060801..00000000 --- a/Mkfiles/vc/gap/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ..\..\..\ -%1 modules\arch\x86\x86parse.gap x86parse.c diff --git a/Mkfiles/vc/genmacro/genmacro.vcproj b/Mkfiles/vc/genmacro/genmacro.vcproj deleted file mode 100644 index 0f18b4bd..00000000 --- a/Mkfiles/vc/genmacro/genmacro.vcproj +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/genmacro/run.bat b/Mkfiles/vc/genmacro/run.bat deleted file mode 100644 index f3323e72..00000000 --- a/Mkfiles/vc/genmacro/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ..\..\.. -%1 modules\preprocs\nasm\standard.mac version.mac diff --git a/Mkfiles/vc/genmodule/genmodule.vcproj b/Mkfiles/vc/genmodule/genmodule.vcproj deleted file mode 100644 index 0cd85b27..00000000 --- a/Mkfiles/vc/genmodule/genmodule.vcproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/genmodule/run.bat b/Mkfiles/vc/genmodule/run.bat deleted file mode 100644 index e34a4169..00000000 --- a/Mkfiles/vc/genmodule/run.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -cd ..\..\.. -%1 libyasm\module.in Makefile.am diff --git a/Mkfiles/vc/genstring/genstring.vcproj b/Mkfiles/vc/genstring/genstring.vcproj deleted file mode 100644 index cc1ba413..00000000 --- a/Mkfiles/vc/genstring/genstring.vcproj +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/genstring/run.bat b/Mkfiles/vc/genstring/run.bat deleted file mode 100644 index 5864b1dc..00000000 --- a/Mkfiles/vc/genstring/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ..\..\.. -%1 license_msg license.c COPYING diff --git a/Mkfiles/vc/genversion/genversion.vcproj b/Mkfiles/vc/genversion/genversion.vcproj deleted file mode 100644 index 62e252d3..00000000 --- a/Mkfiles/vc/genversion/genversion.vcproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/libyasm/libyasm.vcproj b/Mkfiles/vc/libyasm/libyasm.vcproj deleted file mode 100644 index 375f3397..00000000 --- a/Mkfiles/vc/libyasm/libyasm.vcproj +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/modules/modules.vcproj b/Mkfiles/vc/modules/modules.vcproj deleted file mode 100644 index fee60184..00000000 --- a/Mkfiles/vc/modules/modules.vcproj +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/re2c/re2c.vcproj b/Mkfiles/vc/re2c/re2c.vcproj deleted file mode 100644 index 13579b6e..00000000 --- a/Mkfiles/vc/re2c/re2c.vcproj +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/yasm.sln b/Mkfiles/vc/yasm.sln deleted file mode 100644 index 8921a59d..00000000 --- a/Mkfiles/vc/yasm.sln +++ /dev/null @@ -1,94 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasm", "libyasm\libyasm.vcproj", "{29FE7874-1256-4AD6-B889-68E399DC9608}" - ProjectSection(ProjectDependencies) = postProject - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0} = {F0E8B707-00C5-4FF2-B8EF-7C39817132A0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modules", "modules\modules.vcproj", "{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}" - ProjectSection(ProjectDependencies) = postProject - {3C58BE13-50A3-4583-984D-D8902B3D7713} = {3C58BE13-50A3-4583-984D-D8902B3D7713} - {5758BF4E-ABC4-11DA-B012-B622A1EF5492} = {5758BF4E-ABC4-11DA-B012-B622A1EF5492} - {29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608} - {225700A5-07B8-434E-AD61-555278BF6733} = {225700A5-07B8-434E-AD61-555278BF6733} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasm", "yasm.vcproj", "{34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}" - ProjectSection(ProjectDependencies) = postProject - {29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608} - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} = {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} - {021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmacro", "genmacro\genmacro.vcproj", "{225700A5-07B8-434E-AD61-555278BF6733}" - ProjectSection(ProjectDependencies) = postProject - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} = {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genversion", "genversion\genversion.vcproj", "{B545983B-8EE0-4A7B-A67A-E749EEAE62A2}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "re2c\re2c.vcproj", "{3C58BE13-50A3-4583-984D-D8902B3D7713}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gap", "gap\gap.vcproj", "{5758BF4E-ABC4-11DA-B012-B622A1EF5492}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmodule", "genmodule\genmodule.vcproj", "{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genstring", "genstring\genstring.vcproj", "{021CEB0A-F721-4F59-B349-9CEEAF244459}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug.ActiveCfg = Debug|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug.Build.0 = Debug|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Release.ActiveCfg = Release|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Release.Build.0 = Release|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug.ActiveCfg = Debug|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug.Build.0 = Debug|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release.ActiveCfg = Release|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release.Build.0 = Release|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug.ActiveCfg = Debug|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug.Build.0 = Debug|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release.ActiveCfg = Release|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release.Build.0 = Release|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Debug.ActiveCfg = Debug|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Debug.Build.0 = Debug|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Release.ActiveCfg = Release|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Release.Build.0 = Release|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug.ActiveCfg = Debug|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug.Build.0 = Debug|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release.ActiveCfg = Release|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release.Build.0 = Release|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug.ActiveCfg = Debug|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug.Build.0 = Debug|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release.ActiveCfg = Release|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release.Build.0 = Release|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug.ActiveCfg = Debug|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug.Build.0 = Debug|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release.ActiveCfg = Release|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release.Build.0 = Release|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug.ActiveCfg = Debug|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug.Build.0 = Debug|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release.ActiveCfg = Release|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release.Build.0 = Release|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug.ActiveCfg = Debug|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug.Build.0 = Debug|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release.ActiveCfg = Release|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/Mkfiles/vc/yasm.vcproj b/Mkfiles/vc/yasm.vcproj deleted file mode 100644 index 70a25a9f..00000000 --- a/Mkfiles/vc/yasm.vcproj +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/config.h b/Mkfiles/vc8/config.h deleted file mode 100644 index 91168c61..00000000 --- a/Mkfiles/vc8/config.h +++ /dev/null @@ -1,181 +0,0 @@ -/* $Id: config.h 1137 2004-09-04 01:24:57Z peter $ */ - -#define yasm__splitpath(path, tail) yasm__splitpath_win(path, tail) -#define yasm__abspath(path) yasm__abspath_win(path) -#define yasm__combpath(from, to) yasm__combpath_win(from, to) - -/* */ -/* #undef ENABLE_NLS */ - -/* Define if you have the `abort' function. */ -#define HAVE_ABORT 1 - -/* */ -/* #undef HAVE_CATGETS */ - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -/* #undef HAVE_DCGETTEXT */ - -/* Define if you don't have `vprintf' but do have `_doprnt'. */ -/* #undef HAVE_DOPRNT */ - -/* Define to 1 if you have the `getcwd' function. */ -#define HAVE_GETCWD 1 - -/* */ -/* #undef HAVE_GETTEXT */ - -/* Define if you have the GNU C Library */ -/* #undef HAVE_GNU_C_LIBRARY */ - -/* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ - -/* Define if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* */ -/* #undef HAVE_LC_MESSAGES */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBGEN_H */ - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define if you have the `mergesort function. */ -/* #undef HAVE_MERGESORT */ - -/* Define if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* */ -/* #undef HAVE_STPCPY */ - -/* Define if you have the `strcasecmp' function. */ -/* #undef HAVE_STRCASECMP */ - -/* Define if you have the `strcmpi' function. */ -/* #undef HAVE_STRCMPI */ - -/* Define if you have the `stricmp' function. */ -#define HAVE__STRICMP 1 - -/* Define if you have the header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the `strncasecmp' function. */ -/* #undef HAVE_STRNCASECMP */ - -/* Define if you have the `strrchr' function. */ -/* #undef HAVE_STRRCHR */ - -/* Define if you have the `strsep' function. */ -/* #undef HAVE_STRSEP */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_PARAM_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have that is POSIX.1 compatible. */ -/* #undef HAVE_SYS_WAIT_H */ - -/* Define if you have the `toascii' function. */ -#define HAVE_TOASCII 1 -#define toascii __toascii - -/* Define if you have the header file. */ -/* #undef HAVE_UNISTD_H */ - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -/* #undef HAVE_VSNPRINTF */ - -/* Name of package */ -#define PACKAGE "yasm" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "bug-yasm@tortall.net" - -/* Define to build version of this package. */ -#define PACKAGE_BUILD "HEAD" - -/* Define to internal version of this package. */ -#define PACKAGE_INTVER "0.6.99" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "yasm" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "yasm HEAD" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "yasm" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "HEAD" - -/* Define if the C compiler supports function prototypes. */ -#define PROTOTYPES 1 - -/* The size of a `char', as computed by sizeof. */ -/* #undef SIZEOF_CHAR */ - -/* The size of a `int', as computed by sizeof. */ -/* #undef SIZEOF_INT */ - -/* The size of a `long', as computed by sizeof. */ -/* #undef SIZEOF_LONG */ - -/* The size of a `short', as computed by sizeof. */ -/* #undef SIZEOF_SHORT */ - -/* The size of a `void*', as computed by sizeof. */ -/* #undef SIZEOF_VOIDP */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "HEAD" - -/* Define if using the dmalloc debugging malloc package */ -/* #undef WITH_DMALLOC */ - -/* Define like PROTOTYPES; this can be used by system headers. */ -#define __PROTOTYPES 1 - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ diff --git a/Mkfiles/vc8/gap/gap.vcproj b/Mkfiles/vc8/gap/gap.vcproj deleted file mode 100644 index 9ba90035..00000000 --- a/Mkfiles/vc8/gap/gap.vcproj +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/gap/run.bat b/Mkfiles/vc8/gap/run.bat deleted file mode 100644 index d5060801..00000000 --- a/Mkfiles/vc8/gap/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ..\..\..\ -%1 modules\arch\x86\x86parse.gap x86parse.c diff --git a/Mkfiles/vc8/genmacro/genmacro.vcproj b/Mkfiles/vc8/genmacro/genmacro.vcproj deleted file mode 100644 index 6c0b6118..00000000 --- a/Mkfiles/vc8/genmacro/genmacro.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/genmacro/run.bat b/Mkfiles/vc8/genmacro/run.bat deleted file mode 100644 index f3323e72..00000000 --- a/Mkfiles/vc8/genmacro/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ..\..\.. -%1 modules\preprocs\nasm\standard.mac version.mac diff --git a/Mkfiles/vc8/genmodule/genmodule.vcproj b/Mkfiles/vc8/genmodule/genmodule.vcproj deleted file mode 100644 index b55f7125..00000000 --- a/Mkfiles/vc8/genmodule/genmodule.vcproj +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/genstring/genstring.vcproj b/Mkfiles/vc8/genstring/genstring.vcproj deleted file mode 100644 index 9910c8b4..00000000 --- a/Mkfiles/vc8/genstring/genstring.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/genversion/genversion.vcproj b/Mkfiles/vc8/genversion/genversion.vcproj deleted file mode 100644 index c65952fa..00000000 --- a/Mkfiles/vc8/genversion/genversion.vcproj +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/genversion/run.bat b/Mkfiles/vc8/genversion/run.bat deleted file mode 100644 index 30edf8f1..00000000 --- a/Mkfiles/vc8/genversion/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ..\..\.. -%1 version.mac diff --git a/Mkfiles/vc8/libyasm-stdint.h b/Mkfiles/vc8/libyasm-stdint.h deleted file mode 100644 index fed61b33..00000000 --- a/Mkfiles/vc8/libyasm-stdint.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -#include -#else -typedef unsigned long uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif diff --git a/Mkfiles/vc8/libyasm/libyasm.vcproj b/Mkfiles/vc8/libyasm/libyasm.vcproj deleted file mode 100644 index 287c988f..00000000 --- a/Mkfiles/vc8/libyasm/libyasm.vcproj +++ /dev/null @@ -1,571 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/modules/modules.vcproj b/Mkfiles/vc8/modules/modules.vcproj deleted file mode 100644 index 03821e78..00000000 --- a/Mkfiles/vc8/modules/modules.vcproj +++ /dev/null @@ -1,561 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/re2c/re2c.vcproj b/Mkfiles/vc8/re2c/re2c.vcproj deleted file mode 100644 index 84de9b8b..00000000 --- a/Mkfiles/vc8/re2c/re2c.vcproj +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/re2c/run.bat b/Mkfiles/vc8/re2c/run.bat deleted file mode 100644 index cde2a7b6..00000000 --- a/Mkfiles/vc8/re2c/run.bat +++ /dev/null @@ -1,4 +0,0 @@ -cd ..\..\..\ -%1 -s -o lc3bid.c modules\arch\lc3b\lc3bid.re -%1 -b -o nasm-token.c modules\parsers\nasm\nasm-token.re -%1 -b -o gas-token.c modules\parsers\gas\gas-token.re diff --git a/Mkfiles/vc8/readme.vc8.txt b/Mkfiles/vc8/readme.vc8.txt deleted file mode 100644 index 03741bfa..00000000 --- a/Mkfiles/vc8/readme.vc8.txt +++ /dev/null @@ -1,98 +0,0 @@ - -Building YASM with Microsoft Visual Studio 2005 ------------------------------------------------ - -This note describes how to build YASM using Microsoft Visual Studio 2005. - -1. The Compiler ---------------- - -If you want to build the 64-bit version of YASM you will need to install -the Visual Studio 2005 64-bit tools, which are not installed by default. - -2. YASM Download ----------------- - -First YASM needs to be downloaded and the files placed within a suitable -directory, which will be called here but can be named and located -as you wish. - -3. Building YASM with Microsoft VC8 ------------------------------------ - -Now locate and double click on the yasm.sln solution file in the 'Mkfiles/vc8' -subdirectory to open the build project in the Visual Studio 2005 IDE and then -select: - - win32 or x64 build - release or debug build - -as appropriate to build the YASM binaries that you need. - -4. Using YASM with Visual Sudio 2005 and VC++ version 8 -------------------------------------------------------- - -1. Firstly you need to locate the directory (or directories) where the VC++ -compiler binaries are located and put copies of the appropriate yasm.exe -binary in these directories. - -On a win32 system you will use the win32 version of YASM. On an x64 system -you can use either the 32 or the 64 bit versions. The win32 YASM binary -should be placed in the 32-bit VC++ binary directory, which is typically -located at: - - Program Files (x86)\Microsoft Visual Studio 8\VC\bin - -If needed the 64-bit YASM binary should be places in the 64-bit tools -binary directory, which is typically at: - - Program Files\Microsoft Visual Studio 8\VC\bin - -2. To use the new custom tools facility in Visual Studio 2005, you need to -place a copy of the yasm.rules file in the Visual Studio 2005 VC project -defaults directory, which is typically located at: - - Program Files (x86)\Microsoft Visual Studio 8\VC\VCProjectDefaults - -This allows you to configure YASM as an assembler within the VC++ IDE. To -use YASM in a project, right click on the project in the Solution Explorer -and select 'Custom Build Rules..'. This will give you a dialog box that -allows you to select YASM as an assembler (note that your assembler files -need to have the extension '.asm'). - -To assemble a file with YASM, select the Property Page for the file and the -select 'Yasm Assembler' in the Tool dialog entry. Then click 'Apply' and an -additional property page entry will appear and enable YASM settings to be -established. - -As alternative to placing the yasm.rules files as described above is to set -the rules file path in the Visual Studio 2005 settings dialogue. - -It is also important to note that the rules file passes the symbols 'Win32' -or 'x64' to YASM by using the Visual Studio 2005 $(PlatformName) macro in -order to obtain either a 32 or a 64 bit assembler mode. This is a recent -enhancement to YASM so you will need to be sure that your YASM files are at -revision r1331 or higher to use this facility. - -5. A Linker Issue ------------------ - -There appears to be a linker bug in the VC++ v8 linker that prevents symbols -with absolute addresses being linked in DLL builds. This means, for example, -that LEA instructions of the general form: - - lea, rax,[rax+symbol] - -cannot be used for DLL builds. The following general form has to be used -instead: - - lea rcx,[symbol wrt rip] - lea rax,[rax+rcx] - -This limitation may also cause problems with other instruction that use -absolute addresses. - -I am most grateful for the fantastic support that Peter Johnson, YASM's -creator, has given me in tracking down this issue. - - Brian Gladman, 16th January 2006 diff --git a/Mkfiles/vc8/yasm.rules b/Mkfiles/vc8/yasm.rules deleted file mode 100644 index 3001425e..00000000 --- a/Mkfiles/vc8/yasm.rules +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc8/yasm.vcproj b/Mkfiles/vc8/yasm.vcproj deleted file mode 100644 index ef4eab3a..00000000 --- a/Mkfiles/vc8/yasm.vcproj +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mkfiles/vc/config.h b/Mkfiles/vs/config.h similarity index 77% rename from Mkfiles/vc/config.h rename to Mkfiles/vs/config.h index 942f3224..b7f609fc 100644 --- a/Mkfiles/vc/config.h +++ b/Mkfiles/vs/config.h @@ -1,181 +1,170 @@ -/* $Id$ */ - -#define yasm__splitpath(path, tail) yasm__splitpath_win(path, tail) -#define yasm__abspath(path) yasm__abspath_win(path) -#define yasm__combpath(from, to) yasm__combpath_win(from, to) - -/* */ -/* #undef ENABLE_NLS */ - -/* Define if you have the `abort' function. */ -#define HAVE_ABORT 1 - -/* */ -/* #undef HAVE_CATGETS */ - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -/* #undef HAVE_DCGETTEXT */ - -/* Define if you don't have `vprintf' but do have `_doprnt'. */ -/* #undef HAVE_DOPRNT */ - -/* Define to 1 if you have the `getcwd' function. */ -#define HAVE_GETCWD 1 - -/* */ -/* #undef HAVE_GETTEXT */ - -/* Define if you have the GNU C Library */ -/* #undef HAVE_GNU_C_LIBRARY */ - -/* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ - -/* Define if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* */ -/* #undef HAVE_LC_MESSAGES */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBGEN_H */ - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define if you have the `mergesort function. */ -/* #undef HAVE_MERGESORT */ - -/* Define if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* */ -/* #undef HAVE_STPCPY */ - -/* Define if you have the `strcasecmp' function. */ -/* #undef HAVE_STRCASECMP */ - -/* Define if you have the `strcmpi' function. */ -/* #undefine HAVE_STRCMPI */ - -/* Define if you have the `stricmp' function. */ -#define HAVE__STRICMP 1 - -/* Define if you have the header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the `strncasecmp' function. */ -/* #undef HAVE_STRNCASECMP */ - -/* Define if you have the `strrchr' function. */ -/* #undef HAVE_STRRCHR */ - -/* Define if you have the `strsep' function. */ -/* #undef HAVE_STRSEP */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_PARAM_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have that is POSIX.1 compatible. */ -/* #undef HAVE_SYS_WAIT_H */ - -/* Define if you have the `toascii' function. */ -#define HAVE_TOASCII 1 -#define toascii __toascii - -/* Define if you have the header file. */ -/* #undef HAVE_UNISTD_H */ - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -/* #undef HAVE_VSNPRINTF */ - -/* Name of package */ -#define PACKAGE "yasm" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "bug-yasm@tortall.net" - -/* Define to build version of this package. */ -#define PACKAGE_BUILD "HEAD" - -/* Define to internal version of this package. */ -#define PACKAGE_INTVER "0.6.99" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "yasm" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "yasm HEAD" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "yasm" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "HEAD" - -/* Define if the C compiler supports function prototypes. */ -#define PROTOTYPES 1 - -/* The size of a `char', as computed by sizeof. */ -/* #undef SIZEOF_CHAR */ - -/* The size of a `int', as computed by sizeof. */ -/* #undef SIZEOF_INT */ - -/* The size of a `long', as computed by sizeof. */ -/* #undef SIZEOF_LONG */ - -/* The size of a `short', as computed by sizeof. */ -/* #undef SIZEOF_SHORT */ - -/* The size of a `void*', as computed by sizeof. */ -/* #undef SIZEOF_VOIDP */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "HEAD" - -/* Define if using the dmalloc debugging malloc package */ -/* #undef WITH_DMALLOC */ - -/* Define like PROTOTYPES; this can be used by system headers. */ -#define __PROTOTYPES 1 - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ +#include "YASM-VERSION.h" +#define yasm__splitpath(path, tail) yasm__splitpath_win(path, tail) +#define yasm__abspath(path) yasm__abspath_win(path) +#define yasm__combpath(from, to) yasm__combpath_win(from, to) + +/* Command name to run C preprocessor */ +#define CPP_PROG "cpp" + +/* */ +/* #undef ENABLE_NLS */ + +/* Define if you have the `abort' function. */ +#define HAVE_ABORT 1 + +/* */ +/* #undef HAVE_CATGETS */ + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRECT_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* */ +/* #undef HAVE_GETTEXT */ + +/* Define if you have the GNU C Library */ +/* #undef HAVE_GNU_C_LIBRARY */ + +/* Define if you have the iconv() function. */ +/* #undef HAVE_ICONV */ + +/* Define if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* */ +/* #undef HAVE_LC_MESSAGES */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBGEN_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_MEMORY_H */ + +/* Define if you have the `mergesort' function. */ +/* #undef HAVE_MERGESORT */ + +/* Define to 1 if you have the `popen' function. */ +/* #undef HAVE_POPEN */ + +/* Define if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* */ +/* #undef HAVE_STPCPY */ + +/* Define if you have the `strcasecmp' function. */ +/* #undef HAVE_STRCASECMP */ + +/* Define if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define if you have the `stricmp' function. */ +/* #undefine HAVE_STRICMP */ + +/* Define if you have the header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the `strncasecmp' function. */ +/* #undef HAVE_STRNCASECMP */ + +/* Define if you have the `strsep' function. */ +/* #undef HAVE_STRSEP */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_STAT_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the `toascii' function. */ +#define HAVE_TOASCII 1 +#define toascii __toascii + +/* Define if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if you have the `vsnprintf' function. */ +/* #undef HAVE_VSNPRINTF */ + +/* Define to 1 if you have the `_stricmp' function. */ +#define HAVE__STRICMP 1 + +/* Name of package */ +#define PACKAGE "yasm" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "bug-yasm@tortall.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "yasm" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "yasm HEAD" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "yasm" + +/* Define to the version of this package. */ +/*#define PACKAGE_VERSION "HEAD"*/ + +/* Define if the C compiler supports function prototypes. */ +#define PROTOTYPES 1 + +/* The size of a `char', as computed by sizeof. */ +/* #undef SIZEOF_CHAR */ + +/* The size of a `int', as computed by sizeof. */ +/* #undef SIZEOF_INT */ + +/* The size of a `long', as computed by sizeof. */ +/* #undef SIZEOF_LONG */ + +/* The size of a `short', as computed by sizeof. */ +/* #undef SIZEOF_SHORT */ + +/* The size of a `void*', as computed by sizeof. */ +/* #undef SIZEOF_VOIDP */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "HEAD" + +/* Define if using the dmalloc debugging malloc package */ +/* #undef WITH_DMALLOC */ + +/* Define like PROTOTYPES; this can be used by system headers. */ +#define __PROTOTYPES 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ diff --git a/Mkfiles/vs/crt_secure_no_deprecate.props b/Mkfiles/vs/crt_secure_no_deprecate.props new file mode 100644 index 00000000..777d6d0a --- /dev/null +++ b/Mkfiles/vs/crt_secure_no_deprecate.props @@ -0,0 +1,11 @@ + + + + <_ProjectFileVersion>10.0.21006.1 + + + + _CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + + \ No newline at end of file diff --git a/Mkfiles/vc8/crt_secure_no_deprecate.vsprops b/Mkfiles/vs/crt_secure_no_deprecate.vsprops similarity index 96% rename from Mkfiles/vc8/crt_secure_no_deprecate.vsprops rename to Mkfiles/vs/crt_secure_no_deprecate.vsprops index d61ba30a..56ab506f 100644 --- a/Mkfiles/vc8/crt_secure_no_deprecate.vsprops +++ b/Mkfiles/vs/crt_secure_no_deprecate.vsprops @@ -1,11 +1,11 @@ - - - - + + + + diff --git a/Mkfiles/vs/genmacro/genmacro.vcxproj b/Mkfiles/vs/genmacro/genmacro.vcxproj new file mode 100644 index 00000000..1385ac6a --- /dev/null +++ b/Mkfiles/vs/genmacro/genmacro.vcxproj @@ -0,0 +1,204 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {225700A5-07B8-434E-AD61-555278BF6733} + genmacro + Win32Proj + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genmacro.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + ..\Mkfiles\vs + + + $(OutDir)genmacro.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + + + run.bat "$(TargetPath)" + + + + + Full + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genmacro.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Full + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + ..\Mkfiles\vs + + + $(OutDir)genmacro.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + + + run.bat "$(TargetPath)" + + + + + + + + + + + {b545983b-8ee0-4a7b-a67a-e749eeae62a2} + false + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genmacro/genmacro.vcxproj.filters b/Mkfiles/vs/genmacro/genmacro.vcxproj.filters new file mode 100644 index 00000000..402cf1b4 --- /dev/null +++ b/Mkfiles/vs/genmacro/genmacro.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genmacro/run.bat b/Mkfiles/vs/genmacro/run.bat new file mode 100644 index 00000000..98c337ac --- /dev/null +++ b/Mkfiles/vs/genmacro/run.bat @@ -0,0 +1,5 @@ +cd ..\..\.. +%1 nasm-version.c nasm_version_mac version.mac +%1 nasm-macros.c nasm_standard_mac modules\parsers\nasm\nasm-std.mac +%1 win64-nasm.c win64_nasm_stdmac modules\objfmts\coff\win64-nasm.mac +%1 win64-gas.c win64_gas_stdmac modules\objfmts\coff\win64-gas.mac diff --git a/Mkfiles/vs/genmodule/genmodule.vcxproj b/Mkfiles/vs/genmodule/genmodule.vcxproj new file mode 100644 index 00000000..f8eb8f16 --- /dev/null +++ b/Mkfiles/vs/genmodule/genmodule.vcxproj @@ -0,0 +1,207 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0} + genmodule + Win32Proj + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + + + + Disabled + %(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;FILTERMODE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genmodule.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Disabled + ..\Mkfiles\vs;;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;FILTERMODE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genmodule.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + + + run.bat "$(TargetPath)" + + + + + Full + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;FILTERMODE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + $(IntDir) + Level3 + Default + + + $(OutDir)genmodule.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Full + ..\Mkfiles\vs;;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;FILTERMODE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + $(IntDir) + Level3 + Default + + + $(OutDir)genmodule.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + + + run.bat "$(TargetPath)" + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genmodule/genmodule.vcxproj.filters b/Mkfiles/vs/genmodule/genmodule.vcxproj.filters new file mode 100644 index 00000000..d3255c29 --- /dev/null +++ b/Mkfiles/vs/genmodule/genmodule.vcxproj.filters @@ -0,0 +1,20 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vc8/genmodule/run.bat b/Mkfiles/vs/genmodule/run.bat similarity index 94% rename from Mkfiles/vc8/genmodule/run.bat rename to Mkfiles/vs/genmodule/run.bat index e34a4169..00055692 100644 --- a/Mkfiles/vc8/genmodule/run.bat +++ b/Mkfiles/vs/genmodule/run.bat @@ -1,3 +1,3 @@ -@echo off -cd ..\..\.. -%1 libyasm\module.in Makefile.am +@echo off +cd ..\..\.. +%1 libyasm\module.in Makefile.am diff --git a/Mkfiles/vs/genperf/genperf.vcxproj b/Mkfiles/vs/genperf/genperf.vcxproj new file mode 100644 index 00000000..913caa89 --- /dev/null +++ b/Mkfiles/vs/genperf/genperf.vcxproj @@ -0,0 +1,261 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619} + genperf + Win32Proj + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + false + false + false + false + + + + + + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;STDC_HEADERS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genperf.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX86 + + + + + + + run.bat "$(TargetPath)" + + + x86insn_nasm.c;x86insn_gas.c;x86cpu.c;x86regtmod.c;%(Outputs) + + + run.bat "$(TargetPath)" + + + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;STDC_HEADERS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genperf.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + + + + + + + run.bat "$(TargetPath)" + + + x86insn_nasm.c;x86insn_gas.c;x86cpu.c;x86regtmod.c;%(Outputs) + + + run.bat "$(TargetPath)" + + + + + Full + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;STDC_HEADERS;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genperf.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + MachineX86 + + + + + + + run.bat "$(TargetPath)" + + + x86insn_nasm.c;x86insn_gas.c;x86cpu.c;x86regtmod.c;%(Outputs) + + + run.bat "$(TargetPath)" + + + + + Full + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;STDC_HEADERS;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genperf.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + + + + + + + run.bat "$(TargetPath)" + + + x86insn_nasm.c;x86insn_gas.c;x86cpu.c;x86regtmod.c;%(Outputs) + + + run.bat "$(TargetPath)" + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genperf/genperf.vcxproj.filters b/Mkfiles/vs/genperf/genperf.vcxproj.filters new file mode 100644 index 00000000..3124b5d7 --- /dev/null +++ b/Mkfiles/vs/genperf/genperf.vcxproj.filters @@ -0,0 +1,56 @@ + + + + + {3C1E9AA8-6338-4CED-99F1-BEBA80607BD5} + h;hpp;hxx;hm;inl;inc;xsd + + + {1062695D-1C50-4068-8313-73A409885BC1} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genperf/run.bat b/Mkfiles/vs/genperf/run.bat new file mode 100644 index 00000000..40ab8d52 --- /dev/null +++ b/Mkfiles/vs/genperf/run.bat @@ -0,0 +1,40 @@ +cd ..\..\.. +@echo off + +for /f "usebackq tokens=1*" %%f in (`reg query HKCR\Applications\python.exe\shell\open\command 2^>NUL`) do (set _my_=%%f %%g) +goto try1%errorlevel% + +:try10 +goto ok + +:try11 +for /f "usebackq tokens=1*" %%f in (`reg query HKCR\Python.File\shell\open\command 2^>NUL`) do (set _my_=%%f %%g) +goto try2%errorlevel% + +:try20: +goto ok + +:try21: +echo Building without Python ... +goto therest + +:ok +echo Building with Python ... +set _res_=%_my_:*REG_SZ=% +set _end_=%_res_:*exe"=% +call set _python_=%%_res_:%_end_%=%% +echo %_python_% +call %_python_% modules\arch\x86\gen_x86_insn.py + +:therest +@echo on +call :update %1 x86insn_nasm.gperf x86insn_nasm.c +call :update %1 x86insn_gas.gperf x86insn_gas.c +call :update %1 modules\arch\x86\x86cpu.gperf x86cpu.c +call :update %1 modules\arch\x86\x86regtmod.gperf x86regtmod.c +goto :eof + +:update +%1 %2 tf +call mkfiles\vs\out_copy_rename tf .\ %3 +del tf diff --git a/Mkfiles/vs/genstring/genstring.vcxproj b/Mkfiles/vs/genstring/genstring.vcxproj new file mode 100644 index 00000000..0c7d7898 --- /dev/null +++ b/Mkfiles/vs/genstring/genstring.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {021CEB0A-F721-4F59-B349-9CEEAF244459} + genstring + Win32Proj + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genstring.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genstring.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + + + run.bat "$(TargetPath)" + + + + + Full + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genstring.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Full + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genstring.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + + + run.bat "$(TargetPath)" + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genstring/genstring.vcxproj.filters b/Mkfiles/vs/genstring/genstring.vcxproj.filters new file mode 100644 index 00000000..04ed411d --- /dev/null +++ b/Mkfiles/vs/genstring/genstring.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {28EBE11C-5BE8-4935-9381-F57696749E0C} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + + + + \ No newline at end of file diff --git a/Mkfiles/vc8/genstring/run.bat b/Mkfiles/vs/genstring/run.bat similarity index 95% rename from Mkfiles/vc8/genstring/run.bat rename to Mkfiles/vs/genstring/run.bat index 5864b1dc..baedcecb 100644 --- a/Mkfiles/vc8/genstring/run.bat +++ b/Mkfiles/vs/genstring/run.bat @@ -1,2 +1,2 @@ -cd ..\..\.. -%1 license_msg license.c COPYING +cd ..\..\.. +%1 license_msg license.c COPYING diff --git a/Mkfiles/vs/genversion/genversion.vcxproj b/Mkfiles/vs/genversion/genversion.vcxproj new file mode 100644 index 00000000..c9cbe8b2 --- /dev/null +++ b/Mkfiles/vs/genversion/genversion.vcxproj @@ -0,0 +1,223 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} + genversion + Win32Proj + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + + + + Disabled + ..\..\vc10;..\..\..\;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genversion.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + cd ..\..\..\ +YASM-VERSION-GEN.bat + + + + + + Disabled + ..\..\vs;..\..\..\;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + ProgramDatabase + Default + + + $(OutDir)genversion.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + + + run.bat "$(TargetPath)" + + + cd ..\..\..\ +YASM-VERSION-GEN.bat + + + + + + Full + ..\..\vc10;..\..\..\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genversion.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + cd ..\..\..\ +YASM-VERSION-GEN.bat + + + + + + Full + ..\..\vs;..\..\..\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)genversion.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + + + run.bat "$(TargetPath)" + + + cd ..\..\..\ +YASM-VERSION-GEN.bat + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/genversion/genversion.vcxproj.filters b/Mkfiles/vs/genversion/genversion.vcxproj.filters new file mode 100644 index 00000000..cc088b12 --- /dev/null +++ b/Mkfiles/vs/genversion/genversion.vcxproj.filters @@ -0,0 +1,26 @@ + + + + + {2acbec3a-0ed8-4b2e-826e-a84c7d35f205} + h;hpp;hxx;hm;inl + + + {E67ED277-E4F2-4D79-8C9E-962BAC164F3F} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + + + Header Files + + + + + + \ No newline at end of file diff --git a/Mkfiles/vc/genversion/run.bat b/Mkfiles/vs/genversion/run.bat similarity index 93% rename from Mkfiles/vc/genversion/run.bat rename to Mkfiles/vs/genversion/run.bat index 30edf8f1..41b19cad 100644 --- a/Mkfiles/vc/genversion/run.bat +++ b/Mkfiles/vs/genversion/run.bat @@ -1,2 +1,2 @@ -cd ..\..\.. -%1 version.mac +cd ..\..\.. +%1 version.mac diff --git a/Mkfiles/vs/genversion/runpre.bat b/Mkfiles/vs/genversion/runpre.bat new file mode 100644 index 00000000..fdd15708 --- /dev/null +++ b/Mkfiles/vs/genversion/runpre.bat @@ -0,0 +1,2 @@ +cd ..\..\.. +YASM-VERSION-GEN.bat diff --git a/Mkfiles/vc/libyasm-stdint.h b/Mkfiles/vs/libyasm-stdint.h similarity index 63% rename from Mkfiles/vc/libyasm-stdint.h rename to Mkfiles/vs/libyasm-stdint.h index fed61b33..91d7d009 100644 --- a/Mkfiles/vc/libyasm-stdint.h +++ b/Mkfiles/vs/libyasm-stdint.h @@ -1,8 +1,4 @@ -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -#include -#else -typedef unsigned long uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif +#ifndef _UINTPTR_T_DEFINED +typedef unsigned long uintptr_t; +#define _UINTPTR_T_DEFINED +#endif diff --git a/Mkfiles/vs/libyasm/libyasm.vcxproj b/Mkfiles/vs/libyasm/libyasm.vcxproj new file mode 100644 index 00000000..03a53e25 --- /dev/null +++ b/Mkfiles/vs/libyasm/libyasm.vcxproj @@ -0,0 +1,278 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {29FE7874-1256-4AD6-B889-68E399DC9608} + libyasm + 10.0 + + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + Full + Default + ..;../../..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)libyasm.lib + true + + + + + X64 + + + Full + Default + ..;../../..;%(AdditionalIncludeDirectories) + NDEBUG;_LIB;HAVE_CONFIG_H;WIN64;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)libyasm.lib + true + + + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)libyasm.lib + true + + + + + X64 + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + _DEBUG;_LIB;HAVE_CONFIG_H;WIN64;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)libyasm.lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f0e8b707-00c5-4ff2-b8ef-7c39817132a0} + false + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/libyasm/libyasm.vcxproj.filters b/Mkfiles/vs/libyasm/libyasm.vcxproj.filters new file mode 100644 index 00000000..9bdf13a4 --- /dev/null +++ b/Mkfiles/vs/libyasm/libyasm.vcxproj.filters @@ -0,0 +1,200 @@ + + + + + {4ca3b698-9d01-4e4e-ae00-5c98da045efe} + h;hpp;hxx;hm;inl + + + {68607062-982d-4251-9a1a-30f76474983d} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Source Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/modules/modules.vcxproj b/Mkfiles/vs/modules/modules.vcxproj new file mode 100644 index 00000000..699eb6fd --- /dev/null +++ b/Mkfiles/vs/modules/modules.vcxproj @@ -0,0 +1,324 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} + modules + + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + StaticLibrary + false + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + Full + Default + ..;../../..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)modules.lib + true + + + + + + + + + X64 + + + Full + Default + ..;../../..;%(AdditionalIncludeDirectories) + NDEBUG;_LIB;HAVE_CONFIG_H;WIN64;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)modules.lib + true + + + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)modules.lib + true + + + + + X64 + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + _DEBUG;_LIB;HAVE_CONFIG_H;WIN64;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)modules.lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {225700a5-07b8-434e-ad61-555278bf6733} + false + + + {c45a8b59-8b59-4d5d-a8e8-fb090f8dd619} + false + + + {29fe7874-1256-4ad6-b889-68e399dc9608} + false + + + {3c58be13-50a3-4583-984d-d8902b3d7713} + false + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/modules/modules.vcxproj.filters b/Mkfiles/vs/modules/modules.vcxproj.filters new file mode 100644 index 00000000..e6ff3add --- /dev/null +++ b/Mkfiles/vs/modules/modules.vcxproj.filters @@ -0,0 +1,256 @@ + + + + + {39c89f91-d860-4396-a49f-86b8b7a51c33} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {be0cdf28-cbed-4774-b3cc-b63e4e3fa0a9} + + + {491cc60a-889b-4f53-aae9-f4d7d6aa667a} + + + {c084015d-3c3e-4379-8746-ae5cffcec79e} + + + {3333e0b3-e95f-44f6-9000-58d4da368360} + + + {528f2955-ceba-4691-a36c-054f119e3dcc} + + + {81686d52-eb71-4d4a-a830-66c45afb808f} + + + {98fe1e43-3794-4639-bf29-14b0c569754f} + + + {6b3956d4-0bff-4e8e-af61-a7e59b476fa4} + + + {446fad62-ac17-49e9-8263-33481f04f182} + + + {33fb7fc8-61f9-428d-9c94-7a4912fbb678} + + + {48fc77ec-7d78-4c0a-bfc2-9aa76faf5d7f} + + + + + Source Files\parsers + + + Source Files\arch + + + Source Files\arch + + + Source Files\arch + + + Source Files\arch + + + Source Files\arch + + + Source Files\arch + + + Source Files\arch + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\listfmts\nasm + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\parsers + + + Source Files\parsers + + + Source Files\parsers + + + Source Files\parsers + + + Source Files\parsers + + + Source Files\preprocs\cpp + + + Source Files\preprocs\gas + + + Source Files\preprocs\gas + + + Source Files\preprocs\nasm + + + Source Files\preprocs\nasm + + + Source Files\preprocs\nasm + + + Source Files\preprocs\nasm + + + Source Files\preprocs\raw + + + Source Files\parsers + + + Source Files\arch + + + Source Files\arch + + + Source Files\objfmts + + + + + Source Files\arch + + + Source Files\arch + + + Source Files\dbgfmts + + + Source Files\dbgfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\objfmts + + + Source Files\parsers + + + Source Files\parsers + + + Source Files\preprocs\gas + + + Source Files\preprocs\nasm + + + Source Files\preprocs\nasm + + + Source Files\preprocs\nasm + + + Source Files\preprocs\nasm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/out_copy_rename.bat b/Mkfiles/vs/out_copy_rename.bat new file mode 100644 index 00000000..3179b59a --- /dev/null +++ b/Mkfiles/vs/out_copy_rename.bat @@ -0,0 +1,42 @@ +@echo off +if not exist %1 goto nofile +if exist %2 goto copy + +echo creating directory %2 +md %2 > nul + +:copy +set str=%2 +for /f "useback tokens=*" %%a in ('%str%') do set str=%%~a +set str=%str:~-1% +if %str% == "\" goto hasbackslash + +if not exist %2\%3 goto cpy +fc %1 %2\%3 > nul && if not %errorlevel 1 goto exit +echo overwriting %2\%3 with %1 +copy %1 %2\%3 > nul +goto exit + +:cpy +echo copying %1 to %2\%3 +copy %1 %2\%3 > nul +goto exit + +:hasbackslash +if not exist %2%3 goto cpy2 +fc %1 %2%3 > nul && if not %errorlevel 1 goto exit +echo overwriting %2%3 with %1 +copy %1 %2%3 > nul +goto exit + +:cpy2 +echo copying %1 to %2%3 +copy %1 %2%3 > nul +goto exit + +:nofile +echo %1 not found + +:exit + + diff --git a/Mkfiles/vs/re2c/re2c.vcxproj b/Mkfiles/vs/re2c/re2c.vcxproj new file mode 100644 index 00000000..d7bb0736 --- /dev/null +++ b/Mkfiles/vs/re2c/re2c.vcxproj @@ -0,0 +1,221 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {3C58BE13-50A3-4583-984D-D8902B3D7713} + re2c + Win32Proj + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + Default + ProgramDatabase + + + $(OutDir)re2c.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Disabled + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir) + Level3 + Default + ProgramDatabase + + + $(OutDir)re2c.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + + + run.bat "$(TargetPath)" + + + + + Full + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)re2c.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + MachineX86 + + + run.bat "$(TargetPath)" + + + + + Full + ..;../../..;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir) + Level3 + Default + + + $(OutDir)re2c.exe + $(OutDir)$(TargetName).pdb + Console + true + true + false + + + + + run.bat "$(TargetPath)" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/re2c/re2c.vcxproj.filters b/Mkfiles/vs/re2c/re2c.vcxproj.filters new file mode 100644 index 00000000..da0f935c --- /dev/null +++ b/Mkfiles/vs/re2c/re2c.vcxproj.filters @@ -0,0 +1,80 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + + \ No newline at end of file diff --git a/Mkfiles/vc/re2c/run.bat b/Mkfiles/vs/re2c/run.bat similarity index 97% rename from Mkfiles/vc/re2c/run.bat rename to Mkfiles/vs/re2c/run.bat index cde2a7b6..6ac571f0 100644 --- a/Mkfiles/vc/re2c/run.bat +++ b/Mkfiles/vs/re2c/run.bat @@ -1,4 +1,4 @@ -cd ..\..\..\ -%1 -s -o lc3bid.c modules\arch\lc3b\lc3bid.re -%1 -b -o nasm-token.c modules\parsers\nasm\nasm-token.re -%1 -b -o gas-token.c modules\parsers\gas\gas-token.re +cd ..\..\..\ +%1 -s -o lc3bid.c modules\arch\lc3b\lc3bid.re +%1 -b -o nasm-token.c modules\parsers\nasm\nasm-token.re +%1 -b -o gas-token.c modules\parsers\gas\gas-token.re diff --git a/Mkfiles/vs/readme.vs.txt b/Mkfiles/vs/readme.vs.txt new file mode 100644 index 00000000..21c70be9 --- /dev/null +++ b/Mkfiles/vs/readme.vs.txt @@ -0,0 +1,96 @@ +Building YASM with Microsoft Visual Studio +------------------------------------------ + +This note describes how to build YASM using Microsoft Visual +Studio 2019 and later versions. + +1. YASM Download +---------------- + +First YASM needs to be downloaded and the files placed within +a suitable directory, which will be called here but can +be named and located as you wish. + +2. Building YASM +---------------- + +Now locate and double click on the yasm.sln solution file in +the 'Mkfiles/vs' subdirectory to open the build project in +the Visual Studio IDE and then select: + + win32 or x64 build + release or debug build + +as appropriate to build the YASM binaries that you need. + +4. Using YASM with Visual Sudio +------------------------------- + +The YASM version vsyasm.exe is designed specifically for use +with the 2010 and later versions of Visual Studio. To tell +Visual Studio where to find vsyasm.exe, the environment +variable YASMPATH can be set to the absolute path of the +directory in which vsyasm.exe is located (this path should +include the final backslash). + +Alternatively you can find the directory (or directories) +where the VC++ compiler binaries are located and put copies +of the vsyasm.exe binary in these directories. + +Depending on your system you can use either the win32 or the +x64 version of vsyasm.exe, which must be named vsyasm.exe. + +To use the custom tools facility in Visual Studio you need to +place a copy of three files - yasm.props, yasm.targets and +yasm.xml - into a location where they can be found by the +Visual Studio build customisation processes. There are several +ways to do this: + + a. put these files in the MSBUILD customisation directory + + b. put them in a convenient location and set this path in the + 'Build Customisations Search Path' in the Visual Studio + 'Projects and Solutions|VC++ Project Settings' item in + the 'Tools|Options' menu; + + c. put them in a convenient location and set this path in the + 'Build Customisation dialogue (discussed later). + +To use YASM in a project, right click on the project in the Solution +Explorer and select 'Build Customisations..'. This will give you a +dialog box that allows you to select YASM as an assembler (note that +your assembler files need to have the extension '.asm'). If you have +used option c. above, you will need to let the dialogue find them +using the 'Find Existing' button below the dialogue. + +To assemble a file with YASM, select the Property Page for the file +and the select 'Yasm Assembler' in the Tool dialog entry. Then click +'Apply' and an additional property page entry will appear and enable +YASM settings to be established. + +5. A Linker Issue +----------------- + +There appears to be a linker bug in the VC++ linker that prevents +symbols with absolute addresses being linked in DLL builds. This +means, for example, that LEA instructions of the general form: + + lea, rax,[rax+symbol] + +cannot be used for DLL builds. The following general form +has to be used instead: + + lea rcx,[symbol wrt rip] + lea rax,[rax+rcx] + +This limitation may also cause problems with other instruction +that use absolute addresses. + +6. Acknowledgements +------------------- + +I am most grateful for the fantastic support that Peter Johnson, +YASM's creator, has given me in tracking down issues in using +YASM for the production of Windows x64 code. + + Brian Gladman, 16th May 2019 diff --git a/Mkfiles/vs/vsyasm.props b/Mkfiles/vs/vsyasm.props new file mode 100644 index 00000000..9d5c14fa --- /dev/null +++ b/Mkfiles/vs/vsyasm.props @@ -0,0 +1,27 @@ + + + + Midl + CustomBuild + + + _SelectedFiles;$(YASMDependsOn) + + + C:\Program Files\yasm\ + + + + False + $(IntDir)%(FileName).obj + 0 + 0 + "$(YASM_PATH.TrimEnd('\'))"\vsyasm.exe -Xvc -f $(Platform) [AllOptions] [AdditionalOptions] [Inputs] + %(ObjectFile) + Assembling %(Filename)%(Extension) ==> $(IntDir)%(FileName).obj + false + + + diff --git a/Mkfiles/vs/vsyasm.targets b/Mkfiles/vs/vsyasm.targets new file mode 100644 index 00000000..8f38f2cb --- /dev/null +++ b/Mkfiles/vs/vsyasm.targets @@ -0,0 +1,110 @@ + + + + + + + _YASM + + + + + + $(ComputeLinkInputsTargets); + ComputeYASMOutput; + + + $(ComputeLibInputsTargets); + ComputeYASMOutput; + + + + + $(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml + + + + + + <_YASMReadTlog + Include="^%(YASM.FullPath);%(YASM.AdditionalDependencies)" + Condition="'%(YASM.ExcludedFromBuild)' != 'true' and '%(YASM.ObjectFile)' != ''"/> + <_YASMWriteTlog + Include="^%(YASM.FullPath);$([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '%(YASM.ObjectFile)'))" + Condition="'%(YASM.ExcludedFromBuild)' != 'true' and '%(YASM.ObjectFile)' != ''"/> + + + + + + + + <_YASMReadTlog Remove="@(_YASMReadTlog)" /> + <_YASMWriteTlog Remove="@(_YASMWriteTlog)" /> + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/vsyasm.vcxproj b/Mkfiles/vs/vsyasm.vcxproj new file mode 100644 index 00000000..40ab4d6e --- /dev/null +++ b/Mkfiles/vs/vsyasm.vcxproj @@ -0,0 +1,280 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {7FDD85BB-CC86-442B-A425-989B5B296ED5} + vsyasm + 10.0 + + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + $(Platform)\$(Configuration)/yasm.tlb + + + + + Disabled + .;../..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_LIB;HAVE_CONFIG_H;VC;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)vsyasm.exe + true + true + $(OutDir)$(ProjectName).pdb + Console + false + + + MachineX86 + + + + + X64 + $(Platform)\$(Configuration)/yasm.tlb + + + + + Disabled + .;../..;%(AdditionalIncludeDirectories) + _DEBUG;_LIB;HAVE_CONFIG_H;VC;WIN64;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)vsyasm.exe + true + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX64 + + + + + $(Platform)\$(Configuration)/yasm.tlb + + + + + Full + Default + true + .;../..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;VC;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)vsyasm.exe + true + true + $(OutDir)$(ProjectName).pdb + Console + false + + + MachineX86 + + + + + X64 + $(Platform)\$(Configuration)/yasm.tlb + + + + + Full + OnlyExplicitInline + .;../..;%(AdditionalIncludeDirectories) + NDEBUG;_LIB;HAVE_CONFIG_H;VC;WIN64;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)vsyasm.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX64 + true + + + + + + + + + {29fe7874-1256-4ad6-b889-68e399dc9608} + false + + + {d715a3d4-efaa-442e-ad8b-5b4ff64e1dd6} + false + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/vsyasm.xml b/Mkfiles/vs/vsyasm.xml new file mode 100644 index 00000000..a108f005 --- /dev/null +++ b/Mkfiles/vs/vsyasm.xml @@ -0,0 +1,283 @@ + + + + + + + + + + + + + General + + + + + + Symbols + + + + + + Files + + + + + + Command Line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Execute Before + + + Specifies the targets for the build customization to run before. + + + + + + + + + + + + Execute After + + + Specifies the targets for the build customization to run after. + + + + + + + + + + + + + + + + + + Additional Options + + + Additional Options + + + + + + + + \ No newline at end of file diff --git a/Mkfiles/vc8/yasm.sln b/Mkfiles/vs/yasm.sln similarity index 67% rename from Mkfiles/vc8/yasm.sln rename to Mkfiles/vs/yasm.sln index 6717facf..8d3b03a4 100644 --- a/Mkfiles/vc8/yasm.sln +++ b/Mkfiles/vs/yasm.sln @@ -1,128 +1,145 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasm", "libyasm\libyasm.vcproj", "{29FE7874-1256-4AD6-B889-68E399DC9608}" - ProjectSection(ProjectDependencies) = postProject - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0} = {F0E8B707-00C5-4FF2-B8EF-7C39817132A0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modules", "modules\modules.vcproj", "{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}" - ProjectSection(ProjectDependencies) = postProject - {3C58BE13-50A3-4583-984D-D8902B3D7713} = {3C58BE13-50A3-4583-984D-D8902B3D7713} - {5758BF4E-ABC4-11DA-B012-B622A1EF5492} = {5758BF4E-ABC4-11DA-B012-B622A1EF5492} - {29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608} - {225700A5-07B8-434E-AD61-555278BF6733} = {225700A5-07B8-434E-AD61-555278BF6733} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasm", "yasm.vcproj", "{34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}" - ProjectSection(ProjectDependencies) = postProject - {021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459} - {29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608} - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} = {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmacro", "genmacro\genmacro.vcproj", "{225700A5-07B8-434E-AD61-555278BF6733}" - ProjectSection(ProjectDependencies) = postProject - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} = {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genversion", "genversion\genversion.vcproj", "{B545983B-8EE0-4A7B-A67A-E749EEAE62A2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "re2c\re2c.vcproj", "{3C58BE13-50A3-4583-984D-D8902B3D7713}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gap", "gap\gap.vcproj", "{5758BF4E-ABC4-11DA-B012-B622A1EF5492}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmodule", "genmodule\genmodule.vcproj", "{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genstring", "genstring\genstring.vcproj", "{021CEB0A-F721-4F59-B349-9CEEAF244459}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{825AC694-358C-4D8D-92DE-33A2691978CE}" - ProjectSection(SolutionItems) = preProject - crt_secure_no_deprecate.vsprops = crt_secure_no_deprecate.vsprops - readme.vc8.txt = readme.vc8.txt - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|Win32.ActiveCfg = Debug|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|Win32.Build.0 = Debug|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|x64.ActiveCfg = Debug|x64 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|x64.Build.0 = Debug|x64 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|Win32.ActiveCfg = Release|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|Win32.Build.0 = Release|Win32 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|x64.ActiveCfg = Release|x64 - {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|x64.Build.0 = Release|x64 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|Win32.ActiveCfg = Debug|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|Win32.Build.0 = Debug|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|x64.ActiveCfg = Debug|x64 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|x64.Build.0 = Debug|x64 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|Win32.ActiveCfg = Release|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|Win32.Build.0 = Release|Win32 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|x64.ActiveCfg = Release|x64 - {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|x64.Build.0 = Release|x64 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|Win32.ActiveCfg = Debug|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|Win32.Build.0 = Debug|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|x64.ActiveCfg = Debug|x64 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|x64.Build.0 = Debug|x64 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|Win32.ActiveCfg = Release|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|Win32.Build.0 = Release|Win32 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|x64.ActiveCfg = Release|x64 - {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|x64.Build.0 = Release|x64 - {225700A5-07B8-434E-AD61-555278BF6733}.Debug|Win32.ActiveCfg = Debug|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Debug|Win32.Build.0 = Debug|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Debug|x64.ActiveCfg = Debug|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Debug|x64.Build.0 = Debug|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Release|Win32.ActiveCfg = Release|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Release|Win32.Build.0 = Release|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Release|x64.ActiveCfg = Release|Win32 - {225700A5-07B8-434E-AD61-555278BF6733}.Release|x64.Build.0 = Release|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|Win32.ActiveCfg = Debug|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|Win32.Build.0 = Debug|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|x64.ActiveCfg = Debug|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|x64.Build.0 = Debug|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|Win32.ActiveCfg = Release|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|Win32.Build.0 = Release|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|x64.ActiveCfg = Release|Win32 - {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|x64.Build.0 = Release|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|Win32.ActiveCfg = Debug|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|Win32.Build.0 = Debug|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|x64.ActiveCfg = Debug|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|x64.Build.0 = Debug|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|Win32.ActiveCfg = Release|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|Win32.Build.0 = Release|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|x64.ActiveCfg = Release|Win32 - {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|x64.Build.0 = Release|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|Win32.ActiveCfg = Debug|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|Win32.Build.0 = Debug|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|x64.ActiveCfg = Debug|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|x64.Build.0 = Debug|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|Win32.ActiveCfg = Release|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|Win32.Build.0 = Release|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|x64.ActiveCfg = Release|Win32 - {5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|x64.Build.0 = Release|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|Win32.ActiveCfg = Debug|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|Win32.Build.0 = Debug|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|x64.ActiveCfg = Debug|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|x64.Build.0 = Debug|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|Win32.ActiveCfg = Release|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|Win32.Build.0 = Release|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|x64.ActiveCfg = Release|Win32 - {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|x64.Build.0 = Release|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|Win32.ActiveCfg = Debug|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|Win32.Build.0 = Debug|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|x64.ActiveCfg = Debug|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|x64.Build.0 = Debug|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|Win32.ActiveCfg = Release|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|Win32.Build.0 = Release|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|x64.ActiveCfg = Release|Win32 - {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|x64.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30320.27 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{825AC694-358C-4D8D-92DE-33A2691978CE}" + ProjectSection(SolutionItems) = preProject + crt_secure_no_deprecate.vsprops = crt_secure_no_deprecate.vsprops + readme.vs.txt = readme.vs.txt + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasm", "libyasm\libyasm.vcxproj", "{29FE7874-1256-4AD6-B889-68E399DC9608}" + ProjectSection(ProjectDependencies) = postProject + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} = {B545983B-8EE0-4A7B-A67A-E749EEAE62A2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modules", "modules\modules.vcxproj", "{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasm", "yasm.vcxproj", "{34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmacro", "genmacro\genmacro.vcxproj", "{225700A5-07B8-434E-AD61-555278BF6733}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genversion", "genversion\genversion.vcxproj", "{B545983B-8EE0-4A7B-A67A-E749EEAE62A2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "re2c\re2c.vcxproj", "{3C58BE13-50A3-4583-984D-D8902B3D7713}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genperf", "genperf\genperf.vcxproj", "{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmodule", "genmodule\genmodule.vcxproj", "{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genstring", "genstring\genstring.vcxproj", "{021CEB0A-F721-4F59-B349-9CEEAF244459}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ytasm", "ytasm.vcxproj", "{2162937B-0DBD-4450-B45F-DF578D8E7508}" + ProjectSection(ProjectDependencies) = postProject + {021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsyasm", "vsyasm.vcxproj", "{7FDD85BB-CC86-442B-A425-989B5B296ED5}" + ProjectSection(ProjectDependencies) = postProject + {021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|Win32.ActiveCfg = Debug|Win32 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|Win32.Build.0 = Debug|Win32 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|x64.ActiveCfg = Debug|x64 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Debug|x64.Build.0 = Debug|x64 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|Win32.ActiveCfg = Release|Win32 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|Win32.Build.0 = Release|Win32 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|x64.ActiveCfg = Release|x64 + {29FE7874-1256-4AD6-B889-68E399DC9608}.Release|x64.Build.0 = Release|x64 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|Win32.ActiveCfg = Debug|Win32 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|Win32.Build.0 = Debug|Win32 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|x64.ActiveCfg = Debug|x64 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Debug|x64.Build.0 = Debug|x64 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|Win32.ActiveCfg = Release|Win32 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|Win32.Build.0 = Release|Win32 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|x64.ActiveCfg = Release|x64 + {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}.Release|x64.Build.0 = Release|x64 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|Win32.ActiveCfg = Debug|Win32 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|Win32.Build.0 = Debug|Win32 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|x64.ActiveCfg = Debug|x64 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Debug|x64.Build.0 = Debug|x64 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|Win32.ActiveCfg = Release|Win32 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|Win32.Build.0 = Release|Win32 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|x64.ActiveCfg = Release|x64 + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}.Release|x64.Build.0 = Release|x64 + {225700A5-07B8-434E-AD61-555278BF6733}.Debug|Win32.ActiveCfg = Debug|Win32 + {225700A5-07B8-434E-AD61-555278BF6733}.Debug|Win32.Build.0 = Debug|Win32 + {225700A5-07B8-434E-AD61-555278BF6733}.Debug|x64.ActiveCfg = Debug|Win32 + {225700A5-07B8-434E-AD61-555278BF6733}.Debug|x64.Build.0 = Debug|Win32 + {225700A5-07B8-434E-AD61-555278BF6733}.Release|Win32.ActiveCfg = Release|Win32 + {225700A5-07B8-434E-AD61-555278BF6733}.Release|Win32.Build.0 = Release|Win32 + {225700A5-07B8-434E-AD61-555278BF6733}.Release|x64.ActiveCfg = Release|x64 + {225700A5-07B8-434E-AD61-555278BF6733}.Release|x64.Build.0 = Release|x64 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|Win32.ActiveCfg = Debug|Win32 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|Win32.Build.0 = Debug|Win32 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|x64.ActiveCfg = Debug|Win32 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Debug|x64.Build.0 = Debug|Win32 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|Win32.ActiveCfg = Release|Win32 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|Win32.Build.0 = Release|Win32 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|x64.ActiveCfg = Release|x64 + {B545983B-8EE0-4A7B-A67A-E749EEAE62A2}.Release|x64.Build.0 = Release|x64 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|Win32.ActiveCfg = Debug|Win32 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|Win32.Build.0 = Debug|Win32 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|x64.ActiveCfg = Debug|Win32 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug|x64.Build.0 = Debug|Win32 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|Win32.ActiveCfg = Release|Win32 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|Win32.Build.0 = Release|Win32 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|x64.ActiveCfg = Release|x64 + {3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|x64.Build.0 = Release|x64 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|Win32.ActiveCfg = Debug|Win32 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|Win32.Build.0 = Debug|Win32 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|x64.ActiveCfg = Debug|Win32 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|x64.Build.0 = Debug|Win32 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|Win32.ActiveCfg = Release|Win32 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|Win32.Build.0 = Release|Win32 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|x64.ActiveCfg = Release|x64 + {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|x64.Build.0 = Release|x64 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|Win32.ActiveCfg = Debug|Win32 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|Win32.Build.0 = Debug|Win32 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|x64.ActiveCfg = Debug|Win32 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|x64.Build.0 = Debug|Win32 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|Win32.ActiveCfg = Release|Win32 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|Win32.Build.0 = Release|Win32 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|x64.ActiveCfg = Release|x64 + {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release|x64.Build.0 = Release|x64 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|Win32.ActiveCfg = Debug|Win32 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|Win32.Build.0 = Debug|Win32 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|x64.ActiveCfg = Debug|Win32 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Debug|x64.Build.0 = Debug|Win32 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|Win32.ActiveCfg = Release|Win32 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|Win32.Build.0 = Release|Win32 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|x64.ActiveCfg = Release|x64 + {021CEB0A-F721-4F59-B349-9CEEAF244459}.Release|x64.Build.0 = Release|x64 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Debug|Win32.ActiveCfg = Debug|Win32 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Debug|Win32.Build.0 = Debug|Win32 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Debug|x64.ActiveCfg = Debug|x64 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Debug|x64.Build.0 = Debug|x64 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Release|Win32.ActiveCfg = Release|Win32 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Release|Win32.Build.0 = Release|Win32 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Release|x64.ActiveCfg = Release|x64 + {2162937B-0DBD-4450-B45F-DF578D8E7508}.Release|x64.Build.0 = Release|x64 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Debug|Win32.ActiveCfg = Debug|Win32 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Debug|Win32.Build.0 = Debug|Win32 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Debug|x64.ActiveCfg = Debug|x64 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Debug|x64.Build.0 = Debug|x64 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Release|Win32.ActiveCfg = Release|Win32 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Release|Win32.Build.0 = Release|Win32 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Release|x64.ActiveCfg = Release|x64 + {7FDD85BB-CC86-442B-A425-989B5B296ED5}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BE3F09BB-91A9-474C-AAD9-4B4D43DCE89E} + EndGlobalSection +EndGlobal diff --git a/Mkfiles/vs/yasm.vcxproj b/Mkfiles/vs/yasm.vcxproj new file mode 100644 index 00000000..13363e3c --- /dev/null +++ b/Mkfiles/vs/yasm.vcxproj @@ -0,0 +1,283 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5} + yasm + + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + $(Platform)\$(Configuration)/yasm.tlb + + + + + Disabled + .;../..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_LIB;HAVE_CONFIG_H;VC;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)yasm.exe + true + true + $(OutDir)$(ProjectName).pdb + Console + false + + + MachineX86 + + + + + X64 + $(Platform)\$(Configuration)/yasm.tlb + + + + + Disabled + .;../..;%(AdditionalIncludeDirectories) + _DEBUG;_LIB;HAVE_CONFIG_H;VC;WIN64;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)yasm.exe + true + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX64 + + + + + $(Platform)\$(Configuration)/yasm.tlb + + + + + Full + Default + true + .;../..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;VC;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)yasm.exe + true + true + $(OutDir)$(ProjectName).pdb + Console + false + + + MachineX86 + + + + + X64 + $(Platform)\$(Configuration)/yasm.tlb + + + + + Full + OnlyExplicitInline + .;../..;%(AdditionalIncludeDirectories) + NDEBUG;_LIB;HAVE_CONFIG_H;VC;WIN64;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)yasm.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX64 + true + + + + + + + + + + + + + + + + + {021ceb0a-f721-4f59-b349-9ceeaf244459} + false + + + {29fe7874-1256-4ad6-b889-68e399dc9608} + false + + + {d715a3d4-efaa-442e-ad8b-5b4ff64e1dd6} + false + + + + + + \ No newline at end of file diff --git a/Mkfiles/vs/yasm.vcxproj.filters b/Mkfiles/vs/yasm.vcxproj.filters new file mode 100644 index 00000000..04941c22 --- /dev/null +++ b/Mkfiles/vs/yasm.vcxproj.filters @@ -0,0 +1,41 @@ + + + + + {51f0d88e-1373-4bf8-a72e-c79706d37f8b} + h;hpp;hxx;hm;inl + + + {db67b411-6f59-462c-9c20-75024c6b3912} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Mkfiles/vs/ytasm.vcxproj b/Mkfiles/vs/ytasm.vcxproj new file mode 100644 index 00000000..0e9d6bfa --- /dev/null +++ b/Mkfiles/vs/ytasm.vcxproj @@ -0,0 +1,278 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2162937B-0DBD-4450-B45F-DF578D8E7508} + ytasm + + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + Application + false + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + $(Platform)\$(Configuration)/yasm.tlb + + + + + Disabled + .;../..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_LIB;HAVE_CONFIG_H;VC;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)ytasm.exe + true + true + $(OutDir)$(ProjectName).pdb + Console + false + + + MachineX86 + + + + + X64 + $(Platform)\$(Configuration)/yasm.tlb + + + + + Disabled + .;../..;%(AdditionalIncludeDirectories) + _DEBUG;_LIB;HAVE_CONFIG_H;VC;WIN64;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)ytasm.exe + true + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX64 + + + + + $(Platform)\$(Configuration)/yasm.tlb + + + + + Full + Default + true + .;../..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;VC;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)ytasm.exe + true + true + $(OutDir)$(ProjectName).pdb + Console + false + + + MachineX86 + + + + + X64 + $(Platform)\$(Configuration)/yasm.tlb + + + + + Full + OnlyExplicitInline + .;../..;%(AdditionalIncludeDirectories) + NDEBUG;_LIB;HAVE_CONFIG_H;VC;WIN64;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + + + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + Default + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)ytasm.exe + true + $(OutDir)$(TargetName).pdb + Console + false + + + MachineX64 + true + + + + + + + + + + + + + + + + {29fe7874-1256-4ad6-b889-68e399dc9608} + false + + + {d715a3d4-efaa-442e-ad8b-5b4ff64e1dd6} + false + + + + + + \ No newline at end of file diff --git a/README b/README index e69de29b..6d529727 100644 --- a/README +++ b/README @@ -0,0 +1,13 @@ +The Yasm Modular Assembler Project +================================== + +Yasm is a complete rewrite of the NASM assembler under the “new” BSD License +(some portions are under other licenses, see COPYING for details). + +Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and +GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, +RDOFF2, COFF, Win32, and Win64 object formats, and generates source debugging +information in STABS, DWARF 2, and CodeView 8 formats. + +Yasm can be easily integrated into Visual Studio 2005/2008 and 2010 for +assembly of NASM or GAS syntax code into Win32 or Win64 object files. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..d205e244 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +Yasm Security policy +==================== + +A security bug is one that compromises the security of a system by either +making it unavailable, compromising the integrity of the data or by providing +unauthorized access to resources on the system through untrusted inputs. In +the context of yasm, it is expected that all inputs are trusted, since it is +developer code. It is the responsibility of the developer to either verify the +authenticity of the code they're building or to build untrusted code in a +sandbox to protect the system from any ill effects. This responsibility also +extends to the libyasm library. While the library aims to be robust and will +fix bugs arising from bogus inputs, it is the responsibility of the application +to ensure that either the environment under which the call is made is isolated +or that the input is sanitized. + +As such, all bugs will be deemed to have no security consequence with the +exception of bugs where yasm generates code that invoke [undefined behaviour in +a +system](https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf) +from valid, safe and trusted assembly code. + +Reporting security bugs +----------------------- + +To report security issues privately, you may reach out to one of the members of +the [Yasm Team](https://github.com/yasm/yasm/wiki/Yasmteam). Most issues +should just go into GitHub issues as regular bugs. diff --git a/YASM-VERSION-GEN.bat b/YASM-VERSION-GEN.bat new file mode 100644 index 00000000..92bb97e6 --- /dev/null +++ b/YASM-VERSION-GEN.bat @@ -0,0 +1,38 @@ +@echo off +if exist version goto haveversion + +set errorlevel=0 +set _my_= +for /f "usebackq tokens=1*" %%f in (`reg query HKCU\Software\TortoiseGit /v MSysGit`) do (set _my_=%%f %%g) +if %errorlevel% neq 0 goto notfound +if "%_my_%" == "" goto notfound + +rem Using the shell script version (calling Git) ... +set _gitbin_=%_my_:*REG_SZ=% +for /f "tokens=* delims= " %%a in ("%_gitbin_%") do set _gitbin_=%%a +set OLDPATH=%PATH% +set PATH=%_gitbin_%;%PATH% +"%_gitbin_%\sh" YASM-VERSION-GEN.sh "%_gitbin_%" +set PATH=%OLDPATH% +exit /b + +:notfound +rem Could not find Git ... +set _ver_= +for /f "usebackq tokens=2 delims==" %%a in (`%SystemRoot%\system32\find "DEF_VER=" ^ YASM-VERSION-FILE +echo #define PACKAGE_STRING "yasm %_ver_%" > YASM-VERSION.h +echo #define PACKAGE_VERSION "%_ver_%" >> YASM-VERSION.h + diff --git a/YASM-VERSION-GEN.sh b/YASM-VERSION-GEN.sh new file mode 100755 index 00000000..33469507 --- /dev/null +++ b/YASM-VERSION-GEN.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +YVF=YASM-VERSION-FILE +DEF_VER=v1.3.0 + +LF=' +' + +# First see if there is a version file (included in release tarballs), +# then try git-describe, then default. +if test -f version +then + VN=$(cat version) || VN="$DEF_VER" +elif test -d .git -o -f .git && + VN=$(git describe --match "v[0-9]*" --abbrev=4 HEAD 2>/dev/null) && + case "$VN" in + *$LF*) (exit 1) ;; + v[0-9]*) + git update-index -q --refresh + test -z "$(git diff-index --name-only HEAD --)" || + VN="$VN-dirty" ;; + esac +then + VN=$(echo "$VN" | sed -e 's/-/./g'); +else + VN="$DEF_VER" +fi + +VN=$(expr "$VN" : v*'\(.*\)') + +if test -r $YVF +then + VC=$(cat $YVF) +else + VC=unset +fi +test "$VN" = "$VC" || { + echo >&2 "$VN" + echo "$VN" >$YVF + echo "#define PACKAGE_STRING \"yasm $VN\"" > YASM-VERSION.h + echo "#define PACKAGE_VERSION \"$VN\"" >> YASM-VERSION.h +} diff --git a/autogen.sh b/autogen.sh index 9f9c45b2..12da6aa4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,4 @@ #!/bin/sh -# $Id$ # Run this to set up the build system: configure, makefiles, etc. # (based on the version in enlightenment's cvs) @@ -74,7 +73,8 @@ if test ! -d "config"; then mkdir config fi -rm -f stamp-h.in +rm -rf autom4te.cache +rm -f configure config.h config.status config.log stamp-h.in #echo " gettextize -f --no-changelog" #echo "N" | gettextize -f --no-changelog || exit 1 echo " aclocal $ACLOCAL_FLAGS" diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 00000000..5e4ef796 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY(modules) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 00000000..e4351fc9 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,2 @@ +FILE(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake") + diff --git a/cmake/modules/DummyCFile.c b/cmake/modules/DummyCFile.c new file mode 100644 index 00000000..f8b643af --- /dev/null +++ b/cmake/modules/DummyCFile.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/cmake/modules/VersionGen.cmake b/cmake/modules/VersionGen.cmake new file mode 100644 index 00000000..f10ce33c --- /dev/null +++ b/cmake/modules/VersionGen.cmake @@ -0,0 +1,78 @@ +# Redistribution and use is allowed according to the terms of the BSD license. +# +# Copyright (c) 2011 Peter Johnson + +macro (VERSION_GEN _version _version_file _default_version) + set (_vn "v${_default_version}") + + # First see if there is a version file (included in release tarballs), + # then try git-describe, then default. + if (EXISTS "${CMAKE_SOURCE_DIR}/version") + file (STRINGS "${CMAKE_SOURCE_DIR}/version" _version_strs LIMIT_COUNT 1) + list (GET _version_strs 0 _version_strs0) + if (NOT (${_version_strs0} STREQUAL "")) + set (_vn "v${_version_strs0}") + endif (NOT (${_version_strs0} STREQUAL "")) + elseif (EXISTS "${CMAKE_SOURCE_DIR}/.git") + execute_process (COMMAND git describe --match "v[0-9]*" --abbrev=4 HEAD + RESULT_VARIABLE _git_result + OUTPUT_VARIABLE _git_vn + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if (_git_result EQUAL 0) + # Special handling until we get a more recent tag on the master + # branch + if (_git_vn MATCHES "^v0[.]1[.]0") + execute_process (COMMAND git merge-base v${_default_version} HEAD + OUTPUT_VARIABLE _merge_base + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + #message (STATUS "Merge base: ${_merge_base}") + + execute_process (COMMAND git rev-list ${_merge_base}..HEAD + OUTPUT_VARIABLE _rev_list + ERROR_QUIET) + string (REGEX MATCHALL "[^\n]*\n" _rev_list_lines "${_rev_list}") + #message (STATUS "Rev list: ${_rev_list_lines}") + list (LENGTH _rev_list_lines _vn1) + + execute_process (COMMAND git rev-list --max-count=1 --abbrev-commit --abbrev=4 HEAD + OUTPUT_VARIABLE _vn2 + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set (_git_vn "v${_default_version}-${_vn1}-g${_vn2}") + endif (_git_vn MATCHES "^v0[.]1[.]0") + + # Append -dirty if there are local changes + execute_process (COMMAND git update-index -q --refresh) + execute_process (COMMAND git diff-index --name-only HEAD -- + OUTPUT_VARIABLE _git_vn_dirty) + if (_git_vn_dirty) + set (_git_vn "${_git_vn}-dirty") + endif (_git_vn_dirty) + + # Substitute . for - in the result + string (REPLACE "-" "." _vn "${_git_vn}") + endif (_git_result EQUAL 0) + endif (EXISTS "${CMAKE_SOURCE_DIR}/version") + + # Strip leading "v" from version + #message (STATUS "_vn: ${_vn}") + string (REGEX REPLACE "^v*(.+)" "\\1" _vn "${_vn}") + + # Update version file if required + if (EXISTS ${_version_file}) + file (STRINGS ${_version_file} _version_strs LIMIT_COUNT 1) + list (GET _version_strs 0 _vc) + else (EXISTS ${_version_file}) + set (_vc "unset") + endif (EXISTS ${_version_file}) + if (NOT ("${_vn}" STREQUAL "${_vc}")) + file (WRITE ${_version_file} "${_vn}") + endif (NOT ("${_vn}" STREQUAL "${_vc}")) + + # Set output version variable + set (${_version} ${_vn}) +endmacro (VERSION_GEN) diff --git a/cmake/modules/YasmMacros.cmake b/cmake/modules/YasmMacros.cmake new file mode 100644 index 00000000..c6e01922 --- /dev/null +++ b/cmake/modules/YasmMacros.cmake @@ -0,0 +1,83 @@ +# Portions based on kdelibs KDE4Macros.cmake: +# +# Copyright (c) 2006, 2007, Alexander Neundorf, +# Copyright (c) 2006, 2007, Laurent Montel, +# Copyright (c) 2007 Matthias Kretz +# +# Redistribution and use is allowed according to the terms of the BSD license. +# +# Changes for Yasm Copyright (c) 2007 Peter Johnson + +# add a unit test, which is executed when running make test +# it will be built with RPATH pointing to the build dir +# The targets are always created, but only built for the "all" +# target if the option YASM_BUILD_TESTS is enabled. Otherwise the rules for +# the target are created but not built by default. You can build them by +# manually building the target. +# The name of the target can be specified using TESTNAME , if it is +# not given the macro will default to the +macro (YASM_ADD_UNIT_TEST _test_NAME) + set(_srcList ${ARGN}) + set(_targetName ${_test_NAME}) + if( ${ARGV1} STREQUAL "TESTNAME" ) + set(_targetName ${ARGV2}) + LIST(REMOVE_AT _srcList 0 1) + endif( ${ARGV1} STREQUAL "TESTNAME" ) + yasm_add_test_executable( ${_test_NAME} ${_srcList} ) + add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} ) +endmacro (YASM_ADD_UNIT_TEST) + +# add an test executable +# it will be built with RPATH pointing to the build dir +# The targets are always created, but only built for the "all" +# target if the option YASM_BUILD_TESTS is enabled. Otherwise the rules for +# the target are created but not built by default. You can build them by +# manually building the target. +macro (YASM_ADD_TEST_EXECUTABLE _target_NAME) + + set(_add_executable_param) + + if (NOT YASM_BUILD_TESTS) + set(_add_executable_param EXCLUDE_FROM_ALL) + endif (NOT YASM_BUILD_TESTS) + + set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) + + set(_SRCS ${ARGN}) + add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS}) + + set_target_properties(${_target_NAME} PROPERTIES + SKIP_BUILD_RPATH FALSE + BUILD_WITH_INSTALL_RPATH FALSE) + +endmacro (YASM_ADD_TEST_EXECUTABLE) + +macro (YASM_ADD_MODULE _module_NAME) + list(APPEND YASM_MODULES_SRC ${ARGN}) + list(APPEND YASM_MODULES ${_module_NAME}) +endmacro (YASM_ADD_MODULE) + +macro (YASM_GENPERF _in_NAME _out_NAME) + add_custom_command( + OUTPUT ${_out_NAME} + COMMAND yasm::genperf ${_in_NAME} ${_out_NAME} + MAIN_DEPENDENCY ${_in_NAME} + ) +endmacro (YASM_GENPERF) + +macro (YASM_RE2C _in_NAME _out_NAME) + add_custom_command( + OUTPUT ${_out_NAME} + COMMAND yasm::re2c ${ARGN} -o ${_out_NAME} ${_in_NAME} + MAIN_DEPENDENCY ${_in_NAME} + ) +endmacro (YASM_RE2C) + +macro (YASM_GENMACRO _in_NAME _out_NAME _var_NAME) + add_custom_command( + OUTPUT ${_out_NAME} + COMMAND yasm::genmacro ${_out_NAME} ${_var_NAME} ${_in_NAME} + MAIN_DEPENDENCY ${_in_NAME} + ) +endmacro (YASM_GENMACRO) + diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 00000000..61e99d00 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,53 @@ +/* config.h. Generated by cmake from config.h.cmake */ + +#define CMAKE_BUILD 1 + +/* Define if shared libs are being built */ +#cmakedefine BUILD_SHARED_LIBS 1 + +/* Define if messsage translations are enabled */ +#cmakedefine ENABLE_NLS 1 + +/* Define if you have the `abort' function. */ +#cmakedefine HAVE_ABORT 1 + +/* */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBGEN_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DIRECT_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#cmakedefine HAVE_GETCWD 1 + +/* Define to 1 if you have the `_stricmp' function. */ +#cmakedefine HAVE__STRICMP 1 + +/* Define to 1 if you have the `toascii' function. */ +#cmakedefine HAVE_TOASCII 1 + +/* Name of package */ +#define PACKAGE "yasm" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "bug-yasm@tortall.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "yasm" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "@PACKAGE_STRING@" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "@PACKAGE_VERSION@" + +#define VERSION PACKAGE_VERSION + +/* Command name to run C preprocessor */ +#define CPP_PROG "@CPP_PROG@" diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 00000000..4ea29110 --- /dev/null +++ b/config/.gitignore @@ -0,0 +1,5 @@ +mkinstalldirs +depcomp +compile +missing +install-sh diff --git a/config/config.guess b/config/config.guess index 0e30d56e..d622a44e 100644 --- a/config/config.guess +++ b/config/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2003-07-02' +timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -16,24 +17,24 @@ timestamp='2003-07-02' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -53,7 +54,8 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -104,7 +106,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -141,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -158,6 +160,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -166,7 +169,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -176,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -196,50 +199,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -277,42 +262,52 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -320,32 +315,51 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -354,10 +368,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -369,10 +383,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -382,38 +396,41 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -437,35 +454,36 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -478,29 +496,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -508,7 +526,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -523,15 +541,19 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; - *:AIX:*:[45]) + exit ;; + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -544,28 +566,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -574,52 +596,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -627,9 +649,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -637,11 +669,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -669,197 +701,173 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/FreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) + exit ;; + aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit 0 ;; - ia64:Linux:*:*) + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -869,11 +877,90 @@ EOF EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -881,109 +968,71 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -991,15 +1040,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1091,68 +1154,94 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1160,22 +1249,28 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1186,28 +1281,53 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1230,16 +1350,16 @@ main () #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1328,11 +1448,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1341,22 +1462,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1367,7 +1488,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/config/config.rpath b/config/config.rpath index c492a93b..c38b914d 100755 --- a/config/config.rpath +++ b/config/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2006 Free Software Foundation, Inc. +# Copyright 1996-2013 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # @@ -25,7 +25,7 @@ # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. -# All known linkers require a `.a' archive for static linking (except MSVC, +# All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so @@ -47,7 +47,7 @@ for cc_temp in $CC""; do done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` -# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. +# Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then @@ -57,14 +57,7 @@ else aix*) wl='-Wl,' ;; - darwin*) - case $cc_basename in - xlc*) - wl='-Wl,' - ;; - esac - ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' @@ -72,24 +65,37 @@ else irix5* | irix6* | nonstopux*) wl='-Wl,' ;; - newsos6) - ;; - linux*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in - icc* | ecc*) + ecc*) wl='-Wl,' ;; - pgcc | pgf77 | pgf90) + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; + xl* | bgxl* | bgf* | mpixl*) + wl='-Wl,' + ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + wl= + ;; *Sun\ C*) wl='-Wl,' ;; @@ -97,22 +103,36 @@ else ;; esac ;; + newsos6) + ;; + *nto* | *qnx*) + ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; - sco3.2v5*) + rdos*) ;; solaris*) - wl='-Wl,' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac ;; sunos4*) wl='-Qoption ld ' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; unicos*) wl='-Wl,' ;; @@ -121,7 +141,7 @@ else esac fi -# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= @@ -129,7 +149,7 @@ hardcode_direct=no hardcode_minus_L=no case "$host_os" in - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. @@ -155,22 +175,21 @@ if test "$with_gnu_ld" = yes; then # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in - aix3* | aix4* | aix5*) + aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we cannot use - # them. - ld_shlibs=no + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then @@ -179,7 +198,7 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no fi ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' @@ -189,11 +208,13 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no fi ;; - interix3*) + haiku*) + ;; + interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; - linux*) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else @@ -251,7 +272,7 @@ else hardcode_direct=unsupported fi ;; - aix4* | aix5*) + aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -261,7 +282,7 @@ else # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes @@ -280,7 +301,7 @@ else strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct=yes + : else # We have old collect2 hardcode_direct=unsupported @@ -316,14 +337,18 @@ else fi ;; amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac ;; bsdi[45]*) ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is @@ -333,24 +358,15 @@ else ;; darwin* | rhapsody*) hardcode_direct=no - if test "$GCC" = yes ; then + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then : else - case $cc_basename in - xlc*) - ;; - *) - ld_shlibs=no - ;; - esac + ld_shlibs=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; - freebsd1*) - ld_shlibs=no - ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -359,7 +375,7 @@ else hardcode_direct=yes hardcode_minus_L=yes ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; @@ -411,19 +427,25 @@ else hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; + *nto* | *qnx*) + ;; openbsd*) - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs=no fi ;; os2*) @@ -471,7 +493,7 @@ else ld_shlibs=yes fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' @@ -487,34 +509,58 @@ else fi # Check dynamic linker characteristics -# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) + library_names_spec='$libname.a' ;; - aix4* | aix5*) + aix[4-9]*) + library_names_spec='$libname$shrext' ;; amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac ;; beos*) + library_names_spec='$libname$shrext' ;; bsdi[45]*) + library_names_spec='$libname$shrext' ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib + library_names_spec='$libname$shrext' ;; dgux*) - ;; - freebsd1*) - ;; - kfreebsd*-gnu) + library_names_spec='$libname$shrext' ;; freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac ;; gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in @@ -528,10 +574,13 @@ case "$host_os" in shrext=.sl ;; esac + library_names_spec='$libname$shrext' ;; - interix3*) + interix[3-9]*) + library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= @@ -548,41 +597,62 @@ case "$host_os" in ;; linux*oldld* | linux*aout* | linux*coff*) ;; - linux*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' ;; knetbsd*-gnu) + library_names_spec='$libname$shrext' ;; netbsd*) + library_names_spec='$libname$shrext' ;; newsos6) + library_names_spec='$libname$shrext' ;; - nto-qnx*) + *nto* | *qnx*) + library_names_spec='$libname$shrext' ;; openbsd*) + library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll + library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) ;; solaris*) + library_names_spec='$libname$shrext' ;; sunos4*) + library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' ;; sysv4*MP*) + library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' ;; uts4*) + library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -70,7 +73,8 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +87,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +103,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,10 +122,18 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -144,10 +156,13 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -162,13 +177,17 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +204,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -202,6 +225,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -226,55 +255,103 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64vr | mips64vrel \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ + | mt \ | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | open8 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -290,58 +367,80 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ - | v850-* | v850e-* | vax-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -359,6 +458,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -376,6 +478,9 @@ case $basic_machine in amd64) basic_machine=x86_64-pc ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -399,6 +504,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -407,10 +516,35 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -435,12 +569,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -463,6 +612,14 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -574,7 +731,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -613,6 +769,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -624,10 +788,17 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze) + basic_machine=microblaze-xilinx + ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -641,10 +812,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -657,10 +824,21 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -725,9 +903,11 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem @@ -736,9 +916,12 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -756,6 +939,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -765,6 +956,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -794,9 +991,10 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -821,6 +1019,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -847,6 +1049,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -858,6 +1064,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -879,6 +1088,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -935,17 +1147,9 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown @@ -960,6 +1164,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -1003,9 +1211,16 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1014,6 +1229,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1033,6 +1252,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1049,13 +1271,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1099,9 +1318,12 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1122,25 +1344,31 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1158,12 +1386,15 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1176,6 +1407,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1197,6 +1431,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1219,6 +1456,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1255,6 +1495,14 @@ case $os in -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; -none) ;; *) @@ -1277,6 +1525,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1286,9 +1540,21 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1307,13 +1573,13 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1332,9 +1598,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1437,7 +1709,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) @@ -1467,9 +1739,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1494,7 +1772,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/config/ltmain.sh b/config/ltmain.sh deleted file mode 100755 index a85567fc..00000000 --- a/config/ltmain.sh +++ /dev/null @@ -1,6919 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.22 -TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -duplicate_deps=no -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $mkdir "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || { - $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 - exit $EXIT_FAILURE - } - fi - - $echo "X$my_tmpdir" | $Xsed -} - - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () -{ - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - # FreeBSD-specific: where we install compilers with non-standard names - tag_compilers_CC="*cc cc* *gcc gcc*" - tag_compilers_CXX="*c++ c++* *g++ g++*" - base_compiler=`set -- "$@"; echo $1` - - # If $tagname isn't set, then try to infer if the default "CC" tag applies - if test -z "$tagname"; then - for zp in $tag_compilers_CC; do - case $base_compiler in - $zp) tagname="CC"; break;; - esac - done - fi - - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - - # FreeBSD-specific: try compilers based on inferred tag - if test -z "$tagname"; then - eval "tag_compilers=\$tag_compilers_${z}" - if test -n "$tag_compilers"; then - for zp in $tag_compilers; do - case $base_compiler in - $zp) tagname=$z; break;; - esac - done - if test -n "$tagname"; then - break - fi - fi - fi - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE - fi -} - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then - exit $exit_status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - ${rm}r unfat-$$ - cd "$darwin_orig_dir" - else - cd "$darwin_orig_dir" - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - fi # $run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - func_extract_archives_result="$my_oldobjs" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" - -disable_libs=no - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $? - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $? - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit $? - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) - prevopt="--tag" - prev=tag - preserve_args="$preserve_args --tag" - ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi - -case $disable_libs in -no) - ;; -shared) - build_libtool_libs=no - build_old_libs=yes - ;; -static) - build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` - ;; -esac - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue - ;; - - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, and some SunOS ksh mistreat backslash-escaping - # in scan sets (worked around with variable expansion), - # and furthermore cannot handle '|' '&' '(' ')' in scan sets - # at all, so we specify them separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qlibobj="\"$qlibobj\"" ;; - esac - test "X$libobj" != "X$qlibobj" \ - && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - $echo "$srcfile" > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qsrcfile="\"$qsrcfile\"" ;; - esac - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - fi - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - darwin_framework|darwin_framework_skip) - test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework|-arch|-isysroot) - case " $CC " in - *" ${arg} ${1} "* | *" ${arg} ${1} "*) - prev=darwin_framework_skip ;; - *) compiler_flags="$compiler_flags $arg" - prev=darwin_framework ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - notinst_path="$notinst_path $dir" - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - -model) - compile_command="$compile_command $arg" - compiler_flags="$compiler_flags $arg" - finalize_command="$finalize_command $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m* pass through architecture-specific compiler args for GCC - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -pg pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ - -t[45]*|-txscale*|@*) - - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then - exit $exit_status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - fi - - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - ;; - esac # linkmode - - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 - exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $absdir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes ; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | - $EGREP ": [^:]* bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` - deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - deplibs="$new_libs" - - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - output_la=`$echo "X$output" | $Xsed -e "$basename"` - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$output_la-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - len=1 - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadable object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* ) - $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - else - $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* ) - $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -" - - case $host in - *cygwin* | *mingw* ) - $echo >> "$output_objdir/$dlsyms" "\ -/* DATA imports from DLLs on WIN32 can't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs */ -struct { -" - ;; - * ) - $echo >> "$output_objdir/$dlsyms" "\ -const struct { -" - ;; - esac - - - $echo >> "$output_objdir/$dlsyms" "\ - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - case $host in - *cygwin* | *mingw* ) - if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - else - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - fi - ;; - * ) - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - esac - ;; - *-*-freebsd*) - # FreeBSD doesn't need this... - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - exit_status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $exit_status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - output_name=`basename $output` - output_path=`dirname $output` - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -/* -DDEBUG is fairly common in CFLAGS. */ -#undef DEBUG -#if defined DEBUGWRAPPER -# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) -#else -# define DEBUG(format, ...) -#endif - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -const char * base_name (const char *name); -char * find_executable(const char *wrapper); -int check_executable(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup (base_name (argv[0])); - DEBUG("(main) argv[0] : %s\n",argv[0]); - DEBUG("(main) program_name : %s\n",program_name); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = find_executable(argv[0]); - if (newargz[1] == NULL) - lt_fatal("Couldn't find %s", argv[0]); - DEBUG("(main) found exe at : %s\n",newargz[1]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; - - for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" - return 127; -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -const char * -base_name (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha ((unsigned char)name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return base; -} - -int -check_executable(const char * path) -{ - struct stat st; - - DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); - if ((!path) || (!*path)) - return 0; - - if ((stat (path, &st) >= 0) && - ( - /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ -#if defined (S_IXOTH) - ((st.st_mode & S_IXOTH) == S_IXOTH) || -#endif -#if defined (S_IXGRP) - ((st.st_mode & S_IXGRP) == S_IXGRP) || -#endif - ((st.st_mode & S_IXUSR) == S_IXUSR)) - ) - return 1; - else - return 0; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise */ -char * -find_executable (const char* wrapper) -{ - int has_slash = 0; - const char* p; - const char* p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char* concat_name; - - DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char* path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char* q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR(*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - return NULL; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$gentop"; then - exit $exit_status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac - ;; - -g | -m | -o) prev=$arg ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo and FILE.exe exist: automatic-append-.exe - # behavior happens only for exec(3), not for open(2)! Also, sourcing - # `FILE.' does not work on cygwin managed mounts. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo and FILE.exe exist: automatic-append-.exe - # behavior happens only for exec(3), not for open(2)! Also, sourcing - # `FILE.' does not work on cygwin managed mounts. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir=`func_mktempdir` - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "X----------------------------------------------------------------------" | $Xsed - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "X----------------------------------------------------------------------" | $Xsed - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit $EXIT_SUCCESS - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in - clean) - case " $library_names " in - # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; - esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit $EXIT_FAILURE -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit $? - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -disable_libs=shared -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -disable_libs=static -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/config/mkinstalldirs b/config/mkinstalldirs new file mode 100755 index 00000000..ef7e16fd --- /dev/null +++ b/config/mkinstalldirs @@ -0,0 +1,161 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2006-05-11.19 + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' +IFS=" "" $nl" +errstatus=0 +dirmode= + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit $? + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit $? + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file + shift + IFS=$oIFS + + for d + do + test "x$d" = x && continue + + pathcomp=$pathcomp$d + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr= + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp=$pathcomp/ + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/configure.ac b/configure.ac index 7e44b42b..2823ecd7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,22 +1,19 @@ # Process this file with autoconf to produce a configure script. -# $Id$ # # autoconf setup # AC_PREREQ(2.53) -AC_INIT([yasm], [HEAD], [bug-yasm@tortall.net]) +AC_INIT([yasm], + m4_esyscmd([./YASM-VERSION-GEN.sh && tr -d '\n' @@ -165,7 +166,7 @@ if test "$USE_MAINTAINER_MODE" = "yes"; then MORE_CFLAGS="$MORE_CFLAGS -Wcast-align" MORE_CFLAGS="$MORE_CFLAGS -Wcast-qual" MORE_CFLAGS="$MORE_CFLAGS -Wchar-subscripts" - MORE_CFLAGS="$MORE_CFLAGS -Wconversion" +# MORE_CFLAGS="$MORE_CFLAGS -Wconversion" # MORE_CFLAGS="$MORE_CFLAGS -Wdeclaration-after-statement" # MORE_CFLAGS="$MORE_CFLAGS -Wendif-labels" MORE_CFLAGS="$MORE_CFLAGS -Winline" @@ -224,64 +225,81 @@ if test "$USE_MAINTAINER_MODE" = "yes"; then fi AC_SUBST(MORE_CFLAGS) -# -# Cross-building -# -if test "$cross_compiling" = "yes"; then - AC_MSG_CHECKING([cc for build]) - CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}" - AC_MSG_RESULT($CC_FOR_BUILD) - CCLD_FOR_BUILD="$CC_FOR_BUILD" -else - CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" - CCLD_FOR_BUILD="${CCLD_FOR_BUILD-$CC}" -fi - AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) AC_ARG_VAR(CCLD_FOR_BUILD,[build system C linker frontend]) +if test "${build}" != "${host}" ; then + CC_FOR_BUILD=${CC_FOR_BUILD-cc} + CCLD_FOR_BUILD=${CCLD_FOR_BUILD-cc} +else + CC_FOR_BUILD="\$(CC)" + CCLD_FOR_BUILD="\$(CC)" +fi AC_SUBST(CC_FOR_BUILD) AC_SUBST(CCLD_FOR_BUILD) -# libtool erroneously calls CC_FOR_BUILD HOST_CC; -# --host is the platform that the package is compiled for. -HOST_CC="$CC_FOR_BUILD" -AC_SUBST(HOST_CC) +AC_ARG_VAR(CPP_FOR_HOST,[host system C preprocessor]) +if test "$build" != "$target" || test "$build" != "$host"; then + CPP_PROG="${CPP_FOR_HOST-cc -E}" +else + CPP_PROG="${CPP}" +fi +AC_DEFINE_UNQUOTED([CPP_PROG], "${CPP_PROG}", [Command name to run C preprocessor]) -# Detect if we can build Python bindings -# (needs Python, Python headers, and Pyrex) +# Detect if we have Python if test x$enable_python = xno; then have_python=no else - AC_MSG_NOTICE([Checking to see if we can build Python bindings]) + AC_MSG_NOTICE([Checking for Python]) have_python=no AM_PATH_PYTHON(2.4,[],[AC_MSG_WARN([Python not found])]) if test -z "$PYTHON" || test "$PYTHON" = : ; then have_python=no else - AC_MSG_CHECKING([for Pyrex >= 0.9.5.1]) - PYREX_CHECK_VERSION(0.9.5.1, [AC_MSG_RESULT(yes) - have_pyrex=yes], - [AC_MSG_RESULT(no) - have_pyrex=no]) - - AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no) - - if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then - have_python=yes - fi + have_python=yes fi if test x$have_python = xno ; then if test x$enable_python = xyes ; then - AC_MSG_ERROR([Building Python explicitly requested, but can't build Python bindings because either Pyrex, Python headers or a suitable Python version was not found]) + AC_MSG_ERROR([Python explicitly requested, but a suitable Python version was not found]) else - AC_MSG_WARN([Couldn't find either Pyrex, the Python headers or a suitable version of Python, not building Python bindings]) + AC_MSG_WARN([Could not find a suitable version of Python]) fi - fi + fi +fi + +# Detect if we can build Python bindings +# (needs Python, Python headers, and Cython) +if test x$enable_python_bindings = xno; then + have_python_bindings=no +else + AC_MSG_NOTICE([Checking to see if we can build Python bindings]) + have_python_bindings=no + if test x$have_python = xyes; then + AC_MSG_CHECKING([for Cython >= 0.11.3]) + CYTHON_CHECK_VERSION(0.11.3, [AC_MSG_RESULT(yes) + have_cython=yes], + [AC_MSG_RESULT(no) + have_cython=no]) + + AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no) + + if test x$have_cython = xyes -a x$have_python_headers = xyes ; then + have_python_bindings=yes + fi + fi + + if test x$have_python_bindings = xno ; then + if test x$enable_python_bindings = xyes ; then + AC_MSG_ERROR([Building Python bindings explicitly requested, but can't build Python bindings because either Cython, Python headers or a suitable Python version was not found]) + else + AC_MSG_WARN([Couldn't find either Cython, the Python headers or a suitable version of Python, not building Python bindings]) + fi + fi fi AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes) +AM_CONDITIONAL(HAVE_PYTHON_BINDINGS, test x$have_python_bindings = xyes) AC_CONFIG_FILES([Makefile po/Makefile.in diff --git a/frontends/CMakeLists.txt b/frontends/CMakeLists.txt new file mode 100644 index 00000000..9858b616 --- /dev/null +++ b/frontends/CMakeLists.txt @@ -0,0 +1,3 @@ +ADD_SUBDIRECTORY(yasm) +ADD_SUBDIRECTORY(tasm) +ADD_SUBDIRECTORY(vsyasm) diff --git a/frontends/Makefile.inc b/frontends/Makefile.inc index 832a2f0b..295639e8 100644 --- a/frontends/Makefile.inc +++ b/frontends/Makefile.inc @@ -1,5 +1,7 @@ -# $Id$ - EXTRA_DIST += frontends/yasm/Makefile.inc +EXTRA_DIST += frontends/tasm/Makefile.inc +EXTRA_DIST += frontends/vsyasm/Makefile.inc include frontends/yasm/Makefile.inc +include frontends/tasm/Makefile.inc +include frontends/vsyasm/Makefile.inc diff --git a/frontends/tasm/CMakeLists.txt b/frontends/tasm/CMakeLists.txt new file mode 100644 index 00000000..627f9f2f --- /dev/null +++ b/frontends/tasm/CMakeLists.txt @@ -0,0 +1,39 @@ +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_BINARY_DIR} + ${yasm_SOURCE_DIR}/frontends/yasm + ) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/license.c + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/frontends/yasm/genstring.py + license_msg + ${CMAKE_CURRENT_BINARY_DIR}/license.c + ${CMAKE_SOURCE_DIR}/COPYING + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/COPYING + DEPENDS ${CMAKE_SOURCE_DIR}/frontends/yasm/genstring.py + ) + +SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + +IF(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(ytasm + tasm.c + tasm-options.c + ${yasm_SOURCE_DIR}/frontends/yasm/yasm-plugin.c + ) + TARGET_LINK_LIBRARIES(ytasm libyasm ${LIBDL}) +ELSE(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(ytasm + tasm.c + tasm-options.c + ) + TARGET_LINK_LIBRARIES(ytasm yasmstd libyasm) + ADD_DEPENDENCIES(ytasm yasmstd) + SET_PROPERTY(TARGET ytasm APPEND PROPERTY BUILD_RPATH "$") +ENDIF(BUILD_SHARED_LIBS) + +SET_SOURCE_FILES_PROPERTIES(tasm.c PROPERTIES + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/license.c + ) + +INSTALL(TARGETS ytasm RUNTIME DESTINATION bin) diff --git a/frontends/tasm/Makefile.inc b/frontends/tasm/Makefile.inc new file mode 100644 index 00000000..9826e1b9 --- /dev/null +++ b/frontends/tasm/Makefile.inc @@ -0,0 +1,7 @@ +bin_PROGRAMS += ytasm + +ytasm_SOURCES = frontends/tasm/tasm.c +ytasm_SOURCES += frontends/tasm/tasm-options.c +ytasm_SOURCES += frontends/tasm/tasm-options.h + +ytasm_LDADD = libyasm.a $(INTLLIBS) diff --git a/frontends/tasm/tasm-options.c b/frontends/tasm/tasm-options.c new file mode 100644 index 00000000..941b16ef --- /dev/null +++ b/frontends/tasm/tasm-options.c @@ -0,0 +1,132 @@ +/* + * Generic Options Support Header File + * + * Copyright (c) 2001 Stanislav Karchebny + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of other contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + +#include "tasm-options.h" + + +#ifdef __DEBUG__ +#define DEBUG(x) fprintf ## x ; +#else +#define DEBUG(x) +#endif + + +/* Options Parser */ +int +parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, + void (*print_error) (const char *fmt, ...)) +{ + int errors = 0, warnings = 0; + size_t i; + int got_it; + + DEBUG((stderr, "parse_cmdline: entered\n")); + + fail: + while (--argc) { + argv++; + + if (argv[0][0] == '/' && argv[0][1]) { /* opt */ + got_it = 0; + for (i = 0; i < nopts; i++) { + char *cmd = &argv[0][1]; + size_t len = strlen(options[i].opt); + if (yasm__strncasecmp(cmd, options[i].opt, len) == 0) { + char *param; + + param = &argv[0][1+len]; + if (options[i].takes_param) { + if (param[0] != '\0') { + /* do nothing */ + } else if (argc > 1) { + param = argv[1]; + argc--; + argv++; + } else { + print_error( + _("option `-%s' needs an argument!"), + options[i].opt); + errors++; + goto fail; + } + } else + param = NULL; + + if (!options[i].handler(cmd, param, options[i].extra)) + got_it = 1; + break; + } + } + if (!got_it) { + print_error(_("warning: unrecognized option `%s'"), + argv[0]); + warnings++; + } + } else { /* not an option, then it should be a file or something */ + + if (not_an_option_handler(argv[0])) + errors++; + } + } + + (void) warnings; + + DEBUG((stderr, "parse_cmdline: finished\n")); + return errors; +} + +void +help_msg(const char *msg, const char *tail, opt_option *options, size_t nopts) +{ + char optbuf[100]; + size_t i; + + printf("%s", gettext(msg)); + + for (i = 0; i < nopts; i++) { + optbuf[0] = 0; + + if (options[i].takes_param) { + if (options[i].opt) + sprintf(optbuf, "/%s <%s>", options[i].opt, + options[i].param_desc ? options[i]. + param_desc : _("param")); + } else { + if (options[i].opt) + sprintf(optbuf, "/%s", options[i].opt); + } + + printf(" %-22s %s\n", optbuf, gettext(options[i].description)); + } + + printf("%s", gettext(tail)); +} diff --git a/frontends/tasm/tasm-options.h b/frontends/tasm/tasm-options.h new file mode 100644 index 00000000..082409fc --- /dev/null +++ b/frontends/tasm/tasm-options.h @@ -0,0 +1,69 @@ +/* + * Generic Options Support Header File + * + * Copyright (c) 2001 Stanislav Karchebny + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef TASM_OPTIONS_H +#define TASM_OPTIONS_H + +/* an option structure + * operate on either -sopt, --lopt, -sopt or --lopt= + */ +typedef struct opt_option_s +{ + /* option */ + const char *opt; + + /* !=0 if option requires parameter, 0 if not */ + int takes_param; + + int (*handler) (char *cmd, /*@null@*/ char *param, int extra); + int extra; /* extra value for handler */ + + /* description to use in help_msg() */ + /*@observer@*/ const char *description; + + /* optional description for the param taken (NULL if not present) */ + /* (short - will be printed after option sopt/lopt) */ + /*@observer@*/ /*@null@*/ const char *param_desc; +} opt_option; + +/* handle everything that is not an option */ +int not_an_option_handler(char *param); + +/* parse command line calling handlers when appropriate + * argc, argv - pass directly from main(argc,argv) + * options - array of options + * nopts - options count + */ +int parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, + void (*print_error) (const char *fmt, ...)); + +/* display help message msg followed by list of options in options and followed + * by tail + */ +void help_msg(const char *msg, const char *tail, opt_option *options, + size_t nopts); + +#endif diff --git a/frontends/tasm/tasm.c b/frontends/tasm/tasm.c new file mode 100644 index 00000000..9558594e --- /dev/null +++ b/frontends/tasm/tasm.c @@ -0,0 +1,1011 @@ +/* + * Program entry point, command line parsing + * + * Copyright (C) 2001-2008 Peter Johnson + * Copyright (C) 2007-2008 Samuel Thibault + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#include +#include +#include +#include + +#ifdef HAVE_LIBGEN_H +#include +#endif + +#include "tasm-options.h" + +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +#include "yasm-plugin.h" +#endif + +#include "license.c" + +#define DEFAULT_OBJFMT_MODULE "bin" + +#if defined(CMAKE_BUILD) && !defined(BUILD_SHARED_LIBS) +void yasm_init_plugin(void); +#endif + +/*@null@*/ /*@only@*/ static char *obj_filename = NULL, *in_filename = NULL; +/*@null@*/ /*@only@*/ static char *list_filename = NULL, *xref_filename = NULL; +/*@null@*/ /*@only@*/ static char *machine_name = NULL; +static int special_options = 0; +static int segment_ordering = 0; +static int cross_reference = 0; +static int floating_point = 0; +static int listing = 0; +static int expanded_listing = 0; +static int case_sensitivity = 0; +static int valid_length = -1; +/*@null@*/ /*@dependent@*/ static yasm_arch *cur_arch = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_arch_module * + cur_arch_module = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_parser_module * + cur_parser_module = NULL; +/*@null@*/ /*@dependent@*/ static yasm_preproc *cur_preproc = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_preproc_module * + cur_preproc_module = NULL; +/*@null@*/ static char *objfmt_keyword = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_objfmt_module * + cur_objfmt_module = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_dbgfmt_module * + cur_dbgfmt_module = NULL; +/*@null@*/ /*@dependent@*/ static yasm_listfmt *cur_listfmt = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_listfmt_module * + cur_listfmt_module = NULL; +static int warning_error = 0; /* warnings being treated as errors */ +static FILE *errfile; +/*@null@*/ /*@only@*/ static char *error_filename = NULL; + +/*@null@*/ /*@dependent@*/ static FILE *open_file(const char *filename, + const char *mode); +static void check_errors(/*@only@*/ yasm_errwarns *errwarns, + /*@only@*/ yasm_object *object, + /*@only@*/ yasm_linemap *linemap); +static void cleanup(/*@null@*/ /*@only@*/ yasm_object *object); + +/* Forward declarations: cmd line parser handlers */ +static int opt_special_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_segment_ordering_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_cross_reference_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_floating_point_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_ignore(char *cmd, /*@null@*/ char *param, int extra); +static int opt_listing_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_case_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_valid_length_handler(char *cmd, /*@null@*/ char *param, int extra); + +static int opt_warning_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_preproc_option(char *cmd, /*@null@*/ char *param, int extra); +static int opt_exe_handler(char *cmd, /*@null@*/ char *param, int extra); + +static /*@only@*/ char *replace_extension(const char *orig, /*@null@*/ + const char *ext, const char *def); +static void print_error(const char *fmt, ...); + +static /*@exits@*/ void handle_yasm_int_error(const char *file, + unsigned int line, + const char *message); +static /*@exits@*/ void handle_yasm_fatal(const char *message, va_list va); +static const char *handle_yasm_gettext(const char *msgid); +static void print_yasm_error(const char *filename, unsigned long line, + const char *msg, /*@null@*/ const char *xref_fn, + unsigned long xref_line, + /*@null@*/ const char *xref_msg); +static void print_yasm_warning(const char *filename, unsigned long line, + const char *msg); + +static void apply_preproc_builtins(void); +static void apply_preproc_standard_macros(const yasm_stdmac *stdmacs); +static void apply_preproc_saved_options(void); +static void print_list_keyword_desc(const char *name, const char *keyword); + +/* values for special_options */ +#define SPECIAL_SHOW_HELP 0x01 +#define SPECIAL_SHOW_VERSION 0x02 +#define SPECIAL_SHOW_LICENSE 0x04 + +#define SEGMENT_ORDERING_ALPHABETIC 0x01 +#define SEGMENT_ORDERING_SOURCE 0x02 + +#define FP_EMULATED 0x01 +#define FP_REAL 0x02 + +#define CASE_ALL 0x01 +#define CASE_GLOBALS 0x02 +#define CASE_NONE 0x04 + +#define DEBUG_FULL 0x01 +#define DEBUG_LINES 0x02 +#define DEBUG_NONE 0x04 + +/* command line options */ +static opt_option options[] = +{ + { "version", 0, opt_special_handler, SPECIAL_SHOW_VERSION, + N_("show version text"), NULL }, + { "license", 0, opt_special_handler, SPECIAL_SHOW_LICENSE, + N_("show license text"), NULL }, + { "a", 0, opt_segment_ordering_handler, SEGMENT_ORDERING_ALPHABETIC, + N_("Alphabetic segment ordering"), NULL }, + { "s", 0, opt_segment_ordering_handler, SEGMENT_ORDERING_SOURCE, + N_("Source segment ordering"), NULL }, + + { "c", 0, opt_cross_reference_handler, 0, + N_("Generate cross-reference in listing"), NULL }, + + { "d", 1, opt_preproc_option, 2, + N_("pre-define a macro, optionally to value"), N_("macro[=value]") }, + + { "e", 0, opt_floating_point_handler, FP_EMULATED, + N_("Emulated floating-point instructions (not supported)"), NULL }, + { "r", 0, opt_floating_point_handler, FP_REAL, + N_("Real floating-point instructions"), NULL }, + + { "h", 0, opt_special_handler, SPECIAL_SHOW_HELP, + N_("show help text"), NULL }, + { "?", 0, opt_special_handler, SPECIAL_SHOW_HELP, + N_("show help text"), NULL }, + + { "i", 1, opt_preproc_option, 0, + N_("add include path"), N_("path") }, + + { "j", 1, opt_ignore, 0, + N_("Jam in an assemble directive CMD (eg. /jIDEAL) (not supported)"), NULL }, + + { "k", 1, opt_ignore, 0, + N_("Hash table capacity (ignored)"), N_("# symbols") }, + + { "l", 0, opt_listing_handler, 0, + N_("Generate listing"), N_("l=normal listing, la=expanded listing") }, + + { "ml", 0, opt_case_handler, CASE_ALL, + N_("Case sensitivity on all symbols"), NULL }, + { "mx", 0, opt_case_handler, CASE_GLOBALS, + N_("Case sensitivity on global symbols"), NULL }, + { "mu", 0, opt_case_handler, CASE_NONE, + N_("No case sensitivity on symbols"), NULL }, + { "mv", 0, opt_valid_length_handler, 0, + N_("Set maximum valid length for symbols"), N_("length") }, + + { "m", 1, opt_ignore, 0, + N_("Allow multiple passes to resolve forward reference (ignored)"), N_("number of passes") }, + + { "n", 0, opt_ignore, 0, + N_("Suppress symbol tables in listing"), NULL }, + + { "o", 0, opt_ignore, 0, + N_("Object code"), N_("os: standard, o: standard w/overlays, op: Phar Lap, oi: IBM") }, + + { "p", 0, opt_ignore, 0, + N_("Check for code segment overrides in protected mode"), NULL }, + { "q", 0, opt_ignore, 0, + N_("Suppress OBJ records not needed for linking (ignored)"), NULL }, + { "t", 0, opt_ignore, 0, + N_("Suppress messages if successful assembly"), NULL }, + { "u", 0, opt_ignore, 0, + N_("Set version emulation"), N_("Version") }, + { "w", 1, opt_warning_handler, 0, + N_("Set warning level"), N_("w0=none, w1=w2=warnings on, w-xxx/w+xxx=disable/enable warning xxx") }, + { "x", 0, opt_ignore, 0, + N_("Include false conditionals in listing"), NULL }, + { "zi", 0, opt_ignore, DEBUG_FULL, + N_("Full debug info"), NULL }, + { "zd", 0, opt_ignore, DEBUG_LINES, + N_("Line numbers debug info"), NULL }, + { "zn", 0, opt_ignore, DEBUG_NONE, + N_("No debug info"), NULL }, + { "z", 0, opt_ignore, 0, + N_("Display source line with error message (ignored)"), NULL }, + + { "b", 0, opt_exe_handler, 0, + N_("Build a (very) basic .exe file"), NULL }, +}; + +/* version message */ +/*@observer@*/ static const char *version_msg[] = { + PACKAGE_STRING, + "Copyright (c) 2001-2010 Peter Johnson and other Yasm developers.", + "Run yasm --license for licensing overview and summary." +}; + +/* help messages */ +/*@observer@*/ static const char *help_head = N_( + "usage: tasm [option]* source [,object] [,listing] [,xref] \n" + "Options:\n"); +/*@observer@*/ static const char *help_tail = N_( + "\n" + "source is asm source to be assembled.\n" + "\n" + "Sample invocation:\n" + " tasm /zi source.asm\n" + "\n" + "Report bugs to bug-yasm@tortall.net\n"); + +/* parsed command line storage until appropriate modules have been loaded */ +typedef STAILQ_HEAD(constcharparam_head, constcharparam) constcharparam_head; + +typedef struct constcharparam { + STAILQ_ENTRY(constcharparam) link; + const char *param; + int id; +} constcharparam; + +static constcharparam_head preproc_options; + +static int +do_assemble(void) +{ + yasm_object *object; + const char *base_filename; + /*@null@*/ FILE *obj = NULL; + yasm_arch_create_error arch_error; + yasm_linemap *linemap; + yasm_errwarns *errwarns = yasm_errwarns_create(); + int i, matched; + + /* Initialize line map */ + linemap = yasm_linemap_create(); + yasm_linemap_set(linemap, in_filename, 0, 1, 1); + + /* determine the object filename if not specified */ + if (!obj_filename) { + if (in_filename == NULL) + /* Default to yasm.out if no obj filename specified */ + obj_filename = yasm__xstrdup("yasm.out"); + else { + /* replace (or add) extension to base filename */ + yasm__splitpath(in_filename, &base_filename); + if (base_filename[0] == '\0') + obj_filename = yasm__xstrdup("yasm.out"); + else + obj_filename = replace_extension(base_filename, + "obj", + "yasm.out"); + } + } + + cur_arch = yasm_arch_create(cur_arch_module, machine_name, + cur_parser_module->keyword, &arch_error); + if (!cur_arch) { + switch (arch_error) { + case YASM_ARCH_CREATE_BAD_MACHINE: + print_error(_("%s: `%s' is not a valid %s for %s `%s'"), + _("FATAL"), machine_name, _("machine"), + _("architecture"), cur_arch_module->keyword); + break; + case YASM_ARCH_CREATE_BAD_PARSER: + print_error(_("%s: `%s' is not a valid %s for %s `%s'"), + _("FATAL"), cur_parser_module->keyword, + _("parser"), _("architecture"), + cur_arch_module->keyword); + break; + default: + print_error(_("%s: unknown architecture error"), _("FATAL")); + } + + return EXIT_FAILURE; + } + + /* Create object */ + object = yasm_object_create(in_filename, obj_filename, cur_arch, + cur_objfmt_module, cur_dbgfmt_module); + if (!object) { + yasm_error_class eclass; + unsigned long xrefline; + /*@only@*/ /*@null@*/ char *estr, *xrefstr; + + yasm_error_fetch(&eclass, &estr, &xrefline, &xrefstr); + print_error("%s: %s", _("FATAL"), estr); + yasm_xfree(estr); + yasm_xfree(xrefstr); + + cleanup(object); + return EXIT_FAILURE; + } + + /* Get a fresh copy of objfmt_module as it may have changed. */ + cur_objfmt_module = ((yasm_objfmt_base *)object->objfmt)->module; + + /* Check to see if the requested preprocessor is in the allowed list + * for the active parser. + */ + matched = 0; + for (i=0; cur_parser_module->preproc_keywords[i]; i++) + if (yasm__strcasecmp(cur_parser_module->preproc_keywords[i], + cur_preproc_module->keyword) == 0) + matched = 1; + if (!matched) { + print_error(_("%s: `%s' is not a valid %s for %s `%s'"), _("FATAL"), + cur_preproc_module->keyword, _("preprocessor"), + _("parser"), cur_parser_module->keyword); + cleanup(object); + return EXIT_FAILURE; + } + + cur_preproc = yasm_preproc_create(cur_preproc_module, in_filename, + object->symtab, linemap, errwarns); + + apply_preproc_builtins(); + apply_preproc_standard_macros(cur_parser_module->stdmacs); + apply_preproc_standard_macros(cur_objfmt_module->stdmacs); + apply_preproc_saved_options(); + + /* Get initial x86 BITS setting from object format */ + if (yasm__strcasecmp(cur_arch_module->keyword, "x86") == 0) { + yasm_arch_set_var(cur_arch, "mode_bits", + cur_objfmt_module->default_x86_mode_bits); + } + + /* Parse! */ + cur_parser_module->do_parse(object, cur_preproc, list_filename != NULL, + linemap, errwarns); + + check_errors(errwarns, object, linemap); + + /* Finalize parse */ + yasm_object_finalize(object, errwarns); + check_errors(errwarns, object, linemap); + + /* Optimize */ + yasm_object_optimize(object, errwarns); + check_errors(errwarns, object, linemap); + + /* generate any debugging information */ + yasm_dbgfmt_generate(object, linemap, errwarns); + check_errors(errwarns, object, linemap); + + /* open the object file for output (if not already opened by dbg objfmt) */ + if (!obj && yasm__strcasecmp(cur_objfmt_module->keyword, "dbg") != 0) { + obj = open_file(obj_filename, "wb"); + if (!obj) { + cleanup(object); + return EXIT_FAILURE; + } + } + + /* Write the object file */ + yasm_objfmt_output(object, obj?obj:stderr, + yasm__strcasecmp(cur_dbgfmt_module->keyword, "null"), + errwarns); + + /* Close object file */ + if (obj) + fclose(obj); + + /* If we had an error at this point, we also need to delete the output + * object file (to make sure it's not left newer than the source). + */ + if (yasm_errwarns_num_errors(errwarns, warning_error) > 0) + remove(obj_filename); + check_errors(errwarns, object, linemap); + + /* Open and write the list file */ + if (list_filename) { + FILE *list = open_file(list_filename, "wt"); + if (!list) { + cleanup(object); + return EXIT_FAILURE; + } + /* Initialize the list format */ + cur_listfmt = yasm_listfmt_create(cur_listfmt_module, in_filename, + obj_filename); + yasm_listfmt_output(cur_listfmt, list, linemap, cur_arch); + fclose(list); + } + + yasm_errwarns_output_all(errwarns, linemap, warning_error, + print_yasm_error, print_yasm_warning); + + yasm_linemap_destroy(linemap); + yasm_errwarns_destroy(errwarns); + cleanup(object); + return EXIT_SUCCESS; +} + +/* main function */ +/*@-globstate -unrecog@*/ +int +main(int argc, char *argv[]) +{ + size_t i; + + errfile = stderr; + +#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES) + setlocale(LC_MESSAGES, ""); +#endif +#if defined(LOCALEDIR) + bindtextdomain(PACKAGE, LOCALEDIR); +#endif + textdomain(PACKAGE); + + /* Initialize errwarn handling */ + yasm_internal_error_ = handle_yasm_int_error; + yasm_fatal = handle_yasm_fatal; + yasm_gettext_hook = handle_yasm_gettext; + yasm_errwarn_initialize(); + + /* Initialize BitVector (needed for intnum/floatnum). */ + if (BitVector_Boot() != ErrCode_Ok) { + print_error(_("%s: could not initialize BitVector"), _("FATAL")); + return EXIT_FAILURE; + } + + /* Initialize intnum and floatnum */ + yasm_intnum_initialize(); + yasm_floatnum_initialize(); + +#ifdef CMAKE_BUILD + /* Load standard modules */ +#ifdef BUILD_SHARED_LIBS + if (!load_plugin("yasmstd")) { + print_error(_("%s: could not load standard modules"), _("FATAL")); + return EXIT_FAILURE; + } +#else + yasm_init_plugin(); +#endif +#endif + + /* Initialize parameter storage */ + STAILQ_INIT(&preproc_options); + + if (parse_cmdline(argc, argv, options, NELEMS(options), print_error)) + return EXIT_FAILURE; + + switch (special_options) { + case SPECIAL_SHOW_HELP: + /* Does gettext calls internally */ + help_msg(help_head, help_tail, options, NELEMS(options)); + return EXIT_SUCCESS; + case SPECIAL_SHOW_VERSION: + for (i=0; idefault_machine_keyword); + + /* Check for arch help */ + if (machine_name && strcmp(machine_name, "help") == 0) { + const yasm_arch_machine *m = cur_arch_module->machines; + printf(_("Available %s for %s `%s':\n"), _("machines"), + _("architecture"), cur_arch_module->keyword); + while (m->keyword && m->name) { + print_list_keyword_desc(m->name, m->keyword); + m++; + } + return EXIT_SUCCESS; + } + + cur_parser_module = yasm_load_parser("tasm"); + if (!cur_parser_module) { + print_error(_("%s: could not load %s"), _("FATAL"), + _("parser")); + cleanup(NULL); + return EXIT_FAILURE; + } + + /* If not already specified, default to the parser's default preproc. */ + if (!cur_preproc_module) { + cur_preproc_module = + yasm_load_preproc(cur_parser_module->default_preproc_keyword); + if (!cur_preproc_module) { + print_error(_("%s: could not load default %s"), _("FATAL"), + _("preprocessor")); + cleanup(NULL); + return EXIT_FAILURE; + } + } + + /* Determine input filename and open input file. */ + if (!in_filename) { + print_error(_("No input files specified")); + return EXIT_FAILURE; + } + + /* If list file enabled, make sure we have a list format loaded. */ + if (list_filename) { + /* use nasm as the list format. */ + cur_listfmt_module = yasm_load_listfmt("nasm"); + } + + /* If not already specified, default to null as the debug format. */ + if (!cur_dbgfmt_module) { + cur_dbgfmt_module = yasm_load_dbgfmt("null"); + if (!cur_dbgfmt_module) { + print_error(_("%s: could not load default %s"), _("FATAL"), + _("debug format")); + return EXIT_FAILURE; + } + } + + return do_assemble(); +} +/*@=globstate =unrecog@*/ + +/* Open the object file. Returns 0 on failure. */ +static FILE * +open_file(const char *filename, const char *mode) +{ + FILE *f; + + f = fopen(filename, mode); + if (!f) + print_error(_("could not open file `%s'"), filename); + return f; +} + +static void +check_errors(yasm_errwarns *errwarns, yasm_object *object, + yasm_linemap *linemap) +{ + if (yasm_errwarns_num_errors(errwarns, warning_error) > 0) { + yasm_errwarns_output_all(errwarns, linemap, warning_error, + print_yasm_error, print_yasm_warning); + yasm_linemap_destroy(linemap); + yasm_errwarns_destroy(errwarns); + cleanup(object); + exit(EXIT_FAILURE); + } +} + +/* Define DO_FREE to 1 to enable deallocation of all data structures. + * Useful for detecting memory leaks, but slows down execution unnecessarily + * (as the OS will free everything we miss here). + */ +#define DO_FREE 1 + +/* Cleans up all allocated structures. */ +static void +cleanup(yasm_object *object) +{ + if (DO_FREE) { + if (cur_listfmt) + yasm_listfmt_destroy(cur_listfmt); + if (cur_preproc) + yasm_preproc_destroy(cur_preproc); + if (object) + yasm_object_destroy(object); + + yasm_floatnum_cleanup(); + yasm_intnum_cleanup(); + + yasm_errwarn_cleanup(); + + BitVector_Shutdown(); + } + + if (DO_FREE) { + if (in_filename) + yasm_xfree(in_filename); + if (obj_filename) + yasm_xfree(obj_filename); + if (list_filename) + yasm_xfree(list_filename); + if (xref_filename) + yasm_xfree(xref_filename); + if (machine_name) + yasm_xfree(machine_name); + if (objfmt_keyword) + yasm_xfree(objfmt_keyword); + } + + if (errfile != stderr && errfile != stdout) + fclose(errfile); +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) + unload_plugins(); +#endif +} + +/* + * Command line options handlers + */ +static char ** const filenames[] = { + &in_filename, &obj_filename, &list_filename, &xref_filename, NULL +}, ** const * cur_filename = &filenames[0]; + +static int filename_handler(char *param) { + if (!*cur_filename) { + print_error(_("error: too many files on command line.")); + return 1; + } + + if (*param) + **cur_filename = yasm__xstrdup(param); + + return 0; +} +int +not_an_option_handler(char *param) { + char *c, *d = param; + + while ((c = strchr(d, ','))) { + *c = '\0'; + if (filename_handler(d)) + return 1; + d = c + 1; + cur_filename++; + } + filename_handler(d); + return 0; +} + +static int +opt_special_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + if (special_options == 0) + special_options = extra; + return 0; +} + +static int +opt_segment_ordering_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + segment_ordering = extra; + return 0; +} + +static int +opt_cross_reference_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + cross_reference = 1; + return 0; +} + +static int +opt_floating_point_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + floating_point = extra; + return 0; +} + +static int +opt_ignore(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + return 0; +} + +static int +opt_listing_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + if (param && param[0]) { + if (param[0] != 'a') + return 1; + expanded_listing = 1; + } + listing = 1; + return 0; +} + +static int +opt_case_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + case_sensitivity = extra; + return 0; +} + +static int +opt_valid_length_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + valid_length = atoi(param); + return 0; +} + +static int +opt_warning_handler(char *cmd, /*@unused@*/ char *param, int extra) +{ + /* is it disabling the warning instead of enabling? */ + void (*action)(yasm_warn_class wclass) = NULL; + + if (cmd[0] == '0') { + /* /w0, disable warnings */ + yasm_warn_disable_all(); + return 0; + } + + if (cmd[0] == '1' || cmd[0] == '2') { + /* /w[12], enable warnings */ + yasm_warn_enable(YASM_WARN_UNREC_CHAR); + yasm_warn_enable(YASM_WARN_ORPHAN_LABEL); + yasm_warn_enable(YASM_WARN_UNINIT_CONTENTS); + return 0; + } + + /* detect no- prefix to disable the warning */ + if (cmd[0] == '-') { + action = yasm_warn_disable; + } else if (cmd[0] == '+') { + action = yasm_warn_enable; + } else return 1; + + /* skip past '+/-' */ + cmd++; + + if (cmd[0] == '\0') + /* just /w- or /w+, so definitely not valid */ + return 1; + else if (strcmp(cmd, "error") == 0) + warning_error = (action == yasm_warn_enable); + else if (strcmp(cmd, "unrecognized-char") == 0) + action(YASM_WARN_UNREC_CHAR); + else if (strcmp(cmd, "orphan-labels") == 0) + action(YASM_WARN_ORPHAN_LABEL); + else if (strcmp(cmd, "uninit-contents") == 0) + action(YASM_WARN_UNINIT_CONTENTS); + else if (strcmp(cmd, "size-override") == 0) + action(YASM_WARN_SIZE_OVERRIDE); + else if (strcmp(cmd, "segreg-in-64bit") == 0) + action(YASM_WARN_SEGREG_IN_64BIT); + else + return 1; + + return 0; +} + +static int +opt_preproc_option(/*@unused@*/ char *cmd, char *param, int extra) +{ + constcharparam *cp; + cp = yasm_xmalloc(sizeof(constcharparam)); + cp->param = param; + cp->id = extra; + STAILQ_INSERT_TAIL(&preproc_options, cp, link); + return 0; +} + +static int +opt_exe_handler(char *cmd, /*@unused@*/ char *param, int extra) +{ + objfmt_keyword = yasm__xstrdup("dosexe"); + return 0; +} + +static void +apply_preproc_builtins(void) +{ + char *predef; + + if (!objfmt_keyword) + objfmt_keyword = yasm__xstrdup(DEFAULT_OBJFMT_MODULE); + + /* Define standard YASM assembly-time macro constants */ + predef = yasm_xmalloc(strlen("__YASM_OBJFMT__=") + + strlen(objfmt_keyword) + 1); + strcpy(predef, "__YASM_OBJFMT__="); + strcat(predef, objfmt_keyword); + yasm_preproc_define_builtin(cur_preproc, predef); + yasm_xfree(predef); +} + +static void +apply_preproc_standard_macros(const yasm_stdmac *stdmacs) +{ + int i, matched; + + if (!stdmacs) + return; + + matched = -1; + for (i=0; stdmacs[i].parser; i++) + if (yasm__strcasecmp(stdmacs[i].parser, + cur_parser_module->keyword) == 0 && + yasm__strcasecmp(stdmacs[i].preproc, + cur_preproc_module->keyword) == 0) + matched = i; + if (matched >= 0 && stdmacs[matched].macros) + yasm_preproc_add_standard(cur_preproc, stdmacs[matched].macros); +} + +static void +apply_preproc_saved_options(void) +{ + constcharparam *cp, *cpnext; + + void (*funcs[3])(yasm_preproc *, const char *); + funcs[0] = cur_preproc_module->add_include_file; + funcs[1] = cur_preproc_module->predefine_macro; + funcs[2] = cur_preproc_module->undefine_macro; + + STAILQ_FOREACH(cp, &preproc_options, link) { + if (0 <= cp->id && cp->id < 3 && funcs[cp->id]) + funcs[cp->id](cur_preproc, cp->param); + } + + cp = STAILQ_FIRST(&preproc_options); + while (cp != NULL) { + cpnext = STAILQ_NEXT(cp, link); + yasm_xfree(cp); + cp = cpnext; + } + STAILQ_INIT(&preproc_options); +} + +/* Replace extension on a filename (or append one if none is present). + * If output filename would be identical to input (same extension out as in), + * returns (copy of) def. + * A NULL ext means the trailing '.' should NOT be included, whereas a "" ext + * means the trailing '.' should be included. + */ +static char * +replace_extension(const char *orig, /*@null@*/ const char *ext, + const char *def) +{ + char *out, *outext; + size_t deflen, outlen; + + /* allocate enough space for full existing name + extension */ + outlen = strlen(orig) + 2; + if (ext) + outlen += strlen(ext) + 1; + deflen = strlen(def) + 1; + if (outlen < deflen) + outlen = deflen; + out = yasm_xmalloc(outlen); + + strcpy(out, orig); + outext = strrchr(out, '.'); + if (outext) { + /* Existing extension: make sure it's not the same as the replacement + * (as we don't want to overwrite the source file). + */ + outext++; /* advance past '.' */ + if (ext && strcmp(outext, ext) == 0) { + outext = NULL; /* indicate default should be used */ + print_error( + _("file name already ends in `.%s': output will be in `%s'"), + ext, def); + } + } else { + /* No extension: make sure the output extension is not empty + * (again, we don't want to overwrite the source file). + */ + if (!ext) + print_error( + _("file name already has no extension: output will be in `%s'"), + def); + else { + outext = strrchr(out, '\0'); /* point to end of the string */ + *outext++ = '.'; /* append '.' */ + } + } + + /* replace extension or use default name */ + if (outext) { + if (!ext) { + /* Back up and replace '.' with string terminator */ + outext--; + *outext = '\0'; + } else + strcpy(outext, ext); + } else + strcpy(out, def); + + return out; +} + +void +print_list_keyword_desc(const char *name, const char *keyword) +{ + printf("%4s%-12s%s\n", "", keyword, name); +} + +static void +print_error(const char *fmt, ...) +{ + va_list va; + fprintf(errfile, "tasm: "); + va_start(va, fmt); + vfprintf(errfile, fmt, va); + va_end(va); + fputc('\n', errfile); +} + +static /*@exits@*/ void +handle_yasm_int_error(const char *file, unsigned int line, const char *message) +{ + fprintf(stderr, _("INTERNAL ERROR at %s, line %u: %s\n"), file, line, + gettext(message)); +#ifdef HAVE_ABORT + abort(); +#else + exit(EXIT_FAILURE); +#endif +} + +static /*@exits@*/ void +handle_yasm_fatal(const char *fmt, va_list va) +{ + fprintf(errfile, "**%s**: ", _("Fatal")); + vfprintf(errfile, gettext(fmt), va); + fputc('\n', errfile); + exit(EXIT_FAILURE); +} + +static const char * +handle_yasm_gettext(const char *msgid) +{ + return gettext(msgid); +} + +static void +print_yasm_error(const char *filename, unsigned long line, const char *msg, + const char *xref_fn, unsigned long xref_line, + const char *xref_msg) +{ + if (line) + fprintf(errfile, "**%s** %s(%lu) %s\n", _("Error"), filename, line, msg); + else + fprintf(errfile, "**%s** %s %s\n", _("Error"), filename, msg); + + if (/* xref_fn && */ xref_msg) { + if (xref_line) + fprintf(errfile, "**%s** %s(%lu) %s\n", _("Error"), filename, xref_line, xref_msg); + else + fprintf(errfile, "**%s** %s %s\n", _("Error"), filename, xref_msg); + } +} + +static void +print_yasm_warning(const char *filename, unsigned long line, const char *msg) +{ + if (line) + fprintf(errfile, "*%s* %s(%lu) %s\n", _("Warning"), filename, line, msg); + else + fprintf(errfile, "*%s* %s %s\n", _("Warning"), filename, msg); +} diff --git a/frontends/vsyasm/CMakeLists.txt b/frontends/vsyasm/CMakeLists.txt new file mode 100644 index 00000000..f5c1f15c --- /dev/null +++ b/frontends/vsyasm/CMakeLists.txt @@ -0,0 +1,39 @@ +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_BINARY_DIR} + ${yasm_SOURCE_DIR}/frontends/yasm + ) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/license.c + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/frontends/yasm/genstring.py + license_msg + ${CMAKE_CURRENT_BINARY_DIR}/license.c + ${CMAKE_SOURCE_DIR}/COPYING + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/COPYING + DEPENDS ${CMAKE_SOURCE_DIR}/frontends/yasm/genstring.py + ) + +SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + +IF(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(vsyasm + vsyasm.c + ${yasm_SOURCE_DIR}/frontends/yasm/yasm-options.c + ${yasm_SOURCE_DIR}/frontends/yasm/yasm-plugin.c + ) + TARGET_LINK_LIBRARIES(vsyasm libyasm ${LIBDL}) + ADD_DEPENDENCIES(vsyasm yasmstd) + SET_PROPERTY(TARGET vsyasm APPEND PROPERTY BUILD_RPATH "$") +ELSE(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(vsyasm + vsyasm.c + ${yasm_SOURCE_DIR}/frontends/yasm/yasm-options.c + ) + TARGET_LINK_LIBRARIES(vsyasm yasmstd libyasm) +ENDIF(BUILD_SHARED_LIBS) + +SET_SOURCE_FILES_PROPERTIES(vsyasm.c PROPERTIES + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/license.c + ) + +INSTALL(TARGETS vsyasm RUNTIME DESTINATION bin) diff --git a/frontends/vsyasm/Makefile.inc b/frontends/vsyasm/Makefile.inc new file mode 100644 index 00000000..df8d9cf7 --- /dev/null +++ b/frontends/vsyasm/Makefile.inc @@ -0,0 +1,9 @@ +bin_PROGRAMS += vsyasm + +vsyasm_SOURCES = frontends/vsyasm/vsyasm.c +vsyasm_SOURCES += frontends/yasm/yasm-options.c +vsyasm_SOURCES += frontends/yasm/yasm-options.h + +$(srcdir)/frontends/vsyasm/vsyasm.c: license.c + +vsyasm_LDADD = libyasm.a $(INTLLIBS) diff --git a/frontends/vsyasm/vsyasm.c b/frontends/vsyasm/vsyasm.c new file mode 100644 index 00000000..b3a5a592 --- /dev/null +++ b/frontends/vsyasm/vsyasm.c @@ -0,0 +1,1426 @@ +/* + * Program entry point, command line parsing + * + * Copyright (C) 2001-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#include +#include +#include +#include + +#ifdef HAVE_LIBGEN_H +#include +#endif + +#include "frontends/yasm/yasm-options.h" + +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +#include "frontends/yasm/yasm-plugin.h" +#endif + +#include "license.c" + +#if defined(CMAKE_BUILD) && !defined(BUILD_SHARED_LIBS) +void yasm_init_plugin(void); +#endif + +/*@null@*/ /*@only@*/ static char *objdir_pathname = NULL; +/*@null@*/ /*@only@*/ static char *global_prefix = NULL, *global_suffix = NULL; +/*@null@*/ /*@only@*/ static char *listdir_pathname = NULL; +/*@null@*/ /*@only@*/ static char *mapdir_pathname = NULL; +/*@null@*/ /*@only@*/ static char *objext = NULL; +/*@null@*/ /*@only@*/ static char *listext = NULL, *mapext = NULL; +/*@null@*/ /*@only@*/ static char *machine_name = NULL; +static int special_options = 0; +/*@null@*/ /*@dependent@*/ static const yasm_arch_module * + cur_arch_module = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_parser_module * + cur_parser_module = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_preproc_module * + cur_preproc_module = NULL; +/*@null@*/ static char *objfmt_keyword = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_objfmt_module * + cur_objfmt_module = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_dbgfmt_module * + cur_dbgfmt_module = NULL; +/*@null@*/ /*@dependent@*/ static const yasm_listfmt_module * + cur_listfmt_module = NULL; +static unsigned int force_strict = 0; +static int warning_error = 0; /* warnings being treated as errors */ +static FILE *errfile; +/*@null@*/ /*@only@*/ static char *error_filename = NULL; +static enum { + EWSTYLE_GNU = 0, + EWSTYLE_VC +} ewmsg_style = EWSTYLE_GNU; + +/*@null@*/ /*@dependent@*/ static FILE *open_file(const char *filename, + const char *mode); +static int check_errors(/*@only@*/ yasm_errwarns *errwarns, + /*@only@*/ yasm_object *object, + /*@only@*/ yasm_linemap *linemap, + /*@only@*/ yasm_preproc *preproc, + /*@only@*/ yasm_arch *arch); +static void cleanup(void); +static void free_input_filenames(void); + +/* Forward declarations: cmd line parser handlers */ +static int opt_special_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_arch_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_parser_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_preproc_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_objfmt_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_dbgfmt_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_listfmt_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_listdir_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_objdir_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_mapdir_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_listext_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_objext_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_mapext_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_machine_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_strict_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_warning_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_error_file(char *cmd, /*@null@*/ char *param, int extra); +static int opt_error_stdout(char *cmd, /*@null@*/ char *param, int extra); +static int opt_include_option(char *cmd, /*@null@*/ char *param, int extra); +static int opt_preproc_option(char *cmd, /*@null@*/ char *param, int extra); +static int opt_ewmsg_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_prefix_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_suffix_handler(char *cmd, /*@null@*/ char *param, int extra); +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +static int opt_plugin_handler(char *cmd, /*@null@*/ char *param, int extra); +#endif + +static /*@only@*/ char *replace_extension(const char *orig, /*@null@*/ + const char *ext); +static void print_error(const char *fmt, ...); + +static /*@exits@*/ void handle_yasm_int_error(const char *file, + unsigned int line, + const char *message); +static /*@exits@*/ void handle_yasm_fatal(const char *message, va_list va); +static const char *handle_yasm_gettext(const char *msgid); +static void print_yasm_error(const char *filename, unsigned long line, + const char *msg, /*@null@*/ const char *xref_fn, + unsigned long xref_line, + /*@null@*/ const char *xref_msg); +static void print_yasm_warning(const char *filename, unsigned long line, + const char *msg); + +static void apply_preproc_builtins(yasm_preproc *preproc); +static void apply_preproc_standard_macros(yasm_preproc *preproc, + const yasm_stdmac *stdmacs); +static void apply_preproc_saved_options(yasm_preproc *preproc); +static void free_preproc_saved_options(void); +static void print_list_keyword_desc(const char *name, const char *keyword); + +/* values for special_options */ +#define SPECIAL_SHOW_HELP 0x01 +#define SPECIAL_SHOW_VERSION 0x02 +#define SPECIAL_SHOW_LICENSE 0x04 +#define SPECIAL_LISTED 0x08 + +/* command line options */ +static opt_option options[] = +{ + { 0, "version", 0, opt_special_handler, SPECIAL_SHOW_VERSION, + N_("show version text"), NULL }, + { 0, "license", 0, opt_special_handler, SPECIAL_SHOW_LICENSE, + N_("show license text"), NULL }, + { 'h', "help", 0, opt_special_handler, SPECIAL_SHOW_HELP, + N_("show help text"), NULL }, + { 'a', "arch", 1, opt_arch_handler, 0, + N_("select architecture (list with -a help)"), N_("arch") }, + { 'p', "parser", 1, opt_parser_handler, 0, + N_("select parser (list with -p help)"), N_("parser") }, + { 'r', "preproc", 1, opt_preproc_handler, 0, + N_("select preprocessor (list with -r help)"), N_("preproc") }, + { 'f', "oformat", 1, opt_objfmt_handler, 0, + N_("select object format (list with -f help)"), N_("format") }, + { 'g', "dformat", 1, opt_dbgfmt_handler, 0, + N_("select debugging format (list with -g help)"), N_("debug") }, + { 'L', "lformat", 1, opt_listfmt_handler, 0, + N_("select list format (list with -L help)"), N_("list") }, + { 'l', "list", 1, opt_listdir_handler, 0, + N_("name of list-file output directory"), N_("pathname") }, + { 'o', "objdir", 1, opt_objdir_handler, 0, + N_("name of object-file output directory"), N_("pathname") }, + { 0, "mapdir", 1, opt_mapdir_handler, 0, + N_("name of map-file output directory"), N_("pathname") }, + { 0, "listext", 1, opt_listext_handler, 0, + N_("list-file extension (default `lst')"), N_("ext") }, + { 0, "objext", 1, opt_objext_handler, 0, + N_("object-file extension (default is by object format)"), N_("ext") }, + { 0, "mapext", 1, opt_mapext_handler, 0, + N_("map-file extension (default `map')"), N_("ext") }, + { 'm', "machine", 1, opt_machine_handler, 0, + N_("select machine (list with -m help)"), N_("machine") }, + { 0, "force-strict", 0, opt_strict_handler, 0, + N_("treat all sized operands as if `strict' was used"), NULL }, + { 'w', NULL, 0, opt_warning_handler, 1, + N_("inhibits warning messages"), NULL }, + { 'W', NULL, 0, opt_warning_handler, 0, + N_("enables/disables warning"), NULL }, + { 'Z', NULL, 1, opt_error_file, 0, + N_("redirect error messages to file"), N_("file") }, + { 's', NULL, 0, opt_error_stdout, 0, + N_("redirect error messages to stdout"), NULL }, + { 'i', NULL, 1, opt_include_option, 0, + N_("add include path"), N_("path") }, + { 'I', NULL, 1, opt_include_option, 0, + N_("add include path"), N_("path") }, + { 'P', NULL, 1, opt_preproc_option, 0, + N_("pre-include file"), N_("filename") }, + { 'd', NULL, 1, opt_preproc_option, 1, + N_("pre-define a macro, optionally to value"), N_("macro[=value]") }, + { 'D', NULL, 1, opt_preproc_option, 1, + N_("pre-define a macro, optionally to value"), N_("macro[=value]") }, + { 'u', NULL, 1, opt_preproc_option, 2, + N_("undefine a macro"), N_("macro") }, + { 'U', NULL, 1, opt_preproc_option, 2, + N_("undefine a macro"), N_("macro") }, + { 'X', NULL, 1, opt_ewmsg_handler, 0, + N_("select error/warning message style (`gnu' or `vc')"), N_("style") }, + { 0, "prefix", 1, opt_prefix_handler, 0, + N_("prepend argument to name of all external symbols"), N_("prefix") }, + { 0, "suffix", 1, opt_suffix_handler, 0, + N_("append argument to name of all external symbols"), N_("suffix") }, + { 0, "postfix", 1, opt_suffix_handler, 0, + N_("append argument to name of all external symbols"), N_("suffix") }, +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) + { 'N', "plugin", 1, opt_plugin_handler, 0, + N_("load plugin module"), N_("plugin") }, +#endif +}; + +/* version message */ +/*@observer@*/ static const char *version_msg[] = { + PACKAGE_STRING, + "Copyright (c) 2001-2010 Peter Johnson and other Yasm developers.", + "Run yasm --license for licensing overview and summary." +}; + +/* help messages */ +/*@observer@*/ static const char *help_head = N_( + "usage: vsyasm [option]* file...\n" + "Options:\n"); +/*@observer@*/ static const char *help_tail = N_( + "\n" + "Files are asm sources to be assembled.\n" + "\n" + "Sample invocation:\n" + " vsyasm -f win64 -o objdir source1.asm source2.asm\n" + "\n" + "All options apply to all files.\n" + "\n" + "Report bugs to bug-yasm@tortall.net\n"); + +/* parsed command line storage until appropriate modules have been loaded */ +typedef STAILQ_HEAD(constcharparam_head, constcharparam) constcharparam_head; + +typedef struct constcharparam { + STAILQ_ENTRY(constcharparam) link; + const char *param; + int id; +} constcharparam; + +static constcharparam_head preproc_options; +static constcharparam_head input_files; +static int num_input_files = 0; + +static int +do_assemble(const char *in_filename) +{ + yasm_object *object; + const char *base_filename; + char *fn = NULL; + char *obj_filename, *list_filename = NULL, *map_filename = NULL; + /*@null@*/ FILE *obj = NULL; + yasm_arch_create_error arch_error; + yasm_linemap *linemap; + yasm_arch *arch = NULL; + yasm_preproc *preproc = NULL; + yasm_errwarns *errwarns = yasm_errwarns_create(); + int i, matched; + + /* Initialize line map */ + linemap = yasm_linemap_create(); + yasm_linemap_set(linemap, in_filename, 0, 1, 1); + + /* determine the output filenames */ + /* replace (or add) extension to base filename */ + yasm__splitpath(in_filename, &base_filename); + if (base_filename[0] != '\0') + fn = replace_extension(base_filename, objext); + if (!fn) + { + print_error(_("could not determine output filename for `%s'"), + in_filename); + return EXIT_FAILURE; + } + obj_filename = yasm__combpath(objdir_pathname, fn); + yasm_xfree(fn); + + if (listdir_pathname) { + fn = replace_extension(base_filename, listext); + if (!fn) + { + print_error(_("could not determine list filename for `%s'"), + in_filename); + return EXIT_FAILURE; + } + list_filename = yasm__combpath(listdir_pathname, fn); + yasm_xfree(fn); + } + + if (mapdir_pathname) { + fn = replace_extension(base_filename, mapext); + if (!fn) + { + print_error(_("could not determine map filename for `%s'"), + in_filename); + return EXIT_FAILURE; + } + map_filename = yasm__combpath(mapdir_pathname, fn); + yasm_xfree(fn); + } + + /* Set up architecture using machine and parser. */ + if (!machine_name) { + /* If we're using x86 and the default objfmt bits is 64, default the + * machine to amd64. When we get more arches with multiple machines, + * we should do this in a more modular fashion. + */ + if (yasm__strcasecmp(cur_arch_module->keyword, "x86") == 0 && + cur_objfmt_module->default_x86_mode_bits == 64) + machine_name = yasm__xstrdup("amd64"); + else + machine_name = + yasm__xstrdup(cur_arch_module->default_machine_keyword); + } + + arch = yasm_arch_create(cur_arch_module, machine_name, + cur_parser_module->keyword, &arch_error); + if (!arch) { + switch (arch_error) { + case YASM_ARCH_CREATE_BAD_MACHINE: + print_error(_("%s: `%s' is not a valid %s for %s `%s'"), + _("FATAL"), machine_name, _("machine"), + _("architecture"), cur_arch_module->keyword); + break; + case YASM_ARCH_CREATE_BAD_PARSER: + print_error(_("%s: `%s' is not a valid %s for %s `%s'"), + _("FATAL"), cur_parser_module->keyword, + _("parser"), _("architecture"), + cur_arch_module->keyword); + break; + default: + print_error(_("%s: unknown architecture error"), _("FATAL")); + } + + return EXIT_FAILURE; + } + + /* Create object */ + object = yasm_object_create(in_filename, obj_filename, arch, + cur_objfmt_module, cur_dbgfmt_module); + if (!object) { + yasm_error_class eclass; + unsigned long xrefline; + /*@only@*/ /*@null@*/ char *estr, *xrefstr; + + yasm_error_fetch(&eclass, &estr, &xrefline, &xrefstr); + print_error("%s: %s", _("FATAL"), estr); + yasm_xfree(estr); + yasm_xfree(xrefstr); + return EXIT_FAILURE; + } + + /* Get a fresh copy of objfmt_module as it may have changed. */ + cur_objfmt_module = ((yasm_objfmt_base *)object->objfmt)->module; + + /* Check to see if the requested preprocessor is in the allowed list + * for the active parser. + */ + matched = 0; + for (i=0; cur_parser_module->preproc_keywords[i]; i++) + if (yasm__strcasecmp(cur_parser_module->preproc_keywords[i], + cur_preproc_module->keyword) == 0) + matched = 1; + if (!matched) { + print_error(_("%s: `%s' is not a valid %s for %s `%s'"), _("FATAL"), + cur_preproc_module->keyword, _("preprocessor"), + _("parser"), cur_parser_module->keyword); + yasm_object_destroy(object); + return EXIT_FAILURE; + } + + if (global_prefix) + yasm_object_set_global_prefix(object, global_prefix); + if (global_suffix) + yasm_object_set_global_suffix(object, global_suffix); + + preproc = yasm_preproc_create(cur_preproc_module, in_filename, + object->symtab, linemap, errwarns); + + apply_preproc_builtins(preproc); + apply_preproc_standard_macros(preproc, cur_parser_module->stdmacs); + apply_preproc_standard_macros(preproc, cur_objfmt_module->stdmacs); + apply_preproc_saved_options(preproc); + + /* Get initial x86 BITS setting from object format */ + if (yasm__strcasecmp(cur_arch_module->keyword, "x86") == 0) { + yasm_arch_set_var(arch, "mode_bits", + cur_objfmt_module->default_x86_mode_bits); + } + + yasm_arch_set_var(arch, "force_strict", force_strict); + + /* Try to enable the map file via a map NASM directive. This is + * somewhat of a hack. + */ + if (map_filename) { + const yasm_directive *dir = &cur_objfmt_module->directives[0]; + matched = 0; + for (; dir && dir->name; dir++) { + if (yasm__strcasecmp(dir->name, "map") == 0 && + yasm__strcasecmp(dir->parser, "nasm") == 0) { + yasm_valparamhead vps; + yasm_valparam *vp; + matched = 1; + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, yasm__xstrdup(map_filename)); + yasm_vps_append(&vps, vp); + dir->handler(object, &vps, NULL, 0); + yasm_vps_delete(&vps); + } + } + if (!matched) { + print_error( + _("warning: object format `%s' does not support map files"), + cur_objfmt_module->keyword); + } + } + + /* Parse! */ + cur_parser_module->do_parse(object, preproc, list_filename != NULL, + linemap, errwarns); + + if (check_errors(errwarns, object, linemap, preproc, arch) == EXIT_FAILURE) + return EXIT_FAILURE; + + /* Finalize parse */ + yasm_object_finalize(object, errwarns); + if (check_errors(errwarns, object, linemap, preproc, arch) == EXIT_FAILURE) + return EXIT_FAILURE; + + /* Optimize */ + yasm_object_optimize(object, errwarns); + if (check_errors(errwarns, object, linemap, preproc, arch) == EXIT_FAILURE) + return EXIT_FAILURE; + + /* generate any debugging information */ + yasm_dbgfmt_generate(object, linemap, errwarns); + if (check_errors(errwarns, object, linemap, preproc, arch) == EXIT_FAILURE) + return EXIT_FAILURE; + + /* open the object file for output (if not already opened by dbg objfmt) */ + if (!obj && yasm__strcasecmp(cur_objfmt_module->keyword, "dbg") != 0) { + obj = open_file(obj_filename, "wb"); + if (!obj) { + yasm_preproc_destroy(preproc); + yasm_object_destroy(object); + yasm_linemap_destroy(linemap); + yasm_errwarns_destroy(errwarns); + return EXIT_FAILURE; + } + } + + /* Write the object file */ + yasm_objfmt_output(object, obj?obj:stderr, + yasm__strcasecmp(cur_dbgfmt_module->keyword, "null"), + errwarns); + + /* Close object file */ + if (obj) + fclose(obj); + + /* If we had an error at this point, we also need to delete the output + * object file (to make sure it's not left newer than the source). + */ + if (yasm_errwarns_num_errors(errwarns, warning_error) > 0) + remove(obj_filename); + if (check_errors(errwarns, object, linemap, preproc, arch) == EXIT_FAILURE) + return EXIT_FAILURE; + + /* Open and write the list file */ + if (list_filename) { + yasm_listfmt *cur_listfmt; + FILE *list = open_file(list_filename, "wt"); + if (!list) { + yasm_preproc_destroy(preproc); + yasm_object_destroy(object); + yasm_linemap_destroy(linemap); + yasm_errwarns_destroy(errwarns); + return EXIT_FAILURE; + } + /* Initialize the list format */ + cur_listfmt = yasm_listfmt_create(cur_listfmt_module, in_filename, + obj_filename); + yasm_listfmt_output(cur_listfmt, list, linemap, arch); + yasm_listfmt_destroy(cur_listfmt); + fclose(list); + } + + yasm_errwarns_output_all(errwarns, linemap, warning_error, + print_yasm_error, print_yasm_warning); + + yasm_preproc_destroy(preproc); + yasm_object_destroy(object); + yasm_linemap_destroy(linemap); + yasm_errwarns_destroy(errwarns); + + yasm_xfree(obj_filename); + yasm_xfree(map_filename); + yasm_xfree(list_filename); + return EXIT_SUCCESS; +} + +/* main function */ +/*@-globstate -unrecog@*/ +int +main(int argc, char *argv[]) +{ + size_t i; + constcharparam *infile; + + errfile = stderr; + +#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES) + setlocale(LC_MESSAGES, ""); +#endif +#if defined(LOCALEDIR) + bindtextdomain(PACKAGE, LOCALEDIR); +#endif + textdomain(PACKAGE); + + /* Initialize errwarn handling */ + yasm_internal_error_ = handle_yasm_int_error; + yasm_fatal = handle_yasm_fatal; + yasm_gettext_hook = handle_yasm_gettext; + yasm_errwarn_initialize(); + + /* Initialize BitVector (needed for intnum/floatnum). */ + if (BitVector_Boot() != ErrCode_Ok) { + print_error(_("%s: could not initialize BitVector"), _("FATAL")); + return EXIT_FAILURE; + } + + /* Initialize intnum and floatnum */ + yasm_intnum_initialize(); + yasm_floatnum_initialize(); + +#ifdef CMAKE_BUILD + /* Load standard modules */ +#ifdef BUILD_SHARED_LIBS + if (!load_plugin("yasmstd")) { + print_error(_("%s: could not load standard modules"), _("FATAL")); + return EXIT_FAILURE; + } +#else + yasm_init_plugin(); +#endif +#endif + + /* Initialize parameter storage */ + STAILQ_INIT(&preproc_options); + STAILQ_INIT(&input_files); + + if (parse_cmdline(argc, argv, options, NELEMS(options), print_error)) + return EXIT_FAILURE; + + switch (special_options) { + case SPECIAL_SHOW_HELP: + /* Does gettext calls internally */ + help_msg(help_head, help_tail, options, NELEMS(options)); + return EXIT_SUCCESS; + case SPECIAL_SHOW_VERSION: + for (i=0; imachines; + printf(_("Available %s for %s `%s':\n"), _("machines"), + _("architecture"), cur_arch_module->keyword); + while (m->keyword && m->name) { + print_list_keyword_desc(m->name, m->keyword); + m++; + } + return EXIT_SUCCESS; + } + + /* Default to NASM as the parser */ + if (!cur_parser_module) { + cur_parser_module = yasm_load_parser("nasm"); + if (!cur_parser_module) { + print_error(_("%s: could not load default %s"), _("FATAL"), + _("parser")); + cleanup(); + return EXIT_FAILURE; + } + } + + /* If not already specified, default to the parser's default preproc. */ + if (!cur_preproc_module) { + cur_preproc_module = + yasm_load_preproc(cur_parser_module->default_preproc_keyword); + if (!cur_preproc_module) { + print_error(_("%s: could not load default %s"), _("FATAL"), + _("preprocessor")); + cleanup(); + return EXIT_FAILURE; + } + } + + /* Determine input filenames. */ + if (STAILQ_EMPTY(&input_files)) { + print_error(_("No input files specified")); + return EXIT_FAILURE; + } + + /* If list file enabled, make sure we have a list format loaded. */ + if (listdir_pathname) { + /* If not already specified, default to nasm as the list format. */ + if (!cur_listfmt_module) { + cur_listfmt_module = yasm_load_listfmt("nasm"); + if (!cur_listfmt_module) { + print_error(_("%s: could not load default %s"), _("FATAL"), + _("list format")); + return EXIT_FAILURE; + } + } + } + + /* If not already specified, default to null as the debug format. */ + if (!cur_dbgfmt_module) { + cur_dbgfmt_module = yasm_load_dbgfmt("null"); + if (!cur_dbgfmt_module) { + print_error(_("%s: could not load default %s"), _("FATAL"), + _("debug format")); + return EXIT_FAILURE; + } + } + + /* If not already specified, output to the current directory. */ + if (!objdir_pathname) + objdir_pathname = yasm__xstrdup("./"); + else if ((i = yasm__createpath(objdir_pathname)) > 0 && + num_input_files > 1) { + objdir_pathname[i] = '/'; + objdir_pathname[i+1] = '\0'; + } + + /* Create other output directories if necessary */ + if (listdir_pathname && (i = yasm__createpath(listdir_pathname)) > 0 && + num_input_files > 1) { + listdir_pathname[i] = '/'; + listdir_pathname[i+1] = '\0'; + } + if (mapdir_pathname && (i = yasm__createpath(mapdir_pathname)) > 0 && + num_input_files > 1) { + mapdir_pathname[i] = '/'; + mapdir_pathname[i+1] = '\0'; + } + + /* If not already specified, set file extensions */ + if (!objext && cur_objfmt_module->extension) + objext = yasm__xstrdup(cur_objfmt_module->extension); + if (!listext) + listext = yasm__xstrdup("lst"); + if (!mapext) + mapext = yasm__xstrdup("map"); + + /* Assemble each input file. Terminate on first error. */ + STAILQ_FOREACH(infile, &input_files, link) + { + if (do_assemble(infile->param) == EXIT_FAILURE) { + cleanup(); + return EXIT_FAILURE; + } + } + cleanup(); + return EXIT_SUCCESS; +} +/*@=globstate =unrecog@*/ + +/* Open the object file. Returns 0 on failure. */ +static FILE * +open_file(const char *filename, const char *mode) +{ + FILE *f; + + f = fopen(filename, mode); + if (!f) + print_error(_("could not open file `%s'"), filename); + return f; +} + +static int +check_errors(yasm_errwarns *errwarns, yasm_object *object, + yasm_linemap *linemap, yasm_preproc *preproc, yasm_arch *arch) +{ + if (yasm_errwarns_num_errors(errwarns, warning_error) > 0) { + yasm_errwarns_output_all(errwarns, linemap, warning_error, + print_yasm_error, print_yasm_warning); + yasm_preproc_destroy(preproc); + yasm_object_destroy(object); + yasm_linemap_destroy(linemap); + yasm_errwarns_destroy(errwarns); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +/* Define DO_FREE to 1 to enable deallocation of all data structures. + * Useful for detecting memory leaks, but slows down execution unnecessarily + * (as the OS will free everything we miss here). + */ +#define DO_FREE 1 + +/* Cleans up all allocated structures. */ +static void +cleanup(void) +{ + if (DO_FREE) { + yasm_floatnum_cleanup(); + yasm_intnum_cleanup(); + + yasm_errwarn_cleanup(); + + BitVector_Shutdown(); + } + + if (DO_FREE) { + free_input_filenames(); + if (objdir_pathname) + yasm_xfree(objdir_pathname); + if (listdir_pathname) + yasm_xfree(listdir_pathname); + if (mapdir_pathname) + yasm_xfree(mapdir_pathname); + if (objext) + yasm_xfree(objext); + if (listext) + yasm_xfree(listext); + if (mapext) + yasm_xfree(mapext); + if (machine_name) + yasm_xfree(machine_name); + if (objfmt_keyword) + yasm_xfree(objfmt_keyword); + free_preproc_saved_options(); + } + + if (errfile != stderr && errfile != stdout) + fclose(errfile); +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) + unload_plugins(); +#endif +} + +static void +free_input_filenames(void) +{ + constcharparam *cp, *cpnext; + cp = STAILQ_FIRST(&input_files); + while (cp != NULL) { + cpnext = STAILQ_NEXT(cp, link); + yasm_xfree(cp); + cp = cpnext; + } + STAILQ_INIT(&input_files); +} + +/* + * Command line options handlers + */ +int +not_an_option_handler(char *param) +{ + constcharparam *cp; + cp = yasm_xmalloc(sizeof(constcharparam)); + cp->param = param; + cp->id = 0; + STAILQ_INSERT_TAIL(&input_files, cp, link); + ++num_input_files; + return 0; +} + +int +other_option_handler(char *option) +{ + /* Accept, but ignore, -O and -Onnn, for compatibility with NASM. */ + if (option[0] == '-' && option[1] == 'O') { + int n = 2; + for (;;) { + if (option[n] == '\0') + return 0; + if (!isdigit(option[n])) + return 1; + n++; + } + } + return 1; +} + +static int +opt_special_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, int extra) +{ + if (special_options == 0) + special_options = extra; + return 0; +} + +static int +opt_arch_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + assert(param != NULL); + cur_arch_module = yasm_load_arch(param); + if (!cur_arch_module) { + if (!strcmp("help", param)) { + printf(_("Available yasm %s:\n"), _("architectures")); + yasm_list_arch(print_list_keyword_desc); + special_options = SPECIAL_LISTED; + return 0; + } + print_error(_("%s: unrecognized %s `%s'"), _("FATAL"), + _("architecture"), param); + exit(EXIT_FAILURE); + } + return 0; +} + +static int +opt_parser_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + assert(param != NULL); + cur_parser_module = yasm_load_parser(param); + if (!cur_parser_module) { + if (!strcmp("help", param)) { + printf(_("Available yasm %s:\n"), _("parsers")); + yasm_list_parser(print_list_keyword_desc); + special_options = SPECIAL_LISTED; + return 0; + } + print_error(_("%s: unrecognized %s `%s'"), _("FATAL"), _("parser"), + param); + exit(EXIT_FAILURE); + } + return 0; +} + +static int +opt_preproc_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + assert(param != NULL); + cur_preproc_module = yasm_load_preproc(param); + if (!cur_preproc_module) { + if (!strcmp("help", param)) { + printf(_("Available yasm %s:\n"), _("preprocessors")); + yasm_list_preproc(print_list_keyword_desc); + special_options = SPECIAL_LISTED; + return 0; + } + print_error(_("%s: unrecognized %s `%s'"), _("FATAL"), + _("preprocessor"), param); + exit(EXIT_FAILURE); + } + return 0; +} + +static int +opt_objfmt_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + size_t i; + assert(param != NULL); + cur_objfmt_module = yasm_load_objfmt(param); + if (!cur_objfmt_module) { + if (!strcmp("help", param)) { + printf(_("Available yasm %s:\n"), _("object formats")); + yasm_list_objfmt(print_list_keyword_desc); + special_options = SPECIAL_LISTED; + return 0; + } + print_error(_("%s: unrecognized %s `%s'"), _("FATAL"), + _("object format"), param); + exit(EXIT_FAILURE); + } + if (objfmt_keyword) + yasm_xfree(objfmt_keyword); + objfmt_keyword = yasm__xstrdup(param); + for (i=0; iparam = param; + cp->id = extra; + STAILQ_INSERT_TAIL(&preproc_options, cp, link); + return 0; +} + +static int +opt_ewmsg_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + if (yasm__strcasecmp(param, "gnu") == 0 || + yasm__strcasecmp(param, "gcc") == 0) { + ewmsg_style = EWSTYLE_GNU; + } else if (yasm__strcasecmp(param, "vc") == 0) { + ewmsg_style = EWSTYLE_VC; + } else + print_error(_("warning: unrecognized message style `%s'"), param); + + return 0; +} + +static int +opt_prefix_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + if (global_prefix) + yasm_xfree(global_prefix); + + assert(param != NULL); + global_prefix = yasm__xstrdup(param); + + return 0; +} + +static int +opt_suffix_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + if (global_suffix) + yasm_xfree(global_suffix); + + assert(param != NULL); + global_suffix = yasm__xstrdup(param); + + return 0; +} + +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +static int +opt_plugin_handler(/*@unused@*/ char *cmd, char *param, + /*@unused@*/ int extra) +{ + if (!load_plugin(param)) + print_error(_("warning: could not load plugin `%s'"), param); + return 0; +} +#endif + +static void +apply_preproc_builtins(yasm_preproc *preproc) +{ + char *predef; + + /* Define standard YASM assembly-time macro constants */ + predef = yasm_xmalloc(strlen("__YASM_OBJFMT__=") + + strlen(objfmt_keyword) + 1); + strcpy(predef, "__YASM_OBJFMT__="); + strcat(predef, objfmt_keyword); + yasm_preproc_define_builtin(preproc, predef); + yasm_xfree(predef); +} + +static void +apply_preproc_standard_macros(yasm_preproc *preproc, const yasm_stdmac *stdmacs) +{ + int i, matched; + + if (!stdmacs) + return; + + matched = -1; + for (i=0; stdmacs[i].parser; i++) + if (yasm__strcasecmp(stdmacs[i].parser, + cur_parser_module->keyword) == 0 && + yasm__strcasecmp(stdmacs[i].preproc, + cur_preproc_module->keyword) == 0) + matched = i; + if (matched >= 0 && stdmacs[matched].macros) + yasm_preproc_add_standard(preproc, stdmacs[matched].macros); +} + +static void +apply_preproc_saved_options(yasm_preproc *preproc) +{ + constcharparam *cp; + + void (*funcs[3])(yasm_preproc *, const char *); + funcs[0] = cur_preproc_module->add_include_file; + funcs[1] = cur_preproc_module->predefine_macro; + funcs[2] = cur_preproc_module->undefine_macro; + + STAILQ_FOREACH(cp, &preproc_options, link) { + if (0 <= cp->id && cp->id < 3 && funcs[cp->id]) + funcs[cp->id](preproc, cp->param); + } +} + +static void +free_preproc_saved_options(void) +{ + constcharparam *cp, *cpnext; + cp = STAILQ_FIRST(&preproc_options); + while (cp != NULL) { + cpnext = STAILQ_NEXT(cp, link); + yasm_xfree(cp); + cp = cpnext; + } + STAILQ_INIT(&preproc_options); +} + +/* Replace extension on a filename (or append one if none is present). + * If output filename would be identical to input (same extension out as in), + * returns NULL. + * A NULL ext means the trailing '.' should NOT be included, whereas a "" ext + * means the trailing '.' should be included. + */ +static char * +replace_extension(const char *orig, /*@null@*/ const char *ext) +{ + char *out, *outext; + size_t outlen; + + /* allocate enough space for full existing name + extension */ + outlen = strlen(orig) + 2; + if (ext) + outlen += strlen(ext) + 1; + out = yasm_xmalloc(outlen); + + strcpy(out, orig); + outext = strrchr(out, '.'); + if (outext) { + /* Existing extension: make sure it's not the same as the replacement + * (as we don't want to overwrite the source file). + */ + outext++; /* advance past '.' */ + if (ext && strcmp(outext, ext) == 0) { + outext = NULL; /* indicate default should be used */ + print_error(_("file name already ends in `.%s'"), ext); + } + } else { + /* No extension: make sure the output extension is not empty + * (again, we don't want to overwrite the source file). + */ + if (!ext) { + outext = NULL; + print_error(_("file name already has no extension")); + } else { + outext = strrchr(out, '\0'); /* point to end of the string */ + *outext++ = '.'; /* append '.' */ + } + } + + /* replace extension or use default name */ + if (outext) { + if (!ext) { + /* Back up and replace '.' with string terminator */ + outext--; + *outext = '\0'; + } else + strcpy(outext, ext); + } else + return NULL; + + return out; +} + +void +print_list_keyword_desc(const char *name, const char *keyword) +{ + printf("%4s%-12s%s\n", "", keyword, name); +} + +static void +print_error(const char *fmt, ...) +{ + va_list va; + fprintf(errfile, "vsyasm: "); + va_start(va, fmt); + vfprintf(errfile, fmt, va); + va_end(va); + fputc('\n', errfile); +} + +static /*@exits@*/ void +handle_yasm_int_error(const char *file, unsigned int line, const char *message) +{ + fprintf(stderr, _("INTERNAL ERROR at %s, line %u: %s\n"), file, line, + gettext(message)); +#ifdef HAVE_ABORT + abort(); +#else + exit(EXIT_FAILURE); +#endif +} + +static /*@exits@*/ void +handle_yasm_fatal(const char *fmt, va_list va) +{ + fprintf(errfile, "vsyasm: %s: ", _("FATAL")); + vfprintf(errfile, gettext(fmt), va); + fputc('\n', errfile); + exit(EXIT_FAILURE); +} + +static const char * +handle_yasm_gettext(const char *msgid) +{ + return gettext(msgid); +} + +static const char *fmt[2] = { + "%s:%lu: %s%s\n", /* GNU */ + "%s(%lu) : %s%s\n" /* VC */ +}; + +static const char *fmt_noline[2] = { + "%s: %s%s\n", /* GNU */ + "%s : %s%s\n" /* VC */ +}; + +static void +print_yasm_error(const char *filename, unsigned long line, const char *msg, + const char *xref_fn, unsigned long xref_line, + const char *xref_msg) +{ + if (line) + fprintf(errfile, fmt[ewmsg_style], filename, line, _("error: "), msg); + else + fprintf(errfile, fmt_noline[ewmsg_style], filename, _("error: "), msg); + + if (xref_fn && xref_msg) { + if (xref_line) + fprintf(errfile, fmt[ewmsg_style], xref_fn, xref_line, _("error: "), + xref_msg); + else + fprintf(errfile, fmt_noline[ewmsg_style], xref_fn, _("error: "), + xref_msg); + } +} + +static void +print_yasm_warning(const char *filename, unsigned long line, const char *msg) +{ + if (line) + fprintf(errfile, fmt[ewmsg_style], filename, line, _("warning: "), + msg); + else + fprintf(errfile, fmt_noline[ewmsg_style], filename, _("warning: "), + msg); +} diff --git a/frontends/yasm/CMakeLists.txt b/frontends/yasm/CMakeLists.txt new file mode 100644 index 00000000..6da0cd49 --- /dev/null +++ b/frontends/yasm/CMakeLists.txt @@ -0,0 +1,36 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/license.c + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/genstring.py + license_msg + ${CMAKE_CURRENT_BINARY_DIR}/license.c + ${CMAKE_SOURCE_DIR}/COPYING + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/COPYING + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/genstring.py + ) + +SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + +IF(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(yasm + yasm.c + yasm-options.c + yasm-plugin.c + ) + TARGET_LINK_LIBRARIES(yasm libyasm ${LIBDL}) + ADD_DEPENDENCIES(yasm yasmstd) + SET_PROPERTY(TARGET yasm APPEND PROPERTY BUILD_RPATH "$") +ELSE(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(yasm + yasm.c + yasm-options.c + ) + TARGET_LINK_LIBRARIES(yasm yasmstd libyasm) +ENDIF(BUILD_SHARED_LIBS) + +SET_SOURCE_FILES_PROPERTIES(yasm.c PROPERTIES + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/license.c + ) + +INSTALL(TARGETS yasm RUNTIME DESTINATION bin) diff --git a/frontends/yasm/Makefile.inc b/frontends/yasm/Makefile.inc index 1e0a8362..ff73f952 100644 --- a/frontends/yasm/Makefile.inc +++ b/frontends/yasm/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - bin_PROGRAMS += yasm dist_man_MANS += yasm.1 diff --git a/frontends/yasm/genstring.py b/frontends/yasm/genstring.py new file mode 100755 index 00000000..5e8bf8a1 --- /dev/null +++ b/frontends/yasm/genstring.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# Generate array-of-const-string from text file. +# +# Copyright (C) 2006-2007 Peter Johnson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +import sys + +def lprint(s, f = sys.stdout, e = '\n') : + f.write(s + e) + +def file_to_string(fout, str_name, fin_name): + from os.path import basename + lprint("/* This file auto-generated from %s by genstring.py - don't edit it */\n" % basename(fin_name), f=fout) + lprint("static const char* %s[] = {" % str_name, f=fout) + lprint("\n".join(' "%s",' % + l.strip().replace('\\', '\\\\').replace('"', '\\"') + for l in open(fin_name)), + f=fout) + lprint("};", f=fout) + +if __name__ == "__main__": + if len(sys.argv) != 4: + lprint("Usage: genstring.py ", f=sys.stderr) + sys.exit(2) + file_to_string(open(sys.argv[2], "w"), sys.argv[1], sys.argv[3]) diff --git a/frontends/yasm/yasm-options.c b/frontends/yasm/yasm-options.c index 87f6e240..e493207b 100644 --- a/frontends/yasm/yasm-options.c +++ b/frontends/yasm/yasm-options.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); +#include #include "yasm-options.h" @@ -69,10 +69,15 @@ parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, } for (i = 0; i < nopts; i++) { + size_t optlen; if (options[i].lopt && strncmp(&argv[0][2], options[i].lopt, - strlen(options[i].lopt)) == 0) { + (optlen = strlen(options[i].lopt))) == 0) { char *param; + char c = argv[0][2 + optlen]; + + if (c != '\0' && c != '=' && !isspace(c)) + continue; if (options[i].takes_param) { param = strchr(&argv[0][2], '='); @@ -107,6 +112,7 @@ parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, errors++; } else { /* sopt */ for (i = 0; i < nopts; i++) { + size_t optlen; if (argv[0][1] == options[i].sopt) { char *cmd = &argv[0][1]; char *param; @@ -132,6 +138,36 @@ parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, got_it = 1; break; } + /* also allow longopt with single dash */ + if (options[i].lopt && + strncmp(&argv[0][1], options[i].lopt, + (optlen = strlen(options[i].lopt))) == 0) { + char *param; + char c = argv[0][1 + optlen]; + + if (c != '\0' && c != '=' && !isspace(c)) + continue; + + if (options[i].takes_param) { + param = strchr(&argv[0][1], '='); + if (!param) { + print_error( + _("option `-%s' needs an argument!"), + options[i].lopt); + errors++; + goto fail; + } else { + *param = '\0'; + param++; + } + } else + param = NULL; + + if (!options[i]. + handler(&argv[0][1], param, options[i].extra)) + got_it = 1; + break; + } } if (!got_it && !other_option_handler(argv[0])) got_it = 1; @@ -148,6 +184,7 @@ parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, } } + (void) warnings; DEBUG((stderr, "parse_cmdline: finished\n")); return errors; } diff --git a/frontends/yasm/yasm-options.h b/frontends/yasm/yasm-options.h index d78bec30..63c4fbea 100644 --- a/frontends/yasm/yasm-options.h +++ b/frontends/yasm/yasm-options.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * Generic Options Support Header File * * Copyright (c) 2001 Stanislav Karchebny diff --git a/frontends/yasm/yasm-plugin.c b/frontends/yasm/yasm-plugin.c new file mode 100644 index 00000000..573ab45b --- /dev/null +++ b/frontends/yasm/yasm-plugin.c @@ -0,0 +1,126 @@ +/* + * Semi-portable (Windows and Unix) plugin loading + * + * Copyright (C) 2008 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#include + +#include "libyasm-stdint.h" +#include "yasm-plugin.h" + +#if defined(_WIN32) +#include +#elif defined(__GNUC__) +#include +#endif + +static void **loaded_plugins = NULL; +static int num_loaded_plugins = 0; + +static void * +load_dll(const char *name) +{ +#if defined(_WIN32) + return LoadLibrary(name); +#elif defined(__GNUC__) + return dlopen(name, RTLD_NOW); +#else + return NULL; +#endif +} + +int +load_plugin(const char *name) +{ + char *path; + void *lib = NULL; + void (*init_plugin) (void) = NULL; + + /* Load library */ + + path = yasm_xmalloc(strlen(name)+10); +#if defined(_WIN32) + strcpy(path, name); + strcat(path, ".dll"); + lib = load_dll(path); +#elif defined(__GNUC__) + strcpy(path, "lib"); + strcat(path, name); + strcat(path, ".so"); + lib = load_dll(path); + if (!lib) { + strcpy(path, name); + strcat(path, ".so"); + lib = load_dll(path); + } +#endif + yasm_xfree(path); + if (!lib) + lib = load_dll(name); + + if (!lib) + return 0; /* Didn't load successfully */ + + /* Add to array of loaded plugins */ + loaded_plugins = + yasm_xrealloc(loaded_plugins, (num_loaded_plugins+1)*sizeof(void *)); + loaded_plugins[num_loaded_plugins] = lib; + num_loaded_plugins++; + + /* Get yasm_init_plugin() function and run it */ + +#if defined(_WIN32) + init_plugin = + (void (*)(void))GetProcAddress((HINSTANCE)lib, "yasm_init_plugin"); +#elif defined(__GNUC__) + init_plugin = (void (*)(void))(uintptr_t)dlsym(lib, "yasm_init_plugin"); +#endif + + if (!init_plugin) + return 0; /* Didn't load successfully */ + + init_plugin(); + return 1; +} + +void +unload_plugins(void) +{ + int i; + + if (!loaded_plugins) + return; + + for (i = 0; i < num_loaded_plugins; i++) { +#if defined(_WIN32) + FreeLibrary((HINSTANCE)loaded_plugins[i]); +#elif defined(__GNUC__) + dlclose(loaded_plugins[i]); +#endif + } + yasm_xfree(loaded_plugins); + num_loaded_plugins = 0; +} diff --git a/frontends/yasm/yasm-plugin.h b/frontends/yasm/yasm-plugin.h new file mode 100644 index 00000000..efb1bf51 --- /dev/null +++ b/frontends/yasm/yasm-plugin.h @@ -0,0 +1,34 @@ +/* + * Semi-portable (Windows and Unix) plugin loading + * + * Copyright (C) 2008 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef YASM_PLUGIN_H +#define YASM_PLUGIN_H + +/* Load a plugin. Returns 0 on failure. */ +int load_plugin(const char *name); +void unload_plugins(void); + +#endif diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index 2aaa90e1..2aab8350 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -25,7 +25,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); #include #include @@ -38,13 +37,18 @@ #include "yasm-options.h" +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +#include "yasm-plugin.h" +#endif + #include "license.c" /* Preprocess-only buffer size */ #define PREPROC_BUF_SIZE 16384 /*@null@*/ /*@only@*/ static char *obj_filename = NULL, *in_filename = NULL; -/*@null@*/ /*@only@*/ static char *list_filename = NULL; +/*@null@*/ /*@only@*/ static char *global_prefix = NULL, *global_suffix = NULL; +/*@null@*/ /*@only@*/ static char *list_filename = NULL, *map_filename = NULL; /*@null@*/ /*@only@*/ static char *machine_name = NULL; static int special_options = 0; /*@null@*/ /*@dependent@*/ static yasm_arch *cur_arch = NULL; @@ -66,6 +70,10 @@ static int special_options = 0; static int preproc_only = 0; static unsigned int force_strict = 0; static int generate_make_dependencies = 0; +static int makedep_with_empty_recipts = 0; +static int makedep_dos2unix_slash = 0; +/*@null@*/ /*@only@*/ static const char *makedep_out_filename = NULL; +/*@null@*/ /*@only@*/ static const char *makedep_target = NULL; static int warning_error = 0; /* warnings being treated as errors */ static FILE *errfile; /*@null@*/ /*@only@*/ static char *error_filename = NULL; @@ -91,6 +99,7 @@ static int opt_dbgfmt_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_listfmt_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_listfile_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_objfile_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_mapfile_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_machine_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_strict_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_warning_handler(char *cmd, /*@null@*/ char *param, int extra); @@ -100,7 +109,20 @@ static int preproc_only_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_include_option(char *cmd, /*@null@*/ char *param, int extra); static int opt_preproc_option(char *cmd, /*@null@*/ char *param, int extra); static int opt_ewmsg_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_makedep_and_assemble_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_makedep_empty_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_makedep_target_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_makedep_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_makedep_dos2unix_slash_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_prefix_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_suffix_handler(char *cmd, /*@null@*/ char *param, int extra); +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +static int opt_plugin_handler(char *cmd, /*@null@*/ char *param, int extra); +#endif + +#if defined(CMAKE_BUILD) && !defined(BUILD_SHARED_LIBS) +void yasm_init_plugin(void); +#endif static /*@only@*/ char *replace_extension(const char *orig, /*@null@*/ const char *ext, const char *def); @@ -119,9 +141,14 @@ static void print_yasm_warning(const char *filename, unsigned long line, const char *msg); static void apply_preproc_builtins(void); +static void apply_preproc_standard_macros(const yasm_stdmac *stdmacs); static void apply_preproc_saved_options(void); static void print_list_keyword_desc(const char *name, const char *keyword); +#ifndef MAX +# define MAX(a, b) ( ((a) > (b)) ? (a) : (b) ) +#endif + /* values for special_options */ #define SPECIAL_SHOW_HELP 0x01 #define SPECIAL_SHOW_VERSION 0x02 @@ -153,6 +180,8 @@ static opt_option options[] = N_("name of list-file output"), N_("listfile") }, { 'o', "objfile", 1, opt_objfile_handler, 0, N_("name of object-file output"), N_("filename") }, + { 0, "mapfile", 1, opt_mapfile_handler, 0, + N_("name of map-file output"), N_("filename") }, { 'm', "machine", 1, opt_machine_handler, 0, N_("select machine (list with -m help)"), N_("machine") }, { 0, "force-strict", 0, opt_strict_handler, 0, @@ -161,33 +190,58 @@ static opt_option options[] = N_("inhibits warning messages"), NULL }, { 'W', NULL, 0, opt_warning_handler, 0, N_("enables/disables warning"), NULL }, - { 'M', NULL, 0, opt_makedep_handler, 0, + { 0, "MD", 1, opt_makedep_and_assemble_handler, 0, + N_("generate Makefile dependencies and assemble normally"), + N_("file")}, + { 0, "MP", 0, opt_makedep_empty_handler, 0, + N_("generate empty Makefile recipts for the include files"), NULL }, + { 0, "MT", 1, opt_makedep_target_handler, 0, + N_("the Makefile target to associate the dependencies with"), + N_("target")}, + { 'M', NULL, 0, opt_makedep_handler, 0, /* -M must come after -MD and -MP'! */ N_("generate Makefile dependencies on stdout"), NULL }, - { 'E', NULL, 1, opt_error_file, 0, + { 0, "makedep-dos2unix-slash", 0, opt_makedep_dos2unix_slash_handler, 0, + N_("convert DOS to UNIX slashes in Makefile dependencies file"), NULL }, + { 'Z', NULL, 1, opt_error_file, 0, N_("redirect error messages to file"), N_("file") }, { 's', NULL, 0, opt_error_stdout, 0, N_("redirect error messages to stdout"), NULL }, { 'e', "preproc-only", 0, preproc_only_handler, 0, N_("preprocess only (writes output to stdout by default)"), NULL }, + { 'E', NULL, 0, preproc_only_handler, 0, + N_("preprocess only (writes output to stdout by default)"), NULL }, { 'i', NULL, 1, opt_include_option, 0, N_("add include path"), N_("path") }, { 'I', NULL, 1, opt_include_option, 0, N_("add include path"), N_("path") }, { 'P', NULL, 1, opt_preproc_option, 0, N_("pre-include file"), N_("filename") }, + { 'd', NULL, 1, opt_preproc_option, 1, + N_("pre-define a macro, optionally to value"), N_("macro[=value]") }, { 'D', NULL, 1, opt_preproc_option, 1, N_("pre-define a macro, optionally to value"), N_("macro[=value]") }, + { 'u', NULL, 1, opt_preproc_option, 2, + N_("undefine a macro"), N_("macro") }, { 'U', NULL, 1, opt_preproc_option, 2, N_("undefine a macro"), N_("macro") }, { 'X', NULL, 1, opt_ewmsg_handler, 0, N_("select error/warning message style (`gnu' or `vc')"), N_("style") }, + { 0, "prefix", 1, opt_prefix_handler, 0, + N_("prepend argument to name of all external symbols"), N_("prefix") }, + { 0, "suffix", 1, opt_suffix_handler, 0, + N_("append argument to name of all external symbols"), N_("suffix") }, + { 0, "postfix", 1, opt_suffix_handler, 0, + N_("append argument to name of all external symbols"), N_("suffix") }, +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) + { 'N', "plugin", 1, opt_plugin_handler, 0, + N_("load plugin module"), N_("plugin") }, +#endif }; /* version message */ /*@observer@*/ static const char *version_msg[] = { - PACKAGE_NAME " " PACKAGE_INTVER "." PACKAGE_BUILD, - "Compiled on " __DATE__ ".", - "Copyright (c) 2001-2007 Peter Johnson and other Yasm developers.", + PACKAGE_STRING, + "Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.", "Run yasm --license for licensing overview and summary." }; @@ -215,19 +269,136 @@ typedef struct constcharparam { static constcharparam_head preproc_options; +static char * +dos2unix_slash(char *path) +{ + char *slash = strchr(path, '\\'); + while (slash) { + *slash++ = '/'; + slash = strchr(slash, '\\'); + } + return path; +} + static int -do_preproc_only(FILE *in) +do_generate_make_dependencies(void) +{ + size_t empty_recipts_alloc = 0; + size_t empty_recipts_len = 0; + char *empty_recipts = NULL; + char *preproc_buf; + size_t linelen; + size_t got; + FILE *depout = stdout; + const char *target; + + /* Open the -MD . */ + if ( makedep_out_filename != NULL + && strcmp(makedep_out_filename, "-") != 0) { + depout = open_file(makedep_out_filename, "wt"); + if (!depout) + return EXIT_FAILURE; + } + + /* -MT (and later -MQ?) can be used to specify the target name. + If not given, fall back on the object file. */ + target = makedep_target ? makedep_target : obj_filename; + + /* Make sure preproc_buf is large enough for either of the main + file names to avoid checking later (very ulikely that it isn't). */ + linelen = strlen(target); + got = strlen(in_filename); + preproc_buf = yasm_xmalloc(MAX(PREPROC_BUF_SIZE, MAX(got, linelen) + 1)); + + /* The target (the object file) to add the dependencies to. */ + if (!makedep_dos2unix_slash || makedep_target == NULL) + fputs(target, depout); + else + fputs(dos2unix_slash(memcpy(preproc_buf, target, linelen + 1)), + depout); + + /* The source file (no empty rule for it, thus the code duplication). */ + linelen += 2 + got; + if (linelen <= 72) + fputs(": ", depout); + else { + fputs(": \\\n ", depout); + linelen = 1 + got; + } + if (!makedep_dos2unix_slash) + fwrite(in_filename, got, 1, depout); + else + fwrite(dos2unix_slash(memcpy(preproc_buf, in_filename, got + 1)), + got, 1, depout); + + /* Now the include files. */ + while ((got = yasm_preproc_get_included_file(cur_preproc, preproc_buf, + PREPROC_BUF_SIZE)) != 0) { + linelen += 1 + got; + if (linelen <= 72) + fputc(' ', depout); + else { + fputs(" \\\n ", depout); + linelen = 1 + got; + } + if (makedep_dos2unix_slash) + dos2unix_slash(preproc_buf); + fwrite(preproc_buf, got, 1, depout); + + if (makedep_with_empty_recipts) { + /* We only get one shot at each include file, so we generate the + dummy recipts in a buffer while we're writing the dependencies + for the object file. (The empty recipts makes make shut up + about deleted includes.) */ + static const char empty_tail[] = ":\n\n"; + size_t cur_len = empty_recipts_len; + + empty_recipts_len = cur_len + got + sizeof(empty_tail) - 1; + if (empty_recipts_len >= empty_recipts_alloc) { + if (empty_recipts_alloc == 0) + empty_recipts_alloc = 4096; + while (empty_recipts_len >= empty_recipts_alloc) + empty_recipts_alloc *= 2; + empty_recipts = yasm_xrealloc(empty_recipts, + empty_recipts_alloc); + } + + memcpy(&empty_recipts[cur_len], preproc_buf, got); + cur_len += got; + memcpy(&empty_recipts[cur_len], empty_tail, sizeof(empty_tail)); + } + } + + fputc('\n', depout); + yasm_xfree(preproc_buf); + + if (empty_recipts) { + fputc('\n', depout); + fwrite(empty_recipts, empty_recipts_len, 1, depout); + yasm_xfree(empty_recipts); + } + + if ( depout != stdout + && fclose(depout) != 0) { + print_error(_("error writing `%s'"), makedep_out_filename); + return EXIT_FAILURE; + } + + return 0; +} + +static int +do_preproc_only(void) { yasm_linemap *linemap; - char *preproc_buf = yasm_xmalloc(PREPROC_BUF_SIZE); - size_t got; + char *preproc_buf; const char *base_filename; FILE *out = NULL; yasm_errwarns *errwarns = yasm_errwarns_create(); /* Initialize line map */ linemap = yasm_linemap_create(); - yasm_linemap_set(linemap, in_filename, 1, 1); + yasm_linemap_set(linemap, in_filename, 0, 1, 1); /* Default output to stdout if not specified or generating dependency makefiles */ @@ -237,7 +408,7 @@ do_preproc_only(FILE *in) /* determine the object filename if not specified, but we need a file name for the makefile rule */ if (generate_make_dependencies && !obj_filename) { - if (in == stdin) + if (in_filename == NULL) /* Default to yasm.out if no obj filename specified */ obj_filename = yasm__xstrdup("yasm.out"); else { @@ -253,45 +424,31 @@ do_preproc_only(FILE *in) } else { /* Open output (object) file */ out = open_file(obj_filename, "wt"); - if (!out) { - yasm_xfree(preproc_buf); + if (!out) return EXIT_FAILURE; - } } - /* Pre-process until done */ - cur_preproc = yasm_preproc_create(cur_preproc_module, in, in_filename, + /* Create preprocessor */ + cur_preproc = yasm_preproc_create(cur_preproc_module, in_filename, NULL, linemap, errwarns); + /* Apply macros */ apply_preproc_builtins(); + apply_preproc_standard_macros(cur_parser_module->stdmacs); + apply_preproc_standard_macros(cur_objfmt_module->stdmacs); apply_preproc_saved_options(); + /* Pre-process until done */ if (generate_make_dependencies) { - size_t totlen; - - fprintf(stdout, "%s: %s", obj_filename, in_filename); - totlen = strlen(obj_filename)+2+strlen(in_filename); - - while ((got = yasm_preproc_get_included_file(cur_preproc, preproc_buf, - PREPROC_BUF_SIZE)) != 0) { - totlen += got; - if (totlen > 72) { - fputs(" \\\n ", stdout); - totlen = 2; - } - fputc(' ', stdout); - fwrite(preproc_buf, got, 1, stdout); - } - fputc('\n', stdout); + do_generate_make_dependencies(); } else { - while ((got = yasm_preproc_input(cur_preproc, preproc_buf, - PREPROC_BUF_SIZE)) != 0) - fwrite(preproc_buf, got, 1, out); + while ((preproc_buf = yasm_preproc_get_line(cur_preproc)) != NULL) { + fputs(preproc_buf, out); + fputc('\n', out); + yasm_xfree(preproc_buf); + } } - if (in != stdin) - fclose(in); - if (out != stdout) fclose(out); @@ -300,7 +457,6 @@ do_preproc_only(FILE *in) print_yasm_error, print_yasm_warning); if (out != stdout) remove(obj_filename); - yasm_xfree(preproc_buf); yasm_linemap_destroy(linemap); yasm_errwarns_destroy(errwarns); cleanup(NULL); @@ -309,7 +465,6 @@ do_preproc_only(FILE *in) yasm_errwarns_output_all(errwarns, linemap, warning_error, print_yasm_error, print_yasm_warning); - yasm_xfree(preproc_buf); yasm_linemap_destroy(linemap); yasm_errwarns_destroy(errwarns); cleanup(NULL); @@ -317,7 +472,7 @@ do_preproc_only(FILE *in) } static int -do_assemble(FILE *in) +do_assemble(void) { yasm_object *object; const char *base_filename; @@ -326,14 +481,15 @@ do_assemble(FILE *in) yasm_linemap *linemap; yasm_errwarns *errwarns = yasm_errwarns_create(); int i, matched; + const char *machine; /* Initialize line map */ linemap = yasm_linemap_create(); - yasm_linemap_set(linemap, in_filename, 1, 1); + yasm_linemap_set(linemap, in_filename, 0, 1, 1); /* determine the object filename if not specified */ if (!obj_filename) { - if (in == stdin) + if (in_filename == NULL) /* Default to yasm.out if no obj filename specified */ obj_filename = yasm__xstrdup("yasm.out"); else { @@ -354,7 +510,7 @@ do_assemble(FILE *in) * machine to amd64. When we get more arches with multiple machines, * we should do this in a more modular fashion. */ - if (strcmp(cur_arch_module->keyword, "x86") == 0 && + if (yasm__strcasecmp(cur_arch_module->keyword, "x86") == 0 && cur_objfmt_module->default_x86_mode_bits == 64) machine_name = yasm__xstrdup("amd64"); else @@ -362,9 +518,17 @@ do_assemble(FILE *in) yasm__xstrdup(cur_arch_module->default_machine_keyword); } - cur_arch = cur_arch_module->create(machine_name, - cur_parser_module->keyword, - &arch_error); + /* If we're using amd64 and the default objfmt is elfx32, change the + * machine to "x32". + */ + if (yasm__strcasecmp(machine_name, "amd64") == 0 && + yasm__strcasecmp(cur_objfmt_module->keyword, "elfx32") == 0) + machine = "x32"; + else + machine = machine_name; + + cur_arch = yasm_arch_create(cur_arch_module, machine, + cur_parser_module->keyword, &arch_error); if (!cur_arch) { switch (arch_error) { case YASM_ARCH_CREATE_BAD_MACHINE: @@ -398,8 +562,6 @@ do_assemble(FILE *in) yasm_xfree(estr); yasm_xfree(xrefstr); - if (in != stdin) - fclose(in); cleanup(object); return EXIT_FAILURE; } @@ -412,40 +574,72 @@ do_assemble(FILE *in) */ matched = 0; for (i=0; cur_parser_module->preproc_keywords[i]; i++) + { if (yasm__strcasecmp(cur_parser_module->preproc_keywords[i], - cur_preproc_module->keyword) == 0) + cur_preproc_module->keyword) == 0) { matched = 1; + break; + } + } + if (!matched) { print_error(_("%s: `%s' is not a valid %s for %s `%s'"), _("FATAL"), cur_preproc_module->keyword, _("preprocessor"), _("parser"), cur_parser_module->keyword); - if (in != stdin) - fclose(in); cleanup(object); return EXIT_FAILURE; } - cur_preproc = cur_preproc_module->create(in, in_filename, linemap, - errwarns); + if (global_prefix) + yasm_object_set_global_prefix(object, global_prefix); + if (global_suffix) + yasm_object_set_global_suffix(object, global_suffix); + + cur_preproc = yasm_preproc_create(cur_preproc_module, in_filename, + object->symtab, linemap, errwarns); apply_preproc_builtins(); + apply_preproc_standard_macros(cur_parser_module->stdmacs); + apply_preproc_standard_macros(cur_objfmt_module->stdmacs); apply_preproc_saved_options(); /* Get initial x86 BITS setting from object format */ - if (strcmp(cur_arch_module->keyword, "x86") == 0) { + if (yasm__strcasecmp(cur_arch_module->keyword, "x86") == 0) { yasm_arch_set_var(cur_arch, "mode_bits", cur_objfmt_module->default_x86_mode_bits); } yasm_arch_set_var(cur_arch, "force_strict", force_strict); - /* Parse! */ - cur_parser_module->do_parse(object, cur_preproc, in, list_filename != NULL, - linemap, errwarns); + /* Try to enable the map file via a map NASM directive. This is + * somewhat of a hack. + */ + if (map_filename) { + const yasm_directive *dir = &cur_objfmt_module->directives[0]; + matched = 0; + for (; dir && dir->name; dir++) { + if (yasm__strcasecmp(dir->name, "map") == 0 && + yasm__strcasecmp(dir->parser, "nasm") == 0) { + yasm_valparamhead vps; + yasm_valparam *vp; + matched = 1; + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, yasm__xstrdup(map_filename)); + yasm_vps_append(&vps, vp); + dir->handler(object, &vps, NULL, 0); + yasm_vps_delete(&vps); + } + } + if (!matched) { + print_error( + _("warning: object format `%s' does not support map files"), + cur_objfmt_module->keyword); + } + } - /* Close input file */ - if (in != stdin) - fclose(in); + /* Parse! */ + cur_parser_module->do_parse(object, cur_preproc, list_filename != NULL, + linemap, errwarns); check_errors(errwarns, object, linemap); @@ -462,7 +656,7 @@ do_assemble(FILE *in) check_errors(errwarns, object, linemap); /* open the object file for output (if not already opened by dbg objfmt) */ - if (!obj && strcmp(cur_objfmt_module->keyword, "dbg") != 0) { + if (!obj && yasm__strcasecmp(cur_objfmt_module->keyword, "dbg") != 0) { obj = open_file(obj_filename, "wb"); if (!obj) { cleanup(object); @@ -472,7 +666,8 @@ do_assemble(FILE *in) /* Write the object file */ yasm_objfmt_output(object, obj?obj:stderr, - strcmp(cur_dbgfmt_module->keyword, "null"), errwarns); + yasm__strcasecmp(cur_dbgfmt_module->keyword, "null"), + errwarns); /* Close object file */ if (obj) @@ -499,12 +694,17 @@ do_assemble(FILE *in) fclose(list); } + /* Generate make dependency. */ + if (generate_make_dependencies) + do_generate_make_dependencies(); + yasm_errwarns_output_all(errwarns, linemap, warning_error, print_yasm_error, print_yasm_warning); yasm_linemap_destroy(linemap); yasm_errwarns_destroy(errwarns); cleanup(object); + yasm_delete_include_paths(); return EXIT_SUCCESS; } @@ -513,7 +713,6 @@ do_assemble(FILE *in) int main(int argc, char *argv[]) { - /*@null@*/ FILE *in = NULL; size_t i; errfile = stderr; @@ -532,6 +731,28 @@ main(int argc, char *argv[]) yasm_gettext_hook = handle_yasm_gettext; yasm_errwarn_initialize(); + /* Initialize BitVector (needed for intnum/floatnum). */ + if (BitVector_Boot() != ErrCode_Ok) { + print_error(_("%s: could not initialize BitVector"), _("FATAL")); + return EXIT_FAILURE; + } + + /* Initialize intnum and floatnum */ + yasm_intnum_initialize(); + yasm_floatnum_initialize(); + +#ifdef CMAKE_BUILD + /* Load standard modules */ +#ifdef BUILD_SHARED_LIBS + if (!load_plugin("yasmstd")) { + print_error(_("%s: could not load standard modules"), _("FATAL")); + return EXIT_FAILURE; + } +#else + yasm_init_plugin(); +#endif +#endif + /* Initialize parameter storage */ STAILQ_INIT(&preproc_options); @@ -563,16 +784,6 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - /* Initialize BitVector (needed for intnum/floatnum). */ - if (BitVector_Boot() != ErrCode_Ok) { - print_error(_("%s: could not initialize BitVector"), _("FATAL")); - return EXIT_FAILURE; - } - - /* Initialize intnum and floatnum */ - yasm_intnum_initialize(); - yasm_floatnum_initialize(); - /* If not already specified, default to bin as the object format. */ if (!cur_objfmt_module) { if (!objfmt_keyword) @@ -634,25 +845,11 @@ main(int argc, char *argv[]) if (!in_filename) { print_error(_("No input files specified")); return EXIT_FAILURE; - } else if (strcmp(in_filename, "-") != 0) { - /* Open the input file (if not standard input) */ - in = fopen(in_filename, "rt"); - if (!in) { - print_error(_("%s: could not open file `%s'"), _("FATAL"), - in_filename); - yasm_xfree(in_filename); - if (obj_filename) - yasm_xfree(obj_filename); - return EXIT_FAILURE; - } - } else { - /* Filename was "-", read stdin */ - in = stdin; } /* handle preproc-only case here */ if (preproc_only) - return do_preproc_only(in); + return do_preproc_only(); /* If list file enabled, make sure we have a list format loaded. */ if (list_filename) { @@ -677,7 +874,7 @@ main(int argc, char *argv[]) } } - return do_assemble(in); + return do_assemble(); } /*@=globstate =unrecog@*/ @@ -740,6 +937,8 @@ cleanup(yasm_object *object) yasm_xfree(obj_filename); if (list_filename) yasm_xfree(list_filename); + if (map_filename) + yasm_xfree(map_filename); if (machine_name) yasm_xfree(machine_name); if (objfmt_keyword) @@ -748,6 +947,9 @@ cleanup(yasm_object *object) if (errfile != stderr && errfile != stdout) fclose(errfile); +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) + unload_plugins(); +#endif } /* @@ -945,6 +1147,22 @@ opt_objfile_handler(/*@unused@*/ char *cmd, char *param, return 0; } +static int +opt_mapfile_handler(/*@unused@*/ char *cmd, char *param, + /*@unused@*/ int extra) +{ + if (map_filename) { + print_error( + _("warning: can output to only one map file, last specified used")); + yasm_xfree(map_filename); + } + + assert(param != NULL); + map_filename = yasm__xstrdup(param); + + return 0; +} + static int opt_machine_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) @@ -1001,6 +1219,8 @@ opt_warning_handler(char *cmd, /*@unused@*/ char *param, int extra) action(YASM_WARN_UNINIT_CONTENTS); else if (strcmp(cmd, "size-override") == 0) action(YASM_WARN_SIZE_OVERRIDE); + else if (strcmp(cmd, "segreg-in-64bit") == 0) + action(YASM_WARN_SEGREG_IN_64BIT); else return 1; @@ -1075,6 +1295,32 @@ opt_ewmsg_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) return 0; } +static int +opt_makedep_and_assemble_handler(/*@unused@*/ char *cmd, char *param, + /*@unused@*/ int extra) +{ + generate_make_dependencies = 1; + makedep_out_filename = param; + return 0; +} + +static int +opt_makedep_empty_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, + /*@unused@*/ int extra) +{ + makedep_with_empty_recipts = 1; + return 0; +} + +static int +opt_makedep_target_handler(/*@unused@*/ char *cmd, char *param, + /*@unused@*/ int extra) +{ + makedep_target = param; + return 0; +} + + static int opt_makedep_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, /*@unused@*/ int extra) @@ -1082,12 +1328,55 @@ opt_makedep_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, /* Also set preproc_only to 1, we don't want to generate code */ preproc_only = 1; generate_make_dependencies = 1; - + return 0; } +static int +opt_makedep_dos2unix_slash_handler(/*@unused@*/ char *cmd, /*@unused@*/ char *param, + /*@unused@*/ int extra) +{ + makedep_dos2unix_slash = 1; + return 0; +} + +static int +opt_prefix_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + if (global_prefix) + yasm_xfree(global_prefix); + + assert(param != NULL); + global_prefix = yasm__xstrdup(param); + + return 0; +} + +static int +opt_suffix_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + if (global_suffix) + yasm_xfree(global_suffix); + + assert(param != NULL); + global_suffix = yasm__xstrdup(param); + + return 0; +} + +#if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) +static int +opt_plugin_handler(/*@unused@*/ char *cmd, char *param, + /*@unused@*/ int extra) +{ + if (!load_plugin(param)) + print_error(_("warning: could not load plugin `%s'"), param); + return 0; +} +#endif + static void -apply_preproc_builtins() +apply_preproc_builtins(void) { char *predef; @@ -1101,7 +1390,26 @@ apply_preproc_builtins() } static void -apply_preproc_saved_options() +apply_preproc_standard_macros(const yasm_stdmac *stdmacs) +{ + int i, matched; + + if (!stdmacs) + return; + + matched = -1; + for (i=0; stdmacs[i].parser; i++) + if (yasm__strcasecmp(stdmacs[i].parser, + cur_parser_module->keyword) == 0 && + yasm__strcasecmp(stdmacs[i].preproc, + cur_preproc_module->keyword) == 0) + matched = i; + if (matched >= 0 && stdmacs[matched].macros) + yasm_preproc_add_standard(cur_preproc, stdmacs[matched].macros); +} + +static void +apply_preproc_saved_options(void) { constcharparam *cp, *cpnext; @@ -1135,9 +1443,17 @@ replace_extension(const char *orig, /*@null@*/ const char *ext, const char *def) { char *out, *outext; + size_t deflen, outlen; /* allocate enough space for full existing name + extension */ - out = yasm_xmalloc(strlen(orig)+(ext ? (strlen(ext)+2) : 1)); + outlen = strlen(orig) + 2; + if (ext) + outlen += strlen(ext) + 1; + deflen = strlen(def) + 1; + if (outlen < deflen) + outlen = deflen; + out = yasm_xmalloc(outlen); + strcpy(out, orig); outext = strrchr(out, '.'); if (outext) { @@ -1239,16 +1555,17 @@ print_yasm_error(const char *filename, unsigned long line, const char *msg, const char *xref_msg) { if (line) - fprintf(errfile, fmt[ewmsg_style], filename, line, "", msg); + fprintf(errfile, fmt[ewmsg_style], filename, line, _("error: "), msg); else - fprintf(errfile, fmt_noline[ewmsg_style], filename, "", msg); + fprintf(errfile, fmt_noline[ewmsg_style], filename, _("error: "), msg); if (xref_fn && xref_msg) { if (xref_line) - fprintf(errfile, fmt[ewmsg_style], xref_fn, xref_line, "", + fprintf(errfile, fmt[ewmsg_style], xref_fn, xref_line, _("error: "), xref_msg); else - fprintf(errfile, fmt_noline[ewmsg_style], xref_fn, "", xref_msg); + fprintf(errfile, fmt_noline[ewmsg_style], xref_fn, _("error: "), + xref_msg); } } diff --git a/frontends/yasm/yasm.xml b/frontends/yasm/yasm.xml index 11a5fb29..0f074628 100644 --- a/frontends/yasm/yasm.xml +++ b/frontends/yasm/yasm.xml @@ -2,8 +2,6 @@ - - @@ -171,16 +169,6 @@ - - or : Print a - summary of options - - - Prints a summary of invocation options. All other options - are ignored, and no output file is generated. - - - or : @@ -289,6 +277,16 @@ + + or : Print a + summary of options + + + Prints a summary of invocation options. All other options + are ignored, and no output file is generated. + + + : Get the Yasm version diff --git a/genstring.c b/genstring.c index 51b76810..a66e2f56 100644 --- a/genstring.c +++ b/genstring.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Generate array-of-const-string from text file. * diff --git a/libyasm-stdint.h.cmake b/libyasm-stdint.h.cmake new file mode 100644 index 00000000..049037d5 --- /dev/null +++ b/libyasm-stdint.h.cmake @@ -0,0 +1,46 @@ +#ifndef YASM_STDINT_H +#define YASM_STDINT_H + +#cmakedefine HAVE_STDINT_H + +#ifdef HAVE_STDINT_H +#include +#elif defined(_MSC_VER) + +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +#include +#else +typedef unsigned long uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif + +#else +typedef unsigned long uintptr_t; +#endif + +#ifndef BUILD_SHARED_LIBS +#cmakedefine BUILD_SHARED_LIBS +#define BUILD_SHARED_LIBS_UNDEF +#endif + +#ifndef YASM_LIB_DECL +# if defined(BUILD_SHARED_LIBS) && defined(_WIN32) +# ifdef YASM_LIB_SOURCE +# define YASM_LIB_DECL __declspec(dllexport) +# else +# define YASM_LIB_DECL __declspec(dllimport) +# endif +# else +# define YASM_LIB_DECL +# endif +#endif + +#undef HAVE_STDINT_H +#ifdef BUILD_SHARED_LIBS_UNDEF +#undef BUILD_SHARED_LIBS +#undef BUILD_SHARED_LIBS_UNDEF +#endif + +#endif diff --git a/libyasm.h b/libyasm.h index ec92aa53..f52c133b 100644 --- a/libyasm.h +++ b/libyasm.h @@ -2,10 +2,6 @@ * \file libyasm.h * \brief YASM library primary header file. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2003-2007 Peter Johnson * @@ -30,16 +26,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * \endlicense - * - * Define YASM_LIB_INTERNAL to include many internal function and variable - * definitions that violate the yasm_* namespace. This includes - * compat-queue.h, bitvect.h, and hamt.h. - * - * Additional parts may be included via: - * - YASM_BC_INTERNAL: reveal bytecode internal structures via bc-int.h - * inclusion - * - YASM_EXPR_INTERNAL: reveal expr internal structures via expr-int.h - * inclusion */ #ifndef YASM_LIB_H #define YASM_LIB_H @@ -55,9 +41,7 @@ typedef unsigned long uintptr_t; #include #endif -#ifdef YASM_LIB_INTERNAL -# include -#endif +#include #include #include @@ -73,6 +57,7 @@ typedef unsigned long uintptr_t; #include #include +#include #include #include @@ -84,16 +69,7 @@ typedef unsigned long uintptr_t; #include #include -#ifdef YASM_LIB_INTERNAL -#ifdef YASM_BC_INTERNAL -#include -#endif -#ifdef YASM_EXPR_INTERNAL -#include -#endif #include -#include #include -#endif #endif diff --git a/libyasm/CMakeLists.txt b/libyasm/CMakeLists.txt new file mode 100644 index 00000000..0299ac56 --- /dev/null +++ b/libyasm/CMakeLists.txt @@ -0,0 +1,83 @@ +SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + +ADD_LIBRARY(libyasm + assocdat.c + bitvect.c + bc-align.c + bc-data.c + bc-incbin.c + bc-org.c + bc-reserve.c + bytecode.c + cmake-module.c + errwarn.c + expr.c + file.c + floatnum.c + hamt.c + insn.c + intnum.c + inttree.c + linemap.c + md5.c + mergesort.c + phash.c + section.c + strcasecmp.c + strsep.c + symrec.c + valparam.c + value.c + xmalloc.c + xstrdup.c + ) +IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libyasm PROPERTIES + OUTPUT_NAME "yasm" + COMPILE_FLAGS -DYASM_LIB_SOURCE + ) + if(WIN32) + SET_PROPERTY(TARGET libyasm PROPERTY PREFIX "") + endif() +ELSE(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libyasm PROPERTIES + COMPILE_FLAGS -DYASM_LIB_SOURCE + ) +ENDIF(BUILD_SHARED_LIBS) + +INSTALL(TARGETS libyasm + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + +INSTALL(FILES + arch.h + assocdat.h + bitvect.h + bytecode.h + compat-queue.h + coretype.h + dbgfmt.h + errwarn.h + expr.h + file.h + floatnum.h + hamt.h + insn.h + intnum.h + inttree.h + linemap.h + listfmt.h + md5.h + module.h + objfmt.h + parser.h + phash.h + preproc.h + section.h + symrec.h + valparam.h + value.h + DESTINATION include/libyasm + ) diff --git a/libyasm/Makefile.inc b/libyasm/Makefile.inc index 2fc87633..042dd390 100644 --- a/libyasm/Makefile.inc +++ b/libyasm/Makefile.inc @@ -1,12 +1,8 @@ -# $Id$ - -libyasm_a_SOURCES += libyasm/arch.c libyasm_a_SOURCES += libyasm/assocdat.c libyasm_a_SOURCES += libyasm/bitvect.c libyasm_a_SOURCES += libyasm/bc-align.c libyasm_a_SOURCES += libyasm/bc-data.c libyasm_a_SOURCES += libyasm/bc-incbin.c -libyasm_a_SOURCES += libyasm/bc-insn.c libyasm_a_SOURCES += libyasm/bc-org.c libyasm_a_SOURCES += libyasm/bc-reserve.c libyasm_a_SOURCES += libyasm/bytecode.c @@ -15,6 +11,7 @@ libyasm_a_SOURCES += libyasm/expr.c libyasm_a_SOURCES += libyasm/file.c libyasm_a_SOURCES += libyasm/floatnum.c libyasm_a_SOURCES += libyasm/hamt.c +libyasm_a_SOURCES += libyasm/insn.c libyasm_a_SOURCES += libyasm/intnum.c libyasm_a_SOURCES += libyasm/inttree.c libyasm_a_SOURCES += libyasm/linemap.c @@ -29,12 +26,11 @@ libyasm_a_SOURCES += libyasm/valparam.c libyasm_a_SOURCES += libyasm/value.c libyasm_a_SOURCES += libyasm/xmalloc.c libyasm_a_SOURCES += libyasm/xstrdup.c -libyasm_a_SOURCES += module.c +nodist_libyasm_a_SOURCES += module.c module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile -BUILT_SOURCES += module.c CLEANFILES += module.c noinst_PROGRAMS += genmodule @@ -53,7 +49,6 @@ modincludedir = $(includedir)/libyasm modinclude_HEADERS = libyasm/arch.h modinclude_HEADERS += libyasm/assocdat.h -modinclude_HEADERS += libyasm/bc-int.h modinclude_HEADERS += libyasm/bitvect.h modinclude_HEADERS += libyasm/bytecode.h modinclude_HEADERS += libyasm/compat-queue.h @@ -61,10 +56,10 @@ modinclude_HEADERS += libyasm/coretype.h modinclude_HEADERS += libyasm/dbgfmt.h modinclude_HEADERS += libyasm/errwarn.h modinclude_HEADERS += libyasm/expr.h -modinclude_HEADERS += libyasm/expr-int.h modinclude_HEADERS += libyasm/file.h modinclude_HEADERS += libyasm/floatnum.h modinclude_HEADERS += libyasm/hamt.h +modinclude_HEADERS += libyasm/insn.h modinclude_HEADERS += libyasm/intnum.h modinclude_HEADERS += libyasm/inttree.h modinclude_HEADERS += libyasm/linemap.h diff --git a/libyasm/arch.c b/libyasm/arch.c deleted file mode 100644 index e16f6ca7..00000000 --- a/libyasm/arch.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Architecture interface - * - * Copyright (C) 2001-2007 Peter Johnson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#define YASM_LIB_INTERNAL -#define YASM_ARCH_INTERNAL -#include "util.h" -/*@unused@*/ RCSID("$Id$"); - -#include "libyasm-stdint.h" -#include "coretype.h" - -#include "expr.h" - -#include "bytecode.h" - -#include "arch.h" - - -yasm_insn_operand * -yasm_operand_create_reg(uintptr_t reg) -{ - yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand)); - - retval->type = YASM_INSN__OPERAND_REG; - retval->data.reg = reg; - retval->targetmod = 0; - retval->size = 0; - retval->deref = 0; - retval->strict = 0; - - return retval; -} - -yasm_insn_operand * -yasm_operand_create_segreg(uintptr_t segreg) -{ - yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand)); - - retval->type = YASM_INSN__OPERAND_SEGREG; - retval->data.reg = segreg; - retval->targetmod = 0; - retval->size = 0; - retval->deref = 0; - retval->strict = 0; - - return retval; -} - -yasm_insn_operand * -yasm_operand_create_mem(/*@only@*/ yasm_effaddr *ea) -{ - yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand)); - - retval->type = YASM_INSN__OPERAND_MEMORY; - retval->data.ea = ea; - retval->targetmod = 0; - retval->size = 0; - retval->deref = 0; - retval->strict = 0; - - return retval; -} - -yasm_insn_operand * -yasm_operand_create_imm(/*@only@*/ yasm_expr *val) -{ - yasm_insn_operand *retval; - const uintptr_t *reg; - - reg = yasm_expr_get_reg(&val, 0); - if (reg) { - retval = yasm_operand_create_reg(*reg); - yasm_expr_destroy(val); - } else { - retval = yasm_xmalloc(sizeof(yasm_insn_operand)); - retval->type = YASM_INSN__OPERAND_IMM; - retval->data.val = val; - retval->targetmod = 0; - retval->size = 0; - retval->deref = 0; - retval->strict = 0; - } - - return retval; -} - -void -yasm_operand_print(const yasm_insn_operand *op, FILE *f, int indent_level, - yasm_arch *arch) -{ - switch (op->type) { - case YASM_INSN__OPERAND_REG: - fprintf(f, "%*sReg=", indent_level, ""); - yasm_arch_reg_print(arch, op->data.reg, f); - fprintf(f, "\n"); - break; - case YASM_INSN__OPERAND_SEGREG: - fprintf(f, "%*sSegReg=", indent_level, ""); - yasm_arch_segreg_print(arch, op->data.reg, f); - fprintf(f, "\n"); - break; - case YASM_INSN__OPERAND_MEMORY: - fprintf(f, "%*sMemory=\n", indent_level, ""); - yasm_ea_print(op->data.ea, f, indent_level); - break; - case YASM_INSN__OPERAND_IMM: - fprintf(f, "%*sImm=", indent_level, ""); - yasm_expr_print(op->data.val, f); - fprintf(f, "\n"); - break; - } - fprintf(f, "%*sTargetMod=%lx\n", indent_level+1, "", - (unsigned long)op->targetmod); - fprintf(f, "%*sSize=%u\n", indent_level+1, "", op->size); - fprintf(f, "%*sDeref=%d, Strict=%d\n", indent_level+1, "", (int)op->deref, - (int)op->strict); -} - -void -yasm_ops_delete(yasm_insn_operands *headp, int content) -{ - yasm_insn_operand *cur, *next; - - cur = STAILQ_FIRST(headp); - while (cur) { - next = STAILQ_NEXT(cur, link); - if (content) - switch (cur->type) { - case YASM_INSN__OPERAND_MEMORY: - yasm_ea_destroy(cur->data.ea); - break; - case YASM_INSN__OPERAND_IMM: - yasm_expr_destroy(cur->data.val); - break; - default: - break; - } - yasm_xfree(cur); - cur = next; - } - STAILQ_INIT(headp); -} - -/*@null@*/ yasm_insn_operand * -yasm_ops_append(yasm_insn_operands *headp, - /*@returned@*/ /*@null@*/ yasm_insn_operand *op) -{ - if (op) { - STAILQ_INSERT_TAIL(headp, op, link); - return op; - } - return (yasm_insn_operand *)NULL; -} - -void -yasm_ops_print(const yasm_insn_operands *headp, FILE *f, int indent_level, - yasm_arch *arch) -{ - yasm_insn_operand *cur; - - STAILQ_FOREACH (cur, headp, link) - yasm_operand_print(cur, f, indent_level, arch); -} - -yasm_insn_operands * -yasm_ops_create(void) -{ - yasm_insn_operands *headp = yasm_xmalloc(sizeof(yasm_insn_operands)); - yasm_ops_initialize(headp); - return headp; -} - -void -yasm_ops_destroy(yasm_insn_operands *headp, int content) -{ - yasm_ops_delete(headp, content); - yasm_xfree(headp); -} - -/* Non-macro yasm_ops_first() for non-YASM_LIB_INTERNAL users. */ -#undef yasm_ops_first -yasm_insn_operand * -yasm_ops_first(yasm_insn_operands *headp) -{ - return STAILQ_FIRST(headp); -} - -/* Non-macro yasm_operand_next() for non-YASM_LIB_INTERNAL users. */ -#undef yasm_operand_next -yasm_insn_operand * -yasm_operand_next(yasm_insn_operand *cur) -{ - return STAILQ_NEXT(cur, link); -} diff --git a/libyasm/arch.h b/libyasm/arch.h index f6e23ae3..3da9f9fc 100644 --- a/libyasm/arch.h +++ b/libyasm/arch.h @@ -2,10 +2,6 @@ * \file libyasm/arch.h * \brief YASM architecture interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2002-2007 Peter Johnson * @@ -59,12 +55,6 @@ typedef enum yasm_arch_regtmod { YASM_ARCH_TARGETMOD /**< A target modifier (for jumps) */ } yasm_arch_regtmod; -/** An instruction operand (opaque type). */ -typedef struct yasm_insn_operand yasm_insn_operand; -#ifdef YASM_LIB_INTERNAL -/*@reldef@*/ STAILQ_HEAD(yasm_insn_operands, yasm_insn_operand); -#endif - #ifndef YASM_DOXYGEN /** Base #yasm_arch structure. Must be present as the first element in any * #yasm_arch implementation. @@ -114,7 +104,7 @@ typedef struct yasm_arch_module { * Call yasm_arch_create() instead of calling this function. */ /*@only@*/ yasm_arch * (*create) (const char *machine, const char *parser, - yasm_arch_create_error *error); + /*@out@*/ yasm_arch_create_error *error); /** Module-level implementation of yasm_arch_destroy(). * Call yasm_arch_destroy() instead of calling this function. @@ -140,30 +130,21 @@ typedef struct yasm_arch_module { * Call yasm_arch_parse_check_insnprefix() instead of calling this function. */ yasm_arch_insnprefix (*parse_check_insnprefix) - (yasm_arch *arch, /*@out@*/ uintptr_t data[4], const char *id, - size_t id_len); + (yasm_arch *arch, const char *id, size_t id_len, unsigned long line, + /*@out@*/ /*@only@*/ yasm_bytecode **bc, /*@out@*/ uintptr_t *prefix); /** Module-level implementation of yasm_arch_parse_check_regtmod(). * Call yasm_arch_parse_check_regtmod() instead of calling this function. */ yasm_arch_regtmod (*parse_check_regtmod) - (yasm_arch *arch, /*@out@*/ uintptr_t *data, const char *id, - size_t id_len); + (yasm_arch *arch, const char *id, size_t id_len, + /*@out@*/ uintptr_t *data); /** Module-level implementation of yasm_arch_get_fill(). * Call yasm_arch_get_fill() instead of calling this function. */ const unsigned char ** (*get_fill) (const yasm_arch *arch); - /** Module-level implementation of yasm_arch_finalize_insn(). - * Call yasm_arch_finalize_insn() instead of calling this function. - */ - void (*finalize_insn) - (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, - const uintptr_t data[4], int num_operands, - /*@null@*/ yasm_insn_operands *operands, int num_prefixes, - uintptr_t **prefixes, int num_segregs, const uintptr_t *segregs); - /** Module-level implementation of yasm_arch_floatnum_tobytes(). * Call yasm_arch_floatnum_tobytes() instead of calling this function. */ @@ -205,6 +186,22 @@ typedef struct yasm_arch_module { */ yasm_effaddr * (*ea_create) (yasm_arch *arch, /*@keep@*/ yasm_expr *e); + /** Module-level implementation of yasm_arch_ea_destroy(). + * Call yasm_arch_ea_destroy() instead of calling this function. + */ + void (*ea_destroy) (/*@only@*/ yasm_effaddr *ea); + + /** Module-level implementation of yasm_arch_ea_print(). + * Call yasm_arch_ea_print() instead of calling this function. + */ + void (*ea_print) (const yasm_effaddr *ea, FILE *f, int indent_level); + + /** Module-level implementation of yasm_arch_create_empty_insn(). + * Call yasm_arch_create_empty_insn() instead of calling this function. + */ + /*@only@*/ yasm_bytecode * (*create_empty_insn) (yasm_arch *arch, + unsigned long line); + /** NULL-terminated list of machines for this architecture. * Call yasm_arch_get_machine() to get the active machine of a particular * #yasm_arch. @@ -230,56 +227,6 @@ typedef struct yasm_arch_module { unsigned int min_insn_len; } yasm_arch_module; -#ifdef YASM_LIB_INTERNAL -/** An instruction operand. \internal */ -struct yasm_insn_operand { - /** Link for building linked list of operands. \internal */ - /*@reldef@*/ STAILQ_ENTRY(yasm_insn_operand) link; - - /** Operand type. */ - enum yasm_insn_operand_type { - YASM_INSN__OPERAND_REG = 1, /**< A register. */ - YASM_INSN__OPERAND_SEGREG, /**< A segment register. */ - YASM_INSN__OPERAND_MEMORY, /**< An effective address - * (memory reference). */ - YASM_INSN__OPERAND_IMM /**< An immediate or jump target. */ - } type; - - /** Operand data. */ - union { - uintptr_t reg; /**< Arch data for reg/segreg. */ - yasm_effaddr *ea; /**< Effective address for memory references. */ - yasm_expr *val; /**< Value of immediate or jump target. */ - } data; - - uintptr_t targetmod; /**< Arch target modifier, 0 if none. */ - - /** Specified size of the operand, in bits. 0 if not user-specified. */ - unsigned int size:8; - - /** Nonzero if dereference. Used for "*foo" in GAS. - * The reason for this is that by default in GAS, an unprefixed value - * is a memory address, except for jumps/calls, in which case it needs a - * "*" prefix to become a memory address (otherwise it's an immediate). - * This isn't knowable in the parser stage, so the parser sets this flag - * to indicate the "*" prefix has been used, and the arch needs to adjust - * the operand type appropriately depending on the instruction type. - */ - unsigned int deref:1; - - /** Nonzero if strict. Used for "strict foo" in NASM. - * This is used to inhibit optimization on otherwise "sized" values. - * For example, the user may just want to be explicit with the size on - * "push dword 4", but not actually want to force the immediate size to - * 4 bytes (rather wanting the optimizer to optimize it down to 1 byte as - * though "dword" was not specified). To indicate the immediate should - * actually be forced to 4 bytes, the user needs to write - * "push strict dword 4", which sets this flag. - */ - unsigned int strict:1; -}; -#endif - /** Get the one-line description of an architecture. * \param arch architecture * \return One-line description of architecture. @@ -348,15 +295,18 @@ int yasm_arch_set_var(yasm_arch *arch, const char *var, unsigned long val); * symbols. Any additional data beyond just the type (almost always necessary) * should be returned into the space provided by the data parameter. * \param arch architecture - * \param data extra identification information (yasm_arch-specific) - * [output] * \param id identifier as in the input file * \param id_len length of id string + * \param line virtual line + * \param bc for instructions, yasm_insn-based bytecode is returned + * (and NULL otherwise) + * \param prefix for prefixes, yasm_arch-specific value is returned + * (and 0 otherwise) * \return Identifier type (#YASM_ARCH_NOTINSNPREFIX if unrecognized) */ yasm_arch_insnprefix yasm_arch_parse_check_insnprefix - (yasm_arch *arch, /*@out@*/ uintptr_t data[4], const char *id, - size_t id_len); + (yasm_arch *arch, const char *id, size_t id_len, unsigned long line, + /*@out@*/ /*@only@*/ yasm_bytecode **bc, /*@out@*/ uintptr_t *prefix); /** Check an generic identifier to see if it matches architecture specific * names for registers or target modifiers. Unrecognized identifiers should @@ -364,15 +314,15 @@ yasm_arch_insnprefix yasm_arch_parse_check_insnprefix * (almost always necessary) should be returned into the space provided by the * data parameter. * \param arch architecture - * \param data extra identification information (yasm_arch-specific) - * [output] * \param id identifier as in the input file * \param id_len length of id string + * \param data extra identification information (yasm_arch-specific) + * [output] * \return Identifier type (#YASM_ARCH_NOTREGTMOD if unrecognized) */ yasm_arch_regtmod yasm_arch_parse_check_regtmod - (yasm_arch *arch, /*@out@*/ uintptr_t *data, const char *id, - size_t id_len); + (yasm_arch *arch, const char *id, size_t id_len, + /*@out@*/ uintptr_t *data); /** Get NOP fill patterns for 1-15 bytes of fill. * \param arch architecture @@ -381,28 +331,6 @@ yasm_arch_regtmod yasm_arch_parse_check_regtmod */ const unsigned char **yasm_arch_get_fill(const yasm_arch *arch); -/** Finalize an instruction from a semi-generic insn description. Note an - * existing bytecode is required. - * \param arch architecture - * \param bc bytecode to finalize - * \param prev_bc previous bytecode in section - * \param data instruction data (from parse_check_id()); all - * zero indicates an empty instruction - * \param num_operands number of operands - * \param operands list of operands (in parse order) - * \param num_prefixes number of prefixes - * \param prefixes array of 4-element prefix data - * \param num_segregs number of segment register prefixes - * \param segregs array of segment register data - * \return If no match is found (the instruction is invalid), no action is - * performed and an error is recorded. - */ -void yasm_arch_finalize_insn - (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, - const uintptr_t data[4], int num_operands, - /*@null@*/ yasm_insn_operands *operands, int num_prefixes, - const uintptr_t **prefixes, int num_segregs, const uintptr_t *segregs); - /** Output #yasm_floatnum to buffer. Puts the value into the least * significant bits of the destination, or may be shifted into more * significant bits by the shift parameter. The destination bits are @@ -481,6 +409,29 @@ void yasm_arch_segreg_print(yasm_arch *arch, uintptr_t segreg, FILE *f); */ yasm_effaddr *yasm_arch_ea_create(yasm_arch *arch, /*@keep@*/ yasm_expr *e); +/** Delete (free allocated memory for) an effective address. + * \param arch architecture + * \param ea effective address (only pointer to it). + */ +void yasm_arch_ea_destroy(yasm_arch *arch, /*@only@*/ yasm_effaddr *ea); + +/** Print an effective address. For debugging purposes. + * \param arch architecture + * \param ea effective address + * \param f file + * \param indent_level indentation level + */ +void yasm_arch_ea_print(const yasm_arch *arch, const yasm_effaddr *ea, + FILE *f, int indent_level); + +/** Create a bytecode that represents a single empty (0 length) instruction. + * This is used for handling solitary prefixes. + * \param arch architecture + * \param line virtual line (from yasm_linemap) + * \return Newly allocated bytecode. + */ +/*@only@*/ yasm_bytecode *yasm_arch_create_empty_insn(yasm_arch *arch, + unsigned long line); #ifndef YASM_DOXYGEN @@ -506,20 +457,14 @@ yasm_effaddr *yasm_arch_ea_create(yasm_arch *arch, /*@keep@*/ yasm_expr *e); ((yasm_arch_base *)arch)->module->get_address_size(arch) #define yasm_arch_set_var(arch, var, val) \ ((yasm_arch_base *)arch)->module->set_var(arch, var, val) -#define yasm_arch_parse_check_insnprefix(arch, data, id, id_len) \ - ((yasm_arch_base *)arch)->module->parse_check_insnprefix(arch, data, id, \ - id_len) -#define yasm_arch_parse_check_regtmod(arch, data, id, id_len) \ - ((yasm_arch_base *)arch)->module->parse_check_regtmod(arch, data, id, \ - id_len) +#define yasm_arch_parse_check_insnprefix(arch, id, id_len, line, bc, prefix) \ + ((yasm_arch_base *)arch)->module->parse_check_insnprefix \ + (arch, id, id_len, line, bc, prefix) +#define yasm_arch_parse_check_regtmod(arch, id, id_len, data) \ + ((yasm_arch_base *)arch)->module->parse_check_regtmod \ + (arch, id, id_len, data) #define yasm_arch_get_fill(arch) \ ((yasm_arch_base *)arch)->module->get_fill(arch) -#define yasm_arch_finalize_insn(arch, bc, prev_bc, data, num_operands, \ - operands, num_prefixes, prefixes, \ - num_segregs, segregs) \ - ((yasm_arch_base *)arch)->module->finalize_insn \ - (arch, bc, prev_bc, data, num_operands, operands, num_prefixes, \ - prefixes, num_segregs, segregs) #define yasm_arch_floatnum_tobytes(arch, flt, buf, destsize, valsize, shift, \ warn) \ ((yasm_arch_base *)arch)->module->floatnum_tobytes \ @@ -538,100 +483,13 @@ yasm_effaddr *yasm_arch_ea_create(yasm_arch *arch, /*@keep@*/ yasm_expr *e); ((yasm_arch_base *)arch)->module->segreg_print(arch, segreg, f) #define yasm_arch_ea_create(arch, e) \ ((yasm_arch_base *)arch)->module->ea_create(arch, e) +#define yasm_arch_ea_destroy(arch, ea) \ + ((yasm_arch_base *)arch)->module->ea_destroy(ea) +#define yasm_arch_ea_print(arch, ea, f, i) \ + ((yasm_arch_base *)arch)->module->ea_print(ea, f, i) +#define yasm_arch_create_empty_insn(arch, line) \ + ((yasm_arch_base *)arch)->module->create_empty_insn(arch, line) #endif -/** Create an instruction operand from a register. - * \param reg register - * \return Newly allocated operand. - */ -yasm_insn_operand *yasm_operand_create_reg(uintptr_t reg); - -/** Create an instruction operand from a segment register. - * \param segreg segment register - * \return Newly allocated operand. - */ -yasm_insn_operand *yasm_operand_create_segreg(uintptr_t segreg); - -/** Create an instruction operand from an effective address. - * \param ea effective address - * \return Newly allocated operand. - */ -yasm_insn_operand *yasm_operand_create_mem(/*@only@*/ yasm_effaddr *ea); - -/** Create an instruction operand from an immediate expression. - * Looks for cases of a single register and creates a register variant of - * #yasm_insn_operand. - * \param val immediate expression - * \return Newly allocated operand. - */ -yasm_insn_operand *yasm_operand_create_imm(/*@only@*/ yasm_expr *val); - -/** Print an instruction operand. For debugging purposes. - * \param arch architecture - * \param f file - * \param indent_level indentation level - * \param op instruction operand - */ -void yasm_operand_print(const yasm_insn_operand *op, FILE *f, int indent_level, - yasm_arch *arch); - -/** Create a new list of instruction operands. - * \return Newly allocated list. - */ -yasm_insn_operands *yasm_ops_create(void); - -/** Destroy a list of instruction operands (created with yasm_ops_create()). - * \param headp list of instruction operands - * \param content if nonzero, deletes content of each operand - */ -void yasm_ops_destroy(yasm_insn_operands *headp, int content); - -/** Get the first operand in a list of instruction operands. - * \param headp list of instruction operands - * \return First operand in list (NULL if list is empty). - */ -yasm_insn_operand *yasm_ops_first(yasm_insn_operands *headp); - -/** Get the next operand in a list of instruction operands. - * \param cur previous operand - * \return Next operand in list (NULL if cur was the last operand). - */ -yasm_insn_operand *yasm_operand_next(yasm_insn_operand *cur); - -#ifdef YASM_LIB_INTERNAL -#define yasm_ops_initialize(headp) STAILQ_INIT(headp) -#define yasm_ops_first(headp) STAILQ_FIRST(headp) -#define yasm_operand_next(cur) STAILQ_NEXT(cur, link) - -/** Delete (free allocated memory for) a list of instruction operands (created - * with yasm_ops_initialize()). - * \param headp list of instruction operands - * \param content if nonzero, deletes content of each operand - */ -void yasm_ops_delete(yasm_insn_operands *headp, int content); -#endif - -/** Add data value to the end of a list of instruction operands. - * \note Does not make a copy of the operand; so don't pass this function - * static or local variables, and discard the op pointer after calling - * this function. - * \param headp list of instruction operands - * \param op operand (may be NULL) - * \return If operand was actually appended (it wasn't NULL), the operand; - * otherwise NULL. - */ -/*@null@*/ yasm_insn_operand *yasm_ops_append - (yasm_insn_operands *headp, - /*@returned@*/ /*@null@*/ yasm_insn_operand *op); - -/** Print a list of instruction operands. For debugging purposes. - * \param arch architecture - * \param f file - * \param indent_level indentation level - * \param headp list of instruction operands - */ -void yasm_ops_print(const yasm_insn_operands *headp, FILE *f, int indent_level, - yasm_arch *arch); - #endif diff --git a/libyasm/assocdat.c b/libyasm/assocdat.c index f27b2b41..56009368 100644 --- a/libyasm/assocdat.c +++ b/libyasm/assocdat.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "coretype.h" #include "assocdat.h" @@ -89,8 +87,10 @@ yasm__assoc_data_add(yasm__assoc_data *assoc_data_arg, /* See if there's already assocated data for this callback */ for (i=0; isize; i++) { - if (assoc_data->vector[i].callback == callback) + if (assoc_data->vector[i].callback == callback) { item = &assoc_data->vector[i]; + break; + } } /* No? Then append a new one */ diff --git a/libyasm/assocdat.h b/libyasm/assocdat.h index 4b162d66..cf423867 100644 --- a/libyasm/assocdat.h +++ b/libyasm/assocdat.h @@ -2,10 +2,6 @@ * \file assocdat.h * \brief YASM associated data storage (libyasm internal use) * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2003-2007 Peter Johnson * @@ -34,10 +30,15 @@ #ifndef YASM_ASSOCDAT_H #define YASM_ASSOCDAT_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Associated data container. */ typedef struct yasm__assoc_data yasm__assoc_data; /** Create an associated data container. */ +YASM_LIB_DECL /*@only@*/ yasm__assoc_data *yasm__assoc_data_create(void); /** Get associated data for a data callback. @@ -45,6 +46,7 @@ typedef struct yasm__assoc_data yasm__assoc_data; * \param callback callback used when adding data * \return Associated data (NULL if none). */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ void *yasm__assoc_data_get (/*@null@*/ yasm__assoc_data *assoc_data, const yasm_assoc_data_callback *callback); @@ -55,16 +57,19 @@ typedef struct yasm__assoc_data yasm__assoc_data; * \param callback callback * \param data data to associate */ +YASM_LIB_DECL /*@only@*/ yasm__assoc_data *yasm__assoc_data_add (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data, const yasm_assoc_data_callback *callback, /*@only@*/ /*@null@*/ void *data); /** Destroy all associated data in a container. */ +YASM_LIB_DECL void yasm__assoc_data_destroy (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data); /** Print all associated data in a container. */ +YASM_LIB_DECL void yasm__assoc_data_print(const yasm__assoc_data *assoc_data, FILE *f, int indent_level); diff --git a/libyasm/bc-align.c b/libyasm/bc-align.c index dec63a2b..2a47882e 100644 --- a/libyasm/bc-align.c +++ b/libyasm/bc-align.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -37,8 +35,6 @@ #include "bytecode.h" -#include "bc-int.h" - typedef struct bytecode_align { /*@only@*/ yasm_expr *boundary; /* alignment boundary */ @@ -61,7 +57,8 @@ static int bc_align_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, static int bc_align_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); -static int bc_align_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +static int bc_align_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -69,6 +66,7 @@ static const yasm_bytecode_callback bc_align_callback = { bc_align_destroy, bc_align_print, bc_align_finalize, + NULL, bc_align_calc_len, bc_align_expand, bc_align_tobytes, @@ -166,7 +164,8 @@ bc_align_expand(yasm_bytecode *bc, int span, long old_val, long new_val, } static int -bc_align_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +bc_align_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { diff --git a/libyasm/bc-data.c b/libyasm/bc-data.c index 50851eb1..ebbdd6f9 100644 --- a/libyasm/bc-data.c +++ b/libyasm/bc-data.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -39,13 +37,12 @@ #include "bytecode.h" #include "arch.h" -#include "bc-int.h" - struct yasm_dataval { /*@reldef@*/ STAILQ_ENTRY(yasm_dataval) link; - enum { DV_EMPTY, DV_VALUE, DV_RAW, DV_ULEB128, DV_SLEB128 } type; + enum { DV_EMPTY, DV_VALUE, DV_RAW, DV_ULEB128, DV_SLEB128, DV_RESERVE } + type; union { yasm_value val; @@ -54,19 +51,26 @@ struct yasm_dataval { unsigned long len; } raw; } data; + + /* number of times data is repeated, NULL=1. */ + /*@only@*/ /*@null@*/ yasm_expr *multiple; }; typedef struct bytecode_data { /* converted data (linked list) */ yasm_datavalhead datahead; + + int item_size; } bytecode_data; static void bc_data_destroy(void *contents); static void bc_data_print(const void *contents, FILE *f, int indent_level); static void bc_data_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); +static int bc_data_item_size(yasm_bytecode *bc); static int bc_data_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); -static int bc_data_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +static int bc_data_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -74,6 +78,7 @@ static const yasm_bytecode_callback bc_data_callback = { bc_data_destroy, bc_data_print, bc_data_finalize, + bc_data_item_size, bc_data_calc_len, yasm_bc_expand_common, bc_data_tobytes, @@ -134,9 +139,26 @@ bc_data_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc) default: break; } + if (dv->multiple) { + yasm_value val; + if (yasm_value_finalize_expr(&val, dv->multiple, prev_bc, 0)) + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("multiple expression too complex")); + else if (val.rel) + yasm_error_set(YASM_ERROR_NOT_ABSOLUTE, + N_("multiple expression not absolute")); + dv->multiple = val.abs; + } } } +static int +bc_data_item_size(yasm_bytecode *bc) +{ + bytecode_data *bc_data = (bytecode_data *)bc->contents; + return bc_data->item_size; +} + static int bc_data_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data) @@ -144,65 +166,93 @@ bc_data_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, bytecode_data *bc_data = (bytecode_data *)bc->contents; yasm_dataval *dv; yasm_intnum *intn; + unsigned long len = 0; + unsigned long multiple; /* Count up element sizes, rounding up string length. */ STAILQ_FOREACH(dv, &bc_data->datahead, link) { switch (dv->type) { case DV_EMPTY: + len = 0; break; case DV_VALUE: - bc->len += dv->data.val.size/8; + len = dv->data.val.size/8; break; case DV_RAW: - bc->len += dv->data.raw.len; + len = dv->data.raw.len; break; case DV_ULEB128: case DV_SLEB128: intn = yasm_expr_get_intnum(&dv->data.val.abs, 0); if (!intn) yasm_internal_error(N_("non-constant in data_tobytes")); - bc->len += - yasm_intnum_size_leb128(intn, dv->type == DV_SLEB128); + len = yasm_intnum_size_leb128(intn, dv->type == DV_SLEB128); + break; + case DV_RESERVE: + len = dv->data.val.size/8; break; } + + if (!yasm_dv_get_multiple(dv, &multiple)) + len *= multiple; + + bc->len += len; } return 0; } static int -bc_data_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +bc_data_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { bytecode_data *bc_data = (bytecode_data *)bc->contents; yasm_dataval *dv; - unsigned char *bufp_orig = *bufp; yasm_intnum *intn; unsigned int val_len; + unsigned long multiple, i; STAILQ_FOREACH(dv, &bc_data->datahead, link) { + if (yasm_dv_get_multiple(dv, &multiple) || multiple == 0) + continue; switch (dv->type) { case DV_EMPTY: break; case DV_VALUE: val_len = dv->data.val.size/8; - if (output_value(&dv->data.val, *bufp, val_len, - (unsigned long)(*bufp-bufp_orig), bc, 1, d)) - return 1; - *bufp += val_len; + for (i=0; idata.val, *bufp, val_len, + (unsigned long)(*bufp-bufstart), bc, 1, + d)) + return 1; + *bufp += val_len; + } break; case DV_RAW: - memcpy(*bufp, dv->data.raw.contents, dv->data.raw.len); - *bufp += dv->data.raw.len; + for (i=0; idata.raw.contents, dv->data.raw.len); + *bufp += dv->data.raw.len; + } break; case DV_ULEB128: case DV_SLEB128: intn = yasm_expr_get_intnum(&dv->data.val.abs, 234); if (!intn) yasm_internal_error(N_("non-constant in data_tobytes")); - *bufp += - yasm_intnum_get_leb128(intn, *bufp, dv->type == DV_SLEB128); + for (i=0; itype == DV_SLEB128); + } + case DV_RESERVE: + val_len = dv->data.val.size/8; + for (i=0; idatahead); + data->item_size = size; /* Prescan input data for length, etc. Careful: this needs to be * precisely paired with the second loop. */ STAILQ_FOREACH(dv, datahead, link) { + if (dv->multiple && dv->type != DV_EMPTY && len > 0) { + /* Flush previous data */ + dvo = yasm_dv_create_raw(yasm_xmalloc(len), len); + STAILQ_INSERT_TAIL(&data->datahead, dvo, link); + len = 0; + } switch (dv->type) { case DV_EMPTY: break; @@ -250,6 +307,7 @@ yasm_bc_create_data(yasm_datavalhead *datahead, unsigned int size, /* Create bytecode for this value */ dvo = yasm_xmalloc(sizeof(yasm_dataval)); STAILQ_INSERT_TAIL(&data->datahead, dvo, link); + dvo->multiple = dv->multiple; } break; case DV_RAW: @@ -258,7 +316,19 @@ yasm_bc_create_data(yasm_datavalhead *datahead, unsigned int size, rlen = (rlen + size - 1) / size; len += rlen*size; break; + case DV_RESERVE: + len += size; + break; } + + if (dv->multiple && dv->type != DV_EMPTY && len > 0) { + /* Flush this data */ + dvo = yasm_dv_create_raw(yasm_xmalloc(len), len); + STAILQ_INSERT_TAIL(&data->datahead, dvo, link); + dvo->multiple = dv->multiple; + len = 0; + } + if (append_zero) len++; } @@ -274,6 +344,10 @@ yasm_bc_create_data(yasm_datavalhead *datahead, unsigned int size, dvo = STAILQ_FIRST(&data->datahead); len = 0; while (dv && dvo) { + if (dv->multiple && dv->type != DV_EMPTY && len > 0) { + dvo = STAILQ_NEXT(dvo, link); + len = 0; + } switch (dv->type) { case DV_EMPTY: break; @@ -326,7 +400,17 @@ yasm_bc_create_data(yasm_datavalhead *datahead, unsigned int size, dvo->data.raw.contents[len++] = 0; } break; + case DV_RESERVE: + memset(&dvo->data.raw.contents[len], 0, size); + len += size; + break; } + + if (dv->multiple && dv->type != DV_EMPTY && len > 0) { + dvo = STAILQ_NEXT(dvo, link); + len = 0; + } + if (append_zero) dvo->data.raw.contents[len++] = 0; dv2 = STAILQ_NEXT(dv, link); @@ -367,6 +451,7 @@ yasm_dv_create_expr(yasm_expr *e) retval->type = DV_VALUE; yasm_value_initialize(&retval->data.val, e, 0); + retval->multiple = NULL; return retval; } @@ -379,10 +464,62 @@ yasm_dv_create_raw(unsigned char *contents, unsigned long len) retval->type = DV_RAW; retval->data.raw.contents = contents; retval->data.raw.len = len; + retval->multiple = NULL; return retval; } +yasm_dataval * +yasm_dv_create_reserve(void) +{ + yasm_dataval *retval = yasm_xmalloc(sizeof(yasm_dataval)); + + retval->type = DV_RESERVE; + retval->multiple = NULL; + + return retval; +} + +yasm_value * +yasm_dv_get_value(yasm_dataval *dv) +{ + if (dv->type != DV_VALUE) + return NULL; + return &dv->data.val; +} + +void +yasm_dv_set_multiple(yasm_dataval *dv, yasm_expr *e) +{ + if (dv->multiple) + dv->multiple = yasm_expr_create_tree( dv->multiple, YASM_EXPR_MUL, e, + e->line); + else + dv->multiple = e; +} + +int +yasm_dv_get_multiple(yasm_dataval *dv, unsigned long *multiple) +{ + /*@dependent@*/ /*@null@*/ const yasm_intnum *num; + + *multiple = 1; + if (dv->multiple) { + num = yasm_expr_get_intnum(&dv->multiple, 0); + if (!num) { + yasm_error_set(YASM_ERROR_VALUE, + N_("could not determine multiple")); + return 1; + } + if (yasm_intnum_sign(num) < 0) { + yasm_error_set(YASM_ERROR_VALUE, N_("multiple is negative")); + return 1; + } + *multiple = yasm_intnum_get_uint(num); + } + return 0; +} + void yasm_dvs_delete(yasm_datavalhead *headp) { @@ -401,6 +538,8 @@ yasm_dvs_delete(yasm_datavalhead *headp) default: break; } + if (cur->multiple) + yasm_expr_destroy(cur->multiple); yasm_xfree(cur); cur = next; } @@ -424,6 +563,11 @@ yasm_dvs_print(const yasm_datavalhead *head, FILE *f, int indent_level) unsigned long i; STAILQ_FOREACH(cur, head, link) { + fprintf(f, "%*sMultiple=", indent_level, ""); + if (!cur->multiple) + fprintf(f, "nil (1)"); + else + yasm_expr_print(cur->multiple, f); switch (cur->type) { case DV_EMPTY: fprintf(f, "%*sEmpty\n", indent_level, ""); @@ -448,14 +592,9 @@ yasm_dvs_print(const yasm_datavalhead *head, FILE *f, int indent_level) fprintf(f, "%*sSLEB128 value:\n", indent_level, ""); yasm_value_print(&cur->data.val, f, indent_level+1); break; + case DV_RESERVE: + fprintf(f, "%*sReserved\n", indent_level, ""); + break; } } } - -/* Non-macro yasm_dvs_initialize() for non-YASM_LIB_INTERNAL users. */ -#undef yasm_dvs_initialize -void -yasm_dvs_initialize(yasm_datavalhead *headp) -{ - STAILQ_INIT(headp); -} diff --git a/libyasm/bc-incbin.c b/libyasm/bc-incbin.c index f97f6901..a8fec7d6 100644 --- a/libyasm/bc-incbin.c +++ b/libyasm/bc-incbin.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -42,8 +40,6 @@ #include "file.h" -#include "bc-int.h" - typedef struct bytecode_incbin { /*@only@*/ char *filename; /* file to include data from */ @@ -61,7 +57,8 @@ static void bc_incbin_print(const void *contents, FILE *f, int indent_level); static void bc_incbin_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); static int bc_incbin_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); -static int bc_incbin_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +static int bc_incbin_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -69,6 +66,7 @@ static const yasm_bytecode_callback bc_incbin_callback = { bc_incbin_destroy, bc_incbin_print, bc_incbin_finalize, + NULL, bc_incbin_calc_len, yasm_bc_expand_common, bc_incbin_tobytes, @@ -197,7 +195,8 @@ bc_incbin_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -bc_incbin_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +bc_incbin_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { diff --git a/libyasm/bc-insn.c b/libyasm/bc-insn.c deleted file mode 100644 index de8f5143..00000000 --- a/libyasm/bc-insn.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Insn bytecode - * - * Copyright (C) 2005-2007 Peter Johnson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#define YASM_LIB_INTERNAL -#include "util.h" -/*@unused@*/ RCSID("$Id$"); - -#include "libyasm-stdint.h" -#include "coretype.h" - -#include "errwarn.h" -#include "expr.h" -#include "value.h" - -#include "bytecode.h" -#include "arch.h" - -#include "bc-int.h" - - -typedef struct bytecode_insn { - /*@dependent@*/ yasm_arch *arch; - uintptr_t insn_data[4]; - - int num_operands; - /*@null@*/ yasm_insn_operands operands; - - /* array of 4-element prefix_data arrays */ - int num_prefixes; - /*@null@*/ uintptr_t **prefixes; - - /* array of segment prefixes */ - int num_segregs; - /*@null@*/ uintptr_t *segregs; -} bytecode_insn; - -static void bc_insn_destroy(void *contents); -static void bc_insn_print(const void *contents, FILE *f, int indent_level); -static void bc_insn_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); -static int bc_insn_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, - void *add_span_data); -static int bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, - yasm_output_value_func output_value, - /*@null@*/ yasm_output_reloc_func output_reloc); - -static const yasm_bytecode_callback bc_insn_callback = { - bc_insn_destroy, - bc_insn_print, - bc_insn_finalize, - bc_insn_calc_len, - yasm_bc_expand_common, - bc_insn_tobytes, - 0 -}; - - -const yasm_expr * -yasm_ea_get_disp(const yasm_effaddr *ea) -{ - return ea->disp.abs; -} - -void -yasm_ea_set_len(yasm_effaddr *ptr, unsigned int len) -{ - if (!ptr) - return; - - /* Currently don't warn if length truncated, as this is called only from - * an explicit override, where we expect the user knows what they're doing. - */ - - ptr->disp.size = (unsigned char)len; -} - -void -yasm_ea_set_nosplit(yasm_effaddr *ptr, unsigned int nosplit) -{ - if (!ptr) - return; - - ptr->nosplit = (unsigned char)nosplit; -} - -void -yasm_ea_set_strong(yasm_effaddr *ptr, unsigned int strong) -{ - if (!ptr) - return; - - ptr->strong = (unsigned char)strong; -} - -void -yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg) -{ - if (!ea) - return; - - if (segreg != 0 && ea->segreg != 0) - yasm_warn_set(YASM_WARN_GENERAL, - N_("multiple segment overrides, using leftmost")); - - ea->segreg = segreg; -} - -/*@-nullstate@*/ -void -yasm_ea_destroy(yasm_effaddr *ea) -{ - ea->callback->destroy(ea); - yasm_value_delete(&ea->disp); - yasm_xfree(ea); -} -/*@=nullstate@*/ - -/*@-nullstate@*/ -void -yasm_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level) -{ - fprintf(f, "%*sDisp:\n", indent_level, ""); - yasm_value_print(&ea->disp, f, indent_level+1); - fprintf(f, "%*sNoSplit=%u\n", indent_level, "", (unsigned int)ea->nosplit); - ea->callback->print(ea, f, indent_level); -} -/*@=nullstate@*/ - -static void -bc_insn_destroy(void *contents) -{ - bytecode_insn *insn = (bytecode_insn *)contents; - if (insn->num_operands > 0) - yasm_ops_delete(&insn->operands, 0); - if (insn->num_prefixes > 0) { - int i; - for (i=0; inum_prefixes; i++) - yasm_xfree(insn->prefixes[i]); - yasm_xfree(insn->prefixes); - } - if (insn->num_segregs > 0) - yasm_xfree(insn->segregs); - yasm_xfree(contents); -} - -static void -bc_insn_print(const void *contents, FILE *f, int indent_level) -{ -} - -static void -bc_insn_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc) -{ - bytecode_insn *insn = (bytecode_insn *)bc->contents; - int i; - yasm_insn_operand *op; - yasm_error_class eclass; - char *str, *xrefstr; - unsigned long xrefline; - - /* Simplify the operands' expressions first. */ - for (i = 0, op = yasm_ops_first(&insn->operands); - op && inum_operands; op = yasm_operand_next(op), i++) { - /* Check operand type */ - switch (op->type) { - case YASM_INSN__OPERAND_MEMORY: - /* Don't get over-ambitious here; some archs' memory expr - * parser are sensitive to the presence of *1, etc, so don't - * simplify reg*1 identities. - */ - if (op->data.ea) - op->data.ea->disp.abs = - yasm_expr__level_tree(op->data.ea->disp.abs, 1, 1, 0, - 0, NULL, NULL); - if (yasm_error_occurred()) { - /* Add a pointer to where it was used to the error */ - yasm_error_fetch(&eclass, &str, &xrefline, &xrefstr); - if (xrefstr) { - yasm_error_set_xref(xrefline, "%s", xrefstr); - yasm_xfree(xrefstr); - } - if (str) { - yasm_error_set(eclass, "%s in memory expression", str); - yasm_xfree(str); - } - return; - } - break; - case YASM_INSN__OPERAND_IMM: - op->data.val = - yasm_expr__level_tree(op->data.val, 1, 1, 1, 0, NULL, - NULL); - if (yasm_error_occurred()) { - /* Add a pointer to where it was used to the error */ - yasm_error_fetch(&eclass, &str, &xrefline, &xrefstr); - if (xrefstr) { - yasm_error_set_xref(xrefline, "%s", xrefstr); - yasm_xfree(xrefstr); - } - if (str) { - yasm_error_set(eclass, "%s in immediate expression", - str); - yasm_xfree(str); - } - return; - } - break; - default: - break; - } - } - - yasm_arch_finalize_insn(insn->arch, bc, prev_bc, insn->insn_data, - insn->num_operands, &insn->operands, - insn->num_prefixes, insn->prefixes, - insn->num_segregs, insn->segregs); -} - -static int -bc_insn_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, - void *add_span_data) -{ - yasm_internal_error(N_("bc_insn_calc_len() is not implemented")); - /*@notreached@*/ - return 0; -} - -static int -bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, - yasm_output_value_func output_value, - /*@unused@*/ yasm_output_reloc_func output_reloc) -{ - yasm_internal_error(N_("bc_insn_tobytes() is not implemented")); - /*@notreached@*/ - return 1; -} - -yasm_bytecode * -yasm_bc_create_insn(yasm_arch *arch, const uintptr_t insn_data[4], - int num_operands, /*@null@*/ yasm_insn_operands *operands, - unsigned long line) -{ - bytecode_insn *insn = yasm_xmalloc(sizeof(bytecode_insn)); - - insn->arch = arch; - insn->insn_data[0] = insn_data[0]; - insn->insn_data[1] = insn_data[1]; - insn->insn_data[2] = insn_data[2]; - insn->insn_data[3] = insn_data[3]; - insn->num_operands = num_operands; - if (operands) - insn->operands = *operands; /* structure copy */ - else - yasm_ops_initialize(&insn->operands); - insn->num_prefixes = 0; - insn->prefixes = NULL; - insn->num_segregs = 0; - insn->segregs = NULL; - - return yasm_bc_create_common(&bc_insn_callback, insn, line); -} - -yasm_bytecode * -yasm_bc_create_empty_insn(yasm_arch *arch, unsigned long line) -{ - bytecode_insn *insn = yasm_xmalloc(sizeof(bytecode_insn)); - - insn->arch = arch; - insn->insn_data[0] = 0; - insn->insn_data[1] = 0; - insn->insn_data[2] = 0; - insn->insn_data[3] = 0; - insn->num_operands = 0; - yasm_ops_initialize(&insn->operands); - insn->num_prefixes = 0; - insn->prefixes = NULL; - insn->num_segregs = 0; - insn->segregs = NULL; - - return yasm_bc_create_common(&bc_insn_callback, insn, line); -} - -void -yasm_bc_insn_add_prefix(yasm_bytecode *bc, const uintptr_t prefix_data[4]) -{ - bytecode_insn *insn = (bytecode_insn *)bc->contents; - - assert(bc->callback == bc_insn_callback); - - insn->prefixes = - yasm_xrealloc(insn->prefixes, - (insn->num_prefixes+1)*sizeof(uintptr_t *)); - insn->prefixes[insn->num_prefixes] = yasm_xmalloc(4*sizeof(uintptr_t)); - insn->prefixes[insn->num_prefixes][0] = prefix_data[0]; - insn->prefixes[insn->num_prefixes][1] = prefix_data[1]; - insn->prefixes[insn->num_prefixes][2] = prefix_data[2]; - insn->prefixes[insn->num_prefixes][3] = prefix_data[3]; - insn->num_prefixes++; -} - -void -yasm_bc_insn_add_seg_prefix(yasm_bytecode *bc, uintptr_t segreg) -{ - bytecode_insn *insn = (bytecode_insn *)bc->contents; - - assert(bc->callback == bc_insn_callback); - - insn->segregs = - yasm_xrealloc(insn->segregs, (insn->num_segregs+1)*sizeof(uintptr_t)); - insn->segregs[insn->num_segregs] = segreg; - insn->num_segregs++; -} diff --git a/libyasm/bc-int.h b/libyasm/bc-int.h deleted file mode 100644 index 76338509..00000000 --- a/libyasm/bc-int.h +++ /dev/null @@ -1,113 +0,0 @@ -/* $Id$ - * Bytecode internal structures header file - * - * Copyright (C) 2001-2007 Peter Johnson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef YASM_BC_INT_H -#define YASM_BC_INT_H - -typedef struct yasm_bytecode_callback { - void (*destroy) (/*@only@*/ void *contents); - void (*print) (const void *contents, FILE *f, int indent_level); - void (*finalize) (yasm_bytecode *bc, yasm_bytecode *prev_bc); - int (*calc_len) (yasm_bytecode *bc, yasm_bc_add_span_func add_span, - void *add_span_data); - int (*expand) (yasm_bytecode *bc, int span, long old_val, long new_val, - /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); - int (*tobytes) (yasm_bytecode *bc, unsigned char **bufp, void *d, - yasm_output_value_func output_value, - /*@null@*/ yasm_output_reloc_func output_reloc); - enum yasm_bytecode_special_type { - YASM_BC_SPECIAL_NONE = 0, - YASM_BC_SPECIAL_RESERVE,/* Reserves space instead of outputting data */ - YASM_BC_SPECIAL_OFFSET /* Adjusts offset instead of calculating len */ - } special; -} yasm_bytecode_callback; - -struct yasm_bytecode { - /*@reldef@*/ STAILQ_ENTRY(yasm_bytecode) link; - - /*@null@*/ const yasm_bytecode_callback *callback; - - /* Pointer to section containing bytecode; NULL if not part of a section. */ - /*@dependent@*/ /*@null@*/ yasm_section *section; - - /* number of times bytecode is repeated, NULL=1. */ - /*@only@*/ /*@null@*/ yasm_expr *multiple; - - unsigned long len; /* total length of entire bytecode - (not including multiple copies) */ - long mult_int; /* number of copies: integer version */ - - /* where it came from */ - unsigned long line; - - /* other assembler state info */ - unsigned long offset; /* ~0UL if unknown */ - unsigned long bc_index; - - /* NULL-terminated array of labels that point to this bytecode (as the - * bytecode previous to the label). NULL if no labels point here. */ - /*@null@*/ yasm_symrec **symrecs; - - /* bytecode-type-specific data (type identified by callback) */ - void *contents; -}; - -/** Create a bytecode of any specified type. - * \param callback bytecode callback functions, if NULL, creates empty - * bytecode (may not be resolved or output) - * \param contents type-specific data - * \param line virtual line (from yasm_linemap) - * \return Newly allocated bytecode of the specified type. - */ -/*@only@*/ yasm_bytecode *yasm_bc_create_common - (/*@null@*/ const yasm_bytecode_callback *callback, - /*@only@*/ /*@null@*/ void *contents, unsigned long line); - -/** Transform a bytecode of any type into a different type. - * \param bc bytecode to transform - * \param callback new bytecode callback function - * \param contents new type-specific data - */ -void yasm_bc_transform(yasm_bytecode *bc, - const yasm_bytecode_callback *callback, - void *contents); - -/** Common bytecode callback finalize function, for where no finalization - * is ever required for this type of bytecode. - */ -void yasm_bc_finalize_common(yasm_bytecode *bc, yasm_bytecode *prev_bc); - -/** Common bytecode callback expand function, for where the bytecode is - * always short (calc_len never calls add_span). Causes an internal - * error if called. - */ -int yasm_bc_expand_common - (yasm_bytecode *bc, int span, long old_val, long new_val, - /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); - -#define yasm_bc__next(x) STAILQ_NEXT(x, link) - -#endif diff --git a/libyasm/bc-org.c b/libyasm/bc-org.c index 0b73c79f..7ef96c84 100644 --- a/libyasm/bc-org.c +++ b/libyasm/bc-org.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -39,11 +37,10 @@ #include "bytecode.h" -#include "bc-int.h" - typedef struct bytecode_org { unsigned long start; /* target starting offset within section */ + unsigned long fill; /* fill value */ } bytecode_org; static void bc_org_destroy(void *contents); @@ -54,7 +51,8 @@ static int bc_org_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, static int bc_org_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); -static int bc_org_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +static int bc_org_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -62,6 +60,7 @@ static const yasm_bytecode_callback bc_org_callback = { bc_org_destroy, bc_org_print, bc_org_finalize, + NULL, bc_org_calc_len, bc_org_expand, bc_org_tobytes, @@ -121,7 +120,8 @@ bc_org_expand(yasm_bytecode *bc, int span, long old_val, long new_val, } static int -bc_org_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +bc_org_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { @@ -136,16 +136,17 @@ bc_org_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, } len = org->start - bc->offset; for (i=0; ifill); /* XXX: handle more than 8 bit? */ return 0; } yasm_bytecode * -yasm_bc_create_org(unsigned long start, unsigned long line) +yasm_bc_create_org(unsigned long start, unsigned long fill, unsigned long line) { bytecode_org *org = yasm_xmalloc(sizeof(bytecode_org)); org->start = start; + org->fill = fill; return yasm_bc_create_common(&bc_org_callback, org, line); } diff --git a/libyasm/bc-reserve.c b/libyasm/bc-reserve.c index 9acde378..197175b4 100644 --- a/libyasm/bc-reserve.c +++ b/libyasm/bc-reserve.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -38,9 +36,6 @@ #include "bytecode.h" -#include "bc-int.h" -#include "expr-int.h" - typedef struct bytecode_reserve { /*@only@*/ /*@null@*/ yasm_expr *numitems; /* number of items to reserve */ @@ -50,10 +45,12 @@ typedef struct bytecode_reserve { static void bc_reserve_destroy(void *contents); static void bc_reserve_print(const void *contents, FILE *f, int indent_level); static void bc_reserve_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); +static int bc_reserve_elem_size(yasm_bytecode *bc); static int bc_reserve_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); -static int bc_reserve_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +static int bc_reserve_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -61,6 +58,7 @@ static const yasm_bytecode_callback bc_reserve_callback = { bc_reserve_destroy, bc_reserve_print, bc_reserve_finalize, + bc_reserve_elem_size, bc_reserve_calc_len, yasm_bc_expand_common, bc_reserve_tobytes, @@ -99,6 +97,13 @@ bc_reserve_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc) reserve->numitems = NULL; } +static int +bc_reserve_elem_size(yasm_bytecode *bc) +{ + bytecode_reserve *reserve = (bytecode_reserve *)bc->contents; + return reserve->itemsize; +} + static int bc_reserve_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data) @@ -109,7 +114,8 @@ bc_reserve_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -bc_reserve_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +bc_reserve_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { diff --git a/libyasm/bitvect.c b/libyasm/bitvect.c index dad4826b..b6570ea3 100644 --- a/libyasm/bitvect.c +++ b/libyasm/bitvect.c @@ -1,6 +1,4 @@ -#define YASM_LIB_INTERNAL #include "util.h" -RCSID("$Id$"); #include "coretype.h" @@ -10,10 +8,8 @@ RCSID("$Id$"); /* MODULE IMPORTS: */ /*****************************************************************************/ #include /* MODULE TYPE: (sys) */ -#ifdef STDC_HEADERS #include /* MODULE TYPE: (sys) */ #include /* MODULE TYPE: (sys) */ -#endif /*****************************************************************************/ /* MODULE INTERFACE: */ /*****************************************************************************/ @@ -461,7 +457,7 @@ void BitVector_Destroy_List(listptr list, N_int count) /* free list */ { BitVector_Destroy(*slot++); } - free((voidptr) list); + yasm_xfree((voidptr) list); } } @@ -500,7 +496,7 @@ listptr BitVector_Create_List(N_int bits, boolean clear, N_int count) if (count > 0) { - list = (listptr) malloc(sizeof(wordptr) * count); + list = (listptr) yasm_xmalloc(sizeof(wordptr) * count); if (list != NULL) { slot = list; @@ -1514,7 +1510,9 @@ ErrCode BitVector_from_Hex(wordptr addr, charptr string) digit = (int) *(--string); length--; /* separate because toupper() is likely a macro! */ digit = toupper(digit); - if ((ok = (isxdigit(digit) != 0))) + if (digit == '_') + count -= 4; + else if ((ok = (isxdigit(digit) != 0))) { if (digit >= (int) 'A') digit -= (int) 'A' - 10; else digit -= (int) '0'; @@ -1551,7 +1549,9 @@ ErrCode BitVector_from_Oct(wordptr addr, charptr string) for ( count = count_fill; (ok and (length > 0) and (count < BITS)); count += 3 ) { digit = (int) *(--string); length--; - if ((ok = (isdigit(digit) && digit != '8' && digit != '9')) != 0) + if (digit == '_') + count -= 3; + else if ((ok = (isdigit(digit) && digit != '8' && digit != '9')) != 0) { digit -= (int) '0'; value |= (((N_word) digit) << count); @@ -1631,6 +1631,9 @@ ErrCode BitVector_from_Bin(wordptr addr, charptr string) case (int) '1': value |= BITMASKTAB[count]; break; + case (int) '_': + count--; + break; default: ok = FALSE; break; diff --git a/libyasm/bitvect.h b/libyasm/bitvect.h index e2a10238..a13470ad 100644 --- a/libyasm/bitvect.h +++ b/libyasm/bitvect.h @@ -1,5 +1,3 @@ -/* $Id$ */ - #ifndef YASM_BITVECT_H #define YASM_BITVECT_H /*****************************************************************************/ @@ -15,6 +13,9 @@ /* and your own application(s) which might - directly or indirectly - */ /* include this definitions file. */ /*****************************************************************************/ +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif typedef unsigned char N_char; typedef unsigned char N_byte; @@ -82,7 +83,11 @@ typedef Z_longword *Z_longwordptr; #ifdef MACOS_TRADITIONAL #define boolean Boolean #else - typedef enum boolean { false = FALSE, true = TRUE } boolean; + #if __STDC_VERSION__ < 202311L + typedef enum boolean { false = FALSE, true = TRUE } boolean; + #else + typedef bool boolean; + #endif #endif #endif @@ -117,213 +122,318 @@ typedef wordptr *listptr; /* ===> MISCELLANEOUS BASIC FUNCTIONS: <=== */ +YASM_LIB_DECL const char * BitVector_Error (ErrCode error); /* return string for err code */ +YASM_LIB_DECL ErrCode BitVector_Boot (void); /* 0 = ok, 1..7 = error */ +YASM_LIB_DECL void BitVector_Shutdown (void); /* undo Boot */ +YASM_LIB_DECL N_word BitVector_Size (N_int bits); /* bit vector size (# of words) */ +YASM_LIB_DECL N_word BitVector_Mask (N_int bits); /* bit vector mask (unused bits) */ /* ===> CLASS METHODS: <=== */ +YASM_LIB_DECL const char * BitVector_Version (void); /* returns version string */ +YASM_LIB_DECL N_int BitVector_Word_Bits (void); /* return # of bits in machine word */ +YASM_LIB_DECL N_int BitVector_Long_Bits (void); /* return # of bits in unsigned long */ /* ===> CONSTRUCTOR METHODS: <=== */ +YASM_LIB_DECL /*@only@*/ wordptr BitVector_Create (N_int bits, boolean clear); /* malloc */ +YASM_LIB_DECL listptr BitVector_Create_List(N_int bits, boolean clear, N_int count); +YASM_LIB_DECL wordptr BitVector_Resize (wordptr oldaddr, N_int bits); /* realloc */ +YASM_LIB_DECL wordptr BitVector_Shadow (wordptr addr); /* make new same size but empty */ +YASM_LIB_DECL wordptr BitVector_Clone (wordptr addr); /* make exact duplicate */ +YASM_LIB_DECL wordptr BitVector_Concat (wordptr X, wordptr Y); /* return concatenation */ /* ===> DESTRUCTOR METHODS: <=== */ +YASM_LIB_DECL void BitVector_Dispose (/*@only@*/ /*@out@*/ charptr string); /* string */ +YASM_LIB_DECL void BitVector_Destroy (/*@only@*/ wordptr addr); /* bitvec */ +YASM_LIB_DECL void BitVector_Destroy_List (listptr list, N_int count); /* list */ /* ===> OBJECT METHODS: <=== */ /* ===> bit vector copy function: */ +YASM_LIB_DECL void BitVector_Copy (wordptr X, wordptr Y); /* X = Y */ /* ===> bit vector initialization: */ +YASM_LIB_DECL void BitVector_Empty (wordptr addr); /* X = {} */ +YASM_LIB_DECL void BitVector_Fill (wordptr addr); /* X = ~{} */ +YASM_LIB_DECL void BitVector_Flip (wordptr addr); /* X = ~X */ +YASM_LIB_DECL void BitVector_Primes (wordptr addr); /* ===> miscellaneous functions: */ +YASM_LIB_DECL void BitVector_Reverse (wordptr X, wordptr Y); /* ===> bit vector interval operations and functions: */ +YASM_LIB_DECL void BitVector_Interval_Empty (/*@out@*/ wordptr addr, N_int lower, N_int upper); +YASM_LIB_DECL void BitVector_Interval_Fill (/*@out@*/ wordptr addr, N_int lower, N_int upper); +YASM_LIB_DECL void BitVector_Interval_Flip (/*@out@*/ wordptr addr, N_int lower, N_int upper); +YASM_LIB_DECL void BitVector_Interval_Reverse (/*@out@*/ wordptr addr, N_int lower, N_int upper); +YASM_LIB_DECL boolean BitVector_interval_scan_inc (wordptr addr, N_int start, N_intptr min, N_intptr max); +YASM_LIB_DECL boolean BitVector_interval_scan_dec (wordptr addr, N_int start, N_intptr min, N_intptr max); +YASM_LIB_DECL void BitVector_Interval_Copy (/*@out@*/ wordptr X, wordptr Y, N_int Xoffset, N_int Yoffset, N_int length); +YASM_LIB_DECL wordptr BitVector_Interval_Substitute(/*@out@*/ wordptr X, wordptr Y, N_int Xoffset, N_int Xlength, N_int Yoffset, N_int Ylength); /* ===> bit vector test functions: */ +YASM_LIB_DECL boolean BitVector_is_empty (wordptr addr); /* X == {} ? */ +YASM_LIB_DECL boolean BitVector_is_full (wordptr addr); /* X == ~{} ? */ +YASM_LIB_DECL boolean BitVector_equal (wordptr X, wordptr Y); /* X == Y ? */ +YASM_LIB_DECL Z_int BitVector_Lexicompare(wordptr X, wordptr Y); /* X <,=,> Y ? */ +YASM_LIB_DECL Z_int BitVector_Compare (wordptr X, wordptr Y); /* X <,=,> Y ? */ /* ===> bit vector string conversion functions: */ +YASM_LIB_DECL /*@only@*/ charptr BitVector_to_Hex (wordptr addr); +YASM_LIB_DECL ErrCode BitVector_from_Hex (/*@out@*/wordptr addr, charptr string); +YASM_LIB_DECL ErrCode BitVector_from_Oct(/*@out@*/ wordptr addr, charptr string); +YASM_LIB_DECL /*@only@*/ charptr BitVector_to_Bin (wordptr addr); +YASM_LIB_DECL ErrCode BitVector_from_Bin (/*@out@*/ wordptr addr, charptr string); +YASM_LIB_DECL /*@only@*/ charptr BitVector_to_Dec (wordptr addr); +YASM_LIB_DECL ErrCode BitVector_from_Dec (/*@out@*/ wordptr addr, charptr string); typedef struct BitVector_from_Dec_static_data BitVector_from_Dec_static_data; +YASM_LIB_DECL BitVector_from_Dec_static_data *BitVector_from_Dec_static_Boot(N_word bits); +YASM_LIB_DECL void BitVector_from_Dec_static_Shutdown(/*@null@*/ BitVector_from_Dec_static_data *data); +YASM_LIB_DECL ErrCode BitVector_from_Dec_static(BitVector_from_Dec_static_data *data, /*@out@*/ wordptr addr, charptr string); +YASM_LIB_DECL /*@only@*/ charptr BitVector_to_Enum (wordptr addr); +YASM_LIB_DECL ErrCode BitVector_from_Enum (/*@out@*/ wordptr addr, charptr string); /* ===> bit vector bit operations, functions & tests: */ +YASM_LIB_DECL void BitVector_Bit_Off (/*@out@*/ wordptr addr, N_int indx); /* X = X \ {x} */ +YASM_LIB_DECL void BitVector_Bit_On (/*@out@*/ wordptr addr, N_int indx); /* X = X + {x} */ +YASM_LIB_DECL boolean BitVector_bit_flip (/*@out@*/ wordptr addr, N_int indx); /* (X+{x})\(X*{x}) */ +YASM_LIB_DECL boolean BitVector_bit_test (wordptr addr, N_int indx); /* {x} in X ? */ +YASM_LIB_DECL void BitVector_Bit_Copy (/*@out@*/ wordptr addr, N_int indx, boolean bit); /* ===> bit vector bit shift & rotate functions: */ +YASM_LIB_DECL void BitVector_LSB (/*@out@*/ wordptr addr, boolean bit); +YASM_LIB_DECL void BitVector_MSB (/*@out@*/ wordptr addr, boolean bit); +YASM_LIB_DECL boolean BitVector_lsb_ (wordptr addr); +YASM_LIB_DECL boolean BitVector_msb_ (wordptr addr); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_rotate_left (wordptr addr); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_rotate_right (wordptr addr); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_shift_left (wordptr addr, boolean carry_in); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_shift_right (wordptr addr, boolean carry_in); +YASM_LIB_DECL void BitVector_Move_Left (wordptr addr, N_int bits); +YASM_LIB_DECL void BitVector_Move_Right (wordptr addr, N_int bits); /* ===> bit vector insert/delete bits: */ +YASM_LIB_DECL void BitVector_Insert (wordptr addr, N_int offset, N_int count, boolean clear); +YASM_LIB_DECL void BitVector_Delete (wordptr addr, N_int offset, N_int count, boolean clear); /* ===> bit vector arithmetic: */ +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_increment (wordptr addr); /* X++ */ +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_decrement (wordptr addr); /* X-- */ +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_compute (wordptr X, wordptr Y, wordptr Z, boolean minus, boolean *carry); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_add (wordptr X, wordptr Y, wordptr Z, boolean *carry); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_sub (wordptr X, wordptr Y, wordptr Z, boolean *carry); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_inc (wordptr X, wordptr Y); +YASM_LIB_DECL boolean /*@alt void@*/ BitVector_dec (wordptr X, wordptr Y); +YASM_LIB_DECL void BitVector_Negate (wordptr X, wordptr Y); +YASM_LIB_DECL void BitVector_Absolute (wordptr X, wordptr Y); +YASM_LIB_DECL Z_int BitVector_Sign (wordptr addr); +YASM_LIB_DECL ErrCode BitVector_Mul_Pos (wordptr X, wordptr Y, wordptr Z, boolean strict); +YASM_LIB_DECL ErrCode BitVector_Multiply (wordptr X, wordptr Y, wordptr Z); +YASM_LIB_DECL ErrCode BitVector_Div_Pos (wordptr Q, wordptr X, wordptr Y, wordptr R); +YASM_LIB_DECL ErrCode BitVector_Divide (wordptr Q, wordptr X, wordptr Y, wordptr R); +YASM_LIB_DECL ErrCode BitVector_GCD (wordptr X, wordptr Y, wordptr Z); +YASM_LIB_DECL ErrCode BitVector_GCD2 (wordptr U, wordptr V, wordptr W, /* O */ wordptr X, wordptr Y); /* I */ +YASM_LIB_DECL ErrCode BitVector_Power (wordptr X, wordptr Y, wordptr Z); /* ===> direct memory access functions: */ +YASM_LIB_DECL void BitVector_Block_Store(wordptr addr, charptr buffer, N_int length); +YASM_LIB_DECL charptr BitVector_Block_Read (wordptr addr, /*@out@*/ N_intptr length); /* ===> word array functions: */ +YASM_LIB_DECL void BitVector_Word_Store (wordptr addr, N_int offset, N_int value); +YASM_LIB_DECL N_int BitVector_Word_Read (wordptr addr, N_int offset); +YASM_LIB_DECL void BitVector_Word_Insert(wordptr addr, N_int offset, N_int count, boolean clear); +YASM_LIB_DECL void BitVector_Word_Delete(wordptr addr, N_int offset, N_int count, boolean clear); /* ===> arbitrary size chunk functions: */ +YASM_LIB_DECL void BitVector_Chunk_Store(wordptr addr, N_int chunksize, N_int offset, N_long value); +YASM_LIB_DECL N_long BitVector_Chunk_Read (wordptr addr, N_int chunksize, N_int offset); /* ===> set operations: */ +YASM_LIB_DECL void Set_Union (wordptr X, wordptr Y, wordptr Z); /* X = Y + Z */ +YASM_LIB_DECL void Set_Intersection (wordptr X, wordptr Y, wordptr Z); /* X = Y * Z */ +YASM_LIB_DECL void Set_Difference (wordptr X, wordptr Y, wordptr Z); /* X = Y \ Z */ +YASM_LIB_DECL void Set_ExclusiveOr (wordptr X, wordptr Y, wordptr Z); /*(Y+Z)\(Y*Z)*/ +YASM_LIB_DECL void Set_Complement (wordptr X, wordptr Y); /* X = ~Y */ /* ===> set functions: */ +YASM_LIB_DECL boolean Set_subset (wordptr X, wordptr Y); /* X in Y ? */ +YASM_LIB_DECL N_int Set_Norm (wordptr addr); /* = | X | */ +YASM_LIB_DECL N_int Set_Norm2 (wordptr addr); /* = | X | */ +YASM_LIB_DECL N_int Set_Norm3 (wordptr addr); /* = | X | */ +YASM_LIB_DECL Z_long Set_Min (wordptr addr); /* = min(X) */ +YASM_LIB_DECL Z_long Set_Max (wordptr addr); /* = max(X) */ /* ===> matrix-of-booleans operations: */ +YASM_LIB_DECL void Matrix_Multiplication(wordptr X, N_int rowsX, N_int colsX, wordptr Y, N_int rowsY, N_int colsY, wordptr Z, N_int rowsZ, N_int colsZ); +YASM_LIB_DECL void Matrix_Product (wordptr X, N_int rowsX, N_int colsX, wordptr Y, N_int rowsY, N_int colsY, wordptr Z, N_int rowsZ, N_int colsZ); +YASM_LIB_DECL void Matrix_Closure (wordptr addr, N_int rows, N_int cols); +YASM_LIB_DECL void Matrix_Transpose (wordptr X, N_int rowsX, N_int colsX, wordptr Y, N_int rowsY, N_int colsY); diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index 41fe3ca2..f864bae0 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -39,9 +37,6 @@ #include "bytecode.h" -#include "bc-int.h" -#include "expr-int.h" - void yasm_bc_set_multiple(yasm_bytecode *bc, yasm_expr *e) @@ -58,6 +53,15 @@ yasm_bc_finalize_common(yasm_bytecode *bc, yasm_bytecode *prev_bc) { } +int +yasm_bc_calc_len_common(yasm_bytecode *bc, yasm_bc_add_span_func add_span, + void *add_span_data) +{ + yasm_internal_error(N_("bytecode length cannot be calculated")); + /*@unreached@*/ + return 0; +} + int yasm_bc_expand_common(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres) @@ -67,6 +71,17 @@ yasm_bc_expand_common(yasm_bytecode *bc, int span, long old_val, long new_val, return 0; } +int +yasm_bc_tobytes_common(yasm_bytecode *bc, unsigned char **buf, + unsigned char *bufstart, void *d, + yasm_output_value_func output_value, + /*@null@*/ yasm_output_reloc_func output_reloc) +{ + yasm_internal_error(N_("bytecode cannot be converted to bytes")); + /*@unreached@*/ + return 0; +} + void yasm_bc_transform(yasm_bytecode *bc, const yasm_bytecode_callback *callback, void *contents) @@ -207,6 +222,18 @@ yasm_bc_next_offset(yasm_bytecode *precbc) return precbc->offset + precbc->len*precbc->mult_int; } +int +yasm_bc_elem_size(yasm_bytecode *bc) +{ + if (!bc->callback) { + yasm_internal_error(N_("got empty bytecode in yasm_bc_elem_size")); + return 0; + } else if (!bc->callback->elem_size) + return 0; + else + return bc->callback->elem_size(bc); +} + int yasm_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data) @@ -278,14 +305,17 @@ yasm_bc_tobytes(yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize, /*@sets *buf@*/ { /*@only@*/ /*@null@*/ unsigned char *mybuf = NULL; + unsigned char *bufstart; unsigned char *origbuf, *destbuf; long i; int error = 0; - if (yasm_bc_get_multiple(bc, &bc->mult_int, 1) || bc->mult_int == 0) { + long mult; + if (yasm_bc_get_multiple(bc, &mult, 1) || mult == 0) { *bufsize = 0; return NULL; } + bc->mult_int = mult; /* special case for reserve bytecodes */ if (bc->callback->special == YASM_BC_SPECIAL_RESERVE) { @@ -300,6 +330,7 @@ yasm_bc_tobytes(yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize, destbuf = mybuf; } else destbuf = buf; + bufstart = destbuf; *bufsize = bc->len*bc->mult_int; @@ -307,7 +338,7 @@ yasm_bc_tobytes(yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize, yasm_internal_error(N_("got empty bytecode in bc_tobytes")); else for (i=0; imult_int; i++) { origbuf = destbuf; - error = bc->callback->tobytes(bc, &destbuf, d, output_value, + error = bc->callback->tobytes(bc, &destbuf, bufstart, d, output_value, output_reloc); if (!error && ((unsigned long)(destbuf - origbuf) != bc->len)) @@ -345,3 +376,11 @@ yasm_bc_get_multiple_expr(const yasm_bytecode *bc) { return bc->multiple; } + +yasm_insn * +yasm_bc_get_insn(yasm_bytecode *bc) +{ + if (bc->callback->special != YASM_BC_SPECIAL_INSN) + return NULL; + return (yasm_insn *)bc->contents; +} diff --git a/libyasm/bytecode.h b/libyasm/bytecode.h index 86c3c7e5..47cd2624 100644 --- a/libyasm/bytecode.h +++ b/libyasm/bytecode.h @@ -2,10 +2,6 @@ * \file libyasm/bytecode.h * \brief YASM bytecode interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,106 +30,261 @@ #ifndef YASM_BYTECODE_H #define YASM_BYTECODE_H -/** An effective address. */ -typedef struct yasm_effaddr yasm_effaddr; - -/** Callbacks for effective address implementations. */ -typedef struct yasm_effaddr_callback { - /** Destroy the effective address (freeing it). - * \param ea effective address - */ - void (*destroy) (/*@only@*/ yasm_effaddr *ea); - - /** Print the effective address. - * \param ea effective address - * \param f file to output to - * \param indent_level indentation level - */ - void (*print) (const yasm_effaddr *ea, FILE *f, int indent_level); -} yasm_effaddr_callback; - -/** An effective address. */ -struct yasm_effaddr { - const yasm_effaddr_callback *callback; /**< callback functions */ - - yasm_value disp; /**< address displacement */ - - uintptr_t segreg; /**< segment register override (0 if none) */ - - unsigned char need_nonzero_len; /**< 1 if length of disp must be >0. */ - unsigned char need_disp; /**< 1 if a displacement should be present - * in the output. - */ - unsigned char nosplit; /**< 1 if reg*2 should not be split into - * reg+reg. (0 if not) - */ - unsigned char strong; /**< 1 if effective address is *definitely* - * an effective address, e.g. in GAS if - * expr(,1) form is used vs. just expr. - */ -}; +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif /** A data value (opaque type). */ typedef struct yasm_dataval yasm_dataval; -/** A list of data values (opaque type). */ +/** A list of data values. */ typedef struct yasm_datavalhead yasm_datavalhead; -#ifdef YASM_LIB_INTERNAL +/** Linked list of data values. */ /*@reldef@*/ STAILQ_HEAD(yasm_datavalhead, yasm_dataval); -#endif -/** Get the displacement portion of an effective address. - * \param ea effective address - * \return Expression representing the displacement (read-only). +/** Add a dependent span for a bytecode. + * \param add_span_data add_span_data passed into bc_calc_len() + * \param bc bytecode containing span + * \param id non-zero identifier for span; may be any non-zero value + * if <0, expand is called for any change; + * if >0, expand is only called when exceeds threshold + * \param value dependent value for bytecode expansion + * \param neg_thres negative threshold for long/short decision + * \param pos_thres positive threshold for long/short decision */ -/*@observer@*/ const yasm_expr *yasm_ea_get_disp(const yasm_effaddr *ea); +typedef void (*yasm_bc_add_span_func) + (void *add_span_data, yasm_bytecode *bc, int id, const yasm_value *value, + long neg_thres, long pos_thres); -/** Set the length of the displacement portion of an effective address. - * The length is specified in bits. - * \param ea effective address - * \param len length in bits +/** Bytecode callback structure. Any implementation of a specific bytecode + * must implement these functions and this callback structure. The bytecode + * implementation-specific data is stored in #yasm_bytecode.contents. */ -void yasm_ea_set_len(yasm_effaddr *ea, unsigned int len); +typedef struct yasm_bytecode_callback { + /** Destroys the implementation-specific data. + * Called from yasm_bc_destroy(). + * \param contents #yasm_bytecode.contents + */ + void (*destroy) (/*@only@*/ void *contents); -/** Set/clear nosplit flag of an effective address. - * The nosplit flag indicates (for architectures that support complex effective - * addresses such as x86) if various types of complex effective addresses can - * be split into different forms in order to minimize instruction length. - * \param ea effective address - * \param nosplit nosplit flag setting (0=splits allowed, nonzero=splits - * not allowed) - */ -void yasm_ea_set_nosplit(yasm_effaddr *ea, unsigned int nosplit); + /** Prints the implementation-specific data (for debugging purposes). + * Called from yasm_bc_print(). + * \param contents #yasm_bytecode.contents + * \param f file + * \param indent_level indentation level + */ + void (*print) (const void *contents, FILE *f, int indent_level); -/** Set/clear strong flag of an effective address. - * The strong flag indicates if an effective address is *definitely* an - * effective address. This is used in e.g. the GAS parser to differentiate - * between "expr" (which might or might not be an effective address) and - * "expr(,1)" (which is definitely an effective address). - * \param ea effective address - * \param strong strong flag setting (0=not strong, nonzero=strong) - */ -void yasm_ea_set_strong(yasm_effaddr *ea, unsigned int strong); + /** Finalizes the bytecode after parsing. Called from yasm_bc_finalize(). + * A generic fill-in for this is yasm_bc_finalize_common(). + * \param bc bytecode + * \param prev_bc bytecode directly preceding bc + */ + void (*finalize) (yasm_bytecode *bc, yasm_bytecode *prev_bc); -/** Set segment override for an effective address. - * Some architectures (such as x86) support segment overrides on effective - * addresses. A override of an override will result in a warning. - * \param ea effective address - * \param segreg segment register (0 if none) - */ -void yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg); + /** Return elements size of a data bytecode. + * This function should return the size of each elements of a data + * bytecode, for proper dereference of symbols attached to it. + * \param bc bytecode + * \return 0 if element size is unknown. + */ + int (*elem_size) (yasm_bytecode *bc); -/** Delete (free allocated memory for) an effective address. - * \param ea effective address (only pointer to it). - */ -void yasm_ea_destroy(/*@only@*/ yasm_effaddr *ea); + /** Calculates the minimum size of a bytecode. + * Called from yasm_bc_calc_len(). + * A generic fill-in for this is yasm_bc_calc_len_common(), but as this + * function internal errors when called, be very careful when using it! + * This function should simply add to bc->len and not set it directly + * (it's initialized by yasm_bc_calc_len() prior to passing control to + * this function). + * + * \param bc bytecode + * \param add_span function to call to add a span + * \param add_span_data extra data to be passed to add_span function + * \return 0 if no error occurred, nonzero if there was an error + * recognized (and output) during execution. + * \note May store to bytecode updated expressions. + */ + int (*calc_len) (yasm_bytecode *bc, yasm_bc_add_span_func add_span, + void *add_span_data); -/** Print an effective address. For debugging purposes. - * \param f file - * \param indent_level indentation level - * \param ea effective address + /** Recalculates the bytecode's length based on an expanded span length. + * Called from yasm_bc_expand(). + * A generic fill-in for this is yasm_bc_expand_common(), but as this + * function internal errors when called, if used, ensure that calc_len() + * never adds a span. + * This function should simply add to bc->len to increase the length by + * a delta amount. + * \param bc bytecode + * \param span span ID (as given to add_span in calc_len) + * \param old_val previous span value + * \param new_val new span value + * \param neg_thres negative threshold for long/short decision + * (returned) + * \param pos_thres positive threshold for long/short decision + * (returned) + * \return 0 if bc no longer dependent on this span's length, negative if + * there was an error recognized (and output) during execution, + * and positive if bc size may increase for this span further + * based on the new negative and positive thresholds returned. + * \note May store to bytecode updated expressions. + */ + int (*expand) (yasm_bytecode *bc, int span, long old_val, long new_val, + /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); + + /** Convert a bytecode into its byte representation. + * Called from yasm_bc_tobytes(). + * A generic fill-in for this is yasm_bc_tobytes_common(), but as this + * function internal errors when called, be very careful when using it! + * \param bc bytecode + * \param bufp byte representation destination buffer; + * should be incremented as it's written to, + * so that on return its delta from the + * passed-in buf matches the bytecode length + * (it's okay not to do this if an error + * indication is returned) + * \param bufstart For calculating the correct offset parameter for + * the \a output_value calls: *bufp - bufstart. + * \param d data to pass to each call to + * output_value/output_reloc + * \param output_value function to call to convert values into their byte + * representation + * \param output_reloc function to call to output relocation entries + * for a single sym + * \return Nonzero on error, 0 on success. + * \note May result in non-reversible changes to the bytecode, but it's + * preferable if calling this function twice would result in the + * same output. + */ + int (*tobytes) (yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, + yasm_output_value_func output_value, + /*@null@*/ yasm_output_reloc_func output_reloc); + + /** Special bytecode classifications. Most bytecode types should use + * #YASM_BC_SPECIAL_NONE. Others cause special handling to kick in + * in various parts of yasm. + */ + enum yasm_bytecode_special_type { + YASM_BC_SPECIAL_NONE = 0, + + /** Bytecode reserves space instead of outputting data. */ + YASM_BC_SPECIAL_RESERVE, + + /** Adjusts offset instead of calculating len. */ + YASM_BC_SPECIAL_OFFSET, + + /** Instruction bytecode. */ + YASM_BC_SPECIAL_INSN + } special; +} yasm_bytecode_callback; + +/** A bytecode. */ +struct yasm_bytecode { + /** Bytecodes are stored as a singly linked list, with tail insertion. + * \see section.h (#yasm_section). + */ + /*@reldef@*/ STAILQ_ENTRY(yasm_bytecode) link; + + /** The bytecode callback structure for this bytecode. May be NULL + * during partial initialization. + */ + /*@null@*/ const yasm_bytecode_callback *callback; + + /** Pointer to section containing bytecode; NULL if not part of a + * section. + */ + /*@dependent@*/ /*@null@*/ yasm_section *section; + + /** Number of times bytecode is repeated. + * NULL=1 (to save space in the common case). + */ + /*@only@*/ /*@null@*/ yasm_expr *multiple; + + /** Total length of entire bytecode (not including multiple copies). */ + unsigned long len; + + /** Number of copies, integer version. */ + long mult_int; + + /** Line number where bytecode was defined. */ + unsigned long line; + + /** Offset of bytecode from beginning of its section. + * 0-based, ~0UL (e.g. all 1 bits) if unknown. + */ + unsigned long offset; + + /** Unique integer index of bytecode. Used during optimization. */ + unsigned long bc_index; + + /** NULL-terminated array of labels that point to this bytecode (as the + * bytecode previous to the label). NULL if no labels point here. + */ + /*@null@*/ yasm_symrec **symrecs; + + /** Implementation-specific data (type identified by callback). */ + void *contents; +}; + +/** Create a bytecode of any specified type. + * \param callback bytecode callback functions, if NULL, creates empty + * bytecode (may not be resolved or output) + * \param contents type-specific data + * \param line virtual line (from yasm_linemap) + * \return Newly allocated bytecode of the specified type. */ -void yasm_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level); +YASM_LIB_DECL +/*@only@*/ yasm_bytecode *yasm_bc_create_common + (/*@null@*/ const yasm_bytecode_callback *callback, + /*@only@*/ /*@null@*/ void *contents, unsigned long line); + +/** Transform a bytecode of any type into a different type. + * \param bc bytecode to transform + * \param callback new bytecode callback function + * \param contents new type-specific data + */ +YASM_LIB_DECL +void yasm_bc_transform(yasm_bytecode *bc, + const yasm_bytecode_callback *callback, + void *contents); + +/** Common bytecode callback finalize function, for where no finalization + * is ever required for this type of bytecode. + */ +YASM_LIB_DECL +void yasm_bc_finalize_common(yasm_bytecode *bc, yasm_bytecode *prev_bc); + +/** Common bytecode callback calc_len function, for where the bytecode has + * no calculatable length. Causes an internal error if called. + */ +YASM_LIB_DECL +int yasm_bc_calc_len_common(yasm_bytecode *bc, yasm_bc_add_span_func add_span, + void *add_span_data); + +/** Common bytecode callback expand function, for where the bytecode is + * always short (calc_len never calls add_span). Causes an internal + * error if called. + */ +YASM_LIB_DECL +int yasm_bc_expand_common + (yasm_bytecode *bc, int span, long old_val, long new_val, + /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); + +/** Common bytecode callback tobytes function, for where the bytecode + * cannot be converted to bytes. Causes an internal error if called. + */ +YASM_LIB_DECL +int yasm_bc_tobytes_common + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, + yasm_output_value_func output_value, + /*@null@*/ yasm_output_reloc_func output_reloc); + +/** Get the next bytecode in a linked list of bytecodes. + * \param bc bytecode + * \return Next bytecode. + */ +#define yasm_bc__next(bc) STAILQ_NEXT(bc, link) /** Set multiple field of a bytecode. * A bytecode can be repeated a number of times when output. This function @@ -141,6 +292,7 @@ void yasm_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level); * \param bc bytecode * \param e multiple (kept, do not free) */ +YASM_LIB_DECL void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); /** Create a bytecode containing data value(s). @@ -153,6 +305,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); * \param line virtual line (from yasm_linemap) * \return Newly allocated bytecode. */ +YASM_LIB_DECL /*@only@*/ yasm_bytecode *yasm_bc_create_data (yasm_datavalhead *datahead, unsigned int size, int append_zero, /*@null@*/ yasm_arch *arch, unsigned long line); @@ -163,6 +316,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); * \param line virtual line (from yasm_linemap) * \return Newly allocated bytecode. */ +YASM_LIB_DECL /*@only@*/ yasm_bytecode *yasm_bc_create_leb128 (yasm_datavalhead *datahead, int sign, unsigned long line); @@ -172,6 +326,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); * \param line virtual line (from yasm_linemap) * \return Newly allocated bytecode. */ +YASM_LIB_DECL /*@only@*/ yasm_bytecode *yasm_bc_create_reserve (/*@only@*/ yasm_expr *numitems, unsigned int itemsize, unsigned long line); @@ -183,6 +338,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); * \return NULL if bc is not a reserve bytecode, otherwise an expression * for the number of items to reserve. */ +YASM_LIB_DECL /*@null@*/ const yasm_expr *yasm_bc_reserve_numitems (yasm_bytecode *bc, /*@out@*/ unsigned int *itemsize); @@ -196,6 +352,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); * \param line virtual line (from yasm_linemap) for the bytecode * \return Newly allocated bytecode. */ +YASM_LIB_DECL /*@only@*/ yasm_bytecode *yasm_bc_create_incbin (/*@only@*/ char *filename, /*@only@*/ /*@null@*/ yasm_expr *start, /*@only@*/ /*@null@*/ yasm_expr *maxlen, yasm_linemap *linemap, @@ -213,6 +370,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); * - from code_fill parameter (if not NULL) * - 0 */ +YASM_LIB_DECL /*@only@*/ yasm_bytecode *yasm_bc_create_align (/*@keep@*/ yasm_expr *boundary, /*@keep@*/ /*@null@*/ yasm_expr *fill, /*@keep@*/ /*@null@*/ yasm_expr *maxskip, @@ -221,68 +379,35 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); /** Create a bytecode that puts the following bytecode at a fixed section * offset. * \param start section offset of following bytecode + * \param fill fill value * \param line virtual line (from yasm_linemap) * \return Newly allocated bytecode. */ +YASM_LIB_DECL /*@only@*/ yasm_bytecode *yasm_bc_create_org - (unsigned long start, unsigned long line); - -/** Create a bytecode that represents a single instruction. - * \param arch instruction's architecture - * \param insn_data data that identifies the type of instruction - * \param num_operands number of operands - * \param operands instruction operands (may be NULL if no operands) - * \param line virtual line (from yasm_linemap) - * \return Newly allocated bytecode. - * \note Keeps the list of operands; do not call yasm_ops_delete() after - * giving operands to this function. - */ -/*@only@*/ yasm_bytecode *yasm_bc_create_insn - (yasm_arch *arch, const uintptr_t insn_data[4], int num_operands, - /*@null@*/ yasm_insn_operands *operands, unsigned long line); - -/** Create a bytecode that represents a single empty (0 length) instruction. - * This is used for handling solitary prefixes. - * \param arch instruction's architecture - * \param line virtual line (from yasm_linemap) - * \return Newly allocated bytecode. - */ -/*@only@*/ yasm_bytecode *yasm_bc_create_empty_insn(yasm_arch *arch, - unsigned long line); - -/** Associate a prefix with an instruction bytecode. - * \param bc instruction bytecode - * \param prefix_data data the identifies the prefix - */ -void yasm_bc_insn_add_prefix(yasm_bytecode *bc, - const uintptr_t prefix_data[4]); - -/** Associate a segment prefix with an instruction bytecode. - * \param bc instruction bytecode - * \param segreg data the identifies the segment register - */ -void yasm_bc_insn_add_seg_prefix(yasm_bytecode *bc, uintptr_t segreg); + (unsigned long start, unsigned long fill, unsigned long line); /** Get the section that contains a particular bytecode. * \param bc bytecode * \return Section containing bc (can be NULL if bytecode is not part of a * section). */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ yasm_section *yasm_bc_get_section (yasm_bytecode *bc); -#ifdef YASM_LIB_INTERNAL /** Add to the list of symrecs that reference a bytecode. For symrec use * only. * \param bc bytecode * \param sym symbol */ +YASM_LIB_DECL void yasm_bc__add_symrec(yasm_bytecode *bc, /*@dependent@*/ yasm_symrec *sym); -#endif - + /** Delete (free allocated memory for) a bytecode. * \param bc bytecode (only pointer to it); may be NULL */ +YASM_LIB_DECL void yasm_bc_destroy(/*@only@*/ /*@null@*/ yasm_bytecode *bc); /** Print a bytecode. For debugging purposes. @@ -290,12 +415,14 @@ void yasm_bc_destroy(/*@only@*/ /*@null@*/ yasm_bytecode *bc); * \param indent_level indentation level * \param bc bytecode */ +YASM_LIB_DECL void yasm_bc_print(const yasm_bytecode *bc, FILE *f, int indent_level); /** Finalize a bytecode after parsing. * \param bc bytecode * \param prev_bc bytecode directly preceding bc in a list of bytecodes */ +YASM_LIB_DECL void yasm_bc_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); /** Determine the distance between the starting offsets of two bytecodes. @@ -305,6 +432,7 @@ void yasm_bc_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); * the distance was indeterminate. * \warning Only valid /after/ optimization. */ +YASM_LIB_DECL /*@null@*/ /*@only@*/ yasm_intnum *yasm_calc_bc_dist (yasm_bytecode *precbc1, yasm_bytecode *precbc2); @@ -314,21 +442,17 @@ void yasm_bc_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); * \return Offset of the next bytecode in bytes. * \warning Only valid /after/ optimization. */ +YASM_LIB_DECL unsigned long yasm_bc_next_offset(yasm_bytecode *precbc); -/** Add a dependent span for a bytecode. - * \param add_span_data add_span_data passed into bc_calc_len() - * \param bc bytecode containing span - * \param id non-zero identifier for span; may be any non-zero value - * if <0, expand is called for any change; - * if >0, expand is only called when exceeds threshold - * \param value dependent value for bytecode expansion - * \param neg_thres negative threshold for long/short decision - * \param pos_thres positive threshold for long/short decision +/** Return elemens size of a data bytecode. + * Returns the size of each elements of a data bytecode, for proper dereference + * of symbols attached to it. + * \param bc bytecode + * \return 0 if element size is unknown */ -typedef void (*yasm_bc_add_span_func) - (void *add_span_data, yasm_bytecode *bc, int id, const yasm_value *value, - long neg_thres, long pos_thres); +YASM_LIB_DECL +int yasm_bc_elem_size(yasm_bytecode *bc); /** Resolve EQUs in a bytecode and calculate its minimum size. * Generates dependent bytecode spans for cases where, if the length spanned @@ -342,6 +466,7 @@ typedef void (*yasm_bc_add_span_func) * (and output) during execution. * \note May store to bytecode updated expressions and the short length. */ +YASM_LIB_DECL int yasm_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); @@ -352,13 +477,14 @@ int yasm_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, * \param old_val previous span value * \param new_val new span value * \param neg_thres negative threshold for long/short decision (returned) - * \param pos_thres postivie threshold for long/short decision (returned) + * \param pos_thres positive threshold for long/short decision (returned) * \return 0 if bc no longer dependent on this span's length, negative if * there was an error recognized (and output) during execution, and * positive if bc size may increase for this span further based on the * new negative and positive thresholds returned. * \note May store to bytecode updated expressions and the updated length. */ +YASM_LIB_DECL int yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); @@ -382,6 +508,7 @@ int yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, * results on the second call, as calling this function may result in * non-reversible changes to the bytecode. */ +YASM_LIB_DECL /*@null@*/ /*@only@*/ unsigned char *yasm_bc_tobytes (yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize, /*@out@*/ int *gap, void *d, yasm_output_value_func output_value, @@ -395,6 +522,7 @@ int yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, * calculated, 0 if error should be returned in this case * \return 1 on error (set with yasm_error_set), 0 on success. */ +YASM_LIB_DECL int yasm_bc_get_multiple(yasm_bytecode *bc, /*@out@*/ long *multiple, int calc_bc_dist); @@ -402,12 +530,22 @@ int yasm_bc_get_multiple(yasm_bytecode *bc, /*@out@*/ long *multiple, * \param bc bytecode * \return Bytecode multiple, NULL if =1. */ +YASM_LIB_DECL const yasm_expr *yasm_bc_get_multiple_expr(const yasm_bytecode *bc); +/** Get a #yasm_insn structure from an instruction bytecode (if possible). + * \param bc bytecode + * \return Instruction details if bytecode is an instruction bytecode, + * otherwise NULL. + */ +YASM_LIB_DECL +/*@dependent@*/ /*@null@*/ yasm_insn *yasm_bc_get_insn(yasm_bytecode *bc); + /** Create a new data value from an expression. * \param expn expression * \return Newly allocated data value. */ +YASM_LIB_DECL yasm_dataval *yasm_dv_create_expr(/*@keep@*/ yasm_expr *expn); /** Create a new data value from a string. @@ -415,6 +553,7 @@ yasm_dataval *yasm_dv_create_expr(/*@keep@*/ yasm_expr *expn); * \param len length of string * \return Newly allocated data value. */ +YASM_LIB_DECL yasm_dataval *yasm_dv_create_string(/*@keep@*/ char *contents, size_t len); /** Create a new data value from raw bytes data. @@ -422,25 +561,57 @@ yasm_dataval *yasm_dv_create_string(/*@keep@*/ char *contents, size_t len); * \param len length * \return Newly allocated data value. */ +YASM_LIB_DECL yasm_dataval *yasm_dv_create_raw(/*@keep@*/ unsigned char *contents, unsigned long len); +/** Create a new uninitialized data value. + * \return Newly allocated data value. + */ +YASM_LIB_DECL +yasm_dataval *yasm_dv_create_reserve(void); + #ifndef YASM_DOXYGEN #define yasm_dv_create_string(s, l) yasm_dv_create_raw((unsigned char *)(s), \ (unsigned long)(l)) #endif +/** Get the underlying value of a data value. + * \param dv data value + * \return Value, or null if non-value (e.g. string or raw). + */ +YASM_LIB_DECL +yasm_value *yasm_dv_get_value(yasm_dataval *dv); + +/** Set multiple field of a data value. + * A data value can be repeated a number of times when output. This function + * sets that multiple. + * \param dv data value + * \param e multiple (kept, do not free) + */ +YASM_LIB_DECL +void yasm_dv_set_multiple(yasm_dataval *dv, /*@keep@*/ yasm_expr *e); + +/** Get the data value multiple value as an unsigned long integer. + * \param dv data value + * \param multiple multiple value (output) + * \return 1 on error (set with yasm_error_set), 0 on success. + */ +YASM_LIB_DECL +int yasm_dv_get_multiple(yasm_dataval *dv, /*@out@*/ unsigned long *multiple); + /** Initialize a list of data values. * \param headp list of data values */ void yasm_dvs_initialize(yasm_datavalhead *headp); -#ifdef YASM_LIB_INTERNAL +#ifndef YASM_DOXYGEN #define yasm_dvs_initialize(headp) STAILQ_INIT(headp) #endif /** Delete (free allocated memory for) a list of data values. * \param headp list of data values */ +YASM_LIB_DECL void yasm_dvs_delete(yasm_datavalhead *headp); /** Add data value to the end of a list of data values. @@ -452,6 +623,7 @@ void yasm_dvs_delete(yasm_datavalhead *headp); * \return If data value was actually appended (it wasn't NULL), the data * value; otherwise NULL. */ +YASM_LIB_DECL /*@null@*/ yasm_dataval *yasm_dvs_append (yasm_datavalhead *headp, /*@returned@*/ /*@null@*/ yasm_dataval *dv); @@ -460,6 +632,7 @@ void yasm_dvs_delete(yasm_datavalhead *headp); * \param indent_level indentation level * \param headp data value list */ +YASM_LIB_DECL void yasm_dvs_print(const yasm_datavalhead *headp, FILE *f, int indent_level); #endif diff --git a/libyasm/cmake-module.c b/libyasm/cmake-module.c new file mode 100644 index 00000000..0133f902 --- /dev/null +++ b/libyasm/cmake-module.c @@ -0,0 +1,126 @@ +/* + * YASM module loader + * + * Copyright (C) 2004-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#include + + +typedef struct loaded_module { + const char *keyword; /* module keyword */ + void *data; /* associated data */ +} loaded_module; + +static HAMT *loaded_modules[] = {NULL, NULL, NULL, NULL, NULL, NULL}; + +static void +load_module_destroy(/*@only@*/ void *data) +{ + /* do nothing */ +} + +void * +yasm_load_module(yasm_module_type type, const char *keyword) +{ + if (!loaded_modules[type]) + return NULL; + return HAMT_search(loaded_modules[type], keyword); +} + +void +yasm_register_module(yasm_module_type type, const char *keyword, void *data) +{ + int replace = 1; + + assert(type < sizeof(loaded_modules)); + + if (!loaded_modules[type]) + loaded_modules[type] = HAMT_create(1, yasm_internal_error_); + + HAMT_insert(loaded_modules[type], keyword, data, &replace, + load_module_destroy); +} + +typedef struct { + yasm_module_type type; + void (*printfunc) (const char *name, const char *keyword); +} list_one_data; + +static int +yasm_list_one_module(void *node, void *d) +{ + list_one_data *data = (list_one_data *)d; + yasm_arch_module *arch; + yasm_dbgfmt_module *dbgfmt; + yasm_objfmt_module *objfmt; + yasm_listfmt_module *listfmt; + yasm_parser_module *parser; + yasm_preproc_module *preproc; + + switch (data->type) { + case YASM_MODULE_ARCH: + arch = node; + data->printfunc(arch->name, arch->keyword); + break; + case YASM_MODULE_DBGFMT: + dbgfmt = node; + data->printfunc(dbgfmt->name, dbgfmt->keyword); + break; + case YASM_MODULE_OBJFMT: + objfmt = node; + data->printfunc(objfmt->name, objfmt->keyword); + break; + case YASM_MODULE_LISTFMT: + listfmt = node; + data->printfunc(listfmt->name, listfmt->keyword); + break; + case YASM_MODULE_PARSER: + parser = node; + data->printfunc(parser->name, parser->keyword); + break; + case YASM_MODULE_PREPROC: + preproc = node; + data->printfunc(preproc->name, preproc->keyword); + break; + } + return 0; +} + +void +yasm_list_modules(yasm_module_type type, + void (*printfunc) (const char *name, const char *keyword)) +{ + list_one_data data; + + /* Go through available list, and try to load each one */ + if (!loaded_modules[type]) + return; + + data.type = type; + data.printfunc = printfunc; + + HAMT_traverse(loaded_modules[type], &data, yasm_list_one_module); +} diff --git a/libyasm/compat-queue.h b/libyasm/compat-queue.h index e9077be9..da9eff46 100644 --- a/libyasm/compat-queue.h +++ b/libyasm/compat-queue.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * implementation for systems that don't have it. * * Copyright (c) 1991, 1993 diff --git a/libyasm/coretype.h b/libyasm/coretype.h index 3fb4ec1a..624e3c44 100644 --- a/libyasm/coretype.h +++ b/libyasm/coretype.h @@ -2,10 +2,6 @@ * \file libyasm/coretype.h * \brief YASM core types and utility functions. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,6 +30,10 @@ #ifndef YASM_CORETYPE_H #define YASM_CORETYPE_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Architecture instance (mostly opaque type). \see arch.h for details. */ typedef struct yasm_arch yasm_arch; /** Preprocessor interface. \see preproc.h for details. */ @@ -52,6 +52,21 @@ typedef struct yasm_objfmt_module yasm_objfmt_module; /** Debug format module interface. \see dbgfmt.h for details. */ typedef struct yasm_dbgfmt_module yasm_dbgfmt_module; +/** Standard macro structure for modules that allows association of a set of + * standard macros with a parser/preprocessor combination. + * A NULL-terminated array of these structures is used in a number of module + * interfaces. + */ +typedef struct yasm_stdmac { + const char *parser; /**< Parser keyword */ + const char *preproc; /**< Preprocessor keyword */ + + /** NULL-terminated array of standard macros. May be NULL if no standard + * macros should be added for this preprocessor. + */ + const char **macros; +} yasm_stdmac; + /** YASM associated data callback structure. Many data structures can have * arbitrary data associated with them. */ @@ -74,10 +89,7 @@ typedef struct yasm_assoc_data_callback { */ typedef struct yasm_errwarns yasm_errwarns; -/** Bytecode (opaque type). - * \see bytecode.h for related functions. - * Define YASM_BC_INTERNAL to get visible internals. - */ +/** Bytecode. \see bytecode.h for details and related functions. */ typedef struct yasm_bytecode yasm_bytecode; /** Object. \see section.h for details and related functions. */ @@ -92,10 +104,7 @@ typedef struct yasm_symtab yasm_symtab; /** Symbol record (opaque type). \see symrec.h for related functions. */ typedef struct yasm_symrec yasm_symrec; -/** Expression (opaque type). - * \see expr.h for related functions. - * Define YASM_EXPR_INTERNAL to get visible internals. - */ +/** Expression. \see expr.h for details and related functions. */ typedef struct yasm_expr yasm_expr; /** Integer value (opaque type). \see intnum.h for related functions. */ typedef struct yasm_intnum yasm_intnum; @@ -162,6 +171,9 @@ typedef struct yasm_value { */ unsigned int section_rel : 1; + /** Indicates overflow warnings have been disabled for this value. */ + unsigned int no_warn : 1; + /** Sign of the value. Nonzero if the final value should be treated as * signed, 0 if it should be treated as signed. */ @@ -192,11 +204,15 @@ typedef struct yasm_valparamhead yasm_valparamhead; */ typedef struct yasm_directive yasm_directive; -/** A list of instruction operands (opaque type). - * The list goes from left-to-right as parsed. - * \see arch.h for related functions. +/** An effective address. + * \see insn.h for related functions. */ -typedef struct yasm_insn_operands yasm_insn_operands; +typedef struct yasm_effaddr yasm_effaddr; + +/** An instruction. + * \see insn.h for related functions. + */ +typedef struct yasm_insn yasm_insn; /** Expression operators usable in #yasm_expr expressions. */ typedef enum yasm_expr_op { @@ -249,9 +265,7 @@ typedef enum yasm_expr_op { * \param bc current bytecode (usually passed into higher-level * calling function) * \param warn enables standard warnings: zero for none; - * nonzero for overflow/underflow floating point warnings; - * negative for signed integer warnings, - * positive for unsigned integer warnings + * nonzero for overflow/underflow floating point warnings * \param d objfmt-specific data (passed into higher-level calling * function) * \return Nonzero if an error occurred, 0 otherwise. @@ -288,6 +302,7 @@ typedef int (*yasm_output_reloc_func) * \param size size of each array element * \param compar element comparison function */ +YASM_LIB_DECL int yasm__mergesort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); @@ -297,6 +312,7 @@ int yasm__mergesort(void *base, size_t nmemb, size_t size, * \param delim set of 1 or more delimiters * \return First/next substring. */ +YASM_LIB_DECL /*@null@*/ char *yasm__strsep(char **stringp, const char *delim); /** Compare two strings, ignoring case differences. @@ -305,6 +321,7 @@ int yasm__mergesort(void *base, size_t nmemb, size_t size, * \param s2 string 2 * \return 0 if strings are equal, -1 if s1s2. */ +YASM_LIB_DECL int yasm__strcasecmp(const char *s1, const char *s2); /** Compare portion of two strings, ignoring case differences. @@ -314,6 +331,7 @@ int yasm__strcasecmp(const char *s1, const char *s2); * \param n maximum number of characters to compare * \return 0 if strings are equal, -1 if s1s2. */ +YASM_LIB_DECL int yasm__strncasecmp(const char *s1, const char *s2, size_t n); /** strdup() implementation using yasm_xmalloc(). @@ -321,6 +339,7 @@ int yasm__strncasecmp(const char *s1, const char *s2, size_t n); * \param str string * \return Newly allocated duplicate string. */ +YASM_LIB_DECL /*@only@*/ char *yasm__xstrdup(const char *str); /** strndup() implementation using yasm_xmalloc(). @@ -329,6 +348,7 @@ int yasm__strncasecmp(const char *s1, const char *s2, size_t n); * \param max maximum number of characters to copy * \return Newly allocated duplicate string. */ +YASM_LIB_DECL /*@only@*/ char *yasm__xstrndup(const char *str, size_t max); /** Error-checking memory allocation. A default implementation is provided @@ -337,6 +357,7 @@ int yasm__strncasecmp(const char *s1, const char *s2, size_t n); * \param size number of bytes to allocate * \return Allocated memory block. */ +YASM_LIB_DECL extern /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size); /** Error-checking memory allocation (with clear-to-0). A default @@ -346,6 +367,7 @@ extern /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size); * \param elsize size (in bytes) of each element * \return Allocated and cleared memory block. */ +YASM_LIB_DECL extern /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize); /** Error-checking memory reallocation. A default implementation is provided @@ -355,6 +377,7 @@ extern /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize); * \param elsize new size, in bytes * \return Re-allocated memory block. */ +YASM_LIB_DECL extern /*@only@*/ void * (*yasm_xrealloc) (/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size) /*@modifies oldmem@*/; @@ -363,6 +386,7 @@ extern /*@only@*/ void * (*yasm_xrealloc) * that calls yasm_fatal() on allocation errors. * \param p memory block to free */ +YASM_LIB_DECL extern void (*yasm_xfree) (/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/; diff --git a/libyasm/dbgfmt.h b/libyasm/dbgfmt.h index aa0690bd..8e038bbf 100644 --- a/libyasm/dbgfmt.h +++ b/libyasm/dbgfmt.h @@ -2,10 +2,6 @@ * \file libyasm/dbgfmt.h * \brief YASM debug format interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2002-2007 Peter Johnson * diff --git a/libyasm/errwarn.c b/libyasm/errwarn.c index 626ecbee..983e0819 100644 --- a/libyasm/errwarn.c +++ b/libyasm/errwarn.c @@ -24,15 +24,10 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include - -#ifdef STDC_HEADERS -# include -#endif +#include #include "coretype.h" @@ -42,6 +37,10 @@ #define MSG_MAXSIZE 1024 +#if !defined(HAVE_TOASCII) || defined(lint) +# define toascii(c) ((c) & 0x7F) +#endif + /* Default handlers for replacable functions */ static /*@exits@*/ void def_internal_error_ (const char *file, unsigned int line, const char *message); @@ -69,7 +68,7 @@ typedef struct warn { yasm_warn_class wclass; /*@owned@*/ /*@null@*/ char *wstr; } warn; -static STAILQ_HEAD(, warn) yasm_warns; +static STAILQ_HEAD(warn_head, warn) yasm_warns; /* Enabled warnings. See errwarn.h for a list. */ static unsigned long warn_class_enabled; @@ -86,7 +85,7 @@ typedef struct errwarn_data { } errwarn_data; struct yasm_errwarns { - /*@reldef@*/ SLIST_HEAD(, errwarn_data) errwarns; + /*@reldef@*/ SLIST_HEAD(errwarn_head, errwarn_data) errwarns; /* Total error count */ unsigned int ecount; @@ -112,10 +111,11 @@ void yasm_errwarn_initialize(void) { /* Default enabled warnings. See errwarn.h for a list. */ - warn_class_enabled = + warn_class_enabled = (1UL<type == WE_PARSERERROR) { - /* overwrite last error */ + /* overwrite last error */ we = ins_we; } else { /* add a new error */ @@ -492,14 +492,6 @@ yasm_errwarns_output_all(yasm_errwarns *errwarns, yasm_linemap *lm, const char *filename, *xref_filename; unsigned long line, xref_line; - /* If we're treating warnings as errors, tell the user about it. */ - if (warning_as_error && warning_as_error != 2) { - print_error("", 0, - yasm_gettext_hook(N_("warnings being treated as errors")), - NULL, 0, NULL); - warning_as_error = 2; - } - /* Output error/warnings. */ SLIST_FOREACH(we, &errwarns->errwarns, link) { /* Output error/warning */ @@ -514,7 +506,17 @@ yasm_errwarns_output_all(yasm_errwarns *errwarns, yasm_linemap *lm, print_error(filename, line, we->msg, xref_filename, xref_line, we->xrefmsg); else + { print_warning(filename, line, we->msg); + + /* If we're treating warnings as errors, tell the user about it. */ + if (warning_as_error && warning_as_error != 2) { + const char *msg = + yasm_gettext_hook(N_("warnings being treated as errors")); + print_error(filename, line, msg, NULL, 0, NULL); + warning_as_error = 2; + } + } } } diff --git a/libyasm/errwarn.h b/libyasm/errwarn.h index 214f3125..25f68226 100644 --- a/libyasm/errwarn.h +++ b/libyasm/errwarn.h @@ -2,10 +2,6 @@ * \file libyasm/errwarn.h * \brief YASM error and warning reporting interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,6 +30,10 @@ #ifndef YASM_ERRWARN_H #define YASM_ERRWARN_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Warning classes (that may be enabled/disabled). */ typedef enum yasm_warn_class { YASM_WARN_NONE = 0, /**< No warning */ @@ -42,7 +42,9 @@ typedef enum yasm_warn_class { YASM_WARN_PREPROC, /**< Preprocessor warnings */ YASM_WARN_ORPHAN_LABEL, /**< Label alone on a line without a colon */ YASM_WARN_UNINIT_CONTENTS, /**< Uninitialized space in code/data section */ - YASM_WARN_SIZE_OVERRIDE /**< Double size override */ + YASM_WARN_SIZE_OVERRIDE,/**< Double size override */ + YASM_WARN_IMPLICIT_SIZE_OVERRIDE, /**< Implicit size override */ + YASM_WARN_SEGREG_IN_64BIT /**< Segment register ignored in 64-bit mode */ } yasm_warn_class; /** Error classes. Bitmask-based to support limited subclassing. */ @@ -67,11 +69,13 @@ typedef enum yasm_error_class { } yasm_error_class; /** Initialize any internal data structures. */ +YASM_LIB_DECL void yasm_errwarn_initialize(void); /** Clean up any memory allocated by yasm_errwarn_initialize() or other * functions. */ +YASM_LIB_DECL void yasm_errwarn_cleanup(void); /** Reporting point of internal errors. These are usually due to sanity @@ -82,6 +86,7 @@ void yasm_errwarn_cleanup(void); * \param line source line (ala __LINE__) * \param message internal error message */ +YASM_LIB_DECL extern /*@exits@*/ void (*yasm_internal_error_) (const char *file, unsigned int line, const char *message); @@ -98,6 +103,7 @@ extern /*@exits@*/ void (*yasm_internal_error_) * \param message fatal error message * \param va va_list argument list for message */ +YASM_LIB_DECL extern /*@exits@*/ void (*yasm_fatal) (const char *message, va_list va); /** Reporting point of fatal errors, with variable arguments (internal only). @@ -106,11 +112,13 @@ extern /*@exits@*/ void (*yasm_fatal) (const char *message, va_list va); * \param message fatal error message * \param ... argument list for message */ +YASM_LIB_DECL /*@exits@*/ void yasm__fatal(const char *message, ...); /** Unconditionally clear the error indicator, freeing any associated data. * Has no effect if the error indicator is not set. */ +YASM_LIB_DECL void yasm_error_clear(void); /** Get the error indicator. YASM_ERROR_NONE is returned if no error has @@ -127,9 +135,11 @@ yasm_error_class yasm_error_occurred(void); * \return Nonzero if error indicator is set and a subclass of eclass, 0 * otherwise. */ +YASM_LIB_DECL int yasm_error_matches(yasm_error_class eclass); #ifndef YASM_DOXYGEN +YASM_LIB_DECL extern yasm_error_class yasm_eclass; #define yasm_error_occurred() yasm_eclass #endif @@ -140,6 +150,7 @@ extern yasm_error_class yasm_eclass; * \param format printf format string * \param va argument list for format */ +YASM_LIB_DECL void yasm_error_set_va(yasm_error_class eclass, const char *format, va_list va); /** Set the error indicator. Has no effect if the error indicator is already @@ -148,6 +159,7 @@ void yasm_error_set_va(yasm_error_class eclass, const char *format, va_list va); * \param format printf format string * \param ... argument list for format */ +YASM_LIB_DECL void yasm_error_set(yasm_error_class eclass, const char *format, ...) /*@printflike@*/; @@ -158,6 +170,7 @@ void yasm_error_set(yasm_error_class eclass, const char *format, ...) * \param format printf format string * \param va argument list for format */ +YASM_LIB_DECL void yasm_error_set_xref_va(unsigned long xrefline, const char *format, va_list va); @@ -168,6 +181,7 @@ void yasm_error_set_xref_va(unsigned long xrefline, const char *format, * \param format printf format string * \param ... argument list for format */ +YASM_LIB_DECL void yasm_error_set_xref(unsigned long xrefline, const char *format, ...) /*@printflike@*/; @@ -183,6 +197,7 @@ void yasm_error_set_xref(unsigned long xrefline, const char *format, ...) * \param xrefline virtual line used for cross-referencing (0 if no xref) * \param xrefstr cross-reference error message (NULL if no xref) */ +YASM_LIB_DECL void yasm_error_fetch(/*@out@*/ yasm_error_class *eclass, /*@out@*/ /*@only@*/ /*@null@*/ char **str, /*@out@*/ unsigned long *xrefline, @@ -191,6 +206,7 @@ void yasm_error_fetch(/*@out@*/ yasm_error_class *eclass, /** Unconditionally clear all warning indicators, freeing any associated data. * Has no effect if no warning indicators have been set. */ +YASM_LIB_DECL void yasm_warn_clear(void); /** Get the first warning indicator. YASM_WARN_NONE is returned if no warning @@ -198,6 +214,7 @@ void yasm_warn_clear(void); * be treated as a boolean value. * \return First warning indicator. */ +YASM_LIB_DECL yasm_warn_class yasm_warn_occurred(void); /** Add a warning indicator (va_list version). @@ -205,6 +222,7 @@ yasm_warn_class yasm_warn_occurred(void); * \param format printf format string * \param va argument list for format */ +YASM_LIB_DECL void yasm_warn_set_va(yasm_warn_class wclass, const char *format, va_list va); /** Add a warning indicator. @@ -212,6 +230,7 @@ void yasm_warn_set_va(yasm_warn_class wclass, const char *format, va_list va); * \param format printf format string * \param ... argument list for format */ +YASM_LIB_DECL void yasm_warn_set(yasm_warn_class wclass, const char *format, ...) /*@printflike@*/; @@ -225,30 +244,36 @@ void yasm_warn_set(yasm_warn_class wclass, const char *format, ...) * \param wclass warning class (output) * \param str warning message */ +YASM_LIB_DECL void yasm_warn_fetch(/*@out@*/ yasm_warn_class *wclass, /*@out@*/ /*@only@*/ char **str); /** Enable a class of warnings. * \param wclass warning class */ +YASM_LIB_DECL void yasm_warn_enable(yasm_warn_class wclass); /** Disable a class of warnings. * \param wclass warning class */ +YASM_LIB_DECL void yasm_warn_disable(yasm_warn_class wclass); /** Disable all classes of warnings. */ +YASM_LIB_DECL void yasm_warn_disable_all(void); /** Create an error/warning set for collection of multiple error/warnings. * \return Newly allocated set. */ +YASM_LIB_DECL /*@only@*/ yasm_errwarns *yasm_errwarns_create(void); /** Destroy an error/warning set. * \param errwarns error/warning set */ +YASM_LIB_DECL void yasm_errwarns_destroy(/*@only@*/ yasm_errwarns *errwarns); /** Propagate error indicator and warning indicator(s) to an error/warning set. @@ -261,6 +286,7 @@ void yasm_errwarns_destroy(/*@only@*/ yasm_errwarns *errwarns); * \param errwarns error/warning set * \param line virtual line */ +YASM_LIB_DECL void yasm_errwarn_propagate(yasm_errwarns *errwarns, unsigned long line); /** Get total number of errors logged. @@ -268,6 +294,7 @@ void yasm_errwarn_propagate(yasm_errwarns *errwarns, unsigned long line); * \param warning_as_error if nonzero, warnings are treated as errors. * \return Number of errors. */ +YASM_LIB_DECL unsigned int yasm_errwarns_num_errors(yasm_errwarns *errwarns, int warning_as_error); @@ -299,6 +326,7 @@ typedef void (*yasm_print_warning_func) * \param print_error function called to print out errors * \param print_warning function called to print out warnings */ +YASM_LIB_DECL void yasm_errwarns_output_all (yasm_errwarns *errwarns, yasm_linemap *lm, int warning_as_error, yasm_print_error_func print_error, yasm_print_warning_func print_warning); @@ -308,12 +336,14 @@ void yasm_errwarns_output_all * \param ch possibly unprintable character * \return Printable string representation (static buffer). */ +YASM_LIB_DECL char *yasm__conv_unprint(int ch); /** Hook for library users to map to gettext() if GNU gettext is being used. * \param msgid message catalog identifier * \return Translated message. */ +YASM_LIB_DECL extern const char * (*yasm_gettext_hook) (const char *msgid); #endif diff --git a/libyasm/expr-int.h b/libyasm/expr-int.h deleted file mode 100644 index 6946adc5..00000000 --- a/libyasm/expr-int.h +++ /dev/null @@ -1,118 +0,0 @@ -/* $Id$ - * Expressions internal structures header file - * - * Copyright (C) 2001-2007 Peter Johnson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef YASM_EXPR_INT_H -#define YASM_EXPR_INT_H - -/* Types listed in canonical sorting order. See expr_order_terms(). - * Note precbc must be used carefully (in a-b pairs), as only symrecs can - * become the relative term in a #yasm_value. - */ -typedef enum yasm_expr__type { - YASM_EXPR_NONE = 0, - YASM_EXPR_REG = 1<<0, - YASM_EXPR_INT = 1<<1, - YASM_EXPR_SUBST = 1<<2, - YASM_EXPR_FLOAT = 1<<3, - YASM_EXPR_SYM = 1<<4, - YASM_EXPR_PRECBC = 1<<5, /* direct bytecode ref (rather than via symrec) */ - YASM_EXPR_EXPR = 1<<6 -} yasm_expr__type; - -struct yasm_expr__item { - yasm_expr__type type; - union { - yasm_bytecode *precbc; - yasm_symrec *sym; - yasm_expr *expn; - yasm_intnum *intn; - yasm_floatnum *flt; - uintptr_t reg; - unsigned int subst; - } data; -}; - -/* Some operations may allow more than two operand terms: - * ADD, MUL, OR, AND, XOR - */ -struct yasm_expr { - yasm_expr_op op; - unsigned long line; - int numterms; - yasm_expr__item terms[2]; /* structure may be extended to include more */ -}; - -/* Traverse over expression tree in order, calling func for each leaf - * (non-operation). The data pointer d is passed to each func call. - * - * Stops early (and returns 1) if func returns 1. Otherwise returns 0. - */ -int yasm_expr__traverse_leaves_in_const - (const yasm_expr *e, /*@null@*/ void *d, - int (*func) (/*@null@*/ const yasm_expr__item *ei, /*@null@*/ void *d)); -int yasm_expr__traverse_leaves_in - (yasm_expr *e, /*@null@*/ void *d, - int (*func) (/*@null@*/ yasm_expr__item *ei, /*@null@*/ void *d)); - -/* Reorder terms of e into canonical order. Only reorders if reordering - * doesn't change meaning of expression. (eg, doesn't reorder SUB). - * Canonical order: REG, INT, FLOAT, SYM, EXPR. - * Multiple terms of a single type are kept in the same order as in - * the original expression. - * NOTE: Only performs reordering on *one* level (no recursion). - */ -void yasm_expr__order_terms(yasm_expr *e); - -/* Copy entire expression EXCEPT for index "except" at *top level only*. */ -yasm_expr *yasm_expr__copy_except(const yasm_expr *e, int except); - -int yasm_expr__contains(const yasm_expr *e, yasm_expr__type t); - -/** Transform symrec-symrec terms in expression into YASM_EXPR_SUBST items. - * Calls the callback function for each symrec-symrec term. - * \param ep expression (pointer to) - * \param cbd callback data passed to callback function - * \param callback callback function: given subst index for bytecode - * pair, bytecode pair (bc2-bc1), and cbd (callback data) - * \return Number of transformations made. - */ -int yasm_expr__bc_dist_subst(yasm_expr **ep, void *cbd, - void (*callback) (unsigned int subst, - yasm_bytecode *precbc, - yasm_bytecode *precbc2, - void *cbd)); - -/** Substitute items into expr YASM_EXPR_SUBST items (by index). Items are - * copied, so caller is responsible for freeing array of items. - * \param e expression - * \param num_items number of items in items array - * \param items items array - * \return 1 on error (index out of range). - */ -int yasm_expr__subst(yasm_expr *e, unsigned int num_items, - const yasm_expr__item *items); - -#endif diff --git a/libyasm/expr.c b/libyasm/expr.c index e32b4776..09ae1121 100644 --- a/libyasm/expr.c +++ b/libyasm/expr.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -43,9 +41,10 @@ #include "arch.h" -#include "expr-int.h" - +static /*@only@*/ yasm_expr *expr_level_op + (/*@returned@*/ /*@only@*/ yasm_expr *e, int fold_const, + int simplify_ident, int simplify_reg_mul); static int expr_traverse_nodes_post(/*@null@*/ yasm_expr *e, /*@null@*/ void *d, int (*func) (/*@null@*/ yasm_expr *e, @@ -119,7 +118,7 @@ yasm_expr_create(yasm_expr_op op, yasm_expr__item *left, ptr->line = line; - return ptr; + return expr_level_op(ptr, 1, 1, 0); } /*@=compmempass@*/ @@ -420,6 +419,8 @@ expr_xform_neg_helper(/*@returned@*/ /*@only@*/ yasm_expr *e) */ if (e->terms[0].type == YASM_EXPR_FLOAT) yasm_floatnum_calc(e->terms[0].data.flt, YASM_EXPR_NEG, NULL); + else if (e->terms[0].type == YASM_EXPR_INT) + yasm_intnum_calc(e->terms[0].data.intn, YASM_EXPR_NEG, NULL); else if (e->terms[0].type == YASM_EXPR_EXPR && yasm_expr__contains(e->terms[0].data.expn, YASM_EXPR_FLOAT)) expr_xform_neg_helper(e->terms[0].data.expn); @@ -533,7 +534,7 @@ expr_can_destroy_int_right(yasm_expr_op op, yasm_intnum *intn) * NOTE: Really designed to only be used by expr_level_op(). */ static int -expr_simplify_identity(yasm_expr *e, int numterms, int int_term, +expr_simplify_identity(yasm_expr *e, int numterms, int *int_term, int simplify_reg_mul) { int i; @@ -545,26 +546,27 @@ expr_simplify_identity(yasm_expr *e, int numterms, int int_term, save_numterms = e->numterms; e->numterms = numterms; if (simplify_reg_mul || e->op != YASM_EXPR_MUL - || !yasm_intnum_is_pos1(e->terms[int_term].data.intn) + || !yasm_intnum_is_pos1(e->terms[*int_term].data.intn) || !yasm_expr__contains(e, YASM_EXPR_REG)) { /* Check for simple identities that delete the intnum. * Don't delete if the intnum is the only thing in the expn. */ - if ((int_term == 0 && numterms > 1 && + if ((*int_term == 0 && numterms > 1 && expr_can_destroy_int_left(e->op, e->terms[0].data.intn)) || - (int_term > 0 && - expr_can_destroy_int_right(e->op, e->terms[int_term].data.intn))) { + (*int_term > 0 && + expr_can_destroy_int_right(e->op, + e->terms[*int_term].data.intn))) { /* Delete the intnum */ - yasm_intnum_destroy(e->terms[int_term].data.intn); + yasm_intnum_destroy(e->terms[*int_term].data.intn); /* Slide everything to its right over by 1 */ - if (int_term != numterms-1) /* if it wasn't last.. */ - memmove(&e->terms[int_term], &e->terms[int_term+1], - (numterms-1-int_term)*sizeof(yasm_expr__item)); + if (*int_term != numterms-1) /* if it wasn't last.. */ + memmove(&e->terms[*int_term], &e->terms[*int_term+1], + (numterms-1-*int_term)*sizeof(yasm_expr__item)); /* Update numterms */ numterms--; - int_term = -1; /* no longer an int term */ + *int_term = -1; /* no longer an int term */ } } e->numterms = save_numterms; @@ -572,23 +574,23 @@ expr_simplify_identity(yasm_expr *e, int numterms, int int_term, /* Check for simple identites that delete everything BUT the intnum. * Don't bother if the intnum is the only thing in the expn. */ - if (numterms > 1 && int_term != -1 && - expr_is_constant(e->op, e->terms[int_term].data.intn)) { + if (numterms > 1 && *int_term != -1 && + expr_is_constant(e->op, e->terms[*int_term].data.intn)) { /* Loop through, deleting everything but the integer term */ for (i=0; inumterms; i++) - if (i != int_term) + if (i != *int_term) expr_delete_term(&e->terms[i], 1); /* Move integer term to the first term (if not already there) */ - if (int_term != 0) - e->terms[0] = e->terms[int_term]; /* structure copy */ + if (*int_term != 0) + e->terms[0] = e->terms[*int_term]; /* structure copy */ /* Set numterms to 1 */ numterms = 1; } /* Compute NOT, NEG, and LNOT on single intnum. */ - if (numterms == 1 && int_term == 0 && + if (numterms == 1 && *int_term == 0 && (e->op == YASM_EXPR_NOT || e->op == YASM_EXPR_NEG || e->op == YASM_EXPR_LNOT)) yasm_intnum_calc(e->terms[0].data.intn, e->op, NULL); @@ -685,6 +687,7 @@ expr_level_op(/*@returned@*/ /*@only@*/ yasm_expr *e, int fold_const, level_numterms--; /* make sure to delete folded intnum */ yasm_intnum_destroy(e->terms[i].data.intn); + e->terms[i].data.intn = NULL; } else if (o != i) { /* copy term if it changed places */ e->terms[o++] = e->terms[i]; @@ -696,7 +699,7 @@ expr_level_op(/*@returned@*/ /*@only@*/ yasm_expr *e, int fold_const, int new_fold_numterms; /* Simplify identities and make IDENT if possible. */ new_fold_numterms = - expr_simplify_identity(e, fold_numterms, first_int_term, + expr_simplify_identity(e, fold_numterms, &first_int_term, simplify_reg_mul); level_numterms -= fold_numterms-new_fold_numterms; fold_numterms = new_fold_numterms; @@ -739,7 +742,7 @@ expr_level_op(/*@returned@*/ /*@only@*/ yasm_expr *e, int fold_const, * ordering as was present originally. * Combine integer terms as necessary. */ - for (i=e->numterms-1, o=level_numterms-1; i>=0; i--) { + for (i=fold_numterms-1, o=level_numterms-1; i>=0; i--) { if (e->terms[i].type == YASM_EXPR_EXPR && e->terms[i].data.expn->op == e->op) { /* bring up subexpression */ @@ -780,13 +783,14 @@ expr_level_op(/*@returned@*/ /*@only@*/ yasm_expr *e, int fold_const, if (i == first_int_term) first_int_term = o; o--; - } + } else + o--; } /* Simplify identities, make IDENT if possible, and save to e->numterms. */ if (simplify_ident && first_int_term != -1) { e->numterms = expr_simplify_identity(e, level_numterms, - first_int_term, simplify_reg_mul); + &first_int_term, simplify_reg_mul); } else { e->numterms = level_numterms; if (level_numterms == 1) @@ -869,7 +873,8 @@ expr_level_tree(yasm_expr *e, int fold_const, int simplify_ident, e->op = YASM_EXPR_IDENT; e->terms[0].data.expn->op = YASM_EXPR_IDENT; /* Destroy the second (offset) term */ - expr_delete_term(&e->terms[1], 1); + e->terms[0].data.expn->numterms = 1; + expr_delete_term(&e->terms[0].data.expn->terms[1], 1); } /* do callback */ @@ -990,7 +995,10 @@ yasm_expr__copy_except(const yasm_expr *e, int except) { yasm_expr *n; int i; - + + if (e == NULL) + return NULL; + n = yasm_xmalloc(sizeof(yasm_expr) + sizeof(yasm_expr__item)*(e->numterms<2?0:e->numterms-2)); @@ -1005,12 +1013,6 @@ yasm_expr__copy_except(const yasm_expr *e, int except) return n; } -yasm_expr * -yasm_expr_copy(const yasm_expr *e) -{ - return yasm_expr__copy_except(e, -1); -} - static void expr_delete_term(yasm_expr__item *term, int recurse) { @@ -1262,7 +1264,7 @@ yasm_expr_get_intnum(yasm_expr **ep, int calc_bc_dist) { *ep = yasm_expr_simplify(*ep, calc_bc_dist); - if ((*ep)->op == YASM_EXPR_IDENT && (*ep)->terms[0].type == YASM_EXPR_INT) + if (*ep && (*ep)->op == YASM_EXPR_IDENT && (*ep)->terms[0].type == YASM_EXPR_INT) return (*ep)->terms[0].data.intn; else return (yasm_intnum *)NULL; @@ -1446,3 +1448,73 @@ yasm_expr_print(const yasm_expr *e, FILE *f) fprintf(f, "%s", opstr); } } + +unsigned int +yasm_expr_size(const yasm_expr *e) +{ + int i; + int seen = 0; + unsigned int size = 0, newsize; + + if (e->op == YASM_EXPR_IDENT) { + if (e->terms[0].type == YASM_EXPR_SYM) + return yasm_symrec_get_size(e->terms[0].data.sym); + return 0; + } + if (e->op != YASM_EXPR_ADD && e->op != YASM_EXPR_SUB) + return 0; + + for (i=0; inumterms; i++) { + newsize = 0; + switch (e->terms[i].type) { + case YASM_EXPR_EXPR: + newsize = yasm_expr_size(e->terms[i].data.expn); + break; + case YASM_EXPR_SYM: + newsize = yasm_symrec_get_size(e->terms[i].data.sym); + break; + default: + break; + } + if (newsize) { + size = newsize; + if (seen) + /* either sum of idents (?!) or substract of idents */ + return 0; + seen = 1; + } + } + /* exactly one offset */ + return size; +} + +const char * +yasm_expr_segment(const yasm_expr *e) +{ + int i; + int seen = 0; + const char *segment = NULL; + + if (e->op == YASM_EXPR_IDENT) { + if (e->terms[0].type == YASM_EXPR_SYM) + return yasm_symrec_get_segment(e->terms[0].data.sym); + return NULL; + } + if (e->op != YASM_EXPR_ADD && e->op != YASM_EXPR_SUB) + return NULL; + + for (i=0; inumterms; i++) { + if ((e->op == YASM_EXPR_ADD || !i) && + e->terms[i].type == YASM_EXPR_EXPR) { + if ((segment = yasm_expr_segment(e->terms[i].data.expn))) { + if (seen) { + /* either sum of idents (?!) or substract of idents */ + return NULL; + } + seen = 1; + } + } + } + /* exactly one offset */ + return segment; +} diff --git a/libyasm/expr.h b/libyasm/expr.h index ca189d0a..0de62dfe 100644 --- a/libyasm/expr.h +++ b/libyasm/expr.h @@ -2,10 +2,6 @@ * \file libyasm/expr.h * \brief YASM expression interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Michael Urman, Peter Johnson * @@ -34,8 +30,54 @@ #ifndef YASM_EXPR_H #define YASM_EXPR_H -/** Expression item (opaque type). \internal */ -typedef struct yasm_expr__item yasm_expr__item; +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + +/** Type of an expression item. Types are listed in canonical sorting order. + * See expr_order_terms(). + * Note #YASM_EXPR_PRECBC must be used carefully (in a-b pairs), as only + * symrecs can become the relative term in a #yasm_value. + */ +typedef enum yasm_expr__type { + YASM_EXPR_NONE = 0, /**< Nothing */ + YASM_EXPR_REG = 1<<0, /**< Register */ + YASM_EXPR_INT = 1<<1, /**< Integer value */ + YASM_EXPR_SUBST = 1<<2, /**< Substitution placeholder */ + YASM_EXPR_FLOAT = 1<<3, /**< Floating point value */ + YASM_EXPR_SYM = 1<<4, /**< Symbol */ + YASM_EXPR_PRECBC = 1<<5,/**< Direct bytecode ref (rather than via sym) */ + YASM_EXPR_EXPR = 1<<6 /**< Subexpression */ +} yasm_expr__type; + +/** Expression item. */ +typedef struct yasm_expr__item { + yasm_expr__type type; /**< Type */ + + /** Expression item data. Correct value depends on type. */ + union { + yasm_bytecode *precbc; /**< Direct bytecode ref (YASM_EXPR_PRECBC) */ + yasm_symrec *sym; /**< Symbol (YASM_EXPR_SYM) */ + yasm_expr *expn; /**< Subexpression (YASM_EXPR_EXPR) */ + yasm_intnum *intn; /**< Integer value (YASM_EXPR_INT) */ + yasm_floatnum *flt; /**< Floating point value (YASM_EXPR_FLOAT) */ + uintptr_t reg; /**< Register (YASM_EXPR_REG) */ + unsigned int subst; /**< Subst placeholder (YASM_EXPR_SUBST) */ + } data; +} yasm_expr__item; + +/** Expression. */ +struct yasm_expr { + yasm_expr_op op; /**< Operation. */ + unsigned long line; /**< Line number where expression was defined. */ + int numterms; /**< Number of terms in the expression. */ + + /** Terms of the expression. Structure may be extended to include more + * terms, as some operations may allow more than two operand terms + * (ADD, MUL, OR, AND, XOR). + */ + yasm_expr__item terms[2]; +}; /** Create a new expression e=a op b. * \param op operation @@ -44,6 +86,7 @@ typedef struct yasm_expr__item yasm_expr__item; * \param line virtual line (where expression defined) * \return Newly allocated expression. */ +YASM_LIB_DECL /*@only@*/ yasm_expr *yasm_expr_create (yasm_expr_op op, /*@only@*/ yasm_expr__item *a, /*@only@*/ /*@null@*/ yasm_expr__item *b, unsigned long line); @@ -52,36 +95,42 @@ typedef struct yasm_expr__item yasm_expr__item; * \param precbc preceding bytecode * \return Newly allocated expression item. */ +YASM_LIB_DECL /*@only@*/ yasm_expr__item *yasm_expr_precbc(/*@keep@*/ yasm_bytecode *precbc); /** Create a new symbol expression item. * \param sym symbol * \return Newly allocated expression item. */ +YASM_LIB_DECL /*@only@*/ yasm_expr__item *yasm_expr_sym(/*@keep@*/ yasm_symrec *sym); /** Create a new expression expression item. * \param e expression * \return Newly allocated expression item. */ +YASM_LIB_DECL /*@only@*/ yasm_expr__item *yasm_expr_expr(/*@keep@*/ yasm_expr *e); /** Create a new intnum expression item. * \param intn intnum * \return Newly allocated expression item. */ +YASM_LIB_DECL /*@only@*/ yasm_expr__item *yasm_expr_int(/*@keep@*/ yasm_intnum *intn); /** Create a new floatnum expression item. * \param flt floatnum * \return Newly allocated expression item. */ +YASM_LIB_DECL /*@only@*/ yasm_expr__item *yasm_expr_float(/*@keep@*/ yasm_floatnum *flt); /** Create a new register expression item. * \param reg register * \return Newly allocated expression item. */ +YASM_LIB_DECL /*@only@*/ yasm_expr__item *yasm_expr_reg(uintptr_t reg); /** Create a new expression tree e=l op r. @@ -116,10 +165,14 @@ typedef struct yasm_expr__item yasm_expr__item; * \return Newly allocated expression identical to e. */ yasm_expr *yasm_expr_copy(const yasm_expr *e); +#ifndef YASM_DOXYGEN +#define yasm_expr_copy(e) yasm_expr__copy_except(e, -1) +#endif /** Destroy (free allocated memory for) an expression. * \param e expression */ +YASM_LIB_DECL void yasm_expr_destroy(/*@only@*/ /*@null@*/ yasm_expr *e); /** Determine if an expression is a specified operation (at the top level). @@ -128,6 +181,7 @@ void yasm_expr_destroy(/*@only@*/ /*@null@*/ yasm_expr *e); * \return Nonzero if the expression was the specified operation at the top * level, zero otherwise. */ +YASM_LIB_DECL int yasm_expr_is_op(const yasm_expr *e, yasm_expr_op op); /** Extra transformation function for yasm_expr__level_tree(). @@ -151,6 +205,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * \param expr_xform_extra_data data to pass to expr_xform_extra * \return Leveled expression. */ +YASM_LIB_DECL /*@only@*/ /*@null@*/ yasm_expr *yasm_expr__level_tree (/*@returned@*/ /*@only@*/ /*@null@*/ yasm_expr *e, int fold_const, int simplify_ident, int simplify_reg_mul, int calc_bc_dist, @@ -175,6 +230,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * The input expression is modified such that on return, it's the * offset expression. */ +YASM_LIB_DECL /*@only@*/ /*@null@*/ yasm_expr *yasm_expr_extract_deep_segoff(yasm_expr **ep); /** Extract the segment portion of a SEG:OFF expression, leaving the offset. @@ -184,6 +240,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * expression is modified such that on return, it's the offset * expression. */ +YASM_LIB_DECL /*@only@*/ /*@null@*/ yasm_expr *yasm_expr_extract_segoff(yasm_expr **ep); /** Extract the right portion (y) of a x WRT y expression, leaving the left @@ -194,6 +251,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * input expression is modified such that on return, it's the left side * of the WRT expression. */ +YASM_LIB_DECL /*@only@*/ /*@null@*/ yasm_expr *yasm_expr_extract_wrt(yasm_expr **ep); /** Get the integer value of an expression if it's just an integer. @@ -204,6 +262,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * integers, ie floats, non-valued labels, registers); otherwise the * intnum value of the expression. */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ yasm_intnum *yasm_expr_get_intnum (yasm_expr **ep, int calc_bc_dist); @@ -213,6 +272,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * \return NULL if the expression is too complex; otherwise the symbol value of * the expression. */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ const yasm_symrec *yasm_expr_get_symrec (yasm_expr **ep, int simplify); @@ -222,6 +282,7 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * \return NULL if the expression is too complex; otherwise the register value * of the expression. */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ const uintptr_t *yasm_expr_get_reg (yasm_expr **ep, int simplify); @@ -229,6 +290,99 @@ typedef /*@only@*/ yasm_expr * (*yasm_expr_xform_func) * \param e expression * \param f file */ +YASM_LIB_DECL void yasm_expr_print(/*@null@*/ const yasm_expr *e, FILE *f); +/** Return the size of an expression, if the user provided it + * \param e expression + */ +YASM_LIB_DECL +unsigned int yasm_expr_size(const yasm_expr *e); + +/** Return the segment of an expression, if the user provided it + * \param e expression + */ +YASM_LIB_DECL +const char *yasm_expr_segment(const yasm_expr *e); + +/** Traverse over expression tree in order (const version). + * Calls func for each leaf (non-operation). + * \param e expression + * \param d data passed to each call to func + * \param func callback function + * \return Stops early (and returns 1) if func returns 1. + * Otherwise returns 0. + */ +YASM_LIB_DECL +int yasm_expr__traverse_leaves_in_const + (const yasm_expr *e, /*@null@*/ void *d, + int (*func) (/*@null@*/ const yasm_expr__item *ei, /*@null@*/ void *d)); + +/** Traverse over expression tree in order. + * Calls func for each leaf (non-operation). + * \param e expression + * \param d data passed to each call to func + * \param func callback function + * \return Stops early (and returns 1) if func returns 1. + * Otherwise returns 0. + */ +YASM_LIB_DECL +int yasm_expr__traverse_leaves_in + (yasm_expr *e, /*@null@*/ void *d, + int (*func) (/*@null@*/ yasm_expr__item *ei, /*@null@*/ void *d)); + +/** Reorder terms of e into canonical order. Only reorders if reordering + * doesn't change meaning of expression. (eg, doesn't reorder SUB). + * Canonical order: REG, INT, FLOAT, SYM, EXPR. + * Multiple terms of a single type are kept in the same order as in + * the original expression. + * \param e expression + * \note Only performs reordering on *one* level (no recursion). + */ +YASM_LIB_DECL +void yasm_expr__order_terms(yasm_expr *e); + +/** Copy entire expression EXCEPT for index "except" at *top level only*. + * \param e expression + * \param except term index not to copy; -1 to copy all terms + * \return Newly allocated copy of expression. + */ +YASM_LIB_DECL +yasm_expr *yasm_expr__copy_except(const yasm_expr *e, int except); + +/** Test if expression contains an item. Searches recursively into + * subexpressions. + * \param e expression + * \param t type of item to look for + * \return Nonzero if expression contains an item of type t, zero if not. + */ +YASM_LIB_DECL +int yasm_expr__contains(const yasm_expr *e, yasm_expr__type t); + +/** Transform symrec-symrec terms in expression into #YASM_EXPR_SUBST items. + * Calls the callback function for each symrec-symrec term. + * \param ep expression (pointer to) + * \param cbd callback data passed to callback function + * \param callback callback function: given subst index for bytecode + * pair, bytecode pair (bc2-bc1), and cbd (callback data) + * \return Number of transformations made. + */ +YASM_LIB_DECL +int yasm_expr__bc_dist_subst(yasm_expr **ep, void *cbd, + void (*callback) (unsigned int subst, + yasm_bytecode *precbc, + yasm_bytecode *precbc2, + void *cbd)); + +/** Substitute items into expr YASM_EXPR_SUBST items (by index). Items are + * copied, so caller is responsible for freeing array of items. + * \param e expression + * \param num_items number of items in items array + * \param items items array + * \return 1 on error (index out of range). + */ +YASM_LIB_DECL +int yasm_expr__subst(yasm_expr *e, unsigned int num_items, + const yasm_expr__item *items); + #endif diff --git a/libyasm/file.c b/libyasm/file.c index 2ee3ee6f..ea9f603b 100644 --- a/libyasm/file.c +++ b/libyasm/file.c @@ -25,16 +25,26 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -/* Need either unistd.h or direct.h (on Windows) to prototype getcwd() */ +/* Need either unistd.h or direct.h to prototype getcwd() and mkdir() */ #ifdef HAVE_UNISTD_H #include -#elif defined(WIN32) || defined(_WIN32) +#endif + +#ifdef HAVE_DIRECT_H #include #endif +#ifdef _WIN32 +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + #include +#include #include "errwarn.h" #include "file.h" @@ -226,48 +236,47 @@ yasm__splitpath_win(const char *path, /*@out@*/ const char **tail) return s-path+1; } -/* FIXME: dumb way for now */ char * -yasm__abspath_unix(const char *path) +yasm__getcwd(void) { - char *curdir, *abspath; - static const char pathsep[2] = "/"; + char *buf; + size_t size; - curdir = getcwd(NULL, 0); + size = 1024; + buf = yasm_xmalloc(size); - abspath = yasm_xmalloc(strlen(curdir) + strlen(path) + 2); - strcpy(abspath, curdir); - strcat(abspath, pathsep); - strcat(abspath, path); + if (getenv("YASM_TEST_SUITE")) { + strcpy(buf, "./"); + return buf; + } - free(curdir); + while (getcwd(buf, size-1) == NULL) { + if (errno != ERANGE) { + yasm__fatal(N_("could not determine current working directory")); + yasm_xfree(buf); + return NULL; + } + size *= 2; + buf = yasm_xrealloc(buf, size); + } - return abspath; + /* append a '/' if not already present */ + size = strlen(buf); + if (buf[size-1] != '\\' && buf[size-1] != '/') { + buf[size] = '/'; + buf[size+1] = '\0'; + } + return buf; } -/* FIXME: dumb way for now */ char * -yasm__abspath_win(const char *path) +yasm__abspath(const char *path) { - char *curdir, *abspath, *ch; - static const char pathsep[2] = "\\"; + char *curdir, *abspath; - curdir = getcwd(NULL, 0); - - abspath = yasm_xmalloc(strlen(curdir) + strlen(path) + 2); - strcpy(abspath, curdir); - strcat(abspath, pathsep); - strcat(abspath, path); - - free(curdir); - - /* Replace all / with \ */ - ch = abspath; - while (*ch) { - if (*ch == '/') - *ch = '\\'; - ch++; - } + curdir = yasm__getcwd(); + abspath = yasm__combpath(curdir, path); + yasm_xfree(curdir); return abspath; } @@ -456,12 +465,74 @@ yasm__combpath_win(const char *from, const char *to) return out; } +size_t +yasm__createpath_common(const char *path, int win) +{ + const char *pp = path, *pe; + char *ts, *tp; + size_t len, lth; + + lth = len = strlen(path); + ts = tp = (char *) yasm_xmalloc(len + 1); + pe = pp + len; + while (pe > pp) { + if ((win && *pe == '\\') || *pe == '/') + break; + --pe; + --lth; + } + + while (pp <= pe) { + if (pp == pe || (win && *pp == '\\') || *pp == '/') { +#ifdef _WIN32 + struct _finddata_t fi; + intptr_t h; +#elif defined(HAVE_SYS_STAT_H) + struct stat fi; +#endif + *tp = '\0'; + +#ifdef _WIN32 + h = _findfirst(ts, &fi); + if (h != -1) { + if (fi.attrib != _A_SUBDIR) { + _findclose(h); + break; + } + } else if (errno == ENOENT) { + if (_mkdir(ts) == -1) { + _findclose(h); + lth = -1; + break; + } + } + _findclose(h); +#elif defined(HAVE_SYS_STAT_H) + if (stat(ts, &fi) != -1) { + if (!S_ISDIR(fi.st_mode)) + break; + } else if (errno == ENOENT) { + if (mkdir(ts, 0755) == -1) { + lth = 0; + break; + } + } +#else + break; +#endif + } + *tp++ = *pp++; + } + yasm_xfree(ts); + return lth; +} + typedef struct incpath { STAILQ_ENTRY(incpath) link; /*@owned@*/ char *path; } incpath; -STAILQ_HEAD(, incpath) incpaths = STAILQ_HEAD_INITIALIZER(incpaths); +STAILQ_HEAD(incpath_head, incpath) incpaths = STAILQ_HEAD_INITIALIZER(incpaths); FILE * yasm_fopen_include(const char *iname, const char *from, const char *mode, @@ -518,6 +589,23 @@ yasm_delete_include_paths(void) STAILQ_INIT(&incpaths); } +const char * +yasm_get_include_dir(void **iter) +{ + incpath *p = (incpath *)*iter; + + if (!p) + p = STAILQ_FIRST(&incpaths); + else + p = STAILQ_NEXT(p, link); + + *iter = p; + if (p) + return p->path; + else + return NULL; +} + void yasm_add_include_path(const char *path) { diff --git a/libyasm/file.h b/libyasm/file.h index c7069949..1e9b87b0 100644 --- a/libyasm/file.h +++ b/libyasm/file.h @@ -2,10 +2,6 @@ * \file libyasm/file.h * \brief YASM file helpers. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,6 +30,10 @@ #ifndef YASM_FILE_H #define YASM_FILE_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Re2c scanner state. */ typedef struct yasm_scanner { unsigned char *bot; /**< Bottom of scan buffer */ @@ -48,11 +48,13 @@ typedef struct yasm_scanner { /** Initialize scanner state. * \param scanner Re2c scanner state */ +YASM_LIB_DECL void yasm_scanner_initialize(yasm_scanner *scanner); /** Frees any memory used by scanner state; does not free state itself. * \param scanner Re2c scanner state */ +YASM_LIB_DECL void yasm_scanner_delete(yasm_scanner *scanner); /** Fill a scanner state structure with data coming from an input function. @@ -64,6 +66,7 @@ void yasm_scanner_delete(yasm_scanner *scanner); * \return 1 if this was the first time this function was called on this * scanner state, 0 otherwise. */ +YASM_LIB_DECL int yasm_fill_helper (yasm_scanner *scanner, unsigned char **cursor, size_t (*input_func) (void *d, unsigned char *buf, size_t max), @@ -78,6 +81,7 @@ int yasm_fill_helper * \param str C-style string (updated in place) * \param len length of string (updated with new length) */ +YASM_LIB_DECL void yasm_unescape_cstring(unsigned char *str, size_t *len); /** Split a UNIX pathname into head (directory) and tail (base filename) @@ -87,6 +91,7 @@ void yasm_unescape_cstring(unsigned char *str, size_t *len); * \param tail (returned) base filename * \return Length of head (directory). */ +YASM_LIB_DECL size_t yasm__splitpath_unix(const char *path, /*@out@*/ const char **tail); /** Split a Windows pathname into head (directory) and tail (base filename) @@ -96,6 +101,7 @@ size_t yasm__splitpath_unix(const char *path, /*@out@*/ const char **tail); * \param tail (returned) base filename * \return Length of head (directory). */ +YASM_LIB_DECL size_t yasm__splitpath_win(const char *path, /*@out@*/ const char **tail); /** Split a pathname into head (directory) and tail (base filename) portions. @@ -107,43 +113,27 @@ size_t yasm__splitpath_win(const char *path, /*@out@*/ const char **tail); */ #ifndef yasm__splitpath # if defined (_WIN32) || defined (WIN32) || defined (__MSDOS__) || \ - defined (__DJGPP__) || defined (__OS2__) || defined (__CYGWIN__) || \ - defined (__CYGWIN32__) + defined (__DJGPP__) || defined (__OS2__) # define yasm__splitpath(path, tail) yasm__splitpath_win(path, tail) # else # define yasm__splitpath(path, tail) yasm__splitpath_unix(path, tail) # endif #endif -/** Convert a UNIX relative or absolute pathname into an absolute pathname. +/** Get the current working directory. * \internal - * \param path pathname - * \return Absolute version of path (newly allocated). + * \return Current working directory pathname (newly allocated). */ -/*@only@*/ char *yasm__abspath_unix(const char *path); - -/** Convert a Windows relative or absolute pathname into an absolute pathname. - * \internal - * \param path pathname - * \return Absolute version of path (newly allocated). - */ -/*@only@*/ char *yasm__abspath_win(const char *path); +YASM_LIB_DECL +/*@only@*/ char *yasm__getcwd(void); /** Convert a relative or absolute pathname into an absolute pathname. - * Unless otherwise defined, defaults to yasm__abspath_unix(). * \internal * \param path pathname * \return Absolute version of path (newly allocated). */ -#ifndef yasm__abspath -# if defined (_WIN32) || defined (WIN32) || defined (__MSDOS__) || \ - defined (__DJGPP__) || defined (__OS2__) || defined (__CYGWIN__) || \ - defined (__CYGWIN32__) -# define yasm__abspath(path) yasm__abspath_win(path) -# else -# define yasm__abspath(path) yasm__abspath_unix(path) -# endif -#endif +YASM_LIB_DECL +/*@only@*/ char *yasm__abspath(const char *path); /** Build a UNIX pathname that is equivalent to accessing the "to" pathname * when you're in the directory containing "from". Result is relative if both @@ -153,6 +143,7 @@ size_t yasm__splitpath_win(const char *path, /*@out@*/ const char **tail); * \param to to pathname * \return Combined path (newly allocated). */ +YASM_LIB_DECL char *yasm__combpath_unix(const char *from, const char *to); /** Build a Windows pathname that is equivalent to accessing the "to" pathname @@ -163,6 +154,7 @@ char *yasm__combpath_unix(const char *from, const char *to); * \param to to pathname * \return Combined path (newly allocated). */ +YASM_LIB_DECL char *yasm__combpath_win(const char *from, const char *to); /** Build a pathname that is equivalent to accessing the "to" pathname @@ -176,14 +168,37 @@ char *yasm__combpath_win(const char *from, const char *to); */ #ifndef yasm__combpath # if defined (_WIN32) || defined (WIN32) || defined (__MSDOS__) || \ - defined (__DJGPP__) || defined (__OS2__) || defined (__CYGWIN__) || \ - defined (__CYGWIN32__) + defined (__DJGPP__) || defined (__OS2__) # define yasm__combpath(from, to) yasm__combpath_win(from, to) # else # define yasm__combpath(from, to) yasm__combpath_unix(from, to) # endif #endif +/** Recursively create tree of directories needed for pathname. + * \internal + * \param path pathname + * \param win handle windows paths + * \return Length of directory portion of pathname. + */ +YASM_LIB_DECL +size_t yasm__createpath_common(const char *path, int win); + +/** Recursively create tree of directories needed for pathname. + * Unless otherwise defined, defaults to yasm__createpath_unix(). + * \internal + * \param path pathname + * \return Length of directory portion of pathname. + */ +#ifndef yasm__createpath +# if defined (_WIN32) || defined (WIN32) || defined (__MSDOS__) || \ + defined (__DJGPP__) || defined (__OS2__) +# define yasm__createpath(path) yasm__createpath_common(path, 1) +# else +# define yasm__createpath(path) yasm__createpath_common(path, 0) +# endif +#endif + /** Try to find and open an include file, searching through include paths. * First iname is looked for relative to the directory containing "from", then * it's looked for relative to each of the include paths. @@ -202,20 +217,28 @@ char *yasm__combpath_win(const char *from, const char *to); * may be passed if this is unwanted. * \return fopen'ed include file, or NULL if not found. */ +YASM_LIB_DECL /*@null@*/ FILE *yasm_fopen_include (const char *iname, const char *from, const char *mode, /*@null@*/ /*@out@*/ /*@only@*/ char **oname); /** Delete any stored include paths added by yasm_add_include_path(). */ +YASM_LIB_DECL void yasm_delete_include_paths(void); +/** Iterate through include paths. +*/ +YASM_LIB_DECL +const char * yasm_get_include_dir(void **iter); + /** Add an include path for use by yasm_fopen_include(). * If path is relative, it is treated by yasm_fopen_include() as relative to * the current working directory. * * \param path path to add */ +YASM_LIB_DECL void yasm_add_include_path(const char *path); /** Write an 8-bit value to a buffer, incrementing buffer pointer. @@ -346,6 +369,7 @@ void yasm_add_include_path(const char *path); * \param f file * \return 1 if the write was successful, 0 if not (just like fwrite()). */ +YASM_LIB_DECL size_t yasm_fwrite_16_l(unsigned short val, FILE *f); /** Direct-to-file version of YASM_SAVE_32_L(). @@ -355,6 +379,7 @@ size_t yasm_fwrite_16_l(unsigned short val, FILE *f); * \param f file * \return 1 if the write was successful, 0 if not (just like fwrite()). */ +YASM_LIB_DECL size_t yasm_fwrite_32_l(unsigned long val, FILE *f); /** Direct-to-file version of YASM_SAVE_16_B(). @@ -364,6 +389,7 @@ size_t yasm_fwrite_32_l(unsigned long val, FILE *f); * \param f file * \return 1 if the write was successful, 0 if not (just like fwrite()). */ +YASM_LIB_DECL size_t yasm_fwrite_16_b(unsigned short val, FILE *f); /** Direct-to-file version of YASM_SAVE_32_B(). @@ -373,6 +399,7 @@ size_t yasm_fwrite_16_b(unsigned short val, FILE *f); * \param f file * \return 1 if the write was successful, 0 if not (just like fwrite()). */ +YASM_LIB_DECL size_t yasm_fwrite_32_b(unsigned long val, FILE *f); /** Read an 8-bit value from a buffer, incrementing buffer pointer. diff --git a/libyasm/floatnum.c b/libyasm/floatnum.c index cb0435fe..ab67c2b2 100644 --- a/libyasm/floatnum.c +++ b/libyasm/floatnum.c @@ -26,9 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include @@ -632,7 +630,17 @@ floatnum_get_common(const yasm_floatnum *flt, /*@out@*/ unsigned char *ptr, return retval; } -/* IEEE-754 (Intel) "single precision" format: +/* IEEE-754r "half precision" format: + * 16 bits: + * 15 9 Bit 0 + * | | | + * seee eemm mmmm mmmm + * + * e = bias 15 exponent + * s = sign bit + * m = mantissa bits, bit 10 is an implied one bit. + * + * IEEE-754 (Intel) "single precision" format: * 32 bits: * Bit 31 Bit 22 Bit 0 * | | | @@ -673,6 +681,9 @@ yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr, yasm_internal_error(N_("unsupported floatnum functionality")); } switch (destsize) { + case 2: + retval = floatnum_get_common(flt, ptr, 2, 10, 1, 5); + break; case 4: retval = floatnum_get_common(flt, ptr, 4, 23, 1, 8); break; @@ -703,6 +714,7 @@ int yasm_floatnum_check_size(/*@unused@*/ const yasm_floatnum *flt, size_t size) { switch (size) { + case 16: case 32: case 64: case 80: diff --git a/libyasm/floatnum.h b/libyasm/floatnum.h index 15696a56..d2c70420 100644 --- a/libyasm/floatnum.h +++ b/libyasm/floatnum.h @@ -2,10 +2,6 @@ * \file libyasm/floatnum.h * \brief YASM floating point (IEEE) interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -36,10 +32,16 @@ #ifndef YASM_FLOATNUM_H #define YASM_FLOATNUM_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Initialize floatnum internal data structures. */ +YASM_LIB_DECL void yasm_floatnum_initialize(void); /** Clean up internal floatnum allocations. */ +YASM_LIB_DECL void yasm_floatnum_cleanup(void); /** Create a new floatnum from a decimal string. The input string must be in @@ -47,17 +49,20 @@ void yasm_floatnum_cleanup(void); * \param str floating point decimal string * \return Newly allocated floatnum. */ +YASM_LIB_DECL /*@only@*/ yasm_floatnum *yasm_floatnum_create(const char *str); /** Duplicate a floatnum. * \param flt floatnum * \return Newly allocated floatnum with the same value as flt. */ +YASM_LIB_DECL /*@only@*/ yasm_floatnum *yasm_floatnum_copy(const yasm_floatnum *flt); /** Destroy (free allocated memory for) a floatnum. * \param flt floatnum */ +YASM_LIB_DECL void yasm_floatnum_destroy(/*@only@*/ yasm_floatnum *flt); /** Floating point calculation function: acc = acc op operand. @@ -68,6 +73,7 @@ void yasm_floatnum_destroy(/*@only@*/ yasm_floatnum *flt); * \param operand floatnum operand * \return Nonzero on error. */ +YASM_LIB_DECL int yasm_floatnum_calc(yasm_floatnum *acc, yasm_expr_op op, yasm_floatnum *operand); @@ -78,6 +84,7 @@ int yasm_floatnum_calc(yasm_floatnum *acc, yasm_expr_op op, * \return Nonzero if flt can't fit into single precision: -1 if underflow * occurred, 1 if overflow occurred. */ +YASM_LIB_DECL int yasm_floatnum_get_int(const yasm_floatnum *flt, /*@out@*/ unsigned long *ret_val); @@ -98,6 +105,7 @@ int yasm_floatnum_get_int(const yasm_floatnum *flt, * \return Nonzero if flt can't fit into the specified precision: -1 if * underflow occurred, 1 if overflow occurred. */ +YASM_LIB_DECL int yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr, size_t destsize, size_t valsize, size_t shift, int bigendian, int warn); @@ -110,12 +118,14 @@ int yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr, * \param size number of bits of output space * \return 1 if valid size, 0 if invalid size. */ +YASM_LIB_DECL int yasm_floatnum_check_size(const yasm_floatnum *flt, size_t size); /** Print various representations of a floatnum. For debugging purposes only. * \param f file * \param flt floatnum */ +YASM_LIB_DECL void yasm_floatnum_print(const yasm_floatnum *flt, FILE *f); #endif diff --git a/libyasm/genmodule.c b/libyasm/genmodule.c index 4ae31083..867d93a5 100644 --- a/libyasm/genmodule.c +++ b/libyasm/genmodule.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Generate module.c from module.in and Makefile.am or Makefile. * diff --git a/libyasm/hamt.c b/libyasm/hamt.c index 32e13035..59b75921 100644 --- a/libyasm/hamt.c +++ b/libyasm/hamt.c @@ -29,9 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include @@ -57,6 +55,7 @@ struct HAMT { const char *message); unsigned long (*HashKey) (const char *key); unsigned long (*ReHashKey) (const char *key, int Level); + int (*CmpKey) (const char *s1, const char *s2); }; /* XXX make a portable version of this. This depends on the pointer being @@ -133,9 +132,11 @@ HAMT_create(int nocase, /*@exits@*/ void (*error_func) if (nocase) { hamt->HashKey = HashKey_nocase; hamt->ReHashKey = ReHashKey_nocase; + hamt->CmpKey = yasm__strcasecmp; } else { hamt->HashKey = HashKey; hamt->ReHashKey = ReHashKey; + hamt->CmpKey = strcmp; } return hamt; @@ -245,7 +246,8 @@ HAMT_insert(HAMT *hamt, const char *str, void *data, int *replace, for (;;) { if (!(IsSubTrie(node))) { if (node->BitMapKey == key - && strcmp(((HAMTEntry *)(node->BaseValue))->str, str) == 0) { + && hamt->CmpKey(((HAMTEntry *)(node->BaseValue))->str, + str) == 0) { /*@-branchstate@*/ if (*replace) { deletefunc(((HAMTEntry *)(node->BaseValue))->data); @@ -278,7 +280,8 @@ HAMT_insert(HAMT *hamt, const char *str, void *data, int *replace, * downward. */ newnodes = yasm_xmalloc(sizeof(HAMTNode)); - newnodes[0] = *node; /* structure copy */ + newnodes[0].BitMapKey = key2; + newnodes[0].BaseValue = node->BaseValue; node->BitMapKey = 1<BaseValue; newnodes[1].BitMapKey = key; SetValue(hamt, &newnodes[1], entry); } else { newnodes[0].BitMapKey = key; SetValue(hamt, &newnodes[0], entry); - newnodes[1] = *node; /* structure copy */ + newnodes[1].BitMapKey = key2; + newnodes[1].BaseValue = node->BaseValue; } /* Set bits in bitmap corresponding to keys */ @@ -385,7 +390,9 @@ HAMT_search(HAMT *hamt, const char *str) for (;;) { if (!(IsSubTrie(node))) { - if (node->BitMapKey == key) + if (node->BitMapKey == key + && hamt->CmpKey(((HAMTEntry *)(node->BaseValue))->str, + str) == 0) return ((HAMTEntry *)(node->BaseValue))->data; else return NULL; diff --git a/libyasm/hamt.h b/libyasm/hamt.h index d33bbe3b..1ce9b775 100644 --- a/libyasm/hamt.h +++ b/libyasm/hamt.h @@ -2,10 +2,6 @@ * \file libyasm/hamt.h * \brief Hash Array Mapped Trie (HAMT) functions. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,6 +30,10 @@ #ifndef YASM_HAMT_H #define YASM_HAMT_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Hash array mapped trie data structure (opaque type). */ typedef struct HAMT HAMT; /** Hash array mapped trie entry (opaque type). */ @@ -45,6 +45,7 @@ typedef struct HAMTEntry HAMTEntry; * \param error_func function called on internal error * \return New, empty, hash array mapped trie. */ +YASM_LIB_DECL HAMT *HAMT_create(int nocase, /*@exits@*/ void (*error_func) (const char *file, unsigned int line, const char *message)); @@ -53,6 +54,7 @@ HAMT *HAMT_create(int nocase, /*@exits@*/ void (*error_func) * \param hamt Hash array mapped trie * \param deletefunc Data deletion function */ +YASM_LIB_DECL void HAMT_destroy(/*@only@*/ HAMT *hamt, void (*deletefunc) (/*@only@*/ void *data)); @@ -72,6 +74,7 @@ void HAMT_destroy(/*@only@*/ HAMT *hamt, * \param deletefunc Data deletion function if data is replaced * \return Data now associated with key. */ +YASM_LIB_DECL /*@dependent@*/ void *HAMT_insert(HAMT *hamt, /*@dependent@*/ const char *str, /*@only@*/ void *data, int *replace, void (*deletefunc) (/*@only@*/ void *data)); @@ -81,6 +84,7 @@ void HAMT_destroy(/*@only@*/ HAMT *hamt, * \param str Key * \return NULL if key/data not present in HAMT, otherwise associated data. */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ void *HAMT_search(HAMT *hamt, const char *str); /** Traverse over all keys in HAMT, calling function on each data item. @@ -90,6 +94,7 @@ void HAMT_destroy(/*@only@*/ HAMT *hamt, * \return Stops early (and returns func's return value) if func returns a * nonzero value; otherwise 0. */ +YASM_LIB_DECL int HAMT_traverse(HAMT *hamt, /*@null@*/ void *d, int (*func) (/*@dependent@*/ /*@null@*/ void *node, /*@null@*/ void *d)); @@ -98,18 +103,21 @@ int HAMT_traverse(HAMT *hamt, /*@null@*/ void *d, * \param hamt Hash array mapped trie * \return First entry in HAMT, or NULL if HAMT is empty. */ +YASM_LIB_DECL const HAMTEntry *HAMT_first(const HAMT *hamt); /** Get the next entry in a HAMT. * \param prev Previous entry in HAMT * \return Next entry in HAMT, or NULL if no more entries. */ +YASM_LIB_DECL /*@null@*/ const HAMTEntry *HAMT_next(const HAMTEntry *prev); /** Get the corresponding data for a HAMT entry. * \param entry HAMT entry (as returned by HAMT_first() and HAMT_next()) * \return Corresponding data item. */ +YASM_LIB_DECL void *HAMTEntry_get_data(const HAMTEntry *entry); #endif diff --git a/libyasm/insn.c b/libyasm/insn.c new file mode 100644 index 00000000..8f7a4c19 --- /dev/null +++ b/libyasm/insn.c @@ -0,0 +1,295 @@ +/* + * Mnemonic instruction bytecode + * + * Copyright (C) 2005-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "util.h" + +#include "libyasm-stdint.h" +#include "coretype.h" + +#include "errwarn.h" +#include "expr.h" +#include "value.h" + +#include "bytecode.h" +#include "insn.h" +#include "arch.h" + + +void +yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg) +{ + if (!ea) + return; + + if (segreg != 0 && ea->segreg != 0) + yasm_warn_set(YASM_WARN_GENERAL, + N_("multiple segment overrides, using leftmost")); + + ea->segreg = segreg; +} + +yasm_insn_operand * +yasm_operand_create_reg(uintptr_t reg) +{ + yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand)); + + retval->type = YASM_INSN__OPERAND_REG; + retval->data.reg = reg; + retval->seg = 0; + retval->targetmod = 0; + retval->size = 0; + retval->deref = 0; + retval->strict = 0; + + return retval; +} + +yasm_insn_operand * +yasm_operand_create_segreg(uintptr_t segreg) +{ + yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand)); + + retval->type = YASM_INSN__OPERAND_SEGREG; + retval->data.reg = segreg; + retval->seg = 0; + retval->targetmod = 0; + retval->size = 0; + retval->deref = 0; + retval->strict = 0; + + return retval; +} + +yasm_insn_operand * +yasm_operand_create_mem(/*@only@*/ yasm_effaddr *ea) +{ + yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand)); + + retval->type = YASM_INSN__OPERAND_MEMORY; + retval->data.ea = ea; + retval->seg = 0; + retval->targetmod = 0; + retval->size = 0; + retval->deref = 0; + retval->strict = 0; + retval->size = ea->data_len * 8; + + return retval; +} + +yasm_insn_operand * +yasm_operand_create_imm(/*@only@*/ yasm_expr *val) +{ + yasm_insn_operand *retval; + const uintptr_t *reg; + + reg = yasm_expr_get_reg(&val, 0); + if (reg) { + retval = yasm_operand_create_reg(*reg); + yasm_expr_destroy(val); + } else { + retval = yasm_xmalloc(sizeof(yasm_insn_operand)); + retval->type = YASM_INSN__OPERAND_IMM; + retval->data.val = val; + retval->seg = 0; + retval->targetmod = 0; + retval->size = 0; + retval->deref = 0; + retval->strict = 0; + } + + return retval; +} + +yasm_insn_operand * +yasm_insn_ops_append(yasm_insn *insn, yasm_insn_operand *op) +{ + if (op) { + insn->num_operands++; + STAILQ_INSERT_TAIL(&insn->operands, op, link); + return op; + } + return (yasm_insn_operand *)NULL; +} + +void +yasm_insn_add_prefix(yasm_insn *insn, uintptr_t prefix) +{ + insn->prefixes = + yasm_xrealloc(insn->prefixes, + (insn->num_prefixes+1)*sizeof(uintptr_t)); + insn->prefixes[insn->num_prefixes] = prefix; + insn->num_prefixes++; +} + +void +yasm_insn_add_seg_prefix(yasm_insn *insn, uintptr_t segreg) +{ + insn->segregs = + yasm_xrealloc(insn->segregs, (insn->num_segregs+1)*sizeof(uintptr_t)); + insn->segregs[insn->num_segregs] = segreg; + insn->num_segregs++; +} + +void +yasm_insn_initialize(yasm_insn *insn) +{ + STAILQ_INIT(&insn->operands); + + insn->prefixes = NULL; + insn->segregs = NULL; + + insn->num_operands = 0; + insn->num_prefixes = 0; + insn->num_segregs = 0; +} + +void +yasm_insn_delete(yasm_insn *insn, + void (*ea_destroy) (/*@only@*/ yasm_effaddr *)) +{ + if (insn->num_operands > 0) { + yasm_insn_operand *cur, *next; + + cur = STAILQ_FIRST(&insn->operands); + while (cur) { + next = STAILQ_NEXT(cur, link); + switch (cur->type) { + case YASM_INSN__OPERAND_MEMORY: + ea_destroy(cur->data.ea); + break; + case YASM_INSN__OPERAND_IMM: + yasm_expr_destroy(cur->data.val); + break; + default: + break; + } + yasm_xfree(cur); + cur = next; + } + } + if (insn->num_prefixes > 0) + yasm_xfree(insn->prefixes); + if (insn->num_segregs > 0) + yasm_xfree(insn->segregs); +} + +void +yasm_insn_print(const yasm_insn *insn, FILE *f, int indent_level) +{ + const yasm_insn_operand *op; + + STAILQ_FOREACH (op, &insn->operands, link) { + switch (op->type) { + case YASM_INSN__OPERAND_REG: + fprintf(f, "%*sReg=", indent_level, ""); + /*yasm_arch_reg_print(arch, op->data.reg, f);*/ + fprintf(f, "\n"); + break; + case YASM_INSN__OPERAND_SEGREG: + fprintf(f, "%*sSegReg=", indent_level, ""); + /*yasm_arch_segreg_print(arch, op->data.reg, f);*/ + fprintf(f, "\n"); + break; + case YASM_INSN__OPERAND_MEMORY: + fprintf(f, "%*sMemory=\n", indent_level, ""); + /*yasm_arch_ea_print(arch, op->data.ea, f, indent_level);*/ + break; + case YASM_INSN__OPERAND_IMM: + fprintf(f, "%*sImm=", indent_level, ""); + yasm_expr_print(op->data.val, f); + fprintf(f, "\n"); + break; + } + fprintf(f, "%*sTargetMod=%lx\n", indent_level+1, "", + (unsigned long)op->targetmod); + fprintf(f, "%*sSize=%u\n", indent_level+1, "", op->size); + fprintf(f, "%*sDeref=%d, Strict=%d\n", indent_level+1, "", + (int)op->deref, (int)op->strict); + } +} + +void +yasm_insn_finalize(yasm_insn *insn) +{ + unsigned int i; + yasm_insn_operand *op; + yasm_error_class eclass; + char *str, *xrefstr; + unsigned long xrefline; + + /* Simplify the operands' expressions first. */ + for (i = 0, op = yasm_insn_ops_first(insn); + op && inum_operands; op = yasm_insn_op_next(op), i++) { + /* Check operand type */ + switch (op->type) { + case YASM_INSN__OPERAND_MEMORY: + /* Don't get over-ambitious here; some archs' memory expr + * parser are sensitive to the presence of *1, etc, so don't + * simplify reg*1 identities. + */ + if (op->data.ea) + op->data.ea->disp.abs = + yasm_expr__level_tree(op->data.ea->disp.abs, 1, 1, 0, + 0, NULL, NULL); + if (yasm_error_occurred()) { + /* Add a pointer to where it was used to the error */ + yasm_error_fetch(&eclass, &str, &xrefline, &xrefstr); + if (xrefstr) { + yasm_error_set_xref(xrefline, "%s", xrefstr); + yasm_xfree(xrefstr); + } + if (str) { + yasm_error_set(eclass, "%s in memory expression", str); + yasm_xfree(str); + } + return; + } + break; + case YASM_INSN__OPERAND_IMM: + op->data.val = + yasm_expr__level_tree(op->data.val, 1, 1, 1, 0, NULL, + NULL); + if (yasm_error_occurred()) { + /* Add a pointer to where it was used to the error */ + yasm_error_fetch(&eclass, &str, &xrefline, &xrefstr); + if (xrefstr) { + yasm_error_set_xref(xrefline, "%s", xrefstr); + yasm_xfree(xrefstr); + } + if (str) { + yasm_error_set(eclass, "%s in immediate expression", + str); + yasm_xfree(str); + } + return; + } + break; + default: + break; + } + } +} diff --git a/libyasm/insn.h b/libyasm/insn.h new file mode 100644 index 00000000..d2d175d0 --- /dev/null +++ b/libyasm/insn.h @@ -0,0 +1,269 @@ +/** + * \file libyasm/insn.h + * \brief YASM mnenomic instruction. + * + * \license + * Copyright (C) 2002-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * \endlicense + */ +#ifndef YASM_INSN_H +#define YASM_INSN_H + +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + +/** Base structure for an effective address. As with all base + * structures, must be present as the first element in any + * #yasm_arch implementation of an effective address. + */ +struct yasm_effaddr { + yasm_value disp; /**< address displacement */ + + /** Segment register override (0 if none). */ + uintptr_t segreg; + + /** 1 if length of disp must be >0. */ + unsigned int need_nonzero_len:1; + + /** 1 if a displacement should be present in the output. */ + unsigned int need_disp:1; + + /** 1 if reg*2 should not be split into reg+reg. (0 if not). + * This flag indicates (for architectures that support complex effective + * addresses such as x86) if various types of complex effective addresses + * can be split into different forms in order to minimize instruction + * length. + */ + unsigned int nosplit:1; + + /** 1 if effective address is /definitely/ an effective address. + * This is used in e.g. the GAS parser to differentiate + * between "expr" (which might or might not be an effective address) and + * "expr(,1)" (which is definitely an effective address). + */ + unsigned int strong:1; + + /** 1 if effective address is forced PC-relative. */ + unsigned int pc_rel:1; + + /** 1 if effective address is forced non-PC-relative. */ + unsigned int not_pc_rel:1; + + /** length of pointed data (in bytes), 0 if unknown. */ + unsigned int data_len; +}; + +/** An instruction operand (opaque type). */ +typedef struct yasm_insn_operand yasm_insn_operand; + +/** The type of an instruction operand. */ +typedef enum yasm_insn_operand_type { + YASM_INSN__OPERAND_REG = 1, /**< A register. */ + YASM_INSN__OPERAND_SEGREG, /**< A segment register. */ + YASM_INSN__OPERAND_MEMORY, /**< An effective address + * (memory reference). */ + YASM_INSN__OPERAND_IMM /**< An immediate or jump target. */ +} yasm_insn_operand_type; + +/** An instruction operand. */ +struct yasm_insn_operand { + /** Link for building linked list of operands. \internal */ + /*@reldef@*/ STAILQ_ENTRY(yasm_insn_operand) link; + + /** Operand data. */ + union { + uintptr_t reg; /**< Arch data for reg/segreg. */ + yasm_effaddr *ea; /**< Effective address for memory references. */ + yasm_expr *val; /**< Value of immediate or jump target. */ + } data; + + yasm_expr *seg; /**< Segment expression */ + + uintptr_t targetmod; /**< Arch target modifier, 0 if none. */ + + /** Specified size of the operand, in bits. 0 if not user-specified. */ + unsigned int size:16; + + /** Nonzero if dereference. Used for "*foo" in GAS. + * The reason for this is that by default in GAS, an unprefixed value + * is a memory address, except for jumps/calls, in which case it needs a + * "*" prefix to become a memory address (otherwise it's an immediate). + * This isn't knowable in the parser stage, so the parser sets this flag + * to indicate the "*" prefix has been used, and the arch needs to adjust + * the operand type appropriately depending on the instruction type. + */ + unsigned int deref:1; + + /** Nonzero if strict. Used for "strict foo" in NASM. + * This is used to inhibit optimization on otherwise "sized" values. + * For example, the user may just want to be explicit with the size on + * "push dword 4", but not actually want to force the immediate size to + * 4 bytes (rather wanting the optimizer to optimize it down to 1 byte as + * though "dword" was not specified). To indicate the immediate should + * actually be forced to 4 bytes, the user needs to write + * "push strict dword 4", which sets this flag. + */ + unsigned int strict:1; + + /** Operand type. */ + unsigned int type:4; +}; + +/** Base structure for "instruction" bytecodes. These are the mnenomic + * (rather than raw) representation of instructions. As with all base + * structures, must be present as the first element in any + * #yasm_arch implementation of mnenomic instruction bytecodes. + */ +struct yasm_insn { + /** Linked list of operands. */ + /*@reldef@*/ STAILQ_HEAD(yasm_insn_operands, yasm_insn_operand) operands; + + /** Array of prefixes. */ + /*@null@*/ uintptr_t *prefixes; + + /** Array of segment prefixes. */ + /*@null@*/ uintptr_t *segregs; + + unsigned int num_operands; /**< Number of operands. */ + unsigned int num_prefixes; /**< Number of prefixes. */ + unsigned int num_segregs; /**< Number of segment prefixes. */ +}; + +/** Set segment override for an effective address. + * Some architectures (such as x86) support segment overrides on effective + * addresses. A override of an override will result in a warning. + * \param ea effective address + * \param segreg segment register (0 if none) + */ +YASM_LIB_DECL +void yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg); + +/** Create an instruction operand from a register. + * \param reg register + * \return Newly allocated operand. + */ +YASM_LIB_DECL +yasm_insn_operand *yasm_operand_create_reg(uintptr_t reg); + +/** Create an instruction operand from a segment register. + * \param segreg segment register + * \return Newly allocated operand. + */ +YASM_LIB_DECL +yasm_insn_operand *yasm_operand_create_segreg(uintptr_t segreg); + +/** Create an instruction operand from an effective address. + * \param ea effective address + * \return Newly allocated operand. + */ +YASM_LIB_DECL +yasm_insn_operand *yasm_operand_create_mem(/*@only@*/ yasm_effaddr *ea); + +/** Create an instruction operand from an immediate expression. + * Looks for cases of a single register and creates a register variant of + * #yasm_insn_operand. + * \param val immediate expression + * \return Newly allocated operand. + */ +YASM_LIB_DECL +yasm_insn_operand *yasm_operand_create_imm(/*@only@*/ yasm_expr *val); + +/** Get the first operand in an instruction. + * \param insn instruction + * \return First operand (NULL if no operands). + */ +yasm_insn_operand *yasm_insn_ops_first(yasm_insn *insn); +#define yasm_insn_ops_first(insn) STAILQ_FIRST(&((insn)->operands)) + +/** Get the next operand in an instruction. + * \param op previous operand + * \return Next operand (NULL if op was the last operand). + */ +yasm_insn_operand *yasm_insn_op_next(yasm_insn_operand *op); +#define yasm_insn_op_next(cur) STAILQ_NEXT(cur, link) + +/** Add operand to the end of an instruction. + * \note Does not make a copy of the operand; so don't pass this function + * static or local variables, and discard the op pointer after calling + * this function. + * \param insn instruction + * \param op operand (may be NULL) + * \return If operand was actually appended (it wasn't NULL), the operand; + * otherwise NULL. + */ +YASM_LIB_DECL +/*@null@*/ yasm_insn_operand *yasm_insn_ops_append + (yasm_insn *insn, + /*@returned@*/ /*@null@*/ yasm_insn_operand *op); + +/** Associate a prefix with an instruction. + * \param insn instruction + * \param prefix data that identifies the prefix + */ +YASM_LIB_DECL +void yasm_insn_add_prefix(yasm_insn *insn, uintptr_t prefix); + +/** Associate a segment prefix with an instruction. + * \param insn instruction + * \param segreg data that identifies the segment register + */ +YASM_LIB_DECL +void yasm_insn_add_seg_prefix(yasm_insn *insn, uintptr_t segreg); + +/** Initialize the common parts of an instruction. + * \internal For use by yasm_arch implementations only. + * \param insn instruction + */ +YASM_LIB_DECL +void yasm_insn_initialize(/*@out@*/ yasm_insn *insn); + +/** Delete the common parts of an instruction. + * \internal For use by yasm_arch implementations only. + * \param insn instruction + * \param content if nonzero, deletes content of each operand + * \param arch architecture + */ +YASM_LIB_DECL +void yasm_insn_delete(yasm_insn *insn, + void (*ea_destroy) (/*@only@*/ yasm_effaddr *)); + +/** Print a list of instruction operands. For debugging purposes. + * \internal For use by yasm_arch implementations only. + * \param insn instruction + * \param f file + * \param indent_level indentation level + * \param arch architecture + */ +YASM_LIB_DECL +void yasm_insn_print(const yasm_insn *insn, FILE *f, int indent_level); + +/** Finalize the common parts of an instruction. + * \internal For use by yasm_arch implementations only. + * \param insn instruction + */ +YASM_LIB_DECL +void yasm_insn_finalize(yasm_insn *insn); + +#endif diff --git a/libyasm/intnum.c b/libyasm/intnum.c index 2132733f..794c0723 100644 --- a/libyasm/intnum.c +++ b/libyasm/intnum.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include #include @@ -40,14 +38,14 @@ /* "Native" "word" size for intnum calculations. */ -#define BITVECT_NATIVE_SIZE 128 +#define BITVECT_NATIVE_SIZE 256 struct yasm_intnum { union val { - unsigned long ul; /* integer value (for integers <=32 bits) */ - wordptr bv; /* bit vector (for integers >32 bits) */ + long l; /* integer value (for integers <32 bits) */ + wordptr bv; /* bit vector (for integers >=32 bits) */ } val; - enum { INTNUM_UL, INTNUM_BV } type; + enum { INTNUM_L, INTNUM_BV } type; }; /* static bitvect used for conversions */ @@ -81,6 +79,55 @@ yasm_intnum_cleanup(void) BitVector_Destroy(conv_bv); } +/* Compress a bitvector into intnum storage. + * If saved as a bitvector, clones the passed bitvector. + * Can modify the passed bitvector. + */ +static void +intnum_frombv(/*@out@*/ yasm_intnum *intn, wordptr bv) +{ + if (Set_Max(bv) < 31) { + intn->type = INTNUM_L; + intn->val.l = (long)BitVector_Chunk_Read(bv, 31, 0); + } else if (BitVector_msb_(bv)) { + /* Negative, negate and see if we'll fit into a long. */ + unsigned long ul; + BitVector_Negate(bv, bv); + if (Set_Max(bv) >= 32 || + ((ul = BitVector_Chunk_Read(bv, 32, 0)) & 0x80000000)) { + /* too negative */ + BitVector_Negate(bv, bv); + intn->type = INTNUM_BV; + intn->val.bv = BitVector_Clone(bv); + } else { + intn->type = INTNUM_L; + intn->val.l = -((long)ul); + } + } else { + intn->type = INTNUM_BV; + intn->val.bv = BitVector_Clone(bv); + } +} + +/* If intnum is a BV, returns its bitvector directly. + * If not, converts into passed bv and returns that instead. + */ +static wordptr +intnum_tobv(/*@returned@*/ wordptr bv, const yasm_intnum *intn) +{ + if (intn->type == INTNUM_BV) + return intn->val.bv; + + BitVector_Empty(bv); + if (intn->val.l >= 0) + BitVector_Chunk_Store(bv, 32, 0, (unsigned long)intn->val.l); + else { + BitVector_Chunk_Store(bv, 32, 0, (unsigned long)-intn->val.l); + BitVector_Negate(bv, bv); + } + return bv; +} + yasm_intnum * yasm_intnum_create_dec(char *str) { @@ -98,14 +145,7 @@ yasm_intnum_create_dec(char *str) default: break; } - if (Set_Max(conv_bv) < 32) { - intn->type = INTNUM_UL; - intn->val.ul = BitVector_Chunk_Read(conv_bv, 32, 0); - } else { - intn->type = INTNUM_BV; - intn->val.bv = BitVector_Clone(conv_bv); - } - + intnum_frombv(intn, conv_bv); return intn; } @@ -125,14 +165,7 @@ yasm_intnum_create_bin(char *str) default: break; } - if (Set_Max(conv_bv) < 32) { - intn->type = INTNUM_UL; - intn->val.ul = BitVector_Chunk_Read(conv_bv, 32, 0); - } else { - intn->type = INTNUM_BV; - intn->val.bv = BitVector_Clone(conv_bv); - } - + intnum_frombv(intn, conv_bv); return intn; } @@ -152,14 +185,7 @@ yasm_intnum_create_oct(char *str) default: break; } - if (Set_Max(conv_bv) < 32) { - intn->type = INTNUM_UL; - intn->val.ul = BitVector_Chunk_Read(conv_bv, 32, 0); - } else { - intn->type = INTNUM_BV; - intn->val.bv = BitVector_Clone(conv_bv); - } - + intnum_frombv(intn, conv_bv); return intn; } @@ -179,14 +205,7 @@ yasm_intnum_create_hex(char *str) default: break; } - if (Set_Max(conv_bv) < 32) { - intn->type = INTNUM_UL; - intn->val.ul = BitVector_Chunk_Read(conv_bv, 32, 0); - } else { - intn->type = INTNUM_BV; - intn->val.bv = BitVector_Clone(conv_bv); - } - + intnum_frombv(intn, conv_bv); return intn; } @@ -201,37 +220,82 @@ yasm_intnum_create_charconst_nasm(const char *str) yasm_error_set(YASM_ERROR_OVERFLOW, N_("Character constant too large for internal format")); - if (len > 4) { + /* be conservative in choosing bitvect in case MSB is set */ + if (len > 3) { BitVector_Empty(conv_bv); intn->type = INTNUM_BV; } else { - intn->val.ul = 0; - intn->type = INTNUM_UL; + intn->val.l = 0; + intn->type = INTNUM_L; } switch (len) { - case 4: - intn->val.ul |= ((unsigned long)str[3]) & 0xff; - intn->val.ul <<= 8; - /*@fallthrough@*/ case 3: - intn->val.ul |= ((unsigned long)str[2]) & 0xff; - intn->val.ul <<= 8; + intn->val.l |= ((unsigned long)str[2]) & 0xff; + intn->val.l <<= 8; /*@fallthrough@*/ case 2: - intn->val.ul |= ((unsigned long)str[1]) & 0xff; - intn->val.ul <<= 8; + intn->val.l |= ((unsigned long)str[1]) & 0xff; + intn->val.l <<= 8; /*@fallthrough@*/ case 1: - intn->val.ul |= ((unsigned long)str[0]) & 0xff; + intn->val.l |= ((unsigned long)str[0]) & 0xff; case 0: break; default: - /* >32 bit conversion */ + /* >=32 bit conversion */ while (len) { BitVector_Move_Left(conv_bv, 8); BitVector_Chunk_Store(conv_bv, 8, 0, - (unsigned long)str[--len]); + ((unsigned long)str[--len]) & 0xff); + } + intn->val.bv = BitVector_Clone(conv_bv); + } + + return intn; +} + +yasm_intnum * +yasm_intnum_create_charconst_tasm(const char *str) +{ + yasm_intnum *intn = yasm_xmalloc(sizeof(yasm_intnum)); + size_t len = strlen(str); + size_t i; + + if(len*8 > BITVECT_NATIVE_SIZE) + yasm_error_set(YASM_ERROR_OVERFLOW, + N_("Character constant too large for internal format")); + + /* be conservative in choosing bitvect in case MSB is set */ + if (len > 3) { + BitVector_Empty(conv_bv); + intn->type = INTNUM_BV; + } else { + intn->val.l = 0; + intn->type = INTNUM_L; + } + + /* tasm uses big endian notation */ + i = 0; + switch (len) { + case 3: + intn->val.l |= ((unsigned long)str[i++]) & 0xff; + intn->val.l <<= 8; + /*@fallthrough@*/ + case 2: + intn->val.l |= ((unsigned long)str[i++]) & 0xff; + intn->val.l <<= 8; + /*@fallthrough@*/ + case 1: + intn->val.l |= ((unsigned long)str[i++]) & 0xff; + case 0: + break; + default: + /* >=32 bit conversion */ + while (i < len) { + BitVector_Chunk_Store(conv_bv, 8, (len-i-1)*8, + ((unsigned long)str[i]) & 0xff); + i++; } intn->val.bv = BitVector_Clone(conv_bv); } @@ -245,8 +309,15 @@ yasm_intnum_create_uint(unsigned long i) { yasm_intnum *intn = yasm_xmalloc(sizeof(yasm_intnum)); - intn->val.ul = i; - intn->type = INTNUM_UL; + if (i > LONG_MAX) { + /* Too big, store as bitvector */ + intn->val.bv = BitVector_Create(BITVECT_NATIVE_SIZE, TRUE); + intn->type = INTNUM_BV; + BitVector_Chunk_Store(intn->val.bv, 32, 0, i); + } else { + intn->val.l = (long)i; + intn->type = INTNUM_L; + } return intn; } @@ -254,19 +325,10 @@ yasm_intnum_create_uint(unsigned long i) yasm_intnum * yasm_intnum_create_int(long i) { - yasm_intnum *intn; + yasm_intnum *intn = yasm_xmalloc(sizeof(yasm_intnum)); - /* positive numbers can go through the uint() function */ - if (i >= 0) - return yasm_intnum_create_uint((unsigned long)i); - - BitVector_Empty(conv_bv); - BitVector_Chunk_Store(conv_bv, 32, 0, (unsigned long)(-i)); - BitVector_Negate(conv_bv, conv_bv); - - intn = yasm_xmalloc(sizeof(yasm_intnum)); - intn->val.bv = BitVector_Clone(conv_bv); - intn->type = INTNUM_BV; + intn->val.l = i; + intn->type = INTNUM_L; return intn; } @@ -296,14 +358,7 @@ yasm_intnum_create_leb128(const unsigned char *ptr, int sign, else if (sign && (*ptr & 0x40) == 0x40) BitVector_Interval_Fill(conv_bv, i, BITVECT_NATIVE_SIZE-1); - if (Set_Max(conv_bv) < 32) { - intn->type = INTNUM_UL; - intn->val.ul = BitVector_Chunk_Read(conv_bv, 32, 0); - } else { - intn->type = INTNUM_BV; - intn->val.bv = BitVector_Clone(conv_bv); - } - + intnum_frombv(intn, conv_bv); return intn; } @@ -329,17 +384,10 @@ yasm_intnum_create_sized(unsigned char *ptr, int sign, size_t srcsize, } /* Sign extend if needed */ - if (srcsize*8 < BITVECT_NATIVE_SIZE && sign && (ptr[i] & 0x80) == 0x80) + if (srcsize*8 < BITVECT_NATIVE_SIZE && sign && (ptr[i-1] & 0x80) == 0x80) BitVector_Interval_Fill(conv_bv, i*8, BITVECT_NATIVE_SIZE-1); - if (Set_Max(conv_bv) < 32) { - intn->type = INTNUM_UL; - intn->val.ul = BitVector_Chunk_Read(conv_bv, 32, 0); - } else { - intn->type = INTNUM_BV; - intn->val.bv = BitVector_Clone(conv_bv); - } - + intnum_frombv(intn, conv_bv); return intn; } @@ -349,8 +397,8 @@ yasm_intnum_copy(const yasm_intnum *intn) yasm_intnum *n = yasm_xmalloc(sizeof(yasm_intnum)); switch (intn->type) { - case INTNUM_UL: - n->val.ul = intn->val.ul; + case INTNUM_L: + n->val.l = intn->val.l; break; case INTNUM_BV: n->val.bv = BitVector_Clone(intn->val.bv); @@ -364,6 +412,8 @@ yasm_intnum_copy(const yasm_intnum *intn) void yasm_intnum_destroy(yasm_intnum *intn) { + if (intn == NULL) + return; if (intn->type == INTNUM_BV) BitVector_Destroy(intn->val.bv); yasm_xfree(intn); @@ -380,23 +430,9 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand) /* Always do computations with in full bit vector. * Bit vector results must be calculated through intermediate storage. */ - if (acc->type == INTNUM_BV) - op1 = acc->val.bv; - else { - op1 = op1static; - BitVector_Empty(op1); - BitVector_Chunk_Store(op1, 32, 0, acc->val.ul); - } - - if (operand) { - if (operand->type == INTNUM_BV) - op2 = operand->val.bv; - else { - op2 = op2static; - BitVector_Empty(op2); - BitVector_Chunk_Store(op2, 32, 0, operand->val.ul); - } - } + op1 = intnum_tobv(op1static, acc); + if (operand) + op2 = intnum_tobv(op2static, operand); if (!operand && op != YASM_EXPR_NEG && op != YASM_EXPR_NOT && op != YASM_EXPR_LNOT) { @@ -475,17 +511,17 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand) Set_Complement(result, result); break; case YASM_EXPR_SHL: - if (operand->type == INTNUM_UL) { + if (operand->type == INTNUM_L && operand->val.l >= 0) { BitVector_Copy(result, op1); - BitVector_Move_Left(result, (N_int)operand->val.ul); + BitVector_Move_Left(result, (N_int)operand->val.l); } else /* don't even bother, just zero result */ BitVector_Empty(result); break; case YASM_EXPR_SHR: - if (operand->type == INTNUM_UL) { + if (operand->type == INTNUM_L && operand->val.l >= 0) { BitVector_Copy(result, op1); carry = BitVector_msb_(op1); - count = (N_int)operand->val.ul; + count = (N_int)operand->val.l; while (count-- > 0) BitVector_shift_right(result, carry); } else /* don't even bother, just zero result */ @@ -568,85 +604,116 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand) } /* Try to fit the result into 32 bits if possible */ - if (Set_Max(result) < 32) { - if (acc->type == INTNUM_BV) { - BitVector_Destroy(acc->val.bv); - acc->type = INTNUM_UL; - } - acc->val.ul = BitVector_Chunk_Read(result, 32, 0); - } else { - if (acc->type == INTNUM_BV) { - BitVector_Copy(acc->val.bv, result); - } else { - acc->type = INTNUM_BV; - acc->val.bv = BitVector_Clone(result); - } - } + if (acc->type == INTNUM_BV) + BitVector_Destroy(acc->val.bv); + intnum_frombv(acc, result); return 0; } /*@=nullderef =nullpass =branchstate@*/ +int +yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2) +{ + wordptr op1, op2; + + if (intn1->type == INTNUM_L && intn2->type == INTNUM_L) { + if (intn1->val.l < intn2->val.l) + return -1; + if (intn1->val.l > intn2->val.l) + return 1; + return 0; + } + + op1 = intnum_tobv(op1static, intn1); + op2 = intnum_tobv(op2static, intn2); + return BitVector_Compare(op1, op2); +} + void yasm_intnum_zero(yasm_intnum *intn) { - yasm_intnum_set_uint(intn, 0); + yasm_intnum_set_int(intn, 0); +} + +void +yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val) +{ + if (intn->type == val->type) { + switch (val->type) { + case INTNUM_L: + intn->val.l = val->val.l; + break; + case INTNUM_BV: + BitVector_Copy(intn->val.bv, val->val.bv); + break; + } + } else { + switch (val->type) { + case INTNUM_L: + BitVector_Destroy(intn->val.bv); + intn->val.l = val->val.l; + break; + case INTNUM_BV: + intn->val.bv = BitVector_Clone(val->val.bv); + break; + } + intn->type = val->type; + } } void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val) { - if (intn->type == INTNUM_BV) { - BitVector_Destroy(intn->val.bv); - intn->type = INTNUM_UL; + if (val > LONG_MAX) { + if (intn->type != INTNUM_BV) { + intn->val.bv = BitVector_Create(BITVECT_NATIVE_SIZE, TRUE); + intn->type = INTNUM_BV; + } + BitVector_Chunk_Store(intn->val.bv, 32, 0, val); + } else { + if (intn->type == INTNUM_BV) { + BitVector_Destroy(intn->val.bv); + intn->type = INTNUM_L; + } + intn->val.l = (long)val; } - intn->val.ul = val; } void yasm_intnum_set_int(yasm_intnum *intn, long val) { - /* positive numbers can go through the uint() function */ - if (val >= 0) { - yasm_intnum_set_uint(intn, (unsigned long)val); - return; - } - - BitVector_Empty(conv_bv); - BitVector_Chunk_Store(conv_bv, 32, 0, (unsigned long)(-val)); - BitVector_Negate(conv_bv, conv_bv); - if (intn->type == INTNUM_BV) - BitVector_Copy(intn->val.bv, conv_bv); - else { - intn->val.bv = BitVector_Clone(conv_bv); - intn->type = INTNUM_BV; - } + BitVector_Destroy(intn->val.bv); + intn->type = INTNUM_L; + intn->val.l = val; } int yasm_intnum_is_zero(const yasm_intnum *intn) { - return (intn->type == INTNUM_UL && intn->val.ul == 0); + return (intn->type == INTNUM_L && intn->val.l == 0); } int yasm_intnum_is_pos1(const yasm_intnum *intn) { - return (intn->type == INTNUM_UL && intn->val.ul == 1); + return (intn->type == INTNUM_L && intn->val.l == 1); } int yasm_intnum_is_neg1(const yasm_intnum *intn) { - return (intn->type == INTNUM_BV && BitVector_is_full(intn->val.bv)); + return (intn->type == INTNUM_L && intn->val.l == -1); } int yasm_intnum_sign(const yasm_intnum *intn) { - if (intn->type == INTNUM_UL) { - if (intn->val.ul == 0) + if (intn->type == INTNUM_L) { + if (intn->val.l == 0) return 0; + else if (intn->val.l < 0) + return -1; else return 1; } else @@ -657,9 +724,15 @@ unsigned long yasm_intnum_get_uint(const yasm_intnum *intn) { switch (intn->type) { - case INTNUM_UL: - return intn->val.ul; + case INTNUM_L: + if (intn->val.l < 0) + return 0; + return (unsigned long)intn->val.l; case INTNUM_BV: + if (BitVector_msb_(intn->val.bv)) + return 0; + if (Set_Max(intn->val.bv) > 32) + return ULONG_MAX; return BitVector_Chunk_Read(intn->val.bv, 32, 0); default: yasm_internal_error(N_("unknown intnum type")); @@ -672,9 +745,8 @@ long yasm_intnum_get_int(const yasm_intnum *intn) { switch (intn->type) { - case INTNUM_UL: - /* unsigned long values are always positive; max out if needed */ - return (intn->val.ul & 0x80000000) ? LONG_MAX : (long)intn->val.ul; + case INTNUM_L: + return intn->val.l; case INTNUM_BV: if (BitVector_msb_(intn->val.bv)) { /* it's negative: negate the bitvector to get a positive @@ -733,13 +805,7 @@ yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr, BitVector_Block_Store(op1, ptr, (N_int)destsize); /* If not already a bitvect, convert value to be written to a bitvect */ - if (intn->type == INTNUM_BV) - op2 = intn->val.bv; - else { - op2 = op2static; - BitVector_Empty(op2); - BitVector_Chunk_Store(op2, 32, 0, intn->val.ul); - } + op2 = intnum_tobv(op2static, intn); /* Check low bits if right shifting and warnings enabled */ if (warn && rshift > 0) { @@ -785,11 +851,8 @@ yasm_intnum_check_size(const yasm_intnum *intn, size_t size, size_t rshift, BitVector_Copy(val, intn->val.bv); } else val = intn->val.bv; - } else { - val = conv_bv; - BitVector_Empty(val); - BitVector_Chunk_Store(val, 32, 0, intn->val.ul); - } + } else + val = intnum_tobv(conv_bv, intn); if (size >= BITVECT_NATIVE_SIZE) return 1; @@ -821,18 +884,10 @@ yasm_intnum_check_size(const yasm_intnum *intn, size_t size, size_t rshift, int yasm_intnum_in_range(const yasm_intnum *intn, long low, long high) { - wordptr val = result; + wordptr val = intnum_tobv(result, intn); wordptr lval = op1static; wordptr hval = op2static; - /* If not already a bitvect, convert value to be written to a bitvect */ - if (intn->type == INTNUM_BV) - val = intn->val.bv; - else { - BitVector_Empty(val); - BitVector_Chunk_Store(val, 32, 0, intn->val.ul); - } - /* Convert high and low to bitvects */ BitVector_Empty(lval); if (low >= 0) @@ -908,21 +963,16 @@ size_leb128(wordptr val, int sign) unsigned long yasm_intnum_get_leb128(const yasm_intnum *intn, unsigned char *ptr, int sign) { - wordptr val = op1static; + wordptr val; /* Shortcut 0 */ - if (intn->type == INTNUM_UL && intn->val.ul == 0) { + if (intn->type == INTNUM_L && intn->val.l == 0) { *ptr = 0; return 1; } /* If not already a bitvect, convert value to be written to a bitvect */ - if (intn->type == INTNUM_BV) - val = intn->val.bv; - else { - BitVector_Empty(val); - BitVector_Chunk_Store(val, 32, 0, intn->val.ul); - } + val = intnum_tobv(op1static, intn); return get_leb128(val, ptr, sign); } @@ -930,20 +980,15 @@ yasm_intnum_get_leb128(const yasm_intnum *intn, unsigned char *ptr, int sign) unsigned long yasm_intnum_size_leb128(const yasm_intnum *intn, int sign) { - wordptr val = op1static; + wordptr val; /* Shortcut 0 */ - if (intn->type == INTNUM_UL && intn->val.ul == 0) { + if (intn->type == INTNUM_L && intn->val.l == 0) { return 1; } /* If not already a bitvect, convert value to a bitvect */ - if (intn->type == INTNUM_BV) - val = intn->val.bv; - else { - BitVector_Empty(val); - BitVector_Chunk_Store(val, 32, 0, intn->val.ul); - } + val = intnum_tobv(op1static, intn); return size_leb128(val, sign); } @@ -1022,9 +1067,9 @@ yasm_intnum_get_str(const yasm_intnum *intn) unsigned char *s; switch (intn->type) { - case INTNUM_UL: + case INTNUM_L: s = yasm_xmalloc(16); - sprintf((char *)s, "%lu", intn->val.ul); + sprintf((char *)s, "%ld", intn->val.l); return (char *)s; break; case INTNUM_BV: @@ -1041,8 +1086,8 @@ yasm_intnum_print(const yasm_intnum *intn, FILE *f) unsigned char *s; switch (intn->type) { - case INTNUM_UL: - fprintf(f, "0x%lx", intn->val.ul); + case INTNUM_L: + fprintf(f, "0x%lx", intn->val.l); break; case INTNUM_BV: s = BitVector_to_Hex(intn->val.bv); diff --git a/libyasm/intnum.h b/libyasm/intnum.h index 36cb6fea..bec832cf 100644 --- a/libyasm/intnum.h +++ b/libyasm/intnum.h @@ -2,10 +2,6 @@ * \file libyasm/intnum.h * \brief YASM integer number interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,54 +30,76 @@ #ifndef YASM_INTNUM_H #define YASM_INTNUM_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Initialize intnum internal data structures. */ +YASM_LIB_DECL void yasm_intnum_initialize(void); /** Clean up internal intnum allocations. */ +YASM_LIB_DECL void yasm_intnum_cleanup(void); /** Create a new intnum from a decimal string. * \param str decimal string * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_dec(char *str); /** Create a new intnum from a binary string. * \param str binary string * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_bin(char *str); /** Create a new intnum from an octal string. * \param str octal string * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_oct(char *str); /** Create a new intnum from a hexidecimal string. * \param str hexidecimal string * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_hex(char *str); /** Convert character constant to integer value, using NASM rules. NASM syntax * supports automatic conversion from strings such as 'abcd' to a 32-bit - * integer value. This function performs those conversions. + * integer value (little endian order). This function performs those conversions. * \param str character constant string * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_charconst_nasm(const char *str); +/** Convert character constant to integer value, using TASM rules. TASM syntax + * supports automatic conversion from strings such as 'abcd' to a 32-bit + * integer value (big endian order). This function performs those conversions. + * \param str character constant string + * \return Newly allocated intnum. + */ +YASM_LIB_DECL +/*@only@*/ yasm_intnum *yasm_intnum_create_charconst_tasm(const char *str); + /** Create a new intnum from an unsigned integer value. * \param i unsigned integer value * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_uint(unsigned long i); /** Create a new intnum from an signed integer value. * \param i signed integer value * \return Newly allocated intnum. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_int(long i); /** Create a new intnum from LEB128-encoded form. @@ -91,6 +109,7 @@ void yasm_intnum_cleanup(void); * \return Newly allocated intnum. Number of bytes read returned into * bytes_read parameter. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_leb128 (const unsigned char *ptr, int sign, /*@out@*/ unsigned long *size); @@ -101,6 +120,7 @@ void yasm_intnum_cleanup(void); * \param srcsize source buffer size (in bytes) * \param bigendian endianness (nonzero=big, zero=little) */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_create_sized (unsigned char *ptr, int sign, size_t srcsize, int bigendian); @@ -108,11 +128,13 @@ void yasm_intnum_cleanup(void); * \param intn intnum * \return Newly allocated intnum with the same value as intn. */ +YASM_LIB_DECL /*@only@*/ yasm_intnum *yasm_intnum_copy(const yasm_intnum *intn); /** Destroy (free allocated memory for) an intnum. * \param intn intnum */ +YASM_LIB_DECL void yasm_intnum_destroy(/*@only@*/ yasm_intnum *intn); /** Floating point calculation function: acc = acc op operand. @@ -123,47 +145,70 @@ void yasm_intnum_destroy(/*@only@*/ yasm_intnum *intn); * \param operand intnum operand * \return Nonzero if error occurred. */ +YASM_LIB_DECL int yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand); +/** Compare two intnums. + * \param intn1 first intnum + * \param intn2 second intnum + * \return -1 if intn1 < intn2, 0 if intn1 == intn2, 1 if intn1 > intn2. + */ +YASM_LIB_DECL +int yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2); + /** Zero an intnum. * \param intn intnum */ +YASM_LIB_DECL void yasm_intnum_zero(yasm_intnum *intn); +/** Set an intnum to the value of another intnum. + * \param intn intnum + * \param val intnum to get value from + */ +YASM_LIB_DECL +void yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val); + /** Set an intnum to an unsigned integer. * \param intn intnum * \param val integer value */ +YASM_LIB_DECL void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val); /** Set an intnum to an signed integer. * \param intn intnum * \param val integer value */ +YASM_LIB_DECL void yasm_intnum_set_int(yasm_intnum *intn, long val); /** Simple value check for 0. * \param acc intnum * \return Nonzero if acc==0. */ +YASM_LIB_DECL int yasm_intnum_is_zero(const yasm_intnum *acc); /** Simple value check for 1. * \param acc intnum * \return Nonzero if acc==1. */ +YASM_LIB_DECL int yasm_intnum_is_pos1(const yasm_intnum *acc); /** Simple value check for -1. * \param acc intnum * \return Nonzero if acc==-1. */ +YASM_LIB_DECL int yasm_intnum_is_neg1(const yasm_intnum *acc); /** Simple sign check. * \param acc intnum * \return -1 if negative, 0 if zero, +1 if positive */ +YASM_LIB_DECL int yasm_intnum_sign(const yasm_intnum *acc); /** Convert an intnum to an unsigned 32-bit value. The value is in "standard" @@ -173,6 +218,7 @@ int yasm_intnum_sign(const yasm_intnum *acc); * \param intn intnum * \return Unsigned 32-bit value of intn. */ +YASM_LIB_DECL unsigned long yasm_intnum_get_uint(const yasm_intnum *intn); /** Convert an intnum to a signed 32-bit value. The value is in "standard" C @@ -182,6 +228,7 @@ unsigned long yasm_intnum_get_uint(const yasm_intnum *intn); * \param intn intnum * \return Signed 32-bit value of intn. */ +YASM_LIB_DECL long yasm_intnum_get_int(const yasm_intnum *intn); /** Output #yasm_intnum to buffer in little-endian or big-endian. Puts the @@ -198,6 +245,7 @@ long yasm_intnum_get_int(const yasm_intnum *intn); * \param warn enables standard warnings (value doesn't fit into valsize * bits): <0=signed warnings, >0=unsigned warnings, 0=no warn */ +YASM_LIB_DECL void yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr, size_t destsize, size_t valsize, int shift, int bigendian, int warn); @@ -212,6 +260,7 @@ void yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr, * 2 => (signed min, unsigned max) * \return Nonzero if intnum will fit. */ +YASM_LIB_DECL int yasm_intnum_check_size(const yasm_intnum *intn, size_t size, size_t rshift, int rangetype); @@ -221,6 +270,7 @@ int yasm_intnum_check_size(const yasm_intnum *intn, size_t size, * \param high high end of range (inclusive) * \return Nonzero if intnum is within range. */ +YASM_LIB_DECL int yasm_intnum_in_range(const yasm_intnum *intn, long low, long high); /** Output #yasm_intnum to buffer in LEB128-encoded form. @@ -229,6 +279,7 @@ int yasm_intnum_in_range(const yasm_intnum *intn, long low, long high); * \param sign signedness of LEB128 encoding (0=unsigned, 1=signed) * \return Number of bytes generated. */ +YASM_LIB_DECL unsigned long yasm_intnum_get_leb128(const yasm_intnum *intn, unsigned char *ptr, int sign); @@ -237,6 +288,7 @@ unsigned long yasm_intnum_get_leb128(const yasm_intnum *intn, * \param sign signedness of LEB128 encoding (0=unsigned, 1=signed) * \return Number of bytes. */ +YASM_LIB_DECL unsigned long yasm_intnum_size_leb128(const yasm_intnum *intn, int sign); /** Output integer to buffer in signed LEB128-encoded form. @@ -244,12 +296,14 @@ unsigned long yasm_intnum_size_leb128(const yasm_intnum *intn, int sign); * \param ptr pointer to storage for output bytes * \return Number of bytes generated. */ +YASM_LIB_DECL unsigned long yasm_get_sleb128(long v, unsigned char *ptr); /** Calculate number of bytes signed LEB128-encoded form of integer will take. * \param v integer * \return Number of bytes. */ +YASM_LIB_DECL unsigned long yasm_size_sleb128(long v); /** Output integer to buffer in unsigned LEB128-encoded form. @@ -257,12 +311,14 @@ unsigned long yasm_size_sleb128(long v); * \param ptr pointer to storage for output bytes * \return Number of bytes generated. */ +YASM_LIB_DECL unsigned long yasm_get_uleb128(unsigned long v, unsigned char *ptr); /** Calculate number of bytes unsigned LEB128-encoded form of integer will take. * \param v integer * \return Number of bytes. */ +YASM_LIB_DECL unsigned long yasm_size_uleb128(unsigned long v); /** Get an intnum as a signed decimal string. The returned string will @@ -271,12 +327,14 @@ unsigned long yasm_size_uleb128(unsigned long v); * \return Newly allocated string containing the decimal representation of * the intnum. */ +YASM_LIB_DECL /*@only@*/ char *yasm_intnum_get_str(const yasm_intnum *intn); /** Print an intnum. For debugging purposes. * \param f file * \param intn intnum */ +YASM_LIB_DECL void yasm_intnum_print(const yasm_intnum *intn, FILE *f); #endif diff --git a/libyasm/inttree.c b/libyasm/inttree.c index 2c408f1c..2ae10e9b 100644 --- a/libyasm/inttree.c +++ b/libyasm/inttree.c @@ -1,6 +1,4 @@ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include #include @@ -493,7 +491,8 @@ void IT_destroy(IntervalTree *it) { IntervalTreeNode *x = it->root->left; - SLIST_HEAD(, nodeent) stuffToFree = SLIST_HEAD_INITIALIZER(stuffToFree); + SLIST_HEAD(node_head, nodeent) + stuffToFree = SLIST_HEAD_INITIALIZER(stuffToFree); struct nodeent { SLIST_ENTRY(nodeent) link; struct IntervalTreeNode *node; diff --git a/libyasm/inttree.h b/libyasm/inttree.h index 972f5713..f7a76515 100644 --- a/libyasm/inttree.h +++ b/libyasm/inttree.h @@ -1,7 +1,10 @@ -/* $Id$ */ #ifndef YASM_INTTREE_H #define YASM_INTTREE_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /* The interval_tree.h and interval_tree.cc files contain code for * interval trees implemented using red-black-trees as described in * the book _Introduction_To_Algorithms_ by Cormen, Leisserson, @@ -45,14 +48,22 @@ typedef struct IntervalTree { unsigned int recursionNodeStackTop; } IntervalTree; +YASM_LIB_DECL IntervalTree *IT_create(void); +YASM_LIB_DECL void IT_destroy(IntervalTree *); +YASM_LIB_DECL void IT_print(const IntervalTree *); +YASM_LIB_DECL void *IT_delete_node(IntervalTree *, IntervalTreeNode *, long *low, long *high); +YASM_LIB_DECL IntervalTreeNode *IT_insert(IntervalTree *, long low, long high, void *data); +YASM_LIB_DECL IntervalTreeNode *IT_get_predecessor(const IntervalTree *, IntervalTreeNode *); +YASM_LIB_DECL IntervalTreeNode *IT_get_successor(const IntervalTree *, IntervalTreeNode *); +YASM_LIB_DECL void IT_enumerate(IntervalTree *, long low, long high, void *cbd, void (*callback) (IntervalTreeNode *node, void *cbd)); diff --git a/libyasm/linemap.c b/libyasm/linemap.c index e2ff9300..42201d3c 100644 --- a/libyasm/linemap.c +++ b/libyasm/linemap.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "coretype.h" #include "hamt.h" @@ -35,13 +33,6 @@ #include "linemap.h" -/* Source lines tracking */ -typedef struct { - struct line_mapping *vector; - unsigned long size; - unsigned long allocated; -} line_mapping_head; - typedef struct line_mapping { /* monotonically increasing virtual line */ unsigned long line; @@ -71,7 +62,9 @@ struct yasm_linemap { unsigned long current; /* Mappings from virtual to physical line numbers */ - /*@only@*/ /*@null@*/ line_mapping_head *map; + struct line_mapping *map_vector; + unsigned long map_size; + unsigned long map_allocated; /* Bytecode and source line information */ /*@only@*/ line_source_info *source_info; @@ -86,29 +79,47 @@ filename_delete_one(/*@only@*/ void *d) void yasm_linemap_set(yasm_linemap *linemap, const char *filename, - unsigned long file_line, unsigned long line_inc) + unsigned long virtual_line, unsigned long file_line, + unsigned long line_inc) { char *copy; + unsigned long i; int replace = 0; - line_mapping *mapping; + line_mapping *mapping = NULL; - /* Create a new mapping in the map */ - if (linemap->map->size >= linemap->map->allocated) { - /* allocate another size bins when full for 2x space */ - linemap->map->vector = - yasm_xrealloc(linemap->map->vector, 2*linemap->map->allocated - *sizeof(line_mapping)); - linemap->map->allocated *= 2; + if (virtual_line == 0) { + virtual_line = linemap->current; + } + + /* Replace all existing mappings that have line numbers >= this one. */ + for (i = linemap->map_size; i > 0; i--) { + if (linemap->map_vector[i-1].line < virtual_line) { + if (i < linemap->map_size) { + mapping = &linemap->map_vector[i]; + linemap->map_size = i + 1; + } + break; + } + } + + if (mapping == NULL) { + /* Create a new mapping in the map */ + if (linemap->map_size >= linemap->map_allocated) { + /* allocate another size bins when full for 2x space */ + linemap->map_vector = yasm_xrealloc(linemap->map_vector, + 2*linemap->map_allocated*sizeof(line_mapping)); + linemap->map_allocated *= 2; + } + mapping = &linemap->map_vector[linemap->map_size]; + linemap->map_size++; } - mapping = &linemap->map->vector[linemap->map->size]; - linemap->map->size++; /* Fill it */ if (!filename) { - if (linemap->map->size >= 2) + if (linemap->map_size >= 2) mapping->filename = - linemap->map->vector[linemap->map->size-2].filename; + linemap->map_vector[linemap->map_size-2].filename; else filename = "unknown"; } @@ -121,7 +132,7 @@ yasm_linemap_set(yasm_linemap *linemap, const char *filename, /*@=aliasunique@*/ } - mapping->line = linemap->current; + mapping->line = virtual_line; mapping->file_line = file_line; mapping->line_inc = line_inc; } @@ -134,14 +145,16 @@ yasm_linemap_poke(yasm_linemap *linemap, const char *filename, line_mapping *mapping; linemap->current++; - yasm_linemap_set(linemap, filename, file_line, 0); + yasm_linemap_set(linemap, filename, 0, file_line, 0); - mapping = &linemap->map->vector[linemap->map->size-1]; + mapping = &linemap->map_vector[linemap->map_size-1]; line = linemap->current; linemap->current++; - yasm_linemap_set(linemap, mapping->filename, mapping->file_line, + yasm_linemap_set(linemap, mapping->filename, 0, + mapping->file_line + + mapping->line_inc*(linemap->current-2-mapping->line), mapping->line_inc); return line; @@ -158,10 +171,9 @@ yasm_linemap_create(void) linemap->current = 1; /* initialize mapping vector */ - linemap->map = yasm_xmalloc(sizeof(line_mapping_head)); - linemap->map->vector = yasm_xmalloc(8*sizeof(line_mapping)); - linemap->map->size = 0; - linemap->map->allocated = 8; + linemap->map_vector = yasm_xmalloc(8*sizeof(line_mapping)); + linemap->map_size = 0; + linemap->map_allocated = 8; /* initialize source line information array */ linemap->source_info_size = 2; @@ -185,10 +197,7 @@ yasm_linemap_destroy(yasm_linemap *linemap) } yasm_xfree(linemap->source_info); - if (linemap->map) { - yasm_xfree(linemap->map->vector); - yasm_xfree(linemap->map); - } + yasm_xfree(linemap->map_vector); if (linemap->filenames) HAMT_destroy(linemap->filenames, filename_delete_one); @@ -243,22 +252,21 @@ yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line, assert(line <= linemap->current); /* Binary search through map to find highest line_index <= index */ - assert(linemap->map != NULL); vindex = 0; /* start step as the greatest power of 2 <= size */ step = 1; - while (step*2<=linemap->map->size) + while (step*2<=linemap->map_size) step*=2; while (step>0) { - if (vindex+step < linemap->map->size - && linemap->map->vector[vindex+step].line <= line) + if (vindex+step < linemap->map_size + && linemap->map_vector[vindex+step].line <= line) vindex += step; step /= 2; } - mapping = &linemap->map->vector[vindex]; + mapping = &linemap->map_vector[vindex]; *filename = mapping->filename; - *file_line = mapping->file_line + mapping->line_inc*(line-mapping->line); + *file_line = (line ? mapping->file_line + mapping->line_inc*(line-mapping->line) : 0); } int diff --git a/libyasm/linemap.h b/libyasm/linemap.h index 18062989..1c5aa462 100644 --- a/libyasm/linemap.h +++ b/libyasm/linemap.h @@ -2,10 +2,6 @@ * \file libyasm/linemap.h * \brief YASM virtual line mapping interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2002-2007 Peter Johnson * @@ -34,20 +30,27 @@ #ifndef YASM_LINEMAP_H #define YASM_LINEMAP_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Create a new line mapping repository. * \return New repository. */ +YASM_LIB_DECL yasm_linemap *yasm_linemap_create(void); /** Clean up any memory allocated for a repository. * \param linemap line mapping repository */ +YASM_LIB_DECL void yasm_linemap_destroy(yasm_linemap *linemap); /** Get the current line position in a repository. * \param linemap line mapping repository * \return Current virtual line. */ +YASM_LIB_DECL unsigned long yasm_linemap_get_current(yasm_linemap *linemap); /** Get bytecode and source line information, if any, for a virtual line. @@ -59,6 +62,7 @@ unsigned long yasm_linemap_get_current(yasm_linemap *linemap); * \note If source line information is not available, bcp and sourcep targets * are set to NULL. */ +YASM_LIB_DECL int yasm_linemap_get_source(yasm_linemap *linemap, unsigned long line, /*@null@*/ yasm_bytecode **bcp, const char **sourcep); @@ -71,6 +75,7 @@ int yasm_linemap_get_source(yasm_linemap *linemap, unsigned long line, * \param source source code line * \note The source code line pointer is NOT kept, it is strdup'ed. */ +YASM_LIB_DECL void yasm_linemap_add_source(yasm_linemap *linemap, /*@null@*/ yasm_bytecode *bc, const char *source); @@ -79,18 +84,22 @@ void yasm_linemap_add_source(yasm_linemap *linemap, * \param linemap line mapping repository * \return The current (new) virtual line. */ +YASM_LIB_DECL unsigned long yasm_linemap_goto_next(yasm_linemap *linemap); -/** Set a new file/line physical association starting point at the current +/** Set a new file/line physical association starting point at the specified * virtual line. line_inc indicates how much the "real" line is incremented * by for each virtual line increment (0 is perfectly legal). * \param linemap line mapping repository * \param filename physical file name (if NULL, not changed) + * \param virtual_line virtual line number (if 0, linemap->current is used) * \param file_line physical line number * \param line_inc line increment */ +YASM_LIB_DECL void yasm_linemap_set(yasm_linemap *linemap, /*@null@*/ const char *filename, - unsigned long file_line, unsigned long line_inc); + unsigned long virtual_line, unsigned long file_line, + unsigned long line_inc); /** Poke a single file/line association, restoring the original physical * association starting point. Caution: increments the current virtual line @@ -100,6 +109,7 @@ void yasm_linemap_set(yasm_linemap *linemap, /*@null@*/ const char *filename, * \param file_line physical line number * \return The virtual line number of the poked association. */ +YASM_LIB_DECL unsigned long yasm_linemap_poke(yasm_linemap *linemap, /*@null@*/ const char *filename, unsigned long file_line); @@ -110,6 +120,7 @@ unsigned long yasm_linemap_poke(yasm_linemap *linemap, * \param filename physical file name (output) * \param file_line physical line number (output) */ +YASM_LIB_DECL void yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line, /*@out@*/ const char **filename, /*@out@*/ unsigned long *file_line); @@ -122,6 +133,7 @@ void yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line, * \return Stops early (and returns func's return value) if func returns a * nonzero value; otherwise 0. */ +YASM_LIB_DECL int yasm_linemap_traverse_filenames (yasm_linemap *linemap, /*@null@*/ void *d, int (*func) (const char *filename, void *d)); diff --git a/libyasm/listfmt.h b/libyasm/listfmt.h index bfdfac46..945f28e5 100644 --- a/libyasm/listfmt.h +++ b/libyasm/listfmt.h @@ -2,10 +2,6 @@ * \file libyasm/listfmt.h * \brief YASM list format interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2004-2007 Peter Johnson * diff --git a/libyasm/md5.c b/libyasm/md5.c index e02bcf2c..ba1a3077 100644 --- a/libyasm/md5.c +++ b/libyasm/md5.c @@ -29,7 +29,6 @@ this file is only about 3k of object code. */ #include -/*@unused@*/ RCSID("$Id$"); #include "md5.h" @@ -163,7 +162,7 @@ yasm_md5_final(unsigned char digest[16], yasm_md5_context *ctx) putu32(ctx->buf[1], digest + 4); putu32(ctx->buf[2], digest + 8); putu32(ctx->buf[3], digest + 12); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 diff --git a/libyasm/md5.h b/libyasm/md5.h index a7dbc9ab..7872fda7 100644 --- a/libyasm/md5.h +++ b/libyasm/md5.h @@ -1,12 +1,12 @@ /* See md5.c for explanation and copyright information. */ -/* - * $Id$ - */ - #ifndef YASM_MD5_H #define YASM_MD5_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /* Unlike previous versions of this code, uint32 need not be exactly 32 bits, merely 32 bits or more. Choosing a data type which is 32 bits instead of 64 is not important; speed is considerably more @@ -19,10 +19,14 @@ typedef struct yasm_md5_context { unsigned char in[64]; } yasm_md5_context; +YASM_LIB_DECL void yasm_md5_init(yasm_md5_context *context); +YASM_LIB_DECL void yasm_md5_update(yasm_md5_context *context, unsigned char const *buf, unsigned long len); +YASM_LIB_DECL void yasm_md5_final(unsigned char digest[16], yasm_md5_context *context); +YASM_LIB_DECL void yasm_md5_transform(unsigned long buf[4], const unsigned char in[64]); #endif /* !YASM_MD5_H */ diff --git a/libyasm/mergesort.c b/libyasm/mergesort.c index 82fe52a0..3eeaa827 100644 --- a/libyasm/mergesort.c +++ b/libyasm/mergesort.c @@ -31,9 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; @@ -58,10 +56,8 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; * (The default is pairwise merging.) */ -#ifdef STDC_HEADERS -# include -# include -#endif +#include +#include static void setup(unsigned char *, unsigned char *, size_t, size_t, int (*)(const void *, const void *)); diff --git a/libyasm/module.h b/libyasm/module.h index f930800f..220017de 100644 --- a/libyasm/module.h +++ b/libyasm/module.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * YASM module loader header file * * Copyright (C) 2002-2007 Peter Johnson @@ -27,6 +27,10 @@ #ifndef YASM_MODULE_H #define YASM_MODULE_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + typedef enum yasm_module_type { YASM_MODULE_ARCH = 0, YASM_MODULE_DBGFMT, @@ -36,6 +40,7 @@ typedef enum yasm_module_type { YASM_MODULE_PREPROC } yasm_module_type; +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ void *yasm_load_module (yasm_module_type type, const char *keyword); @@ -52,6 +57,7 @@ typedef enum yasm_module_type { #define yasm_load_preproc(keyword) \ yasm_load_module(YASM_MODULE_PREPROC, keyword) +YASM_LIB_DECL void yasm_list_modules (yasm_module_type type, void (*printfunc) (const char *name, const char *keyword)); @@ -69,4 +75,8 @@ void yasm_list_modules #define yasm_list_preproc(func) \ yasm_list_modules(YASM_MODULE_PREPROC, func) +YASM_LIB_DECL +void yasm_register_module(yasm_module_type type, const char *keyword, + void *data); + #endif diff --git a/libyasm/module.in b/libyasm/module.in index 2a3fd571..a18778b6 100644 --- a/libyasm/module.in +++ b/libyasm/module.in @@ -25,7 +25,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); #include @@ -73,14 +72,33 @@ static struct { {preproc_modules, sizeof(preproc_modules)/sizeof(module)}, }; +typedef struct loaded_module { + yasm_module_type type; /* module type */ + const char *keyword; /* module keyword */ + void *data; /* associated data */ +} loaded_module; + +static loaded_module *loaded_modules = NULL; +static size_t num_loaded_modules = 0; + void * yasm_load_module(yasm_module_type type, const char *keyword) { size_t i; - module *modules = module_types[type].m; - size_t n = module_types[type].n; + module *modules; + size_t n; - /* Look for the module/symbol. */ + /* Look for the module/symbol, first in loaded modules */ + if (loaded_modules) { + for (i=0; iname, arch->keyword); - break; - case YASM_MODULE_DBGFMT: - dbgfmt = modules[i].data; - printfunc(dbgfmt->name, dbgfmt->keyword); - break; - case YASM_MODULE_OBJFMT: - objfmt = modules[i].data; - printfunc(objfmt->name, objfmt->keyword); - break; - case YASM_MODULE_LISTFMT: - listfmt = modules[i].data; - printfunc(listfmt->name, listfmt->keyword); - break; - case YASM_MODULE_PARSER: - parser = modules[i].data; - printfunc(parser->name, parser->keyword); - break; - case YASM_MODULE_PREPROC: - preproc = modules[i].data; - printfunc(preproc->name, preproc->keyword); - break; - } + switch (type) { + case YASM_MODULE_ARCH: + arch = data; + printfunc(arch->name, arch->keyword); + break; + case YASM_MODULE_DBGFMT: + dbgfmt = data; + printfunc(dbgfmt->name, dbgfmt->keyword); + break; + case YASM_MODULE_OBJFMT: + objfmt = data; + printfunc(objfmt->name, objfmt->keyword); + break; + case YASM_MODULE_LISTFMT: + listfmt = data; + printfunc(listfmt->name, listfmt->keyword); + break; + case YASM_MODULE_PARSER: + parser = data; + printfunc(parser->name, parser->keyword); + break; + case YASM_MODULE_PREPROC: + preproc = data; + printfunc(preproc->name, preproc->keyword); + break; } } + +void +yasm_list_modules(yasm_module_type type, + void (*printfunc) (const char *name, const char *keyword)) +{ + size_t i; + module *modules; + size_t n;; + + /* Go through available list, and try to load each one */ + if (loaded_modules) { + for (i=0; iobjfmt))->module->add_default_section \ (object) +#define yasm_objfmt_init_new_section(section, line) \ + ((yasm_objfmt_base *)((object)->objfmt))->module->init_new_section \ + (section, line) +#define yasm_objfmt_get_special_sym(object, name, parser) \ + ((yasm_objfmt_base *)((object)->objfmt))->module->get_special_sym \ + (object, name, parser) #endif diff --git a/libyasm/parser.h b/libyasm/parser.h index 2ed5ce1c..93d4d332 100644 --- a/libyasm/parser.h +++ b/libyasm/parser.h @@ -2,10 +2,6 @@ * \file libyasm/parser.h * \brief YASM parser module interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -51,10 +47,12 @@ typedef struct yasm_parser_module { /** Default preprocessor. */ const char *default_preproc_keyword; + /** NULL-terminated list of standard macro lookups. NULL if none. */ + const yasm_stdmac *stdmacs; + /** Parse a source file into an object. * \param object object to parse into (already created) * \param pp preprocessor - * \param f initial starting file * \param save_input nonzero if the parser should save the original * lines of source into the object's linemap (via * yasm_linemap_add_data()). @@ -62,7 +60,7 @@ typedef struct yasm_parser_module { * \note Parse errors and warnings are stored into errwarns. */ void (*do_parse) - (yasm_object *object, yasm_preproc *pp, FILE *f, int save_input, + (yasm_object *object, yasm_preproc *pp, int save_input, yasm_linemap *linemap, yasm_errwarns *errwarns); } yasm_parser_module; diff --git a/libyasm/phash.c b/libyasm/phash.c index 2ce1938d..cef8c781 100644 --- a/libyasm/phash.c +++ b/libyasm/phash.c @@ -1,7 +1,5 @@ /* Modified for use with yasm by Peter Johnson. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); /* -------------------------------------------------------------------- diff --git a/libyasm/phash.h b/libyasm/phash.h index c4cc88a0..2273a5df 100644 --- a/libyasm/phash.h +++ b/libyasm/phash.h @@ -1,6 +1,4 @@ -/* Modified for use with yasm by Peter Johnson. - * $Id$ - */ +/* Modified for use with yasm by Peter Johnson. */ /* ------------------------------------------------------------------------------ By Bob Jenkins, September 1996. @@ -10,6 +8,12 @@ Source is http://burtleburtle.net/bob/c/lookupa.h ------------------------------------------------------------------------------ */ +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + +YASM_LIB_DECL unsigned long phash_lookup(const char *k, size_t length, unsigned long level); +YASM_LIB_DECL void phash_checksum(const char *k, size_t length, unsigned long *state); diff --git a/libyasm/preproc.h b/libyasm/preproc.h index f93a838c..751b19e4 100644 --- a/libyasm/preproc.h +++ b/libyasm/preproc.h @@ -2,10 +2,6 @@ * \file libyasm/preproc.h * \brief YASM preprocessor module interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -56,15 +52,17 @@ typedef struct yasm_preproc_module { * Module-level implementation of yasm_preproc_create(). * Call yasm_preproc_create() instead of calling this function. * - * \param f initial starting file - * \param in_filename initial starting filename + * \param in_filename initial starting filename, or "-" to read from + * stdin + * \param symtab symbol table (may be NULL if none) * \param lm line mapping repository * \param errwarns error/warnning set. * \return New preprocessor. * * \note Any preprocessor errors and warnings are stored into errwarns. */ - /*@only@*/ yasm_preproc * (*create) (FILE *f, const char *in_filename, + /*@only@*/ yasm_preproc * (*create) (const char *in_filename, + yasm_symtab *symtab, yasm_linemap *lm, yasm_errwarns *errwarns); @@ -73,11 +71,10 @@ typedef struct yasm_preproc_module { */ void (*destroy) (/*@only@*/ yasm_preproc *preproc); - /** Module-level implementation of yasm_preproc_input(). - * Call yasm_preproc_input() instead of calling this function. + /** Module-level implementation of yasm_preproc_get_line(). + * Call yasm_preproc_get_line() instead of calling this function. */ - size_t (*input) (yasm_preproc *preproc, /*@out@*/ char *buf, - size_t max_size); + char * (*get_line) (yasm_preproc *preproc); /** Module-level implementation of yasm_preproc_get_included_file(). * Call yasm_preproc_get_included_file() instead of calling this function. @@ -104,37 +101,38 @@ typedef struct yasm_preproc_module { * Call yasm_preproc_builtin_define() instead of calling this function. */ void (*define_builtin) (yasm_preproc *preproc, const char *macronameval); + + /** Module-level implementation of yasm_preproc_add_standard(). + * Call yasm_preproc_add_standard() instead of calling this function. + */ + void (*add_standard) (yasm_preproc *preproc, const char **macros); } yasm_preproc_module; /** Initialize preprocessor. * The preprocessor needs access to the object format module to find out * any output format specific macros. * \param module preprocessor module - * \param f initial starting file - * \param in_filename initial starting file filename + * \param in_filename initial starting filename, or "-" to read from stdin + * \param symtab symbol table (may be NULL if none) * \param lm line mapping repository * \param errwarns error/warning set * \return New preprocessor. * \note Errors/warnings are stored into errwarns. */ /*@only@*/ yasm_preproc *yasm_preproc_create - (yasm_preproc_module *module, FILE *f, const char *in_filename, - yasm_linemap *lm, yasm_errwarns *errwarns); + (yasm_preproc_module *module, const char *in_filename, + yasm_symtab *symtab, yasm_linemap *lm, yasm_errwarns *errwarns); /** Cleans up any allocated preproc memory. * \param preproc preprocessor */ void yasm_preproc_destroy(/*@only@*/ yasm_preproc *preproc); -/** Gets more preprocessed source code (up to max_size bytes) into buf. - * More than a single line may be returned in buf. +/** Gets a single line of preprocessed source code. * \param preproc preprocessor - * \param buf destination buffer for preprocessed source - * \param max_size maximum number of bytes that can be returned in buf - * \return Actual number of bytes returned in buf. + * \return Allocated line of code, without the trailing \n. */ -size_t yasm_preproc_input(yasm_preproc *preproc, /*@out@*/ char *buf, - size_t max_size); +char *yasm_preproc_get_line(yasm_preproc *preproc); /** Get the next filename included by the source code. * \param preproc preprocessor @@ -172,17 +170,25 @@ void yasm_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname); void yasm_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval); +/** Define additional standard macros, preprocessed after the builtins but + * prior to any user-defined macros. + * \param preproc preprocessor + * \param macros NULL-terminated array of macro strings + */ +void yasm_preproc_add_standard(yasm_preproc *preproc, + const char **macros); + #ifndef YASM_DOXYGEN /* Inline macro implementations for preproc functions */ -#define yasm_preproc_create(module, f, in_filename, lm, ews) \ - module->create(f, in_filename, lm, ews) +#define yasm_preproc_create(module, in_filename, symtab, lm, ews) \ + module->create(in_filename, symtab, lm, ews) #define yasm_preproc_destroy(preproc) \ ((yasm_preproc_base *)preproc)->module->destroy(preproc) -#define yasm_preproc_input(preproc, buf, max_size) \ - ((yasm_preproc_base *)preproc)->module->input(preproc, buf, max_size) +#define yasm_preproc_get_line(preproc) \ + ((yasm_preproc_base *)preproc)->module->get_line(preproc) #define yasm_preproc_get_included_file(preproc, buf, max_size) \ ((yasm_preproc_base *)preproc)->module->get_included_file(preproc, buf, max_size) #define yasm_preproc_add_include_file(preproc, filename) \ @@ -195,6 +201,9 @@ void yasm_preproc_define_builtin(yasm_preproc *preproc, #define yasm_preproc_define_builtin(preproc, macronameval) \ ((yasm_preproc_base *)preproc)->module->define_builtin(preproc, \ macronameval) +#define yasm_preproc_add_standard(preproc, macros) \ + ((yasm_preproc_base *)preproc)->module->add_standard(preproc, \ + macros) #endif diff --git a/libyasm/section.c b/libyasm/section.c index 2b5d4342..dd067e07 100644 --- a/libyasm/section.c +++ b/libyasm/section.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include @@ -50,9 +48,6 @@ #include "dbgfmt.h" #include "objfmt.h" -#include "expr-int.h" -#include "bc-int.h" - #include "inttree.h" @@ -66,8 +61,6 @@ struct yasm_section { /* associated data; NULL if none */ /*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data; - /*@owned@*/ yasm_expr *start; /* Starting address of section contents */ - unsigned long align; /* Section alignment */ unsigned long opt_flags; /* storage for optimizer flags */ @@ -129,6 +122,23 @@ dir_global(yasm_object *object, yasm_valparamhead *valparams, } } +static void +dir_privextern(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_valparamhead vps; + + yasm_vps_initialize(&vps); + if (!objext_valparams) { + yasm_valparam *vp; + + vp = yasm_vp_create_id(NULL, yasm__xstrdup("private_extern"), '$'); + yasm_vps_append(&vps, vp); + objext_valparams = &vps; + } + dir_global(object, valparams, objext_valparams, line); +} + static void dir_common(yasm_object *object, yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, unsigned long line) @@ -171,6 +181,7 @@ static const yasm_directive object_directives[] = { { ".extern", "gas", dir_extern, YASM_DIR_ID_REQUIRED }, { ".global", "gas", dir_global, YASM_DIR_ID_REQUIRED }, { ".globl", "gas", dir_global, YASM_DIR_ID_REQUIRED }, + { ".private_extern","gas", dir_privextern, YASM_DIR_ID_REQUIRED }, { "extern", "nasm", dir_extern, YASM_DIR_ID_REQUIRED }, { "global", "nasm", dir_global, YASM_DIR_ID_REQUIRED }, { "common", "nasm", dir_common, YASM_DIR_ID_REQUIRED }, @@ -229,6 +240,10 @@ yasm_object_create(const char *src_filename, const char *obj_filename, object->src_filename = yasm__xstrdup(src_filename); object->obj_filename = yasm__xstrdup(obj_filename); + /* No prefix/suffix */ + object->global_prefix = yasm__xstrdup(""); + object->global_suffix = yasm__xstrdup(""); + /* Create empty symbol table */ object->symtab = yasm_symtab_create(); @@ -264,10 +279,14 @@ yasm_object_create(const char *src_filename, const char *obj_filename, * for the active object format. */ matched = 0; - for (i=0; objfmt_module->dbgfmt_keywords[i]; i++) + for (i=0; objfmt_module->dbgfmt_keywords[i]; i++) { if (yasm__strcasecmp(objfmt_module->dbgfmt_keywords[i], - dbgfmt_module->keyword) == 0) + dbgfmt_module->keyword) == 0) { matched = 1; + break; + } + } + if (!matched) { yasm_error_set(YASM_ERROR_GENERAL, N_("`%s' is not a valid debug format for object format `%s'"), @@ -304,8 +323,8 @@ error: /*@-onlytrans@*/ yasm_section * yasm_object_get_general(yasm_object *object, const char *name, - yasm_expr *start, unsigned long align, int code, - int res_only, int *isnew, unsigned long line) + unsigned long align, int code, int res_only, + int *isnew, unsigned long line) { yasm_section *s; yasm_bytecode *bc; @@ -329,12 +348,6 @@ yasm_object_get_general(yasm_object *object, const char *name, s->object = object; s->name = yasm__xstrdup(name); s->assoc_data = NULL; - if (start) - s->start = start; - else - s->start = - yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_uint(0)), - line); s->align = align; /* Initialize bytecodes with one empty bytecode (acts as "prior" for first @@ -354,6 +367,9 @@ yasm_object_get_general(yasm_object *object, const char *name, s->res_only = res_only; s->def = 0; + /* Initialize object format specific data */ + yasm_objfmt_init_new_section(s, line); + *isnew = 1; return s; } @@ -388,6 +404,20 @@ yasm_object_set_source_fn(yasm_object *object, const char *src_filename) object->src_filename = yasm__xstrdup(src_filename); } +void +yasm_object_set_global_prefix(yasm_object *object, const char *prefix) +{ + yasm_xfree(object->global_prefix); + object->global_prefix = yasm__xstrdup(prefix); +} + +void +yasm_object_set_global_suffix(yasm_object *object, const char *suffix) +{ + yasm_xfree(object->global_suffix); + object->global_suffix = yasm__xstrdup(suffix); +} + int yasm_section_is_code(yasm_section *sect) { @@ -462,6 +492,10 @@ yasm_object_destroy(yasm_object *object) /* Delete directives HAMT */ HAMT_destroy(object->directives, directive_level1_delete); + /* Delete prefix/suffix */ + yasm_xfree(object->global_prefix); + yasm_xfree(object->global_suffix); + /* Delete associated filenames */ yasm_xfree(object->src_filename); yasm_xfree(object->obj_filename); @@ -595,6 +629,10 @@ yasm_bytecode * yasm_section_bcs_append(yasm_section *sect, yasm_bytecode *bc) { if (bc) { + if (!sect) { + yasm_error_set(YASM_ERROR_VALUE, "Attempt to append bytecode to a NULL section or with a NULL bytecode"); + return NULL; + } if (bc->callback) { bc->section = sect; /* record parent section */ STAILQ_INSERT_TAIL(§->bcs, bc, link); @@ -634,20 +672,6 @@ yasm_section_get_name(const yasm_section *sect) return sect->name; } -void -yasm_section_set_start(yasm_section *sect, yasm_expr *start, - unsigned long line) -{ - yasm_expr_destroy(sect->start); - sect->start = start; -} - -const yasm_expr * -yasm_section_get_start(const yasm_section *sect) -{ - return sect->start; -} - void yasm_section_set_align(yasm_section *sect, unsigned long align, unsigned long line) @@ -672,7 +696,6 @@ yasm_section_destroy(yasm_section *sect) yasm_xfree(sect->name); yasm__assoc_data_destroy(sect->assoc_data); - yasm_expr_destroy(sect->start); /* Delete bytecodes */ cur = STAILQ_FIRST(§->bcs); @@ -704,9 +727,6 @@ yasm_section_print(const yasm_section *sect, FILE *f, int indent_level, } fprintf(f, "%*sname=%s\n", indent_level, "", sect->name); - fprintf(f, "%*sstart=", indent_level, ""); - yasm_expr_print(sect->start, f); - fprintf(f, "\n"); if (sect->assoc_data) { fprintf(f, "%*sAssociated data:\n", indent_level, ""); @@ -872,16 +892,18 @@ struct yasm_span { * checking for circular references (cycles) with id=0 spans. */ yasm_span **backtrace; + int backtrace_size; /* First offset setter following this span's bytecode */ yasm_offset_setter *os; }; typedef struct optimize_data { - /*@reldef@*/ TAILQ_HEAD(, yasm_span) spans; - /*@reldef@*/ STAILQ_HEAD(, yasm_span) QA, QB; + /*@reldef@*/ TAILQ_HEAD(yasm_span_head, yasm_span) spans; + /*@reldef@*/ STAILQ_HEAD(yasm_span_shead, yasm_span) QA, QB; /*@only@*/ IntervalTree *itree; - /*@reldef@*/ STAILQ_HEAD(, yasm_offset_setter) offset_setters; + /*@reldef@*/ STAILQ_HEAD(offset_setters_head, yasm_offset_setter) + offset_setters; long len_diff; /* used only for optimize_term_expand */ yasm_span *span; /* used only for check_cycle */ yasm_offset_setter *os; @@ -909,6 +931,7 @@ create_span(yasm_bytecode *bc, int id, /*@null@*/ const yasm_value *value, span->id = id; span->active = 1; span->backtrace = NULL; + span->backtrace_size = 0; span->os = os; return span; @@ -1168,7 +1191,8 @@ check_cycle(IntervalTreeNode *node, void *d) optimize_data *optd = d; yasm_span_term *term = node->data; yasm_span *depspan = term->span; - int bt_size = 0, dep_bt_size = 0; + int i; + int depspan_bt_alloc; /* Only check for cycles in id=0 spans */ if (depspan->id > 0) @@ -1178,10 +1202,8 @@ check_cycle(IntervalTreeNode *node, void *d) * span is in our backtrace. */ if (optd->span->backtrace) { - yasm_span *s; - while ((s = optd->span->backtrace[bt_size])) { - bt_size++; - if (s == depspan) + for (i=0; ispan->backtrace_size; i++) { + if (optd->span->backtrace[i] == depspan) yasm_error_set(YASM_ERROR_VALUE, N_("circular reference detected")); } @@ -1191,25 +1213,51 @@ check_cycle(IntervalTreeNode *node, void *d) * span. */ if (!depspan->backtrace) { - depspan->backtrace = yasm_xmalloc((bt_size+2)*sizeof(yasm_span *)); - if (bt_size > 0) + depspan->backtrace = yasm_xmalloc((optd->span->backtrace_size+1)* + sizeof(yasm_span *)); + if (optd->span->backtrace_size > 0) memcpy(depspan->backtrace, optd->span->backtrace, - bt_size*sizeof(yasm_span *)); - depspan->backtrace[bt_size] = optd->span; - depspan->backtrace[bt_size+1] = NULL; + optd->span->backtrace_size*sizeof(yasm_span *)); + depspan->backtrace[optd->span->backtrace_size] = optd->span; + depspan->backtrace_size = optd->span->backtrace_size+1; return; } - while (depspan->backtrace[dep_bt_size]) - dep_bt_size++; - depspan->backtrace = - yasm_xrealloc(depspan->backtrace, - (dep_bt_size+bt_size+2)*sizeof(yasm_span *)); - if (bt_size > 0) - memcpy(&depspan->backtrace[dep_bt_size], optd->span->backtrace, - (bt_size-1)*sizeof(yasm_span *)); - depspan->backtrace[dep_bt_size+bt_size] = optd->span; - depspan->backtrace[dep_bt_size+bt_size+1] = NULL; + /* Add our complete backtrace, checking for duplicates */ + depspan_bt_alloc = depspan->backtrace_size; + for (i=0; ispan->backtrace_size; i++) { + int present = 0; + int j; + for (j=0; jbacktrace_size; j++) { + if (optd->span->backtrace[i] == optd->span->backtrace[j]) { + present = 1; + break; + } + } + if (present) + continue; + /* Not already in array; add it. */ + if (depspan->backtrace_size >= depspan_bt_alloc) + { + depspan_bt_alloc *= 2; + depspan->backtrace = + yasm_xrealloc(depspan->backtrace, + depspan_bt_alloc*sizeof(yasm_span *)); + } + depspan->backtrace[depspan->backtrace_size] = optd->span->backtrace[i]; + depspan->backtrace_size++; + } + + /* Add ourselves. */ + if (depspan->backtrace_size >= depspan_bt_alloc) + { + depspan_bt_alloc++; + depspan->backtrace = + yasm_xrealloc(depspan->backtrace, + depspan_bt_alloc*sizeof(yasm_span *)); + } + depspan->backtrace[depspan->backtrace_size] = optd->span; + depspan->backtrace_size++; } static void @@ -1289,12 +1337,10 @@ yasm_object_optimize(yasm_object *object, yasm_errwarns *errwarns) unsigned long offset = 0; yasm_bytecode *bc = STAILQ_FIRST(§->bcs); - yasm_bytecode *prevbc; bc->bc_index = bc_index++; /* Skip our locally created empty bytecode first. */ - prevbc = bc; bc = STAILQ_NEXT(bc, link); /* Iterate through the remainder, if any. */ @@ -1332,7 +1378,6 @@ yasm_object_optimize(yasm_object *object, yasm_errwarns *errwarns) offset += bc->len*bc->mult_int; } - prevbc = bc; bc = STAILQ_NEXT(bc, link); } } diff --git a/libyasm/section.h b/libyasm/section.h index 27ccb298..2c7faa4d 100644 --- a/libyasm/section.h +++ b/libyasm/section.h @@ -2,10 +2,6 @@ * \file libyasm/section.h * \brief YASM section interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,18 +30,20 @@ #ifndef YASM_SECTION_H #define YASM_SECTION_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Basic YASM relocation. Object formats will need to extend this * structure with additional fields for relocation type, etc. */ typedef struct yasm_reloc yasm_reloc; -#ifdef YASM_LIB_INTERNAL struct yasm_reloc { - /*@reldef@*/ STAILQ_ENTRY(yasm_reloc) link; + /*@reldef@*/ STAILQ_ENTRY(yasm_reloc) link; /**< Link to next reloc */ yasm_intnum *addr; /**< Offset (address) within section */ /*@dependent@*/ yasm_symrec *sym; /**< Relocated symbol */ }; -#endif /** An object. This is the internal representation of an object file. */ struct yasm_object { @@ -62,7 +60,6 @@ struct yasm_object { */ /*@dependent@*/ /*@null@*/ yasm_section *cur_section; -#ifdef YASM_LIB_INTERNAL /** Linked list of sections. */ /*@reldef@*/ STAILQ_HEAD(yasm_sectionhead, yasm_section) sections; @@ -70,7 +67,12 @@ struct yasm_object { * second level is directive name. */ /*@owned@*/ struct HAMT *directives; -#endif + + /** Prefix prepended to externally-visible symbols (empty string if none) */ + /*@owned@*/ char *global_prefix; + + /** Suffix appended to externally-visible symbols (empty string if none) */ + /*@owned@*/ char *global_suffix; }; /** Create a new object. A default section is created as the first section. @@ -83,6 +85,7 @@ struct yasm_object { * \param dbgfmt_module debug format module * \return Newly allocated object, or NULL on error. */ +YASM_LIB_DECL /*@null@*/ /*@only@*/ yasm_object *yasm_object_create (const char *src_filename, const char *obj_filename, /*@kept@*/ yasm_arch *arch, @@ -93,8 +96,6 @@ struct yasm_object { * added to the object if there's not already a section by that name. * \param object object * \param name section name - * \param start starting address (ignored if section already exists), - * NULL if 0 or don't care. * \param align alignment in bytes (0 if none) * \param code if nonzero, section is intended to contain code * (e.g. alignment should be made with NOP instructions, not 0) @@ -105,9 +106,9 @@ struct yasm_object { * already exists) * \return New section. */ +YASM_LIB_DECL /*@dependent@*/ yasm_section *yasm_object_get_general - (yasm_object *object, const char *name, - /*@null@*/ /*@only@*/ yasm_expr *start, unsigned long align, int code, + (yasm_object *object, const char *name, unsigned long align, int code, int res_only, /*@out@*/ int *isnew, unsigned long line); /** Handle a directive. Passed down to object format, debug format, or @@ -120,6 +121,7 @@ struct yasm_object { * \param line virtual line (from yasm_linemap) * \return 0 if directive recognized, nonzero if unrecognized. */ +YASM_LIB_DECL int yasm_object_directive(yasm_object *object, const char *name, const char *parser, yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, @@ -129,6 +131,7 @@ int yasm_object_directive(yasm_object *object, const char *name, * object and all bytecodes within those sections are also deleted. * \param object object */ +YASM_LIB_DECL void yasm_object_destroy(/*@only@*/ yasm_object *object); /** Print an object. For debugging purposes. @@ -136,6 +139,7 @@ void yasm_object_destroy(/*@only@*/ yasm_object *object); * \param f file * \param indent_level indentation level */ +YASM_LIB_DECL void yasm_object_print(const yasm_object *object, FILE *f, int indent_level); /** Finalize an object after parsing. @@ -143,6 +147,7 @@ void yasm_object_print(const yasm_object *object, FILE *f, int indent_level); * \param errwarns error/warning set * \note Errors/warnings are stored into errwarns. */ +YASM_LIB_DECL void yasm_object_finalize(yasm_object *object, yasm_errwarns *errwarns); /** Traverses all sections in an object, calling a function on each section. @@ -152,6 +157,7 @@ void yasm_object_finalize(yasm_object *object, yasm_errwarns *errwarns); * \return Stops early (and returns func's return value) if func returns a * nonzero value; otherwise 0. */ +YASM_LIB_DECL int yasm_object_sections_traverse (yasm_object *object, /*@null@*/ void *d, int (*func) (yasm_section *sect, /*@null@*/ void *d)); @@ -161,6 +167,7 @@ int yasm_object_sections_traverse * \param name section name * \return Section matching name, or NULL if no match found. */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ yasm_section *yasm_object_find_general (yasm_object *object, const char *name); @@ -168,32 +175,51 @@ int yasm_object_sections_traverse * \param object object * \param src_filename new source filename (e.g. "file.asm") */ +YASM_LIB_DECL void yasm_object_set_source_fn(yasm_object *object, const char *src_filename); +/** Change the prefix used for externally-visible symbols. + * \param object object + * \param prefix new prefix + */ +YASM_LIB_DECL +void yasm_object_set_global_prefix(yasm_object *object, const char *prefix); + +/** Change the suffix used for externally-visible symbols. + * \param object object + * \param suffix new suffix + */ +YASM_LIB_DECL +void yasm_object_set_global_suffix(yasm_object *object, const char *suffix); + /** Optimize an object. Takes the unoptimized object and optimizes it. * If successful, the object is ready for output to an object file. * \param object object * \param errwarns error/warning set * \note Optimization failures are stored into errwarns. */ +YASM_LIB_DECL void yasm_object_optimize(yasm_object *object, yasm_errwarns *errwarns); /** Determine if a section is flagged to contain code. * \param sect section * \return Nonzero if section is flagged to contain code. */ +YASM_LIB_DECL int yasm_section_is_code(yasm_section *sect); /** Get yasm_optimizer-specific flags. For yasm_optimizer use only. * \param sect section * \return Optimizer-specific flags. */ +YASM_LIB_DECL unsigned long yasm_section_get_opt_flags(const yasm_section *sect); /** Set yasm_optimizer-specific flags. For yasm_optimizer use only. * \param sect section * \param opt_flags optimizer-specific flags. */ +YASM_LIB_DECL void yasm_section_set_opt_flags(yasm_section *sect, unsigned long opt_flags); /** Determine if a section was declared as the "default" section (e.g. not @@ -201,18 +227,21 @@ void yasm_section_set_opt_flags(yasm_section *sect, unsigned long opt_flags); * \param sect section * \return Nonzero if section was declared as default. */ +YASM_LIB_DECL int yasm_section_is_default(const yasm_section *sect); /** Set section "default" flag to a new value. * \param sect section * \param def new value of default flag */ +YASM_LIB_DECL void yasm_section_set_default(yasm_section *sect, int def); /** Get object owner of a section. * \param sect section * \return Object this section is a part of. */ +YASM_LIB_DECL yasm_object *yasm_section_get_object(const yasm_section *sect); /** Get assocated data for a section and data callback. @@ -220,6 +249,7 @@ yasm_object *yasm_section_get_object(const yasm_section *sect); * \param callback callback used when adding data * \return Associated data (NULL if none). */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ void *yasm_section_get_data (yasm_section *sect, const yasm_assoc_data_callback *callback); @@ -229,6 +259,7 @@ yasm_object *yasm_section_get_object(const yasm_section *sect); * \param callback callback * \param data data to associate */ +YASM_LIB_DECL void yasm_section_add_data(yasm_section *sect, const yasm_assoc_data_callback *callback, /*@null@*/ /*@only@*/ void *data); @@ -242,6 +273,7 @@ void yasm_section_add_data(yasm_section *sect, * The section will destroy the relocation address; it is the caller's * responsibility to destroy any other allocated data. */ +YASM_LIB_DECL void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc, void (*destroy_func) (/*@only@*/ void *reloc)); @@ -249,6 +281,7 @@ void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc, * \param sect section * \return First relocation for section. NULL if no relocations. */ +YASM_LIB_DECL /*@null@*/ yasm_reloc *yasm_section_relocs_first(yasm_section *sect); /** Get the next relocation for a section. @@ -256,8 +289,7 @@ void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc, * \return Next relocation for section. NULL if no more relocations. */ /*@null@*/ yasm_reloc *yasm_section_reloc_next(yasm_reloc *reloc); - -#ifdef YASM_LIB_INTERNAL +#ifndef YASM_DOXYGEN #define yasm_section_reloc_next(x) STAILQ_NEXT((x), link) #endif @@ -266,6 +298,7 @@ void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc, * \param addrp address of relocation within section (returned) * \param symp relocated symbol (returned) */ +YASM_LIB_DECL void yasm_reloc_get(yasm_reloc *reloc, yasm_intnum **addrp, /*@dependent@*/ yasm_symrec **symp); @@ -274,6 +307,7 @@ void yasm_reloc_get(yasm_reloc *reloc, yasm_intnum **addrp, * \return First bytecode in section (at least one empty bytecode is always * present). */ +YASM_LIB_DECL yasm_bytecode *yasm_section_bcs_first(yasm_section *sect); /** Get the last bytecode in a section. @@ -281,6 +315,7 @@ yasm_bytecode *yasm_section_bcs_first(yasm_section *sect); * \return Last bytecode in section (at least one empty bytecode is always * present). */ +YASM_LIB_DECL yasm_bytecode *yasm_section_bcs_last(yasm_section *sect); /** Add bytecode to the end of a section. @@ -292,6 +327,7 @@ yasm_bytecode *yasm_section_bcs_last(yasm_section *sect); * \return If bytecode was actually appended (it wasn't NULL or empty), the * bytecode; otherwise NULL. */ +YASM_LIB_DECL /*@only@*/ /*@null@*/ yasm_bytecode *yasm_section_bcs_append (yasm_section *sect, /*@returned@*/ /*@only@*/ /*@null@*/ yasm_bytecode *bc); @@ -306,6 +342,7 @@ yasm_bytecode *yasm_section_bcs_last(yasm_section *sect); * \note If errwarns is non-NULL, yasm_errwarn_propagate() is called after * each call to func (with the bytecode's line number). */ +YASM_LIB_DECL int yasm_section_bcs_traverse (yasm_section *sect, /*@null@*/ yasm_errwarns *errwarns, /*@null@*/ void *d, int (*func) (yasm_bytecode *bc, /*@null@*/ void *d)); @@ -314,28 +351,15 @@ int yasm_section_bcs_traverse * \param sect section * \return Section name. */ +YASM_LIB_DECL /*@observer@*/ const char *yasm_section_get_name(const yasm_section *sect); -/** Change starting address of a section. - * \param sect section - * \param start starting address - * \param line virtual line - */ -void yasm_section_set_start(yasm_section *sect, /*@only@*/ yasm_expr *start, - unsigned long line); - -/** Get starting address of a section. - * \param sect section - * \return Starting address. - */ -/*@observer@*/ const yasm_expr *yasm_section_get_start - (const yasm_section *sect); - /** Change alignment of a section. * \param sect section * \param align alignment in bytes * \param line virtual line */ +YASM_LIB_DECL void yasm_section_set_align(yasm_section *sect, unsigned long align, unsigned long line); @@ -343,6 +367,7 @@ void yasm_section_set_align(yasm_section *sect, unsigned long align, * \param sect section * \return Alignment in bytes (0 if none). */ +YASM_LIB_DECL unsigned long yasm_section_get_align(const yasm_section *sect); /** Print a section. For debugging purposes. @@ -351,6 +376,7 @@ unsigned long yasm_section_get_align(const yasm_section *sect); * \param sect section * \param print_bcs if nonzero, print bytecodes within section */ +YASM_LIB_DECL void yasm_section_print(/*@null@*/ const yasm_section *sect, FILE *f, int indent_level, int print_bcs); diff --git a/libyasm/strcasecmp.c b/libyasm/strcasecmp.c index 66424c6b..a87bd88b 100644 --- a/libyasm/strcasecmp.c +++ b/libyasm/strcasecmp.c @@ -29,10 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); - #ifndef USE_OUR_OWN_STRCASECMP #undef yasm__strcasecmp diff --git a/libyasm/strsep.c b/libyasm/strsep.c index f57c1b0a..0fecd475 100644 --- a/libyasm/strsep.c +++ b/libyasm/strsep.c @@ -28,10 +28,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #define NO_STRING_INLINES #include "util.h" -/*@unused@*/ RCSID("$Id$"); #if defined(LIBC_SCCS) && !defined(lint) diff --git a/libyasm/symrec.c b/libyasm/symrec.c index bef0eaa9..694f0c67 100644 --- a/libyasm/symrec.c +++ b/libyasm/symrec.c @@ -24,13 +24,10 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); -#ifdef STDC_HEADERS -# include -#endif +#include +#include #include "libyasm-stdint.h" #include "coretype.h" @@ -74,6 +71,8 @@ struct yasm_symrec { /* bytecode immediately preceding a label */ /*@dependent@*/ yasm_bytecode *precbc; } value; + unsigned int size; /* 0 if not user-defined */ + const char *segment; /* for segmented systems like DOS */ /* associated data; NULL if none */ /*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data; @@ -90,6 +89,8 @@ struct yasm_symtab { /*@only@*/ HAMT *sym_table; /* Symbols not in the table */ SLIST_HEAD(nontablesymhead_s, non_table_symrec_s) non_table_syms; + + int case_sensitive; }; static void @@ -135,9 +136,16 @@ yasm_symtab_create(void) yasm_symtab *symtab = yasm_xmalloc(sizeof(yasm_symtab)); symtab->sym_table = HAMT_create(0, yasm_internal_error_); SLIST_INIT(&symtab->non_table_syms); + symtab->case_sensitive = 1; return symtab; } +void +yasm_symtab_set_case_sensitive(yasm_symtab *symtab, int sensitive) +{ + symtab->case_sensitive = sensitive; +} + static void symrec_destroy_one(/*@only@*/ void *d) { @@ -150,15 +158,24 @@ symrec_destroy_one(/*@only@*/ void *d) } static /*@partial@*/ yasm_symrec * -symrec_new_common(/*@keep@*/ char *name) +symrec_new_common(/*@keep@*/ char *name, int case_sensitive) { yasm_symrec *rec = yasm_xmalloc(sizeof(yasm_symrec)); + + if (!case_sensitive) { + char *c; + for (c=name; *c; c++) + *c = tolower(*c); + } + rec->name = name; rec->type = SYM_UNKNOWN; rec->def_line = 0; rec->decl_line = 0; rec->use_line = 0; rec->visibility = YASM_SYM_LOCAL; + rec->size = 0; + rec->segment = NULL; rec->assoc_data = NULL; return rec; } @@ -166,11 +183,17 @@ symrec_new_common(/*@keep@*/ char *name) static /*@partial@*/ /*@dependent@*/ yasm_symrec * symtab_get_or_new_in_table(yasm_symtab *symtab, /*@only@*/ char *name) { - yasm_symrec *rec = symrec_new_common(name); + yasm_symrec *rec = symrec_new_common(name, symtab->case_sensitive); int replace = 0; rec->status = YASM_SYM_NOSTATUS; + if (!symtab->case_sensitive) { + char *c; + for (c=name; *c; c++) + *c = tolower(*c); + } + return HAMT_insert(symtab->sym_table, name, rec, &replace, symrec_destroy_one); } @@ -179,7 +202,7 @@ static /*@partial@*/ /*@dependent@*/ yasm_symrec * symtab_get_or_new_not_in_table(yasm_symtab *symtab, /*@only@*/ char *name) { non_table_symrec *sym = yasm_xmalloc(sizeof(non_table_symrec)); - sym->rec = symrec_new_common(name); + sym->rec = symrec_new_common(name, symtab->case_sensitive); sym->rec->status = YASM_SYM_NOTINTABLE; @@ -254,7 +277,17 @@ yasm_symtab_use(yasm_symtab *symtab, const char *name, unsigned long line) yasm_symrec * yasm_symtab_get(yasm_symtab *symtab, const char *name) { - return HAMT_search(symtab->sym_table, name); + if (!symtab->case_sensitive) { + char *_name = yasm__xstrdup(name); + char *c; + yasm_symrec *ret; + for (c=_name; *c; c++) + *c = tolower(*c); + ret = HAMT_search(symtab->sym_table, _name); + yasm_xfree(_name); + return ret; + } else + return HAMT_search(symtab->sym_table, name); } static /*@dependent@*/ yasm_symrec * @@ -276,6 +309,8 @@ symtab_define(yasm_symtab *symtab, const char *name, sym_type type, rec->def_line = line; /* set line number of definition */ rec->type = type; rec->status |= YASM_SYM_DEFINED; + rec->size = 0; + rec->segment = NULL; } return rec; } @@ -456,6 +491,21 @@ yasm_symrec_get_name(const yasm_symrec *sym) return sym->name; } +char * +yasm_symrec_get_global_name(const yasm_symrec *sym, const yasm_object *object) +{ + if (sym->visibility & (YASM_SYM_GLOBAL|YASM_SYM_COMMON|YASM_SYM_EXTERN)) { + char *name = yasm_xmalloc(strlen(object->global_prefix) + + strlen(sym->name) + + strlen(object->global_suffix) + 1); + strcpy(name, object->global_prefix); + strcat(name, sym->name); + strcat(name, object->global_suffix); + return name; + } + return yasm__xstrdup(sym->name); +} + yasm_sym_vis yasm_symrec_get_visibility(const yasm_symrec *sym) { @@ -507,6 +557,30 @@ yasm_symrec_get_label(const yasm_symrec *sym, return 1; } +void +yasm_symrec_set_size(yasm_symrec *sym, int size) +{ + sym->size = size; +} + +int +yasm_symrec_get_size(const yasm_symrec *sym) +{ + return sym->size; +} + +void +yasm_symrec_set_segment(yasm_symrec *sym, const char *segment) +{ + sym->segment = segment; +} + +const char * +yasm_symrec_get_segment(const yasm_symrec *sym) +{ + return sym->segment; +} + int yasm_symrec_is_abs(const yasm_symrec *sym) { diff --git a/libyasm/symrec.h b/libyasm/symrec.h index 349dcce5..b1f797c6 100644 --- a/libyasm/symrec.h +++ b/libyasm/symrec.h @@ -2,10 +2,6 @@ * \file libyasm/symrec.h * \brief YASM symbol table interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Michael Urman, Peter Johnson * @@ -34,6 +30,10 @@ #ifndef YASM_SYMREC_H #define YASM_SYMREC_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Symbol status. YASM_SYM_DEFINED is set by yasm_symtab_define_label(), * yasm_symtab_define_equ(), or yasm_symtab_declare()/yasm_symrec_declare() * with a visibility of #YASM_SYM_EXTERN or #YASM_SYM_COMMON. @@ -58,6 +58,7 @@ typedef enum yasm_sym_vis { } yasm_sym_vis; /** Create a new symbol table. */ +YASM_LIB_DECL yasm_symtab *yasm_symtab_create(void); /** Destroy a symbol table and all internal symbols. @@ -65,8 +66,17 @@ yasm_symtab *yasm_symtab_create(void); * \warning All yasm_symrec *'s into this symbol table become invalid after * this is called! */ +YASM_LIB_DECL void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); +/** Set the symbol table to be case sensitive or not. + * Should be called before adding any symbol. + * \param symtab symbol table + * \param sensitive whether the symbol table should be case sensitive. + */ +YASM_LIB_DECL +void yasm_symtab_set_case_sensitive(yasm_symtab *symtab, int sensitive); + /** Get a reference to the symbol table's "absolute" symbol. This is * essentially an EQU with no name and value 0, and is used for relocating * absolute current-position-relative values. @@ -74,6 +84,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param symtab symbol table * \return Absolute symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_abs_sym(yasm_symtab *symtab); /** Get a reference to (use) a symbol. The symbol does not necessarily need to @@ -83,6 +94,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param line virtual line where referenced * \return Symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_use (yasm_symtab *symtab, const char *name, unsigned long line); @@ -94,6 +106,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \return Symbol (dependent pointer, do not free). May be NULL if symbol * doesn't exist. */ +YASM_LIB_DECL /*@null@*/ /*@dependent@*/ yasm_symrec *yasm_symtab_get (yasm_symtab *symtab, const char *name); @@ -104,6 +117,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param line virtual line of EQU * \return Symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_define_equ (yasm_symtab *symtab, const char *name, /*@keep@*/ yasm_expr *e, unsigned long line); @@ -117,6 +131,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param line virtual line of label * \return Symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_define_label (yasm_symtab *symtab, const char *name, /*@dependent@*/ yasm_bytecode *precbc, int in_table, unsigned long line); @@ -131,6 +146,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param line virtual line of label * \return Symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_define_curpos (yasm_symtab *symtab, const char *name, /*@dependent@*/ yasm_bytecode *precbc, unsigned long line); @@ -143,6 +159,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param vis symbol visibility * \return Symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_define_special (yasm_symtab *symtab, const char *name, yasm_sym_vis vis); @@ -154,6 +171,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param line virtual line of visibility-setting * \return Symbol (dependent pointer, do not free). */ +YASM_LIB_DECL /*@dependent@*/ yasm_symrec *yasm_symtab_declare (yasm_symtab *symtab, const char *name, yasm_sym_vis vis, unsigned long line); @@ -164,6 +182,7 @@ void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab); * \param vis visibility * \param line virtual line of visibility-setting */ +YASM_LIB_DECL void yasm_symrec_declare(yasm_symrec *symrec, yasm_sym_vis vis, unsigned long line); @@ -182,6 +201,7 @@ typedef int (*yasm_symtab_traverse_callback) * \return Nonzero value returned by callback function if it ever returned * nonzero. */ +YASM_LIB_DECL int /*@alt void@*/ yasm_symtab_traverse (yasm_symtab *symtab, /*@null@*/ void *d, yasm_symtab_traverse_callback func); @@ -193,12 +213,14 @@ typedef struct yasm_symtab_iter yasm_symtab_iter; * \param symtab symbol table * \return Iterator for the symbol table. */ +YASM_LIB_DECL const yasm_symtab_iter *yasm_symtab_first(const yasm_symtab *symtab); /** Move a symbol table iterator to the next symbol in the symbol table. * \param prev Previous iterator value * \return Next iterator value, or NULL if no more symbols in the table. */ +YASM_LIB_DECL /*@null@*/ const yasm_symtab_iter *yasm_symtab_next (const yasm_symtab_iter *prev); @@ -206,6 +228,7 @@ const yasm_symtab_iter *yasm_symtab_first(const yasm_symtab *symtab); * \param cur iterator value * \return Corresponding symbol. */ +YASM_LIB_DECL yasm_symrec *yasm_symtab_iter_value(const yasm_symtab_iter *cur); /** Finalize symbol table after parsing stage. Checks for symbols that are @@ -215,6 +238,7 @@ yasm_symrec *yasm_symtab_iter_value(const yasm_symtab_iter *cur); * \param errwarns error/warning set * \note Errors/warnings are stored into errwarns. */ +YASM_LIB_DECL void yasm_symtab_parser_finalize(yasm_symtab *symtab, int undef_extern, yasm_errwarns *errwarns); @@ -223,48 +247,65 @@ void yasm_symtab_parser_finalize(yasm_symtab *symtab, int undef_extern, * \param f file * \param indent_level indentation level */ +YASM_LIB_DECL void yasm_symtab_print(yasm_symtab *symtab, FILE *f, int indent_level); /** Get the name of a symbol. * \param sym symbol * \return Symbol name. */ +YASM_LIB_DECL /*@observer@*/ const char *yasm_symrec_get_name(const yasm_symrec *sym); +/** Get the externally-visible (global) name of a symbol. + * \param sym symbol + * \param object object + * \return Externally-visible symbol name (allocated, caller must free). + */ +YASM_LIB_DECL +/*@only@*/ char *yasm_symrec_get_global_name(const yasm_symrec *sym, + const yasm_object *object); + /** Get the visibility of a symbol. * \param sym symbol * \return Symbol visibility. */ +YASM_LIB_DECL yasm_sym_vis yasm_symrec_get_visibility(const yasm_symrec *sym); /** Get the status of a symbol. * \param sym symbol * \return Symbol status. */ +YASM_LIB_DECL yasm_sym_status yasm_symrec_get_status(const yasm_symrec *sym); /** Get the virtual line of where a symbol was first defined. * \param sym symbol * \return line virtual line */ +YASM_LIB_DECL unsigned long yasm_symrec_get_def_line(const yasm_symrec *sym); /** Get the virtual line of where a symbol was first declared. * \param sym symbol * \return line virtual line */ +YASM_LIB_DECL unsigned long yasm_symrec_get_decl_line(const yasm_symrec *sym); /** Get the virtual line of where a symbol was first used. * \param sym symbol * \return line virtual line */ +YASM_LIB_DECL unsigned long yasm_symrec_get_use_line(const yasm_symrec *sym); /** Get EQU value of a symbol. * \param sym symbol * \return EQU value, or NULL if symbol is not an EQU or is not defined. */ +YASM_LIB_DECL /*@observer@*/ /*@null@*/ const yasm_expr *yasm_symrec_get_equ (const yasm_symrec *sym); @@ -277,32 +318,65 @@ typedef /*@dependent@*/ yasm_bytecode *yasm_symrec_get_label_bytecodep; * \return 0 if not symbol is not a label or if the symbol's visibility is * #YASM_SYM_EXTERN or #YASM_SYM_COMMON (not defined in the file). */ +YASM_LIB_DECL int yasm_symrec_get_label(const yasm_symrec *sym, /*@out@*/ yasm_symrec_get_label_bytecodep *precbc); +/** Set the size of a symbol. + * \param sym symbol + * \param size size to be set + */ +YASM_LIB_DECL +void yasm_symrec_set_size(yasm_symrec *sym, int size); + +/** Get the size of a symbol. + * \param sym symbol + * \return size of the symbol, 0 if none specified by the user. + */ +YASM_LIB_DECL +int yasm_symrec_get_size(const yasm_symrec *sym); + +/** Set the segment of a symbol. + * \param sym symbol + * \param segment segment to be set + */ +YASM_LIB_DECL +void yasm_symrec_set_segment(yasm_symrec *sym, const char *segment); + +/** Get the segment of a symbol. + * \param sym symbol + * \return segment of the symbol, NULL if none specified by the user. + */ +YASM_LIB_DECL +const char *yasm_symrec_get_segment(const yasm_symrec *sym); + /** Determine if symbol is the "absolute" symbol created by * yasm_symtab_abs_sym(). * \param sym symbol * \return 0 if symbol is not the "absolute" symbol, nonzero otherwise. */ +YASM_LIB_DECL int yasm_symrec_is_abs(const yasm_symrec *sym); /** Determine if symbol is a special symbol. * \param sym symbol * \return 0 if symbol is not a special symbol, nonzero otherwise. */ +YASM_LIB_DECL int yasm_symrec_is_special(const yasm_symrec *sym); /** Determine if symbol is a label representing the current assembly position. * \param sym symbol * \return 0 if symbol is not a current position label, nonzero otherwise. */ +YASM_LIB_DECL int yasm_symrec_is_curpos(const yasm_symrec *sym); /** Set object-extended valparams. * \param sym symbol * \param objext_valparams object-extended valparams */ +YASM_LIB_DECL void yasm_symrec_set_objext_valparams (yasm_symrec *sym, /*@only@*/ yasm_valparamhead *objext_valparams); @@ -311,6 +385,7 @@ void yasm_symrec_set_objext_valparams * \param sym symbol * \return Object-extended valparams (NULL if none). */ +YASM_LIB_DECL /*@null@*/ /*@dependent@*/ yasm_valparamhead *yasm_symrec_get_objext_valparams (yasm_symrec *sym); @@ -318,6 +393,7 @@ void yasm_symrec_set_objext_valparams * \param sym symbol * \param common_size common size expression */ +YASM_LIB_DECL void yasm_symrec_set_common_size (yasm_symrec *sym, /*@only@*/ yasm_expr *common_size); @@ -326,6 +402,7 @@ void yasm_symrec_set_common_size * \param sym symbol * \return Common size (NULL if none). */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ yasm_expr **yasm_symrec_get_common_size (yasm_symrec *sym); @@ -334,6 +411,7 @@ void yasm_symrec_set_common_size * \param callback callback used when adding data * \return Associated data (NULL if none). */ +YASM_LIB_DECL /*@dependent@*/ /*@null@*/ void *yasm_symrec_get_data (yasm_symrec *sym, const yasm_assoc_data_callback *callback); @@ -343,6 +421,7 @@ void yasm_symrec_set_common_size * \param callback callback * \param data data to associate */ +YASM_LIB_DECL void yasm_symrec_add_data(yasm_symrec *sym, const yasm_assoc_data_callback *callback, /*@only@*/ /*@null@*/ void *data); @@ -352,6 +431,7 @@ void yasm_symrec_add_data(yasm_symrec *sym, * \param indent_level indentation level * \param sym symbol */ +YASM_LIB_DECL void yasm_symrec_print(const yasm_symrec *sym, FILE *f, int indent_level); #endif diff --git a/libyasm/tests/1shl0.asm b/libyasm/tests/1shl0.asm new file mode 100644 index 00000000..d69930ad --- /dev/null +++ b/libyasm/tests/1shl0.asm @@ -0,0 +1 @@ +dd (1<<0) diff --git a/libyasm/tests/1shl0.hex b/libyasm/tests/1shl0.hex new file mode 100644 index 00000000..607fb55a --- /dev/null +++ b/libyasm/tests/1shl0.hex @@ -0,0 +1,4 @@ +01 +00 +00 +00 diff --git a/libyasm/tests/Makefile.inc b/libyasm/tests/Makefile.inc index 1528ef68..9c038a14 100644 --- a/libyasm/tests/Makefile.inc +++ b/libyasm/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += bitvect_test TESTS += floatnum_test TESTS += leb128_test @@ -9,6 +7,8 @@ TESTS += uncstring_test TESTS += libyasm/tests/libyasm_test.sh EXTRA_DIST += libyasm/tests/libyasm_test.sh +EXTRA_DIST += libyasm/tests/1shl0.asm +EXTRA_DIST += libyasm/tests/1shl0.hex EXTRA_DIST += libyasm/tests/absloop-err.asm EXTRA_DIST += libyasm/tests/absloop-err.errwarn EXTRA_DIST += libyasm/tests/charconst64.asm @@ -21,6 +21,10 @@ EXTRA_DIST += libyasm/tests/emptydata.asm EXTRA_DIST += libyasm/tests/emptydata.hex EXTRA_DIST += libyasm/tests/equ-expand.asm EXTRA_DIST += libyasm/tests/equ-expand.hex +EXTRA_DIST += libyasm/tests/expr-fold-level.asm +EXTRA_DIST += libyasm/tests/expr-fold-level.hex +EXTRA_DIST += libyasm/tests/expr-simplify-identity.asm +EXTRA_DIST += libyasm/tests/expr-simplify-identity.hex EXTRA_DIST += libyasm/tests/expr-wide-ident.asm EXTRA_DIST += libyasm/tests/expr-wide-ident.hex EXTRA_DIST += libyasm/tests/externdef.asm @@ -62,6 +66,8 @@ EXTRA_DIST += libyasm/tests/strucsize.asm EXTRA_DIST += libyasm/tests/strucsize.hex EXTRA_DIST += libyasm/tests/times0.asm EXTRA_DIST += libyasm/tests/times0.hex +EXTRA_DIST += libyasm/tests/timesfwd.asm +EXTRA_DIST += libyasm/tests/timesfwd.hex EXTRA_DIST += libyasm/tests/timesover-err.asm EXTRA_DIST += libyasm/tests/timesover-err.errwarn EXTRA_DIST += libyasm/tests/timesunder.asm @@ -73,6 +79,14 @@ EXTRA_DIST += libyasm/tests/unary.asm EXTRA_DIST += libyasm/tests/unary.hex EXTRA_DIST += libyasm/tests/value-err.asm EXTRA_DIST += libyasm/tests/value-err.errwarn +EXTRA_DIST += libyasm/tests/value-samesym.asm +EXTRA_DIST += libyasm/tests/value-samesym.errwarn +EXTRA_DIST += libyasm/tests/value-samesym.hex +EXTRA_DIST += libyasm/tests/value-mask.asm +EXTRA_DIST += libyasm/tests/value-mask.errwarn +EXTRA_DIST += libyasm/tests/value-mask.hex +EXTRA_DIST += libyasm/tests/value-shr-symexpr.asm +EXTRA_DIST += libyasm/tests/value-shr-symexpr.hex check_PROGRAMS += bitvect_test check_PROGRAMS += floatnum_test diff --git a/libyasm/tests/absloop-err.errwarn b/libyasm/tests/absloop-err.errwarn index 79983393..29d3a334 100644 --- a/libyasm/tests/absloop-err.errwarn +++ b/libyasm/tests/absloop-err.errwarn @@ -1 +1 @@ --:6: circular reference detected in memory expression +-:6: error: circular reference detected in memory expression diff --git a/libyasm/tests/bitvect_test.c b/libyasm/tests/bitvect_test.c index 40485262..b60b7ede 100644 --- a/libyasm/tests/bitvect_test.c +++ b/libyasm/tests/bitvect_test.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Copyright (C) 2001-2007 Peter Johnson * @@ -23,17 +23,11 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -#endif - #include +#include +#include +#include "util.h" #include "libyasm/bitvect.h" static int @@ -116,7 +110,7 @@ num_check(Val *val) strcat(result_msg, ": "); strcat(result_msg, (char *)ascii); } - free(result); + yasm_xfree(result); return ret; } diff --git a/libyasm/tests/combpath_test.c b/libyasm/tests/combpath_test.c index e0edf8eb..90f2e241 100644 --- a/libyasm/tests/combpath_test.c +++ b/libyasm/tests/combpath_test.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Copyright (C) 2006-2007 Peter Johnson * @@ -23,16 +23,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -#endif - #include +#include +#include #include "libyasm/file.h" #include "libyasm/coretype.h" diff --git a/libyasm/tests/duplabel-err.errwarn b/libyasm/tests/duplabel-err.errwarn index 69014ad8..4ce13bff 100644 --- a/libyasm/tests/duplabel-err.errwarn +++ b/libyasm/tests/duplabel-err.errwarn @@ -1,4 +1,4 @@ --:16: redefinition of `label' --:12: `label' previously defined here --:18: redefinition of `label' --:12: `label' previously defined here +-:16: error: redefinition of `label' +-:12: error: `label' previously defined here +-:18: error: redefinition of `label' +-:12: error: `label' previously defined here diff --git a/libyasm/tests/expr-fold-level.asm b/libyasm/tests/expr-fold-level.asm new file mode 100644 index 00000000..814a62c5 --- /dev/null +++ b/libyasm/tests/expr-fold-level.asm @@ -0,0 +1,4 @@ +begin +A equ 09000h +a dd (A+(end-begin)+3) +end diff --git a/libyasm/tests/expr-fold-level.hex b/libyasm/tests/expr-fold-level.hex new file mode 100644 index 00000000..aba10f6d --- /dev/null +++ b/libyasm/tests/expr-fold-level.hex @@ -0,0 +1,4 @@ +07 +90 +00 +00 diff --git a/libyasm/tests/expr-simplify-identity.asm b/libyasm/tests/expr-simplify-identity.asm new file mode 100644 index 00000000..cda9c3bb --- /dev/null +++ b/libyasm/tests/expr-simplify-identity.asm @@ -0,0 +1,4 @@ +d_key equ 0 +cachedata: DQ 0 +dtable: +cmp al, [esi + (dtable-cachedata) + ebx*4 + d_key] diff --git a/libyasm/tests/expr-simplify-identity.hex b/libyasm/tests/expr-simplify-identity.hex new file mode 100644 index 00000000..4a236bc5 --- /dev/null +++ b/libyasm/tests/expr-simplify-identity.hex @@ -0,0 +1,13 @@ +00 +00 +00 +00 +00 +00 +00 +00 +67 +3a +44 +9e +08 diff --git a/libyasm/tests/floatnum_test.c b/libyasm/tests/floatnum_test.c index 907aac98..2447e90b 100644 --- a/libyasm/tests/floatnum_test.c +++ b/libyasm/tests/floatnum_test.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Copyright (C) 2001-2007 Peter Johnson * @@ -23,16 +23,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -#endif - #include +#include +#include #include "libyasm/floatnum.c" @@ -184,7 +177,7 @@ new_check_flt(Init_Entry *val) for (i=1;imantissa[i]) result = 1; - free(mantissa); + yasm_xfree(mantissa); if (result) { strcat(result_msg, "mantissa"); return 1; @@ -238,7 +231,7 @@ test_new_normalized_edgecase(void) static void get_family_setup(void) { - flt = malloc(sizeof(yasm_floatnum)); + flt = yasm_xmalloc(sizeof(yasm_floatnum)); flt->mantissa = BitVector_Create(MANT_BITS, TRUE); } @@ -246,7 +239,7 @@ static void get_family_teardown(void) { BitVector_Destroy(flt->mantissa); - free(flt); + yasm_xfree(flt); } static void diff --git a/libyasm/tests/jmpsize1-err.errwarn b/libyasm/tests/jmpsize1-err.errwarn index 9b821acc..276b1eb8 100644 --- a/libyasm/tests/jmpsize1-err.errwarn +++ b/libyasm/tests/jmpsize1-err.errwarn @@ -1,2 +1,2 @@ --:132: short jump out of range --:263: short jump out of range +-:132: error: short jump out of range +-:263: error: short jump out of range diff --git a/libyasm/tests/leb128_test.c b/libyasm/tests/leb128_test.c index 18ae9958..87fc8d91 100644 --- a/libyasm/tests/leb128_test.c +++ b/libyasm/tests/leb128_test.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Copyright (C) 2005-2007 Peter Johnson * @@ -23,16 +23,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -#endif - #include +#include +#include #include "libyasm/intnum.c" diff --git a/libyasm/tests/libyasm_test.sh b/libyasm/tests/libyasm_test.sh index 02457315..37f8717f 100755 --- a/libyasm/tests/libyasm_test.sh +++ b/libyasm/tests/libyasm_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh libyasm_test libyasm/tests "libyasm" "-f bin" "" exit $? diff --git a/libyasm/tests/opt-circular1-err.errwarn b/libyasm/tests/opt-circular1-err.errwarn index b26f47ad..9b09e1c5 100644 --- a/libyasm/tests/opt-circular1-err.errwarn +++ b/libyasm/tests/opt-circular1-err.errwarn @@ -1 +1 @@ --:1: circular reference detected +-:1: error: circular reference detected diff --git a/libyasm/tests/opt-circular2-err.errwarn b/libyasm/tests/opt-circular2-err.errwarn index b26f47ad..9b09e1c5 100644 --- a/libyasm/tests/opt-circular2-err.errwarn +++ b/libyasm/tests/opt-circular2-err.errwarn @@ -1 +1 @@ --:1: circular reference detected +-:1: error: circular reference detected diff --git a/libyasm/tests/opt-circular3-err.errwarn b/libyasm/tests/opt-circular3-err.errwarn index bf1d3fa2..041cbba2 100644 --- a/libyasm/tests/opt-circular3-err.errwarn +++ b/libyasm/tests/opt-circular3-err.errwarn @@ -1 +1 @@ --:6: circular reference detected +-:6: error: circular reference detected diff --git a/libyasm/tests/reserve-err1.errwarn b/libyasm/tests/reserve-err1.errwarn index e3da650a..e53fe3c7 100644 --- a/libyasm/tests/reserve-err1.errwarn +++ b/libyasm/tests/reserve-err1.errwarn @@ -1,2 +1,2 @@ --:7: multiple expression not absolute --:14: multiple expression not absolute +-:7: error: multiple expression not absolute +-:14: error: multiple expression not absolute diff --git a/libyasm/tests/reserve-err2.errwarn b/libyasm/tests/reserve-err2.errwarn index 44c5efa9..d3fbbabb 100644 --- a/libyasm/tests/reserve-err2.errwarn +++ b/libyasm/tests/reserve-err2.errwarn @@ -1,6 +1,6 @@ --:3: multiple is negative --:4: expression must not contain floating point value --:5: expression must not contain floating point value --:10: multiple is negative --:11: expression must not contain floating point value --:12: expression must not contain floating point value +-:3: error: multiple is negative +-:4: error: expression must not contain floating point value +-:5: error: expression must not contain floating point value +-:10: error: multiple is negative +-:11: error: expression must not contain floating point value +-:12: error: expression must not contain floating point value diff --git a/libyasm/tests/splitpath_test.c b/libyasm/tests/splitpath_test.c index aada6a5d..7f873a47 100644 --- a/libyasm/tests/splitpath_test.c +++ b/libyasm/tests/splitpath_test.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Copyright (C) 2006-2007 Peter Johnson * @@ -23,16 +23,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -#endif - #include +#include +#include #include "libyasm/file.h" diff --git a/libyasm/tests/timesfwd.asm b/libyasm/tests/timesfwd.asm new file mode 100644 index 00000000..bdb36d3e --- /dev/null +++ b/libyasm/tests/timesfwd.asm @@ -0,0 +1,8 @@ +[section .text] +[bits 64] +;[global foo] +;[global bar] +times (foo-bar+$$-$)&7 nop +foo: inc eax +bar: inc ecx + diff --git a/libyasm/tests/timesfwd.hex b/libyasm/tests/timesfwd.hex new file mode 100644 index 00000000..82904beb --- /dev/null +++ b/libyasm/tests/timesfwd.hex @@ -0,0 +1,10 @@ +90 +90 +90 +90 +90 +90 +ff +c0 +ff +c1 diff --git a/libyasm/tests/timesover-err.errwarn b/libyasm/tests/timesover-err.errwarn index c972a1d9..81441ac3 100644 --- a/libyasm/tests/timesover-err.errwarn +++ b/libyasm/tests/timesover-err.errwarn @@ -1 +1 @@ --:2: multiple is negative +-:2: error: multiple is negative diff --git a/libyasm/tests/uncstring_test.c b/libyasm/tests/uncstring_test.c index a067858e..73037642 100644 --- a/libyasm/tests/uncstring_test.c +++ b/libyasm/tests/uncstring_test.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Copyright (C) 2006-2007 Peter Johnson * @@ -23,16 +23,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -#endif - #include +#include +#include #include "util.h" #include "libyasm/errwarn.h" diff --git a/libyasm/tests/value-err.errwarn b/libyasm/tests/value-err.errwarn index a7535524..a949cd85 100644 --- a/libyasm/tests/value-err.errwarn +++ b/libyasm/tests/value-err.errwarn @@ -1,3 +1,3 @@ --:2: effective address too complex --:3: immediate expression too complex --:8: data expression too complex +-:2: error: effective address too complex +-:3: error: immediate expression too complex +-:8: error: data expression too complex diff --git a/libyasm/tests/value-mask.asm b/libyasm/tests/value-mask.asm new file mode 100644 index 00000000..3e939521 --- /dev/null +++ b/libyasm/tests/value-mask.asm @@ -0,0 +1,5 @@ +db label +db label & 0xff +section .bss +resb 500 +label: diff --git a/libyasm/tests/value-mask.errwarn b/libyasm/tests/value-mask.errwarn new file mode 100644 index 00000000..9df5a665 --- /dev/null +++ b/libyasm/tests/value-mask.errwarn @@ -0,0 +1 @@ +-:1: warning: value does not fit in 8 bit field diff --git a/libyasm/tests/value-mask.hex b/libyasm/tests/value-mask.hex new file mode 100644 index 00000000..8cae27c3 --- /dev/null +++ b/libyasm/tests/value-mask.hex @@ -0,0 +1,2 @@ +f8 +f8 diff --git a/libyasm/tests/value-samesym.asm b/libyasm/tests/value-samesym.asm new file mode 100644 index 00000000..da325992 --- /dev/null +++ b/libyasm/tests/value-samesym.asm @@ -0,0 +1,2 @@ +extern RW +mov [eax + (RW + 22032) - (RW + 23056)], eax diff --git a/libyasm/tests/value-samesym.errwarn b/libyasm/tests/value-samesym.errwarn new file mode 100644 index 00000000..58c850b3 --- /dev/null +++ b/libyasm/tests/value-samesym.errwarn @@ -0,0 +1 @@ +-:1: warning: binary object format does not support extern variables diff --git a/libyasm/tests/value-samesym.hex b/libyasm/tests/value-samesym.hex new file mode 100644 index 00000000..4bab16b8 --- /dev/null +++ b/libyasm/tests/value-samesym.hex @@ -0,0 +1,8 @@ +67 +66 +89 +80 +00 +fc +ff +ff diff --git a/libyasm/tests/value-shr-symexpr.asm b/libyasm/tests/value-shr-symexpr.asm new file mode 100644 index 00000000..988abbff --- /dev/null +++ b/libyasm/tests/value-shr-symexpr.asm @@ -0,0 +1,6 @@ +dw foo +dw (foo+((1<<9)-1)) +dw (foo+((1<<9)-1)) >> 9 +foo: +dw (bar+foo)>>(0+1) +bar: diff --git a/libyasm/tests/value-shr-symexpr.hex b/libyasm/tests/value-shr-symexpr.hex new file mode 100644 index 00000000..b3169287 --- /dev/null +++ b/libyasm/tests/value-shr-symexpr.hex @@ -0,0 +1,8 @@ +06 +00 +05 +02 +01 +00 +07 +00 diff --git a/libyasm/valparam.c b/libyasm/valparam.c index 752ab7e3..88e41a7c 100644 --- a/libyasm/valparam.c +++ b/libyasm/valparam.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -218,31 +216,6 @@ yasm_vps_destroy(yasm_valparamhead *headp) yasm_xfree(headp); } -/* Non-macro yasm_vps_append() for non-YASM_LIB_INTERNAL users. */ -#undef yasm_vps_append -void -yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp) -{ - if (vp) - STAILQ_INSERT_TAIL(headp, vp, link); -} - -/* Non-macro yasm_vps_first() for non-YASM_LIB_INTERNAL users. */ -#undef yasm_vps_first -/*@null@*/ /*@dependent@*/ yasm_valparam * -yasm_vps_first(yasm_valparamhead *headp) -{ - return STAILQ_FIRST(headp); -} - -/* Non-macro yasm_vps_next() for non-YASM_LIB_INTERNAL users. */ -#undef yasm_vps_next -/*@null@*/ /*@dependent@*/ yasm_valparam * -yasm_vps_next(yasm_valparam *cur) -{ - return STAILQ_NEXT(cur, link); -} - int yasm_dir_helper(void *obj, yasm_valparam *vp_first, unsigned long line, const yasm_dir_help *help, size_t nhelp, void *data, @@ -328,6 +301,23 @@ yasm_dir_helper_flag_set(void *obj, yasm_valparam *vp, unsigned long line, return 0; } +int +yasm_dir_helper_expr(void *obj, yasm_valparam *vp, unsigned long line, + void *data, uintptr_t arg) +{ + yasm_object *object = (yasm_object *)obj; + yasm_expr **expr = (yasm_expr **)data; + + if (*expr) + yasm_expr_destroy(*expr); + if (!(*expr = yasm_vp_expr(vp, object->symtab, line))) { + yasm_error_set(YASM_ERROR_VALUE, N_("argument to `%s' is not an expression"), + vp->val); + return -1; + } + return 0; +} + int yasm_dir_helper_intn(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg) diff --git a/libyasm/valparam.h b/libyasm/valparam.h index 4a64a66f..d7343d49 100644 --- a/libyasm/valparam.h +++ b/libyasm/valparam.h @@ -2,10 +2,6 @@ * \file libyasm/valparam.h * \brief YASM value/parameter interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2001-2007 Peter Johnson * @@ -34,36 +30,40 @@ #ifndef YASM_VALPARAM_H #define YASM_VALPARAM_H -#ifdef YASM_LIB_INTERNAL +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Value/parameter pair. \internal */ struct yasm_valparam { /*@reldef@*/ STAILQ_ENTRY(yasm_valparam) link; /**< Next pair in list */ /*@owned@*/ /*@null@*/ char *val; /**< Value */ + /** Parameter type. */ enum yasm_param_type { YASM_PARAM_ID, /**< Identifier */ YASM_PARAM_STRING, /**< String */ YASM_PARAM_EXPR /**< Expression */ } type; /**< Parameter type */ + /** Parameter value. */ union yasm_param { /*@owned@*/ char *id; /**< Identifier */ /*@owned@*/ char *str; /**< String */ /*@owned@*/ yasm_expr *e; /**< Expression */ } param; /**< Parameter */ - /* Prefix character that indicates a raw identifier. When yasm_vp_string() - * is called on a #YASM_PARAM_ID, all characters are returned. When - * yasm_vp_id() is called on a #YASM_PARAM_ID, if the identifier begins - * with this character, this character is stripped from the returned - * value. + /** Prefix character that indicates a raw identifier. When + * yasm_vp_string() is called on a #YASM_PARAM_ID, all characters are + * returned. When yasm_vp_id() is called on a #YASM_PARAM_ID, if the + * identifier begins with this character, this character is stripped + * from the returned value. */ char id_prefix; }; /** Linked list of value/parameter pairs. \internal */ /*@reldef@*/ STAILQ_HEAD(yasm_valparamhead, yasm_valparam); -#endif /** Directive list entry structure. */ struct yasm_directive { @@ -101,6 +101,7 @@ struct yasm_directive { * \param objext_valparams object format-specific value/parameters * \param line virtual line (from yasm_linemap) */ +YASM_LIB_DECL void yasm_call_directive(const yasm_directive *directive, yasm_object *object, yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, @@ -112,6 +113,7 @@ void yasm_call_directive(const yasm_directive *directive, yasm_object *object, * \param id_prefix identifier prefix for raw identifiers * \return Newly allocated valparam. */ +YASM_LIB_DECL yasm_valparam *yasm_vp_create_id(/*@keep@*/ char *v, /*@keep@*/ char *p, int id_prefix); @@ -120,6 +122,7 @@ yasm_valparam *yasm_vp_create_id(/*@keep@*/ char *v, /*@keep@*/ char *p, * \param p parameter * \return Newly allocated valparam. */ +YASM_LIB_DECL yasm_valparam *yasm_vp_create_string(/*@keep@*/ char *v, /*@keep@*/ char *p); /** Create a new valparam with expression parameter. @@ -127,6 +130,7 @@ yasm_valparam *yasm_vp_create_string(/*@keep@*/ char *v, /*@keep@*/ char *p); * \param p parameter * \return Newly allocated valparam. */ +YASM_LIB_DECL yasm_valparam *yasm_vp_create_expr(/*@keep@*/ char *v, /*@keep@*/ yasm_expr *p); @@ -138,6 +142,7 @@ yasm_valparam *yasm_vp_create_expr(/*@keep@*/ char *v, * \return Expression, or NULL if vp is NULL or the parameter cannot be * converted to an expression. */ +YASM_LIB_DECL /*@null@*/ /*@only@*/ yasm_expr *yasm_vp_expr (const yasm_valparam *vp, yasm_symtab *symtab, unsigned long line); @@ -147,6 +152,7 @@ yasm_valparam *yasm_vp_create_expr(/*@keep@*/ char *v, * \return String, or NULL if vp is NULL or the parameter cannot be realized * as a string. */ +YASM_LIB_DECL /*@null@*/ /*@dependent@*/ const char *yasm_vp_string(const yasm_valparam *vp); /** Get a valparam parameter as an identifier. @@ -154,38 +160,43 @@ yasm_valparam *yasm_vp_create_expr(/*@keep@*/ char *v, * \return Identifier (string), or NULL if vp is NULL or the parameter is not * an identifier. */ +YASM_LIB_DECL /*@null@*/ /*@dependent@*/ const char *yasm_vp_id(const yasm_valparam *vp); /** Create a new linked list of valparams. * \return Newly allocated valparam list. */ +YASM_LIB_DECL yasm_valparamhead *yasm_vps_create(void); /** Destroy a list of valparams (created with yasm_vps_create). * \param headp list of valparams */ +YASM_LIB_DECL void yasm_vps_destroy(yasm_valparamhead *headp); -#ifdef YASM_LIB_INTERNAL /** Initialize linked list of valparams. * \param headp linked list */ +void yasm_vps_initialize(/*@out@*/ yasm_valparamhead *headp); +#ifndef YASM_DOXYGEN #define yasm_vps_initialize(headp) STAILQ_INIT(headp) +#endif /** Destroy (free allocated memory for) linked list of valparams (created with * yasm_vps_initialize). * \warning Deletes val/params. * \param headp linked list */ +YASM_LIB_DECL void yasm_vps_delete(yasm_valparamhead *headp); -#endif /** Append valparam to tail of linked list. * \param headp linked list * \param vp valparam */ void yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp); -#ifdef YASM_LIB_INTERNAL +#ifndef YASM_DOXYGEN #define yasm_vps_append(headp, vp) do { \ if (vp) \ STAILQ_INSERT_TAIL(headp, vp, link); \ @@ -198,7 +209,7 @@ void yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp); */ /*@null@*/ /*@dependent@*/ yasm_valparam *yasm_vps_first (yasm_valparamhead *headp); -#ifdef YASM_LIB_INTERNAL +#ifndef YASM_DOXYGEN #define yasm_vps_first(headp) STAILQ_FIRST(headp) #endif @@ -207,14 +218,16 @@ void yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp); * \return Next valparam in linked list. */ /*@null@*/ /*@dependent@*/ yasm_valparam *yasm_vps_next(yasm_valparam *cur); -#ifdef YASM_LIB_INTERNAL +#ifndef YASM_DOXYGEN #define yasm_vps_next(cur) STAILQ_NEXT(cur, link) +#endif /** Iterate through linked list of valparams. * \internal * \param iter iterator variable * \param headp linked list */ +#ifndef YASM_DOXYGEN #define yasm_vps_foreach(iter, headp) STAILQ_FOREACH(iter, headp, link) #endif @@ -222,6 +235,7 @@ void yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp); * \param f file * \param headp linked list */ +YASM_LIB_DECL void yasm_vps_print(/*@null@*/ const yasm_valparamhead *headp, FILE *f); /** Directive valparam parse helper structure. */ @@ -277,6 +291,7 @@ typedef struct yasm_dir_help { * \return -1 on error, 1 if any arguments matched (including via * catch-all callback), 0 if no match. */ +YASM_LIB_DECL int yasm_dir_helper(void *obj, yasm_valparam *vp_first, unsigned long line, const yasm_dir_help *help, size_t nhelp, void *data, int (*helper_valparam) (void *object, @@ -294,6 +309,7 @@ int yasm_dir_helper(void *obj, yasm_valparam *vp_first, unsigned long line, * \param arg flag to set * \return 0 */ +YASM_LIB_DECL int yasm_dir_helper_flag_set(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg); @@ -307,6 +323,7 @@ int yasm_dir_helper_flag_set(void *obj, yasm_valparam *vp, unsigned long line, * \param arg flag to OR * \return 0 */ +YASM_LIB_DECL int yasm_dir_helper_flag_or(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg); @@ -320,9 +337,28 @@ int yasm_dir_helper_flag_or(void *obj, yasm_valparam *vp, unsigned long line, * \param arg flag to AND * \return 0 */ +YASM_LIB_DECL int yasm_dir_helper_flag_and(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg); +/** Standard helper for yasm_dir_helper() that parses an expr parameter. + * The #yasm_dir_help structure that uses this function should have + * needsparam=1. The obj parameter to yasm_dir_helper() when this helper + * is used MUST point to a #yasm_object. In addition, the data parameter + * that is ultimately passed to this function (e.g. yasm_dir_helper() data + * parameter plus #yasm_dir_help.off) must point to a #yasm_expr * + * initialized to NULL. + * \param obj object; must be #yasm_object + * \param vp valparam + * \param line virtual line number + * \param data pointer to #yasm_expr * + * \param arg unused argument + * \return -1 on error, 0 otherwise. + */ +YASM_LIB_DECL +int yasm_dir_helper_expr(void *obj, yasm_valparam *vp, unsigned long line, + void *data, uintptr_t arg); + /** Standard helper for yasm_dir_helper() that parses an intnum parameter. * The #yasm_dir_help structure that uses this function should have * needsparam=1. The obj parameter to yasm_dir_helper() when this helper @@ -337,6 +373,7 @@ int yasm_dir_helper_flag_and(void *obj, yasm_valparam *vp, unsigned long line, * \param arg unused argument * \return -1 on error, 0 otherwise. */ +YASM_LIB_DECL int yasm_dir_helper_intn(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg); @@ -353,6 +390,7 @@ int yasm_dir_helper_intn(void *obj, yasm_valparam *vp, unsigned long line, * \param arg unused * \return -1 on error, 0 otherwise. */ +YASM_LIB_DECL int yasm_dir_helper_string(void *obj, yasm_valparam *vp, unsigned long line, void *data, uintptr_t arg); @@ -364,6 +402,7 @@ int yasm_dir_helper_string(void *obj, yasm_valparam *vp, unsigned long line, * \param data unused * \return 0 */ +YASM_LIB_DECL int yasm_dir_helper_valparam_warn(void *obj, yasm_valparam *vp, unsigned long line, void *data); #endif diff --git a/libyasm/value.c b/libyasm/value.c index decaaff8..3ab73c1c 100644 --- a/libyasm/value.c +++ b/libyasm/value.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -/*@unused@*/ RCSID("$Id$"); #include "libyasm-stdint.h" #include "coretype.h" @@ -44,8 +42,6 @@ #include "arch.h" -#include "expr-int.h" -#include "bc-int.h" void yasm_value_initialize(/*@out@*/ yasm_value *value, @@ -60,6 +56,7 @@ yasm_value_initialize(/*@out@*/ yasm_value *value, value->ip_rel = 0; value->jump_target = 0; value->section_rel = 0; + value->no_warn = 0; value->sign = 0; value->size = size; } @@ -77,6 +74,7 @@ yasm_value_init_sym(/*@out@*/ yasm_value *value, /*@null@*/ yasm_symrec *sym, value->ip_rel = 0; value->jump_target = 0; value->section_rel = 0; + value->no_warn = 0; value->sign = 0; value->size = size; } @@ -93,6 +91,7 @@ yasm_value_init_copy(yasm_value *value, const yasm_value *orig) value->ip_rel = orig->ip_rel; value->jump_target = orig->jump_target; value->section_rel = orig->section_rel; + value->no_warn = orig->no_warn; value->sign = orig->sign; value->size = orig->size; } @@ -211,6 +210,29 @@ value_finalize_scan(yasm_value *value, yasm_expr *e, continue; } + /* Look for the same symrec term; even if both are external, + * they should cancel out. + */ + for (j=0; jnumterms; j++) { + if (e->terms[j].type == YASM_EXPR_SYM + && e->terms[j].data.sym == sym + && (used & (1<terms[i].type = YASM_EXPR_INT; + e->terms[i].data.intn = yasm_intnum_create_uint(0); + e->terms[j].type = YASM_EXPR_INT; + e->terms[j].data.intn = yasm_intnum_create_uint(0); + + break; /* stop looking */ + } + } + if (j != e->numterms) + continue; + if (!yasm_symrec_get_label(sym, &precbc)) { if (value_finalize_scan(value, sube, expr_precbc, ssym_not_ok)) @@ -253,8 +275,8 @@ value_finalize_scan(yasm_value *value, yasm_expr *e, && sect2 == yasm_bc_get_section(expr_precbc)))) { for (j=0; jnumterms; j++) { if (e->terms[j].type == YASM_EXPR_SYM - && yasm_symrec_get_label(e->terms[j].data.sym, - &precbc2) + && !yasm_symrec_get_equ(e->terms[j].data.sym) + && !yasm_symrec_is_special(e->terms[j].data.sym) && (used & (1<terms[1].type) { - case YASM_EXPR_REG: - case YASM_EXPR_FLOAT: - return 1; /* not legal */ - case YASM_EXPR_SYM: - return 1; - case YASM_EXPR_EXPR: - if (value_finalize_scan(value, e->terms[1].data.expn, - expr_precbc, 1)) - return 1; - break; - default: - break; - } + /* Check for single sym on LHS */ + if (e->terms[0].type != YASM_EXPR_SYM) + break; - /* Check for single sym and allowed cases on LHS */ - switch (e->terms[0].type) { - /*case YASM_EXPR_REG: ????? should this be illegal ????? */ - case YASM_EXPR_FLOAT: - return 1; /* not legal */ - case YASM_EXPR_SYM: - if (value->rel || ssym_not_ok) - return 1; - value->rel = e->terms[0].data.sym; - /* and replace with 0 */ - e->terms[0].type = YASM_EXPR_INT; - e->terms[0].data.intn = yasm_intnum_create_uint(0); - break; - case YASM_EXPR_EXPR: - /* recurse */ - if (value_finalize_scan(value, e->terms[0].data.expn, - expr_precbc, ssym_not_ok)) - return 1; - break; - default: - break; /* ignore */ - } + /* If we already have a sym, we can't take another one */ + if (value->rel || ssym_not_ok) + return 1; - /* Handle RHS */ - if (!value->rel) - break; /* no handling needed */ + /* RHS must be a positive integer */ if (e->terms[1].type != YASM_EXPR_INT) return 1; /* can't shift sym by non-constant integer */ shamt = yasm_intnum_get_uint(e->terms[1].data.intn); if ((shamt + value->rshift) > YASM_VALUE_RSHIFT_MAX) return 1; /* total shift would be too large */ + + /* Update value */ value->rshift += shamt; + value->rel = e->terms[0].data.sym; + + /* Replace symbol with 0 */ + e->terms[0].type = YASM_EXPR_INT; + e->terms[0].data.intn = yasm_intnum_create_uint(0); /* Just leave SHR in place */ break; @@ -456,15 +452,63 @@ yasm_value_finalize_expr(yasm_value *value, yasm_expr *e, yasm_value_initialize(value, NULL, size); return 0; } + yasm_value_initialize(value, e, size); + return yasm_value_finalize(value, precbc); +} - yasm_value_initialize(value, - yasm_expr__level_tree(e, 1, 1, 0, 0, NULL, NULL), - size); +int +yasm_value_finalize(yasm_value *value, yasm_bytecode *precbc) +{ + if (!value->abs) + return 0; + + value->abs = yasm_expr__level_tree(value->abs, 1, 1, 0, 0, NULL, NULL); /* quit early if there was an issue in simplify() */ if (yasm_error_occurred()) return 1; + /* Strip top-level AND masking to an all-1s mask the same size + * of the value size. This allows forced avoidance of overflow warnings. + */ + if (value->abs->op == YASM_EXPR_AND) { + int term; + + /* Calculate 1<size); + yasm_intnum_calc(mask, YASM_EXPR_SHL, mask_tmp); + yasm_intnum_set_uint(mask_tmp, 1); + yasm_intnum_calc(mask, YASM_EXPR_SUB, mask_tmp); + yasm_intnum_destroy(mask_tmp); + + /* Walk terms and delete matching masks */ + for (term=value->abs->numterms-1; term>=0; term--) { + if (value->abs->terms[term].type == YASM_EXPR_INT && + yasm_intnum_compare(value->abs->terms[term].data.intn, + mask) == 0) { + /* Delete the intnum */ + yasm_intnum_destroy(value->abs->terms[term].data.intn); + + /* Slide everything to its right over by 1 */ + if (term != value->abs->numterms-1) /* if it wasn't last.. */ + memmove(&value->abs->terms[term], + &value->abs->terms[term+1], + (value->abs->numterms-1-term)* + sizeof(yasm_expr__item)); + + /* Update numterms */ + value->abs->numterms--; + + /* Indicate warnings have been disabled */ + value->no_warn = 1; + } + } + if (value->abs->numterms == 1) + value->abs->op = YASM_EXPR_IDENT; + yasm_intnum_destroy(mask); + } + /* Handle trivial (IDENT) cases immediately */ if (value->abs->op == YASM_EXPR_IDENT) { switch (value->abs->terms[0].type) { @@ -511,13 +555,6 @@ yasm_value_finalize_expr(yasm_value *value, yasm_expr *e, return 0; } -int -yasm_value_finalize(yasm_value *value, yasm_bytecode *precbc) -{ - unsigned int valsize = value->size; - return yasm_value_finalize_expr(value, value->abs, precbc, valsize); -} - yasm_intnum * yasm_value_get_intnum(yasm_value *value, yasm_bytecode *bc, int calc_bc_dist) { @@ -592,6 +629,9 @@ yasm_value_output_basic(yasm_value *value, /*@out@*/ unsigned char *buf, int retval = 1; unsigned int valsize = value->size; + if (value->no_warn) + warn = 0; + if (value->abs) { /* Handle floating point expressions */ if (!value->rel && value->abs->op == YASM_EXPR_IDENT @@ -725,5 +765,7 @@ yasm_value_print(const yasm_value *value, FILE *f, int indent_level) fprintf(f, "%*s(Jump target)\n", indent_level, ""); if (value->section_rel) fprintf(f, "%*s(Section-relative)\n", indent_level, ""); + if (value->no_warn) + fprintf(f, "%*s(Overflow warnings disabled)\n", indent_level, ""); } } diff --git a/libyasm/value.h b/libyasm/value.h index cc6d3469..4dc294bc 100644 --- a/libyasm/value.h +++ b/libyasm/value.h @@ -2,10 +2,6 @@ * \file libyasm/value.h * \brief YASM value interface. * - * \rcs - * $Id$ - * \endrcs - * * \license * Copyright (C) 2006-2007 Peter Johnson * @@ -34,6 +30,10 @@ #ifndef YASM_VALUE_H #define YASM_VALUE_H +#ifndef YASM_LIB_DECL +#define YASM_LIB_DECL +#endif + /** Initialize a #yasm_value with just an expression. No processing is * performed, the expression is simply stuck into value.abs and the other * fields are initialized. Use yasm_expr_extract_value() to perform "smart" @@ -45,6 +45,7 @@ * \param e expression (kept) * \param size value size (in bits) */ +YASM_LIB_DECL void yasm_value_initialize(/*@out@*/ yasm_value *value, /*@null@*/ /*@kept@*/ yasm_expr *e, unsigned int size); @@ -56,6 +57,7 @@ void yasm_value_initialize(/*@out@*/ yasm_value *value, * \param sym symrec * \param size value size (in bits) */ +YASM_LIB_DECL void yasm_value_init_sym(/*@out@*/ yasm_value *value, /*@null@*/ yasm_symrec *sym, unsigned int size); @@ -64,11 +66,13 @@ void yasm_value_init_sym(/*@out@*/ yasm_value *value, * \param value value (copy to create) * \param orig original value */ +YASM_LIB_DECL void yasm_value_init_copy(yasm_value *value, const yasm_value *orig); /** Frees any memory inside value; does not free value itself. * \param value value */ +YASM_LIB_DECL void yasm_value_delete(yasm_value *value); /** Set a value to be relative to the current assembly position rather than @@ -80,6 +84,7 @@ void yasm_value_delete(yasm_value *value); * \note If value is just an absolute value, will get an absolute symrec to * reference to (via bc's symbol table). */ +YASM_LIB_DECL void yasm_value_set_curpos_rel(yasm_value *value, yasm_bytecode *bc, unsigned int ip_rel); @@ -89,6 +94,7 @@ void yasm_value_set_curpos_rel(yasm_value *value, yasm_bytecode *bc, * \param precbc previous bytecode to bytecode containing value * \return Nonzero if value could not be split. */ +YASM_LIB_DECL int yasm_value_finalize(yasm_value *value, /*@null@*/ yasm_bytecode *precbc); /** Break a #yasm_expr into a #yasm_value constituent parts. Extracts @@ -110,6 +116,7 @@ int yasm_value_finalize(yasm_value *value, /*@null@*/ yasm_bytecode *precbc); * \note This should only be called after the parse is complete. Calling * before the parse is complete will usually result in an error return. */ +YASM_LIB_DECL int yasm_value_finalize_expr(/*@out@*/ yasm_value *value, /*@null@*/ /*@kept@*/ yasm_expr *e, /*@null@*/ yasm_bytecode *precbc, @@ -126,6 +133,7 @@ int yasm_value_finalize_expr(/*@out@*/ yasm_value *value, * as bc (and there is no WRT or SEG). * \return Intnum if can be resolved to integer value, otherwise NULL. */ +YASM_LIB_DECL /*@null@*/ /*@only@*/ yasm_intnum *yasm_value_get_intnum (yasm_value *value, /*@null@*/ yasm_bytecode *bc, int calc_bc_dist); @@ -148,6 +156,7 @@ int yasm_value_finalize_expr(/*@out@*/ yasm_value *value, * \return 0 if no value output due to value needing relocation; * 1 if value output; -1 if error. */ +YASM_LIB_DECL int yasm_value_output_basic (yasm_value *value, /*@out@*/ unsigned char *buf, size_t destsize, yasm_bytecode *bc, int warn, yasm_arch *arch); @@ -157,6 +166,7 @@ int yasm_value_output_basic * \param indent_level indentation level * \param f file */ +YASM_LIB_DECL void yasm_value_print(const yasm_value *value, FILE *f, int indent_level); #endif diff --git a/libyasm/xmalloc.c b/libyasm/xmalloc.c index 5430ddd5..81b608c0 100644 --- a/libyasm/xmalloc.c +++ b/libyasm/xmalloc.c @@ -24,9 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -RCSID("$Id$"); #include "coretype.h" #include "errwarn.h" @@ -48,11 +46,15 @@ static void def_xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/; /* storage for global function pointers */ +YASM_LIB_DECL /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size) = def_xmalloc; +YASM_LIB_DECL /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize) = def_xcalloc; +YASM_LIB_DECL /*@only@*/ void * (*yasm_xrealloc) (/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size) /*@modifies oldmem@*/ = def_xrealloc; +YASM_LIB_DECL void (*yasm_xfree) (/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/ = def_xfree; diff --git a/libyasm/xstrdup.c b/libyasm/xstrdup.c index 83ac3955..b187704f 100644 --- a/libyasm/xstrdup.c +++ b/libyasm/xstrdup.c @@ -28,9 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#define YASM_LIB_INTERNAL #include "util.h" -RCSID("$Id$"); #include "coretype.h" diff --git a/m4/Makefile.inc b/m4/Makefile.inc index 4dac7a1c..1afffbbf 100644 --- a/m4/Makefile.inc +++ b/m4/Makefile.inc @@ -27,4 +27,4 @@ EXTRA_DIST += m4/progtest.m4 EXTRA_DIST += m4/stdint_h.m4 EXTRA_DIST += m4/uintmax_t.m4 EXTRA_DIST += m4/pythonhead.m4 -EXTRA_DIST += m4/pyrex.m4 +EXTRA_DIST += m4/cython.m4 diff --git a/m4/cython.m4 b/m4/cython.m4 new file mode 100644 index 00000000..a7ed9ee1 --- /dev/null +++ b/m4/cython.m4 @@ -0,0 +1,36 @@ +dnl a macro to check for the installed Cython version +dnl CYTHON_CHECK_VERSION([VERSION [,[ACTION-IF-TRUE [,ACTION-IF-FALSE]]]) +dnl Check if a Cython version is installed +dnl Defines CYTHON_VERSION and CYTHON_FOUND +dnl taken from Enligntenment Foundation Libraries(GPL). +AC_DEFUN([CYTHON_CHECK_VERSION], +[ +AC_REQUIRE([AM_PATH_PYTHON]) +ifelse([$1], [], [_msg=""], [_msg=" >= $1"]) +AC_MSG_CHECKING(for Cython$_msg) +AC_CACHE_VAL(py_cv_cython, [ + +prog="from __future__ import print_function; import Cython.Compiler.Version; print(Cython.Compiler.Version.version)" +CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC` + +py_cv_cython=no +if test "x$CYTHON_VERSION" != "x"; then + py_cv_cython=yes +fi + +if test "x$py_cv_cython" = "xyes"; then + ifelse([$1], [], [:], + [AS_VERSION_COMPARE([$CYTHON_VERSION], [$1], [py_cv_cython=no])]) +fi +]) + +AC_MSG_RESULT([$py_cv_cython]) + +if test "x$py_cv_cython" = "xyes"; then + CYTHON_FOUND=yes + ifelse([$2], [], [:], [$2]) +else + CYTHON_FOUND=no + ifelse([$3], [], [AC_MSG_ERROR([Could not find usable Cython$_msg])], [$3]) +fi +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 91c345e9..8d1f0665 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,5 +1,5 @@ -# gettext.m4 serial 59 (gettext-0.16.1) -dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. +# gettext.m4 serial 66 (gettext-0.18.2) +dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,7 +15,7 @@ dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2006. +dnl Bruno Haible , 2000-2006, 2008-2010. dnl Macro to add for using GNU gettext. @@ -35,7 +35,7 @@ dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. +dnl the value '$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled @@ -60,6 +60,8 @@ AC_DEFUN([AM_GNU_GETTEXT], ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) + ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], + [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) @@ -95,7 +97,7 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) - dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. @@ -123,11 +125,11 @@ AC_DEFUN([AM_GNU_GETTEXT], gt_use_preinstalled_gnugettext=no ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, + AC_ARG_WITH([included-gettext], [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then @@ -155,12 +157,18 @@ changequote([,])dnl fi AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], - [AC_TRY_LINK([#include + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include $gt_revision_test_code extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings;], - [bindtextdomain ("", ""); -return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], +extern int *_nl_domain_bindings; + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings + ]])], [eval "$gt_func_gnugettext_libc=yes"], [eval "$gt_func_gnugettext_libc=no"])]) @@ -181,35 +189,47 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_b gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. - AC_TRY_LINK([#include + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias (const char *);], - [bindtextdomain ("", ""); -return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], +const char *_nl_expand_alias (const char *); + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ]])], [eval "$gt_func_gnugettext_libintl=yes"], [eval "$gt_func_gnugettext_libintl=no"]) dnl Now see whether libintl exists and depends on libiconv. if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias (const char *);], - [bindtextdomain ("", ""); -return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - eval "$gt_func_gnugettext_libintl=yes" - ]) +const char *_nl_expand_alias (const char *); + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ]])], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + ]) fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) @@ -267,7 +287,7 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, + AC_DEFINE([ENABLE_NLS], [1], [Define to 1 if translation of program messages to the user's native language is requested.]) else @@ -301,9 +321,9 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a fi dnl For backward compatibility. Some packages may be using this. - AC_DEFINE(HAVE_GETTEXT, 1, + AC_DEFINE([HAVE_GETTEXT], [1], [Define if the GNU gettext() function is already present or preinstalled.]) - AC_DEFINE(HAVE_DCGETTEXT, 1, + AC_DEFINE([HAVE_DCGETTEXT], [1], [Define if the GNU dcgettext() function is already present or preinstalled.]) fi @@ -319,9 +339,9 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a fi dnl Make all variables we use known to autoconf. - AC_SUBST(BUILD_INCLUDED_LIBINTL) - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATOBJEXT) + AC_SUBST([BUILD_INCLUDED_LIBINTL]) + AC_SUBST([USE_INCLUDED_LIBINTL]) + AC_SUBST([CATOBJEXT]) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= @@ -329,74 +349,36 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share - AC_SUBST(DATADIRNAME) + AC_SUBST([DATADIRNAME]) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo - AC_SUBST(INSTOBJEXT) + AC_SUBST([INSTOBJEXT]) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat - AC_SUBST(GENCAT) + AC_SUBST([GENCAT]) dnl For backward compatibility. Some Makefiles may be using this. INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi - AC_SUBST(INTLOBJS) + AC_SUBST([INTLOBJS]) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" - AC_SUBST(INTLLIBS) + AC_SUBST([INTLLIBS]) dnl Make all documented variables known to autoconf. - AC_SUBST(LIBINTL) - AC_SUBST(LTLIBINTL) - AC_SUBST(POSUB) -]) - - -dnl Checks for special options needed on MacOS X. -dnl Defines INTL_MACOSX_LIBS. -AC_DEFUN([gt_INTL_MACOSX], -[ - dnl Check for API introduced in MacOS X 10.2. - AC_CACHE_CHECK([for CFPreferencesCopyAppValue], - gt_cv_func_CFPreferencesCopyAppValue, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" - AC_TRY_LINK([#include ], - [CFPreferencesCopyAppValue(NULL, NULL)], - [gt_cv_func_CFPreferencesCopyAppValue=yes], - [gt_cv_func_CFPreferencesCopyAppValue=no]) - LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then - AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, - [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) - fi - dnl Check for API introduced in MacOS X 10.3. - AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" - AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], - [gt_cv_func_CFLocaleCopyCurrent=yes], - [gt_cv_func_CFLocaleCopyCurrent=no]) - LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFLocaleCopyCurrent = yes; then - AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, - [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) - fi - INTL_MACOSX_LIBS= - if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then - INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" - fi - AC_SUBST([INTL_MACOSX_LIBS]) + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + AC_SUBST([POSUB]) ]) diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 654c4158..a5036465 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial AM4 (gettext-0.11.3) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +# iconv.m4 serial 18 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -21,6 +21,7 @@ AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. @@ -29,34 +30,170 @@ AC_DEFUN([AM_ICONV_LINK], dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_func_iconv=yes) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, + dnl Solaris 10. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +int main () +{ + int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + const char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; +}]])], + [am_cv_func_iconv_works=yes], + [am_cv_func_iconv_works=no], + [ +changequote(,)dnl + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +changequote([,])dnl + ]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) @@ -68,34 +205,64 @@ AC_DEFUN([AM_ICONV_LINK], LIBICONV= LTLIBICONV= fi - AC_SUBST(LIBICONV) - AC_SUBST(LTLIBICONV) + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) ]) -AC_DEFUN([AM_ICONV], +dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to +dnl avoid warnings like +dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". +dnl This is tricky because of the way 'aclocal' is implemented: +dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. +dnl Otherwise aclocal's initial scan pass would miss the macro definition. +dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. +dnl Otherwise aclocal would emit many "Use of uninitialized value $1" +dnl warnings. +m4_define([gl_iconv_AC_DEFUN], + m4_version_prereq([2.64], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [m4_ifdef([gl_00GNULIB], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [[AC_DEFUN( + [$1], [$2])]])])) +gl_iconv_AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(am_cv_proto_iconv, [ - AC_TRY_COMPILE([ + AC_CACHE_VAL([am_cv_proto_iconv], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ #include #include extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(__cplusplus) +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + ]], + [[]])], + [am_cv_proto_iconv_arg1=""], + [am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([$]{ac_t:- - }[$]am_cv_proto_iconv) - AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + AC_MSG_RESULT([ + $am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) + dnl Also substitute ICONV_CONST in the gnulib generated . + m4_ifdef([gl_ICONV_H_DEFAULTS], + [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + if test -n "$am_cv_proto_iconv_arg1"; then + ICONV_CONST="const" + fi + ]) fi ]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 index 96c4e2c3..c145e478 100644 --- a/m4/lib-ld.m4 +++ b/m4/lib-ld.m4 @@ -1,50 +1,56 @@ -# lib-ld.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +# lib-ld.m4 serial 6 +dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. +dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid +dnl collision with libtool.m4. -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], +[# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } fi + ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) + AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -54,12 +60,12 @@ if test "$GCC" = yes; then esac case $ac_prog in # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` + while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -77,33 +83,36 @@ elif test "$with_gnu_ld" = yes; then else AC_MSG_CHECKING([for non-GNU ld]) fi -AC_CACHE_VAL(acl_cv_path_LD, +AC_CACHE_VAL([acl_cv_path_LD], [if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + case `"$acl_cv_path_LD" -v 2>&1 = 1.10 to complain if config.rpath is missing. @@ -101,7 +130,7 @@ AC_DEFUN([AC_LIB_RPATH], AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh @@ -109,35 +138,66 @@ AC_DEFUN([AC_LIB_RPATH], acl_cv_rpath=done ]) wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, + AC_ARG_ENABLE([rpath], [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl Autoconf >= 2.61 supports dots in --with options. + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], + AC_ARG_WITH(P_A_C_K[-prefix], +[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -150,6 +210,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi fi fi ]) @@ -158,6 +222,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], LIB[]NAME= LTLIB[]NAME= INC[]NAME= + LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= @@ -177,7 +245,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then @@ -197,29 +265,55 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], found_la= found_so= found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi if test $use_additional = yes; then - if test -n "$shlibext" \ - && { test -f "$additional_libdir/lib$name.$shlibext" \ - || { test "$shlibext" = dll \ - && test -f "$additional_libdir/lib$name.dll.a"; }; }; then - found_dir="$additional_libdir" - if test -f "$additional_libdir/lib$name.$shlibext"; then - found_so="$additional_libdir/lib$name.$shlibext" + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" else - found_so="$additional_libdir/lib$name.dll.a" - fi - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done fi fi fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do @@ -227,28 +321,46 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" \ - && { test -f "$dir/lib$name.$shlibext" \ - || { test "$shlibext" = dll \ - && test -f "$dir/lib$name.dll.a"; }; }; then - found_dir="$dir" - if test -f "$dir/lib$name.$shlibext"; then - found_so="$dir/lib$name.$shlibext" - else - found_so="$dir/lib$name.dll.a" - fi - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done fi fi fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi ;; esac if test "X$found_dir" != "X"; then @@ -263,7 +375,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else @@ -282,12 +396,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then + if test "$acl_hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" @@ -318,13 +432,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi - if test "$hardcode_minus_L" != no; then + if test "$acl_hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. @@ -351,6 +465,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi additional_includedir="$basedir/include" ;; esac @@ -411,9 +535,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; @@ -512,18 +638,18 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], done done if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then + if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else @@ -531,7 +657,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done @@ -544,6 +670,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi + popdef([P_A_C_K]) + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, @@ -580,7 +711,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= @@ -589,7 +720,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem"; then + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= @@ -598,7 +730,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem"; then + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= ;; @@ -614,16 +747,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], done else dnl The linker is used for linking directly. - if test -n "$hardcode_libdir_separator"; then + if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir" + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" done acl_save_libdir="$libdir" libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="$flag" else @@ -631,7 +764,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], for dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$dir" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="${$1}${$1:+ }$flag" done diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 index a8684e17..60908e8f 100644 --- a/m4/lib-prefix.m4 +++ b/m4/lib-prefix.m4 @@ -1,5 +1,5 @@ -# lib-prefix.m4 serial 5 (gettext-0.15) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. +# lib-prefix.m4 serial 7 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -153,33 +153,72 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], prefix="$acl_save_prefix" ]) -dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing -dnl the basename of the libdir, either "lib" or "lib64". +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ - dnl There is no formal standard regarding lib and lib64. The current - dnl practice is that on a system supporting 32-bit and 64-bit instruction - dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit - dnl libraries go under $prefix/lib. We determine the compiler's default - dnl mode by looking at the compiler's library search path. If at least - dnl of its elements ends in /lib64 or points to a directory whose absolute - dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the - dnl default, namely "lib". + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) acl_libdirstem=lib - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi - done - IFS="$acl_save_IFS" - fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" ]) diff --git a/m4/nls.m4 b/m4/nls.m4 index 7967cc2f..8f8a147b 100644 --- a/m4/nls.m4 +++ b/m4/nls.m4 @@ -1,5 +1,6 @@ -# nls.m4 serial 3 (gettext-0.15) -dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. +# nls.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,15 +18,15 @@ dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. -AC_PREREQ(2.50) +AC_PREREQ([2.50]) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS - AC_ARG_ENABLE(nls, + AC_ARG_ENABLE([nls], [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) ]) diff --git a/m4/po.m4 b/m4/po.m4 index 00133ef3..1c70b6c1 100644 --- a/m4/po.m4 +++ b/m4/po.m4 @@ -1,5 +1,5 @@ -# po.m4 serial 13 (gettext-0.15) -dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. +# po.m4 serial 21 (gettext-0.18.3) +dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,16 +17,21 @@ dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. -AC_PREREQ(2.50) +AC_PREREQ([2.60]) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AC_PROG_MKDIR_P])dnl + AC_REQUIRE([AC_PROG_SED])dnl AC_REQUIRE([AM_NLS])dnl + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.18]) + dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. @@ -37,7 +42,7 @@ AC_DEFUN([AM_PO_SUBDIRS], [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) dnl Test whether it is GNU msgfmt >= 0.15. changequote(,)dnl @@ -84,6 +89,10 @@ changequote([,])dnl test -n "$localedir" || localedir='${datadir}/locale' AC_SUBST([localedir]) + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + AC_CONFIG_COMMANDS([po-directories], [[ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" @@ -94,7 +103,7 @@ changequote([,])dnl case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. @@ -110,7 +119,8 @@ changequote([,])dnl if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration @@ -121,12 +131,12 @@ changequote([,])dnl test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake < 1.5. + # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. - # Hide the ALL_LINGUAS assigment from automake < 1.5. + # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES @@ -218,7 +228,7 @@ AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. @@ -246,6 +256,7 @@ EOT fi # A sed script that extracts the value of VARIABLE from a Makefile. + tab=`printf '\t'` sed_x_variable=' # Test if the hold space is empty. x @@ -253,9 +264,9 @@ s/P/P/ x ta # Yes it was empty. Look if we have the expected variable definition. -/^[ ]*VARIABLE[ ]*=/{ +/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{ # Seen the first line of the variable definition. - s/^[ ]*VARIABLE[ ]*=// + s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=// ba } bd @@ -307,7 +318,7 @@ changequote([,])dnl sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` fi - # Hide the ALL_LINGUAS assigment from automake < 1.5. + # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) @@ -397,14 +408,15 @@ changequote([,])dnl fi sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" + tab=`printf '\t'` if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. -AC_PREREQ(2.50) +AC_PREREQ([2.50]) # Search path for a program which passes the given test. @@ -27,15 +27,14 @@ AC_DEFUN([AM_PATH_PROG_WITH_TEST], # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } fi # Find out how to test for executable files. Don't use a zero-byte file, @@ -55,7 +54,7 @@ rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL(ac_cv_path_$1, +AC_CACHE_VAL([ac_cv_path_$1], [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. @@ -84,9 +83,9 @@ ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then - AC_MSG_RESULT([$]$1) + AC_MSG_RESULT([$][$1]) else - AC_MSG_RESULT(no) + AC_MSG_RESULT([no]) fi -AC_SUBST($1)dnl +AC_SUBST([$1])dnl ]) diff --git a/m4/pyrex.m4 b/m4/pyrex.m4 deleted file mode 100644 index 379c5e3d..00000000 --- a/m4/pyrex.m4 +++ /dev/null @@ -1,17 +0,0 @@ -dnl a macro to check for the installed Pyrex version; note PYTHON needs to -dnl be set before this function is called. -dnl PYREX_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -AC_DEFUN([PYREX_CHECK_VERSION], - [prog="import sys -from Pyrex.Compiler.Version import version -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -pyrexver = map(int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]] -pyrexverhex = 0 -for i in xrange(0, 4): pyrexverhex = (pyrexverhex << 8) + pyrexver[[i]] -minver = map(int, '$1'.split('.')) + [[0, 0, 0]] -minverhex = 0 -for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]] -sys.exit(pyrexverhex < minverhex)" - AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])]) - diff --git a/m4/pythonhead.m4 b/m4/pythonhead.m4 index 1e0f2b63..15b7a333 100644 --- a/m4/pythonhead.m4 +++ b/m4/pythonhead.m4 @@ -1,16 +1,39 @@ dnl a macro to check for ability to create python extensions dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) dnl function also defines PYTHON_INCLUDES +dnl update taken from dbus-python(GPL). AC_DEFUN([AM_CHECK_PYTHON_HEADERS], [AC_REQUIRE([AM_PATH_PYTHON]) -AC_MSG_CHECKING(for headers required to compile python extensions) -dnl deduce PYTHON_INCLUDES -py_prefix=`$PYTHON -c "import sys; print sys.prefix"` -py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` -PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -if test "$py_prefix" != "$py_exec_prefix"; then - PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" + +AC_PATH_PROGS([PYTHON_CONFIG], [python${PYTHON_VERSION}-config python-config], [no]) +if test "${PYTHON_CONFIG}" = "no"; then + AC_MSG_ERROR([cannot find python${PYTHON_VERSION}-config or python-config in PATH]) fi + +AC_ARG_VAR([PYTHON_INCLUDES], [CPPFLAGS for Python, overriding output of python2.x-config --includes, e.g. "-I/opt/misc/include/python2.7"]) + +if test "${PYTHON_INCLUDES+set}" = set; then + AC_MSG_NOTICE([PYTHON_INCLUDES overridden to: $PYTHON_INCLUDES]) +else + dnl deduce PYTHON_INCLUDES + AC_MSG_CHECKING(for Python headers using $PYTHON_CONFIG --includes) + PYTHON_INCLUDES=`$PYTHON_CONFIG --includes` + if test $? = 0; then + AC_MSG_RESULT($PYTHON_INCLUDES) + else + AC_MSG_RESULT([failed, will try another way]) + py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"` + py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"` + AC_MSG_CHECKING(for Python headers in $py_prefix and $py_exec_prefix) + PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" + if test "$py_prefix" != "$py_exec_prefix"; then + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" + fi + AC_MSG_RESULT($PYTHON_INCLUDES) + fi +fi + +AC_MSG_CHECKING(whether those headers are sufficient) AC_SUBST(PYTHON_INCLUDES) dnl check if the headers exist: save_CPPFLAGS="$CPPFLAGS" diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 00000000..6e59cb52 --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,104 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + +INCLUDE(arch/CMakeLists.txt) +INCLUDE(listfmts/CMakeLists.txt) +INCLUDE(parsers/CMakeLists.txt) +INCLUDE(preprocs/CMakeLists.txt) +INCLUDE(dbgfmts/CMakeLists.txt) +INCLUDE(objfmts/CMakeLists.txt) + +MESSAGE(STATUS "Standard modules: ${YASM_MODULES}") + +# +# Generate init_plugin.c +# This file provides the yasm_init_plugin() function for yasmstd. +# + +SET(INIT_PLUGIN_C ${CMAKE_CURRENT_BINARY_DIR}/init_plugin.c) +SET(INIT_PLUGIN_C_REV 1) + +# Don't regen if no changes; default to regen +SET(regen_init_plugin_c TRUE) +IF(EXISTS ${INIT_PLUGIN_C}) + FILE(READ ${INIT_PLUGIN_C} _old_init_plugin_c) + STRING(REGEX MATCHALL "[^\n]*\n" _lines "${_old_init_plugin_c}") + #MESSAGE(STATUS "Lines: ${_lines}") + + LIST(GET _lines 0 _line0) + STRING(REGEX MATCH "([A-Za-z][A-Za-z0-9_]+[ ]?)+" _old_modules "${_line0}") + #MESSAGE(STATUS "Old modules: ${_old_modules}") + STRING(REPLACE ";" " " _modules_str "${YASM_MODULES}") + STRING(COMPARE EQUAL "${_old_modules}" "${_modules_str} " _modules_match) + + LIST(GET _lines 1 _line1) + STRING(REGEX MATCH "rev [0-9]+" _old_modules_rev "${_line1}") + #MESSAGE(STATUS "Old modules rev: ${_old_modules_rev}") + STRING(COMPARE EQUAL "${_old_modules_rev}" "rev ${INIT_PLUGIN_C_REV}" + _modules_rev_match) + + IF(_modules_match AND _modules_rev_match) + SET(regen_init_plugin_c FALSE) + ENDIF(_modules_match AND _modules_rev_match) +ENDIF(EXISTS ${INIT_PLUGIN_C}) + +IF(regen_init_plugin_c) + MESSAGE(STATUS "Generating standard plugin initialization file") + STRING(REPLACE ";" " " _modules_str "${YASM_MODULES}") + FILE(WRITE ${INIT_PLUGIN_C} "/* ${_modules_str} \n") + FILE(APPEND ${INIT_PLUGIN_C} " rev ${INIT_PLUGIN_C_REV}\n") + FILE(APPEND ${INIT_PLUGIN_C} " */\n\n") + FILE(APPEND ${INIT_PLUGIN_C} "#include \n") + FILE(APPEND ${INIT_PLUGIN_C} "#include \n\n") + FOREACH(module ${YASM_MODULES}) + STRING(REGEX MATCHALL "[a-zA-Z][a-zA-Z0-9]+" _modulepath ${module}) + LIST(GET _modulepath 0 _type) + LIST(GET _modulepath 1 _keyword) + FILE(APPEND ${INIT_PLUGIN_C} + "extern yasm_${_type}_module yasm_${_keyword}_LTX_${_type};\n") + ENDFOREACH(module) + IF(BUILD_SHARED_LIBS) + FILE(APPEND ${INIT_PLUGIN_C} "\n#ifdef _WIN32\n") + FILE(APPEND ${INIT_PLUGIN_C} "__declspec(dllexport)\n") + FILE(APPEND ${INIT_PLUGIN_C} "#endif\n") + ENDIF(BUILD_SHARED_LIBS) + FILE(APPEND ${INIT_PLUGIN_C} "void\n") + FILE(APPEND ${INIT_PLUGIN_C} "yasm_init_plugin(void)\n") + FILE(APPEND ${INIT_PLUGIN_C} "{\n") + FOREACH(module ${YASM_MODULES}) + STRING(REGEX MATCHALL "[a-zA-Z][a-zA-Z0-9]+" _modulepath ${module}) + LIST(GET _modulepath 0 _type) + LIST(GET _modulepath 1 _keyword) + SET(_data "yasm_${_keyword}_LTX_${_type}") + STRING(TOUPPER "${_type}" _type) + FILE(APPEND ${INIT_PLUGIN_C} + " yasm_register_module(YASM_MODULE_${_type}, \"${_keyword}\", &${_data});\n") + ENDFOREACH(module) + FILE(APPEND ${INIT_PLUGIN_C} "}\n") +ELSE(regen_init_plugin_c) + MESSAGE(STATUS "Not regenerating static modules file (unchanged)") +ENDIF(regen_init_plugin_c) + +SET_SOURCE_FILES_PROPERTIES(init_plugin.c GENERATED) + +SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + +IF(BUILD_SHARED_LIBS) + ADD_LIBRARY(yasmstd MODULE + init_plugin.c + ${YASM_MODULES_SRC} + ) + TARGET_LINK_LIBRARIES(yasmstd libyasm) + + IF(WIN32) + SET_PROPERTY(TARGET yasmstd PROPERTY PREFIX "") + INSTALL(TARGETS yasmstd LIBRARY DESTINATION bin) + ELSE(WIN32) + INSTALL(TARGETS yasmstd LIBRARY DESTINATION lib) + ENDIF(WIN32) +ELSE(BUILD_SHARED_LIBS) + ADD_LIBRARY(yasmstd + init_plugin.c + ${YASM_MODULES_SRC} + ) + TARGET_LINK_LIBRARIES(yasmstd libyasm) +ENDIF(BUILD_SHARED_LIBS) diff --git a/modules/Makefile.inc b/modules/Makefile.inc index 3ff8fd31..c220a84c 100644 --- a/modules/Makefile.inc +++ b/modules/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += modules/arch/Makefile.inc EXTRA_DIST += modules/listfmts/Makefile.inc EXTRA_DIST += modules/parsers/Makefile.inc diff --git a/modules/arch/CMakeLists.txt b/modules/arch/CMakeLists.txt new file mode 100644 index 00000000..ea65fbd0 --- /dev/null +++ b/modules/arch/CMakeLists.txt @@ -0,0 +1,2 @@ +INCLUDE(arch/lc3b/CMakeLists.txt) +INCLUDE(arch/x86/CMakeLists.txt) diff --git a/modules/arch/Makefile.inc b/modules/arch/Makefile.inc index 7dc98dfc..5c5d9d15 100644 --- a/modules/arch/Makefile.inc +++ b/modules/arch/Makefile.inc @@ -1,12 +1,10 @@ -# $Id$ - EXTRA_DIST += modules/arch/x86/Makefile.inc EXTRA_DIST += modules/arch/lc3b/Makefile.inc include modules/arch/x86/Makefile.inc -#include modules/arch/lc3b/Makefile.inc +include modules/arch/lc3b/Makefile.inc -dist_man_MANS += yasm_arch.7 +notrans_dist_man_MANS += yasm_arch.7 if BUILD_MAN yasm_arch.7: modules/arch/yasm_arch.xml diff --git a/modules/arch/lc3b/CMakeLists.txt b/modules/arch/lc3b/CMakeLists.txt new file mode 100644 index 00000000..0d5df705 --- /dev/null +++ b/modules/arch/lc3b/CMakeLists.txt @@ -0,0 +1,11 @@ +YASM_RE2C( + ${CMAKE_CURRENT_SOURCE_DIR}/arch/lc3b/lc3bid.re + ${CMAKE_CURRENT_BINARY_DIR}/lc3bid.c + -s + ) + +YASM_ADD_MODULE(arch_lc3b + arch/lc3b/lc3barch.c + arch/lc3b/lc3bbc.c + lc3bid.c + ) diff --git a/modules/arch/lc3b/Makefile.inc b/modules/arch/lc3b/Makefile.inc index 6fbc60ce..fc30583d 100644 --- a/modules/arch/lc3b/Makefile.inc +++ b/modules/arch/lc3b/Makefile.inc @@ -1,17 +1,13 @@ -# $Id$ - libyasm_a_SOURCES += modules/arch/lc3b/lc3barch.c libyasm_a_SOURCES += modules/arch/lc3b/lc3barch.h libyasm_a_SOURCES += modules/arch/lc3b/lc3bbc.c -libyasm_a_SOURCES += lc3bid.c +nodist_libyasm_a_SOURCES += lc3bid.c YASM_MODULES += arch_lc3b lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT) $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re -BUILT_SOURCES += lc3bid.c - CLEANFILES += lc3bid.c EXTRA_DIST += modules/arch/lc3b/tests/Makefile.inc diff --git a/modules/arch/lc3b/lc3barch.c b/modules/arch/lc3b/lc3barch.c index aad37108..05145286 100644 --- a/modules/arch/lc3b/lc3barch.c +++ b/modules/arch/lc3b/lc3barch.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "lc3barch.h" @@ -83,18 +81,6 @@ lc3b_set_var(yasm_arch *arch, const char *var, unsigned long val) return 1; } -static int -lc3b_parse_directive(/*@unused@*/ yasm_arch *arch, - /*@unused@*/ const char *name, - /*@unused@*/ /*@null@*/ yasm_valparamhead *valparams, - /*@unused@*/ /*@null@*/ - yasm_valparamhead *objext_valparams, - /*@unused@*/ yasm_object *object, - /*@unused@*/ unsigned long line) -{ - return 1; -} - static const unsigned char ** lc3b_get_fill(const yasm_arch *arch) { @@ -132,21 +118,21 @@ lc3b_get_fill(const yasm_arch *arch) } static unsigned int -lc3b_get_reg_size(/*@unused@*/ yasm_arch *arch, /*@unused@*/ unsigned long reg) +lc3b_get_reg_size(/*@unused@*/ yasm_arch *arch, /*@unused@*/ uintptr_t reg) { return 16; } -static unsigned long +static uintptr_t lc3b_reggroup_get_reg(/*@unused@*/ yasm_arch *arch, - /*@unused@*/ unsigned long reggroup, + /*@unused@*/ uintptr_t reggroup, /*@unused@*/ unsigned long regindex) { return 0; } static void -lc3b_reg_print(/*@unused@*/ yasm_arch *arch, unsigned long reg, FILE *f) +lc3b_reg_print(/*@unused@*/ yasm_arch *arch, uintptr_t reg, FILE *f) { fprintf(f, "r%u", (unsigned int)(reg&7)); } @@ -164,8 +150,30 @@ lc3b_floatnum_tobytes(yasm_arch *arch, const yasm_floatnum *flt, static yasm_effaddr * lc3b_ea_create_expr(yasm_arch *arch, yasm_expr *e) { - yasm_expr_destroy(e); - return NULL; + yasm_effaddr *ea = yasm_xmalloc(sizeof(yasm_effaddr)); + yasm_value_initialize(&ea->disp, e, 0); + ea->need_nonzero_len = 0; + ea->need_disp = 1; + ea->nosplit = 0; + ea->strong = 0; + ea->segreg = 0; + ea->pc_rel = 0; + ea->not_pc_rel = 0; + return ea; +} + +void +yasm_lc3b__ea_destroy(/*@only@*/ yasm_effaddr *ea) +{ + yasm_value_delete(&ea->disp); + yasm_xfree(ea); +} + +static void +lc3b_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level) +{ + fprintf(f, "%*sDisp:\n", indent_level, ""); + yasm_value_print(&ea->disp, f, indent_level+1); } /* Define lc3b machines -- see arch.h for details */ @@ -178,17 +186,15 @@ static yasm_arch_machine lc3b_machines[] = { yasm_arch_module yasm_lc3b_LTX_arch = { "LC-3b", "lc3b", + NULL, lc3b_create, lc3b_destroy, lc3b_get_machine, lc3b_get_address_size, lc3b_set_var, - yasm_lc3b__parse_cpu, yasm_lc3b__parse_check_insnprefix, yasm_lc3b__parse_check_regtmod, - lc3b_parse_directive, lc3b_get_fill, - yasm_lc3b__finalize_insn, lc3b_floatnum_tobytes, yasm_lc3b__intnum_tobytes, lc3b_get_reg_size, @@ -196,9 +202,11 @@ yasm_arch_module yasm_lc3b_LTX_arch = { lc3b_reg_print, NULL, /*yasm_lc3b__segreg_print*/ lc3b_ea_create_expr, + yasm_lc3b__ea_destroy, + lc3b_ea_print, + yasm_lc3b__create_empty_insn, lc3b_machines, "lc3b", 16, - 512, 2 }; diff --git a/modules/arch/lc3b/lc3barch.h b/modules/arch/lc3b/lc3barch.h index ff7d97e4..9ded8cbe 100644 --- a/modules/arch/lc3b/lc3barch.h +++ b/modules/arch/lc3b/lc3barch.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * LC-3b Architecture header file * * Copyright (C) 2003-2007 Peter Johnson @@ -45,29 +45,26 @@ typedef struct lc3b_insn { yasm_value imm; /* immediate or relative value */ lc3b_imm_type imm_type; /* size of the immediate */ - /* PC origin if needed */ - /*@null@*/ /*@dependent@*/ yasm_bytecode *origin_prevbc; - unsigned int opcode; /* opcode */ } lc3b_insn; void yasm_lc3b__bc_transform_insn(yasm_bytecode *bc, lc3b_insn *insn); -void yasm_lc3b__parse_cpu(yasm_arch *arch, const char *cpuid, size_t cpuid_len); - yasm_arch_insnprefix yasm_lc3b__parse_check_insnprefix - (yasm_arch *arch, unsigned long data[4], const char *id, size_t id_len); + (yasm_arch *arch, const char *id, size_t id_len, unsigned long line, + /*@out@*/ /*@only@*/ yasm_bytecode **bc, /*@out@*/ uintptr_t *prefix); yasm_arch_regtmod yasm_lc3b__parse_check_regtmod - (yasm_arch *arch, unsigned long *data, const char *id, size_t id_len); - -void yasm_lc3b__finalize_insn - (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, - const unsigned long data[4], int num_operands, - /*@null@*/ yasm_insn_operands *operands, int num_prefixes, - unsigned long **prefixes, int num_segregs, const unsigned long *segregs); + (yasm_arch *arch, const char *id, size_t id_len, + /*@out@*/ uintptr_t *data); int yasm_lc3b__intnum_tobytes (yasm_arch *arch, const yasm_intnum *intn, unsigned char *buf, size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc, int warn); + +/*@only@*/ yasm_bytecode *yasm_lc3b__create_empty_insn(yasm_arch *arch, + unsigned long line); + +void yasm_lc3b__ea_destroy(/*@only@*/ yasm_effaddr *ea); + #endif diff --git a/modules/arch/lc3b/lc3bbc.c b/modules/arch/lc3b/lc3bbc.c index 95478897..d077c7c5 100644 --- a/modules/arch/lc3b/lc3bbc.c +++ b/modules/arch/lc3b/lc3bbc.c @@ -25,10 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "lc3barch.h" @@ -39,9 +36,14 @@ static void lc3b_bc_insn_destroy(void *contents); static void lc3b_bc_insn_print(const void *contents, FILE *f, int indent_level); -static yasm_bc_resolve_flags lc3b_bc_insn_resolve - (yasm_bytecode *bc, int save, yasm_calc_bc_dist_func calc_bc_dist); +static int lc3b_bc_insn_calc_len(yasm_bytecode *bc, + yasm_bc_add_span_func add_span, + void *add_span_data); +static int lc3b_bc_insn_expand(yasm_bytecode *bc, int span, long old_val, + long new_val, /*@out@*/ long *neg_thres, + /*@out@*/ long *pos_thres); static int lc3b_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -51,7 +53,9 @@ static const yasm_bytecode_callback lc3b_bc_callback_insn = { lc3b_bc_insn_destroy, lc3b_bc_insn_print, yasm_bc_finalize_common, - lc3b_bc_insn_resolve, + NULL, + lc3b_bc_insn_calc_len, + lc3b_bc_insn_expand, lc3b_bc_insn_tobytes, 0 }; @@ -125,65 +129,50 @@ lc3b_bc_insn_print(const void *contents, FILE *f, int indent_level) (unsigned int)insn->opcode); } -static yasm_bc_resolve_flags -lc3b_bc_insn_resolve(yasm_bytecode *bc, int save, - yasm_calc_bc_dist_func calc_bc_dist) +static int +lc3b_bc_insn_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, + void *add_span_data) { lc3b_insn *insn = (lc3b_insn *)bc->contents; yasm_bytecode *target_prevbc; - /*@only@*/ yasm_intnum *num; - long rel; /* Fixed size instruction length */ - bc->len = 2; + bc->len += 2; - /* Only need to worry about out-of-range to PC-relative, and only if we're - * saving. - */ - if (insn->imm_type != LC3B_IMM_9_PC || !save) - return YASM_BC_RESOLVE_MIN_LEN; + /* Only need to worry about out-of-range to PC-relative */ + if (insn->imm_type != LC3B_IMM_9_PC) + return 0; - if (!insn->imm.rel) - num = yasm_intnum_create_uint(0); - else if (!yasm_symrec_get_label(insn->imm.rel, &target_prevbc) - || target_prevbc->section != insn->origin_prevbc->section - || !(num = calc_bc_dist(insn->origin_prevbc, target_prevbc))) { + if (insn->imm.rel + && (!yasm_symrec_get_label(insn->imm.rel, &target_prevbc) + || target_prevbc->section != bc->section)) { /* External or out of segment, so we can't check distance. */ - return YASM_BC_RESOLVE_MIN_LEN; + return 0; } - if (insn->imm.abs) { - /*@only@*/ yasm_expr *temp = yasm_expr_copy(insn->imm.abs); - /*@dependent@*/ /*@null@*/ yasm_intnum *num2; - num2 = yasm_expr_get_intnum(&temp, calc_bc_dist); - if (!num2) { - yasm_error_set(YASM_ERROR_TOO_COMPLEX, - N_("jump target too complex")); - yasm_expr_destroy(temp); - return YASM_BC_RESOLVE_ERROR | YASM_BC_RESOLVE_UNKNOWN_LEN; - } - yasm_intnum_calc(num, YASM_EXPR_ADD, num2); - yasm_expr_destroy(temp); - } - - rel = yasm_intnum_get_int(num); - yasm_intnum_destroy(num); - rel -= 2; /* 9-bit signed, word-multiple displacement */ - if (rel < -512 || rel > 511) { - yasm_error_set(YASM_ERROR_OVERFLOW, N_("target out of range")); - return YASM_BC_RESOLVE_ERROR | YASM_BC_RESOLVE_UNKNOWN_LEN; - } - return YASM_BC_RESOLVE_MIN_LEN; + add_span(add_span_data, bc, 1, &insn->imm, -512+(long)bc->len, + 511+(long)bc->len); + return 0; } static int -lc3b_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +lc3b_bc_insn_expand(yasm_bytecode *bc, int span, long old_val, long new_val, + /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres) +{ + yasm_error_set(YASM_ERROR_VALUE, N_("jump target out of range")); + return -1; +} + +static int +lc3b_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { lc3b_insn *insn = (lc3b_insn *)bc->contents; /*@only@*/ yasm_intnum *delta; + unsigned long buf_off = (unsigned long)(*bufp - bufstart); /* Output opcode */ YASM_SAVE_16_L(*bufp, insn->opcode); @@ -194,27 +183,29 @@ lc3b_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, break; case LC3B_IMM_4: insn->imm.size = 4; - if (output_value(&insn->imm, *bufp, 2, 0, bc, 1, d)) + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; case LC3B_IMM_5: insn->imm.size = 5; - if (output_value(&insn->imm, *bufp, 2, 0, bc, -1, d)) + insn->imm.sign = 1; + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; case LC3B_IMM_6_WORD: insn->imm.size = 6; - if (output_value(&insn->imm, *bufp, 2, 0, bc, 1, d)) + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; case LC3B_IMM_6_BYTE: insn->imm.size = 6; - if (output_value(&insn->imm, *bufp, 2, 0, bc, -1, d)) + insn->imm.sign = 1; + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; case LC3B_IMM_8: insn->imm.size = 8; - if (output_value(&insn->imm, *bufp, 2, 0, bc, 1, d)) + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; case LC3B_IMM_9_PC: @@ -230,12 +221,13 @@ lc3b_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_expr_int(delta), bc->line); insn->imm.size = 9; - if (output_value(&insn->imm, *bufp, 2, 0, bc, -1, d)) + insn->imm.sign = 1; + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; case LC3B_IMM_9: insn->imm.size = 9; - if (output_value(&insn->imm, *bufp, 2, 0, bc, 1, d)) + if (output_value(&insn->imm, *bufp, 2, buf_off, bc, 1, d)) return 1; break; default: diff --git a/modules/arch/lc3b/lc3bid.re b/modules/arch/lc3b/lc3bid.re index dcd6599d..cd8f1303 100644 --- a/modules/arch/lc3b/lc3bid.re +++ b/modules/arch/lc3b/lc3bid.re @@ -25,11 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include #include "modules/arch/lc3b/lc3barch.h" @@ -110,22 +106,42 @@ typedef struct lc3b_insn_info { unsigned int operands[3]; } lc3b_insn_info; -/* Define lexer arch-specific data with 0-3 modifiers. */ -#define DEF_INSN_DATA(group, mod) do { \ - data[0] = (unsigned long)group##_insn; \ - data[1] = ((mod)<<8) | \ - ((unsigned char)(sizeof(group##_insn)/sizeof(lc3b_insn_info))); \ - } while (0) +typedef struct lc3b_id_insn { + yasm_insn insn; /* base structure */ -#define RET_INSN(group, mod) do { \ - DEF_INSN_DATA(group, mod); \ - return YASM_ARCH_INSN; \ - } while (0) + /* instruction parse group - NULL if empty instruction (just prefixes) */ + /*@null@*/ const lc3b_insn_info *group; + + /* Modifier data */ + unsigned long mod_data; + + /* Number of elements in the instruction parse group */ + unsigned int num_info:8; +} lc3b_id_insn; + +static void lc3b_id_insn_destroy(void *contents); +static void lc3b_id_insn_print(const void *contents, FILE *f, int indent_level); +static void lc3b_id_insn_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); + +static const yasm_bytecode_callback lc3b_id_insn_callback = { + lc3b_id_insn_destroy, + lc3b_id_insn_print, + lc3b_id_insn_finalize, + NULL, + yasm_bc_calc_len_common, + yasm_bc_expand_common, + yasm_bc_tobytes_common, + YASM_BC_SPECIAL_INSN +}; /* * Instruction groupings */ +static const lc3b_insn_info empty_insn[] = { + { 0, 0, 0, {0, 0, 0} } +}; + static const lc3b_insn_info addand_insn[] = { { MOD_OpHAdd, 0x1000, 3, {OPT_Reg|OPA_DR, OPT_Reg|OPA_SR, OPT_Reg|OPA_Imm|OPI_5} }, @@ -172,22 +188,20 @@ static const lc3b_insn_info trap_insn[] = { { 0, 0xF000, 1, {OPT_Imm|OPA_Imm|OPI_8, 0, 0} } }; -void -yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, - yasm_bytecode *prev_bc, const unsigned long data[4], - int num_operands, - /*@null@*/ yasm_insn_operands *operands, - int num_prefixes, unsigned long **prefixes, - int num_segregs, const unsigned long *segregs) +static void +lc3b_id_insn_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc) { + lc3b_id_insn *id_insn = (lc3b_id_insn *)bc->contents; lc3b_insn *insn; - int num_info = (int)(data[1]&0xFF); - lc3b_insn_info *info = (lc3b_insn_info *)data[0]; - unsigned long mod_data = data[1] >> 8; + int num_info = id_insn->num_info; + const lc3b_insn_info *info = id_insn->group; + unsigned long mod_data = id_insn->mod_data; int found = 0; yasm_insn_operand *op; int i; + yasm_insn_finalize(&id_insn->insn); + /* Just do a simple linear search through the info array for a match. * First match wins. */ @@ -195,17 +209,18 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, int mismatch = 0; /* Match # of operands */ - if (num_operands != info->num_operands) + if (id_insn->insn.num_operands != info->num_operands) continue; - if (!operands) { + if (id_insn->insn.num_operands == 0) { found = 1; /* no operands -> must have a match here. */ break; } /* Match each operand type and size */ - for(i = 0, op = yasm_ops_first(operands); op && inum_operands && - !mismatch; op = yasm_operand_next(op), i++) { + for(i = 0, op = yasm_insn_ops_first(&id_insn->insn); + op && inum_operands && !mismatch; + op = yasm_insn_op_next(op), i++) { /* Check operand type */ switch ((int)(info->operands[i] & OPT_MASK)) { case OPT_Imm: @@ -241,7 +256,6 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, insn = yasm_xmalloc(sizeof(lc3b_insn)); yasm_value_initialize(&insn->imm, NULL, 0); insn->imm_type = LC3B_IMM_NONE; - insn->origin_prevbc = NULL; insn->opcode = info->opcode; /* Apply modifiers */ @@ -255,9 +269,9 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, } /* Go through operands and assign */ - if (operands) { - for(i = 0, op = yasm_ops_first(operands); op && inum_operands; - op = yasm_operand_next(op), i++) { + if (id_insn->insn.num_operands > 0) { + for(i = 0, op = yasm_insn_ops_first(&id_insn->insn); + op && inum_operands; op = yasm_insn_op_next(op), i++) { switch ((int)(info->operands[i] & OPA_MASK)) { case OPA_None: @@ -288,7 +302,8 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, yasm_expr_int(yasm_intnum_create_uint(1)), op->data.val->line); if (yasm_value_finalize_expr(&insn->imm, - op->data.val, 0)) + op->data.val, + prev_bc, 0)) yasm_error_set(YASM_ERROR_TOO_COMPLEX, N_("immediate expression too complex")); break; @@ -296,7 +311,7 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, if (yasm_value_finalize_expr(&insn->imm, yasm_expr_create_ident(yasm_expr_int( yasm_intnum_create_uint(op->data.reg & 0x7)), - bc->line), 0)) + bc->line), prev_bc, 0)) yasm_internal_error(N_("reg expr too complex?")); break; default: @@ -306,10 +321,12 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, default: yasm_internal_error(N_("unknown operand action")); } + + /* Clear so it doesn't get destroyed */ + op->type = YASM_INSN__OPERAND_REG; } if (insn->imm_type == LC3B_IMM_9_PC) { - insn->origin_prevbc = prev_bc; if (insn->imm.seg_of || insn->imm.rshift > 1 || insn->imm.curpos_rel) yasm_error_set(YASM_ERROR_VALUE, N_("invalid jump target")); @@ -324,20 +341,16 @@ yasm_lc3b__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, #define YYCTYPE unsigned char #define YYCURSOR id -#define YYLIMIT id +#define YYLIMIT id_end #define YYMARKER marker #define YYFILL(n) (void)(n) -void -yasm_lc3b__parse_cpu(yasm_arch *arch, const char *cpuid, size_t cpuid_len) -{ -} - yasm_arch_regtmod -yasm_lc3b__parse_check_regtmod(yasm_arch *arch, unsigned long *data, - const char *oid, size_t id_len) +yasm_lc3b__parse_check_regtmod(yasm_arch *arch, const char *oid, size_t id_len, + uintptr_t *data) { const YYCTYPE *id = (const YYCTYPE *)oid; + const YYCTYPE *const id_end = (const YYCTYPE *)(oid + id_len); /*const char *marker;*/ /*!re2c /* integer registers */ @@ -356,11 +369,29 @@ yasm_lc3b__parse_check_regtmod(yasm_arch *arch, unsigned long *data, */ } +#define RET_INSN(g, m) \ + do { \ + group = g##_insn; \ + mod = m; \ + nelems = NELEMS(g##_insn); \ + goto done; \ + } while(0) + yasm_arch_insnprefix -yasm_lc3b__parse_check_insnprefix(yasm_arch *arch, unsigned long data[4], - const char *oid, size_t id_len) +yasm_lc3b__parse_check_insnprefix(yasm_arch *arch, const char *oid, + size_t id_len, unsigned long line, + yasm_bytecode **bc, uintptr_t *prefix) { const YYCTYPE *id = (const YYCTYPE *)oid; + const YYCTYPE *const id_end = (const YYCTYPE *)(oid + id_len); + const lc3b_insn_info *group = empty_insn; + unsigned long mod = 0; + unsigned int nelems = NELEMS(empty_insn); + lc3b_id_insn *id_insn; + + *bc = (yasm_bytecode *)NULL; + *prefix = 0; + /*const char *marker;*/ /*!re2c /* instructions */ @@ -410,4 +441,42 @@ yasm_lc3b__parse_check_insnprefix(yasm_arch *arch, unsigned long data[4], return YASM_ARCH_NOTINSNPREFIX; } */ + +done: + id_insn = yasm_xmalloc(sizeof(lc3b_id_insn)); + yasm_insn_initialize(&id_insn->insn); + id_insn->group = group; + id_insn->mod_data = mod; + id_insn->num_info = nelems; + *bc = yasm_bc_create_common(&lc3b_id_insn_callback, id_insn, line); + return YASM_ARCH_INSN; +} + +static void +lc3b_id_insn_destroy(void *contents) +{ + lc3b_id_insn *id_insn = (lc3b_id_insn *)contents; + yasm_insn_delete(&id_insn->insn, yasm_lc3b__ea_destroy); + yasm_xfree(contents); +} + +static void +lc3b_id_insn_print(const void *contents, FILE *f, int indent_level) +{ + const lc3b_id_insn *id_insn = (const lc3b_id_insn *)contents; + yasm_insn_print(&id_insn->insn, f, indent_level); + /*TODO*/ +} + +/*@only@*/ yasm_bytecode * +yasm_lc3b__create_empty_insn(yasm_arch *arch, unsigned long line) +{ + lc3b_id_insn *id_insn = yasm_xmalloc(sizeof(lc3b_id_insn)); + + yasm_insn_initialize(&id_insn->insn); + id_insn->group = empty_insn; + id_insn->mod_data = 0; + id_insn->num_info = NELEMS(empty_insn); + + return yasm_bc_create_common(&lc3b_id_insn_callback, id_insn, line); } diff --git a/modules/arch/lc3b/tests/Makefile.inc b/modules/arch/lc3b/tests/Makefile.inc index 43ffb70b..1ca39a3d 100644 --- a/modules/arch/lc3b/tests/Makefile.inc +++ b/modules/arch/lc3b/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/arch/lc3b/tests/lc3b_test.sh EXTRA_DIST += modules/arch/lc3b/tests/lc3b_test.sh @@ -7,10 +5,8 @@ EXTRA_DIST += modules/arch/lc3b/tests/lc3b-basic.asm EXTRA_DIST += modules/arch/lc3b/tests/lc3b-basic.errwarn EXTRA_DIST += modules/arch/lc3b/tests/lc3b-basic.hex EXTRA_DIST += modules/arch/lc3b/tests/lc3b-br.asm -EXTRA_DIST += modules/arch/lc3b/tests/lc3b-br.errwarn EXTRA_DIST += modules/arch/lc3b/tests/lc3b-br.hex EXTRA_DIST += modules/arch/lc3b/tests/lc3b-ea-err.asm EXTRA_DIST += modules/arch/lc3b/tests/lc3b-ea-err.errwarn EXTRA_DIST += modules/arch/lc3b/tests/lc3b-mp22NC.asm -EXTRA_DIST += modules/arch/lc3b/tests/lc3b-mp22NC.errwarn EXTRA_DIST += modules/arch/lc3b/tests/lc3b-mp22NC.hex diff --git a/modules/arch/lc3b/tests/lc3b-ea-err.errwarn b/modules/arch/lc3b/tests/lc3b-ea-err.errwarn index afc28697..e49df726 100644 --- a/modules/arch/lc3b/tests/lc3b-ea-err.errwarn +++ b/modules/arch/lc3b/tests/lc3b-ea-err.errwarn @@ -1 +1 @@ --:1: invalid combination of opcode and operands +-:1: error: invalid combination of opcode and operands diff --git a/modules/arch/lc3b/tests/lc3b_test.sh b/modules/arch/lc3b/tests/lc3b_test.sh index 30ca95df..5c115817 100755 --- a/modules/arch/lc3b/tests/lc3b_test.sh +++ b/modules/arch/lc3b/tests/lc3b_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh lc3b_test modules/arch/lc3b/tests "lc3b arch" "-a lc3b -f bin" "" exit $? diff --git a/modules/arch/x86/CMakeLists.txt b/modules/arch/x86/CMakeLists.txt new file mode 100644 index 00000000..d15c9948 --- /dev/null +++ b/modules/arch/x86/CMakeLists.txt @@ -0,0 +1,50 @@ +ADD_CUSTOM_COMMAND( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/gen_x86_insn.py + ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/gen_x86_insn.py + ) + +YASM_GENPERF( + ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/x86cpu.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86cpu.c + ) + +YASM_GENPERF( + ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/x86regtmod.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86regtmod.c + ) + +YASM_GENPERF( + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c + ) + +YASM_GENPERF( + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c + ) + +YASM_ADD_MODULE(arch_x86 + arch/x86/x86arch.c + arch/x86/x86bc.c + arch/x86/x86expr.c + arch/x86/x86id.c + x86cpu.c + x86regtmod.c + ) + +SET(insn_DEPS + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c + ) + +SET_SOURCE_FILES_PROPERTIES(arch/x86/x86id.c PROPERTIES + OBJECT_DEPENDS "${insn_DEPS}" + ) diff --git a/modules/arch/x86/Makefile.inc b/modules/arch/x86/Makefile.inc index 24e90fa7..e7b162e3 100644 --- a/modules/arch/x86/Makefile.inc +++ b/modules/arch/x86/Makefile.inc @@ -1,22 +1,56 @@ -# $Id$ - libyasm_a_SOURCES += modules/arch/x86/x86arch.c libyasm_a_SOURCES += modules/arch/x86/x86arch.h libyasm_a_SOURCES += modules/arch/x86/x86bc.c libyasm_a_SOURCES += modules/arch/x86/x86expr.c libyasm_a_SOURCES += modules/arch/x86/x86id.c +nodist_libyasm_a_SOURCES += x86cpu.c +nodist_libyasm_a_SOURCES += x86regtmod.c YASM_MODULES += arch_x86 -modules/arch/x86/x86id.c: x86parse.c +modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c -EXTRA_DIST += modules/arch/x86/x86parse.gap +EXTRA_DIST += modules/arch/x86/gen_x86_insn.py -x86parse.c: $(srcdir)/modules/arch/x86/x86parse.gap gap$(EXEEXT) - $(top_builddir)/gap$(EXEEXT) $(srcdir)/modules/arch/x86/x86parse.gap $@ +if HAVE_PYTHON +x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py + $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py +else +x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf + @echo Python must be installed to regenerate x86 instructions files + cp $(srcdir)/x86insn_nasm.gperf $@ +x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf + @echo Python must be installed to regenerate x86 instructions files + cp $(srcdir)/x86insn_gas.gperf $@ +endif -BUILT_SOURCES += x86parse.c -CLEANFILES += x86parse.c +BUILT_SOURCES += x86insns.c +BUILT_SOURCES += x86insn_nasm.gperf +BUILT_SOURCES += x86insn_gas.gperf +EXTRA_DIST += x86insns.c +EXTRA_DIST += x86insn_nasm.gperf +EXTRA_DIST += x86insn_gas.gperf +MAINTAINERCLEANFILES += x86insns.c +MAINTAINERCLEANFILES += x86insn_nasm.gperf +MAINTAINERCLEANFILES += x86insn_gas.gperf + +EXTRA_DIST += modules/arch/x86/x86cpu.gperf +EXTRA_DIST += modules/arch/x86/x86regtmod.gperf + +# Use suffix rules for gperf files +x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT) +x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT) +x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT) + $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@ +x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT) + $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@ + +BUILT_SOURCES += x86insn_nasm.c +BUILT_SOURCES += x86insn_gas.c +CLEANFILES += x86insn_nasm.c +CLEANFILES += x86insn_gas.c +CLEANFILES += x86cpu.c +CLEANFILES += x86regtmod.c EXTRA_DIST += modules/arch/x86/tests/Makefile.inc diff --git a/modules/arch/x86/gen_x86_insn.py b/modules/arch/x86/gen_x86_insn.py new file mode 100755 index 00000000..ba41a4f1 --- /dev/null +++ b/modules/arch/x86/gen_x86_insn.py @@ -0,0 +1,8516 @@ +#! /usr/bin/env python +# x86 instructions and prefixes data and code generation +# +# Copyright (C) 2002-2007 Peter Johnson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# NOTE: operands are arranged in NASM / Intel order (e.g. dest, src) + +from sys import stdout, version_info + +scriptname = "gen_x86_insn.py" +scriptrev = "HEAD" + +ordered_cpus = [ + "086", "186", "286", "386", "486", "586", "686", "K6", "Athlon", "P3", + "P4", "IA64", "Hammer"] +ordered_cpu_features = [ + "FPU", "Cyrix", "AMD", "MMX", "3DNow", "SMM", "SSE", "SSE2", + "SSE3", "SVM", "PadLock", "SSSE3", "SSE41", "SSE42", "SSE4a", "SSE5", + "AES", "AVX", "FMA", "CLMUL", "MOVBE", "XOP", "FMA4", "F16C", + "FSGSBASE", "RDRAND", "XSAVEOPT", "EPTVPID", "SMX", "AVX2", "BMI1", + "BMI2", "INVPCID", "LZCNT", "TBM", "TSX", "SHA", "SMAP", "RDSEED", "ADX", + "PRFCHW"] +unordered_cpu_features = ["Priv", "Prot", "Undoc", "Obs"] + +# Predefined VEX prefix field values +VEXW0 = 0xC0 +VEXW1 = 0xC8 +VEXL0 = 0xC0 +VEXL1 = 0xC4 +VEXpp = 0xC0 # OR with value + +# Predefined XOP prefix field values +XOPW0 = 0x80 +XOPW1 = 0x88 +XOPL0 = 0x80 +XOPL1 = 0x84 +XOPpp = 0x80 # OR with value + +def lprint(s, f = stdout, e = '\n') : + f.write(s + e) + +def cpu_lcd(cpu1, cpu2): + """Find the lowest common denominator of two CPU sets.""" + retval = set() + + # CPU + cpu1cpus = set(ordered_cpus) & set(cpu1) + if not cpu1cpus: + cpu1cpus.add("086") + cpu1mincpu = min(ordered_cpus.index(x) for x in cpu1cpus) + cpu2cpus = set(ordered_cpus) & set(cpu2) + if not cpu2cpus: + cpu2cpus.add("086") + cpu2mincpu = min(ordered_cpus.index(x) for x in cpu1cpus) + cpumin = ordered_cpus[min(cpu1mincpu, cpu2mincpu)] + if cpumin == "086": + cpumin = "Any" + + if cpumin != "Any": + retval.add(cpumin) + + # Feature + cpu1features = set(ordered_cpu_features) & set(cpu1) + if not cpu1features: + cpu1minfeature = -1 + else: + cpu1minfeature = min(ordered_cpu_features.index(x) + for x in cpu1features) + + cpu2features = set(ordered_cpu_features) & set(cpu2) + if not cpu2features: + cpu2minfeature = -1 + else: + cpu2minfeature = min(ordered_cpu_features.index(x) + for x in cpu2features) + + if cpu1minfeature != -1 and cpu2minfeature != -1: + featuremin = ordered_cpu_features[min(cpu1minfeature, cpu2minfeature)] + retval.add(featuremin) + + # Unordered features + for feature in set(unordered_cpu_features) & set(cpu1) & set(cpu2): + retval.add(feature) + + return retval + +class Operand(object): + def __init__(self, **kwargs): + self.type = kwargs.pop("type") + self.size = kwargs.pop("size", "Any") + self.relaxed = kwargs.pop("relaxed", False) + self.dest = kwargs.pop("dest", None) + self.tmod = kwargs.pop("tmod", None) + self.opt = kwargs.pop("opt", None) + + if kwargs: + for arg in kwargs: + lprint("Warning: unrecognized arg %s" % arg) + + def __str__(self): + return "{"+ ", ".join(["OPT_%s" % self.type, + "OPS_%s" % self.size, + "%d" % self.relaxed, + self.dest == "EA64" and "1" or "0", + "OPTM_%s" % self.tmod, + "OPA_%s" % (self.dest == "EA64" + and "EA" or self.dest), + "OPAP_%s" % self.opt]) + "}" + + def __eq__(self, other): + return (self.type == other.type and + self.size == other.size and + self.relaxed == other.relaxed and + self.dest == other.dest and + self.tmod == other.tmod and + self.opt == other.opt) + + def __ne__(self, other): + return (self.type != other.type or + self.size != other.size or + self.relaxed != other.relaxed or + self.dest != other.dest or + self.tmod != other.tmod or + self.opt != other.opt) + +class GroupForm(object): + def __init__(self, **kwargs): + # Parsers + self.parsers = set(kwargs.pop("parsers", ["gas", "nasm"])) + + # CPU feature flags initialization + self.cpu = set(kwargs.pop("cpu", [])) + + # Misc flags + self.misc_flags = set(kwargs.pop("misc_flags", [])) + if kwargs.pop("only64", False): + self.misc_flags.add("ONLY_64") + if kwargs.pop("not64", False): + self.misc_flags.add("NOT_64") + if kwargs.pop("onlyavx", False): + self.misc_flags.add("ONLY_AVX") + if kwargs.pop("notavx", False): + self.misc_flags.add("NOT_AVX") + + # Operation size + self.opersize = kwargs.pop("opersize", 0) + if self.opersize == 8: + self.opersize = 0 + + if self.opersize == 64: + self.misc_flags.add("ONLY_64") + elif self.opersize == 32 and "ONLY_64" not in self.misc_flags: + self.cpu.add("386") + + # Default operation size in 64-bit mode + self.def_opersize_64 = kwargs.pop("def_opersize_64", 0) + + # GAS suffix + self.gen_suffix = kwargs.pop("gen_suffix", True) + self.suffixes = kwargs.pop("suffixes", None) + suffix = kwargs.pop("suffix", None) + if suffix is not None: + self.suffixes = [suffix] + + req_suffix = kwargs.pop("req_suffix", False) + if not req_suffix: + if self.suffixes is None: + self.suffixes = ["Z"] + else: + self.suffixes.append("Z") + + if self.suffixes is not None: + self.suffixes = set(x.upper() for x in self.suffixes) + + # Special instruction prefix + self.special_prefix = "0" + if "prefix" in kwargs: + self.special_prefix = "0x%02X" % kwargs.pop("prefix") + + # VEX prefix + if "vex" in kwargs: + self.misc_flags.add("ONLY_AVX") + vexW = kwargs.pop("vexw", 0) + if vexW not in [0, 1]: + raise ValueError("VEX.W must be 0 or 1") + + vexL = kwargs.pop("vex") + if vexL == 128 or vexL == 0: + vexL = 0 + elif vexL == 256: + vexL = 1 + else: + raise ValueError("VEX.L must be 128 or 256") + + if self.special_prefix in ["0", "0x00"]: + vexpp = 0 + elif self.special_prefix == "0x66": + vexpp = 1 + elif self.special_prefix == "0xF3": + vexpp = 2 + elif self.special_prefix == "0xF2": + vexpp = 3 + else: + raise ValueError("Cannot combine VEX and special prefix %s" + % self.special_prefix) + + self.special_prefix = "0x%02X" % (0xC0 + vexW*8 + vexL*4 + vexpp) + + # XOP prefix + if "xop" in kwargs: + xopW = kwargs.pop("xopw", 0) + if xopW not in [0, 1]: + raise ValueError("XOP.W must be 0 or 1") + + xopL = kwargs.pop("xop") + if xopL == 128 or xopL == 0: + xopL = 0 + elif xopL == 256: + xopL = 1 + else: + raise ValueError("XOP.L must be 128 or 256") + + # XOPpp is currently reserved (0) + xoppp = 0 + if self.special_prefix not in ["0", "0x00"]: + raise ValueError("Cannot combine XOP and special prefix %s" + % self.special_prefix) + self.special_prefix = "0x%02X" % (0x80 + xopW*8 + xopL*4 + xoppp) + + # Spare value + self.spare = kwargs.pop("spare", 0) + + # Build opcodes string (C array initializer) + if "opcode" in kwargs: + # Usual case, just a single opcode + self.opcode = kwargs.pop("opcode") + self.opcode_len = len(self.opcode) + elif "opcode1" in kwargs and "opcode2" in kwargs: + # Two opcode case; the first opcode is the "optimized" opcode, + # the second is the "relaxed" opcode. For this to work, an + # opt="foo" must be set for one of the operands. + self.opcode1 = kwargs.pop("opcode1") + self.opcode2 = kwargs.pop("opcode2") + self.opcode_len = len(self.opcode1) + else: + raise KeyError("missing opcode") + + # Build operands string (C array initializer) + self.operands = kwargs.pop("operands") + for op in self.operands: + if op.type in ["Reg", "RM", "Areg", "Creg", "Dreg"]: + if op.size == 64: + self.misc_flags.add("ONLY_64") + elif op.size == 32 and "ONLY_64" not in self.misc_flags: + self.cpu.add("386") + if op.type in ["Imm", "ImmNotSegOff"]: + if op.size == 64: + self.misc_flags.add("ONLY_64") + elif op.size == 32 and "ONLY_64" not in self.misc_flags: + self.cpu.add("386") + if op.type in ["FS", "GS"] and "ONLY_64" not in self.misc_flags: + self.cpu.add("386") + if op.type in ["CR4"] and "ONLY_64" not in self.misc_flags: + self.cpu.add("586") + if op.dest == "EA64": + self.misc_flags.add("ONLY_64") + + # Modifiers + self.modifiers = kwargs.pop("modifiers", []) + + # GAS flags + self.gas_only = ("nasm" not in self.parsers) + self.gas_illegal = ("gas" not in self.parsers) + self.gas_no_rev = (kwargs.pop("gas_no_reverse", False) or + kwargs.pop("gas_no_rev", False)) + + # CPU feature flags finalization + # Remove redundancies + maxcpu = -1 + maxcpu_set = self.cpu & set(ordered_cpus) + if maxcpu_set: + maxcpu = max(ordered_cpus.index(x) for x in maxcpu_set) + if maxcpu != -1: + for cpu in ordered_cpus[0:maxcpu]: + self.cpu.discard(cpu) + + if kwargs: + for arg in kwargs: + lprint("Warning: unrecognized arg %s" % arg) + + def __str__(self): + if hasattr(self, "opcode"): + opcodes_str = ["0x%02X" % x for x in self.opcode] + elif hasattr(self, "opcode1") and hasattr(self, "opcode2"): + opcodes_str = ["0x%02X" % x for x in self.opcode1] + opcodes_str.extend("0x%02X" % x for x in self.opcode2) + # Ensure opcodes initializer string is 3 long + opcodes_str.extend(["0", "0", "0"]) + opcodes_str = "{" + ', '.join(opcodes_str[0:3]) + "}" + + cpus_str = "|".join("CPU_%s" % x for x in sorted(self.cpu)) + + if len(self.modifiers) > 4: + raise ValueError("too many modifiers: %s" % (self.modifiers,)) + + cpus_str = [] + if self.cpu is not None: + if len(self.cpu) > 3: + raise ValueError("too many CPUs: %s" % (self.cpu,)) + + # Ensure CPUs initializer string is at least 3 long + cpus_str.extend("CPU_%s" % x for x in sorted(self.cpu)) + + # Ensure cpus initializer string is 3 long; 0=CPU_Any + cpus_str.extend(["0", "0", "0"]) + + + mods = ["MOD_%s" % x for x in self.modifiers] + # Ensure mods initializer string is 4 long + mods.extend(["0", "0", "0", "0"]) + mod_str = "{" + ', '.join(mods[0:4]) + "}" + + gas_flags = [] + if self.gas_only: + gas_flags.append("GAS_ONLY") + if self.gas_illegal: + gas_flags.append("GAS_ILLEGAL") + if self.gas_no_rev: + gas_flags.append("GAS_NO_REV") + if self.suffixes: + gas_flags.extend("SUF_%s" % x for x in sorted(self.suffixes)) + gas_flags = "|".join(gas_flags) + + # Build instruction info structure initializer + return "{ "+ ", ".join([gas_flags or "0", + "|".join(self.misc_flags) or "0", + cpus_str[0], + cpus_str[1], + cpus_str[2], + mod_str, + "%d" % (self.opersize or 0), + "%d" % (self.def_opersize_64 or 0), + self.special_prefix or "0", + "%d" % self.opcode_len, + opcodes_str, + "%d" % (self.spare or 0), + "%d" % len(self.operands), + "%d" % self.all_operands_index]) + " }" + +groups = {} +groupnames_ordered = [] +def add_group(name, **kwargs): + forms = groups.setdefault(name, []) + forms.append(GroupForm(**kwargs)) + groupnames_ordered.append(name) + +class Insn(object): + def __init__(self, groupname, suffix=None, parser=None, modifiers=None, + cpu=None, misc_flags=None, only64=False, not64=False, + avx=False): + self.groupname = groupname + if suffix is None: + self.suffix = None + else: + self.suffix = suffix.upper() + + self.parsers = None + if suffix is not None: + self.parsers = set(["gas"]) + if parser is not None: + self.parsers = set([parser]) + + if modifiers is None: + self.modifiers = [] + else: + self.modifiers = modifiers + if cpu is None: + self.cpu = None + else: + self.cpu = set(cpu) + + if misc_flags is None: + self.misc_flags = None + else: + self.misc_flags = set([x for x in misc_flags]) + + if only64: + if self.misc_flags is None: + self.misc_flags = set() + self.misc_flags.add("ONLY_64") + if not64: + if self.misc_flags is None: + self.misc_flags = set() + self.misc_flags.add("NOT_64") + if avx: + if self.misc_flags is None: + self.misc_flags = set() + self.misc_flags.add("ONLY_AVX") + if self.cpu is None: + self.cpu = set(["AVX"]) + + def auto_cpu(self, parser): + """Determine lowest common denominator CPU from group and suffix. + Does nothing if CPU is already set.""" + if self.cpu is not None: + return + # Scan through group, matching parser and suffix + for form in groups[self.groupname]: + if parser not in form.parsers: + continue + if (self.suffix is not None and len(self.suffix) == 1 and + (form.suffixes is None or self.suffix not in form.suffixes)): + continue + if self.cpu is None: + self.cpu = set(form.cpu) + else: + self.cpu = cpu_lcd(self.cpu, form.cpu) + + def auto_misc_flags(self, parser): + """Determine lowest common denominator flags from group and suffix. + Does nothing if flags is already set.""" + if self.misc_flags is not None: + return + # Scan through group, matching parser and suffix + for form in groups[self.groupname]: + if parser not in form.parsers: + continue + if (self.suffix is not None and len(self.suffix) == 1 and + (form.suffixes is None or self.suffix not in form.suffixes)): + continue + if self.misc_flags is None: + self.misc_flags = set(form.misc_flags) + else: + self.misc_flags &= form.misc_flags + + def copy(self): + """Return a shallow copy.""" + return Insn(self.groupname, + suffix=self.suffix, + modifiers=self.modifiers, + cpu=self.cpu, + misc_flags=self.misc_flags) + + def __str__(self): + if self.suffix is None: + suffix_str = "SUF_Z" + elif len(self.suffix) == 1: + suffix_str = "SUF_" + self.suffix + else: + suffix_str = self.suffix + + cpus_str = [] + if self.cpu is not None: + if len(self.cpu) > 3: + raise ValueError("too many CPUs: %s" % (self.cpu,)) + cpus_str.extend("CPU_%s" % x for x in sorted(self.cpu)) + + # Ensure cpus initializer string is 3 long + cpus_str.extend(["0", "0", "0"]) + + if len(self.modifiers) > 4: + raise ValueError("too many modifiers") + mods_str = ["0x%02X" % x for x in self.modifiers] + + # Ensure modifiers is at least 4 long + mods_str.extend(["0", "0", "0", "0"]) + + return ",\t".join(["%s_insn" % self.groupname, + "%d" % len(groups[self.groupname]), + suffix_str, + mods_str[0], + mods_str[1], + mods_str[2], + "|".join(self.misc_flags or []) or "0", + cpus_str[0], + cpus_str[1], + cpus_str[2]]) + +insns = {} +def add_insn(name, groupname, **kwargs): + opts = insns.setdefault(name, []) + opts.append(Insn(groupname, **kwargs)) + +class Prefix(object): + def __init__(self, groupname, value, only64=False): + self.groupname = groupname + self.value = value + self.only64 = only64 + + def __str__(self): + return ",\t".join(["NULL", + "X86_%s>>8" % self.groupname, + "0x%02X" % self.value, + "0", + "0", + "0", + self.only64 and "ONLY_64" or "0", + "0", + "0", + "0"]) + +gas_insns = {} +nasm_insns = {} + +def add_prefix(name, groupname, value, parser=None, **kwargs): + prefix = Prefix(groupname, value, **kwargs) + if parser is None or parser == "gas": + gas_insns[name] = prefix + if parser is None or parser == "nasm": + nasm_insns[name] = prefix + +def finalize_insns(): + unused_groups = set(groups.keys()) + for name in insns: + for insn in insns[name]: + group = groups[insn.groupname] + unused_groups.discard(insn.groupname) + + parsers = set() + for form in group: + parsers |= form.parsers + if insn.parsers is not None: + parsers &= insn.parsers + + if "gas" in parsers: + suffixes = set() + if insn.suffix is None: + for form in group: + if form.gen_suffix and form.suffixes is not None: + suffixes |= form.suffixes + + if not suffixes: + suffixes.add("Z") + for suffix in suffixes: + if suffix == "Z": + keyword = name + else: + keyword = name+suffix + keyword = keyword.lower() + if keyword in gas_insns: + raise ValueError("duplicate gas instruction %s" % + keyword) + newinsn = insn.copy() + if insn.suffix is None: + newinsn.suffix = suffix + newinsn.auto_cpu("gas") + newinsn.auto_misc_flags("gas") + gas_insns[keyword] = newinsn + + if "nasm" in parsers: + keyword = name + if keyword in nasm_insns: + raise ValueError("duplicate nasm instruction %s" % keyword) + newinsn = insn.copy() + newinsn.auto_cpu("nasm") + newinsn.auto_misc_flags("nasm") + nasm_insns[keyword] = newinsn + + unused_groups.discard("empty") + unused_groups.discard("not64") + if unused_groups: + lprint("warning: unused groups: %s" % ", ".join(unused_groups)) + +def output_insns(f, parser, insns): + lprint("/* Generated by %s r%s, do not edit */" % \ + (scriptname, scriptrev), f) + lprint("""%%ignore-case +%%language=ANSI-C +%%compare-strncmp +%%readonly-tables +%%enum +%%struct-type +%%define hash-function-name insnprefix_%s_hash +%%define lookup-function-name insnprefix_%s_find +struct insnprefix_parse_data; +%%%%""" % (parser, parser), f) + for keyword in sorted(insns): + lprint("%s,\t%s" % (keyword.lower(), insns[keyword]), f) + +def output_gas_insns(f): + output_insns(f, "gas", gas_insns) + +def output_nasm_insns(f): + output_insns(f, "nasm", nasm_insns) + +def output_groups(f): + # Merge all operand lists into single list + # Sort by number of operands to shorten output + all_operands = [] + if version_info[0] == 2: + gi = groups.itervalues() + else: + gi = groups.values() + for form in sorted((form for g in gi for form in g), + key=lambda x:len(x.operands), reverse=True): + num_operands = len(form.operands) + for i in range(len(all_operands)): + if all_operands[i:i+num_operands] == form.operands: + form.all_operands_index = i + break + else: + form.all_operands_index = len(all_operands) + all_operands.extend(form.operands) + + # Output operands list + lprint("/* Generated by %s r%s, do not edit */" % \ + (scriptname, scriptrev), f) + lprint("static const x86_info_operand insn_operands[] = {", f) + lprint(" ", f, '') + lprint(",\n ".join(str(x) for x in all_operands), f) + lprint("};\n", f) + + # Output groups + seen = set() + for name in groupnames_ordered: + if name in seen: + continue + seen.add(name) + lprint("static const x86_insn_info %s_insn[] = {" % name, f) + lprint(" ", f, '') + lprint(",\n ".join(str(x) for x in groups[name]), f) + lprint("};\n", f) + +##################################################################### +# General instruction groupings +##################################################################### + +# +# Empty instruction +# +add_group("empty", opcode=[], operands=[]) + +# +# Placeholder for instructions invalid in 64-bit mode +# +add_group("not64", opcode=[], operands=[], not64=True) + +# +# One byte opcode instructions with no operands +# +add_group("onebyte", + modifiers=["Op0Add", "OpSizeR", "DOpS64R"], + opcode=[0x00], + operands=[]) + +# +# One byte opcode instructions with "special" prefix with no operands +# +add_group("onebyte_prefix", + modifiers=["PreAdd", "Op0Add"], + prefix=0x00, + opcode=[0x00], + operands=[]) + +# +# Two byte opcode instructions with no operands +# +add_group("twobyte", + gen_suffix=False, + suffixes=["l", "q"], + modifiers=["Op0Add", "Op1Add"], + opcode=[0x00, 0x00], + operands=[]) + +# +# Three byte opcode instructions with no operands +# +add_group("threebyte", + modifiers=["Op0Add", "Op1Add", "Op2Add"], + opcode=[0x00, 0x00, 0x00], + operands=[]) + +# +# Four byte opcode instructions with no operands +# +add_group("fourbyte", + modifiers=["Op0Add", "Op1Add", "Op2Add", "Op3Add"], + opcode=[0x00, 0x00, 0x00, 0x00], + operands=[]) + +# +# One byte opcode instructions with general memory operand +# +add_group("onebytemem", + gen_suffix=False, + suffixes=["l", "q", "s"], + modifiers=["SpAdd", "Op0Add"], + opcode=[0x00], + spare=0, + operands=[Operand(type="Mem", dest="EA")]) + +# +# Two byte opcode instructions with general memory operand +# +add_group("twobytemem", + gen_suffix=False, + suffixes=["w", "l", "q", "s"], + modifiers=["SpAdd", "Op0Add", "Op1Add"], + opcode=[0x00, 0x00], + spare=0, + operands=[Operand(type="Mem", relaxed=True, dest="EA")]) + +# +# mov +# + +# Absolute forms for non-64-bit mode +for sfx, sz in zip("bwl", [8, 16, 32]): + add_group("mov", + suffix=sfx, + not64=True, + opersize=sz, + opcode=[0xA0+(sz!=8)], + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="MemOffs", size=sz, relaxed=True, dest="EA")]) + +for sfx, sz in zip("bwl", [8, 16, 32]): + add_group("mov", + suffix=sfx, + not64=True, + opersize=sz, + opcode=[0xA2+(sz!=8)], + operands=[Operand(type="MemOffs", size=sz, relaxed=True, dest="EA"), + Operand(type="Areg", size=sz, dest=None)]) + +# 64-bit absolute forms for 64-bit mode. Disabled for GAS, see movabs +for sz in (8, 16, 32, 64): + add_group("mov", + opersize=sz, + opcode=[0xA0+(sz!=8)], + only64=True, + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="MemOffs", size=sz, relaxed=True, dest="EA64")]) + +for sz in (8, 16, 32, 64): + add_group("mov", + only64=True, + opersize=sz, + opcode=[0xA2+(sz!=8)], + operands=[Operand(type="MemOffs", size=sz, relaxed=True, dest="EA64"), + Operand(type="Areg", size=sz, dest=None)]) + +# General 32-bit forms using Areg / short absolute option +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode1=[0x88+(sz!=8)], + opcode2=[0xA2+(sz!=8)], + operands=[ + Operand(type="RM", size=sz, relaxed=True, dest="EA", opt="ShortMov"), + Operand(type="Areg", size=sz, dest="Spare")]) + +# General 32-bit forms +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode=[0x88+(sz!=8)], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) + +# General 32-bit forms using Areg / short absolute option +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode1=[0x8A+(sz!=8)], + opcode2=[0xA0+(sz!=8)], + operands=[Operand(type="Areg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA", + opt="ShortMov")]) + +# General 32-bit forms +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode=[0x8A+(sz!=8)], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +# Segment register forms +add_group("mov", + suffix="w", + opcode=[0x8C], + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA"), + Operand(type="SegReg", size=16, relaxed=True, dest="Spare")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode=[0x8C], + operands=[ + Operand(type="Reg", size=sz, dest="EA"), + Operand(type="SegReg", size=16, relaxed=True, dest="Spare")]) +add_group("mov", + suffix="w", + opcode=[0x8E], + operands=[Operand(type="SegReg", size=16, relaxed=True, dest="Spare"), + Operand(type="RM", size=16, relaxed=True, dest="EA")]) +for sfx, sz in zip("lq", [32, 64]): + add_group("mov", + suffix=sfx, + opcode=[0x8E], + operands=[ + Operand(type="SegReg", size=16, relaxed=True, dest="Spare"), + Operand(type="Reg", size=sz, dest="EA")]) + +# Immediate forms +add_group("mov", + suffix="b", + opcode=[0xB0], + operands=[Operand(type="Reg", size=8, dest="Op0Add"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +for sfx, sz in zip("wl", [16, 32]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode=[0xB8], + operands=[Operand(type="Reg", size=sz, dest="Op0Add"), + Operand(type="Imm", size=sz, relaxed=True, dest="Imm")]) +# 64-bit forced size form +add_group("mov", + parsers=["nasm"], + opersize=64, + opcode=[0xB8], + operands=[Operand(type="Reg", size=64, dest="Op0Add"), + Operand(type="Imm", size=64, dest="Imm")]) +add_group("mov", + suffix="q", + opersize=64, + opcode1=[0xB8], + opcode2=[0xC7], + operands=[Operand(type="Reg", size=64, dest="Op0Add"), + Operand(type="Imm", size=64, relaxed=True, dest="Imm", + opt="SImm32Avail")]) +# Need two sets here, one for strictness on left side, one for right. +for sfx, sz, immsz in zip("bwlq", [8, 16, 32, 64], [8, 16, 32, 32]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode=[0xC6+(sz!=8)], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=immsz, dest="Imm")]) +for sfx, sz, immsz in zip("bwlq", [8, 16, 32, 64], [8, 16, 32, 32]): + add_group("mov", + suffix=sfx, + opersize=sz, + opcode=[0xC6+(sz!=8)], + operands=[Operand(type="RM", size=sz, dest="EA"), + Operand(type="Imm", size=immsz, relaxed=True, dest="Imm")]) + +# CR forms +add_group("mov", + suffix="l", + not64=True, + cpu=["Priv"], + opcode=[0x0F, 0x22], + operands=[Operand(type="CR4", size=32, dest="Spare"), + Operand(type="Reg", size=32, dest="EA")]) +add_group("mov", + suffix="l", + not64=True, + cpu=["Priv"], + opcode=[0x0F, 0x22], + operands=[Operand(type="CRReg", size=32, dest="Spare"), + Operand(type="Reg", size=32, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["Priv"], + opcode=[0x0F, 0x22], + operands=[Operand(type="CRReg", size=32, dest="Spare"), + Operand(type="Reg", size=64, dest="EA")]) +add_group("mov", + suffix="l", + not64=True, + cpu=["Priv"], + opcode=[0x0F, 0x20], + operands=[Operand(type="Reg", size=32, dest="EA"), + Operand(type="CR4", size=32, dest="Spare")]) +add_group("mov", + suffix="l", + cpu=["Priv"], + not64=True, + opcode=[0x0F, 0x20], + operands=[Operand(type="Reg", size=32, dest="EA"), + Operand(type="CRReg", size=32, dest="Spare")]) +add_group("mov", + suffix="q", + cpu=["Priv"], + opcode=[0x0F, 0x20], + operands=[Operand(type="Reg", size=64, dest="EA"), + Operand(type="CRReg", size=32, dest="Spare")]) + +# DR forms +add_group("mov", + suffix="l", + not64=True, + cpu=["Priv"], + opcode=[0x0F, 0x23], + operands=[Operand(type="DRReg", size=32, dest="Spare"), + Operand(type="Reg", size=32, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["Priv"], + opcode=[0x0F, 0x23], + operands=[Operand(type="DRReg", size=32, dest="Spare"), + Operand(type="Reg", size=64, dest="EA")]) +add_group("mov", + suffix="l", + not64=True, + cpu=["Priv"], + opcode=[0x0F, 0x21], + operands=[Operand(type="Reg", size=32, dest="EA"), + Operand(type="DRReg", size=32, dest="Spare")]) +add_group("mov", + suffix="q", + cpu=["Priv"], + opcode=[0x0F, 0x21], + operands=[Operand(type="Reg", size=64, dest="EA"), + Operand(type="DRReg", size=32, dest="Spare")]) + +# MMX forms for GAS parser (copied from movq) +add_group("mov", + suffix="q", + cpu=["MMX"], + parsers=["gas"], + opcode=[0x0F, 0x6F], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["MMX"], + parsers=["gas"], + opersize=64, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["MMX"], + parsers=["gas"], + opcode=[0x0F, 0x7F], + operands=[Operand(type="SIMDRM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) +add_group("mov", + suffix="q", + cpu=["MMX"], + parsers=["gas"], + opersize=64, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) + +# SSE2 forms for GAS parser (copied from movq) +add_group("mov", + suffix="q", + cpu=["SSE2"], + parsers=["gas"], + prefix=0xF3, + opcode=[0x0F, 0x7E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["SSE2"], + parsers=["gas"], + prefix=0xF3, + opcode=[0x0F, 0x7E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["SSE2"], + parsers=["gas"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("mov", + suffix="q", + cpu=["SSE2"], + parsers=["gas"], + prefix=0x66, + opcode=[0x0F, 0xD6], + operands=[Operand(type="SIMDRM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("mov", + suffix="q", + cpu=["SSE2"], + parsers=["gas"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("mov", "mov") + +# +# 64-bit absolute move (for GAS). +# These are disabled for GAS for normal mov above. +# +add_group("movabs", + suffix="b", + only64=True, + opcode=[0xA0], + operands=[Operand(type="Areg", size=8, dest=None), + Operand(type="MemOffs", size=8, relaxed=True, dest="EA64")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("movabs", + only64=True, + suffix=sfx, + opersize=sz, + opcode=[0xA1], + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="MemOffs", size=sz, relaxed=True, + dest="EA64")]) + +add_group("movabs", + suffix="b", + only64=True, + opcode=[0xA2], + operands=[Operand(type="MemOffs", size=8, relaxed=True, dest="EA64"), + Operand(type="Areg", size=8, dest=None)]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("movabs", + suffix=sfx, + only64=True, + opersize=sz, + opcode=[0xA3], + operands=[Operand(type="MemOffs", size=sz, relaxed=True, + dest="EA64"), + Operand(type="Areg", size=sz, dest=None)]) + +# 64-bit immediate form +add_group("movabs", + suffix="q", + opersize=64, + opcode=[0xB8], + operands=[Operand(type="Reg", size=64, dest="Op0Add"), + Operand(type="Imm", size=64, relaxed=True, dest="Imm")]) + +add_insn("movabs", "movabs", parser="gas") + +# +# Move with sign/zero extend +# +add_group("movszx", + suffix="b", + cpu=["386"], + modifiers=["Op1Add"], + opersize=16, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=16, dest="Spare"), + Operand(type="RM", size=8, relaxed=True, dest="EA")]) +add_group("movszx", + suffix="b", + cpu=["386"], + modifiers=["Op1Add"], + opersize=32, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="RM", size=8, dest="EA")]) +add_group("movszx", + suffix="b", + modifiers=["Op1Add"], + opersize=64, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="RM", size=8, dest="EA")]) +add_group("movszx", + suffix="w", + cpu=["386"], + modifiers=["Op1Add"], + opersize=32, + opcode=[0x0F, 0x01], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="RM", size=16, dest="EA")]) +add_group("movszx", + suffix="w", + modifiers=["Op1Add"], + opersize=64, + opcode=[0x0F, 0x01], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="RM", size=16, dest="EA")]) + +add_insn("movsbw", "movszx", suffix="b", modifiers=[0xBE]) +add_insn("movsbl", "movszx", suffix="b", modifiers=[0xBE]) +add_insn("movswl", "movszx", suffix="w", modifiers=[0xBE]) +add_insn("movsbq", "movszx", suffix="b", modifiers=[0xBE], only64=True) +add_insn("movswq", "movszx", suffix="w", modifiers=[0xBE], only64=True) +add_insn("movsx", "movszx", modifiers=[0xBE]) +add_insn("movzbw", "movszx", suffix="b", modifiers=[0xB6]) +add_insn("movzbl", "movszx", suffix="b", modifiers=[0xB6]) +add_insn("movzwl", "movszx", suffix="w", modifiers=[0xB6]) +add_insn("movzbq", "movszx", suffix="b", modifiers=[0xB6], only64=True) +add_insn("movzwq", "movszx", suffix="w", modifiers=[0xB6], only64=True) +add_insn("movzx", "movszx", modifiers=[0xB6]) + +# +# Move with sign-extend doubleword (64-bit mode only) +# +add_group("movsxd", + suffix="l", + opersize=64, + opcode=[0x63], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="RM", size=32, dest="EA")]) + +add_insn("movslq", "movsxd", suffix="l") +add_insn("movsxd", "movsxd", parser="nasm") + +# +# Push instructions +# +add_group("push", + def_opersize_64=64, + opcode=[0x50], + operands=[Operand(type="Reg", size="BITS", dest="Op0Add")]) +add_group("push", + suffix="w", + opersize=16, + def_opersize_64=64, + opcode=[0x50], + operands=[Operand(type="Reg", size=16, dest="Op0Add")]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode=[0x50], + operands=[Operand(type="Reg", size=32, dest="Op0Add")]) +add_group("push", + suffix="q", + only64=True, + def_opersize_64=64, + opcode=[0x50], + operands=[Operand(type="Reg", size=64, dest="Op0Add")]) + +add_group("push", + def_opersize_64=64, + opcode=[0xFF], + spare=6, + operands=[Operand(type="RM", size="BITS", dest="EA")]) +add_group("push", + suffix="w", + opersize=16, + def_opersize_64=64, + opcode=[0xFF], + spare=6, + operands=[Operand(type="RM", size=16, dest="EA")]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode=[0xFF], + spare=6, + operands=[Operand(type="RM", size=32, dest="EA")]) +add_group("push", + suffix="q", + only64=True, + def_opersize_64=64, + opcode=[0xFF], + spare=6, + operands=[Operand(type="RM", size=64, dest="EA")]) + +add_group("push", + cpu=["186"], + parsers=["nasm"], + def_opersize_64=64, + opcode=[0x6A], + operands=[Operand(type="Imm", size=8, dest="SImm")]) +add_group("push", + cpu=["186"], + parsers=["gas"], + def_opersize_64=64, + opcode=[0x6A], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="SImm")]) +add_group("push", + suffix="q", + only64=True, + opersize=64, + def_opersize_64=64, + opcode1=[0x6A], + opcode2=[0x68], + operands=[Operand(type="Imm", size=32, relaxed=True, dest="SImm", + opt="SImm8")]) +add_group("push", + not64=True, + cpu=["186"], + parsers=["nasm"], + opcode1=[0x6A], + opcode2=[0x68], + operands=[Operand(type="Imm", size="BITS", relaxed=True, dest="Imm", + opt="SImm8")]) +add_group("push", + suffix="w", + cpu=["186"], + opersize=16, + def_opersize_64=64, + opcode1=[0x6A], + opcode2=[0x68], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="Imm", + opt="SImm8")]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode1=[0x6A], + opcode2=[0x68], + operands=[Operand(type="Imm", size=32, relaxed=True, dest="Imm", + opt="SImm8")]) +# Need these when we don't match the BITS size, but they need to be +# below the above line so the optimizer can kick in by default. +add_group("push", + cpu=["186"], + parsers=["nasm"], + opersize=16, + def_opersize_64=64, + opcode=[0x68], + operands=[Operand(type="Imm", size=16, dest="Imm")]) +add_group("push", + not64=True, + parsers=["nasm"], + opersize=32, + opcode=[0x68], + operands=[Operand(type="Imm", size=32, dest="Imm")]) +add_group("push", + only64=True, + parsers=["nasm"], + opersize=64, + def_opersize_64=64, + opcode=[0x68], + operands=[Operand(type="Imm", size=32, dest="SImm")]) +add_group("push", + not64=True, + opcode=[0x0E], + operands=[Operand(type="CS", dest=None)]) +add_group("push", + suffix="w", + not64=True, + opersize=16, + opcode=[0x0E], + operands=[Operand(type="CS", size=16, dest=None)]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode=[0x0E], + operands=[Operand(type="CS", size=32, dest=None)]) +add_group("push", + not64=True, + opcode=[0x16], + operands=[Operand(type="SS", dest=None)]) +add_group("push", + suffix="w", + not64=True, + opersize=16, + opcode=[0x16], + operands=[Operand(type="SS", size=16, dest=None)]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode=[0x16], + operands=[Operand(type="SS", size=32, dest=None)]) +add_group("push", + not64=True, + opcode=[0x1E], + operands=[Operand(type="DS", dest=None)]) +add_group("push", + suffix="w", + not64=True, + opersize=16, + opcode=[0x1E], + operands=[Operand(type="DS", size=16, dest=None)]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode=[0x1E], + operands=[Operand(type="DS", size=32, dest=None)]) +add_group("push", + not64=True, + opcode=[0x06], + operands=[Operand(type="ES", dest=None)]) +add_group("push", + suffix="w", + not64=True, + opersize=16, + opcode=[0x06], + operands=[Operand(type="ES", size=16, dest=None)]) +add_group("push", + suffix="l", + not64=True, + opersize=32, + opcode=[0x06], + operands=[Operand(type="ES", size=32, dest=None)]) +add_group("push", + opcode=[0x0F, 0xA0], + operands=[Operand(type="FS", dest=None)]) +add_group("push", + suffix="w", + opersize=16, + opcode=[0x0F, 0xA0], + operands=[Operand(type="FS", size=16, dest=None)]) +add_group("push", + suffix="l", + opersize=32, + opcode=[0x0F, 0xA0], + operands=[Operand(type="FS", size=32, dest=None)]) +add_group("push", + opcode=[0x0F, 0xA8], + operands=[Operand(type="GS", dest=None)]) +add_group("push", + suffix="w", + opersize=16, + opcode=[0x0F, 0xA8], + operands=[Operand(type="GS", size=16, dest=None)]) +add_group("push", + suffix="l", + opersize=32, + opcode=[0x0F, 0xA8], + operands=[Operand(type="GS", size=32, dest=None)]) + +add_insn("push", "push") +add_insn("pusha", "onebyte", modifiers=[0x60, 0], cpu=["186"], not64=True) +add_insn("pushad", "onebyte", parser="nasm", modifiers=[0x60, 32], + cpu=["386"], not64=True) +add_insn("pushal", "onebyte", parser="gas", modifiers=[0x60, 32], + cpu=["386"], not64=True) +add_insn("pushaw", "onebyte", modifiers=[0x60, 16], cpu=["186"], not64=True) + +# +# Pop instructions +# +add_group("pop", + def_opersize_64=64, + opcode=[0x58], + operands=[Operand(type="Reg", size="BITS", dest="Op0Add")]) +add_group("pop", + suffix="w", + opersize=16, + def_opersize_64=64, + opcode=[0x58], + operands=[Operand(type="Reg", size=16, dest="Op0Add")]) +add_group("pop", + suffix="l", + not64=True, + opersize=32, + opcode=[0x58], + operands=[Operand(type="Reg", size=32, dest="Op0Add")]) +add_group("pop", + suffix="q", + only64=True, + def_opersize_64=64, + opcode=[0x58], + operands=[Operand(type="Reg", size=64, dest="Op0Add")]) + +add_group("pop", + def_opersize_64=64, + opcode=[0x8F], + operands=[Operand(type="RM", size="BITS", dest="EA")]) +add_group("pop", + suffix="w", + opersize=16, + def_opersize_64=64, + opcode=[0x8F], + operands=[Operand(type="RM", size=16, dest="EA")]) +add_group("pop", + suffix="l", + not64=True, + opersize=32, + opcode=[0x8F], + operands=[Operand(type="RM", size=32, dest="EA")]) +add_group("pop", + suffix="q", + only64=True, + def_opersize_64=64, + opcode=[0x8F], + operands=[Operand(type="RM", size=64, dest="EA")]) + +# POP CS is debateably valid on the 8086, if obsolete and undocumented. +# We don't include it because it's VERY unlikely it will ever be used +# anywhere. If someone really wants it they can db 0x0F it. +#add_group("pop", +# cpu=["Undoc", "Obs"], +# opcode=[0x0F], +# operands=[Operand(type="CS", dest=None)]) +add_group("pop", + not64=True, + opcode=[0x17], + operands=[Operand(type="SS", dest=None)]) +add_group("pop", + not64=True, + opersize=16, + opcode=[0x17], + operands=[Operand(type="SS", size=16, dest=None)]) +add_group("pop", + not64=True, + opersize=32, + opcode=[0x17], + operands=[Operand(type="SS", size=32, dest=None)]) +add_group("pop", + not64=True, + opcode=[0x1F], + operands=[Operand(type="DS", dest=None)]) +add_group("pop", + not64=True, + opersize=16, + opcode=[0x1F], + operands=[Operand(type="DS", size=16, dest=None)]) +add_group("pop", + not64=True, + opersize=32, + opcode=[0x1F], + operands=[Operand(type="DS", size=32, dest=None)]) +add_group("pop", + not64=True, + opcode=[0x07], + operands=[Operand(type="ES", dest=None)]) +add_group("pop", + not64=True, + opersize=16, + opcode=[0x07], + operands=[Operand(type="ES", size=16, dest=None)]) +add_group("pop", + not64=True, + opersize=32, + opcode=[0x07], + operands=[Operand(type="ES", size=32, dest=None)]) +add_group("pop", + opcode=[0x0F, 0xA1], + operands=[Operand(type="FS", dest=None)]) +add_group("pop", + opersize=16, + opcode=[0x0F, 0xA1], + operands=[Operand(type="FS", size=16, dest=None)]) +add_group("pop", + opersize=32, + opcode=[0x0F, 0xA1], + operands=[Operand(type="FS", size=32, dest=None)]) +add_group("pop", + opcode=[0x0F, 0xA9], + operands=[Operand(type="GS", dest=None)]) +add_group("pop", + opersize=16, + opcode=[0x0F, 0xA9], + operands=[Operand(type="GS", size=16, dest=None)]) +add_group("pop", + opersize=32, + opcode=[0x0F, 0xA9], + operands=[Operand(type="GS", size=32, dest=None)]) + +add_insn("pop", "pop") +add_insn("popa", "onebyte", modifiers=[0x61, 0], cpu=["186"], not64=True) +add_insn("popad", "onebyte", parser="nasm", modifiers=[0x61, 32], + cpu=["386"], not64=True) +add_insn("popal", "onebyte", parser="gas", modifiers=[0x61, 32], + cpu=["386"], not64=True) +add_insn("popaw", "onebyte", modifiers=[0x61, 16], cpu=["186"], not64=True) + +# +# Exchange instructions +# +add_group("xchg", + suffix="b", + opcode=[0x86], + operands=[Operand(type="RM", size=8, relaxed=True, dest="EA"), + Operand(type="Reg", size=8, dest="Spare")]) +add_group("xchg", + suffix="b", + opcode=[0x86], + operands=[Operand(type="Reg", size=8, dest="Spare"), + Operand(type="RM", size=8, relaxed=True, dest="EA")]) +# We could be extra-efficient in the 64-bit mode case here. +# XCHG AX, AX in 64-bit mode is a NOP, as it doesn't clear the +# high 48 bits of RAX. Thus we don't need the operand-size prefix. +# But this feels too clever, and probably not what the user really +# expects in the generated code, so we don't do it. +#add_group("xchg", +# suffix="w", +# only64=True, +# opcode=[0x90], +# operands=[Operand(type="Areg", size=16, dest=None), +# Operand(type="AReg", size=16, dest="Op0Add")]) +add_group("xchg", + suffix="w", + opersize=16, + opcode=[0x90], + operands=[Operand(type="Areg", size=16, dest=None), + Operand(type="Reg", size=16, dest="Op0Add")]) +add_group("xchg", + suffix="w", + opersize=16, + opcode=[0x90], + operands=[Operand(type="Reg", size=16, dest="Op0Add"), + Operand(type="Areg", size=16, dest=None)]) +add_group("xchg", + suffix="w", + opersize=16, + opcode=[0x87], + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA"), + Operand(type="Reg", size=16, dest="Spare")]) +add_group("xchg", + suffix="w", + opersize=16, + opcode=[0x87], + operands=[Operand(type="Reg", size=16, dest="Spare"), + Operand(type="RM", size=16, relaxed=True, dest="EA")]) +# Be careful with XCHG EAX, EAX in 64-bit mode. This needs to use +# the long form rather than the NOP form, as the long form clears +# the high 32 bits of RAX. This makes all 32-bit forms in 64-bit +# mode have consistent operation. +# +# FIXME: due to a hard-to-fix bug in how we handle generating gas suffix CPU +# rules, this causes xchgl to be CPU_Any instead of CPU_386. A hacky patch +# could fix it, but it's doubtful anyone will ever notice, so leave it. +add_group("xchg", + suffix="l", + only64=True, + opersize=32, + opcode=[0x87], + operands=[Operand(type="Areg", size=32, dest="EA"), + Operand(type="Areg", size=32, dest="Spare")]) +add_group("xchg", + suffix="l", + opersize=32, + opcode=[0x90], + operands=[Operand(type="Areg", size=32, dest=None), + Operand(type="Reg", size=32, dest="Op0Add")]) +add_group("xchg", + suffix="l", + opersize=32, + opcode=[0x90], + operands=[Operand(type="Reg", size=32, dest="Op0Add"), + Operand(type="Areg", size=32, dest=None)]) +add_group("xchg", + suffix="l", + opersize=32, + opcode=[0x87], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Reg", size=32, dest="Spare")]) +add_group("xchg", + suffix="l", + opersize=32, + opcode=[0x87], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +# Be efficient with XCHG RAX, RAX. +# This is a NOP and thus doesn't need the REX prefix. +add_group("xchg", + suffix="q", + only64=True, + opcode=[0x90], + operands=[Operand(type="Areg", size=64, dest=None), + Operand(type="Areg", size=64, dest="Op0Add")]) +add_group("xchg", + suffix="q", + opersize=64, + opcode=[0x90], + operands=[Operand(type="Areg", size=64, dest=None), + Operand(type="Reg", size=64, dest="Op0Add")]) +add_group("xchg", + suffix="q", + opersize=64, + opcode=[0x90], + operands=[Operand(type="Reg", size=64, dest="Op0Add"), + Operand(type="Areg", size=64, dest=None)]) +add_group("xchg", + suffix="q", + opersize=64, + opcode=[0x87], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="Reg", size=64, dest="Spare")]) +add_group("xchg", + suffix="q", + opersize=64, + opcode=[0x87], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) + +add_insn("xchg", "xchg") + +##################################################################### +# In/out from ports +##################################################################### +add_group("in", + suffix="b", + opcode=[0xE4], + operands=[Operand(type="Areg", size=8, dest=None), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +for sfx, sz in zip("wl", [16, 32]): + add_group("in", + suffix=sfx, + opersize=sz, + opcode=[0xE5], + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("in", + suffix="b", + opcode=[0xEC], + operands=[Operand(type="Areg", size=8, dest=None), + Operand(type="Dreg", size=16, dest=None)]) +for sfx, sz in zip("wl", [16, 32]): + add_group("in", + suffix=sfx, + opersize=sz, + opcode=[0xED], + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="Dreg", size=16, dest=None)]) +# GAS-only variants (implicit accumulator register) +add_group("in", + suffix="b", + parsers=["gas"], + opcode=[0xE4], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +for sfx, sz in zip("wl", [16, 32]): + add_group("in", + suffix=sfx, + parsers=["gas"], + opersize=sz, + opcode=[0xE5], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("in", + suffix="b", + parsers=["gas"], + opcode=[0xEC], + operands=[Operand(type="Dreg", size=16, dest=None)]) +add_group("in", + suffix="w", + parsers=["gas"], + opersize=16, + opcode=[0xED], + operands=[Operand(type="Dreg", size=16, dest=None)]) +add_group("in", + suffix="l", + cpu=["386"], + parsers=["gas"], + opersize=32, + opcode=[0xED], + operands=[Operand(type="Dreg", size=16, dest=None)]) + +add_insn("in", "in") + +add_group("out", + suffix="b", + opcode=[0xE6], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm"), + Operand(type="Areg", size=8, dest=None)]) +for sfx, sz in zip("wl", [16, 32]): + add_group("out", + suffix=sfx, + opersize=sz, + opcode=[0xE7], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm"), + Operand(type="Areg", size=sz, dest=None)]) +add_group("out", + suffix="b", + opcode=[0xEE], + operands=[Operand(type="Dreg", size=16, dest=None), + Operand(type="Areg", size=8, dest=None)]) +for sfx, sz in zip("wl", [16, 32]): + add_group("out", + suffix=sfx, + opersize=sz, + opcode=[0xEF], + operands=[Operand(type="Dreg", size=16, dest=None), + Operand(type="Areg", size=sz, dest=None)]) +# GAS-only variants (implicit accumulator register) +add_group("out", + suffix="b", + parsers=["gas"], + opcode=[0xE6], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("out", + suffix="w", + parsers=["gas"], + opersize=16, + opcode=[0xE7], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("out", + suffix="l", + cpu=["386"], + parsers=["gas"], + opersize=32, + opcode=[0xE7], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("out", + suffix="b", + parsers=["gas"], + opcode=[0xEE], + operands=[Operand(type="Dreg", size=16, dest=None)]) +add_group("out", + suffix="w", + parsers=["gas"], + opersize=16, + opcode=[0xEF], + operands=[Operand(type="Dreg", size=16, dest=None)]) +add_group("out", + suffix="l", + cpu=["386"], + parsers=["gas"], + opersize=32, + opcode=[0xEF], + operands=[Operand(type="Dreg", size=16, dest=None)]) + +add_insn("out", "out") + +# +# Load effective address +# +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("lea", + suffix=sfx, + opersize=sz, + opcode=[0x8D], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Mem", relaxed=True, dest="EA")]) + +add_insn("lea", "lea") + +# +# Load segment registers from memory +# +for sfx, sz in zip("wl", [16, 32]): + add_group("ldes", + suffix=sfx, + not64=True, + modifiers=["Op0Add"], + opersize=sz, + opcode=[0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Mem", relaxed=True, dest="EA")]) + +add_insn("lds", "ldes", modifiers=[0xC5]) +add_insn("les", "ldes", modifiers=[0xC4]) + +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("lfgss", + suffix=sfx, + cpu=["386"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Mem", relaxed=True, dest="EA")]) + +add_insn("lfs", "lfgss", modifiers=[0xB4]) +add_insn("lgs", "lfgss", modifiers=[0xB5]) +add_insn("lss", "lfgss", modifiers=[0xB2]) + +# +# Flags registers instructions +# +add_insn("clc", "onebyte", modifiers=[0xF8]) +add_insn("cld", "onebyte", modifiers=[0xFC]) +add_insn("cli", "onebyte", modifiers=[0xFA]) +add_insn("clts", "twobyte", modifiers=[0x0F, 0x06], cpu=["286", "Priv"]) +add_insn("cmc", "onebyte", modifiers=[0xF5]) +add_insn("lahf", "onebyte", modifiers=[0x9F]) +add_insn("sahf", "onebyte", modifiers=[0x9E]) +add_insn("pushf", "onebyte", modifiers=[0x9C, 0, 64]) +add_insn("pushfd", "onebyte", parser="nasm", modifiers=[0x9C, 32], + cpu=["386"], not64=True) +add_insn("pushfl", "onebyte", parser="gas", modifiers=[0x9C, 32], + cpu=["386"], not64=True) +add_insn("pushfw", "onebyte", modifiers=[0x9C, 16, 64]) +add_insn("pushfq", "onebyte", modifiers=[0x9C, 64, 64], only64=True) +add_insn("popf", "onebyte", modifiers=[0x9D, 0, 64]) +add_insn("popfd", "onebyte", parser="nasm", modifiers=[0x9D, 32], + cpu=["386"], not64=True) +add_insn("popfl", "onebyte", parser="gas", modifiers=[0x9D, 32], + cpu=["386"], not64=True) +add_insn("popfw", "onebyte", modifiers=[0x9D, 16, 64]) +add_insn("popfq", "onebyte", modifiers=[0x9D, 64, 64], only64=True) +add_insn("stc", "onebyte", modifiers=[0xF9]) +add_insn("std", "onebyte", modifiers=[0xFD]) +add_insn("sti", "onebyte", modifiers=[0xFB]) + +# +# Arithmetic - general +# +add_group("arith", + suffix="b", + modifiers=["Op0Add"], + opcode=[0x04], + operands=[Operand(type="Areg", size=8, dest=None), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +for sfx, sz, immsz in zip("wlq", [16, 32, 64], [16, 32, 32]): + add_group("arith", + suffix=sfx, + modifiers=["Op2Add", "Op1AddSp"], + opersize=sz, + opcode1=[0x83, 0xC0], + opcode2=[0x05], + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="Imm", size=immsz, relaxed=True, dest="Imm", + opt="SImm8")]) + +add_group("arith", + suffix="b", + modifiers=["Gap", "SpAdd"], + opcode=[0x80], + spare=0, + operands=[Operand(type="RM", size=8, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("arith", + suffix="b", + modifiers=["Gap", "SpAdd"], + opcode=[0x80], + spare=0, + operands=[Operand(type="RM", size=8, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, dest="Imm")]) + +add_group("arith", + suffix="w", + modifiers=["Gap", "SpAdd"], + opersize=16, + opcode=[0x83], + spare=0, + operands=[Operand(type="RM", size=16, dest="EA"), + Operand(type="Imm", size=8, dest="SImm")]) +add_group("arith", + parsers=["nasm"], + modifiers=["Gap", "SpAdd"], + opersize=16, + opcode1=[0x83], + opcode2=[0x81], + spare=0, + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA"), + Operand(type="Imm", size=16, dest="Imm", opt="SImm8")]) +add_group("arith", + suffix="w", + modifiers=["Gap", "SpAdd"], + opersize=16, + opcode1=[0x83], + opcode2=[0x81], + spare=0, + operands=[ + Operand(type="RM", size=16, dest="EA"), + Operand(type="Imm", size=16, relaxed=True, dest="Imm", opt="SImm8")]) + +add_group("arith", + suffix="l", + modifiers=["Gap", "SpAdd"], + opersize=32, + opcode=[0x83], + spare=0, + operands=[Operand(type="RM", size=32, dest="EA"), + Operand(type="Imm", size=8, dest="SImm")]) +# Not64 because we can't tell if add [], dword in 64-bit mode is supposed +# to be a qword destination or a dword destination. +add_group("arith", + not64=True, + parsers=["nasm"], + modifiers=["Gap", "SpAdd"], + opersize=32, + opcode1=[0x83], + opcode2=[0x81], + spare=0, + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=32, dest="Imm", opt="SImm8")]) +add_group("arith", + suffix="l", + modifiers=["Gap", "SpAdd"], + opersize=32, + opcode1=[0x83], + opcode2=[0x81], + spare=0, + operands=[ + Operand(type="RM", size=32, dest="EA"), + Operand(type="Imm", size=32, relaxed=True, dest="Imm", opt="SImm8")]) + +# No relaxed-RM mode for 64-bit destinations; see above Not64 comment. +add_group("arith", + suffix="q", + modifiers=["Gap", "SpAdd"], + opersize=64, + opcode=[0x83], + spare=0, + operands=[Operand(type="RM", size=64, dest="EA"), + Operand(type="Imm", size=8, dest="SImm")]) +add_group("arith", + suffix="q", + modifiers=["Gap", "SpAdd"], + opersize=64, + opcode1=[0x83], + opcode2=[0x81], + spare=0, + operands=[ + Operand(type="RM", size=64, dest="EA"), + Operand(type="Imm", size=32, relaxed=True, dest="Imm", opt="SImm8")]) + +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("arith", + suffix=sfx, + modifiers=["Op0Add"], + opersize=sz, + opcode=[0x00+(sz!=8)], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("arith", + suffix=sfx, + modifiers=["Op0Add"], + opersize=sz, + opcode=[0x02+(sz!=8)], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("add", "arith", modifiers=[0x00, 0]) +add_insn("or", "arith", modifiers=[0x08, 1]) +add_insn("adc", "arith", modifiers=[0x10, 2]) +add_insn("sbb", "arith", modifiers=[0x18, 3]) +add_insn("and", "arith", modifiers=[0x20, 4]) +add_insn("sub", "arith", modifiers=[0x28, 5]) +add_insn("xor", "arith", modifiers=[0x30, 6]) +add_insn("cmp", "arith", modifiers=[0x38, 7]) + +# +# Arithmetic - inc/dec +# +add_group("incdec", + suffix="b", + modifiers=["Gap", "SpAdd"], + opcode=[0xFE], + spare=0, + operands=[Operand(type="RM", size=8, dest="EA")]) +for sfx, sz in zip("wl", [16, 32]): + add_group("incdec", + suffix=sfx, + not64=True, + modifiers=["Op0Add"], + opersize=sz, + opcode=[0x00], + operands=[Operand(type="Reg", size=sz, dest="Op0Add")]) + add_group("incdec", + suffix=sfx, + modifiers=["Gap", "SpAdd"], + opersize=sz, + opcode=[0xFF], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA")]) +add_group("incdec", + suffix="q", + modifiers=["Gap", "SpAdd"], + opersize=64, + opcode=[0xFF], + spare=0, + operands=[Operand(type="RM", size=64, dest="EA")]) + +add_insn("inc", "incdec", modifiers=[0x40, 0]) +add_insn("dec", "incdec", modifiers=[0x48, 1]) + +# +# Arithmetic - mul/neg/not F6 opcodes +# +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("f6", + suffix=sfx, + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xF6+(sz!=8)], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA")]) + +add_insn("not", "f6", modifiers=[2]) +add_insn("neg", "f6", modifiers=[3]) +add_insn("mul", "f6", modifiers=[4]) + +# +# Arithmetic - div/idiv F6 opcodes +# These allow explicit accumulator in GAS mode. +# +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("div", + suffix=sfx, + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xF6+(sz!=8)], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA")]) +# Versions with explicit accumulator +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("div", + suffix=sfx, + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xF6+(sz!=8)], + spare=0, + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="RM", size=sz, dest="EA")]) + +add_insn("div", "div", modifiers=[6]) +add_insn("idiv", "div", modifiers=[7]) + +# +# Arithmetic - test instruction +# +for sfx, sz, immsz in zip("bwlq", [8, 16, 32, 64], [8, 16, 32, 32]): + add_group("test", + suffix=sfx, + opersize=sz, + opcode=[0xA8+(sz!=8)], + operands=[Operand(type="Areg", size=sz, dest=None), + Operand(type="Imm", size=immsz, relaxed=True, dest="Imm")]) + +for sfx, sz, immsz in zip("bwlq", [8, 16, 32, 64], [8, 16, 32, 32]): + add_group("test", + suffix=sfx, + opersize=sz, + opcode=[0xF6+(sz!=8)], + operands=[Operand(type="RM", size=sz, dest="EA"), + Operand(type="Imm", size=immsz, relaxed=True, dest="Imm")]) + add_group("test", + suffix=sfx, + opersize=sz, + opcode=[0xF6+(sz!=8)], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=immsz, dest="Imm")]) + +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("test", + suffix=sfx, + opersize=sz, + opcode=[0x84+(sz!=8)], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("test", + suffix=sfx, + opersize=sz, + opcode=[0x84+(sz!=8)], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("test", "test") + +# +# Arithmetic - aad/aam +# +add_group("aadm", + modifiers=["Op0Add"], + opcode=[0xD4, 0x0A], + operands=[]) +add_group("aadm", + modifiers=["Op0Add"], + opcode=[0xD4], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("aaa", "onebyte", modifiers=[0x37], not64=True) +add_insn("aas", "onebyte", modifiers=[0x3F], not64=True) +add_insn("daa", "onebyte", modifiers=[0x27], not64=True) +add_insn("das", "onebyte", modifiers=[0x2F], not64=True) +add_insn("aad", "aadm", modifiers=[0x01], not64=True) +add_insn("aam", "aadm", modifiers=[0x00], not64=True) + +# +# Conversion instructions +# +add_insn("cbw", "onebyte", modifiers=[0x98, 16]) +add_insn("cwde", "onebyte", modifiers=[0x98, 32], cpu=["386"]) +add_insn("cdqe", "onebyte", modifiers=[0x98, 64], only64=True) +add_insn("cwd", "onebyte", modifiers=[0x99, 16]) +add_insn("cdq", "onebyte", modifiers=[0x99, 32], cpu=["386"]) +add_insn("cqo", "onebyte", modifiers=[0x99, 64], only64=True) + +# +# Conversion instructions - GAS / AT&T naming +# +add_insn("cbtw", "onebyte", parser="gas", modifiers=[0x98, 16]) +add_insn("cwtl", "onebyte", parser="gas", modifiers=[0x98, 32], cpu=["386"]) +add_insn("cltq", "onebyte", parser="gas", modifiers=[0x98, 64], only64=True) +add_insn("cwtd", "onebyte", parser="gas", modifiers=[0x99, 16]) +add_insn("cltd", "onebyte", parser="gas", modifiers=[0x99, 32], cpu=["386"]) +add_insn("cqto", "onebyte", parser="gas", modifiers=[0x99, 64], only64=True) + +# +# Arithmetic - imul +# +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("imul", + suffix=sfx, + opersize=sz, + opcode=[0xF6+(sz!=8)], + spare=5, + operands=[Operand(type="RM", size=sz, dest="EA")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("imul", + suffix=sfx, + cpu=["386"], + opersize=sz, + opcode=[0x0F, 0xAF], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("imul", + suffix=sfx, + cpu=["186"], + opersize=sz, + opcode=[0x6B], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, dest="SImm")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("imul", + suffix=sfx, + cpu=["186"], + opersize=sz, + opcode=[0x6B], + operands=[Operand(type="Reg", size=sz, dest="SpareEA"), + Operand(type="Imm", size=8, dest="SImm")]) +for sfx, sz, immsz in zip("wlq", [16, 32, 64], [16, 32, 32]): + add_group("imul", + suffix=sfx, + cpu=["186"], + opersize=sz, + opcode1=[0x6B], + opcode2=[0x69], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=immsz, relaxed=True, dest="SImm", + opt="SImm8")]) +for sfx, sz, immsz in zip("wlq", [16, 32, 64], [16, 32, 32]): + add_group("imul", + suffix=sfx, + cpu=["186"], + opersize=sz, + opcode1=[0x6B], + opcode2=[0x69], + operands=[Operand(type="Reg", size=sz, dest="SpareEA"), + Operand(type="Imm", size=immsz, relaxed=True, dest="SImm", + opt="SImm8")]) + +add_insn("imul", "imul") + +# +# Shifts - standard +# +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("shift", + suffix=sfx, + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xD2+(sz!=8)], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA"), + Operand(type="Creg", size=8, dest=None)]) + add_group("shift", + suffix=sfx, + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xD0+(sz!=8)], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA"), + Operand(type="Imm1", size=8, relaxed=True, dest=None)]) + add_group("shift", + suffix=sfx, + cpu=["186"], + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xC0+(sz!=8)], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +# In GAS mode, single operands are equivalent to shifting by 1 forms +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("shift", + suffix=sfx, + parsers=["gas"], + modifiers=["SpAdd"], + opersize=sz, + opcode=[0xD0+(sz!=8)], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA")]) + +add_insn("rol", "shift", modifiers=[0]) +add_insn("ror", "shift", modifiers=[1]) +add_insn("rcl", "shift", modifiers=[2]) +add_insn("rcr", "shift", modifiers=[3]) +add_insn("sal", "shift", modifiers=[4]) +add_insn("shl", "shift", modifiers=[4]) +add_insn("shr", "shift", modifiers=[5]) +add_insn("sar", "shift", modifiers=[7]) + +# +# Shifts - doubleword +# +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("shlrd", + suffix=sfx, + cpu=["386"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + add_group("shlrd", + suffix=sfx, + cpu=["386"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x01], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Creg", size=8, dest=None)]) +# GAS parser supports two-operand form for shift with CL count +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("shlrd", + suffix=sfx, + cpu=["386"], + parsers=["gas"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x01], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) + +add_insn("shld", "shlrd", modifiers=[0xA4]) +add_insn("shrd", "shlrd", modifiers=[0xAC]) + +##################################################################### +# Control transfer instructions (unconditional) +##################################################################### +# +# call +# +add_group("call", + opcode=[], + operands=[Operand(type="ImmNotSegOff", dest="JmpRel")]) +add_group("call", + suffix="w", + opersize=16, + opcode=[], + operands=[Operand(type="ImmNotSegOff", size=16, dest="JmpRel")]) +add_group("call", + suffix="l", + not64=True, + opersize=32, + opcode=[], + operands=[Operand(type="ImmNotSegOff", size=32, dest="JmpRel")]) +add_group("call", + suffixes=["l", "q"], + only64=True, + opersize=64, + opcode=[], + operands=[Operand(type="ImmNotSegOff", size=32, dest="JmpRel")]) + +add_group("call", + opersize=16, + not64=True, #there should not be 16bit call in 64bit mode + opcode=[0xE8], + operands=[Operand(type="Imm", size=16, tmod="Near", dest="JmpRel")]) +add_group("call", + not64=True, + opersize=32, + opcode=[0xE8], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) +add_group("call", + only64=True, + opersize=64, + def_opersize_64=64, + opcode=[0xE8], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) +add_group("call", + def_opersize_64=64, + opcode=[0xE8], + operands=[Operand(type="Imm", tmod="Near", dest="JmpRel")]) + +add_group("call", + suffix="w", + req_suffix=True, + opersize=16, + opcode=[0xFF], + spare=2, + operands=[Operand(type="RM", size=16, dest="EA")]) +add_group("call", + suffix="l", + req_suffix=True, + not64=True, + opersize=32, + opcode=[0xFF], + spare=2, + operands=[Operand(type="RM", size=32, dest="EA")]) +add_group("call", + suffix="q", + req_suffix=True, + opersize=64, + def_opersize_64=64, + opcode=[0xFF], + spare=2, + operands=[Operand(type="RM", size=64, dest="EA")]) +add_group("call", + parsers=["gas"], + def_opersize_64=64, + opcode=[0xFF], + spare=2, + operands=[Operand(type="Reg", size="BITS", dest="EA")]) +add_group("call", + def_opersize_64=64, + opcode=[0xFF], + spare=2, + operands=[Operand(type="Mem", dest="EA")]) +add_group("call", + parsers=["nasm"], + opersize=16, + def_opersize_64=64, + opcode=[0xFF], + spare=2, + operands=[Operand(type="RM", size=16, tmod="Near", dest="EA")]) +add_group("call", + parsers=["nasm"], + not64=True, + opersize=32, + opcode=[0xFF], + spare=2, + operands=[Operand(type="RM", size=32, tmod="Near", dest="EA")]) +add_group("call", + parsers=["nasm"], + opersize=64, + def_opersize_64=64, + opcode=[0xFF], + spare=2, + operands=[Operand(type="RM", size=64, tmod="Near", dest="EA")]) +add_group("call", + parsers=["nasm"], + def_opersize_64=64, + opcode=[0xFF], + spare=2, + operands=[Operand(type="Mem", tmod="Near", dest="EA")]) + +# Far indirect (through memory). Needs explicit FAR override (NASM only) +for sz in [16, 32, 64]: + add_group("call", + parsers=["nasm"], + opersize=sz, + opcode=[0xFF], + spare=3, + operands=[Operand(type="Mem", size=sz, tmod="Far", dest="EA")]) +add_group("call", + parsers=["nasm"], + opcode=[0xFF], + spare=3, + operands=[Operand(type="Mem", tmod="Far", dest="EA")]) + +# With explicit FAR override +for sz in [16, 32]: + add_group("call", + parsers=["nasm"], + not64=True, + opersize=sz, + opcode=[0x9A], + operands=[Operand(type="Imm", size=sz, tmod="Far", dest="JmpFar")]) +add_group("call", + parsers=["nasm"], + not64=True, + opcode=[0x9A], + operands=[Operand(type="Imm", tmod="Far", dest="JmpFar")]) + +# Since not caught by first ImmNotSegOff group, implicitly FAR (in NASM). +for sz in [16, 32]: + add_group("call", + parsers=["nasm"], + not64=True, + opersize=sz, + opcode=[0x9A], + operands=[Operand(type="Imm", size=sz, dest="JmpFar")]) +add_group("call", + parsers=["nasm"], + not64=True, + opcode=[0x9A], + operands=[Operand(type="Imm", dest="JmpFar")]) + +# Two-operand FAR (GAS only) +for sfx, sz in zip("wl", [16, 32]): + add_group("call", + suffix=sfx, + req_suffix=True, + parsers=["gas"], + not64=True, + gas_no_reverse=True, + opersize=sz, + opcode=[0x9A], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="JmpFar"), + Operand(type="Imm", size=sz, relaxed=True, dest="JmpFar")]) +add_group("call", + parsers=["gas"], + not64=True, + gas_no_reverse=True, + opcode=[0x9A], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="JmpFar"), + Operand(type="Imm", size="BITS", relaxed=True, dest="JmpFar")]) + +add_insn("call", "call") + +# +# jmp +# +add_group("jmp", + opcode=[], + operands=[Operand(type="ImmNotSegOff", dest="JmpRel")]) +add_group("jmp", + suffix="w", + opersize=16, + opcode=[], + operands=[Operand(type="ImmNotSegOff", size=16, dest="JmpRel")]) +add_group("jmp", + suffix="l", + not64=True, + opersize=32, + opcode=[0x00], + operands=[Operand(type="ImmNotSegOff", size=32, dest="JmpRel")]) +add_group("jmp", + suffixes=["l", "q"], + only64=True, + opersize=64, + opcode=[0x00], + operands=[Operand(type="ImmNotSegOff", size=32, dest="JmpRel")]) + +add_group("jmp", + def_opersize_64=64, + opcode=[0xEB], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel")]) +add_group("jmp", + opersize=16, + def_opersize_64=64, + opcode=[0xE9], + operands=[Operand(type="Imm", size=16, tmod="Near", dest="JmpRel")]) +add_group("jmp", + not64=True, + cpu=["386"], + opersize=32, + opcode=[0xE9], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) +add_group("jmp", + only64=True, + opersize=64, + def_opersize_64=64, + opcode=[0xE9], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) +add_group("jmp", + def_opersize_64=64, + opcode=[0xE9], + operands=[Operand(type="Imm", tmod="Near", dest="JmpRel")]) + +add_group("jmp", + suffix="w", + req_suffix=True, + opersize=16, + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="RM", size=16, dest="EA")]) +add_group("jmp", + suffix="l", + req_suffix=True, + not64=True, + opersize=32, + opcode=[0xFF], + spare=4, + operands=[Operand(type="RM", size=32, dest="EA")]) +add_group("jmp", + suffix="q", + req_suffix=True, + opersize=64, + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="RM", size=64, dest="EA")]) +add_group("jmp", + parsers=["gas"], + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="Reg", size="BITS", dest="EA")]) +add_group("jmp", + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="Mem", dest="EA")]) +add_group("jmp", + parsers=["nasm"], + opersize=16, + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="RM", size=16, tmod="Near", dest="EA")]) +add_group("jmp", + parsers=["nasm"], + not64=True, + cpu=["386"], + opersize=32, + opcode=[0xFF], + spare=4, + operands=[Operand(type="RM", size=32, tmod="Near", dest="EA")]) +add_group("jmp", + parsers=["nasm"], + opersize=64, + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="RM", size=64, tmod="Near", dest="EA")]) +add_group("jmp", + parsers=["nasm"], + def_opersize_64=64, + opcode=[0xFF], + spare=4, + operands=[Operand(type="Mem", tmod="Near", dest="EA")]) + +# Far indirect (through memory). Needs explicit FAR override. +for sz in [16, 32, 64]: + add_group("jmp", + opersize=sz, + opcode=[0xFF], + spare=5, + operands=[Operand(type="Mem", size=sz, tmod="Far", dest="EA")]) +add_group("jmp", + opcode=[0xFF], + spare=5, + operands=[Operand(type="Mem", tmod="Far", dest="EA")]) + +# With explicit FAR override +for sz in [16, 32]: + add_group("jmp", + not64=True, + opersize=sz, + opcode=[0xEA], + operands=[Operand(type="Imm", size=sz, tmod="Far", dest="JmpFar")]) +add_group("jmp", + not64=True, + opcode=[0xEA], + operands=[Operand(type="Imm", tmod="Far", dest="JmpFar")]) + +# Since not caught by first ImmNotSegOff group, implicitly FAR (in NASM). +for sz in [16, 32]: + add_group("jmp", + parsers=["nasm"], + not64=True, + opersize=sz, + opcode=[0xEA], + operands=[Operand(type="Imm", size=sz, dest="JmpFar")]) +add_group("jmp", + parsers=["nasm"], + not64=True, + opcode=[0xEA], + operands=[Operand(type="Imm", dest="JmpFar")]) + +# Two-operand FAR (GAS only) +for sfx, sz in zip("wl", [16, 32]): + add_group("jmp", + parsers=["gas"], + suffix=sfx, + req_suffix=True, + not64=True, + gas_no_reverse=True, + opersize=sz, + opcode=[0xEA], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="JmpFar"), + Operand(type="Imm", size=sz, relaxed=True, dest="JmpFar")]) +add_group("jmp", + parsers=["gas"], + not64=True, + gas_no_reverse=True, + opcode=[0xEA], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="JmpFar"), + Operand(type="Imm", size="BITS", relaxed=True, dest="JmpFar")]) + +add_insn("jmp", "jmp") + +# +# GAS far calls/jumps +# + +# Far indirect (through memory) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("ljmpcall", + suffix=sfx, + req_suffix=True, + opersize=sz, + modifiers=["SpAdd"], + opcode=[0xFF], + spare=0, + operands=[Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) +add_group("ljmpcall", + modifiers=["SpAdd"], + opcode=[0xFF], + spare=0, + operands=[Operand(type="Mem", size="BITS", relaxed=True, dest="EA")]) + +# Two-operand far +for sfx, sz in zip("wl", [16, 32]): + add_group("ljmpcall", + not64=True, + gas_no_reverse=True, + suffix=sfx, + req_suffix=True, + opersize=sz, + modifiers=["Gap", "Op0Add"], + opcode=[0x00], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="JmpFar"), + Operand(type="Imm", size=sz, relaxed=True, dest="JmpFar")]) +add_group("ljmpcall", + not64=True, + gas_no_reverse=True, + modifiers=["Gap", "Op0Add"], + opcode=[0x00], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="JmpFar"), + Operand(type="Imm", size="BITS", relaxed=True, dest="JmpFar")]) + +add_insn("ljmp", "ljmpcall", parser="gas", modifiers=[5, 0xEA]) +add_insn("lcall", "ljmpcall", parser="gas", modifiers=[3, 0x9A]) + +# +# ret +# +add_group("retnf", + not64=True, + modifiers=["Op0Add"], + opcode=[0x01], + operands=[]) +add_group("retnf", + not64=True, + modifiers=["Op0Add"], + opcode=[0x00], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="Imm")]) +add_group("retnf", + only64=True, + modifiers=["Op0Add", "OpSizeR"], + opcode=[0x01], + operands=[]) +add_group("retnf", + only64=True, + modifiers=["Op0Add", "OpSizeR"], + opcode=[0x00], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="Imm")]) +add_group("retnf", + gen_suffix=False, + suffixes=["w", "l", "q"], + modifiers=["Op0Add", "OpSizeR"], + opcode=[0x01], + operands=[]) +# GAS suffix versions +add_group("retnf", + gen_suffix=False, + suffixes=["w", "l", "q"], + modifiers=["Op0Add", "OpSizeR"], + opcode=[0x00], + operands=[Operand(type="Imm", size=16, relaxed=True, dest="Imm")]) + +add_insn("ret", "retnf", modifiers=[0xC2]) +add_insn("retw", "retnf", parser="gas", modifiers=[0xC2, 16]) +add_insn("retl", "retnf", parser="gas", modifiers=[0xC2], not64=True) +add_insn("retq", "retnf", parser="gas", modifiers=[0xC2], only64=True) +add_insn("retn", "retnf", parser="nasm", modifiers=[0xC2]) +add_insn("retf", "retnf", parser="nasm", modifiers=[0xCA, 64]) +add_insn("lret", "retnf", parser="gas", modifiers=[0xCA], suffix="z") +add_insn("lretw", "retnf", parser="gas", modifiers=[0xCA, 16], suffix="w") +add_insn("lretl", "retnf", parser="gas", modifiers=[0xCA], suffix="l") +add_insn("lretq", "retnf", parser="gas", modifiers=[0xCA, 64], only64=True, + suffix="q") + +# +# enter +# +add_group("enter", + suffix="l", + not64=True, + cpu=["186"], + gas_no_reverse=True, + opcode=[0xC8], + operands=[ + Operand(type="Imm", size=16, relaxed=True, dest="EA", opt="A16"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("enter", + suffix="q", + only64=True, + cpu=["186"], + gas_no_reverse=True, + opersize=64, + def_opersize_64=64, + opcode=[0xC8], + operands=[ + Operand(type="Imm", size=16, relaxed=True, dest="EA", opt="A16"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +# GAS suffix version +add_group("enter", + suffix="w", + cpu=["186"], + parsers=["gas"], + gas_no_reverse=True, + opersize=16, + opcode=[0xC8], + operands=[ + Operand(type="Imm", size=16, relaxed=True, dest="EA", opt="A16"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("enter", "enter") + +# +# leave +# +add_insn("leave", "onebyte", modifiers=[0xC9, 0, 64], cpu=["186"]) +add_insn("leavew", "onebyte", parser="gas", modifiers=[0xC9, 16, 0], + cpu=["186"]) +add_insn("leavel", "onebyte", parser="gas", modifiers=[0xC9, 0, 64], + cpu=["186"]) +add_insn("leaveq", "onebyte", parser="gas", modifiers=[0xC9, 0, 64], + only64=True) + +##################################################################### +# Conditional jumps +##################################################################### +add_group("jcc", + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel")]) +add_group("jcc", + opersize=16, + opcode=[], + operands=[Operand(type="Imm", size=16, dest="JmpRel")]) +add_group("jcc", + not64=True, + opersize=32, + opcode=[], + operands=[Operand(type="Imm", size=32, dest="JmpRel")]) +add_group("jcc", + only64=True, + opersize=64, + opcode=[], + operands=[Operand(type="Imm", size=32, dest="JmpRel")]) + +add_group("jcc", + modifiers=["Op0Add"], + def_opersize_64=64, + opcode=[0x70], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel")]) +add_group("jcc", + cpu=["186"], + modifiers=["Op1Add"], + opersize=16, + def_opersize_64=64, + opcode=[0x0F, 0x80], + operands=[Operand(type="Imm", size=16, tmod="Near", dest="JmpRel")]) +add_group("jcc", + not64=True, + cpu=["386"], + modifiers=["Op1Add"], + opersize=32, + opcode=[0x0F, 0x80], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) +add_group("jcc", + only64=True, + modifiers=["Op1Add"], + opersize=64, + def_opersize_64=64, + opcode=[0x0F, 0x80], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) +add_group("jcc", + cpu=["186"], + modifiers=["Op1Add"], + def_opersize_64=64, + opcode=[0x0F, 0x80], + operands=[Operand(type="Imm", tmod="Near", dest="JmpRel")]) + +add_insn("jo", "jcc", modifiers=[0x00]) +add_insn("jno", "jcc", modifiers=[0x01]) +add_insn("jb", "jcc", modifiers=[0x02]) +add_insn("jc", "jcc", modifiers=[0x02]) +add_insn("jnae", "jcc", modifiers=[0x02]) +add_insn("jnb", "jcc", modifiers=[0x03]) +add_insn("jnc", "jcc", modifiers=[0x03]) +add_insn("jae", "jcc", modifiers=[0x03]) +add_insn("je", "jcc", modifiers=[0x04]) +add_insn("jz", "jcc", modifiers=[0x04]) +add_insn("jne", "jcc", modifiers=[0x05]) +add_insn("jnz", "jcc", modifiers=[0x05]) +add_insn("jbe", "jcc", modifiers=[0x06]) +add_insn("jna", "jcc", modifiers=[0x06]) +add_insn("jnbe", "jcc", modifiers=[0x07]) +add_insn("ja", "jcc", modifiers=[0x07]) +add_insn("js", "jcc", modifiers=[0x08]) +add_insn("jns", "jcc", modifiers=[0x09]) +add_insn("jp", "jcc", modifiers=[0x0A]) +add_insn("jpe", "jcc", modifiers=[0x0A]) +add_insn("jnp", "jcc", modifiers=[0x0B]) +add_insn("jpo", "jcc", modifiers=[0x0B]) +add_insn("jl", "jcc", modifiers=[0x0C]) +add_insn("jnge", "jcc", modifiers=[0x0C]) +add_insn("jnl", "jcc", modifiers=[0x0D]) +add_insn("jge", "jcc", modifiers=[0x0D]) +add_insn("jle", "jcc", modifiers=[0x0E]) +add_insn("jng", "jcc", modifiers=[0x0E]) +add_insn("jnle", "jcc", modifiers=[0x0F]) +add_insn("jg", "jcc", modifiers=[0x0F]) + +# +# jcxz +# +add_group("jcxz", + modifiers=["AdSizeR"], + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel")]) +add_group("jcxz", + modifiers=["AdSizeR"], + def_opersize_64=64, + opcode=[0xE3], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel")]) + +add_insn("jcxz", "jcxz", modifiers=[16]) +add_insn("jecxz", "jcxz", modifiers=[32], cpu=["386"]) +add_insn("jrcxz", "jcxz", modifiers=[64], only64=True) + +##################################################################### +# Loop instructions +##################################################################### +add_group("loop", + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel")]) +add_group("loop", + not64=True, + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel"), + Operand(type="Creg", size=16, dest="AdSizeR")]) +add_group("loop", + def_opersize_64=64, + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel"), + Operand(type="Creg", size=32, dest="AdSizeR")]) +add_group("loop", + def_opersize_64=64, + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel"), + Operand(type="Creg", size=64, dest="AdSizeR")]) + +add_group("loop", + not64=True, + modifiers=["Op0Add"], + opcode=[0xE0], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel")]) +for sz in [16, 32, 64]: + add_group("loop", + modifiers=["Op0Add"], + def_opersize_64=64, + opcode=[0xE0], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel"), + Operand(type="Creg", size=sz, dest="AdSizeR")]) + +add_insn("loop", "loop", modifiers=[2]) +add_insn("loopz", "loop", modifiers=[1]) +add_insn("loope", "loop", modifiers=[1]) +add_insn("loopnz", "loop", modifiers=[0]) +add_insn("loopne", "loop", modifiers=[0]) + +# GAS w/l/q suffixes have to set addrsize via modifiers +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("loop"+sfx, + not64=(sz == 16), + only64=(sz == 64), + modifiers=["Gap", "AdSizeR"], + def_opersize_64=64, + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel")]) + add_group("loop"+sfx, + not64=(sz == 16), + only64=(sz == 64), + modifiers=["Op0Add", "AdSizeR"], + def_opersize_64=64, + opcode=[0xE0], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel")]) + + add_group("loop"+sfx, + not64=(sz == 16), + only64=(sz == 64), + def_opersize_64=64, + opcode=[], + operands=[Operand(type="Imm", dest="JmpRel"), + Operand(type="Creg", size=sz, dest="AdSizeR")]) + add_group("loop"+sfx, + not64=(sz == 16), + only64=(sz == 64), + modifiers=["Op0Add"], + def_opersize_64=64, + opcode=[0xE0], + operands=[Operand(type="Imm", tmod="Short", dest="JmpRel"), + Operand(type="Creg", size=sz, dest="AdSizeR")]) + + add_insn("loop"+sfx, "loop"+sfx, parser="gas", modifiers=[2, sz]) + add_insn("loopz"+sfx, "loop"+sfx, parser="gas", modifiers=[1, sz]) + add_insn("loope"+sfx, "loop"+sfx, parser="gas", modifiers=[1, sz]) + add_insn("loopnz"+sfx, "loop"+sfx, parser="gas", modifiers=[0, sz]) + add_insn("loopne"+sfx, "loop"+sfx, parser="gas", modifiers=[0, sz]) + +##################################################################### +# Set byte on flag instructions +##################################################################### +add_group("setcc", + suffix="b", + cpu=["386"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x90], + spare=2, + operands=[Operand(type="RM", size=8, relaxed=True, dest="EA")]) + +add_insn("seto", "setcc", modifiers=[0x00]) +add_insn("setno", "setcc", modifiers=[0x01]) +add_insn("setb", "setcc", modifiers=[0x02]) +add_insn("setc", "setcc", modifiers=[0x02]) +add_insn("setnae", "setcc", modifiers=[0x02]) +add_insn("setnb", "setcc", modifiers=[0x03]) +add_insn("setnc", "setcc", modifiers=[0x03]) +add_insn("setae", "setcc", modifiers=[0x03]) +add_insn("sete", "setcc", modifiers=[0x04]) +add_insn("setz", "setcc", modifiers=[0x04]) +add_insn("setne", "setcc", modifiers=[0x05]) +add_insn("setnz", "setcc", modifiers=[0x05]) +add_insn("setbe", "setcc", modifiers=[0x06]) +add_insn("setna", "setcc", modifiers=[0x06]) +add_insn("setnbe", "setcc", modifiers=[0x07]) +add_insn("seta", "setcc", modifiers=[0x07]) +add_insn("sets", "setcc", modifiers=[0x08]) +add_insn("setns", "setcc", modifiers=[0x09]) +add_insn("setp", "setcc", modifiers=[0x0A]) +add_insn("setpe", "setcc", modifiers=[0x0A]) +add_insn("setnp", "setcc", modifiers=[0x0B]) +add_insn("setpo", "setcc", modifiers=[0x0B]) +add_insn("setl", "setcc", modifiers=[0x0C]) +add_insn("setnge", "setcc", modifiers=[0x0C]) +add_insn("setnl", "setcc", modifiers=[0x0D]) +add_insn("setge", "setcc", modifiers=[0x0D]) +add_insn("setle", "setcc", modifiers=[0x0E]) +add_insn("setng", "setcc", modifiers=[0x0E]) +add_insn("setnle", "setcc", modifiers=[0x0F]) +add_insn("setg", "setcc", modifiers=[0x0F]) + +##################################################################### +# String instructions +##################################################################### +add_insn("cmpsb", "onebyte", modifiers=[0xA6, 0]) +add_insn("cmpsw", "onebyte", modifiers=[0xA7, 16]) + +# cmpsd has to be non-onebyte for SSE2 forms below +add_group("cmpsd", + parsers=["nasm"], + notavx=True, + opersize=32, + opcode=[0xA7], + operands=[]) + +add_insn("cmpsd", "cmpsd", cpu=[]) + +add_insn("cmpsl", "onebyte", parser="gas", modifiers=[0xA7, 32], cpu=["386"]) +add_insn("cmpsq", "onebyte", modifiers=[0xA7, 64], only64=True) +add_insn("insb", "onebyte", modifiers=[0x6C, 0]) +add_insn("insw", "onebyte", modifiers=[0x6D, 16]) +add_insn("insd", "onebyte", parser="nasm", modifiers=[0x6D, 32], cpu=["386"]) +add_insn("insl", "onebyte", parser="gas", modifiers=[0x6D, 32], cpu=["386"]) +add_insn("outsb", "onebyte", modifiers=[0x6E, 0]) +add_insn("outsw", "onebyte", modifiers=[0x6F, 16]) +add_insn("outsd", "onebyte", parser="nasm", modifiers=[0x6F, 32], + cpu=["386"]) +add_insn("outsl", "onebyte", parser="gas", modifiers=[0x6F, 32], cpu=["386"]) +add_insn("lodsb", "onebyte", modifiers=[0xAC, 0]) +add_insn("lodsw", "onebyte", modifiers=[0xAD, 16]) +add_insn("lodsd", "onebyte", parser="nasm", modifiers=[0xAD, 32], + cpu=["386"]) +add_insn("lodsl", "onebyte", parser="gas", modifiers=[0xAD, 32], cpu=["386"]) +add_insn("lodsq", "onebyte", modifiers=[0xAD, 64], only64=True) +add_insn("movsb", "onebyte", modifiers=[0xA4, 0]) +add_insn("movsw", "onebyte", modifiers=[0xA5, 16]) + +# movsd has to be non-onebyte for SSE2 forms below +add_group("movsd", + parsers=["nasm", "gas"], + notavx=True, + opersize=32, + opcode=[0xA5], + operands=[]) + +add_insn("movsd", "movsd", cpu=["386"]) + +add_insn("movsl", "onebyte", parser="gas", modifiers=[0xA5, 32], cpu=["386"]) +add_insn("movsq", "onebyte", modifiers=[0xA5, 64], only64=True) +# smov alias for movs in GAS mode +add_insn("smovb", "onebyte", parser="gas", modifiers=[0xA4, 0]) +add_insn("smovw", "onebyte", parser="gas", modifiers=[0xA5, 16]) +add_insn("smovl", "onebyte", parser="gas", modifiers=[0xA5, 32], cpu=["386"]) +add_insn("smovq", "onebyte", parser="gas", modifiers=[0xA5, 64], only64=True) +add_insn("scasb", "onebyte", modifiers=[0xAE, 0]) +add_insn("scasw", "onebyte", modifiers=[0xAF, 16]) +add_insn("scasd", "onebyte", parser="nasm", modifiers=[0xAF, 32], + cpu=["386"]) +add_insn("scasl", "onebyte", parser="gas", modifiers=[0xAF, 32], cpu=["386"]) +add_insn("scasq", "onebyte", modifiers=[0xAF, 64], only64=True) +# ssca alias for scas in GAS mode +add_insn("sscab", "onebyte", parser="gas", modifiers=[0xAE, 0]) +add_insn("sscaw", "onebyte", parser="gas", modifiers=[0xAF, 16]) +add_insn("sscal", "onebyte", parser="gas", modifiers=[0xAF, 32], cpu=["386"]) +add_insn("sscaq", "onebyte", parser="gas", modifiers=[0xAF, 64], only64=True) +add_insn("stosb", "onebyte", modifiers=[0xAA, 0]) +add_insn("stosw", "onebyte", modifiers=[0xAB, 16]) +add_insn("stosd", "onebyte", parser="nasm", modifiers=[0xAB, 32], + cpu=["386"]) +add_insn("stosl", "onebyte", parser="gas", modifiers=[0xAB, 32], cpu=["386"]) +add_insn("stosq", "onebyte", modifiers=[0xAB, 64], only64=True) +add_insn("xlatb", "onebyte", modifiers=[0xD7, 0]) + +##################################################################### +# Bit manipulation +##################################################################### + +# +# bit tests +# +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("bittest", + suffix=sfx, + cpu=["386"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("bittest", + suffix=sfx, + cpu=["386"], + modifiers=["Gap", "SpAdd"], + opersize=sz, + opcode=[0x0F, 0xBA], + spare=0, + operands=[Operand(type="RM", size=sz, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("bt", "bittest", modifiers=[0xA3, 4]) +add_insn("bts", "bittest", modifiers=[0xAB, 5]) +add_insn("btr", "bittest", modifiers=[0xB3, 6]) +add_insn("btc", "bittest", modifiers=[0xBB, 7]) + +# +# bit scans - also used for lar/lsl +# +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("bsfr", + suffix=sfx, + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("bsf", "bsfr", modifiers=[0xBC], cpu=["386"]) +add_insn("bsr", "bsfr", modifiers=[0xBD], cpu=["386"]) + +##################################################################### +# Interrupts and operating system instructions +##################################################################### +add_group("int", + opcode=[0xCD], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("int", "int") +add_insn("int3", "onebyte", modifiers=[0xCC]) +add_insn("int03", "onebyte", parser="nasm", modifiers=[0xCC]) +add_insn("into", "onebyte", modifiers=[0xCE], not64=True) +add_insn("iret", "onebyte", modifiers=[0xCF]) +add_insn("iretw", "onebyte", modifiers=[0xCF, 16]) +add_insn("iretd", "onebyte", parser="nasm", modifiers=[0xCF, 32], + cpu=["386"]) +add_insn("iretl", "onebyte", parser="gas", modifiers=[0xCF, 32], cpu=["386"]) +add_insn("iretq", "onebyte", modifiers=[0xCF, 64], only64=True) +add_insn("rsm", "twobyte", modifiers=[0x0F, 0xAA], cpu=["586", "SMM"]) + +for sfx, sz in zip("wl", [16, 32]): + add_group("bound", + suffix=sfx, + cpu=["186"], + not64=True, + opersize=sz, + opcode=[0x62], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) + +add_insn("bound", "bound") +add_insn("hlt", "onebyte", modifiers=[0xF4], cpu=["Priv"]) +add_insn("nop", "onebyte", modifiers=[0x90]) + +# +# Protection control +# +for sfx, sz, sz2 in zip("wlq", [16, 32, 64], [16, 32, 32]): + add_group("larlsl", + suffix=sfx, + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Reg", size=sz2, dest="EA")]) + add_group("larlsl", + suffix=sfx, + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=16, relaxed=True, dest="EA")]) + +add_insn("lar", "larlsl", modifiers=[0x02], cpu=["286", "Prot"]) +add_insn("lsl", "larlsl", modifiers=[0x03], cpu=["286", "Prot"]) + +add_group("arpl", + suffix="w", + cpu=["Prot", "286"], + not64=True, + opcode=[0x63], + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA"), + Operand(type="Reg", size=16, dest="Spare")]) + +add_insn("arpl", "arpl") + +for sfx in [None, "w", "l", "q"]: + add_insn("lgdt"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[2, 0x0F, 0x01], cpu=["286", "Priv"]) + add_insn("lidt"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[3, 0x0F, 0x01], cpu=["286", "Priv"]) + add_insn("sgdt"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[0, 0x0F, 0x01], cpu=["286", "Priv"]) + add_insn("sidt"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[1, 0x0F, 0x01], cpu=["286", "Priv"]) + +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("str", + suffix=sfx, + cpu=["Prot", "286"], + opersize=sz, + opcode=[0x0F, 0x00], + spare=1, + operands=[Operand(type="Reg", size=sz, dest="EA")]) +add_group("str", + suffixes=["w", "l"], + cpu=["Prot", "286"], + opcode=[0x0F, 0x00], + spare=1, + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA")]) + +add_insn("str", "str") + +add_group("prot286", + suffix="w", + cpu=["286"], + modifiers=["SpAdd", "Op1Add"], + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA")]) + +add_insn("lldt", "prot286", modifiers=[2, 0], cpu=["286", "Prot", "Priv"]) +add_insn("ltr", "prot286", modifiers=[3, 0], cpu=["286", "Prot", "Priv"]) +add_insn("verr", "prot286", modifiers=[4, 0], cpu=["286", "Prot"]) +add_insn("verw", "prot286", modifiers=[5, 0], cpu=["286", "Prot"]) +add_insn("lmsw", "prot286", modifiers=[6, 1], cpu=["286", "Priv"]) + +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("sldtmsw", + suffix=sfx, + only64=(sz==64), + cpu=[(sz==32) and "386" or "286"], + modifiers=["SpAdd", "Op1Add"], + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("sldtmsw", + suffix=sfx, + cpu=["286"], + modifiers=["SpAdd", "Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="Reg", size=sz, dest="EA")]) + +add_insn("sldt", "sldtmsw", modifiers=[0, 0]) +add_insn("smsw", "sldtmsw", modifiers=[4, 1]) + +##################################################################### +# Floating point instructions +##################################################################### +add_insn("fcompp", "twobyte", modifiers=[0xDE, 0xD9], cpu=["FPU"]) +add_insn("fucompp", "twobyte", modifiers=[0xDA, 0xE9], cpu=["286", "FPU"]) +add_insn("ftst", "twobyte", modifiers=[0xD9, 0xE4], cpu=["FPU"]) +add_insn("fxam", "twobyte", modifiers=[0xD9, 0xE5], cpu=["FPU"]) +add_insn("fld1", "twobyte", modifiers=[0xD9, 0xE8], cpu=["FPU"]) +add_insn("fldl2t", "twobyte", modifiers=[0xD9, 0xE9], cpu=["FPU"]) +add_insn("fldl2e", "twobyte", modifiers=[0xD9, 0xEA], cpu=["FPU"]) +add_insn("fldpi", "twobyte", modifiers=[0xD9, 0xEB], cpu=["FPU"]) +add_insn("fldlg2", "twobyte", modifiers=[0xD9, 0xEC], cpu=["FPU"]) +add_insn("fldln2", "twobyte", modifiers=[0xD9, 0xED], cpu=["FPU"]) +add_insn("fldz", "twobyte", modifiers=[0xD9, 0xEE], cpu=["FPU"]) +add_insn("f2xm1", "twobyte", modifiers=[0xD9, 0xF0], cpu=["FPU"]) +add_insn("fyl2x", "twobyte", modifiers=[0xD9, 0xF1], cpu=["FPU"]) +add_insn("fptan", "twobyte", modifiers=[0xD9, 0xF2], cpu=["FPU"]) +add_insn("fpatan", "twobyte", modifiers=[0xD9, 0xF3], cpu=["FPU"]) +add_insn("fxtract", "twobyte", modifiers=[0xD9, 0xF4], cpu=["FPU"]) +add_insn("fprem1", "twobyte", modifiers=[0xD9, 0xF5], cpu=["286", "FPU"]) +add_insn("fdecstp", "twobyte", modifiers=[0xD9, 0xF6], cpu=["FPU"]) +add_insn("fincstp", "twobyte", modifiers=[0xD9, 0xF7], cpu=["FPU"]) +add_insn("fprem", "twobyte", modifiers=[0xD9, 0xF8], cpu=["FPU"]) +add_insn("fyl2xp1", "twobyte", modifiers=[0xD9, 0xF9], cpu=["FPU"]) +add_insn("fsqrt", "twobyte", modifiers=[0xD9, 0xFA], cpu=["FPU"]) +add_insn("fsincos", "twobyte", modifiers=[0xD9, 0xFB], cpu=["286", "FPU"]) +add_insn("frndint", "twobyte", modifiers=[0xD9, 0xFC], cpu=["FPU"]) +add_insn("fscale", "twobyte", modifiers=[0xD9, 0xFD], cpu=["FPU"]) +add_insn("fsin", "twobyte", modifiers=[0xD9, 0xFE], cpu=["286", "FPU"]) +add_insn("fcos", "twobyte", modifiers=[0xD9, 0xFF], cpu=["286", "FPU"]) +add_insn("fchs", "twobyte", modifiers=[0xD9, 0xE0], cpu=["FPU"]) +add_insn("fabs", "twobyte", modifiers=[0xD9, 0xE1], cpu=["FPU"]) +add_insn("fninit", "twobyte", modifiers=[0xDB, 0xE3], cpu=["FPU"]) +add_insn("finit", "threebyte", modifiers=[0x9B, 0xDB, 0xE3], cpu=["FPU"]) +add_insn("fnclex", "twobyte", modifiers=[0xDB, 0xE2], cpu=["FPU"]) +add_insn("fclex", "threebyte", modifiers=[0x9B, 0xDB, 0xE2], cpu=["FPU"]) +for sfx in [None, "l", "s"]: + add_insn("fnstenv"+(sfx or ""), "onebytemem", suffix=sfx, + modifiers=[6, 0xD9], cpu=["FPU"]) + add_insn("fstenv"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[6, 0x9B, 0xD9], cpu=["FPU"]) + add_insn("fldenv"+(sfx or ""), "onebytemem", suffix=sfx, + modifiers=[4, 0xD9], cpu=["FPU"]) + add_insn("fnsave"+(sfx or ""), "onebytemem", suffix=sfx, + modifiers=[6, 0xDD], cpu=["FPU"]) + add_insn("fsave"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[6, 0x9B, 0xDD], cpu=["FPU"]) + add_insn("frstor"+(sfx or ""), "onebytemem", suffix=sfx, + modifiers=[4, 0xDD], cpu=["FPU"]) +add_insn("fnop", "twobyte", modifiers=[0xD9, 0xD0], cpu=["FPU"]) +add_insn("fwait", "onebyte", modifiers=[0x9B], cpu=["FPU"]) +# Prefixes; should the others be here too? should wait be a prefix? +add_insn("wait", "onebyte", modifiers=[0x9B]) + +# +# load/store with pop (integer and normal) +# +add_group("fld", + suffix="s", + cpu=["FPU"], + opcode=[0xD9], + operands=[Operand(type="Mem", size=32, dest="EA")]) +add_group("fld", + suffix="l", + cpu=["FPU"], + opcode=[0xDD], + operands=[Operand(type="Mem", size=64, dest="EA")]) +add_group("fld", + cpu=["FPU"], + opcode=[0xDB], + spare=5, + operands=[Operand(type="Mem", size=80, dest="EA")]) +add_group("fld", + cpu=["FPU"], + opcode=[0xD9, 0xC0], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("fld", "fld") + +add_group("fstp", + suffix="s", + cpu=["FPU"], + opcode=[0xD9], + spare=3, + operands=[Operand(type="Mem", size=32, dest="EA")]) +add_group("fstp", + suffix="l", + cpu=["FPU"], + opcode=[0xDD], + spare=3, + operands=[Operand(type="Mem", size=64, dest="EA")]) +add_group("fstp", + cpu=["FPU"], + opcode=[0xDB], + spare=7, + operands=[Operand(type="Mem", size=80, dest="EA")]) +add_group("fstp", + cpu=["FPU"], + opcode=[0xDD, 0xD8], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("fstp", "fstp") + +# +# Long memory version of floating point load/store for GAS +# +add_group("fldstpt", + cpu=["FPU"], + modifiers=["SpAdd"], + opcode=[0xDB], + spare=0, + operands=[Operand(type="Mem", size=80, relaxed=True, dest="EA")]) + +add_insn("fldt", "fldstpt", modifiers=[5]) +add_insn("fstpt", "fldstpt", modifiers=[7]) + +add_group("fildstp", + suffix="s", + cpu=["FPU"], + modifiers=["SpAdd"], + opcode=[0xDF], + spare=0, + operands=[Operand(type="Mem", size=16, dest="EA")]) +add_group("fildstp", + suffix="l", + cpu=["FPU"], + modifiers=["SpAdd"], + opcode=[0xDB], + spare=0, + operands=[Operand(type="Mem", size=32, dest="EA")]) +add_group("fildstp", + suffix="q", + cpu=["FPU"], + modifiers=["Gap", "Op0Add", "SpAdd"], + opcode=[0xDD], + spare=0, + operands=[Operand(type="Mem", size=64, dest="EA")]) +# No-suffix alias for memory for GAS compat -> "s" version generated +add_group("fildstp", + cpu=["FPU"], + parsers=["gas"], + modifiers=["SpAdd"], + opcode=[0xDF], + spare=0, + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA")]) + +add_insn("fild", "fildstp", modifiers=[0, 2, 5]) +add_insn("fistp", "fildstp", modifiers=[3, 2, 7]) + +add_group("fbldstp", + cpu=["FPU"], + modifiers=["SpAdd"], + opcode=[0xDF], + spare=0, + operands=[Operand(type="Mem", size=80, relaxed=True, dest="EA")]) + +add_insn("fbld", "fbldstp", modifiers=[4]) +add_insn("fildll", "fbldstp", parser="gas", modifiers=[5]) +add_insn("fbstp", "fbldstp", modifiers=[6]) +add_insn("fistpll", "fbldstp", parser="gas", modifiers=[7]) + +# +# store (normal) +# +add_group("fst", + suffix="s", + cpu=["FPU"], + opcode=[0xD9], + spare=2, + operands=[Operand(type="Mem", size=32, dest="EA")]) +add_group("fst", + suffix="l", + cpu=["FPU"], + opcode=[0xDD], + spare=2, + operands=[Operand(type="Mem", size=64, dest="EA")]) +add_group("fst", + cpu=["FPU"], + opcode=[0xDD, 0xD0], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("fst", "fst") + +# +# exchange (with ST0) +# +add_group("fxch", + cpu=["FPU"], + opcode=[0xD9, 0xC8], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) +add_group("fxch", + cpu=["FPU"], + opcode=[0xD9, 0xC8], + operands=[Operand(type="ST0", size=80, dest=None), + Operand(type="Reg", size=80, dest="Op1Add")]) +add_group("fxch", + cpu=["FPU"], + opcode=[0xD9, 0xC8], + operands=[Operand(type="Reg", size=80, dest="Op1Add"), + Operand(type="ST0", size=80, dest=None)]) +add_group("fxch", + cpu=["FPU"], + opcode=[0xD9, 0xC9], + operands=[]) + +add_insn("fxch", "fxch") + +# +# comparisons +# +add_group("fcom", + suffix="s", + cpu=["FPU"], + modifiers=["Gap", "SpAdd"], + opcode=[0xD8], + spare=0, + operands=[Operand(type="Mem", size=32, dest="EA")]) +add_group("fcom", + suffix="l", + cpu=["FPU"], + modifiers=["Gap", "SpAdd"], + opcode=[0xDC], + spare=0, + operands=[Operand(type="Mem", size=64, dest="EA")]) +add_group("fcom", + cpu=["FPU"], + modifiers=["Op1Add"], + opcode=[0xD8, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) +# No-suffix alias for memory for GAS compat -> "s" version generated +add_group("fcom", + cpu=["FPU"], + parsers=["gas"], + modifiers=["Gap", "SpAdd"], + opcode=[0xD8], + spare=0, + operands=[Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +# Alias for fcom %st(1) for GAS compat +add_group("fcom", + cpu=["FPU"], + parsers=["gas"], + modifiers=["Op1Add"], + opcode=[0xD8, 0x01], + operands=[]) +add_group("fcom", + cpu=["FPU"], + parsers=["nasm"], + modifiers=["Op1Add"], + opcode=[0xD8, 0x00], + operands=[Operand(type="ST0", size=80, dest=None), + Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("fcom", "fcom", modifiers=[0xD0, 2]) +add_insn("fcomp", "fcom", modifiers=[0xD8, 3]) + +# +# extended comparisons +# +add_group("fcom2", + cpu=["FPU", "286"], + modifiers=["Op0Add", "Op1Add"], + opcode=[0x00, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) +add_group("fcom2", + cpu=["FPU", "286"], + modifiers=["Op0Add", "Op1Add"], + opcode=[0x00, 0x00], + operands=[Operand(type="ST0", size=80, dest=None), + Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("fucom", "fcom2", modifiers=[0xDD, 0xE0]) +add_insn("fucomp", "fcom2", modifiers=[0xDD, 0xE8]) + +# +# arithmetic +# +add_group("farith", + suffix="s", + cpu=["FPU"], + modifiers=["Gap", "Gap", "SpAdd"], + opcode=[0xD8], + spare=0, + operands=[Operand(type="Mem", size=32, dest="EA")]) +add_group("farith", + suffix="l", + cpu=["FPU"], + modifiers=["Gap", "Gap", "SpAdd"], + opcode=[0xDC], + spare=0, + operands=[Operand(type="Mem", size=64, dest="EA")]) +add_group("farith", + cpu=["FPU"], + modifiers=["Gap", "Op1Add"], + opcode=[0xD8, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) +add_group("farith", + cpu=["FPU"], + modifiers=["Gap", "Op1Add"], + opcode=[0xD8, 0x00], + operands=[Operand(type="ST0", size=80, dest=None), + Operand(type="Reg", size=80, dest="Op1Add")]) +add_group("farith", + cpu=["FPU"], + modifiers=["Op1Add"], + opcode=[0xDC, 0x00], + operands=[Operand(type="Reg", size=80, tmod="To", dest="Op1Add")]) +add_group("farith", + cpu=["FPU"], + parsers=["nasm"], + modifiers=["Op1Add"], + opcode=[0xDC, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add"), + Operand(type="ST0", size=80, dest=None)]) +add_group("farith", + cpu=["FPU"], + parsers=["gas"], + modifiers=["Gap", "Op1Add"], + opcode=[0xDC, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add"), + Operand(type="ST0", size=80, dest=None)]) + +add_insn("fadd", "farith", modifiers=[0xC0, 0xC0, 0]) +add_insn("fsub", "farith", modifiers=[0xE8, 0xE0, 4]) +add_insn("fsubr", "farith", modifiers=[0xE0, 0xE8, 5]) +add_insn("fmul", "farith", modifiers=[0xC8, 0xC8, 1]) +add_insn("fdiv", "farith", modifiers=[0xF8, 0xF0, 6]) +add_insn("fdivr", "farith", modifiers=[0xF0, 0xF8, 7]) + +add_group("farithp", + cpu=["FPU"], + modifiers=["Op1Add"], + opcode=[0xDE, 0x01], + operands=[]) +add_group("farithp", + cpu=["FPU"], + modifiers=["Op1Add"], + opcode=[0xDE, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) +add_group("farithp", + cpu=["FPU"], + modifiers=["Op1Add"], + opcode=[0xDE, 0x00], + operands=[Operand(type="Reg", size=80, dest="Op1Add"), + Operand(type="ST0", size=80, dest=None)]) + +add_insn("faddp", "farithp", modifiers=[0xC0]) +add_insn("fsubp", "farithp", parser="nasm", modifiers=[0xE8]) +add_insn("fsubp", "farithp", parser="gas", modifiers=[0xE0]) +add_insn("fsubrp", "farithp", parser="nasm", modifiers=[0xE0]) +add_insn("fsubrp", "farithp", parser="gas", modifiers=[0xE8]) +add_insn("fmulp", "farithp", modifiers=[0xC8]) +add_insn("fdivp", "farithp", parser="nasm", modifiers=[0xF8]) +add_insn("fdivp", "farithp", parser="gas", modifiers=[0xF0]) +add_insn("fdivrp", "farithp", parser="nasm", modifiers=[0xF0]) +add_insn("fdivrp", "farithp", parser="gas", modifiers=[0xF8]) + +# +# integer arith/store wo pop/compare +# +add_group("fiarith", + suffix="s", + cpu=["FPU"], + modifiers=["SpAdd", "Op0Add"], + opcode=[0x04], + spare=0, + operands=[Operand(type="Mem", size=16, dest="EA")]) +add_group("fiarith", + suffix="l", + cpu=["FPU"], + modifiers=["SpAdd", "Op0Add"], + opcode=[0x00], + spare=0, + operands=[Operand(type="Mem", size=32, dest="EA")]) + +add_insn("fist", "fiarith", modifiers=[2, 0xDB]) +add_insn("ficom", "fiarith", modifiers=[2, 0xDA]) +add_insn("ficomp", "fiarith", modifiers=[3, 0xDA]) +add_insn("fiadd", "fiarith", modifiers=[0, 0xDA]) +add_insn("fisub", "fiarith", modifiers=[4, 0xDA]) +add_insn("fisubr", "fiarith", modifiers=[5, 0xDA]) +add_insn("fimul", "fiarith", modifiers=[1, 0xDA]) +add_insn("fidiv", "fiarith", modifiers=[6, 0xDA]) +add_insn("fidivr", "fiarith", modifiers=[7, 0xDA]) + +# +# processor control +# +add_group("fldnstcw", + suffix="w", + cpu=["FPU"], + modifiers=["SpAdd"], + opcode=[0xD9], + spare=0, + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA")]) + +add_insn("fldcw", "fldnstcw", modifiers=[5]) +add_insn("fnstcw", "fldnstcw", modifiers=[7]) + +add_group("fstcw", + suffix="w", + cpu=["FPU"], + opcode=[0x9B, 0xD9], + spare=7, + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA")]) + +add_insn("fstcw", "fstcw") + +add_group("fnstsw", + suffix="w", + cpu=["FPU"], + opcode=[0xDD], + spare=7, + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA")]) +add_group("fnstsw", + suffix="w", + cpu=["FPU"], + opcode=[0xDF, 0xE0], + operands=[Operand(type="Areg", size=16, dest=None)]) + +add_insn("fnstsw", "fnstsw") + +add_group("fstsw", + suffix="w", + cpu=["FPU"], + opcode=[0x9B, 0xDD], + spare=7, + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA")]) +add_group("fstsw", + suffix="w", + cpu=["FPU"], + opcode=[0x9B, 0xDF, 0xE0], + operands=[Operand(type="Areg", size=16, dest=None)]) + +add_insn("fstsw", "fstsw") + +add_group("ffree", + cpu=["FPU"], + modifiers=["Op0Add"], + opcode=[0x00, 0xC0], + operands=[Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("ffree", "ffree", modifiers=[0xDD]) +add_insn("ffreep", "ffree", modifiers=[0xDF], cpu=["686", "FPU", "Undoc"]) + +##################################################################### +# 486 extensions +##################################################################### +add_group("bswap", + suffix="l", + cpu=["486"], + opersize=32, + opcode=[0x0F, 0xC8], + operands=[Operand(type="Reg", size=32, dest="Op1Add")]) +add_group("bswap", + suffix="q", + opersize=64, + opcode=[0x0F, 0xC8], + operands=[Operand(type="Reg", size=64, dest="Op1Add")]) + +add_insn("bswap", "bswap") + +for sfx, sz in zip("bwlq", [8, 16, 32, 64]): + add_group("cmpxchgxadd", + suffix=sfx, + cpu=["486"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x00+(sz!=8)], + operands=[Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) + +add_insn("xadd", "cmpxchgxadd", modifiers=[0xC0]) +add_insn("cmpxchg", "cmpxchgxadd", modifiers=[0xB0]) +add_insn("cmpxchg486", "cmpxchgxadd", parser="nasm", modifiers=[0xA6], + cpu=["486", "Undoc"]) + +add_insn("invd", "twobyte", modifiers=[0x0F, 0x08], cpu=["486", "Priv"]) +add_insn("wbinvd", "twobyte", modifiers=[0x0F, 0x09], cpu=["486", "Priv"]) +add_insn("invlpg", "twobytemem", modifiers=[7, 0x0F, 0x01], + cpu=["486", "Priv"]) + +##################################################################### +# 586+ and late 486 extensions +##################################################################### +add_insn("cpuid", "twobyte", modifiers=[0x0F, 0xA2], cpu=["486"]) + +##################################################################### +# Pentium extensions +##################################################################### +add_insn("wrmsr", "twobyte", modifiers=[0x0F, 0x30], cpu=["586", "Priv"]) +add_insn("rdtsc", "twobyte", modifiers=[0x0F, 0x31], cpu=["586"]) +add_insn("rdmsr", "twobyte", modifiers=[0x0F, 0x32], cpu=["586", "Priv"]) + +add_group("cmpxchg8b", + suffix="q", + cpu=["586"], + opcode=[0x0F, 0xC7], + spare=1, + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("cmpxchg8b", "cmpxchg8b") + +##################################################################### +# Pentium II/Pentium Pro extensions +##################################################################### +add_insn("sysenter", "twobyte", modifiers=[0x0F, 0x34], cpu=["686"], + not64=True) +add_insn("sysexit", "twobyte", modifiers=[0x0F, 0x35], cpu=["686", "Priv"], + not64=True) +for sfx in [None, "q"]: + add_insn("fxsave"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[0, 0x0F, 0xAE], cpu=["686", "FPU"]) + add_insn("fxrstor"+(sfx or ""), "twobytemem", suffix=sfx, + modifiers=[1, 0x0F, 0xAE], cpu=["686", "FPU"]) +add_insn("rdpmc", "twobyte", modifiers=[0x0F, 0x33], cpu=["686"]) +add_insn("ud2", "twobyte", modifiers=[0x0F, 0x0B], cpu=["286"]) +add_insn("ud1", "twobyte", modifiers=[0x0F, 0xB9], cpu=["286", "Undoc"]) + +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("cmovcc", + suffix=sfx, + cpu=["686"], + modifiers=["Op1Add"], + opersize=sz, + opcode=[0x0F, 0x40], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("cmovo", "cmovcc", modifiers=[0x00]) +add_insn("cmovno", "cmovcc", modifiers=[0x01]) +add_insn("cmovb", "cmovcc", modifiers=[0x02]) +add_insn("cmovc", "cmovcc", modifiers=[0x02]) +add_insn("cmovnae", "cmovcc", modifiers=[0x02]) +add_insn("cmovnb", "cmovcc", modifiers=[0x03]) +add_insn("cmovnc", "cmovcc", modifiers=[0x03]) +add_insn("cmovae", "cmovcc", modifiers=[0x03]) +add_insn("cmove", "cmovcc", modifiers=[0x04]) +add_insn("cmovz", "cmovcc", modifiers=[0x04]) +add_insn("cmovne", "cmovcc", modifiers=[0x05]) +add_insn("cmovnz", "cmovcc", modifiers=[0x05]) +add_insn("cmovbe", "cmovcc", modifiers=[0x06]) +add_insn("cmovna", "cmovcc", modifiers=[0x06]) +add_insn("cmovnbe", "cmovcc", modifiers=[0x07]) +add_insn("cmova", "cmovcc", modifiers=[0x07]) +add_insn("cmovs", "cmovcc", modifiers=[0x08]) +add_insn("cmovns", "cmovcc", modifiers=[0x09]) +add_insn("cmovp", "cmovcc", modifiers=[0x0A]) +add_insn("cmovpe", "cmovcc", modifiers=[0x0A]) +add_insn("cmovnp", "cmovcc", modifiers=[0x0B]) +add_insn("cmovpo", "cmovcc", modifiers=[0x0B]) +add_insn("cmovl", "cmovcc", modifiers=[0x0C]) +add_insn("cmovnge", "cmovcc", modifiers=[0x0C]) +add_insn("cmovnl", "cmovcc", modifiers=[0x0D]) +add_insn("cmovge", "cmovcc", modifiers=[0x0D]) +add_insn("cmovle", "cmovcc", modifiers=[0x0E]) +add_insn("cmovng", "cmovcc", modifiers=[0x0E]) +add_insn("cmovnle", "cmovcc", modifiers=[0x0F]) +add_insn("cmovg", "cmovcc", modifiers=[0x0F]) + +add_group("fcmovcc", + cpu=["FPU", "686"], + modifiers=["Op0Add", "Op1Add"], + opcode=[0x00, 0x00], + operands=[Operand(type="ST0", size=80, dest=None), + Operand(type="Reg", size=80, dest="Op1Add")]) + +add_insn("fcmovb", "fcmovcc", modifiers=[0xDA, 0xC0]) +add_insn("fcmove", "fcmovcc", modifiers=[0xDA, 0xC8]) +add_insn("fcmovbe", "fcmovcc", modifiers=[0xDA, 0xD0]) +add_insn("fcmovu", "fcmovcc", modifiers=[0xDA, 0xD8]) +add_insn("fcmovnb", "fcmovcc", modifiers=[0xDB, 0xC0]) +add_insn("fcmovne", "fcmovcc", modifiers=[0xDB, 0xC8]) +add_insn("fcmovnbe", "fcmovcc", modifiers=[0xDB, 0xD0]) +add_insn("fcmovnu", "fcmovcc", modifiers=[0xDB, 0xD8]) + +add_insn("fcomi", "fcom2", modifiers=[0xDB, 0xF0], cpu=["686", "FPU"]) +add_insn("fucomi", "fcom2", modifiers=[0xDB, 0xE8], cpu=["686", "FPU"]) +add_insn("fcomip", "fcom2", modifiers=[0xDF, 0xF0], cpu=["686", "FPU"]) +add_insn("fucomip", "fcom2", modifiers=[0xDF, 0xE8], cpu=["686", "FPU"]) + +##################################################################### +# Pentium4 extensions +##################################################################### +add_group("movnti", + suffix="l", + cpu=["P4"], + opcode=[0x0F, 0xC3], + operands=[Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="Reg", size=32, dest="Spare")]) +add_group("movnti", + suffix="q", + cpu=["P4"], + opersize=64, + opcode=[0x0F, 0xC3], + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="Reg", size=64, dest="Spare")]) + +add_insn("movnti", "movnti") + +add_group("clflush", + cpu=["P3"], + opcode=[0x0F, 0xAE], + spare=7, + operands=[Operand(type="Mem", size=8, relaxed=True, dest="EA")]) + +add_insn("clflush", "clflush") + +add_insn("lfence", "threebyte", modifiers=[0x0F, 0xAE, 0xE8], cpu=["P3"]) +add_insn("mfence", "threebyte", modifiers=[0x0F, 0xAE, 0xF0], cpu=["P3"]) +add_insn("pause", "onebyte_prefix", modifiers=[0xF3, 0x90], cpu=["P4"]) + +##################################################################### +# MMX/SSE2 instructions +##################################################################### + +add_insn("emms", "twobyte", modifiers=[0x0F, 0x77], cpu=["MMX"]) + +# +# movd +# +add_group("movd", + cpu=["MMX"], + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +add_group("movd", + cpu=["MMX"], + opersize=64, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("movd", + cpu=["MMX"], + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) +add_group("movd", + cpu=["MMX"], + opersize=64, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) +add_group("movd", + cpu=["SSE2"], + prefix=0x66, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +add_group("movd", + cpu=["SSE2"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("movd", + cpu=["SSE2"], + prefix=0x66, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movd", + cpu=["SSE2"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("movd", "movd") + +# +# movq +# + +# MMX forms +add_group("movq", + cpu=["MMX"], + parsers=["nasm"], + opcode=[0x0F, 0x6F], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("movq", + cpu=["MMX"], + parsers=["nasm"], + opersize=64, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("movq", + cpu=["MMX"], + parsers=["nasm"], + opcode=[0x0F, 0x7F], + operands=[Operand(type="SIMDRM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) +add_group("movq", + cpu=["MMX"], + parsers=["nasm"], + opersize=64, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) + +# SSE2 forms +add_group("movq", + cpu=["SSE2"], + parsers=["nasm"], + prefix=0xF3, + opcode=[0x0F, 0x7E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("movq", + cpu=["SSE2"], + parsers=["nasm"], + prefix=0xF3, + opcode=[0x0F, 0x7E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("movq", + cpu=["SSE2"], + parsers=["nasm"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("movq", + cpu=["SSE2"], + parsers=["nasm"], + prefix=0x66, + opcode=[0x0F, 0xD6], + operands=[Operand(type="SIMDRM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movq", + cpu=["SSE2"], + parsers=["nasm"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("movq", "movq") + +add_group("mmxsse2", + cpu=["MMX"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("mmxsse2", + cpu=["SSE2"], + modifiers=["Op1Add"], + prefix=0x66, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +add_insn("packssdw", "mmxsse2", modifiers=[0x6B]) +add_insn("packsswb", "mmxsse2", modifiers=[0x63]) +add_insn("packuswb", "mmxsse2", modifiers=[0x67]) +add_insn("paddb", "mmxsse2", modifiers=[0xFC]) +add_insn("paddw", "mmxsse2", modifiers=[0xFD]) +add_insn("paddd", "mmxsse2", modifiers=[0xFE]) +add_insn("paddq", "mmxsse2", modifiers=[0xD4]) +add_insn("paddsb", "mmxsse2", modifiers=[0xEC]) +add_insn("paddsw", "mmxsse2", modifiers=[0xED]) +add_insn("paddusb", "mmxsse2", modifiers=[0xDC]) +add_insn("paddusw", "mmxsse2", modifiers=[0xDD]) +add_insn("pand", "mmxsse2", modifiers=[0xDB]) +add_insn("pandn", "mmxsse2", modifiers=[0xDF]) +add_insn("pcmpeqb", "mmxsse2", modifiers=[0x74]) +add_insn("pcmpeqw", "mmxsse2", modifiers=[0x75]) +add_insn("pcmpeqd", "mmxsse2", modifiers=[0x76]) +add_insn("pcmpgtb", "mmxsse2", modifiers=[0x64]) +add_insn("pcmpgtw", "mmxsse2", modifiers=[0x65]) +add_insn("pcmpgtd", "mmxsse2", modifiers=[0x66]) +add_insn("pmaddwd", "mmxsse2", modifiers=[0xF5]) +add_insn("pmulhw", "mmxsse2", modifiers=[0xE5]) +add_insn("pmullw", "mmxsse2", modifiers=[0xD5]) +add_insn("por", "mmxsse2", modifiers=[0xEB]) +add_insn("psubb", "mmxsse2", modifiers=[0xF8]) +add_insn("psubw", "mmxsse2", modifiers=[0xF9]) +add_insn("psubd", "mmxsse2", modifiers=[0xFA]) +add_insn("psubq", "mmxsse2", modifiers=[0xFB]) +add_insn("psubsb", "mmxsse2", modifiers=[0xE8]) +add_insn("psubsw", "mmxsse2", modifiers=[0xE9]) +add_insn("psubusb", "mmxsse2", modifiers=[0xD8]) +add_insn("psubusw", "mmxsse2", modifiers=[0xD9]) +add_insn("punpckhbw", "mmxsse2", modifiers=[0x68]) +add_insn("punpckhwd", "mmxsse2", modifiers=[0x69]) +add_insn("punpckhdq", "mmxsse2", modifiers=[0x6A]) +add_insn("punpcklbw", "mmxsse2", modifiers=[0x60]) +add_insn("punpcklwd", "mmxsse2", modifiers=[0x61]) +add_insn("punpckldq", "mmxsse2", modifiers=[0x62]) +add_insn("pxor", "mmxsse2", modifiers=[0xEF]) + +# AVX versions don't support the MMX registers +add_insn("vpackssdw", "xmm_xmm128_256avx2", modifiers=[0x66, 0x6B, VEXL0], avx=True) +add_insn("vpacksswb", "xmm_xmm128_256avx2", modifiers=[0x66, 0x63, VEXL0], avx=True) +add_insn("vpackuswb", "xmm_xmm128_256avx2", modifiers=[0x66, 0x67, VEXL0], avx=True) +add_insn("vpaddb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xFC, VEXL0], avx=True) +add_insn("vpaddw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xFD, VEXL0], avx=True) +add_insn("vpaddd", "xmm_xmm128_256avx2", modifiers=[0x66, 0xFE, VEXL0], avx=True) +add_insn("vpaddq", "xmm_xmm128_256avx2", modifiers=[0x66, 0xD4, VEXL0], avx=True) +add_insn("vpaddsb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xEC, VEXL0], avx=True) +add_insn("vpaddsw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xED, VEXL0], avx=True) +add_insn("vpaddusb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xDC, VEXL0], avx=True) +add_insn("vpaddusw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xDD, VEXL0], avx=True) +add_insn("vpand", "xmm_xmm128_256avx2", modifiers=[0x66, 0xDB, VEXL0], avx=True) +add_insn("vpandn", "xmm_xmm128_256avx2", modifiers=[0x66, 0xDF, VEXL0], avx=True) +add_insn("vpcmpeqb", "xmm_xmm128_256avx2", modifiers=[0x66, 0x74, VEXL0], avx=True) +add_insn("vpcmpeqw", "xmm_xmm128_256avx2", modifiers=[0x66, 0x75, VEXL0], avx=True) +add_insn("vpcmpeqd", "xmm_xmm128_256avx2", modifiers=[0x66, 0x76, VEXL0], avx=True) +add_insn("vpcmpgtb", "xmm_xmm128_256avx2", modifiers=[0x66, 0x64, VEXL0], avx=True) +add_insn("vpcmpgtw", "xmm_xmm128_256avx2", modifiers=[0x66, 0x65, VEXL0], avx=True) +add_insn("vpcmpgtd", "xmm_xmm128_256avx2", modifiers=[0x66, 0x66, VEXL0], avx=True) +add_insn("vpmaddwd", "xmm_xmm128_256avx2", modifiers=[0x66, 0xF5, VEXL0], avx=True) +add_insn("vpmulhw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xE5, VEXL0], avx=True) +add_insn("vpmullw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xD5, VEXL0], avx=True) +add_insn("vpor", "xmm_xmm128_256avx2", modifiers=[0x66, 0xEB, VEXL0], avx=True) +add_insn("vpsubb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xF8, VEXL0], avx=True) +add_insn("vpsubw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xF9, VEXL0], avx=True) +add_insn("vpsubd", "xmm_xmm128_256avx2", modifiers=[0x66, 0xFA, VEXL0], avx=True) +add_insn("vpsubq", "xmm_xmm128_256avx2", modifiers=[0x66, 0xFB, VEXL0], avx=True) +add_insn("vpsubsb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xE8, VEXL0], avx=True) +add_insn("vpsubsw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xE9, VEXL0], avx=True) +add_insn("vpsubusb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xD8, VEXL0], avx=True) +add_insn("vpsubusw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xD9, VEXL0], avx=True) +add_insn("vpunpckhbw", "xmm_xmm128_256avx2", modifiers=[0x66, 0x68, VEXL0], avx=True) +add_insn("vpunpckhwd", "xmm_xmm128_256avx2", modifiers=[0x66, 0x69, VEXL0], avx=True) +add_insn("vpunpckhdq", "xmm_xmm128_256avx2", modifiers=[0x66, 0x6A, VEXL0], avx=True) +add_insn("vpunpcklbw", "xmm_xmm128_256avx2", modifiers=[0x66, 0x60, VEXL0], avx=True) +add_insn("vpunpcklwd", "xmm_xmm128_256avx2", modifiers=[0x66, 0x61, VEXL0], avx=True) +add_insn("vpunpckldq", "xmm_xmm128_256avx2", modifiers=[0x66, 0x62, VEXL0], avx=True) +add_insn("vpxor", "xmm_xmm128_256avx2", modifiers=[0x66, 0xEF, VEXL0], avx=True) + +add_group("pshift", + cpu=["MMX"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("pshift", + cpu=["MMX"], + modifiers=["Gap", "Op1Add", "SpAdd"], + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="SIMDReg", size=64, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pshift", + cpu=["SSE2"], + modifiers=["Op1Add"], + prefix=0x66, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("pshift", + cpu=["SSE2"], + modifiers=["Gap", "Op1Add", "SpAdd"], + prefix=0x66, + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("psllw", "pshift", modifiers=[0xF1, 0x71, 6]) +add_insn("pslld", "pshift", modifiers=[0xF2, 0x72, 6]) +add_insn("psllq", "pshift", modifiers=[0xF3, 0x73, 6]) +add_insn("psraw", "pshift", modifiers=[0xE1, 0x71, 4]) +add_insn("psrad", "pshift", modifiers=[0xE2, 0x72, 4]) +add_insn("psrlw", "pshift", modifiers=[0xD1, 0x71, 2]) +add_insn("psrld", "pshift", modifiers=[0xD2, 0x72, 2]) +add_insn("psrlq", "pshift", modifiers=[0xD3, 0x73, 2]) + +# Ran out of modifiers, so AVX has to be separate +for cpu, sz in zip(["AVX", "AVX2"], [128, 256]): + add_group("vpshift", + cpu=[cpu], + modifiers=["Op1Add"], + vex=sz, + prefix=0x66, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + add_group("vpshift", + cpu=[cpu], + modifiers=["Gap", "Op1Add", "SpAdd"], + vex=sz, + prefix=0x66, + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="SIMDReg", size=sz, dest="EAVEX"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + add_group("vpshift", + cpu=[cpu], + modifiers=["Op1Add"], + vex=sz, + prefix=0x66, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + add_group("vpshift", + cpu=[cpu], + modifiers=["Gap", "Op1Add", "SpAdd"], + vex=sz, + prefix=0x66, + opcode=[0x0F, 0x00], + spare=0, + operands=[Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDReg", size=sz, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vpsllw", "vpshift", modifiers=[0xF1, 0x71, 6]) +add_insn("vpslld", "vpshift", modifiers=[0xF2, 0x72, 6]) +add_insn("vpsllq", "vpshift", modifiers=[0xF3, 0x73, 6]) +add_insn("vpsraw", "vpshift", modifiers=[0xE1, 0x71, 4]) +add_insn("vpsrad", "vpshift", modifiers=[0xE2, 0x72, 4]) +add_insn("vpsrlw", "vpshift", modifiers=[0xD1, 0x71, 2]) +add_insn("vpsrld", "vpshift", modifiers=[0xD2, 0x72, 2]) +add_insn("vpsrlq", "vpshift", modifiers=[0xD3, 0x73, 2]) + +# +# PIII (Katmai) new instructions / SIMD instructions +# +add_insn("pavgb", "mmxsse2", modifiers=[0xE0], cpu=["P3", "MMX"]) +add_insn("pavgw", "mmxsse2", modifiers=[0xE3], cpu=["P3", "MMX"]) +add_insn("pmaxsw", "mmxsse2", modifiers=[0xEE], cpu=["P3", "MMX"]) +add_insn("pmaxub", "mmxsse2", modifiers=[0xDE], cpu=["P3", "MMX"]) +add_insn("pminsw", "mmxsse2", modifiers=[0xEA], cpu=["P3", "MMX"]) +add_insn("pminub", "mmxsse2", modifiers=[0xDA], cpu=["P3", "MMX"]) +add_insn("pmulhuw", "mmxsse2", modifiers=[0xE4], cpu=["P3", "MMX"]) +add_insn("psadbw", "mmxsse2", modifiers=[0xF6], cpu=["P3", "MMX"]) + +# AVX versions don't support MMX register +add_insn("vpavgb", "xmm_xmm128_256avx2", modifiers=[0x66, 0xE0, VEXL0], avx=True) +add_insn("vpavgw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xE3, VEXL0], avx=True) +add_insn("vpmaxsw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xEE, VEXL0], avx=True) +add_insn("vpmaxub", "xmm_xmm128_256avx2", modifiers=[0x66, 0xDE, VEXL0], avx=True) +add_insn("vpminsw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xEA, VEXL0], avx=True) +add_insn("vpminub", "xmm_xmm128_256avx2", modifiers=[0x66, 0xDA, VEXL0], avx=True) +add_insn("vpmulhuw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xE4, VEXL0], avx=True) +add_insn("vpsadbw", "xmm_xmm128_256avx2", modifiers=[0x66, 0xF6, VEXL0], avx=True) + +add_insn("prefetchnta", "twobytemem", modifiers=[0, 0x0F, 0x18], cpu=["P3"]) +add_insn("prefetcht0", "twobytemem", modifiers=[1, 0x0F, 0x18], cpu=["P3"]) +add_insn("prefetcht1", "twobytemem", modifiers=[2, 0x0F, 0x18], cpu=["P3"]) +add_insn("prefetcht2", "twobytemem", modifiers=[3, 0x0F, 0x18], cpu=["P3"]) + +add_insn("sfence", "threebyte", modifiers=[0x0F, 0xAE, 0xF8], cpu=["P3"]) + +add_group("xmm_xmm128_256", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("xmm_xmm128_256", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("xmm_xmm128_256", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="SpareVEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_group("xmm_xmm128_256", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +# Same as above, except 256-bit version only available in AVX2 +add_group("xmm_xmm128_256avx2", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("xmm_xmm128_256avx2", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("xmm_xmm128_256avx2", + cpu=["AVX2"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="SpareVEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_group("xmm_xmm128_256avx2", + cpu=["AVX2"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +# Version that does not allow YMM registers +add_group("xmm_xmm128", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("xmm_xmm128", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +add_insn("addps", "xmm_xmm128", modifiers=[0, 0x58]) +add_insn("andnps", "xmm_xmm128", modifiers=[0, 0x55]) +add_insn("andps", "xmm_xmm128", modifiers=[0, 0x54]) +add_insn("divps", "xmm_xmm128", modifiers=[0, 0x5E]) +add_insn("maxps", "xmm_xmm128", modifiers=[0, 0x5F]) +add_insn("minps", "xmm_xmm128", modifiers=[0, 0x5D]) +add_insn("mulps", "xmm_xmm128", modifiers=[0, 0x59]) +add_insn("orps", "xmm_xmm128", modifiers=[0, 0x56]) +add_insn("rcpps", "xmm_xmm128", modifiers=[0, 0x53]) +add_insn("rsqrtps", "xmm_xmm128", modifiers=[0, 0x52]) +add_insn("sqrtps", "xmm_xmm128", modifiers=[0, 0x51]) +add_insn("subps", "xmm_xmm128", modifiers=[0, 0x5C]) +add_insn("unpckhps", "xmm_xmm128", modifiers=[0, 0x15]) +add_insn("unpcklps", "xmm_xmm128", modifiers=[0, 0x14]) +add_insn("xorps", "xmm_xmm128", modifiers=[0, 0x57]) + +add_insn("vaddps", "xmm_xmm128_256", modifiers=[0, 0x58, VEXL0], avx=True) +add_insn("vandnps", "xmm_xmm128_256", modifiers=[0, 0x55, VEXL0], avx=True) +add_insn("vandps", "xmm_xmm128_256", modifiers=[0, 0x54, VEXL0], avx=True) +add_insn("vdivps", "xmm_xmm128_256", modifiers=[0, 0x5E, VEXL0], avx=True) +add_insn("vmaxps", "xmm_xmm128_256", modifiers=[0, 0x5F, VEXL0], avx=True) +add_insn("vminps", "xmm_xmm128_256", modifiers=[0, 0x5D, VEXL0], avx=True) +add_insn("vmulps", "xmm_xmm128_256", modifiers=[0, 0x59, VEXL0], avx=True) +add_insn("vorps", "xmm_xmm128_256", modifiers=[0, 0x56, VEXL0], avx=True) +# vrcpps, vrsqrtps, and vsqrtps don't add third operand +add_insn("vsubps", "xmm_xmm128_256", modifiers=[0, 0x5C, VEXL0], avx=True) +add_insn("vunpckhps", "xmm_xmm128_256", modifiers=[0, 0x15, VEXL0], avx=True) +add_insn("vunpcklps", "xmm_xmm128_256", modifiers=[0, 0x14, VEXL0], avx=True) +add_insn("vxorps", "xmm_xmm128_256", modifiers=[0, 0x57, VEXL0], avx=True) + +add_group("cvt_rx_xmm32", + suffix="l", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("cvt_rx_xmm32", + suffix="l", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +# REX +add_group("cvt_rx_xmm32", + suffix="q", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opersize=64, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("cvt_rx_xmm32", + suffix="q", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opersize=64, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +add_insn("cvtss2si", "cvt_rx_xmm32", modifiers=[0xF3, 0x2D]) +add_insn("cvttss2si", "cvt_rx_xmm32", modifiers=[0xF3, 0x2C]) +add_insn("vcvtss2si", "cvt_rx_xmm32", modifiers=[0xF3, 0x2D, VEXL0], avx=True) +add_insn("vcvttss2si", "cvt_rx_xmm32", modifiers=[0xF3, 0x2C, VEXL0], avx=True) + +add_group("cvt_mm_xmm64", + cpu=["SSE"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("cvt_mm_xmm64", + cpu=["SSE"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("cvtps2pi", "cvt_mm_xmm64", modifiers=[0x2D]) +add_insn("cvttps2pi", "cvt_mm_xmm64", modifiers=[0x2C]) + +add_group("cvt_xmm_mm_ps", + cpu=["SSE"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) + +add_insn("cvtpi2ps", "cvt_xmm_mm_ps", modifiers=[0x2A]) + +# Memory size can be relaxed only in BITS=32 case, where there's no +# ambiguity. +add_group("cvt_xmm_rmx", + suffix="l", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="RM", size=32, dest="EA")]) +add_group("cvt_xmm_rmx", + suffix="l", + cpu=["SSE"], + not64=True, + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +# REX +add_group("cvt_xmm_rmx", + suffix="q", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opersize=64, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="RM", size=64, dest="EA")]) +add_group("cvt_xmm_rmx", + suffix="l", + cpu=["AVX"], + not64=True, + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +add_group("cvt_xmm_rmx", + suffix="l", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="RM", size=32, dest="EA")]) +add_group("cvt_xmm_rmx", + suffix="q", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + opersize=64, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="RM", size=64, dest="EA")]) + +add_insn("cvtsi2ss", "cvt_xmm_rmx", modifiers=[0xF3, 0x2A]) +add_insn("vcvtsi2ss", "cvt_xmm_rmx", modifiers=[0xF3, 0x2A, VEXL0], avx=True) + +add_group("xmm_xmm32", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("xmm_xmm32", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +add_group("xmm_xmm32", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("xmm_xmm32", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +add_insn("addss", "xmm_xmm32", modifiers=[0xF3, 0x58]) +add_insn("comiss", "xmm_xmm32", modifiers=[0, 0x2F]) +add_insn("divss", "xmm_xmm32", modifiers=[0xF3, 0x5E]) +add_insn("maxss", "xmm_xmm32", modifiers=[0xF3, 0x5F]) +add_insn("minss", "xmm_xmm32", modifiers=[0xF3, 0x5D]) +add_insn("mulss", "xmm_xmm32", modifiers=[0xF3, 0x59]) +add_insn("rcpss", "xmm_xmm32", modifiers=[0xF3, 0x53]) +add_insn("rsqrtss", "xmm_xmm32", modifiers=[0xF3, 0x52]) +add_insn("sqrtss", "xmm_xmm32", modifiers=[0xF3, 0x51]) +add_insn("subss", "xmm_xmm32", modifiers=[0xF3, 0x5C]) +add_insn("ucomiss", "xmm_xmm32", modifiers=[0, 0x2E]) + +add_insn("vaddss", "xmm_xmm32", modifiers=[0xF3, 0x58, VEXL0], avx=True) +# vcomiss and vucomiss are only two operand +add_insn("vdivss", "xmm_xmm32", modifiers=[0xF3, 0x5E, VEXL0], avx=True) +add_insn("vmaxss", "xmm_xmm32", modifiers=[0xF3, 0x5F, VEXL0], avx=True) +add_insn("vminss", "xmm_xmm32", modifiers=[0xF3, 0x5D, VEXL0], avx=True) +add_insn("vmulss", "xmm_xmm32", modifiers=[0xF3, 0x59, VEXL0], avx=True) +add_insn("vrcpss", "xmm_xmm32", modifiers=[0xF3, 0x53, VEXL0], avx=True) +add_insn("vrsqrtss", "xmm_xmm32", modifiers=[0xF3, 0x52, VEXL0], avx=True) +add_insn("vsqrtss", "xmm_xmm32", modifiers=[0xF3, 0x51, VEXL0], avx=True) +add_insn("vsubss", "xmm_xmm32", modifiers=[0xF3, 0x5C, VEXL0], avx=True) + +add_group("ssecmp_128", + cpu=["SSE"], + modifiers=["Imm8", "PreAdd", "SetVEX"], + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("ssecmp_128", + cpu=["AVX"], + modifiers=["Imm8", "PreAdd"], + vex=128, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("ssecmp_128", + cpu=["AVX"], + modifiers=["Imm8", "PreAdd"], + vex=256, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_group("ssecmp_32", + cpu=["SSE"], + modifiers=["Imm8", "PreAdd", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("ssecmp_32", + cpu=["SSE"], + modifiers=["Imm8", "PreAdd", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +add_group("ssecmp_32", + cpu=["AVX"], + modifiers=["Imm8", "PreAdd"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("ssecmp_32", + cpu=["AVX"], + modifiers=["Imm8", "PreAdd"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +ssecoms = [(0x0, "eq"), + (0x1, "lt"), + (0x2, "le"), + (0x3, "unord"), + (0x4, "neq"), + (0x5, "nlt"), + (0x6, "nle"), + (0x7, "ord")] +for ib, cc in ssecoms: + add_insn("cmp"+cc+"ps", "ssecmp_128", modifiers=[ib]) + add_insn("cmp"+cc+"ss", "ssecmp_32", modifiers=[ib, 0xF3]) + +avxcoms = [(0x00, "eq"), + (0x01, "lt"), + (0x02, "le"), + (0x03, "unord"), + (0x04, "neq"), + (0x05, "nlt"), + (0x06, "nle"), + (0x07, "ord"), + (0x08, "eq_uq"), + (0x09, "nge"), + (0x0a, "ngt"), + (0x0b, "false"), + (0x0c, "neq_oq"), + (0x0d, "ge"), + (0x0e, "gt"), + (0x0f, "true"), + (0x10, "eq_os"), + (0x11, "lt_oq"), + (0x12, "le_oq"), + (0x13, "unord_s"), + (0x14, "neq_us"), + (0x15, "nlt_uq"), + (0x16, "nle_uq"), + (0x17, "ord_s"), + (0x18, "eq_us"), + (0x19, "nge_uq"), + (0x1a, "ngt_uq"), + (0x1b, "false_os"), + (0x1c, "neq_os"), + (0x1d, "ge_oq"), + (0x1e, "gt_oq"), + (0x1f, "true_us")] +for ib, cc in avxcoms: + add_insn("vcmp"+cc+"ps", "ssecmp_128", modifiers=[ib, 0, VEXL0], avx=True) + add_insn("vcmp"+cc+"ss", "ssecmp_32", modifiers=[ib, 0xF3, VEXL0], avx=True) + +add_group("xmm_xmm128_imm", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("cmpps", "xmm_xmm128_imm", modifiers=[0, 0xC2]) +add_insn("shufps", "xmm_xmm128_imm", modifiers=[0, 0xC6]) + +# YMM register AVX2 version of above +add_group("xmm_xmm128_imm_256avx2", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("xmm_xmm128_imm_256avx2", + cpu=["AVX2"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +# YMM register and 4-operand version of above +add_group("xmm_xmm128_imm_256", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("xmm_xmm128_imm_256", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("xmm_xmm128_imm_256", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vcmpps", "xmm_xmm128_imm_256", modifiers=[0, 0xC2, VEXL0], avx=True) +add_insn("vshufps", "xmm_xmm128_imm_256", modifiers=[0, 0xC6, VEXL0], avx=True) + +add_group("xmm_xmm32_imm", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("xmm_xmm32_imm", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("xmm_xmm32_imm", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("xmm_xmm32_imm", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("cmpss", "xmm_xmm32_imm", modifiers=[0xF3, 0xC2]) +add_insn("vcmpss", "xmm_xmm32_imm", modifiers=[0xF3, 0xC2, VEXL0], avx=True) + +add_group("ldstmxcsr", + cpu=["SSE"], + modifiers=["SpAdd", "SetVEX"], + opcode=[0x0F, 0xAE], + spare=0, + operands=[Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +add_insn("ldmxcsr", "ldstmxcsr", modifiers=[2]) +add_insn("stmxcsr", "ldstmxcsr", modifiers=[3]) +add_insn("vldmxcsr", "ldstmxcsr", modifiers=[2, VEXL0], avx=True) +add_insn("vstmxcsr", "ldstmxcsr", modifiers=[3, VEXL0], avx=True) + +add_group("maskmovq", + cpu=["MMX", "P3"], + opcode=[0x0F, 0xF7], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=64, dest="EA")]) + +add_insn("maskmovq", "maskmovq") + +# Too many modifiers, so can't reuse first two cases for AVX version +# Just repeat and disable first two with noavx. +add_group("movau", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add"], + notavx=True, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("movau", + cpu=["SSE"], + notavx=True, + modifiers=["PreAdd", "Op1Add", "Op1Add"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movau", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("movau", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add", "Op1Add"], + vex=128, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movau", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_group("movau", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add", "Op1Add"], + vex=256, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="Spare")]) + +add_insn("movaps", "movau", modifiers=[0, 0x28, 0x01]) +add_insn("movups", "movau", modifiers=[0, 0x10, 0x01]) +add_insn("vmovaps", "movau", modifiers=[0, 0x28, 0x01], avx=True) +add_insn("vmovups", "movau", modifiers=[0, 0x10, 0x01], avx=True) + +add_group("movhllhps", + cpu=["SSE"], + modifiers=["Op1Add", "SetVEX"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("movhllhps", + cpu=["AVX"], + modifiers=["Op1Add"], + vex=128, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("movhlps", "movhllhps", modifiers=[0x12]) +add_insn("movlhps", "movhllhps", modifiers=[0x16]) +add_insn("vmovhlps", "movhllhps", modifiers=[0x12, VEXL0], avx=True) +add_insn("vmovlhps", "movhllhps", modifiers=[0x16, VEXL0], avx=True) + +add_group("movhlp", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("movhlp", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x01], + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movhlp", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("movhps", "movhlp", modifiers=[0, 0x16]) +add_insn("movlps", "movhlp", modifiers=[0, 0x12]) +add_insn("vmovhps", "movhlp", modifiers=[0, 0x16, VEXL0], avx=True) +add_insn("vmovlps", "movhlp", modifiers=[0, 0x12, VEXL0], avx=True) + +add_group("movmsk", + suffix="l", + cpu=["SSE"], + modifiers=["PreAdd", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x50], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("movmsk", + suffix="q", + cpu=["SSE"], + modifiers=["PreAdd", "SetVEX"], + prefix=0x00, + opersize=64, + opcode=[0x0F, 0x50], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("movmsk", + suffix="l", + cpu=["AVX"], + modifiers=["PreAdd"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x50], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="EA")]) +add_group("movmsk", + suffix="q", + cpu=["SSE"], + modifiers=["PreAdd"], + vex=256, + prefix=0x00, + opersize=64, + opcode=[0x0F, 0x50], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="EA")]) + +add_insn("movmskps", "movmsk") +add_insn("vmovmskps", "movmsk", modifiers=[0, VEXL0], avx=True) + +add_group("movnt", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Mem", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movnt", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Mem", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="Spare")]) + +add_insn("movntps", "movnt", modifiers=[0, 0x2B]) +add_insn("vmovntps", "movnt", modifiers=[0, 0x2B, VEXL0], avx=True) + +add_group("movntq", + cpu=["SSE"], + opcode=[0x0F, 0xE7], + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=64, dest="Spare")]) + +add_insn("movntq", "movntq") + +add_group("movss", + cpu=["SSE"], + modifiers=["SetVEX"], + prefix=0xF3, + opcode=[0x0F, 0x10], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("movss", + cpu=["SSE"], + modifiers=["SetVEX"], + prefix=0xF3, + opcode=[0x0F, 0x10], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +add_group("movss", + cpu=["SSE"], + modifiers=["SetVEX"], + prefix=0xF3, + opcode=[0x0F, 0x11], + operands=[Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movss", + cpu=["AVX"], + vex=128, + prefix=0xF3, + opcode=[0x0F, 0x10], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("movss", "movss") +add_insn("vmovss", "movss", modifiers=[VEXL0], avx=True) + +add_group("pextrw", + suffix="l", + cpu=["MMX", "P3"], + notavx=True, + opcode=[0x0F, 0xC5], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=64, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrw", + suffix="l", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0xC5], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrw", + suffix="q", + cpu=["MMX", "P3"], + notavx=True, + opersize=64, + opcode=[0x0F, 0xC5], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=64, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrw", + suffix="q", + cpu=["SSE2"], + modifiers=["SetVEX"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0xC5], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +# SSE41 instructions +add_group("pextrw", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x15], + operands=[Operand(type="Mem", size=16, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrw", + cpu=["SSE41"], + modifiers=["SetVEX"], + opersize=32, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x15], + operands=[Operand(type="Reg", size=32, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrw", + cpu=["SSE41"], + modifiers=["SetVEX"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x15], + operands=[Operand(type="Reg", size=64, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pextrw", "pextrw") +add_insn("vpextrw", "pextrw", modifiers=[VEXL0], avx=True) + +add_group("pinsrw", + suffix="l", + cpu=["MMX", "P3"], + notavx=True, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="Reg", size=32, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="q", + cpu=["MMX", "P3"], + notavx=True, + def_opersize_64=64, + opersize=64, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="Reg", size=64, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="l", + cpu=["MMX", "P3"], + notavx=True, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="Mem", size=16, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="l", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Reg", size=32, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="q", + cpu=["SSE2"], + modifiers=["SetVEX"], + def_opersize_64=64, + opersize=64, + prefix=0x66, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Reg", size=64, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="l", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=16, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="l", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Reg", size=32, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="q", + cpu=["AVX"], + vex=128, + def_opersize_64=64, + opersize=64, + prefix=0x66, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Reg", size=64, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrw", + suffix="l", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0xC4], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=16, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pinsrw", "pinsrw") +add_insn("vpinsrw", "pinsrw", modifiers=[VEXL0], avx=True) + +add_group("pmovmskb", + suffix="l", + cpu=["MMX", "P3"], + notavx=True, + opcode=[0x0F, 0xD7], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=64, dest="EA")]) +add_group("pmovmskb", + suffix="l", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0xD7], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("pmovmskb", + suffix="l", + cpu=["AVX2"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0xD7], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="EA")]) +add_group("pmovmskb", + suffix="q", + cpu=["MMX", "P3"], + notavx=True, + opersize=64, + def_opersize_64=64, + opcode=[0x0F, 0xD7], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=64, dest="EA")]) +add_group("pmovmskb", + suffix="q", + cpu=["SSE2"], + modifiers=["SetVEX"], + opersize=64, + def_opersize_64=64, + prefix=0x66, + opcode=[0x0F, 0xD7], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("pmovmskb", + suffix="q", + cpu=["SSE2"], + vex=256, + opersize=64, + def_opersize_64=64, + prefix=0x66, + opcode=[0x0F, 0xD7], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="EA")]) + +add_insn("pmovmskb", "pmovmskb") +add_insn("vpmovmskb", "pmovmskb", modifiers=[VEXL0], avx=True) + +add_group("pshufw", + cpu=["MMX", "P3"], + opcode=[0x0F, 0x70], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pshufw", "pshufw") + +##################################################################### +# SSE2 instructions +##################################################################### +add_group("xmm_xmm64", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("xmm_xmm64", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("xmm_xmm64", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("xmm_xmm64", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("addsd", "xmm_xmm64", modifiers=[0xF2, 0x58]) +add_insn("comisd", "xmm_xmm64", modifiers=[0x66, 0x2F]) +add_insn("cvtdq2pd", "xmm_xmm64", modifiers=[0xF3, 0xE6]) +add_insn("cvtps2pd", "xmm_xmm64", modifiers=[0, 0x5A]) +add_insn("cvtsd2ss", "xmm_xmm64", modifiers=[0xF2, 0x5A]) +add_insn("divsd", "xmm_xmm64", modifiers=[0xF2, 0x5E]) +add_insn("maxsd", "xmm_xmm64", modifiers=[0xF2, 0x5F]) +add_insn("minsd", "xmm_xmm64", modifiers=[0xF2, 0x5D]) +add_insn("mulsd", "xmm_xmm64", modifiers=[0xF2, 0x59]) +add_insn("subsd", "xmm_xmm64", modifiers=[0xF2, 0x5C]) +add_insn("sqrtsd", "xmm_xmm64", modifiers=[0xF2, 0x51]) +add_insn("ucomisd", "xmm_xmm64", modifiers=[0x66, 0x2E]) + +add_insn("vaddsd", "xmm_xmm64", modifiers=[0xF2, 0x58, VEXL0], avx=True) +# vcomisd and vucomisd are only two operand +# vcvtdq2pd and vcvtps2pd can take ymm, xmm version +add_insn("vcvtsd2ss", "xmm_xmm64", modifiers=[0xF2, 0x5A, VEXL0], avx=True) +add_insn("vdivsd", "xmm_xmm64", modifiers=[0xF2, 0x5E, VEXL0], avx=True) +add_insn("vmaxsd", "xmm_xmm64", modifiers=[0xF2, 0x5F, VEXL0], avx=True) +add_insn("vminsd", "xmm_xmm64", modifiers=[0xF2, 0x5D, VEXL0], avx=True) +add_insn("vmulsd", "xmm_xmm64", modifiers=[0xF2, 0x59, VEXL0], avx=True) +add_insn("vsubsd", "xmm_xmm64", modifiers=[0xF2, 0x5C, VEXL0], avx=True) +add_insn("vsqrtsd", "xmm_xmm64", modifiers=[0xF2, 0x51, VEXL0], avx=True) + +add_insn("addpd", "xmm_xmm128", modifiers=[0x66, 0x58], cpu=["SSE2"]) +add_insn("andnpd", "xmm_xmm128", modifiers=[0x66, 0x55], cpu=["SSE2"]) +add_insn("andpd", "xmm_xmm128", modifiers=[0x66, 0x54], cpu=["SSE2"]) +add_insn("cvtdq2ps", "xmm_xmm128", modifiers=[0, 0x5B], cpu=["SSE2"]) +add_insn("cvtpd2dq", "xmm_xmm128", modifiers=[0xF2, 0xE6], cpu=["SSE2"]) +add_insn("cvtpd2ps", "xmm_xmm128", modifiers=[0x66, 0x5A], cpu=["SSE2"]) +add_insn("cvtps2dq", "xmm_xmm128", modifiers=[0x66, 0x5B], cpu=["SSE2"]) +add_insn("divpd", "xmm_xmm128", modifiers=[0x66, 0x5E], cpu=["SSE2"]) +add_insn("maxpd", "xmm_xmm128", modifiers=[0x66, 0x5F], cpu=["SSE2"]) +add_insn("minpd", "xmm_xmm128", modifiers=[0x66, 0x5D], cpu=["SSE2"]) +add_insn("mulpd", "xmm_xmm128", modifiers=[0x66, 0x59], cpu=["SSE2"]) +add_insn("orpd", "xmm_xmm128", modifiers=[0x66, 0x56], cpu=["SSE2"]) +add_insn("sqrtpd", "xmm_xmm128", modifiers=[0x66, 0x51], cpu=["SSE2"]) +add_insn("subpd", "xmm_xmm128", modifiers=[0x66, 0x5C], cpu=["SSE2"]) +add_insn("unpckhpd", "xmm_xmm128", modifiers=[0x66, 0x15], cpu=["SSE2"]) +add_insn("unpcklpd", "xmm_xmm128", modifiers=[0x66, 0x14], cpu=["SSE2"]) +add_insn("xorpd", "xmm_xmm128", modifiers=[0x66, 0x57], cpu=["SSE2"]) + +add_insn("vaddpd", "xmm_xmm128_256", modifiers=[0x66, 0x58, VEXL0], avx=True) +add_insn("vandnpd", "xmm_xmm128_256", modifiers=[0x66, 0x55, VEXL0], avx=True) +add_insn("vandpd", "xmm_xmm128_256", modifiers=[0x66, 0x54, VEXL0], avx=True) +# vcvtdq2ps and vcvtps2dq are 2-operand, YMM capable +# vcvtpd2dq and vcvtpd2ps take xmm, ymm combination +add_insn("vdivpd", "xmm_xmm128_256", modifiers=[0x66, 0x5E, VEXL0], avx=True) +add_insn("vmaxpd", "xmm_xmm128_256", modifiers=[0x66, 0x5F, VEXL0], avx=True) +add_insn("vminpd", "xmm_xmm128_256", modifiers=[0x66, 0x5D, VEXL0], avx=True) +add_insn("vmulpd", "xmm_xmm128_256", modifiers=[0x66, 0x59, VEXL0], avx=True) +add_insn("vorpd", "xmm_xmm128_256", modifiers=[0x66, 0x56, VEXL0], avx=True) +# vsqrtpd doesn't add third operand +add_insn("vsubpd", "xmm_xmm128_256", modifiers=[0x66, 0x5C, VEXL0], avx=True) +add_insn("vunpckhpd", "xmm_xmm128_256", modifiers=[0x66, 0x15, VEXL0], avx=True) +add_insn("vunpcklpd", "xmm_xmm128_256", modifiers=[0x66, 0x14, VEXL0], avx=True) +add_insn("vxorpd", "xmm_xmm128_256", modifiers=[0x66, 0x57, VEXL0], avx=True) + +add_group("ssecmp_64", + cpu=["SSE2"], + modifiers=["Imm8", "PreAdd", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("ssecmp_64", + cpu=["SSE2"], + modifiers=["Imm8", "PreAdd", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("ssecmp_64", + cpu=["AVX"], + modifiers=["Imm8", "PreAdd"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("ssecmp_64", + cpu=["AVX"], + modifiers=["Imm8", "PreAdd"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +for ib, cc in ssecoms: + add_insn("cmp"+cc+"sd", "ssecmp_64", modifiers=[ib, 0xF2]) + add_insn("cmp"+cc+"pd", "ssecmp_128", modifiers=[ib, 0x66]) + +for ib, cc in avxcoms: + add_insn("vcmp"+cc+"sd", "ssecmp_64", modifiers=[ib, 0xF2, VEXL0], avx=True) + add_insn("vcmp"+cc+"pd", "ssecmp_128", modifiers=[ib, 0x66, VEXL0], avx=True) + +add_insn("cmppd", "xmm_xmm128_imm", modifiers=[0x66, 0xC2], cpu=["SSE2"]) +add_insn("shufpd", "xmm_xmm128_imm", modifiers=[0x66, 0xC6], cpu=["SSE2"]) +add_insn("vcmppd", "xmm_xmm128_imm_256", modifiers=[0x66, 0xC2, VEXL0], avx=True) +add_insn("vshufpd", "xmm_xmm128_imm_256", modifiers=[0x66, 0xC6, VEXL0], avx=True) + +add_insn("cvtsi2sd", "cvt_xmm_rmx", modifiers=[0xF2, 0x2A], cpu=["SSE2"]) +add_insn("vcvtsi2sd", "cvt_xmm_rmx", modifiers=[0xF2, 0x2A, VEXL0], avx=True) + +add_group("cvt_rx_xmm64", + suffix="l", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("cvt_rx_xmm64", + suffix="l", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +# REX +add_group("cvt_rx_xmm64", + suffix="q", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opersize=64, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("cvt_rx_xmm64", + suffix="q", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add", "SetVEX"], + opersize=64, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("cvtsd2si", "cvt_rx_xmm64", modifiers=[0xF2, 0x2D]) +add_insn("vcvtsd2si", "cvt_rx_xmm64", modifiers=[0xF2, 0x2D, VEXL0], avx=True) + +add_group("cvt_mm_xmm", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +add_insn("cvtpd2pi", "cvt_mm_xmm", modifiers=[0x66, 0x2D], cpu=["SSE2"]) + +add_group("cvt_xmm_mm_ss", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) + +add_insn("cvtpi2pd", "cvt_xmm_mm_ss", modifiers=[0x66, 0x2A], cpu=["SSE2"]) + +# cmpsd SSE2 form +add_group("cmpsd", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0xF2, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("cmpsd", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0xF2, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("cmpsd", + cpu=["AVX"], + vex=128, + prefix=0xF2, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("cmpsd", + cpu=["AVX"], + vex=128, + prefix=0xF2, + opcode=[0x0F, 0xC2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +# cmpsd is added in string instructions above, so don't re-add_insn() +add_insn("vcmpsd", "cmpsd", modifiers=[VEXL0], avx=True) + +add_insn("movapd", "movau", modifiers=[0x66, 0x28, 0x01], cpu=["SSE2"]) +add_insn("movupd", "movau", modifiers=[0x66, 0x10, 0x01], cpu=["SSE2"]) +add_insn("vmovapd", "movau", modifiers=[0x66, 0x28, 0x01], avx=True) +add_insn("vmovupd", "movau", modifiers=[0x66, 0x10, 0x01], avx=True) + +add_insn("movhpd", "movhlp", modifiers=[0x66, 0x16], cpu=["SSE2"]) +add_insn("movlpd", "movhlp", modifiers=[0x66, 0x12], cpu=["SSE2"]) +add_insn("vmovhpd", "movhlp", modifiers=[0x66, 0x16, VEXL0], avx=True) +add_insn("vmovlpd", "movhlp", modifiers=[0x66, 0x12, VEXL0], avx=True) + +add_insn("movmskpd", "movmsk", modifiers=[0x66], cpu=["SSE2"]) +add_insn("vmovmskpd", "movmsk", modifiers=[0x66, VEXL0], avx=True) + +add_insn("movntpd", "movnt", modifiers=[0x66, 0x2B], cpu=["SSE2"]) +add_insn("movntdq", "movnt", modifiers=[0x66, 0xE7], cpu=["SSE2"]) +add_insn("vmovntpd", "movnt", modifiers=[0x66, 0x2B, VEXL0], avx=True) +add_insn("vmovntdq", "movnt", modifiers=[0x66, 0xE7, VEXL0], avx=True) + +# movsd SSE2 forms +add_group("movsd", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0xF2, + opcode=[0x0F, 0x10], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("movsd", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0xF2, + opcode=[0x0F, 0x10], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("movsd", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0xF2, + opcode=[0x0F, 0x11], + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("movsd", + cpu=["AVX"], + vex=128, + prefix=0xF2, + opcode=[0x0F, 0x10], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) +# movsd is added in string instructions above, so don't re-add_insn() +add_insn("vmovsd", "movsd", modifiers=[VEXL0], avx=True) + +##################################################################### +# P4 VMX Instructions +##################################################################### + +add_group("eptvpid", + modifiers=["Op2Add"], + suffix="l", + not64=True, + cpu=["EPTVPID"], + opersize=32, + prefix=0x66, + opcode=[0x0F, 0x38, 0x80], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) +add_group("eptvpid", + modifiers=["Op2Add"], + suffix="q", + cpu=["EPTVPID"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x38, 0x80], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) +add_insn("invept", "eptvpid", modifiers=[0]) +add_insn("invvpid", "eptvpid", modifiers=[1]) + +add_insn("vmcall", "threebyte", modifiers=[0x0F, 0x01, 0xC1], cpu=["P4"]) +add_insn("vmlaunch", "threebyte", modifiers=[0x0F, 0x01, 0xC2], cpu=["P4"]) +add_insn("vmresume", "threebyte", modifiers=[0x0F, 0x01, 0xC3], cpu=["P4"]) +add_insn("vmxoff", "threebyte", modifiers=[0x0F, 0x01, 0xC4], cpu=["P4"]) + +add_group("vmxmemrd", + suffix="l", + not64=True, + cpu=["P4"], + opersize=32, + opcode=[0x0F, 0x78], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Reg", size=32, dest="Spare")]) +add_group("vmxmemrd", + suffix="q", + cpu=["P4"], + opersize=64, + def_opersize_64=64, + opcode=[0x0F, 0x78], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="Reg", size=64, dest="Spare")]) +add_insn("vmread", "vmxmemrd") + +add_group("vmxmemwr", + suffix="l", + not64=True, + cpu=["P4"], + opersize=32, + opcode=[0x0F, 0x79], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +add_group("vmxmemwr", + suffix="q", + cpu=["P4"], + opersize=64, + def_opersize_64=64, + opcode=[0x0F, 0x79], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_insn("vmwrite", "vmxmemwr") + +add_group("vmxtwobytemem", + modifiers=["SpAdd"], + cpu=["P4"], + opcode=[0x0F, 0xC7], + spare=0, + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_insn("vmptrld", "vmxtwobytemem", modifiers=[6]) +add_insn("vmptrst", "vmxtwobytemem", modifiers=[7]) + +add_group("vmxthreebytemem", + modifiers=["PreAdd"], + cpu=["P4"], + prefix=0x00, + opcode=[0x0F, 0xC7], + spare=6, + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_insn("vmclear", "vmxthreebytemem", modifiers=[0x66]) +add_insn("vmxon", "vmxthreebytemem", modifiers=[0xF3]) + +add_insn("endbr32", "fourbyte", modifiers=[0xF3, 0x0F, 0x1E, 0xFB]) +add_insn("endbr64", "fourbyte", modifiers=[0xF3, 0x0F, 0x1E, 0xFA]) + +##################################################################### +# Intel SMX Instructions +##################################################################### +add_insn("getsec", "twobyte", modifiers=[0x0F, 0x37], cpu=["SMX"]) + +add_insn("cvttpd2pi", "cvt_mm_xmm", modifiers=[0x66, 0x2C], cpu=["SSE2"]) +add_insn("cvttsd2si", "cvt_rx_xmm64", modifiers=[0xF2, 0x2C], cpu=["SSE2"]) +add_insn("cvttpd2dq", "xmm_xmm128", modifiers=[0x66, 0xE6], cpu=["SSE2"]) +add_insn("cvttps2dq", "xmm_xmm128", modifiers=[0xF3, 0x5B], cpu=["SSE2"]) +add_insn("pmuludq", "mmxsse2", modifiers=[0xF4], cpu=["SSE2"]) +add_insn("pshufd", "xmm_xmm128_imm", modifiers=[0x66, 0x70], cpu=["SSE2"]) +add_insn("pshufhw", "xmm_xmm128_imm", modifiers=[0xF3, 0x70], cpu=["SSE2"]) +add_insn("pshuflw", "xmm_xmm128_imm", modifiers=[0xF2, 0x70], cpu=["SSE2"]) +add_insn("punpckhqdq", "xmm_xmm128", modifiers=[0x66, 0x6D], cpu=["SSE2"]) +add_insn("punpcklqdq", "xmm_xmm128", modifiers=[0x66, 0x6C], cpu=["SSE2"]) + +add_insn("vcvttsd2si", "cvt_rx_xmm64", modifiers=[0xF2, 0x2C, VEXL0], avx=True) +# vcvttpd2dq takes xmm, ymm combination +# vcvttps2dq is two-operand +add_insn("vpmuludq", "xmm_xmm128_256avx2", modifiers=[0x66, 0xF4, VEXL0], avx=True) +add_insn("vpshufd", "xmm_xmm128_imm_256avx2", modifiers=[0x66, 0x70, VEXL0], avx=True) +add_insn("vpshufhw", "xmm_xmm128_imm_256avx2", modifiers=[0xF3, 0x70, VEXL0], avx=True) +add_insn("vpshuflw", "xmm_xmm128_imm_256avx2", modifiers=[0xF2, 0x70, VEXL0], avx=True) +add_insn("vpunpckhqdq", "xmm_xmm128_256avx2", modifiers=[0x66, 0x6D, VEXL0], avx=True) +add_insn("vpunpcklqdq", "xmm_xmm128_256avx2", modifiers=[0x66, 0x6C, VEXL0], avx=True) + +add_insn("cvtss2sd", "xmm_xmm32", modifiers=[0xF3, 0x5A], cpu=["SSE2"]) +add_insn("vcvtss2sd", "xmm_xmm32", modifiers=[0xF3, 0x5A, VEXL0], avx=True) + +add_group("maskmovdqu", + cpu=["SSE2"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0xF7], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("maskmovdqu", "maskmovdqu") +add_insn("vmaskmovdqu", "maskmovdqu", modifiers=[VEXL0], avx=True) + +add_insn("movdqa", "movau", modifiers=[0x66, 0x6F, 0x10], cpu=["SSE2"]) +add_insn("movdqu", "movau", modifiers=[0xF3, 0x6F, 0x10], cpu=["SSE2"]) +add_insn("vmovdqa", "movau", modifiers=[0x66, 0x6F, 0x10], avx=True) +add_insn("vmovdqu", "movau", modifiers=[0xF3, 0x6F, 0x10], avx=True) + +add_group("movdq2q", + cpu=["SSE2"], + prefix=0xF2, + opcode=[0x0F, 0xD6], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("movdq2q", "movdq2q") + +add_group("movq2dq", + cpu=["SSE2"], + prefix=0xF3, + opcode=[0x0F, 0xD6], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=64, dest="EA")]) + +add_insn("movq2dq", "movq2dq") + +add_group("pslrldq", + cpu=["SSE2"], + modifiers=["SpAdd", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x73], + spare=0, + operands=[Operand(type="SIMDReg", size=128, dest="EAVEX"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pslrldq", + cpu=["SSE2"], + modifiers=["SpAdd", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x73], + spare=0, + operands=[Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pslrldq", + cpu=["AVX2"], + modifiers=["SpAdd"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x73], + spare=0, + operands=[Operand(type="SIMDReg", size=256, dest="EAVEX"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pslrldq", + cpu=["AVX2"], + modifiers=["SpAdd"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x73], + spare=0, + operands=[Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDReg", size=256, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pslldq", "pslrldq", modifiers=[7]) +add_insn("psrldq", "pslrldq", modifiers=[3]) +add_insn("vpslldq", "pslrldq", modifiers=[7, VEXL0], avx=True) +add_insn("vpsrldq", "pslrldq", modifiers=[3, VEXL0], avx=True) + +##################################################################### +# SSE3 / PNI Prescott New Instructions instructions +##################################################################### +add_insn("addsubpd", "xmm_xmm128", modifiers=[0x66, 0xD0], cpu=["SSE3"]) +add_insn("addsubps", "xmm_xmm128", modifiers=[0xF2, 0xD0], cpu=["SSE3"]) +add_insn("haddpd", "xmm_xmm128", modifiers=[0x66, 0x7C], cpu=["SSE3"]) +add_insn("haddps", "xmm_xmm128", modifiers=[0xF2, 0x7C], cpu=["SSE3"]) +add_insn("hsubpd", "xmm_xmm128", modifiers=[0x66, 0x7D], cpu=["SSE3"]) +add_insn("hsubps", "xmm_xmm128", modifiers=[0xF2, 0x7D], cpu=["SSE3"]) + +add_insn("vaddsubpd", "xmm_xmm128_256", modifiers=[0x66, 0xD0, VEXL0], avx=True) +add_insn("vaddsubps", "xmm_xmm128_256", modifiers=[0xF2, 0xD0, VEXL0], avx=True) +add_insn("vhaddpd", "xmm_xmm128_256", modifiers=[0x66, 0x7C, VEXL0], avx=True) +add_insn("vhaddps", "xmm_xmm128_256", modifiers=[0xF2, 0x7C, VEXL0], avx=True) +add_insn("vhsubpd", "xmm_xmm128_256", modifiers=[0x66, 0x7D, VEXL0], avx=True) +add_insn("vhsubps", "xmm_xmm128_256", modifiers=[0xF2, 0x7D, VEXL0], avx=True) + +add_insn("movshdup", "xmm_xmm128", modifiers=[0xF3, 0x16], cpu=["SSE3"]) +add_insn("movsldup", "xmm_xmm128", modifiers=[0xF3, 0x12], cpu=["SSE3"]) +add_insn("fisttp", "fildstp", modifiers=[1, 0, 1], cpu=["SSE3"]) +add_insn("fisttpll", "fildstp", suffix="q", modifiers=[7], cpu=["SSE3"]) +add_insn("movddup", "xmm_xmm64", modifiers=[0xF2, 0x12], cpu=["SSE3"]) +add_insn("monitor", "threebyte", modifiers=[0x0F, 0x01, 0xC8], cpu=["SSE3"]) +add_insn("mwait", "threebyte", modifiers=[0x0F, 0x01, 0xC9], cpu=["SSE3"]) + +add_group("lddqu", + cpu=["SSE3"], + modifiers=["SetVEX"], + prefix=0xF2, + opcode=[0x0F, 0xF0], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) +add_group("lddqu", + cpu=["AVX"], + vex=256, + prefix=0xF2, + opcode=[0x0F, 0xF0], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Mem", size=256, relaxed=True, dest="EA")]) + +add_insn("lddqu", "lddqu") +add_insn("vlddqu", "lddqu", modifiers=[VEXL0], avx=True) + +##################################################################### +# SSSE3 / TNI Tejas New Intructions instructions +##################################################################### + +add_group("ssse3", + cpu=["SSSE3"], + notavx=True, + modifiers=["Op2Add"], + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) +add_group("ssse3", + cpu=["SSSE3"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("ssse3", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("ssse3", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="SpareVEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_group("ssse3", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("pshufb", "ssse3", modifiers=[0x00]) +add_insn("phaddw", "ssse3", modifiers=[0x01]) +add_insn("phaddd", "ssse3", modifiers=[0x02]) +add_insn("phaddsw", "ssse3", modifiers=[0x03]) +add_insn("pmaddubsw", "ssse3", modifiers=[0x04]) +add_insn("phsubw", "ssse3", modifiers=[0x05]) +add_insn("phsubd", "ssse3", modifiers=[0x06]) +add_insn("phsubsw", "ssse3", modifiers=[0x07]) +add_insn("psignb", "ssse3", modifiers=[0x08]) +add_insn("psignw", "ssse3", modifiers=[0x09]) +add_insn("psignd", "ssse3", modifiers=[0x0A]) +add_insn("pmulhrsw", "ssse3", modifiers=[0x0B]) +add_insn("pabsb", "ssse3", modifiers=[0x1C]) +add_insn("pabsw", "ssse3", modifiers=[0x1D]) +add_insn("pabsd", "ssse3", modifiers=[0x1E]) + +add_insn("vpshufb", "ssse3", modifiers=[0x00, VEXL0], avx=True) +add_insn("vphaddw", "ssse3", modifiers=[0x01, VEXL0], avx=True) +add_insn("vphaddd", "ssse3", modifiers=[0x02, VEXL0], avx=True) +add_insn("vphaddsw", "ssse3", modifiers=[0x03, VEXL0], avx=True) +add_insn("vpmaddubsw", "ssse3", modifiers=[0x04, VEXL0], avx=True) +add_insn("vphsubw", "ssse3", modifiers=[0x05, VEXL0], avx=True) +add_insn("vphsubd", "ssse3", modifiers=[0x06, VEXL0], avx=True) +add_insn("vphsubsw", "ssse3", modifiers=[0x07, VEXL0], avx=True) +add_insn("vpsignb", "ssse3", modifiers=[0x08, VEXL0], avx=True) +add_insn("vpsignw", "ssse3", modifiers=[0x09, VEXL0], avx=True) +add_insn("vpsignd", "ssse3", modifiers=[0x0A, VEXL0], avx=True) +add_insn("vpmulhrsw", "ssse3", modifiers=[0x0B, VEXL0], avx=True) +# vpabsb/vpabsw/vpabsd are 2 operand only + +add_group("ssse3imm", + cpu=["SSSE3"], + modifiers=["Op2Add"], + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("ssse3imm", + cpu=["SSSE3"], + modifiers=["Op2Add"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("palignr", "ssse3imm", modifiers=[0x0F]) +add_insn("vpalignr", "sse4imm_256avx2", modifiers=[0x0F, VEXL0], avx=True) + +##################################################################### +# SSE4.1 / SSE4.2 instructions +##################################################################### + +add_group("sse4", + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("sse4", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("packusdw", "sse4", modifiers=[0x2B]) +add_insn("pcmpeqq", "sse4", modifiers=[0x29]) +add_insn("pcmpgtq", "sse4", modifiers=[0x37]) +add_insn("phminposuw", "sse4", modifiers=[0x41]) +add_insn("pmaxsb", "sse4", modifiers=[0x3C]) +add_insn("pmaxsd", "sse4", modifiers=[0x3D]) +add_insn("pmaxud", "sse4", modifiers=[0x3F]) +add_insn("pmaxuw", "sse4", modifiers=[0x3E]) +add_insn("pminsb", "sse4", modifiers=[0x38]) +add_insn("pminsd", "sse4", modifiers=[0x39]) +add_insn("pminud", "sse4", modifiers=[0x3B]) +add_insn("pminuw", "sse4", modifiers=[0x3A]) +add_insn("pmuldq", "sse4", modifiers=[0x28]) +add_insn("pmulld", "sse4", modifiers=[0x40]) +add_insn("ptest", "sse4", modifiers=[0x17]) + +# AVX versions use ssse3, and disable MMX version, as they're 3-operand +add_insn("vpackusdw", "ssse3", modifiers=[0x2B, VEXL0], avx=True) +add_insn("vpcmpeqq", "ssse3", modifiers=[0x29, VEXL0], avx=True) +add_insn("vpcmpgtq", "ssse3", modifiers=[0x37, VEXL0], avx=True) +# vphminposuw is 2 operand only +add_insn("vpmaxsb", "ssse3", modifiers=[0x3C, VEXL0], avx=True) +add_insn("vpmaxsd", "ssse3", modifiers=[0x3D, VEXL0], avx=True) +add_insn("vpmaxud", "ssse3", modifiers=[0x3F, VEXL0], avx=True) +add_insn("vpmaxuw", "ssse3", modifiers=[0x3E, VEXL0], avx=True) +add_insn("vpminsb", "ssse3", modifiers=[0x38, VEXL0], avx=True) +add_insn("vpminsd", "ssse3", modifiers=[0x39, VEXL0], avx=True) +add_insn("vpminud", "ssse3", modifiers=[0x3B, VEXL0], avx=True) +add_insn("vpminuw", "ssse3", modifiers=[0x3A, VEXL0], avx=True) +add_insn("vpmuldq", "ssse3", modifiers=[0x28, VEXL0], avx=True) +add_insn("vpmulld", "ssse3", modifiers=[0x40, VEXL0], avx=True) +# vptest uses SSE4 style (2 operand only), and takes 256-bit operands +add_insn("vptest", "sse4", modifiers=[0x17, VEXL0], avx=True) + +add_group("sse4imm_256", + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm_256", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm_256", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="SpareVEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm_256", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +# Same as above except AVX2 required for 256-bit. +add_group("sse4imm_256avx2", + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm_256avx2", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm_256avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="SpareVEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm_256avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +# Version that does not allow YMM registers +add_group("sse4imm", + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("sse4imm", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +for sz in [32, 64]: + add_group("sse4m%dimm" % sz, + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + add_group("sse4m%dimm" % sz, + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + add_group("sse4m%dimm" % sz, + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + add_group("sse4m%dimm" % sz, + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("blendpd", "sse4imm", modifiers=[0x0D]) +add_insn("blendps", "sse4imm", modifiers=[0x0C]) +add_insn("dppd", "sse4imm", modifiers=[0x41]) +add_insn("dpps", "sse4imm", modifiers=[0x40]) +add_insn("mpsadbw", "sse4imm", modifiers=[0x42]) +add_insn("pblendw", "sse4imm", modifiers=[0x0E]) +add_insn("roundpd", "sse4imm", modifiers=[0x09]) +add_insn("roundps", "sse4imm", modifiers=[0x08]) +add_insn("roundsd", "sse4m64imm", modifiers=[0x0B]) +add_insn("roundss", "sse4m32imm", modifiers=[0x0A]) + +# vdppd does not allow YMM registers +# vmpsadbw and vpblendw do not allow YMM registers unless AVX2 +add_insn("vblendpd", "sse4imm_256", modifiers=[0x0D, VEXL0], avx=True) +add_insn("vblendps", "sse4imm_256", modifiers=[0x0C, VEXL0], avx=True) +add_insn("vdppd", "sse4imm", modifiers=[0x41, VEXL0], avx=True) +add_insn("vdpps", "sse4imm_256", modifiers=[0x40, VEXL0], avx=True) +add_insn("vmpsadbw", "sse4imm_256avx2", modifiers=[0x42, VEXL0], avx=True) +add_insn("vpblendw", "sse4imm_256avx2", modifiers=[0x0E, VEXL0], avx=True) +# vroundpd and vroundps don't add another register operand +add_insn("vroundsd", "sse4m64imm", modifiers=[0x0B, VEXL0], avx=True) +add_insn("vroundss", "sse4m32imm", modifiers=[0x0A, VEXL0], avx=True) + +add_group("sse4xmm0", + cpu=["SSE41"], + modifiers=["Op2Add"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("sse4xmm0", + cpu=["SSE41"], + modifiers=["Op2Add"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="XMM0", size=128, dest=None)]) + +add_insn("blendvpd", "sse4xmm0", modifiers=[0x15]) +add_insn("blendvps", "sse4xmm0", modifiers=[0x14]) +add_insn("pblendvb", "sse4xmm0", modifiers=[0x10]) + +# implicit XMM0 can't be VEX-encoded +add_group("avx_sse4xmm0", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) +add_group("avx_sse4xmm0", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEXImmSrc")]) + +add_insn("vblendvpd", "avx_sse4xmm0", modifiers=[0x4B]) +add_insn("vblendvps", "avx_sse4xmm0", modifiers=[0x4A]) + +# vpblendvb didn't have a 256-bit form until AVX2 +add_group("avx2_sse4xmm0", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) +add_group("avx2_sse4xmm0", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEXImmSrc")]) + +add_insn("vpblendvb", "avx2_sse4xmm0", modifiers=[0x4C]) + +for sfx, sz in zip("bwl", [8, 16, 32]): + add_group("crc32", + suffix=sfx, + cpu=["SSE42"], + opersize=sz, + prefix=0xF2, + opcode=[0x0F, 0x38, 0xF0+(sz!=8)], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="RM", size=sz, relaxed=(sz==32), dest="EA")]) +for sfx, sz in zip("bq", [8, 64]): + add_group("crc32", + suffix=sfx, + cpu=["SSE42"], + opersize=64, + prefix=0xF2, + opcode=[0x0F, 0x38, 0xF0+(sz!=8)], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="RM", size=sz, relaxed=(sz==64), dest="EA")]) + +add_insn("crc32", "crc32") + +add_group("extractps", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x17], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("extractps", + cpu=["SSE41"], + modifiers=["SetVEX"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x17], + operands=[Operand(type="Reg", size=64, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("extractps", "extractps") +add_insn("vextractps", "extractps", modifiers=[VEXL0], avx=True) + +add_group("insertps", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x21], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("insertps", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x21], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("insertps", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x21], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("insertps", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x21], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("insertps", "insertps") +add_insn("vinsertps", "insertps", modifiers=[VEXL0], avx=True) + +add_group("movntdqa", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x2A], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) +add_group("movntdqa", + cpu=["AVX2"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x2A], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Mem", size=256, relaxed=True, dest="EA")]) + +add_insn("movntdqa", "movntdqa") +add_insn("vmovntdqa", "movntdqa", modifiers=[VEXL0], avx=True) + +add_group("sse4pcmpstr", + cpu=["SSE42"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pcmpestri", "sse4pcmpstr", modifiers=[0x61]) +add_insn("pcmpestrm", "sse4pcmpstr", modifiers=[0x60]) +add_insn("pcmpistri", "sse4pcmpstr", modifiers=[0x63]) +add_insn("pcmpistrm", "sse4pcmpstr", modifiers=[0x62]) + +add_insn("vpcmpestri", "sse4pcmpstr", modifiers=[0x61, VEXL0], avx=True) +add_insn("vpcmpestrm", "sse4pcmpstr", modifiers=[0x60, VEXL0], avx=True) +add_insn("vpcmpistri", "sse4pcmpstr", modifiers=[0x63, VEXL0], avx=True) +add_insn("vpcmpistrm", "sse4pcmpstr", modifiers=[0x62, VEXL0], avx=True) + +add_group("pextrb", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x14], + operands=[Operand(type="Mem", size=8, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrb", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x14], + operands=[Operand(type="Reg", size=32, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pextrb", + cpu=["SSE41"], + modifiers=["SetVEX"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x14], + operands=[Operand(type="Reg", size=64, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pextrb", "pextrb") +add_insn("vpextrb", "pextrb", modifiers=[VEXL0], avx=True) + +add_group("pextrd", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x16], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pextrd", "pextrd") +add_insn("vpextrd", "pextrd", modifiers=[VEXL0], avx=True) + +add_group("pextrq", + cpu=["SSE41"], + modifiers=["SetVEX"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x16], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pextrq", "pextrq") +add_insn("vpextrq", "pextrq", modifiers=[VEXL0], avx=True) + +add_group("pinsrb", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x20], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Mem", size=8, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrb", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x20], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="Reg", size=32, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrb", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x20], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=8, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrb", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x20], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Reg", size=32, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pinsrb", "pinsrb") +add_insn("vpinsrb", "pinsrb", modifiers=[VEXL0], avx=True) + +add_group("pinsrd", + cpu=["SSE41"], + modifiers=["SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x22], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrd", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x22], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pinsrd", "pinsrd") +add_insn("vpinsrd", "pinsrd", modifiers=[VEXL0], avx=True) + +add_group("pinsrq", + cpu=["SSE41"], + modifiers=["SetVEX"], + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x22], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pinsrq", + cpu=["AVX"], + vex=128, + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x22], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pinsrq", "pinsrq") +add_insn("vpinsrq", "pinsrq", modifiers=[VEXL0], avx=True) + +for sz in [16, 32, 64]: + add_group("sse4m%d" % sz, + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) + add_group("sse4m%d" % sz, + cpu=["SSE41"], + modifiers=["Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + add_group("sse4m%d" % sz, + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Mem", size=sz*2, relaxed=True, dest="EA")]) + add_group("sse4m%d" % sz, + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("pmovsxbw", "sse4m64", modifiers=[0x20]) +add_insn("pmovsxwd", "sse4m64", modifiers=[0x23]) +add_insn("pmovsxdq", "sse4m64", modifiers=[0x25]) +add_insn("pmovzxbw", "sse4m64", modifiers=[0x30]) +add_insn("pmovzxwd", "sse4m64", modifiers=[0x33]) +add_insn("pmovzxdq", "sse4m64", modifiers=[0x35]) + +add_insn("vpmovsxbw", "sse4m64", modifiers=[0x20, VEXL0], avx=True) +add_insn("vpmovsxwd", "sse4m64", modifiers=[0x23, VEXL0], avx=True) +add_insn("vpmovsxdq", "sse4m64", modifiers=[0x25, VEXL0], avx=True) +add_insn("vpmovzxbw", "sse4m64", modifiers=[0x30, VEXL0], avx=True) +add_insn("vpmovzxwd", "sse4m64", modifiers=[0x33, VEXL0], avx=True) +add_insn("vpmovzxdq", "sse4m64", modifiers=[0x35, VEXL0], avx=True) + +add_insn("pmovsxbd", "sse4m32", modifiers=[0x21]) +add_insn("pmovsxwq", "sse4m32", modifiers=[0x24]) +add_insn("pmovzxbd", "sse4m32", modifiers=[0x31]) +add_insn("pmovzxwq", "sse4m32", modifiers=[0x34]) + +add_insn("vpmovsxbd", "sse4m32", modifiers=[0x21, VEXL0], avx=True) +add_insn("vpmovsxwq", "sse4m32", modifiers=[0x24, VEXL0], avx=True) +add_insn("vpmovzxbd", "sse4m32", modifiers=[0x31, VEXL0], avx=True) +add_insn("vpmovzxwq", "sse4m32", modifiers=[0x34, VEXL0], avx=True) + +add_insn("pmovsxbq", "sse4m16", modifiers=[0x22]) +add_insn("pmovzxbq", "sse4m16", modifiers=[0x32]) + +add_insn("vpmovsxbq", "sse4m16", modifiers=[0x22, VEXL0], avx=True) +add_insn("vpmovzxbq", "sse4m16", modifiers=[0x32, VEXL0], avx=True) + +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("cnt", + suffix=sfx, + modifiers=["Op1Add"], + opersize=sz, + prefix=0xF3, + opcode=[0x0F, 0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("popcnt", "cnt", modifiers=[0xB8], cpu=["SSE42"]) + +##################################################################### +# Intel AVX instructions +##################################################################### + +# Most AVX instructions are mixed in with above SSEx groups. +# Some make more sense to have separate groups due to naming conflicts +# that the v-named versions don't have to deal with. +add_group("vmovd", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) +add_group("vmovd", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("vmovd", "vmovd") + +add_group("vmovq", + cpu=["AVX"], + vex=128, + prefix=0xF3, + opcode=[0x0F, 0x7E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("vmovq", + cpu=["AVX"], + vex=128, + prefix=0xF3, + opcode=[0x0F, 0x7E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("vmovq", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0xD6], + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("vmovq", + cpu=["AVX"], + vex=128, + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x6E], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="RM", size=64, relaxed=True, dest="EA")]) +add_group("vmovq", + cpu=["AVX"], + vex=128, + opersize=64, + prefix=0x66, + opcode=[0x0F, 0x7E], + operands=[Operand(type="RM", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("vmovq", "vmovq") + +# Some AVX variants don't add third operand +add_group("avx_xmm_xmm128", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("avx_xmm_xmm128", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("vmovshdup", "avx_xmm_xmm128", modifiers=[0xF3, 0x16]) +add_insn("vmovsldup", "avx_xmm_xmm128", modifiers=[0xF3, 0x12]) +add_insn("vrcpps", "avx_xmm_xmm128", modifiers=[0, 0x53]) +add_insn("vrsqrtps", "avx_xmm_xmm128", modifiers=[0, 0x52]) +add_insn("vsqrtps", "avx_xmm_xmm128", modifiers=[0, 0x51]) +add_insn("vsqrtpd", "avx_xmm_xmm128", modifiers=[0x66, 0x51]) +add_insn("vcvtdq2ps", "avx_xmm_xmm128", modifiers=[0, 0x5B]) +add_insn("vcvtps2dq", "avx_xmm_xmm128", modifiers=[0x66, 0x5B]) +add_insn("vcvttps2dq", "avx_xmm_xmm128", modifiers=[0xF3, 0x5B]) + +add_group("avx_sse4imm", + cpu=["SSE41"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("avx_sse4imm", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("avx_sse4imm", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vroundpd", "avx_sse4imm", modifiers=[0x09]) +add_insn("vroundps", "avx_sse4imm", modifiers=[0x08]) + +add_group("vmovddup", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("vmovddup", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("vmovddup", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("vmovddup", "vmovddup", modifiers=[0xF2, 0x12]) + +# Some xmm_xmm64 combinations only take two operands in AVX +# (VEX.vvvv must be 1111b) +add_group("avx_xmm_xmm64", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("avx_xmm_xmm64", + cpu=["SSE2"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("vcomisd", "avx_xmm_xmm64", modifiers=[0x66, 0x2F], avx=True) +add_insn("vucomisd", "avx_xmm_xmm64", modifiers=[0x66, 0x2E], avx=True) + +# Some xmm_xmm64 combinations only take two operands in AVX +# (VEX.vvvv must be 1111b) +add_group("avx_xmm_xmm32", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("avx_xmm_xmm32", + cpu=["SSE"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +add_insn("vcomiss", "avx_xmm_xmm32", modifiers=[0, 0x2F], avx=True) +add_insn("vucomiss", "avx_xmm_xmm32", modifiers=[0, 0x2E], avx=True) + +# Some conversion functions take ymm, xmm combination +add_group("avx_cvt_xmm64", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("avx_cvt_xmm64", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("avx_cvt_xmm64", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +add_insn("vcvtdq2pd", "avx_cvt_xmm64", modifiers=[0xF3, 0xE6]) +add_insn("vcvtps2pd", "avx_cvt_xmm64", modifiers=[0, 0x5A]) + +# Some SSE3 opcodes are only two operand in AVX +# (VEX.vvvv must be 1111b) +add_group("avx_ssse3_2op", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_insn("vphminposuw", "avx_ssse3_2op", modifiers=[0x41], avx=True) + +# VPABS* are extended to 256-bit in AVX2 +for cpu, sz in zip(["AVX", "AVX2"], [128, 256]): + add_group("avx2_ssse3_2op", + cpu=[cpu], + modifiers=["Op2Add"], + vex=sz, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDRM", size=sz, relaxed=True, dest="EA")]) +add_insn("vpabsb", "avx2_ssse3_2op", modifiers=[0x1C], avx=True) +add_insn("vpabsw", "avx2_ssse3_2op", modifiers=[0x1D], avx=True) +add_insn("vpabsd", "avx2_ssse3_2op", modifiers=[0x1E], avx=True) + +# Some conversion functions take xmm, ymm combination +# Need separate x and y versions for gas mode +add_group("avx_cvt_xmm128_x", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("avx_cvt_xmm128_y", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_group("avx_cvt_xmm128", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA")]) +add_group("avx_cvt_xmm128", + cpu=["AVX"], + modifiers=["PreAdd", "Op1Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=256, dest="EA")]) + +add_insn("vcvtpd2dqx", "avx_cvt_xmm128_x", modifiers=[0xF2, 0xE6], parser="gas") +add_insn("vcvtpd2dqy", "avx_cvt_xmm128_y", modifiers=[0xF2, 0xE6], parser="gas") +add_insn("vcvtpd2dq", "avx_cvt_xmm128", modifiers=[0xF2, 0xE6]) + +add_insn("vcvtpd2psx", "avx_cvt_xmm128_x", modifiers=[0x66, 0x5A], parser="gas") +add_insn("vcvtpd2psy", "avx_cvt_xmm128_y", modifiers=[0x66, 0x5A], parser="gas") +add_insn("vcvtpd2ps", "avx_cvt_xmm128", modifiers=[0x66, 0x5A]) + +add_insn("vcvttpd2dqx", "avx_cvt_xmm128_x", modifiers=[0x66, 0xE6], parser="gas") +add_insn("vcvttpd2dqy", "avx_cvt_xmm128_y", modifiers=[0x66, 0xE6], parser="gas") +add_insn("vcvttpd2dq", "avx_cvt_xmm128", modifiers=[0x66, 0xE6]) + +# Instructions new to AVX +add_insn("vtestps", "sse4", modifiers=[0x0E, VEXL0], avx=True) +add_insn("vtestpd", "sse4", modifiers=[0x0F, VEXL0], avx=True) + +add_group("vbroadcastss", + cpu=["AVX"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x18], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +add_group("vbroadcastss", + cpu=["AVX"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x18], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +add_group("vbroadcastss", + cpu=["AVX2"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x18], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("vbroadcastss", + cpu=["AVX2"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x18], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("vbroadcastss", "vbroadcastss") + +add_group("vbroadcastsd", + cpu=["AVX"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x19], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_group("vbroadcastsd", + cpu=["AVX2"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x19], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("vbroadcastsd", "vbroadcastsd") + +add_group("vbroadcastif128", + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) + +add_insn("vbroadcastf128", "vbroadcastif128", modifiers=[0x1A], cpu=["AVX"]) +add_insn("vbroadcasti128", "vbroadcastif128", modifiers=[0x5A], cpu=["AVX2"]) + +add_group("vextractif128", + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vextractf128", "vextractif128", modifiers=[0x19], cpu=["AVX"]) +add_insn("vextracti128", "vextractif128", modifiers=[0x39], cpu=["AVX2"]) + +add_group("vinsertif128", + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vinsertf128", "vinsertif128", modifiers=[0x18], cpu=["AVX"]) +add_insn("vinserti128", "vinsertif128", modifiers=[0x38], cpu=["AVX2"]) + +add_group("vzero", + cpu=["AVX"], + modifiers=["SetVEX"], + opcode=[0x0F, 0x77], + operands=[]) + +add_insn("vzeroall", "vzero", modifiers=[VEXL1]) +add_insn("vzeroupper", "vzero", modifiers=[VEXL0]) + +add_group("vmaskmov", + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vmaskmov", + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_group("vmaskmov", + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x02], + operands=[Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="Spare")]) +add_group("vmaskmov", + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x02], + operands=[Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDReg", size=256, dest="Spare")]) + +add_insn("vmaskmovps", "vmaskmov", modifiers=[0x2C], cpu=["AVX"]) +add_insn("vmaskmovpd", "vmaskmov", modifiers=[0x2D], cpu=["AVX"]) + +add_group("vpermil", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x38, 0x08], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vpermil", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x38, 0x08], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_group("vpermil", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("vpermil", + cpu=["AVX"], + modifiers=["Op2Add"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vpermilpd", "vpermil", modifiers=[0x05]) +add_insn("vpermilps", "vpermil", modifiers=[0x04]) + +add_group("vperm2f128", + cpu=["AVX"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x06], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vperm2f128", "vperm2f128") + +##################################################################### +# Intel AVX2 instructions +##################################################################### + +# Most AVX2 instructions are mixed in with above SSEx/AVX groups. +# Some make more sense to have separate groups. + +# vex.vvvv=1111b +add_group("vperm_var_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("vpermd", "vperm_var_avx2", modifiers=[0x36]) +add_insn("vpermps", "vperm_var_avx2", modifiers=[0x16]) + +# vex.vvvv=1111b +add_group("vperm_imm_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vpermq", "vperm_imm_avx2", modifiers=[0x00]) +add_insn("vpermpd", "vperm_imm_avx2", modifiers=[0x01]) + +add_group("vperm2i128_avx2", + cpu=["AVX2"], + vex=256, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x46], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vperm2i128", "vperm2i128_avx2") + +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastb_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x78], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=128, relaxed=True, dest="EA")]) +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastb_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x78], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="RM", size=8, relaxed=True, dest="EA")]) + +add_insn("vpbroadcastb", "vpbroadcastb_avx2") + +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastw_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x79], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=128, relaxed=True, dest="EA")]) +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastw_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x79], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="RM", size=16, relaxed=True, dest="EA")]) + +add_insn("vpbroadcastw", "vpbroadcastw_avx2") + +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastd_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x58], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=128, relaxed=True, dest="EA")]) +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastd_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x58], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) + +add_insn("vpbroadcastd", "vpbroadcastd_avx2") + +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastq_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x59], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=128, relaxed=True, dest="EA")]) +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vpbroadcastq_avx2", + cpu=["AVX2"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x59], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) + +add_insn("vpbroadcastq", "vpbroadcastq_avx2") + +for sz in [128, 256]: + add_group("vpshiftv_vexw0_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDRM", size=sz, relaxed=True, dest="EA")]) + +for sz in [128, 256]: + add_group("vpshiftv_vexw1_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=sz, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDRM", size=sz, relaxed=True, dest="EA")]) + +add_insn("vpsrlvd", "vpshiftv_vexw0_avx2", modifiers=[0x45]) +add_insn("vpsrlvq", "vpshiftv_vexw1_avx2", modifiers=[0x45]) +add_insn("vpsravd", "vpshiftv_vexw0_avx2", modifiers=[0x46]) + +add_insn("vpsllvd", "vpshiftv_vexw0_avx2", modifiers=[0x47]) +add_insn("vpsllvq", "vpshiftv_vexw1_avx2", modifiers=[0x47]) + +add_insn("vpmaskmovd", "vmaskmov", modifiers=[0x8C], cpu=["AVX2"]) + +# vex.vvvv=1111b +for sz in [128, 256]: + add_group("vmaskmov_vexw1_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=sz, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDRM", size=sz, relaxed=True, dest="EA")]) + +for sz in [128, 256]: + add_group("vmaskmov_vexw1_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=sz, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x02], + operands=[Operand(type="SIMDRM", size=sz, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDReg", size=sz, dest="Spare")]) + +add_insn("vpmaskmovq", "vmaskmov_vexw1_avx2", modifiers=[0x8C]) + +for sz in [128, 256]: + add_group("vex_66_0F3A_imm8_avx2", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=sz, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=sz, dest="Spare"), + Operand(type="SIMDReg", size=sz, dest="VEX"), + Operand(type="SIMDRM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("vpblendd", "vex_66_0F3A_imm8_avx2", modifiers=[0x02]) + +# Vector register in EA. +add_group("gather_64x_64x", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=128, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="MemXMMIndex", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_group("gather_64x_64x", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="MemXMMIndex", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEX")]) +add_insn("vgatherdpd", "gather_64x_64x", modifiers=[0x92]) +add_insn("vpgatherdq", "gather_64x_64x", modifiers=[0x90]) + +add_group("gather_64x_64y", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=128, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="MemXMMIndex", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_group("gather_64x_64y", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="MemYMMIndex", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEX")]) +add_insn("vgatherqpd", "gather_64x_64y", modifiers=[0x93]) +add_insn("vpgatherqq", "gather_64x_64y", modifiers=[0x91]) + +add_group("gather_32x_32y", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="MemXMMIndex", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_group("gather_32x_32y", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="MemYMMIndex", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEX")]) +add_insn("vgatherdps", "gather_32x_32y", modifiers=[0x92]) +add_insn("vpgatherdd", "gather_32x_32y", modifiers=[0x90]) + +add_group("gather_32x_32y_128", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="MemXMMIndex", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_group("gather_32x_32y_128", + cpu=["AVX2"], + modifiers=["Op2Add"], + vex=256, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="MemYMMIndex", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_insn("vgatherqps", "gather_32x_32y_128", modifiers=[0x93]) +add_insn("vpgatherqd", "gather_32x_32y_128", modifiers=[0x91]) + +##################################################################### +# Intel TSX instructions +##################################################################### +add_prefix("xacquire", "ACQREL", 0xF2) +add_prefix("xrelease", "ACQREL", 0xF3) + +add_group("tsx_xabort", + cpu=["TSX"], + opcode=[0xC6, 0xF8], + operands=[Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_insn("xabort", "tsx_xabort") + + + +add_group("tsx_xbegin", + cpu=["TSX"], + opcode=[0xC7, 0xF8], + operands=[Operand(type="Imm", size=32, tmod="Near", dest="JmpRel")]) + +add_group("tsx_xbegin", + cpu=["TSX"], + opersize=16, + not64=True, #there should not be 16bit xbegin in 64bit mode + opcode=[0xC7, 0xF8], + operands=[Operand(type="Imm", size=16, tmod="Near", dest="JmpRel")]) +add_insn("xbegin", "tsx_xbegin") + +add_group("tsx_0x0F_0x01", + cpu=["TSX"], + modifiers=["Op2Add"], + opcode=[0x0F, 0x01, 0x00], + operands=[]) +add_insn("xend", "tsx_0x0F_0x01", modifiers=[0xD5]) +add_insn("xtest", "tsx_0x0F_0x01", modifiers=[0xD6]) + + + + + +##################################################################### +# Intel FMA instructions +##################################################################### + +### 128/256b FMA PS +add_group("vfma_ps", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=128, + vexw=0, # single precision + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vfma_ps", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=256, + vexw=0, # single precision + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +### 128/256b FMA PD(W=1) +add_group("vfma_pd", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=128, + vexw=1, # double precision + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vfma_pd", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=256, + vexw=1, # double precision + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_group("vfma_ss", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_group("vfma_ss", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +add_group("vfma_sd", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=128, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_group("vfma_sd", + cpu=["FMA"], + modifiers=["Op2Add"], + vex=128, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +for orderval, order in enumerate(["132", "213", "231"]): + ov = orderval << 4 + for combval, comb in enumerate(["ps", "pd", "ss", "sd"]): + cv = combval >> 1 + add_insn("vfmadd"+order+comb, "vfma_"+comb, modifiers=[0x98+ov+cv]) + add_insn("vfmsub"+order+comb, "vfma_"+comb, modifiers=[0x9A+ov+cv]) + add_insn("vfnmsub"+order+comb, "vfma_"+comb, modifiers=[0x9E+ov+cv]) + add_insn("vfnmadd"+order+comb, "vfma_"+comb, modifiers=[0x9C+ov+cv]) + + # no ss/sd for these + for comb in ["ps", "pd"]: + add_insn("vfmaddsub"+order+comb, "vfma_"+comb, modifiers=[0x96+ov]) + add_insn("vfmsubadd"+order+comb, "vfma_"+comb, modifiers=[0x97+ov]) + +##################################################################### +# Intel AES instructions +##################################################################### + +add_group("aes", + cpu=["AES"], + modifiers=["Op1Add", "Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x00, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("aes", + cpu=["AES", "AVX"], + modifiers=["Op1Add", "Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x00, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + + +add_insn("aesenc", "aes", modifiers=[0x38, 0xDC]) +add_insn("aesenclast", "aes", modifiers=[0x38, 0xDD]) +add_insn("aesdec", "aes", modifiers=[0x38, 0xDE]) +add_insn("aesdeclast", "aes", modifiers=[0x38, 0xDF]) + +add_insn("vaesenc", "aes", modifiers=[0x38, 0xDC, VEXL0], avx=True) +add_insn("vaesenclast", "aes", modifiers=[0x38, 0xDD, VEXL0], avx=True) +add_insn("vaesdec", "aes", modifiers=[0x38, 0xDE, VEXL0], avx=True) +add_insn("vaesdeclast", "aes", modifiers=[0x38, 0xDF, VEXL0], avx=True) + +add_group("aesimc", + cpu=["AES"], + modifiers=["Op1Add", "Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x00, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +add_insn("aesimc", "aesimc", modifiers=[0x38, 0xDB]) +add_insn("vaesimc", "aesimc", modifiers=[0x38, 0xDB, VEXL0], avx=True) + + +add_group("aes_imm", + cpu=["AES"], + modifiers=["Op1Add", "Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x00, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("aeskeygenassist", "aes_imm", modifiers=[0x3A, 0xDF]) +add_insn("vaeskeygenassist", "aes_imm", modifiers=[0x3A, 0xDF, VEXL0], + avx=True) + +##################################################################### +# Intel PCLMULQDQ instruction +##################################################################### + +add_group("pclmulqdq", + cpu=["CLMUL"], + modifiers=["Op1Add", "Op2Add", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x00, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("pclmulqdq", + cpu=["CLMUL", "AVX"], + modifiers=["Op1Add", "Op2Add"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x00, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("pclmulqdq", "pclmulqdq", modifiers=[0x3A, 0x44]) +add_insn("vpclmulqdq", "pclmulqdq", modifiers=[0x3A, 0x44, VEXL0], avx=True) + +add_group("pclmulqdq_fixed", + cpu=["CLMUL"], + modifiers=["Imm8", "SetVEX"], + prefix=0x66, + opcode=[0x0F, 0x3A, 0x44], + operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("pclmulqdq_fixed", + cpu=["CLMUL", "AVX"], + modifiers=["Imm8"], + vex=128, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x44], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +for comb, combval in zip(["lql","hql","lqh","hqh"], [0x00,0x01,0x10,0x11]): + add_insn("pclmul"+comb+"qdq", "pclmulqdq_fixed", modifiers=[combval]) + add_insn("vpclmul"+comb+"qdq", "pclmulqdq_fixed", + modifiers=[combval, VEXL0], avx=True) + +##################################################################### +# AVX Post-32nm instructions +##################################################################### + +# RDRAND +add_group("rdrand", + modifiers=['SpAdd'], + opersize=16, + opcode=[0x0F, 0xC7], + operands=[Operand(type="Reg", size=16, dest="EA")]) +add_group("rdrand", + #suffix="l", + modifiers=['SpAdd'], + opersize=32, + opcode=[0x0F, 0xC7], + operands=[Operand(type="Reg", size=32, dest="EA")]) +add_group("rdrand", + modifiers=['SpAdd'], + opersize=64, + opcode=[0x0F, 0xC7], + operands=[Operand(type="Reg", size=64, dest="EA")]) +add_insn("rdrand", "rdrand", modifiers=[6], cpu=["RDRAND"]) +add_insn("rdseed", "rdrand", modifiers=[7], cpu=["RDSEED"]) + +# FSGSBASE instructions +add_group("fs_gs_base", + only64=True, + cpu=["FSGSBASE"], + modifiers=['SpAdd'], + opersize=32, + prefix=0xF3, + opcode=[0x0F, 0xAE], + operands=[Operand(type="Reg", size=32, dest="EA")]) +add_group("fs_gs_base", + only64=True, + cpu=["FSGSBASE"], + opersize=64, + modifiers=['SpAdd'], + prefix=0xF3, + opcode=[0x0F, 0xAE], + operands=[Operand(type="Reg", size=64, dest="EA")]) + +add_insn("rdfsbase", "fs_gs_base", modifiers=[0], only64=True) +add_insn("rdgsbase", "fs_gs_base", modifiers=[1], only64=True) +add_insn("wrfsbase", "fs_gs_base", modifiers=[2], only64=True) +add_insn("wrgsbase", "fs_gs_base", modifiers=[3], only64=True) + +# Float-16 conversion instructions +for g in ['ps2ph', 'ph2ps']: + operands1=[] + operands1.append(Operand(type="SIMDReg", size=128, dest="EA")) + operands1.append(Operand(type="SIMDReg", size=128, dest="Spare")) + + operands2=[] + operands2.append(Operand(type="Mem", size=64, dest="EA")) + operands2.append(Operand(type="SIMDReg", size=128, dest="Spare")) + + operands3=[] + operands3.append(Operand(type="SIMDReg", size=128, dest="EA")) + operands3.append(Operand(type="SIMDReg", size=256, dest="Spare")) + + operands4=[] + operands4.append(Operand(type="Mem", size=128, dest="EA")) + operands4.append(Operand(type="SIMDReg", size=256, dest="Spare")) + + if g == 'ph2ps': + operands1.reverse() + operands2.reverse() + operands3.reverse() + operands4.reverse() + map = 0x38 + elif g == 'ps2ph': + immop = Operand(type="Imm", size=8, relaxed=True, dest="Imm") + operands1.append(immop) + operands2.append(immop) + operands3.append(immop) + operands4.append(immop) + map = 0x3A + + add_group("avx_cvt" + g, + cpu=["F16C", "AVX"], + modifiers=["PreAdd", "Op2Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, map, 0x00], + operands=operands1) + + add_group("avx_cvt" + g, + cpu=["F16C", "AVX"], + modifiers=["PreAdd", "Op2Add"], + vex=128, + prefix=0x00, + opcode=[0x0F, map, 0x00], + operands=operands2) + + add_group("avx_cvt" + g, + cpu=["F16C", "AVX"], + modifiers=["PreAdd", "Op2Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, map, 0x00], + operands=operands3) + + add_group("avx_cvt" + g, + cpu=["F16C", "AVX"], + modifiers=["PreAdd", "Op2Add"], + vex=256, + prefix=0x00, + opcode=[0x0F, map, 0x00], + operands=operands4) + +add_insn("vcvtps2ph", "avx_cvtps2ph", modifiers=[0x66, 0x1D], avx=True) +add_insn("vcvtph2ps", "avx_cvtph2ps", modifiers=[0x66, 0x13], avx=True) + +##################################################################### +# AMD SSE4a instructions +##################################################################### + +add_group("extrq", + cpu=["SSE4a"], + prefix=0x66, + opcode=[0x0F, 0x78], + operands=[Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("extrq", + cpu=["SSE4a"], + prefix=0x66, + opcode=[0x0F, 0x79], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("extrq", "extrq") + +add_group("insertq", + cpu=["SSE4a"], + prefix=0xF2, + opcode=[0x0F, 0x78], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +add_group("insertq", + cpu=["SSE4a"], + prefix=0xF2, + opcode=[0x0F, 0x79], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) + +add_insn("insertq", "insertq") + +add_group("movntsd", + cpu=["SSE4a"], + prefix=0xF2, + opcode=[0x0F, 0x2B], + operands=[Operand(type="Mem", size=64, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("movntsd", "movntsd") + +add_group("movntss", + cpu=["SSE4a"], + prefix=0xF3, + opcode=[0x0F, 0x2B], + operands=[Operand(type="Mem", size=32, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="Spare")]) + +add_insn("movntss", "movntss") + +##################################################################### +# AMD XOP instructions +##################################################################### + +add_group("vfrc_pdps", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + opcode=[0x09, 0x80], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vfrc_pdps", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=256, + opcode=[0x09, 0x80], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) +add_insn("vfrczpd", "vfrc_pdps", modifiers=[0x01]) +add_insn("vfrczps", "vfrc_pdps", modifiers=[0x00]) + +add_group("vfrczsd", + cpu=["XOP"], + xop=128, + opcode=[0x09, 0x83], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("vfrczsd", + cpu=["XOP"], + xop=128, + opcode=[0x09, 0x83], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) +add_insn("vfrczsd", "vfrczsd") + +add_group("vfrczss", + cpu=["XOP"], + xop=128, + opcode=[0x09, 0x82], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="EA")]) +add_group("vfrczss", + cpu=["XOP"], + xop=128, + opcode=[0x09, 0x82], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) +add_insn("vfrczss", "vfrczss") + +add_group("vpcmov", + cpu=["XOP"], + xop=128, + xopw=0, + opcode=[0x08, 0xA2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) +add_group("vpcmov", + cpu=["XOP"], + xop=128, + xopw=1, + opcode=[0x08, 0xA2], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vpcmov", + cpu=["XOP"], + xop=256, + xopw=0, + opcode=[0x08, 0xA2], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEXImmSrc")]) +add_group("vpcmov", + cpu=["XOP"], + xop=256, + xopw=1, + opcode=[0x08, 0xA2], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDReg", size=256, dest="VEXImmSrc"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("vpcmov", "vpcmov") + +add_group("vpcom", + cpu=["XOP"], + modifiers=["Op1Add", "Imm8"], + xop=128, + opcode=[0x08, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vpcom_imm", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + opcode=[0x08, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +for opc, sfx in [(0xCC, "b"), + (0xCE, "d"), + (0xCD, "w"), + (0xCF, "q"), + (0xEC, "ub"), + (0xEE, "ud"), + (0xEF, "uq"), + (0xED, "uw")]: + add_insn("vpcom"+sfx, "vpcom_imm", modifiers=[opc]) + for ib, cc in enumerate(["lt", "le", "gt", "ge", + "eq", "neq", "false", "true"]): + add_insn("vpcom"+cc+sfx, "vpcom", modifiers=[opc, ib]) + # ne alias for neq + add_insn("vpcomne"+sfx, "vpcom", modifiers=[opc, 5]) + +add_group("vphaddsub", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + opcode=[0x09, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) + +add_insn("vphaddbw", "vphaddsub", modifiers=[0xC1]) +add_insn("vphaddbd", "vphaddsub", modifiers=[0xC2]) +add_insn("vphaddbq", "vphaddsub", modifiers=[0xC3]) +add_insn("vphaddwd", "vphaddsub", modifiers=[0xC6]) +add_insn("vphaddwq", "vphaddsub", modifiers=[0xC7]) +add_insn("vphadddq", "vphaddsub", modifiers=[0xCB]) + +add_insn("vphaddubw", "vphaddsub", modifiers=[0xD1]) +add_insn("vphaddubd", "vphaddsub", modifiers=[0xD2]) +add_insn("vphaddubq", "vphaddsub", modifiers=[0xD3]) +add_insn("vphadduwd", "vphaddsub", modifiers=[0xD6]) +add_insn("vphadduwq", "vphaddsub", modifiers=[0xD7]) +add_insn("vphaddudq", "vphaddsub", modifiers=[0xDB]) + +add_insn("vphsubbw", "vphaddsub", modifiers=[0xE1]) +add_insn("vphsubwd", "vphaddsub", modifiers=[0xE2]) +add_insn("vphsubdq", "vphaddsub", modifiers=[0xE3]) + +add_group("vpma", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + opcode=[0x08, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) + +add_insn("vpmacsdd", "vpma", modifiers=[0x9E]) +add_insn("vpmacsdqh", "vpma", modifiers=[0x9F]) +add_insn("vpmacsdql", "vpma", modifiers=[0x97]) +add_insn("vpmacssdd", "vpma", modifiers=[0x8E]) +add_insn("vpmacssdqh", "vpma", modifiers=[0x8F]) +add_insn("vpmacssdql", "vpma", modifiers=[0x87]) +add_insn("vpmacsswd", "vpma", modifiers=[0x86]) +add_insn("vpmacssww", "vpma", modifiers=[0x85]) +add_insn("vpmacswd", "vpma", modifiers=[0x96]) +add_insn("vpmacsww", "vpma", modifiers=[0x95]) +add_insn("vpmadcsswd", "vpma", modifiers=[0xA6]) +add_insn("vpmadcswd", "vpma", modifiers=[0xB6]) + +add_group("vpperm", + cpu=["XOP"], + xop=128, + xopw=0, + opcode=[0x08, 0xA3], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) +add_group("vpperm", + cpu=["XOP"], + xop=128, + xopw=1, + opcode=[0x08, 0xA3], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_insn("vpperm", "vpperm") + +add_group("vprot", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + xopw=0, + opcode=[0x09, 0x90], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_group("vprot", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + xopw=1, + opcode=[0x09, 0x90], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("vprot", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + opcode=[0x08, 0xC0], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) +for opc, sfx in enumerate(["b", "w", "d", "q"]): + add_insn("vprot"+sfx, "vprot", modifiers=[opc]) + +add_group("amd_vpshift", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + xopw=0, + opcode=[0x09, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEX")]) +add_group("amd_vpshift", + cpu=["XOP"], + modifiers=["Op1Add"], + xop=128, + xopw=1, + opcode=[0x09, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +for opc, sfx in enumerate(["b", "w", "d", "q"]): + add_insn("vpsha"+sfx, "amd_vpshift", modifiers=[0x98+opc]) + add_insn("vpshl"+sfx, "amd_vpshift", modifiers=[0x94+opc]) + +##################################################################### +# AMD FMA4 instructions (same as original Intel FMA instructions) +##################################################################### + +add_group("fma_128_256", + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) +add_group("fma_128_256", + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=128, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc"), + Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")]) +add_group("fma_128_256", + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=256, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=256, dest="VEXImmSrc")]) +add_group("fma_128_256", + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=256, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=256, dest="Spare"), + Operand(type="SIMDReg", size=256, dest="VEX"), + Operand(type="SIMDReg", size=256, dest="VEXImmSrc"), + Operand(type="SIMDRM", size=256, relaxed=True, dest="EA")]) + +add_insn("vfmaddpd", "fma_128_256", modifiers=[0x69]) +add_insn("vfmaddps", "fma_128_256", modifiers=[0x68]) +add_insn("vfmaddsubpd", "fma_128_256", modifiers=[0x5D]) +add_insn("vfmaddsubps", "fma_128_256", modifiers=[0x5C]) +add_insn("vfmsubaddpd", "fma_128_256", modifiers=[0x5F]) +add_insn("vfmsubaddps", "fma_128_256", modifiers=[0x5E]) +add_insn("vfmsubpd", "fma_128_256", modifiers=[0x6D]) +add_insn("vfmsubps", "fma_128_256", modifiers=[0x6C]) +add_insn("vfnmaddpd", "fma_128_256", modifiers=[0x79]) +add_insn("vfnmaddps", "fma_128_256", modifiers=[0x78]) +add_insn("vfnmsubpd", "fma_128_256", modifiers=[0x7D]) +add_insn("vfnmsubps", "fma_128_256", modifiers=[0x7C]) + +for sz in [32, 64]: + add_group("fma_128_m%d" % sz, + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) + add_group("fma_128_m%d" % sz, + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=128, + vexw=0, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc")]) + add_group("fma_128_m%d" % sz, + cpu=["FMA4"], + modifiers=["Op2Add"], + vex=128, + vexw=1, + prefix=0x66, + opcode=[0x0F, 0x3A, 0x00], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDReg", size=128, dest="VEX"), + Operand(type="SIMDReg", size=128, dest="VEXImmSrc"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) + +add_insn("vfmaddsd", "fma_128_m64", modifiers=[0x6B]) +add_insn("vfmaddss", "fma_128_m32", modifiers=[0x6A]) +add_insn("vfmsubsd", "fma_128_m64", modifiers=[0x6F]) +add_insn("vfmsubss", "fma_128_m32", modifiers=[0x6E]) +add_insn("vfnmaddsd", "fma_128_m64", modifiers=[0x7B]) +add_insn("vfnmaddss", "fma_128_m32", modifiers=[0x7A]) +add_insn("vfnmsubsd", "fma_128_m64", modifiers=[0x7F]) +add_insn("vfnmsubss", "fma_128_m32", modifiers=[0x7E]) + +##################################################################### +# Intel XSAVE and XSAVEOPT instructions +##################################################################### +add_insn("xgetbv", "threebyte", modifiers=[0x0F, 0x01, 0xD0], + cpu=["XSAVE", "386"]) +add_insn("xsetbv", "threebyte", modifiers=[0x0F, 0x01, 0xD1], + cpu=["XSAVE", "386", "Priv"]) +add_insn("xsave", "twobytemem", modifiers=[4, 0x0F, 0xAE], + cpu=["XSAVE", "386"]) +add_insn("xrstor", "twobytemem", modifiers=[5, 0x0F, 0xAE], + cpu=["XSAVE", "386"]) + +add_insn("xsaveopt", "twobytemem", modifiers=[6, 0x0F, 0xAE], + cpu=["XSAVEOPT"]) + +add_group("xsaveopt64", + modifiers=["SpAdd", "Op0Add", "Op1Add"], + opcode=[0x00, 0x00], + spare=0, + opersize=64, + operands=[Operand(type="Mem", relaxed=True, dest="EA")]) +add_insn("xsaveopt64", "xsaveopt64", modifiers=[6, 0x0F, 0xAE], + cpu=["XSAVEOPT"], only64=True) + +##################################################################### +# Intel MOVBE instruction +##################################################################### +for sfx, sz in zip("wlq", [16, 32, 64]): + add_group("movbe", + cpu=["MOVBE"], + suffix=sfx, + opersize=sz, + opcode=[0x0F, 0x38, 0xF0], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) + add_group("movbe", + cpu=["MOVBE"], + suffix=sfx, + opersize=sz, + opcode=[0x0F, 0x38, 0xF1], + operands=[Operand(type="Mem", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) +add_insn("movbe", "movbe") + +##################################################################### +# Intel advanced bit manipulations (BMI1/2) +##################################################################### + +add_insn("tzcnt", "cnt", modifiers=[0xBC], cpu=["BMI1"]) +# LZCNT is present as AMD ext + +for sfx, sz in zip("lq", [32, 64]): + add_group("vex_gpr_ndd_rm_0F38_regext", + suffix=sfx, + modifiers=["PreAdd", "Op2Add", "SpAdd" ], + opersize=sz, + prefix=0x00, + opcode=[0x0F, 0x38, 0x00], + vex=0, ## VEX.L=0 + operands=[Operand(type="Reg", size=sz, dest="VEX"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + + +add_insn("blsr", "vex_gpr_ndd_rm_0F38_regext", modifiers=[0x00, 0xF3, 1], + cpu=["BMI1"]) +add_insn("blsmsk", "vex_gpr_ndd_rm_0F38_regext", modifiers=[0x00, 0xF3, 2], + cpu=["BMI1"]) +add_insn("blsi", "vex_gpr_ndd_rm_0F38_regext", modifiers=[0x00, 0xF3, 3], + cpu=["BMI1"]) + +for sfx, sz in zip("lq", [32, 64]): + add_group("vex_gpr_reg_rm_0F_imm8", + suffix=sfx, + modifiers=["PreAdd", "Op1Add", "Op2Add"], + opersize=sz, + prefix=0x00, + opcode=[0x0F, 0x00, 0x00], + vex=0, ## VEX.L=0 + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=8, relaxed=True, dest="Imm")]) + +add_insn("rorx", "vex_gpr_reg_rm_0F_imm8", modifiers=[0xF2, 0x3A, 0xF0], + cpu=["BMI2"]) + +for sfx, sz in zip("lq", [32, 64]): # no 16-bit forms + add_group("vex_gpr_reg_nds_rm_0F", + suffix=sfx, + modifiers=["PreAdd", "Op1Add", "Op2Add"], + opersize=sz, + prefix=0x00, + opcode=[0x0F, 0x00, 0x00], + vex=0, + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Reg", size=sz, dest="VEX"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("andn", "vex_gpr_reg_nds_rm_0F", modifiers=[0x00, 0x38, 0xF2], + cpu=["BMI1"]) + +add_insn("pdep", "vex_gpr_reg_nds_rm_0F", modifiers=[0xF2, 0x38, 0xF5], + cpu=["BMI2"]) +add_insn("pext", "vex_gpr_reg_nds_rm_0F", modifiers=[0xF3, 0x38, 0xF5], + cpu=["BMI2"]) + +for sfx, sz in zip("lq", [32, 64]): # no 16-bit forms + add_group("vex_gpr_reg_rm_nds_0F", + suffix=sfx, + modifiers=["PreAdd", "Op1Add", "Op2Add"], + opersize=sz, + prefix=0x00, + opcode=[0x0F, 0x00, 0x00], + vex=0, + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="VEX")]) + +add_insn("bzhi", "vex_gpr_reg_rm_nds_0F", modifiers=[0x00, 0x38, 0xF5], + cpu=["BMI2"]) +add_insn("shlx", "vex_gpr_reg_rm_nds_0F", modifiers=[0x66, 0x38, 0xF7], + cpu=["BMI2"]) +add_insn("shrx", "vex_gpr_reg_rm_nds_0F", modifiers=[0xF2, 0x38, 0xF7], + cpu=["BMI2"]) +add_insn("sarx", "vex_gpr_reg_rm_nds_0F", modifiers=[0xF3, 0x38, 0xF7], + cpu=["BMI2"]) + +add_insn("mulx", "vex_gpr_reg_nds_rm_0F", modifiers=[0xF2, 0x38, 0xF6], + cpu=["BMI2"]) + +for sfx, sz in zip("lq", [32, 64]): # no 16-bit forms + add_group("bextr", + cpu=["BMI1"], + suffix=sfx, + opersize=sz, + prefix=0x00, + opcode=[0x0F, 0x38, 0xF7], + vex=0, + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="VEX")]) + add_group("bextr", # TBM alternate form of bextr + cpu=["TBM"], + suffix=sfx, + opersize=sz, + prefix=0x00, + opcode=[0x0A, 0x10], + xop=128, + xopw=(sz==64), + onlyavx=True, + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA"), + Operand(type="Imm", size=32, relaxed=True, dest="Imm")]) + +add_insn("bextr", "bextr") + +##################################################################### +# Intel INVPCID instruction +##################################################################### +add_group("invpcid", + cpu=["INVPCID", "Priv"], + not64=True, + prefix=0x66, + opcode=[0x0F, 0x38, 0x82], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) +add_group("invpcid", + cpu=["INVPCID", "Priv"], + only64=True, + def_opersize_64=64, + prefix=0x66, + opcode=[0x0F, 0x38, 0x82], + operands=[Operand(type="Reg", size=64, dest="Spare"), + Operand(type="Mem", size=128, relaxed=True, dest="EA")]) +add_insn("invpcid", "invpcid") + + +##################################################################### +# Intel SHA instructions +##################################################################### +add_group("intel_SHA1MSG1", + cpu=["SHA"], + opcode=[0x0F, 0x38, 0xC9], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA", relaxed=True)]) +add_group("intel_SHA1MSG2", + cpu=["SHA"], + opcode=[0x0F, 0x38, 0xCA], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA", relaxed=True)]) +add_group("intel_SHA1NEXTE", + cpu=["SHA"], + opcode=[0x0F, 0x38, 0xC8], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA", relaxed=True)]) +add_group("intel_SHA1RNDS4", + cpu=["SHA"], + opcode=[0x0F, 0x3A, 0xCC], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA", relaxed=True), + Operand(type="Imm", size=8, dest="Imm", relaxed=True)]) +add_group("intel_SHA256MSG1", + cpu=["SHA"], + opcode=[0x0F, 0x38, 0xCC], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA", relaxed=True)]) +add_group("intel_SHA256MSG2", + cpu=["SHA"], + opcode=[0x0F, 0x38, 0xCD], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA", relaxed=True)]) +add_group("intel_SHA256RNDS2", + cpu=["SHA"], + opcode=[0x0F, 0x38, 0xCB], + operands=[Operand(type="SIMDReg", size=128, dest="Spare"), + Operand(type="SIMDRM", size=128, dest="EA")]) + +add_insn("SHA1MSG1", "intel_SHA1MSG1") +add_insn("SHA1MSG2", "intel_SHA1MSG2") +add_insn("SHA1NEXTE", "intel_SHA1NEXTE") +add_insn("SHA1RNDS4", "intel_SHA1RNDS4") +add_insn("SHA256MSG1", "intel_SHA256MSG1") +add_insn("SHA256MSG2", "intel_SHA256MSG2") +add_insn("SHA256RNDS2", "intel_SHA256RNDS2") + +##################################################################### +# Intel SMAP instructions +##################################################################### +add_insn("clac", "threebyte", modifiers=[0x0F, 0x01, 0xCA], cpu=["SMAP"]) +add_insn("stac", "threebyte", modifiers=[0x0F, 0x01, 0xCB], cpu=["SMAP"]) + +##################################################################### +# Intel ADX instructions +##################################################################### +for sfx, sz in zip("lq", [32, 64]): + add_group("vex_gpr_ndd_rm_0F38", + suffix=sfx, + modifiers=["PreAdd", "Op2Add"], + opersize=sz, + prefix=0x00, + opcode=[0x0F, 0x38, 0x00], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("adcx", "vex_gpr_ndd_rm_0F38", modifiers=[0x66, 0xF6], cpu=["ADX"]) +add_insn("adox", "vex_gpr_ndd_rm_0F38", modifiers=[0xF3, 0xF6], cpu=["ADX"]) + + +##################################################################### +# AMD trailing bit manipulation (TBM) +##################################################################### + +for sfx, sz in zip("lq", [32, 64]): # no 16-bit forms + add_group("xop_gpr_reg_rm_09", + cpu=["TBM"], + suffix=sfx, + modifiers=["Op1Add","SpAdd"], + opersize=sz, + prefix=0x00, + opcode=[0x09, 0x00], + xop=128, + xopw=(sz==64), + operands=[Operand(type="Reg", size=sz, dest="VEX"), + Operand(type="RM", size=sz, relaxed=True, dest="EA")]) + +add_insn("blcfill", "xop_gpr_reg_rm_09", modifiers=[0x01, 1]) +add_insn("blci", "xop_gpr_reg_rm_09", modifiers=[0x02, 6]) +add_insn("blcic", "xop_gpr_reg_rm_09", modifiers=[0x01, 5]) +add_insn("blcmsk", "xop_gpr_reg_rm_09", modifiers=[0x02, 1]) +add_insn("blcs", "xop_gpr_reg_rm_09", modifiers=[0x01, 3]) +add_insn("blsfill", "xop_gpr_reg_rm_09", modifiers=[0x01, 2]) +add_insn("blsic", "xop_gpr_reg_rm_09", modifiers=[0x01, 6]) +add_insn("t1mskc", "xop_gpr_reg_rm_09", modifiers=[0x01, 7]) +add_insn("tzmsk", "xop_gpr_reg_rm_09", modifiers=[0x01, 4]) + +##################################################################### +# AMD 3DNow! instructions +##################################################################### + +add_insn("prefetch", "twobytemem", modifiers=[0x00, 0x0F, 0x0D], cpu=["3DNow"]) +add_insn("prefetchw", "twobytemem", modifiers=[0x01, 0x0F, 0x0D], cpu=["PRFCHW"]) +add_insn("femms", "twobyte", modifiers=[0x0F, 0x0E], cpu=["3DNow"]) + +add_group("now3d", + cpu=["3DNow"], + modifiers=["Imm8"], + opcode=[0x0F, 0x0F], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) + +add_insn("pavgusb", "now3d", modifiers=[0xBF]) +add_insn("pf2id", "now3d", modifiers=[0x1D]) +add_insn("pf2iw", "now3d", modifiers=[0x1C], cpu=["Athlon", "3DNow"]) +add_insn("pfacc", "now3d", modifiers=[0xAE]) +add_insn("pfadd", "now3d", modifiers=[0x9E]) +add_insn("pfcmpeq", "now3d", modifiers=[0xB0]) +add_insn("pfcmpge", "now3d", modifiers=[0x90]) +add_insn("pfcmpgt", "now3d", modifiers=[0xA0]) +add_insn("pfmax", "now3d", modifiers=[0xA4]) +add_insn("pfmin", "now3d", modifiers=[0x94]) +add_insn("pfmul", "now3d", modifiers=[0xB4]) +add_insn("pfnacc", "now3d", modifiers=[0x8A], cpu=["Athlon", "3DNow"]) +add_insn("pfpnacc", "now3d", modifiers=[0x8E], cpu=["Athlon", "3DNow"]) +add_insn("pfrcp", "now3d", modifiers=[0x96]) +add_insn("pfrcpit1", "now3d", modifiers=[0xA6]) +add_insn("pfrcpit2", "now3d", modifiers=[0xB6]) +add_insn("pfrsqit1", "now3d", modifiers=[0xA7]) +add_insn("pfrsqrt", "now3d", modifiers=[0x97]) +add_insn("pfsub", "now3d", modifiers=[0x9A]) +add_insn("pfsubr", "now3d", modifiers=[0xAA]) +add_insn("pi2fd", "now3d", modifiers=[0x0D]) +add_insn("pi2fw", "now3d", modifiers=[0x0C], cpu=["Athlon", "3DNow"]) +add_insn("pmulhrw", "now3d", modifiers=[0xB7]) +add_insn("pswapd", "now3d", modifiers=[0xBB], cpu=["Athlon", "3DNow"]) + +##################################################################### +# AMD extensions +##################################################################### + +add_insn("syscall", "twobyte", modifiers=[0x0F, 0x05], cpu=["686", "AMD"]) +for sfx in [None, "l", "q"]: + add_insn("sysret"+(sfx or ""), "twobyte", suffix=sfx, modifiers=[0x0F, 0x07], + cpu=["686", "AMD", "Priv"]) +add_insn("lzcnt", "cnt", modifiers=[0xBD], cpu=["LZCNT"]) + +##################################################################### +# AMD x86-64 extensions +##################################################################### + +add_insn("swapgs", "threebyte", modifiers=[0x0F, 0x01, 0xF8], only64=True) +add_insn("rdtscp", "threebyte", modifiers=[0x0F, 0x01, 0xF9], + cpu=["686", "AMD", "Priv"]) + +add_group("cmpxchg16b", + only64=True, + opersize=64, + opcode=[0x0F, 0xC7], + spare=1, + operands=[Operand(type="Mem", size=128, relaxed=True, dest="EA")]) + +add_insn("cmpxchg16b", "cmpxchg16b") + +##################################################################### +# AMD Pacifica SVM instructions +##################################################################### + +add_insn("clgi", "threebyte", modifiers=[0x0F, 0x01, 0xDD], cpu=["SVM"]) +add_insn("stgi", "threebyte", modifiers=[0x0F, 0x01, 0xDC], cpu=["SVM"]) +add_insn("vmmcall", "threebyte", modifiers=[0x0F, 0x01, 0xD9], cpu=["SVM"]) + +add_group("invlpga", + cpu=["SVM"], + opcode=[0x0F, 0x01, 0xDF], + operands=[]) +add_group("invlpga", + cpu=["SVM"], + opcode=[0x0F, 0x01, 0xDF], + operands=[Operand(type="MemrAX", dest="AdSizeEA"), + Operand(type="Creg", size=32, dest=None)]) + +add_insn("invlpga", "invlpga") + +add_group("skinit", + cpu=["SVM"], + opcode=[0x0F, 0x01, 0xDE], + operands=[]) +add_group("skinit", + cpu=["SVM"], + opcode=[0x0F, 0x01, 0xDE], + operands=[Operand(type="MemEAX", dest=None)]) + +add_insn("skinit", "skinit") + +add_group("svm_rax", + cpu=["SVM"], + modifiers=["Op2Add"], + opcode=[0x0F, 0x01, 0x00], + operands=[]) +add_group("svm_rax", + cpu=["SVM"], + modifiers=["Op2Add"], + opcode=[0x0F, 0x01, 0x00], + operands=[Operand(type="MemrAX", dest="AdSizeEA")]) + +add_insn("vmload", "svm_rax", modifiers=[0xDA]) +add_insn("vmrun", "svm_rax", modifiers=[0xD8]) +add_insn("vmsave", "svm_rax", modifiers=[0xDB]) + + +##################################################################### +# AMD Excavator, new instructions MONITORX, MWAITX +##################################################################### + +add_insn("monitorx", "threebyte", modifiers=[0x0F, 0x01, 0xFA], cpu=["AMD"]) +add_insn("mwaitx", "threebyte", modifiers=[0x0F, 0x01, 0xFB], cpu=["AMD"]) + +##################################################################### +# AMD Zen, new instructions CLZERO +##################################################################### + +add_insn("clzero", "threebyte", modifiers=[0x0F, 0x01, 0xFC], cpu=["AMD"]) + +##################################################################### +# VIA PadLock instructions +##################################################################### + +add_group("padlock", + cpu=["PadLock"], + modifiers=["Imm8", "PreAdd", "Op1Add"], + prefix=0x00, + opcode=[0x0F, 0x00], + operands=[]) + +add_insn("xstore", "padlock", modifiers=[0xC0, 0x00, 0xA7]) +add_insn("xstorerng", "padlock", modifiers=[0xC0, 0x00, 0xA7]) +add_insn("xcryptecb", "padlock", modifiers=[0xC8, 0xF3, 0xA7]) +add_insn("xcryptcbc", "padlock", modifiers=[0xD0, 0xF3, 0xA7]) +add_insn("xcryptctr", "padlock", modifiers=[0xD8, 0xF3, 0xA7]) +add_insn("xcryptcfb", "padlock", modifiers=[0xE0, 0xF3, 0xA7]) +add_insn("xcryptofb", "padlock", modifiers=[0xE8, 0xF3, 0xA7]) +add_insn("montmul", "padlock", modifiers=[0xC0, 0xF3, 0xA6]) +add_insn("xsha1", "padlock", modifiers=[0xC8, 0xF3, 0xA6]) +add_insn("xsha256", "padlock", modifiers=[0xD0, 0xF3, 0xA6]) + +##################################################################### +# Cyrix MMX instructions +##################################################################### + +add_group("cyrixmmx", + cpu=["MMX", "Cyrix"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="SIMDRM", size=64, relaxed=True, dest="EA")]) + +add_insn("paddsiw", "cyrixmmx", modifiers=[0x51]) +add_insn("paveb", "cyrixmmx", modifiers=[0x50]) +add_insn("pdistib", "cyrixmmx", modifiers=[0x54]) +add_insn("pmagw", "cyrixmmx", modifiers=[0x52]) +add_insn("pmulhriw", "cyrixmmx", modifiers=[0x5D]) +add_insn("pmulhrwc", "cyrixmmx", modifiers=[0x59]) +add_insn("pmvgezb", "cyrixmmx", modifiers=[0x5C]) +add_insn("pmvlzb", "cyrixmmx", modifiers=[0x5B]) +add_insn("pmvnzb", "cyrixmmx", modifiers=[0x5A]) +add_insn("pmvzb", "cyrixmmx", modifiers=[0x58]) +add_insn("psubsiw", "cyrixmmx", modifiers=[0x55]) + +add_group("pmachriw", + cpu=["MMX", "Cyrix"], + opcode=[0x0F, 0x5E], + operands=[Operand(type="SIMDReg", size=64, dest="Spare"), + Operand(type="Mem", size=64, relaxed=True, dest="EA")]) + +add_insn("pmachriw", "pmachriw") + +##################################################################### +# Cyrix extensions +##################################################################### + +add_insn("smint", "twobyte", modifiers=[0x0F, 0x38], cpu=["686", "Cyrix"]) +add_insn("smintold", "twobyte", modifiers=[0x0F, 0x7E], cpu=["486", "Cyrix", "Obs"]) + +add_group("rdwrshr", + cpu=["Cyrix", "SMM", "686"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x36], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA")]) + +add_insn("rdshr", "rdwrshr", modifiers=[0x00]) +add_insn("wrshr", "rdwrshr", modifiers=[0x01]) + +add_group("rsdc", + cpu=["Cyrix", "SMM", "486"], + opcode=[0x0F, 0x79], + operands=[Operand(type="SegReg", size=16, relaxed=True, dest="Spare"), + Operand(type="Mem", size=80, relaxed=True, dest="EA")]) + +add_insn("rsdc", "rsdc") + +add_group("cyrixsmm", + cpu=["Cyrix", "SMM", "486"], + modifiers=["Op1Add"], + opcode=[0x0F, 0x00], + operands=[Operand(type="Mem", size=80, relaxed=True, dest="EA")]) + +add_insn("rsldt", "cyrixsmm", modifiers=[0x7B]) +add_insn("rsts", "cyrixsmm", modifiers=[0x7D]) +add_insn("svldt", "cyrixsmm", modifiers=[0x7A]) +add_insn("svts", "cyrixsmm", modifiers=[0x7C]) + +add_group("svdc", + cpu=["Cyrix", "SMM", "486"], + opcode=[0x0F, 0x78], + operands=[Operand(type="Mem", size=80, relaxed=True, dest="EA"), + Operand(type="SegReg", size=16, relaxed=True, dest="Spare")]) + +add_insn("svdc", "svdc") + +##################################################################### +# Obsolete/undocumented instructions +##################################################################### + +add_insn("fsetpm", "twobyte", modifiers=[0xDB, 0xE4], cpu=["286", "FPU", "Obs"]) +add_insn("loadall", "twobyte", modifiers=[0x0F, 0x07], cpu=["386", "Undoc"]) +add_insn("loadall286", "twobyte", modifiers=[0x0F, 0x05], cpu=["286", "Undoc"]) +add_insn("salc", "onebyte", modifiers=[0xD6], cpu=["Undoc"], not64=True) +add_insn("smi", "onebyte", modifiers=[0xF1], cpu=["386", "Undoc"]) + +add_group("ibts", + cpu=["Undoc", "Obs", "386"], + opersize=16, + opcode=[0x0F, 0xA7], + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA"), + Operand(type="Reg", size=16, dest="Spare")]) +add_group("ibts", + cpu=["Undoc", "Obs", "386"], + opersize=32, + opcode=[0x0F, 0xA7], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Reg", size=32, dest="Spare")]) + +add_insn("ibts", "ibts") + +add_group("umov", + cpu=["Undoc", "386"], + opcode=[0x0F, 0x10], + operands=[Operand(type="RM", size=8, relaxed=True, dest="EA"), + Operand(type="Reg", size=8, dest="Spare")]) +add_group("umov", + cpu=["Undoc", "386"], + opersize=16, + opcode=[0x0F, 0x11], + operands=[Operand(type="RM", size=16, relaxed=True, dest="EA"), + Operand(type="Reg", size=16, dest="Spare")]) +add_group("umov", + cpu=["Undoc", "386"], + opersize=32, + opcode=[0x0F, 0x11], + operands=[Operand(type="RM", size=32, relaxed=True, dest="EA"), + Operand(type="Reg", size=32, dest="Spare")]) +add_group("umov", + cpu=["Undoc", "386"], + opcode=[0x0F, 0x12], + operands=[Operand(type="Reg", size=8, dest="Spare"), + Operand(type="RM", size=8, relaxed=True, dest="EA")]) +add_group("umov", + cpu=["Undoc", "386"], + opersize=16, + opcode=[0x0F, 0x13], + operands=[Operand(type="Reg", size=16, dest="Spare"), + Operand(type="RM", size=16, relaxed=True, dest="EA")]) +add_group("umov", + cpu=["Undoc", "386"], + opersize=32, + opcode=[0x0F, 0x13], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="RM", size=32, relaxed=True, dest="EA")]) + +add_insn("umov", "umov") + +add_group("xbts", + cpu=["Undoc", "Obs", "386"], + opersize=16, + opcode=[0x0F, 0xA6], + operands=[Operand(type="Reg", size=16, dest="Spare"), + Operand(type="Mem", size=16, relaxed=True, dest="EA")]) +add_group("xbts", + cpu=["Undoc", "Obs", "386"], + opersize=32, + opcode=[0x0F, 0xA6], + operands=[Operand(type="Reg", size=32, dest="Spare"), + Operand(type="Mem", size=32, relaxed=True, dest="EA")]) + +add_insn("xbts", "xbts") + +finalize_insns() + +##################################################################### +# Prefixes +##################################################################### +# operand size overrides +for sz in [16, 32, 64]: + add_prefix("o%d" % sz, "OPERSIZE", sz, parser="nasm", only64=(sz==64)) + add_prefix("data%d" % sz, "OPERSIZE", sz, parser="gas", only64=(sz==64)) +add_prefix("word", "OPERSIZE", 16, parser="gas") +add_prefix("dword", "OPERSIZE", 32, parser="gas") +add_prefix("qword", "OPERSIZE", 64, parser="gas", only64=True) + +# address size overrides +for sz in [16, 32, 64]: + add_prefix("a%d" % sz, "ADDRSIZE", sz, parser="nasm", only64=(sz==64)) + add_prefix("addr%d" % sz, "ADDRSIZE", sz, parser="gas", only64=(sz==64)) +add_prefix("aword", "ADDRSIZE", 16, parser="gas") +add_prefix("adword", "ADDRSIZE", 32, parser="gas") +add_prefix("aqword", "ADDRSIZE", 64, parser="gas", only64=True) + +# instruction prefixes +add_prefix("lock", "LOCKREP", 0xF0) +add_prefix("repne", "LOCKREP", 0xF2) +add_prefix("repnz", "LOCKREP", 0xF2) +add_prefix("rep", "LOCKREP", 0xF3) +add_prefix("repe", "LOCKREP", 0xF3) +add_prefix("repz", "LOCKREP", 0xF3) + +# other prefixes, limited to GAS-only at the moment +# Hint taken/not taken for jumps +add_prefix("ht", "SEGREG", 0x3E, parser="gas") +add_prefix("hnt", "SEGREG", 0x2E, parser="gas") + +# REX byte explicit prefixes +for val, suf in enumerate(["", "z", "y", "yz", "x", "xz", "xy", "xyz"]): + add_prefix("rex" + suf, "REX", 0x40+val, parser="gas", only64=True) + add_prefix("rex64" + suf, "REX", 0x48+val, parser="gas", only64=True) + +##################################################################### +# Output generation +##################################################################### + +output_groups(open("x86insns.c", "wt")) +output_gas_insns(open("x86insn_gas.gperf", "wt")) +output_nasm_insns(open("x86insn_nasm.gperf", "wt")) + diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index ad735995..c633e6c1 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -1,8 +1,7 @@ -# $Id$ - TESTS += modules/arch/x86/tests/x86_test.sh EXTRA_DIST += modules/arch/x86/tests/x86_test.sh +EXTRA_DIST += modules/arch/x86/tests/gen-fma-test.py EXTRA_DIST += modules/arch/x86/tests/addbyte.asm EXTRA_DIST += modules/arch/x86/tests/addbyte.errwarn EXTRA_DIST += modules/arch/x86/tests/addbyte.hex @@ -11,13 +10,33 @@ EXTRA_DIST += modules/arch/x86/tests/addrop.errwarn EXTRA_DIST += modules/arch/x86/tests/addrop.hex EXTRA_DIST += modules/arch/x86/tests/addrop-err.asm EXTRA_DIST += modules/arch/x86/tests/addrop-err.errwarn +EXTRA_DIST += modules/arch/x86/tests/aes.asm +EXTRA_DIST += modules/arch/x86/tests/aes.hex +EXTRA_DIST += modules/arch/x86/tests/amd200707.asm +EXTRA_DIST += modules/arch/x86/tests/amd200707.hex +EXTRA_DIST += modules/arch/x86/tests/amd-fma4.asm +EXTRA_DIST += modules/arch/x86/tests/amd-fma4.hex EXTRA_DIST += modules/arch/x86/tests/arithsmall.asm EXTRA_DIST += modules/arch/x86/tests/arithsmall.errwarn EXTRA_DIST += modules/arch/x86/tests/arithsmall.hex +EXTRA_DIST += modules/arch/x86/tests/avx.asm +EXTRA_DIST += modules/arch/x86/tests/avx.hex +EXTRA_DIST += modules/arch/x86/tests/avx16.asm +EXTRA_DIST += modules/arch/x86/tests/avx16.hex +EXTRA_DIST += modules/arch/x86/tests/avx2.asm +EXTRA_DIST += modules/arch/x86/tests/avx2.hex +EXTRA_DIST += modules/arch/x86/tests/avxcc.asm +EXTRA_DIST += modules/arch/x86/tests/avxcc.hex EXTRA_DIST += modules/arch/x86/tests/bittest.asm EXTRA_DIST += modules/arch/x86/tests/bittest.hex +EXTRA_DIST += modules/arch/x86/tests/bmi1.asm +EXTRA_DIST += modules/arch/x86/tests/bmi1.hex +EXTRA_DIST += modules/arch/x86/tests/bmi2.asm +EXTRA_DIST += modules/arch/x86/tests/bmi2.hex EXTRA_DIST += modules/arch/x86/tests/bswap64.asm EXTRA_DIST += modules/arch/x86/tests/bswap64.hex +EXTRA_DIST += modules/arch/x86/tests/clmul.asm +EXTRA_DIST += modules/arch/x86/tests/clmul.hex EXTRA_DIST += modules/arch/x86/tests/cmpxchg.asm EXTRA_DIST += modules/arch/x86/tests/cmpxchg.hex EXTRA_DIST += modules/arch/x86/tests/cpubasic-err.asm @@ -41,6 +60,10 @@ EXTRA_DIST += modules/arch/x86/tests/effaddr.hex EXTRA_DIST += modules/arch/x86/tests/enter.asm EXTRA_DIST += modules/arch/x86/tests/enter.errwarn EXTRA_DIST += modules/arch/x86/tests/enter.hex +EXTRA_DIST += modules/arch/x86/tests/eptvpid.asm +EXTRA_DIST += modules/arch/x86/tests/eptvpid.hex +EXTRA_DIST += modules/arch/x86/tests/f16c.asm +EXTRA_DIST += modules/arch/x86/tests/f16c.hex EXTRA_DIST += modules/arch/x86/tests/far64.asm EXTRA_DIST += modules/arch/x86/tests/far64.hex EXTRA_DIST += modules/arch/x86/tests/farbasic.asm @@ -49,10 +72,19 @@ EXTRA_DIST += modules/arch/x86/tests/farithr.asm EXTRA_DIST += modules/arch/x86/tests/farithr.hex EXTRA_DIST += modules/arch/x86/tests/fcmov.asm EXTRA_DIST += modules/arch/x86/tests/fcmov.hex +EXTRA_DIST += modules/arch/x86/tests/fma.asm +EXTRA_DIST += modules/arch/x86/tests/fma.hex +EXTRA_DIST += modules/arch/x86/tests/fsgsbase.asm +EXTRA_DIST += modules/arch/x86/tests/fsgsbase.hex EXTRA_DIST += modules/arch/x86/tests/fwdequ64.asm EXTRA_DIST += modules/arch/x86/tests/fwdequ64.hex EXTRA_DIST += modules/arch/x86/tests/genopcode.asm EXTRA_DIST += modules/arch/x86/tests/genopcode.hex +EXTRA_DIST += modules/arch/x86/tests/imm64.asm +EXTRA_DIST += modules/arch/x86/tests/imm64.errwarn +EXTRA_DIST += modules/arch/x86/tests/imm64.hex +EXTRA_DIST += modules/arch/x86/tests/invpcid.asm +EXTRA_DIST += modules/arch/x86/tests/invpcid.hex EXTRA_DIST += modules/arch/x86/tests/iret.asm EXTRA_DIST += modules/arch/x86/tests/iret.hex EXTRA_DIST += modules/arch/x86/tests/jmp64-1.asm @@ -67,12 +99,20 @@ EXTRA_DIST += modules/arch/x86/tests/jmp64-5.asm EXTRA_DIST += modules/arch/x86/tests/jmp64-5.hex EXTRA_DIST += modules/arch/x86/tests/jmp64-6.asm EXTRA_DIST += modules/arch/x86/tests/jmp64-6.hex -EXTRA_DIST += modules/arch/x86/tests/lds-err.asm -EXTRA_DIST += modules/arch/x86/tests/lds-err.errwarn +EXTRA_DIST += modules/arch/x86/tests/jmpfar.asm +EXTRA_DIST += modules/arch/x86/tests/jmpfar.hex +EXTRA_DIST += modules/arch/x86/tests/larlsl.asm +EXTRA_DIST += modules/arch/x86/tests/larlsl.hex +EXTRA_DIST += modules/arch/x86/tests/lds.asm +EXTRA_DIST += modules/arch/x86/tests/lds.hex +EXTRA_DIST += modules/arch/x86/tests/lfs64.asm +EXTRA_DIST += modules/arch/x86/tests/lfs64.hex EXTRA_DIST += modules/arch/x86/tests/loopadsz.asm EXTRA_DIST += modules/arch/x86/tests/loopadsz.hex EXTRA_DIST += modules/arch/x86/tests/lsahf.asm EXTRA_DIST += modules/arch/x86/tests/lsahf.hex +EXTRA_DIST += modules/arch/x86/tests/lzcnt.asm +EXTRA_DIST += modules/arch/x86/tests/lzcnt.hex EXTRA_DIST += modules/arch/x86/tests/mem64-err.asm EXTRA_DIST += modules/arch/x86/tests/mem64-err.errwarn EXTRA_DIST += modules/arch/x86/tests/mem64.asm @@ -82,6 +122,10 @@ EXTRA_DIST += modules/arch/x86/tests/mem64hi32.asm EXTRA_DIST += modules/arch/x86/tests/mem64hi32.hex EXTRA_DIST += modules/arch/x86/tests/mem64rip.asm EXTRA_DIST += modules/arch/x86/tests/mem64rip.hex +EXTRA_DIST += modules/arch/x86/tests/mixcase.asm +EXTRA_DIST += modules/arch/x86/tests/mixcase.hex +EXTRA_DIST += modules/arch/x86/tests/movbe.asm +EXTRA_DIST += modules/arch/x86/tests/movbe.hex EXTRA_DIST += modules/arch/x86/tests/movdq32.asm EXTRA_DIST += modules/arch/x86/tests/movdq32.hex EXTRA_DIST += modules/arch/x86/tests/movdq64.asm @@ -97,6 +141,9 @@ EXTRA_DIST += modules/arch/x86/tests/nomem64.errwarn EXTRA_DIST += modules/arch/x86/tests/nomem64.hex EXTRA_DIST += modules/arch/x86/tests/o64.asm EXTRA_DIST += modules/arch/x86/tests/o64.hex +EXTRA_DIST += modules/arch/x86/tests/o64loop.asm +EXTRA_DIST += modules/arch/x86/tests/o64loop.errwarn +EXTRA_DIST += modules/arch/x86/tests/o64loop.hex EXTRA_DIST += modules/arch/x86/tests/opersize.asm EXTRA_DIST += modules/arch/x86/tests/opersize.hex EXTRA_DIST += modules/arch/x86/tests/opsize-err.asm @@ -106,6 +153,8 @@ EXTRA_DIST += modules/arch/x86/tests/overflow.errwarn EXTRA_DIST += modules/arch/x86/tests/overflow.hex EXTRA_DIST += modules/arch/x86/tests/padlock.asm EXTRA_DIST += modules/arch/x86/tests/padlock.hex +EXTRA_DIST += modules/arch/x86/tests/pinsrb.asm +EXTRA_DIST += modules/arch/x86/tests/pinsrb.hex EXTRA_DIST += modules/arch/x86/tests/pshift.asm EXTRA_DIST += modules/arch/x86/tests/pshift.hex EXTRA_DIST += modules/arch/x86/tests/push64.asm @@ -118,14 +167,30 @@ EXTRA_DIST += modules/arch/x86/tests/pushf-err.errwarn EXTRA_DIST += modules/arch/x86/tests/pushnosize.asm EXTRA_DIST += modules/arch/x86/tests/pushnosize.errwarn EXTRA_DIST += modules/arch/x86/tests/pushnosize.hex +EXTRA_DIST += modules/arch/x86/tests/rdrnd.asm +EXTRA_DIST += modules/arch/x86/tests/rdrnd.hex EXTRA_DIST += modules/arch/x86/tests/rep.asm EXTRA_DIST += modules/arch/x86/tests/rep.hex EXTRA_DIST += modules/arch/x86/tests/ret.asm EXTRA_DIST += modules/arch/x86/tests/ret.hex +EXTRA_DIST += modules/arch/x86/tests/riprel1.asm +EXTRA_DIST += modules/arch/x86/tests/riprel1.hex +EXTRA_DIST += modules/arch/x86/tests/riprel2.asm +EXTRA_DIST += modules/arch/x86/tests/riprel2.errwarn +EXTRA_DIST += modules/arch/x86/tests/riprel2.hex +EXTRA_DIST += modules/arch/x86/tests/ripseg.asm +EXTRA_DIST += modules/arch/x86/tests/ripseg.errwarn +EXTRA_DIST += modules/arch/x86/tests/ripseg.hex EXTRA_DIST += modules/arch/x86/tests/segmov.asm EXTRA_DIST += modules/arch/x86/tests/segmov.hex +EXTRA_DIST += modules/arch/x86/tests/segoff.asm +EXTRA_DIST += modules/arch/x86/tests/segoff.hex +EXTRA_DIST += modules/arch/x86/tests/segoff-err.asm +EXTRA_DIST += modules/arch/x86/tests/segoff-err.errwarn EXTRA_DIST += modules/arch/x86/tests/shift.asm EXTRA_DIST += modules/arch/x86/tests/shift.hex +EXTRA_DIST += modules/arch/x86/tests/shift64.asm +EXTRA_DIST += modules/arch/x86/tests/shift64.hex EXTRA_DIST += modules/arch/x86/tests/simd-1.asm EXTRA_DIST += modules/arch/x86/tests/simd-1.hex EXTRA_DIST += modules/arch/x86/tests/simd-2.asm @@ -134,6 +199,8 @@ EXTRA_DIST += modules/arch/x86/tests/simd64-1.asm EXTRA_DIST += modules/arch/x86/tests/simd64-1.hex EXTRA_DIST += modules/arch/x86/tests/simd64-2.asm EXTRA_DIST += modules/arch/x86/tests/simd64-2.hex +EXTRA_DIST += modules/arch/x86/tests/smx.asm +EXTRA_DIST += modules/arch/x86/tests/smx.hex EXTRA_DIST += modules/arch/x86/tests/sse-prefix.asm EXTRA_DIST += modules/arch/x86/tests/sse-prefix.hex EXTRA_DIST += modules/arch/x86/tests/sse3.asm @@ -142,6 +209,8 @@ EXTRA_DIST += modules/arch/x86/tests/sse4.asm EXTRA_DIST += modules/arch/x86/tests/sse4.hex EXTRA_DIST += modules/arch/x86/tests/sse4-err.asm EXTRA_DIST += modules/arch/x86/tests/sse4-err.errwarn +EXTRA_DIST += modules/arch/x86/tests/ssewidth.asm +EXTRA_DIST += modules/arch/x86/tests/ssewidth.hex EXTRA_DIST += modules/arch/x86/tests/ssse3.asm EXTRA_DIST += modules/arch/x86/tests/ssse3.c EXTRA_DIST += modules/arch/x86/tests/ssse3.hex @@ -166,12 +235,26 @@ EXTRA_DIST += modules/arch/x86/tests/vmx.asm EXTRA_DIST += modules/arch/x86/tests/vmx.hex EXTRA_DIST += modules/arch/x86/tests/vmx-err.asm EXTRA_DIST += modules/arch/x86/tests/vmx-err.errwarn +EXTRA_DIST += modules/arch/x86/tests/vsib.asm +EXTRA_DIST += modules/arch/x86/tests/vsib.hex +EXTRA_DIST += modules/arch/x86/tests/vsib-err.asm +EXTRA_DIST += modules/arch/x86/tests/vsib-err.errwarn +EXTRA_DIST += modules/arch/x86/tests/vsib2-err.asm +EXTRA_DIST += modules/arch/x86/tests/vsib2-err.errwarn EXTRA_DIST += modules/arch/x86/tests/x86label.asm EXTRA_DIST += modules/arch/x86/tests/x86label.hex EXTRA_DIST += modules/arch/x86/tests/xchg64.asm EXTRA_DIST += modules/arch/x86/tests/xchg64.hex EXTRA_DIST += modules/arch/x86/tests/xmm64.asm EXTRA_DIST += modules/arch/x86/tests/xmm64.hex +EXTRA_DIST += modules/arch/x86/tests/xop-all.asm +EXTRA_DIST += modules/arch/x86/tests/xop-all.hex +EXTRA_DIST += modules/arch/x86/tests/xop-basic.asm +EXTRA_DIST += modules/arch/x86/tests/xop-basic.hex +EXTRA_DIST += modules/arch/x86/tests/xop-cc.asm +EXTRA_DIST += modules/arch/x86/tests/xop-cc.hex +EXTRA_DIST += modules/arch/x86/tests/xsave.asm +EXTRA_DIST += modules/arch/x86/tests/xsave.hex EXTRA_DIST += modules/arch/x86/tests/gas32/Makefile.inc EXTRA_DIST += modules/arch/x86/tests/gas64/Makefile.inc diff --git a/modules/arch/x86/tests/addrop-err.errwarn b/modules/arch/x86/tests/addrop-err.errwarn index 72040ee7..0bf0b548 100644 --- a/modules/arch/x86/tests/addrop-err.errwarn +++ b/modules/arch/x86/tests/addrop-err.errwarn @@ -1 +1 @@ --:2: invalid effective address (displacement size) +-:2: error: invalid effective address (displacement size) diff --git a/modules/arch/x86/tests/adx.asm b/modules/arch/x86/tests/adx.asm new file mode 100644 index 00000000..3feb88e0 --- /dev/null +++ b/modules/arch/x86/tests/adx.asm @@ -0,0 +1,10 @@ +[bits 64] +adcx eax, ebx +adcx ebx, [0] +adcx rax, rbx +adcx rbx, [0] + +adox eax, ebx +adox ebx, [0] +adox rax, rbx +adox rbx, [0] diff --git a/modules/arch/x86/tests/adx.hex b/modules/arch/x86/tests/adx.hex new file mode 100644 index 00000000..f6188af3 --- /dev/null +++ b/modules/arch/x86/tests/adx.hex @@ -0,0 +1,64 @@ +66 +0f +38 +f6 +c3 +66 +0f +38 +f6 +1c +25 +00 +00 +00 +00 +66 +48 +0f +38 +f6 +c3 +66 +48 +0f +38 +f6 +1c +25 +00 +00 +00 +00 +f3 +0f +38 +f6 +c3 +f3 +0f +38 +f6 +1c +25 +00 +00 +00 +00 +f3 +48 +0f +38 +f6 +c3 +f3 +48 +0f +38 +f6 +1c +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/aes.asm b/modules/arch/x86/tests/aes.asm new file mode 100644 index 00000000..52c587d5 --- /dev/null +++ b/modules/arch/x86/tests/aes.asm @@ -0,0 +1,80 @@ +[bits 64] +aesenc xmm1, xmm2 +aesenc xmm1, [rax] +aesenc xmm1, dqword [rax] +aesenc xmm10, xmm12 +aesenc xmm10, [rax+r15*4] +aesenc xmm10, [r14+r15*4] +vaesenc xmm1, xmm2 +vaesenc xmm1, [rax] +vaesenc xmm1, dqword [rax] +vaesenc xmm1, xmm2, xmm3 +vaesenc xmm1, xmm2, [rax] +vaesenc xmm1, xmm2, dqword [rax] + +aesenclast xmm1, xmm2 +aesenclast xmm1, [rax] +aesenclast xmm1, dqword [rax] +vaesenclast xmm1, xmm2 +vaesenclast xmm1, [rax] +vaesenclast xmm1, dqword [rax] +vaesenclast xmm1, xmm2, xmm3 +vaesenclast xmm1, xmm2, [rax] +vaesenclast xmm1, xmm2, dqword [rax] + +aesdec xmm1, xmm2 +aesdec xmm1, [rax] +aesdec xmm1, dqword [rax] +vaesdec xmm1, xmm2 +vaesdec xmm1, [rax] +vaesdec xmm1, dqword [rax] +vaesdec xmm1, xmm2, xmm3 +vaesdec xmm1, xmm2, [rax] +vaesdec xmm1, xmm2, dqword [rax] + +aesdeclast xmm1, xmm2 +aesdeclast xmm1, [rax] +aesdeclast xmm1, dqword [rax] +vaesdeclast xmm1, xmm2 +vaesdeclast xmm1, [rax] +vaesdeclast xmm1, dqword [rax] +vaesdeclast xmm1, xmm2, xmm3 +vaesdeclast xmm1, xmm2, [rax] +vaesdeclast xmm1, xmm2, dqword [rax] + +aesimc xmm1, xmm2 +aesimc xmm1, [rax] +aesimc xmm1, dqword [rax] +vaesimc xmm1, xmm2 +vaesimc xmm1, [rax] +vaesimc xmm1, dqword [rax] +; no 3-operand form + +aeskeygenassist xmm1, xmm2, 5 +aeskeygenassist xmm1, [rax], byte 5 +aeskeygenassist xmm1, dqword [rax], 5 +vaeskeygenassist xmm1, xmm2, 5 +vaeskeygenassist xmm1, [rax], byte 5 +vaeskeygenassist xmm1, dqword [rax], 5 + +pclmulqdq xmm1, xmm2, 5 +pclmulqdq xmm1, [rax], byte 5 +pclmulqdq xmm1, dqword [rax], 5 + +; pclmulqdq variants +pclmullqlqdq xmm1, xmm2 +pclmullqlqdq xmm1, [rax] +pclmullqlqdq xmm1, dqword [rax] + +pclmulhqlqdq xmm1, xmm2 +pclmulhqlqdq xmm1, [rax] +pclmulhqlqdq xmm1, dqword [rax] + +pclmullqhqdq xmm1, xmm2 +pclmullqhqdq xmm1, [rax] +pclmullqhqdq xmm1, dqword [rax] + +pclmulhqhqdq xmm1, xmm2 +pclmulhqhqdq xmm1, [rax] +pclmulhqhqdq xmm1, dqword [rax] + diff --git a/modules/arch/x86/tests/aes.hex b/modules/arch/x86/tests/aes.hex new file mode 100644 index 00000000..6583be83 --- /dev/null +++ b/modules/arch/x86/tests/aes.hex @@ -0,0 +1,356 @@ +66 +0f +38 +dc +ca +66 +0f +38 +dc +08 +66 +0f +38 +dc +08 +66 +45 +0f +38 +dc +d4 +66 +46 +0f +38 +dc +14 +b8 +66 +47 +0f +38 +dc +14 +be +c4 +e2 +71 +dc +ca +c4 +e2 +71 +dc +08 +c4 +e2 +71 +dc +08 +c4 +e2 +69 +dc +cb +c4 +e2 +69 +dc +08 +c4 +e2 +69 +dc +08 +66 +0f +38 +dd +ca +66 +0f +38 +dd +08 +66 +0f +38 +dd +08 +c4 +e2 +71 +dd +ca +c4 +e2 +71 +dd +08 +c4 +e2 +71 +dd +08 +c4 +e2 +69 +dd +cb +c4 +e2 +69 +dd +08 +c4 +e2 +69 +dd +08 +66 +0f +38 +de +ca +66 +0f +38 +de +08 +66 +0f +38 +de +08 +c4 +e2 +71 +de +ca +c4 +e2 +71 +de +08 +c4 +e2 +71 +de +08 +c4 +e2 +69 +de +cb +c4 +e2 +69 +de +08 +c4 +e2 +69 +de +08 +66 +0f +38 +df +ca +66 +0f +38 +df +08 +66 +0f +38 +df +08 +c4 +e2 +71 +df +ca +c4 +e2 +71 +df +08 +c4 +e2 +71 +df +08 +c4 +e2 +69 +df +cb +c4 +e2 +69 +df +08 +c4 +e2 +69 +df +08 +66 +0f +38 +db +ca +66 +0f +38 +db +08 +66 +0f +38 +db +08 +c4 +e2 +79 +db +ca +c4 +e2 +79 +db +08 +c4 +e2 +79 +db +08 +66 +0f +3a +df +ca +05 +66 +0f +3a +df +08 +05 +66 +0f +3a +df +08 +05 +c4 +e3 +79 +df +ca +05 +c4 +e3 +79 +df +08 +05 +c4 +e3 +79 +df +08 +05 +66 +0f +3a +44 +ca +05 +66 +0f +3a +44 +08 +05 +66 +0f +3a +44 +08 +05 +66 +0f +3a +44 +ca +00 +66 +0f +3a +44 +08 +00 +66 +0f +3a +44 +08 +00 +66 +0f +3a +44 +ca +01 +66 +0f +3a +44 +08 +01 +66 +0f +3a +44 +08 +01 +66 +0f +3a +44 +ca +10 +66 +0f +3a +44 +08 +10 +66 +0f +3a +44 +08 +10 +66 +0f +3a +44 +ca +11 +66 +0f +3a +44 +08 +11 +66 +0f +3a +44 +08 +11 diff --git a/modules/arch/x86/tests/amd-fma4.asm b/modules/arch/x86/tests/amd-fma4.asm new file mode 100644 index 00000000..25fdc50d --- /dev/null +++ b/modules/arch/x86/tests/amd-fma4.asm @@ -0,0 +1,109 @@ +[bits 64] +vfmaddpd xmm0, xmm1, xmm2, xmm3 +vfmaddpd xmm0, xmm1, [rax], xmm3 +vfmaddpd xmm0, xmm1, dqword [rax], xmm3 +vfmaddpd xmm0, xmm1, xmm2, [rax] +vfmaddpd xmm0, xmm1, xmm2, dqword [rax] +vfmaddpd ymm0, ymm1, ymm2, ymm3 +vfmaddpd ymm0, ymm1, [rax], ymm3 +vfmaddpd ymm0, ymm1, yword [rax], ymm3 +vfmaddpd ymm0, ymm1, ymm2, [rax] +vfmaddpd ymm0, ymm1, ymm2, yword [rax] + +vfmaddps xmm0, xmm1, xmm2, xmm3 +vfmaddps xmm0, xmm1, dqword [rax], xmm3 +vfmaddps xmm0, xmm1, xmm2, dqword [rax] +vfmaddps ymm0, ymm1, ymm2, ymm3 +vfmaddps ymm0, ymm1, yword [rax], ymm3 +vfmaddps ymm0, ymm1, ymm2, yword [rax] + +vfmaddsd xmm0, xmm1, xmm2, xmm3 +vfmaddsd xmm0, xmm1, [rax], xmm3 +vfmaddsd xmm0, xmm1, qword [rax], xmm3 +vfmaddsd xmm0, xmm1, xmm2, [rax] +vfmaddsd xmm0, xmm1, xmm2, qword [rax] + +vfmaddss xmm0, xmm1, xmm2, xmm3 +vfmaddss xmm0, xmm1, dword [rax], xmm3 +vfmaddss xmm0, xmm1, xmm2, dword [rax] + +vfmaddsubpd xmm0, xmm1, xmm2, xmm3 +vfmaddsubpd xmm0, xmm1, dqword [rax], xmm3 +vfmaddsubpd xmm0, xmm1, xmm2, dqword [rax] +vfmaddsubpd ymm0, ymm1, ymm2, ymm3 +vfmaddsubpd ymm0, ymm1, yword [rax], ymm3 +vfmaddsubpd ymm0, ymm1, ymm2, yword [rax] + +vfmaddsubps xmm0, xmm1, xmm2, xmm3 +vfmaddsubps xmm0, xmm1, dqword [rax], xmm3 +vfmaddsubps xmm0, xmm1, xmm2, dqword [rax] +vfmaddsubps ymm0, ymm1, ymm2, ymm3 +vfmaddsubps ymm0, ymm1, yword [rax], ymm3 +vfmaddsubps ymm0, ymm1, ymm2, yword [rax] + +vfmsubpd xmm0, xmm1, xmm2, xmm3 +vfmsubpd xmm0, xmm1, dqword [rax], xmm3 +vfmsubpd xmm0, xmm1, xmm2, dqword [rax] +vfmsubpd ymm0, ymm1, ymm2, ymm3 +vfmsubpd ymm0, ymm1, yword [rax], ymm3 +vfmsubpd ymm0, ymm1, ymm2, yword [rax] + +vfmsubps xmm0, xmm1, xmm2, xmm3 +vfmsubps xmm0, xmm1, dqword [rax], xmm3 +vfmsubps xmm0, xmm1, xmm2, dqword [rax] +vfmsubps ymm0, ymm1, ymm2, ymm3 +vfmsubps ymm0, ymm1, yword [rax], ymm3 +vfmsubps ymm0, ymm1, ymm2, yword [rax] + +vfmsubsd xmm0, xmm1, xmm2, xmm3 +vfmsubsd xmm0, xmm1, qword [rax], xmm3 +vfmsubsd xmm0, xmm1, xmm2, qword [rax] + +vfmsubss xmm0, xmm1, xmm2, xmm3 +vfmsubss xmm0, xmm1, dword [rax], xmm3 +vfmsubss xmm0, xmm1, xmm2, dword [rax] + +vfnmaddpd xmm0, xmm1, xmm2, xmm3 +vfnmaddpd xmm0, xmm1, dqword [rax], xmm3 +vfnmaddpd xmm0, xmm1, xmm2, dqword [rax] +vfnmaddpd ymm0, ymm1, ymm2, ymm3 +vfnmaddpd ymm0, ymm1, yword [rax], ymm3 +vfnmaddpd ymm0, ymm1, ymm2, yword [rax] + +vfnmaddps xmm0, xmm1, xmm2, xmm3 +vfnmaddps xmm0, xmm1, dqword [rax], xmm3 +vfnmaddps xmm0, xmm1, xmm2, dqword [rax] +vfnmaddps ymm0, ymm1, ymm2, ymm3 +vfnmaddps ymm0, ymm1, yword [rax], ymm3 +vfnmaddps ymm0, ymm1, ymm2, yword [rax] + +vfnmaddsd xmm0, xmm1, xmm2, xmm3 +vfnmaddsd xmm0, xmm1, qword [rax], xmm3 +vfnmaddsd xmm0, xmm1, xmm2, qword [rax] + +vfnmaddss xmm0, xmm1, xmm2, xmm3 +vfnmaddss xmm0, xmm1, dword [rax], xmm3 +vfnmaddss xmm0, xmm1, xmm2, dword [rax] + +vfnmsubpd xmm0, xmm1, xmm2, xmm3 +vfnmsubpd xmm0, xmm1, dqword [rax], xmm3 +vfnmsubpd xmm0, xmm1, xmm2, dqword [rax] +vfnmsubpd ymm0, ymm1, ymm2, ymm3 +vfnmsubpd ymm0, ymm1, yword [rax], ymm3 +vfnmsubpd ymm0, ymm1, ymm2, yword [rax] + +vfnmsubps xmm0, xmm1, xmm2, xmm3 +vfnmsubps xmm0, xmm1, dqword [rax], xmm3 +vfnmsubps xmm0, xmm1, xmm2, dqword [rax] +vfnmsubps ymm0, ymm1, ymm2, ymm3 +vfnmsubps ymm0, ymm1, yword [rax], ymm3 +vfnmsubps ymm0, ymm1, ymm2, yword [rax] + +vfnmsubsd xmm0, xmm1, xmm2, xmm3 +vfnmsubsd xmm0, xmm1, qword [rax], xmm3 +vfnmsubsd xmm0, xmm1, xmm2, qword [rax] + +vfnmsubss xmm0, xmm1, xmm2, xmm3 +vfnmsubss xmm0, xmm1, dword [rax], xmm3 +vfnmsubss xmm0, xmm1, xmm2, dword [rax] + diff --git a/modules/arch/x86/tests/amd-fma4.hex b/modules/arch/x86/tests/amd-fma4.hex new file mode 100644 index 00000000..a1193179 --- /dev/null +++ b/modules/arch/x86/tests/amd-fma4.hex @@ -0,0 +1,540 @@ +c4 +e3 +71 +69 +c2 +30 +c4 +e3 +71 +69 +00 +30 +c4 +e3 +71 +69 +00 +30 +c4 +e3 +f1 +69 +00 +20 +c4 +e3 +f1 +69 +00 +20 +c4 +e3 +75 +69 +c2 +30 +c4 +e3 +75 +69 +00 +30 +c4 +e3 +75 +69 +00 +30 +c4 +e3 +f5 +69 +00 +20 +c4 +e3 +f5 +69 +00 +20 +c4 +e3 +71 +68 +c2 +30 +c4 +e3 +71 +68 +00 +30 +c4 +e3 +f1 +68 +00 +20 +c4 +e3 +75 +68 +c2 +30 +c4 +e3 +75 +68 +00 +30 +c4 +e3 +f5 +68 +00 +20 +c4 +e3 +71 +6b +c2 +30 +c4 +e3 +71 +6b +00 +30 +c4 +e3 +71 +6b +00 +30 +c4 +e3 +f1 +6b +00 +20 +c4 +e3 +f1 +6b +00 +20 +c4 +e3 +71 +6a +c2 +30 +c4 +e3 +71 +6a +00 +30 +c4 +e3 +f1 +6a +00 +20 +c4 +e3 +71 +5d +c2 +30 +c4 +e3 +71 +5d +00 +30 +c4 +e3 +f1 +5d +00 +20 +c4 +e3 +75 +5d +c2 +30 +c4 +e3 +75 +5d +00 +30 +c4 +e3 +f5 +5d +00 +20 +c4 +e3 +71 +5c +c2 +30 +c4 +e3 +71 +5c +00 +30 +c4 +e3 +f1 +5c +00 +20 +c4 +e3 +75 +5c +c2 +30 +c4 +e3 +75 +5c +00 +30 +c4 +e3 +f5 +5c +00 +20 +c4 +e3 +71 +6d +c2 +30 +c4 +e3 +71 +6d +00 +30 +c4 +e3 +f1 +6d +00 +20 +c4 +e3 +75 +6d +c2 +30 +c4 +e3 +75 +6d +00 +30 +c4 +e3 +f5 +6d +00 +20 +c4 +e3 +71 +6c +c2 +30 +c4 +e3 +71 +6c +00 +30 +c4 +e3 +f1 +6c +00 +20 +c4 +e3 +75 +6c +c2 +30 +c4 +e3 +75 +6c +00 +30 +c4 +e3 +f5 +6c +00 +20 +c4 +e3 +71 +6f +c2 +30 +c4 +e3 +71 +6f +00 +30 +c4 +e3 +f1 +6f +00 +20 +c4 +e3 +71 +6e +c2 +30 +c4 +e3 +71 +6e +00 +30 +c4 +e3 +f1 +6e +00 +20 +c4 +e3 +71 +79 +c2 +30 +c4 +e3 +71 +79 +00 +30 +c4 +e3 +f1 +79 +00 +20 +c4 +e3 +75 +79 +c2 +30 +c4 +e3 +75 +79 +00 +30 +c4 +e3 +f5 +79 +00 +20 +c4 +e3 +71 +78 +c2 +30 +c4 +e3 +71 +78 +00 +30 +c4 +e3 +f1 +78 +00 +20 +c4 +e3 +75 +78 +c2 +30 +c4 +e3 +75 +78 +00 +30 +c4 +e3 +f5 +78 +00 +20 +c4 +e3 +71 +7b +c2 +30 +c4 +e3 +71 +7b +00 +30 +c4 +e3 +f1 +7b +00 +20 +c4 +e3 +71 +7a +c2 +30 +c4 +e3 +71 +7a +00 +30 +c4 +e3 +f1 +7a +00 +20 +c4 +e3 +71 +7d +c2 +30 +c4 +e3 +71 +7d +00 +30 +c4 +e3 +f1 +7d +00 +20 +c4 +e3 +75 +7d +c2 +30 +c4 +e3 +75 +7d +00 +30 +c4 +e3 +f5 +7d +00 +20 +c4 +e3 +71 +7c +c2 +30 +c4 +e3 +71 +7c +00 +30 +c4 +e3 +f1 +7c +00 +20 +c4 +e3 +75 +7c +c2 +30 +c4 +e3 +75 +7c +00 +30 +c4 +e3 +f5 +7c +00 +20 +c4 +e3 +71 +7f +c2 +30 +c4 +e3 +71 +7f +00 +30 +c4 +e3 +f1 +7f +00 +20 +c4 +e3 +71 +7e +c2 +30 +c4 +e3 +71 +7e +00 +30 +c4 +e3 +f1 +7e +00 +20 diff --git a/modules/arch/x86/tests/amd200707.asm b/modules/arch/x86/tests/amd200707.asm new file mode 100644 index 00000000..42c26a3c --- /dev/null +++ b/modules/arch/x86/tests/amd200707.asm @@ -0,0 +1,31 @@ +bits 64 +extrq xmm0, 5, 4 +extrq xmm6, 0, 7 +extrq xmm2, xmm3 +insertq xmm0, xmm1, 5, 4 +insertq xmm5, xmm6, 0, 7 +insertq xmm2, xmm3 +movntsd [0], xmm1 +movntsd qword [0], xmm5 +movntss [0], xmm3 +movntss dword [0], xmm7 + +lzcnt ax, bx +lzcnt cx, word [0] +lzcnt dx, [0] +lzcnt eax, ebx +lzcnt ecx, dword [0] +lzcnt edx, [0] +lzcnt rax, rbx +lzcnt rcx, qword [0] +lzcnt rdx, [0] + +popcnt ax, bx +popcnt cx, word [0] +popcnt dx, [0] +popcnt eax, ebx +popcnt ecx, dword [0] +popcnt edx, [0] +popcnt rax, rbx +popcnt rcx, qword [0] +popcnt rdx, [0] diff --git a/modules/arch/x86/tests/amd200707.hex b/modules/arch/x86/tests/amd200707.hex new file mode 100644 index 00000000..28b58a12 --- /dev/null +++ b/modules/arch/x86/tests/amd200707.hex @@ -0,0 +1,212 @@ +66 +0f +78 +c0 +05 +04 +66 +0f +78 +c6 +00 +07 +66 +0f +79 +d3 +f2 +0f +78 +c1 +05 +04 +f2 +0f +78 +ee +00 +07 +f2 +0f +79 +d3 +f2 +0f +2b +0c +25 +00 +00 +00 +00 +f2 +0f +2b +2c +25 +00 +00 +00 +00 +f3 +0f +2b +1c +25 +00 +00 +00 +00 +f3 +0f +2b +3c +25 +00 +00 +00 +00 +66 +f3 +0f +bd +c3 +66 +f3 +0f +bd +0c +25 +00 +00 +00 +00 +66 +f3 +0f +bd +14 +25 +00 +00 +00 +00 +f3 +0f +bd +c3 +f3 +0f +bd +0c +25 +00 +00 +00 +00 +f3 +0f +bd +14 +25 +00 +00 +00 +00 +f3 +48 +0f +bd +c3 +f3 +48 +0f +bd +0c +25 +00 +00 +00 +00 +f3 +48 +0f +bd +14 +25 +00 +00 +00 +00 +66 +f3 +0f +b8 +c3 +66 +f3 +0f +b8 +0c +25 +00 +00 +00 +00 +66 +f3 +0f +b8 +14 +25 +00 +00 +00 +00 +f3 +0f +b8 +c3 +f3 +0f +b8 +0c +25 +00 +00 +00 +00 +f3 +0f +b8 +14 +25 +00 +00 +00 +00 +f3 +48 +0f +b8 +c3 +f3 +48 +0f +b8 +0c +25 +00 +00 +00 +00 +f3 +48 +0f +b8 +14 +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/avx.asm b/modules/arch/x86/tests/avx.asm new file mode 100644 index 00000000..eff8cc97 --- /dev/null +++ b/modules/arch/x86/tests/avx.asm @@ -0,0 +1,2617 @@ +; Exhaustive test of AVX instructions +; Also includes based-upon SSE instructions for comparison +; +; Copyright (C) 2008 Peter Johnson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; 1. Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; + +[bits 64] +addpd xmm1, xmm2 +addpd xmm1, [rax] +addpd xmm1, dqword [rax] +addpd xmm10, xmm12 +addpd xmm10, [rax+r15*4] +addpd xmm10, [r14+r15*4] + +vaddpd xmm1, xmm2 +vaddpd xmm1, [rax] +vaddpd xmm1, dqword [rax] +vaddpd xmm10, xmm12 +vaddpd xmm10, [rax+r15*4] +vaddpd xmm10, [r14+r15*4] + +vaddpd xmm1, xmm2, xmm3 +vaddpd xmm1, xmm2, [rax] +vaddpd xmm1, xmm2, dqword [rax] +vaddpd xmm10, xmm12, xmm13 +vaddpd xmm10, xmm12, [rax+r15*4] +vaddpd xmm10, xmm12, [r14+r15*4] + +vaddpd ymm1, ymm2, ymm3 +vaddpd ymm1, ymm2, [rax] +vaddpd ymm1, ymm2, yword [rax] +vaddpd ymm10, ymm12, ymm13 +vaddpd ymm10, ymm12, [rax+r15*4] +vaddpd ymm10, ymm12, [r14+r15*4] + +; Further instructions won't test high 8 registers (validated above) +addps xmm1, xmm2 +addps xmm1, [rax] +addps xmm1, dqword [rax] +vaddps xmm1, xmm2 +vaddps xmm1, [rax] +vaddps xmm1, dqword [rax] +vaddps xmm1, xmm2, xmm3 +vaddps xmm1, xmm2, [rax] +vaddps xmm1, xmm2, dqword [rax] +vaddps ymm1, ymm2, ymm3 +vaddps ymm1, ymm2, [rax] +vaddps ymm1, ymm2, yword [rax] + +addsd xmm1, xmm2 +addsd xmm1, [rax] +addsd xmm1, qword [rax] +vaddsd xmm1, xmm2 +vaddsd xmm1, [rax] +vaddsd xmm1, qword [rax] +vaddsd xmm1, xmm2, xmm3 +vaddsd xmm1, xmm2, [rax] +vaddsd xmm1, xmm2, qword [rax] + +addss xmm1, xmm2 +addss xmm1, [rax] +addss xmm1, dword [rax] +vaddss xmm1, xmm2 +vaddss xmm1, [rax] +vaddss xmm1, dword [rax] +vaddss xmm1, xmm2, xmm3 +vaddss xmm1, xmm2, [rax] +vaddss xmm1, xmm2, dword [rax] + +addsubpd xmm1, xmm2 +addsubpd xmm1, [rax] +addsubpd xmm1, dqword [rax] +vaddsubpd xmm1, xmm2 +vaddsubpd xmm1, [rax] +vaddsubpd xmm1, dqword [rax] +vaddsubpd xmm1, xmm2, xmm3 +vaddsubpd xmm1, xmm2, [rax] +vaddsubpd xmm1, xmm2, dqword [rax] +vaddsubpd ymm1, ymm2, ymm3 +vaddsubpd ymm1, ymm2, [rax] +vaddsubpd ymm1, ymm2, yword [rax] + +addsubps xmm1, xmm2 +addsubps xmm1, [rax] +addsubps xmm1, dqword [rax] +vaddsubps xmm1, xmm2 +vaddsubps xmm1, [rax] +vaddsubps xmm1, dqword [rax] +vaddsubps xmm1, xmm2, xmm3 +vaddsubps xmm1, xmm2, [rax] +vaddsubps xmm1, xmm2, dqword [rax] +vaddsubps ymm1, ymm2, ymm3 +vaddsubps ymm1, ymm2, [rax] +vaddsubps ymm1, ymm2, yword [rax] + +andpd xmm1, xmm2 +andpd xmm1, [rax] +andpd xmm1, dqword [rax] +vandpd xmm1, xmm2 +vandpd xmm1, [rax] +vandpd xmm1, dqword [rax] +vandpd xmm1, xmm2, xmm3 +vandpd xmm1, xmm2, [rax] +vandpd xmm1, xmm2, dqword [rax] +vandpd ymm1, ymm2, ymm3 +vandpd ymm1, ymm2, [rax] +vandpd ymm1, ymm2, yword [rax] + +andps xmm1, xmm2 +andps xmm1, [rax] +andps xmm1, dqword [rax] +vandps xmm1, xmm2 +vandps xmm1, [rax] +vandps xmm1, dqword [rax] +vandps xmm1, xmm2, xmm3 +vandps xmm1, xmm2, [rax] +vandps xmm1, xmm2, dqword [rax] +vandps ymm1, ymm2, ymm3 +vandps ymm1, ymm2, [rax] +vandps ymm1, ymm2, yword [rax] + +andnpd xmm1, xmm2 +andnpd xmm1, [rax] +andnpd xmm1, dqword [rax] +vandnpd xmm1, xmm2 +vandnpd xmm1, [rax] +vandnpd xmm1, dqword [rax] +vandnpd xmm1, xmm2, xmm3 +vandnpd xmm1, xmm2, [rax] +vandnpd xmm1, xmm2, dqword [rax] +vandnpd ymm1, ymm2, ymm3 +vandnpd ymm1, ymm2, [rax] +vandnpd ymm1, ymm2, yword [rax] + +andnps xmm1, xmm2 +andnps xmm1, [rax] +andnps xmm1, dqword [rax] +vandnps xmm1, xmm2 +vandnps xmm1, [rax] +vandnps xmm1, dqword [rax] +vandnps xmm1, xmm2, xmm3 +vandnps xmm1, xmm2, [rax] +vandnps xmm1, xmm2, dqword [rax] +vandnps ymm1, ymm2, ymm3 +vandnps ymm1, ymm2, [rax] +vandnps ymm1, ymm2, yword [rax] + +blendpd xmm1, xmm2, 5 +blendpd xmm1, [rax], byte 5 +blendpd xmm1, dqword [rax], 5 +vblendpd xmm1, xmm2, 5 +vblendpd xmm1, [rax], byte 5 +vblendpd xmm1, dqword [rax], 5 +vblendpd xmm1, xmm2, xmm3, 5 +vblendpd xmm1, xmm2, [rax], byte 5 +vblendpd xmm1, xmm2, dqword [rax], 5 +vblendpd ymm1, ymm2, ymm3, 5 +vblendpd ymm1, ymm2, [rax], byte 5 +vblendpd ymm1, ymm2, yword [rax], 5 + +blendps xmm1, xmm2, 5 +blendps xmm1, [rax], byte 5 +blendps xmm1, dqword [rax], 5 +vblendps xmm1, xmm2, 5 +vblendps xmm1, [rax], byte 5 +vblendps xmm1, dqword [rax], 5 +vblendps xmm1, xmm2, xmm3, 5 +vblendps xmm1, xmm2, [rax], byte 5 +vblendps xmm1, xmm2, dqword [rax], 5 +vblendps ymm1, ymm2, ymm3, 5 +vblendps ymm1, ymm2, [rax], byte 5 +vblendps ymm1, ymm2, yword [rax], 5 + +; blendvpd doesn't have vex-encoded version of implicit xmm0 +blendvpd xmm1, xmm3 +blendvpd xmm1, [rax] +blendvpd xmm1, dqword [rax] +blendvpd xmm1, xmm3, xmm0 +blendvpd xmm1, [rax], xmm0 +blendvpd xmm1, dqword [rax], xmm0 +vblendvpd xmm1, xmm2, xmm3, xmm4 +vblendvpd xmm1, xmm2, [rax], xmm4 +vblendvpd xmm1, xmm2, dqword [rax], xmm4 +vblendvpd ymm1, ymm2, ymm3, ymm4 +vblendvpd ymm1, ymm2, [rax], ymm4 +vblendvpd ymm1, ymm2, yword [rax], ymm4 + +; blendvps doesn't have vex-encoded version of implicit xmm0 +blendvps xmm1, xmm3 +blendvps xmm1, [rax] +blendvps xmm1, dqword [rax] +blendvps xmm1, xmm3, xmm0 +blendvps xmm1, [rax], xmm0 +blendvps xmm1, dqword [rax], xmm0 +vblendvps xmm1, xmm2, xmm3, xmm4 +vblendvps xmm1, xmm2, [rax], xmm4 +vblendvps xmm1, xmm2, dqword [rax], xmm4 +vblendvps ymm1, ymm2, ymm3, ymm4 +vblendvps ymm1, ymm2, [rax], ymm4 +vblendvps ymm1, ymm2, yword [rax], ymm4 + +vbroadcastss xmm1, [rax] +vbroadcastss xmm1, dword [rax] +vbroadcastss ymm1, [rax] +vbroadcastss ymm1, dword [rax] + +vbroadcastsd ymm1, [rax] +vbroadcastsd ymm1, qword [rax] + +vbroadcastf128 ymm1, [rax] +vbroadcastf128 ymm1, dqword [rax] + +cmppd xmm1, xmm2, 5 +cmppd xmm1, [rax], byte 5 +cmppd xmm1, dqword [rax], 5 +vcmppd xmm1, xmm2, 5 +vcmppd xmm1, [rax], byte 5 +vcmppd xmm1, dqword [rax], 5 +vcmppd xmm1, xmm2, xmm3, 5 +vcmppd xmm1, xmm2, [rax], byte 5 +vcmppd xmm1, xmm2, dqword [rax], 5 +vcmppd ymm1, ymm2, ymm3, 5 +vcmppd ymm1, ymm2, [rax], byte 5 +vcmppd ymm1, ymm2, yword [rax], 5 + +cmpps xmm1, xmm2, 5 +cmpps xmm1, [rax], byte 5 +cmpps xmm1, dqword [rax], 5 +vcmpps xmm1, xmm2, 5 +vcmpps xmm1, [rax], byte 5 +vcmpps xmm1, dqword [rax], 5 +vcmpps xmm1, xmm2, xmm3, 5 +vcmpps xmm1, xmm2, [rax], byte 5 +vcmpps xmm1, xmm2, dqword [rax], 5 +vcmpps ymm1, ymm2, ymm3, 5 +vcmpps ymm1, ymm2, [rax], byte 5 +vcmpps ymm1, ymm2, yword [rax], 5 + +cmpsd xmm1, xmm2, 5 +cmpsd xmm1, [rax], byte 5 +cmpsd xmm1, qword [rax], 5 +vcmpsd xmm1, xmm2, 5 +vcmpsd xmm1, [rax], byte 5 +vcmpsd xmm1, qword [rax], 5 +vcmpsd xmm1, xmm2, xmm3, 5 +vcmpsd xmm1, xmm2, [rax], byte 5 +vcmpsd xmm1, xmm2, qword [rax], 5 + +cmpss xmm1, xmm2, 5 +cmpss xmm1, [rax], byte 5 +cmpss xmm1, dword [rax], 5 +vcmpss xmm1, xmm2, 5 +vcmpss xmm1, [rax], byte 5 +vcmpss xmm1, dword [rax], 5 +vcmpss xmm1, xmm2, xmm3, 5 +vcmpss xmm1, xmm2, [rax], byte 5 +vcmpss xmm1, xmm2, dword [rax], 5 + +comisd xmm1, xmm2 +comisd xmm1, [rax] +comisd xmm1, qword [rax] +vcomisd xmm1, xmm2 +vcomisd xmm1, [rax] +vcomisd xmm1, qword [rax] + +comiss xmm1, xmm2 +comiss xmm1, [rax] +comiss xmm1, dword [rax] +vcomiss xmm1, xmm2 +vcomiss xmm1, [rax] +vcomiss xmm1, dword [rax] + +cvtdq2pd xmm1, xmm2 +cvtdq2pd xmm1, [rax] +cvtdq2pd xmm1, qword [rax] +vcvtdq2pd xmm1, xmm2 +vcvtdq2pd xmm1, [rax] +vcvtdq2pd xmm1, qword [rax] +vcvtdq2pd ymm1, xmm2 +vcvtdq2pd ymm1, [rax] +vcvtdq2pd ymm1, dqword [rax] + +cvtdq2ps xmm1, xmm2 +cvtdq2ps xmm1, [rax] +cvtdq2ps xmm1, dqword [rax] +vcvtdq2ps xmm1, xmm2 +vcvtdq2ps xmm1, [rax] +vcvtdq2ps xmm1, dqword [rax] +vcvtdq2ps ymm1, ymm2 +vcvtdq2ps ymm1, [rax] +vcvtdq2ps ymm1, yword [rax] + +; These require memory operand size to be specified (in AVX version) +cvtpd2dq xmm1, xmm2 +cvtpd2dq xmm1, [rax] +cvtpd2dq xmm1, dqword [rax] +vcvtpd2dq xmm1, xmm2 +vcvtpd2dq xmm1, dqword [rax] +vcvtpd2dq xmm1, ymm2 +vcvtpd2dq xmm1, yword [rax] + +cvtpd2ps xmm1, xmm2 +cvtpd2ps xmm1, [rax] +cvtpd2ps xmm1, dqword [rax] +vcvtpd2ps xmm1, xmm2 +vcvtpd2ps xmm1, dqword [rax] +vcvtpd2ps xmm1, ymm2 +vcvtpd2ps xmm1, yword [rax] + +cvtps2dq xmm1, xmm2 +cvtps2dq xmm1, [rax] +cvtps2dq xmm1, dqword [rax] +vcvtps2dq xmm1, xmm2 +vcvtps2dq xmm1, [rax] +vcvtps2dq xmm1, dqword [rax] +vcvtps2dq ymm1, ymm2 +vcvtps2dq ymm1, [rax] +vcvtps2dq ymm1, yword [rax] + +cvtps2pd xmm1, xmm2 +cvtps2pd xmm1, [rax] +cvtps2pd xmm1, qword [rax] +vcvtps2pd xmm1, xmm2 +vcvtps2pd xmm1, [rax] +vcvtps2pd xmm1, qword [rax] +vcvtps2pd ymm1, xmm2 +vcvtps2pd ymm1, [rax] +vcvtps2pd ymm1, dqword [rax] + +cvtsd2si eax, xmm2 +cvtsd2si eax, [rax] +cvtsd2si eax, qword [rax] +vcvtsd2si eax, xmm2 +vcvtsd2si eax, [rax] +vcvtsd2si eax, qword [rax] +cvtsd2si rax, xmm2 +cvtsd2si rax, [rax] +cvtsd2si rax, qword [rax] +vcvtsd2si rax, xmm2 +vcvtsd2si rax, [rax] +vcvtsd2si rax, qword [rax] + +cvtsd2ss xmm1, xmm2 +cvtsd2ss xmm1, [rax] +cvtsd2ss xmm1, qword [rax] +vcvtsd2ss xmm1, xmm2 +vcvtsd2ss xmm1, [rax] +vcvtsd2ss xmm1, qword [rax] +vcvtsd2ss xmm1, xmm2, xmm3 +vcvtsd2ss xmm1, xmm2, [rax] +vcvtsd2ss xmm1, xmm2, qword [rax] + +; unsized not valid +cvtsi2sd xmm1, eax +cvtsi2sd xmm1, dword [rax] +vcvtsi2sd xmm1, eax +vcvtsi2sd xmm1, dword [rax] +vcvtsi2sd xmm1, xmm2, eax +vcvtsi2sd xmm1, xmm2, dword [rax] +cvtsi2sd xmm1, rax +cvtsi2sd xmm1, qword [rax] +vcvtsi2sd xmm1, rax +vcvtsi2sd xmm1, qword [rax] +vcvtsi2sd xmm1, xmm2, rax +vcvtsi2sd xmm1, xmm2, qword [rax] + +cvtsi2ss xmm1, eax +cvtsi2ss xmm1, dword [rax] +vcvtsi2ss xmm1, eax +vcvtsi2ss xmm1, dword [rax] +vcvtsi2ss xmm1, xmm2, eax +vcvtsi2ss xmm1, xmm2, dword [rax] +cvtsi2ss xmm1, rax +cvtsi2ss xmm1, qword [rax] +vcvtsi2ss xmm1, rax +vcvtsi2ss xmm1, qword [rax] +vcvtsi2ss xmm1, xmm2, rax +vcvtsi2ss xmm1, xmm2, qword [rax] + +cvtss2sd xmm1, xmm2 +cvtss2sd xmm1, [rax] +cvtss2sd xmm1, dword [rax] +vcvtss2sd xmm1, xmm2 +vcvtss2sd xmm1, [rax] +vcvtss2sd xmm1, dword [rax] +vcvtss2sd xmm1, xmm2, xmm3 +vcvtss2sd xmm1, xmm2, [rax] +vcvtss2sd xmm1, xmm2, dword [rax] + +cvtss2si eax, xmm2 +cvtss2si eax, [rax] +cvtss2si eax, dword [rax] +vcvtss2si eax, xmm2 +vcvtss2si eax, [rax] +vcvtss2si eax, dword [rax] +cvtss2si rax, xmm2 +cvtss2si rax, [rax] +cvtss2si rax, dword [rax] +vcvtss2si rax, xmm2 +vcvtss2si rax, [rax] +vcvtss2si rax, dword [rax] + +; These require memory operand size to be specified (in AVX version) +cvttpd2dq xmm1, xmm2 +cvttpd2dq xmm1, [rax] +cvttpd2dq xmm1, dqword [rax] +vcvttpd2dq xmm1, xmm2 +vcvttpd2dq xmm1, dqword [rax] +vcvttpd2dq xmm1, ymm2 +vcvttpd2dq xmm1, yword [rax] + +cvttps2dq xmm1, xmm2 +cvttps2dq xmm1, [rax] +cvttps2dq xmm1, dqword [rax] +vcvttps2dq xmm1, xmm2 +vcvttps2dq xmm1, [rax] +vcvttps2dq xmm1, dqword [rax] +vcvttps2dq ymm1, ymm2 +vcvttps2dq ymm1, [rax] +vcvttps2dq ymm1, yword [rax] + +cvttsd2si eax, xmm2 +cvttsd2si eax, [rax] +cvttsd2si eax, qword [rax] +vcvttsd2si eax, xmm2 +vcvttsd2si eax, [rax] +vcvttsd2si eax, qword [rax] +cvttsd2si rax, xmm2 +cvttsd2si rax, [rax] +cvttsd2si rax, qword [rax] +vcvttsd2si rax, xmm2 +vcvttsd2si rax, [rax] +vcvttsd2si rax, qword [rax] + +cvttss2si eax, xmm2 +cvttss2si eax, [rax] +cvttss2si eax, dword [rax] +vcvttss2si eax, xmm2 +vcvttss2si eax, [rax] +vcvttss2si eax, dword [rax] +cvttss2si rax, xmm2 +cvttss2si rax, [rax] +cvttss2si rax, dword [rax] +vcvttss2si rax, xmm2 +vcvttss2si rax, [rax] +vcvttss2si rax, dword [rax] + +divpd xmm1, xmm2 +divpd xmm1, [rax] +divpd xmm1, dqword [rax] +vdivpd xmm1, xmm2 +vdivpd xmm1, [rax] +vdivpd xmm1, dqword [rax] +vdivpd xmm1, xmm2, xmm3 +vdivpd xmm1, xmm2, [rax] +vdivpd xmm1, xmm2, dqword [rax] +vdivpd ymm1, ymm2, ymm3 +vdivpd ymm1, ymm2, [rax] +vdivpd ymm1, ymm2, yword [rax] + +divps xmm1, xmm2 +divps xmm1, [rax] +divps xmm1, dqword [rax] +vdivps xmm1, xmm2 +vdivps xmm1, [rax] +vdivps xmm1, dqword [rax] +vdivps xmm1, xmm2, xmm3 +vdivps xmm1, xmm2, [rax] +vdivps xmm1, xmm2, dqword [rax] +vdivps ymm1, ymm2, ymm3 +vdivps ymm1, ymm2, [rax] +vdivps ymm1, ymm2, yword [rax] + +divsd xmm1, xmm2 +divsd xmm1, [rax] +divsd xmm1, qword [rax] +vdivsd xmm1, xmm2 +vdivsd xmm1, [rax] +vdivsd xmm1, qword [rax] +vdivsd xmm1, xmm2, xmm3 +vdivsd xmm1, xmm2, [rax] +vdivsd xmm1, xmm2, qword [rax] + +divss xmm1, xmm2 +divss xmm1, [rax] +divss xmm1, dword [rax] +vdivss xmm1, xmm2 +vdivss xmm1, [rax] +vdivss xmm1, dword [rax] +vdivss xmm1, xmm2, xmm3 +vdivss xmm1, xmm2, [rax] +vdivss xmm1, xmm2, dword [rax] + +dppd xmm1, xmm2, 5 +dppd xmm1, [rax], byte 5 +dppd xmm1, dqword [rax], 5 +vdppd xmm1, xmm2, 5 +vdppd xmm1, [rax], byte 5 +vdppd xmm1, dqword [rax], 5 +vdppd xmm1, xmm2, xmm3, 5 +vdppd xmm1, xmm2, [rax], byte 5 +vdppd xmm1, xmm2, dqword [rax], 5 +; no ymm version + +dpps xmm1, xmm2, 5 +dpps xmm1, [rax], byte 5 +dpps xmm1, dqword [rax], 5 +vdpps xmm1, xmm2, 5 +vdpps xmm1, [rax], byte 5 +vdpps xmm1, dqword [rax], 5 +vdpps xmm1, xmm2, xmm3, 5 +vdpps xmm1, xmm2, [rax], byte 5 +vdpps xmm1, xmm2, dqword [rax], 5 +vdpps ymm1, ymm2, ymm3, 5 +vdpps ymm1, ymm2, [rax], byte 5 +vdpps ymm1, ymm2, yword [rax], 5 + +vextractf128 xmm1, ymm2, 5 +vextractf128 [rax], ymm2, byte 5 +vextractf128 dqword [rax], ymm2, 5 + +extractps eax, xmm1, 5 +extractps rax, xmm1, 5 +extractps [rax], xmm1, byte 5 +extractps dword [rax], xmm1, 5 +vextractps eax, xmm1, 5 +vextractps rax, xmm1, 5 +vextractps [rax], xmm1, byte 5 +vextractps dword [rax], xmm1, 5 + +haddpd xmm1, xmm2 +haddpd xmm1, [rax] +haddpd xmm1, dqword [rax] +vhaddpd xmm1, xmm2 +vhaddpd xmm1, [rax] +vhaddpd xmm1, dqword [rax] +vhaddpd xmm1, xmm2, xmm3 +vhaddpd xmm1, xmm2, [rax] +vhaddpd xmm1, xmm2, dqword [rax] +vhaddpd ymm1, ymm2, ymm3 +vhaddpd ymm1, ymm2, [rax] +vhaddpd ymm1, ymm2, yword [rax] + +haddps xmm1, xmm2 +haddps xmm1, [rax] +haddps xmm1, dqword [rax] +vhaddps xmm1, xmm2 +vhaddps xmm1, [rax] +vhaddps xmm1, dqword [rax] +vhaddps xmm1, xmm2, xmm3 +vhaddps xmm1, xmm2, [rax] +vhaddps xmm1, xmm2, dqword [rax] +vhaddps ymm1, ymm2, ymm3 +vhaddps ymm1, ymm2, [rax] +vhaddps ymm1, ymm2, yword [rax] + +hsubpd xmm1, xmm2 +hsubpd xmm1, [rax] +hsubpd xmm1, dqword [rax] +vhsubpd xmm1, xmm2 +vhsubpd xmm1, [rax] +vhsubpd xmm1, dqword [rax] +vhsubpd xmm1, xmm2, xmm3 +vhsubpd xmm1, xmm2, [rax] +vhsubpd xmm1, xmm2, dqword [rax] +vhsubpd ymm1, ymm2, ymm3 +vhsubpd ymm1, ymm2, [rax] +vhsubpd ymm1, ymm2, yword [rax] + +hsubps xmm1, xmm2 +hsubps xmm1, [rax] +hsubps xmm1, dqword [rax] +vhsubps xmm1, xmm2 +vhsubps xmm1, [rax] +vhsubps xmm1, dqword [rax] +vhsubps xmm1, xmm2, xmm3 +vhsubps xmm1, xmm2, [rax] +vhsubps xmm1, xmm2, dqword [rax] +vhsubps ymm1, ymm2, ymm3 +vhsubps ymm1, ymm2, [rax] +vhsubps ymm1, ymm2, yword [rax] + +vinsertf128 ymm1, ymm2, xmm3, 5 +vinsertf128 ymm1, ymm2, [rax], byte 5 +vinsertf128 ymm1, ymm2, dqword [rax], 5 + +insertps xmm1, xmm2, 5 +insertps xmm1, [rax], byte 5 +insertps xmm1, dword [rax], 5 +vinsertps xmm1, xmm2, 5 +vinsertps xmm1, [rax], byte 5 +vinsertps xmm1, dword [rax], 5 +vinsertps xmm1, xmm2, xmm3, 5 +vinsertps xmm1, xmm2, [rax], byte 5 +vinsertps xmm1, xmm2, dword [rax], 5 + +lddqu xmm1, [rax] +lddqu xmm1, dqword [rax] +vlddqu xmm1, [rax] +vlddqu xmm1, dqword [rax] +vlddqu ymm1, [rax] +vlddqu ymm1, yword [rax] + +ldmxcsr [rax] +ldmxcsr dword [rax] +vldmxcsr [rax] +vldmxcsr dword [rax] + +maskmovdqu xmm1, xmm2 +vmaskmovdqu xmm1, xmm2 + +vmaskmovps xmm1, xmm2, [rax] +vmaskmovps xmm1, xmm2, dqword [rax] +vmaskmovps ymm1, ymm2, [rax] +vmaskmovps ymm1, ymm2, yword [rax] +vmaskmovps [rax], xmm2, xmm3 +vmaskmovps dqword [rax], xmm2, xmm3 +vmaskmovps [rax], ymm2, ymm3 +vmaskmovps yword [rax], ymm2, ymm3 + +vmaskmovpd xmm1, xmm2, [rax] +vmaskmovpd xmm1, xmm2, dqword [rax] +vmaskmovpd ymm1, ymm2, [rax] +vmaskmovpd ymm1, ymm2, yword [rax] +vmaskmovpd [rax], xmm2, xmm3 +vmaskmovpd dqword [rax], xmm2, xmm3 +vmaskmovpd [rax], ymm2, ymm3 +vmaskmovpd yword [rax], ymm2, ymm3 + +maxpd xmm1, xmm2 +maxpd xmm1, [rax] +maxpd xmm1, dqword [rax] +vmaxpd xmm1, xmm2 +vmaxpd xmm1, [rax] +vmaxpd xmm1, dqword [rax] +vmaxpd xmm1, xmm2, xmm3 +vmaxpd xmm1, xmm2, [rax] +vmaxpd xmm1, xmm2, dqword [rax] +vmaxpd ymm1, ymm2, ymm3 +vmaxpd ymm1, ymm2, [rax] +vmaxpd ymm1, ymm2, yword [rax] + +maxps xmm1, xmm2 +maxps xmm1, [rax] +maxps xmm1, dqword [rax] +vmaxps xmm1, xmm2 +vmaxps xmm1, [rax] +vmaxps xmm1, dqword [rax] +vmaxps xmm1, xmm2, xmm3 +vmaxps xmm1, xmm2, [rax] +vmaxps xmm1, xmm2, dqword [rax] +vmaxps ymm1, ymm2, ymm3 +vmaxps ymm1, ymm2, [rax] +vmaxps ymm1, ymm2, yword [rax] + +maxsd xmm1, xmm2 +maxsd xmm1, [rax] +maxsd xmm1, qword [rax] +vmaxsd xmm1, xmm2 +vmaxsd xmm1, [rax] +vmaxsd xmm1, qword [rax] +vmaxsd xmm1, xmm2, xmm3 +vmaxsd xmm1, xmm2, [rax] +vmaxsd xmm1, xmm2, qword [rax] + +maxss xmm1, xmm2 +maxss xmm1, [rax] +maxss xmm1, dword [rax] +vmaxss xmm1, xmm2 +vmaxss xmm1, [rax] +vmaxss xmm1, dword [rax] +vmaxss xmm1, xmm2, xmm3 +vmaxss xmm1, xmm2, [rax] +vmaxss xmm1, xmm2, dword [rax] + +minpd xmm1, xmm2 +minpd xmm1, [rax] +minpd xmm1, dqword [rax] +vminpd xmm1, xmm2 +vminpd xmm1, [rax] +vminpd xmm1, dqword [rax] +vminpd xmm1, xmm2, xmm3 +vminpd xmm1, xmm2, [rax] +vminpd xmm1, xmm2, dqword [rax] +vminpd ymm1, ymm2, ymm3 +vminpd ymm1, ymm2, [rax] +vminpd ymm1, ymm2, yword [rax] + +minps xmm1, xmm2 +minps xmm1, [rax] +minps xmm1, dqword [rax] +vminps xmm1, xmm2 +vminps xmm1, [rax] +vminps xmm1, dqword [rax] +vminps xmm1, xmm2, xmm3 +vminps xmm1, xmm2, [rax] +vminps xmm1, xmm2, dqword [rax] +vminps ymm1, ymm2, ymm3 +vminps ymm1, ymm2, [rax] +vminps ymm1, ymm2, yword [rax] + +minsd xmm1, xmm2 +minsd xmm1, [rax] +minsd xmm1, qword [rax] +vminsd xmm1, xmm2 +vminsd xmm1, [rax] +vminsd xmm1, qword [rax] +vminsd xmm1, xmm2, xmm3 +vminsd xmm1, xmm2, [rax] +vminsd xmm1, xmm2, qword [rax] + +minss xmm1, xmm2 +minss xmm1, [rax] +minss xmm1, dword [rax] +vminss xmm1, xmm2 +vminss xmm1, [rax] +vminss xmm1, dword [rax] +vminss xmm1, xmm2, xmm3 +vminss xmm1, xmm2, [rax] +vminss xmm1, xmm2, dword [rax] + +movapd xmm1, xmm2 +movapd xmm1, [rax] +movapd xmm1, dqword [rax] +vmovapd xmm1, xmm2 +vmovapd xmm1, [rax] +vmovapd xmm1, dqword [rax] +movapd [rax], xmm2 +movapd dqword [rax], xmm2 +vmovapd [rax], xmm2 +vmovapd dqword [rax], xmm2 +vmovapd ymm1, ymm2 +vmovapd ymm1, [rax] +vmovapd ymm1, yword [rax] +vmovapd [rax], ymm2 +vmovapd yword [rax], ymm2 + +movaps xmm1, xmm2 +movaps xmm1, [rax] +movaps xmm1, dqword [rax] +vmovaps xmm1, xmm2 +vmovaps xmm1, [rax] +vmovaps xmm1, dqword [rax] +movaps [rax], xmm2 +movaps dqword [rax], xmm2 +vmovaps [rax], xmm2 +vmovaps dqword [rax], xmm2 +vmovaps ymm1, ymm2 +vmovaps ymm1, [rax] +vmovaps ymm1, yword [rax] +vmovaps [rax], ymm2 +vmovaps yword [rax], ymm2 + +movd xmm1, eax +movd xmm1, [rax] +movd xmm1, dword [rax] +vmovd xmm1, eax +vmovd xmm1, [rax] +vmovd xmm1, dword [rax] +movd eax, xmm2 +movd [rax], xmm2 +movd dword [rax], xmm2 +vmovd eax, xmm2 +vmovd [rax], xmm2 +vmovd dword [rax], xmm2 + +movq xmm1, rax +movq xmm1, [rax] +movq xmm1, qword [rax] +vmovq xmm1, rax +vmovq xmm1, [rax] +vmovq xmm1, qword [rax] +movq rax, xmm2 +movq [rax], xmm2 +movq qword [rax], xmm2 +vmovq rax, xmm2 +vmovq [rax], xmm2 +vmovq qword [rax], xmm2 + +movq xmm1, xmm2 +movq xmm1, [rax] +movq xmm1, qword [rax] +vmovq xmm1, xmm2 +vmovq xmm1, [rax] +vmovq xmm1, qword [rax] +movq [rax], xmm1 +movq qword [rax], xmm1 +vmovq [rax], xmm1 +vmovq qword [rax], xmm1 + +movddup xmm1, xmm2 +movddup xmm1, [rax] +movddup xmm1, qword [rax] +vmovddup xmm1, xmm2 +vmovddup xmm1, [rax] +vmovddup xmm1, qword [rax] +vmovddup ymm1, ymm2 +vmovddup ymm1, [rax] +vmovddup ymm1, yword [rax] + +movdqa xmm1, xmm2 +movdqa xmm1, [rax] +movdqa xmm1, dqword [rax] +movdqa [rax], xmm2 +movdqa dqword [rax], xmm2 +vmovdqa xmm1, xmm2 +vmovdqa xmm1, [rax] +vmovdqa xmm1, dqword [rax] +vmovdqa [rax], xmm2 +vmovdqa dqword [rax], xmm2 +vmovdqa ymm1, ymm2 +vmovdqa ymm1, [rax] +vmovdqa ymm1, yword [rax] +vmovdqa [rax], ymm2 +vmovdqa yword [rax], ymm2 + +movdqu xmm1, xmm2 +movdqu xmm1, [rax] +movdqu xmm1, dqword [rax] +movdqu [rax], xmm2 +movdqu dqword [rax], xmm2 +vmovdqu xmm1, xmm2 +vmovdqu xmm1, [rax] +vmovdqu xmm1, dqword [rax] +vmovdqu [rax], xmm2 +vmovdqu dqword [rax], xmm2 +vmovdqu ymm1, ymm2 +vmovdqu ymm1, [rax] +vmovdqu ymm1, yword [rax] +vmovdqu [rax], ymm2 +vmovdqu yword [rax], ymm2 + +movhlps xmm1, xmm2 +vmovhlps xmm1, xmm2 +vmovhlps xmm1, xmm2, xmm3 + +movhpd xmm1, [rax] +movhpd xmm1, qword [rax] +vmovhpd xmm1, [rax] +vmovhpd xmm1, qword [rax] +vmovhpd xmm1, xmm2, [rax] +vmovhpd xmm1, xmm2, qword [rax] +movhpd [rax], xmm2 +movhpd qword [rax], xmm2 +vmovhpd [rax], xmm2 +vmovhpd qword [rax], xmm2 + +movhps xmm1, [rax] +movhps xmm1, qword [rax] +vmovhps xmm1, [rax] +vmovhps xmm1, qword [rax] +vmovhps xmm1, xmm2, [rax] +vmovhps xmm1, xmm2, qword [rax] +movhps [rax], xmm2 +movhps qword [rax], xmm2 +vmovhps [rax], xmm2 +vmovhps qword [rax], xmm2 + +movhlps xmm1, xmm2 +vmovhlps xmm1, xmm2 +vmovhlps xmm1, xmm2, xmm3 + +movlpd xmm1, [rax] +movlpd xmm1, qword [rax] +vmovlpd xmm1, [rax] +vmovlpd xmm1, qword [rax] +vmovlpd xmm1, xmm2, [rax] +vmovlpd xmm1, xmm2, qword [rax] +movlpd [rax], xmm2 +movlpd qword [rax], xmm2 +vmovlpd [rax], xmm2 +vmovlpd qword [rax], xmm2 + +movlps xmm1, [rax] +movlps xmm1, qword [rax] +vmovlps xmm1, [rax] +vmovlps xmm1, qword [rax] +vmovlps xmm1, xmm2, [rax] +vmovlps xmm1, xmm2, qword [rax] +movlps [rax], xmm2 +movlps qword [rax], xmm2 +vmovlps [rax], xmm2 +vmovlps qword [rax], xmm2 + +movmskpd eax, xmm2 +movmskpd rax, xmm2 +vmovmskpd eax, xmm2 +vmovmskpd rax, xmm2 +vmovmskpd eax, ymm2 +vmovmskpd rax, ymm2 + +movmskps eax, xmm2 +movmskps rax, xmm2 +vmovmskps eax, xmm2 +vmovmskps rax, xmm2 +vmovmskps eax, ymm2 +vmovmskps rax, ymm2 + +movntdq [rax], xmm1 +movntdq dqword [rax], xmm1 +vmovntdq [rax], xmm1 +vmovntdq dqword [rax], xmm1 +vmovntdq [rax], ymm1 +vmovntdq yword [rax], ymm1 + +movntdqa xmm1, [rax] +movntdqa xmm1, dqword [rax] +vmovntdqa xmm1, [rax] +vmovntdqa xmm1, dqword [rax] + +movntpd [rax], xmm1 +movntpd dqword [rax], xmm1 +vmovntpd [rax], xmm1 +vmovntpd dqword [rax], xmm1 +vmovntpd [rax], ymm1 +vmovntpd yword [rax], ymm1 + +movntps [rax], xmm1 +movntps dqword [rax], xmm1 +vmovntps [rax], xmm1 +vmovntps dqword [rax], xmm1 +vmovntps [rax], ymm1 +vmovntps yword [rax], ymm1 + +movsd xmm1, xmm2 +vmovsd xmm1, xmm2 +vmovsd xmm1, xmm2, xmm3 +movsd xmm1, [rax] +movsd xmm1, qword [rax] +vmovsd xmm1, [rax] +vmovsd xmm1, qword [rax] +movsd [rax], xmm2 +movsd qword [rax], xmm2 +vmovsd [rax], xmm2 +vmovsd qword [rax], xmm2 + +movshdup xmm1, xmm2 +movshdup xmm1, [rax] +movshdup xmm1, dqword [rax] +vmovshdup xmm1, xmm2 +vmovshdup xmm1, [rax] +vmovshdup xmm1, dqword [rax] +vmovshdup ymm1, ymm2 +vmovshdup ymm1, [rax] +vmovshdup ymm1, yword [rax] + +movsldup xmm1, xmm2 +movsldup xmm1, [rax] +movsldup xmm1, dqword [rax] +vmovsldup xmm1, xmm2 +vmovsldup xmm1, [rax] +vmovsldup xmm1, dqword [rax] +vmovsldup ymm1, ymm2 +vmovsldup ymm1, [rax] +vmovsldup ymm1, yword [rax] + +movss xmm1, xmm2 +vmovss xmm1, xmm2 +vmovss xmm1, xmm2, xmm3 +movss xmm1, [rax] +movss xmm1, dword [rax] +vmovss xmm1, [rax] +vmovss xmm1, dword [rax] +movss [rax], xmm2 +movss dword [rax], xmm2 +vmovss [rax], xmm2 +vmovss dword [rax], xmm2 + +movupd xmm1, xmm2 +movupd xmm1, [rax] +movupd xmm1, dqword [rax] +vmovupd xmm1, xmm2 +vmovupd xmm1, [rax] +vmovupd xmm1, dqword [rax] +movupd [rax], xmm2 +movupd dqword [rax], xmm2 +vmovupd [rax], xmm2 +vmovupd dqword [rax], xmm2 +vmovupd ymm1, ymm2 +vmovupd ymm1, [rax] +vmovupd ymm1, yword [rax] +vmovupd [rax], ymm2 +vmovupd yword [rax], ymm2 + +movups xmm1, xmm2 +movups xmm1, [rax] +movups xmm1, dqword [rax] +vmovups xmm1, xmm2 +vmovups xmm1, [rax] +vmovups xmm1, dqword [rax] +movups [rax], xmm2 +movups dqword [rax], xmm2 +vmovups [rax], xmm2 +vmovups dqword [rax], xmm2 +vmovups ymm1, ymm2 +vmovups ymm1, [rax] +vmovups ymm1, yword [rax] +vmovups [rax], ymm2 +vmovups yword [rax], ymm2 + +mpsadbw xmm1, xmm2, 5 +mpsadbw xmm1, [rax], byte 5 +mpsadbw xmm1, dqword [rax], 5 +vmpsadbw xmm1, xmm2, 5 +vmpsadbw xmm1, [rax], byte 5 +vmpsadbw xmm1, dqword [rax], 5 +vmpsadbw xmm1, xmm2, xmm3, 5 +vmpsadbw xmm1, xmm2, [rax], byte 5 +vmpsadbw xmm1, xmm2, dqword [rax], 5 + +mulpd xmm1, xmm2 +mulpd xmm1, [rax] +mulpd xmm1, dqword [rax] +vmulpd xmm1, xmm2 +vmulpd xmm1, [rax] +vmulpd xmm1, dqword [rax] +vmulpd xmm1, xmm2, xmm3 +vmulpd xmm1, xmm2, [rax] +vmulpd xmm1, xmm2, dqword [rax] +vmulpd ymm1, ymm2, ymm3 +vmulpd ymm1, ymm2, [rax] +vmulpd ymm1, ymm2, yword [rax] + +mulps xmm1, xmm2 +mulps xmm1, [rax] +mulps xmm1, dqword [rax] +vmulps xmm1, xmm2 +vmulps xmm1, [rax] +vmulps xmm1, dqword [rax] +vmulps xmm1, xmm2, xmm3 +vmulps xmm1, xmm2, [rax] +vmulps xmm1, xmm2, dqword [rax] +vmulps ymm1, ymm2, ymm3 +vmulps ymm1, ymm2, [rax] +vmulps ymm1, ymm2, yword [rax] + +mulsd xmm1, xmm2 +mulsd xmm1, [rax] +mulsd xmm1, qword [rax] +vmulsd xmm1, xmm2 +vmulsd xmm1, [rax] +vmulsd xmm1, qword [rax] +vmulsd xmm1, xmm2, xmm3 +vmulsd xmm1, xmm2, [rax] +vmulsd xmm1, xmm2, qword [rax] + +mulss xmm1, xmm2 +mulss xmm1, [rax] +mulss xmm1, dword [rax] +vmulss xmm1, xmm2 +vmulss xmm1, [rax] +vmulss xmm1, dword [rax] +vmulss xmm1, xmm2, xmm3 +vmulss xmm1, xmm2, [rax] +vmulss xmm1, xmm2, dword [rax] + +orpd xmm1, xmm2 +orpd xmm1, [rax] +orpd xmm1, dqword [rax] +vorpd xmm1, xmm2 +vorpd xmm1, [rax] +vorpd xmm1, dqword [rax] +vorpd xmm1, xmm2, xmm3 +vorpd xmm1, xmm2, [rax] +vorpd xmm1, xmm2, dqword [rax] +vorpd ymm1, ymm2, ymm3 +vorpd ymm1, ymm2, [rax] +vorpd ymm1, ymm2, yword [rax] + +orps xmm1, xmm2 +orps xmm1, [rax] +orps xmm1, dqword [rax] +vorps xmm1, xmm2 +vorps xmm1, [rax] +vorps xmm1, dqword [rax] +vorps xmm1, xmm2, xmm3 +vorps xmm1, xmm2, [rax] +vorps xmm1, xmm2, dqword [rax] +vorps ymm1, ymm2, ymm3 +vorps ymm1, ymm2, [rax] +vorps ymm1, ymm2, yword [rax] + +pabsb xmm1, xmm2 +pabsb xmm1, [rax] +pabsb xmm1, dqword [rax] +vpabsb xmm1, xmm2 +vpabsb xmm1, [rax] +vpabsb xmm1, dqword [rax] + +pabsw xmm1, xmm2 +pabsw xmm1, [rax] +pabsw xmm1, dqword [rax] +vpabsw xmm1, xmm2 +vpabsw xmm1, [rax] +vpabsw xmm1, dqword [rax] + +pabsd xmm1, xmm2 +pabsd xmm1, [rax] +pabsd xmm1, dqword [rax] +vpabsd xmm1, xmm2 +vpabsd xmm1, [rax] +vpabsd xmm1, dqword [rax] + +packsswb xmm1, xmm2 +packsswb xmm1, [rax] +packsswb xmm1, dqword [rax] +vpacksswb xmm1, xmm2 +vpacksswb xmm1, [rax] +vpacksswb xmm1, dqword [rax] +vpacksswb xmm1, xmm2, xmm3 +vpacksswb xmm1, xmm2, [rax] +vpacksswb xmm1, xmm2, dqword [rax] + +packssdw xmm1, xmm2 +packssdw xmm1, [rax] +packssdw xmm1, dqword [rax] +vpackssdw xmm1, xmm2 +vpackssdw xmm1, [rax] +vpackssdw xmm1, dqword [rax] +vpackssdw xmm1, xmm2, xmm3 +vpackssdw xmm1, xmm2, [rax] +vpackssdw xmm1, xmm2, dqword [rax] + +packuswb xmm1, xmm2 +packuswb xmm1, [rax] +packuswb xmm1, dqword [rax] +vpackuswb xmm1, xmm2 +vpackuswb xmm1, [rax] +vpackuswb xmm1, dqword [rax] +vpackuswb xmm1, xmm2, xmm3 +vpackuswb xmm1, xmm2, [rax] +vpackuswb xmm1, xmm2, dqword [rax] + +packusdw xmm1, xmm2 +packusdw xmm1, [rax] +packusdw xmm1, dqword [rax] +vpackusdw xmm1, xmm2 +vpackusdw xmm1, [rax] +vpackusdw xmm1, dqword [rax] +vpackusdw xmm1, xmm2, xmm3 +vpackusdw xmm1, xmm2, [rax] +vpackusdw xmm1, xmm2, dqword [rax] + +paddb xmm1, xmm2 +paddb xmm1, [rax] +paddb xmm1, dqword [rax] +vpaddb xmm1, xmm2 +vpaddb xmm1, [rax] +vpaddb xmm1, dqword [rax] +vpaddb xmm1, xmm2, xmm3 +vpaddb xmm1, xmm2, [rax] +vpaddb xmm1, xmm2, dqword [rax] + +paddw xmm1, xmm2 +paddw xmm1, [rax] +paddw xmm1, dqword [rax] +vpaddw xmm1, xmm2 +vpaddw xmm1, [rax] +vpaddw xmm1, dqword [rax] +vpaddw xmm1, xmm2, xmm3 +vpaddw xmm1, xmm2, [rax] +vpaddw xmm1, xmm2, dqword [rax] + +paddd xmm1, xmm2 +paddd xmm1, [rax] +paddd xmm1, dqword [rax] +vpaddd xmm1, xmm2 +vpaddd xmm1, [rax] +vpaddd xmm1, dqword [rax] +vpaddd xmm1, xmm2, xmm3 +vpaddd xmm1, xmm2, [rax] +vpaddd xmm1, xmm2, dqword [rax] + +paddq xmm1, xmm2 +paddq xmm1, [rax] +paddq xmm1, dqword [rax] +vpaddq xmm1, xmm2 +vpaddq xmm1, [rax] +vpaddq xmm1, dqword [rax] +vpaddq xmm1, xmm2, xmm3 +vpaddq xmm1, xmm2, [rax] +vpaddq xmm1, xmm2, dqword [rax] + +paddsb xmm1, xmm2 +paddsb xmm1, [rax] +paddsb xmm1, dqword [rax] +vpaddsb xmm1, xmm2 +vpaddsb xmm1, [rax] +vpaddsb xmm1, dqword [rax] +vpaddsb xmm1, xmm2, xmm3 +vpaddsb xmm1, xmm2, [rax] +vpaddsb xmm1, xmm2, dqword [rax] + +paddsw xmm1, xmm2 +paddsw xmm1, [rax] +paddsw xmm1, dqword [rax] +vpaddsw xmm1, xmm2 +vpaddsw xmm1, [rax] +vpaddsw xmm1, dqword [rax] +vpaddsw xmm1, xmm2, xmm3 +vpaddsw xmm1, xmm2, [rax] +vpaddsw xmm1, xmm2, dqword [rax] + +paddusb xmm1, xmm2 +paddusb xmm1, [rax] +paddusb xmm1, dqword [rax] +vpaddusb xmm1, xmm2 +vpaddusb xmm1, [rax] +vpaddusb xmm1, dqword [rax] +vpaddusb xmm1, xmm2, xmm3 +vpaddusb xmm1, xmm2, [rax] +vpaddusb xmm1, xmm2, dqword [rax] + +paddusw xmm1, xmm2 +paddusw xmm1, [rax] +paddusw xmm1, dqword [rax] +vpaddusw xmm1, xmm2 +vpaddusw xmm1, [rax] +vpaddusw xmm1, dqword [rax] +vpaddusw xmm1, xmm2, xmm3 +vpaddusw xmm1, xmm2, [rax] +vpaddusw xmm1, xmm2, dqword [rax] + +palignr xmm1, xmm2, 5 +palignr xmm1, [rax], byte 5 +palignr xmm1, dqword [rax], 5 +vpalignr xmm1, xmm2, 5 +vpalignr xmm1, [rax], byte 5 +vpalignr xmm1, dqword [rax], 5 +vpalignr xmm1, xmm2, xmm3, 5 +vpalignr xmm1, xmm2, [rax], byte 5 +vpalignr xmm1, xmm2, dqword [rax], 5 + +pand xmm1, xmm2 +pand xmm1, [rax] +pand xmm1, dqword [rax] +vpand xmm1, xmm2 +vpand xmm1, [rax] +vpand xmm1, dqword [rax] +vpand xmm1, xmm2, xmm3 +vpand xmm1, xmm2, [rax] +vpand xmm1, xmm2, dqword [rax] + +pandn xmm1, xmm2 +pandn xmm1, [rax] +pandn xmm1, dqword [rax] +vpandn xmm1, xmm2 +vpandn xmm1, [rax] +vpandn xmm1, dqword [rax] +vpandn xmm1, xmm2, xmm3 +vpandn xmm1, xmm2, [rax] +vpandn xmm1, xmm2, dqword [rax] + +pavgb xmm1, xmm2 +pavgb xmm1, [rax] +pavgb xmm1, dqword [rax] +vpavgb xmm1, xmm2 +vpavgb xmm1, [rax] +vpavgb xmm1, dqword [rax] +vpavgb xmm1, xmm2, xmm3 +vpavgb xmm1, xmm2, [rax] +vpavgb xmm1, xmm2, dqword [rax] + +pavgw xmm1, xmm2 +pavgw xmm1, [rax] +pavgw xmm1, dqword [rax] +vpavgw xmm1, xmm2 +vpavgw xmm1, [rax] +vpavgw xmm1, dqword [rax] +vpavgw xmm1, xmm2, xmm3 +vpavgw xmm1, xmm2, [rax] +vpavgw xmm1, xmm2, dqword [rax] + +; implicit XMM0 cannot be VEX encoded +pblendvb xmm1, xmm2 +pblendvb xmm1, [rax] +pblendvb xmm1, dqword [rax] +pblendvb xmm1, xmm2, xmm0 +pblendvb xmm1, [rax], xmm0 +pblendvb xmm1, dqword [rax], xmm0 +vpblendvb xmm1, xmm2, xmm3, xmm4 +vpblendvb xmm1, xmm2, [rax], xmm4 +vpblendvb xmm1, xmm2, dqword [rax], xmm4 + +pblendw xmm1, xmm2, 5 +pblendw xmm1, [rax], byte 5 +pblendw xmm1, dqword [rax], 5 +vpblendw xmm1, xmm2, 5 +vpblendw xmm1, [rax], byte 5 +vpblendw xmm1, dqword [rax], 5 +vpblendw xmm1, xmm2, xmm3, 5 +vpblendw xmm1, xmm2, [rax], byte 5 +vpblendw xmm1, xmm2, dqword [rax], 5 + +pcmpestri xmm1, xmm2, 5 +pcmpestri xmm1, [rax], byte 5 +pcmpestri xmm1, dqword [rax], 5 +vpcmpestri xmm1, xmm2, 5 +vpcmpestri xmm1, [rax], byte 5 +vpcmpestri xmm1, dqword [rax], 5 + +pcmpestrm xmm1, xmm2, 5 +pcmpestrm xmm1, [rax], byte 5 +pcmpestrm xmm1, dqword [rax], 5 +vpcmpestrm xmm1, xmm2, 5 +vpcmpestrm xmm1, [rax], byte 5 +vpcmpestrm xmm1, dqword [rax], 5 + +pcmpistri xmm1, xmm2, 5 +pcmpistri xmm1, [rax], byte 5 +pcmpistri xmm1, dqword [rax], 5 +vpcmpistri xmm1, xmm2, 5 +vpcmpistri xmm1, [rax], byte 5 +vpcmpistri xmm1, dqword [rax], 5 + +pcmpistrm xmm1, xmm2, 5 +pcmpistrm xmm1, [rax], byte 5 +pcmpistrm xmm1, dqword [rax], 5 +vpcmpistrm xmm1, xmm2, 5 +vpcmpistrm xmm1, [rax], byte 5 +vpcmpistrm xmm1, dqword [rax], 5 + +pcmpeqb xmm1, xmm2 +pcmpeqb xmm1, [rax] +pcmpeqb xmm1, dqword [rax] +vpcmpeqb xmm1, xmm2 +vpcmpeqb xmm1, [rax] +vpcmpeqb xmm1, dqword [rax] +vpcmpeqb xmm1, xmm2, xmm3 +vpcmpeqb xmm1, xmm2, [rax] +vpcmpeqb xmm1, xmm2, dqword [rax] + +pcmpeqw xmm1, xmm2 +pcmpeqw xmm1, [rax] +pcmpeqw xmm1, dqword [rax] +vpcmpeqw xmm1, xmm2 +vpcmpeqw xmm1, [rax] +vpcmpeqw xmm1, dqword [rax] +vpcmpeqw xmm1, xmm2, xmm3 +vpcmpeqw xmm1, xmm2, [rax] +vpcmpeqw xmm1, xmm2, dqword [rax] + +pcmpeqd xmm1, xmm2 +pcmpeqd xmm1, [rax] +pcmpeqd xmm1, dqword [rax] +vpcmpeqd xmm1, xmm2 +vpcmpeqd xmm1, [rax] +vpcmpeqd xmm1, dqword [rax] +vpcmpeqd xmm1, xmm2, xmm3 +vpcmpeqd xmm1, xmm2, [rax] +vpcmpeqd xmm1, xmm2, dqword [rax] + +pcmpeqq xmm1, xmm2 +pcmpeqq xmm1, [rax] +pcmpeqq xmm1, dqword [rax] +vpcmpeqq xmm1, xmm2 +vpcmpeqq xmm1, [rax] +vpcmpeqq xmm1, dqword [rax] +vpcmpeqq xmm1, xmm2, xmm3 +vpcmpeqq xmm1, xmm2, [rax] +vpcmpeqq xmm1, xmm2, dqword [rax] + +pcmpgtb xmm1, xmm2 +pcmpgtb xmm1, [rax] +pcmpgtb xmm1, dqword [rax] +vpcmpgtb xmm1, xmm2 +vpcmpgtb xmm1, [rax] +vpcmpgtb xmm1, dqword [rax] +vpcmpgtb xmm1, xmm2, xmm3 +vpcmpgtb xmm1, xmm2, [rax] +vpcmpgtb xmm1, xmm2, dqword [rax] + +pcmpgtw xmm1, xmm2 +pcmpgtw xmm1, [rax] +pcmpgtw xmm1, dqword [rax] +vpcmpgtw xmm1, xmm2 +vpcmpgtw xmm1, [rax] +vpcmpgtw xmm1, dqword [rax] +vpcmpgtw xmm1, xmm2, xmm3 +vpcmpgtw xmm1, xmm2, [rax] +vpcmpgtw xmm1, xmm2, dqword [rax] + +pcmpgtd xmm1, xmm2 +pcmpgtd xmm1, [rax] +pcmpgtd xmm1, dqword [rax] +vpcmpgtd xmm1, xmm2 +vpcmpgtd xmm1, [rax] +vpcmpgtd xmm1, dqword [rax] +vpcmpgtd xmm1, xmm2, xmm3 +vpcmpgtd xmm1, xmm2, [rax] +vpcmpgtd xmm1, xmm2, dqword [rax] + +pcmpgtq xmm1, xmm2 +pcmpgtq xmm1, [rax] +pcmpgtq xmm1, dqword [rax] +vpcmpgtq xmm1, xmm2 +vpcmpgtq xmm1, [rax] +vpcmpgtq xmm1, dqword [rax] +vpcmpgtq xmm1, xmm2, xmm3 +vpcmpgtq xmm1, xmm2, [rax] +vpcmpgtq xmm1, xmm2, dqword [rax] + +vpermilpd xmm1, xmm2, xmm3 +vpermilpd xmm1, xmm2, [rax] +vpermilpd xmm1, xmm2, dqword [rax] +vpermilpd ymm1, ymm2, ymm3 +vpermilpd ymm1, ymm2, [rax] +vpermilpd ymm1, ymm2, yword [rax] +vpermilpd xmm1, [rax], byte 5 +vpermilpd xmm1, dqword [rax], 5 +vpermilpd ymm1, [rax], byte 5 +vpermilpd ymm1, yword [rax], 5 + +vpermilps xmm1, xmm2, xmm3 +vpermilps xmm1, xmm2, [rax] +vpermilps xmm1, xmm2, dqword [rax] +vpermilps ymm1, ymm2, ymm3 +vpermilps ymm1, ymm2, [rax] +vpermilps ymm1, ymm2, yword [rax] +vpermilps xmm1, [rax], byte 5 +vpermilps xmm1, dqword [rax], 5 +vpermilps ymm1, [rax], byte 5 +vpermilps ymm1, yword [rax], 5 + +vperm2f128 ymm1, ymm2, ymm3, 5 +vperm2f128 ymm1, ymm2, [rax], byte 5 +vperm2f128 ymm1, ymm2, yword [rax], 5 + +pextrb eax, xmm2, 5 +pextrb eax, xmm2, byte 5 +pextrb rax, xmm2, 5 +pextrb rax, xmm2, byte 5 +pextrb byte [rax], xmm2, 5 +pextrb [rax], xmm2, byte 5 +vpextrb eax, xmm2, 5 +vpextrb eax, xmm2, byte 5 +vpextrb rax, xmm2, 5 +vpextrb rax, xmm2, byte 5 +vpextrb byte [rax], xmm2, 5 +vpextrb [rax], xmm2, byte 5 + +pextrw eax, xmm2, 5 +pextrw eax, xmm2, byte 5 +pextrw rax, xmm2, 5 +pextrw rax, xmm2, byte 5 +pextrw word [rax], xmm2, 5 +pextrw [rax], xmm2, byte 5 +vpextrw eax, xmm2, 5 +vpextrw eax, xmm2, byte 5 +vpextrw rax, xmm2, 5 +vpextrw rax, xmm2, byte 5 +vpextrw word [rax], xmm2, 5 +vpextrw [rax], xmm2, byte 5 + +pextrd eax, xmm2, 5 +pextrd eax, xmm2, byte 5 +pextrd dword [rax], xmm2, 5 +pextrd [rax], xmm2, byte 5 +vpextrd eax, xmm2, 5 +vpextrd eax, xmm2, byte 5 +vpextrd dword [rax], xmm2, 5 +vpextrd [rax], xmm2, byte 5 + +pextrq rax, xmm2, 5 +pextrq rax, xmm2, byte 5 +pextrq qword [rax], xmm2, 5 +pextrq [rax], xmm2, byte 5 +vpextrq rax, xmm2, 5 +vpextrq rax, xmm2, byte 5 +vpextrq qword [rax], xmm2, 5 +vpextrq [rax], xmm2, byte 5 + +phaddw xmm1, xmm2 +phaddw xmm1, [rax] +phaddw xmm1, dqword [rax] +vphaddw xmm1, xmm2 +vphaddw xmm1, [rax] +vphaddw xmm1, dqword [rax] +vphaddw xmm1, xmm2, xmm3 +vphaddw xmm1, xmm2, [rax] +vphaddw xmm1, xmm2, dqword [rax] + +phaddd xmm1, xmm2 +phaddd xmm1, [rax] +phaddd xmm1, dqword [rax] +vphaddd xmm1, xmm2 +vphaddd xmm1, [rax] +vphaddd xmm1, dqword [rax] +vphaddd xmm1, xmm2, xmm3 +vphaddd xmm1, xmm2, [rax] +vphaddd xmm1, xmm2, dqword [rax] + +phaddsw xmm1, xmm2 +phaddsw xmm1, [rax] +phaddsw xmm1, dqword [rax] +vphaddsw xmm1, xmm2 +vphaddsw xmm1, [rax] +vphaddsw xmm1, dqword [rax] +vphaddsw xmm1, xmm2, xmm3 +vphaddsw xmm1, xmm2, [rax] +vphaddsw xmm1, xmm2, dqword [rax] + +phminposuw xmm1, xmm2 +phminposuw xmm1, [rax] +phminposuw xmm1, dqword [rax] +vphminposuw xmm1, xmm2 +vphminposuw xmm1, [rax] +vphminposuw xmm1, dqword [rax] + +phsubw xmm1, xmm2 +phsubw xmm1, [rax] +phsubw xmm1, dqword [rax] +vphsubw xmm1, xmm2 +vphsubw xmm1, [rax] +vphsubw xmm1, dqword [rax] +vphsubw xmm1, xmm2, xmm3 +vphsubw xmm1, xmm2, [rax] +vphsubw xmm1, xmm2, dqword [rax] + +phsubd xmm1, xmm2 +phsubd xmm1, [rax] +phsubd xmm1, dqword [rax] +vphsubd xmm1, xmm2 +vphsubd xmm1, [rax] +vphsubd xmm1, dqword [rax] +vphsubd xmm1, xmm2, xmm3 +vphsubd xmm1, xmm2, [rax] +vphsubd xmm1, xmm2, dqword [rax] + +phsubsw xmm1, xmm2 +phsubsw xmm1, [rax] +phsubsw xmm1, dqword [rax] +vphsubsw xmm1, xmm2 +vphsubsw xmm1, [rax] +vphsubsw xmm1, dqword [rax] +vphsubsw xmm1, xmm2, xmm3 +vphsubsw xmm1, xmm2, [rax] +vphsubsw xmm1, xmm2, dqword [rax] + +pinsrb xmm1, eax, 5 +pinsrb xmm1, byte [rax], 5 +pinsrb xmm1, [rax], byte 5 +vpinsrb xmm1, eax, 5 +vpinsrb xmm1, byte [rax], 5 +vpinsrb xmm1, [rax], byte 5 +vpinsrb xmm1, xmm2, eax, 5 +vpinsrb xmm1, xmm2, byte [rax], 5 +vpinsrb xmm1, xmm2, [rax], byte 5 + +pinsrw xmm1, eax, 5 +pinsrw xmm1, word [rax], 5 +pinsrw xmm1, [rax], byte 5 +vpinsrw xmm1, eax, 5 +vpinsrw xmm1, word [rax], 5 +vpinsrw xmm1, [rax], byte 5 +vpinsrw xmm1, xmm2, eax, 5 +vpinsrw xmm1, xmm2, word [rax], 5 +vpinsrw xmm1, xmm2, [rax], byte 5 + +pinsrd xmm1, eax, 5 +pinsrd xmm1, dword [rax], 5 +pinsrd xmm1, [rax], byte 5 +vpinsrd xmm1, eax, 5 +vpinsrd xmm1, dword [rax], 5 +vpinsrd xmm1, [rax], byte 5 +vpinsrd xmm1, xmm2, eax, 5 +vpinsrd xmm1, xmm2, dword [rax], 5 +vpinsrd xmm1, xmm2, [rax], byte 5 + +pinsrq xmm1, rax, 5 +pinsrq xmm1, qword [rax], 5 +pinsrq xmm1, [rax], byte 5 +vpinsrq xmm1, rax, 5 +vpinsrq xmm1, qword [rax], 5 +vpinsrq xmm1, [rax], byte 5 +vpinsrq xmm1, xmm2, rax, 5 +vpinsrq xmm1, xmm2, qword [rax], 5 +vpinsrq xmm1, xmm2, [rax], byte 5 + +pmaddwd xmm1, xmm2 +pmaddwd xmm1, [rax] +pmaddwd xmm1, dqword [rax] +vpmaddwd xmm1, xmm2 +vpmaddwd xmm1, [rax] +vpmaddwd xmm1, dqword [rax] +vpmaddwd xmm1, xmm2, xmm3 +vpmaddwd xmm1, xmm2, [rax] +vpmaddwd xmm1, xmm2, dqword [rax] + +pmaddubsw xmm1, xmm2 +pmaddubsw xmm1, [rax] +pmaddubsw xmm1, dqword [rax] +vpmaddubsw xmm1, xmm2 +vpmaddubsw xmm1, [rax] +vpmaddubsw xmm1, dqword [rax] +vpmaddubsw xmm1, xmm2, xmm3 +vpmaddubsw xmm1, xmm2, [rax] +vpmaddubsw xmm1, xmm2, dqword [rax] + +pmaxsb xmm1, xmm2 +pmaxsb xmm1, [rax] +pmaxsb xmm1, dqword [rax] +vpmaxsb xmm1, xmm2 +vpmaxsb xmm1, [rax] +vpmaxsb xmm1, dqword [rax] +vpmaxsb xmm1, xmm2, xmm3 +vpmaxsb xmm1, xmm2, [rax] +vpmaxsb xmm1, xmm2, dqword [rax] + +pmaxsw xmm1, xmm2 +pmaxsw xmm1, [rax] +pmaxsw xmm1, dqword [rax] +vpmaxsw xmm1, xmm2 +vpmaxsw xmm1, [rax] +vpmaxsw xmm1, dqword [rax] +vpmaxsw xmm1, xmm2, xmm3 +vpmaxsw xmm1, xmm2, [rax] +vpmaxsw xmm1, xmm2, dqword [rax] + +pmaxsd xmm1, xmm2 +pmaxsd xmm1, [rax] +pmaxsd xmm1, dqword [rax] +vpmaxsd xmm1, xmm2 +vpmaxsd xmm1, [rax] +vpmaxsd xmm1, dqword [rax] +vpmaxsd xmm1, xmm2, xmm3 +vpmaxsd xmm1, xmm2, [rax] +vpmaxsd xmm1, xmm2, dqword [rax] + +pmaxub xmm1, xmm2 +pmaxub xmm1, [rax] +pmaxub xmm1, dqword [rax] +vpmaxub xmm1, xmm2 +vpmaxub xmm1, [rax] +vpmaxub xmm1, dqword [rax] +vpmaxub xmm1, xmm2, xmm3 +vpmaxub xmm1, xmm2, [rax] +vpmaxub xmm1, xmm2, dqword [rax] + +pmaxuw xmm1, xmm2 +pmaxuw xmm1, [rax] +pmaxuw xmm1, dqword [rax] +vpmaxuw xmm1, xmm2 +vpmaxuw xmm1, [rax] +vpmaxuw xmm1, dqword [rax] +vpmaxuw xmm1, xmm2, xmm3 +vpmaxuw xmm1, xmm2, [rax] +vpmaxuw xmm1, xmm2, dqword [rax] + +pmaxud xmm1, xmm2 +pmaxud xmm1, [rax] +pmaxud xmm1, dqword [rax] +vpmaxud xmm1, xmm2 +vpmaxud xmm1, [rax] +vpmaxud xmm1, dqword [rax] +vpmaxud xmm1, xmm2, xmm3 +vpmaxud xmm1, xmm2, [rax] +vpmaxud xmm1, xmm2, dqword [rax] + +pminsb xmm1, xmm2 +pminsb xmm1, [rax] +pminsb xmm1, dqword [rax] +vpminsb xmm1, xmm2 +vpminsb xmm1, [rax] +vpminsb xmm1, dqword [rax] +vpminsb xmm1, xmm2, xmm3 +vpminsb xmm1, xmm2, [rax] +vpminsb xmm1, xmm2, dqword [rax] + +pminsw xmm1, xmm2 +pminsw xmm1, [rax] +pminsw xmm1, dqword [rax] +vpminsw xmm1, xmm2 +vpminsw xmm1, [rax] +vpminsw xmm1, dqword [rax] +vpminsw xmm1, xmm2, xmm3 +vpminsw xmm1, xmm2, [rax] +vpminsw xmm1, xmm2, dqword [rax] + +pminsd xmm1, xmm2 +pminsd xmm1, [rax] +pminsd xmm1, dqword [rax] +vpminsd xmm1, xmm2 +vpminsd xmm1, [rax] +vpminsd xmm1, dqword [rax] +vpminsd xmm1, xmm2, xmm3 +vpminsd xmm1, xmm2, [rax] +vpminsd xmm1, xmm2, dqword [rax] + +pminub xmm1, xmm2 +pminub xmm1, [rax] +pminub xmm1, dqword [rax] +vpminub xmm1, xmm2 +vpminub xmm1, [rax] +vpminub xmm1, dqword [rax] +vpminub xmm1, xmm2, xmm3 +vpminub xmm1, xmm2, [rax] +vpminub xmm1, xmm2, dqword [rax] + +pminuw xmm1, xmm2 +pminuw xmm1, [rax] +pminuw xmm1, dqword [rax] +vpminuw xmm1, xmm2 +vpminuw xmm1, [rax] +vpminuw xmm1, dqword [rax] +vpminuw xmm1, xmm2, xmm3 +vpminuw xmm1, xmm2, [rax] +vpminuw xmm1, xmm2, dqword [rax] + +pminud xmm1, xmm2 +pminud xmm1, [rax] +pminud xmm1, dqword [rax] +vpminud xmm1, xmm2 +vpminud xmm1, [rax] +vpminud xmm1, dqword [rax] +vpminud xmm1, xmm2, xmm3 +vpminud xmm1, xmm2, [rax] +vpminud xmm1, xmm2, dqword [rax] + +pmovmskb eax, xmm1 +pmovmskb rax, xmm1 +vpmovmskb eax, xmm1 +vpmovmskb rax, xmm1 + +pmovsxbw xmm1, xmm2 +pmovsxbw xmm1, [rax] +pmovsxbw xmm1, qword [rax] +vpmovsxbw xmm1, xmm2 +vpmovsxbw xmm1, [rax] +vpmovsxbw xmm1, qword [rax] + +pmovsxbd xmm1, xmm2 +pmovsxbd xmm1, [rax] +pmovsxbd xmm1, dword [rax] +vpmovsxbd xmm1, xmm2 +vpmovsxbd xmm1, [rax] +vpmovsxbd xmm1, dword [rax] + +pmovsxbq xmm1, xmm2 +pmovsxbq xmm1, [rax] +pmovsxbq xmm1, word [rax] +vpmovsxbq xmm1, xmm2 +vpmovsxbq xmm1, [rax] +vpmovsxbq xmm1, word [rax] + +pmovsxwd xmm1, xmm2 +pmovsxwd xmm1, [rax] +pmovsxwd xmm1, qword [rax] +vpmovsxwd xmm1, xmm2 +vpmovsxwd xmm1, [rax] +vpmovsxwd xmm1, qword [rax] + +pmovsxwq xmm1, xmm2 +pmovsxwq xmm1, [rax] +pmovsxwq xmm1, dword [rax] +vpmovsxwq xmm1, xmm2 +vpmovsxwq xmm1, [rax] +vpmovsxwq xmm1, dword [rax] + +pmovsxdq xmm1, xmm2 +pmovsxdq xmm1, [rax] +pmovsxdq xmm1, qword [rax] +vpmovsxdq xmm1, xmm2 +vpmovsxdq xmm1, [rax] +vpmovsxdq xmm1, qword [rax] + +pmovzxbw xmm1, xmm2 +pmovzxbw xmm1, [rax] +pmovzxbw xmm1, qword [rax] +vpmovzxbw xmm1, xmm2 +vpmovzxbw xmm1, [rax] +vpmovzxbw xmm1, qword [rax] + +pmovzxbd xmm1, xmm2 +pmovzxbd xmm1, [rax] +pmovzxbd xmm1, dword [rax] +vpmovzxbd xmm1, xmm2 +vpmovzxbd xmm1, [rax] +vpmovzxbd xmm1, dword [rax] + +pmovzxbq xmm1, xmm2 +pmovzxbq xmm1, [rax] +pmovzxbq xmm1, word [rax] +vpmovzxbq xmm1, xmm2 +vpmovzxbq xmm1, [rax] +vpmovzxbq xmm1, word [rax] + +pmovzxwd xmm1, xmm2 +pmovzxwd xmm1, [rax] +pmovzxwd xmm1, qword [rax] +vpmovzxwd xmm1, xmm2 +vpmovzxwd xmm1, [rax] +vpmovzxwd xmm1, qword [rax] + +pmovzxwq xmm1, xmm2 +pmovzxwq xmm1, [rax] +pmovzxwq xmm1, dword [rax] +vpmovzxwq xmm1, xmm2 +vpmovzxwq xmm1, [rax] +vpmovzxwq xmm1, dword [rax] + +pmovzxdq xmm1, xmm2 +pmovzxdq xmm1, [rax] +pmovzxdq xmm1, qword [rax] +vpmovzxdq xmm1, xmm2 +vpmovzxdq xmm1, [rax] +vpmovzxdq xmm1, qword [rax] + +pmulhuw xmm1, xmm2 +pmulhuw xmm1, [rax] +pmulhuw xmm1, dqword [rax] +vpmulhuw xmm1, xmm2 +vpmulhuw xmm1, [rax] +vpmulhuw xmm1, dqword [rax] +vpmulhuw xmm1, xmm2, xmm3 +vpmulhuw xmm1, xmm2, [rax] +vpmulhuw xmm1, xmm2, dqword [rax] + +pmulhrsw xmm1, xmm2 +pmulhrsw xmm1, [rax] +pmulhrsw xmm1, dqword [rax] +vpmulhrsw xmm1, xmm2 +vpmulhrsw xmm1, [rax] +vpmulhrsw xmm1, dqword [rax] +vpmulhrsw xmm1, xmm2, xmm3 +vpmulhrsw xmm1, xmm2, [rax] +vpmulhrsw xmm1, xmm2, dqword [rax] + +pmulhw xmm1, xmm2 +pmulhw xmm1, [rax] +pmulhw xmm1, dqword [rax] +vpmulhw xmm1, xmm2 +vpmulhw xmm1, [rax] +vpmulhw xmm1, dqword [rax] +vpmulhw xmm1, xmm2, xmm3 +vpmulhw xmm1, xmm2, [rax] +vpmulhw xmm1, xmm2, dqword [rax] + +pmullw xmm1, xmm2 +pmullw xmm1, [rax] +pmullw xmm1, dqword [rax] +vpmullw xmm1, xmm2 +vpmullw xmm1, [rax] +vpmullw xmm1, dqword [rax] +vpmullw xmm1, xmm2, xmm3 +vpmullw xmm1, xmm2, [rax] +vpmullw xmm1, xmm2, dqword [rax] + +pmulld xmm1, xmm2 +pmulld xmm1, [rax] +pmulld xmm1, dqword [rax] +vpmulld xmm1, xmm2 +vpmulld xmm1, [rax] +vpmulld xmm1, dqword [rax] +vpmulld xmm1, xmm2, xmm3 +vpmulld xmm1, xmm2, [rax] +vpmulld xmm1, xmm2, dqword [rax] + +pmuludq xmm1, xmm2 +pmuludq xmm1, [rax] +pmuludq xmm1, dqword [rax] +vpmuludq xmm1, xmm2 +vpmuludq xmm1, [rax] +vpmuludq xmm1, dqword [rax] +vpmuludq xmm1, xmm2, xmm3 +vpmuludq xmm1, xmm2, [rax] +vpmuludq xmm1, xmm2, dqword [rax] + +pmuldq xmm1, xmm2 +pmuldq xmm1, [rax] +pmuldq xmm1, dqword [rax] +vpmuldq xmm1, xmm2 +vpmuldq xmm1, [rax] +vpmuldq xmm1, dqword [rax] +vpmuldq xmm1, xmm2, xmm3 +vpmuldq xmm1, xmm2, [rax] +vpmuldq xmm1, xmm2, dqword [rax] + +por xmm1, xmm2 +por xmm1, [rax] +por xmm1, dqword [rax] +vpor xmm1, xmm2 +vpor xmm1, [rax] +vpor xmm1, dqword [rax] +vpor xmm1, xmm2, xmm3 +vpor xmm1, xmm2, [rax] +vpor xmm1, xmm2, dqword [rax] + +psadbw xmm1, xmm2 +psadbw xmm1, [rax] +psadbw xmm1, dqword [rax] +vpsadbw xmm1, xmm2 +vpsadbw xmm1, [rax] +vpsadbw xmm1, dqword [rax] +vpsadbw xmm1, xmm2, xmm3 +vpsadbw xmm1, xmm2, [rax] +vpsadbw xmm1, xmm2, dqword [rax] + +pshufb xmm1, xmm2 +pshufb xmm1, [rax] +pshufb xmm1, dqword [rax] +vpshufb xmm1, xmm2 +vpshufb xmm1, [rax] +vpshufb xmm1, dqword [rax] +vpshufb xmm1, xmm2, xmm3 +vpshufb xmm1, xmm2, [rax] +vpshufb xmm1, xmm2, dqword [rax] + +pshufd xmm1, xmm2, 5 +pshufd xmm1, [rax], byte 5 +pshufd xmm1, dqword [rax], 5 +vpshufd xmm1, xmm2, 5 +vpshufd xmm1, [rax], byte 5 +vpshufd xmm1, dqword [rax], 5 + +pshufhw xmm1, xmm2, 5 +pshufhw xmm1, [rax], byte 5 +pshufhw xmm1, dqword [rax], 5 +vpshufhw xmm1, xmm2, 5 +vpshufhw xmm1, [rax], byte 5 +vpshufhw xmm1, dqword [rax], 5 + +pshuflw xmm1, xmm2, 5 +pshuflw xmm1, [rax], byte 5 +pshuflw xmm1, dqword [rax], 5 +vpshuflw xmm1, xmm2, 5 +vpshuflw xmm1, [rax], byte 5 +vpshuflw xmm1, dqword [rax], 5 + +psignb xmm1, xmm2 +psignb xmm1, [rax] +psignb xmm1, dqword [rax] +vpsignb xmm1, xmm2 +vpsignb xmm1, [rax] +vpsignb xmm1, dqword [rax] +vpsignb xmm1, xmm2, xmm3 +vpsignb xmm1, xmm2, [rax] +vpsignb xmm1, xmm2, dqword [rax] + +psignw xmm1, xmm2 +psignw xmm1, [rax] +psignw xmm1, dqword [rax] +vpsignw xmm1, xmm2 +vpsignw xmm1, [rax] +vpsignw xmm1, dqword [rax] +vpsignw xmm1, xmm2, xmm3 +vpsignw xmm1, xmm2, [rax] +vpsignw xmm1, xmm2, dqword [rax] + +psignd xmm1, xmm2 +psignd xmm1, [rax] +psignd xmm1, dqword [rax] +vpsignd xmm1, xmm2 +vpsignd xmm1, [rax] +vpsignd xmm1, dqword [rax] +vpsignd xmm1, xmm2, xmm3 +vpsignd xmm1, xmm2, [rax] +vpsignd xmm1, xmm2, dqword [rax] + +; Test these with high regs as it goes into VEX.B (REX.B) +pslldq xmm11, 5 +pslldq xmm11, byte 5 +vpslldq xmm11, 5 +vpslldq xmm11, byte 5 +vpslldq xmm11, xmm12, 5 +vpslldq xmm11, xmm12, byte 5 + +pslldq xmm1, 5 +pslldq xmm1, byte 5 +vpslldq xmm1, 5 +vpslldq xmm1, byte 5 +vpslldq xmm1, xmm2, 5 +vpslldq xmm1, xmm2, byte 5 + +psrldq xmm1, 5 +psrldq xmm1, byte 5 +vpsrldq xmm1, 5 +vpsrldq xmm1, byte 5 +vpsrldq xmm1, xmm2, 5 +vpsrldq xmm1, xmm2, byte 5 + +psllw xmm1, xmm2 +psllw xmm1, [rax] +psllw xmm1, dqword [rax] +vpsllw xmm1, xmm2 +vpsllw xmm1, [rax] +vpsllw xmm1, dqword [rax] +vpsllw xmm1, xmm2, xmm3 +vpsllw xmm1, xmm2, [rax] +vpsllw xmm1, xmm2, dqword [rax] +psllw xmm1, 5 +psllw xmm1, byte 5 +vpsllw xmm1, 5 +vpsllw xmm1, byte 5 +vpsllw xmm1, xmm2, 5 +vpsllw xmm1, xmm2, byte 5 + +pslld xmm1, xmm2 +pslld xmm1, [rax] +pslld xmm1, dqword [rax] +vpslld xmm1, xmm2 +vpslld xmm1, [rax] +vpslld xmm1, dqword [rax] +vpslld xmm1, xmm2, xmm3 +vpslld xmm1, xmm2, [rax] +vpslld xmm1, xmm2, dqword [rax] +pslld xmm1, 5 +pslld xmm1, byte 5 +vpslld xmm1, 5 +vpslld xmm1, byte 5 +vpslld xmm1, xmm2, 5 +vpslld xmm1, xmm2, byte 5 + +psllq xmm1, xmm2 +psllq xmm1, [rax] +psllq xmm1, dqword [rax] +vpsllq xmm1, xmm2 +vpsllq xmm1, [rax] +vpsllq xmm1, dqword [rax] +vpsllq xmm1, xmm2, xmm3 +vpsllq xmm1, xmm2, [rax] +vpsllq xmm1, xmm2, dqword [rax] +psllq xmm1, 5 +psllq xmm1, byte 5 +vpsllq xmm1, 5 +vpsllq xmm1, byte 5 +vpsllq xmm1, xmm2, 5 +vpsllq xmm1, xmm2, byte 5 + +psraw xmm1, xmm2 +psraw xmm1, [rax] +psraw xmm1, dqword [rax] +vpsraw xmm1, xmm2 +vpsraw xmm1, [rax] +vpsraw xmm1, dqword [rax] +vpsraw xmm1, xmm2, xmm3 +vpsraw xmm1, xmm2, [rax] +vpsraw xmm1, xmm2, dqword [rax] +psraw xmm1, 5 +psraw xmm1, byte 5 +vpsraw xmm1, 5 +vpsraw xmm1, byte 5 +vpsraw xmm1, xmm2, 5 +vpsraw xmm1, xmm2, byte 5 + +psrad xmm1, xmm2 +psrad xmm1, [rax] +psrad xmm1, dqword [rax] +vpsrad xmm1, xmm2 +vpsrad xmm1, [rax] +vpsrad xmm1, dqword [rax] +vpsrad xmm1, xmm2, xmm3 +vpsrad xmm1, xmm2, [rax] +vpsrad xmm1, xmm2, dqword [rax] +psrad xmm1, 5 +psrad xmm1, byte 5 +vpsrad xmm1, 5 +vpsrad xmm1, byte 5 +vpsrad xmm1, xmm2, 5 +vpsrad xmm1, xmm2, byte 5 + +psrlw xmm1, xmm2 +psrlw xmm1, [rax] +psrlw xmm1, dqword [rax] +vpsrlw xmm1, xmm2 +vpsrlw xmm1, [rax] +vpsrlw xmm1, dqword [rax] +vpsrlw xmm1, xmm2, xmm3 +vpsrlw xmm1, xmm2, [rax] +vpsrlw xmm1, xmm2, dqword [rax] +psrlw xmm1, 5 +psrlw xmm1, byte 5 +vpsrlw xmm1, 5 +vpsrlw xmm1, byte 5 +vpsrlw xmm1, xmm2, 5 +vpsrlw xmm1, xmm2, byte 5 + +psrld xmm1, xmm2 +psrld xmm1, [rax] +psrld xmm1, dqword [rax] +vpsrld xmm1, xmm2 +vpsrld xmm1, [rax] +vpsrld xmm1, dqword [rax] +vpsrld xmm1, xmm2, xmm3 +vpsrld xmm1, xmm2, [rax] +vpsrld xmm1, xmm2, dqword [rax] +psrld xmm1, 5 +psrld xmm1, byte 5 +vpsrld xmm1, 5 +vpsrld xmm1, byte 5 +vpsrld xmm1, xmm2, 5 +vpsrld xmm1, xmm2, byte 5 + +psrlq xmm1, xmm2 +psrlq xmm1, [rax] +psrlq xmm1, dqword [rax] +vpsrlq xmm1, xmm2 +vpsrlq xmm1, [rax] +vpsrlq xmm1, dqword [rax] +vpsrlq xmm1, xmm2, xmm3 +vpsrlq xmm1, xmm2, [rax] +vpsrlq xmm1, xmm2, dqword [rax] +psrlq xmm1, 5 +psrlq xmm1, byte 5 +vpsrlq xmm1, 5 +vpsrlq xmm1, byte 5 +vpsrlq xmm1, xmm2, 5 +vpsrlq xmm1, xmm2, byte 5 + +ptest xmm1, xmm2 +ptest xmm1, [rax] +ptest xmm1, dqword [rax] +vptest xmm1, xmm2 +vptest xmm1, [rax] +vptest xmm1, dqword [rax] +vptest ymm1, ymm2 +vptest ymm1, [rax] +vptest ymm1, yword [rax] + +vtestps xmm1, xmm2 +vtestps xmm1, [rax] +vtestps xmm1, dqword [rax] +vtestps ymm1, ymm2 +vtestps ymm1, [rax] +vtestps ymm1, yword [rax] + +vtestpd xmm1, xmm2 +vtestpd xmm1, [rax] +vtestpd xmm1, dqword [rax] +vtestpd ymm1, ymm2 +vtestpd ymm1, [rax] +vtestpd ymm1, yword [rax] + +psubb xmm1, xmm2 +psubb xmm1, [rax] +psubb xmm1, dqword [rax] +vpsubb xmm1, xmm2 +vpsubb xmm1, [rax] +vpsubb xmm1, dqword [rax] +vpsubb xmm1, xmm2, xmm3 +vpsubb xmm1, xmm2, [rax] +vpsubb xmm1, xmm2, dqword [rax] + +psubw xmm1, xmm2 +psubw xmm1, [rax] +psubw xmm1, dqword [rax] +vpsubw xmm1, xmm2 +vpsubw xmm1, [rax] +vpsubw xmm1, dqword [rax] +vpsubw xmm1, xmm2, xmm3 +vpsubw xmm1, xmm2, [rax] +vpsubw xmm1, xmm2, dqword [rax] + +psubd xmm1, xmm2 +psubd xmm1, [rax] +psubd xmm1, dqword [rax] +vpsubd xmm1, xmm2 +vpsubd xmm1, [rax] +vpsubd xmm1, dqword [rax] +vpsubd xmm1, xmm2, xmm3 +vpsubd xmm1, xmm2, [rax] +vpsubd xmm1, xmm2, dqword [rax] + +psubq xmm1, xmm2 +psubq xmm1, [rax] +psubq xmm1, dqword [rax] +vpsubq xmm1, xmm2 +vpsubq xmm1, [rax] +vpsubq xmm1, dqword [rax] +vpsubq xmm1, xmm2, xmm3 +vpsubq xmm1, xmm2, [rax] +vpsubq xmm1, xmm2, dqword [rax] + +psubsb xmm1, xmm2 +psubsb xmm1, [rax] +psubsb xmm1, dqword [rax] +vpsubsb xmm1, xmm2 +vpsubsb xmm1, [rax] +vpsubsb xmm1, dqword [rax] +vpsubsb xmm1, xmm2, xmm3 +vpsubsb xmm1, xmm2, [rax] +vpsubsb xmm1, xmm2, dqword [rax] + +psubsw xmm1, xmm2 +psubsw xmm1, [rax] +psubsw xmm1, dqword [rax] +vpsubsw xmm1, xmm2 +vpsubsw xmm1, [rax] +vpsubsw xmm1, dqword [rax] +vpsubsw xmm1, xmm2, xmm3 +vpsubsw xmm1, xmm2, [rax] +vpsubsw xmm1, xmm2, dqword [rax] + +psubusb xmm1, xmm2 +psubusb xmm1, [rax] +psubusb xmm1, dqword [rax] +vpsubusb xmm1, xmm2 +vpsubusb xmm1, [rax] +vpsubusb xmm1, dqword [rax] +vpsubusb xmm1, xmm2, xmm3 +vpsubusb xmm1, xmm2, [rax] +vpsubusb xmm1, xmm2, dqword [rax] + +psubusw xmm1, xmm2 +psubusw xmm1, [rax] +psubusw xmm1, dqword [rax] +vpsubusw xmm1, xmm2 +vpsubusw xmm1, [rax] +vpsubusw xmm1, dqword [rax] +vpsubusw xmm1, xmm2, xmm3 +vpsubusw xmm1, xmm2, [rax] +vpsubusw xmm1, xmm2, dqword [rax] + +punpckhbw xmm1, xmm2 +punpckhbw xmm1, [rax] +punpckhbw xmm1, dqword [rax] +vpunpckhbw xmm1, xmm2 +vpunpckhbw xmm1, [rax] +vpunpckhbw xmm1, dqword [rax] +vpunpckhbw xmm1, xmm2, xmm3 +vpunpckhbw xmm1, xmm2, [rax] +vpunpckhbw xmm1, xmm2, dqword [rax] + +punpckhwd xmm1, xmm2 +punpckhwd xmm1, [rax] +punpckhwd xmm1, dqword [rax] +vpunpckhwd xmm1, xmm2 +vpunpckhwd xmm1, [rax] +vpunpckhwd xmm1, dqword [rax] +vpunpckhwd xmm1, xmm2, xmm3 +vpunpckhwd xmm1, xmm2, [rax] +vpunpckhwd xmm1, xmm2, dqword [rax] + +punpckhdq xmm1, xmm2 +punpckhdq xmm1, [rax] +punpckhdq xmm1, dqword [rax] +vpunpckhdq xmm1, xmm2 +vpunpckhdq xmm1, [rax] +vpunpckhdq xmm1, dqword [rax] +vpunpckhdq xmm1, xmm2, xmm3 +vpunpckhdq xmm1, xmm2, [rax] +vpunpckhdq xmm1, xmm2, dqword [rax] + +punpckhqdq xmm1, xmm2 +punpckhqdq xmm1, [rax] +punpckhqdq xmm1, dqword [rax] +vpunpckhqdq xmm1, xmm2 +vpunpckhqdq xmm1, [rax] +vpunpckhqdq xmm1, dqword [rax] +vpunpckhqdq xmm1, xmm2, xmm3 +vpunpckhqdq xmm1, xmm2, [rax] +vpunpckhqdq xmm1, xmm2, dqword [rax] + +punpcklbw xmm1, xmm2 +punpcklbw xmm1, [rax] +punpcklbw xmm1, dqword [rax] +vpunpcklbw xmm1, xmm2 +vpunpcklbw xmm1, [rax] +vpunpcklbw xmm1, dqword [rax] +vpunpcklbw xmm1, xmm2, xmm3 +vpunpcklbw xmm1, xmm2, [rax] +vpunpcklbw xmm1, xmm2, dqword [rax] + +punpcklwd xmm1, xmm2 +punpcklwd xmm1, [rax] +punpcklwd xmm1, dqword [rax] +vpunpcklwd xmm1, xmm2 +vpunpcklwd xmm1, [rax] +vpunpcklwd xmm1, dqword [rax] +vpunpcklwd xmm1, xmm2, xmm3 +vpunpcklwd xmm1, xmm2, [rax] +vpunpcklwd xmm1, xmm2, dqword [rax] + +punpckldq xmm1, xmm2 +punpckldq xmm1, [rax] +punpckldq xmm1, dqword [rax] +vpunpckldq xmm1, xmm2 +vpunpckldq xmm1, [rax] +vpunpckldq xmm1, dqword [rax] +vpunpckldq xmm1, xmm2, xmm3 +vpunpckldq xmm1, xmm2, [rax] +vpunpckldq xmm1, xmm2, dqword [rax] + +punpcklqdq xmm1, xmm2 +punpcklqdq xmm1, [rax] +punpcklqdq xmm1, dqword [rax] +vpunpcklqdq xmm1, xmm2 +vpunpcklqdq xmm1, [rax] +vpunpcklqdq xmm1, dqword [rax] +vpunpcklqdq xmm1, xmm2, xmm3 +vpunpcklqdq xmm1, xmm2, [rax] +vpunpcklqdq xmm1, xmm2, dqword [rax] + +pxor xmm1, xmm2 +pxor xmm1, [rax] +pxor xmm1, dqword [rax] +vpxor xmm1, xmm2 +vpxor xmm1, [rax] +vpxor xmm1, dqword [rax] +vpxor xmm1, xmm2, xmm3 +vpxor xmm1, xmm2, [rax] +vpxor xmm1, xmm2, dqword [rax] + +rcpps xmm1, xmm2 +rcpps xmm1, [rax] +rcpps xmm1, dqword [rax] +vrcpps xmm1, xmm2 +vrcpps xmm1, [rax] +vrcpps xmm1, dqword [rax] +vrcpps ymm1, ymm2 +vrcpps ymm1, [rax] +vrcpps ymm1, yword [rax] + +rcpss xmm1, xmm2 +rcpss xmm1, [rax] +rcpss xmm1, dword [rax] +vrcpss xmm1, xmm2 +vrcpss xmm1, [rax] +vrcpss xmm1, dword [rax] +vrcpss xmm1, xmm2, xmm3 +vrcpss xmm1, xmm2, [rax] +vrcpss xmm1, xmm2, dword [rax] + +rsqrtps xmm1, xmm2 +rsqrtps xmm1, [rax] +rsqrtps xmm1, dqword [rax] +vrsqrtps xmm1, xmm2 +vrsqrtps xmm1, [rax] +vrsqrtps xmm1, dqword [rax] +vrsqrtps ymm1, ymm2 +vrsqrtps ymm1, [rax] +vrsqrtps ymm1, yword [rax] + +rsqrtss xmm1, xmm2 +rsqrtss xmm1, [rax] +rsqrtss xmm1, dword [rax] +vrsqrtss xmm1, xmm2 +vrsqrtss xmm1, [rax] +vrsqrtss xmm1, dword [rax] +vrsqrtss xmm1, xmm2, xmm3 +vrsqrtss xmm1, xmm2, [rax] +vrsqrtss xmm1, xmm2, dword [rax] + +roundpd xmm1, xmm2, 5 +roundpd xmm1, [rax], byte 5 +roundpd xmm1, dqword [rax], 5 +vroundpd xmm1, xmm2, 5 +vroundpd xmm1, [rax], byte 5 +vroundpd xmm1, dqword [rax], 5 +vroundpd ymm1, ymm2, 5 +vroundpd ymm1, [rax], byte 5 +vroundpd ymm1, yword [rax], 5 + +roundps xmm1, xmm2, 5 +roundps xmm1, [rax], byte 5 +roundps xmm1, dqword [rax], 5 +vroundps xmm1, xmm2, 5 +vroundps xmm1, [rax], byte 5 +vroundps xmm1, dqword [rax], 5 +vroundps ymm1, ymm2, 5 +vroundps ymm1, [rax], byte 5 +vroundps ymm1, yword [rax], 5 + +roundsd xmm1, xmm2, 5 +roundsd xmm1, [rax], byte 5 +roundsd xmm1, qword [rax], 5 +vroundsd xmm1, xmm2, 5 +vroundsd xmm1, [rax], byte 5 +vroundsd xmm1, qword [rax], 5 +vroundsd xmm1, xmm2, xmm3, 5 +vroundsd xmm1, xmm2, [rax], byte 5 +vroundsd xmm1, xmm2, qword [rax], 5 + +roundss xmm1, xmm2, 5 +roundss xmm1, [rax], byte 5 +roundss xmm1, dword [rax], 5 +vroundss xmm1, xmm2, 5 +vroundss xmm1, [rax], byte 5 +vroundss xmm1, dword [rax], 5 +vroundss xmm1, xmm2, xmm3, 5 +vroundss xmm1, xmm2, [rax], byte 5 +vroundss xmm1, xmm2, dword [rax], 5 + +shufpd xmm1, xmm2, 5 +shufpd xmm1, [rax], byte 5 +shufpd xmm1, dqword [rax], 5 +vshufpd xmm1, xmm2, 5 +vshufpd xmm1, [rax], byte 5 +vshufpd xmm1, dqword [rax], 5 +vshufpd xmm1, xmm2, xmm3, 5 +vshufpd xmm1, xmm2, [rax], byte 5 +vshufpd xmm1, xmm2, dqword [rax], 5 +vshufpd ymm1, ymm2, ymm3, 5 +vshufpd ymm1, ymm2, [rax], byte 5 +vshufpd ymm1, ymm2, yword [rax], 5 + +shufps xmm1, xmm2, 5 +shufps xmm1, [rax], byte 5 +shufps xmm1, dqword [rax], 5 +vshufps xmm1, xmm2, 5 +vshufps xmm1, [rax], byte 5 +vshufps xmm1, dqword [rax], 5 +vshufps xmm1, xmm2, xmm3, 5 +vshufps xmm1, xmm2, [rax], byte 5 +vshufps xmm1, xmm2, dqword [rax], 5 +vshufps ymm1, ymm2, ymm3, 5 +vshufps ymm1, ymm2, [rax], byte 5 +vshufps ymm1, ymm2, yword [rax], 5 + +sqrtpd xmm1, xmm2 +sqrtpd xmm1, [rax] +sqrtpd xmm1, dqword [rax] +vsqrtpd xmm1, xmm2 +vsqrtpd xmm1, [rax] +vsqrtpd xmm1, dqword [rax] +vsqrtpd ymm1, ymm2 +vsqrtpd ymm1, [rax] +vsqrtpd ymm1, yword [rax] + +sqrtps xmm1, xmm2 +sqrtps xmm1, [rax] +sqrtps xmm1, dqword [rax] +vsqrtps xmm1, xmm2 +vsqrtps xmm1, [rax] +vsqrtps xmm1, dqword [rax] +vsqrtps ymm1, ymm2 +vsqrtps ymm1, [rax] +vsqrtps ymm1, yword [rax] + +sqrtsd xmm1, xmm2 +sqrtsd xmm1, [rax] +sqrtsd xmm1, qword [rax] +vsqrtsd xmm1, xmm2 +vsqrtsd xmm1, [rax] +vsqrtsd xmm1, qword [rax] +vsqrtsd xmm1, xmm2, xmm3 +vsqrtsd xmm1, xmm2, [rax] +vsqrtsd xmm1, xmm2, qword [rax] + +sqrtss xmm1, xmm2 +sqrtss xmm1, [rax] +sqrtss xmm1, dword [rax] +vsqrtss xmm1, xmm2 +vsqrtss xmm1, [rax] +vsqrtss xmm1, dword [rax] +vsqrtss xmm1, xmm2, xmm3 +vsqrtss xmm1, xmm2, [rax] +vsqrtss xmm1, xmm2, dword [rax] + +stmxcsr [rax] +stmxcsr dword [rax] +vstmxcsr [rax] +vstmxcsr dword [rax] + +subpd xmm1, xmm2 +subpd xmm1, [rax] +subpd xmm1, dqword [rax] +vsubpd xmm1, xmm2 +vsubpd xmm1, [rax] +vsubpd xmm1, dqword [rax] +vsubpd xmm1, xmm2, xmm3 +vsubpd xmm1, xmm2, [rax] +vsubpd xmm1, xmm2, dqword [rax] +vsubpd ymm1, ymm2, ymm3 +vsubpd ymm1, ymm2, [rax] +vsubpd ymm1, ymm2, yword [rax] + +subps xmm1, xmm2 +subps xmm1, [rax] +subps xmm1, dqword [rax] +vsubps xmm1, xmm2 +vsubps xmm1, [rax] +vsubps xmm1, dqword [rax] +vsubps xmm1, xmm2, xmm3 +vsubps xmm1, xmm2, [rax] +vsubps xmm1, xmm2, dqword [rax] +vsubps ymm1, ymm2, ymm3 +vsubps ymm1, ymm2, [rax] +vsubps ymm1, ymm2, yword [rax] + +subsd xmm1, xmm2 +subsd xmm1, [rax] +subsd xmm1, qword [rax] +vsubsd xmm1, xmm2 +vsubsd xmm1, [rax] +vsubsd xmm1, qword [rax] +vsubsd xmm1, xmm2, xmm3 +vsubsd xmm1, xmm2, [rax] +vsubsd xmm1, xmm2, qword [rax] + +subss xmm1, xmm2 +subss xmm1, [rax] +subss xmm1, dword [rax] +vsubss xmm1, xmm2 +vsubss xmm1, [rax] +vsubss xmm1, dword [rax] +vsubss xmm1, xmm2, xmm3 +vsubss xmm1, xmm2, [rax] +vsubss xmm1, xmm2, dword [rax] + +ucomisd xmm1, xmm2 +ucomisd xmm1, [rax] +ucomisd xmm1, qword [rax] +vucomisd xmm1, xmm2 +vucomisd xmm1, [rax] +vucomisd xmm1, qword [rax] + +ucomiss xmm1, xmm2 +ucomiss xmm1, [rax] +ucomiss xmm1, dword [rax] +vucomiss xmm1, xmm2 +vucomiss xmm1, [rax] +vucomiss xmm1, dword [rax] + +unpckhpd xmm1, xmm2 +unpckhpd xmm1, [rax] +unpckhpd xmm1, dqword [rax] +vunpckhpd xmm1, xmm2 +vunpckhpd xmm1, [rax] +vunpckhpd xmm1, dqword [rax] +vunpckhpd xmm1, xmm2, xmm3 +vunpckhpd xmm1, xmm2, [rax] +vunpckhpd xmm1, xmm2, dqword [rax] +vunpckhpd ymm1, ymm2, ymm3 +vunpckhpd ymm1, ymm2, [rax] +vunpckhpd ymm1, ymm2, yword [rax] + +unpckhps xmm1, xmm2 +unpckhps xmm1, [rax] +unpckhps xmm1, dqword [rax] +vunpckhps xmm1, xmm2 +vunpckhps xmm1, [rax] +vunpckhps xmm1, dqword [rax] +vunpckhps xmm1, xmm2, xmm3 +vunpckhps xmm1, xmm2, [rax] +vunpckhps xmm1, xmm2, dqword [rax] +vunpckhps ymm1, ymm2, ymm3 +vunpckhps ymm1, ymm2, [rax] +vunpckhps ymm1, ymm2, yword [rax] + +unpcklpd xmm1, xmm2 +unpcklpd xmm1, [rax] +unpcklpd xmm1, dqword [rax] +vunpcklpd xmm1, xmm2 +vunpcklpd xmm1, [rax] +vunpcklpd xmm1, dqword [rax] +vunpcklpd xmm1, xmm2, xmm3 +vunpcklpd xmm1, xmm2, [rax] +vunpcklpd xmm1, xmm2, dqword [rax] +vunpcklpd ymm1, ymm2, ymm3 +vunpcklpd ymm1, ymm2, [rax] +vunpcklpd ymm1, ymm2, yword [rax] + +unpcklps xmm1, xmm2 +unpcklps xmm1, [rax] +unpcklps xmm1, dqword [rax] +vunpcklps xmm1, xmm2 +vunpcklps xmm1, [rax] +vunpcklps xmm1, dqword [rax] +vunpcklps xmm1, xmm2, xmm3 +vunpcklps xmm1, xmm2, [rax] +vunpcklps xmm1, xmm2, dqword [rax] +vunpcklps ymm1, ymm2, ymm3 +vunpcklps ymm1, ymm2, [rax] +vunpcklps ymm1, ymm2, yword [rax] + +xorpd xmm1, xmm2 +xorpd xmm1, [rax] +xorpd xmm1, dqword [rax] +vxorpd xmm1, xmm2 +vxorpd xmm1, [rax] +vxorpd xmm1, dqword [rax] +vxorpd xmm1, xmm2, xmm3 +vxorpd xmm1, xmm2, [rax] +vxorpd xmm1, xmm2, dqword [rax] +vxorpd ymm1, ymm2, ymm3 +vxorpd ymm1, ymm2, [rax] +vxorpd ymm1, ymm2, yword [rax] + +xorps xmm1, xmm2 +xorps xmm1, [rax] +xorps xmm1, dqword [rax] +vxorps xmm1, xmm2 +vxorps xmm1, [rax] +vxorps xmm1, dqword [rax] +vxorps xmm1, xmm2, xmm3 +vxorps xmm1, xmm2, [rax] +vxorps xmm1, xmm2, dqword [rax] +vxorps ymm1, ymm2, ymm3 +vxorps ymm1, ymm2, [rax] +vxorps ymm1, ymm2, yword [rax] + +vzeroall + +vzeroupper + diff --git a/modules/arch/x86/tests/avx.hex b/modules/arch/x86/tests/avx.hex new file mode 100644 index 00000000..57eb96f5 --- /dev/null +++ b/modules/arch/x86/tests/avx.hex @@ -0,0 +1,10332 @@ +66 +0f +58 +ca +66 +0f +58 +08 +66 +0f +58 +08 +66 +45 +0f +58 +d4 +66 +46 +0f +58 +14 +b8 +66 +47 +0f +58 +14 +be +c5 +f1 +58 +ca +c5 +f1 +58 +08 +c5 +f1 +58 +08 +c4 +41 +29 +58 +d4 +c4 +21 +29 +58 +14 +b8 +c4 +01 +29 +58 +14 +be +c5 +e9 +58 +cb +c5 +e9 +58 +08 +c5 +e9 +58 +08 +c4 +41 +19 +58 +d5 +c4 +21 +19 +58 +14 +b8 +c4 +01 +19 +58 +14 +be +c5 +ed +58 +cb +c5 +ed +58 +08 +c5 +ed +58 +08 +c4 +41 +1d +58 +d5 +c4 +21 +1d +58 +14 +b8 +c4 +01 +1d +58 +14 +be +0f +58 +ca +0f +58 +08 +0f +58 +08 +c5 +f0 +58 +ca +c5 +f0 +58 +08 +c5 +f0 +58 +08 +c5 +e8 +58 +cb +c5 +e8 +58 +08 +c5 +e8 +58 +08 +c5 +ec +58 +cb +c5 +ec +58 +08 +c5 +ec +58 +08 +f2 +0f +58 +ca +f2 +0f +58 +08 +f2 +0f +58 +08 +c5 +f3 +58 +ca +c5 +f3 +58 +08 +c5 +f3 +58 +08 +c5 +eb +58 +cb +c5 +eb +58 +08 +c5 +eb +58 +08 +f3 +0f +58 +ca +f3 +0f +58 +08 +f3 +0f +58 +08 +c5 +f2 +58 +ca +c5 +f2 +58 +08 +c5 +f2 +58 +08 +c5 +ea +58 +cb +c5 +ea +58 +08 +c5 +ea +58 +08 +66 +0f +d0 +ca +66 +0f +d0 +08 +66 +0f +d0 +08 +c5 +f1 +d0 +ca +c5 +f1 +d0 +08 +c5 +f1 +d0 +08 +c5 +e9 +d0 +cb +c5 +e9 +d0 +08 +c5 +e9 +d0 +08 +c5 +ed +d0 +cb +c5 +ed +d0 +08 +c5 +ed +d0 +08 +f2 +0f +d0 +ca +f2 +0f +d0 +08 +f2 +0f +d0 +08 +c5 +f3 +d0 +ca +c5 +f3 +d0 +08 +c5 +f3 +d0 +08 +c5 +eb +d0 +cb +c5 +eb +d0 +08 +c5 +eb +d0 +08 +c5 +ef +d0 +cb +c5 +ef +d0 +08 +c5 +ef +d0 +08 +66 +0f +54 +ca +66 +0f +54 +08 +66 +0f +54 +08 +c5 +f1 +54 +ca +c5 +f1 +54 +08 +c5 +f1 +54 +08 +c5 +e9 +54 +cb +c5 +e9 +54 +08 +c5 +e9 +54 +08 +c5 +ed +54 +cb +c5 +ed +54 +08 +c5 +ed +54 +08 +0f +54 +ca +0f +54 +08 +0f +54 +08 +c5 +f0 +54 +ca +c5 +f0 +54 +08 +c5 +f0 +54 +08 +c5 +e8 +54 +cb +c5 +e8 +54 +08 +c5 +e8 +54 +08 +c5 +ec +54 +cb +c5 +ec +54 +08 +c5 +ec +54 +08 +66 +0f +55 +ca +66 +0f +55 +08 +66 +0f +55 +08 +c5 +f1 +55 +ca +c5 +f1 +55 +08 +c5 +f1 +55 +08 +c5 +e9 +55 +cb +c5 +e9 +55 +08 +c5 +e9 +55 +08 +c5 +ed +55 +cb +c5 +ed +55 +08 +c5 +ed +55 +08 +0f +55 +ca +0f +55 +08 +0f +55 +08 +c5 +f0 +55 +ca +c5 +f0 +55 +08 +c5 +f0 +55 +08 +c5 +e8 +55 +cb +c5 +e8 +55 +08 +c5 +e8 +55 +08 +c5 +ec +55 +cb +c5 +ec +55 +08 +c5 +ec +55 +08 +66 +0f +3a +0d +ca +05 +66 +0f +3a +0d +08 +05 +66 +0f +3a +0d +08 +05 +c4 +e3 +71 +0d +ca +05 +c4 +e3 +71 +0d +08 +05 +c4 +e3 +71 +0d +08 +05 +c4 +e3 +69 +0d +cb +05 +c4 +e3 +69 +0d +08 +05 +c4 +e3 +69 +0d +08 +05 +c4 +e3 +6d +0d +cb +05 +c4 +e3 +6d +0d +08 +05 +c4 +e3 +6d +0d +08 +05 +66 +0f +3a +0c +ca +05 +66 +0f +3a +0c +08 +05 +66 +0f +3a +0c +08 +05 +c4 +e3 +71 +0c +ca +05 +c4 +e3 +71 +0c +08 +05 +c4 +e3 +71 +0c +08 +05 +c4 +e3 +69 +0c +cb +05 +c4 +e3 +69 +0c +08 +05 +c4 +e3 +69 +0c +08 +05 +c4 +e3 +6d +0c +cb +05 +c4 +e3 +6d +0c +08 +05 +c4 +e3 +6d +0c +08 +05 +66 +0f +38 +15 +cb +66 +0f +38 +15 +08 +66 +0f +38 +15 +08 +66 +0f +38 +15 +cb +66 +0f +38 +15 +08 +66 +0f +38 +15 +08 +c4 +e3 +69 +4b +cb +40 +c4 +e3 +69 +4b +08 +40 +c4 +e3 +69 +4b +08 +40 +c4 +e3 +6d +4b +cb +40 +c4 +e3 +6d +4b +08 +40 +c4 +e3 +6d +4b +08 +40 +66 +0f +38 +14 +cb +66 +0f +38 +14 +08 +66 +0f +38 +14 +08 +66 +0f +38 +14 +cb +66 +0f +38 +14 +08 +66 +0f +38 +14 +08 +c4 +e3 +69 +4a +cb +40 +c4 +e3 +69 +4a +08 +40 +c4 +e3 +69 +4a +08 +40 +c4 +e3 +6d +4a +cb +40 +c4 +e3 +6d +4a +08 +40 +c4 +e3 +6d +4a +08 +40 +c4 +e2 +79 +18 +08 +c4 +e2 +79 +18 +08 +c4 +e2 +7d +18 +08 +c4 +e2 +7d +18 +08 +c4 +e2 +7d +19 +08 +c4 +e2 +7d +19 +08 +c4 +e2 +7d +1a +08 +c4 +e2 +7d +1a +08 +66 +0f +c2 +ca +05 +66 +0f +c2 +08 +05 +66 +0f +c2 +08 +05 +c5 +f1 +c2 +ca +05 +c5 +f1 +c2 +08 +05 +c5 +f1 +c2 +08 +05 +c5 +e9 +c2 +cb +05 +c5 +e9 +c2 +08 +05 +c5 +e9 +c2 +08 +05 +c5 +ed +c2 +cb +05 +c5 +ed +c2 +08 +05 +c5 +ed +c2 +08 +05 +0f +c2 +ca +05 +0f +c2 +08 +05 +0f +c2 +08 +05 +c5 +f0 +c2 +ca +05 +c5 +f0 +c2 +08 +05 +c5 +f0 +c2 +08 +05 +c5 +e8 +c2 +cb +05 +c5 +e8 +c2 +08 +05 +c5 +e8 +c2 +08 +05 +c5 +ec +c2 +cb +05 +c5 +ec +c2 +08 +05 +c5 +ec +c2 +08 +05 +f2 +0f +c2 +ca +05 +f2 +0f +c2 +08 +05 +f2 +0f +c2 +08 +05 +c5 +f3 +c2 +ca +05 +c5 +f3 +c2 +08 +05 +c5 +f3 +c2 +08 +05 +c5 +eb +c2 +cb +05 +c5 +eb +c2 +08 +05 +c5 +eb +c2 +08 +05 +f3 +0f +c2 +ca +05 +f3 +0f +c2 +08 +05 +f3 +0f +c2 +08 +05 +c5 +f2 +c2 +ca +05 +c5 +f2 +c2 +08 +05 +c5 +f2 +c2 +08 +05 +c5 +ea +c2 +cb +05 +c5 +ea +c2 +08 +05 +c5 +ea +c2 +08 +05 +66 +0f +2f +ca +66 +0f +2f +08 +66 +0f +2f +08 +c5 +f9 +2f +ca +c5 +f9 +2f +08 +c5 +f9 +2f +08 +0f +2f +ca +0f +2f +08 +0f +2f +08 +c5 +f8 +2f +ca +c5 +f8 +2f +08 +c5 +f8 +2f +08 +f3 +0f +e6 +ca +f3 +0f +e6 +08 +f3 +0f +e6 +08 +c5 +fa +e6 +ca +c5 +fa +e6 +08 +c5 +fa +e6 +08 +c5 +fe +e6 +ca +c5 +fe +e6 +08 +c5 +fe +e6 +08 +0f +5b +ca +0f +5b +08 +0f +5b +08 +c5 +f8 +5b +ca +c5 +f8 +5b +08 +c5 +f8 +5b +08 +c5 +fc +5b +ca +c5 +fc +5b +08 +c5 +fc +5b +08 +f2 +0f +e6 +ca +f2 +0f +e6 +08 +f2 +0f +e6 +08 +c5 +fb +e6 +ca +c5 +fb +e6 +08 +c5 +ff +e6 +ca +c5 +ff +e6 +08 +66 +0f +5a +ca +66 +0f +5a +08 +66 +0f +5a +08 +c5 +f9 +5a +ca +c5 +f9 +5a +08 +c5 +fd +5a +ca +c5 +fd +5a +08 +66 +0f +5b +ca +66 +0f +5b +08 +66 +0f +5b +08 +c5 +f9 +5b +ca +c5 +f9 +5b +08 +c5 +f9 +5b +08 +c5 +fd +5b +ca +c5 +fd +5b +08 +c5 +fd +5b +08 +0f +5a +ca +0f +5a +08 +0f +5a +08 +c5 +f8 +5a +ca +c5 +f8 +5a +08 +c5 +f8 +5a +08 +c5 +fc +5a +ca +c5 +fc +5a +08 +c5 +fc +5a +08 +f2 +0f +2d +c2 +f2 +0f +2d +00 +f2 +0f +2d +00 +c5 +fb +2d +c2 +c5 +fb +2d +00 +c5 +fb +2d +00 +f2 +48 +0f +2d +c2 +f2 +48 +0f +2d +00 +f2 +48 +0f +2d +00 +c4 +e1 +fb +2d +c2 +c4 +e1 +fb +2d +00 +c4 +e1 +fb +2d +00 +f2 +0f +5a +ca +f2 +0f +5a +08 +f2 +0f +5a +08 +c5 +f3 +5a +ca +c5 +f3 +5a +08 +c5 +f3 +5a +08 +c5 +eb +5a +cb +c5 +eb +5a +08 +c5 +eb +5a +08 +f2 +0f +2a +c8 +f2 +0f +2a +08 +c5 +f3 +2a +c8 +c5 +f3 +2a +08 +c5 +eb +2a +c8 +c5 +eb +2a +08 +f2 +48 +0f +2a +c8 +f2 +48 +0f +2a +08 +c4 +e1 +f3 +2a +c8 +c4 +e1 +f3 +2a +08 +c4 +e1 +eb +2a +c8 +c4 +e1 +eb +2a +08 +f3 +0f +2a +c8 +f3 +0f +2a +08 +c5 +f2 +2a +c8 +c5 +f2 +2a +08 +c5 +ea +2a +c8 +c5 +ea +2a +08 +f3 +48 +0f +2a +c8 +f3 +48 +0f +2a +08 +c4 +e1 +f2 +2a +c8 +c4 +e1 +f2 +2a +08 +c4 +e1 +ea +2a +c8 +c4 +e1 +ea +2a +08 +f3 +0f +5a +ca +f3 +0f +5a +08 +f3 +0f +5a +08 +c5 +f2 +5a +ca +c5 +f2 +5a +08 +c5 +f2 +5a +08 +c5 +ea +5a +cb +c5 +ea +5a +08 +c5 +ea +5a +08 +f3 +0f +2d +c2 +f3 +0f +2d +00 +f3 +0f +2d +00 +c5 +fa +2d +c2 +c5 +fa +2d +00 +c5 +fa +2d +00 +f3 +48 +0f +2d +c2 +f3 +48 +0f +2d +00 +f3 +48 +0f +2d +00 +c4 +e1 +fa +2d +c2 +c4 +e1 +fa +2d +00 +c4 +e1 +fa +2d +00 +66 +0f +e6 +ca +66 +0f +e6 +08 +66 +0f +e6 +08 +c5 +f9 +e6 +ca +c5 +f9 +e6 +08 +c5 +fd +e6 +ca +c5 +fd +e6 +08 +f3 +0f +5b +ca +f3 +0f +5b +08 +f3 +0f +5b +08 +c5 +fa +5b +ca +c5 +fa +5b +08 +c5 +fa +5b +08 +c5 +fe +5b +ca +c5 +fe +5b +08 +c5 +fe +5b +08 +f2 +0f +2c +c2 +f2 +0f +2c +00 +f2 +0f +2c +00 +c5 +fb +2c +c2 +c5 +fb +2c +00 +c5 +fb +2c +00 +f2 +48 +0f +2c +c2 +f2 +48 +0f +2c +00 +f2 +48 +0f +2c +00 +c4 +e1 +fb +2c +c2 +c4 +e1 +fb +2c +00 +c4 +e1 +fb +2c +00 +f3 +0f +2c +c2 +f3 +0f +2c +00 +f3 +0f +2c +00 +c5 +fa +2c +c2 +c5 +fa +2c +00 +c5 +fa +2c +00 +f3 +48 +0f +2c +c2 +f3 +48 +0f +2c +00 +f3 +48 +0f +2c +00 +c4 +e1 +fa +2c +c2 +c4 +e1 +fa +2c +00 +c4 +e1 +fa +2c +00 +66 +0f +5e +ca +66 +0f +5e +08 +66 +0f +5e +08 +c5 +f1 +5e +ca +c5 +f1 +5e +08 +c5 +f1 +5e +08 +c5 +e9 +5e +cb +c5 +e9 +5e +08 +c5 +e9 +5e +08 +c5 +ed +5e +cb +c5 +ed +5e +08 +c5 +ed +5e +08 +0f +5e +ca +0f +5e +08 +0f +5e +08 +c5 +f0 +5e +ca +c5 +f0 +5e +08 +c5 +f0 +5e +08 +c5 +e8 +5e +cb +c5 +e8 +5e +08 +c5 +e8 +5e +08 +c5 +ec +5e +cb +c5 +ec +5e +08 +c5 +ec +5e +08 +f2 +0f +5e +ca +f2 +0f +5e +08 +f2 +0f +5e +08 +c5 +f3 +5e +ca +c5 +f3 +5e +08 +c5 +f3 +5e +08 +c5 +eb +5e +cb +c5 +eb +5e +08 +c5 +eb +5e +08 +f3 +0f +5e +ca +f3 +0f +5e +08 +f3 +0f +5e +08 +c5 +f2 +5e +ca +c5 +f2 +5e +08 +c5 +f2 +5e +08 +c5 +ea +5e +cb +c5 +ea +5e +08 +c5 +ea +5e +08 +66 +0f +3a +41 +ca +05 +66 +0f +3a +41 +08 +05 +66 +0f +3a +41 +08 +05 +c4 +e3 +71 +41 +ca +05 +c4 +e3 +71 +41 +08 +05 +c4 +e3 +71 +41 +08 +05 +c4 +e3 +69 +41 +cb +05 +c4 +e3 +69 +41 +08 +05 +c4 +e3 +69 +41 +08 +05 +66 +0f +3a +40 +ca +05 +66 +0f +3a +40 +08 +05 +66 +0f +3a +40 +08 +05 +c4 +e3 +71 +40 +ca +05 +c4 +e3 +71 +40 +08 +05 +c4 +e3 +71 +40 +08 +05 +c4 +e3 +69 +40 +cb +05 +c4 +e3 +69 +40 +08 +05 +c4 +e3 +69 +40 +08 +05 +c4 +e3 +6d +40 +cb +05 +c4 +e3 +6d +40 +08 +05 +c4 +e3 +6d +40 +08 +05 +c4 +e3 +7d +19 +d1 +05 +c4 +e3 +7d +19 +10 +05 +c4 +e3 +7d +19 +10 +05 +66 +0f +3a +17 +c8 +05 +66 +48 +0f +3a +17 +c8 +05 +66 +0f +3a +17 +08 +05 +66 +0f +3a +17 +08 +05 +c4 +e3 +79 +17 +c8 +05 +c4 +e3 +f9 +17 +c8 +05 +c4 +e3 +79 +17 +08 +05 +c4 +e3 +79 +17 +08 +05 +66 +0f +7c +ca +66 +0f +7c +08 +66 +0f +7c +08 +c5 +f1 +7c +ca +c5 +f1 +7c +08 +c5 +f1 +7c +08 +c5 +e9 +7c +cb +c5 +e9 +7c +08 +c5 +e9 +7c +08 +c5 +ed +7c +cb +c5 +ed +7c +08 +c5 +ed +7c +08 +f2 +0f +7c +ca +f2 +0f +7c +08 +f2 +0f +7c +08 +c5 +f3 +7c +ca +c5 +f3 +7c +08 +c5 +f3 +7c +08 +c5 +eb +7c +cb +c5 +eb +7c +08 +c5 +eb +7c +08 +c5 +ef +7c +cb +c5 +ef +7c +08 +c5 +ef +7c +08 +66 +0f +7d +ca +66 +0f +7d +08 +66 +0f +7d +08 +c5 +f1 +7d +ca +c5 +f1 +7d +08 +c5 +f1 +7d +08 +c5 +e9 +7d +cb +c5 +e9 +7d +08 +c5 +e9 +7d +08 +c5 +ed +7d +cb +c5 +ed +7d +08 +c5 +ed +7d +08 +f2 +0f +7d +ca +f2 +0f +7d +08 +f2 +0f +7d +08 +c5 +f3 +7d +ca +c5 +f3 +7d +08 +c5 +f3 +7d +08 +c5 +eb +7d +cb +c5 +eb +7d +08 +c5 +eb +7d +08 +c5 +ef +7d +cb +c5 +ef +7d +08 +c5 +ef +7d +08 +c4 +e3 +6d +18 +cb +05 +c4 +e3 +6d +18 +08 +05 +c4 +e3 +6d +18 +08 +05 +66 +0f +3a +21 +ca +05 +66 +0f +3a +21 +08 +05 +66 +0f +3a +21 +08 +05 +c4 +e3 +71 +21 +ca +05 +c4 +e3 +71 +21 +08 +05 +c4 +e3 +71 +21 +08 +05 +c4 +e3 +69 +21 +cb +05 +c4 +e3 +69 +21 +08 +05 +c4 +e3 +69 +21 +08 +05 +f2 +0f +f0 +08 +f2 +0f +f0 +08 +c5 +fb +f0 +08 +c5 +fb +f0 +08 +c5 +ff +f0 +08 +c5 +ff +f0 +08 +0f +ae +10 +0f +ae +10 +c5 +f8 +ae +10 +c5 +f8 +ae +10 +66 +0f +f7 +ca +c5 +f9 +f7 +ca +c4 +e2 +69 +2c +08 +c4 +e2 +69 +2c +08 +c4 +e2 +6d +2c +08 +c4 +e2 +6d +2c +08 +c4 +e2 +69 +2e +18 +c4 +e2 +69 +2e +18 +c4 +e2 +6d +2e +18 +c4 +e2 +6d +2e +18 +c4 +e2 +69 +2d +08 +c4 +e2 +69 +2d +08 +c4 +e2 +6d +2d +08 +c4 +e2 +6d +2d +08 +c4 +e2 +69 +2f +18 +c4 +e2 +69 +2f +18 +c4 +e2 +6d +2f +18 +c4 +e2 +6d +2f +18 +66 +0f +5f +ca +66 +0f +5f +08 +66 +0f +5f +08 +c5 +f1 +5f +ca +c5 +f1 +5f +08 +c5 +f1 +5f +08 +c5 +e9 +5f +cb +c5 +e9 +5f +08 +c5 +e9 +5f +08 +c5 +ed +5f +cb +c5 +ed +5f +08 +c5 +ed +5f +08 +0f +5f +ca +0f +5f +08 +0f +5f +08 +c5 +f0 +5f +ca +c5 +f0 +5f +08 +c5 +f0 +5f +08 +c5 +e8 +5f +cb +c5 +e8 +5f +08 +c5 +e8 +5f +08 +c5 +ec +5f +cb +c5 +ec +5f +08 +c5 +ec +5f +08 +f2 +0f +5f +ca +f2 +0f +5f +08 +f2 +0f +5f +08 +c5 +f3 +5f +ca +c5 +f3 +5f +08 +c5 +f3 +5f +08 +c5 +eb +5f +cb +c5 +eb +5f +08 +c5 +eb +5f +08 +f3 +0f +5f +ca +f3 +0f +5f +08 +f3 +0f +5f +08 +c5 +f2 +5f +ca +c5 +f2 +5f +08 +c5 +f2 +5f +08 +c5 +ea +5f +cb +c5 +ea +5f +08 +c5 +ea +5f +08 +66 +0f +5d +ca +66 +0f +5d +08 +66 +0f +5d +08 +c5 +f1 +5d +ca +c5 +f1 +5d +08 +c5 +f1 +5d +08 +c5 +e9 +5d +cb +c5 +e9 +5d +08 +c5 +e9 +5d +08 +c5 +ed +5d +cb +c5 +ed +5d +08 +c5 +ed +5d +08 +0f +5d +ca +0f +5d +08 +0f +5d +08 +c5 +f0 +5d +ca +c5 +f0 +5d +08 +c5 +f0 +5d +08 +c5 +e8 +5d +cb +c5 +e8 +5d +08 +c5 +e8 +5d +08 +c5 +ec +5d +cb +c5 +ec +5d +08 +c5 +ec +5d +08 +f2 +0f +5d +ca +f2 +0f +5d +08 +f2 +0f +5d +08 +c5 +f3 +5d +ca +c5 +f3 +5d +08 +c5 +f3 +5d +08 +c5 +eb +5d +cb +c5 +eb +5d +08 +c5 +eb +5d +08 +f3 +0f +5d +ca +f3 +0f +5d +08 +f3 +0f +5d +08 +c5 +f2 +5d +ca +c5 +f2 +5d +08 +c5 +f2 +5d +08 +c5 +ea +5d +cb +c5 +ea +5d +08 +c5 +ea +5d +08 +66 +0f +28 +ca +66 +0f +28 +08 +66 +0f +28 +08 +c5 +f9 +28 +ca +c5 +f9 +28 +08 +c5 +f9 +28 +08 +66 +0f +29 +10 +66 +0f +29 +10 +c5 +f9 +29 +10 +c5 +f9 +29 +10 +c5 +fd +28 +ca +c5 +fd +28 +08 +c5 +fd +28 +08 +c5 +fd +29 +10 +c5 +fd +29 +10 +0f +28 +ca +0f +28 +08 +0f +28 +08 +c5 +f8 +28 +ca +c5 +f8 +28 +08 +c5 +f8 +28 +08 +0f +29 +10 +0f +29 +10 +c5 +f8 +29 +10 +c5 +f8 +29 +10 +c5 +fc +28 +ca +c5 +fc +28 +08 +c5 +fc +28 +08 +c5 +fc +29 +10 +c5 +fc +29 +10 +66 +0f +6e +c8 +66 +0f +6e +08 +66 +0f +6e +08 +c5 +f9 +6e +c8 +c5 +f9 +6e +08 +c5 +f9 +6e +08 +66 +0f +7e +d0 +66 +0f +7e +10 +66 +0f +7e +10 +c5 +f9 +7e +d0 +c5 +f9 +7e +10 +c5 +f9 +7e +10 +66 +48 +0f +6e +c8 +f3 +0f +7e +08 +f3 +0f +7e +08 +c4 +e1 +f9 +6e +c8 +c5 +fa +7e +08 +c5 +fa +7e +08 +66 +48 +0f +7e +d0 +66 +0f +d6 +10 +66 +0f +d6 +10 +c4 +e1 +f9 +7e +d0 +c5 +f9 +d6 +10 +c5 +f9 +d6 +10 +f3 +0f +7e +ca +f3 +0f +7e +08 +f3 +0f +7e +08 +c5 +fa +7e +ca +c5 +fa +7e +08 +c5 +fa +7e +08 +66 +0f +d6 +08 +66 +0f +d6 +08 +c5 +f9 +d6 +08 +c5 +f9 +d6 +08 +f2 +0f +12 +ca +f2 +0f +12 +08 +f2 +0f +12 +08 +c5 +fb +12 +ca +c5 +fb +12 +08 +c5 +fb +12 +08 +c5 +ff +12 +ca +c5 +ff +12 +08 +c5 +ff +12 +08 +66 +0f +6f +ca +66 +0f +6f +08 +66 +0f +6f +08 +66 +0f +7f +10 +66 +0f +7f +10 +c5 +f9 +6f +ca +c5 +f9 +6f +08 +c5 +f9 +6f +08 +c5 +f9 +7f +10 +c5 +f9 +7f +10 +c5 +fd +6f +ca +c5 +fd +6f +08 +c5 +fd +6f +08 +c5 +fd +7f +10 +c5 +fd +7f +10 +f3 +0f +6f +ca +f3 +0f +6f +08 +f3 +0f +6f +08 +f3 +0f +7f +10 +f3 +0f +7f +10 +c5 +fa +6f +ca +c5 +fa +6f +08 +c5 +fa +6f +08 +c5 +fa +7f +10 +c5 +fa +7f +10 +c5 +fe +6f +ca +c5 +fe +6f +08 +c5 +fe +6f +08 +c5 +fe +7f +10 +c5 +fe +7f +10 +0f +12 +ca +c5 +f0 +12 +ca +c5 +e8 +12 +cb +66 +0f +16 +08 +66 +0f +16 +08 +c5 +f1 +16 +08 +c5 +f1 +16 +08 +c5 +e9 +16 +08 +c5 +e9 +16 +08 +66 +0f +17 +10 +66 +0f +17 +10 +c5 +f9 +17 +10 +c5 +f9 +17 +10 +0f +16 +08 +0f +16 +08 +c5 +f0 +16 +08 +c5 +f0 +16 +08 +c5 +e8 +16 +08 +c5 +e8 +16 +08 +0f +17 +10 +0f +17 +10 +c5 +f8 +17 +10 +c5 +f8 +17 +10 +0f +12 +ca +c5 +f0 +12 +ca +c5 +e8 +12 +cb +66 +0f +12 +08 +66 +0f +12 +08 +c5 +f1 +12 +08 +c5 +f1 +12 +08 +c5 +e9 +12 +08 +c5 +e9 +12 +08 +66 +0f +13 +10 +66 +0f +13 +10 +c5 +f9 +13 +10 +c5 +f9 +13 +10 +0f +12 +08 +0f +12 +08 +c5 +f0 +12 +08 +c5 +f0 +12 +08 +c5 +e8 +12 +08 +c5 +e8 +12 +08 +0f +13 +10 +0f +13 +10 +c5 +f8 +13 +10 +c5 +f8 +13 +10 +66 +0f +50 +c2 +66 +48 +0f +50 +c2 +c5 +f9 +50 +c2 +c4 +e1 +f9 +50 +c2 +c5 +fd +50 +c2 +c4 +e1 +fd +50 +c2 +0f +50 +c2 +48 +0f +50 +c2 +c5 +f8 +50 +c2 +c4 +e1 +f8 +50 +c2 +c5 +fc +50 +c2 +c4 +e1 +fc +50 +c2 +66 +0f +e7 +08 +66 +0f +e7 +08 +c5 +f9 +e7 +08 +c5 +f9 +e7 +08 +c5 +fd +e7 +08 +c5 +fd +e7 +08 +66 +0f +38 +2a +08 +66 +0f +38 +2a +08 +c4 +e2 +79 +2a +08 +c4 +e2 +79 +2a +08 +66 +0f +2b +08 +66 +0f +2b +08 +c5 +f9 +2b +08 +c5 +f9 +2b +08 +c5 +fd +2b +08 +c5 +fd +2b +08 +0f +2b +08 +0f +2b +08 +c5 +f8 +2b +08 +c5 +f8 +2b +08 +c5 +fc +2b +08 +c5 +fc +2b +08 +f2 +0f +10 +ca +c5 +f3 +10 +ca +c5 +eb +10 +cb +f2 +0f +10 +08 +f2 +0f +10 +08 +c5 +fb +10 +08 +c5 +fb +10 +08 +f2 +0f +11 +10 +f2 +0f +11 +10 +c5 +fb +11 +10 +c5 +fb +11 +10 +f3 +0f +16 +ca +f3 +0f +16 +08 +f3 +0f +16 +08 +c5 +fa +16 +ca +c5 +fa +16 +08 +c5 +fa +16 +08 +c5 +fe +16 +ca +c5 +fe +16 +08 +c5 +fe +16 +08 +f3 +0f +12 +ca +f3 +0f +12 +08 +f3 +0f +12 +08 +c5 +fa +12 +ca +c5 +fa +12 +08 +c5 +fa +12 +08 +c5 +fe +12 +ca +c5 +fe +12 +08 +c5 +fe +12 +08 +f3 +0f +10 +ca +c5 +f2 +10 +ca +c5 +ea +10 +cb +f3 +0f +10 +08 +f3 +0f +10 +08 +c5 +fa +10 +08 +c5 +fa +10 +08 +f3 +0f +11 +10 +f3 +0f +11 +10 +c5 +fa +11 +10 +c5 +fa +11 +10 +66 +0f +10 +ca +66 +0f +10 +08 +66 +0f +10 +08 +c5 +f9 +10 +ca +c5 +f9 +10 +08 +c5 +f9 +10 +08 +66 +0f +11 +10 +66 +0f +11 +10 +c5 +f9 +11 +10 +c5 +f9 +11 +10 +c5 +fd +10 +ca +c5 +fd +10 +08 +c5 +fd +10 +08 +c5 +fd +11 +10 +c5 +fd +11 +10 +0f +10 +ca +0f +10 +08 +0f +10 +08 +c5 +f8 +10 +ca +c5 +f8 +10 +08 +c5 +f8 +10 +08 +0f +11 +10 +0f +11 +10 +c5 +f8 +11 +10 +c5 +f8 +11 +10 +c5 +fc +10 +ca +c5 +fc +10 +08 +c5 +fc +10 +08 +c5 +fc +11 +10 +c5 +fc +11 +10 +66 +0f +3a +42 +ca +05 +66 +0f +3a +42 +08 +05 +66 +0f +3a +42 +08 +05 +c4 +e3 +71 +42 +ca +05 +c4 +e3 +71 +42 +08 +05 +c4 +e3 +71 +42 +08 +05 +c4 +e3 +69 +42 +cb +05 +c4 +e3 +69 +42 +08 +05 +c4 +e3 +69 +42 +08 +05 +66 +0f +59 +ca +66 +0f +59 +08 +66 +0f +59 +08 +c5 +f1 +59 +ca +c5 +f1 +59 +08 +c5 +f1 +59 +08 +c5 +e9 +59 +cb +c5 +e9 +59 +08 +c5 +e9 +59 +08 +c5 +ed +59 +cb +c5 +ed +59 +08 +c5 +ed +59 +08 +0f +59 +ca +0f +59 +08 +0f +59 +08 +c5 +f0 +59 +ca +c5 +f0 +59 +08 +c5 +f0 +59 +08 +c5 +e8 +59 +cb +c5 +e8 +59 +08 +c5 +e8 +59 +08 +c5 +ec +59 +cb +c5 +ec +59 +08 +c5 +ec +59 +08 +f2 +0f +59 +ca +f2 +0f +59 +08 +f2 +0f +59 +08 +c5 +f3 +59 +ca +c5 +f3 +59 +08 +c5 +f3 +59 +08 +c5 +eb +59 +cb +c5 +eb +59 +08 +c5 +eb +59 +08 +f3 +0f +59 +ca +f3 +0f +59 +08 +f3 +0f +59 +08 +c5 +f2 +59 +ca +c5 +f2 +59 +08 +c5 +f2 +59 +08 +c5 +ea +59 +cb +c5 +ea +59 +08 +c5 +ea +59 +08 +66 +0f +56 +ca +66 +0f +56 +08 +66 +0f +56 +08 +c5 +f1 +56 +ca +c5 +f1 +56 +08 +c5 +f1 +56 +08 +c5 +e9 +56 +cb +c5 +e9 +56 +08 +c5 +e9 +56 +08 +c5 +ed +56 +cb +c5 +ed +56 +08 +c5 +ed +56 +08 +0f +56 +ca +0f +56 +08 +0f +56 +08 +c5 +f0 +56 +ca +c5 +f0 +56 +08 +c5 +f0 +56 +08 +c5 +e8 +56 +cb +c5 +e8 +56 +08 +c5 +e8 +56 +08 +c5 +ec +56 +cb +c5 +ec +56 +08 +c5 +ec +56 +08 +66 +0f +38 +1c +ca +66 +0f +38 +1c +08 +66 +0f +38 +1c +08 +c4 +e2 +79 +1c +ca +c4 +e2 +79 +1c +08 +c4 +e2 +79 +1c +08 +66 +0f +38 +1d +ca +66 +0f +38 +1d +08 +66 +0f +38 +1d +08 +c4 +e2 +79 +1d +ca +c4 +e2 +79 +1d +08 +c4 +e2 +79 +1d +08 +66 +0f +38 +1e +ca +66 +0f +38 +1e +08 +66 +0f +38 +1e +08 +c4 +e2 +79 +1e +ca +c4 +e2 +79 +1e +08 +c4 +e2 +79 +1e +08 +66 +0f +63 +ca +66 +0f +63 +08 +66 +0f +63 +08 +c5 +f1 +63 +ca +c5 +f1 +63 +08 +c5 +f1 +63 +08 +c5 +e9 +63 +cb +c5 +e9 +63 +08 +c5 +e9 +63 +08 +66 +0f +6b +ca +66 +0f +6b +08 +66 +0f +6b +08 +c5 +f1 +6b +ca +c5 +f1 +6b +08 +c5 +f1 +6b +08 +c5 +e9 +6b +cb +c5 +e9 +6b +08 +c5 +e9 +6b +08 +66 +0f +67 +ca +66 +0f +67 +08 +66 +0f +67 +08 +c5 +f1 +67 +ca +c5 +f1 +67 +08 +c5 +f1 +67 +08 +c5 +e9 +67 +cb +c5 +e9 +67 +08 +c5 +e9 +67 +08 +66 +0f +38 +2b +ca +66 +0f +38 +2b +08 +66 +0f +38 +2b +08 +c4 +e2 +71 +2b +ca +c4 +e2 +71 +2b +08 +c4 +e2 +71 +2b +08 +c4 +e2 +69 +2b +cb +c4 +e2 +69 +2b +08 +c4 +e2 +69 +2b +08 +66 +0f +fc +ca +66 +0f +fc +08 +66 +0f +fc +08 +c5 +f1 +fc +ca +c5 +f1 +fc +08 +c5 +f1 +fc +08 +c5 +e9 +fc +cb +c5 +e9 +fc +08 +c5 +e9 +fc +08 +66 +0f +fd +ca +66 +0f +fd +08 +66 +0f +fd +08 +c5 +f1 +fd +ca +c5 +f1 +fd +08 +c5 +f1 +fd +08 +c5 +e9 +fd +cb +c5 +e9 +fd +08 +c5 +e9 +fd +08 +66 +0f +fe +ca +66 +0f +fe +08 +66 +0f +fe +08 +c5 +f1 +fe +ca +c5 +f1 +fe +08 +c5 +f1 +fe +08 +c5 +e9 +fe +cb +c5 +e9 +fe +08 +c5 +e9 +fe +08 +66 +0f +d4 +ca +66 +0f +d4 +08 +66 +0f +d4 +08 +c5 +f1 +d4 +ca +c5 +f1 +d4 +08 +c5 +f1 +d4 +08 +c5 +e9 +d4 +cb +c5 +e9 +d4 +08 +c5 +e9 +d4 +08 +66 +0f +ec +ca +66 +0f +ec +08 +66 +0f +ec +08 +c5 +f1 +ec +ca +c5 +f1 +ec +08 +c5 +f1 +ec +08 +c5 +e9 +ec +cb +c5 +e9 +ec +08 +c5 +e9 +ec +08 +66 +0f +ed +ca +66 +0f +ed +08 +66 +0f +ed +08 +c5 +f1 +ed +ca +c5 +f1 +ed +08 +c5 +f1 +ed +08 +c5 +e9 +ed +cb +c5 +e9 +ed +08 +c5 +e9 +ed +08 +66 +0f +dc +ca +66 +0f +dc +08 +66 +0f +dc +08 +c5 +f1 +dc +ca +c5 +f1 +dc +08 +c5 +f1 +dc +08 +c5 +e9 +dc +cb +c5 +e9 +dc +08 +c5 +e9 +dc +08 +66 +0f +dd +ca +66 +0f +dd +08 +66 +0f +dd +08 +c5 +f1 +dd +ca +c5 +f1 +dd +08 +c5 +f1 +dd +08 +c5 +e9 +dd +cb +c5 +e9 +dd +08 +c5 +e9 +dd +08 +66 +0f +3a +0f +ca +05 +66 +0f +3a +0f +08 +05 +66 +0f +3a +0f +08 +05 +c4 +e3 +71 +0f +ca +05 +c4 +e3 +71 +0f +08 +05 +c4 +e3 +71 +0f +08 +05 +c4 +e3 +69 +0f +cb +05 +c4 +e3 +69 +0f +08 +05 +c4 +e3 +69 +0f +08 +05 +66 +0f +db +ca +66 +0f +db +08 +66 +0f +db +08 +c5 +f1 +db +ca +c5 +f1 +db +08 +c5 +f1 +db +08 +c5 +e9 +db +cb +c5 +e9 +db +08 +c5 +e9 +db +08 +66 +0f +df +ca +66 +0f +df +08 +66 +0f +df +08 +c5 +f1 +df +ca +c5 +f1 +df +08 +c5 +f1 +df +08 +c5 +e9 +df +cb +c5 +e9 +df +08 +c5 +e9 +df +08 +66 +0f +e0 +ca +66 +0f +e0 +08 +66 +0f +e0 +08 +c5 +f1 +e0 +ca +c5 +f1 +e0 +08 +c5 +f1 +e0 +08 +c5 +e9 +e0 +cb +c5 +e9 +e0 +08 +c5 +e9 +e0 +08 +66 +0f +e3 +ca +66 +0f +e3 +08 +66 +0f +e3 +08 +c5 +f1 +e3 +ca +c5 +f1 +e3 +08 +c5 +f1 +e3 +08 +c5 +e9 +e3 +cb +c5 +e9 +e3 +08 +c5 +e9 +e3 +08 +66 +0f +38 +10 +ca +66 +0f +38 +10 +08 +66 +0f +38 +10 +08 +66 +0f +38 +10 +ca +66 +0f +38 +10 +08 +66 +0f +38 +10 +08 +c4 +e3 +69 +4c +cb +40 +c4 +e3 +69 +4c +08 +40 +c4 +e3 +69 +4c +08 +40 +66 +0f +3a +0e +ca +05 +66 +0f +3a +0e +08 +05 +66 +0f +3a +0e +08 +05 +c4 +e3 +71 +0e +ca +05 +c4 +e3 +71 +0e +08 +05 +c4 +e3 +71 +0e +08 +05 +c4 +e3 +69 +0e +cb +05 +c4 +e3 +69 +0e +08 +05 +c4 +e3 +69 +0e +08 +05 +66 +0f +3a +61 +ca +05 +66 +0f +3a +61 +08 +05 +66 +0f +3a +61 +08 +05 +c4 +e3 +79 +61 +ca +05 +c4 +e3 +79 +61 +08 +05 +c4 +e3 +79 +61 +08 +05 +66 +0f +3a +60 +ca +05 +66 +0f +3a +60 +08 +05 +66 +0f +3a +60 +08 +05 +c4 +e3 +79 +60 +ca +05 +c4 +e3 +79 +60 +08 +05 +c4 +e3 +79 +60 +08 +05 +66 +0f +3a +63 +ca +05 +66 +0f +3a +63 +08 +05 +66 +0f +3a +63 +08 +05 +c4 +e3 +79 +63 +ca +05 +c4 +e3 +79 +63 +08 +05 +c4 +e3 +79 +63 +08 +05 +66 +0f +3a +62 +ca +05 +66 +0f +3a +62 +08 +05 +66 +0f +3a +62 +08 +05 +c4 +e3 +79 +62 +ca +05 +c4 +e3 +79 +62 +08 +05 +c4 +e3 +79 +62 +08 +05 +66 +0f +74 +ca +66 +0f +74 +08 +66 +0f +74 +08 +c5 +f1 +74 +ca +c5 +f1 +74 +08 +c5 +f1 +74 +08 +c5 +e9 +74 +cb +c5 +e9 +74 +08 +c5 +e9 +74 +08 +66 +0f +75 +ca +66 +0f +75 +08 +66 +0f +75 +08 +c5 +f1 +75 +ca +c5 +f1 +75 +08 +c5 +f1 +75 +08 +c5 +e9 +75 +cb +c5 +e9 +75 +08 +c5 +e9 +75 +08 +66 +0f +76 +ca +66 +0f +76 +08 +66 +0f +76 +08 +c5 +f1 +76 +ca +c5 +f1 +76 +08 +c5 +f1 +76 +08 +c5 +e9 +76 +cb +c5 +e9 +76 +08 +c5 +e9 +76 +08 +66 +0f +38 +29 +ca +66 +0f +38 +29 +08 +66 +0f +38 +29 +08 +c4 +e2 +71 +29 +ca +c4 +e2 +71 +29 +08 +c4 +e2 +71 +29 +08 +c4 +e2 +69 +29 +cb +c4 +e2 +69 +29 +08 +c4 +e2 +69 +29 +08 +66 +0f +64 +ca +66 +0f +64 +08 +66 +0f +64 +08 +c5 +f1 +64 +ca +c5 +f1 +64 +08 +c5 +f1 +64 +08 +c5 +e9 +64 +cb +c5 +e9 +64 +08 +c5 +e9 +64 +08 +66 +0f +65 +ca +66 +0f +65 +08 +66 +0f +65 +08 +c5 +f1 +65 +ca +c5 +f1 +65 +08 +c5 +f1 +65 +08 +c5 +e9 +65 +cb +c5 +e9 +65 +08 +c5 +e9 +65 +08 +66 +0f +66 +ca +66 +0f +66 +08 +66 +0f +66 +08 +c5 +f1 +66 +ca +c5 +f1 +66 +08 +c5 +f1 +66 +08 +c5 +e9 +66 +cb +c5 +e9 +66 +08 +c5 +e9 +66 +08 +66 +0f +38 +37 +ca +66 +0f +38 +37 +08 +66 +0f +38 +37 +08 +c4 +e2 +71 +37 +ca +c4 +e2 +71 +37 +08 +c4 +e2 +71 +37 +08 +c4 +e2 +69 +37 +cb +c4 +e2 +69 +37 +08 +c4 +e2 +69 +37 +08 +c4 +e2 +69 +0d +cb +c4 +e2 +69 +0d +08 +c4 +e2 +69 +0d +08 +c4 +e2 +6d +0d +cb +c4 +e2 +6d +0d +08 +c4 +e2 +6d +0d +08 +c4 +e3 +79 +05 +08 +05 +c4 +e3 +79 +05 +08 +05 +c4 +e3 +7d +05 +08 +05 +c4 +e3 +7d +05 +08 +05 +c4 +e2 +69 +0c +cb +c4 +e2 +69 +0c +08 +c4 +e2 +69 +0c +08 +c4 +e2 +6d +0c +cb +c4 +e2 +6d +0c +08 +c4 +e2 +6d +0c +08 +c4 +e3 +79 +04 +08 +05 +c4 +e3 +79 +04 +08 +05 +c4 +e3 +7d +04 +08 +05 +c4 +e3 +7d +04 +08 +05 +c4 +e3 +6d +06 +cb +05 +c4 +e3 +6d +06 +08 +05 +c4 +e3 +6d +06 +08 +05 +66 +0f +3a +14 +d0 +05 +66 +0f +3a +14 +d0 +05 +66 +48 +0f +3a +14 +d0 +05 +66 +48 +0f +3a +14 +d0 +05 +66 +0f +3a +14 +10 +05 +66 +0f +3a +14 +10 +05 +c4 +e3 +79 +14 +d0 +05 +c4 +e3 +79 +14 +d0 +05 +c4 +e3 +f9 +14 +d0 +05 +c4 +e3 +f9 +14 +d0 +05 +c4 +e3 +79 +14 +10 +05 +c4 +e3 +79 +14 +10 +05 +66 +0f +c5 +c2 +05 +66 +0f +c5 +c2 +05 +66 +48 +0f +c5 +c2 +05 +66 +48 +0f +c5 +c2 +05 +66 +0f +3a +15 +10 +05 +66 +0f +3a +15 +10 +05 +c5 +f9 +c5 +c2 +05 +c5 +f9 +c5 +c2 +05 +c4 +e1 +f9 +c5 +c2 +05 +c4 +e1 +f9 +c5 +c2 +05 +c4 +e3 +79 +15 +10 +05 +c4 +e3 +79 +15 +10 +05 +66 +0f +3a +16 +d0 +05 +66 +0f +3a +16 +d0 +05 +66 +0f +3a +16 +10 +05 +66 +0f +3a +16 +10 +05 +c4 +e3 +79 +16 +d0 +05 +c4 +e3 +79 +16 +d0 +05 +c4 +e3 +79 +16 +10 +05 +c4 +e3 +79 +16 +10 +05 +66 +48 +0f +3a +16 +d0 +05 +66 +48 +0f +3a +16 +d0 +05 +66 +48 +0f +3a +16 +10 +05 +66 +48 +0f +3a +16 +10 +05 +c4 +e3 +f9 +16 +d0 +05 +c4 +e3 +f9 +16 +d0 +05 +c4 +e3 +f9 +16 +10 +05 +c4 +e3 +f9 +16 +10 +05 +66 +0f +38 +01 +ca +66 +0f +38 +01 +08 +66 +0f +38 +01 +08 +c4 +e2 +71 +01 +ca +c4 +e2 +71 +01 +08 +c4 +e2 +71 +01 +08 +c4 +e2 +69 +01 +cb +c4 +e2 +69 +01 +08 +c4 +e2 +69 +01 +08 +66 +0f +38 +02 +ca +66 +0f +38 +02 +08 +66 +0f +38 +02 +08 +c4 +e2 +71 +02 +ca +c4 +e2 +71 +02 +08 +c4 +e2 +71 +02 +08 +c4 +e2 +69 +02 +cb +c4 +e2 +69 +02 +08 +c4 +e2 +69 +02 +08 +66 +0f +38 +03 +ca +66 +0f +38 +03 +08 +66 +0f +38 +03 +08 +c4 +e2 +71 +03 +ca +c4 +e2 +71 +03 +08 +c4 +e2 +71 +03 +08 +c4 +e2 +69 +03 +cb +c4 +e2 +69 +03 +08 +c4 +e2 +69 +03 +08 +66 +0f +38 +41 +ca +66 +0f +38 +41 +08 +66 +0f +38 +41 +08 +c4 +e2 +79 +41 +ca +c4 +e2 +79 +41 +08 +c4 +e2 +79 +41 +08 +66 +0f +38 +05 +ca +66 +0f +38 +05 +08 +66 +0f +38 +05 +08 +c4 +e2 +71 +05 +ca +c4 +e2 +71 +05 +08 +c4 +e2 +71 +05 +08 +c4 +e2 +69 +05 +cb +c4 +e2 +69 +05 +08 +c4 +e2 +69 +05 +08 +66 +0f +38 +06 +ca +66 +0f +38 +06 +08 +66 +0f +38 +06 +08 +c4 +e2 +71 +06 +ca +c4 +e2 +71 +06 +08 +c4 +e2 +71 +06 +08 +c4 +e2 +69 +06 +cb +c4 +e2 +69 +06 +08 +c4 +e2 +69 +06 +08 +66 +0f +38 +07 +ca +66 +0f +38 +07 +08 +66 +0f +38 +07 +08 +c4 +e2 +71 +07 +ca +c4 +e2 +71 +07 +08 +c4 +e2 +71 +07 +08 +c4 +e2 +69 +07 +cb +c4 +e2 +69 +07 +08 +c4 +e2 +69 +07 +08 +66 +0f +3a +20 +c8 +05 +66 +0f +3a +20 +08 +05 +66 +0f +3a +20 +08 +05 +c4 +e3 +71 +20 +c8 +05 +c4 +e3 +71 +20 +08 +05 +c4 +e3 +71 +20 +08 +05 +c4 +e3 +69 +20 +c8 +05 +c4 +e3 +69 +20 +08 +05 +c4 +e3 +69 +20 +08 +05 +66 +0f +c4 +c8 +05 +66 +0f +c4 +08 +05 +66 +0f +c4 +08 +05 +c5 +f1 +c4 +c8 +05 +c5 +f1 +c4 +08 +05 +c5 +f1 +c4 +08 +05 +c5 +e9 +c4 +c8 +05 +c5 +e9 +c4 +08 +05 +c5 +e9 +c4 +08 +05 +66 +0f +3a +22 +c8 +05 +66 +0f +3a +22 +08 +05 +66 +0f +3a +22 +08 +05 +c4 +e3 +71 +22 +c8 +05 +c4 +e3 +71 +22 +08 +05 +c4 +e3 +71 +22 +08 +05 +c4 +e3 +69 +22 +c8 +05 +c4 +e3 +69 +22 +08 +05 +c4 +e3 +69 +22 +08 +05 +66 +48 +0f +3a +22 +c8 +05 +66 +48 +0f +3a +22 +08 +05 +66 +48 +0f +3a +22 +08 +05 +c4 +e3 +f1 +22 +c8 +05 +c4 +e3 +f1 +22 +08 +05 +c4 +e3 +f1 +22 +08 +05 +c4 +e3 +e9 +22 +c8 +05 +c4 +e3 +e9 +22 +08 +05 +c4 +e3 +e9 +22 +08 +05 +66 +0f +f5 +ca +66 +0f +f5 +08 +66 +0f +f5 +08 +c5 +f1 +f5 +ca +c5 +f1 +f5 +08 +c5 +f1 +f5 +08 +c5 +e9 +f5 +cb +c5 +e9 +f5 +08 +c5 +e9 +f5 +08 +66 +0f +38 +04 +ca +66 +0f +38 +04 +08 +66 +0f +38 +04 +08 +c4 +e2 +71 +04 +ca +c4 +e2 +71 +04 +08 +c4 +e2 +71 +04 +08 +c4 +e2 +69 +04 +cb +c4 +e2 +69 +04 +08 +c4 +e2 +69 +04 +08 +66 +0f +38 +3c +ca +66 +0f +38 +3c +08 +66 +0f +38 +3c +08 +c4 +e2 +71 +3c +ca +c4 +e2 +71 +3c +08 +c4 +e2 +71 +3c +08 +c4 +e2 +69 +3c +cb +c4 +e2 +69 +3c +08 +c4 +e2 +69 +3c +08 +66 +0f +ee +ca +66 +0f +ee +08 +66 +0f +ee +08 +c5 +f1 +ee +ca +c5 +f1 +ee +08 +c5 +f1 +ee +08 +c5 +e9 +ee +cb +c5 +e9 +ee +08 +c5 +e9 +ee +08 +66 +0f +38 +3d +ca +66 +0f +38 +3d +08 +66 +0f +38 +3d +08 +c4 +e2 +71 +3d +ca +c4 +e2 +71 +3d +08 +c4 +e2 +71 +3d +08 +c4 +e2 +69 +3d +cb +c4 +e2 +69 +3d +08 +c4 +e2 +69 +3d +08 +66 +0f +de +ca +66 +0f +de +08 +66 +0f +de +08 +c5 +f1 +de +ca +c5 +f1 +de +08 +c5 +f1 +de +08 +c5 +e9 +de +cb +c5 +e9 +de +08 +c5 +e9 +de +08 +66 +0f +38 +3e +ca +66 +0f +38 +3e +08 +66 +0f +38 +3e +08 +c4 +e2 +71 +3e +ca +c4 +e2 +71 +3e +08 +c4 +e2 +71 +3e +08 +c4 +e2 +69 +3e +cb +c4 +e2 +69 +3e +08 +c4 +e2 +69 +3e +08 +66 +0f +38 +3f +ca +66 +0f +38 +3f +08 +66 +0f +38 +3f +08 +c4 +e2 +71 +3f +ca +c4 +e2 +71 +3f +08 +c4 +e2 +71 +3f +08 +c4 +e2 +69 +3f +cb +c4 +e2 +69 +3f +08 +c4 +e2 +69 +3f +08 +66 +0f +38 +38 +ca +66 +0f +38 +38 +08 +66 +0f +38 +38 +08 +c4 +e2 +71 +38 +ca +c4 +e2 +71 +38 +08 +c4 +e2 +71 +38 +08 +c4 +e2 +69 +38 +cb +c4 +e2 +69 +38 +08 +c4 +e2 +69 +38 +08 +66 +0f +ea +ca +66 +0f +ea +08 +66 +0f +ea +08 +c5 +f1 +ea +ca +c5 +f1 +ea +08 +c5 +f1 +ea +08 +c5 +e9 +ea +cb +c5 +e9 +ea +08 +c5 +e9 +ea +08 +66 +0f +38 +39 +ca +66 +0f +38 +39 +08 +66 +0f +38 +39 +08 +c4 +e2 +71 +39 +ca +c4 +e2 +71 +39 +08 +c4 +e2 +71 +39 +08 +c4 +e2 +69 +39 +cb +c4 +e2 +69 +39 +08 +c4 +e2 +69 +39 +08 +66 +0f +da +ca +66 +0f +da +08 +66 +0f +da +08 +c5 +f1 +da +ca +c5 +f1 +da +08 +c5 +f1 +da +08 +c5 +e9 +da +cb +c5 +e9 +da +08 +c5 +e9 +da +08 +66 +0f +38 +3a +ca +66 +0f +38 +3a +08 +66 +0f +38 +3a +08 +c4 +e2 +71 +3a +ca +c4 +e2 +71 +3a +08 +c4 +e2 +71 +3a +08 +c4 +e2 +69 +3a +cb +c4 +e2 +69 +3a +08 +c4 +e2 +69 +3a +08 +66 +0f +38 +3b +ca +66 +0f +38 +3b +08 +66 +0f +38 +3b +08 +c4 +e2 +71 +3b +ca +c4 +e2 +71 +3b +08 +c4 +e2 +71 +3b +08 +c4 +e2 +69 +3b +cb +c4 +e2 +69 +3b +08 +c4 +e2 +69 +3b +08 +66 +0f +d7 +c1 +66 +0f +d7 +c1 +c5 +f9 +d7 +c1 +c5 +f9 +d7 +c1 +66 +0f +38 +20 +ca +66 +0f +38 +20 +08 +66 +0f +38 +20 +08 +c4 +e2 +79 +20 +ca +c4 +e2 +79 +20 +08 +c4 +e2 +79 +20 +08 +66 +0f +38 +21 +ca +66 +0f +38 +21 +08 +66 +0f +38 +21 +08 +c4 +e2 +79 +21 +ca +c4 +e2 +79 +21 +08 +c4 +e2 +79 +21 +08 +66 +0f +38 +22 +ca +66 +0f +38 +22 +08 +66 +0f +38 +22 +08 +c4 +e2 +79 +22 +ca +c4 +e2 +79 +22 +08 +c4 +e2 +79 +22 +08 +66 +0f +38 +23 +ca +66 +0f +38 +23 +08 +66 +0f +38 +23 +08 +c4 +e2 +79 +23 +ca +c4 +e2 +79 +23 +08 +c4 +e2 +79 +23 +08 +66 +0f +38 +24 +ca +66 +0f +38 +24 +08 +66 +0f +38 +24 +08 +c4 +e2 +79 +24 +ca +c4 +e2 +79 +24 +08 +c4 +e2 +79 +24 +08 +66 +0f +38 +25 +ca +66 +0f +38 +25 +08 +66 +0f +38 +25 +08 +c4 +e2 +79 +25 +ca +c4 +e2 +79 +25 +08 +c4 +e2 +79 +25 +08 +66 +0f +38 +30 +ca +66 +0f +38 +30 +08 +66 +0f +38 +30 +08 +c4 +e2 +79 +30 +ca +c4 +e2 +79 +30 +08 +c4 +e2 +79 +30 +08 +66 +0f +38 +31 +ca +66 +0f +38 +31 +08 +66 +0f +38 +31 +08 +c4 +e2 +79 +31 +ca +c4 +e2 +79 +31 +08 +c4 +e2 +79 +31 +08 +66 +0f +38 +32 +ca +66 +0f +38 +32 +08 +66 +0f +38 +32 +08 +c4 +e2 +79 +32 +ca +c4 +e2 +79 +32 +08 +c4 +e2 +79 +32 +08 +66 +0f +38 +33 +ca +66 +0f +38 +33 +08 +66 +0f +38 +33 +08 +c4 +e2 +79 +33 +ca +c4 +e2 +79 +33 +08 +c4 +e2 +79 +33 +08 +66 +0f +38 +34 +ca +66 +0f +38 +34 +08 +66 +0f +38 +34 +08 +c4 +e2 +79 +34 +ca +c4 +e2 +79 +34 +08 +c4 +e2 +79 +34 +08 +66 +0f +38 +35 +ca +66 +0f +38 +35 +08 +66 +0f +38 +35 +08 +c4 +e2 +79 +35 +ca +c4 +e2 +79 +35 +08 +c4 +e2 +79 +35 +08 +66 +0f +e4 +ca +66 +0f +e4 +08 +66 +0f +e4 +08 +c5 +f1 +e4 +ca +c5 +f1 +e4 +08 +c5 +f1 +e4 +08 +c5 +e9 +e4 +cb +c5 +e9 +e4 +08 +c5 +e9 +e4 +08 +66 +0f +38 +0b +ca +66 +0f +38 +0b +08 +66 +0f +38 +0b +08 +c4 +e2 +71 +0b +ca +c4 +e2 +71 +0b +08 +c4 +e2 +71 +0b +08 +c4 +e2 +69 +0b +cb +c4 +e2 +69 +0b +08 +c4 +e2 +69 +0b +08 +66 +0f +e5 +ca +66 +0f +e5 +08 +66 +0f +e5 +08 +c5 +f1 +e5 +ca +c5 +f1 +e5 +08 +c5 +f1 +e5 +08 +c5 +e9 +e5 +cb +c5 +e9 +e5 +08 +c5 +e9 +e5 +08 +66 +0f +d5 +ca +66 +0f +d5 +08 +66 +0f +d5 +08 +c5 +f1 +d5 +ca +c5 +f1 +d5 +08 +c5 +f1 +d5 +08 +c5 +e9 +d5 +cb +c5 +e9 +d5 +08 +c5 +e9 +d5 +08 +66 +0f +38 +40 +ca +66 +0f +38 +40 +08 +66 +0f +38 +40 +08 +c4 +e2 +71 +40 +ca +c4 +e2 +71 +40 +08 +c4 +e2 +71 +40 +08 +c4 +e2 +69 +40 +cb +c4 +e2 +69 +40 +08 +c4 +e2 +69 +40 +08 +66 +0f +f4 +ca +66 +0f +f4 +08 +66 +0f +f4 +08 +c5 +f1 +f4 +ca +c5 +f1 +f4 +08 +c5 +f1 +f4 +08 +c5 +e9 +f4 +cb +c5 +e9 +f4 +08 +c5 +e9 +f4 +08 +66 +0f +38 +28 +ca +66 +0f +38 +28 +08 +66 +0f +38 +28 +08 +c4 +e2 +71 +28 +ca +c4 +e2 +71 +28 +08 +c4 +e2 +71 +28 +08 +c4 +e2 +69 +28 +cb +c4 +e2 +69 +28 +08 +c4 +e2 +69 +28 +08 +66 +0f +eb +ca +66 +0f +eb +08 +66 +0f +eb +08 +c5 +f1 +eb +ca +c5 +f1 +eb +08 +c5 +f1 +eb +08 +c5 +e9 +eb +cb +c5 +e9 +eb +08 +c5 +e9 +eb +08 +66 +0f +f6 +ca +66 +0f +f6 +08 +66 +0f +f6 +08 +c5 +f1 +f6 +ca +c5 +f1 +f6 +08 +c5 +f1 +f6 +08 +c5 +e9 +f6 +cb +c5 +e9 +f6 +08 +c5 +e9 +f6 +08 +66 +0f +38 +00 +ca +66 +0f +38 +00 +08 +66 +0f +38 +00 +08 +c4 +e2 +71 +00 +ca +c4 +e2 +71 +00 +08 +c4 +e2 +71 +00 +08 +c4 +e2 +69 +00 +cb +c4 +e2 +69 +00 +08 +c4 +e2 +69 +00 +08 +66 +0f +70 +ca +05 +66 +0f +70 +08 +05 +66 +0f +70 +08 +05 +c5 +f9 +70 +ca +05 +c5 +f9 +70 +08 +05 +c5 +f9 +70 +08 +05 +f3 +0f +70 +ca +05 +f3 +0f +70 +08 +05 +f3 +0f +70 +08 +05 +c5 +fa +70 +ca +05 +c5 +fa +70 +08 +05 +c5 +fa +70 +08 +05 +f2 +0f +70 +ca +05 +f2 +0f +70 +08 +05 +f2 +0f +70 +08 +05 +c5 +fb +70 +ca +05 +c5 +fb +70 +08 +05 +c5 +fb +70 +08 +05 +66 +0f +38 +08 +ca +66 +0f +38 +08 +08 +66 +0f +38 +08 +08 +c4 +e2 +71 +08 +ca +c4 +e2 +71 +08 +08 +c4 +e2 +71 +08 +08 +c4 +e2 +69 +08 +cb +c4 +e2 +69 +08 +08 +c4 +e2 +69 +08 +08 +66 +0f +38 +09 +ca +66 +0f +38 +09 +08 +66 +0f +38 +09 +08 +c4 +e2 +71 +09 +ca +c4 +e2 +71 +09 +08 +c4 +e2 +71 +09 +08 +c4 +e2 +69 +09 +cb +c4 +e2 +69 +09 +08 +c4 +e2 +69 +09 +08 +66 +0f +38 +0a +ca +66 +0f +38 +0a +08 +66 +0f +38 +0a +08 +c4 +e2 +71 +0a +ca +c4 +e2 +71 +0a +08 +c4 +e2 +71 +0a +08 +c4 +e2 +69 +0a +cb +c4 +e2 +69 +0a +08 +c4 +e2 +69 +0a +08 +66 +41 +0f +73 +fb +05 +66 +41 +0f +73 +fb +05 +c4 +c1 +21 +73 +fb +05 +c4 +c1 +21 +73 +fb +05 +c4 +c1 +21 +73 +fc +05 +c4 +c1 +21 +73 +fc +05 +66 +0f +73 +f9 +05 +66 +0f +73 +f9 +05 +c5 +f1 +73 +f9 +05 +c5 +f1 +73 +f9 +05 +c5 +f1 +73 +fa +05 +c5 +f1 +73 +fa +05 +66 +0f +73 +d9 +05 +66 +0f +73 +d9 +05 +c5 +f1 +73 +d9 +05 +c5 +f1 +73 +d9 +05 +c5 +f1 +73 +da +05 +c5 +f1 +73 +da +05 +66 +0f +f1 +ca +66 +0f +f1 +08 +66 +0f +f1 +08 +c5 +f1 +f1 +ca +c5 +f1 +f1 +08 +c5 +f1 +f1 +08 +c5 +e9 +f1 +cb +c5 +e9 +f1 +08 +c5 +e9 +f1 +08 +66 +0f +71 +f1 +05 +66 +0f +71 +f1 +05 +c5 +f1 +71 +f1 +05 +c5 +f1 +71 +f1 +05 +c5 +f1 +71 +f2 +05 +c5 +f1 +71 +f2 +05 +66 +0f +f2 +ca +66 +0f +f2 +08 +66 +0f +f2 +08 +c5 +f1 +f2 +ca +c5 +f1 +f2 +08 +c5 +f1 +f2 +08 +c5 +e9 +f2 +cb +c5 +e9 +f2 +08 +c5 +e9 +f2 +08 +66 +0f +72 +f1 +05 +66 +0f +72 +f1 +05 +c5 +f1 +72 +f1 +05 +c5 +f1 +72 +f1 +05 +c5 +f1 +72 +f2 +05 +c5 +f1 +72 +f2 +05 +66 +0f +f3 +ca +66 +0f +f3 +08 +66 +0f +f3 +08 +c5 +f1 +f3 +ca +c5 +f1 +f3 +08 +c5 +f1 +f3 +08 +c5 +e9 +f3 +cb +c5 +e9 +f3 +08 +c5 +e9 +f3 +08 +66 +0f +73 +f1 +05 +66 +0f +73 +f1 +05 +c5 +f1 +73 +f1 +05 +c5 +f1 +73 +f1 +05 +c5 +f1 +73 +f2 +05 +c5 +f1 +73 +f2 +05 +66 +0f +e1 +ca +66 +0f +e1 +08 +66 +0f +e1 +08 +c5 +f1 +e1 +ca +c5 +f1 +e1 +08 +c5 +f1 +e1 +08 +c5 +e9 +e1 +cb +c5 +e9 +e1 +08 +c5 +e9 +e1 +08 +66 +0f +71 +e1 +05 +66 +0f +71 +e1 +05 +c5 +f1 +71 +e1 +05 +c5 +f1 +71 +e1 +05 +c5 +f1 +71 +e2 +05 +c5 +f1 +71 +e2 +05 +66 +0f +e2 +ca +66 +0f +e2 +08 +66 +0f +e2 +08 +c5 +f1 +e2 +ca +c5 +f1 +e2 +08 +c5 +f1 +e2 +08 +c5 +e9 +e2 +cb +c5 +e9 +e2 +08 +c5 +e9 +e2 +08 +66 +0f +72 +e1 +05 +66 +0f +72 +e1 +05 +c5 +f1 +72 +e1 +05 +c5 +f1 +72 +e1 +05 +c5 +f1 +72 +e2 +05 +c5 +f1 +72 +e2 +05 +66 +0f +d1 +ca +66 +0f +d1 +08 +66 +0f +d1 +08 +c5 +f1 +d1 +ca +c5 +f1 +d1 +08 +c5 +f1 +d1 +08 +c5 +e9 +d1 +cb +c5 +e9 +d1 +08 +c5 +e9 +d1 +08 +66 +0f +71 +d1 +05 +66 +0f +71 +d1 +05 +c5 +f1 +71 +d1 +05 +c5 +f1 +71 +d1 +05 +c5 +f1 +71 +d2 +05 +c5 +f1 +71 +d2 +05 +66 +0f +d2 +ca +66 +0f +d2 +08 +66 +0f +d2 +08 +c5 +f1 +d2 +ca +c5 +f1 +d2 +08 +c5 +f1 +d2 +08 +c5 +e9 +d2 +cb +c5 +e9 +d2 +08 +c5 +e9 +d2 +08 +66 +0f +72 +d1 +05 +66 +0f +72 +d1 +05 +c5 +f1 +72 +d1 +05 +c5 +f1 +72 +d1 +05 +c5 +f1 +72 +d2 +05 +c5 +f1 +72 +d2 +05 +66 +0f +d3 +ca +66 +0f +d3 +08 +66 +0f +d3 +08 +c5 +f1 +d3 +ca +c5 +f1 +d3 +08 +c5 +f1 +d3 +08 +c5 +e9 +d3 +cb +c5 +e9 +d3 +08 +c5 +e9 +d3 +08 +66 +0f +73 +d1 +05 +66 +0f +73 +d1 +05 +c5 +f1 +73 +d1 +05 +c5 +f1 +73 +d1 +05 +c5 +f1 +73 +d2 +05 +c5 +f1 +73 +d2 +05 +66 +0f +38 +17 +ca +66 +0f +38 +17 +08 +66 +0f +38 +17 +08 +c4 +e2 +79 +17 +ca +c4 +e2 +79 +17 +08 +c4 +e2 +79 +17 +08 +c4 +e2 +7d +17 +ca +c4 +e2 +7d +17 +08 +c4 +e2 +7d +17 +08 +c4 +e2 +79 +0e +ca +c4 +e2 +79 +0e +08 +c4 +e2 +79 +0e +08 +c4 +e2 +7d +0e +ca +c4 +e2 +7d +0e +08 +c4 +e2 +7d +0e +08 +c4 +e2 +79 +0f +ca +c4 +e2 +79 +0f +08 +c4 +e2 +79 +0f +08 +c4 +e2 +7d +0f +ca +c4 +e2 +7d +0f +08 +c4 +e2 +7d +0f +08 +66 +0f +f8 +ca +66 +0f +f8 +08 +66 +0f +f8 +08 +c5 +f1 +f8 +ca +c5 +f1 +f8 +08 +c5 +f1 +f8 +08 +c5 +e9 +f8 +cb +c5 +e9 +f8 +08 +c5 +e9 +f8 +08 +66 +0f +f9 +ca +66 +0f +f9 +08 +66 +0f +f9 +08 +c5 +f1 +f9 +ca +c5 +f1 +f9 +08 +c5 +f1 +f9 +08 +c5 +e9 +f9 +cb +c5 +e9 +f9 +08 +c5 +e9 +f9 +08 +66 +0f +fa +ca +66 +0f +fa +08 +66 +0f +fa +08 +c5 +f1 +fa +ca +c5 +f1 +fa +08 +c5 +f1 +fa +08 +c5 +e9 +fa +cb +c5 +e9 +fa +08 +c5 +e9 +fa +08 +66 +0f +fb +ca +66 +0f +fb +08 +66 +0f +fb +08 +c5 +f1 +fb +ca +c5 +f1 +fb +08 +c5 +f1 +fb +08 +c5 +e9 +fb +cb +c5 +e9 +fb +08 +c5 +e9 +fb +08 +66 +0f +e8 +ca +66 +0f +e8 +08 +66 +0f +e8 +08 +c5 +f1 +e8 +ca +c5 +f1 +e8 +08 +c5 +f1 +e8 +08 +c5 +e9 +e8 +cb +c5 +e9 +e8 +08 +c5 +e9 +e8 +08 +66 +0f +e9 +ca +66 +0f +e9 +08 +66 +0f +e9 +08 +c5 +f1 +e9 +ca +c5 +f1 +e9 +08 +c5 +f1 +e9 +08 +c5 +e9 +e9 +cb +c5 +e9 +e9 +08 +c5 +e9 +e9 +08 +66 +0f +d8 +ca +66 +0f +d8 +08 +66 +0f +d8 +08 +c5 +f1 +d8 +ca +c5 +f1 +d8 +08 +c5 +f1 +d8 +08 +c5 +e9 +d8 +cb +c5 +e9 +d8 +08 +c5 +e9 +d8 +08 +66 +0f +d9 +ca +66 +0f +d9 +08 +66 +0f +d9 +08 +c5 +f1 +d9 +ca +c5 +f1 +d9 +08 +c5 +f1 +d9 +08 +c5 +e9 +d9 +cb +c5 +e9 +d9 +08 +c5 +e9 +d9 +08 +66 +0f +68 +ca +66 +0f +68 +08 +66 +0f +68 +08 +c5 +f1 +68 +ca +c5 +f1 +68 +08 +c5 +f1 +68 +08 +c5 +e9 +68 +cb +c5 +e9 +68 +08 +c5 +e9 +68 +08 +66 +0f +69 +ca +66 +0f +69 +08 +66 +0f +69 +08 +c5 +f1 +69 +ca +c5 +f1 +69 +08 +c5 +f1 +69 +08 +c5 +e9 +69 +cb +c5 +e9 +69 +08 +c5 +e9 +69 +08 +66 +0f +6a +ca +66 +0f +6a +08 +66 +0f +6a +08 +c5 +f1 +6a +ca +c5 +f1 +6a +08 +c5 +f1 +6a +08 +c5 +e9 +6a +cb +c5 +e9 +6a +08 +c5 +e9 +6a +08 +66 +0f +6d +ca +66 +0f +6d +08 +66 +0f +6d +08 +c5 +f1 +6d +ca +c5 +f1 +6d +08 +c5 +f1 +6d +08 +c5 +e9 +6d +cb +c5 +e9 +6d +08 +c5 +e9 +6d +08 +66 +0f +60 +ca +66 +0f +60 +08 +66 +0f +60 +08 +c5 +f1 +60 +ca +c5 +f1 +60 +08 +c5 +f1 +60 +08 +c5 +e9 +60 +cb +c5 +e9 +60 +08 +c5 +e9 +60 +08 +66 +0f +61 +ca +66 +0f +61 +08 +66 +0f +61 +08 +c5 +f1 +61 +ca +c5 +f1 +61 +08 +c5 +f1 +61 +08 +c5 +e9 +61 +cb +c5 +e9 +61 +08 +c5 +e9 +61 +08 +66 +0f +62 +ca +66 +0f +62 +08 +66 +0f +62 +08 +c5 +f1 +62 +ca +c5 +f1 +62 +08 +c5 +f1 +62 +08 +c5 +e9 +62 +cb +c5 +e9 +62 +08 +c5 +e9 +62 +08 +66 +0f +6c +ca +66 +0f +6c +08 +66 +0f +6c +08 +c5 +f1 +6c +ca +c5 +f1 +6c +08 +c5 +f1 +6c +08 +c5 +e9 +6c +cb +c5 +e9 +6c +08 +c5 +e9 +6c +08 +66 +0f +ef +ca +66 +0f +ef +08 +66 +0f +ef +08 +c5 +f1 +ef +ca +c5 +f1 +ef +08 +c5 +f1 +ef +08 +c5 +e9 +ef +cb +c5 +e9 +ef +08 +c5 +e9 +ef +08 +0f +53 +ca +0f +53 +08 +0f +53 +08 +c5 +f8 +53 +ca +c5 +f8 +53 +08 +c5 +f8 +53 +08 +c5 +fc +53 +ca +c5 +fc +53 +08 +c5 +fc +53 +08 +f3 +0f +53 +ca +f3 +0f +53 +08 +f3 +0f +53 +08 +c5 +f2 +53 +ca +c5 +f2 +53 +08 +c5 +f2 +53 +08 +c5 +ea +53 +cb +c5 +ea +53 +08 +c5 +ea +53 +08 +0f +52 +ca +0f +52 +08 +0f +52 +08 +c5 +f8 +52 +ca +c5 +f8 +52 +08 +c5 +f8 +52 +08 +c5 +fc +52 +ca +c5 +fc +52 +08 +c5 +fc +52 +08 +f3 +0f +52 +ca +f3 +0f +52 +08 +f3 +0f +52 +08 +c5 +f2 +52 +ca +c5 +f2 +52 +08 +c5 +f2 +52 +08 +c5 +ea +52 +cb +c5 +ea +52 +08 +c5 +ea +52 +08 +66 +0f +3a +09 +ca +05 +66 +0f +3a +09 +08 +05 +66 +0f +3a +09 +08 +05 +c4 +e3 +79 +09 +ca +05 +c4 +e3 +79 +09 +08 +05 +c4 +e3 +79 +09 +08 +05 +c4 +e3 +7d +09 +ca +05 +c4 +e3 +7d +09 +08 +05 +c4 +e3 +7d +09 +08 +05 +66 +0f +3a +08 +ca +05 +66 +0f +3a +08 +08 +05 +66 +0f +3a +08 +08 +05 +c4 +e3 +79 +08 +ca +05 +c4 +e3 +79 +08 +08 +05 +c4 +e3 +79 +08 +08 +05 +c4 +e3 +7d +08 +ca +05 +c4 +e3 +7d +08 +08 +05 +c4 +e3 +7d +08 +08 +05 +66 +0f +3a +0b +ca +05 +66 +0f +3a +0b +08 +05 +66 +0f +3a +0b +08 +05 +c4 +e3 +71 +0b +ca +05 +c4 +e3 +71 +0b +08 +05 +c4 +e3 +71 +0b +08 +05 +c4 +e3 +69 +0b +cb +05 +c4 +e3 +69 +0b +08 +05 +c4 +e3 +69 +0b +08 +05 +66 +0f +3a +0a +ca +05 +66 +0f +3a +0a +08 +05 +66 +0f +3a +0a +08 +05 +c4 +e3 +71 +0a +ca +05 +c4 +e3 +71 +0a +08 +05 +c4 +e3 +71 +0a +08 +05 +c4 +e3 +69 +0a +cb +05 +c4 +e3 +69 +0a +08 +05 +c4 +e3 +69 +0a +08 +05 +66 +0f +c6 +ca +05 +66 +0f +c6 +08 +05 +66 +0f +c6 +08 +05 +c5 +f1 +c6 +ca +05 +c5 +f1 +c6 +08 +05 +c5 +f1 +c6 +08 +05 +c5 +e9 +c6 +cb +05 +c5 +e9 +c6 +08 +05 +c5 +e9 +c6 +08 +05 +c5 +ed +c6 +cb +05 +c5 +ed +c6 +08 +05 +c5 +ed +c6 +08 +05 +0f +c6 +ca +05 +0f +c6 +08 +05 +0f +c6 +08 +05 +c5 +f0 +c6 +ca +05 +c5 +f0 +c6 +08 +05 +c5 +f0 +c6 +08 +05 +c5 +e8 +c6 +cb +05 +c5 +e8 +c6 +08 +05 +c5 +e8 +c6 +08 +05 +c5 +ec +c6 +cb +05 +c5 +ec +c6 +08 +05 +c5 +ec +c6 +08 +05 +66 +0f +51 +ca +66 +0f +51 +08 +66 +0f +51 +08 +c5 +f9 +51 +ca +c5 +f9 +51 +08 +c5 +f9 +51 +08 +c5 +fd +51 +ca +c5 +fd +51 +08 +c5 +fd +51 +08 +0f +51 +ca +0f +51 +08 +0f +51 +08 +c5 +f8 +51 +ca +c5 +f8 +51 +08 +c5 +f8 +51 +08 +c5 +fc +51 +ca +c5 +fc +51 +08 +c5 +fc +51 +08 +f2 +0f +51 +ca +f2 +0f +51 +08 +f2 +0f +51 +08 +c5 +f3 +51 +ca +c5 +f3 +51 +08 +c5 +f3 +51 +08 +c5 +eb +51 +cb +c5 +eb +51 +08 +c5 +eb +51 +08 +f3 +0f +51 +ca +f3 +0f +51 +08 +f3 +0f +51 +08 +c5 +f2 +51 +ca +c5 +f2 +51 +08 +c5 +f2 +51 +08 +c5 +ea +51 +cb +c5 +ea +51 +08 +c5 +ea +51 +08 +0f +ae +18 +0f +ae +18 +c5 +f8 +ae +18 +c5 +f8 +ae +18 +66 +0f +5c +ca +66 +0f +5c +08 +66 +0f +5c +08 +c5 +f1 +5c +ca +c5 +f1 +5c +08 +c5 +f1 +5c +08 +c5 +e9 +5c +cb +c5 +e9 +5c +08 +c5 +e9 +5c +08 +c5 +ed +5c +cb +c5 +ed +5c +08 +c5 +ed +5c +08 +0f +5c +ca +0f +5c +08 +0f +5c +08 +c5 +f0 +5c +ca +c5 +f0 +5c +08 +c5 +f0 +5c +08 +c5 +e8 +5c +cb +c5 +e8 +5c +08 +c5 +e8 +5c +08 +c5 +ec +5c +cb +c5 +ec +5c +08 +c5 +ec +5c +08 +f2 +0f +5c +ca +f2 +0f +5c +08 +f2 +0f +5c +08 +c5 +f3 +5c +ca +c5 +f3 +5c +08 +c5 +f3 +5c +08 +c5 +eb +5c +cb +c5 +eb +5c +08 +c5 +eb +5c +08 +f3 +0f +5c +ca +f3 +0f +5c +08 +f3 +0f +5c +08 +c5 +f2 +5c +ca +c5 +f2 +5c +08 +c5 +f2 +5c +08 +c5 +ea +5c +cb +c5 +ea +5c +08 +c5 +ea +5c +08 +66 +0f +2e +ca +66 +0f +2e +08 +66 +0f +2e +08 +c5 +f9 +2e +ca +c5 +f9 +2e +08 +c5 +f9 +2e +08 +0f +2e +ca +0f +2e +08 +0f +2e +08 +c5 +f8 +2e +ca +c5 +f8 +2e +08 +c5 +f8 +2e +08 +66 +0f +15 +ca +66 +0f +15 +08 +66 +0f +15 +08 +c5 +f1 +15 +ca +c5 +f1 +15 +08 +c5 +f1 +15 +08 +c5 +e9 +15 +cb +c5 +e9 +15 +08 +c5 +e9 +15 +08 +c5 +ed +15 +cb +c5 +ed +15 +08 +c5 +ed +15 +08 +0f +15 +ca +0f +15 +08 +0f +15 +08 +c5 +f0 +15 +ca +c5 +f0 +15 +08 +c5 +f0 +15 +08 +c5 +e8 +15 +cb +c5 +e8 +15 +08 +c5 +e8 +15 +08 +c5 +ec +15 +cb +c5 +ec +15 +08 +c5 +ec +15 +08 +66 +0f +14 +ca +66 +0f +14 +08 +66 +0f +14 +08 +c5 +f1 +14 +ca +c5 +f1 +14 +08 +c5 +f1 +14 +08 +c5 +e9 +14 +cb +c5 +e9 +14 +08 +c5 +e9 +14 +08 +c5 +ed +14 +cb +c5 +ed +14 +08 +c5 +ed +14 +08 +0f +14 +ca +0f +14 +08 +0f +14 +08 +c5 +f0 +14 +ca +c5 +f0 +14 +08 +c5 +f0 +14 +08 +c5 +e8 +14 +cb +c5 +e8 +14 +08 +c5 +e8 +14 +08 +c5 +ec +14 +cb +c5 +ec +14 +08 +c5 +ec +14 +08 +66 +0f +57 +ca +66 +0f +57 +08 +66 +0f +57 +08 +c5 +f1 +57 +ca +c5 +f1 +57 +08 +c5 +f1 +57 +08 +c5 +e9 +57 +cb +c5 +e9 +57 +08 +c5 +e9 +57 +08 +c5 +ed +57 +cb +c5 +ed +57 +08 +c5 +ed +57 +08 +0f +57 +ca +0f +57 +08 +0f +57 +08 +c5 +f0 +57 +ca +c5 +f0 +57 +08 +c5 +f0 +57 +08 +c5 +e8 +57 +cb +c5 +e8 +57 +08 +c5 +e8 +57 +08 +c5 +ec +57 +cb +c5 +ec +57 +08 +c5 +ec +57 +08 +c5 +fc +77 +c5 +f8 +77 diff --git a/modules/arch/x86/tests/avx16.asm b/modules/arch/x86/tests/avx16.asm new file mode 100644 index 00000000..72167589 --- /dev/null +++ b/modules/arch/x86/tests/avx16.asm @@ -0,0 +1,10 @@ +[bits 16] +extractps eax, xmm1, 5 +vextractps eax, xmm1, 5 +pextrb eax, xmm1, 5 +vpextrb eax, xmm1, 5 +pextrw eax, xmm1, 5 +vpextrw eax, xmm1, 5 +pextrd eax, xmm1, 5 +vpextrd eax, xmm1, 5 +vpinsrd xmm1, xmm2, eax, 5 diff --git a/modules/arch/x86/tests/avx16.hex b/modules/arch/x86/tests/avx16.hex new file mode 100644 index 00000000..6e3a538d --- /dev/null +++ b/modules/arch/x86/tests/avx16.hex @@ -0,0 +1,52 @@ +66 +0f +3a +17 +c8 +05 +c4 +e3 +79 +17 +c8 +05 +66 +0f +3a +14 +c8 +05 +c4 +e3 +79 +14 +c8 +05 +66 +0f +c5 +c1 +05 +c5 +f9 +c5 +c1 +05 +66 +0f +3a +16 +c8 +05 +c4 +e3 +79 +16 +c8 +05 +c4 +e3 +69 +22 +c8 +05 diff --git a/modules/arch/x86/tests/avx2.asm b/modules/arch/x86/tests/avx2.asm new file mode 100644 index 00000000..e76016ca --- /dev/null +++ b/modules/arch/x86/tests/avx2.asm @@ -0,0 +1,652 @@ +; Exhaustive test of AVX2 instructions +; +; Copyright (C) 2011 Peter Johnson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; 1. Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; + +[bits 64] + +vmpsadbw ymm1, ymm3, 3 ; c4 e3 75 42 cb 03 +vmpsadbw ymm1, yword [rax], 3 ; c4 e3 75 42 08 03 +vmpsadbw ymm1, ymm2, ymm3, 3 ; c4 e3 6d 42 cb 03 +vmpsadbw ymm1, ymm2, yword [rax], 3 ; c4 e3 6d 42 08 03 + +vpabsb ymm1, ymm2 ; c4 e2 7d 1c ca +vpabsb ymm1, yword [rax] ; c4 e2 7d 1c 08 + +vpabsw ymm1, ymm2 ; c4 e2 7d 1d ca +vpabsw ymm1, yword [rax] ; c4 e2 7d 1d 08 + +vpabsd ymm1, ymm2 ; c4 e2 7d 1e ca +vpabsd ymm1, yword [rax] ; c4 e2 7d 1e 08 + +vpacksswb ymm1, ymm3 ; c5 f5 63 cb +vpacksswb ymm1, yword [rax] ; c5 f5 63 08 +vpacksswb ymm1, ymm2, ymm3 ; c5 ed 63 cb +vpacksswb ymm1, ymm2, yword [rax] ; c5 ed 63 08 + +vpackssdw ymm1, ymm3 ; c5 f5 6b cb +vpackssdw ymm1, yword [rax] ; c5 f5 6b 08 +vpackssdw ymm1, ymm2, ymm3 ; c5 ed 6b cb +vpackssdw ymm1, ymm2, yword [rax] ; c5 ed 6b 08 + +vpackusdw ymm1, ymm3 ; c4 e2 75 2b cb +vpackusdw ymm1, yword [rax] ; c4 e2 75 2b 08 +vpackusdw ymm1, ymm2, ymm3 ; c4 e2 6d 2b cb +vpackusdw ymm1, ymm2, yword [rax] ; c4 e2 6d 2b 08 + +vpackuswb ymm1, ymm3 ; c5 f5 67 cb +vpackuswb ymm1, yword [rax] ; c5 f5 67 08 +vpackuswb ymm1, ymm2, ymm3 ; c5 ed 67 cb +vpackuswb ymm1, ymm2, yword [rax] ; c5 ed 67 08 + +vpaddb ymm1, ymm3 ; c5 f5 fc cb +vpaddb ymm1, yword [rax] ; c5 f5 fc 08 +vpaddb ymm1, ymm2, ymm3 ; c5 ed fc cb +vpaddb ymm1, ymm2, yword [rax] ; c5 ed fc 08 + +vpaddw ymm1, ymm3 ; c5 f5 fd cb +vpaddw ymm1, yword [rax] ; c5 f5 fd 08 +vpaddw ymm1, ymm2, ymm3 ; c5 ed fd cb +vpaddw ymm1, ymm2, yword [rax] ; c5 ed fd 08 + +vpaddd ymm1, ymm3 ; c5 f5 fe cb +vpaddd ymm1, yword [rax] ; c5 f5 fe 08 +vpaddd ymm1, ymm2, ymm3 ; c5 ed fe cb +vpaddd ymm1, ymm2, yword [rax] ; c5 ed fe 08 + +vpaddq ymm1, ymm3 ; c5 f5 d4 cb +vpaddq ymm1, yword [rax] ; c5 f5 d4 08 +vpaddq ymm1, ymm2, ymm3 ; c5 ed d4 cb +vpaddq ymm1, ymm2, yword [rax] ; c5 ed d4 08 + +vpaddsb ymm1, ymm3 ; c5 f5 ec cb +vpaddsb ymm1, yword [rax] ; c5 f5 ec 08 +vpaddsb ymm1, ymm2, ymm3 ; c5 ed ec cb +vpaddsb ymm1, ymm2, yword [rax] ; c5 ed ec 08 + +vpaddsw ymm1, ymm3 ; c5 f5 ed cb +vpaddsw ymm1, yword [rax] ; c5 f5 ed 08 +vpaddsw ymm1, ymm2, ymm3 ; c5 ed ed cb +vpaddsw ymm1, ymm2, yword [rax] ; c5 ed ed 08 + +vpaddusb ymm1, ymm3 ; c5 f5 dc cb +vpaddusb ymm1, yword [rax] ; c5 f5 dc 08 +vpaddusb ymm1, ymm2, ymm3 ; c5 ed dc cb +vpaddusb ymm1, ymm2, yword [rax] ; c5 ed dc 08 + +vpaddusw ymm1, ymm3 ; c5 f5 dd cb +vpaddusw ymm1, yword [rax] ; c5 f5 dd 08 +vpaddusw ymm1, ymm2, ymm3 ; c5 ed dd cb +vpaddusw ymm1, ymm2, yword [rax] ; c5 ed dd 08 + +vpalignr ymm1, ymm2, ymm3, 3 ; c4 e3 6d 0f cb 03 +vpalignr ymm1, ymm2, yword [rax], 3 ; c4 e3 6d 0f 08 03 + +vpand ymm1, ymm3 ; c5 f5 db cb +vpand ymm1, yword [rax] ; c5 f5 db 08 +vpand ymm1, ymm2, ymm3 ; c5 ed db cb +vpand ymm1, ymm2, yword [rax] ; c5 ed db 08 + +vpandn ymm1, ymm3 ; c5 f5 df cb +vpandn ymm1, yword [rax] ; c5 f5 df 08 +vpandn ymm1, ymm2, ymm3 ; c5 ed df cb +vpandn ymm1, ymm2, yword [rax] ; c5 ed df 08 + +vpavgb ymm1, ymm3 ; c5 f5 e0 cb +vpavgb ymm1, yword [rax] ; c5 f5 e0 08 +vpavgb ymm1, ymm2, ymm3 ; c5 ed e0 cb +vpavgb ymm1, ymm2, yword [rax] ; c5 ed e0 08 + +vpavgw ymm1, ymm3 ; c5 f5 e3 cb +vpavgw ymm1, yword [rax] ; c5 f5 e3 08 +vpavgw ymm1, ymm2, ymm3 ; c5 ed e3 cb +vpavgw ymm1, ymm2, yword [rax] ; c5 ed e3 08 + +vpblendvb ymm1, ymm2, ymm3, ymm4 ; c4 e3 6d 4c cb 40 +vpblendvb ymm1, ymm2, yword [rax], ymm4 ; c4 e3 6d 4c 08 40 + +vpblendw ymm1, ymm3, 3 ; c4 e3 75 0e cb 03 +vpblendw ymm1, yword [rax], 3 ; c4 e3 75 0e 08 03 +vpblendw ymm1, ymm2, ymm3, 3 ; c4 e3 6d 0e cb 03 +vpblendw ymm1, ymm2, yword [rax], 3 ; c4 e3 6d 0e 08 03 + +vpcmpeqb ymm1, ymm3 ; c5 f5 74 cb +vpcmpeqb ymm1, yword [rax] ; c5 f5 74 08 +vpcmpeqb ymm1, ymm2, ymm3 ; c5 ed 74 cb +vpcmpeqb ymm1, ymm2, yword [rax] ; c5 ed 74 08 + +vpcmpeqw ymm1, ymm3 ; c5 f5 75 cb +vpcmpeqw ymm1, yword [rax] ; c5 f5 75 08 +vpcmpeqw ymm1, ymm2, ymm3 ; c5 ed 75 cb +vpcmpeqw ymm1, ymm2, yword [rax] ; c5 ed 75 08 + +vpcmpeqd ymm1, ymm3 ; c5 f5 76 cb +vpcmpeqd ymm1, yword [rax] ; c5 f5 76 08 +vpcmpeqd ymm1, ymm2, ymm3 ; c5 ed 76 cb +vpcmpeqd ymm1, ymm2, yword [rax] ; c5 ed 76 08 + +vpcmpeqq ymm1, ymm3 ; c4 e2 75 29 cb +vpcmpeqq ymm1, yword [rax] ; c4 e2 75 29 08 +vpcmpeqq ymm1, ymm2, ymm3 ; c4 e2 6d 29 cb +vpcmpeqq ymm1, ymm2, yword [rax] ; c4 e2 6d 29 08 + +vpcmpgtb ymm1, ymm3 ; c5 f5 64 cb +vpcmpgtb ymm1, yword [rax] ; c5 f5 64 08 +vpcmpgtb ymm1, ymm2, ymm3 ; c5 ed 64 cb +vpcmpgtb ymm1, ymm2, yword [rax] ; c5 ed 64 08 + +vpcmpgtw ymm1, ymm3 ; c5 f5 65 cb +vpcmpgtw ymm1, yword [rax] ; c5 f5 65 08 +vpcmpgtw ymm1, ymm2, ymm3 ; c5 ed 65 cb +vpcmpgtw ymm1, ymm2, yword [rax] ; c5 ed 65 08 + +vpcmpgtd ymm1, ymm3 ; c5 f5 66 cb +vpcmpgtd ymm1, yword [rax] ; c5 f5 66 08 +vpcmpgtd ymm1, ymm2, ymm3 ; c5 ed 66 cb +vpcmpgtd ymm1, ymm2, yword [rax] ; c5 ed 66 08 + +vpcmpgtq ymm1, ymm3 ; c4 e2 75 37 cb +vpcmpgtq ymm1, yword [rax] ; c4 e2 75 37 08 +vpcmpgtq ymm1, ymm2, ymm3 ; c4 e2 6d 37 cb +vpcmpgtq ymm1, ymm2, yword [rax] ; c4 e2 6d 37 08 + +vphaddw ymm1, ymm3 ; c4 e2 75 01 cb +vphaddw ymm1, yword [rax] ; c4 e2 75 01 08 +vphaddw ymm1, ymm2, ymm3 ; c4 e2 6d 01 cb +vphaddw ymm1, ymm2, yword [rax] ; c4 e2 6d 01 08 + +vphaddd ymm1, ymm3 ; c4 e2 75 02 cb +vphaddd ymm1, yword [rax] ; c4 e2 75 02 08 +vphaddd ymm1, ymm2, ymm3 ; c4 e2 6d 02 cb +vphaddd ymm1, ymm2, yword [rax] ; c4 e2 6d 02 08 + +vphaddsw ymm1, ymm3 ; c4 e2 75 03 cb +vphaddsw ymm1, yword [rax] ; c4 e2 75 03 08 +vphaddsw ymm1, ymm2, ymm3 ; c4 e2 6d 03 cb +vphaddsw ymm1, ymm2, yword [rax] ; c4 e2 6d 03 08 + +vphsubw ymm1, ymm3 ; c4 e2 75 05 cb +vphsubw ymm1, yword [rax] ; c4 e2 75 05 08 +vphsubw ymm1, ymm2, ymm3 ; c4 e2 6d 05 cb +vphsubw ymm1, ymm2, yword [rax] ; c4 e2 6d 05 08 + +vphsubd ymm1, ymm3 ; c4 e2 75 06 cb +vphsubd ymm1, yword [rax] ; c4 e2 75 06 08 +vphsubd ymm1, ymm2, ymm3 ; c4 e2 6d 06 cb +vphsubd ymm1, ymm2, yword [rax] ; c4 e2 6d 06 08 + +vphsubsw ymm1, ymm3 ; c4 e2 75 07 cb +vphsubsw ymm1, yword [rax] ; c4 e2 75 07 08 +vphsubsw ymm1, ymm2, ymm3 ; c4 e2 6d 07 cb +vphsubsw ymm1, ymm2, yword [rax] ; c4 e2 6d 07 08 + +vpmaddubsw ymm1, ymm3 ; c4 e2 75 04 cb +vpmaddubsw ymm1, yword [rax] ; c4 e2 75 04 08 +vpmaddubsw ymm1, ymm2, ymm3 ; c4 e2 6d 04 cb +vpmaddubsw ymm1, ymm2, yword [rax] ; c4 e2 6d 04 08 + +vpmaddwd ymm1, ymm3 ; c5 f5 f5 cb +vpmaddwd ymm1, yword [rax] ; c5 f5 f5 08 +vpmaddwd ymm1, ymm2, ymm3 ; c5 ed f5 cb +vpmaddwd ymm1, ymm2, yword [rax] ; c5 ed f5 08 + +vpmaxsb ymm1, ymm3 ; c4 e2 75 3c cb +vpmaxsb ymm1, yword [rax] ; c4 e2 75 3c 08 +vpmaxsb ymm1, ymm2, ymm3 ; c4 e2 6d 3c cb +vpmaxsb ymm1, ymm2, yword [rax] ; c4 e2 6d 3c 08 + +vpmaxsw ymm1, ymm3 ; c5 f5 ee cb +vpmaxsw ymm1, yword [rax] ; c5 f5 ee 08 +vpmaxsw ymm1, ymm2, ymm3 ; c5 ed ee cb +vpmaxsw ymm1, ymm2, yword [rax] ; c5 ed ee 08 + +vpmaxsd ymm1, ymm3 ; c4 e2 75 3d cb +vpmaxsd ymm1, yword [rax] ; c4 e2 75 3d 08 +vpmaxsd ymm1, ymm2, ymm3 ; c4 e2 6d 3d cb +vpmaxsd ymm1, ymm2, yword [rax] ; c4 e2 6d 3d 08 + +vpmaxub ymm1, ymm3 ; c5 f5 de cb +vpmaxub ymm1, yword [rax] ; c5 f5 de 08 +vpmaxub ymm1, ymm2, ymm3 ; c5 ed de cb +vpmaxub ymm1, ymm2, yword [rax] ; c5 ed de 08 + +vpmaxuw ymm1, ymm3 ; c4 e2 75 3e cb +vpmaxuw ymm1, yword [rax] ; c4 e2 75 3e 08 +vpmaxuw ymm1, ymm2, ymm3 ; c4 e2 6d 3e cb +vpmaxuw ymm1, ymm2, yword [rax] ; c4 e2 6d 3e 08 + +vpmaxud ymm1, ymm3 ; c4 e2 75 3f cb +vpmaxud ymm1, yword [rax] ; c4 e2 75 3f 08 +vpmaxud ymm1, ymm2, ymm3 ; c4 e2 6d 3f cb +vpmaxud ymm1, ymm2, yword [rax] ; c4 e2 6d 3f 08 + +vpminsb ymm1, ymm3 ; c4 e2 75 38 cb +vpminsb ymm1, yword [rax] ; c4 e2 75 38 08 +vpminsb ymm1, ymm2, ymm3 ; c4 e2 6d 38 cb +vpminsb ymm1, ymm2, yword [rax] ; c4 e2 6d 38 08 + +vpminsw ymm1, ymm3 ; c5 f5 ea cb +vpminsw ymm1, yword [rax] ; c5 f5 ea 08 +vpminsw ymm1, ymm2, ymm3 ; c5 ed ea cb +vpminsw ymm1, ymm2, yword [rax] ; c5 ed ea 08 + +vpminsd ymm1, ymm3 ; c4 e2 75 39 cb +vpminsd ymm1, yword [rax] ; c4 e2 75 39 08 +vpminsd ymm1, ymm2, ymm3 ; c4 e2 6d 39 cb +vpminsd ymm1, ymm2, yword [rax] ; c4 e2 6d 39 08 + +vpminub ymm1, ymm3 ; c5 f5 da cb +vpminub ymm1, yword [rax] ; c5 f5 da 08 +vpminub ymm1, ymm2, ymm3 ; c5 ed da cb +vpminub ymm1, ymm2, yword [rax] ; c5 ed da 08 + +vpminuw ymm1, ymm3 ; c4 e2 75 3a cb +vpminuw ymm1, yword [rax] ; c4 e2 75 3a 08 +vpminuw ymm1, ymm2, ymm3 ; c4 e2 6d 3a cb +vpminuw ymm1, ymm2, yword [rax] ; c4 e2 6d 3a 08 + +vpminud ymm1, ymm3 ; c4 e2 75 3b cb +vpminud ymm1, yword [rax] ; c4 e2 75 3b 08 +vpminud ymm1, ymm2, ymm3 ; c4 e2 6d 3b cb +vpminud ymm1, ymm2, yword [rax] ; c4 e2 6d 3b 08 + +vpmovmskb eax, ymm1 ; c5 fd d7 c1 +vpmovmskb rax, ymm1 ; c5 fd d7 c1 + +vpmovsxbw ymm1, xmm2 ; c4 e2 7d 20 ca +vpmovsxbw ymm1, [rax] ; c4 e2 7d 20 08 +vpmovsxbw ymm1, oword [rax] ; c4 e2 7d 20 08 + +vpmovsxbd ymm1, xmm2 ; c4 e2 7d 21 ca +vpmovsxbd ymm1, [rax] ; c4 e2 7d 21 08 +vpmovsxbd ymm1, qword [rax] ; c4 e2 7d 21 08 + +vpmovsxbq ymm1, xmm2 ; c4 e2 7d 22 ca +vpmovsxbq ymm1, [rax] ; c4 e2 7d 22 08 +vpmovsxbq ymm1, dword [rax] ; c4 e2 7d 22 08 + +vpmovsxwd ymm1, xmm2 ; c4 e2 7d 23 ca +vpmovsxwd ymm1, [rax] ; c4 e2 7d 23 08 +vpmovsxwd ymm1, oword [rax] ; c4 e2 7d 23 08 + +vpmovsxwq ymm1, xmm2 ; c4 e2 7d 24 ca +vpmovsxwq ymm1, [rax] ; c4 e2 7d 24 08 +vpmovsxwq ymm1, qword [rax] ; c4 e2 7d 24 08 + +vpmovsxdq ymm1, xmm2 ; c4 e2 7d 25 ca +vpmovsxdq ymm1, [rax] ; c4 e2 7d 25 08 +vpmovsxdq ymm1, oword [rax] ; c4 e2 7d 25 08 + +vpmovzxbw ymm1, xmm2 ; c4 e2 7d 30 ca +vpmovzxbw ymm1, [rax] ; c4 e2 7d 30 08 +vpmovzxbw ymm1, oword [rax] ; c4 e2 7d 30 08 + +vpmovzxbd ymm1, xmm2 ; c4 e2 7d 31 ca +vpmovzxbd ymm1, [rax] ; c4 e2 7d 31 08 +vpmovzxbd ymm1, qword [rax] ; c4 e2 7d 31 08 + +vpmovzxbq ymm1, xmm2 ; c4 e2 7d 32 ca +vpmovzxbq ymm1, [rax] ; c4 e2 7d 32 08 +vpmovzxbq ymm1, dword [rax] ; c4 e2 7d 32 08 + +vpmovzxwd ymm1, xmm2 ; c4 e2 7d 33 ca +vpmovzxwd ymm1, [rax] ; c4 e2 7d 33 08 +vpmovzxwd ymm1, oword [rax] ; c4 e2 7d 33 08 + +vpmovzxwq ymm1, xmm2 ; c4 e2 7d 34 ca +vpmovzxwq ymm1, [rax] ; c4 e2 7d 34 08 +vpmovzxwq ymm1, qword [rax] ; c4 e2 7d 34 08 + +vpmovzxdq ymm1, xmm2 ; c4 e2 7d 35 ca +vpmovzxdq ymm1, [rax] ; c4 e2 7d 35 08 +vpmovzxdq ymm1, oword [rax] ; c4 e2 7d 35 08 + +vpmuldq ymm1, ymm3 ; c4 e2 75 28 cb +vpmuldq ymm1, yword [rax] ; c4 e2 75 28 08 +vpmuldq ymm1, ymm2, ymm3 ; c4 e2 6d 28 cb +vpmuldq ymm1, ymm2, yword [rax] ; c4 e2 6d 28 08 + +vpmulhrsw ymm1, ymm3 ; c4 e2 75 0b cb +vpmulhrsw ymm1, yword [rax] ; c4 e2 75 0b 08 +vpmulhrsw ymm1, ymm2, ymm3 ; c4 e2 6d 0b cb +vpmulhrsw ymm1, ymm2, yword [rax] ; c4 e2 6d 0b 08 + +vpmulhuw ymm1, ymm3 ; c5 f5 e4 cb +vpmulhuw ymm1, yword [rax] ; c5 f5 e4 08 +vpmulhuw ymm1, ymm2, ymm3 ; c5 ed e4 cb +vpmulhuw ymm1, ymm2, yword [rax] ; c5 ed e4 08 + +vpmulhw ymm1, ymm3 ; c5 f5 e5 cb +vpmulhw ymm1, yword [rax] ; c5 f5 e5 08 +vpmulhw ymm1, ymm2, ymm3 ; c5 ed e5 cb +vpmulhw ymm1, ymm2, yword [rax] ; c5 ed e5 08 + +vpmullw ymm1, ymm3 ; c5 f5 d5 cb +vpmullw ymm1, yword [rax] ; c5 f5 d5 08 +vpmullw ymm1, ymm2, ymm3 ; c5 ed d5 cb +vpmullw ymm1, ymm2, yword [rax] ; c5 ed d5 08 + +vpmulld ymm1, ymm3 ; c4 e2 75 40 cb +vpmulld ymm1, yword [rax] ; c4 e2 75 40 08 +vpmulld ymm1, ymm2, ymm3 ; c4 e2 6d 40 cb +vpmulld ymm1, ymm2, yword [rax] ; c4 e2 6d 40 08 + +vpmuludq ymm1, ymm3 ; c5 f5 f4 cb +vpmuludq ymm1, yword [rax] ; c5 f5 f4 08 +vpmuludq ymm1, ymm2, ymm3 ; c5 ed f4 cb +vpmuludq ymm1, ymm2, yword [rax] ; c5 ed f4 08 + +vpor ymm1, ymm3 ; c5 f5 eb cb +vpor ymm1, yword [rax] ; c5 f5 eb 08 +vpor ymm1, ymm2, ymm3 ; c5 ed eb cb +vpor ymm1, ymm2, yword [rax] ; c5 ed eb 08 + +vpsadbw ymm1, ymm3 ; c5 f5 f6 cb +vpsadbw ymm1, yword [rax] ; c5 f5 f6 08 +vpsadbw ymm1, ymm2, ymm3 ; c5 ed f6 cb +vpsadbw ymm1, ymm2, yword [rax] ; c5 ed f6 08 + +vpshufb ymm1, ymm3 ; c4 e2 75 00 cb +vpshufb ymm1, yword [rax] ; c4 e2 75 00 08 +vpshufb ymm1, ymm2, ymm3 ; c4 e2 6d 00 cb +vpshufb ymm1, ymm2, yword [rax] ; c4 e2 6d 00 08 + +vpshufd ymm1, ymm3, 3 ; c5 fd 70 cb 03 +vpshufd ymm1, yword [rax], 3 ; c5 fd 70 08 03 + +vpshufhw ymm1, ymm3, 3 ; c5 fe 70 cb 03 +vpshufhw ymm1, yword [rax], 3 ; c5 fe 70 08 03 + +vpshuflw ymm1, ymm3, 3 ; c5 ff 70 cb 03 +vpshuflw ymm1, yword [rax], 3 ; c5 ff 70 08 03 + +vpsignb ymm1, ymm3 ; c4 e2 75 08 cb +vpsignb ymm1, yword [rax] ; c4 e2 75 08 08 +vpsignb ymm1, ymm2, ymm3 ; c4 e2 6d 08 cb +vpsignb ymm1, ymm2, yword [rax] ; c4 e2 6d 08 08 + +vpsignw ymm1, ymm3 ; c4 e2 75 09 cb +vpsignw ymm1, yword [rax] ; c4 e2 75 09 08 +vpsignw ymm1, ymm2, ymm3 ; c4 e2 6d 09 cb +vpsignw ymm1, ymm2, yword [rax] ; c4 e2 6d 09 08 + +vpsignd ymm1, ymm3 ; c4 e2 75 0a cb +vpsignd ymm1, yword [rax] ; c4 e2 75 0a 08 +vpsignd ymm1, ymm2, ymm3 ; c4 e2 6d 0a cb +vpsignd ymm1, ymm2, yword [rax] ; c4 e2 6d 0a 08 + +vpslldq ymm1, 3 ; c5 f5 73 f9 03 +vpslldq ymm1, ymm2, 3 ; c5 f5 73 fa 03 + +vpsllw ymm1, xmm3 ; c5 f5 f1 cb +vpsllw ymm1, oword [rax] ; c5 f5 f1 08 +vpsllw ymm1, 3 ; c5 f5 71 f1 03 +vpsllw ymm1, ymm2, xmm3 ; c5 ed f1 cb +vpsllw ymm1, ymm2, oword [rax] ; c5 ed f1 08 +vpsllw ymm1, ymm2, 3 ; c5 f5 71 f2 03 + +vpslld ymm1, xmm3 ; c5 f5 f2 cb +vpslld ymm1, oword [rax] ; c5 f5 f2 08 +vpslld ymm1, 3 ; c5 f5 72 f1 03 +vpslld ymm1, ymm2, xmm3 ; c5 ed f2 cb +vpslld ymm1, ymm2, oword [rax] ; c5 ed f2 08 +vpslld ymm1, ymm2, 3 ; c5 f5 72 f2 03 + +vpsllq ymm1, xmm3 ; c5 f5 f3 cb +vpsllq ymm1, oword [rax] ; c5 f5 f3 08 +vpsllq ymm1, 3 ; c5 f5 73 f1 03 +vpsllq ymm1, ymm2, xmm3 ; c5 ed f3 cb +vpsllq ymm1, ymm2, oword [rax] ; c5 ed f3 08 +vpsllq ymm1, ymm2, 3 ; c5 f5 73 f2 03 + +vpsraw ymm1, xmm3 ; c5 f5 e1 cb +vpsraw ymm1, oword [rax] ; c5 f5 e1 08 +vpsraw ymm1, 3 ; c5 f5 71 e1 03 +vpsraw ymm1, ymm2, xmm3 ; c5 ed e1 cb +vpsraw ymm1, ymm2, oword [rax] ; c5 ed e1 08 +vpsraw ymm1, ymm2, 3 ; c5 f5 71 e2 03 + +vpsrad ymm1, xmm3 ; c5 f5 e2 cb +vpsrad ymm1, oword [rax] ; c5 f5 e2 08 +vpsrad ymm1, 3 ; c5 f5 72 e1 03 +vpsrad ymm1, ymm2, xmm3 ; c5 ed e2 cb +vpsrad ymm1, ymm2, oword [rax] ; c5 ed e2 08 +vpsrad ymm1, ymm2, 3 ; c5 f5 72 e2 03 + +vpsrldq ymm1, 3 ; c5 f5 73 d9 03 +vpsrldq ymm1, ymm2, 3 ; c5 f5 73 da 03 + +vpsrlw ymm1, xmm3 ; c5 f5 d1 cb +vpsrlw ymm1, oword [rax] ; c5 f5 d1 08 +vpsrlw ymm1, 3 ; c5 f5 71 d1 03 +vpsrlw ymm1, ymm2, xmm3 ; c5 ed d1 cb +vpsrlw ymm1, ymm2, oword [rax] ; c5 ed d1 08 +vpsrlw ymm1, ymm2, 3 ; c5 f5 71 d2 03 + +vpsrld ymm1, xmm3 ; c5 f5 d2 cb +vpsrld ymm1, oword [rax] ; c5 f5 d2 08 +vpsrld ymm1, 3 ; c5 f5 72 d1 03 +vpsrld ymm1, ymm2, xmm3 ; c5 ed d2 cb +vpsrld ymm1, ymm2, oword [rax] ; c5 ed d2 08 +vpsrld ymm1, ymm2, 3 ; c5 f5 72 d2 03 + +vpsrld ymm1, xmm3 ; c5 f5 d2 cb +vpsrld ymm1, oword [rax] ; c5 f5 d2 08 +vpsrld ymm1, 3 ; c5 f5 72 d1 03 +vpsrld ymm1, ymm2, xmm3 ; c5 ed d2 cb +vpsrld ymm1, ymm2, oword [rax] ; c5 ed d2 08 +vpsrld ymm1, ymm2, 3 ; c5 f5 72 d2 03 + +vpsubsb ymm1, ymm3 ; c5 f5 e8 cb +vpsubsb ymm1, yword [rax] ; c5 f5 e8 08 +vpsubsb ymm1, ymm2, ymm3 ; c5 ed e8 cb +vpsubsb ymm1, ymm2, yword [rax] ; c5 ed e8 08 + +vpsubsw ymm1, ymm3 ; c5 f5 e9 cb +vpsubsw ymm1, yword [rax] ; c5 f5 e9 08 +vpsubsw ymm1, ymm2, ymm3 ; c5 ed e9 cb +vpsubsw ymm1, ymm2, yword [rax] ; c5 ed e9 08 + +vpsubusb ymm1, ymm3 ; c5 f5 d8 cb +vpsubusb ymm1, yword [rax] ; c5 f5 d8 08 +vpsubusb ymm1, ymm2, ymm3 ; c5 ed d8 cb +vpsubusb ymm1, ymm2, yword [rax] ; c5 ed d8 08 + +vpsubusw ymm1, ymm3 ; c5 f5 d9 cb +vpsubusw ymm1, yword [rax] ; c5 f5 d9 08 +vpsubusw ymm1, ymm2, ymm3 ; c5 ed d9 cb +vpsubusw ymm1, ymm2, yword [rax] ; c5 ed d9 08 + +vpunpckhbw ymm1, ymm3 ; c5 f5 68 cb +vpunpckhbw ymm1, yword [rax] ; c5 f5 68 08 +vpunpckhbw ymm1, ymm2, ymm3 ; c5 ed 68 cb +vpunpckhbw ymm1, ymm2, yword [rax] ; c5 ed 68 08 + +vpunpckhwd ymm1, ymm3 ; c5 f5 69 cb +vpunpckhwd ymm1, yword [rax] ; c5 f5 69 08 +vpunpckhwd ymm1, ymm2, ymm3 ; c5 ed 69 cb +vpunpckhwd ymm1, ymm2, yword [rax] ; c5 ed 69 08 + +vpunpckhdq ymm1, ymm3 ; c5 f5 6a cb +vpunpckhdq ymm1, yword [rax] ; c5 f5 6a 08 +vpunpckhdq ymm1, ymm2, ymm3 ; c5 ed 6a cb +vpunpckhdq ymm1, ymm2, yword [rax] ; c5 ed 6a 08 + +vpunpckhqdq ymm1, ymm3 ; c5 f5 6d cb +vpunpckhqdq ymm1, yword [rax] ; c5 f5 6d 08 +vpunpckhqdq ymm1, ymm2, ymm3 ; c5 ed 6d cb +vpunpckhqdq ymm1, ymm2, yword [rax] ; c5 ed 6d 08 + +vpunpcklbw ymm1, ymm3 ; c5 f5 60 cb +vpunpcklbw ymm1, yword [rax] ; c5 f5 60 08 +vpunpcklbw ymm1, ymm2, ymm3 ; c5 ed 60 cb +vpunpcklbw ymm1, ymm2, yword [rax] ; c5 ed 60 08 + +vpunpcklwd ymm1, ymm3 ; c5 f5 61 cb +vpunpcklwd ymm1, yword [rax] ; c5 f5 61 08 +vpunpcklwd ymm1, ymm2, ymm3 ; c5 ed 61 cb +vpunpcklwd ymm1, ymm2, yword [rax] ; c5 ed 61 08 + +vpunpckldq ymm1, ymm3 ; c5 f5 62 cb +vpunpckldq ymm1, yword [rax] ; c5 f5 62 08 +vpunpckldq ymm1, ymm2, ymm3 ; c5 ed 62 cb +vpunpckldq ymm1, ymm2, yword [rax] ; c5 ed 62 08 + +vpunpcklqdq ymm1, ymm3 ; c5 f5 6c cb +vpunpcklqdq ymm1, yword [rax] ; c5 f5 6c 08 +vpunpcklqdq ymm1, ymm2, ymm3 ; c5 ed 6c cb +vpunpcklqdq ymm1, ymm2, yword [rax] ; c5 ed 6c 08 + +vpxor ymm1, ymm3 ; c5 f5 ef cb +vpxor ymm1, yword [rax] ; c5 f5 ef 08 +vpxor ymm1, ymm2, ymm3 ; c5 ed ef cb +vpxor ymm1, ymm2, yword [rax] ; c5 ed ef 08 + +vmovntdqa ymm1, yword [rax] ; c4 e2 7d 2a 08 + +vbroadcastss xmm1, xmm2 ; c4 e2 79 18 ca +vbroadcastss ymm1, xmm2 ; c4 e2 7d 18 ca + +vbroadcastsd ymm1, xmm2 ; c4 e2 7d 19 ca + +vbroadcasti128 ymm1, oword [rax] ; c4 e2 7d 5a 08 + +vpblendd ymm1, ymm2, ymm3, 3 ; c4 e3 6d 02 cb 03 +vpblendd ymm1, ymm2, yword [rax], 3 ; c4 e3 6d 02 08 03 + +vpbroadcastb xmm1, xmm2 ; c4 e2 79 78 ca +vpbroadcastb xmm1, byte [rax] ; c4 e2 79 78 08 +vpbroadcastb ymm1, xmm2 ; c4 e2 7d 78 ca +vpbroadcastb ymm1, byte [rax] ; c4 e2 7d 78 08 + +vpbroadcastw xmm1, xmm2 ; c4 e2 79 79 ca +vpbroadcastw xmm1, word [rax] ; c4 e2 79 79 08 +vpbroadcastw ymm1, xmm2 ; c4 e2 7d 79 ca +vpbroadcastw ymm1, word [rax] ; c4 e2 7d 79 08 + +vpbroadcastd xmm1, xmm2 ; c4 e2 79 58 ca +vpbroadcastd xmm1, dword [rax] ; c4 e2 79 58 08 +vpbroadcastd ymm1, xmm2 ; c4 e2 7d 58 ca +vpbroadcastd ymm1, dword [rax] ; c4 e2 7d 58 08 + +vpbroadcastq xmm1, xmm2 ; c4 e2 79 59 ca +vpbroadcastq xmm1, qword [rax] ; c4 e2 79 59 08 +vpbroadcastq ymm1, xmm2 ; c4 e2 7d 59 ca +vpbroadcastq ymm1, qword [rax] ; c4 e2 7d 59 08 + +vpermd ymm1, ymm2, ymm3 ; c4 e2 6d 36 cb +vpermd ymm1, ymm2, yword [rax] ; c4 e2 6d 36 08 + +vpermpd ymm1, ymm2, 3 ; c4 e3 fd 01 ca 03 +vpermpd ymm1, yword [rax], 3 ; c4 e3 fd 01 08 03 + +vpermps ymm1, ymm2, ymm3 ; c4 e2 6d 16 cb +vpermps ymm1, ymm2, yword [rax] ; c4 e2 6d 16 08 + +vpermq ymm1, ymm2, 3 ; c4 e3 fd 00 ca 03 +vpermq ymm1, yword [rax], 3 ; c4 e3 fd 00 08 03 + +vperm2i128 ymm1, ymm2, ymm3, 3 ; c4 e3 6d 46 cb 03 +vperm2i128 ymm1, ymm2, yword [rax], 3 ; c4 e3 6d 46 08 03 + +vextracti128 xmm1, ymm2, 3 ; c4 e3 7d 39 d1 03 +vextracti128 oword [rax], ymm2, 3 ; c4 e3 7d 39 10 03 + +vinserti128 ymm1, ymm2, xmm3, 3 ; c4 e3 6d 38 cb 03 +vinserti128 ymm1, ymm2, oword [rax], 3 ; c4 e3 6d 38 08 03 + +vpmaskmovd xmm1, xmm2, oword [rax] ; c4 e2 69 8c 08 +vpmaskmovd ymm1, ymm2, yword [rax] ; c4 e2 6d 8c 08 +vpmaskmovd oword [rax], xmm1, xmm2 ; c4 e2 71 8e 10 +vpmaskmovd yword [rax], ymm1, ymm2 ; c4 e2 75 8e 10 + +vpmaskmovq xmm1, xmm2, oword [rax] ; c4 e2 e9 8c 08 +vpmaskmovq ymm1, ymm2, yword [rax] ; c4 e2 ed 8c 08 +vpmaskmovq oword [rax], xmm1, xmm2 ; c4 e2 f1 8e 10 +vpmaskmovq yword [rax], ymm1, ymm2 ; c4 e2 f5 8e 10 + +vpsllvd xmm1, xmm2, xmm3 ; c4 e2 69 47 cb +vpsllvd xmm1, xmm2, oword [rax] ; c4 e2 69 47 08 +vpsllvd ymm1, ymm2, ymm3 ; c4 e2 6d 47 cb +vpsllvd ymm1, ymm2, yword [rax] ; c4 e2 6d 47 08 + +vpsllvq xmm1, xmm2, xmm3 ; c4 e2 e9 47 cb +vpsllvq xmm1, xmm2, oword [rax] ; c4 e2 e9 47 08 +vpsllvq ymm1, ymm2, ymm3 ; c4 e2 ed 47 cb +vpsllvq ymm1, ymm2, yword [rax] ; c4 e2 ed 47 08 + +vpsravd xmm1, xmm2, xmm3 ; c4 e2 69 46 cb +vpsravd xmm1, xmm2, oword [rax] ; c4 e2 69 46 08 +vpsravd ymm1, ymm2, ymm3 ; c4 e2 6d 46 cb +vpsravd ymm1, ymm2, yword [rax] ; c4 e2 6d 46 08 + +vpsrlvd xmm1, xmm2, xmm3 ; c4 e2 69 45 cb +vpsrlvd xmm1, xmm2, oword [rax] ; c4 e2 69 45 08 +vpsrlvd ymm1, ymm2, ymm3 ; c4 e2 6d 45 cb +vpsrlvd ymm1, ymm2, yword [rax] ; c4 e2 6d 45 08 + +vpsrlvq xmm1, xmm2, xmm3 ; c4 e2 e9 45 cb +vpsrlvq xmm1, xmm2, oword [rax] ; c4 e2 e9 45 08 +vpsrlvq ymm1, ymm2, ymm3 ; c4 e2 ed 45 cb +vpsrlvq ymm1, ymm2, yword [rax] ; c4 e2 ed 45 08 + +vgatherdpd xmm1, [rax+xmm1], xmm2 ; c4 e2 e9 92 0c 08 +vgatherdpd xmm1, qword [rax+xmm1], xmm2 ; c4 e2 e9 92 0c 08 +vgatherdpd ymm1, [rax+xmm1], ymm2 ; c4 e2 ed 92 0c 08 +vgatherdpd ymm1, qword [rax+xmm1], ymm2 ; c4 e2 ed 92 0c 08 + +vgatherqpd xmm1, [rax+xmm1], xmm2 ; c4 e2 e9 93 0c 08 +vgatherqpd xmm1, qword [rax+xmm1], xmm2 ; c4 e2 e9 93 0c 08 +vgatherqpd ymm1, [rax+ymm1], ymm2 ; c4 e2 ed 93 0c 08 +vgatherqpd ymm1, qword [rax+ymm1], ymm2 ; c4 e2 ed 93 0c 08 + +vgatherdps xmm1, [rax+xmm1], xmm2 ; c4 e2 69 92 0c 08 +vgatherdps xmm1, dword [rax+xmm1], xmm2 ; c4 e2 69 92 0c 08 +vgatherdps ymm1, [rax+ymm1], ymm2 ; c4 e2 6d 92 0c 08 +vgatherdps ymm1, dword [rax+ymm1], ymm2 ; c4 e2 6d 92 0c 08 + +vgatherqps xmm1, [rax+xmm1], xmm2 ; c4 e2 69 93 0c 08 +vgatherqps xmm1, dword [rax+xmm1], xmm2 ; c4 e2 69 93 0c 08 +vgatherqps xmm1, [rax+ymm1], xmm2 ; c4 e2 6d 93 0c 08 +vgatherqps xmm1, dword [rax+ymm1], xmm2 ; c4 e2 6d 93 0c 08 + +vpgatherdd xmm1, [rax+xmm1], xmm2 ; c4 e2 69 90 0c 08 +vpgatherdd xmm1, dword [rax+xmm1], xmm2 ; c4 e2 69 90 0c 08 +vpgatherdd ymm1, [rax+ymm1], ymm2 ; c4 e2 6d 90 0c 08 +vpgatherdd ymm1, dword [rax+ymm1], ymm2 ; c4 e2 6d 90 0c 08 + +vpgatherqd xmm1, [rax+xmm1], xmm2 ; c4 e2 69 91 0c 08 +vpgatherqd xmm1, dword [rax+xmm1], xmm2 ; c4 e2 69 91 0c 08 +vpgatherqd xmm1, [rax+ymm1], xmm2 ; c4 e2 6d 91 0c 08 +vpgatherqd xmm1, dword [rax+ymm1], xmm2 ; c4 e2 6d 91 0c 08 + +vpgatherdq xmm1, [rax+xmm1], xmm2 ; c4 e2 e9 90 0c 08 +vpgatherdq xmm1, qword [rax+xmm1], xmm2 ; c4 e2 e9 90 0c 08 +vpgatherdq ymm1, [rax+xmm1], ymm2 ; c4 e2 ed 90 0c 08 +vpgatherdq ymm1, qword [rax+xmm1], ymm2 ; c4 e2 ed 90 0c 08 + +vpgatherqq xmm1, [rax+xmm1], xmm2 ; c4 e2 e9 91 0c 08 +vpgatherqq xmm1, qword [rax+xmm1], xmm2 ; c4 e2 e9 91 0c 08 +vpgatherqq ymm1, [rax+ymm1], ymm2 ; c4 e2 ed 91 0c 08 +vpgatherqq ymm1, qword [rax+ymm1], ymm2 ; c4 e2 ed 91 0c 08 diff --git a/modules/arch/x86/tests/avx2.hex b/modules/arch/x86/tests/avx2.hex new file mode 100644 index 00000000..17f84bd3 --- /dev/null +++ b/modules/arch/x86/tests/avx2.hex @@ -0,0 +1,2297 @@ +c4 +e3 +75 +42 +cb +03 +c4 +e3 +75 +42 +08 +03 +c4 +e3 +6d +42 +cb +03 +c4 +e3 +6d +42 +08 +03 +c4 +e2 +7d +1c +ca +c4 +e2 +7d +1c +08 +c4 +e2 +7d +1d +ca +c4 +e2 +7d +1d +08 +c4 +e2 +7d +1e +ca +c4 +e2 +7d +1e +08 +c5 +f5 +63 +cb +c5 +f5 +63 +08 +c5 +ed +63 +cb +c5 +ed +63 +08 +c5 +f5 +6b +cb +c5 +f5 +6b +08 +c5 +ed +6b +cb +c5 +ed +6b +08 +c4 +e2 +75 +2b +cb +c4 +e2 +75 +2b +08 +c4 +e2 +6d +2b +cb +c4 +e2 +6d +2b +08 +c5 +f5 +67 +cb +c5 +f5 +67 +08 +c5 +ed +67 +cb +c5 +ed +67 +08 +c5 +f5 +fc +cb +c5 +f5 +fc +08 +c5 +ed +fc +cb +c5 +ed +fc +08 +c5 +f5 +fd +cb +c5 +f5 +fd +08 +c5 +ed +fd +cb +c5 +ed +fd +08 +c5 +f5 +fe +cb +c5 +f5 +fe +08 +c5 +ed +fe +cb +c5 +ed +fe +08 +c5 +f5 +d4 +cb +c5 +f5 +d4 +08 +c5 +ed +d4 +cb +c5 +ed +d4 +08 +c5 +f5 +ec +cb +c5 +f5 +ec +08 +c5 +ed +ec +cb +c5 +ed +ec +08 +c5 +f5 +ed +cb +c5 +f5 +ed +08 +c5 +ed +ed +cb +c5 +ed +ed +08 +c5 +f5 +dc +cb +c5 +f5 +dc +08 +c5 +ed +dc +cb +c5 +ed +dc +08 +c5 +f5 +dd +cb +c5 +f5 +dd +08 +c5 +ed +dd +cb +c5 +ed +dd +08 +c4 +e3 +6d +0f +cb +03 +c4 +e3 +6d +0f +08 +03 +c5 +f5 +db +cb +c5 +f5 +db +08 +c5 +ed +db +cb +c5 +ed +db +08 +c5 +f5 +df +cb +c5 +f5 +df +08 +c5 +ed +df +cb +c5 +ed +df +08 +c5 +f5 +e0 +cb +c5 +f5 +e0 +08 +c5 +ed +e0 +cb +c5 +ed +e0 +08 +c5 +f5 +e3 +cb +c5 +f5 +e3 +08 +c5 +ed +e3 +cb +c5 +ed +e3 +08 +c4 +e3 +6d +4c +cb +40 +c4 +e3 +6d +4c +08 +40 +c4 +e3 +75 +0e +cb +03 +c4 +e3 +75 +0e +08 +03 +c4 +e3 +6d +0e +cb +03 +c4 +e3 +6d +0e +08 +03 +c5 +f5 +74 +cb +c5 +f5 +74 +08 +c5 +ed +74 +cb +c5 +ed +74 +08 +c5 +f5 +75 +cb +c5 +f5 +75 +08 +c5 +ed +75 +cb +c5 +ed +75 +08 +c5 +f5 +76 +cb +c5 +f5 +76 +08 +c5 +ed +76 +cb +c5 +ed +76 +08 +c4 +e2 +75 +29 +cb +c4 +e2 +75 +29 +08 +c4 +e2 +6d +29 +cb +c4 +e2 +6d +29 +08 +c5 +f5 +64 +cb +c5 +f5 +64 +08 +c5 +ed +64 +cb +c5 +ed +64 +08 +c5 +f5 +65 +cb +c5 +f5 +65 +08 +c5 +ed +65 +cb +c5 +ed +65 +08 +c5 +f5 +66 +cb +c5 +f5 +66 +08 +c5 +ed +66 +cb +c5 +ed +66 +08 +c4 +e2 +75 +37 +cb +c4 +e2 +75 +37 +08 +c4 +e2 +6d +37 +cb +c4 +e2 +6d +37 +08 +c4 +e2 +75 +01 +cb +c4 +e2 +75 +01 +08 +c4 +e2 +6d +01 +cb +c4 +e2 +6d +01 +08 +c4 +e2 +75 +02 +cb +c4 +e2 +75 +02 +08 +c4 +e2 +6d +02 +cb +c4 +e2 +6d +02 +08 +c4 +e2 +75 +03 +cb +c4 +e2 +75 +03 +08 +c4 +e2 +6d +03 +cb +c4 +e2 +6d +03 +08 +c4 +e2 +75 +05 +cb +c4 +e2 +75 +05 +08 +c4 +e2 +6d +05 +cb +c4 +e2 +6d +05 +08 +c4 +e2 +75 +06 +cb +c4 +e2 +75 +06 +08 +c4 +e2 +6d +06 +cb +c4 +e2 +6d +06 +08 +c4 +e2 +75 +07 +cb +c4 +e2 +75 +07 +08 +c4 +e2 +6d +07 +cb +c4 +e2 +6d +07 +08 +c4 +e2 +75 +04 +cb +c4 +e2 +75 +04 +08 +c4 +e2 +6d +04 +cb +c4 +e2 +6d +04 +08 +c5 +f5 +f5 +cb +c5 +f5 +f5 +08 +c5 +ed +f5 +cb +c5 +ed +f5 +08 +c4 +e2 +75 +3c +cb +c4 +e2 +75 +3c +08 +c4 +e2 +6d +3c +cb +c4 +e2 +6d +3c +08 +c5 +f5 +ee +cb +c5 +f5 +ee +08 +c5 +ed +ee +cb +c5 +ed +ee +08 +c4 +e2 +75 +3d +cb +c4 +e2 +75 +3d +08 +c4 +e2 +6d +3d +cb +c4 +e2 +6d +3d +08 +c5 +f5 +de +cb +c5 +f5 +de +08 +c5 +ed +de +cb +c5 +ed +de +08 +c4 +e2 +75 +3e +cb +c4 +e2 +75 +3e +08 +c4 +e2 +6d +3e +cb +c4 +e2 +6d +3e +08 +c4 +e2 +75 +3f +cb +c4 +e2 +75 +3f +08 +c4 +e2 +6d +3f +cb +c4 +e2 +6d +3f +08 +c4 +e2 +75 +38 +cb +c4 +e2 +75 +38 +08 +c4 +e2 +6d +38 +cb +c4 +e2 +6d +38 +08 +c5 +f5 +ea +cb +c5 +f5 +ea +08 +c5 +ed +ea +cb +c5 +ed +ea +08 +c4 +e2 +75 +39 +cb +c4 +e2 +75 +39 +08 +c4 +e2 +6d +39 +cb +c4 +e2 +6d +39 +08 +c5 +f5 +da +cb +c5 +f5 +da +08 +c5 +ed +da +cb +c5 +ed +da +08 +c4 +e2 +75 +3a +cb +c4 +e2 +75 +3a +08 +c4 +e2 +6d +3a +cb +c4 +e2 +6d +3a +08 +c4 +e2 +75 +3b +cb +c4 +e2 +75 +3b +08 +c4 +e2 +6d +3b +cb +c4 +e2 +6d +3b +08 +c5 +fd +d7 +c1 +c5 +fd +d7 +c1 +c4 +e2 +7d +20 +ca +c4 +e2 +7d +20 +08 +c4 +e2 +7d +20 +08 +c4 +e2 +7d +21 +ca +c4 +e2 +7d +21 +08 +c4 +e2 +7d +21 +08 +c4 +e2 +7d +22 +ca +c4 +e2 +7d +22 +08 +c4 +e2 +7d +22 +08 +c4 +e2 +7d +23 +ca +c4 +e2 +7d +23 +08 +c4 +e2 +7d +23 +08 +c4 +e2 +7d +24 +ca +c4 +e2 +7d +24 +08 +c4 +e2 +7d +24 +08 +c4 +e2 +7d +25 +ca +c4 +e2 +7d +25 +08 +c4 +e2 +7d +25 +08 +c4 +e2 +7d +30 +ca +c4 +e2 +7d +30 +08 +c4 +e2 +7d +30 +08 +c4 +e2 +7d +31 +ca +c4 +e2 +7d +31 +08 +c4 +e2 +7d +31 +08 +c4 +e2 +7d +32 +ca +c4 +e2 +7d +32 +08 +c4 +e2 +7d +32 +08 +c4 +e2 +7d +33 +ca +c4 +e2 +7d +33 +08 +c4 +e2 +7d +33 +08 +c4 +e2 +7d +34 +ca +c4 +e2 +7d +34 +08 +c4 +e2 +7d +34 +08 +c4 +e2 +7d +35 +ca +c4 +e2 +7d +35 +08 +c4 +e2 +7d +35 +08 +c4 +e2 +75 +28 +cb +c4 +e2 +75 +28 +08 +c4 +e2 +6d +28 +cb +c4 +e2 +6d +28 +08 +c4 +e2 +75 +0b +cb +c4 +e2 +75 +0b +08 +c4 +e2 +6d +0b +cb +c4 +e2 +6d +0b +08 +c5 +f5 +e4 +cb +c5 +f5 +e4 +08 +c5 +ed +e4 +cb +c5 +ed +e4 +08 +c5 +f5 +e5 +cb +c5 +f5 +e5 +08 +c5 +ed +e5 +cb +c5 +ed +e5 +08 +c5 +f5 +d5 +cb +c5 +f5 +d5 +08 +c5 +ed +d5 +cb +c5 +ed +d5 +08 +c4 +e2 +75 +40 +cb +c4 +e2 +75 +40 +08 +c4 +e2 +6d +40 +cb +c4 +e2 +6d +40 +08 +c5 +f5 +f4 +cb +c5 +f5 +f4 +08 +c5 +ed +f4 +cb +c5 +ed +f4 +08 +c5 +f5 +eb +cb +c5 +f5 +eb +08 +c5 +ed +eb +cb +c5 +ed +eb +08 +c5 +f5 +f6 +cb +c5 +f5 +f6 +08 +c5 +ed +f6 +cb +c5 +ed +f6 +08 +c4 +e2 +75 +00 +cb +c4 +e2 +75 +00 +08 +c4 +e2 +6d +00 +cb +c4 +e2 +6d +00 +08 +c5 +fd +70 +cb +03 +c5 +fd +70 +08 +03 +c5 +fe +70 +cb +03 +c5 +fe +70 +08 +03 +c5 +ff +70 +cb +03 +c5 +ff +70 +08 +03 +c4 +e2 +75 +08 +cb +c4 +e2 +75 +08 +08 +c4 +e2 +6d +08 +cb +c4 +e2 +6d +08 +08 +c4 +e2 +75 +09 +cb +c4 +e2 +75 +09 +08 +c4 +e2 +6d +09 +cb +c4 +e2 +6d +09 +08 +c4 +e2 +75 +0a +cb +c4 +e2 +75 +0a +08 +c4 +e2 +6d +0a +cb +c4 +e2 +6d +0a +08 +c5 +f5 +73 +f9 +03 +c5 +f5 +73 +fa +03 +c5 +f5 +f1 +cb +c5 +f5 +f1 +08 +c5 +f5 +71 +f1 +03 +c5 +ed +f1 +cb +c5 +ed +f1 +08 +c5 +f5 +71 +f2 +03 +c5 +f5 +f2 +cb +c5 +f5 +f2 +08 +c5 +f5 +72 +f1 +03 +c5 +ed +f2 +cb +c5 +ed +f2 +08 +c5 +f5 +72 +f2 +03 +c5 +f5 +f3 +cb +c5 +f5 +f3 +08 +c5 +f5 +73 +f1 +03 +c5 +ed +f3 +cb +c5 +ed +f3 +08 +c5 +f5 +73 +f2 +03 +c5 +f5 +e1 +cb +c5 +f5 +e1 +08 +c5 +f5 +71 +e1 +03 +c5 +ed +e1 +cb +c5 +ed +e1 +08 +c5 +f5 +71 +e2 +03 +c5 +f5 +e2 +cb +c5 +f5 +e2 +08 +c5 +f5 +72 +e1 +03 +c5 +ed +e2 +cb +c5 +ed +e2 +08 +c5 +f5 +72 +e2 +03 +c5 +f5 +73 +d9 +03 +c5 +f5 +73 +da +03 +c5 +f5 +d1 +cb +c5 +f5 +d1 +08 +c5 +f5 +71 +d1 +03 +c5 +ed +d1 +cb +c5 +ed +d1 +08 +c5 +f5 +71 +d2 +03 +c5 +f5 +d2 +cb +c5 +f5 +d2 +08 +c5 +f5 +72 +d1 +03 +c5 +ed +d2 +cb +c5 +ed +d2 +08 +c5 +f5 +72 +d2 +03 +c5 +f5 +d2 +cb +c5 +f5 +d2 +08 +c5 +f5 +72 +d1 +03 +c5 +ed +d2 +cb +c5 +ed +d2 +08 +c5 +f5 +72 +d2 +03 +c5 +f5 +e8 +cb +c5 +f5 +e8 +08 +c5 +ed +e8 +cb +c5 +ed +e8 +08 +c5 +f5 +e9 +cb +c5 +f5 +e9 +08 +c5 +ed +e9 +cb +c5 +ed +e9 +08 +c5 +f5 +d8 +cb +c5 +f5 +d8 +08 +c5 +ed +d8 +cb +c5 +ed +d8 +08 +c5 +f5 +d9 +cb +c5 +f5 +d9 +08 +c5 +ed +d9 +cb +c5 +ed +d9 +08 +c5 +f5 +68 +cb +c5 +f5 +68 +08 +c5 +ed +68 +cb +c5 +ed +68 +08 +c5 +f5 +69 +cb +c5 +f5 +69 +08 +c5 +ed +69 +cb +c5 +ed +69 +08 +c5 +f5 +6a +cb +c5 +f5 +6a +08 +c5 +ed +6a +cb +c5 +ed +6a +08 +c5 +f5 +6d +cb +c5 +f5 +6d +08 +c5 +ed +6d +cb +c5 +ed +6d +08 +c5 +f5 +60 +cb +c5 +f5 +60 +08 +c5 +ed +60 +cb +c5 +ed +60 +08 +c5 +f5 +61 +cb +c5 +f5 +61 +08 +c5 +ed +61 +cb +c5 +ed +61 +08 +c5 +f5 +62 +cb +c5 +f5 +62 +08 +c5 +ed +62 +cb +c5 +ed +62 +08 +c5 +f5 +6c +cb +c5 +f5 +6c +08 +c5 +ed +6c +cb +c5 +ed +6c +08 +c5 +f5 +ef +cb +c5 +f5 +ef +08 +c5 +ed +ef +cb +c5 +ed +ef +08 +c4 +e2 +7d +2a +08 +c4 +e2 +79 +18 +ca +c4 +e2 +7d +18 +ca +c4 +e2 +7d +19 +ca +c4 +e2 +7d +5a +08 +c4 +e3 +6d +02 +cb +03 +c4 +e3 +6d +02 +08 +03 +c4 +e2 +79 +78 +ca +c4 +e2 +79 +78 +08 +c4 +e2 +7d +78 +ca +c4 +e2 +7d +78 +08 +c4 +e2 +79 +79 +ca +c4 +e2 +79 +79 +08 +c4 +e2 +7d +79 +ca +c4 +e2 +7d +79 +08 +c4 +e2 +79 +58 +ca +c4 +e2 +79 +58 +08 +c4 +e2 +7d +58 +ca +c4 +e2 +7d +58 +08 +c4 +e2 +79 +59 +ca +c4 +e2 +79 +59 +08 +c4 +e2 +7d +59 +ca +c4 +e2 +7d +59 +08 +c4 +e2 +6d +36 +cb +c4 +e2 +6d +36 +08 +c4 +e3 +fd +01 +ca +03 +c4 +e3 +fd +01 +08 +03 +c4 +e2 +6d +16 +cb +c4 +e2 +6d +16 +08 +c4 +e3 +fd +00 +ca +03 +c4 +e3 +fd +00 +08 +03 +c4 +e3 +6d +46 +cb +03 +c4 +e3 +6d +46 +08 +03 +c4 +e3 +7d +39 +d1 +03 +c4 +e3 +7d +39 +10 +03 +c4 +e3 +6d +38 +cb +03 +c4 +e3 +6d +38 +08 +03 +c4 +e2 +69 +8c +08 +c4 +e2 +6d +8c +08 +c4 +e2 +71 +8e +10 +c4 +e2 +75 +8e +10 +c4 +e2 +e9 +8c +08 +c4 +e2 +ed +8c +08 +c4 +e2 +f1 +8e +10 +c4 +e2 +f5 +8e +10 +c4 +e2 +69 +47 +cb +c4 +e2 +69 +47 +08 +c4 +e2 +6d +47 +cb +c4 +e2 +6d +47 +08 +c4 +e2 +e9 +47 +cb +c4 +e2 +e9 +47 +08 +c4 +e2 +ed +47 +cb +c4 +e2 +ed +47 +08 +c4 +e2 +69 +46 +cb +c4 +e2 +69 +46 +08 +c4 +e2 +6d +46 +cb +c4 +e2 +6d +46 +08 +c4 +e2 +69 +45 +cb +c4 +e2 +69 +45 +08 +c4 +e2 +6d +45 +cb +c4 +e2 +6d +45 +08 +c4 +e2 +e9 +45 +cb +c4 +e2 +e9 +45 +08 +c4 +e2 +ed +45 +cb +c4 +e2 +ed +45 +08 +c4 +e2 +e9 +92 +0c +08 +c4 +e2 +e9 +92 +0c +08 +c4 +e2 +ed +92 +0c +08 +c4 +e2 +ed +92 +0c +08 +c4 +e2 +e9 +93 +0c +08 +c4 +e2 +e9 +93 +0c +08 +c4 +e2 +ed +93 +0c +08 +c4 +e2 +ed +93 +0c +08 +c4 +e2 +69 +92 +0c +08 +c4 +e2 +69 +92 +0c +08 +c4 +e2 +6d +92 +0c +08 +c4 +e2 +6d +92 +0c +08 +c4 +e2 +69 +93 +0c +08 +c4 +e2 +69 +93 +0c +08 +c4 +e2 +6d +93 +0c +08 +c4 +e2 +6d +93 +0c +08 +c4 +e2 +69 +90 +0c +08 +c4 +e2 +69 +90 +0c +08 +c4 +e2 +6d +90 +0c +08 +c4 +e2 +6d +90 +0c +08 +c4 +e2 +69 +91 +0c +08 +c4 +e2 +69 +91 +0c +08 +c4 +e2 +6d +91 +0c +08 +c4 +e2 +6d +91 +0c +08 +c4 +e2 +e9 +90 +0c +08 +c4 +e2 +e9 +90 +0c +08 +c4 +e2 +ed +90 +0c +08 +c4 +e2 +ed +90 +0c +08 +c4 +e2 +e9 +91 +0c +08 +c4 +e2 +e9 +91 +0c +08 +c4 +e2 +ed +91 +0c +08 +c4 +e2 +ed +91 +0c +08 diff --git a/modules/arch/x86/tests/avxcc.asm b/modules/arch/x86/tests/avxcc.asm new file mode 100644 index 00000000..bcde2563 --- /dev/null +++ b/modules/arch/x86/tests/avxcc.asm @@ -0,0 +1,899 @@ +; Exhaustive test of AVX condition code aliases +; Also includes based-upon SSE instructions for comparison +; +; Copyright (C) 2008 Peter Johnson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; 1. Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; + +[bits 64] + +cmpeqpd xmm1, xmm2 ; 00h +cmpltpd xmm1, xmm2 ; 01h +cmplepd xmm1, xmm2 ; 02h +cmpunordpd xmm1, xmm2 ; 03h +cmpneqpd xmm1, xmm2 ; 04h +cmpnltpd xmm1, xmm2 ; 05h +cmpnlepd xmm1, xmm2 ; 06h +cmpordpd xmm1, xmm2 ; 07h + +vcmpeqpd xmm1, xmm2 ; 00h +vcmpltpd xmm1, xmm2 ; 01h +vcmplepd xmm1, xmm2 ; 02h +vcmpunordpd xmm1, xmm2 ; 03h +vcmpneqpd xmm1, xmm2 ; 04h +vcmpnltpd xmm1, xmm2 ; 05h +vcmpnlepd xmm1, xmm2 ; 06h +vcmpordpd xmm1, xmm2 ; 07h + +vcmpeqpd xmm1, xmm2, xmm3 ; 00h +vcmpltpd xmm1, xmm2, xmm3 ; 01h +vcmplepd xmm1, xmm2, xmm3 ; 02h +vcmpunordpd xmm1, xmm2, xmm3 ; 03h +vcmpneqpd xmm1, xmm2, xmm3 ; 04h +vcmpnltpd xmm1, xmm2, xmm3 ; 05h +vcmpnlepd xmm1, xmm2, xmm3 ; 06h +vcmpordpd xmm1, xmm2, xmm3 ; 07h + +vcmpeq_uqpd xmm1, xmm2, xmm3 ; 08h +vcmpngepd xmm1, xmm2, xmm3 ; 09h +vcmpngtpd xmm1, xmm2, xmm3 ; 0Ah +vcmpfalsepd xmm1, xmm2, xmm3 ; 0Bh +vcmpneq_oqpd xmm1, xmm2, xmm3 ; 0Ch +vcmpgepd xmm1, xmm2, xmm3 ; 0Dh +vcmpgtpd xmm1, xmm2, xmm3 ; 0Eh +vcmptruepd xmm1, xmm2, xmm3 ; 0Fh + +vcmpeq_ospd xmm1, xmm2, xmm3 ; 10h +vcmplt_oqpd xmm1, xmm2, xmm3 ; 11h +vcmple_oqpd xmm1, xmm2, xmm3 ; 12h +vcmpunord_spd xmm1, xmm2, xmm3 ; 13h +vcmpneq_uspd xmm1, xmm2, xmm3 ; 14h +vcmpnlt_uqpd xmm1, xmm2, xmm3 ; 15h +vcmpnle_uqpd xmm1, xmm2, xmm3 ; 16h +vcmpord_spd xmm1, xmm2, xmm3 ; 17h + +vcmpeq_uspd xmm1, xmm2, xmm3 ; 18h +vcmpnge_uqpd xmm1, xmm2, xmm3 ; 19h +vcmpngt_uqpd xmm1, xmm2, xmm3 ; 1Ah +vcmpfalse_ospd xmm1, xmm2, xmm3 ; 1Bh +vcmpneq_ospd xmm1, xmm2, xmm3 ; 1Ch +vcmpge_oqpd xmm1, xmm2, xmm3 ; 1Dh +vcmpgt_oqpd xmm1, xmm2, xmm3 ; 1Eh +vcmptrue_uspd xmm1, xmm2, xmm3 ; 1Fh + +cmpeqpd xmm1, [rax] ; 00h +cmpltpd xmm1, [rax] ; 01h +cmplepd xmm1, [rax] ; 02h +cmpunordpd xmm1, [rax] ; 03h +cmpneqpd xmm1, [rax] ; 04h +cmpnltpd xmm1, [rax] ; 05h +cmpnlepd xmm1, [rax] ; 06h +cmpordpd xmm1, [rax] ; 07h + +vcmpeqpd xmm1, [rax] ; 00h +vcmpltpd xmm1, [rax] ; 01h +vcmplepd xmm1, [rax] ; 02h +vcmpunordpd xmm1, [rax] ; 03h +vcmpneqpd xmm1, [rax] ; 04h +vcmpnltpd xmm1, [rax] ; 05h +vcmpnlepd xmm1, [rax] ; 06h +vcmpordpd xmm1, [rax] ; 07h + +vcmpeqpd xmm1, xmm2, [rax] ; 00h +vcmpltpd xmm1, xmm2, [rax] ; 01h +vcmplepd xmm1, xmm2, [rax] ; 02h +vcmpunordpd xmm1, xmm2, [rax] ; 03h +vcmpneqpd xmm1, xmm2, [rax] ; 04h +vcmpnltpd xmm1, xmm2, [rax] ; 05h +vcmpnlepd xmm1, xmm2, [rax] ; 06h +vcmpordpd xmm1, xmm2, [rax] ; 07h + +vcmpeq_uqpd xmm1, xmm2, [rax] ; 08h +vcmpngepd xmm1, xmm2, [rax] ; 09h +vcmpngtpd xmm1, xmm2, [rax] ; 0Ah +vcmpfalsepd xmm1, xmm2, [rax] ; 0Bh +vcmpneq_oqpd xmm1, xmm2, [rax] ; 0Ch +vcmpgepd xmm1, xmm2, [rax] ; 0Dh +vcmpgtpd xmm1, xmm2, [rax] ; 0Eh +vcmptruepd xmm1, xmm2, [rax] ; 0Fh + +vcmpeq_ospd xmm1, xmm2, [rax] ; 10h +vcmplt_oqpd xmm1, xmm2, [rax] ; 11h +vcmple_oqpd xmm1, xmm2, [rax] ; 12h +vcmpunord_spd xmm1, xmm2, [rax] ; 13h +vcmpneq_uspd xmm1, xmm2, [rax] ; 14h +vcmpnlt_uqpd xmm1, xmm2, [rax] ; 15h +vcmpnle_uqpd xmm1, xmm2, [rax] ; 16h +vcmpord_spd xmm1, xmm2, [rax] ; 17h + +vcmpeq_uspd xmm1, xmm2, [rax] ; 18h +vcmpnge_uqpd xmm1, xmm2, [rax] ; 19h +vcmpngt_uqpd xmm1, xmm2, [rax] ; 1Ah +vcmpfalse_ospd xmm1, xmm2, [rax] ; 1Bh +vcmpneq_ospd xmm1, xmm2, [rax] ; 1Ch +vcmpge_oqpd xmm1, xmm2, [rax] ; 1Dh +vcmpgt_oqpd xmm1, xmm2, [rax] ; 1Eh +vcmptrue_uspd xmm1, xmm2, [rax] ; 1Fh + +cmpeqpd xmm1, dqword [rax] ; 00h +cmpltpd xmm1, dqword [rax] ; 01h +cmplepd xmm1, dqword [rax] ; 02h +cmpunordpd xmm1, dqword [rax] ; 03h +cmpneqpd xmm1, dqword [rax] ; 04h +cmpnltpd xmm1, dqword [rax] ; 05h +cmpnlepd xmm1, dqword [rax] ; 06h +cmpordpd xmm1, dqword [rax] ; 07h + +vcmpeqpd xmm1, dqword [rax] ; 00h +vcmpltpd xmm1, dqword [rax] ; 01h +vcmplepd xmm1, dqword [rax] ; 02h +vcmpunordpd xmm1, dqword [rax] ; 03h +vcmpneqpd xmm1, dqword [rax] ; 04h +vcmpnltpd xmm1, dqword [rax] ; 05h +vcmpnlepd xmm1, dqword [rax] ; 06h +vcmpordpd xmm1, dqword [rax] ; 07h + +vcmpeqpd xmm1, xmm2, dqword [rax] ; 00h +vcmpltpd xmm1, xmm2, dqword [rax] ; 01h +vcmplepd xmm1, xmm2, dqword [rax] ; 02h +vcmpunordpd xmm1, xmm2, dqword [rax] ; 03h +vcmpneqpd xmm1, xmm2, dqword [rax] ; 04h +vcmpnltpd xmm1, xmm2, dqword [rax] ; 05h +vcmpnlepd xmm1, xmm2, dqword [rax] ; 06h +vcmpordpd xmm1, xmm2, dqword [rax] ; 07h + +vcmpeq_uqpd xmm1, xmm2, dqword [rax] ; 08h +vcmpngepd xmm1, xmm2, dqword [rax] ; 09h +vcmpngtpd xmm1, xmm2, dqword [rax] ; 0Ah +vcmpfalsepd xmm1, xmm2, dqword [rax] ; 0Bh +vcmpneq_oqpd xmm1, xmm2, dqword [rax] ; 0Ch +vcmpgepd xmm1, xmm2, dqword [rax] ; 0Dh +vcmpgtpd xmm1, xmm2, dqword [rax] ; 0Eh +vcmptruepd xmm1, xmm2, dqword [rax] ; 0Fh + +vcmpeq_ospd xmm1, xmm2, dqword [rax] ; 10h +vcmplt_oqpd xmm1, xmm2, dqword [rax] ; 11h +vcmple_oqpd xmm1, xmm2, dqword [rax] ; 12h +vcmpunord_spd xmm1, xmm2, dqword [rax] ; 13h +vcmpneq_uspd xmm1, xmm2, dqword [rax] ; 14h +vcmpnlt_uqpd xmm1, xmm2, dqword [rax] ; 15h +vcmpnle_uqpd xmm1, xmm2, dqword [rax] ; 16h +vcmpord_spd xmm1, xmm2, dqword [rax] ; 17h + +vcmpeq_uspd xmm1, xmm2, dqword [rax] ; 18h +vcmpnge_uqpd xmm1, xmm2, dqword [rax] ; 19h +vcmpngt_uqpd xmm1, xmm2, dqword [rax] ; 1Ah +vcmpfalse_ospd xmm1, xmm2, dqword [rax] ; 1Bh +vcmpneq_ospd xmm1, xmm2, dqword [rax] ; 1Ch +vcmpge_oqpd xmm1, xmm2, dqword [rax] ; 1Dh +vcmpgt_oqpd xmm1, xmm2, dqword [rax] ; 1Eh +vcmptrue_uspd xmm1, xmm2, dqword [rax] ; 1Fh + +vcmpeqpd ymm1, ymm2, ymm3 ; 00h +vcmpltpd ymm1, ymm2, ymm3 ; 01h +vcmplepd ymm1, ymm2, ymm3 ; 02h +vcmpunordpd ymm1, ymm2, ymm3 ; 03h +vcmpneqpd ymm1, ymm2, ymm3 ; 04h +vcmpnltpd ymm1, ymm2, ymm3 ; 05h +vcmpnlepd ymm1, ymm2, ymm3 ; 06h +vcmpordpd ymm1, ymm2, ymm3 ; 07h + +vcmpeq_uqpd ymm1, ymm2, ymm3 ; 08h +vcmpngepd ymm1, ymm2, ymm3 ; 09h +vcmpngtpd ymm1, ymm2, ymm3 ; 0Ah +vcmpfalsepd ymm1, ymm2, ymm3 ; 0Bh +vcmpneq_oqpd ymm1, ymm2, ymm3 ; 0Ch +vcmpgepd ymm1, ymm2, ymm3 ; 0Dh +vcmpgtpd ymm1, ymm2, ymm3 ; 0Eh +vcmptruepd ymm1, ymm2, ymm3 ; 0Fh + +vcmpeq_ospd ymm1, ymm2, ymm3 ; 10h +vcmplt_oqpd ymm1, ymm2, ymm3 ; 11h +vcmple_oqpd ymm1, ymm2, ymm3 ; 12h +vcmpunord_spd ymm1, ymm2, ymm3 ; 13h +vcmpneq_uspd ymm1, ymm2, ymm3 ; 14h +vcmpnlt_uqpd ymm1, ymm2, ymm3 ; 15h +vcmpnle_uqpd ymm1, ymm2, ymm3 ; 16h +vcmpord_spd ymm1, ymm2, ymm3 ; 17h + +vcmpeq_uspd ymm1, ymm2, ymm3 ; 18h +vcmpnge_uqpd ymm1, ymm2, ymm3 ; 19h +vcmpngt_uqpd ymm1, ymm2, ymm3 ; 1Ah +vcmpfalse_ospd ymm1, ymm2, ymm3 ; 1Bh +vcmpneq_ospd ymm1, ymm2, ymm3 ; 1Ch +vcmpge_oqpd ymm1, ymm2, ymm3 ; 1Dh +vcmpgt_oqpd ymm1, ymm2, ymm3 ; 1Eh +vcmptrue_uspd ymm1, ymm2, ymm3 ; 1Fh + +vcmpeqpd ymm1, ymm2, [rax] ; 00h +vcmpltpd ymm1, ymm2, [rax] ; 01h +vcmplepd ymm1, ymm2, [rax] ; 02h +vcmpunordpd ymm1, ymm2, [rax] ; 03h +vcmpneqpd ymm1, ymm2, [rax] ; 04h +vcmpnltpd ymm1, ymm2, [rax] ; 05h +vcmpnlepd ymm1, ymm2, [rax] ; 06h +vcmpordpd ymm1, ymm2, [rax] ; 07h + +vcmpeq_uqpd ymm1, ymm2, [rax] ; 08h +vcmpngepd ymm1, ymm2, [rax] ; 09h +vcmpngtpd ymm1, ymm2, [rax] ; 0Ah +vcmpfalsepd ymm1, ymm2, [rax] ; 0Bh +vcmpneq_oqpd ymm1, ymm2, [rax] ; 0Ch +vcmpgepd ymm1, ymm2, [rax] ; 0Dh +vcmpgtpd ymm1, ymm2, [rax] ; 0Eh +vcmptruepd ymm1, ymm2, [rax] ; 0Fh + +vcmpeq_ospd ymm1, ymm2, [rax] ; 10h +vcmplt_oqpd ymm1, ymm2, [rax] ; 11h +vcmple_oqpd ymm1, ymm2, [rax] ; 12h +vcmpunord_spd ymm1, ymm2, [rax] ; 13h +vcmpneq_uspd ymm1, ymm2, [rax] ; 14h +vcmpnlt_uqpd ymm1, ymm2, [rax] ; 15h +vcmpnle_uqpd ymm1, ymm2, [rax] ; 16h +vcmpord_spd ymm1, ymm2, [rax] ; 17h + +vcmpeq_uspd ymm1, ymm2, [rax] ; 18h +vcmpnge_uqpd ymm1, ymm2, [rax] ; 19h +vcmpngt_uqpd ymm1, ymm2, [rax] ; 1Ah +vcmpfalse_ospd ymm1, ymm2, [rax] ; 1Bh +vcmpneq_ospd ymm1, ymm2, [rax] ; 1Ch +vcmpge_oqpd ymm1, ymm2, [rax] ; 1Dh +vcmpgt_oqpd ymm1, ymm2, [rax] ; 1Eh +vcmptrue_uspd ymm1, ymm2, [rax] ; 1Fh + +vcmpeqpd ymm1, ymm2, yword [rax] ; 00h +vcmpltpd ymm1, ymm2, yword [rax] ; 01h +vcmplepd ymm1, ymm2, yword [rax] ; 02h +vcmpunordpd ymm1, ymm2, yword [rax] ; 03h +vcmpneqpd ymm1, ymm2, yword [rax] ; 04h +vcmpnltpd ymm1, ymm2, yword [rax] ; 05h +vcmpnlepd ymm1, ymm2, yword [rax] ; 06h +vcmpordpd ymm1, ymm2, yword [rax] ; 07h + +vcmpeq_uqpd ymm1, ymm2, yword [rax] ; 08h +vcmpngepd ymm1, ymm2, yword [rax] ; 09h +vcmpngtpd ymm1, ymm2, yword [rax] ; 0Ah +vcmpfalsepd ymm1, ymm2, yword [rax] ; 0Bh +vcmpneq_oqpd ymm1, ymm2, yword [rax] ; 0Ch +vcmpgepd ymm1, ymm2, yword [rax] ; 0Dh +vcmpgtpd ymm1, ymm2, yword [rax] ; 0Eh +vcmptruepd ymm1, ymm2, yword [rax] ; 0Fh + +vcmpeq_ospd ymm1, ymm2, yword [rax] ; 10h +vcmplt_oqpd ymm1, ymm2, yword [rax] ; 11h +vcmple_oqpd ymm1, ymm2, yword [rax] ; 12h +vcmpunord_spd ymm1, ymm2, yword [rax] ; 13h +vcmpneq_uspd ymm1, ymm2, yword [rax] ; 14h +vcmpnlt_uqpd ymm1, ymm2, yword [rax] ; 15h +vcmpnle_uqpd ymm1, ymm2, yword [rax] ; 16h +vcmpord_spd ymm1, ymm2, yword [rax] ; 17h + +vcmpeq_uspd ymm1, ymm2, yword [rax] ; 18h +vcmpnge_uqpd ymm1, ymm2, yword [rax] ; 19h +vcmpngt_uqpd ymm1, ymm2, yword [rax] ; 1Ah +vcmpfalse_ospd ymm1, ymm2, yword [rax] ; 1Bh +vcmpneq_ospd ymm1, ymm2, yword [rax] ; 1Ch +vcmpge_oqpd ymm1, ymm2, yword [rax] ; 1Dh +vcmpgt_oqpd ymm1, ymm2, yword [rax] ; 1Eh +vcmptrue_uspd ymm1, ymm2, yword [rax] ; 1Fh + +;----------------------------------------------------------------------------- + +cmpeqps xmm1, xmm2 ; 00h +cmpltps xmm1, xmm2 ; 01h +cmpleps xmm1, xmm2 ; 02h +cmpunordps xmm1, xmm2 ; 03h +cmpneqps xmm1, xmm2 ; 04h +cmpnltps xmm1, xmm2 ; 05h +cmpnleps xmm1, xmm2 ; 06h +cmpordps xmm1, xmm2 ; 07h + +vcmpeqps xmm1, xmm2 ; 00h +vcmpltps xmm1, xmm2 ; 01h +vcmpleps xmm1, xmm2 ; 02h +vcmpunordps xmm1, xmm2 ; 03h +vcmpneqps xmm1, xmm2 ; 04h +vcmpnltps xmm1, xmm2 ; 05h +vcmpnleps xmm1, xmm2 ; 06h +vcmpordps xmm1, xmm2 ; 07h + +vcmpeqps xmm1, xmm2, xmm3 ; 00h +vcmpltps xmm1, xmm2, xmm3 ; 01h +vcmpleps xmm1, xmm2, xmm3 ; 02h +vcmpunordps xmm1, xmm2, xmm3 ; 03h +vcmpneqps xmm1, xmm2, xmm3 ; 04h +vcmpnltps xmm1, xmm2, xmm3 ; 05h +vcmpnleps xmm1, xmm2, xmm3 ; 06h +vcmpordps xmm1, xmm2, xmm3 ; 07h + +vcmpeq_uqps xmm1, xmm2, xmm3 ; 08h +vcmpngeps xmm1, xmm2, xmm3 ; 09h +vcmpngtps xmm1, xmm2, xmm3 ; 0Ah +vcmpfalseps xmm1, xmm2, xmm3 ; 0Bh +vcmpneq_oqps xmm1, xmm2, xmm3 ; 0Ch +vcmpgeps xmm1, xmm2, xmm3 ; 0Dh +vcmpgtps xmm1, xmm2, xmm3 ; 0Eh +vcmptrueps xmm1, xmm2, xmm3 ; 0Fh + +vcmpeq_osps xmm1, xmm2, xmm3 ; 10h +vcmplt_oqps xmm1, xmm2, xmm3 ; 11h +vcmple_oqps xmm1, xmm2, xmm3 ; 12h +vcmpunord_sps xmm1, xmm2, xmm3 ; 13h +vcmpneq_usps xmm1, xmm2, xmm3 ; 14h +vcmpnlt_uqps xmm1, xmm2, xmm3 ; 15h +vcmpnle_uqps xmm1, xmm2, xmm3 ; 16h +vcmpord_sps xmm1, xmm2, xmm3 ; 17h + +vcmpeq_usps xmm1, xmm2, xmm3 ; 18h +vcmpnge_uqps xmm1, xmm2, xmm3 ; 19h +vcmpngt_uqps xmm1, xmm2, xmm3 ; 1Ah +vcmpfalse_osps xmm1, xmm2, xmm3 ; 1Bh +vcmpneq_osps xmm1, xmm2, xmm3 ; 1Ch +vcmpge_oqps xmm1, xmm2, xmm3 ; 1Dh +vcmpgt_oqps xmm1, xmm2, xmm3 ; 1Eh +vcmptrue_usps xmm1, xmm2, xmm3 ; 1Fh + +cmpeqps xmm1, [rax] ; 00h +cmpltps xmm1, [rax] ; 01h +cmpleps xmm1, [rax] ; 02h +cmpunordps xmm1, [rax] ; 03h +cmpneqps xmm1, [rax] ; 04h +cmpnltps xmm1, [rax] ; 05h +cmpnleps xmm1, [rax] ; 06h +cmpordps xmm1, [rax] ; 07h + +vcmpeqps xmm1, [rax] ; 00h +vcmpltps xmm1, [rax] ; 01h +vcmpleps xmm1, [rax] ; 02h +vcmpunordps xmm1, [rax] ; 03h +vcmpneqps xmm1, [rax] ; 04h +vcmpnltps xmm1, [rax] ; 05h +vcmpnleps xmm1, [rax] ; 06h +vcmpordps xmm1, [rax] ; 07h + +vcmpeqps xmm1, xmm2, [rax] ; 00h +vcmpltps xmm1, xmm2, [rax] ; 01h +vcmpleps xmm1, xmm2, [rax] ; 02h +vcmpunordps xmm1, xmm2, [rax] ; 03h +vcmpneqps xmm1, xmm2, [rax] ; 04h +vcmpnltps xmm1, xmm2, [rax] ; 05h +vcmpnleps xmm1, xmm2, [rax] ; 06h +vcmpordps xmm1, xmm2, [rax] ; 07h + +vcmpeq_uqps xmm1, xmm2, [rax] ; 08h +vcmpngeps xmm1, xmm2, [rax] ; 09h +vcmpngtps xmm1, xmm2, [rax] ; 0Ah +vcmpfalseps xmm1, xmm2, [rax] ; 0Bh +vcmpneq_oqps xmm1, xmm2, [rax] ; 0Ch +vcmpgeps xmm1, xmm2, [rax] ; 0Dh +vcmpgtps xmm1, xmm2, [rax] ; 0Eh +vcmptrueps xmm1, xmm2, [rax] ; 0Fh + +vcmpeq_osps xmm1, xmm2, [rax] ; 10h +vcmplt_oqps xmm1, xmm2, [rax] ; 11h +vcmple_oqps xmm1, xmm2, [rax] ; 12h +vcmpunord_sps xmm1, xmm2, [rax] ; 13h +vcmpneq_usps xmm1, xmm2, [rax] ; 14h +vcmpnlt_uqps xmm1, xmm2, [rax] ; 15h +vcmpnle_uqps xmm1, xmm2, [rax] ; 16h +vcmpord_sps xmm1, xmm2, [rax] ; 17h + +vcmpeq_usps xmm1, xmm2, [rax] ; 18h +vcmpnge_uqps xmm1, xmm2, [rax] ; 19h +vcmpngt_uqps xmm1, xmm2, [rax] ; 1Ah +vcmpfalse_osps xmm1, xmm2, [rax] ; 1Bh +vcmpneq_osps xmm1, xmm2, [rax] ; 1Ch +vcmpge_oqps xmm1, xmm2, [rax] ; 1Dh +vcmpgt_oqps xmm1, xmm2, [rax] ; 1Eh +vcmptrue_usps xmm1, xmm2, [rax] ; 1Fh + +cmpeqps xmm1, dqword [rax] ; 00h +cmpltps xmm1, dqword [rax] ; 01h +cmpleps xmm1, dqword [rax] ; 02h +cmpunordps xmm1, dqword [rax] ; 03h +cmpneqps xmm1, dqword [rax] ; 04h +cmpnltps xmm1, dqword [rax] ; 05h +cmpnleps xmm1, dqword [rax] ; 06h +cmpordps xmm1, dqword [rax] ; 07h + +vcmpeqps xmm1, dqword [rax] ; 00h +vcmpltps xmm1, dqword [rax] ; 01h +vcmpleps xmm1, dqword [rax] ; 02h +vcmpunordps xmm1, dqword [rax] ; 03h +vcmpneqps xmm1, dqword [rax] ; 04h +vcmpnltps xmm1, dqword [rax] ; 05h +vcmpnleps xmm1, dqword [rax] ; 06h +vcmpordps xmm1, dqword [rax] ; 07h + +vcmpeqps xmm1, xmm2, dqword [rax] ; 00h +vcmpltps xmm1, xmm2, dqword [rax] ; 01h +vcmpleps xmm1, xmm2, dqword [rax] ; 02h +vcmpunordps xmm1, xmm2, dqword [rax] ; 03h +vcmpneqps xmm1, xmm2, dqword [rax] ; 04h +vcmpnltps xmm1, xmm2, dqword [rax] ; 05h +vcmpnleps xmm1, xmm2, dqword [rax] ; 06h +vcmpordps xmm1, xmm2, dqword [rax] ; 07h + +vcmpeq_uqps xmm1, xmm2, dqword [rax] ; 08h +vcmpngeps xmm1, xmm2, dqword [rax] ; 09h +vcmpngtps xmm1, xmm2, dqword [rax] ; 0Ah +vcmpfalseps xmm1, xmm2, dqword [rax] ; 0Bh +vcmpneq_oqps xmm1, xmm2, dqword [rax] ; 0Ch +vcmpgeps xmm1, xmm2, dqword [rax] ; 0Dh +vcmpgtps xmm1, xmm2, dqword [rax] ; 0Eh +vcmptrueps xmm1, xmm2, dqword [rax] ; 0Fh + +vcmpeq_osps xmm1, xmm2, dqword [rax] ; 10h +vcmplt_oqps xmm1, xmm2, dqword [rax] ; 11h +vcmple_oqps xmm1, xmm2, dqword [rax] ; 12h +vcmpunord_sps xmm1, xmm2, dqword [rax] ; 13h +vcmpneq_usps xmm1, xmm2, dqword [rax] ; 14h +vcmpnlt_uqps xmm1, xmm2, dqword [rax] ; 15h +vcmpnle_uqps xmm1, xmm2, dqword [rax] ; 16h +vcmpord_sps xmm1, xmm2, dqword [rax] ; 17h + +vcmpeq_usps xmm1, xmm2, dqword [rax] ; 18h +vcmpnge_uqps xmm1, xmm2, dqword [rax] ; 19h +vcmpngt_uqps xmm1, xmm2, dqword [rax] ; 1Ah +vcmpfalse_osps xmm1, xmm2, dqword [rax] ; 1Bh +vcmpneq_osps xmm1, xmm2, dqword [rax] ; 1Ch +vcmpge_oqps xmm1, xmm2, dqword [rax] ; 1Dh +vcmpgt_oqps xmm1, xmm2, dqword [rax] ; 1Eh +vcmptrue_usps xmm1, xmm2, dqword [rax] ; 1Fh + +vcmpeqps ymm1, ymm2, ymm3 ; 00h +vcmpltps ymm1, ymm2, ymm3 ; 01h +vcmpleps ymm1, ymm2, ymm3 ; 02h +vcmpunordps ymm1, ymm2, ymm3 ; 03h +vcmpneqps ymm1, ymm2, ymm3 ; 04h +vcmpnltps ymm1, ymm2, ymm3 ; 05h +vcmpnleps ymm1, ymm2, ymm3 ; 06h +vcmpordps ymm1, ymm2, ymm3 ; 07h + +vcmpeq_uqps ymm1, ymm2, ymm3 ; 08h +vcmpngeps ymm1, ymm2, ymm3 ; 09h +vcmpngtps ymm1, ymm2, ymm3 ; 0Ah +vcmpfalseps ymm1, ymm2, ymm3 ; 0Bh +vcmpneq_oqps ymm1, ymm2, ymm3 ; 0Ch +vcmpgeps ymm1, ymm2, ymm3 ; 0Dh +vcmpgtps ymm1, ymm2, ymm3 ; 0Eh +vcmptrueps ymm1, ymm2, ymm3 ; 0Fh + +vcmpeq_osps ymm1, ymm2, ymm3 ; 10h +vcmplt_oqps ymm1, ymm2, ymm3 ; 11h +vcmple_oqps ymm1, ymm2, ymm3 ; 12h +vcmpunord_sps ymm1, ymm2, ymm3 ; 13h +vcmpneq_usps ymm1, ymm2, ymm3 ; 14h +vcmpnlt_uqps ymm1, ymm2, ymm3 ; 15h +vcmpnle_uqps ymm1, ymm2, ymm3 ; 16h +vcmpord_sps ymm1, ymm2, ymm3 ; 17h + +vcmpeq_usps ymm1, ymm2, ymm3 ; 18h +vcmpnge_uqps ymm1, ymm2, ymm3 ; 19h +vcmpngt_uqps ymm1, ymm2, ymm3 ; 1Ah +vcmpfalse_osps ymm1, ymm2, ymm3 ; 1Bh +vcmpneq_osps ymm1, ymm2, ymm3 ; 1Ch +vcmpge_oqps ymm1, ymm2, ymm3 ; 1Dh +vcmpgt_oqps ymm1, ymm2, ymm3 ; 1Eh +vcmptrue_usps ymm1, ymm2, ymm3 ; 1Fh + +vcmpeqps ymm1, ymm2, [rax] ; 00h +vcmpltps ymm1, ymm2, [rax] ; 01h +vcmpleps ymm1, ymm2, [rax] ; 02h +vcmpunordps ymm1, ymm2, [rax] ; 03h +vcmpneqps ymm1, ymm2, [rax] ; 04h +vcmpnltps ymm1, ymm2, [rax] ; 05h +vcmpnleps ymm1, ymm2, [rax] ; 06h +vcmpordps ymm1, ymm2, [rax] ; 07h + +vcmpeq_uqps ymm1, ymm2, [rax] ; 08h +vcmpngeps ymm1, ymm2, [rax] ; 09h +vcmpngtps ymm1, ymm2, [rax] ; 0Ah +vcmpfalseps ymm1, ymm2, [rax] ; 0Bh +vcmpneq_oqps ymm1, ymm2, [rax] ; 0Ch +vcmpgeps ymm1, ymm2, [rax] ; 0Dh +vcmpgtps ymm1, ymm2, [rax] ; 0Eh +vcmptrueps ymm1, ymm2, [rax] ; 0Fh + +vcmpeq_osps ymm1, ymm2, [rax] ; 10h +vcmplt_oqps ymm1, ymm2, [rax] ; 11h +vcmple_oqps ymm1, ymm2, [rax] ; 12h +vcmpunord_sps ymm1, ymm2, [rax] ; 13h +vcmpneq_usps ymm1, ymm2, [rax] ; 14h +vcmpnlt_uqps ymm1, ymm2, [rax] ; 15h +vcmpnle_uqps ymm1, ymm2, [rax] ; 16h +vcmpord_sps ymm1, ymm2, [rax] ; 17h + +vcmpeq_usps ymm1, ymm2, [rax] ; 18h +vcmpnge_uqps ymm1, ymm2, [rax] ; 19h +vcmpngt_uqps ymm1, ymm2, [rax] ; 1Ah +vcmpfalse_osps ymm1, ymm2, [rax] ; 1Bh +vcmpneq_osps ymm1, ymm2, [rax] ; 1Ch +vcmpge_oqps ymm1, ymm2, [rax] ; 1Dh +vcmpgt_oqps ymm1, ymm2, [rax] ; 1Eh +vcmptrue_usps ymm1, ymm2, [rax] ; 1Fh + +vcmpeqps ymm1, ymm2, yword [rax] ; 00h +vcmpltps ymm1, ymm2, yword [rax] ; 01h +vcmpleps ymm1, ymm2, yword [rax] ; 02h +vcmpunordps ymm1, ymm2, yword [rax] ; 03h +vcmpneqps ymm1, ymm2, yword [rax] ; 04h +vcmpnltps ymm1, ymm2, yword [rax] ; 05h +vcmpnleps ymm1, ymm2, yword [rax] ; 06h +vcmpordps ymm1, ymm2, yword [rax] ; 07h + +vcmpeq_uqps ymm1, ymm2, yword [rax] ; 08h +vcmpngeps ymm1, ymm2, yword [rax] ; 09h +vcmpngtps ymm1, ymm2, yword [rax] ; 0Ah +vcmpfalseps ymm1, ymm2, yword [rax] ; 0Bh +vcmpneq_oqps ymm1, ymm2, yword [rax] ; 0Ch +vcmpgeps ymm1, ymm2, yword [rax] ; 0Dh +vcmpgtps ymm1, ymm2, yword [rax] ; 0Eh +vcmptrueps ymm1, ymm2, yword [rax] ; 0Fh + +vcmpeq_osps ymm1, ymm2, yword [rax] ; 10h +vcmplt_oqps ymm1, ymm2, yword [rax] ; 11h +vcmple_oqps ymm1, ymm2, yword [rax] ; 12h +vcmpunord_sps ymm1, ymm2, yword [rax] ; 13h +vcmpneq_usps ymm1, ymm2, yword [rax] ; 14h +vcmpnlt_uqps ymm1, ymm2, yword [rax] ; 15h +vcmpnle_uqps ymm1, ymm2, yword [rax] ; 16h +vcmpord_sps ymm1, ymm2, yword [rax] ; 17h + +vcmpeq_usps ymm1, ymm2, yword [rax] ; 18h +vcmpnge_uqps ymm1, ymm2, yword [rax] ; 19h +vcmpngt_uqps ymm1, ymm2, yword [rax] ; 1Ah +vcmpfalse_osps ymm1, ymm2, yword [rax] ; 1Bh +vcmpneq_osps ymm1, ymm2, yword [rax] ; 1Ch +vcmpge_oqps ymm1, ymm2, yword [rax] ; 1Dh +vcmpgt_oqps ymm1, ymm2, yword [rax] ; 1Eh +vcmptrue_usps ymm1, ymm2, yword [rax] ; 1Fh + +;----------------------------------------------------------------------------- + +cmpeqsd xmm1, xmm2 ; 00h +cmpltsd xmm1, xmm2 ; 01h +cmplesd xmm1, xmm2 ; 02h +cmpunordsd xmm1, xmm2 ; 03h +cmpneqsd xmm1, xmm2 ; 04h +cmpnltsd xmm1, xmm2 ; 05h +cmpnlesd xmm1, xmm2 ; 06h +cmpordsd xmm1, xmm2 ; 07h + +vcmpeqsd xmm1, xmm2 ; 00h +vcmpltsd xmm1, xmm2 ; 01h +vcmplesd xmm1, xmm2 ; 02h +vcmpunordsd xmm1, xmm2 ; 03h +vcmpneqsd xmm1, xmm2 ; 04h +vcmpnltsd xmm1, xmm2 ; 05h +vcmpnlesd xmm1, xmm2 ; 06h +vcmpordsd xmm1, xmm2 ; 07h + +vcmpeqsd xmm1, xmm2, xmm3 ; 00h +vcmpltsd xmm1, xmm2, xmm3 ; 01h +vcmplesd xmm1, xmm2, xmm3 ; 02h +vcmpunordsd xmm1, xmm2, xmm3 ; 03h +vcmpneqsd xmm1, xmm2, xmm3 ; 04h +vcmpnltsd xmm1, xmm2, xmm3 ; 05h +vcmpnlesd xmm1, xmm2, xmm3 ; 06h +vcmpordsd xmm1, xmm2, xmm3 ; 07h + +vcmpeq_uqsd xmm1, xmm2, xmm3 ; 08h +vcmpngesd xmm1, xmm2, xmm3 ; 09h +vcmpngtsd xmm1, xmm2, xmm3 ; 0Ah +vcmpfalsesd xmm1, xmm2, xmm3 ; 0Bh +vcmpneq_oqsd xmm1, xmm2, xmm3 ; 0Ch +vcmpgesd xmm1, xmm2, xmm3 ; 0Dh +vcmpgtsd xmm1, xmm2, xmm3 ; 0Eh +vcmptruesd xmm1, xmm2, xmm3 ; 0Fh + +vcmpeq_ossd xmm1, xmm2, xmm3 ; 10h +vcmplt_oqsd xmm1, xmm2, xmm3 ; 11h +vcmple_oqsd xmm1, xmm2, xmm3 ; 12h +vcmpunord_ssd xmm1, xmm2, xmm3 ; 13h +vcmpneq_ussd xmm1, xmm2, xmm3 ; 14h +vcmpnlt_uqsd xmm1, xmm2, xmm3 ; 15h +vcmpnle_uqsd xmm1, xmm2, xmm3 ; 16h +vcmpord_ssd xmm1, xmm2, xmm3 ; 17h + +vcmpeq_ussd xmm1, xmm2, xmm3 ; 18h +vcmpnge_uqsd xmm1, xmm2, xmm3 ; 19h +vcmpngt_uqsd xmm1, xmm2, xmm3 ; 1Ah +vcmpfalse_ossd xmm1, xmm2, xmm3 ; 1Bh +vcmpneq_ossd xmm1, xmm2, xmm3 ; 1Ch +vcmpge_oqsd xmm1, xmm2, xmm3 ; 1Dh +vcmpgt_oqsd xmm1, xmm2, xmm3 ; 1Eh +vcmptrue_ussd xmm1, xmm2, xmm3 ; 1Fh + +cmpeqsd xmm1, [rax] ; 00h +cmpltsd xmm1, [rax] ; 01h +cmplesd xmm1, [rax] ; 02h +cmpunordsd xmm1, [rax] ; 03h +cmpneqsd xmm1, [rax] ; 04h +cmpnltsd xmm1, [rax] ; 05h +cmpnlesd xmm1, [rax] ; 06h +cmpordsd xmm1, [rax] ; 07h + +vcmpeqsd xmm1, [rax] ; 00h +vcmpltsd xmm1, [rax] ; 01h +vcmplesd xmm1, [rax] ; 02h +vcmpunordsd xmm1, [rax] ; 03h +vcmpneqsd xmm1, [rax] ; 04h +vcmpnltsd xmm1, [rax] ; 05h +vcmpnlesd xmm1, [rax] ; 06h +vcmpordsd xmm1, [rax] ; 07h + +vcmpeqsd xmm1, xmm2, [rax] ; 00h +vcmpltsd xmm1, xmm2, [rax] ; 01h +vcmplesd xmm1, xmm2, [rax] ; 02h +vcmpunordsd xmm1, xmm2, [rax] ; 03h +vcmpneqsd xmm1, xmm2, [rax] ; 04h +vcmpnltsd xmm1, xmm2, [rax] ; 05h +vcmpnlesd xmm1, xmm2, [rax] ; 06h +vcmpordsd xmm1, xmm2, [rax] ; 07h + +vcmpeq_uqsd xmm1, xmm2, [rax] ; 08h +vcmpngesd xmm1, xmm2, [rax] ; 09h +vcmpngtsd xmm1, xmm2, [rax] ; 0Ah +vcmpfalsesd xmm1, xmm2, [rax] ; 0Bh +vcmpneq_oqsd xmm1, xmm2, [rax] ; 0Ch +vcmpgesd xmm1, xmm2, [rax] ; 0Dh +vcmpgtsd xmm1, xmm2, [rax] ; 0Eh +vcmptruesd xmm1, xmm2, [rax] ; 0Fh + +vcmpeq_ossd xmm1, xmm2, [rax] ; 10h +vcmplt_oqsd xmm1, xmm2, [rax] ; 11h +vcmple_oqsd xmm1, xmm2, [rax] ; 12h +vcmpunord_ssd xmm1, xmm2, [rax] ; 13h +vcmpneq_ussd xmm1, xmm2, [rax] ; 14h +vcmpnlt_uqsd xmm1, xmm2, [rax] ; 15h +vcmpnle_uqsd xmm1, xmm2, [rax] ; 16h +vcmpord_ssd xmm1, xmm2, [rax] ; 17h + +vcmpeq_ussd xmm1, xmm2, [rax] ; 18h +vcmpnge_uqsd xmm1, xmm2, [rax] ; 19h +vcmpngt_uqsd xmm1, xmm2, [rax] ; 1Ah +vcmpfalse_ossd xmm1, xmm2, [rax] ; 1Bh +vcmpneq_ossd xmm1, xmm2, [rax] ; 1Ch +vcmpge_oqsd xmm1, xmm2, [rax] ; 1Dh +vcmpgt_oqsd xmm1, xmm2, [rax] ; 1Eh +vcmptrue_ussd xmm1, xmm2, [rax] ; 1Fh + +cmpeqsd xmm1, qword [rax] ; 00h +cmpltsd xmm1, qword [rax] ; 01h +cmplesd xmm1, qword [rax] ; 02h +cmpunordsd xmm1, qword [rax] ; 03h +cmpneqsd xmm1, qword [rax] ; 04h +cmpnltsd xmm1, qword [rax] ; 05h +cmpnlesd xmm1, qword [rax] ; 06h +cmpordsd xmm1, qword [rax] ; 07h + +vcmpeqsd xmm1, qword [rax] ; 00h +vcmpltsd xmm1, qword [rax] ; 01h +vcmplesd xmm1, qword [rax] ; 02h +vcmpunordsd xmm1, qword [rax] ; 03h +vcmpneqsd xmm1, qword [rax] ; 04h +vcmpnltsd xmm1, qword [rax] ; 05h +vcmpnlesd xmm1, qword [rax] ; 06h +vcmpordsd xmm1, qword [rax] ; 07h + +vcmpeqsd xmm1, xmm2, qword [rax] ; 00h +vcmpltsd xmm1, xmm2, qword [rax] ; 01h +vcmplesd xmm1, xmm2, qword [rax] ; 02h +vcmpunordsd xmm1, xmm2, qword [rax] ; 03h +vcmpneqsd xmm1, xmm2, qword [rax] ; 04h +vcmpnltsd xmm1, xmm2, qword [rax] ; 05h +vcmpnlesd xmm1, xmm2, qword [rax] ; 06h +vcmpordsd xmm1, xmm2, qword [rax] ; 07h + +vcmpeq_uqsd xmm1, xmm2, qword [rax] ; 08h +vcmpngesd xmm1, xmm2, qword [rax] ; 09h +vcmpngtsd xmm1, xmm2, qword [rax] ; 0Ah +vcmpfalsesd xmm1, xmm2, qword [rax] ; 0Bh +vcmpneq_oqsd xmm1, xmm2, qword [rax] ; 0Ch +vcmpgesd xmm1, xmm2, qword [rax] ; 0Dh +vcmpgtsd xmm1, xmm2, qword [rax] ; 0Eh +vcmptruesd xmm1, xmm2, qword [rax] ; 0Fh + +vcmpeq_ossd xmm1, xmm2, qword [rax] ; 10h +vcmplt_oqsd xmm1, xmm2, qword [rax] ; 11h +vcmple_oqsd xmm1, xmm2, qword [rax] ; 12h +vcmpunord_ssd xmm1, xmm2, qword [rax] ; 13h +vcmpneq_ussd xmm1, xmm2, qword [rax] ; 14h +vcmpnlt_uqsd xmm1, xmm2, qword [rax] ; 15h +vcmpnle_uqsd xmm1, xmm2, qword [rax] ; 16h +vcmpord_ssd xmm1, xmm2, qword [rax] ; 17h + +vcmpeq_ussd xmm1, xmm2, qword [rax] ; 18h +vcmpnge_uqsd xmm1, xmm2, qword [rax] ; 19h +vcmpngt_uqsd xmm1, xmm2, qword [rax] ; 1Ah +vcmpfalse_ossd xmm1, xmm2, qword [rax] ; 1Bh +vcmpneq_ossd xmm1, xmm2, qword [rax] ; 1Ch +vcmpge_oqsd xmm1, xmm2, qword [rax] ; 1Dh +vcmpgt_oqsd xmm1, xmm2, qword [rax] ; 1Eh +vcmptrue_ussd xmm1, xmm2, qword [rax] ; 1Fh + +;----------------------------------------------------------------------------- + +cmpeqss xmm1, xmm2 ; 00h +cmpltss xmm1, xmm2 ; 01h +cmpless xmm1, xmm2 ; 02h +cmpunordss xmm1, xmm2 ; 03h +cmpneqss xmm1, xmm2 ; 04h +cmpnltss xmm1, xmm2 ; 05h +cmpnless xmm1, xmm2 ; 06h +cmpordss xmm1, xmm2 ; 07h + +vcmpeqss xmm1, xmm2 ; 00h +vcmpltss xmm1, xmm2 ; 01h +vcmpless xmm1, xmm2 ; 02h +vcmpunordss xmm1, xmm2 ; 03h +vcmpneqss xmm1, xmm2 ; 04h +vcmpnltss xmm1, xmm2 ; 05h +vcmpnless xmm1, xmm2 ; 06h +vcmpordss xmm1, xmm2 ; 07h + +vcmpeqss xmm1, xmm2, xmm3 ; 00h +vcmpltss xmm1, xmm2, xmm3 ; 01h +vcmpless xmm1, xmm2, xmm3 ; 02h +vcmpunordss xmm1, xmm2, xmm3 ; 03h +vcmpneqss xmm1, xmm2, xmm3 ; 04h +vcmpnltss xmm1, xmm2, xmm3 ; 05h +vcmpnless xmm1, xmm2, xmm3 ; 06h +vcmpordss xmm1, xmm2, xmm3 ; 07h + +vcmpeq_uqss xmm1, xmm2, xmm3 ; 08h +vcmpngess xmm1, xmm2, xmm3 ; 09h +vcmpngtss xmm1, xmm2, xmm3 ; 0Ah +vcmpfalsess xmm1, xmm2, xmm3 ; 0Bh +vcmpneq_oqss xmm1, xmm2, xmm3 ; 0Ch +vcmpgess xmm1, xmm2, xmm3 ; 0Dh +vcmpgtss xmm1, xmm2, xmm3 ; 0Eh +vcmptruess xmm1, xmm2, xmm3 ; 0Fh + +vcmpeq_osss xmm1, xmm2, xmm3 ; 10h +vcmplt_oqss xmm1, xmm2, xmm3 ; 11h +vcmple_oqss xmm1, xmm2, xmm3 ; 12h +vcmpunord_sss xmm1, xmm2, xmm3 ; 13h +vcmpneq_usss xmm1, xmm2, xmm3 ; 14h +vcmpnlt_uqss xmm1, xmm2, xmm3 ; 15h +vcmpnle_uqss xmm1, xmm2, xmm3 ; 16h +vcmpord_sss xmm1, xmm2, xmm3 ; 17h + +vcmpeq_usss xmm1, xmm2, xmm3 ; 18h +vcmpnge_uqss xmm1, xmm2, xmm3 ; 19h +vcmpngt_uqss xmm1, xmm2, xmm3 ; 1Ah +vcmpfalse_osss xmm1, xmm2, xmm3 ; 1Bh +vcmpneq_osss xmm1, xmm2, xmm3 ; 1Ch +vcmpge_oqss xmm1, xmm2, xmm3 ; 1Dh +vcmpgt_oqss xmm1, xmm2, xmm3 ; 1Eh +vcmptrue_usss xmm1, xmm2, xmm3 ; 1Fh + +cmpeqss xmm1, [rax] ; 00h +cmpltss xmm1, [rax] ; 01h +cmpless xmm1, [rax] ; 02h +cmpunordss xmm1, [rax] ; 03h +cmpneqss xmm1, [rax] ; 04h +cmpnltss xmm1, [rax] ; 05h +cmpnless xmm1, [rax] ; 06h +cmpordss xmm1, [rax] ; 07h + +vcmpeqss xmm1, [rax] ; 00h +vcmpltss xmm1, [rax] ; 01h +vcmpless xmm1, [rax] ; 02h +vcmpunordss xmm1, [rax] ; 03h +vcmpneqss xmm1, [rax] ; 04h +vcmpnltss xmm1, [rax] ; 05h +vcmpnless xmm1, [rax] ; 06h +vcmpordss xmm1, [rax] ; 07h + +vcmpeqss xmm1, xmm2, [rax] ; 00h +vcmpltss xmm1, xmm2, [rax] ; 01h +vcmpless xmm1, xmm2, [rax] ; 02h +vcmpunordss xmm1, xmm2, [rax] ; 03h +vcmpneqss xmm1, xmm2, [rax] ; 04h +vcmpnltss xmm1, xmm2, [rax] ; 05h +vcmpnless xmm1, xmm2, [rax] ; 06h +vcmpordss xmm1, xmm2, [rax] ; 07h + +vcmpeq_uqss xmm1, xmm2, [rax] ; 08h +vcmpngess xmm1, xmm2, [rax] ; 09h +vcmpngtss xmm1, xmm2, [rax] ; 0Ah +vcmpfalsess xmm1, xmm2, [rax] ; 0Bh +vcmpneq_oqss xmm1, xmm2, [rax] ; 0Ch +vcmpgess xmm1, xmm2, [rax] ; 0Dh +vcmpgtss xmm1, xmm2, [rax] ; 0Eh +vcmptruess xmm1, xmm2, [rax] ; 0Fh + +vcmpeq_osss xmm1, xmm2, [rax] ; 10h +vcmplt_oqss xmm1, xmm2, [rax] ; 11h +vcmple_oqss xmm1, xmm2, [rax] ; 12h +vcmpunord_sss xmm1, xmm2, [rax] ; 13h +vcmpneq_usss xmm1, xmm2, [rax] ; 14h +vcmpnlt_uqss xmm1, xmm2, [rax] ; 15h +vcmpnle_uqss xmm1, xmm2, [rax] ; 16h +vcmpord_sss xmm1, xmm2, [rax] ; 17h + +vcmpeq_usss xmm1, xmm2, [rax] ; 18h +vcmpnge_uqss xmm1, xmm2, [rax] ; 19h +vcmpngt_uqss xmm1, xmm2, [rax] ; 1Ah +vcmpfalse_osss xmm1, xmm2, [rax] ; 1Bh +vcmpneq_osss xmm1, xmm2, [rax] ; 1Ch +vcmpge_oqss xmm1, xmm2, [rax] ; 1Dh +vcmpgt_oqss xmm1, xmm2, [rax] ; 1Eh +vcmptrue_usss xmm1, xmm2, [rax] ; 1Fh + +cmpeqss xmm1, dword [rax] ; 00h +cmpltss xmm1, dword [rax] ; 01h +cmpless xmm1, dword [rax] ; 02h +cmpunordss xmm1, dword [rax] ; 03h +cmpneqss xmm1, dword [rax] ; 04h +cmpnltss xmm1, dword [rax] ; 05h +cmpnless xmm1, dword [rax] ; 06h +cmpordss xmm1, dword [rax] ; 07h + +vcmpeqss xmm1, dword [rax] ; 00h +vcmpltss xmm1, dword [rax] ; 01h +vcmpless xmm1, dword [rax] ; 02h +vcmpunordss xmm1, dword [rax] ; 03h +vcmpneqss xmm1, dword [rax] ; 04h +vcmpnltss xmm1, dword [rax] ; 05h +vcmpnless xmm1, dword [rax] ; 06h +vcmpordss xmm1, dword [rax] ; 07h + +vcmpeqss xmm1, xmm2, dword [rax] ; 00h +vcmpltss xmm1, xmm2, dword [rax] ; 01h +vcmpless xmm1, xmm2, dword [rax] ; 02h +vcmpunordss xmm1, xmm2, dword [rax] ; 03h +vcmpneqss xmm1, xmm2, dword [rax] ; 04h +vcmpnltss xmm1, xmm2, dword [rax] ; 05h +vcmpnless xmm1, xmm2, dword [rax] ; 06h +vcmpordss xmm1, xmm2, dword [rax] ; 07h + +vcmpeq_uqss xmm1, xmm2, dword [rax] ; 08h +vcmpngess xmm1, xmm2, dword [rax] ; 09h +vcmpngtss xmm1, xmm2, dword [rax] ; 0Ah +vcmpfalsess xmm1, xmm2, dword [rax] ; 0Bh +vcmpneq_oqss xmm1, xmm2, dword [rax] ; 0Ch +vcmpgess xmm1, xmm2, dword [rax] ; 0Dh +vcmpgtss xmm1, xmm2, dword [rax] ; 0Eh +vcmptruess xmm1, xmm2, dword [rax] ; 0Fh + +vcmpeq_osss xmm1, xmm2, dword [rax] ; 10h +vcmplt_oqss xmm1, xmm2, dword [rax] ; 11h +vcmple_oqss xmm1, xmm2, dword [rax] ; 12h +vcmpunord_sss xmm1, xmm2, dword [rax] ; 13h +vcmpneq_usss xmm1, xmm2, dword [rax] ; 14h +vcmpnlt_uqss xmm1, xmm2, dword [rax] ; 15h +vcmpnle_uqss xmm1, xmm2, dword [rax] ; 16h +vcmpord_sss xmm1, xmm2, dword [rax] ; 17h + +vcmpeq_usss xmm1, xmm2, dword [rax] ; 18h +vcmpnge_uqss xmm1, xmm2, dword [rax] ; 19h +vcmpngt_uqss xmm1, xmm2, dword [rax] ; 1Ah +vcmpfalse_osss xmm1, xmm2, dword [rax] ; 1Bh +vcmpneq_osss xmm1, xmm2, dword [rax] ; 1Ch +vcmpge_oqss xmm1, xmm2, dword [rax] ; 1Dh +vcmpgt_oqss xmm1, xmm2, dword [rax] ; 1Eh +vcmptrue_usss xmm1, xmm2, dword [rax] ; 1Fh + diff --git a/modules/arch/x86/tests/avxcc.hex b/modules/arch/x86/tests/avxcc.hex new file mode 100644 index 00000000..c6ed929a --- /dev/null +++ b/modules/arch/x86/tests/avxcc.hex @@ -0,0 +1,3816 @@ +66 +0f +c2 +ca +00 +66 +0f +c2 +ca +01 +66 +0f +c2 +ca +02 +66 +0f +c2 +ca +03 +66 +0f +c2 +ca +04 +66 +0f +c2 +ca +05 +66 +0f +c2 +ca +06 +66 +0f +c2 +ca +07 +c5 +f1 +c2 +ca +00 +c5 +f1 +c2 +ca +01 +c5 +f1 +c2 +ca +02 +c5 +f1 +c2 +ca +03 +c5 +f1 +c2 +ca +04 +c5 +f1 +c2 +ca +05 +c5 +f1 +c2 +ca +06 +c5 +f1 +c2 +ca +07 +c5 +e9 +c2 +cb +00 +c5 +e9 +c2 +cb +01 +c5 +e9 +c2 +cb +02 +c5 +e9 +c2 +cb +03 +c5 +e9 +c2 +cb +04 +c5 +e9 +c2 +cb +05 +c5 +e9 +c2 +cb +06 +c5 +e9 +c2 +cb +07 +c5 +e9 +c2 +cb +08 +c5 +e9 +c2 +cb +09 +c5 +e9 +c2 +cb +0a +c5 +e9 +c2 +cb +0b +c5 +e9 +c2 +cb +0c +c5 +e9 +c2 +cb +0d +c5 +e9 +c2 +cb +0e +c5 +e9 +c2 +cb +0f +c5 +e9 +c2 +cb +10 +c5 +e9 +c2 +cb +11 +c5 +e9 +c2 +cb +12 +c5 +e9 +c2 +cb +13 +c5 +e9 +c2 +cb +14 +c5 +e9 +c2 +cb +15 +c5 +e9 +c2 +cb +16 +c5 +e9 +c2 +cb +17 +c5 +e9 +c2 +cb +18 +c5 +e9 +c2 +cb +19 +c5 +e9 +c2 +cb +1a +c5 +e9 +c2 +cb +1b +c5 +e9 +c2 +cb +1c +c5 +e9 +c2 +cb +1d +c5 +e9 +c2 +cb +1e +c5 +e9 +c2 +cb +1f +66 +0f +c2 +08 +00 +66 +0f +c2 +08 +01 +66 +0f +c2 +08 +02 +66 +0f +c2 +08 +03 +66 +0f +c2 +08 +04 +66 +0f +c2 +08 +05 +66 +0f +c2 +08 +06 +66 +0f +c2 +08 +07 +c5 +f1 +c2 +08 +00 +c5 +f1 +c2 +08 +01 +c5 +f1 +c2 +08 +02 +c5 +f1 +c2 +08 +03 +c5 +f1 +c2 +08 +04 +c5 +f1 +c2 +08 +05 +c5 +f1 +c2 +08 +06 +c5 +f1 +c2 +08 +07 +c5 +e9 +c2 +08 +00 +c5 +e9 +c2 +08 +01 +c5 +e9 +c2 +08 +02 +c5 +e9 +c2 +08 +03 +c5 +e9 +c2 +08 +04 +c5 +e9 +c2 +08 +05 +c5 +e9 +c2 +08 +06 +c5 +e9 +c2 +08 +07 +c5 +e9 +c2 +08 +08 +c5 +e9 +c2 +08 +09 +c5 +e9 +c2 +08 +0a +c5 +e9 +c2 +08 +0b +c5 +e9 +c2 +08 +0c +c5 +e9 +c2 +08 +0d +c5 +e9 +c2 +08 +0e +c5 +e9 +c2 +08 +0f +c5 +e9 +c2 +08 +10 +c5 +e9 +c2 +08 +11 +c5 +e9 +c2 +08 +12 +c5 +e9 +c2 +08 +13 +c5 +e9 +c2 +08 +14 +c5 +e9 +c2 +08 +15 +c5 +e9 +c2 +08 +16 +c5 +e9 +c2 +08 +17 +c5 +e9 +c2 +08 +18 +c5 +e9 +c2 +08 +19 +c5 +e9 +c2 +08 +1a +c5 +e9 +c2 +08 +1b +c5 +e9 +c2 +08 +1c +c5 +e9 +c2 +08 +1d +c5 +e9 +c2 +08 +1e +c5 +e9 +c2 +08 +1f +66 +0f +c2 +08 +00 +66 +0f +c2 +08 +01 +66 +0f +c2 +08 +02 +66 +0f +c2 +08 +03 +66 +0f +c2 +08 +04 +66 +0f +c2 +08 +05 +66 +0f +c2 +08 +06 +66 +0f +c2 +08 +07 +c5 +f1 +c2 +08 +00 +c5 +f1 +c2 +08 +01 +c5 +f1 +c2 +08 +02 +c5 +f1 +c2 +08 +03 +c5 +f1 +c2 +08 +04 +c5 +f1 +c2 +08 +05 +c5 +f1 +c2 +08 +06 +c5 +f1 +c2 +08 +07 +c5 +e9 +c2 +08 +00 +c5 +e9 +c2 +08 +01 +c5 +e9 +c2 +08 +02 +c5 +e9 +c2 +08 +03 +c5 +e9 +c2 +08 +04 +c5 +e9 +c2 +08 +05 +c5 +e9 +c2 +08 +06 +c5 +e9 +c2 +08 +07 +c5 +e9 +c2 +08 +08 +c5 +e9 +c2 +08 +09 +c5 +e9 +c2 +08 +0a +c5 +e9 +c2 +08 +0b +c5 +e9 +c2 +08 +0c +c5 +e9 +c2 +08 +0d +c5 +e9 +c2 +08 +0e +c5 +e9 +c2 +08 +0f +c5 +e9 +c2 +08 +10 +c5 +e9 +c2 +08 +11 +c5 +e9 +c2 +08 +12 +c5 +e9 +c2 +08 +13 +c5 +e9 +c2 +08 +14 +c5 +e9 +c2 +08 +15 +c5 +e9 +c2 +08 +16 +c5 +e9 +c2 +08 +17 +c5 +e9 +c2 +08 +18 +c5 +e9 +c2 +08 +19 +c5 +e9 +c2 +08 +1a +c5 +e9 +c2 +08 +1b +c5 +e9 +c2 +08 +1c +c5 +e9 +c2 +08 +1d +c5 +e9 +c2 +08 +1e +c5 +e9 +c2 +08 +1f +c5 +ed +c2 +cb +00 +c5 +ed +c2 +cb +01 +c5 +ed +c2 +cb +02 +c5 +ed +c2 +cb +03 +c5 +ed +c2 +cb +04 +c5 +ed +c2 +cb +05 +c5 +ed +c2 +cb +06 +c5 +ed +c2 +cb +07 +c5 +ed +c2 +cb +08 +c5 +ed +c2 +cb +09 +c5 +ed +c2 +cb +0a +c5 +ed +c2 +cb +0b +c5 +ed +c2 +cb +0c +c5 +ed +c2 +cb +0d +c5 +ed +c2 +cb +0e +c5 +ed +c2 +cb +0f +c5 +ed +c2 +cb +10 +c5 +ed +c2 +cb +11 +c5 +ed +c2 +cb +12 +c5 +ed +c2 +cb +13 +c5 +ed +c2 +cb +14 +c5 +ed +c2 +cb +15 +c5 +ed +c2 +cb +16 +c5 +ed +c2 +cb +17 +c5 +ed +c2 +cb +18 +c5 +ed +c2 +cb +19 +c5 +ed +c2 +cb +1a +c5 +ed +c2 +cb +1b +c5 +ed +c2 +cb +1c +c5 +ed +c2 +cb +1d +c5 +ed +c2 +cb +1e +c5 +ed +c2 +cb +1f +c5 +ed +c2 +08 +00 +c5 +ed +c2 +08 +01 +c5 +ed +c2 +08 +02 +c5 +ed +c2 +08 +03 +c5 +ed +c2 +08 +04 +c5 +ed +c2 +08 +05 +c5 +ed +c2 +08 +06 +c5 +ed +c2 +08 +07 +c5 +ed +c2 +08 +08 +c5 +ed +c2 +08 +09 +c5 +ed +c2 +08 +0a +c5 +ed +c2 +08 +0b +c5 +ed +c2 +08 +0c +c5 +ed +c2 +08 +0d +c5 +ed +c2 +08 +0e +c5 +ed +c2 +08 +0f +c5 +ed +c2 +08 +10 +c5 +ed +c2 +08 +11 +c5 +ed +c2 +08 +12 +c5 +ed +c2 +08 +13 +c5 +ed +c2 +08 +14 +c5 +ed +c2 +08 +15 +c5 +ed +c2 +08 +16 +c5 +ed +c2 +08 +17 +c5 +ed +c2 +08 +18 +c5 +ed +c2 +08 +19 +c5 +ed +c2 +08 +1a +c5 +ed +c2 +08 +1b +c5 +ed +c2 +08 +1c +c5 +ed +c2 +08 +1d +c5 +ed +c2 +08 +1e +c5 +ed +c2 +08 +1f +c5 +ed +c2 +08 +00 +c5 +ed +c2 +08 +01 +c5 +ed +c2 +08 +02 +c5 +ed +c2 +08 +03 +c5 +ed +c2 +08 +04 +c5 +ed +c2 +08 +05 +c5 +ed +c2 +08 +06 +c5 +ed +c2 +08 +07 +c5 +ed +c2 +08 +08 +c5 +ed +c2 +08 +09 +c5 +ed +c2 +08 +0a +c5 +ed +c2 +08 +0b +c5 +ed +c2 +08 +0c +c5 +ed +c2 +08 +0d +c5 +ed +c2 +08 +0e +c5 +ed +c2 +08 +0f +c5 +ed +c2 +08 +10 +c5 +ed +c2 +08 +11 +c5 +ed +c2 +08 +12 +c5 +ed +c2 +08 +13 +c5 +ed +c2 +08 +14 +c5 +ed +c2 +08 +15 +c5 +ed +c2 +08 +16 +c5 +ed +c2 +08 +17 +c5 +ed +c2 +08 +18 +c5 +ed +c2 +08 +19 +c5 +ed +c2 +08 +1a +c5 +ed +c2 +08 +1b +c5 +ed +c2 +08 +1c +c5 +ed +c2 +08 +1d +c5 +ed +c2 +08 +1e +c5 +ed +c2 +08 +1f +0f +c2 +ca +00 +0f +c2 +ca +01 +0f +c2 +ca +02 +0f +c2 +ca +03 +0f +c2 +ca +04 +0f +c2 +ca +05 +0f +c2 +ca +06 +0f +c2 +ca +07 +c5 +f0 +c2 +ca +00 +c5 +f0 +c2 +ca +01 +c5 +f0 +c2 +ca +02 +c5 +f0 +c2 +ca +03 +c5 +f0 +c2 +ca +04 +c5 +f0 +c2 +ca +05 +c5 +f0 +c2 +ca +06 +c5 +f0 +c2 +ca +07 +c5 +e8 +c2 +cb +00 +c5 +e8 +c2 +cb +01 +c5 +e8 +c2 +cb +02 +c5 +e8 +c2 +cb +03 +c5 +e8 +c2 +cb +04 +c5 +e8 +c2 +cb +05 +c5 +e8 +c2 +cb +06 +c5 +e8 +c2 +cb +07 +c5 +e8 +c2 +cb +08 +c5 +e8 +c2 +cb +09 +c5 +e8 +c2 +cb +0a +c5 +e8 +c2 +cb +0b +c5 +e8 +c2 +cb +0c +c5 +e8 +c2 +cb +0d +c5 +e8 +c2 +cb +0e +c5 +e8 +c2 +cb +0f +c5 +e8 +c2 +cb +10 +c5 +e8 +c2 +cb +11 +c5 +e8 +c2 +cb +12 +c5 +e8 +c2 +cb +13 +c5 +e8 +c2 +cb +14 +c5 +e8 +c2 +cb +15 +c5 +e8 +c2 +cb +16 +c5 +e8 +c2 +cb +17 +c5 +e8 +c2 +cb +18 +c5 +e8 +c2 +cb +19 +c5 +e8 +c2 +cb +1a +c5 +e8 +c2 +cb +1b +c5 +e8 +c2 +cb +1c +c5 +e8 +c2 +cb +1d +c5 +e8 +c2 +cb +1e +c5 +e8 +c2 +cb +1f +0f +c2 +08 +00 +0f +c2 +08 +01 +0f +c2 +08 +02 +0f +c2 +08 +03 +0f +c2 +08 +04 +0f +c2 +08 +05 +0f +c2 +08 +06 +0f +c2 +08 +07 +c5 +f0 +c2 +08 +00 +c5 +f0 +c2 +08 +01 +c5 +f0 +c2 +08 +02 +c5 +f0 +c2 +08 +03 +c5 +f0 +c2 +08 +04 +c5 +f0 +c2 +08 +05 +c5 +f0 +c2 +08 +06 +c5 +f0 +c2 +08 +07 +c5 +e8 +c2 +08 +00 +c5 +e8 +c2 +08 +01 +c5 +e8 +c2 +08 +02 +c5 +e8 +c2 +08 +03 +c5 +e8 +c2 +08 +04 +c5 +e8 +c2 +08 +05 +c5 +e8 +c2 +08 +06 +c5 +e8 +c2 +08 +07 +c5 +e8 +c2 +08 +08 +c5 +e8 +c2 +08 +09 +c5 +e8 +c2 +08 +0a +c5 +e8 +c2 +08 +0b +c5 +e8 +c2 +08 +0c +c5 +e8 +c2 +08 +0d +c5 +e8 +c2 +08 +0e +c5 +e8 +c2 +08 +0f +c5 +e8 +c2 +08 +10 +c5 +e8 +c2 +08 +11 +c5 +e8 +c2 +08 +12 +c5 +e8 +c2 +08 +13 +c5 +e8 +c2 +08 +14 +c5 +e8 +c2 +08 +15 +c5 +e8 +c2 +08 +16 +c5 +e8 +c2 +08 +17 +c5 +e8 +c2 +08 +18 +c5 +e8 +c2 +08 +19 +c5 +e8 +c2 +08 +1a +c5 +e8 +c2 +08 +1b +c5 +e8 +c2 +08 +1c +c5 +e8 +c2 +08 +1d +c5 +e8 +c2 +08 +1e +c5 +e8 +c2 +08 +1f +0f +c2 +08 +00 +0f +c2 +08 +01 +0f +c2 +08 +02 +0f +c2 +08 +03 +0f +c2 +08 +04 +0f +c2 +08 +05 +0f +c2 +08 +06 +0f +c2 +08 +07 +c5 +f0 +c2 +08 +00 +c5 +f0 +c2 +08 +01 +c5 +f0 +c2 +08 +02 +c5 +f0 +c2 +08 +03 +c5 +f0 +c2 +08 +04 +c5 +f0 +c2 +08 +05 +c5 +f0 +c2 +08 +06 +c5 +f0 +c2 +08 +07 +c5 +e8 +c2 +08 +00 +c5 +e8 +c2 +08 +01 +c5 +e8 +c2 +08 +02 +c5 +e8 +c2 +08 +03 +c5 +e8 +c2 +08 +04 +c5 +e8 +c2 +08 +05 +c5 +e8 +c2 +08 +06 +c5 +e8 +c2 +08 +07 +c5 +e8 +c2 +08 +08 +c5 +e8 +c2 +08 +09 +c5 +e8 +c2 +08 +0a +c5 +e8 +c2 +08 +0b +c5 +e8 +c2 +08 +0c +c5 +e8 +c2 +08 +0d +c5 +e8 +c2 +08 +0e +c5 +e8 +c2 +08 +0f +c5 +e8 +c2 +08 +10 +c5 +e8 +c2 +08 +11 +c5 +e8 +c2 +08 +12 +c5 +e8 +c2 +08 +13 +c5 +e8 +c2 +08 +14 +c5 +e8 +c2 +08 +15 +c5 +e8 +c2 +08 +16 +c5 +e8 +c2 +08 +17 +c5 +e8 +c2 +08 +18 +c5 +e8 +c2 +08 +19 +c5 +e8 +c2 +08 +1a +c5 +e8 +c2 +08 +1b +c5 +e8 +c2 +08 +1c +c5 +e8 +c2 +08 +1d +c5 +e8 +c2 +08 +1e +c5 +e8 +c2 +08 +1f +c5 +ec +c2 +cb +00 +c5 +ec +c2 +cb +01 +c5 +ec +c2 +cb +02 +c5 +ec +c2 +cb +03 +c5 +ec +c2 +cb +04 +c5 +ec +c2 +cb +05 +c5 +ec +c2 +cb +06 +c5 +ec +c2 +cb +07 +c5 +ec +c2 +cb +08 +c5 +ec +c2 +cb +09 +c5 +ec +c2 +cb +0a +c5 +ec +c2 +cb +0b +c5 +ec +c2 +cb +0c +c5 +ec +c2 +cb +0d +c5 +ec +c2 +cb +0e +c5 +ec +c2 +cb +0f +c5 +ec +c2 +cb +10 +c5 +ec +c2 +cb +11 +c5 +ec +c2 +cb +12 +c5 +ec +c2 +cb +13 +c5 +ec +c2 +cb +14 +c5 +ec +c2 +cb +15 +c5 +ec +c2 +cb +16 +c5 +ec +c2 +cb +17 +c5 +ec +c2 +cb +18 +c5 +ec +c2 +cb +19 +c5 +ec +c2 +cb +1a +c5 +ec +c2 +cb +1b +c5 +ec +c2 +cb +1c +c5 +ec +c2 +cb +1d +c5 +ec +c2 +cb +1e +c5 +ec +c2 +cb +1f +c5 +ec +c2 +08 +00 +c5 +ec +c2 +08 +01 +c5 +ec +c2 +08 +02 +c5 +ec +c2 +08 +03 +c5 +ec +c2 +08 +04 +c5 +ec +c2 +08 +05 +c5 +ec +c2 +08 +06 +c5 +ec +c2 +08 +07 +c5 +ec +c2 +08 +08 +c5 +ec +c2 +08 +09 +c5 +ec +c2 +08 +0a +c5 +ec +c2 +08 +0b +c5 +ec +c2 +08 +0c +c5 +ec +c2 +08 +0d +c5 +ec +c2 +08 +0e +c5 +ec +c2 +08 +0f +c5 +ec +c2 +08 +10 +c5 +ec +c2 +08 +11 +c5 +ec +c2 +08 +12 +c5 +ec +c2 +08 +13 +c5 +ec +c2 +08 +14 +c5 +ec +c2 +08 +15 +c5 +ec +c2 +08 +16 +c5 +ec +c2 +08 +17 +c5 +ec +c2 +08 +18 +c5 +ec +c2 +08 +19 +c5 +ec +c2 +08 +1a +c5 +ec +c2 +08 +1b +c5 +ec +c2 +08 +1c +c5 +ec +c2 +08 +1d +c5 +ec +c2 +08 +1e +c5 +ec +c2 +08 +1f +c5 +ec +c2 +08 +00 +c5 +ec +c2 +08 +01 +c5 +ec +c2 +08 +02 +c5 +ec +c2 +08 +03 +c5 +ec +c2 +08 +04 +c5 +ec +c2 +08 +05 +c5 +ec +c2 +08 +06 +c5 +ec +c2 +08 +07 +c5 +ec +c2 +08 +08 +c5 +ec +c2 +08 +09 +c5 +ec +c2 +08 +0a +c5 +ec +c2 +08 +0b +c5 +ec +c2 +08 +0c +c5 +ec +c2 +08 +0d +c5 +ec +c2 +08 +0e +c5 +ec +c2 +08 +0f +c5 +ec +c2 +08 +10 +c5 +ec +c2 +08 +11 +c5 +ec +c2 +08 +12 +c5 +ec +c2 +08 +13 +c5 +ec +c2 +08 +14 +c5 +ec +c2 +08 +15 +c5 +ec +c2 +08 +16 +c5 +ec +c2 +08 +17 +c5 +ec +c2 +08 +18 +c5 +ec +c2 +08 +19 +c5 +ec +c2 +08 +1a +c5 +ec +c2 +08 +1b +c5 +ec +c2 +08 +1c +c5 +ec +c2 +08 +1d +c5 +ec +c2 +08 +1e +c5 +ec +c2 +08 +1f +f2 +0f +c2 +ca +00 +f2 +0f +c2 +ca +01 +f2 +0f +c2 +ca +02 +f2 +0f +c2 +ca +03 +f2 +0f +c2 +ca +04 +f2 +0f +c2 +ca +05 +f2 +0f +c2 +ca +06 +f2 +0f +c2 +ca +07 +c5 +f3 +c2 +ca +00 +c5 +f3 +c2 +ca +01 +c5 +f3 +c2 +ca +02 +c5 +f3 +c2 +ca +03 +c5 +f3 +c2 +ca +04 +c5 +f3 +c2 +ca +05 +c5 +f3 +c2 +ca +06 +c5 +f3 +c2 +ca +07 +c5 +eb +c2 +cb +00 +c5 +eb +c2 +cb +01 +c5 +eb +c2 +cb +02 +c5 +eb +c2 +cb +03 +c5 +eb +c2 +cb +04 +c5 +eb +c2 +cb +05 +c5 +eb +c2 +cb +06 +c5 +eb +c2 +cb +07 +c5 +eb +c2 +cb +08 +c5 +eb +c2 +cb +09 +c5 +eb +c2 +cb +0a +c5 +eb +c2 +cb +0b +c5 +eb +c2 +cb +0c +c5 +eb +c2 +cb +0d +c5 +eb +c2 +cb +0e +c5 +eb +c2 +cb +0f +c5 +eb +c2 +cb +10 +c5 +eb +c2 +cb +11 +c5 +eb +c2 +cb +12 +c5 +eb +c2 +cb +13 +c5 +eb +c2 +cb +14 +c5 +eb +c2 +cb +15 +c5 +eb +c2 +cb +16 +c5 +eb +c2 +cb +17 +c5 +eb +c2 +cb +18 +c5 +eb +c2 +cb +19 +c5 +eb +c2 +cb +1a +c5 +eb +c2 +cb +1b +c5 +eb +c2 +cb +1c +c5 +eb +c2 +cb +1d +c5 +eb +c2 +cb +1e +c5 +eb +c2 +cb +1f +f2 +0f +c2 +08 +00 +f2 +0f +c2 +08 +01 +f2 +0f +c2 +08 +02 +f2 +0f +c2 +08 +03 +f2 +0f +c2 +08 +04 +f2 +0f +c2 +08 +05 +f2 +0f +c2 +08 +06 +f2 +0f +c2 +08 +07 +c5 +f3 +c2 +08 +00 +c5 +f3 +c2 +08 +01 +c5 +f3 +c2 +08 +02 +c5 +f3 +c2 +08 +03 +c5 +f3 +c2 +08 +04 +c5 +f3 +c2 +08 +05 +c5 +f3 +c2 +08 +06 +c5 +f3 +c2 +08 +07 +c5 +eb +c2 +08 +00 +c5 +eb +c2 +08 +01 +c5 +eb +c2 +08 +02 +c5 +eb +c2 +08 +03 +c5 +eb +c2 +08 +04 +c5 +eb +c2 +08 +05 +c5 +eb +c2 +08 +06 +c5 +eb +c2 +08 +07 +c5 +eb +c2 +08 +08 +c5 +eb +c2 +08 +09 +c5 +eb +c2 +08 +0a +c5 +eb +c2 +08 +0b +c5 +eb +c2 +08 +0c +c5 +eb +c2 +08 +0d +c5 +eb +c2 +08 +0e +c5 +eb +c2 +08 +0f +c5 +eb +c2 +08 +10 +c5 +eb +c2 +08 +11 +c5 +eb +c2 +08 +12 +c5 +eb +c2 +08 +13 +c5 +eb +c2 +08 +14 +c5 +eb +c2 +08 +15 +c5 +eb +c2 +08 +16 +c5 +eb +c2 +08 +17 +c5 +eb +c2 +08 +18 +c5 +eb +c2 +08 +19 +c5 +eb +c2 +08 +1a +c5 +eb +c2 +08 +1b +c5 +eb +c2 +08 +1c +c5 +eb +c2 +08 +1d +c5 +eb +c2 +08 +1e +c5 +eb +c2 +08 +1f +f2 +0f +c2 +08 +00 +f2 +0f +c2 +08 +01 +f2 +0f +c2 +08 +02 +f2 +0f +c2 +08 +03 +f2 +0f +c2 +08 +04 +f2 +0f +c2 +08 +05 +f2 +0f +c2 +08 +06 +f2 +0f +c2 +08 +07 +c5 +f3 +c2 +08 +00 +c5 +f3 +c2 +08 +01 +c5 +f3 +c2 +08 +02 +c5 +f3 +c2 +08 +03 +c5 +f3 +c2 +08 +04 +c5 +f3 +c2 +08 +05 +c5 +f3 +c2 +08 +06 +c5 +f3 +c2 +08 +07 +c5 +eb +c2 +08 +00 +c5 +eb +c2 +08 +01 +c5 +eb +c2 +08 +02 +c5 +eb +c2 +08 +03 +c5 +eb +c2 +08 +04 +c5 +eb +c2 +08 +05 +c5 +eb +c2 +08 +06 +c5 +eb +c2 +08 +07 +c5 +eb +c2 +08 +08 +c5 +eb +c2 +08 +09 +c5 +eb +c2 +08 +0a +c5 +eb +c2 +08 +0b +c5 +eb +c2 +08 +0c +c5 +eb +c2 +08 +0d +c5 +eb +c2 +08 +0e +c5 +eb +c2 +08 +0f +c5 +eb +c2 +08 +10 +c5 +eb +c2 +08 +11 +c5 +eb +c2 +08 +12 +c5 +eb +c2 +08 +13 +c5 +eb +c2 +08 +14 +c5 +eb +c2 +08 +15 +c5 +eb +c2 +08 +16 +c5 +eb +c2 +08 +17 +c5 +eb +c2 +08 +18 +c5 +eb +c2 +08 +19 +c5 +eb +c2 +08 +1a +c5 +eb +c2 +08 +1b +c5 +eb +c2 +08 +1c +c5 +eb +c2 +08 +1d +c5 +eb +c2 +08 +1e +c5 +eb +c2 +08 +1f +f3 +0f +c2 +ca +00 +f3 +0f +c2 +ca +01 +f3 +0f +c2 +ca +02 +f3 +0f +c2 +ca +03 +f3 +0f +c2 +ca +04 +f3 +0f +c2 +ca +05 +f3 +0f +c2 +ca +06 +f3 +0f +c2 +ca +07 +c5 +f2 +c2 +ca +00 +c5 +f2 +c2 +ca +01 +c5 +f2 +c2 +ca +02 +c5 +f2 +c2 +ca +03 +c5 +f2 +c2 +ca +04 +c5 +f2 +c2 +ca +05 +c5 +f2 +c2 +ca +06 +c5 +f2 +c2 +ca +07 +c5 +ea +c2 +cb +00 +c5 +ea +c2 +cb +01 +c5 +ea +c2 +cb +02 +c5 +ea +c2 +cb +03 +c5 +ea +c2 +cb +04 +c5 +ea +c2 +cb +05 +c5 +ea +c2 +cb +06 +c5 +ea +c2 +cb +07 +c5 +ea +c2 +cb +08 +c5 +ea +c2 +cb +09 +c5 +ea +c2 +cb +0a +c5 +ea +c2 +cb +0b +c5 +ea +c2 +cb +0c +c5 +ea +c2 +cb +0d +c5 +ea +c2 +cb +0e +c5 +ea +c2 +cb +0f +c5 +ea +c2 +cb +10 +c5 +ea +c2 +cb +11 +c5 +ea +c2 +cb +12 +c5 +ea +c2 +cb +13 +c5 +ea +c2 +cb +14 +c5 +ea +c2 +cb +15 +c5 +ea +c2 +cb +16 +c5 +ea +c2 +cb +17 +c5 +ea +c2 +cb +18 +c5 +ea +c2 +cb +19 +c5 +ea +c2 +cb +1a +c5 +ea +c2 +cb +1b +c5 +ea +c2 +cb +1c +c5 +ea +c2 +cb +1d +c5 +ea +c2 +cb +1e +c5 +ea +c2 +cb +1f +f3 +0f +c2 +08 +00 +f3 +0f +c2 +08 +01 +f3 +0f +c2 +08 +02 +f3 +0f +c2 +08 +03 +f3 +0f +c2 +08 +04 +f3 +0f +c2 +08 +05 +f3 +0f +c2 +08 +06 +f3 +0f +c2 +08 +07 +c5 +f2 +c2 +08 +00 +c5 +f2 +c2 +08 +01 +c5 +f2 +c2 +08 +02 +c5 +f2 +c2 +08 +03 +c5 +f2 +c2 +08 +04 +c5 +f2 +c2 +08 +05 +c5 +f2 +c2 +08 +06 +c5 +f2 +c2 +08 +07 +c5 +ea +c2 +08 +00 +c5 +ea +c2 +08 +01 +c5 +ea +c2 +08 +02 +c5 +ea +c2 +08 +03 +c5 +ea +c2 +08 +04 +c5 +ea +c2 +08 +05 +c5 +ea +c2 +08 +06 +c5 +ea +c2 +08 +07 +c5 +ea +c2 +08 +08 +c5 +ea +c2 +08 +09 +c5 +ea +c2 +08 +0a +c5 +ea +c2 +08 +0b +c5 +ea +c2 +08 +0c +c5 +ea +c2 +08 +0d +c5 +ea +c2 +08 +0e +c5 +ea +c2 +08 +0f +c5 +ea +c2 +08 +10 +c5 +ea +c2 +08 +11 +c5 +ea +c2 +08 +12 +c5 +ea +c2 +08 +13 +c5 +ea +c2 +08 +14 +c5 +ea +c2 +08 +15 +c5 +ea +c2 +08 +16 +c5 +ea +c2 +08 +17 +c5 +ea +c2 +08 +18 +c5 +ea +c2 +08 +19 +c5 +ea +c2 +08 +1a +c5 +ea +c2 +08 +1b +c5 +ea +c2 +08 +1c +c5 +ea +c2 +08 +1d +c5 +ea +c2 +08 +1e +c5 +ea +c2 +08 +1f +f3 +0f +c2 +08 +00 +f3 +0f +c2 +08 +01 +f3 +0f +c2 +08 +02 +f3 +0f +c2 +08 +03 +f3 +0f +c2 +08 +04 +f3 +0f +c2 +08 +05 +f3 +0f +c2 +08 +06 +f3 +0f +c2 +08 +07 +c5 +f2 +c2 +08 +00 +c5 +f2 +c2 +08 +01 +c5 +f2 +c2 +08 +02 +c5 +f2 +c2 +08 +03 +c5 +f2 +c2 +08 +04 +c5 +f2 +c2 +08 +05 +c5 +f2 +c2 +08 +06 +c5 +f2 +c2 +08 +07 +c5 +ea +c2 +08 +00 +c5 +ea +c2 +08 +01 +c5 +ea +c2 +08 +02 +c5 +ea +c2 +08 +03 +c5 +ea +c2 +08 +04 +c5 +ea +c2 +08 +05 +c5 +ea +c2 +08 +06 +c5 +ea +c2 +08 +07 +c5 +ea +c2 +08 +08 +c5 +ea +c2 +08 +09 +c5 +ea +c2 +08 +0a +c5 +ea +c2 +08 +0b +c5 +ea +c2 +08 +0c +c5 +ea +c2 +08 +0d +c5 +ea +c2 +08 +0e +c5 +ea +c2 +08 +0f +c5 +ea +c2 +08 +10 +c5 +ea +c2 +08 +11 +c5 +ea +c2 +08 +12 +c5 +ea +c2 +08 +13 +c5 +ea +c2 +08 +14 +c5 +ea +c2 +08 +15 +c5 +ea +c2 +08 +16 +c5 +ea +c2 +08 +17 +c5 +ea +c2 +08 +18 +c5 +ea +c2 +08 +19 +c5 +ea +c2 +08 +1a +c5 +ea +c2 +08 +1b +c5 +ea +c2 +08 +1c +c5 +ea +c2 +08 +1d +c5 +ea +c2 +08 +1e +c5 +ea +c2 +08 +1f diff --git a/modules/arch/x86/tests/bmi1.asm b/modules/arch/x86/tests/bmi1.asm new file mode 100644 index 00000000..4913a4f8 --- /dev/null +++ b/modules/arch/x86/tests/bmi1.asm @@ -0,0 +1,32 @@ +[bits 64] +andn eax, ebx, ecx ; c4 e2 60 f2 c1 +andn eax, ebx, [0] ; c4 e2 60 f2 04 25 00 00 00 00 +andn rax, rbx, rcx ; c4 e2 e0 f2 c1 +andn rax, rbx, [0] ; c4 e2 e0 f2 04 25 00 00 00 00 + +bextr eax, ebx, ecx ; c4 e2 70 f7 c3 +bextr eax, [0], ecx ; c4 e2 70 f7 04 25 00 00 00 00 +bextr rax, rbx, rcx ; c4 e2 f0 f7 c3 +bextr rax, [0], rcx ; c4 e2 f0 f7 04 25 00 00 00 00 + +blsi eax, ecx ; c4 e2 78 f3 d9 +blsi eax, [0] ; c4 e2 78 f3 1c 25 00 00 00 00 +blsi rax, rcx ; c4 e2 f8 f3 d9 +blsi rax, [0] ; c4 e2 f8 f3 1c 25 00 00 00 00 + +blsmsk eax, ecx ; c4 e2 78 f3 d1 +blsmsk eax, [0] ; c4 e2 78 f3 14 25 00 00 00 00 +blsmsk rax, rcx ; c4 e2 f8 f3 d1 +blsmsk rax, [0] ; c4 e2 f8 f3 14 25 00 00 00 00 + +blsr eax, ecx ; c4 e2 78 f3 c9 +blsr eax, [0] ; c4 e2 78 f3 0c 25 00 00 00 00 +blsr rax, rcx ; c4 e2 f8 f3 c9 +blsr rax, [0] ; c4 e2 f8 f3 0c 25 00 00 00 00 + +tzcnt ax, bx ; 66 f3 0f bc c3 +tzcnt ax, [0] ; 66 f3 0f bc 04 25 00 00 00 00 +tzcnt eax, ebx ; f3 0f bc c3 +tzcnt eax, [0] ; f3 0f bc 04 25 00 00 00 00 +tzcnt rax, rbx ; f3 48 0f bc c3 +tzcnt rax, [0] ; f3 48 0f bc 04 25 00 00 00 00 diff --git a/modules/arch/x86/tests/bmi1.hex b/modules/arch/x86/tests/bmi1.hex new file mode 100644 index 00000000..fc692cde --- /dev/null +++ b/modules/arch/x86/tests/bmi1.hex @@ -0,0 +1,193 @@ +c4 +e2 +60 +f2 +c1 +c4 +e2 +60 +f2 +04 +25 +00 +00 +00 +00 +c4 +e2 +e0 +f2 +c1 +c4 +e2 +e0 +f2 +04 +25 +00 +00 +00 +00 +c4 +e2 +70 +f7 +c3 +c4 +e2 +70 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +f0 +f7 +c3 +c4 +e2 +f0 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +78 +f3 +d9 +c4 +e2 +78 +f3 +1c +25 +00 +00 +00 +00 +c4 +e2 +f8 +f3 +d9 +c4 +e2 +f8 +f3 +1c +25 +00 +00 +00 +00 +c4 +e2 +78 +f3 +d1 +c4 +e2 +78 +f3 +14 +25 +00 +00 +00 +00 +c4 +e2 +f8 +f3 +d1 +c4 +e2 +f8 +f3 +14 +25 +00 +00 +00 +00 +c4 +e2 +78 +f3 +c9 +c4 +e2 +78 +f3 +0c +25 +00 +00 +00 +00 +c4 +e2 +f8 +f3 +c9 +c4 +e2 +f8 +f3 +0c +25 +00 +00 +00 +00 +66 +f3 +0f +bc +c3 +66 +f3 +0f +bc +04 +25 +00 +00 +00 +00 +f3 +0f +bc +c3 +f3 +0f +bc +04 +25 +00 +00 +00 +00 +f3 +48 +0f +bc +c3 +f3 +48 +0f +bc +04 +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/bmi2.asm b/modules/arch/x86/tests/bmi2.asm new file mode 100644 index 00000000..d19d7f3a --- /dev/null +++ b/modules/arch/x86/tests/bmi2.asm @@ -0,0 +1,40 @@ +[bits 64] +bzhi eax, ebx, ecx ; c4 e2 70 f5 c3 +bzhi eax, [0], ecx ; c4 e2 70 f5 04 25 00 00 00 00 +bzhi rax, rbx, rcx ; c4 e2 f0 f5 c3 +bzhi rax, [0], rcx ; c4 e2 f0 f5 04 25 00 00 00 00 + +mulx eax, ebx, ecx ; c4 e2 63 f6 c1 +mulx eax, ebx, [0] ; c4 e2 63 f6 04 25 00 00 00 00 +mulx rax, rbx, rcx ; c4 e2 e3 f6 c1 +mulx rax, rbx, [0] ; c4 e2 e3 f6 04 25 00 00 00 00 + +pdep eax, ebx, ecx ; c4 e2 63 f5 c1 +pdep eax, ebx, [0] ; c4 e2 63 f5 04 25 00 00 00 00 +pdep rax, rbx, rcx ; c4 e2 e3 f5 c1 +pdep rax, rbx, [0] ; c4 e2 e3 f5 04 25 00 00 00 00 + +pext eax, ebx, ecx ; c4 e2 62 f5 c1 +pext eax, ebx, [0] ; c4 e2 62 f5 04 25 00 00 00 00 +pext rax, rbx, rcx ; c4 e2 e2 f5 c1 +pext rax, rbx, [0] ; c4 e2 e2 f5 04 25 00 00 00 00 + +rorx eax, ebx, 3 ; c4 e3 7b f0 c3 03 +rorx eax, [0], 3 ; c4 e3 7b f0 04 25 00 00 00 00 03 +rorx rax, rbx, 3 ; c4 e3 fb f0 c3 03 +rorx rax, [0], 3 ; c4 e3 fb f0 04 25 00 00 00 00 03 + +sarx eax, ebx, ecx ; c4 e2 72 f7 c3 +sarx eax, [0], ecx ; c4 e2 72 f7 04 25 00 00 00 00 +sarx rax, rbx, rcx ; c4 e2 f2 f7 c3 +sarx rax, [0], rcx ; c4 e2 f2 f7 04 25 00 00 00 00 + +shlx eax, ebx, ecx ; c4 e2 71 f7 c3 +shlx eax, [0], ecx ; c4 e2 71 f7 04 25 00 00 00 00 +shlx rax, rbx, rcx ; c4 e2 f1 f7 c3 +shlx rax, [0], rcx ; c4 e2 f1 f7 04 25 00 00 00 00 + +shrx eax, ebx, ecx ; c4 e2 73 f7 c3 +shrx eax, [0], ecx ; c4 e2 73 f7 04 25 00 00 00 00 +shrx rax, rbx, rcx ; c4 e2 f3 f7 c3 +shrx rax, [0], rcx ; c4 e2 f3 f7 04 25 00 00 00 00 diff --git a/modules/arch/x86/tests/bmi2.hex b/modules/arch/x86/tests/bmi2.hex new file mode 100644 index 00000000..c1529729 --- /dev/null +++ b/modules/arch/x86/tests/bmi2.hex @@ -0,0 +1,244 @@ +c4 +e2 +70 +f5 +c3 +c4 +e2 +70 +f5 +04 +25 +00 +00 +00 +00 +c4 +e2 +f0 +f5 +c3 +c4 +e2 +f0 +f5 +04 +25 +00 +00 +00 +00 +c4 +e2 +63 +f6 +c1 +c4 +e2 +63 +f6 +04 +25 +00 +00 +00 +00 +c4 +e2 +e3 +f6 +c1 +c4 +e2 +e3 +f6 +04 +25 +00 +00 +00 +00 +c4 +e2 +63 +f5 +c1 +c4 +e2 +63 +f5 +04 +25 +00 +00 +00 +00 +c4 +e2 +e3 +f5 +c1 +c4 +e2 +e3 +f5 +04 +25 +00 +00 +00 +00 +c4 +e2 +62 +f5 +c1 +c4 +e2 +62 +f5 +04 +25 +00 +00 +00 +00 +c4 +e2 +e2 +f5 +c1 +c4 +e2 +e2 +f5 +04 +25 +00 +00 +00 +00 +c4 +e3 +7b +f0 +c3 +03 +c4 +e3 +7b +f0 +04 +25 +00 +00 +00 +00 +03 +c4 +e3 +fb +f0 +c3 +03 +c4 +e3 +fb +f0 +04 +25 +00 +00 +00 +00 +03 +c4 +e2 +72 +f7 +c3 +c4 +e2 +72 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +f2 +f7 +c3 +c4 +e2 +f2 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +71 +f7 +c3 +c4 +e2 +71 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +f1 +f7 +c3 +c4 +e2 +f1 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +73 +f7 +c3 +c4 +e2 +73 +f7 +04 +25 +00 +00 +00 +00 +c4 +e2 +f3 +f7 +c3 +c4 +e2 +f3 +f7 +04 +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/clmul.asm b/modules/arch/x86/tests/clmul.asm new file mode 100644 index 00000000..92e168ef --- /dev/null +++ b/modules/arch/x86/tests/clmul.asm @@ -0,0 +1,42 @@ +[bits 64] + +pclmulqdq xmm1, xmm2, 5 +pclmulqdq xmm1, [rax], byte 5 +pclmulqdq xmm1, dqword [rax], 5 +vpclmulqdq xmm1, xmm2, 0x10 +vpclmulqdq xmm1, dqword [rbx], 0x10 +vpclmulqdq xmm0, xmm1, xmm2, 0x10 +vpclmulqdq xmm0, xmm1, dqword [rbx], 0x10 + +pclmullqlqdq xmm1, xmm2 +pclmullqlqdq xmm1, [rax] +pclmullqlqdq xmm1, dqword [rax] +vpclmullqlqdq xmm1, xmm2 +vpclmullqlqdq xmm1, dqword[rbx] +vpclmullqlqdq xmm0, xmm1, xmm2 +vpclmullqlqdq xmm0, xmm1, dqword[rbx] + +pclmulhqlqdq xmm1, xmm2 +pclmulhqlqdq xmm1, [rax] +pclmulhqlqdq xmm1, dqword [rax] +vpclmulhqlqdq xmm1, xmm2 +vpclmulhqlqdq xmm1, dqword[rbx] +vpclmulhqlqdq xmm0, xmm1, xmm2 +vpclmulhqlqdq xmm0, xmm1, dqword[rbx] + +pclmullqhqdq xmm1, xmm2 +pclmullqhqdq xmm1, [rax] +pclmullqhqdq xmm1, dqword [rax] +vpclmullqhqdq xmm1, xmm2 +vpclmullqhqdq xmm1, dqword[rbx] +vpclmullqhqdq xmm0, xmm1, xmm2 +vpclmullqhqdq xmm0, xmm1, dqword[rbx] + +pclmulhqhqdq xmm1, xmm2 +pclmulhqhqdq xmm1, [rax] +pclmulhqhqdq xmm1, dqword [rax] +vpclmulhqhqdq xmm1, xmm2 +vpclmulhqhqdq xmm1, dqword[rbx] +vpclmulhqhqdq xmm0, xmm1, xmm2 +vpclmulhqhqdq xmm0, xmm1, dqword[rbx] + diff --git a/modules/arch/x86/tests/clmul.hex b/modules/arch/x86/tests/clmul.hex new file mode 100644 index 00000000..6aad748a --- /dev/null +++ b/modules/arch/x86/tests/clmul.hex @@ -0,0 +1,210 @@ +66 +0f +3a +44 +ca +05 +66 +0f +3a +44 +08 +05 +66 +0f +3a +44 +08 +05 +c4 +e3 +71 +44 +ca +10 +c4 +e3 +71 +44 +0b +10 +c4 +e3 +71 +44 +c2 +10 +c4 +e3 +71 +44 +03 +10 +66 +0f +3a +44 +ca +00 +66 +0f +3a +44 +08 +00 +66 +0f +3a +44 +08 +00 +c4 +e3 +71 +44 +ca +00 +c4 +e3 +71 +44 +0b +00 +c4 +e3 +71 +44 +c2 +00 +c4 +e3 +71 +44 +03 +00 +66 +0f +3a +44 +ca +01 +66 +0f +3a +44 +08 +01 +66 +0f +3a +44 +08 +01 +c4 +e3 +71 +44 +ca +01 +c4 +e3 +71 +44 +0b +01 +c4 +e3 +71 +44 +c2 +01 +c4 +e3 +71 +44 +03 +01 +66 +0f +3a +44 +ca +10 +66 +0f +3a +44 +08 +10 +66 +0f +3a +44 +08 +10 +c4 +e3 +71 +44 +ca +10 +c4 +e3 +71 +44 +0b +10 +c4 +e3 +71 +44 +c2 +10 +c4 +e3 +71 +44 +03 +10 +66 +0f +3a +44 +ca +11 +66 +0f +3a +44 +08 +11 +66 +0f +3a +44 +08 +11 +c4 +e3 +71 +44 +ca +11 +c4 +e3 +71 +44 +0b +11 +c4 +e3 +71 +44 +c2 +11 +c4 +e3 +71 +44 +03 +11 diff --git a/modules/arch/x86/tests/cpubasic-err.errwarn b/modules/arch/x86/tests/cpubasic-err.errwarn index 917843e5..3c2b876c 100644 --- a/modules/arch/x86/tests/cpubasic-err.errwarn +++ b/modules/arch/x86/tests/cpubasic-err.errwarn @@ -1,6 +1,6 @@ -:2: warning: `pause' is an instruction in CPU P4 --:4: requires CPU 186 +-:4: error: requires CPU 186 -:7: warning: `fninit' is an instruction in CPU FPU --:15: requires CPU 186 +-:15: error: requires CPU 186 -:16: warning: `movsd' is an instruction in CPU 386 --:17: requires CPU 186 +-:17: error: requires CPU 186 diff --git a/modules/arch/x86/tests/div-err.errwarn b/modules/arch/x86/tests/div-err.errwarn index 4b6340e7..af466252 100644 --- a/modules/arch/x86/tests/div-err.errwarn +++ b/modules/arch/x86/tests/div-err.errwarn @@ -1,4 +1,4 @@ --:1: cannot override register size --:3: cannot override register size --:4: cannot override register size --:5: cannot override register size +-:1: error: cannot override register size +-:3: error: cannot override register size +-:4: error: cannot override register size +-:5: error: cannot override register size diff --git a/modules/arch/x86/tests/effaddr.asm b/modules/arch/x86/tests/effaddr.asm index 5a165c9a..1a22a158 100644 --- a/modules/arch/x86/tests/effaddr.asm +++ b/modules/arch/x86/tests/effaddr.asm @@ -15,3 +15,4 @@ label dd 5 label2 ;mov ax,[eax+ebx*(label2-label)] ; not supported +mov ax,[eax*2+ebx*2-ebx] diff --git a/modules/arch/x86/tests/effaddr.hex b/modules/arch/x86/tests/effaddr.hex index b3628f0d..225a2152 100644 --- a/modules/arch/x86/tests/effaddr.hex +++ b/modules/arch/x86/tests/effaddr.hex @@ -57,3 +57,7 @@ f8 00 00 00 +66 +8b +04 +43 diff --git a/modules/arch/x86/tests/eptvpid.asm b/modules/arch/x86/tests/eptvpid.asm new file mode 100644 index 00000000..8c4881f4 --- /dev/null +++ b/modules/arch/x86/tests/eptvpid.asm @@ -0,0 +1,8 @@ +[bits 32] +invept eax, [eax] +invvpid eax, [eax] + +[bits 64] +invept rax, [rax] +invvpid rax, [rax] + diff --git a/modules/arch/x86/tests/eptvpid.hex b/modules/arch/x86/tests/eptvpid.hex new file mode 100644 index 00000000..1e2c2420 --- /dev/null +++ b/modules/arch/x86/tests/eptvpid.hex @@ -0,0 +1,22 @@ +66 +0f +38 +80 +00 +66 +0f +38 +81 +00 +66 +48 +0f +38 +80 +00 +66 +48 +0f +38 +81 +00 diff --git a/modules/arch/x86/tests/f16c.asm b/modules/arch/x86/tests/f16c.asm new file mode 100644 index 00000000..06fa5f1d --- /dev/null +++ b/modules/arch/x86/tests/f16c.asm @@ -0,0 +1,10 @@ +[bits 64] +vcvtph2ps ymm1, xmm2 +vcvtph2ps ymm1, oword [0] +vcvtph2ps xmm1, xmm2 +vcvtph2ps xmm1, qword [0] + +vcvtps2ph xmm1, ymm2, 4 +vcvtps2ph oword [0], ymm2, 8 +vcvtps2ph xmm1, xmm2, 3 +vcvtps2ph qword [0], xmm2, 5 diff --git a/modules/arch/x86/tests/f16c.hex b/modules/arch/x86/tests/f16c.hex new file mode 100644 index 00000000..8ba06fc7 --- /dev/null +++ b/modules/arch/x86/tests/f16c.hex @@ -0,0 +1,64 @@ +c4 +e2 +7d +13 +ca +c4 +e2 +7d +13 +0c +25 +00 +00 +00 +00 +c4 +e2 +79 +13 +ca +c4 +e2 +79 +13 +0c +25 +00 +00 +00 +00 +c4 +e3 +7d +1d +d1 +04 +c4 +e3 +7d +1d +14 +25 +00 +00 +00 +00 +08 +c4 +e3 +79 +1d +d1 +03 +c4 +e3 +79 +1d +14 +25 +00 +00 +00 +00 +05 diff --git a/modules/arch/x86/tests/farbasic.asm b/modules/arch/x86/tests/farbasic.asm index 0c2648dc..fa1ced0f 100644 --- a/modules/arch/x86/tests/farbasic.asm +++ b/modules/arch/x86/tests/farbasic.asm @@ -1,10 +1,10 @@ +equval equ 6:7 + [bits 32] jmp 5:4 -jmp equval - -equval equ 6:7 +jmp far equval [bits 16] diff --git a/modules/arch/x86/tests/fma.asm b/modules/arch/x86/tests/fma.asm new file mode 100644 index 00000000..9bfb512b --- /dev/null +++ b/modules/arch/x86/tests/fma.asm @@ -0,0 +1,289 @@ +[bits 64] +vfmadd132ss xmm1, xmm2, xmm3 +vfmadd132ss xmm1, xmm2, dword [rax] +vfmadd132ss xmm1, xmm2, [rax] +vfmadd231ss xmm1, xmm2, xmm3 +vfmadd231ss xmm1, xmm2, dword [rax] +vfmadd231ss xmm1, xmm2, [rax] +vfmadd213ss xmm1, xmm2, xmm3 +vfmadd213ss xmm1, xmm2, dword [rax] +vfmadd213ss xmm1, xmm2, [rax] +vfmadd132sd xmm1, xmm2, xmm3 +vfmadd132sd xmm1, xmm2, qword [rax] +vfmadd132sd xmm1, xmm2, [rax] +vfmadd231sd xmm1, xmm2, xmm3 +vfmadd231sd xmm1, xmm2, qword [rax] +vfmadd231sd xmm1, xmm2, [rax] +vfmadd213sd xmm1, xmm2, xmm3 +vfmadd213sd xmm1, xmm2, qword [rax] +vfmadd213sd xmm1, xmm2, [rax] +vfmadd132ps xmm1, xmm2, xmm3 +vfmadd132ps xmm1, xmm2, xmm3 +vfmadd132ps xmm1, xmm2, [rax] +vfmadd231ps xmm1, xmm2, xmm3 +vfmadd231ps xmm1, xmm2, xmm3 +vfmadd231ps xmm1, xmm2, [rax] +vfmadd213ps xmm1, xmm2, xmm3 +vfmadd213ps xmm1, xmm2, xmm3 +vfmadd213ps xmm1, xmm2, [rax] +vfmadd132ps ymm1, ymm2, ymm3 +vfmadd132ps ymm1, ymm2, yword [rax] +vfmadd132ps ymm1, ymm2, [rax] +vfmadd231ps ymm1, ymm2, ymm3 +vfmadd231ps ymm1, ymm2, yword [rax] +vfmadd231ps ymm1, ymm2, [rax] +vfmadd213ps ymm1, ymm2, ymm3 +vfmadd213ps ymm1, ymm2, yword [rax] +vfmadd213ps ymm1, ymm2, [rax] +vfmadd132pd xmm1, xmm2, xmm3 +vfmadd132pd xmm1, xmm2, dqword [rax] +vfmadd132pd xmm1, xmm2, [rax] +vfmadd231pd xmm1, xmm2, xmm3 +vfmadd231pd xmm1, xmm2, dqword [rax] +vfmadd231pd xmm1, xmm2, [rax] +vfmadd213pd xmm1, xmm2, xmm3 +vfmadd213pd xmm1, xmm2, dqword [rax] +vfmadd213pd xmm1, xmm2, [rax] +vfmadd132pd ymm1, ymm2, ymm3 +vfmadd132pd ymm1, ymm2, yword [rax] +vfmadd132pd ymm1, ymm2, [rax] +vfmadd231pd ymm1, ymm2, ymm3 +vfmadd231pd ymm1, ymm2, yword [rax] +vfmadd231pd ymm1, ymm2, [rax] +vfmadd213pd ymm1, ymm2, ymm3 +vfmadd213pd ymm1, ymm2, yword [rax] +vfmadd213pd ymm1, ymm2, [rax] +vfmsub132ss xmm1, xmm2, xmm3 +vfmsub132ss xmm1, xmm2, dword [rax] +vfmsub132ss xmm1, xmm2, [rax] +vfmsub231ss xmm1, xmm2, xmm3 +vfmsub231ss xmm1, xmm2, dword [rax] +vfmsub231ss xmm1, xmm2, [rax] +vfmsub213ss xmm1, xmm2, xmm3 +vfmsub213ss xmm1, xmm2, dword [rax] +vfmsub213ss xmm1, xmm2, [rax] +vfmsub132sd xmm1, xmm2, xmm3 +vfmsub132sd xmm1, xmm2, qword [rax] +vfmsub132sd xmm1, xmm2, [rax] +vfmsub231sd xmm1, xmm2, xmm3 +vfmsub231sd xmm1, xmm2, qword [rax] +vfmsub231sd xmm1, xmm2, [rax] +vfmsub213sd xmm1, xmm2, xmm3 +vfmsub213sd xmm1, xmm2, qword [rax] +vfmsub213sd xmm1, xmm2, [rax] +vfmsub132ps xmm1, xmm2, xmm3 +vfmsub132ps xmm1, xmm2, xmm3 +vfmsub132ps xmm1, xmm2, [rax] +vfmsub231ps xmm1, xmm2, xmm3 +vfmsub231ps xmm1, xmm2, xmm3 +vfmsub231ps xmm1, xmm2, [rax] +vfmsub213ps xmm1, xmm2, xmm3 +vfmsub213ps xmm1, xmm2, xmm3 +vfmsub213ps xmm1, xmm2, [rax] +vfmsub132ps ymm1, ymm2, ymm3 +vfmsub132ps ymm1, ymm2, yword [rax] +vfmsub132ps ymm1, ymm2, [rax] +vfmsub231ps ymm1, ymm2, ymm3 +vfmsub231ps ymm1, ymm2, yword [rax] +vfmsub231ps ymm1, ymm2, [rax] +vfmsub213ps ymm1, ymm2, ymm3 +vfmsub213ps ymm1, ymm2, yword [rax] +vfmsub213ps ymm1, ymm2, [rax] +vfmsub132pd xmm1, xmm2, xmm3 +vfmsub132pd xmm1, xmm2, dqword [rax] +vfmsub132pd xmm1, xmm2, [rax] +vfmsub231pd xmm1, xmm2, xmm3 +vfmsub231pd xmm1, xmm2, dqword [rax] +vfmsub231pd xmm1, xmm2, [rax] +vfmsub213pd xmm1, xmm2, xmm3 +vfmsub213pd xmm1, xmm2, dqword [rax] +vfmsub213pd xmm1, xmm2, [rax] +vfmsub132pd ymm1, ymm2, ymm3 +vfmsub132pd ymm1, ymm2, yword [rax] +vfmsub132pd ymm1, ymm2, [rax] +vfmsub231pd ymm1, ymm2, ymm3 +vfmsub231pd ymm1, ymm2, yword [rax] +vfmsub231pd ymm1, ymm2, [rax] +vfmsub213pd ymm1, ymm2, ymm3 +vfmsub213pd ymm1, ymm2, yword [rax] +vfmsub213pd ymm1, ymm2, [rax] +vfnmadd132ss xmm1, xmm2, xmm3 +vfnmadd132ss xmm1, xmm2, dword [rax] +vfnmadd132ss xmm1, xmm2, [rax] +vfnmadd231ss xmm1, xmm2, xmm3 +vfnmadd231ss xmm1, xmm2, dword [rax] +vfnmadd231ss xmm1, xmm2, [rax] +vfnmadd213ss xmm1, xmm2, xmm3 +vfnmadd213ss xmm1, xmm2, dword [rax] +vfnmadd213ss xmm1, xmm2, [rax] +vfnmadd132sd xmm1, xmm2, xmm3 +vfnmadd132sd xmm1, xmm2, qword [rax] +vfnmadd132sd xmm1, xmm2, [rax] +vfnmadd231sd xmm1, xmm2, xmm3 +vfnmadd231sd xmm1, xmm2, qword [rax] +vfnmadd231sd xmm1, xmm2, [rax] +vfnmadd213sd xmm1, xmm2, xmm3 +vfnmadd213sd xmm1, xmm2, qword [rax] +vfnmadd213sd xmm1, xmm2, [rax] +vfnmadd132ps xmm1, xmm2, xmm3 +vfnmadd132ps xmm1, xmm2, xmm3 +vfnmadd132ps xmm1, xmm2, [rax] +vfnmadd231ps xmm1, xmm2, xmm3 +vfnmadd231ps xmm1, xmm2, xmm3 +vfnmadd231ps xmm1, xmm2, [rax] +vfnmadd213ps xmm1, xmm2, xmm3 +vfnmadd213ps xmm1, xmm2, xmm3 +vfnmadd213ps xmm1, xmm2, [rax] +vfnmadd132ps ymm1, ymm2, ymm3 +vfnmadd132ps ymm1, ymm2, yword [rax] +vfnmadd132ps ymm1, ymm2, [rax] +vfnmadd231ps ymm1, ymm2, ymm3 +vfnmadd231ps ymm1, ymm2, yword [rax] +vfnmadd231ps ymm1, ymm2, [rax] +vfnmadd213ps ymm1, ymm2, ymm3 +vfnmadd213ps ymm1, ymm2, yword [rax] +vfnmadd213ps ymm1, ymm2, [rax] +vfnmadd132pd xmm1, xmm2, xmm3 +vfnmadd132pd xmm1, xmm2, dqword [rax] +vfnmadd132pd xmm1, xmm2, [rax] +vfnmadd231pd xmm1, xmm2, xmm3 +vfnmadd231pd xmm1, xmm2, dqword [rax] +vfnmadd231pd xmm1, xmm2, [rax] +vfnmadd213pd xmm1, xmm2, xmm3 +vfnmadd213pd xmm1, xmm2, dqword [rax] +vfnmadd213pd xmm1, xmm2, [rax] +vfnmadd132pd ymm1, ymm2, ymm3 +vfnmadd132pd ymm1, ymm2, yword [rax] +vfnmadd132pd ymm1, ymm2, [rax] +vfnmadd231pd ymm1, ymm2, ymm3 +vfnmadd231pd ymm1, ymm2, yword [rax] +vfnmadd231pd ymm1, ymm2, [rax] +vfnmadd213pd ymm1, ymm2, ymm3 +vfnmadd213pd ymm1, ymm2, yword [rax] +vfnmadd213pd ymm1, ymm2, [rax] +vfnmsub132ss xmm1, xmm2, xmm3 +vfnmsub132ss xmm1, xmm2, dword [rax] +vfnmsub132ss xmm1, xmm2, [rax] +vfnmsub231ss xmm1, xmm2, xmm3 +vfnmsub231ss xmm1, xmm2, dword [rax] +vfnmsub231ss xmm1, xmm2, [rax] +vfnmsub213ss xmm1, xmm2, xmm3 +vfnmsub213ss xmm1, xmm2, dword [rax] +vfnmsub213ss xmm1, xmm2, [rax] +vfnmsub132sd xmm1, xmm2, xmm3 +vfnmsub132sd xmm1, xmm2, qword [rax] +vfnmsub132sd xmm1, xmm2, [rax] +vfnmsub231sd xmm1, xmm2, xmm3 +vfnmsub231sd xmm1, xmm2, qword [rax] +vfnmsub231sd xmm1, xmm2, [rax] +vfnmsub213sd xmm1, xmm2, xmm3 +vfnmsub213sd xmm1, xmm2, qword [rax] +vfnmsub213sd xmm1, xmm2, [rax] +vfnmsub132ps xmm1, xmm2, xmm3 +vfnmsub132ps xmm1, xmm2, xmm3 +vfnmsub132ps xmm1, xmm2, [rax] +vfnmsub231ps xmm1, xmm2, xmm3 +vfnmsub231ps xmm1, xmm2, xmm3 +vfnmsub231ps xmm1, xmm2, [rax] +vfnmsub213ps xmm1, xmm2, xmm3 +vfnmsub213ps xmm1, xmm2, xmm3 +vfnmsub213ps xmm1, xmm2, [rax] +vfnmsub132ps ymm1, ymm2, ymm3 +vfnmsub132ps ymm1, ymm2, yword [rax] +vfnmsub132ps ymm1, ymm2, [rax] +vfnmsub231ps ymm1, ymm2, ymm3 +vfnmsub231ps ymm1, ymm2, yword [rax] +vfnmsub231ps ymm1, ymm2, [rax] +vfnmsub213ps ymm1, ymm2, ymm3 +vfnmsub213ps ymm1, ymm2, yword [rax] +vfnmsub213ps ymm1, ymm2, [rax] +vfnmsub132pd xmm1, xmm2, xmm3 +vfnmsub132pd xmm1, xmm2, dqword [rax] +vfnmsub132pd xmm1, xmm2, [rax] +vfnmsub231pd xmm1, xmm2, xmm3 +vfnmsub231pd xmm1, xmm2, dqword [rax] +vfnmsub231pd xmm1, xmm2, [rax] +vfnmsub213pd xmm1, xmm2, xmm3 +vfnmsub213pd xmm1, xmm2, dqword [rax] +vfnmsub213pd xmm1, xmm2, [rax] +vfnmsub132pd ymm1, ymm2, ymm3 +vfnmsub132pd ymm1, ymm2, yword [rax] +vfnmsub132pd ymm1, ymm2, [rax] +vfnmsub231pd ymm1, ymm2, ymm3 +vfnmsub231pd ymm1, ymm2, yword [rax] +vfnmsub231pd ymm1, ymm2, [rax] +vfnmsub213pd ymm1, ymm2, ymm3 +vfnmsub213pd ymm1, ymm2, yword [rax] +vfnmsub213pd ymm1, ymm2, [rax] +vfmaddsub132ps xmm1, xmm2, xmm3 +vfmaddsub132ps xmm1, xmm2, xmm3 +vfmaddsub132ps xmm1, xmm2, [rax] +vfmaddsub231ps xmm1, xmm2, xmm3 +vfmaddsub231ps xmm1, xmm2, xmm3 +vfmaddsub231ps xmm1, xmm2, [rax] +vfmaddsub213ps xmm1, xmm2, xmm3 +vfmaddsub213ps xmm1, xmm2, xmm3 +vfmaddsub213ps xmm1, xmm2, [rax] +vfmaddsub132ps ymm1, ymm2, ymm3 +vfmaddsub132ps ymm1, ymm2, yword [rax] +vfmaddsub132ps ymm1, ymm2, [rax] +vfmaddsub231ps ymm1, ymm2, ymm3 +vfmaddsub231ps ymm1, ymm2, yword [rax] +vfmaddsub231ps ymm1, ymm2, [rax] +vfmaddsub213ps ymm1, ymm2, ymm3 +vfmaddsub213ps ymm1, ymm2, yword [rax] +vfmaddsub213ps ymm1, ymm2, [rax] +vfmaddsub132pd xmm1, xmm2, xmm3 +vfmaddsub132pd xmm1, xmm2, dqword [rax] +vfmaddsub132pd xmm1, xmm2, [rax] +vfmaddsub231pd xmm1, xmm2, xmm3 +vfmaddsub231pd xmm1, xmm2, dqword [rax] +vfmaddsub231pd xmm1, xmm2, [rax] +vfmaddsub213pd xmm1, xmm2, xmm3 +vfmaddsub213pd xmm1, xmm2, dqword [rax] +vfmaddsub213pd xmm1, xmm2, [rax] +vfmaddsub132pd ymm1, ymm2, ymm3 +vfmaddsub132pd ymm1, ymm2, yword [rax] +vfmaddsub132pd ymm1, ymm2, [rax] +vfmaddsub231pd ymm1, ymm2, ymm3 +vfmaddsub231pd ymm1, ymm2, yword [rax] +vfmaddsub231pd ymm1, ymm2, [rax] +vfmaddsub213pd ymm1, ymm2, ymm3 +vfmaddsub213pd ymm1, ymm2, yword [rax] +vfmaddsub213pd ymm1, ymm2, [rax] +vfmsubadd132ps xmm1, xmm2, xmm3 +vfmsubadd132ps xmm1, xmm2, xmm3 +vfmsubadd132ps xmm1, xmm2, [rax] +vfmsubadd231ps xmm1, xmm2, xmm3 +vfmsubadd231ps xmm1, xmm2, xmm3 +vfmsubadd231ps xmm1, xmm2, [rax] +vfmsubadd213ps xmm1, xmm2, xmm3 +vfmsubadd213ps xmm1, xmm2, xmm3 +vfmsubadd213ps xmm1, xmm2, [rax] +vfmsubadd132ps ymm1, ymm2, ymm3 +vfmsubadd132ps ymm1, ymm2, yword [rax] +vfmsubadd132ps ymm1, ymm2, [rax] +vfmsubadd231ps ymm1, ymm2, ymm3 +vfmsubadd231ps ymm1, ymm2, yword [rax] +vfmsubadd231ps ymm1, ymm2, [rax] +vfmsubadd213ps ymm1, ymm2, ymm3 +vfmsubadd213ps ymm1, ymm2, yword [rax] +vfmsubadd213ps ymm1, ymm2, [rax] +vfmsubadd132pd xmm1, xmm2, xmm3 +vfmsubadd132pd xmm1, xmm2, dqword [rax] +vfmsubadd132pd xmm1, xmm2, [rax] +vfmsubadd231pd xmm1, xmm2, xmm3 +vfmsubadd231pd xmm1, xmm2, dqword [rax] +vfmsubadd231pd xmm1, xmm2, [rax] +vfmsubadd213pd xmm1, xmm2, xmm3 +vfmsubadd213pd xmm1, xmm2, dqword [rax] +vfmsubadd213pd xmm1, xmm2, [rax] +vfmsubadd132pd ymm1, ymm2, ymm3 +vfmsubadd132pd ymm1, ymm2, yword [rax] +vfmsubadd132pd ymm1, ymm2, [rax] +vfmsubadd231pd ymm1, ymm2, ymm3 +vfmsubadd231pd ymm1, ymm2, yword [rax] +vfmsubadd231pd ymm1, ymm2, [rax] +vfmsubadd213pd ymm1, ymm2, ymm3 +vfmsubadd213pd ymm1, ymm2, yword [rax] +vfmsubadd213pd ymm1, ymm2, [rax] diff --git a/modules/arch/x86/tests/fma.hex b/modules/arch/x86/tests/fma.hex new file mode 100644 index 00000000..161933f9 --- /dev/null +++ b/modules/arch/x86/tests/fma.hex @@ -0,0 +1,1440 @@ +c4 +e2 +69 +99 +cb +c4 +e2 +69 +99 +08 +c4 +e2 +69 +99 +08 +c4 +e2 +69 +b9 +cb +c4 +e2 +69 +b9 +08 +c4 +e2 +69 +b9 +08 +c4 +e2 +69 +a9 +cb +c4 +e2 +69 +a9 +08 +c4 +e2 +69 +a9 +08 +c4 +e2 +e9 +99 +cb +c4 +e2 +e9 +99 +08 +c4 +e2 +e9 +99 +08 +c4 +e2 +e9 +b9 +cb +c4 +e2 +e9 +b9 +08 +c4 +e2 +e9 +b9 +08 +c4 +e2 +e9 +a9 +cb +c4 +e2 +e9 +a9 +08 +c4 +e2 +e9 +a9 +08 +c4 +e2 +69 +98 +cb +c4 +e2 +69 +98 +cb +c4 +e2 +69 +98 +08 +c4 +e2 +69 +b8 +cb +c4 +e2 +69 +b8 +cb +c4 +e2 +69 +b8 +08 +c4 +e2 +69 +a8 +cb +c4 +e2 +69 +a8 +cb +c4 +e2 +69 +a8 +08 +c4 +e2 +6d +98 +cb +c4 +e2 +6d +98 +08 +c4 +e2 +6d +98 +08 +c4 +e2 +6d +b8 +cb +c4 +e2 +6d +b8 +08 +c4 +e2 +6d +b8 +08 +c4 +e2 +6d +a8 +cb +c4 +e2 +6d +a8 +08 +c4 +e2 +6d +a8 +08 +c4 +e2 +e9 +98 +cb +c4 +e2 +e9 +98 +08 +c4 +e2 +e9 +98 +08 +c4 +e2 +e9 +b8 +cb +c4 +e2 +e9 +b8 +08 +c4 +e2 +e9 +b8 +08 +c4 +e2 +e9 +a8 +cb +c4 +e2 +e9 +a8 +08 +c4 +e2 +e9 +a8 +08 +c4 +e2 +ed +98 +cb +c4 +e2 +ed +98 +08 +c4 +e2 +ed +98 +08 +c4 +e2 +ed +b8 +cb +c4 +e2 +ed +b8 +08 +c4 +e2 +ed +b8 +08 +c4 +e2 +ed +a8 +cb +c4 +e2 +ed +a8 +08 +c4 +e2 +ed +a8 +08 +c4 +e2 +69 +9b +cb +c4 +e2 +69 +9b +08 +c4 +e2 +69 +9b +08 +c4 +e2 +69 +bb +cb +c4 +e2 +69 +bb +08 +c4 +e2 +69 +bb +08 +c4 +e2 +69 +ab +cb +c4 +e2 +69 +ab +08 +c4 +e2 +69 +ab +08 +c4 +e2 +e9 +9b +cb +c4 +e2 +e9 +9b +08 +c4 +e2 +e9 +9b +08 +c4 +e2 +e9 +bb +cb +c4 +e2 +e9 +bb +08 +c4 +e2 +e9 +bb +08 +c4 +e2 +e9 +ab +cb +c4 +e2 +e9 +ab +08 +c4 +e2 +e9 +ab +08 +c4 +e2 +69 +9a +cb +c4 +e2 +69 +9a +cb +c4 +e2 +69 +9a +08 +c4 +e2 +69 +ba +cb +c4 +e2 +69 +ba +cb +c4 +e2 +69 +ba +08 +c4 +e2 +69 +aa +cb +c4 +e2 +69 +aa +cb +c4 +e2 +69 +aa +08 +c4 +e2 +6d +9a +cb +c4 +e2 +6d +9a +08 +c4 +e2 +6d +9a +08 +c4 +e2 +6d +ba +cb +c4 +e2 +6d +ba +08 +c4 +e2 +6d +ba +08 +c4 +e2 +6d +aa +cb +c4 +e2 +6d +aa +08 +c4 +e2 +6d +aa +08 +c4 +e2 +e9 +9a +cb +c4 +e2 +e9 +9a +08 +c4 +e2 +e9 +9a +08 +c4 +e2 +e9 +ba +cb +c4 +e2 +e9 +ba +08 +c4 +e2 +e9 +ba +08 +c4 +e2 +e9 +aa +cb +c4 +e2 +e9 +aa +08 +c4 +e2 +e9 +aa +08 +c4 +e2 +ed +9a +cb +c4 +e2 +ed +9a +08 +c4 +e2 +ed +9a +08 +c4 +e2 +ed +ba +cb +c4 +e2 +ed +ba +08 +c4 +e2 +ed +ba +08 +c4 +e2 +ed +aa +cb +c4 +e2 +ed +aa +08 +c4 +e2 +ed +aa +08 +c4 +e2 +69 +9d +cb +c4 +e2 +69 +9d +08 +c4 +e2 +69 +9d +08 +c4 +e2 +69 +bd +cb +c4 +e2 +69 +bd +08 +c4 +e2 +69 +bd +08 +c4 +e2 +69 +ad +cb +c4 +e2 +69 +ad +08 +c4 +e2 +69 +ad +08 +c4 +e2 +e9 +9d +cb +c4 +e2 +e9 +9d +08 +c4 +e2 +e9 +9d +08 +c4 +e2 +e9 +bd +cb +c4 +e2 +e9 +bd +08 +c4 +e2 +e9 +bd +08 +c4 +e2 +e9 +ad +cb +c4 +e2 +e9 +ad +08 +c4 +e2 +e9 +ad +08 +c4 +e2 +69 +9c +cb +c4 +e2 +69 +9c +cb +c4 +e2 +69 +9c +08 +c4 +e2 +69 +bc +cb +c4 +e2 +69 +bc +cb +c4 +e2 +69 +bc +08 +c4 +e2 +69 +ac +cb +c4 +e2 +69 +ac +cb +c4 +e2 +69 +ac +08 +c4 +e2 +6d +9c +cb +c4 +e2 +6d +9c +08 +c4 +e2 +6d +9c +08 +c4 +e2 +6d +bc +cb +c4 +e2 +6d +bc +08 +c4 +e2 +6d +bc +08 +c4 +e2 +6d +ac +cb +c4 +e2 +6d +ac +08 +c4 +e2 +6d +ac +08 +c4 +e2 +e9 +9c +cb +c4 +e2 +e9 +9c +08 +c4 +e2 +e9 +9c +08 +c4 +e2 +e9 +bc +cb +c4 +e2 +e9 +bc +08 +c4 +e2 +e9 +bc +08 +c4 +e2 +e9 +ac +cb +c4 +e2 +e9 +ac +08 +c4 +e2 +e9 +ac +08 +c4 +e2 +ed +9c +cb +c4 +e2 +ed +9c +08 +c4 +e2 +ed +9c +08 +c4 +e2 +ed +bc +cb +c4 +e2 +ed +bc +08 +c4 +e2 +ed +bc +08 +c4 +e2 +ed +ac +cb +c4 +e2 +ed +ac +08 +c4 +e2 +ed +ac +08 +c4 +e2 +69 +9f +cb +c4 +e2 +69 +9f +08 +c4 +e2 +69 +9f +08 +c4 +e2 +69 +bf +cb +c4 +e2 +69 +bf +08 +c4 +e2 +69 +bf +08 +c4 +e2 +69 +af +cb +c4 +e2 +69 +af +08 +c4 +e2 +69 +af +08 +c4 +e2 +e9 +9f +cb +c4 +e2 +e9 +9f +08 +c4 +e2 +e9 +9f +08 +c4 +e2 +e9 +bf +cb +c4 +e2 +e9 +bf +08 +c4 +e2 +e9 +bf +08 +c4 +e2 +e9 +af +cb +c4 +e2 +e9 +af +08 +c4 +e2 +e9 +af +08 +c4 +e2 +69 +9e +cb +c4 +e2 +69 +9e +cb +c4 +e2 +69 +9e +08 +c4 +e2 +69 +be +cb +c4 +e2 +69 +be +cb +c4 +e2 +69 +be +08 +c4 +e2 +69 +ae +cb +c4 +e2 +69 +ae +cb +c4 +e2 +69 +ae +08 +c4 +e2 +6d +9e +cb +c4 +e2 +6d +9e +08 +c4 +e2 +6d +9e +08 +c4 +e2 +6d +be +cb +c4 +e2 +6d +be +08 +c4 +e2 +6d +be +08 +c4 +e2 +6d +ae +cb +c4 +e2 +6d +ae +08 +c4 +e2 +6d +ae +08 +c4 +e2 +e9 +9e +cb +c4 +e2 +e9 +9e +08 +c4 +e2 +e9 +9e +08 +c4 +e2 +e9 +be +cb +c4 +e2 +e9 +be +08 +c4 +e2 +e9 +be +08 +c4 +e2 +e9 +ae +cb +c4 +e2 +e9 +ae +08 +c4 +e2 +e9 +ae +08 +c4 +e2 +ed +9e +cb +c4 +e2 +ed +9e +08 +c4 +e2 +ed +9e +08 +c4 +e2 +ed +be +cb +c4 +e2 +ed +be +08 +c4 +e2 +ed +be +08 +c4 +e2 +ed +ae +cb +c4 +e2 +ed +ae +08 +c4 +e2 +ed +ae +08 +c4 +e2 +69 +96 +cb +c4 +e2 +69 +96 +cb +c4 +e2 +69 +96 +08 +c4 +e2 +69 +b6 +cb +c4 +e2 +69 +b6 +cb +c4 +e2 +69 +b6 +08 +c4 +e2 +69 +a6 +cb +c4 +e2 +69 +a6 +cb +c4 +e2 +69 +a6 +08 +c4 +e2 +6d +96 +cb +c4 +e2 +6d +96 +08 +c4 +e2 +6d +96 +08 +c4 +e2 +6d +b6 +cb +c4 +e2 +6d +b6 +08 +c4 +e2 +6d +b6 +08 +c4 +e2 +6d +a6 +cb +c4 +e2 +6d +a6 +08 +c4 +e2 +6d +a6 +08 +c4 +e2 +e9 +96 +cb +c4 +e2 +e9 +96 +08 +c4 +e2 +e9 +96 +08 +c4 +e2 +e9 +b6 +cb +c4 +e2 +e9 +b6 +08 +c4 +e2 +e9 +b6 +08 +c4 +e2 +e9 +a6 +cb +c4 +e2 +e9 +a6 +08 +c4 +e2 +e9 +a6 +08 +c4 +e2 +ed +96 +cb +c4 +e2 +ed +96 +08 +c4 +e2 +ed +96 +08 +c4 +e2 +ed +b6 +cb +c4 +e2 +ed +b6 +08 +c4 +e2 +ed +b6 +08 +c4 +e2 +ed +a6 +cb +c4 +e2 +ed +a6 +08 +c4 +e2 +ed +a6 +08 +c4 +e2 +69 +97 +cb +c4 +e2 +69 +97 +cb +c4 +e2 +69 +97 +08 +c4 +e2 +69 +b7 +cb +c4 +e2 +69 +b7 +cb +c4 +e2 +69 +b7 +08 +c4 +e2 +69 +a7 +cb +c4 +e2 +69 +a7 +cb +c4 +e2 +69 +a7 +08 +c4 +e2 +6d +97 +cb +c4 +e2 +6d +97 +08 +c4 +e2 +6d +97 +08 +c4 +e2 +6d +b7 +cb +c4 +e2 +6d +b7 +08 +c4 +e2 +6d +b7 +08 +c4 +e2 +6d +a7 +cb +c4 +e2 +6d +a7 +08 +c4 +e2 +6d +a7 +08 +c4 +e2 +e9 +97 +cb +c4 +e2 +e9 +97 +08 +c4 +e2 +e9 +97 +08 +c4 +e2 +e9 +b7 +cb +c4 +e2 +e9 +b7 +08 +c4 +e2 +e9 +b7 +08 +c4 +e2 +e9 +a7 +cb +c4 +e2 +e9 +a7 +08 +c4 +e2 +e9 +a7 +08 +c4 +e2 +ed +97 +cb +c4 +e2 +ed +97 +08 +c4 +e2 +ed +97 +08 +c4 +e2 +ed +b7 +cb +c4 +e2 +ed +b7 +08 +c4 +e2 +ed +b7 +08 +c4 +e2 +ed +a7 +cb +c4 +e2 +ed +a7 +08 +c4 +e2 +ed +a7 +08 diff --git a/modules/arch/x86/tests/fsgsbase.asm b/modules/arch/x86/tests/fsgsbase.asm new file mode 100644 index 00000000..bae73013 --- /dev/null +++ b/modules/arch/x86/tests/fsgsbase.asm @@ -0,0 +1,10 @@ +[bits 64] +rdfsbase ebx +rdfsbase rbx +rdgsbase ecx +rdgsbase rcx + +wrfsbase ebx +wrfsbase rbx +wrgsbase ecx +wrgsbase rcx diff --git a/modules/arch/x86/tests/fsgsbase.hex b/modules/arch/x86/tests/fsgsbase.hex new file mode 100644 index 00000000..27b5eee0 --- /dev/null +++ b/modules/arch/x86/tests/fsgsbase.hex @@ -0,0 +1,36 @@ +f3 +0f +ae +c3 +f3 +48 +0f +ae +c3 +f3 +0f +ae +c9 +f3 +48 +0f +ae +c9 +f3 +0f +ae +d3 +f3 +48 +0f +ae +d3 +f3 +0f +ae +d9 +f3 +48 +0f +ae +d9 diff --git a/modules/arch/x86/tests/gas32/Makefile.inc b/modules/arch/x86/tests/gas32/Makefile.inc index fbb8ccf4..2f58c668 100644 --- a/modules/arch/x86/tests/gas32/Makefile.inc +++ b/modules/arch/x86/tests/gas32/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/arch/x86/tests/gas32/x86_gas32_test.sh EXTRA_DIST += modules/arch/x86/tests/gas32/x86_gas32_test.sh @@ -7,8 +5,20 @@ EXTRA_DIST += modules/arch/x86/tests/gas32/align32.asm EXTRA_DIST += modules/arch/x86/tests/gas32/align32.hex EXTRA_DIST += modules/arch/x86/tests/gas32/gas-farithr.asm EXTRA_DIST += modules/arch/x86/tests/gas32/gas-farithr.hex +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-farjump.asm +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-farjump.hex +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-fpmem.asm +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-fpmem.hex +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-invlpg.asm +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-invlpg.hex +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-loop32.asm +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-loop32.hex EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movdq32.asm EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movdq32.hex +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movsd.asm +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movsd.hex +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-pop.asm +EXTRA_DIST += modules/arch/x86/tests/gas32/gas-pop.hex EXTRA_DIST += modules/arch/x86/tests/gas32/gas32-jmpcall.asm EXTRA_DIST += modules/arch/x86/tests/gas32/gas32-jmpcall.hex diff --git a/modules/arch/x86/tests/gas32/align32.hex b/modules/arch/x86/tests/gas32/align32.hex index 77181969..8fb42419 100644 --- a/modules/arch/x86/tests/gas32/align32.hex +++ b/modules/arch/x86/tests/gas32/align32.hex @@ -228,8 +228,8 @@ ff 00 ff ff -89 -f6 +66 +90 ff 90 00 diff --git a/modules/arch/x86/tests/gas32/gas-farjump.asm b/modules/arch/x86/tests/gas32/gas-farjump.asm new file mode 100644 index 00000000..6d890da2 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-farjump.asm @@ -0,0 +1,13 @@ +call $0x1234, $0x567890ab +lcall $0x1234, $0x567890ab +jmp $0x1234, $0x567890ab +ljmp $0x1234, $0x567890ab +ljmp *(%eax) +lcall *(%eax) +jmp *(%eax) +call *(%eax) +jmp *%eax +call *%eax +ret +lret +lret $0x100 diff --git a/modules/arch/x86/tests/gas32/gas-farjump.hex b/modules/arch/x86/tests/gas32/gas-farjump.hex new file mode 100644 index 00000000..839492d4 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-farjump.hex @@ -0,0 +1,408 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +d0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +9a +ab +90 +78 +56 +34 +12 +9a +ab +90 +78 +56 +34 +12 +ea +ab +90 +78 +56 +34 +12 +ea +ab +90 +78 +56 +34 +12 +ff +28 +ff +18 +ff +20 +ff +10 +ff +e0 +ff +d0 +c3 +cb +ca +00 +01 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +70 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +94 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +98 +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas32/gas-fpmem.asm b/modules/arch/x86/tests/gas32/gas-fpmem.asm new file mode 100644 index 00000000..ca905308 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-fpmem.asm @@ -0,0 +1,11 @@ +.text +fcomp +fcomp %st(1) +fcomp 0(%eax) +fcomps 0(%eax) +fcompl 0(%eax) + +fistp 0(%eax) +fistps 0(%eax) +fistpl 0(%eax) + diff --git a/modules/arch/x86/tests/gas32/gas-fpmem.hex b/modules/arch/x86/tests/gas32/gas-fpmem.hex new file mode 100644 index 00000000..81d6a3a0 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-fpmem.hex @@ -0,0 +1,376 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +d8 +d9 +d8 +d9 +d8 +18 +d8 +18 +dc +18 +df +18 +df +18 +db +18 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +50 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +74 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +78 +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas32/gas-invlpg.asm b/modules/arch/x86/tests/gas32/gas-invlpg.asm new file mode 100644 index 00000000..f7d6faa9 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-invlpg.asm @@ -0,0 +1,2 @@ +invlpg (%eax) + diff --git a/modules/arch/x86/tests/gas32/gas-invlpg.hex b/modules/arch/x86/tests/gas32/gas-invlpg.hex new file mode 100644 index 00000000..c40e0506 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-invlpg.hex @@ -0,0 +1,360 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +01 +38 +00 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +44 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +68 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas32/gas-loop32.asm b/modules/arch/x86/tests/gas32/gas-loop32.asm new file mode 100644 index 00000000..3b5777de --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-loop32.asm @@ -0,0 +1,5 @@ +loop label +loopw label +loopl label +#loopq label +label: diff --git a/modules/arch/x86/tests/gas32/gas-loop32.hex b/modules/arch/x86/tests/gas32/gas-loop32.hex new file mode 100644 index 00000000..5bf161bc --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-loop32.hex @@ -0,0 +1,376 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +e2 +05 +67 +e2 +02 +e2 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +70 +00 +00 +00 +40 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas32/gas-movsd.asm b/modules/arch/x86/tests/gas32/gas-movsd.asm new file mode 100644 index 00000000..3d3c0c73 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-movsd.asm @@ -0,0 +1,3 @@ +.text +movsd +movsl diff --git a/modules/arch/x86/tests/gas32/gas-movsd.hex b/modules/arch/x86/tests/gas32/gas-movsd.hex new file mode 100644 index 00000000..70701e6d --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-movsd.hex @@ -0,0 +1,360 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a5 +a5 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +44 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +68 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas32/gas-pop.asm b/modules/arch/x86/tests/gas32/gas-pop.asm new file mode 100644 index 00000000..7c47ebef --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-pop.asm @@ -0,0 +1,50 @@ +.code64 +push %cx # out: 66 51 +pop %cx # out: 66 59 +push %rcx # out: 51 +pop %rcx # out: 59 +pushw %cx # out: 66 51 +popw %cx # out: 66 59 +pushq %rcx # out: 51 +popq %rcx # out: 59 + +push -24(%rcx) # out: ff 71 e8 +pop -24(%rcx) # out: 8f 41 e8 +pushw -24(%rcx) # out: 66 ff 71 e8 +popw -24(%rcx) # out: 66 8f 41 e8 +pushq -24(%rcx) # out: ff 71 e8 +popq -24(%rcx) # out: 8f 41 e8 + +.code32 +push %cx # out: 66 51 +pop %cx # out: 66 59 +push %ecx # out: 51 +pop %ecx # out: 59 +pushw %cx # out: 66 51 +popw %cx # out: 66 59 +pushl %ecx # out: 51 +popl %ecx # out: 59 + +push -24(%ecx) # out: ff 71 e8 +pop -24(%ecx) # out: 8f 41 e8 +pushw -24(%ecx) # out: 66 ff 71 e8 +popw -24(%ecx) # out: 66 8f 41 e8 +pushl -24(%ecx) # out: ff 71 e8 +popl -24(%ecx) # out: 8f 41 e8 + +.code16 +push %cx # out: 51 +pop %cx # out: 59 +push %ecx # out: 66 51 +pop %ecx # out: 66 59 +pushw %cx # out: 51 +popw %cx # out: 59 +pushl %ecx # out: 66 51 +popl %ecx # out: 66 59 + +push -24(%bp) # out: ff 76 e8 +pop -24(%bp) # out: 8f 46 e8 +pushw -24(%bp) # out: ff 76 e8 +popw -24(%bp) # out: 8f 46 e8 +pushl -24(%bp) # out: 66 ff 76 e8 +popl -24(%bp) # out: 66 8f 46 e8 diff --git a/modules/arch/x86/tests/gas32/gas-pop.hex b/modules/arch/x86/tests/gas32/gas-pop.hex new file mode 100644 index 00000000..30744378 --- /dev/null +++ b/modules/arch/x86/tests/gas32/gas-pop.hex @@ -0,0 +1,456 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +66 +51 +66 +59 +51 +59 +66 +51 +66 +59 +51 +59 +ff +71 +e8 +8f +41 +e8 +66 +ff +71 +e8 +66 +8f +41 +e8 +ff +71 +e8 +8f +41 +e8 +66 +51 +66 +59 +51 +59 +66 +51 +66 +59 +51 +59 +ff +71 +e8 +8f +41 +e8 +66 +ff +71 +e8 +66 +8f +41 +e8 +ff +71 +e8 +8f +41 +e8 +51 +59 +66 +51 +66 +59 +51 +59 +66 +51 +66 +59 +ff +76 +e8 +8f +46 +e8 +ff +76 +e8 +8f +46 +e8 +66 +ff +76 +e8 +66 +8f +46 +e8 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a0 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c4 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c8 +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +60 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas32/x86_gas32_test.sh b/modules/arch/x86/tests/gas32/x86_gas32_test.sh index af84899e..b1d6c03c 100755 --- a/modules/arch/x86/tests/gas32/x86_gas32_test.sh +++ b/modules/arch/x86/tests/gas32/x86_gas32_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh x86_gas32_test modules/arch/x86/tests/gas32 "x86 gas format" "-f elf32 -p gas" ".o" exit $? diff --git a/modules/arch/x86/tests/gas64/Makefile.inc b/modules/arch/x86/tests/gas64/Makefile.inc index ab6589aa..00baf626 100644 --- a/modules/arch/x86/tests/gas64/Makefile.inc +++ b/modules/arch/x86/tests/gas64/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/arch/x86/tests/gas64/x86_gas64_test.sh EXTRA_DIST += modules/arch/x86/tests/gas64/x86_gas64_test.sh @@ -11,6 +9,8 @@ EXTRA_DIST += modules/arch/x86/tests/gas64/gas-fp.asm EXTRA_DIST += modules/arch/x86/tests/gas64/gas-fp.hex EXTRA_DIST += modules/arch/x86/tests/gas64/gas-inout.asm EXTRA_DIST += modules/arch/x86/tests/gas64/gas-inout.hex +EXTRA_DIST += modules/arch/x86/tests/gas64/gas-loop64.asm +EXTRA_DIST += modules/arch/x86/tests/gas64/gas-loop64.hex EXTRA_DIST += modules/arch/x86/tests/gas64/gas-moreinsn.asm EXTRA_DIST += modules/arch/x86/tests/gas64/gas-moreinsn.hex EXTRA_DIST += modules/arch/x86/tests/gas64/gas-movabs.asm diff --git a/modules/arch/x86/tests/gas64/align64.hex b/modules/arch/x86/tests/gas64/align64.hex index 3e9c5c1d..ecfbf7ab 100644 --- a/modules/arch/x86/tests/gas64/align64.hex +++ b/modules/arch/x86/tests/gas64/align64.hex @@ -66,50 +66,50 @@ ff 66 66 66 -90 66 66 66 -90 -66 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 ff ff 66 66 66 -90 66 66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 ff ff ff 66 66 66 -90 66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 ff ff ff @@ -117,15 +117,15 @@ ff 66 66 66 -90 -66 -66 -66 -90 -66 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 ff ff ff @@ -133,15 +133,15 @@ ff ff 66 66 -66 -90 -66 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 ff ff ff @@ -149,15 +149,15 @@ ff ff ff 66 -66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 ff ff ff @@ -166,14 +166,14 @@ ff ff ff 66 -66 -90 -66 -66 -90 -66 -66 -90 +0f +1f +84 +00 +00 +00 +00 +00 ff ff ff @@ -182,50 +182,50 @@ ff ff ff ff -66 -66 -66 -90 -66 -66 -66 -90 +0f +1f +84 +00 +00 +00 +00 +00 ff -66 -66 -66 -90 -66 -66 -90 +0f +1f +80 +00 +00 +00 +00 ff ff 66 -66 -90 -66 -66 -90 +0f +1f +44 +00 +00 ff ff ff -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 ff ff ff ff -66 -66 -66 -90 +0f +1f +40 +00 ff -66 -66 -90 +0f +1f +00 ff ff 66 diff --git a/modules/arch/x86/tests/gas64/gas-loop64.asm b/modules/arch/x86/tests/gas64/gas-loop64.asm new file mode 100644 index 00000000..d441ad69 --- /dev/null +++ b/modules/arch/x86/tests/gas64/gas-loop64.asm @@ -0,0 +1,5 @@ +loop label +#loopw label +loopl label +loopq label +label: diff --git a/modules/arch/x86/tests/gas64/gas-loop64.hex b/modules/arch/x86/tests/gas64/gas-loop64.hex new file mode 100644 index 00000000..7c1e9246 --- /dev/null +++ b/modules/arch/x86/tests/gas64/gas-loop64.hex @@ -0,0 +1,528 @@ +7f +45 +4c +46 +02 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +d0 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +40 +00 +05 +00 +01 +00 +e2 +05 +67 +e2 +02 +e2 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +00 +00 +00 +00 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +70 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/gas64/gas-moreinsn.hex b/modules/arch/x86/tests/gas64/gas-moreinsn.hex index 399c179a..fa76e393 100644 --- a/modules/arch/x86/tests/gas64/gas-moreinsn.hex +++ b/modules/arch/x86/tests/gas64/gas-moreinsn.hex @@ -208,7 +208,6 @@ c1 c4 c0 05 -48 0f c4 c8 @@ -219,7 +218,6 @@ c4 c0 05 66 -48 0f c4 c8 @@ -227,7 +225,6 @@ c8 0f d7 c0 -48 0f d7 c0 @@ -236,7 +233,6 @@ c0 d7 c0 66 -48 0f d7 c0 @@ -462,6 +458,10 @@ ff 00 00 00 +00 +00 +00 +00 17 00 00 @@ -486,7 +486,7 @@ ff 00 00 00 -20 +1c 01 00 00 @@ -550,7 +550,7 @@ ff 00 00 00 -44 +40 01 00 00 @@ -614,7 +614,7 @@ ff 00 00 00 -48 +44 01 00 00 @@ -686,7 +686,7 @@ ff 00 00 00 -e0 +dc 00 00 00 diff --git a/modules/arch/x86/tests/gas64/gas-movsxs.asm b/modules/arch/x86/tests/gas64/gas-movsxs.asm index 1aa1e97e..7216a8ca 100644 --- a/modules/arch/x86/tests/gas64/gas-movsxs.asm +++ b/modules/arch/x86/tests/gas64/gas-movsxs.asm @@ -16,3 +16,17 @@ movzbw %al, %ax movzwl %ax, %eax movzbq %al, %rax movzwq %ax, %rax + +movsbw 5,%ax +movsbl 5,%eax +movswl 5,%eax +movsbq 5,%rax +movswq 5,%rax +movsx 5,%eax +movzbw 5,%ax +movzbl 5,%eax +movzwl 5,%eax +movzbq 5,%rax +movzwq 5,%rax +movzx 5,%eax + diff --git a/modules/arch/x86/tests/gas64/gas-movsxs.hex b/modules/arch/x86/tests/gas64/gas-movsxs.hex index dc1dfd30..50abeba2 100644 --- a/modules/arch/x86/tests/gas64/gas-movsxs.hex +++ b/modules/arch/x86/tests/gas64/gas-movsxs.hex @@ -38,8 +38,8 @@ 00 00 00 -e0 -00 +40 +01 00 00 00 @@ -101,6 +101,110 @@ c0 0f b7 c0 +66 +0f +be +04 +25 +05 +00 +00 +00 +0f +be +04 +25 +05 +00 +00 +00 +0f +bf +04 +25 +05 +00 +00 +00 +48 +0f +be +04 +25 +05 +00 +00 +00 +48 +0f +bf +04 +25 +05 +00 +00 +00 +0f +be +04 +25 +05 +00 +00 +00 +66 +0f +b6 +04 +25 +05 +00 +00 +00 +0f +b6 +04 +25 +05 +00 +00 +00 +0f +b7 +04 +25 +05 +00 +00 +00 +48 +0f +b6 +04 +25 +05 +00 +00 +00 +48 +0f +b7 +04 +25 +05 +00 +00 +00 +0f +b6 +04 +25 +05 +00 +00 +00 +00 +00 00 00 2e @@ -278,14 +382,6 @@ ff 00 00 00 -00 -00 -00 -00 -00 -00 -00 -00 17 00 00 @@ -310,7 +406,7 @@ ff 00 00 00 -68 +d0 00 00 00 @@ -374,7 +470,7 @@ ff 00 00 00 -8c +f4 00 00 00 @@ -438,7 +534,7 @@ ff 00 00 00 -90 +f8 00 00 00 @@ -510,7 +606,7 @@ ff 00 00 00 -27 +8d 00 00 00 diff --git a/modules/arch/x86/tests/gas64/x86_gas64_test.sh b/modules/arch/x86/tests/gas64/x86_gas64_test.sh index 3379775c..b5b2cdf3 100755 --- a/modules/arch/x86/tests/gas64/x86_gas64_test.sh +++ b/modules/arch/x86/tests/gas64/x86_gas64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh x86_gas64_test modules/arch/x86/tests/gas64 "amd64 gas format" "-f elf -m amd64 -p gas" ".o" exit $? diff --git a/modules/arch/x86/tests/gen-fma-test.py b/modules/arch/x86/tests/gen-fma-test.py new file mode 100755 index 00000000..a8f4e025 --- /dev/null +++ b/modules/arch/x86/tests/gen-fma-test.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +def emit(opcode,suffix,width,order,optype): + d = {} + d['opcode']=opcode + d['suffix']=suffix + d['order']=order + if width == 128: + d['op1']= 'xmm1' + d['op2']= 'xmm2' + d['op3']= 'xmm3' + if optype == 'rrr': + d['op3']= 'xmm3' + elif suffix == 'pd': + d['op3']= 'dqword [rax]' + elif suffix == 'sd': + d['op3']= 'qword [rax]' + elif suffix == 'ss': + d['op3']= 'dword [rax]' + else: + d['op1']= 'ymm1' + d['op2']= 'ymm2' + if optype == 'rrr': + d['op3']= 'ymm3' + else: + d['op3']= 'yword [rax]' + + + print "v%(opcode)s%(order)s%(suffix)s %(op1)s, %(op2)s, %(op3)s" % (d) + if optype == 'rrm': + d['op3']= '[rax]' + print "v%(opcode)s%(order)s%(suffix)s %(op1)s, %(op2)s, %(op3)s" % (d) + +def gen(opcodes, combos, optypes, orders): + for opcode in opcodes: + for (suffix,width) in combos: + for order in orders: + for optype in optypes: + emit(opcode,suffix,width,order,optype) + + +if __name__ == '__main__': + orders = ['132', '231', '213'] + + all_combos = [('ss',128), + ('sd',128), + ('ps',128), + ('ps',256), + ('pd',128), + ('pd',256) ] + packed_combos = [ ('ps',128), + ('ps',256), + ('pd',128), + ('pd',256) ] + + opcodes1 = ['fmadd', 'fmsub', 'fnmadd', 'fnmsub'] + opcodes2 = ['fmaddsub', 'fmsubadd'] + + optypes = ['rrr','rrm'] + + print "[bits 64]" + gen(opcodes1, all_combos,optypes, orders) + gen(opcodes2, packed_combos,optypes, orders) diff --git a/modules/arch/x86/tests/genopcode.asm b/modules/arch/x86/tests/genopcode.asm index f37695d3..357c010e 100644 --- a/modules/arch/x86/tests/genopcode.asm +++ b/modules/arch/x86/tests/genopcode.asm @@ -168,6 +168,9 @@ jmp near label jmp far [label] jmp far dword [label] call far word [label] +loop short label +jcxz short label +jecxz short label [bits 16] push si push esi diff --git a/modules/arch/x86/tests/genopcode.hex b/modules/arch/x86/tests/genopcode.hex index d6a562d2..37b3cf94 100644 --- a/modules/arch/x86/tests/genopcode.hex +++ b/modules/arch/x86/tests/genopcode.hex @@ -482,6 +482,13 @@ ff 1e b9 01 +e2 +d3 +e3 +d1 +67 +e3 +ce 56 66 56 diff --git a/modules/arch/x86/tests/imm64.asm b/modules/arch/x86/tests/imm64.asm new file mode 100644 index 00000000..5b41bfae --- /dev/null +++ b/modules/arch/x86/tests/imm64.asm @@ -0,0 +1,35 @@ +bits 64 +default abs +;extern label1 +label1: +label2: + +mov rax, 0x1000 ; 32-bit imm +mov rax, 0x1122334455667788 ; 64-bit imm (larger than signed 32-bit) +;mov rax, 0x80000000 ; 64-bit imm (larger than signed 32-bit) +mov rax, label1 ; 32-bit imm <--- not 64-bit! +mov rax, label2 ; 32-bit imm <--- not 64-bit! +mov rax, qword 0x1000 ; 64-bit imm +mov rax, qword label1 ; 64-bit imm +mov rax, qword label2 ; 64-bit imm + +mov qword [rax], 0x1000 ; 32-bit imm +mov qword [rax], 0x1122334455667788 ; 32-bit imm, overflow warning +;mov qword [rax], 0x80000000 ; 32-bit imm, overflow warning +mov qword [rax], label1 ; 32-bit imm (matches default above) +mov qword [rax], label2 ; 32-bit imm (matches default above) + +add rax, 0x1000 ; 32-bit imm +add rax, 0x1122334455667788 ; 32-bit imm, overflow warning +;add rax, 0x80000000 ; 32-bit imm, overflow warning +add rax, label1 ; 32-bit imm (matches default above) +add rax, label2 ; 32-bit imm (matches default above) + +mov [0x1000], rax ; 32-bit disp +mov [abs 0x1122334455667788], rax ; 64-bit disp +mov [label1], rax ; 32-bit disp +mov [label2], rax ; 32-bit disp +mov [qword 0x1000], rax ; 64-bit disp +mov [qword label1], rax ; 64-bit disp +mov [qword label2], rax ; 64-bit disp + diff --git a/modules/arch/x86/tests/imm64.errwarn b/modules/arch/x86/tests/imm64.errwarn new file mode 100644 index 00000000..a0487353 --- /dev/null +++ b/modules/arch/x86/tests/imm64.errwarn @@ -0,0 +1,3 @@ +-:17: warning: value does not fit in 32 bit field +-:23: warning: value does not fit in 32 bit field +-:29: warning: value does not fit in 32 bit field diff --git a/modules/arch/x86/tests/imm64.hex b/modules/arch/x86/tests/imm64.hex new file mode 100644 index 00000000..af46a719 --- /dev/null +++ b/modules/arch/x86/tests/imm64.hex @@ -0,0 +1,175 @@ +48 +c7 +c0 +00 +10 +00 +00 +48 +b8 +88 +77 +66 +55 +44 +33 +22 +11 +48 +c7 +c0 +00 +00 +00 +00 +48 +c7 +c0 +00 +00 +00 +00 +48 +b8 +00 +10 +00 +00 +00 +00 +00 +00 +48 +b8 +00 +00 +00 +00 +00 +00 +00 +00 +48 +b8 +00 +00 +00 +00 +00 +00 +00 +00 +48 +c7 +00 +00 +10 +00 +00 +48 +c7 +00 +88 +77 +66 +55 +48 +c7 +00 +00 +00 +00 +00 +48 +c7 +00 +00 +00 +00 +00 +48 +05 +00 +10 +00 +00 +48 +05 +88 +77 +66 +55 +48 +05 +00 +00 +00 +00 +48 +05 +00 +00 +00 +00 +48 +89 +04 +25 +00 +10 +00 +00 +48 +89 +04 +25 +88 +77 +66 +55 +48 +89 +04 +25 +00 +00 +00 +00 +48 +89 +04 +25 +00 +00 +00 +00 +48 +a3 +00 +10 +00 +00 +00 +00 +00 +00 +48 +a3 +00 +00 +00 +00 +00 +00 +00 +00 +48 +a3 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/invpcid.asm b/modules/arch/x86/tests/invpcid.asm new file mode 100644 index 00000000..90f517aa --- /dev/null +++ b/modules/arch/x86/tests/invpcid.asm @@ -0,0 +1,6 @@ +[bits 32] +invpcid eax, oword [0] ; 66 0f 38 82 05 00 00 00 00 + +[bits 64] +invpcid rax, oword [0] ; 66 0f 38 82 04 25 00 00 00 00 + diff --git a/modules/arch/x86/tests/invpcid.hex b/modules/arch/x86/tests/invpcid.hex new file mode 100644 index 00000000..cfc8726b --- /dev/null +++ b/modules/arch/x86/tests/invpcid.hex @@ -0,0 +1,19 @@ +66 +0f +38 +82 +05 +00 +00 +00 +00 +66 +0f +38 +82 +04 +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/jmpfar.asm b/modules/arch/x86/tests/jmpfar.asm new file mode 100644 index 00000000..92ef261b --- /dev/null +++ b/modules/arch/x86/tests/jmpfar.asm @@ -0,0 +1,16 @@ +jmp 1234:5678 ; YASM: far jump +jmp near 1234:5678 ; YASM: near jump; NASM: mismatch in operand sizes +jmp far 1234:5678 ; YASM: far jump; NASM: mismatch in operand sizes +;dw seg (1234:5678) +far1 equ 1234:5678 +jmp far1 ; both: near jump +jmp near far1 ; both: near jump +jmp far far1 ; YASM: far jump; NASM: value referenced by FAR is not relocatable +dw seg far1 +jmp far2 ; both: near jump +jmp near far2 ; both: near jump +jmp far far2 ; YASM: far jump; NASM: value referenced by FAR is not relocatable +dw seg far2 +far2 equ 1234:5678 +;mov ax, [1234:5678] ; YASM: invalid segment in effective address; NASM: invalid segment override +;mov ax, 1234:5678 ; YASM: immediate does not support segment; NASM: invalid combination of opcode and operands diff --git a/modules/arch/x86/tests/jmpfar.hex b/modules/arch/x86/tests/jmpfar.hex new file mode 100644 index 00000000..f9d3ea42 --- /dev/null +++ b/modules/arch/x86/tests/jmpfar.hex @@ -0,0 +1,39 @@ +ea +2e +16 +d2 +04 +e9 +26 +16 +ea +2e +16 +d2 +04 +e9 +1e +16 +e9 +1b +16 +ea +2e +16 +d2 +04 +d2 +04 +e9 +11 +16 +e9 +0e +16 +ea +2e +16 +d2 +04 +d2 +04 diff --git a/modules/arch/x86/tests/larlsl.asm b/modules/arch/x86/tests/larlsl.asm new file mode 100644 index 00000000..51c3feca --- /dev/null +++ b/modules/arch/x86/tests/larlsl.asm @@ -0,0 +1,59 @@ +[bits 16] +lar ax, bx +lar ax, [bx] +lar ax, word [bx] +lar eax, bx +lar eax, ebx +lar eax, [bx] +lar eax, word [bx] + +lsl ax, bx +lsl ax, [bx] +lsl ax, word [bx] +lsl eax, bx +lsl eax, ebx +lsl eax, [bx] +lsl eax, word [bx] + +[bits 32] +lar ax, bx +lar ax, [ebx] +lar ax, word [ebx] +lar eax, bx +lar eax, ebx +lar eax, [ebx] +lar eax, word [ebx] + +lsl ax, bx +lsl ax, [ebx] +lsl ax, word [ebx] +lsl eax, bx +lsl eax, ebx +lsl eax, [ebx] +lsl eax, word [ebx] + +[bits 64] +lar ax, bx +lar ax, [rbx] +lar ax, word [rbx] +lar eax, bx +lar eax, ebx +lar eax, [rbx] +lar eax, word [rbx] +lar rax, bx +lar rax, ebx +lar rax, [rbx] +lar rax, word [rbx] + +lsl ax, bx +lsl ax, [rbx] +lsl ax, word [rbx] +lsl eax, bx +lsl eax, ebx +lsl eax, [rbx] +lsl eax, word [rbx] +lsl rax, bx +lsl rax, ebx +lsl rax, [rbx] +lsl rax, word [rbx] + diff --git a/modules/arch/x86/tests/larlsl.hex b/modules/arch/x86/tests/larlsl.hex new file mode 100644 index 00000000..38c8b973 --- /dev/null +++ b/modules/arch/x86/tests/larlsl.hex @@ -0,0 +1,178 @@ +0f +02 +c3 +0f +02 +07 +0f +02 +07 +66 +0f +02 +c3 +66 +0f +02 +c3 +66 +0f +02 +07 +66 +0f +02 +07 +0f +03 +c3 +0f +03 +07 +0f +03 +07 +66 +0f +03 +c3 +66 +0f +03 +c3 +66 +0f +03 +07 +66 +0f +03 +07 +66 +0f +02 +c3 +66 +0f +02 +03 +66 +0f +02 +03 +0f +02 +c3 +0f +02 +c3 +0f +02 +03 +0f +02 +03 +66 +0f +03 +c3 +66 +0f +03 +03 +66 +0f +03 +03 +0f +03 +c3 +0f +03 +c3 +0f +03 +03 +0f +03 +03 +66 +0f +02 +c3 +66 +0f +02 +03 +66 +0f +02 +03 +0f +02 +c3 +0f +02 +c3 +0f +02 +03 +0f +02 +03 +48 +0f +02 +c3 +48 +0f +02 +c3 +48 +0f +02 +03 +48 +0f +02 +03 +66 +0f +03 +c3 +66 +0f +03 +03 +66 +0f +03 +03 +0f +03 +c3 +0f +03 +c3 +0f +03 +03 +0f +03 +03 +48 +0f +03 +c3 +48 +0f +03 +c3 +48 +0f +03 +03 +48 +0f +03 +03 diff --git a/modules/arch/x86/tests/lds-err.errwarn b/modules/arch/x86/tests/lds-err.errwarn deleted file mode 100644 index cd07464a..00000000 --- a/modules/arch/x86/tests/lds-err.errwarn +++ /dev/null @@ -1,4 +0,0 @@ --:2: invalid size for operand 2 --:3: invalid size for operand 2 --:5: invalid size for operand 2 --:6: invalid size for operand 2 diff --git a/modules/arch/x86/tests/lds-err.asm b/modules/arch/x86/tests/lds.asm similarity index 100% rename from modules/arch/x86/tests/lds-err.asm rename to modules/arch/x86/tests/lds.asm diff --git a/modules/arch/x86/tests/lds.hex b/modules/arch/x86/tests/lds.hex new file mode 100644 index 00000000..c3909546 --- /dev/null +++ b/modules/arch/x86/tests/lds.hex @@ -0,0 +1,27 @@ +c5 +06 +01 +00 +c5 +06 +01 +00 +c5 +06 +01 +00 +66 +c5 +06 +01 +00 +66 +c5 +06 +01 +00 +66 +c5 +06 +01 +00 diff --git a/modules/arch/x86/tests/lfs64.asm b/modules/arch/x86/tests/lfs64.asm new file mode 100644 index 00000000..5ee04760 --- /dev/null +++ b/modules/arch/x86/tests/lfs64.asm @@ -0,0 +1,10 @@ +[bits 64] +lfs ax, [rbx] +lfs eax, [rbx] +lfs rax, [rbx] +lgs ax, [rbx] +lgs eax, [rbx] +lgs rax, [rbx] +lss ax, [rbx] +lss eax, [rbx] +lss rax, [rbx] diff --git a/modules/arch/x86/tests/lfs64.hex b/modules/arch/x86/tests/lfs64.hex new file mode 100644 index 00000000..8eb71864 --- /dev/null +++ b/modules/arch/x86/tests/lfs64.hex @@ -0,0 +1,33 @@ +66 +0f +b4 +03 +0f +b4 +03 +48 +0f +b4 +03 +66 +0f +b5 +03 +0f +b5 +03 +48 +0f +b5 +03 +66 +0f +b2 +03 +0f +b2 +03 +48 +0f +b2 +03 diff --git a/modules/arch/x86/tests/lzcnt.asm b/modules/arch/x86/tests/lzcnt.asm new file mode 100644 index 00000000..4e545dfa --- /dev/null +++ b/modules/arch/x86/tests/lzcnt.asm @@ -0,0 +1,8 @@ +[bits 64] + +lzcnt ax, bx ; 66 f3 0f bd c3 +lzcnt ax, [0] ; 66 f3 0f bd 04 25 00 00 00 00 +lzcnt eax, ebx ; f3 0f bd c3 +lzcnt eax, [0] ; f3 0f bd 04 25 00 00 00 00 +lzcnt rax, rbx ; f3 48 0f bd c3 +lzcnt rax, [0] ; f3 48 0f bd 04 25 00 00 00 00 diff --git a/modules/arch/x86/tests/lzcnt.hex b/modules/arch/x86/tests/lzcnt.hex new file mode 100644 index 00000000..ed14eb0e --- /dev/null +++ b/modules/arch/x86/tests/lzcnt.hex @@ -0,0 +1,43 @@ +66 +f3 +0f +bd +c3 +66 +f3 +0f +bd +04 +25 +00 +00 +00 +00 +f3 +0f +bd +c3 +f3 +0f +bd +04 +25 +00 +00 +00 +00 +f3 +48 +0f +bd +c3 +f3 +48 +0f +bd +04 +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/mem64-err.errwarn b/modules/arch/x86/tests/mem64-err.errwarn index c9b1943d..6f37650d 100644 --- a/modules/arch/x86/tests/mem64-err.errwarn +++ b/modules/arch/x86/tests/mem64-err.errwarn @@ -1,5 +1,5 @@ --:2: 16-bit addresses not supported in 64-bit mode --:4: 16-bit addresses not supported in 64-bit mode --:5: invalid effective address --:6: invalid effective address --:7: cannot use A/B/C/DH with instruction needing REX +-:2: error: 16-bit addresses not supported in 64-bit mode +-:4: error: 16-bit addresses not supported in 64-bit mode +-:5: error: invalid effective address +-:6: error: invalid effective address +-:7: error: cannot use A/B/C/DH with instruction needing REX diff --git a/modules/arch/x86/tests/mixcase.asm b/modules/arch/x86/tests/mixcase.asm new file mode 100644 index 00000000..66a96865 --- /dev/null +++ b/modules/arch/x86/tests/mixcase.asm @@ -0,0 +1,3 @@ +CPU SSSE3 +MOV AX,5 + diff --git a/modules/arch/x86/tests/mixcase.hex b/modules/arch/x86/tests/mixcase.hex new file mode 100644 index 00000000..76dc00b9 --- /dev/null +++ b/modules/arch/x86/tests/mixcase.hex @@ -0,0 +1,3 @@ +b8 +05 +00 diff --git a/modules/arch/x86/tests/movbe.asm b/modules/arch/x86/tests/movbe.asm new file mode 100644 index 00000000..637524ae --- /dev/null +++ b/modules/arch/x86/tests/movbe.asm @@ -0,0 +1,20 @@ +[bits 64] +movbe cx, [5] +movbe cx, word [5] +movbe ecx, [5] +movbe ecx, dword [5] +movbe rcx, [5] +movbe rcx, qword [5] +movbe r9, [5] +movbe r9, qword [5] +movbe [5], bx +movbe word [5], bx +movbe [5], ebx +movbe dword [5], ebx +movbe [5], r10d +movbe dword [5], r10d +movbe [5], rbx +movbe qword [5], rbx +movbe [5], r10 +movbe qword [5], r10 + diff --git a/modules/arch/x86/tests/movbe.hex b/modules/arch/x86/tests/movbe.hex new file mode 100644 index 00000000..108bedf7 --- /dev/null +++ b/modules/arch/x86/tests/movbe.hex @@ -0,0 +1,176 @@ +66 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +66 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +48 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +48 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +4c +0f +38 +f0 +0c +25 +05 +00 +00 +00 +4c +0f +38 +f0 +0c +25 +05 +00 +00 +00 +66 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +66 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +44 +0f +38 +f1 +14 +25 +05 +00 +00 +00 +44 +0f +38 +f1 +14 +25 +05 +00 +00 +00 +48 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +48 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +4c +0f +38 +f1 +14 +25 +05 +00 +00 +00 +4c +0f +38 +f1 +14 +25 +05 +00 +00 +00 diff --git a/modules/arch/x86/tests/nomem64-err.errwarn b/modules/arch/x86/tests/nomem64-err.errwarn index 2694d2fb..73bfcf97 100644 --- a/modules/arch/x86/tests/nomem64-err.errwarn +++ b/modules/arch/x86/tests/nomem64-err.errwarn @@ -1,12 +1,12 @@ -:2: warning: `es' segment register ignored in 64-bit mode --:4: `pushaw' invalid in 64-bit mode --:5: `popa' invalid in 64-bit mode --:6: `lds' invalid in 64-bit mode --:7: `aas' invalid in 64-bit mode --:8: `das' invalid in 64-bit mode --:9: `aad' invalid in 64-bit mode --:10: `into' invalid in 64-bit mode --:11: `salc' invalid in 64-bit mode +-:4: error: `pushaw' invalid in 64-bit mode +-:5: error: `popa' invalid in 64-bit mode +-:6: error: `lds' invalid in 64-bit mode +-:7: error: `aas' invalid in 64-bit mode +-:8: error: `das' invalid in 64-bit mode +-:9: error: `aad' invalid in 64-bit mode +-:10: error: `into' invalid in 64-bit mode +-:11: error: `salc' invalid in 64-bit mode -:13: warning: `xmm9' is a register in 64-bit mode -:14: warning: `rax' is a register in 64-bit mode -:15: warning: `rdx' is a register in 64-bit mode diff --git a/modules/arch/x86/tests/nomem64-err2.errwarn b/modules/arch/x86/tests/nomem64-err2.errwarn index b26a14d1..8a785392 100644 --- a/modules/arch/x86/tests/nomem64-err2.errwarn +++ b/modules/arch/x86/tests/nomem64-err2.errwarn @@ -1,2 +1,2 @@ --:2: cannot use A/B/C/DH with instruction needing REX --:3: cannot use A/B/C/DH with instruction needing REX +-:2: error: cannot use A/B/C/DH with instruction needing REX +-:3: error: cannot use A/B/C/DH with instruction needing REX diff --git a/modules/arch/x86/tests/o64loop.asm b/modules/arch/x86/tests/o64loop.asm new file mode 100644 index 00000000..14f7951b --- /dev/null +++ b/modules/arch/x86/tests/o64loop.asm @@ -0,0 +1,3 @@ +[bits 64] +o64 loop next +next: diff --git a/modules/arch/x86/tests/o64loop.errwarn b/modules/arch/x86/tests/o64loop.errwarn new file mode 100644 index 00000000..55f8201b --- /dev/null +++ b/modules/arch/x86/tests/o64loop.errwarn @@ -0,0 +1 @@ +-:2: warning: ignoring REX prefix on jump diff --git a/modules/arch/x86/tests/o64loop.hex b/modules/arch/x86/tests/o64loop.hex new file mode 100644 index 00000000..55e2c214 --- /dev/null +++ b/modules/arch/x86/tests/o64loop.hex @@ -0,0 +1,2 @@ +e2 +00 diff --git a/modules/arch/x86/tests/opsize-err.errwarn b/modules/arch/x86/tests/opsize-err.errwarn index da7bf083..f515f51e 100644 --- a/modules/arch/x86/tests/opsize-err.errwarn +++ b/modules/arch/x86/tests/opsize-err.errwarn @@ -1 +1 @@ --:3: invalid size for operand 2 +-:3: error: invalid size for operand 2 diff --git a/modules/arch/x86/tests/pinsrb.asm b/modules/arch/x86/tests/pinsrb.asm new file mode 100644 index 00000000..7ee059d7 --- /dev/null +++ b/modules/arch/x86/tests/pinsrb.asm @@ -0,0 +1,6 @@ +[bits 16] +pinsrb xmm4, eax, 0x55 +[bits 32] +pinsrb xmm4, eax, 0x55 +[bits 64] +pinsrb xmm4, eax, 0x55 diff --git a/modules/arch/x86/tests/pinsrb.hex b/modules/arch/x86/tests/pinsrb.hex new file mode 100644 index 00000000..27e71a9e --- /dev/null +++ b/modules/arch/x86/tests/pinsrb.hex @@ -0,0 +1,18 @@ +66 +0f +3a +20 +e0 +55 +66 +0f +3a +20 +e0 +55 +66 +0f +3a +20 +e0 +55 diff --git a/modules/arch/x86/tests/pushf-err.errwarn b/modules/arch/x86/tests/pushf-err.errwarn index 79f3177a..498610ba 100644 --- a/modules/arch/x86/tests/pushf-err.errwarn +++ b/modules/arch/x86/tests/pushf-err.errwarn @@ -1,10 +1,10 @@ -:5: warning: `pushfq' is an instruction in 64-bit mode -:9: warning: `popfq' is an instruction in 64-bit mode -:15: warning: `pushfq' is an instruction in 64-bit mode --:15: redefinition of `pushfq' --:5: `pushfq' previously defined here +-:15: error: redefinition of `pushfq' +-:5: error: `pushfq' previously defined here -:19: warning: `popfq' is an instruction in 64-bit mode --:19: redefinition of `popfq' --:9: `popfq' previously defined here --:24: `pushfd' invalid in 64-bit mode --:28: `popfd' invalid in 64-bit mode +-:19: error: redefinition of `popfq' +-:9: error: `popfq' previously defined here +-:24: error: `pushfd' invalid in 64-bit mode +-:28: error: `popfd' invalid in 64-bit mode diff --git a/modules/arch/x86/tests/pushnosize.asm b/modules/arch/x86/tests/pushnosize.asm index 3d999774..ada9be17 100644 --- a/modules/arch/x86/tests/pushnosize.asm +++ b/modules/arch/x86/tests/pushnosize.asm @@ -2,7 +2,7 @@ push 0 ; 6A 00 - equivalent to push byte 0 push byte 0 ; 6A 00 push word 0 ; 6A 00 - optimized -push dword 0 ; 66 68 00000000 +push dword 0 ; 66 6A 00 - optimized push strict byte 0 ; 6A 00 push strict word 0 ; 68 0000 push strict dword 0 ; 66 68 00000000 @@ -17,7 +17,7 @@ push strict dword 128 ; 66 68 80000000 [bits 32] push 0 ; 6A 00 - equivalent to push byte 0 push byte 0 ; 6A 00 -push word 0 ; 66 68 0000 +push word 0 ; 66 6A 00 - optimized push dword 0 ; 6A 00 - optimized push strict byte 0 ; 6A 00 push strict word 0 ; 66 68 0000 @@ -32,12 +32,12 @@ push strict dword 128 ; 6A 80000000 [bits 64] push 0 ; same as bits 32 output -push byte 0 -push word 0 -push dword 0 ; optimized to byte -push strict byte 0 -push strict word 0 -push strict dword 0 +push byte 0 ; 6A 00; 64 bits pushed onto stack +push word 0 ; 66 6A 00 - 66h prefix, optimized to byte +push dword 0 ; 6A 00 - optimized to byte; note 64 bits pushed onto stack +push strict byte 0 ; 6A 00; 64 bits pushed onto stack +push strict word 0 ; 66 68 0000 +push strict dword 0 ; 68 00000000; note 64 bits pushed onto stack push 128 push byte 128 ; warning push word 128 diff --git a/modules/arch/x86/tests/pushnosize.hex b/modules/arch/x86/tests/pushnosize.hex index de28febf..08960202 100644 --- a/modules/arch/x86/tests/pushnosize.hex +++ b/modules/arch/x86/tests/pushnosize.hex @@ -5,10 +5,7 @@ 6a 00 66 -68 -00 -00 -00 +6a 00 6a 00 @@ -51,8 +48,7 @@ 6a 00 66 -68 -00 +6a 00 6a 00 @@ -99,8 +95,7 @@ 6a 00 66 -68 -00 +6a 00 6a 00 diff --git a/modules/arch/x86/tests/rdrand.asm b/modules/arch/x86/tests/rdrand.asm new file mode 100644 index 00000000..20ade23f --- /dev/null +++ b/modules/arch/x86/tests/rdrand.asm @@ -0,0 +1,4 @@ +[bits 64] +rdrand bx +rdrand ebx +rdrand rbx diff --git a/modules/arch/x86/tests/rdrand.hex b/modules/arch/x86/tests/rdrand.hex new file mode 100644 index 00000000..25ac57c4 --- /dev/null +++ b/modules/arch/x86/tests/rdrand.hex @@ -0,0 +1,11 @@ +66 +0f +c7 +f3 +0f +c7 +f3 +48 +0f +c7 +f3 diff --git a/modules/arch/x86/tests/rdrnd.asm b/modules/arch/x86/tests/rdrnd.asm new file mode 100644 index 00000000..234451df --- /dev/null +++ b/modules/arch/x86/tests/rdrnd.asm @@ -0,0 +1,4 @@ +[bits 64] +rdrand cx +rdrand ecx +rdrand rcx diff --git a/modules/arch/x86/tests/rdrnd.hex b/modules/arch/x86/tests/rdrnd.hex new file mode 100644 index 00000000..be4bb809 --- /dev/null +++ b/modules/arch/x86/tests/rdrnd.hex @@ -0,0 +1,11 @@ +66 +0f +c7 +f1 +0f +c7 +f1 +48 +0f +c7 +f1 diff --git a/modules/arch/x86/tests/rdseed.asm b/modules/arch/x86/tests/rdseed.asm new file mode 100644 index 00000000..42fff846 --- /dev/null +++ b/modules/arch/x86/tests/rdseed.asm @@ -0,0 +1,4 @@ +[bits 64] +rdseed bx +rdseed ebx +rdseed rbx diff --git a/modules/arch/x86/tests/rdseed.hex b/modules/arch/x86/tests/rdseed.hex new file mode 100644 index 00000000..03f4fbd3 --- /dev/null +++ b/modules/arch/x86/tests/rdseed.hex @@ -0,0 +1,11 @@ +66 +0f +c7 +fb +0f +c7 +fb +48 +0f +c7 +fb diff --git a/modules/arch/x86/tests/riprel1.asm b/modules/arch/x86/tests/riprel1.asm new file mode 100644 index 00000000..b1fdbecb --- /dev/null +++ b/modules/arch/x86/tests/riprel1.asm @@ -0,0 +1,66 @@ +bits 64 +val: +default abs + +mov rax, val ; 32-bit imm +mov rax, dword val ; 32-bit imm +mov rax, qword val ; 64-bit imm + +mov rbx, val ; 32-bit imm +mov rbx, dword val ; 32-bit imm +mov rbx, qword val ; 64-bit imm + +mov rax, [val] ; 48 8b ... (32-bit disp) +mov rax, [dword val] ; 48 8b ... (32-bit disp) +mov rax, [qword val] ; 48 a1 ... (64-bit disp) +a32 mov rax, [val] ; 67 48 a1 ... (32-bit disp) +a32 mov rax, [dword val] ; 67 48 a1 ... (32-bit disp) +a32 mov rax, [qword val] ; 67 48 a1 ... (32-bit disp) + ; [this one is debatable on correctness, + ; I chose in yasm to make a32 override] +a64 mov rax, [val] ; 48 8b ... (32-bit disp) +a64 mov rax, [dword val] ; 48 8b ... (32-bit disp) +a64 mov rax, [qword val] ; 48 a1 ... (64-bit disp) + +mov rbx, [val] ; 48 8b ... (32-bit disp) +mov rbx, [dword val] ; 48 8b ... (32-bit disp) +;mov rbx, [qword val] ; illegal (can't have 64-bit disp) +a32 mov rbx, [val] ; 67 48 8b ... (32-bit disp) +a32 mov rbx, [dword val] ; 67 48 8b ... (32-bit disp) +;a32 mov rbx, [qword val] ; illegal (can't have 64-bit disp) +a64 mov rbx, [val] ; 48 8b ... (32-bit disp) +a64 mov rbx, [dword val] ; 48 8b ... (32-bit disp) +;a64 mov rbx, [qword val] ; illegal (can't have 64-bit disp) + +default rel + +mov rax, val ; 32-bit imm +mov rax, dword val ; 32-bit imm +mov rax, qword val ; 64-bit imm + +mov rbx, val ; 32-bit imm +mov rbx, dword val ; 32-bit imm +mov rbx, qword val ; 64-bit imm + +mov rax, [val] ; 48 8b ... (32-bit disp, RIP-rel) +mov rax, [dword val] ; 48 8b ... (32-bit disp, RIP-rel) +mov rax, [qword val] ; 48 a1 ... (64-bit disp, ABS) +a32 mov rax, [val] ; 67 48 8b ... (32-bit disp, RIP-rel) +a32 mov rax, [dword val] ; 67 48 8b ... (32-bit disp, RIP-rel) +a32 mov rax, [qword val] ; 67 48 a1 ... (32-bit disp, ABS) + ; [this one is debatable on correctness, + ; I chose in yasm to make a32 override] +a64 mov rax, [val] ; 48 8b ... (32-bit disp, RIP-rel) +a64 mov rax, [dword val] ; 48 8b ... (32-bit disp, RIP-rel) +a64 mov rax, [qword val] ; 48 a1 ... (64-bit disp, ABS) + +mov rbx, [val] ; 48 8b ... (32-bit disp, RIP-rel) +mov rbx, [dword val] ; 48 8b ... (32-bit disp, RIP-rel) +;mov rbx, [qword val] ; illegal (can't have 64-bit disp) +a32 mov rbx, [val] ; 67 48 8b ... (32-bit disp, RIP-rel) +a32 mov rbx, [dword val] ; 67 48 8b ... (32-bit disp, RIP-rel) +;a32 mov rbx, [qword val] ; illegal (can't have 64-bit disp) +a64 mov rbx, [val] ; 48 8b ... (32-bit disp, RIP-rel) +a64 mov rbx, [dword val] ; 48 8b ... (32-bit disp, RIP-rel) +;a64 mov rbx, [qword val] ; illegal (can't have 64-bit disp) + diff --git a/modules/arch/x86/tests/riprel1.hex b/modules/arch/x86/tests/riprel1.hex new file mode 100644 index 00000000..78f28bff --- /dev/null +++ b/modules/arch/x86/tests/riprel1.hex @@ -0,0 +1,334 @@ +48 +c7 +c0 +00 +00 +00 +00 +48 +c7 +c0 +00 +00 +00 +00 +48 +b8 +00 +00 +00 +00 +00 +00 +00 +00 +48 +c7 +c3 +00 +00 +00 +00 +48 +c7 +c3 +00 +00 +00 +00 +48 +bb +00 +00 +00 +00 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +a1 +00 +00 +00 +00 +00 +00 +00 +00 +67 +48 +a1 +00 +00 +00 +00 +67 +48 +a1 +00 +00 +00 +00 +67 +48 +a1 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +a1 +00 +00 +00 +00 +00 +00 +00 +00 +48 +8b +1c +25 +00 +00 +00 +00 +48 +8b +1c +25 +00 +00 +00 +00 +67 +48 +8b +1c +25 +00 +00 +00 +00 +67 +48 +8b +1c +25 +00 +00 +00 +00 +48 +8b +1c +25 +00 +00 +00 +00 +48 +8b +1c +25 +00 +00 +00 +00 +48 +c7 +c0 +00 +00 +00 +00 +48 +c7 +c0 +00 +00 +00 +00 +48 +b8 +00 +00 +00 +00 +00 +00 +00 +00 +48 +c7 +c3 +00 +00 +00 +00 +48 +c7 +c3 +00 +00 +00 +00 +48 +bb +00 +00 +00 +00 +00 +00 +00 +00 +48 +8b +05 +1e +ff +ff +ff +48 +8b +05 +17 +ff +ff +ff +48 +a1 +00 +00 +00 +00 +00 +00 +00 +00 +67 +48 +8b +05 +05 +ff +ff +ff +67 +48 +8b +05 +fd +fe +ff +ff +67 +48 +a1 +00 +00 +00 +00 +48 +8b +05 +ef +fe +ff +ff +48 +8b +05 +e8 +fe +ff +ff +48 +a1 +00 +00 +00 +00 +00 +00 +00 +00 +48 +8b +1d +d7 +fe +ff +ff +48 +8b +1d +d0 +fe +ff +ff +67 +48 +8b +1d +c8 +fe +ff +ff +67 +48 +8b +1d +c0 +fe +ff +ff +48 +8b +1d +b9 +fe +ff +ff +48 +8b +1d +b2 +fe +ff +ff diff --git a/modules/arch/x86/tests/riprel2.asm b/modules/arch/x86/tests/riprel2.asm new file mode 100644 index 00000000..7f3be69a --- /dev/null +++ b/modules/arch/x86/tests/riprel2.asm @@ -0,0 +1,110 @@ + bits 64 + + default abs ; default abs, except for explicit rel + + mov rax,[foo] + mov rax,[qword 123456789abcdef0h] + mov rbx,[foo] + mov rax,[dword foo] + mov rbx,[dword foo] + mov rax,[qword foo] + mov rax,[rel foo] ; rel + mov rbx,[rel foo] ; rel + mov rax,[rel dword foo] ; rel + ;mov rax,[rel qword foo] ; illegal + mov rax,[abs foo] + mov rbx,[abs foo] + mov rax,[abs dword foo] + mov rax,[abs qword foo] + + mov rax,[es:foo] + mov rax,[qword es:123456789abcdef0h] + mov rbx,[es:foo] + mov rax,[dword es:foo] + mov rbx,[dword es:foo] + mov rax,[qword es:foo] + mov rax,[rel es:foo] ; rel + mov rbx,[rel es:foo] ; rel + mov rax,[rel dword es:foo] ; rel + ;mov rax,[rel qword es:foo] ; illegal + mov rax,[abs es:foo] + mov rbx,[abs es:foo] + mov rax,[abs dword es:foo] + mov rax,[abs qword es:foo] + + mov rax,[fs:foo] + mov rax,[qword fs:123456789abcdef0h] + mov rbx,[fs:foo] + mov rax,[dword fs:foo] + mov rbx,[dword fs:foo] + mov rax,[qword fs:foo] + mov rax,[rel fs:foo] ; rel + mov rbx,[rel fs:foo] ; rel + mov rax,[rel dword fs:foo] ; rel + ;mov rax,[rel qword fs:foo] ; illegal + mov rax,[abs fs:foo] + mov rbx,[abs fs:foo] + mov rax,[abs dword fs:foo] + mov rax,[abs qword fs:foo] + + mov rax,[rbx] + mov rax,[rel rbx] + mov rax,[abs rbx] + + default rel + + ; all of these are default rel, except for 64-bit displacements + mov rax,[foo] + mov rax,[qword 123456789abcdef0h] ; abs + mov rbx,[foo] + mov rax,[dword foo] + mov rbx,[dword foo] + mov rax,[qword foo] ; abs + mov rax,[rel foo] + mov rbx,[rel foo] + mov rax,[rel dword foo] + ;mov rax,[rel qword foo] ; illegal + mov rax,[abs foo] + mov rbx,[abs foo] + mov rax,[abs dword foo] + mov rax,[abs qword foo] + + ; all of these are default rel, except for 64-bit displacements + mov rax,[es:foo] + mov rax,[qword es:123456789abcdef0h] + mov rbx,[es:foo] + mov rax,[dword es:foo] + mov rbx,[dword es:foo] + mov rax,[qword es:foo] + mov rax,[rel es:foo] ; rel + mov rbx,[rel es:foo] ; rel + mov rax,[rel dword es:foo] ; rel + ;mov rax,[rel qword es:foo] ; illegal + mov rax,[abs es:foo] + mov rbx,[abs es:foo] + mov rax,[abs dword es:foo] + mov rax,[abs qword es:foo] + + ; all of these are abs due to fs:, except for explicit rel + mov rax,[fs:foo] + mov rax,[qword fs:123456789abcdef0h] + mov rbx,[fs:foo] + mov rax,[dword fs:foo] + mov rbx,[dword fs:foo] + mov rax,[qword fs:foo] + mov rax,[rel fs:foo] ; rel + mov rbx,[rel fs:foo] ; rel + mov rax,[rel dword fs:foo] ; rel + ;mov rax,[rel qword fs:foo] ; illegal + mov rax,[abs fs:foo] + mov rbx,[abs fs:foo] + mov rax,[abs dword fs:foo] + mov rax,[abs qword fs:foo] + + mov rax,[rbx] + mov rax,[rel rbx] + mov rax,[abs rbx] + + section .data +foo equ $ + diff --git a/modules/arch/x86/tests/riprel2.errwarn b/modules/arch/x86/tests/riprel2.errwarn new file mode 100644 index 00000000..b219dc7e --- /dev/null +++ b/modules/arch/x86/tests/riprel2.errwarn @@ -0,0 +1,26 @@ +-:20: warning: `es' segment register ignored in 64-bit mode +-:21: warning: `es' segment register ignored in 64-bit mode +-:22: warning: `es' segment register ignored in 64-bit mode +-:23: warning: `es' segment register ignored in 64-bit mode +-:24: warning: `es' segment register ignored in 64-bit mode +-:25: warning: `es' segment register ignored in 64-bit mode +-:26: warning: `es' segment register ignored in 64-bit mode +-:27: warning: `es' segment register ignored in 64-bit mode +-:28: warning: `es' segment register ignored in 64-bit mode +-:30: warning: `es' segment register ignored in 64-bit mode +-:31: warning: `es' segment register ignored in 64-bit mode +-:32: warning: `es' segment register ignored in 64-bit mode +-:33: warning: `es' segment register ignored in 64-bit mode +-:73: warning: `es' segment register ignored in 64-bit mode +-:74: warning: `es' segment register ignored in 64-bit mode +-:75: warning: `es' segment register ignored in 64-bit mode +-:76: warning: `es' segment register ignored in 64-bit mode +-:77: warning: `es' segment register ignored in 64-bit mode +-:78: warning: `es' segment register ignored in 64-bit mode +-:79: warning: `es' segment register ignored in 64-bit mode +-:80: warning: `es' segment register ignored in 64-bit mode +-:81: warning: `es' segment register ignored in 64-bit mode +-:83: warning: `es' segment register ignored in 64-bit mode +-:84: warning: `es' segment register ignored in 64-bit mode +-:85: warning: `es' segment register ignored in 64-bit mode +-:86: warning: `es' segment register ignored in 64-bit mode diff --git a/modules/arch/x86/tests/riprel2.hex b/modules/arch/x86/tests/riprel2.hex new file mode 100644 index 00000000..a7b6f112 --- /dev/null +++ b/modules/arch/x86/tests/riprel2.hex @@ -0,0 +1,704 @@ +48 +8b +04 +25 +c0 +02 +00 +00 +48 +a1 +f0 +de +bc +9a +78 +56 +34 +12 +48 +8b +1c +25 +c0 +02 +00 +00 +48 +8b +04 +25 +c0 +02 +00 +00 +48 +8b +1c +25 +c0 +02 +00 +00 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +48 +8b +05 +85 +02 +00 +00 +48 +8b +1d +7e +02 +00 +00 +48 +8b +05 +77 +02 +00 +00 +48 +8b +04 +25 +c0 +02 +00 +00 +48 +8b +1c +25 +c0 +02 +00 +00 +48 +8b +04 +25 +c0 +02 +00 +00 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +26 +48 +8b +04 +25 +c0 +02 +00 +00 +26 +48 +a1 +f0 +de +bc +9a +78 +56 +34 +12 +26 +48 +8b +1c +25 +c0 +02 +00 +00 +26 +48 +8b +04 +25 +c0 +02 +00 +00 +26 +48 +8b +1c +25 +c0 +02 +00 +00 +26 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +26 +48 +8b +05 +13 +02 +00 +00 +26 +48 +8b +1d +0b +02 +00 +00 +26 +48 +8b +05 +03 +02 +00 +00 +26 +48 +8b +04 +25 +c0 +02 +00 +00 +26 +48 +8b +1c +25 +c0 +02 +00 +00 +26 +48 +8b +04 +25 +c0 +02 +00 +00 +26 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +a1 +f0 +de +bc +9a +78 +56 +34 +12 +64 +48 +8b +1c +25 +c0 +02 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +8b +1c +25 +c0 +02 +00 +00 +64 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +64 +48 +8b +05 +9b +01 +00 +00 +64 +48 +8b +1d +93 +01 +00 +00 +64 +48 +8b +05 +8b +01 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +8b +1c +25 +c0 +02 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +48 +8b +03 +48 +8b +03 +48 +8b +03 +48 +8b +05 +55 +01 +00 +00 +48 +a1 +f0 +de +bc +9a +78 +56 +34 +12 +48 +8b +1d +44 +01 +00 +00 +48 +8b +05 +3d +01 +00 +00 +48 +8b +1d +36 +01 +00 +00 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +48 +8b +05 +25 +01 +00 +00 +48 +8b +1d +1e +01 +00 +00 +48 +8b +05 +17 +01 +00 +00 +48 +8b +04 +25 +c0 +02 +00 +00 +48 +8b +1c +25 +c0 +02 +00 +00 +48 +8b +04 +25 +c0 +02 +00 +00 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +26 +48 +8b +05 +ed +00 +00 +00 +26 +48 +a1 +f0 +de +bc +9a +78 +56 +34 +12 +26 +48 +8b +1d +da +00 +00 +00 +26 +48 +8b +05 +d2 +00 +00 +00 +26 +48 +8b +1d +ca +00 +00 +00 +26 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +26 +48 +8b +05 +b7 +00 +00 +00 +26 +48 +8b +1d +af +00 +00 +00 +26 +48 +8b +05 +a7 +00 +00 +00 +26 +48 +8b +04 +25 +c0 +02 +00 +00 +26 +48 +8b +1c +25 +c0 +02 +00 +00 +26 +48 +8b +04 +25 +c0 +02 +00 +00 +26 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +a1 +f0 +de +bc +9a +78 +56 +34 +12 +64 +48 +8b +1c +25 +c0 +02 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +8b +1c +25 +c0 +02 +00 +00 +64 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +64 +48 +8b +05 +3f +00 +00 +00 +64 +48 +8b +1d +37 +00 +00 +00 +64 +48 +8b +05 +2f +00 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +8b +1c +25 +c0 +02 +00 +00 +64 +48 +8b +04 +25 +c0 +02 +00 +00 +64 +48 +a1 +c0 +02 +00 +00 +00 +00 +00 +00 +48 +8b +03 +48 +8b +03 +48 +8b +03 diff --git a/modules/arch/x86/tests/ripseg.asm b/modules/arch/x86/tests/ripseg.asm new file mode 100644 index 00000000..1779a1c9 --- /dev/null +++ b/modules/arch/x86/tests/ripseg.asm @@ -0,0 +1,35 @@ +bits 64 +foo: + +default abs +mov rbx, [foo] +mov rbx, [es:foo] +mov rbx, [fs:foo] +mov rbx, [gs:foo] +mov rbx, [rel es:foo] +mov rbx, [rel fs:foo] +mov rbx, [rel gs:foo] +mov rbx, [abs es:foo] +mov rbx, [abs fs:foo] +mov rbx, [abs gs:foo] +;mov rbx, [es:rel foo] +;mov rbx, [fs:rel foo] +;mov rbx, [es:abs foo] +;mov rbx, [fs:abs foo] + +default rel +mov rbx, [foo] +mov rbx, [es:foo] +mov rbx, [fs:foo] +mov rbx, [gs:foo] +mov rbx, [rel es:foo] +mov rbx, [rel fs:foo] +mov rbx, [rel gs:foo] +mov rbx, [abs es:foo] +mov rbx, [abs fs:foo] +mov rbx, [abs gs:foo] +;mov rbx, [es:rel foo] +;mov rbx, [fs:rel foo] +;mov rbx, [es:abs foo] +;mov rbx, [fs:abs foo] + diff --git a/modules/arch/x86/tests/ripseg.errwarn b/modules/arch/x86/tests/ripseg.errwarn new file mode 100644 index 00000000..19782ddd --- /dev/null +++ b/modules/arch/x86/tests/ripseg.errwarn @@ -0,0 +1,6 @@ +-:6: warning: `es' segment register ignored in 64-bit mode +-:9: warning: `es' segment register ignored in 64-bit mode +-:12: warning: `es' segment register ignored in 64-bit mode +-:22: warning: `es' segment register ignored in 64-bit mode +-:25: warning: `es' segment register ignored in 64-bit mode +-:28: warning: `es' segment register ignored in 64-bit mode diff --git a/modules/arch/x86/tests/ripseg.hex b/modules/arch/x86/tests/ripseg.hex new file mode 100644 index 00000000..5303fe94 --- /dev/null +++ b/modules/arch/x86/tests/ripseg.hex @@ -0,0 +1,170 @@ +48 +8b +1c +25 +00 +00 +00 +00 +26 +48 +8b +1c +25 +00 +00 +00 +00 +64 +48 +8b +1c +25 +00 +00 +00 +00 +65 +48 +8b +1c +25 +00 +00 +00 +00 +26 +48 +8b +1d +d5 +ff +ff +ff +64 +48 +8b +1d +cd +ff +ff +ff +65 +48 +8b +1d +c5 +ff +ff +ff +26 +48 +8b +1c +25 +00 +00 +00 +00 +64 +48 +8b +1c +25 +00 +00 +00 +00 +65 +48 +8b +1c +25 +00 +00 +00 +00 +48 +8b +1d +a3 +ff +ff +ff +26 +48 +8b +1d +9b +ff +ff +ff +64 +48 +8b +1c +25 +00 +00 +00 +00 +65 +48 +8b +1c +25 +00 +00 +00 +00 +26 +48 +8b +1d +81 +ff +ff +ff +64 +48 +8b +1d +79 +ff +ff +ff +65 +48 +8b +1d +71 +ff +ff +ff +26 +48 +8b +1c +25 +00 +00 +00 +00 +64 +48 +8b +1c +25 +00 +00 +00 +00 +65 +48 +8b +1c +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/tests/segoff-err.asm b/modules/arch/x86/tests/segoff-err.asm new file mode 100644 index 00000000..ac76927d --- /dev/null +++ b/modules/arch/x86/tests/segoff-err.asm @@ -0,0 +1,6 @@ +; all of these should be illegal + +jmp far[1:2] +mov ax,[1:2] +push dword [1:2] +mov ax,1:2 diff --git a/modules/arch/x86/tests/segoff-err.errwarn b/modules/arch/x86/tests/segoff-err.errwarn new file mode 100644 index 00000000..98a96c7b --- /dev/null +++ b/modules/arch/x86/tests/segoff-err.errwarn @@ -0,0 +1,4 @@ +-:3: error: invalid segment in effective address +-:4: error: invalid segment in effective address +-:5: error: invalid segment in effective address +-:6: error: immediate does not support segment diff --git a/modules/arch/x86/tests/segoff.asm b/modules/arch/x86/tests/segoff.asm new file mode 100644 index 00000000..7a2091fe --- /dev/null +++ b/modules/arch/x86/tests/segoff.asm @@ -0,0 +1,7 @@ +; all of these should be legal and should just result in the offset portion + +foo equ 1:2 +jmp far[foo] +mov ax,[foo] +push dword [foo] +mov ax,foo diff --git a/modules/arch/x86/tests/segoff.hex b/modules/arch/x86/tests/segoff.hex new file mode 100644 index 00000000..7520242a --- /dev/null +++ b/modules/arch/x86/tests/segoff.hex @@ -0,0 +1,15 @@ +ff +2e +02 +00 +a1 +02 +00 +66 +ff +36 +02 +00 +b8 +02 +00 diff --git a/modules/arch/x86/tests/shift64.asm b/modules/arch/x86/tests/shift64.asm new file mode 100644 index 00000000..c1ce6b1c --- /dev/null +++ b/modules/arch/x86/tests/shift64.asm @@ -0,0 +1,5 @@ +[bits 64] +shl rax, 5 +shl rax, 32 +shr rax, 5 +shr rax, 32 diff --git a/modules/arch/x86/tests/shift64.hex b/modules/arch/x86/tests/shift64.hex new file mode 100644 index 00000000..ad28eb24 --- /dev/null +++ b/modules/arch/x86/tests/shift64.hex @@ -0,0 +1,16 @@ +48 +c1 +e0 +05 +48 +c1 +e0 +20 +48 +c1 +e8 +05 +48 +c1 +e8 +20 diff --git a/modules/arch/x86/tests/smap.asm b/modules/arch/x86/tests/smap.asm new file mode 100644 index 00000000..702bc810 --- /dev/null +++ b/modules/arch/x86/tests/smap.asm @@ -0,0 +1,2 @@ +clac +stac diff --git a/modules/arch/x86/tests/smap.hex b/modules/arch/x86/tests/smap.hex new file mode 100644 index 00000000..a1034059 --- /dev/null +++ b/modules/arch/x86/tests/smap.hex @@ -0,0 +1,6 @@ +0f +01 +ca +0f +01 +cb diff --git a/modules/arch/x86/tests/smx.asm b/modules/arch/x86/tests/smx.asm new file mode 100644 index 00000000..e5ca5b5a --- /dev/null +++ b/modules/arch/x86/tests/smx.asm @@ -0,0 +1,3 @@ +[bits 32] +getsec + diff --git a/modules/arch/x86/tests/smx.hex b/modules/arch/x86/tests/smx.hex new file mode 100644 index 00000000..7e6dae1f --- /dev/null +++ b/modules/arch/x86/tests/smx.hex @@ -0,0 +1,2 @@ +0f +37 diff --git a/modules/arch/x86/tests/sse4-err.errwarn b/modules/arch/x86/tests/sse4-err.errwarn index b26a14d1..8a785392 100644 --- a/modules/arch/x86/tests/sse4-err.errwarn +++ b/modules/arch/x86/tests/sse4-err.errwarn @@ -1,2 +1,2 @@ --:2: cannot use A/B/C/DH with instruction needing REX --:3: cannot use A/B/C/DH with instruction needing REX +-:2: error: cannot use A/B/C/DH with instruction needing REX +-:3: error: cannot use A/B/C/DH with instruction needing REX diff --git a/modules/arch/x86/tests/ssewidth.asm b/modules/arch/x86/tests/ssewidth.asm new file mode 100644 index 00000000..0824b769 --- /dev/null +++ b/modules/arch/x86/tests/ssewidth.asm @@ -0,0 +1,566 @@ +[bits 64] +addpd xmm1, xmm2 +addpd xmm1, dqword [rbx] + +addps xmm1, xmm2 +addps xmm1, dqword [rbx] + +addsd xmm1, xmm2 +addsd xmm1, qword [rbx] + +addss xmm1, xmm2 +addss xmm1, dword [rbx] + +addsubpd xmm1, xmm2 +addsubpd xmm1, dqword [rbx] + +addsubps xmm1, xmm2 +addsubps xmm1, dqword [rbx] + +andnpd xmm1, xmm2 +andnpd xmm1, dqword [rbx] + +andnps xmm1, xmm2 +andnps xmm1, dqword [rbx] + +andpd xmm1, xmm2 +andpd xmm1, dqword [rbx] + +andps xmm1, xmm2 +andps xmm1, dqword [rbx] + +cmppd xmm1, xmm2, 0 +cmppd xmm1, dqword [rbx], 0 +cmpeqpd xmm1, xmm2 +cmpeqpd xmm1, dqword [rbx] + +cmpps xmm1, xmm2, 0 +cmpps xmm1, dqword [rbx], 0 +cmpeqps xmm1, xmm2 +cmpeqps xmm1, dqword [rbx] + +cmpsd xmm1, xmm2, 0 +cmpsd xmm1, qword [rbx], 0 +cmpeqsd xmm1, xmm2 +cmpeqsd xmm1, qword [rbx] + +cmpss xmm1, xmm2, 0 +cmpss xmm1, dword [rbx], 0 +cmpeqss xmm1, xmm2 +cmpeqss xmm1, dword [rbx] + +comisd xmm1, xmm2 +comisd xmm1, qword [rbx] + +comiss xmm1, xmm2 +comiss xmm1, dword [rbx] + +cvtdq2pd xmm1, xmm2 +cvtdq2pd xmm1, qword [rbx] + +cvtdq2ps xmm1, xmm2 +cvtdq2ps xmm1, dqword [rbx] + +cvtpd2dq xmm1, xmm2 +cvtpd2dq xmm1, dqword [rbx] + +cvtpd2pi mm1, xmm2 ; mmx +cvtpd2pi mm1, dqword [rbx] + +cvtpd2ps xmm1, xmm2 +cvtpd2ps xmm1, dqword [rbx] + +cvtpi2pd xmm1, mm2 ; mmx +cvtpi2pd xmm1, qword [rbx] + +cvtpi2ps xmm1, mm2 ; mmx +cvtpi2ps xmm1, qword [rbx] + +cvtps2dq xmm1, xmm2 +cvtps2dq xmm1, dqword [rbx] + +cvtps2pd xmm1, xmm2 +cvtps2pd xmm1, qword [rbx] + +cvtps2pi mm1, xmm2 +cvtps2pi mm1, qword [rbx] + +cvtsd2si rbx, xmm2 +cvtsd2si rbx, qword [rbx] + +cvtsd2ss xmm1, xmm2 +cvtsd2ss xmm1, qword [rbx] + +cvtsi2sd xmm1, ebx +cvtsi2sd xmm1, dword [rbx] +cvtsi2sd xmm1, rbx +cvtsi2sd xmm1, qword [rbx] + +cvtsi2ss xmm1, ebx +cvtsi2ss xmm1, dword [rbx] +cvtsi2ss xmm1, rbx +cvtsi2ss xmm1, qword [rbx] + +cvtss2sd xmm1, xmm2 +cvtss2sd xmm1, dword [rbx] + +cvtss2si ebx, xmm2 +cvtss2si ebx, dword [rbx] +cvtss2si rbx, xmm2 +cvtss2si rbx, dword [rbx] + +cvttpd2dq xmm1, xmm2 +cvttpd2dq xmm1, dqword [rbx] + +cvttpd2pi mm1, xmm2 +cvttpd2pi mm1, dqword [rbx] + +cvttps2dq xmm1, xmm2 +cvttps2dq xmm1, dqword [rbx] + +cvttps2pi mm1, xmm2 +cvttps2pi mm1, qword [rbx] + +cvttsd2si eax, xmm1 +cvttsd2si eax, qword [rbx] +cvttsd2si rax, xmm1 +cvttsd2si rax, qword [rbx] + +cvttss2si eax, xmm1 +cvttss2si eax, dword [rbx] +cvttss2si rax, xmm1 +cvttss2si rax, dword [rbx] + +divpd xmm1, xmm2 +divpd xmm1, dqword [rbx] + +divps xmm1, xmm2 +divps xmm1, dqword [rbx] + +divsd xmm1, xmm2 +divsd xmm1, qword [rbx] + +divss xmm1, xmm2 +divss xmm1, dword [rbx] + +extrq xmm1, 0, 1 +extrq xmm1, byte 0, byte 1 +extrq xmm1, xmm2 + +haddpd xmm1, xmm2 +haddpd xmm1, dqword [rbx] + +haddps xmm1, xmm2 +haddps xmm1, dqword [rbx] + +hsubpd xmm1, xmm2 +hsubpd xmm1, dqword [rbx] + +hsubps xmm1, xmm2 +hsubps xmm1, dqword [rbx] + +insertq xmm1, xmm2, 0, 1 +insertq xmm1, xmm2, byte 0, byte 1 +insertq xmm1, xmm2 + +lddqu xmm1, dqword [rbx] + +ldmxcsr dword [rbx] + +maskmovdqu xmm1, xmm2 + +maxpd xmm1, xmm2 +maxpd xmm1, dqword [rbx] + +maxps xmm1, xmm2 +maxps xmm1, dqword [rbx] + +maxsd xmm1, xmm2 +maxsd xmm1, qword [rbx] + +maxss xmm1, xmm2 +maxss xmm1, dword [rbx] + +minpd xmm1, xmm2 +minpd xmm1, dqword [rbx] + +minps xmm1, xmm2 +minps xmm1, dqword [rbx] + +minsd xmm1, xmm2 +minsd xmm1, qword [rbx] + +minss xmm1, xmm2 +minss xmm1, dword [rbx] + +movapd xmm1, xmm2 +movapd xmm1, dqword [rbx] +movapd dqword [rbx], xmm2 + +movaps xmm1, xmm2 +movaps xmm1, dqword [rbx] +movaps dqword [rbx], xmm2 + +movd xmm1, ebx +movd xmm1, dword [rbx] +movd xmm1, rbx +movd xmm1, qword [rbx] +movd dword [rbx], xmm2 +movd qword [rbx], xmm2 + +movddup xmm1, xmm2 +movddup xmm1, qword [rbx] + +movdq2q mm1, xmm2 + +movdqa xmm1, xmm2 +movdqa xmm1, dqword [rbx] +movdqa dqword [rbx], xmm2 + +movdqu xmm1, xmm2 +movdqu xmm1, dqword [rbx] +movdqu dqword [rbx], xmm2 + +movhlps xmm1, xmm2 + +movhpd xmm1, qword [rbx] +movhpd qword [rbx], xmm2 + +movhps xmm1, qword [rbx] +movhps qword [rbx], xmm2 + +movlhps xmm1, xmm2 + +movlpd xmm1, qword [rbx] +movlpd qword [rbx], xmm2 + +movlps xmm1, qword [rbx] +movlps qword [rbx], xmm2 + +movmskpd ebx, xmm2 + +movmskps ebx, xmm2 + +movntdq dqword [rbx], xmm2 + +movntpd dqword [rbx], xmm2 + +movntps dqword [rbx], xmm2 + +movntsd qword [rbx], xmm2 + +movntss dword [rbx], xmm2 + +movq xmm1, xmm2 +movq xmm1, qword [rbx] +movq qword [rbx], xmm2 + +movq2dq xmm1, mm2 + +movsd xmm1, xmm2 +movsd xmm1, qword [rbx] +movsd qword [rbx], xmm2 + +movshdup xmm1, xmm2 +movshdup xmm1, dqword [rbx] + +movsldup xmm1, xmm2 +movsldup xmm1, dqword [rbx] + +movss xmm1, xmm2 +movss xmm1, dword [rbx] +movss dword [rbx], xmm2 + +movupd xmm1, xmm2 +movupd xmm1, dqword [rbx] +movupd dqword [rbx], xmm2 + +movups xmm1, xmm2 +movups xmm1, dqword [rbx] +movups dqword [rbx], xmm2 + +mulpd xmm1, xmm2 +mulpd xmm1, dqword [rbx] + +mulps xmm1, xmm2 +mulps xmm1, dqword [rbx] + +mulsd xmm1, xmm2 +mulsd xmm1, qword [rbx] + +mulss xmm1, xmm2 +mulss xmm1, dword [rbx] + +orpd xmm1, xmm2 +orpd xmm1, dqword [rbx] + +orps xmm1, xmm2 +orps xmm1, dqword [rbx] + +packssdw xmm1, xmm2 +packssdw xmm1, dqword [rbx] + +packsswb xmm1, xmm2 +packsswb xmm1, dqword [rbx] + +packuswb xmm1, xmm2 +packuswb xmm1, dqword [rbx] + +paddb xmm1, xmm2 +paddb xmm1, dqword [rbx] + +paddd xmm1, xmm2 +paddd xmm1, dqword [rbx] + +paddq xmm1, xmm2 +paddq xmm1, dqword [rbx] + +paddsb xmm1, xmm2 +paddsb xmm1, dqword [rbx] + +paddsw xmm1, xmm2 +paddsw xmm1, dqword [rbx] + +paddusb xmm1, xmm2 +paddusb xmm1, dqword [rbx] + +paddusw xmm1, xmm2 +paddusw xmm1, dqword [rbx] + +paddw xmm1, xmm2 +paddw xmm1, dqword [rbx] + +pand xmm1, xmm2 +pand xmm1, dqword [rbx] + +pandn xmm1, xmm2 +pandn xmm1, dqword [rbx] + +pavgb xmm1, xmm2 +pavgb xmm1, dqword [rbx] + +pavgw xmm1, xmm2 +pavgw xmm1, dqword [rbx] + +pcmpeqb xmm1, xmm2 +pcmpeqb xmm1, dqword [rbx] + +pcmpeqd xmm1, xmm2 +pcmpeqd xmm1, dqword [rbx] + +pcmpeqw xmm1, xmm2 +pcmpeqw xmm1, dqword [rbx] + +pcmpgtb xmm1, xmm2 +pcmpgtb xmm1, dqword [rbx] + +pcmpgtd xmm1, xmm2 +pcmpgtd xmm1, dqword [rbx] + +pcmpgtw xmm1, xmm2 +pcmpgtw xmm1, dqword [rbx] + +pextrw ebx, xmm2, byte 0 + +pinsrw xmm1, ebx, byte 0 +pinsrw xmm1, word [rbx], byte 0 + +pmaddwd xmm1, xmm2 +pmaddwd xmm1, dqword [rbx] + +pmaxsw xmm1, xmm2 +pmaxsw xmm1, dqword [rbx] + +pmaxub xmm1, xmm2 +pmaxub xmm1, dqword [rbx] + +pminsw xmm1, xmm2 +pminsw xmm1, dqword [rbx] + +pminub xmm1, xmm2 +pminub xmm1, dqword [rbx] + +pmovmskb eax, xmm2 + +pmulhuw xmm1, xmm2 +pmulhuw xmm1, dqword [rbx] + +pmulhw xmm1, xmm2 +pmulhw xmm1, dqword [rbx] + +pmullw xmm1, xmm2 +pmullw xmm1, dqword [rbx] + +pmuludq xmm1, xmm2 +pmuludq xmm1, dqword [rbx] + +por xmm1, xmm2 +por xmm1, dqword [rbx] + +psadbw xmm1, xmm2 +psadbw xmm1, dqword [rbx] + +pshufd xmm1, xmm2, byte 0 +pshufd xmm1, dqword [rbx], byte 0 + +pshufhw xmm1, xmm2, byte 0 +pshufhw xmm1, dqword [rbx], byte 0 + +pshuflw xmm1, xmm2, byte 0 +pshuflw xmm1, dqword [rbx], byte 0 + +pslld xmm1, xmm2 +pslld xmm1, dqword [rbx] +pslld xmm1, byte 5 + +pslldq xmm1, byte 5 + +psllq xmm1, xmm2 +psllq xmm1, dqword [rbx] +psllq xmm1, byte 5 + +psllw xmm1, xmm2 +psllw xmm1, dqword [rbx] +psllw xmm1, byte 5 + +psrad xmm1, xmm2 +psrad xmm1, dqword [rbx] +psrad xmm1, byte 5 + +psraw xmm1, xmm2 +psraw xmm1, dqword [rbx] +psraw xmm1, byte 5 + +psrld xmm1, xmm2 +psrld xmm1, dqword [rbx] +psrld xmm1, byte 5 + +psrldq xmm1, byte 5 + +psrlq xmm1, xmm2 +psrlq xmm1, dqword [rbx] +psrlq xmm1, byte 5 + +psrlw xmm1, xmm2 +psrlw xmm1, dqword [rbx] +psrlw xmm1, byte 5 + +psubb xmm1, xmm2 +psubb xmm1, dqword [rbx] + +psubd xmm1, xmm2 +psubd xmm1, dqword [rbx] + +psubq xmm1, xmm2 +psubq xmm1, dqword [rbx] + +psubsb xmm1, xmm2 +psubsb xmm1, dqword [rbx] + +psubsw xmm1, xmm2 +psubsw xmm1, dqword [rbx] + +psubusb xmm1, xmm2 +psubusb xmm1, dqword [rbx] + +psubusw xmm1, xmm2 +psubusw xmm1, dqword [rbx] + +psubw xmm1, xmm2 +psubw xmm1, dqword [rbx] + +punpckhbw xmm1, xmm2 +punpckhbw xmm1, dqword [rbx] + +punpckhdq xmm1, xmm2 +punpckhdq xmm1, dqword [rbx] + +punpckhqdq xmm1, xmm2 +punpckhqdq xmm1, dqword [rbx] + +punpckhwd xmm1, xmm2 +punpckhwd xmm1, dqword [rbx] + +punpcklbw xmm1, xmm2 +punpcklbw xmm1, dqword [rbx] + +punpckldq xmm1, xmm2 +punpckldq xmm1, dqword [rbx] + +punpcklqdq xmm1, xmm2 +punpcklqdq xmm1, dqword [rbx] + +punpcklwd xmm1, xmm2 +punpcklwd xmm1, dqword [rbx] + +pxor xmm1, xmm2 +pxor xmm1, dqword [rbx] + +rcpps xmm1, xmm2 +rcpps xmm1, dqword [rbx] + +rcpss xmm1, xmm2 +rcpss xmm1, dword [rbx] + +rsqrtps xmm1, xmm2 +rsqrtps xmm1, dqword [rbx] + +rsqrtss xmm1, xmm2 +rsqrtss xmm1, dword [rbx] + +shufpd xmm1, xmm2, 0 +shufpd xmm1, dqword [rbx], byte 0 + +shufps xmm1, xmm2, 0 +shufps xmm1, dqword [rbx], byte 0 + +sqrtpd xmm1, xmm2 +sqrtpd xmm1, dqword [rbx] + +sqrtps xmm1, xmm2 +sqrtps xmm1, dqword [rbx] + +sqrtsd xmm1, xmm2 +sqrtsd xmm1, qword [rbx] + +sqrtss xmm1, xmm2 +sqrtss xmm1, dword [rbx] + +stmxcsr dword [rbx] + +subpd xmm1, xmm2 +subpd xmm1, dqword [rbx] + +subps xmm1, xmm2 +subps xmm1, dqword [rbx] + +subsd xmm1, xmm2 +subsd xmm1, qword [rbx] + +subss xmm1, xmm2 +subss xmm1, dword [rbx] + +ucomisd xmm1, xmm2 +ucomisd xmm1, qword [rbx] + +ucomiss xmm1, xmm2 +ucomiss xmm1, dword [rbx] + +unpckhpd xmm1, xmm2 +unpckhpd xmm1, dqword [rbx] + +unpckhps xmm1, xmm2 +unpckhps xmm1, dqword [rbx] + +unpcklpd xmm1, xmm2 +unpcklpd xmm1, dqword [rbx] + +unpcklps xmm1, xmm2 +unpcklps xmm1, dqword [rbx] + +xorpd xmm1, xmm2 +xorpd xmm1, dqword [rbx] + +xorps xmm1, xmm2 +xorps xmm1, dqword [rbx] + diff --git a/modules/arch/x86/tests/ssewidth.hex b/modules/arch/x86/tests/ssewidth.hex new file mode 100644 index 00000000..fc24e8da --- /dev/null +++ b/modules/arch/x86/tests/ssewidth.hex @@ -0,0 +1,1532 @@ +66 +0f +58 +ca +66 +0f +58 +0b +0f +58 +ca +0f +58 +0b +f2 +0f +58 +ca +f2 +0f +58 +0b +f3 +0f +58 +ca +f3 +0f +58 +0b +66 +0f +d0 +ca +66 +0f +d0 +0b +f2 +0f +d0 +ca +f2 +0f +d0 +0b +66 +0f +55 +ca +66 +0f +55 +0b +0f +55 +ca +0f +55 +0b +66 +0f +54 +ca +66 +0f +54 +0b +0f +54 +ca +0f +54 +0b +66 +0f +c2 +ca +00 +66 +0f +c2 +0b +00 +66 +0f +c2 +ca +00 +66 +0f +c2 +0b +00 +0f +c2 +ca +00 +0f +c2 +0b +00 +0f +c2 +ca +00 +0f +c2 +0b +00 +f2 +0f +c2 +ca +00 +f2 +0f +c2 +0b +00 +f2 +0f +c2 +ca +00 +f2 +0f +c2 +0b +00 +f3 +0f +c2 +ca +00 +f3 +0f +c2 +0b +00 +f3 +0f +c2 +ca +00 +f3 +0f +c2 +0b +00 +66 +0f +2f +ca +66 +0f +2f +0b +0f +2f +ca +0f +2f +0b +f3 +0f +e6 +ca +f3 +0f +e6 +0b +0f +5b +ca +0f +5b +0b +f2 +0f +e6 +ca +f2 +0f +e6 +0b +66 +0f +2d +ca +66 +0f +2d +0b +66 +0f +5a +ca +66 +0f +5a +0b +66 +0f +2a +ca +66 +0f +2a +0b +0f +2a +ca +0f +2a +0b +66 +0f +5b +ca +66 +0f +5b +0b +0f +5a +ca +0f +5a +0b +0f +2d +ca +0f +2d +0b +f2 +48 +0f +2d +da +f2 +48 +0f +2d +1b +f2 +0f +5a +ca +f2 +0f +5a +0b +f2 +0f +2a +cb +f2 +0f +2a +0b +f2 +48 +0f +2a +cb +f2 +48 +0f +2a +0b +f3 +0f +2a +cb +f3 +0f +2a +0b +f3 +48 +0f +2a +cb +f3 +48 +0f +2a +0b +f3 +0f +5a +ca +f3 +0f +5a +0b +f3 +0f +2d +da +f3 +0f +2d +1b +f3 +48 +0f +2d +da +f3 +48 +0f +2d +1b +66 +0f +e6 +ca +66 +0f +e6 +0b +66 +0f +2c +ca +66 +0f +2c +0b +f3 +0f +5b +ca +f3 +0f +5b +0b +0f +2c +ca +0f +2c +0b +f2 +0f +2c +c1 +f2 +0f +2c +03 +f2 +48 +0f +2c +c1 +f2 +48 +0f +2c +03 +f3 +0f +2c +c1 +f3 +0f +2c +03 +f3 +48 +0f +2c +c1 +f3 +48 +0f +2c +03 +66 +0f +5e +ca +66 +0f +5e +0b +0f +5e +ca +0f +5e +0b +f2 +0f +5e +ca +f2 +0f +5e +0b +f3 +0f +5e +ca +f3 +0f +5e +0b +66 +0f +78 +c1 +00 +01 +66 +0f +78 +c1 +00 +01 +66 +0f +79 +ca +66 +0f +7c +ca +66 +0f +7c +0b +f2 +0f +7c +ca +f2 +0f +7c +0b +66 +0f +7d +ca +66 +0f +7d +0b +f2 +0f +7d +ca +f2 +0f +7d +0b +f2 +0f +78 +ca +00 +01 +f2 +0f +78 +ca +00 +01 +f2 +0f +79 +ca +f2 +0f +f0 +0b +0f +ae +13 +66 +0f +f7 +ca +66 +0f +5f +ca +66 +0f +5f +0b +0f +5f +ca +0f +5f +0b +f2 +0f +5f +ca +f2 +0f +5f +0b +f3 +0f +5f +ca +f3 +0f +5f +0b +66 +0f +5d +ca +66 +0f +5d +0b +0f +5d +ca +0f +5d +0b +f2 +0f +5d +ca +f2 +0f +5d +0b +f3 +0f +5d +ca +f3 +0f +5d +0b +66 +0f +28 +ca +66 +0f +28 +0b +66 +0f +29 +13 +0f +28 +ca +0f +28 +0b +0f +29 +13 +66 +0f +6e +cb +66 +0f +6e +0b +66 +48 +0f +6e +cb +66 +48 +0f +6e +0b +66 +0f +7e +13 +66 +48 +0f +7e +13 +f2 +0f +12 +ca +f2 +0f +12 +0b +f2 +0f +d6 +ca +66 +0f +6f +ca +66 +0f +6f +0b +66 +0f +7f +13 +f3 +0f +6f +ca +f3 +0f +6f +0b +f3 +0f +7f +13 +0f +12 +ca +66 +0f +16 +0b +66 +0f +17 +13 +0f +16 +0b +0f +17 +13 +0f +16 +ca +66 +0f +12 +0b +66 +0f +13 +13 +0f +12 +0b +0f +13 +13 +66 +0f +50 +da +0f +50 +da +66 +0f +e7 +13 +66 +0f +2b +13 +0f +2b +13 +f2 +0f +2b +13 +f3 +0f +2b +13 +f3 +0f +7e +ca +f3 +0f +7e +0b +66 +0f +d6 +13 +f3 +0f +d6 +ca +f2 +0f +10 +ca +f2 +0f +10 +0b +f2 +0f +11 +13 +f3 +0f +16 +ca +f3 +0f +16 +0b +f3 +0f +12 +ca +f3 +0f +12 +0b +f3 +0f +10 +ca +f3 +0f +10 +0b +f3 +0f +11 +13 +66 +0f +10 +ca +66 +0f +10 +0b +66 +0f +11 +13 +0f +10 +ca +0f +10 +0b +0f +11 +13 +66 +0f +59 +ca +66 +0f +59 +0b +0f +59 +ca +0f +59 +0b +f2 +0f +59 +ca +f2 +0f +59 +0b +f3 +0f +59 +ca +f3 +0f +59 +0b +66 +0f +56 +ca +66 +0f +56 +0b +0f +56 +ca +0f +56 +0b +66 +0f +6b +ca +66 +0f +6b +0b +66 +0f +63 +ca +66 +0f +63 +0b +66 +0f +67 +ca +66 +0f +67 +0b +66 +0f +fc +ca +66 +0f +fc +0b +66 +0f +fe +ca +66 +0f +fe +0b +66 +0f +d4 +ca +66 +0f +d4 +0b +66 +0f +ec +ca +66 +0f +ec +0b +66 +0f +ed +ca +66 +0f +ed +0b +66 +0f +dc +ca +66 +0f +dc +0b +66 +0f +dd +ca +66 +0f +dd +0b +66 +0f +fd +ca +66 +0f +fd +0b +66 +0f +db +ca +66 +0f +db +0b +66 +0f +df +ca +66 +0f +df +0b +66 +0f +e0 +ca +66 +0f +e0 +0b +66 +0f +e3 +ca +66 +0f +e3 +0b +66 +0f +74 +ca +66 +0f +74 +0b +66 +0f +76 +ca +66 +0f +76 +0b +66 +0f +75 +ca +66 +0f +75 +0b +66 +0f +64 +ca +66 +0f +64 +0b +66 +0f +66 +ca +66 +0f +66 +0b +66 +0f +65 +ca +66 +0f +65 +0b +66 +0f +c5 +da +00 +66 +0f +c4 +cb +00 +66 +0f +c4 +0b +00 +66 +0f +f5 +ca +66 +0f +f5 +0b +66 +0f +ee +ca +66 +0f +ee +0b +66 +0f +de +ca +66 +0f +de +0b +66 +0f +ea +ca +66 +0f +ea +0b +66 +0f +da +ca +66 +0f +da +0b +66 +0f +d7 +c2 +66 +0f +e4 +ca +66 +0f +e4 +0b +66 +0f +e5 +ca +66 +0f +e5 +0b +66 +0f +d5 +ca +66 +0f +d5 +0b +66 +0f +f4 +ca +66 +0f +f4 +0b +66 +0f +eb +ca +66 +0f +eb +0b +66 +0f +f6 +ca +66 +0f +f6 +0b +66 +0f +70 +ca +00 +66 +0f +70 +0b +00 +f3 +0f +70 +ca +00 +f3 +0f +70 +0b +00 +f2 +0f +70 +ca +00 +f2 +0f +70 +0b +00 +66 +0f +f2 +ca +66 +0f +f2 +0b +66 +0f +72 +f1 +05 +66 +0f +73 +f9 +05 +66 +0f +f3 +ca +66 +0f +f3 +0b +66 +0f +73 +f1 +05 +66 +0f +f1 +ca +66 +0f +f1 +0b +66 +0f +71 +f1 +05 +66 +0f +e2 +ca +66 +0f +e2 +0b +66 +0f +72 +e1 +05 +66 +0f +e1 +ca +66 +0f +e1 +0b +66 +0f +71 +e1 +05 +66 +0f +d2 +ca +66 +0f +d2 +0b +66 +0f +72 +d1 +05 +66 +0f +73 +d9 +05 +66 +0f +d3 +ca +66 +0f +d3 +0b +66 +0f +73 +d1 +05 +66 +0f +d1 +ca +66 +0f +d1 +0b +66 +0f +71 +d1 +05 +66 +0f +f8 +ca +66 +0f +f8 +0b +66 +0f +fa +ca +66 +0f +fa +0b +66 +0f +fb +ca +66 +0f +fb +0b +66 +0f +e8 +ca +66 +0f +e8 +0b +66 +0f +e9 +ca +66 +0f +e9 +0b +66 +0f +d8 +ca +66 +0f +d8 +0b +66 +0f +d9 +ca +66 +0f +d9 +0b +66 +0f +f9 +ca +66 +0f +f9 +0b +66 +0f +68 +ca +66 +0f +68 +0b +66 +0f +6a +ca +66 +0f +6a +0b +66 +0f +6d +ca +66 +0f +6d +0b +66 +0f +69 +ca +66 +0f +69 +0b +66 +0f +60 +ca +66 +0f +60 +0b +66 +0f +62 +ca +66 +0f +62 +0b +66 +0f +6c +ca +66 +0f +6c +0b +66 +0f +61 +ca +66 +0f +61 +0b +66 +0f +ef +ca +66 +0f +ef +0b +0f +53 +ca +0f +53 +0b +f3 +0f +53 +ca +f3 +0f +53 +0b +0f +52 +ca +0f +52 +0b +f3 +0f +52 +ca +f3 +0f +52 +0b +66 +0f +c6 +ca +00 +66 +0f +c6 +0b +00 +0f +c6 +ca +00 +0f +c6 +0b +00 +66 +0f +51 +ca +66 +0f +51 +0b +0f +51 +ca +0f +51 +0b +f2 +0f +51 +ca +f2 +0f +51 +0b +f3 +0f +51 +ca +f3 +0f +51 +0b +0f +ae +1b +66 +0f +5c +ca +66 +0f +5c +0b +0f +5c +ca +0f +5c +0b +f2 +0f +5c +ca +f2 +0f +5c +0b +f3 +0f +5c +ca +f3 +0f +5c +0b +66 +0f +2e +ca +66 +0f +2e +0b +0f +2e +ca +0f +2e +0b +66 +0f +15 +ca +66 +0f +15 +0b +0f +15 +ca +0f +15 +0b +66 +0f +14 +ca +66 +0f +14 +0b +0f +14 +ca +0f +14 +0b +66 +0f +57 +ca +66 +0f +57 +0b +0f +57 +ca +0f +57 +0b diff --git a/modules/arch/x86/tests/strict-err.errwarn b/modules/arch/x86/tests/strict-err.errwarn index 62ebb456..ac3b21b8 100644 --- a/modules/arch/x86/tests/strict-err.errwarn +++ b/modules/arch/x86/tests/strict-err.errwarn @@ -1,4 +1,4 @@ --:2: invalid size for operand 1 --:3: invalid size for operand 1 --:4: invalid size for operand 2 --:5: invalid size for operand 2 +-:2: error: invalid size for operand 1 +-:3: error: invalid size for operand 1 +-:4: error: invalid size for operand 2 +-:5: error: invalid size for operand 2 diff --git a/modules/arch/x86/tests/vmx-err.errwarn b/modules/arch/x86/tests/vmx-err.errwarn index 6faab0a7..7db4b3cb 100644 --- a/modules/arch/x86/tests/vmx-err.errwarn +++ b/modules/arch/x86/tests/vmx-err.errwarn @@ -1,2 +1,2 @@ --:6: invalid size for operand 2 --:7: invalid size for operand 1 +-:6: error: invalid size for operand 2 +-:7: error: invalid size for operand 1 diff --git a/modules/arch/x86/tests/vsib-err.asm b/modules/arch/x86/tests/vsib-err.asm new file mode 100644 index 00000000..ee306038 --- /dev/null +++ b/modules/arch/x86/tests/vsib-err.asm @@ -0,0 +1,14 @@ +; Errors caught during instruction matching + +[bits 64] + +vpgatherdq xmm0,xmm0,xmm0 ; no reg EA template + +vpgatherdq xmm0,[ymm0],xmm0 ; not a VSIB256 template +vpgatherqq ymm0,[xmm0],ymm0 ; not a VSIB128 template + +vpgatherdq xmm0,[rel 0],xmm0 +vpgatherdq xmm0,[0],xmm0 +vpgatherdq xmm0,[rax],xmm0 +vpgatherdq xmm0,[rax+rbx],xmm0 + diff --git a/modules/arch/x86/tests/vsib-err.errwarn b/modules/arch/x86/tests/vsib-err.errwarn new file mode 100644 index 00000000..8d2d084f --- /dev/null +++ b/modules/arch/x86/tests/vsib-err.errwarn @@ -0,0 +1,7 @@ +-:5: error: invalid combination of opcode and operands +-:7: error: invalid combination of opcode and operands +-:8: error: invalid combination of opcode and operands +-:10: error: invalid combination of opcode and operands +-:11: error: invalid combination of opcode and operands +-:12: error: invalid combination of opcode and operands +-:13: error: invalid combination of opcode and operands diff --git a/modules/arch/x86/tests/vsib.asm b/modules/arch/x86/tests/vsib.asm new file mode 100644 index 00000000..fc2a705b --- /dev/null +++ b/modules/arch/x86/tests/vsib.asm @@ -0,0 +1,114 @@ +[bits 16] +; test promotion to 32-bit address size +vpgatherdq xmm0,[xmm0],xmm0 ; 67 c4 e2 f9 90 04 05 00 00 00 00 +vpgatherqq ymm0,[ymm0],ymm0 ; 67 c4 e2 fd 91 04 05 00 00 00 00 + +[bits 32] +; test promotion from base to index +vpgatherdq xmm0,[xmm0],xmm0 ; c4 e2 f9 90 04 05 00 00 00 00 +vpgatherqq ymm0,[ymm0],ymm0 ; c4 e2 fd 91 04 05 00 00 00 00 + +; various combinations +vpgatherdq xmm0,[ecx+xmm5],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[ecx+ymm5],ymm0 ; c4 e2 fd 91 04 29 +vpgatherdq xmm0,[ebp+xmm5],xmm0 ; c4 e2 f9 90 44 2d 00 +vpgatherqq ymm0,[ebp+ymm5],ymm0 ; c4 e2 fd 91 44 2d 00 + +vpgatherdq xmm0,[xmm5+ecx],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[ymm5+ecx],ymm0 ; c4 e2 fd 91 04 29 +vpgatherdq xmm0,[xmm5+ebp],xmm0 ; c4 e2 f9 90 44 2d 00 +vpgatherqq ymm0,[ymm5+ebp],ymm0 ; c4 e2 fd 91 44 2d 00 + +vpgatherdq xmm0,[ecx+xmm5*1],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[ecx+ymm5*1],ymm0 ; c4 e2 fd 91 04 29 +vpgatherdq xmm0,[ebp+xmm5*1],xmm0 ; c4 e2 f9 90 44 2d 00 +vpgatherqq ymm0,[ebp+ymm5*1],ymm0 ; c4 e2 fd 91 44 2d 00 + +vpgatherdq xmm0,[xmm5+ecx*1],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[ymm5+ecx*1],ymm0 ; c4 e2 fd 91 04 29 +vpgatherdq xmm0,[xmm5+ebp*1],xmm0 ; c4 e2 f9 90 44 2d 00 +vpgatherqq ymm0,[ymm5+ebp*1],ymm0 ; c4 e2 fd 91 44 2d 00 + +vpgatherdq xmm0,[nosplit 12345678h + xmm5*1],xmm0; c4 e2 f9 90 04 2d 78 56 34 12 +vpgatherqq ymm0,[nosplit 12345678h + ymm5*1],ymm0; c4 e2 fd 91 04 2d 78 56 34 12 + +vpgatherdq xmm0,[byte ecx + 12 + xmm5*2],xmm0 ; c4 e2 f9 90 44 69 0c +vpgatherqq ymm0,[byte ecx + 12 + ymm5*2],ymm0 ; c4 e2 fd 91 44 69 0c +vpgatherdq xmm0,[byte ebp + 12 + xmm5*2],xmm0 ; c4 e2 f9 90 44 6d 0c +vpgatherqq ymm0,[byte ebp + 12 + ymm5*2],ymm0 ; c4 e2 fd 91 44 6d 0c + +vpgatherdq xmm0,[dword ecx + 12 + xmm5*4],xmm0 ; c4 e2 f9 90 84 a9 0c 00 00 00 +vpgatherqq ymm0,[dword ecx + 12 + ymm5*4],ymm0 ; c4 e2 fd 91 84 a9 0c 00 00 00 +vpgatherdq xmm0,[dword ebp + 12 + xmm5*4],xmm0 ; c4 e2 f9 90 84 ad 0c 00 00 00 +vpgatherqq ymm0,[dword ebp + 12 + ymm5*4],ymm0 ; c4 e2 fd 91 84 ad 0c 00 00 00 + +vpgatherdq xmm0,[ecx + 12345678h + xmm5*4],xmm0 ; c4 e2 f9 90 84 a9 78 56 34 12 +vpgatherqq ymm0,[ecx + 12345678h + ymm5*4],ymm0 ; c4 e2 fd 91 84 a9 78 56 34 12 +vpgatherdq xmm0,[ebp + 12345678h + xmm5*4],xmm0 ; c4 e2 f9 90 84 ad 78 56 34 12 +vpgatherqq ymm0,[ebp + 12345678h + ymm5*4],ymm0 ; c4 e2 fd 91 84 ad 78 56 34 12 + +vpgatherdq xmm0,[ecx + 12 + xmm5*4],xmm0 ; c4 e2 f9 90 44 a9 0c +vpgatherqq ymm0,[ecx + 12 + ymm5*4],ymm0 ; c4 e2 fd 91 44 a9 0c +vpgatherdq xmm0,[ebp + 12 + xmm5*4],xmm0 ; c4 e2 f9 90 44 ad 0c +vpgatherqq ymm0,[ebp + 12 + ymm5*4],ymm0 ; c4 e2 fd 91 44 ad 0c + +vpgatherdq xmm0,[dword 12 + xmm5*8],xmm0 ; c4 e2 f9 90 04 ed 0c 00 00 00 +vpgatherqq ymm0,[dword 12 + ymm5*8],ymm0 ; c4 e2 fd 91 04 ed 0c 00 00 00 +vpgatherdq xmm0,[12 + xmm5*8],xmm0 ; c4 e2 f9 90 04 ed 0c 00 00 00 +vpgatherqq ymm0,[12 + ymm5*8],ymm0 ; c4 e2 fd 91 04 ed 0c 00 00 00 + +[bits 64] +; test promotion from base to index +vpgatherdq xmm0,[xmm0],xmm0 ; c4 e2 f9 90 04 05 00 00 00 00 +vpgatherqq ymm0,[ymm0],ymm0 ; c4 e2 fd 91 04 05 00 00 00 00 + +; various combinations +vpgatherdq xmm0,[rcx+xmm5],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[rcx+ymm13],ymm0 ; c4 a2 fd 91 04 29 +vpgatherdq xmm0,[r13+xmm13],xmm0 ; c4 82 f9 90 44 2d 00 +vpgatherqq ymm0,[r13+ymm5],ymm0 ; c4 c2 fd 91 44 2d 00 + +vpgatherdq xmm0,[xmm5+rcx],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[ymm13+rcx],ymm0 ; c4 a2 fd 91 04 29 +vpgatherdq xmm0,[xmm13+r13],xmm0 ; c4 82 f9 90 44 2d 00 +vpgatherqq ymm0,[ymm5+r13],ymm0 ; c4 c2 fd 91 44 2d 00 + +vpgatherdq xmm0,[rcx+xmm5*1],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[rcx+ymm13*1],ymm0 ; c4 a2 fd 91 04 29 +vpgatherdq xmm0,[r13+xmm13*1],xmm0 ; c4 82 f9 90 44 2d 00 +vpgatherqq ymm0,[r13+ymm5*1],ymm0 ; c4 c2 fd 91 44 2d 00 + +vpgatherdq xmm0,[xmm5+rcx*1],xmm0 ; c4 e2 f9 90 04 29 +vpgatherqq ymm0,[ymm13+rcx*1],ymm0 ; c4 a2 fd 91 04 29 +vpgatherdq xmm0,[xmm13+r13*1],xmm0 ; c4 82 f9 90 44 2d 00 +vpgatherqq ymm0,[ymm5+r13*1],ymm0 ; c4 c2 fd 91 44 2d 00 + +vpgatherdq xmm0,[nosplit 12345678h + xmm5*1],xmm0; c4 e2 f9 90 04 2d 78 56 34 12 +vpgatherqq ymm0,[nosplit 12345678h + ymm5*1],ymm0; c4 e2 fd 91 04 2d 78 56 34 12 + +vpgatherdq xmm0,[byte rcx + 12 + xmm5*2],xmm0 ; c4 e2 f9 90 44 69 0c +vpgatherqq ymm0,[byte rcx + 12 + ymm13*2],ymm0 ; c4 a2 fd 91 44 69 0c +vpgatherdq xmm0,[byte r13 + 12 + xmm13*2],xmm0 ; c4 82 f9 90 44 6d 0c +vpgatherqq ymm0,[byte r13 + 12 + ymm5*2],ymm0 ; c4 c2 fd 91 44 6d 0c + +vpgatherdq xmm0,[dword rcx + 12 + xmm5*4],xmm0 ; c4 e2 f9 90 84 a9 0c 00 00 00 +vpgatherqq ymm0,[dword rcx + 12 + ymm13*4],ymm0 ; c4 a2 fd 91 84 a9 0c 00 00 00 +vpgatherdq xmm0,[dword r13 + 12 + xmm13*4],xmm0 ; c4 82 f9 90 84 ad 0c 00 00 00 +vpgatherqq ymm0,[dword r13 + 12 + ymm5*4],ymm0 ; c4 c2 fd 91 84 ad 0c 00 00 00 + +vpgatherdq xmm0,[rcx + 12345678h + xmm5*4],xmm0 ; c4 e2 f9 90 84 a9 78 56 34 12 +vpgatherqq ymm0,[rcx + 12345678h + ymm13*4],ymm0; c4 a2 fd 91 84 a9 78 56 34 12 +vpgatherdq xmm0,[r13 + 12345678h + xmm13*4],xmm0; c4 82 f9 90 84 ad 78 56 34 12 +vpgatherqq ymm0,[r13 + 12345678h + ymm5*4],ymm0 ; c4 c2 fd 91 84 ad 78 56 34 12 + +vpgatherdq xmm0,[rcx + 12 + xmm5*4],xmm0 ; c4 e2 f9 90 44 a9 0c +vpgatherqq ymm0,[rcx + 12 + ymm13*4],ymm0 ; c4 a2 fd 91 44 a9 0c +vpgatherdq xmm0,[r13 + 12 + xmm13*4],xmm0 ; c4 82 f9 90 44 ad 0c +vpgatherqq ymm0,[r13 + 12 + ymm5*4],ymm0 ; c4 c2 fd 91 44 ad 0c + +vpgatherdq xmm0,[dword 12 + xmm5*8],xmm0 ; c4 e2 f9 90 04 ed 0c 00 00 00 +vpgatherqq ymm0,[dword 12 + ymm13*8],ymm0 ; c4 a2 fd 91 04 ed 0c 00 00 00 +vpgatherdq xmm0,[12 + xmm13*8],xmm0 ; c4 a2 f9 90 04 ed 0c 00 00 00 +vpgatherqq ymm0,[12 + ymm5*8],ymm0 ; c4 e2 fd 91 04 ed 0c 00 00 00 + + diff --git a/modules/arch/x86/tests/vsib.hex b/modules/arch/x86/tests/vsib.hex new file mode 100644 index 00000000..7dfde886 --- /dev/null +++ b/modules/arch/x86/tests/vsib.hex @@ -0,0 +1,662 @@ +67 +c4 +e2 +f9 +90 +04 +05 +00 +00 +00 +00 +67 +c4 +e2 +fd +91 +04 +05 +00 +00 +00 +00 +c4 +e2 +f9 +90 +04 +05 +00 +00 +00 +00 +c4 +e2 +fd +91 +04 +05 +00 +00 +00 +00 +c4 +e2 +f9 +90 +04 +29 +c4 +e2 +fd +91 +04 +29 +c4 +e2 +f9 +90 +44 +2d +00 +c4 +e2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +29 +c4 +e2 +fd +91 +04 +29 +c4 +e2 +f9 +90 +44 +2d +00 +c4 +e2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +29 +c4 +e2 +fd +91 +04 +29 +c4 +e2 +f9 +90 +44 +2d +00 +c4 +e2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +29 +c4 +e2 +fd +91 +04 +29 +c4 +e2 +f9 +90 +44 +2d +00 +c4 +e2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +2d +78 +56 +34 +12 +c4 +e2 +fd +91 +04 +2d +78 +56 +34 +12 +c4 +e2 +f9 +90 +44 +69 +0c +c4 +e2 +fd +91 +44 +69 +0c +c4 +e2 +f9 +90 +44 +6d +0c +c4 +e2 +fd +91 +44 +6d +0c +c4 +e2 +f9 +90 +84 +a9 +0c +00 +00 +00 +c4 +e2 +fd +91 +84 +a9 +0c +00 +00 +00 +c4 +e2 +f9 +90 +84 +ad +0c +00 +00 +00 +c4 +e2 +fd +91 +84 +ad +0c +00 +00 +00 +c4 +e2 +f9 +90 +84 +a9 +78 +56 +34 +12 +c4 +e2 +fd +91 +84 +a9 +78 +56 +34 +12 +c4 +e2 +f9 +90 +84 +ad +78 +56 +34 +12 +c4 +e2 +fd +91 +84 +ad +78 +56 +34 +12 +c4 +e2 +f9 +90 +44 +a9 +0c +c4 +e2 +fd +91 +44 +a9 +0c +c4 +e2 +f9 +90 +44 +ad +0c +c4 +e2 +fd +91 +44 +ad +0c +c4 +e2 +f9 +90 +04 +ed +0c +00 +00 +00 +c4 +e2 +fd +91 +04 +ed +0c +00 +00 +00 +c4 +e2 +f9 +90 +04 +ed +0c +00 +00 +00 +c4 +e2 +fd +91 +04 +ed +0c +00 +00 +00 +c4 +e2 +f9 +90 +04 +05 +00 +00 +00 +00 +c4 +e2 +fd +91 +04 +05 +00 +00 +00 +00 +c4 +e2 +f9 +90 +04 +29 +c4 +a2 +fd +91 +04 +29 +c4 +82 +f9 +90 +44 +2d +00 +c4 +c2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +29 +c4 +a2 +fd +91 +04 +29 +c4 +82 +f9 +90 +44 +2d +00 +c4 +c2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +29 +c4 +a2 +fd +91 +04 +29 +c4 +82 +f9 +90 +44 +2d +00 +c4 +c2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +29 +c4 +a2 +fd +91 +04 +29 +c4 +82 +f9 +90 +44 +2d +00 +c4 +c2 +fd +91 +44 +2d +00 +c4 +e2 +f9 +90 +04 +2d +78 +56 +34 +12 +c4 +e2 +fd +91 +04 +2d +78 +56 +34 +12 +c4 +e2 +f9 +90 +44 +69 +0c +c4 +a2 +fd +91 +44 +69 +0c +c4 +82 +f9 +90 +44 +6d +0c +c4 +c2 +fd +91 +44 +6d +0c +c4 +e2 +f9 +90 +84 +a9 +0c +00 +00 +00 +c4 +a2 +fd +91 +84 +a9 +0c +00 +00 +00 +c4 +82 +f9 +90 +84 +ad +0c +00 +00 +00 +c4 +c2 +fd +91 +84 +ad +0c +00 +00 +00 +c4 +e2 +f9 +90 +84 +a9 +78 +56 +34 +12 +c4 +a2 +fd +91 +84 +a9 +78 +56 +34 +12 +c4 +82 +f9 +90 +84 +ad +78 +56 +34 +12 +c4 +c2 +fd +91 +84 +ad +78 +56 +34 +12 +c4 +e2 +f9 +90 +44 +a9 +0c +c4 +a2 +fd +91 +44 +a9 +0c +c4 +82 +f9 +90 +44 +ad +0c +c4 +c2 +fd +91 +44 +ad +0c +c4 +e2 +f9 +90 +04 +ed +0c +00 +00 +00 +c4 +a2 +fd +91 +04 +ed +0c +00 +00 +00 +c4 +a2 +f9 +90 +04 +ed +0c +00 +00 +00 +c4 +e2 +fd +91 +04 +ed +0c +00 +00 +00 diff --git a/modules/arch/x86/tests/vsib2-err.asm b/modules/arch/x86/tests/vsib2-err.asm new file mode 100644 index 00000000..7e3ac55e --- /dev/null +++ b/modules/arch/x86/tests/vsib2-err.asm @@ -0,0 +1,19 @@ +; Errors caught during EA checking + +[bits 32] +vpgatherqq ymm0,[ymm0+ecx*2],ymm0 + +[bits 64] +addpd xmm0,[xmm0] ; not a VSIB128 template +addpd xmm0,[ymm0] ; not a VSIB256 template + +[bits 32] +vpgatherdq xmm0,[bp+xmm0],xmm0 + +vpgatherdq xmm0,[xmm0+ymm0],xmm0 + +vpgatherqq ymm0,[word ymm0],ymm0 + +vpgatherqq ymm0,[byte ymm0],ymm0 + + diff --git a/modules/arch/x86/tests/vsib2-err.errwarn b/modules/arch/x86/tests/vsib2-err.errwarn new file mode 100644 index 00000000..877ce62e --- /dev/null +++ b/modules/arch/x86/tests/vsib2-err.errwarn @@ -0,0 +1,7 @@ +-:4: error: invalid effective address +-:7: error: invalid effective address +-:8: error: invalid effective address +-:11: error: invalid effective address +-:13: error: invalid effective address +-:15: error: invalid effective address +-:17: warning: invalid displacement size; fixed diff --git a/modules/arch/x86/tests/x86_test.sh b/modules/arch/x86/tests/x86_test.sh index d2e6e373..56aa2154 100755 --- a/modules/arch/x86/tests/x86_test.sh +++ b/modules/arch/x86/tests/x86_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ -${srcdir}/out_test.sh x86_test modules/arch/x86/tests "x86 arch" "-f bin" "" +${srcdir}/out_test.sh x86_test modules/arch/x86/tests "x86 arch" "-f bin -Wsegreg-in-64bit" "" exit $? diff --git a/modules/arch/x86/tests/xchg64.asm b/modules/arch/x86/tests/xchg64.asm index d6a13949..794d4f1c 100644 --- a/modules/arch/x86/tests/xchg64.asm +++ b/modules/arch/x86/tests/xchg64.asm @@ -8,3 +8,25 @@ xchg ebx, eax xchg rax, rax xchg rax, rbx xchg rbx, rax + +xchg al, al +xchg al, r8b +xchg r8b, al + +xchg ax, ax +xchg ax, r8w +xchg r8w, ax +xchg ax, r9w +xchg r9w, ax + +xchg eax, eax +xchg eax, r8d +xchg r8d, eax +xchg eax, r9d +xchg r9d, eax + +xchg rax, rax +xchg rax, r8 +xchg r8, rax +xchg rax, r9 +xchg r9, rax diff --git a/modules/arch/x86/tests/xchg64.hex b/modules/arch/x86/tests/xchg64.hex index f7149e3d..44adfca8 100644 --- a/modules/arch/x86/tests/xchg64.hex +++ b/modules/arch/x86/tests/xchg64.hex @@ -13,3 +13,44 @@ c0 93 48 93 +86 +c0 +44 +86 +c0 +41 +86 +c0 +66 +90 +66 +41 +90 +66 +41 +90 +66 +41 +91 +66 +41 +91 +87 +c0 +41 +90 +41 +90 +41 +91 +41 +91 +90 +49 +90 +49 +90 +49 +91 +49 +91 diff --git a/modules/arch/x86/tests/xop-all.asm b/modules/arch/x86/tests/xop-all.asm new file mode 100644 index 00000000..db5dabf0 --- /dev/null +++ b/modules/arch/x86/tests/xop-all.asm @@ -0,0 +1,266 @@ +; Instructions are ordered in XOP databook order +; BITS=16 to minimize output length +[bits 16] +vfrczpd xmm1, xmm2 ; 8F E9 78 81 312 +vfrczpd xmm1, [0] ; 8F E9 78 81 016 00 00 +vfrczpd xmm1, dqword [0] ; 8F E9 78 81 016 00 00 +vfrczpd ymm1, ymm2 ; 8F E9 7C 81 312 +vfrczpd ymm1, [0] ; 8F E9 7C 81 016 00 00 +vfrczpd ymm1, yword [0] ; 8F E9 7C 81 016 00 00 + +vfrczps xmm1, xmm2 ; 8F E9 78 80 312 +vfrczps xmm1, [0] ; 8F E9 78 80 016 00 00 +vfrczps xmm1, dqword [0] ; 8F E9 78 80 016 00 00 +vfrczps ymm1, ymm2 ; 8F E9 7C 80 312 +vfrczps ymm1, [0] ; 8F E9 7C 80 016 00 00 +vfrczps ymm1, yword [0] ; 8F E9 7C 80 016 00 00 + +vfrczsd xmm1, xmm2 ; 8F E9 78 83 312 +vfrczsd xmm1, [0] ; 8F E9 78 83 016 00 00 +vfrczsd xmm1, qword [0] ; 8F E9 78 83 016 00 00 + +vfrczss xmm1, xmm2 ; 8F E9 78 82 312 +vfrczss xmm1, [0] ; 8F E9 78 82 016 00 00 +vfrczss xmm1, dword [0] ; 8F E9 78 82 016 00 00 + +vpcmov xmm1, xmm2, xmm3, xmm4 ; 8F E8 68 A2 313 40 /or/ 8F E8 E8 A2 314 30 +vpcmov xmm1, xmm2, xmm3, [0] ; 8F E8 E8 A2 016 00 00 30 +vpcmov xmm1, xmm2, xmm3, dqword [0] ; 8F E8 E8 A2 016 00 00 30 +vpcmov xmm1, xmm2, [0], xmm4 ; 8F E8 68 A2 016 00 00 40 +vpcmov xmm1, xmm2, dqword [0], xmm4 ; 8F E8 68 A2 016 00 00 40 +vpcmov ymm1, ymm2, ymm3, ymm4 ; 8F E8 6C A2 313 40 /or/ 8F E8 EC A2 314 30 +vpcmov ymm1, ymm2, ymm3, [0] ; 8F E8 EC A2 016 00 00 30 +vpcmov ymm1, ymm2, ymm3, yword [0] ; 8F E8 EC A2 016 00 00 30 +vpcmov ymm1, ymm2, [0], ymm4 ; 8F E8 6C A2 016 00 00 40 +vpcmov ymm1, ymm2, yword [0], ymm4 ; 8F E8 6C A2 016 00 00 40 + +vpcomb xmm1, xmm4, xmm7, 5 ; 8F E8 58 CC 317 05 +vpcomb xmm2, xmm5, [0], byte 5 ; 8F E8 50 CC 026 00 00 05 +vpcomb xmm3, xmm6, dqword [0], 5 ; 8F E8 48 CC 036 00 00 05 + +vpcomd xmm1, xmm4, xmm7, 5 ; 8F E8 58 CE 317 05 +vpcomd xmm2, xmm5, [0], byte 5 ; 8F E8 50 CE 026 00 00 05 +vpcomd xmm3, xmm6, dqword [0], 5 ; 8F E8 48 CE 036 00 00 05 + +vpcomq xmm1, xmm4, xmm7, 5 ; 8F E8 58 CF 317 05 +vpcomq xmm2, xmm5, [0], byte 5 ; 8F E8 50 CF 026 00 00 05 +vpcomq xmm3, xmm6, dqword [0], 5 ; 8F E8 48 CF 036 00 00 05 + +vpcomub xmm1, xmm4, xmm7, 5 ; 8F E8 58 EC 317 05 +vpcomub xmm2, xmm5, [0], byte 5 ; 8F E8 50 EC 026 00 00 05 +vpcomub xmm3, xmm6, dqword [0], 5 ; 8F E8 48 EC 036 00 00 05 + +vpcomud xmm1, xmm4, xmm7, 5 ; 8F E8 58 EE 317 05 +vpcomud xmm2, xmm5, [0], byte 5 ; 8F E8 50 EE 026 00 00 05 +vpcomud xmm3, xmm6, dqword [0], 5 ; 8F E8 48 EE 036 00 00 05 + +vpcomuq xmm1, xmm4, xmm7, 5 ; 8F E8 58 EF 317 05 +vpcomuq xmm2, xmm5, [0], byte 5 ; 8F E8 50 EF 026 00 00 05 +vpcomuq xmm3, xmm6, dqword [0], 5 ; 8F E8 48 EF 036 00 00 05 + +vpcomuw xmm1, xmm4, xmm7, 5 ; 8F E8 58 ED 317 05 +vpcomuw xmm2, xmm5, [0], byte 5 ; 8F E8 50 ED 026 00 00 05 +vpcomuw xmm3, xmm6, dqword [0], 5 ; 8F E8 48 ED 036 00 00 05 + +vpcomw xmm1, xmm4, xmm7, 5 ; 8F E8 58 CD 317 05 +vpcomw xmm2, xmm5, [0], byte 5 ; 8F E8 50 CD 026 00 00 05 +vpcomw xmm3, xmm6, dqword [0], 5 ; 8F E8 48 CD 036 00 00 05 + +vphaddbd xmm1, xmm2 ; 8F E9 78 C2 312 +vphaddbd xmm1, [0] ; 8F E9 78 C2 016 00 00 +vphaddbd xmm1, dqword [0] ; 8F E9 78 C2 016 00 00 + +vphaddbq xmm1, xmm2 ; 8F E9 78 C3 312 +vphaddbq xmm1, [0] ; 8F E9 78 C3 016 00 00 +vphaddbq xmm1, dqword [0] ; 8F E9 78 C3 016 00 00 + +vphaddbw xmm1, xmm2 ; 8F E9 78 C1 312 +vphaddbw xmm1, [0] ; 8F E9 78 C1 016 00 00 +vphaddbw xmm1, dqword [0] ; 8F E9 78 C1 016 00 00 + +vphadddq xmm1, xmm2 ; 8F E9 78 CB 312 +vphadddq xmm1, [0] ; 8F E9 78 CB 016 00 00 +vphadddq xmm1, dqword [0] ; 8F E9 78 CB 016 00 00 + +vphaddubd xmm1, xmm2 ; 8F E9 78 D2 312 +vphaddubd xmm1, [0] ; 8F E9 78 D2 016 00 00 +vphaddubd xmm1, dqword [0] ; 8F E9 78 D2 016 00 00 + +vphaddubq xmm1, xmm2 ; 8F E9 78 D3 312 +vphaddubq xmm1, [0] ; 8F E9 78 D3 016 00 00 +vphaddubq xmm1, dqword [0] ; 8F E9 78 D3 016 00 00 + +vphaddubw xmm1, xmm2 ; 8F E9 78 D1 312 +vphaddubw xmm1, [0] ; 8F E9 78 D1 016 00 00 +vphaddubw xmm1, dqword [0] ; 8F E9 78 D1 016 00 00 + +vphaddudq xmm1, xmm2 ; 8F E9 78 DB 312 +vphaddudq xmm1, [0] ; 8F E9 78 DB 016 00 00 +vphaddudq xmm1, dqword [0] ; 8F E9 78 DB 016 00 00 + +vphadduwd xmm1, xmm2 ; 8F E9 78 D6 312 +vphadduwd xmm1, [0] ; 8F E9 78 D6 016 00 00 +vphadduwd xmm1, dqword [0] ; 8F E9 78 D6 016 00 00 + +vphadduwq xmm1, xmm2 ; 8F E9 78 D7 312 +vphadduwq xmm1, [0] ; 8F E9 78 D7 016 00 00 +vphadduwq xmm1, dqword [0] ; 8F E9 78 D7 016 00 00 + +vphaddwd xmm1, xmm2 ; 8F E9 78 C6 312 +vphaddwd xmm1, [0] ; 8F E9 78 C6 016 00 00 +vphaddwd xmm1, dqword [0] ; 8F E9 78 C6 016 00 00 + +vphaddwq xmm1, xmm2 ; 8F E9 78 C7 312 +vphaddwq xmm1, [0] ; 8F E9 78 C7 016 00 00 +vphaddwq xmm1, dqword [0] ; 8F E9 78 C7 016 00 00 + +vphsubbw xmm1, xmm2 ; 8F E9 78 E1 312 +vphsubbw xmm1, [0] ; 8F E9 78 E1 016 00 00 +vphsubbw xmm1, dqword [0] ; 8F E9 78 E1 016 00 00 + +vphsubdq xmm1, xmm2 ; 8F E9 78 E3 312 +vphsubdq xmm1, [0] ; 8F E9 78 E3 016 00 00 +vphsubdq xmm1, dqword [0] ; 8F E9 78 E3 016 00 00 + +vphsubwd xmm1, xmm2 ; 8F E9 78 E2 312 +vphsubwd xmm1, [0] ; 8F E9 78 E2 016 00 00 +vphsubwd xmm1, dqword [0] ; 8F E9 78 E2 016 00 00 + +vpmacsdd xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 9E 317 30 +vpmacsdd xmm2, xmm5, [0], xmm0 ; 8F E8 50 9E 026 00 00 00 +vpmacsdd xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 9E 036 00 00 20 + +vpmacsdqh xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 9F 317 30 +vpmacsdqh xmm2, xmm5, [0], xmm0 ; 8F E8 50 9F 026 00 00 00 +vpmacsdqh xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 9F 036 00 00 20 + +vpmacsdql xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 97 317 30 +vpmacsdql xmm2, xmm5, [0], xmm0 ; 8F E8 50 97 026 00 00 00 +vpmacsdql xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 97 036 00 00 20 + +vpmacssdd xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 8E 317 30 +vpmacssdd xmm2, xmm5, [0], xmm0 ; 8F E8 50 8E 026 00 00 00 +vpmacssdd xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 8E 036 00 00 20 + +vpmacssdqh xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 8F 317 30 +vpmacssdqh xmm2, xmm5, [0], xmm0 ; 8F E8 50 8F 026 00 00 00 +vpmacssdqh xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 8F 036 00 00 20 + +vpmacssdql xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 87 317 30 +vpmacssdql xmm2, xmm5, [0], xmm0 ; 8F E8 50 87 026 00 00 00 +vpmacssdql xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 87 036 00 00 20 + +vpmacsswd xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 86 317 30 +vpmacsswd xmm2, xmm5, [0], xmm0 ; 8F E8 50 86 026 00 00 00 +vpmacsswd xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 86 036 00 00 20 + +vpmacssww xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 85 317 30 +vpmacssww xmm2, xmm5, [0], xmm0 ; 8F E8 50 85 026 00 00 00 +vpmacssww xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 85 036 00 00 20 + +vpmacswd xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 96 317 30 +vpmacswd xmm2, xmm5, [0], xmm0 ; 8F E8 50 96 026 00 00 00 +vpmacswd xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 96 036 00 00 20 + +vpmacsww xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 95 317 30 +vpmacsww xmm2, xmm5, [0], xmm0 ; 8F E8 50 95 026 00 00 00 +vpmacsww xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 95 036 00 00 20 + +vpmadcsswd xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 A6 317 30 +vpmadcsswd xmm2, xmm5, [0], xmm0 ; 8F E8 50 A6 026 00 00 00 +vpmadcsswd xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 A6 036 00 00 20 + +vpmadcswd xmm1, xmm4, xmm7, xmm3 ; 8F E8 58 B6 317 30 +vpmadcswd xmm2, xmm5, [0], xmm0 ; 8F E8 50 B6 026 00 00 00 +vpmadcswd xmm3, xmm6, dqword [0], xmm2 ; 8F E8 48 B6 036 00 00 20 + +vpperm xmm1, xmm2, xmm3, xmm4 ; 8F E8 68 A3 313 40 /or/ 8F E8 E8 A3 314 30 +vpperm xmm1, xmm2, xmm3, [0] ; 8F E8 E8 A3 016 00 00 30 +vpperm xmm1, xmm2, xmm3, dqword [0] ; 8F E8 E8 A3 016 00 00 30 +vpperm xmm1, xmm2, [0], xmm4 ; 8F E8 68 A3 016 00 00 40 +vpperm xmm1, xmm2, dqword [0], xmm4 ; 8F E8 68 A3 016 00 00 40 + +vprotb xmm1, xmm2, xmm3 ; 8F E9 60 90 312 /or/ 8F E9 E8 90 313 +vprotb xmm1, xmm2, [0] ; 8F E9 E8 90 016 00 00 +vprotb xmm1, xmm2, dqword [0] ; 8F E9 E8 90 016 00 00 +vprotb xmm1, [0], xmm3 ; 8F E9 60 90 016 00 00 +vprotb xmm1, dqword [0], xmm3 ; 8F E9 60 90 016 00 00 +vprotb xmm1, xmm2, byte 5 ; 8F E8 78 C0 312 05 +vprotb xmm1, [0], byte 5 ; 8F E8 78 C0 016 00 00 05 +vprotb xmm1, dqword [0], 5 ; 8F E8 78 C0 016 00 00 05 + +vprotd xmm1, xmm2, xmm3 ; 8F E9 60 92 312 /or/ 8F E9 E8 92 313 +vprotd xmm1, xmm2, [0] ; 8F E9 E8 92 016 00 00 +vprotd xmm1, xmm2, dqword [0] ; 8F E9 E8 92 016 00 00 +vprotd xmm1, [0], xmm3 ; 8F E9 60 92 016 00 00 +vprotd xmm1, dqword [0], xmm3 ; 8F E9 60 92 016 00 00 +vprotd xmm1, xmm2, byte 5 ; 8F E8 78 C2 312 05 +vprotd xmm1, [0], byte 5 ; 8F E8 78 C2 016 00 00 05 +vprotd xmm1, dqword [0], 5 ; 8F E8 78 C2 016 00 00 05 + +vprotq xmm1, xmm2, xmm3 ; 8F E9 60 93 312 /or/ 8F E9 E8 93 313 +vprotq xmm1, xmm2, [0] ; 8F E9 E8 93 016 00 00 +vprotq xmm1, xmm2, dqword [0] ; 8F E9 E8 93 016 00 00 +vprotq xmm1, [0], xmm3 ; 8F E9 60 93 016 00 00 +vprotq xmm1, dqword [0], xmm3 ; 8F E9 60 93 016 00 00 +vprotq xmm1, xmm2, byte 5 ; 8F E8 78 C3 312 05 +vprotq xmm1, [0], byte 5 ; 8F E8 78 C3 016 00 00 05 +vprotq xmm1, dqword [0], 5 ; 8F E8 78 C3 016 00 00 05 + +vprotw xmm1, xmm2, xmm3 ; 8F E9 60 91 312 /or/ 8F E9 E8 91 313 +vprotw xmm1, xmm2, [0] ; 8F E9 E8 91 016 00 00 +vprotw xmm1, xmm2, dqword [0] ; 8F E9 E8 91 016 00 00 +vprotw xmm1, [0], xmm3 ; 8F E9 60 91 016 00 00 +vprotw xmm1, dqword [0], xmm3 ; 8F E9 60 91 016 00 00 +vprotw xmm1, xmm2, byte 5 ; 8F E8 78 C1 312 05 +vprotw xmm1, [0], byte 5 ; 8F E8 78 C1 016 00 00 05 +vprotw xmm1, dqword [0], 5 ; 8F E8 78 C1 016 00 00 05 + +vpshab xmm1, xmm2, xmm3 ; 8F E9 60 98 312 /or/ 8F E9 E8 98 313 +vpshab xmm1, xmm2, [0] ; 8F E9 E8 98 016 00 00 +vpshab xmm1, xmm2, dqword [0] ; 8F E9 E8 98 016 00 00 +vpshab xmm1, [0], xmm3 ; 8F E9 60 98 016 00 00 +vpshab xmm1, dqword [0], xmm3 ; 8F E9 60 98 016 00 00 + +vpshad xmm1, xmm2, xmm3 ; 8F E9 60 9A 312 /or/ 8F E9 E8 9A 313 +vpshad xmm1, xmm2, [0] ; 8F E9 E8 9A 016 00 00 +vpshad xmm1, xmm2, dqword [0] ; 8F E9 E8 9A 016 00 00 +vpshad xmm1, [0], xmm3 ; 8F E9 60 9A 016 00 00 +vpshad xmm1, dqword [0], xmm3 ; 8F E9 60 9A 016 00 00 + +vpshaq xmm1, xmm2, xmm3 ; 8F E9 60 9B 312 /or/ 8F E9 E8 9B 313 +vpshaq xmm1, xmm2, [0] ; 8F E9 E8 9B 016 00 00 +vpshaq xmm1, xmm2, dqword [0] ; 8F E9 E8 9B 016 00 00 +vpshaq xmm1, [0], xmm3 ; 8F E9 60 9B 016 00 00 +vpshaq xmm1, dqword [0], xmm3 ; 8F E9 60 9B 016 00 00 + +vpshaw xmm1, xmm2, xmm3 ; 8F E9 60 99 312 /or/ 8F E9 E8 99 313 +vpshaw xmm1, xmm2, [0] ; 8F E9 E8 99 016 00 00 +vpshaw xmm1, xmm2, dqword [0] ; 8F E9 E8 99 016 00 00 +vpshaw xmm1, [0], xmm3 ; 8F E9 60 99 016 00 00 +vpshaw xmm1, dqword [0], xmm3 ; 8F E9 60 99 016 00 00 + +vpshlb xmm1, xmm2, xmm3 ; 8F E9 60 94 312 /or/ 8F E9 E8 94 313 +vpshlb xmm1, xmm2, [0] ; 8F E9 E8 94 016 00 00 +vpshlb xmm1, xmm2, dqword [0] ; 8F E9 E8 94 016 00 00 +vpshlb xmm1, [0], xmm3 ; 8F E9 60 94 016 00 00 +vpshlb xmm1, dqword [0], xmm3 ; 8F E9 60 94 016 00 00 + +vpshld xmm1, xmm2, xmm3 ; 8F E9 60 96 312 /or/ 8F E9 E8 96 313 +vpshld xmm1, xmm2, [0] ; 8F E9 E8 96 016 00 00 +vpshld xmm1, xmm2, dqword [0] ; 8F E9 E8 96 016 00 00 +vpshld xmm1, [0], xmm3 ; 8F E9 60 96 016 00 00 +vpshld xmm1, dqword [0], xmm3 ; 8F E9 60 96 016 00 00 + +vpshlq xmm1, xmm2, xmm3 ; 8F E9 60 97 312 /or/ 8F E9 E8 97 313 +vpshlq xmm1, xmm2, [0] ; 8F E9 E8 97 016 00 00 +vpshlq xmm1, xmm2, dqword [0] ; 8F E9 E8 97 016 00 00 +vpshlq xmm1, [0], xmm3 ; 8F E9 60 97 016 00 00 +vpshlq xmm1, dqword [0], xmm3 ; 8F E9 60 97 016 00 00 + +vpshlw xmm1, xmm2, xmm3 ; 8F E9 60 95 312 /or/ 8F E9 E8 95 313 +vpshlw xmm1, xmm2, [0] ; 8F E9 E8 95 016 00 00 +vpshlw xmm1, xmm2, dqword [0] ; 8F E9 E8 95 016 00 00 +vpshlw xmm1, [0], xmm3 ; 8F E9 60 95 016 00 00 +vpshlw xmm1, dqword [0], xmm3 ; 8F E9 60 95 016 00 00 + diff --git a/modules/arch/x86/tests/xop-all.hex b/modules/arch/x86/tests/xop-all.hex new file mode 100644 index 00000000..ee9fd7fb --- /dev/null +++ b/modules/arch/x86/tests/xop-all.hex @@ -0,0 +1,1437 @@ +8f +e9 +78 +81 +ca +8f +e9 +78 +81 +0e +00 +00 +8f +e9 +78 +81 +0e +00 +00 +8f +e9 +7c +81 +ca +8f +e9 +7c +81 +0e +00 +00 +8f +e9 +7c +81 +0e +00 +00 +8f +e9 +78 +80 +ca +8f +e9 +78 +80 +0e +00 +00 +8f +e9 +78 +80 +0e +00 +00 +8f +e9 +7c +80 +ca +8f +e9 +7c +80 +0e +00 +00 +8f +e9 +7c +80 +0e +00 +00 +8f +e9 +78 +83 +ca +8f +e9 +78 +83 +0e +00 +00 +8f +e9 +78 +83 +0e +00 +00 +8f +e9 +78 +82 +ca +8f +e9 +78 +82 +0e +00 +00 +8f +e9 +78 +82 +0e +00 +00 +8f +e8 +68 +a2 +cb +40 +8f +e8 +e8 +a2 +0e +00 +00 +30 +8f +e8 +e8 +a2 +0e +00 +00 +30 +8f +e8 +68 +a2 +0e +00 +00 +40 +8f +e8 +68 +a2 +0e +00 +00 +40 +8f +e8 +6c +a2 +cb +40 +8f +e8 +ec +a2 +0e +00 +00 +30 +8f +e8 +ec +a2 +0e +00 +00 +30 +8f +e8 +6c +a2 +0e +00 +00 +40 +8f +e8 +6c +a2 +0e +00 +00 +40 +8f +e8 +58 +cc +cf +05 +8f +e8 +50 +cc +16 +00 +00 +05 +8f +e8 +48 +cc +1e +00 +00 +05 +8f +e8 +58 +ce +cf +05 +8f +e8 +50 +ce +16 +00 +00 +05 +8f +e8 +48 +ce +1e +00 +00 +05 +8f +e8 +58 +cf +cf +05 +8f +e8 +50 +cf +16 +00 +00 +05 +8f +e8 +48 +cf +1e +00 +00 +05 +8f +e8 +58 +ec +cf +05 +8f +e8 +50 +ec +16 +00 +00 +05 +8f +e8 +48 +ec +1e +00 +00 +05 +8f +e8 +58 +ee +cf +05 +8f +e8 +50 +ee +16 +00 +00 +05 +8f +e8 +48 +ee +1e +00 +00 +05 +8f +e8 +58 +ef +cf +05 +8f +e8 +50 +ef +16 +00 +00 +05 +8f +e8 +48 +ef +1e +00 +00 +05 +8f +e8 +58 +ed +cf +05 +8f +e8 +50 +ed +16 +00 +00 +05 +8f +e8 +48 +ed +1e +00 +00 +05 +8f +e8 +58 +cd +cf +05 +8f +e8 +50 +cd +16 +00 +00 +05 +8f +e8 +48 +cd +1e +00 +00 +05 +8f +e9 +78 +c2 +ca +8f +e9 +78 +c2 +0e +00 +00 +8f +e9 +78 +c2 +0e +00 +00 +8f +e9 +78 +c3 +ca +8f +e9 +78 +c3 +0e +00 +00 +8f +e9 +78 +c3 +0e +00 +00 +8f +e9 +78 +c1 +ca +8f +e9 +78 +c1 +0e +00 +00 +8f +e9 +78 +c1 +0e +00 +00 +8f +e9 +78 +cb +ca +8f +e9 +78 +cb +0e +00 +00 +8f +e9 +78 +cb +0e +00 +00 +8f +e9 +78 +d2 +ca +8f +e9 +78 +d2 +0e +00 +00 +8f +e9 +78 +d2 +0e +00 +00 +8f +e9 +78 +d3 +ca +8f +e9 +78 +d3 +0e +00 +00 +8f +e9 +78 +d3 +0e +00 +00 +8f +e9 +78 +d1 +ca +8f +e9 +78 +d1 +0e +00 +00 +8f +e9 +78 +d1 +0e +00 +00 +8f +e9 +78 +db +ca +8f +e9 +78 +db +0e +00 +00 +8f +e9 +78 +db +0e +00 +00 +8f +e9 +78 +d6 +ca +8f +e9 +78 +d6 +0e +00 +00 +8f +e9 +78 +d6 +0e +00 +00 +8f +e9 +78 +d7 +ca +8f +e9 +78 +d7 +0e +00 +00 +8f +e9 +78 +d7 +0e +00 +00 +8f +e9 +78 +c6 +ca +8f +e9 +78 +c6 +0e +00 +00 +8f +e9 +78 +c6 +0e +00 +00 +8f +e9 +78 +c7 +ca +8f +e9 +78 +c7 +0e +00 +00 +8f +e9 +78 +c7 +0e +00 +00 +8f +e9 +78 +e1 +ca +8f +e9 +78 +e1 +0e +00 +00 +8f +e9 +78 +e1 +0e +00 +00 +8f +e9 +78 +e3 +ca +8f +e9 +78 +e3 +0e +00 +00 +8f +e9 +78 +e3 +0e +00 +00 +8f +e9 +78 +e2 +ca +8f +e9 +78 +e2 +0e +00 +00 +8f +e9 +78 +e2 +0e +00 +00 +8f +e8 +58 +9e +cf +30 +8f +e8 +50 +9e +16 +00 +00 +00 +8f +e8 +48 +9e +1e +00 +00 +20 +8f +e8 +58 +9f +cf +30 +8f +e8 +50 +9f +16 +00 +00 +00 +8f +e8 +48 +9f +1e +00 +00 +20 +8f +e8 +58 +97 +cf +30 +8f +e8 +50 +97 +16 +00 +00 +00 +8f +e8 +48 +97 +1e +00 +00 +20 +8f +e8 +58 +8e +cf +30 +8f +e8 +50 +8e +16 +00 +00 +00 +8f +e8 +48 +8e +1e +00 +00 +20 +8f +e8 +58 +8f +cf +30 +8f +e8 +50 +8f +16 +00 +00 +00 +8f +e8 +48 +8f +1e +00 +00 +20 +8f +e8 +58 +87 +cf +30 +8f +e8 +50 +87 +16 +00 +00 +00 +8f +e8 +48 +87 +1e +00 +00 +20 +8f +e8 +58 +86 +cf +30 +8f +e8 +50 +86 +16 +00 +00 +00 +8f +e8 +48 +86 +1e +00 +00 +20 +8f +e8 +58 +85 +cf +30 +8f +e8 +50 +85 +16 +00 +00 +00 +8f +e8 +48 +85 +1e +00 +00 +20 +8f +e8 +58 +96 +cf +30 +8f +e8 +50 +96 +16 +00 +00 +00 +8f +e8 +48 +96 +1e +00 +00 +20 +8f +e8 +58 +95 +cf +30 +8f +e8 +50 +95 +16 +00 +00 +00 +8f +e8 +48 +95 +1e +00 +00 +20 +8f +e8 +58 +a6 +cf +30 +8f +e8 +50 +a6 +16 +00 +00 +00 +8f +e8 +48 +a6 +1e +00 +00 +20 +8f +e8 +58 +b6 +cf +30 +8f +e8 +50 +b6 +16 +00 +00 +00 +8f +e8 +48 +b6 +1e +00 +00 +20 +8f +e8 +68 +a3 +cb +40 +8f +e8 +e8 +a3 +0e +00 +00 +30 +8f +e8 +e8 +a3 +0e +00 +00 +30 +8f +e8 +68 +a3 +0e +00 +00 +40 +8f +e8 +68 +a3 +0e +00 +00 +40 +8f +e9 +60 +90 +ca +8f +e9 +e8 +90 +0e +00 +00 +8f +e9 +e8 +90 +0e +00 +00 +8f +e9 +60 +90 +0e +00 +00 +8f +e9 +60 +90 +0e +00 +00 +8f +e8 +78 +c0 +ca +05 +8f +e8 +78 +c0 +0e +00 +00 +05 +8f +e8 +78 +c0 +0e +00 +00 +05 +8f +e9 +60 +92 +ca +8f +e9 +e8 +92 +0e +00 +00 +8f +e9 +e8 +92 +0e +00 +00 +8f +e9 +60 +92 +0e +00 +00 +8f +e9 +60 +92 +0e +00 +00 +8f +e8 +78 +c2 +ca +05 +8f +e8 +78 +c2 +0e +00 +00 +05 +8f +e8 +78 +c2 +0e +00 +00 +05 +8f +e9 +60 +93 +ca +8f +e9 +e8 +93 +0e +00 +00 +8f +e9 +e8 +93 +0e +00 +00 +8f +e9 +60 +93 +0e +00 +00 +8f +e9 +60 +93 +0e +00 +00 +8f +e8 +78 +c3 +ca +05 +8f +e8 +78 +c3 +0e +00 +00 +05 +8f +e8 +78 +c3 +0e +00 +00 +05 +8f +e9 +60 +91 +ca +8f +e9 +e8 +91 +0e +00 +00 +8f +e9 +e8 +91 +0e +00 +00 +8f +e9 +60 +91 +0e +00 +00 +8f +e9 +60 +91 +0e +00 +00 +8f +e8 +78 +c1 +ca +05 +8f +e8 +78 +c1 +0e +00 +00 +05 +8f +e8 +78 +c1 +0e +00 +00 +05 +8f +e9 +60 +98 +ca +8f +e9 +e8 +98 +0e +00 +00 +8f +e9 +e8 +98 +0e +00 +00 +8f +e9 +60 +98 +0e +00 +00 +8f +e9 +60 +98 +0e +00 +00 +8f +e9 +60 +9a +ca +8f +e9 +e8 +9a +0e +00 +00 +8f +e9 +e8 +9a +0e +00 +00 +8f +e9 +60 +9a +0e +00 +00 +8f +e9 +60 +9a +0e +00 +00 +8f +e9 +60 +9b +ca +8f +e9 +e8 +9b +0e +00 +00 +8f +e9 +e8 +9b +0e +00 +00 +8f +e9 +60 +9b +0e +00 +00 +8f +e9 +60 +9b +0e +00 +00 +8f +e9 +60 +99 +ca +8f +e9 +e8 +99 +0e +00 +00 +8f +e9 +e8 +99 +0e +00 +00 +8f +e9 +60 +99 +0e +00 +00 +8f +e9 +60 +99 +0e +00 +00 +8f +e9 +60 +94 +ca +8f +e9 +e8 +94 +0e +00 +00 +8f +e9 +e8 +94 +0e +00 +00 +8f +e9 +60 +94 +0e +00 +00 +8f +e9 +60 +94 +0e +00 +00 +8f +e9 +60 +96 +ca +8f +e9 +e8 +96 +0e +00 +00 +8f +e9 +e8 +96 +0e +00 +00 +8f +e9 +60 +96 +0e +00 +00 +8f +e9 +60 +96 +0e +00 +00 +8f +e9 +60 +97 +ca +8f +e9 +e8 +97 +0e +00 +00 +8f +e9 +e8 +97 +0e +00 +00 +8f +e9 +60 +97 +0e +00 +00 +8f +e9 +60 +97 +0e +00 +00 +8f +e9 +60 +95 +ca +8f +e9 +e8 +95 +0e +00 +00 +8f +e9 +e8 +95 +0e +00 +00 +8f +e9 +60 +95 +0e +00 +00 +8f +e9 +60 +95 +0e +00 +00 diff --git a/modules/arch/x86/tests/xop-basic.asm b/modules/arch/x86/tests/xop-basic.asm new file mode 100644 index 00000000..516b4bd2 --- /dev/null +++ b/modules/arch/x86/tests/xop-basic.asm @@ -0,0 +1,8 @@ +[bits 64] +vfrczpd ymm9, ymm10 ; 8F 49 7C 81 312 +vfrczpd ymm9, [0] ; 8F 69 7C 81 0C 25 00 00 00 00 +vfrczpd ymm9, yword [0] ; 8F 69 7C 81 0C 25 00 00 00 00 +vfrczpd ymm9, [r8*4] ; 8F 29 7C 81 0C 85 00 00 00 00 +vfrczpd ymm9, [r8*4+r9] ; 8F 09 7C 81 0C 81 + +vpcmov ymm10, ymm11, ymm12, ymm13 ; 8F 48 24 A2 324 D0 diff --git a/modules/arch/x86/tests/xop-basic.hex b/modules/arch/x86/tests/xop-basic.hex new file mode 100644 index 00000000..6be478a1 --- /dev/null +++ b/modules/arch/x86/tests/xop-basic.hex @@ -0,0 +1,47 @@ +8f +49 +7c +81 +ca +8f +69 +7c +81 +0c +25 +00 +00 +00 +00 +8f +69 +7c +81 +0c +25 +00 +00 +00 +00 +8f +29 +7c +81 +0c +85 +00 +00 +00 +00 +8f +09 +7c +81 +0c +81 +8f +48 +24 +a2 +d4 +d0 diff --git a/modules/arch/x86/tests/xop-cc.asm b/modules/arch/x86/tests/xop-cc.asm new file mode 100644 index 00000000..8b8bbe39 --- /dev/null +++ b/modules/arch/x86/tests/xop-cc.asm @@ -0,0 +1,22 @@ +[bits 16] +vpcomltb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 00 +vpcomleb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 01 +vpcomgtb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 02 +vpcomgeb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 03 +vpcomeqb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 04 +vpcomneqb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 05 +vpcomneb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 05 +vpcomfalseb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 06 +vpcomtrueb xmm1, xmm2, xmm3 ; 8F E8 68 CC 313 07 + +vpcomltuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 00 +vpcomleuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 01 +vpcomgtuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 02 +vpcomgeuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 03 +vpcomequw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 04 +vpcomnequw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 05 +vpcomneuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 05 +vpcomfalseuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 06 +vpcomtrueuw xmm1, xmm2, xmm3 ; 8F E8 68 ED 313 07 + + diff --git a/modules/arch/x86/tests/xop-cc.hex b/modules/arch/x86/tests/xop-cc.hex new file mode 100644 index 00000000..24300585 --- /dev/null +++ b/modules/arch/x86/tests/xop-cc.hex @@ -0,0 +1,108 @@ +8f +e8 +68 +cc +cb +00 +8f +e8 +68 +cc +cb +01 +8f +e8 +68 +cc +cb +02 +8f +e8 +68 +cc +cb +03 +8f +e8 +68 +cc +cb +04 +8f +e8 +68 +cc +cb +05 +8f +e8 +68 +cc +cb +05 +8f +e8 +68 +cc +cb +06 +8f +e8 +68 +cc +cb +07 +8f +e8 +68 +ed +cb +00 +8f +e8 +68 +ed +cb +01 +8f +e8 +68 +ed +cb +02 +8f +e8 +68 +ed +cb +03 +8f +e8 +68 +ed +cb +04 +8f +e8 +68 +ed +cb +05 +8f +e8 +68 +ed +cb +05 +8f +e8 +68 +ed +cb +06 +8f +e8 +68 +ed +cb +07 diff --git a/modules/arch/x86/tests/xsave.asm b/modules/arch/x86/tests/xsave.asm new file mode 100644 index 00000000..43f5f28d --- /dev/null +++ b/modules/arch/x86/tests/xsave.asm @@ -0,0 +1,8 @@ +xsave [0] +xrstor [0] +xgetbv +xsetbv + +xsaveopt [0] +[bits 64] +xsaveopt64 [0] diff --git a/modules/arch/x86/tests/xsave.hex b/modules/arch/x86/tests/xsave.hex new file mode 100644 index 00000000..21e3a193 --- /dev/null +++ b/modules/arch/x86/tests/xsave.hex @@ -0,0 +1,30 @@ +0f +ae +26 +00 +00 +0f +ae +2e +00 +00 +0f +01 +d0 +0f +01 +d1 +0f +ae +36 +00 +00 +48 +0f +ae +34 +25 +00 +00 +00 +00 diff --git a/modules/arch/x86/x86arch.c b/modules/arch/x86/x86arch.c index 42a95389..bac11774 100644 --- a/modules/arch/x86/x86arch.c +++ b/modules/arch/x86/x86arch.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "x86arch.h" @@ -41,14 +39,20 @@ x86_create(const char *machine, const char *parser, /*@out@*/ yasm_arch_create_error *error) { yasm_arch_x86 *arch_x86; - unsigned int amd64_machine; + unsigned int amd64_machine, address_size; *error = YASM_ARCH_CREATE_OK; - if (yasm__strcasecmp(machine, "x86") == 0) + if (yasm__strcasecmp(machine, "x86") == 0) { amd64_machine = 0; - else if (yasm__strcasecmp(machine, "amd64") == 0) + address_size = 32; + } else if (yasm__strcasecmp(machine, "amd64") == 0) { amd64_machine = 1; + address_size = 64; + } else if (yasm__strcasecmp(machine, "x32") == 0) { + amd64_machine = 1; + address_size = 32; + } else { *error = YASM_ARCH_CREATE_BAD_MACHINE; return NULL; @@ -58,13 +62,25 @@ x86_create(const char *machine, const char *parser, arch_x86->arch.module = &yasm_x86_LTX_arch; - arch_x86->cpu_enabled = ~CPU_Any; + /* default to all instructions/features enabled */ + arch_x86->active_cpu = 0; + arch_x86->cpu_enables_size = 1; + arch_x86->cpu_enables = yasm_xmalloc(sizeof(wordptr)); + arch_x86->cpu_enables[0] = BitVector_Create(64, FALSE); + BitVector_Fill(arch_x86->cpu_enables[0]); + arch_x86->amd64_machine = amd64_machine; arch_x86->mode_bits = 0; + arch_x86->address_size = address_size; arch_x86->force_strict = 0; + arch_x86->default_rel = 0; + arch_x86->gas_intel_mode = 0; + arch_x86->nop = X86_NOP_BASIC; if (yasm__strcasecmp(parser, "nasm") == 0) arch_x86->parser = X86_PARSER_NASM; + else if (yasm__strcasecmp(parser, "tasm") == 0) + arch_x86->parser = X86_PARSER_TASM; else if (yasm__strcasecmp(parser, "gas") == 0 || yasm__strcasecmp(parser, "gnu") == 0) arch_x86->parser = X86_PARSER_GAS; @@ -80,6 +96,11 @@ x86_create(const char *machine, const char *parser, static void x86_destroy(/*@only@*/ yasm_arch *arch) { + yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; + unsigned int i; + for (i=0; icpu_enables_size; i++) + BitVector_Destroy(arch_x86->cpu_enables[i]); + yasm_xfree(arch_x86->cpu_enables); yasm_xfree(arch); } @@ -87,9 +108,12 @@ static const char * x86_get_machine(const yasm_arch *arch) { const yasm_arch_x86 *arch_x86 = (const yasm_arch_x86 *)arch; - if (arch_x86->amd64_machine) - return "amd64"; - else + if (arch_x86->amd64_machine) { + if (arch_x86->address_size == 32) + return "x32"; + else + return "amd64"; + } else return "x86"; } @@ -99,10 +123,7 @@ x86_get_address_size(const yasm_arch *arch) const yasm_arch_x86 *arch_x86 = (const yasm_arch_x86 *)arch; if (arch_x86->mode_bits != 0) return arch_x86->mode_bits; - if (arch_x86->amd64_machine) - return 64; - else - return 32; + return arch_x86->address_size; } static int @@ -110,10 +131,18 @@ x86_set_var(yasm_arch *arch, const char *var, unsigned long val) { yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; if (yasm__strcasecmp(var, "mode_bits") == 0) - arch_x86->mode_bits = (unsigned char)val; + arch_x86->mode_bits = (unsigned int)val; else if (yasm__strcasecmp(var, "force_strict") == 0) - arch_x86->force_strict = (unsigned char)val; - else + arch_x86->force_strict = (unsigned int)val; + else if (yasm__strcasecmp(var, "default_rel") == 0) { + if (arch_x86->mode_bits != 64) + yasm_warn_set(YASM_WARN_GENERAL, + N_("ignoring default rel in non-64-bit mode")); + else + arch_x86->default_rel = (unsigned int)val; + } else if (yasm__strcasecmp(var, "gas_intel_mode") == 0) { + arch_x86->gas_intel_mode = (unsigned int)val; + } else return 1; return 0; } @@ -199,163 +228,227 @@ x86_get_fill(const yasm_arch *arch) const yasm_arch_x86 *arch_x86 = (const yasm_arch_x86 *)arch; /* Fill patterns that GAS uses. */ - static const unsigned char *fill16[16] = { - NULL, /* unused */ - (const unsigned char *) - "\x90", /* 1 - nop */ - (const unsigned char *) - "\x89\xf6", /* 2 - mov si, si */ - (const unsigned char *) - "\x8d\x74\x00", /* 3 - lea si, [si+byte 0] */ - (const unsigned char *) - "\x8d\xb4\x00\x00", /* 4 - lea si, [si+word 0] */ - (const unsigned char *) - "\x90" /* 5 - nop */ - "\x8d\xb4\x00\x00", /* lea si, [si+word 0] */ - (const unsigned char *) - "\x89\xf6" /* 6 - mov si, si */ - "\x8d\xbd\x00\x00", /* lea di, [di+word 0] */ - (const unsigned char *) - "\x8d\x74\x00" /* 7 - lea si, [si+byte 0] */ - "\x8d\xbd\x00\x00", /* lea di, [di+word 0] */ - (const unsigned char *) - "\x8d\xb4\x00\x00" /* 8 - lea si, [si+word 0] */ - "\x8d\xbd\x00\x00", /* lea di, [di+word 0] */ - (const unsigned char *) - "\xeb\x07\x90\x90\x90\x90\x90" /* 9 - jmp $+9; nop fill */ - "\x90\x90", - (const unsigned char *) - "\xeb\x08\x90\x90\x90\x90\x90" /* 10 - jmp $+10; nop fill */ - "\x90\x90\x90", - (const unsigned char *) - "\xeb\x09\x90\x90\x90\x90\x90" /* 11 - jmp $+11; nop fill */ - "\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0a\x90\x90\x90\x90\x90" /* 12 - jmp $+12; nop fill */ - "\x90\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0b\x90\x90\x90\x90\x90" /* 13 - jmp $+13; nop fill */ - "\x90\x90\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0c\x90\x90\x90\x90\x90" /* 14 - jmp $+14; nop fill */ - "\x90\x90\x90\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0d\x90\x90\x90\x90\x90" /* 15 - jmp $+15; nop fill */ - "\x90\x90\x90\x90\x90\x90\x90\x90" + static const unsigned char fill16_1[1] = + {0x90}; /* 1 - nop */ + static const unsigned char fill16_2[2] = + {0x89, 0xf6}; /* 2 - mov si, si */ + static const unsigned char fill16_3[3] = + {0x8d, 0x74, 0x00}; /* 3 - lea si, [si+byte 0] */ + static const unsigned char fill16_4[4] = + {0x8d, 0xb4, 0x00, 0x00}; /* 4 - lea si, [si+word 0] */ + static const unsigned char fill16_5[5] = + {0x90, /* 5 - nop */ + 0x8d, 0xb4, 0x00, 0x00}; /* lea si, [si+word 0] */ + static const unsigned char fill16_6[6] = + {0x89, 0xf6, /* 6 - mov si, si */ + 0x8d, 0xbd, 0x00, 0x00}; /* lea di, [di+word 0] */ + static const unsigned char fill16_7[7] = + {0x8d, 0x74, 0x00, /* 7 - lea si, [si+byte 0] */ + 0x8d, 0xbd, 0x00, 0x00}; /* lea di, [di+word 0] */ + static const unsigned char fill16_8[8] = + {0x8d, 0xb4, 0x00, 0x00, /* 8 - lea si, [si+word 0] */ + 0x8d, 0xbd, 0x00, 0x00}; /* lea di, [di+word 0] */ + static const unsigned char fill16_9[9] = + {0xeb, 0x07, 0x90, 0x90, 0x90, 0x90, /* 9 - jmp $+9; nop fill */ + 0x90, 0x90, 0x90}; + static const unsigned char fill16_10[10] = + {0xeb, 0x08, 0x90, 0x90, 0x90, 0x90, /* 10 - jmp $+10; nop fill */ + 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill16_11[11] = + {0xeb, 0x09, 0x90, 0x90, 0x90, 0x90, /* 11 - jmp $+11; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill16_12[12] = + {0xeb, 0x0a, 0x90, 0x90, 0x90, 0x90, /* 12 - jmp $+12; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill16_13[13] = + {0xeb, 0x0b, 0x90, 0x90, 0x90, 0x90, /* 13 - jmp $+13; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill16_14[14] = + {0xeb, 0x0c, 0x90, 0x90, 0x90, 0x90, /* 14 - jmp $+14; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill16_15[15] = + {0xeb, 0x0d, 0x90, 0x90, 0x90, 0x90, /* 15 - jmp $+15; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char *fill16[16] = + { + NULL, fill16_1, fill16_2, fill16_3, + fill16_4, fill16_5, fill16_6, fill16_7, + fill16_8, fill16_9, fill16_10, fill16_11, + fill16_12, fill16_13, fill16_14, fill16_15 }; - static const unsigned char *fill32[16] = { - NULL, /* unused */ - (const unsigned char *) - "\x90", /* 1 - nop */ - (const unsigned char *) - "\x89\xf6", /* 2 - mov esi, esi */ - (const unsigned char *) - "\x8d\x76\x00", /* 3 - lea esi, [esi+byte 0] */ - (const unsigned char *) - "\x8d\x74\x26\x00", /* 4 - lea esi, [esi*1+byte 0] */ - (const unsigned char *) - "\x90" /* 5 - nop */ - "\x8d\x74\x26\x00", /* lea esi, [esi*1+byte 0] */ - (const unsigned char *) - "\x8d\xb6\x00\x00\x00\x00", /* 6 - lea esi, [esi+dword 0] */ - (const unsigned char *) - "\x8d\xb4\x26\x00\x00\x00\x00", /* 7 - lea esi, [esi*1+dword 0] */ - (const unsigned char *) - "\x90" /* 8 - nop */ - "\x8d\xb4\x26\x00\x00\x00\x00", /* lea esi, [esi*1+dword 0] */ + + static const unsigned char fill32_1[1] = + {0x90}; /* 1 - nop */ + static const unsigned char fill32_2[2] = + {0x66, 0x90}; /* 2 - xchg ax, ax (o16 nop) */ + static const unsigned char fill32_3[3] = + {0x8d, 0x76, 0x00}; /* 3 - lea esi, [esi+byte 0] */ + static const unsigned char fill32_4[4] = + {0x8d, 0x74, 0x26, 0x00}; /* 4 - lea esi, [esi*1+byte 0] */ + static const unsigned char fill32_5[5] = + {0x90, /* 5 - nop */ + 0x8d, 0x74, 0x26, 0x00}; /* lea esi, [esi*1+byte 0] */ + static const unsigned char fill32_6[6] = + {0x8d, 0xb6, 0x00, 0x00, 0x00, 0x00};/* 6 - lea esi, [esi+dword 0] */ + static const unsigned char fill32_7[7] = + {0x8d, 0xb4, 0x26, 0x00, 0x00, 0x00, /* 7 - lea esi, [esi*1+dword 0] */ + 0x00}; + static const unsigned char fill32_8[8] = + {0x90, /* 8 - nop */ + 0x8d, 0xb4, 0x26, 0x00, 0x00, 0x00, /* lea esi, [esi*1+dword 0] */ + 0x00}; #if 0 - /* GAS uses these */ - (const unsigned char *) - "\x89\xf6" /* 9 - mov esi, esi */ - "\x8d\xbc\x27\x00\x00\x00\x00", /* lea edi, [edi*1+dword 0] */ - (const unsigned char *) - "\x8d\x76\x00" /* 10 - lea esi, [esi+byte 0] */ - "\x8d\xbc\x27\x00\x00\x00\x00", /* lea edi, [edi+dword 0] */ - (const unsigned char *) - "\x8d\x74\x26\x00" /* 11 - lea esi, [esi*1+byte 0] */ - "\x8d\xbc\x27\x00\x00\x00\x00", /* lea edi, [edi*1+dword 0]*/ - (const unsigned char *) - "\x8d\xb6\x00\x00\x00\x00" /* 12 - lea esi, [esi+dword 0] */ - "\x8d\xbf\x00\x00\x00\x00", /* lea edi, [edi+dword 0] */ - (const unsigned char *) - "\x8d\xb6\x00\x00\x00\x00" /* 13 - lea esi, [esi+dword 0] */ - "\x8d\xbc\x27\x00\x00\x00\x00", /* lea edi, [edi*1+dword 0]*/ - (const unsigned char *) - "\x8d\xb4\x26\x00\x00\x00\x00" /* 14 - lea esi, [esi*1+dword 0]*/ - "\x8d\xbc\x27\x00\x00\x00\x00", /* lea edi, [edi*1+dword 0]*/ + /* GAS uses these */ + static const unsigned char fill32_9[9] = + {0x89, 0xf6, /* 9 - mov esi, esi */ + 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, /* lea edi, [edi*1+dword 0] */ + 0x00}; + static const unsigned char fill32_10[10] = + {0x8d, 0x76, 0x00, /* 10 - lea esi, [esi+byte 0] */ + 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, /* lea edi, [edi+dword 0] */ + 0x00}; + static const unsigned char fill32_11[11] = + {0x8d, 0x74, 0x26, 0x00, /* 11 - lea esi, [esi*1+byte 0] */ + 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, /* lea edi, [edi*1+dword 0] */ + 0x00}; + static const unsigned char fill32_12[12] = + {0x8d, 0xb6, 0x00, 0x00, 0x00, 0x00, /* 12 - lea esi, [esi+dword 0] */ + 0x8d, 0xbf, 0x00, 0x00, 0x00, 0x00};/* lea edi, [edi+dword 0] */ + static const unsigned char fill32_13[13] = + {0x8d, 0xb6, 0x00, 0x00, 0x00, 0x00, /* 13 - lea esi, [esi+dword 0] */ + 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, /* lea edi, [edi*1+dword 0] */ + 0x00}; + static const unsigned char fill32_14[14] = + {0x8d, 0xb4, 0x26, 0x00, 0x00, 0x00, /* 14 - lea esi, [esi*1+dword 0] */ + 0x00, + 0x8d, 0xbc, 0x27, 0x00, 0x00, 0x00, /* lea edi, [edi*1+dword 0] */ + 0x00}; #else - /* But on newer processors, these are recommended */ - (const unsigned char *) - "\xeb\x07\x90\x90\x90\x90\x90" /* 9 - jmp $+9; nop fill */ - "\x90\x90", - (const unsigned char *) - "\xeb\x08\x90\x90\x90\x90\x90" /* 10 - jmp $+10; nop fill */ - "\x90\x90\x90", - (const unsigned char *) - "\xeb\x09\x90\x90\x90\x90\x90" /* 11 - jmp $+11; nop fill */ - "\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0a\x90\x90\x90\x90\x90" /* 12 - jmp $+12; nop fill */ - "\x90\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0b\x90\x90\x90\x90\x90" /* 13 - jmp $+13; nop fill */ - "\x90\x90\x90\x90\x90\x90", - (const unsigned char *) - "\xeb\x0c\x90\x90\x90\x90\x90" /* 14 - jmp $+14; nop fill */ - "\x90\x90\x90\x90\x90\x90\x90", + /* But on newer processors, these are recommended */ + static const unsigned char fill32_9[9] = + {0xeb, 0x07, 0x90, 0x90, 0x90, 0x90, /* 9 - jmp $+9; nop fill */ + 0x90, 0x90, 0x90}; + static const unsigned char fill32_10[10] = + {0xeb, 0x08, 0x90, 0x90, 0x90, 0x90, /* 10 - jmp $+10; nop fill */ + 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill32_11[11] = + {0xeb, 0x09, 0x90, 0x90, 0x90, 0x90, /* 11 - jmp $+11; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill32_12[12] = + {0xeb, 0x0a, 0x90, 0x90, 0x90, 0x90, /* 12 - jmp $+12; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill32_13[13] = + {0xeb, 0x0b, 0x90, 0x90, 0x90, 0x90, /* 13 - jmp $+13; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char fill32_14[14] = + {0xeb, 0x0c, 0x90, 0x90, 0x90, 0x90, /* 14 - jmp $+14; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; #endif - (const unsigned char *) - "\xeb\x0d\x90\x90\x90\x90\x90" /* 15 - jmp $+15; nop fill */ - "\x90\x90\x90\x90\x90\x90\x90\x90" + static const unsigned char fill32_15[15] = + {0xeb, 0x0d, 0x90, 0x90, 0x90, 0x90, /* 15 - jmp $+15; nop fill */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90}; + static const unsigned char *fill32[16] = + { + NULL, fill32_1, fill32_2, fill32_3, + fill32_4, fill32_5, fill32_6, fill32_7, + fill32_8, fill32_9, fill32_10, fill32_11, + fill32_12, fill32_13, fill32_14, fill32_15 }; - static const unsigned char *fill64[16] = { - NULL, /* unused */ - (const unsigned char *) - "\x90", /* 1 - nop */ - (const unsigned char *) - "\x66\x90", /* 2 - o16; nop */ - (const unsigned char *) - "\x66\x66\x90", /* 3 - o16; o16; nop */ - (const unsigned char *) - "\x66\x66\x66\x90", /* 4 - o16; o16; o16; nop */ - (const unsigned char *) - "\x66\x66\x90\x66\x90", /* 5 */ - (const unsigned char *) - "\x66\x66\x90\x66\x66\x90", /* 6 */ - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x90", /* 7 */ - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x66" /* 8 */ - "\x90", - (const unsigned char *) - "\x66\x66\x90\x66\x66\x90\x66" /* 9 */ - "\x66\x90", - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x90" /* 10 */ - "\x66\x66\x90", - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x66" /* 11 */ - "\x90\x66\x66\x90", - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x66" /* 12 */ - "\x90\x66\x66\x66\x90", - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x90" /* 13 */ - "\x66\x66\x90\x66\x66\x90", - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x66" /* 14 */ - "\x90\x66\x66\x90\x66\x66\x90", - (const unsigned char *) - "\x66\x66\x66\x90\x66\x66\x66" /* 15 */ - "\x90\x66\x66\x66\x90\x66\x66\x90" + + /* Long form nops available on more recent Intel and AMD processors */ + static const unsigned char fill32new_3[3] = + {0x0f, 0x1f, 0x00}; /* 3 - nop(3) */ + static const unsigned char fill32new_4[4] = + {0x0f, 0x1f, 0x40, 0x00}; /* 4 - nop(4) */ + static const unsigned char fill32new_5[5] = + {0x0f, 0x1f, 0x44, 0x00, 0x00}; /* 5 - nop(5) */ + static const unsigned char fill32new_6[6] = + {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00}; /* 6 - nop(6) */ + static const unsigned char fill32new_7[7] = + {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00}; /* 7 - nop(7) */ + static const unsigned char fill32new_8[8] = + {0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, /* 8 - nop(8) */ + 0x00}; + static const unsigned char fill32new_9[9] = + {0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, /* 9 - nop(9) */ + 0x00, 0x00}; + + /* Longer forms preferred by Intel use repeated o16 prefixes */ + static const unsigned char fill32intel_10[10] = + {0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, /* 10 - o16; cs; nop */ + 0x00, 0x00, 0x00}; + static const unsigned char fill32intel_11[11] = + {0x66, 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, /* 11 - 2x o16; cs; nop */ + 0x00, 0x00, 0x00, 0x00}; + static const unsigned char fill32intel_12[12] = + {0x66, 0x66, 0x66, 0x2e, 0x0f, 0x1f, 0x84, /* 12 - 3x o16; cs; nop */ + 0x00, 0x00, 0x00, 0x00, 0x00}; + static const unsigned char fill32intel_13[13] = + {0x66, 0x66, 0x66, 0x66, 0x2e, 0x0f, 0x1f, /* 13 - 4x o16; cs; nop */ + 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}; + static const unsigned char fill32intel_14[14] = + {0x66, 0x66, 0x66, 0x66, 0x66, 0x2e, 0x0f, /* 14 - 5x o16; cs; nop */ + 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}; + static const unsigned char fill32intel_15[15] = + {0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x2e, /* 15 - 6x o16; cs; nop */ + 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}; + + /* Longer forms preferred by AMD use fewer o16 prefixes and no CS prefix; + * Source: Software Optimisation Guide for AMD Family 10h + * Processors 40546 revision 3.10 February 2009 + */ + static const unsigned char fill32amd_10[10] = + {0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, /* 10 - nop(10) */ + 0x00, 0x00, 0x00}; + static const unsigned char fill32amd_11[11] = + {0x0f, 0x1f, 0x44, 0x00, 0x00, /* 11 - nop(5) */ + 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00}; /* nop(6) */ + static const unsigned char fill32amd_12[12] = + {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00, /* 12 - nop(6) */ + 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00}; /* nop(6) */ + static const unsigned char fill32amd_13[13] = + {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00, /* 13 - nop(6) */ + 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00}; /* nop(7) */ + static const unsigned char fill32amd_14[14] = + {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, /* 14 - nop(7) */ + 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00}; /* nop(7) */ + static const unsigned char fill32amd_15[15] = + {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, /* 15 - nop(7) */ + 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}; /* nop(8) */ + + static const unsigned char *fill32_intel[16] = + { + NULL, fill32_1, fill32_2, fill32new_3, + fill32new_4, fill32new_5, fill32new_6, fill32new_7, + fill32new_8, fill32new_9, fill32intel_10, fill32intel_11, + fill32intel_12, fill32intel_13, fill32intel_14, fill32intel_15 }; + static const unsigned char *fill32_amd[16] = + { + NULL, fill32_1, fill32_2, fill32new_3, + fill32new_4, fill32new_5, fill32new_6, fill32new_7, + fill32new_8, fill32new_9, fill32amd_10, fill32amd_11, + fill32amd_12, fill32amd_13, fill32amd_14, fill32amd_15 + }; + switch (arch_x86->mode_bits) { case 16: return fill16; case 32: - return fill32; + if (arch_x86->nop == X86_NOP_INTEL) + return fill32_intel; + else if (arch_x86->nop == X86_NOP_AMD) + return fill32_amd; + else + return fill32; case 64: - return fill64; + /* We know long nops are available in 64-bit mode; default to Intel + * ones if unspecified (to match GAS behavior). + */ + if (arch_x86->nop == X86_NOP_AMD) + return fill32_amd; + else + return fill32_intel; default: yasm_error_set(YASM_ERROR_VALUE, N_("Invalid mode_bits in x86_get_fill")); @@ -364,7 +457,7 @@ x86_get_fill(const yasm_arch *arch) } unsigned int -yasm_x86__get_reg_size(yasm_arch *arch, uintptr_t reg) +yasm_x86__get_reg_size(uintptr_t reg) { switch ((x86_expritem_reg_size)(reg & ~0xFUL)) { case X86_REG8: @@ -382,6 +475,8 @@ yasm_x86__get_reg_size(yasm_arch *arch, uintptr_t reg) return 64; case X86_XMMREG: return 128; + case X86_YMMREG: + return 256; case X86_FPUREG: return 80; default: @@ -390,6 +485,12 @@ yasm_x86__get_reg_size(yasm_arch *arch, uintptr_t reg) return 0; } +static unsigned int +x86_get_reg_size(yasm_arch *arch, uintptr_t reg) +{ + return yasm_x86__get_reg_size(reg); +} + static uintptr_t x86_reggroup_get_reg(yasm_arch *arch, uintptr_t reggroup, unsigned long regindex) @@ -397,6 +498,7 @@ x86_reggroup_get_reg(yasm_arch *arch, uintptr_t reggroup, yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; switch ((x86_expritem_reg_size)(reggroup & ~0xFUL)) { case X86_XMMREG: + case X86_YMMREG: if (arch_x86->mode_bits == 64) { if (regindex > 15) return 0; @@ -423,15 +525,15 @@ x86_reg_print(yasm_arch *arch, uintptr_t reg, FILE *f) "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" }; static const char *name16[] = { - "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" + "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" }; static const char *name32[] = { - "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" + "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" }; static const char *name64[] = { - "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi" + "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" }; @@ -457,6 +559,9 @@ x86_reg_print(yasm_arch *arch, uintptr_t reg, FILE *f) case X86_XMMREG: fprintf(f, "xmm%d", (int)(reg&0xF)); break; + case X86_YMMREG: + fprintf(f, "ymm%d", (int)(reg&0xF)); + break; case X86_CRREG: fprintf(f, "cr%d", (int)(reg&0xF)); break; @@ -485,6 +590,7 @@ x86_segreg_print(yasm_arch *arch, uintptr_t segreg, FILE *f) static const yasm_arch_machine x86_machines[] = { { "IA-32 and derivatives", "x86" }, { "AMD64", "amd64" }, + { "X32", "x32" }, { NULL, NULL } }; @@ -510,14 +616,16 @@ yasm_arch_module yasm_x86_LTX_arch = { yasm_x86__parse_check_insnprefix, yasm_x86__parse_check_regtmod, x86_get_fill, - yasm_x86__finalize_insn, yasm_x86__floatnum_tobytes, yasm_x86__intnum_tobytes, - yasm_x86__get_reg_size, + x86_get_reg_size, x86_reggroup_get_reg, x86_reg_print, x86_segreg_print, yasm_x86__ea_create_expr, + yasm_x86__ea_destroy, + yasm_x86__ea_print, + yasm_x86__create_empty_insn, x86_machines, "x86", 16, diff --git a/modules/arch/x86/x86arch.h b/modules/arch/x86/x86arch.h index 5659ba5f..911482ee 100644 --- a/modules/arch/x86/x86arch.h +++ b/modules/arch/x86/x86arch.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * x86 Architecture header file * * Copyright (C) 2001-2007 Peter Johnson @@ -27,60 +27,99 @@ #ifndef YASM_X86ARCH_H #define YASM_X86ARCH_H -/* Available CPU feature flags */ -#define CPU_Any (0UL) /* Any old cpu will do */ -#define CPU_086 CPU_Any -#define CPU_186 (1UL<<0) /* i186 or better required */ -#define CPU_286 (1UL<<1) /* i286 or better required */ -#define CPU_386 (1UL<<2) /* i386 or better required */ -#define CPU_486 (1UL<<3) /* i486 or better required */ -#define CPU_586 (1UL<<4) /* i585 or better required */ -#define CPU_686 (1UL<<5) /* i686 or better required */ -#define CPU_P3 (1UL<<6) /* Pentium3 or better required */ -#define CPU_P4 (1UL<<7) /* Pentium4 or better required */ -#define CPU_IA64 (1UL<<8) /* IA-64 or better required */ -#define CPU_K6 (1UL<<9) /* AMD K6 or better required */ -#define CPU_Athlon (1UL<<10) /* AMD Athlon or better required */ -#define CPU_Hammer (1UL<<11) /* AMD Sledgehammer or better required */ -#define CPU_FPU (1UL<<12) /* FPU support required */ -#define CPU_MMX (1UL<<13) /* MMX support required */ -#define CPU_SSE (1UL<<14) /* Streaming SIMD extensions required */ -#define CPU_SSE2 (1UL<<15) /* Streaming SIMD extensions 2 required */ -#define CPU_SSE3 (1UL<<16) /* Streaming SIMD extensions 3 required */ -#define CPU_3DNow (1UL<<17) /* 3DNow! support required */ -#define CPU_Cyrix (1UL<<18) /* Cyrix-specific instruction */ -#define CPU_AMD (1UL<<19) /* AMD-specific inst. (older than K6) */ -#define CPU_SMM (1UL<<20) /* System Management Mode instruction */ -#define CPU_Prot (1UL<<21) /* Protected mode only instruction */ -#define CPU_Undoc (1UL<<22) /* Undocumented instruction */ -#define CPU_Obs (1UL<<23) /* Obsolete instruction */ -#define CPU_Priv (1UL<<24) /* Priveleged instruction */ -#define CPU_SVM (1UL<<25) /* Secure Virtual Machine instruction */ -#define CPU_PadLock (1UL<<25) /* VIA PadLock instruction */ -#define CPU_EM64T (1UL<<26) /* Intel EM64T or better */ -#define CPU_SSSE3 (1UL<<27) /* Streaming SIMD extensions 3 required */ -#define CPU_SSE41 (1UL<<28) /* Streaming SIMD extensions 4.1 required */ -#define CPU_SSE42 (1UL<<29) /* Streaming SIMD extensions 4.2 required */ -#define CPU_SSE4 (CPU_SSE41|CPU_SSE42) +#include -/* Technically not CPU capabilities, they do affect what instructions are - * available. These are tested against BITS==64. - */ -#define CPU_64 (1UL<<30) /* Only available in 64-bit mode */ -#define CPU_Not64 (1UL<<31) /* Not available (invalid) in 64-bit mode */ +/* Available CPU feature flags */ +#define CPU_Any 0 /* Any old cpu will do */ +#define CPU_086 CPU_Any +#define CPU_186 1 /* i186 or better required */ +#define CPU_286 2 /* i286 or better required */ +#define CPU_386 3 /* i386 or better required */ +#define CPU_486 4 /* i486 or better required */ +#define CPU_586 5 /* i585 or better required */ +#define CPU_686 6 /* i686 or better required */ +#define CPU_P3 7 /* Pentium3 or better required */ +#define CPU_P4 8 /* Pentium4 or better required */ +#define CPU_IA64 9 /* IA-64 or better required */ +#define CPU_K6 10 /* AMD K6 or better required */ +#define CPU_Athlon 11 /* AMD Athlon or better required */ +#define CPU_Hammer 12 /* AMD Sledgehammer or better required */ +#define CPU_FPU 13 /* FPU support required */ +#define CPU_MMX 14 /* MMX support required */ +#define CPU_SSE 15 /* Streaming SIMD extensions required */ +#define CPU_SSE2 16 /* Streaming SIMD extensions 2 required */ +#define CPU_SSE3 17 /* Streaming SIMD extensions 3 required */ +#define CPU_3DNow 18 /* 3DNow! support required */ +#define CPU_Cyrix 19 /* Cyrix-specific instruction */ +#define CPU_AMD 20 /* AMD-specific inst. (older than K6) */ +#define CPU_SMM 21 /* System Management Mode instruction */ +#define CPU_Prot 22 /* Protected mode only instruction */ +#define CPU_Undoc 23 /* Undocumented instruction */ +#define CPU_Obs 24 /* Obsolete instruction */ +#define CPU_Priv 25 /* Priveleged instruction */ +#define CPU_SVM 26 /* Secure Virtual Machine instruction */ +#define CPU_PadLock 27 /* VIA PadLock instruction */ +#define CPU_EM64T 28 /* Intel EM64T or better */ +#define CPU_SSSE3 29 /* Streaming SIMD extensions 3 required */ +#define CPU_SSE41 30 /* Streaming SIMD extensions 4.1 required */ +#define CPU_SSE42 31 /* Streaming SIMD extensions 4.2 required */ +#define CPU_SSE4a 32 /* AMD Streaming SIMD extensions 4a required */ +#define CPU_XSAVE 33 /* Intel XSAVE instructions */ +#define CPU_AVX 34 /* Intel Advanced Vector Extensions */ +#define CPU_FMA 35 /* Intel Fused-Multiply-Add Extensions */ +#define CPU_AES 36 /* AES instruction */ +#define CPU_CLMUL 37 /* PCLMULQDQ instruction */ +#define CPU_MOVBE 38 /* MOVBE instruction */ +#define CPU_XOP 39 /* AMD XOP extensions */ +#define CPU_FMA4 40 /* AMD Fused-Multiply-Add extensions */ +#define CPU_F16C 41 /* Intel float-16 instructions */ +#define CPU_FSGSBASE 42 /* Intel FSGSBASE instructions */ +#define CPU_RDRAND 43 /* Intel RDRAND instruction */ +#define CPU_XSAVEOPT 44 /* Intel XSAVEOPT instruction */ +#define CPU_EPTVPID 45 /* Intel INVEPT, INVVPID instructions */ +#define CPU_SMX 46 /* Intel SMX instruction (GETSEC) */ +#define CPU_AVX2 47 /* Intel AVX2 instructions */ +#define CPU_BMI1 48 /* Intel BMI1 instructions */ +#define CPU_BMI2 49 /* Intel BMI2 instructions */ +#define CPU_INVPCID 50 /* Intel INVPCID instruction */ +#define CPU_LZCNT 51 /* Intel LZCNT instruction */ +#define CPU_TBM 52 /* AMD TBM instruction */ +#define CPU_TSX 53 /* Intel TSX instructions */ +#define CPU_SHA 54 /* Intel SHA instructions */ +#define CPU_SMAP 55 /* Intel SMAP instructions */ +#define CPU_RDSEED 56 /* Intel RDSEED instruction */ +#define CPU_ADX 57 /* Intel ADCX and ADOX instructions */ +#define CPU_PRFCHW 58 /* Intel/AMD PREFETCHW instruction */ + +enum x86_parser_type { + X86_PARSER_NASM = 0, + X86_PARSER_TASM = 1, + X86_PARSER_GAS = 2 +}; + +#define PARSER(arch) (((arch)->parser == X86_PARSER_GAS && (arch)->gas_intel_mode) ? X86_PARSER_NASM : (arch)->parser) typedef struct yasm_arch_x86 { yasm_arch_base arch; /* base structure */ /* What instructions/features are enabled? */ - unsigned long cpu_enabled; + unsigned int active_cpu; /* active index into cpu_enables table */ + unsigned int cpu_enables_size; /* size of cpu_enables table */ + wordptr *cpu_enables; + unsigned int amd64_machine; + enum x86_parser_type parser; + unsigned int mode_bits; + unsigned int address_size; + unsigned int force_strict; + unsigned int default_rel; + unsigned int gas_intel_mode; + enum { - X86_PARSER_NASM, - X86_PARSER_GAS - } parser; - unsigned char mode_bits; - unsigned char force_strict; + X86_NOP_BASIC = 0, + X86_NOP_INTEL = 1, + X86_NOP_AMD = 2 + } nop; } yasm_arch_x86; /* 0-15 (low 4 bits) used for register number, stored in same data area. @@ -95,18 +134,21 @@ typedef enum { X86_FPUREG = 0x6<<4, X86_MMXREG = 0x7<<4, X86_XMMREG = 0x8<<4, - X86_CRREG = 0x9<<4, - X86_DRREG = 0xA<<4, - X86_TRREG = 0xB<<4, - X86_RIP = 0xC<<4 /* 64-bit mode only, always RIP (regnum ignored) */ + X86_YMMREG = 0x9<<4, + X86_CRREG = 0xA<<4, + X86_DRREG = 0xB<<4, + X86_TRREG = 0xC<<4, + X86_RIP = 0xD<<4 /* 64-bit mode only, always RIP (regnum ignored) */ } x86_expritem_reg_size; +/* Low 8 bits are used for the prefix value, stored in same data area. */ typedef enum { - X86_LOCKREP = 1, - X86_ADDRSIZE, - X86_OPERSIZE, - X86_SEGREG, - X86_REX + X86_LOCKREP = 1<<8, + X86_ADDRSIZE = 2<<8, + X86_OPERSIZE = 3<<8, + X86_SEGREG = 4<<8, + X86_REX = 5<<8, + X86_ACQREL = 6<<8 /*TSX hint prefixes*/ } x86_parse_insn_prefix; typedef enum { @@ -144,6 +186,9 @@ int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3, typedef struct x86_effaddr { yasm_effaddr ea; /* base structure */ + /* VSIB uses the normal SIB byte, but this flag enables it. */ + unsigned char vsib_mode; /* 0 if not, 1 if XMM, 2 if YMM */ + /* How the spare (register) bits in Mod/RM are handled: * Even if valid_modrm=0, the spare bits are still valid (don't overwrite!) * They're set in bytecode_create_insn(). @@ -162,12 +207,14 @@ void yasm_x86__ea_init(x86_effaddr *x86_ea, unsigned int spare, yasm_bytecode *precbc); void yasm_x86__ea_set_disponly(x86_effaddr *x86_ea); -x86_effaddr *yasm_x86__ea_create_reg(unsigned long reg, unsigned char *rex, - unsigned int bits); +x86_effaddr *yasm_x86__ea_create_reg(x86_effaddr *x86_ea, unsigned long reg, + unsigned char *rex, unsigned int bits); x86_effaddr *yasm_x86__ea_create_imm - (/*@keep@*/ yasm_expr *imm, unsigned int im_len); + (x86_effaddr *x86_ea, /*@keep@*/ yasm_expr *imm, unsigned int im_len); yasm_effaddr *yasm_x86__ea_create_expr(yasm_arch *arch, /*@keep@*/ yasm_expr *e); +void yasm_x86__ea_destroy(yasm_effaddr *ea); +void yasm_x86__ea_print(const yasm_effaddr *ea, FILE *f, int indent_level); void yasm_x86__bc_insn_opersize_override(yasm_bytecode *bc, unsigned int opersize); @@ -181,12 +228,14 @@ typedef struct x86_common { unsigned char addrsize; /* 0 or =mode_bits => no override */ unsigned char opersize; /* 0 or =mode_bits => no override */ unsigned char lockrep_pre; /* 0 indicates no prefix */ + unsigned char acqrel_pre; /* 0 indicates no prefix. We need this because + xqcuire/xrelease might require F0 prefix */ unsigned char mode_bits; } x86_common; typedef struct x86_opcode { - unsigned char opcode[3]; /* opcode */ + unsigned char opcode[4]; /* opcode */ unsigned char len; } x86_opcode; @@ -253,7 +302,7 @@ void yasm_x86__bc_transform_jmpfar(yasm_bytecode *bc, x86_jmpfar *jmpfar); void yasm_x86__bc_apply_prefixes (x86_common *common, unsigned char *rex, unsigned int def_opersize_64, - int num_prefixes, uintptr_t **prefixes); + unsigned int num_prefixes, uintptr_t *prefixes); /* Check an effective address. Returns 0 if EA was successfully determined, * 1 if invalid EA, or 2 if indeterminate EA. @@ -266,17 +315,11 @@ void yasm_x86__parse_cpu(yasm_arch_x86 *arch_x86, const char *cpuid, size_t cpuid_len); yasm_arch_insnprefix yasm_x86__parse_check_insnprefix - (yasm_arch *arch, /*@out@*/ uintptr_t data[4], const char *id, - size_t id_len); + (yasm_arch *arch, const char *id, size_t id_len, unsigned long line, + /*@out@*/ yasm_bytecode **bc, /*@out@*/ uintptr_t *prefix); yasm_arch_regtmod yasm_x86__parse_check_regtmod - (yasm_arch *arch, /*@out@*/ uintptr_t *data, const char *id, - size_t id_len); - -void yasm_x86__finalize_insn - (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, - const uintptr_t data[4], int num_operands, - /*@null@*/ yasm_insn_operands *operands, int num_prefixes, - uintptr_t **prefixes, int num_segregs, const uintptr_t *segregs); + (yasm_arch *arch, const char *id, size_t id_len, + /*@out@*/ uintptr_t *data); int yasm_x86__floatnum_tobytes (yasm_arch *arch, const yasm_floatnum *flt, unsigned char *buf, @@ -286,5 +329,8 @@ int yasm_x86__intnum_tobytes size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc, int warn); -unsigned int yasm_x86__get_reg_size(yasm_arch *arch, uintptr_t reg); +unsigned int yasm_x86__get_reg_size(uintptr_t reg); + +/*@only@*/ yasm_bytecode *yasm_x86__create_empty_insn(yasm_arch *arch, + unsigned long line); #endif diff --git a/modules/arch/x86/x86bc.c b/modules/arch/x86/x86bc.c index b1fa1a28..7f1eccea 100644 --- a/modules/arch/x86/x86bc.c +++ b/modules/arch/x86/x86bc.c @@ -25,21 +25,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include #include "x86arch.h" -/* Effective address callback function prototypes */ - -static void x86_ea_destroy(yasm_effaddr *ea); -static void x86_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level); - /* Bytecode callback function prototypes */ static void x86_bc_insn_destroy(void *contents); @@ -52,6 +43,7 @@ static int x86_bc_insn_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); static int x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -64,6 +56,7 @@ static int x86_bc_jmp_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); static int x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -74,23 +67,17 @@ static int x86_bc_jmpfar_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int x86_bc_jmpfar_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); -/* Effective address callback structures */ - -static const yasm_effaddr_callback x86_ea_callback = { - x86_ea_destroy, - x86_ea_print -}; - /* Bytecode callback structures */ static const yasm_bytecode_callback x86_bc_callback_insn = { x86_bc_insn_destroy, x86_bc_insn_print, yasm_bc_finalize_common, + NULL, x86_bc_insn_calc_len, x86_bc_insn_expand, x86_bc_insn_tobytes, @@ -101,6 +88,7 @@ static const yasm_bytecode_callback x86_bc_callback_jmp = { x86_bc_jmp_destroy, x86_bc_jmp_print, yasm_bc_finalize_common, + NULL, x86_bc_jmp_calc_len, x86_bc_jmp_expand, x86_bc_jmp_tobytes, @@ -111,6 +99,7 @@ static const yasm_bytecode_callback x86_bc_callback_jmpfar = { x86_bc_jmpfar_destroy, x86_bc_jmpfar_print, yasm_bc_finalize_common, + NULL, x86_bc_jmpfar_calc_len, yasm_bc_expand_common, x86_bc_jmpfar_tobytes, @@ -187,28 +176,24 @@ yasm_x86__ea_set_disponly(x86_effaddr *x86_ea) x86_ea->need_sib = 0; } -x86_effaddr * -yasm_x86__ea_create_reg(unsigned long reg, unsigned char *rex, - unsigned int bits) +static x86_effaddr * +ea_create(void) { - x86_effaddr *x86_ea; - unsigned char rm; + x86_effaddr *x86_ea = yasm_xmalloc(sizeof(x86_effaddr)); - if (yasm_x86__set_rex_from_reg(rex, &rm, reg, bits, X86_REX_B)) - return NULL; - - x86_ea = yasm_xmalloc(sizeof(x86_effaddr)); - - x86_ea->ea.callback = &x86_ea_callback; yasm_value_initialize(&x86_ea->ea.disp, NULL, 0); x86_ea->ea.need_nonzero_len = 0; x86_ea->ea.need_disp = 0; x86_ea->ea.nosplit = 0; x86_ea->ea.strong = 0; x86_ea->ea.segreg = 0; - x86_ea->modrm = 0xC0 | rm; /* Mod=11, R/M=Reg, Reg=0 */ - x86_ea->valid_modrm = 1; - x86_ea->need_modrm = 1; + x86_ea->ea.pc_rel = 0; + x86_ea->ea.not_pc_rel = 0; + x86_ea->ea.data_len = 0; + x86_ea->vsib_mode = 0; + x86_ea->modrm = 0; + x86_ea->valid_modrm = 0; + x86_ea->need_modrm = 0; x86_ea->sib = 0; x86_ea->valid_sib = 0; x86_ea->need_sib = 0; @@ -216,17 +201,34 @@ yasm_x86__ea_create_reg(unsigned long reg, unsigned char *rex, return x86_ea; } +x86_effaddr * +yasm_x86__ea_create_reg(x86_effaddr *x86_ea, unsigned long reg, + unsigned char *rex, unsigned int bits) +{ + unsigned char rm; + + if (yasm_x86__set_rex_from_reg(rex, &rm, reg, bits, X86_REX_B)) + return NULL; + + if (!x86_ea) + x86_ea = ea_create(); + x86_ea->modrm = 0xC0 | rm; /* Mod=11, R/M=Reg, Reg=0 */ + x86_ea->valid_modrm = 1; + x86_ea->need_modrm = 1; + + return x86_ea; +} + yasm_effaddr * yasm_x86__ea_create_expr(yasm_arch *arch, yasm_expr *e) { yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; x86_effaddr *x86_ea; - x86_ea = yasm_xmalloc(sizeof(x86_effaddr)); + x86_ea = ea_create(); - x86_ea->ea.callback = &x86_ea_callback; if (arch_x86->parser == X86_PARSER_GAS) { - /* Need to change foo+rip into foo wrt rip. + /* Need to change foo+rip into foo wrt rip (even in .intel_syntax mode). * Note this assumes a particular ordering coming from the parser * to work (it's not very smart)! */ @@ -241,44 +243,27 @@ yasm_x86__ea_create_expr(yasm_arch *arch, yasm_expr *e) } } yasm_value_initialize(&x86_ea->ea.disp, e, 0); - x86_ea->ea.need_nonzero_len = 0; x86_ea->ea.need_disp = 1; - x86_ea->ea.nosplit = 0; - x86_ea->ea.strong = 0; - x86_ea->ea.segreg = 0; - x86_ea->modrm = 0; - x86_ea->valid_modrm = 0; x86_ea->need_modrm = 1; - x86_ea->sib = 0; - x86_ea->valid_sib = 0; /* We won't know whether we need an SIB until we know more about expr and * the BITS/address override setting. */ x86_ea->need_sib = 0xff; + x86_ea->ea.data_len = 0; + return (yasm_effaddr *)x86_ea; } /*@-compmempass@*/ x86_effaddr * -yasm_x86__ea_create_imm(yasm_expr *imm, unsigned int im_len) +yasm_x86__ea_create_imm(x86_effaddr *x86_ea, yasm_expr *imm, + unsigned int im_len) { - x86_effaddr *x86_ea; - - x86_ea = yasm_xmalloc(sizeof(x86_effaddr)); - - x86_ea->ea.callback = &x86_ea_callback; + if (!x86_ea) + x86_ea = ea_create(); yasm_value_initialize(&x86_ea->ea.disp, imm, im_len); x86_ea->ea.need_disp = 1; - x86_ea->ea.nosplit = 0; - x86_ea->ea.strong = 0; - x86_ea->ea.segreg = 0; - x86_ea->modrm = 0; - x86_ea->valid_modrm = 0; - x86_ea->need_modrm = 0; - x86_ea->sib = 0; - x86_ea->valid_sib = 0; - x86_ea->need_sib = 0; return x86_ea; } @@ -286,28 +271,49 @@ yasm_x86__ea_create_imm(yasm_expr *imm, unsigned int im_len) void yasm_x86__bc_apply_prefixes(x86_common *common, unsigned char *rex, - unsigned int def_opersize_64, int num_prefixes, - uintptr_t **prefixes) + unsigned int def_opersize_64, + unsigned int num_prefixes, uintptr_t *prefixes) { - int i; + unsigned int i; int first = 1; for (i=0; iacqrel_pre != 0) + yasm_warn_set(YASM_WARN_GENERAL, + N_("multiple XACQUIRE/XRELEASE prefixes, " + "using leftmost")); + common->acqrel_pre = (unsigned char)prefixes[i] & 0xff; + break; case X86_LOCKREP: if (common->lockrep_pre != 0) yasm_warn_set(YASM_WARN_GENERAL, N_("multiple LOCK or REP prefixes, using leftmost")); - common->lockrep_pre = (unsigned char)prefixes[i][1]; + common->lockrep_pre = (unsigned char)prefixes[i] & 0xff; break; case X86_ADDRSIZE: - common->addrsize = (unsigned char)prefixes[i][1]; + common->addrsize = (unsigned char)prefixes[i] & 0xff; break; case X86_OPERSIZE: - common->opersize = (unsigned char)prefixes[i][1]; + common->opersize = (unsigned char)prefixes[i] & 0xff; if (common->mode_bits == 64 && common->opersize == 64 && def_opersize_64 != 64) { - if (*rex == 0xff) + if (!rex) + yasm_warn_set(YASM_WARN_GENERAL, + N_("ignoring REX prefix on jump")); + else if (*rex == 0xff) yasm_warn_set(YASM_WARN_GENERAL, N_("REX prefix not allowed on this instruction, ignoring")); else @@ -318,7 +324,7 @@ yasm_x86__bc_apply_prefixes(x86_common *common, unsigned char *rex, /* This is a hack.. we should really be putting this in the * the effective address! */ - common->lockrep_pre = (unsigned char)prefixes[i][1]; + common->lockrep_pre = (unsigned char)prefixes[i] & 0xff; break; case X86_REX: if (!rex) @@ -340,7 +346,7 @@ yasm_x86__bc_apply_prefixes(x86_common *common, unsigned char *rex, * 64 bit mode due to checks in parse_check_prefix(). */ common->mode_bits = 64; - *rex = (unsigned char)prefixes[i][1]; + *rex = (unsigned char)prefixes[i] & 0xff; } first = 0; break; @@ -353,7 +359,7 @@ x86_bc_insn_destroy(void *contents) { x86_insn *insn = (x86_insn *)contents; if (insn->x86_ea) - yasm_ea_destroy((yasm_effaddr *)insn->x86_ea); + yasm_x86__ea_destroy((yasm_effaddr *)insn->x86_ea); if (insn->imm) { yasm_value_delete(insn->imm); yasm_xfree(insn->imm); @@ -378,17 +384,24 @@ x86_bc_jmpfar_destroy(void *contents) yasm_xfree(contents); } -static void -x86_ea_destroy(yasm_effaddr *ea) +void +yasm_x86__ea_destroy(yasm_effaddr *ea) { + yasm_value_delete(&ea->disp); + yasm_xfree(ea); } -static void -x86_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level) +void +yasm_x86__ea_print(const yasm_effaddr *ea, FILE *f, int indent_level) { const x86_effaddr *x86_ea = (const x86_effaddr *)ea; + fprintf(f, "%*sDisp:\n", indent_level, ""); + yasm_value_print(&ea->disp, f, indent_level+1); + fprintf(f, "%*sNoSplit=%u\n", indent_level, "", (unsigned int)ea->nosplit); fprintf(f, "%*sSegmentOv=%02x\n", indent_level, "", (unsigned int)x86_ea->ea.segreg); + fprintf(f, "%*sVSIBMode=%u\n", indent_level, "", + (unsigned int)x86_ea->vsib_mode); fprintf(f, "%*sModRM=%03o ValidRM=%u NeedRM=%u\n", indent_level, "", (unsigned int)x86_ea->modrm, (unsigned int)x86_ea->valid_modrm, (unsigned int)x86_ea->need_modrm); @@ -400,21 +413,24 @@ x86_ea_print(const yasm_effaddr *ea, FILE *f, int indent_level) static void x86_common_print(const x86_common *common, FILE *f, int indent_level) { - fprintf(f, "%*sAddrSize=%u OperSize=%u LockRepPre=%02x BITS=%u\n", + fprintf(f, "%*sAddrSize=%u OperSize=%u LockRepPre=%02x " + "ACQREL_Pre=%02x BITS=%u\n", indent_level, "", (unsigned int)common->addrsize, (unsigned int)common->opersize, (unsigned int)common->lockrep_pre, + (unsigned int)common->acqrel_pre, (unsigned int)common->mode_bits); } static void x86_opcode_print(const x86_opcode *opcode, FILE *f, int indent_level) { - fprintf(f, "%*sOpcode: %02x %02x %02x OpLen=%u\n", indent_level, "", + fprintf(f, "%*sOpcode: %02x %02x %02x %02x OpLen=%u\n", indent_level, "", (unsigned int)opcode->opcode[0], (unsigned int)opcode->opcode[1], (unsigned int)opcode->opcode[2], + (unsigned int)opcode->opcode[3], (unsigned int)opcode->len); } @@ -427,7 +443,7 @@ x86_bc_insn_print(const void *contents, FILE *f, int indent_level) fprintf(f, "%*sEffective Address:", indent_level, ""); if (insn->x86_ea) { fprintf(f, "\n"); - yasm_ea_print((yasm_effaddr *)insn->x86_ea, f, indent_level+1); + yasm_x86__ea_print((yasm_effaddr *)insn->x86_ea, f, indent_level+1); } else fprintf(f, " (nil)\n"); fprintf(f, "%*sImmediate Value:", indent_level, ""); @@ -520,6 +536,9 @@ x86_common_calc_len(const x86_common *common) len++; if (common->lockrep_pre != 0) len++; + if (common->acqrel_pre != 0) + len++; + return len; } @@ -601,11 +620,32 @@ x86_bc_insn_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, bc->len += immlen/8; } + /* VEX and XOP prefixes never have REX (it's embedded in the opcode). + * For VEX, we can come into this function with the three byte form, + * so we need to see if we can optimize to the two byte form. + * We can't do it earlier, as we don't know all of the REX byte until now. + */ + if (insn->special_prefix == 0xC4) { + /* See if we can shorten the VEX prefix to its two byte form. + * In order to do this, REX.X, REX.B, and REX.W/VEX.W must all be 0, + * and the VEX mmmmm field must be 1. + */ + if ((insn->opcode.opcode[0] & 0x1F) == 1 && + (insn->opcode.opcode[1] & 0x80) == 0 && + (insn->rex == 0xff || (insn->rex & 0x0B) == 0)) { + insn->opcode.opcode[0] = insn->opcode.opcode[1]; + insn->opcode.opcode[1] = insn->opcode.opcode[2]; + insn->opcode.opcode[2] = 0; /* sanity */ + insn->opcode.len = 2; + insn->special_prefix = 0xC5; /* mark as two-byte VEX */ + } + } else if (insn->rex != 0xff && insn->rex != 0 && + insn->special_prefix != 0xC5 && insn->special_prefix != 0x8F) + bc->len++; + bc->len += insn->opcode.len; bc->len += x86_common_calc_len(&insn->common); bc->len += (insn->special_prefix != 0) ? 1:0; - if (insn->rex != 0xff && insn->rex != 0) - bc->len++; return 0; } @@ -615,8 +655,11 @@ x86_bc_insn_expand(yasm_bytecode *bc, int span, long old_val, long new_val, { x86_insn *insn = (x86_insn *)bc->contents; x86_effaddr *x86_ea = insn->x86_ea; - yasm_effaddr *ea = &x86_ea->ea; - yasm_value *imm = insn->imm; + yasm_effaddr *ea = NULL; + yasm_value *imm; + if (x86_ea != NULL) + ea = &x86_ea->ea; + imm = insn->imm; if (ea && span == 1) { /* Change displacement length into word-sized */ @@ -775,6 +818,9 @@ x86_common_tobytes(const x86_common *common, unsigned char **bufp, ((common->mode_bits != 64 && common->opersize != common->mode_bits) || (common->mode_bits == 64 && common->opersize == 16))) YASM_WRITE_8(*bufp, 0x66); + /*TSX hints come before lock prefix*/ + if (common->acqrel_pre != 0) + YASM_WRITE_8(*bufp, common->acqrel_pre); if (common->lockrep_pre != 0) YASM_WRITE_8(*bufp, common->lockrep_pre); } @@ -788,21 +834,39 @@ x86_opcode_tobytes(const x86_opcode *opcode, unsigned char **bufp) } static int -x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { x86_insn *insn = (x86_insn *)bc->contents; /*@null@*/ x86_effaddr *x86_ea = (x86_effaddr *)insn->x86_ea; yasm_value *imm = insn->imm; - unsigned char *bufp_orig = *bufp; /* Prefixes */ x86_common_tobytes(&insn->common, bufp, x86_ea ? (unsigned int)(x86_ea->ea.segreg>>8) : 0); if (insn->special_prefix != 0) YASM_WRITE_8(*bufp, insn->special_prefix); - if (insn->rex != 0xff && insn->rex != 0) { + if (insn->special_prefix == 0xC4 || insn->special_prefix == 0x8F) { + /* 3-byte VEX/XOP; merge in 1s complement of REX.R, REX.X, REX.B */ + insn->opcode.opcode[0] &= 0x1F; + if (insn->rex != 0xff) + insn->opcode.opcode[0] |= ((~insn->rex) & 0x07) << 5; + /* merge REX.W via ORing; there should never be a case in which REX.W + * is important when VEX.W is already set by the instruction. + */ + if (insn->rex != 0xff && (insn->rex & 0x8) != 0) + insn->opcode.opcode[1] |= 0x80; + } else if (insn->special_prefix == 0xC5) { + /* 2-byte VEX; merge in 1s complement of REX.R */ + insn->opcode.opcode[0] &= 0x7F; + if (insn->rex != 0xff && (insn->rex & 0x4) == 0) + insn->opcode.opcode[0] |= 0x80; + /* No other REX bits should be set */ + if (insn->rex != 0xff && (insn->rex & 0xB) != 0) + yasm_internal_error(N_("x86: REX.WXB set, but 2-byte VEX")); + } else if (insn->rex != 0xff && insn->rex != 0) { if (insn->common.mode_bits != 64) yasm_internal_error(N_("x86: got a REX prefix in non-64-bit mode")); YASM_WRITE_8(*bufp, insn->rex); @@ -844,7 +908,7 @@ x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_expr_int(delta), bc->line); } if (output_value(&x86_ea->ea.disp, *bufp, disp_len, - (unsigned long)(*bufp-bufp_orig), bc, 1, d)) + (unsigned long)(*bufp-bufstart), bc, 1, d)) return 1; *bufp += disp_len; } @@ -862,7 +926,7 @@ x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, imm_len = 1; } else imm_len = imm->size/8; - if (output_value(imm, *bufp, imm_len, (unsigned long)(*bufp-bufp_orig), + if (output_value(imm, *bufp, imm_len, (unsigned long)(*bufp-bufstart), bc, 1, d)) return 1; *bufp += imm_len; @@ -872,14 +936,14 @@ x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, } static int -x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { x86_jmp *jmp = (x86_jmp *)bc->contents; unsigned char opersize; unsigned int i; - unsigned char *bufp_orig = *bufp; /*@only@*/ yasm_intnum *delta; /* Prefixes */ @@ -912,8 +976,9 @@ x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_expr_int(delta), bc->line); jmp->target.size = 8; + jmp->target.sign = 1; if (output_value(&jmp->target, *bufp, 1, - (unsigned long)(*bufp-bufp_orig), bc, -1, d)) + (unsigned long)(*bufp-bufstart), bc, 1, d)) return 1; *bufp += 1; break; @@ -943,8 +1008,9 @@ x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_expr_int(delta), bc->line); jmp->target.size = i*8; + jmp->target.sign = 1; if (output_value(&jmp->target, *bufp, i, - (unsigned long)(*bufp-bufp_orig), bc, -1, d)) + (unsigned long)(*bufp-bufstart), bc, 1, d)) return 1; *bufp += i; break; @@ -957,13 +1023,13 @@ x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, } static int -x86_bc_jmpfar_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +x86_bc_jmpfar_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@unused@*/ yasm_output_reloc_func output_reloc) { x86_jmpfar *jmpfar = (x86_jmpfar *)bc->contents; unsigned int i; - unsigned char *bufp_orig = *bufp; unsigned char opersize; x86_common_tobytes(&jmpfar->common, bufp, 0); @@ -977,12 +1043,12 @@ x86_bc_jmpfar_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, i = (opersize == 16) ? 2 : 4; jmpfar->offset.size = i*8; if (output_value(&jmpfar->offset, *bufp, i, - (unsigned long)(*bufp-bufp_orig), bc, 1, d)) + (unsigned long)(*bufp-bufstart), bc, 1, d)) return 1; *bufp += i; jmpfar->segment.size = 16; if (output_value(&jmpfar->segment, *bufp, 2, - (unsigned long)(*bufp-bufp_orig), bc, 1, d)) + (unsigned long)(*bufp-bufstart), bc, 1, d)) return 1; *bufp += 2; diff --git a/modules/arch/x86/x86cpu.gperf b/modules/arch/x86/x86cpu.gperf new file mode 100644 index 00000000..334ea1c8 --- /dev/null +++ b/modules/arch/x86/x86cpu.gperf @@ -0,0 +1,496 @@ +# +# x86 CPU recognition +# +# Copyright (C) 2002-2007 Peter Johnson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +%{ +#include + +#include +#include +#include + +#include "modules/arch/x86/x86arch.h" + +#define PROC_8086 0 +#define PROC_186 1 +#define PROC_286 2 +#define PROC_386 3 +#define PROC_486 4 +#define PROC_586 5 +#define PROC_686 6 +#define PROC_p2 7 +#define PROC_p3 8 +#define PROC_p4 9 +#define PROC_prescott 10 +#define PROC_conroe 11 +#define PROC_penryn 12 +#define PROC_nehalem 13 +#define PROC_westmere 14 +#define PROC_sandybridge 15 +#define PROC_ivybridge 16 +#define PROC_haswell 17 +#define PROC_broadwell 18 +#define PROC_skylake 19 + +static void +x86_cpu_intel(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Empty(cpu); + + BitVector_Bit_On(cpu, CPU_Priv); + if (data >= PROC_286) + BitVector_Bit_On(cpu, CPU_Prot); + if (data >= PROC_386) + BitVector_Bit_On(cpu, CPU_SMM); + if (data >= PROC_skylake) { + BitVector_Bit_On(cpu, CPU_SHA); + } + if (data >= PROC_broadwell) { + BitVector_Bit_On(cpu, CPU_RDSEED); + BitVector_Bit_On(cpu, CPU_ADX); + BitVector_Bit_On(cpu, CPU_PRFCHW); + } + if (data >= PROC_haswell) { + BitVector_Bit_On(cpu, CPU_FMA); + BitVector_Bit_On(cpu, CPU_AVX2); + BitVector_Bit_On(cpu, CPU_BMI1); + BitVector_Bit_On(cpu, CPU_BMI2); + BitVector_Bit_On(cpu, CPU_INVPCID); + BitVector_Bit_On(cpu, CPU_LZCNT); + BitVector_Bit_On(cpu, CPU_TSX); + BitVector_Bit_On(cpu, CPU_SMAP); + } + if (data >= PROC_ivybridge) { + BitVector_Bit_On(cpu, CPU_F16C); + BitVector_Bit_On(cpu, CPU_FSGSBASE); + BitVector_Bit_On(cpu, CPU_RDRAND); + } + if (data >= PROC_sandybridge) { + BitVector_Bit_On(cpu, CPU_AVX); + BitVector_Bit_On(cpu, CPU_XSAVEOPT); + BitVector_Bit_On(cpu, CPU_EPTVPID); + BitVector_Bit_On(cpu, CPU_SMX); + } + if (data >= PROC_westmere) { + BitVector_Bit_On(cpu, CPU_AES); + BitVector_Bit_On(cpu, CPU_CLMUL); + } + if (data >= PROC_nehalem) { + BitVector_Bit_On(cpu, CPU_SSE42); + BitVector_Bit_On(cpu, CPU_XSAVE); + } + if (data >= PROC_penryn) + BitVector_Bit_On(cpu, CPU_SSE41); + if (data >= PROC_conroe) + BitVector_Bit_On(cpu, CPU_SSSE3); + if (data >= PROC_prescott) + BitVector_Bit_On(cpu, CPU_SSE3); + if (data >= PROC_p4) + BitVector_Bit_On(cpu, CPU_SSE2); + if (data >= PROC_p3) + BitVector_Bit_On(cpu, CPU_SSE); + if (data >= PROC_p2) + BitVector_Bit_On(cpu, CPU_MMX); + if (data >= PROC_486) + BitVector_Bit_On(cpu, CPU_FPU); + if (data >= PROC_prescott) + BitVector_Bit_On(cpu, CPU_EM64T); + + if (data >= PROC_p4) + BitVector_Bit_On(cpu, CPU_P4); + if (data >= PROC_p3) + BitVector_Bit_On(cpu, CPU_P3); + if (data >= PROC_686) + BitVector_Bit_On(cpu, CPU_686); + if (data >= PROC_586) + BitVector_Bit_On(cpu, CPU_586); + if (data >= PROC_486) + BitVector_Bit_On(cpu, CPU_486); + if (data >= PROC_386) + BitVector_Bit_On(cpu, CPU_386); + if (data >= PROC_286) + BitVector_Bit_On(cpu, CPU_286); + if (data >= PROC_186) + BitVector_Bit_On(cpu, CPU_186); + BitVector_Bit_On(cpu, CPU_086); + + /* Use Intel long NOPs if 686 or better */ + if (data >= PROC_686) + arch_x86->nop = X86_NOP_INTEL; + else + arch_x86->nop = X86_NOP_BASIC; +} + +static void +x86_cpu_ia64(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Empty(cpu); + BitVector_Bit_On(cpu, CPU_Priv); + BitVector_Bit_On(cpu, CPU_Prot); + BitVector_Bit_On(cpu, CPU_SMM); + BitVector_Bit_On(cpu, CPU_SSE2); + BitVector_Bit_On(cpu, CPU_SSE); + BitVector_Bit_On(cpu, CPU_MMX); + BitVector_Bit_On(cpu, CPU_FPU); + BitVector_Bit_On(cpu, CPU_IA64); + BitVector_Bit_On(cpu, CPU_P4); + BitVector_Bit_On(cpu, CPU_P3); + BitVector_Bit_On(cpu, CPU_686); + BitVector_Bit_On(cpu, CPU_586); + BitVector_Bit_On(cpu, CPU_486); + BitVector_Bit_On(cpu, CPU_386); + BitVector_Bit_On(cpu, CPU_286); + BitVector_Bit_On(cpu, CPU_186); + BitVector_Bit_On(cpu, CPU_086); +} + +#define PROC_bulldozer 11 +#define PROC_k10 10 +#define PROC_venice 9 +#define PROC_hammer 8 +#define PROC_k7 7 +#define PROC_k6 6 + +static void +x86_cpu_amd(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Empty(cpu); + + BitVector_Bit_On(cpu, CPU_Priv); + BitVector_Bit_On(cpu, CPU_Prot); + BitVector_Bit_On(cpu, CPU_SMM); + BitVector_Bit_On(cpu, CPU_3DNow); + if (data >= PROC_bulldozer) { + BitVector_Bit_On(cpu, CPU_XOP); + BitVector_Bit_On(cpu, CPU_FMA4); + } + if (data >= PROC_k10) + BitVector_Bit_On(cpu, CPU_SSE4a); + if (data >= PROC_venice) + BitVector_Bit_On(cpu, CPU_SSE3); + if (data >= PROC_hammer) + BitVector_Bit_On(cpu, CPU_SSE2); + if (data >= PROC_k7) + BitVector_Bit_On(cpu, CPU_SSE); + if (data >= PROC_k6) + BitVector_Bit_On(cpu, CPU_MMX); + BitVector_Bit_On(cpu, CPU_FPU); + + if (data >= PROC_hammer) + BitVector_Bit_On(cpu, CPU_Hammer); + if (data >= PROC_k7) + BitVector_Bit_On(cpu, CPU_Athlon); + if (data >= PROC_k6) + BitVector_Bit_On(cpu, CPU_K6); + BitVector_Bit_On(cpu, CPU_686); + BitVector_Bit_On(cpu, CPU_586); + BitVector_Bit_On(cpu, CPU_486); + BitVector_Bit_On(cpu, CPU_386); + BitVector_Bit_On(cpu, CPU_286); + BitVector_Bit_On(cpu, CPU_186); + BitVector_Bit_On(cpu, CPU_086); + + /* Use AMD long NOPs if k6 or better */ + if (data >= PROC_k6) + arch_x86->nop = X86_NOP_AMD; + else + arch_x86->nop = X86_NOP_BASIC; +} + +static void +x86_cpu_set(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Bit_On(cpu, data); +} + +static void +x86_cpu_clear(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Bit_Off(cpu, data); +} + +static void +x86_cpu_set_sse4(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Bit_On(cpu, CPU_SSE41); + BitVector_Bit_On(cpu, CPU_SSE42); +} + +static void +x86_cpu_clear_sse4(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + BitVector_Bit_Off(cpu, CPU_SSE41); + BitVector_Bit_Off(cpu, CPU_SSE42); +} + +static void +x86_nop(wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data) +{ + arch_x86->nop = data; +} + +%} +%ignore-case +%language=ANSI-C +%compare-strncmp +%readonly-tables +%enum +%struct-type +%define hash-function-name cpu_hash +%define lookup-function-name cpu_find +struct cpu_parse_data { + const char *name; + void (*handler) (wordptr cpu, yasm_arch_x86 *arch_x86, unsigned int data); + unsigned int data; +}; +%% +8086, x86_cpu_intel, PROC_8086 +186, x86_cpu_intel, PROC_186 +80186, x86_cpu_intel, PROC_186 +i186, x86_cpu_intel, PROC_186 +286, x86_cpu_intel, PROC_286 +80286, x86_cpu_intel, PROC_286 +i286, x86_cpu_intel, PROC_286 +386, x86_cpu_intel, PROC_386 +80386, x86_cpu_intel, PROC_386 +i386, x86_cpu_intel, PROC_386 +486, x86_cpu_intel, PROC_486 +80486, x86_cpu_intel, PROC_486 +i486, x86_cpu_intel, PROC_486 +586, x86_cpu_intel, PROC_586 +i586, x86_cpu_intel, PROC_586 +pentium, x86_cpu_intel, PROC_586 +p5, x86_cpu_intel, PROC_586 +686, x86_cpu_intel, PROC_686 +i686, x86_cpu_intel, PROC_686 +p6, x86_cpu_intel, PROC_686 +ppro, x86_cpu_intel, PROC_686 +pentiumpro, x86_cpu_intel, PROC_686 +p2, x86_cpu_intel, PROC_p2 +pentium2, x86_cpu_intel, PROC_p2 +pentium-2, x86_cpu_intel, PROC_p2 +pentiumii, x86_cpu_intel, PROC_p2 +pentium-ii, x86_cpu_intel, PROC_p2 +p3, x86_cpu_intel, PROC_p3 +pentium3, x86_cpu_intel, PROC_p3 +pentium-3, x86_cpu_intel, PROC_p3 +pentiumiii, x86_cpu_intel, PROC_p3 +pentium-iii, x86_cpu_intel, PROC_p3 +katmai, x86_cpu_intel, PROC_p3 +p4, x86_cpu_intel, PROC_p4 +pentium4, x86_cpu_intel, PROC_p4 +pentium-4, x86_cpu_intel, PROC_p4 +pentiumiv, x86_cpu_intel, PROC_p4 +pentium-iv, x86_cpu_intel, PROC_p4 +williamette, x86_cpu_intel, PROC_p4 +ia64, x86_cpu_ia64, 0 +ia-64, x86_cpu_ia64, 0 +itanium, x86_cpu_ia64, 0 +k6, x86_cpu_amd, PROC_k6 +k7, x86_cpu_amd, PROC_k7 +athlon, x86_cpu_amd, PROC_k7 +k8, x86_cpu_amd, PROC_hammer +hammer, x86_cpu_amd, PROC_hammer +clawhammer, x86_cpu_amd, PROC_hammer +opteron, x86_cpu_amd, PROC_hammer +athlon64, x86_cpu_amd, PROC_hammer +athlon-64, x86_cpu_amd, PROC_hammer +venice, x86_cpu_amd, PROC_venice +k10, x86_cpu_amd, PROC_k10 +phenom, x86_cpu_amd, PROC_k10 +family10h, x86_cpu_amd, PROC_k10 +bulldozer, x86_cpu_amd, PROC_bulldozer +prescott, x86_cpu_intel, PROC_prescott +conroe, x86_cpu_intel, PROC_conroe +core2, x86_cpu_intel, PROC_conroe +penryn, x86_cpu_intel, PROC_penryn +nehalem, x86_cpu_intel, PROC_nehalem +corei7, x86_cpu_intel, PROC_nehalem +westmere, x86_cpu_intel, PROC_westmere +sandybridge, x86_cpu_intel, PROC_sandybridge +ivybridge, x86_cpu_intel, PROC_ivybridge +haswell, x86_cpu_intel, PROC_haswell +broadwell, x86_cpu_intel, PROC_broadwell +skylake, x86_cpu_intel, PROC_skylake +# +# Features have "no" versions to disable them, and only set/reset the +# specific feature being changed. All other bits are left alone. +# +fpu, x86_cpu_set, CPU_FPU +nofpu, x86_cpu_clear, CPU_FPU +mmx, x86_cpu_set, CPU_MMX +nommx, x86_cpu_clear, CPU_MMX +sse, x86_cpu_set, CPU_SSE +nosse, x86_cpu_clear, CPU_SSE +sse2, x86_cpu_set, CPU_SSE2 +nosse2, x86_cpu_clear, CPU_SSE2 +sse3, x86_cpu_set, CPU_SSE3 +nosse3, x86_cpu_clear, CPU_SSE3 +#pni, x86_cpu_set, CPU_PNI +#nopni, x86_cpu_clear, CPU_PNI +3dnow, x86_cpu_set, CPU_3DNow +no3dnow, x86_cpu_clear, CPU_3DNow +cyrix, x86_cpu_set, CPU_Cyrix +nocyrix, x86_cpu_clear, CPU_Cyrix +amd, x86_cpu_set, CPU_AMD +noamd, x86_cpu_clear, CPU_AMD +smm, x86_cpu_set, CPU_SMM +nosmm, x86_cpu_clear, CPU_SMM +prot, x86_cpu_set, CPU_Prot +noprot, x86_cpu_clear, CPU_Prot +protected, x86_cpu_set, CPU_Prot +noprotected, x86_cpu_clear, CPU_Prot +undoc, x86_cpu_set, CPU_Undoc +noundoc, x86_cpu_clear, CPU_Undoc +undocumented, x86_cpu_set, CPU_Undoc +noundocumented, x86_cpu_clear, CPU_Undoc +obs, x86_cpu_set, CPU_Obs +noobs, x86_cpu_clear, CPU_Obs +obsolete, x86_cpu_set, CPU_Obs +noobsolete, x86_cpu_clear, CPU_Obs +priv, x86_cpu_set, CPU_Priv +nopriv, x86_cpu_clear, CPU_Priv +privileged, x86_cpu_set, CPU_Priv +noprivileged, x86_cpu_clear, CPU_Priv +svm, x86_cpu_set, CPU_SVM +nosvm, x86_cpu_clear, CPU_SVM +padlock, x86_cpu_set, CPU_PadLock +nopadlock, x86_cpu_clear, CPU_PadLock +em64t, x86_cpu_set, CPU_EM64T +noem64t, x86_cpu_clear, CPU_EM64T +ssse3, x86_cpu_set, CPU_SSSE3 +nossse3, x86_cpu_clear, CPU_SSSE3 +sse4.1, x86_cpu_set, CPU_SSE41 +nosse4.1, x86_cpu_clear, CPU_SSE41 +sse41, x86_cpu_set, CPU_SSE41 +nosse41, x86_cpu_clear, CPU_SSE41 +sse4.2, x86_cpu_set, CPU_SSE42 +nosse4.2, x86_cpu_clear, CPU_SSE42 +sse42, x86_cpu_set, CPU_SSE42 +nosse42, x86_cpu_clear, CPU_SSE42 +sse4a, x86_cpu_set, CPU_SSE4a +nosse4a, x86_cpu_clear, CPU_SSE4a +sse4, x86_cpu_set_sse4, 0 +nosse4, x86_cpu_clear_sse4, 0 +xsave, x86_cpu_set, CPU_XSAVE +noxsave, x86_cpu_clear, CPU_XSAVE +avx, x86_cpu_set, CPU_AVX +noavx, x86_cpu_clear, CPU_AVX +fma, x86_cpu_set, CPU_FMA +nofma, x86_cpu_clear, CPU_FMA +aes, x86_cpu_set, CPU_AES +noaes, x86_cpu_clear, CPU_AES +clmul, x86_cpu_set, CPU_CLMUL +noclmul, x86_cpu_clear, CPU_CLMUL +pclmulqdq, x86_cpu_set, CPU_CLMUL +nopclmulqdq, x86_cpu_clear, CPU_CLMUL +movbe, x86_cpu_set, CPU_MOVBE +nomovbe, x86_cpu_clear, CPU_MOVBE +xop, x86_cpu_set, CPU_XOP +noxop, x86_cpu_clear, CPU_XOP +fma4, x86_cpu_set, CPU_FMA4 +nofma4, x86_cpu_clear, CPU_FMA4 +f16c, x86_cpu_set, CPU_F16C +nof16c, x86_cpu_clear, CPU_F16C +fsgsbase, x86_cpu_set, CPU_FSGSBASE +nofsgsbase, x86_cpu_clear, CPU_FSGSBASE +rdrand, x86_cpu_set, CPU_RDRAND +nordrand, x86_cpu_clear, CPU_RDRAND +xsaveopt, x86_cpu_set, CPU_XSAVEOPT +noxsaveopt, x86_cpu_clear, CPU_XSAVEOPT +eptvpid, x86_cpu_set, CPU_EPTVPID +noeptvpid, x86_cpu_clear, CPU_EPTVPID +smx, x86_cpu_set, CPU_SMX +nosmx, x86_cpu_clear, CPU_SMX +avx2, x86_cpu_set, CPU_AVX2 +noavx2, x86_cpu_clear, CPU_AVX2 +tsx, x86_cpu_set, CPU_TSX +notsx, x86_cpu_clear, CPU_TSX +bmi1, x86_cpu_set, CPU_BMI1 +nobmi1, x86_cpu_clear, CPU_BMI1 +bmi2, x86_cpu_set, CPU_BMI2 +nobmi2, x86_cpu_clear, CPU_BMI2 +invpcid, x86_cpu_set, CPU_INVPCID +noinvpcid, x86_cpu_clear, CPU_INVPCID +lzcnt, x86_cpu_set, CPU_LZCNT +nolzcnt, x86_cpu_clear, CPU_LZCNT +tbm, x86_cpu_set, CPU_TBM +notbm, x86_cpu_clear, CPU_TBM +sha, x86_cpu_set, CPU_SHA +nosha, x86_cpu_clear, CPU_SHA +smap, x86_cpu_set, CPU_SMAP +nosmap, x86_cpu_clear, CPU_SMAP +rdseed, x86_cpu_set, CPU_RDSEED +nordseed, x86_cpu_clear, CPU_RDSEED +adx, x86_cpu_set, CPU_ADX +noadx, x86_cpu_clear, CPU_ADX +prfchw, x86_cpu_set, CPU_PRFCHW +noprfchw, x86_cpu_clear, CPU_PRFCHW +# Change NOP patterns +basicnop, x86_nop, X86_NOP_BASIC +intelnop, x86_nop, X86_NOP_INTEL +amdnop, x86_nop, X86_NOP_AMD +%% + +void +yasm_x86__parse_cpu(yasm_arch_x86 *arch_x86, const char *cpuid, + size_t cpuid_len) +{ + /*@null@*/ const struct cpu_parse_data *pdata; + wordptr new_cpu; + size_t i; + static char lcaseid[16]; + + if (cpuid_len > 15) + return; + for (i=0; icpu_enables[arch_x86->active_cpu]); + pdata->handler(new_cpu, arch_x86, pdata->data); + + /* try to find an existing match in the CPU table first */ + for (i=0; icpu_enables_size; i++) { + if (BitVector_equal(arch_x86->cpu_enables[i], new_cpu)) { + arch_x86->active_cpu = i; + BitVector_Destroy(new_cpu); + return; + } + } + + /* not found, need to add a new entry */ + arch_x86->active_cpu = arch_x86->cpu_enables_size++; + arch_x86->cpu_enables = + yasm_xrealloc(arch_x86->cpu_enables, + arch_x86->cpu_enables_size*sizeof(wordptr)); + arch_x86->cpu_enables[arch_x86->active_cpu] = new_cpu; +} diff --git a/modules/arch/x86/x86expr.c b/modules/arch/x86/x86expr.c index 2ad101c0..e9ddcce5 100644 --- a/modules/arch/x86/x86expr.c +++ b/modules/arch/x86/x86expr.c @@ -25,10 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_EXPR_INTERNAL #include #include "x86arch.h" @@ -36,6 +33,7 @@ typedef struct x86_checkea_reg3264_data { int *regs; /* total multiplier for each reg */ + unsigned char vsib_mode; unsigned char bits; unsigned char addrsize; } x86_checkea_reg3264_data; @@ -60,6 +58,20 @@ x86_expr_checkea_get_reg3264(yasm_expr__item *ei, int *regnum, return 0; *regnum = (unsigned int)(ei->data.reg & 0xF); break; + case X86_XMMREG: + if (data->vsib_mode != 1) + return 0; + if (data->bits != 64 && (ei->data.reg & 0x8) == 0x8) + return 0; + *regnum = 17+(unsigned int)(ei->data.reg & 0xF); + break; + case X86_YMMREG: + if (data->vsib_mode != 2) + return 0; + if (data->bits != 64 && (ei->data.reg & 0x8) == 0x8) + return 0; + *regnum = 17+(unsigned int)(ei->data.reg & 0xF); + break; case X86_RIP: if (data->bits != 64) return 0; @@ -341,6 +353,7 @@ x86_expr_checkea_getregusage(yasm_expr **ep, /*@null@*/ int *indexreg, */ if (e->terms[i].data.expn->terms[0].type == YASM_EXPR_REG) { + long delta; if (e->terms[i].data.expn->terms[1].type != YASM_EXPR_INT) yasm_internal_error( @@ -349,13 +362,19 @@ x86_expr_checkea_getregusage(yasm_expr **ep, /*@null@*/ int *indexreg, ®num, data); if (!reg) return 1; - (*reg) += yasm_intnum_get_int( + delta = yasm_intnum_get_int( e->terms[i].data.expn->terms[1].data.intn); + (*reg) += delta; /* Let last, largest multipler win indexreg */ - if (indexreg && *reg > 0 && indexval <= *reg) { + if (indexreg && delta > 0 && indexval <= *reg) { *indexreg = regnum; indexval = *reg; indexmult = 1; + } else if (indexreg && *indexreg == regnum && + delta < 0 && *reg <= 1) { + *indexreg = -1; + indexval = 0; + indexmult = 0; } } } @@ -365,6 +384,7 @@ x86_expr_checkea_getregusage(yasm_expr **ep, /*@null@*/ int *indexreg, /* Here, too, check for non-int multipliers against a reg. */ yasm_expr__order_terms(e); if (e->terms[0].type == YASM_EXPR_REG) { + long delta; if (e->numterms > 2) return 1; if (e->terms[1].type != YASM_EXPR_INT) @@ -372,11 +392,26 @@ x86_expr_checkea_getregusage(yasm_expr **ep, /*@null@*/ int *indexreg, reg = get_reg(&e->terms[0], ®num, data); if (!reg) return 1; - (*reg) += yasm_intnum_get_int(e->terms[1].data.intn); + delta = yasm_intnum_get_int(e->terms[1].data.intn); + (*reg) += delta; if (indexreg) - *indexreg = regnum; + { + if (delta < 0 && *reg <= 1) + { + *indexreg = -1; + indexval = 0; + indexmult = 0; + } + else + *indexreg = regnum; + } } break; + case YASM_EXPR_SEGOFF: + /* No registers are allowed on either side. */ + if (yasm_expr__contains(e, YASM_EXPR_REG)) + return 1; + break; default: /* Should never get here! */ yasm_internal_error(N_("unexpected expr op")); @@ -419,7 +454,7 @@ x86_checkea_calc_displen(x86_effaddr *x86_ea, unsigned int wordsize, int noreg, * EA. With no registers, we must have a 16/32 value. */ if (noreg) { - yasm_warn_set(YASM_WARN_GENERAL, + yasm_warn_set(YASM_WARN_IMPLICIT_SIZE_OVERRIDE, N_("invalid displacement size; fixed")); x86_ea->ea.disp.size = wordsize; } else @@ -585,6 +620,11 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, } /*@fallthrough@*/ default: + /* If SIB is required, but we're in 16-bit mode, set to 32. */ + if (bits == 16 && x86_ea->need_sib == 1) { + *addrsize = 32; + break; + } /* check for use of 16 or 32-bit registers; if none are used * default to bits setting. */ @@ -604,7 +644,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, (x86_ea->need_sib && !x86_ea->valid_sib))) { int i; unsigned char low3; - typedef enum { + enum { REG3264_NONE = -1, REG3264_EAX = 0, REG3264_ECX, @@ -622,13 +662,19 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, REG64_R13, REG64_R14, REG64_R15, - REG64_RIP - } reg3264type; - int reg3264mult[17] = {0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0}; + REG64_RIP, + SIMDREGS + }; + int reg3264mult[33] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; x86_checkea_reg3264_data reg3264_data; int basereg = REG3264_NONE; /* "base" register (for SIB) */ int indexreg = REG3264_NONE; /* "index" register (for SIB) */ + int regcount = 17; /* normally don't check SIMD regs */ + + if (x86_ea->vsib_mode != 0) + regcount = 33; /* We can only do 64-bit addresses in 64-bit mode. */ if (*addrsize == 64 && bits != 64) { @@ -637,7 +683,14 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, return 1; } + if (x86_ea->ea.pc_rel && bits != 64) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("RIP-relative directive ignored in non-64-bit mode")); + x86_ea->ea.pc_rel = 0; + } + reg3264_data.regs = reg3264mult; + reg3264_data.vsib_mode = x86_ea->vsib_mode; reg3264_data.bits = bits; reg3264_data.addrsize = *addrsize; if (x86_ea->ea.disp.abs) { @@ -671,7 +724,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, * Also, if an indexreg hasn't been assigned, try to find one. * Meanwhile, check to make sure there's no negative register mults. */ - for (i=0; i<17; i++) { + for (i=0; ivsib_mode != 0) { + /* For VSIB, the SIMD register needs to go into the indexreg. + * Also check basereg (must be a GPR if present) and indexreg + * (must be a SIMD register). + */ + if (basereg >= SIMDREGS && + (indexreg == REG3264_NONE || reg3264mult[indexreg] == 1)) { + int temp = basereg; + basereg = indexreg; + indexreg = temp; + } + if (basereg >= REG64_RIP || indexreg < SIMDREGS) { + yasm_error_set(YASM_ERROR_VALUE, + N_("invalid effective address")); + return 1; + } + } else if (indexreg != REG3264_NONE && basereg == REG3264_NONE) + /* Handle certain special cases of indexreg mults when basereg is + * empty. + */ switch (reg3264mult[indexreg]) { case 1: /* Only optimize this way if nosplit wasn't specified */ @@ -714,7 +783,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, /* Make sure there's no other registers than the basereg and indexreg * we just found. */ - for (i=0; i<17; i++) + for (i=0; iea.pc_rel) { + basereg = REG64_RIP; + yasm_value_set_curpos_rel(&x86_ea->ea.disp, bc, 1); + } + /* First determine R/M (Mod is later determined from disp size) */ x86_ea->need_modrm = 1; /* we always need ModRM */ if (basereg == REG3264_NONE && indexreg == REG3264_NONE) { @@ -825,10 +903,17 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize, x86_ea->sib |= 040; /* Any scale field is valid, just leave at 0. */ else { - if (yasm_x86__set_rex_from_reg(rex, &low3, (unsigned int) - (X86_REG64 | indexreg), bits, - X86_REX_X)) - return 1; + if (indexreg >= SIMDREGS) { + if (yasm_x86__set_rex_from_reg(rex, &low3, + (unsigned int)(X86_XMMREG | (indexreg-SIMDREGS)), + bits, X86_REX_X)) + return 1; + } else { + if (yasm_x86__set_rex_from_reg(rex, &low3, + (unsigned int)(X86_REG64 | indexreg), + bits, X86_REX_X)) + return 1; + } x86_ea->sib |= low3 << 3; /* Set scale field, 1 case -> 0, so don't bother. */ switch (reg3264mult[indexreg]) { diff --git a/modules/arch/x86/x86id.c b/modules/arch/x86/x86id.c index 7e27273d..6a766dc9 100644 --- a/modules/arch/x86/x86id.c +++ b/modules/arch/x86/x86id.c @@ -26,226 +26,235 @@ */ #include #include -RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include #include #include "modules/arch/x86/x86arch.h" -static const char *cpu_find_reverse(unsigned long cpu); +static const char *cpu_find_reverse(unsigned int cpu0, unsigned int cpu1, + unsigned int cpu2); -/* Opcode modifiers. The opcode bytes are in "reverse" order because the - * parameters are read from the arch-specific data in LSB->MSB order. - * (only for asthetic reasons in the lexer code below, no practical reason). - */ -#define MOD_Gap0 (1UL<<0) /* Eats a parameter */ -#define MOD_Op2Add (1UL<<1) /* Parameter adds to opcode byte 2 */ -#define MOD_Gap1 (1UL<<2) /* Eats a parameter */ -#define MOD_Op1Add (1UL<<3) /* Parameter adds to opcode byte 1 */ -#define MOD_Gap2 (1UL<<4) /* Eats a parameter */ -#define MOD_Op0Add (1UL<<5) /* Parameter adds to opcode byte 0 */ -#define MOD_PreAdd (1UL<<6) /* Parameter adds to "special" prefix */ -#define MOD_SpAdd (1UL<<7) /* Parameter adds to "spare" value */ -#define MOD_OpSizeR (1UL<<8) /* Parameter replaces opersize */ -#define MOD_Imm8 (1UL<<9) /* Parameter is included as immediate byte */ -#define MOD_AdSizeR (1UL<<10) /* Parameter replaces addrsize (jmp only) */ -#define MOD_DOpS64R (1UL<<11) /* Parameter replaces default 64-bit opersize */ -#define MOD_Op1AddSp (1UL<<12) /* Parameter is added as "spare" to opcode byte 2 */ +/* Opcode modifiers. */ +#define MOD_Gap 0 /* Eats a parameter / does nothing */ +#define MOD_PreAdd 1 /* Parameter adds to "special" prefix */ +#define MOD_Op0Add 2 /* Parameter adds to opcode byte 0 */ +#define MOD_Op1Add 3 /* Parameter adds to opcode byte 1 */ +#define MOD_Op2Add 4 /* Parameter adds to opcode byte 2 */ +#define MOD_Op3Add 5 /* Parameter adds to opcode byte 3 */ +#define MOD_SpAdd 6 /* Parameter adds to "spare" value */ +#define MOD_OpSizeR 7 /* Parameter replaces opersize */ +#define MOD_Imm8 8 /* Parameter is included as immediate byte */ +#define MOD_AdSizeR 9 /* Parameter replaces addrsize (jmp only) */ +#define MOD_DOpS64R 10 /* Parameter replaces default 64-bit opersize */ +#define MOD_Op1AddSp 11 /* Parameter is added as "spare" to opcode byte 2 */ +#define MOD_SetVEX 12 /* Parameter replaces internal VEX prefix value */ -/* Modifiers that aren't: these are used with the GAS parser to indicate - * special cases. - */ -#define MOD_GasOnly (1UL<<13) /* Only available in GAS mode */ -#define MOD_GasIllegal (1UL<<14) /* Illegal in GAS mode */ -#define MOD_GasNoRev (1UL<<15) /* Don't reverse operands */ -#define MOD_GasSufB (1UL<<16) /* GAS B suffix ok */ -#define MOD_GasSufW (1UL<<17) /* GAS W suffix ok */ -#define MOD_GasSufL (1UL<<18) /* GAS L suffix ok */ -#define MOD_GasSufQ (1UL<<19) /* GAS Q suffix ok */ -#define MOD_GasSufS (1UL<<20) /* GAS S suffix ok */ -#define MOD_GasSuf_SHIFT 16 -#define MOD_GasSuf_MASK (0x1FUL<<16) +/* GAS suffix flags for instructions */ +enum x86_gas_suffix_flags { + SUF_Z = 1<<0, /* no suffix */ + SUF_B = 1<<1, + SUF_W = 1<<2, + SUF_L = 1<<3, + SUF_Q = 1<<4, + SUF_S = 1<<5, + SUF_MASK = SUF_Z|SUF_B|SUF_W|SUF_L|SUF_Q|SUF_S, -/* Operand types. These are more detailed than the "general" types for all - * architectures, as they include the size, for instance. - * Bit Breakdown (from LSB to MSB): - * - 5 bits = general type (must be exact match, except for =3): - * 0 = immediate - * 1 = any general purpose or FPU register - * 2 = memory - * 3 = any general purpose or FPU register OR memory - * 4 = any MMX or XMM register - * 5 = any MMX or XMM register OR memory - * 6 = any segment register - * 7 = any CR register - * 8 = any DR register - * 9 = any TR register - * A = ST0 - * B = AL/AX/EAX/RAX (depending on size) - * C = CL/CX/ECX/RCX (depending on size) - * D = DL/DX/EDX/RDX (depending on size) - * E = CS - * F = DS - * 10 = ES - * 11 = FS - * 12 = GS - * 13 = SS - * 14 = CR4 - * 15 = memory offset (an EA, but with no registers allowed) - * [special case for MOV opcode] - * 16 = immediate, value=1 (for special-case shift) - * 17 = immediate, does not contain SEG:OFF (for jmp/call), - * 18 = XMM0 - * 19 = AX/EAX/RAX memory operand only (EA) - * [special case for SVM opcodes] - * 20 = EAX memory operand only (EA) - * [special case for SVM skinit opcode] - * - 3 bits = size (user-specified, or from register size): - * 0 = any size acceptable/no size spec acceptable (dep. on strict) - * 1/2/3/4 = 8/16/32/64 bits (from user or reg size) - * 5/6 = 80/128 bits (from user) - * 7 = current BITS setting; when this is used the size matched - * gets stored into the opersize as well. - * - 1 bit = size implicit or explicit ("strictness" of size matching on - * non-registers -- registers are always strictly matched): - * 0 = user size must exactly match size above. - * 1 = user size either unspecified or exactly match size above. - * - 3 bits = target modification. - * 0 = no target mod acceptable - * 1 = NEAR - * 2 = SHORT - * 3 = FAR (or SEG:OFF immediate) - * 4 = TO - * - 1 bit = effective address size - * 0 = any address size allowed except for 64-bit - * 1 = only 64-bit address size allowed - * - * MSBs than the above are actions: what to do with the operand if the - * instruction matches. Essentially describes what part of the output bytecode - * gets the operand. This may require conversion (e.g. a register going into - * an ea field). Naturally, only one of each of these may be contained in the - * operands of a single insn_info structure. - * - 4 bits = action: - * 0 = does nothing (operand data is discarded) - * 1 = operand data goes into ea field - * 2 = operand data goes into imm field - * 3 = operand data goes into sign-extended imm field - * 4 = operand data goes into "spare" field - * 5 = operand data is added to opcode byte 0 - * 6 = operand data is added to opcode byte 1 - * 7 = operand data goes into BOTH ea and spare - * [special case for imul opcode] - * 8 = relative jump (outputs a jmp instead of normal insn) - * 9 = operand size goes into address size (jmp only) - * A = far jump (outputs a farjmp instead of normal insn) - * B = ea operand only sets address size (no actual ea field) - * The below describes postponed actions: actions which can't be completed at - * parse-time due to possibly dependent expressions. For these, some - * additional data (stored in the second byte of the opcode with a one-byte - * opcode) is passed to later stages of the assembler with flags set to - * indicate postponed actions. - * - 3 bits = postponed action: - * 0 = none - * 1 = sign-extended imm8 that could expand to a large imm16/32 - * 2 = could become a short opcode mov with bits=64 and a32 prefix - * 3 = forced 16-bit address size (override ignored, no prefix) - * 4 = large imm64 that can become a sign-extended imm32. - */ -#define OPT_Imm 0x0 -#define OPT_Reg 0x1 -#define OPT_Mem 0x2 -#define OPT_RM 0x3 -#define OPT_SIMDReg 0x4 -#define OPT_SIMDRM 0x5 -#define OPT_SegReg 0x6 -#define OPT_CRReg 0x7 -#define OPT_DRReg 0x8 -#define OPT_TRReg 0x9 -#define OPT_ST0 0xA -#define OPT_Areg 0xB -#define OPT_Creg 0xC -#define OPT_Dreg 0xD -#define OPT_CS 0xE -#define OPT_DS 0xF -#define OPT_ES 0x10 -#define OPT_FS 0x11 -#define OPT_GS 0x12 -#define OPT_SS 0x13 -#define OPT_CR4 0x14 -#define OPT_MemOffs 0x15 -#define OPT_Imm1 0x16 -#define OPT_ImmNotSegOff 0x17 -#define OPT_XMM0 0x18 -#define OPT_MemrAX 0x19 -#define OPT_MemEAX 0x1A -#define OPT_MASK 0x1F + /* Flags only used in x86_insn_info */ + GAS_ONLY = 1<<6, /* Only available in GAS mode */ + GAS_ILLEGAL = 1<<7, /* Illegal in GAS mode */ + GAS_NO_REV = 1<<8 /* Don't reverse operands in GAS mode */ +}; -#define OPS_Any (0UL<<5) -#define OPS_8 (1UL<<5) -#define OPS_16 (2UL<<5) -#define OPS_32 (3UL<<5) -#define OPS_64 (4UL<<5) -#define OPS_80 (5UL<<5) -#define OPS_128 (6UL<<5) -#define OPS_BITS (7UL<<5) -#define OPS_MASK (7UL<<5) -#define OPS_SHIFT 5 +/* Miscellaneous flag tests for instructions */ +enum x86_misc_flags { + /* These are tested against BITS==64. */ + ONLY_64 = 1<<0, /* Only available in 64-bit mode */ + NOT_64 = 1<<1, /* Not available (invalid) in 64-bit mode */ + /* These are tested against whether the base instruction is an AVX one. */ + ONLY_AVX = 1<<2, /* Only available in AVX instruction */ + NOT_AVX = 1<<3 /* Not available (invalid) in AVX instruction */ +}; -#define OPS_Relaxed (1UL<<8) -#define OPS_RMASK (1UL<<8) +enum x86_operand_type { + OPT_Imm = 0, /* immediate */ + OPT_Reg = 1, /* any general purpose or FPU register */ + OPT_Mem = 2, /* memory */ + OPT_RM = 3, /* any general purpose or FPU register OR memory */ + OPT_SIMDReg = 4, /* any MMX or XMM register */ + OPT_SIMDRM = 5, /* any MMX or XMM register OR memory */ + OPT_SegReg = 6, /* any segment register */ + OPT_CRReg = 7, /* any CR register */ + OPT_DRReg = 8, /* any DR register */ + OPT_TRReg = 9, /* any TR register */ + OPT_ST0 = 10, /* ST0 */ + OPT_Areg = 11, /* AL/AX/EAX/RAX (depending on size) */ + OPT_Creg = 12, /* CL/CX/ECX/RCX (depending on size) */ + OPT_Dreg = 13, /* DL/DX/EDX/RDX (depending on size) */ + OPT_CS = 14, /* CS */ + OPT_DS = 15, /* DS */ + OPT_ES = 16, /* ES */ + OPT_FS = 17, /* FS */ + OPT_GS = 18, /* GS */ + OPT_SS = 19, /* SS */ + OPT_CR4 = 20, /* CR4 */ + /* memory offset (an EA, but with no registers allowed) + * [special case for MOV opcode] + */ + OPT_MemOffs = 21, + OPT_Imm1 = 22, /* immediate, value=1 (for special-case shift) */ + /* immediate, does not contain SEG:OFF (for jmp/call) */ + OPT_ImmNotSegOff = 23, + OPT_XMM0 = 24, /* XMM0 */ + /* AX/EAX/RAX memory operand only (EA) [special case for SVM opcodes] + */ + OPT_MemrAX = 25, + /* EAX memory operand only (EA) [special case for SVM skinit opcode] */ + OPT_MemEAX = 26, + /* XMM VSIB memory operand */ + OPT_MemXMMIndex = 27, + /* YMM VSIB memory operand */ + OPT_MemYMMIndex = 28 +}; -#define OPEAS_Not64 (0UL<<9) -#define OPEAS_64 (1UL<<9) -#define OPEAS_MASK (1UL<<9) +enum x86_operand_size { + /* any size acceptable/no size spec acceptable (dep. on strict) */ + OPS_Any = 0, + /* 8/16/32/64/80/128/256 bits (from user or reg size) */ + OPS_8 = 1, + OPS_16 = 2, + OPS_32 = 3, + OPS_64 = 4, + OPS_80 = 5, + OPS_128 = 6, + OPS_256 = 7, + /* current BITS setting; when this is used the size matched + * gets stored into the opersize as well. + */ + OPS_BITS = 8 +}; -#define OPTM_None (0UL<<10) -#define OPTM_Near (1UL<<10) -#define OPTM_Short (2UL<<10) -#define OPTM_Far (3UL<<10) -#define OPTM_To (4UL<<10) -#define OPTM_MASK (7UL<<10) +enum x86_operand_targetmod { + OPTM_None = 0, /* no target mod acceptable */ + OPTM_Near = 1, /* NEAR */ + OPTM_Short = 2, /* SHORT */ + OPTM_Far = 3, /* FAR (or SEG:OFF immediate) */ + OPTM_To = 4 /* TO */ +}; -#define OPA_None (0UL<<13) -#define OPA_EA (1UL<<13) -#define OPA_Imm (2UL<<13) -#define OPA_SImm (3UL<<13) -#define OPA_Spare (4UL<<13) -#define OPA_Op0Add (5UL<<13) -#define OPA_Op1Add (6UL<<13) -#define OPA_SpareEA (7UL<<13) -#define OPA_JmpRel (8UL<<13) -#define OPA_AdSizeR (9UL<<13) -#define OPA_JmpFar (0xAUL<<13) -#define OPA_AdSizeEA (0xBUL<<13) -#define OPA_MASK (0xFUL<<13) +enum x86_operand_action { + OPA_None = 0, /* does nothing (operand data is discarded) */ + OPA_EA = 1, /* operand data goes into ea field */ + OPA_Imm = 2, /* operand data goes into imm field */ + OPA_SImm = 3, /* operand data goes into sign-extended imm field */ + OPA_Spare = 4, /* operand data goes into "spare" field */ + OPA_Op0Add = 5, /* operand data is added to opcode byte 0 */ + OPA_Op1Add = 6, /* operand data is added to opcode byte 1 */ + /* operand data goes into BOTH ea and spare + * (special case for imul opcode) + */ + OPA_SpareEA = 7, + /* relative jump (outputs a jmp instead of normal insn) */ + OPA_JmpRel = 8, + /* operand size goes into address size (jmp only) */ + OPA_AdSizeR = 9, + /* far jump (outputs a farjmp instead of normal insn) */ + OPA_JmpFar = 10, + /* ea operand only sets address size (no actual ea field) */ + OPA_AdSizeEA = 11, + OPA_VEX = 12, /* operand data goes into VEX/XOP "vvvv" field */ + /* operand data goes into BOTH VEX/XOP "vvvv" field and ea field */ + OPA_EAVEX = 13, + /* operand data goes into BOTH VEX/XOP "vvvv" field and spare field */ + OPA_SpareVEX = 14, + /* operand data goes into upper 4 bits of immediate byte (VEX is4 field) */ + OPA_VEXImmSrc = 15, + /* operand data goes into bottom 4 bits of immediate byte + * (currently only VEX imz2 field) + */ + OPA_VEXImm = 16 +}; -#define OPAP_None (0UL<<17) -#define OPAP_SImm8 (1UL<<17) -#define OPAP_ShortMov (2UL<<17) -#define OPAP_A16 (3UL<<17) -#define OPAP_SImm32Avail (4UL<<17) -#define OPAP_MASK (7UL<<17) +enum x86_operand_post_action { + OPAP_None = 0, + /* sign-extended imm8 that could expand to a large imm16/32 */ + OPAP_SImm8 = 1, + /* could become a short opcode mov with bits=64 and a32 prefix */ + OPAP_ShortMov = 2, + /* forced 16-bit address size (override ignored, no prefix) */ + OPAP_A16 = 3, + /* large imm64 that can become a sign-extended imm32 */ + OPAP_SImm32Avail = 4 +}; + +typedef struct x86_info_operand { + /* Operand types. These are more detailed than the "general" types for all + * architectures, as they include the size, for instance. + */ + + /* general type (must be exact match, except for RM types): */ + unsigned int type:5; + + /* size (user-specified, or from register size) */ + unsigned int size:4; + + /* size implicit or explicit ("strictness" of size matching on + * non-registers -- registers are always strictly matched): + * 0 = user size must exactly match size above. + * 1 = user size either unspecified or exactly match size above. + */ + unsigned int relaxed:1; + + /* effective address size + * 0 = any address size allowed except for 64-bit + * 1 = only 64-bit address size allowed + */ + unsigned int eas64:1; + + /* target modification */ + unsigned int targetmod:3; + + /* Actions: what to do with the operand if the instruction matches. + * Essentially describes what part of the output bytecode gets the + * operand. This may require conversion (e.g. a register going into + * an ea field). Naturally, only one of each of these may be contained + * in the operands of a single insn_info structure. + */ + unsigned int action:5; + + /* Postponed actions: actions which can't be completed at + * parse-time due to possibly dependent expressions. For these, some + * additional data (stored in the second byte of the opcode with a + * one-byte opcode) is passed to later stages of the assembler with + * flags set to indicate postponed actions. + */ + unsigned int post_action:3; +} x86_info_operand; typedef struct x86_insn_info { + /* GAS suffix flags */ + unsigned int gas_flags:9; /* Enabled for these GAS suffixes */ + + /* Tests against BITS==64, AVX, and XOP */ + unsigned int misc_flags:5; + /* The CPU feature flags needed to execute this instruction. This is OR'ed * with arch-specific data[2]. This combined value is compared with * cpu_enabled to see if all bits set here are set in cpu_enabled--if so, * the instruction is available on this CPU. */ - unsigned long cpu; + unsigned int cpu0:6; + unsigned int cpu1:6; + unsigned int cpu2:6; /* Opcode modifiers for variations of instruction. As each modifier reads * its parameter in LSB->MSB order from the arch-specific data[1] from the * lexer data, and the LSB of the arch-specific data[1] is reserved for the * count of insn_info structures in the instruction grouping, there can - * only be a maximum of 3 modifiers. + * only be a maximum of 4 modifiers. */ - unsigned long modifiers; + unsigned char modifiers[4]; /* Operand Size */ unsigned char opersize; @@ -258,2028 +267,129 @@ typedef struct x86_insn_info { * mode, they're treated like normal prefixes (e.g. the REX prefix needs * to be *after* the F2/F3/66 "prefix"). * (0=no special prefix) + * 0xC0 - 0xCF indicate a VEX prefix, with the four LSBs holding "WLpp": + * W: VEX.W field (meaning depends on opcode) + * L: 0=128-bit, 1=256-bit + * pp: SIMD prefix designation: + * 00: None + * 01: 66 + * 10: F3 + * 11: F2 + * 0x80 - 0x8F indicate a XOP prefix, with the four LSBs holding "WLpp": + * same meanings as VEX prefix. */ unsigned char special_prefix; /* The length of the basic opcode */ unsigned char opcode_len; - /* The basic 1-3 byte opcode (not including the special instruction + /* The basic 1-4 byte opcode (not including the special instruction * prefix). */ - unsigned char opcode[3]; + unsigned char opcode[4]; /* The 3-bit "spare" value (extended opcode) for the R/M byte field */ unsigned char spare; /* The number of operands this form of the instruction takes */ - unsigned char num_operands; + unsigned int num_operands:4; - /* The types of each operand, see above */ - unsigned long operands[3]; + /* The index into the insn_operands array which contains the type of each + * operand, see above + */ + unsigned int operands_index:12; } x86_insn_info; -/* - * General instruction groupings +typedef struct x86_id_insn { + yasm_insn insn; /* base structure */ + + /* instruction parse group - NULL if empty instruction (just prefixes) */ + /*@null@*/ const x86_insn_info *group; + + /* CPU feature flags enabled at the time of parsing the instruction */ + wordptr cpu_enabled; + + /* Modifier data */ + unsigned char mod_data[4]; + + /* Number of elements in the instruction parse group */ + unsigned int num_info:8; + + /* BITS setting active at the time of parsing the instruction */ + unsigned int mode_bits:8; + + /* Suffix flags */ + unsigned int suffix:9; + + /* Tests against BITS==64 and AVX */ + unsigned int misc_flags:5; + + /* Parser enabled at the time of parsing the instruction */ + unsigned int parser:2; + + /* Strict forced setting at the time of parsing the instruction */ + unsigned int force_strict:1; + + /* Default rel setting at the time of parsing the instruction */ + unsigned int default_rel:1; +} x86_id_insn; + +static void x86_id_insn_destroy(void *contents); +static void x86_id_insn_print(const void *contents, FILE *f, int indent_level); +static void x86_id_insn_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); + +static const yasm_bytecode_callback x86_id_insn_callback = { + x86_id_insn_destroy, + x86_id_insn_print, + x86_id_insn_finalize, + NULL, + yasm_bc_calc_len_common, + yasm_bc_expand_common, + yasm_bc_tobytes_common, + YASM_BC_SPECIAL_INSN +}; + +#include "x86insns.c" + +/* Looks for the first SIMD register match for the purposes of VSIB matching. + * Full legality checking is performed in EA code. */ - -/* Empty instruction */ -static const x86_insn_info empty_insn[] = { - { CPU_Any, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, {0, 0, 0} } -}; - -/* Placeholder for instructions invalid in 64-bit mode */ -static const x86_insn_info not64_insn[] = { - { CPU_Not64, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, {0, 0, 0} } -}; - -/* One byte opcode instructions with no operands */ -static const x86_insn_info onebyte_insn[] = { - { CPU_Any, MOD_Op0Add|MOD_OpSizeR|MOD_DOpS64R, 0, 0, 0, 1, {0, 0, 0}, 0, 0, - {0, 0, 0} } -}; - -/* One byte opcode instructions with "special" prefix with no operands */ -static const x86_insn_info onebyte_prefix_insn[] = { - { CPU_Any, MOD_Op0Add|MOD_PreAdd, 0, 0, 0x00, 1, {0x00, 0, 0}, 0, 0, - {0, 0, 0} } -}; - -/* Two byte opcode instructions with no operands */ -static const x86_insn_info twobyte_insn[] = { - { CPU_Any, MOD_Op1Add|MOD_Op0Add|MOD_GasSufL|MOD_GasSufQ, 0, 0, 0, 2, - {0, 0, 0}, 0, 0, {0, 0, 0} } -}; - -/* Three byte opcode instructions with no operands */ -static const x86_insn_info threebyte_insn[] = { - { CPU_Any, MOD_Op2Add|MOD_Op1Add|MOD_Op0Add, 0, 0, 0, 3, {0, 0, 0}, 0, 0, - {0, 0, 0} } -}; - -/* One byte opcode instructions with general memory operand */ -static const x86_insn_info onebytemem_insn[] = { - { CPU_Any, MOD_Op0Add|MOD_SpAdd|MOD_GasSufL|MOD_GasSufQ|MOD_GasSufS, - 0, 0, 0, 1, {0, 0, 0}, 0, 1, {OPT_Mem|OPS_Any|OPA_EA, 0, 0} } -}; - -/* Two byte opcode instructions with general memory operand */ -static const x86_insn_info twobytemem_insn[] = { - { CPU_Any, - MOD_Op1Add|MOD_Op0Add|MOD_SpAdd|MOD_GasSufL|MOD_GasSufQ|MOD_GasSufS, - 0, 0, 0, 2, {0, 0, 0}, 0, 1, {OPT_Mem|OPS_Any|OPA_EA, 0, 0} } -}; - -/* P4 VMX Instructions */ -static const x86_insn_info vmxmemrd_insn[] = { - { CPU_Not64, MOD_Op1Add|MOD_Op0Add|MOD_GasSufL, 32, 0, 0, 2, {0, 0, 0}, 0, - 2, {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_64, MOD_Op1Add|MOD_Op0Add|MOD_GasSufQ, 64, 64, 0, 2, {0, 0, 0}, 0, - 2, {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} } -}; -static const x86_insn_info vmxmemwr_insn[] = { - { CPU_Not64, MOD_Op1Add|MOD_Op0Add|MOD_GasSufL, 32, 0, 0, 2, {0, 0, 0}, 0, - 2, {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_64, MOD_Op1Add|MOD_Op0Add|MOD_GasSufQ, 64, 64, 0, 2, {0, 0, 0}, 0, - 2, {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; -static const x86_insn_info vmxtwobytemem_insn[] = { - { CPU_Any, MOD_SpAdd|MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0, 0}, 0, 1, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info vmxthreebytemem_insn[] = { - { CPU_Any, MOD_SpAdd|MOD_PreAdd|MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0, 0}, 0, 1, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0, 0} } -}; - -/* Move instructions */ -static const x86_insn_info mov_insn[] = { - /* Absolute forms for non-64-bit mode */ - { CPU_Not64, MOD_GasSufB, 0, 0, 0, 1, {0xA0, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, OPT_MemOffs|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Not64, MOD_GasSufW, 16, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, OPT_MemOffs|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, OPT_MemOffs|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - - { CPU_Not64, MOD_GasSufB, 0, 0, 0, 1, {0xA2, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_8|OPS_Relaxed|OPA_EA, OPT_Areg|OPS_8|OPA_None, 0} }, - { CPU_Not64, MOD_GasSufW, 16, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_16|OPS_Relaxed|OPA_EA, OPT_Areg|OPS_16|OPA_None, 0} }, - { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_32|OPS_Relaxed|OPA_EA, OPT_Areg|OPS_32|OPA_None, 0} }, - - /* 64-bit absolute forms for 64-bit mode. Disabled for GAS, see movabs */ - { CPU_Hammer|CPU_64, 0, 0, 0, 0, 1, {0xA0, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, - OPT_MemOffs|OPS_8|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, 0, 16, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, - OPT_MemOffs|OPS_16|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, 0, 32, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, - OPT_MemOffs|OPS_32|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_64|OPA_None, - OPT_MemOffs|OPS_64|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - - { CPU_Hammer|CPU_64, 0, 0, 0, 0, 1, {0xA2, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_8|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_8|OPA_None, 0} }, - { CPU_Hammer|CPU_64, 0, 16, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_16|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_16|OPA_None, 0} }, - { CPU_Hammer|CPU_64, 0, 32, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_32|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_32|OPA_None, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_64|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_64|OPA_None, 0} }, - - /* General 32-bit forms using Areg / short absolute option */ - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x88, 0xA2, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA|OPAP_ShortMov, OPT_Areg|OPS_8|OPA_Spare, - 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x89, 0xA3, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA|OPAP_ShortMov, - OPT_Areg|OPS_16|OPA_Spare, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x89, 0xA3, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA|OPAP_ShortMov, - OPT_Areg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x89, 0xA3, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA|OPAP_ShortMov, - OPT_Areg|OPS_64|OPA_Spare, 0} }, - - /* General 32-bit forms */ - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x88, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_8|OPA_Spare, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x89, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x89, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x89, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} }, - - /* General 32-bit forms using Areg / short absolute option */ - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x8A, 0xA0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA|OPAP_ShortMov, - 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x8B, 0xA1, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_Spare, - OPT_RM|OPS_16|OPS_Relaxed|OPA_EA|OPAP_ShortMov, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x8B, 0xA1, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_Spare, - OPT_RM|OPS_32|OPS_Relaxed|OPA_EA|OPAP_ShortMov, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x8B, 0xA1, 0}, 0, 2, - {OPT_Areg|OPS_64|OPA_Spare, - OPT_RM|OPS_64|OPS_Relaxed|OPA_EA|OPAP_ShortMov, 0} }, - - /* General 32-bit forms */ - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x8A, 0, 0}, 0, 2, - {OPT_Reg|OPS_8|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x8B, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x8B, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x8B, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - - /* Segment register forms */ - { CPU_Any, MOD_GasSufW, 0, 0, 0, 1, {0x8C, 0, 0}, 0, 2, - {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, - OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x8C, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_EA, OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x8C, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_EA, OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x8C, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_EA, OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, 0} }, - - { CPU_Any, MOD_GasSufW, 0, 0, 0, 1, {0x8E, 0, 0}, 0, 2, - {OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, - OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_GasSufL, 0, 0, 0, 1, {0x8E, 0, 0}, 0, 2, - {OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 0, 0, 0, 1, {0x8E, 0, 0}, 0, 2, - {OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, OPT_Reg|OPS_64|OPA_EA, 0} }, - - /* Immediate forms */ - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xB0, 0, 0}, 0, 2, - {OPT_Reg|OPS_8|OPA_Op0Add, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xB8, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Op0Add, OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xB8, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Op0Add, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - /* 64-bit forced size form */ - { CPU_Hammer|CPU_64, MOD_GasIllegal, 64, 0, 0, 1, {0xB8, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Op0Add, OPT_Imm|OPS_64|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xB8, 0xC7, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Op0Add, - OPT_Imm|OPS_64|OPS_Relaxed|OPA_Imm|OPAP_SImm32Avail, 0} }, - /* Need two sets here, one for strictness on left side, one for right. */ - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xC6, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_8|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xC7, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_16|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xC7, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_32|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xC7, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_32|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xC6, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xC7, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPA_EA, OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xC7, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPA_EA, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xC7, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPA_EA, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - - /* CR/DR forms */ - { CPU_586|CPU_Priv|CPU_Not64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x22, 0}, 0, - 2, {OPT_CR4|OPS_32|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, 0} }, - { CPU_386|CPU_Priv|CPU_Not64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x22, 0}, 0, - 2, {OPT_CRReg|OPS_32|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, 0} }, - { CPU_Hammer|CPU_Priv|CPU_64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x22, 0}, 0, - 2, {OPT_CRReg|OPS_32|OPA_Spare, OPT_Reg|OPS_64|OPA_EA, 0} }, - { CPU_586|CPU_Priv|CPU_Not64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x20, 0}, 0, - 2, {OPT_Reg|OPS_32|OPA_EA, OPT_CR4|OPS_32|OPA_Spare, 0} }, - { CPU_386|CPU_Priv|CPU_Not64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x20, 0}, 0, - 2, {OPT_Reg|OPS_32|OPA_EA, OPT_CRReg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_Priv|CPU_64, MOD_GasSufQ, 0, 0, 0, 2, {0x0F, 0x20, 0}, 0, - 2, {OPT_Reg|OPS_64|OPA_EA, OPT_CRReg|OPS_32|OPA_Spare, 0} }, - - { CPU_386|CPU_Priv|CPU_Not64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x23, 0}, 0, - 2, {OPT_DRReg|OPS_32|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, 0} }, - { CPU_Hammer|CPU_Priv|CPU_64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x23, 0}, 0, - 2, {OPT_DRReg|OPS_32|OPA_Spare, OPT_Reg|OPS_64|OPA_EA, 0} }, - { CPU_386|CPU_Priv|CPU_Not64, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x21, 0}, 0, - 2, {OPT_Reg|OPS_32|OPA_EA, OPT_DRReg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_Priv|CPU_64, MOD_GasSufQ, 0, 0, 0, 2, {0x0F, 0x21, 0}, 0, - 2, {OPT_Reg|OPS_64|OPA_EA, OPT_DRReg|OPS_32|OPA_Spare, 0} }, - - /* MMX/SSE2 forms for GAS parser (copied from movq_insn) */ - { CPU_MMX, MOD_GasOnly|MOD_GasSufQ, 0, 0, 0, 2, {0x0F, 0x6F, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_MMX|CPU_Hammer|CPU_64, MOD_GasOnly|MOD_GasSufQ, 64, 0, 0, 2, - {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_MMX, MOD_GasOnly|MOD_GasSufQ, 0, 0, 0, 2, {0x0F, 0x7F, 0}, 0, 2, - {OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} - }, - { CPU_MMX|CPU_Hammer|CPU_64, MOD_GasOnly|MOD_GasSufQ, 64, 0, 0, 2, - {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} }, - { CPU_SSE2, MOD_GasOnly|MOD_GasSufQ, 0, 0, 0xF3, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} }, - { CPU_SSE2, MOD_GasOnly|MOD_GasSufQ, 0, 0, 0xF3, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE2|CPU_Hammer|CPU_64, MOD_GasOnly|MOD_GasSufQ, 64, 0, 0x66, 2, - {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE2, MOD_GasOnly|MOD_GasSufQ, 0, 0, 0x66, 2, {0x0F, 0xD6, 0}, 0, 2, - {OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} - }, - { CPU_SSE2|CPU_Hammer|CPU_64, MOD_GasOnly|MOD_GasSufQ, 64, 0, 0x66, 2, - {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; - -/* 64-bit absolute move (for GAS). - * These are disabled for GAS for normal mov above. - */ -static const x86_insn_info movabs_insn[] = { - { CPU_Hammer|CPU_64, MOD_GasSufB, 0, 0, 0, 1, {0xA0, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, - OPT_MemOffs|OPS_8|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufW, 16, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, - OPT_MemOffs|OPS_16|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufL, 32, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, - OPT_MemOffs|OPS_32|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xA1, 0, 0}, 0, 2, - {OPT_Areg|OPS_64|OPA_None, - OPT_MemOffs|OPS_64|OPS_Relaxed|OPEAS_64|OPA_EA, 0} }, - - { CPU_Hammer|CPU_64, MOD_GasSufB, 0, 0, 0, 1, {0xA2, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_8|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_8|OPA_None, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufW, 16, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_16|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_16|OPA_None, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufL, 32, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_32|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_32|OPA_None, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xA3, 0, 0}, 0, 2, - {OPT_MemOffs|OPS_64|OPS_Relaxed|OPEAS_64|OPA_EA, - OPT_Areg|OPS_64|OPA_None, 0} }, - - /* 64-bit immediate form */ - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xB8, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Op0Add, OPT_Imm|OPS_64|OPS_Relaxed|OPA_Imm, 0} }, -}; - -/* Move with sign/zero extend */ -static const x86_insn_info movszx_insn[] = { - { CPU_386, MOD_Op1Add|MOD_GasSufB, 16, 0, 0, 2, {0x0F, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_Op1Add|MOD_GasSufB, 32, 0, 0, 2, {0x0F, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_8|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufB, 64, 0, 0, 2, {0x0F, 0, 0}, 0, - 2, {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_8|OPA_EA, 0} }, - { CPU_386, MOD_Op1Add|MOD_GasSufW, 32, 0, 0, 2, {0x0F, 1, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_16|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufW, 64, 0, 0, 2, {0x0F, 1, 0}, 0, - 2, {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_16|OPA_EA, 0} } -}; - -/* Move with sign-extend doubleword (64-bit mode only) */ -static const x86_insn_info movsxd_insn[] = { - { CPU_Hammer|CPU_64, MOD_GasSufL, 64, 0, 0, 1, {0x63, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_32|OPA_EA, 0} } -}; - -/* Push instructions */ -static const x86_insn_info push_insn[] = { - { CPU_Any, MOD_GasSufW, 16, 64, 0, 1, {0x50, 0, 0}, 0, 1, - {OPT_Reg|OPS_16|OPA_Op0Add, 0, 0} }, - { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x50, 0, 0}, 0, 1, - {OPT_Reg|OPS_32|OPA_Op0Add, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 0, 64, 0, 1, {0x50, 0, 0}, 0, 1, - {OPT_Reg|OPS_64|OPA_Op0Add, 0, 0} }, - { CPU_Any, MOD_GasSufW, 16, 64, 0, 1, {0xFF, 0, 0}, 6, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0xFF, 0, 0}, 6, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 0, 64, 0, 1, {0xFF, 0, 0}, 6, 1, - {OPT_RM|OPS_64|OPA_EA, 0, 0} }, - { CPU_186, MOD_GasIllegal, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPA_SImm, 0, 0} }, - { CPU_186, MOD_GasOnly|MOD_GasSufB, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_SImm, 0, 0} }, - { CPU_186, MOD_GasOnly|MOD_GasSufW, 16, 64, 0, 1, {0x6A, 0x68, 0}, 0, 1, - {OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0, 0} }, - { CPU_386|CPU_Not64, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1, - {0x6A, 0x68, 0}, 0, 1, - {OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 64, 0, 1, - {0x6A, 0x68, 0}, 0, 1, - {OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8, 0, 0} }, - { CPU_186|CPU_Not64, MOD_GasIllegal, 0, 0, 0, 1, - {0x6A, 0x68, 0}, 0, 1, - {OPT_Imm|OPS_BITS|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0, 0} }, - /* Need these when we don't match the BITS size, but they need to be - * below the above line so the optimizer can kick in by default. - */ - { CPU_186, MOD_GasIllegal, 16, 64, 0, 1, {0x68, 0, 0}, 0, 1, - {OPT_Imm|OPS_16|OPA_Imm, 0, 0} }, - { CPU_386|CPU_Not64, MOD_GasIllegal, 32, 0, 0, 1, {0x68, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPA_Imm, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasIllegal, 64, 64, 0, 1, {0x68, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPA_SImm, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x0E, 0, 0}, 0, 1, - {OPT_CS|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufW, 16, 0, 0, 1, {0x0E, 0, 0}, 0, 1, - {OPT_CS|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x0E, 0, 0}, 0, 1, - {OPT_CS|OPS_32|OPA_None, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x16, 0, 0}, 0, 1, - {OPT_SS|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufW, 16, 0, 0, 1, {0x16, 0, 0}, 0, 1, - {OPT_SS|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x16, 0, 0}, 0, 1, - {OPT_SS|OPS_32|OPA_None, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x1E, 0, 0}, 0, 1, - {OPT_DS|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufW, 16, 0, 0, 1, {0x1E, 0, 0}, 0, 1, - {OPT_DS|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x1E, 0, 0}, 0, 1, - {OPT_DS|OPS_32|OPA_None, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x06, 0, 0}, 0, 1, - {OPT_ES|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufW, 16, 0, 0, 1, {0x06, 0, 0}, 0, 1, - {OPT_ES|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x06, 0, 0}, 0, 1, - {OPT_ES|OPS_32|OPA_None, 0, 0} }, - { CPU_386, 0, 0, 0, 0, 2, {0x0F, 0xA0, 0}, 0, 1, - {OPT_FS|OPS_Any|OPA_None, 0, 0} }, - { CPU_386, MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0xA0, 0}, 0, 1, - {OPT_FS|OPS_16|OPA_None, 0, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0xA0, 0}, 0, 1, - {OPT_FS|OPS_32|OPA_None, 0, 0} }, - { CPU_386, 0, 0, 0, 0, 2, {0x0F, 0xA8, 0}, 0, 1, - {OPT_GS|OPS_Any|OPA_None, 0, 0} }, - { CPU_386, MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0xA8, 0}, 0, 1, - {OPT_GS|OPS_16|OPA_None, 0, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0xA8, 0}, 0, 1, - {OPT_GS|OPS_32|OPA_None, 0, 0} } -}; - -/* Pop instructions */ -static const x86_insn_info pop_insn[] = { - { CPU_Any, MOD_GasSufW, 16, 64, 0, 1, {0x58, 0, 0}, 0, 1, - {OPT_Reg|OPS_16|OPA_Op0Add, 0, 0} }, - { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x58, 0, 0}, 0, 1, - {OPT_Reg|OPS_32|OPA_Op0Add, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 0, 64, 0, 1, {0x58, 0, 0}, 0, 1, - {OPT_Reg|OPS_64|OPA_Op0Add, 0, 0} }, - { CPU_Any, MOD_GasSufW, 16, 64, 0, 1, {0x8F, 0, 0}, 0, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1, {0x8F, 0, 0}, 0, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 0, 64, 0, 1, {0x8F, 0, 0}, 0, 1, - {OPT_RM|OPS_64|OPA_EA, 0, 0} }, - /* POP CS is debateably valid on the 8086, if obsolete and undocumented. - * We don't include it because it's VERY unlikely it will ever be used - * anywhere. If someone really wants it they can db 0x0F it. - */ - /*{ CPU_Any|CPU_Undoc|CPU_Obs, 0, 0, 1, {0x0F, 0, 0}, 0, 1, - {OPT_CS|OPS_Any|OPA_None, 0, 0} },*/ - { CPU_Not64, 0, 0, 0, 0, 1, {0x17, 0, 0}, 0, 1, - {OPT_SS|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, 0, 16, 0, 0, 1, {0x17, 0, 0}, 0, 1, - {OPT_SS|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, 0, 32, 0, 0, 1, {0x17, 0, 0}, 0, 1, - {OPT_SS|OPS_32|OPA_None, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x1F, 0, 0}, 0, 1, - {OPT_DS|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, 0, 16, 0, 0, 1, {0x1F, 0, 0}, 0, 1, - {OPT_DS|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, 0, 32, 0, 0, 1, {0x1F, 0, 0}, 0, 1, - {OPT_DS|OPS_32|OPA_None, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x07, 0, 0}, 0, 1, - {OPT_ES|OPS_Any|OPA_None, 0, 0} }, - { CPU_Not64, 0, 16, 0, 0, 1, {0x07, 0, 0}, 0, 1, - {OPT_ES|OPS_16|OPA_None, 0, 0} }, - { CPU_Not64, 0, 32, 0, 0, 1, {0x07, 0, 0}, 0, 1, - {OPT_ES|OPS_32|OPA_None, 0, 0} }, - { CPU_386, 0, 0, 0, 0, 2, {0x0F, 0xA1, 0}, 0, 1, - {OPT_FS|OPS_Any|OPA_None, 0, 0} }, - { CPU_386, 0, 16, 0, 0, 2, {0x0F, 0xA1, 0}, 0, 1, - {OPT_FS|OPS_16|OPA_None, 0, 0} }, - { CPU_386, 0, 32, 0, 0, 2, {0x0F, 0xA1, 0}, 0, 1, - {OPT_FS|OPS_32|OPA_None, 0, 0} }, - { CPU_386, 0, 0, 0, 0, 2, {0x0F, 0xA9, 0}, 0, 1, - {OPT_GS|OPS_Any|OPA_None, 0, 0} }, - { CPU_386, 0, 16, 0, 0, 2, {0x0F, 0xA9, 0}, 0, 1, - {OPT_GS|OPS_16|OPA_None, 0, 0} }, - { CPU_386, 0, 32, 0, 0, 2, {0x0F, 0xA9, 0}, 0, 1, - {OPT_GS|OPS_32|OPA_None, 0, 0} } -}; - -/* Exchange instructions */ -static const x86_insn_info xchg_insn[] = { - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x86, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_8|OPA_Spare, 0} }, - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x86, 0, 0}, 0, 2, - {OPT_Reg|OPS_8|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - /* We could be extra-efficient in the 64-bit mode case here. - * XCHG AX, AX in 64-bit mode is a NOP, as it doesn't clear the - * high 48 bits of RAX. Thus we don't need the operand-size prefix. - * But this feels too clever, and probably not what the user really - * expects in the generated code, so we don't do it. - * - * { CPU_Any|CPU_64, MOD_GasSufW, 0, 0, 0, 1, {0x90, 0, 0}, 0, 2, - * {OPT_Areg|OPS_16|OPA_None, OPT_Areg|OPS_16|OPA_Op0Add, 0} }, - */ - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, OPT_Reg|OPS_16|OPA_Op0Add, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Op0Add, OPT_Areg|OPS_16|OPA_None, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - /* Be careful with XCHG EAX, EAX in 64-bit mode. This needs to use - * the long form rather than the NOP form, as the long form clears - * the high 32 bits of RAX. This makes all 32-bit forms in 64-bit - * mode have consistent operation. - */ - { CPU_386|CPU_64, MOD_GasSufL, 32, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_EA, OPT_Areg|OPS_32|OPA_Spare, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, OPT_Reg|OPS_32|OPA_Op0Add, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Op0Add, OPT_Areg|OPS_32|OPA_None, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - /* Be efficient with XCHG RAX, RAX. - * This is a NOP and thus doesn't need the REX prefix. - */ - { CPU_Hammer|CPU_64, MOD_GasSufQ, 0, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Areg|OPS_64|OPA_None, OPT_Areg|OPS_64|OPA_Op0Add, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Areg|OPS_64|OPA_None, OPT_Reg|OPS_64|OPA_Op0Add, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x90, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Op0Add, OPT_Areg|OPS_64|OPA_None, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x87, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* In/out from ports */ -static const x86_insn_info in_insn[] = { - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xE4, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xE5, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xE5, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xEC, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, OPT_Dreg|OPS_16|OPA_None, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xED, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, OPT_Dreg|OPS_16|OPA_None, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xED, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, OPT_Dreg|OPS_16|OPA_None, 0} }, - /* GAS-only variants (implict accumulator register) */ - { CPU_Any, MOD_GasOnly|MOD_GasSufB, 0, 0, 0, 1, {0xE4, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_Any, MOD_GasOnly|MOD_GasSufW, 16, 0, 0, 1, {0xE5, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_386, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1, {0xE5, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_Any, MOD_GasOnly|MOD_GasSufB, 0, 0, 0, 1, {0xEC, 0, 0}, 0, 1, - {OPT_Dreg|OPS_16|OPA_None, 0, 0} }, - { CPU_Any, MOD_GasOnly|MOD_GasSufW, 16, 0, 0, 1, {0xED, 0, 0}, 0, 1, - {OPT_Dreg|OPS_16|OPA_None, 0, 0} }, - { CPU_386, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1, {0xED, 0, 0}, 0, 1, - {OPT_Dreg|OPS_16|OPA_None, 0, 0} } -}; -static const x86_insn_info out_insn[] = { - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xE6, 0, 0}, 0, 2, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, OPT_Areg|OPS_8|OPA_None, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xE7, 0, 0}, 0, 2, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, OPT_Areg|OPS_16|OPA_None, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xE7, 0, 0}, 0, 2, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, OPT_Areg|OPS_32|OPA_None, 0} }, - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xEE, 0, 0}, 0, 2, - {OPT_Dreg|OPS_16|OPA_None, OPT_Areg|OPS_8|OPA_None, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xEF, 0, 0}, 0, 2, - {OPT_Dreg|OPS_16|OPA_None, OPT_Areg|OPS_16|OPA_None, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xEF, 0, 0}, 0, 2, - {OPT_Dreg|OPS_16|OPA_None, OPT_Areg|OPS_32|OPA_None, 0} }, - /* GAS-only variants (implict accumulator register) */ - { CPU_Any, MOD_GasOnly|MOD_GasSufB, 0, 0, 0, 1, {0xE6, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_Any, MOD_GasOnly|MOD_GasSufW, 16, 0, 0, 1, {0xE7, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_386, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1, {0xE7, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_Any, MOD_GasOnly|MOD_GasSufB, 0, 0, 0, 1, {0xEE, 0, 0}, 0, 1, - {OPT_Dreg|OPS_16|OPA_None, 0, 0} }, - { CPU_Any, MOD_GasOnly|MOD_GasSufW, 16, 0, 0, 1, {0xEF, 0, 0}, 0, 1, - {OPT_Dreg|OPS_16|OPA_None, 0, 0} }, - { CPU_386, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1, {0xEF, 0, 0}, 0, 1, - {OPT_Dreg|OPS_16|OPA_None, 0, 0} } -}; - -/* Load effective address */ -static const x86_insn_info lea_insn[] = { - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x8D, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x8D, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x8D, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* Load segment registers from memory */ -static const x86_insn_info ldes_insn[] = { - { CPU_Not64, MOD_Op0Add|MOD_GasSufW, 16, 0, 0, 1, {0, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_Mem|OPS_Any|OPA_EA, 0} }, - { CPU_386|CPU_Not64, MOD_Op0Add|MOD_GasSufL, 32, 0, 0, 1, {0, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_Any|OPA_EA, 0} } -}; -static const x86_insn_info lfgss_insn[] = { - { CPU_386, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_Mem|OPS_Any|OPA_EA, 0} }, - { CPU_386, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_Any|OPA_EA, 0} } -}; - -/* Arithmetic - general */ -static const x86_insn_info arith_insn[] = { - { CPU_Any, MOD_Op0Add|MOD_GasSufB, 0, 0, 0, 1, {0x04, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_Op2Add|MOD_Op1AddSp|MOD_GasSufW, 16, 0, 0, 2, - {0x83, 0xC0, 0x05}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, - OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0} }, - { CPU_386, MOD_Op2Add|MOD_Op1AddSp|MOD_GasSufL, 32, 0, 0, 2, - {0x83, 0xC0, 0x05}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0} }, - { CPU_Hammer|CPU_64, MOD_Op2Add|MOD_Op1AddSp|MOD_GasSufQ, 64, 0, 0, 2, - {0x83, 0xC0, 0x05}, 0, - 2, {OPT_Areg|OPS_64|OPA_None, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0} }, - - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0x80, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0x80, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_8|OPA_Imm, 0} }, - - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0x83, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPA_EA, OPT_Imm|OPS_8|OPA_SImm, 0} }, - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasIllegal, 16, 0, 0, 1, {0x83, 0x81, 0}, - 0, 2, {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_16|OPA_Imm|OPAP_SImm8, 0} }, - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0x83, 0x81, 0}, 0, - 2, {OPT_RM|OPS_16|OPA_EA, - OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0} }, - - { CPU_386, MOD_Gap0|MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0x83, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPA_EA, OPT_Imm|OPS_8|OPA_SImm, 0} }, - /* Not64 because we can't tell if add [], dword in 64-bit mode is supposed - * to be a qword destination or a dword destination. - */ - { CPU_386|CPU_Not64, MOD_Gap0|MOD_SpAdd|MOD_GasIllegal, 32, 0, 0, 1, - {0x83, 0x81, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_32|OPA_Imm|OPAP_SImm8, 0} }, - { CPU_386, MOD_Gap0|MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0x83, 0x81, 0}, 0, - 2, {OPT_RM|OPS_32|OPA_EA, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0} }, - - /* No relaxed-RM mode for 64-bit destinations; see above Not64 comment. */ - { CPU_Hammer|CPU_64, MOD_Gap0|MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, - {0x83, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPA_EA, OPT_Imm|OPS_8|OPA_SImm, 0} }, - { CPU_Hammer|CPU_64, MOD_Gap0|MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, - {0x83, 0x81, 0}, 0, 2, - {OPT_RM|OPS_64|OPA_EA, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8, 0} }, - - { CPU_Any, MOD_Op0Add|MOD_GasSufB, 0, 0, 0, 1, {0x00, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_8|OPA_Spare, 0} }, - { CPU_Any, MOD_Op0Add|MOD_GasSufW, 16, 0, 0, 1, {0x01, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386, MOD_Op0Add|MOD_GasSufL, 32, 0, 0, 1, {0x01, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_Op0Add|MOD_GasSufQ, 64, 0, 0, 1, {0x01, 0, 0}, 0, - 2, {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} }, - { CPU_Any, MOD_Op0Add|MOD_GasSufB, 0, 0, 0, 1, {0x02, 0, 0}, 0, 2, - {OPT_Reg|OPS_8|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Any, MOD_Op0Add|MOD_GasSufW, 16, 0, 0, 1, {0x03, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_Op0Add|MOD_GasSufL, 32, 0, 0, 1, {0x03, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_Op0Add|MOD_GasSufQ, 64, 0, 0, 1, {0x03, 0, 0}, 0, - 2, {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* Arithmetic - inc/dec */ -static const x86_insn_info incdec_insn[] = { - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xFE, 0, 0}, 0, 1, - {OPT_RM|OPS_8|OPA_EA, 0, 0} }, - { CPU_Not64, MOD_Op0Add|MOD_GasSufW, 16, 0, 0, 1, {0, 0, 0}, 0, 1, - {OPT_Reg|OPS_16|OPA_Op0Add, 0, 0} }, - { CPU_Any, MOD_Gap0|MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xFF, 0, 0}, 0, - 1, {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, MOD_Op0Add|MOD_GasSufL, 32, 0, 0, 1, {0, 0, 0}, 0, 1, - {OPT_Reg|OPS_32|OPA_Op0Add, 0, 0} }, - { CPU_386, MOD_Gap0|MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xFF, 0, 0}, 0, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_Gap0|MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, - {0xFF, 0, 0}, 0, 1, {OPT_RM|OPS_64|OPA_EA, 0, 0} }, -}; - -/* Arithmetic - mul/neg/not F6 opcodes */ -static const x86_insn_info f6_insn[] = { - { CPU_Any, MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xF6, 0, 0}, 0, 1, - {OPT_RM|OPS_8|OPA_EA, 0, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xF7, 0, 0}, 0, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386, MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xF7, 0, 0}, 0, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, {0xF7, 0, 0}, 0, - 1, {OPT_RM|OPS_64|OPA_EA, 0, 0} }, -}; - -/* Arithmetic - div/idiv F6 opcodes - * These allow explicit accumulator in GAS mode. - */ -static const x86_insn_info div_insn[] = { - { CPU_Any, MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xF6, 0, 0}, 0, 1, - {OPT_RM|OPS_8|OPA_EA, 0, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xF7, 0, 0}, 0, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386, MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xF7, 0, 0}, 0, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, {0xF7, 0, 0}, 0, - 1, {OPT_RM|OPS_64|OPA_EA, 0, 0} }, - /* Versions with explicit accumulator */ - { CPU_Any, MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xF6, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, OPT_RM|OPS_8|OPA_EA, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, OPT_RM|OPS_16|OPA_EA, 0} }, - { CPU_386, MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, OPT_RM|OPS_32|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, {0xF7, 0, 0}, 0, - 2, {OPT_Areg|OPS_64|OPA_None, OPT_RM|OPS_64|OPA_EA, 0} }, -}; - -/* Arithmetic - test instruction */ -static const x86_insn_info test_insn[] = { - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xA8, 0, 0}, 0, 2, - {OPT_Areg|OPS_8|OPA_None, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xA9, 0, 0}, 0, 2, - {OPT_Areg|OPS_16|OPA_None, OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xA9, 0, 0}, 0, 2, - {OPT_Areg|OPS_32|OPA_None, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xA9, 0, 0}, 0, 2, - {OPT_Areg|OPS_64|OPA_None, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xF6, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xF6, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_8|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPA_EA, OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_16|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPA_EA, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_32|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPA_EA, OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xF7, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_32|OPA_Imm, 0} }, - - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x84, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_8|OPA_Spare, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x85, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x85, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x85, 0, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} }, - - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0x84, 0, 0}, 0, 2, - {OPT_Reg|OPS_8|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0x85, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x85, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x85, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* Arithmetic - aad/aam */ -static const x86_insn_info aadm_insn[] = { - { CPU_Any, MOD_Op0Add, 0, 0, 0, 2, {0xD4, 0x0A, 0}, 0, 0, {0, 0, 0} }, - { CPU_Any, MOD_Op0Add, 0, 0, 0, 1, {0xD4, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} } -}; - -/* Arithmetic - imul */ -static const x86_insn_info imul_insn[] = { - { CPU_Any, MOD_GasSufB, 0, 0, 0, 1, {0xF6, 0, 0}, 5, 1, - {OPT_RM|OPS_8|OPA_EA, 0, 0} }, - { CPU_Any, MOD_GasSufW, 16, 0, 0, 1, {0xF7, 0, 0}, 5, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0xF7, 0, 0}, 5, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0xF7, 0, 0}, 5, 1, - {OPT_RM|OPS_64|OPA_EA, 0, 0} }, - - { CPU_386, MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0xAF, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0xAF, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0xAF, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - - { CPU_186, MOD_GasSufW, 16, 0, 0, 1, {0x6B, 0, 0}, 0, 3, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPA_SImm} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x6B, 0, 0}, 0, 3, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPA_SImm} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x6B, 0, 0}, 0, 3, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPA_SImm} }, - - { CPU_186, MOD_GasSufW, 16, 0, 0, 1, {0x6B, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_SpareEA, OPT_Imm|OPS_8|OPA_SImm, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x6B, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_SpareEA, OPT_Imm|OPS_8|OPA_SImm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x6B, 0, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_SpareEA, OPT_Imm|OPS_8|OPA_SImm, 0} }, - - { CPU_186, MOD_GasSufW, 16, 0, 0, 1, {0x6B, 0x69, 0}, 0, 3, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_16|OPS_Relaxed|OPA_SImm|OPAP_SImm8} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x6B, 0x69, 0}, 0, 3, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x6B, 0x69, 0}, 0, 3, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8} }, - - { CPU_186, MOD_GasSufW, 16, 0, 0, 1, {0x6B, 0x69, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_SpareEA, - OPT_Imm|OPS_16|OPS_Relaxed|OPA_SImm|OPAP_SImm8, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x6B, 0x69, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_SpareEA, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 1, {0x6B, 0x69, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_SpareEA, - OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8, 0} } -}; - -/* Shifts - standard */ -static const x86_insn_info shift_insn[] = { - { CPU_Any, MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xD2, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPA_EA, OPT_Creg|OPS_8|OPA_None, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xD0, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPA_EA, OPT_Imm1|OPS_8|OPS_Relaxed|OPA_None, 0} }, - { CPU_186, MOD_SpAdd|MOD_GasSufB, 0, 0, 0, 1, {0xC0, 0, 0}, 0, 2, - {OPT_RM|OPS_8|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xD3, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPA_EA, OPT_Creg|OPS_8|OPA_None, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xD1, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPA_EA, OPT_Imm1|OPS_8|OPS_Relaxed|OPA_None, 0} }, - { CPU_186, MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 1, {0xC1, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xD3, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPA_EA, OPT_Creg|OPS_8|OPA_None, 0} }, - { CPU_386, MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xD1, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPA_EA, OPT_Imm1|OPS_8|OPS_Relaxed|OPA_None, 0} }, - { CPU_386, MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 1, {0xC1, 0, 0}, 0, 2, - {OPT_RM|OPS_32|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, {0xD3, 0, 0}, 0, - 2, {OPT_RM|OPS_64|OPA_EA, OPT_Creg|OPS_8|OPA_None, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, {0xD1, 0, 0}, - 0, 2, {OPT_RM|OPS_64|OPA_EA, OPT_Imm1|OPS_8|OPS_Relaxed|OPA_None, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 1, {0xC1, 0, 0}, - 0, 2, {OPT_RM|OPS_64|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - /* In GAS mode, single operands are equivalent to shifting by 1 forms */ - { CPU_Any, MOD_SpAdd|MOD_GasOnly|MOD_GasSufB, 0, 0, 0, 1, {0xD0, 0, 0}, - 0, 1, {OPT_RM|OPS_8|OPA_EA, 0, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasOnly|MOD_GasSufW, 16, 0, 0, 1, {0xD1, 0, 0}, - 0, 1, {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_Any, MOD_SpAdd|MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1, {0xD1, 0, 0}, - 0, 1, {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_SpAdd|MOD_GasOnly|MOD_GasSufQ, 64, 0, 0, 1, - {0xD1, 0, 0}, 0, 1, {OPT_RM|OPS_64|OPA_EA, 0, 0} } -}; - -/* Shifts - doubleword */ -static const x86_insn_info shlrd_insn[] = { - { CPU_386, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x00, 0}, 0, 3, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_386, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x01, 0}, 0, 3, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, - OPT_Creg|OPS_8|OPA_None} }, - { CPU_386, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x00, 0}, 0, 3, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_386, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x01, 0}, 0, 3, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, - OPT_Creg|OPS_8|OPA_None} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 3, {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x01, 0}, - 0, 3, {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, - OPT_Creg|OPS_8|OPA_None} }, - /* GAS parser supports two-operand form for shift with CL count */ - { CPU_386, MOD_Op1Add|MOD_GasOnly|MOD_GasSufW, 16, 0, 0, 2, - {0x0F, 0x01, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386, MOD_Op1Add|MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 2, - {0x0F, 0x01, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasOnly|MOD_GasSufQ, 64, 0, 0, 2, - {0x0F, 0x01, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} } -}; - -/* Control transfer instructions (unconditional) */ -static const x86_insn_info call_insn[] = { - { CPU_Any, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_Any|OPA_JmpRel, 0, 0} }, - { CPU_Any, 0, 16, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_16|OPA_JmpRel, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_32|OPA_JmpRel, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_32|OPA_JmpRel, 0, 0} }, - - { CPU_Any, 0, 16, 64, 0, 1, {0xE8, 0, 0}, 0, 1, - {OPT_Imm|OPS_16|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xE8, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0xE8, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_Any, 0, 0, 64, 0, 1, {0xE8, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Near|OPA_JmpRel, 0, 0} }, - - { CPU_Any, 0, 16, 0, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_RM|OPS_64|OPA_EA, 0, 0} }, - { CPU_Any, 0, 0, 64, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_Mem|OPS_Any|OPA_EA, 0, 0} }, - { CPU_Any, 0, 16, 64, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_RM|OPS_16|OPTM_Near|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_RM|OPS_32|OPTM_Near|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_RM|OPS_64|OPTM_Near|OPA_EA, 0, 0} }, - { CPU_Any, 0, 0, 64, 0, 1, {0xFF, 0, 0}, 2, 1, - {OPT_Mem|OPS_Any|OPTM_Near|OPA_EA, 0, 0} }, - - /* Far indirect (through memory). Needs explicit FAR override. */ - { CPU_Any, 0, 16, 0, 0, 1, {0xFF, 0, 0}, 3, 1, - {OPT_Mem|OPS_16|OPTM_Far|OPA_EA, 0, 0} }, - { CPU_386, 0, 32, 0, 0, 1, {0xFF, 0, 0}, 3, 1, - {OPT_Mem|OPS_32|OPTM_Far|OPA_EA, 0, 0} }, - { CPU_EM64T|CPU_64, 0, 64, 0, 0, 1, {0xFF, 0, 0}, 3, 1, - {OPT_Mem|OPS_64|OPTM_Far|OPA_EA, 0, 0} }, - { CPU_Any, 0, 0, 0, 0, 1, {0xFF, 0, 0}, 3, 1, - {OPT_Mem|OPS_Any|OPTM_Far|OPA_EA, 0, 0} }, - - /* With explicit FAR override */ - { CPU_Not64, 0, 16, 0, 0, 1, {0x9A, 0, 0}, 3, 1, - {OPT_Imm|OPS_16|OPTM_Far|OPA_JmpFar, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0x9A, 0, 0}, 3, 1, - {OPT_Imm|OPS_32|OPTM_Far|OPA_JmpFar, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x9A, 0, 0}, 3, 1, - {OPT_Imm|OPS_Any|OPTM_Far|OPA_JmpFar, 0, 0} }, - - /* Since not caught by first ImmNotSegOff group, implicitly FAR. */ - { CPU_Not64, 0, 16, 0, 0, 1, {0x9A, 0, 0}, 3, 1, - {OPT_Imm|OPS_16|OPA_JmpFar, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0x9A, 0, 0}, 3, 1, - {OPT_Imm|OPS_32|OPA_JmpFar, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0x9A, 0, 0}, 3, 1, - {OPT_Imm|OPS_Any|OPA_JmpFar, 0, 0} } -}; -static const x86_insn_info jmp_insn[] = { - { CPU_Any, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_Any|OPA_JmpRel, 0, 0} }, - { CPU_Any, 0, 16, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_16|OPA_JmpRel, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_32|OPA_JmpRel, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 0, 0, 1, {0, 0, 0}, 0, 1, - {OPT_ImmNotSegOff|OPS_32|OPA_JmpRel, 0, 0} }, - - { CPU_Any, 0, 0, 64, 0, 1, {0xEB, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, 0, 0} }, - { CPU_Any, 0, 16, 64, 0, 1, {0xE9, 0, 0}, 0, 1, - {OPT_Imm|OPS_16|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xE9, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0xE9, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_Any, 0, 0, 64, 0, 1, {0xE9, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Near|OPA_JmpRel, 0, 0} }, - - { CPU_Any, 0, 16, 64, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_RM|OPS_16|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_RM|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_RM|OPS_64|OPA_EA, 0, 0} }, - { CPU_Any, 0, 0, 64, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_Mem|OPS_Any|OPA_EA, 0, 0} }, - { CPU_Any, 0, 16, 64, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_RM|OPS_16|OPTM_Near|OPA_EA, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_RM|OPS_32|OPTM_Near|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_RM|OPS_64|OPTM_Near|OPA_EA, 0, 0} }, - { CPU_Any, 0, 0, 64, 0, 1, {0xFF, 0, 0}, 4, 1, - {OPT_Mem|OPS_Any|OPTM_Near|OPA_EA, 0, 0} }, - - /* Far indirect (through memory). Needs explicit FAR override. */ - { CPU_Any, 0, 16, 0, 0, 1, {0xFF, 0, 0}, 5, 1, - {OPT_Mem|OPS_16|OPTM_Far|OPA_EA, 0, 0} }, - { CPU_386, 0, 32, 0, 0, 1, {0xFF, 0, 0}, 5, 1, - {OPT_Mem|OPS_32|OPTM_Far|OPA_EA, 0, 0} }, - { CPU_EM64T|CPU_64, 0, 64, 0, 0, 1, {0xFF, 0, 0}, 5, 1, - {OPT_Mem|OPS_64|OPTM_Far|OPA_EA, 0, 0} }, - { CPU_Any, 0, 0, 0, 0, 1, {0xFF, 0, 0}, 5, 1, - {OPT_Mem|OPS_Any|OPTM_Far|OPA_EA, 0, 0} }, - - /* With explicit FAR override */ - { CPU_Not64, 0, 16, 0, 0, 1, {0xEA, 0, 0}, 3, 1, - {OPT_Imm|OPS_16|OPTM_Far|OPA_JmpFar, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xEA, 0, 0}, 3, 1, - {OPT_Imm|OPS_32|OPTM_Far|OPA_JmpFar, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0xEA, 0, 0}, 3, 1, - {OPT_Imm|OPS_Any|OPTM_Far|OPA_JmpFar, 0, 0} }, - - /* Since not caught by first ImmNotSegOff group, implicitly FAR. */ - { CPU_Not64, 0, 16, 0, 0, 1, {0xEA, 0, 0}, 3, 1, - {OPT_Imm|OPS_16|OPA_JmpFar, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0xEA, 0, 0}, 3, 1, - {OPT_Imm|OPS_32|OPA_JmpFar, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 1, {0xEA, 0, 0}, 3, 1, - {OPT_Imm|OPS_Any|OPA_JmpFar, 0, 0} } -}; -static const x86_insn_info retnf_insn[] = { - { CPU_Not64, MOD_Op0Add, 0, 0, 0, 1, - {0x01, 0, 0}, 0, 0, {0, 0, 0} }, - { CPU_Not64, MOD_Op0Add, 0, 0, 0, 1, - {0x00, 0, 0}, 0, 1, {OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0, 0} }, - { CPU_64, MOD_Op0Add|MOD_OpSizeR, 0, 0, 0, 1, - {0x01, 0, 0}, 0, 0, {0, 0, 0} }, - { CPU_64, MOD_Op0Add|MOD_OpSizeR, 0, 0, 0, 1, - {0x00, 0, 0}, 0, 1, {OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0, 0} }, - /* GAS suffix versions */ - { CPU_Any, MOD_Op0Add|MOD_OpSizeR|MOD_GasSufW|MOD_GasSufL|MOD_GasSufQ, 0, - 0, 0, 1, {0x01, 0, 0}, 0, 0, {0, 0, 0} }, - { CPU_Any, MOD_Op0Add|MOD_OpSizeR|MOD_GasSufW|MOD_GasSufL|MOD_GasSufQ, 0, - 0, 0, 1, {0x00, 0, 0}, 0, 1, {OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm, 0, 0} } -}; -static const x86_insn_info enter_insn[] = { - { CPU_186|CPU_Not64, MOD_GasNoRev|MOD_GasSufL, 0, 0, 0, 1, {0xC8, 0, 0}, 0, - 2, {OPT_Imm|OPS_16|OPS_Relaxed|OPA_EA|OPAP_A16, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_GasNoRev|MOD_GasSufQ, 64, 64, 0, 1, {0xC8, 0, 0}, - 0, 2, {OPT_Imm|OPS_16|OPS_Relaxed|OPA_EA|OPAP_A16, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - /* GAS suffix version */ - { CPU_186, MOD_GasOnly|MOD_GasNoRev|MOD_GasSufW, 16, 0, 0, 1, - {0xC8, 0, 0}, 0, 2, {OPT_Imm|OPS_16|OPS_Relaxed|OPA_EA|OPAP_A16, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, -}; - -/* Conditional jumps */ -static const x86_insn_info jcc_insn[] = { - { CPU_Any, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPA_JmpRel, 0, 0} }, - { CPU_Any, 0, 16, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_Imm|OPS_16|OPA_JmpRel, 0, 0} }, - { CPU_386|CPU_Not64, 0, 32, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPA_JmpRel, 0, 0} }, - { CPU_Hammer|CPU_64, 0, 64, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_Imm|OPS_32|OPA_JmpRel, 0, 0} }, - - { CPU_Any, MOD_Op0Add, 0, 64, 0, 1, {0x70, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, 0, 0} }, - { CPU_386, MOD_Op1Add, 16, 64, 0, 2, {0x0F, 0x80, 0}, 0, 1, - {OPT_Imm|OPS_16|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_386|CPU_Not64, MOD_Op1Add, 32, 0, 0, 2, {0x0F, 0x80, 0}, 0, 1, - {OPT_Imm|OPS_32|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add, 64, 64, 0, 2, {0x0F, 0x80, 0}, 0, 1, - {OPT_Imm|OPS_32|OPTM_Near|OPA_JmpRel, 0, 0} }, - { CPU_386, MOD_Op1Add, 0, 64, 0, 2, {0x0F, 0x80, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Near|OPA_JmpRel, 0, 0} } -}; -static const x86_insn_info jcxz_insn[] = { - { CPU_Any, MOD_AdSizeR, 0, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPA_JmpRel, 0, 0} }, - { CPU_Any, MOD_AdSizeR, 0, 64, 0, 1, {0xE3, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, 0, 0} } -}; - -/* Loop instructions */ -static const x86_insn_info loop_insn[] = { - { CPU_Any, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPA_JmpRel, 0, 0} }, - { CPU_Not64, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 2, - {OPT_Imm|OPS_Any|OPA_JmpRel, OPT_Creg|OPS_16|OPA_AdSizeR, 0} }, - { CPU_386, 0, 0, 64, 0, 0, {0, 0, 0}, 0, 2, - {OPT_Imm|OPS_Any|OPA_JmpRel, OPT_Creg|OPS_32|OPA_AdSizeR, 0} }, - { CPU_Hammer|CPU_64, 0, 0, 64, 0, 0, {0, 0, 0}, 0, 2, - {OPT_Imm|OPS_Any|OPA_JmpRel, OPT_Creg|OPS_64|OPA_AdSizeR, 0} }, - - { CPU_Not64, MOD_Op0Add, 0, 0, 0, 1, {0xE0, 0, 0}, 0, 1, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, 0, 0} }, - { CPU_Any, MOD_Op0Add, 0, 64, 0, 1, {0xE0, 0, 0}, 0, 2, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, OPT_Creg|OPS_16|OPA_AdSizeR, 0} - }, - { CPU_386, MOD_Op0Add, 0, 64, 0, 1, {0xE0, 0, 0}, 0, 2, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, OPT_Creg|OPS_32|OPA_AdSizeR, 0} - }, - { CPU_Hammer|CPU_64, MOD_Op0Add, 0, 64, 0, 1, {0xE0, 0, 0}, 0, 2, - {OPT_Imm|OPS_Any|OPTM_Short|OPA_JmpRel, OPT_Creg|OPS_64|OPA_AdSizeR, 0} } -}; - -/* Set byte on flag instructions */ -static const x86_insn_info setcc_insn[] = { - { CPU_386, MOD_Op1Add|MOD_GasSufB, 0, 0, 0, 2, {0x0F, 0x90, 0}, 2, 1, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0, 0} } -}; - -/* Bit manipulation - bit tests */ -static const x86_insn_info bittest_insn[] = { - { CPU_386, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 2, {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} }, - { CPU_386, MOD_Gap0|MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0xBA, 0}, - 0, 2, {OPT_RM|OPS_16|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_386, MOD_Gap0|MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0xBA, 0}, - 0, 2, {OPT_RM|OPS_32|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_Hammer|CPU_64, MOD_Gap0|MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 2, - {0x0F, 0xBA, 0}, 0, 2, - {OPT_RM|OPS_64|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} } -}; - -/* Bit manipulation - bit scans - also used for lar/lsl */ -static const x86_insn_info bsfr_insn[] = { - { CPU_286, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 2, {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* Interrupts and operating system instructions */ -static const x86_insn_info int_insn[] = { - { CPU_Any, 0, 0, 0, 0, 1, {0xCD, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0, 0} } -}; -static const x86_insn_info bound_insn[] = { - { CPU_186, MOD_GasSufW, 16, 0, 0, 1, {0x62, 0, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386, MOD_GasSufL, 32, 0, 0, 1, {0x62, 0, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} } -}; - -/* Protection control */ -static const x86_insn_info arpl_insn[] = { - { CPU_286|CPU_Prot, MOD_GasSufW, 0, 0, 0, 1, {0x63, 0, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} } -}; -static const x86_insn_info str_insn[] = { - { CPU_286|CPU_Prot, MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x00, 0}, 1, 1, - {OPT_Reg|OPS_16|OPA_EA, 0, 0} }, - { CPU_386|CPU_Prot, MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x00, 0}, 1, 1, - {OPT_Reg|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64|CPU_Prot, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x00, 0}, 1, - 1, {OPT_Reg|OPS_64|OPA_EA, 0, 0} }, - { CPU_286|CPU_Prot, MOD_GasSufW|MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x00, 0}, - 1, 1, {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info prot286_insn[] = { - { CPU_286, MOD_Op1Add|MOD_SpAdd|MOD_GasSufW, 0, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 1, {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info sldtmsw_insn[] = { - { CPU_286, MOD_Op1Add|MOD_SpAdd|MOD_GasSufW, 0, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 1, {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} }, - { CPU_386, MOD_Op1Add|MOD_SpAdd|MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 1, {OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_SpAdd|MOD_GasSufQ, 0, 0, 0, 2, - {0x0F, 0x00, 0}, 0, 1, {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0, 0} }, - { CPU_286, MOD_Op1Add|MOD_SpAdd|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 1, {OPT_Reg|OPS_16|OPA_EA, 0, 0} }, - { CPU_386, MOD_Op1Add|MOD_SpAdd|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x00, 0}, - 0, 1, {OPT_Reg|OPS_32|OPA_EA, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_SpAdd|MOD_GasSufQ, 64, 0, 0, 2, - {0x0F, 0x00, 0}, 0, 1, {OPT_Reg|OPS_64|OPA_EA, 0, 0} } -}; - -/* Floating point instructions - load/store with pop (integer and normal) */ -static const x86_insn_info fld_insn[] = { - { CPU_FPU, MOD_GasSufS, 0, 0, 0, 1, {0xD9, 0, 0}, 0, 1, - {OPT_Mem|OPS_32|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_GasSufL, 0, 0, 0, 1, {0xDD, 0, 0}, 0, 1, - {OPT_Mem|OPS_64|OPA_EA, 0, 0} }, - { CPU_FPU, 0, 0, 0, 0, 1, {0xDB, 0, 0}, 5, 1, - {OPT_Mem|OPS_80|OPA_EA, 0, 0} }, - { CPU_FPU, 0, 0, 0, 0, 2, {0xD9, 0xC0, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} } -}; -static const x86_insn_info fstp_insn[] = { - { CPU_FPU, MOD_GasSufS, 0, 0, 0, 1, {0xD9, 0, 0}, 3, 1, - {OPT_Mem|OPS_32|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_GasSufL, 0, 0, 0, 1, {0xDD, 0, 0}, 3, 1, - {OPT_Mem|OPS_64|OPA_EA, 0, 0} }, - { CPU_FPU, 0, 0, 0, 0, 1, {0xDB, 0, 0}, 7, 1, - {OPT_Mem|OPS_80|OPA_EA, 0, 0} }, - { CPU_FPU, 0, 0, 0, 0, 2, {0xDD, 0xD8, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} } -}; -/* Long memory version of floating point load/store for GAS */ -static const x86_insn_info fldstpt_insn[] = { - { CPU_FPU, MOD_SpAdd, 0, 0, 0, 1, {0xDB, 0, 0}, 0, 1, - {OPT_Mem|OPS_80|OPA_EA, 0, 0} } -}; -static const x86_insn_info fildstp_insn[] = { - { CPU_FPU, MOD_SpAdd|MOD_GasSufS, 0, 0, 0, 1, {0xDF, 0, 0}, 0, 1, - {OPT_Mem|OPS_16|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_SpAdd|MOD_GasSufL, 0, 0, 0, 1, {0xDB, 0, 0}, 0, 1, - {OPT_Mem|OPS_32|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_Gap0|MOD_Op0Add|MOD_SpAdd|MOD_GasSufQ, 0, 0, 0, 1, - {0xDD, 0, 0}, 0, 1, {OPT_Mem|OPS_64|OPA_EA, 0, 0} } -}; -static const x86_insn_info fbldstp_insn[] = { - { CPU_FPU, MOD_SpAdd, 0, 0, 0, 1, {0xDF, 0, 0}, 0, 1, - {OPT_Mem|OPS_80|OPS_Relaxed|OPA_EA, 0, 0} } -}; -/* Floating point instructions - store (normal) */ -static const x86_insn_info fst_insn[] = { - { CPU_FPU, MOD_GasSufS, 0, 0, 0, 1, {0xD9, 0, 0}, 2, 1, - {OPT_Mem|OPS_32|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_GasSufL, 0, 0, 0, 1, {0xDD, 0, 0}, 2, 1, - {OPT_Mem|OPS_64|OPA_EA, 0, 0} }, - { CPU_FPU, 0, 0, 0, 0, 2, {0xDD, 0xD0, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} } -}; -/* Floating point instructions - exchange (with ST0) */ -static const x86_insn_info fxch_insn[] = { - { CPU_FPU, 0, 0, 0, 0, 2, {0xD9, 0xC8, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} }, - { CPU_FPU, 0, 0, 0, 0, 2, {0xD9, 0xC8, 0}, 0, 2, - {OPT_ST0|OPS_80|OPA_None, OPT_Reg|OPS_80|OPA_Op1Add, 0} }, - { CPU_FPU, 0, 0, 0, 0, 2, {0xD9, 0xC8, 0}, 0, 2, - {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} }, - { CPU_FPU, 0, 0, 0, 0, 2, {0xD9, 0xC9, 0}, 0, 0, {0, 0, 0} } -}; -/* Floating point instructions - comparisons */ -static const x86_insn_info fcom_insn[] = { - { CPU_FPU, MOD_Gap0|MOD_SpAdd|MOD_GasSufS, 0, 0, 0, 1, {0xD8, 0, 0}, 0, 1, - {OPT_Mem|OPS_32|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_Gap0|MOD_SpAdd|MOD_GasSufL, 0, 0, 0, 1, {0xDC, 0, 0}, 0, 1, - {OPT_Mem|OPS_64|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xD8, 0x00, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} }, - /* Alias for fcom %st(1) for GAS compat */ - { CPU_FPU, MOD_Op1Add|MOD_GasOnly, 0, 0, 0, 2, {0xD8, 0x01, 0}, 0, 0, - {0, 0, 0} }, - { CPU_FPU, MOD_Op1Add|MOD_GasIllegal, 0, 0, 0, 2, {0xD8, 0x00, 0}, 0, 2, - {OPT_ST0|OPS_80|OPA_None, OPT_Reg|OPS_80|OPA_Op1Add, 0} } -}; -/* Floating point instructions - extended comparisons */ -static const x86_insn_info fcom2_insn[] = { - { CPU_286|CPU_FPU, MOD_Op0Add|MOD_Op1Add, 0, 0, 0, 2, {0x00, 0x00, 0}, - 0, 1, {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} }, - { CPU_286|CPU_FPU, MOD_Op0Add|MOD_Op1Add, 0, 0, 0, 2, {0x00, 0x00, 0}, - 0, 2, {OPT_ST0|OPS_80|OPA_None, OPT_Reg|OPS_80|OPA_Op1Add, 0} } -}; -/* Floating point instructions - arithmetic */ -static const x86_insn_info farith_insn[] = { - { CPU_FPU, MOD_Gap0|MOD_Gap1|MOD_SpAdd|MOD_GasSufS, 0, 0, 0, 1, - {0xD8, 0, 0}, 0, 1, {OPT_Mem|OPS_32|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_Gap0|MOD_Gap1|MOD_SpAdd|MOD_GasSufL, 0, 0, 0, 1, - {0xDC, 0, 0}, 0, 1, {OPT_Mem|OPS_64|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_Gap0|MOD_Op1Add, 0, 0, 0, 2, {0xD8, 0x00, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} }, - { CPU_FPU, MOD_Gap0|MOD_Op1Add, 0, 0, 0, 2, {0xD8, 0x00, 0}, 0, 2, - {OPT_ST0|OPS_80|OPA_None, OPT_Reg|OPS_80|OPA_Op1Add, 0} }, - { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDC, 0x00, 0}, 0, 1, - {OPT_Reg|OPS_80|OPTM_To|OPA_Op1Add, 0, 0} }, - { CPU_FPU, MOD_Op1Add|MOD_GasIllegal, 0, 0, 0, 2, {0xDC, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} }, - { CPU_FPU, MOD_Gap0|MOD_Op1Add|MOD_GasOnly, 0, 0, 0, 2, {0xDC, 0x00, 0}, - 0, 2, {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} } -}; -static const x86_insn_info farithp_insn[] = { - { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDE, 0x01, 0}, 0, 0, {0, 0, 0} }, - { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDE, 0x00, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} }, - { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDE, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} } -}; -/* Floating point instructions - integer arith/store wo pop/compare */ -static const x86_insn_info fiarith_insn[] = { - { CPU_FPU, MOD_Op0Add|MOD_SpAdd|MOD_GasSufS, 0, 0, 0, 1, {0x04, 0, 0}, 0, - 1, {OPT_Mem|OPS_16|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_Op0Add|MOD_SpAdd|MOD_GasSufL, 0, 0, 0, 1, {0x00, 0, 0}, 0, - 1, {OPT_Mem|OPS_32|OPA_EA, 0, 0} } -}; -/* Floating point instructions - processor control */ -static const x86_insn_info fldnstcw_insn[] = { - { CPU_FPU, MOD_SpAdd|MOD_GasSufW, 0, 0, 0, 1, {0xD9, 0, 0}, 0, 1, - {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info fstcw_insn[] = { - { CPU_FPU, MOD_GasSufW, 0, 0, 0, 2, {0x9B, 0xD9, 0}, 7, 1, - {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info fnstsw_insn[] = { - { CPU_FPU, MOD_GasSufW, 0, 0, 0, 1, {0xDD, 0, 0}, 7, 1, - {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_GasSufW, 0, 0, 0, 2, {0xDF, 0xE0, 0}, 0, 1, - {OPT_Areg|OPS_16|OPA_None, 0, 0} } -}; -static const x86_insn_info fstsw_insn[] = { - { CPU_FPU, MOD_GasSufW, 0, 0, 0, 2, {0x9B, 0xDD, 0}, 7, 1, - {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0, 0} }, - { CPU_FPU, MOD_GasSufW, 0, 0, 0, 3, {0x9B, 0xDF, 0xE0}, 0, 1, - {OPT_Areg|OPS_16|OPA_None, 0, 0} } -}; -static const x86_insn_info ffree_insn[] = { - { CPU_FPU, MOD_Op0Add, 0, 0, 0, 2, {0x00, 0xC0, 0}, 0, 1, - {OPT_Reg|OPS_80|OPA_Op1Add, 0, 0} } -}; - -/* 486 extensions */ -static const x86_insn_info bswap_insn[] = { - { CPU_486, MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0xC8, 0}, 0, 1, - {OPT_Reg|OPS_32|OPA_Op1Add, 0, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0xC8, 0}, 0, 1, - {OPT_Reg|OPS_64|OPA_Op1Add, 0, 0} } -}; -static const x86_insn_info cmpxchgxadd_insn[] = { - { CPU_486, MOD_Op1Add|MOD_GasSufB, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_8|OPA_Spare, 0} }, - { CPU_486, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x01, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_486, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x01, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x01, 0}, - 0, 2, {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} } -}; - -/* Pentium extensions */ -static const x86_insn_info cmpxchg8b_insn[] = { - { CPU_586, MOD_GasSufQ, 0, 0, 0, 2, {0x0F, 0xC7, 0}, 1, 1, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0, 0} } -}; - -/* Pentium II/Pentium Pro extensions */ -static const x86_insn_info cmovcc_insn[] = { - { CPU_686, MOD_Op1Add|MOD_GasSufW, 16, 0, 0, 2, {0x0F, 0x40, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_686, MOD_Op1Add|MOD_GasSufL, 32, 0, 0, 2, {0x0F, 0x40, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_Op1Add|MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x40, 0}, - 0, 2, {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; -static const x86_insn_info fcmovcc_insn[] = { - { CPU_686|CPU_FPU, MOD_Op0Add|MOD_Op1Add, 0, 0, 0, 2, {0x00, 0x00, 0}, - 0, 2, {OPT_ST0|OPS_80|OPA_None, OPT_Reg|OPS_80|OPA_Op1Add, 0} } -}; - -/* Pentium4 extensions */ -static const x86_insn_info movnti_insn[] = { - { CPU_P4, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0xC3, 0}, 0, 2, - {OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0xC3, 0}, 0, 2, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_64|OPA_Spare, 0} } -}; -static const x86_insn_info clflush_insn[] = { - { CPU_P3, 0, 0, 0, 0, 2, {0x0F, 0xAE, 0}, 7, 1, - {OPT_Mem|OPS_8|OPS_Relaxed|OPA_EA, 0, 0} } -}; - -/* MMX/SSE2 instructions */ -static const x86_insn_info movd_insn[] = { - { CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_MMX|CPU_Hammer|CPU_64, 0, 64, 0, 0, 2, {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} }, - { CPU_MMX|CPU_Hammer|CPU_64, 0, 64, 0, 0, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} }, - { CPU_SSE2, 0, 0, 0, 0x66, 2, {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE2|CPU_Hammer|CPU_64, 0, 64, 0, 0x66, 2, {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE2, 0, 0, 0, 0x66, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} }, - { CPU_SSE2|CPU_Hammer|CPU_64, 0, 64, 0, 0x66, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info movq_insn[] = { - { CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0x6F, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_MMX|CPU_Hammer|CPU_64, 0, 64, 0, 0, 2, {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0x7F, 0}, 0, 2, - {OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} - }, - { CPU_MMX|CPU_Hammer|CPU_64, 0, 64, 0, 0, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} }, - { CPU_SSE2, 0, 0, 0, 0xF3, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} }, - { CPU_SSE2, 0, 0, 0, 0xF3, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE2|CPU_Hammer|CPU_64, 0, 64, 0, 0x66, 2, {0x0F, 0x6E, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE2, 0, 0, 0, 0x66, 2, {0x0F, 0xD6, 0}, 0, 2, - {OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} - }, - { CPU_SSE2|CPU_Hammer|CPU_64, 0, 64, 0, 0x66, 2, {0x0F, 0x7E, 0}, 0, 2, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info mmxsse2_insn[] = { - { CPU_MMX, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} +static int +x86_expr_contains_simd_cb(const yasm_expr__item *ei, void *d) +{ + int ymm = *((int *)d); + if (ei->type != YASM_EXPR_REG) + return 0; + switch ((x86_expritem_reg_size)(ei->data.reg & ~0xFUL)) { + case X86_XMMREG: + if (!ymm) + return 1; + break; + case X86_YMMREG: + if (ymm) + return 1; + break; + default: + break; } -}; -static const x86_insn_info pshift_insn[] = { - { CPU_MMX, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_MMX, MOD_Gap0|MOD_Op1Add|MOD_SpAdd, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, - 2, {OPT_SIMDReg|OPS_64|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} }, - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE2, MOD_Gap0|MOD_Op1Add|MOD_SpAdd, 0, 0, 0x66, 2, {0x0F, 0x00, 0}, - 0, 2, - {OPT_SIMDReg|OPS_128|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} } -}; - -/* PIII (Katmai) new instructions / SIMD instructiosn */ -static const x86_insn_info sseps_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_xmm_xmm64_ss_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_xmm_xmm64_ps_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_xmm_xmm32_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_rx_xmm64_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add|MOD_GasSufL, 0, 0, 0x00, 2, - {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE, MOD_PreAdd|MOD_Op1Add|MOD_GasSufL, 0, 0, 0x00, 2, - {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - /* REX */ - { CPU_SSE|CPU_Hammer|CPU_64, MOD_PreAdd|MOD_Op1Add|MOD_GasSufQ, 64, 0, - 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE|CPU_Hammer|CPU_64, MOD_PreAdd|MOD_Op1Add|MOD_GasSufQ, 64, 0, - 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_rx_xmm32_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add|MOD_GasSufL, 0, 0, 0x00, 2, - {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE, MOD_PreAdd|MOD_Op1Add|MOD_GasSufL, 0, 0, 0x00, 2, - {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} - }, - /* REX */ - { CPU_SSE|CPU_Hammer|CPU_64, MOD_PreAdd|MOD_Op1Add|MOD_GasSufQ, 64, 0, - 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE|CPU_Hammer|CPU_64, MOD_PreAdd|MOD_Op1Add|MOD_GasSufQ, 64, 0, - 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_mm_xmm64_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} - }, - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_mm_xmm_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_xmm_mm_ss_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_xmm_mm_ps_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info cvt_xmm_rmx_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add|MOD_GasSufL, 0, 0, 0x00, 2, - {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} - }, - /* REX */ - { CPU_Hammer|CPU_64, MOD_PreAdd|MOD_Op1Add|MOD_GasSufQ, 64, 0, 0x00, 2, - {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info ssess_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info ssecmpps_insn[] = { - { CPU_SSE, MOD_Imm8, 0, 0, 0, 2, {0x0F, 0xC2, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info ssecmpss_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Imm8, 0, 0, 0x00, 2, {0x0F, 0xC2, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; -static const x86_insn_info ssepsimm_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; -static const x86_insn_info ssessimm_insn[] = { - { CPU_SSE, MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; -static const x86_insn_info ldstmxcsr_insn[] = { - { CPU_SSE, MOD_SpAdd, 0, 0, 0, 2, {0x0F, 0xAE, 0}, 0, 1, - {OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info maskmovq_insn[] = { - { CPU_P3|CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0xF7, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_64|OPA_EA, 0} } -}; -static const x86_insn_info movaups_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x01, 0}, 0, 2, - {OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} - } -}; -static const x86_insn_info movhllhps_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; -static const x86_insn_info movhlps_insn[] = { - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x01, 0}, 0, 2, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info movmskps_insn[] = { - { CPU_SSE, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0x50, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0x50, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; -static const x86_insn_info movntps_insn[] = { - { CPU_SSE, 0, 0, 0, 0, 2, {0x0F, 0x2B, 0}, 0, 2, - {OPT_Mem|OPS_128|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info movntq_insn[] = { - { CPU_SSE, 0, 0, 0, 0, 2, {0x0F, 0xE7, 0}, 0, 2, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_64|OPA_Spare, 0} } -}; -static const x86_insn_info movss_insn[] = { - { CPU_SSE, 0, 0, 0, 0xF3, 2, {0x0F, 0x10, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} }, - { CPU_SSE, 0, 0, 0, 0xF3, 2, {0x0F, 0x10, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE, 0, 0, 0, 0xF3, 2, {0x0F, 0x11, 0}, 0, 2, - {OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info pextrw_insn[] = { - { CPU_P3|CPU_MMX, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0xC5, 0}, 0, 3, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_64|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE2, MOD_GasSufL, 0, 0, 0x66, 2, {0x0F, 0xC5, 0}, 0, 3, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE2|CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0xC5, 0}, - 0, 3, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_64|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE2|CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0x66, 2, {0x0F, 0xC5, 0}, - 0, 3, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - /* SSE4.1 instructions */ - { CPU_SSE41, 0, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x15}, 0, 3, - {OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41, 0, 32, 0, 0x66, 3, {0x0F, 0x3A, 0x15}, 0, 3, - {OPT_Reg|OPS_32|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41|CPU_64, 0, 64, 0, 0x66, 3, {0x0F, 0x3A, 0x15}, 0, 3, - {OPT_Reg|OPS_64|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; -static const x86_insn_info pinsrw_insn[] = { - { CPU_P3|CPU_MMX, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0xC4, 0}, 0, 3, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0xC4, 0}, 0, 3, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_Reg|OPS_64|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_P3|CPU_MMX, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0xC4, 0}, 0, 3, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE2, MOD_GasSufL, 0, 0, 0x66, 2, {0x0F, 0xC4, 0}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0x66, 2, {0x0F, 0xC4, 0}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Reg|OPS_64|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE2, MOD_GasSufL, 0, 0, 0x66, 2, {0x0F, 0xC4, 0}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; -static const x86_insn_info pmovmskb_insn[] = { - { CPU_P3|CPU_MMX, MOD_GasSufL, 0, 0, 0, 2, {0x0F, 0xD7, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_64|OPA_EA, 0} }, - { CPU_SSE2, MOD_GasSufL, 0, 0, 0x66, 2, {0x0F, 0xD7, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0, 2, {0x0F, 0xD7, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_64|OPA_EA, 0} }, - { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 0, 0x66, 2, {0x0F, 0xD7, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; -static const x86_insn_info pshufw_insn[] = { - { CPU_P3|CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0x70, 0}, 0, 3, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -/* SSE2 instructions */ -static const x86_insn_info cmpsd_insn[] = { - { CPU_Any, MOD_GasIllegal, 32, 0, 0, 1, {0xA7, 0, 0}, 0, 0, {0, 0, 0} }, - { CPU_SSE2, 0, 0, 0, 0xF2, 2, {0x0F, 0xC2, 0}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; -static const x86_insn_info movaupd_insn[] = { - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x01, 0}, 0, 2, - {OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} - } -}; -static const x86_insn_info movhlpd_insn[] = { - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x01, 0}, 0, 2, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info movmskpd_insn[] = { - { CPU_SSE2, MOD_GasSufL, 0, 0, 0x66, 2, {0x0F, 0x50, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; -static const x86_insn_info movntpddq_insn[] = { - { CPU_SSE2, MOD_Op1Add, 0, 0, 0x66, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_Mem|OPS_128|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info movsd_insn[] = { - { CPU_Any, MOD_GasIllegal, 32, 0, 0, 1, {0xA5, 0, 0}, 0, 0, {0, 0, 0} }, - { CPU_SSE2, 0, 0, 0, 0xF2, 2, {0x0F, 0x10, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} }, - { CPU_SSE2, 0, 0, 0, 0xF2, 2, {0x0F, 0x10, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE2, 0, 0, 0, 0xF2, 2, {0x0F, 0x11, 0}, 0, 2, - {OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} } -}; -static const x86_insn_info maskmovdqu_insn[] = { - { CPU_SSE2, 0, 0, 0, 0x66, 2, {0x0F, 0xF7, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; -static const x86_insn_info movdqau_insn[] = { - { CPU_SSE2, MOD_PreAdd, 0, 0, 0x00, 2, {0x0F, 0x6F, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE2, MOD_PreAdd, 0, 0, 0x00, 2, {0x0F, 0x7F, 0}, 0, 2, - {OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, 0} - } -}; -static const x86_insn_info movdq2q_insn[] = { - { CPU_SSE2, 0, 0, 0, 0xF2, 2, {0x0F, 0xD6, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; -static const x86_insn_info movq2dq_insn[] = { - { CPU_SSE2, 0, 0, 0, 0xF3, 2, {0x0F, 0xD6, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_64|OPA_EA, 0} } -}; -static const x86_insn_info pslrldq_insn[] = { - { CPU_SSE2, MOD_SpAdd, 0, 0, 0x66, 2, {0x0F, 0x73, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm, 0} } -}; - -/* SSE3 instructions */ -static const x86_insn_info lddqu_insn[] = { - { CPU_SSE3, 0, 0, 0, 0xF2, 2, {0x0F, 0xF0, 0}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_Any|OPA_EA, 0} } -}; - -/* SSSE3 instructions */ -static const x86_insn_info ssse3_insn[] = { - { CPU_SSSE3, MOD_Op2Add, 0, 0, 0, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSSE3, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; - -static const x86_insn_info ssse3imm_insn[] = { - { CPU_SSSE3, MOD_Op2Add, 0, 0, 0, 3, {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} - }, - { CPU_SSSE3, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} - } -}; - -/* SSE4 instructions */ - -static const x86_insn_info sse4_insn[] = { - { CPU_Any, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - } -}; - -static const x86_insn_info sse4imm_insn[] = { - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info sse4xmm0_insn[] = { - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, 0} - }, - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_XMM0|OPS_128|OPA_None} - } -}; - -static const x86_insn_info crc32_insn[] = { - { CPU_SSE42, MOD_GasSufB, 0, 0, 0xF2, 3, {0x0F, 0x38, 0xF0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_8|OPA_EA, 0} }, - { CPU_SSE42, MOD_GasSufW, 16, 0, 0xF2, 3, {0x0F, 0x38, 0xF1}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_16|OPA_EA, 0} }, - { CPU_SSE42, MOD_GasSufL, 32, 0, 0xF2, 3, {0x0F, 0x38, 0xF1}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE42|CPU_64, MOD_GasSufB, 64, 0, 0xF2, 3, {0x0F, 0x38, 0xF0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_8|OPA_EA, 0} }, - { CPU_SSE42|CPU_64, MOD_GasSufQ, 64, 0, 0xF2, 3, {0x0F, 0x38, 0xF1}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -static const x86_insn_info extractps_insn[] = { - { CPU_SSE41, 0, 32, 0, 0x66, 3, {0x0F, 0x3A, 0x17}, 0, 3, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41|CPU_64, 0, 64, 0, 0x66, 3, {0x0F, 0x3A, 0x17}, 0, 3, - {OPT_Reg|OPS_64|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info insertps_insn[] = { - { CPU_SSE41, 0, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x21}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41, 0, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x21}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info movntdqa_insn[] = { - { CPU_SSE41, 0, 0, 0, 0x66, 3, {0x0F, 0x38, 0x2A}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_128|OPS_Relaxed|OPA_EA, 0} } -}; - -static const x86_insn_info sse4pcmpstr_insn[] = { - { CPU_SSE42, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE42, MOD_Op2Add|MOD_GasOnly|MOD_GasSufW, 16, 0, 0x66, 3, - {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} - }, - { CPU_SSE42, MOD_Op2Add|MOD_GasOnly|MOD_GasSufL, 32, 0, 0x66, 3, - {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} - }, - { CPU_SSE42, MOD_Op2Add|MOD_GasOnly|MOD_GasSufQ, 64, 0, 0x66, 3, - {0x0F, 0x3A, 0x00}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDRM|OPS_128|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} - } -}; - -static const x86_insn_info pextrb_insn[] = { - { CPU_SSE41, 0, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x14}, 0, 3, - {OPT_Mem|OPS_8|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41, 0, 32, 0, 0x66, 3, {0x0F, 0x3A, 0x14}, 0, 3, - {OPT_Reg|OPS_32|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41|CPU_64, 0, 64, 0, 0x66, 3, {0x0F, 0x3A, 0x14}, 0, 3, - {OPT_Reg|OPS_64|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info pextrd_insn[] = { - { CPU_SSE41, 0, 32, 0, 0x66, 3, {0x0F, 0x3A, 0x16}, 0, 3, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info pextrq_insn[] = { - { CPU_SSE41|CPU_64, 0, 64, 0, 0x66, 3, {0x0F, 0x3A, 0x16}, 0, 3, - {OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, OPT_SIMDReg|OPS_128|OPA_Spare, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info pinsrb_insn[] = { - { CPU_SSE41, 0, 0, 0, 0x66, 3, {0x0F, 0x3A, 0x20}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_8|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} }, - { CPU_SSE41, 0, 32, 0, 0x66, 3, {0x0F, 0x3A, 0x20}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Reg|OPS_32|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info pinsrd_insn[] = { - { CPU_SSE41, 0, 32, 0, 0x66, 3, {0x0F, 0x3A, 0x22}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info pinsrq_insn[] = { - { CPU_SSE41|CPU_64, 0, 64, 0, 0x66, 3, {0x0F, 0x3A, 0x22}, 0, 3, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, - OPT_Imm|OPS_8|OPS_Relaxed|OPA_Imm} } -}; - -static const x86_insn_info sse4m64_insn[] = { - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; - -static const x86_insn_info sse4m32_insn[] = { - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; - -static const x86_insn_info sse4m16_insn[] = { - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE41, MOD_Op2Add, 0, 0, 0x66, 3, {0x0F, 0x38, 0x00}, 0, 2, - {OPT_SIMDReg|OPS_128|OPA_Spare, OPT_SIMDReg|OPS_128|OPA_EA, 0} } -}; - -static const x86_insn_info popcnt_insn[] = { - { CPU_SSE42, MOD_GasSufW, 16, 0, 0xF3, 2, {0x0F, 0xB8, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE42, MOD_GasSufL, 32, 0, 0xF3, 2, {0x0F, 0xB8, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} }, - { CPU_SSE42|CPU_64, MOD_GasSufQ, 64, 0, 0xF3, 2, {0x0F, 0xB8, 0}, 0, 2, - {OPT_Reg|OPS_64|OPA_Spare, OPT_RM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* AMD 3DNow! instructions */ -static const x86_insn_info now3d_insn[] = { - { CPU_3DNow, MOD_Imm8, 0, 0, 0, 2, {0x0F, 0x0F, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* AMD x86-64 extensions */ -static const x86_insn_info cmpxchg16b_insn[] = { - { CPU_64|CPU_Hammer, 0, 64, 0, 0, 2, {0x0F, 0xC7, 0}, 1, 1, - {OPT_Mem|OPS_128|OPS_Relaxed|OPA_EA, 0, 0} } -}; - -/* AMD Pacifica (SVM) instructions */ -static const x86_insn_info invlpga_insn[] = { - { CPU_SVM, 0, 0, 0, 0, 3, {0x0F, 0x01, 0xDF}, 0, 0, {0, 0, 0} }, - { CPU_SVM, 0, 0, 0, 0, 3, {0x0F, 0x01, 0xDF}, 0, 2, - {OPT_MemrAX|OPS_Any|OPA_AdSizeEA, OPT_Creg|OPS_32|OPA_None, 0} } -}; -static const x86_insn_info skinit_insn[] = { - { CPU_SVM, 0, 0, 0, 0, 3, {0x0F, 0x01, 0xDE}, 0, 0, {0, 0, 0} }, - { CPU_SVM, 0, 0, 0, 0, 3, {0x0F, 0x01, 0xDE}, 0, 1, - {OPT_MemEAX|OPS_Any|OPA_None, 0, 0} } -}; -static const x86_insn_info svm_rax_insn[] = { - { CPU_SVM, MOD_Op2Add, 0, 0, 0, 3, {0x0F, 0x01, 0x00}, 0, 0, {0, 0, 0} }, - { CPU_SVM, MOD_Op2Add, 0, 0, 0, 3, {0x0F, 0x01, 0x00}, 0, 1, - {OPT_MemrAX|OPS_Any|OPA_AdSizeEA, 0, 0} } -}; -/* VIA PadLock instructions */ -static const x86_insn_info padlock_insn[] = { - { CPU_Any, MOD_Imm8|MOD_PreAdd|MOD_Op1Add, 0, 0, 0x00, 2, {0x0F, 0x00, 0}, - 0, 0, {0, 0, 0} } -}; - -/* Cyrix MMX instructions */ -static const x86_insn_info cyrixmmx_insn[] = { - { CPU_Cyrix|CPU_MMX, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_SIMDRM|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; -static const x86_insn_info pmachriw_insn[] = { - { CPU_Cyrix|CPU_MMX, 0, 0, 0, 0, 2, {0x0F, 0x5E, 0}, 0, 2, - {OPT_SIMDReg|OPS_64|OPA_Spare, OPT_Mem|OPS_64|OPS_Relaxed|OPA_EA, 0} } -}; - -/* Cyrix extensions */ -static const x86_insn_info rdwrshr_insn[] = { - { CPU_486|CPU_Cyrix|CPU_SMM, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x36, 0}, 0, 1, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} } -}; -static const x86_insn_info rsdc_insn[] = { - { CPU_486|CPU_Cyrix|CPU_SMM, 0, 0, 0, 0, 2, {0x0F, 0x79, 0}, 0, 2, - {OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, - OPT_Mem|OPS_80|OPS_Relaxed|OPA_EA, 0} } -}; -static const x86_insn_info cyrixsmm_insn[] = { - { CPU_486|CPU_Cyrix|CPU_SMM, MOD_Op1Add, 0, 0, 0, 2, {0x0F, 0x00, 0}, 0, 1, - {OPT_Mem|OPS_80|OPS_Relaxed|OPA_EA, 0, 0} } -}; -static const x86_insn_info svdc_insn[] = { - { CPU_486|CPU_Cyrix|CPU_SMM, 0, 0, 0, 0, 2, {0x0F, 0x78, 0}, 0, 2, - {OPT_Mem|OPS_80|OPS_Relaxed|OPA_EA, - OPT_SegReg|OPS_16|OPS_Relaxed|OPA_Spare, 0} } -}; - -/* Obsolete/undocumented instructions */ -static const x86_insn_info ibts_insn[] = { - { CPU_386|CPU_Undoc|CPU_Obs, 0, 16, 0, 0, 2, {0x0F, 0xA7, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386|CPU_Undoc|CPU_Obs, 0, 32, 0, 0, 2, {0x0F, 0xA7, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} } -}; -static const x86_insn_info umov_insn[] = { - { CPU_386|CPU_Undoc, 0, 0, 0, 0, 2, {0x0F, 0x10, 0}, 0, 2, - {OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_8|OPA_Spare, 0} }, - { CPU_386|CPU_Undoc, 0, 16, 0, 0, 2, {0x0F, 0x11, 0}, 0, 2, - {OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_16|OPA_Spare, 0} }, - { CPU_386|CPU_Undoc, 0, 32, 0, 0, 2, {0x0F, 0x11, 0}, 0, 2, - {OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, OPT_Reg|OPS_32|OPA_Spare, 0} }, - { CPU_386|CPU_Undoc, 0, 0, 0, 0, 2, {0x0F, 0x12, 0}, 0, 2, - {OPT_Reg|OPS_8|OPA_Spare, OPT_RM|OPS_8|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386|CPU_Undoc, 0, 16, 0, 0, 2, {0x0F, 0x13, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_RM|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386|CPU_Undoc, 0, 32, 0, 0, 2, {0x0F, 0x13, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_RM|OPS_32|OPS_Relaxed|OPA_EA, 0} } -}; -static const x86_insn_info xbts_insn[] = { - { CPU_386|CPU_Undoc|CPU_Obs, 0, 16, 0, 0, 2, {0x0F, 0xA6, 0}, 0, 2, - {OPT_Reg|OPS_16|OPA_Spare, OPT_Mem|OPS_16|OPS_Relaxed|OPA_EA, 0} }, - { CPU_386|CPU_Undoc|CPU_Obs, 0, 32, 0, 0, 2, {0x0F, 0xA6, 0}, 0, 2, - {OPT_Reg|OPS_32|OPA_Spare, OPT_Mem|OPS_32|OPS_Relaxed|OPA_EA, 0} } -}; + return 0; +} +static int +x86_expr_contains_simd(const yasm_expr *e, int ymm) +{ + return yasm_expr__traverse_leaves_in_const(e, &ymm, + x86_expr_contains_simd_cb); +} static void x86_finalize_common(x86_common *common, const x86_insn_info *info, - uintptr_t mode_bits) + unsigned int mode_bits) { common->addrsize = 0; common->opersize = info->opersize; common->lockrep_pre = 0; + common->acqrel_pre = 0; common->mode_bits = (unsigned char)mode_bits; } @@ -2292,29 +402,37 @@ x86_finalize_opcode(x86_opcode *opcode, const x86_insn_info *info) opcode->opcode[2] = info->opcode[2]; } +/* Clear operands so they don't get destroyed after we've copied references. */ static void -x86_finalize_jmpfar(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, - const uintptr_t data[4], int num_operands, - yasm_insn_operands *operands, int num_prefixes, - uintptr_t **prefixes, const x86_insn_info *info) +x86_id_insn_clear_operands(x86_id_insn *id_insn) { + yasm_insn_operand *op = yasm_insn_ops_first(&id_insn->insn); + while (op) { + op->type = YASM_INSN__OPERAND_REG; + op = yasm_insn_op_next(op); + } +} + +static void +x86_finalize_jmpfar(yasm_bytecode *bc, yasm_bytecode *prev_bc, + const x86_insn_info *info) +{ + x86_id_insn *id_insn = (x86_id_insn *)bc->contents; + unsigned char *mod_data = id_insn->mod_data; + unsigned int mode_bits = id_insn->mode_bits; x86_jmpfar *jmpfar; yasm_insn_operand *op; - /*@only@*/ yasm_expr *segment; + unsigned int i; jmpfar = yasm_xmalloc(sizeof(x86_jmpfar)); - x86_finalize_common(&jmpfar->common, info, data[3]); + x86_finalize_common(&jmpfar->common, info, mode_bits); x86_finalize_opcode(&jmpfar->opcode, info); - op = yasm_ops_first(operands); + op = yasm_insn_ops_first(&id_insn->insn); - if (op->type == YASM_INSN__OPERAND_IMM && - yasm_expr_is_op(op->data.val, YASM_EXPR_SEGOFF)) { - /* SEG:OFF expression; split it. */ - segment = yasm_expr_extract_segoff(&op->data.val); - if (!segment) - yasm_internal_error(N_("didn't get SEG:OFF expression in jmpfar")); - if (yasm_value_finalize_expr(&jmpfar->segment, segment, prev_bc, 16)) + if (op->type == YASM_INSN__OPERAND_IMM && op->seg) { + /* SEG:OFF */ + if (yasm_value_finalize_expr(&jmpfar->segment, op->seg, prev_bc, 16)) yasm_error_set(YASM_ERROR_TOO_COMPLEX, N_("jump target segment too complex")); if (yasm_value_finalize_expr(&jmpfar->offset, op->data.val, prev_bc, @@ -2323,41 +441,83 @@ x86_finalize_jmpfar(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, N_("jump target offset too complex")); } else if (op->targetmod == X86_FAR) { /* "FAR imm" target needs to become "seg imm:imm". */ - if (yasm_value_finalize_expr(&jmpfar->offset, - yasm_expr_copy(op->data.val), prev_bc, 0) - || yasm_value_finalize_expr(&jmpfar->segment, op->data.val, - prev_bc, 16)) + yasm_expr *e = yasm_expr_create_branch(YASM_EXPR_SEG, + yasm_expr_copy(op->data.val), + op->data.val->line); + if (yasm_value_finalize_expr(&jmpfar->offset, op->data.val, prev_bc, 0) + || yasm_value_finalize_expr(&jmpfar->segment, e, prev_bc, 16)) yasm_error_set(YASM_ERROR_TOO_COMPLEX, N_("jump target expression too complex")); - jmpfar->segment.seg_of = 1; + } else if (yasm_insn_op_next(op)) { + /* Two operand form (gas) */ + yasm_insn_operand *op2 = yasm_insn_op_next(op); + if (yasm_value_finalize_expr(&jmpfar->segment, op->data.val, prev_bc, + 16)) + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("jump target segment too complex")); + if (yasm_value_finalize_expr(&jmpfar->offset, op2->data.val, prev_bc, + 0)) + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("jump target offset too complex")); + if (op2->size == OPS_BITS) + jmpfar->common.opersize = (unsigned char)mode_bits; } else yasm_internal_error(N_("didn't get FAR expression in jmpfar")); + /* Apply modifiers */ + for (i=0; imodifiers); i++) { + switch (info->modifiers[i]) { + case MOD_Gap: + break; + case MOD_Op0Add: + jmpfar->opcode.opcode[0] += mod_data[i]; + break; + case MOD_Op1Add: + jmpfar->opcode.opcode[1] += mod_data[i]; + break; + case MOD_Op2Add: + jmpfar->opcode.opcode[2] += mod_data[i]; + break; + case MOD_Op3Add: + jmpfar->opcode.opcode[3] += mod_data[i]; + break; + case MOD_Op1AddSp: + jmpfar->opcode.opcode[1] += mod_data[i]<<3; + break; + default: + break; + } + } + yasm_x86__bc_apply_prefixes((x86_common *)jmpfar, NULL, - info->def_opersize_64, num_prefixes, - prefixes); + info->def_opersize_64, + id_insn->insn.num_prefixes, + id_insn->insn.prefixes); + + x86_id_insn_clear_operands(id_insn); /* Transform the bytecode */ yasm_x86__bc_transform_jmpfar(bc, jmpfar); } static void -x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, - const uintptr_t data[4], int num_operands, - yasm_insn_operands *operands, int num_prefixes, - uintptr_t **prefixes, const x86_insn_info *jinfo) +x86_finalize_jmp(yasm_bytecode *bc, yasm_bytecode *prev_bc, + const x86_insn_info *jinfo) { + x86_id_insn *id_insn = (x86_id_insn *)bc->contents; x86_jmp *jmp; - int num_info = (int)(data[1]&0xFF); - x86_insn_info *info = (x86_insn_info *)data[0]; - unsigned long mod_data = (unsigned long)(data[1] >> 8); - unsigned int mode_bits = (unsigned int)(data[3] & 0xFF); - /*unsigned char suffix = (unsigned char)((data[3]>>8) & 0xFF);*/ + int num_info = id_insn->num_info; + const x86_insn_info *info = id_insn->group; + unsigned char *mod_data = id_insn->mod_data; + unsigned int mode_bits = id_insn->mode_bits; + /*unsigned char suffix = id_insn->suffix;*/ yasm_insn_operand *op; - static const unsigned char size_lookup[] = {0, 8, 16, 32, 64, 80, 128, 0}; + static const unsigned char size_lookup[] = + {0, 8, 16, 32, 64, 80, 128, 0, 0}; /* 256 not needed */ + unsigned int i; /* We know the target is in operand 0, but sanity check for Imm. */ - op = yasm_ops_first(operands); + op = yasm_insn_ops_first(&id_insn->insn); if (op->type != YASM_INSN__OPERAND_IMM) yasm_internal_error(N_("invalid operand conversion")); @@ -2372,7 +532,7 @@ x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, jmp->target.jump_target = 1; /* See if the user explicitly specified short/near/far. */ - switch ((int)(jinfo->operands[0] & OPTM_MASK)) { + switch (insn_operands[jinfo->operands_index+0].targetmod) { case OPTM_Short: jmp->op_sel = JMP_SHORT_FORCED; break; @@ -2385,13 +545,15 @@ x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, /* Check for address size setting in second operand, if present */ if (jinfo->num_operands > 1 && - (jinfo->operands[1] & OPA_MASK) == OPA_AdSizeR) + insn_operands[jinfo->operands_index+1].action == OPA_AdSizeR) jmp->common.addrsize = (unsigned char) - size_lookup[(jinfo->operands[1] & OPS_MASK)>>OPS_SHIFT]; + size_lookup[insn_operands[jinfo->operands_index+1].size]; /* Check for address size override */ - if (jinfo->modifiers & MOD_AdSizeR) - jmp->common.addrsize = (unsigned char)(mod_data & 0xFF); + for (i=0; imodifiers); i++) { + if (jinfo->modifiers[i] == MOD_AdSizeR) + jmp->common.addrsize = mod_data[i]; + } /* Scan through other infos for this insn looking for short/near versions. * Needs to match opersize and number of operands, also be within CPU. @@ -2400,44 +562,48 @@ x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, jmp->nearop.len = 0; for (; num_info>0 && (jmp->shortop.len == 0 || jmp->nearop.len == 0); num_info--, info++) { - unsigned long cpu = info->cpu; - - if ((cpu & CPU_64) && mode_bits != 64) + /* Match CPU */ + if (mode_bits != 64 && (info->misc_flags & ONLY_64)) continue; - if ((cpu & CPU_Not64) && mode_bits == 64) + if (mode_bits == 64 && (info->misc_flags & NOT_64)) continue; - cpu &= ~(CPU_64 | CPU_Not64); - if ((data[2] & cpu) != cpu) + if (!BitVector_bit_test(id_insn->cpu_enabled, info->cpu0) || + !BitVector_bit_test(id_insn->cpu_enabled, info->cpu1) || + !BitVector_bit_test(id_insn->cpu_enabled, info->cpu2)) continue; if (info->num_operands == 0) continue; - if ((info->operands[0] & OPA_MASK) != OPA_JmpRel) + if (insn_operands[info->operands_index+0].action != OPA_JmpRel) continue; if (info->opersize != jmp->common.opersize) continue; - switch ((int)(info->operands[0] & OPTM_MASK)) { + switch (insn_operands[info->operands_index+0].targetmod) { case OPTM_Short: x86_finalize_opcode(&jmp->shortop, info); - if (info->modifiers & MOD_Op0Add) - jmp->shortop.opcode[0] += (unsigned char)(mod_data & 0xFF); + for (i=0; imodifiers); i++) { + if (info->modifiers[i] == MOD_Op0Add) + jmp->shortop.opcode[0] += mod_data[i]; + } break; case OPTM_Near: x86_finalize_opcode(&jmp->nearop, info); - if (info->modifiers & MOD_Op1Add) - jmp->nearop.opcode[1] += (unsigned char)(mod_data & 0xFF); + for (i=0; imodifiers); i++) { + if (info->modifiers[i] == MOD_Op1Add) + jmp->nearop.opcode[1] += mod_data[i]; + } break; } } - if ((jmp->op_sel == JMP_SHORT_FORCED) && (jmp->nearop.len == 0)) + if ((jmp->op_sel == JMP_SHORT_FORCED) && (jmp->shortop.len == 0)) yasm_error_set(YASM_ERROR_TYPE, N_("no SHORT form of that jump instruction exists")); - if ((jmp->op_sel == JMP_NEAR_FORCED) && (jmp->shortop.len == 0)) + if ((jmp->op_sel == JMP_NEAR_FORCED) && (jmp->nearop.len == 0)) yasm_error_set(YASM_ERROR_TYPE, N_("no NEAR form of that jump instruction exists")); @@ -2448,21 +614,26 @@ x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, jmp->op_sel = JMP_NEAR_FORCED; } - yasm_x86__bc_apply_prefixes((x86_common *)jmp, NULL, info->def_opersize_64, - num_prefixes, prefixes); + yasm_x86__bc_apply_prefixes((x86_common *)jmp, NULL, + jinfo->def_opersize_64, + id_insn->insn.num_prefixes, + id_insn->insn.prefixes); + + x86_id_insn_clear_operands(id_insn); /* Transform the bytecode */ yasm_x86__bc_transform_jmp(bc, jmp); } static const x86_insn_info * -x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, - uintptr_t cpu, unsigned int mode_bits, unsigned int suffix, - int num_operands, yasm_insn_operand **ops, +x86_find_match(x86_id_insn *id_insn, yasm_insn_operand **ops, yasm_insn_operand **rev_ops, const unsigned int *size_lookup, int bypass) { - yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; + const x86_insn_info *info = id_insn->group; + unsigned int num_info = id_insn->num_info; + unsigned int suffix = id_insn->suffix; + unsigned int mode_bits = id_insn->mode_bits; int found = 0; /* Just do a simple linear search through the info array for a match. @@ -2470,47 +641,53 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, */ for (; num_info>0 && !found; num_info--, info++) { yasm_insn_operand *op, **use_ops; - unsigned long icpu; + const x86_info_operand *info_ops = + &insn_operands[info->operands_index]; + unsigned int gas_flags = info->gas_flags; + unsigned int misc_flags = info->misc_flags; unsigned int size; int mismatch = 0; - int i; + unsigned int i; /* Match CPU */ - icpu = info->cpu; - - if ((icpu & CPU_64) && mode_bits != 64) + if (mode_bits != 64 && (misc_flags & ONLY_64)) continue; - if ((icpu & CPU_Not64) && mode_bits == 64) + if (mode_bits == 64 && (misc_flags & NOT_64)) continue; - icpu &= ~(CPU_64 | CPU_Not64); - if (bypass != 7 && (cpu & icpu) != icpu) + if (bypass != 8 && + (!BitVector_bit_test(id_insn->cpu_enabled, info->cpu0) || + !BitVector_bit_test(id_insn->cpu_enabled, info->cpu1) || + !BitVector_bit_test(id_insn->cpu_enabled, info->cpu2))) continue; /* Match # of operands */ - if (num_operands != info->num_operands) + if (id_insn->insn.num_operands != info->num_operands) + continue; + + /* Match AVX */ + if (!(id_insn->misc_flags & ONLY_AVX) && (misc_flags & ONLY_AVX)) + continue; + if ((id_insn->misc_flags & ONLY_AVX) && (misc_flags & NOT_AVX)) continue; /* Match parser mode */ - if ((info->modifiers & MOD_GasOnly) - && arch_x86->parser != X86_PARSER_GAS) + if ((gas_flags & GAS_ONLY) && id_insn->parser != X86_PARSER_GAS) continue; - if ((info->modifiers & MOD_GasIllegal) - && arch_x86->parser == X86_PARSER_GAS) + if ((gas_flags & GAS_ILLEGAL) && id_insn->parser == X86_PARSER_GAS) continue; /* Match suffix (if required) */ - if (suffix != 0 && suffix != 0x80 - && ((suffix<modifiers) == 0) + if (id_insn->parser == X86_PARSER_GAS + && ((suffix & SUF_MASK) & (gas_flags & SUF_MASK)) == 0) continue; /* Use reversed operands in GAS mode if not otherwise specified */ use_ops = ops; - if (arch_x86->parser == X86_PARSER_GAS - && !(info->modifiers & MOD_GasNoRev)) + if (id_insn->parser == X86_PARSER_GAS && !(gas_flags & GAS_NO_REV)) use_ops = rev_ops; - if (num_operands == 0) { + if (id_insn->insn.num_operands == 0) { found = 1; /* no operands -> must have a match here. */ break; } @@ -2519,7 +696,7 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, for (i = 0, op = use_ops[0]; op && inum_operands && !mismatch; op = use_ops[++i]) { /* Check operand type */ - switch ((int)(info->operands[i] & OPT_MASK)) { + switch (info_ops[i].type) { case OPT_Imm: if (op->type != YASM_INSN__OPERAND_IMM) mismatch = 1; @@ -2561,6 +738,7 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, switch ((x86_expritem_reg_size)(op->data.reg&~0xFUL)) { case X86_MMXREG: case X86_XMMREG: + case X86_YMMREG: break; default: mismatch = 1; @@ -2594,40 +772,40 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, break; case OPT_Areg: if (op->type != YASM_INSN__OPERAND_REG || - ((info->operands[i] & OPS_MASK) == OPS_8 && + (info_ops[i].size == OPS_8 && op->data.reg != (X86_REG8 | 0) && op->data.reg != (X86_REG8X | 0)) || - ((info->operands[i] & OPS_MASK) == OPS_16 && + (info_ops[i].size == OPS_16 && op->data.reg != (X86_REG16 | 0)) || - ((info->operands[i] & OPS_MASK) == OPS_32 && + (info_ops[i].size == OPS_32 && op->data.reg != (X86_REG32 | 0)) || - ((info->operands[i] & OPS_MASK) == OPS_64 && + (info_ops[i].size == OPS_64 && op->data.reg != (X86_REG64 | 0))) mismatch = 1; break; case OPT_Creg: if (op->type != YASM_INSN__OPERAND_REG || - ((info->operands[i] & OPS_MASK) == OPS_8 && + (info_ops[i].size == OPS_8 && op->data.reg != (X86_REG8 | 1) && op->data.reg != (X86_REG8X | 1)) || - ((info->operands[i] & OPS_MASK) == OPS_16 && + (info_ops[i].size == OPS_16 && op->data.reg != (X86_REG16 | 1)) || - ((info->operands[i] & OPS_MASK) == OPS_32 && + (info_ops[i].size == OPS_32 && op->data.reg != (X86_REG32 | 1)) || - ((info->operands[i] & OPS_MASK) == OPS_64 && + (info_ops[i].size == OPS_64 && op->data.reg != (X86_REG64 | 1))) mismatch = 1; break; case OPT_Dreg: if (op->type != YASM_INSN__OPERAND_REG || - ((info->operands[i] & OPS_MASK) == OPS_8 && + (info_ops[i].size == OPS_8 && op->data.reg != (X86_REG8 | 2) && op->data.reg != (X86_REG8X | 2)) || - ((info->operands[i] & OPS_MASK) == OPS_16 && + (info_ops[i].size == OPS_16 && op->data.reg != (X86_REG16 | 2)) || - ((info->operands[i] & OPS_MASK) == OPS_32 && + (info_ops[i].size == OPS_32 && op->data.reg != (X86_REG32 | 2)) || - ((info->operands[i] & OPS_MASK) == OPS_64 && + (info_ops[i].size == OPS_64 && op->data.reg != (X86_REG64 | 2))) mismatch = 1; break; @@ -2668,8 +846,11 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, break; case OPT_MemOffs: if (op->type != YASM_INSN__OPERAND_MEMORY || - yasm_expr__contains(yasm_ea_get_disp(op->data.ea), - YASM_EXPR_REG)) + yasm_expr__contains(op->data.ea->disp.abs, + YASM_EXPR_REG) || + op->data.ea->pc_rel || + (!op->data.ea->not_pc_rel && id_insn->default_rel && + op->data.ea->disp.size != 64)) mismatch = 1; break; case OPT_Imm1: @@ -2683,8 +864,7 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, break; case OPT_ImmNotSegOff: if (op->type != YASM_INSN__OPERAND_IMM || - op->targetmod != 0 || - yasm_expr_is_op(op->data.val, YASM_EXPR_SEGOFF)) + op->targetmod != 0 || op->seg) mismatch = 1; break; case OPT_XMM0: @@ -2710,6 +890,16 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, mismatch = 1; break; } + case OPT_MemXMMIndex: + if (op->type != YASM_INSN__OPERAND_MEMORY || + !x86_expr_contains_simd(op->data.ea->disp.abs, 0)) + mismatch = 1; + break; + case OPT_MemYMMIndex: + if (op->type != YASM_INSN__OPERAND_MEMORY || + !x86_expr_contains_simd(op->data.ea->disp.abs, 1)) + mismatch = 1; + break; default: yasm_internal_error(N_("invalid operand type")); } @@ -2718,35 +908,34 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, break; /* Check operand size */ - size = size_lookup[(info->operands[i] & OPS_MASK)>>OPS_SHIFT]; - if (suffix != 0) { + size = size_lookup[info_ops[i].size]; + if (id_insn->parser == X86_PARSER_GAS) { /* Require relaxed operands for GAS mode (don't allow * per-operand sizing). */ if (op->type == YASM_INSN__OPERAND_REG && op->size == 0) { /* Register size must exactly match */ - if (yasm_x86__get_reg_size(arch, op->data.reg) != size) + if (yasm_x86__get_reg_size(op->data.reg) != size) mismatch = 1; - } else if (((info->operands[i] & OPT_MASK) == OPT_Imm - || (info->operands[i] & OPT_MASK) == OPT_ImmNotSegOff - || (info->operands[i] & OPT_MASK) == OPT_Imm1) - && (info->operands[i] & OPS_RMASK) != OPS_Relaxed - && (info->operands[i] & OPA_MASK) != OPA_JmpRel) + } else if ((info_ops[i].type == OPT_Imm + || info_ops[i].type == OPT_ImmNotSegOff + || info_ops[i].type == OPT_Imm1) + && !info_ops[i].relaxed + && info_ops[i].action != OPA_JmpRel) mismatch = 1; } else { if (op->type == YASM_INSN__OPERAND_REG && op->size == 0) { /* Register size must exactly match */ if ((bypass == 4 && i == 0) || (bypass == 5 && i == 1) - || (bypass == 6 && i == 3)) + || (bypass == 6 && i == 2)) ; - else if (yasm_x86__get_reg_size(arch, - op->data.reg) != size) + else if (yasm_x86__get_reg_size(op->data.reg) != size) mismatch = 1; } else { if ((bypass == 1 && i == 0) || (bypass == 2 && i == 1) - || (bypass == 3 && i == 3)) + || (bypass == 3 && i == 2)) ; - else if ((info->operands[i] & OPS_RMASK) == OPS_Relaxed) { + else if (info_ops[i].relaxed) { /* Relaxed checking */ if (size != 0 && op->size != size && op->size != 0) mismatch = 1; @@ -2762,8 +951,9 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, break; /* Check for 64-bit effective address size in NASM mode */ - if (suffix == 0 && op->type == YASM_INSN__OPERAND_MEMORY) { - if ((info->operands[i] & OPEAS_MASK) == OPEAS_64) { + if (id_insn->parser != X86_PARSER_GAS && + op->type == YASM_INSN__OPERAND_MEMORY) { + if (info_ops[i].eas64) { if (op->data.ea->disp.size != 64) mismatch = 1; } else if (op->data.ea->disp.size == 64) @@ -2774,7 +964,7 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, break; /* Check target modifier */ - switch ((int)(info->operands[i] & OPTM_MASK)) { + switch (info_ops[i].targetmod) { case OPTM_None: if (op->targetmod != 0) mismatch = 1; @@ -2812,9 +1002,7 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, } static void -x86_match_error(yasm_arch *arch, int num_info, const x86_insn_info *info, - uintptr_t cpu, unsigned int mode_bits, unsigned int suffix, - int num_operands, yasm_insn_operand **ops, +x86_match_error(x86_id_insn *id_insn, yasm_insn_operand **ops, yasm_insn_operand **rev_ops, const unsigned int *size_lookup) { const x86_insn_info *i; @@ -2824,8 +1012,8 @@ x86_match_error(yasm_arch *arch, int num_info, const x86_insn_info *info, /* Check for matching # of operands */ found = 0; - for (ni=num_info, i=info; ni>0; ni--, i++) { - if (num_operands == i->num_operands) { + for (ni=id_insn->num_info, i=id_insn->group; ni>0; ni--, i++) { + if (id_insn->insn.num_operands == i->num_operands) { found = 1; break; } @@ -2835,9 +1023,8 @@ x86_match_error(yasm_arch *arch, int num_info, const x86_insn_info *info, return; } - for (bypass=1; bypass<8; bypass++) { - i = x86_find_match(arch, num_info, info, cpu, mode_bits, suffix, - num_operands, ops, rev_ops, size_lookup, bypass); + for (bypass=1; bypass<9; bypass++) { + i = x86_find_match(id_insn, ops, rev_ops, size_lookup, bypass); if (i) break; } @@ -2860,65 +1047,65 @@ x86_match_error(yasm_arch *arch, int num_info, const x86_insn_info *info, break; case 7: yasm_error_set(YASM_ERROR_TYPE, - N_("requires CPU%s"), - cpu_find_reverse(i->cpu & ~(CPU_64 | CPU_Not64))); + N_("one of source operand 1 or 3 must match dest operand")); break; + case 8: + { + unsigned int cpu0 = i->cpu0, cpu1 = i->cpu1, cpu2 = i->cpu2; + yasm_error_set(YASM_ERROR_TYPE, + N_("requires CPU%s"), + cpu_find_reverse(cpu0, cpu1, cpu2)); + break; + } default: yasm_error_set(YASM_ERROR_TYPE, N_("invalid combination of opcode and operands")); } } -void -yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, - yasm_bytecode *prev_bc, const uintptr_t data[4], - int num_operands, - /*@null@*/ yasm_insn_operands *operands, - int num_prefixes, uintptr_t **prefixes, - int num_segregs, const uintptr_t *segregs) +static void +x86_id_insn_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc) { - yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; + x86_id_insn *id_insn = (x86_id_insn *)bc->contents; x86_insn *insn; - int num_info = (int)(data[1]&0xFF); - const x86_insn_info *info = (const x86_insn_info *)data[0]; - unsigned long mod_data = (unsigned long)(data[1] >> 8); - unsigned int mode_bits = (unsigned int)(data[3] & 0xFF); - unsigned int suffix = (unsigned int)((data[3]>>8) & 0xFF); - yasm_insn_operand *op, *ops[4], *rev_ops[4]; + const x86_insn_info *info = id_insn->group; + unsigned int mode_bits = id_insn->mode_bits; + unsigned char *mod_data = id_insn->mod_data; + yasm_insn_operand *op, *ops[5], *rev_ops[5]; /*@null@*/ yasm_expr *imm; unsigned char im_len; unsigned char im_sign; unsigned char spare; - int i; - unsigned int size_lookup[] = {0, 8, 16, 32, 64, 80, 128, 0}; + unsigned char vexdata, vexreg; + unsigned int i; + unsigned int size_lookup[] = {0, 8, 16, 32, 64, 80, 128, 256, 0}; unsigned long do_postop = 0; - size_lookup[7] = mode_bits; + size_lookup[OPS_BITS] = mode_bits; - if (!info) { - num_info = 1; - info = empty_insn; - } + yasm_insn_finalize(&id_insn->insn); /* Build local array of operands from list, since we know we have a max - * of 3 operands. + * of 5 operands. */ - if (num_operands > 3) { + if (id_insn->insn.num_operands > 5) { yasm_error_set(YASM_ERROR_TYPE, N_("too many operands")); return; } - ops[0] = ops[1] = ops[2] = ops[3] = NULL; - for (i = 0, op = yasm_ops_first(operands); op && i < num_operands; - op = yasm_operand_next(op), i++) + ops[0] = ops[1] = ops[2] = ops[3] = ops[4] = NULL; + for (i = 0, op = yasm_insn_ops_first(&id_insn->insn); + op && i < id_insn->insn.num_operands; + op = yasm_insn_op_next(op), i++) ops[i] = op; /* If we're running in GAS mode, build a reverse array of the operands * as most GAS instructions have reversed operands from Intel style. */ - if (arch_x86->parser == X86_PARSER_GAS) { - rev_ops[0] = rev_ops[1] = rev_ops[2] = rev_ops[3] = NULL; - for (i = num_operands-1, op = yasm_ops_first(operands); op && i >= 0; - op = yasm_operand_next(op), i--) + if (id_insn->parser == X86_PARSER_GAS) { + rev_ops[0] = rev_ops[1] = rev_ops[2] = rev_ops[3] = rev_ops[4] = NULL; + for (i = id_insn->insn.num_operands-1, + op = yasm_insn_ops_first(&id_insn->insn); + op; op = yasm_insn_op_next(op), i--) rev_ops[i] = op; } @@ -2926,8 +1113,8 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, * if this is a relative jump (OPA_JmpRel). If so, run through the * operands and adjust for dereferences / lack thereof. */ - if (arch_x86->parser == X86_PARSER_GAS - && (info->operands[0] & OPA_MASK) == OPA_JmpRel) { + if (id_insn->parser == X86_PARSER_GAS + && insn_operands[info->operands_index+0].action == OPA_JmpRel) { for (i = 0, op = ops[0]; op; op = ops[++i]) { if (!op->deref && (op->type == YASM_INSN__OPERAND_REG || (op->type == YASM_INSN__OPERAND_MEMORY @@ -2944,37 +1131,30 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, N_("skipping prefixes on this instruction")); imm = op->data.ea->disp.abs; op->data.ea->disp.abs = NULL; - yasm_ea_destroy(op->data.ea); + yasm_x86__ea_destroy(op->data.ea); op->type = YASM_INSN__OPERAND_IMM; op->data.val = imm; } } } - info = x86_find_match(arch, num_info, info, data[2], mode_bits, suffix, - num_operands, ops, rev_ops, size_lookup, 0); + info = x86_find_match(id_insn, ops, rev_ops, size_lookup, 0); if (!info) { /* Didn't find a match */ - info = (const x86_insn_info *)data[0]; - if (!info) - info = empty_insn; - x86_match_error(arch, num_info, info, data[2], mode_bits, suffix, - num_operands, ops, rev_ops, size_lookup); + x86_match_error(id_insn, ops, rev_ops, size_lookup); return; } - if (operands) { - switch (info->operands[0] & OPA_MASK) { + if (id_insn->insn.num_operands > 0) { + switch (insn_operands[info->operands_index+0].action) { case OPA_JmpRel: /* Shortcut to JmpRel */ - x86_finalize_jmp(arch, bc, prev_bc, data, num_operands, - operands, num_prefixes, prefixes, info); + x86_finalize_jmp(bc, prev_bc, info); return; case OPA_JmpFar: /* Shortcut to JmpFar */ - x86_finalize_jmpfar(arch, bc, prev_bc, data, num_operands, - operands, num_prefixes, prefixes, info); + x86_finalize_jmpfar(bc, prev_bc, info); return; } } @@ -2988,74 +1168,88 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, insn->def_opersize_64 = info->def_opersize_64; insn->special_prefix = info->special_prefix; spare = info->spare; + vexdata = 0; + vexreg = 0; im_len = 0; im_sign = 0; insn->postop = X86_POSTOP_NONE; insn->rex = 0; - /* Apply modifiers */ - if (info->modifiers & MOD_Gap0) - mod_data >>= 8; - if (info->modifiers & MOD_Op2Add) { - insn->opcode.opcode[2] += (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_Gap1) - mod_data >>= 8; - if (info->modifiers & MOD_Op1Add) { - insn->opcode.opcode[1] += (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_Gap2) - mod_data >>= 8; - if (info->modifiers & MOD_Op0Add) { - insn->opcode.opcode[0] += (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_PreAdd) { - insn->special_prefix += (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_SpAdd) { - spare += (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_OpSizeR) { - insn->common.opersize = (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_Imm8) { - imm = yasm_expr_create_ident(yasm_expr_int( - yasm_intnum_create_uint(mod_data & 0xFF)), bc->line); - im_len = 8; - mod_data >>= 8; - } - if (info->modifiers & MOD_DOpS64R) { - insn->def_opersize_64 = (unsigned char)(mod_data & 0xFF); - mod_data >>= 8; - } - if (info->modifiers & MOD_Op1AddSp) { - insn->opcode.opcode[1] += (unsigned char)(mod_data & 0xFF)<<3; - /*mod_data >>= 8;*/ + /* Move VEX/XOP data (stored in special prefix) to separate location to + * allow overriding of special prefix by modifiers. + */ + if ((insn->special_prefix & 0xF0) == 0xC0 || + (insn->special_prefix & 0xF0) == 0x80) { + vexdata = insn->special_prefix; + insn->special_prefix = 0; } - /* In 64-bit mode, if opersize is 64 and default is not 64, force REX byte */ + /* Apply modifiers */ + for (i=0; imodifiers); i++) { + switch (info->modifiers[i]) { + case MOD_Gap: + break; + case MOD_PreAdd: + insn->special_prefix += mod_data[i]; + break; + case MOD_Op0Add: + insn->opcode.opcode[0] += mod_data[i]; + break; + case MOD_Op1Add: + insn->opcode.opcode[1] += mod_data[i]; + break; + case MOD_Op2Add: + insn->opcode.opcode[2] += mod_data[i]; + break; + case MOD_Op3Add: + insn->opcode.opcode[3] += mod_data[i]; + break; + case MOD_SpAdd: + spare += mod_data[i]; + break; + case MOD_OpSizeR: + insn->common.opersize = mod_data[i]; + break; + case MOD_Imm8: + imm = yasm_expr_create_ident(yasm_expr_int( + yasm_intnum_create_uint(mod_data[i])), bc->line); + im_len = 8; + break; + case MOD_DOpS64R: + insn->def_opersize_64 = mod_data[i]; + break; + case MOD_Op1AddSp: + insn->opcode.opcode[1] += mod_data[i]<<3; + break; + case MOD_SetVEX: + vexdata = mod_data[i]; + break; + default: + break; + } + } + + /* In 64-bit mode, if opersize is 64 and default is not 64, + * force REX byte. + */ if (mode_bits == 64 && insn->common.opersize == 64 && insn->def_opersize_64 != 64) insn->rex = 0x48; /* Go through operands and assign */ - if (operands) { + if (id_insn->insn.num_operands > 0) { yasm_insn_operand **use_ops = ops; + const x86_info_operand *info_ops = + &insn_operands[info->operands_index]; /* Use reversed operands in GAS mode if not otherwise specified */ - if (arch_x86->parser == X86_PARSER_GAS - && !(info->modifiers & MOD_GasNoRev)) + if (id_insn->parser == X86_PARSER_GAS + && !(info->gas_flags & GAS_NO_REV)) use_ops = rev_ops; for (i = 0, op = use_ops[0]; op && inum_operands; op = use_ops[++i]) { - switch ((int)(info->operands[i] & OPA_MASK)) { + switch (info_ops[i].action) { case OPA_None: /* Throw away the operand contents */ switch (op->type) { @@ -3063,7 +1257,7 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, case YASM_INSN__OPERAND_SEGREG: break; case YASM_INSN__OPERAND_MEMORY: - yasm_ea_destroy(op->data.ea); + yasm_x86__ea_destroy(op->data.ea); break; case YASM_INSN__OPERAND_IMM: yasm_expr_destroy(op->data.val); @@ -3073,40 +1267,74 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, case OPA_EA: switch (op->type) { case YASM_INSN__OPERAND_REG: - insn->x86_ea = yasm_x86__ea_create_reg( - (unsigned long)op->data.reg, &insn->rex, - mode_bits); + insn->x86_ea = + yasm_x86__ea_create_reg(insn->x86_ea, + (unsigned long)op->data.reg, &insn->rex, + mode_bits); break; case YASM_INSN__OPERAND_SEGREG: yasm_internal_error( N_("invalid operand conversion")); case YASM_INSN__OPERAND_MEMORY: + if (op->seg) + yasm_error_set(YASM_ERROR_VALUE, + N_("invalid segment in effective address")); insn->x86_ea = (x86_effaddr *)op->data.ea; - if ((info->operands[i] & OPT_MASK) == OPT_MemOffs) + if (info_ops[i].type == OPT_MemOffs) /* Special-case for MOV MemOffs instruction */ yasm_x86__ea_set_disponly(insn->x86_ea); + else if (info_ops[i].type == OPT_MemXMMIndex) { + /* Remember VSIB mode */ + insn->x86_ea->vsib_mode = 1; + insn->x86_ea->need_sib = 1; + } else if (info_ops[i].type == OPT_MemYMMIndex) { + /* Remember VSIB mode */ + insn->x86_ea->vsib_mode = 2; + insn->x86_ea->need_sib = 1; + } else if (id_insn->default_rel && + !op->data.ea->not_pc_rel && + op->data.ea->segreg != 0x6404 && + op->data.ea->segreg != 0x6505 && + !yasm_expr__contains( + op->data.ea->disp.abs, YASM_EXPR_REG)) + /* Enable default PC-rel if no regs and segreg + * is not FS or GS. + */ + insn->x86_ea->ea.pc_rel = 1; break; case YASM_INSN__OPERAND_IMM: insn->x86_ea = - yasm_x86__ea_create_imm(op->data.val, - size_lookup[(info->operands[i] & - OPS_MASK)>>OPS_SHIFT]); + yasm_x86__ea_create_imm(insn->x86_ea, + op->data.val, + size_lookup[info_ops[i].size]); break; } break; + case OPA_EAVEX: + if (op->type != YASM_INSN__OPERAND_REG) + yasm_internal_error(N_("invalid operand conversion")); + insn->x86_ea = + yasm_x86__ea_create_reg(insn->x86_ea, + (unsigned long)op->data.reg, &insn->rex, mode_bits); + vexreg = op->data.reg & 0xF; + break; case OPA_Imm: + if (op->seg) + yasm_error_set(YASM_ERROR_VALUE, + N_("immediate does not support segment")); if (op->type == YASM_INSN__OPERAND_IMM) { imm = op->data.val; - im_len = size_lookup[(info->operands[i] & - OPS_MASK)>>OPS_SHIFT]; + im_len = size_lookup[info_ops[i].size]; } else yasm_internal_error(N_("invalid operand conversion")); break; case OPA_SImm: + if (op->seg) + yasm_error_set(YASM_ERROR_VALUE, + N_("immediate does not support segment")); if (op->type == YASM_INSN__OPERAND_IMM) { imm = op->data.val; - im_len = size_lookup[(info->operands[i] & - OPS_MASK)>>OPS_SHIFT]; + im_len = size_lookup[info_ops[i].size]; im_sign = 1; } else yasm_internal_error(N_("invalid operand conversion")); @@ -3121,6 +1349,14 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, } else yasm_internal_error(N_("invalid operand conversion")); break; + case OPA_SpareVEX: + if (op->type != YASM_INSN__OPERAND_REG) + yasm_internal_error(N_("invalid operand conversion")); + if (yasm_x86__set_rex_from_reg(&insn->rex, &spare, + op->data.reg, mode_bits, X86_REX_R)) + return; + vexreg = op->data.reg & 0xF; + break; case OPA_Op0Add: if (op->type == YASM_INSN__OPERAND_REG) { unsigned char opadd; @@ -3144,8 +1380,9 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, case OPA_SpareEA: if (op->type == YASM_INSN__OPERAND_REG) { insn->x86_ea = - yasm_x86__ea_create_reg((unsigned long)op->data.reg, - &insn->rex, mode_bits); + yasm_x86__ea_create_reg(insn->x86_ea, + (unsigned long)op->data.reg, &insn->rex, + mode_bits); if (!insn->x86_ea || yasm_x86__set_rex_from_reg(&insn->rex, &spare, op->data.reg, mode_bits, X86_REX_R)) { @@ -3178,17 +1415,70 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, else yasm_error_set(YASM_ERROR_TYPE, N_("unsupported address size")); - yasm_ea_destroy(op->data.ea); + yasm_x86__ea_destroy(op->data.ea); break; } + case OPA_VEX: + if (op->type != YASM_INSN__OPERAND_REG) + yasm_internal_error(N_("invalid operand conversion")); + vexreg = op->data.reg & 0xF; + break; + case OPA_VEXImmSrc: + if (op->type != YASM_INSN__OPERAND_REG) + yasm_internal_error(N_("invalid operand conversion")); + + if (!imm) { + imm = yasm_expr_create_ident( + yasm_expr_int( + yasm_intnum_create_uint((op->data.reg << 4) + & 0xF0)), + bc->line); + } else { + imm = yasm_expr_create( + YASM_EXPR_OR, + yasm_expr_expr(yasm_expr_create( + YASM_EXPR_AND, + yasm_expr_expr(imm), + yasm_expr_int(yasm_intnum_create_uint(0x0F)), + bc->line)), + yasm_expr_int( + yasm_intnum_create_uint((op->data.reg << 4) + & 0xF0)), + bc->line); + } + im_len = 8; + break; + case OPA_VEXImm: + if (op->type != YASM_INSN__OPERAND_IMM) + yasm_internal_error(N_("invalid operand conversion")); + + if (!imm) + imm = op->data.val; + else { + imm = yasm_expr_create( + YASM_EXPR_OR, + yasm_expr_expr(yasm_expr_create( + YASM_EXPR_AND, + yasm_expr_expr(op->data.val), + yasm_expr_int(yasm_intnum_create_uint(0x0F)), + bc->line)), + yasm_expr_expr(yasm_expr_create( + YASM_EXPR_AND, + yasm_expr_expr(imm), + yasm_expr_int(yasm_intnum_create_uint(0xF0)), + bc->line)), + bc->line); + } + im_len = 8; + break; default: yasm_internal_error(N_("unknown operand action")); } - if ((info->operands[i] & OPS_MASK) == OPS_BITS) + if (info_ops[i].size == OPS_BITS) insn->common.opersize = (unsigned char)mode_bits; - switch ((int)(info->operands[i] & OPAP_MASK)) { + switch (info_ops[i].post_action) { case OPAP_None: break; case OPAP_SImm8: @@ -3196,7 +1486,7 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, * pre-emptively expand to full size. * For unspecified size case, still optimize. */ - if (!(arch_x86->force_strict || op->strict) + if (!(id_insn->force_strict || op->strict) || op->size == 0) insn->postop = X86_POSTOP_SIGNEXT_IMM8; else if (op->size != 8) { @@ -3223,28 +1513,30 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, if (insn->x86_ea) { yasm_x86__ea_init(insn->x86_ea, spare, prev_bc); - for (i=0; ix86_ea->ea, segregs[i]); - } else if (num_segregs > 0 && insn->special_prefix == 0) { - if (num_segregs > 1) + for (i=0; iinsn.num_segregs; i++) + yasm_ea_set_segreg(&insn->x86_ea->ea, id_insn->insn.segregs[i]); + } else if (id_insn->insn.num_segregs > 0 && insn->special_prefix == 0) { + if (id_insn->insn.num_segregs > 1) yasm_warn_set(YASM_WARN_GENERAL, N_("multiple segment overrides, using leftmost")); - insn->special_prefix = (unsigned char)(segregs[num_segregs-1]>>8); - } else if (num_segregs > 0) + insn->special_prefix = (unsigned char) + (id_insn->insn.segregs[id_insn->insn.num_segregs-1]>>8); + } else if (id_insn->insn.num_segregs > 0) yasm_internal_error(N_("unhandled segment prefix")); if (imm) { insn->imm = yasm_xmalloc(sizeof(yasm_value)); - if (yasm_value_finalize_expr(insn->imm, imm, prev_bc, 0)) + if (yasm_value_finalize_expr(insn->imm, imm, prev_bc, im_len)) yasm_error_set(YASM_ERROR_TOO_COMPLEX, N_("immediate expression too complex")); - insn->imm->size = im_len; insn->imm->sign = im_sign; } else insn->imm = NULL; yasm_x86__bc_apply_prefixes((x86_common *)insn, &insn->rex, - insn->def_opersize_64, num_prefixes, prefixes); + insn->def_opersize_64, + id_insn->insn.num_prefixes, + id_insn->insn.prefixes); if (insn->postop == X86_POSTOP_ADDRESS16 && insn->common.addrsize) { yasm_warn_set(YASM_WARN_GENERAL, N_("address size override ignored")); @@ -3258,8 +1550,12 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, * short mov instructions if a 32-bit address override is applied in * 64-bit mode to an EA of just an offset (no registers) and the * target register is al/ax/eax/rax. + * + * We don't want to do this if we're in default rel mode. */ - if (insn->common.mode_bits == 64 && insn->common.addrsize == 32 && + if (!id_insn->default_rel && + insn->common.mode_bits == 64 && + insn->common.addrsize == 32 && (!insn->x86_ea->ea.disp.abs || !yasm_expr__contains(insn->x86_ea->ea.disp.abs, YASM_EXPR_REG))) { @@ -3285,7 +1581,7 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, /* Build ModRM EA - CAUTION: this depends on * opcode 0 being a mov instruction! */ - insn->x86_ea = yasm_x86__ea_create_reg( + insn->x86_ea = yasm_x86__ea_create_reg(insn->x86_ea, (unsigned long)insn->opcode.opcode[0]-0xB8, &rex_temp, 64); /* Make the imm32s form permanent. */ @@ -3298,6 +1594,84 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, break; } + /* Convert to VEX/XOP prefixes if requested. + * To save space in the insn structure, the VEX/XOP prefix is written into + * special_prefix and the first 2 bytes of the instruction are set to + * the second two VEX/XOP bytes. During calc_len() it may be shortened to + * one VEX byte (this can only be done after knowledge of REX value); this + * further optimization is not possible for XOP. + */ + if (vexdata) { + int xop = ((vexdata & 0xF0) == 0x80); + unsigned char vex1 = 0xE0; /* R=X=B=1, mmmmm=0 */ + unsigned char vex2; + + if (xop) { + /* Look at the first bytes of the opcode for the XOP mmmmm field. + * Leave R=X=B=1 for now. + */ + if (insn->opcode.opcode[0] != 0x08 && + insn->opcode.opcode[0] != 0x09 && + insn->opcode.opcode[0] != 0x0A) + yasm_internal_error(N_("first opcode byte of XOP must be 0x08, 0x09, or 0x0A")); + vex1 |= insn->opcode.opcode[0]; + /* Move opcode byte back one byte to make room for XOP prefix. */ + insn->opcode.opcode[2] = insn->opcode.opcode[1]; + } else { + /* Look at the first bytes of the opcode to see what leading bytes + * to encode in the VEX mmmmm field. Leave R=X=B=1 for now. + */ + if (insn->opcode.opcode[0] != 0x0F) + yasm_internal_error(N_("first opcode byte of VEX must be 0x0F")); + + if (insn->opcode.opcode[1] == 0x38) + vex1 |= 0x02; /* implied 0x0F 0x38 */ + else if (insn->opcode.opcode[1] == 0x3A) + vex1 |= 0x03; /* implied 0x0F 0x3A */ + else { + /* Originally a 0F-only opcode; move opcode byte back one + * position to make room for VEX prefix. + */ + insn->opcode.opcode[2] = insn->opcode.opcode[1]; + vex1 |= 0x01; /* implied 0x0F */ + } + } + + /* Check for update of special prefix by modifiers */ + if (insn->special_prefix != 0) { + vexdata &= ~0x03; + switch (insn->special_prefix) { + case 0x66: + vexdata |= 0x01; + break; + case 0xF3: + vexdata |= 0x02; + break; + case 0xF2: + vexdata |= 0x03; + break; + default: + yasm_internal_error(N_("unrecognized special prefix")); + } + } + + /* 2nd VEX byte is WvvvvLpp. + * W, L, pp come from vexdata + * vvvv comes from 1s complement of vexreg + */ + vex2 = (((vexdata & 0x8) << 4) | /* W */ + ((15 - (vexreg & 0xF)) << 3) | /* vvvv */ + (vexdata & 0x7)); /* Lpp */ + + /* Save to special_prefix and opcode */ + insn->special_prefix = xop ? 0x8F : 0xC4; /* VEX/XOP prefix */ + insn->opcode.opcode[0] = vex1; + insn->opcode.opcode[1] = vex2; + insn->opcode.len = 3; /* two prefix bytes and 1 opcode byte */ + } + + x86_id_insn_clear_operands(id_insn); + /* Transform the bytecode */ yasm_x86__bc_transform_insn(bc, insn); } @@ -3309,157 +1683,144 @@ typedef struct insnprefix_parse_data { /* instruction parse group - NULL if prefix */ /*@null@*/ const x86_insn_info *group; - /* For instruction, modifier in upper 24 bits, number of elements in group - * in lower 8 bits. - * For prefix, prefix type. + /* For instruction, number of elements in group. + * For prefix, prefix type shifted right by 8. */ - unsigned long data1; + unsigned int num_info:8; - /* For instruction, cpu flags. + /* For instruction, GAS suffix flags. * For prefix, prefix value. */ - unsigned long data2; + unsigned int flags:8; - /* suffix flags for instructions */ - enum { - NONE = 0, - SUF_B = (MOD_GasSufB >> MOD_GasSuf_SHIFT), - SUF_W = (MOD_GasSufW >> MOD_GasSuf_SHIFT), - SUF_L = (MOD_GasSufL >> MOD_GasSuf_SHIFT), - SUF_Q = (MOD_GasSufQ >> MOD_GasSuf_SHIFT), - SUF_S = (MOD_GasSufS >> MOD_GasSuf_SHIFT), - WEAK = 0x80 /* Relaxed operand mode for GAS */ - } flags; + /* Instruction modifier data. */ + unsigned int mod_data0:8; + unsigned int mod_data1:8; + unsigned int mod_data2:8; + + /* Tests against BITS==64 and AVX */ + unsigned int misc_flags:6; + + /* CPU flags */ + unsigned int cpu0:6; + unsigned int cpu1:6; + unsigned int cpu2:6; } insnprefix_parse_data; -#define INSN(name, flags, group, mod, cpu) \ - { name, group##_insn, (mod##UL<<8)|NELEMS(group##_insn), cpu, flags } -#define PREFIX(name, type, value) \ - { name, NULL, type, value, NONE } - -/* Static parse data structure for CPU feature flags */ -typedef struct cpu_parse_data { - const char *name; - - unsigned long cpu; - enum { - CPU_MODE_VERBATIM, - CPU_MODE_SET, - CPU_MODE_CLEAR - } mode; -} cpu_parse_data; - -typedef struct regtmod_parse_data { - const char *name; - - unsigned long regtmod; -} regtmod_parse_data; -#define REG(name, type, index, bits) \ - { name, (((unsigned long)YASM_ARCH_REG) << 24) | \ - (((unsigned long)bits) << 16) | (type | index) } -#define REGGROUP(name, group) \ - { name, (((unsigned long)YASM_ARCH_REGGROUP) << 24) | (group) } -#define SEGREG(name, prefix, num, bits) \ - { name, (((unsigned long)YASM_ARCH_SEGREG) << 24) | \ - (((unsigned long)bits) << 16) | (prefix << 8) | (num) } -#define TARGETMOD(name, mod) \ - { name, (((unsigned long)YASM_ARCH_TARGETMOD) << 24) | (mod) } /* Pull in all parse data */ -#include "x86parse.c" +#include "x86insn_nasm.c" +#include "x86insn_gas.c" static const char * -cpu_find_reverse(unsigned long cpu) +cpu_find_reverse(unsigned int cpu0, unsigned int cpu1, unsigned int cpu2) { static char cpuname[200]; + wordptr cpu = BitVector_Create(128, TRUE); + + if (cpu0 != CPU_Any) + BitVector_Bit_On(cpu, cpu0); + if (cpu1 != CPU_Any) + BitVector_Bit_On(cpu, cpu1); + if (cpu2 != CPU_Any) + BitVector_Bit_On(cpu, cpu2); cpuname[0] = '\0'; - if (cpu & CPU_Prot) + if (BitVector_bit_test(cpu, CPU_Prot)) strcat(cpuname, " Protected"); - if (cpu & CPU_Undoc) + if (BitVector_bit_test(cpu, CPU_Undoc)) strcat(cpuname, " Undocumented"); - if (cpu & CPU_Obs) + if (BitVector_bit_test(cpu, CPU_Obs)) strcat(cpuname, " Obsolete"); - if (cpu & CPU_Priv) + if (BitVector_bit_test(cpu, CPU_Priv)) strcat(cpuname, " Privileged"); - if (cpu & CPU_FPU) + if (BitVector_bit_test(cpu, CPU_FPU)) strcat(cpuname, " FPU"); - if (cpu & CPU_MMX) + if (BitVector_bit_test(cpu, CPU_MMX)) strcat(cpuname, " MMX"); - if (cpu & CPU_SSE) + if (BitVector_bit_test(cpu, CPU_SSE)) strcat(cpuname, " SSE"); - if (cpu & CPU_SSE2) + if (BitVector_bit_test(cpu, CPU_SSE2)) strcat(cpuname, " SSE2"); - if (cpu & CPU_SSE3) + if (BitVector_bit_test(cpu, CPU_SSE3)) strcat(cpuname, " SSE3"); - if (cpu & CPU_3DNow) + if (BitVector_bit_test(cpu, CPU_3DNow)) strcat(cpuname, " 3DNow"); - if (cpu & CPU_Cyrix) + if (BitVector_bit_test(cpu, CPU_Cyrix)) strcat(cpuname, " Cyrix"); - if (cpu & CPU_AMD) + if (BitVector_bit_test(cpu, CPU_AMD)) strcat(cpuname, " AMD"); - if (cpu & CPU_SMM) + if (BitVector_bit_test(cpu, CPU_SMM)) strcat(cpuname, " SMM"); - if (cpu & CPU_SVM) + if (BitVector_bit_test(cpu, CPU_SVM)) strcat(cpuname, " SVM"); - if (cpu & CPU_PadLock) + if (BitVector_bit_test(cpu, CPU_PadLock)) strcat(cpuname, " PadLock"); - if (cpu & CPU_EM64T) + if (BitVector_bit_test(cpu, CPU_EM64T)) strcat(cpuname, " EM64T"); - if (cpu & CPU_SSSE3) + if (BitVector_bit_test(cpu, CPU_SSSE3)) strcat(cpuname, " SSSE3"); - if (cpu & CPU_SSE41) + if (BitVector_bit_test(cpu, CPU_SSE41)) strcat(cpuname, " SSE4.1"); - if (cpu & CPU_SSE42) + if (BitVector_bit_test(cpu, CPU_SSE42)) strcat(cpuname, " SSE4.2"); - if (cpu & CPU_186) + if (BitVector_bit_test(cpu, CPU_186)) strcat(cpuname, " 186"); - if (cpu & CPU_286) + if (BitVector_bit_test(cpu, CPU_286)) strcat(cpuname, " 286"); - if (cpu & CPU_386) + if (BitVector_bit_test(cpu, CPU_386)) strcat(cpuname, " 386"); - if (cpu & CPU_486) + if (BitVector_bit_test(cpu, CPU_486)) strcat(cpuname, " 486"); - if (cpu & CPU_586) + if (BitVector_bit_test(cpu, CPU_586)) strcat(cpuname, " 586"); - if (cpu & CPU_686) + if (BitVector_bit_test(cpu, CPU_686)) strcat(cpuname, " 686"); - if (cpu & CPU_P3) + if (BitVector_bit_test(cpu, CPU_P3)) strcat(cpuname, " P3"); - if (cpu & CPU_P4) + if (BitVector_bit_test(cpu, CPU_P4)) strcat(cpuname, " P4"); - if (cpu & CPU_IA64) + if (BitVector_bit_test(cpu, CPU_IA64)) strcat(cpuname, " IA64"); - if (cpu & CPU_K6) + if (BitVector_bit_test(cpu, CPU_K6)) strcat(cpuname, " K6"); - if (cpu & CPU_Athlon) + if (BitVector_bit_test(cpu, CPU_Athlon)) strcat(cpuname, " Athlon"); - if (cpu & CPU_Hammer) + if (BitVector_bit_test(cpu, CPU_Hammer)) strcat(cpuname, " Hammer"); + + BitVector_Destroy(cpu); return cpuname; } yasm_arch_insnprefix -yasm_x86__parse_check_insnprefix(yasm_arch *arch, uintptr_t data[4], - const char *id, size_t id_len) +yasm_x86__parse_check_insnprefix(yasm_arch *arch, const char *id, + size_t id_len, unsigned long line, + yasm_bytecode **bc, uintptr_t *prefix) { yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; /*@null@*/ const insnprefix_parse_data *pdata; size_t i; - static char lcaseid[16]; + static char lcaseid[17]; - if (id_len > 15) + *bc = (yasm_bytecode *)NULL; + *prefix = 0; + + if (id_len > 16) return YASM_ARCH_NOTINSNPREFIX; for (i=0; iparser) { + switch (PARSER(arch_x86)) { case X86_PARSER_NASM: pdata = insnprefix_nasm_find(lcaseid, id_len); break; + case X86_PARSER_TASM: + pdata = insnprefix_nasm_find(lcaseid, id_len); + break; case X86_PARSER_GAS: pdata = insnprefix_gas_find(lcaseid, id_len); break; @@ -3470,39 +1831,69 @@ yasm_x86__parse_check_insnprefix(yasm_arch *arch, uintptr_t data[4], return YASM_ARCH_NOTINSNPREFIX; if (pdata->group) { - unsigned long cpu = pdata->data2; + x86_id_insn *id_insn; + wordptr cpu_enabled = arch_x86->cpu_enables[arch_x86->active_cpu]; + unsigned int cpu0, cpu1, cpu2; - if ((cpu & CPU_64) && arch_x86->mode_bits != 64) { + if (arch_x86->mode_bits != 64 && (pdata->misc_flags & ONLY_64)) { yasm_warn_set(YASM_WARN_GENERAL, N_("`%s' is an instruction in 64-bit mode"), id); return YASM_ARCH_NOTINSNPREFIX; } - if ((cpu & CPU_Not64) && arch_x86->mode_bits == 64) { + if (arch_x86->mode_bits == 64 && (pdata->misc_flags & NOT_64)) { yasm_error_set(YASM_ERROR_GENERAL, N_("`%s' invalid in 64-bit mode"), id); - data[0] = (uintptr_t)not64_insn; - data[1] = NELEMS(not64_insn); - data[2] = CPU_Not64; - data[3] = arch_x86->mode_bits; + id_insn = yasm_xmalloc(sizeof(x86_id_insn)); + yasm_insn_initialize(&id_insn->insn); + id_insn->group = not64_insn; + id_insn->cpu_enabled = cpu_enabled; + id_insn->mod_data[0] = 0; + id_insn->mod_data[1] = 0; + id_insn->mod_data[2] = 0; + id_insn->num_info = NELEMS(not64_insn); + id_insn->mode_bits = arch_x86->mode_bits; + id_insn->suffix = 0; + id_insn->misc_flags = 0; + id_insn->parser = PARSER(arch_x86); + + id_insn->force_strict = arch_x86->force_strict != 0; + id_insn->default_rel = arch_x86->default_rel != 0; + *bc = yasm_bc_create_common(&x86_id_insn_callback, id_insn, line); return YASM_ARCH_INSN; } - cpu &= ~(CPU_64 | CPU_Not64); - if ((arch_x86->cpu_enabled & cpu) != cpu) { + cpu0 = pdata->cpu0; + cpu1 = pdata->cpu1; + cpu2 = pdata->cpu2; + + if (!BitVector_bit_test(cpu_enabled, cpu0) || + !BitVector_bit_test(cpu_enabled, cpu1) || + !BitVector_bit_test(cpu_enabled, cpu2)) { yasm_warn_set(YASM_WARN_GENERAL, N_("`%s' is an instruction in CPU%s"), id, - cpu_find_reverse(cpu)); + cpu_find_reverse(cpu0, cpu1, cpu2)); return YASM_ARCH_NOTINSNPREFIX; } - data[0] = (uintptr_t)pdata->group; - data[1] = pdata->data1; - data[2] = arch_x86->cpu_enabled; - data[3] = (((unsigned long)pdata->flags)<<8) | arch_x86->mode_bits; + id_insn = yasm_xmalloc(sizeof(x86_id_insn)); + yasm_insn_initialize(&id_insn->insn); + id_insn->group = pdata->group; + id_insn->cpu_enabled = cpu_enabled; + id_insn->mod_data[0] = pdata->mod_data0; + id_insn->mod_data[1] = pdata->mod_data1; + id_insn->mod_data[2] = pdata->mod_data2; + id_insn->num_info = pdata->num_info; + id_insn->mode_bits = arch_x86->mode_bits; + id_insn->suffix = pdata->flags; + id_insn->misc_flags = pdata->misc_flags; + id_insn->parser = PARSER(arch_x86); + id_insn->force_strict = arch_x86->force_strict != 0; + id_insn->default_rel = arch_x86->default_rel != 0; + *bc = yasm_bc_create_common(&x86_id_insn_callback, id_insn, line); return YASM_ARCH_INSN; } else { - unsigned long type = pdata->data1; - unsigned long value = pdata->data2; + unsigned long type = pdata->num_info<<8; + unsigned long value = pdata->flags; if (arch_x86->mode_bits == 64 && type == X86_OPERSIZE && value == 32) { yasm_error_set(YASM_ERROR_GENERAL, @@ -3516,90 +1907,52 @@ yasm_x86__parse_check_insnprefix(yasm_arch *arch, uintptr_t data[4], return YASM_ARCH_NOTINSNPREFIX; } - if ((type == X86_REX || - (value == 64 && (type == X86_OPERSIZE || type == X86_ADDRSIZE))) - && arch_x86->mode_bits != 64) { + if (arch_x86->mode_bits != 64 && (pdata->misc_flags & ONLY_64)) { yasm_warn_set(YASM_WARN_GENERAL, N_("`%s' is a prefix in 64-bit mode"), id); return YASM_ARCH_NOTINSNPREFIX; } - data[0] = type; - data[1] = value; + *prefix = type|value; return YASM_ARCH_PREFIX; } } -void -yasm_x86__parse_cpu(yasm_arch_x86 *arch_x86, const char *cpuid, - size_t cpuid_len) +static void +x86_id_insn_destroy(void *contents) { - /*@null@*/ const cpu_parse_data *pdata; - size_t i; - static char lcaseid[16]; - - if (cpuid_len > 15) - return; - for (i=0; imode) { - case CPU_MODE_VERBATIM: - arch_x86->cpu_enabled = pdata->cpu; - break; - case CPU_MODE_SET: - arch_x86->cpu_enabled |= pdata->cpu; - break; - case CPU_MODE_CLEAR: - arch_x86->cpu_enabled &= ~pdata->cpu; - break; - } + x86_id_insn *id_insn = (x86_id_insn *)contents; + yasm_insn_delete(&id_insn->insn, yasm_x86__ea_destroy); + yasm_xfree(contents); } -yasm_arch_regtmod -yasm_x86__parse_check_regtmod(yasm_arch *arch, uintptr_t *data, - const char *id, size_t id_len) +static void +x86_id_insn_print(const void *contents, FILE *f, int indent_level) +{ + const x86_id_insn *id_insn = (const x86_id_insn *)contents; + yasm_insn_print(&id_insn->insn, f, indent_level); + /*TODO*/ +} + +/*@only@*/ yasm_bytecode * +yasm_x86__create_empty_insn(yasm_arch *arch, unsigned long line) { yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; - /*@null@*/ const regtmod_parse_data *pdata; - size_t i; - static char lcaseid[8]; - unsigned int bits; - yasm_arch_regtmod type; + x86_id_insn *id_insn = yasm_xmalloc(sizeof(x86_id_insn)); - if (id_len > 7) - return YASM_ARCH_NOTREGTMOD; - for (i=0; iinsn); + id_insn->group = empty_insn; + id_insn->cpu_enabled = arch_x86->cpu_enables[arch_x86->active_cpu]; + id_insn->mod_data[0] = 0; + id_insn->mod_data[1] = 0; + id_insn->mod_data[2] = 0; + id_insn->num_info = NELEMS(empty_insn); + id_insn->mode_bits = arch_x86->mode_bits; + id_insn->suffix = (PARSER(arch_x86) == X86_PARSER_GAS) ? SUF_Z : 0; + id_insn->misc_flags = 0; + id_insn->parser = PARSER(arch_x86); + id_insn->force_strict = arch_x86->force_strict != 0; + id_insn->default_rel = arch_x86->default_rel != 0; - pdata = regtmod_find(lcaseid, id_len); - if (!pdata) - return YASM_ARCH_NOTREGTMOD; - - type = (yasm_arch_regtmod)(pdata->regtmod >> 24); - bits = (pdata->regtmod >> 16) & 0xFF; - - if (type == YASM_ARCH_REG && bits != 0 && arch_x86->mode_bits != bits) { - yasm_warn_set(YASM_WARN_GENERAL, - N_("`%s' is a register in %u-bit mode"), id, bits); - return YASM_ARCH_NOTREGTMOD; - } - - if (type == YASM_ARCH_SEGREG && bits != 0 && arch_x86->mode_bits == bits) { - yasm_warn_set(YASM_WARN_GENERAL, - N_("`%s' segment register ignored in %u-bit mode"), id, - bits); - } - - *data = pdata->regtmod & 0x0000FFFFUL; - return type; + return yasm_bc_create_common(&x86_id_insn_callback, id_insn, line); } diff --git a/modules/arch/x86/x86parse.gap b/modules/arch/x86/x86parse.gap deleted file mode 100644 index c9d71411..00000000 --- a/modules/arch/x86/x86parse.gap +++ /dev/null @@ -1,1268 +0,0 @@ -# GAP (gen_arch_parse) input file for x86 architecture -# $Id$ -# -# Copyright (C) 2001-2007 Peter Johnson -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -# Configure GAP for x86 generation mode -ARCH x86 - -# Supported x86 parsers -PARSERS nasm gas - -# INSN parameters: -# - parser (- if any) -# - base name of instruction -# - if string, each character is an allowed GAS suffix -# if defined name, value is GAS suffix mode set (no character suffix reqd) -# - instruction group (sans _insn suffix) -# - modifiers (up to 3 bytes) -# - CPU flags -# -# The string mode of the second parameter is a shortcut for GAS forms, e.g.: -# INSN - mov "bwl" mov 0 CPU_Any -# is equivalent to: -# INSN - mov NONE mov 0 CPU_Any -# INSN gas movb SUF_B mov 0 CPU_Any -# INSN gas movw SUF_W mov 0 CPU_Any -# INSN gas movl SUF_L mov 0 CPU_Any - -# Move -INSN - mov "bwl" mov 0 CPU_Any -INSN gas movabs "bwlq" movabs 0 CPU_Hammer|CPU_64 - -# Move with sign/zero extend -INSN gas movsbw SUF_B movszx 0xBE CPU_386 -INSN gas movsbl SUF_B movszx 0xBE CPU_386 -INSN gas movswl SUF_W movszx 0xBE CPU_386 -INSN gas movsbq SUF_B movszx 0xBE CPU_Hammer|CPU_64 -INSN gas movswq SUF_W movszx 0xBE CPU_Hammer|CPU_64 -INSN - movsx "bw" movszx 0xBE CPU_386 -INSN gas movslq SUF_L movsxd 0 CPU_Hammer|CPU_64 -INSN nasm movsxd NONE movsxd 0 CPU_Hammer|CPU_64 -INSN gas movzbw SUF_B movszx 0xB6 CPU_386 -INSN gas movzbl SUF_B movszx 0xB6 CPU_386 -INSN gas movzwl SUF_W movszx 0xB6 CPU_386 -INSN gas movzbq SUF_B movszx 0xB6 CPU_Hammer|CPU_64 -INSN gas movzwq SUF_W movszx 0xB6 CPU_Hammer|CPU_64 -INSN - movzx NONE movszx 0xB6 CPU_386 - -# Push instructions -INSN - push "wlq" push 0 CPU_Any -INSN - pusha NONE onebyte 0x0060 CPU_186|CPU_Not64 -INSN nasm pushad NONE onebyte 0x2060 CPU_386|CPU_Not64 -INSN gas pushal NONE onebyte 0x2060 CPU_386|CPU_Not64 -INSN - pushaw NONE onebyte 0x1060 CPU_186|CPU_Not64 - -# Pop instructions -INSN - pop "wlq" pop 0 CPU_Any -INSN - popa NONE onebyte 0x0061 CPU_186|CPU_Not64 -INSN nasm popad NONE onebyte 0x2061 CPU_386|CPU_Not64 -INSN gas popal NONE onebyte 0x2061 CPU_386|CPU_Not64 -INSN - popaw NONE onebyte 0x1061 CPU_186|CPU_Not64 - -# Exchange -INSN - xchg "bwlq" xchg 0 CPU_Any - -# In/out from ports -INSN - in "bwl" in 0 CPU_Any -INSN - out "bwl" out 0 CPU_Any -# Load effective address -INSN - lea "wlq" lea 0 CPU_Any -# Load segment registers from memory -INSN - lds "wl" ldes 0xC5 CPU_Not64 -INSN - les "wl" ldes 0xC4 CPU_Not64 -INSN - lfs "wl" lfgss 0xB4 CPU_386 -INSN - lgs "wl" lfgss 0xB5 CPU_386 -INSN - lss "wl" lfgss 0xB2 CPU_386 -# Flags register instructions -INSN - clc NONE onebyte 0x00F8 CPU_Any -INSN - cld NONE onebyte 0x00FC CPU_Any -INSN - cli NONE onebyte 0x00FA CPU_Any -INSN - clts NONE twobyte 0x0F06 CPU_286|CPU_Priv -INSN - cmc NONE onebyte 0x00F5 CPU_Any -INSN - lahf NONE onebyte 0x009F CPU_Any -INSN - sahf NONE onebyte 0x009E CPU_Any -INSN - pushf NONE onebyte 0x40009C CPU_Any -INSN nasm pushfd NONE onebyte 0x00209C CPU_386|CPU_Not64 -INSN gas pushfl NONE onebyte 0x00209C CPU_386|CPU_Not64 -INSN - pushfw NONE onebyte 0x40109C CPU_Any -INSN - pushfq NONE onebyte 0x40409C CPU_Hammer|CPU_64 -INSN - popf NONE onebyte 0x40009D CPU_Any -INSN nasm popfd NONE onebyte 0x00209D CPU_386|CPU_Not64 -INSN gas popfl NONE onebyte 0x00209D CPU_386|CPU_Not64 -INSN - popfw NONE onebyte 0x40109D CPU_Any -INSN - popfq NONE onebyte 0x40409D CPU_Hammer|CPU_64 -INSN - stc NONE onebyte 0x00F9 CPU_Any -INSN - std NONE onebyte 0x00FD CPU_Any -INSN - sti NONE onebyte 0x00FB CPU_Any -# Arithmetic -INSN - add "bwlq" arith 0x0000 CPU_Any -INSN - inc "bwlq" incdec 0x0040 CPU_Any -INSN - sub "bwlq" arith 0x0528 CPU_Any -INSN - dec "bwlq" incdec 0x0148 CPU_Any -INSN - sbb "bwlq" arith 0x0318 CPU_Any -INSN - cmp "bwlq" arith 0x0738 CPU_Any -INSN - test "bwlq" test 0 CPU_Any -INSN - and "bwlq" arith 0x0420 CPU_Any -INSN - or "bwlq" arith 0x0108 CPU_Any -INSN - xor "bwlq" arith 0x0630 CPU_Any -INSN - adc "bwlq" arith 0x0210 CPU_Any -INSN - neg "bwlq" f6 0x03 CPU_Any -INSN - not "bwlq" f6 0x02 CPU_Any -INSN - aaa NONE onebyte 0x0037 CPU_Not64 -INSN - aas NONE onebyte 0x003F CPU_Not64 -INSN - daa NONE onebyte 0x0027 CPU_Not64 -INSN - das NONE onebyte 0x002F CPU_Not64 -INSN - aad NONE aadm 0x01 CPU_Not64 -INSN - aam NONE aadm 0x00 CPU_Not64 -# Conversion instructions -INSN - cbw NONE onebyte 0x1098 CPU_Any -INSN - cwde NONE onebyte 0x2098 CPU_386 -INSN - cdqe NONE onebyte 0x4098 CPU_Hammer|CPU_64 -INSN - cwd NONE onebyte 0x1099 CPU_Any -INSN - cdq NONE onebyte 0x2099 CPU_386 -INSN - cqo NONE onebyte 0x4099 CPU_Hammer|CPU_64 -# Conversion instructions - GAS / AT&T naming -INSN gas cbtw NONE onebyte 0x1098 CPU_Any -INSN gas cwtl NONE onebyte 0x2098 CPU_386 -INSN gas cltq NONE onebyte 0x4098 CPU_Hammer|CPU_64 -INSN gas cwtd NONE onebyte 0x1099 CPU_Any -INSN gas cltd NONE onebyte 0x2099 CPU_386 -INSN gas cqto NONE onebyte 0x4099 CPU_Hammer|CPU_64 -# Multiplication and division -INSN - mul "bwlq" f6 0x04 CPU_Any -INSN - imul "bwlq" imul 0 CPU_Any -INSN - div "bwlq" div 0x06 CPU_Any -INSN - idiv "bwlq" div 0x07 CPU_Any -# Shifts -INSN - rol "bwlq" shift 0x00 CPU_Any -INSN - ror "bwlq" shift 0x01 CPU_Any -INSN - rcl "bwlq" shift 0x02 CPU_Any -INSN - rcr "bwlq" shift 0x03 CPU_Any -INSN - sal "bwlq" shift 0x04 CPU_Any -INSN - shl "bwlq" shift 0x04 CPU_Any -INSN - shr "bwlq" shift 0x05 CPU_Any -INSN - sar "bwlq" shift 0x07 CPU_Any -INSN - shld "wlq" shlrd 0xA4 CPU_386 -INSN - shrd "wlq" shlrd 0xAC CPU_386 -# Control transfer instructions unconditional) -INSN - call NONE call 0 CPU_Any -INSN gas calll NONE call 0 CPU_Not64 -INSN gas callq NONE call 0 CPU_Hammer|CPU_64 -INSN - jmp NONE jmp 0 CPU_Any -INSN - ret NONE retnf 0x00C2 CPU_Any -INSN gas retw NONE retnf 0x10C2 CPU_Any -INSN gas retl NONE retnf 0x00C2 CPU_Not64 -INSN gas retq NONE retnf 0x00C2 CPU_Hammer|CPU_64 -INSN nasm retn NONE retnf 0x00C2 CPU_Any -INSN nasm retf NONE retnf 0x40CA CPU_Any -INSN gas lretw NONE retnf 0x10CA CPU_Any -INSN gas lretl NONE retnf 0x00CA CPU_Any -INSN gas lretq NONE retnf 0x40CA CPU_Hammer|CPU_64 -INSN - enter "wlq" enter 0 CPU_186 -INSN - leave NONE onebyte 0x4000C9 CPU_186 -INSN gas leavew NONE onebyte 0x0010C9 CPU_186 -INSN gas leavel NONE onebyte 0x4000C9 CPU_186 -INSN gas leaveq NONE onebyte 0x4000C9 CPU_Hammer|CPU_64 -# Conditional jumps -INSN - jo NONE jcc 0x00 CPU_Any -INSN - jno NONE jcc 0x01 CPU_Any -INSN - jb NONE jcc 0x02 CPU_Any -INSN - jc NONE jcc 0x02 CPU_Any -INSN - jnae NONE jcc 0x02 CPU_Any -INSN - jnb NONE jcc 0x03 CPU_Any -INSN - jnc NONE jcc 0x03 CPU_Any -INSN - jae NONE jcc 0x03 CPU_Any -INSN - je NONE jcc 0x04 CPU_Any -INSN - jz NONE jcc 0x04 CPU_Any -INSN - jne NONE jcc 0x05 CPU_Any -INSN - jnz NONE jcc 0x05 CPU_Any -INSN - jbe NONE jcc 0x06 CPU_Any -INSN - jna NONE jcc 0x06 CPU_Any -INSN - jnbe NONE jcc 0x07 CPU_Any -INSN - ja NONE jcc 0x07 CPU_Any -INSN - js NONE jcc 0x08 CPU_Any -INSN - jns NONE jcc 0x09 CPU_Any -INSN - jp NONE jcc 0x0A CPU_Any -INSN - jpe NONE jcc 0x0A CPU_Any -INSN - jnp NONE jcc 0x0B CPU_Any -INSN - jpo NONE jcc 0x0B CPU_Any -INSN - jl NONE jcc 0x0C CPU_Any -INSN - jnge NONE jcc 0x0C CPU_Any -INSN - jnl NONE jcc 0x0D CPU_Any -INSN - jge NONE jcc 0x0D CPU_Any -INSN - jle NONE jcc 0x0E CPU_Any -INSN - jng NONE jcc 0x0E CPU_Any -INSN - jnle NONE jcc 0x0F CPU_Any -INSN - jg NONE jcc 0x0F CPU_Any -INSN - jcxz NONE jcxz 0x10 CPU_Any -INSN - jecxz NONE jcxz 0x20 CPU_386 -INSN - jrcxz NONE jcxz 0x40 CPU_Hammer|CPU_64 -# Loop instructions -INSN - loop NONE loop 0x02 CPU_Any -INSN - loopz NONE loop 0x01 CPU_Any -INSN - loope NONE loop 0x01 CPU_Any -INSN - loopnz NONE loop 0x00 CPU_Any -INSN - loopne NONE loop 0x00 CPU_Any -# Set byte on flag instructions -INSN - seto "b" setcc 0x00 CPU_386 -INSN - setno "b" setcc 0x01 CPU_386 -INSN - setb "b" setcc 0x02 CPU_386 -INSN - setc "b" setcc 0x02 CPU_386 -INSN - setnae "b" setcc 0x02 CPU_386 -INSN - setnb "b" setcc 0x03 CPU_386 -INSN - setnc "b" setcc 0x03 CPU_386 -INSN - setae "b" setcc 0x03 CPU_386 -INSN - sete "b" setcc 0x04 CPU_386 -INSN - setz "b" setcc 0x04 CPU_386 -INSN - setne "b" setcc 0x05 CPU_386 -INSN - setnz "b" setcc 0x05 CPU_386 -INSN - setbe "b" setcc 0x06 CPU_386 -INSN - setna "b" setcc 0x06 CPU_386 -INSN - setnbe "b" setcc 0x07 CPU_386 -INSN - seta "b" setcc 0x07 CPU_386 -INSN - sets "b" setcc 0x08 CPU_386 -INSN - setns "b" setcc 0x09 CPU_386 -INSN - setp "b" setcc 0x0A CPU_386 -INSN - setpe "b" setcc 0x0A CPU_386 -INSN - setnp "b" setcc 0x0B CPU_386 -INSN - setpo "b" setcc 0x0B CPU_386 -INSN - setl "b" setcc 0x0C CPU_386 -INSN - setnge "b" setcc 0x0C CPU_386 -INSN - setnl "b" setcc 0x0D CPU_386 -INSN - setge "b" setcc 0x0D CPU_386 -INSN - setle "b" setcc 0x0E CPU_386 -INSN - setng "b" setcc 0x0E CPU_386 -INSN - setnle "b" setcc 0x0F CPU_386 -INSN - setg "b" setcc 0x0F CPU_386 -# String instructions -INSN - cmpsb NONE onebyte 0x00A6 CPU_Any -INSN - cmpsw NONE onebyte 0x10A7 CPU_Any -INSN - cmpsd NONE cmpsd 0 CPU_Any -INSN gas cmpsl NONE onebyte 0x20A7 CPU_386 -INSN - cmpsq NONE onebyte 0x40A7 CPU_Hammer|CPU_64 -INSN - insb NONE onebyte 0x006C CPU_Any -INSN - insw NONE onebyte 0x106D CPU_Any -INSN nasm insd NONE onebyte 0x206D CPU_386 -INSN gas insl NONE onebyte 0x206D CPU_386 -INSN - outsb NONE onebyte 0x006E CPU_Any -INSN - outsw NONE onebyte 0x106F CPU_Any -INSN nasm outsd NONE onebyte 0x206F CPU_386 -INSN gas outsl NONE onebyte 0x206F CPU_386 -INSN - lodsb NONE onebyte 0x00AC CPU_Any -INSN - lodsw NONE onebyte 0x10AD CPU_Any -INSN nasm lodsd NONE onebyte 0x20AD CPU_386 -INSN gas lodsl NONE onebyte 0x20AD CPU_386 -INSN - lodsq NONE onebyte 0x40AD CPU_Hammer|CPU_64 -INSN - movsb NONE onebyte 0x00A4 CPU_Any -INSN - movsw NONE onebyte 0x10A5 CPU_Any -INSN - movsd NONE movsd 0 CPU_386 -INSN gas movsl NONE onebyte 0x20A5 CPU_386 -INSN - movsq NONE onebyte 0x40A5 CPU_Hammer|CPU_64 -# smov alias for movs in GAS mode -INSN gas smovb NONE onebyte 0x00A4 CPU_Any -INSN gas smovw NONE onebyte 0x10A5 CPU_Any -INSN gas smovl NONE onebyte 0x20A5 CPU_386 -INSN gas smovq NONE onebyte 0x40A5 CPU_Hammer|CPU_64 -INSN - scasb NONE onebyte 0x00AE CPU_Any -INSN - scasw NONE onebyte 0x10AF CPU_Any -INSN nasm scasd NONE onebyte 0x20AF CPU_386 -INSN gas scasl NONE onebyte 0x20AF CPU_386 -INSN - scasq NONE onebyte 0x40AF CPU_Hammer|CPU_64 -# ssca alias for scas in GAS mode -INSN gas sscab NONE onebyte 0x00AE CPU_Any -INSN gas sscaw NONE onebyte 0x10AF CPU_Any -INSN gas sscal NONE onebyte 0x20AF CPU_386 -INSN gas sscaq NONE onebyte 0x40AF CPU_Hammer|CPU_64 -INSN - stosb NONE onebyte 0x00AA CPU_Any -INSN - stosw NONE onebyte 0x10AB CPU_Any -INSN nasm stosd NONE onebyte 0x20AB CPU_386 -INSN gas stosl NONE onebyte 0x20AB CPU_386 -INSN - stosq NONE onebyte 0x40AB CPU_Hammer|CPU_64 -INSN - xlatb NONE onebyte 0x00D7 CPU_Any -# Bit manipulation -INSN - bsf "wlq" bsfr 0xBC CPU_386 -INSN - bsr "wlq" bsfr 0xBD CPU_386 -INSN - bt "wlq" bittest 0x04A3 CPU_386 -INSN - btc "wlq" bittest 0x07BB CPU_386 -INSN - btr "wlq" bittest 0x06B3 CPU_386 -INSN - bts "wlq" bittest 0x05AB CPU_386 -# Interrupts and operating system instructions -INSN - int NONE int 0 CPU_Any -INSN - int3 NONE onebyte 0x00CC CPU_Any -INSN nasm int03 NONE onebyte 0x00CC CPU_Any -INSN - into NONE onebyte 0x00CE CPU_Not64 -INSN - iret NONE onebyte 0x00CF CPU_Any -INSN - iretw NONE onebyte 0x10CF CPU_Any -INSN nasm iretd NONE onebyte 0x20CF CPU_386 -INSN gas iretl NONE onebyte 0x20CF CPU_386 -INSN - iretq NONE onebyte 0x40CF CPU_Hammer|CPU_64 -INSN - rsm NONE twobyte 0x0FAA CPU_586|CPU_SMM -INSN - bound "wl" bound 0 CPU_186|CPU_Not64 -INSN - hlt NONE onebyte 0x00F4 CPU_Priv -INSN - nop NONE onebyte 0x0090 CPU_Any -# Protection control -INSN - arpl "w" arpl 0 CPU_286|CPU_Prot|CPU_Not64 -INSN - lar "wlq" bsfr 0x02 CPU_286|CPU_Prot -INSN - lgdt "wlq" twobytemem 0x020F01 CPU_286|CPU_Priv -INSN - lidt "wlq" twobytemem 0x030F01 CPU_286|CPU_Priv -INSN - lldt "w" prot286 0x0200 CPU_286|CPU_Prot|CPU_Priv -INSN - lmsw "w" prot286 0x0601 CPU_286|CPU_Priv -INSN - lsl "wlq" bsfr 0x03 CPU_286|CPU_Prot -INSN - ltr "w" prot286 0x0300 CPU_286|CPU_Prot|CPU_Priv -INSN - sgdt "wlq" twobytemem 0x000F01 CPU_286|CPU_Priv -INSN - sidt "wlq" twobytemem 0x010F01 CPU_286|CPU_Priv -INSN - sldt "wlq" sldtmsw 0x0000 CPU_286 -INSN - smsw "wlq" sldtmsw 0x0401 CPU_286 -INSN - str "wlq" str 0 CPU_286|CPU_Prot -INSN - verr "w" prot286 0x0400 CPU_286|CPU_Prot -INSN - verw "w" prot286 0x0500 CPU_286|CPU_Prot -# Floating point instructions -INSN - fld "ls" fld 0 CPU_FPU -INSN gas fldt WEAK fldstpt 0x05 CPU_FPU -INSN - fild "lqs" fildstp 0x050200 CPU_FPU -INSN gas fildll NONE fbldstp 0x05 CPU_FPU -INSN - fbld NONE fbldstp 0x04 CPU_FPU -INSN - fst "ls" fst 0 CPU_FPU -INSN - fist "ls" fiarith 0x02DB CPU_FPU -INSN - fstp "ls" fstp 0 CPU_FPU -INSN gas fstpt WEAK fldstpt 0x07 CPU_FPU -INSN - fistp "lqs" fildstp 0x070203 CPU_FPU -INSN gas fistpll NONE fbldstp 0x07 CPU_FPU -INSN - fbstp NONE fbldstp 0x06 CPU_FPU -INSN - fxch NONE fxch 0 CPU_FPU -INSN - fcom "ls" fcom 0x02D0 CPU_FPU -INSN - ficom "ls" fiarith 0x02DA CPU_FPU -INSN - fcomp "ls" fcom 0x03D8 CPU_FPU -INSN - ficomp "ls" fiarith 0x03DA CPU_FPU -INSN - fcompp NONE twobyte 0xDED9 CPU_FPU -INSN - fucom NONE fcom2 0xDDE0 CPU_286|CPU_FPU -INSN - fucomp NONE fcom2 0xDDE8 CPU_286|CPU_FPU -INSN - fucompp NONE twobyte 0xDAE9 CPU_286|CPU_FPU -INSN - ftst NONE twobyte 0xD9E4 CPU_FPU -INSN - fxam NONE twobyte 0xD9E5 CPU_FPU -INSN - fld1 NONE twobyte 0xD9E8 CPU_FPU -INSN - fldl2t NONE twobyte 0xD9E9 CPU_FPU -INSN - fldl2e NONE twobyte 0xD9EA CPU_FPU -INSN - fldpi NONE twobyte 0xD9EB CPU_FPU -INSN - fldlg2 NONE twobyte 0xD9EC CPU_FPU -INSN - fldln2 NONE twobyte 0xD9ED CPU_FPU -INSN - fldz NONE twobyte 0xD9EE CPU_FPU -INSN - fadd "ls" farith 0x00C0C0 CPU_FPU -INSN - faddp NONE farithp 0xC0 CPU_FPU -INSN - fiadd "ls" fiarith 0x00DA CPU_FPU -INSN - fsub "ls" farith 0x04E0E8 CPU_FPU -INSN - fisub "ls" fiarith 0x04DA CPU_FPU -INSN nasm fsubp NONE farithp 0xE8 CPU_FPU -INSN gas fsubp NONE farithp 0xE0 CPU_FPU -INSN - fsubr "ls" farith 0x05E8E0 CPU_FPU -INSN - fisubr "ls" fiarith 0x05DA CPU_FPU -INSN nasm fsubrp NONE farithp 0xE0 CPU_FPU -INSN gas fsubrp NONE farithp 0xE8 CPU_FPU -INSN - fmul "ls" farith 0x01C8C8 CPU_FPU -INSN - fimul "ls" fiarith 0x01DA CPU_FPU -INSN - fmulp NONE farithp 0xC8 CPU_FPU -INSN - fdiv "ls" farith 0x06F0F8 CPU_FPU -INSN - fidiv "ls" fiarith 0x06DA CPU_FPU -INSN nasm fdivp NONE farithp 0xF8 CPU_FPU -INSN gas fdivp NONE farithp 0xF0 CPU_FPU -INSN - fdivr "ls" farith 0x07F8F0 CPU_FPU -INSN - fidivr "ls" fiarith 0x07DA CPU_FPU -INSN nasm fdivrp NONE farithp 0xF0 CPU_FPU -INSN gas fdivrp NONE farithp 0xF8 CPU_FPU -INSN - f2xm1 NONE twobyte 0xD9F0 CPU_FPU -INSN - fyl2x NONE twobyte 0xD9F1 CPU_FPU -INSN - fptan NONE twobyte 0xD9F2 CPU_FPU -INSN - fpatan NONE twobyte 0xD9F3 CPU_FPU -INSN - fxtract NONE twobyte 0xD9F4 CPU_FPU -INSN - fprem1 NONE twobyte 0xD9F5 CPU_286|CPU_FPU -INSN - fdecstp NONE twobyte 0xD9F6 CPU_FPU -INSN - fincstp NONE twobyte 0xD9F7 CPU_FPU -INSN - fprem NONE twobyte 0xD9F8 CPU_FPU -INSN - fyl2xp1 NONE twobyte 0xD9F9 CPU_FPU -INSN - fsqrt NONE twobyte 0xD9FA CPU_FPU -INSN - fsincos NONE twobyte 0xD9FB CPU_286|CPU_FPU -INSN - frndint NONE twobyte 0xD9FC CPU_FPU -INSN - fscale NONE twobyte 0xD9FD CPU_FPU -INSN - fsin NONE twobyte 0xD9FE CPU_286|CPU_FPU -INSN - fcos NONE twobyte 0xD9FF CPU_286|CPU_FPU -INSN - fchs NONE twobyte 0xD9E0 CPU_FPU -INSN - fabs NONE twobyte 0xD9E1 CPU_FPU -INSN - fninit NONE twobyte 0xDBE3 CPU_FPU -INSN - finit NONE threebyte 0x9BDBE3 CPU_FPU -INSN - fldcw "w" fldnstcw 0x05 CPU_FPU -INSN - fnstcw "w" fldnstcw 0x07 CPU_FPU -INSN - fstcw "w" fstcw 0 CPU_FPU -INSN - fnstsw "w" fnstsw 0 CPU_FPU -INSN - fstsw "w" fstsw 0 CPU_FPU -INSN - fnclex NONE twobyte 0xDBE2 CPU_FPU -INSN - fclex NONE threebyte 0x9BDBE2 CPU_FPU -INSN - fnstenv "ls" onebytemem 0x06D9 CPU_FPU -INSN - fstenv "ls" twobytemem 0x069BD9 CPU_FPU -INSN - fldenv "ls" onebytemem 0x04D9 CPU_FPU -INSN - fnsave "ls" onebytemem 0x06DD CPU_FPU -INSN - fsave "ls" twobytemem 0x069BDD CPU_FPU -INSN - frstor "ls" onebytemem 0x04DD CPU_FPU -INSN - ffree NONE ffree 0xDD CPU_FPU -INSN - ffreep NONE ffree 0xDF CPU_686|CPU_FPU|CPU_Undoc -INSN - fnop NONE twobyte 0xD9D0 CPU_FPU -INSN - fwait NONE onebyte 0x009B CPU_FPU -# Prefixes should the others be here too? should wait be a prefix? -INSN - wait NONE onebyte 0x009B CPU_Any -# 486 extensions -INSN - bswap "lq" bswap 0 CPU_486 -INSN - xadd "bwlq" cmpxchgxadd 0xC0 CPU_486 -INSN - cmpxchg "bwlq" cmpxchgxadd 0xB0 CPU_486 -INSN nasm cmpxchg486 NONE cmpxchgxadd 0xA6 CPU_486|CPU_Undoc -INSN - invd NONE twobyte 0x0F08 CPU_486|CPU_Priv -INSN - wbinvd NONE twobyte 0x0F09 CPU_486|CPU_Priv -INSN - invlpg NONE twobytemem 0x070F01 CPU_486|CPU_Priv -# 586+ and late 486 extensions -INSN - cpuid NONE twobyte 0x0FA2 CPU_486 -# Pentium extensions -INSN - wrmsr NONE twobyte 0x0F30 CPU_586|CPU_Priv -INSN - rdtsc NONE twobyte 0x0F31 CPU_586 -INSN - rdmsr NONE twobyte 0x0F32 CPU_586|CPU_Priv -INSN - cmpxchg8b "q" cmpxchg8b 0 CPU_586 -# Pentium II/Pentium Pro extensions -INSN - sysenter NONE twobyte 0x0F34 CPU_686|CPU_Not64 -INSN - sysexit NONE twobyte 0x0F35 CPU_686|CPU_Priv|CPU_Not64 -INSN - fxsave "q" twobytemem 0x000FAE CPU_686|CPU_FPU -INSN - fxrstor "q" twobytemem 0x010FAE CPU_686|CPU_FPU -INSN - rdpmc NONE twobyte 0x0F33 CPU_686 -INSN - ud2 NONE twobyte 0x0F0B CPU_286 -INSN - ud1 NONE twobyte 0x0FB9 CPU_286|CPU_Undoc -INSN - cmovo "wlq" cmovcc 0x00 CPU_686 -INSN - cmovno "wlq" cmovcc 0x01 CPU_686 -INSN - cmovb "wlq" cmovcc 0x02 CPU_686 -INSN - cmovc "wlq" cmovcc 0x02 CPU_686 -INSN - cmovnae "wlq" cmovcc 0x02 CPU_686 -INSN - cmovnb "wlq" cmovcc 0x03 CPU_686 -INSN - cmovnc "wlq" cmovcc 0x03 CPU_686 -INSN - cmovae "wlq" cmovcc 0x03 CPU_686 -INSN - cmove "wlq" cmovcc 0x04 CPU_686 -INSN - cmovz "wlq" cmovcc 0x04 CPU_686 -INSN - cmovne "wlq" cmovcc 0x05 CPU_686 -INSN - cmovnz "wlq" cmovcc 0x05 CPU_686 -INSN - cmovbe "wlq" cmovcc 0x06 CPU_686 -INSN - cmovna "wlq" cmovcc 0x06 CPU_686 -INSN - cmovnbe "wlq" cmovcc 0x07 CPU_686 -INSN - cmova "wlq" cmovcc 0x07 CPU_686 -INSN - cmovs "wlq" cmovcc 0x08 CPU_686 -INSN - cmovns "wlq" cmovcc 0x09 CPU_686 -INSN - cmovp "wlq" cmovcc 0x0A CPU_686 -INSN - cmovpe "wlq" cmovcc 0x0A CPU_686 -INSN - cmovnp "wlq" cmovcc 0x0B CPU_686 -INSN - cmovpo "wlq" cmovcc 0x0B CPU_686 -INSN - cmovl "wlq" cmovcc 0x0C CPU_686 -INSN - cmovnge "wlq" cmovcc 0x0C CPU_686 -INSN - cmovnl "wlq" cmovcc 0x0D CPU_686 -INSN - cmovge "wlq" cmovcc 0x0D CPU_686 -INSN - cmovle "wlq" cmovcc 0x0E CPU_686 -INSN - cmovng "wlq" cmovcc 0x0E CPU_686 -INSN - cmovnle "wlq" cmovcc 0x0F CPU_686 -INSN - cmovg "wlq" cmovcc 0x0F CPU_686 -INSN - fcmovb NONE fcmovcc 0xDAC0 CPU_686|CPU_FPU -INSN - fcmove NONE fcmovcc 0xDAC8 CPU_686|CPU_FPU -INSN - fcmovbe NONE fcmovcc 0xDAD0 CPU_686|CPU_FPU -INSN - fcmovu NONE fcmovcc 0xDAD8 CPU_686|CPU_FPU -INSN - fcmovnb NONE fcmovcc 0xDBC0 CPU_686|CPU_FPU -INSN - fcmovne NONE fcmovcc 0xDBC8 CPU_686|CPU_FPU -INSN - fcmovnbe NONE fcmovcc 0xDBD0 CPU_686|CPU_FPU -INSN - fcmovnu NONE fcmovcc 0xDBD8 CPU_686|CPU_FPU -INSN - fcomi NONE fcom2 0xDBF0 CPU_686|CPU_FPU -INSN - fucomi NONE fcom2 0xDBE8 CPU_686|CPU_FPU -INSN - fcomip NONE fcom2 0xDFF0 CPU_686|CPU_FPU -INSN - fucomip NONE fcom2 0xDFE8 CPU_686|CPU_FPU -# Pentium4 extensions -INSN - movnti "lq" movnti 0 CPU_P4 -INSN - clflush NONE clflush 0 CPU_P3 -INSN - lfence NONE threebyte 0x0FAEE8 CPU_P3 -INSN - mfence NONE threebyte 0x0FAEF0 CPU_P3 -INSN - pause NONE onebyte_prefix 0xF390 CPU_P4 -# MMX/SSE2 instructions -INSN - emms NONE twobyte 0x0F77 CPU_MMX -INSN - movd NONE movd 0 CPU_MMX -# For GAS movq must use standard mov instruction. -# For NASM it can use a dedicated instruction. -INSN gas movq SUF_Q mov 0 CPU_Any -INSN nasm movq NONE movq 0 CPU_MMX -INSN - packssdw NONE mmxsse2 0x6B CPU_MMX -INSN - packsswb NONE mmxsse2 0x63 CPU_MMX -INSN - packuswb NONE mmxsse2 0x67 CPU_MMX -INSN - paddb NONE mmxsse2 0xFC CPU_MMX -INSN - paddw NONE mmxsse2 0xFD CPU_MMX -INSN - paddd NONE mmxsse2 0xFE CPU_MMX -INSN - paddq NONE mmxsse2 0xD4 CPU_MMX -INSN - paddsb NONE mmxsse2 0xEC CPU_MMX -INSN - paddsw NONE mmxsse2 0xED CPU_MMX -INSN - paddusb NONE mmxsse2 0xDC CPU_MMX -INSN - paddusw NONE mmxsse2 0xDD CPU_MMX -INSN - pand NONE mmxsse2 0xDB CPU_MMX -INSN - pandn NONE mmxsse2 0xDF CPU_MMX -INSN - pcmpeqb NONE mmxsse2 0x74 CPU_MMX -INSN - pcmpeqw NONE mmxsse2 0x75 CPU_MMX -INSN - pcmpeqd NONE mmxsse2 0x76 CPU_MMX -INSN - pcmpgtb NONE mmxsse2 0x64 CPU_MMX -INSN - pcmpgtw NONE mmxsse2 0x65 CPU_MMX -INSN - pcmpgtd NONE mmxsse2 0x66 CPU_MMX -INSN - pmaddwd NONE mmxsse2 0xF5 CPU_MMX -INSN - pmulhw NONE mmxsse2 0xE5 CPU_MMX -INSN - pmullw NONE mmxsse2 0xD5 CPU_MMX -INSN - por NONE mmxsse2 0xEB CPU_MMX -INSN - psllw NONE pshift 0x0671F1 CPU_MMX -INSN - pslld NONE pshift 0x0672F2 CPU_MMX -INSN - psllq NONE pshift 0x0673F3 CPU_MMX -INSN - psraw NONE pshift 0x0471E1 CPU_MMX -INSN - psrad NONE pshift 0x0472E2 CPU_MMX -INSN - psrlw NONE pshift 0x0271D1 CPU_MMX -INSN - psrld NONE pshift 0x0272D2 CPU_MMX -INSN - psrlq NONE pshift 0x0273D3 CPU_MMX -INSN - psubb NONE mmxsse2 0xF8 CPU_MMX -INSN - psubw NONE mmxsse2 0xF9 CPU_MMX -INSN - psubd NONE mmxsse2 0xFA CPU_MMX -INSN - psubq NONE mmxsse2 0xFB CPU_MMX -INSN - psubsb NONE mmxsse2 0xE8 CPU_MMX -INSN - psubsw NONE mmxsse2 0xE9 CPU_MMX -INSN - psubusb NONE mmxsse2 0xD8 CPU_MMX -INSN - psubusw NONE mmxsse2 0xD9 CPU_MMX -INSN - punpckhbw NONE mmxsse2 0x68 CPU_MMX -INSN - punpckhwd NONE mmxsse2 0x69 CPU_MMX -INSN - punpckhdq NONE mmxsse2 0x6A CPU_MMX -INSN - punpcklbw NONE mmxsse2 0x60 CPU_MMX -INSN - punpcklwd NONE mmxsse2 0x61 CPU_MMX -INSN - punpckldq NONE mmxsse2 0x62 CPU_MMX -INSN - pxor NONE mmxsse2 0xEF CPU_MMX -# PIII Katmai new instructions / SIMD instructions -INSN - addps NONE sseps 0x58 CPU_SSE -INSN - addss NONE ssess 0xF358 CPU_SSE -INSN - andnps NONE sseps 0x55 CPU_SSE -INSN - andps NONE sseps 0x54 CPU_SSE -INSN - cmpeqps NONE ssecmpps 0x00 CPU_SSE -INSN - cmpeqss NONE ssecmpss 0x00F3 CPU_SSE -INSN - cmpleps NONE ssecmpps 0x02 CPU_SSE -INSN - cmpless NONE ssecmpss 0x02F3 CPU_SSE -INSN - cmpltps NONE ssecmpps 0x01 CPU_SSE -INSN - cmpltss NONE ssecmpss 0x01F3 CPU_SSE -INSN - cmpneqps NONE ssecmpps 0x04 CPU_SSE -INSN - cmpneqss NONE ssecmpss 0x04F3 CPU_SSE -INSN - cmpnleps NONE ssecmpps 0x06 CPU_SSE -INSN - cmpnless NONE ssecmpss 0x06F3 CPU_SSE -INSN - cmpnltps NONE ssecmpps 0x05 CPU_SSE -INSN - cmpnltss NONE ssecmpss 0x05F3 CPU_SSE -INSN - cmpordps NONE ssecmpps 0x07 CPU_SSE -INSN - cmpordss NONE ssecmpss 0x07F3 CPU_SSE -INSN - cmpunordps NONE ssecmpps 0x03 CPU_SSE -INSN - cmpunordss NONE ssecmpss 0x03F3 CPU_SSE -INSN - cmpps NONE ssepsimm 0xC2 CPU_SSE -INSN - cmpss NONE ssessimm 0xF3C2 CPU_SSE -INSN - comiss NONE sseps 0x2F CPU_SSE -INSN - cvtpi2ps NONE cvt_xmm_mm_ps 0x2A CPU_SSE -INSN - cvtps2pi NONE cvt_mm_xmm64 0x2D CPU_SSE -INSN - cvtsi2ss "lq" cvt_xmm_rmx 0xF32A CPU_SSE -INSN - cvtss2si "lq" cvt_rx_xmm32 0xF32D CPU_SSE -INSN - cvttps2pi NONE cvt_mm_xmm64 0x2C CPU_SSE -INSN - cvttss2si "lq" cvt_rx_xmm32 0xF32C CPU_SSE -INSN - divps NONE sseps 0x5E CPU_SSE -INSN - divss NONE ssess 0xF35E CPU_SSE -INSN - ldmxcsr NONE ldstmxcsr 0x02 CPU_SSE -INSN - maskmovq NONE maskmovq 0 CPU_P3|CPU_MMX -INSN - maxps NONE sseps 0x5F CPU_SSE -INSN - maxss NONE ssess 0xF35F CPU_SSE -INSN - minps NONE sseps 0x5D CPU_SSE -INSN - minss NONE ssess 0xF35D CPU_SSE -INSN - movaps NONE movaups 0x28 CPU_SSE -INSN - movhlps NONE movhllhps 0x12 CPU_SSE -INSN - movhps NONE movhlps 0x16 CPU_SSE -INSN - movlhps NONE movhllhps 0x16 CPU_SSE -INSN - movlps NONE movhlps 0x12 CPU_SSE -INSN - movmskps "lq" movmskps 0 CPU_SSE -INSN - movntps NONE movntps 0 CPU_SSE -INSN - movntq NONE movntq 0 CPU_SSE -INSN - movss NONE movss 0 CPU_SSE -INSN - movups NONE movaups 0x10 CPU_SSE -INSN - mulps NONE sseps 0x59 CPU_SSE -INSN - mulss NONE ssess 0xF359 CPU_SSE -INSN - orps NONE sseps 0x56 CPU_SSE -INSN - pavgb NONE mmxsse2 0xE0 CPU_P3|CPU_MMX -INSN - pavgw NONE mmxsse2 0xE3 CPU_P3|CPU_MMX -INSN - pextrw "lq" pextrw 0 CPU_P3|CPU_MMX -INSN - pinsrw "lq" pinsrw 0 CPU_P3|CPU_MMX -INSN - pmaxsw NONE mmxsse2 0xEE CPU_P3|CPU_MMX -INSN - pmaxub NONE mmxsse2 0xDE CPU_P3|CPU_MMX -INSN - pminsw NONE mmxsse2 0xEA CPU_P3|CPU_MMX -INSN - pminub NONE mmxsse2 0xDA CPU_P3|CPU_MMX -INSN - pmovmskb "lq" pmovmskb 0 CPU_SSE -INSN - pmulhuw NONE mmxsse2 0xE4 CPU_P3|CPU_MMX -INSN - prefetchnta NONE twobytemem 0x000F18 CPU_P3 -INSN - prefetcht0 NONE twobytemem 0x010F18 CPU_P3 -INSN - prefetcht1 NONE twobytemem 0x020F18 CPU_P3 -INSN - prefetcht2 NONE twobytemem 0x030F18 CPU_P3 -INSN - psadbw NONE mmxsse2 0xF6 CPU_P3|CPU_MMX -INSN - pshufw NONE pshufw 0 CPU_P3|CPU_MMX -INSN - rcpps NONE sseps 0x53 CPU_SSE -INSN - rcpss NONE ssess 0xF353 CPU_SSE -INSN - rsqrtps NONE sseps 0x52 CPU_SSE -INSN - rsqrtss NONE ssess 0xF352 CPU_SSE -INSN - sfence NONE threebyte 0x0FAEF8 CPU_P3 -INSN - shufps NONE ssepsimm 0xC6 CPU_SSE -INSN - sqrtps NONE sseps 0x51 CPU_SSE -INSN - sqrtss NONE ssess 0xF351 CPU_SSE -INSN - stmxcsr NONE ldstmxcsr 0x03 CPU_SSE -INSN - subps NONE sseps 0x5C CPU_SSE -INSN - subss NONE ssess 0xF35C CPU_SSE -INSN - ucomiss NONE ssess 0x2E CPU_SSE -INSN - unpckhps NONE sseps 0x15 CPU_SSE -INSN - unpcklps NONE sseps 0x14 CPU_SSE -INSN - xorps NONE sseps 0x57 CPU_SSE -# SSE2 instructions -INSN - addpd NONE ssess 0x6658 CPU_SSE2 -INSN - addsd NONE ssess 0xF258 CPU_SSE2 -INSN - andnpd NONE ssess 0x6655 CPU_SSE2 -INSN - andpd NONE ssess 0x6654 CPU_SSE2 -INSN - cmpeqpd NONE ssecmpss 0x0066 CPU_SSE2 -INSN - cmpeqsd NONE ssecmpss 0x00F2 CPU_SSE2 -INSN - cmplepd NONE ssecmpss 0x0266 CPU_SSE2 -INSN - cmplesd NONE ssecmpss 0x02F2 CPU_SSE2 -INSN - cmpltpd NONE ssecmpss 0x0166 CPU_SSE2 -INSN - cmpltsd NONE ssecmpss 0x01F2 CPU_SSE2 -INSN - cmpneqpd NONE ssecmpss 0x0466 CPU_SSE2 -INSN - cmpneqsd NONE ssecmpss 0x04F2 CPU_SSE2 -INSN - cmpnlepd NONE ssecmpss 0x0666 CPU_SSE2 -INSN - cmpnlesd NONE ssecmpss 0x06F2 CPU_SSE2 -INSN - cmpnltpd NONE ssecmpss 0x0566 CPU_SSE2 -INSN - cmpnltsd NONE ssecmpss 0x05F2 CPU_SSE2 -INSN - cmpordpd NONE ssecmpss 0x0766 CPU_SSE2 -INSN - cmpordsd NONE ssecmpss 0x07F2 CPU_SSE2 -INSN - cmpunordpd NONE ssecmpss 0x0366 CPU_SSE2 -INSN - cmpunordsd NONE ssecmpss 0x03F2 CPU_SSE2 -INSN - cmppd NONE ssessimm 0x66C2 CPU_SSE2 -# cmpsd is in string instructions above -INSN - comisd NONE ssess 0x662F CPU_SSE2 -INSN - cvtpi2pd NONE cvt_xmm_mm_ss 0x662A CPU_SSE2 -INSN - cvtsi2sd "lq" cvt_xmm_rmx 0xF22A CPU_SSE2 -INSN - divpd NONE ssess 0x665E CPU_SSE2 -INSN - divsd NONE ssess 0xF25E CPU_SSE2 -INSN - maxpd NONE ssess 0x665F CPU_SSE2 -INSN - maxsd NONE ssess 0xF25F CPU_SSE2 -INSN - minpd NONE ssess 0x665D CPU_SSE2 -INSN - minsd NONE ssess 0xF25D CPU_SSE2 -INSN - movapd NONE movaupd 0x28 CPU_SSE2 -INSN - movhpd NONE movhlpd 0x16 CPU_SSE2 -INSN - movlpd NONE movhlpd 0x12 CPU_SSE2 -INSN - movmskpd "lq" movmskpd 0 CPU_SSE2 -INSN - movntpd NONE movntpddq 0x2B CPU_SSE2 -INSN - movntdq NONE movntpddq 0xE7 CPU_SSE2 -# movsd is in string instructions above -INSN - movupd NONE movaupd 0x10 CPU_SSE2 -INSN - mulpd NONE ssess 0x6659 CPU_SSE2 -INSN - mulsd NONE ssess 0xF259 CPU_SSE2 -INSN - orpd NONE ssess 0x6656 CPU_SSE2 -INSN - shufpd NONE ssessimm 0x66C6 CPU_SSE2 -INSN - sqrtpd NONE ssess 0x6651 CPU_SSE2 -INSN - sqrtsd NONE ssess 0xF251 CPU_SSE2 -INSN - subpd NONE ssess 0x665C CPU_SSE2 -INSN - subsd NONE ssess 0xF25C CPU_SSE2 -INSN - ucomisd NONE ssess 0x662E CPU_SSE2 -INSN - unpckhpd NONE ssess 0x6615 CPU_SSE2 -INSN - unpcklpd NONE ssess 0x6614 CPU_SSE2 -INSN - xorpd NONE ssess 0x6657 CPU_SSE2 -INSN - cvtdq2pd NONE cvt_xmm_xmm64_ss 0xF3E6 CPU_SSE2 -INSN - cvtpd2dq NONE ssess 0xF2E6 CPU_SSE2 -INSN - cvtdq2ps NONE sseps 0x5B CPU_SSE2 -INSN - cvtpd2pi NONE cvt_mm_xmm 0x662D CPU_SSE2 -INSN - cvtpd2ps NONE ssess 0x665A CPU_SSE2 -INSN - cvtps2pd NONE cvt_xmm_xmm64_ps 0x5A CPU_SSE2 -INSN - cvtps2dq NONE ssess 0x665B CPU_SSE2 -INSN - cvtsd2si "lq" cvt_rx_xmm64 0xF22D CPU_SSE2 -INSN - cvtsd2ss NONE cvt_xmm_xmm64_ss 0xF25A CPU_SSE2 -# P4 VMX Instructions -INSN - vmcall NONE threebyte 0x0F01C1 CPU_P4 -INSN - vmlaunch NONE threebyte 0x0F01C2 CPU_P4 -INSN - vmresume NONE threebyte 0x0F01C3 CPU_P4 -INSN - vmxoff NONE threebyte 0x0F01C4 CPU_P4 -INSN - vmread "lq" vmxmemrd 0x0F78 CPU_P4 -INSN - vmwrite "lq" vmxmemwr 0x0F79 CPU_P4 -INSN - vmptrld NONE vmxtwobytemem 0x06C7 CPU_P4 -INSN - vmptrst NONE vmxtwobytemem 0x07C7 CPU_P4 -INSN - vmclear NONE vmxthreebytemem 0x0666C7 CPU_P4 -INSN - vmxon NONE vmxthreebytemem 0x06F3C7 CPU_P4 -INSN - cvtss2sd NONE cvt_xmm_xmm32 0xF35A CPU_SSE2 -INSN - cvttpd2pi NONE cvt_mm_xmm 0x662C CPU_SSE2 -INSN - cvttsd2si "lq" cvt_rx_xmm64 0xF22C CPU_SSE2 -INSN - cvttpd2dq NONE ssess 0x66E6 CPU_SSE2 -INSN - cvttps2dq NONE ssess 0xF35B CPU_SSE2 -INSN - maskmovdqu NONE maskmovdqu 0 CPU_SSE2 -INSN - movdqa NONE movdqau 0x66 CPU_SSE2 -INSN - movdqu NONE movdqau 0xF3 CPU_SSE2 -INSN - movdq2q NONE movdq2q 0 CPU_SSE2 -INSN - movq2dq NONE movq2dq 0 CPU_SSE2 -INSN - pmuludq NONE mmxsse2 0xF4 CPU_SSE2 -INSN - pshufd NONE ssessimm 0x6670 CPU_SSE2 -INSN - pshufhw NONE ssessimm 0xF370 CPU_SSE2 -INSN - pshuflw NONE ssessimm 0xF270 CPU_SSE2 -INSN - pslldq NONE pslrldq 0x07 CPU_SSE2 -INSN - psrldq NONE pslrldq 0x03 CPU_SSE2 -INSN - punpckhqdq NONE ssess 0x666D CPU_SSE2 -INSN - punpcklqdq NONE ssess 0x666C CPU_SSE2 -# SSE3 / PNI Prescott New Instructions instructions -INSN - addsubpd NONE ssess 0x66D0 CPU_SSE3 -INSN - addsubps NONE ssess 0xF2D0 CPU_SSE3 -INSN - fisttp "lqs" fildstp 0x010001 CPU_SSE3 -INSN gas fisttpll SUF_Q fildstp 0x07 CPU_FPU -INSN - haddpd NONE ssess 0x667C CPU_SSE3 -INSN - haddps NONE ssess 0xF27C CPU_SSE3 -INSN - hsubpd NONE ssess 0x667D CPU_SSE3 -INSN - hsubps NONE ssess 0xF27D CPU_SSE3 -INSN - lddqu NONE lddqu 0 CPU_SSE3 -INSN - monitor NONE threebyte 0x0F01C8 CPU_SSE3 -INSN - movddup NONE cvt_xmm_xmm64_ss 0xF212 CPU_SSE3 -INSN - movshdup NONE ssess 0xF316 CPU_SSE3 -INSN - movsldup NONE ssess 0xF312 CPU_SSE3 -INSN - mwait NONE threebyte 0x0F01C9 CPU_SSE3 -# SSSE3 / TNI Tejas New Intructions instructions -INSN - pshufb NONE ssse3 0x00 CPU_SSSE3 -INSN - phaddw NONE ssse3 0x01 CPU_SSSE3 -INSN - phaddd NONE ssse3 0x02 CPU_SSSE3 -INSN - phaddsw NONE ssse3 0x03 CPU_SSSE3 -INSN - pmaddubsw NONE ssse3 0x04 CPU_SSSE3 -INSN - phsubw NONE ssse3 0x05 CPU_SSSE3 -INSN - phsubd NONE ssse3 0x06 CPU_SSSE3 -INSN - phsubsw NONE ssse3 0x07 CPU_SSSE3 -INSN - psignb NONE ssse3 0x08 CPU_SSSE3 -INSN - psignw NONE ssse3 0x09 CPU_SSSE3 -INSN - psignd NONE ssse3 0x0A CPU_SSSE3 -INSN - pmulhrsw NONE ssse3 0x0B CPU_SSSE3 -INSN - pabsb NONE ssse3 0x1C CPU_SSSE3 -INSN - pabsw NONE ssse3 0x1D CPU_SSSE3 -INSN - pabsd NONE ssse3 0x1E CPU_SSSE3 -INSN - palignr NONE ssse3imm 0x0F CPU_SSSE3 -# SSE4.1 / SSE4.2 instructions -INSN - blendpd NONE sse4imm 0x0D CPU_SSE41 -INSN - blendps NONE sse4imm 0x0C CPU_SSE41 -INSN - blendvpd NONE sse4xmm0 0x15 CPU_SSE41 -INSN - blendvps NONE sse4xmm0 0x14 CPU_SSE41 -INSN - crc32 "bwlq" crc32 0 CPU_SSE42 -INSN - dppd NONE sse4imm 0x41 CPU_SSE41 -INSN - dpps NONE sse4imm 0x40 CPU_SSE41 -INSN - extractps NONE extractps 0 CPU_SSE41 -INSN - insertps NONE insertps 0 CPU_SSE41 -INSN - movntdqa NONE movntdqa 0 CPU_SSE41 -INSN - mpsadbw NONE sse4imm 0x42 CPU_SSE41 -INSN - packusdw NONE sse4 0x2B CPU_SSE41 -INSN - pblendvb NONE sse4xmm0 0x10 CPU_SSE41 -INSN - pblendw NONE sse4imm 0x0E CPU_SSE41 -INSN - pcmpeqq NONE sse4 0x29 CPU_SSE41 -INSN - pcmpestri "wlq" sse4pcmpstr 0x61 CPU_SSE42 -INSN - pcmpestrm "wlq" sse4pcmpstr 0x60 CPU_SSE42 -INSN - pcmpistri "wlq" sse4pcmpstr 0x63 CPU_SSE42 -INSN - pcmpistrm "wlq" sse4pcmpstr 0x62 CPU_SSE42 -INSN - pcmpgtq NONE sse4 0x37 CPU_SSE42 -INSN - pextrb NONE pextrb 0 CPU_SSE41 -INSN - pextrd NONE pextrd 0 CPU_SSE41 -INSN - pextrq NONE pextrq 0 CPU_SSE41 -#INSN - pextrw NONE pextrw 0 CPU_SSE41 -INSN - phminposuw NONE sse4 0x41 CPU_SSE41 -INSN - pinsrb NONE pinsrb 0 CPU_SSE41 -INSN - pinsrd NONE pinsrd 0 CPU_SSE41 -INSN - pinsrq NONE pinsrq 0 CPU_SSE41 -INSN - pmaxsb NONE sse4 0x3C CPU_SSE41 -INSN - pmaxsd NONE sse4 0x3D CPU_SSE41 -INSN - pmaxud NONE sse4 0x3F CPU_SSE41 -INSN - pmaxuw NONE sse4 0x3E CPU_SSE41 -INSN - pminsb NONE sse4 0x38 CPU_SSE41 -INSN - pminsd NONE sse4 0x39 CPU_SSE41 -INSN - pminud NONE sse4 0x3B CPU_SSE41 -INSN - pminuw NONE sse4 0x3A CPU_SSE41 -INSN - pmovsxbw NONE sse4m64 0x20 CPU_SSE41 -INSN - pmovsxbd NONE sse4m32 0x21 CPU_SSE41 -INSN - pmovsxbq NONE sse4m16 0x22 CPU_SSE41 -INSN - pmovsxwd NONE sse4m64 0x23 CPU_SSE41 -INSN - pmovsxwq NONE sse4m32 0x24 CPU_SSE41 -INSN - pmovsxdq NONE sse4m64 0x25 CPU_SSE41 -INSN - pmovzxbw NONE sse4m64 0x30 CPU_SSE41 -INSN - pmovzxbd NONE sse4m32 0x31 CPU_SSE41 -INSN - pmovzxbq NONE sse4m16 0x32 CPU_SSE41 -INSN - pmovzxwd NONE sse4m64 0x33 CPU_SSE41 -INSN - pmovzxwq NONE sse4m32 0x34 CPU_SSE41 -INSN - pmovzxdq NONE sse4m64 0x35 CPU_SSE41 -INSN - pmuldq NONE sse4 0x28 CPU_SSE41 -INSN - pmulld NONE sse4 0x40 CPU_SSE41 -INSN - popcnt "wlq" popcnt 0 CPU_SSE42 -INSN - ptest NONE sse4 0x17 CPU_SSE41 -INSN - roundpd NONE sse4imm 0x09 CPU_SSE41 -INSN - roundps NONE sse4imm 0x08 CPU_SSE41 -INSN - roundsd NONE sse4imm 0x0B CPU_SSE41 -INSN - roundss NONE sse4imm 0x0A CPU_SSE41 -# AMD 3DNow! instructions -INSN - prefetch NONE twobytemem 0x000F0D CPU_3DNow -INSN - prefetchw NONE twobytemem 0x010F0D CPU_3DNow -INSN - femms NONE twobyte 0x0F0E CPU_3DNow -INSN - pavgusb NONE now3d 0xBF CPU_3DNow -INSN - pf2id NONE now3d 0x1D CPU_3DNow -INSN - pf2iw NONE now3d 0x1C CPU_Athlon|CPU_3DNow -INSN - pfacc NONE now3d 0xAE CPU_3DNow -INSN - pfadd NONE now3d 0x9E CPU_3DNow -INSN - pfcmpeq NONE now3d 0xB0 CPU_3DNow -INSN - pfcmpge NONE now3d 0x90 CPU_3DNow -INSN - pfcmpgt NONE now3d 0xA0 CPU_3DNow -INSN - pfmax NONE now3d 0xA4 CPU_3DNow -INSN - pfmin NONE now3d 0x94 CPU_3DNow -INSN - pfmul NONE now3d 0xB4 CPU_3DNow -INSN - pfnacc NONE now3d 0x8A CPU_Athlon|CPU_3DNow -INSN - pfpnacc NONE now3d 0x8E CPU_Athlon|CPU_3DNow -INSN - pfrcp NONE now3d 0x96 CPU_3DNow -INSN - pfrcpit1 NONE now3d 0xA6 CPU_3DNow -INSN - pfrcpit2 NONE now3d 0xB6 CPU_3DNow -INSN - pfrsqit1 NONE now3d 0xA7 CPU_3DNow -INSN - pfrsqrt NONE now3d 0x97 CPU_3DNow -INSN - pfsub NONE now3d 0x9A CPU_3DNow -INSN - pfsubr NONE now3d 0xAA CPU_3DNow -INSN - pi2fd NONE now3d 0x0D CPU_3DNow -INSN - pi2fw NONE now3d 0x0C CPU_Athlon|CPU_3DNow -INSN - pmulhrwa NONE now3d 0xB7 CPU_3DNow -INSN - pswapd NONE now3d 0xBB CPU_Athlon|CPU_3DNow -# AMD extensions -INSN - syscall NONE twobyte 0x0F05 CPU_686|CPU_AMD -INSN - sysret "lq" twobyte 0x0F07 CPU_686|CPU_AMD|CPU_Priv -# AMD x86-64 extensions -INSN - swapgs NONE threebyte 0x0F01F8 CPU_Hammer|CPU_64 -INSN - rdtscp NONE threebyte 0x0F01F9 CPU_686|CPU_AMD|CPU_Priv -INSN - cmpxchg16b NONE cmpxchg16b 0 CPU_Hammer|CPU_64 -# AMD Pacifica SVM instructions -INSN - clgi NONE threebyte 0x0F01DD CPU_SVM -INSN - invlpga NONE invlpga 0 CPU_SVM -INSN - skinit NONE skinit 0 CPU_SVM -INSN - stgi NONE threebyte 0x0F01DC CPU_SVM -INSN - vmload NONE svm_rax 0xDA CPU_SVM -INSN - vmmcall NONE threebyte 0x0F01D9 CPU_SVM -INSN - vmrun NONE svm_rax 0xD8 CPU_SVM -INSN - vmsave NONE svm_rax 0xDB CPU_SVM -# VIA PadLock instructions -INSN - xstore NONE padlock 0xC000A7 CPU_PadLock -INSN - xstorerng NONE padlock 0xC000A7 CPU_PadLock -INSN - xcryptecb NONE padlock 0xC8F3A7 CPU_PadLock -INSN - xcryptcbc NONE padlock 0xD0F3A7 CPU_PadLock -INSN - xcryptctr NONE padlock 0xD8F3A7 CPU_PadLock -INSN - xcryptcfb NONE padlock 0xE0F3A7 CPU_PadLock -INSN - xcryptofb NONE padlock 0xE8F3A7 CPU_PadLock -INSN - montmul NONE padlock 0xC0F3A6 CPU_PadLock -INSN - xsha1 NONE padlock 0xC8F3A6 CPU_PadLock -INSN - xsha256 NONE padlock 0xD0F3A6 CPU_PadLock -# Cyrix MMX instructions -INSN - paddsiw NONE cyrixmmx 0x51 CPU_Cyrix|CPU_MMX -INSN - paveb NONE cyrixmmx 0x50 CPU_Cyrix|CPU_MMX -INSN - pdistib NONE cyrixmmx 0x54 CPU_Cyrix|CPU_MMX -INSN - pmachriw NONE pmachriw 0 CPU_Cyrix|CPU_MMX -INSN - pmagw NONE cyrixmmx 0x52 CPU_Cyrix|CPU_MMX -INSN - pmulhriw NONE cyrixmmx 0x5D CPU_Cyrix|CPU_MMX -INSN - pmulhrwc NONE cyrixmmx 0x59 CPU_Cyrix|CPU_MMX -INSN - pmvgezb NONE cyrixmmx 0x5C CPU_Cyrix|CPU_MMX -INSN - pmvlzb NONE cyrixmmx 0x5B CPU_Cyrix|CPU_MMX -INSN - pmvnzb NONE cyrixmmx 0x5A CPU_Cyrix|CPU_MMX -INSN - pmvzb NONE cyrixmmx 0x58 CPU_Cyrix|CPU_MMX -INSN - psubsiw NONE cyrixmmx 0x55 CPU_Cyrix|CPU_MMX -# Cyrix extensions -INSN - rdshr NONE rdwrshr 0x00 CPU_686|CPU_Cyrix|CPU_SMM -INSN - rsdc NONE rsdc 0 CPU_486|CPU_Cyrix|CPU_SMM -INSN - rsldt NONE cyrixsmm 0x7B CPU_486|CPU_Cyrix|CPU_SMM -INSN - rsts NONE cyrixsmm 0x7D CPU_486|CPU_Cyrix|CPU_SMM -INSN - svdc NONE svdc 0 CPU_486|CPU_Cyrix|CPU_SMM -INSN - svldt NONE cyrixsmm 0x7A CPU_486|CPU_Cyrix|CPU_SMM -INSN - svts NONE cyrixsmm 0x7C CPU_486|CPU_Cyrix|CPU_SMM -INSN - smint NONE twobyte 0x0F38 CPU_686|CPU_Cyrix -INSN - smintold NONE twobyte 0x0F7E CPU_486|CPU_Cyrix|CPU_Obs -INSN - wrshr NONE rdwrshr 0x01 CPU_686|CPU_Cyrix|CPU_SMM -# Obsolete/undocumented instructions -INSN - fsetpm NONE twobyte 0xDBE4 CPU_286|CPU_FPU|CPU_Obs -INSN - ibts NONE ibts 0 CPU_386|CPU_Undoc|CPU_Obs -INSN - loadall NONE twobyte 0x0F07 CPU_386|CPU_Undoc -INSN - loadall286 NONE twobyte 0x0F05 CPU_286|CPU_Undoc -INSN - salc NONE onebyte 0x00D6 CPU_Undoc|CPU_Not64 -INSN - smi NONE onebyte 0x00F1 CPU_386|CPU_Undoc -INSN - umov NONE umov 0 CPU_386|CPU_Undoc -INSN - xbts NONE xbts 0 CPU_386|CPU_Undoc|CPU_Obs - - -# DEF_CPU parameters: -# - CPU name -# - CPU flags to set -# DEF_CPU_ALIAS parameters: -# - CPU alias name -# - CPU base name -# DEF_CPU_FEATURE parameters: -# - CPU feature name -# - CPU flag to set feature name alone or unset ("no" + feature name) - -# The standard CPU names /set/ cpu_enabled. -CPU 8086 CPU_Priv -CPU 186 CPU_186|CPU_Priv -CPU_ALIAS 80186 186 -CPU_ALIAS i186 186 -CPU 286 CPU_186|CPU_286|CPU_Priv -CPU_ALIAS 80286 286 -CPU_ALIAS i286 286 -CPU 386 CPU_186|CPU_286|CPU_386|CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS 80386 386 -CPU_ALIAS i386 386 -CPU 486 CPU_186|CPU_286|CPU_386|CPU_486|CPU_FPU|CPU_SMM|\ - CPU_Prot|CPU_Priv -CPU_ALIAS 80486 486 -CPU_ALIAS i486 486 -CPU 586 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_FPU|\ - CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS i586 586 -CPU_ALIAS pentium 586 -CPU_ALIAS p5 586 -CPU 686 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_FPU|CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS i686 686 -CPU_ALIAS p6 686 -CPU_ALIAS ppro 686 -CPU_ALIAS pentiumpro 686 -CPU p2 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_FPU|CPU_MMX|CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS pentium2 p2 -CPU_ALIAS pentium-2 p2 -CPU_ALIAS pentiumii p2 -CPU_ALIAS pentium-ii p2 -CPU p3 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_P3|CPU_FPU|CPU_MMX|CPU_SSE|CPU_SMM|CPU_Prot|\ - CPU_Priv -CPU_ALIAS pentium3 p3 -CPU_ALIAS pentium-3 p3 -CPU_ALIAS pentiumiii p3 -CPU_ALIAS pentium-iii p3 -CPU_ALIAS katmai p3 -CPU p4 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_P3|CPU_P4|CPU_FPU|CPU_MMX|CPU_SSE|CPU_SSE2|\ - CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS pentium4 p4 -CPU_ALIAS pentium-4 p4 -CPU_ALIAS pentiumiv p4 -CPU_ALIAS pentium-iv p4 -CPU_ALIAS williamette p4 -CPU ia64 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_P3|CPU_P4|CPU_IA64|CPU_FPU|CPU_MMX|CPU_SSE|\ - CPU_SSE2|CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS ia-64 ia64 -CPU_ALIAS itanium ia64 -CPU k6 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_K6|CPU_FPU|CPU_MMX|CPU_3DNow|CPU_SMM|CPU_Prot|\ - CPU_Priv -CPU k7 CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_K6|CPU_Athlon|CPU_FPU|CPU_MMX|CPU_SSE|CPU_3DNow|\ - CPU_SMM|CPU_Prot|CPU_Priv -CPU_ALIAS athlon k7 -CPU hammer CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_K6|CPU_Athlon|CPU_Hammer|CPU_FPU|CPU_MMX|\ - CPU_SSE|CPU_SSE2|CPU_3DNow|CPU_SMM|CPU_Prot|\ - CPU_Priv -CPU_ALIAS sledgehammer hammer -CPU_ALIAS opteron hammer -CPU_ALIAS athlon64 hammer -CPU_ALIAS athlon-64 hammer -CPU prescott CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_Hammer|CPU_EM64T|CPU_FPU|CPU_MMX|\ - CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SMM|\ - CPU_Prot|CPU_Priv -CPU conroe CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_Hammer|CPU_EM64T|CPU_FPU|CPU_MMX|\ - CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SMM|\ - CPU_Prot|CPU_Priv -CPU penryn CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_Hammer|CPU_EM64T|CPU_FPU|CPU_MMX|\ - CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SSE41|CPU_SMM|\ - CPU_Prot|CPU_Priv -CPU nehalem CPU_186|CPU_286|CPU_386|CPU_486|CPU_586|CPU_686|\ - CPU_Hammer|CPU_EM64T|CPU_FPU|CPU_MMX|\ - CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SSE41|\ - CPU_SSE42|CPU_SMM|CPU_Prot|CPU_Priv - -# Features have "no" versions to disable them, and only set/reset the -# specific feature being changed. All other bits are left alone. - -CPU_FEATURE fpu CPU_FPU -CPU_FEATURE mmx CPU_MMX -CPU_FEATURE sse CPU_SSE -CPU_FEATURE sse2 CPU_SSE2 -CPU_FEATURE sse3 CPU_SSE3 -#CPU_FEATURE pni CPU_PNI -CPU_FEATURE 3dnow CPU_3DNow -CPU_FEATURE cyrix CPU_Cyrix -CPU_FEATURE amd CPU_AMD -CPU_FEATURE smm CPU_SMM -CPU_FEATURE prot CPU_Prot -CPU_FEATURE protected CPU_Prot -CPU_FEATURE undoc CPU_Undoc -CPU_FEATURE undocumented CPU_Undoc -CPU_FEATURE obs CPU_Obs -CPU_FEATURE obsolete CPU_Obs -CPU_FEATURE priv CPU_Priv -CPU_FEATURE privileged CPU_Priv -CPU_FEATURE svm CPU_SVM -CPU_FEATURE padlock CPU_PadLock -CPU_FEATURE em64t CPU_EM64T -CPU_FEATURE ssse3 CPU_SSSE3 -CPU_FEATURE sse4.1 CPU_SSE41 -CPU_FEATURE sse4.2 CPU_SSE42 -CPU_FEATURE sse4 CPU_SSE4 - - -# TARGETMOD parameters: -# - target modifier name -# - modifier to return - -TARGETMOD near X86_NEAR -TARGETMOD short X86_SHORT -TARGETMOD far X86_FAR -TARGETMOD to X86_TO - - -# PREFIX parameters: -# - parser -# - prefix name -# - prefix type -# - prefix value - -# operand size overrides -PREFIX nasm o16 X86_OPERSIZE 16 -PREFIX gas data16 X86_OPERSIZE 16 -PREFIX gas word X86_OPERSIZE 16 -PREFIX nasm o32 X86_OPERSIZE 32 -PREFIX gas data32 X86_OPERSIZE 32 -PREFIX gas dword X86_OPERSIZE 32 -PREFIX nasm o64 X86_OPERSIZE 64 -PREFIX gas data64 X86_OPERSIZE 64 -PREFIX gas qword X86_OPERSIZE 64 - -# address size overrides -PREFIX nasm a16 X86_ADDRSIZE 16 -PREFIX gas addr16 X86_ADDRSIZE 16 -PREFIX gas aword X86_ADDRSIZE 16 -PREFIX nasm a32 X86_ADDRSIZE 32 -PREFIX gas addr32 X86_ADDRSIZE 32 -PREFIX gas adword X86_ADDRSIZE 32 -PREFIX nasm a64 X86_ADDRSIZE 64 -PREFIX gas addr64 X86_ADDRSIZE 64 -PREFIX gas aqword X86_ADDRSIZE 64 - -# instruction prefixes -PREFIX - lock X86_LOCKREP 0xF0 -PREFIX - repne X86_LOCKREP 0xF2 -PREFIX - repnz X86_LOCKREP 0xF2 -PREFIX - rep X86_LOCKREP 0xF3 -PREFIX - repe X86_LOCKREP 0xF3 -PREFIX - repz X86_LOCKREP 0xF3 - -# other prefixes, limited to GAS-only at the moment -# Hint taken/not taken for jumps -PREFIX gas ht X86_SEGREG 0x3E -PREFIX gas hnt X86_SEGREG 0x2E - -# REX byte explicit prefixes -PREFIX gas rex X86_REX 0x40 -PREFIX gas rexz X86_REX 0x41 -PREFIX gas rexy X86_REX 0x42 -PREFIX gas rexyz X86_REX 0x43 -PREFIX gas rexx X86_REX 0x44 -PREFIX gas rexxz X86_REX 0x45 -PREFIX gas rexxy X86_REX 0x46 -PREFIX gas rexxyz X86_REX 0x47 -PREFIX gas rex64 X86_REX 0x48 -PREFIX gas rex64z X86_REX 0x49 -PREFIX gas rex64y X86_REX 0x4A -PREFIX gas rex64yz X86_REX 0x4B -PREFIX gas rex64x X86_REX 0x4C -PREFIX gas rex64xz X86_REX 0x4D -PREFIX gas rex64xy X86_REX 0x4E -PREFIX gas rex64xyz X86_REX 0x4F - - -# REG parameters: -# - register name -# - register type -# - register index -# - required BITS setting (0 for any) -# -# REGGROUP parameters: -# - register group name -# - register group type -# -# SEGREG parameters: -# - segment register name -# - prefix encoding -# - register encoding -# - BITS in which the segment is ignored - -# control, debug, and test registers -REG cr0 X86_CRREG 0 0 -REG cr2 X86_CRREG 2 0 -REG cr3 X86_CRREG 3 0 -REG cr4 X86_CRREG 4 0 -REG cr8 X86_CRREG 8 64 - -REG dr0 X86_DRREG 0 0 -REG dr1 X86_DRREG 1 0 -REG dr2 X86_DRREG 2 0 -REG dr3 X86_DRREG 3 0 -REG dr4 X86_DRREG 4 0 -REG dr5 X86_DRREG 5 0 -REG dr6 X86_DRREG 6 0 -REG dr7 X86_DRREG 7 0 - -REG tr0 X86_TRREG 0 0 -REG tr1 X86_TRREG 1 0 -REG tr2 X86_TRREG 2 0 -REG tr3 X86_TRREG 3 0 -REG tr4 X86_TRREG 4 0 -REG tr5 X86_TRREG 5 0 -REG tr6 X86_TRREG 6 0 -REG tr7 X86_TRREG 7 0 - -# floating point, MMX, and SSE/SSE2 registers -REG st0 X86_FPUREG 0 0 -REG st1 X86_FPUREG 1 0 -REG st2 X86_FPUREG 2 0 -REG st3 X86_FPUREG 3 0 -REG st4 X86_FPUREG 4 0 -REG st5 X86_FPUREG 5 0 -REG st6 X86_FPUREG 6 0 -REG st7 X86_FPUREG 7 0 - -REG mm0 X86_MMXREG 0 0 -REG mm1 X86_MMXREG 1 0 -REG mm2 X86_MMXREG 2 0 -REG mm3 X86_MMXREG 3 0 -REG mm4 X86_MMXREG 4 0 -REG mm5 X86_MMXREG 5 0 -REG mm6 X86_MMXREG 6 0 -REG mm7 X86_MMXREG 7 0 - -REG xmm0 X86_XMMREG 0 0 -REG xmm1 X86_XMMREG 1 0 -REG xmm2 X86_XMMREG 2 0 -REG xmm3 X86_XMMREG 3 0 -REG xmm4 X86_XMMREG 4 0 -REG xmm5 X86_XMMREG 5 0 -REG xmm6 X86_XMMREG 6 0 -REG xmm7 X86_XMMREG 7 0 -REG xmm8 X86_XMMREG 8 64 -REG xmm9 X86_XMMREG 9 64 -REG xmm10 X86_XMMREG 10 64 -REG xmm11 X86_XMMREG 11 64 -REG xmm12 X86_XMMREG 12 64 -REG xmm13 X86_XMMREG 13 64 -REG xmm14 X86_XMMREG 14 64 -REG xmm15 X86_XMMREG 15 64 - -# integer registers -REG rax X86_REG64 0 64 -REG rcx X86_REG64 1 64 -REG rdx X86_REG64 2 64 -REG rbx X86_REG64 3 64 -REG rsp X86_REG64 4 64 -REG rbp X86_REG64 5 64 -REG rsi X86_REG64 6 64 -REG rdi X86_REG64 7 64 -REG r8 X86_REG64 8 64 -REG r9 X86_REG64 9 64 -REG r10 X86_REG64 10 64 -REG r11 X86_REG64 11 64 -REG r12 X86_REG64 12 64 -REG r13 X86_REG64 13 64 -REG r14 X86_REG64 14 64 -REG r15 X86_REG64 15 64 - -REG eax X86_REG32 0 0 -REG ecx X86_REG32 1 0 -REG edx X86_REG32 2 0 -REG ebx X86_REG32 3 0 -REG esp X86_REG32 4 0 -REG ebp X86_REG32 5 0 -REG esi X86_REG32 6 0 -REG edi X86_REG32 7 0 -REG r8d X86_REG32 8 64 -REG r9d X86_REG32 9 64 -REG r10d X86_REG32 10 64 -REG r11d X86_REG32 11 64 -REG r12d X86_REG32 12 64 -REG r13d X86_REG32 13 64 -REG r14d X86_REG32 14 64 -REG r15d X86_REG32 15 64 - -REG ax X86_REG16 0 0 -REG cx X86_REG16 1 0 -REG dx X86_REG16 2 0 -REG bx X86_REG16 3 0 -REG sp X86_REG16 4 0 -REG bp X86_REG16 5 0 -REG si X86_REG16 6 0 -REG di X86_REG16 7 0 -REG r8w X86_REG16 8 64 -REG r9w X86_REG16 9 64 -REG r10w X86_REG16 10 64 -REG r11w X86_REG16 11 64 -REG r12w X86_REG16 12 64 -REG r13w X86_REG16 13 64 -REG r14w X86_REG16 14 64 -REG r15w X86_REG16 15 64 - -REG al X86_REG8 0 0 -REG cl X86_REG8 1 0 -REG dl X86_REG8 2 0 -REG bl X86_REG8 3 0 -REG ah X86_REG8 4 0 -REG ch X86_REG8 5 0 -REG dh X86_REG8 6 0 -REG bh X86_REG8 7 0 -REG r8b X86_REG8 8 64 -REG r9b X86_REG8 9 64 -REG r10b X86_REG8 10 64 -REG r11b X86_REG8 11 64 -REG r12b X86_REG8 12 64 -REG r13b X86_REG8 13 64 -REG r14b X86_REG8 14 64 -REG r15b X86_REG8 15 64 - -REG spl X86_REG8X 4 64 -REG bpl X86_REG8X 5 64 -REG sil X86_REG8X 6 64 -REG dil X86_REG8X 7 64 - -REG rip X86_RIP 0 64 - -# floating point, MMX, and SSE/SSE2 registers -REGGROUP st X86_FPUREG -REGGROUP mm X86_MMXREG -REGGROUP xmm X86_XMMREG - -# segment registers -SEGREG es 0x26 0x00 64 -SEGREG cs 0x2e 0x01 0 -SEGREG ss 0x36 0x02 64 -SEGREG ds 0x3e 0x03 64 -SEGREG fs 0x64 0x04 0 -SEGREG gs 0x65 0x05 0 - diff --git a/modules/arch/x86/x86regtmod.gperf b/modules/arch/x86/x86regtmod.gperf new file mode 100644 index 00000000..38986df0 --- /dev/null +++ b/modules/arch/x86/x86regtmod.gperf @@ -0,0 +1,297 @@ +# +# x86 register and target modifier recognition +# +# Copyright (C) 2002-2007 Peter Johnson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +%{ +#include + +#include +#include +#include + +#include "modules/arch/x86/x86arch.h" + +enum regtmod_type { + REG = 1, + REGGROUP, + SEGREG, + TARGETMOD +}; +%} +%ignore-case +%language=ANSI-C +%compare-strncmp +%readonly-tables +%enum +%struct-type +%define hash-function-name regtmod_hash +%define lookup-function-name regtmod_find +struct regtmod_parse_data { + const char *name; + unsigned int type:8; /* regtmod_type */ + + /* REG: register size + * SEGREG: prefix encoding + * Others: 0 + */ + unsigned int size_prefix:8; + + /* REG: register index + * REGGROUP: register group type + * SEGREG: register encoding + * TARGETMOD: target modifier + */ + unsigned int data:8; + + /* REG: required bits setting + * SEGREG: BITS in which the segment is ignored + * Others: 0 + */ + unsigned int bits:8; +}; +%% +# +# control, debug, and test registers +# +cr0, REG, X86_CRREG, 0, 0 +cr2, REG, X86_CRREG, 2, 0 +cr3, REG, X86_CRREG, 3, 0 +cr4, REG, X86_CRREG, 4, 0 +cr8, REG, X86_CRREG, 8, 64 +# +dr0, REG, X86_DRREG, 0, 0 +dr1, REG, X86_DRREG, 1, 0 +dr2, REG, X86_DRREG, 2, 0 +dr3, REG, X86_DRREG, 3, 0 +dr4, REG, X86_DRREG, 4, 0 +dr5, REG, X86_DRREG, 5, 0 +dr6, REG, X86_DRREG, 6, 0 +dr7, REG, X86_DRREG, 7, 0 +# +tr0, REG, X86_TRREG, 0, 0 +tr1, REG, X86_TRREG, 1, 0 +tr2, REG, X86_TRREG, 2, 0 +tr3, REG, X86_TRREG, 3, 0 +tr4, REG, X86_TRREG, 4, 0 +tr5, REG, X86_TRREG, 5, 0 +tr6, REG, X86_TRREG, 6, 0 +tr7, REG, X86_TRREG, 7, 0 +# +# floating point, MMX, and SSE/SSE2 registers +# +st0, REG, X86_FPUREG, 0, 0 +st1, REG, X86_FPUREG, 1, 0 +st2, REG, X86_FPUREG, 2, 0 +st3, REG, X86_FPUREG, 3, 0 +st4, REG, X86_FPUREG, 4, 0 +st5, REG, X86_FPUREG, 5, 0 +st6, REG, X86_FPUREG, 6, 0 +st7, REG, X86_FPUREG, 7, 0 +# +mm0, REG, X86_MMXREG, 0, 0 +mm1, REG, X86_MMXREG, 1, 0 +mm2, REG, X86_MMXREG, 2, 0 +mm3, REG, X86_MMXREG, 3, 0 +mm4, REG, X86_MMXREG, 4, 0 +mm5, REG, X86_MMXREG, 5, 0 +mm6, REG, X86_MMXREG, 6, 0 +mm7, REG, X86_MMXREG, 7, 0 +# +xmm0, REG, X86_XMMREG, 0, 0 +xmm1, REG, X86_XMMREG, 1, 0 +xmm2, REG, X86_XMMREG, 2, 0 +xmm3, REG, X86_XMMREG, 3, 0 +xmm4, REG, X86_XMMREG, 4, 0 +xmm5, REG, X86_XMMREG, 5, 0 +xmm6, REG, X86_XMMREG, 6, 0 +xmm7, REG, X86_XMMREG, 7, 0 +xmm8, REG, X86_XMMREG, 8, 64 +xmm9, REG, X86_XMMREG, 9, 64 +xmm10, REG, X86_XMMREG, 10, 64 +xmm11, REG, X86_XMMREG, 11, 64 +xmm12, REG, X86_XMMREG, 12, 64 +xmm13, REG, X86_XMMREG, 13, 64 +xmm14, REG, X86_XMMREG, 14, 64 +xmm15, REG, X86_XMMREG, 15, 64 +# AVX registers +ymm0, REG, X86_YMMREG, 0, 0 +ymm1, REG, X86_YMMREG, 1, 0 +ymm2, REG, X86_YMMREG, 2, 0 +ymm3, REG, X86_YMMREG, 3, 0 +ymm4, REG, X86_YMMREG, 4, 0 +ymm5, REG, X86_YMMREG, 5, 0 +ymm6, REG, X86_YMMREG, 6, 0 +ymm7, REG, X86_YMMREG, 7, 0 +ymm8, REG, X86_YMMREG, 8, 64 +ymm9, REG, X86_YMMREG, 9, 64 +ymm10, REG, X86_YMMREG, 10, 64 +ymm11, REG, X86_YMMREG, 11, 64 +ymm12, REG, X86_YMMREG, 12, 64 +ymm13, REG, X86_YMMREG, 13, 64 +ymm14, REG, X86_YMMREG, 14, 64 +ymm15, REG, X86_YMMREG, 15, 64 +# +# integer registers +# +rax, REG, X86_REG64, 0, 64 +rcx, REG, X86_REG64, 1, 64 +rdx, REG, X86_REG64, 2, 64 +rbx, REG, X86_REG64, 3, 64 +rsp, REG, X86_REG64, 4, 64 +rbp, REG, X86_REG64, 5, 64 +rsi, REG, X86_REG64, 6, 64 +rdi, REG, X86_REG64, 7, 64 +r8, REG, X86_REG64, 8, 64 +r9, REG, X86_REG64, 9, 64 +r10, REG, X86_REG64, 10, 64 +r11, REG, X86_REG64, 11, 64 +r12, REG, X86_REG64, 12, 64 +r13, REG, X86_REG64, 13, 64 +r14, REG, X86_REG64, 14, 64 +r15, REG, X86_REG64, 15, 64 +# +eax, REG, X86_REG32, 0, 0 +ecx, REG, X86_REG32, 1, 0 +edx, REG, X86_REG32, 2, 0 +ebx, REG, X86_REG32, 3, 0 +esp, REG, X86_REG32, 4, 0 +ebp, REG, X86_REG32, 5, 0 +esi, REG, X86_REG32, 6, 0 +edi, REG, X86_REG32, 7, 0 +r8d, REG, X86_REG32, 8, 64 +r9d, REG, X86_REG32, 9, 64 +r10d, REG, X86_REG32, 10, 64 +r11d, REG, X86_REG32, 11, 64 +r12d, REG, X86_REG32, 12, 64 +r13d, REG, X86_REG32, 13, 64 +r14d, REG, X86_REG32, 14, 64 +r15d, REG, X86_REG32, 15, 64 +# +ax, REG, X86_REG16, 0, 0 +cx, REG, X86_REG16, 1, 0 +dx, REG, X86_REG16, 2, 0 +bx, REG, X86_REG16, 3, 0 +sp, REG, X86_REG16, 4, 0 +bp, REG, X86_REG16, 5, 0 +si, REG, X86_REG16, 6, 0 +di, REG, X86_REG16, 7, 0 +r8w, REG, X86_REG16, 8, 64 +r9w, REG, X86_REG16, 9, 64 +r10w, REG, X86_REG16, 10, 64 +r11w, REG, X86_REG16, 11, 64 +r12w, REG, X86_REG16, 12, 64 +r13w, REG, X86_REG16, 13, 64 +r14w, REG, X86_REG16, 14, 64 +r15w, REG, X86_REG16, 15, 64 +# +al, REG, X86_REG8, 0, 0 +cl, REG, X86_REG8, 1, 0 +dl, REG, X86_REG8, 2, 0 +bl, REG, X86_REG8, 3, 0 +ah, REG, X86_REG8, 4, 0 +ch, REG, X86_REG8, 5, 0 +dh, REG, X86_REG8, 6, 0 +bh, REG, X86_REG8, 7, 0 +r8b, REG, X86_REG8, 8, 64 +r9b, REG, X86_REG8, 9, 64 +r10b, REG, X86_REG8, 10, 64 +r11b, REG, X86_REG8, 11, 64 +r12b, REG, X86_REG8, 12, 64 +r13b, REG, X86_REG8, 13, 64 +r14b, REG, X86_REG8, 14, 64 +r15b, REG, X86_REG8, 15, 64 +# +spl, REG, X86_REG8X, 4, 64 +bpl, REG, X86_REG8X, 5, 64 +sil, REG, X86_REG8X, 6, 64 +dil, REG, X86_REG8X, 7, 64 +# +rip, REG, X86_RIP, 0, 64 +# +# floating point, MMX, and SSE/SSE2 registers +# +st, REGGROUP, 0, X86_FPUREG, 0 +mm, REGGROUP, 0, X86_MMXREG, 0 +xmm, REGGROUP, 0, X86_XMMREG, 0 +ymm, REGGROUP, 0, X86_YMMREG, 0 +# +# segment registers +# +es, SEGREG, 0x26, 0x00, 64 +cs, SEGREG, 0x2e, 0x01, 0 +ss, SEGREG, 0x36, 0x02, 64 +ds, SEGREG, 0x3e, 0x03, 64 +fs, SEGREG, 0x64, 0x04, 0 +gs, SEGREG, 0x65, 0x05, 0 +# +# target modifiers +# +near, TARGETMOD, 0, X86_NEAR, 0 +short, TARGETMOD, 0, X86_SHORT, 0 +far, TARGETMOD, 0, X86_FAR, 0 +to, TARGETMOD, 0, X86_TO, 0 +%% + +yasm_arch_regtmod +yasm_x86__parse_check_regtmod(yasm_arch *arch, const char *id, size_t id_len, + uintptr_t *data) +{ + yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; + /*@null@*/ const struct regtmod_parse_data *pdata; + size_t i; + static char lcaseid[8]; + unsigned int bits; + yasm_arch_regtmod type; + + if (id_len > 7) + return YASM_ARCH_NOTREGTMOD; + for (i=0; itype; + bits = pdata->bits; + + if (type == YASM_ARCH_REG && bits != 0 && arch_x86->mode_bits != bits) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("`%s' is a register in %u-bit mode"), id, bits); + return YASM_ARCH_NOTREGTMOD; + } + + if (type == YASM_ARCH_SEGREG && bits != 0 && arch_x86->mode_bits == bits) { + yasm_warn_set(YASM_WARN_SEGREG_IN_64BIT, + N_("`%s' segment register ignored in %u-bit mode"), id, + bits); + } + + if (type == YASM_ARCH_SEGREG) + *data = (pdata->size_prefix<<8) | pdata->data; + else + *data = pdata->size_prefix | pdata->data; + return type; +} diff --git a/modules/arch/yasm_arch.xml b/modules/arch/yasm_arch.xml index 46002919..a35510c0 100644 --- a/modules/arch/yasm_arch.xml +++ b/modules/arch/yasm_arch.xml @@ -2,8 +2,6 @@ - - @@ -22,6 +20,7 @@ 2004 2005 2006 + 2007 Peter Johnson @@ -133,7 +132,9 @@ assembled will be run in 64-bit mode. To specify an AMD64 object file, use on the Yasm command line, or explicitly target a 64-bit object format such as or . + win64 or . can be used to select 32-bit ELF object format + for AMD64 processors. Register Changes @@ -229,6 +230,23 @@ mov ecx, -1 ; 5 byte, equivalent to above mov rcx, sym ; 5 byte, 32-bit size default for symbols mov rcx, qword sym ; 10 byte, override default size + + The handling of mov reg64, unsized immediate is different + between YASM and NASM 2.x; YASM follows the above behavior, while + NASM 2.x does the following: + + add rax, 0xffffffff ; sign-extended 32-bit immediate + add rax, -1 ; same as above + add rax, 0xffffffffffffffff ; truncated 32-bit (warning) + add rax, sym ; sign-extended 32-bit immediate + mov eax, 1 ; 5 byte (32-bit immediate) + mov rax, 1 ; 10 byte (64-bit immediate) + mov rbx, 0x1234567890abcdef ; 10 byte instruction + mov rcx, 0xffffffff ; 10 byte instruction + mov ecx, -1 ; 5 byte, equivalent to above + mov ecx, sym ; 5 byte (32-bit immediate) + mov rcx, sym ; 10 byte instruction + mov rcx, qword sym ; 10 byte (64-bit immediate) @@ -280,6 +298,67 @@ value 1 there. If symb is a variable, this will not store the value 1 into the symb variable! + + Yasm also supports the following syntax for RIP-relative + addressing: + + mov [rel sym], rax ; RIP-relative + mov [abs sym], rax ; not RIP-relative + + The behavior of: + + mov [sym], rax + + Depends on a mode set by the DEFAULT directive, as follows. + The default mode is always "abs", and in "rel" mode, use of + registers, an fs or gs segment override, or an explicit "abs" + override will result in a non-RIP-relative effective + address. + + default rel + mov [sym], rbx ; RIP-relative + mov [abs sym], rbx ; not RIP-relative (explicit override) + mov [rbx+1], rbx ; not RIP-relative (register use) + mov [fs:sym], rbx ; not RIP-relative (fs or gs use) + mov [ds:sym], rbx ; RIP-relative (segment, but not fs or gs) + mov [rel sym], rbx ; RIP-relative (redundant override) + + default abs + mov [sym], rbx ; not RIP-relative + mov [abs sym], rbx ; not RIP-relative + mov [rbx+1], rbx ; not RIP-relative + mov [fs:sym], rbx ; not RIP-relative + mov [ds:sym], rbx ; not RIP-relative + mov [rel sym], rbx ; RIP-relative (explicit override) + + + + Memory references + + Usually the size of a memory reference can be deduced by + which registers you're moving--for example, "mov [rax],ecx" is a + 32-bit move, because ecx is 32 bits. YASM currently gives the + non-obvious "invalid combination of opcode and operands" error if + it can't figure out how much memory you're moving. The fix in + this case is to add a memory size specifier: qword, dword, word, + or byte. + + Here's a 64-bit memory move, which sets 8 bytes starting at + rax: + + mov qword [rax], 1 + + Here's a 32-bit memory move, which sets 4 bytes: + + mov dword [rax], 1 + + Here's a 16-bit memory move, which sets 2 bytes: + + mov word [rax], 1 + + Here's an 8-bit memory move, which sets 1 byte: + + mov byte [rax], 1 diff --git a/modules/dbgfmts/CMakeLists.txt b/modules/dbgfmts/CMakeLists.txt new file mode 100644 index 00000000..93c29fe8 --- /dev/null +++ b/modules/dbgfmts/CMakeLists.txt @@ -0,0 +1,4 @@ +INCLUDE(dbgfmts/codeview/CMakeLists.txt) +INCLUDE(dbgfmts/dwarf2/CMakeLists.txt) +INCLUDE(dbgfmts/null/CMakeLists.txt) +INCLUDE(dbgfmts/stabs/CMakeLists.txt) diff --git a/modules/dbgfmts/Makefile.inc b/modules/dbgfmts/Makefile.inc index be53622c..8da62104 100644 --- a/modules/dbgfmts/Makefile.inc +++ b/modules/dbgfmts/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += modules/dbgfmts/codeview/Makefile.inc EXTRA_DIST += modules/dbgfmts/dwarf2/Makefile.inc EXTRA_DIST += modules/dbgfmts/null/Makefile.inc @@ -10,7 +8,7 @@ include modules/dbgfmts/dwarf2/Makefile.inc include modules/dbgfmts/null/Makefile.inc include modules/dbgfmts/stabs/Makefile.inc -dist_man_MANS += yasm_dbgfmts.7 +notrans_dist_man_MANS += yasm_dbgfmts.7 if BUILD_MAN yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml diff --git a/modules/dbgfmts/codeview/CMakeLists.txt b/modules/dbgfmts/codeview/CMakeLists.txt new file mode 100644 index 00000000..3ecd9fa5 --- /dev/null +++ b/modules/dbgfmts/codeview/CMakeLists.txt @@ -0,0 +1,5 @@ +YASM_ADD_MODULE(dbgfmt_cv8 + dbgfmts/codeview/cv-dbgfmt.c + dbgfmts/codeview/cv-symline.c + dbgfmts/codeview/cv-type.c + ) diff --git a/modules/dbgfmts/codeview/Makefile.inc b/modules/dbgfmts/codeview/Makefile.inc index 1a11f729..19f2db65 100644 --- a/modules/dbgfmts/codeview/Makefile.inc +++ b/modules/dbgfmts/codeview/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/dbgfmts/codeview/cv-dbgfmt.h libyasm_a_SOURCES += modules/dbgfmts/codeview/cv-dbgfmt.c libyasm_a_SOURCES += modules/dbgfmts/codeview/cv-symline.c diff --git a/modules/dbgfmts/codeview/cv-dbgfmt.c b/modules/dbgfmts/codeview/cv-dbgfmt.c index 75dc2f1e..e39a725f 100644 --- a/modules/dbgfmts/codeview/cv-dbgfmt.c +++ b/modules/dbgfmts/codeview/cv-dbgfmt.c @@ -25,10 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "cv-dbgfmt.h" @@ -74,6 +71,8 @@ cv_dbgfmt_destroy(/*@only@*/ yasm_dbgfmt *dbgfmt) for (i=0; ifilenames_size; i++) { if (dbgfmt_cv->filenames[i].pathname) yasm_xfree(dbgfmt_cv->filenames[i].pathname); + if (dbgfmt_cv->filenames[i].filename) + yasm_xfree(dbgfmt_cv->filenames[i].filename); } yasm_xfree(dbgfmt_cv->filenames); yasm_xfree(dbgfmt); diff --git a/modules/dbgfmts/codeview/cv-dbgfmt.h b/modules/dbgfmts/codeview/cv-dbgfmt.h index 5f415d7b..134b0b88 100644 --- a/modules/dbgfmts/codeview/cv-dbgfmt.h +++ b/modules/dbgfmts/codeview/cv-dbgfmt.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * CodeView debugging formats implementation for Yasm * * Copyright (C) 2006-2007 Peter Johnson diff --git a/modules/dbgfmts/codeview/cv-symline.c b/modules/dbgfmts/codeview/cv-symline.c index f9ddd992..8d703022 100644 --- a/modules/dbgfmts/codeview/cv-symline.c +++ b/modules/dbgfmts/codeview/cv-symline.c @@ -28,10 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "cv-dbgfmt.h" @@ -130,13 +127,16 @@ typedef struct cv8_lineset { size_t num_pairs; } cv8_lineset; +/* Note: Due to line number sorting requirements (by section offset it seems) + * one file may need more than one record per section. */ typedef struct cv8_lineinfo { STAILQ_ENTRY(cv8_lineinfo) link; const cv_filename *fn; /* filename associated with line numbers */ yasm_section *sect; /* section line numbers are for */ yasm_symrec *sectsym; /* symbol for beginning of sect */ unsigned long num_linenums; - STAILQ_HEAD(, cv8_lineset) linesets; + int first_in_sect; /* First lineinfo for this section. */ + STAILQ_HEAD(cv8_lineset_head, cv8_lineset) linesets; } cv8_lineinfo; /* Symbols use a bit of meta-programming to encode formats: each character @@ -165,7 +165,7 @@ static void cv8_symhead_bc_print(const void *contents, FILE *f, static int cv8_symhead_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int cv8_symhead_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -175,7 +175,7 @@ static void cv8_fileinfo_bc_print(const void *contents, FILE *f, static int cv8_fileinfo_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int cv8_fileinfo_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -185,7 +185,7 @@ static void cv8_lineinfo_bc_print(const void *contents, FILE *f, static int cv8_lineinfo_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int cv8_lineinfo_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -194,7 +194,7 @@ static void cv_sym_bc_print(const void *contents, FILE *f, int indent_level); static int cv_sym_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int cv_sym_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -203,6 +203,7 @@ static const yasm_bytecode_callback cv8_symhead_bc_callback = { cv8_symhead_bc_destroy, cv8_symhead_bc_print, yasm_bc_finalize_common, + NULL, cv8_symhead_bc_calc_len, yasm_bc_expand_common, cv8_symhead_bc_tobytes, @@ -213,6 +214,7 @@ static const yasm_bytecode_callback cv8_fileinfo_bc_callback = { cv8_fileinfo_bc_destroy, cv8_fileinfo_bc_print, yasm_bc_finalize_common, + NULL, cv8_fileinfo_bc_calc_len, yasm_bc_expand_common, cv8_fileinfo_bc_tobytes, @@ -223,6 +225,7 @@ static const yasm_bytecode_callback cv8_lineinfo_bc_callback = { cv8_lineinfo_bc_destroy, cv8_lineinfo_bc_print, yasm_bc_finalize_common, + NULL, cv8_lineinfo_bc_calc_len, yasm_bc_expand_common, cv8_lineinfo_bc_tobytes, @@ -233,6 +236,7 @@ static const yasm_bytecode_callback cv_sym_bc_callback = { cv_sym_bc_destroy, cv_sym_bc_print, yasm_bc_finalize_common, + NULL, cv_sym_bc_calc_len, yasm_bc_expand_common, cv_sym_bc_tobytes, @@ -417,7 +421,7 @@ typedef struct cv_line_info { yasm_linemap *linemap; yasm_errwarns *errwarns; unsigned int num_lineinfos; - STAILQ_HEAD(, cv8_lineinfo) cv8_lineinfos; + STAILQ_HEAD(cv8_lineinfo_head, cv8_lineinfo) cv8_lineinfos; /*@null@*/ cv8_lineinfo *cv8_cur_li; /*@null@*/ cv8_lineset *cv8_cur_ls; } cv_line_info; @@ -442,23 +446,9 @@ cv_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) || strcmp(filename, info->cv8_cur_li->fn->filename) != 0) { yasm_bytecode *sectbc; char symname[8]; + int first_in_sect = !info->cv8_cur_li; - /* first see if we already have a lineinfo that is for this section and - * filename - */ - STAILQ_FOREACH(info->cv8_cur_li, &info->cv8_lineinfos, link) { - if (sect == info->cv8_cur_li->sect - && strcmp(filename, info->cv8_cur_li->fn->filename) == 0) - break; - } - - if (info->cv8_cur_li) { - info->cv8_cur_ls = STAILQ_LAST(&info->cv8_cur_li->linesets, - cv8_lineset, link); - goto done; /* found one */ - } - - /* Nope; find file */ + /* Find file */ for (i=0; ifilenames_size; i++) { if (strcmp(filename, dbgfmt_cv->filenames[i].filename) == 0) break; @@ -470,6 +460,7 @@ cv_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) info->cv8_cur_li = yasm_xmalloc(sizeof(cv8_lineinfo)); info->cv8_cur_li->fn = &dbgfmt_cv->filenames[i]; info->cv8_cur_li->sect = sect; + info->cv8_cur_li->first_in_sect = first_in_sect; sectbc = yasm_section_bcs_first(sect); if (sectbc->symrecs && sectbc->symrecs[0]) info->cv8_cur_li->sectsym = sectbc->symrecs[0]; @@ -484,7 +475,6 @@ cv_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) STAILQ_INSERT_TAIL(&info->cv8_lineinfos, info->cv8_cur_li, link); info->cv8_cur_ls = NULL; } -done: /* build new lineset if necessary */ if (!info->cv8_cur_ls || info->cv8_cur_ls->num_pairs >= 126) { @@ -571,7 +561,7 @@ yasm_cv__generate_symline(yasm_object *object, yasm_linemap *linemap, info.linemap = linemap; info.errwarns = errwarns; info.debug_symline = - yasm_object_get_general(object, ".debug$S", 0, 1, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug$S", 1, 0, 0, &new, 0); info.num_lineinfos = 0; STAILQ_INIT(&info.cv8_lineinfos); info.cv8_cur_li = NULL; @@ -621,13 +611,19 @@ yasm_cv__generate_symline(yasm_object *object, yasm_linemap *linemap, cv_generate_line_section); /* Output line numbers for sections */ + head = NULL; STAILQ_FOREACH(li, &info.cv8_lineinfos, link) { - head = cv8_add_symhead(info.debug_symline, CV8_LINE_NUMS, 0); + if (li->first_in_sect) { + if (head) + cv8_set_symhead_end(head, yasm_section_bcs_last(info.debug_symline)); + head = cv8_add_symhead(info.debug_symline, CV8_LINE_NUMS, 0); + } bc = yasm_bc_create_common(&cv8_lineinfo_bc_callback, li, 0); - bc->len = 24+li->num_linenums*8; + bc->len = (li->first_in_sect ? 24 : 12) + li->num_linenums*8; yasm_cv__append_bc(info.debug_symline, bc); - cv8_set_symhead_end(head, yasm_section_bcs_last(info.debug_symline)); } + if (head) + cv8_set_symhead_end(head, yasm_section_bcs_last(info.debug_symline)); /* Already aligned 4 */ @@ -636,9 +632,12 @@ yasm_cv__generate_symline(yasm_object *object, yasm_linemap *linemap, /* add object and compile flag first */ cv8_add_sym_objname(info.debug_symline, yasm__abspath(object->obj_filename)); - cv8_add_sym_compile(object, info.debug_symline, - yasm__xstrdup(PACKAGE_NAME " " PACKAGE_INTVER "." - PACKAGE_BUILD)); + if (getenv("YASM_TEST_SUITE")) + cv8_add_sym_compile(object, info.debug_symline, + yasm__xstrdup("yasm HEAD")); + else + cv8_add_sym_compile(object, info.debug_symline, + yasm__xstrdup(PACKAGE_STRING)); /* then iterate through symbol table */ yasm_symtab_traverse(object->symtab, &info, cv_generate_sym); cv8_set_symhead_end(head, yasm_section_bcs_last(info.debug_symline)); @@ -722,7 +721,8 @@ cv8_symhead_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -cv8_symhead_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +cv8_symhead_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -795,7 +795,8 @@ cv8_fileinfo_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -cv8_fileinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +cv8_fileinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -862,7 +863,8 @@ cv8_lineinfo_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -cv8_lineinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +cv8_lineinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -873,21 +875,25 @@ cv8_lineinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, unsigned long i; cv8_lineset *ls; - /* start offset and section */ - cv_out_sym(li->sectsym, 0, bc, &buf, d, output_value); + if (li->first_in_sect) { + /* start offset and section */ + cv_out_sym(li->sectsym, (unsigned long)(buf - bufstart), bc, &buf, + d, output_value); - /* Two bytes of pad/alignment */ - YASM_WRITE_8(buf, 0); - YASM_WRITE_8(buf, 0); + /* Two bytes of pad/alignment */ + YASM_WRITE_8(buf, 0); + YASM_WRITE_8(buf, 0); - /* Section length covered by line number info */ - cval = yasm_calc_bc_dist(yasm_section_bcs_first(li->sect), - yasm_section_bcs_last(li->sect)); - yasm_arch_intnum_tobytes(object->arch, cval, buf, 4, 32, 0, bc, 0); - buf += 4; + /* Section length covered by line number info */ + cval = yasm_calc_bc_dist(yasm_section_bcs_first(li->sect), + yasm_section_bcs_last(li->sect)); + yasm_arch_intnum_tobytes(object->arch, cval, buf, 4, 32, 0, bc, 0); + yasm_intnum_destroy(cval); + buf += 4; + } /* Offset of source file in info table */ - yasm_intnum_set_uint(cval, li->fn->info_off); + cval = yasm_intnum_create_uint(li->fn->info_off); yasm_arch_intnum_tobytes(object->arch, cval, buf, 4, 32, 0, bc, 0); buf += 4; @@ -1017,7 +1023,8 @@ cv_sym_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -cv_sym_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +cv_sym_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -1059,7 +1066,7 @@ cv_sym_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, break; case 'Y': cv_out_sym((yasm_symrec *)cvs->args[arg++].p, - (unsigned long)(buf-(*bufp)), bc, &buf, d, + (unsigned long)(buf-bufstart), bc, &buf, d, output_value); break; case 'T': diff --git a/modules/dbgfmts/codeview/cv-type.c b/modules/dbgfmts/codeview/cv-type.c index 9722a414..c374c2ba 100644 --- a/modules/dbgfmts/codeview/cv-type.c +++ b/modules/dbgfmts/codeview/cv-type.c @@ -28,10 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "cv-dbgfmt.h" @@ -485,7 +482,7 @@ static void cv_type_bc_print(const void *contents, FILE *f, int indent_level); static int cv_type_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int cv_type_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -494,6 +491,7 @@ static const yasm_bytecode_callback cv_type_bc_callback = { cv_type_bc_destroy, cv_type_bc_print, yasm_bc_finalize_common, + NULL, cv_type_bc_calc_len, yasm_bc_expand_common, cv_type_bc_tobytes, @@ -524,7 +522,7 @@ yasm_cv__generate_type(yasm_object *object) cv_type *type; debug_type = - yasm_object_get_general(object, ".debug$T", 0, 1, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug$T", 1, 0, 0, &new, 0); /* Add label type */ type = cv_type_create(indx++); @@ -563,6 +561,7 @@ cv_leaf_destroy(cv_leaf *leaf) } ch++; } + yasm_xfree(leaf); } static unsigned long @@ -733,7 +732,8 @@ cv_type_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -cv_type_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +cv_type_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { diff --git a/modules/dbgfmts/codeview/cv8.txt b/modules/dbgfmts/codeview/cv8.txt index 04f152b2..a4bbdd8e 100644 --- a/modules/dbgfmts/codeview/cv8.txt +++ b/modules/dbgfmts/codeview/cv8.txt @@ -25,15 +25,17 @@ the end (not included in length). 2 bytes - section index (SECTION to section start) 2 bytes - pad/align (0) 4 bytes - section length covered by line number info - 4 bytes - offset of source file in source file info table - 4 bytes - number of line number pairs - 4 bytes - number of bytes of line number pairs + 12 - followed by pairs of: - 4 bytes - offset in section - 4 bytes - line number; if high bit is set, - end of statement/breakpointable (?) - e.g. lines containing - just labels should have line numbers + followed by one or more source mappings: + 4 bytes - offset of source file in source file info table + 4 bytes - number of line number pairs + 4 bytes - number of bytes this mapping takes, i.e. 12 + pair-count * 8. + + followed by pairs of: + 4 bytes - offset in section + 4 bytes - line number; if high bit is set, + end of statement/breakpointable (?) - e.g. lines containing + just labels should have line numbers 0x000000F1: symbol information enclosed data per below diff --git a/modules/dbgfmts/codeview/tests/cv8-multi.asm b/modules/dbgfmts/codeview/tests/cv8-multi.asm new file mode 100644 index 00000000..ddb9adcd --- /dev/null +++ b/modules/dbgfmts/codeview/tests/cv8-multi.asm @@ -0,0 +1,23 @@ +; +; Test for windbg's ability to single step thru two (or more) source files +; contributing instructions to the same sections. +; +; YASM 1.2.0 and earlier used to generate one CV8_LINE_NUMS per file per +; section, thus potentially having several CV8_LINE_NUMS records for each +; section. It is seems that this confuses either the linker or/and windbg +; and prevents single stepping in and out of include files. +; +; MASM generates one line number debug subsection for each code section, +; repeating the 12 bytes before the offset/lineno pairs for each new file. +; +; It also appears that line numbers must be ordered by section offset, and +; therefore cannot be grouped per file as done by YASM 1.2.0 and earlier. +; +_start: +global _start +%include "cv8-multi.mac" + mov eax, 42 +%include "cv8-multi.mac" + xor eax, eax + ret + diff --git a/modules/dbgfmts/codeview/tests/cv8-multi.mac b/modules/dbgfmts/codeview/tests/cv8-multi.mac new file mode 100644 index 00000000..5a559f48 --- /dev/null +++ b/modules/dbgfmts/codeview/tests/cv8-multi.mac @@ -0,0 +1,4 @@ + int3 + nop + ; Must be able to step back into the main file. + diff --git a/modules/dbgfmts/dwarf2/CMakeLists.txt b/modules/dbgfmts/dwarf2/CMakeLists.txt new file mode 100644 index 00000000..671910ee --- /dev/null +++ b/modules/dbgfmts/dwarf2/CMakeLists.txt @@ -0,0 +1,6 @@ +YASM_ADD_MODULE(dbgfmt_dwarf2 + dbgfmts/dwarf2/dwarf2-dbgfmt.c + dbgfmts/dwarf2/dwarf2-line.c + dbgfmts/dwarf2/dwarf2-aranges.c + dbgfmts/dwarf2/dwarf2-info.c + ) diff --git a/modules/dbgfmts/dwarf2/Makefile.inc b/modules/dbgfmts/dwarf2/Makefile.inc index 602ae641..606b699e 100644 --- a/modules/dbgfmts/dwarf2/Makefile.inc +++ b/modules/dbgfmts/dwarf2/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h libyasm_a_SOURCES += modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c libyasm_a_SOURCES += modules/dbgfmts/dwarf2/dwarf2-line.c diff --git a/modules/dbgfmts/dwarf2/dwarf2-aranges.c b/modules/dbgfmts/dwarf2/dwarf2-aranges.c index 34ff80e1..f398b7fa 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-aranges.c +++ b/modules/dbgfmts/dwarf2/dwarf2-aranges.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "dwarf2-dbgfmt.h" @@ -90,7 +88,7 @@ yasm_dwarf2__generate_aranges(yasm_object *object, yasm_section *debug_info) dwarf2_aranges_info info; debug_aranges = - yasm_object_get_general(object, ".debug_aranges", 0, + yasm_object_get_general(object, ".debug_aranges", 2*dbgfmt_dwarf2->sizeof_address, 0, 0, &new, 0); diff --git a/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c b/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c index b0469c32..5b66f8a7 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c +++ b/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c @@ -25,10 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "dwarf2-dbgfmt.h" @@ -48,7 +45,7 @@ static void dwarf2_head_bc_print(const void *contents, FILE *f, static int dwarf2_head_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int dwarf2_head_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -57,6 +54,7 @@ static const yasm_bytecode_callback dwarf2_head_bc_callback = { dwarf2_head_bc_destroy, dwarf2_head_bc_print, yasm_bc_finalize_common, + NULL, dwarf2_head_bc_calc_len, yasm_bc_expand_common, dwarf2_head_bc_tobytes, @@ -249,7 +247,8 @@ dwarf2_head_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -dwarf2_head_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +dwarf2_head_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -289,7 +288,7 @@ dwarf2_head_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_section_bcs_first(head->debug_ptr)), dbgfmt_dwarf2->sizeof_offset*8); output_value(&value, buf, dbgfmt_dwarf2->sizeof_offset, - (unsigned long)(buf-*bufp), bc, 0, d); + (unsigned long)(buf-bufstart), bc, 0, d); buf += dbgfmt_dwarf2->sizeof_offset; } diff --git a/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h b/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h index 7331bf36..03752345 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h +++ b/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * DWARF2 debugging format * * Copyright (C) 2006-2007 Peter Johnson @@ -66,6 +66,7 @@ typedef struct dwarf2_loc { unsigned long file; /* index into table of filenames */ unsigned long line; /* source line number */ unsigned long column; /* source column */ + unsigned long discriminator; int isa_change; unsigned long isa; enum { diff --git a/modules/dbgfmts/dwarf2/dwarf2-info.c b/modules/dbgfmts/dwarf2/dwarf2-info.c index f6d2643e..7dbe43a9 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-info.c +++ b/modules/dbgfmts/dwarf2/dwarf2-info.c @@ -25,17 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -/* Need either unistd.h or direct.h (on Windows) to prototype getcwd() */ -#ifdef HAVE_UNISTD_H -#include -#elif defined(WIN32) || defined(_WIN32) -#include -#endif - -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "dwarf2-dbgfmt.h" @@ -206,7 +196,7 @@ static void dwarf2_abbrev_bc_print(const void *contents, FILE *f, static int dwarf2_abbrev_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int dwarf2_abbrev_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -216,6 +206,7 @@ static const yasm_bytecode_callback dwarf2_abbrev_bc_callback = { dwarf2_abbrev_bc_destroy, dwarf2_abbrev_bc_print, yasm_bc_finalize_common, + NULL, dwarf2_abbrev_bc_calc_len, yasm_bc_expand_common, dwarf2_abbrev_bc_tobytes, @@ -276,9 +267,9 @@ yasm_dwarf2__generate_info(yasm_object *object, yasm_section *debug_line, dwarf2_head *head; char *buf; yasm_section *debug_abbrev = - yasm_object_get_general(object, ".debug_abbrev", 0, 4, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug_abbrev", 4, 0, 0, &new, 0); yasm_section *debug_info = - yasm_object_get_general(object, ".debug_info", 0, 4, 0, 0, &new, 0); + yasm_object_get_general(object, ".debug_info", 4, 0, 0, &new, 0); yasm_section_set_align(debug_abbrev, 0, 0); yasm_section_set_align(debug_info, 0, 0); @@ -339,13 +330,16 @@ yasm_dwarf2__generate_info(yasm_object *object, yasm_section *debug_line, /* compile directory (current working directory) */ abc->len += dwarf2_add_abbrev_attr(abbrev, DW_AT_comp_dir, DW_FORM_string); - buf = getcwd(NULL, 0); + buf = yasm__getcwd(); dwarf2_append_str(debug_info, buf); - free(buf); + yasm_xfree(buf); /* producer - assembler name */ abc->len += dwarf2_add_abbrev_attr(abbrev, DW_AT_producer, DW_FORM_string); - dwarf2_append_str(debug_info, PACKAGE " " VERSION); + if (getenv("YASM_TEST_SUITE")) + dwarf2_append_str(debug_info, "yasm HEAD"); + else + dwarf2_append_str(debug_info, PACKAGE_STRING); /* language - no standard code for assembler, use MIPS as a substitute */ abc->len += dwarf2_add_abbrev_attr(abbrev, DW_AT_language, DW_FORM_data2); @@ -402,7 +396,8 @@ dwarf2_abbrev_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -dwarf2_abbrev_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +dwarf2_abbrev_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { diff --git a/modules/dbgfmts/dwarf2/dwarf2-line.c b/modules/dbgfmts/dwarf2/dwarf2-line.c index 6e77ceb4..8943c067 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-line.c +++ b/modules/dbgfmts/dwarf2/dwarf2-line.c @@ -28,10 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include #include "dwarf2-dbgfmt.h" @@ -79,7 +76,8 @@ static unsigned char line_opcode_num_operands[DWARF2_LINE_OPCODE_BASE-1] = { typedef enum { DW_LNE_end_sequence = 1, DW_LNE_set_address, - DW_LNE_define_file + DW_LNE_define_file, + DW_LNE_set_discriminator } dwarf_line_number_ext_op; /* Base and range for line offsets in special opcodes */ @@ -122,6 +120,7 @@ typedef struct dwarf2_line_op { /* extended opcode */ dwarf_line_number_ext_op ext_opcode; /*@null@*/ /*@dependent@*/ yasm_symrec *ext_operand; /* unsigned */ + /*@null@*/ /*@dependent@*/ yasm_intnum *ext_operand_int; /* unsigned */ unsigned long ext_operandsize; } dwarf2_line_op; @@ -132,7 +131,7 @@ static void dwarf2_spp_bc_print(const void *contents, FILE *f, static int dwarf2_spp_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int dwarf2_spp_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -142,7 +141,7 @@ static void dwarf2_line_op_bc_print(const void *contents, FILE *f, static int dwarf2_line_op_bc_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int dwarf2_line_op_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -151,6 +150,7 @@ static const yasm_bytecode_callback dwarf2_spp_bc_callback = { dwarf2_spp_bc_destroy, dwarf2_spp_bc_print, yasm_bc_finalize_common, + NULL, dwarf2_spp_bc_calc_len, yasm_bc_expand_common, dwarf2_spp_bc_tobytes, @@ -161,6 +161,7 @@ static const yasm_bytecode_callback dwarf2_line_op_bc_callback = { dwarf2_line_op_bc_destroy, dwarf2_line_op_bc_print, yasm_bc_finalize_common, + NULL, dwarf2_line_op_bc_calc_len, yasm_bc_expand_common, dwarf2_line_op_bc_tobytes, @@ -254,6 +255,7 @@ dwarf2_dbgfmt_append_line_op(yasm_section *sect, dwarf_line_number_op opcode, line_op->operand = operand; line_op->ext_opcode = 0; line_op->ext_operand = NULL; + line_op->ext_operand_int = NULL; line_op->ext_operandsize = 0; bc = yasm_bc_create_common(&dwarf2_line_op_bc_callback, line_op, 0); @@ -282,6 +284,31 @@ dwarf2_dbgfmt_append_line_ext_op(yasm_section *sect, line_op->operand = yasm_intnum_create_uint(ext_operandsize+1); line_op->ext_opcode = ext_opcode; line_op->ext_operand = ext_operand; + line_op->ext_operand_int = NULL; + line_op->ext_operandsize = ext_operandsize; + + bc = yasm_bc_create_common(&dwarf2_line_op_bc_callback, line_op, 0); + bc->len = 2 + yasm_intnum_size_leb128(line_op->operand, 0) + + ext_operandsize; + + yasm_dwarf2__append_bc(sect, bc); + return bc; +} + +static yasm_bytecode * +dwarf2_dbgfmt_append_line_ext_op_int(yasm_section *sect, + dwarf_line_number_ext_op ext_opcode, + /*@only@*/ yasm_intnum *ext_operand) +{ + dwarf2_line_op *line_op = yasm_xmalloc(sizeof(dwarf2_line_op)); + unsigned long ext_operandsize = yasm_intnum_size_leb128(ext_operand, 0); + yasm_bytecode *bc; + + line_op->opcode = DW_LNS_extended_op; + line_op->operand = yasm_intnum_create_uint(ext_operandsize+1); + line_op->ext_opcode = ext_opcode; + line_op->ext_operand = NULL; + line_op->ext_operand_int = ext_operand; line_op->ext_operandsize = ext_operandsize; bc = yasm_bc_create_common(&dwarf2_line_op_bc_callback, line_op, 0); @@ -344,6 +371,11 @@ dwarf2_dbgfmt_gen_line_op(yasm_section *debug_line, dwarf2_line_state *state, dwarf2_dbgfmt_append_line_op(debug_line, DW_LNS_set_column, yasm_intnum_create_uint(state->column)); } + if (loc->discriminator != 0) { + dwarf2_dbgfmt_append_line_ext_op_int(debug_line, + DW_LNE_set_discriminator, + yasm_intnum_create_uint(loc->discriminator)); + } #ifdef WITH_DWARF3 if (loc->isa_change) { state->isa = loc->isa; @@ -452,13 +484,35 @@ typedef struct dwarf2_line_bc_info { unsigned long lastfile; } dwarf2_line_bc_info; +static int +dwarf2_filename_equals(const dwarf2_filename *fn, + char **dirs, + const char *pathname, + unsigned long dirlen, + const char *filename) +{ + /* check directory */ + if (fn->dir == 0) { + if (dirlen != 0) + return 0; + } else { + if (strncmp(dirs[fn->dir-1], pathname, dirlen) != 0 || + dirs[fn->dir-1][dirlen] != '\0') + return 0; + } + + /* check filename */ + return strcmp(fn->filename, filename) == 0; +} + static int dwarf2_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) { dwarf2_line_bc_info *info = (dwarf2_line_bc_info *)d; yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2 = info->dbgfmt_dwarf2; unsigned long i; - const char *filename; + size_t dirlen; + const char *pathname, *filename; /*@null@*/ yasm_bytecode *nextbc = yasm_bc__next(bc); if (nextbc && bc->offset == nextbc->offset) @@ -476,15 +530,20 @@ dwarf2_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) } } - yasm_linemap_lookup(info->linemap, bc->line, &filename, &info->loc.line); + yasm_linemap_lookup(info->linemap, bc->line, &pathname, &info->loc.line); + dirlen = yasm__splitpath(pathname, &filename); + /* Find file index; just linear search it unless it was the last used */ if (info->lastfile > 0 - && strcmp(filename, dbgfmt_dwarf2->filenames[info->lastfile-1].pathname) - == 0) + && dwarf2_filename_equals(&dbgfmt_dwarf2->filenames[info->lastfile-1], + dbgfmt_dwarf2->dirs, pathname, dirlen, + filename)) info->loc.file = info->lastfile; else { for (i=0; ifilenames_size; i++) { - if (strcmp(filename, dbgfmt_dwarf2->filenames[i].pathname) == 0) + if (dwarf2_filename_equals(&dbgfmt_dwarf2->filenames[i], + dbgfmt_dwarf2->dirs, pathname, dirlen, + filename)) break; } if (i >= dbgfmt_dwarf2->filenames_size) @@ -561,6 +620,7 @@ dwarf2_generate_line_section(yasm_section *sect, /*@null@*/ void *d) bcinfo.lastfile = 0; bcinfo.loc.isa_change = 0; bcinfo.loc.column = 0; + bcinfo.loc.discriminator = 0; bcinfo.loc.is_stmt = IS_STMT_NOCHANGE; bcinfo.loc.basic_block = 0; bcinfo.loc.prologue_end = 0; @@ -631,7 +691,7 @@ yasm_dwarf2__generate_line(yasm_object *object, yasm_linemap *linemap, dwarf2_line_info info; int new; size_t i; - yasm_bytecode *last, *sppbc; + yasm_bytecode *sppbc; dwarf2_spp *spp; dwarf2_head *head; @@ -647,9 +707,9 @@ yasm_dwarf2__generate_line(yasm_object *object, yasm_linemap *linemap, info.object = object; info.linemap = linemap; info.dbgfmt_dwarf2 = dbgfmt_dwarf2; - info.debug_line = yasm_object_get_general(object, ".debug_line", 0, 1, 0, - 0, &new, 0); - last = yasm_section_bcs_last(info.debug_line); + info.debug_line = yasm_object_get_general(object, ".debug_line", 1, 0, 0, + &new, 0); + info.errwarns = errwarns; /* header */ head = yasm_dwarf2__add_head(dbgfmt_dwarf2, info.debug_line, NULL, 0, 0); @@ -717,7 +777,8 @@ dwarf2_spp_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -dwarf2_spp_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +dwarf2_spp_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -780,6 +841,8 @@ dwarf2_line_op_bc_destroy(void *contents) dwarf2_line_op *line_op = (dwarf2_line_op *)contents; if (line_op->operand) yasm_intnum_destroy(line_op->operand); + if (line_op->ext_operand_int) + yasm_intnum_destroy(line_op->ext_operand_int); yasm_xfree(contents); } @@ -799,7 +862,8 @@ dwarf2_line_op_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } static int -dwarf2_line_op_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +dwarf2_line_op_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -817,9 +881,12 @@ dwarf2_line_op_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_value_init_sym(&value, line_op->ext_operand, line_op->ext_operandsize*8); output_value(&value, buf, line_op->ext_operandsize, - (unsigned long)(buf-*bufp), bc, 0, d); + (unsigned long)(buf-bufstart), bc, 0, d); buf += line_op->ext_operandsize; } + if (line_op->ext_operand_int) { + buf += yasm_intnum_get_leb128(line_op->ext_operand_int, buf, 0); + } } *bufp = buf; @@ -831,7 +898,7 @@ yasm_dwarf2__dir_loc(yasm_object *object, yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, unsigned long line) { yasm_valparam *vp; - int in_is_stmt = 0, in_isa = 0; + int in_is_stmt = 0, in_isa = 0, in_discriminator = 0; /*@dependent@*/ /*@null@*/ const yasm_intnum *intn; dwarf2_section_data *dsd; @@ -892,6 +959,7 @@ yasm_dwarf2__dir_loc(yasm_object *object, yasm_valparamhead *valparams, /* Defaults for optional settings */ loc->column = 0; + loc->discriminator = 0; loc->isa_change = 0; loc->isa = 0; loc->is_stmt = IS_STMT_NOCHANGE; @@ -966,11 +1034,33 @@ restart: loc->isa_change = 1; loc->isa = yasm_intnum_get_uint(intn); yasm_expr_destroy(e); + } else if (in_discriminator) { + in_discriminator = 0; + if (!(e = yasm_vp_expr(vp, object->symtab, line)) || + !(intn = yasm_expr_get_intnum(&e, 0))) { + yasm_error_set(YASM_ERROR_NOT_CONSTANT, + N_("discriminator value is not a constant")); + yasm_xfree(loc); + if (e) + yasm_expr_destroy(e); + return; + } + if (yasm_intnum_sign(intn) < 0) { + yasm_error_set(YASM_ERROR_VALUE, + N_("discriminator value less than zero")); + yasm_xfree(loc); + yasm_expr_destroy(e); + return; + } + loc->discriminator = yasm_intnum_get_uint(intn); + yasm_expr_destroy(e); } else if (!vp->val && (s = yasm_vp_id(vp))) { if (yasm__strcasecmp(s, "is_stmt") == 0) in_is_stmt = 1; else if (yasm__strcasecmp(s, "isa") == 0) in_isa = 1; + else if (yasm__strcasecmp(s, "discriminator") == 0) + in_discriminator = 1; else if (yasm__strcasecmp(s, "basic_block") == 0) loc->basic_block = 1; else if (yasm__strcasecmp(s, "prologue_end") == 0) @@ -989,15 +1079,19 @@ restart: } else if (yasm__strcasecmp(vp->val, "isa") == 0) { in_isa = 1; goto restart; /* don't go to the next valparam */ + } else if (yasm__strcasecmp(vp->val, "discriminator") == 0) { + in_discriminator = 1; + goto restart; /* don't go to the next valparam */ } else yasm_warn_set(YASM_WARN_GENERAL, N_("unrecognized loc option `%s'"), vp->val); vp = yasm_vps_next(vp); } - if (in_is_stmt || in_isa) { + if (in_is_stmt || in_isa || in_discriminator) { yasm_error_set(YASM_ERROR_SYNTAX, N_("%s requires value"), - in_is_stmt ? "is_stmt" : "isa"); + in_is_stmt ? "is_stmt" : + (in_isa ? "isa" : "discriminator")); yasm_xfree(loc); return; } diff --git a/modules/dbgfmts/dwarf2/tests/Makefile.inc b/modules/dbgfmts/dwarf2/tests/Makefile.inc index 1136e288..e1dc1d4e 100644 --- a/modules/dbgfmts/dwarf2/tests/Makefile.inc +++ b/modules/dbgfmts/dwarf2/tests/Makefile.inc @@ -1,8 +1,8 @@ -# $Id$ - +EXTRA_DIST += modules/dbgfmts/dwarf2/tests/gen64/Makefile.inc EXTRA_DIST += modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc EXTRA_DIST += modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc EXTRA_DIST += modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc +include modules/dbgfmts/dwarf2/tests/gen64/Makefile.inc include modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc include modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc include modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc diff --git a/modules/dbgfmts/dwarf2/tests/gen64/Makefile.inc b/modules/dbgfmts/dwarf2/tests/gen64/Makefile.inc new file mode 100644 index 00000000..88ca78c6 --- /dev/null +++ b/modules/dbgfmts/dwarf2/tests/gen64/Makefile.inc @@ -0,0 +1,6 @@ +TESTS += modules/dbgfmts/dwarf2/tests/gen64/dwarf2_gen64_test.sh + +EXTRA_DIST += modules/dbgfmts/dwarf2/tests/gen64/dwarf2_gen64_test.sh +EXTRA_DIST += modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.asm +EXTRA_DIST += modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.hex + diff --git a/modules/dbgfmts/dwarf2/tests/gen64/dwarf2_gen64_test.sh b/modules/dbgfmts/dwarf2/tests/gen64/dwarf2_gen64_test.sh new file mode 100755 index 00000000..dae5f429 --- /dev/null +++ b/modules/dbgfmts/dwarf2/tests/gen64/dwarf2_gen64_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh dwarf2_gen64_test modules/dbgfmts/dwarf2/tests/gen64 "dwarf2 dbgfmt gen64" "-f elf64 -g dwarf2" ".o" +exit $? diff --git a/modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.asm b/modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.asm new file mode 100644 index 00000000..a216f9bd --- /dev/null +++ b/modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.asm @@ -0,0 +1,22 @@ +[bits 64] +[section .text] +[default rel] + +%line 1+0 ./some_filename +; program tst_wyjatki +global _start +_start: + XOR EBP, EBP + CALL main + XOR RAX, RAX + MOV RDI, RAX + MOV RAX, 60 + SYSCALL + HLT + +main: + PUSH rbp + MOV rbp, rsp + SUB RSP, 0x20 + %line 2+0 some_filename + SUB RSP, 64 diff --git a/modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.hex b/modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.hex new file mode 100644 index 00000000..c67b19de --- /dev/null +++ b/modules/dbgfmts/dwarf2/tests/gen64/dwarf64_pathname.hex @@ -0,0 +1,1632 @@ +7f +45 +4c +46 +02 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +40 +00 +0c +00 +01 +00 +31 +ed +e8 +10 +00 +00 +00 +48 +31 +c0 +48 +89 +c7 +48 +c7 +c0 +3c +00 +00 +00 +0f +05 +f4 +55 +48 +89 +e5 +48 +83 +ec +20 +48 +83 +ec +40 +4c +00 +00 +00 +02 +00 +29 +00 +00 +00 +01 +01 +fb +0e +0d +00 +01 +01 +01 +01 +00 +00 +00 +01 +00 +00 +01 +00 +2d +00 +00 +00 +00 +73 +6f +6d +65 +5f +66 +69 +6c +65 +6e +61 +6d +65 +00 +00 +00 +00 +00 +04 +02 +00 +09 +02 +00 +00 +00 +00 +00 +00 +00 +00 +01 +2e +58 +3c +3c +74 +2e +20 +20 +3c +4b +02 +04 +00 +01 +01 +00 +38 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +11 +00 +10 +06 +11 +01 +12 +01 +03 +08 +1b +08 +25 +08 +13 +05 +00 +00 +00 +2d +00 +00 +00 +02 +00 +00 +00 +00 +00 +08 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2d +00 +2e +2f +00 +79 +61 +73 +6d +20 +48 +45 +41 +44 +00 +01 +80 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0c +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +05 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +07 +00 +00 +00 +23 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2c +00 +00 +00 +02 +00 +00 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +23 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +64 +65 +62 +75 +67 +5f +6c +69 +6e +65 +00 +2e +64 +65 +62 +75 +67 +5f +61 +62 +62 +72 +65 +76 +00 +2e +64 +65 +62 +75 +67 +5f +69 +6e +66 +6f +00 +2e +64 +65 +62 +75 +67 +5f +61 +72 +61 +6e +67 +65 +73 +00 +2e +72 +65 +6c +61 +2e +64 +65 +62 +75 +67 +5f +6c +69 +6e +65 +00 +2e +72 +65 +6c +61 +2e +64 +65 +62 +75 +67 +5f +69 +6e +66 +6f +00 +2e +72 +65 +6c +61 +2e +64 +65 +62 +75 +67 +5f +61 +72 +61 +6e +67 +65 +73 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +5f +73 +74 +61 +72 +74 +00 +6d +61 +69 +6e +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +0a +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +05 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +00 +00 +04 +00 +17 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +10 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +82 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +e0 +01 +00 +00 +00 +00 +00 +00 +8c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +72 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +02 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +7a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +7c +02 +00 +00 +00 +00 +00 +00 +d8 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +08 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +00 +00 +23 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +63 +00 +00 +00 +00 +00 +00 +00 +50 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +3c +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b4 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +05 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +13 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +cc +00 +00 +00 +00 +00 +00 +00 +14 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +21 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +e0 +00 +00 +00 +00 +00 +00 +00 +31 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +4d +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +14 +01 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +08 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +2d +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +80 +01 +00 +00 +00 +00 +00 +00 +30 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5e +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b0 +01 +00 +00 +00 +00 +00 +00 +30 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +0a +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc b/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc index 4c3fabc9..be69cbf8 100644 --- a/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc +++ b/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh EXTRA_DIST += modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh diff --git a/modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh b/modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh index ba89b781..8b159a37 100755 --- a/modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh +++ b/modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh dwarf2_pass32_test modules/dbgfmts/dwarf2/tests/pass32 "dwarf2 dbgfmt pass32" "-f elf -p gas -g dwarf2" ".o" exit $? diff --git a/modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn b/modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn index d22fdf91..9c333565 100644 --- a/modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn +++ b/modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn @@ -1,22 +1,22 @@ --:1: directive `.loc' requires an argument --:2: file number required --:3: file number required --:4: file number less than one --:6: line number required --:7: line number required --:8: line number required --:11: line number required +-:1: error: directive `.loc' requires an argument +-:2: error: file number required +-:3: error: file number required +-:4: error: file number less than one +-:6: error: line number required +-:7: error: line number required +-:8: error: line number required +-:11: error: line number required -:12: warning: unrecognized numeric qualifier --:13: column number is not a constant --:14: is_stmt requires value --:17: is_stmt value is not a constant --:19: is_stmt value is not a constant --:20: is_stmt value is not a constant --:22: is_stmt value not 0 or 1 --:23: isa requires value --:26: isa value is not a constant --:28: isa value is not a constant --:30: isa value less than zero --:31: column number is not a constant +-:13: error: column number is not a constant +-:14: error: is_stmt requires value +-:17: error: is_stmt value is not a constant +-:19: error: is_stmt value is not a constant +-:20: error: is_stmt value is not a constant +-:22: error: is_stmt value not 0 or 1 +-:23: error: isa requires value +-:26: error: isa value is not a constant +-:28: error: isa value is not a constant +-:30: error: isa value less than zero +-:31: error: column number is not a constant -:33: warning: unrecognized loc option `foo' -:33: warning: unrecognized numeric qualifier diff --git a/modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex b/modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex index e73e882a..7cfddd03 100644 --- a/modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex +++ b/modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex @@ -168,8 +168,8 @@ b8 00 eb 72 -89 -f6 +66 +90 83 ec 08 @@ -280,8 +280,8 @@ b8 00 00 00 -89 -f6 +66 +90 8d 65 f8 diff --git a/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc b/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc index 2ca475d5..e9760145 100644 --- a/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc +++ b/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh EXTRA_DIST += modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh diff --git a/modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh b/modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh index f4dddfe8..a377327c 100755 --- a/modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh +++ b/modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh dwarf2_pass64_test modules/dbgfmts/dwarf2/tests/pass64 "dwarf2 dbgfmt pass64" "-f elf64 -p gas -g dwarf2" ".o" exit $? diff --git a/modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex b/modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex index af09833c..2af91504 100644 --- a/modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex +++ b/modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex @@ -183,13 +183,13 @@ e8 c4 08 c3 -66 -66 -66 -90 -66 -66 -90 +0f +1f +80 +00 +00 +00 +00 48 83 ec @@ -410,10 +410,10 @@ e8 c4 18 c3 -66 -66 -66 -90 +0f +1f +40 +00 48 8b 3d @@ -459,9 +459,9 @@ e8 c4 18 c3 -66 -66 -90 +0f +1f +00 ba 00 00 @@ -485,15 +485,15 @@ ff ff ff 66 -66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 6c @@ -682,10 +682,10 @@ d8 c4 18 c3 -66 -66 -66 -90 +0f +1f +40 +00 ba 00 00 @@ -709,15 +709,15 @@ ff ff ff 66 -66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 6c @@ -933,15 +933,15 @@ ff ff ff 66 -66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 6c @@ -1157,15 +1157,15 @@ ff ff ff 66 -66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 5c @@ -1371,9 +1371,9 @@ e8 c4 28 c3 -66 -66 -90 +0f +1f +00 4d 85 e4 @@ -1450,10 +1450,10 @@ ff 23 31 db -66 -66 -66 -90 +0f +1f +40 +00 48 8b 3d @@ -1557,15 +1557,15 @@ ff ff 66 66 -66 -90 -66 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 53 48 89 @@ -1610,10 +1610,10 @@ fb 5b eb d4 -66 -66 -66 -90 +0f +1f +40 +00 48 8b 3d @@ -1714,18 +1714,18 @@ c3 66 66 66 -90 66 66 66 -90 -66 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 6c @@ -1833,11 +1833,11 @@ c4 18 c3 66 -66 -90 -66 -66 -90 +0f +1f +44 +00 +00 48 8b 7d @@ -1881,11 +1881,11 @@ d8 c4 18 c3 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 53 83 7f @@ -2281,11 +2281,11 @@ ff 4c 8b 27 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 e9 fb fe @@ -3299,17 +3299,17 @@ ff 66 66 66 -90 66 66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 53 83 7f @@ -3353,11 +3353,11 @@ c7 00 5b c3 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 8b 4f 08 @@ -3382,14 +3382,14 @@ c3 c0 c3 66 -66 -90 -66 -66 -90 -66 -66 -90 +0f +1f +84 +00 +00 +00 +00 +00 8b 77 08 @@ -3413,15 +3413,15 @@ c0 f3 c3 66 -66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 83 ec @@ -3465,11 +3465,11 @@ d0 c4 08 c3 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 44 8b 47 @@ -3497,11 +3497,11 @@ e9 00 00 00 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 48 83 ec @@ -3545,11 +3545,11 @@ c0 c4 08 c3 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 48 8b 07 @@ -3577,11 +3577,11 @@ e9 00 00 00 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 53 8b 47 @@ -3641,11 +3641,11 @@ ff ff 7f c3 -66 -66 -90 -66 -90 +0f +1f +44 +00 +00 48 8b 3f @@ -3733,15 +3733,15 @@ d8 c3 66 66 -66 -90 -66 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 5c @@ -3929,11 +3929,11 @@ c4 38 c3 66 -66 -90 -66 -66 -90 +0f +1f +44 +00 +00 48 89 ef @@ -3947,9 +3947,9 @@ e8 41 89 c4 -66 -66 -90 +0f +1f +00 44 89 e6 @@ -3979,9 +3979,9 @@ d2 48 8b 2f -66 -66 -90 +0f +1f +00 e9 64 ff @@ -4070,14 +4070,14 @@ e9 ff ff ff -66 -66 -66 -90 -66 -66 -66 -90 +0f +1f +84 +00 +00 +00 +00 +00 48 89 5c @@ -4649,11 +4649,11 @@ fe ff ff 66 -66 -90 -66 -66 -90 +0f +1f +44 +00 +00 48 89 ef @@ -4715,9 +4715,9 @@ d0 fd ff ff -66 -66 -90 +0f +1f +00 48 89 5c @@ -4875,9 +4875,9 @@ ed 2f 74 be -66 -66 -90 +0f +1f +00 4c 89 ef @@ -4954,10 +4954,10 @@ d8 f0 eb 85 -66 -66 -66 -90 +0f +1f +40 +00 b8 01 00 @@ -5010,18 +5010,18 @@ ff 66 66 66 -90 66 66 66 -90 -66 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 5c @@ -5251,17 +5251,17 @@ eb 66 66 66 -90 66 66 -66 -90 -66 -66 -90 -66 -66 -90 +2e +0f +1f +84 +00 +00 +00 +00 +00 48 89 6c @@ -5767,13 +5767,13 @@ b8 00 00 00 -66 -66 -66 -90 -66 -66 -90 +0f +1f +80 +00 +00 +00 +00 c6 44 28 @@ -90134,7 +90134,7 @@ c0 00 00 00 -00 +02 00 00 00 diff --git a/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc b/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc index 32027367..e1d9c4d9 100644 --- a/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc +++ b/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh EXTRA_DIST += modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh diff --git a/modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh b/modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh index e892d33e..336ceab9 100755 --- a/modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh +++ b/modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh dwarf2_passwin64_test modules/dbgfmts/dwarf2/tests/passwin64 "dwarf2 dbgfmt passwin64" "-f win64 -p gas -g dwarf2" ".o" exit $? diff --git a/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn b/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn index d383da2a..be2a237e 100644 --- a/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn +++ b/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn @@ -4,7 +4,7 @@ -:10: warning: unrecognized section attribute: `M' -:10: warning: unrecognized section attribute: `S' -:10: warning: Unrecognized qualifier `progbits' --:24: warning: directive `.type' not recognized +-:24: warning: .type pseudo-op used outside of .def/.endef; ignored -:152: warning: directive `.size' not recognized -:153: warning: Unrecognized qualifier `progbits' -:190: warning: Unrecognized qualifier `progbits' diff --git a/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex b/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex index fdf74cc5..18adfd50 100644 --- a/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex +++ b/modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex @@ -66,8 +66,8 @@ 00 00 00 -04 -01 +00 +00 00 00 00 @@ -106,8 +106,8 @@ c0 00 00 00 -ec -01 +00 +00 00 00 00 @@ -146,8 +146,8 @@ f3 00 00 00 -37 -05 +00 +00 00 00 00 @@ -186,8 +186,8 @@ f3 00 00 00 -d6 -05 +00 +00 00 00 00 @@ -226,8 +226,8 @@ d6 00 00 00 -22 -06 +00 +00 00 00 00 @@ -266,8 +266,8 @@ ce 00 00 00 -6a -06 +00 +00 00 00 00 @@ -306,8 +306,8 @@ c0 00 00 00 -b2 -06 +00 +00 00 00 00 @@ -346,8 +346,8 @@ b2 00 00 00 -bf -08 +00 +00 00 00 00 @@ -386,8 +386,8 @@ bf 00 00 00 -da -08 +00 +00 00 00 00 @@ -426,8 +426,8 @@ da 00 00 00 -0a -09 +00 +00 00 00 00 @@ -466,8 +466,8 @@ aa 00 00 00 -54 -0b +00 +00 00 00 00 @@ -506,8 +506,8 @@ f4 00 00 00 -77 -0b +00 +00 00 00 00 @@ -611,13 +611,13 @@ b8 c4 18 c3 -66 -66 -66 -90 -66 -66 -90 +0f +1f +80 +00 +00 +00 +00 48 8b 7d @@ -646,10 +646,10 @@ c3 14 eb 77 -66 -66 -66 -90 +0f +1f +40 +00 89 c6 bf diff --git a/modules/dbgfmts/null/CMakeLists.txt b/modules/dbgfmts/null/CMakeLists.txt new file mode 100644 index 00000000..9f85b2fd --- /dev/null +++ b/modules/dbgfmts/null/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(dbgfmt_null + dbgfmts/null/null-dbgfmt.c + ) diff --git a/modules/dbgfmts/null/Makefile.inc b/modules/dbgfmts/null/Makefile.inc index 6582d744..94f7cdbe 100644 --- a/modules/dbgfmts/null/Makefile.inc +++ b/modules/dbgfmts/null/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/dbgfmts/null/null-dbgfmt.c YASM_MODULES += dbgfmt_null diff --git a/modules/dbgfmts/null/null-dbgfmt.c b/modules/dbgfmts/null/null-dbgfmt.c index d3f5fd13..d2d1bed5 100644 --- a/modules/dbgfmts/null/null-dbgfmt.c +++ b/modules/dbgfmts/null/null-dbgfmt.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include diff --git a/modules/dbgfmts/stabs/CMakeLists.txt b/modules/dbgfmts/stabs/CMakeLists.txt new file mode 100644 index 00000000..bd3b0268 --- /dev/null +++ b/modules/dbgfmts/stabs/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(dbgfmt_stabs + dbgfmts/stabs/stabs-dbgfmt.c + ) diff --git a/modules/dbgfmts/stabs/Makefile.inc b/modules/dbgfmts/stabs/Makefile.inc index f5ba1422..745c0dec 100644 --- a/modules/dbgfmts/stabs/Makefile.inc +++ b/modules/dbgfmts/stabs/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/dbgfmts/stabs/stabs-dbgfmt.c YASM_MODULES += dbgfmt_stabs diff --git a/modules/dbgfmts/stabs/stabs-dbgfmt.c b/modules/dbgfmts/stabs/stabs-dbgfmt.c index a3fe8277..64896cab 100644 --- a/modules/dbgfmts/stabs/stabs-dbgfmt.c +++ b/modules/dbgfmts/stabs/stabs-dbgfmt.c @@ -25,10 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include typedef enum { @@ -121,7 +118,7 @@ static void stabs_bc_str_print(const void *contents, FILE *f, int static int stabs_bc_str_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int stabs_bc_str_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -131,7 +128,7 @@ static void stabs_bc_stab_print(const void *contents, FILE *f, int static int stabs_bc_stab_calc_len (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); static int stabs_bc_stab_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -141,6 +138,7 @@ static const yasm_bytecode_callback stabs_bc_str_callback = { stabs_bc_str_destroy, stabs_bc_str_print, yasm_bc_finalize_common, + NULL, stabs_bc_str_calc_len, yasm_bc_expand_common, stabs_bc_str_tobytes, @@ -151,6 +149,7 @@ static const yasm_bytecode_callback stabs_bc_stab_callback = { stabs_bc_stab_destroy, stabs_bc_stab_print, yasm_bc_finalize_common, + NULL, stabs_bc_stab_calc_len, yasm_bc_expand_common, stabs_bc_stab_tobytes, @@ -317,7 +316,7 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, int new; yasm_bytecode *dbgbc; stabs_stab *stab; - yasm_bytecode *filebc, *nullbc, *laststr, *firstbc; + yasm_bytecode *filebc, *laststr, *firstbc; yasm_symrec *firstsym; yasm_section *stext; @@ -333,7 +332,7 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, info.errwarns = errwarns; info.lastline = 0; info.stabcount = 0; - info.stab = yasm_object_get_general(object, ".stab", 0, 4, 0, 0, &new, 0); + info.stab = yasm_object_get_general(object, ".stab", 4, 0, 0, &new, 0); if (!new) { yasm_bytecode *last = yasm_section_bcs_last(info.stab); if (last == NULL) { @@ -349,14 +348,14 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, } info.stabstr = - yasm_object_get_general(object, ".stabstr", 0, 1, 0, 0, &new, 0); + yasm_object_get_general(object, ".stabstr", 1, 0, 0, &new, 0); if (!new) { yasm_bytecode *last = yasm_section_bcs_last(info.stabstr); if (last == NULL) { yasm_error_set(YASM_ERROR_GENERAL, N_("stabs debugging conflicts with user-defined section .stabstr")); yasm_errwarn_propagate(errwarns, - yasm_section_bcs_first(info.stab)->line); + yasm_section_bcs_first(info.stabstr)->line); } else { yasm_warn_set(YASM_WARN_GENERAL, N_("stabs debugging overrides empty section .stabstr")); @@ -372,7 +371,7 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, yasm_section_bcs_append(info.stab, dbgbc); /* initial strtab bytecodes */ - nullbc = stabs_dbgfmt_append_bcstr(info.stabstr, ""); + stabs_dbgfmt_append_bcstr(info.stabstr, ""); filebc = stabs_dbgfmt_append_bcstr(info.stabstr, object->src_filename); stext = yasm_object_find_general(object, ".text"); @@ -405,7 +404,8 @@ stabs_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, } static int -stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -439,7 +439,8 @@ stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, } static int -stabs_bc_str_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +stabs_bc_str_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { diff --git a/modules/dbgfmts/stabs/tests/Makefile.inc b/modules/dbgfmts/stabs/tests/Makefile.inc index 9563d9c5..6f789eb8 100644 --- a/modules/dbgfmts/stabs/tests/Makefile.inc +++ b/modules/dbgfmts/stabs/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += modules/dbgfmts/stabs/tests/stabs_test.sh TESTS += modules/dbgfmts/stabs/tests/stabs_test.sh diff --git a/modules/dbgfmts/stabs/tests/stabs-elf.hex b/modules/dbgfmts/stabs/tests/stabs-elf.hex index c2e9e3cf..71cd7c9f 100644 --- a/modules/dbgfmts/stabs/tests/stabs-elf.hex +++ b/modules/dbgfmts/stabs/tests/stabs-elf.hex @@ -599,7 +599,7 @@ c3 00 00 01 -04 +02 00 00 00 @@ -862,6 +862,22 @@ c3 00 f1 ff +69 +00 +00 +00 +3d +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 00 00 00 @@ -894,22 +910,6 @@ ff 00 09 00 -69 -00 -00 -00 -3d -00 -00 -00 -00 -00 -00 -00 -00 -00 -04 -00 00 00 00 diff --git a/modules/dbgfmts/stabs/tests/stabs_test.sh b/modules/dbgfmts/stabs/tests/stabs_test.sh index 64f24f33..e04b9522 100755 --- a/modules/dbgfmts/stabs/tests/stabs_test.sh +++ b/modules/dbgfmts/stabs/tests/stabs_test.sh @@ -1,5 +1,4 @@ #! /bin/sh -# $Id$ # copied from yasm/modules/objfmts/coff/tests/coff_test.sh ; s/coff/stabs/g ${srcdir}/out_test.sh stabs_test modules/dbgfmts/stabs/tests "stabs dbgfmt" "-f elf -g stabs" ".o" exit $? diff --git a/modules/dbgfmts/yasm_dbgfmts.xml b/modules/dbgfmts/yasm_dbgfmts.xml index 5b15925f..7cd38a49 100644 --- a/modules/dbgfmts/yasm_dbgfmts.xml +++ b/modules/dbgfmts/yasm_dbgfmts.xml @@ -2,8 +2,6 @@ - - diff --git a/modules/listfmts/CMakeLists.txt b/modules/listfmts/CMakeLists.txt new file mode 100644 index 00000000..ce3c92a0 --- /dev/null +++ b/modules/listfmts/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE(listfmts/nasm/CMakeLists.txt) diff --git a/modules/listfmts/Makefile.inc b/modules/listfmts/Makefile.inc index 2621412e..77fb2ec5 100644 --- a/modules/listfmts/Makefile.inc +++ b/modules/listfmts/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += modules/listfmts/nasm/Makefile.inc include modules/listfmts/nasm/Makefile.inc diff --git a/modules/listfmts/nasm/CMakeLists.txt b/modules/listfmts/nasm/CMakeLists.txt new file mode 100644 index 00000000..9d54f82f --- /dev/null +++ b/modules/listfmts/nasm/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(listfmt_nasm + listfmts/nasm/nasm-listfmt.c + ) diff --git a/modules/listfmts/nasm/Makefile.inc b/modules/listfmts/nasm/Makefile.inc index 7df9badc..6f00499e 100644 --- a/modules/listfmts/nasm/Makefile.inc +++ b/modules/listfmts/nasm/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/listfmts/nasm/nasm-listfmt.c YASM_MODULES += listfmt_nasm diff --git a/modules/listfmts/nasm/nasm-listfmt.c b/modules/listfmts/nasm/nasm-listfmt.c index 21ce4330..1dfc5b62 100644 --- a/modules/listfmts/nasm/nasm-listfmt.c +++ b/modules/listfmts/nasm/nasm-listfmt.c @@ -25,10 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL #include /* NOTE: For this code to generate relocation information, the relocations diff --git a/modules/objfmts/CMakeLists.txt b/modules/objfmts/CMakeLists.txt new file mode 100644 index 00000000..c00a3a04 --- /dev/null +++ b/modules/objfmts/CMakeLists.txt @@ -0,0 +1,9 @@ +INCLUDE(objfmts/dbg/CMakeLists.txt) +INCLUDE(objfmts/bin/CMakeLists.txt) +INCLUDE(objfmts/elf/CMakeLists.txt) +INCLUDE(objfmts/coff/CMakeLists.txt) +INCLUDE(objfmts/macho/CMakeLists.txt) +INCLUDE(objfmts/rdf/CMakeLists.txt) +#INCLUDE(objfmts/win32/CMakeLists.txt) +#INCLUDE(objfmts/win64/CMakeLists.txt) +INCLUDE(objfmts/xdf/CMakeLists.txt) diff --git a/modules/objfmts/Makefile.inc b/modules/objfmts/Makefile.inc index be672182..a76359a4 100644 --- a/modules/objfmts/Makefile.inc +++ b/modules/objfmts/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += modules/objfmts/dbg/Makefile.inc EXTRA_DIST += modules/objfmts/bin/Makefile.inc EXTRA_DIST += modules/objfmts/elf/Makefile.inc @@ -22,7 +20,7 @@ include modules/objfmts/win32/Makefile.inc include modules/objfmts/win64/Makefile.inc include modules/objfmts/xdf/Makefile.inc -dist_man_MANS += yasm_objfmts.7 +notrans_dist_man_MANS += yasm_objfmts.7 if BUILD_MAN yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml diff --git a/modules/objfmts/bin/CMakeLists.txt b/modules/objfmts/bin/CMakeLists.txt new file mode 100644 index 00000000..7af5e22b --- /dev/null +++ b/modules/objfmts/bin/CMakeLists.txt @@ -0,0 +1,6 @@ +YASM_ADD_MODULE(objfmt_bin + objfmts/bin/bin-objfmt.c + ) + +YASM_ADD_MODULE(objfmt_dosexe + ) diff --git a/modules/objfmts/bin/Makefile.inc b/modules/objfmts/bin/Makefile.inc index 4d38b539..ae23cfe7 100644 --- a/modules/objfmts/bin/Makefile.inc +++ b/modules/objfmts/bin/Makefile.inc @@ -1,8 +1,6 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/bin/bin-objfmt.c -YASM_MODULES += objfmt_bin +YASM_MODULES += objfmt_bin objfmt_dosexe EXTRA_DIST += modules/objfmts/bin/tests/Makefile.inc diff --git a/modules/objfmts/bin/bin-objfmt.c b/modules/objfmts/bin/bin-objfmt.c index 2e7fd727..c5abd87a 100644 --- a/modules/objfmts/bin/bin-objfmt.c +++ b/modules/objfmts/bin/bin-objfmt.c @@ -25,20 +25,78 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL +#ifdef HAVE_UNISTD_H +#include +#endif #include +#include #define REGULAR_OUTBUF_SIZE 1024 +typedef struct bin_section_data { + int bss; /* aka nobits */ + + /* User-provided alignment */ + yasm_intnum *align, *valign; + + /* User-provided starts */ + /*@null@*/ /*@owned@*/ yasm_expr *start, *vstart; + + /* User-provided follows */ + /*@null@*/ /*@owned@*/ char *follows, *vfollows; + + /* Calculated (final) starts, used only during output() */ + /*@null@*/ /*@owned@*/ yasm_intnum *istart, *ivstart; + + /* Calculated (final) length, used only during output() */ + /*@null@*/ /*@owned@*/ yasm_intnum *length; +} bin_section_data; + typedef struct yasm_objfmt_bin { yasm_objfmt_base objfmt; /* base structure */ + + enum { + NO_MAP = 0, + MAP_NONE = 0x01, + MAP_BRIEF = 0x02, + MAP_SECTIONS = 0x04, + MAP_SYMBOLS = 0x08 + } map_flags; + /*@null@*/ /*@only@*/ char *map_filename; + + /*@null@*/ /*@only@*/ yasm_expr *org; } yasm_objfmt_bin; +/* symrec data is used only for the special symbols section.start, + * section.vstart, and section.length + */ +typedef struct bin_symrec_data { + yasm_section *section; /* referenced section */ + enum bin_ssym { + SSYM_START, + SSYM_VSTART, + SSYM_LENGTH + } which; +} bin_symrec_data; + +static void bin_section_data_destroy(/*@only@*/ void *d); +static void bin_section_data_print(void *data, FILE *f, int indent_level); + +static const yasm_assoc_data_callback bin_section_data_cb = { + bin_section_data_destroy, + bin_section_data_print +}; + +static void bin_symrec_data_destroy(/*@only@*/ void *d); +static void bin_symrec_data_print(void *data, FILE *f, int indent_level); + +static const yasm_assoc_data_callback bin_symrec_data_cb = { + bin_symrec_data_destroy, + bin_symrec_data_print +}; + yasm_objfmt_module yasm_bin_LTX_objfmt; @@ -47,40 +105,84 @@ bin_objfmt_create(yasm_object *object) { yasm_objfmt_bin *objfmt_bin = yasm_xmalloc(sizeof(yasm_objfmt_bin)); objfmt_bin->objfmt.module = &yasm_bin_LTX_objfmt; + + objfmt_bin->map_flags = NO_MAP; + objfmt_bin->map_filename = NULL; + objfmt_bin->org = NULL; + return (yasm_objfmt *)objfmt_bin; } -/* Aligns sect to either its specified alignment. Uses prevsect and base to - * both determine the new starting address (returned) and the total length of - * prevsect after sect has been aligned. - */ -static unsigned long -bin_objfmt_align_section(yasm_section *sect, yasm_section *prevsect, - unsigned long base, - /*@out@*/ unsigned long *prevsectlen, - /*@out@*/ unsigned long *padamt) +typedef TAILQ_HEAD(bin_group_head, bin_group) bin_groups; + +typedef struct bin_group { + TAILQ_ENTRY(bin_group) link; + yasm_section *section; + bin_section_data *bsd; + + /* Groups that (in parallel) logically come immediately after this + * group's section. + */ + bin_groups follow_groups; +} bin_group; + +/* Recursive function to find group containing named section. */ +static bin_group * +find_group_by_name(bin_groups *groups, const char *name) { - unsigned long start; - unsigned long align; + bin_group *group, *found; + TAILQ_FOREACH(group, groups, link) { + if (strcmp(yasm_section_get_name(group->section), name) == 0) + return group; + /* Recurse to loop through follow groups */ + found = find_group_by_name(&group->follow_groups, name); + if (found) + return found; + } + return NULL; +} - /* Figure out the size of .text by looking at the last bytecode's offset - * plus its length. Add the start and size together to get the new start. - */ - *prevsectlen = yasm_bc_next_offset(yasm_section_bcs_last(prevsect)); - start = base + *prevsectlen; +/* Recursive function to find group. Returns NULL if not found. */ +static bin_group * +find_group_by_section(bin_groups *groups, yasm_section *section) +{ + bin_group *group, *found; + TAILQ_FOREACH(group, groups, link) { + if (group->section == section) + return group; + /* Recurse to loop through follow groups */ + found = find_group_by_section(&group->follow_groups, section); + if (found) + return found; + } + return NULL; +} - /* Round new start up to alignment of .data section, and adjust textlen to - * indicate padded size. Because aignment is always a power of two, we - * can use some bit trickery to do this easily. - */ - align = yasm_section_get_align(sect); +#if 0 +/* Debugging function */ +static void +print_groups(const bin_groups *groups, int indent_level) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + printf("%*sSection `%s':\n", indent_level, "", + yasm_section_get_name(group->section)); + bin_section_data_print(group->bsd, stdout, indent_level+1); + if (!TAILQ_EMPTY(&group->follow_groups)) { + printf("%*sFollowing groups:\n", indent_level, ""); + print_groups(&group->follow_groups, indent_level+1); + } + } +} +#endif - if (start & (align-1)) - start = (start & ~(align-1)) + align; - - *padamt = start - (base + *prevsectlen); - - return start; +static void +bin_group_destroy(/*@only@*/ bin_group *group) +{ + bin_group *follow, *group_temp; + TAILQ_FOREACH_SAFE(follow, &group->follow_groups, link, group_temp) + bin_group_destroy(follow); + yasm_xfree(group); } typedef struct bin_objfmt_output_info { @@ -90,21 +192,315 @@ typedef struct bin_objfmt_output_info { /*@only@*/ unsigned char *buf; /*@observer@*/ const yasm_section *sect; unsigned long start; /* what normal variables go against */ - unsigned long abs_start; /* what absolutes go against */ + + yasm_intnum *origin; + yasm_intnum *tmp_intn; /* temporary working intnum */ + + bin_groups lma_groups, vma_groups; } bin_objfmt_output_info; +static int +bin_objfmt_check_sym(yasm_symrec *sym, /*@null@*/ void *d) +{ + /*@null@*/ bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + yasm_sym_vis vis = yasm_symrec_get_visibility(sym); + assert(info != NULL); + + /* Don't check internally-generated symbols. Only internally generated + * symbols have symrec data, so simply check for its presence. + */ + if (yasm_symrec_get_data(sym, &bin_symrec_data_cb)) + return 0; + + if (vis & YASM_SYM_EXTERN) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("binary object format does not support extern variables")); + yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + } else if (vis & YASM_SYM_GLOBAL) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("binary object format does not support global variables")); + yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + } else if (vis & YASM_SYM_COMMON) { + yasm_error_set(YASM_ERROR_TYPE, + N_("binary object format does not support common variables")); + yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + } + return 0; +} + +static int +bin_lma_create_group(yasm_section *sect, /*@null@*/ void *d) +{ + bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + unsigned long align = yasm_section_get_align(sect); + bin_group *group; + + assert(info != NULL); + assert(bsd != NULL); + + group = yasm_xmalloc(sizeof(bin_group)); + group->section = sect; + group->bsd = bsd; + TAILQ_INIT(&group->follow_groups); + + /* Determine section alignment as necessary. */ + if (!bsd->align) + bsd->align = yasm_intnum_create_uint(align > 4 ? align : 4); + else { + yasm_intnum *align_intn = yasm_intnum_create_uint(align); + if (yasm_intnum_compare(align_intn, bsd->align) > 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("section `%s' internal align of %lu is greater than `%s' of %lu; using `%s'"), + yasm_section_get_name(sect), + yasm_intnum_get_uint(align_intn), + N_("align"), + yasm_intnum_get_uint(bsd->align), + N_("align")); + yasm_errwarn_propagate(info->errwarns, 0); + } + yasm_intnum_destroy(align_intn); + } + + /* Calculate section integer start. */ + if (bsd->start) { + bsd->istart = yasm_expr_get_intnum(&bsd->start, 0); + if (!bsd->istart) { + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("start expression is too complex")); + yasm_errwarn_propagate(info->errwarns, bsd->start->line); + return 1; + } else + bsd->istart = yasm_intnum_copy(bsd->istart); + } else + bsd->istart = NULL; + + /* Calculate section integer vstart. */ + if (bsd->vstart) { + bsd->ivstart = yasm_expr_get_intnum(&bsd->vstart, 0); + if (!bsd->ivstart) { + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("vstart expression is too complex")); + yasm_errwarn_propagate(info->errwarns, bsd->vstart->line); + return 1; + } else + bsd->ivstart = yasm_intnum_copy(bsd->ivstart); + } else + bsd->ivstart = NULL; + + /* Calculate section integer length. */ + bsd->length = yasm_calc_bc_dist(yasm_section_bcs_first(sect), + yasm_section_bcs_last(sect)); + + TAILQ_INSERT_TAIL(&info->lma_groups, group, link); + return 0; +} + +static int +bin_vma_create_group(yasm_section *sect, /*@null@*/ void *d) +{ + bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + bin_group *group; + + assert(info != NULL); + assert(bsd != NULL); + + group = yasm_xmalloc(sizeof(bin_group)); + group->section = sect; + group->bsd = bsd; + TAILQ_INIT(&group->follow_groups); + + TAILQ_INSERT_TAIL(&info->vma_groups, group, link); + return 0; +} + +/* Calculates new start address based on alignment constraint. + * Start is modified (rounded up) to the closest aligned value greater than + * what was passed in. + * Align must be a power of 2. + */ +static void +bin_objfmt_align(yasm_intnum *start, const yasm_intnum *align) +{ + /* Because alignment is always a power of two, we can use some bit + * trickery to do this easily. + */ + yasm_intnum *align_intn = + yasm_intnum_create_uint(yasm_intnum_get_uint(align)-1); + yasm_intnum_calc(align_intn, YASM_EXPR_AND, start); + if (!yasm_intnum_is_zero(align_intn)) { + /* start = (start & ~(align-1)) + align; */ + yasm_intnum_set_uint(align_intn, yasm_intnum_get_uint(align)-1); + yasm_intnum_calc(align_intn, YASM_EXPR_NOT, NULL); + yasm_intnum_calc(align_intn, YASM_EXPR_AND, start); + yasm_intnum_set(start, align); + yasm_intnum_calc(start, YASM_EXPR_ADD, align_intn); + } + yasm_intnum_destroy(align_intn); +} + +/* Recursive function to assign start addresses. + * Updates start, last, and vdelta parameters as it goes along. + * The tmp parameter is just a working intnum so one doesn't have to be + * locally allocated for this purpose. + */ +static void +group_assign_start_recurse(bin_group *group, yasm_intnum *start, + yasm_intnum *last, yasm_intnum *vdelta, + yasm_intnum *tmp, yasm_errwarns *errwarns) +{ + bin_group *follow_group; + + /* Determine LMA */ + if (group->bsd->istart) { + yasm_intnum_set(group->bsd->istart, start); + if (group->bsd->align) { + bin_objfmt_align(group->bsd->istart, group->bsd->align); + if (yasm_intnum_compare(start, group->bsd->istart) != 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("start inconsistent with align; using aligned value")); + yasm_errwarn_propagate(errwarns, group->bsd->start->line); + } + } + } else { + group->bsd->istart = yasm_intnum_copy(start); + if (group->bsd->align != 0) + bin_objfmt_align(group->bsd->istart, group->bsd->align); + } + + /* Determine VMA if either just valign specified or if no v* specified */ + if (!group->bsd->vstart) { + if (!group->bsd->vfollows && !group->bsd->valign) { + /* No v* specified, set VMA=LMA+vdelta. */ + group->bsd->ivstart = yasm_intnum_copy(group->bsd->istart); + yasm_intnum_calc(group->bsd->ivstart, YASM_EXPR_ADD, vdelta); + } else if (!group->bsd->vfollows) { + /* Just valign specified: set VMA=LMA+vdelta, align VMA, then add + * delta between unaligned and aligned to vdelta parameter. + */ + group->bsd->ivstart = yasm_intnum_copy(group->bsd->istart); + yasm_intnum_calc(group->bsd->ivstart, YASM_EXPR_ADD, vdelta); + yasm_intnum_set(tmp, group->bsd->ivstart); + bin_objfmt_align(group->bsd->ivstart, group->bsd->valign); + yasm_intnum_calc(vdelta, YASM_EXPR_ADD, group->bsd->ivstart); + yasm_intnum_calc(vdelta, YASM_EXPR_SUB, tmp); + } + } + + /* Find the maximum end value */ + yasm_intnum_set(tmp, group->bsd->istart); + yasm_intnum_calc(tmp, YASM_EXPR_ADD, group->bsd->length); + if (yasm_intnum_compare(tmp, last) > 0) /* tmp > last */ + yasm_intnum_set(last, tmp); + + /* Recurse for each following group. */ + TAILQ_FOREACH(follow_group, &group->follow_groups, link) { + /* Following sections have to follow this one, + * so add length to start. + */ + yasm_intnum_set(start, group->bsd->istart); + yasm_intnum_calc(start, YASM_EXPR_ADD, group->bsd->length); + + group_assign_start_recurse(follow_group, start, last, vdelta, tmp, + errwarns); + } +} + +/* Recursive function to assign start addresses. + * Updates start parameter as it goes along. + * The tmp parameter is just a working intnum so one doesn't have to be + * locally allocated for this purpose. + */ +static void +group_assign_vstart_recurse(bin_group *group, yasm_intnum *start, + yasm_errwarns *errwarns) +{ + bin_group *follow_group; + + /* Determine VMA section alignment as necessary. + * Default to LMA alignment if not specified. + */ + if (!group->bsd->valign) + group->bsd->valign = yasm_intnum_copy(group->bsd->align); + else { + unsigned long align = yasm_section_get_align(group->section); + yasm_intnum *align_intn = yasm_intnum_create_uint(align); + if (yasm_intnum_compare(align_intn, group->bsd->valign) > 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("section `%s' internal align of %lu is greater than `%s' of %lu; using `%s'"), + yasm_section_get_name(group->section), + yasm_intnum_get_uint(align_intn), + N_("valign"), + yasm_intnum_get_uint(group->bsd->valign), + N_("valign")); + yasm_errwarn_propagate(errwarns, 0); + } + yasm_intnum_destroy(align_intn); + } + + /* Determine VMA */ + if (group->bsd->ivstart) { + yasm_intnum_set(group->bsd->ivstart, start); + if (group->bsd->valign) { + bin_objfmt_align(group->bsd->ivstart, group->bsd->valign); + if (yasm_intnum_compare(start, group->bsd->ivstart) != 0) { + yasm_error_set(YASM_ERROR_VALUE, + N_("vstart inconsistent with valign")); + yasm_errwarn_propagate(errwarns, group->bsd->vstart->line); + } + } + } else { + group->bsd->ivstart = yasm_intnum_copy(start); + if (group->bsd->valign) + bin_objfmt_align(group->bsd->ivstart, group->bsd->valign); + } + + /* Recurse for each following group. */ + TAILQ_FOREACH(follow_group, &group->follow_groups, link) { + /* Following sections have to follow this one, + * so add length to start. + */ + yasm_intnum_set(start, group->bsd->ivstart); + yasm_intnum_calc(start, YASM_EXPR_ADD, group->bsd->length); + + group_assign_vstart_recurse(follow_group, start, errwarns); + } +} + +static /*@null@*/ const yasm_intnum * +get_ssym_value(yasm_symrec *sym) +{ + bin_symrec_data *bsymd = yasm_symrec_get_data(sym, &bin_symrec_data_cb); + bin_section_data *bsd; + + if (!bsymd) + return NULL; + + bsd = yasm_section_get_data(bsymd->section, &bin_section_data_cb); + assert(bsd != NULL); + + switch (bsymd->which) { + case SSYM_START: return bsd->istart; + case SSYM_VSTART: return bsd->ivstart; + case SSYM_LENGTH: return bsd->length; + } + return NULL; +} + static /*@only@*/ yasm_expr * bin_objfmt_expr_xform(/*@returned@*/ /*@only@*/ yasm_expr *e, /*@unused@*/ /*@null@*/ void *d) { int i; - /*@dependent@*/ yasm_section *sect; - /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; - /*@null@*/ yasm_intnum *dist; - for (i=0; inumterms; i++) { + /*@dependent@*/ yasm_section *sect; + /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; + /*@null@*/ yasm_intnum *dist; + /*@null@*/ const yasm_intnum *ssymval; + /* Transform symrecs or precbcs that reference sections into - * start expr + intnum(dist). + * vstart + intnum(dist). */ if (((e->terms[i].type == YASM_EXPR_SYM && yasm_symrec_get_label(e->terms[i].data.sym, &precbc)) || @@ -112,18 +508,399 @@ bin_objfmt_expr_xform(/*@returned@*/ /*@only@*/ yasm_expr *e, (precbc = e->terms[i].data.precbc))) && (sect = yasm_bc_get_section(precbc)) && (dist = yasm_calc_bc_dist(yasm_section_bcs_first(sect), precbc))) { - const yasm_expr *start = yasm_section_get_start(sect); - e->terms[i].type = YASM_EXPR_EXPR; - e->terms[i].data.expn = - yasm_expr_create(YASM_EXPR_ADD, - yasm_expr_expr(yasm_expr_copy(start)), - yasm_expr_int(dist), e->line); + bin_section_data *bsd; + bsd = yasm_section_get_data(sect, &bin_section_data_cb); + assert(bsd != NULL); + yasm_intnum_calc(dist, YASM_EXPR_ADD, bsd->ivstart); + e->terms[i].type = YASM_EXPR_INT; + e->terms[i].data.intn = dist; + } + + /* Transform our special symrecs into the appropriate value */ + if (e->terms[i].type == YASM_EXPR_SYM && + (ssymval = get_ssym_value(e->terms[i].data.sym))) { + e->terms[i].type = YASM_EXPR_INT; + e->terms[i].data.intn = yasm_intnum_copy(ssymval); } } return e; } +typedef struct map_output_info { + /* address width */ + int bytes; + + /* intnum output static data areas */ + unsigned char *buf; + yasm_intnum *intn; + + /* symrec output information */ + unsigned long count; + yasm_section *section; /* NULL for EQUs */ + + yasm_object *object; /* object */ + FILE *f; /* map output file */ +} map_output_info; + +static int +map_prescan_bytes(yasm_section *sect, void *d) +{ + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + map_output_info *info = (map_output_info *)d; + + assert(bsd != NULL); + assert(info != NULL); + + while (!yasm_intnum_check_size(bsd->length, info->bytes * 8, 0, 0)) + info->bytes *= 2; + while (!yasm_intnum_check_size(bsd->istart, info->bytes * 8, 0, 0)) + info->bytes *= 2; + while (!yasm_intnum_check_size(bsd->ivstart, info->bytes * 8, 0, 0)) + info->bytes *= 2; + + return 0; +} + +static void +map_print_intnum(const yasm_intnum *intn, map_output_info *info) +{ + size_t i; + yasm_intnum_get_sized(intn, info->buf, info->bytes, info->bytes*8, 0, 0, + 0); + for (i=info->bytes; i != 0; i--) + fprintf(info->f, "%02X", info->buf[i-1]); +} + +static void +map_sections_summary(bin_groups *groups, map_output_info *info) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + bin_section_data *bsd = group->bsd; + + assert(bsd != NULL); + assert(info != NULL); + + map_print_intnum(bsd->ivstart, info); + fprintf(info->f, " "); + + yasm_intnum_set(info->intn, bsd->ivstart); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->length); + map_print_intnum(info->intn, info); + fprintf(info->f, " "); + + map_print_intnum(bsd->istart, info); + fprintf(info->f, " "); + + yasm_intnum_set(info->intn, bsd->istart); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->length); + map_print_intnum(info->intn, info); + fprintf(info->f, " "); + + map_print_intnum(bsd->length, info); + fprintf(info->f, " "); + + fprintf(info->f, "%-*s", 10, bsd->bss ? "nobits" : "progbits"); + fprintf(info->f, "%s\n", yasm_section_get_name(group->section)); + + /* Recurse to loop through follow groups */ + map_sections_summary(&group->follow_groups, info); + } +} + +static void +map_sections_detail(bin_groups *groups, map_output_info *info) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + bin_section_data *bsd = group->bsd; + size_t i; + const char *s; + + s = yasm_section_get_name(group->section); + fprintf(info->f, "---- Section %s ", s); + for (i=0; i<(65-strlen(s)); i++) + fputc('-', info->f); + + fprintf(info->f, "\n\nclass: %s", + bsd->bss ? "nobits" : "progbits"); + fprintf(info->f, "\nlength: "); + map_print_intnum(bsd->length, info); + fprintf(info->f, "\nstart: "); + map_print_intnum(bsd->istart, info); + fprintf(info->f, "\nalign: "); + map_print_intnum(bsd->align, info); + fprintf(info->f, "\nfollows: %s", + bsd->follows ? bsd->follows : "not defined"); + fprintf(info->f, "\nvstart: "); + map_print_intnum(bsd->ivstart, info); + fprintf(info->f, "\nvalign: "); + map_print_intnum(bsd->valign, info); + fprintf(info->f, "\nvfollows: %s\n\n", + bsd->vfollows ? bsd->vfollows : "not defined"); + + /* Recurse to loop through follow groups */ + map_sections_detail(&group->follow_groups, info); + } +} + +static int +map_symrec_count(yasm_symrec *sym, void *d) +{ + map_output_info *info = (map_output_info *)d; + /*@dependent@*/ yasm_bytecode *precbc; + + assert(info != NULL); + + /* TODO: autodetect wider size */ + if (!info->section && yasm_symrec_get_equ(sym)) { + info->count++; + } else if (yasm_symrec_get_label(sym, &precbc) && + yasm_bc_get_section(precbc) == info->section) { + info->count++; + } + return 0; +} + +static int +map_symrec_output(yasm_symrec *sym, void *d) +{ + map_output_info *info = (map_output_info *)d; + const yasm_expr *equ; + /*@dependent@*/ yasm_bytecode *precbc; + /*@only@*/ char *name = yasm_symrec_get_global_name(sym, info->object); + + assert(info != NULL); + + if (!info->section && (equ = yasm_symrec_get_equ(sym))) { + yasm_expr *realequ = yasm_expr_copy(equ); + realequ = yasm_expr__level_tree + (realequ, 1, 1, 1, 0, bin_objfmt_expr_xform, NULL); + yasm_intnum_set(info->intn, yasm_expr_get_intnum(&realequ, 0)); + yasm_expr_destroy(realequ); + map_print_intnum(info->intn, info); + fprintf(info->f, " %s\n", name); + } else if (yasm_symrec_get_label(sym, &precbc) && + yasm_bc_get_section(precbc) == info->section) { + bin_section_data *bsd = + yasm_section_get_data(info->section, &bin_section_data_cb); + + /* Real address */ + yasm_intnum_set_uint(info->intn, yasm_bc_next_offset(precbc)); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->istart); + map_print_intnum(info->intn, info); + fprintf(info->f, " "); + + /* Virtual address */ + yasm_intnum_set_uint(info->intn, yasm_bc_next_offset(precbc)); + yasm_intnum_calc(info->intn, YASM_EXPR_ADD, bsd->ivstart); + map_print_intnum(info->intn, info); + + /* Name */ + fprintf(info->f, " %s\n", name); + } + yasm_xfree(name); + return 0; +} + +static void +map_sections_symbols(bin_groups *groups, map_output_info *info) +{ + bin_group *group; + TAILQ_FOREACH(group, groups, link) { + info->count = 0; + info->section = group->section; + yasm_symtab_traverse(info->object->symtab, info, map_symrec_count); + + if (info->count > 0) { + const char *s = yasm_section_get_name(group->section); + size_t i; + fprintf(info->f, "---- Section %s ", s); + for (i=0; i<(65-strlen(s)); i++) + fputc('-', info->f); + fprintf(info->f, "\n\n%-*s%-*s%s\n", + info->bytes*2+2, "Real", + info->bytes*2+2, "Virtual", + "Name"); + yasm_symtab_traverse(info->object->symtab, info, + map_symrec_output); + fprintf(info->f, "\n\n"); + } + + /* Recurse to loop through follow groups */ + map_sections_symbols(&group->follow_groups, info); + } +} + +static void +output_map(bin_objfmt_output_info *info) +{ + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)info->object->objfmt; + FILE *f; + int i; + map_output_info mapinfo; + + if (objfmt_bin->map_flags == NO_MAP) + return; + + if (objfmt_bin->map_flags == MAP_NONE) + objfmt_bin->map_flags = MAP_BRIEF; /* default to brief */ + + if (!objfmt_bin->map_filename) + f = stdout; /* default to stdout */ + else { + f = fopen(objfmt_bin->map_filename, "wt"); + if (!f) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("unable to open map file `%s'"), + objfmt_bin->map_filename); + yasm_errwarn_propagate(info->errwarns, 0); + return; + } + } + + mapinfo.object = info->object; + mapinfo.f = f; + + /* Temporary intnum */ + mapinfo.intn = info->tmp_intn; + + /* Prescan all values to figure out what width we should make the output + * fields. Start with a minimum of 4. + */ + mapinfo.bytes = 4; + while (!yasm_intnum_check_size(info->origin, mapinfo.bytes * 8, 0, 0)) + mapinfo.bytes *= 2; + yasm_object_sections_traverse(info->object, &mapinfo, map_prescan_bytes); + mapinfo.buf = yasm_xmalloc(mapinfo.bytes); + + fprintf(f, "\n- YASM Map file "); + for (i=0; i<63; i++) + fputc('-', f); + fprintf(f, "\n\nSource file: %s\n", info->object->src_filename); + if (getenv("YASM_TEST_SUITE")) { + const char *filename = info->object->obj_filename; + const char *next_filename; + while ((next_filename = strpbrk(filename, "/\\"))) + filename = next_filename + 1; + fprintf(f, "Output file: %s\n\n", filename); + } else { + fprintf(f, "Output file: %s\n\n", info->object->obj_filename); + } + + fprintf(f, "-- Program origin "); + for (i=0; i<61; i++) + fputc('-', f); + fprintf(f, "\n\n"); + map_print_intnum(info->origin, &mapinfo); + fprintf(f, "\n\n"); + + if (objfmt_bin->map_flags & MAP_BRIEF) { + fprintf(f, "-- Sections (summary) "); + for (i=0; i<57; i++) + fputc('-', f); + fprintf(f, "\n\n%-*s%-*s%-*s%-*s%-*s%-*s%s\n", + mapinfo.bytes*2+2, "Vstart", + mapinfo.bytes*2+2, "Vstop", + mapinfo.bytes*2+2, "Start", + mapinfo.bytes*2+2, "Stop", + mapinfo.bytes*2+2, "Length", + 10, "Class", "Name"); + + map_sections_summary(&info->lma_groups, &mapinfo); + fprintf(f, "\n"); + } + + if (objfmt_bin->map_flags & MAP_SECTIONS) { + fprintf(f, "-- Sections (detailed) "); + for (i=0; i<56; i++) + fputc('-', f); + fprintf(f, "\n\n"); + map_sections_detail(&info->lma_groups, &mapinfo); + } + + if (objfmt_bin->map_flags & MAP_SYMBOLS) { + fprintf(f, "-- Symbols "); + for (i=0; i<68; i++) + fputc('-', f); + fprintf(f, "\n\n"); + + /* We do two passes for EQU and each section; the first pass + * determines the byte width to use for the value and whether any + * symbols are present, the second pass actually outputs the text. + */ + + /* EQUs */ + mapinfo.count = 0; + mapinfo.section = NULL; + yasm_symtab_traverse(info->object->symtab, &mapinfo, map_symrec_count); + + if (mapinfo.count > 0) { + fprintf(f, "---- No Section "); + for (i=0; i<63; i++) + fputc('-', f); + fprintf(f, "\n\n%-*s%s\n", mapinfo.bytes*2+2, "Value", "Name"); + yasm_symtab_traverse(info->object->symtab, &mapinfo, + map_symrec_output); + fprintf(f, "\n\n"); + } + + /* Other sections */ + map_sections_symbols(&info->lma_groups, &mapinfo); + } + + if (f != stdout) + fclose(f); + + yasm_xfree(mapinfo.buf); +} + +/* Check for LMA overlap using a simple N^2 algorithm. */ +static int +check_lma_overlap(yasm_section *sect, /*@null@*/ void *d) +{ + bin_section_data *bsd, *bsd2; + yasm_section *other = (yasm_section *)d; + yasm_intnum *overlap; + + if (!d) + return yasm_object_sections_traverse(yasm_section_get_object(sect), + sect, check_lma_overlap); + if (sect == other) + return 0; + + bsd = yasm_section_get_data(sect, &bin_section_data_cb); + bsd2 = yasm_section_get_data(other, &bin_section_data_cb); + + if (yasm_intnum_is_zero(bsd->length) || + yasm_intnum_is_zero(bsd2->length)) + return 0; + + if (yasm_intnum_compare(bsd->istart, bsd2->istart) <= 0) { + overlap = yasm_intnum_copy(bsd->istart); + yasm_intnum_calc(overlap, YASM_EXPR_ADD, bsd->length); + yasm_intnum_calc(overlap, YASM_EXPR_SUB, bsd2->istart); + } else { + overlap = yasm_intnum_copy(bsd2->istart); + yasm_intnum_calc(overlap, YASM_EXPR_ADD, bsd2->length); + yasm_intnum_calc(overlap, YASM_EXPR_SUB, bsd->istart); + } + + if (yasm_intnum_sign(overlap) > 0) { + yasm_error_set(YASM_ERROR_GENERAL, + N_("sections `%s' and `%s' overlap by %lu bytes"), + yasm_section_get_name(sect), + yasm_section_get_name(other), + yasm_intnum_get_uint(overlap)); + yasm_intnum_destroy(overlap); + return -1; + } + + yasm_intnum_destroy(overlap); + return 0; +} + static int bin_objfmt_output_value(yasm_value *value, unsigned char *buf, unsigned int destsize, @@ -140,6 +917,7 @@ bin_objfmt_output_value(yasm_value *value, unsigned char *buf, if (value->rel) { unsigned int rshift = (unsigned int)value->rshift; yasm_expr *syme; + /*@null@*/ const yasm_intnum *ssymval; if (yasm_symrec_is_abs(value->rel)) { syme = yasm_expr_create_ident(yasm_expr_int( @@ -147,6 +925,9 @@ bin_objfmt_output_value(yasm_value *value, unsigned char *buf, } else if (yasm_symrec_get_label(value->rel, &precbc) && (sect = yasm_bc_get_section(precbc))) { syme = yasm_expr_create_ident(yasm_expr_sym(value->rel), bc->line); + } else if ((ssymval = get_ssym_value(value->rel))) { + syme = yasm_expr_create_ident(yasm_expr_int( + yasm_intnum_copy(ssymval)), bc->line); } else goto done; @@ -160,7 +941,7 @@ bin_objfmt_output_value(yasm_value *value, unsigned char *buf, yasm_expr_expr(sube), bc->line); value->curpos_rel = 0; value->ip_rel = 0; - } else + } if (value->rshift > 0) syme = yasm_expr_create(YASM_EXPR_SHR, yasm_expr_expr(syme), @@ -244,139 +1025,404 @@ bin_objfmt_output_bytecode(yasm_bytecode *bc, /*@null@*/ void *d) return 0; } +/* Check to ensure bytecode is res* (for BSS sections) */ static int -bin_objfmt_check_sym(yasm_symrec *sym, /*@null@*/ void *d) +bin_objfmt_no_output_bytecode(yasm_bytecode *bc, /*@null@*/ void *d) { /*@null@*/ bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; - yasm_sym_vis vis = yasm_symrec_get_visibility(sym); + /*@null@*/ /*@only@*/ unsigned char *bigbuf; + unsigned long size = REGULAR_OUTBUF_SIZE; + int gap; + assert(info != NULL); - if (vis & YASM_SYM_EXTERN) { + bigbuf = yasm_bc_tobytes(bc, info->buf, &size, &gap, info, + bin_objfmt_output_value, NULL); + + /* If bigbuf was allocated, free it */ + if (bigbuf) + yasm_xfree(bigbuf); + + /* Don't bother doing anything else if size ended up being 0. */ + if (size == 0) + return 0; + + /* Warn if not a gap. */ + if (!gap) { yasm_warn_set(YASM_WARN_GENERAL, - N_("binary object format does not support extern variables")); - yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); - } else if (vis & YASM_SYM_GLOBAL) { - yasm_warn_set(YASM_WARN_GENERAL, - N_("binary object format does not support global variables")); - yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); - } else if (vis & YASM_SYM_COMMON) { - yasm_error_set(YASM_ERROR_TYPE, - N_("binary object format does not support common variables")); - yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); + N_("initialized space declared in nobits section: ignoring")); } + return 0; } +static int +bin_objfmt_output_section(yasm_section *sect, /*@null@*/ void *d) +{ + bin_section_data *bsd = yasm_section_get_data(sect, &bin_section_data_cb); + /*@null@*/ bin_objfmt_output_info *info = (bin_objfmt_output_info *)d; + + assert(bsd != NULL); + assert(info != NULL); + + if (bsd->bss) { + yasm_section_bcs_traverse(sect, info->errwarns, + info, bin_objfmt_no_output_bytecode); + } else { + yasm_intnum_set(info->tmp_intn, bsd->istart); + yasm_intnum_calc(info->tmp_intn, YASM_EXPR_SUB, info->origin); + if (yasm_intnum_sign(info->tmp_intn) < 0) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' starts before origin (ORG)"), + yasm_section_get_name(sect)); + yasm_errwarn_propagate(info->errwarns, 0); + return 0; + } + if (!yasm_intnum_check_size(info->tmp_intn, sizeof(long)*8, 0, 1)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' start value too large"), + yasm_section_get_name(sect)); + yasm_errwarn_propagate(info->errwarns, 0); + return 0; + } + if (fseek(info->f, yasm_intnum_get_int(info->tmp_intn) + info->start, + SEEK_SET) < 0) + yasm__fatal(N_("could not seek on output file")); + yasm_section_bcs_traverse(sect, info->errwarns, + info, bin_objfmt_output_bytecode); + } + + return 0; +} + +static void +bin_objfmt_cleanup(bin_objfmt_output_info *info) +{ + bin_group *group, *group_temp; + + yasm_xfree(info->buf); + yasm_intnum_destroy(info->origin); + yasm_intnum_destroy(info->tmp_intn); + + TAILQ_FOREACH_SAFE(group, &info->lma_groups, link, group_temp) + bin_group_destroy(group); + + TAILQ_FOREACH_SAFE(group, &info->vma_groups, link, group_temp) + bin_group_destroy(group); +} + static void bin_objfmt_output(yasm_object *object, FILE *f, /*@unused@*/ int all_syms, yasm_errwarns *errwarns) { - /*@observer@*/ /*@null@*/ yasm_section *text, *data, *bss, *prevsect; - /*@null@*/ yasm_expr *startexpr; - /*@dependent@*/ /*@null@*/ const yasm_intnum *startnum; - unsigned long start = 0, textstart = 0, datastart = 0; - unsigned long textlen = 0, textpad = 0, datalen = 0, datapad = 0; - unsigned long *prevsectlenptr, *prevsectpadptr; - unsigned long i; + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt; bin_objfmt_output_info info; + bin_group *group, *lma_group, *vma_group, *group_temp; + yasm_intnum *start, *last, *vdelta; + bin_groups unsorted_groups, bss_groups; + + info.start = ftell(f); + + /* Set ORG to 0 unless otherwise specified */ + if (objfmt_bin->org) { + info.origin = yasm_expr_get_intnum(&objfmt_bin->org, 0); + if (!info.origin) { + yasm_error_set(YASM_ERROR_TOO_COMPLEX, + N_("ORG expression is too complex")); + yasm_errwarn_propagate(errwarns, objfmt_bin->org->line); + return; + } + if (yasm_intnum_sign(info.origin) < 0) { + yasm_error_set(YASM_ERROR_VALUE, N_("ORG expression is negative")); + yasm_errwarn_propagate(errwarns, objfmt_bin->org->line); + return; + } + info.origin = yasm_intnum_copy(info.origin); + } else + info.origin = yasm_intnum_create_uint(0); info.object = object; info.errwarns = errwarns; info.f = f; info.buf = yasm_xmalloc(REGULAR_OUTBUF_SIZE); + info.tmp_intn = yasm_intnum_create_uint(0); + TAILQ_INIT(&info.lma_groups); + TAILQ_INIT(&info.vma_groups); /* Check symbol table */ yasm_symtab_traverse(object->symtab, &info, bin_objfmt_check_sym); - text = yasm_object_find_general(object, ".text"); - data = yasm_object_find_general(object, ".data"); - bss = yasm_object_find_general(object, ".bss"); + /* Create section groups */ + if (yasm_object_sections_traverse(object, &info, bin_lma_create_group)) { + bin_objfmt_cleanup(&info); + return; /* error detected */ + } - if (!text) - yasm_internal_error(N_("No `.text' section in bin objfmt output")); - - /* First determine the actual starting offsets for .data and .bss. - * As the order in the file is .text -> .data -> .bss (not present), - * use the last bytecode in .text (and the .text section start) to - * determine the starting offset in .data, and likewise for .bss. - * Also compensate properly for alignment. + /* Determine section order according to LMA. + * Sections can be ordered either by (priority): + * - follows + * - start + * - progbits/nobits setting + * - order in the input file */ - /* Find out the start of .text */ - startexpr = yasm_expr_copy(yasm_section_get_start(text)); - assert(startexpr != NULL); - startnum = yasm_expr_get_intnum(&startexpr, 0); - if (!startnum) { - yasm_error_set(YASM_ERROR_TOO_COMPLEX, - N_("ORG expression too complex")); - yasm_errwarn_propagate(errwarns, startexpr->line); + /* Look at each group with follows specified, and find the section + * that group is supposed to follow. + */ + TAILQ_FOREACH_SAFE(lma_group, &info.lma_groups, link, group_temp) { + if (lma_group->bsd->follows) { + bin_group *found; + /* Need to find group containing section this section follows. */ + found = + find_group_by_name(&info.lma_groups, lma_group->bsd->follows); + if (!found) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' follows an invalid or unknown section `%s'"), + yasm_section_get_name(lma_group->section), + lma_group->bsd->follows); + yasm_errwarn_propagate(errwarns, 0); + bin_objfmt_cleanup(&info); + return; + } + + /* Check for loops */ + if (lma_group->section == found->section || + find_group_by_section(&lma_group->follow_groups, + found->section)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("follows loop between section `%s' and section `%s'"), + yasm_section_get_name(lma_group->section), + yasm_section_get_name(found->section)); + yasm_errwarn_propagate(errwarns, 0); + bin_objfmt_cleanup(&info); + return; + } + + /* Remove this section from main lma groups list */ + TAILQ_REMOVE(&info.lma_groups, lma_group, link); + /* Add it after the section it's supposed to follow. */ + TAILQ_INSERT_TAIL(&found->follow_groups, lma_group, link); + } + } + + /* Sort the top-level groups according to their start address. + * Use Shell sort for ease of implementation. + * If no start address is specified for a section, don't change the order, + * and move BSS sections to a separate list so they can be moved to the + * end of the lma list after all other sections are sorted. + */ + unsorted_groups = info.lma_groups; /* structure copy */ + TAILQ_INIT(&info.lma_groups); + TAILQ_INIT(&bss_groups); + TAILQ_FOREACH_SAFE(lma_group, &unsorted_groups, link, group_temp) { + bin_group *before; + + if (!lma_group->bsd->istart) { + if (lma_group->bsd->bss) + TAILQ_INSERT_TAIL(&bss_groups, lma_group, link); + else + TAILQ_INSERT_TAIL(&info.lma_groups, lma_group, link); + continue; + } + + before = NULL; + TAILQ_FOREACH(group, &info.lma_groups, link) { + if (!group->bsd->istart) + continue; + if (yasm_intnum_compare(group->bsd->istart, + lma_group->bsd->istart) > 0) { + before = group; + break; + } + } + if (before) + TAILQ_INSERT_BEFORE(before, lma_group, link); + else + TAILQ_INSERT_TAIL(&info.lma_groups, lma_group, link); + } + + /* Move the pure-BSS sections to the end of the LMA list. */ + TAILQ_FOREACH_SAFE(group, &bss_groups, link, group_temp) + TAILQ_INSERT_TAIL(&info.lma_groups, group, link); + TAILQ_INIT(&bss_groups); /* For sanity */ + + /* Assign a LMA start address to every section. + * Also assign VMA=LMA unless otherwise specified. + * + * We need to assign VMA=LMA here (while walking the tree) for the case: + * sect1 start=0 (size=0x11) + * sect2 follows=sect1 valign=16 (size=0x104) + * sect3 follows=sect2 valign=16 + * Where the valign of sect2 will result in a sect3 vaddr higher than a + * naive segment-by-segment interpretation (where sect3 and sect2 would + * have a VMA overlap). + * + * Algorithm for VMA=LMA setting: + * Start with delta=0. + * If there's no virtual attributes, we simply set VMA = LMA+delta. + * If there's only valign specified, we set VMA = aligned LMA, and add + * any new alignment difference to delta. + * + * We could do the LMA start and VMA=LMA steps in two separate steps, + * but it's easier to just recurse once. + */ + start = yasm_intnum_copy(info.origin); + last = yasm_intnum_copy(info.origin); + vdelta = yasm_intnum_create_uint(0); + TAILQ_FOREACH(lma_group, &info.lma_groups, link) { + if (lma_group->bsd->istart) + yasm_intnum_set(start, lma_group->bsd->istart); + group_assign_start_recurse(lma_group, start, last, vdelta, + info.tmp_intn, errwarns); + yasm_intnum_set(start, last); + } + yasm_intnum_destroy(last); + yasm_intnum_destroy(vdelta); + + /* + * Determine section order according to VMA + */ + + /* Create section groups */ + if (yasm_object_sections_traverse(object, &info, bin_vma_create_group)) { + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); + return; /* error detected */ + } + + /* Look at each group with vfollows specified, and find the section + * that group is supposed to follow. + */ + TAILQ_FOREACH_SAFE(vma_group, &info.vma_groups, link, group_temp) { + if (vma_group->bsd->vfollows) { + bin_group *found; + /* Need to find group containing section this section follows. */ + found = find_group_by_name(&info.vma_groups, + vma_group->bsd->vfollows); + if (!found) { + yasm_error_set(YASM_ERROR_VALUE, + N_("section `%s' vfollows an invalid or unknown section `%s'"), + yasm_section_get_name(vma_group->section), + vma_group->bsd->vfollows); + yasm_errwarn_propagate(errwarns, 0); + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); + return; + } + + /* Check for loops */ + if (vma_group->section == found->section || + find_group_by_section(&vma_group->follow_groups, + found->section)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("vfollows loop between section `%s' and section `%s'"), + yasm_section_get_name(vma_group->section), + yasm_section_get_name(found->section)); + yasm_errwarn_propagate(errwarns, 0); + bin_objfmt_cleanup(&info); + return; + } + + /* Remove this section from main lma groups list */ + TAILQ_REMOVE(&info.vma_groups, vma_group, link); + /* Add it after the section it's supposed to follow. */ + TAILQ_INSERT_TAIL(&found->follow_groups, vma_group, link); + } + } + + /* Due to the combination of steps above, we now know that all top-level + * groups have integer ivstart: + * Vstart Vfollows Valign Handled by + * No No No group_assign_start_recurse() + * No No Yes group_assign_start_recurse() + * No Yes - vfollows loop (above) + * Yes - - bin_lma_create_group() + */ + TAILQ_FOREACH(vma_group, &info.vma_groups, link) { + yasm_intnum_set(start, vma_group->bsd->ivstart); + group_assign_vstart_recurse(vma_group, start, errwarns); + } + + /* Output map file */ + output_map(&info); + + /* Ensure we don't have overlapping progbits LMAs. + * Use a dumb O(N^2) algorithm as the number of sections is essentially + * always low. + */ + if (yasm_object_sections_traverse(object, NULL, check_lma_overlap)) { + yasm_errwarn_propagate(errwarns, 0); + yasm_intnum_destroy(start); + bin_objfmt_cleanup(&info); return; } - start = yasm_intnum_get_uint(startnum); - yasm_expr_destroy(startexpr); - info.abs_start = start; - textstart = start; - /* Align .data and .bss (if present) by adjusting their starts. */ - prevsect = text; - prevsectlenptr = &textlen; - prevsectpadptr = &textpad; - if (data) { - start = bin_objfmt_align_section(data, prevsect, start, - prevsectlenptr, prevsectpadptr); - yasm_section_set_start(data, yasm_expr_create_ident( - yasm_expr_int(yasm_intnum_create_uint(start)), 0), 0); - datastart = start; - prevsect = data; - prevsectlenptr = &datalen; - prevsectpadptr = &datapad; - } - if (bss) { - start = bin_objfmt_align_section(bss, prevsect, start, - prevsectlenptr, prevsectpadptr); - yasm_section_set_start(bss, yasm_expr_create_ident( - yasm_expr_int(yasm_intnum_create_uint(start)), 0), 0); - } + /* Output sections */ + yasm_object_sections_traverse(object, &info, bin_objfmt_output_section); - /* Output .text first. */ - info.sect = text; - info.start = textstart; - yasm_section_bcs_traverse(text, errwarns, &info, - bin_objfmt_output_bytecode); - - /* If .data is present, output it */ - if (data) { - /* Add padding to align .data. Just use a for loop, as this will - * seldom be very many bytes. - */ - for (i=0; imap_filename) + yasm_xfree(objfmt_bin->map_filename); + yasm_expr_destroy(objfmt_bin->org); yasm_xfree(objfmt); } static void -bin_objfmt_init_new_section(yasm_object *object, yasm_section *sect, - const char *sectname, unsigned long line) +define_section_symbol(yasm_symtab *symtab, yasm_section *sect, + const char *sectname, const char *suffix, + enum bin_ssym which, unsigned long line) { - yasm_symtab_define_label(object->symtab, sectname, - yasm_section_bcs_first(sect), 1, line); + yasm_symrec *sym; + bin_symrec_data *bsymd = yasm_xmalloc(sizeof(bin_symrec_data)); + char *symname = yasm_xmalloc(8+strlen(sectname)+strlen(suffix)+1); + + strcpy(symname, "section."); + strcat(symname, sectname); + strcat(symname, suffix); + + bsymd->section = sect; + bsymd->which = which; + + sym = yasm_symtab_declare(symtab, symname, YASM_SYM_EXTERN, line); + yasm_xfree(symname); + yasm_symrec_add_data(sym, &bin_symrec_data_cb, bsymd); +} + +static void +bin_objfmt_init_new_section(yasm_section *sect, unsigned long line) +{ + yasm_object *object = yasm_section_get_object(sect); + const char *sectname = yasm_section_get_name(sect); + /*yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt;*/ + bin_section_data *data; + + data = yasm_xmalloc(sizeof(bin_section_data)); + data->bss = 0; + data->align = NULL; + data->valign = NULL; + data->start = NULL; + data->vstart = NULL; + data->follows = NULL; + data->vfollows = NULL; + data->istart = NULL; + data->ivstart = NULL; + data->length = NULL; + yasm_section_add_data(sect, &bin_section_data_cb, data); + + define_section_symbol(object->symtab, sect, sectname, ".start", + SSYM_START, line); + define_section_symbol(object->symtab, sect, sectname, ".vstart", + SSYM_VSTART, line); + define_section_symbol(object->symtab, sect, sectname, ".length", + SSYM_LENGTH, line); } static yasm_section * @@ -385,14 +1431,21 @@ bin_objfmt_add_default_section(yasm_object *object) yasm_section *retval; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 16, 1, 0, &isnew, 0); - if (isnew) { - bin_objfmt_init_new_section(object, retval, ".text", 0); + retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); + if (isnew) yasm_section_set_default(retval, 1); - } return retval; } +/* GAS-style flags */ +static int +bin_helper_gasflags(void *obj, yasm_valparam *vp, unsigned long line, void *d, + /*@unused@*/ uintptr_t arg) +{ + /* TODO */ + return 0; +} + static /*@observer@*/ /*@null@*/ yasm_section * bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, /*@unused@*/ /*@null@*/ @@ -402,15 +1455,47 @@ bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, yasm_valparam *vp; yasm_section *retval; int isnew; - unsigned long start; + int flags_override = 0; const char *sectname; - int resonly = 0; - /*@only@*/ /*@null@*/ yasm_intnum *align_intn = NULL; - unsigned long align = 4; - int have_align = 0; + bin_section_data *bsd = NULL; + + struct bin_section_switch_data { + /*@only@*/ /*@null@*/ char *follows; + /*@only@*/ /*@null@*/ char *vfollows; + /*@only@*/ /*@null@*/ yasm_expr *start; + /*@only@*/ /*@null@*/ yasm_expr *vstart; + /*@only@*/ /*@null@*/ yasm_intnum *align; + /*@only@*/ /*@null@*/ yasm_intnum *valign; + unsigned long bss; + unsigned long code; + } data; static const yasm_dir_help help[] = { - { "align", 1, yasm_dir_helper_intn, 0, 0 } + { "follows", 1, yasm_dir_helper_string, + offsetof(struct bin_section_switch_data, follows), 0 }, + { "vfollows", 1, yasm_dir_helper_string, + offsetof(struct bin_section_switch_data, vfollows), 0 }, + { "start", 1, yasm_dir_helper_expr, + offsetof(struct bin_section_switch_data, start), 0 }, + { "vstart", 1, yasm_dir_helper_expr, + offsetof(struct bin_section_switch_data, vstart), 0 }, + { "align", 1, yasm_dir_helper_intn, + offsetof(struct bin_section_switch_data, align), 0 }, + { "valign", 1, yasm_dir_helper_intn, + offsetof(struct bin_section_switch_data, valign), 0 }, + { "nobits", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, bss), 1 }, + { "progbits", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, bss), 0 }, + { "code", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 1 }, + { "data", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 0 }, + { "execute", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 1 }, + { "noexecute", 0, yasm_dir_helper_flag_set, + offsetof(struct bin_section_switch_data, code), 0 }, + { "gasflags", 1, bin_helper_gasflags, 0, 0 } }; vp = yasm_vps_first(valparams); @@ -419,31 +1504,48 @@ bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, return NULL; vp = yasm_vps_next(vp); - /* If it's the first section output (.text) start at 0, otherwise - * make sure the start is > 128. - */ - if (strcmp(sectname, ".text") == 0) - start = 0; - else if (strcmp(sectname, ".data") == 0) - start = 200; - else if (strcmp(sectname, ".bss") == 0) { - start = 200; - resonly = 1; + retval = yasm_object_find_general(object, sectname); + if (retval) { + bsd = yasm_section_get_data(retval, &bin_section_data_cb); + assert(bsd != NULL); + data.follows = bsd->follows; + data.vfollows = bsd->vfollows; + data.start = bsd->start; + data.vstart = bsd->vstart; + data.align = NULL; + data.valign = NULL; + data.bss = bsd->bss; + data.code = yasm_section_is_code(retval); } else { - /* other section names not recognized. */ + data.follows = NULL; + data.vfollows = NULL; + data.start = NULL; + data.vstart = NULL; + data.align = NULL; + data.valign = NULL; + data.bss = strcmp(sectname, ".bss") == 0; + data.code = strcmp(sectname, ".text") == 0; + } + + flags_override = yasm_dir_helper(object, vp, line, help, NELEMS(help), + &data, yasm_dir_helper_valparam_warn); + if (flags_override < 0) + return NULL; /* error occurred */ + + if (data.start && data.follows) { yasm_error_set(YASM_ERROR_GENERAL, - N_("segment name `%s' not recognized"), sectname); + N_("cannot combine `start' and `follows' section attributes")); return NULL; } - have_align = yasm_dir_helper(object, vp, line, help, NELEMS(help), - &align_intn, yasm_dir_helper_valparam_warn); - if (have_align < 0) - return NULL; /* error occurred */ + if (data.vstart && data.vfollows) { + yasm_error_set(YASM_ERROR_GENERAL, + N_("cannot combine `vstart' and `vfollows' section attributes")); + return NULL; + } - if (align_intn) { - align = yasm_intnum_get_uint(align_intn); - yasm_intnum_destroy(align_intn); + if (data.align) { + unsigned long align = yasm_intnum_get_uint(data.align); /* Alignments must be a power of two. */ if (!is_exp2(align)) { @@ -452,51 +1554,235 @@ bin_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, "align"); return NULL; } - } + } else + data.align = bsd ? bsd->align : NULL; - retval = yasm_object_get_general(object, sectname, - yasm_expr_create_ident( - yasm_expr_int(yasm_intnum_create_uint(start)), line), align, - strcmp(sectname, ".text") == 0, resonly, &isnew, line); + if (data.valign) { + unsigned long valign = yasm_intnum_get_uint(data.valign); - if (isnew) - bin_objfmt_init_new_section(object, retval, sectname, line); + /* Alignments must be a power of two. */ + if (!is_exp2(valign)) { + yasm_error_set(YASM_ERROR_VALUE, + N_("argument to `%s' is not a power of two"), + "valign"); + return NULL; + } + } else + data.valign = bsd ? bsd->valign : NULL; + + retval = yasm_object_get_general(object, sectname, 0, (int)data.code, + (int)data.bss, &isnew, line); + + bsd = yasm_section_get_data(retval, &bin_section_data_cb); if (isnew || yasm_section_is_default(retval)) { yasm_section_set_default(retval, 0); - yasm_section_set_align(retval, align, line); - } else if (have_align) - yasm_warn_set(YASM_WARN_GENERAL, - N_("alignment value ignored on section redeclaration")); + } + + /* Update section flags */ + bsd->bss = data.bss; + bsd->align = data.align; + bsd->valign = data.valign; + bsd->start = data.start; + bsd->vstart = data.vstart; + bsd->follows = data.follows; + bsd->vfollows = data.vfollows; return retval; } +static /*@observer@*/ /*@null@*/ yasm_symrec * +bin_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + return NULL; +} + static void bin_objfmt_dir_org(yasm_object *object, /*@null@*/ yasm_valparamhead *valparams, /*@unused@*/ /*@null@*/ yasm_valparamhead *objext_valparams, unsigned long line) { - yasm_section *sect; + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt; yasm_valparam *vp; - /*@only@*/ /*@null@*/ yasm_expr *start; - /* ORG takes just a simple integer as param */ + /* We only allow a single ORG in a program. */ + if (objfmt_bin->org) { + yasm_error_set(YASM_ERROR_GENERAL, N_("program origin redefined")); + return; + } + + /* ORG takes just a simple expression as param */ vp = yasm_vps_first(valparams); - start = yasm_vp_expr(vp, object->symtab, line); - if (!start) { + objfmt_bin->org = yasm_vp_expr(vp, object->symtab, line); + if (!objfmt_bin->org) { yasm_error_set(YASM_ERROR_SYNTAX, N_("argument to ORG must be expression")); return; } +} - /* ORG changes the start of the .text section */ - sect = yasm_object_find_general(object, ".text"); - if (!sect) - yasm_internal_error( - N_("bin objfmt: .text section does not exist before ORG is called?")); - yasm_section_set_start(sect, start, line); +struct bin_dir_map_data { + unsigned long flags; + /*@only@*/ /*@null@*/ char *filename; +}; + +static int +dir_map_filename(void *obj, yasm_valparam *vp, unsigned long line, void *data) +{ + struct bin_dir_map_data *mdata = (struct bin_dir_map_data *)data; + const char *filename; + + if (mdata->filename) { + yasm_warn_set(YASM_WARN_GENERAL, N_("map file already specified")); + return 0; + } + + filename = yasm_vp_string(vp); + if (!filename) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("unexpected expression in [map]")); + return -1; + } + mdata->filename = yasm__xstrdup(filename); + + return 1; +} + +static void +bin_objfmt_dir_map(yasm_object *object, + /*@null@*/ yasm_valparamhead *valparams, + /*@unused@*/ /*@null@*/ + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *)object->objfmt; + + struct bin_dir_map_data data; + + static const yasm_dir_help help[] = { + { "all", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), + MAP_BRIEF|MAP_SECTIONS|MAP_SYMBOLS }, + { "brief", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_BRIEF }, + { "sections", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_SECTIONS }, + { "segments", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_SECTIONS }, + { "symbols", 0, yasm_dir_helper_flag_or, + offsetof(struct bin_dir_map_data, flags), MAP_SYMBOLS } + }; + + data.flags = objfmt_bin->map_flags | MAP_NONE; + data.filename = objfmt_bin->map_filename; + + if (valparams && yasm_dir_helper(object, yasm_vps_first(valparams), line, help, + NELEMS(help), &data, dir_map_filename) < 0) + return; /* error occurred */ + + objfmt_bin->map_flags = data.flags; + objfmt_bin->map_filename = data.filename; +} + +static void +bin_section_data_destroy(void *data) +{ + bin_section_data *bsd = (bin_section_data *)data; + if (bsd->align) + yasm_xfree(bsd->align); + if (bsd->valign) + yasm_xfree(bsd->valign); + if (bsd->start) + yasm_expr_destroy(bsd->start); + if (bsd->vstart) + yasm_expr_destroy(bsd->vstart); + if (bsd->follows) + yasm_xfree(bsd->follows); + if (bsd->vfollows) + yasm_xfree(bsd->vfollows); + if (bsd->istart) + yasm_intnum_destroy(bsd->istart); + if (bsd->ivstart) + yasm_intnum_destroy(bsd->ivstart); + if (bsd->length) + yasm_intnum_destroy(bsd->length); + yasm_xfree(data); +} + +static void +bin_section_data_print(void *data, FILE *f, int indent_level) +{ + bin_section_data *bsd = (bin_section_data *)data; + + fprintf(f, "%*sbss=%d\n", indent_level, "", bsd->bss); + + fprintf(f, "%*salign=", indent_level, ""); + if (bsd->align) + yasm_intnum_print(bsd->align, f); + else + fprintf(f, "(nil)"); + fprintf(f, "\n%*svalign=", indent_level, ""); + if (bsd->valign) + yasm_intnum_print(bsd->valign, f); + else + fprintf(f, "(nil)"); + + fprintf(f, "\n%*sstart=", indent_level, ""); + yasm_expr_print(bsd->start, f); + fprintf(f, "\n%*svstart=", indent_level, ""); + yasm_expr_print(bsd->vstart, f); + + fprintf(f, "\n%*sfollows=", indent_level, ""); + if (bsd->follows) + fprintf(f, "\"%s\"", bsd->follows); + else + fprintf(f, "(nil)"); + fprintf(f, "\n%*svfollows=", indent_level, ""); + if (bsd->vfollows) + fprintf(f, "\"%s\"", bsd->vfollows); + else + fprintf(f, "(nil)"); + + fprintf(f, "\n%*sistart=", indent_level, ""); + if (bsd->istart) + yasm_intnum_print(bsd->istart, f); + else + fprintf(f, "(nil)"); + fprintf(f, "\n%*sivstart=", indent_level, ""); + if (bsd->ivstart) + yasm_intnum_print(bsd->ivstart, f); + else + fprintf(f, "(nil)"); + + fprintf(f, "\n%*slength=", indent_level, ""); + if (bsd->length) + yasm_intnum_print(bsd->length, f); + else + fprintf(f, "(nil)"); + fprintf(f, "\n"); +} + +static void +bin_symrec_data_destroy(void *data) +{ + yasm_xfree(data); +} + +static void +bin_symrec_data_print(void *data, FILE *f, int indent_level) +{ + bin_symrec_data *bsymd = (bin_symrec_data *)data; + + fprintf(f, "%*ssection=\"%s\"\n", indent_level, "", + yasm_section_get_name(bsymd->section)); + fprintf(f, "%*swhich=", indent_level, ""); + switch (bsymd->which) { + case SSYM_START: fprintf(f, "START"); break; + case SSYM_VSTART: fprintf(f, "VSTART"); break; + case SSYM_LENGTH: fprintf(f, "LENGTH"); break; + } + fprintf(f, "\n"); } @@ -508,21 +1794,193 @@ static const char *bin_objfmt_dbgfmt_keywords[] = { static const yasm_directive bin_objfmt_directives[] = { { "org", "nasm", bin_objfmt_dir_org, YASM_DIR_ARG_REQUIRED }, + { "map", "nasm", bin_objfmt_dir_map, YASM_DIR_ANY }, { NULL, NULL, NULL, 0 } }; +static const char *bin_nasm_stdmac[] = { + "%imacro org 1+.nolist", + "[org %1]", + "%endmacro", + NULL +}; + +static const yasm_stdmac bin_objfmt_stdmacs[] = { + { "nasm", "nasm", bin_nasm_stdmac }, + { "tasm", "tasm", bin_nasm_stdmac }, + { NULL, NULL, NULL } +}; + /* Define objfmt structure -- see objfmt.h for details */ yasm_objfmt_module yasm_bin_LTX_objfmt = { "Flat format binary", "bin", NULL, 16, + 0, bin_objfmt_dbgfmt_keywords, "null", bin_objfmt_directives, + bin_objfmt_stdmacs, bin_objfmt_create, bin_objfmt_output, bin_objfmt_destroy, bin_objfmt_add_default_section, - bin_objfmt_section_switch + bin_objfmt_init_new_section, + bin_objfmt_section_switch, + bin_objfmt_get_special_sym +}; + +#define EXE_HEADER_SIZE 0x200 + +/* DOS .EXE binaries are just raw binaries with a header */ +yasm_objfmt_module yasm_dosexe_LTX_objfmt; + +static yasm_objfmt * +dosexe_objfmt_create(yasm_object *object) +{ + yasm_objfmt_bin *objfmt_bin = (yasm_objfmt_bin *) bin_objfmt_create(object); + objfmt_bin->objfmt.module = &yasm_dosexe_LTX_objfmt; + return (yasm_objfmt *)objfmt_bin; +} + +static unsigned long +get_sym(yasm_object *object, const char *name) { + yasm_symrec *symrec = yasm_symtab_get(object->symtab, name); + yasm_bytecode *prevbc; + if (!symrec) + return 0; + if (!yasm_symrec_get_label(symrec, &prevbc)) + return 0; + return prevbc->offset + prevbc->len; +} + +static void +dosexe_objfmt_output(yasm_object *object, FILE *f, /*@unused@*/ int all_syms, + yasm_errwarns *errwarns) +{ + unsigned long tot_size, size, bss_size; + unsigned long start, bss; + unsigned char c; + + fseek(f, EXE_HEADER_SIZE, SEEK_SET); + + bin_objfmt_output(object, f, all_syms, errwarns); + + tot_size = ftell(f); + + /* if there is a __bss_start symbol, data after it is 0, no need to write + * it. */ + bss = get_sym(object, "__bss_start"); + if (bss) + size = bss; + else + size = tot_size; + bss_size = tot_size - size; +#ifdef HAVE_FTRUNCATE + if (size != tot_size) + if (ftruncate(fileno(f), EXE_HEADER_SIZE + size)) + ; /* No-op. Report an error? */ +#endif + fseek(f, 0, SEEK_SET); + + /* magic */ + fwrite("MZ", 1, 2, f); + + /* file size */ + c = size & 0xff; + fwrite(&c, 1, 1, f); + c = !!(size & 0x100); + fwrite(&c, 1, 1, f); + c = ((size + 511) >> 9) & 0xff; + fwrite(&c, 1, 1, f); + c = ((size + 511) >> 17) & 0xff; + fwrite(&c, 1, 1, f); + + /* relocation # */ + c = 0; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); + + /* header size */ + c = EXE_HEADER_SIZE / 16; + fwrite(&c, 1, 1, f); + c = 0; + fwrite(&c, 1, 1, f); + + /* minimum paragraph # */ + bss_size = (bss_size + 15) >> 4; + c = bss_size & 0xff; + fwrite(&c, 1, 1, f); + c = (bss_size >> 8) & 0xff; + fwrite(&c, 1, 1, f); + + /* maximum paragraph # */ + c = 0xFF; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); + + /* relative value of stack segment */ + c = 0; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); + + /* SP at start */ + c = 0; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); + + /* header checksum */ + c = 0; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); + + /* IP at start */ + start = get_sym(object, "start"); + if (!start) { + yasm_error_set(YASM_ERROR_GENERAL, + N_("%s: could not find symbol `start'")); + return; + } + c = start & 0xff; + fwrite(&c, 1, 1, f); + c = (start >> 8) & 0xff; + fwrite(&c, 1, 1, f); + + /* CS start */ + c = 0; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); + + /* reloc start */ + c = 0x22; + fwrite(&c, 1, 1, f); + c = 0; + fwrite(&c, 1, 1, f); + + /* Overlay number */ + c = 0; + fwrite(&c, 1, 1, f); + fwrite(&c, 1, 1, f); +} + + +/* Define objfmt structure -- see objfmt.h for details */ +yasm_objfmt_module yasm_dosexe_LTX_objfmt = { + "DOS .EXE format binary", + "dosexe", + "exe", + 16, + 0, + bin_objfmt_dbgfmt_keywords, + "null", + bin_objfmt_directives, + bin_objfmt_stdmacs, + dosexe_objfmt_create, + dosexe_objfmt_output, + bin_objfmt_destroy, + bin_objfmt_add_default_section, + bin_objfmt_init_new_section, + bin_objfmt_section_switch, + bin_objfmt_get_special_sym }; diff --git a/modules/objfmts/bin/tests/Makefile.inc b/modules/objfmts/bin/tests/Makefile.inc index e1993ea4..e29ed72f 100644 --- a/modules/objfmts/bin/tests/Makefile.inc +++ b/modules/objfmts/bin/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/bin/tests/bin_test.sh EXTRA_DIST += modules/objfmts/bin/tests/bin_test.sh @@ -30,3 +28,7 @@ EXTRA_DIST += modules/objfmts/bin/tests/reserve.hex EXTRA_DIST += modules/objfmts/bin/tests/reserve.errwarn EXTRA_DIST += modules/objfmts/bin/tests/shr.asm EXTRA_DIST += modules/objfmts/bin/tests/shr.hex + +EXTRA_DIST += modules/objfmts/bin/tests/multisect/Makefile.inc + +include modules/objfmts/bin/tests/multisect/Makefile.inc diff --git a/modules/objfmts/bin/tests/bin-farabs.asm b/modules/objfmts/bin/tests/bin-farabs.asm index e26bcbc6..4d931c1e 100644 --- a/modules/objfmts/bin/tests/bin-farabs.asm +++ b/modules/objfmts/bin/tests/bin-farabs.asm @@ -14,14 +14,16 @@ mov es, ax ; Use without seg should yield just the offset part. mov bx, keybuf -mov bx, 0040h:001Eh ; Illegal in NASM ("invalid combination...") +;mov bx, 0040h:001Eh ; Illegal ; Each of the below pairs should be equivalent (and legal) in Yasm. ; There are some differences from NASM here! +; Defaults to near jump (on both NASM and Yasm) +jmp keybuf + ; Direct far jump. -jmp keybuf ; Results in a near jump in NASM -jmp 0040h:001Eh ; But Yasm sees the equ value as equivalent to this +jmp 0040h:001Eh ; Force near (non-far) jump (just offset, no segment). jmp near keybuf diff --git a/modules/objfmts/bin/tests/bin-farabs.hex b/modules/objfmts/bin/tests/bin-farabs.hex index 6f626b56..5ebd4225 100644 --- a/modules/objfmts/bin/tests/bin-farabs.hex +++ b/modules/objfmts/bin/tests/bin-farabs.hex @@ -9,36 +9,31 @@ c0 bb 1e 00 -bb -1e -00 -ea -1e -00 -40 -00 +e9 +10 +ff ea 1e 00 40 00 e9 -03 +08 ff e9 -00 +05 ff e9 -fd +02 +ff +e9 +e1 fe e9 -dc -fe -e9 -d9 +de 0e e9 -d6 +db 4e eb fe diff --git a/modules/objfmts/bin/tests/bin_test.sh b/modules/objfmts/bin/tests/bin_test.sh index 49f4897c..9ab7e41a 100755 --- a/modules/objfmts/bin/tests/bin_test.sh +++ b/modules/objfmts/bin/tests/bin_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh bin_test modules/objfmts/bin/tests "bin objfmt" "-f bin" "" exit $? diff --git a/modules/objfmts/bin/tests/float-err.asm b/modules/objfmts/bin/tests/float-err.asm index 56a766c2..7c608ba0 100644 --- a/modules/objfmts/bin/tests/float-err.asm +++ b/modules/objfmts/bin/tests/float-err.asm @@ -1,6 +1,6 @@ ; Tests illegal float handling db 1.2 -dw 3.14 +dw 3.14e500 dd 5.12e100000 dq 3.141592653589793e-158105 dt 5653894745.318293470142875104710284019245e-1999 diff --git a/modules/objfmts/bin/tests/float-err.errwarn b/modules/objfmts/bin/tests/float-err.errwarn index 3efe445d..4aaa9402 100644 --- a/modules/objfmts/bin/tests/float-err.errwarn +++ b/modules/objfmts/bin/tests/float-err.errwarn @@ -1,8 +1,8 @@ --:2: invalid floating point constant size --:3: invalid floating point constant size +-:2: error: invalid floating point constant size +-:3: warning: overflow in floating point expression -:4: warning: overflow in floating point expression -:5: warning: underflow in floating point expression --:8: invalid floating point constant size --:9: invalid floating point constant size +-:8: error: invalid floating point constant size +-:9: warning: overflow in floating point expression -:11: warning: overflow in floating point expression -:12: warning: underflow in floating point expression diff --git a/modules/objfmts/bin/tests/float.asm b/modules/objfmts/bin/tests/float.asm index a2823f35..32d2777b 100644 --- a/modules/objfmts/bin/tests/float.asm +++ b/modules/objfmts/bin/tests/float.asm @@ -1,8 +1,10 @@ ; Tests float handling +dw 3.14 dd 5.12 dq 3.141592653589793 dt 5653894745.318293470142875104710284019245e335 +dw -62000.0 dd -47102940.467103581 dq -45102571092751092341095.5827509174509178450917845019 dt -1.e-1000 diff --git a/modules/objfmts/bin/tests/float.hex b/modules/objfmts/bin/tests/float.hex index 066fa76e..33b0d978 100644 --- a/modules/objfmts/bin/tests/float.hex +++ b/modules/objfmts/bin/tests/float.hex @@ -1,3 +1,5 @@ +48 +42 0a d7 a3 @@ -20,6 +22,8 @@ f1 97 78 44 +92 +fb f7 ae 33 diff --git a/modules/objfmts/bin/tests/multisect/Makefile.inc b/modules/objfmts/bin/tests/multisect/Makefile.inc new file mode 100644 index 00000000..dcb7d62a --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/Makefile.inc @@ -0,0 +1,51 @@ +TESTS += modules/objfmts/bin/tests/multisect/bin_multi_test.sh + +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin_multi_test.sh +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-align.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-ssym.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-ssym.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/bin-ssym.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop1-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop2-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-notfound-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/initbss.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/ldlinux-sects.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/ldlinux-sects.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/ldlinux-sects.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect1.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect1.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect1.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect2.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect2.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect2.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect3.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect3.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect3.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect4.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect4.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect4.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect5.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect5.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/multisect5.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect1.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect1.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect1.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect2.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect2.hex +EXTRA_DIST += modules/objfmts/bin/tests/multisect/nomultisect2.map +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm +EXTRA_DIST += modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn + diff --git a/modules/objfmts/bin/tests/multisect/bin-align.asm b/modules/objfmts/bin/tests/multisect/bin-align.asm new file mode 100644 index 00000000..e355aac7 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.asm @@ -0,0 +1,12 @@ +[map all binalign.map] +section .text +db 1 +align 8 +db 0 +section .data +align 8 +db 0 +section .foo align=4 +align 8 +section .bar valign=4 +align 8 diff --git a/modules/objfmts/bin/tests/multisect/bin-align.errwarn b/modules/objfmts/bin/tests/multisect/bin-align.errwarn new file mode 100644 index 00000000..e13f89df --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.errwarn @@ -0,0 +1,3 @@ +-: warning: section `.foo' internal align of 8 is greater than `align' of 4; using `align' +-: warning: section `.bar' internal align of 8 is greater than `valign' of 4; using `valign' +-:1: warning: map file already specified diff --git a/modules/objfmts/bin/tests/multisect/bin-align.hex b/modules/objfmts/bin/tests/multisect/bin-align.hex new file mode 100644 index 00000000..dd133f77 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.hex @@ -0,0 +1,17 @@ +01 +8d +74 +00 +8d +bd +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/bin/tests/multisect/bin-align.map b/modules/objfmts/bin/tests/multisect/bin-align.map new file mode 100644 index 00000000..bb5a8f23 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-align.map @@ -0,0 +1,66 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: bin-align + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000009 00000000 00000009 00000009 progbits .text +00000010 00000011 00000010 00000011 00000001 progbits .data +00000014 00000014 00000014 00000014 00000000 progbits .foo +00000018 00000018 00000018 00000018 00000000 progbits .bar + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000009 +start: 00000000 +align: 00000008 +follows: not defined +vstart: 00000000 +valign: 00000008 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000001 +start: 00000010 +align: 00000008 +follows: not defined +vstart: 00000010 +valign: 00000008 +vfollows: not defined + +---- Section .foo ------------------------------------------------------------- + +class: progbits +length: 00000000 +start: 00000014 +align: 00000004 +follows: not defined +vstart: 00000014 +valign: 00000004 +vfollows: not defined + +---- Section .bar ------------------------------------------------------------- + +class: progbits +length: 00000000 +start: 00000018 +align: 00000008 +follows: not defined +vstart: 00000018 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/bin-ssym.asm b/modules/objfmts/bin/tests/multisect/bin-ssym.asm new file mode 100644 index 00000000..8c5608cf --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-ssym.asm @@ -0,0 +1,5 @@ +section foo start=0x10 vstart=0x6000 +mov si, section.foo.start +mov di, section.foo.vstart +mov cx, section.foo.length +;mov dx, section.foo.vstart-section.foo.start diff --git a/modules/objfmts/bin/tests/multisect/bin-ssym.hex b/modules/objfmts/bin/tests/multisect/bin-ssym.hex new file mode 100644 index 00000000..e89a7e22 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-ssym.hex @@ -0,0 +1,25 @@ +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +be +10 +00 +bf +00 +60 +b9 +09 +00 diff --git a/modules/objfmts/bin/tests/multisect/bin-ssym.map b/modules/objfmts/bin/tests/multisect/bin-ssym.map new file mode 100644 index 00000000..112dc02b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin-ssym.map @@ -0,0 +1,16 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: bin-ssym + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000000 00000000 00000000 00000000 progbits .text +00006000 00006009 00000010 00000019 00000009 progbits foo + diff --git a/modules/objfmts/bin/tests/multisect/bin_multi_test.sh b/modules/objfmts/bin/tests/multisect/bin_multi_test.sh new file mode 100755 index 00000000..aa3f616c --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/bin_multi_test.sh @@ -0,0 +1,113 @@ +#! /bin/sh + +YASM_TEST_SUITE=1 +export YASM_TEST_SUITE + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +mkdir results >/dev/null 2>&1 + +# +# Verify that all test cases match +# + +passedct=0 +failedct=0 + +echo $ECHO_N "Test bin_multi_test: $ECHO_C" +for asm in ${srcdir}/modules/objfmts/bin/tests/multisect/*.asm +do + a=`echo ${asm} | sed 's,^.*/,,;s,.asm$,,'` + o=${a} + oh=${a}.hx + og=`echo ${asm} | sed 's,.asm$,.hex,'` + e=${a}.ew + eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` + m=${a}.map + mg=`echo ${asm} | sed 's,.asm$,.map,'` + if test \! -f ${eg}; then + eg=/dev/null + fi + + # Run within a subshell to prevent signal messages from displaying. + sh -c "cat ${asm} | ./yasm -f bin --mapfile=results/${m} -o results/${o} - 2>results/${e}" >/dev/null 2>/dev/null + status=$? + if test $status -gt 128; then + # We should never get a coredump! + echo $ECHO_N "C$ECHO_C" + eval "failed$failedct='C: ${a} crashed!'" + failedct=`expr $failedct + 1` + elif test $status -gt 0; then + echo ${asm} | grep err >/dev/null + if test $? -gt 0; then + # YASM detected errors but shouldn't have! + echo $ECHO_N "E$ECHO_C" + eval "failed$failedct='E: ${a} returned an error code!'" + failedct=`expr $failedct + 1` + else + # We got errors, check to see if they match: + if diff -w ${eg} results/${e} >/dev/null; then + # Error/warnings match, it passes! + echo $ECHO_N ".$ECHO_C" + passedct=`expr $passedct + 1` + else + # Error/warnings don't match. + echo $ECHO_N "W$ECHO_C" + eval "failed$failedct='W: ${a} did not match errors and warnings!'" + failedct=`expr $failedct + 1` + fi + fi + else + echo ${asm} | grep -v err >/dev/null + if test $? -gt 0; then + # YASM didn't detect errors but should have! + echo $ECHO_N "E$ECHO_C" + eval "failed$failedct='E: ${a} did not return an error code!'" + failedct=`expr $failedct + 1` + else + ./test_hd results/${o} > results/${oh} + if diff -w ${og} results/${oh} >/dev/null; then + if diff -w ${eg} results/${e} >/dev/null; then + if diff -w ${mg} results/${m} >/dev/null; then + # All match, it passes! + echo $ECHO_N ".$ECHO_C" + passedct=`expr $passedct + 1` + else + # Map file doesn't match. + echo $ECHO_N "M$ECHO_C" + eval "failed$failedct='M: ${a} did not match map file!'" + failedct=`expr $failedct + 1` + fi + else + # Error/warnings don't match. + echo $ECHO_N "W$ECHO_C" + eval "failed$failedct='W: ${a} did not match errors and warnings!'" + failedct=`expr $failedct + 1` + fi + else + # Object file doesn't match. + echo $ECHO_N "O$ECHO_C" + eval "failed$failedct='O: ${a} did not match object file!'" + failedct=`expr $failedct + 1` + fi + fi + fi +done + +ct=`expr $failedct + $passedct` +per=`expr 100 \* $passedct / $ct` + +echo " +$passedct-$failedct/$ct $per%" +i=0 +while test $i -lt $failedct; do + eval "failure=\$failed$i" + echo " ** $failure" + i=`expr $i + 1` +done + +exit $failedct diff --git a/modules/objfmts/bin/tests/multisect/follows-loop1-err.asm b/modules/objfmts/bin/tests/multisect/follows-loop1-err.asm new file mode 100644 index 00000000..ad7fef16 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop1-err.asm @@ -0,0 +1,2 @@ +section sect1 follows=sect2 +section sect2 follows=sect1 diff --git a/modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn b/modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn new file mode 100644 index 00000000..613280e9 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn @@ -0,0 +1 @@ +-: error: follows loop between section `sect2' and section `sect1' diff --git a/modules/objfmts/bin/tests/multisect/follows-loop2-err.asm b/modules/objfmts/bin/tests/multisect/follows-loop2-err.asm new file mode 100644 index 00000000..9b15f465 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop2-err.asm @@ -0,0 +1 @@ +section sect follows=sect diff --git a/modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn b/modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn new file mode 100644 index 00000000..bc832e00 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn @@ -0,0 +1 @@ +-: error: follows loop between section `sect' and section `sect' diff --git a/modules/objfmts/bin/tests/multisect/follows-notfound-err.asm b/modules/objfmts/bin/tests/multisect/follows-notfound-err.asm new file mode 100644 index 00000000..36361d52 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-notfound-err.asm @@ -0,0 +1,2 @@ +section foo follows=bar + diff --git a/modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn b/modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn new file mode 100644 index 00000000..53d29d80 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn @@ -0,0 +1 @@ +-: error: section `foo' follows an invalid or unknown section `bar' diff --git a/modules/objfmts/bin/tests/multisect/initbss.asm b/modules/objfmts/bin/tests/multisect/initbss.asm new file mode 100644 index 00000000..8fe39bcc --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/initbss.asm @@ -0,0 +1,5 @@ +section .bss +mov ax, 5 + +section foo nobits +db 5 diff --git a/modules/objfmts/bin/tests/multisect/initbss.errwarn b/modules/objfmts/bin/tests/multisect/initbss.errwarn new file mode 100644 index 00000000..e92a68e4 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/initbss.errwarn @@ -0,0 +1,2 @@ +-:2: warning: initialized space declared in nobits section: ignoring +-:5: warning: initialized space declared in nobits section: ignoring diff --git a/modules/objfmts/bin/tests/multisect/initbss.hex b/modules/objfmts/bin/tests/multisect/initbss.hex new file mode 100644 index 00000000..e69de29b diff --git a/modules/objfmts/bin/tests/multisect/initbss.map b/modules/objfmts/bin/tests/multisect/initbss.map new file mode 100644 index 00000000..dc444f56 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/initbss.map @@ -0,0 +1,17 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: initbss + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000000 00000000 00000000 00000000 progbits .text +00000000 00000003 00000000 00000003 00000003 nobits .bss +00000004 00000005 00000004 00000005 00000001 nobits foo + diff --git a/modules/objfmts/bin/tests/multisect/ldlinux-sects.asm b/modules/objfmts/bin/tests/multisect/ldlinux-sects.asm new file mode 100644 index 00000000..2beae7c7 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/ldlinux-sects.asm @@ -0,0 +1,102 @@ +[map all] +BSS_START equ 0800h +LATEBSS_START equ 0B800h +TEXT_START equ 7C00h +STACK_SIZE equ 4096 +STACK_START equ TEXT_START-STACK_SIZE +org TEXT_START +[section .text] +times 0x2410 db 0x1 +[section .earlybss nobits start=BSS_START] +resb 0x40C4 +[section .bcopy32 align=4 valign=16 follows=.data vfollows=.earlybss] +times 0x2A0 db 0x3 +[section .config align=4 valign=16 follows=.bcopy32 vfollows=.bcopy32] +times 0x23 db 0x4 +[section .config.end nobits valign=4 vfollows=.config] +[section .bss1 nobits valign=16 vfollows=.config.end] +resb 0x1FB +[section .text start=TEXT_START] +[section .data align=16] +times 0x590 db 0x2 +[section .adv progbits align=1 follows=.config] +[section .bss nobits align=16 follows=.adv] +resb 0x3900 +[section .stack nobits align=16 start=STACK_START] +resb STACK_SIZE +[section .stack nobits align=16 start=STACK_START] +[section .stack nobits align=16 start=STACK_START] +[section .earlybss] +[section .bss] +[section .text] +[section .bss] +[section .text] +[section .data] +[section .text] +[section .text] +[section .text] +[section .bss] +[section .text] +[section .data] +[section .bss] +[section .text] +[section .data] +[section .bss] +[section .text] +[section .text] +[section .text] +[section .data] +[section .bss1] +[section .data] +[section .text] +[section .bss1] +[section .text] +[section .text] +[section .data] +[section .text] +[section .text] +[section .bss] +[section .text] +[section .bss] +[section .text] +[section .data] +[section .text] +[section .text] +[section .bss1] +[section .data] +[section .text] +[section .text] +[section .data] +[section .config] +[section .bss] +[section .text] +[section .text] +[section .text] +[section .data] +[section .text] +[section .data] +[section .config] +[section .bss] +[section .text] +[section .text] +[section .data] +[section .bss] +[section .bcopy32] +[section .data] +[section .bcopy32] +[section .earlybss] +[section .text] +[section .text] +[section .bss] +[section .data] +[section .bss1] +[section .text] +[section .data] +[section .bss1] +[section .text] +[section .bss] +[section .text] +[section .text] +[section .text] +[section .bss] +[section .data] diff --git a/modules/objfmts/bin/tests/multisect/ldlinux-sects.hex b/modules/objfmts/bin/tests/multisect/ldlinux-sects.hex new file mode 100644 index 00000000..bb591fc0 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/ldlinux-sects.hex @@ -0,0 +1,11363 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 +04 diff --git a/modules/objfmts/bin/tests/multisect/ldlinux-sects.map b/modules/objfmts/bin/tests/multisect/ldlinux-sects.map new file mode 100644 index 00000000..3a5e33e3 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/ldlinux-sects.map @@ -0,0 +1,148 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: ldlinux-sects + +-- Program origin ------------------------------------------------------------- + +00007C00 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000800 000048C4 00000800 000048C4 000040C4 nobits .earlybss +00006C00 00007C00 00006C00 00007C00 00001000 nobits .stack +00007C00 0000A010 00007C00 0000A010 00002410 progbits .text +0000A010 0000A5A0 0000A010 0000A5A0 00000590 progbits .data +000048D0 00004B70 0000A5A0 0000A840 000002A0 progbits .bcopy32 +00004B70 00004B93 0000A840 0000A863 00000023 progbits .config +0000A863 0000A863 0000A863 0000A863 00000000 progbits .adv +0000A870 0000E170 0000A870 0000E170 00003900 nobits .bss +00004B94 00004B94 0000E170 0000E170 00000000 nobits .config.end +00004BA0 00004D9B 0000E170 0000E36B 000001FB nobits .bss1 + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .earlybss -------------------------------------------------------- + +class: nobits +length: 000040C4 +start: 00000800 +align: 00000004 +follows: not defined +vstart: 00000800 +valign: 00000004 +vfollows: not defined + +---- Section .stack ----------------------------------------------------------- + +class: nobits +length: 00001000 +start: 00006C00 +align: 00000010 +follows: not defined +vstart: 00006C00 +valign: 00000010 +vfollows: not defined + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00002410 +start: 00007C00 +align: 00000004 +follows: not defined +vstart: 00007C00 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000590 +start: 0000A010 +align: 00000010 +follows: not defined +vstart: 0000A010 +valign: 00000010 +vfollows: not defined + +---- Section .bcopy32 --------------------------------------------------------- + +class: progbits +length: 000002A0 +start: 0000A5A0 +align: 00000004 +follows: .data +vstart: 000048D0 +valign: 00000010 +vfollows: .earlybss + +---- Section .config ---------------------------------------------------------- + +class: progbits +length: 00000023 +start: 0000A840 +align: 00000004 +follows: .bcopy32 +vstart: 00004B70 +valign: 00000010 +vfollows: .bcopy32 + +---- Section .adv ------------------------------------------------------------- + +class: progbits +length: 00000000 +start: 0000A863 +align: 00000001 +follows: .config +vstart: 0000A863 +valign: 00000001 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00003900 +start: 0000A870 +align: 00000010 +follows: .adv +vstart: 0000A870 +valign: 00000010 +vfollows: not defined + +---- Section .config.end ------------------------------------------------------ + +class: nobits +length: 00000000 +start: 0000E170 +align: 00000004 +follows: not defined +vstart: 00004B94 +valign: 00000004 +vfollows: .config + +---- Section .bss1 ------------------------------------------------------------ + +class: nobits +length: 000001FB +start: 0000E170 +align: 00000004 +follows: not defined +vstart: 00004BA0 +valign: 00000010 +vfollows: .config.end + +-- Symbols -------------------------------------------------------------------- + +---- No Section --------------------------------------------------------------- + +Value Name +00000800 BSS_START +0000B800 LATEBSS_START +00007C00 TEXT_START +00001000 STACK_SIZE +00006C00 STACK_START + + diff --git a/modules/objfmts/bin/tests/multisect/multisect1.asm b/modules/objfmts/bin/tests/multisect/multisect1.asm new file mode 100644 index 00000000..d9699b79 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect1.asm @@ -0,0 +1,31 @@ +[BITS 32] + +[MAP all] +; This file is loaded as a DOS .COM file. +[SEGMENT _TEXT start=0 vstart=100h] + +; shrink & relocate stack: + mov sp, stack_ends ; NASM puts 460h here - + ; 9B0h is desired. + mov bx, sp + mov cl, 4 + shr bx, cl + mov ah, 4Ah ; DOS resize mem.block + int 21h + +[SEGMENT GATESEG align=1 follows=_TEXT vstart=0] +; label to use for copying this segment at run-time. +gate0cpy: +dd 0 + +; 32-bit ring-0 protected mode code that interacts +; with the VMM (Win3.x/9x kernel). To be relocated +; at run-time to memory dynamically allocated with +; DPMI, and called through a call-gate from ring-3. +; vstart=0 makes some calculations easier. + +; Reserve space for stack: +[SEGMENT .bss follows=GATESEG align=16] + resb 400h +stack_ends: + diff --git a/modules/objfmts/bin/tests/multisect/multisect1.hex b/modules/objfmts/bin/tests/multisect/multisect1.hex new file mode 100644 index 00000000..32695b89 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect1.hex @@ -0,0 +1,20 @@ +66 +bc +20 +04 +66 +89 +e3 +b1 +04 +66 +d3 +eb +b4 +4a +cd +21 +00 +00 +00 +00 diff --git a/modules/objfmts/bin/tests/multisect/multisect1.map b/modules/objfmts/bin/tests/multisect/multisect1.map new file mode 100644 index 00000000..f52da415 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect1.map @@ -0,0 +1,78 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: multisect1 + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000000 00000000 00000000 00000000 progbits .text +00000100 00000110 00000000 00000010 00000010 progbits _TEXT +00000000 00000004 00000010 00000014 00000004 progbits GATESEG +00000020 00000420 00000020 00000420 00000400 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000000 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000000 +valign: 00000004 +vfollows: not defined + +---- Section _TEXT ------------------------------------------------------------ + +class: progbits +length: 00000010 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section GATESEG ---------------------------------------------------------- + +class: progbits +length: 00000004 +start: 00000010 +align: 00000001 +follows: _TEXT +vstart: 00000000 +valign: 00000001 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000400 +start: 00000020 +align: 00000010 +follows: GATESEG +vstart: 00000020 +valign: 00000010 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + +---- Section GATESEG ---------------------------------------------------------- + +Real Virtual Name +00000010 00000000 gate0cpy + + +---- Section .bss ------------------------------------------------------------- + +Real Virtual Name +00000420 00000420 stack_ends + + diff --git a/modules/objfmts/bin/tests/multisect/multisect2.asm b/modules/objfmts/bin/tests/multisect/multisect2.asm new file mode 100644 index 00000000..cfbf58c6 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect2.asm @@ -0,0 +1,42 @@ +org 100h +[map all] + +section .bss ; follows=.data + buffer resb 123h +section .data + msg db "this is a message", 0 +section .text + mov ax, msg + call showax + mov ax, buffer + call showax + ret + +;----------------- +showax: + push cx + push dx + + mov cx, 4 ; four digits to show + +.top + rol ax, 4 ; rotate one digit into position + mov dl, al ; make a copy to process + and dl, 0Fh ; mask off a single (hex) digit + cmp dl, 9 ; is it in the "A" to "F" range? + jbe .dec_dig ; no, skip it + add dl, 7 ; adjust +.dec_dig: + add dl, 30h ; convert to character + + push ax + mov ah, 2 + int 21h + pop ax + + loop .top + + pop dx + pop cx + ret +;-------------------------- diff --git a/modules/objfmts/bin/tests/multisect/multisect2.hex b/modules/objfmts/bin/tests/multisect/multisect2.hex new file mode 100644 index 00000000..f043f372 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect2.hex @@ -0,0 +1,66 @@ +b8 +30 +01 +e8 +07 +00 +b8 +44 +01 +e8 +01 +00 +c3 +51 +52 +b9 +04 +00 +c1 +c0 +04 +88 +c2 +80 +e2 +0f +80 +fa +09 +76 +03 +80 +c2 +07 +80 +c2 +30 +50 +b4 +02 +cd +21 +58 +e2 +e5 +5a +59 +c3 +74 +68 +69 +73 +20 +69 +73 +20 +61 +20 +6d +65 +73 +73 +61 +67 +65 +00 diff --git a/modules/objfmts/bin/tests/multisect/multisect2.map b/modules/objfmts/bin/tests/multisect/multisect2.map new file mode 100644 index 00000000..858da399 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect2.map @@ -0,0 +1,74 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: multisect2 + +-- Program origin ------------------------------------------------------------- + +00000100 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000100 00000130 00000100 00000130 00000030 progbits .text +00000130 00000142 00000130 00000142 00000012 progbits .data +00000144 00000267 00000144 00000267 00000123 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000030 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000012 +start: 00000130 +align: 00000004 +follows: not defined +vstart: 00000130 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000123 +start: 00000144 +align: 00000004 +follows: not defined +vstart: 00000144 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +Real Virtual Name +0000010D 0000010D showax +00000112 00000112 showax.top +00000122 00000122 showax.dec_dig + + +---- Section .data ------------------------------------------------------------ + +Real Virtual Name +00000130 00000130 msg + + +---- Section .bss ------------------------------------------------------------- + +Real Virtual Name +00000144 00000144 buffer + + diff --git a/modules/objfmts/bin/tests/multisect/multisect3.asm b/modules/objfmts/bin/tests/multisect/multisect3.asm new file mode 100644 index 00000000..d6499f96 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect3.asm @@ -0,0 +1,9 @@ +[map all] +section .text + mov ax, bx + +section .foo nobits follows=.text + resb 4 + +section .bss + resb 4 diff --git a/modules/objfmts/bin/tests/multisect/multisect3.hex b/modules/objfmts/bin/tests/multisect/multisect3.hex new file mode 100644 index 00000000..a9949757 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect3.hex @@ -0,0 +1,2 @@ +89 +d8 diff --git a/modules/objfmts/bin/tests/multisect/multisect3.map b/modules/objfmts/bin/tests/multisect/multisect3.map new file mode 100644 index 00000000..a3f651b2 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect3.map @@ -0,0 +1,54 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: multisect3 + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000002 00000000 00000002 00000002 progbits .text +00000004 00000008 00000004 00000008 00000004 nobits .foo +00000008 0000000C 00000008 0000000C 00000004 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000002 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000000 +valign: 00000004 +vfollows: not defined + +---- Section .foo ------------------------------------------------------------- + +class: nobits +length: 00000004 +start: 00000004 +align: 00000004 +follows: .text +vstart: 00000004 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000004 +start: 00000008 +align: 00000004 +follows: not defined +vstart: 00000008 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/multisect4.asm b/modules/objfmts/bin/tests/multisect/multisect4.asm new file mode 100644 index 00000000..94d2415f --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect4.asm @@ -0,0 +1,31 @@ +[map all] +; Memory below 0800h is reserved for the BIOS and the MBR +BSS_START equ 0800h + +; PXELINUX needs lots of BSS, so it relocates itself on startup +;%if IS_PXELINUX +TEXT_START equ 9000h +;%else +;TEXT_START equ 7C00h +;%endif + +; +; The various sections and their relationship +; +org TEXT_START + +times 0x100 db 0x3 + +section .earlybss nobits start=BSS_START +resb 0x100 +section .bcopy32 align=16 follows=.data vfollows=.earlybss +times 0x100 db 0x1 +section .bss nobits align=256 vfollows=.bcopy32 +resb 0x100 + +section .text start=TEXT_START +section .data align=16 follows=.text +times 0x100 db 0x2 + +section .latebss nobits align=16 follows=.bcopy32 +resb 0x100 diff --git a/modules/objfmts/bin/tests/multisect/multisect4.hex b/modules/objfmts/bin/tests/multisect/multisect4.hex new file mode 100644 index 00000000..d40d7a19 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect4.hex @@ -0,0 +1,768 @@ +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +03 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +02 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/objfmts/bin/tests/multisect/multisect4.map b/modules/objfmts/bin/tests/multisect/multisect4.map new file mode 100644 index 00000000..bb97c9f2 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect4.map @@ -0,0 +1,97 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: multisect4 + +-- Program origin ------------------------------------------------------------- + +00009000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000800 00000900 00000800 00000900 00000100 nobits .earlybss +00009000 00009100 00009000 00009100 00000100 progbits .text +00009100 00009200 00009100 00009200 00000100 progbits .data +00000900 00000A00 00009200 00009300 00000100 progbits .bcopy32 +00009300 00009400 00009300 00009400 00000100 nobits .latebss +00000A00 00000B00 00009400 00009500 00000100 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .earlybss -------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00000800 +align: 00000004 +follows: not defined +vstart: 00000800 +valign: 00000004 +vfollows: not defined + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00009000 +align: 00000004 +follows: not defined +vstart: 00009000 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00009100 +align: 00000010 +follows: .text +vstart: 00009100 +valign: 00000010 +vfollows: not defined + +---- Section .bcopy32 --------------------------------------------------------- + +class: progbits +length: 00000100 +start: 00009200 +align: 00000010 +follows: .data +vstart: 00000900 +valign: 00000010 +vfollows: .earlybss + +---- Section .latebss --------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00009300 +align: 00000010 +follows: .bcopy32 +vstart: 00009300 +valign: 00000010 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00009400 +align: 00000100 +follows: not defined +vstart: 00000A00 +valign: 00000100 +vfollows: .bcopy32 + +-- Symbols -------------------------------------------------------------------- + +---- No Section --------------------------------------------------------------- + +Value Name +00000800 BSS_START +00009000 TEXT_START + + diff --git a/modules/objfmts/bin/tests/multisect/multisect5.asm b/modules/objfmts/bin/tests/multisect/multisect5.asm new file mode 100644 index 00000000..2b761172 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect5.asm @@ -0,0 +1,22 @@ +org 0x100 +[map all] +section sect1 start=0x100 vstart=0x2000 +times 0x100 db 0 +section sect2 follows=sect1 +times 0x100 db 0 + +section sect3 start=0x300 vstart=0x4000 +times 0x100 db 0 +section sect4 follows=sect3 +times 0x100 db 0 +section sect5 vfollows=sect3 +times 0x100 db 0 + +section sect6 start=0x600 vstart=0x6000 +times 0x11 db 0 +section sect7 follows=sect6 valign=16 +times 0x104 db 0 +section sect8 follows=sect7 valign=16 ; NASM bug - sect7 and sect8 overlap +times 0x100 db 0 + +section sect9 vfollows=sect8 diff --git a/modules/objfmts/bin/tests/multisect/multisect5.hex b/modules/objfmts/bin/tests/multisect/multisect5.hex new file mode 100644 index 00000000..a2776bc8 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect5.hex @@ -0,0 +1,1816 @@ +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/bin/tests/multisect/multisect5.map b/modules/objfmts/bin/tests/multisect/multisect5.map new file mode 100644 index 00000000..e5c972a3 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/multisect5.map @@ -0,0 +1,138 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: multisect5 + +-- Program origin ------------------------------------------------------------- + +00000100 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000100 00000100 00000100 00000100 00000000 progbits .text +00002000 00002100 00000100 00000200 00000100 progbits sect1 +00000200 00000300 00000200 00000300 00000100 progbits sect2 +00004000 00004100 00000300 00000400 00000100 progbits sect3 +00000400 00000500 00000400 00000500 00000100 progbits sect4 +00004100 00004200 00000500 00000600 00000100 progbits sect5 +00006000 00006011 00000600 00000611 00000011 progbits sect6 +00000620 00000724 00000614 00000718 00000104 progbits sect7 +00000730 00000830 00000718 00000818 00000100 progbits sect8 +00000830 00000830 00000818 00000818 00000000 progbits sect9 + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000000 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section sect1 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00002000 +valign: 00000004 +vfollows: not defined + +---- Section sect2 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000200 +align: 00000004 +follows: sect1 +vstart: 00000200 +valign: 00000004 +vfollows: not defined + +---- Section sect3 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000300 +align: 00000004 +follows: not defined +vstart: 00004000 +valign: 00000004 +vfollows: not defined + +---- Section sect4 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000400 +align: 00000004 +follows: sect3 +vstart: 00000400 +valign: 00000004 +vfollows: not defined + +---- Section sect5 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000500 +align: 00000004 +follows: not defined +vstart: 00004100 +valign: 00000004 +vfollows: sect3 + +---- Section sect6 ------------------------------------------------------------ + +class: progbits +length: 00000011 +start: 00000600 +align: 00000004 +follows: not defined +vstart: 00006000 +valign: 00000004 +vfollows: not defined + +---- Section sect7 ------------------------------------------------------------ + +class: progbits +length: 00000104 +start: 00000614 +align: 00000004 +follows: sect6 +vstart: 00000620 +valign: 00000010 +vfollows: not defined + +---- Section sect8 ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000718 +align: 00000004 +follows: sect7 +vstart: 00000730 +valign: 00000010 +vfollows: not defined + +---- Section sect9 ------------------------------------------------------------ + +class: progbits +length: 00000000 +start: 00000818 +align: 00000004 +follows: not defined +vstart: 00000830 +valign: 00000004 +vfollows: sect8 + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/nomultisect1.asm b/modules/objfmts/bin/tests/multisect/nomultisect1.asm new file mode 100644 index 00000000..5f720d84 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect1.asm @@ -0,0 +1,10 @@ +[map all] + +[section .bss] +resb 0x100 + +[section .data] +times 0x100 db 1 + +[section .text] +times 0x100 db 1 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect1.hex b/modules/objfmts/bin/tests/multisect/nomultisect1.hex new file mode 100644 index 00000000..59c9350b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect1.hex @@ -0,0 +1,512 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect1.map b/modules/objfmts/bin/tests/multisect/nomultisect1.map new file mode 100644 index 00000000..0745189b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect1.map @@ -0,0 +1,54 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: nomultisect1 + +-- Program origin ------------------------------------------------------------- + +00000000 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000000 00000100 00000000 00000100 00000100 progbits .text +00000100 00000200 00000100 00000200 00000100 progbits .data +00000200 00000300 00000200 00000300 00000100 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000000 +align: 00000004 +follows: not defined +vstart: 00000000 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00000200 +align: 00000004 +follows: not defined +vstart: 00000200 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/nomultisect2.asm b/modules/objfmts/bin/tests/multisect/nomultisect2.asm new file mode 100644 index 00000000..b97e40a7 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect2.asm @@ -0,0 +1,12 @@ +org 0x100 + +[map all] + +[section .bss] +resb 0x100 + +[section .data] +times 0x100 db 1 + +[section .text] +times 0x100 db 1 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect2.hex b/modules/objfmts/bin/tests/multisect/nomultisect2.hex new file mode 100644 index 00000000..59c9350b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect2.hex @@ -0,0 +1,512 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/objfmts/bin/tests/multisect/nomultisect2.map b/modules/objfmts/bin/tests/multisect/nomultisect2.map new file mode 100644 index 00000000..7a9d306f --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/nomultisect2.map @@ -0,0 +1,54 @@ + +- YASM Map file --------------------------------------------------------------- + +Source file: - +Output file: nomultisect2 + +-- Program origin ------------------------------------------------------------- + +00000100 + +-- Sections (summary) --------------------------------------------------------- + +Vstart Vstop Start Stop Length Class Name +00000100 00000200 00000100 00000200 00000100 progbits .text +00000200 00000300 00000200 00000300 00000100 progbits .data +00000300 00000400 00000300 00000400 00000100 nobits .bss + +-- Sections (detailed) -------------------------------------------------------- + +---- Section .text ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000100 +align: 00000004 +follows: not defined +vstart: 00000100 +valign: 00000004 +vfollows: not defined + +---- Section .data ------------------------------------------------------------ + +class: progbits +length: 00000100 +start: 00000200 +align: 00000004 +follows: not defined +vstart: 00000200 +valign: 00000004 +vfollows: not defined + +---- Section .bss ------------------------------------------------------------- + +class: nobits +length: 00000100 +start: 00000300 +align: 00000004 +follows: not defined +vstart: 00000300 +valign: 00000004 +vfollows: not defined + +-- Symbols -------------------------------------------------------------------- + diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm new file mode 100644 index 00000000..84a7c1e4 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm @@ -0,0 +1,2 @@ +section sect1 vfollows=sect2 +section sect2 vfollows=sect1 diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn new file mode 100644 index 00000000..3965e589 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn @@ -0,0 +1 @@ +-: error: vfollows loop between section `sect2' and section `sect1' diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm new file mode 100644 index 00000000..ac080b85 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm @@ -0,0 +1 @@ +section sect vfollows=sect diff --git a/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn new file mode 100644 index 00000000..4f252b42 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn @@ -0,0 +1 @@ +-: error: vfollows loop between section `sect' and section `sect' diff --git a/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm new file mode 100644 index 00000000..fe0f6e5b --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm @@ -0,0 +1,2 @@ +section foo vfollows=bar + diff --git a/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn new file mode 100644 index 00000000..93b44d08 --- /dev/null +++ b/modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn @@ -0,0 +1 @@ +-: error: section `foo' vfollows an invalid or unknown section `bar' diff --git a/modules/objfmts/coff/CMakeLists.txt b/modules/objfmts/coff/CMakeLists.txt new file mode 100644 index 00000000..b25f9ac8 --- /dev/null +++ b/modules/objfmts/coff/CMakeLists.txt @@ -0,0 +1,28 @@ +YASM_GENMACRO( + ${CMAKE_CURRENT_SOURCE_DIR}/objfmts/coff/win64-nasm.mac + ${CMAKE_CURRENT_BINARY_DIR}/win64-nasm.c + win64_nasm_stdmac + ) + +YASM_GENMACRO( + ${CMAKE_CURRENT_SOURCE_DIR}/objfmts/coff/win64-gas.mac + ${CMAKE_CURRENT_BINARY_DIR}/win64-gas.c + win64_gas_stdmac + ) + +SET(coff_DEPS + ${CMAKE_CURRENT_BINARY_DIR}/win64-nasm.c + ${CMAKE_CURRENT_BINARY_DIR}/win64-gas.c + ) + +SET_SOURCE_FILES_PROPERTIES(objfmts/coff/coff-objfmt.c PROPERTIES + OBJECT_DEPENDS "${coff_DEPS}" + ) + +YASM_ADD_MODULE(objfmt_coff + objfmts/coff/coff-objfmt.c + objfmts/coff/win64-except.c + ) +list(APPEND YASM_MODULES objfmt_win32) +list(APPEND YASM_MODULES objfmt_win64) +list(APPEND YASM_MODULES objfmt_x64) diff --git a/modules/objfmts/coff/Makefile.inc b/modules/objfmts/coff/Makefile.inc index 526f7713..9564fed3 100644 --- a/modules/objfmts/coff/Makefile.inc +++ b/modules/objfmts/coff/Makefile.inc @@ -1,11 +1,25 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/coff/coff-objfmt.c libyasm_a_SOURCES += modules/objfmts/coff/coff-objfmt.h libyasm_a_SOURCES += modules/objfmts/coff/win64-except.c YASM_MODULES += objfmt_coff +$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c + +win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT) + $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac + +BUILT_SOURCES += win64-nasm.c +CLEANFILES += win64-nasm.c +EXTRA_DIST += modules/objfmts/coff/win64-nasm.mac + +win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT) + $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac + +BUILT_SOURCES += win64-gas.c +CLEANFILES += win64-gas.c +EXTRA_DIST += modules/objfmts/coff/win64-gas.mac + EXTRA_DIST += modules/objfmts/coff/tests/Makefile.inc include modules/objfmts/coff/tests/Makefile.inc diff --git a/modules/objfmts/coff/coff-objfmt.c b/modules/objfmts/coff/coff-objfmt.c index bd856140..8f753bfe 100644 --- a/modules/objfmts/coff/coff-objfmt.c +++ b/modules/objfmts/coff/coff-objfmt.c @@ -26,11 +26,7 @@ */ #include #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include #include "coff-objfmt.h" @@ -38,15 +34,6 @@ #define REGULAR_OUTBUF_SIZE 1024 -/* Defining this to 0 sets all section VMA's to 0 rather than as the same as - * the LMA. According to the DJGPP COFF Spec, this should be set to 1 - * (VMA=LMA), and indeed DJGPP's GCC output shows VMA=LMA. However, NASM - * outputs VMA=0 (as if this was 0), and GNU objdump output looks a lot nicer - * with VMA=0. Who's right? This is #defined as changing this setting affects - * several places in the code. - */ -#define COFF_SET_VMA (!objfmt_coff->win32) - #define COFF_MACHINE_I386 0x014C #define COFF_MACHINE_AMD64 0x8664 @@ -165,7 +152,9 @@ typedef enum coff_symtab_auxtype { } coff_symtab_auxtype; typedef struct coff_symrec_data { + int forcevis; /* force visibility in symbol table */ unsigned long index; /* assigned COFF symbol table index */ + unsigned int type; /* type */ coff_symrec_sclass sclass; /* storage class */ int numaux; /* number of auxiliary entries */ @@ -184,10 +173,15 @@ typedef struct yasm_objfmt_coff { coff_symrec_data *filesym_data; /* Data for .file symbol */ + /* data for .def/.endef and related directives */ + coff_symrec_data *def_sym; /* symbol specified by .def */ + /* data for win64 proc_frame and related directives */ unsigned long proc_frame; /* Line number of start of proc, or 0 */ unsigned long done_prolog; /* Line number of end of prologue, or 0 */ /*@null@*/ coff_unwind_info *unwind; /* Unwind info */ + + yasm_symrec *ssym_imagebase; /* ..imagebase symbol for win64 */ } yasm_objfmt_coff; typedef struct coff_objfmt_output_info { @@ -221,6 +215,29 @@ static const yasm_assoc_data_callback coff_symrec_data_cb = { coff_symrec_data_print }; +/* Bytecode callback function prototypes */ +static void win32_sxdata_bc_destroy(void *contents); +static void win32_sxdata_bc_print(const void *contents, FILE *f, + int indent_level); +static int win32_sxdata_bc_calc_len + (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); +static int win32_sxdata_bc_tobytes + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, + yasm_output_value_func output_value, + /*@null@*/ yasm_output_reloc_func output_reloc); + +/* Bytecode callback structures */ +static const yasm_bytecode_callback win32_sxdata_bc_callback = { + win32_sxdata_bc_destroy, + win32_sxdata_bc_print, + yasm_bc_finalize_common, + NULL, + win32_sxdata_bc_calc_len, + yasm_bc_expand_common, + win32_sxdata_bc_tobytes, + 0 +}; + yasm_objfmt_module yasm_coff_LTX_objfmt; yasm_objfmt_module yasm_win32_LTX_objfmt; yasm_objfmt_module yasm_win64_LTX_objfmt; @@ -234,7 +251,9 @@ coff_objfmt_sym_set_data(yasm_symrec *sym, coff_symrec_sclass sclass, sym_data = yasm_xmalloc(sizeof(coff_symrec_data) + (numaux-1)*sizeof(coff_symtab_auxent)); + sym_data->forcevis = 0; sym_data->index = 0; + sym_data->type = 0; sym_data->sclass = sclass; sym_data->numaux = numaux; sym_data->auxtype = auxtype; @@ -270,6 +289,8 @@ coff_common_create(yasm_object *object) objfmt_coff->proc_frame = 0; objfmt_coff->done_prolog = 0; objfmt_coff->unwind = NULL; + objfmt_coff->ssym_imagebase = NULL; + objfmt_coff->def_sym = NULL; return objfmt_coff; } @@ -323,6 +344,17 @@ win32_objfmt_create(yasm_object *object) } objfmt_coff->win32 = 1; + /* Define a @feat.00 symbol for win32 safeseh handling */ + if (!objfmt_coff->win64) { + yasm_symrec *feat00; + coff_symrec_data *sym_data; + feat00 = yasm_symtab_define_equ(object->symtab, "@feat.00", + yasm_expr_create_ident(yasm_expr_int( + yasm_intnum_create_uint(1)), 0), 0); + sym_data = coff_objfmt_sym_set_data(feat00, COFF_SCL_STAT, 0, + COFF_SYMTAB_AUX_NONE); + sym_data->forcevis = 1; + } } return (yasm_objfmt *)objfmt_coff; } @@ -345,14 +377,17 @@ win64_objfmt_create(yasm_object *object) objfmt_coff->objfmt.module = &yasm_win64_LTX_objfmt; objfmt_coff->win32 = 1; objfmt_coff->win64 = 1; + objfmt_coff->ssym_imagebase = + yasm_symtab_define_label(object->symtab, "..imagebase", NULL, 0, 0); } return (yasm_objfmt *)objfmt_coff; } -static coff_section_data * -coff_objfmt_init_new_section(yasm_object *object, yasm_section *sect, - const char *sectname, unsigned long line) +static void +coff_objfmt_init_new_section(yasm_section *sect, unsigned long line) { + yasm_object *object = yasm_section_get_object(sect); + const char *sectname = yasm_section_get_name(sect); yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; coff_section_data *data; yasm_symrec *sym; @@ -368,6 +403,15 @@ coff_objfmt_init_new_section(yasm_object *object, yasm_section *sect, data->flags2 = 0; data->strtab_name = 0; data->isdebug = 0; + + if (yasm__strncasecmp(sectname, ".debug", 6)==0) { + data->flags = COFF_STYP_DATA; + if (objfmt_coff->win32) + data->flags |= COFF_STYP_DISCARD|COFF_STYP_READ; + data->isdebug = 1; + } else + data->flags = COFF_STYP_TEXT; + yasm_section_add_data(sect, &coff_section_data_cb, data); sym = yasm_symtab_define_label(object->symtab, sectname, @@ -375,47 +419,6 @@ coff_objfmt_init_new_section(yasm_object *object, yasm_section *sect, yasm_symrec_declare(sym, YASM_SYM_GLOBAL, line); coff_objfmt_sym_set_data(sym, COFF_SCL_STAT, 1, COFF_SYMTAB_AUX_SECT); data->sym = sym; - return data; -} - -static int -coff_objfmt_init_remaining_section(yasm_section *sect, /*@null@*/ void *d) -{ - /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; - /*@dependent@*/ /*@null@*/ coff_section_data *csd; - - assert(info != NULL); - csd = yasm_section_get_data(sect, &coff_section_data_cb); - if (!csd) { - /* Initialize new one */ - const char *sectname = yasm_section_get_name(sect); - csd = coff_objfmt_init_new_section(info->object, sect, sectname, 0); - if (yasm__strncasecmp(sectname, ".debug", 6)==0) { - csd->flags = COFF_STYP_DATA; - if (info->objfmt_coff->win32) - csd->flags |= COFF_STYP_DISCARD|COFF_STYP_READ; - csd->isdebug = 1; - } else - csd->flags = COFF_STYP_TEXT; - } - - return 0; -} - -static int -coff_objfmt_set_section_addr(yasm_section *sect, /*@null@*/ void *d) -{ - /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; - /*@dependent@*/ /*@null@*/ coff_section_data *csd; - - assert(info != NULL); - csd = yasm_section_get_data(sect, &coff_section_data_cb); - assert(csd != NULL); - - csd->addr = info->addr; - info->addr += yasm_bc_next_offset(yasm_section_bcs_last(sect)); - - return 0; } static int @@ -467,14 +470,18 @@ coff_objfmt_output_value(yasm_value *value, unsigned char *buf, /*@dependent@*/ /*@null@*/ yasm_symrec *sym = value->rel; unsigned long addr; coff_reloc *reloc; + int nobase = info->csd->flags2 & COFF_FLAG_NOBASE; /* Sometimes we want the relocation to be generated against one * symbol but the value generated correspond to a different symbol. * This is done through (sym being referenced) WRT (sym used for * reloc). Note both syms need to be in the same section! */ - if (value->wrt) { + if (value->wrt && value->wrt == objfmt_coff->ssym_imagebase) + nobase = 1; + else if (value->wrt) { /*@dependent@*/ /*@null@*/ yasm_bytecode *rel_precbc, *wrt_precbc; + if (!yasm_symrec_get_label(sym, &rel_precbc) || !yasm_symrec_get_label(value->wrt, &wrt_precbc)) { yasm_error_set(YASM_ERROR_TOO_COMPLEX, @@ -493,12 +500,9 @@ coff_objfmt_output_value(yasm_value *value, unsigned char *buf, if (vis & YASM_SYM_COMMON) { /* In standard COFF, COMMON symbols have their length added in */ if (!objfmt_coff->win32) { - /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; /*@dependent@*/ /*@null@*/ yasm_expr **csize_expr; /*@dependent@*/ /*@null@*/ yasm_intnum *common_size; - csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); - assert(csymd != NULL); csize_expr = yasm_symrec_get_common_size(sym); assert(csize_expr != NULL); common_size = yasm_expr_get_intnum(csize_expr, 1); @@ -528,8 +532,6 @@ coff_objfmt_output_value(yasm_value *value, unsigned char *buf, assert(sym_csd != NULL); sym = sym_csd->sym; intn_val = yasm_bc_next_offset(sym_precbc); - if (COFF_SET_VMA) - intn_val += sym_csd->addr; } } @@ -549,8 +551,8 @@ coff_objfmt_output_value(yasm_value *value, unsigned char *buf, intn_minus = bc->offset; } - if (value->seg_of || value->section_rel) { - /* Segment or section-relative generation; zero value. */ + if (value->seg_of) { + /* Segment generation; zero value. */ intn_val = 0; intn_minus = 0; } @@ -558,8 +560,6 @@ coff_objfmt_output_value(yasm_value *value, unsigned char *buf, /* Generate reloc */ reloc = yasm_xmalloc(sizeof(coff_reloc)); addr = bc->offset + offset; - if (COFF_SET_VMA) - addr += info->addr; reloc->reloc.addr = yasm_intnum_create_uint(addr); reloc->reloc.sym = sym; @@ -622,13 +622,13 @@ coff_objfmt_output_value(yasm_value *value, unsigned char *buf, yasm_internal_error(N_("coff objfmt: unrecognized machine")); } else { if (objfmt_coff->machine == COFF_MACHINE_I386) { - if (info->csd->flags2 & COFF_FLAG_NOBASE) + if (nobase) reloc->type = COFF_RELOC_I386_ADDR32NB; else reloc->type = COFF_RELOC_I386_ADDR32; } else if (objfmt_coff->machine == COFF_MACHINE_AMD64) { if (valsize == 32) { - if (info->csd->flags2 & COFF_FLAG_NOBASE) + if (nobase) reloc->type = COFF_RELOC_AMD64_ADDR32NB; else reloc->type = COFF_RELOC_AMD64_ADDR32; @@ -773,7 +773,8 @@ coff_objfmt_output_section(yasm_section *sect, /*@null@*/ void *d) coff_objfmt_output_bytecode); /* Sanity check final section size */ - if (csd->size != yasm_bc_next_offset(yasm_section_bcs_last(sect))) + if (yasm_errwarns_num_errors(info->errwarns, 0) == 0 && + csd->size != yasm_bc_next_offset(yasm_section_bcs_last(sect))) yasm_internal_error( N_("coff: section computed size did not match actual size")); } @@ -883,16 +884,8 @@ coff_objfmt_output_secthead(yasm_section *sect, /*@null@*/ void *d) } else strncpy((char *)localbuf, yasm_section_get_name(sect), 8); localbuf += 8; - if (csd->isdebug) { - YASM_WRITE_32_L(localbuf, 0); /* physical address */ - YASM_WRITE_32_L(localbuf, 0); /* virtual address */ - } else { - YASM_WRITE_32_L(localbuf, csd->addr); /* physical address */ - if (COFF_SET_VMA) - YASM_WRITE_32_L(localbuf, csd->addr);/* virtual address */ - else - YASM_WRITE_32_L(localbuf, 0); /* virtual address */ - } + YASM_WRITE_32_L(localbuf, 0); /* physical address */ + YASM_WRITE_32_L(localbuf, 0); /* virtual address */ YASM_WRITE_32_L(localbuf, csd->size); /* section size */ YASM_WRITE_32_L(localbuf, csd->scnptr); /* file ptr to data */ YASM_WRITE_32_L(localbuf, csd->relptr); /* file ptr to relocs */ @@ -927,16 +920,21 @@ coff_objfmt_count_sym(yasm_symrec *sym, /*@null@*/ void *d) assert(info != NULL); sym_data = yasm_symrec_get_data(sym, &coff_symrec_data_cb); - if ((vis & (YASM_SYM_EXTERN|YASM_SYM_GLOBAL|YASM_SYM_COMMON)) && !sym_data) - sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_EXT, 0, - COFF_SYMTAB_AUX_NONE); - if (info->all_syms || vis != YASM_SYM_LOCAL) { + if (info->all_syms || vis != YASM_SYM_LOCAL || yasm_symrec_is_abs(sym) || + (sym_data && sym_data->forcevis)) { /* Save index in symrec data */ - if (!sym_data) { - sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_STAT, 0, + if (!sym_data) + sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_NULL, 0, COFF_SYMTAB_AUX_NONE); + /* Set storage class based on visibility if not already set */ + if (sym_data->sclass == COFF_SCL_NULL) { + if (vis & (YASM_SYM_EXTERN|YASM_SYM_GLOBAL|YASM_SYM_COMMON)) + sym_data->sclass = COFF_SCL_EXT; + else + sym_data->sclass = COFF_SCL_STAT; } + sym_data->index = info->indx; info->indx += sym_data->numaux + 1; @@ -949,28 +947,46 @@ coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) { /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; yasm_sym_vis vis = yasm_symrec_get_visibility(sym); + int is_abs = yasm_symrec_is_abs(sym); + /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; + yasm_valparamhead *objext_valparams = + yasm_symrec_get_objext_valparams(sym); + csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); assert(info != NULL); + /* Look for "function" flag on global syms */ + if (csymd && csymd->type == 0 && (vis & YASM_SYM_GLOBAL) != 0) { + if (objext_valparams) { + const char *id = yasm_vp_id(yasm_vps_first(objext_valparams)); + if (yasm__strcasecmp(id, "function") == 0) + csymd->type = 0x20; + } + } + /* Don't output local syms unless outputting all syms */ - if (info->all_syms || vis != YASM_SYM_LOCAL) { - const char *name = yasm_symrec_get_name(sym); + if (info->all_syms || vis != YASM_SYM_LOCAL || is_abs || + (csymd && csymd->forcevis)) { + /*@only*/ char *name; const yasm_expr *equ_val; const yasm_intnum *intn; unsigned char *localbuf; - size_t len = strlen(name); + size_t len; int aux; - /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; unsigned long value = 0; unsigned int scnum = 0xfffe; /* -2 = debugging symbol */ /*@dependent@*/ /*@null@*/ yasm_section *sect; /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc; unsigned long scnlen = 0; /* for sect auxent */ unsigned long nreloc = 0; /* for sect auxent */ - yasm_objfmt_coff *objfmt_coff = info->objfmt_coff; + + if (is_abs) + name = yasm__xstrdup(".absolut"); + else + name = yasm_symrec_get_global_name(sym, info->object); + len = strlen(name); /* Get symrec's of_data (needed for storage class) */ - csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); if (!csymd) yasm_internal_error(N_("coff: expected sym data to be present")); @@ -990,8 +1006,6 @@ coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) scnum = csectd->scnum; scnlen = csectd->size; nreloc = csectd->nreloc; - if (COFF_SET_VMA) - value = csectd->addr; } else yasm_internal_error(N_("didn't understand section")); if (precbc) @@ -1042,7 +1056,7 @@ coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) } YASM_WRITE_32_L(localbuf, value); /* value */ YASM_WRITE_16_L(localbuf, scnum); /* section number */ - YASM_WRITE_16_L(localbuf, 0); /* type is always zero (for now) */ + YASM_WRITE_16_L(localbuf, csymd->type); /* type */ YASM_WRITE_8(localbuf, csymd->sclass); /* storage class */ YASM_WRITE_8(localbuf, csymd->numaux); /* number of aux entries */ fwrite(info->buf, 18, 1, info->f); @@ -1072,6 +1086,7 @@ coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) } fwrite(info->buf, 18, 1, info->f); } + yasm_xfree(name); } return 0; } @@ -1081,17 +1096,18 @@ coff_objfmt_output_str(yasm_symrec *sym, /*@null@*/ void *d) { /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; yasm_sym_vis vis = yasm_symrec_get_visibility(sym); + /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; + csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); assert(info != NULL); /* Don't output local syms unless outputting all syms */ - if (info->all_syms || vis != YASM_SYM_LOCAL) { - const char *name = yasm_symrec_get_name(sym); - /*@dependent@*/ /*@null@*/ coff_symrec_data *csymd; + if (info->all_syms || vis != YASM_SYM_LOCAL || + (csymd && csymd->forcevis)) { + /*@only@*/ char *name = yasm_symrec_get_global_name(sym, info->object); size_t len = strlen(name); int aux; - csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); if (!csymd) yasm_internal_error(N_("coff: expected sym data to be present")); @@ -1108,6 +1124,7 @@ coff_objfmt_output_str(yasm_symrec *sym, /*@null@*/ void *d) break; } } + yasm_xfree(name); } return 0; } @@ -1152,12 +1169,6 @@ coff_objfmt_output(yasm_object *object, FILE *f, int all_syms, info.f = f; info.buf = yasm_xmalloc(REGULAR_OUTBUF_SIZE); - /* Initialize section data (and count in parse_scnum) any sections that - * we've not initialized so far. - */ - yasm_object_sections_traverse(object, &info, - coff_objfmt_init_remaining_section); - /* Allocate space for headers by seeking forward */ if (fseek(f, (long)(20+40*(objfmt_coff->parse_scnum-1)), SEEK_SET) < 0) { yasm__fatal(N_("could not seek on output file")); @@ -1172,17 +1183,6 @@ coff_objfmt_output(yasm_object *object, FILE *f, int all_syms, symtab_count = info.indx; /* Section data/relocs */ - if (COFF_SET_VMA) { - /* If we're setting the VMA, we need to do a first section pass to - * determine each section's addr value before actually outputting - * relocations, as a relocation's section address is added into the - * addends in the generated code. - */ - info.addr = 0; - if (yasm_object_sections_traverse(object, &info, - coff_objfmt_set_section_addr)) - return; - } info.addr = 0; if (yasm_object_sections_traverse(object, &info, coff_objfmt_output_section)) @@ -1256,9 +1256,9 @@ coff_objfmt_add_default_section(yasm_object *object) coff_section_data *csd; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 16, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 16, 1, 0, &isnew, 0); if (isnew) { - csd = coff_objfmt_init_new_section(object, retval, ".text", 0); + csd = yasm_section_get_data(retval, &coff_section_data_cb); csd->flags = COFF_STYP_TEXT; if (objfmt_coff->win32) csd->flags |= COFF_STYP_EXECUTE | COFF_STYP_READ; @@ -1314,6 +1314,7 @@ coff_helper_gasflags(void *obj, yasm_valparam *vp, unsigned long line, void *d, datasect = 1; load = 1; readonly = 0; + break; case 'x': code = 1; load = 1; @@ -1481,6 +1482,9 @@ coff_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, } else if (objfmt_coff->win64 && strcmp(sectname, ".xdata") == 0) { data.flags = COFF_STYP_DATA | COFF_STYP_READ; align = 8; + data.flags2 = COFF_FLAG_NOBASE; + } else if (objfmt_coff->win32 && strcmp(sectname, ".sxdata") == 0) { + data.flags = COFF_STYP_INFO; } else if (strcmp(sectname, ".comment") == 0) { data.flags = COFF_STYP_INFO | COFF_STYP_DISCARD | COFF_STYP_READ; } else if (yasm__strncasecmp(sectname, ".debug", 6)==0) { @@ -1537,16 +1541,12 @@ coff_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, realname[8] = '\0'; } - retval = yasm_object_get_general(object, realname, 0, align, iscode, + retval = yasm_object_get_general(object, realname, align, iscode, resonly, &isnew, line); - - if (isnew) - csd = coff_objfmt_init_new_section(object, retval, realname, line); - else - csd = yasm_section_get_data(retval, &coff_section_data_cb); - yasm_xfree(realname); + csd = yasm_section_get_data(retval, &coff_section_data_cb); + if (isnew || yasm_section_is_default(retval)) { yasm_section_set_default(retval, 0); csd->flags = data.flags; @@ -1558,6 +1558,24 @@ coff_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, return retval; } +static /*@observer@*/ /*@null@*/ yasm_symrec * +coff_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + return NULL; +} + +static /*@observer@*/ /*@null@*/ yasm_symrec * +win64_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + if (yasm__strcasecmp(name, "imagebase") == 0) { + yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; + return objfmt_coff->ssym_imagebase; + } + return NULL; +} + static void coff_section_data_destroy(void *data) { @@ -1632,14 +1650,12 @@ dir_export(yasm_object *object, yasm_valparamhead *valparams, } /* Add to end of linker directives */ - sect = yasm_object_get_general(object, ".drectve", 0, 0, 0, 0, &isnew, - line); + sect = yasm_object_get_general(object, ".drectve", 0, 0, 0, &isnew, line); /* Initialize directive section if needed */ if (isnew) { coff_section_data *csd; - csd = coff_objfmt_init_new_section(object, sect, - yasm_section_get_name(sect), line); + csd = yasm_section_get_data(sect, &coff_section_data_cb); csd->flags = COFF_STYP_INFO | COFF_STYP_DISCARD | COFF_STYP_READ; } @@ -1653,6 +1669,96 @@ dir_export(yasm_object *object, yasm_valparamhead *valparams, yasm_section_bcs_append(sect, yasm_bc_create_data(&dvs, 1, 0, NULL, line)); } +static void +dir_safeseh(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_valparam *vp; + /*@null@*/ const char *symname; + yasm_symrec *sym; + int isnew; + yasm_section *sect; + + /* Reference symbol (to generate error if not declared). + * Also, symbol must be externally visible, so force it. + */ + vp = yasm_vps_first(valparams); + symname = yasm_vp_id(vp); + if (symname) { + coff_symrec_data *sym_data; + sym = yasm_symtab_use(object->symtab, symname, line); + sym_data = yasm_symrec_get_data(sym, &coff_symrec_data_cb); + if (!sym_data) { + sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_NULL, 0, + COFF_SYMTAB_AUX_NONE); + } + sym_data->forcevis = 1; + sym_data->type = 0x20; /* function */ + } else { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("argument to SAFESEH must be symbol name")); + return; + } + + /* + * Add symbol number to end of .sxdata section. + */ + + sect = yasm_object_get_general(object, ".sxdata", 0, 0, 0, &isnew, line); + + /* Initialize sxdata section if needed */ + if (isnew) { + coff_section_data *csd; + csd = yasm_section_get_data(sect, &coff_section_data_cb); + csd->flags = COFF_STYP_INFO; + } + + /* Add as sxdata bytecode */ + yasm_section_bcs_append(sect, + yasm_bc_create_common(&win32_sxdata_bc_callback, + sym, line)); +} + +static void +win32_sxdata_bc_destroy(void *contents) +{ + /* Contents is just the symbol pointer, so no need to delete */ +} + +static void +win32_sxdata_bc_print(const void *contents, FILE *f, int indent_level) +{ + /* TODO */ +} + +static int +win32_sxdata_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, + void *add_span_data) +{ + bc->len += 4; + return 0; +} + +static int +win32_sxdata_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, + yasm_output_value_func output_value, + yasm_output_reloc_func output_reloc) +{ + yasm_symrec *sym = (yasm_symrec *)bc->contents; + unsigned char *buf = *bufp; + coff_symrec_data *csymd; + + csymd = yasm_symrec_get_data(sym, &coff_symrec_data_cb); + if (!csymd) + yasm_internal_error(N_("coff: no symbol data for SAFESEH symbol")); + + YASM_WRITE_32_L(buf, csymd->index); + + *bufp = buf; + return 0; +} + static void dir_ident(yasm_object *object, yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, unsigned long line) @@ -1716,6 +1822,131 @@ dir_ident(yasm_object *object, yasm_valparamhead *valparams, yasm_bc_create_data(&dvs, 1, 1, object->arch, line)); } +static void +dir_secrel32(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_datavalhead dvs; + yasm_valparam *vp; + + if (!object->cur_section) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_(".secrel32 can only be used inside of a section")); + return; + } + + vp = yasm_vps_first(valparams); + yasm_dvs_initialize(&dvs); + do { + yasm_expr *e = yasm_vp_expr(vp, object->symtab, line); + yasm_dataval *dv; + if (!e) { + yasm_error_set(YASM_ERROR_VALUE, + N_(".secrel32 requires expressions")); + yasm_dvs_delete(&dvs); + return; + } + dv = yasm_dv_create_expr(e); + yasm_dv_get_value(dv)->section_rel = 1; + yasm_dvs_append(&dvs, dv); + } while ((vp = yasm_vps_next(vp))); + + yasm_section_bcs_append(object->cur_section, + yasm_bc_create_data(&dvs, 4, 0, object->arch, line)); +} + +static void +dir_def(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; + yasm_valparam *vp; + const char *symname; + yasm_symrec *sym; + coff_symrec_data *sym_data; + + if (objfmt_coff->def_sym) { + yasm_warn_set(YASM_WARN_GENERAL, + N_(".def pseudo-op used inside of .def/.endef; ignored")); + return; + } + + vp = yasm_vps_first(valparams); + symname = yasm_vp_id(vp); + if (!symname) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("argument to SAFESEH must be symbol name")); + return; + } + + sym = yasm_symtab_use(object->symtab, symname, line); + sym_data = yasm_symrec_get_data(sym, &coff_symrec_data_cb); + if (!sym_data) { + sym_data = coff_objfmt_sym_set_data(sym, COFF_SCL_NULL, 0, + COFF_SYMTAB_AUX_NONE); + } + objfmt_coff->def_sym = sym_data; +} + +static void +dir_scl(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; + yasm_intnum *intn = NULL; + + if (!objfmt_coff->def_sym) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("%s pseudo-op used outside of .def/.endef; ignored"), + ".scl"); + return; + } + + if (yasm_dir_helper_intn(object, yasm_vps_first(valparams), line, + &intn, 0) < 0) + return; + if (!intn) + return; + objfmt_coff->def_sym->sclass = yasm_intnum_get_uint(intn); + yasm_intnum_destroy(intn); +} + +static void +dir_type(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; + yasm_intnum *intn = NULL; + + if (!objfmt_coff->def_sym) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("%s pseudo-op used outside of .def/.endef; ignored"), + ".type"); + return; + } + + if (yasm_dir_helper_intn(object, yasm_vps_first(valparams), line, + &intn, 0) < 0) + return; + if (!intn) + return; + objfmt_coff->def_sym->type = yasm_intnum_get_uint(intn); + yasm_intnum_destroy(intn); +} + +static void +dir_endef(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_coff *objfmt_coff = (yasm_objfmt_coff *)object->objfmt; + if (!objfmt_coff->def_sym) { + yasm_warn_set(YASM_WARN_GENERAL, + N_(".endef pseudo-op used before .def; ignored")); + return; + } + objfmt_coff->def_sym = NULL; +} + static void dir_proc_frame(yasm_object *object, /*@null@*/ yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, unsigned long line) @@ -2010,11 +2241,11 @@ dir_endproc_frame(yasm_object *object, /*@null@*/ yasm_valparamhead *valparams, * Add unwind info to end of .xdata section. */ - sect = yasm_object_get_general(object, ".xdata", 0, 0, 0, 0, &isnew, line); + sect = yasm_object_get_general(object, ".xdata", 0, 0, 0, &isnew, line); /* Initialize xdata section if needed */ if (isnew) { - csd = coff_objfmt_init_new_section(object, sect, ".xdata", line); + csd = yasm_section_get_data(sect, &coff_section_data_cb); csd->flags = COFF_STYP_DATA | COFF_STYP_READ; yasm_section_set_align(sect, 8, line); } @@ -2035,11 +2266,11 @@ dir_endproc_frame(yasm_object *object, /*@null@*/ yasm_valparamhead *valparams, * Add function lookup to end of .pdata section. */ - sect = yasm_object_get_general(object, ".pdata", 0, 0, 0, 0, &isnew, line); + sect = yasm_object_get_general(object, ".pdata", 0, 0, 0, &isnew, line); /* Initialize pdata section if needed */ if (isnew) { - csd = coff_objfmt_init_new_section(object, sect, ".pdata", line); + csd = yasm_section_get_data(sect, &coff_section_data_cb); csd->flags = COFF_STYP_DATA | COFF_STYP_READ; csd->flags2 = COFF_FLAG_NOBASE; yasm_section_set_align(sect, 4, line); @@ -2071,6 +2302,11 @@ static const char *coff_objfmt_dbgfmt_keywords[] = { static const yasm_directive coff_objfmt_directives[] = { { ".ident", "gas", dir_ident, YASM_DIR_ANY }, { "ident", "nasm", dir_ident, YASM_DIR_ANY }, + { ".def", "gas", dir_def, YASM_DIR_ID_REQUIRED }, + { ".endef", "gas", dir_endef, YASM_DIR_ANY }, + { ".scl", "gas", dir_scl, YASM_DIR_ARG_REQUIRED }, + { ".type", "gas", dir_type, YASM_DIR_ARG_REQUIRED }, + { ".secrel32", "gas", dir_secrel32, YASM_DIR_ARG_REQUIRED }, { NULL, NULL, NULL, 0 } }; @@ -2080,14 +2316,18 @@ yasm_objfmt_module yasm_coff_LTX_objfmt = { "coff", "o", 32, + 0, coff_objfmt_dbgfmt_keywords, "null", coff_objfmt_directives, + NULL, /* no standard macros */ coff_objfmt_create, coff_objfmt_output, coff_objfmt_destroy, coff_objfmt_add_default_section, - coff_objfmt_section_switch + coff_objfmt_init_new_section, + coff_objfmt_section_switch, + coff_objfmt_get_special_sym }; /* Define valid debug formats to use with this object format */ @@ -2100,71 +2340,128 @@ static const char *winXX_objfmt_dbgfmt_keywords[] = { static const yasm_directive win32_objfmt_directives[] = { { ".ident", "gas", dir_ident, YASM_DIR_ANY }, - { ".export", "gas", dir_export, YASM_DIR_ID_REQUIRED }, { "ident", "nasm", dir_ident, YASM_DIR_ANY }, + { ".def", "gas", dir_def, YASM_DIR_ID_REQUIRED }, + { ".endef", "gas", dir_endef, YASM_DIR_ANY }, + { ".scl", "gas", dir_scl, YASM_DIR_ARG_REQUIRED }, + { ".type", "gas", dir_type, YASM_DIR_ARG_REQUIRED }, + { ".secrel32", "gas", dir_secrel32, YASM_DIR_ARG_REQUIRED }, + { ".export", "gas", dir_export, YASM_DIR_ID_REQUIRED }, { "export", "nasm", dir_export, YASM_DIR_ID_REQUIRED }, + { ".safeseh", "gas", dir_safeseh, YASM_DIR_ID_REQUIRED }, + { "safeseh", "nasm", dir_safeseh, YASM_DIR_ID_REQUIRED }, { NULL, NULL, NULL, 0 } }; +static const char *win32_nasm_stdmac[] = { + "%imacro export 1+.nolist", + "[export %1]", + "%endmacro", + "%imacro safeseh 1+.nolist", + "[safeseh %1]", + "%endmacro", + NULL +}; + +static const yasm_stdmac win32_objfmt_stdmacs[] = { + { "nasm", "nasm", win32_nasm_stdmac }, + { NULL, NULL, NULL } +}; + /* Define objfmt structure -- see objfmt.h for details */ yasm_objfmt_module yasm_win32_LTX_objfmt = { "Win32", "win32", "obj", 32, + 1, winXX_objfmt_dbgfmt_keywords, "null", win32_objfmt_directives, + win32_objfmt_stdmacs, win32_objfmt_create, coff_objfmt_output, coff_objfmt_destroy, coff_objfmt_add_default_section, - coff_objfmt_section_switch + coff_objfmt_init_new_section, + coff_objfmt_section_switch, + coff_objfmt_get_special_sym }; static const yasm_directive win64_objfmt_directives[] = { { ".ident", "gas", dir_ident, YASM_DIR_ANY }, { "ident", "nasm", dir_ident, YASM_DIR_ANY }, + { ".def", "gas", dir_def, YASM_DIR_ID_REQUIRED }, + { ".endef", "gas", dir_endef, YASM_DIR_ANY }, + { ".scl", "gas", dir_scl, YASM_DIR_ARG_REQUIRED }, + { ".type", "gas", dir_type, YASM_DIR_ARG_REQUIRED }, + { ".secrel32", "gas", dir_secrel32, YASM_DIR_ARG_REQUIRED }, { ".export", "gas", dir_export, YASM_DIR_ID_REQUIRED }, { "export", "nasm", dir_export, YASM_DIR_ID_REQUIRED }, + { ".proc_frame", "gas", dir_proc_frame, YASM_DIR_ID_REQUIRED }, { "proc_frame", "nasm", dir_proc_frame, YASM_DIR_ID_REQUIRED }, + { ".pushreg", "gas", dir_pushreg, YASM_DIR_ARG_REQUIRED }, { "pushreg", "nasm", dir_pushreg, YASM_DIR_ARG_REQUIRED }, + { ".setframe", "gas", dir_setframe, YASM_DIR_ARG_REQUIRED }, { "setframe", "nasm", dir_setframe, YASM_DIR_ARG_REQUIRED }, + { ".allocstack", "gas", dir_allocstack, YASM_DIR_ARG_REQUIRED }, { "allocstack", "nasm", dir_allocstack, YASM_DIR_ARG_REQUIRED }, + { ".savereg", "gas", dir_savereg, YASM_DIR_ARG_REQUIRED }, { "savereg", "nasm", dir_savereg, YASM_DIR_ARG_REQUIRED }, + { ".savexmm128", "gas", dir_savexmm128, YASM_DIR_ARG_REQUIRED }, { "savexmm128", "nasm", dir_savexmm128, YASM_DIR_ARG_REQUIRED }, + { ".pushframe", "gas", dir_pushframe, YASM_DIR_ANY }, { "pushframe", "nasm", dir_pushframe, YASM_DIR_ANY }, + { ".endprolog", "gas", dir_endprolog, YASM_DIR_ANY }, { "endprolog", "nasm", dir_endprolog, YASM_DIR_ANY }, + { ".endproc_frame", "gas", dir_endproc_frame, YASM_DIR_ANY }, { "endproc_frame", "nasm", dir_endproc_frame, YASM_DIR_ANY }, { NULL, NULL, NULL, 0 } }; +#include "win64-nasm.c" +#include "win64-gas.c" + +static const yasm_stdmac win64_objfmt_stdmacs[] = { + { "nasm", "nasm", win64_nasm_stdmac }, + { "gas", "nasm", win64_gas_stdmac }, + { NULL, NULL, NULL } +}; + /* Define objfmt structure -- see objfmt.h for details */ yasm_objfmt_module yasm_win64_LTX_objfmt = { "Win64", "win64", "obj", 64, + 1, winXX_objfmt_dbgfmt_keywords, "null", win64_objfmt_directives, + win64_objfmt_stdmacs, win64_objfmt_create, coff_objfmt_output, coff_objfmt_destroy, coff_objfmt_add_default_section, - coff_objfmt_section_switch + coff_objfmt_init_new_section, + coff_objfmt_section_switch, + win64_objfmt_get_special_sym }; yasm_objfmt_module yasm_x64_LTX_objfmt = { "Win64", "x64", "obj", 64, + 1, winXX_objfmt_dbgfmt_keywords, "null", win64_objfmt_directives, + win64_objfmt_stdmacs, win64_objfmt_create, coff_objfmt_output, coff_objfmt_destroy, coff_objfmt_add_default_section, - coff_objfmt_section_switch + coff_objfmt_init_new_section, + coff_objfmt_section_switch, + win64_objfmt_get_special_sym }; diff --git a/modules/objfmts/coff/coff-objfmt.h b/modules/objfmts/coff/coff-objfmt.h index 1360eade..10d88a09 100644 --- a/modules/objfmts/coff/coff-objfmt.h +++ b/modules/objfmts/coff/coff-objfmt.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * COFF (DJGPP) object format * * Copyright (C) 2007 Peter Johnson diff --git a/modules/objfmts/coff/tests/Makefile.inc b/modules/objfmts/coff/tests/Makefile.inc index 869d0f87..aafdfbf2 100644 --- a/modules/objfmts/coff/tests/Makefile.inc +++ b/modules/objfmts/coff/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/coff/tests/coff_test.sh EXTRA_DIST += modules/objfmts/coff/tests/coff_test.sh diff --git a/modules/objfmts/coff/tests/coff_test.sh b/modules/objfmts/coff/tests/coff_test.sh index 42f82a76..eec61beb 100755 --- a/modules/objfmts/coff/tests/coff_test.sh +++ b/modules/objfmts/coff/tests/coff_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh coff_test modules/objfmts/coff/tests "coff objfmt" "-f coff" ".o" exit $? diff --git a/modules/objfmts/coff/tests/cofftest.hex b/modules/objfmts/coff/tests/cofftest.hex index c6329775..927cf9b8 100644 --- a/modules/objfmts/coff/tests/cofftest.hex +++ b/modules/objfmts/coff/tests/cofftest.hex @@ -66,11 +66,11 @@ c9 00 00 00 -3d 00 00 00 -3d +00 +00 00 00 00 @@ -106,11 +106,11 @@ c9 00 00 00 -7d 00 00 00 -7d +00 +00 00 00 00 @@ -156,13 +156,13 @@ ec 5d c3 a1 -7d +00 00 00 00 40 a3 -81 +04 00 00 00 @@ -173,7 +173,7 @@ ff 00 00 a1 -71 +34 00 00 00 @@ -181,12 +181,12 @@ ff 30 ff 35 -7d +00 00 00 00 68 -4a +0d 00 00 00 @@ -321,7 +321,7 @@ c3 64 0a 00 -81 +04 00 00 00 @@ -329,11 +329,11 @@ c3 00 00 00 -79 +3c 00 00 00 -71 +34 00 00 00 @@ -343,7 +343,7 @@ c3 00 06 00 -75 +38 00 00 00 @@ -353,7 +353,7 @@ c3 00 06 00 -79 +3c 00 00 00 @@ -479,7 +479,7 @@ ff 74 72 00 -3d +00 00 00 00 @@ -497,7 +497,7 @@ ff 70 74 72 -75 +38 00 00 00 @@ -515,7 +515,7 @@ ff 70 74 72 -79 +3c 00 00 00 @@ -533,7 +533,7 @@ ff 67 65 72 -7d +00 00 00 00 @@ -587,7 +587,7 @@ ff 00 00 00 -3d +00 00 00 00 @@ -623,7 +623,7 @@ ff 00 00 00 -7d +00 00 00 00 diff --git a/modules/objfmts/coff/tests/cofftimes.hex b/modules/objfmts/coff/tests/cofftimes.hex index 40cf2be1..e6779362 100644 --- a/modules/objfmts/coff/tests/cofftimes.hex +++ b/modules/objfmts/coff/tests/cofftimes.hex @@ -66,11 +66,11 @@ b4 00 00 00 -04 00 00 00 -04 +00 +00 00 00 00 @@ -106,11 +106,11 @@ b8 00 00 00 -08 00 00 00 -08 +00 +00 00 00 00 @@ -146,11 +146,11 @@ bc 00 00 00 -2a 00 00 00 -2a +00 +00 00 00 00 @@ -364,7 +364,7 @@ ff 00 00 00 -04 +00 00 00 00 @@ -400,7 +400,7 @@ ff 00 00 00 -08 +00 00 00 00 @@ -436,7 +436,7 @@ ff 00 00 00 -2a +00 00 00 00 diff --git a/modules/objfmts/coff/tests/x86id.hex b/modules/objfmts/coff/tests/x86id.hex index b75ec02a..5d0af134 100644 --- a/modules/objfmts/coff/tests/x86id.hex +++ b/modules/objfmts/coff/tests/x86id.hex @@ -66,12 +66,12 @@ d4 00 00 00 -e9 -d3 00 00 -e9 -d3 +00 +00 +00 +00 00 00 04 @@ -106,12 +106,12 @@ f4 74 61 00 -ed -d3 00 00 -ed -d3 +00 +00 +00 +00 00 00 24 @@ -185,9 +185,9 @@ c8 ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 07 @@ -195,9 +195,9 @@ ec 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -331,9 +331,9 @@ ff 75 18 68 -c4 -08 -01 +d7 +34 +00 00 e8 36 @@ -495,9 +495,9 @@ e8 05 8a 80 -85 -08 -01 +98 +34 +00 00 88 45 @@ -547,8 +547,8 @@ f6 00 8b 3d -e9 -d3 +00 +00 00 00 89 @@ -950,8 +950,8 @@ fc d0 23 05 -e9 -d3 +00 +00 00 00 39 @@ -1050,9 +1050,9 @@ f8 ff 24 85 -51 -0a -01 +64 +36 +00 00 83 7f @@ -1860,9 +1860,9 @@ eb ec 04 68 -ed -08 -01 +00 +35 +00 00 68 39 @@ -1870,9 +1870,9 @@ ed 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -1911,9 +1911,9 @@ e8 8b 34 85 -cd -08 -01 +e0 +34 +00 00 83 7f @@ -2090,9 +2090,9 @@ eb ec 04 68 -02 -09 -01 +15 +35 +00 00 68 6b @@ -2100,9 +2100,9 @@ ec 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -2258,9 +2258,9 @@ eb ec 08 68 -1f -09 -01 +32 +35 +00 00 eb 08 @@ -2268,9 +2268,9 @@ eb ec 08 68 -39 -09 -01 +4c +35 +00 00 ff 75 @@ -2289,9 +2289,9 @@ d0 ec 04 68 -6d -09 -01 +80 +35 +00 00 68 8a @@ -2299,9 +2299,9 @@ ec 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -2318,9 +2318,9 @@ b3 ec 04 68 -6d -09 -01 +80 +35 +00 00 68 91 @@ -2336,9 +2336,9 @@ e9 ec 04 68 -8d -09 -01 +a0 +35 +00 00 68 95 @@ -2346,9 +2346,9 @@ ec 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -2964,9 +2964,9 @@ eb ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 e9 @@ -2974,9 +2974,9 @@ e9 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -3047,9 +3047,9 @@ e8 ff 34 85 -cd -08 -01 +e0 +34 +00 00 ff 77 @@ -3097,9 +3097,9 @@ e8 8a 04 85 -cd -08 -01 +e0 +34 +00 00 88 45 @@ -3113,9 +3113,9 @@ cf ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 fd @@ -3157,9 +3157,9 @@ e8 8a 04 85 -cd -08 -01 +e0 +34 +00 00 88 45 @@ -3177,9 +3177,9 @@ e9 ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 06 @@ -3261,9 +3261,9 @@ c0 ec 08 68 -cd -09 -01 +e0 +35 +00 00 ff 75 @@ -3282,9 +3282,9 @@ f2 ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 14 @@ -3356,9 +3356,9 @@ dc ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 22 @@ -3394,9 +3394,9 @@ b6 ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 29 @@ -3484,9 +3484,9 @@ c0 ec 08 68 -cd -09 -01 +e0 +35 +00 00 ff 75 @@ -3534,9 +3534,9 @@ e9 ec 04 68 -8d -08 -01 +a0 +34 +00 00 68 3a @@ -3549,9 +3549,9 @@ eb ec 04 68 -f8 -09 -01 +0b +36 +00 00 68 3d @@ -3559,9 +3559,9 @@ f8 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -3629,9 +3629,9 @@ eb ec 04 68 -2d -0a -01 +40 +36 +00 00 68 4b @@ -3639,9 +3639,9 @@ ec 00 00 68 -a8 -08 -01 +bb +34 +00 00 ff 15 @@ -3722,9 +3722,9 @@ f8 ff 24 85 -cd -0a -01 +e0 +36 +00 00 42 8a @@ -4523,9 +4523,9 @@ f7 42 52 68 -ad -0a -01 +c0 +36 +00 00 53 6a @@ -4587,8 +4587,8 @@ bf b6 81 0d -e9 -d3 +00 +00 00 00 00 @@ -4651,8 +4651,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -4693,8 +4693,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -4727,9 +4727,9 @@ ff ff 24 85 -ad -0c -01 +c0 +38 +00 00 42 8a @@ -5015,8 +5015,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5091,8 +5091,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5200,8 +5200,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5225,8 +5225,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5267,8 +5267,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5343,8 +5343,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5419,8 +5419,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5486,8 +5486,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5511,8 +5511,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5536,8 +5536,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5578,8 +5578,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5620,8 +5620,8 @@ ff ff 81 25 -e9 -d3 +00 +00 00 00 ff @@ -5662,8 +5662,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -5790,8 +5790,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 3f @@ -5815,8 +5815,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -5964,8 +5964,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -5989,8 +5989,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -6014,8 +6014,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -6233,8 +6233,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 3f @@ -6281,8 +6281,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -6459,8 +6459,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 ff @@ -6484,8 +6484,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 3f @@ -6592,8 +6592,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 7f @@ -6629,8 +6629,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 3f @@ -6654,8 +6654,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 3f @@ -6679,8 +6679,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 1f @@ -6814,8 +6814,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -6839,8 +6839,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -7252,8 +7252,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 0f @@ -7341,8 +7341,8 @@ ff ff 81 0d -e9 -d3 +00 +00 00 00 00 @@ -7366,8 +7366,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 07 @@ -7403,8 +7403,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 03 @@ -7440,8 +7440,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 01 @@ -7577,8 +7577,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 ff @@ -7689,8 +7689,8 @@ ff ff c7 05 -e9 -d3 +00 +00 00 00 00 @@ -7737,9 +7737,9 @@ f8 ff 24 85 -ed -0e -01 +00 +3b +00 00 41 8a @@ -7826,9 +7826,9 @@ e2 ff 24 85 -d1 -10 -01 +e4 +3c +00 00 41 8a @@ -7851,9 +7851,9 @@ c9 ff 24 85 -b5 -11 -01 +c8 +3d +00 00 41 8a @@ -8051,9 +8051,9 @@ f8 ff 24 85 -d5 -12 -01 +e8 +3e +00 00 41 8a @@ -8076,9 +8076,9 @@ e8 ff 24 85 -f5 -13 -01 +08 +40 +00 00 41 8a @@ -8101,9 +8101,9 @@ cf ff 24 85 -c5 -14 -01 +d8 +40 +00 00 41 8a @@ -8126,9 +8126,9 @@ b6 ff 24 85 -d1 -15 -01 +e4 +41 +00 00 41 8a @@ -8151,9 +8151,9 @@ f8 ff 24 85 -b1 -16 -01 +c4 +42 +00 00 41 8a @@ -8176,9 +8176,9 @@ f8 ff 24 85 -91 -17 -01 +a4 +43 +00 00 41 8a @@ -8201,9 +8201,9 @@ f8 ff 24 85 -65 -18 -01 +78 +44 +00 00 41 8a @@ -8226,9 +8226,9 @@ f8 ff 24 85 -21 -19 -01 +34 +45 +00 00 41 8a @@ -8251,9 +8251,9 @@ f8 ff 24 85 -ed -19 -01 +00 +46 +00 00 41 8a @@ -8302,9 +8302,9 @@ f8 ff 24 85 -b1 -1a -01 +c4 +46 +00 00 41 8a @@ -8327,9 +8327,9 @@ ed ff 24 85 -91 -1b -01 +a4 +47 +00 00 41 8a @@ -8352,9 +8352,9 @@ d4 ff 24 85 -55 -1c -01 +68 +48 +00 00 41 8a @@ -8844,9 +8844,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -8872,9 +8872,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -8950,9 +8950,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -8978,9 +8978,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -9023,9 +9023,9 @@ ff ff c7 07 -8d -07 -01 +a0 +33 +00 00 c7 47 @@ -9051,8 +9051,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -9079,8 +9079,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -9207,9 +9207,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -9235,9 +9235,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -9417,8 +9417,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -9462,8 +9462,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -9541,8 +9541,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -9586,8 +9586,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -9681,8 +9681,8 @@ ff ff c7 07 -3d -f7 +50 +23 00 00 c7 @@ -9709,8 +9709,8 @@ ff ff c7 07 -3d -f7 +50 +23 00 00 c7 @@ -9754,8 +9754,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -10088,9 +10088,9 @@ ff ff 24 85 -3d -1d -01 +50 +49 +00 00 41 80 @@ -10104,8 +10104,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10226,8 +10226,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10254,8 +10254,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10329,8 +10329,8 @@ a9 00 c7 07 -ed -f3 +00 +20 00 00 c7 @@ -10357,8 +10357,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10385,8 +10385,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10501,8 +10501,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10529,8 +10529,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10557,8 +10557,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10658,8 +10658,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10686,8 +10686,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10714,8 +10714,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10742,8 +10742,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10770,8 +10770,8 @@ ff ff c7 07 -4d -f0 +60 +1c 00 00 e9 @@ -10791,8 +10791,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10819,8 +10819,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10881,8 +10881,8 @@ ff ff c7 07 -ed -f3 +00 +20 00 00 c7 @@ -10926,8 +10926,8 @@ ff ff c7 07 -ed -f3 +00 +20 00 00 c7 @@ -10954,8 +10954,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -10982,8 +10982,8 @@ ff ff c7 07 -0d -f3 +20 +1f 00 00 c7 @@ -11192,8 +11192,8 @@ ff ff c7 07 -8d -e1 +a0 +0d 00 00 e9 @@ -11311,8 +11311,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11339,8 +11339,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11367,8 +11367,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11408,8 +11408,8 @@ a5 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11436,8 +11436,8 @@ ff ff c7 07 -8d -e6 +a0 +12 00 00 c7 @@ -11616,8 +11616,8 @@ ff ff c7 07 -41 -f6 +54 +22 00 00 c7 @@ -11694,8 +11694,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -11753,8 +11753,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -11814,8 +11814,8 @@ a5 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11842,8 +11842,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11870,8 +11870,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11898,8 +11898,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11926,8 +11926,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -11971,8 +11971,8 @@ ff ff c7 07 -4d -ea +60 +16 00 00 c7 @@ -12016,8 +12016,8 @@ ff ff c7 07 -4d -e7 +60 +13 00 00 c7 @@ -12061,9 +12061,9 @@ ff ff c7 07 -4d -07 -01 +60 +33 +00 00 e9 87 @@ -12290,9 +12290,9 @@ ff ff 24 85 -25 -1e -01 +38 +4a +00 00 41 8a @@ -12608,9 +12608,9 @@ ff ff 24 85 -2d -1f -01 +40 +4b +00 00 41 8a @@ -12708,9 +12708,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13142,9 +13142,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13187,9 +13187,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -13215,9 +13215,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13243,9 +13243,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13350,9 +13350,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13395,9 +13395,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -13423,9 +13423,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13451,9 +13451,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -13541,8 +13541,8 @@ ff ff c7 07 -6d -da +80 +06 00 00 c7 @@ -13651,8 +13651,8 @@ f5 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -13743,8 +13743,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -13771,8 +13771,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -13812,8 +13812,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -13840,8 +13840,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -13881,8 +13881,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -13922,8 +13922,8 @@ e6 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -14161,9 +14161,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -14292,9 +14292,9 @@ ff ff c7 07 -89 -01 -01 +9c +2d +00 00 c7 47 @@ -14356,9 +14356,9 @@ ff ff c7 07 -45 -04 -01 +58 +30 +00 00 e9 66 @@ -14377,9 +14377,9 @@ ff ff c7 07 -89 -01 -01 +9c +2d +00 00 c7 47 @@ -14405,9 +14405,9 @@ ff ff c7 07 -89 -01 -01 +9c +2d +00 00 c7 47 @@ -14467,9 +14467,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14504,9 +14504,9 @@ ff ff 24 85 -09 -20 -01 +1c +4c +00 00 41 80 @@ -14520,9 +14520,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14548,9 +14548,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14576,9 +14576,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14604,9 +14604,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14782,9 +14782,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14810,9 +14810,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14838,9 +14838,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14884,9 +14884,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -14912,9 +14912,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -15067,9 +15067,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15118,9 +15118,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15146,9 +15146,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15174,9 +15174,9 @@ ff ff c7 07 -7d -06 -01 +90 +32 +00 00 c7 47 @@ -15202,9 +15202,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15230,9 +15230,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15321,9 +15321,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15372,9 +15372,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15400,9 +15400,9 @@ ff ff c7 07 -8d +a0 +2c 00 -01 00 c7 47 @@ -15428,9 +15428,9 @@ ff ff c7 07 -7d -06 -01 +90 +32 +00 00 c7 47 @@ -15605,8 +15605,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -15691,8 +15691,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -15719,8 +15719,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -15747,8 +15747,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -15775,8 +15775,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -15820,8 +15820,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -15910,8 +15910,8 @@ ff ff c7 07 -8d -dd +a0 +09 00 00 c7 @@ -15938,9 +15938,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -16048,8 +16048,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16140,8 +16140,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16168,8 +16168,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16196,8 +16196,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16237,8 +16237,8 @@ e6 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16278,8 +16278,8 @@ b2 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16319,8 +16319,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -16709,9 +16709,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -16754,9 +16754,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -16799,9 +16799,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -16861,9 +16861,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -16957,9 +16957,9 @@ ff ff c7 07 -0d -04 -01 +20 +30 +00 00 c7 47 @@ -17070,9 +17070,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17098,9 +17098,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17333,9 +17333,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17361,9 +17361,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17464,9 +17464,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17492,9 +17492,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17587,9 +17587,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -17615,9 +17615,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -17643,9 +17643,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -17834,9 +17834,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17862,9 +17862,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -17890,9 +17890,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -17952,9 +17952,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -18031,9 +18031,9 @@ ff ff c7 07 -d1 -06 -01 +e4 +32 +00 00 c7 47 @@ -18152,9 +18152,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18180,9 +18180,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18242,9 +18242,9 @@ ff ff c7 07 -8d -03 -01 +a0 +2f +00 00 c7 47 @@ -18638,9 +18638,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18666,9 +18666,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18822,9 +18822,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18862,9 +18862,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18913,9 +18913,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -18985,9 +18985,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19013,9 +19013,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19092,9 +19092,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19154,9 +19154,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19235,9 +19235,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19263,9 +19263,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19291,9 +19291,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19454,9 +19454,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19482,9 +19482,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19510,9 +19510,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19573,9 +19573,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19601,9 +19601,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19679,9 +19679,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19707,9 +19707,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -19793,9 +19793,9 @@ ff ff c7 07 -4d -03 -01 +60 +2f +00 00 c7 47 @@ -19889,9 +19889,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -20200,9 +20200,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20228,9 +20228,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20290,9 +20290,9 @@ ff ff c7 07 -99 -06 -01 +ac +32 +00 00 c7 47 @@ -20318,9 +20318,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -20369,9 +20369,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20397,9 +20397,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20434,9 +20434,9 @@ ff ff 24 85 -e1 -20 -01 +f4 +4c +00 00 41 80 @@ -20450,9 +20450,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20478,9 +20478,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20506,9 +20506,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20534,9 +20534,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20712,9 +20712,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20740,9 +20740,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20768,9 +20768,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20814,9 +20814,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -20842,9 +20842,9 @@ ff ff c7 07 -b5 -06 -01 +c8 +32 +00 00 c7 47 @@ -21116,9 +21116,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21144,9 +21144,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21172,9 +21172,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21265,9 +21265,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21293,9 +21293,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21321,9 +21321,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21418,9 +21418,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21531,9 +21531,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21559,9 +21559,9 @@ ff ff c7 07 -4d +60 +2c 00 -01 00 c7 47 @@ -21604,8 +21604,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -21919,8 +21919,8 @@ ff ff c7 07 -2d -f5 +40 +21 00 00 c7 @@ -21968,8 +21968,8 @@ ff ff c7 07 -2d -f5 +40 +21 00 00 c7 @@ -21996,8 +21996,8 @@ ff ff c7 07 -2d -f5 +40 +21 00 00 c7 @@ -22024,8 +22024,8 @@ ff ff c7 07 -2d -f5 +40 +21 00 00 c7 @@ -22052,8 +22052,8 @@ ff ff c7 07 -ed -f5 +00 +22 00 00 c7 @@ -22080,8 +22080,8 @@ ff ff c7 07 -ed -f5 +00 +22 00 00 c7 @@ -22142,8 +22142,8 @@ ff ff c7 07 -0d -fd +20 +29 00 00 c7 @@ -22251,8 +22251,8 @@ ff 00 c7 07 -6d -f6 +80 +22 00 00 c7 @@ -22575,9 +22575,9 @@ ff 11 53 68 -cd -0d -01 +e0 +39 +00 00 56 6a @@ -22689,8 +22689,8 @@ ff ff c7 07 -e5 -f2 +f8 +1e 00 00 c7 @@ -22734,8 +22734,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -23058,8 +23058,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -23135,9 +23135,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -23163,9 +23163,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -23364,8 +23364,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -23420,8 +23420,8 @@ ff ff c7 07 -ed -df +00 +0c 00 00 c7 @@ -23465,9 +23465,9 @@ ff ff c7 07 -4d -08 -01 +60 +34 +00 00 c7 47 @@ -23517,8 +23517,8 @@ ff ff c7 07 -4d -fd +60 +29 00 00 c7 @@ -23785,8 +23785,8 @@ ff ff c7 07 -4d -e7 +60 +13 00 00 c7 @@ -23922,9 +23922,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -23950,9 +23950,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -23978,9 +23978,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -24006,9 +24006,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -24345,8 +24345,8 @@ ff ff c7 07 -ad -d4 +c0 +00 00 00 c7 @@ -24429,8 +24429,8 @@ ff ff c7 07 -cd -fe +e0 +2a 00 00 c7 @@ -24648,8 +24648,8 @@ ff ff c7 07 -ad -ff +c0 +2b 00 00 c7 @@ -24692,9 +24692,9 @@ ff ff 24 85 -b9 -21 -01 +cc +4d +00 00 41 8a @@ -24743,8 +24743,8 @@ ff ff c7 07 -ad -d9 +c0 +05 00 00 c7 @@ -24821,9 +24821,9 @@ ff ff c7 07 -ad -04 -01 +c0 +30 +00 00 c7 47 @@ -24849,9 +24849,9 @@ ff ff c7 07 -ed -01 -01 +00 +2e +00 00 c7 47 @@ -24907,8 +24907,8 @@ ff ff c7 07 -ad -d9 +c0 +05 00 00 c7 @@ -24935,8 +24935,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -24963,8 +24963,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -24991,9 +24991,9 @@ ff ff c7 07 -6d -05 -01 +80 +31 +00 00 c7 47 @@ -25032,8 +25032,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -25060,9 +25060,9 @@ ff ff c7 07 -ed -02 -01 +00 +2f +00 00 c7 47 @@ -25101,8 +25101,8 @@ ff 00 c7 07 -39 -da +4c +06 00 00 c7 @@ -25163,9 +25163,9 @@ ff ff c7 07 -61 -06 -01 +74 +32 +00 00 e9 63 @@ -25303,8 +25303,8 @@ ff ff c7 07 -6d -fe +80 +2a 00 00 c7 @@ -25388,9 +25388,9 @@ ff ff c7 07 -bd -02 -01 +d0 +2e +00 00 e9 94 @@ -25409,9 +25409,9 @@ ff ff c7 07 -a1 -02 -01 +b4 +2e +00 00 e9 7f @@ -25430,9 +25430,9 @@ ff ff c7 07 -41 -05 -01 +54 +31 +00 00 c7 47 @@ -25458,9 +25458,9 @@ ff ff c7 07 -41 -05 -01 +54 +31 +00 00 c7 47 @@ -25570,9 +25570,9 @@ ff ff c7 07 -25 -05 -01 +38 +31 +00 00 e9 cc @@ -25591,9 +25591,9 @@ ff ff c7 07 -85 -02 -01 +98 +2e +00 00 e9 c9 @@ -25680,9 +25680,9 @@ ff ff c7 07 -ed -04 -01 +00 +31 +00 00 c7 47 @@ -25708,9 +25708,9 @@ ff ff c7 07 -4d -02 -01 +60 +2e +00 00 c7 47 @@ -25753,9 +25753,9 @@ ff ff c7 07 -25 -02 -01 +38 +2e +00 00 c7 47 @@ -25849,9 +25849,9 @@ ff ff c7 07 -ed -04 -01 +00 +31 +00 00 c7 47 @@ -25877,9 +25877,9 @@ ff ff c7 07 -4d -02 -01 +60 +2e +00 00 c7 47 @@ -25922,9 +25922,9 @@ ff ff c7 07 -25 -02 -01 +38 +2e +00 00 c7 47 @@ -26033,9 +26033,9 @@ ff ff c7 07 -0d -06 -01 +20 +32 +00 00 c7 47 @@ -26061,9 +26061,9 @@ ff ff c7 07 -0d -06 -01 +20 +32 +00 00 c7 47 @@ -26089,9 +26089,9 @@ ff ff c7 07 -45 -06 -01 +58 +32 +00 00 e9 c5 @@ -26160,9 +26160,9 @@ ff ff c7 07 -ad -04 -01 +c0 +30 +00 00 c7 47 @@ -26188,9 +26188,9 @@ ff ff c7 07 -ed -01 -01 +00 +2e +00 00 c7 47 @@ -26400,9 +26400,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -26428,9 +26428,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -26456,9 +26456,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -26484,9 +26484,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -26563,8 +26563,8 @@ ff ff c7 07 -41 -d4 +54 +00 00 00 c7 @@ -26776,9 +26776,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -26804,9 +26804,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -26832,9 +26832,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -26860,9 +26860,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -27007,9 +27007,9 @@ ff ff c7 07 -c1 -01 -01 +d4 +2d +00 00 c7 47 @@ -27059,9 +27059,9 @@ ff ff c7 07 -dd -05 -01 +f0 +31 +00 00 c7 47 @@ -27340,9 +27340,9 @@ ff 11 53 68 -cd -0d -01 +e0 +39 +00 00 56 6a @@ -27515,8 +27515,8 @@ ff ff c7 07 -4d -e7 +60 +13 00 00 c7 @@ -27652,9 +27652,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -27680,9 +27680,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -27708,9 +27708,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -27736,9 +27736,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -27764,8 +27764,8 @@ ff ff c7 07 -8d -e6 +a0 +12 00 00 c7 @@ -27805,8 +27805,8 @@ ab 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -27846,8 +27846,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -28483,8 +28483,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -28511,8 +28511,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -29055,9 +29055,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29117,9 +29117,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29259,9 +29259,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -29287,9 +29287,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29400,9 +29400,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29428,9 +29428,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29569,9 +29569,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29597,9 +29597,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29692,9 +29692,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29720,9 +29720,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29815,9 +29815,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -29843,9 +29843,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30035,9 +30035,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30063,9 +30063,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30091,9 +30091,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30235,9 +30235,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30263,9 +30263,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -30291,9 +30291,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -30386,9 +30386,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30414,9 +30414,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -30521,9 +30521,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30549,9 +30549,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -30657,8 +30657,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -30769,9 +30769,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -30797,9 +30797,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -30825,8 +30825,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -31073,8 +31073,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -31127,9 +31127,9 @@ ff ff 24 85 -95 -22 -01 +a8 +4e +00 00 41 80 @@ -31143,8 +31143,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31180,9 +31180,9 @@ ff ff 24 85 -7d -23 -01 +90 +4f +00 00 41 8a @@ -31284,8 +31284,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31312,8 +31312,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31516,8 +31516,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31586,8 +31586,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31654,8 +31654,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31712,8 +31712,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31770,8 +31770,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31798,8 +31798,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31826,8 +31826,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31854,8 +31854,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31882,8 +31882,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31910,8 +31910,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31938,8 +31938,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31966,8 +31966,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -31994,8 +31994,8 @@ ff ff c7 07 -ed -fd +00 +2a 00 00 c7 @@ -32275,9 +32275,9 @@ ff ff 24 85 -65 -24 -01 +78 +50 +00 00 41 8a @@ -32391,8 +32391,8 @@ ff ff c7 07 -4d -fd +60 +29 00 00 c7 @@ -32456,8 +32456,8 @@ ff ff c7 07 -bd -fd +d0 +29 00 00 c7 @@ -32496,8 +32496,8 @@ ff ff c7 07 -4d -fd +60 +29 00 00 c7 @@ -32743,9 +32743,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -32771,9 +32771,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -32799,9 +32799,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -32827,9 +32827,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 e9 fa @@ -32848,8 +32848,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -32876,8 +32876,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -32904,9 +32904,9 @@ ff ff c7 07 -6d -04 -01 +80 +30 +00 00 e9 cd @@ -32938,8 +32938,8 @@ a9 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -32966,9 +32966,9 @@ ff ff c7 07 -89 -01 -01 +9c +2d +00 00 c7 47 @@ -32994,9 +32994,9 @@ ff ff c7 07 -6d -01 -01 +80 +2d +00 00 c7 47 @@ -33022,9 +33022,9 @@ ff ff c7 07 -89 -01 -01 +9c +2d +00 00 c7 47 @@ -33228,9 +33228,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33256,9 +33256,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33284,9 +33284,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33312,9 +33312,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 c7 47 @@ -33641,9 +33641,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33669,9 +33669,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33697,9 +33697,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33725,9 +33725,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 c7 47 @@ -33864,9 +33864,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33892,9 +33892,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33920,9 +33920,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -33948,9 +33948,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 c7 47 @@ -34137,9 +34137,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34165,9 +34165,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34193,9 +34193,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34221,9 +34221,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 c7 47 @@ -34472,9 +34472,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34500,9 +34500,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34528,9 +34528,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 c7 47 @@ -34556,9 +34556,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34693,9 +34693,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34721,9 +34721,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34749,9 +34749,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 e9 98 @@ -34770,9 +34770,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34957,9 +34957,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -34985,9 +34985,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -35013,9 +35013,9 @@ ff ff c7 07 -35 -01 -01 +48 +2d +00 00 c7 47 @@ -35041,9 +35041,9 @@ ff ff c7 07 -51 -01 -01 +64 +2d +00 00 c7 47 @@ -35069,8 +35069,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35097,8 +35097,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35125,8 +35125,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35239,8 +35239,8 @@ ff ff c7 07 -a5 -fe +b8 +2a 00 00 c7 @@ -35267,8 +35267,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -35318,8 +35318,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35359,8 +35359,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35400,8 +35400,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35428,8 +35428,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -35473,8 +35473,8 @@ ff ff c7 07 -0d -ee +20 +1a 00 00 e9 @@ -35851,9 +35851,9 @@ ff ff 24 85 -3d -25 -01 +50 +51 +00 00 41 8a @@ -36030,9 +36030,9 @@ ff ff 24 85 -fd -25 -01 +10 +52 +00 00 41 80 @@ -36114,8 +36114,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -36228,9 +36228,9 @@ ff ff c7 07 -09 -07 -01 +1c +33 +00 00 c7 47 @@ -36273,9 +36273,9 @@ ff ff c7 07 -09 -07 -01 +1c +33 +00 00 c7 47 @@ -36301,9 +36301,9 @@ ff ff c7 07 -ed -06 -01 +00 +33 +00 00 e9 25 @@ -36424,9 +36424,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -36452,9 +36452,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -36480,8 +36480,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 e9 @@ -36501,8 +36501,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 e9 @@ -36711,8 +36711,8 @@ ff ff c7 07 -ad -f2 +c0 +1e 00 00 c7 @@ -36739,8 +36739,8 @@ ff ff c7 07 -ad -f2 +c0 +1e 00 00 c7 @@ -37039,8 +37039,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -37091,8 +37091,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -37136,8 +37136,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -37188,8 +37188,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -37257,8 +37257,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 e9 @@ -37278,8 +37278,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 c7 @@ -37391,9 +37391,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -37419,9 +37419,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -38448,8 +38448,8 @@ ff ff c7 07 -3d -f7 +50 +23 00 00 c7 @@ -38476,8 +38476,8 @@ ff ff c7 07 -ad -e3 +c0 +0f 00 00 c7 @@ -38504,8 +38504,8 @@ ff ff c7 07 -ed -f5 +00 +22 00 00 c7 @@ -38685,8 +38685,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -38737,8 +38737,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -38862,8 +38862,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -38890,8 +38890,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -38918,8 +38918,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -38959,8 +38959,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -39040,8 +39040,8 @@ ff ff c7 07 -2d -f4 +40 +20 00 00 c7 @@ -39068,8 +39068,8 @@ ff ff c7 07 -2d -f4 +40 +20 00 00 c7 @@ -39139,8 +39139,8 @@ ff ff c7 07 -2d -f4 +40 +20 00 00 c7 @@ -39212,8 +39212,8 @@ ff ff c7 07 -3d -f7 +50 +23 00 00 c7 @@ -39257,8 +39257,8 @@ ff ff c7 07 -3d -f7 +50 +23 00 00 c7 @@ -39309,8 +39309,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -39337,8 +39337,8 @@ ff ff c7 07 -ad -e3 +c0 +0f 00 00 c7 @@ -39382,8 +39382,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -39410,8 +39410,8 @@ ff ff c7 07 -ad -e3 +c0 +0f 00 00 c7 @@ -39489,8 +39489,8 @@ ff ff c7 07 -41 -d4 +54 +00 00 00 c7 @@ -39540,8 +39540,8 @@ ff ff c7 07 -0d -e3 +20 +0f 00 00 c7 @@ -39581,8 +39581,8 @@ ab 00 c7 07 -6d -e3 +80 +0f 00 00 c7 @@ -39626,8 +39626,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -39674,8 +39674,8 @@ ff 00 c7 07 -6d -e3 +80 +0f 00 00 c7 @@ -39770,9 +39770,9 @@ ff ff c7 07 -a5 -01 -01 +b8 +2d +00 00 c7 47 @@ -39816,8 +39816,8 @@ ff ff c7 07 -ed -f5 +00 +22 00 00 c7 @@ -39857,8 +39857,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -40239,8 +40239,8 @@ ff 00 c7 07 -a5 -f6 +b8 +22 00 00 c7 @@ -40322,8 +40322,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -40417,9 +40417,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -40445,9 +40445,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -40523,9 +40523,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -40551,9 +40551,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -40637,8 +40637,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -40665,8 +40665,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -40802,9 +40802,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -40830,9 +40830,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -40858,9 +40858,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -40886,9 +40886,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -40927,8 +40927,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -40968,8 +40968,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -41009,8 +41009,8 @@ ff 00 c7 07 -0d -ea +20 +16 00 00 c7 @@ -41050,8 +41050,8 @@ ee 00 c7 07 -0d -ea +20 +16 00 00 c7 @@ -41144,9 +41144,9 @@ ff ec 08 68 -0d -0e -01 +20 +3a +00 00 56 e8 @@ -41263,8 +41263,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -41331,8 +41331,8 @@ ff ff c7 07 -4d -e2 +60 +0e 00 00 c7 @@ -41424,8 +41424,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -41452,8 +41452,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -41480,8 +41480,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -41558,9 +41558,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -41586,9 +41586,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -41623,9 +41623,9 @@ ff 0b 53 68 -4d -0e -01 +60 +3a +00 00 e9 b7 @@ -41821,8 +41821,8 @@ ff ff c7 07 -cd -e7 +e0 +13 00 00 c7 @@ -42257,9 +42257,9 @@ ff ff 24 85 -c1 -26 -01 +d4 +52 +00 00 41 8a @@ -43091,8 +43091,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -43131,8 +43131,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -43323,8 +43323,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -43385,8 +43385,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -43464,8 +43464,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -43492,8 +43492,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -43520,8 +43520,8 @@ ff ff c7 07 -8d -f9 +a0 +25 00 00 c7 @@ -43582,8 +43582,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -43699,8 +43699,8 @@ ff ff c7 07 -8d -fa +a0 +26 00 00 c7 @@ -43750,8 +43750,8 @@ ff ff c7 07 -8d -fa +a0 +26 00 00 c7 @@ -43801,8 +43801,8 @@ ff ff c7 07 -8d -fa +a0 +26 00 00 c7 @@ -43829,8 +43829,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -43857,8 +43857,8 @@ ff ff c7 07 -8d -fa +a0 +26 00 00 c7 @@ -43902,8 +43902,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -44054,8 +44054,8 @@ ff ff c7 07 -2d -f9 +40 +25 00 00 c7 @@ -44255,8 +44255,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -44307,8 +44307,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -44369,8 +44369,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -44420,8 +44420,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -44482,8 +44482,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -44527,8 +44527,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -44610,8 +44610,8 @@ ff ff c7 07 -cd -fa +e0 +26 00 00 c7 @@ -44638,8 +44638,8 @@ ff ff c7 07 -8d -fb +a0 +27 00 00 c7 @@ -44689,8 +44689,8 @@ ff ff c7 07 -cd -fa +e0 +26 00 00 c7 @@ -44717,8 +44717,8 @@ ff ff c7 07 -8d -fb +a0 +27 00 00 c7 @@ -44789,8 +44789,8 @@ ff ff c7 07 -2d -f8 +40 +24 00 00 c7 @@ -44834,8 +44834,8 @@ ff ff c7 07 -ad -fc +c0 +28 00 00 e9 @@ -44872,8 +44872,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -44900,8 +44900,8 @@ ff ff c7 07 -41 -fc +54 +28 00 00 c7 @@ -44997,8 +44997,8 @@ ff ff c7 07 -5d -d4 +70 +00 00 00 c7 @@ -45076,8 +45076,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45189,8 +45189,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45217,8 +45217,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45279,8 +45279,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45324,8 +45324,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45477,8 +45477,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45539,8 +45539,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45728,8 +45728,8 @@ ff ff c7 07 -5d -d4 +70 +00 00 00 c7 @@ -45756,8 +45756,8 @@ ff ff c7 07 -6d -fc +80 +28 00 00 c7 @@ -45784,8 +45784,8 @@ ff ff c7 07 -25 -fc +38 +28 00 00 c7 @@ -45829,8 +45829,8 @@ ff ff c7 07 -5d -d4 +70 +00 00 00 c7 @@ -45891,8 +45891,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -45959,8 +45959,8 @@ ff ff c7 07 -cd -fa +e0 +26 00 00 c7 @@ -45987,8 +45987,8 @@ ff ff c7 07 -8d -fb +a0 +27 00 00 c7 @@ -46179,8 +46179,8 @@ ff ff c7 07 -2d -f8 +40 +24 00 00 c7 @@ -46207,8 +46207,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46388,8 +46388,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46416,8 +46416,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46522,8 +46522,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46550,8 +46550,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46578,8 +46578,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46606,8 +46606,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -46651,8 +46651,8 @@ ff ff c7 07 -5d -d4 +70 +00 00 00 c7 @@ -46679,8 +46679,8 @@ ff ff c7 07 -25 -fc +38 +28 00 00 c7 @@ -46985,8 +46985,8 @@ ff ff c7 07 -41 -d4 +54 +00 00 00 c7 @@ -47047,8 +47047,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -47115,8 +47115,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47143,8 +47143,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47188,8 +47188,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47233,8 +47233,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47301,8 +47301,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47329,8 +47329,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47380,8 +47380,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47448,8 +47448,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47476,8 +47476,8 @@ ff ff c7 07 -ed -fb +00 +28 00 00 c7 @@ -47504,8 +47504,8 @@ ff ff c7 07 -ad -f8 +c0 +24 00 00 c7 @@ -47532,8 +47532,8 @@ ff ff c7 07 -ad -f8 +c0 +24 00 00 c7 @@ -47617,8 +47617,8 @@ ff ff c7 07 -e5 -fc +f8 +28 00 00 c7 @@ -47645,8 +47645,8 @@ ff ff c7 07 -e5 -fc +f8 +28 00 00 c7 @@ -47714,8 +47714,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -47835,8 +47835,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -47918,8 +47918,8 @@ ff ff c7 07 -cd -fa +e0 +26 00 00 c7 @@ -47946,8 +47946,8 @@ ff ff c7 07 -8d -fb +a0 +27 00 00 c7 @@ -47997,8 +47997,8 @@ ff ff c7 07 -cd -fa +e0 +26 00 00 c7 @@ -48025,8 +48025,8 @@ ff ff c7 07 -8d -fb +a0 +27 00 00 c7 @@ -48330,8 +48330,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48358,8 +48358,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48436,8 +48436,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48487,8 +48487,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48515,8 +48515,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48543,8 +48543,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48571,8 +48571,8 @@ ff ff c7 07 -41 -fe +54 +2a 00 00 c7 @@ -48616,8 +48616,8 @@ ff ff c7 07 -41 -d4 +54 +00 00 00 c7 @@ -48644,8 +48644,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -48731,8 +48731,8 @@ ff ff c7 07 -0d -fa +20 +26 00 00 c7 @@ -48759,8 +48759,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -48817,8 +48817,8 @@ ff ff c7 07 -0d -fa +20 +26 00 00 c7 @@ -48868,8 +48868,8 @@ ff ff c7 07 -8d -fa +a0 +26 00 00 c7 @@ -48893,8 +48893,8 @@ ff ff c7 07 -8d -fa +a0 +26 00 00 c7 @@ -48928,8 +48928,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -49008,8 +49008,8 @@ ff ff c7 07 -01 -f9 +14 +25 00 00 c7 @@ -49036,8 +49036,8 @@ ff ff c7 07 -01 -f9 +14 +25 00 00 c7 @@ -49120,8 +49120,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -49168,8 +49168,8 @@ ff ff c7 07 -cd -fa +e0 +26 00 00 c7 @@ -49193,8 +49193,8 @@ ff ff c7 07 -8d -fb +a0 +27 00 00 c7 @@ -49247,8 +49247,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -49504,9 +49504,9 @@ ff ff 24 85 -8d -27 -01 +a0 +53 +00 00 41 8a @@ -49786,9 +49786,9 @@ ff 11 53 68 -cd -0d -01 +e0 +39 +00 00 56 6a @@ -49838,9 +49838,9 @@ ff ff 24 85 -35 -28 -01 +48 +54 +00 00 41 8a @@ -50181,8 +50181,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -50281,8 +50281,8 @@ df 00 c7 07 -25 -d4 +38 +00 00 00 c7 @@ -50363,8 +50363,8 @@ ff 00 c7 07 -25 -d4 +38 +00 00 00 c7 @@ -50432,8 +50432,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -50531,8 +50531,8 @@ f0 00 c7 07 -41 -d4 +54 +00 00 00 c7 @@ -50612,9 +50612,9 @@ ff ff c7 07 -09 -07 -01 +1c +33 +00 00 c7 47 @@ -50654,9 +50654,9 @@ ff ff c7 07 -09 -07 -01 +1c +33 +00 00 c7 47 @@ -50679,9 +50679,9 @@ ff ff c7 07 -25 -07 -01 +38 +33 +00 00 c7 47 @@ -50769,8 +50769,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -50906,9 +50906,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -50934,9 +50934,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -50962,9 +50962,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -50990,9 +50990,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -51045,8 +51045,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51073,8 +51073,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51101,8 +51101,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51155,8 +51155,8 @@ ff ff c7 07 -cd -f6 +e0 +22 00 00 c7 @@ -51258,9 +51258,9 @@ ff ff c7 07 -a5 -01 -01 +b8 +2d +00 00 c7 47 @@ -51376,8 +51376,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51404,8 +51404,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51432,8 +51432,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51473,8 +51473,8 @@ ff 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51679,9 +51679,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -51707,9 +51707,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -51735,9 +51735,9 @@ ff ff c7 07 -19 -01 -01 +2c +2d +00 00 c7 47 @@ -51763,9 +51763,9 @@ ff ff c7 07 -fd +10 +2d 00 -01 00 c7 47 @@ -51874,8 +51874,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -51949,8 +51949,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -52018,8 +52018,8 @@ ff ff c7 07 -25 -d4 +38 +00 00 00 c7 @@ -52053,8 +52053,8 @@ ff ff c7 07 -6d -f7 +80 +23 00 00 c7 @@ -52095,8 +52095,8 @@ ff ff c7 07 -6d -f7 +80 +23 00 00 c7 @@ -52139,9 +52139,9 @@ ff 0b 53 68 -6d -0e -01 +80 +3a +00 00 e9 a3 @@ -52193,8 +52193,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -52321,8 +52321,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 c7 @@ -52433,9 +52433,9 @@ ff ff c7 07 -89 -01 -01 +9c +2d +00 00 c7 47 @@ -52468,9 +52468,9 @@ ff ff c7 07 -6d -01 -01 +80 +2d +00 00 c7 47 @@ -52503,8 +52503,8 @@ ff ff c7 07 -4d -ed +60 +19 00 00 c7 @@ -52531,8 +52531,8 @@ ff ff c7 07 -4d -ed +60 +19 00 00 c7 @@ -52614,8 +52614,8 @@ ff ff c7 07 -79 -d4 +8c +00 00 00 c7 @@ -52700,8 +52700,8 @@ ff ff c7 07 -41 -d4 +54 +00 00 00 c7 @@ -52744,9 +52744,9 @@ ff ff 24 85 -41 -29 -01 +54 +55 +00 00 41 8a @@ -52945,9 +52945,9 @@ ff ff 24 85 -29 -2a -01 +3c +56 +00 00 41 80 @@ -52961,8 +52961,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53055,8 +53055,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53083,8 +53083,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53111,8 +53111,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53139,8 +53139,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53255,8 +53255,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53283,8 +53283,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53311,8 +53311,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53412,8 +53412,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53440,8 +53440,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53468,8 +53468,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53496,8 +53496,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53524,8 +53524,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53552,8 +53552,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53580,8 +53580,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53608,8 +53608,8 @@ ff ff c7 07 -0d -f5 +20 +21 00 00 c7 @@ -53743,8 +53743,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -53771,8 +53771,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -53799,8 +53799,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -53843,9 +53843,9 @@ ff 18 53 68 -ad -0e -01 +c0 +3a +00 00 56 6a @@ -53867,8 +53867,8 @@ e9 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -53902,8 +53902,8 @@ ff ff c7 07 -ed -e3 +00 +10 00 00 c7 @@ -53979,8 +53979,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 c7 @@ -54007,8 +54007,8 @@ ff ff c7 07 -6d -ec +80 +18 00 00 c7 @@ -54044,8 +54044,8 @@ ff 2c c7 07 -09 -d4 +1c +00 00 00 c7 @@ -54091,9 +54091,9 @@ ec 04 53 68 -d2 -0e -01 +e5 +3a +00 00 56 e8 @@ -54103,8 +54103,8 @@ ff ff c7 07 -ed -d3 +00 +00 00 00 c7 @@ -54131,8 +54131,8 @@ de 00 c7 07 -09 -d4 +1c +00 00 00 c7 @@ -54265,8 +54265,8 @@ ff ff c7 07 -4d -e7 +60 +13 00 00 c7 @@ -54290,8 +54290,8 @@ ff ff c7 07 -09 -d4 +1c +00 00 00 c7 @@ -54333,8 +54333,8 @@ ff ff c7 07 -4d -e7 +60 +13 00 00 c7 @@ -84829,9 +84829,9 @@ e7 cf 00 00 -51 -0a -01 +64 +36 +00 00 02 00 @@ -84839,9 +84839,9 @@ cf 00 06 00 -55 -0a -01 +68 +36 +00 00 02 00 @@ -84849,9 +84849,9 @@ cf 00 06 00 -59 -0a -01 +6c +36 +00 00 02 00 @@ -84859,9 +84859,9 @@ cf 00 06 00 -5d -0a -01 +70 +36 +00 00 02 00 @@ -84869,9 +84869,9 @@ cf 00 06 00 -61 -0a -01 +74 +36 +00 00 02 00 @@ -84879,9 +84879,9 @@ cf 00 06 00 -65 -0a -01 +78 +36 +00 00 02 00 @@ -84889,9 +84889,9 @@ cf 00 06 00 -69 -0a -01 +7c +36 +00 00 02 00 @@ -84899,9 +84899,9 @@ cf 00 06 00 -6d -0a -01 +80 +36 +00 00 02 00 @@ -84909,9 +84909,9 @@ cf 00 06 00 -71 -0a -01 +84 +36 +00 00 02 00 @@ -84919,9 +84919,9 @@ cf 00 06 00 -75 -0a -01 +88 +36 +00 00 02 00 @@ -84929,9 +84929,9 @@ cf 00 06 00 -79 -0a -01 +8c +36 +00 00 02 00 @@ -84939,9 +84939,9 @@ cf 00 06 00 -7d -0a -01 +90 +36 +00 00 02 00 @@ -84949,9 +84949,9 @@ cf 00 06 00 -81 -0a -01 +94 +36 +00 00 02 00 @@ -84959,9 +84959,9 @@ cf 00 06 00 -85 -0a -01 +98 +36 +00 00 02 00 @@ -84969,9 +84969,9 @@ cf 00 06 00 -89 -0a -01 +9c +36 +00 00 02 00 @@ -84979,9 +84979,9 @@ cf 00 06 00 -8d -0a -01 +a0 +36 +00 00 02 00 @@ -84989,9 +84989,9 @@ cf 00 06 00 -91 -0a -01 +a4 +36 +00 00 02 00 @@ -84999,9 +84999,9 @@ cf 00 06 00 -95 -0a -01 +a8 +36 +00 00 02 00 @@ -85009,9 +85009,9 @@ cf 00 06 00 -99 -0a -01 +ac +36 +00 00 02 00 @@ -85019,9 +85019,9 @@ cf 00 06 00 -9d -0a -01 +b0 +36 +00 00 02 00 @@ -85029,9 +85029,9 @@ cf 00 06 00 -a1 -0a -01 +b4 +36 +00 00 02 00 @@ -85039,9 +85039,9 @@ a1 00 06 00 -a5 -0a -01 +b8 +36 +00 00 02 00 @@ -85049,9 +85049,9 @@ a5 00 06 00 -cd -0a -01 +e0 +36 +00 00 02 00 @@ -85059,9 +85059,9 @@ cd 00 06 00 -d1 -0a -01 +e4 +36 +00 00 02 00 @@ -85069,9 +85069,9 @@ d1 00 06 00 -d5 -0a -01 +e8 +36 +00 00 02 00 @@ -85079,9 +85079,9 @@ d5 00 06 00 -d9 -0a -01 +ec +36 +00 00 02 00 @@ -85089,9 +85089,9 @@ d9 00 06 00 -dd -0a -01 +f0 +36 +00 00 02 00 @@ -85099,9 +85099,9 @@ dd 00 06 00 -e1 -0a -01 +f4 +36 +00 00 02 00 @@ -85109,9 +85109,9 @@ e1 00 06 00 -e5 -0a -01 +f8 +36 +00 00 02 00 @@ -85119,9 +85119,9 @@ e5 00 06 00 -e9 -0a -01 +fc +36 +00 00 02 00 @@ -85129,9 +85129,9 @@ e9 00 06 00 -ed -0a -01 +00 +37 +00 00 02 00 @@ -85139,9 +85139,9 @@ ed 00 06 00 -f1 -0a -01 +04 +37 +00 00 02 00 @@ -85149,9 +85149,9 @@ f1 00 06 00 -f5 -0a -01 +08 +37 +00 00 02 00 @@ -85159,9 +85159,9 @@ f5 00 06 00 -f9 -0a -01 +0c +37 +00 00 02 00 @@ -85169,9 +85169,9 @@ f9 00 06 00 -fd -0a -01 +10 +37 +00 00 02 00 @@ -85179,9 +85179,9 @@ fd 00 06 00 -01 -0b -01 +14 +37 +00 00 02 00 @@ -85189,9 +85189,9 @@ fd 00 06 00 -05 -0b -01 +18 +37 +00 00 02 00 @@ -85199,9 +85199,9 @@ fd 00 06 00 -09 -0b -01 +1c +37 +00 00 02 00 @@ -85209,9 +85209,9 @@ fd 00 06 00 -0d -0b -01 +20 +37 +00 00 02 00 @@ -85219,9 +85219,9 @@ fd 00 06 00 -11 -0b -01 +24 +37 +00 00 02 00 @@ -85229,9 +85229,9 @@ fd 00 06 00 -15 -0b -01 +28 +37 +00 00 02 00 @@ -85239,9 +85239,9 @@ fd 00 06 00 -19 -0b -01 +2c +37 +00 00 02 00 @@ -85249,9 +85249,9 @@ fd 00 06 00 -1d -0b -01 +30 +37 +00 00 02 00 @@ -85259,9 +85259,9 @@ fd 00 06 00 -21 -0b -01 +34 +37 +00 00 02 00 @@ -85269,9 +85269,9 @@ fd 00 06 00 -25 -0b -01 +38 +37 +00 00 02 00 @@ -85279,9 +85279,9 @@ fd 00 06 00 -29 -0b -01 +3c +37 +00 00 02 00 @@ -85289,9 +85289,9 @@ fd 00 06 00 -2d -0b -01 +40 +37 +00 00 02 00 @@ -85299,9 +85299,9 @@ fd 00 06 00 -31 -0b -01 +44 +37 +00 00 02 00 @@ -85309,9 +85309,9 @@ fd 00 06 00 -35 -0b -01 +48 +37 +00 00 02 00 @@ -85319,639 +85319,1099 @@ fd 00 06 00 +4c +37 +00 +00 +02 +00 +00 +00 +06 +00 +50 +37 +00 +00 +02 +00 +00 +00 +06 +00 +54 +37 +00 +00 +02 +00 +00 +00 +06 +00 +58 +37 +00 +00 +02 +00 +00 +00 +06 +00 +5c +37 +00 +00 +02 +00 +00 +00 +06 +00 +60 +37 +00 +00 +02 +00 +00 +00 +06 +00 +64 +37 +00 +00 +02 +00 +00 +00 +06 +00 +68 +37 +00 +00 +02 +00 +00 +00 +06 +00 +6c +37 +00 +00 +02 +00 +00 +00 +06 +00 +70 +37 +00 +00 +02 +00 +00 +00 +06 +00 +74 +37 +00 +00 +02 +00 +00 +00 +06 +00 +78 +37 +00 +00 +02 +00 +00 +00 +06 +00 +7c +37 +00 +00 +02 +00 +00 +00 +06 +00 +80 +37 +00 +00 +02 +00 +00 +00 +06 +00 +84 +37 +00 +00 +02 +00 +00 +00 +06 +00 +88 +37 +00 +00 +02 +00 +00 +00 +06 +00 +8c +37 +00 +00 +02 +00 +00 +00 +06 +00 +90 +37 +00 +00 +02 +00 +00 +00 +06 +00 +94 +37 +00 +00 +02 +00 +00 +00 +06 +00 +98 +37 +00 +00 +02 +00 +00 +00 +06 +00 +9c +37 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +37 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +37 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +37 +00 +00 +02 +00 +00 +00 +06 +00 +ac +37 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +37 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +37 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +37 +00 +00 +02 +00 +00 +00 +06 +00 +bc +37 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +37 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +37 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +37 +00 +00 +02 +00 +00 +00 +06 +00 +cc +37 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +37 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +37 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +37 +00 +00 +02 +00 +00 +00 +06 +00 +dc +37 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +37 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +37 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +37 +00 +00 +02 +00 +00 +00 +06 +00 +ec +37 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +37 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +37 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +37 +00 +00 +02 +00 +00 +00 +06 +00 +fc +37 +00 +00 +02 +00 +00 +00 +06 +00 +00 +38 +00 +00 +02 +00 +00 +00 +06 +00 +04 +38 +00 +00 +02 +00 +00 +00 +06 +00 +08 +38 +00 +00 +02 +00 +00 +00 +06 +00 +0c +38 +00 +00 +02 +00 +00 +00 +06 +00 +10 +38 +00 +00 +02 +00 +00 +00 +06 +00 +14 +38 +00 +00 +02 +00 +00 +00 +06 +00 +18 +38 +00 +00 +02 +00 +00 +00 +06 +00 +1c +38 +00 +00 +02 +00 +00 +00 +06 +00 +20 +38 +00 +00 +02 +00 +00 +00 +06 +00 +24 +38 +00 +00 +02 +00 +00 +00 +06 +00 +28 +38 +00 +00 +02 +00 +00 +00 +06 +00 +2c +38 +00 +00 +02 +00 +00 +00 +06 +00 +30 +38 +00 +00 +02 +00 +00 +00 +06 +00 +34 +38 +00 +00 +02 +00 +00 +00 +06 +00 +38 +38 +00 +00 +02 +00 +00 +00 +06 +00 +3c +38 +00 +00 +02 +00 +00 +00 +06 +00 +40 +38 +00 +00 +02 +00 +00 +00 +06 +00 +44 +38 +00 +00 +02 +00 +00 +00 +06 +00 +48 +38 +00 +00 +02 +00 +00 +00 +06 +00 +4c +38 +00 +00 +02 +00 +00 +00 +06 +00 +50 +38 +00 +00 +02 +00 +00 +00 +06 +00 +54 +38 +00 +00 +02 +00 +00 +00 +06 +00 +58 +38 +00 +00 +02 +00 +00 +00 +06 +00 +5c +38 +00 +00 +02 +00 +00 +00 +06 +00 +60 +38 +00 +00 +02 +00 +00 +00 +06 +00 +64 +38 +00 +00 +02 +00 +00 +00 +06 +00 +68 +38 +00 +00 +02 +00 +00 +00 +06 +00 +6c +38 +00 +00 +02 +00 +00 +00 +06 +00 +70 +38 +00 +00 +02 +00 +00 +00 +06 +00 +74 +38 +00 +00 +02 +00 +00 +00 +06 +00 +78 +38 +00 +00 +02 +00 +00 +00 +06 +00 +7c +38 +00 +00 +02 +00 +00 +00 +06 +00 +80 +38 +00 +00 +02 +00 +00 +00 +06 +00 +84 +38 +00 +00 +02 +00 +00 +00 +06 +00 +88 +38 +00 +00 +02 +00 +00 +00 +06 +00 +8c +38 +00 +00 +02 +00 +00 +00 +06 +00 +90 +38 +00 +00 +02 +00 +00 +00 +06 +00 +94 +38 +00 +00 +02 +00 +00 +00 +06 +00 +98 +38 +00 +00 +02 +00 +00 +00 +06 +00 +9c +38 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +38 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +38 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +38 +00 +00 +02 +00 +00 +00 +06 +00 +ac +38 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +38 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +38 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +38 +00 +00 +02 +00 +00 +00 +06 +00 +bc +38 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +38 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +38 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +38 +00 +00 +02 +00 +00 +00 +06 +00 +cc +38 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +38 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +38 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +38 +00 +00 +02 +00 +00 +00 +06 +00 +dc +38 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +38 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +38 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +38 +00 +00 +02 +00 +00 +00 +06 +00 +ec +38 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +38 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +38 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +38 +00 +00 +02 +00 +00 +00 +06 +00 +fc +38 +00 +00 +02 +00 +00 +00 +06 +00 +00 39 -0b -01 -00 -02 -00 -00 -00 -06 -00 -3d -0b -01 -00 -02 -00 -00 -00 -06 -00 -41 -0b -01 -00 -02 -00 -00 -00 -06 -00 -45 -0b -01 -00 -02 -00 -00 -00 -06 -00 -49 -0b -01 -00 -02 -00 -00 -00 -06 -00 -4d -0b -01 -00 -02 -00 -00 -00 -06 -00 -51 -0b -01 -00 -02 -00 -00 -00 -06 -00 -55 -0b -01 -00 -02 -00 -00 -00 -06 -00 -59 -0b -01 -00 -02 -00 -00 -00 -06 -00 -5d -0b -01 -00 -02 -00 -00 -00 -06 -00 -61 -0b -01 -00 -02 -00 -00 -00 -06 -00 -65 -0b -01 -00 -02 -00 -00 -00 -06 -00 -69 -0b -01 -00 -02 -00 -00 -00 -06 -00 -6d -0b -01 -00 -02 -00 -00 -00 -06 -00 -71 -0b -01 -00 -02 -00 -00 -00 -06 -00 -75 -0b -01 -00 -02 -00 -00 -00 -06 -00 -79 -0b -01 -00 -02 -00 -00 -00 -06 -00 -7d -0b -01 -00 -02 -00 -00 -00 -06 -00 -81 -0b -01 -00 -02 -00 -00 -00 -06 -00 -85 -0b -01 -00 -02 -00 -00 -00 -06 -00 -89 -0b -01 -00 -02 -00 -00 -00 -06 -00 -8d -0b -01 -00 -02 -00 -00 -00 -06 -00 -91 -0b -01 -00 -02 -00 -00 -00 -06 -00 -95 -0b -01 -00 -02 -00 -00 -00 -06 -00 -99 -0b -01 -00 -02 -00 -00 -00 -06 -00 -9d -0b -01 -00 -02 -00 -00 -00 -06 -00 -a1 -0b -01 -00 -02 -00 -00 -00 -06 -00 -a5 -0b -01 -00 -02 -00 -00 -00 -06 -00 -a9 -0b -01 -00 -02 -00 -00 -00 -06 -00 -ad -0b -01 -00 -02 -00 -00 -00 -06 -00 -b1 -0b -01 -00 -02 -00 -00 -00 -06 -00 -b5 -0b -01 -00 -02 -00 -00 -00 -06 -00 -b9 -0b -01 -00 -02 -00 -00 -00 -06 -00 -bd -0b -01 -00 -02 -00 -00 -00 -06 -00 -c1 -0b -01 -00 -02 -00 -00 -00 -06 -00 -c5 -0b -01 -00 -02 -00 -00 -00 -06 -00 -c9 -0b -01 -00 -02 -00 -00 -00 -06 -00 -cd -0b -01 -00 -02 -00 -00 -00 -06 -00 -d1 -0b -01 -00 -02 -00 -00 -00 -06 -00 -d5 -0b -01 -00 -02 -00 -00 -00 -06 -00 -d9 -0b -01 -00 -02 -00 -00 -00 -06 -00 -dd -0b -01 -00 -02 -00 -00 -00 -06 -00 -e1 -0b -01 -00 -02 -00 -00 -00 -06 -00 -e5 -0b -01 -00 -02 -00 -00 -00 -06 -00 -e9 -0b -01 -00 -02 -00 -00 -00 -06 -00 -ed -0b -01 -00 -02 -00 -00 -00 -06 -00 -f1 -0b -01 -00 -02 -00 -00 -00 -06 -00 -f5 -0b -01 -00 -02 -00 -00 -00 -06 -00 -f9 -0b -01 -00 -02 -00 -00 -00 -06 -00 -fd -0b -01 -00 -02 -00 -00 -00 -06 -00 -01 -0c -01 -00 -02 -00 -00 -00 -06 -00 -05 -0c -01 -00 -02 -00 -00 -00 -06 -00 -09 -0c -01 -00 -02 -00 -00 -00 -06 -00 -0d -0c -01 -00 -02 -00 -00 -00 -06 -00 -11 -0c -01 -00 -02 -00 -00 -00 -06 -00 -15 -0c -01 -00 -02 -00 -00 -00 -06 -00 -19 -0c -01 -00 -02 -00 -00 -00 -06 -00 -1d -0c -01 -00 -02 -00 -00 -00 -06 -00 -21 -0c -01 -00 -02 -00 -00 -00 -06 -00 -25 -0c -01 -00 -02 -00 -00 -00 -06 -00 -29 -0c -01 -00 -02 -00 -00 -00 -06 -00 -2d -0c -01 -00 -02 -00 -00 -00 -06 -00 -31 -0c -01 -00 -02 -00 -00 -00 -06 -00 -35 -0c -01 +00 00 02 00 @@ -85959,639 +86419,9 @@ fd 00 06 00 +04 39 -0c -01 -00 -02 -00 -00 -00 -06 -00 -3d -0c -01 -00 -02 -00 -00 -00 -06 -00 -41 -0c -01 -00 -02 -00 -00 -00 -06 -00 -45 -0c -01 -00 -02 -00 -00 -00 -06 -00 -49 -0c -01 -00 -02 -00 -00 -00 -06 -00 -4d -0c -01 -00 -02 -00 -00 -00 -06 -00 -51 -0c -01 -00 -02 -00 -00 -00 -06 -00 -55 -0c -01 -00 -02 -00 -00 -00 -06 -00 -59 -0c -01 -00 -02 -00 -00 -00 -06 -00 -5d -0c -01 -00 -02 -00 -00 -00 -06 -00 -61 -0c -01 -00 -02 -00 -00 -00 -06 -00 -65 -0c -01 -00 -02 -00 -00 -00 -06 -00 -69 -0c -01 -00 -02 -00 -00 -00 -06 -00 -6d -0c -01 -00 -02 -00 -00 -00 -06 -00 -71 -0c -01 -00 -02 -00 -00 -00 -06 -00 -75 -0c -01 -00 -02 -00 -00 -00 -06 -00 -79 -0c -01 -00 -02 -00 -00 -00 -06 -00 -7d -0c -01 -00 -02 -00 -00 -00 -06 -00 -81 -0c -01 -00 -02 -00 -00 -00 -06 -00 -85 -0c -01 -00 -02 -00 -00 -00 -06 -00 -89 -0c -01 -00 -02 -00 -00 -00 -06 -00 -8d -0c -01 -00 -02 -00 -00 -00 -06 -00 -91 -0c -01 -00 -02 -00 -00 -00 -06 -00 -95 -0c -01 -00 -02 -00 -00 -00 -06 -00 -99 -0c -01 -00 -02 -00 -00 -00 -06 -00 -9d -0c -01 -00 -02 -00 -00 -00 -06 -00 -a1 -0c -01 -00 -02 -00 -00 -00 -06 -00 -a5 -0c -01 -00 -02 -00 -00 -00 -06 -00 -a9 -0c -01 -00 -02 -00 -00 -00 -06 -00 -ad -0c -01 -00 -02 -00 -00 -00 -06 -00 -b1 -0c -01 -00 -02 -00 -00 -00 -06 -00 -b5 -0c -01 -00 -02 -00 -00 -00 -06 -00 -b9 -0c -01 -00 -02 -00 -00 -00 -06 -00 -bd -0c -01 -00 -02 -00 -00 -00 -06 -00 -c1 -0c -01 -00 -02 -00 -00 -00 -06 -00 -c5 -0c -01 -00 -02 -00 -00 -00 -06 -00 -c9 -0c -01 -00 -02 -00 -00 -00 -06 -00 -cd -0c -01 -00 -02 -00 -00 -00 -06 -00 -d1 -0c -01 -00 -02 -00 -00 -00 -06 -00 -d5 -0c -01 -00 -02 -00 -00 -00 -06 -00 -d9 -0c -01 -00 -02 -00 -00 -00 -06 -00 -dd -0c -01 -00 -02 -00 -00 -00 -06 -00 -e1 -0c -01 -00 -02 -00 -00 -00 -06 -00 -e5 -0c -01 -00 -02 -00 -00 -00 -06 -00 -e9 -0c -01 -00 -02 -00 -00 -00 -06 -00 -ed -0c -01 -00 -02 -00 -00 -00 -06 -00 -f1 -0c -01 -00 -02 -00 -00 -00 -06 -00 -f5 -0c -01 -00 -02 -00 -00 -00 -06 -00 -f9 -0c -01 -00 -02 -00 -00 -00 -06 -00 -fd -0c -01 -00 -02 -00 -00 -00 -06 -00 -01 -0d -01 -00 -02 -00 -00 -00 -06 -00 -05 -0d -01 -00 -02 -00 -00 -00 -06 -00 -09 -0d -01 -00 -02 -00 -00 -00 -06 -00 -0d -0d -01 -00 -02 -00 -00 -00 -06 -00 -11 -0d -01 -00 -02 -00 -00 -00 -06 -00 -15 -0d -01 -00 -02 -00 -00 -00 -06 -00 -19 -0d -01 -00 -02 -00 -00 -00 -06 -00 -1d -0d -01 -00 -02 -00 -00 -00 -06 -00 -21 -0d -01 -00 -02 -00 -00 -00 -06 -00 -25 -0d -01 -00 -02 -00 -00 -00 -06 -00 -29 -0d -01 -00 -02 -00 -00 -00 -06 -00 -2d -0d -01 -00 -02 -00 -00 -00 -06 -00 -31 -0d -01 -00 -02 -00 -00 -00 -06 -00 -35 -0d -01 +00 00 02 00 @@ -86599,509 +86429,9 @@ fd 00 06 00 +08 39 -0d -01 -00 -02 -00 -00 -00 -06 -00 -3d -0d -01 -00 -02 -00 -00 -00 -06 -00 -41 -0d -01 -00 -02 -00 -00 -00 -06 -00 -45 -0d -01 -00 -02 -00 -00 -00 -06 -00 -49 -0d -01 -00 -02 -00 -00 -00 -06 -00 -4d -0d -01 -00 -02 -00 -00 -00 -06 -00 -51 -0d -01 -00 -02 -00 -00 -00 -06 -00 -55 -0d -01 -00 -02 -00 -00 -00 -06 -00 -59 -0d -01 -00 -02 -00 -00 -00 -06 -00 -5d -0d -01 -00 -02 -00 -00 -00 -06 -00 -61 -0d -01 -00 -02 -00 -00 -00 -06 -00 -65 -0d -01 -00 -02 -00 -00 -00 -06 -00 -69 -0d -01 -00 -02 -00 -00 -00 -06 -00 -6d -0d -01 -00 -02 -00 -00 -00 -06 -00 -71 -0d -01 -00 -02 -00 -00 -00 -06 -00 -75 -0d -01 -00 -02 -00 -00 -00 -06 -00 -79 -0d -01 -00 -02 -00 -00 -00 -06 -00 -7d -0d -01 -00 -02 -00 -00 -00 -06 -00 -81 -0d -01 -00 -02 -00 -00 -00 -06 -00 -85 -0d -01 -00 -02 -00 -00 -00 -06 -00 -89 -0d -01 -00 -02 -00 -00 -00 -06 -00 -8d -0d -01 -00 -02 -00 -00 -00 -06 -00 -91 -0d -01 -00 -02 -00 -00 -00 -06 -00 -95 -0d -01 -00 -02 -00 -00 -00 -06 -00 -99 -0d -01 -00 -02 -00 -00 -00 -06 -00 -9d -0d -01 -00 -02 -00 -00 -00 -06 -00 -a1 -0d -01 -00 -02 -00 -00 -00 -06 -00 -a5 -0d -01 -00 -02 -00 -00 -00 -06 -00 -a9 -0d -01 -00 -02 -00 -00 -00 -06 -00 -ad -0d -01 -00 -02 -00 -00 -00 -06 -00 -b1 -0d -01 -00 -02 -00 -00 -00 -06 -00 -b5 -0d -01 -00 -02 -00 -00 -00 -06 -00 -ed -0e -01 -00 -02 -00 -00 -00 -06 -00 -f1 -0e -01 -00 -02 -00 -00 -00 -06 -00 -f5 -0e -01 -00 -02 -00 -00 -00 -06 -00 -f9 -0e -01 -00 -02 -00 -00 -00 -06 -00 -fd -0e -01 -00 -02 -00 -00 -00 -06 -00 -01 -0f -01 -00 -02 -00 -00 -00 -06 -00 -05 -0f -01 -00 -02 -00 -00 -00 -06 -00 -09 -0f -01 -00 -02 -00 -00 -00 -06 -00 -0d -0f -01 -00 -02 -00 -00 -00 -06 -00 -11 -0f -01 -00 -02 -00 -00 -00 -06 -00 -15 -0f -01 -00 -02 -00 -00 -00 -06 -00 -19 -0f -01 -00 -02 -00 -00 -00 -06 -00 -1d -0f -01 -00 -02 -00 -00 -00 -06 -00 -21 -0f -01 -00 -02 -00 -00 -00 -06 -00 -25 -0f -01 -00 -02 -00 -00 -00 -06 -00 -29 -0f -01 -00 -02 -00 -00 -00 -06 -00 -2d -0f -01 -00 -02 -00 -00 -00 -06 -00 -31 -0f -01 -00 -02 -00 -00 -00 -06 -00 -35 -0f -01 +00 00 02 00 @@ -87109,9 +86439,9 @@ fd 00 06 00 +0c 39 -0f -01 +00 00 02 00 @@ -87119,1269 +86449,9 @@ fd 00 06 00 -3d -0f -01 -00 -02 -00 -00 -00 -06 -00 -41 -0f -01 -00 -02 -00 -00 -00 -06 -00 -45 -0f -01 -00 -02 -00 -00 -00 -06 -00 -49 -0f -01 -00 -02 -00 -00 -00 -06 -00 -4d -0f -01 -00 -02 -00 -00 -00 -06 -00 -51 -0f -01 -00 -02 -00 -00 -00 -06 -00 -55 -0f -01 -00 -02 -00 -00 -00 -06 -00 -59 -0f -01 -00 -02 -00 -00 -00 -06 -00 -5d -0f -01 -00 -02 -00 -00 -00 -06 -00 -61 -0f -01 -00 -02 -00 -00 -00 -06 -00 -65 -0f -01 -00 -02 -00 -00 -00 -06 -00 -69 -0f -01 -00 -02 -00 -00 -00 -06 -00 -6d -0f -01 -00 -02 -00 -00 -00 -06 -00 -71 -0f -01 -00 -02 -00 -00 -00 -06 -00 -75 -0f -01 -00 -02 -00 -00 -00 -06 -00 -79 -0f -01 -00 -02 -00 -00 -00 -06 -00 -7d -0f -01 -00 -02 -00 -00 -00 -06 -00 -81 -0f -01 -00 -02 -00 -00 -00 -06 -00 -85 -0f -01 -00 -02 -00 -00 -00 -06 -00 -89 -0f -01 -00 -02 -00 -00 -00 -06 -00 -8d -0f -01 -00 -02 -00 -00 -00 -06 -00 -91 -0f -01 -00 -02 -00 -00 -00 -06 -00 -95 -0f -01 -00 -02 -00 -00 -00 -06 -00 -99 -0f -01 -00 -02 -00 -00 -00 -06 -00 -9d -0f -01 -00 -02 -00 -00 -00 -06 -00 -a1 -0f -01 -00 -02 -00 -00 -00 -06 -00 -a5 -0f -01 -00 -02 -00 -00 -00 -06 -00 -a9 -0f -01 -00 -02 -00 -00 -00 -06 -00 -ad -0f -01 -00 -02 -00 -00 -00 -06 -00 -b1 -0f -01 -00 -02 -00 -00 -00 -06 -00 -b5 -0f -01 -00 -02 -00 -00 -00 -06 -00 -b9 -0f -01 -00 -02 -00 -00 -00 -06 -00 -bd -0f -01 -00 -02 -00 -00 -00 -06 -00 -c1 -0f -01 -00 -02 -00 -00 -00 -06 -00 -c5 -0f -01 -00 -02 -00 -00 -00 -06 -00 -c9 -0f -01 -00 -02 -00 -00 -00 -06 -00 -cd -0f -01 -00 -02 -00 -00 -00 -06 -00 -d1 -0f -01 -00 -02 -00 -00 -00 -06 -00 -d5 -0f -01 -00 -02 -00 -00 -00 -06 -00 -d9 -0f -01 -00 -02 -00 -00 -00 -06 -00 -dd -0f -01 -00 -02 -00 -00 -00 -06 -00 -e1 -0f -01 -00 -02 -00 -00 -00 -06 -00 -e5 -0f -01 -00 -02 -00 -00 -00 -06 -00 -e9 -0f -01 -00 -02 -00 -00 -00 -06 -00 -ed -0f -01 -00 -02 -00 -00 -00 -06 -00 -f1 -0f -01 -00 -02 -00 -00 -00 -06 -00 -f5 -0f -01 -00 -02 -00 -00 -00 -06 -00 -f9 -0f -01 -00 -02 -00 -00 -00 -06 -00 -fd -0f -01 -00 -02 -00 -00 -00 -06 -00 -01 10 -01 -00 -02 -00 -00 -00 -06 -00 -05 -10 -01 -00 -02 -00 -00 -00 -06 -00 -09 -10 -01 -00 -02 -00 -00 -00 -06 -00 -0d -10 -01 -00 -02 -00 -00 -00 -06 -00 -11 -10 -01 -00 -02 -00 -00 -00 -06 -00 -15 -10 -01 -00 -02 -00 -00 -00 -06 -00 -19 -10 -01 -00 -02 -00 -00 -00 -06 -00 -1d -10 -01 -00 -02 -00 -00 -00 -06 -00 -21 -10 -01 -00 -02 -00 -00 -00 -06 -00 -25 -10 -01 -00 -02 -00 -00 -00 -06 -00 -29 -10 -01 -00 -02 -00 -00 -00 -06 -00 -2d -10 -01 -00 -02 -00 -00 -00 -06 -00 -31 -10 -01 -00 -02 -00 -00 -00 -06 -00 -35 -10 -01 -00 -02 -00 -00 -00 -06 -00 39 -10 -01 -00 -02 -00 -00 -00 -06 -00 -3d -10 -01 -00 -02 -00 -00 -00 -06 -00 -41 -10 -01 -00 -02 -00 -00 -00 -06 -00 -45 -10 -01 -00 -02 -00 -00 -00 -06 -00 -49 -10 -01 -00 -02 -00 -00 -00 -06 -00 -4d -10 -01 -00 -02 -00 -00 -00 -06 -00 -51 -10 -01 -00 -02 -00 -00 -00 -06 -00 -55 -10 -01 -00 -02 -00 -00 -00 -06 -00 -59 -10 -01 -00 -02 -00 -00 -00 -06 -00 -5d -10 -01 -00 -02 -00 -00 -00 -06 -00 -61 -10 -01 -00 -02 -00 -00 -00 -06 -00 -65 -10 -01 -00 -02 -00 -00 -00 -06 -00 -69 -10 -01 -00 -02 -00 -00 -00 -06 -00 -6d -10 -01 -00 -02 -00 -00 -00 -06 -00 -71 -10 -01 -00 -02 -00 -00 -00 -06 -00 -75 -10 -01 -00 -02 -00 -00 -00 -06 -00 -79 -10 -01 -00 -02 -00 -00 -00 -06 -00 -7d -10 -01 -00 -02 -00 -00 -00 -06 -00 -81 -10 -01 -00 -02 -00 -00 -00 -06 -00 -85 -10 -01 -00 -02 -00 -00 -00 -06 -00 -89 -10 -01 -00 -02 -00 -00 -00 -06 -00 -8d -10 -01 -00 -02 -00 -00 -00 -06 -00 -91 -10 -01 -00 -02 -00 -00 -00 -06 -00 -95 -10 -01 -00 -02 -00 -00 -00 -06 -00 -99 -10 -01 -00 -02 -00 -00 -00 -06 -00 -9d -10 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -10 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -10 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -10 -01 -00 -02 -00 -00 -00 -06 -00 -ad -10 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -10 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -10 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -10 -01 -00 -02 -00 -00 -00 -06 -00 -bd -10 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -10 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -10 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -10 -01 -00 -02 -00 -00 -00 -06 -00 -cd -10 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -10 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -10 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -10 -01 -00 -02 -00 -00 -00 -06 -00 -dd -10 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -10 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -10 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -10 -01 -00 -02 -00 -00 -00 -06 -00 -ed -10 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -10 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -10 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -10 -01 -00 -02 -00 -00 -00 -06 -00 -fd -10 -01 -00 -02 -00 -00 -00 -06 -00 -01 -11 -01 -00 -02 -00 -00 -00 -06 -00 -05 -11 -01 -00 -02 -00 -00 -00 -06 -00 -09 -11 -01 -00 -02 -00 -00 -00 -06 -00 -0d -11 -01 -00 -02 -00 -00 -00 -06 -00 -11 -11 -01 -00 -02 -00 -00 -00 -06 -00 -15 -11 -01 -00 -02 -00 -00 -00 -06 -00 -19 -11 -01 -00 -02 -00 -00 -00 -06 -00 -1d -11 -01 -00 -02 -00 -00 -00 -06 -00 -21 -11 -01 -00 -02 -00 -00 -00 -06 -00 -25 -11 -01 -00 -02 -00 -00 -00 -06 -00 -29 -11 -01 -00 -02 -00 -00 -00 -06 -00 -2d -11 -01 -00 -02 -00 -00 -00 -06 -00 -31 -11 -01 -00 -02 -00 -00 -00 -06 -00 -35 -11 -01 +00 00 02 00 @@ -88389,639 +86459,9 @@ fd 00 06 00 +14 39 -11 -01 -00 -02 -00 -00 -00 -06 -00 -3d -11 -01 -00 -02 -00 -00 -00 -06 -00 -41 -11 -01 -00 -02 -00 -00 -00 -06 -00 -45 -11 -01 -00 -02 -00 -00 -00 -06 -00 -49 -11 -01 -00 -02 -00 -00 -00 -06 -00 -4d -11 -01 -00 -02 -00 -00 -00 -06 -00 -51 -11 -01 -00 -02 -00 -00 -00 -06 -00 -55 -11 -01 -00 -02 -00 -00 -00 -06 -00 -59 -11 -01 -00 -02 -00 -00 -00 -06 -00 -5d -11 -01 -00 -02 -00 -00 -00 -06 -00 -61 -11 -01 -00 -02 -00 -00 -00 -06 -00 -65 -11 -01 -00 -02 -00 -00 -00 -06 -00 -69 -11 -01 -00 -02 -00 -00 -00 -06 -00 -6d -11 -01 -00 -02 -00 -00 -00 -06 -00 -71 -11 -01 -00 -02 -00 -00 -00 -06 -00 -75 -11 -01 -00 -02 -00 -00 -00 -06 -00 -79 -11 -01 -00 -02 -00 -00 -00 -06 -00 -7d -11 -01 -00 -02 -00 -00 -00 -06 -00 -81 -11 -01 -00 -02 -00 -00 -00 -06 -00 -85 -11 -01 -00 -02 -00 -00 -00 -06 -00 -89 -11 -01 -00 -02 -00 -00 -00 -06 -00 -8d -11 -01 -00 -02 -00 -00 -00 -06 -00 -91 -11 -01 -00 -02 -00 -00 -00 -06 -00 -95 -11 -01 -00 -02 -00 -00 -00 -06 -00 -99 -11 -01 -00 -02 -00 -00 -00 -06 -00 -9d -11 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -11 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -11 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -11 -01 -00 -02 -00 -00 -00 -06 -00 -ad -11 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -11 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -11 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -11 -01 -00 -02 -00 -00 -00 -06 -00 -bd -11 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -11 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -11 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -11 -01 -00 -02 -00 -00 -00 -06 -00 -cd -11 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -11 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -11 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -11 -01 -00 -02 -00 -00 -00 -06 -00 -dd -11 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -11 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -11 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -11 -01 -00 -02 -00 -00 -00 -06 -00 -ed -11 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -11 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -11 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -11 -01 -00 -02 -00 -00 -00 -06 -00 -fd -11 -01 -00 -02 -00 -00 -00 -06 -00 -01 -12 -01 -00 -02 -00 -00 -00 -06 -00 -05 -12 -01 -00 -02 -00 -00 -00 -06 -00 -09 -12 -01 -00 -02 -00 -00 -00 -06 -00 -0d -12 -01 -00 -02 -00 -00 -00 -06 -00 -11 -12 -01 -00 -02 -00 -00 -00 -06 -00 -15 -12 -01 -00 -02 -00 -00 -00 -06 -00 -19 -12 -01 -00 -02 -00 -00 -00 -06 -00 -1d -12 -01 -00 -02 -00 -00 -00 -06 -00 -21 -12 -01 -00 -02 -00 -00 -00 -06 -00 -25 -12 -01 -00 -02 -00 -00 -00 -06 -00 -29 -12 -01 -00 -02 -00 -00 -00 -06 -00 -2d -12 -01 -00 -02 -00 -00 -00 -06 -00 -31 -12 -01 -00 -02 -00 -00 -00 -06 -00 -35 -12 -01 +00 00 02 00 @@ -89029,639 +86469,9 @@ fd 00 06 00 +18 39 -12 -01 -00 -02 -00 -00 -00 -06 -00 -3d -12 -01 -00 -02 -00 -00 -00 -06 -00 -41 -12 -01 -00 -02 -00 -00 -00 -06 -00 -45 -12 -01 -00 -02 -00 -00 -00 -06 -00 -49 -12 -01 -00 -02 -00 -00 -00 -06 -00 -4d -12 -01 -00 -02 -00 -00 -00 -06 -00 -51 -12 -01 -00 -02 -00 -00 -00 -06 -00 -55 -12 -01 -00 -02 -00 -00 -00 -06 -00 -59 -12 -01 -00 -02 -00 -00 -00 -06 -00 -5d -12 -01 -00 -02 -00 -00 -00 -06 -00 -61 -12 -01 -00 -02 -00 -00 -00 -06 -00 -65 -12 -01 -00 -02 -00 -00 -00 -06 -00 -69 -12 -01 -00 -02 -00 -00 -00 -06 -00 -6d -12 -01 -00 -02 -00 -00 -00 -06 -00 -71 -12 -01 -00 -02 -00 -00 -00 -06 -00 -75 -12 -01 -00 -02 -00 -00 -00 -06 -00 -79 -12 -01 -00 -02 -00 -00 -00 -06 -00 -7d -12 -01 -00 -02 -00 -00 -00 -06 -00 -81 -12 -01 -00 -02 -00 -00 -00 -06 -00 -85 -12 -01 -00 -02 -00 -00 -00 -06 -00 -89 -12 -01 -00 -02 -00 -00 -00 -06 -00 -8d -12 -01 -00 -02 -00 -00 -00 -06 -00 -91 -12 -01 -00 -02 -00 -00 -00 -06 -00 -95 -12 -01 -00 -02 -00 -00 -00 -06 -00 -99 -12 -01 -00 -02 -00 -00 -00 -06 -00 -9d -12 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -12 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -12 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -12 -01 -00 -02 -00 -00 -00 -06 -00 -ad -12 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -12 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -12 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -12 -01 -00 -02 -00 -00 -00 -06 -00 -bd -12 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -12 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -12 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -12 -01 -00 -02 -00 -00 -00 -06 -00 -cd -12 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -12 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -12 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -12 -01 -00 -02 -00 -00 -00 -06 -00 -dd -12 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -12 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -12 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -12 -01 -00 -02 -00 -00 -00 -06 -00 -ed -12 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -12 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -12 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -12 -01 -00 -02 -00 -00 -00 -06 -00 -fd -12 -01 -00 -02 -00 -00 -00 -06 -00 -01 -13 -01 -00 -02 -00 -00 -00 -06 -00 -05 -13 -01 -00 -02 -00 -00 -00 -06 -00 -09 -13 -01 -00 -02 -00 -00 -00 -06 -00 -0d -13 -01 -00 -02 -00 -00 -00 -06 -00 -11 -13 -01 -00 -02 -00 -00 -00 -06 -00 -15 -13 -01 -00 -02 -00 -00 -00 -06 -00 -19 -13 -01 -00 -02 -00 -00 -00 -06 -00 -1d -13 -01 -00 -02 -00 -00 -00 -06 -00 -21 -13 -01 -00 -02 -00 -00 -00 -06 -00 -25 -13 -01 -00 -02 -00 -00 -00 -06 -00 -29 -13 -01 -00 -02 -00 -00 -00 -06 -00 -2d -13 -01 -00 -02 -00 -00 -00 -06 -00 -31 -13 -01 -00 -02 -00 -00 -00 -06 -00 -35 -13 -01 +00 00 02 00 @@ -89669,639 +86479,9 @@ fd 00 06 00 +1c 39 -13 -01 -00 -02 -00 -00 -00 -06 -00 -3d -13 -01 -00 -02 -00 -00 -00 -06 -00 -41 -13 -01 -00 -02 -00 -00 -00 -06 -00 -45 -13 -01 -00 -02 -00 -00 -00 -06 -00 -49 -13 -01 -00 -02 -00 -00 -00 -06 -00 -4d -13 -01 -00 -02 -00 -00 -00 -06 -00 -51 -13 -01 -00 -02 -00 -00 -00 -06 -00 -55 -13 -01 -00 -02 -00 -00 -00 -06 -00 -59 -13 -01 -00 -02 -00 -00 -00 -06 -00 -5d -13 -01 -00 -02 -00 -00 -00 -06 -00 -61 -13 -01 -00 -02 -00 -00 -00 -06 -00 -65 -13 -01 -00 -02 -00 -00 -00 -06 -00 -69 -13 -01 -00 -02 -00 -00 -00 -06 -00 -6d -13 -01 -00 -02 -00 -00 -00 -06 -00 -71 -13 -01 -00 -02 -00 -00 -00 -06 -00 -75 -13 -01 -00 -02 -00 -00 -00 -06 -00 -79 -13 -01 -00 -02 -00 -00 -00 -06 -00 -7d -13 -01 -00 -02 -00 -00 -00 -06 -00 -81 -13 -01 -00 -02 -00 -00 -00 -06 -00 -85 -13 -01 -00 -02 -00 -00 -00 -06 -00 -89 -13 -01 -00 -02 -00 -00 -00 -06 -00 -8d -13 -01 -00 -02 -00 -00 -00 -06 -00 -91 -13 -01 -00 -02 -00 -00 -00 -06 -00 -95 -13 -01 -00 -02 -00 -00 -00 -06 -00 -99 -13 -01 -00 -02 -00 -00 -00 -06 -00 -9d -13 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -13 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -13 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -13 -01 -00 -02 -00 -00 -00 -06 -00 -ad -13 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -13 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -13 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -13 -01 -00 -02 -00 -00 -00 -06 -00 -bd -13 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -13 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -13 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -13 -01 -00 -02 -00 -00 -00 -06 -00 -cd -13 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -13 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -13 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -13 -01 -00 -02 -00 -00 -00 -06 -00 -dd -13 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -13 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -13 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -13 -01 -00 -02 -00 -00 -00 -06 -00 -ed -13 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -13 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -13 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -13 -01 -00 -02 -00 -00 -00 -06 -00 -fd -13 -01 -00 -02 -00 -00 -00 -06 -00 -01 -14 -01 -00 -02 -00 -00 -00 -06 -00 -05 -14 -01 -00 -02 -00 -00 -00 -06 -00 -09 -14 -01 -00 -02 -00 -00 -00 -06 -00 -0d -14 -01 -00 -02 -00 -00 -00 -06 -00 -11 -14 -01 -00 -02 -00 -00 -00 -06 -00 -15 -14 -01 -00 -02 -00 -00 -00 -06 -00 -19 -14 -01 -00 -02 -00 -00 -00 -06 -00 -1d -14 -01 -00 -02 -00 -00 -00 -06 -00 -21 -14 -01 -00 -02 -00 -00 -00 -06 -00 -25 -14 -01 -00 -02 -00 -00 -00 -06 -00 -29 -14 -01 -00 -02 -00 -00 -00 -06 -00 -2d -14 -01 -00 -02 -00 -00 -00 -06 -00 -31 -14 -01 -00 -02 -00 -00 -00 -06 -00 -35 -14 -01 +00 00 02 00 @@ -90309,639 +86489,9 @@ fd 00 06 00 +20 39 -14 -01 -00 -02 -00 -00 -00 -06 -00 -3d -14 -01 -00 -02 -00 -00 -00 -06 -00 -41 -14 -01 -00 -02 -00 -00 -00 -06 -00 -45 -14 -01 -00 -02 -00 -00 -00 -06 -00 -49 -14 -01 -00 -02 -00 -00 -00 -06 -00 -4d -14 -01 -00 -02 -00 -00 -00 -06 -00 -51 -14 -01 -00 -02 -00 -00 -00 -06 -00 -55 -14 -01 -00 -02 -00 -00 -00 -06 -00 -59 -14 -01 -00 -02 -00 -00 -00 -06 -00 -5d -14 -01 -00 -02 -00 -00 -00 -06 -00 -61 -14 -01 -00 -02 -00 -00 -00 -06 -00 -65 -14 -01 -00 -02 -00 -00 -00 -06 -00 -69 -14 -01 -00 -02 -00 -00 -00 -06 -00 -6d -14 -01 -00 -02 -00 -00 -00 -06 -00 -71 -14 -01 -00 -02 -00 -00 -00 -06 -00 -75 -14 -01 -00 -02 -00 -00 -00 -06 -00 -79 -14 -01 -00 -02 -00 -00 -00 -06 -00 -7d -14 -01 -00 -02 -00 -00 -00 -06 -00 -81 -14 -01 -00 -02 -00 -00 -00 -06 -00 -85 -14 -01 -00 -02 -00 -00 -00 -06 -00 -89 -14 -01 -00 -02 -00 -00 -00 -06 -00 -8d -14 -01 -00 -02 -00 -00 -00 -06 -00 -91 -14 -01 -00 -02 -00 -00 -00 -06 -00 -95 -14 -01 -00 -02 -00 -00 -00 -06 -00 -99 -14 -01 -00 -02 -00 -00 -00 -06 -00 -9d -14 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -14 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -14 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -14 -01 -00 -02 -00 -00 -00 -06 -00 -ad -14 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -14 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -14 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -14 -01 -00 -02 -00 -00 -00 -06 -00 -bd -14 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -14 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -14 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -14 -01 -00 -02 -00 -00 -00 -06 -00 -cd -14 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -14 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -14 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -14 -01 -00 -02 -00 -00 -00 -06 -00 -dd -14 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -14 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -14 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -14 -01 -00 -02 -00 -00 -00 -06 -00 -ed -14 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -14 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -14 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -14 -01 -00 -02 -00 -00 -00 -06 -00 -fd -14 -01 -00 -02 -00 -00 -00 -06 -00 -01 -15 -01 -00 -02 -00 -00 -00 -06 -00 -05 -15 -01 -00 -02 -00 -00 -00 -06 -00 -09 -15 -01 -00 -02 -00 -00 -00 -06 -00 -0d -15 -01 -00 -02 -00 -00 -00 -06 -00 -11 -15 -01 -00 -02 -00 -00 -00 -06 -00 -15 -15 -01 -00 -02 -00 -00 -00 -06 -00 -19 -15 -01 -00 -02 -00 -00 -00 -06 -00 -1d -15 -01 -00 -02 -00 -00 -00 -06 -00 -21 -15 -01 -00 -02 -00 -00 -00 -06 -00 -25 -15 -01 -00 -02 -00 -00 -00 -06 -00 -29 -15 -01 -00 -02 -00 -00 -00 -06 -00 -2d -15 -01 -00 -02 -00 -00 -00 -06 -00 -31 -15 -01 -00 -02 -00 -00 -00 -06 -00 -35 -15 -01 +00 00 02 00 @@ -90949,639 +86499,9 @@ fd 00 06 00 +24 39 -15 -01 -00 -02 -00 -00 -00 -06 -00 -3d -15 -01 -00 -02 -00 -00 -00 -06 -00 -41 -15 -01 -00 -02 -00 -00 -00 -06 -00 -45 -15 -01 -00 -02 -00 -00 -00 -06 -00 -49 -15 -01 -00 -02 -00 -00 -00 -06 -00 -4d -15 -01 -00 -02 -00 -00 -00 -06 -00 -51 -15 -01 -00 -02 -00 -00 -00 -06 -00 -55 -15 -01 -00 -02 -00 -00 -00 -06 -00 -59 -15 -01 -00 -02 -00 -00 -00 -06 -00 -5d -15 -01 -00 -02 -00 -00 -00 -06 -00 -61 -15 -01 -00 -02 -00 -00 -00 -06 -00 -65 -15 -01 -00 -02 -00 -00 -00 -06 -00 -69 -15 -01 -00 -02 -00 -00 -00 -06 -00 -6d -15 -01 -00 -02 -00 -00 -00 -06 -00 -71 -15 -01 -00 -02 -00 -00 -00 -06 -00 -75 -15 -01 -00 -02 -00 -00 -00 -06 -00 -79 -15 -01 -00 -02 -00 -00 -00 -06 -00 -7d -15 -01 -00 -02 -00 -00 -00 -06 -00 -81 -15 -01 -00 -02 -00 -00 -00 -06 -00 -85 -15 -01 -00 -02 -00 -00 -00 -06 -00 -89 -15 -01 -00 -02 -00 -00 -00 -06 -00 -8d -15 -01 -00 -02 -00 -00 -00 -06 -00 -91 -15 -01 -00 -02 -00 -00 -00 -06 -00 -95 -15 -01 -00 -02 -00 -00 -00 -06 -00 -99 -15 -01 -00 -02 -00 -00 -00 -06 -00 -9d -15 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -15 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -15 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -15 -01 -00 -02 -00 -00 -00 -06 -00 -ad -15 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -15 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -15 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -15 -01 -00 -02 -00 -00 -00 -06 -00 -bd -15 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -15 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -15 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -15 -01 -00 -02 -00 -00 -00 -06 -00 -cd -15 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -15 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -15 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -15 -01 -00 -02 -00 -00 -00 -06 -00 -dd -15 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -15 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -15 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -15 -01 -00 -02 -00 -00 -00 -06 -00 -ed -15 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -15 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -15 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -15 -01 -00 -02 -00 -00 -00 -06 -00 -fd -15 -01 -00 -02 -00 -00 -00 -06 -00 -01 -16 -01 -00 -02 -00 -00 -00 -06 -00 -05 -16 -01 -00 -02 -00 -00 -00 -06 -00 -09 -16 -01 -00 -02 -00 -00 -00 -06 -00 -0d -16 -01 -00 -02 -00 -00 -00 -06 -00 -11 -16 -01 -00 -02 -00 -00 -00 -06 -00 -15 -16 -01 -00 -02 -00 -00 -00 -06 -00 -19 -16 -01 -00 -02 -00 -00 -00 -06 -00 -1d -16 -01 -00 -02 -00 -00 -00 -06 -00 -21 -16 -01 -00 -02 -00 -00 -00 -06 -00 -25 -16 -01 -00 -02 -00 -00 -00 -06 -00 -29 -16 -01 -00 -02 -00 -00 -00 -06 -00 -2d -16 -01 -00 -02 -00 -00 -00 -06 -00 -31 -16 -01 -00 -02 -00 -00 -00 -06 -00 -35 -16 -01 +00 00 02 00 @@ -91589,639 +86509,9 @@ fd 00 06 00 +28 39 -16 -01 -00 -02 -00 -00 -00 -06 -00 -3d -16 -01 -00 -02 -00 -00 -00 -06 -00 -41 -16 -01 -00 -02 -00 -00 -00 -06 -00 -45 -16 -01 -00 -02 -00 -00 -00 -06 -00 -49 -16 -01 -00 -02 -00 -00 -00 -06 -00 -4d -16 -01 -00 -02 -00 -00 -00 -06 -00 -51 -16 -01 -00 -02 -00 -00 -00 -06 -00 -55 -16 -01 -00 -02 -00 -00 -00 -06 -00 -59 -16 -01 -00 -02 -00 -00 -00 -06 -00 -5d -16 -01 -00 -02 -00 -00 -00 -06 -00 -61 -16 -01 -00 -02 -00 -00 -00 -06 -00 -65 -16 -01 -00 -02 -00 -00 -00 -06 -00 -69 -16 -01 -00 -02 -00 -00 -00 -06 -00 -6d -16 -01 -00 -02 -00 -00 -00 -06 -00 -71 -16 -01 -00 -02 -00 -00 -00 -06 -00 -75 -16 -01 -00 -02 -00 -00 -00 -06 -00 -79 -16 -01 -00 -02 -00 -00 -00 -06 -00 -7d -16 -01 -00 -02 -00 -00 -00 -06 -00 -81 -16 -01 -00 -02 -00 -00 -00 -06 -00 -85 -16 -01 -00 -02 -00 -00 -00 -06 -00 -89 -16 -01 -00 -02 -00 -00 -00 -06 -00 -8d -16 -01 -00 -02 -00 -00 -00 -06 -00 -91 -16 -01 -00 -02 -00 -00 -00 -06 -00 -95 -16 -01 -00 -02 -00 -00 -00 -06 -00 -99 -16 -01 -00 -02 -00 -00 -00 -06 -00 -9d -16 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -16 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -16 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -16 -01 -00 -02 -00 -00 -00 -06 -00 -ad -16 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -16 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -16 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -16 -01 -00 -02 -00 -00 -00 -06 -00 -bd -16 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -16 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -16 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -16 -01 -00 -02 -00 -00 -00 -06 -00 -cd -16 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -16 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -16 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -16 -01 -00 -02 -00 -00 -00 -06 -00 -dd -16 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -16 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -16 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -16 -01 -00 -02 -00 -00 -00 -06 -00 -ed -16 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -16 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -16 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -16 -01 -00 -02 -00 -00 -00 -06 -00 -fd -16 -01 -00 -02 -00 -00 -00 -06 -00 -01 -17 -01 -00 -02 -00 -00 -00 -06 -00 -05 -17 -01 -00 -02 -00 -00 -00 -06 -00 -09 -17 -01 -00 -02 -00 -00 -00 -06 -00 -0d -17 -01 -00 -02 -00 -00 -00 -06 -00 -11 -17 -01 -00 -02 -00 -00 -00 -06 -00 -15 -17 -01 -00 -02 -00 -00 -00 -06 -00 -19 -17 -01 -00 -02 -00 -00 -00 -06 -00 -1d -17 -01 -00 -02 -00 -00 -00 -06 -00 -21 -17 -01 -00 -02 -00 -00 -00 -06 -00 -25 -17 -01 -00 -02 -00 -00 -00 -06 -00 -29 -17 -01 -00 -02 -00 -00 -00 -06 -00 -2d -17 -01 -00 -02 -00 -00 -00 -06 -00 -31 -17 -01 -00 -02 -00 -00 -00 -06 -00 -35 -17 -01 +00 00 02 00 @@ -92229,639 +86519,9 @@ fd 00 06 00 +2c 39 -17 -01 -00 -02 -00 -00 -00 -06 -00 -3d -17 -01 -00 -02 -00 -00 -00 -06 -00 -41 -17 -01 -00 -02 -00 -00 -00 -06 -00 -45 -17 -01 -00 -02 -00 -00 -00 -06 -00 -49 -17 -01 -00 -02 -00 -00 -00 -06 -00 -4d -17 -01 -00 -02 -00 -00 -00 -06 -00 -51 -17 -01 -00 -02 -00 -00 -00 -06 -00 -55 -17 -01 -00 -02 -00 -00 -00 -06 -00 -59 -17 -01 -00 -02 -00 -00 -00 -06 -00 -5d -17 -01 -00 -02 -00 -00 -00 -06 -00 -61 -17 -01 -00 -02 -00 -00 -00 -06 -00 -65 -17 -01 -00 -02 -00 -00 -00 -06 -00 -69 -17 -01 -00 -02 -00 -00 -00 -06 -00 -6d -17 -01 -00 -02 -00 -00 -00 -06 -00 -71 -17 -01 -00 -02 -00 -00 -00 -06 -00 -75 -17 -01 -00 -02 -00 -00 -00 -06 -00 -79 -17 -01 -00 -02 -00 -00 -00 -06 -00 -7d -17 -01 -00 -02 -00 -00 -00 -06 -00 -81 -17 -01 -00 -02 -00 -00 -00 -06 -00 -85 -17 -01 -00 -02 -00 -00 -00 -06 -00 -89 -17 -01 -00 -02 -00 -00 -00 -06 -00 -8d -17 -01 -00 -02 -00 -00 -00 -06 -00 -91 -17 -01 -00 -02 -00 -00 -00 -06 -00 -95 -17 -01 -00 -02 -00 -00 -00 -06 -00 -99 -17 -01 -00 -02 -00 -00 -00 -06 -00 -9d -17 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -17 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -17 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -17 -01 -00 -02 -00 -00 -00 -06 -00 -ad -17 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -17 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -17 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -17 -01 -00 -02 -00 -00 -00 -06 -00 -bd -17 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -17 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -17 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -17 -01 -00 -02 -00 -00 -00 -06 -00 -cd -17 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -17 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -17 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -17 -01 -00 -02 -00 -00 -00 -06 -00 -dd -17 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -17 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -17 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -17 -01 -00 -02 -00 -00 -00 -06 -00 -ed -17 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -17 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -17 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -17 -01 -00 -02 -00 -00 -00 -06 -00 -fd -17 -01 -00 -02 -00 -00 -00 -06 -00 -01 -18 -01 -00 -02 -00 -00 -00 -06 -00 -05 -18 -01 -00 -02 -00 -00 -00 -06 -00 -09 -18 -01 -00 -02 -00 -00 -00 -06 -00 -0d -18 -01 -00 -02 -00 -00 -00 -06 -00 -11 -18 -01 -00 -02 -00 -00 -00 -06 -00 -15 -18 -01 -00 -02 -00 -00 -00 -06 -00 -19 -18 -01 -00 -02 -00 -00 -00 -06 -00 -1d -18 -01 -00 -02 -00 -00 -00 -06 -00 -21 -18 -01 -00 -02 -00 -00 -00 -06 -00 -25 -18 -01 -00 -02 -00 -00 -00 -06 -00 -29 -18 -01 -00 -02 -00 -00 -00 -06 -00 -2d -18 -01 -00 -02 -00 -00 -00 -06 -00 -31 -18 -01 -00 -02 -00 -00 -00 -06 -00 -35 -18 -01 +00 00 02 00 @@ -92869,639 +86529,9 @@ fd 00 06 00 +30 39 -18 -01 -00 -02 -00 -00 -00 -06 -00 -3d -18 -01 -00 -02 -00 -00 -00 -06 -00 -41 -18 -01 -00 -02 -00 -00 -00 -06 -00 -45 -18 -01 -00 -02 -00 -00 -00 -06 -00 -49 -18 -01 -00 -02 -00 -00 -00 -06 -00 -4d -18 -01 -00 -02 -00 -00 -00 -06 -00 -51 -18 -01 -00 -02 -00 -00 -00 -06 -00 -55 -18 -01 -00 -02 -00 -00 -00 -06 -00 -59 -18 -01 -00 -02 -00 -00 -00 -06 -00 -5d -18 -01 -00 -02 -00 -00 -00 -06 -00 -61 -18 -01 -00 -02 -00 -00 -00 -06 -00 -65 -18 -01 -00 -02 -00 -00 -00 -06 -00 -69 -18 -01 -00 -02 -00 -00 -00 -06 -00 -6d -18 -01 -00 -02 -00 -00 -00 -06 -00 -71 -18 -01 -00 -02 -00 -00 -00 -06 -00 -75 -18 -01 -00 -02 -00 -00 -00 -06 -00 -79 -18 -01 -00 -02 -00 -00 -00 -06 -00 -7d -18 -01 -00 -02 -00 -00 -00 -06 -00 -81 -18 -01 -00 -02 -00 -00 -00 -06 -00 -85 -18 -01 -00 -02 -00 -00 -00 -06 -00 -89 -18 -01 -00 -02 -00 -00 -00 -06 -00 -8d -18 -01 -00 -02 -00 -00 -00 -06 -00 -91 -18 -01 -00 -02 -00 -00 -00 -06 -00 -95 -18 -01 -00 -02 -00 -00 -00 -06 -00 -99 -18 -01 -00 -02 -00 -00 -00 -06 -00 -9d -18 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -18 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -18 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -18 -01 -00 -02 -00 -00 -00 -06 -00 -ad -18 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -18 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -18 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -18 -01 -00 -02 -00 -00 -00 -06 -00 -bd -18 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -18 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -18 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -18 -01 -00 -02 -00 -00 -00 -06 -00 -cd -18 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -18 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -18 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -18 -01 -00 -02 -00 -00 -00 -06 -00 -dd -18 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -18 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -18 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -18 -01 -00 -02 -00 -00 -00 -06 -00 -ed -18 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -18 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -18 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -18 -01 -00 -02 -00 -00 -00 -06 -00 -fd -18 -01 -00 -02 -00 -00 -00 -06 -00 -01 -19 -01 -00 -02 -00 -00 -00 -06 -00 -05 -19 -01 -00 -02 -00 -00 -00 -06 -00 -09 -19 -01 -00 -02 -00 -00 -00 -06 -00 -0d -19 -01 -00 -02 -00 -00 -00 -06 -00 -11 -19 -01 -00 -02 -00 -00 -00 -06 -00 -15 -19 -01 -00 -02 -00 -00 -00 -06 -00 -19 -19 -01 -00 -02 -00 -00 -00 -06 -00 -1d -19 -01 -00 -02 -00 -00 -00 -06 -00 -21 -19 -01 -00 -02 -00 -00 -00 -06 -00 -25 -19 -01 -00 -02 -00 -00 -00 -06 -00 -29 -19 -01 -00 -02 -00 -00 -00 -06 -00 -2d -19 -01 -00 -02 -00 -00 -00 -06 -00 -31 -19 -01 -00 -02 -00 -00 -00 -06 -00 -35 -19 -01 +00 00 02 00 @@ -93509,639 +86539,9 @@ fd 00 06 00 +34 39 -19 -01 -00 -02 -00 -00 -00 -06 -00 -3d -19 -01 -00 -02 -00 -00 -00 -06 -00 -41 -19 -01 -00 -02 -00 -00 -00 -06 -00 -45 -19 -01 -00 -02 -00 -00 -00 -06 -00 -49 -19 -01 -00 -02 -00 -00 -00 -06 -00 -4d -19 -01 -00 -02 -00 -00 -00 -06 -00 -51 -19 -01 -00 -02 -00 -00 -00 -06 -00 -55 -19 -01 -00 -02 -00 -00 -00 -06 -00 -59 -19 -01 -00 -02 -00 -00 -00 -06 -00 -5d -19 -01 -00 -02 -00 -00 -00 -06 -00 -61 -19 -01 -00 -02 -00 -00 -00 -06 -00 -65 -19 -01 -00 -02 -00 -00 -00 -06 -00 -69 -19 -01 -00 -02 -00 -00 -00 -06 -00 -6d -19 -01 -00 -02 -00 -00 -00 -06 -00 -71 -19 -01 -00 -02 -00 -00 -00 -06 -00 -75 -19 -01 -00 -02 -00 -00 -00 -06 -00 -79 -19 -01 -00 -02 -00 -00 -00 -06 -00 -7d -19 -01 -00 -02 -00 -00 -00 -06 -00 -81 -19 -01 -00 -02 -00 -00 -00 -06 -00 -85 -19 -01 -00 -02 -00 -00 -00 -06 -00 -89 -19 -01 -00 -02 -00 -00 -00 -06 -00 -8d -19 -01 -00 -02 -00 -00 -00 -06 -00 -91 -19 -01 -00 -02 -00 -00 -00 -06 -00 -95 -19 -01 -00 -02 -00 -00 -00 -06 -00 -99 -19 -01 -00 -02 -00 -00 -00 -06 -00 -9d -19 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -19 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -19 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -19 -01 -00 -02 -00 -00 -00 -06 -00 -ad -19 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -19 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -19 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -19 -01 -00 -02 -00 -00 -00 -06 -00 -bd -19 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -19 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -19 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -19 -01 -00 -02 -00 -00 -00 -06 -00 -cd -19 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -19 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -19 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -19 -01 -00 -02 -00 -00 -00 -06 -00 -dd -19 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -19 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -19 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -19 -01 -00 -02 -00 -00 -00 -06 -00 -ed -19 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -19 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -19 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -19 -01 -00 -02 -00 -00 -00 -06 -00 -fd -19 -01 -00 -02 -00 -00 -00 -06 -00 -01 -1a -01 -00 -02 -00 -00 -00 -06 -00 -05 -1a -01 -00 -02 -00 -00 -00 -06 -00 -09 -1a -01 -00 -02 -00 -00 -00 -06 -00 -0d -1a -01 -00 -02 -00 -00 -00 -06 -00 -11 -1a -01 -00 -02 -00 -00 -00 -06 -00 -15 -1a -01 -00 -02 -00 -00 -00 -06 -00 -19 -1a -01 -00 -02 -00 -00 -00 -06 -00 -1d -1a -01 -00 -02 -00 -00 -00 -06 -00 -21 -1a -01 -00 -02 -00 -00 -00 -06 -00 -25 -1a -01 -00 -02 -00 -00 -00 -06 -00 -29 -1a -01 -00 -02 -00 -00 -00 -06 -00 -2d -1a -01 -00 -02 -00 -00 -00 -06 -00 -31 -1a -01 -00 -02 -00 -00 -00 -06 -00 -35 -1a -01 +00 00 02 00 @@ -94149,639 +86549,9 @@ fd 00 06 00 +38 39 -1a -01 -00 -02 -00 -00 -00 -06 -00 -3d -1a -01 -00 -02 -00 -00 -00 -06 -00 -41 -1a -01 -00 -02 -00 -00 -00 -06 -00 -45 -1a -01 -00 -02 -00 -00 -00 -06 -00 -49 -1a -01 -00 -02 -00 -00 -00 -06 -00 -4d -1a -01 -00 -02 -00 -00 -00 -06 -00 -51 -1a -01 -00 -02 -00 -00 -00 -06 -00 -55 -1a -01 -00 -02 -00 -00 -00 -06 -00 -59 -1a -01 -00 -02 -00 -00 -00 -06 -00 -5d -1a -01 -00 -02 -00 -00 -00 -06 -00 -61 -1a -01 -00 -02 -00 -00 -00 -06 -00 -65 -1a -01 -00 -02 -00 -00 -00 -06 -00 -69 -1a -01 -00 -02 -00 -00 -00 -06 -00 -6d -1a -01 -00 -02 -00 -00 -00 -06 -00 -71 -1a -01 -00 -02 -00 -00 -00 -06 -00 -75 -1a -01 -00 -02 -00 -00 -00 -06 -00 -79 -1a -01 -00 -02 -00 -00 -00 -06 -00 -7d -1a -01 -00 -02 -00 -00 -00 -06 -00 -81 -1a -01 -00 -02 -00 -00 -00 -06 -00 -85 -1a -01 -00 -02 -00 -00 -00 -06 -00 -89 -1a -01 -00 -02 -00 -00 -00 -06 -00 -8d -1a -01 -00 -02 -00 -00 -00 -06 -00 -91 -1a -01 -00 -02 -00 -00 -00 -06 -00 -95 -1a -01 -00 -02 -00 -00 -00 -06 -00 -99 -1a -01 -00 -02 -00 -00 -00 -06 -00 -9d -1a -01 -00 -02 -00 -00 -00 -06 -00 -a1 -1a -01 -00 -02 -00 -00 -00 -06 -00 -a5 -1a -01 -00 -02 -00 -00 -00 -06 -00 -a9 -1a -01 -00 -02 -00 -00 -00 -06 -00 -ad -1a -01 -00 -02 -00 -00 -00 -06 -00 -b1 -1a -01 -00 -02 -00 -00 -00 -06 -00 -b5 -1a -01 -00 -02 -00 -00 -00 -06 -00 -b9 -1a -01 -00 -02 -00 -00 -00 -06 -00 -bd -1a -01 -00 -02 -00 -00 -00 -06 -00 -c1 -1a -01 -00 -02 -00 -00 -00 -06 -00 -c5 -1a -01 -00 -02 -00 -00 -00 -06 -00 -c9 -1a -01 -00 -02 -00 -00 -00 -06 -00 -cd -1a -01 -00 -02 -00 -00 -00 -06 -00 -d1 -1a -01 -00 -02 -00 -00 -00 -06 -00 -d5 -1a -01 -00 -02 -00 -00 -00 -06 -00 -d9 -1a -01 -00 -02 -00 -00 -00 -06 -00 -dd -1a -01 -00 -02 -00 -00 -00 -06 -00 -e1 -1a -01 -00 -02 -00 -00 -00 -06 -00 -e5 -1a -01 -00 -02 -00 -00 -00 -06 -00 -e9 -1a -01 -00 -02 -00 -00 -00 -06 -00 -ed -1a -01 -00 -02 -00 -00 -00 -06 -00 -f1 -1a -01 -00 -02 -00 -00 -00 -06 -00 -f5 -1a -01 -00 -02 -00 -00 -00 -06 -00 -f9 -1a -01 -00 -02 -00 -00 -00 -06 -00 -fd -1a -01 -00 -02 -00 -00 -00 -06 -00 -01 -1b -01 -00 -02 -00 -00 -00 -06 -00 -05 -1b -01 -00 -02 -00 -00 -00 -06 -00 -09 -1b -01 -00 -02 -00 -00 -00 -06 -00 -0d -1b -01 -00 -02 -00 -00 -00 -06 -00 -11 -1b -01 -00 -02 -00 -00 -00 -06 -00 -15 -1b -01 -00 -02 -00 -00 -00 -06 -00 -19 -1b -01 -00 -02 -00 -00 -00 -06 -00 -1d -1b -01 -00 -02 -00 -00 -00 -06 -00 -21 -1b -01 -00 -02 -00 -00 -00 -06 -00 -25 -1b -01 -00 -02 -00 -00 -00 -06 -00 -29 -1b -01 -00 -02 -00 -00 -00 -06 -00 -2d -1b -01 -00 -02 -00 -00 -00 -06 -00 -31 -1b -01 -00 -02 -00 -00 -00 -06 -00 -35 -1b -01 +00 00 02 00 @@ -94789,639 +86559,9 @@ fd 00 06 00 +3c 39 -1b -01 -00 -02 -00 -00 -00 -06 -00 -3d -1b -01 -00 -02 -00 -00 -00 -06 -00 -41 -1b -01 -00 -02 -00 -00 -00 -06 -00 -45 -1b -01 -00 -02 -00 -00 -00 -06 -00 -49 -1b -01 -00 -02 -00 -00 -00 -06 -00 -4d -1b -01 -00 -02 -00 -00 -00 -06 -00 -51 -1b -01 -00 -02 -00 -00 -00 -06 -00 -55 -1b -01 -00 -02 -00 -00 -00 -06 -00 -59 -1b -01 -00 -02 -00 -00 -00 -06 -00 -5d -1b -01 -00 -02 -00 -00 -00 -06 -00 -61 -1b -01 -00 -02 -00 -00 -00 -06 -00 -65 -1b -01 -00 -02 -00 -00 -00 -06 -00 -69 -1b -01 -00 -02 -00 -00 -00 -06 -00 -6d -1b -01 -00 -02 -00 -00 -00 -06 -00 -71 -1b -01 -00 -02 -00 -00 -00 -06 -00 -75 -1b -01 -00 -02 -00 -00 -00 -06 -00 -79 -1b -01 -00 -02 -00 -00 -00 -06 -00 -7d -1b -01 -00 -02 -00 -00 -00 -06 -00 -81 -1b -01 -00 -02 -00 -00 -00 -06 -00 -85 -1b -01 -00 -02 -00 -00 -00 -06 -00 -89 -1b -01 -00 -02 -00 -00 -00 -06 -00 -8d -1b -01 -00 -02 -00 -00 -00 -06 -00 -91 -1b -01 -00 -02 -00 -00 -00 -06 -00 -95 -1b -01 -00 -02 -00 -00 -00 -06 -00 -99 -1b -01 -00 -02 -00 -00 -00 -06 -00 -9d -1b -01 -00 -02 -00 -00 -00 -06 -00 -a1 -1b -01 -00 -02 -00 -00 -00 -06 -00 -a5 -1b -01 -00 -02 -00 -00 -00 -06 -00 -a9 -1b -01 -00 -02 -00 -00 -00 -06 -00 -ad -1b -01 -00 -02 -00 -00 -00 -06 -00 -b1 -1b -01 -00 -02 -00 -00 -00 -06 -00 -b5 -1b -01 -00 -02 -00 -00 -00 -06 -00 -b9 -1b -01 -00 -02 -00 -00 -00 -06 -00 -bd -1b -01 -00 -02 -00 -00 -00 -06 -00 -c1 -1b -01 -00 -02 -00 -00 -00 -06 -00 -c5 -1b -01 -00 -02 -00 -00 -00 -06 -00 -c9 -1b -01 -00 -02 -00 -00 -00 -06 -00 -cd -1b -01 -00 -02 -00 -00 -00 -06 -00 -d1 -1b -01 -00 -02 -00 -00 -00 -06 -00 -d5 -1b -01 -00 -02 -00 -00 -00 -06 -00 -d9 -1b -01 -00 -02 -00 -00 -00 -06 -00 -dd -1b -01 -00 -02 -00 -00 -00 -06 -00 -e1 -1b -01 -00 -02 -00 -00 -00 -06 -00 -e5 -1b -01 -00 -02 -00 -00 -00 -06 -00 -e9 -1b -01 -00 -02 -00 -00 -00 -06 -00 -ed -1b -01 -00 -02 -00 -00 -00 -06 -00 -f1 -1b -01 -00 -02 -00 -00 -00 -06 -00 -f5 -1b -01 -00 -02 -00 -00 -00 -06 -00 -f9 -1b -01 -00 -02 -00 -00 -00 -06 -00 -fd -1b -01 -00 -02 -00 -00 -00 -06 -00 -01 -1c -01 -00 -02 -00 -00 -00 -06 -00 -05 -1c -01 -00 -02 -00 -00 -00 -06 -00 -09 -1c -01 -00 -02 -00 -00 -00 -06 -00 -0d -1c -01 -00 -02 -00 -00 -00 -06 -00 -11 -1c -01 -00 -02 -00 -00 -00 -06 -00 -15 -1c -01 -00 -02 -00 -00 -00 -06 -00 -19 -1c -01 -00 -02 -00 -00 -00 -06 -00 -1d -1c -01 -00 -02 -00 -00 -00 -06 -00 -21 -1c -01 -00 -02 -00 -00 -00 -06 -00 -25 -1c -01 -00 -02 -00 -00 -00 -06 -00 -29 -1c -01 -00 -02 -00 -00 -00 -06 -00 -2d -1c -01 -00 -02 -00 -00 -00 -06 -00 -31 -1c -01 -00 -02 -00 -00 -00 -06 -00 -35 -1c -01 +00 00 02 00 @@ -95429,639 +86569,9 @@ fd 00 06 00 +40 39 -1c -01 -00 -02 -00 -00 -00 -06 -00 -3d -1c -01 -00 -02 -00 -00 -00 -06 -00 -41 -1c -01 -00 -02 -00 -00 -00 -06 -00 -45 -1c -01 -00 -02 -00 -00 -00 -06 -00 -49 -1c -01 -00 -02 -00 -00 -00 -06 -00 -4d -1c -01 -00 -02 -00 -00 -00 -06 -00 -51 -1c -01 -00 -02 -00 -00 -00 -06 -00 -55 -1c -01 -00 -02 -00 -00 -00 -06 -00 -59 -1c -01 -00 -02 -00 -00 -00 -06 -00 -5d -1c -01 -00 -02 -00 -00 -00 -06 -00 -61 -1c -01 -00 -02 -00 -00 -00 -06 -00 -65 -1c -01 -00 -02 -00 -00 -00 -06 -00 -69 -1c -01 -00 -02 -00 -00 -00 -06 -00 -6d -1c -01 -00 -02 -00 -00 -00 -06 -00 -71 -1c -01 -00 -02 -00 -00 -00 -06 -00 -75 -1c -01 -00 -02 -00 -00 -00 -06 -00 -79 -1c -01 -00 -02 -00 -00 -00 -06 -00 -7d -1c -01 -00 -02 -00 -00 -00 -06 -00 -81 -1c -01 -00 -02 -00 -00 -00 -06 -00 -85 -1c -01 -00 -02 -00 -00 -00 -06 -00 -89 -1c -01 -00 -02 -00 -00 -00 -06 -00 -8d -1c -01 -00 -02 -00 -00 -00 -06 -00 -91 -1c -01 -00 -02 -00 -00 -00 -06 -00 -95 -1c -01 -00 -02 -00 -00 -00 -06 -00 -99 -1c -01 -00 -02 -00 -00 -00 -06 -00 -9d -1c -01 -00 -02 -00 -00 -00 -06 -00 -a1 -1c -01 -00 -02 -00 -00 -00 -06 -00 -a5 -1c -01 -00 -02 -00 -00 -00 -06 -00 -a9 -1c -01 -00 -02 -00 -00 -00 -06 -00 -ad -1c -01 -00 -02 -00 -00 -00 -06 -00 -b1 -1c -01 -00 -02 -00 -00 -00 -06 -00 -b5 -1c -01 -00 -02 -00 -00 -00 -06 -00 -b9 -1c -01 -00 -02 -00 -00 -00 -06 -00 -bd -1c -01 -00 -02 -00 -00 -00 -06 -00 -c1 -1c -01 -00 -02 -00 -00 -00 -06 -00 -c5 -1c -01 -00 -02 -00 -00 -00 -06 -00 -c9 -1c -01 -00 -02 -00 -00 -00 -06 -00 -cd -1c -01 -00 -02 -00 -00 -00 -06 -00 -d1 -1c -01 -00 -02 -00 -00 -00 -06 -00 -d5 -1c -01 -00 -02 -00 -00 -00 -06 -00 -d9 -1c -01 -00 -02 -00 -00 -00 -06 -00 -dd -1c -01 -00 -02 -00 -00 -00 -06 -00 -e1 -1c -01 -00 -02 -00 -00 -00 -06 -00 -e5 -1c -01 -00 -02 -00 -00 -00 -06 -00 -e9 -1c -01 -00 -02 -00 -00 -00 -06 -00 -ed -1c -01 -00 -02 -00 -00 -00 -06 -00 -f1 -1c -01 -00 -02 -00 -00 -00 -06 -00 -f5 -1c -01 -00 -02 -00 -00 -00 -06 -00 -f9 -1c -01 -00 -02 -00 -00 -00 -06 -00 -fd -1c -01 -00 -02 -00 -00 -00 -06 -00 -01 -1d -01 -00 -02 -00 -00 -00 -06 -00 -05 -1d -01 -00 -02 -00 -00 -00 -06 -00 -09 -1d -01 -00 -02 -00 -00 -00 -06 -00 -0d -1d -01 -00 -02 -00 -00 -00 -06 -00 -11 -1d -01 -00 -02 -00 -00 -00 -06 -00 -15 -1d -01 -00 -02 -00 -00 -00 -06 -00 -19 -1d -01 -00 -02 -00 -00 -00 -06 -00 -1d -1d -01 -00 -02 -00 -00 -00 -06 -00 -21 -1d -01 -00 -02 -00 -00 -00 -06 -00 -25 -1d -01 -00 -02 -00 -00 -00 -06 -00 -29 -1d -01 -00 -02 -00 -00 -00 -06 -00 -2d -1d -01 -00 -02 -00 -00 -00 -06 -00 -31 -1d -01 -00 -02 -00 -00 -00 -06 -00 -35 -1d -01 +00 00 02 00 @@ -96069,639 +86579,9 @@ fd 00 06 00 +44 39 -1d -01 -00 -02 -00 -00 -00 -06 -00 -3d -1d -01 -00 -02 -00 -00 -00 -06 -00 -41 -1d -01 -00 -02 -00 -00 -00 -06 -00 -45 -1d -01 -00 -02 -00 -00 -00 -06 -00 -49 -1d -01 -00 -02 -00 -00 -00 -06 -00 -4d -1d -01 -00 -02 -00 -00 -00 -06 -00 -51 -1d -01 -00 -02 -00 -00 -00 -06 -00 -55 -1d -01 -00 -02 -00 -00 -00 -06 -00 -59 -1d -01 -00 -02 -00 -00 -00 -06 -00 -5d -1d -01 -00 -02 -00 -00 -00 -06 -00 -61 -1d -01 -00 -02 -00 -00 -00 -06 -00 -65 -1d -01 -00 -02 -00 -00 -00 -06 -00 -69 -1d -01 -00 -02 -00 -00 -00 -06 -00 -6d -1d -01 -00 -02 -00 -00 -00 -06 -00 -71 -1d -01 -00 -02 -00 -00 -00 -06 -00 -75 -1d -01 -00 -02 -00 -00 -00 -06 -00 -79 -1d -01 -00 -02 -00 -00 -00 -06 -00 -7d -1d -01 -00 -02 -00 -00 -00 -06 -00 -81 -1d -01 -00 -02 -00 -00 -00 -06 -00 -85 -1d -01 -00 -02 -00 -00 -00 -06 -00 -89 -1d -01 -00 -02 -00 -00 -00 -06 -00 -8d -1d -01 -00 -02 -00 -00 -00 -06 -00 -91 -1d -01 -00 -02 -00 -00 -00 -06 -00 -95 -1d -01 -00 -02 -00 -00 -00 -06 -00 -99 -1d -01 -00 -02 -00 -00 -00 -06 -00 -9d -1d -01 -00 -02 -00 -00 -00 -06 -00 -a1 -1d -01 -00 -02 -00 -00 -00 -06 -00 -a5 -1d -01 -00 -02 -00 -00 -00 -06 -00 -a9 -1d -01 -00 -02 -00 -00 -00 -06 -00 -ad -1d -01 -00 -02 -00 -00 -00 -06 -00 -b1 -1d -01 -00 -02 -00 -00 -00 -06 -00 -b5 -1d -01 -00 -02 -00 -00 -00 -06 -00 -b9 -1d -01 -00 -02 -00 -00 -00 -06 -00 -bd -1d -01 -00 -02 -00 -00 -00 -06 -00 -c1 -1d -01 -00 -02 -00 -00 -00 -06 -00 -c5 -1d -01 -00 -02 -00 -00 -00 -06 -00 -c9 -1d -01 -00 -02 -00 -00 -00 -06 -00 -cd -1d -01 -00 -02 -00 -00 -00 -06 -00 -d1 -1d -01 -00 -02 -00 -00 -00 -06 -00 -d5 -1d -01 -00 -02 -00 -00 -00 -06 -00 -d9 -1d -01 -00 -02 -00 -00 -00 -06 -00 -dd -1d -01 -00 -02 -00 -00 -00 -06 -00 -e1 -1d -01 -00 -02 -00 -00 -00 -06 -00 -e5 -1d -01 -00 -02 -00 -00 -00 -06 -00 -e9 -1d -01 -00 -02 -00 -00 -00 -06 -00 -ed -1d -01 -00 -02 -00 -00 -00 -06 -00 -f1 -1d -01 -00 -02 -00 -00 -00 -06 -00 -f5 -1d -01 -00 -02 -00 -00 -00 -06 -00 -f9 -1d -01 -00 -02 -00 -00 -00 -06 -00 -fd -1d -01 -00 -02 -00 -00 -00 -06 -00 -01 -1e -01 -00 -02 -00 -00 -00 -06 -00 -05 -1e -01 -00 -02 -00 -00 -00 -06 -00 -09 -1e -01 -00 -02 -00 -00 -00 -06 -00 -0d -1e -01 -00 -02 -00 -00 -00 -06 -00 -11 -1e -01 -00 -02 -00 -00 -00 -06 -00 -15 -1e -01 -00 -02 -00 -00 -00 -06 -00 -19 -1e -01 -00 -02 -00 -00 -00 -06 -00 -1d -1e -01 -00 -02 -00 -00 -00 -06 -00 -21 -1e -01 -00 -02 -00 -00 -00 -06 -00 -25 -1e -01 -00 -02 -00 -00 -00 -06 -00 -29 -1e -01 -00 -02 -00 -00 -00 -06 -00 -2d -1e -01 -00 -02 -00 -00 -00 -06 -00 -31 -1e -01 -00 -02 -00 -00 -00 -06 -00 -35 -1e -01 +00 00 02 00 @@ -96709,639 +86589,9 @@ fd 00 06 00 +48 39 -1e -01 -00 -02 -00 -00 -00 -06 -00 -3d -1e -01 -00 -02 -00 -00 -00 -06 -00 -41 -1e -01 -00 -02 -00 -00 -00 -06 -00 -45 -1e -01 -00 -02 -00 -00 -00 -06 -00 -49 -1e -01 -00 -02 -00 -00 -00 -06 -00 -4d -1e -01 -00 -02 -00 -00 -00 -06 -00 -51 -1e -01 -00 -02 -00 -00 -00 -06 -00 -55 -1e -01 -00 -02 -00 -00 -00 -06 -00 -59 -1e -01 -00 -02 -00 -00 -00 -06 -00 -5d -1e -01 -00 -02 -00 -00 -00 -06 -00 -61 -1e -01 -00 -02 -00 -00 -00 -06 -00 -65 -1e -01 -00 -02 -00 -00 -00 -06 -00 -69 -1e -01 -00 -02 -00 -00 -00 -06 -00 -6d -1e -01 -00 -02 -00 -00 -00 -06 -00 -71 -1e -01 -00 -02 -00 -00 -00 -06 -00 -75 -1e -01 -00 -02 -00 -00 -00 -06 -00 -79 -1e -01 -00 -02 -00 -00 -00 -06 -00 -7d -1e -01 -00 -02 -00 -00 -00 -06 -00 -81 -1e -01 -00 -02 -00 -00 -00 -06 -00 -85 -1e -01 -00 -02 -00 -00 -00 -06 -00 -89 -1e -01 -00 -02 -00 -00 -00 -06 -00 -8d -1e -01 -00 -02 -00 -00 -00 -06 -00 -91 -1e -01 -00 -02 -00 -00 -00 -06 -00 -95 -1e -01 -00 -02 -00 -00 -00 -06 -00 -99 -1e -01 -00 -02 -00 -00 -00 -06 -00 -9d -1e -01 -00 -02 -00 -00 -00 -06 -00 -a1 -1e -01 -00 -02 -00 -00 -00 -06 -00 -a5 -1e -01 -00 -02 -00 -00 -00 -06 -00 -a9 -1e -01 -00 -02 -00 -00 -00 -06 -00 -ad -1e -01 -00 -02 -00 -00 -00 -06 -00 -b1 -1e -01 -00 -02 -00 -00 -00 -06 -00 -b5 -1e -01 -00 -02 -00 -00 -00 -06 -00 -b9 -1e -01 -00 -02 -00 -00 -00 -06 -00 -bd -1e -01 -00 -02 -00 -00 -00 -06 -00 -c1 -1e -01 -00 -02 -00 -00 -00 -06 -00 -c5 -1e -01 -00 -02 -00 -00 -00 -06 -00 -c9 -1e -01 -00 -02 -00 -00 -00 -06 -00 -cd -1e -01 -00 -02 -00 -00 -00 -06 -00 -d1 -1e -01 -00 -02 -00 -00 -00 -06 -00 -d5 -1e -01 -00 -02 -00 -00 -00 -06 -00 -d9 -1e -01 -00 -02 -00 -00 -00 -06 -00 -dd -1e -01 -00 -02 -00 -00 -00 -06 -00 -e1 -1e -01 -00 -02 -00 -00 -00 -06 -00 -e5 -1e -01 -00 -02 -00 -00 -00 -06 -00 -e9 -1e -01 -00 -02 -00 -00 -00 -06 -00 -ed -1e -01 -00 -02 -00 -00 -00 -06 -00 -f1 -1e -01 -00 -02 -00 -00 -00 -06 -00 -f5 -1e -01 -00 -02 -00 -00 -00 -06 -00 -f9 -1e -01 -00 -02 -00 -00 -00 -06 -00 -fd -1e -01 -00 -02 -00 -00 -00 -06 -00 -01 -1f -01 -00 -02 -00 -00 -00 -06 -00 -05 -1f -01 -00 -02 -00 -00 -00 -06 -00 -09 -1f -01 -00 -02 -00 -00 -00 -06 -00 -0d -1f -01 -00 -02 -00 -00 -00 -06 -00 -11 -1f -01 -00 -02 -00 -00 -00 -06 -00 -15 -1f -01 -00 -02 -00 -00 -00 -06 -00 -19 -1f -01 -00 -02 -00 -00 -00 -06 -00 -1d -1f -01 -00 -02 -00 -00 -00 -06 -00 -21 -1f -01 -00 -02 -00 -00 -00 -06 -00 -25 -1f -01 -00 -02 -00 -00 -00 -06 -00 -29 -1f -01 -00 -02 -00 -00 -00 -06 -00 -2d -1f -01 -00 -02 -00 -00 -00 -06 -00 -31 -1f -01 -00 -02 -00 -00 -00 -06 -00 -35 -1f -01 +00 00 02 00 @@ -97349,639 +86599,9 @@ fd 00 06 00 +4c 39 -1f -01 -00 -02 -00 -00 -00 -06 -00 -3d -1f -01 -00 -02 -00 -00 -00 -06 -00 -41 -1f -01 -00 -02 -00 -00 -00 -06 -00 -45 -1f -01 -00 -02 -00 -00 -00 -06 -00 -49 -1f -01 -00 -02 -00 -00 -00 -06 -00 -4d -1f -01 -00 -02 -00 -00 -00 -06 -00 -51 -1f -01 -00 -02 -00 -00 -00 -06 -00 -55 -1f -01 -00 -02 -00 -00 -00 -06 -00 -59 -1f -01 -00 -02 -00 -00 -00 -06 -00 -5d -1f -01 -00 -02 -00 -00 -00 -06 -00 -61 -1f -01 -00 -02 -00 -00 -00 -06 -00 -65 -1f -01 -00 -02 -00 -00 -00 -06 -00 -69 -1f -01 -00 -02 -00 -00 -00 -06 -00 -6d -1f -01 -00 -02 -00 -00 -00 -06 -00 -71 -1f -01 -00 -02 -00 -00 -00 -06 -00 -75 -1f -01 -00 -02 -00 -00 -00 -06 -00 -79 -1f -01 -00 -02 -00 -00 -00 -06 -00 -7d -1f -01 -00 -02 -00 -00 -00 -06 -00 -81 -1f -01 -00 -02 -00 -00 -00 -06 -00 -85 -1f -01 -00 -02 -00 -00 -00 -06 -00 -89 -1f -01 -00 -02 -00 -00 -00 -06 -00 -8d -1f -01 -00 -02 -00 -00 -00 -06 -00 -91 -1f -01 -00 -02 -00 -00 -00 -06 -00 -95 -1f -01 -00 -02 -00 -00 -00 -06 -00 -99 -1f -01 -00 -02 -00 -00 -00 -06 -00 -9d -1f -01 -00 -02 -00 -00 -00 -06 -00 -a1 -1f -01 -00 -02 -00 -00 -00 -06 -00 -a5 -1f -01 -00 -02 -00 -00 -00 -06 -00 -a9 -1f -01 -00 -02 -00 -00 -00 -06 -00 -ad -1f -01 -00 -02 -00 -00 -00 -06 -00 -b1 -1f -01 -00 -02 -00 -00 -00 -06 -00 -b5 -1f -01 -00 -02 -00 -00 -00 -06 -00 -b9 -1f -01 -00 -02 -00 -00 -00 -06 -00 -bd -1f -01 -00 -02 -00 -00 -00 -06 -00 -c1 -1f -01 -00 -02 -00 -00 -00 -06 -00 -c5 -1f -01 -00 -02 -00 -00 -00 -06 -00 -c9 -1f -01 -00 -02 -00 -00 -00 -06 -00 -cd -1f -01 -00 -02 -00 -00 -00 -06 -00 -d1 -1f -01 -00 -02 -00 -00 -00 -06 -00 -d5 -1f -01 -00 -02 -00 -00 -00 -06 -00 -d9 -1f -01 -00 -02 -00 -00 -00 -06 -00 -dd -1f -01 -00 -02 -00 -00 -00 -06 -00 -e1 -1f -01 -00 -02 -00 -00 -00 -06 -00 -e5 -1f -01 -00 -02 -00 -00 -00 -06 -00 -e9 -1f -01 -00 -02 -00 -00 -00 -06 -00 -ed -1f -01 -00 -02 -00 -00 -00 -06 -00 -f1 -1f -01 -00 -02 -00 -00 -00 -06 -00 -f5 -1f -01 -00 -02 -00 -00 -00 -06 -00 -f9 -1f -01 -00 -02 -00 -00 -00 -06 -00 -fd -1f -01 -00 -02 -00 -00 -00 -06 -00 -01 -20 -01 -00 -02 -00 -00 -00 -06 -00 -05 -20 -01 -00 -02 -00 -00 -00 -06 -00 -09 -20 -01 -00 -02 -00 -00 -00 -06 -00 -0d -20 -01 -00 -02 -00 -00 -00 -06 -00 -11 -20 -01 -00 -02 -00 -00 -00 -06 -00 -15 -20 -01 -00 -02 -00 -00 -00 -06 -00 -19 -20 -01 -00 -02 -00 -00 -00 -06 -00 -1d -20 -01 -00 -02 -00 -00 -00 -06 -00 -21 -20 -01 -00 -02 -00 -00 -00 -06 -00 -25 -20 -01 -00 -02 -00 -00 -00 -06 -00 -29 -20 -01 -00 -02 -00 -00 -00 -06 -00 -2d -20 -01 -00 -02 -00 -00 -00 -06 -00 -31 -20 -01 -00 -02 -00 -00 -00 -06 -00 -35 -20 -01 +00 00 02 00 @@ -97989,639 +86609,9 @@ fd 00 06 00 +50 39 -20 -01 -00 -02 -00 -00 -00 -06 -00 -3d -20 -01 -00 -02 -00 -00 -00 -06 -00 -41 -20 -01 -00 -02 -00 -00 -00 -06 -00 -45 -20 -01 -00 -02 -00 -00 -00 -06 -00 -49 -20 -01 -00 -02 -00 -00 -00 -06 -00 -4d -20 -01 -00 -02 -00 -00 -00 -06 -00 -51 -20 -01 -00 -02 -00 -00 -00 -06 -00 -55 -20 -01 -00 -02 -00 -00 -00 -06 -00 -59 -20 -01 -00 -02 -00 -00 -00 -06 -00 -5d -20 -01 -00 -02 -00 -00 -00 -06 -00 -61 -20 -01 -00 -02 -00 -00 -00 -06 -00 -65 -20 -01 -00 -02 -00 -00 -00 -06 -00 -69 -20 -01 -00 -02 -00 -00 -00 -06 -00 -6d -20 -01 -00 -02 -00 -00 -00 -06 -00 -71 -20 -01 -00 -02 -00 -00 -00 -06 -00 -75 -20 -01 -00 -02 -00 -00 -00 -06 -00 -79 -20 -01 -00 -02 -00 -00 -00 -06 -00 -7d -20 -01 -00 -02 -00 -00 -00 -06 -00 -81 -20 -01 -00 -02 -00 -00 -00 -06 -00 -85 -20 -01 -00 -02 -00 -00 -00 -06 -00 -89 -20 -01 -00 -02 -00 -00 -00 -06 -00 -8d -20 -01 -00 -02 -00 -00 -00 -06 -00 -91 -20 -01 -00 -02 -00 -00 -00 -06 -00 -95 -20 -01 -00 -02 -00 -00 -00 -06 -00 -99 -20 -01 -00 -02 -00 -00 -00 -06 -00 -9d -20 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -20 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -20 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -20 -01 -00 -02 -00 -00 -00 -06 -00 -ad -20 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -20 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -20 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -20 -01 -00 -02 -00 -00 -00 -06 -00 -bd -20 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -20 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -20 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -20 -01 -00 -02 -00 -00 -00 -06 -00 -cd -20 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -20 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -20 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -20 -01 -00 -02 -00 -00 -00 -06 -00 -dd -20 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -20 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -20 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -20 -01 -00 -02 -00 -00 -00 -06 -00 -ed -20 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -20 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -20 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -20 -01 -00 -02 -00 -00 -00 -06 -00 -fd -20 -01 -00 -02 -00 -00 -00 -06 -00 -01 -21 -01 -00 -02 -00 -00 -00 -06 -00 -05 -21 -01 -00 -02 -00 -00 -00 -06 -00 -09 -21 -01 -00 -02 -00 -00 -00 -06 -00 -0d -21 -01 -00 -02 -00 -00 -00 -06 -00 -11 -21 -01 -00 -02 -00 -00 -00 -06 -00 -15 -21 -01 -00 -02 -00 -00 -00 -06 -00 -19 -21 -01 -00 -02 -00 -00 -00 -06 -00 -1d -21 -01 -00 -02 -00 -00 -00 -06 -00 -21 -21 -01 -00 -02 -00 -00 -00 -06 -00 -25 -21 -01 -00 -02 -00 -00 -00 -06 -00 -29 -21 -01 -00 -02 -00 -00 -00 -06 -00 -2d -21 -01 -00 -02 -00 -00 -00 -06 -00 -31 -21 -01 -00 -02 -00 -00 -00 -06 -00 -35 -21 -01 +00 00 02 00 @@ -98629,639 +86619,9 @@ fd 00 06 00 +54 39 -21 -01 -00 -02 -00 -00 -00 -06 -00 -3d -21 -01 -00 -02 -00 -00 -00 -06 -00 -41 -21 -01 -00 -02 -00 -00 -00 -06 -00 -45 -21 -01 -00 -02 -00 -00 -00 -06 -00 -49 -21 -01 -00 -02 -00 -00 -00 -06 -00 -4d -21 -01 -00 -02 -00 -00 -00 -06 -00 -51 -21 -01 -00 -02 -00 -00 -00 -06 -00 -55 -21 -01 -00 -02 -00 -00 -00 -06 -00 -59 -21 -01 -00 -02 -00 -00 -00 -06 -00 -5d -21 -01 -00 -02 -00 -00 -00 -06 -00 -61 -21 -01 -00 -02 -00 -00 -00 -06 -00 -65 -21 -01 -00 -02 -00 -00 -00 -06 -00 -69 -21 -01 -00 -02 -00 -00 -00 -06 -00 -6d -21 -01 -00 -02 -00 -00 -00 -06 -00 -71 -21 -01 -00 -02 -00 -00 -00 -06 -00 -75 -21 -01 -00 -02 -00 -00 -00 -06 -00 -79 -21 -01 -00 -02 -00 -00 -00 -06 -00 -7d -21 -01 -00 -02 -00 -00 -00 -06 -00 -81 -21 -01 -00 -02 -00 -00 -00 -06 -00 -85 -21 -01 -00 -02 -00 -00 -00 -06 -00 -89 -21 -01 -00 -02 -00 -00 -00 -06 -00 -8d -21 -01 -00 -02 -00 -00 -00 -06 -00 -91 -21 -01 -00 -02 -00 -00 -00 -06 -00 -95 -21 -01 -00 -02 -00 -00 -00 -06 -00 -99 -21 -01 -00 -02 -00 -00 -00 -06 -00 -9d -21 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -21 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -21 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -21 -01 -00 -02 -00 -00 -00 -06 -00 -ad -21 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -21 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -21 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -21 -01 -00 -02 -00 -00 -00 -06 -00 -bd -21 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -21 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -21 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -21 -01 -00 -02 -00 -00 -00 -06 -00 -cd -21 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -21 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -21 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -21 -01 -00 -02 -00 -00 -00 -06 -00 -dd -21 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -21 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -21 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -21 -01 -00 -02 -00 -00 -00 -06 -00 -ed -21 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -21 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -21 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -21 -01 -00 -02 -00 -00 -00 -06 -00 -fd -21 -01 -00 -02 -00 -00 -00 -06 -00 -01 -22 -01 -00 -02 -00 -00 -00 -06 -00 -05 -22 -01 -00 -02 -00 -00 -00 -06 -00 -09 -22 -01 -00 -02 -00 -00 -00 -06 -00 -0d -22 -01 -00 -02 -00 -00 -00 -06 -00 -11 -22 -01 -00 -02 -00 -00 -00 -06 -00 -15 -22 -01 -00 -02 -00 -00 -00 -06 -00 -19 -22 -01 -00 -02 -00 -00 -00 -06 -00 -1d -22 -01 -00 -02 -00 -00 -00 -06 -00 -21 -22 -01 -00 -02 -00 -00 -00 -06 -00 -25 -22 -01 -00 -02 -00 -00 -00 -06 -00 -29 -22 -01 -00 -02 -00 -00 -00 -06 -00 -2d -22 -01 -00 -02 -00 -00 -00 -06 -00 -31 -22 -01 -00 -02 -00 -00 -00 -06 -00 -35 -22 -01 +00 00 02 00 @@ -99269,639 +86629,9 @@ fd 00 06 00 +58 39 -22 -01 -00 -02 -00 -00 -00 -06 -00 -3d -22 -01 -00 -02 -00 -00 -00 -06 -00 -41 -22 -01 -00 -02 -00 -00 -00 -06 -00 -45 -22 -01 -00 -02 -00 -00 -00 -06 -00 -49 -22 -01 -00 -02 -00 -00 -00 -06 -00 -4d -22 -01 -00 -02 -00 -00 -00 -06 -00 -51 -22 -01 -00 -02 -00 -00 -00 -06 -00 -55 -22 -01 -00 -02 -00 -00 -00 -06 -00 -59 -22 -01 -00 -02 -00 -00 -00 -06 -00 -5d -22 -01 -00 -02 -00 -00 -00 -06 -00 -61 -22 -01 -00 -02 -00 -00 -00 -06 -00 -65 -22 -01 -00 -02 -00 -00 -00 -06 -00 -69 -22 -01 -00 -02 -00 -00 -00 -06 -00 -6d -22 -01 -00 -02 -00 -00 -00 -06 -00 -71 -22 -01 -00 -02 -00 -00 -00 -06 -00 -75 -22 -01 -00 -02 -00 -00 -00 -06 -00 -79 -22 -01 -00 -02 -00 -00 -00 -06 -00 -7d -22 -01 -00 -02 -00 -00 -00 -06 -00 -81 -22 -01 -00 -02 -00 -00 -00 -06 -00 -85 -22 -01 -00 -02 -00 -00 -00 -06 -00 -89 -22 -01 -00 -02 -00 -00 -00 -06 -00 -8d -22 -01 -00 -02 -00 -00 -00 -06 -00 -91 -22 -01 -00 -02 -00 -00 -00 -06 -00 -95 -22 -01 -00 -02 -00 -00 -00 -06 -00 -99 -22 -01 -00 -02 -00 -00 -00 -06 -00 -9d -22 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -22 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -22 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -22 -01 -00 -02 -00 -00 -00 -06 -00 -ad -22 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -22 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -22 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -22 -01 -00 -02 -00 -00 -00 -06 -00 -bd -22 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -22 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -22 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -22 -01 -00 -02 -00 -00 -00 -06 -00 -cd -22 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -22 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -22 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -22 -01 -00 -02 -00 -00 -00 -06 -00 -dd -22 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -22 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -22 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -22 -01 -00 -02 -00 -00 -00 -06 -00 -ed -22 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -22 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -22 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -22 -01 -00 -02 -00 -00 -00 -06 -00 -fd -22 -01 -00 -02 -00 -00 -00 -06 -00 -01 -23 -01 -00 -02 -00 -00 -00 -06 -00 -05 -23 -01 -00 -02 -00 -00 -00 -06 -00 -09 -23 -01 -00 -02 -00 -00 -00 -06 -00 -0d -23 -01 -00 -02 -00 -00 -00 -06 -00 -11 -23 -01 -00 -02 -00 -00 -00 -06 -00 -15 -23 -01 -00 -02 -00 -00 -00 -06 -00 -19 -23 -01 -00 -02 -00 -00 -00 -06 -00 -1d -23 -01 -00 -02 -00 -00 -00 -06 -00 -21 -23 -01 -00 -02 -00 -00 -00 -06 -00 -25 -23 -01 -00 -02 -00 -00 -00 -06 -00 -29 -23 -01 -00 -02 -00 -00 -00 -06 -00 -2d -23 -01 -00 -02 -00 -00 -00 -06 -00 -31 -23 -01 -00 -02 -00 -00 -00 -06 -00 -35 -23 -01 +00 00 02 00 @@ -99909,639 +86639,9 @@ fd 00 06 00 +5c 39 -23 -01 -00 -02 -00 -00 -00 -06 -00 -3d -23 -01 -00 -02 -00 -00 -00 -06 -00 -41 -23 -01 -00 -02 -00 -00 -00 -06 -00 -45 -23 -01 -00 -02 -00 -00 -00 -06 -00 -49 -23 -01 -00 -02 -00 -00 -00 -06 -00 -4d -23 -01 -00 -02 -00 -00 -00 -06 -00 -51 -23 -01 -00 -02 -00 -00 -00 -06 -00 -55 -23 -01 -00 -02 -00 -00 -00 -06 -00 -59 -23 -01 -00 -02 -00 -00 -00 -06 -00 -5d -23 -01 -00 -02 -00 -00 -00 -06 -00 -61 -23 -01 -00 -02 -00 -00 -00 -06 -00 -65 -23 -01 -00 -02 -00 -00 -00 -06 -00 -69 -23 -01 -00 -02 -00 -00 -00 -06 -00 -6d -23 -01 -00 -02 -00 -00 -00 -06 -00 -71 -23 -01 -00 -02 -00 -00 -00 -06 -00 -75 -23 -01 -00 -02 -00 -00 -00 -06 -00 -79 -23 -01 -00 -02 -00 -00 -00 -06 -00 -7d -23 -01 -00 -02 -00 -00 -00 -06 -00 -81 -23 -01 -00 -02 -00 -00 -00 -06 -00 -85 -23 -01 -00 -02 -00 -00 -00 -06 -00 -89 -23 -01 -00 -02 -00 -00 -00 -06 -00 -8d -23 -01 -00 -02 -00 -00 -00 -06 -00 -91 -23 -01 -00 -02 -00 -00 -00 -06 -00 -95 -23 -01 -00 -02 -00 -00 -00 -06 -00 -99 -23 -01 -00 -02 -00 -00 -00 -06 -00 -9d -23 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -23 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -23 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -23 -01 -00 -02 -00 -00 -00 -06 -00 -ad -23 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -23 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -23 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -23 -01 -00 -02 -00 -00 -00 -06 -00 -bd -23 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -23 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -23 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -23 -01 -00 -02 -00 -00 -00 -06 -00 -cd -23 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -23 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -23 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -23 -01 -00 -02 -00 -00 -00 -06 -00 -dd -23 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -23 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -23 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -23 -01 -00 -02 -00 -00 -00 -06 -00 -ed -23 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -23 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -23 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -23 -01 -00 -02 -00 -00 -00 -06 -00 -fd -23 -01 -00 -02 -00 -00 -00 -06 -00 -01 -24 -01 -00 -02 -00 -00 -00 -06 -00 -05 -24 -01 -00 -02 -00 -00 -00 -06 -00 -09 -24 -01 -00 -02 -00 -00 -00 -06 -00 -0d -24 -01 -00 -02 -00 -00 -00 -06 -00 -11 -24 -01 -00 -02 -00 -00 -00 -06 -00 -15 -24 -01 -00 -02 -00 -00 -00 -06 -00 -19 -24 -01 -00 -02 -00 -00 -00 -06 -00 -1d -24 -01 -00 -02 -00 -00 -00 -06 -00 -21 -24 -01 -00 -02 -00 -00 -00 -06 -00 -25 -24 -01 -00 -02 -00 -00 -00 -06 -00 -29 -24 -01 -00 -02 -00 -00 -00 -06 -00 -2d -24 -01 -00 -02 -00 -00 -00 -06 -00 -31 -24 -01 -00 -02 -00 -00 -00 -06 -00 -35 -24 -01 +00 00 02 00 @@ -100549,639 +86649,9 @@ fd 00 06 00 +60 39 -24 -01 -00 -02 -00 -00 -00 -06 -00 -3d -24 -01 -00 -02 -00 -00 -00 -06 -00 -41 -24 -01 -00 -02 -00 -00 -00 -06 -00 -45 -24 -01 -00 -02 -00 -00 -00 -06 -00 -49 -24 -01 -00 -02 -00 -00 -00 -06 -00 -4d -24 -01 -00 -02 -00 -00 -00 -06 -00 -51 -24 -01 -00 -02 -00 -00 -00 -06 -00 -55 -24 -01 -00 -02 -00 -00 -00 -06 -00 -59 -24 -01 -00 -02 -00 -00 -00 -06 -00 -5d -24 -01 -00 -02 -00 -00 -00 -06 -00 -61 -24 -01 -00 -02 -00 -00 -00 -06 -00 -65 -24 -01 -00 -02 -00 -00 -00 -06 -00 -69 -24 -01 -00 -02 -00 -00 -00 -06 -00 -6d -24 -01 -00 -02 -00 -00 -00 -06 -00 -71 -24 -01 -00 -02 -00 -00 -00 -06 -00 -75 -24 -01 -00 -02 -00 -00 -00 -06 -00 -79 -24 -01 -00 -02 -00 -00 -00 -06 -00 -7d -24 -01 -00 -02 -00 -00 -00 -06 -00 -81 -24 -01 -00 -02 -00 -00 -00 -06 -00 -85 -24 -01 -00 -02 -00 -00 -00 -06 -00 -89 -24 -01 -00 -02 -00 -00 -00 -06 -00 -8d -24 -01 -00 -02 -00 -00 -00 -06 -00 -91 -24 -01 -00 -02 -00 -00 -00 -06 -00 -95 -24 -01 -00 -02 -00 -00 -00 -06 -00 -99 -24 -01 -00 -02 -00 -00 -00 -06 -00 -9d -24 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -24 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -24 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -24 -01 -00 -02 -00 -00 -00 -06 -00 -ad -24 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -24 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -24 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -24 -01 -00 -02 -00 -00 -00 -06 -00 -bd -24 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -24 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -24 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -24 -01 -00 -02 -00 -00 -00 -06 -00 -cd -24 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -24 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -24 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -24 -01 -00 -02 -00 -00 -00 -06 -00 -dd -24 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -24 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -24 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -24 -01 -00 -02 -00 -00 -00 -06 -00 -ed -24 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -24 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -24 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -24 -01 -00 -02 -00 -00 -00 -06 -00 -fd -24 -01 -00 -02 -00 -00 -00 -06 -00 -01 -25 -01 -00 -02 -00 -00 -00 -06 -00 -05 -25 -01 -00 -02 -00 -00 -00 -06 -00 -09 -25 -01 -00 -02 -00 -00 -00 -06 -00 -0d -25 -01 -00 -02 -00 -00 -00 -06 -00 -11 -25 -01 -00 -02 -00 -00 -00 -06 -00 -15 -25 -01 -00 -02 -00 -00 -00 -06 -00 -19 -25 -01 -00 -02 -00 -00 -00 -06 -00 -1d -25 -01 -00 -02 -00 -00 -00 -06 -00 -21 -25 -01 -00 -02 -00 -00 -00 -06 -00 -25 -25 -01 -00 -02 -00 -00 -00 -06 -00 -29 -25 -01 -00 -02 -00 -00 -00 -06 -00 -2d -25 -01 -00 -02 -00 -00 -00 -06 -00 -31 -25 -01 -00 -02 -00 -00 -00 -06 -00 -35 -25 -01 +00 00 02 00 @@ -101189,639 +86659,9 @@ fd 00 06 00 +64 39 -25 -01 -00 -02 -00 -00 -00 -06 -00 -3d -25 -01 -00 -02 -00 -00 -00 -06 -00 -41 -25 -01 -00 -02 -00 -00 -00 -06 -00 -45 -25 -01 -00 -02 -00 -00 -00 -06 -00 -49 -25 -01 -00 -02 -00 -00 -00 -06 -00 -4d -25 -01 -00 -02 -00 -00 -00 -06 -00 -51 -25 -01 -00 -02 -00 -00 -00 -06 -00 -55 -25 -01 -00 -02 -00 -00 -00 -06 -00 -59 -25 -01 -00 -02 -00 -00 -00 -06 -00 -5d -25 -01 -00 -02 -00 -00 -00 -06 -00 -61 -25 -01 -00 -02 -00 -00 -00 -06 -00 -65 -25 -01 -00 -02 -00 -00 -00 -06 -00 -69 -25 -01 -00 -02 -00 -00 -00 -06 -00 -6d -25 -01 -00 -02 -00 -00 -00 -06 -00 -71 -25 -01 -00 -02 -00 -00 -00 -06 -00 -75 -25 -01 -00 -02 -00 -00 -00 -06 -00 -79 -25 -01 -00 -02 -00 -00 -00 -06 -00 -7d -25 -01 -00 -02 -00 -00 -00 -06 -00 -81 -25 -01 -00 -02 -00 -00 -00 -06 -00 -85 -25 -01 -00 -02 -00 -00 -00 -06 -00 -89 -25 -01 -00 -02 -00 -00 -00 -06 -00 -8d -25 -01 -00 -02 -00 -00 -00 -06 -00 -91 -25 -01 -00 -02 -00 -00 -00 -06 -00 -95 -25 -01 -00 -02 -00 -00 -00 -06 -00 -99 -25 -01 -00 -02 -00 -00 -00 -06 -00 -9d -25 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -25 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -25 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -25 -01 -00 -02 -00 -00 -00 -06 -00 -ad -25 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -25 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -25 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -25 -01 -00 -02 -00 -00 -00 -06 -00 -bd -25 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -25 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -25 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -25 -01 -00 -02 -00 -00 -00 -06 -00 -cd -25 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -25 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -25 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -25 -01 -00 -02 -00 -00 -00 -06 -00 -dd -25 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -25 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -25 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -25 -01 -00 -02 -00 -00 -00 -06 -00 -ed -25 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -25 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -25 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -25 -01 -00 -02 -00 -00 -00 -06 -00 -fd -25 -01 -00 -02 -00 -00 -00 -06 -00 -01 -26 -01 -00 -02 -00 -00 -00 -06 -00 -05 -26 -01 -00 -02 -00 -00 -00 -06 -00 -09 -26 -01 -00 -02 -00 -00 -00 -06 -00 -0d -26 -01 -00 -02 -00 -00 -00 -06 -00 -11 -26 -01 -00 -02 -00 -00 -00 -06 -00 -15 -26 -01 -00 -02 -00 -00 -00 -06 -00 -19 -26 -01 -00 -02 -00 -00 -00 -06 -00 -1d -26 -01 -00 -02 -00 -00 -00 -06 -00 -21 -26 -01 -00 -02 -00 -00 -00 -06 -00 -25 -26 -01 -00 -02 -00 -00 -00 -06 -00 -29 -26 -01 -00 -02 -00 -00 -00 -06 -00 -2d -26 -01 -00 -02 -00 -00 -00 -06 -00 -31 -26 -01 -00 -02 -00 -00 -00 -06 -00 -35 -26 -01 +00 00 02 00 @@ -101829,639 +86669,9 @@ fd 00 06 00 +68 39 -26 -01 -00 -02 -00 -00 -00 -06 -00 -3d -26 -01 -00 -02 -00 -00 -00 -06 -00 -41 -26 -01 -00 -02 -00 -00 -00 -06 -00 -45 -26 -01 -00 -02 -00 -00 -00 -06 -00 -49 -26 -01 -00 -02 -00 -00 -00 -06 -00 -4d -26 -01 -00 -02 -00 -00 -00 -06 -00 -51 -26 -01 -00 -02 -00 -00 -00 -06 -00 -55 -26 -01 -00 -02 -00 -00 -00 -06 -00 -59 -26 -01 -00 -02 -00 -00 -00 -06 -00 -5d -26 -01 -00 -02 -00 -00 -00 -06 -00 -61 -26 -01 -00 -02 -00 -00 -00 -06 -00 -65 -26 -01 -00 -02 -00 -00 -00 -06 -00 -69 -26 -01 -00 -02 -00 -00 -00 -06 -00 -6d -26 -01 -00 -02 -00 -00 -00 -06 -00 -71 -26 -01 -00 -02 -00 -00 -00 -06 -00 -75 -26 -01 -00 -02 -00 -00 -00 -06 -00 -79 -26 -01 -00 -02 -00 -00 -00 -06 -00 -7d -26 -01 -00 -02 -00 -00 -00 -06 -00 -81 -26 -01 -00 -02 -00 -00 -00 -06 -00 -85 -26 -01 -00 -02 -00 -00 -00 -06 -00 -89 -26 -01 -00 -02 -00 -00 -00 -06 -00 -8d -26 -01 -00 -02 -00 -00 -00 -06 -00 -91 -26 -01 -00 -02 -00 -00 -00 -06 -00 -95 -26 -01 -00 -02 -00 -00 -00 -06 -00 -99 -26 -01 -00 -02 -00 -00 -00 -06 -00 -9d -26 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -26 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -26 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -26 -01 -00 -02 -00 -00 -00 -06 -00 -ad -26 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -26 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -26 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -26 -01 -00 -02 -00 -00 -00 -06 -00 -bd -26 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -26 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -26 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -26 -01 -00 -02 -00 -00 -00 -06 -00 -cd -26 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -26 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -26 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -26 -01 -00 -02 -00 -00 -00 -06 -00 -dd -26 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -26 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -26 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -26 -01 -00 -02 -00 -00 -00 -06 -00 -ed -26 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -26 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -26 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -26 -01 -00 -02 -00 -00 -00 -06 -00 -fd -26 -01 -00 -02 -00 -00 -00 -06 -00 -01 -27 -01 -00 -02 -00 -00 -00 -06 -00 -05 -27 -01 -00 -02 -00 -00 -00 -06 -00 -09 -27 -01 -00 -02 -00 -00 -00 -06 -00 -0d -27 -01 -00 -02 -00 -00 -00 -06 -00 -11 -27 -01 -00 -02 -00 -00 -00 -06 -00 -15 -27 -01 -00 -02 -00 -00 -00 -06 -00 -19 -27 -01 -00 -02 -00 -00 -00 -06 -00 -1d -27 -01 -00 -02 -00 -00 -00 -06 -00 -21 -27 -01 -00 -02 -00 -00 -00 -06 -00 -25 -27 -01 -00 -02 -00 -00 -00 -06 -00 -29 -27 -01 -00 -02 -00 -00 -00 -06 -00 -2d -27 -01 -00 -02 -00 -00 -00 -06 -00 -31 -27 -01 -00 -02 -00 -00 -00 -06 -00 -35 -27 -01 +00 00 02 00 @@ -102469,639 +86679,9 @@ fd 00 06 00 +6c 39 -27 -01 -00 -02 -00 -00 -00 -06 -00 -3d -27 -01 -00 -02 -00 -00 -00 -06 -00 -41 -27 -01 -00 -02 -00 -00 -00 -06 -00 -45 -27 -01 -00 -02 -00 -00 -00 -06 -00 -49 -27 -01 -00 -02 -00 -00 -00 -06 -00 -4d -27 -01 -00 -02 -00 -00 -00 -06 -00 -51 -27 -01 -00 -02 -00 -00 -00 -06 -00 -55 -27 -01 -00 -02 -00 -00 -00 -06 -00 -59 -27 -01 -00 -02 -00 -00 -00 -06 -00 -5d -27 -01 -00 -02 -00 -00 -00 -06 -00 -61 -27 -01 -00 -02 -00 -00 -00 -06 -00 -65 -27 -01 -00 -02 -00 -00 -00 -06 -00 -69 -27 -01 -00 -02 -00 -00 -00 -06 -00 -6d -27 -01 -00 -02 -00 -00 -00 -06 -00 -71 -27 -01 -00 -02 -00 -00 -00 -06 -00 -75 -27 -01 -00 -02 -00 -00 -00 -06 -00 -79 -27 -01 -00 -02 -00 -00 -00 -06 -00 -7d -27 -01 -00 -02 -00 -00 -00 -06 -00 -81 -27 -01 -00 -02 -00 -00 -00 -06 -00 -85 -27 -01 -00 -02 -00 -00 -00 -06 -00 -89 -27 -01 -00 -02 -00 -00 -00 -06 -00 -8d -27 -01 -00 -02 -00 -00 -00 -06 -00 -91 -27 -01 -00 -02 -00 -00 -00 -06 -00 -95 -27 -01 -00 -02 -00 -00 -00 -06 -00 -99 -27 -01 -00 -02 -00 -00 -00 -06 -00 -9d -27 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -27 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -27 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -27 -01 -00 -02 -00 -00 -00 -06 -00 -ad -27 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -27 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -27 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -27 -01 -00 -02 -00 -00 -00 -06 -00 -bd -27 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -27 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -27 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -27 -01 -00 -02 -00 -00 -00 -06 -00 -cd -27 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -27 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -27 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -27 -01 -00 -02 -00 -00 -00 -06 -00 -dd -27 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -27 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -27 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -27 -01 -00 -02 -00 -00 -00 -06 -00 -ed -27 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -27 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -27 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -27 -01 -00 -02 -00 -00 -00 -06 -00 -fd -27 -01 -00 -02 -00 -00 -00 -06 -00 -01 -28 -01 -00 -02 -00 -00 -00 -06 -00 -05 -28 -01 -00 -02 -00 -00 -00 -06 -00 -09 -28 -01 -00 -02 -00 -00 -00 -06 -00 -0d -28 -01 -00 -02 -00 -00 -00 -06 -00 -11 -28 -01 -00 -02 -00 -00 -00 -06 -00 -15 -28 -01 -00 -02 -00 -00 -00 -06 -00 -19 -28 -01 -00 -02 -00 -00 -00 -06 -00 -1d -28 -01 -00 -02 -00 -00 -00 -06 -00 -21 -28 -01 -00 -02 -00 -00 -00 -06 -00 -25 -28 -01 -00 -02 -00 -00 -00 -06 -00 -29 -28 -01 -00 -02 -00 -00 -00 -06 -00 -2d -28 -01 -00 -02 -00 -00 -00 -06 -00 -31 -28 -01 -00 -02 -00 -00 -00 -06 -00 -35 -28 -01 +00 00 02 00 @@ -103109,639 +86689,9 @@ fd 00 06 00 +70 39 -28 -01 -00 -02 -00 -00 -00 -06 -00 -3d -28 -01 -00 -02 -00 -00 -00 -06 -00 -41 -28 -01 -00 -02 -00 -00 -00 -06 -00 -45 -28 -01 -00 -02 -00 -00 -00 -06 -00 -49 -28 -01 -00 -02 -00 -00 -00 -06 -00 -4d -28 -01 -00 -02 -00 -00 -00 -06 -00 -51 -28 -01 -00 -02 -00 -00 -00 -06 -00 -55 -28 -01 -00 -02 -00 -00 -00 -06 -00 -59 -28 -01 -00 -02 -00 -00 -00 -06 -00 -5d -28 -01 -00 -02 -00 -00 -00 -06 -00 -61 -28 -01 -00 -02 -00 -00 -00 -06 -00 -65 -28 -01 -00 -02 -00 -00 -00 -06 -00 -69 -28 -01 -00 -02 -00 -00 -00 -06 -00 -6d -28 -01 -00 -02 -00 -00 -00 -06 -00 -71 -28 -01 -00 -02 -00 -00 -00 -06 -00 -75 -28 -01 -00 -02 -00 -00 -00 -06 -00 -79 -28 -01 -00 -02 -00 -00 -00 -06 -00 -7d -28 -01 -00 -02 -00 -00 -00 -06 -00 -81 -28 -01 -00 -02 -00 -00 -00 -06 -00 -85 -28 -01 -00 -02 -00 -00 -00 -06 -00 -89 -28 -01 -00 -02 -00 -00 -00 -06 -00 -8d -28 -01 -00 -02 -00 -00 -00 -06 -00 -91 -28 -01 -00 -02 -00 -00 -00 -06 -00 -95 -28 -01 -00 -02 -00 -00 -00 -06 -00 -99 -28 -01 -00 -02 -00 -00 -00 -06 -00 -9d -28 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -28 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -28 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -28 -01 -00 -02 -00 -00 -00 -06 -00 -ad -28 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -28 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -28 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -28 -01 -00 -02 -00 -00 -00 -06 -00 -bd -28 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -28 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -28 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -28 -01 -00 -02 -00 -00 -00 -06 -00 -cd -28 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -28 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -28 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -28 -01 -00 -02 -00 -00 -00 -06 -00 -dd -28 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -28 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -28 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -28 -01 -00 -02 -00 -00 -00 -06 -00 -ed -28 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -28 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -28 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -28 -01 -00 -02 -00 -00 -00 -06 -00 -fd -28 -01 -00 -02 -00 -00 -00 -06 -00 -01 -29 -01 -00 -02 -00 -00 -00 -06 -00 -05 -29 -01 -00 -02 -00 -00 -00 -06 -00 -09 -29 -01 -00 -02 -00 -00 -00 -06 -00 -0d -29 -01 -00 -02 -00 -00 -00 -06 -00 -11 -29 -01 -00 -02 -00 -00 -00 -06 -00 -15 -29 -01 -00 -02 -00 -00 -00 -06 -00 -19 -29 -01 -00 -02 -00 -00 -00 -06 -00 -1d -29 -01 -00 -02 -00 -00 -00 -06 -00 -21 -29 -01 -00 -02 -00 -00 -00 -06 -00 -25 -29 -01 -00 -02 -00 -00 -00 -06 -00 -29 -29 -01 -00 -02 -00 -00 -00 -06 -00 -2d -29 -01 -00 -02 -00 -00 -00 -06 -00 -31 -29 -01 -00 -02 -00 -00 -00 -06 -00 -35 -29 -01 +00 00 02 00 @@ -103749,639 +86699,9 @@ fd 00 06 00 +74 39 -29 -01 -00 -02 -00 -00 -00 -06 -00 -3d -29 -01 -00 -02 -00 -00 -00 -06 -00 -41 -29 -01 -00 -02 -00 -00 -00 -06 -00 -45 -29 -01 -00 -02 -00 -00 -00 -06 -00 -49 -29 -01 -00 -02 -00 -00 -00 -06 -00 -4d -29 -01 -00 -02 -00 -00 -00 -06 -00 -51 -29 -01 -00 -02 -00 -00 -00 -06 -00 -55 -29 -01 -00 -02 -00 -00 -00 -06 -00 -59 -29 -01 -00 -02 -00 -00 -00 -06 -00 -5d -29 -01 -00 -02 -00 -00 -00 -06 -00 -61 -29 -01 -00 -02 -00 -00 -00 -06 -00 -65 -29 -01 -00 -02 -00 -00 -00 -06 -00 -69 -29 -01 -00 -02 -00 -00 -00 -06 -00 -6d -29 -01 -00 -02 -00 -00 -00 -06 -00 -71 -29 -01 -00 -02 -00 -00 -00 -06 -00 -75 -29 -01 -00 -02 -00 -00 -00 -06 -00 -79 -29 -01 -00 -02 -00 -00 -00 -06 -00 -7d -29 -01 -00 -02 -00 -00 -00 -06 -00 -81 -29 -01 -00 -02 -00 -00 -00 -06 -00 -85 -29 -01 -00 -02 -00 -00 -00 -06 -00 -89 -29 -01 -00 -02 -00 -00 -00 -06 -00 -8d -29 -01 -00 -02 -00 -00 -00 -06 -00 -91 -29 -01 -00 -02 -00 -00 -00 -06 -00 -95 -29 -01 -00 -02 -00 -00 -00 -06 -00 -99 -29 -01 -00 -02 -00 -00 -00 -06 -00 -9d -29 -01 -00 -02 -00 -00 -00 -06 -00 -a1 -29 -01 -00 -02 -00 -00 -00 -06 -00 -a5 -29 -01 -00 -02 -00 -00 -00 -06 -00 -a9 -29 -01 -00 -02 -00 -00 -00 -06 -00 -ad -29 -01 -00 -02 -00 -00 -00 -06 -00 -b1 -29 -01 -00 -02 -00 -00 -00 -06 -00 -b5 -29 -01 -00 -02 -00 -00 -00 -06 -00 -b9 -29 -01 -00 -02 -00 -00 -00 -06 -00 -bd -29 -01 -00 -02 -00 -00 -00 -06 -00 -c1 -29 -01 -00 -02 -00 -00 -00 -06 -00 -c5 -29 -01 -00 -02 -00 -00 -00 -06 -00 -c9 -29 -01 -00 -02 -00 -00 -00 -06 -00 -cd -29 -01 -00 -02 -00 -00 -00 -06 -00 -d1 -29 -01 -00 -02 -00 -00 -00 -06 -00 -d5 -29 -01 -00 -02 -00 -00 -00 -06 -00 -d9 -29 -01 -00 -02 -00 -00 -00 -06 -00 -dd -29 -01 -00 -02 -00 -00 -00 -06 -00 -e1 -29 -01 -00 -02 -00 -00 -00 -06 -00 -e5 -29 -01 -00 -02 -00 -00 -00 -06 -00 -e9 -29 -01 -00 -02 -00 -00 -00 -06 -00 -ed -29 -01 -00 -02 -00 -00 -00 -06 -00 -f1 -29 -01 -00 -02 -00 -00 -00 -06 -00 -f5 -29 -01 -00 -02 -00 -00 -00 -06 -00 -f9 -29 -01 -00 -02 -00 -00 -00 -06 -00 -fd -29 -01 -00 -02 -00 -00 -00 -06 -00 -01 -2a -01 -00 -02 -00 -00 -00 -06 -00 -05 -2a -01 -00 -02 -00 -00 -00 -06 -00 -09 -2a -01 -00 -02 -00 -00 -00 -06 -00 -0d -2a -01 -00 -02 -00 -00 -00 -06 -00 -11 -2a -01 -00 -02 -00 -00 -00 -06 -00 -15 -2a -01 -00 -02 -00 -00 -00 -06 -00 -19 -2a -01 -00 -02 -00 -00 -00 -06 -00 -1d -2a -01 -00 -02 -00 -00 -00 -06 -00 -21 -2a -01 -00 -02 -00 -00 -00 -06 -00 -25 -2a -01 -00 -02 -00 -00 -00 -06 -00 -29 -2a -01 -00 -02 -00 -00 -00 -06 -00 -2d -2a -01 -00 -02 -00 -00 -00 -06 -00 -31 -2a -01 -00 -02 -00 -00 -00 -06 -00 -35 -2a -01 +00 00 02 00 @@ -104389,9 +86709,9 @@ fd 00 06 00 +78 39 -2a -01 +00 00 02 00 @@ -104399,9 +86719,1489 @@ fd 00 06 00 +7c +39 +00 +00 +02 +00 +00 +00 +06 +00 +80 +39 +00 +00 +02 +00 +00 +00 +06 +00 +84 +39 +00 +00 +02 +00 +00 +00 +06 +00 +88 +39 +00 +00 +02 +00 +00 +00 +06 +00 +8c +39 +00 +00 +02 +00 +00 +00 +06 +00 +90 +39 +00 +00 +02 +00 +00 +00 +06 +00 +94 +39 +00 +00 +02 +00 +00 +00 +06 +00 +98 +39 +00 +00 +02 +00 +00 +00 +06 +00 +9c +39 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +39 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +39 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +39 +00 +00 +02 +00 +00 +00 +06 +00 +ac +39 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +39 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +39 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +39 +00 +00 +02 +00 +00 +00 +06 +00 +bc +39 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +39 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +39 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +39 +00 +00 +02 +00 +00 +00 +06 +00 +00 +3b +00 +00 +02 +00 +00 +00 +06 +00 +04 +3b +00 +00 +02 +00 +00 +00 +06 +00 +08 +3b +00 +00 +02 +00 +00 +00 +06 +00 +0c +3b +00 +00 +02 +00 +00 +00 +06 +00 +10 +3b +00 +00 +02 +00 +00 +00 +06 +00 +14 +3b +00 +00 +02 +00 +00 +00 +06 +00 +18 +3b +00 +00 +02 +00 +00 +00 +06 +00 +1c +3b +00 +00 +02 +00 +00 +00 +06 +00 +20 +3b +00 +00 +02 +00 +00 +00 +06 +00 +24 +3b +00 +00 +02 +00 +00 +00 +06 +00 +28 +3b +00 +00 +02 +00 +00 +00 +06 +00 +2c +3b +00 +00 +02 +00 +00 +00 +06 +00 +30 +3b +00 +00 +02 +00 +00 +00 +06 +00 +34 +3b +00 +00 +02 +00 +00 +00 +06 +00 +38 +3b +00 +00 +02 +00 +00 +00 +06 +00 +3c +3b +00 +00 +02 +00 +00 +00 +06 +00 +40 +3b +00 +00 +02 +00 +00 +00 +06 +00 +44 +3b +00 +00 +02 +00 +00 +00 +06 +00 +48 +3b +00 +00 +02 +00 +00 +00 +06 +00 +4c +3b +00 +00 +02 +00 +00 +00 +06 +00 +50 +3b +00 +00 +02 +00 +00 +00 +06 +00 +54 +3b +00 +00 +02 +00 +00 +00 +06 +00 +58 +3b +00 +00 +02 +00 +00 +00 +06 +00 +5c +3b +00 +00 +02 +00 +00 +00 +06 +00 +60 +3b +00 +00 +02 +00 +00 +00 +06 +00 +64 +3b +00 +00 +02 +00 +00 +00 +06 +00 +68 +3b +00 +00 +02 +00 +00 +00 +06 +00 +6c +3b +00 +00 +02 +00 +00 +00 +06 +00 +70 +3b +00 +00 +02 +00 +00 +00 +06 +00 +74 +3b +00 +00 +02 +00 +00 +00 +06 +00 +78 +3b +00 +00 +02 +00 +00 +00 +06 +00 +7c +3b +00 +00 +02 +00 +00 +00 +06 +00 +80 +3b +00 +00 +02 +00 +00 +00 +06 +00 +84 +3b +00 +00 +02 +00 +00 +00 +06 +00 +88 +3b +00 +00 +02 +00 +00 +00 +06 +00 +8c +3b +00 +00 +02 +00 +00 +00 +06 +00 +90 +3b +00 +00 +02 +00 +00 +00 +06 +00 +94 +3b +00 +00 +02 +00 +00 +00 +06 +00 +98 +3b +00 +00 +02 +00 +00 +00 +06 +00 +9c +3b +00 +00 +02 +00 +00 +00 +06 +00 +a0 +3b +00 +00 +02 +00 +00 +00 +06 +00 +a4 +3b +00 +00 +02 +00 +00 +00 +06 +00 +a8 +3b +00 +00 +02 +00 +00 +00 +06 +00 +ac +3b +00 +00 +02 +00 +00 +00 +06 +00 +b0 +3b +00 +00 +02 +00 +00 +00 +06 +00 +b4 +3b +00 +00 +02 +00 +00 +00 +06 +00 +b8 +3b +00 +00 +02 +00 +00 +00 +06 +00 +bc +3b +00 +00 +02 +00 +00 +00 +06 +00 +c0 +3b +00 +00 +02 +00 +00 +00 +06 +00 +c4 +3b +00 +00 +02 +00 +00 +00 +06 +00 +c8 +3b +00 +00 +02 +00 +00 +00 +06 +00 +cc +3b +00 +00 +02 +00 +00 +00 +06 +00 +d0 +3b +00 +00 +02 +00 +00 +00 +06 +00 +d4 +3b +00 +00 +02 +00 +00 +00 +06 +00 +d8 +3b +00 +00 +02 +00 +00 +00 +06 +00 +dc +3b +00 +00 +02 +00 +00 +00 +06 +00 +e0 +3b +00 +00 +02 +00 +00 +00 +06 +00 +e4 +3b +00 +00 +02 +00 +00 +00 +06 +00 +e8 +3b +00 +00 +02 +00 +00 +00 +06 +00 +ec +3b +00 +00 +02 +00 +00 +00 +06 +00 +f0 +3b +00 +00 +02 +00 +00 +00 +06 +00 +f4 +3b +00 +00 +02 +00 +00 +00 +06 +00 +f8 +3b +00 +00 +02 +00 +00 +00 +06 +00 +fc +3b +00 +00 +02 +00 +00 +00 +06 +00 +00 +3c +00 +00 +02 +00 +00 +00 +06 +00 +04 +3c +00 +00 +02 +00 +00 +00 +06 +00 +08 +3c +00 +00 +02 +00 +00 +00 +06 +00 +0c +3c +00 +00 +02 +00 +00 +00 +06 +00 +10 +3c +00 +00 +02 +00 +00 +00 +06 +00 +14 +3c +00 +00 +02 +00 +00 +00 +06 +00 +18 +3c +00 +00 +02 +00 +00 +00 +06 +00 +1c +3c +00 +00 +02 +00 +00 +00 +06 +00 +20 +3c +00 +00 +02 +00 +00 +00 +06 +00 +24 +3c +00 +00 +02 +00 +00 +00 +06 +00 +28 +3c +00 +00 +02 +00 +00 +00 +06 +00 +2c +3c +00 +00 +02 +00 +00 +00 +06 +00 +30 +3c +00 +00 +02 +00 +00 +00 +06 +00 +34 +3c +00 +00 +02 +00 +00 +00 +06 +00 +38 +3c +00 +00 +02 +00 +00 +00 +06 +00 +3c +3c +00 +00 +02 +00 +00 +00 +06 +00 +40 +3c +00 +00 +02 +00 +00 +00 +06 +00 +44 +3c +00 +00 +02 +00 +00 +00 +06 +00 +48 +3c +00 +00 +02 +00 +00 +00 +06 +00 +4c +3c +00 +00 +02 +00 +00 +00 +06 +00 +50 +3c +00 +00 +02 +00 +00 +00 +06 +00 +54 +3c +00 +00 +02 +00 +00 +00 +06 +00 +58 +3c +00 +00 +02 +00 +00 +00 +06 +00 +5c +3c +00 +00 +02 +00 +00 +00 +06 +00 +60 +3c +00 +00 +02 +00 +00 +00 +06 +00 +64 +3c +00 +00 +02 +00 +00 +00 +06 +00 +68 +3c +00 +00 +02 +00 +00 +00 +06 +00 +6c +3c +00 +00 +02 +00 +00 +00 +06 +00 +70 +3c +00 +00 +02 +00 +00 +00 +06 +00 +74 +3c +00 +00 +02 +00 +00 +00 +06 +00 +78 +3c +00 +00 +02 +00 +00 +00 +06 +00 +7c +3c +00 +00 +02 +00 +00 +00 +06 +00 +80 +3c +00 +00 +02 +00 +00 +00 +06 +00 +84 +3c +00 +00 +02 +00 +00 +00 +06 +00 +88 +3c +00 +00 +02 +00 +00 +00 +06 +00 +8c +3c +00 +00 +02 +00 +00 +00 +06 +00 +90 +3c +00 +00 +02 +00 +00 +00 +06 +00 +94 +3c +00 +00 +02 +00 +00 +00 +06 +00 +98 +3c +00 +00 +02 +00 +00 +00 +06 +00 +9c +3c +00 +00 +02 +00 +00 +00 +06 +00 +a0 +3c +00 +00 +02 +00 +00 +00 +06 +00 +a4 +3c +00 +00 +02 +00 +00 +00 +06 +00 +a8 +3c +00 +00 +02 +00 +00 +00 +06 +00 +ac +3c +00 +00 +02 +00 +00 +00 +06 +00 +b0 +3c +00 +00 +02 +00 +00 +00 +06 +00 +b4 +3c +00 +00 +02 +00 +00 +00 +06 +00 +b8 +3c +00 +00 +02 +00 +00 +00 +06 +00 +bc +3c +00 +00 +02 +00 +00 +00 +06 +00 +c0 +3c +00 +00 +02 +00 +00 +00 +06 +00 +c4 +3c +00 +00 +02 +00 +00 +00 +06 +00 +c8 +3c +00 +00 +02 +00 +00 +00 +06 +00 +cc +3c +00 +00 +02 +00 +00 +00 +06 +00 +d0 +3c +00 +00 +02 +00 +00 +00 +06 +00 +d4 +3c +00 +00 +02 +00 +00 +00 +06 +00 +d8 +3c +00 +00 +02 +00 +00 +00 +06 +00 +dc +3c +00 +00 +02 +00 +00 +00 +06 +00 +e0 +3c +00 +00 +02 +00 +00 +00 +06 +00 +e4 +3c +00 +00 +02 +00 +00 +00 +06 +00 +e8 +3c +00 +00 +02 +00 +00 +00 +06 +00 +ec +3c +00 +00 +02 +00 +00 +00 +06 +00 +f0 +3c +00 +00 +02 +00 +00 +00 +06 +00 +f4 +3c +00 +00 +02 +00 +00 +00 +06 +00 +f8 +3c +00 +00 +02 +00 +00 +00 +06 +00 +fc +3c +00 +00 +02 +00 +00 +00 +06 +00 +00 3d -2a -01 +00 00 02 00 @@ -104409,9 +88209,2559 @@ fd 00 06 00 +04 +3d +00 +00 +02 +00 +00 +00 +06 +00 +08 +3d +00 +00 +02 +00 +00 +00 +06 +00 +0c +3d +00 +00 +02 +00 +00 +00 +06 +00 +10 +3d +00 +00 +02 +00 +00 +00 +06 +00 +14 +3d +00 +00 +02 +00 +00 +00 +06 +00 +18 +3d +00 +00 +02 +00 +00 +00 +06 +00 +1c +3d +00 +00 +02 +00 +00 +00 +06 +00 +20 +3d +00 +00 +02 +00 +00 +00 +06 +00 +24 +3d +00 +00 +02 +00 +00 +00 +06 +00 +28 +3d +00 +00 +02 +00 +00 +00 +06 +00 +2c +3d +00 +00 +02 +00 +00 +00 +06 +00 +30 +3d +00 +00 +02 +00 +00 +00 +06 +00 +34 +3d +00 +00 +02 +00 +00 +00 +06 +00 +38 +3d +00 +00 +02 +00 +00 +00 +06 +00 +3c +3d +00 +00 +02 +00 +00 +00 +06 +00 +40 +3d +00 +00 +02 +00 +00 +00 +06 +00 +44 +3d +00 +00 +02 +00 +00 +00 +06 +00 +48 +3d +00 +00 +02 +00 +00 +00 +06 +00 +4c +3d +00 +00 +02 +00 +00 +00 +06 +00 +50 +3d +00 +00 +02 +00 +00 +00 +06 +00 +54 +3d +00 +00 +02 +00 +00 +00 +06 +00 +58 +3d +00 +00 +02 +00 +00 +00 +06 +00 +5c +3d +00 +00 +02 +00 +00 +00 +06 +00 +60 +3d +00 +00 +02 +00 +00 +00 +06 +00 +64 +3d +00 +00 +02 +00 +00 +00 +06 +00 +68 +3d +00 +00 +02 +00 +00 +00 +06 +00 +6c +3d +00 +00 +02 +00 +00 +00 +06 +00 +70 +3d +00 +00 +02 +00 +00 +00 +06 +00 +74 +3d +00 +00 +02 +00 +00 +00 +06 +00 +78 +3d +00 +00 +02 +00 +00 +00 +06 +00 +7c +3d +00 +00 +02 +00 +00 +00 +06 +00 +80 +3d +00 +00 +02 +00 +00 +00 +06 +00 +84 +3d +00 +00 +02 +00 +00 +00 +06 +00 +88 +3d +00 +00 +02 +00 +00 +00 +06 +00 +8c +3d +00 +00 +02 +00 +00 +00 +06 +00 +90 +3d +00 +00 +02 +00 +00 +00 +06 +00 +94 +3d +00 +00 +02 +00 +00 +00 +06 +00 +98 +3d +00 +00 +02 +00 +00 +00 +06 +00 +9c +3d +00 +00 +02 +00 +00 +00 +06 +00 +a0 +3d +00 +00 +02 +00 +00 +00 +06 +00 +a4 +3d +00 +00 +02 +00 +00 +00 +06 +00 +a8 +3d +00 +00 +02 +00 +00 +00 +06 +00 +ac +3d +00 +00 +02 +00 +00 +00 +06 +00 +b0 +3d +00 +00 +02 +00 +00 +00 +06 +00 +b4 +3d +00 +00 +02 +00 +00 +00 +06 +00 +b8 +3d +00 +00 +02 +00 +00 +00 +06 +00 +bc +3d +00 +00 +02 +00 +00 +00 +06 +00 +c0 +3d +00 +00 +02 +00 +00 +00 +06 +00 +c4 +3d +00 +00 +02 +00 +00 +00 +06 +00 +c8 +3d +00 +00 +02 +00 +00 +00 +06 +00 +cc +3d +00 +00 +02 +00 +00 +00 +06 +00 +d0 +3d +00 +00 +02 +00 +00 +00 +06 +00 +d4 +3d +00 +00 +02 +00 +00 +00 +06 +00 +d8 +3d +00 +00 +02 +00 +00 +00 +06 +00 +dc +3d +00 +00 +02 +00 +00 +00 +06 +00 +e0 +3d +00 +00 +02 +00 +00 +00 +06 +00 +e4 +3d +00 +00 +02 +00 +00 +00 +06 +00 +e8 +3d +00 +00 +02 +00 +00 +00 +06 +00 +ec +3d +00 +00 +02 +00 +00 +00 +06 +00 +f0 +3d +00 +00 +02 +00 +00 +00 +06 +00 +f4 +3d +00 +00 +02 +00 +00 +00 +06 +00 +f8 +3d +00 +00 +02 +00 +00 +00 +06 +00 +fc +3d +00 +00 +02 +00 +00 +00 +06 +00 +00 +3e +00 +00 +02 +00 +00 +00 +06 +00 +04 +3e +00 +00 +02 +00 +00 +00 +06 +00 +08 +3e +00 +00 +02 +00 +00 +00 +06 +00 +0c +3e +00 +00 +02 +00 +00 +00 +06 +00 +10 +3e +00 +00 +02 +00 +00 +00 +06 +00 +14 +3e +00 +00 +02 +00 +00 +00 +06 +00 +18 +3e +00 +00 +02 +00 +00 +00 +06 +00 +1c +3e +00 +00 +02 +00 +00 +00 +06 +00 +20 +3e +00 +00 +02 +00 +00 +00 +06 +00 +24 +3e +00 +00 +02 +00 +00 +00 +06 +00 +28 +3e +00 +00 +02 +00 +00 +00 +06 +00 +2c +3e +00 +00 +02 +00 +00 +00 +06 +00 +30 +3e +00 +00 +02 +00 +00 +00 +06 +00 +34 +3e +00 +00 +02 +00 +00 +00 +06 +00 +38 +3e +00 +00 +02 +00 +00 +00 +06 +00 +3c +3e +00 +00 +02 +00 +00 +00 +06 +00 +40 +3e +00 +00 +02 +00 +00 +00 +06 +00 +44 +3e +00 +00 +02 +00 +00 +00 +06 +00 +48 +3e +00 +00 +02 +00 +00 +00 +06 +00 +4c +3e +00 +00 +02 +00 +00 +00 +06 +00 +50 +3e +00 +00 +02 +00 +00 +00 +06 +00 +54 +3e +00 +00 +02 +00 +00 +00 +06 +00 +58 +3e +00 +00 +02 +00 +00 +00 +06 +00 +5c +3e +00 +00 +02 +00 +00 +00 +06 +00 +60 +3e +00 +00 +02 +00 +00 +00 +06 +00 +64 +3e +00 +00 +02 +00 +00 +00 +06 +00 +68 +3e +00 +00 +02 +00 +00 +00 +06 +00 +6c +3e +00 +00 +02 +00 +00 +00 +06 +00 +70 +3e +00 +00 +02 +00 +00 +00 +06 +00 +74 +3e +00 +00 +02 +00 +00 +00 +06 +00 +78 +3e +00 +00 +02 +00 +00 +00 +06 +00 +7c +3e +00 +00 +02 +00 +00 +00 +06 +00 +80 +3e +00 +00 +02 +00 +00 +00 +06 +00 +84 +3e +00 +00 +02 +00 +00 +00 +06 +00 +88 +3e +00 +00 +02 +00 +00 +00 +06 +00 +8c +3e +00 +00 +02 +00 +00 +00 +06 +00 +90 +3e +00 +00 +02 +00 +00 +00 +06 +00 +94 +3e +00 +00 +02 +00 +00 +00 +06 +00 +98 +3e +00 +00 +02 +00 +00 +00 +06 +00 +9c +3e +00 +00 +02 +00 +00 +00 +06 +00 +a0 +3e +00 +00 +02 +00 +00 +00 +06 +00 +a4 +3e +00 +00 +02 +00 +00 +00 +06 +00 +a8 +3e +00 +00 +02 +00 +00 +00 +06 +00 +ac +3e +00 +00 +02 +00 +00 +00 +06 +00 +b0 +3e +00 +00 +02 +00 +00 +00 +06 +00 +b4 +3e +00 +00 +02 +00 +00 +00 +06 +00 +b8 +3e +00 +00 +02 +00 +00 +00 +06 +00 +bc +3e +00 +00 +02 +00 +00 +00 +06 +00 +c0 +3e +00 +00 +02 +00 +00 +00 +06 +00 +c4 +3e +00 +00 +02 +00 +00 +00 +06 +00 +c8 +3e +00 +00 +02 +00 +00 +00 +06 +00 +cc +3e +00 +00 +02 +00 +00 +00 +06 +00 +d0 +3e +00 +00 +02 +00 +00 +00 +06 +00 +d4 +3e +00 +00 +02 +00 +00 +00 +06 +00 +d8 +3e +00 +00 +02 +00 +00 +00 +06 +00 +dc +3e +00 +00 +02 +00 +00 +00 +06 +00 +e0 +3e +00 +00 +02 +00 +00 +00 +06 +00 +e4 +3e +00 +00 +02 +00 +00 +00 +06 +00 +e8 +3e +00 +00 +02 +00 +00 +00 +06 +00 +ec +3e +00 +00 +02 +00 +00 +00 +06 +00 +f0 +3e +00 +00 +02 +00 +00 +00 +06 +00 +f4 +3e +00 +00 +02 +00 +00 +00 +06 +00 +f8 +3e +00 +00 +02 +00 +00 +00 +06 +00 +fc +3e +00 +00 +02 +00 +00 +00 +06 +00 +00 +3f +00 +00 +02 +00 +00 +00 +06 +00 +04 +3f +00 +00 +02 +00 +00 +00 +06 +00 +08 +3f +00 +00 +02 +00 +00 +00 +06 +00 +0c +3f +00 +00 +02 +00 +00 +00 +06 +00 +10 +3f +00 +00 +02 +00 +00 +00 +06 +00 +14 +3f +00 +00 +02 +00 +00 +00 +06 +00 +18 +3f +00 +00 +02 +00 +00 +00 +06 +00 +1c +3f +00 +00 +02 +00 +00 +00 +06 +00 +20 +3f +00 +00 +02 +00 +00 +00 +06 +00 +24 +3f +00 +00 +02 +00 +00 +00 +06 +00 +28 +3f +00 +00 +02 +00 +00 +00 +06 +00 +2c +3f +00 +00 +02 +00 +00 +00 +06 +00 +30 +3f +00 +00 +02 +00 +00 +00 +06 +00 +34 +3f +00 +00 +02 +00 +00 +00 +06 +00 +38 +3f +00 +00 +02 +00 +00 +00 +06 +00 +3c +3f +00 +00 +02 +00 +00 +00 +06 +00 +40 +3f +00 +00 +02 +00 +00 +00 +06 +00 +44 +3f +00 +00 +02 +00 +00 +00 +06 +00 +48 +3f +00 +00 +02 +00 +00 +00 +06 +00 +4c +3f +00 +00 +02 +00 +00 +00 +06 +00 +50 +3f +00 +00 +02 +00 +00 +00 +06 +00 +54 +3f +00 +00 +02 +00 +00 +00 +06 +00 +58 +3f +00 +00 +02 +00 +00 +00 +06 +00 +5c +3f +00 +00 +02 +00 +00 +00 +06 +00 +60 +3f +00 +00 +02 +00 +00 +00 +06 +00 +64 +3f +00 +00 +02 +00 +00 +00 +06 +00 +68 +3f +00 +00 +02 +00 +00 +00 +06 +00 +6c +3f +00 +00 +02 +00 +00 +00 +06 +00 +70 +3f +00 +00 +02 +00 +00 +00 +06 +00 +74 +3f +00 +00 +02 +00 +00 +00 +06 +00 +78 +3f +00 +00 +02 +00 +00 +00 +06 +00 +7c +3f +00 +00 +02 +00 +00 +00 +06 +00 +80 +3f +00 +00 +02 +00 +00 +00 +06 +00 +84 +3f +00 +00 +02 +00 +00 +00 +06 +00 +88 +3f +00 +00 +02 +00 +00 +00 +06 +00 +8c +3f +00 +00 +02 +00 +00 +00 +06 +00 +90 +3f +00 +00 +02 +00 +00 +00 +06 +00 +94 +3f +00 +00 +02 +00 +00 +00 +06 +00 +98 +3f +00 +00 +02 +00 +00 +00 +06 +00 +9c +3f +00 +00 +02 +00 +00 +00 +06 +00 +a0 +3f +00 +00 +02 +00 +00 +00 +06 +00 +a4 +3f +00 +00 +02 +00 +00 +00 +06 +00 +a8 +3f +00 +00 +02 +00 +00 +00 +06 +00 +ac +3f +00 +00 +02 +00 +00 +00 +06 +00 +b0 +3f +00 +00 +02 +00 +00 +00 +06 +00 +b4 +3f +00 +00 +02 +00 +00 +00 +06 +00 +b8 +3f +00 +00 +02 +00 +00 +00 +06 +00 +bc +3f +00 +00 +02 +00 +00 +00 +06 +00 +c0 +3f +00 +00 +02 +00 +00 +00 +06 +00 +c4 +3f +00 +00 +02 +00 +00 +00 +06 +00 +c8 +3f +00 +00 +02 +00 +00 +00 +06 +00 +cc +3f +00 +00 +02 +00 +00 +00 +06 +00 +d0 +3f +00 +00 +02 +00 +00 +00 +06 +00 +d4 +3f +00 +00 +02 +00 +00 +00 +06 +00 +d8 +3f +00 +00 +02 +00 +00 +00 +06 +00 +dc +3f +00 +00 +02 +00 +00 +00 +06 +00 +e0 +3f +00 +00 +02 +00 +00 +00 +06 +00 +e4 +3f +00 +00 +02 +00 +00 +00 +06 +00 +e8 +3f +00 +00 +02 +00 +00 +00 +06 +00 +ec +3f +00 +00 +02 +00 +00 +00 +06 +00 +f0 +3f +00 +00 +02 +00 +00 +00 +06 +00 +f4 +3f +00 +00 +02 +00 +00 +00 +06 +00 +f8 +3f +00 +00 +02 +00 +00 +00 +06 +00 +fc +3f +00 +00 +02 +00 +00 +00 +06 +00 +00 +40 +00 +00 +02 +00 +00 +00 +06 +00 +04 +40 +00 +00 +02 +00 +00 +00 +06 +00 +08 +40 +00 +00 +02 +00 +00 +00 +06 +00 +0c +40 +00 +00 +02 +00 +00 +00 +06 +00 +10 +40 +00 +00 +02 +00 +00 +00 +06 +00 +14 +40 +00 +00 +02 +00 +00 +00 +06 +00 +18 +40 +00 +00 +02 +00 +00 +00 +06 +00 +1c +40 +00 +00 +02 +00 +00 +00 +06 +00 +20 +40 +00 +00 +02 +00 +00 +00 +06 +00 +24 +40 +00 +00 +02 +00 +00 +00 +06 +00 +28 +40 +00 +00 +02 +00 +00 +00 +06 +00 +2c +40 +00 +00 +02 +00 +00 +00 +06 +00 +30 +40 +00 +00 +02 +00 +00 +00 +06 +00 +34 +40 +00 +00 +02 +00 +00 +00 +06 +00 +38 +40 +00 +00 +02 +00 +00 +00 +06 +00 +3c +40 +00 +00 +02 +00 +00 +00 +06 +00 +40 +40 +00 +00 +02 +00 +00 +00 +06 +00 +44 +40 +00 +00 +02 +00 +00 +00 +06 +00 +48 +40 +00 +00 +02 +00 +00 +00 +06 +00 +4c +40 +00 +00 +02 +00 +00 +00 +06 +00 +50 +40 +00 +00 +02 +00 +00 +00 +06 +00 +54 +40 +00 +00 +02 +00 +00 +00 +06 +00 +58 +40 +00 +00 +02 +00 +00 +00 +06 +00 +5c +40 +00 +00 +02 +00 +00 +00 +06 +00 +60 +40 +00 +00 +02 +00 +00 +00 +06 +00 +64 +40 +00 +00 +02 +00 +00 +00 +06 +00 +68 +40 +00 +00 +02 +00 +00 +00 +06 +00 +6c +40 +00 +00 +02 +00 +00 +00 +06 +00 +70 +40 +00 +00 +02 +00 +00 +00 +06 +00 +74 +40 +00 +00 +02 +00 +00 +00 +06 +00 +78 +40 +00 +00 +02 +00 +00 +00 +06 +00 +7c +40 +00 +00 +02 +00 +00 +00 +06 +00 +80 +40 +00 +00 +02 +00 +00 +00 +06 +00 +84 +40 +00 +00 +02 +00 +00 +00 +06 +00 +88 +40 +00 +00 +02 +00 +00 +00 +06 +00 +8c +40 +00 +00 +02 +00 +00 +00 +06 +00 +90 +40 +00 +00 +02 +00 +00 +00 +06 +00 +94 +40 +00 +00 +02 +00 +00 +00 +06 +00 +98 +40 +00 +00 +02 +00 +00 +00 +06 +00 +9c +40 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +40 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +40 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +40 +00 +00 +02 +00 +00 +00 +06 +00 +ac +40 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +40 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +40 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +40 +00 +00 +02 +00 +00 +00 +06 +00 +bc +40 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +40 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +40 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +40 +00 +00 +02 +00 +00 +00 +06 +00 +cc +40 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +40 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +40 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +40 +00 +00 +02 +00 +00 +00 +06 +00 +dc +40 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +40 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +40 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +40 +00 +00 +02 +00 +00 +00 +06 +00 +ec +40 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +40 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +40 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +40 +00 +00 +02 +00 +00 +00 +06 +00 +fc +40 +00 +00 +02 +00 +00 +00 +06 +00 +00 41 -2a -01 +00 00 02 00 @@ -104419,9 +90769,2559 @@ fd 00 06 00 +04 +41 +00 +00 +02 +00 +00 +00 +06 +00 +08 +41 +00 +00 +02 +00 +00 +00 +06 +00 +0c +41 +00 +00 +02 +00 +00 +00 +06 +00 +10 +41 +00 +00 +02 +00 +00 +00 +06 +00 +14 +41 +00 +00 +02 +00 +00 +00 +06 +00 +18 +41 +00 +00 +02 +00 +00 +00 +06 +00 +1c +41 +00 +00 +02 +00 +00 +00 +06 +00 +20 +41 +00 +00 +02 +00 +00 +00 +06 +00 +24 +41 +00 +00 +02 +00 +00 +00 +06 +00 +28 +41 +00 +00 +02 +00 +00 +00 +06 +00 +2c +41 +00 +00 +02 +00 +00 +00 +06 +00 +30 +41 +00 +00 +02 +00 +00 +00 +06 +00 +34 +41 +00 +00 +02 +00 +00 +00 +06 +00 +38 +41 +00 +00 +02 +00 +00 +00 +06 +00 +3c +41 +00 +00 +02 +00 +00 +00 +06 +00 +40 +41 +00 +00 +02 +00 +00 +00 +06 +00 +44 +41 +00 +00 +02 +00 +00 +00 +06 +00 +48 +41 +00 +00 +02 +00 +00 +00 +06 +00 +4c +41 +00 +00 +02 +00 +00 +00 +06 +00 +50 +41 +00 +00 +02 +00 +00 +00 +06 +00 +54 +41 +00 +00 +02 +00 +00 +00 +06 +00 +58 +41 +00 +00 +02 +00 +00 +00 +06 +00 +5c +41 +00 +00 +02 +00 +00 +00 +06 +00 +60 +41 +00 +00 +02 +00 +00 +00 +06 +00 +64 +41 +00 +00 +02 +00 +00 +00 +06 +00 +68 +41 +00 +00 +02 +00 +00 +00 +06 +00 +6c +41 +00 +00 +02 +00 +00 +00 +06 +00 +70 +41 +00 +00 +02 +00 +00 +00 +06 +00 +74 +41 +00 +00 +02 +00 +00 +00 +06 +00 +78 +41 +00 +00 +02 +00 +00 +00 +06 +00 +7c +41 +00 +00 +02 +00 +00 +00 +06 +00 +80 +41 +00 +00 +02 +00 +00 +00 +06 +00 +84 +41 +00 +00 +02 +00 +00 +00 +06 +00 +88 +41 +00 +00 +02 +00 +00 +00 +06 +00 +8c +41 +00 +00 +02 +00 +00 +00 +06 +00 +90 +41 +00 +00 +02 +00 +00 +00 +06 +00 +94 +41 +00 +00 +02 +00 +00 +00 +06 +00 +98 +41 +00 +00 +02 +00 +00 +00 +06 +00 +9c +41 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +41 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +41 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +41 +00 +00 +02 +00 +00 +00 +06 +00 +ac +41 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +41 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +41 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +41 +00 +00 +02 +00 +00 +00 +06 +00 +bc +41 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +41 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +41 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +41 +00 +00 +02 +00 +00 +00 +06 +00 +cc +41 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +41 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +41 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +41 +00 +00 +02 +00 +00 +00 +06 +00 +dc +41 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +41 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +41 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +41 +00 +00 +02 +00 +00 +00 +06 +00 +ec +41 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +41 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +41 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +41 +00 +00 +02 +00 +00 +00 +06 +00 +fc +41 +00 +00 +02 +00 +00 +00 +06 +00 +00 +42 +00 +00 +02 +00 +00 +00 +06 +00 +04 +42 +00 +00 +02 +00 +00 +00 +06 +00 +08 +42 +00 +00 +02 +00 +00 +00 +06 +00 +0c +42 +00 +00 +02 +00 +00 +00 +06 +00 +10 +42 +00 +00 +02 +00 +00 +00 +06 +00 +14 +42 +00 +00 +02 +00 +00 +00 +06 +00 +18 +42 +00 +00 +02 +00 +00 +00 +06 +00 +1c +42 +00 +00 +02 +00 +00 +00 +06 +00 +20 +42 +00 +00 +02 +00 +00 +00 +06 +00 +24 +42 +00 +00 +02 +00 +00 +00 +06 +00 +28 +42 +00 +00 +02 +00 +00 +00 +06 +00 +2c +42 +00 +00 +02 +00 +00 +00 +06 +00 +30 +42 +00 +00 +02 +00 +00 +00 +06 +00 +34 +42 +00 +00 +02 +00 +00 +00 +06 +00 +38 +42 +00 +00 +02 +00 +00 +00 +06 +00 +3c +42 +00 +00 +02 +00 +00 +00 +06 +00 +40 +42 +00 +00 +02 +00 +00 +00 +06 +00 +44 +42 +00 +00 +02 +00 +00 +00 +06 +00 +48 +42 +00 +00 +02 +00 +00 +00 +06 +00 +4c +42 +00 +00 +02 +00 +00 +00 +06 +00 +50 +42 +00 +00 +02 +00 +00 +00 +06 +00 +54 +42 +00 +00 +02 +00 +00 +00 +06 +00 +58 +42 +00 +00 +02 +00 +00 +00 +06 +00 +5c +42 +00 +00 +02 +00 +00 +00 +06 +00 +60 +42 +00 +00 +02 +00 +00 +00 +06 +00 +64 +42 +00 +00 +02 +00 +00 +00 +06 +00 +68 +42 +00 +00 +02 +00 +00 +00 +06 +00 +6c +42 +00 +00 +02 +00 +00 +00 +06 +00 +70 +42 +00 +00 +02 +00 +00 +00 +06 +00 +74 +42 +00 +00 +02 +00 +00 +00 +06 +00 +78 +42 +00 +00 +02 +00 +00 +00 +06 +00 +7c +42 +00 +00 +02 +00 +00 +00 +06 +00 +80 +42 +00 +00 +02 +00 +00 +00 +06 +00 +84 +42 +00 +00 +02 +00 +00 +00 +06 +00 +88 +42 +00 +00 +02 +00 +00 +00 +06 +00 +8c +42 +00 +00 +02 +00 +00 +00 +06 +00 +90 +42 +00 +00 +02 +00 +00 +00 +06 +00 +94 +42 +00 +00 +02 +00 +00 +00 +06 +00 +98 +42 +00 +00 +02 +00 +00 +00 +06 +00 +9c +42 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +42 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +42 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +42 +00 +00 +02 +00 +00 +00 +06 +00 +ac +42 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +42 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +42 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +42 +00 +00 +02 +00 +00 +00 +06 +00 +bc +42 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +42 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +42 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +42 +00 +00 +02 +00 +00 +00 +06 +00 +cc +42 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +42 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +42 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +42 +00 +00 +02 +00 +00 +00 +06 +00 +dc +42 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +42 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +42 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +42 +00 +00 +02 +00 +00 +00 +06 +00 +ec +42 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +42 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +42 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +42 +00 +00 +02 +00 +00 +00 +06 +00 +fc +42 +00 +00 +02 +00 +00 +00 +06 +00 +00 +43 +00 +00 +02 +00 +00 +00 +06 +00 +04 +43 +00 +00 +02 +00 +00 +00 +06 +00 +08 +43 +00 +00 +02 +00 +00 +00 +06 +00 +0c +43 +00 +00 +02 +00 +00 +00 +06 +00 +10 +43 +00 +00 +02 +00 +00 +00 +06 +00 +14 +43 +00 +00 +02 +00 +00 +00 +06 +00 +18 +43 +00 +00 +02 +00 +00 +00 +06 +00 +1c +43 +00 +00 +02 +00 +00 +00 +06 +00 +20 +43 +00 +00 +02 +00 +00 +00 +06 +00 +24 +43 +00 +00 +02 +00 +00 +00 +06 +00 +28 +43 +00 +00 +02 +00 +00 +00 +06 +00 +2c +43 +00 +00 +02 +00 +00 +00 +06 +00 +30 +43 +00 +00 +02 +00 +00 +00 +06 +00 +34 +43 +00 +00 +02 +00 +00 +00 +06 +00 +38 +43 +00 +00 +02 +00 +00 +00 +06 +00 +3c +43 +00 +00 +02 +00 +00 +00 +06 +00 +40 +43 +00 +00 +02 +00 +00 +00 +06 +00 +44 +43 +00 +00 +02 +00 +00 +00 +06 +00 +48 +43 +00 +00 +02 +00 +00 +00 +06 +00 +4c +43 +00 +00 +02 +00 +00 +00 +06 +00 +50 +43 +00 +00 +02 +00 +00 +00 +06 +00 +54 +43 +00 +00 +02 +00 +00 +00 +06 +00 +58 +43 +00 +00 +02 +00 +00 +00 +06 +00 +5c +43 +00 +00 +02 +00 +00 +00 +06 +00 +60 +43 +00 +00 +02 +00 +00 +00 +06 +00 +64 +43 +00 +00 +02 +00 +00 +00 +06 +00 +68 +43 +00 +00 +02 +00 +00 +00 +06 +00 +6c +43 +00 +00 +02 +00 +00 +00 +06 +00 +70 +43 +00 +00 +02 +00 +00 +00 +06 +00 +74 +43 +00 +00 +02 +00 +00 +00 +06 +00 +78 +43 +00 +00 +02 +00 +00 +00 +06 +00 +7c +43 +00 +00 +02 +00 +00 +00 +06 +00 +80 +43 +00 +00 +02 +00 +00 +00 +06 +00 +84 +43 +00 +00 +02 +00 +00 +00 +06 +00 +88 +43 +00 +00 +02 +00 +00 +00 +06 +00 +8c +43 +00 +00 +02 +00 +00 +00 +06 +00 +90 +43 +00 +00 +02 +00 +00 +00 +06 +00 +94 +43 +00 +00 +02 +00 +00 +00 +06 +00 +98 +43 +00 +00 +02 +00 +00 +00 +06 +00 +9c +43 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +43 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +43 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +43 +00 +00 +02 +00 +00 +00 +06 +00 +ac +43 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +43 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +43 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +43 +00 +00 +02 +00 +00 +00 +06 +00 +bc +43 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +43 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +43 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +43 +00 +00 +02 +00 +00 +00 +06 +00 +cc +43 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +43 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +43 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +43 +00 +00 +02 +00 +00 +00 +06 +00 +dc +43 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +43 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +43 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +43 +00 +00 +02 +00 +00 +00 +06 +00 +ec +43 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +43 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +43 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +43 +00 +00 +02 +00 +00 +00 +06 +00 +fc +43 +00 +00 +02 +00 +00 +00 +06 +00 +00 +44 +00 +00 +02 +00 +00 +00 +06 +00 +04 +44 +00 +00 +02 +00 +00 +00 +06 +00 +08 +44 +00 +00 +02 +00 +00 +00 +06 +00 +0c +44 +00 +00 +02 +00 +00 +00 +06 +00 +10 +44 +00 +00 +02 +00 +00 +00 +06 +00 +14 +44 +00 +00 +02 +00 +00 +00 +06 +00 +18 +44 +00 +00 +02 +00 +00 +00 +06 +00 +1c +44 +00 +00 +02 +00 +00 +00 +06 +00 +20 +44 +00 +00 +02 +00 +00 +00 +06 +00 +24 +44 +00 +00 +02 +00 +00 +00 +06 +00 +28 +44 +00 +00 +02 +00 +00 +00 +06 +00 +2c +44 +00 +00 +02 +00 +00 +00 +06 +00 +30 +44 +00 +00 +02 +00 +00 +00 +06 +00 +34 +44 +00 +00 +02 +00 +00 +00 +06 +00 +38 +44 +00 +00 +02 +00 +00 +00 +06 +00 +3c +44 +00 +00 +02 +00 +00 +00 +06 +00 +40 +44 +00 +00 +02 +00 +00 +00 +06 +00 +44 +44 +00 +00 +02 +00 +00 +00 +06 +00 +48 +44 +00 +00 +02 +00 +00 +00 +06 +00 +4c +44 +00 +00 +02 +00 +00 +00 +06 +00 +50 +44 +00 +00 +02 +00 +00 +00 +06 +00 +54 +44 +00 +00 +02 +00 +00 +00 +06 +00 +58 +44 +00 +00 +02 +00 +00 +00 +06 +00 +5c +44 +00 +00 +02 +00 +00 +00 +06 +00 +60 +44 +00 +00 +02 +00 +00 +00 +06 +00 +64 +44 +00 +00 +02 +00 +00 +00 +06 +00 +68 +44 +00 +00 +02 +00 +00 +00 +06 +00 +6c +44 +00 +00 +02 +00 +00 +00 +06 +00 +70 +44 +00 +00 +02 +00 +00 +00 +06 +00 +74 +44 +00 +00 +02 +00 +00 +00 +06 +00 +78 +44 +00 +00 +02 +00 +00 +00 +06 +00 +7c +44 +00 +00 +02 +00 +00 +00 +06 +00 +80 +44 +00 +00 +02 +00 +00 +00 +06 +00 +84 +44 +00 +00 +02 +00 +00 +00 +06 +00 +88 +44 +00 +00 +02 +00 +00 +00 +06 +00 +8c +44 +00 +00 +02 +00 +00 +00 +06 +00 +90 +44 +00 +00 +02 +00 +00 +00 +06 +00 +94 +44 +00 +00 +02 +00 +00 +00 +06 +00 +98 +44 +00 +00 +02 +00 +00 +00 +06 +00 +9c +44 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +44 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +44 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +44 +00 +00 +02 +00 +00 +00 +06 +00 +ac +44 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +44 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +44 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +44 +00 +00 +02 +00 +00 +00 +06 +00 +bc +44 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +44 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +44 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +44 +00 +00 +02 +00 +00 +00 +06 +00 +cc +44 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +44 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +44 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +44 +00 +00 +02 +00 +00 +00 +06 +00 +dc +44 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +44 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +44 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +44 +00 +00 +02 +00 +00 +00 +06 +00 +ec +44 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +44 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +44 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +44 +00 +00 +02 +00 +00 +00 +06 +00 +fc +44 +00 +00 +02 +00 +00 +00 +06 +00 +00 45 -2a -01 +00 00 02 00 @@ -104429,9 +93329,2559 @@ fd 00 06 00 +04 +45 +00 +00 +02 +00 +00 +00 +06 +00 +08 +45 +00 +00 +02 +00 +00 +00 +06 +00 +0c +45 +00 +00 +02 +00 +00 +00 +06 +00 +10 +45 +00 +00 +02 +00 +00 +00 +06 +00 +14 +45 +00 +00 +02 +00 +00 +00 +06 +00 +18 +45 +00 +00 +02 +00 +00 +00 +06 +00 +1c +45 +00 +00 +02 +00 +00 +00 +06 +00 +20 +45 +00 +00 +02 +00 +00 +00 +06 +00 +24 +45 +00 +00 +02 +00 +00 +00 +06 +00 +28 +45 +00 +00 +02 +00 +00 +00 +06 +00 +2c +45 +00 +00 +02 +00 +00 +00 +06 +00 +30 +45 +00 +00 +02 +00 +00 +00 +06 +00 +34 +45 +00 +00 +02 +00 +00 +00 +06 +00 +38 +45 +00 +00 +02 +00 +00 +00 +06 +00 +3c +45 +00 +00 +02 +00 +00 +00 +06 +00 +40 +45 +00 +00 +02 +00 +00 +00 +06 +00 +44 +45 +00 +00 +02 +00 +00 +00 +06 +00 +48 +45 +00 +00 +02 +00 +00 +00 +06 +00 +4c +45 +00 +00 +02 +00 +00 +00 +06 +00 +50 +45 +00 +00 +02 +00 +00 +00 +06 +00 +54 +45 +00 +00 +02 +00 +00 +00 +06 +00 +58 +45 +00 +00 +02 +00 +00 +00 +06 +00 +5c +45 +00 +00 +02 +00 +00 +00 +06 +00 +60 +45 +00 +00 +02 +00 +00 +00 +06 +00 +64 +45 +00 +00 +02 +00 +00 +00 +06 +00 +68 +45 +00 +00 +02 +00 +00 +00 +06 +00 +6c +45 +00 +00 +02 +00 +00 +00 +06 +00 +70 +45 +00 +00 +02 +00 +00 +00 +06 +00 +74 +45 +00 +00 +02 +00 +00 +00 +06 +00 +78 +45 +00 +00 +02 +00 +00 +00 +06 +00 +7c +45 +00 +00 +02 +00 +00 +00 +06 +00 +80 +45 +00 +00 +02 +00 +00 +00 +06 +00 +84 +45 +00 +00 +02 +00 +00 +00 +06 +00 +88 +45 +00 +00 +02 +00 +00 +00 +06 +00 +8c +45 +00 +00 +02 +00 +00 +00 +06 +00 +90 +45 +00 +00 +02 +00 +00 +00 +06 +00 +94 +45 +00 +00 +02 +00 +00 +00 +06 +00 +98 +45 +00 +00 +02 +00 +00 +00 +06 +00 +9c +45 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +45 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +45 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +45 +00 +00 +02 +00 +00 +00 +06 +00 +ac +45 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +45 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +45 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +45 +00 +00 +02 +00 +00 +00 +06 +00 +bc +45 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +45 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +45 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +45 +00 +00 +02 +00 +00 +00 +06 +00 +cc +45 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +45 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +45 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +45 +00 +00 +02 +00 +00 +00 +06 +00 +dc +45 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +45 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +45 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +45 +00 +00 +02 +00 +00 +00 +06 +00 +ec +45 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +45 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +45 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +45 +00 +00 +02 +00 +00 +00 +06 +00 +fc +45 +00 +00 +02 +00 +00 +00 +06 +00 +00 +46 +00 +00 +02 +00 +00 +00 +06 +00 +04 +46 +00 +00 +02 +00 +00 +00 +06 +00 +08 +46 +00 +00 +02 +00 +00 +00 +06 +00 +0c +46 +00 +00 +02 +00 +00 +00 +06 +00 +10 +46 +00 +00 +02 +00 +00 +00 +06 +00 +14 +46 +00 +00 +02 +00 +00 +00 +06 +00 +18 +46 +00 +00 +02 +00 +00 +00 +06 +00 +1c +46 +00 +00 +02 +00 +00 +00 +06 +00 +20 +46 +00 +00 +02 +00 +00 +00 +06 +00 +24 +46 +00 +00 +02 +00 +00 +00 +06 +00 +28 +46 +00 +00 +02 +00 +00 +00 +06 +00 +2c +46 +00 +00 +02 +00 +00 +00 +06 +00 +30 +46 +00 +00 +02 +00 +00 +00 +06 +00 +34 +46 +00 +00 +02 +00 +00 +00 +06 +00 +38 +46 +00 +00 +02 +00 +00 +00 +06 +00 +3c +46 +00 +00 +02 +00 +00 +00 +06 +00 +40 +46 +00 +00 +02 +00 +00 +00 +06 +00 +44 +46 +00 +00 +02 +00 +00 +00 +06 +00 +48 +46 +00 +00 +02 +00 +00 +00 +06 +00 +4c +46 +00 +00 +02 +00 +00 +00 +06 +00 +50 +46 +00 +00 +02 +00 +00 +00 +06 +00 +54 +46 +00 +00 +02 +00 +00 +00 +06 +00 +58 +46 +00 +00 +02 +00 +00 +00 +06 +00 +5c +46 +00 +00 +02 +00 +00 +00 +06 +00 +60 +46 +00 +00 +02 +00 +00 +00 +06 +00 +64 +46 +00 +00 +02 +00 +00 +00 +06 +00 +68 +46 +00 +00 +02 +00 +00 +00 +06 +00 +6c +46 +00 +00 +02 +00 +00 +00 +06 +00 +70 +46 +00 +00 +02 +00 +00 +00 +06 +00 +74 +46 +00 +00 +02 +00 +00 +00 +06 +00 +78 +46 +00 +00 +02 +00 +00 +00 +06 +00 +7c +46 +00 +00 +02 +00 +00 +00 +06 +00 +80 +46 +00 +00 +02 +00 +00 +00 +06 +00 +84 +46 +00 +00 +02 +00 +00 +00 +06 +00 +88 +46 +00 +00 +02 +00 +00 +00 +06 +00 +8c +46 +00 +00 +02 +00 +00 +00 +06 +00 +90 +46 +00 +00 +02 +00 +00 +00 +06 +00 +94 +46 +00 +00 +02 +00 +00 +00 +06 +00 +98 +46 +00 +00 +02 +00 +00 +00 +06 +00 +9c +46 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +46 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +46 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +46 +00 +00 +02 +00 +00 +00 +06 +00 +ac +46 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +46 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +46 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +46 +00 +00 +02 +00 +00 +00 +06 +00 +bc +46 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +46 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +46 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +46 +00 +00 +02 +00 +00 +00 +06 +00 +cc +46 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +46 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +46 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +46 +00 +00 +02 +00 +00 +00 +06 +00 +dc +46 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +46 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +46 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +46 +00 +00 +02 +00 +00 +00 +06 +00 +ec +46 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +46 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +46 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +46 +00 +00 +02 +00 +00 +00 +06 +00 +fc +46 +00 +00 +02 +00 +00 +00 +06 +00 +00 +47 +00 +00 +02 +00 +00 +00 +06 +00 +04 +47 +00 +00 +02 +00 +00 +00 +06 +00 +08 +47 +00 +00 +02 +00 +00 +00 +06 +00 +0c +47 +00 +00 +02 +00 +00 +00 +06 +00 +10 +47 +00 +00 +02 +00 +00 +00 +06 +00 +14 +47 +00 +00 +02 +00 +00 +00 +06 +00 +18 +47 +00 +00 +02 +00 +00 +00 +06 +00 +1c +47 +00 +00 +02 +00 +00 +00 +06 +00 +20 +47 +00 +00 +02 +00 +00 +00 +06 +00 +24 +47 +00 +00 +02 +00 +00 +00 +06 +00 +28 +47 +00 +00 +02 +00 +00 +00 +06 +00 +2c +47 +00 +00 +02 +00 +00 +00 +06 +00 +30 +47 +00 +00 +02 +00 +00 +00 +06 +00 +34 +47 +00 +00 +02 +00 +00 +00 +06 +00 +38 +47 +00 +00 +02 +00 +00 +00 +06 +00 +3c +47 +00 +00 +02 +00 +00 +00 +06 +00 +40 +47 +00 +00 +02 +00 +00 +00 +06 +00 +44 +47 +00 +00 +02 +00 +00 +00 +06 +00 +48 +47 +00 +00 +02 +00 +00 +00 +06 +00 +4c +47 +00 +00 +02 +00 +00 +00 +06 +00 +50 +47 +00 +00 +02 +00 +00 +00 +06 +00 +54 +47 +00 +00 +02 +00 +00 +00 +06 +00 +58 +47 +00 +00 +02 +00 +00 +00 +06 +00 +5c +47 +00 +00 +02 +00 +00 +00 +06 +00 +60 +47 +00 +00 +02 +00 +00 +00 +06 +00 +64 +47 +00 +00 +02 +00 +00 +00 +06 +00 +68 +47 +00 +00 +02 +00 +00 +00 +06 +00 +6c +47 +00 +00 +02 +00 +00 +00 +06 +00 +70 +47 +00 +00 +02 +00 +00 +00 +06 +00 +74 +47 +00 +00 +02 +00 +00 +00 +06 +00 +78 +47 +00 +00 +02 +00 +00 +00 +06 +00 +7c +47 +00 +00 +02 +00 +00 +00 +06 +00 +80 +47 +00 +00 +02 +00 +00 +00 +06 +00 +84 +47 +00 +00 +02 +00 +00 +00 +06 +00 +88 +47 +00 +00 +02 +00 +00 +00 +06 +00 +8c +47 +00 +00 +02 +00 +00 +00 +06 +00 +90 +47 +00 +00 +02 +00 +00 +00 +06 +00 +94 +47 +00 +00 +02 +00 +00 +00 +06 +00 +98 +47 +00 +00 +02 +00 +00 +00 +06 +00 +9c +47 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +47 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +47 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +47 +00 +00 +02 +00 +00 +00 +06 +00 +ac +47 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +47 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +47 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +47 +00 +00 +02 +00 +00 +00 +06 +00 +bc +47 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +47 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +47 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +47 +00 +00 +02 +00 +00 +00 +06 +00 +cc +47 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +47 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +47 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +47 +00 +00 +02 +00 +00 +00 +06 +00 +dc +47 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +47 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +47 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +47 +00 +00 +02 +00 +00 +00 +06 +00 +ec +47 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +47 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +47 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +47 +00 +00 +02 +00 +00 +00 +06 +00 +fc +47 +00 +00 +02 +00 +00 +00 +06 +00 +00 +48 +00 +00 +02 +00 +00 +00 +06 +00 +04 +48 +00 +00 +02 +00 +00 +00 +06 +00 +08 +48 +00 +00 +02 +00 +00 +00 +06 +00 +0c +48 +00 +00 +02 +00 +00 +00 +06 +00 +10 +48 +00 +00 +02 +00 +00 +00 +06 +00 +14 +48 +00 +00 +02 +00 +00 +00 +06 +00 +18 +48 +00 +00 +02 +00 +00 +00 +06 +00 +1c +48 +00 +00 +02 +00 +00 +00 +06 +00 +20 +48 +00 +00 +02 +00 +00 +00 +06 +00 +24 +48 +00 +00 +02 +00 +00 +00 +06 +00 +28 +48 +00 +00 +02 +00 +00 +00 +06 +00 +2c +48 +00 +00 +02 +00 +00 +00 +06 +00 +30 +48 +00 +00 +02 +00 +00 +00 +06 +00 +34 +48 +00 +00 +02 +00 +00 +00 +06 +00 +38 +48 +00 +00 +02 +00 +00 +00 +06 +00 +3c +48 +00 +00 +02 +00 +00 +00 +06 +00 +40 +48 +00 +00 +02 +00 +00 +00 +06 +00 +44 +48 +00 +00 +02 +00 +00 +00 +06 +00 +48 +48 +00 +00 +02 +00 +00 +00 +06 +00 +4c +48 +00 +00 +02 +00 +00 +00 +06 +00 +50 +48 +00 +00 +02 +00 +00 +00 +06 +00 +54 +48 +00 +00 +02 +00 +00 +00 +06 +00 +58 +48 +00 +00 +02 +00 +00 +00 +06 +00 +5c +48 +00 +00 +02 +00 +00 +00 +06 +00 +60 +48 +00 +00 +02 +00 +00 +00 +06 +00 +64 +48 +00 +00 +02 +00 +00 +00 +06 +00 +68 +48 +00 +00 +02 +00 +00 +00 +06 +00 +6c +48 +00 +00 +02 +00 +00 +00 +06 +00 +70 +48 +00 +00 +02 +00 +00 +00 +06 +00 +74 +48 +00 +00 +02 +00 +00 +00 +06 +00 +78 +48 +00 +00 +02 +00 +00 +00 +06 +00 +7c +48 +00 +00 +02 +00 +00 +00 +06 +00 +80 +48 +00 +00 +02 +00 +00 +00 +06 +00 +84 +48 +00 +00 +02 +00 +00 +00 +06 +00 +88 +48 +00 +00 +02 +00 +00 +00 +06 +00 +8c +48 +00 +00 +02 +00 +00 +00 +06 +00 +90 +48 +00 +00 +02 +00 +00 +00 +06 +00 +94 +48 +00 +00 +02 +00 +00 +00 +06 +00 +98 +48 +00 +00 +02 +00 +00 +00 +06 +00 +9c +48 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +48 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +48 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +48 +00 +00 +02 +00 +00 +00 +06 +00 +ac +48 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +48 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +48 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +48 +00 +00 +02 +00 +00 +00 +06 +00 +bc +48 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +48 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +48 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +48 +00 +00 +02 +00 +00 +00 +06 +00 +cc +48 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +48 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +48 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +48 +00 +00 +02 +00 +00 +00 +06 +00 +dc +48 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +48 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +48 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +48 +00 +00 +02 +00 +00 +00 +06 +00 +ec +48 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +48 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +48 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +48 +00 +00 +02 +00 +00 +00 +06 +00 +fc +48 +00 +00 +02 +00 +00 +00 +06 +00 +00 49 -2a -01 +00 00 02 00 @@ -104439,9 +95889,2559 @@ fd 00 06 00 +04 +49 +00 +00 +02 +00 +00 +00 +06 +00 +08 +49 +00 +00 +02 +00 +00 +00 +06 +00 +0c +49 +00 +00 +02 +00 +00 +00 +06 +00 +10 +49 +00 +00 +02 +00 +00 +00 +06 +00 +14 +49 +00 +00 +02 +00 +00 +00 +06 +00 +18 +49 +00 +00 +02 +00 +00 +00 +06 +00 +1c +49 +00 +00 +02 +00 +00 +00 +06 +00 +20 +49 +00 +00 +02 +00 +00 +00 +06 +00 +24 +49 +00 +00 +02 +00 +00 +00 +06 +00 +28 +49 +00 +00 +02 +00 +00 +00 +06 +00 +2c +49 +00 +00 +02 +00 +00 +00 +06 +00 +30 +49 +00 +00 +02 +00 +00 +00 +06 +00 +34 +49 +00 +00 +02 +00 +00 +00 +06 +00 +38 +49 +00 +00 +02 +00 +00 +00 +06 +00 +3c +49 +00 +00 +02 +00 +00 +00 +06 +00 +40 +49 +00 +00 +02 +00 +00 +00 +06 +00 +44 +49 +00 +00 +02 +00 +00 +00 +06 +00 +48 +49 +00 +00 +02 +00 +00 +00 +06 +00 +4c +49 +00 +00 +02 +00 +00 +00 +06 +00 +50 +49 +00 +00 +02 +00 +00 +00 +06 +00 +54 +49 +00 +00 +02 +00 +00 +00 +06 +00 +58 +49 +00 +00 +02 +00 +00 +00 +06 +00 +5c +49 +00 +00 +02 +00 +00 +00 +06 +00 +60 +49 +00 +00 +02 +00 +00 +00 +06 +00 +64 +49 +00 +00 +02 +00 +00 +00 +06 +00 +68 +49 +00 +00 +02 +00 +00 +00 +06 +00 +6c +49 +00 +00 +02 +00 +00 +00 +06 +00 +70 +49 +00 +00 +02 +00 +00 +00 +06 +00 +74 +49 +00 +00 +02 +00 +00 +00 +06 +00 +78 +49 +00 +00 +02 +00 +00 +00 +06 +00 +7c +49 +00 +00 +02 +00 +00 +00 +06 +00 +80 +49 +00 +00 +02 +00 +00 +00 +06 +00 +84 +49 +00 +00 +02 +00 +00 +00 +06 +00 +88 +49 +00 +00 +02 +00 +00 +00 +06 +00 +8c +49 +00 +00 +02 +00 +00 +00 +06 +00 +90 +49 +00 +00 +02 +00 +00 +00 +06 +00 +94 +49 +00 +00 +02 +00 +00 +00 +06 +00 +98 +49 +00 +00 +02 +00 +00 +00 +06 +00 +9c +49 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +49 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +49 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +49 +00 +00 +02 +00 +00 +00 +06 +00 +ac +49 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +49 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +49 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +49 +00 +00 +02 +00 +00 +00 +06 +00 +bc +49 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +49 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +49 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +49 +00 +00 +02 +00 +00 +00 +06 +00 +cc +49 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +49 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +49 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +49 +00 +00 +02 +00 +00 +00 +06 +00 +dc +49 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +49 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +49 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +49 +00 +00 +02 +00 +00 +00 +06 +00 +ec +49 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +49 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +49 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +49 +00 +00 +02 +00 +00 +00 +06 +00 +fc +49 +00 +00 +02 +00 +00 +00 +06 +00 +00 +4a +00 +00 +02 +00 +00 +00 +06 +00 +04 +4a +00 +00 +02 +00 +00 +00 +06 +00 +08 +4a +00 +00 +02 +00 +00 +00 +06 +00 +0c +4a +00 +00 +02 +00 +00 +00 +06 +00 +10 +4a +00 +00 +02 +00 +00 +00 +06 +00 +14 +4a +00 +00 +02 +00 +00 +00 +06 +00 +18 +4a +00 +00 +02 +00 +00 +00 +06 +00 +1c +4a +00 +00 +02 +00 +00 +00 +06 +00 +20 +4a +00 +00 +02 +00 +00 +00 +06 +00 +24 +4a +00 +00 +02 +00 +00 +00 +06 +00 +28 +4a +00 +00 +02 +00 +00 +00 +06 +00 +2c +4a +00 +00 +02 +00 +00 +00 +06 +00 +30 +4a +00 +00 +02 +00 +00 +00 +06 +00 +34 +4a +00 +00 +02 +00 +00 +00 +06 +00 +38 +4a +00 +00 +02 +00 +00 +00 +06 +00 +3c +4a +00 +00 +02 +00 +00 +00 +06 +00 +40 +4a +00 +00 +02 +00 +00 +00 +06 +00 +44 +4a +00 +00 +02 +00 +00 +00 +06 +00 +48 +4a +00 +00 +02 +00 +00 +00 +06 +00 +4c +4a +00 +00 +02 +00 +00 +00 +06 +00 +50 +4a +00 +00 +02 +00 +00 +00 +06 +00 +54 +4a +00 +00 +02 +00 +00 +00 +06 +00 +58 +4a +00 +00 +02 +00 +00 +00 +06 +00 +5c +4a +00 +00 +02 +00 +00 +00 +06 +00 +60 +4a +00 +00 +02 +00 +00 +00 +06 +00 +64 +4a +00 +00 +02 +00 +00 +00 +06 +00 +68 +4a +00 +00 +02 +00 +00 +00 +06 +00 +6c +4a +00 +00 +02 +00 +00 +00 +06 +00 +70 +4a +00 +00 +02 +00 +00 +00 +06 +00 +74 +4a +00 +00 +02 +00 +00 +00 +06 +00 +78 +4a +00 +00 +02 +00 +00 +00 +06 +00 +7c +4a +00 +00 +02 +00 +00 +00 +06 +00 +80 +4a +00 +00 +02 +00 +00 +00 +06 +00 +84 +4a +00 +00 +02 +00 +00 +00 +06 +00 +88 +4a +00 +00 +02 +00 +00 +00 +06 +00 +8c +4a +00 +00 +02 +00 +00 +00 +06 +00 +90 +4a +00 +00 +02 +00 +00 +00 +06 +00 +94 +4a +00 +00 +02 +00 +00 +00 +06 +00 +98 +4a +00 +00 +02 +00 +00 +00 +06 +00 +9c +4a +00 +00 +02 +00 +00 +00 +06 +00 +a0 +4a +00 +00 +02 +00 +00 +00 +06 +00 +a4 +4a +00 +00 +02 +00 +00 +00 +06 +00 +a8 +4a +00 +00 +02 +00 +00 +00 +06 +00 +ac +4a +00 +00 +02 +00 +00 +00 +06 +00 +b0 +4a +00 +00 +02 +00 +00 +00 +06 +00 +b4 +4a +00 +00 +02 +00 +00 +00 +06 +00 +b8 +4a +00 +00 +02 +00 +00 +00 +06 +00 +bc +4a +00 +00 +02 +00 +00 +00 +06 +00 +c0 +4a +00 +00 +02 +00 +00 +00 +06 +00 +c4 +4a +00 +00 +02 +00 +00 +00 +06 +00 +c8 +4a +00 +00 +02 +00 +00 +00 +06 +00 +cc +4a +00 +00 +02 +00 +00 +00 +06 +00 +d0 +4a +00 +00 +02 +00 +00 +00 +06 +00 +d4 +4a +00 +00 +02 +00 +00 +00 +06 +00 +d8 +4a +00 +00 +02 +00 +00 +00 +06 +00 +dc +4a +00 +00 +02 +00 +00 +00 +06 +00 +e0 +4a +00 +00 +02 +00 +00 +00 +06 +00 +e4 +4a +00 +00 +02 +00 +00 +00 +06 +00 +e8 +4a +00 +00 +02 +00 +00 +00 +06 +00 +ec +4a +00 +00 +02 +00 +00 +00 +06 +00 +f0 +4a +00 +00 +02 +00 +00 +00 +06 +00 +f4 +4a +00 +00 +02 +00 +00 +00 +06 +00 +f8 +4a +00 +00 +02 +00 +00 +00 +06 +00 +fc +4a +00 +00 +02 +00 +00 +00 +06 +00 +00 +4b +00 +00 +02 +00 +00 +00 +06 +00 +04 +4b +00 +00 +02 +00 +00 +00 +06 +00 +08 +4b +00 +00 +02 +00 +00 +00 +06 +00 +0c +4b +00 +00 +02 +00 +00 +00 +06 +00 +10 +4b +00 +00 +02 +00 +00 +00 +06 +00 +14 +4b +00 +00 +02 +00 +00 +00 +06 +00 +18 +4b +00 +00 +02 +00 +00 +00 +06 +00 +1c +4b +00 +00 +02 +00 +00 +00 +06 +00 +20 +4b +00 +00 +02 +00 +00 +00 +06 +00 +24 +4b +00 +00 +02 +00 +00 +00 +06 +00 +28 +4b +00 +00 +02 +00 +00 +00 +06 +00 +2c +4b +00 +00 +02 +00 +00 +00 +06 +00 +30 +4b +00 +00 +02 +00 +00 +00 +06 +00 +34 +4b +00 +00 +02 +00 +00 +00 +06 +00 +38 +4b +00 +00 +02 +00 +00 +00 +06 +00 +3c +4b +00 +00 +02 +00 +00 +00 +06 +00 +40 +4b +00 +00 +02 +00 +00 +00 +06 +00 +44 +4b +00 +00 +02 +00 +00 +00 +06 +00 +48 +4b +00 +00 +02 +00 +00 +00 +06 +00 +4c +4b +00 +00 +02 +00 +00 +00 +06 +00 +50 +4b +00 +00 +02 +00 +00 +00 +06 +00 +54 +4b +00 +00 +02 +00 +00 +00 +06 +00 +58 +4b +00 +00 +02 +00 +00 +00 +06 +00 +5c +4b +00 +00 +02 +00 +00 +00 +06 +00 +60 +4b +00 +00 +02 +00 +00 +00 +06 +00 +64 +4b +00 +00 +02 +00 +00 +00 +06 +00 +68 +4b +00 +00 +02 +00 +00 +00 +06 +00 +6c +4b +00 +00 +02 +00 +00 +00 +06 +00 +70 +4b +00 +00 +02 +00 +00 +00 +06 +00 +74 +4b +00 +00 +02 +00 +00 +00 +06 +00 +78 +4b +00 +00 +02 +00 +00 +00 +06 +00 +7c +4b +00 +00 +02 +00 +00 +00 +06 +00 +80 +4b +00 +00 +02 +00 +00 +00 +06 +00 +84 +4b +00 +00 +02 +00 +00 +00 +06 +00 +88 +4b +00 +00 +02 +00 +00 +00 +06 +00 +8c +4b +00 +00 +02 +00 +00 +00 +06 +00 +90 +4b +00 +00 +02 +00 +00 +00 +06 +00 +94 +4b +00 +00 +02 +00 +00 +00 +06 +00 +98 +4b +00 +00 +02 +00 +00 +00 +06 +00 +9c +4b +00 +00 +02 +00 +00 +00 +06 +00 +a0 +4b +00 +00 +02 +00 +00 +00 +06 +00 +a4 +4b +00 +00 +02 +00 +00 +00 +06 +00 +a8 +4b +00 +00 +02 +00 +00 +00 +06 +00 +ac +4b +00 +00 +02 +00 +00 +00 +06 +00 +b0 +4b +00 +00 +02 +00 +00 +00 +06 +00 +b4 +4b +00 +00 +02 +00 +00 +00 +06 +00 +b8 +4b +00 +00 +02 +00 +00 +00 +06 +00 +bc +4b +00 +00 +02 +00 +00 +00 +06 +00 +c0 +4b +00 +00 +02 +00 +00 +00 +06 +00 +c4 +4b +00 +00 +02 +00 +00 +00 +06 +00 +c8 +4b +00 +00 +02 +00 +00 +00 +06 +00 +cc +4b +00 +00 +02 +00 +00 +00 +06 +00 +d0 +4b +00 +00 +02 +00 +00 +00 +06 +00 +d4 +4b +00 +00 +02 +00 +00 +00 +06 +00 +d8 +4b +00 +00 +02 +00 +00 +00 +06 +00 +dc +4b +00 +00 +02 +00 +00 +00 +06 +00 +e0 +4b +00 +00 +02 +00 +00 +00 +06 +00 +e4 +4b +00 +00 +02 +00 +00 +00 +06 +00 +e8 +4b +00 +00 +02 +00 +00 +00 +06 +00 +ec +4b +00 +00 +02 +00 +00 +00 +06 +00 +f0 +4b +00 +00 +02 +00 +00 +00 +06 +00 +f4 +4b +00 +00 +02 +00 +00 +00 +06 +00 +f8 +4b +00 +00 +02 +00 +00 +00 +06 +00 +fc +4b +00 +00 +02 +00 +00 +00 +06 +00 +00 +4c +00 +00 +02 +00 +00 +00 +06 +00 +04 +4c +00 +00 +02 +00 +00 +00 +06 +00 +08 +4c +00 +00 +02 +00 +00 +00 +06 +00 +0c +4c +00 +00 +02 +00 +00 +00 +06 +00 +10 +4c +00 +00 +02 +00 +00 +00 +06 +00 +14 +4c +00 +00 +02 +00 +00 +00 +06 +00 +18 +4c +00 +00 +02 +00 +00 +00 +06 +00 +1c +4c +00 +00 +02 +00 +00 +00 +06 +00 +20 +4c +00 +00 +02 +00 +00 +00 +06 +00 +24 +4c +00 +00 +02 +00 +00 +00 +06 +00 +28 +4c +00 +00 +02 +00 +00 +00 +06 +00 +2c +4c +00 +00 +02 +00 +00 +00 +06 +00 +30 +4c +00 +00 +02 +00 +00 +00 +06 +00 +34 +4c +00 +00 +02 +00 +00 +00 +06 +00 +38 +4c +00 +00 +02 +00 +00 +00 +06 +00 +3c +4c +00 +00 +02 +00 +00 +00 +06 +00 +40 +4c +00 +00 +02 +00 +00 +00 +06 +00 +44 +4c +00 +00 +02 +00 +00 +00 +06 +00 +48 +4c +00 +00 +02 +00 +00 +00 +06 +00 +4c +4c +00 +00 +02 +00 +00 +00 +06 +00 +50 +4c +00 +00 +02 +00 +00 +00 +06 +00 +54 +4c +00 +00 +02 +00 +00 +00 +06 +00 +58 +4c +00 +00 +02 +00 +00 +00 +06 +00 +5c +4c +00 +00 +02 +00 +00 +00 +06 +00 +60 +4c +00 +00 +02 +00 +00 +00 +06 +00 +64 +4c +00 +00 +02 +00 +00 +00 +06 +00 +68 +4c +00 +00 +02 +00 +00 +00 +06 +00 +6c +4c +00 +00 +02 +00 +00 +00 +06 +00 +70 +4c +00 +00 +02 +00 +00 +00 +06 +00 +74 +4c +00 +00 +02 +00 +00 +00 +06 +00 +78 +4c +00 +00 +02 +00 +00 +00 +06 +00 +7c +4c +00 +00 +02 +00 +00 +00 +06 +00 +80 +4c +00 +00 +02 +00 +00 +00 +06 +00 +84 +4c +00 +00 +02 +00 +00 +00 +06 +00 +88 +4c +00 +00 +02 +00 +00 +00 +06 +00 +8c +4c +00 +00 +02 +00 +00 +00 +06 +00 +90 +4c +00 +00 +02 +00 +00 +00 +06 +00 +94 +4c +00 +00 +02 +00 +00 +00 +06 +00 +98 +4c +00 +00 +02 +00 +00 +00 +06 +00 +9c +4c +00 +00 +02 +00 +00 +00 +06 +00 +a0 +4c +00 +00 +02 +00 +00 +00 +06 +00 +a4 +4c +00 +00 +02 +00 +00 +00 +06 +00 +a8 +4c +00 +00 +02 +00 +00 +00 +06 +00 +ac +4c +00 +00 +02 +00 +00 +00 +06 +00 +b0 +4c +00 +00 +02 +00 +00 +00 +06 +00 +b4 +4c +00 +00 +02 +00 +00 +00 +06 +00 +b8 +4c +00 +00 +02 +00 +00 +00 +06 +00 +bc +4c +00 +00 +02 +00 +00 +00 +06 +00 +c0 +4c +00 +00 +02 +00 +00 +00 +06 +00 +c4 +4c +00 +00 +02 +00 +00 +00 +06 +00 +c8 +4c +00 +00 +02 +00 +00 +00 +06 +00 +cc +4c +00 +00 +02 +00 +00 +00 +06 +00 +d0 +4c +00 +00 +02 +00 +00 +00 +06 +00 +d4 +4c +00 +00 +02 +00 +00 +00 +06 +00 +d8 +4c +00 +00 +02 +00 +00 +00 +06 +00 +dc +4c +00 +00 +02 +00 +00 +00 +06 +00 +e0 +4c +00 +00 +02 +00 +00 +00 +06 +00 +e4 +4c +00 +00 +02 +00 +00 +00 +06 +00 +e8 +4c +00 +00 +02 +00 +00 +00 +06 +00 +ec +4c +00 +00 +02 +00 +00 +00 +06 +00 +f0 +4c +00 +00 +02 +00 +00 +00 +06 +00 +f4 +4c +00 +00 +02 +00 +00 +00 +06 +00 +f8 +4c +00 +00 +02 +00 +00 +00 +06 +00 +fc +4c +00 +00 +02 +00 +00 +00 +06 +00 +00 4d -2a -01 +00 00 02 00 @@ -104449,9 +98449,2559 @@ fd 00 06 00 +04 +4d +00 +00 +02 +00 +00 +00 +06 +00 +08 +4d +00 +00 +02 +00 +00 +00 +06 +00 +0c +4d +00 +00 +02 +00 +00 +00 +06 +00 +10 +4d +00 +00 +02 +00 +00 +00 +06 +00 +14 +4d +00 +00 +02 +00 +00 +00 +06 +00 +18 +4d +00 +00 +02 +00 +00 +00 +06 +00 +1c +4d +00 +00 +02 +00 +00 +00 +06 +00 +20 +4d +00 +00 +02 +00 +00 +00 +06 +00 +24 +4d +00 +00 +02 +00 +00 +00 +06 +00 +28 +4d +00 +00 +02 +00 +00 +00 +06 +00 +2c +4d +00 +00 +02 +00 +00 +00 +06 +00 +30 +4d +00 +00 +02 +00 +00 +00 +06 +00 +34 +4d +00 +00 +02 +00 +00 +00 +06 +00 +38 +4d +00 +00 +02 +00 +00 +00 +06 +00 +3c +4d +00 +00 +02 +00 +00 +00 +06 +00 +40 +4d +00 +00 +02 +00 +00 +00 +06 +00 +44 +4d +00 +00 +02 +00 +00 +00 +06 +00 +48 +4d +00 +00 +02 +00 +00 +00 +06 +00 +4c +4d +00 +00 +02 +00 +00 +00 +06 +00 +50 +4d +00 +00 +02 +00 +00 +00 +06 +00 +54 +4d +00 +00 +02 +00 +00 +00 +06 +00 +58 +4d +00 +00 +02 +00 +00 +00 +06 +00 +5c +4d +00 +00 +02 +00 +00 +00 +06 +00 +60 +4d +00 +00 +02 +00 +00 +00 +06 +00 +64 +4d +00 +00 +02 +00 +00 +00 +06 +00 +68 +4d +00 +00 +02 +00 +00 +00 +06 +00 +6c +4d +00 +00 +02 +00 +00 +00 +06 +00 +70 +4d +00 +00 +02 +00 +00 +00 +06 +00 +74 +4d +00 +00 +02 +00 +00 +00 +06 +00 +78 +4d +00 +00 +02 +00 +00 +00 +06 +00 +7c +4d +00 +00 +02 +00 +00 +00 +06 +00 +80 +4d +00 +00 +02 +00 +00 +00 +06 +00 +84 +4d +00 +00 +02 +00 +00 +00 +06 +00 +88 +4d +00 +00 +02 +00 +00 +00 +06 +00 +8c +4d +00 +00 +02 +00 +00 +00 +06 +00 +90 +4d +00 +00 +02 +00 +00 +00 +06 +00 +94 +4d +00 +00 +02 +00 +00 +00 +06 +00 +98 +4d +00 +00 +02 +00 +00 +00 +06 +00 +9c +4d +00 +00 +02 +00 +00 +00 +06 +00 +a0 +4d +00 +00 +02 +00 +00 +00 +06 +00 +a4 +4d +00 +00 +02 +00 +00 +00 +06 +00 +a8 +4d +00 +00 +02 +00 +00 +00 +06 +00 +ac +4d +00 +00 +02 +00 +00 +00 +06 +00 +b0 +4d +00 +00 +02 +00 +00 +00 +06 +00 +b4 +4d +00 +00 +02 +00 +00 +00 +06 +00 +b8 +4d +00 +00 +02 +00 +00 +00 +06 +00 +bc +4d +00 +00 +02 +00 +00 +00 +06 +00 +c0 +4d +00 +00 +02 +00 +00 +00 +06 +00 +c4 +4d +00 +00 +02 +00 +00 +00 +06 +00 +c8 +4d +00 +00 +02 +00 +00 +00 +06 +00 +cc +4d +00 +00 +02 +00 +00 +00 +06 +00 +d0 +4d +00 +00 +02 +00 +00 +00 +06 +00 +d4 +4d +00 +00 +02 +00 +00 +00 +06 +00 +d8 +4d +00 +00 +02 +00 +00 +00 +06 +00 +dc +4d +00 +00 +02 +00 +00 +00 +06 +00 +e0 +4d +00 +00 +02 +00 +00 +00 +06 +00 +e4 +4d +00 +00 +02 +00 +00 +00 +06 +00 +e8 +4d +00 +00 +02 +00 +00 +00 +06 +00 +ec +4d +00 +00 +02 +00 +00 +00 +06 +00 +f0 +4d +00 +00 +02 +00 +00 +00 +06 +00 +f4 +4d +00 +00 +02 +00 +00 +00 +06 +00 +f8 +4d +00 +00 +02 +00 +00 +00 +06 +00 +fc +4d +00 +00 +02 +00 +00 +00 +06 +00 +00 +4e +00 +00 +02 +00 +00 +00 +06 +00 +04 +4e +00 +00 +02 +00 +00 +00 +06 +00 +08 +4e +00 +00 +02 +00 +00 +00 +06 +00 +0c +4e +00 +00 +02 +00 +00 +00 +06 +00 +10 +4e +00 +00 +02 +00 +00 +00 +06 +00 +14 +4e +00 +00 +02 +00 +00 +00 +06 +00 +18 +4e +00 +00 +02 +00 +00 +00 +06 +00 +1c +4e +00 +00 +02 +00 +00 +00 +06 +00 +20 +4e +00 +00 +02 +00 +00 +00 +06 +00 +24 +4e +00 +00 +02 +00 +00 +00 +06 +00 +28 +4e +00 +00 +02 +00 +00 +00 +06 +00 +2c +4e +00 +00 +02 +00 +00 +00 +06 +00 +30 +4e +00 +00 +02 +00 +00 +00 +06 +00 +34 +4e +00 +00 +02 +00 +00 +00 +06 +00 +38 +4e +00 +00 +02 +00 +00 +00 +06 +00 +3c +4e +00 +00 +02 +00 +00 +00 +06 +00 +40 +4e +00 +00 +02 +00 +00 +00 +06 +00 +44 +4e +00 +00 +02 +00 +00 +00 +06 +00 +48 +4e +00 +00 +02 +00 +00 +00 +06 +00 +4c +4e +00 +00 +02 +00 +00 +00 +06 +00 +50 +4e +00 +00 +02 +00 +00 +00 +06 +00 +54 +4e +00 +00 +02 +00 +00 +00 +06 +00 +58 +4e +00 +00 +02 +00 +00 +00 +06 +00 +5c +4e +00 +00 +02 +00 +00 +00 +06 +00 +60 +4e +00 +00 +02 +00 +00 +00 +06 +00 +64 +4e +00 +00 +02 +00 +00 +00 +06 +00 +68 +4e +00 +00 +02 +00 +00 +00 +06 +00 +6c +4e +00 +00 +02 +00 +00 +00 +06 +00 +70 +4e +00 +00 +02 +00 +00 +00 +06 +00 +74 +4e +00 +00 +02 +00 +00 +00 +06 +00 +78 +4e +00 +00 +02 +00 +00 +00 +06 +00 +7c +4e +00 +00 +02 +00 +00 +00 +06 +00 +80 +4e +00 +00 +02 +00 +00 +00 +06 +00 +84 +4e +00 +00 +02 +00 +00 +00 +06 +00 +88 +4e +00 +00 +02 +00 +00 +00 +06 +00 +8c +4e +00 +00 +02 +00 +00 +00 +06 +00 +90 +4e +00 +00 +02 +00 +00 +00 +06 +00 +94 +4e +00 +00 +02 +00 +00 +00 +06 +00 +98 +4e +00 +00 +02 +00 +00 +00 +06 +00 +9c +4e +00 +00 +02 +00 +00 +00 +06 +00 +a0 +4e +00 +00 +02 +00 +00 +00 +06 +00 +a4 +4e +00 +00 +02 +00 +00 +00 +06 +00 +a8 +4e +00 +00 +02 +00 +00 +00 +06 +00 +ac +4e +00 +00 +02 +00 +00 +00 +06 +00 +b0 +4e +00 +00 +02 +00 +00 +00 +06 +00 +b4 +4e +00 +00 +02 +00 +00 +00 +06 +00 +b8 +4e +00 +00 +02 +00 +00 +00 +06 +00 +bc +4e +00 +00 +02 +00 +00 +00 +06 +00 +c0 +4e +00 +00 +02 +00 +00 +00 +06 +00 +c4 +4e +00 +00 +02 +00 +00 +00 +06 +00 +c8 +4e +00 +00 +02 +00 +00 +00 +06 +00 +cc +4e +00 +00 +02 +00 +00 +00 +06 +00 +d0 +4e +00 +00 +02 +00 +00 +00 +06 +00 +d4 +4e +00 +00 +02 +00 +00 +00 +06 +00 +d8 +4e +00 +00 +02 +00 +00 +00 +06 +00 +dc +4e +00 +00 +02 +00 +00 +00 +06 +00 +e0 +4e +00 +00 +02 +00 +00 +00 +06 +00 +e4 +4e +00 +00 +02 +00 +00 +00 +06 +00 +e8 +4e +00 +00 +02 +00 +00 +00 +06 +00 +ec +4e +00 +00 +02 +00 +00 +00 +06 +00 +f0 +4e +00 +00 +02 +00 +00 +00 +06 +00 +f4 +4e +00 +00 +02 +00 +00 +00 +06 +00 +f8 +4e +00 +00 +02 +00 +00 +00 +06 +00 +fc +4e +00 +00 +02 +00 +00 +00 +06 +00 +00 +4f +00 +00 +02 +00 +00 +00 +06 +00 +04 +4f +00 +00 +02 +00 +00 +00 +06 +00 +08 +4f +00 +00 +02 +00 +00 +00 +06 +00 +0c +4f +00 +00 +02 +00 +00 +00 +06 +00 +10 +4f +00 +00 +02 +00 +00 +00 +06 +00 +14 +4f +00 +00 +02 +00 +00 +00 +06 +00 +18 +4f +00 +00 +02 +00 +00 +00 +06 +00 +1c +4f +00 +00 +02 +00 +00 +00 +06 +00 +20 +4f +00 +00 +02 +00 +00 +00 +06 +00 +24 +4f +00 +00 +02 +00 +00 +00 +06 +00 +28 +4f +00 +00 +02 +00 +00 +00 +06 +00 +2c +4f +00 +00 +02 +00 +00 +00 +06 +00 +30 +4f +00 +00 +02 +00 +00 +00 +06 +00 +34 +4f +00 +00 +02 +00 +00 +00 +06 +00 +38 +4f +00 +00 +02 +00 +00 +00 +06 +00 +3c +4f +00 +00 +02 +00 +00 +00 +06 +00 +40 +4f +00 +00 +02 +00 +00 +00 +06 +00 +44 +4f +00 +00 +02 +00 +00 +00 +06 +00 +48 +4f +00 +00 +02 +00 +00 +00 +06 +00 +4c +4f +00 +00 +02 +00 +00 +00 +06 +00 +50 +4f +00 +00 +02 +00 +00 +00 +06 +00 +54 +4f +00 +00 +02 +00 +00 +00 +06 +00 +58 +4f +00 +00 +02 +00 +00 +00 +06 +00 +5c +4f +00 +00 +02 +00 +00 +00 +06 +00 +60 +4f +00 +00 +02 +00 +00 +00 +06 +00 +64 +4f +00 +00 +02 +00 +00 +00 +06 +00 +68 +4f +00 +00 +02 +00 +00 +00 +06 +00 +6c +4f +00 +00 +02 +00 +00 +00 +06 +00 +70 +4f +00 +00 +02 +00 +00 +00 +06 +00 +74 +4f +00 +00 +02 +00 +00 +00 +06 +00 +78 +4f +00 +00 +02 +00 +00 +00 +06 +00 +7c +4f +00 +00 +02 +00 +00 +00 +06 +00 +80 +4f +00 +00 +02 +00 +00 +00 +06 +00 +84 +4f +00 +00 +02 +00 +00 +00 +06 +00 +88 +4f +00 +00 +02 +00 +00 +00 +06 +00 +8c +4f +00 +00 +02 +00 +00 +00 +06 +00 +90 +4f +00 +00 +02 +00 +00 +00 +06 +00 +94 +4f +00 +00 +02 +00 +00 +00 +06 +00 +98 +4f +00 +00 +02 +00 +00 +00 +06 +00 +9c +4f +00 +00 +02 +00 +00 +00 +06 +00 +a0 +4f +00 +00 +02 +00 +00 +00 +06 +00 +a4 +4f +00 +00 +02 +00 +00 +00 +06 +00 +a8 +4f +00 +00 +02 +00 +00 +00 +06 +00 +ac +4f +00 +00 +02 +00 +00 +00 +06 +00 +b0 +4f +00 +00 +02 +00 +00 +00 +06 +00 +b4 +4f +00 +00 +02 +00 +00 +00 +06 +00 +b8 +4f +00 +00 +02 +00 +00 +00 +06 +00 +bc +4f +00 +00 +02 +00 +00 +00 +06 +00 +c0 +4f +00 +00 +02 +00 +00 +00 +06 +00 +c4 +4f +00 +00 +02 +00 +00 +00 +06 +00 +c8 +4f +00 +00 +02 +00 +00 +00 +06 +00 +cc +4f +00 +00 +02 +00 +00 +00 +06 +00 +d0 +4f +00 +00 +02 +00 +00 +00 +06 +00 +d4 +4f +00 +00 +02 +00 +00 +00 +06 +00 +d8 +4f +00 +00 +02 +00 +00 +00 +06 +00 +dc +4f +00 +00 +02 +00 +00 +00 +06 +00 +e0 +4f +00 +00 +02 +00 +00 +00 +06 +00 +e4 +4f +00 +00 +02 +00 +00 +00 +06 +00 +e8 +4f +00 +00 +02 +00 +00 +00 +06 +00 +ec +4f +00 +00 +02 +00 +00 +00 +06 +00 +f0 +4f +00 +00 +02 +00 +00 +00 +06 +00 +f4 +4f +00 +00 +02 +00 +00 +00 +06 +00 +f8 +4f +00 +00 +02 +00 +00 +00 +06 +00 +fc +4f +00 +00 +02 +00 +00 +00 +06 +00 +00 +50 +00 +00 +02 +00 +00 +00 +06 +00 +04 +50 +00 +00 +02 +00 +00 +00 +06 +00 +08 +50 +00 +00 +02 +00 +00 +00 +06 +00 +0c +50 +00 +00 +02 +00 +00 +00 +06 +00 +10 +50 +00 +00 +02 +00 +00 +00 +06 +00 +14 +50 +00 +00 +02 +00 +00 +00 +06 +00 +18 +50 +00 +00 +02 +00 +00 +00 +06 +00 +1c +50 +00 +00 +02 +00 +00 +00 +06 +00 +20 +50 +00 +00 +02 +00 +00 +00 +06 +00 +24 +50 +00 +00 +02 +00 +00 +00 +06 +00 +28 +50 +00 +00 +02 +00 +00 +00 +06 +00 +2c +50 +00 +00 +02 +00 +00 +00 +06 +00 +30 +50 +00 +00 +02 +00 +00 +00 +06 +00 +34 +50 +00 +00 +02 +00 +00 +00 +06 +00 +38 +50 +00 +00 +02 +00 +00 +00 +06 +00 +3c +50 +00 +00 +02 +00 +00 +00 +06 +00 +40 +50 +00 +00 +02 +00 +00 +00 +06 +00 +44 +50 +00 +00 +02 +00 +00 +00 +06 +00 +48 +50 +00 +00 +02 +00 +00 +00 +06 +00 +4c +50 +00 +00 +02 +00 +00 +00 +06 +00 +50 +50 +00 +00 +02 +00 +00 +00 +06 +00 +54 +50 +00 +00 +02 +00 +00 +00 +06 +00 +58 +50 +00 +00 +02 +00 +00 +00 +06 +00 +5c +50 +00 +00 +02 +00 +00 +00 +06 +00 +60 +50 +00 +00 +02 +00 +00 +00 +06 +00 +64 +50 +00 +00 +02 +00 +00 +00 +06 +00 +68 +50 +00 +00 +02 +00 +00 +00 +06 +00 +6c +50 +00 +00 +02 +00 +00 +00 +06 +00 +70 +50 +00 +00 +02 +00 +00 +00 +06 +00 +74 +50 +00 +00 +02 +00 +00 +00 +06 +00 +78 +50 +00 +00 +02 +00 +00 +00 +06 +00 +7c +50 +00 +00 +02 +00 +00 +00 +06 +00 +80 +50 +00 +00 +02 +00 +00 +00 +06 +00 +84 +50 +00 +00 +02 +00 +00 +00 +06 +00 +88 +50 +00 +00 +02 +00 +00 +00 +06 +00 +8c +50 +00 +00 +02 +00 +00 +00 +06 +00 +90 +50 +00 +00 +02 +00 +00 +00 +06 +00 +94 +50 +00 +00 +02 +00 +00 +00 +06 +00 +98 +50 +00 +00 +02 +00 +00 +00 +06 +00 +9c +50 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +50 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +50 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +50 +00 +00 +02 +00 +00 +00 +06 +00 +ac +50 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +50 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +50 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +50 +00 +00 +02 +00 +00 +00 +06 +00 +bc +50 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +50 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +50 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +50 +00 +00 +02 +00 +00 +00 +06 +00 +cc +50 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +50 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +50 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +50 +00 +00 +02 +00 +00 +00 +06 +00 +dc +50 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +50 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +50 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +50 +00 +00 +02 +00 +00 +00 +06 +00 +ec +50 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +50 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +50 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +50 +00 +00 +02 +00 +00 +00 +06 +00 +fc +50 +00 +00 +02 +00 +00 +00 +06 +00 +00 51 -2a -01 +00 00 02 00 @@ -104459,9 +101009,2559 @@ fd 00 06 00 +04 +51 +00 +00 +02 +00 +00 +00 +06 +00 +08 +51 +00 +00 +02 +00 +00 +00 +06 +00 +0c +51 +00 +00 +02 +00 +00 +00 +06 +00 +10 +51 +00 +00 +02 +00 +00 +00 +06 +00 +14 +51 +00 +00 +02 +00 +00 +00 +06 +00 +18 +51 +00 +00 +02 +00 +00 +00 +06 +00 +1c +51 +00 +00 +02 +00 +00 +00 +06 +00 +20 +51 +00 +00 +02 +00 +00 +00 +06 +00 +24 +51 +00 +00 +02 +00 +00 +00 +06 +00 +28 +51 +00 +00 +02 +00 +00 +00 +06 +00 +2c +51 +00 +00 +02 +00 +00 +00 +06 +00 +30 +51 +00 +00 +02 +00 +00 +00 +06 +00 +34 +51 +00 +00 +02 +00 +00 +00 +06 +00 +38 +51 +00 +00 +02 +00 +00 +00 +06 +00 +3c +51 +00 +00 +02 +00 +00 +00 +06 +00 +40 +51 +00 +00 +02 +00 +00 +00 +06 +00 +44 +51 +00 +00 +02 +00 +00 +00 +06 +00 +48 +51 +00 +00 +02 +00 +00 +00 +06 +00 +4c +51 +00 +00 +02 +00 +00 +00 +06 +00 +50 +51 +00 +00 +02 +00 +00 +00 +06 +00 +54 +51 +00 +00 +02 +00 +00 +00 +06 +00 +58 +51 +00 +00 +02 +00 +00 +00 +06 +00 +5c +51 +00 +00 +02 +00 +00 +00 +06 +00 +60 +51 +00 +00 +02 +00 +00 +00 +06 +00 +64 +51 +00 +00 +02 +00 +00 +00 +06 +00 +68 +51 +00 +00 +02 +00 +00 +00 +06 +00 +6c +51 +00 +00 +02 +00 +00 +00 +06 +00 +70 +51 +00 +00 +02 +00 +00 +00 +06 +00 +74 +51 +00 +00 +02 +00 +00 +00 +06 +00 +78 +51 +00 +00 +02 +00 +00 +00 +06 +00 +7c +51 +00 +00 +02 +00 +00 +00 +06 +00 +80 +51 +00 +00 +02 +00 +00 +00 +06 +00 +84 +51 +00 +00 +02 +00 +00 +00 +06 +00 +88 +51 +00 +00 +02 +00 +00 +00 +06 +00 +8c +51 +00 +00 +02 +00 +00 +00 +06 +00 +90 +51 +00 +00 +02 +00 +00 +00 +06 +00 +94 +51 +00 +00 +02 +00 +00 +00 +06 +00 +98 +51 +00 +00 +02 +00 +00 +00 +06 +00 +9c +51 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +51 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +51 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +51 +00 +00 +02 +00 +00 +00 +06 +00 +ac +51 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +51 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +51 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +51 +00 +00 +02 +00 +00 +00 +06 +00 +bc +51 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +51 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +51 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +51 +00 +00 +02 +00 +00 +00 +06 +00 +cc +51 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +51 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +51 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +51 +00 +00 +02 +00 +00 +00 +06 +00 +dc +51 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +51 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +51 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +51 +00 +00 +02 +00 +00 +00 +06 +00 +ec +51 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +51 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +51 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +51 +00 +00 +02 +00 +00 +00 +06 +00 +fc +51 +00 +00 +02 +00 +00 +00 +06 +00 +00 +52 +00 +00 +02 +00 +00 +00 +06 +00 +04 +52 +00 +00 +02 +00 +00 +00 +06 +00 +08 +52 +00 +00 +02 +00 +00 +00 +06 +00 +0c +52 +00 +00 +02 +00 +00 +00 +06 +00 +10 +52 +00 +00 +02 +00 +00 +00 +06 +00 +14 +52 +00 +00 +02 +00 +00 +00 +06 +00 +18 +52 +00 +00 +02 +00 +00 +00 +06 +00 +1c +52 +00 +00 +02 +00 +00 +00 +06 +00 +20 +52 +00 +00 +02 +00 +00 +00 +06 +00 +24 +52 +00 +00 +02 +00 +00 +00 +06 +00 +28 +52 +00 +00 +02 +00 +00 +00 +06 +00 +2c +52 +00 +00 +02 +00 +00 +00 +06 +00 +30 +52 +00 +00 +02 +00 +00 +00 +06 +00 +34 +52 +00 +00 +02 +00 +00 +00 +06 +00 +38 +52 +00 +00 +02 +00 +00 +00 +06 +00 +3c +52 +00 +00 +02 +00 +00 +00 +06 +00 +40 +52 +00 +00 +02 +00 +00 +00 +06 +00 +44 +52 +00 +00 +02 +00 +00 +00 +06 +00 +48 +52 +00 +00 +02 +00 +00 +00 +06 +00 +4c +52 +00 +00 +02 +00 +00 +00 +06 +00 +50 +52 +00 +00 +02 +00 +00 +00 +06 +00 +54 +52 +00 +00 +02 +00 +00 +00 +06 +00 +58 +52 +00 +00 +02 +00 +00 +00 +06 +00 +5c +52 +00 +00 +02 +00 +00 +00 +06 +00 +60 +52 +00 +00 +02 +00 +00 +00 +06 +00 +64 +52 +00 +00 +02 +00 +00 +00 +06 +00 +68 +52 +00 +00 +02 +00 +00 +00 +06 +00 +6c +52 +00 +00 +02 +00 +00 +00 +06 +00 +70 +52 +00 +00 +02 +00 +00 +00 +06 +00 +74 +52 +00 +00 +02 +00 +00 +00 +06 +00 +78 +52 +00 +00 +02 +00 +00 +00 +06 +00 +7c +52 +00 +00 +02 +00 +00 +00 +06 +00 +80 +52 +00 +00 +02 +00 +00 +00 +06 +00 +84 +52 +00 +00 +02 +00 +00 +00 +06 +00 +88 +52 +00 +00 +02 +00 +00 +00 +06 +00 +8c +52 +00 +00 +02 +00 +00 +00 +06 +00 +90 +52 +00 +00 +02 +00 +00 +00 +06 +00 +94 +52 +00 +00 +02 +00 +00 +00 +06 +00 +98 +52 +00 +00 +02 +00 +00 +00 +06 +00 +9c +52 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +52 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +52 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +52 +00 +00 +02 +00 +00 +00 +06 +00 +ac +52 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +52 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +52 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +52 +00 +00 +02 +00 +00 +00 +06 +00 +bc +52 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +52 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +52 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +52 +00 +00 +02 +00 +00 +00 +06 +00 +cc +52 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +52 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +52 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +52 +00 +00 +02 +00 +00 +00 +06 +00 +dc +52 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +52 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +52 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +52 +00 +00 +02 +00 +00 +00 +06 +00 +ec +52 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +52 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +52 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +52 +00 +00 +02 +00 +00 +00 +06 +00 +fc +52 +00 +00 +02 +00 +00 +00 +06 +00 +00 +53 +00 +00 +02 +00 +00 +00 +06 +00 +04 +53 +00 +00 +02 +00 +00 +00 +06 +00 +08 +53 +00 +00 +02 +00 +00 +00 +06 +00 +0c +53 +00 +00 +02 +00 +00 +00 +06 +00 +10 +53 +00 +00 +02 +00 +00 +00 +06 +00 +14 +53 +00 +00 +02 +00 +00 +00 +06 +00 +18 +53 +00 +00 +02 +00 +00 +00 +06 +00 +1c +53 +00 +00 +02 +00 +00 +00 +06 +00 +20 +53 +00 +00 +02 +00 +00 +00 +06 +00 +24 +53 +00 +00 +02 +00 +00 +00 +06 +00 +28 +53 +00 +00 +02 +00 +00 +00 +06 +00 +2c +53 +00 +00 +02 +00 +00 +00 +06 +00 +30 +53 +00 +00 +02 +00 +00 +00 +06 +00 +34 +53 +00 +00 +02 +00 +00 +00 +06 +00 +38 +53 +00 +00 +02 +00 +00 +00 +06 +00 +3c +53 +00 +00 +02 +00 +00 +00 +06 +00 +40 +53 +00 +00 +02 +00 +00 +00 +06 +00 +44 +53 +00 +00 +02 +00 +00 +00 +06 +00 +48 +53 +00 +00 +02 +00 +00 +00 +06 +00 +4c +53 +00 +00 +02 +00 +00 +00 +06 +00 +50 +53 +00 +00 +02 +00 +00 +00 +06 +00 +54 +53 +00 +00 +02 +00 +00 +00 +06 +00 +58 +53 +00 +00 +02 +00 +00 +00 +06 +00 +5c +53 +00 +00 +02 +00 +00 +00 +06 +00 +60 +53 +00 +00 +02 +00 +00 +00 +06 +00 +64 +53 +00 +00 +02 +00 +00 +00 +06 +00 +68 +53 +00 +00 +02 +00 +00 +00 +06 +00 +6c +53 +00 +00 +02 +00 +00 +00 +06 +00 +70 +53 +00 +00 +02 +00 +00 +00 +06 +00 +74 +53 +00 +00 +02 +00 +00 +00 +06 +00 +78 +53 +00 +00 +02 +00 +00 +00 +06 +00 +7c +53 +00 +00 +02 +00 +00 +00 +06 +00 +80 +53 +00 +00 +02 +00 +00 +00 +06 +00 +84 +53 +00 +00 +02 +00 +00 +00 +06 +00 +88 +53 +00 +00 +02 +00 +00 +00 +06 +00 +8c +53 +00 +00 +02 +00 +00 +00 +06 +00 +90 +53 +00 +00 +02 +00 +00 +00 +06 +00 +94 +53 +00 +00 +02 +00 +00 +00 +06 +00 +98 +53 +00 +00 +02 +00 +00 +00 +06 +00 +9c +53 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +53 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +53 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +53 +00 +00 +02 +00 +00 +00 +06 +00 +ac +53 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +53 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +53 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +53 +00 +00 +02 +00 +00 +00 +06 +00 +bc +53 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +53 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +53 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +53 +00 +00 +02 +00 +00 +00 +06 +00 +cc +53 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +53 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +53 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +53 +00 +00 +02 +00 +00 +00 +06 +00 +dc +53 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +53 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +53 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +53 +00 +00 +02 +00 +00 +00 +06 +00 +ec +53 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +53 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +53 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +53 +00 +00 +02 +00 +00 +00 +06 +00 +fc +53 +00 +00 +02 +00 +00 +00 +06 +00 +00 +54 +00 +00 +02 +00 +00 +00 +06 +00 +04 +54 +00 +00 +02 +00 +00 +00 +06 +00 +08 +54 +00 +00 +02 +00 +00 +00 +06 +00 +0c +54 +00 +00 +02 +00 +00 +00 +06 +00 +10 +54 +00 +00 +02 +00 +00 +00 +06 +00 +14 +54 +00 +00 +02 +00 +00 +00 +06 +00 +18 +54 +00 +00 +02 +00 +00 +00 +06 +00 +1c +54 +00 +00 +02 +00 +00 +00 +06 +00 +20 +54 +00 +00 +02 +00 +00 +00 +06 +00 +24 +54 +00 +00 +02 +00 +00 +00 +06 +00 +28 +54 +00 +00 +02 +00 +00 +00 +06 +00 +2c +54 +00 +00 +02 +00 +00 +00 +06 +00 +30 +54 +00 +00 +02 +00 +00 +00 +06 +00 +34 +54 +00 +00 +02 +00 +00 +00 +06 +00 +38 +54 +00 +00 +02 +00 +00 +00 +06 +00 +3c +54 +00 +00 +02 +00 +00 +00 +06 +00 +40 +54 +00 +00 +02 +00 +00 +00 +06 +00 +44 +54 +00 +00 +02 +00 +00 +00 +06 +00 +48 +54 +00 +00 +02 +00 +00 +00 +06 +00 +4c +54 +00 +00 +02 +00 +00 +00 +06 +00 +50 +54 +00 +00 +02 +00 +00 +00 +06 +00 +54 +54 +00 +00 +02 +00 +00 +00 +06 +00 +58 +54 +00 +00 +02 +00 +00 +00 +06 +00 +5c +54 +00 +00 +02 +00 +00 +00 +06 +00 +60 +54 +00 +00 +02 +00 +00 +00 +06 +00 +64 +54 +00 +00 +02 +00 +00 +00 +06 +00 +68 +54 +00 +00 +02 +00 +00 +00 +06 +00 +6c +54 +00 +00 +02 +00 +00 +00 +06 +00 +70 +54 +00 +00 +02 +00 +00 +00 +06 +00 +74 +54 +00 +00 +02 +00 +00 +00 +06 +00 +78 +54 +00 +00 +02 +00 +00 +00 +06 +00 +7c +54 +00 +00 +02 +00 +00 +00 +06 +00 +80 +54 +00 +00 +02 +00 +00 +00 +06 +00 +84 +54 +00 +00 +02 +00 +00 +00 +06 +00 +88 +54 +00 +00 +02 +00 +00 +00 +06 +00 +8c +54 +00 +00 +02 +00 +00 +00 +06 +00 +90 +54 +00 +00 +02 +00 +00 +00 +06 +00 +94 +54 +00 +00 +02 +00 +00 +00 +06 +00 +98 +54 +00 +00 +02 +00 +00 +00 +06 +00 +9c +54 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +54 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +54 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +54 +00 +00 +02 +00 +00 +00 +06 +00 +ac +54 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +54 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +54 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +54 +00 +00 +02 +00 +00 +00 +06 +00 +bc +54 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +54 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +54 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +54 +00 +00 +02 +00 +00 +00 +06 +00 +cc +54 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +54 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +54 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +54 +00 +00 +02 +00 +00 +00 +06 +00 +dc +54 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +54 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +54 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +54 +00 +00 +02 +00 +00 +00 +06 +00 +ec +54 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +54 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +54 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +54 +00 +00 +02 +00 +00 +00 +06 +00 +fc +54 +00 +00 +02 +00 +00 +00 +06 +00 +00 55 -2a -01 +00 00 02 00 @@ -104469,9 +103569,9 @@ fd 00 06 00 -59 -2a -01 +04 +55 +00 00 02 00 @@ -104479,9 +103579,9 @@ fd 00 06 00 -5d -2a -01 +08 +55 +00 00 02 00 @@ -104489,9 +103589,9 @@ fd 00 06 00 -61 -2a -01 +0c +55 +00 00 02 00 @@ -104499,9 +103599,9 @@ fd 00 06 00 -65 -2a -01 +10 +55 +00 00 02 00 @@ -104509,9 +103609,9 @@ fd 00 06 00 -69 -2a -01 +14 +55 +00 00 02 00 @@ -104519,9 +103619,9 @@ fd 00 06 00 -6d -2a -01 +18 +55 +00 00 02 00 @@ -104529,9 +103629,9 @@ fd 00 06 00 -71 -2a -01 +1c +55 +00 00 02 00 @@ -104539,9 +103639,9 @@ fd 00 06 00 -75 -2a -01 +20 +55 +00 00 02 00 @@ -104549,9 +103649,9 @@ fd 00 06 00 -79 -2a -01 +24 +55 +00 00 02 00 @@ -104559,9 +103659,9 @@ fd 00 06 00 -7d -2a -01 +28 +55 +00 00 02 00 @@ -104569,9 +103669,9 @@ fd 00 06 00 -81 -2a -01 +2c +55 +00 00 02 00 @@ -104579,9 +103679,9 @@ fd 00 06 00 -85 -2a -01 +30 +55 +00 00 02 00 @@ -104589,9 +103689,9 @@ fd 00 06 00 -89 -2a -01 +34 +55 +00 00 02 00 @@ -104599,9 +103699,9 @@ fd 00 06 00 -8d -2a -01 +38 +55 +00 00 02 00 @@ -104609,9 +103709,9 @@ fd 00 06 00 -91 -2a -01 +3c +55 +00 00 02 00 @@ -104619,9 +103719,9 @@ fd 00 06 00 -95 -2a -01 +40 +55 +00 00 02 00 @@ -104629,9 +103729,9 @@ fd 00 06 00 -99 -2a -01 +44 +55 +00 00 02 00 @@ -104639,9 +103739,9 @@ fd 00 06 00 -9d -2a -01 +48 +55 +00 00 02 00 @@ -104649,9 +103749,9 @@ fd 00 06 00 -a1 -2a -01 +4c +55 +00 00 02 00 @@ -104659,9 +103759,9 @@ a1 00 06 00 -a5 -2a -01 +50 +55 +00 00 02 00 @@ -104669,9 +103769,9 @@ a5 00 06 00 -a9 -2a -01 +54 +55 +00 00 02 00 @@ -104679,9 +103779,9 @@ a9 00 06 00 -ad -2a -01 +58 +55 +00 00 02 00 @@ -104689,9 +103789,9 @@ ad 00 06 00 -b1 -2a -01 +5c +55 +00 00 02 00 @@ -104699,9 +103799,9 @@ b1 00 06 00 -b5 -2a -01 +60 +55 +00 00 02 00 @@ -104709,9 +103809,9 @@ b5 00 06 00 -b9 -2a -01 +64 +55 +00 00 02 00 @@ -104719,9 +103819,9 @@ b9 00 06 00 -bd -2a -01 +68 +55 +00 00 02 00 @@ -104729,9 +103829,9 @@ bd 00 06 00 -c1 -2a -01 +6c +55 +00 00 02 00 @@ -104739,9 +103839,9 @@ c1 00 06 00 -c5 -2a -01 +70 +55 +00 00 02 00 @@ -104749,9 +103849,9 @@ c5 00 06 00 -c9 -2a -01 +74 +55 +00 00 02 00 @@ -104759,9 +103859,9 @@ c9 00 06 00 -cd -2a -01 +78 +55 +00 00 02 00 @@ -104769,9 +103869,9 @@ cd 00 06 00 -d1 -2a -01 +7c +55 +00 00 02 00 @@ -104779,9 +103879,9 @@ d1 00 06 00 -d5 -2a -01 +80 +55 +00 00 02 00 @@ -104789,9 +103889,9 @@ d5 00 06 00 -d9 -2a -01 +84 +55 +00 00 02 00 @@ -104799,9 +103899,9 @@ d9 00 06 00 -dd -2a -01 +88 +55 +00 00 02 00 @@ -104809,9 +103909,9 @@ dd 00 06 00 -e1 -2a -01 +8c +55 +00 00 02 00 @@ -104819,9 +103919,9 @@ e1 00 06 00 -e5 -2a -01 +90 +55 +00 00 02 00 @@ -104829,9 +103929,9 @@ e5 00 06 00 -e9 -2a -01 +94 +55 +00 00 02 00 @@ -104839,9 +103939,9 @@ e9 00 06 00 -ed -2a -01 +98 +55 +00 00 02 00 @@ -104849,9 +103949,9 @@ ed 00 06 00 -f1 -2a -01 +9c +55 +00 00 02 00 @@ -104859,9 +103959,9 @@ f1 00 06 00 -f5 -2a -01 +a0 +55 +00 00 02 00 @@ -104869,9 +103969,9 @@ f5 00 06 00 -f9 -2a -01 +a4 +55 +00 00 02 00 @@ -104879,9 +103979,9 @@ f9 00 06 00 -fd -2a -01 +a8 +55 +00 00 02 00 @@ -104889,9 +103989,9 @@ fd 00 06 00 -01 -2b -01 +ac +55 +00 00 02 00 @@ -104899,9 +103999,9 @@ fd 00 06 00 -05 -2b -01 +b0 +55 +00 00 02 00 @@ -104909,9 +104009,9 @@ fd 00 06 00 -09 -2b -01 +b4 +55 +00 00 02 00 @@ -104919,9 +104019,909 @@ fd 00 06 00 -0d -2b -01 +b8 +55 +00 +00 +02 +00 +00 +00 +06 +00 +bc +55 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +55 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +55 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +55 +00 +00 +02 +00 +00 +00 +06 +00 +cc +55 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +55 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +55 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +55 +00 +00 +02 +00 +00 +00 +06 +00 +dc +55 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +55 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +55 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +55 +00 +00 +02 +00 +00 +00 +06 +00 +ec +55 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +55 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +55 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +55 +00 +00 +02 +00 +00 +00 +06 +00 +fc +55 +00 +00 +02 +00 +00 +00 +06 +00 +00 +56 +00 +00 +02 +00 +00 +00 +06 +00 +04 +56 +00 +00 +02 +00 +00 +00 +06 +00 +08 +56 +00 +00 +02 +00 +00 +00 +06 +00 +0c +56 +00 +00 +02 +00 +00 +00 +06 +00 +10 +56 +00 +00 +02 +00 +00 +00 +06 +00 +14 +56 +00 +00 +02 +00 +00 +00 +06 +00 +18 +56 +00 +00 +02 +00 +00 +00 +06 +00 +1c +56 +00 +00 +02 +00 +00 +00 +06 +00 +20 +56 +00 +00 +02 +00 +00 +00 +06 +00 +24 +56 +00 +00 +02 +00 +00 +00 +06 +00 +28 +56 +00 +00 +02 +00 +00 +00 +06 +00 +2c +56 +00 +00 +02 +00 +00 +00 +06 +00 +30 +56 +00 +00 +02 +00 +00 +00 +06 +00 +34 +56 +00 +00 +02 +00 +00 +00 +06 +00 +38 +56 +00 +00 +02 +00 +00 +00 +06 +00 +3c +56 +00 +00 +02 +00 +00 +00 +06 +00 +40 +56 +00 +00 +02 +00 +00 +00 +06 +00 +44 +56 +00 +00 +02 +00 +00 +00 +06 +00 +48 +56 +00 +00 +02 +00 +00 +00 +06 +00 +4c +56 +00 +00 +02 +00 +00 +00 +06 +00 +50 +56 +00 +00 +02 +00 +00 +00 +06 +00 +54 +56 +00 +00 +02 +00 +00 +00 +06 +00 +58 +56 +00 +00 +02 +00 +00 +00 +06 +00 +5c +56 +00 +00 +02 +00 +00 +00 +06 +00 +60 +56 +00 +00 +02 +00 +00 +00 +06 +00 +64 +56 +00 +00 +02 +00 +00 +00 +06 +00 +68 +56 +00 +00 +02 +00 +00 +00 +06 +00 +6c +56 +00 +00 +02 +00 +00 +00 +06 +00 +70 +56 +00 +00 +02 +00 +00 +00 +06 +00 +74 +56 +00 +00 +02 +00 +00 +00 +06 +00 +78 +56 +00 +00 +02 +00 +00 +00 +06 +00 +7c +56 +00 +00 +02 +00 +00 +00 +06 +00 +80 +56 +00 +00 +02 +00 +00 +00 +06 +00 +84 +56 +00 +00 +02 +00 +00 +00 +06 +00 +88 +56 +00 +00 +02 +00 +00 +00 +06 +00 +8c +56 +00 +00 +02 +00 +00 +00 +06 +00 +90 +56 +00 +00 +02 +00 +00 +00 +06 +00 +94 +56 +00 +00 +02 +00 +00 +00 +06 +00 +98 +56 +00 +00 +02 +00 +00 +00 +06 +00 +9c +56 +00 +00 +02 +00 +00 +00 +06 +00 +a0 +56 +00 +00 +02 +00 +00 +00 +06 +00 +a4 +56 +00 +00 +02 +00 +00 +00 +06 +00 +a8 +56 +00 +00 +02 +00 +00 +00 +06 +00 +ac +56 +00 +00 +02 +00 +00 +00 +06 +00 +b0 +56 +00 +00 +02 +00 +00 +00 +06 +00 +b4 +56 +00 +00 +02 +00 +00 +00 +06 +00 +b8 +56 +00 +00 +02 +00 +00 +00 +06 +00 +bc +56 +00 +00 +02 +00 +00 +00 +06 +00 +c0 +56 +00 +00 +02 +00 +00 +00 +06 +00 +c4 +56 +00 +00 +02 +00 +00 +00 +06 +00 +c8 +56 +00 +00 +02 +00 +00 +00 +06 +00 +cc +56 +00 +00 +02 +00 +00 +00 +06 +00 +d0 +56 +00 +00 +02 +00 +00 +00 +06 +00 +d4 +56 +00 +00 +02 +00 +00 +00 +06 +00 +d8 +56 +00 +00 +02 +00 +00 +00 +06 +00 +dc +56 +00 +00 +02 +00 +00 +00 +06 +00 +e0 +56 +00 +00 +02 +00 +00 +00 +06 +00 +e4 +56 +00 +00 +02 +00 +00 +00 +06 +00 +e8 +56 +00 +00 +02 +00 +00 +00 +06 +00 +ec +56 +00 +00 +02 +00 +00 +00 +06 +00 +f0 +56 +00 +00 +02 +00 +00 +00 +06 +00 +f4 +56 +00 +00 +02 +00 +00 +00 +06 +00 +f8 +56 +00 +00 +02 +00 +00 +00 +06 +00 +fc +56 +00 +00 +02 +00 +00 +00 +06 +00 +00 +57 +00 +00 +02 +00 +00 +00 +06 +00 +04 +57 +00 +00 +02 +00 +00 +00 +06 +00 +08 +57 +00 +00 +02 +00 +00 +00 +06 +00 +0c +57 +00 +00 +02 +00 +00 +00 +06 +00 +10 +57 +00 +00 +02 +00 +00 +00 +06 +00 +14 +57 +00 +00 +02 +00 +00 +00 +06 +00 +18 +57 +00 +00 +02 +00 +00 +00 +06 +00 +1c +57 +00 +00 +02 +00 +00 +00 +06 +00 +20 +57 +00 00 02 00 @@ -105405,8 +105405,8 @@ f5 00 00 00 -e9 -d3 +00 +00 00 00 02 @@ -105441,8 +105441,8 @@ d3 74 61 00 -ed -d3 +00 +00 00 00 03 diff --git a/modules/objfmts/coff/win64-except.c b/modules/objfmts/coff/win64-except.c index 99c14376..8c8ecbbc 100644 --- a/modules/objfmts/coff/win64-except.c +++ b/modules/objfmts/coff/win64-except.c @@ -25,11 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include #include "coff-objfmt.h" @@ -37,7 +33,7 @@ #define UNW_FLAG_EHANDLER 0x01 #define UNW_FLAG_UHANDLER 0x02 -#define UNW_FLAG_CHAININFO 0x03 +#define UNW_FLAG_CHAININFO 0x04 /* Bytecode callback function prototypes */ static void win64_uwinfo_bc_destroy(void *contents); @@ -51,7 +47,7 @@ static int win64_uwinfo_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); static int win64_uwinfo_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -66,7 +62,7 @@ static int win64_uwcode_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); static int win64_uwcode_bc_tobytes - (yasm_bytecode *bc, unsigned char **bufp, void *d, + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, yasm_output_value_func output_value, /*@null@*/ yasm_output_reloc_func output_reloc); @@ -75,6 +71,7 @@ static const yasm_bytecode_callback win64_uwinfo_bc_callback = { win64_uwinfo_bc_destroy, win64_uwinfo_bc_print, win64_uwinfo_bc_finalize, + NULL, win64_uwinfo_bc_calc_len, win64_uwinfo_bc_expand, win64_uwinfo_bc_tobytes, @@ -85,6 +82,7 @@ static const yasm_bytecode_callback win64_uwcode_bc_callback = { win64_uwcode_bc_destroy, win64_uwcode_bc_print, win64_uwcode_bc_finalize, + NULL, win64_uwcode_bc_calc_len, win64_uwcode_bc_expand, win64_uwcode_bc_tobytes, @@ -280,7 +278,8 @@ win64_uwinfo_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, } static int -win64_uwinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +win64_uwinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -296,12 +295,12 @@ win64_uwinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, YASM_WRITE_8(buf, 1); /* Size of prolog */ - output_value(&info->prolog_size, buf, 1, (unsigned long)(buf-*bufp), + output_value(&info->prolog_size, buf, 1, (unsigned long)(buf-bufstart), bc, 1, d); buf += 1; /* Count of codes */ - output_value(&info->codes_count, buf, 1, (unsigned long)(buf-*bufp), + output_value(&info->codes_count, buf, 1, (unsigned long)(buf-bufstart), bc, 1, d); buf += 1; @@ -460,7 +459,8 @@ win64_uwcode_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, } static int -win64_uwcode_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, +win64_uwcode_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, + unsigned char *bufstart, void *d, yasm_output_value_func output_value, yasm_output_reloc_func output_reloc) { @@ -477,7 +477,7 @@ win64_uwcode_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, yasm_expr_create(YASM_EXPR_SUB, yasm_expr_sym(code->loc), yasm_expr_sym(code->proc), bc->line), 8); - output_value(&val, buf, 1, (unsigned long)(buf-*bufp), bc, 1, d); + output_value(&val, buf, 1, (unsigned long)(buf-bufstart), bc, 1, d); buf += 1; yasm_value_delete(&val); diff --git a/modules/objfmts/coff/win64-gas.mac b/modules/objfmts/coff/win64-gas.mac new file mode 100644 index 00000000..c8c36fbc --- /dev/null +++ b/modules/objfmts/coff/win64-gas.mac @@ -0,0 +1,73 @@ +%imacro export 1+.nolist +.export %1 +%endmacro + +; Raw exception handling operations +%imacro proc_frame 1+.nolist +%1: +.proc_frame %1 +%endmacro + +%imacro endproc_frame 0.nolist +.endproc_frame +%endmacro + +; Complex (macro) exception handling operations +; Mimics many macros provided by MASM's macamd64.inc +%imacro push_reg 1 +pushq %1 +.pushreg %1 +%endmacro + +%imacro rex_push_reg 1 +.byte 0x48 +pushq %1 +.pushreg %1 +%endmacro + +%imacro push_eflags 0 +pushfq +.allocstack 8 +%endmacro + +%imacro rex_push_eflags 0 +.byte 0x48 +pushfq +.allocstack 8 +%endmacro + +%imacro alloc_stack 1 +subq $%1, %rsp +.allocstack %1 +%endmacro + +%imacro save_reg 2 +movq %1, %2(%rsp) +.savereg %1 %2 +%endmacro + +%imacro save_xmm128 2 +movdqa %1, %2(%rsp) +.savexmm128 %1, %2 +%endmacro + +%imacro push_frame 0-1.nolist +.pushframe %1 +%endmacro + +%imacro set_frame 1-2 +%if %0==1 +movq %rsp, %1 +%else +leaq %2(%rsp), %1 +%endif +.setframe %1, %2 +%endmacro + +%imacro end_prolog 0.nolist +.endprolog +%endmacro + +%imacro end_prologue 0.nolist +.endprolog +%endmacro diff --git a/modules/objfmts/coff/win64-nasm.mac b/modules/objfmts/coff/win64-nasm.mac new file mode 100644 index 00000000..13954b89 --- /dev/null +++ b/modules/objfmts/coff/win64-nasm.mac @@ -0,0 +1,106 @@ +%imacro export 1+.nolist +[export %1] +%endmacro + +; Raw exception handling operations +%imacro proc_frame 1+.nolist +%1: +[proc_frame %1] +%endmacro + +; Disable these as they're too closely named to the macroized ones. +; MASM needs a preceding . to use these, so it seems reasonable for +; us to similarly require the []. +; +;%imacro pushreg 1.nolist +;[pushreg %1] +;%endmacro +; +;%imacro setframe 1-2.nolist +;[setframe %1 %2] +;%endmacro +; +;%imacro allocstack 1.nolist +;[allocstack %1] +;%endmacro +; +;%imacro savereg 2.nolist +;[savereg %1 %2] +;%endmacro +; +;%imacro savexmm128 2.nolist +;[savexmm128 %1 %2] +;%endmacro +; +;%imacro pushframe 0-1.nolist +;[pushframe %1] +;%endmacro +; +;%imacro endprolog 0.nolist +;[endprolog] +;%endmacro +; + +%imacro endproc_frame 0.nolist +[endproc_frame] +%endmacro + +; Complex (macro) exception handling operations +; Mimics many macros provided by MASM's macamd64.inc +%imacro push_reg 1 +push %1 +[pushreg %1] +%endmacro + +%imacro rex_push_reg 1 +db 0x48 +push %1 +[pushreg %1] +%endmacro + +%imacro push_eflags 0 +pushfq +[allocstack 8] +%endmacro + +%imacro rex_push_eflags 0 +db 0x48 +pushfq +[allocstack 8] +%endmacro + +%imacro alloc_stack 1 +sub rsp, %1 +[allocstack %1] +%endmacro + +%imacro save_reg 2 +mov [rsp+%2], %1 +[savereg %1 %2] +%endmacro + +%imacro save_xmm128 2 +movdqa [rsp+%2], %1 +[savexmm128 %1 %2] +%endmacro + +%imacro push_frame 0-1.nolist +[pushframe %1] +%endmacro + +%imacro set_frame 1-2 +%if %0==1 +mov %1, rsp +%else +lea %1, [rsp+%2] +%endif +[setframe %1 %2] +%endmacro + +%imacro end_prolog 0.nolist +[endprolog] +%endmacro + +%imacro end_prologue 0.nolist +[endprolog] +%endmacro diff --git a/modules/objfmts/dbg/CMakeLists.txt b/modules/objfmts/dbg/CMakeLists.txt new file mode 100644 index 00000000..ba5193fa --- /dev/null +++ b/modules/objfmts/dbg/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(objfmt_dbg + objfmts/dbg/dbg-objfmt.c + ) diff --git a/modules/objfmts/dbg/Makefile.inc b/modules/objfmts/dbg/Makefile.inc index 4ccfb570..cfc9b75b 100644 --- a/modules/objfmts/dbg/Makefile.inc +++ b/modules/objfmts/dbg/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/dbg/dbg-objfmt.c YASM_MODULES += objfmt_dbg diff --git a/modules/objfmts/dbg/dbg-objfmt.c b/modules/objfmts/dbg/dbg-objfmt.c index e1aad7ad..bdf403c7 100644 --- a/modules/objfmts/dbg/dbg-objfmt.c +++ b/modules/objfmts/dbg/dbg-objfmt.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include @@ -90,6 +88,17 @@ dbg_objfmt_destroy(yasm_objfmt *objfmt) yasm_xfree(objfmt); } +static void +dbg_objfmt_init_new_section(yasm_section *sect, unsigned long line) +{ + yasm_object *object = yasm_section_get_object(sect); + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt; + fprintf(objfmt_dbg->dbgfile, "init_new_section(\"%s\", %lu)\n", + yasm_section_get_name(sect), line); + yasm_symtab_define_label(object->symtab, ".text", + yasm_section_bcs_first(sect), 1, 0); +} + static yasm_section * dbg_objfmt_add_default_section(yasm_object *object) { @@ -97,13 +106,9 @@ dbg_objfmt_add_default_section(yasm_object *object) yasm_section *retval; int isnew; - retval = yasm_object_get_general(object, ".text", - yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_uint(200)), 0), - 0, 0, 0, &isnew, 0); + fprintf(objfmt_dbg->dbgfile, "add_default_section()\n"); + retval = yasm_object_get_general(object, ".text", 0, 0, 0, &isnew, 0); if (isnew) { - fprintf(objfmt_dbg->dbgfile, "(new) "); - yasm_symtab_define_label(object->symtab, ".text", - yasm_section_bcs_first(retval), 1, 0); yasm_section_set_default(retval, 1); } return retval; @@ -131,19 +136,26 @@ dbg_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, fprintf(objfmt_dbg->dbgfile, "NULL\n"); return NULL; } - retval = yasm_object_get_general(object, yasm_vp_string(vp), - yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_uint(200)), - line), 0, 0, 0, &isnew, line); + retval = yasm_object_get_general(object, yasm_vp_string(vp), 0, 0, 0, + &isnew, line); if (isnew) { fprintf(objfmt_dbg->dbgfile, "(new) "); - yasm_symtab_define_label(object->symtab, vp->val, - yasm_section_bcs_first(retval), 1, line); } yasm_section_set_default(retval, 0); fprintf(objfmt_dbg->dbgfile, "\"%s\" section\n", vp->val); return retval; } +static /*@observer@*/ /*@null@*/ yasm_symrec * +dbg_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt; + fprintf(objfmt_dbg->dbgfile, "get_special_sym(object, \"%s\", \"%s\")\n", + name, parser); + return NULL; +} + /* Define valid debug formats to use with this object format */ static const char *dbg_objfmt_dbgfmt_keywords[] = { "null", @@ -156,12 +168,16 @@ yasm_objfmt_module yasm_dbg_LTX_objfmt = { "dbg", "dbg", 32, + 0, dbg_objfmt_dbgfmt_keywords, "null", NULL, /* no directives */ + NULL, /* no standard macros */ dbg_objfmt_create, dbg_objfmt_output, dbg_objfmt_destroy, dbg_objfmt_add_default_section, - dbg_objfmt_section_switch + dbg_objfmt_init_new_section, + dbg_objfmt_section_switch, + dbg_objfmt_get_special_sym }; diff --git a/modules/objfmts/elf/CMakeLists.txt b/modules/objfmts/elf/CMakeLists.txt new file mode 100644 index 00000000..444e9a8b --- /dev/null +++ b/modules/objfmts/elf/CMakeLists.txt @@ -0,0 +1,10 @@ +YASM_ADD_MODULE(objfmt_elf + objfmts/elf/elf.c + objfmts/elf/elf-objfmt.c + objfmts/elf/elf-x86-x86.c + objfmts/elf/elf-x86-amd64.c + objfmts/elf/elf-x86-x32.c + ) +list(APPEND YASM_MODULES objfmt_elf32) +list(APPEND YASM_MODULES objfmt_elf64) +list(APPEND YASM_MODULES objfmt_elfx32) diff --git a/modules/objfmts/elf/Makefile.inc b/modules/objfmts/elf/Makefile.inc index 7e37b5ba..54657657 100644 --- a/modules/objfmts/elf/Makefile.inc +++ b/modules/objfmts/elf/Makefile.inc @@ -1,13 +1,12 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/elf/elf.c libyasm_a_SOURCES += modules/objfmts/elf/elf.h libyasm_a_SOURCES += modules/objfmts/elf/elf-objfmt.c libyasm_a_SOURCES += modules/objfmts/elf/elf-machine.h libyasm_a_SOURCES += modules/objfmts/elf/elf-x86-x86.c libyasm_a_SOURCES += modules/objfmts/elf/elf-x86-amd64.c +libyasm_a_SOURCES += modules/objfmts/elf/elf-x86-x32.c -YASM_MODULES += objfmt_elf objfmt_elf32 objfmt_elf64 +YASM_MODULES += objfmt_elf objfmt_elf32 objfmt_elf64 objfmt_elfx32 EXTRA_DIST += modules/objfmts/elf/tests/Makefile.inc diff --git a/modules/objfmts/elf/elf-machine.h b/modules/objfmts/elf/elf-machine.h index 562e098c..ea6cb4ec 100644 --- a/modules/objfmts/elf/elf-machine.h +++ b/modules/objfmts/elf/elf-machine.h @@ -1,4 +1,4 @@ -/* $Id:$ +/* * ELF object machine specific format helpers * * Copyright (C) 2004-2007 Michael Urman @@ -44,8 +44,7 @@ #define YASM_WRITE_64Z_L(p, i) YASM_WRITE_64C_L(p, 0, i) -typedef int(*func_accepts_reloc)(size_t val, yasm_symrec *wrt, - yasm_symrec **ssyms); +typedef int(*func_accepts_reloc)(size_t val, yasm_symrec *wrt); typedef void(*func_write_symtab_entry)(unsigned char *bufp, elf_symtab_entry *entry, yasm_intnum *value_intn, @@ -57,9 +56,9 @@ typedef void(*func_write_secthead_rel)(unsigned char *bufp, elf_section_index sindex); typedef void(*func_handle_reloc_addend)(yasm_intnum *intn, - elf_reloc_entry *reloc); -typedef unsigned int(*func_map_reloc_info_to_type)(elf_reloc_entry *reloc, - yasm_symrec **ssyms); + elf_reloc_entry *reloc, + unsigned long offset); +typedef unsigned int(*func_map_reloc_info_to_type)(elf_reloc_entry *reloc); typedef void(*func_write_reloc)(unsigned char *bufp, elf_reloc_entry *reloc, unsigned int r_type, @@ -69,9 +68,17 @@ typedef void (*func_write_proghead)(unsigned char **bufpp, unsigned long secthead_count, elf_section_index shstrtab_index); +enum { + ELF_SSYM_SYM_RELATIVE = 1 << 0, + ELF_SSYM_CURPOS_ADJUST = 1 << 1, + ELF_SSYM_THREAD_LOCAL = 1 << 2 +}; + typedef struct { const char *name; /* should be something like ..name */ const int sym_rel; /* symbol or section-relative? */ + const unsigned int reloc; /* relocation type */ + const unsigned int size; /* legal data size */ } elf_machine_ssym; struct elf_machine_handler { @@ -92,7 +99,7 @@ struct elf_machine_handler { func_write_reloc write_reloc; func_write_proghead write_proghead; - const elf_machine_ssym *ssyms; /* array of "special" syms */ + elf_machine_ssym *ssyms; /* array of "special" syms */ const size_t num_ssyms; /* size of array */ const int bits; /* usually 32 or 64 */ diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c index d53e2430..c4360c03 100644 --- a/modules/objfmts/elf/elf-objfmt.c +++ b/modules/objfmts/elf/elf-objfmt.c @@ -25,7 +25,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); /* Notes * @@ -44,9 +43,6 @@ * Each Section is spatially disjoint, and has exactly one SHT entry. */ -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include #include "elf.h" @@ -71,6 +67,7 @@ typedef struct { yasm_section *sect; yasm_object *object; unsigned long sindex; + yasm_symrec *GOT_sym; } elf_objfmt_output_info; typedef struct { @@ -83,20 +80,23 @@ typedef struct { yasm_objfmt_module yasm_elf_LTX_objfmt; yasm_objfmt_module yasm_elf32_LTX_objfmt; yasm_objfmt_module yasm_elf64_LTX_objfmt; +yasm_objfmt_module yasm_elfx32_LTX_objfmt; static elf_symtab_entry * elf_objfmt_symtab_append(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym, elf_section_index sectidx, elf_symbol_binding bind, elf_symbol_type type, elf_symbol_vis vis, - yasm_expr *size, elf_address *value) + yasm_expr *size, elf_address *value, + yasm_object *object) { elf_symtab_entry *entry = yasm_symrec_get_data(sym, &elf_symrec_data); if (!entry) { + /*@only@*/ char *symname = yasm_symrec_get_global_name(sym, object); elf_strtab_entry *name = - elf_strtab_append_str(objfmt_elf->strtab, - yasm_symrec_get_name(sym)); + elf_strtab_append_str(objfmt_elf->strtab, symname); + yasm_xfree(symname); entry = elf_symtab_entry_create(name, sym); yasm_symrec_add_data(sym, &elf_symrec_data, entry); } @@ -112,7 +112,7 @@ elf_objfmt_symtab_append(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym, } static elf_symtab_entry * -build_extern(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym) +build_extern(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym, yasm_object *object) { yasm_valparamhead *objext_valparams = yasm_symrec_get_objext_valparams(sym); @@ -128,7 +128,7 @@ build_extern(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym) } return elf_objfmt_symtab_append(objfmt_elf, sym, SHN_UNDEF, STB_GLOBAL, 0, - STV_DEFAULT, NULL, NULL); + STV_DEFAULT, NULL, NULL, object); } struct elf_build_global_data { @@ -169,7 +169,7 @@ elf_global_helper_vis(void *obj, yasm_valparam *vp, unsigned long line, static elf_symtab_entry * -build_global(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym) +build_global(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym, yasm_object *object) { yasm_valparamhead *objext_valparams = yasm_symrec_get_objext_valparams(sym); @@ -204,7 +204,8 @@ build_global(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym) } return elf_objfmt_symtab_append(objfmt_elf, sym, SHN_UNDEF, STB_GLOBAL, - data.type, data.vis, data.size, NULL); + data.type, data.vis, data.size, NULL, + object); } static /*@null@*/ elf_symtab_entry * @@ -247,7 +248,7 @@ build_common(yasm_objfmt_elf *objfmt_elf, yasm_symrec *sym, yasm_object *object) } return elf_objfmt_symtab_append(objfmt_elf, sym, SHN_COMMON, STB_GLOBAL, - 0, STV_DEFAULT, *size, &addralign); + 0, STV_DEFAULT, *size, &addralign, object); } static int @@ -264,7 +265,7 @@ elf_objfmt_build_symtab(yasm_symrec *sym, /*@null@*/ void *d) assert(info != NULL); if (vis & YASM_SYM_EXTERN) { - entry = build_extern(info->objfmt_elf, sym); + entry = build_extern(info->objfmt_elf, sym, info->object); yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); return 0; @@ -295,7 +296,7 @@ elf_objfmt_build_symtab(yasm_symrec *sym, /*@null@*/ void *d) if (entry && elf_sym_in_table(entry)) ; else if (vis & YASM_SYM_GLOBAL) { - entry = build_global(info->objfmt_elf, sym); + entry = build_global(info->objfmt_elf, sym, info->object); yasm_errwarn_propagate(info->errwarns, yasm_symrec_get_decl_line(sym)); } else { int is_sect = 0; @@ -318,9 +319,11 @@ elf_objfmt_build_symtab(yasm_symrec *sym, /*@null@*/ void *d) #endif entry = yasm_symrec_get_data(sym, &elf_symrec_data); if (!entry) { + /*@only@*/ char *symname = + yasm_symrec_get_global_name(sym, info->object); elf_strtab_entry *name = !info->local_names || is_sect ? NULL : - elf_strtab_append_str(info->objfmt_elf->strtab, - yasm_symrec_get_name(sym)); + elf_strtab_append_str(info->objfmt_elf->strtab, symname); + yasm_xfree(symname); entry = elf_symtab_entry_create(name, sym); yasm_symrec_add_data(sym, &elf_symrec_data, entry); } @@ -378,7 +381,7 @@ elf_objfmt_create_common(yasm_object *object, yasm_objfmt_module *module, /* FIXME: misuse of NULL bytecode */ objfmt_elf->dotdotsym = - yasm_symtab_define_label(object->symtab, "..sym", NULL, 1, 0); + yasm_symtab_define_label(object->symtab, "..sym", NULL, 0, 0); return (yasm_objfmt *)objfmt_elf; } @@ -395,7 +398,9 @@ elf_objfmt_create(yasm_object *object) if (objfmt) { objfmt_elf = (yasm_objfmt_elf *)objfmt; /* Figure out which bitness of object format to use */ - if (elf_march->bits == 32) + if (strcmp (elf_march->machine, "x32") == 0) + objfmt_elf->objfmt.module = &yasm_elfx32_LTX_objfmt; + else if (elf_march->bits == 32) objfmt_elf->objfmt.module = &yasm_elf32_LTX_objfmt; else if (elf_march->bits == 64) objfmt_elf->objfmt.module = &yasm_elf64_LTX_objfmt; @@ -415,6 +420,12 @@ elf64_objfmt_create(yasm_object *object) return elf_objfmt_create_common(object, &yasm_elf64_LTX_objfmt, 64, NULL); } +static yasm_objfmt * +elfx32_objfmt_create(yasm_object *object) +{ + return elf_objfmt_create_common(object, &yasm_elfx32_LTX_objfmt, 32, NULL); +} + static long elf_objfmt_output_align(FILE *f, unsigned int align) { @@ -452,7 +463,7 @@ elf_objfmt_output_reloc(yasm_symrec *sym, yasm_bytecode *bc, int retval; reloc = elf_reloc_entry_create(sym, NULL, - yasm_intnum_create_uint(bc->offset), 0, valsize); + yasm_intnum_create_uint(bc->offset), 0, valsize, 0); if (reloc == NULL) { yasm_error_set(YASM_ERROR_TYPE, N_("elf: invalid relocation size")); return 1; @@ -461,7 +472,7 @@ elf_objfmt_output_reloc(yasm_symrec *sym, yasm_bytecode *bc, elf_secthead_append_reloc(info->sect, info->shead, reloc); zero = yasm_intnum_create_uint(0); - elf_handle_reloc_addend(zero, reloc); + elf_handle_reloc_addend(zero, reloc, 0); retval = yasm_arch_intnum_tobytes(info->object->arch, zero, buf, destsize, valsize, 0, bc, warn); yasm_intnum_destroy(zero); @@ -517,6 +528,8 @@ elf_objfmt_output_value(yasm_value *value, unsigned char *buf, wrt = NULL; else if (wrt && elf_is_wrt_sym_relative(wrt)) ; + else if (wrt && elf_is_wrt_pos_adjusted(wrt)) + intn_val = offset + bc->offset; else if (vis == YASM_SYM_LOCAL) { yasm_bytecode *sym_precbc; /* Local symbols need relocation to their section's start, and @@ -542,9 +555,10 @@ elf_objfmt_output_value(yasm_value *value, unsigned char *buf, if (value->curpos_rel) intn_val += offset; + /* Check for _GLOBAL_OFFSET_TABLE_ symbol reference */ reloc = elf_reloc_entry_create(sym, wrt, yasm_intnum_create_uint(bc->offset + offset), value->curpos_rel, - valsize); + valsize, sym == info->GOT_sym); if (reloc == NULL) { yasm_error_set(YASM_ERROR_TYPE, N_("elf: invalid relocation (WRT or size)")); @@ -568,7 +582,7 @@ elf_objfmt_output_value(yasm_value *value, unsigned char *buf, } if (reloc) - elf_handle_reloc_addend(intn, reloc); + elf_handle_reloc_addend(intn, reloc, offset); retval = yasm_arch_intnum_tobytes(info->object->arch, intn, buf, destsize, valsize, 0, bc, warn); yasm_intnum_destroy(intn); @@ -627,45 +641,6 @@ elf_objfmt_output_bytecode(yasm_bytecode *bc, /*@null@*/ void *d) return 0; } -static int -elf_objfmt_create_dbg_secthead(yasm_section *sect, /*@null@*/ void *d) -{ - /*@null@*/ elf_objfmt_output_info *info = (elf_objfmt_output_info *)d; - elf_secthead *shead; - elf_section_type type=SHT_PROGBITS; - elf_size entsize=0; - const char *sectname; - /*@dependent@*/ yasm_symrec *sym; - elf_strtab_entry *name; - - shead = yasm_section_get_data(sect, &elf_section_data); - if (shead) - return 0; /* only create new secthead if missing */ - - sectname = yasm_section_get_name(sect); - name = elf_strtab_append_str(info->objfmt_elf->shstrtab, sectname); - - if (yasm__strcasecmp(sectname, ".stab")==0) { - entsize = 12; - } else if (yasm__strcasecmp(sectname, ".stabstr")==0) { - type = SHT_STRTAB; - } else if (yasm__strncasecmp(sectname, ".debug_", 7)==0) { - ; - } else - yasm_internal_error(N_("Unrecognized section without data")); - - shead = elf_secthead_create(name, type, 0, 0, 0); - elf_secthead_set_entsize(shead, entsize); - - sym = yasm_symtab_define_label(info->object->symtab, sectname, - yasm_section_bcs_first(sect), 1, 0); - elf_secthead_set_sym(shead, sym); - - yasm_section_add_data(sect, &elf_section_data, shead); - - return 0; -} - static int elf_objfmt_output_section(yasm_section *sect, /*@null@*/ void *d) { @@ -776,6 +751,7 @@ elf_objfmt_output(yasm_object *object, FILE *f, int all_syms, info.objfmt_elf = objfmt_elf; info.errwarns = errwarns; info.f = f; + info.GOT_sym = yasm_symtab_get(object->symtab, "_GLOBAL_OFFSET_TABLE_"); /* Update filename strtab */ elf_strtab_entry_set_str(objfmt_elf->file_strtab_entry, @@ -788,11 +764,6 @@ elf_objfmt_output(yasm_object *object, FILE *f, int all_syms, return; } - /* Create missing section headers */ - if (yasm_object_sections_traverse(object, &info, - elf_objfmt_create_dbg_secthead)) - return; - /* add all (local) syms to symtab because relocation needs a symtab index * if all_syms, register them by name. if not, use strtab entry 0 */ buildsym_info.object = object; @@ -918,25 +889,33 @@ elf_objfmt_destroy(yasm_objfmt *objfmt) yasm_xfree(objfmt); } -static elf_secthead * -elf_objfmt_init_new_section(yasm_object *object, yasm_section *sect, - const char *sectname, unsigned long type, - unsigned long flags, unsigned long line) +static void +elf_objfmt_init_new_section(yasm_section *sect, unsigned long line) { + yasm_object *object = yasm_section_get_object(sect); + const char *sectname = yasm_section_get_name(sect); yasm_objfmt_elf *objfmt_elf = (yasm_objfmt_elf *)object->objfmt; elf_secthead *esd; yasm_symrec *sym; elf_strtab_entry *name = elf_strtab_append_str(objfmt_elf->shstrtab, sectname); - esd = elf_secthead_create(name, type, flags, 0, 0); + elf_section_type type=SHT_PROGBITS; + elf_size entsize=0; + + if (yasm__strcasecmp(sectname, ".stab")==0) { + entsize = 12; + } else if (yasm__strcasecmp(sectname, ".stabstr")==0) { + type = SHT_STRTAB; + } + + esd = elf_secthead_create(name, type, 0, 0, 0); + elf_secthead_set_entsize(esd, entsize); yasm_section_add_data(sect, &elf_section_data, esd); sym = yasm_symtab_define_label(object->symtab, sectname, yasm_section_bcs_first(sect), 1, line); elf_secthead_set_sym(esd, sym); - - return esd; } static yasm_section * @@ -944,12 +923,15 @@ elf_objfmt_add_default_section(yasm_object *object) { yasm_section *retval; int isnew; - elf_secthead *esd; - retval = yasm_object_get_general(object, ".text", 0, 16, 1, 0, &isnew, 0); - esd = elf_objfmt_init_new_section(object, retval, ".text", SHT_PROGBITS, - SHF_ALLOC + SHF_EXECINSTR, 0); - yasm_section_set_default(retval, 1); + retval = yasm_object_get_general(object, ".text", 16, 1, 0, &isnew, 0); + if (isnew) + { + elf_secthead *esd = yasm_section_get_data(retval, &elf_section_data); + elf_secthead_set_typeflags(esd, SHT_PROGBITS, + SHF_ALLOC + SHF_EXECINSTR); + yasm_section_set_default(retval, 1); + } return retval; } @@ -958,6 +940,7 @@ struct elf_section_switch_data { unsigned long flags; unsigned long type; int gasflags; + int stdsect; }; /* GAS-style flags */ @@ -975,6 +958,11 @@ elf_helper_gasflags(void *obj, yasm_valparam *vp, unsigned long line, void *d, return -1; } + if (data->stdsect && strlen(s) == 0) { + data->gasflags = 1; + return 0; + } + data->flags = 0; for (i=0; iobjfmt; + return objfmt_elf->dotdotsym; + } + return elf_get_special_sym(name, parser); +} + static void dir_type(yasm_object *object, yasm_valparamhead *valparams, yasm_valparamhead *objext_valparams, unsigned long line) @@ -1169,6 +1177,10 @@ dir_type(yasm_object *object, yasm_valparamhead *valparams, elf_sym_set_type(entry, STT_FUNC); else if (yasm__strcasecmp(type, "object") == 0) elf_sym_set_type(entry, STT_OBJECT); + else if (yasm__strcasecmp(type, "tls_object") == 0) + elf_sym_set_type(entry, STT_TLS); + else if (yasm__strcasecmp(type, "notype") == 0) + elf_sym_set_type(entry, STT_NOTYPE); else yasm_warn_set(YASM_WARN_GENERAL, N_("unrecognized symbol type `%s'"), type); @@ -1213,7 +1225,7 @@ dir_weak(yasm_object *object, yasm_valparamhead *valparams, yasm_symrec *sym = yasm_symtab_declare(object->symtab, symname, YASM_SYM_GLOBAL, line); elf_objfmt_symtab_append(objfmt_elf, sym, SHN_UNDEF, STB_WEAK, 0, - STV_DEFAULT, NULL, NULL); + STV_DEFAULT, NULL, NULL, object); } static void @@ -1289,20 +1301,42 @@ static const yasm_directive elf_objfmt_directives[] = { { NULL, NULL, NULL, 0 } }; +static const char *elf_nasm_stdmac[] = { + "%imacro type 1+.nolist", + "[type %1]", + "%endmacro", + "%imacro size 1+.nolist", + "[size %1]", + "%endmacro", + "%imacro weak 1+.nolist", + "[weak %1]", + "%endmacro", + NULL +}; + +static const yasm_stdmac elf_objfmt_stdmacs[] = { + { "nasm", "nasm", elf_nasm_stdmac }, + { NULL, NULL, NULL } +}; + /* Define objfmt structure -- see objfmt.h for details */ yasm_objfmt_module yasm_elf_LTX_objfmt = { "ELF", "elf", "o", 32, + 0, elf_objfmt_dbgfmt_keywords, "null", elf_objfmt_directives, + elf_objfmt_stdmacs, elf_objfmt_create, elf_objfmt_output, elf_objfmt_destroy, elf_objfmt_add_default_section, - elf_objfmt_section_switch + elf_objfmt_init_new_section, + elf_objfmt_section_switch, + elf_objfmt_get_special_sym }; yasm_objfmt_module yasm_elf32_LTX_objfmt = { @@ -1310,14 +1344,18 @@ yasm_objfmt_module yasm_elf32_LTX_objfmt = { "elf32", "o", 32, + 0, elf_objfmt_dbgfmt_keywords, "null", elf_objfmt_directives, + elf_objfmt_stdmacs, elf32_objfmt_create, elf_objfmt_output, elf_objfmt_destroy, elf_objfmt_add_default_section, - elf_objfmt_section_switch + elf_objfmt_init_new_section, + elf_objfmt_section_switch, + elf_objfmt_get_special_sym }; yasm_objfmt_module yasm_elf64_LTX_objfmt = { @@ -1325,12 +1363,35 @@ yasm_objfmt_module yasm_elf64_LTX_objfmt = { "elf64", "o", 64, + 0, elf_objfmt_dbgfmt_keywords, "null", elf_objfmt_directives, + elf_objfmt_stdmacs, elf64_objfmt_create, elf_objfmt_output, elf_objfmt_destroy, elf_objfmt_add_default_section, - elf_objfmt_section_switch + elf_objfmt_init_new_section, + elf_objfmt_section_switch, + elf_objfmt_get_special_sym +}; + +yasm_objfmt_module yasm_elfx32_LTX_objfmt = { + "ELF (x32)", + "elfx32", + "o", + 64, + 0, + elf_objfmt_dbgfmt_keywords, + "null", + elf_objfmt_directives, + elf_objfmt_stdmacs, + elfx32_objfmt_create, + elf_objfmt_output, + elf_objfmt_destroy, + elf_objfmt_add_default_section, + elf_objfmt_init_new_section, + elf_objfmt_section_switch, + elf_objfmt_get_special_sym }; diff --git a/modules/objfmts/elf/elf-x86-amd64.c b/modules/objfmts/elf/elf-x86-amd64.c index c1318d64..3ba376af 100644 --- a/modules/objfmts/elf/elf-x86-amd64.c +++ b/modules/objfmts/elf/elf-x86-amd64.c @@ -26,31 +26,44 @@ */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_EXPR_INTERNAL #include #define YASM_OBJFMT_ELF_INTERNAL #include "elf.h" #include "elf-machine.h" -enum ssym_index { - SSYM_GOTPCREL = 0, - SSYM_GOT, - SSYM_PLT +static elf_machine_ssym elf_x86_amd64_ssyms[] = { + {"pltoff", ELF_SSYM_SYM_RELATIVE, R_X86_64_PLTOFF64, 64}, + {"plt", ELF_SSYM_SYM_RELATIVE, R_X86_64_PLT32, 32}, + {"gotplt", ELF_SSYM_SYM_RELATIVE, R_X86_64_GOTPLT64, 64}, + {"gotoff", ELF_SSYM_SYM_RELATIVE, R_X86_64_GOTOFF64, 64}, + {"gotpcrel", ELF_SSYM_SYM_RELATIVE, R_X86_64_GOTPCREL, 32}, + {"tlsgd", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TLSGD, 32}, + {"tlsld", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TLSLD, 32}, + {"gottpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_GOTTPOFF, 32}, + {"tpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TPOFF32, 32}, + {"dtpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_DTPOFF32, 32}, + {"got", ELF_SSYM_SYM_RELATIVE, R_X86_64_GOT32, 32}, + {"tlsdesc", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_GOTPC32_TLSDESC, 32}, + {"tlscall", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TLSDESC_CALL, 32} }; static int -elf_x86_amd64_accepts_reloc(size_t val, yasm_symrec *wrt, yasm_symrec **ssyms) +elf_x86_amd64_accepts_reloc(size_t val, yasm_symrec *wrt) { if (wrt) { - if ((wrt == ssyms[SSYM_GOTPCREL] && val == 32) - || (wrt == ssyms[SSYM_GOT] && val == 32) - || (wrt == ssyms[SSYM_PLT] && val == 32)) - return 1; - else + const elf_machine_ssym *ssym = (elf_machine_ssym *) + yasm_symrec_get_data(wrt, &elf_ssym_symrec_data); + if (!ssym || val != ssym->size) return 0; + return 1; } return (val&(val-1)) ? 0 : ((val & (8|16|32|64)) != 0); } @@ -123,7 +136,9 @@ elf_x86_amd64_write_secthead_rel(unsigned char *bufp, } static void -elf_x86_amd64_handle_reloc_addend(yasm_intnum *intn, elf_reloc_entry *reloc) +elf_x86_amd64_handle_reloc_addend(yasm_intnum *intn, + elf_reloc_entry *reloc, + unsigned long offset) { /* .rela: copy value out as addend, replace original with 0 */ reloc->addend = yasm_intnum_copy(intn); @@ -131,23 +146,36 @@ elf_x86_amd64_handle_reloc_addend(yasm_intnum *intn, elf_reloc_entry *reloc) } static unsigned int -elf_x86_amd64_map_reloc_info_to_type(elf_reloc_entry *reloc, - yasm_symrec **ssyms) +elf_x86_amd64_map_reloc_info_to_type(elf_reloc_entry *reloc) { if (reloc->wrt) { - if (reloc->wrt == ssyms[SSYM_GOTPCREL] && reloc->valsize == 32) - return (unsigned char) R_X86_64_GOTPCREL; - else if (reloc->wrt == ssyms[SSYM_GOT] && reloc->valsize == 32) - return (unsigned char) R_X86_64_GOT32; - else if (reloc->wrt == ssyms[SSYM_PLT] && reloc->valsize == 32) - return (unsigned char) R_X86_64_PLT32; - else + const elf_machine_ssym *ssym = (elf_machine_ssym *) + yasm_symrec_get_data(reloc->wrt, &elf_ssym_symrec_data); + if (!ssym || reloc->valsize != ssym->size) yasm_internal_error(N_("Unsupported WRT")); + + /* Force TLS type; this is required by the linker. */ + if (ssym->sym_rel & ELF_SSYM_THREAD_LOCAL) { + elf_symtab_entry *esym; + + esym = yasm_symrec_get_data(reloc->reloc.sym, &elf_symrec_data); + if (esym) + esym->type = STT_TLS; + } + /* Map PC-relative GOT to appropriate relocation */ + if (reloc->rtype_rel && ssym->reloc == R_X86_64_GOT32) + return (unsigned char) R_X86_64_GOTPCREL; + return (unsigned char) ssym->reloc; + } else if (reloc->is_GOT_sym && reloc->valsize == 32) { + return (unsigned char) R_X86_64_GOTPC32; + } else if (reloc->is_GOT_sym && reloc->valsize == 64) { + return (unsigned char) R_X86_64_GOTPC64; } else if (reloc->rtype_rel) { switch (reloc->valsize) { case 8: return (unsigned char) R_X86_64_PC8; case 16: return (unsigned char) R_X86_64_PC16; case 32: return (unsigned char) R_X86_64_PC32; + case 64: return (unsigned char) R_X86_64_PC64; default: yasm_internal_error(N_("Unsupported relocation size")); } } else { @@ -210,12 +238,6 @@ elf_x86_amd64_write_proghead(unsigned char **bufpp, *bufpp = bufp; } -static elf_machine_ssym elf_x86_amd64_ssyms[] = { - {"..gotpcrel", 1}, - {"..got", 1}, - {"..plt", 0} -}; - const elf_machine_handler elf_machine_handler_x86_amd64 = { "x86", "amd64", ".rela", diff --git a/modules/objfmts/elf/elf-x86-x32.c b/modules/objfmts/elf/elf-x86-x32.c new file mode 100644 index 00000000..40a25a12 --- /dev/null +++ b/modules/objfmts/elf/elf-x86-x32.c @@ -0,0 +1,251 @@ +/* + * ELF object format helpers - x86:x32 + * + * Copyright (C) 2012 Michael Urman and H.J. Lu + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#define YASM_OBJFMT_ELF_INTERNAL +#include "elf.h" +#include "elf-machine.h" + +static elf_machine_ssym elf_x86_x32_ssyms[] = { + {"plt", ELF_SSYM_SYM_RELATIVE, R_X86_64_PLT32, 32}, + {"gotpcrel", ELF_SSYM_SYM_RELATIVE, R_X86_64_GOTPCREL, 32}, + {"tlsgd", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TLSGD, 32}, + {"tlsld", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TLSLD, 32}, + {"gottpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_GOTTPOFF, 32}, + {"tpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TPOFF32, 32}, + {"dtpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_DTPOFF32, 32}, + {"got", ELF_SSYM_SYM_RELATIVE, R_X86_64_GOT32, 32}, + {"tlsdesc", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_GOTPC32_TLSDESC, 32}, + {"tlscall", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_X86_64_TLSDESC_CALL, 32} +}; + +static int +elf_x86_x32_accepts_reloc(size_t val, yasm_symrec *wrt) +{ + if (wrt) { + const elf_machine_ssym *ssym = (elf_machine_ssym *) + yasm_symrec_get_data(wrt, &elf_ssym_symrec_data); + if (!ssym || val != ssym->size) + return 0; + return 1; + } + return (val&(val-1)) ? 0 : ((val & (8|16|32)) != 0); +} + +static void +elf_x86_x32_write_symtab_entry(unsigned char *bufp, + elf_symtab_entry *entry, + yasm_intnum *value_intn, + yasm_intnum *size_intn) +{ + YASM_WRITE_32_L(bufp, entry->name ? entry->name->index : 0); + YASM_WRITE_32I_L(bufp, value_intn); + YASM_WRITE_32I_L(bufp, size_intn); + + YASM_WRITE_8(bufp, ELF32_ST_INFO(entry->bind, entry->type)); + YASM_WRITE_8(bufp, ELF32_ST_OTHER(entry->vis)); + if (entry->sect) { + elf_secthead *shead = + yasm_section_get_data(entry->sect, &elf_section_data); + if (!shead) + yasm_internal_error(N_("symbol references section without data")); + YASM_WRITE_16_L(bufp, shead->index); + } else { + YASM_WRITE_16_L(bufp, entry->index); + } +} + +static void +elf_x86_x32_write_secthead(unsigned char *bufp, elf_secthead *shead) +{ + YASM_WRITE_32_L(bufp, shead->name ? shead->name->index : 0); + YASM_WRITE_32_L(bufp, shead->type); + YASM_WRITE_32_L(bufp, shead->flags); + YASM_WRITE_32_L(bufp, 0); /* vmem address */ + YASM_WRITE_32_L(bufp, shead->offset); + YASM_WRITE_32I_L(bufp, shead->size); + + YASM_WRITE_32_L(bufp, shead->link); + YASM_WRITE_32_L(bufp, shead->info); + + YASM_WRITE_32_L(bufp, shead->align); + YASM_WRITE_32_L(bufp, shead->entsize); +} + +static void +elf_x86_x32_write_secthead_rel(unsigned char *bufp, + elf_secthead *shead, + elf_section_index symtab_idx, + elf_section_index sindex) +{ + yasm_intnum *nreloc; + yasm_intnum *relocsize; + + YASM_WRITE_32_L(bufp, shead->rel_name ? shead->rel_name->index : 0); + YASM_WRITE_32_L(bufp, SHT_RELA); + YASM_WRITE_32_L(bufp, 0); + YASM_WRITE_32_L(bufp, 0); + YASM_WRITE_32_L(bufp, shead->rel_offset); + + nreloc = yasm_intnum_create_uint(shead->nreloc); + relocsize = yasm_intnum_create_uint(RELOC32A_SIZE); + yasm_intnum_calc(relocsize, YASM_EXPR_MUL, nreloc); + YASM_WRITE_32I_L(bufp, relocsize); /* size */ + yasm_intnum_destroy(nreloc); + yasm_intnum_destroy(relocsize); + + YASM_WRITE_32_L(bufp, symtab_idx); /* link: symtab index */ + YASM_WRITE_32_L(bufp, shead->index); /* info: relocated's index */ + YASM_WRITE_32_L(bufp, RELOC32_ALIGN); /* align */ + YASM_WRITE_32_L(bufp, RELOC32A_SIZE); /* entity size */ +} + +static void +elf_x86_x32_handle_reloc_addend(yasm_intnum *intn, + elf_reloc_entry *reloc, + unsigned long offset) +{ + /* .rela: copy value out as addend, replace original with 0 */ + reloc->addend = yasm_intnum_copy(intn); + yasm_intnum_zero(intn); +} + +static unsigned int +elf_x86_x32_map_reloc_info_to_type(elf_reloc_entry *reloc) +{ + if (reloc->wrt) { + const elf_machine_ssym *ssym = (elf_machine_ssym *) + yasm_symrec_get_data(reloc->wrt, &elf_ssym_symrec_data); + if (!ssym || reloc->valsize != ssym->size) + yasm_internal_error(N_("Unsupported WRT")); + + /* Force TLS type; this is required by the linker. */ + if (ssym->sym_rel & ELF_SSYM_THREAD_LOCAL) { + elf_symtab_entry *esym; + + esym = yasm_symrec_get_data(reloc->reloc.sym, &elf_symrec_data); + if (esym) + esym->type = STT_TLS; + } + /* Map PC-relative GOT to appropriate relocation */ + if (reloc->rtype_rel && ssym->reloc == R_X86_64_GOT32) + return (unsigned char) R_X86_64_GOTPCREL; + return (unsigned char) ssym->reloc; + } else if (reloc->is_GOT_sym && reloc->valsize == 32) { + return (unsigned char) R_X86_64_GOTPC32; + } else if (reloc->is_GOT_sym && reloc->valsize == 64) { + yasm_internal_error(N_("Unsupported relocation size")); + } else if (reloc->rtype_rel) { + switch (reloc->valsize) { + case 8: return (unsigned char) R_X86_64_PC8; + case 16: return (unsigned char) R_X86_64_PC16; + case 32: return (unsigned char) R_X86_64_PC32; + default: yasm_internal_error(N_("Unsupported relocation size")); + } + } else { + switch (reloc->valsize) { + case 8: return (unsigned char) R_X86_64_8; + case 16: return (unsigned char) R_X86_64_16; + case 32: return (unsigned char) R_X86_64_32; + case 64: return (unsigned char) R_X86_64_64; + default: yasm_internal_error(N_("Unsupported relocation size")); + } + } + return 0; +} + +static void +elf_x86_x32_write_reloc(unsigned char *bufp, elf_reloc_entry *reloc, + unsigned int r_type, unsigned int r_sym) +{ + YASM_WRITE_32I_L(bufp, reloc->reloc.addr); + YASM_WRITE_32_L(bufp, ELF32_R_INFO((unsigned long)r_sym, (unsigned char)r_type)); + if (reloc->addend) + YASM_WRITE_32I_L(bufp, reloc->addend); + else { + YASM_WRITE_32_L(bufp, 0); + } +} + +static void +elf_x86_x32_write_proghead(unsigned char **bufpp, + elf_offset secthead_addr, + unsigned long secthead_count, + elf_section_index shstrtab_index) +{ + unsigned char *bufp = *bufpp; + unsigned char *buf = bufp-4; + YASM_WRITE_8(bufp, ELFCLASS32); /* elf class */ + YASM_WRITE_8(bufp, ELFDATA2LSB); /* data encoding :: MSB? */ + YASM_WRITE_8(bufp, EV_CURRENT); /* elf version */ + YASM_WRITE_8(bufp, ELFOSABI_SYSV); /* os/abi */ + YASM_WRITE_8(bufp, 0); /* SYSV v3 ABI=0 */ + while (bufp-buf < EI_NIDENT) /* e_ident padding */ + YASM_WRITE_8(bufp, 0); + + YASM_WRITE_16_L(bufp, ET_REL); /* e_type - object file */ + YASM_WRITE_16_L(bufp, EM_X86_64); /* e_machine - or others */ + YASM_WRITE_32_L(bufp, EV_CURRENT); /* elf version */ + YASM_WRITE_32_L(bufp, 0); /* e_entry */ + YASM_WRITE_32_L(bufp, 0); /* e_phoff */ + YASM_WRITE_32_L(bufp, secthead_addr); /* e_shoff secthead off */ + + YASM_WRITE_32_L(bufp, 0); /* e_flags */ + YASM_WRITE_16_L(bufp, EHDR32_SIZE); /* e_ehsize */ + YASM_WRITE_16_L(bufp, 0); /* e_phentsize */ + YASM_WRITE_16_L(bufp, 0); /* e_phnum */ + YASM_WRITE_16_L(bufp, SHDR32_SIZE); /* e_shentsize */ + YASM_WRITE_16_L(bufp, secthead_count); /* e_shnum */ + YASM_WRITE_16_L(bufp, shstrtab_index); /* e_shstrndx */ + *bufpp = bufp; +} + +const elf_machine_handler +elf_machine_handler_x86_x32 = { + "x86", "x32", ".rela", + SYMTAB32_SIZE, SYMTAB32_ALIGN, RELOC32A_SIZE, SHDR32_SIZE, EHDR32_SIZE, + elf_x86_x32_accepts_reloc, + elf_x86_x32_write_symtab_entry, + elf_x86_x32_write_secthead, + elf_x86_x32_write_secthead_rel, + elf_x86_x32_handle_reloc_addend, + elf_x86_x32_map_reloc_info_to_type, + elf_x86_x32_write_reloc, + elf_x86_x32_write_proghead, + elf_x86_x32_ssyms, + sizeof(elf_x86_x32_ssyms)/sizeof(elf_x86_x32_ssyms[0]), + 32 +}; diff --git a/modules/objfmts/elf/elf-x86-x86.c b/modules/objfmts/elf/elf-x86-x86.c index 00d7a047..d79ec6ea 100644 --- a/modules/objfmts/elf/elf-x86-x86.c +++ b/modules/objfmts/elf/elf-x86-x86.c @@ -26,33 +26,49 @@ */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_EXPR_INTERNAL #include #define YASM_OBJFMT_ELF_INTERNAL #include "elf.h" #include "elf-machine.h" -enum ssym_index { - SSYM_GOTPC = 0, - SSYM_GOTOFF, - SSYM_GOT, - SSYM_PLT +static elf_machine_ssym elf_x86_x86_ssyms[] = { + {"plt", ELF_SSYM_SYM_RELATIVE, R_386_PLT32, 32}, + {"gotoff", 0, R_386_GOTOFF, 32}, + /* special one for NASM */ + {"gotpc", ELF_SSYM_CURPOS_ADJUST, R_386_GOTPC, 32}, + {"tlsgd", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_GD, 32}, + {"tlsldm", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_LDM, 32}, + {"gottpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_IE_32, 32}, + {"tpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_LE_32, 32}, + {"ntpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_LE, 32}, + {"dtpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_LDO_32, 32}, + {"gotntpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_GOTIE, 32}, + {"indntpoff", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_IE, 32}, + {"got", ELF_SSYM_SYM_RELATIVE, R_386_GOT32, 32}, + {"tlsdesc", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_GOTDESC, 32}, + {"tlscall", ELF_SSYM_SYM_RELATIVE|ELF_SSYM_THREAD_LOCAL, + R_386_TLS_DESC_CALL, 32} }; static int -elf_x86_x86_accepts_reloc(size_t val, yasm_symrec *wrt, yasm_symrec **ssyms) +elf_x86_x86_accepts_reloc(size_t val, yasm_symrec *wrt) { if (wrt) { - if ((wrt == ssyms[SSYM_GOTPC] && val == 32) - || (wrt == ssyms[SSYM_GOTOFF] && val == 32) - || (wrt == ssyms[SSYM_GOT] && val == 32) - || (wrt == ssyms[SSYM_PLT] && val == 32)) - return 1; - else + const elf_machine_ssym *ssym = (elf_machine_ssym *) + yasm_symrec_get_data(wrt, &elf_ssym_symrec_data); + if (!ssym || val != ssym->size) return 0; + return 1; } return (val&(val-1)) ? 0 : ((val & (8|16|32)) != 0); } @@ -119,26 +135,39 @@ elf_x86_x86_write_secthead_rel(unsigned char *bufp, } static void -elf_x86_x86_handle_reloc_addend(yasm_intnum *intn, elf_reloc_entry *reloc) +elf_x86_x86_handle_reloc_addend(yasm_intnum *intn, + elf_reloc_entry *reloc, + unsigned long offset) { + if (!reloc->wrt && reloc->is_GOT_sym && reloc->valsize == 32 && offset != 0) + { + yasm_intnum *off_intn = yasm_intnum_create_uint(offset); + yasm_intnum_calc(intn, YASM_EXPR_ADD, off_intn); + yasm_intnum_destroy(off_intn); + } return; /* .rel: Leave addend in intn */ } static unsigned int -elf_x86_x86_map_reloc_info_to_type(elf_reloc_entry *reloc, - yasm_symrec **ssyms) +elf_x86_x86_map_reloc_info_to_type(elf_reloc_entry *reloc) { if (reloc->wrt) { - if (reloc->wrt == ssyms[SSYM_GOTPC] && reloc->valsize == 32) - return (unsigned char) R_386_GOTPC; - else if (reloc->wrt == ssyms[SSYM_GOTOFF] && reloc->valsize == 32) - return (unsigned char) R_386_GOTOFF; - else if (reloc->wrt == ssyms[SSYM_GOT] && reloc->valsize == 32) - return (unsigned char) R_386_GOT32; - else if (reloc->wrt == ssyms[SSYM_PLT] && reloc->valsize == 32) - return (unsigned char) R_386_PLT32; - else + const elf_machine_ssym *ssym = (elf_machine_ssym *) + yasm_symrec_get_data(reloc->wrt, &elf_ssym_symrec_data); + if (!ssym || reloc->valsize != ssym->size) yasm_internal_error(N_("Unsupported WRT")); + + /* Force TLS type; this is required by the linker. */ + if (ssym->sym_rel & ELF_SSYM_THREAD_LOCAL) { + elf_symtab_entry *esym; + + esym = yasm_symrec_get_data(reloc->reloc.sym, &elf_symrec_data); + if (esym) + esym->type = STT_TLS; + } + return (unsigned char) ssym->reloc; + } else if (reloc->is_GOT_sym && reloc->valsize == 32) { + return (unsigned char) R_386_GOTPC; } else if (reloc->rtype_rel) { switch (reloc->valsize) { case 8: return (unsigned char) R_386_PC8; @@ -195,13 +224,6 @@ elf_x86_x86_write_proghead(unsigned char **bufpp, *bufpp = bufp; } -static elf_machine_ssym elf_x86_x86_ssyms[] = { - {"..gotpc", 0}, - {"..gotoff", 0}, - {"..got", 1}, - {"..plt", 0} -}; - const elf_machine_handler elf_machine_handler_x86_x86 = { "x86", "x86", ".rel", diff --git a/modules/objfmts/elf/elf.c b/modules/objfmts/elf/elf.c index 3bcbffb5..1ee98bfd 100644 --- a/modules/objfmts/elf/elf.c +++ b/modules/objfmts/elf/elf.c @@ -26,10 +26,7 @@ */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_EXPR_INTERNAL #include #define YASM_OBJFMT_ELF_INTERNAL #include "elf.h" @@ -45,20 +42,28 @@ const yasm_assoc_data_callback elf_section_data = { static void elf_symrec_data_destroy(/*@only@*/ void *d); static void elf_symtab_entry_print(void *data, FILE *f, int indent_level); +static void elf_ssym_symtab_entry_print(void *data, FILE *f, int indent_level); const yasm_assoc_data_callback elf_symrec_data = { elf_symrec_data_destroy, elf_symtab_entry_print }; +const yasm_assoc_data_callback elf_ssym_symrec_data = { + elf_symrec_data_destroy, + elf_ssym_symtab_entry_print +}; + extern elf_machine_handler elf_machine_handler_x86_x86, - elf_machine_handler_x86_amd64; + elf_machine_handler_x86_amd64, + elf_machine_handler_x86_x32; static const elf_machine_handler *elf_machine_handlers[] = { &elf_machine_handler_x86_x86, &elf_machine_handler_x86_amd64, + &elf_machine_handler_x86_x32, NULL }; static const elf_machine_handler elf_null_machine = {0, 0, 0, 0, 0, 0, 0, 0, @@ -77,10 +82,15 @@ elf_set_arch(yasm_arch *arch, yasm_symtab *symtab, int bits_pref) elf_march != NULL; elf_march = elf_machine_handlers[++i]) { - if (yasm__strcasecmp(yasm_arch_keyword(arch), elf_march->arch)==0) - if (yasm__strcasecmp(machine, elf_march->machine)==0) + if (yasm__strcasecmp(yasm_arch_keyword(arch), elf_march->arch)==0) { + if (yasm__strcasecmp(machine, elf_march->machine)==0) { if (bits_pref == 0 || bits_pref == elf_march->bits) break; + } else if (bits_pref == elf_march->bits + && yasm__strcasecmp(machine, "amd64") == 0 + && yasm__strcasecmp(elf_march->machine, "x32") == 0) + break; + } } if (elf_march && elf_march->num_ssyms > 0) @@ -93,21 +103,48 @@ elf_set_arch(yasm_arch *arch, yasm_symtab *symtab, int bits_pref) /* FIXME: misuse of NULL bytecode */ elf_ssyms[i] = yasm_symtab_define_label(symtab, elf_march->ssyms[i].name, - NULL, 1, 0); + NULL, 0, 0); + yasm_symrec_add_data(elf_ssyms[i], &elf_ssym_symrec_data, + (void*)&elf_march->ssyms[i]); } } return elf_march; } +yasm_symrec * +elf_get_special_sym(const char *name, const char *parser) +{ + int i; + for (i=0; (unsigned int)inum_ssyms; i++) { + if (yasm__strcasecmp(name, elf_march->ssyms[i].name) == 0) + return elf_ssyms[i]; + } + return NULL; +} + /* reloc functions */ +int elf_ssym_has_flag(yasm_symrec *wrt, int flag); + int elf_is_wrt_sym_relative(yasm_symrec *wrt) +{ + return elf_ssym_has_flag(wrt, ELF_SSYM_SYM_RELATIVE); +} + +int +elf_is_wrt_pos_adjusted(yasm_symrec *wrt) +{ + return elf_ssym_has_flag(wrt, ELF_SSYM_CURPOS_ADJUST); +} + +int +elf_ssym_has_flag(yasm_symrec *wrt, int flag) { int i; for (i=0; (unsigned int)inum_ssyms; i++) { if (elf_ssyms[i] == wrt) - return elf_march->ssyms[i].sym_rel; + return (elf_march->ssyms[i].sym_rel & flag) != 0; } return 0; } @@ -118,14 +155,15 @@ elf_reloc_entry_create(yasm_symrec *sym, yasm_symrec *wrt, yasm_intnum *addr, int rel, - size_t valsize) + size_t valsize, + int is_GOT_sym) { elf_reloc_entry *entry; if (!elf_march->accepts_reloc) yasm_internal_error(N_("Unsupported machine for ELF output")); - if (!elf_march->accepts_reloc(valsize, wrt, elf_ssyms)) + if (!elf_march->accepts_reloc(valsize, wrt)) { if (addr) yasm_intnum_destroy(addr); @@ -142,6 +180,7 @@ elf_reloc_entry_create(yasm_symrec *sym, entry->valsize = valsize; entry->addend = NULL; entry->wrt = wrt; + entry->is_GOT_sym = is_GOT_sym; return entry; } @@ -183,7 +222,7 @@ elf_strtab_entry_set_str(elf_strtab_entry *entry, const char *str) } elf_strtab_head * -elf_strtab_create() +elf_strtab_create(void) { elf_strtab_head *strtab = yasm_xmalloc(sizeof(elf_strtab_head)); elf_strtab_entry *entry = yasm_xmalloc(sizeof(elf_strtab_entry)); @@ -327,8 +366,14 @@ elf_symtab_entry_print(void *data, FILE *f, int indent_level) fprintf(f, "\n"); } +static void +elf_ssym_symtab_entry_print(void *data, FILE *f, int indent_level) +{ + /* TODO */ +} + elf_symtab_head * -elf_symtab_create() +elf_symtab_create(void) { elf_symtab_head *symtab = yasm_xmalloc(sizeof(elf_symtab_head)); elf_symtab_entry *entry = yasm_xmalloc(sizeof(elf_symtab_entry)); @@ -424,13 +469,12 @@ elf_symtab_write_to_file(FILE *f, elf_symtab_head *symtab, yasm_errwarns *errwarns) { unsigned char buf[SYMTAB_MAXSIZE], *bufp; - elf_symtab_entry *entry, *prev; + elf_symtab_entry *entry; unsigned long size = 0; if (!symtab) yasm_internal_error(N_("symtab is null")); - prev = NULL; STAILQ_FOREACH(entry, symtab, qlink) { yasm_intnum *size_intn=NULL, *value_intn=NULL; @@ -438,15 +482,15 @@ elf_symtab_write_to_file(FILE *f, elf_symtab_head *symtab, /* get size (if specified); expr overrides stored integer */ if (entry->xsize) { - size_intn = yasm_intnum_copy( - yasm_expr_get_intnum(&entry->xsize, 1)); - if (!size_intn) { + yasm_intnum *intn = yasm_expr_get_intnum(&entry->xsize, 1); + if (!intn) { yasm_error_set(YASM_ERROR_VALUE, N_("size specifier not an integer expression")); yasm_errwarn_propagate(errwarns, entry->xsize->line); - } + } else + size_intn = yasm_intnum_copy(intn); } - else + if (!size_intn) size_intn = yasm_intnum_create_uint(entry->size); /* get EQU value for constants */ @@ -472,6 +516,18 @@ elf_symtab_write_to_file(FILE *f, elf_symtab_head *symtab, if (value_intn == NULL) value_intn = yasm_intnum_create_uint(entry->value); + /* If symbol is in a TLS section, force its type to TLS. */ + if (entry->sym) { + yasm_bytecode *precbc; + yasm_section *sect; + elf_secthead *shead; + if (yasm_symrec_get_label(entry->sym, &precbc) && + (sect = yasm_bc_get_section(precbc)) && + (shead = yasm_section_get_data(sect, &elf_section_data)) && + shead->flags & SHF_TLS) { + entry->type = STT_TLS; + } + } if (!elf_march->write_symtab_entry || !elf_march->symtab_entry_size) yasm_internal_error(N_("Unsupported machine for ELF output")); @@ -481,8 +537,6 @@ elf_symtab_write_to_file(FILE *f, elf_symtab_head *symtab, yasm_intnum_destroy(size_intn); yasm_intnum_destroy(value_intn); - - prev = entry; } return size; } @@ -667,11 +721,13 @@ elf_secthead_name_reloc_section(const char *basesect) } void -elf_handle_reloc_addend(yasm_intnum *intn, elf_reloc_entry *reloc) +elf_handle_reloc_addend(yasm_intnum *intn, + elf_reloc_entry *reloc, + unsigned long offset) { if (!elf_march->handle_reloc_addend) yasm_internal_error(N_("Unsupported machine for ELF output")); - elf_march->handle_reloc_addend(intn, reloc); + elf_march->handle_reloc_addend(intn, reloc, offset); } unsigned long @@ -730,7 +786,6 @@ elf_secthead_write_relocs_to_file(FILE *f, yasm_section *sect, while (reloc) { - yasm_sym_vis vis; unsigned int r_type=0, r_sym; elf_symtab_entry *esym; @@ -740,10 +795,9 @@ elf_secthead_write_relocs_to_file(FILE *f, yasm_section *sect, else r_sym = STN_UNDEF; - vis = yasm_symrec_get_visibility(reloc->reloc.sym); if (!elf_march->map_reloc_info_to_type) yasm_internal_error(N_("Unsupported arch/machine for elf output")); - r_type = elf_march->map_reloc_info_to_type(reloc, elf_ssyms); + r_type = elf_march->map_reloc_info_to_type(reloc); bufp = buf; if (!elf_march->write_reloc || !elf_march->reloc_entry_size) diff --git a/modules/objfmts/elf/elf.h b/modules/objfmts/elf/elf.h index b876a75e..69ed3f01 100644 --- a/modules/objfmts/elf/elf.h +++ b/modules/objfmts/elf/elf.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * ELF object format helpers * * Copyright (C) 2003-2007 Michael Urman @@ -75,7 +75,8 @@ typedef enum { EM_SPARCV9 = 43, /* SPARC v9 64-bit */ EM_IA_64 = 50, /* Intel IA-64 */ EM_X86_64 = 62, /* AMD x86-64 */ - EM_ALPHA = 0x9026 /* Alpha (no ABI) */ + EM_ALPHA = 0x9026, /* Alpha (no ABI) */ + EM_LOONGARCH = 258 /* loongson LoongArch */ } elf_machine; typedef enum { @@ -191,6 +192,9 @@ typedef enum { STT_FUNC = 2, /* a function or executable code */ STT_SECTION = 3, /* a section: often for relocation, STB_LOCAL */ STT_FILE = 4, /* often source filename: STB_LOCAL, SHN_ABS */ + STT_COMMON = 5, /* Uninitialized common block. */ + STT_TLS = 6, /* TLS object. */ + STT_NUM = 7, STT_LOOS = 10, /* Environment specific use */ STT_HIOS = 12, @@ -300,7 +304,10 @@ typedef enum { R_386_TLS_LE_32 = 34, /* Offset relative to static TLS block */ R_386_TLS_DTPMOD32 = 35, /* ID of module containing symbol */ R_386_TLS_DTPOFF32 = 36, /* Offset in TLS block */ - R_386_TLS_TPOFF32 = 37 /* Offset in static TLS block */ + R_386_TLS_TPOFF32 = 37, /* Offset in static TLS block */ + R_386_TLS_GOTDESC = 39, + R_386_TLS_DESC_CALL = 40, + R_386_TLS_DESC = 41 } elf_386_relocation_type; typedef enum { @@ -327,7 +334,18 @@ typedef enum { R_X86_64_TLSLD = 20, /* word32, PC-rel offset to LD GOT block */ R_X86_64_DTPOFF32 = 21, /* word32, offset to TLS block */ R_X86_64_GOTTPOFF = 22, /* word32, PC-rel offset to IE GOT entry */ - R_X86_64_TPOFF32 = 23 /* word32, offset in initial TLS block */ + R_X86_64_TPOFF32 = 23, /* word32, offset in initial TLS block */ + R_X86_64_PC64 = 24, /* word64, PC relative */ + R_X86_64_GOTOFF64 = 25, /* word64, offset to GOT */ + R_X86_64_GOTPC32 = 26, /* word32, signed pc relative to GOT */ + R_X86_64_GOT64 = 27, /* word64, GOT entry offset */ + R_X86_64_GOTPCREL64 = 28, /* word64, signed pc relative to GOT entry */ + R_X86_64_GOTPC64 = 29, /* word64, signed pc relative to GOT */ + R_X86_64_GOTPLT64 = 30, /* like GOT64, but indicates PLT entry needed */ + R_X86_64_PLTOFF64 = 31, /* word64, GOT relative offset to PLT entry */ + R_X86_64_GOTPC32_TLSDESC = 34, /* GOT offset for TLS descriptor */ + R_X86_64_TLSDESC_CALL = 35, /* Marker for call through TLS descriptor */ + R_X86_64_TLSDESC = 36 /* TLS descriptor */ } elf_x86_64_relocation_type; struct elf_secthead { @@ -374,6 +392,7 @@ struct elf_reloc_entry { size_t valsize; yasm_intnum *addend; /*@null@*/ yasm_symrec *wrt; + int is_GOT_sym; }; STAILQ_HEAD(elf_strtab_head, elf_strtab_entry); @@ -404,19 +423,24 @@ struct elf_symtab_entry { extern const yasm_assoc_data_callback elf_section_data; extern const yasm_assoc_data_callback elf_symrec_data; +extern const yasm_assoc_data_callback elf_ssym_symrec_data; const elf_machine_handler *elf_set_arch(struct yasm_arch *arch, yasm_symtab *symtab, int bits_pref); +yasm_symrec *elf_get_special_sym(const char *name, const char *parser); + /* reloc functions */ int elf_is_wrt_sym_relative(yasm_symrec *wrt); +int elf_is_wrt_pos_adjusted(yasm_symrec *wrt); elf_reloc_entry *elf_reloc_entry_create(yasm_symrec *sym, /*@null@*/ yasm_symrec *wrt, yasm_intnum *addr, int rel, - size_t valsize); + size_t valsize, + int is_GOT_sym); void elf_reloc_entry_destroy(void *entry); /* strtab functions */ @@ -485,7 +509,9 @@ struct yasm_symrec *elf_secthead_set_sym(elf_secthead *shead, struct yasm_symrec *sym); void elf_secthead_add_size(elf_secthead *shead, yasm_intnum *size); char *elf_secthead_name_reloc_section(const char *basesect); -void elf_handle_reloc_addend(yasm_intnum *intn, elf_reloc_entry *reloc); +void elf_handle_reloc_addend(yasm_intnum *intn, + elf_reloc_entry *reloc, + unsigned long offset); unsigned long elf_secthead_write_rel_to_file(FILE *f, elf_section_index symtab, yasm_section *sect, elf_secthead *esd, diff --git a/modules/objfmts/elf/tests/Makefile.inc b/modules/objfmts/elf/tests/Makefile.inc index bf112037..0980329c 100644 --- a/modules/objfmts/elf/tests/Makefile.inc +++ b/modules/objfmts/elf/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/elf/tests/elf_test.sh EXTRA_DIST += modules/objfmts/elf/tests/elf_test.sh @@ -49,7 +47,13 @@ EXTRA_DIST += modules/objfmts/elf/tests/nasm-forceident.asm EXTRA_DIST += modules/objfmts/elf/tests/nasm-forceident.hex EXTRA_DIST += modules/objfmts/elf/tests/amd64/Makefile.inc +EXTRA_DIST += modules/objfmts/elf/tests/x32/Makefile.inc +EXTRA_DIST += modules/objfmts/elf/tests/gas32/Makefile.inc EXTRA_DIST += modules/objfmts/elf/tests/gas64/Makefile.inc +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/Makefile.inc include modules/objfmts/elf/tests/amd64/Makefile.inc +include modules/objfmts/elf/tests/x32/Makefile.inc +include modules/objfmts/elf/tests/gas32/Makefile.inc include modules/objfmts/elf/tests/gas64/Makefile.inc +include modules/objfmts/elf/tests/gasx32/Makefile.inc diff --git a/modules/objfmts/elf/tests/amd64/Makefile.inc b/modules/objfmts/elf/tests/amd64/Makefile.inc index d0695926..deb54bc0 100644 --- a/modules/objfmts/elf/tests/amd64/Makefile.inc +++ b/modules/objfmts/elf/tests/amd64/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/elf/tests/amd64/elf_amd64_test.sh EXTRA_DIST += modules/objfmts/elf/tests/amd64/elf_amd64_test.sh @@ -7,3 +5,7 @@ EXTRA_DIST += modules/objfmts/elf/tests/amd64/elf-rip.asm EXTRA_DIST += modules/objfmts/elf/tests/amd64/elf-rip.hex EXTRA_DIST += modules/objfmts/elf/tests/amd64/elfso64.asm EXTRA_DIST += modules/objfmts/elf/tests/amd64/elfso64.hex +EXTRA_DIST += modules/objfmts/elf/tests/amd64/gotpcrel.asm +EXTRA_DIST += modules/objfmts/elf/tests/amd64/gotpcrel.hex +EXTRA_DIST += modules/objfmts/elf/tests/amd64/multiplefixup.asm +EXTRA_DIST += modules/objfmts/elf/tests/amd64/multiplefixup.hex diff --git a/modules/objfmts/elf/tests/amd64/elf_amd64_test.sh b/modules/objfmts/elf/tests/amd64/elf_amd64_test.sh index 239443da..1f48a32a 100755 --- a/modules/objfmts/elf/tests/amd64/elf_amd64_test.sh +++ b/modules/objfmts/elf/tests/amd64/elf_amd64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh elf_amd64_test modules/objfmts/elf/tests/amd64 "elf-amd64 objfmt" "-m amd64 -f elf" ".o" exit $? diff --git a/modules/objfmts/elf/tests/amd64/elfso64.asm b/modules/objfmts/elf/tests/amd64/elfso64.asm index 39dbf2ea..931c7ffe 100644 --- a/modules/objfmts/elf/tests/amd64/elfso64.asm +++ b/modules/objfmts/elf/tests/amd64/elfso64.asm @@ -21,18 +21,18 @@ ; [16] Reference a data-section symbol in the data section ; [17] Reference a BSS-section symbol in the data section - BITS 64 - GLOBAL lrotate:function ; [1] - GLOBAL greet:function ; [1] - GLOBAL asmstr:data asmstr.end-asmstr ; [2] - GLOBAL textptr:data 4 ; [2] - GLOBAL selfptr:data 4 ; [2] - GLOBAL integer:data 4 ; [3] - EXTERN printf ; [10] - COMMON commvar 4:4 ; [7] - EXTERN _GLOBAL_OFFSET_TABLE_ + [BITS 64] + [GLOBAL lrotate:function] ; [1] + [GLOBAL greet:function] ; [1] + [GLOBAL asmstr:data asmstr.end-asmstr] ; [2] + [GLOBAL textptr:data 4] ; [2] + [GLOBAL selfptr:data 4] ; [2] + [GLOBAL integer:data 4] ; [3] + [EXTERN printf] ; [10] + [COMMON commvar 4:4] ; [7] + [EXTERN _GLOBAL_OFFSET_TABLE_] - SECTION .text + [SECTION .text] ; prototype: long lrotate(long x, int num); lrotate: ; [1] @@ -66,7 +66,7 @@ greet push rbx ; we'll use RBX for GOT, so save it pop rbx ret - SECTION .data + [SECTION .data] ; a string asmstr db 'hello, world', 0 ; [2] @@ -81,7 +81,7 @@ localptr dd localint ; [5] [17] textptr dd greet wrt ..sym ; [15] selfptr dd selfptr wrt ..sym ; [16] - SECTION .bss + [SECTION .bss] ; an integer integer resd 1 ; [3] diff --git a/modules/objfmts/elf/tests/amd64/gotpcrel.asm b/modules/objfmts/elf/tests/amd64/gotpcrel.asm new file mode 100644 index 00000000..c3d12383 --- /dev/null +++ b/modules/objfmts/elf/tests/amd64/gotpcrel.asm @@ -0,0 +1,6 @@ +var: +mov rax, [var wrt ..got] +mov rax, [var wrt ..gotpcrel] ; should be error/warning? +mov rax, [rel var wrt ..got] ; automatic promotion to GOTPCREL +mov rax, [rel var wrt ..gotpcrel] + diff --git a/modules/objfmts/elf/tests/amd64/gotpcrel.hex b/modules/objfmts/elf/tests/amd64/gotpcrel.hex new file mode 100644 index 00000000..1ad94244 --- /dev/null +++ b/modules/objfmts/elf/tests/amd64/gotpcrel.hex @@ -0,0 +1,720 @@ +7f +45 +4c +46 +02 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +50 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +40 +00 +06 +00 +01 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0c +00 +00 +00 +00 +00 +00 +00 +09 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +13 +00 +00 +00 +00 +00 +00 +00 +09 +00 +00 +00 +02 +00 +00 +00 +fc +ff +ff +ff +ff +ff +ff +ff +1a +00 +00 +00 +00 +00 +00 +00 +09 +00 +00 +00 +02 +00 +00 +00 +fc +ff +ff +ff +ff +ff +ff +ff +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c0 +00 +00 +00 +00 +00 +00 +00 +2c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +ec +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +f0 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +00 +00 +1e +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/amd64/multiplefixup.asm b/modules/objfmts/elf/tests/amd64/multiplefixup.asm new file mode 100644 index 00000000..ec253cbb --- /dev/null +++ b/modules/objfmts/elf/tests/amd64/multiplefixup.asm @@ -0,0 +1,8 @@ +[section .data] +foobar: + dq 42 +[section .text] +foo: + times 4 mov rax, [rel foobar] + times 4 mov rax, [foobar] + times 4 jmp foo diff --git a/modules/objfmts/elf/tests/amd64/multiplefixup.hex b/modules/objfmts/elf/tests/amd64/multiplefixup.hex new file mode 100644 index 00000000..16565ff5 --- /dev/null +++ b/modules/objfmts/elf/tests/amd64/multiplefixup.hex @@ -0,0 +1,992 @@ +7f +45 +4c +46 +02 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +40 +00 +07 +00 +01 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +eb +c2 +eb +c0 +eb +be +eb +bc +03 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +fc +ff +ff +ff +ff +ff +ff +ff +0a +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +fc +ff +ff +ff +ff +ff +ff +ff +11 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +fc +ff +ff +ff +ff +ff +ff +ff +18 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +fc +ff +ff +ff +ff +ff +ff +ff +20 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +28 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +30 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +38 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2a +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +64 +61 +74 +61 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +28 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +4c +01 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +80 +01 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +84 +01 +00 +00 +00 +00 +00 +00 +90 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +06 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +00 +00 +44 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0d +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +84 +00 +00 +00 +00 +00 +00 +00 +c0 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +44 +01 +00 +00 +00 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/curpos-err.errwarn b/modules/objfmts/elf/tests/curpos-err.errwarn index fb6f65d7..efe6b093 100644 --- a/modules/objfmts/elf/tests/curpos-err.errwarn +++ b/modules/objfmts/elf/tests/curpos-err.errwarn @@ -1,2 +1,2 @@ --:15: data expression too complex --:21: data expression too complex +-:15: error: data expression too complex +-:21: error: data expression too complex diff --git a/modules/objfmts/elf/tests/elf-x86id.asm b/modules/objfmts/elf/tests/elf-x86id.asm index e083fdd5..04b4a039 100644 --- a/modules/objfmts/elf/tests/elf-x86id.asm +++ b/modules/objfmts/elf/tests/elf-x86id.asm @@ -5,37 +5,37 @@ ;#APP ;.ident "$Id$" ;#NO_APP -extern yasm_internal_error_ -extern yasm_expr_copy -extern yasm_expr_expr -extern yasm_expr_new -extern yasm_symrec_define_label -extern yasm_x86_LTX_mode_bits -extern yasm_x86__bc_new_jmp -extern yasm_ea_get_disp -extern yasm_expr__contains -extern yasm_x86__get_reg_size -extern yasm__error -extern yasm_intnum_new_uint -extern yasm_expr_int -extern yasm_ea_delete -extern yasm_expr_delete -extern yasm_x86__ea_new_reg -extern yasm_x86__ea_set_disponly -extern yasm_x86__ea_new_imm -extern yasm_x86__set_rex_from_reg -extern yasm_xfree -extern yasm_x86__bc_new_insn -extern yasm__warning +[extern yasm_internal_error_] +[extern yasm_expr_copy] +[extern yasm_expr_expr] +[extern yasm_expr_new] +[extern yasm_symrec_define_label] +[extern yasm_x86_LTX_mode_bits] +[extern yasm_x86__bc_new_jmp] +[extern yasm_ea_get_disp] +[extern yasm_expr__contains] +[extern yasm_x86__get_reg_size] +[extern yasm__error] +[extern yasm_intnum_new_uint] +[extern yasm_expr_int] +[extern yasm_ea_delete] +[extern yasm_expr_delete] +[extern yasm_x86__ea_new_reg] +[extern yasm_x86__ea_set_disponly] +[extern yasm_x86__ea_new_imm] +[extern yasm_x86__set_rex_from_reg] +[extern yasm_xfree] +[extern yasm_x86__bc_new_insn] +[extern yasm__warning] - section .data - align 4 + [section .data] + [align 4] ;.type cpu_enabled,@object ;.size cpu_enabled,4 cpu_enabled: dd -1 - section .rodata - align 4 + [section .rodata] + [align 4] ;.type not64_insn,@object ;.size not64_insn,28 not64_insn: @@ -52,7 +52,7 @@ not64_insn: dd 0 dd 0 dd 0 - align 4 + [align 4] ;.type onebyte_insn,@object ;.size onebyte_insn,28 onebyte_insn: @@ -69,7 +69,7 @@ onebyte_insn: dd 0 dd 0 dd 0 - align 4 + [align 4] ;.type twobyte_insn,@object ;.size twobyte_insn,28 twobyte_insn: @@ -86,7 +86,7 @@ twobyte_insn: dd 0 dd 0 dd 0 - align 4 + [align 4] ;.type threebyte_insn,@object ;.size threebyte_insn,28 threebyte_insn: @@ -103,7 +103,7 @@ threebyte_insn: dd 0 dd 0 dd 0 - align 4 + [align 4] ;.type onebytemem_insn,@object ;.size onebytemem_insn,28 onebytemem_insn: @@ -120,7 +120,7 @@ onebytemem_insn: dd 4098 dd 0 dd 0 - align 4 + [align 4] ;.type twobytemem_insn,@object ;.size twobytemem_insn,28 twobytemem_insn: @@ -137,7 +137,7 @@ twobytemem_insn: dd 4098 dd 0 dd 0 - align 32 + [align 32] ;.type mov_insn,@object ;.size mov_insn,1260 mov_insn: @@ -726,7 +726,7 @@ mov_insn: dd 4225 dd 16488 dd 0 - align 32 + [align 32] ;.type movszx_insn,@object ;.size movszx_insn,140 movszx_insn: @@ -795,7 +795,7 @@ movszx_insn: dd 16513 dd 4163 dd 0 - align 4 + [align 4] ;.type movsxd_insn,@object ;.size movsxd_insn,28 movsxd_insn: @@ -812,7 +812,7 @@ movsxd_insn: dd 16513 dd 4195 dd 0 - align 32 + [align 32] ;.type push_insn,@object ;.size push_insn,784 push_insn: @@ -1180,7 +1180,7 @@ push_insn: dd 114 dd 0 dd 0 - align 32 + [align 32] ;.type pop_insn,@object ;.size pop_insn,588 pop_insn: @@ -1457,7 +1457,7 @@ pop_insn: dd 114 dd 0 dd 0 - align 32 + [align 32] ;.type xchg_insn,@object ;.size xchg_insn,392 xchg_insn: @@ -1643,7 +1643,7 @@ xchg_insn: dd 16513 dd 4483 dd 0 - align 32 + [align 32] ;.type in_insn,@object ;.size in_insn,168 in_insn: @@ -1725,7 +1725,7 @@ in_insn: dd 107 dd 77 dd 0 - align 32 + [align 32] ;.type out_insn,@object ;.size out_insn,168 out_insn: @@ -1807,7 +1807,7 @@ out_insn: dd 77 dd 107 dd 0 - align 32 + [align 32] ;.type lea_insn,@object ;.size lea_insn,84 lea_insn: @@ -1850,7 +1850,7 @@ lea_insn: dd 16513 dd 4482 dd 0 - align 32 + [align 32] ;.type ldes_insn,@object ;.size ldes_insn,56 ldes_insn: @@ -1880,7 +1880,7 @@ ldes_insn: dd 16481 dd 4098 dd 0 - align 32 + [align 32] ;.type lfgss_insn,@object ;.size lfgss_insn,56 lfgss_insn: @@ -1910,7 +1910,7 @@ lfgss_insn: dd 16481 dd 4098 dd 0 - align 32 + [align 32] ;.type arith_insn,@object ;.size arith_insn,644 arith_insn: @@ -2213,7 +2213,7 @@ arith_insn: dd 16513 dd 4483 dd 0 - align 32 + [align 32] ;.type incdec_insn,@object ;.size incdec_insn,168 incdec_insn: @@ -2295,7 +2295,7 @@ incdec_insn: dd 4227 dd 0 dd 0 - align 32 + [align 32] ;.type f6_insn,@object ;.size f6_insn,112 f6_insn: @@ -2351,7 +2351,7 @@ f6_insn: dd 4227 dd 0 dd 0 - align 32 + [align 32] ;.type test_insn,@object ;.size test_insn,560 test_insn: @@ -2615,7 +2615,7 @@ test_insn: dd 16513 dd 4483 dd 0 - align 32 + [align 32] ;.type aadm_insn,@object ;.size aadm_insn,56 aadm_insn: @@ -2645,7 +2645,7 @@ aadm_insn: dd 8480 dd 0 dd 0 - align 32 + [align 32] ;.type imul_insn,@object ;.size imul_insn,532 imul_insn: @@ -2896,7 +2896,7 @@ imul_insn: dd 28801 dd 143712 dd 0 - align 32 + [align 32] ;.type shift_insn,@object ;.size shift_insn,224 shift_insn: @@ -3004,7 +3004,7 @@ shift_insn: dd 4227 dd 74016 dd 0 - align 32 + [align 32] ;.type shlrd_insn,@object ;.size shlrd_insn,168 shlrd_insn: @@ -3086,7 +3086,7 @@ shlrd_insn: dd 4483 dd 16513 dd 44 - align 32 + [align 32] ;.type call_insn,@object ;.size call_insn,560 call_insn: @@ -3350,7 +3350,7 @@ call_insn: dd 5634 dd 0 dd 0 - align 32 + [align 32] ;.type jmp_insn,@object ;.size jmp_insn,588 jmp_insn: @@ -3627,7 +3627,7 @@ jmp_insn: dd 5634 dd 0 dd 0 - align 32 + [align 32] ;.type retnf_insn,@object ;.size retnf_insn,56 retnf_insn: @@ -3657,7 +3657,7 @@ retnf_insn: dd 8512 dd 0 dd 0 - align 4 + [align 4] ;.type enter_insn,@object ;.size enter_insn,28 enter_insn: @@ -3674,7 +3674,7 @@ enter_insn: dd 4416 dd 8480 dd 0 - align 32 + [align 32] ;.type jcc_insn,@object ;.size jcc_insn,196 jcc_insn: @@ -3769,7 +3769,7 @@ jcc_insn: dd 33280 dd 0 dd 0 - align 32 + [align 32] ;.type jcxz_insn,@object ;.size jcxz_insn,56 jcxz_insn: @@ -3799,7 +3799,7 @@ jcxz_insn: dd 33792 dd 0 dd 0 - align 32 + [align 32] ;.type loop_insn,@object ;.size loop_insn,224 loop_insn: @@ -3907,7 +3907,7 @@ loop_insn: dd 33792 dd 37004 dd 0 - align 4 + [align 4] ;.type setcc_insn,@object ;.size setcc_insn,28 setcc_insn: @@ -3924,7 +3924,7 @@ setcc_insn: dd 4387 dd 0 dd 0 - align 32 + [align 32] ;.type bittest_insn,@object ;.size bittest_insn,168 bittest_insn: @@ -4006,7 +4006,7 @@ bittest_insn: dd 4227 dd 8224 dd 0 - align 32 + [align 32] ;.type bsfr_insn,@object ;.size bsfr_insn,84 bsfr_insn: @@ -4049,7 +4049,7 @@ bsfr_insn: dd 16513 dd 4483 dd 0 - align 4 + [align 4] ;.type int_insn,@object ;.size int_insn,28 int_insn: @@ -4066,7 +4066,7 @@ int_insn: dd 8480 dd 0 dd 0 - align 32 + [align 32] ;.type bound_insn,@object ;.size bound_insn,56 bound_insn: @@ -4096,7 +4096,7 @@ bound_insn: dd 16481 dd 4450 dd 0 - align 4 + [align 4] ;.type arpl_insn,@object ;.size arpl_insn,28 arpl_insn: @@ -4113,7 +4113,7 @@ arpl_insn: dd 4419 dd 16449 dd 0 - align 32 + [align 32] ;.type str_insn,@object ;.size str_insn,112 str_insn: @@ -4169,7 +4169,7 @@ str_insn: dd 4419 dd 0 dd 0 - align 4 + [align 4] ;.type prot286_insn,@object ;.size prot286_insn,28 prot286_insn: @@ -4186,7 +4186,7 @@ prot286_insn: dd 4419 dd 0 dd 0 - align 32 + [align 32] ;.type sldtmsw_insn,@object ;.size sldtmsw_insn,168 sldtmsw_insn: @@ -4268,7 +4268,7 @@ sldtmsw_insn: dd 4225 dd 0 dd 0 - align 32 + [align 32] ;.type fldstp_insn,@object ;.size fldstp_insn,112 fldstp_insn: @@ -4324,7 +4324,7 @@ fldstp_insn: dd 24737 dd 0 dd 0 - align 32 + [align 32] ;.type fildstp_insn,@object ;.size fildstp_insn,84 fildstp_insn: @@ -4367,7 +4367,7 @@ fildstp_insn: dd 4226 dd 0 dd 0 - align 4 + [align 4] ;.type fbldstp_insn,@object ;.size fbldstp_insn,28 fbldstp_insn: @@ -4384,7 +4384,7 @@ fbldstp_insn: dd 4514 dd 0 dd 0 - align 32 + [align 32] ;.type fst_insn,@object ;.size fst_insn,84 fst_insn: @@ -4427,7 +4427,7 @@ fst_insn: dd 24737 dd 0 dd 0 - align 32 + [align 32] ;.type fxch_insn,@object ;.size fxch_insn,112 fxch_insn: @@ -4483,7 +4483,7 @@ fxch_insn: dd 0 dd 0 dd 0 - align 32 + [align 32] ;.type fcom_insn,@object ;.size fcom_insn,112 fcom_insn: @@ -4539,7 +4539,7 @@ fcom_insn: dd 170 dd 24737 dd 0 - align 32 + [align 32] ;.type fcom2_insn,@object ;.size fcom2_insn,56 fcom2_insn: @@ -4569,7 +4569,7 @@ fcom2_insn: dd 170 dd 24737 dd 0 - align 32 + [align 32] ;.type farith_insn,@object ;.size farith_insn,168 farith_insn: @@ -4651,7 +4651,7 @@ farith_insn: dd 24737 dd 170 dd 0 - align 32 + [align 32] ;.type farithp_insn,@object ;.size farithp_insn,84 farithp_insn: @@ -4694,7 +4694,7 @@ farithp_insn: dd 24737 dd 170 dd 0 - align 32 + [align 32] ;.type fiarith_insn,@object ;.size fiarith_insn,56 fiarith_insn: @@ -4724,7 +4724,7 @@ fiarith_insn: dd 4194 dd 0 dd 0 - align 4 + [align 4] ;.type fldnstcw_insn,@object ;.size fldnstcw_insn,28 fldnstcw_insn: @@ -4741,7 +4741,7 @@ fldnstcw_insn: dd 4418 dd 0 dd 0 - align 4 + [align 4] ;.type fstcw_insn,@object ;.size fstcw_insn,28 fstcw_insn: @@ -4758,7 +4758,7 @@ fstcw_insn: dd 4418 dd 0 dd 0 - align 32 + [align 32] ;.type fnstsw_insn,@object ;.size fnstsw_insn,56 fnstsw_insn: @@ -4788,7 +4788,7 @@ fnstsw_insn: dd 75 dd 0 dd 0 - align 32 + [align 32] ;.type fstsw_insn,@object ;.size fstsw_insn,56 fstsw_insn: @@ -4818,7 +4818,7 @@ fstsw_insn: dd 75 dd 0 dd 0 - align 4 + [align 4] ;.type ffree_insn,@object ;.size ffree_insn,28 ffree_insn: @@ -4835,7 +4835,7 @@ ffree_insn: dd 24737 dd 0 dd 0 - align 32 + [align 32] ;.type bswap_insn,@object ;.size bswap_insn,56 bswap_insn: @@ -4865,7 +4865,7 @@ bswap_insn: dd 24705 dd 0 dd 0 - align 32 + [align 32] ;.type cmpxchgxadd_insn,@object ;.size cmpxchgxadd_insn,112 cmpxchgxadd_insn: @@ -4921,7 +4921,7 @@ cmpxchgxadd_insn: dd 4483 dd 16513 dd 0 - align 4 + [align 4] ;.type cmpxchg8b_insn,@object ;.size cmpxchg8b_insn,28 cmpxchg8b_insn: @@ -4938,7 +4938,7 @@ cmpxchg8b_insn: dd 4482 dd 0 dd 0 - align 32 + [align 32] ;.type cmovcc_insn,@object ;.size cmovcc_insn,84 cmovcc_insn: @@ -4981,7 +4981,7 @@ cmovcc_insn: dd 16513 dd 4483 dd 0 - align 4 + [align 4] ;.type fcmovcc_insn,@object ;.size fcmovcc_insn,28 fcmovcc_insn: @@ -4998,7 +4998,7 @@ fcmovcc_insn: dd 170 dd 24737 dd 0 - align 32 + [align 32] ;.type movnti_insn,@object ;.size movnti_insn,56 movnti_insn: @@ -5028,7 +5028,7 @@ movnti_insn: dd 4482 dd 16513 dd 0 - align 4 + [align 4] ;.type clflush_insn,@object ;.size clflush_insn,28 clflush_insn: @@ -5045,7 +5045,7 @@ clflush_insn: dd 4386 dd 0 dd 0 - align 32 + [align 32] ;.type movd_insn,@object ;.size movd_insn,224 movd_insn: @@ -5153,7 +5153,7 @@ movd_insn: dd 4483 dd 16580 dd 0 - align 32 + [align 32] ;.type movq_insn,@object ;.size movq_insn,140 movq_insn: @@ -5222,7 +5222,7 @@ movq_insn: dd 4485 dd 16580 dd 0 - align 32 + [align 32] ;.type mmxsse2_insn,@object ;.size mmxsse2_insn,56 mmxsse2_insn: @@ -5252,7 +5252,7 @@ mmxsse2_insn: dd 16580 dd 4549 dd 0 - align 32 + [align 32] ;.type pshift_insn,@object ;.size pshift_insn,112 pshift_insn: @@ -5308,7 +5308,7 @@ pshift_insn: dd 4292 dd 8480 dd 0 - align 4 + [align 4] ;.type sseps_insn,@object ;.size sseps_insn,28 sseps_insn: @@ -5325,7 +5325,7 @@ sseps_insn: dd 16580 dd 4549 dd 0 - align 4 + [align 4] ;.type ssess_insn,@object ;.size ssess_insn,28 ssess_insn: @@ -5342,7 +5342,7 @@ ssess_insn: dd 16580 dd 4549 dd 0 - align 4 + [align 4] ;.type ssecmpps_insn,@object ;.size ssecmpps_insn,28 ssecmpps_insn: @@ -5359,7 +5359,7 @@ ssecmpps_insn: dd 16580 dd 4549 dd 0 - align 4 + [align 4] ;.type ssecmpss_insn,@object ;.size ssecmpss_insn,28 ssecmpss_insn: @@ -5376,7 +5376,7 @@ ssecmpss_insn: dd 16580 dd 4549 dd 0 - align 4 + [align 4] ;.type ssepsimm_insn,@object ;.size ssepsimm_insn,28 ssepsimm_insn: @@ -5393,7 +5393,7 @@ ssepsimm_insn: dd 16580 dd 4549 dd 8480 - align 4 + [align 4] ;.type ssessimm_insn,@object ;.size ssessimm_insn,28 ssessimm_insn: @@ -5410,7 +5410,7 @@ ssessimm_insn: dd 16580 dd 4549 dd 8480 - align 4 + [align 4] ;.type ldstmxcsr_insn,@object ;.size ldstmxcsr_insn,28 ldstmxcsr_insn: @@ -5427,7 +5427,7 @@ ldstmxcsr_insn: dd 4450 dd 0 dd 0 - align 4 + [align 4] ;.type maskmovq_insn,@object ;.size maskmovq_insn,28 maskmovq_insn: @@ -5444,7 +5444,7 @@ maskmovq_insn: dd 16516 dd 4228 dd 0 - align 32 + [align 32] ;.type movaups_insn,@object ;.size movaups_insn,56 movaups_insn: @@ -5474,7 +5474,7 @@ movaups_insn: dd 4549 dd 16580 dd 0 - align 4 + [align 4] ;.type movhllhps_insn,@object ;.size movhllhps_insn,28 movhllhps_insn: @@ -5491,7 +5491,7 @@ movhllhps_insn: dd 16580 dd 4292 dd 0 - align 32 + [align 32] ;.type movhlps_insn,@object ;.size movhlps_insn,56 movhlps_insn: @@ -5521,7 +5521,7 @@ movhlps_insn: dd 4482 dd 16580 dd 0 - align 4 + [align 4] ;.type movmskps_insn,@object ;.size movmskps_insn,28 movmskps_insn: @@ -5538,7 +5538,7 @@ movmskps_insn: dd 4193 dd 16580 dd 0 - align 4 + [align 4] ;.type movntps_insn,@object ;.size movntps_insn,28 movntps_insn: @@ -5555,7 +5555,7 @@ movntps_insn: dd 4546 dd 16577 dd 0 - align 4 + [align 4] ;.type movntq_insn,@object ;.size movntq_insn,28 movntq_insn: @@ -5572,7 +5572,7 @@ movntq_insn: dd 4482 dd 16580 dd 0 - align 32 + [align 32] ;.type movss_insn,@object ;.size movss_insn,84 movss_insn: @@ -5615,7 +5615,7 @@ movss_insn: dd 4482 dd 16580 dd 0 - align 32 + [align 32] ;.type pextrw_insn,@object ;.size pextrw_insn,56 pextrw_insn: @@ -5645,7 +5645,7 @@ pextrw_insn: dd 4193 dd 16580 dd 8480 - align 32 + [align 32] ;.type pinsrw_insn,@object ;.size pinsrw_insn,112 pinsrw_insn: @@ -5701,7 +5701,7 @@ pinsrw_insn: dd 16516 dd 4419 dd 8480 - align 32 + [align 32] ;.type pmovmskb_insn,@object ;.size pmovmskb_insn,56 pmovmskb_insn: @@ -5731,7 +5731,7 @@ pmovmskb_insn: dd 4193 dd 16580 dd 0 - align 4 + [align 4] ;.type pshufw_insn,@object ;.size pshufw_insn,28 pshufw_insn: @@ -5748,7 +5748,7 @@ pshufw_insn: dd 16516 dd 4485 dd 8480 - align 32 + [align 32] ;.type cmpsd_insn,@object ;.size cmpsd_insn,56 cmpsd_insn: @@ -5778,7 +5778,7 @@ cmpsd_insn: dd 16580 dd 4549 dd 8480 - align 32 + [align 32] ;.type movaupd_insn,@object ;.size movaupd_insn,56 movaupd_insn: @@ -5808,7 +5808,7 @@ movaupd_insn: dd 4549 dd 16580 dd 0 - align 32 + [align 32] ;.type movhlpd_insn,@object ;.size movhlpd_insn,56 movhlpd_insn: @@ -5838,7 +5838,7 @@ movhlpd_insn: dd 4482 dd 16580 dd 0 - align 4 + [align 4] ;.type movmskpd_insn,@object ;.size movmskpd_insn,28 movmskpd_insn: @@ -5855,7 +5855,7 @@ movmskpd_insn: dd 4193 dd 16580 dd 0 - align 4 + [align 4] ;.type movntpddq_insn,@object ;.size movntpddq_insn,28 movntpddq_insn: @@ -5872,7 +5872,7 @@ movntpddq_insn: dd 4546 dd 16580 dd 0 - align 32 + [align 32] ;.type movsd_insn,@object ;.size movsd_insn,112 movsd_insn: @@ -5928,7 +5928,7 @@ movsd_insn: dd 4482 dd 16580 dd 0 - align 4 + [align 4] ;.type maskmovdqu_insn,@object ;.size maskmovdqu_insn,28 maskmovdqu_insn: @@ -5945,7 +5945,7 @@ maskmovdqu_insn: dd 16580 dd 4292 dd 0 - align 32 + [align 32] ;.type movdqau_insn,@object ;.size movdqau_insn,56 movdqau_insn: @@ -5975,7 +5975,7 @@ movdqau_insn: dd 4549 dd 16580 dd 0 - align 4 + [align 4] ;.type movdq2q_insn,@object ;.size movdq2q_insn,28 movdq2q_insn: @@ -5992,7 +5992,7 @@ movdq2q_insn: dd 16516 dd 4292 dd 0 - align 4 + [align 4] ;.type movq2dq_insn,@object ;.size movq2dq_insn,28 movq2dq_insn: @@ -6009,7 +6009,7 @@ movq2dq_insn: dd 16580 dd 4228 dd 0 - align 4 + [align 4] ;.type pslrldq_insn,@object ;.size pslrldq_insn,28 pslrldq_insn: @@ -6026,7 +6026,7 @@ pslrldq_insn: dd 4292 dd 8480 dd 0 - align 4 + [align 4] ;.type now3d_insn,@object ;.size now3d_insn,28 now3d_insn: @@ -6043,7 +6043,7 @@ now3d_insn: dd 16516 dd 4485 dd 0 - align 4 + [align 4] ;.type cyrixmmx_insn,@object ;.size cyrixmmx_insn,28 cyrixmmx_insn: @@ -6060,7 +6060,7 @@ cyrixmmx_insn: dd 16516 dd 4485 dd 0 - align 4 + [align 4] ;.type pmachriw_insn,@object ;.size pmachriw_insn,28 pmachriw_insn: @@ -6077,7 +6077,7 @@ pmachriw_insn: dd 16516 dd 4482 dd 0 - align 4 + [align 4] ;.type rsdc_insn,@object ;.size rsdc_insn,28 rsdc_insn: @@ -6094,7 +6094,7 @@ rsdc_insn: dd 16454 dd 4514 dd 0 - align 4 + [align 4] ;.type cyrixsmm_insn,@object ;.size cyrixsmm_insn,28 cyrixsmm_insn: @@ -6111,7 +6111,7 @@ cyrixsmm_insn: dd 4514 dd 0 dd 0 - align 4 + [align 4] ;.type svdc_insn,@object ;.size svdc_insn,28 svdc_insn: @@ -6128,7 +6128,7 @@ svdc_insn: dd 4514 dd 16454 dd 0 - align 32 + [align 32] ;.type ibts_insn,@object ;.size ibts_insn,56 ibts_insn: @@ -6158,7 +6158,7 @@ ibts_insn: dd 4451 dd 16481 dd 0 - align 32 + [align 32] ;.type umov_insn,@object ;.size umov_insn,168 umov_insn: @@ -6240,7 +6240,7 @@ umov_insn: dd 16481 dd 4451 dd 0 - align 32 + [align 32] ;.type xbts_insn,@object ;.size xbts_insn,56 xbts_insn: @@ -6281,14 +6281,14 @@ size_lookup.0: db 80 db -128 db 0 - section .rodata;.str1.1,"aMS",@progbits,1 + [section .rodata];.str1.1,"aMS",@progbits,1 LC0: db "invalid operand conversion", 0 LC1: db "./modules/arch/x86/x86id.re", 0 LC2: db "$", 0 - section .text + [section .text] ;.type x86_new_jmp,@function x86_new_jmp: push ebp @@ -6524,8 +6524,8 @@ x86_new_jmp: ret .Lfe1: ;.size x86_new_jmp,.Lfe1-x86_new_jmp - section .rodata - align 32 + [section .rodata] + [align 32] ;.type size_lookup.1,@object ;.size size_lookup.1,32 size_lookup.1: @@ -6537,7 +6537,7 @@ size_lookup.1: dd 10 dd 16 dd 0 - section .rodata;.str1.1 + [section .rodata];.str1.1 LC3: db "invalid operand type", 0 LC4: @@ -6546,25 +6546,25 @@ LC6: db "mismatch in operand sizes", 0 LC7: db "operand size not specified", 0 - section .rodata;.str1.32,"aMS",@progbits,1 - align 32 + [section .rodata];.str1.32,"aMS",@progbits,1 + [align 32] LC8: db "unrecognized x86 ext mod index", 0 - align 32 + [align 32] LC9: db "unrecognized x86 extended modifier", 0 - align 32 + [align 32] LC5: db "invalid combination of opcode and operands", 0 - section .rodata;.str1.1 + [section .rodata];.str1.1 LC10: db "unknown operand action", 0 - section .rodata;.str1.32 - align 32 + [section .rodata];.str1.32 + [align 32] LC11: db "unknown operand postponed action", 0 - section .text -global yasm_x86__parse_insn + [section .text] +[global yasm_x86__parse_insn] ;.type yasm_x86__parse_insn,@function yasm_x86__parse_insn: push ebp @@ -6626,9 +6626,9 @@ yasm_x86__parse_insn: cmp eax, 21 ja .L139 jmp DWORD [.L140+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L140: dd .L53 dd .L57 @@ -6652,7 +6652,7 @@ yasm_x86__parse_insn: dd .L130 dd .L133 dd .L136 - section .text + [section .text] .L53: cmp DWORD [edi+4], 4 jmp .L273 @@ -7496,12 +7496,12 @@ yasm_x86__parse_insn: ret .Lfe2: ;.size yasm_x86__parse_insn,.Lfe2-yasm_x86__parse_insn - section .rodata;.str1.32 - align 32 + [section .rodata];.str1.32 + [align 32] LC12: db "unrecognized CPU identifier `s'", 0 - section .text -global yasm_x86__parse_cpu + [section .text] +[global yasm_x86__parse_cpu] ;.type yasm_x86__parse_cpu,@function yasm_x86__parse_cpu: push ebp @@ -7515,9 +7515,9 @@ yasm_x86__parse_cpu: cmp eax, 119 ja .L338 jmp DWORD [.L339+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L339: dd .L283 dd .L338 @@ -7639,7 +7639,7 @@ yasm_x86__parse_cpu: dd .L333 dd .L338 dd .L336 - section .text + [section .text] .L297: inc edx mov cl, BYTE [edx] @@ -7988,9 +7988,9 @@ yasm_x86__parse_cpu: cmp eax, 66 ja .L342 jmp DWORD [.L530+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L530: dd .L504 dd .L342 @@ -8059,7 +8059,7 @@ yasm_x86__parse_cpu: dd .L525 dd .L342 dd .L528 - section .text + [section .text] .L513: inc edx mov cl, BYTE [edx] @@ -9102,27 +9102,27 @@ yasm_x86__parse_cpu: ret .Lfe3: ;.size yasm_x86__parse_cpu,.Lfe3-yasm_x86__parse_cpu - section .rodata;.str1.32 - align 32 + [section .rodata];.str1.32 + [align 32] LC16: db "`s' segment register ignored in 64-bit mode", 0 - align 32 + [align 32] LC18: db "Cannot override address size to 16 bits in 64-bit mode", 0 - align 32 + [align 32] LC17: db "`s' is a prefix in 64-bit mode", 0 - align 32 + [align 32] LC15: db "`s' is a register in 64-bit mode", 0 - align 32 + [align 32] LC13: db "`s' is an instruction in 64-bit mode", 0 - section .rodata;.str1.1 + [section .rodata];.str1.1 LC14: db "`s' invalid in 64-bit mode", 0 - section .text -global yasm_x86__parse_check_id + [section .text] +[global yasm_x86__parse_check_id] ;.type yasm_x86__parse_check_id,@function yasm_x86__parse_check_id: push ebp @@ -9140,9 +9140,9 @@ yasm_x86__parse_check_id: cmp eax, 120 ja .L999 jmp DWORD [.L1000+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1000: dd .L8702 dd .L999 @@ -9265,7 +9265,7 @@ yasm_x86__parse_check_id: dd .L991 dd .L994 dd .L997 - section .text + [section .text] .L970: inc ecx mov dl, BYTE [ecx] @@ -9295,9 +9295,9 @@ yasm_x86__parse_check_id: cmp eax, 56 ja .L1005 jmp DWORD [.L1069+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1069: dd .L1016 dd .L1019 @@ -9356,7 +9356,7 @@ yasm_x86__parse_check_id: dd .L1064 dd .L1005 dd .L1067 - section .text + [section .text] .L949: inc ecx mov dl, BYTE [ecx] @@ -9365,9 +9365,9 @@ yasm_x86__parse_check_id: cmp eax, 71 ja .L1005 jmp DWORD [.L1128+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1128: dd .L1072 dd .L1005 @@ -9441,7 +9441,7 @@ yasm_x86__parse_check_id: dd .L1120 dd .L1123 dd .L1126 - section .text + [section .text] .L985: inc ecx mov dl, BYTE [ecx] @@ -9508,9 +9508,9 @@ yasm_x86__parse_check_id: cmp eax, 71 ja .L1005 jmp DWORD [.L1191+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1191: dd .L1164 dd .L1005 @@ -9584,7 +9584,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1189 - section .text + [section .text] .L964: inc ecx mov dl, BYTE [ecx] @@ -9593,9 +9593,9 @@ yasm_x86__parse_check_id: cmp eax, 51 ja .L1005 jmp DWORD [.L1227+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1227: dd .L1195 dd .L1005 @@ -9649,7 +9649,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1222 dd .L1225 - section .text + [section .text] .L979: inc ecx mov dl, BYTE [ecx] @@ -9658,9 +9658,9 @@ yasm_x86__parse_check_id: cmp eax, 66 ja .L1005 jmp DWORD [.L1259+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1259: dd .L1230 dd .L1005 @@ -9729,7 +9729,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1257 - section .text + [section .text] .L940: inc ecx mov dl, BYTE [ecx] @@ -9738,9 +9738,9 @@ yasm_x86__parse_check_id: cmp eax, 55 ja .L1005 jmp DWORD [.L1301+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1301: dd .L1263 dd .L1266 @@ -9798,7 +9798,7 @@ yasm_x86__parse_check_id: dd .L1293 dd .L1296 dd .L1299 - section .text + [section .text] .L943: inc ecx mov dl, BYTE [ecx] @@ -9807,9 +9807,9 @@ yasm_x86__parse_check_id: cmp eax, 55 ja .L1005 jmp DWORD [.L1328+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1328: dd .L1305 dd .L1005 @@ -9867,7 +9867,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1326 - section .text + [section .text] .L967: inc ecx mov dl, BYTE [ecx] @@ -9876,9 +9876,9 @@ yasm_x86__parse_check_id: cmp eax, 52 ja .L1005 jmp DWORD [.L1349+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1349: dd .L1332 dd .L1005 @@ -9933,7 +9933,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1347 - section .text + [section .text] .L997: inc ecx mov dl, BYTE [ecx] @@ -9942,9 +9942,9 @@ yasm_x86__parse_check_id: cmp eax, 46 ja .L1005 jmp DWORD [.L1370+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1370: dd .L1353 dd .L1356 @@ -9993,7 +9993,7 @@ yasm_x86__parse_check_id: dd .L1365 dd .L1005 dd .L1368 - section .text + [section .text] .L946: inc ecx mov dl, BYTE [ecx] @@ -10002,9 +10002,9 @@ yasm_x86__parse_check_id: cmp eax, 50 ja .L1005 jmp DWORD [.L1394+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1394: dd .L1374 dd .L1377 @@ -10057,7 +10057,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1392 - section .text + [section .text] .L937: inc ecx mov dl, BYTE [ecx] @@ -10066,9 +10066,9 @@ yasm_x86__parse_check_id: cmp eax, 48 ja .L1005 jmp DWORD [.L1418+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1418: dd .L1398 dd .L1005 @@ -10119,7 +10119,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1416 - section .text + [section .text] .L952: inc ecx mov dl, BYTE [ecx] @@ -10136,9 +10136,9 @@ yasm_x86__parse_check_id: cmp eax, 55 ja .L1005 jmp DWORD [.L1457+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1457: dd .L1425 dd .L1005 @@ -10196,7 +10196,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1455 - section .text + [section .text] .L958: inc ecx mov dl, BYTE [ecx] @@ -10205,9 +10205,9 @@ yasm_x86__parse_check_id: cmp eax, 48 ja .L1005 jmp DWORD [.L1475+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1475: dd .L1461 dd .L1005 @@ -10258,7 +10258,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1473 - section .text + [section .text] .L961: inc ecx mov dl, BYTE [ecx] @@ -10267,9 +10267,9 @@ yasm_x86__parse_check_id: cmp eax, 57 ja .L1005 jmp DWORD [.L1517+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1517: dd .L1479 dd .L1482 @@ -10329,7 +10329,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1515 - section .text + [section .text] .L955: inc ecx mov dl, BYTE [ecx] @@ -10932,9 +10932,9 @@ yasm_x86__parse_check_id: cmp eax, 57 ja .L1005 jmp DWORD [.L1830+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L1830: dd .L1801 dd .L1804 @@ -10994,7 +10994,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L1828 - section .text + [section .text] .L1503: inc ecx cmp BYTE [ecx], 0 @@ -11676,9 +11676,9 @@ yasm_x86__parse_check_id: cmp eax, 65 ja .L1005 jmp DWORD [.L2189+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L2189: dd .L2166 dd .L1005 @@ -11746,7 +11746,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L2184 dd .L2187 - section .text + [section .text] .L1437: inc ecx mov dl, BYTE [ecx] @@ -11845,9 +11845,9 @@ yasm_x86__parse_check_id: cmp eax, 54 ja .L1005 jmp DWORD [.L2257+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L2257: dd .L2240 dd .L1005 @@ -11904,7 +11904,7 @@ yasm_x86__parse_check_id: dd .L2252 dd .L1005 dd .L2255 - section .text + [section .text] .L1452: inc ecx mov dl, BYTE [ecx] @@ -12531,9 +12531,9 @@ yasm_x86__parse_check_id: cmp eax, 53 ja .L1005 jmp DWORD [.L2571+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L2571: dd .L2554 dd .L1005 @@ -12589,7 +12589,7 @@ yasm_x86__parse_check_id: dd .L2566 dd .L1005 dd .L2569 - section .text + [section .text] .L2554: inc ecx cmp BYTE [ecx], 0 @@ -14530,9 +14530,9 @@ yasm_x86__parse_check_id: cmp eax, 53 ja .L1005 jmp DWORD [.L3482+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L3482: dd .L3465 dd .L1005 @@ -14588,7 +14588,7 @@ yasm_x86__parse_check_id: dd .L3477 dd .L1005 dd .L3480 - section .text + [section .text] .L3465: inc ecx cmp BYTE [ecx], 0 @@ -15939,9 +15939,9 @@ yasm_x86__parse_check_id: cmp eax, 54 ja .L1005 jmp DWORD [.L4093+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L4093: dd .L4076 dd .L1005 @@ -15998,7 +15998,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L4088 dd .L4091 - section .text + [section .text] .L4001: inc ecx mov dl, BYTE [ecx] @@ -18089,9 +18089,9 @@ yasm_x86__parse_check_id: cmp eax, 57 ja .L1005 jmp DWORD [.L5073+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L5073: dd .L5041 dd .L5044 @@ -18151,7 +18151,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L5071 - section .text + [section .text] .L5062: inc ecx cmp BYTE [ecx], 0 @@ -18167,9 +18167,9 @@ yasm_x86__parse_check_id: cmp eax, 57 ja .L1005 jmp DWORD [.L5109+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L5109: dd .L5080 dd .L5083 @@ -18229,7 +18229,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L5107 - section .text + [section .text] .L5044: inc ecx mov dl, BYTE [ecx] @@ -18577,9 +18577,9 @@ yasm_x86__parse_check_id: cmp eax, 53 ja .L1005 jmp DWORD [.L5310+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L5310: dd .L5296 dd .L1005 @@ -18635,7 +18635,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L5308 - section .text + [section .text] .L5015: inc ecx mov dl, BYTE [ecx] @@ -19766,9 +19766,9 @@ yasm_x86__parse_check_id: cmp eax, 47 ja .L1005 jmp DWORD [.L5855+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L5855: dd .L5838 dd .L1005 @@ -19818,7 +19818,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L5853 - section .text + [section .text] .L1248: inc ecx mov dl, BYTE [ecx] @@ -19875,9 +19875,9 @@ yasm_x86__parse_check_id: cmp eax, 48 ja .L1005 jmp DWORD [.L5902+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L5902: dd .L5882 dd .L1005 @@ -19928,7 +19928,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L5900 - section .text + [section .text] .L5894: inc ecx cmp BYTE [ecx], 0 @@ -21890,9 +21890,9 @@ yasm_x86__parse_check_id: cmp eax, 50 ja .L1005 jmp DWORD [.L6775+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L6775: dd .L6755 dd .L1005 @@ -21945,7 +21945,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L6773 - section .text + [section .text] .L1096: inc ecx mov dl, BYTE [ecx] @@ -24308,9 +24308,9 @@ yasm_x86__parse_check_id: cmp eax, 41 ja .L1005 jmp DWORD [.L7863+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L7863: dd .L7852 dd .L1005 @@ -24354,7 +24354,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L7861 - section .text + [section .text] .L1037: inc ecx mov dl, BYTE [ecx] @@ -24462,9 +24462,9 @@ yasm_x86__parse_check_id: cmp eax, 66 ja .L1005 jmp DWORD [.L7931+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L7931: dd .L7911 dd .L7911 @@ -24533,7 +24533,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L7929 - section .text + [section .text] .L1058: inc ecx mov dl, BYTE [ecx] @@ -25478,9 +25478,9 @@ yasm_x86__parse_check_id: cmp eax, 57 ja .L1005 jmp DWORD [.L8375+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L8375: dd .L8343 dd .L8346 @@ -25540,7 +25540,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L8373 - section .text + [section .text] .L8343: inc ecx mov dl, BYTE [ecx] @@ -25611,9 +25611,9 @@ yasm_x86__parse_check_id: cmp eax, 57 ja .L1005 jmp DWORD [.L8450+eax*4] - section .rodata - align 4 - align 4 + [section .rodata] + [align 4] + [align 4] .L8450: dd .L8421 dd .L8424 @@ -25673,7 +25673,7 @@ yasm_x86__parse_check_id: dd .L1005 dd .L1005 dd .L8448 - section .text + [section .text] .L8364: inc ecx cmp BYTE [ecx], 0 diff --git a/modules/objfmts/elf/tests/elf_test.sh b/modules/objfmts/elf/tests/elf_test.sh index 420eab36..ed3766ec 100755 --- a/modules/objfmts/elf/tests/elf_test.sh +++ b/modules/objfmts/elf/tests/elf_test.sh @@ -1,5 +1,4 @@ #! /bin/sh -# $Id$ # copied from yasm/modules/objfmts/coff/tests/coff_test.sh ; s/coff/elf/g ${srcdir}/out_test.sh elf_test modules/objfmts/elf/tests "elf objfmt" "-f elf" ".o" exit $? diff --git a/modules/objfmts/elf/tests/elfso.hex b/modules/objfmts/elf/tests/elfso.hex index 9d99c0f8..206cce9c 100644 --- a/modules/objfmts/elf/tests/elfso.hex +++ b/modules/objfmts/elf/tests/elfso.hex @@ -88,10 +88,10 @@ e8 5b 81 c3 -e9 -ff -ff -ff +03 +00 +00 +00 8b 83 00 diff --git a/modules/objfmts/elf/tests/elfvisibility.asm b/modules/objfmts/elf/tests/elfvisibility.asm index 32d20722..8577b5de 100644 --- a/modules/objfmts/elf/tests/elfvisibility.asm +++ b/modules/objfmts/elf/tests/elfvisibility.asm @@ -1,9 +1,9 @@ [section .text] -global ghidden:hidden -global ginternal:internal -global gprotected:protected -global gtoomany:hidden internal +[global ghidden:hidden] +[global ginternal:internal] +[global gprotected:protected] +[global gtoomany:hidden internal] ghidden: ginternal: diff --git a/modules/objfmts/elf/tests/gas32/Makefile.inc b/modules/objfmts/elf/tests/gas32/Makefile.inc new file mode 100644 index 00000000..883c2143 --- /dev/null +++ b/modules/objfmts/elf/tests/gas32/Makefile.inc @@ -0,0 +1,7 @@ +TESTS += modules/objfmts/elf/tests/gas32/elf_gas32_test.sh + +EXTRA_DIST += modules/objfmts/elf/tests/gas32/elf_gas32_test.sh +EXTRA_DIST += modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm +EXTRA_DIST += modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex +EXTRA_DIST += modules/objfmts/elf/tests/gas32/elf_gas32_got.asm +EXTRA_DIST += modules/objfmts/elf/tests/gas32/elf_gas32_got.hex diff --git a/modules/objfmts/elf/tests/gas32/elf_gas32_got.asm b/modules/objfmts/elf/tests/gas32/elf_gas32_got.asm new file mode 100644 index 00000000..22a60a52 --- /dev/null +++ b/modules/objfmts/elf/tests/gas32/elf_gas32_got.asm @@ -0,0 +1,13 @@ +.text + +.extern a + +.globl tst +tst: + call L1 +L1: + pop %eax + add $_GLOBAL_OFFSET_TABLE_+(.-L1), %eax + mov (a@GOT)(%eax), %eax + movl $5, (%eax) + ret diff --git a/modules/objfmts/elf/tests/gas32/elf_gas32_got.hex b/modules/objfmts/elf/tests/gas32/elf_gas32_got.hex new file mode 100644 index 00000000..c7060e62 --- /dev/null +++ b/modules/objfmts/elf/tests/gas32/elf_gas32_got.hex @@ -0,0 +1,544 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +30 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +06 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +e8 +00 +00 +00 +00 +58 +05 +02 +00 +00 +00 +8b +80 +00 +00 +00 +00 +c7 +00 +05 +00 +00 +00 +c3 +07 +00 +00 +00 +0a +06 +00 +00 +0d +00 +00 +00 +03 +04 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +2d +00 +61 +00 +74 +73 +74 +00 +5f +47 +4c +4f +42 +41 +4c +5f +4f +46 +46 +53 +45 +54 +5f +54 +41 +42 +4c +45 +5f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +05 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +05 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +04 +00 +09 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +21 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +68 +00 +00 +00 +2b +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +11 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +94 +00 +00 +00 +1f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +19 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b4 +00 +00 +00 +70 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +09 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +58 +00 +00 +00 +10 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm b/modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm new file mode 100644 index 00000000..9bd042d0 --- /dev/null +++ b/modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm @@ -0,0 +1,14 @@ +.text +foo: +movl %eax, foo@PLT +movl %eax, foo@GOTOFF +#movl %eax, foo@GOTPC +movl %eax, bar@TLSGD +movl %eax, bar@TLSLDM +movl %eax, bar@GOTTPOFF +movl %eax, bar@TPOFF +movl %eax, bar@NTPOFF +movl %eax, bar@DTPOFF +movl %eax, bar@GOTNTPOFF +movl %eax, bar@INDNTPOFF +movl %eax, foo@GOT diff --git a/modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex b/modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex new file mode 100644 index 00000000..61057e2f --- /dev/null +++ b/modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex @@ -0,0 +1,592 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +06 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +a3 +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +02 +00 +00 +06 +00 +00 +00 +09 +03 +00 +00 +0b +00 +00 +00 +12 +04 +00 +00 +10 +00 +00 +00 +13 +04 +00 +00 +15 +00 +00 +00 +21 +04 +00 +00 +1a +00 +00 +00 +22 +04 +00 +00 +1f +00 +00 +00 +11 +04 +00 +00 +24 +00 +00 +00 +20 +04 +00 +00 +29 +00 +00 +00 +10 +04 +00 +00 +2e +00 +00 +00 +0f +04 +00 +00 +33 +00 +00 +00 +03 +02 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +2d +00 +62 +61 +72 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +16 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +21 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +d0 +00 +00 +00 +2b +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +11 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +fc +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +19 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +01 +00 +00 +50 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +37 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +09 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +78 +00 +00 +00 +58 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gas32/elf_gas32_test.sh b/modules/objfmts/elf/tests/gas32/elf_gas32_test.sh new file mode 100755 index 00000000..4d346911 --- /dev/null +++ b/modules/objfmts/elf/tests/gas32/elf_gas32_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh elf_gas32_test modules/objfmts/elf/tests/gas32 "GAS elf-x86 objfmt" "-f elf32 -p gas" ".o" +exit $? diff --git a/modules/objfmts/elf/tests/gas64/Makefile.inc b/modules/objfmts/elf/tests/gas64/Makefile.inc index 9be81625..382744d1 100644 --- a/modules/objfmts/elf/tests/gas64/Makefile.inc +++ b/modules/objfmts/elf/tests/gas64/Makefile.inc @@ -1,5 +1,3 @@ -# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $ - TESTS += modules/objfmts/elf/tests/gas64/elf_gas64_test.sh EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_test.sh @@ -9,3 +7,5 @@ EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex +EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm +EXTRA_DIST += modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex diff --git a/modules/objfmts/elf/tests/gas64/crosssect.hex b/modules/objfmts/elf/tests/gas64/crosssect.hex index 4e15f937..dd95c79d 100644 --- a/modules/objfmts/elf/tests/gas64/crosssect.hex +++ b/modules/objfmts/elf/tests/gas64/crosssect.hex @@ -774,7 +774,7 @@ e4 00 00 00 -00 +02 00 00 00 diff --git a/modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex b/modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex index f1a2befa..80e25a8f 100644 --- a/modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex +++ b/modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex @@ -870,7 +870,7 @@ c0 00 00 00 -00 +06 00 00 00 @@ -1126,7 +1126,7 @@ b4 00 00 00 -00 +03 00 00 00 diff --git a/modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm b/modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm new file mode 100644 index 00000000..b7203f62 --- /dev/null +++ b/modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm @@ -0,0 +1,10 @@ +.text +foo: +movl %eax, foo@PLT +movl %eax, foo@GOTPCREL +movl %eax, bar@TLSGD +movl %eax, bar@TLSLD +movl %eax, bar@GOTTPOFF +movl %eax, bar@TPOFF +movl %eax, bar@DTPOFF +movl %eax, foo@GOT diff --git a/modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex b/modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex new file mode 100644 index 00000000..06e4c138 --- /dev/null +++ b/modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex @@ -0,0 +1,880 @@ +7f +45 +4c +46 +02 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +f0 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +40 +00 +06 +00 +01 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +00 +00 +00 +00 +09 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +11 +00 +00 +00 +00 +00 +00 +00 +13 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +14 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1f +00 +00 +00 +00 +00 +00 +00 +16 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +26 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +15 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +62 +61 +72 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +16 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +38 +01 +00 +00 +00 +00 +00 +00 +2c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +64 +01 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +01 +00 +00 +00 +00 +00 +00 +78 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +00 +00 +00 +00 +38 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +78 +00 +00 +00 +00 +00 +00 +00 +c0 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gas64/elf_gas64_test.sh b/modules/objfmts/elf/tests/gas64/elf_gas64_test.sh index de90bc13..6696ba7e 100755 --- a/modules/objfmts/elf/tests/gas64/elf_gas64_test.sh +++ b/modules/objfmts/elf/tests/gas64/elf_gas64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id: elf_amd64_test.sh 1137 2004-09-04 01:24:57Z peter $ ${srcdir}/out_test.sh elf_gas64_test modules/objfmts/elf/tests/gas64 "GAS elf-amd64 objfmt" "-f elf64 -p gas" ".o" exit $? diff --git a/modules/objfmts/elf/tests/gasx32/Makefile.inc b/modules/objfmts/elf/tests/gasx32/Makefile.inc new file mode 100644 index 00000000..6bba8bd6 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/Makefile.inc @@ -0,0 +1,11 @@ +TESTS += modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh + +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/crosssect.asm +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/crosssect.hex +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm +EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex diff --git a/modules/objfmts/elf/tests/gasx32/crosssect.asm b/modules/objfmts/elf/tests/gasx32/crosssect.asm new file mode 100644 index 00000000..41999791 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/crosssect.asm @@ -0,0 +1,18 @@ +.section .rodata + .align 4 +_sys_srt: + .long 0 + +.text + .align 4,0x90 + .long _sys_srt-. + .long _sys_srt-_sys_info + #.long _sys_info-_sys_srt + #.long -(_sys_srt-_sys_info) + .long _sys_info-. + .long .-_sys_info + .long (_sys_srt-.)+(.-_sys_info) # GAS cannot handle this but we can + .long 0 + .long 65558 +_sys_info: + .long 0 diff --git a/modules/objfmts/elf/tests/gasx32/crosssect.hex b/modules/objfmts/elf/tests/gasx32/crosssect.hex new file mode 100644 index 00000000..35893c4e --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/crosssect.hex @@ -0,0 +1,568 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +07 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +14 +00 +00 +00 +f0 +ff +ff +ff +00 +00 +00 +00 +00 +00 +00 +00 +16 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +04 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +02 +04 +00 +00 +e8 +ff +ff +ff +10 +00 +00 +00 +02 +04 +00 +00 +f4 +ff +ff +ff +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +72 +6f +64 +61 +74 +61 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +1c +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2a +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +88 +00 +00 +00 +34 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1a +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +bc +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c0 +00 +00 +00 +60 +00 +00 +00 +02 +00 +00 +00 +06 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +20 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +24 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +84 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm new file mode 100644 index 00000000..60a893b3 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm @@ -0,0 +1,27 @@ +.globl bar +.globl foo + +.section .bar +bar: +.4byte foo-. +.4byte baz-. +call foo +call baz +foo: + +.section .data +baz: +.4byte foo-. +#.4byte .-foo # illegal +.4byte baz-. +.4byte .-baz +.4byte foo+4-. # with constant +.4byte .-baz+foo+4-. # both local and cross-segment (legal) +#.4byte baz+foo+4-.-. # ditto, slightly different - GAS gets confused on this +#.4byte (bar-.)+(foo-.) # illegal (too many cross-segment) +.4byte baz-.+baz-. # two from same segment + +.section .text +movl $5, foo-. +movl $(foo-.), %eax +call foo diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex new file mode 100644 index 00000000..45cb217f --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex @@ -0,0 +1,848 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c0 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +0a +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c7 +04 +25 +00 +00 +00 +00 +05 +00 +00 +00 +b8 +00 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +02 +07 +00 +00 +03 +00 +00 +00 +0c +00 +00 +00 +02 +07 +00 +00 +01 +00 +00 +00 +11 +00 +00 +00 +02 +07 +00 +00 +fc +ff +ff +ff +12 +00 +00 +00 +00 +00 +00 +00 +e8 +05 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +02 +02 +00 +00 +00 +00 +00 +00 +0e +00 +00 +00 +02 +02 +00 +00 +fc +ff +ff +ff +00 +00 +00 +00 +fc +ff +ff +ff +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +d8 +ff +ff +ff +00 +00 +00 +00 +02 +07 +00 +00 +00 +00 +00 +00 +0c +00 +00 +00 +02 +07 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +02 +07 +00 +00 +14 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +62 +61 +72 +00 +2e +64 +61 +74 +61 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +62 +61 +72 +00 +2e +72 +65 +6c +61 +2e +64 +61 +74 +61 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +62 +61 +72 +00 +66 +6f +6f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +06 +00 +07 +00 +00 +00 +12 +00 +00 +00 +00 +00 +00 +00 +10 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +42 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +e4 +00 +00 +00 +4c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +30 +01 +00 +00 +0b +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +3a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +3c +01 +00 +00 +80 +00 +00 +00 +02 +00 +00 +00 +06 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +15 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +58 +00 +00 +00 +24 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +7c +00 +00 +00 +12 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +1d +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +90 +00 +00 +00 +18 +00 +00 +00 +03 +00 +00 +00 +06 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +0c +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +a8 +00 +00 +00 +18 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +27 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c0 +00 +00 +00 +24 +00 +00 +00 +03 +00 +00 +00 +08 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm new file mode 100644 index 00000000..e015ce4b --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm @@ -0,0 +1,37 @@ +.comm _ZEROVAR, 32, 16 +.comm _VAR, 16, 16 +.data +.org 0 +_ZEROVAR: +.org 0xa0 +.globl _VAR +.type _VAR, @object +.size _VAR, 16 +_VAR: +.4byte 0 +.4byte 0 +.4byte 0 +.4byte 0 +.org 0xc0 +_VAR2: +.org 0xe0 +.globl _VAR3 +_VAR3: + +.text +movq $0, %rax +movq _VAR, %rax +movq %rax, _VAR(%rip) +movq _VAR+8(%rip), %rcx +movlpd _VAR(%rip), %xmm1 + +movq _VAR2, %rax +movq %rax, _VAR2(%rip) +movq _VAR2+8(%rip), %rcx +movlpd _VAR2(%rip), %xmm1 + +movq _VAR3, %rax +movq %rax, _VAR3(%rip) +movq _VAR3+8(%rip), %rcx +movlpd _VAR3(%rip), %xmm1 + diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex new file mode 100644 index 00000000..1b46fa18 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex @@ -0,0 +1,1016 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +e0 +02 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +07 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +c7 +c0 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +89 +05 +00 +00 +00 +00 +48 +8b +0d +00 +00 +00 +00 +66 +0f +12 +0d +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +89 +05 +00 +00 +00 +00 +48 +8b +0d +00 +00 +00 +00 +66 +0f +12 +0d +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +89 +05 +00 +00 +00 +00 +48 +8b +0d +00 +00 +00 +00 +66 +0f +12 +0d +00 +00 +00 +00 +00 +00 +00 +0b +00 +00 +00 +0a +06 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +02 +06 +00 +00 +fc +ff +ff +ff +19 +00 +00 +00 +02 +06 +00 +00 +04 +00 +00 +00 +21 +00 +00 +00 +02 +06 +00 +00 +fc +ff +ff +ff +29 +00 +00 +00 +0a +03 +00 +00 +c0 +00 +00 +00 +30 +00 +00 +00 +02 +03 +00 +00 +bc +00 +00 +00 +37 +00 +00 +00 +02 +03 +00 +00 +c4 +00 +00 +00 +3f +00 +00 +00 +02 +03 +00 +00 +bc +00 +00 +00 +47 +00 +00 +00 +0a +07 +00 +00 +00 +00 +00 +00 +4e +00 +00 +00 +02 +07 +00 +00 +fc +ff +ff +ff +55 +00 +00 +00 +02 +07 +00 +00 +04 +00 +00 +00 +5d +00 +00 +00 +02 +07 +00 +00 +fc +ff +ff +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +64 +61 +74 +61 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +2d +00 +5f +56 +41 +52 +00 +5f +5a +45 +52 +4f +56 +41 +52 +00 +5f +56 +41 +52 +33 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +c0 +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +08 +00 +00 +00 +00 +00 +00 +00 +20 +00 +00 +00 +10 +00 +06 +00 +03 +00 +00 +00 +a0 +00 +00 +00 +10 +00 +00 +00 +11 +00 +06 +00 +11 +00 +00 +00 +e0 +00 +00 +00 +00 +00 +00 +00 +10 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +28 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +14 +02 +00 +00 +32 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +02 +00 +00 +17 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +02 +00 +00 +80 +00 +00 +00 +02 +00 +00 +00 +05 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +0d +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a4 +00 +00 +00 +90 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +34 +01 +00 +00 +e0 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm new file mode 100644 index 00000000..b7203f62 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm @@ -0,0 +1,10 @@ +.text +foo: +movl %eax, foo@PLT +movl %eax, foo@GOTPCREL +movl %eax, bar@TLSGD +movl %eax, bar@TLSLD +movl %eax, bar@GOTTPOFF +movl %eax, bar@TPOFF +movl %eax, bar@DTPOFF +movl %eax, foo@GOT diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex new file mode 100644 index 00000000..cac39900 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex @@ -0,0 +1,592 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +06 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +89 +04 +25 +00 +00 +00 +00 +03 +00 +00 +00 +04 +02 +00 +00 +00 +00 +00 +00 +0a +00 +00 +00 +09 +02 +00 +00 +00 +00 +00 +00 +11 +00 +00 +00 +13 +04 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +14 +04 +00 +00 +00 +00 +00 +00 +1f +00 +00 +00 +16 +04 +00 +00 +00 +00 +00 +00 +26 +00 +00 +00 +17 +04 +00 +00 +00 +00 +00 +00 +2d +00 +00 +00 +15 +04 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +03 +02 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +62 +61 +72 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +16 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +d8 +00 +00 +00 +2c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +01 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0c +01 +00 +00 +50 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +38 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +78 +00 +00 +00 +60 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh b/modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh new file mode 100755 index 00000000..f5372cb5 --- /dev/null +++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh elf_gasx32_test modules/objfmts/elf/tests/gasx32 "GAS elf-x32 objfmt" "-f elfx32 -p gas" ".o" +exit $? diff --git a/modules/objfmts/elf/tests/x32/Makefile.inc b/modules/objfmts/elf/tests/x32/Makefile.inc new file mode 100644 index 00000000..2db20525 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/Makefile.inc @@ -0,0 +1,11 @@ +TESTS += modules/objfmts/elf/tests/x32/elf_x32_test.sh + +EXTRA_DIST += modules/objfmts/elf/tests/x32/elf_x32_test.sh +EXTRA_DIST += modules/objfmts/elf/tests/x32/elf-rip.asm +EXTRA_DIST += modules/objfmts/elf/tests/x32/elf-rip.hex +EXTRA_DIST += modules/objfmts/elf/tests/x32/elfsox32.asm +EXTRA_DIST += modules/objfmts/elf/tests/x32/elfsox32.hex +EXTRA_DIST += modules/objfmts/elf/tests/x32/gotpcrel.asm +EXTRA_DIST += modules/objfmts/elf/tests/x32/gotpcrel.hex +EXTRA_DIST += modules/objfmts/elf/tests/x32/multiplefixup.asm +EXTRA_DIST += modules/objfmts/elf/tests/x32/multiplefixup.hex diff --git a/modules/objfmts/elf/tests/x32/elf-rip.asm b/modules/objfmts/elf/tests/x32/elf-rip.asm new file mode 100644 index 00000000..5f10f096 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/elf-rip.asm @@ -0,0 +1,7 @@ +[bits 64] +[extern sym] +mov eax, [rip] +mov eax, [rip+2] +mov eax, [rip+sym] +mov eax, [sym wrt rip] +call sym diff --git a/modules/objfmts/elf/tests/x32/elf-rip.hex b/modules/objfmts/elf/tests/x32/elf-rip.hex new file mode 100644 index 00000000..be5da687 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/elf-rip.hex @@ -0,0 +1,496 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +06 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +8b +05 +00 +00 +00 +00 +8b +05 +02 +00 +00 +00 +8b +05 +00 +00 +00 +00 +8b +05 +00 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +00 +0e +00 +00 +00 +0a +03 +00 +00 +00 +00 +00 +00 +14 +00 +00 +00 +02 +03 +00 +00 +fc +ff +ff +ff +19 +00 +00 +00 +02 +03 +00 +00 +fc +ff +ff +ff +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +73 +79 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +84 +00 +00 +00 +2c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b0 +00 +00 +00 +07 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b8 +00 +00 +00 +40 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +1d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +24 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 diff --git a/modules/objfmts/elf/tests/x32/elf_x32_test.sh b/modules/objfmts/elf/tests/x32/elf_x32_test.sh new file mode 100755 index 00000000..39618166 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/elf_x32_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh elf_x32_test modules/objfmts/elf/tests/x32 "elf-x32 objfmt" "-f elf -m x32" ".o" +exit $? diff --git a/modules/objfmts/elf/tests/x32/elfsox32.asm b/modules/objfmts/elf/tests/x32/elfsox32.asm new file mode 100644 index 00000000..931c7ffe --- /dev/null +++ b/modules/objfmts/elf/tests/x32/elfsox32.asm @@ -0,0 +1,90 @@ +; This code is UNTESTED, and almost certainly DOES NOT WORK! +; Do NOT use this as an example of how to write AMD64 shared libraries! +; This code is simply to test the AMD64 ELF WRT relocations. + +; This file should test the following: +; [1] Define and export a global text-section symbol +; [2] Define and export a global data-section symbol +; [3] Define and export a global BSS-section symbol +; [4] Define a non-global text-section symbol +; [5] Define a non-global data-section symbol +; [6] Define a non-global BSS-section symbol +; [7] Define a COMMON symbol +; [8] Define a NASM local label +; [9] Reference a NASM local label +; [10] Import an external symbol +; [11] Make a PC-relative call to an external symbol +; [12] Reference a text-section symbol in the text section +; [13] Reference a data-section symbol in the text section +; [14] Reference a BSS-section symbol in the text section +; [15] Reference a text-section symbol in the data section +; [16] Reference a data-section symbol in the data section +; [17] Reference a BSS-section symbol in the data section + + [BITS 64] + [GLOBAL lrotate:function] ; [1] + [GLOBAL greet:function] ; [1] + [GLOBAL asmstr:data asmstr.end-asmstr] ; [2] + [GLOBAL textptr:data 4] ; [2] + [GLOBAL selfptr:data 4] ; [2] + [GLOBAL integer:data 4] ; [3] + [EXTERN printf] ; [10] + [COMMON commvar 4:4] ; [7] + [EXTERN _GLOBAL_OFFSET_TABLE_] + + [SECTION .text] + +; prototype: long lrotate(long x, int num); +lrotate: ; [1] + push rbp + mov rbp,rsp + mov rax,[rbp+8] + mov rcx,[rbp+12] +.label rol rax,1 ; [4] [8] + loop .label ; [9] [12] + mov rsp,rbp + pop rbp + ret + +; prototype: void greet(void); +greet push rbx ; we'll use RBX for GOT, so save it + mov rbx,[integer wrt ..gotpcrel wrt rip] + mov rax,[rbx] ; [14] + inc rax + mov rbx,[_GLOBAL_OFFSET_TABLE_ wrt ..gotpcrel wrt rip] + mov [rbx+localint wrt ..got],eax ; [14] + mov rax,[rbx+commvar wrt ..got] + push qword [rax] + mov rax,[rbx+localptr wrt ..got] ; [13] + push qword [rax] + mov rax,[rbx+integer wrt ..got] ; [1] [14] + push qword [rax] + lea rax,[rbx+printfstr wrt ..got] + push rax ; [13] + call printf wrt ..plt ; [11] + add rsp,16 + pop rbx + ret + + [SECTION .data] + +; a string +asmstr db 'hello, world', 0 ; [2] +.end + +; a string for Printf +printfstr db "integer==%d, localint==%d, commvar=%d" + db 10, 0 + +; some pointers +localptr dd localint ; [5] [17] +textptr dd greet wrt ..sym ; [15] +selfptr dd selfptr wrt ..sym ; [16] + + [SECTION .bss] + +; an integer +integer resd 1 ; [3] + +; a local integer +localint resd 1 ; [6] diff --git a/modules/objfmts/elf/tests/x32/elfsox32.hex b/modules/objfmts/elf/tests/x32/elfsox32.hex new file mode 100644 index 00000000..d423b2de --- /dev/null +++ b/modules/objfmts/elf/tests/x32/elfsox32.hex @@ -0,0 +1,1176 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +30 +03 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +09 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +55 +48 +89 +e5 +48 +8b +45 +08 +48 +8b +4d +0c +48 +d1 +c0 +e2 +fb +48 +89 +ec +5d +c3 +53 +48 +8b +1d +00 +00 +00 +00 +48 +8b +03 +48 +ff +c0 +48 +8b +1d +00 +00 +00 +00 +89 +83 +00 +00 +00 +00 +48 +8b +83 +00 +00 +00 +00 +ff +30 +48 +8b +83 +00 +00 +00 +00 +ff +30 +48 +8b +83 +00 +00 +00 +00 +ff +30 +48 +8d +83 +00 +00 +00 +00 +50 +e8 +00 +00 +00 +00 +48 +83 +c4 +10 +5b +c3 +00 +1a +00 +00 +00 +09 +0f +00 +00 +fc +ff +ff +ff +27 +00 +00 +00 +09 +12 +00 +00 +fc +ff +ff +ff +2d +00 +00 +00 +03 +06 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +03 +11 +00 +00 +00 +00 +00 +00 +3d +00 +00 +00 +03 +05 +00 +00 +00 +00 +00 +00 +46 +00 +00 +00 +03 +0f +00 +00 +00 +00 +00 +00 +4f +00 +00 +00 +03 +04 +00 +00 +00 +00 +00 +00 +55 +00 +00 +00 +04 +10 +00 +00 +fc +ff +ff +ff +68 +65 +6c +6c +6f +2c +20 +77 +6f +72 +6c +64 +00 +69 +6e +74 +65 +67 +65 +72 +3d +3d +25 +64 +2c +20 +6c +6f +63 +61 +6c +69 +6e +74 +3d +3d +25 +64 +2c +20 +63 +6f +6d +6d +76 +61 +72 +3d +25 +64 +0a +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +0a +02 +00 +00 +04 +00 +00 +00 +38 +00 +00 +00 +0a +0b +00 +00 +00 +00 +00 +00 +3c +00 +00 +00 +0a +0e +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +64 +61 +74 +61 +00 +2e +62 +73 +73 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +64 +61 +74 +61 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +2d +00 +6c +72 +6f +74 +61 +74 +65 +00 +67 +72 +65 +65 +74 +00 +61 +73 +6d +73 +74 +72 +00 +74 +65 +78 +74 +70 +74 +72 +00 +73 +65 +6c +66 +70 +74 +72 +00 +69 +6e +74 +65 +67 +65 +72 +00 +70 +72 +69 +6e +74 +66 +00 +63 +6f +6d +6d +76 +61 +72 +00 +5f +47 +4c +4f +42 +41 +4c +5f +4f +46 +46 +53 +45 +54 +5f +54 +41 +42 +4c +45 +5f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +06 +00 +00 +00 +00 +00 +0d +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +08 +00 +00 +00 +00 +00 +0c +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +0d +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +12 +00 +04 +00 +0b +00 +00 +00 +16 +00 +00 +00 +00 +00 +00 +00 +12 +00 +04 +00 +11 +00 +00 +00 +00 +00 +00 +00 +0d +00 +00 +00 +11 +00 +06 +00 +18 +00 +00 +00 +38 +00 +00 +00 +04 +00 +00 +00 +11 +00 +06 +00 +20 +00 +00 +00 +3c +00 +00 +00 +04 +00 +00 +00 +11 +00 +06 +00 +28 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +11 +00 +08 +00 +30 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +37 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +10 +00 +f2 +ff +3f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +38 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +64 +01 +00 +00 +42 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +28 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a8 +01 +00 +00 +55 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +30 +01 +00 +00 +02 +00 +00 +00 +0a +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +5f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a0 +00 +00 +00 +60 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +40 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +1d +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +01 +00 +00 +24 +00 +00 +00 +03 +00 +00 +00 +06 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +0d +00 +00 +00 +08 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/elf/tests/x32/gotpcrel.asm b/modules/objfmts/elf/tests/x32/gotpcrel.asm new file mode 100644 index 00000000..c3d12383 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/gotpcrel.asm @@ -0,0 +1,6 @@ +var: +mov rax, [var wrt ..got] +mov rax, [var wrt ..gotpcrel] ; should be error/warning? +mov rax, [rel var wrt ..got] ; automatic promotion to GOTPCREL +mov rax, [rel var wrt ..gotpcrel] + diff --git a/modules/objfmts/elf/tests/x32/gotpcrel.hex b/modules/objfmts/elf/tests/x32/gotpcrel.hex new file mode 100644 index 00000000..695cf7d6 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/gotpcrel.hex @@ -0,0 +1,496 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +06 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +03 +02 +00 +00 +00 +00 +00 +00 +0c +00 +00 +00 +09 +02 +00 +00 +00 +00 +00 +00 +13 +00 +00 +00 +09 +02 +00 +00 +fc +ff +ff +ff +1a +00 +00 +00 +09 +02 +00 +00 +fc +ff +ff +ff +00 +2e +74 +65 +78 +74 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +90 +00 +00 +00 +2c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +12 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +bc +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1a +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c0 +00 +00 +00 +40 +00 +00 +00 +02 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +1e +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +60 +00 +00 +00 +30 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 diff --git a/modules/objfmts/elf/tests/x32/multiplefixup.asm b/modules/objfmts/elf/tests/x32/multiplefixup.asm new file mode 100644 index 00000000..ec253cbb --- /dev/null +++ b/modules/objfmts/elf/tests/x32/multiplefixup.asm @@ -0,0 +1,8 @@ +[section .data] +foobar: + dq 42 +[section .text] +foo: + times 4 mov rax, [rel foobar] + times 4 mov rax, [foobar] + times 4 jmp foo diff --git a/modules/objfmts/elf/tests/x32/multiplefixup.hex b/modules/objfmts/elf/tests/x32/multiplefixup.hex new file mode 100644 index 00000000..a1874282 --- /dev/null +++ b/modules/objfmts/elf/tests/x32/multiplefixup.hex @@ -0,0 +1,680 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +3e +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +90 +01 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +07 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +48 +8b +04 +25 +00 +00 +00 +00 +eb +c2 +eb +c0 +eb +be +eb +bc +03 +00 +00 +00 +02 +04 +00 +00 +fc +ff +ff +ff +0a +00 +00 +00 +02 +04 +00 +00 +fc +ff +ff +ff +11 +00 +00 +00 +02 +04 +00 +00 +fc +ff +ff +ff +18 +00 +00 +00 +02 +04 +00 +00 +fc +ff +ff +ff +20 +00 +00 +00 +0a +04 +00 +00 +00 +00 +00 +00 +28 +00 +00 +00 +0a +04 +00 +00 +00 +00 +00 +00 +30 +00 +00 +00 +0a +04 +00 +00 +00 +00 +00 +00 +38 +00 +00 +00 +0a +04 +00 +00 +00 +00 +00 +00 +2a +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +64 +61 +74 +61 +00 +2e +72 +65 +6c +61 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +06 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +28 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +ec +00 +00 +00 +32 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +01 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +24 +01 +00 +00 +60 +00 +00 +00 +02 +00 +00 +00 +06 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +44 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +0d +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +84 +00 +00 +00 +60 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +0c +00 +00 +00 +07 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +e4 +00 +00 +00 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/macho/CMakeLists.txt b/modules/objfmts/macho/CMakeLists.txt new file mode 100644 index 00000000..cb5f4934 --- /dev/null +++ b/modules/objfmts/macho/CMakeLists.txt @@ -0,0 +1,5 @@ +YASM_ADD_MODULE(objfmt_macho + objfmts/macho/macho-objfmt.c + ) +list(APPEND YASM_MODULES objfmt_macho32) +list(APPEND YASM_MODULES objfmt_macho64) diff --git a/modules/objfmts/macho/Makefile.inc b/modules/objfmts/macho/Makefile.inc index be9f4bcb..39eff297 100644 --- a/modules/objfmts/macho/Makefile.inc +++ b/modules/objfmts/macho/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/macho/macho-objfmt.c YASM_MODULES += objfmt_macho objfmt_macho32 objfmt_macho64 diff --git a/modules/objfmts/macho/macho-objfmt.c b/modules/objfmts/macho/macho-objfmt.c index ceddbf98..7fec0147 100644 --- a/modules/objfmts/macho/macho-objfmt.c +++ b/modules/objfmts/macho/macho-objfmt.c @@ -88,29 +88,10 @@ Will currently produce an error though the necessary means are provided by the Mach-O specification. - 3) position independend coding (64 Bit) - Mach-O provides the relocation features X86_64_RELOC_GOT_LOAD and - X86_64_RELOC_GOT for C-compatible global offset tables. This IS NOT - implemented yet, sorry. - - 4) symbol naming for global and external symbols - BSD, Windows and MacOS-X use underscores for global symbols, - where ELF/Linux does not. This file contains simple means of adding - underscores to symbols by defining "AUTO_UNDERSCORE" but that - can be considered not more than a hack. For cross-platform coding, - use two symbols for your routines and referenced data. - */ #include -/*@unused@*/ RCSID("$Id$"); -/* optional: automatically prefix underscores to global exported symbols */ -/*#define AUTO_UNDERSCORE*/ - -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include /* MACH-O DEFINES */ @@ -121,6 +102,7 @@ #define MACHO_SYMCMD_SIZE 24 #define MACHO_NLIST_SIZE 12 #define MACHO_RELINFO_SIZE 8 +#define MACHO_BUILDVERSION_SIZE 24 /* 64 bit sizes */ #define MACHO_HEADER64_SIZE 32 @@ -164,7 +146,10 @@ #define LC_SEGMENT 0x1 /* segment load command */ #define LC_SYMTAB 0x2 /* symbol table load command */ #define LC_SEGMENT_64 0x19 /* segment load command */ +#define LC_BUILD_VERSION 0x32 /* build version command */ +/* Values for platform field in build version command */ +#define PLATFORM_MACOS 1 #define VM_PROT_NONE 0x00 #define VM_PROT_READ 0x01 @@ -296,7 +281,6 @@ typedef struct macho_symrec_data { unsigned long index; /* index in output order */ yasm_intnum *value; /* valid after writing symtable to file */ unsigned long length; /* length + 1 (plus auto underscore) */ - int add_uscore; /* add underscore (0/1) */ } macho_symrec_data; @@ -305,6 +289,11 @@ typedef struct yasm_objfmt_macho { long parse_scnum; /* sect numbering in parser */ int bits; /* 32 / 64 */ + + yasm_symrec *gotpcrel_sym; /* ..gotpcrel */ + + unsigned long minos; /* minimum os version */ + unsigned long sdk; /* sdk version */ } yasm_objfmt_macho; @@ -371,13 +360,21 @@ macho_objfmt_create_common(yasm_object *object, yasm_objfmt_module *module, /* Support x86 and amd64 machines of x86 arch */ if (yasm__strcasecmp(yasm_arch_get_machine(object->arch), "x86") == 0 && - (bits_pref == 0 || bits_pref == 32)) + (bits_pref == 0 || bits_pref == 32)) { objfmt_macho->bits = 32; - else if (yasm__strcasecmp(yasm_arch_get_machine(object->arch), + objfmt_macho->gotpcrel_sym = NULL; + objfmt_macho->minos = 0x000a0400; /* min OS version: 10.4 */ + objfmt_macho->sdk = 0x000a0400; /* SDK version: 10.4 */ + } else if (yasm__strcasecmp(yasm_arch_get_machine(object->arch), "amd64") == 0 && - (bits_pref == 0 || bits_pref == 64)) + (bits_pref == 0 || bits_pref == 64)) { objfmt_macho->bits = 64; - else { + /* FIXME: misuse of NULL bytecode */ + objfmt_macho->gotpcrel_sym = + yasm_symtab_define_label(object->symtab, "..gotpcrel", NULL, 0, 0); + objfmt_macho->minos = 0x000a0500; /* min OS version: 10.5 */ + objfmt_macho->sdk = 0x000a0500; /* SDK version: 10.5 */ + } else { yasm_xfree(objfmt_macho); return NULL; } @@ -499,9 +496,13 @@ macho_objfmt_output_value(yasm_value *value, unsigned char *buf, return 1; } - if (value->wrt) { + if (value->curpos_rel && objfmt_macho->gotpcrel_sym && + value->wrt == objfmt_macho->gotpcrel_sym) { + reloc->type = X86_64_RELOC_GOT; + value->wrt = NULL; + } else if (value->wrt) { yasm_error_set(YASM_ERROR_TOO_COMPLEX, - N_("macho: WRT not supported")); + N_("macho: invalid WRT")); yasm_xfree(reloc); return 1; } @@ -516,7 +517,11 @@ macho_objfmt_output_value(yasm_value *value, unsigned char *buf, } else { /* Add in the offset plus value size to end up with 0. */ intn_plus = offset+destsize; - if (value->jump_target) + if (reloc->type == X86_64_RELOC_GOT) { + /* XXX: This is a hack */ + if (offset >= 2 && buf[-2] == 0x8B) + reloc->type = X86_64_RELOC_GOT_LOAD; + } else if (value->jump_target) reloc->type = X86_64_RELOC_BRANCH; else reloc->type = X86_64_RELOC_SIGNED; @@ -537,7 +542,7 @@ macho_objfmt_output_value(yasm_value *value, unsigned char *buf, if ((vis & YASM_SYM_EXTERN) || (vis & YASM_SYM_COMMON)) { reloc->ext = 1; info->msd->extreloc = 1; /* section has external relocations */ - } else if (!value->curpos_rel && !info->is_64) { + } else if (!info->is_64) { /*@dependent@*/ /*@null@*/ yasm_bytecode *sym_precbc; /* Local symbols need valued to their actual address */ @@ -736,12 +741,10 @@ static int macho_objfmt_output_secthead(yasm_section *sect, /*@null@*/ void *d) { /*@null@*/ macho_objfmt_output_info *info = (macho_objfmt_output_info *)d; - yasm_objfmt_macho *objfmt_macho; /*@dependent@*/ /*@null@*/ macho_section_data *msd; unsigned char *localbuf; assert(info != NULL); - objfmt_macho = info->objfmt_macho; msd = yasm_section_get_data(sect, &macho_section_data_cb); assert(msd != NULL); @@ -802,7 +805,7 @@ static int macho_objfmt_count_sym(yasm_symrec *sym, /*@null@*/ void *d) { /*@null@*/ macho_objfmt_output_info *info = (macho_objfmt_output_info *)d; - const char *name; + /*@only@*/ char *name; yasm_sym_vis vis = yasm_symrec_get_visibility(sym); assert(info != NULL); @@ -819,19 +822,13 @@ macho_objfmt_count_sym(yasm_symrec *sym, /*@null@*/ void *d) sym_data->index = info->symindex; info->symindex++; - name = yasm_symrec_get_name(sym); /*printf("%s\n",name); */ - sym_data->add_uscore = 0; -#ifdef AUTO_UNDERSCORE - if (vis & (YASM_SYM_EXTERN | YASM_SYM_COMMON | YASM_SYM_GLOBAL)) { - if (name[0] != '_') - sym_data->add_uscore = 1; - } -#endif + name = yasm_symrec_get_global_name(sym, info->object); + /*printf("%s\n",name); */ /* name length + delimiter */ - sym_data->length = - (unsigned long)strlen(name) + sym_data->add_uscore + 1; + sym_data->length = (unsigned long)strlen(name) + 1; info->strlength += sym_data->length; info->indx++; + yasm_xfree(name); } } return 0; @@ -933,7 +930,26 @@ macho_objfmt_output_symtable(yasm_symrec *sym, /*@null@*/ void *d) } /*printf("common symbol %s val %lu\n", name, yasm_intnum_get_uint(val));*/ } else if (vis & YASM_SYM_GLOBAL) { - n_type |= N_EXT; + yasm_valparamhead *valparams = + yasm_symrec_get_objext_valparams(sym); + + struct macho_global_data { + unsigned long flag; /* N_PEXT */ + } data; + + data.flag = 0; + + if (valparams) { + static const yasm_dir_help help[] = { + { "private_extern", 0, yasm_dir_helper_flag_set, + offsetof(struct macho_global_data, flag), N_PEXT }, + }; + yasm_dir_helper(sym, yasm_vps_first(valparams), + yasm_symrec_get_decl_line(sym), help, NELEMS(help), + &data, yasm_dir_helper_valparam_warn); + } + + n_type |= N_EXT | data.flag; } localbuf = info->buf; @@ -963,21 +979,18 @@ macho_objfmt_output_str(yasm_symrec *sym, /*@null@*/ void *d) { /*@null@*/ macho_objfmt_output_info *info = (macho_objfmt_output_info *)d; yasm_sym_vis vis = yasm_symrec_get_visibility(sym); - /*@null@*/ macho_symrec_data *xsymd; - assert(info != NULL); if (info->all_syms || vis & (YASM_SYM_GLOBAL | YASM_SYM_COMMON | YASM_SYM_EXTERN)) { if (0 == macho_objfmt_is_section_label(sym)) { - const char *name = yasm_symrec_get_name(sym); + /*@only@*/ char *name = + yasm_symrec_get_global_name(sym, info->object); size_t len = strlen(name); - xsymd = yasm_symrec_get_data(sym, &macho_symrec_data_cb); - if (xsymd->add_uscore) - fputc('_', info->f); fwrite(name, len + 1, 1, info->f); + yasm_xfree(name); } } return 0; @@ -989,6 +1002,7 @@ macho_objfmt_calc_sectsize(yasm_section *sect, /*@null@ */ void *d) /*@null@ */ macho_objfmt_output_info *info = (macho_objfmt_output_info *) d; /*@dependent@ *//*@null@ */ macho_section_data *msd; + unsigned long align; assert(info != NULL); msd = yasm_section_get_data(sect, &macho_section_data_cb); @@ -1005,6 +1019,16 @@ macho_objfmt_calc_sectsize(yasm_section *sect, /*@null@ */ void *d) msd->vmoff = info->vmsize; info->vmsize += msd->size; + /* align both start and end of section */ + align = yasm_section_get_align(sect); + if (align != 0) { + unsigned long delta = msd->vmoff % align; + if (delta > 0) { + msd->vmoff += align - delta; + info->vmsize += align - delta; + } + } + return 0; } @@ -1019,7 +1043,7 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms, unsigned long symtab_count = 0; unsigned long headsize; unsigned int macho_segcmdsize, macho_sectcmdsize, macho_nlistsize; - unsigned int macho_relinfosize, macho_segcmd; + unsigned int macho_segcmd; unsigned int head_ncmds, head_sizeofcmds; unsigned long fileoffset, fileoff_sections; yasm_intnum *val; @@ -1049,23 +1073,21 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms, headsize = MACHO_HEADER64_SIZE + MACHO_SEGCMD64_SIZE + (MACHO_SECTCMD64_SIZE * (objfmt_macho->parse_scnum)) + - MACHO_SYMCMD_SIZE; + MACHO_SYMCMD_SIZE + MACHO_BUILDVERSION_SIZE; macho_segcmd = LC_SEGMENT_64; macho_segcmdsize = MACHO_SEGCMD64_SIZE; macho_sectcmdsize = MACHO_SECTCMD64_SIZE; macho_nlistsize = MACHO_NLIST64_SIZE; - macho_relinfosize = MACHO_RELINFO64_SIZE; long_int_bytes = 8; } else { headsize = MACHO_HEADER_SIZE + MACHO_SEGCMD_SIZE + (MACHO_SECTCMD_SIZE * (objfmt_macho->parse_scnum)) + - MACHO_SYMCMD_SIZE; + MACHO_SYMCMD_SIZE + MACHO_BUILDVERSION_SIZE; macho_segcmd = LC_SEGMENT; macho_segcmdsize = MACHO_SEGCMD_SIZE; macho_sectcmdsize = MACHO_SECTCMD_SIZE; macho_nlistsize = MACHO_NLIST_SIZE; - macho_relinfosize = MACHO_RELINFO_SIZE; long_int_bytes = 4; } @@ -1121,8 +1143,8 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms, YASM_WRITE_32_L(localbuf, MH_OBJECT); /* MACH file type */ /* calculate number of commands and their size, put to stream */ - head_ncmds = 0; - head_sizeofcmds = 0; + head_ncmds = 1; + head_sizeofcmds = MACHO_BUILDVERSION_SIZE; if (objfmt_macho->parse_scnum > 0) { head_ncmds++; head_sizeofcmds += @@ -1144,6 +1166,14 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms, fileoffset = MACHO_HEADER_SIZE + head_sizeofcmds; } + /* --------------- write build version command ---------------- */ + YASM_WRITE_32_L(localbuf, LC_BUILD_VERSION); + YASM_WRITE_32_L(localbuf, MACHO_BUILDVERSION_SIZE); + YASM_WRITE_32_L(localbuf, PLATFORM_MACOS); + YASM_WRITE_32_L(localbuf, objfmt_macho->minos); + YASM_WRITE_32_L(localbuf, objfmt_macho->sdk); + YASM_WRITE_32_L(localbuf, 0); /* number of tools */ + /* --------------- write segment header command ---------------- */ YASM_WRITE_32_L(localbuf, macho_segcmd); /* command LC_SEGMENT */ /* size of load command including section load commands */ @@ -1188,7 +1218,7 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms, /* next: section headers */ /* offset to relocs for first section */ - info.rel_base = align32((long)fileoffset + (long)info.filesize); + info.rel_base = align32((long)fileoff_sections); info.s_reloff = 0; /* offset for relocs of following sections */ yasm_object_sections_traverse(object, &info, macho_objfmt_output_secthead); @@ -1217,8 +1247,8 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms, } /* padding to long boundary */ - if (info.rel_base - (fileoffset + info.filesize)) { - fwrite(pad_data, info.rel_base - (fileoffset + info.filesize), 1, f); + if ((info.rel_base - fileoff_sections) > 0) { + fwrite(pad_data, info.rel_base - fileoff_sections, 1, f); } /* relocation data */ @@ -1242,10 +1272,11 @@ macho_objfmt_destroy(yasm_objfmt *objfmt) yasm_xfree(objfmt); } -static macho_section_data * -macho_objfmt_init_new_section(yasm_object *object, yasm_section *sect, - const char *sectname, unsigned long line) +static void +macho_objfmt_init_new_section(yasm_section *sect, unsigned long line) { + yasm_object *object = yasm_section_get_object(sect); + const char *sectname = yasm_section_get_name(sect); yasm_objfmt_macho *objfmt_macho = (yasm_objfmt_macho *)object->objfmt; macho_section_data *data; yasm_symrec *sym; @@ -1265,7 +1296,6 @@ macho_objfmt_init_new_section(yasm_object *object, yasm_section *sect, sym = yasm_symtab_define_label(object->symtab, sectname, yasm_section_bcs_first(sect), 1, line); data->sym = sym; - return data; } static yasm_section * @@ -1275,10 +1305,29 @@ macho_objfmt_add_default_section(yasm_object *object) macho_section_data *msd; int isnew; - retval = yasm_object_get_general(object, "LC_SEGMENT.__TEXT.__text", 0, 0, 1, 0, - &isnew, 0); + /* Create a dummy __asm marker section with a single zero byte. This tells + * the Apple toolchain that the code came from assembler and has no bitcode. + */ + retval = yasm_object_get_general(object, ".llvmasm", 0, 0, 0, &isnew, 0); if (isnew) { - msd = macho_objfmt_init_new_section(object, retval, ".text", 0); + yasm_datavalhead dvs; + + msd = yasm_section_get_data(retval, &macho_section_data_cb); + msd->segname = yasm__xstrdup("__LLVM"); + msd->sectname = yasm__xstrdup("__asm"); + yasm_section_set_align(retval, 0, 0); + yasm_dvs_initialize(&dvs); + yasm_dvs_append(&dvs, yasm_dv_create_expr( + yasm_expr_create_ident( + yasm_expr_int(yasm_intnum_create_uint(0)), 0))); + yasm_section_bcs_append(retval, + yasm_bc_create_data(&dvs, 1, 0, object->arch, 0)); + } + + retval = yasm_object_get_general(object, "LC_SEGMENT.__TEXT.__text", 0, 1, + 0, &isnew, 0); + if (isnew) { + msd = yasm_section_get_data(retval, &macho_section_data_cb); msd->segname = yasm__xstrdup("__TEXT"); msd->sectname = yasm__xstrdup("__text"); msd->flags = S_ATTR_PURE_INSTRUCTIONS; @@ -1335,6 +1384,7 @@ macho_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, {".const_data", "__DATA", "__const", S_REGULAR, 0}, {".rodata", "__DATA", "__const", S_REGULAR, 0}, {".bss", "__DATA", "__bss", S_ZEROFILL, 0}, + {".llvmasm", "__LLVM", "__asm", S_REGULAR, 0}, {".objc_class_names", "__TEXT", "__cstring", S_CSTRING_LITERALS, 0}, {".objc_meth_var_types","__TEXT", "__cstring", S_CSTRING_LITERALS, 0}, {".objc_meth_var_names","__TEXT", "__cstring", S_CSTRING_LITERALS, 0}, @@ -1467,14 +1517,11 @@ macho_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, realname = yasm_xmalloc(strlen("LC_SEGMENT") + 1 + strlen(data.f_segname) + 1 + strlen(f_sectname) + 1); sprintf(realname, "LC_SEGMENT.%s.%s", data.f_segname, f_sectname); - retval = yasm_object_get_general(object, realname, 0, align, 1, resonly, + retval = yasm_object_get_general(object, realname, align, 1, resonly, &isnew, line); yasm_xfree(realname); - if (isnew) - msd = macho_objfmt_init_new_section(object, retval, sectname, line); - else - msd = yasm_section_get_data(retval, &macho_section_data_cb); + msd = yasm_section_get_data(retval, &macho_section_data_cb); if (isnew || yasm_section_is_default(retval)) { yasm_section_set_default(retval, 0); @@ -1482,12 +1529,27 @@ macho_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, msd->sectname = f_sectname; msd->flags = flags; yasm_section_set_align(retval, align, line); - } else if (flags_override) - yasm_warn_set(YASM_WARN_GENERAL, - N_("section flags ignored on section redeclaration")); + } else if (flags_override) { + /* align is the only value used from overrides. */ + if (yasm_section_get_align(retval) != align) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("section flags ignored on section redeclaration")); + } + } return retval; } +static /*@observer@*/ /*@null@*/ yasm_symrec * +macho_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + yasm_objfmt_macho *objfmt_macho = (yasm_objfmt_macho *)object->objfmt; + if (yasm__strcasecmp(name, "gotpcrel") == 0) { + return objfmt_macho->gotpcrel_sym; + } + return NULL; +} + static void macho_section_data_destroy(void *data) { @@ -1531,6 +1593,54 @@ macho_symrec_data_print(void *data, FILE *f, int indent_level) fprintf(f, "nil\n"); } +static void +parse_version(unsigned long *out, const yasm_valparam *vp) +{ + unsigned long major, minor, subminor; + int m; + + if (vp->type != YASM_PARAM_STRING) { + yasm_error_set(YASM_ERROR_VALUE, + N_("argument to `%s' is not a string"), vp->val); + return; + } + + subminor = 0; + m = sscanf(vp->param.str, "%lu.%lu.%lu", &major, &minor, &subminor); + if (m < 2) { + yasm_error_set(YASM_ERROR_VALUE, + N_("argument to `%s' must be `MAJOR.MINOR[.SUBMINOR]`"), + vp->val); + return; + } + + *out = ((major & 0xffff) << 16) | ((minor & 0xff) << 8) | (subminor & 0xff); +} + +static void +dir_buildversion(yasm_object *object, yasm_valparamhead *valparams, + yasm_valparamhead *objext_valparams, unsigned long line) +{ + yasm_objfmt_macho *objfmt_macho = (yasm_objfmt_macho *)object->objfmt; + yasm_valparam *vp; + + /* Accept, but do nothing with empty ident */ + if (!valparams) + return; + + vp = yasm_vps_first(valparams); + while (vp) { + if (vp->val && yasm__strcasecmp(vp->val, "minos") == 0) { + parse_version(&objfmt_macho->minos, vp); + } else if (vp->val && yasm__strcasecmp(vp->val, "sdk") == 0) { + parse_version(&objfmt_macho->sdk, vp); + } else { + yasm_dir_helper_valparam_warn(object, vp, line, NULL); + } + vp = yasm_vps_next(vp); + } +} + /* Define valid debug formats to use with this object format */ static const char *macho_objfmt_dbgfmt_keywords[] = { @@ -1538,20 +1648,30 @@ static const char *macho_objfmt_dbgfmt_keywords[] = { NULL }; +static const yasm_directive macho_objfmt_directives[] = { + { ".buildversion", "gas", dir_buildversion, YASM_DIR_ANY }, + { "buildversion", "nasm", dir_buildversion, YASM_DIR_ANY }, + { NULL, NULL, NULL, 0 } +}; + /* Define objfmt structure -- see objfmt.h for details */ yasm_objfmt_module yasm_macho_LTX_objfmt = { "Mac OS X ABI Mach-O File Format", "macho", "o", 32, + 0, macho_objfmt_dbgfmt_keywords, "null", - NULL, /* no directives */ + macho_objfmt_directives, + NULL, /* no standard macros */ macho_objfmt_create, macho_objfmt_output, macho_objfmt_destroy, macho_objfmt_add_default_section, - macho_objfmt_section_switch + macho_objfmt_init_new_section, + macho_objfmt_section_switch, + macho_objfmt_get_special_sym }; yasm_objfmt_module yasm_macho32_LTX_objfmt = { @@ -1559,14 +1679,18 @@ yasm_objfmt_module yasm_macho32_LTX_objfmt = { "macho32", "o", 32, + 0, macho_objfmt_dbgfmt_keywords, "null", - NULL, /* no directives */ + macho_objfmt_directives, + NULL, /* no standard macros */ macho32_objfmt_create, macho_objfmt_output, macho_objfmt_destroy, macho_objfmt_add_default_section, - macho_objfmt_section_switch + macho_objfmt_init_new_section, + macho_objfmt_section_switch, + macho_objfmt_get_special_sym }; yasm_objfmt_module yasm_macho64_LTX_objfmt = { @@ -1574,12 +1698,16 @@ yasm_objfmt_module yasm_macho64_LTX_objfmt = { "macho64", "o", 64, + 0, macho_objfmt_dbgfmt_keywords, "null", - NULL, /* no directives */ + macho_objfmt_directives, + NULL, /* no standard macros */ macho64_objfmt_create, macho_objfmt_output, macho_objfmt_destroy, macho_objfmt_add_default_section, - macho_objfmt_section_switch + macho_objfmt_init_new_section, + macho_objfmt_section_switch, + macho_objfmt_get_special_sym }; diff --git a/modules/objfmts/macho/tests/Makefile.inc b/modules/objfmts/macho/tests/Makefile.inc index bff27f5b..e8b4dc1f 100644 --- a/modules/objfmts/macho/tests/Makefile.inc +++ b/modules/objfmts/macho/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += modules/objfmts/macho/tests/gas32/Makefile.inc EXTRA_DIST += modules/objfmts/macho/tests/gas64/Makefile.inc EXTRA_DIST += modules/objfmts/macho/tests/nasm32/Makefile.inc diff --git a/modules/objfmts/macho/tests/gas32/Makefile.inc b/modules/objfmts/macho/tests/gas32/Makefile.inc index ac36c09c..a02b3b3e 100644 --- a/modules/objfmts/macho/tests/gas32/Makefile.inc +++ b/modules/objfmts/macho/tests/gas32/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/macho/tests/gas32/gas_macho32_test.sh EXTRA_DIST += modules/objfmts/macho/tests/gas32/gas_macho32_test.sh diff --git a/modules/objfmts/macho/tests/gas32/gas-macho32.hex b/modules/objfmts/macho/tests/gas32/gas-macho32.hex index 72cdabde..ba0d6c4d 100644 --- a/modules/objfmts/macho/tests/gas32/gas-macho32.hex +++ b/modules/objfmts/macho/tests/gas32/gas-macho32.hex @@ -14,11 +14,11 @@ fe 00 00 00 -02 +03 00 00 00 -1c +78 01 00 00 @@ -26,11 +26,35 @@ fe 00 00 00 +32 +00 +00 +00 +18 +00 +00 +00 01 00 00 00 +00 04 +0a +00 +00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +48 01 00 00 @@ -54,15 +78,15 @@ fe 00 00 00 -89 +8a 00 00 00 -38 +94 01 00 00 -81 +82 00 00 00 @@ -74,7 +98,75 @@ fe 00 00 00 -03 +04 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +94 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 00 00 00 @@ -114,7 +206,7 @@ fe 00 00 00 -00 +01 00 00 00 @@ -122,7 +214,7 @@ fe 00 00 00 -38 +95 01 00 00 @@ -130,8 +222,8 @@ fe 00 00 00 -bc -01 +18 +02 00 00 07 @@ -182,7 +274,7 @@ bc 00 00 00 -41 +42 00 00 00 @@ -190,7 +282,7 @@ bc 00 00 00 -79 +d6 01 00 00 @@ -198,8 +290,8 @@ bc 00 00 00 -f4 -01 +50 +02 00 00 03 @@ -250,7 +342,7 @@ f4 00 00 00 -81 +82 00 00 00 @@ -294,7 +386,7 @@ f4 00 00 00 -0c +68 02 00 00 @@ -302,7 +394,7 @@ f4 00 00 00 -6c +c8 02 00 00 @@ -310,6 +402,7 @@ f4 00 00 00 +00 55 89 e5 @@ -328,13 +421,13 @@ ec 5d c3 a1 -81 +82 00 00 00 40 a3 -85 +86 00 00 00 @@ -345,7 +438,7 @@ ff 00 00 a1 -75 +76 00 00 00 @@ -353,13 +446,13 @@ ff 30 ff 35 -81 +82 00 00 00 ff 35 -4e +4f 00 00 00 @@ -427,16 +520,15 @@ c3 64 0a 00 -85 +86 00 00 00 -11 +12 00 00 00 -7d -00 +7e 00 00 00 @@ -446,7 +538,7 @@ c3 00 00 00 -03 +04 00 00 04 @@ -454,7 +546,7 @@ c3 00 00 00 -03 +04 00 00 04 @@ -470,7 +562,7 @@ c3 00 00 00 -02 +03 00 00 04 @@ -478,7 +570,7 @@ c3 00 00 00 -03 +04 00 00 04 @@ -486,7 +578,7 @@ c3 00 00 00 -02 +03 00 00 04 @@ -502,7 +594,7 @@ c3 00 00 00 -03 +04 00 00 04 @@ -510,7 +602,7 @@ c3 00 00 00 -01 +02 00 00 04 @@ -518,7 +610,7 @@ c3 00 00 00 -02 +03 00 00 04 @@ -527,22 +619,22 @@ c3 00 00 0f +02 +00 +00 01 00 00 00 -00 -00 -00 0a 00 00 00 0f -01 +02 00 00 -11 +12 00 00 00 @@ -551,10 +643,10 @@ c3 00 00 0f -02 +03 00 00 -41 +42 00 00 00 @@ -563,10 +655,10 @@ c3 00 00 0f -02 +03 00 00 -79 +7a 00 00 00 @@ -575,10 +667,10 @@ c3 00 00 0f -02 +03 00 00 -7d +7e 00 00 00 @@ -587,10 +679,10 @@ c3 00 00 0f -03 +04 00 00 -81 +82 00 00 00 diff --git a/modules/objfmts/macho/tests/gas32/gas_macho32_test.sh b/modules/objfmts/macho/tests/gas32/gas_macho32_test.sh index 48f871d4..45a1e104 100755 --- a/modules/objfmts/macho/tests/gas32/gas_macho32_test.sh +++ b/modules/objfmts/macho/tests/gas32/gas_macho32_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh macho_test modules/objfmts/macho/tests/gas32 "GAS 32-bit macho objfmt" "-f macho32 -p gas" ".o" exit $? diff --git a/modules/objfmts/macho/tests/gas64/Makefile.inc b/modules/objfmts/macho/tests/gas64/Makefile.inc index 79d85edc..ec99a219 100644 --- a/modules/objfmts/macho/tests/gas64/Makefile.inc +++ b/modules/objfmts/macho/tests/gas64/Makefile.inc @@ -1,7 +1,7 @@ -# $Id$ - TESTS += modules/objfmts/macho/tests/gas64/gas_macho64_test.sh EXTRA_DIST += modules/objfmts/macho/tests/gas64/gas_macho64_test.sh EXTRA_DIST += modules/objfmts/macho/tests/gas64/gas-macho64.asm EXTRA_DIST += modules/objfmts/macho/tests/gas64/gas-macho64.hex +EXTRA_DIST += modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm +EXTRA_DIST += modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex diff --git a/modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm b/modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm new file mode 100644 index 00000000..c44502b3 --- /dev/null +++ b/modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm @@ -0,0 +1,32 @@ +call _foo +# r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# E8 00 00 00 00 + +call _foo+4 +# r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# E8 04 00 00 00 + +movq _foo@GOTPCREL(%rip), %rax +# r_type=X86_64_RELOC_GOT_LOAD, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# 48 8B 05 00 00 00 00 + +pushq _foo@GOTPCREL(%rip) +# r_type=X86_64_RELOC_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# FF 35 00 00 00 00 + +movl _foo(%rip), %eax +# r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# 8B 05 00 00 00 00 + +movl _foo+4(%rip), %eax +# r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# 8B 05 04 00 00 00 + +movb $0x12, _foo(%rip) +# r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# C6 05 FF FF FF FF 12 + +movl $0x12345678, _foo(%rip) +# r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +# C7 05 FC FF FF FF 78 56 34 12 + diff --git a/modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex b/modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex new file mode 100644 index 00000000..f84e075b --- /dev/null +++ b/modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex @@ -0,0 +1,454 @@ +cf +fa +ed +fe +07 +00 +00 +01 +03 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +18 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +05 +0a +00 +00 +05 +0a +00 +00 +00 +00 +00 +19 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +35 +00 +00 +00 +00 +00 +00 +00 +38 +01 +00 +00 +00 +00 +00 +00 +35 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +38 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +54 +45 +58 +54 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +00 +00 +39 +01 +00 +00 +00 +00 +00 +00 +70 +01 +00 +00 +08 +00 +00 +00 +00 +03 +00 +80 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +18 +00 +00 +00 +b0 +01 +00 +00 +01 +00 +00 +00 +c0 +01 +00 +00 +06 +00 +00 +00 +00 +e8 +00 +00 +00 +00 +e8 +04 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +ff +35 +00 +00 +00 +00 +8b +05 +00 +00 +00 +00 +8b +05 +04 +00 +00 +00 +c6 +05 +ff +ff +ff +ff +12 +c7 +05 +fc +ff +ff +ff +78 +56 +34 +12 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +2d +06 +00 +00 +00 +00 +00 +00 +2d +0d +00 +00 +00 +00 +00 +00 +3d +13 +00 +00 +00 +00 +00 +00 +4d +19 +00 +00 +00 +00 +00 +00 +1d +1f +00 +00 +00 +00 +00 +00 +1d +25 +00 +00 +00 +00 +00 +00 +1d +2c +00 +00 +00 +00 +00 +00 +1d +01 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +66 +6f +6f +00 diff --git a/modules/objfmts/macho/tests/gas64/gas-macho64.hex b/modules/objfmts/macho/tests/gas64/gas-macho64.hex index e4fa4882..6e281529 100644 --- a/modules/objfmts/macho/tests/gas64/gas-macho64.hex +++ b/modules/objfmts/macho/tests/gas64/gas-macho64.hex @@ -14,18 +14,42 @@ fe 00 00 00 -02 +03 00 00 00 +68 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 00 01 00 00 00 00 +05 +0a 00 00 +05 +0a +00 00 00 00 @@ -34,43 +58,7 @@ fe 00 00 00 -e8 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -c5 -00 -00 -00 -00 -00 -00 -00 -20 +38 01 00 00 @@ -78,7 +66,43 @@ c5 00 00 00 -c5 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +c6 +00 +00 +00 +00 +00 +00 +00 +88 +01 +00 +00 +00 +00 +00 +00 +c6 00 00 00 @@ -94,7 +118,87 @@ c5 00 00 00 -02 +03 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +88 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 00 00 00 @@ -134,7 +238,7 @@ c5 00 00 00 -00 +01 00 00 00 @@ -150,7 +254,7 @@ c5 00 00 00 -20 +89 01 00 00 @@ -158,8 +262,8 @@ c5 00 00 00 -e8 -01 +50 +02 00 00 0c @@ -214,7 +318,7 @@ e8 00 00 00 -5d +5e 00 00 00 @@ -230,7 +334,7 @@ e8 00 00 00 -7d +e6 01 00 00 @@ -270,7 +374,7 @@ e8 00 00 00 -48 +b0 02 00 00 @@ -278,7 +382,7 @@ e8 00 00 00 -88 +f0 02 00 00 @@ -286,6 +390,7 @@ e8 00 00 00 +00 e8 00 00 @@ -485,7 +590,6 @@ ff 00 00 00 -00 01 00 00 @@ -603,10 +707,10 @@ ff 00 00 0e -02 +03 00 00 -c5 +c6 00 00 00 @@ -619,10 +723,10 @@ c5 00 00 0e -02 +03 00 00 -b3 +b4 00 00 00 @@ -635,10 +739,10 @@ b3 00 00 0e -02 +03 00 00 -b3 +b4 00 00 00 diff --git a/modules/objfmts/macho/tests/gas64/gas_macho64_test.sh b/modules/objfmts/macho/tests/gas64/gas_macho64_test.sh index 577bf83f..d3ead46c 100755 --- a/modules/objfmts/macho/tests/gas64/gas_macho64_test.sh +++ b/modules/objfmts/macho/tests/gas64/gas_macho64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh macho_test modules/objfmts/macho/tests/gas64 "GAS 64-bit macho objfmt" "-f macho64 -p gas" ".o" exit $? diff --git a/modules/objfmts/macho/tests/nasm32/Makefile.inc b/modules/objfmts/macho/tests/nasm32/Makefile.inc index 1ee18be1..2bba5de7 100644 --- a/modules/objfmts/macho/tests/nasm32/Makefile.inc +++ b/modules/objfmts/macho/tests/nasm32/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/macho/tests/nasm32/macho32_test.sh EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32_test.sh @@ -8,6 +6,12 @@ EXTRA_DIST += modules/objfmts/macho/tests/nasm32/machotest.asm EXTRA_DIST += modules/objfmts/macho/tests/nasm32/machotest.hex EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho-reloc.asm EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho-reloc.hex +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pext.asm +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pext.hex +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pic.asm +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pic.hex EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-sect.asm EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-sect.hex +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-size.asm +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-size.hex diff --git a/modules/objfmts/macho/tests/nasm32/macho-reloc.hex b/modules/objfmts/macho/tests/nasm32/macho-reloc.hex index 7ef6e8a1..8dc58940 100644 --- a/modules/objfmts/macho/tests/nasm32/macho-reloc.hex +++ b/modules/objfmts/macho/tests/nasm32/macho-reloc.hex @@ -14,11 +14,127 @@ fe 00 00 00 -02 +03 +00 +00 +00 +34 +01 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +04 +0a +00 +00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2c +00 +00 +00 +50 +01 +00 +00 +2c +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 00 00 00 -d8 00 00 00 @@ -30,7 +146,8 @@ d8 00 00 00 -c0 +50 +01 00 00 00 @@ -54,31 +171,6 @@ c0 00 00 00 -2b -00 -00 -00 -f4 -00 -00 -00 -2b -00 -00 -00 -07 -00 -00 -00 -07 -00 -00 -00 -02 -00 -00 -00 -00 00 00 00 @@ -114,7 +206,7 @@ f4 00 00 00 -00 +01 00 00 00 @@ -122,15 +214,15 @@ f4 00 00 00 -f4 +51 +01 00 00 00 00 00 00 -00 -20 +7c 01 00 00 @@ -182,7 +274,7 @@ f4 00 00 00 -28 +29 00 00 00 @@ -190,7 +282,7 @@ f4 00 00 00 -1c +79 01 00 00 @@ -226,7 +318,7 @@ f4 00 00 00 -58 +b4 01 00 00 @@ -234,7 +326,7 @@ f4 00 00 00 -7c +d8 01 00 00 @@ -242,6 +334,7 @@ f4 00 00 00 +00 b8 02 00 @@ -263,17 +356,17 @@ a1 00 00 b8 -00 -00 -00 -00 -b8 -19 +01 00 00 00 b8 -22 +1a +00 +00 +00 +b8 +23 00 00 00 @@ -285,7 +378,6 @@ b8 05 05 00 -00 01 00 00 @@ -322,7 +414,7 @@ b8 00 00 00 -01 +02 00 00 04 @@ -330,7 +422,7 @@ b8 00 00 00 -01 +02 00 00 04 @@ -338,7 +430,7 @@ b8 00 00 00 -01 +02 00 00 04 @@ -347,10 +439,10 @@ b8 00 00 0f -02 +03 00 00 -29 +2a 00 00 00 diff --git a/modules/objfmts/macho/tests/nasm32/macho32-pext.asm b/modules/objfmts/macho/tests/nasm32/macho32-pext.asm new file mode 100644 index 00000000..f881b4fc --- /dev/null +++ b/modules/objfmts/macho/tests/nasm32/macho32-pext.asm @@ -0,0 +1,4 @@ +[GLOBAL function:private_extern] + +function: + ret diff --git a/modules/objfmts/macho/tests/nasm32/macho32-pext.hex b/modules/objfmts/macho/tests/nasm32/macho32-pext.hex new file mode 100644 index 00000000..c57c549a --- /dev/null +++ b/modules/objfmts/macho/tests/nasm32/macho32-pext.hex @@ -0,0 +1,294 @@ +ce +fa +ed +fe +07 +00 +00 +00 +03 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +f0 +00 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +04 +0a +00 +00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +c0 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +0c +01 +00 +00 +02 +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +0c +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +54 +45 +58 +54 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +0d +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +80 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +18 +00 +00 +00 +10 +01 +00 +00 +01 +00 +00 +00 +1c +01 +00 +00 +0a +00 +00 +00 +00 +c3 +00 +00 +01 +00 +00 +00 +1f +02 +00 +00 +01 +00 +00 +00 +00 +66 +75 +6e +63 +74 +69 +6f +6e +00 diff --git a/modules/objfmts/macho/tests/nasm32/macho32-pic.asm b/modules/objfmts/macho/tests/nasm32/macho32-pic.asm new file mode 100644 index 00000000..438923d1 --- /dev/null +++ b/modules/objfmts/macho/tests/nasm32/macho32-pic.asm @@ -0,0 +1,46 @@ +; At present, nasm doesn't seem to support PIC generation for Mach-O. +; The PIC support code below is a little tricky. +[extern func] + SECTION .rodata +const_base: + +%define GOTOFF(got,sym) (got) + (sym) - const_base + +%imacro get_GOT 1 + ; NOTE: this macro destroys ecx resister. + call %%geteip + add ecx, byte (%%ref - $) + jmp short %%adjust +%%geteip: + mov ecx, [esp] + ret +%%adjust: + push ebp + xor ebp,ebp ; ebp = 0 +%ifidni %1,ebx ; (%1 == ebx) + ; db 0x8D,0x9C + jmp near const_base = + ; lea ebx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,9C,E9,(offset32) + db 0x8D,0x9C ; 8D,9C + jmp near const_base ; E9,(const_base-%%ref) +%%ref: +%else ; (%1 != ebx) + ; db 0x8D,0x8C + jmp near const_base = + ; lea ecx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,8C,E9,(offset32) + db 0x8D,0x8C ; 8D,8C + jmp strict near const_base ; E9,(const_base-%%ref) +%%ref: mov %1, ecx +%endif ; (%1 == ebx) + pop ebp +%endmacro + +SECTION .text + +jmp const_base + +get_GOT ebx + +jmp const_base + +call func + +ret diff --git a/modules/objfmts/macho/tests/nasm32/macho32-pic.hex b/modules/objfmts/macho/tests/nasm32/macho32-pic.hex new file mode 100644 index 00000000..9b92e0bf --- /dev/null +++ b/modules/objfmts/macho/tests/nasm32/macho32-pic.hex @@ -0,0 +1,430 @@ +ce +fa +ed +fe +07 +00 +00 +00 +03 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +34 +01 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +04 +0a +00 +00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2a +00 +00 +00 +50 +01 +00 +00 +2a +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +50 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +54 +45 +58 +54 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +29 +00 +00 +00 +51 +01 +00 +00 +00 +00 +00 +00 +7c +01 +00 +00 +04 +00 +00 +00 +00 +03 +00 +80 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +63 +6f +6e +73 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +44 +41 +54 +41 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2a +00 +00 +00 +00 +00 +00 +00 +7a +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +18 +00 +00 +00 +9c +01 +00 +00 +01 +00 +00 +00 +a8 +01 +00 +00 +06 +00 +00 +00 +00 +e9 +25 +00 +00 +00 +e8 +05 +00 +00 +00 +83 +c1 +13 +eb +04 +8b +0c +24 +c3 +55 +31 +ed +8d +9c +e9 +0d +00 +00 +00 +5d +e9 +07 +00 +00 +00 +e8 +d8 +ff +ff +ff +c3 +00 +00 +01 +00 +00 +00 +03 +00 +00 +05 +19 +00 +00 +00 +03 +00 +00 +05 +1f +00 +00 +00 +03 +00 +00 +05 +24 +00 +00 +00 +00 +00 +00 +0d +01 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +66 +75 +6e +63 +00 diff --git a/modules/objfmts/macho/tests/nasm32/macho32-sect.hex b/modules/objfmts/macho/tests/nasm32/macho32-sect.hex index eff781a5..d4e35f01 100644 --- a/modules/objfmts/macho/tests/nasm32/macho32-sect.hex +++ b/modules/objfmts/macho/tests/nasm32/macho32-sect.hex @@ -14,15 +14,23 @@ fe 00 00 00 -01 -00 -00 -00 -e0 02 00 00 00 +3c +03 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 00 00 00 @@ -30,53 +38,137 @@ e0 00 00 00 -e0 -02 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -fc -02 -00 -00 -00 -00 -00 -00 -07 -00 -00 -00 -07 -00 -00 00 +04 0a 00 00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +24 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +58 +03 +00 +00 +01 +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +0b +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +70 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 00 00 00 @@ -114,6 +206,7 @@ fc 00 00 00 +01 00 00 00 @@ -121,8 +214,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -182,6 +274,7 @@ fc 00 00 00 +01 00 00 00 @@ -189,8 +282,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -250,6 +342,7 @@ fc 00 00 00 +01 00 00 00 @@ -257,8 +350,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -318,6 +410,7 @@ fc 00 00 00 +01 00 00 00 @@ -325,8 +418,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -386,6 +478,7 @@ fc 00 00 00 +01 00 00 00 @@ -393,8 +486,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -454,6 +546,7 @@ fc 00 00 00 +01 00 00 00 @@ -461,8 +554,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -522,6 +614,7 @@ fc 00 00 00 +01 00 00 00 @@ -529,8 +622,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -590,6 +682,7 @@ fc 45 47 4e +01 00 00 00 @@ -597,8 +690,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -658,6 +750,7 @@ fc 00 00 00 +01 00 00 00 @@ -665,8 +758,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -726,6 +818,7 @@ fc 53 45 47 +01 00 00 00 @@ -733,8 +826,7 @@ fc 00 00 00 -00 -14 +71 03 00 00 @@ -770,16 +862,16 @@ fc 00 00 00 -fc -02 +74 +03 00 00 00 00 00 00 -fc -02 +74 +03 00 00 01 @@ -787,3 +879,7 @@ fc 00 00 00 +00 +00 +00 +00 diff --git a/modules/objfmts/macho/tests/nasm32/macho32-size.asm b/modules/objfmts/macho/tests/nasm32/macho32-size.asm new file mode 100644 index 00000000..f8cd50fa --- /dev/null +++ b/modules/objfmts/macho/tests/nasm32/macho32-size.asm @@ -0,0 +1,60 @@ + section .data align=16 + + align 16 + + mmx_yuy2_00ff dw 000ffh, 000ffh, 000ffh, 000ffh + + section .text + +; -- Import/Export ------------------------------------------------------ + + global mb_yuy2yuv_mmx + + struc macroblock_yuy2_param + .dsty: resd 1 + .dstu: resd 1 + .dstv: resd 1 + .dypitch: resd 1 + .dcpitch: resd 1 + .src: resd 1 + .spitch: resd 1 + endstruc + +; ----------------------------------------------------------------------- +; -= mb_yuy2yuv_mmx =- +; +; extern "C" int __fastcall mb_yuy2yuv_mmx( macroblock_param *param ); +; ----------------------------------------------------------------------- + + align 16 + +mb_yuy2yuv_mmx: + + push ebx + push edx + + push esi + push edi + push ebp + + mov esi, [ecx + macroblock_yuy2_param.src] + mov edx, [ecx + macroblock_yuy2_param.spitch] + + mov edi, [ecx + macroblock_yuy2_param.dsty] + mov eax, [ecx + macroblock_yuy2_param.dstu] + mov ebx, [ecx + macroblock_yuy2_param.dstv] + + mov ebp, [ecx + macroblock_yuy2_param.dypitch] + mov ecx, [ecx + macroblock_yuy2_param.dcpitch] + + movq mm6, [mmx_yuy2_00ff] + + pop ebp + pop edi + pop esi + + pop edx + pop ebx + + retn + diff --git a/modules/objfmts/macho/tests/nasm32/macho32-size.hex b/modules/objfmts/macho/tests/nasm32/macho32-size.hex new file mode 100644 index 00000000..3ae12b81 --- /dev/null +++ b/modules/objfmts/macho/tests/nasm32/macho32-size.hex @@ -0,0 +1,420 @@ +ce +fa +ed +fe +07 +00 +00 +00 +03 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +34 +01 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +04 +0a +00 +00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +04 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +48 +00 +00 +00 +50 +01 +00 +00 +2f +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +50 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +54 +45 +58 +54 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +26 +00 +00 +00 +51 +01 +00 +00 +04 +00 +00 +00 +80 +01 +00 +00 +01 +00 +00 +00 +00 +01 +00 +80 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +44 +41 +54 +41 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +08 +00 +00 +00 +77 +01 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +18 +00 +00 +00 +88 +01 +00 +00 +01 +00 +00 +00 +94 +01 +00 +00 +10 +00 +00 +00 +00 +53 +52 +56 +57 +55 +8b +71 +14 +8b +51 +18 +8b +39 +8b +41 +04 +8b +59 +08 +8b +69 +0c +8b +49 +10 +0f +6f +35 +40 +00 +00 +00 +5d +5f +5e +5a +5b +c3 +ff +00 +ff +00 +ff +00 +ff +00 +00 +1c +00 +00 +00 +03 +00 +00 +04 +01 +00 +00 +00 +0f +02 +00 +00 +10 +00 +00 +00 +00 +6d +62 +5f +79 +75 +79 +32 +79 +75 +76 +5f +6d +6d +78 +00 diff --git a/modules/objfmts/macho/tests/nasm32/macho32_test.sh b/modules/objfmts/macho/tests/nasm32/macho32_test.sh index 64d9c4a3..e5fdcc95 100755 --- a/modules/objfmts/macho/tests/nasm32/macho32_test.sh +++ b/modules/objfmts/macho/tests/nasm32/macho32_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh macho_test modules/objfmts/macho/tests/nasm32 "32-bit macho objfmt" "-f macho32" ".o" exit $? diff --git a/modules/objfmts/macho/tests/nasm32/machotest.hex b/modules/objfmts/macho/tests/nasm32/machotest.hex index e6791e4e..e4c5442a 100644 --- a/modules/objfmts/macho/tests/nasm32/machotest.hex +++ b/modules/objfmts/macho/tests/nasm32/machotest.hex @@ -14,11 +14,11 @@ fe 00 00 00 -02 +03 00 00 00 -1c +78 01 00 00 @@ -26,11 +26,35 @@ fe 00 00 00 +32 +00 +00 +00 +18 +00 +00 +00 01 00 00 00 +00 04 +0a +00 +00 +04 +0a +00 +00 +00 +00 +00 +01 +00 +00 +00 +48 01 00 00 @@ -54,15 +78,15 @@ fe 00 00 00 -8f +90 00 00 00 -38 +94 01 00 00 -87 +88 00 00 00 @@ -74,7 +98,75 @@ fe 00 00 00 -03 +04 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +94 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 00 00 00 @@ -114,7 +206,7 @@ fe 00 00 00 -00 +01 00 00 00 @@ -122,7 +214,7 @@ fe 00 00 00 -38 +95 01 00 00 @@ -130,8 +222,8 @@ fe 00 00 00 -c0 -01 +1c +02 00 00 07 @@ -182,7 +274,7 @@ c0 00 00 00 -47 +48 00 00 00 @@ -190,7 +282,7 @@ c0 00 00 00 -7f +dc 01 00 00 @@ -198,8 +290,8 @@ c0 00 00 00 -f8 -01 +54 +02 00 00 03 @@ -250,7 +342,7 @@ f8 00 00 00 -87 +88 00 00 00 @@ -294,7 +386,7 @@ f8 00 00 00 -10 +6c 02 00 00 @@ -302,7 +394,7 @@ f8 00 00 00 -70 +cc 02 00 00 @@ -310,6 +402,7 @@ f8 00 00 00 +00 55 89 e5 @@ -328,13 +421,13 @@ ec 5d c3 a1 -87 +88 00 00 00 40 a3 -8b +8c 00 00 00 @@ -345,7 +438,7 @@ ff 00 00 a1 -7b +7c 00 00 00 @@ -353,12 +446,12 @@ ff 30 ff 35 -87 +88 00 00 00 68 -54 +55 00 00 00 @@ -433,16 +526,7 @@ ff 64 0a 00 -8b -00 -00 -00 -11 -00 -00 -00 -83 -00 +8c 00 00 00 @@ -450,7 +534,15 @@ ff 00 00 00 -03 +84 +00 +00 +00 +12 +00 +00 +00 +04 00 00 04 @@ -458,7 +550,7 @@ ff 00 00 00 -03 +04 00 00 04 @@ -474,7 +566,7 @@ ff 00 00 00 -02 +03 00 00 04 @@ -482,7 +574,7 @@ ff 00 00 00 -03 +04 00 00 04 @@ -490,7 +582,7 @@ ff 00 00 00 -02 +03 00 00 04 @@ -506,7 +598,7 @@ ff 00 00 00 -03 +04 00 00 04 @@ -514,7 +606,7 @@ ff 00 00 00 -01 +02 00 00 04 @@ -522,7 +614,7 @@ ff 00 00 00 -02 +03 00 00 04 @@ -531,22 +623,22 @@ ff 00 00 0f +02 +00 +00 01 00 00 00 -00 -00 -00 0a 00 00 00 0f -01 +02 00 00 -11 +12 00 00 00 @@ -555,10 +647,10 @@ ff 00 00 0f -02 +03 00 00 -47 +48 00 00 00 @@ -567,10 +659,10 @@ ff 00 00 0f -02 +03 00 00 -7f +80 00 00 00 @@ -579,10 +671,10 @@ ff 00 00 0f -02 +03 00 00 -83 +84 00 00 00 @@ -591,10 +683,10 @@ ff 00 00 0f -03 +04 00 00 -87 +88 00 00 00 diff --git a/modules/objfmts/macho/tests/nasm64/Makefile.inc b/modules/objfmts/macho/tests/nasm64/Makefile.inc index efe5de4d..93ec45e9 100644 --- a/modules/objfmts/macho/tests/nasm64/Makefile.inc +++ b/modules/objfmts/macho/tests/nasm64/Makefile.inc @@ -1,7 +1,7 @@ -# $Id$ - TESTS += modules/objfmts/macho/tests/nasm64/macho64_test.sh +EXTRA_DIST += modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm +EXTRA_DIST += modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex EXTRA_DIST += modules/objfmts/macho/tests/nasm64/macho64_test.sh EXTRA_DIST += modules/objfmts/macho/tests/nasm64/machotest64.c EXTRA_DIST += modules/objfmts/macho/tests/nasm64/machotest64.asm diff --git a/modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn b/modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn index 3d4e5d97..1a118833 100644 --- a/modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn +++ b/modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn @@ -1,8 +1,8 @@ --:20: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:21: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:23: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:24: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:25: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:26: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:27: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. --:29: macho: WRT not supported +-:20: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:21: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:23: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:24: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:25: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:26: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:27: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers. +-:29: error: macho: invalid WRT diff --git a/modules/objfmts/macho/tests/nasm64/macho64-buildversion.asm b/modules/objfmts/macho/tests/nasm64/macho64-buildversion.asm new file mode 100644 index 00000000..a277f7c4 --- /dev/null +++ b/modules/objfmts/macho/tests/nasm64/macho64-buildversion.asm @@ -0,0 +1,2 @@ +[buildversion minos="10.14.2" sdk="10.7"] + diff --git a/modules/objfmts/macho/tests/nasm64/macho64-buildversion.hex b/modules/objfmts/macho/tests/nasm64/macho64-buildversion.hex new file mode 100644 index 00000000..c8ed6de9 --- /dev/null +++ b/modules/objfmts/macho/tests/nasm64/macho64-buildversion.hex @@ -0,0 +1,317 @@ +cf +fa +ed +fe +07 +00 +00 +01 +03 +00 +00 +00 +01 +00 +00 +00 +02 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +02 +0e +0a +00 +00 +07 +0a +00 +00 +00 +00 +00 +19 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +20 +01 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +38 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +54 +45 +58 +54 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +39 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +80 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +18 +00 +00 +00 +3c +01 +00 +00 +00 +00 +00 +00 +3c +01 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/objfmts/macho/tests/nasm64/macho64_test.sh b/modules/objfmts/macho/tests/nasm64/macho64_test.sh index 30e23248..f7c0bfbb 100755 --- a/modules/objfmts/macho/tests/nasm64/macho64_test.sh +++ b/modules/objfmts/macho/tests/nasm64/macho64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh macho_test modules/objfmts/macho/tests/nasm64 "64-bit macho objfmt" "-f macho64" ".o" exit $? diff --git a/modules/objfmts/macho/tests/nasm64/machotest64.hex b/modules/objfmts/macho/tests/nasm64/machotest64.hex index 21395186..e8b38768 100644 --- a/modules/objfmts/macho/tests/nasm64/machotest64.hex +++ b/modules/objfmts/macho/tests/nasm64/machotest64.hex @@ -14,11 +14,11 @@ fe 00 00 00 -02 +03 00 00 00 -50 +b8 01 00 00 @@ -30,11 +30,35 @@ fe 00 00 00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +05 +0a +00 +00 +05 +0a +00 +00 +00 +00 +00 19 00 00 00 -38 +88 01 00 00 @@ -62,7 +86,7 @@ fe 00 00 00 -d6 +d7 00 00 00 @@ -70,7 +94,7 @@ d6 00 00 00 -70 +d8 01 00 00 @@ -78,7 +102,7 @@ d6 00 00 00 -c6 +c7 00 00 00 @@ -94,7 +118,87 @@ c6 00 00 00 -03 +04 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +d8 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 00 00 00 @@ -134,7 +238,7 @@ c6 00 00 00 -00 +01 00 00 00 @@ -150,7 +254,7 @@ c6 00 00 00 -70 +d9 01 00 00 @@ -158,7 +262,7 @@ c6 00 00 00 -38 +a0 02 00 00 @@ -214,7 +318,7 @@ c6 00 00 00 -7a +7b 00 00 00 @@ -230,15 +334,15 @@ c6 00 00 00 -ea -01 +53 +02 00 00 00 00 00 00 -88 +f0 02 00 00 @@ -294,7 +398,7 @@ ea 00 00 00 -c6 +c7 00 00 00 @@ -350,15 +454,15 @@ c6 00 00 00 -a0 -02 +08 +03 00 00 0f 00 00 00 -90 +f8 03 00 00 @@ -366,6 +470,7 @@ a0 00 00 00 +00 51 48 89 @@ -565,7 +670,6 @@ ff 64 00 00 -00 10 00 00 @@ -675,6 +779,9 @@ ff 00 00 0f +02 +00 +00 01 00 00 @@ -683,18 +790,15 @@ ff 00 00 00 -00 -00 -00 0a 00 00 00 0f -01 +02 00 00 -2f +30 00 00 00 @@ -707,10 +811,10 @@ ff 00 00 0f -02 +03 00 00 -b9 +ba 00 00 00 @@ -723,10 +827,10 @@ b9 00 00 0f -02 +03 00 00 -a9 +aa 00 00 00 @@ -739,10 +843,10 @@ a9 00 00 0f -02 +03 00 00 -b1 +b2 00 00 00 @@ -755,10 +859,10 @@ b1 00 00 0f -03 +04 00 00 -c6 +c7 00 00 00 @@ -803,10 +907,10 @@ c6 00 00 0f -01 +02 00 00 -0e +0f 00 00 00 @@ -819,10 +923,10 @@ c6 00 00 0f -01 +02 00 00 -19 +1a 00 00 00 @@ -835,10 +939,10 @@ c6 00 00 0e -01 +02 00 00 -07 +08 00 00 00 @@ -851,10 +955,10 @@ c6 00 00 0e -03 +04 00 00 -ce +cf 00 00 00 @@ -867,10 +971,10 @@ ce 00 00 0e -01 +02 00 00 -24 +25 00 00 00 @@ -883,10 +987,10 @@ ce 00 00 0e -02 +03 00 00 -a1 +a2 00 00 00 @@ -899,10 +1003,10 @@ a1 00 00 0e -02 +03 00 00 -7a +7b 00 00 00 diff --git a/modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm b/modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm new file mode 100644 index 00000000..7b46163e --- /dev/null +++ b/modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm @@ -0,0 +1,34 @@ +[extern _foo] + +call _foo +; r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; E8 00 00 00 00 + +call _foo+4 +; r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; E8 04 00 00 00 + +mov rax, [rel _foo wrt ..gotpcrel] +; r_type=X86_64_RELOC_GOT_LOAD, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; 48 8B 05 00 00 00 00 + +push qword [rel _foo wrt ..gotpcrel] +; r_type=X86_64_RELOC_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; FF 35 00 00 00 00 + +mov eax, [rel _foo] +; r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; 8B 05 00 00 00 00 + +mov eax, [rel _foo+4] +; r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; 8B 05 04 00 00 00 + +mov [rel _foo], byte 12h +; r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; C6 05 FF FF FF FF 12 + +mov dword [rel _foo], 0x12345678 +; r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo +; C7 05 FC FF FF FF 78 56 34 12 + diff --git a/modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex b/modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex new file mode 100644 index 00000000..f84e075b --- /dev/null +++ b/modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex @@ -0,0 +1,454 @@ +cf +fa +ed +fe +07 +00 +00 +01 +03 +00 +00 +00 +01 +00 +00 +00 +03 +00 +00 +00 +18 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +32 +00 +00 +00 +18 +00 +00 +00 +01 +00 +00 +00 +00 +05 +0a +00 +00 +05 +0a +00 +00 +00 +00 +00 +19 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +35 +00 +00 +00 +00 +00 +00 +00 +38 +01 +00 +00 +00 +00 +00 +00 +35 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +07 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +5f +5f +61 +73 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +4c +4c +56 +4d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +38 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +5f +54 +45 +58 +54 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +00 +00 +39 +01 +00 +00 +00 +00 +00 +00 +70 +01 +00 +00 +08 +00 +00 +00 +00 +03 +00 +80 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +18 +00 +00 +00 +b0 +01 +00 +00 +01 +00 +00 +00 +c0 +01 +00 +00 +06 +00 +00 +00 +00 +e8 +00 +00 +00 +00 +e8 +04 +00 +00 +00 +48 +8b +05 +00 +00 +00 +00 +ff +35 +00 +00 +00 +00 +8b +05 +00 +00 +00 +00 +8b +05 +04 +00 +00 +00 +c6 +05 +ff +ff +ff +ff +12 +c7 +05 +fc +ff +ff +ff +78 +56 +34 +12 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +2d +06 +00 +00 +00 +00 +00 +00 +2d +0d +00 +00 +00 +00 +00 +00 +3d +13 +00 +00 +00 +00 +00 +00 +4d +19 +00 +00 +00 +00 +00 +00 +1d +1f +00 +00 +00 +00 +00 +00 +1d +25 +00 +00 +00 +00 +00 +00 +1d +2c +00 +00 +00 +00 +00 +00 +1d +01 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +66 +6f +6f +00 diff --git a/modules/objfmts/rdf/CMakeLists.txt b/modules/objfmts/rdf/CMakeLists.txt new file mode 100644 index 00000000..6cf9157d --- /dev/null +++ b/modules/objfmts/rdf/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(objfmt_rdf + objfmts/rdf/rdf-objfmt.c + ) diff --git a/modules/objfmts/rdf/Makefile.inc b/modules/objfmts/rdf/Makefile.inc index ef33dffb..f5e01e15 100644 --- a/modules/objfmts/rdf/Makefile.inc +++ b/modules/objfmts/rdf/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/rdf/rdf-objfmt.c YASM_MODULES += objfmt_rdf diff --git a/modules/objfmts/rdf/rdf-objfmt.c b/modules/objfmts/rdf/rdf-objfmt.c index 124f2560..eb3c6668 100644 --- a/modules/objfmts/rdf/rdf-objfmt.c +++ b/modules/objfmts/rdf/rdf-objfmt.c @@ -25,11 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include @@ -187,7 +183,6 @@ rdf_objfmt_output_value(yasm_value *value, unsigned char *buf, yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ rdf_objfmt_output_info *info = (rdf_objfmt_output_info *)d; - yasm_objfmt_rdf *objfmt_rdf; /*@dependent@*/ /*@null@*/ yasm_intnum *intn; unsigned long intn_minus; unsigned long intn_plus; @@ -195,7 +190,6 @@ rdf_objfmt_output_value(yasm_value *value, unsigned char *buf, unsigned int valsize = value->size; assert(info != NULL); - objfmt_rdf = info->objfmt_rdf; if (value->abs) value->abs = yasm_expr_simplify(value->abs, 1); @@ -523,7 +517,7 @@ rdf_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) { /*@null@*/ rdf_objfmt_output_info *info = (rdf_objfmt_output_info *)d; yasm_sym_vis vis = yasm_symrec_get_visibility(sym); - const char *name; + /*@only@*/ char *name; size_t len; unsigned long value = 0; unsigned int scnum = 0; @@ -561,7 +555,7 @@ rdf_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) return 0; } - name = yasm_symrec_get_name(sym); + name = yasm_symrec_get_global_name(sym, info->object); len = strlen(name); if (len > EXIM_LABEL_MAX-1) { @@ -658,6 +652,7 @@ rdf_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) memcpy(localbuf, name, len); localbuf += len; YASM_WRITE_8(localbuf, 0); /* 0-terminated name */ + yasm_xfree(name); fwrite(info->buf, (unsigned long)(localbuf-info->buf), 1, info->f); @@ -813,10 +808,11 @@ rdf_objfmt_destroy(yasm_objfmt *objfmt) yasm_xfree(objfmt); } -static rdf_section_data * -rdf_objfmt_init_new_section(yasm_object *object, yasm_section *sect, - const char *sectname, unsigned long line) +static void +rdf_objfmt_init_new_section(yasm_section *sect, unsigned long line) { + yasm_object *object = yasm_section_get_object(sect); + const char *sectname = yasm_section_get_name(sect); yasm_objfmt_rdf *objfmt_rdf = (yasm_objfmt_rdf *)object->objfmt; rdf_section_data *data; yasm_symrec *sym; @@ -832,7 +828,6 @@ rdf_objfmt_init_new_section(yasm_object *object, yasm_section *sect, sym = yasm_symtab_define_label(object->symtab, sectname, yasm_section_bcs_first(sect), 1, line); data->sym = sym; - return data; } static yasm_section * @@ -842,9 +837,9 @@ rdf_objfmt_add_default_section(yasm_object *object) rdf_section_data *rsd; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 0, 1, 0, &isnew, 0); + retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); if (isnew) { - rsd = rdf_objfmt_init_new_section(object, retval, ".text", 0); + rsd = yasm_section_get_data(retval, &rdf_section_data_cb); rsd->type = RDF_SECT_CODE; rsd->reserved = 0; yasm_section_set_default(retval, 1); @@ -949,13 +944,10 @@ rdf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, yasm_intnum_destroy(data.reserved_intn); } - retval = yasm_object_get_general(object, sectname, 0, 0, 1, + retval = yasm_object_get_general(object, sectname, 0, 1, data.type == RDF_SECT_BSS, &isnew, line); - if (isnew) - rsd = rdf_objfmt_init_new_section(object, retval, sectname, line); - else - rsd = yasm_section_get_data(retval, &rdf_section_data_cb); + rsd = yasm_section_get_data(retval, &rdf_section_data_cb); if (isnew || yasm_section_is_default(retval)) { yasm_section_set_default(retval, 0); @@ -967,6 +959,13 @@ rdf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, return retval; } +static /*@observer@*/ /*@null@*/ yasm_symrec * +rdf_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + return NULL; +} + static void rdf_section_data_destroy(void *data) { @@ -1053,18 +1052,37 @@ static const yasm_directive rdf_objfmt_directives[] = { { NULL, NULL, NULL, 0 } }; +static const char *rdf_nasm_stdmac[] = { + "%imacro library 1+.nolist", + "[library %1]", + "%endmacro", + "%imacro module 1+.nolist", + "[module %1]", + "%endmacro", + NULL +}; + +static const yasm_stdmac rdf_objfmt_stdmacs[] = { + { "nasm", "nasm", rdf_nasm_stdmac }, + { NULL, NULL, NULL } +}; + /* Define objfmt structure -- see objfmt.h for details */ yasm_objfmt_module yasm_rdf_LTX_objfmt = { "Relocatable Dynamic Object File Format (RDOFF) v2.0", "rdf", "rdf", 32, + 0, rdf_objfmt_dbgfmt_keywords, "null", rdf_objfmt_directives, + rdf_objfmt_stdmacs, rdf_objfmt_create, rdf_objfmt_output, rdf_objfmt_destroy, rdf_objfmt_add_default_section, - rdf_objfmt_section_switch + rdf_objfmt_init_new_section, + rdf_objfmt_section_switch, + rdf_objfmt_get_special_sym }; diff --git a/modules/objfmts/rdf/tests/Makefile.inc b/modules/objfmts/rdf/tests/Makefile.inc index 39f6aab3..c547e8fd 100644 --- a/modules/objfmts/rdf/tests/Makefile.inc +++ b/modules/objfmts/rdf/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/rdf/tests/rdf_test.sh EXTRA_DIST += modules/objfmts/rdf/tests/rdf_test.sh diff --git a/modules/objfmts/rdf/tests/rdf_test.sh b/modules/objfmts/rdf/tests/rdf_test.sh index 9161c378..46584395 100755 --- a/modules/objfmts/rdf/tests/rdf_test.sh +++ b/modules/objfmts/rdf/tests/rdf_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh rdf_test modules/objfmts/rdf/tests "rdf objfmt" "-f rdf" ".rdf" exit $? diff --git a/modules/objfmts/win32/Makefile.inc b/modules/objfmts/win32/Makefile.inc index ce4964fe..5b3b1626 100644 --- a/modules/objfmts/win32/Makefile.inc +++ b/modules/objfmts/win32/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - # Assume objfmt_coff is included YASM_MODULES += objfmt_win32 diff --git a/modules/objfmts/win32/tests/Makefile.inc b/modules/objfmts/win32/tests/Makefile.inc index 5bb8d143..3f2ab943 100644 --- a/modules/objfmts/win32/tests/Makefile.inc +++ b/modules/objfmts/win32/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/win32/tests/win32_test.sh EXTRA_DIST += modules/objfmts/win32/tests/export.asm @@ -9,8 +7,15 @@ EXTRA_DIST += modules/objfmts/win32/tests/win32-curpos.asm EXTRA_DIST += modules/objfmts/win32/tests/win32-curpos.hex EXTRA_DIST += modules/objfmts/win32/tests/win32-overdef.asm EXTRA_DIST += modules/objfmts/win32/tests/win32-overdef.hex +EXTRA_DIST += modules/objfmts/win32/tests/win32-safeseh.asm +EXTRA_DIST += modules/objfmts/win32/tests/win32-safeseh.hex +EXTRA_DIST += modules/objfmts/win32/tests/win32-safeseh.masm EXTRA_DIST += modules/objfmts/win32/tests/win32-segof.asm EXTRA_DIST += modules/objfmts/win32/tests/win32-segof.hex EXTRA_DIST += modules/objfmts/win32/tests/win32test.c EXTRA_DIST += modules/objfmts/win32/tests/win32test.asm EXTRA_DIST += modules/objfmts/win32/tests/win32test.hex + +EXTRA_DIST += modules/objfmts/win32/tests/gas/Makefile.inc + +include modules/objfmts/win32/tests/gas/Makefile.inc diff --git a/modules/objfmts/win32/tests/export.hex b/modules/objfmts/win32/tests/export.hex index bcae2219..33ca9ffb 100644 --- a/modules/objfmts/win32/tests/export.hex +++ b/modules/objfmts/win32/tests/export.hex @@ -10,7 +10,7 @@ 00 00 00 -07 +08 00 00 00 @@ -159,6 +159,24 @@ ff 00 00 00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 2e 74 65 diff --git a/modules/objfmts/win32/tests/gas/Makefile.inc b/modules/objfmts/win32/tests/gas/Makefile.inc new file mode 100644 index 00000000..f492cbac --- /dev/null +++ b/modules/objfmts/win32/tests/gas/Makefile.inc @@ -0,0 +1,9 @@ +TESTS += modules/objfmts/win32/tests/gas/win32_gas_test.sh + +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32_gas_test.sh +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32at.asm +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32at.hex +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32def.asm +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32def.hex +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32secrel32.asm +EXTRA_DIST += modules/objfmts/win32/tests/gas/win32secrel32.hex diff --git a/modules/objfmts/win32/tests/gas/win32_gas_test.sh b/modules/objfmts/win32/tests/gas/win32_gas_test.sh new file mode 100755 index 00000000..4a1bbe98 --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32_gas_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh win32_gas_test modules/objfmts/win32/tests/gas "win32 objfmt" "-f win32 -p gas" ".obj" +exit $? diff --git a/modules/objfmts/win32/tests/gas/win32at.asm b/modules/objfmts/win32/tests/gas/win32at.asm new file mode 100644 index 00000000..f56520a2 --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32at.asm @@ -0,0 +1,167 @@ +.section .rodata +L2586: +.ascii "myWindowClass\0" +.globl _g_szClassName +_g_szClassName: +.byte 109 +.byte 121 +.byte 87 +.byte 105 +.byte 110 +.byte 100 +.byte 111 +.byte 119 +.byte 67 +.byte 108 +.byte 97 +.byte 115 +.byte 115 +.byte 0 +.text +.align 4 +.globl _WndProc@16 +_WndProc@16: +pushl %ebp +movl %esp,%ebp +subl $8,%esp +L2588: +L2590: +movl 12(%ebp),%eax +movl %eax,-4(%ebp) +jmp L2592 +L2593: +pushl 8(%ebp) +call _DestroyWindow@4 +jmp L2591 +L2594: +pushl $0 +call _PostQuitMessage@4 +jmp L2591 +L2595: +pushl 20(%ebp) +pushl 16(%ebp) +pushl 12(%ebp) +pushl 8(%ebp) +call _DefWindowProcA@16 +movl %eax,-8(%ebp) +jmp L2589 +L2592: +cmpl $2,-4(%ebp) +je L2594 +cmpl $16,-4(%ebp) +je L2593 +jmp L2595 +L2591: +movl $0,-8(%ebp) +jmp L2589 +L2589: +movl -8(%ebp),%eax +leave +ret $16 +.section .rodata +L2600: +.ascii "Window Registration Failed!\0" +L2601: +.ascii "Error!\0" +L2602: +.ascii "The title of my window\0" +L2604: +.ascii "Window Creation Failed!\0" +.text +.align 4 +.globl _WinMain@16 +_WinMain@16: +pushl %ebp +movl %esp,%ebp +subl $84,%esp +L2596: +L2598: +movl $48,-48(%ebp) +movl $0,-44(%ebp) +movl $_WndProc@16,-40(%ebp) +movl $0,-36(%ebp) +movl $0,-32(%ebp) +movl 8(%ebp),%eax +movl %eax,-28(%ebp) +pushl $32512 +pushl $0 +call _LoadIconA@8 +movl %eax,-24(%ebp) +pushl $32512 +pushl $0 +call _LoadCursorA@8 +movl %eax,-20(%ebp) +movl $6,-16(%ebp) +movl $0,-12(%ebp) +movl $_g_szClassName,-8(%ebp) +pushl $32512 +pushl $0 +call _LoadIconA@8 +movl %eax,-4(%ebp) +leal -48(%ebp),%edx +pushl %edx +call _RegisterClassExA@4 +cmpw $0,%ax +jne L2599 +pushl $48 +pushl $L2601 +pushl $L2600 +pushl $0 +call _MessageBoxA@16 +movl $0,-84(%ebp) +jmp L2597 +L2599: +pushl $0 +pushl 8(%ebp) +pushl $0 +pushl $0 +pushl $120 +pushl $240 +pushl $-2147483648 +pushl $-2147483648 +pushl $13565952 +pushl $L2602 +pushl $_g_szClassName +pushl $512 +call _CreateWindowExA@48 +movl %eax,-52(%ebp) +cmpl $0,-52(%ebp) +jne L2603 +pushl $48 +pushl $L2601 +pushl $L2604 +pushl $0 +call _MessageBoxA@16 +movl $0,-84(%ebp) +jmp L2597 +L2603: +pushl 20(%ebp) +pushl -52(%ebp) +call _ShowWindow@8 +pushl -52(%ebp) +call _UpdateWindow@4 +L2605: +pushl $0 +pushl $0 +pushl $0 +leal -80(%ebp),%edx +pushl %edx +call _GetMessageA@16 +cmpl $0,%eax +jle L2606 +leal -80(%ebp),%eax +pushl %eax +call _TranslateMessage@4 +leal -80(%ebp),%eax +pushl %eax +call _DispatchMessageA@4 +jmp L2605 +L2606: +movl -72(%ebp),%eax +movl %eax,-84(%ebp) +jmp L2597 +L2597: +movl -84(%ebp),%eax +leave +ret $16 +.ident "PCC: pcc 0.9.9 (win32)" diff --git a/modules/objfmts/win32/tests/gas/win32at.hex b/modules/objfmts/win32/tests/gas/win32at.hex new file mode 100644 index 00000000..21edec5c --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32at.hex @@ -0,0 +1,1653 @@ +4c +01 +03 +00 +00 +00 +00 +00 +91 +03 +00 +00 +19 +00 +00 +00 +00 +00 +0c +01 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +99 +01 +00 +00 +8c +00 +00 +00 +25 +02 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +20 +00 +50 +60 +2e +72 +6f +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6e +00 +00 +00 +0b +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +40 +40 +2f +34 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +79 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +40 +40 +55 +89 +e5 +83 +ec +08 +8b +45 +0c +89 +45 +fc +eb +29 +ff +75 +08 +e8 +00 +00 +00 +00 +eb +2d +6a +00 +e8 +00 +00 +00 +00 +eb +24 +ff +75 +14 +ff +75 +10 +ff +75 +0c +ff +75 +08 +e8 +00 +00 +00 +00 +89 +45 +f8 +eb +17 +83 +7d +fc +02 +74 +db +83 +7d +fc +10 +74 +cb +eb +dc +c7 +45 +f8 +00 +00 +00 +00 +eb +00 +8b +45 +f8 +c9 +c2 +10 +00 +8d +76 +00 +55 +89 +e5 +83 +ec +54 +c7 +45 +d0 +30 +00 +00 +00 +c7 +45 +d4 +00 +00 +00 +00 +c7 +45 +d8 +00 +00 +00 +00 +c7 +45 +dc +00 +00 +00 +00 +c7 +45 +e0 +00 +00 +00 +00 +8b +45 +08 +89 +45 +e4 +68 +00 +7f +00 +00 +6a +00 +e8 +00 +00 +00 +00 +89 +45 +e8 +68 +00 +7f +00 +00 +6a +00 +e8 +00 +00 +00 +00 +89 +45 +ec +c7 +45 +f0 +06 +00 +00 +00 +c7 +45 +f4 +00 +00 +00 +00 +c7 +45 +f8 +0e +00 +00 +00 +68 +00 +7f +00 +00 +6a +00 +e8 +00 +00 +00 +00 +89 +45 +fc +8d +55 +d0 +52 +e8 +00 +00 +00 +00 +66 +83 +f8 +00 +75 +1f +6a +30 +68 +38 +00 +00 +00 +68 +1c +00 +00 +00 +6a +00 +e8 +00 +00 +00 +00 +c7 +45 +ac +00 +00 +00 +00 +e9 +9b +00 +00 +00 +6a +00 +ff +75 +08 +6a +00 +6a +00 +6a +78 +68 +f0 +00 +00 +00 +68 +00 +00 +00 +80 +68 +00 +00 +00 +80 +68 +00 +00 +cf +00 +68 +3f +00 +00 +00 +68 +0e +00 +00 +00 +68 +00 +02 +00 +00 +e8 +00 +00 +00 +00 +89 +45 +cc +83 +7d +cc +00 +75 +1c +6a +30 +68 +38 +00 +00 +00 +68 +56 +00 +00 +00 +6a +00 +e8 +00 +00 +00 +00 +c7 +45 +ac +00 +00 +00 +00 +eb +43 +ff +75 +14 +ff +75 +cc +e8 +00 +00 +00 +00 +ff +75 +cc +e8 +00 +00 +00 +00 +6a +00 +6a +00 +6a +00 +8d +55 +b0 +52 +e8 +00 +00 +00 +00 +83 +f8 +00 +7e +14 +8d +45 +b0 +50 +e8 +00 +00 +00 +00 +8d +45 +b0 +50 +e8 +00 +00 +00 +00 +eb +d8 +8b +45 +b8 +89 +45 +ac +eb +00 +8b +45 +ac +c9 +c2 +10 +00 +12 +00 +00 +00 +09 +00 +00 +00 +14 +00 +1b +00 +00 +00 +0a +00 +00 +00 +14 +00 +2e +00 +00 +00 +0b +00 +00 +00 +14 +00 +6f +00 +00 +00 +03 +00 +00 +00 +06 +00 +8f +00 +00 +00 +0d +00 +00 +00 +14 +00 +9e +00 +00 +00 +0e +00 +00 +00 +14 +00 +b6 +00 +00 +00 +05 +00 +00 +00 +06 +00 +c2 +00 +00 +00 +0d +00 +00 +00 +14 +00 +ce +00 +00 +00 +0f +00 +00 +00 +14 +00 +db +00 +00 +00 +05 +00 +00 +00 +06 +00 +e0 +00 +00 +00 +05 +00 +00 +00 +06 +00 +e7 +00 +00 +00 +10 +00 +00 +00 +14 +00 +17 +01 +00 +00 +05 +00 +00 +00 +06 +00 +1c +01 +00 +00 +05 +00 +00 +00 +06 +00 +26 +01 +00 +00 +11 +00 +00 +00 +14 +00 +36 +01 +00 +00 +05 +00 +00 +00 +06 +00 +3b +01 +00 +00 +05 +00 +00 +00 +06 +00 +42 +01 +00 +00 +10 +00 +00 +00 +14 +00 +56 +01 +00 +00 +12 +00 +00 +00 +14 +00 +5e +01 +00 +00 +13 +00 +00 +00 +14 +00 +6d +01 +00 +00 +14 +00 +00 +00 +14 +00 +7b +01 +00 +00 +15 +00 +00 +00 +14 +00 +84 +01 +00 +00 +16 +00 +00 +00 +14 +00 +6d +79 +57 +69 +6e +64 +6f +77 +43 +6c +61 +73 +73 +00 +6d +79 +57 +69 +6e +64 +6f +77 +43 +6c +61 +73 +73 +00 +57 +69 +6e +64 +6f +77 +20 +52 +65 +67 +69 +73 +74 +72 +61 +74 +69 +6f +6e +20 +46 +61 +69 +6c +65 +64 +21 +00 +45 +72 +72 +6f +72 +21 +00 +54 +68 +65 +20 +74 +69 +74 +6c +65 +20 +6f +66 +20 +6d +79 +20 +77 +69 +6e +64 +6f +77 +00 +57 +69 +6e +64 +6f +77 +20 +43 +72 +65 +61 +74 +69 +6f +6e +20 +46 +61 +69 +6c +65 +64 +21 +00 +00 +50 +43 +43 +3a +20 +70 +63 +63 +20 +30 +2e +39 +2e +39 +20 +28 +77 +69 +6e +33 +32 +29 +00 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +99 +01 +00 +00 +17 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +72 +6f +64 +61 +74 +61 +00 +00 +00 +00 +00 +02 +00 +00 +00 +03 +01 +6e +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +0e +00 +00 +00 +02 +00 +00 +00 +02 +00 +00 +00 +00 +00 +1e +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +02 +00 +00 +00 +00 +00 +2a +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +3b +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +4e +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +61 +00 +00 +00 +58 +00 +00 +00 +01 +00 +00 +00 +02 +00 +00 +00 +00 +00 +6d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +7a +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +89 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +9d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +ad +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +c1 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +cf +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +df +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +ef +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +03 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +00 +00 +17 +01 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +03 +01 +18 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +22 +01 +00 +00 +2e +72 +64 +61 +74 +61 +24 +7a +7a +7a +00 +5f +67 +5f +73 +7a +43 +6c +61 +73 +73 +4e +61 +6d +65 +00 +5f +57 +6e +64 +50 +72 +6f +63 +40 +31 +36 +00 +5f +44 +65 +73 +74 +72 +6f +79 +57 +69 +6e +64 +6f +77 +40 +34 +00 +5f +50 +6f +73 +74 +51 +75 +69 +74 +4d +65 +73 +73 +61 +67 +65 +40 +34 +00 +5f +44 +65 +66 +57 +69 +6e +64 +6f +77 +50 +72 +6f +63 +41 +40 +31 +36 +00 +5f +57 +69 +6e +4d +61 +69 +6e +40 +31 +36 +00 +5f +4c +6f +61 +64 +49 +63 +6f +6e +41 +40 +38 +00 +5f +4c +6f +61 +64 +43 +75 +72 +73 +6f +72 +41 +40 +38 +00 +5f +52 +65 +67 +69 +73 +74 +65 +72 +43 +6c +61 +73 +73 +45 +78 +41 +40 +34 +00 +5f +4d +65 +73 +73 +61 +67 +65 +42 +6f +78 +41 +40 +31 +36 +00 +5f +43 +72 +65 +61 +74 +65 +57 +69 +6e +64 +6f +77 +45 +78 +41 +40 +34 +38 +00 +5f +53 +68 +6f +77 +57 +69 +6e +64 +6f +77 +40 +38 +00 +5f +55 +70 +64 +61 +74 +65 +57 +69 +6e +64 +6f +77 +40 +34 +00 +5f +47 +65 +74 +4d +65 +73 +73 +61 +67 +65 +41 +40 +31 +36 +00 +5f +54 +72 +61 +6e +73 +6c +61 +74 +65 +4d +65 +73 +73 +61 +67 +65 +40 +34 +00 +5f +44 +69 +73 +70 +61 +74 +63 +68 +4d +65 +73 +73 +61 +67 +65 +41 +40 +34 +00 +2e +72 +64 +61 +74 +61 +24 +7a +7a +7a +00 diff --git a/modules/objfmts/win32/tests/gas/win32def.asm b/modules/objfmts/win32/tests/gas/win32def.asm new file mode 100644 index 00000000..e4764668 --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32def.asm @@ -0,0 +1,7 @@ +.globl label +label: + +.def label +.scl 2 +.type 32 +.endef diff --git a/modules/objfmts/win32/tests/gas/win32def.hex b/modules/objfmts/win32/tests/gas/win32def.hex new file mode 100644 index 00000000..bfedd51b --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32def.hex @@ -0,0 +1,172 @@ +4c +01 +01 +00 +00 +00 +00 +00 +3c +00 +00 +00 +06 +00 +00 +00 +00 +00 +0c +01 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +50 +60 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +61 +62 +65 +6c +00 +00 +00 +00 +00 +00 +00 +01 +00 +20 +00 +02 +00 +04 +00 +00 +00 diff --git a/modules/objfmts/win32/tests/gas/win32secrel32.asm b/modules/objfmts/win32/tests/gas/win32secrel32.asm new file mode 100644 index 00000000..0e8a82f7 --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32secrel32.asm @@ -0,0 +1,80 @@ +# [oformat win32] +.text + + .ascii ">>>>" +pre04: .ascii "<<<<" + .ascii ">>>>>" +pre0d: .ascii "<<<" + .ascii ">>>>>>" +pre16: .ascii "<<" + .ascii ">>>>>>>" +pre1f: .ascii "<" + +.data + + .ascii ">>>>" +sam04: .ascii "<<<<" + .ascii ">>>>>" +sam0d: .ascii "<<<" + .ascii ">>>>>>" +sam16: .ascii "<<" + .ascii ">>>>>>>" +sam1f: .ascii "<" + + .ascii ">>>>" + .secrel32 pre04 + .byte 0x11 + .secrel32 pre0d + .byte 0x11 + .secrel32 pre16 + .byte 0x11 + .secrel32 pre1f + .byte 0x11 + .ascii "<<<<<<<<" + + .ascii ">>>>" + .secrel32 sam04 + .byte 0x11 + .secrel32 sam0d + .byte 0x11 + .secrel32 sam16 + .byte 0x11 + .secrel32 sam1f + .byte 0x11 + .ascii "<<<<<<<<" + + .ascii ">>>>" + .secrel32 nex04 + .byte 0x11 + .secrel32 nex0d + .byte 0x11 + .secrel32 nex16 + .byte 0x11 + .secrel32 nex1f + .byte 0x11 + .ascii "<<<<<<<<" + + .ascii ">>>>" + .secrel32 ext24 + .byte 0x11 + .secrel32 ext2d + .byte 0x11 + .secrel32 ext36 + .byte 0x11 + .secrel32 ext3f + .byte 0x11 + .ascii "<<<<<<<<" + +.section .rdata + + .ascii ">>>>" +nex04: .ascii "<<<<" + .ascii ">>>>>" +nex0d: .ascii "<<<" + .ascii ">>>>>>" +nex16: .ascii "<<" + .ascii ">>>>>>>" +nex1f: .ascii "<" + .ascii ">>>>" + + .p2align 4,0 diff --git a/modules/objfmts/win32/tests/gas/win32secrel32.hex b/modules/objfmts/win32/tests/gas/win32secrel32.hex new file mode 100644 index 00000000..89103c06 --- /dev/null +++ b/modules/objfmts/win32/tests/gas/win32secrel32.hex @@ -0,0 +1,778 @@ +4c +01 +03 +00 +00 +00 +00 +00 +1c +02 +00 +00 +0d +00 +00 +00 +00 +00 +0c +01 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +00 +00 +8c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +50 +60 +2e +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a0 +00 +00 +00 +ac +00 +00 +00 +4c +01 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +40 +00 +30 +c0 +2e +72 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +30 +00 +00 +00 +ec +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +50 +40 +3e +3e +3e +3e +3c +3c +3c +3c +3e +3e +3e +3e +3e +3c +3c +3c +3e +3e +3e +3e +3e +3e +3c +3c +3e +3e +3e +3e +3e +3e +3e +3c +3e +3e +3e +3e +3c +3c +3c +3c +3e +3e +3e +3e +3e +3c +3c +3c +3e +3e +3e +3e +3e +3e +3c +3c +3e +3e +3e +3e +3e +3e +3e +3c +3e +3e +3e +3e +04 +00 +00 +00 +11 +0d +00 +00 +00 +11 +16 +00 +00 +00 +11 +1f +00 +00 +00 +11 +3c +3c +3c +3c +3c +3c +3c +3c +3e +3e +3e +3e +04 +00 +00 +00 +11 +0d +00 +00 +00 +11 +16 +00 +00 +00 +11 +1f +00 +00 +00 +11 +3c +3c +3c +3c +3c +3c +3c +3c +3e +3e +3e +3e +04 +00 +00 +00 +11 +0d +00 +00 +00 +11 +16 +00 +00 +00 +11 +1f +00 +00 +00 +11 +3c +3c +3c +3c +3c +3c +3c +3c +3e +3e +3e +3e +00 +00 +00 +00 +11 +00 +00 +00 +00 +11 +00 +00 +00 +00 +11 +00 +00 +00 +00 +11 +3c +3c +3c +3c +3c +3c +3c +3c +24 +00 +00 +00 +03 +00 +00 +00 +0b +00 +29 +00 +00 +00 +03 +00 +00 +00 +0b +00 +2e +00 +00 +00 +03 +00 +00 +00 +0b +00 +33 +00 +00 +00 +03 +00 +00 +00 +0b +00 +44 +00 +00 +00 +05 +00 +00 +00 +0b +00 +49 +00 +00 +00 +05 +00 +00 +00 +0b +00 +4e +00 +00 +00 +05 +00 +00 +00 +0b +00 +53 +00 +00 +00 +05 +00 +00 +00 +0b +00 +64 +00 +00 +00 +0b +00 +00 +00 +0b +00 +69 +00 +00 +00 +0b +00 +00 +00 +0b +00 +6e +00 +00 +00 +0b +00 +00 +00 +0b +00 +73 +00 +00 +00 +0b +00 +00 +00 +0b +00 +84 +00 +00 +00 +07 +00 +00 +00 +0b +00 +89 +00 +00 +00 +08 +00 +00 +00 +0b +00 +8e +00 +00 +00 +09 +00 +00 +00 +0b +00 +93 +00 +00 +00 +0a +00 +00 +00 +0b +00 +3e +3e +3e +3e +3c +3c +3c +3c +3e +3e +3e +3e +3e +3c +3c +3c +3e +3e +3e +3e +3e +3e +3c +3c +3e +3e +3e +3e +3e +3e +3e +3c +3e +3e +3e +3e +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +20 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +03 +01 +a0 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +65 +78 +74 +32 +34 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +65 +78 +74 +32 +64 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +65 +78 +74 +33 +36 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +65 +78 +74 +33 +66 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +2e +72 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +03 +01 +30 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 diff --git a/modules/objfmts/win32/tests/win32-curpos.hex b/modules/objfmts/win32/tests/win32-curpos.hex index 16b39a8f..e8cc7d68 100644 --- a/modules/objfmts/win32/tests/win32-curpos.hex +++ b/modules/objfmts/win32/tests/win32-curpos.hex @@ -10,7 +10,7 @@ 01 00 00 -0a +0b 00 00 00 @@ -66,7 +66,7 @@ a0 00 00 00 -14 +00 00 00 00 @@ -106,7 +106,7 @@ d0 00 00 00 -26 +00 00 00 00 @@ -162,7 +162,7 @@ e8 00 00 00 -06 +07 00 00 00 @@ -172,7 +172,7 @@ e8 00 00 00 -06 +07 00 00 00 @@ -182,7 +182,7 @@ e8 00 00 00 -06 +07 00 00 00 @@ -210,7 +210,7 @@ e8 00 00 00 -08 +09 00 00 00 @@ -220,7 +220,7 @@ e8 00 00 00 -08 +09 00 00 00 @@ -258,7 +258,7 @@ ff 00 00 00 -06 +07 00 00 00 @@ -268,7 +268,7 @@ ff 00 00 00 -06 +07 00 00 00 @@ -278,7 +278,7 @@ ff 00 00 00 -06 +07 00 00 00 @@ -288,7 +288,7 @@ ff 00 00 00 -06 +07 00 00 00 @@ -330,6 +330,24 @@ ff 00 00 00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 2e 74 65 diff --git a/modules/objfmts/win32/tests/win32-longsect.hex b/modules/objfmts/win32/tests/win32-longsect.hex index 25d4812e..fa507b16 100644 --- a/modules/objfmts/win32/tests/win32-longsect.hex +++ b/modules/objfmts/win32/tests/win32-longsect.hex @@ -10,7 +10,7 @@ 01 00 00 -0e +0f 00 00 00 @@ -106,7 +106,7 @@ 00 00 00 -04 +00 00 00 00 @@ -146,7 +146,7 @@ 6c 79 38 -08 +00 00 00 00 @@ -186,7 +186,7 @@ 00 00 00 -0c +00 00 00 00 @@ -226,7 +226,7 @@ 74 37 00 -10 +00 00 00 00 @@ -314,6 +314,24 @@ ff 00 00 00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 2e 74 65 diff --git a/modules/objfmts/win32/tests/win32-overdef.hex b/modules/objfmts/win32/tests/win32-overdef.hex index 00d97cd6..fe0d6d73 100644 --- a/modules/objfmts/win32/tests/win32-overdef.hex +++ b/modules/objfmts/win32/tests/win32-overdef.hex @@ -10,7 +10,7 @@ 00 00 00 -04 +05 00 00 00 @@ -94,6 +94,24 @@ ff 00 00 00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 2e 74 65 diff --git a/modules/objfmts/win32/tests/win32-safeseh.asm b/modules/objfmts/win32/tests/win32-safeseh.asm new file mode 100644 index 00000000..9edd8ede --- /dev/null +++ b/modules/objfmts/win32/tests/win32-safeseh.asm @@ -0,0 +1,5 @@ +MyHandler: + ret +safeseh MyHandler +extern MyHandler3 +safeseh MyHandler3 diff --git a/modules/objfmts/win32/tests/win32-safeseh.hex b/modules/objfmts/win32/tests/win32-safeseh.hex new file mode 100644 index 00000000..4ee1dd14 --- /dev/null +++ b/modules/objfmts/win32/tests/win32-safeseh.hex @@ -0,0 +1,296 @@ +4c +01 +02 +00 +00 +00 +00 +00 +6d +00 +00 +00 +09 +00 +00 +00 +00 +00 +0c +01 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +64 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +50 +60 +2e +73 +78 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +08 +00 +00 +00 +65 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +c3 +05 +00 +00 +00 +08 +00 +00 +00 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +00 +00 +00 +00 +01 +00 +20 +00 +03 +00 +2e +73 +78 +64 +61 +74 +61 +00 +00 +00 +00 +00 +02 +00 +00 +00 +03 +01 +08 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0e +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +02 +00 +19 +00 +00 +00 +4d +79 +48 +61 +6e +64 +6c +65 +72 +00 +4d +79 +48 +61 +6e +64 +6c +65 +72 +33 +00 diff --git a/modules/objfmts/win32/tests/win32-safeseh.masm b/modules/objfmts/win32/tests/win32-safeseh.masm new file mode 100644 index 00000000..f165b9c3 --- /dev/null +++ b/modules/objfmts/win32/tests/win32-safeseh.masm @@ -0,0 +1,10 @@ +.386 +.model flat +_TEXT SEGMENT USE32 PUBLIC 'CODE' +MyHandler proc +.safeseh MyHandler +MyHandler endp +_TEXT ENDS +MyHandler3 proto +.safeseh MyHandler3 +end diff --git a/modules/objfmts/win32/tests/win32-segof.hex b/modules/objfmts/win32/tests/win32-segof.hex index 873129f1..6ad6a75f 100644 --- a/modules/objfmts/win32/tests/win32-segof.hex +++ b/modules/objfmts/win32/tests/win32-segof.hex @@ -10,7 +10,7 @@ 00 00 00 -07 +08 00 00 00 @@ -66,7 +66,7 @@ 00 00 00 -0c +00 00 00 00 @@ -114,7 +114,7 @@ c0 00 00 00 -04 +05 00 00 00 @@ -124,7 +124,7 @@ c0 00 00 00 -05 +06 00 00 00 @@ -166,6 +166,24 @@ ff 00 00 00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 2e 74 65 diff --git a/modules/objfmts/win32/tests/win32_test.sh b/modules/objfmts/win32/tests/win32_test.sh index cd2ab008..6ffb349d 100755 --- a/modules/objfmts/win32/tests/win32_test.sh +++ b/modules/objfmts/win32/tests/win32_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh win32_test modules/objfmts/win32/tests "win32 objfmt" "-f win32" ".obj" exit $? diff --git a/modules/objfmts/win32/tests/win32test.hex b/modules/objfmts/win32/tests/win32test.hex index 339090b1..8e4cfa8a 100644 --- a/modules/objfmts/win32/tests/win32test.hex +++ b/modules/objfmts/win32/tests/win32test.hex @@ -10,7 +10,7 @@ 01 00 00 -10 +11 00 00 00 @@ -66,7 +66,7 @@ c9 00 00 00 -3d +00 00 00 00 @@ -106,7 +106,7 @@ c0 00 00 00 -7d +00 00 00 00 @@ -203,7 +203,7 @@ c3 00 00 00 -0e +0f 00 00 00 @@ -213,7 +213,7 @@ c3 00 00 00 -0e +0f 00 00 00 @@ -223,7 +223,7 @@ c3 00 00 00 -0b +0c 00 00 00 @@ -233,7 +233,7 @@ c3 00 00 00 -0c +0d 00 00 00 @@ -243,7 +243,7 @@ c3 00 00 00 -0e +0f 00 00 00 @@ -253,7 +253,7 @@ c3 00 00 00 -0c +0d 00 00 00 @@ -263,7 +263,7 @@ c3 00 00 00 -0a +0b 00 00 00 @@ -337,7 +337,7 @@ c3 00 00 00 -0e +0f 00 00 00 @@ -347,7 +347,7 @@ c3 00 00 00 -02 +03 00 00 00 @@ -357,7 +357,7 @@ c3 00 00 00 -0c +0d 00 00 00 @@ -399,6 +399,24 @@ ff 00 00 00 +40 +66 +65 +61 +74 +2e +30 +30 +01 +00 +00 +00 +ff +ff +00 +00 +03 +00 2e 74 65 diff --git a/modules/objfmts/win64/Makefile.inc b/modules/objfmts/win64/Makefile.inc index 72dcd716..545c847e 100644 --- a/modules/objfmts/win64/Makefile.inc +++ b/modules/objfmts/win64/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - # Assume objfmt_coff is included YASM_MODULES += objfmt_win64 objfmt_x64 diff --git a/modules/objfmts/win64/tests/Makefile.inc b/modules/objfmts/win64/tests/Makefile.inc index 4bc0907c..4062fc33 100644 --- a/modules/objfmts/win64/tests/Makefile.inc +++ b/modules/objfmts/win64/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/win64/tests/win64_test.sh EXTRA_DIST += modules/objfmts/win64/tests/win64_test.sh @@ -19,6 +17,8 @@ EXTRA_DIST += modules/objfmts/win64/tests/sce4.hex EXTRA_DIST += modules/objfmts/win64/tests/sce4.masm EXTRA_DIST += modules/objfmts/win64/tests/sce4-err.asm EXTRA_DIST += modules/objfmts/win64/tests/sce4-err.errwarn +EXTRA_DIST += modules/objfmts/win64/tests/win64-abs.asm +EXTRA_DIST += modules/objfmts/win64/tests/win64-abs.hex EXTRA_DIST += modules/objfmts/win64/tests/win64-curpos.asm EXTRA_DIST += modules/objfmts/win64/tests/win64-curpos.hex EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref.asm @@ -27,3 +27,11 @@ EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref.masm EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref2.asm EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref2.hex EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref2.masm +EXTRA_DIST += modules/objfmts/win64/tests/win64-function.asm +EXTRA_DIST += modules/objfmts/win64/tests/win64-function.hex +EXTRA_DIST += modules/objfmts/win64/tests/win64-imagebase.hex +EXTRA_DIST += modules/objfmts/win64/tests/win64-imagebase.asm + +EXTRA_DIST += modules/objfmts/win64/tests/gas/Makefile.inc + +include modules/objfmts/win64/tests/gas/Makefile.inc diff --git a/modules/objfmts/win64/tests/gas/Makefile.inc b/modules/objfmts/win64/tests/gas/Makefile.inc new file mode 100644 index 00000000..0faeec78 --- /dev/null +++ b/modules/objfmts/win64/tests/gas/Makefile.inc @@ -0,0 +1,5 @@ +TESTS += modules/objfmts/win64/tests/gas/win64_gas_test.sh + +EXTRA_DIST += modules/objfmts/win64/tests/gas/win64_gas_test.sh +EXTRA_DIST += modules/objfmts/win64/tests/gas/win64-gas-sce.asm +EXTRA_DIST += modules/objfmts/win64/tests/gas/win64-gas-sce.hex diff --git a/modules/objfmts/win64/tests/gas/win64-gas-sce.asm b/modules/objfmts/win64/tests/gas/win64-gas-sce.asm new file mode 100644 index 00000000..3a75ee4c --- /dev/null +++ b/modules/objfmts/win64/tests/gas/win64-gas-sce.asm @@ -0,0 +1,11 @@ +PROC_FRAME sample +rex_push_reg %rbp +rex_push_eflags +alloc_stack 16 +save_reg %rsi, 0x18 +save_xmm128 %xmm7, 0x20 +push_frame 16 +set_frame %rdi +set_frame %rdi, 16 +END_PROLOGUE +ENDPROC_FRAME diff --git a/modules/objfmts/win64/tests/gas/win64-gas-sce.hex b/modules/objfmts/win64/tests/gas/win64-gas-sce.hex new file mode 100644 index 00000000..e50d860f --- /dev/null +++ b/modules/objfmts/win64/tests/gas/win64-gas-sce.hex @@ -0,0 +1,399 @@ +64 +86 +03 +00 +00 +00 +00 +00 +e9 +00 +00 +00 +09 +00 +00 +00 +00 +00 +04 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +1b +00 +00 +00 +8c +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +50 +60 +2e +78 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +18 +00 +00 +00 +a7 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +40 +00 +40 +40 +2e +70 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0c +00 +00 +00 +bf +00 +00 +00 +cb +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +40 +00 +30 +40 +48 +55 +48 +9c +48 +83 +ec +10 +48 +89 +74 +24 +18 +66 +0f +7f +7c +24 +20 +48 +89 +e7 +48 +8d +7c +24 +10 +01 +1b +0a +17 +1b +73 +16 +73 +13 +1a +13 +78 +02 +00 +0d +64 +03 +00 +08 +12 +04 +02 +02 +50 +00 +00 +00 +00 +1b +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +03 +00 +04 +00 +00 +00 +04 +00 +00 +00 +03 +00 +08 +00 +00 +00 +05 +00 +00 +00 +03 +00 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +1b +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +73 +61 +6d +70 +6c +65 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +00 +2e +78 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +03 +01 +18 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +70 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +03 +01 +0c +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 diff --git a/modules/objfmts/win64/tests/gas/win64_gas_test.sh b/modules/objfmts/win64/tests/gas/win64_gas_test.sh new file mode 100755 index 00000000..efc76882 --- /dev/null +++ b/modules/objfmts/win64/tests/gas/win64_gas_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh win64_gas_test modules/objfmts/win64/tests/gas "win64 objfmt" "-f win64 -p gas -r nasm" ".obj" +exit $? diff --git a/modules/objfmts/win64/tests/sce1-err.errwarn b/modules/objfmts/win64/tests/sce1-err.errwarn index f5b67933..bfb88c14 100644 --- a/modules/objfmts/win64/tests/sce1-err.errwarn +++ b/modules/objfmts/win64/tests/sce1-err.errwarn @@ -1,8 +1,8 @@ --:9: ended procedure without ending prologue --:1: procedure started here --:20: nested procedures not supported (didn't use [ENDPROC_FRAME]?) --:11: previous procedure started here --:27: [SAVEREG] after end of prologue --:26: prologue ended here --:31: [ENDPROLOG] without preceding [PROC_FRAME] --:32: [SAVEREG] without preceding [PROC_FRAME] +-:9: error: ended procedure without ending prologue +-:1: error: procedure started here +-:20: error: nested procedures not supported (didn't use [ENDPROC_FRAME]?) +-:11: error: previous procedure started here +-:27: error: [SAVEREG] after end of prologue +-:26: error: prologue ended here +-:31: error: [ENDPROLOG] without preceding [PROC_FRAME] +-:32: error: [SAVEREG] without preceding [PROC_FRAME] diff --git a/modules/objfmts/win64/tests/sce1.hex b/modules/objfmts/win64/tests/sce1.hex index d6b1427c..442ef944 100644 --- a/modules/objfmts/win64/tests/sce1.hex +++ b/modules/objfmts/win64/tests/sce1.hex @@ -66,7 +66,7 @@ 61 00 00 -3a +00 00 00 00 @@ -106,7 +106,7 @@ c6 61 00 00 -52 +00 00 00 00 diff --git a/modules/objfmts/win64/tests/sce2-err.errwarn b/modules/objfmts/win64/tests/sce2-err.errwarn index d7f0d290..73e18652 100644 --- a/modules/objfmts/win64/tests/sce2-err.errwarn +++ b/modules/objfmts/win64/tests/sce2-err.errwarn @@ -1,2 +1,2 @@ --: end of file in procedure frame --:1: procedure started here +-: error: end of file in procedure frame +-:1: error: procedure started here diff --git a/modules/objfmts/win64/tests/sce2.hex b/modules/objfmts/win64/tests/sce2.hex index 1caa10c7..54bc0e9e 100644 --- a/modules/objfmts/win64/tests/sce2.hex +++ b/modules/objfmts/win64/tests/sce2.hex @@ -66,7 +66,7 @@ e3 61 00 00 -1d +00 00 00 00 @@ -106,7 +106,7 @@ a9 61 00 00 -2d +00 00 00 00 diff --git a/modules/objfmts/win64/tests/sce3.hex b/modules/objfmts/win64/tests/sce3.hex index cadf8b94..26fdb0c8 100644 --- a/modules/objfmts/win64/tests/sce3.hex +++ b/modules/objfmts/win64/tests/sce3.hex @@ -66,7 +66,7 @@ 61 00 00 -57 +00 00 00 00 @@ -106,7 +106,7 @@ e3 61 00 00 -7f +00 00 00 00 diff --git a/modules/objfmts/win64/tests/sce4-err.errwarn b/modules/objfmts/win64/tests/sce4-err.errwarn index 92d9cb02..b477ceb7 100644 --- a/modules/objfmts/win64/tests/sce4-err.errwarn +++ b/modules/objfmts/win64/tests/sce4-err.errwarn @@ -1,9 +1,9 @@ --:2: frame offset of -4 bytes, must be between 0 and 240 --:3: negative offset not allowed --:5: negative offset not allowed --:6: negative offset not allowed --:11: frame offset of 248 bytes, must be between 0 and 240 --:17: frame offset of 236 is not a multiple of 16 --:18: offset of 124 is not a multiple of 8 --:20: offset of 1032 is not a multiple of 16 --:21: offset of 1028 is not a multiple of 8 +-:2: error: frame offset of -4 bytes, must be between 0 and 240 +-:3: error: negative offset not allowed +-:5: error: negative offset not allowed +-:6: error: negative offset not allowed +-:11: error: frame offset of 248 bytes, must be between 0 and 240 +-:17: error: frame offset of 236 is not a multiple of 16 +-:18: error: offset of 124 is not a multiple of 8 +-:20: error: offset of 1032 is not a multiple of 16 +-:21: error: offset of 1028 is not a multiple of 8 diff --git a/modules/objfmts/win64/tests/sce4.hex b/modules/objfmts/win64/tests/sce4.hex index 9a57d50d..e324697e 100644 --- a/modules/objfmts/win64/tests/sce4.hex +++ b/modules/objfmts/win64/tests/sce4.hex @@ -106,7 +106,7 @@ 61 00 00 -40 +00 00 00 00 diff --git a/modules/objfmts/win64/tests/win64-abs.asm b/modules/objfmts/win64/tests/win64-abs.asm new file mode 100644 index 00000000..b5c29ea2 --- /dev/null +++ b/modules/objfmts/win64/tests/win64-abs.asm @@ -0,0 +1 @@ +mov rax, [rel 0x1000] diff --git a/modules/objfmts/win64/tests/win64-abs.hex b/modules/objfmts/win64/tests/win64-abs.hex new file mode 100644 index 00000000..7d4b35e9 --- /dev/null +++ b/modules/objfmts/win64/tests/win64-abs.hex @@ -0,0 +1,171 @@ +64 +86 +01 +00 +00 +00 +00 +00 +4d +00 +00 +00 +05 +00 +00 +00 +00 +00 +04 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +3c +00 +00 +00 +43 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +20 +00 +50 +60 +48 +8b +05 +00 +10 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +04 +00 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +07 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +61 +62 +73 +6f +6c +75 +74 +00 +00 +00 +00 +ff +ff +00 +00 +03 +00 +04 +00 +00 +00 diff --git a/modules/objfmts/win64/tests/win64-curpos.hex b/modules/objfmts/win64/tests/win64-curpos.hex index d7c51b10..14032abd 100644 --- a/modules/objfmts/win64/tests/win64-curpos.hex +++ b/modules/objfmts/win64/tests/win64-curpos.hex @@ -66,7 +66,7 @@ a1 00 00 00 -15 +00 00 00 00 @@ -106,7 +106,7 @@ d1 00 00 00 -27 +00 00 00 00 diff --git a/modules/objfmts/win64/tests/win64-dataref.hex b/modules/objfmts/win64/tests/win64-dataref.hex index 3af07864..443727dd 100644 --- a/modules/objfmts/win64/tests/win64-dataref.hex +++ b/modules/objfmts/win64/tests/win64-dataref.hex @@ -66,8 +66,8 @@ a4 00 00 00 -a0 -01 +00 +00 00 00 00 @@ -106,8 +106,8 @@ c0 00 00 00 -ec -01 +00 +00 00 00 00 @@ -146,8 +146,8 @@ c0 61 00 00 -fc -01 +00 +00 00 00 00 @@ -186,8 +186,8 @@ fc 61 00 00 -08 -02 +00 +00 00 00 00 @@ -226,8 +226,8 @@ fc 00 00 00 -10 -02 +00 +00 00 00 00 @@ -1364,7 +1364,7 @@ f8 00 00 00 -17 +16 00 00 00 @@ -1374,7 +1374,7 @@ f8 00 00 00 -17 +16 00 00 00 @@ -1999,6 +1999,24 @@ a0 03 00 78 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +03 +00 +78 70 74 72 @@ -2017,24 +2035,6 @@ a0 03 00 78 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -00 -03 -00 -00 -00 -03 -00 -78 70 74 72 diff --git a/modules/objfmts/win64/tests/win64-dataref2.hex b/modules/objfmts/win64/tests/win64-dataref2.hex index 1b7a430c..0555f0b2 100644 --- a/modules/objfmts/win64/tests/win64-dataref2.hex +++ b/modules/objfmts/win64/tests/win64-dataref2.hex @@ -66,7 +66,7 @@ c3 00 00 00 -29 +00 00 00 00 diff --git a/modules/objfmts/win64/tests/win64-function.asm b/modules/objfmts/win64/tests/win64-function.asm new file mode 100644 index 00000000..b1af165c --- /dev/null +++ b/modules/objfmts/win64/tests/win64-function.asm @@ -0,0 +1,4 @@ +global _foo:function + +_foo: + diff --git a/modules/objfmts/win64/tests/win64-function.hex b/modules/objfmts/win64/tests/win64-function.hex new file mode 100644 index 00000000..ad94a4dd --- /dev/null +++ b/modules/objfmts/win64/tests/win64-function.hex @@ -0,0 +1,154 @@ +64 +86 +01 +00 +00 +00 +00 +00 +3c +00 +00 +00 +05 +00 +00 +00 +00 +00 +04 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +50 +60 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +5f +66 +6f +6f +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +20 +00 +02 +00 +04 +00 +00 +00 diff --git a/modules/objfmts/win64/tests/win64-imagebase.asm b/modules/objfmts/win64/tests/win64-imagebase.asm new file mode 100644 index 00000000..bd636026 --- /dev/null +++ b/modules/objfmts/win64/tests/win64-imagebase.asm @@ -0,0 +1,17 @@ +[section .text] +handler: ret +func: ret +func_end: + +[section .pdata] + dd func + dd func_end + dd myunwnd + +[section .xdata] +myunwnd: + db 9,0,0,0 + dd handler + +[section .foo] + dd handler wrt ..imagebase diff --git a/modules/objfmts/win64/tests/win64-imagebase.hex b/modules/objfmts/win64/tests/win64-imagebase.hex new file mode 100644 index 00000000..04f00b80 --- /dev/null +++ b/modules/objfmts/win64/tests/win64-imagebase.hex @@ -0,0 +1,512 @@ +64 +86 +04 +00 +00 +00 +00 +00 +00 +01 +00 +00 +0e +00 +00 +00 +00 +00 +04 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +b4 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +20 +00 +50 +60 +2e +70 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0c +00 +00 +00 +b6 +00 +00 +00 +c2 +00 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +40 +00 +30 +40 +2e +78 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +08 +00 +00 +00 +e0 +00 +00 +00 +e8 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +40 +00 +40 +40 +2e +66 +6f +6f +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +f2 +00 +00 +00 +f6 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +20 +00 +00 +60 +c3 +c3 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +05 +00 +00 +00 +03 +00 +04 +00 +00 +00 +06 +00 +00 +00 +03 +00 +08 +00 +00 +00 +09 +00 +00 +00 +03 +00 +09 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +04 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +03 +00 +2e +66 +69 +6c +65 +00 +00 +00 +00 +00 +00 +00 +fe +ff +00 +00 +67 +01 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +74 +65 +78 +74 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +01 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +68 +61 +6e +64 +6c +65 +72 +00 +00 +00 +00 +00 +01 +00 +00 +00 +03 +00 +66 +75 +6e +63 +00 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +03 +00 +66 +75 +6e +63 +5f +65 +6e +64 +02 +00 +00 +00 +01 +00 +00 +00 +03 +00 +2e +70 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +02 +00 +00 +00 +03 +01 +0c +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6d +79 +75 +6e +77 +6e +64 +00 +00 +00 +00 +00 +03 +00 +00 +00 +03 +00 +2e +78 +64 +61 +74 +61 +00 +00 +00 +00 +00 +00 +03 +00 +00 +00 +03 +01 +08 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +2e +66 +6f +6f +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 +03 +01 +04 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +00 +00 diff --git a/modules/objfmts/win64/tests/win64_test.sh b/modules/objfmts/win64/tests/win64_test.sh index bf7f2d3c..4616900f 100755 --- a/modules/objfmts/win64/tests/win64_test.sh +++ b/modules/objfmts/win64/tests/win64_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh win64_test modules/objfmts/win64/tests "win64 objfmt" "-f win64" ".obj" exit $? diff --git a/modules/objfmts/xdf/CMakeLists.txt b/modules/objfmts/xdf/CMakeLists.txt new file mode 100644 index 00000000..681ec2b0 --- /dev/null +++ b/modules/objfmts/xdf/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(objfmt_xdf + objfmts/xdf/xdf-objfmt.c + ) diff --git a/modules/objfmts/xdf/Makefile.inc b/modules/objfmts/xdf/Makefile.inc index 955ef218..ffdc68b8 100644 --- a/modules/objfmts/xdf/Makefile.inc +++ b/modules/objfmts/xdf/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/objfmts/xdf/xdf-objfmt.c YASM_MODULES += objfmt_xdf diff --git a/modules/objfmts/xdf/tests/Makefile.inc b/modules/objfmts/xdf/tests/Makefile.inc index 7bd402dc..c39ba301 100644 --- a/modules/objfmts/xdf/tests/Makefile.inc +++ b/modules/objfmts/xdf/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/objfmts/xdf/tests/xdf_test.sh EXTRA_DIST += modules/objfmts/xdf/tests/xdf_test.sh diff --git a/modules/objfmts/xdf/tests/xdf_test.sh b/modules/objfmts/xdf/tests/xdf_test.sh index 11640fa8..ee9d5d5f 100755 --- a/modules/objfmts/xdf/tests/xdf_test.sh +++ b/modules/objfmts/xdf/tests/xdf_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh xdf_test modules/objfmts/xdf/tests "xdf objfmt" "-f xdf" ".xdf" exit $? diff --git a/modules/objfmts/xdf/tests/xdfsect-err.errwarn b/modules/objfmts/xdf/tests/xdfsect-err.errwarn index 4a9d5b3a..84acc4c1 100644 --- a/modules/objfmts/xdf/tests/xdfsect-err.errwarn +++ b/modules/objfmts/xdf/tests/xdfsect-err.errwarn @@ -1,4 +1,4 @@ --:1: directive `section' requires an argument +-:1: error: directive `section' requires an argument -:2: warning: Unrecognized qualifier `use16' -:3: warning: Unrecognized qualifier `use32' -:4: warning: Unrecognized qualifier `use64' @@ -6,15 +6,15 @@ -:6: warning: Unrecognized qualifier `flat' -:7: warning: Unrecognized qualifier `foo' -:8: warning: Unrecognized qualifier `foo' --:9: argument to `absolute' is not an integer --:9: undefined symbol `foo' (first use) --:9: (Each undefined symbol is reported only once.) --:10: argument to `absolute' is not an integer +-:9: error: argument to `absolute' is not an integer +-:9: error: undefined symbol `foo' (first use) +-:9: error: (Each undefined symbol is reported only once.) +-:10: error: argument to `absolute' is not an integer -:11: warning: Unrecognized qualifier `absolute' --:12: argument to `virtual' is not an integer --:13: argument to `virtual' is not an integer +-:12: error: argument to `virtual' is not an integer +-:13: error: argument to `virtual' is not an integer -:14: warning: Unrecognized qualifier `virtual' --:15: argument to `align' is not an integer --:16: argument to `align' is not an integer +-:15: error: argument to `align' is not an integer +-:16: error: argument to `align' is not an integer -:17: warning: Unrecognized qualifier `align' -:18: warning: Unrecognized string qualifier diff --git a/modules/objfmts/xdf/xdf-objfmt.c b/modules/objfmts/xdf/xdf-objfmt.c index 84e0e314..9ad0e60a 100644 --- a/modules/objfmts/xdf/xdf-objfmt.c +++ b/modules/objfmts/xdf/xdf-objfmt.c @@ -25,11 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_BC_INTERNAL -#define YASM_EXPR_INTERNAL #include @@ -153,14 +149,12 @@ xdf_objfmt_output_value(yasm_value *value, unsigned char *buf, yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ xdf_objfmt_output_info *info = (xdf_objfmt_output_info *)d; - yasm_objfmt_xdf *objfmt_xdf; /*@dependent@*/ /*@null@*/ yasm_intnum *intn; unsigned long intn_minus; int retval; unsigned int valsize = value->size; assert(info != NULL); - objfmt_xdf = info->objfmt_xdf; if (value->abs) value->abs = yasm_expr_simplify(value->abs, 1); @@ -379,13 +373,11 @@ static int xdf_objfmt_output_secthead(yasm_section *sect, /*@null@*/ void *d) { /*@null@*/ xdf_objfmt_output_info *info = (xdf_objfmt_output_info *)d; - yasm_objfmt_xdf *objfmt_xdf; /*@dependent@*/ /*@null@*/ xdf_section_data *xsd; /*@null@*/ xdf_symrec_data *xsymd; unsigned char *localbuf; assert(info != NULL); - objfmt_xdf = info->objfmt_xdf; xsd = yasm_section_get_data(sect, &xdf_section_data_cb); assert(xsd != NULL); @@ -455,7 +447,7 @@ xdf_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) assert(info != NULL); if (info->all_syms || vis != YASM_SYM_LOCAL) { - const char *name = yasm_symrec_get_name(sym); + /*@only@*/ char *name = yasm_symrec_get_global_name(sym, info->object); const yasm_expr *equ_val; const yasm_intnum *intn; size_t len = strlen(name); @@ -517,6 +509,7 @@ xdf_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) info->strtab_offset += (unsigned long)(len+1); YASM_WRITE_32_L(localbuf, flags); /* flags */ fwrite(info->buf, 16, 1, info->f); + yasm_xfree(name); } return 0; } @@ -530,9 +523,10 @@ xdf_objfmt_output_str(yasm_symrec *sym, /*@null@*/ void *d) assert(info != NULL); if (info->all_syms || vis != YASM_SYM_LOCAL) { - const char *name = yasm_symrec_get_name(sym); + /*@only@*/ char *name = yasm_symrec_get_global_name(sym, info->object); size_t len = strlen(name); fwrite(name, len+1, 1, info->f); + yasm_xfree(name); } return 0; } @@ -605,10 +599,11 @@ xdf_objfmt_destroy(yasm_objfmt *objfmt) yasm_xfree(objfmt); } -static xdf_section_data * -xdf_objfmt_init_new_section(yasm_object *object, yasm_section *sect, - const char *sectname, unsigned long line) +static void +xdf_objfmt_init_new_section(yasm_section *sect, unsigned long line) { + yasm_object *object = yasm_section_get_object(sect); + const char *sectname = yasm_section_get_name(sect); yasm_objfmt_xdf *objfmt_xdf = (yasm_objfmt_xdf *)object->objfmt; xdf_section_data *data; yasm_symrec *sym; @@ -627,21 +622,17 @@ xdf_objfmt_init_new_section(yasm_object *object, yasm_section *sect, sym = yasm_symtab_define_label(object->symtab, sectname, yasm_section_bcs_first(sect), 1, line); data->sym = sym; - return data; } static yasm_section * xdf_objfmt_add_default_section(yasm_object *object) { yasm_section *retval; - xdf_section_data *xsd; int isnew; - retval = yasm_object_get_general(object, ".text", 0, 0, 1, 0, &isnew, 0); - if (isnew) { - xsd = xdf_objfmt_init_new_section(object, retval, ".text", 0); + retval = yasm_object_get_general(object, ".text", 0, 1, 0, &isnew, 0); + if (isnew) yasm_section_set_default(retval, 1); - } return retval; } @@ -748,13 +739,10 @@ xdf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, } } - retval = yasm_object_get_general(object, sectname, 0, align, 1, resonly, + retval = yasm_object_get_general(object, sectname, align, 1, resonly, &isnew, line); - if (isnew) - xsd = xdf_objfmt_init_new_section(object, retval, sectname, line); - else - xsd = yasm_section_get_data(retval, &xdf_section_data_cb); + xsd = yasm_section_get_data(retval, &xdf_section_data_cb); if (isnew || yasm_section_is_default(retval)) { yasm_section_set_default(retval, 0); @@ -776,6 +764,13 @@ xdf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, return retval; } +static /*@observer@*/ /*@null@*/ yasm_symrec * +xdf_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + return NULL; +} + static void xdf_section_data_destroy(void *data) { @@ -832,12 +827,16 @@ yasm_objfmt_module yasm_xdf_LTX_objfmt = { "xdf", "xdf", 32, + 0, xdf_objfmt_dbgfmt_keywords, "null", NULL, /* no directives */ + NULL, /* no standard macros */ xdf_objfmt_create, xdf_objfmt_output, xdf_objfmt_destroy, xdf_objfmt_add_default_section, - xdf_objfmt_section_switch + xdf_objfmt_init_new_section, + xdf_objfmt_section_switch, + xdf_objfmt_get_special_sym }; diff --git a/modules/objfmts/yasm_objfmts.xml b/modules/objfmts/yasm_objfmts.xml index 3a70fedc..f4c9a75b 100644 --- a/modules/objfmts/yasm_objfmts.xml +++ b/modules/objfmts/yasm_objfmts.xml @@ -2,8 +2,6 @@ - - @@ -98,11 +96,12 @@ elf - The ELF object format really comes in two flavors: - elf32 (for 32-bit targets) and elf64 - (for 64-bit targets). ELF is a standard object format in common - use on modern Unix and compatible systems (e.g. Linux, FreeBSD). - ELF has complex support for relocatable and shared objects. + The ELF object format really comes in three flavors: + elf32 (for 32-bit targets), elf64 + (for 64-bit targets and elfx32 (for x32 targets). + ELF is a standard object format in common use on modern Unix and + compatible systems (e.g. Linux, FreeBSD). ELF has complex support + for relocatable and shared objects. diff --git a/modules/parsers/CMakeLists.txt b/modules/parsers/CMakeLists.txt new file mode 100644 index 00000000..db1e371f --- /dev/null +++ b/modules/parsers/CMakeLists.txt @@ -0,0 +1,2 @@ +INCLUDE(parsers/gas/CMakeLists.txt) +INCLUDE(parsers/nasm/CMakeLists.txt) diff --git a/modules/parsers/Makefile.inc b/modules/parsers/Makefile.inc index 89bfd35b..b432fa9e 100644 --- a/modules/parsers/Makefile.inc +++ b/modules/parsers/Makefile.inc @@ -1,12 +1,11 @@ -# $Id$ - EXTRA_DIST += modules/parsers/gas/Makefile.inc EXTRA_DIST += modules/parsers/nasm/Makefile.inc include modules/parsers/gas/Makefile.inc include modules/parsers/nasm/Makefile.inc +include modules/parsers/tasm/Makefile.inc -dist_man_MANS += yasm_parsers.7 +notrans_dist_man_MANS += yasm_parsers.7 if BUILD_MAN yasm_parsers.7: modules/parsers/yasm_parsers.xml diff --git a/modules/parsers/gas/CMakeLists.txt b/modules/parsers/gas/CMakeLists.txt new file mode 100644 index 00000000..8c59d4dd --- /dev/null +++ b/modules/parsers/gas/CMakeLists.txt @@ -0,0 +1,15 @@ +YASM_RE2C( + ${CMAKE_CURRENT_SOURCE_DIR}/parsers/gas/gas-token.re + ${CMAKE_CURRENT_BINARY_DIR}/gas-token.c + -b + ) + +YASM_ADD_MODULE(parser_gas + parsers/gas/gas-parser.c + parsers/gas/gas-parse.c + parsers/gas/gas-parse-intel.c + gas-token.c + ) + +YASM_ADD_MODULE(parser_gnu + ) diff --git a/modules/parsers/gas/Makefile.inc b/modules/parsers/gas/Makefile.inc index 84fa4190..a0264cc6 100644 --- a/modules/parsers/gas/Makefile.inc +++ b/modules/parsers/gas/Makefile.inc @@ -1,8 +1,7 @@ -# $Id$ - libyasm_a_SOURCES += modules/parsers/gas/gas-parser.c libyasm_a_SOURCES += modules/parsers/gas/gas-parser.h libyasm_a_SOURCES += modules/parsers/gas/gas-parse.c +libyasm_a_SOURCES += modules/parsers/gas/gas-parse-intel.c nodist_libyasm_a_SOURCES += gas-token.c YASM_MODULES += parser_gas parser_gnu diff --git a/modules/parsers/gas/gas-parse-intel.c b/modules/parsers/gas/gas-parse-intel.c new file mode 100644 index 00000000..9d412fc7 --- /dev/null +++ b/modules/parsers/gas/gas-parse-intel.c @@ -0,0 +1,90 @@ +/* + * GAS-compatible parser Intel syntax support + * + * Copyright (C) 2010 Alexei Svitkine + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of other contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#include + +#include "modules/parsers/gas/gas-parser.h" +#include "modules/parsers/nasm/nasm-parser-struct.h" + +extern yasm_bytecode *gas_intel_syntax_parse_instr(yasm_parser_nasm *parser_nasm, unsigned char *instr); + +#define SET_FIELDS(to, from) \ + (to)->object = (from)->object; \ + (to)->locallabel_base = (from)->locallabel_base; \ + (to)->locallabel_base_len = (from)->locallabel_base_len; \ + (to)->preproc = (from)->preproc; \ + (to)->errwarns = (from)->errwarns; \ + (to)->linemap = (from)->linemap; \ + (to)->prev_bc = (from)->prev_bc; + +yasm_bytecode *parse_instr_intel(yasm_parser_gas *parser_gas) +{ + char *stok, *slim; + unsigned char *line; + size_t length; + + yasm_parser_nasm parser_nasm; + yasm_bytecode *bc; + + memset(&parser_nasm, 0, sizeof(parser_nasm)); + + yasm_arch_set_var(parser_gas->object->arch, "gas_intel_mode", 1); + SET_FIELDS(&parser_nasm, parser_gas); + parser_nasm.masm = 1; + + stok = (char *) parser_gas->s.tok; + slim = (char *) parser_gas->s.lim; + length = 0; + while (&stok[length] < slim && stok[length] != '\n') { + length++; + } + + if (&stok[length] == slim && parser_gas->line) { + line = yasm_xmalloc(length + parser_gas->lineleft + 1); + memcpy(line, parser_gas->s.tok, length); + memcpy(line + length, parser_gas->linepos, parser_gas->lineleft); + length += parser_gas->lineleft; + if (line[length - 1] == '\n') length--; + } else { + line = yasm_xmalloc(length + 1); + memcpy(line, parser_gas->s.tok, length); + } + line[length] = '\0'; + + bc = gas_intel_syntax_parse_instr(&parser_nasm, line); + + SET_FIELDS(parser_gas, &parser_nasm); + yasm_arch_set_var(parser_gas->object->arch, "gas_intel_mode", 0); + + yasm_xfree(line); + + return bc; +} diff --git a/modules/parsers/gas/gas-parse.c b/modules/parsers/gas/gas-parse.c index 702b47dd..14c86a70 100644 --- a/modules/parsers/gas/gas-parse.c +++ b/modules/parsers/gas/gas-parse.c @@ -28,18 +28,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_EXPR_INTERNAL #include +#include #include #include #include "modules/parsers/gas/gas-parser.h" -static yasm_bytecode *parse_line(yasm_parser_gas *parser_gas); +typedef struct dir_lookup { + const char *name; + yasm_bytecode * (*handler) (yasm_parser_gas *, unsigned int); + unsigned int param; + enum gas_parser_state newstate; +} dir_lookup; + +static void cpp_line_marker(yasm_parser_gas *parser_gas); +static void nasm_line_marker(yasm_parser_gas *parser_gas); static yasm_bytecode *parse_instr(yasm_parser_gas *parser_gas); static int parse_dirvals(yasm_parser_gas *parser_gas, yasm_valparamhead *vps); static int parse_datavals(yasm_parser_gas *parser_gas, yasm_datavalhead *dvs); @@ -59,9 +65,9 @@ static yasm_section *gas_get_section /*@null@*/ char *type, /*@null@*/ yasm_valparamhead *objext_valparams, int builtin); static void gas_switch_section - (yasm_parser_gas *parser_gas, /*@only@*/ char *name, /*@null@*/ char *flags, - /*@null@*/ char *type, /*@null@*/ yasm_valparamhead *objext_valparams, - int builtin); + (yasm_parser_gas *parser_gas, /*@only@*/ const char *name, + /*@null@*/ char *flags, /*@null@*/ char *type, + /*@null@*/ yasm_valparamhead *objext_valparams, int builtin); static yasm_bytecode *gas_parser_align (yasm_parser_gas *parser_gas, yasm_section *sect, yasm_expr *boundval, /*@null@*/ yasm_expr *fillval, /*@null@*/ yasm_expr *maxskipval, @@ -70,12 +76,6 @@ static yasm_bytecode *gas_parser_dir_fill (yasm_parser_gas *parser_gas, /*@only@*/ yasm_expr *repeat, /*@only@*/ /*@null@*/ yasm_expr *size, /*@only@*/ /*@null@*/ yasm_expr *value); -#if 0 -static void gas_parser_directive - (yasm_parser_gas *parser_gas, const char *name, - yasm_valparamhead *valparams, - /*@null@*/ yasm_valparamhead *objext_valparams); -#endif #define is_eol_tok(tok) ((tok) == '\n' || (tok) == ';' || (tok) == 0) #define is_eol() is_eol_tok(curtok) @@ -87,7 +87,7 @@ get_peek_token(yasm_parser_gas *parser_gas) { char savech = parser_gas->tokch; if (parser_gas->peek_token != NONE) - yasm_internal_error(N_("only can have one token of lookahead")); + yasm_internal_error(N_("can only have one token of lookahead")); parser_gas->peek_token = gas_parser_lex(&parser_gas->peek_tokval, parser_gas); parser_gas->peek_tokch = parser_gas->tokch; @@ -108,8 +108,6 @@ destroy_curtok_(yasm_parser_gas *parser_gas) break; case ID: case LABEL: - yasm_xfree(curval.str_val); - break; case STRING: yasm_xfree(curval.str.contents); break; @@ -153,8 +151,6 @@ expect_(yasm_parser_gas *parser_gas, int token) case INTNUM: str = "integer"; break; case FLTNUM: str = "floating point value"; break; case STRING: str = "string"; break; - case INSN: str = "instruction"; break; - case PREFIX: str = "instruction prefix"; break; case REG: str = "register"; break; case REGGROUP: str = "register group"; break; case SEGREG: str = "segment register"; break; @@ -163,27 +159,6 @@ expect_(yasm_parser_gas *parser_gas, int token) case RIGHT_OP: str = ">>"; break; case ID: str = "identifier"; break; case LABEL: str = "label"; break; - case LINE: - case DIR_ALIGN: - case DIR_ASCII: - case DIR_COMM: - case DIR_DATA: - case DIR_ENDR: - case DIR_EQU: - case DIR_FILE: - case DIR_FILL: - case DIR_LEB128: - case DIR_LINE: - case DIR_LOCAL: - case DIR_LCOMM: - case DIR_ORG: - case DIR_REPT: - case DIR_SECTION: - case DIR_SECTNAME: - case DIR_SKIP: - case DIR_ZERO: - str = "directive"; - break; default: strch[1] = token; str = strch; @@ -195,44 +170,14 @@ expect_(yasm_parser_gas *parser_gas, int token) } #define expect(token) expect_(parser_gas, token) -void -gas_parser_parse(yasm_parser_gas *parser_gas) -{ - while (get_next_token() != 0) { - yasm_bytecode *bc = NULL, *temp_bc; - - if (!is_eol()) { - bc = parse_line(parser_gas); - demand_eol(); - } - - yasm_errwarn_propagate(parser_gas->errwarns, cur_line); - - temp_bc = yasm_section_bcs_append(cursect, bc); - if (temp_bc) - parser_gas->prev_bc = temp_bc; - if (curtok == ';') - continue; /* don't advance line number until \n */ - if (parser_gas->save_input) - yasm_linemap_add_source(parser_gas->linemap, - temp_bc, - (char *)parser_gas->save_line[parser_gas->save_last ^ 1]); - yasm_linemap_goto_next(parser_gas->linemap); - parser_gas->dir_line++; /* keep track for .line followed by .file */ - } -} - static yasm_bytecode * parse_line(yasm_parser_gas *parser_gas) { yasm_bytecode *bc; yasm_expr *e; - yasm_intnum *intn; - yasm_datavalhead dvs; yasm_valparamhead vps; - yasm_valparam *vp; - unsigned int ival; char *id; + const dir_lookup *dir; if (is_eol()) return NULL; @@ -244,7 +189,15 @@ parse_line(yasm_parser_gas *parser_gas) switch (curtok) { case ID: id = ID_val; - parser_gas->state = INSTDIR; + + /* See if it's a gas-specific directive */ + dir = (const dir_lookup *)HAMT_search(parser_gas->dirs, id); + if (dir) { + parser_gas->state = dir->newstate; + get_next_token(); /* ID */ + return dir->handler(parser_gas, dir->param); + } + get_next_token(); /* ID */ if (curtok == ':') { /* Label */ @@ -288,401 +241,13 @@ parse_line(yasm_parser_gas *parser_gas) define_label(parser_gas, LABEL_val, 0); get_next_token(); /* LABEL */ return parse_line(parser_gas); - - /* Line directive */ - case DIR_LINE: - get_next_token(); /* DIR_LINE */ - - if (!expect(INTNUM)) return NULL; - if (yasm_intnum_sign(INTNUM_val) < 0) { - get_next_token(); /* INTNUM */ - yasm_error_set(YASM_ERROR_SYNTAX, - N_("line number is negative")); - return NULL; - } - - parser_gas->dir_line = yasm_intnum_get_uint(INTNUM_val); - yasm_intnum_destroy(INTNUM_val); - get_next_token(); /* INTNUM */ - - if (parser_gas->dir_fileline == 3) { - /* Have both file and line */ - yasm_linemap_set(parser_gas->linemap, NULL, - parser_gas->dir_line, 1); - } else if (parser_gas->dir_fileline == 1) { - /* Had previous file directive only */ - parser_gas->dir_fileline = 3; - yasm_linemap_set(parser_gas->linemap, parser_gas->dir_file, - parser_gas->dir_line, 1); - } else { - /* Didn't see file yet */ - parser_gas->dir_fileline = 2; - } + case CPP_LINE_MARKER: + get_next_token(); + cpp_line_marker(parser_gas); return NULL; - - /* Macro directives */ - case DIR_REPT: - get_next_token(); /* DIR_REPT */ - e = parse_expr(parser_gas); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expression expected after `%s'"), - ".rept"); - return NULL; - } - intn = yasm_expr_get_intnum(&e, 0); - - if (!intn) { - yasm_error_set(YASM_ERROR_NOT_ABSOLUTE, - N_("rept expression not absolute")); - } else if (yasm_intnum_sign(intn) < 0) { - yasm_error_set(YASM_ERROR_VALUE, - N_("rept expression is negative")); - } else { - gas_rept *rept = yasm_xmalloc(sizeof(gas_rept)); - STAILQ_INIT(&rept->lines); - rept->startline = cur_line; - rept->numrept = yasm_intnum_get_uint(intn); - rept->numdone = 0; - rept->line = NULL; - rept->linepos = 0; - rept->ended = 0; - rept->oldbuf = NULL; - rept->oldbuflen = 0; - rept->oldbufpos = 0; - parser_gas->rept = rept; - } - return NULL; - case DIR_ENDR: - get_next_token(); /* DIR_ENDR */ - /* Shouldn't ever get here unless we didn't get a DIR_REPT first */ - yasm_error_set(YASM_ERROR_SYNTAX, N_("endr without matching rept")); - return NULL; - - /* Alignment directives */ - case DIR_ALIGN: - { - yasm_expr *bound, *fill=NULL, *maxskip=NULL; - - ival = DIR_ALIGN_val; - get_next_token(); /* DIR_ALIGN */ - - bound = parse_expr(parser_gas); - if (!bound) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_(".align directive must specify alignment")); - return NULL; - } - - if (curtok == ',') { - get_next_token(); /* ',' */ - fill = parse_expr(parser_gas); - if (curtok == ',') { - get_next_token(); /* ',' */ - maxskip = parse_expr(parser_gas); - } - } - - return gas_parser_align(parser_gas, cursect, bound, fill, maxskip, - (int)ival); - } - case DIR_ORG: - get_next_token(); /* DIR_ORG */ - if (!expect(INTNUM)) return NULL; - /* TODO: support expr instead of intnum */ - bc = yasm_bc_create_org(yasm_intnum_get_uint(INTNUM_val), cur_line); - yasm_intnum_destroy(INTNUM_val); - get_next_token(); /* INTNUM */ - return bc; - - /* Data visibility directives */ - case DIR_LOCAL: - get_next_token(); /* DIR_LOCAL */ - if (!expect(ID)) return NULL; - yasm_symtab_declare(p_symtab, ID_val, YASM_SYM_DLOCAL, cur_line); - yasm_xfree(ID_val); - get_next_token(); /* ID */ - return NULL; - case DIR_COMM: - case DIR_LCOMM: - { - yasm_expr *align = NULL; - /*@null@*/ /*@dependent@*/ yasm_symrec *sym; - int is_lcomm = curtok == DIR_LCOMM; - - get_next_token(); /* DIR_LOCAL */ - - if (!expect(ID)) return NULL; - id = ID_val; - get_next_token(); /* ID */ - if (!expect(',')) { - yasm_xfree(id); - return NULL; - } - get_next_token(); /* , */ - e = parse_expr(parser_gas); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, N_("size expected for `%s'"), - ".COMM"); - return NULL; - } - if (curtok == ',') { - /* Optional alignment expression */ - get_next_token(); /* ',' */ - align = parse_expr(parser_gas); - } - /* If already explicitly declared local, treat like LCOMM */ - if (is_lcomm - || ((sym = yasm_symtab_get(p_symtab, id)) - && yasm_symrec_get_visibility(sym) == YASM_SYM_DLOCAL)) { - define_lcomm(parser_gas, id, e, align); - } else if (align) { - /* Give third parameter as objext valparam */ - yasm_valparamhead *extvps = yasm_vps_create(); - vp = yasm_vp_create_expr(NULL, align); - yasm_vps_append(extvps, vp); - - sym = yasm_symtab_declare(p_symtab, id, YASM_SYM_COMMON, - cur_line); - yasm_symrec_set_common_size(sym, e); - yasm_symrec_set_objext_valparams(sym, extvps); - - yasm_xfree(id); - } else { - sym = yasm_symtab_declare(p_symtab, id, YASM_SYM_COMMON, - cur_line); - yasm_symrec_set_common_size(sym, e); - yasm_xfree(id); - } - return NULL; - } - - /* Integer data definition directives */ - case DIR_ASCII: - ival = DIR_ASCII_val; - get_next_token(); /* DIR_ASCII */ - if (!parse_strvals(parser_gas, &dvs)) - return NULL; - return yasm_bc_create_data(&dvs, 1, (int)ival, p_object->arch, - cur_line); - case DIR_DATA: - ival = DIR_DATA_val; - get_next_token(); /* DIR_DATA */ - if (!parse_datavals(parser_gas, &dvs)) - return NULL; - return yasm_bc_create_data(&dvs, ival, 0, p_object->arch, - cur_line); - case DIR_LEB128: - ival = DIR_LEB128_val; - get_next_token(); /* DIR_LEB128 */ - if (!parse_datavals(parser_gas, &dvs)) - return NULL; - return yasm_bc_create_leb128(&dvs, (int)ival, cur_line); - - /* Empty space / fill data definition directives */ - case DIR_ZERO: - get_next_token(); /* DIR_ZERO */ - e = parse_expr(parser_gas); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expression expected after `%s'"), ".ZERO"); - return NULL; - } - - yasm_dvs_initialize(&dvs); - yasm_dvs_append(&dvs, yasm_dv_create_expr( - p_expr_new_ident(yasm_expr_int(yasm_intnum_create_uint(0))))); - bc = yasm_bc_create_data(&dvs, 1, 0, p_object->arch, cur_line); - yasm_bc_set_multiple(bc, e); - return bc; - case DIR_SKIP: - { - yasm_expr *e_val; - - get_next_token(); /* DIR_SKIP */ - e = parse_expr(parser_gas); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expression expected after `%s'"), ".SKIP"); - return NULL; - } - if (curtok != ',') - return yasm_bc_create_reserve(e, 1, cur_line); - get_next_token(); /* ',' */ - e_val = parse_expr(parser_gas); - yasm_dvs_initialize(&dvs); - yasm_dvs_append(&dvs, yasm_dv_create_expr(e_val)); - bc = yasm_bc_create_data(&dvs, 1, 0, p_object->arch, cur_line); - - yasm_bc_set_multiple(bc, e); - return bc; - } - - /* fill data definition directive */ - case DIR_FILL: - { - yasm_expr *sz=NULL, *val=NULL; - get_next_token(); /* DIR_FILL */ - e = parse_expr(parser_gas); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expression expected after `%s'"), ".FILL"); - return NULL; - } - if (curtok == ',') { - get_next_token(); /* ',' */ - sz = parse_expr(parser_gas); - if (curtok == ',') { - get_next_token(); /* ',' */ - val = parse_expr(parser_gas); - } - } - return gas_parser_dir_fill(parser_gas, e, sz, val); - } - - /* Section directives */ - case DIR_SECTNAME: - gas_switch_section(parser_gas, DIR_SECTNAME_val, NULL, NULL, NULL, - 1); - get_next_token(); /* DIR_SECTNAME */ - return NULL; - case DIR_SECTION: - { - /* DIR_SECTION ID ',' STRING ',' '@' ID ',' dirvals */ - char *sectname, *flags = NULL, *type = NULL; - int have_vps = 0; - - get_next_token(); /* DIR_SECTION */ - - if (!expect(ID)) return NULL; - sectname = ID_val; - get_next_token(); /* ID */ - - if (curtok == ',') { - get_next_token(); /* ',' */ - if (!expect(STRING)) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("flag string expected")); - yasm_xfree(sectname); - return NULL; - } - flags = STRING_val.contents; - get_next_token(); /* STRING */ - } - - if (curtok == ',') { - get_next_token(); /* ',' */ - if (!expect('@')) { - yasm_xfree(sectname); - yasm_xfree(flags); - return NULL; - } - get_next_token(); /* '@' */ - if (!expect(ID)) { - yasm_xfree(sectname); - yasm_xfree(flags); - return NULL; - } - type = ID_val; - get_next_token(); /* ID */ - } - - if (curtok == ',') { - get_next_token(); /* ',' */ - if (parse_dirvals(parser_gas, &vps)) - have_vps = 1; - } - - gas_switch_section(parser_gas, sectname, flags, type, - have_vps ? &vps : NULL, 0); - yasm_xfree(flags); - return NULL; - } - - /* Other directives */ - case DIR_EQU: - /* ID ',' expr */ - get_next_token(); /* DIR_EQU */ - if (!expect(ID)) return NULL; - id = ID_val; - get_next_token(); /* ID */ - if (!expect(',')) { - yasm_xfree(id); - return NULL; - } - get_next_token(); /* ',' */ - e = parse_expr(parser_gas); - if (e) - yasm_symtab_define_equ(p_symtab, id, e, cur_line); - else - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expression expected after `%s'"), ","); - yasm_xfree(id); - return NULL; - - case DIR_FILE: - get_next_token(); /* DIR_FILE */ - if (curtok == STRING) { - /* No file number; this form also sets the assembler's - * internal line number. - */ - char *filename = STRING_val.contents; - get_next_token(); /* STRING */ - if (parser_gas->dir_fileline == 3) { - /* Have both file and line */ - const char *old_fn; - unsigned long old_line; - - yasm_linemap_lookup(parser_gas->linemap, cur_line, &old_fn, - &old_line); - yasm_linemap_set(parser_gas->linemap, filename, old_line, - 1); - } else if (parser_gas->dir_fileline == 2) { - /* Had previous line directive only */ - parser_gas->dir_fileline = 3; - yasm_linemap_set(parser_gas->linemap, filename, - parser_gas->dir_line, 1); - } else { - /* Didn't see line yet, save file */ - parser_gas->dir_fileline = 1; - if (parser_gas->dir_file) - yasm_xfree(parser_gas->dir_file); - parser_gas->dir_file = yasm__xstrdup(filename); - } - - /* Pass change along to debug format */ - yasm_vps_initialize(&vps); - vp = yasm_vp_create_string(NULL, filename); - yasm_vps_append(&vps, vp); - - yasm_object_directive(p_object, ".file", "gas", &vps, NULL, - cur_line); - - yasm_vps_delete(&vps); - return NULL; - } - - /* fileno filename form */ - yasm_vps_initialize(&vps); - - if (!expect(INTNUM)) return NULL; - vp = yasm_vp_create_expr(NULL, - p_expr_new_ident(yasm_expr_int(INTNUM_val))); - yasm_vps_append(&vps, vp); - get_next_token(); /* INTNUM */ - - if (!expect(STRING)) { - yasm_vps_delete(&vps); - return NULL; - } - vp = yasm_vp_create_string(NULL, STRING_val.contents); - yasm_vps_append(&vps, vp); - get_next_token(); /* STRING */ - - yasm_object_directive(p_object, ".file", "gas", &vps, NULL, - cur_line); - - yasm_vps_delete(&vps); + case NASM_LINE_MARKER: + get_next_token(); + nasm_line_marker(parser_gas); return NULL; default: yasm_error_set(YASM_ERROR_SYNTAX, @@ -691,68 +256,747 @@ parse_line(yasm_parser_gas *parser_gas) } } +/* + Handle line markers generated by cpp. + + We expect a positive integer (line) followed by a string (filename). If we + fail to find either of these, we treat the line as a comment. There is a + possibility of false positives (mistaking a comment for a line marker, when + the comment is not intended as a line marker) but this cannot be avoided + without adding a filter to the input before passing it to cpp. + + This function is only called if the preprocessor was 'cpp', since the + CPP_LINE_MARKER token isn't generated for any other preprocessor. With any + other preprocessor, anything after a '#' is always treated as a comment. +*/ +static void +cpp_line_marker(yasm_parser_gas *parser_gas) +{ + yasm_valparamhead vps; + yasm_valparam *vp; + unsigned long line; + char *filename; + + /* Line number. */ + if (curtok != INTNUM) { + /* Skip over a comment. */ + while (curtok != '\n') + get_next_token(); + + return; + } + + if (yasm_intnum_sign(INTNUM_val) < 0) { + get_next_token(); /* INTNUM */ + yasm_error_set(YASM_ERROR_SYNTAX, + N_("line number is negative")); + return; + } + + line = yasm_intnum_get_uint(INTNUM_val); + + /* + Set to (line - 1) since the directive indicates that the *next* line + will have the number given. + + cpp should never produce line=0, but the if keeps us safe just incase. + */ + if (line != 0) + line--; + + yasm_intnum_destroy(INTNUM_val); + get_next_token(); /* INTNUM */ + + /* File name, in quotes. */ + if (curtok != STRING) { + /* Skip over a comment. */ + while (curtok != '\n') + get_next_token(); + + return; + } + + filename = STRING_val.contents; + get_next_token(); + + /* Set linemap. */ + yasm_linemap_set(parser_gas->linemap, filename, 0, line, 1); + + /* + The first line marker in the file (which should be on the first line + of the file) will give us the name of the source file. This information + needs to be passed on to the debug format module. + */ + if (parser_gas->seen_line_marker == 0) { + parser_gas->seen_line_marker = 1; + + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, filename); + yasm_vps_append(&vps, vp); + + yasm_object_directive(p_object, ".file", "gas", &vps, NULL, cur_line); + + yasm_vps_delete(&vps); + } else + yasm_xfree(filename); + + /* Skip flags. */ + while (1) { + switch (curtok) { + case INTNUM: + break; + + case '\n': + return; + + default: + yasm_error_set(YASM_ERROR_SYNTAX, + N_("junk at end of cpp line marker")); + return; + } + get_next_token(); + } +} + +/* + Handle line markers generated by the nasm preproc. + + We expect a positive integer (line) followed by a plus sign, followed by + another positive integer, followed by a string (filename). + + This function is only called if the preprocessor was 'nasm', since the + NASM_LINE_MARKER token isn't generated for any other preprocessor. +*/ +static void +nasm_line_marker(yasm_parser_gas *parser_gas) +{ + yasm_valparamhead vps; + yasm_valparam *vp; + unsigned long line, incr; + char *filename; + + /* Line number. */ + if (!expect(INTNUM)) return; + + if (yasm_intnum_sign(INTNUM_val) < 0) { + get_next_token(); /* INTNUM */ + yasm_error_set(YASM_ERROR_SYNTAX, + N_("line number is negative")); + return; + } + + line = yasm_intnum_get_uint(INTNUM_val); + + /* + Set to (line - 1) since the directive indicates that the *next* line + will have the number given. + + cpp should never produce line=0, but the if keeps us safe just incase. + */ + if (line != 0) + line--; + + yasm_intnum_destroy(INTNUM_val); + get_next_token(); /* INTNUM */ + + if (!expect('+')) return; + get_next_token(); /* + */ + + /* Line number increment. */ + if (!expect(INTNUM)) return; + + if (yasm_intnum_sign(INTNUM_val) < 0) { + get_next_token(); /* INTNUM */ + yasm_error_set(YASM_ERROR_SYNTAX, + N_("line increment is negative")); + return; + } + + incr = yasm_intnum_get_uint(INTNUM_val); + yasm_intnum_destroy(INTNUM_val); + + /* File name is not in quotes, so need to switch to a different tokenizer + * state. + */ + parser_gas->state = NASM_FILENAME; + get_next_token(); /* INTNUM */ + if (!expect(STRING)) { + parser_gas->state = INITIAL; + return; + } + + filename = STRING_val.contents; + + /* Set linemap. */ + yasm_linemap_set(parser_gas->linemap, filename, 0, line, incr); + + /* + The first line marker in the file (which should be on the first line + of the file) will give us the name of the source file. This information + needs to be passed on to the debug format module. + */ + if (parser_gas->seen_line_marker == 0) { + parser_gas->seen_line_marker = 1; + + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, filename); + yasm_vps_append(&vps, vp); + + yasm_object_directive(p_object, ".file", "gas", &vps, NULL, cur_line); + + yasm_vps_delete(&vps); + } else + yasm_xfree(filename); + + /* We need to poke back on the \n that was consumed by the tokenizer */ + parser_gas->peek_token = '\n'; + get_next_token(); +} + +/* Line directive */ +static yasm_bytecode * +dir_line(yasm_parser_gas *parser_gas, unsigned int param) +{ + if (!expect(INTNUM)) return NULL; + if (yasm_intnum_sign(INTNUM_val) < 0) { + get_next_token(); /* INTNUM */ + yasm_error_set(YASM_ERROR_SYNTAX, + N_("line number is negative")); + return NULL; + } + + parser_gas->dir_line = yasm_intnum_get_uint(INTNUM_val); + yasm_intnum_destroy(INTNUM_val); + get_next_token(); /* INTNUM */ + + if (parser_gas->dir_fileline == 3) { + /* Have both file and line */ + yasm_linemap_set(parser_gas->linemap, NULL, 0, + parser_gas->dir_line, 1); + } else if (parser_gas->dir_fileline == 1) { + /* Had previous file directive only */ + parser_gas->dir_fileline = 3; + yasm_linemap_set(parser_gas->linemap, parser_gas->dir_file, 0, + parser_gas->dir_line, 1); + } else { + /* Didn't see file yet */ + parser_gas->dir_fileline = 2; + } + return NULL; +} + +/* Alignment directives */ + +static yasm_bytecode * +dir_align(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_expr *bound, *fill=NULL, *maxskip=NULL; + + bound = parse_expr(parser_gas); + if (!bound) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_(".align directive must specify alignment")); + return NULL; + } + + if (curtok == ',') { + get_next_token(); /* ',' */ + fill = parse_expr(parser_gas); + if (curtok == ',') { + get_next_token(); /* ',' */ + maxskip = parse_expr(parser_gas); + } + } + + return gas_parser_align(parser_gas, cursect, bound, fill, maxskip, + (int)param); +} + +static yasm_bytecode * +dir_org(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_intnum *start, *value=NULL; + yasm_bytecode *bc; + + /* TODO: support expr instead of intnum */ + if (!expect(INTNUM)) return NULL; + start = INTNUM_val; + get_next_token(); /* INTNUM */ + + if (curtok == ',') { + get_next_token(); /* ',' */ + /* TODO: support expr instead of intnum */ + if (!expect(INTNUM)) return NULL; + value = INTNUM_val; + get_next_token(); /* INTNUM */ + } + if (value) { + bc = yasm_bc_create_org(yasm_intnum_get_uint(start), + yasm_intnum_get_uint(value), cur_line); + yasm_intnum_destroy(value); + } else + bc = yasm_bc_create_org(yasm_intnum_get_uint(start), 0, + cur_line); + yasm_intnum_destroy(start); + return bc; +} + +/* Data visibility directives */ + +static yasm_bytecode * +dir_local(yasm_parser_gas *parser_gas, unsigned int param) +{ + if (!expect(ID)) return NULL; + yasm_symtab_declare(p_symtab, ID_val, YASM_SYM_DLOCAL, cur_line); + yasm_xfree(ID_val); + get_next_token(); /* ID */ + return NULL; +} + +static yasm_bytecode * +dir_comm(yasm_parser_gas *parser_gas, unsigned int is_lcomm) +{ + yasm_expr *align = NULL; + /*@null@*/ /*@dependent@*/ yasm_symrec *sym; + char *id; + yasm_expr *e; + + if (!expect(ID)) return NULL; + id = ID_val; + get_next_token(); /* ID */ + if (!expect(',')) { + yasm_xfree(id); + return NULL; + } + get_next_token(); /* , */ + e = parse_expr(parser_gas); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("size expected for `%s'"), + ".COMM"); + return NULL; + } + if (curtok == ',') { + /* Optional alignment expression */ + get_next_token(); /* ',' */ + align = parse_expr(parser_gas); + } + /* If already explicitly declared local, treat like LCOMM */ + if (is_lcomm + || ((sym = yasm_symtab_get(p_symtab, id)) + && yasm_symrec_get_visibility(sym) == YASM_SYM_DLOCAL)) { + define_lcomm(parser_gas, id, e, align); + } else if (align) { + /* Give third parameter as objext valparam */ + yasm_valparamhead *extvps = yasm_vps_create(); + yasm_valparam *vp = yasm_vp_create_expr(NULL, align); + yasm_vps_append(extvps, vp); + + sym = yasm_symtab_declare(p_symtab, id, YASM_SYM_COMMON, + cur_line); + yasm_symrec_set_common_size(sym, e); + yasm_symrec_set_objext_valparams(sym, extvps); + + yasm_xfree(id); + } else { + sym = yasm_symtab_declare(p_symtab, id, YASM_SYM_COMMON, + cur_line); + yasm_symrec_set_common_size(sym, e); + yasm_xfree(id); + } + return NULL; +} + +/* Integer data definition directives */ + +static yasm_bytecode * +dir_ascii(yasm_parser_gas *parser_gas, unsigned int withzero) +{ + yasm_datavalhead dvs; + if (!parse_strvals(parser_gas, &dvs)) + return NULL; + return yasm_bc_create_data(&dvs, 1, (int)withzero, p_object->arch, + cur_line); +} + +static yasm_bytecode * +dir_data(yasm_parser_gas *parser_gas, unsigned int size) +{ + yasm_datavalhead dvs; + if (!parse_datavals(parser_gas, &dvs)) + return NULL; + return yasm_bc_create_data(&dvs, size, 0, p_object->arch, cur_line); +} + +static yasm_bytecode * +dir_leb128(yasm_parser_gas *parser_gas, unsigned int sign) +{ + yasm_datavalhead dvs; + if (!parse_datavals(parser_gas, &dvs)) + return NULL; + return yasm_bc_create_leb128(&dvs, (int)sign, cur_line); +} + +/* Empty space / fill data definition directives */ + +static yasm_bytecode * +dir_zero(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_bytecode *bc; + yasm_datavalhead dvs; + yasm_expr *e = parse_expr(parser_gas); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expression expected after `%s'"), ".ZERO"); + return NULL; + } + + yasm_dvs_initialize(&dvs); + yasm_dvs_append(&dvs, yasm_dv_create_expr( + p_expr_new_ident(yasm_expr_int(yasm_intnum_create_uint(0))))); + bc = yasm_bc_create_data(&dvs, 1, 0, p_object->arch, cur_line); + yasm_bc_set_multiple(bc, e); + return bc; +} + +static yasm_bytecode * +dir_skip(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_expr *e, *e_val; + yasm_bytecode *bc; + yasm_datavalhead dvs; + + e = parse_expr(parser_gas); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expression expected after `%s'"), ".SKIP"); + return NULL; + } + if (curtok != ',') + return yasm_bc_create_reserve(e, 1, cur_line); + get_next_token(); /* ',' */ + e_val = parse_expr(parser_gas); + yasm_dvs_initialize(&dvs); + yasm_dvs_append(&dvs, yasm_dv_create_expr(e_val)); + bc = yasm_bc_create_data(&dvs, 1, 0, p_object->arch, cur_line); + + yasm_bc_set_multiple(bc, e); + return bc; +} + +/* fill data definition directive */ +static yasm_bytecode * +dir_fill(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_expr *sz=NULL, *val=NULL; + yasm_expr *e = parse_expr(parser_gas); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expression expected after `%s'"), ".FILL"); + return NULL; + } + if (curtok == ',') { + get_next_token(); /* ',' */ + sz = parse_expr(parser_gas); + if (curtok == ',') { + get_next_token(); /* ',' */ + val = parse_expr(parser_gas); + } + } + return gas_parser_dir_fill(parser_gas, e, sz, val); +} + +/* Section directives */ + +static yasm_bytecode * +dir_bss_section(yasm_parser_gas *parser_gas, unsigned int param) +{ + gas_switch_section(parser_gas, ".bss", NULL, NULL, NULL, 1); + return NULL; +} + +static yasm_bytecode * +dir_data_section(yasm_parser_gas *parser_gas, unsigned int param) +{ + gas_switch_section(parser_gas, ".data", NULL, NULL, NULL, 1); + return NULL; +} + +static yasm_bytecode * +dir_text_section(yasm_parser_gas *parser_gas, unsigned int param) +{ + gas_switch_section(parser_gas, ".text", NULL, NULL, NULL, 1); + return NULL; +} + +static yasm_bytecode * +dir_section(yasm_parser_gas *parser_gas, unsigned int param) +{ + /* DIR_SECTION ID ',' STRING ',' '@' ID ',' dirvals */ + char *sectname, *flags = NULL, *type = NULL; + yasm_valparamhead vps; + int have_vps = 0; + + if (!expect(ID)) return NULL; + sectname = ID_val; + get_next_token(); /* ID */ + + if (curtok == ',') { + get_next_token(); /* ',' */ + if (!expect(STRING)) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("flag string expected")); + yasm_xfree(sectname); + return NULL; + } + flags = STRING_val.contents; + get_next_token(); /* STRING */ + } + + if (curtok == ',') { + get_next_token(); /* ',' */ + if (!expect('@')) { + yasm_xfree(sectname); + yasm_xfree(flags); + return NULL; + } + get_next_token(); /* '@' */ + if (!expect(ID)) { + yasm_xfree(sectname); + yasm_xfree(flags); + return NULL; + } + type = ID_val; + get_next_token(); /* ID */ + } + + if (curtok == ',') { + get_next_token(); /* ',' */ + if (parse_dirvals(parser_gas, &vps)) + have_vps = 1; + } + + gas_switch_section(parser_gas, sectname, flags, type, + have_vps ? &vps : NULL, 0); + yasm_xfree(sectname); + yasm_xfree(flags); + return NULL; +} + +/* Other directives */ + +static yasm_bytecode * +dir_equ(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_expr *e; + char *id; + + /* ID ',' expr */ + if (!expect(ID)) return NULL; + id = ID_val; + get_next_token(); /* ID */ + if (!expect(',')) { + yasm_xfree(id); + return NULL; + } + get_next_token(); /* ',' */ + e = parse_expr(parser_gas); + if (e) + yasm_symtab_define_equ(p_symtab, id, e, cur_line); + else + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expression expected after `%s'"), ","); + yasm_xfree(id); + return NULL; +} + +static yasm_bytecode * +dir_file(yasm_parser_gas *parser_gas, unsigned int param) +{ + yasm_valparamhead vps; + yasm_valparam *vp; + + if (curtok == STRING) { + /* No file number; this form also sets the assembler's + * internal line number. + */ + char *filename = STRING_val.contents; + + get_next_token(); /* STRING */ + if (parser_gas->dir_fileline == 3) { + /* Have both file and line */ + const char *old_fn; + unsigned long old_line; + + yasm_linemap_lookup(parser_gas->linemap, cur_line, &old_fn, + &old_line); + yasm_linemap_set(parser_gas->linemap, filename, 0, old_line, + 1); + } else if (parser_gas->dir_fileline == 2) { + /* Had previous line directive only */ + parser_gas->dir_fileline = 3; + yasm_linemap_set(parser_gas->linemap, filename, 0, + parser_gas->dir_line, 1); + } else { + /* Didn't see line yet, save file */ + parser_gas->dir_fileline = 1; + if (parser_gas->dir_file) + yasm_xfree(parser_gas->dir_file); + parser_gas->dir_file = yasm__xstrdup(filename); + } + + /* Pass change along to debug format */ + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, filename); + yasm_vps_append(&vps, vp); + + yasm_object_directive(p_object, ".file", "gas", &vps, NULL, + cur_line); + + yasm_vps_delete(&vps); + return NULL; + } + + /* fileno filename form */ + yasm_vps_initialize(&vps); + + if (!expect(INTNUM)) return NULL; + vp = yasm_vp_create_expr(NULL, + p_expr_new_ident(yasm_expr_int(INTNUM_val))); + yasm_vps_append(&vps, vp); + get_next_token(); /* INTNUM */ + + if (!expect(STRING)) { + yasm_vps_delete(&vps); + return NULL; + } + vp = yasm_vp_create_string(NULL, STRING_val.contents); + yasm_vps_append(&vps, vp); + get_next_token(); /* STRING */ + + yasm_object_directive(p_object, ".file", "gas", &vps, NULL, + cur_line); + + yasm_vps_delete(&vps); + return NULL; +} + + +static yasm_bytecode * +dir_intel_syntax(yasm_parser_gas *parser_gas, unsigned int param) +{ + parser_gas->intel_syntax = 1; + + do { + destroy_curtok(); + get_next_token(); + } while (!is_eol()); + return NULL; +} + +static yasm_bytecode * +dir_att_syntax(yasm_parser_gas *parser_gas, unsigned int param) +{ + parser_gas->intel_syntax = 0; + return NULL; +} + static yasm_bytecode * parse_instr(yasm_parser_gas *parser_gas) { yasm_bytecode *bc; + char *id; + uintptr_t prefix; - switch (curtok) { - case INSN: + if (parser_gas->intel_syntax) { + bc = parse_instr_intel(parser_gas); + if (bc) { + yasm_warn_disable(YASM_WARN_UNREC_CHAR); + do { + destroy_curtok(); + get_next_token(); + } while (!is_eol()); + yasm_warn_enable(YASM_WARN_UNREC_CHAR); + } + return bc; + } + + if (curtok != ID) + return NULL; + + id = ID_val; + + /* instructions/prefixes must start with a letter */ + if (!isalpha(id[0])) + return NULL; + + /* check to be sure it's not a label or equ */ + get_peek_token(parser_gas); + if (parser_gas->peek_token == ':' || parser_gas->peek_token == '=') + return NULL; + + switch (yasm_arch_parse_check_insnprefix + (p_object->arch, ID_val, ID_len, cur_line, &bc, &prefix)) { + case YASM_ARCH_INSN: { - yystype insn = curval; /* structure copy */ - yasm_insn_operands operands; - int num_operands = 0; + yasm_insn *insn; - get_next_token(); - if (is_eol()) { - /* no operands */ - return yasm_bc_create_insn(p_object->arch, insn.arch_data, - 0, NULL, cur_line); - } + /* Propagate errors in case we got a warning from the arch */ + yasm_errwarn_propagate(parser_gas->errwarns, cur_line); + + insn = yasm_bc_get_insn(bc); + + yasm_xfree(id); + get_next_token(); /* ID */ + if (is_eol()) + return bc; /* no operands */ /* parse operands */ - yasm_ops_initialize(&operands); for (;;) { yasm_insn_operand *op = parse_operand(parser_gas); if (!op) { yasm_error_set(YASM_ERROR_SYNTAX, N_("expression syntax error")); - yasm_ops_delete(&operands, 1); + yasm_bc_destroy(bc); return NULL; } - yasm_ops_append(&operands, op); - num_operands++; + yasm_insn_ops_append(insn, op); if (is_eol()) break; if (!expect(',')) { - yasm_ops_delete(&operands, 1); + yasm_bc_destroy(bc); return NULL; } get_next_token(); } - return yasm_bc_create_insn(p_object->arch, insn.arch_data, - num_operands, &operands, cur_line); - } - case PREFIX: - { - yystype prefix = curval; /* structure copy */ - get_next_token(); /* PREFIX */ - bc = parse_instr(parser_gas); - if (!bc) - bc = yasm_bc_create_empty_insn(p_object->arch, cur_line); - yasm_bc_insn_add_prefix(bc, prefix.arch_data); return bc; } - case SEGREG: - { - uintptr_t segreg = SEGREG_val[0]; - get_next_token(); /* SEGREG */ + case YASM_ARCH_PREFIX: + /* Propagate errors in case we got a warning from the arch */ + yasm_errwarn_propagate(parser_gas->errwarns, cur_line); + + yasm_xfree(id); + get_next_token(); /* ID */ bc = parse_instr(parser_gas); if (!bc) - bc = yasm_bc_create_empty_insn(p_object->arch, cur_line); - yasm_bc_insn_add_seg_prefix(bc, segreg); - } + bc = yasm_arch_create_empty_insn(p_object->arch, cur_line); + yasm_insn_add_prefix(yasm_bc_get_insn(bc), prefix); + return bc; + default: + break; + } + + /* Check for segment register used as prefix */ + switch (yasm_arch_parse_check_regtmod(p_object->arch, ID_val, ID_len, + &prefix)) { + case YASM_ARCH_SEGREG: + yasm_xfree(id); + get_next_token(); /* ID */ + bc = parse_instr(parser_gas); + if (!bc) + bc = yasm_arch_create_empty_insn(p_object->arch, cur_line); + yasm_insn_add_seg_prefix(yasm_bc_get_insn(bc), prefix); + return bc; default: return NULL; } @@ -789,6 +1033,11 @@ parse_dirvals(yasm_parser_gas *parser_gas, yasm_valparamhead *vps) vp = yasm_vp_create_string(NULL, STRING_val.contents); get_next_token(); /* STRING */ break; + case REG: + e = p_expr_new_ident(yasm_expr_reg(REG_val)); + vp = yasm_vp_create_expr(NULL, e); + get_next_token(); /* REG */ + break; case '@': /* XXX: is throwing it away *really* the right thing? */ get_next_token(); /* @ */ @@ -869,7 +1118,7 @@ parse_memaddr(yasm_parser_gas *parser_gas) int strong = 0; if (curtok == SEGREG) { - uintptr_t segreg = SEGREG_val[0]; + uintptr_t segreg = SEGREG_val; get_next_token(); /* SEGREG */ if (!expect(':')) return NULL; get_next_token(); /* ':' */ @@ -900,7 +1149,7 @@ parse_memaddr(yasm_parser_gas *parser_gas) /* base register */ if (curtok == REG) { - e2 = p_expr_new_ident(yasm_expr_reg(REG_val[0])); + e2 = p_expr_new_ident(yasm_expr_reg(REG_val)); get_next_token(); /* REG */ } else e2 = p_expr_new_ident(yasm_expr_int(yasm_intnum_create_uint(0))); @@ -921,7 +1170,7 @@ parse_memaddr(yasm_parser_gas *parser_gas) /* index register */ if (curtok == REG) { - reg = REG_val[0]; + reg = REG_val; havereg = 1; get_next_token(); /* REG */ if (curtok != ',') { @@ -978,7 +1227,7 @@ done: return NULL; ea = yasm_arch_ea_create(p_object->arch, e1); if (strong) - yasm_ea_set_strong(ea, 1); + ea->strong = 1; return ea; } @@ -991,7 +1240,7 @@ parse_operand(yasm_parser_gas *parser_gas) switch (curtok) { case REG: - reg = REG_val[0]; + reg = REG_val; get_next_token(); /* REG */ return yasm_operand_create_reg(reg); case SEGREG: @@ -1003,13 +1252,13 @@ parse_operand(yasm_parser_gas *parser_gas) return NULL; return yasm_operand_create_mem(ea); } - reg = SEGREG_val[0]; + reg = SEGREG_val; get_next_token(); /* SEGREG */ return yasm_operand_create_segreg(reg); case REGGROUP: { unsigned long regindex; - reg = REGGROUP_val[0]; + reg = REGGROUP_val; get_next_token(); /* REGGROUP */ if (curtok != '(') return yasm_operand_create_reg(reg); @@ -1050,7 +1299,7 @@ parse_operand(yasm_parser_gas *parser_gas) case '*': get_next_token(); /* '*' */ if (curtok == REG) { - op = yasm_operand_create_reg(REG_val[0]); + op = yasm_operand_create_reg(REG_val); get_next_token(); /* REG */ } else { ea = parse_memaddr(parser_gas); @@ -1205,25 +1454,9 @@ parse_expr2(yasm_parser_gas *parser_gas) get_next_token(); return e; case ID: - case DIR_SECTNAME: { char *name = ID_val; get_next_token(); /* ID */ - if (curtok == '@') { - /* TODO: this is needed for shared objects, e.g. sym@PLT */ - get_next_token(); /* '@' */ - if (!expect(ID)) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expected identifier after `@'")); - yasm_xfree(name); - return NULL; - } - yasm_xfree(ID_val); - get_next_token(); /* ID */ - sym = yasm_symtab_use(p_symtab, name, cur_line); - yasm_xfree(name); - return p_expr_new_ident(yasm_expr_sym(sym)); - } /* "." references the current assembly position */ if (name[1] == '\0' && name[0] == '.') @@ -1232,6 +1465,28 @@ parse_expr2(yasm_parser_gas *parser_gas) else sym = yasm_symtab_use(p_symtab, name, cur_line); yasm_xfree(name); + + if (curtok == '@') { + yasm_symrec *wrt; + /* TODO: this is needed for shared objects, e.g. sym@PLT */ + get_next_token(); /* '@' */ + if (!expect(ID)) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected identifier after `@'")); + return NULL; + } + wrt = yasm_objfmt_get_special_sym(p_object, ID_val, "gas"); + yasm_xfree(ID_val); + get_next_token(); /* ID */ + if (!wrt) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("unrecognized identifier after `@'")); + return p_expr_new_ident(yasm_expr_sym(sym)); + } + return p_expr_new(yasm_expr_sym(sym), YASM_EXPR_WRT, + yasm_expr_sym(wrt)); + } + return p_expr_new_ident(yasm_expr_sym(sym)); } default: @@ -1312,7 +1567,7 @@ gas_get_section(yasm_parser_gas *parser_gas, char *name, } static void -gas_switch_section(yasm_parser_gas *parser_gas, char *name, +gas_switch_section(yasm_parser_gas *parser_gas, const char *name, /*@null@*/ char *flags, /*@null@*/ char *type, /*@null@*/ yasm_valparamhead *objext_valparams, int builtin) @@ -1328,8 +1583,6 @@ gas_switch_section(yasm_parser_gas *parser_gas, char *name, yasm_error_set(YASM_ERROR_GENERAL, N_("invalid section name `%s'"), name); - yasm_xfree(name); - if (objext_valparams) yasm_vps_delete(objext_valparams); } @@ -1402,26 +1655,112 @@ gas_parser_dir_fill(yasm_parser_gas *parser_gas, /*@only@*/ yasm_expr *repeat, return bc; } -#if 0 -static void -gas_parser_directive(yasm_parser_gas *parser_gas, const char *name, - yasm_valparamhead *valparams, - yasm_valparamhead *objext_valparams) -{ - unsigned long line = cur_line; - /* Handle (mostly) output-format independent directives here */ - if (!yasm_arch_parse_directive(p_object->arch, name, valparams, - objext_valparams, parser_gas->object, line)) { - ; - } else if (yasm_objfmt_directive(p_object, name, valparams, - objext_valparams, line)) { - yasm_error_set(YASM_ERROR_GENERAL, N_("unrecognized directive [%s]"), - name); +static dir_lookup dirs_static[] = { + /* FIXME: Whether this is power-of-two or not depends on arch and objfmt. */ + {".align", dir_align, 0, INITIAL}, + {".p2align", dir_align, 1, INITIAL}, + {".balign", dir_align, 0, INITIAL}, + {".org", dir_org, 0, INITIAL}, + /* data visibility directives */ + {".local", dir_local, 0, INITIAL}, + {".comm", dir_comm, 0, INITIAL}, + {".lcomm", dir_comm, 1, INITIAL}, + /* integer data declaration directives */ + {".byte", dir_data, 1, INITIAL}, + {".2byte", dir_data, 2, INITIAL}, + {".4byte", dir_data, 4, INITIAL}, + {".8byte", dir_data, 8, INITIAL}, + {".16byte", dir_data, 16, INITIAL}, + /* TODO: These should depend on arch */ + {".short", dir_data, 2, INITIAL}, + {".int", dir_data, 4, INITIAL}, + {".long", dir_data, 4, INITIAL}, + {".hword", dir_data, 2, INITIAL}, + {".quad", dir_data, 8, INITIAL}, + {".octa", dir_data, 16, INITIAL}, + /* XXX: At least on x86, this is 2 bytes */ + {".value", dir_data, 2, INITIAL}, + /* ASCII data declaration directives */ + {".ascii", dir_ascii, 0, INITIAL}, /* no terminating zero */ + {".asciz", dir_ascii, 1, INITIAL}, /* add terminating zero */ + {".string", dir_ascii, 1, INITIAL}, /* add terminating zero */ + /* LEB128 integer data declaration directives */ + {".sleb128", dir_leb128, 1, INITIAL}, /* signed */ + {".uleb128", dir_leb128, 0, INITIAL}, /* unsigned */ + /* floating point data declaration directives */ + {".float", dir_data, 4, INITIAL}, + {".single", dir_data, 4, INITIAL}, + {".double", dir_data, 8, INITIAL}, + {".tfloat", dir_data, 10, INITIAL}, + /* section directives */ + {".bss", dir_bss_section, 0, INITIAL}, + {".data", dir_data_section, 0, INITIAL}, + {".text", dir_text_section, 0, INITIAL}, + {".section", dir_section, 0, SECTION_DIRECTIVE}, + /* empty space/fill directives */ + {".skip", dir_skip, 0, INITIAL}, + {".space", dir_skip, 0, INITIAL}, + {".fill", dir_fill, 0, INITIAL}, + {".zero", dir_zero, 0, INITIAL}, + /* syntax directives */ + {".intel_syntax", dir_intel_syntax, 0, INITIAL}, + {".att_syntax", dir_att_syntax, 0, INITIAL}, + /* other directives */ + {".equ", dir_equ, 0, INITIAL}, + {".file", dir_file, 0, INITIAL}, + {".line", dir_line, 0, INITIAL}, + {".set", dir_equ, 0, INITIAL} +}; + +static void +no_delete(void *data) +{ +} + +void +gas_parser_parse(yasm_parser_gas *parser_gas) +{ + dir_lookup word; + unsigned int i; + int replace = 1; + + word.name = ".word"; + word.handler = dir_data; + word.param = yasm_arch_wordsize(p_object->arch)/8; + word.newstate = INITIAL; + + /* Create directive lookup */ + parser_gas->dirs = HAMT_create(1, yasm_internal_error_); + HAMT_insert(parser_gas->dirs, word.name, &word, &replace, no_delete); + for (i=0; idirs, dirs_static[i].name, + &dirs_static[i], &replace, no_delete); } - yasm_vps_delete(valparams); - if (objext_valparams) - yasm_vps_delete(objext_valparams); + while (get_next_token() != 0) { + yasm_bytecode *bc = NULL, *temp_bc; + + if (!is_eol()) { + bc = parse_line(parser_gas); + demand_eol(); + } + + yasm_errwarn_propagate(parser_gas->errwarns, cur_line); + + temp_bc = yasm_section_bcs_append(cursect, bc); + if (temp_bc) + parser_gas->prev_bc = temp_bc; + if (curtok == ';') + continue; /* don't advance line number until \n */ + if (parser_gas->save_input) + yasm_linemap_add_source(parser_gas->linemap, + temp_bc, + (char *)parser_gas->save_line[parser_gas->save_last ^ 1]); + yasm_linemap_goto_next(parser_gas->linemap); + parser_gas->dir_line++; /* keep track for .line followed by .file */ + } + + HAMT_destroy(parser_gas->dirs, no_delete); } -#endif diff --git a/modules/parsers/gas/gas-parser.c b/modules/parsers/gas/gas-parser.c index e2515341..088bcdad 100644 --- a/modules/parsers/gas/gas-parser.c +++ b/modules/parsers/gas/gas-parser.c @@ -28,32 +28,30 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "gas-parser.h" static void -gas_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, +gas_parser_do_parse(yasm_object *object, yasm_preproc *pp, int save_input, yasm_linemap *linemap, yasm_errwarns *errwarns) { yasm_parser_gas parser_gas; + int i; parser_gas.object = object; parser_gas.linemap = linemap; - parser_gas.in = f; - parser_gas.locallabel_base = (char *)NULL; parser_gas.locallabel_base_len = 0; parser_gas.dir_fileline = 0; parser_gas.dir_file = NULL; parser_gas.dir_line = 0; + parser_gas.seen_line_marker = 0; parser_gas.preproc = pp; parser_gas.errwarns = errwarns; @@ -65,24 +63,25 @@ gas_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, parser_gas.peek_token = NONE; + parser_gas.line = NULL; + /* initialize scanner structure */ yasm_scanner_initialize(&parser_gas.s); parser_gas.state = INITIAL; - parser_gas.rept = NULL; + for (i=0; i<10; i++) + parser_gas.local[i] = 0; - /* yacc debugging, needs YYDEBUG set in bison.y.in to work */ - parser_gas.debug = 1; + parser_gas.intel_syntax = 0; + + parser_gas.is_cpp_preproc = + yasm__strcasecmp(((yasm_preproc_base*)pp)->module->keyword, "cpp") == 0; + parser_gas.is_nasm_preproc = + yasm__strcasecmp(((yasm_preproc_base*)pp)->module->keyword, "nasm") == 0; gas_parser_parse(&parser_gas); - /* Check for ending inside a rept */ - if (parser_gas.rept) { - yasm_error_set(YASM_ERROR_SYNTAX, N_("rept without matching endr")); - yasm_errwarn_propagate(errwarns, parser_gas.rept->startline); - } - /* Check for ending inside a comment */ if (parser_gas.state == COMMENT) { yasm_warn_set(YASM_WARN_GENERAL, N_("end of file in comment")); @@ -108,7 +107,10 @@ gas_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, /* Define valid preprocessors to use with this parser */ static const char *gas_parser_preproc_keywords[] = { + "gas", "raw", + "cpp", + "nasm", NULL }; @@ -117,13 +119,15 @@ yasm_parser_module yasm_gas_LTX_parser = { "GNU AS (GAS)-compatible parser", "gas", gas_parser_preproc_keywords, - "raw", + "gas", + NULL, /* No standard macros */ gas_parser_do_parse }; yasm_parser_module yasm_gnu_LTX_parser = { "GNU AS (GAS)-compatible parser", "gnu", gas_parser_preproc_keywords, - "raw", + "gas", + NULL, /* No standard macros */ gas_parser_do_parse }; diff --git a/modules/parsers/gas/gas-parser.h b/modules/parsers/gas/gas-parser.h index 214048e0..99659e96 100644 --- a/modules/parsers/gas/gas-parser.h +++ b/modules/parsers/gas/gas-parser.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * GAS-compatible parser header file * * Copyright (C) 2005-2007 Peter Johnson @@ -38,8 +38,6 @@ enum tokentype { INTNUM = 258, FLTNUM, STRING, - INSN, - PREFIX, REG, REGGROUP, SEGREG, @@ -48,34 +46,17 @@ enum tokentype { RIGHT_OP, ID, LABEL, - LINE, - DIR_ALIGN, - DIR_ASCII, - DIR_COMM, - DIR_DATA, - DIR_ENDR, - DIR_EQU, - DIR_FILE, - DIR_FILL, - DIR_LEB128, - DIR_LINE, - DIR_LOCAL, - DIR_LCOMM, - DIR_ORG, - DIR_REPT, - DIR_SECTION, - DIR_SECTNAME, - DIR_SKIP, - DIR_ZERO, + CPP_LINE_MARKER, + NASM_LINE_MARKER, NONE }; typedef union { unsigned int int_info; - char *str_val; yasm_intnum *intn; yasm_floatnum *flt; - uintptr_t arch_data[4]; + yasm_bytecode *bc; + uintptr_t arch_data; struct { char *contents; size_t len; @@ -83,30 +64,14 @@ typedef union { } yystype; #define YYSTYPE yystype -typedef struct gas_rept_line { - STAILQ_ENTRY(gas_rept_line) link; - YYCTYPE *data; /* line characters */ - size_t len; /* length of data */ -} gas_rept_line; - -typedef struct gas_rept { - STAILQ_HEAD(reptlinelist, gas_rept_line) lines; /* repeated lines */ - unsigned long startline; /* line number of rept directive */ - unsigned long numrept; /* number of repititions to generate */ - unsigned long numdone; /* number of repititions executed so far */ - /*@null@*/ gas_rept_line *line; /* next line to repeat */ - size_t linepos; /* position to start pulling chars from line */ - int ended; /* seen endr directive yet? */ - - YYCTYPE *oldbuf; /* saved previous fill buffer */ - size_t oldbuflen; /* previous fill buffer length */ - size_t oldbufpos; /* position in previous fill buffer */ -} gas_rept; +enum gas_parser_state { + INITIAL, + COMMENT, + SECTION_DIRECTIVE, + NASM_FILENAME +}; typedef struct yasm_parser_gas { - FILE *in; - int debug; - /*@only@*/ yasm_object *object; /* last "base" label for local (.) labels */ @@ -118,6 +83,9 @@ typedef struct yasm_parser_gas { /*@null@*/ char *dir_file; unsigned long dir_line; + /* Have we seen a line marker? */ + int seen_line_marker; + /*@dependent@*/ yasm_preproc *preproc; /*@dependent@*/ yasm_errwarns *errwarns; @@ -130,13 +98,12 @@ typedef struct yasm_parser_gas { YYCTYPE save_line[2][MAX_SAVED_LINE_LEN]; int save_last; + /* Line data storage used in preproc_input(). */ + char *line, *linepos; + size_t lineleft; + yasm_scanner s; - enum { - INITIAL, - COMMENT, - SECTION_DIRECTIVE, - INSTDIR - } state; + enum gas_parser_state state; int token; /* enum tokentype or any character */ yystype tokval; @@ -147,7 +114,18 @@ typedef struct yasm_parser_gas { yystype peek_tokval; char peek_tokch; - /*@null@*/ gas_rept *rept; + /* Index of local labels; what's stored here is the /next/ index, + * so these are all 0 at start. + */ + unsigned long local[10]; + + /* Parser-handled directives HAMT lookup */ + HAMT *dirs; + + int intel_syntax; + + int is_nasm_preproc; + int is_cpp_preproc; } yasm_parser_gas; /* shorter access names to commonly used parser_gas fields */ @@ -160,19 +138,14 @@ typedef struct yasm_parser_gas { #define INTNUM_val (curval.intn) #define FLTNUM_val (curval.flt) #define STRING_val (curval.str) -#define INSN_val (curval.arch_data) -#define PREFIX_val (curval.arch_data) #define REG_val (curval.arch_data) #define REGGROUP_val (curval.arch_data) #define SEGREG_val (curval.arch_data) #define TARGETMOD_val (curval.arch_data) -#define ID_val (curval.str_val) -#define LABEL_val (curval.str_val) -#define DIR_ALIGN_val (curval.int_info) -#define DIR_ASCII_val (curval.int_info) -#define DIR_DATA_val (curval.int_info) -#define DIR_LEB128_val (curval.int_info) -#define DIR_SECTNAME_val (curval.str_val) +#define ID_val (curval.str.contents) +#define ID_len (curval.str.len) +#define LABEL_val (curval.str.contents) +#define LABEL_len (curval.str.len) #define cur_line (yasm_linemap_get_current(parser_gas->linemap)) @@ -181,6 +154,8 @@ typedef struct yasm_parser_gas { #define p_expr_new_branch(o,r) yasm_expr_create_branch(o,r,cur_line) #define p_expr_new_ident(r) yasm_expr_create_ident(r,cur_line) +yasm_bytecode *parse_instr_intel(yasm_parser_gas *parser_gas); + void gas_parser_parse(yasm_parser_gas *parser_gas); void gas_parser_cleanup(yasm_parser_gas *parser_gas); int gas_parser_lex(YYSTYPE *lvalp, yasm_parser_gas *parser_gas); diff --git a/modules/parsers/gas/gas-token.re b/modules/parsers/gas/gas-token.re index 69d816b1..1a8673db 100644 --- a/modules/parsers/gas/gas-token.re +++ b/modules/parsers/gas/gas-token.re @@ -28,9 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "modules/parsers/gas/gas-parser.h" @@ -43,88 +41,49 @@ RCSID("$Id$"); #define YYMARKER (s->ptr) #define YYFILL(n) {cursor = fill(parser_gas, cursor);} -#define RETURN(i) {s->cur = cursor; parser_gas->tokch = s->tok[0]; \ - return i;} +#define RETURN(i) do {s->cur = cursor; parser_gas->tokch = s->tok[0]; \ + return i;} while (0) #define SCANINIT() {s->tok = cursor;} #define TOK ((char *)s->tok) #define TOKLEN (size_t)(cursor-s->tok) +/* Bridge function to convert byte-oriented parser with line-oriented + * preprocessor. + */ static size_t -rept_input(yasm_parser_gas *parser_gas, /*@out@*/ YYCTYPE *buf, - size_t max_size) +preproc_input(yasm_parser_gas *parser_gas, /*@out@*/ YYCTYPE *buf, + size_t max_size) { - gas_rept *rept = parser_gas->rept; - size_t numleft = max_size; - YYCTYPE *bufp = buf; + size_t tot=0; + while (max_size > 0) { + size_t n; - /* If numrept is 0, copy out just the line end characters */ - if (rept->numrept == 0) { - /* Skip first line, which contains .line */ - rept->line = STAILQ_NEXT(rept->line, link); - if (!rept->line) { - rept->numrept = 1; - rept->numdone = 1; + if (!parser_gas->line) { + parser_gas->line = yasm_preproc_get_line(parser_gas->preproc); + if (!parser_gas->line) + return tot; /* EOF */ + parser_gas->linepos = parser_gas->line; + parser_gas->lineleft = strlen(parser_gas->line) + 1; + parser_gas->line[parser_gas->lineleft-1] = '\n'; } - while (rept->numrept == 0 && numleft > 0) { - *bufp++ = rept->line->data[rept->line->len-1]; - rept->line = STAILQ_NEXT(rept->line, link); - if (!rept->line) { - rept->numrept = 1; - rept->numdone = 1; - } + + n = parser_gas->lineleftlineleft : max_size; + strncpy((char *)buf+tot, parser_gas->linepos, n); + + if (n == parser_gas->lineleft) { + yasm_xfree(parser_gas->line); + parser_gas->line = NULL; + } else { + parser_gas->lineleft -= n; + parser_gas->linepos += n; } + + tot += n; + max_size -= n; } - - /* Copy out the previous fill buffer until we're *really* done */ - if (rept->numdone == rept->numrept) { - size_t numcopy = rept->oldbuflen - rept->oldbufpos; - if (numcopy > numleft) - numcopy = numleft; - memcpy(bufp, &rept->oldbuf[rept->oldbufpos], numcopy); - numleft -= numcopy; - bufp += numcopy; - rept->oldbufpos += numcopy; - - if (rept->oldbufpos == rept->oldbuflen) { - /* Delete lines, then delete rept and clear rept state */ - gas_rept_line *cur, *next; - cur = STAILQ_FIRST(&rept->lines); - while (cur) { - next = STAILQ_NEXT(cur, link); - yasm_xfree(cur->data); - yasm_xfree(cur); - cur = next; - } - yasm_xfree(rept->oldbuf); - yasm_xfree(rept); - parser_gas->rept = NULL; - } - } - - while (numleft > 0 && rept->numdone < rept->numrept) { - /* Copy from line data to buf */ - size_t numcopy = rept->line->len - rept->linepos; - if (numcopy > numleft) - numcopy = numleft; - memcpy(bufp, &rept->line->data[rept->linepos], numcopy); - numleft -= numcopy; - bufp += numcopy; - rept->linepos += numcopy; - - /* Update locations if needed */ - if (rept->linepos == rept->line->len) { - rept->line = STAILQ_NEXT(rept->line, link); - rept->linepos = 0; - } - if (rept->line == NULL) { - rept->numdone++; - rept->line = STAILQ_FIRST(&rept->lines); - } - } - - return (max_size-numleft); + return tot; } #if 0 static size_t @@ -161,11 +120,7 @@ fill(yasm_parser_gas *parser_gas, YYCTYPE *cursor) yasm_xfree(s->bot); s->bot = buf; } - if (parser_gas->rept && parser_gas->rept->ended) { - /* Pull from rept lines instead of preproc */ - cnt = rept_input(parser_gas, s->lim, BSIZE); - } else if((cnt = yasm_preproc_input(parser_gas->preproc, - (char *)s->lim, BSIZE)) == 0) { + if((cnt = preproc_input(parser_gas, s->lim, BSIZE)) == 0) { s->eof = &s->lim[cnt]; *s->eof++ = '\n'; } s->lim += cnt; @@ -236,13 +191,10 @@ strbuf_append(size_t count, YYCTYPE *cursor, yasm_scanner *s, int ch) int gas_parser_lex(YYSTYPE *lvalp, yasm_parser_gas *parser_gas) { - /*@null@*/ gas_rept *rept = parser_gas->rept; yasm_scanner *s = &parser_gas->s; YYCTYPE *cursor = s->cur; size_t count; YYCTYPE savech; - int linestart; - gas_rept_line *new_line; /* Handle one token of lookahead */ if (parser_gas->peek_token != NONE) { @@ -257,16 +209,14 @@ gas_parser_lex(YYSTYPE *lvalp, yasm_parser_gas *parser_gas) if (s->eof && cursor == s->eof) return 0; - /* Handle rept */ - if (rept && !rept->ended) - goto rept_directive; - /* Jump to proper "exclusive" states */ switch (parser_gas->state) { case COMMENT: goto comment; case SECTION_DIRECTIVE: goto section_directive; + case NASM_FILENAME: + goto nasm_filename; default: break; } @@ -313,7 +263,21 @@ scan: } /* floating point value */ - "0" [DdEeFfTt] [-+]? (digit+)? ("." digit*)? ('e' [-+]? digit+)? { + [-+]? digit* "." digit+ ('e' [-+]? digit+)? { + savech = s->tok[TOKLEN]; + s->tok[TOKLEN] = '\0'; + lvalp->flt = yasm_floatnum_create(TOK); + s->tok[TOKLEN] = savech; + RETURN(FLTNUM); + } + [-+]? digit+ "." digit* ('e' [-+]? digit+)? { + savech = s->tok[TOKLEN]; + s->tok[TOKLEN] = '\0'; + lvalp->flt = yasm_floatnum_create(TOK); + s->tok[TOKLEN] = savech; + RETURN(FLTNUM); + } + "0" [DdEeFfTt] [-+]? digit* ("." digit*)? ('e' [-+]? digit+)? { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->flt = yasm_floatnum_create(TOK+2); @@ -342,154 +306,20 @@ scan: RETURN(s->tok[0]); } - /* arch-independent directives */ - /* alignment directives */ - '.align' { - /* FIXME: Whether this is power-of-two or not depends on arch and - * objfmt. - */ - lvalp->int_info = 0; - parser_gas->state = INSTDIR; RETURN(DIR_ALIGN); + /* identifier */ + [a-zA-Z_.][a-zA-Z0-9_$.]* { + lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN); + lvalp->str.len = TOKLEN; + RETURN(ID); } - '.p2align' { - lvalp->int_info = 1; - parser_gas->state = INSTDIR; RETURN(DIR_ALIGN); - } - '.balign' { - lvalp->int_info = 0; - parser_gas->state = INSTDIR; RETURN(DIR_ALIGN); - } - '.org' { parser_gas->state = INSTDIR; RETURN(DIR_ORG); } - /* data visibility directives */ - '.local' { parser_gas->state = INSTDIR; RETURN(DIR_LOCAL); } - '.comm' { parser_gas->state = INSTDIR; RETURN(DIR_COMM); } - '.lcomm' { parser_gas->state = INSTDIR; RETURN(DIR_LCOMM); } - /* integer data declaration directives */ - '.byte' { - lvalp->int_info = 1; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.2byte' { - lvalp->int_info = 2; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.4byte' { - lvalp->int_info = 4; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.8byte' { - lvalp->int_info = 8; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.16byte' { - lvalp->int_info = 16; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.short' { - lvalp->int_info = 2; /* TODO: This should depend on arch */ - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.int' { - lvalp->int_info = 4; /* TODO: This should depend on arch */ - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.long' { - lvalp->int_info = 4; /* TODO: This should depend on arch */ - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.hword' { - lvalp->int_info = 2; /* TODO: This should depend on arch */ - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.word' { - lvalp->int_info = yasm_arch_wordsize(p_object->arch)/8; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.quad' { - lvalp->int_info = 8; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.octa' { - lvalp->int_info = 16; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.value' { - lvalp->int_info = 2; /* XXX: At least on x86, this is 2 bytes */ - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - /* ASCII data declaration directives */ - '.ascii' { - lvalp->int_info = 0; /* do not add terminating zero */ - parser_gas->state = INSTDIR; RETURN(DIR_ASCII); - } - '.asciz' { - lvalp->int_info = 1; /* add terminating zero */ - parser_gas->state = INSTDIR; RETURN(DIR_ASCII); - } - '.string' { - lvalp->int_info = 1; /* add terminating zero */ - parser_gas->state = INSTDIR; RETURN(DIR_ASCII); - } - /* LEB128 integer data declaration directives */ - '.sleb128' { - lvalp->int_info = 1; /* signed */ - parser_gas->state = INSTDIR; RETURN(DIR_LEB128); - } - '.uleb128' { - lvalp->int_info = 0; /* unsigned */ - parser_gas->state = INSTDIR; RETURN(DIR_LEB128); - } - /* floating point data declaration directives */ - '.float' { - lvalp->int_info = 4; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.single' { - lvalp->int_info = 4; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.double' { - lvalp->int_info = 8; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - '.tfloat' { - lvalp->int_info = 10; - parser_gas->state = INSTDIR; RETURN(DIR_DATA); - } - /* section directives */ - '.bss' { - lvalp->str_val = yasm__xstrdup(".bss"); - RETURN(DIR_SECTNAME); - } - '.data' { - lvalp->str_val = yasm__xstrdup(".data"); - RETURN(DIR_SECTNAME); - } - '.text' { - lvalp->str_val = yasm__xstrdup(".text"); - RETURN(DIR_SECTNAME); - } - '.section' { - parser_gas->state = SECTION_DIRECTIVE; - RETURN(DIR_SECTION); - } - /* macro directives */ - '.rept' { parser_gas->state = INSTDIR; RETURN(DIR_REPT); } - '.endr' { parser_gas->state = INSTDIR; RETURN(DIR_ENDR); } - /* empty space/fill directives */ - '.skip' { parser_gas->state = INSTDIR; RETURN(DIR_SKIP); } - '.space' { parser_gas->state = INSTDIR; RETURN(DIR_SKIP); } - '.fill' { parser_gas->state = INSTDIR; RETURN(DIR_FILL); } - '.zero' { parser_gas->state = INSTDIR; RETURN(DIR_ZERO); } - /* other directives */ - '.equ' { parser_gas->state = INSTDIR; RETURN(DIR_EQU); } - '.file' { parser_gas->state = INSTDIR; RETURN(DIR_FILE); } - '.line' { parser_gas->state = INSTDIR; RETURN(DIR_LINE); } - '.set' { parser_gas->state = INSTDIR; RETURN(DIR_EQU); } - /* label or maybe directive */ - [_.][a-zA-Z0-9_$.]* { - lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); + /* identifier with @ */ + [a-zA-Z_.]([a-zA-Z0-9_$.]*[@][a-zA-Z0-9_$.]*)+ { + /* if @ not part of ID, move the scanner cursor to the first @ */ + if (!((yasm_objfmt_base *)p_object->objfmt)->module->id_at_ok) + cursor = (unsigned char *)strchr(TOK, '@'); + lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN); + lvalp->str.len = TOKLEN; RETURN(ID); } @@ -497,8 +327,13 @@ scan: [%][a-zA-Z0-9]+ { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; + if (parser_gas->is_nasm_preproc && strcmp(TOK+1, "line") == 0) { + s->tok[TOKLEN] = savech; + RETURN(NASM_LINE_MARKER); + } + switch (yasm_arch_parse_check_regtmod - (p_object->arch, lvalp->arch_data, TOK+1, TOKLEN-1)) { + (p_object->arch, TOK+1, TOKLEN-1, &lvalp->arch_data)) { case YASM_ARCH_REG: s->tok[TOKLEN] = savech; RETURN(REG); @@ -514,55 +349,51 @@ scan: yasm_error_set(YASM_ERROR_GENERAL, N_("Unrecognized register name `%s'"), s->tok); s->tok[TOKLEN] = savech; - lvalp->arch_data[0] = 0; - lvalp->arch_data[1] = 0; - lvalp->arch_data[2] = 0; - lvalp->arch_data[3] = 0; + lvalp->arch_data = 0; RETURN(REG); } - /* label */ - [a-zA-Z][a-zA-Z0-9_$.]* ws* ':' { - /* strip off colon and any whitespace */ - count = TOKLEN-1; - while (s->tok[count] == ' ' || s->tok[count] == '\t' - || s->tok[count] == '\r') - count--; - /* Just an identifier, return as such. */ - lvalp->str_val = yasm__xstrndup(TOK, count); + /* local label */ + [0-9] ':' { + /* increment label index */ + parser_gas->local[s->tok[0]-'0']++; + /* build local label name */ + lvalp->str.contents = yasm_xmalloc(30); + lvalp->str.len = + sprintf(lvalp->str.contents, "L%c\001%lu", s->tok[0], + parser_gas->local[s->tok[0]-'0']); RETURN(LABEL); } - /* identifier that may be an instruction, etc. */ - [a-zA-Z][a-zA-Z0-9_$.]* { - /* Can only be an instruction/prefix when not inside an - * instruction or directive. - */ - if (parser_gas->state != INSTDIR) { - savech = s->tok[TOKLEN]; - s->tok[TOKLEN] = '\0'; - switch (yasm_arch_parse_check_insnprefix - (p_object->arch, lvalp->arch_data, TOK, TOKLEN)) { - case YASM_ARCH_INSN: - s->tok[TOKLEN] = savech; - parser_gas->state = INSTDIR; - RETURN(INSN); - case YASM_ARCH_PREFIX: - s->tok[TOKLEN] = savech; - RETURN(PREFIX); - default: - s->tok[TOKLEN] = savech; - } - } - /* Propagate errors in case we got a warning from the arch */ - yasm_errwarn_propagate(parser_gas->errwarns, cur_line); - /* Just an identifier, return as such. */ - lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); + /* local label forward reference */ + [0-9] 'f' { + /* build local label name */ + lvalp->str.contents = yasm_xmalloc(30); + lvalp->str.len = + sprintf(lvalp->str.contents, "L%c\001%lu", s->tok[0], + parser_gas->local[s->tok[0]-'0']+1); + RETURN(ID); + } + + /* local label backward reference */ + [0-9] 'b' { + /* build local label name */ + lvalp->str.contents = yasm_xmalloc(30); + lvalp->str.len = + sprintf(lvalp->str.contents, "L%c\001%lu", s->tok[0], + parser_gas->local[s->tok[0]-'0']); RETURN(ID); } "/*" { parser_gas->state = COMMENT; goto comment; } - "#" (any \ [\n])* { goto scan; } + "#" { + if (parser_gas->is_cpp_preproc) + { + RETURN(CPP_LINE_MARKER); + } else + goto line_comment; + } + "//" { goto line_comment; } ws+ { goto scan; } @@ -602,13 +433,20 @@ comment: } */ + /* Single line comment. */ +line_comment: + /*!re2c + (any \ [\n])* { goto scan; } + */ + /* .section directive (the section name portion thereof) */ section_directive: SCANINIT(); /*!re2c [a-zA-Z0-9_$.-]+ { - lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); + lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN); + lvalp->str.len = TOKLEN; parser_gas->state = INITIAL; RETURN(ID); } @@ -637,6 +475,39 @@ section_directive: } */ + /* filename portion of nasm preproc %line */ +nasm_filename: + strbuf = yasm_xmalloc(STRBUF_ALLOC_SIZE); + strbuf_size = STRBUF_ALLOC_SIZE; + count = 0; + +nasm_filename_scan: + SCANINIT(); + + /*!re2c + "\n" { + strbuf_append(count++, cursor, s, '\0'); + lvalp->str.contents = (char *)strbuf; + lvalp->str.len = count; + parser_gas->state = INITIAL; + RETURN(STRING); + } + + ws+ { goto nasm_filename_scan; } + + any { + if (cursor == s->eof) { + strbuf_append(count++, cursor, s, '\0'); + lvalp->str.contents = (char *)strbuf; + lvalp->str.len = count; + parser_gas->state = INITIAL; + RETURN(STRING); + } + strbuf_append(count++, cursor, s, s->tok[0]); + goto nasm_filename_scan; + } + */ + /* character constant values */ charconst: /*TODO*/ @@ -651,8 +522,8 @@ stringconst_scan: SCANINIT(); /*!re2c - /* Handle escaped double-quote by copying and continuing */ - "\\\"" { + /* Handle escaped character by copying both and continuing. */ + "\\". { if (cursor == s->eof) { yasm_error_set(YASM_ERROR_SYNTAX, N_("unexpected end of file in string")); @@ -660,7 +531,8 @@ stringconst_scan: lvalp->str.len = count; RETURN(STRING); } - strbuf_append(count++, cursor, s, '"'); + strbuf_append(count++, cursor, s, '\\'); + strbuf_append(count++, cursor, s, s->tok[1]); goto stringconst_scan; } @@ -684,106 +556,4 @@ stringconst_scan: goto stringconst_scan; } */ - -rept_directive: - strbuf = yasm_xmalloc(STRBUF_ALLOC_SIZE); - strbuf_size = STRBUF_ALLOC_SIZE; - count = 0; - linestart = 1; - - -rept_scan: - SCANINIT(); - - /*!re2c - [\n;] { - /* Line ending, save in lines */ - new_line = yasm_xmalloc(sizeof(gas_rept_line)); - if (cursor == s->eof) { - yasm_xfree(strbuf); - return 0; - } - strbuf_append(count++, cursor, s, s->tok[0]); - new_line->data = strbuf; - new_line->len = count; - STAILQ_INSERT_TAIL(&rept->lines, new_line, link); - /* Allocate new strbuf */ - strbuf = yasm_xmalloc(STRBUF_ALLOC_SIZE); - strbuf_size = STRBUF_ALLOC_SIZE; - count = 0; - /* Mark start of line */ - linestart = 1; - goto rept_scan; - } - '.rept' { - int i; - if (linestart) { - /* We don't support nested right now, error */ - yasm_error_set(YASM_ERROR_GENERAL, - N_("nested rept not supported")); - yasm_errwarn_propagate(parser_gas->errwarns, cur_line); - } - for (i=0; i<6; i++) - strbuf_append(count++, cursor, s, s->tok[i]); - goto rept_scan; - } - '.endr' { - if (linestart) { - /* We're done, kick off the main lexer */ - rept->line = STAILQ_FIRST(&rept->lines); - if (!rept->line) { - /* Didn't get any intervening data? Empty repeat, so - * don't even bother. - */ - yasm_xfree(strbuf); - yasm_xfree(rept); - parser_gas->rept = NULL; - } else { - rept->ended = 1; - - /* Add .line as first line to get line numbers correct */ - new_line = yasm_xmalloc(sizeof(gas_rept_line)); - new_line->data = yasm_xmalloc(40); - sprintf((char *)new_line->data, ".line %lu;", - rept->startline+1); - new_line->len = strlen((char *)new_line->data); - STAILQ_INSERT_HEAD(&rept->lines, new_line, link); - - /* Save previous fill buffer */ - rept->oldbuf = parser_gas->s.bot; - rept->oldbuflen = s->lim - s->bot; - rept->oldbufpos = cursor - s->bot; - - /* Reset fill */ - s->bot = NULL; - s->tok = NULL; - s->ptr = NULL; - s->cur = NULL; - s->lim = NULL; - s->top = NULL; - s->eof = NULL; - cursor = NULL; - YYFILL(1); - } - - goto scan; - } else { - int i; - for (i=0; i<6; i++) - strbuf_append(count++, cursor, s, s->tok[i]); - goto rept_scan; - } - } - - any { - if (cursor == s->eof) { - yasm_xfree(strbuf); - return 0; - } - strbuf_append(count++, cursor, s, s->tok[0]); - linestart = 0; - goto rept_scan; - } - */ - } diff --git a/modules/parsers/gas/tests/Makefile.inc b/modules/parsers/gas/tests/Makefile.inc index 44827334..c288adcf 100644 --- a/modules/parsers/gas/tests/Makefile.inc +++ b/modules/parsers/gas/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/parsers/gas/tests/gas_test.sh EXTRA_DIST += modules/parsers/gas/tests/gas_test.sh @@ -14,6 +12,8 @@ EXTRA_DIST += modules/parsers/gas/tests/execsect.asm EXTRA_DIST += modules/parsers/gas/tests/execsect.hex EXTRA_DIST += modules/parsers/gas/tests/gas-fill.asm EXTRA_DIST += modules/parsers/gas/tests/gas-fill.hex +EXTRA_DIST += modules/parsers/gas/tests/gas-float.asm +EXTRA_DIST += modules/parsers/gas/tests/gas-float.hex EXTRA_DIST += modules/parsers/gas/tests/gas-instlabel.asm EXTRA_DIST += modules/parsers/gas/tests/gas-instlabel.hex EXTRA_DIST += modules/parsers/gas/tests/gas-line-err.asm @@ -22,6 +22,8 @@ EXTRA_DIST += modules/parsers/gas/tests/gas-line2-err.asm EXTRA_DIST += modules/parsers/gas/tests/gas-line2-err.errwarn EXTRA_DIST += modules/parsers/gas/tests/gas-push.asm EXTRA_DIST += modules/parsers/gas/tests/gas-push.hex +EXTRA_DIST += modules/parsers/gas/tests/gas-segprefix.asm +EXTRA_DIST += modules/parsers/gas/tests/gas-segprefix.hex EXTRA_DIST += modules/parsers/gas/tests/gas-semi.asm EXTRA_DIST += modules/parsers/gas/tests/gas-semi.hex EXTRA_DIST += modules/parsers/gas/tests/gassectalign.asm diff --git a/modules/parsers/gas/tests/bin/Makefile.inc b/modules/parsers/gas/tests/bin/Makefile.inc index 8132e69c..5428d144 100644 --- a/modules/parsers/gas/tests/bin/Makefile.inc +++ b/modules/parsers/gas/tests/bin/Makefile.inc @@ -1,21 +1,27 @@ -# $Id$ - TESTS += modules/parsers/gas/tests/bin/gas_bin_test.sh EXTRA_DIST += modules/parsers/gas/tests/bin/gas_bin_test.sh EXTRA_DIST += modules/parsers/gas/tests/bin/gas-comment.asm EXTRA_DIST += modules/parsers/gas/tests/bin/gas-comment.errwarn EXTRA_DIST += modules/parsers/gas/tests/bin/gas-comment.hex +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.asm +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.hex +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-llabel.asm +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-llabel.hex +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-macro.asm +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-macro.hex EXTRA_DIST += modules/parsers/gas/tests/bin/gas-set.asm EXTRA_DIST += modules/parsers/gas/tests/bin/gas-set.hex +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-str.asm +EXTRA_DIST += modules/parsers/gas/tests/bin/gas-str.hex EXTRA_DIST += modules/parsers/gas/tests/bin/rept-err.asm EXTRA_DIST += modules/parsers/gas/tests/bin/rept-err.errwarn EXTRA_DIST += modules/parsers/gas/tests/bin/reptempty.asm EXTRA_DIST += modules/parsers/gas/tests/bin/reptempty.hex EXTRA_DIST += modules/parsers/gas/tests/bin/reptlong.asm EXTRA_DIST += modules/parsers/gas/tests/bin/reptlong.hex -EXTRA_DIST += modules/parsers/gas/tests/bin/reptnested-err.asm -EXTRA_DIST += modules/parsers/gas/tests/bin/reptnested-err.errwarn +EXTRA_DIST += modules/parsers/gas/tests/bin/reptnested.asm +EXTRA_DIST += modules/parsers/gas/tests/bin/reptnested.hex EXTRA_DIST += modules/parsers/gas/tests/bin/reptsimple.asm EXTRA_DIST += modules/parsers/gas/tests/bin/reptsimple.hex EXTRA_DIST += modules/parsers/gas/tests/bin/reptwarn.asm diff --git a/modules/parsers/gas/tests/bin/gas-comment.asm b/modules/parsers/gas/tests/bin/gas-comment.asm index ee68e554..0c265f7d 100644 --- a/modules/parsers/gas/tests/bin/gas-comment.asm +++ b/modules/parsers/gas/tests/bin/gas-comment.asm @@ -2,6 +2,8 @@ /* So is this */ +// and so is this + .byte 0 /* at end of line? */ .byte 0 /* at end of line, diff --git a/modules/parsers/gas/tests/bin/gas-comment.errwarn b/modules/parsers/gas/tests/bin/gas-comment.errwarn index 1fb55a30..6a29a1fd 100644 --- a/modules/parsers/gas/tests/bin/gas-comment.errwarn +++ b/modules/parsers/gas/tests/bin/gas-comment.errwarn @@ -1 +1 @@ --:23: warning: end of file in comment +-:25: warning: end of file in comment diff --git a/modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.asm b/modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.asm new file mode 100644 index 00000000..25c65076 --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.asm @@ -0,0 +1,19 @@ +.intel_syntax noprefix +.section .rodata +.LC0: +.string "Hello" +.text + lea ecx, 4 [esp] + and esp, -16 + push DWORD PTR [ecx-4] + push ebp + fstp st(0) + ffree st(1) + mov ebp, esp + push ecx + sub esp, 4 + mov DWORD PTR [esp], OFFSET FLAT:.LC0 + add esp, 4 + pop ebp + lea esp, [ecx-4] + ret diff --git a/modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.hex b/modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.hex new file mode 100644 index 00000000..fe0fdafa --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-intel_syntax-noprefix.hex @@ -0,0 +1,58 @@ +67 +66 +8d +4c +24 +04 +66 +83 +e4 +f0 +67 +66 +ff +71 +fc +66 +55 +dd +d8 +dd +c1 +66 +89 +e5 +66 +51 +66 +83 +ec +04 +67 +66 +c7 +04 +24 +34 +00 +00 +00 +66 +83 +c4 +04 +66 +5d +67 +66 +8d +61 +fc +c3 +00 +48 +65 +6c +6c +6f +00 diff --git a/modules/parsers/gas/tests/bin/gas-llabel.asm b/modules/parsers/gas/tests/bin/gas-llabel.asm new file mode 100644 index 00000000..11f3f545 --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-llabel.asm @@ -0,0 +1,29 @@ +# Skelix by Xiaoming Mo (xiaoming.mo@skelix.org) +# Licence: GPLv2 + .text + #.globl start + .code16 +start: + jmp code +msg: + .string "Hello World!\x0" +code: + movw $0xb800,%ax + movw %ax, %es + xorw %ax, %ax + movw %ax, %ds + + movw $msg, %si + xorw %di, %di + cld + movb $0x07, %al +1: + cmpw $0, (%si) + je 1f + movsb + stosb + jmp 1b +1: jmp 1b +.org 0x1fe, 0x90 +.word 0xaa55 + diff --git a/modules/parsers/gas/tests/bin/gas-llabel.hex b/modules/parsers/gas/tests/bin/gas-llabel.hex new file mode 100644 index 00000000..4bef5c77 --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-llabel.hex @@ -0,0 +1,512 @@ +eb +0e +48 +65 +6c +6c +6f +20 +57 +6f +72 +6c +64 +21 +00 +00 +b8 +00 +b8 +8e +c0 +31 +c0 +8e +d8 +be +02 +00 +31 +ff +fc +b0 +07 +83 +3c +00 +74 +04 +a4 +aa +eb +f7 +eb +fe +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +90 +55 +aa diff --git a/modules/parsers/gas/tests/bin/gas-macro.asm b/modules/parsers/gas/tests/bin/gas-macro.asm new file mode 100644 index 00000000..29b475cc --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-macro.asm @@ -0,0 +1,25 @@ +.macro foo arg1, arg2 +.byte \arg1 +.byte \arg2 +.endm + +.macro bar x y +.byte \x-\y +.endm + +.macro def a=5 b +.byte \a + \b +.endm + +.macro nest x=9 +.macro zap y +.byte \y +.endm +zap \x +.endm + +foo 5 6 +bar 3, 2 +def ,3 +def 3 2 +nest diff --git a/modules/parsers/gas/tests/bin/gas-macro.hex b/modules/parsers/gas/tests/bin/gas-macro.hex new file mode 100644 index 00000000..0904d1cd --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-macro.hex @@ -0,0 +1,6 @@ +05 +06 +01 +08 +05 +09 diff --git a/modules/parsers/gas/tests/bin/gas-set.asm b/modules/parsers/gas/tests/bin/gas-set.asm index 24f278fb..6bce4a2f 100644 --- a/modules/parsers/gas/tests/bin/gas-set.asm +++ b/modules/parsers/gas/tests/bin/gas-set.asm @@ -1,2 +1,34 @@ +.set bar,(foo-1) .set foo,5 -.byte foo +.byte foo /* 0x5 */ +.byte bar /* 0x4 */ +.set foo,6 +.byte foo /* 0x6 */ +.byte bar /* 0x4 */ +.set bar,10 +.byte bar /* 0xa */ +.set bar,foo+1 +.byte bar /* 0x7 */ +.set bar,bar+1 +.byte bar /* 0x8 */ +.set bar,5 +.set bam,bar-1 +.set bar,1 +.byte bam /* 0x4 */ +.set bar, boo + 1 +.set boo, 5 +.set boo, 6 +.byte bar /* 0x6 */ +.set a, b+c +.set b, 0x1 +.set b, 0x2 +.set c, 0x10 +.set c, 0x20 +.byte a /* 0x11 */ +.set x, 5 +.set y, x+z +.set x, 10 +.set z, 1 +.byte y /* 0x6 */ +.set z, 0xfe +.byte z /* 0xfe */ diff --git a/modules/parsers/gas/tests/bin/gas-set.hex b/modules/parsers/gas/tests/bin/gas-set.hex index f62fa93d..c0a5bfcf 100644 --- a/modules/parsers/gas/tests/bin/gas-set.hex +++ b/modules/parsers/gas/tests/bin/gas-set.hex @@ -1 +1,12 @@ 05 +04 +06 +04 +0a +07 +08 +04 +06 +11 +06 +fe diff --git a/modules/parsers/gas/tests/bin/gas-str.asm b/modules/parsers/gas/tests/bin/gas-str.asm new file mode 100644 index 00000000..4d02a02c --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-str.asm @@ -0,0 +1 @@ +.string "a\\" diff --git a/modules/parsers/gas/tests/bin/gas-str.hex b/modules/parsers/gas/tests/bin/gas-str.hex new file mode 100644 index 00000000..d4eaa859 --- /dev/null +++ b/modules/parsers/gas/tests/bin/gas-str.hex @@ -0,0 +1,3 @@ +61 +5c +00 diff --git a/modules/parsers/gas/tests/bin/gas_bin_test.sh b/modules/parsers/gas/tests/bin/gas_bin_test.sh index f0c83e9f..aa35a4e7 100755 --- a/modules/parsers/gas/tests/bin/gas_bin_test.sh +++ b/modules/parsers/gas/tests/bin/gas_bin_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh gas_bin_test modules/parsers/gas/tests/bin "gas-compat parser bin output" "-f bin -p gas" "" exit $? diff --git a/modules/parsers/gas/tests/bin/rept-err.asm b/modules/parsers/gas/tests/bin/rept-err.asm index 143e9041..88582f93 100644 --- a/modules/parsers/gas/tests/bin/rept-err.asm +++ b/modules/parsers/gas/tests/bin/rept-err.asm @@ -1,2 +1,4 @@ .rept 6 +.endr +.rept 3 .byte 0 diff --git a/modules/parsers/gas/tests/bin/rept-err.errwarn b/modules/parsers/gas/tests/bin/rept-err.errwarn index 050398c2..5682b14a 100644 --- a/modules/parsers/gas/tests/bin/rept-err.errwarn +++ b/modules/parsers/gas/tests/bin/rept-err.errwarn @@ -1 +1 @@ --:1: rept without matching endr +-:3: error: rept without matching endr diff --git a/modules/parsers/gas/tests/bin/reptnested-err.errwarn b/modules/parsers/gas/tests/bin/reptnested-err.errwarn deleted file mode 100644 index 016b13e9..00000000 --- a/modules/parsers/gas/tests/bin/reptnested-err.errwarn +++ /dev/null @@ -1,7 +0,0 @@ --:2: nested rept not supported --:3: rept without matching endr --:4: nested rept not supported --:4: nested rept not supported --:4: nested rept not supported --:4: nested rept not supported --:4: nested rept not supported diff --git a/modules/parsers/gas/tests/bin/reptnested-err.asm b/modules/parsers/gas/tests/bin/reptnested.asm similarity index 69% rename from modules/parsers/gas/tests/bin/reptnested-err.asm rename to modules/parsers/gas/tests/bin/reptnested.asm index bb85988a..061cae02 100644 --- a/modules/parsers/gas/tests/bin/reptnested-err.asm +++ b/modules/parsers/gas/tests/bin/reptnested.asm @@ -1,7 +1,7 @@ -.rept 6 +.rept 3 .byte 1 .rept 2 -.byte 2 -.endr .byte 3 .endr +.endr +.byte 5 diff --git a/modules/parsers/gas/tests/bin/reptnested.hex b/modules/parsers/gas/tests/bin/reptnested.hex new file mode 100644 index 00000000..9ec32fc7 --- /dev/null +++ b/modules/parsers/gas/tests/bin/reptnested.hex @@ -0,0 +1,10 @@ +01 +03 +03 +01 +03 +03 +01 +03 +03 +05 diff --git a/modules/parsers/gas/tests/gas-float.asm b/modules/parsers/gas/tests/gas-float.asm new file mode 100644 index 00000000..7101eed6 --- /dev/null +++ b/modules/parsers/gas/tests/gas-float.asm @@ -0,0 +1,2 @@ +.double 0.1 +.double -.0 diff --git a/modules/parsers/gas/tests/gas-float.hex b/modules/parsers/gas/tests/gas-float.hex new file mode 100644 index 00000000..4daadf4c --- /dev/null +++ b/modules/parsers/gas/tests/gas-float.hex @@ -0,0 +1,376 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +b0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +9a +99 +99 +99 +99 +99 +b9 +3f +00 +00 +00 +00 +00 +00 +00 +80 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +50 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +74 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +78 +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/parsers/gas/tests/gas-instlabel.asm b/modules/parsers/gas/tests/gas-instlabel.asm index 44c47482..22c0c00a 100644 --- a/modules/parsers/gas/tests/gas-instlabel.asm +++ b/modules/parsers/gas/tests/gas-instlabel.asm @@ -1,3 +1,6 @@ .globl SUB .type SUB, @function SUB: + +ADD = 5 + diff --git a/modules/parsers/gas/tests/gas-line-err.errwarn b/modules/parsers/gas/tests/gas-line-err.errwarn index 8f92ad62..f08f8be8 100644 --- a/modules/parsers/gas/tests/gas-line-err.errwarn +++ b/modules/parsers/gas/tests/gas-line-err.errwarn @@ -1,6 +1,6 @@ --:1: invalid number of operands --:3: invalid number of operands -bar1.s:601: invalid number of operands -bar1.s:201: invalid number of operands -bar2.s:203: invalid number of operands -bar2.s:205: invalid number of operands +-:1: error: invalid number of operands +-:3: error: invalid number of operands +bar1.s:601: error: invalid number of operands +bar1.s:201: error: invalid number of operands +bar2.s:203: error: invalid number of operands +bar2.s:205: error: invalid number of operands diff --git a/modules/parsers/gas/tests/gas-line2-err.errwarn b/modules/parsers/gas/tests/gas-line2-err.errwarn index 4cfc626f..5cd6b05b 100644 --- a/modules/parsers/gas/tests/gas-line2-err.errwarn +++ b/modules/parsers/gas/tests/gas-line2-err.errwarn @@ -1,3 +1,3 @@ --:1: invalid number of operands --:3: invalid number of operands -bar1.s:603: invalid number of operands +-:1: error: invalid number of operands +-:3: error: invalid number of operands +bar1.s:603: error: invalid number of operands diff --git a/modules/parsers/gas/tests/gas-segprefix.asm b/modules/parsers/gas/tests/gas-segprefix.asm new file mode 100644 index 00000000..9295b90a --- /dev/null +++ b/modules/parsers/gas/tests/gas-segprefix.asm @@ -0,0 +1,2 @@ +.text +es pushl %ebp diff --git a/modules/parsers/gas/tests/gas-segprefix.hex b/modules/parsers/gas/tests/gas-segprefix.hex new file mode 100644 index 00000000..932e1ea6 --- /dev/null +++ b/modules/parsers/gas/tests/gas-segprefix.hex @@ -0,0 +1,360 @@ +7f +45 +4c +46 +01 +01 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +03 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +a0 +00 +00 +00 +00 +00 +00 +00 +34 +00 +00 +00 +00 +00 +28 +00 +05 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +26 +55 +00 +00 +00 +2e +74 +65 +78 +74 +00 +2e +73 +74 +72 +74 +61 +62 +00 +2e +73 +79 +6d +74 +61 +62 +00 +2e +73 +68 +73 +74 +72 +74 +61 +62 +00 +00 +00 +00 +00 +2d +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +04 +00 +f1 +ff +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +03 +00 +04 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +17 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +44 +00 +00 +00 +21 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +07 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +68 +00 +00 +00 +03 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +0f +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +6c +00 +00 +00 +30 +00 +00 +00 +02 +00 +00 +00 +03 +00 +00 +00 +04 +00 +00 +00 +10 +00 +00 +00 +01 +00 +00 +00 +01 +00 +00 +00 +06 +00 +00 +00 +00 +00 +00 +00 +40 +00 +00 +00 +02 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +10 +00 +00 +00 +00 +00 +00 +00 diff --git a/modules/parsers/gas/tests/gas_test.sh b/modules/parsers/gas/tests/gas_test.sh index bce85d3c..f39d4d17 100755 --- a/modules/parsers/gas/tests/gas_test.sh +++ b/modules/parsers/gas/tests/gas_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh gas_test modules/parsers/gas/tests "gas-compat parser" "-f elf -p gas" ".o" exit $? diff --git a/modules/parsers/gas/tests/reggroup-err.errwarn b/modules/parsers/gas/tests/reggroup-err.errwarn index 1b6d02b7..3f428a79 100644 --- a/modules/parsers/gas/tests/reggroup-err.errwarn +++ b/modules/parsers/gas/tests/reggroup-err.errwarn @@ -1 +1 @@ --:5: bad register index `8' +-:5: error: bad register index `8' diff --git a/modules/parsers/nasm/CMakeLists.txt b/modules/parsers/nasm/CMakeLists.txt new file mode 100644 index 00000000..9f40beb2 --- /dev/null +++ b/modules/parsers/nasm/CMakeLists.txt @@ -0,0 +1,24 @@ +YASM_GENMACRO( + ${CMAKE_CURRENT_SOURCE_DIR}/parsers/nasm/nasm-std.mac + ${CMAKE_CURRENT_BINARY_DIR}/nasm-macros.c + nasm_standard_mac + ) + +SET_SOURCE_FILES_PROPERTIES(parsers/nasm/nasm-parser.c PROPERTIES + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nasm-macros.c + ) + +YASM_RE2C( + ${CMAKE_CURRENT_SOURCE_DIR}/parsers/nasm/nasm-token.re + ${CMAKE_CURRENT_BINARY_DIR}/nasm-token.c + -b + ) + +YASM_ADD_MODULE(parser_nasm + parsers/nasm/nasm-parser.c + parsers/nasm/nasm-parse.c + nasm-token.c + ) + +YASM_ADD_MODULE(parser_tasm + ) diff --git a/modules/parsers/nasm/Makefile.inc b/modules/parsers/nasm/Makefile.inc index 9994e316..ed58bb63 100644 --- a/modules/parsers/nasm/Makefile.inc +++ b/modules/parsers/nasm/Makefile.inc @@ -1,11 +1,10 @@ -# $Id$ - libyasm_a_SOURCES += modules/parsers/nasm/nasm-parser.c libyasm_a_SOURCES += modules/parsers/nasm/nasm-parser.h +libyasm_a_SOURCES += modules/parsers/nasm/nasm-parser-struct.h libyasm_a_SOURCES += modules/parsers/nasm/nasm-parse.c nodist_libyasm_a_SOURCES += nasm-token.c -YASM_MODULES += parser_nasm +YASM_MODULES += parser_nasm parser_tasm nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT) $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re @@ -14,7 +13,17 @@ BUILT_SOURCES += nasm-token.c CLEANFILES += nasm-token.c -EXTRA_DIST += modules/parsers/nasm/tests/Makefile.inc EXTRA_DIST += modules/parsers/nasm/nasm-token.re +$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c + +nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT) + $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac + +BUILT_SOURCES += nasm-macros.c +CLEANFILES += nasm-macros.c +EXTRA_DIST += modules/parsers/nasm/nasm-std.mac + +EXTRA_DIST += modules/parsers/nasm/tests/Makefile.inc + include modules/parsers/nasm/tests/Makefile.inc diff --git a/modules/parsers/nasm/nasm-parse.c b/modules/parsers/nasm/nasm-parse.c index 7866cffe..680aa0e7 100644 --- a/modules/parsers/nasm/nasm-parse.c +++ b/modules/parsers/nasm/nasm-parse.c @@ -25,22 +25,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -RCSID("$Id$"); -#define YASM_LIB_INTERNAL -#define YASM_EXPR_INTERNAL #include -#ifdef STDC_HEADERS -# include -#endif +#include #include "modules/parsers/nasm/nasm-parser.h" +#include "modules/preprocs/nasm/nasm.h" typedef enum { NORM_EXPR, - DIR_EXPR, - DV_EXPR + DIR_EXPR, /* Can't have seg:off or WRT anywhere */ + DV_EXPR /* Can't have registers anywhere */ } expr_type; static yasm_bytecode *parse_line(yasm_parser_nasm *parser_nasm); @@ -50,7 +46,7 @@ static yasm_bytecode *parse_times(yasm_parser_nasm *parser_nasm); static yasm_bytecode *parse_exp(yasm_parser_nasm *parser_nasm); static yasm_bytecode *parse_instr(yasm_parser_nasm *parser_nasm); static yasm_insn_operand *parse_operand(yasm_parser_nasm *parser_nasm); -static yasm_effaddr *parse_memaddr(yasm_parser_nasm *parser_nasm); +static yasm_insn_operand *parse_memaddr(yasm_parser_nasm *parser_nasm); static yasm_expr *parse_expr(yasm_parser_nasm *parser_nasm, expr_type type); static yasm_expr *parse_bexpr(yasm_parser_nasm *parser_nasm, expr_type type); static yasm_expr *parse_expr0(yasm_parser_nasm *parser_nasm, expr_type type); @@ -65,10 +61,27 @@ static void nasm_parser_directive (yasm_parser_nasm *parser_nasm, const char *name, /*@null@*/ yasm_valparamhead *valparams, /*@null@*/ yasm_valparamhead *objext_valparams); +static void set_nonlocal_label(yasm_parser_nasm *parser_nasm, const char *name); static void define_label(yasm_parser_nasm *parser_nasm, /*@only@*/ char *name, - int local); + unsigned int size); -#define is_eol_tok(tok) ((tok) == '\n' || (tok) == 0) +static void yasm_ea_set_implicit_size_segment(yasm_parser_nasm *parser_nasm, + yasm_effaddr *ea, yasm_expr *e) +{ + if (parser_nasm->tasm) { + const char *segment = yasm_expr_segment(e); + ea->data_len = yasm_expr_size(e); + if (segment) { + const char *segreg = tasm_get_segment_register(segment); + if (segreg) + yasm_arch_parse_check_regtmod(p_object->arch, segreg, + strlen(segreg), &ea->segreg); + } + } +} + + +#define is_eol_tok(tok) ((tok) == 0) #define is_eol() is_eol_tok(curtok) #define get_next_token() (curtok = nasm_parser_lex(&curval, parser_nasm)) @@ -102,11 +115,15 @@ destroy_curtok_(yasm_parser_nasm *parser_nasm) case ID: case LOCAL_ID: case SPECIAL_ID: + case NONLOCAL_ID: yasm_xfree(curval.str_val); break; case STRING: yasm_xfree(curval.str.contents); break; + case INSN: + yasm_bc_destroy(curval.bc); + break; default: break; } @@ -134,16 +151,14 @@ demand_eol_(yasm_parser_nasm *parser_nasm) } #define demand_eol() demand_eol_(parser_nasm) -static int -expect_(yasm_parser_nasm *parser_nasm, int token) +static const char * +describe_token(int token) { static char strch[] = "` '"; const char *str; - if (curtok == token) - return 1; - switch (token) { + case 0: str = "end of line"; break; case INTNUM: str = "integer"; break; case FLTNUM: str = "floating point value"; break; case DIRECTIVE_NAME: str = "directive name"; break; @@ -162,6 +177,7 @@ expect_(yasm_parser_nasm *parser_nasm, int token) case INSN: str = "instruction"; break; case PREFIX: str = "instruction prefix"; break; case REG: str = "register"; break; + case REGGROUP: str = "register group"; break; case SEGREG: str = "segment register"; break; case TARGETMOD: str = "target modifier"; break; case LEFT_OP: str = "<<"; break; @@ -172,13 +188,24 @@ expect_(yasm_parser_nasm *parser_nasm, int token) case ID: str = "identifier"; break; case LOCAL_ID: str = ".identifier"; break; case SPECIAL_ID: str = "..identifier"; break; + case NONLOCAL_ID: str = "..@identifier"; break; case LINE: str = "%line"; break; default: strch[1] = token; str = strch; break; } - yasm_error_set(YASM_ERROR_PARSE, "expected %s", str); + + return str; +} + +static int +expect_(yasm_parser_nasm *parser_nasm, int token) +{ + if (curtok == token) + return 1; + + yasm_error_set(YASM_ERROR_PARSE, "expected %s", describe_token(token)); destroy_curtok(); return 0; } @@ -187,9 +214,19 @@ expect_(yasm_parser_nasm *parser_nasm, int token) void nasm_parser_parse(yasm_parser_nasm *parser_nasm) { - while (get_next_token() != 0) { + unsigned char *line; + while ((line = (unsigned char *) + yasm_preproc_get_line(parser_nasm->preproc)) != NULL) { yasm_bytecode *bc = NULL, *temp_bc; - + + parser_nasm->s.bot = line; + parser_nasm->s.tok = line; + parser_nasm->s.ptr = line; + parser_nasm->s.cur = line; + parser_nasm->s.lim = line + strlen((char *)line)+1; + parser_nasm->s.top = parser_nasm->s.lim; + + get_next_token(); if (!is_eol()) { bc = parse_line(parser_nasm); demand_eol(); @@ -223,18 +260,19 @@ nasm_parser_parse(yasm_parser_nasm *parser_nasm) yasm_bc_destroy(bc); } temp_bc = NULL; - } else { + } else if (bc) { temp_bc = yasm_section_bcs_append(cursect, bc); if (temp_bc) parser_nasm->prev_bc = temp_bc; - } + } else + temp_bc = NULL; yasm_errwarn_propagate(parser_nasm->errwarns, cur_line); if (parser_nasm->save_input) - yasm_linemap_add_source(parser_nasm->linemap, - temp_bc, - (char *)parser_nasm->save_line[parser_nasm->save_last ^ 1]); + yasm_linemap_add_source(parser_nasm->linemap, temp_bc, + (char *)line); yasm_linemap_goto_next(parser_nasm->linemap); + yasm_xfree(line); } } @@ -278,7 +316,7 @@ parse_line(yasm_parser_nasm *parser_nasm) /* %line indicates the line number of the *next* line, so subtract * out the increment when setting the line number. */ - yasm_linemap_set(parser_nasm->linemap, filename, + yasm_linemap_set(parser_nasm->linemap, filename, 0, yasm_intnum_get_uint(line) - yasm_intnum_get_uint(incr), yasm_intnum_get_uint(incr)); yasm_intnum_destroy(line); @@ -300,6 +338,22 @@ parse_line(yasm_parser_nasm *parser_nasm) dirname = DIRECTIVE_NAME_val; get_next_token(); + /* ignore [warning]. TODO: actually implement */ + if (yasm__strcasecmp(dirname, "warning") == 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("[warning] directive not supported; ignored")); + + /* throw away the rest of the directive tokens */ + while (!is_eol() && curtok != ']') + { + destroy_curtok(); + get_next_token(); + } + expect(']'); + get_next_token(); + return NULL; + } + if (curtok == ']' || curtok == ':') have_vps = 0; else if (!parse_directive_valparams(parser_nasm, &dir_vps)) { @@ -332,26 +386,39 @@ parse_line(yasm_parser_nasm *parser_nasm) return parse_times(parser_nasm); case ID: case SPECIAL_ID: + case NONLOCAL_ID: case LOCAL_ID: { char *name = ID_val; - int local = (curtok != ID); + int local = parser_nasm->tasm + ? (curtok == ID || curtok == LOCAL_ID || + (curtok == SPECIAL_ID && name[0] == '@')) + : (curtok != ID); + unsigned int size = 0; get_next_token(); if (is_eol()) { /* label alone on the line */ yasm_warn_set(YASM_WARN_ORPHAN_LABEL, N_("label alone on a line without a colon might be in error")); - define_label(parser_nasm, name, local); + if (!local) + set_nonlocal_label(parser_nasm, name); + define_label(parser_nasm, name, 0); return NULL; } if (curtok == ':') get_next_token(); - if (curtok == EQU) { + if (curtok == EQU || (parser_nasm->tasm && curtok == '=')) { /* label EQU expr */ yasm_expr *e; get_next_token(); + + if (parser_nasm->tasm && curtok == SIZE_OVERRIDE) { + size = SIZE_OVERRIDE_val; + get_next_token(); + } + e = parse_expr(parser_nasm, NORM_EXPR); if (!e) { yasm_error_set(YASM_ERROR_SYNTAX, @@ -364,17 +431,33 @@ parse_line(yasm_parser_nasm *parser_nasm) return NULL; } - define_label(parser_nasm, name, local); - if (is_eol()) + if (parser_nasm->tasm && curtok == LABEL) + get_next_token(); + + if (parser_nasm->tasm && curtok == SIZE_OVERRIDE) { + size = SIZE_OVERRIDE_val; + get_next_token(); + } + + if (!local) + set_nonlocal_label(parser_nasm, name); + + if (is_eol()) { + define_label(parser_nasm, name, size); return NULL; + } if (curtok == TIMES) { + define_label(parser_nasm, name, size); get_next_token(); return parse_times(parser_nasm); } bc = parse_exp(parser_nasm); - if (!bc) + if (!parser_nasm->tasm && !bc) yasm_error_set(YASM_ERROR_SYNTAX, N_("instruction expected after label")); + if (parser_nasm->tasm && bc && !size) + size = yasm_bc_elem_size(bc); + define_label(parser_nasm, name, size); return bc; } default: @@ -458,7 +541,7 @@ parse_times(yasm_parser_nasm *parser_nasm) yasm_expr *multiple; yasm_bytecode *bc; - multiple = parse_expr(parser_nasm, DV_EXPR); + multiple = parse_bexpr(parser_nasm, DV_EXPR); if (!multiple) { yasm_error_set(YASM_ERROR_SYNTAX, N_("expression expected after %s"), "TIMES"); @@ -490,7 +573,7 @@ parse_exp(yasm_parser_nasm *parser_nasm) unsigned int size = DECLARE_DATA_val/8; yasm_datavalhead dvs; yasm_dataval *dv; - yasm_expr *e; + yasm_expr *e, *e2; get_next_token(); @@ -509,14 +592,68 @@ parse_exp(yasm_parser_nasm *parser_nasm) goto dv_done; } } - if ((e = parse_expr(parser_nasm, DV_EXPR))) - dv = yasm_dv_create_expr(e); - else { + if (curtok == '?') { + yasm_dvs_delete(&dvs); + get_next_token(); + if (! is_eol_tok(curtok)) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("can not handle more than one '?'")); + return NULL; + } + return yasm_bc_create_reserve( + p_expr_new_ident(yasm_expr_int( + yasm_intnum_create_uint(1))), + size, cur_line); + } + if (!(e = parse_bexpr(parser_nasm, DV_EXPR))) { yasm_error_set(YASM_ERROR_SYNTAX, N_("expression or string expected")); yasm_dvs_delete(&dvs); return NULL; } + if (curtok == DUP) { + get_next_token(); + if (curtok != '(') { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected ( after DUP")); + goto error; + } + get_next_token(); + if (curtok == '?') { + get_next_token(); + if (curtok != ')') { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected ) after DUPlicated expression")); + goto error; + } + get_next_token(); + if (! is_eol_tok(curtok)) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("can not handle more than one '?'")); + goto error; + } + yasm_dvs_delete(&dvs); + return yasm_bc_create_reserve(e, size, cur_line); + } else if ((e2 = parse_bexpr(parser_nasm, DV_EXPR))) { + if (curtok != ')') { + yasm_expr_destroy(e2); + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected ) after DUPlicated expression")); + goto error; + } + get_next_token(); + dv = yasm_dv_create_expr(e2); + yasm_dv_set_multiple(dv, e); + } else { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expression or string expected")); +error: + yasm_expr_destroy(e); + yasm_dvs_delete(&dvs); + return NULL; + } + } else + dv = yasm_dv_create_expr(e); dv_done: yasm_dvs_append(&dvs, dv); if (is_eol()) @@ -537,7 +674,7 @@ dv_done: unsigned int size = RESERVE_SPACE_val/8; yasm_expr *e; get_next_token(); - e = parse_expr(parser_nasm, DV_EXPR); + e = parse_bexpr(parser_nasm, DV_EXPR); if (!e) { yasm_error_set(YASM_ERROR_SYNTAX, N_("expression expected after %s"), "RESx"); @@ -565,7 +702,7 @@ dv_done: get_next_token(); if (is_eol()) goto incbin_done; - start = parse_expr(parser_nasm, DV_EXPR); + start = parse_bexpr(parser_nasm, DV_EXPR); if (!start) { yasm_error_set(YASM_ERROR_SYNTAX, N_("expression expected for INCBIN start")); @@ -577,8 +714,8 @@ dv_done: get_next_token(); if (is_eol()) goto incbin_done; - maxlen = parse_expr(parser_nasm, DV_EXPR); - if (!start) { + maxlen = parse_bexpr(parser_nasm, DV_EXPR); + if (!maxlen) { yasm_error_set(YASM_ERROR_SYNTAX, N_("expression expected for INCBIN maximum length")); return NULL; @@ -596,60 +733,64 @@ incbin_done: static yasm_bytecode * parse_instr(yasm_parser_nasm *parser_nasm) { + yasm_bytecode *bc; + switch (curtok) { case INSN: { - yystype insn = curval; /* structure copy */ - yasm_insn_operands operands; - int num_operands = 0; + yasm_insn *insn; + bc = INSN_val; + insn = yasm_bc_get_insn(bc); get_next_token(); - if (is_eol()) { - /* no operands */ - return yasm_bc_create_insn(p_object->arch, insn.arch_data, 0, - NULL, cur_line); - } + if (is_eol()) + return bc; /* no operands */ /* parse operands */ - yasm_ops_initialize(&operands); for (;;) { yasm_insn_operand *op = parse_operand(parser_nasm); if (!op) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expression syntax error")); - yasm_ops_delete(&operands, 1); + if (insn->num_operands == 0) + yasm_error_set(YASM_ERROR_SYNTAX, + N_("unexpected %s after instruction"), + describe_token(curtok)); + else + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected operand, got %s"), + describe_token(curtok)); + yasm_bc_destroy(bc); return NULL; } - yasm_ops_append(&operands, op); - num_operands++; + yasm_insn_ops_append(insn, op); if (is_eol()) break; if (!expect(',')) { - yasm_ops_delete(&operands, 1); + yasm_bc_destroy(bc); return NULL; } get_next_token(); } - return yasm_bc_create_insn(p_object->arch, insn.arch_data, - num_operands, &operands, cur_line); - } - case PREFIX: { - yystype prefix = curval; /* structure copy */ - yasm_bytecode *bc; - get_next_token(); - bc = parse_instr(parser_nasm); - if (bc) - yasm_bc_insn_add_prefix(bc, prefix.arch_data); return bc; } - case SEGREG: { - uintptr_t segreg = SEGREG_val[0]; - yasm_bytecode *bc; + case PREFIX: + { + uintptr_t prefix = PREFIX_val; get_next_token(); bc = parse_instr(parser_nasm); - if (bc) - yasm_bc_insn_add_seg_prefix(bc, segreg); + if (!bc) + bc = yasm_arch_create_empty_insn(p_object->arch, cur_line); + yasm_insn_add_prefix(yasm_bc_get_insn(bc), prefix); + return bc; + } + case SEGREG: + { + uintptr_t segreg = SEGREG_val; + get_next_token(); + bc = parse_instr(parser_nasm); + if (!bc) + bc = yasm_arch_create_empty_insn(p_object->arch, cur_line); + yasm_insn_add_seg_prefix(yasm_bc_get_insn(bc), segreg); return bc; } default: @@ -664,28 +805,156 @@ parse_operand(yasm_parser_nasm *parser_nasm) switch (curtok) { case '[': { - yasm_effaddr *ea; get_next_token(); - ea = parse_memaddr(parser_nasm); + op = parse_memaddr(parser_nasm); expect(']'); get_next_token(); - if (!ea) { + if (!op) { yasm_error_set(YASM_ERROR_SYNTAX, N_("memory address expected")); return NULL; } - return yasm_operand_create_mem(ea); + + if (parser_nasm->tasm && !is_eol() && curtok != ',') { + yasm_expr *e = NULL, *f; + yasm_effaddr *ea; + + switch (op->type) { + case YASM_INSN__OPERAND_IMM: + e = op->data.val; + break; + case YASM_INSN__OPERAND_MEMORY: + if (op->data.ea->disp.rel) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("relative adressing not supported\n")); + return NULL; + } + e = yasm_expr_copy(op->data.ea->disp.abs); + yasm_arch_ea_destroy(p_object->arch, op->data.ea); + break; + case YASM_INSN__OPERAND_REG: + case YASM_INSN__OPERAND_SEGREG: + yasm_error_set(YASM_ERROR_SYNTAX, + N_("register adressing not supported\n")); + return NULL; + } + yasm_xfree(op); + f = parse_bexpr(parser_nasm, NORM_EXPR); + if (!f) { + yasm_expr_destroy(e); + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after ]")); + return NULL; + } + e = p_expr_new_tree(e, YASM_EXPR_ADD, f); + ea = yasm_arch_ea_create(p_object->arch, e); + yasm_ea_set_implicit_size_segment(parser_nasm, ea, e); + op = yasm_operand_create_mem(ea); + } + return op; + } + case OFFSET: + { + yasm_insn_operand *op2; + get_next_token(); + if (parser_nasm->masm && curtok == ID && !yasm__strcasecmp(ID_val, "flat")) { + get_next_token(); + if (curtok == ':') { + get_next_token(); + } + } + op = parse_operand(parser_nasm); + if (!op) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("memory address expected")); + return NULL; + } + if (op->type == YASM_INSN__OPERAND_IMM) + return op; + if (op->type != YASM_INSN__OPERAND_MEMORY) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("OFFSET applied to non-memory operand")); + return NULL; + } + if (op->data.ea->disp.rel) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("OFFSET applied to non-absolute memory operand")); + return NULL; + } + if (op->data.ea->disp.abs) + op2 = yasm_operand_create_imm(op->data.ea->disp.abs); + else + op2 = yasm_operand_create_imm(p_expr_new_ident( + yasm_expr_int(yasm_intnum_create_uint(0)))); + yasm_xfree(op); + return op2; } case SEGREG: - op = yasm_operand_create_segreg(SEGREG_val[0]); + { + uintptr_t segreg = SEGREG_val; get_next_token(); + if (parser_nasm->tasm && curtok == ':') { + get_next_token(); + op = parse_operand(parser_nasm); + if (!op) + return NULL; + if (op->type == YASM_INSN__OPERAND_IMM) { + yasm_effaddr *ea = yasm_arch_ea_create(p_object->arch, + op->data.val); + yasm_insn_operand *op2; + yasm_ea_set_implicit_size_segment(parser_nasm, ea, + op->data.val); + op2 = yasm_operand_create_mem(ea); + op2->size = op->size; + yasm_xfree(op); + op = op2; + } + if (op->type != YASM_INSN__OPERAND_MEMORY) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("segment applied to non-memory operand")); + return NULL; + } + yasm_ea_set_segreg(op->data.ea, segreg); + return op; + } + op = yasm_operand_create_segreg(segreg); return op; + } case REG: - op = yasm_operand_create_reg(REG_val[0]); + op = yasm_operand_create_reg(REG_val); get_next_token(); return op; + case REGGROUP: + { + unsigned long regindex; + uintptr_t reg = REGGROUP_val; + get_next_token(); /* REGGROUP */ + if (curtok != '(') + return yasm_operand_create_reg(reg); + get_next_token(); /* '(' */ + if (!expect(INTNUM)) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("integer register index expected")); + return NULL; + } + regindex = yasm_intnum_get_uint(INTNUM_val); + get_next_token(); /* INTNUM */ + if (!expect(')')) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("missing closing parenthesis for register index")); + return NULL; + } + get_next_token(); /* ')' */ + reg = yasm_arch_reggroup_get_reg(p_object->arch, reg, regindex); + if (reg == 0) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("bad register index `%u'"), + regindex); + return NULL; + } + return yasm_operand_create_reg(reg); + } case STRICT: get_next_token(); op = parse_operand(parser_nasm); @@ -696,6 +965,10 @@ parse_operand(yasm_parser_nasm *parser_nasm) { unsigned int size = SIZE_OVERRIDE_val; get_next_token(); + if (parser_nasm->masm && curtok == ID && !yasm__strcasecmp(ID_val, "ptr")) { + destroy_curtok(); + get_next_token(); + } op = parse_operand(parser_nasm); if (!op) return NULL; @@ -726,32 +999,102 @@ parse_operand(yasm_parser_nasm *parser_nasm) } case TARGETMOD: { - uintptr_t tmod = TARGETMOD_val[0]; + uintptr_t tmod = TARGETMOD_val; get_next_token(); op = parse_operand(parser_nasm); if (op) op->targetmod = tmod; return op; } + case ID: + case LOCAL_ID: + case NONLOCAL_ID: + if (parser_nasm->tasm) { + get_peek_token(parser_nasm); + if (parser_nasm->peek_token == '[') { + yasm_symrec *sym = yasm_symtab_use(p_symtab, ID_val, + cur_line); + yasm_expr *e = p_expr_new_ident(yasm_expr_sym(sym)), *f; + yasm_effaddr *ea; + yasm_xfree(ID_val); + get_next_token(); + get_next_token(); + f = parse_bexpr(parser_nasm, NORM_EXPR); + if (!f) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after [")); + return NULL; + } + e = p_expr_new_tree(e, YASM_EXPR_ADD, f); + if (!expect(']')) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("missing closing bracket")); + return NULL; + } + get_next_token(); + ea = yasm_arch_ea_create(p_object->arch, e); + yasm_ea_set_implicit_size_segment(parser_nasm, ea, e); + op = yasm_operand_create_mem(ea); + return op; + } + } + /* Fallthrough */ default: { - yasm_expr *e = parse_expr(parser_nasm, NORM_EXPR); + yasm_expr *e = parse_bexpr(parser_nasm, NORM_EXPR); if (!e) return NULL; - return yasm_operand_create_imm(e); + if (curtok != ':') { + if (parser_nasm->tasm && yasm_expr_size(e)) { + yasm_effaddr *ea = yasm_arch_ea_create(p_object->arch, e); + yasm_ea_set_implicit_size_segment(parser_nasm, ea, e); + op = yasm_operand_create_mem(ea); + return op; + } else if (curtok == '[') { + yasm_expr *f; + yasm_effaddr *ea; + yasm_insn_operand *op2; + + op = parse_operand(parser_nasm); + if (!op) + return NULL; + + f = op->data.ea->disp.abs; + e = p_expr_new_tree(e, YASM_EXPR_ADD, f); + ea = yasm_arch_ea_create(p_object->arch, e); + yasm_ea_set_implicit_size_segment(parser_nasm, ea, e); + op2 = yasm_operand_create_mem(ea); + + yasm_xfree(op); + + return op2; + } else { + return yasm_operand_create_imm(e); + } + } else { + yasm_expr *off; + get_next_token(); + off = parse_bexpr(parser_nasm, NORM_EXPR); + if (!off) { + yasm_expr_destroy(e); + return NULL; + } + op = yasm_operand_create_imm(off); + op->seg = e; + return op; + } } } } /* memory addresses */ -static yasm_effaddr * +static yasm_insn_operand * parse_memaddr(yasm_parser_nasm *parser_nasm) { - yasm_effaddr *ea; + yasm_insn_operand *op; switch (curtok) { case SEGREG: { - uintptr_t segreg = SEGREG_val[0]; + uintptr_t segreg = SEGREG_val; get_next_token(); if (!expect(':')) { yasm_error_set(YASM_ERROR_SYNTAX, @@ -759,32 +1102,66 @@ parse_memaddr(yasm_parser_nasm *parser_nasm) return NULL; } get_next_token(); - ea = parse_memaddr(parser_nasm); - if (ea) - yasm_ea_set_segreg(ea, segreg); - return ea; + op = parse_memaddr(parser_nasm); + if (op) + yasm_ea_set_segreg(op->data.ea, segreg); + return op; } case SIZE_OVERRIDE: { unsigned int size = SIZE_OVERRIDE_val; get_next_token(); - ea = parse_memaddr(parser_nasm); - if (ea) - yasm_ea_set_len(ea, size); - return ea; + op = parse_memaddr(parser_nasm); + if (op) + op->data.ea->disp.size = size; + return op; } case NOSPLIT: get_next_token(); - ea = parse_memaddr(parser_nasm); - if (ea) - yasm_ea_set_nosplit(ea, 1); - return ea; + op = parse_memaddr(parser_nasm); + if (op) + op->data.ea->nosplit = 1; + return op; + case REL: + get_next_token(); + op = parse_memaddr(parser_nasm); + if (op) { + op->data.ea->pc_rel = 1; + op->data.ea->not_pc_rel = 0; + } + return op; + case ABS: + get_next_token(); + op = parse_memaddr(parser_nasm); + if (op) { + op->data.ea->pc_rel = 0; + op->data.ea->not_pc_rel = 1; + } + return op; default: { - yasm_expr *e = parse_expr(parser_nasm, NORM_EXPR); + yasm_expr *e = parse_bexpr(parser_nasm, NORM_EXPR); if (!e) return NULL; - return yasm_arch_ea_create(p_object->arch, e); + if (curtok != ':') { + yasm_effaddr *ea = yasm_arch_ea_create(p_object->arch, e); + yasm_ea_set_implicit_size_segment(parser_nasm, ea, e); + return yasm_operand_create_mem(ea); + } else { + yasm_effaddr *ea; + yasm_expr *off; + get_next_token(); + off = parse_bexpr(parser_nasm, NORM_EXPR); + if (!off) { + yasm_expr_destroy(e); + return NULL; + } + ea = yasm_arch_ea_create(p_object->arch, off); + yasm_ea_set_implicit_size_segment(parser_nasm, ea, off); + op = yasm_operand_create_mem(ea); + op->seg = e; + return op; + } } } } @@ -817,6 +1194,9 @@ parse_memaddr(yasm_parser_nasm *parser_nasm) get_next_token(); \ f = rightfunc(parser_nasm, type); \ if (!f) { \ + yasm_error_set(YASM_ERROR_SYNTAX, \ + N_("expected expression after %s"), \ + describe_token(op)); \ yasm_expr_destroy(e); \ return NULL; \ } \ @@ -829,14 +1209,11 @@ static yasm_expr * parse_expr(yasm_parser_nasm *parser_nasm, expr_type type) { switch (type) { - case NORM_EXPR: - parse_expr_common(parse_bexpr, ':', parse_bexpr, YASM_EXPR_SEGOFF); - case DV_EXPR: - /* dataval expressions can't handle seg:off */ - return parse_bexpr(parser_nasm, type); case DIR_EXPR: /* directive expressions can't handle seg:off or WRT */ return parse_expr0(parser_nasm, type); + default: + parse_expr_common(parse_bexpr, ':', parse_bexpr, YASM_EXPR_SEGOFF); } /*@notreached@*/ return NULL; @@ -879,6 +1256,9 @@ parse_expr3(yasm_parser_nasm *parser_nasm, expr_type type) get_next_token(); f = parse_expr4(parser_nasm, type); if (!f) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), + describe_token(op)); yasm_expr_destroy(e); return NULL; } @@ -904,6 +1284,9 @@ parse_expr4(yasm_parser_nasm *parser_nasm, expr_type type) get_next_token(); f = parse_expr5(parser_nasm, type); if (!f) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), + describe_token(op)); yasm_expr_destroy(e); return NULL; } @@ -930,6 +1313,9 @@ parse_expr5(yasm_parser_nasm *parser_nasm, expr_type type) get_next_token(); f = parse_expr6(parser_nasm, type); if (!f) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), + describe_token(op)); yasm_expr_destroy(e); return NULL; } @@ -951,20 +1337,74 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) yasm_expr *e; yasm_symrec *sym; - /* directives allow very little and handle IDs specially */ - if (type == DIR_EXPR) { - switch (curtok) { + switch (curtok) { + case '+': + get_next_token(); + e = parse_expr6(parser_nasm, type); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "`+'"); + } + return e; + case '-': + get_next_token(); + e = parse_expr6(parser_nasm, type); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "`-'"); + return NULL; + } + return p_expr_new_branch(YASM_EXPR_NEG, e); case '~': get_next_token(); e = parse_expr6(parser_nasm, type); - if (!e) + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "`~'"); return NULL; + } return p_expr_new_branch(YASM_EXPR_NOT, e); + case LOW: + get_next_token(); + e = parse_expr6(parser_nasm, type); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "LOW"); + return NULL; + } + return p_expr_new_tree(e, YASM_EXPR_AND, + p_expr_new_ident(yasm_expr_int(yasm_intnum_create_uint(0xff)))); + case HIGH: + get_next_token(); + e = parse_expr6(parser_nasm, type); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "HIGH"); + return NULL; + } + return p_expr_new_tree( + p_expr_new_tree(e, YASM_EXPR_SHR, + p_expr_new_ident(yasm_expr_int( + yasm_intnum_create_uint(8)))), + YASM_EXPR_AND, + p_expr_new_ident(yasm_expr_int(yasm_intnum_create_uint(0xff)))); + case SEG: + get_next_token(); + e = parse_expr6(parser_nasm, type); + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "SEG"); + return NULL; + } + return p_expr_new_branch(YASM_EXPR_SEG, e); case '(': get_next_token(); e = parse_expr(parser_nasm, type); - if (!e) + if (!e) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("expected expression after %s"), "`('"); return NULL; + } if (!expect(')')) { yasm_error_set(YASM_ERROR_SYNTAX, N_("missing parenthesis")); return NULL; @@ -973,10 +1413,22 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) return e; case INTNUM: e = p_expr_new_ident(yasm_expr_int(INTNUM_val)); - break; + get_next_token(); + return e; case REG: - e = p_expr_new_ident(yasm_expr_reg(REG_val[0])); - break; + if (type == DV_EXPR) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("data values can't have registers")); + return NULL; + } + e = p_expr_new_ident(yasm_expr_reg(REG_val)); + get_next_token(); + return e; + } + + /* directives allow very little and handle IDs specially */ + if (type == DIR_EXPR) { + switch (curtok) { case ID: sym = yasm_symtab_use(p_symtab, ID_val, cur_line); e = p_expr_new_ident(yasm_expr_sym(sym)); @@ -986,60 +1438,31 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) return NULL; } } else switch (curtok) { - case '+': - get_next_token(); - return parse_expr6(parser_nasm, type); - case '-': - get_next_token(); - e = parse_expr6(parser_nasm, type); - if (!e) - return NULL; - return p_expr_new_branch(YASM_EXPR_NEG, e); - case '~': - get_next_token(); - e = parse_expr6(parser_nasm, type); - if (!e) - return NULL; - return p_expr_new_branch(YASM_EXPR_NOT, e); - case SEG: - get_next_token(); - e = parse_expr6(parser_nasm, type); - if (!e) - return NULL; - return p_expr_new_branch(YASM_EXPR_SEG, e); - case '(': - get_next_token(); - e = parse_expr(parser_nasm, type); - if (!e) - return NULL; - if (!expect(')')) { - yasm_error_set(YASM_ERROR_SYNTAX, N_("missing parenthesis")); - return NULL; - } - get_next_token(); - return e; - case INTNUM: - e = p_expr_new_ident(yasm_expr_int(INTNUM_val)); - break; case FLTNUM: e = p_expr_new_ident(yasm_expr_float(FLTNUM_val)); break; - case REG: - if (type == DV_EXPR) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("data values can't have registers")); - return NULL; - } - e = p_expr_new_ident(yasm_expr_reg(REG_val[0])); - break; case STRING: - e = p_expr_new_ident(yasm_expr_int( - yasm_intnum_create_charconst_nasm(STRING_val.contents))); + { + yasm_intnum *intn; + if (parser_nasm->tasm) + intn = yasm_intnum_create_charconst_tasm(STRING_val.contents); + else + intn = yasm_intnum_create_charconst_nasm(STRING_val.contents); + e = p_expr_new_ident(yasm_expr_int(intn)); yasm_xfree(STRING_val.contents); break; - case ID: + } case SPECIAL_ID: + sym = yasm_objfmt_get_special_sym(p_object, ID_val+2, "nasm"); + if (sym) { + e = p_expr_new_ident(yasm_expr_sym(sym)); + yasm_xfree(ID_val); + break; + } + /*@fallthrough@*/ + case ID: case LOCAL_ID: + case NONLOCAL_ID: sym = yasm_symtab_use(p_symtab, ID_val, cur_line); e = p_expr_new_ident(yasm_expr_sym(sym)); yasm_xfree(ID_val); @@ -1067,14 +1490,15 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) default: return NULL; } + get_next_token(); return e; } static void -define_label(yasm_parser_nasm *parser_nasm, char *name, int local) +set_nonlocal_label(yasm_parser_nasm *parser_nasm, const char *name) { - if (!local) { + if (!parser_nasm->tasm || tasm_locals) { if (parser_nasm->locallabel_base) yasm_xfree(parser_nasm->locallabel_base); parser_nasm->locallabel_base_len = strlen(name); @@ -1082,13 +1506,24 @@ define_label(yasm_parser_nasm *parser_nasm, char *name, int local) yasm_xmalloc(parser_nasm->locallabel_base_len+1); strcpy(parser_nasm->locallabel_base, name); } +} + +static void +define_label(yasm_parser_nasm *parser_nasm, char *name, unsigned int size) +{ + yasm_symrec *symrec; if (parser_nasm->abspos) - yasm_symtab_define_equ(p_symtab, name, - yasm_expr_copy(parser_nasm->abspos), cur_line); + symrec = yasm_symtab_define_equ(p_symtab, name, + yasm_expr_copy(parser_nasm->abspos), + cur_line); else - yasm_symtab_define_label(p_symtab, name, parser_nasm->prev_bc, 1, - cur_line); + symrec = yasm_symtab_define_label(p_symtab, name, parser_nasm->prev_bc, + 1, cur_line); + + yasm_symrec_set_size(symrec, size); + yasm_symrec_set_segment(symrec, tasm_segment); + yasm_xfree(name); } @@ -1136,15 +1571,21 @@ nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name, objext_valparams, line)) ; else if (yasm__strcasecmp(name, "absolute") == 0) { - vp = yasm_vps_first(valparams); - if (parser_nasm->absstart) - yasm_expr_destroy(parser_nasm->absstart); - if (parser_nasm->abspos) - yasm_expr_destroy(parser_nasm->abspos); - parser_nasm->absstart = yasm_vp_expr(vp, p_object->symtab, line); - parser_nasm->abspos = yasm_expr_copy(parser_nasm->absstart); - cursect = NULL; - parser_nasm->prev_bc = NULL; + if (!valparams) { + yasm_error_set(YASM_ERROR_SYNTAX, + N_("directive `%s' requires an argument"), + "absolute"); + } else { + vp = yasm_vps_first(valparams); + if (parser_nasm->absstart) + yasm_expr_destroy(parser_nasm->absstart); + if (parser_nasm->abspos) + yasm_expr_destroy(parser_nasm->abspos); + parser_nasm->absstart = yasm_vp_expr(vp, p_object->symtab, line); + parser_nasm->abspos = yasm_expr_copy(parser_nasm->absstart); + cursect = NULL; + parser_nasm->prev_bc = NULL; + } } else if (yasm__strcasecmp(name, "align") == 0) { /* Really, we shouldn't end up with an align directive in an absolute * section (as it's supposed to be only used for nop fill), but handle @@ -1171,6 +1612,27 @@ nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name, N_("directive `%s' requires an argument"), "align"); } else dir_align(p_object, valparams, objext_valparams, line); + } else if (yasm__strcasecmp(name, "default") == 0) { + if (!valparams) + ; + else { + vp = yasm_vps_first(valparams); + while (vp) { + const char *id = yasm_vp_id(vp); + if (id) { + if (yasm__strcasecmp(id, "rel") == 0) + yasm_arch_set_var(p_object->arch, "default_rel", 1); + else if (yasm__strcasecmp(id, "abs") == 0) + yasm_arch_set_var(p_object->arch, "default_rel", 0); + else + yasm_error_set(YASM_ERROR_SYNTAX, + N_("unrecognized default `%s'"), id); + } else + yasm_error_set(YASM_ERROR_SYNTAX, + N_("unrecognized default value")); + vp = yasm_vps_next(vp); + } + } } else yasm_error_set(YASM_ERROR_SYNTAX, N_("unrecognized directive `%s'"), name); @@ -1195,3 +1657,25 @@ nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name, if (objext_valparams) yasm_vps_delete(objext_valparams); } + +yasm_bytecode * +gas_intel_syntax_parse_instr(yasm_parser_nasm *parser_nasm, unsigned char *instr) +{ + yasm_bytecode *bc = NULL; + char *sinstr = (char *) instr; + + parser_nasm->s.bot = instr; + parser_nasm->s.tok = instr; + parser_nasm->s.ptr = instr; + parser_nasm->s.cur = instr; + parser_nasm->s.lim = instr + strlen(sinstr) + 1; + parser_nasm->s.top = parser_nasm->s.lim; + parser_nasm->peek_token = NONE; + + get_next_token(); + if (!is_eol()) { + bc = parse_instr(parser_nasm); + } + + return bc; +} diff --git a/modules/parsers/nasm/nasm-parser-struct.h b/modules/parsers/nasm/nasm-parser-struct.h new file mode 100644 index 00000000..b9223510 --- /dev/null +++ b/modules/parsers/nasm/nasm-parser-struct.h @@ -0,0 +1,85 @@ +/* + * NASM-compatible parser struct header file + * + * Copyright (C) 2002-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef YASM_NASM_PARSER_STRUCT_H +#define YASM_NASM_PARSER_STRUCT_H + +typedef union { + unsigned int int_info; + char *str_val; + yasm_intnum *intn; + yasm_floatnum *flt; + yasm_bytecode *bc; + uintptr_t arch_data; + struct { + char *contents; + size_t len; + } str; +} nasm_yystype; + +typedef struct yasm_parser_nasm { + int tasm; + int masm; + + /*@only@*/ yasm_object *object; + + /* last "base" label for local (.) labels */ + /*@null@*/ char *locallabel_base; + size_t locallabel_base_len; + + /*@dependent@*/ yasm_preproc *preproc; + /*@dependent@*/ yasm_errwarns *errwarns; + + /*@dependent@*/ yasm_linemap *linemap; + + /*@null@*/ yasm_bytecode *prev_bc; + + int save_input; + + yasm_scanner s; + int state; + + int token; /* enum tokentype or any character */ + nasm_yystype tokval; + char tokch; /* first character of token */ + + /* one token of lookahead; used sparingly */ + int peek_token; /* NONE if none */ + nasm_yystype peek_tokval; + char peek_tokch; + + /* Starting point of the absolute section. NULL if not in an absolute + * section. + */ + /*@null@*/ yasm_expr *absstart; + + /* Current location inside an absolute section (including the start). + * NULL if not in an absolute section. + */ + /*@null@*/ yasm_expr *abspos; +} yasm_parser_nasm; + +#endif diff --git a/modules/parsers/nasm/nasm-parser.c b/modules/parsers/nasm/nasm-parser.c index 2fa1934b..bd166929 100644 --- a/modules/parsers/nasm/nasm-parser.c +++ b/modules/parsers/nasm/nasm-parser.c @@ -25,26 +25,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "nasm-parser.h" static void -nasm_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, - int save_input, yasm_linemap *linemap, - yasm_errwarns *errwarns) +nasm_do_parse(yasm_object *object, yasm_preproc *pp, int save_input, + yasm_linemap *linemap, yasm_errwarns *errwarns, int tasm) { yasm_parser_nasm parser_nasm; + parser_nasm.tasm = tasm; + parser_nasm.masm = 0; + parser_nasm.object = object; parser_nasm.linemap = linemap; - parser_nasm.in = f; - parser_nasm.locallabel_base = (char *)NULL; parser_nasm.locallabel_base_len = 0; @@ -54,7 +52,6 @@ nasm_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, parser_nasm.prev_bc = yasm_section_bcs_first(object->cur_section); parser_nasm.save_input = save_input; - parser_nasm.save_last = 0; parser_nasm.peek_token = NONE; @@ -66,12 +63,9 @@ nasm_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, parser_nasm.state = INITIAL; - /* yacc debugging, needs YYDEBUG set in bison.y.in to work */ - /* nasm_parser_debug = 1; */ - nasm_parser_parse(&parser_nasm); - yasm_scanner_delete(&parser_nasm.s); + /*yasm_scanner_delete(&parser_nasm.s);*/ /* Free locallabel base if necessary */ if (parser_nasm.locallabel_base) @@ -81,6 +75,16 @@ nasm_parser_do_parse(yasm_object *object, yasm_preproc *pp, FILE *f, yasm_symtab_parser_finalize(object->symtab, 0, errwarns); } +static void +nasm_parser_do_parse(yasm_object *object, yasm_preproc *pp, + int save_input, yasm_linemap *linemap, + yasm_errwarns *errwarns) +{ + nasm_do_parse(object, pp, save_input, linemap, errwarns, 0); +} + +#include "nasm-macros.c" + /* Define valid preprocessors to use with this parser */ static const char *nasm_parser_preproc_keywords[] = { "raw", @@ -88,11 +92,49 @@ static const char *nasm_parser_preproc_keywords[] = { NULL }; +static const yasm_stdmac nasm_parser_stdmacs[] = { + { "nasm", "nasm", nasm_standard_mac }, + { NULL, NULL, NULL } +}; + /* Define parser structure -- see parser.h for details */ yasm_parser_module yasm_nasm_LTX_parser = { "NASM-compatible parser", "nasm", nasm_parser_preproc_keywords, "nasm", + nasm_parser_stdmacs, nasm_parser_do_parse }; + +static void +tasm_parser_do_parse(yasm_object *object, yasm_preproc *pp, + int save_input, yasm_linemap *linemap, + yasm_errwarns *errwarns) +{ + yasm_symtab_set_case_sensitive(object->symtab, 0); + yasm_warn_disable(YASM_WARN_IMPLICIT_SIZE_OVERRIDE); + nasm_do_parse(object, pp, save_input, linemap, errwarns, 1); +} + +/* Define valid preprocessors to use with this parser */ +static const char *tasm_parser_preproc_keywords[] = { + "raw", + "tasm", + NULL +}; + +static const yasm_stdmac tasm_parser_stdmacs[] = { + { "tasm", "tasm", nasm_standard_mac }, + { NULL, NULL, NULL } +}; + +/* Define parser structure -- see parser.h for details */ +yasm_parser_module yasm_tasm_LTX_parser = { + "TASM-compatible parser", + "tasm", + tasm_parser_preproc_keywords, + "tasm", + tasm_parser_stdmacs, + tasm_parser_do_parse +}; diff --git a/modules/parsers/nasm/nasm-parser.h b/modules/parsers/nasm/nasm-parser.h index de0824b5..dc19cfb5 100644 --- a/modules/parsers/nasm/nasm-parser.h +++ b/modules/parsers/nasm/nasm-parser.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * NASM-compatible parser header file * * Copyright (C) 2002-2007 Peter Johnson @@ -27,6 +27,8 @@ #ifndef YASM_NASM_PARSER_H #define YASM_NASM_PARSER_H +#include "nasm-parser-struct.h" + #define YYCTYPE unsigned char #define MAX_SAVED_LINE_LEN 80 @@ -38,96 +40,52 @@ enum tokentype { FILENAME, STRING, SIZE_OVERRIDE, + OFFSET, DECLARE_DATA, RESERVE_SPACE, + LABEL, INCBIN, EQU, TIMES, + DUP, SEG, WRT, + ABS, + REL, NOSPLIT, STRICT, INSN, PREFIX, REG, + REGGROUP, SEGREG, TARGETMOD, LEFT_OP, RIGHT_OP, + LOW, + HIGH, SIGNDIV, SIGNMOD, START_SECTION_ID, ID, LOCAL_ID, SPECIAL_ID, + NONLOCAL_ID, LINE, NONE /* special token for lookahead */ }; -typedef union { - unsigned int int_info; - char *str_val; - yasm_intnum *intn; - yasm_floatnum *flt; - uintptr_t arch_data[4]; - struct { - char *contents; - size_t len; - } str; -} yystype; -#define YYSTYPE yystype +enum nasm_parser_state { + INITIAL, + DIRECTIVE, + SECTION_DIRECTIVE, + DIRECTIVE2, + LINECHG, + LINECHG2, + INSTRUCTION +}; -typedef struct yasm_parser_nasm { - FILE *in; - int debug; - - /*@only@*/ yasm_object *object; - - /* last "base" label for local (.) labels */ - /*@null@*/ char *locallabel_base; - size_t locallabel_base_len; - - /*@dependent@*/ yasm_preproc *preproc; - /*@dependent@*/ yasm_errwarns *errwarns; - - /*@dependent@*/ yasm_linemap *linemap; - - /*@null@*/ yasm_bytecode *prev_bc; - - int save_input; - YYCTYPE save_line[2][MAX_SAVED_LINE_LEN]; - int save_last; - - yasm_scanner s; - enum { - INITIAL, - DIRECTIVE, - SECTION_DIRECTIVE, - DIRECTIVE2, - LINECHG, - LINECHG2, - INSTRUCTION - } state; - - int token; /* enum tokentype or any character */ - yystype tokval; - char tokch; /* first character of token */ - - /* one token of lookahead; used sparingly */ - int peek_token; /* NONE if none */ - yystype peek_tokval; - char peek_tokch; - - /* Starting point of the absolute section. NULL if not in an absolute - * section. - */ - /*@null@*/ yasm_expr *absstart; - - /* Current location inside an absolute section (including the start). - * NULL if not in an absolute section. - */ - /*@null@*/ yasm_expr *abspos; -} yasm_parser_nasm; +#define YYSTYPE nasm_yystype /* shorter access names to commonly used parser_nasm fields */ #define p_object (parser_nasm->object) @@ -144,9 +102,10 @@ typedef struct yasm_parser_nasm { #define SIZE_OVERRIDE_val (curval.int_info) #define DECLARE_DATA_val (curval.int_info) #define RESERVE_SPACE_val (curval.int_info) -#define INSN_val (curval.arch_data) +#define INSN_val (curval.bc) #define PREFIX_val (curval.arch_data) #define REG_val (curval.arch_data) +#define REGGROUP_val (curval.arch_data) #define SEGREG_val (curval.arch_data) #define TARGETMOD_val (curval.arch_data) #define ID_val (curval.str_val) diff --git a/modules/parsers/nasm/nasm-std.mac b/modules/parsers/nasm/nasm-std.mac new file mode 100644 index 00000000..bb6e5c4e --- /dev/null +++ b/modules/parsers/nasm/nasm-std.mac @@ -0,0 +1,109 @@ +; Standard macro set for NASM -*- nasm -*- + +; Note that although some user-level forms of directives are defined +; here, not all of them are: the user-level form of a format-specific +; directive should be defined in the module for that directive. + +; These two need to be defined, though the actual definitions will +; be constantly updated during preprocessing. +%define __FILE__ +%define __LINE__ + +%define __SECT__ [section .text] ; it ought to be defined, even if as nothing + +%imacro section 1+.nolist +%define __SECT__ [section %1] + __SECT__ +%endmacro +%imacro segment 1+.nolist +%define __SECT__ [segment %1] + __SECT__ +%endmacro + +%imacro absolute 1+.nolist +%define __SECT__ [absolute %1] + __SECT__ +%endmacro + +%imacro struc 1-2.nolist 0 +%push struc +%define %$strucname %1 +[absolute %2] +%$strucname: ; allow definition of `.member' to work sanely +%endmacro +%imacro endstruc 0.nolist +%{$strucname}_size EQU $ - %$strucname +%pop +__SECT__ +%endmacro + +%imacro istruc 1.nolist +%push istruc +%define %$strucname %1 +%$strucstart: +%endmacro +%imacro at 1-2+.nolist + times %1-($-%$strucstart) db 0 + %2 +%endmacro +%imacro iend 0.nolist + times %{$strucname}_size-($-%$strucstart) db 0 +%pop +%endmacro + +%imacro align 1-2+.nolist nop +%ifidni %2,nop + [align %1] +%else + times ($$-$) & ((%1)-1) %2 +%endif +%endmacro +%imacro alignb 1-2+.nolist resb 1 + times ($$-$) & ((%1)-1) %2 +%endmacro + +%imacro extern 1-*.nolist +%rep %0 +[extern %1] +%rotate 1 +%endrep +%endmacro + +%imacro bits 1+.nolist +[bits %1] +%endmacro + +%imacro use16 0.nolist +[bits 16] +%endmacro +%imacro use32 0.nolist +[bits 32] +%endmacro +%imacro use64 0.nolist +[bits 64] +%endmacro + +%imacro global 1-*.nolist +%rep %0 +[global %1] +%rotate 1 +%endrep +%endmacro + +%imacro common 1-*.nolist +%rep %0 +[common %1] +%rotate 1 +%endrep +%endmacro + +%imacro cpu 1+.nolist +[cpu %1] +%endmacro + +%imacro default 1+.nolist +[default %1] +%endmacro + +; NASM compatibility shim +%define __OUTPUT_FORMAT__ __YASM_OBJFMT__ diff --git a/modules/parsers/nasm/nasm-token.re b/modules/parsers/nasm/nasm-token.re index 56bd8dfc..b2110ce9 100644 --- a/modules/parsers/nasm/nasm-token.re +++ b/modules/parsers/nasm/nasm-token.re @@ -27,20 +27,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "modules/parsers/nasm/nasm-parser.h" +#include "modules/preprocs/nasm/nasm.h" -#define BSIZE 8192 - #define YYCURSOR cursor #define YYLIMIT (s->lim) #define YYMARKER (s->ptr) -#define YYFILL(n) {fill(parser_nasm, &cursor);} +#define YYFILL(n) {} #define RETURN(i) {s->cur = cursor; parser_nasm->tokch = s->tok[0]; \ return i;} @@ -51,48 +48,6 @@ RCSID("$Id$"); #define TOKLEN (size_t)(cursor-s->tok) -static size_t -fill_input(void *d, unsigned char *buf, size_t max) -{ - return yasm_preproc_input((yasm_preproc *)d, (char *)buf, max); -} - -static void -fill(yasm_parser_nasm *parser_nasm, YYCTYPE **cursor) -{ - yasm_scanner *s = &parser_nasm->s; - if (yasm_fill_helper(s, cursor, fill_input, parser_nasm->preproc) - && parser_nasm->save_input) { - int i; - YYCTYPE *saveline; - parser_nasm->save_last ^= 1; - saveline = parser_nasm->save_line[parser_nasm->save_last]; - /* save next line into cur_line */ - for (i=0; i<79 && &s->tok[i] < s->lim && s->tok[i] != '\n'; i++) - saveline[i] = s->tok[i]; - saveline[i] = '\0'; - } -} - -static YYCTYPE * -save_line(yasm_parser_nasm *parser_nasm, YYCTYPE *cursor) -{ - yasm_scanner *s = &parser_nasm->s; - int i = 0; - YYCTYPE *saveline; - - parser_nasm->save_last ^= 1; - saveline = parser_nasm->save_line[parser_nasm->save_last]; - - /* save next line into cur_line */ - if ((YYLIMIT - YYCURSOR) < 80) - YYFILL(80); - for (i=0; i<79 && &cursor[i] < s->lim && cursor[i] != '\n'; i++) - saveline[i] = cursor[i]; - saveline[i] = '\0'; - return cursor; -} - /* starting size of string buffer */ #define STRBUF_ALLOC_SIZE 128 @@ -105,16 +60,57 @@ static size_t strbuf_size = 0; static int linechg_numcount; /*!re2c - any = [\000-\377]; + any = [\001-\377]; digit = [0-9]; iletter = [a-zA-Z]; - bindigit = [01]; - octdigit = [0-7]; - hexdigit = [0-9a-fA-F]; + bindigit = [01_]; + octdigit = [0-7_]; + hexdigit = [0-9a-fA-F_]; ws = [ \t\r]; quot = ["']; */ +static int +handle_dot_label(YYSTYPE *lvalp, char *tok, size_t toklen, size_t zeropos, + yasm_parser_nasm *parser_nasm) +{ + /* check for special non-local labels like ..start */ + if (tok[zeropos+1] == '.') { + lvalp->str_val = yasm__xstrndup(tok+zeropos+(parser_nasm->tasm?2:0), + toklen-zeropos-(parser_nasm->tasm?2:0)); + /* check for special non-local ..@label */ + if (lvalp->str_val[2] == '@') + return NONLOCAL_ID; + return SPECIAL_ID; + } + if (parser_nasm->masm && tok[zeropos] == '.') { + lvalp->str_val = yasm__xstrndup(tok + zeropos, toklen - zeropos); + return SPECIAL_ID; + } + if (parser_nasm->tasm && (!tasm_locals || + (tok[zeropos] == '.' && + tok[zeropos+1] != '@' && tok[zeropos+2] != '@'))) { + /* no locals on Tasm without the 'locals' directive */ + /* .foo is never local either, but .@@foo may be (local structure + * members) */ + lvalp->str_val = yasm__xstrndup(tok + zeropos, toklen - zeropos); + return SPECIAL_ID; + } + if (!parser_nasm->locallabel_base) { + lvalp->str_val = yasm__xstrndup(tok+zeropos, toklen-zeropos); + yasm_warn_set(YASM_WARN_GENERAL, + N_("no non-local label before `%s'"), + lvalp->str_val); + } else { + size_t len = toklen - zeropos + parser_nasm->locallabel_base_len; + lvalp->str_val = yasm_xmalloc(len + 1); + strcpy(lvalp->str_val, parser_nasm->locallabel_base); + strncat(lvalp->str_val, tok+zeropos, toklen-zeropos); + lvalp->str_val[len] = '\0'; + } + + return LOCAL_ID; +} int nasm_parser_lex(YYSTYPE *lvalp, yasm_parser_nasm *parser_nasm) @@ -122,7 +118,7 @@ nasm_parser_lex(YYSTYPE *lvalp, yasm_parser_nasm *parser_nasm) yasm_scanner *s = &parser_nasm->s; YYCTYPE *cursor = s->cur; YYCTYPE endch; - size_t count, len; + size_t count; YYCTYPE savech; /* Handle one token of lookahead */ @@ -134,7 +130,7 @@ nasm_parser_lex(YYSTYPE *lvalp, yasm_parser_nasm *parser_nasm) return tok; } - /* Catch EOF */ + /* Catch EOL (EOF from the scanner perspective) */ if (s->eof && cursor == s->eof) return 0; @@ -156,6 +152,8 @@ nasm_parser_lex(YYSTYPE *lvalp, yasm_parser_nasm *parser_nasm) scan: SCANINIT(); + if (*cursor == '\0') + goto endofinput; /*!re2c /* standard decimal integer */ @@ -168,14 +166,14 @@ scan: } /* 10010011b - binary number */ - bindigit+ 'b' { + [01] bindigit* 'b' { s->tok[TOKLEN-1] = '\0'; /* strip off 'b' */ lvalp->intn = yasm_intnum_create_bin(TOK); RETURN(INTNUM); } /* 777q or 777o - octal number */ - octdigit+ [qQoO] { + [0-7] octdigit* [qQoO] { s->tok[TOKLEN-1] = '\0'; /* strip off 'q' or 'o' */ lvalp->intn = yasm_intnum_create_oct(TOK); RETURN(INTNUM); @@ -189,10 +187,10 @@ scan: } /* $0AA and 0xAA forms of hexidecimal number */ - (("$" digit) | "0x") hexdigit+ { + (("$" digit) | '0x') hexdigit+ { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; - if (s->tok[1] == 'x') + if (s->tok[1] == 'x' || s->tok[1] == 'X') /* skip 0 and x */ lvalp->intn = yasm_intnum_create_hex(TOK+2); else @@ -247,51 +245,105 @@ scan: lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8; RETURN(SIZE_OVERRIDE); } + 'oword' { + lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8; + RETURN(SIZE_OVERRIDE); + } + 'yword' { + lvalp->int_info = 256; + RETURN(SIZE_OVERRIDE); + } /* pseudo-instructions */ - 'db' { lvalp->int_info = 8; RETURN(DECLARE_DATA); } + 'db' { + lvalp->int_info = 8; + parser_nasm->state = INSTRUCTION; + RETURN(DECLARE_DATA); + } 'dhw' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)/2; + parser_nasm->state = INSTRUCTION; RETURN(DECLARE_DATA); } 'dw' { lvalp->int_info = yasm_arch_wordsize(p_object->arch); + parser_nasm->state = INSTRUCTION; RETURN(DECLARE_DATA); } 'dd' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)*2; + parser_nasm->state = INSTRUCTION; RETURN(DECLARE_DATA); } 'dq' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)*4; + parser_nasm->state = INSTRUCTION; + RETURN(DECLARE_DATA); + } + 'dt' { + lvalp->int_info = 80; + parser_nasm->state = INSTRUCTION; RETURN(DECLARE_DATA); } - 'dt' { lvalp->int_info = 80; RETURN(DECLARE_DATA); } 'ddq' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8; + parser_nasm->state = INSTRUCTION; + RETURN(DECLARE_DATA); + } + 'do' { + lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8; + parser_nasm->state = INSTRUCTION; + RETURN(DECLARE_DATA); + } + 'dy' { + lvalp->int_info = 256; + parser_nasm->state = INSTRUCTION; RETURN(DECLARE_DATA); } - 'resb' { lvalp->int_info = 8; RETURN(RESERVE_SPACE); } + 'resb' { + lvalp->int_info = 8; + parser_nasm->state = INSTRUCTION; + RETURN(RESERVE_SPACE); + } 'reshw' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)/2; + parser_nasm->state = INSTRUCTION; RETURN(RESERVE_SPACE); } 'resw' { lvalp->int_info = yasm_arch_wordsize(p_object->arch); + parser_nasm->state = INSTRUCTION; RETURN(RESERVE_SPACE); } 'resd' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)*2; + parser_nasm->state = INSTRUCTION; RETURN(RESERVE_SPACE); } 'resq' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)*4; + parser_nasm->state = INSTRUCTION; + RETURN(RESERVE_SPACE); + } + 'rest' { + lvalp->int_info = 80; + parser_nasm->state = INSTRUCTION; RETURN(RESERVE_SPACE); } - 'rest' { lvalp->int_info = 80; RETURN(RESERVE_SPACE); } 'resdq' { lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8; + parser_nasm->state = INSTRUCTION; + RETURN(RESERVE_SPACE); + } + 'reso' { + lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8; + parser_nasm->state = INSTRUCTION; + RETURN(RESERVE_SPACE); + } + 'resy' { + lvalp->int_info = 256; + parser_nasm->state = INSTRUCTION; RETURN(RESERVE_SPACE); } @@ -304,6 +356,9 @@ scan: 'seg' { RETURN(SEG); } 'wrt' { RETURN(WRT); } + 'abs' { RETURN(ABS); } + 'rel' { RETURN(REL); } + 'nosplit' { RETURN(NOSPLIT); } 'strict' { RETURN(STRICT); } @@ -313,58 +368,48 @@ scan: "//" { RETURN(SIGNDIV); } "%%" { RETURN(SIGNMOD); } "$$" { RETURN(START_SECTION_ID); } - [-+|^*&/%~$():=,\[] { RETURN(s->tok[0]); } + [-+|^*&/%~$():=,\[?] { RETURN(s->tok[0]); } "]" { RETURN(s->tok[0]); } - /* special non-local ..@label and labels like ..start */ - ".." [a-zA-Z0-9_$#@~.?]+ { - lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); - RETURN(SPECIAL_ID); - } - /* local label (.label) */ - "." [a-zA-Z0-9_$#@~?][a-zA-Z0-9_$#@~.?]* { - if (!parser_nasm->locallabel_base) { - lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); - yasm_warn_set(YASM_WARN_GENERAL, - N_("no non-local label before `%s'"), - lvalp->str_val); - } else { - len = TOKLEN + parser_nasm->locallabel_base_len; - lvalp->str_val = yasm_xmalloc(len + 1); - strcpy(lvalp->str_val, parser_nasm->locallabel_base); - strncat(lvalp->str_val, TOK, TOKLEN); - lvalp->str_val[len] = '\0'; - } - - RETURN(LOCAL_ID); + ("." | "@@") [a-zA-Z0-9_$#@~.?]+ { + RETURN(handle_dot_label(lvalp, TOK, TOKLEN, 0, parser_nasm)); } /* forced identifier */ "$" [a-zA-Z0-9_$#@~.?]+ { + if (TOK[1] == '.' || + (parser_nasm->tasm && TOK[1] == '@' && TOK[2] == '@')) { + /* handle like .label */ + RETURN(handle_dot_label(lvalp, TOK, TOKLEN, 1, parser_nasm)); + } lvalp->str_val = yasm__xstrndup(TOK+1, TOKLEN-1); RETURN(ID); } /* identifier that may be a register, instruction, etc. */ - [a-zA-Z_?][a-zA-Z0-9_$#@~.?]* { + [a-zA-Z_?@][a-zA-Z0-9_$#@~.?]* { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; - if (parser_nasm->state != INSTRUCTION) + if (parser_nasm->state != INSTRUCTION) { + uintptr_t prefix; switch (yasm_arch_parse_check_insnprefix - (p_object->arch, lvalp->arch_data, TOK, TOKLEN)) { + (p_object->arch, TOK, TOKLEN, cur_line, &lvalp->bc, + &prefix)) { case YASM_ARCH_INSN: parser_nasm->state = INSTRUCTION; s->tok[TOKLEN] = savech; RETURN(INSN); case YASM_ARCH_PREFIX: + lvalp->arch_data = prefix; s->tok[TOKLEN] = savech; RETURN(PREFIX); default: break; } + } switch (yasm_arch_parse_check_regtmod - (p_object->arch, lvalp->arch_data, TOK, TOKLEN)) { + (p_object->arch, TOK, TOKLEN, &lvalp->arch_data)) { case YASM_ARCH_REG: s->tok[TOKLEN] = savech; RETURN(REG); @@ -374,26 +419,85 @@ scan: case YASM_ARCH_TARGETMOD: s->tok[TOKLEN] = savech; RETURN(TARGETMOD); + case YASM_ARCH_REGGROUP: + if (parser_nasm->masm) { + s->tok[TOKLEN] = savech; + RETURN(REGGROUP); + } default: + break; + } + if (parser_nasm->masm) { + if (!yasm__strcasecmp(TOK, "offset")) { s->tok[TOKLEN] = savech; + RETURN(OFFSET); + } + } else if (parser_nasm->tasm) { + if (!yasm__strcasecmp(TOK, "shl")) { + s->tok[TOKLEN] = savech; + RETURN(LEFT_OP); + } + if (!yasm__strcasecmp(TOK, "shr")) { + s->tok[TOKLEN] = savech; + RETURN(RIGHT_OP); + } + if (!yasm__strcasecmp(TOK, "and")) { + s->tok[TOKLEN] = savech; + RETURN('&'); + } + if (!yasm__strcasecmp(TOK, "or")) { + s->tok[TOKLEN] = savech; + RETURN('|'); + } + if (!yasm__strcasecmp(TOK, "not")) { + s->tok[TOKLEN] = savech; + RETURN('~'); + } + if (!yasm__strcasecmp(TOK, "low")) { + s->tok[TOKLEN] = savech; + RETURN(LOW); + } + if (!yasm__strcasecmp(TOK, "high")) { + s->tok[TOKLEN] = savech; + RETURN(HIGH); + } + if (!yasm__strcasecmp(TOK, "offset")) { + s->tok[TOKLEN] = savech; + RETURN(OFFSET); + } + if (!yasm__strcasecmp(TOK, "fword")) { + s->tok[TOKLEN] = savech; + lvalp->int_info = yasm_arch_wordsize(p_object->arch)*2; + RETURN(SIZE_OVERRIDE); + } + if (!yasm__strcasecmp(TOK, "df")) { + s->tok[TOKLEN] = savech; + lvalp->int_info = yasm_arch_wordsize(p_object->arch)*3; + parser_nasm->state = INSTRUCTION; + RETURN(DECLARE_DATA); + } + if (!yasm__strcasecmp(TOK, "label")) { + s->tok[TOKLEN] = savech; + RETURN(LABEL); + } + if (!yasm__strcasecmp(TOK, "dup")) { + s->tok[TOKLEN] = savech; + RETURN(DUP); + } } /* Propagate errors in case we got a warning from the arch */ yasm_errwarn_propagate(parser_nasm->errwarns, cur_line); /* Just an identifier, return as such. */ + s->tok[TOKLEN] = savech; lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); RETURN(ID); } - ";" (any \ [\n])* { goto scan; } + ";" (any \ [\000])* { goto scan; } ws+ { goto scan; } - "\n" { - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + [\000] { goto endofinput; } any { yasm_warn_set(YASM_WARN_UNREC_CHAR, @@ -406,6 +510,8 @@ scan: /* %line linenum+lineinc filename */ linechg: SCANINIT(); + if (*cursor == '\0') + goto endofinput; /*!re2c digit+ { @@ -417,12 +523,7 @@ linechg: RETURN(INTNUM); } - "\n" { - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + [\000] { goto endofinput; } "+" { RETURN(s->tok[0]); @@ -446,18 +547,15 @@ linechg: linechg2: SCANINIT(); + if (*cursor == '\0') + goto endofinput; /*!re2c - "\n" { - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + [\000] { goto endofinput; } - "\r" { } + "\r" { goto linechg2; } - (any \ [\r\n])+ { + (any \ [\000])+ { parser_nasm->state = LINECHG; lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); RETURN(FILENAME); @@ -467,14 +565,11 @@ linechg2: /* directive: [name value] */ directive: SCANINIT(); + if (*cursor == '\0') + goto endofinput; /*!re2c - [\]\n] { - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + [\]\000] { goto endofinput; } [a-zA-Z_][a-zA-Z_0-9]* { lvalp->str_val = yasm__xstrndup(TOK, TOKLEN); @@ -497,6 +592,8 @@ directive: /* section directive (the section name portion thereof) */ section_directive: SCANINIT(); + if (*cursor == '\0') + goto endofinput; /*!re2c [a-zA-Z0-9_$#@~.?-]+ { @@ -517,17 +614,7 @@ section_directive: goto section_directive; } - "]" { - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } - - "\n" { - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + [\]\000] { goto endofinput; } any { yasm_warn_set(YASM_WARN_UNREC_CHAR, @@ -540,6 +627,8 @@ section_directive: /* inner part of directive */ directive2: SCANINIT(); + if (*cursor == '\0') + goto endofinput; /*!re2c /* standard decimal integer */ @@ -552,14 +641,14 @@ directive2: } /* 10010011b - binary number */ - bindigit+ 'b' { + [01] bindigit* 'b' { s->tok[TOKLEN-1] = '\0'; /* strip off 'b' */ lvalp->intn = yasm_intnum_create_bin(TOK); RETURN(INTNUM); } /* 777q or 777o - octal number */ - octdigit+ [qQoO] { + [0-7] octdigit* [qQoO] { s->tok[TOKLEN-1] = '\0'; /* strip off 'q' or 'o' */ lvalp->intn = yasm_intnum_create_oct(TOK); RETURN(INTNUM); @@ -573,10 +662,10 @@ directive2: } /* $0AA and 0xAA forms of hexidecimal number */ - (("$" digit) | "0x") hexdigit+ { + (("$" digit) | '0x') hexdigit+ { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; - if (s->tok[1] == 'x') + if (s->tok[1] == 'x' || s->tok[1] == 'X') /* skip 0 and x */ lvalp->intn = yasm_intnum_create_hex(TOK+2); else @@ -600,10 +689,7 @@ directive2: [-+|^*&/%~$():=,\[] { RETURN(s->tok[0]); } /* handle ] for directives */ - "]" { - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + "]" { goto endofinput; } /* forced identifier; within directive, don't strip '$', this is * handled later. @@ -618,7 +704,7 @@ directive2: savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; switch (yasm_arch_parse_check_regtmod - (p_object->arch, lvalp->arch_data, TOK, TOKLEN)) { + (p_object->arch, TOK, TOKLEN, &lvalp->arch_data)) { case YASM_ARCH_REG: s->tok[TOKLEN] = savech; RETURN(REG); @@ -632,16 +718,11 @@ directive2: RETURN(ID); } - ";" (any \ [\n])* { goto directive2; } + ";" (any \ [\000])* { goto directive2; } ws+ { goto directive2; } - "\n" { - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - parser_nasm->state = INITIAL; - RETURN(s->tok[0]); - } + [\000] { goto endofinput; } any { yasm_warn_set(YASM_WARN_UNREC_CHAR, @@ -659,29 +740,35 @@ stringconst: stringconst_scan: SCANINIT(); + if (*cursor == '\0') + goto stringconst_error; /*!re2c - "\n" { - if (cursor == s->eof) - yasm_error_set(YASM_ERROR_SYNTAX, - N_("unexpected end of file in string")); - else - yasm_error_set(YASM_ERROR_SYNTAX, N_("unterminated string")); - strbuf[count] = '\0'; - lvalp->str.contents = (char *)strbuf; - lvalp->str.len = count; - if (parser_nasm->save_input) - cursor = save_line(parser_nasm, cursor); - RETURN(STRING); + [\000] { goto stringconst_error; } + + "''" | '""' { + if (endch != s->tok[0]) { + strbuf[count++] = s->tok[0]; + if (count >= strbuf_size) { + strbuf = yasm_xrealloc(strbuf, + strbuf_size + STRBUF_ALLOC_SIZE); + strbuf_size += STRBUF_ALLOC_SIZE; + } + } else if (!parser_nasm->tasm) { + YYCURSOR--; + goto stringconst_end; + } + strbuf[count++] = s->tok[0]; + if (count >= strbuf_size) { + strbuf = yasm_xrealloc(strbuf, strbuf_size + STRBUF_ALLOC_SIZE); + strbuf_size += STRBUF_ALLOC_SIZE; + } + goto stringconst_scan; } any { - if (s->tok[0] == endch) { - strbuf[count] = '\0'; - lvalp->str.contents = (char *)strbuf; - lvalp->str.len = count; - RETURN(STRING); - } + if (s->tok[0] == endch) + goto stringconst_end; strbuf[count++] = s->tok[0]; if (count >= strbuf_size) { @@ -692,4 +779,17 @@ stringconst_scan: goto stringconst_scan; } */ + +stringconst_error: + yasm_error_set(YASM_ERROR_SYNTAX, N_("unterminated string")); + +stringconst_end: + strbuf[count] = '\0'; + lvalp->str.contents = (char *)strbuf; + lvalp->str.len = count; + RETURN(STRING); + +endofinput: + parser_nasm->state = INITIAL; + RETURN(s->tok[0]); } diff --git a/modules/parsers/nasm/tests/Makefile.inc b/modules/parsers/nasm/tests/Makefile.inc index 552320cc..56d0b926 100644 --- a/modules/parsers/nasm/tests/Makefile.inc +++ b/modules/parsers/nasm/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/parsers/nasm/tests/nasm_test.sh EXTRA_DIST += modules/parsers/nasm/tests/nasm_test.sh @@ -9,14 +7,27 @@ EXTRA_DIST += modules/parsers/nasm/tests/alignnop32.asm EXTRA_DIST += modules/parsers/nasm/tests/alignnop32.hex EXTRA_DIST += modules/parsers/nasm/tests/charconstmath.asm EXTRA_DIST += modules/parsers/nasm/tests/charconstmath.hex +EXTRA_DIST += modules/parsers/nasm/tests/dirwarning.asm +EXTRA_DIST += modules/parsers/nasm/tests/dirwarning.errwarn +EXTRA_DIST += modules/parsers/nasm/tests/dirwarning.hex +EXTRA_DIST += modules/parsers/nasm/tests/dy.asm +EXTRA_DIST += modules/parsers/nasm/tests/dy.hex EXTRA_DIST += modules/parsers/nasm/tests/endcomma.asm EXTRA_DIST += modules/parsers/nasm/tests/endcomma.hex EXTRA_DIST += modules/parsers/nasm/tests/equcolon.asm EXTRA_DIST += modules/parsers/nasm/tests/equcolon.hex EXTRA_DIST += modules/parsers/nasm/tests/equlocal.asm EXTRA_DIST += modules/parsers/nasm/tests/equlocal.hex +EXTRA_DIST += modules/parsers/nasm/tests/hexconst.asm +EXTRA_DIST += modules/parsers/nasm/tests/hexconst.hex EXTRA_DIST += modules/parsers/nasm/tests/long.asm EXTRA_DIST += modules/parsers/nasm/tests/long.hex +EXTRA_DIST += modules/parsers/nasm/tests/locallabel.asm +EXTRA_DIST += modules/parsers/nasm/tests/locallabel.hex +EXTRA_DIST += modules/parsers/nasm/tests/locallabel2.asm +EXTRA_DIST += modules/parsers/nasm/tests/locallabel2.hex +EXTRA_DIST += modules/parsers/nasm/tests/nasm-prefix.asm +EXTRA_DIST += modules/parsers/nasm/tests/nasm-prefix.hex EXTRA_DIST += modules/parsers/nasm/tests/newsect.asm EXTRA_DIST += modules/parsers/nasm/tests/newsect.hex EXTRA_DIST += modules/parsers/nasm/tests/orphannowarn.asm @@ -28,6 +39,12 @@ EXTRA_DIST += modules/parsers/nasm/tests/strucalign.asm EXTRA_DIST += modules/parsers/nasm/tests/strucalign.hex EXTRA_DIST += modules/parsers/nasm/tests/struczero.asm EXTRA_DIST += modules/parsers/nasm/tests/struczero.hex +EXTRA_DIST += modules/parsers/nasm/tests/strucbase.asm +EXTRA_DIST += modules/parsers/nasm/tests/strucbase.hex +EXTRA_DIST += modules/parsers/nasm/tests/syntax-err.asm +EXTRA_DIST += modules/parsers/nasm/tests/syntax-err.errwarn +EXTRA_DIST += modules/parsers/nasm/tests/uscore.asm +EXTRA_DIST += modules/parsers/nasm/tests/uscore.hex EXTRA_DIST += modules/parsers/nasm/tests/worphan/Makefile.inc diff --git a/modules/parsers/nasm/tests/dirwarning.asm b/modules/parsers/nasm/tests/dirwarning.asm new file mode 100644 index 00000000..265d60a5 --- /dev/null +++ b/modules/parsers/nasm/tests/dirwarning.asm @@ -0,0 +1 @@ +[warning -w] diff --git a/modules/parsers/nasm/tests/dirwarning.errwarn b/modules/parsers/nasm/tests/dirwarning.errwarn new file mode 100644 index 00000000..366c8d66 --- /dev/null +++ b/modules/parsers/nasm/tests/dirwarning.errwarn @@ -0,0 +1 @@ +-:1: warning: [warning] directive not supported; ignored diff --git a/modules/parsers/nasm/tests/dirwarning.hex b/modules/parsers/nasm/tests/dirwarning.hex new file mode 100644 index 00000000..e69de29b diff --git a/modules/parsers/nasm/tests/dy.asm b/modules/parsers/nasm/tests/dy.asm new file mode 100644 index 00000000..5a74e2f4 --- /dev/null +++ b/modules/parsers/nasm/tests/dy.asm @@ -0,0 +1,5 @@ +dy 0x0123456789abcdef00112233445566778899aabbccddeeff1111222233334444 +dw label +section .bss +resy 1 +label: diff --git a/modules/parsers/nasm/tests/dy.hex b/modules/parsers/nasm/tests/dy.hex new file mode 100644 index 00000000..ead24e69 --- /dev/null +++ b/modules/parsers/nasm/tests/dy.hex @@ -0,0 +1,34 @@ +44 +44 +33 +33 +22 +22 +11 +11 +ff +ee +dd +cc +bb +aa +99 +88 +77 +66 +55 +44 +33 +22 +11 +00 +ef +cd +ab +89 +67 +45 +23 +01 +44 +00 diff --git a/modules/parsers/nasm/tests/hexconst.asm b/modules/parsers/nasm/tests/hexconst.asm new file mode 100644 index 00000000..a0039b02 --- /dev/null +++ b/modules/parsers/nasm/tests/hexconst.asm @@ -0,0 +1,2 @@ +dd 0x500 +dd 0X500 diff --git a/modules/parsers/nasm/tests/hexconst.hex b/modules/parsers/nasm/tests/hexconst.hex new file mode 100644 index 00000000..90a00fe9 --- /dev/null +++ b/modules/parsers/nasm/tests/hexconst.hex @@ -0,0 +1,8 @@ +00 +05 +00 +00 +00 +05 +00 +00 diff --git a/modules/parsers/nasm/tests/locallabel.asm b/modules/parsers/nasm/tests/locallabel.asm new file mode 100644 index 00000000..013de530 --- /dev/null +++ b/modules/parsers/nasm/tests/locallabel.asm @@ -0,0 +1,21 @@ +label: +db 0 +.local: +db 0 +..@local1: +.local2: +dw label.local +dw label.local2 + +$label2: +db 0 +$.local: +db 0 +$..@local2: +$.local2: +dw label2.local +dw label2.local2 +dw $label2.local +dw $label2.local2 + + diff --git a/modules/parsers/nasm/tests/locallabel.hex b/modules/parsers/nasm/tests/locallabel.hex new file mode 100644 index 00000000..4aaba4ef --- /dev/null +++ b/modules/parsers/nasm/tests/locallabel.hex @@ -0,0 +1,16 @@ +00 +00 +01 +00 +02 +00 +00 +00 +07 +00 +08 +00 +07 +00 +08 +00 diff --git a/modules/parsers/nasm/tests/locallabel2.asm b/modules/parsers/nasm/tests/locallabel2.asm new file mode 100644 index 00000000..ea0f8c92 --- /dev/null +++ b/modules/parsers/nasm/tests/locallabel2.asm @@ -0,0 +1,4 @@ +nl1: +nl2:db .0 - nl2 +.0: db .1 - nl2 +.1: diff --git a/modules/parsers/nasm/tests/locallabel2.hex b/modules/parsers/nasm/tests/locallabel2.hex new file mode 100644 index 00000000..26334819 --- /dev/null +++ b/modules/parsers/nasm/tests/locallabel2.hex @@ -0,0 +1,2 @@ +01 +02 diff --git a/modules/parsers/nasm/tests/nasm-prefix.asm b/modules/parsers/nasm/tests/nasm-prefix.asm new file mode 100644 index 00000000..2bd7824f --- /dev/null +++ b/modules/parsers/nasm/tests/nasm-prefix.asm @@ -0,0 +1,5 @@ +es +mov ax, [bx] + +a32 +mov ax, [bx] diff --git a/modules/parsers/nasm/tests/nasm-prefix.hex b/modules/parsers/nasm/tests/nasm-prefix.hex new file mode 100644 index 00000000..24bdfef6 --- /dev/null +++ b/modules/parsers/nasm/tests/nasm-prefix.hex @@ -0,0 +1,6 @@ +26 +8b +07 +67 +8b +07 diff --git a/modules/parsers/nasm/tests/nasm_test.sh b/modules/parsers/nasm/tests/nasm_test.sh index dc26d21f..0ff39b6e 100755 --- a/modules/parsers/nasm/tests/nasm_test.sh +++ b/modules/parsers/nasm/tests/nasm_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh nasm_test modules/parsers/nasm/tests "nasm-compat parser" "-f bin" "" exit $? diff --git a/modules/parsers/nasm/tests/strucbase.asm b/modules/parsers/nasm/tests/strucbase.asm new file mode 100644 index 00000000..81e2fc03 --- /dev/null +++ b/modules/parsers/nasm/tests/strucbase.asm @@ -0,0 +1,11 @@ +struc base, -7 +.a: resb 1 +.b: resb 1 +endstruc + +; Expect base and base.a to appear at -7, base.b at -6 +db base +db base.a +db base.b +; The size should be '2' here +db base_size diff --git a/modules/parsers/nasm/tests/strucbase.hex b/modules/parsers/nasm/tests/strucbase.hex new file mode 100644 index 00000000..5d48c5ea --- /dev/null +++ b/modules/parsers/nasm/tests/strucbase.hex @@ -0,0 +1,4 @@ +f9 +f9 +fa +02 diff --git a/modules/parsers/nasm/tests/syntax-err.asm b/modules/parsers/nasm/tests/syntax-err.asm new file mode 100644 index 00000000..f36010a7 --- /dev/null +++ b/modules/parsers/nasm/tests/syntax-err.asm @@ -0,0 +1,17 @@ +global crc32 +crc32: resd 1 +cli: +mov ax, 5% +mov ax, % +mov ax, ~ +mov ax, + +mov ax, - +mov ax, ( +mov ax, ) +ret 5% +ret % +ret ~ +ret + +ret - +ret ( +ret ) diff --git a/modules/parsers/nasm/tests/syntax-err.errwarn b/modules/parsers/nasm/tests/syntax-err.errwarn new file mode 100644 index 00000000..2e52a0d1 --- /dev/null +++ b/modules/parsers/nasm/tests/syntax-err.errwarn @@ -0,0 +1,16 @@ +-:2: error: unexpected `:' after instruction +-:3: error: unexpected `:' after instruction +-:4: error: expected expression after `%' +-:5: error: expected operand, got `%' +-:6: error: expected expression after `~' +-:7: error: expected expression after `+' +-:8: error: expected expression after `-' +-:9: error: expected expression after `(' +-:10: error: expected operand, got `)' +-:11: error: expected expression after `%' +-:12: error: unexpected `%' after instruction +-:13: error: expected expression after `~' +-:14: error: expected expression after `+' +-:15: error: expected expression after `-' +-:16: error: expected expression after `(' +-:17: error: unexpected `)' after instruction diff --git a/modules/parsers/nasm/tests/uscore.asm b/modules/parsers/nasm/tests/uscore.asm new file mode 100644 index 00000000..0630597f --- /dev/null +++ b/modules/parsers/nasm/tests/uscore.asm @@ -0,0 +1,10 @@ +dq 0000_1111_2222_3333h +dq 0000111122223333h +dd 0x01_23_45_67 +dd 0x01234567 +dw 1_2_3_4q +dw 1234q +db 00_11_00_11b +db 00110011b +_0: +dw _0 diff --git a/modules/parsers/nasm/tests/uscore.hex b/modules/parsers/nasm/tests/uscore.hex new file mode 100644 index 00000000..4793d1d8 --- /dev/null +++ b/modules/parsers/nasm/tests/uscore.hex @@ -0,0 +1,32 @@ +33 +33 +22 +22 +11 +11 +00 +00 +33 +33 +22 +22 +11 +11 +00 +00 +67 +45 +23 +01 +67 +45 +23 +01 +9c +02 +9c +02 +33 +33 +1e +00 diff --git a/modules/parsers/nasm/tests/worphan/Makefile.inc b/modules/parsers/nasm/tests/worphan/Makefile.inc index 7495f8e8..f55b93d3 100644 --- a/modules/parsers/nasm/tests/worphan/Makefile.inc +++ b/modules/parsers/nasm/tests/worphan/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh EXTRA_DIST += modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh diff --git a/modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh b/modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh index bc772c6b..ebb6bcd2 100755 --- a/modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh +++ b/modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh nasm_test modules/parsers/nasm/tests/worphan "nasm-compat parser" "-Worphan-labels -f bin" "" exit $? diff --git a/modules/parsers/nasm/tests/worphan/orphanwarn.errwarn b/modules/parsers/nasm/tests/worphan/orphanwarn.errwarn index 0953e811..d0071f2c 100644 --- a/modules/parsers/nasm/tests/worphan/orphanwarn.errwarn +++ b/modules/parsers/nasm/tests/worphan/orphanwarn.errwarn @@ -1,2 +1,2 @@ --:2: warning: label alone on aline without a colon might be in error --:3: warning: label alone on aline without a colon might be in error +-:2: warning: label alone on a line without a colon might be in error +-:3: warning: label alone on a line without a colon might be in error diff --git a/modules/parsers/tasm/Makefile.inc b/modules/parsers/tasm/Makefile.inc new file mode 100644 index 00000000..bf49f71e --- /dev/null +++ b/modules/parsers/tasm/Makefile.inc @@ -0,0 +1,3 @@ +EXTRA_DIST += modules/parsers/tasm/tests/Makefile.inc + +include modules/parsers/tasm/tests/Makefile.inc diff --git a/modules/parsers/tasm/tests/Makefile.inc b/modules/parsers/tasm/tests/Makefile.inc new file mode 100644 index 00000000..d37e1e63 --- /dev/null +++ b/modules/parsers/tasm/tests/Makefile.inc @@ -0,0 +1,43 @@ +TESTS += modules/parsers/tasm/tests/tasm_test.sh + +EXTRA_DIST += modules/parsers/tasm/tests/tasm_test.sh +EXTRA_DIST += modules/parsers/tasm/tests/array.asm +EXTRA_DIST += modules/parsers/tasm/tests/array.hex +EXTRA_DIST += modules/parsers/tasm/tests/case.asm +EXTRA_DIST += modules/parsers/tasm/tests/case.hex +EXTRA_DIST += modules/parsers/tasm/tests/charstr.asm +EXTRA_DIST += modules/parsers/tasm/tests/charstr.hex +EXTRA_DIST += modules/parsers/tasm/tests/dup.asm +EXTRA_DIST += modules/parsers/tasm/tests/dup.hex +EXTRA_DIST += modules/parsers/tasm/tests/equal.asm +EXTRA_DIST += modules/parsers/tasm/tests/equal.hex +EXTRA_DIST += modules/parsers/tasm/tests/expr.asm +EXTRA_DIST += modules/parsers/tasm/tests/expr.hex +EXTRA_DIST += modules/parsers/tasm/tests/irp.asm +EXTRA_DIST += modules/parsers/tasm/tests/irp.hex +EXTRA_DIST += modules/parsers/tasm/tests/label.asm +EXTRA_DIST += modules/parsers/tasm/tests/label.hex +EXTRA_DIST += modules/parsers/tasm/tests/les.asm +EXTRA_DIST += modules/parsers/tasm/tests/les.hex +EXTRA_DIST += modules/parsers/tasm/tests/lidt.asm +EXTRA_DIST += modules/parsers/tasm/tests/lidt.hex +EXTRA_DIST += modules/parsers/tasm/tests/macro.asm +EXTRA_DIST += modules/parsers/tasm/tests/macro.hex +EXTRA_DIST += modules/parsers/tasm/tests/offset.asm +EXTRA_DIST += modules/parsers/tasm/tests/offset.hex +EXTRA_DIST += modules/parsers/tasm/tests/quote.asm +EXTRA_DIST += modules/parsers/tasm/tests/quote.hex +EXTRA_DIST += modules/parsers/tasm/tests/res.asm +EXTRA_DIST += modules/parsers/tasm/tests/res.errwarn +EXTRA_DIST += modules/parsers/tasm/tests/res.hex +EXTRA_DIST += modules/parsers/tasm/tests/segment.asm +EXTRA_DIST += modules/parsers/tasm/tests/segment.hex +EXTRA_DIST += modules/parsers/tasm/tests/size.asm +EXTRA_DIST += modules/parsers/tasm/tests/size.hex +EXTRA_DIST += modules/parsers/tasm/tests/struc.asm +EXTRA_DIST += modules/parsers/tasm/tests/struc.errwarn +EXTRA_DIST += modules/parsers/tasm/tests/struc.hex + +EXTRA_DIST += modules/parsers/tasm/tests/exe/Makefile.inc + +include modules/parsers/tasm/tests/exe/Makefile.inc diff --git a/modules/parsers/tasm/tests/array.asm b/modules/parsers/tasm/tests/array.asm new file mode 100644 index 00000000..44842678 --- /dev/null +++ b/modules/parsers/tasm/tests/array.asm @@ -0,0 +1,2 @@ +t db 0,1,2 +mov al,t[1] diff --git a/modules/parsers/tasm/tests/array.hex b/modules/parsers/tasm/tests/array.hex new file mode 100644 index 00000000..97758932 --- /dev/null +++ b/modules/parsers/tasm/tests/array.hex @@ -0,0 +1,6 @@ +00 +01 +02 +a0 +01 +00 diff --git a/modules/parsers/tasm/tests/case.asm b/modules/parsers/tasm/tests/case.asm new file mode 100644 index 00000000..1549d4bf --- /dev/null +++ b/modules/parsers/tasm/tests/case.asm @@ -0,0 +1,3 @@ +a db 0 +B dw A +c dw b diff --git a/modules/parsers/tasm/tests/case.hex b/modules/parsers/tasm/tests/case.hex new file mode 100644 index 00000000..e2092e09 --- /dev/null +++ b/modules/parsers/tasm/tests/case.hex @@ -0,0 +1,5 @@ +00 +00 +00 +01 +00 diff --git a/modules/parsers/tasm/tests/charstr.asm b/modules/parsers/tasm/tests/charstr.asm new file mode 100644 index 00000000..a753716c --- /dev/null +++ b/modules/parsers/tasm/tests/charstr.asm @@ -0,0 +1 @@ +mov eax,"1234" diff --git a/modules/parsers/tasm/tests/charstr.hex b/modules/parsers/tasm/tests/charstr.hex new file mode 100644 index 00000000..42deac41 --- /dev/null +++ b/modules/parsers/tasm/tests/charstr.hex @@ -0,0 +1,6 @@ +66 +b8 +34 +33 +32 +31 diff --git a/modules/parsers/tasm/tests/dup.asm b/modules/parsers/tasm/tests/dup.asm new file mode 100644 index 00000000..c19ea762 --- /dev/null +++ b/modules/parsers/tasm/tests/dup.asm @@ -0,0 +1 @@ +a db 10 dup(1) diff --git a/modules/parsers/tasm/tests/dup.hex b/modules/parsers/tasm/tests/dup.hex new file mode 100644 index 00000000..5a51766a --- /dev/null +++ b/modules/parsers/tasm/tests/dup.hex @@ -0,0 +1,10 @@ +01 +01 +01 +01 +01 +01 +01 +01 +01 +01 diff --git a/modules/parsers/tasm/tests/equal.asm b/modules/parsers/tasm/tests/equal.asm new file mode 100644 index 00000000..4b8919dc --- /dev/null +++ b/modules/parsers/tasm/tests/equal.asm @@ -0,0 +1 @@ +a = byte 1 diff --git a/modules/parsers/tasm/tests/equal.hex b/modules/parsers/tasm/tests/equal.hex new file mode 100644 index 00000000..e69de29b diff --git a/modules/parsers/tasm/tests/exe/Makefile.inc b/modules/parsers/tasm/tests/exe/Makefile.inc new file mode 100644 index 00000000..117012cc --- /dev/null +++ b/modules/parsers/tasm/tests/exe/Makefile.inc @@ -0,0 +1,6 @@ +TESTS += modules/parsers/tasm/tests/exe/tasm_exe_test.sh + +EXTRA_DIST += modules/parsers/tasm/tests/exe/tasm_exe_test.sh +EXTRA_DIST += modules/parsers/tasm/tests/exe/exe.asm +EXTRA_DIST += modules/parsers/tasm/tests/exe/exe.hex + diff --git a/modules/parsers/tasm/tests/exe/exe.asm b/modules/parsers/tasm/tests/exe/exe.asm new file mode 100644 index 00000000..f040a1cf --- /dev/null +++ b/modules/parsers/tasm/tests/exe/exe.asm @@ -0,0 +1,4 @@ +a db 1 +start proc +int 22 +start endp diff --git a/modules/parsers/tasm/tests/exe/exe.hex b/modules/parsers/tasm/tests/exe/exe.hex new file mode 100644 index 00000000..4547fbc7 --- /dev/null +++ b/modules/parsers/tasm/tests/exe/exe.hex @@ -0,0 +1,515 @@ +4d +5a +03 +00 +02 +00 +00 +00 +20 +00 +00 +00 +ff +ff +00 +00 +00 +00 +00 +00 +01 +00 +00 +00 +22 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +00 +01 +cd +16 diff --git a/modules/parsers/tasm/tests/exe/tasm_exe_test.sh b/modules/parsers/tasm/tests/exe/tasm_exe_test.sh new file mode 100755 index 00000000..15fdd553 --- /dev/null +++ b/modules/parsers/tasm/tests/exe/tasm_exe_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh tasm_test modules/parsers/tasm/tests/exe "tasm-compat parser" "-f dosexe -p tasm" "" +exit $? diff --git a/modules/parsers/tasm/tests/expr.asm b/modules/parsers/tasm/tests/expr.asm new file mode 100644 index 00000000..f5958cae --- /dev/null +++ b/modules/parsers/tasm/tests/expr.asm @@ -0,0 +1,2 @@ +a db low ((1 shl 2) and (16 shr 2) or (high 0x5034)) +b db not 1 diff --git a/modules/parsers/tasm/tests/expr.hex b/modules/parsers/tasm/tests/expr.hex new file mode 100644 index 00000000..c6b00472 --- /dev/null +++ b/modules/parsers/tasm/tests/expr.hex @@ -0,0 +1,2 @@ +54 +fe diff --git a/modules/parsers/tasm/tests/irp.asm b/modules/parsers/tasm/tests/irp.asm new file mode 100644 index 00000000..d24cd29f --- /dev/null +++ b/modules/parsers/tasm/tests/irp.asm @@ -0,0 +1,3 @@ +irp i,<1,2,3> + mov ax,i +endm diff --git a/modules/parsers/tasm/tests/irp.hex b/modules/parsers/tasm/tests/irp.hex new file mode 100644 index 00000000..7bf091db --- /dev/null +++ b/modules/parsers/tasm/tests/irp.hex @@ -0,0 +1,9 @@ +b8 +01 +00 +b8 +02 +00 +b8 +03 +00 diff --git a/modules/parsers/tasm/tests/label.asm b/modules/parsers/tasm/tests/label.asm new file mode 100644 index 00000000..ff72ba3e --- /dev/null +++ b/modules/parsers/tasm/tests/label.asm @@ -0,0 +1,2 @@ +a label byte +mov ax,offset a diff --git a/modules/parsers/tasm/tests/label.hex b/modules/parsers/tasm/tests/label.hex new file mode 100644 index 00000000..b74f90bd --- /dev/null +++ b/modules/parsers/tasm/tests/label.hex @@ -0,0 +1,3 @@ +b8 +00 +00 diff --git a/modules/parsers/tasm/tests/les.asm b/modules/parsers/tasm/tests/les.asm new file mode 100644 index 00000000..bbcfd90a --- /dev/null +++ b/modules/parsers/tasm/tests/les.asm @@ -0,0 +1,2 @@ +a db 1 +les ax,a diff --git a/modules/parsers/tasm/tests/les.hex b/modules/parsers/tasm/tests/les.hex new file mode 100644 index 00000000..032eee74 --- /dev/null +++ b/modules/parsers/tasm/tests/les.hex @@ -0,0 +1,5 @@ +01 +c4 +06 +00 +00 diff --git a/modules/parsers/tasm/tests/lidt.asm b/modules/parsers/tasm/tests/lidt.asm new file mode 100644 index 00000000..11cf0c6a --- /dev/null +++ b/modules/parsers/tasm/tests/lidt.asm @@ -0,0 +1,3 @@ +idtr dw 0 + dd 0 +lidt fword ptr idtr diff --git a/modules/parsers/tasm/tests/lidt.hex b/modules/parsers/tasm/tests/lidt.hex new file mode 100644 index 00000000..97fb3b73 --- /dev/null +++ b/modules/parsers/tasm/tests/lidt.hex @@ -0,0 +1,11 @@ +00 +00 +00 +00 +00 +00 +0f +01 +1e +00 +00 diff --git a/modules/parsers/tasm/tests/macro.asm b/modules/parsers/tasm/tests/macro.asm new file mode 100644 index 00000000..75902391 --- /dev/null +++ b/modules/parsers/tasm/tests/macro.asm @@ -0,0 +1,6 @@ +a macro reg,i + mov reg,i + endm + +a ax,0 +a bx,1 diff --git a/modules/parsers/tasm/tests/macro.hex b/modules/parsers/tasm/tests/macro.hex new file mode 100644 index 00000000..92b4e4ae --- /dev/null +++ b/modules/parsers/tasm/tests/macro.hex @@ -0,0 +1,6 @@ +b8 +00 +00 +bb +01 +00 diff --git a/modules/parsers/tasm/tests/offset.asm b/modules/parsers/tasm/tests/offset.asm new file mode 100644 index 00000000..417fd2c3 --- /dev/null +++ b/modules/parsers/tasm/tests/offset.asm @@ -0,0 +1,3 @@ +a db 1 +mov ax,offset a +mov ax,offset[a] diff --git a/modules/parsers/tasm/tests/offset.hex b/modules/parsers/tasm/tests/offset.hex new file mode 100644 index 00000000..3def1cf9 --- /dev/null +++ b/modules/parsers/tasm/tests/offset.hex @@ -0,0 +1,7 @@ +01 +b8 +00 +00 +b8 +00 +00 diff --git a/modules/parsers/tasm/tests/quote.asm b/modules/parsers/tasm/tests/quote.asm new file mode 100644 index 00000000..a269ba37 --- /dev/null +++ b/modules/parsers/tasm/tests/quote.asm @@ -0,0 +1,2 @@ +a db 'don''t' +b db """" diff --git a/modules/parsers/tasm/tests/quote.hex b/modules/parsers/tasm/tests/quote.hex new file mode 100644 index 00000000..eb41f7b4 --- /dev/null +++ b/modules/parsers/tasm/tests/quote.hex @@ -0,0 +1,6 @@ +64 +6f +6e +27 +74 +22 diff --git a/modules/parsers/tasm/tests/res.asm b/modules/parsers/tasm/tests/res.asm new file mode 100644 index 00000000..8cf0829a --- /dev/null +++ b/modules/parsers/tasm/tests/res.asm @@ -0,0 +1,2 @@ +a db ? +b db 2 dup (?) diff --git a/modules/parsers/tasm/tests/res.errwarn b/modules/parsers/tasm/tests/res.errwarn new file mode 100644 index 00000000..490e1ad7 --- /dev/null +++ b/modules/parsers/tasm/tests/res.errwarn @@ -0,0 +1,2 @@ +-:1: warning: uninitialized space declared in code/data section: zeroing +-:2: warning: uninitialized space declared in code/data section: zeroing diff --git a/modules/parsers/tasm/tests/res.hex b/modules/parsers/tasm/tests/res.hex new file mode 100644 index 00000000..47f99ba3 --- /dev/null +++ b/modules/parsers/tasm/tests/res.hex @@ -0,0 +1,3 @@ +00 +00 +00 diff --git a/modules/parsers/tasm/tests/segment.asm b/modules/parsers/tasm/tests/segment.asm new file mode 100644 index 00000000..f0563ebd --- /dev/null +++ b/modules/parsers/tasm/tests/segment.asm @@ -0,0 +1,8 @@ +data segment + a db 0 +data ends + +assume es:data +code segment + mov byte ptr [a],1 +code ends diff --git a/modules/parsers/tasm/tests/segment.hex b/modules/parsers/tasm/tests/segment.hex new file mode 100644 index 00000000..667a69b2 --- /dev/null +++ b/modules/parsers/tasm/tests/segment.hex @@ -0,0 +1,7 @@ +00 +26 +c6 +06 +00 +00 +01 diff --git a/modules/parsers/tasm/tests/size.asm b/modules/parsers/tasm/tests/size.asm new file mode 100644 index 00000000..405cc407 --- /dev/null +++ b/modules/parsers/tasm/tests/size.asm @@ -0,0 +1,2 @@ +a db 0 +mov a,1 diff --git a/modules/parsers/tasm/tests/size.hex b/modules/parsers/tasm/tests/size.hex new file mode 100644 index 00000000..401266a1 --- /dev/null +++ b/modules/parsers/tasm/tests/size.hex @@ -0,0 +1,6 @@ +00 +c6 +06 +00 +00 +01 diff --git a/modules/parsers/tasm/tests/struc.asm b/modules/parsers/tasm/tests/struc.asm new file mode 100644 index 00000000..5a88b615 --- /dev/null +++ b/modules/parsers/tasm/tests/struc.asm @@ -0,0 +1,8 @@ +s struc + a db ? + b db ? +s ends + +v s <1,?> + +mov al,[v].b diff --git a/modules/parsers/tasm/tests/struc.errwarn b/modules/parsers/tasm/tests/struc.errwarn new file mode 100644 index 00000000..4e188892 --- /dev/null +++ b/modules/parsers/tasm/tests/struc.errwarn @@ -0,0 +1 @@ +-:6: warning: uninitialized space declared in code/data section: zeroing diff --git a/modules/parsers/tasm/tests/struc.hex b/modules/parsers/tasm/tests/struc.hex new file mode 100644 index 00000000..d2ad9563 --- /dev/null +++ b/modules/parsers/tasm/tests/struc.hex @@ -0,0 +1,5 @@ +01 +00 +a0 +01 +00 diff --git a/modules/parsers/tasm/tests/tasm_test.sh b/modules/parsers/tasm/tests/tasm_test.sh new file mode 100755 index 00000000..35ef7360 --- /dev/null +++ b/modules/parsers/tasm/tests/tasm_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh tasm_test modules/parsers/tasm/tests "tasm-compat parser" "-f bin -p tasm" "" +exit $? diff --git a/modules/parsers/yasm_parsers.xml b/modules/parsers/yasm_parsers.xml index d29421de..28aa2e29 100644 --- a/modules/parsers/yasm_parsers.xml +++ b/modules/parsers/yasm_parsers.xml @@ -2,8 +2,6 @@ - - @@ -91,11 +89,11 @@ assembler for modern Unix systems, and is used as the backend for the GCC compiler. Yasm's support for GAS syntax is moderately good, although immature: not all directives are supported, and only - 32-bit x86 and AMD64 architectures are supported. There is also no - support for the GAS preprocessor. Despite these limitations, - Yasm's GAS syntax support is good enough to handle essentially all - x86 and AMD64 GCC compiler output. The GAS parser can be selected - with . + 32-bit x86 and AMD64 architectures are supported. Nearly all of + the GAS preprocessor is also supported. Yasm's GAS syntax support + is good enough to handle essentially all x86 and AMD64 GCC compiler + output. The GAS parser can be selected with . diff --git a/modules/preprocs/CMakeLists.txt b/modules/preprocs/CMakeLists.txt new file mode 100644 index 00000000..59640272 --- /dev/null +++ b/modules/preprocs/CMakeLists.txt @@ -0,0 +1,4 @@ +INCLUDE(preprocs/nasm/CMakeLists.txt) +INCLUDE(preprocs/raw/CMakeLists.txt) +INCLUDE(preprocs/cpp/CMakeLists.txt) +INCLUDE(preprocs/gas/CMakeLists.txt) diff --git a/modules/preprocs/Makefile.inc b/modules/preprocs/Makefile.inc index 04145581..acf06838 100644 --- a/modules/preprocs/Makefile.inc +++ b/modules/preprocs/Makefile.inc @@ -1,7 +1,11 @@ -# $Id$ - +EXTRA_DIST += modules/preprocs/tasm/Makefile.inc EXTRA_DIST += modules/preprocs/nasm/Makefile.inc EXTRA_DIST += modules/preprocs/raw/Makefile.inc +EXTRA_DIST += modules/preprocs/cpp/Makefile.inc +EXTRA_DIST += modules/preprocs/gas/Makefile.inc +include modules/preprocs/tasm/Makefile.inc include modules/preprocs/nasm/Makefile.inc include modules/preprocs/raw/Makefile.inc +include modules/preprocs/cpp/Makefile.inc +include modules/preprocs/gas/Makefile.inc diff --git a/modules/preprocs/cpp/CMakeLists.txt b/modules/preprocs/cpp/CMakeLists.txt new file mode 100644 index 00000000..202787cb --- /dev/null +++ b/modules/preprocs/cpp/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(preproc_cpp + preprocs/cpp/cpp-preproc.c + ) diff --git a/modules/preprocs/cpp/Makefile.inc b/modules/preprocs/cpp/Makefile.inc new file mode 100644 index 00000000..30bd24b3 --- /dev/null +++ b/modules/preprocs/cpp/Makefile.inc @@ -0,0 +1,6 @@ +# Makefile for cpp module. +# Copied from raw preprocessor module. + +libyasm_a_SOURCES += modules/preprocs/cpp/cpp-preproc.c + +YASM_MODULES += preproc_cpp diff --git a/modules/preprocs/cpp/cpp-preproc.c b/modules/preprocs/cpp/cpp-preproc.c new file mode 100644 index 00000000..663f726c --- /dev/null +++ b/modules/preprocs/cpp/cpp-preproc.c @@ -0,0 +1,402 @@ +/* + * Invoke an external C preprocessor + * + * Copyright (C) 2007 Paul Barker + * Copyright (C) 2001-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +/* TODO: Use autoconf to get the limit on the command line length. */ +#define CMDLINE_SIZE 32770 + +#define BSIZE 512 + +/* Pre-declare the preprocessor module object. */ +yasm_preproc_module yasm_cpp_LTX_preproc; + +/******************************************************************************* + Structures. +*******************************************************************************/ + +/* An entry in a list of arguments to pass to cpp. */ +typedef struct cpp_arg_entry { + TAILQ_ENTRY(cpp_arg_entry) entry; + + /* + The operator (eg "-I") and the parameter (eg "include/"). op is expected + to point to a string literal, whereas param is expected to be a copy of + the parameter which is free'd when no-longer needed (in + cpp_preproc_destroy()). + */ + const char *op; + char *param; +} cpp_arg_entry; + +typedef struct yasm_preproc_cpp { + yasm_preproc_base preproc; /* base structure */ + + /* List of arguments to pass to cpp. */ + TAILQ_HEAD(cpp_arg_head, cpp_arg_entry) cpp_args; + + char *filename; + FILE *f, *f_deps; + yasm_linemap *cur_lm; + yasm_errwarns *errwarns; + + int flags; +} yasm_preproc_cpp; + +/* Flag values for yasm_preproc_cpp->flags. */ +#define CPP_HAS_BEEN_INVOKED 0x01 +#define CPP_HAS_GENERATED_DEPS 0x02 + +/******************************************************************************* + Internal functions and helpers. +*******************************************************************************/ + +/* + Append a string to the command line, ensuring that we don't overflow the + buffer. +*/ +#define APPEND(s) do { \ + size_t _len = strlen(s); \ + if (p + _len >= limit) \ + yasm__fatal(N_("command line too long!")); \ + strcpy(p, s); \ + p += _len; \ +} while (0) + +/* + Put all the options together into a command line that can be used to invoke + cpp. +*/ +static char * +cpp_build_cmdline(yasm_preproc_cpp *pp, const char *extra) +{ + char *cmdline, *p, *limit; + cpp_arg_entry *arg; + + /* Initialize command line. */ + cmdline = p = yasm_xmalloc(strlen(CPP_PROG)+CMDLINE_SIZE); + limit = p + CMDLINE_SIZE; + strcpy(p, CPP_PROG); + p += strlen(CPP_PROG); + + arg = TAILQ_FIRST(&pp->cpp_args); + + /* Append arguments from the list. */ + while ( arg ) { + APPEND(" "); + APPEND(arg->op); + APPEND(" "); + APPEND(arg->param); + + arg = TAILQ_NEXT(arg, entry); + } + + /* Append extra arguments. */ + if (extra) { + APPEND(" "); + APPEND(extra); + } + /* Append final arguments. */ + APPEND(" -x assembler-with-cpp "); + APPEND(pp->filename); + + return cmdline; +} + +/* Invoke the c preprocessor. */ +static void +cpp_invoke(yasm_preproc_cpp *pp) +{ + char *cmdline; + + cmdline = cpp_build_cmdline(pp, NULL); + +#ifdef HAVE_POPEN + pp->f = popen(cmdline, "r"); + if (!pp->f) + yasm__fatal( N_("Failed to execute preprocessor") ); +#else + yasm__fatal( N_("Cannot execute preprocessor, no popen available") ); +#endif + + yasm_xfree(cmdline); +} + +/* Free memory used by the list of arguments. */ +static void +cpp_destroy_args(yasm_preproc_cpp *pp) +{ + cpp_arg_entry *arg; + + while ( (arg = TAILQ_FIRST(&pp->cpp_args)) ) { + TAILQ_REMOVE(&pp->cpp_args, arg, entry); + yasm_xfree(arg->param); + yasm_xfree(arg); + } +} + +/* Invoke the c preprocessor to generate dependency info. */ +static void +cpp_generate_deps(yasm_preproc_cpp *pp) +{ + char *cmdline; + + cmdline = cpp_build_cmdline(pp, "-M"); + +#ifdef HAVE_POPEN + pp->f_deps = popen(cmdline, "r"); + if (!pp->f_deps) + yasm__fatal( N_("Failed to execute preprocessor") ); +#else + yasm__fatal( N_("Cannot execute preprocessor, no popen available") ); +#endif + + yasm_xfree(cmdline); +} + +/******************************************************************************* + Interface functions. +*******************************************************************************/ +static yasm_preproc * +cpp_preproc_create(const char *in, yasm_symtab *symtab, yasm_linemap *lm, + yasm_errwarns *errwarns) +{ + yasm_preproc_cpp *pp = yasm_xmalloc(sizeof(yasm_preproc_cpp)); + void * iter; + const char * inc_dir; + + pp->preproc.module = &yasm_cpp_LTX_preproc; + pp->f = pp->f_deps = NULL; + pp->cur_lm = lm; + pp->errwarns = errwarns; + pp->flags = 0; + pp->filename = yasm__xstrdup(in); + + TAILQ_INIT(&pp->cpp_args); + + /* Iterate through the list of include dirs. */ + iter = NULL; + while ((inc_dir = yasm_get_include_dir(&iter)) != NULL) { + cpp_arg_entry *arg = yasm_xmalloc(sizeof(cpp_arg_entry)); + arg->op = "-I"; + arg->param = yasm__xstrdup(inc_dir); + + TAILQ_INSERT_TAIL(&pp->cpp_args, arg, entry); + } + + return (yasm_preproc *)pp; +} + +static void +cpp_preproc_destroy(yasm_preproc *preproc) +{ + yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc; + + if (pp->f) { +#ifdef HAVE_POPEN + if (pclose(pp->f) != 0) + yasm__fatal( N_("Preprocessor exited with failure") ); +#endif + } + + cpp_destroy_args(pp); + + yasm_xfree(pp->filename); + yasm_xfree(pp); +} + +static char * +cpp_preproc_get_line(yasm_preproc *preproc) +{ + yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc; + int bufsize = BSIZE; + char *buf, *p; + + if (! (pp->flags & CPP_HAS_BEEN_INVOKED) ) { + pp->flags |= CPP_HAS_BEEN_INVOKED; + + cpp_invoke(pp); + } + + /* + Once the preprocessor has been run, we're just dealing with a normal + file. + */ + + /* Loop to ensure entire line is read (don't want to limit line length). */ + buf = yasm_xmalloc((size_t)bufsize); + p = buf; + for (;;) { + if (!fgets(p, bufsize-(p-buf), pp->f)) { + if (ferror(pp->f)) { + yasm_error_set(YASM_ERROR_IO, + N_("error when reading from file")); + yasm_errwarn_propagate(pp->errwarns, + yasm_linemap_get_current(pp->cur_lm)); + } + break; + } + p += strlen(p); + if (p > buf && p[-1] == '\n') + break; + if ((p-buf) >= bufsize) { + /* Increase size of buffer */ + char *oldbuf = buf; + bufsize *= 2; + buf = yasm_xrealloc(buf, (size_t)bufsize); + p = buf + (p-oldbuf); + } + } + + if (p == buf) { + /* No data; must be at EOF */ + yasm_xfree(buf); + return NULL; + } + + /* Strip the line ending */ + buf[strcspn(buf, "\r\n")] = '\0'; + + return buf; +} + +static size_t +cpp_preproc_get_included_file(yasm_preproc *preproc, char *buf, + size_t max_size) +{ + char *p = buf; + int ch = '\0'; + size_t n = 0; + yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc; + + if (! (pp->flags & CPP_HAS_GENERATED_DEPS) ) { + pp->flags |= CPP_HAS_GENERATED_DEPS; + + cpp_generate_deps(pp); + + /* Skip target name and first dependency. */ + while (ch != ':') + ch = fgetc(pp->f_deps); + + fgetc(pp->f_deps); /* Discard space after colon. */ + + while (ch != ' ' && ch != EOF) + ch = fgetc(pp->f_deps); + + if (ch == EOF) + return 0; + } + + while (n < max_size) { + ch = fgetc(pp->f_deps); + + if (ch == ' ' || ch == EOF) { + *p = '\0'; + return n; + } + + /* Eat any silly characters. */ + if (ch < ' ') + continue; + + *p++ = ch; + n++; + } + + /* Ensure the buffer is null-terminated. */ + *(p - 1) = '\0'; + return n; +} + +static void +cpp_preproc_add_include_file(yasm_preproc *preproc, const char *filename) +{ + yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc; + + cpp_arg_entry *arg = yasm_xmalloc(sizeof(cpp_arg_entry)); + arg->op = "-include"; + arg->param = yasm__xstrdup(filename); + + TAILQ_INSERT_TAIL(&pp->cpp_args, arg, entry); +} + +static void +cpp_preproc_predefine_macro(yasm_preproc *preproc, const char *macronameval) +{ + yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc; + + cpp_arg_entry *arg = yasm_xmalloc(sizeof(cpp_arg_entry)); + arg->op = "-D"; + arg->param = yasm__xstrdup(macronameval); + + TAILQ_INSERT_TAIL(&pp->cpp_args, arg, entry); +} + +static void +cpp_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname) +{ + yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc; + + cpp_arg_entry *arg = yasm_xmalloc(sizeof(cpp_arg_entry)); + arg->op = "-U"; + arg->param = yasm__xstrdup(macroname); + + TAILQ_INSERT_TAIL(&pp->cpp_args, arg, entry); +} + +static void +cpp_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval) +{ + /* Handle a builtin as if it were a predefine. */ + cpp_preproc_predefine_macro(preproc, macronameval); +} + +static void +cpp_preproc_add_standard(yasm_preproc *preproc, const char **macros) +{ + /* TODO */ +} + +/******************************************************************************* + Preprocessor module object. +*******************************************************************************/ + +yasm_preproc_module yasm_cpp_LTX_preproc = { + "Run input through external C preprocessor", + "cpp", + cpp_preproc_create, + cpp_preproc_destroy, + cpp_preproc_get_line, + cpp_preproc_get_included_file, + cpp_preproc_add_include_file, + cpp_preproc_predefine_macro, + cpp_preproc_undefine_macro, + cpp_preproc_define_builtin, + cpp_preproc_add_standard +}; diff --git a/modules/preprocs/gas/CMakeLists.txt b/modules/preprocs/gas/CMakeLists.txt new file mode 100644 index 00000000..e8d09148 --- /dev/null +++ b/modules/preprocs/gas/CMakeLists.txt @@ -0,0 +1,4 @@ +YASM_ADD_MODULE(preproc_gas + preprocs/gas/gas-preproc.c + preprocs/gas/gas-eval.c + ) diff --git a/modules/preprocs/gas/Makefile.inc b/modules/preprocs/gas/Makefile.inc new file mode 100644 index 00000000..a7289a94 --- /dev/null +++ b/modules/preprocs/gas/Makefile.inc @@ -0,0 +1,9 @@ +libyasm_a_SOURCES += modules/preprocs/gas/gas-preproc.c +libyasm_a_SOURCES += modules/preprocs/gas/gas-eval.h +libyasm_a_SOURCES += modules/preprocs/gas/gas-eval.c + +YASM_MODULES += preproc_gas + +EXTRA_DIST += modules/preprocs/gas/tests/Makefile.inc + +include modules/preprocs/gas/tests/Makefile.inc diff --git a/modules/preprocs/gas/gas-eval.c b/modules/preprocs/gas/gas-eval.c new file mode 100644 index 00000000..3625c7a9 --- /dev/null +++ b/modules/preprocs/gas/gas-eval.c @@ -0,0 +1,444 @@ +/* eval.c expression evaluator for the Netwide Assembler + * + * The Netwide Assembler is copyright (C) 1996 Simon Tatham and + * Julian Hall. All rights reserved. The software is + * redistributable under the licence given in the file "Licence" + * distributed in the NASM archive. + * + * initial version 27/iii/95 by Simon Tatham + */ +#include +#include +#include +#include +#include +#include +#include + +#include "gas-eval.h" + +/* The assembler symbol table. */ +static yasm_symtab *symtab; + +static scanner scan; /* Address of scanner routine */ +static efunc error; /* Address of error reporting routine */ + +static struct tokenval *tokval; /* The current token */ +static int i; /* The t_type of tokval */ + +static void *scpriv; +static void *epriv; + +/* + * Recursive-descent parser. Called with a single boolean operand, + * which is TRUE if the evaluation is critical (i.e. unresolved + * symbols are an error condition). Must update the global `i' to + * reflect the token after the parsed string. May return NULL. + * + * evaluate() should report its own errors: on return it is assumed + * that if NULL has been returned, the error has already been + * reported. + */ + +/* + * Grammar parsed is: + * + * expr : bexpr [ WRT expr6 ] + * bexpr : rexp0 or expr0 depending on relative-mode setting + * rexp0 : rexp1 [ {||} rexp1...] + * rexp1 : rexp2 [ {^^} rexp2...] + * rexp2 : rexp3 [ {&&} rexp3...] + * rexp3 : expr0 [ {=,==,<>,!=,<,>,<=,>=} expr0 ] + * expr0 : expr1 [ {|} expr1...] + * expr1 : expr2 [ {^} expr2...] + * expr2 : expr3 [ {&} expr3...] + * expr3 : expr4 [ {<<,>>} expr4...] + * expr4 : expr5 [ {+,-} expr5...] + * expr5 : expr6 [ {*,/,%,//,%%} expr6...] + * expr6 : { ~,+,-,SEG } expr6 + * | (bexpr) + * | symbol + * | $ + * | number + */ + +static yasm_expr *rexp0(void), *rexp1(void), *rexp2(void), *rexp3(void); + +static yasm_expr *expr0(void), *expr1(void), *expr2(void), *expr3(void); +static yasm_expr *expr4(void), *expr5(void), *expr6(void); + +static yasm_expr *(*bexpr)(void); + +static yasm_expr *rexp0(void) +{ + yasm_expr *e, *f; + + e = rexp1(); + if (!e) + return NULL; + + while (i == TOKEN_DBL_OR) + { + i = scan(scpriv, tokval); + f = rexp1(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + e = yasm_expr_create_tree(e, YASM_EXPR_LOR, f, 0); + } + return e; +} + +static yasm_expr *rexp1(void) +{ + yasm_expr *e, *f; + + e = rexp2(); + if (!e) + return NULL; + + while (i == TOKEN_DBL_XOR) + { + i = scan(scpriv, tokval); + f = rexp2(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + e = yasm_expr_create_tree(e, YASM_EXPR_LXOR, f, 0); + } + return e; +} + +static yasm_expr *rexp2(void) +{ + yasm_expr *e, *f; + + e = rexp3(); + if (!e) + return NULL; + while (i == TOKEN_DBL_AND) + { + i = scan(scpriv, tokval); + f = rexp3(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + e = yasm_expr_create_tree(e, YASM_EXPR_LAND, f, 0); + } + return e; +} + +static yasm_expr *rexp3(void) +{ + yasm_expr *e, *f; + + e = expr0(); + if (!e) + return NULL; + + while (i == TOKEN_EQ || i == TOKEN_LT || i == TOKEN_GT || + i == TOKEN_NE || i == TOKEN_LE || i == TOKEN_GE) + { + int j = i; + i = scan(scpriv, tokval); + f = expr0(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + switch (j) + { + case TOKEN_EQ: + e = yasm_expr_create_tree(e, YASM_EXPR_EQ, f, 0); + break; + case TOKEN_LT: + e = yasm_expr_create_tree(e, YASM_EXPR_LT, f, 0); + break; + case TOKEN_GT: + e = yasm_expr_create_tree(e, YASM_EXPR_GT, f, 0); + break; + case TOKEN_NE: + e = yasm_expr_create_tree(e, YASM_EXPR_NE, f, 0); + break; + case TOKEN_LE: + e = yasm_expr_create_tree(e, YASM_EXPR_LE, f, 0); + break; + case TOKEN_GE: + e = yasm_expr_create_tree(e, YASM_EXPR_GE, f, 0); + break; + } + } + return e; +} + +static yasm_expr *expr0(void) +{ + yasm_expr *e, *f; + + e = expr1(); + if (!e) + return NULL; + + while (i == '|') + { + i = scan(scpriv, tokval); + f = expr1(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + e = yasm_expr_create_tree(e, YASM_EXPR_OR, f, 0); + } + return e; +} + +static yasm_expr *expr1(void) +{ + yasm_expr *e, *f; + + e = expr2(); + if (!e) + return NULL; + + while (i == '^') { + i = scan(scpriv, tokval); + f = expr2(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + e = yasm_expr_create_tree(e, YASM_EXPR_XOR, f, 0); + } + return e; +} + +static yasm_expr *expr2(void) +{ + yasm_expr *e, *f; + + e = expr3(); + if (!e) + return NULL; + + while (i == '&') { + i = scan(scpriv, tokval); + f = expr3(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + e = yasm_expr_create_tree(e, YASM_EXPR_AND, f, 0); + } + return e; +} + +static yasm_expr *expr3(void) +{ + yasm_expr *e, *f; + + e = expr4(); + if (!e) + return NULL; + + while (i == TOKEN_SHL || i == TOKEN_SHR) + { + int j = i; + i = scan(scpriv, tokval); + f = expr4(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + + switch (j) { + case TOKEN_SHL: + e = yasm_expr_create_tree(e, YASM_EXPR_SHL, f, 0); + break; + case TOKEN_SHR: + e = yasm_expr_create_tree(e, YASM_EXPR_SHR, f, 0); + break; + } + } + return e; +} + +static yasm_expr *expr4(void) +{ + yasm_expr *e, *f; + + e = expr5(); + if (!e) + return NULL; + while (i == '+' || i == '-') + { + int j = i; + i = scan(scpriv, tokval); + f = expr5(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + switch (j) { + case '+': + e = yasm_expr_create_tree(e, YASM_EXPR_ADD, f, 0); + break; + case '-': + e = yasm_expr_create_tree(e, YASM_EXPR_SUB, f, 0); + break; + } + } + return e; +} + +static yasm_expr *expr5(void) +{ + yasm_expr *e, *f; + + e = expr6(); + if (!e) + return NULL; + while (i == '*' || i == '/' || i == '%' || + i == TOKEN_SDIV || i == TOKEN_SMOD) + { + int j = i; + i = scan(scpriv, tokval); + f = expr6(); + if (!f) { + yasm_expr_destroy(e); + return NULL; + } + switch (j) { + case '*': + e = yasm_expr_create_tree(e, YASM_EXPR_MUL, f, 0); + break; + case '/': + e = yasm_expr_create_tree(e, YASM_EXPR_DIV, f, 0); + break; + case '%': + e = yasm_expr_create_tree(e, YASM_EXPR_MOD, f, 0); + break; + case TOKEN_SDIV: + e = yasm_expr_create_tree(e, YASM_EXPR_SIGNDIV, f, 0); + break; + case TOKEN_SMOD: + e = yasm_expr_create_tree(e, YASM_EXPR_SIGNMOD, f, 0); + break; + } + } + return e; +} + +static yasm_expr *expr6(void) +{ + yasm_expr *e = NULL; + + if (i == '-') { + i = scan(scpriv, tokval); + e = expr6(); + if (!e) + return NULL; + return yasm_expr_create_branch(YASM_EXPR_NEG, e, 0); + } else if (i == '+') { + i = scan(scpriv, tokval); + return expr6(); + } else if (i == '~') { + i = scan(scpriv, tokval); + e = expr6(); + if (!e) + return NULL; + return yasm_expr_create_branch(YASM_EXPR_NOT, e, 0); + } else if (i == TOKEN_SEG) { + i = scan(scpriv, tokval); + e = expr6(); + if (!e) + return NULL; + error(epriv, ERR_NONFATAL, "%s not supported", "SEG"); + return e; + } else if (i == '(') { + i = scan(scpriv, tokval); + e = bexpr(); + if (!e) + return NULL; + if (i != ')') { + error(epriv, ERR_NONFATAL, "expecting `)'"); + return NULL; + } + i = scan(scpriv, tokval); + return e; + } + else if (i == TOKEN_NUM || i == TOKEN_ID || + i == TOKEN_HERE || i == TOKEN_BASE) + { + switch (i) { + case TOKEN_NUM: + e = yasm_expr_create_ident(yasm_expr_int(tokval->t_integer), 0); + tokval->t_integer = NULL; + break; + case TOKEN_ID: + if (symtab) { + yasm_symrec *sym = + yasm_symtab_get(symtab, tokval->t_charptr); + if (sym) { + e = yasm_expr_create_ident(yasm_expr_sym(sym), 0); + } else { + error(epriv, ERR_NONFATAL, + "undefined symbol `%s' in preprocessor", + tokval->t_charptr); + e = yasm_expr_create_ident(yasm_expr_int( + yasm_intnum_create_int(1)), 0); + } + break; + } + /*fallthrough*/ + case TOKEN_HERE: + case TOKEN_BASE: + error(epriv, ERR_NONFATAL, + "cannot reference symbol `%s' in preprocessor", + (i == TOKEN_ID ? tokval->t_charptr : + i == TOKEN_HERE ? "$" : "$$")); + e = yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_int(1)), + 0); + break; + } + i = scan(scpriv, tokval); + return e; + } else { + error(epriv, ERR_NONFATAL, "expression syntax error"); + return NULL; + } +} + +yasm_expr *evaluate (scanner sc, void *scprivate, struct tokenval *tv, + void *eprivate, int critical, efunc report_error, + yasm_symtab *st) +{ + if (critical & CRITICAL) { + critical &= ~CRITICAL; + bexpr = rexp0; + } else + bexpr = expr0; + + scan = sc; + scpriv = scprivate; + tokval = tv; + error = report_error; + epriv = eprivate; + symtab = st; + + if (tokval->t_type == TOKEN_INVALID) + i = scan(scpriv, tokval); + else + i = tokval->t_type; + + return bexpr (); +} diff --git a/modules/preprocs/gas/gas-eval.h b/modules/preprocs/gas/gas-eval.h new file mode 100644 index 00000000..18dcc517 --- /dev/null +++ b/modules/preprocs/gas/gas-eval.h @@ -0,0 +1,120 @@ +/* eval.h header file for eval.c + * + * The Netwide Assembler is copyright (C) 1996 Simon Tatham and + * Julian Hall. All rights reserved. The software is + * redistributable under the licence given in the file "Licence" + * distributed in the NASM archive. + */ + +#ifndef YASM_EVAL_H +#define YASM_EVAL_H + +/* + * ------------------------- + * Error reporting functions + * ------------------------- + */ + +/* + * An error reporting function should look like this. + */ +typedef void (*efunc) (void *private_data, int severity, const char *fmt, ...); + +/* + * These are the error severity codes which get passed as the first + * argument to an efunc. + */ + +#define ERR_DEBUG 0x00000008 /* put out debugging message */ +#define ERR_WARNING 0x00000000 /* warn only: no further action */ +#define ERR_NONFATAL 0x00000001 /* terminate assembly after phase */ +#define ERR_FATAL 0x00000002 /* instantly fatal: exit with error */ +#define ERR_PANIC 0x00000003 /* internal error: panic instantly + * and dump core for reference */ +#define ERR_MASK 0x0000000F /* mask off the above codes */ +#define ERR_NOFILE 0x00000010 /* don't give source file name/line */ +#define ERR_USAGE 0x00000020 /* print a usage message */ +#define ERR_PASS1 0x00000040 /* only print this error on pass one */ + +/* + * These codes define specific types of suppressible warning. + */ + +#define ERR_WARN_MASK 0x0000FF00 /* the mask for this feature */ +#define ERR_WARN_SHR 8 /* how far to shift right */ + +#define ERR_WARN_MNP 0x00000100 /* macro-num-parameters warning */ +#define ERR_WARN_MSR 0x00000200 /* macro self-reference */ +#define ERR_WARN_OL 0x00000300 /* orphan label (no colon, and + * alone on line) */ +#define ERR_WARN_NOV 0x00000400 /* numeric overflow */ +#define ERR_WARN_GNUELF 0x00000500 /* using GNU ELF extensions */ +#define ERR_WARN_MAX 5 /* the highest numbered one */ + +/* + * The expression evaluator must be passed a scanner function; a + * standard scanner is provided as part of nasmlib.c. The + * preprocessor will use a different one. Scanners, and the + * token-value structures they return, look like this. + * + * The return value from the scanner is always a copy of the + * `t_type' field in the structure. + */ +struct tokenval { + int t_type; + yasm_intnum *t_integer, *t_inttwo; + char *t_charptr; +}; +typedef int (*scanner) (void *private_data, struct tokenval *tv); + +/* + * Token types returned by the scanner, in addition to ordinary + * ASCII character values, and zero for end-of-string. + */ +enum { /* token types, other than chars */ + TOKEN_INVALID = -1, /* a placeholder value */ + TOKEN_EOS = 0, /* end of string */ + TOKEN_EQ = '=', TOKEN_GT = '>', TOKEN_LT = '<', /* aliases */ + TOKEN_ID = 256, TOKEN_NUM, TOKEN_REG, TOKEN_INSN, /* major token types */ + TOKEN_ERRNUM, /* numeric constant with error in */ + TOKEN_HERE, TOKEN_BASE, /* $ and $$ */ + TOKEN_SPECIAL, /* BYTE, WORD, DWORD, FAR, NEAR, etc */ + TOKEN_PREFIX, /* A32, O16, LOCK, REPNZ, TIMES, etc */ + TOKEN_SHL, TOKEN_SHR, /* << and >> */ + TOKEN_SDIV, TOKEN_SMOD, /* // and %% */ + TOKEN_GE, TOKEN_LE, TOKEN_NE, /* >=, <= and <> (!= is same as <>) */ + TOKEN_DBL_AND, TOKEN_DBL_OR, TOKEN_DBL_XOR, /* &&, || and ^^ */ + TOKEN_SEG, TOKEN_WRT, /* SEG and WRT */ + TOKEN_FLOAT /* floating-point constant */ +}; + +/* + * The actual expression evaluator function looks like this. When + * called, it expects the first token of its expression to already + * be in `*tv'; if it is not, set tv->t_type to TOKEN_INVALID and + * it will start by calling the scanner. + * + * `critical' is non-zero if the expression may not contain forward + * references. The evaluator will report its own error if this + * occurs; if `critical' is 1, the error will be "symbol not + * defined before use", whereas if `critical' is 2, the error will + * be "symbol undefined". + * + * If `critical' has bit 8 set (in addition to its main value: 0x101 + * and 0x102 correspond to 1 and 2) then an extended expression + * syntax is recognised, in which relational operators such as =, < + * and >= are accepted, as well as low-precedence logical operators + * &&, ^^ and ||. + */ +#define CRITICAL 0x100 +typedef yasm_expr *(*evalfunc) (scanner sc, void *scprivate, struct tokenval *tv, + int critical, efunc error, yasm_symtab *symtab); + +/* + * The evaluator itself. + */ +yasm_expr *evaluate (scanner sc, void *scprivate, struct tokenval *tv, + void *eprivate, int critical, efunc report_error, + yasm_symtab *symtab); + +#endif diff --git a/modules/preprocs/gas/gas-preproc.c b/modules/preprocs/gas/gas-preproc.c new file mode 100644 index 00000000..0dd0531c --- /dev/null +++ b/modules/preprocs/gas/gas-preproc.c @@ -0,0 +1,1444 @@ +/* + * GAS preprocessor (emulates GNU Assembler's preprocessor) + * + * Copyright (C) 2009 Alexei Svitkine + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + +#include +#include "modules/preprocs/gas/gas-eval.h" + +#define FALSE 0 +#define TRUE 1 +#define BSIZE 512 + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +typedef struct buffered_line { + char *line; + int line_number; + SLIST_ENTRY(buffered_line) next; +} buffered_line; + +typedef struct included_file { + char *filename; + int lines_remaining; + SLIST_ENTRY(included_file) next; +} included_file; + +typedef struct macro_entry { + char *name; + int num_params; + char **params; + int num_lines; + char **lines; + STAILQ_ENTRY(macro_entry) next; +} macro_entry; + +typedef struct deferred_define { + char *name; + char *value; + SLIST_ENTRY(deferred_define) next; +} deferred_define; + +typedef struct expr_state { + const char *string; + char *symbol; + int string_cursor; +} expr_state; + +typedef struct yasm_preproc_gas { + yasm_preproc_base preproc; /* base structure */ + + FILE *in; + char *in_filename; + + yasm_symtab *defines; + SLIST_HEAD(deferred_defines_head, deferred_define) deferred_defines; + + int depth; + int skip_depth; + + int in_comment; + + expr_state expr; + + SLIST_HEAD(buffered_lines_head, buffered_line) buffered_lines; + SLIST_HEAD(included_files_head, included_file) included_files; + STAILQ_HEAD(macros_head, macro_entry) macros; + + int in_line_number; + int next_line_number; + int current_line_number; /* virtual (output) line number */ + + yasm_linemap *cur_lm; + yasm_errwarns *errwarns; + int fatal_error; + int detect_errors_only; +} yasm_preproc_gas; + +yasm_preproc_module yasm_gas_LTX_preproc; + +/* Forward declarations. */ + +static int substitute_values(yasm_preproc_gas *pp, char **line_ptr); + +/* String helpers. */ + +static const char *starts_with(const char *big, const char *little) +{ + while (*little) { + if (*little++ != *big++) { + return NULL; + } + } + return big; +} + +static void skip_whitespace(const char **line) +{ + while (isspace(**line)) { + (*line)++; + } +} + +static void skip_whitespace2(char **line) +{ + while (isspace(**line)) { + (*line)++; + } +} + +static const char *matches(const char *line, const char *directive) +{ + skip_whitespace(&line); + + if (*line == '.') { + line = starts_with(line + 1, directive); + if (line && (!*line || isspace(*line))) { + skip_whitespace(&line); + return line; + } + } + + return NULL; +} + +static int unquote(const char *arg, char *to, size_t to_size, char q, char expected, const char **remainder) +{ + const char *quote; + const char *end; + size_t len; + + skip_whitespace(&arg); + if (*arg != q) { + return -1; + } + + arg++; + + end = arg; + do { + quote = strchr(end, q); + if (!quote) { + return -2; + } + end = quote + 1; + } while (*(quote - 1) == '\\'); + + skip_whitespace(&end); + if (*end != expected) { + return -3; + } + + if (remainder) { + *remainder = end + 1; + } + + len = (size_t) (quote - arg); + if (len >= to_size) { + return -4; + } + + strncpy(to, arg, len); + to[len] = '\0'; + + return (int) len; +} + +/* Line-reading. */ + +static char *read_line_from_file(yasm_preproc_gas *pp, FILE *file) +{ + int bufsize = BSIZE; + char *buf; + char *p; + + buf = yasm_xmalloc((size_t)bufsize); + + /* Loop to ensure entire line is read (don't want to limit line length). */ + p = buf; + for (;;) { + if (!fgets(p, bufsize - (p - buf), file)) { + if (ferror(file)) { + yasm_error_set(YASM_ERROR_IO, N_("error when reading from file")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + } + break; + } + p += strlen(p); + if (p > buf && p[-1] == '\n') { + break; + } + if ((p - buf) + 1 >= bufsize) { + /* Increase size of buffer */ + char *oldbuf = buf; + bufsize *= 2; + buf = yasm_xrealloc(buf, (size_t) bufsize); + p = buf + (p - oldbuf); + } + } + + if (p == buf) { + /* No data; must be at EOF */ + yasm_xfree(buf); + return NULL; + } + + /* Strip the line ending */ + buf[strcspn(buf, "\r\n")] = '\0'; + return buf; +} + +static char *read_line(yasm_preproc_gas *pp) +{ + char *line; + + if (!SLIST_EMPTY(&pp->included_files)) { + included_file *inc_file = SLIST_FIRST(&pp->included_files); + if (inc_file->lines_remaining <= 0) { + SLIST_REMOVE_HEAD(&pp->included_files, next); + yasm_xfree(inc_file->filename); + yasm_xfree(inc_file); + } + } + + if (!SLIST_EMPTY(&pp->buffered_lines)) { + buffered_line *bline = SLIST_FIRST(&pp->buffered_lines); + SLIST_REMOVE_HEAD(&pp->buffered_lines, next); + line = bline->line; + if (bline->line_number != -1) { + pp->next_line_number = bline->line_number; + } + yasm_xfree(bline); + if (!SLIST_EMPTY(&pp->included_files)) { + SLIST_FIRST(&pp->included_files)->lines_remaining--; + } + return line; + } + + line = read_line_from_file(pp, pp->in); + if (line) { + pp->in_line_number++; + pp->next_line_number = pp->in_line_number; + } + + return line; +} + +static const char *get_arg(yasm_preproc_gas *pp, const char *src, char *dest, size_t dest_size) +{ + const char *comma = strchr(src, ','); + if (comma) { + size_t len = (size_t) (comma - src); + if (len >= dest_size) { + len = dest_size - 1; + } + strncpy(dest, src, len); + dest[len] = '\0'; + comma++; + skip_whitespace(&comma); + } else { + yasm_error_set(YASM_ERROR_SYNTAX, N_("expected comma")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + } + return comma; +} + +/* GAS expression evaluation. */ + +static char get_char(yasm_preproc_gas *pp) +{ + return pp->expr.string[pp->expr.string_cursor]; +} + +static const char *get_str(yasm_preproc_gas *pp) +{ + return pp->expr.string + pp->expr.string_cursor; +} + +static void next_char(yasm_preproc_gas *pp) +{ + pp->expr.string_cursor++; +} + +static int ishex(char c) +{ + c = tolower(c); + return isdigit(c) || (c >= 'a' && c <= 'f'); +} + +static void gas_scan_init(yasm_preproc_gas *pp, struct tokenval *tokval, const char *arg1) +{ + pp->expr.symbol = NULL; + pp->expr.string = arg1; + pp->expr.string_cursor = 0; + memset(tokval, 0, sizeof(struct tokenval)); + tokval->t_type = TOKEN_INVALID; +} + +static void gas_scan_cleanup(yasm_preproc_gas *pp, struct tokenval *tokval) +{ + if (tokval->t_integer) { + yasm_intnum_destroy(tokval->t_integer); + tokval->t_integer = NULL; + } + if (pp->expr.symbol) { + yasm_xfree(pp->expr.symbol); + pp->expr.symbol = NULL; + } +} + +static int gas_scan(void *preproc, struct tokenval *tokval) +{ + yasm_preproc_gas *pp = (yasm_preproc_gas *) preproc; + char c = get_char(pp); + const char *str; + + tokval->t_charptr = NULL; + + if (c == '\0') { + return tokval->t_type = TOKEN_EOS; + } + + if (isspace(c)) { + do { + next_char(pp); + c = get_char(pp); + } while (isspace(c)); + } + + if (isdigit(c)) { + int char_index = 0; + int value = 0; + + do { + value = value*10 + (c - '0'); + char_index++; + next_char(pp); + c = get_char(pp); + if (char_index == 1 && c == 'x' && value == 0) { + next_char(pp); + c = get_char(pp); + /* Hex notation. */ + while (ishex(c)) { + if (isdigit(c)) { + value = (value << 4) | (c - '0'); + } else { + value = (value << 4) | (tolower(c) - 'a' + 0xa); + } + next_char(pp); + c = get_char(pp); + } + break; + } + } while (isdigit(c)); + + if (tokval->t_integer) { + yasm_intnum_destroy(tokval->t_integer); + } + tokval->t_integer = yasm_intnum_create_int(value); + return tokval->t_type = TOKEN_NUM; + } + + tokval->t_type = TOKEN_INVALID; + str = get_str(pp); + + { + /* It should be tested whether GAS supports all of these or if there are missing ones. */ + unsigned i; + struct { + const char *op; + int token; + } ops[] = { + { "<<", TOKEN_SHL }, + { ">>", TOKEN_SHR }, + { "//", TOKEN_SDIV }, + { "%%", TOKEN_SMOD }, + { "==", TOKEN_EQ }, + { "!=", TOKEN_NE }, + { "<>", TOKEN_NE }, + { "<>", TOKEN_NE }, + { "<=", TOKEN_LE }, + { ">=", TOKEN_GE }, + { "&&", TOKEN_DBL_AND }, + { "^^", TOKEN_DBL_XOR }, + { "||", TOKEN_DBL_OR } + }; + if (strlen(str) > 1) { + for (i = 0; i < sizeof(ops)/sizeof(ops[0]); i++) { + if (!strncmp(str, ops[i].op, 2)) { + tokval->t_type = ops[i].token; + break; + } + } + } + } + + if (tokval->t_type != TOKEN_INVALID) { + next_char(pp); + next_char(pp); + } else { + str = get_str(pp); + + next_char(pp); + tokval->t_type = c; + + /* Is it a symbol? If so we need to make it a TOKEN_ID. */ + if (isalpha(c) || c == '_' || c == '.' || c == '%') { + int symbol_length = 1; + + c = get_char(pp); + while (isalnum(c) || c == '$' || c == '_') { + symbol_length++; + next_char(pp); + c = get_char(pp); + } + + pp->expr.symbol = yasm_xrealloc(pp->expr.symbol, symbol_length + 1); + memcpy(pp->expr.symbol, str, symbol_length); + pp->expr.symbol[symbol_length] = '\0'; + + tokval->t_type = TOKEN_ID; + tokval->t_charptr = pp->expr.symbol; + } + } + + return tokval->t_type; +} + +static void gas_err(void *private_data, int severity, const char *fmt, ...) +{ + va_list args; + yasm_preproc_gas *pp = private_data; + + if (!pp->detect_errors_only) { + va_start(args, fmt); + yasm_error_set_va(YASM_ERROR_SYNTAX, N_(fmt), args); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + va_end(args); + } + + pp->fatal_error = 1; +} + +static long eval_expr(yasm_preproc_gas *pp, const char *arg1) +{ + struct tokenval tv; + yasm_expr *expr; + yasm_intnum *intn; + long value; + expr_state prev_state; + + if (!*arg1) { + return 0; + } + + prev_state = pp->expr; + gas_scan_init(pp, &tv, arg1); + expr = evaluate(gas_scan, pp, &tv, pp, CRITICAL, gas_err, pp->defines); + intn = yasm_expr_get_intnum(&expr, 0); + value = yasm_intnum_get_int(intn); + yasm_expr_destroy(expr); + gas_scan_cleanup(pp, &tv); + pp->expr = prev_state; + + return value; +} + +/* If-directive helpers. */ + +static int handle_if(yasm_preproc_gas *pp, int is_true) +{ + assert(pp->depth >= 0); + assert(pp->skip_depth == 0); + if (is_true) { + pp->depth++; + } else { + pp->skip_depth = 1; + } + return 1; +} + +static int handle_endif(yasm_preproc_gas *pp) +{ + if (pp->depth) { + pp->depth--; + } else { + yasm_error_set(YASM_ERROR_SYNTAX, N_("\".endif\" without \".if\"")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } + return 1; +} + +static int handle_else(yasm_preproc_gas *pp, int is_elseif) +{ + if (!pp->depth) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("\".%s\" without \".if\""), is_elseif ? "elseif" : "else"); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } else { + pp->skip_depth = 1; + } + return 1; +} + +/* Directive-handling functions. */ + +static int eval_if(yasm_preproc_gas *pp, int negate, const char *arg1) +{ + long value; + if (!*arg1) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("expression is required in \".if\" statement")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } + value = eval_expr(pp, arg1); + handle_if(pp, (negate ? !value : !!value)); + return 1; +} + +static int eval_else(yasm_preproc_gas *pp, int unused) +{ + return handle_else(pp, 0); +} + +static int eval_endif(yasm_preproc_gas *pp, int unused) +{ + return handle_endif(pp); +} + +static int eval_elseif(yasm_preproc_gas *pp, int unused, const char *arg1) +{ + if (!*arg1) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("expression is required in \".elseif\" statement")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } + if (!handle_else(pp, 1)) { + return 0; + } + return eval_if(pp, 0, arg1); +} + +static int eval_ifb(yasm_preproc_gas *pp, int negate, const char *arg1) +{ + int is_blank = !*arg1; + return handle_if(pp, (negate ? !is_blank : is_blank)); +} + +static int eval_ifc(yasm_preproc_gas *pp, int negate, const char *args) +{ + char arg1[512], arg2[512]; + const char *remainder; + int len = unquote(args, arg1, sizeof(arg1), '\'', ',', &remainder); + if (len >= 0) { + len = unquote(remainder, arg2, sizeof(arg2), '\'', '\0', NULL); + if (len >= 0) { + int result = !strcmp(arg1, arg2); + return handle_if(pp, (negate ? !result : result)); + } + } else { + /* first argument was not single-quoted, assume non-quoted mode */ + remainder = get_arg(pp, args, arg1, sizeof(arg1)); + if (remainder) { + int result = !strcmp(arg1, remainder); + return handle_if(pp, (negate ? !result : result)); + } + } + yasm_error_set(YASM_ERROR_SYNTAX, N_("\"%s\" expects two single-quoted or unquoted arguments"), negate ? ".ifnc" : ".ifc"); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; +} + +static int eval_ifeqs(yasm_preproc_gas *pp, int negate, const char *args) +{ + char arg1[512], arg2[512]; + const char *remainder; + int len = unquote(args, arg1, sizeof(arg1), '"', ',', &remainder); + if (len >= 0) { + len = unquote(remainder, arg2, sizeof(arg2), '"', '\0', NULL); + if (len >= 0) { + int result = !strcmp(arg1, arg2); + return handle_if(pp, (negate ? !result : result)); + } + } + yasm_error_set(YASM_ERROR_SYNTAX, N_("\"%s\" expects two double-quoted arguments"), negate ? ".ifnes" : ".ifeqs"); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 1; +} + +static int eval_ifdef(yasm_preproc_gas *pp, int negate, const char *name) +{ + yasm_symrec *rec = yasm_symtab_get(pp->defines, name); + int result = (rec != NULL); + return handle_if(pp, (negate ? !result : result)); +} + +static int eval_ifge(yasm_preproc_gas *pp, int negate, const char *arg1) +{ + long value = eval_expr(pp, arg1); + int result = (value >= 0); + return handle_if(pp, (negate ? !result : result)); +} + +static int eval_ifgt(yasm_preproc_gas *pp, int negate, const char *arg1) +{ + long value = eval_expr(pp, arg1); + int result = (value > 0); + return handle_if(pp, (negate ? !result : result)); +} + +static int eval_include(yasm_preproc_gas *pp, int unused, const char *arg1) +{ + char *current_filename; + char filename[MAXPATHLEN]; + char *line; + int num_lines; + FILE *file; + buffered_line *prev_bline; + included_file *inc_file; + + if (unquote(arg1, filename, sizeof(filename), '"', '\0', NULL) < 0) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("string expected")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } + + if (SLIST_EMPTY(&pp->included_files)) { + current_filename = pp->in_filename; + } else { + current_filename = SLIST_FIRST(&pp->included_files)->filename; + } + file = yasm_fopen_include(filename, current_filename, "r", NULL); + if (!file) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("unable to open included file \"%s\""), filename); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } + + num_lines = 0; + prev_bline = NULL; + line = read_line_from_file(pp, file); + while (line) { + buffered_line *bline = yasm_xmalloc(sizeof(buffered_line)); + bline->line = line; + bline->line_number = -1; + if (prev_bline) { + SLIST_INSERT_AFTER(prev_bline, bline, next); + } else { + SLIST_INSERT_HEAD(&pp->buffered_lines, bline, next); + } + prev_bline = bline; + line = read_line_from_file(pp, file); + num_lines++; + } + + inc_file = yasm_xmalloc(sizeof(included_file)); + inc_file->filename = yasm__xstrdup(filename); + inc_file->lines_remaining = num_lines; + SLIST_INSERT_HEAD(&pp->included_files, inc_file, next); + return 1; +} + +static int try_eval_expr(yasm_preproc_gas *pp, const char *value, long *result) +{ + int success; + + pp->detect_errors_only = 1; + *result = eval_expr(pp, value); + success = !pp->fatal_error; + pp->fatal_error = 0; + pp->detect_errors_only = 0; + + return success; +} + +static int remove_define(yasm_preproc_gas *pp, const char *name, int allow_redefine) +{ + yasm_symrec *rec = yasm_symtab_get(pp->defines, name); + if (rec) { + const yasm_symtab_iter *entry; + yasm_symtab *new_defines; + + if (!allow_redefine) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("symbol \"%s\" is already defined"), name); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; + } + + new_defines = yasm_symtab_create(); + + for (entry = yasm_symtab_first(pp->defines); entry; entry = yasm_symtab_next(entry)) { + yasm_symrec *entry_rec = yasm_symtab_iter_value(entry); + const char *rec_name = yasm_symrec_get_name(entry_rec); + if (strcmp(rec_name, name)) { + yasm_intnum *num = yasm_intnum_create_int(eval_expr(pp, rec_name)); + yasm_expr *expr = yasm_expr_create_ident(yasm_expr_int(num), 0); + yasm_symtab_define_equ(new_defines, rec_name, expr, 0); + } + } + + yasm_symtab_destroy(pp->defines); + pp->defines = new_defines; + } + return (rec != NULL); +} + +static void add_define(yasm_preproc_gas *pp, const char *name, long value, int allow_redefine, int substitute) +{ + deferred_define *def, *prev_def, *temp_def; + yasm_intnum *num; + yasm_expr *expr; + + remove_define(pp, name, allow_redefine); + + /* Add the new define. */ + num = yasm_intnum_create_int(value); + expr = yasm_expr_create_ident(yasm_expr_int(num), 0); + yasm_symtab_define_equ(pp->defines, name, expr, 0); + + /* Perform substitution on any deferred defines. */ + if (substitute) { + prev_def = NULL; + temp_def = NULL; + SLIST_FOREACH_SAFE(def, &pp->deferred_defines, next, temp_def) { + if (substitute_values(pp, &def->value)) { + /* Value was updated - check if it can be added to the symtab. */ + if (try_eval_expr(pp, def->value, &value)) { + add_define(pp, def->name, value, FALSE, FALSE); + if (prev_def) { + SLIST_NEXT(prev_def, next) = SLIST_NEXT(def, next); + } else { + SLIST_FIRST(&pp->deferred_defines) = SLIST_NEXT(def, next); + } + yasm_xfree(def->name); + yasm_xfree(def->value); + yasm_xfree(def); + continue; + } + } + prev_def = def; + } + } +} + +static int eval_set(yasm_preproc_gas *pp, int allow_redefine, const char *name, const char *value) +{ + if (!pp->skip_depth) { + long result; + + if (!try_eval_expr(pp, value, &result)) { + deferred_define *def; + remove_define(pp, name, allow_redefine); + def = yasm_xmalloc(sizeof(deferred_define)); + def->name = yasm__xstrdup(name); + def->value = yasm__xstrdup(value); + substitute_values(pp, &def->value); + SLIST_INSERT_HEAD(&pp->deferred_defines, def, next); + } else { + add_define(pp, name, result, allow_redefine, TRUE); + } + } + return 1; +} + +static int eval_macro(yasm_preproc_gas *pp, int unused, char *args) +{ + char *end; + char *line; + long nesting = 1; + macro_entry *macro = yasm_xmalloc(sizeof(macro_entry)); + + memset(macro, 0, sizeof(macro_entry)); + + end = args; + while (*end && !isspace(*end)) { + end++; + } + macro->name = yasm_xmalloc(end - args + 1); + memcpy(macro->name, args, end - args); + macro->name[end - args] = '\0'; + + skip_whitespace2(&end); + while (*end) { + args = end; + while (*end && !isspace(*end) && *end != ',') { + end++; + } + macro->num_params++; + macro->params = yasm_xrealloc(macro->params, macro->num_params*sizeof(char *)); + macro->params[macro->num_params - 1] = yasm_xmalloc(end - args + 1); + memcpy(macro->params[macro->num_params - 1], args, end - args); + macro->params[macro->num_params - 1][end - args] = '\0'; + skip_whitespace2(&end); + if (*end == ',') { + end++; + skip_whitespace2(&end); + } + } + + STAILQ_INSERT_TAIL(&pp->macros, macro, next); + + line = read_line(pp); + while (line) { + char *line2 = line; + skip_whitespace2(&line2); + if (starts_with(line2, ".macro")) { + nesting++; + } else if (starts_with(line2, ".endm") && --nesting == 0) { + return 1; + } + macro->num_lines++; + macro->lines = yasm_xrealloc(macro->lines, macro->num_lines*sizeof(char *)); + macro->lines[macro->num_lines - 1] = line; + line = read_line(pp); + } + + yasm_error_set(YASM_ERROR_SYNTAX, N_("unexpected EOF in \".macro\" block")); + yasm_errwarn_propagate(pp->errwarns, yasm_linemap_get_current(pp->cur_lm)); + return 0; +} + +static int eval_endm(yasm_preproc_gas *pp, int unused) +{ + yasm_error_set(YASM_ERROR_SYNTAX, N_("\".endm\" without \".macro\"")); + yasm_errwarn_propagate(pp->errwarns, yasm_linemap_get_current(pp->cur_lm)); + return 0; +} + +static void get_param_value(macro_entry *macro, int param_index, const char *args, const char **value, int *length) +{ + int arg_index = 0; + const char *default_value = NULL; + const char *end, *eq = strstr(macro->params[param_index], "="); + + if (eq) { + default_value = eq + 1; + } + + skip_whitespace(&args); + end = args; + while (*end) { + args = end; + while (*end && !isspace(*end) && *end != ',') { + end++; + } + if (arg_index == param_index) { + if (end == args && default_value) { + *value = default_value; + *length = strlen(default_value); + } else { + *value = args; + *length = end - args; + } + return; + } + arg_index++; + skip_whitespace(&end); + if (*end == ',') { + end++; + skip_whitespace(&end); + } + } + + *value = default_value; + *length = (default_value ? strlen(default_value) : 0); +} + +static void expand_macro(yasm_preproc_gas *pp, macro_entry *macro, const char *args) +{ + int i, j; + buffered_line *prev_bline = NULL; + + for (i = 0; i < macro->num_lines; i++) { + buffered_line *bline = yasm_xmalloc(sizeof(buffered_line)); + struct tokenval tokval; + int prev_was_backslash = FALSE; + int line_length = strlen(macro->lines[i]); + char *work = yasm__xstrdup(macro->lines[i]); + expr_state prev_state = pp->expr; + + gas_scan_init(pp, &tokval, work); + while (gas_scan(pp, &tokval) != TOKEN_EOS) { + if (prev_was_backslash) { + if (tokval.t_type == TOKEN_ID) { + for (j = 0; j < macro->num_params; j++) { + char *end = strstr(macro->params[j], "="); + int len = (end ? (size_t)(end - macro->params[j]) + : strlen(macro->params[j])); + if (!tokval.t_charptr) { + continue; + } + if (!strncmp(tokval.t_charptr, macro->params[j], len) + && tokval.t_charptr[len] == '\0') { + /* now, find matching argument. */ + const char *value; + char *line = work + (pp->expr.string - work); + int cursor = pp->expr.string_cursor; + int value_length, delta; + + get_param_value(macro, j, args, &value, &value_length); + + len++; /* leading slash */ + delta = value_length - len; + line_length += delta; + if (delta > 0) { + line = yasm_xrealloc(line, line_length + 1); + } + memmove(line + cursor - len + value_length, line + cursor, strlen(line + cursor) + 1); + memcpy(line + cursor - len, value, value_length); + pp->expr.string = work = line; + pp->expr.string_cursor += delta; + if (pp->expr.symbol == tokval.t_charptr) { + tokval.t_charptr = NULL; + } + if (pp->expr.symbol) { + yasm_xfree(pp->expr.symbol); + pp->expr.symbol = NULL; + } + } + } + } + prev_was_backslash = FALSE; + } else if (tokval.t_type == '\\') { + prev_was_backslash = TRUE; + } + } + gas_scan_cleanup(pp, &tokval); + + bline->line = work + (pp->expr.string - work); + bline->line_number = -1; + pp->expr = prev_state; + + if (prev_bline) { + SLIST_INSERT_AFTER(prev_bline, bline, next); + } else { + SLIST_INSERT_HEAD(&pp->buffered_lines, bline, next); + } + prev_bline = bline; + } +} + +static int eval_rept(yasm_preproc_gas *pp, int unused, const char *arg1) +{ + long i, n = eval_expr(pp, arg1); + long num_lines = 0; + long nesting = 1; + char *line = read_line(pp); + buffered_line *prev_bline = NULL; + SLIST_HEAD(buffered_lines_head, buffered_line) lines; + int rept_start_file_line_number = pp->next_line_number - 1; + int rept_start_output_line_number = pp->current_line_number; + + SLIST_INIT(&lines); + + while (line) { + char *line2 = line; + skip_whitespace2(&line2); + if (starts_with(line2, ".rept")) { + nesting++; + } else if (starts_with(line2, ".endr") && --nesting == 0) { + for (i = 0; i < n; i++) { + buffered_line *current_line; + prev_bline = NULL; + SLIST_FOREACH(current_line, &lines, next) { + buffered_line *bline = yasm_xmalloc(sizeof(buffered_line)); + bline->line = yasm__xstrdup(current_line->line); + bline->line_number = current_line->line_number; + if (prev_bline) { + SLIST_INSERT_AFTER(prev_bline, bline, next); + } else { + SLIST_INSERT_HEAD(&pp->buffered_lines, bline, next); + } + prev_bline = bline; + } + } + if (!SLIST_EMPTY(&pp->included_files)) { + included_file *inc_file = SLIST_FIRST(&pp->included_files); + inc_file->lines_remaining += n * num_lines; + } + while (!SLIST_EMPTY(&lines)) { + buffered_line *bline = SLIST_FIRST(&lines); + SLIST_REMOVE_HEAD(&lines, next); + yasm_xfree(bline->line); + yasm_xfree(bline); + } + yasm_xfree(line); + return 1; + } + if (n > 0) { + buffered_line *bline = yasm_xmalloc(sizeof(buffered_line)); + bline->line = line; + bline->line_number = pp->next_line_number; + if (prev_bline) { + SLIST_INSERT_AFTER(prev_bline, bline, next); + } else { + SLIST_INSERT_HEAD(&lines, bline, next); + } + prev_bline = bline; + } else { + yasm_xfree(line); + } + line = read_line(pp); + num_lines++; + } + yasm_linemap_set(pp->cur_lm, pp->in_filename, rept_start_output_line_number, rept_start_file_line_number, 0); + yasm_error_set(YASM_ERROR_SYNTAX, N_("rept without matching endr")); + yasm_errwarn_propagate(pp->errwarns, rept_start_output_line_number); + return 0; +} + +static int eval_endr(yasm_preproc_gas *pp, int unused) +{ + yasm_error_set(YASM_ERROR_SYNTAX, N_("\".endr\" without \".rept\"")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + return 0; +} + +/* Top-level line processing. */ + +typedef int (*pp_fn0_t)(yasm_preproc_gas *pp, int param); +typedef int (*pp_fn1_t)(yasm_preproc_gas *pp, int param, const char *arg1); +typedef int (*pp_fn2_t)(yasm_preproc_gas *pp, int param, const char *arg1, const char *arg2); + +#define FN(f) ((pp_fn0_t) &(f)) + +static char *find_str_bound(char *line) +{ + for (; line[0]; ++line) { + if (line[0] == '"') return line; + if (line[0] == '\\' && line[1] == '"') ++line; + } + return NULL; +} + +static char *find_comment(char *line) +{ + char *c, *s; + + for (c = line, s = line; (c = strstr(c, "/*")); s = c) { + for (;;) { + s = find_str_bound(s); + if (!s || s > c) return c; + + s = find_str_bound(s + 1); + if (!s || s > c) return NULL; + } + } + + return NULL; +} + +static void kill_comments(yasm_preproc_gas *pp, char *line) +{ + int next = 2; + char *cstart; + + skip_whitespace2(&line); + if (*line == '#' || !strncmp(line, "//", 2)) { + *line = '\0'; + return; + } + + if (pp->in_comment) { + cstart = line; + next = 0; + } else { + cstart = find_comment(line); + next = 2; + } + + while (cstart) { + char *cend = strstr(cstart + next, "*/"); + + if (!cend) { + *cstart = '\0'; + pp->in_comment = TRUE; + return; + } + + memmove(cstart, cend + 2, strlen(cend + 2) + 1); + pp->in_comment = FALSE; + cstart = strstr(cstart, "/*"); + next = 2; + } +} + +static int substitute_values(yasm_preproc_gas *pp, char **line_ptr) +{ + int changed = 0; + char *line = *line_ptr; + int line_length = strlen(line); + struct tokenval tokval; + expr_state prev_state = pp->expr; + + gas_scan_init(pp, &tokval, line); + while (gas_scan(pp, &tokval) != TOKEN_EOS) { + if (tokval.t_type == TOKEN_ID) { + yasm_symrec *rec = yasm_symtab_get(pp->defines, tokval.t_charptr); + if (rec) { + int cursor = pp->expr.string_cursor; + int len = strlen(tokval.t_charptr); + char value[64]; + int value_length = sprintf(value, "%ld", eval_expr(pp, tokval.t_charptr)); + int delta = value_length - len; + + line_length += delta; + if (delta > 0) { + line = yasm_xrealloc(line, line_length + 1); + } + memmove(line + cursor - len + value_length, line + cursor, strlen(line + cursor) + 1); + memcpy(line + cursor - len, value, value_length); + pp->expr.string = line; + pp->expr.string_cursor = cursor + delta; + changed = 1; + } + yasm_xfree(pp->expr.symbol); + pp->expr.symbol = NULL; + } + } + gas_scan_cleanup(pp, &tokval); + pp->expr = prev_state; + + if (changed) { + *line_ptr = line; + } + + return changed; +} + +static int process_line(yasm_preproc_gas *pp, char **line_ptr) +{ + macro_entry *macro; + size_t i; + char *line = *line_ptr; + struct { + const char *name; + int nargs; + pp_fn0_t fn; + int param; + } directives[] = { + {"else", 0, FN(eval_else), 0}, + {"elseif", 1, FN(eval_elseif), 0}, + {"endif", 0, FN(eval_endif), 0}, + {"if", 1, FN(eval_if), 0}, + {"ifb", 1, FN(eval_ifb), 0}, + {"ifc", 1, FN(eval_ifc), 0}, + {"ifdef", 1, FN(eval_ifdef), 0}, + {"ifeq", 1, FN(eval_if), 1}, + {"ifeqs", 1, FN(eval_ifeqs), 0}, + {"ifge", 1, FN(eval_ifge), 0}, + {"ifgt", 1, FN(eval_ifgt), 0}, + {"ifle", 1, FN(eval_ifgt), 1}, + {"iflt", 1, FN(eval_ifge), 1}, + {"ifnb", 1, FN(eval_ifb), 1}, + {"ifnc", 1, FN(eval_ifc), 1}, + {"ifndef", 1, FN(eval_ifdef), 1}, + {"ifnotdef", 1, FN(eval_ifdef), 1}, + {"ifne", 1, FN(eval_if), 0}, + {"ifnes", 1, FN(eval_ifeqs), 1}, + {"include", 1, FN(eval_include), 0}, + {"set", 2, FN(eval_set), 1}, + {"equ", 2, FN(eval_set), 1}, + {"equiv", 2, FN(eval_set), 0}, + {"macro", 1, FN(eval_macro), 0}, + {"endm", 0, FN(eval_endm), 0}, + {"rept", 1, FN(eval_rept), 0}, + {"endr", 1, FN(eval_endr), 0}, + }; + + kill_comments(pp, line); + skip_whitespace2(&line); + if (*line == '\0') { + return FALSE; + } + + /* See if this is a macro call. */ + STAILQ_FOREACH(macro, &pp->macros, next) { + const char *remainder = starts_with(line, macro->name); + if (remainder && (!*remainder || isspace(*remainder))) { + skip_whitespace2(&line); + expand_macro(pp, macro, remainder); + return FALSE; + } + } + + for (i = 0; i < sizeof(directives)/sizeof(directives[0]); i++) { + char buf1[1024]; + const char *remainder = matches(line, directives[i].name); + + if (remainder) { + if (pp->skip_depth) { + if (!strncmp("if", directives[i].name, 2)) { + pp->skip_depth++; + } else if (!strcmp("endif", directives[i].name)) { + pp->skip_depth--; + } else if (!strcmp("else", directives[i].name)) { + if (pp->skip_depth == 1) { + pp->skip_depth = 0; + pp->depth++; + } + } + return FALSE; + } else if (directives[i].nargs == 0) { + pp_fn0_t fn = (pp_fn0_t) directives[i].fn; + pp->fatal_error = !fn(pp, directives[i].param); + return FALSE; + } else if (directives[i].nargs == 1) { + pp_fn1_t fn = (pp_fn1_t) directives[i].fn; + skip_whitespace(&remainder); + pp->fatal_error = !fn(pp, directives[i].param, remainder); + return FALSE; + } else if (directives[i].nargs == 2) { + remainder = get_arg(pp, remainder, buf1, sizeof(buf1)); + if (!remainder || !*remainder || !*buf1) { + yasm_error_set(YASM_ERROR_SYNTAX, N_("\".%s\" expects two arguments"), directives[i].name); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + pp->fatal_error = 1; + } else { + pp_fn2_t fn = (pp_fn2_t) directives[i].fn; + pp->fatal_error = !fn(pp, directives[i].param, buf1, remainder); + } + return FALSE; + } + } + } + + if (pp->skip_depth == 0) { + substitute_values(pp, line_ptr); + return TRUE; + } + + return FALSE; +} + +/* Functions exported by the preprocessor. */ + +static yasm_preproc * +gas_preproc_create(const char *in_filename, yasm_symtab *symtab, + yasm_linemap *lm, yasm_errwarns *errwarns) +{ + FILE *f; + yasm_preproc_gas *pp = yasm_xmalloc(sizeof(yasm_preproc_gas)); + + if (strcmp(in_filename, "-") != 0) { + f = fopen(in_filename, "r"); + if (!f) { + yasm__fatal(N_("Could not open input file")); + } + } else { + f = stdin; + } + + pp->preproc.module = &yasm_gas_LTX_preproc; + pp->in = f; + pp->in_filename = yasm__xstrdup(in_filename); + pp->defines = yasm_symtab_create(); + SLIST_INIT(&pp->deferred_defines); + yasm_symtab_set_case_sensitive(pp->defines, 1); + pp->depth = 0; + pp->skip_depth = 0; + pp->in_comment = FALSE; + SLIST_INIT(&pp->buffered_lines); + SLIST_INIT(&pp->included_files); + STAILQ_INIT(&pp->macros); + pp->in_line_number = 0; + pp->next_line_number = 0; + pp->current_line_number = 0; + pp->cur_lm = lm; + pp->errwarns = errwarns; + pp->fatal_error = 0; + pp->detect_errors_only = 0; + + return (yasm_preproc *) pp; +} + +static void +gas_preproc_destroy(yasm_preproc *preproc) +{ + yasm_preproc_gas *pp = (yasm_preproc_gas *) preproc; + yasm_xfree(pp->in_filename); + yasm_symtab_destroy(pp->defines); + while (!SLIST_EMPTY(&pp->deferred_defines)) { + deferred_define *def = SLIST_FIRST(&pp->deferred_defines); + SLIST_REMOVE_HEAD(&pp->deferred_defines, next); + yasm_xfree(def->name); + yasm_xfree(def->value); + yasm_xfree(def); + } + while (!SLIST_EMPTY(&pp->buffered_lines)) { + buffered_line *bline = SLIST_FIRST(&pp->buffered_lines); + SLIST_REMOVE_HEAD(&pp->buffered_lines, next); + yasm_xfree(bline->line); + yasm_xfree(bline); + } + while (!SLIST_EMPTY(&pp->included_files)) { + included_file *inc_file = SLIST_FIRST(&pp->included_files); + SLIST_REMOVE_HEAD(&pp->included_files, next); + yasm_xfree(inc_file->filename); + yasm_xfree(inc_file); + } + while (!STAILQ_EMPTY(&pp->macros)) { + int i; + macro_entry *macro = STAILQ_FIRST(&pp->macros); + STAILQ_REMOVE_HEAD(&pp->macros, next); + yasm_xfree(macro->name); + for (i = 0; i < macro->num_params; i++) + yasm_xfree(macro->params[i]); + yasm_xfree(macro->params); + for (i = 0; i < macro->num_lines; i++) + yasm_xfree(macro->lines[i]); + yasm_xfree(macro->lines); + yasm_xfree(macro); + } + yasm_xfree(preproc); +} + +static char * +gas_preproc_get_line(yasm_preproc *preproc) +{ + yasm_preproc_gas *pp = (yasm_preproc_gas *)preproc; + int done = FALSE; + char *line = NULL; + + pp->current_line_number++; + + do { + if (line != NULL) { + yasm_xfree(line); + } + if (pp->fatal_error) { + return NULL; + } + line = read_line(pp); + if (line == NULL) { + if (pp->in_comment) { + yasm_linemap_set(pp->cur_lm, pp->in_filename, pp->current_line_number, pp->next_line_number, 0); + yasm_warn_set(YASM_WARN_GENERAL, N_("end of file in comment")); + yasm_errwarn_propagate(pp->errwarns, pp->current_line_number); + pp->in_comment = FALSE; + } + return NULL; + } + done = process_line(pp, &line); + } while (!done); + + yasm_linemap_set(pp->cur_lm, pp->in_filename, pp->current_line_number, pp->next_line_number, 0); + + return line; +} + +static size_t +gas_preproc_get_included_file(yasm_preproc *preproc, char *buf, + size_t max_size) +{ + /* TODO */ + return 0; +} + +static void +gas_preproc_add_include_file(yasm_preproc *preproc, const char *filename) +{ + yasm_preproc_gas *pp = (yasm_preproc_gas *) preproc; + eval_include(pp, 0, filename); +} + +static void +gas_preproc_predefine_macro(yasm_preproc *preproc, const char *macronameval) +{ + yasm_preproc_gas *pp = (yasm_preproc_gas *) preproc; + const char *eq = strstr(macronameval, "="); + char *name, *value; + if (eq) { + value = yasm__xstrdup(eq + 1); + name = yasm_xmalloc(eq - macronameval + 1); + memcpy(name, macronameval, eq - macronameval); + name[eq - macronameval] = '\0'; + } else { + name = yasm__xstrdup(macronameval); + value = yasm__xstrdup(""); + } + eval_set(pp, 1, name, value); + yasm_xfree(name); + yasm_xfree(value); +} + +static void +gas_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname) +{ + /* TODO */ +} + +static void +gas_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval) +{ + /* TODO */ +} + +static void +gas_preproc_add_standard(yasm_preproc *preproc, const char **macros) +{ + /* TODO */ +} + + +/* Define preproc structure -- see preproc.h for details */ +yasm_preproc_module yasm_gas_LTX_preproc = { + "GNU AS (GAS)-compatible preprocessor", + "gas", + gas_preproc_create, + gas_preproc_destroy, + gas_preproc_get_line, + gas_preproc_get_included_file, + gas_preproc_add_include_file, + gas_preproc_predefine_macro, + gas_preproc_undefine_macro, + gas_preproc_define_builtin, + gas_preproc_add_standard +}; diff --git a/modules/preprocs/gas/tests/Makefile.inc b/modules/preprocs/gas/tests/Makefile.inc new file mode 100644 index 00000000..c5e628a0 --- /dev/null +++ b/modules/preprocs/gas/tests/Makefile.inc @@ -0,0 +1,5 @@ +#TESTS += modules/preprocs/gas/tests/rawpp_test.sh + +#EXTRA_DIST += modules/preprocs/gas/tests/rawpp_test.sh +#EXTRA_DIST += modules/preprocs/gas/tests/longline.asm +#EXTRA_DIST += modules/preprocs/gas/tests/longline.hex diff --git a/modules/preprocs/nasm/CMakeLists.txt b/modules/preprocs/nasm/CMakeLists.txt new file mode 100644 index 00000000..b5abaa74 --- /dev/null +++ b/modules/preprocs/nasm/CMakeLists.txt @@ -0,0 +1,33 @@ +add_executable(genversion preprocs/nasm/genversion.c) +if(CMAKE_CROSSCOMPILING) + find_program(GENVERSION_BIN NAMES genversion REQUIRED) + add_executable(yasm::genversion IMPORTED GLOBAL) + set_property(TARGET yasm::genversion PROPERTY IMPORTED_LOCATION "${GENVERSION_BIN}") +else() + add_executable(yasm::genversion ALIAS genversion) +endif() + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.mac + COMMAND yasm::genversion ${CMAKE_CURRENT_BINARY_DIR}/version.mac + ) + +YASM_GENMACRO( + ${CMAKE_CURRENT_BINARY_DIR}/version.mac + ${CMAKE_CURRENT_BINARY_DIR}/nasm-version.c + nasm_version_mac + ) + +SET_SOURCE_FILES_PROPERTIES(preprocs/nasm/nasm-preproc.c PROPERTIES + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nasm-version.c + ) + +YASM_ADD_MODULE(preproc_nasm + preprocs/nasm/nasm-preproc.c + preprocs/nasm/nasm-pp.c + preprocs/nasm/nasmlib.c + preprocs/nasm/nasm-eval.c + ) + +YASM_ADD_MODULE(preproc_tasm + ) diff --git a/modules/preprocs/nasm/Makefile.inc b/modules/preprocs/nasm/Makefile.inc index a91eb914..ef29d479 100644 --- a/modules/preprocs/nasm/Makefile.inc +++ b/modules/preprocs/nasm/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/preprocs/nasm/nasm-preproc.c libyasm_a_SOURCES += modules/preprocs/nasm/nasm-pp.h libyasm_a_SOURCES += modules/preprocs/nasm/nasm-pp.c @@ -9,25 +7,15 @@ libyasm_a_SOURCES += modules/preprocs/nasm/nasmlib.c libyasm_a_SOURCES += modules/preprocs/nasm/nasm-eval.h libyasm_a_SOURCES += modules/preprocs/nasm/nasm-eval.c -YASM_MODULES += preproc_nasm +YASM_MODULES += preproc_nasm preproc_tasm -$(top_srcdir)/src/preprocs/nasm/nasm-pp.c: nasm-macros.c +$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c -nasm-macros.c: $(top_srcdir)/modules/preprocs/nasm/standard.mac version.mac genmacro$(EXEEXT) - $(top_builddir)/genmacro$(EXEEXT) $(top_srcdir)/modules/preprocs/nasm/standard.mac version.mac +nasm-version.c: version.mac genmacro$(EXEEXT) + $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac -BUILT_SOURCES += nasm-macros.c -CLEANFILES += nasm-macros.c - -noinst_PROGRAMS += genmacro - -genmacro_SOURCES = -EXTRA_DIST += modules/preprocs/nasm/genmacro.c -genmacro_LDADD = genmacro.$(OBJEXT) -genmacro_LINK = $(CCLD_FOR_BUILD) -o $@ - -genmacro.$(OBJEXT): modules/preprocs/nasm/genmacro.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genmacro.c || echo '$(srcdir)/'`modules/preprocs/nasm/genmacro.c +BUILT_SOURCES += nasm-version.c +CLEANFILES += nasm-version.c version.mac: genversion$(EXEEXT) $(top_builddir)/genversion$(EXEEXT) $@ @@ -45,7 +33,6 @@ genversion_LINK = $(CCLD_FOR_BUILD) -o $@ genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c -EXTRA_DIST += modules/preprocs/nasm/standard.mac EXTRA_DIST += modules/preprocs/nasm/tests/Makefile.inc include modules/preprocs/nasm/tests/Makefile.inc diff --git a/modules/preprocs/nasm/genversion.c b/modules/preprocs/nasm/genversion.c index 5426c3dd..164b4d6b 100644 --- a/modules/preprocs/nasm/genversion.c +++ b/modules/preprocs/nasm/genversion.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Generate version.mac * @@ -36,13 +36,23 @@ int main(int argc, char *argv[]) { FILE *out; - int major, minor, subminor; + int major, minor, subminor, patchlevel, matched; if (argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); return EXIT_FAILURE; } + matched = sscanf(PACKAGE_VERSION, "%d.%d.%d.%d", &major, &minor, &subminor, + &patchlevel); + + if (matched == 3) + patchlevel = 0; + else if (matched != 4) { + fprintf(stderr, "Version tokenizing error\n"); + return EXIT_FAILURE; + } + out = fopen(argv[1], "wt"); if (!out) { @@ -53,27 +63,18 @@ main(int argc, char *argv[]) fprintf(out, "; This file auto-generated by genversion.c" " - don't edit it\n"); - if (sscanf(PACKAGE_INTVER, "%d.%d.%d", &major, &minor, &subminor) != 3) { - fprintf(stderr, "Version tokenizing error\n"); - fclose(out); - remove(argv[1]); - return EXIT_FAILURE; - } - fprintf(out, "%%define __YASM_MAJOR__ %d\n", major); fprintf(out, "%%define __YASM_MINOR__ %d\n", minor); fprintf(out, "%%define __YASM_SUBMINOR__ %d\n", subminor); - if (!isdigit(PACKAGE_BUILD[0])) - fprintf(out, "%%define __YASM_BUILD__ 0\n"); - else - fprintf(out, "%%define __YASM_BUILD__ %d\n", atoi(PACKAGE_BUILD)); + fprintf(out, "%%define __YASM_BUILD__ %d\n", patchlevel); + fprintf(out, "%%define __YASM_PATCHLEVEL__ %d\n", patchlevel); /* Version id (hex number) */ - fprintf(out, "%%define __YASM_VERSION_ID__ 0%02x%02x%02x00h\n", major, - minor, subminor); + fprintf(out, "%%define __YASM_VERSION_ID__ 0%02x%02x%02x%02xh\n", major, + minor, subminor, patchlevel); - /* Version string - version sans build */ - fprintf(out, "%%define __YASM_VER__ \"%s\"\n", PACKAGE_INTVER); + /* Version string */ + fprintf(out, "%%define __YASM_VER__ \"%s\"\n", PACKAGE_VERSION); fclose(out); return EXIT_SUCCESS; diff --git a/modules/preprocs/nasm/nasm-eval.c b/modules/preprocs/nasm/nasm-eval.c index c896a1cc..e249484c 100644 --- a/modules/preprocs/nasm/nasm-eval.c +++ b/modules/preprocs/nasm/nasm-eval.c @@ -12,12 +12,16 @@ #include #include #include +#include #include #include "nasm.h" #include "nasmlib.h" #include "nasm-eval.h" +/* The assembler symbol table. */ +extern yasm_symtab *nasm_symtab; + static scanner scan; /* Address of scanner routine */ static efunc error; /* Address of error reporting routine */ @@ -381,6 +385,21 @@ static yasm_expr *expr6(void) e = yasm_expr_create_ident(yasm_expr_int(tokval->t_integer), 0); break; case TOKEN_ID: + if (nasm_symtab) { + yasm_symrec *sym = + yasm_symtab_get(nasm_symtab, tokval->t_charptr); + if (sym) { + e = yasm_expr_create_ident(yasm_expr_sym(sym), 0); + } else { + error(ERR_NONFATAL, + "undefined symbol `%s' in preprocessor", + tokval->t_charptr); + e = yasm_expr_create_ident(yasm_expr_int( + yasm_intnum_create_int(1)), 0); + } + break; + } + /*fallthrough*/ case TOKEN_HERE: case TOKEN_BASE: error(ERR_NONFATAL, diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c index 604bb2bc..8b7ab572 100644 --- a/modules/preprocs/nasm/nasm-pp.c +++ b/modules/preprocs/nasm/nasm-pp.c @@ -63,6 +63,7 @@ struct SMacro { SMacro *next; char *name; + int level; int casesense; int nparam; int in_progress; @@ -276,15 +277,15 @@ static const char *directives[] = { "%elifid", "%elifidn", "%elifidni", "%elifmacro", "%elifnctx", "%elifndef", "%elifnid", "%elifnidn", "%elifnidni", "%elifnmacro", "%elifnnum", "%elifnstr", "%elifnum", "%elifstr", "%else", "%endif", "%endm", "%endmacro", - "%endrep", "%error", "%exitrep", "%iassign", "%idefine", "%if", + "%endrep", "%endscope", "%error", "%exitrep", "%iassign", "%idefine", "%if", "%ifctx", "%ifdef", "%ifid", "%ifidn", "%ifidni", "%ifmacro", "%ifnctx", "%ifndef", "%ifnid", "%ifnidn", "%ifnidni", "%ifnmacro", "%ifnnum", "%ifnstr", "%ifnum", "%ifstr", "%imacro", "%include", "%ixdefine", "%line", "%local", "%macro", "%pop", "%push", "%rep", "%repl", "%rotate", - "%stacksize", - "%strlen", "%substr", "%undef", "%xdefine" + "%scope", "%stacksize", + "%strlen", "%substr", "%undef", "%warning", "%xdefine" }; enum { @@ -293,15 +294,15 @@ enum PP_ELIFID, PP_ELIFIDN, PP_ELIFIDNI, PP_ELIFMACRO, PP_ELIFNCTX, PP_ELIFNDEF, PP_ELIFNID, PP_ELIFNIDN, PP_ELIFNIDNI, PP_ELIFNMACRO, PP_ELIFNNUM, PP_ELIFNSTR, PP_ELIFNUM, PP_ELIFSTR, PP_ELSE, PP_ENDIF, PP_ENDM, PP_ENDMACRO, - PP_ENDREP, PP_ERROR, PP_EXITREP, PP_IASSIGN, PP_IDEFINE, PP_IF, + PP_ENDREP, PP_ENDSCOPE, PP_ERROR, PP_EXITREP, PP_IASSIGN, PP_IDEFINE, PP_IF, PP_IFCTX, PP_IFDEF, PP_IFID, PP_IFIDN, PP_IFIDNI, PP_IFMACRO, PP_IFNCTX, PP_IFNDEF, PP_IFNID, PP_IFNIDN, PP_IFNIDNI, PP_IFNMACRO, PP_IFNNUM, PP_IFNSTR, PP_IFNUM, PP_IFSTR, PP_IMACRO, PP_INCLUDE, PP_IXDEFINE, PP_LINE, PP_LOCAL, PP_MACRO, PP_POP, PP_PUSH, PP_REP, PP_REPL, PP_ROTATE, - PP_STACKSIZE, - PP_STRLEN, PP_SUBSTR, PP_UNDEF, PP_XDEFINE + PP_SCOPE, PP_STACKSIZE, + PP_STRLEN, PP_SUBSTR, PP_UNDEF, PP_WARNING, PP_XDEFINE }; /* If this is a an IF, ELIF, ELSE or ENDIF keyword */ @@ -324,7 +325,9 @@ static int is_condition(int arg) enum { TM_ARG, TM_ELIF, TM_ELSE, TM_ENDIF, TM_IF, TM_IFDEF, TM_IFDIFI, - TM_IFNDEF, TM_INCLUDE, TM_LOCAL + TM_IFNDEF, TM_INCLUDE, TM_LOCAL, + TM_REPT, TM_IRP, TM_MACRO, + TM_STRUC, TM_SEGMENT }; static const char *tasm_directives[] = { @@ -336,6 +339,7 @@ static int StackSize = 4; static const char *StackPointer = "ebp"; static int ArgOffset = 8; static int LocalOffset = 4; +static int Level = 0; static Context *cstk; @@ -351,7 +355,9 @@ static int pass; /* HACK: pass 0 = generate dependencies only */ static unsigned long unique; /* unique identifier numbers */ static Line *builtindef = NULL; +static Line *stddef = NULL; static Line *predef = NULL; +static int first_line = 1; static ListGen *list; @@ -360,7 +366,7 @@ static ListGen *list; * FIXME: We should *really* be able to configure this at run time, * or even have the hash table automatically expanding when necessary. */ -#define NHASH 31 +#define NHASH 4096 /* * The current set of multi-line macros we have defined. @@ -384,18 +390,62 @@ static MMacro *defining; #define PARAM_DELTA 16 /* - * The standard macro set: defined as `static char *stdmac[]'. Also - * gives our position in the macro set, when we're processing it. + * Macros to make NASM ignore some TASM directives before the first include + * directive. */ -#include "nasm-macros.c" -static const char **stdmacpos; - -/* - * The extra standard macros that come from the object format, if - * any. - */ -static const char **extrastdmac = NULL; -int any_extrastdmac; +static const char *tasm_compat_macros[] = +{ + "%idefine IDEAL", + "%idefine JUMPS", + "%idefine END", + "%idefine P8086 CPU 8086", + "%idefine P186 CPU 186", + "%idefine P286 CPU 286", + "%idefine P286N CPU 286", + "%idefine P286P CPU 286 Priv", + "%idefine P386 CPU 386", + "%idefine P386N CPU 386", + "%idefine P386P CPU 386 Priv", + "%idefine P486 CPU 486", + "%idefine P586 CPU 586", + "%idefine .8086 CPU 8086", + "%idefine .186 CPU 186", + "%idefine .286 CPU 286", + "%idefine .286C CPU 286", + "%idefine .286P CPU 286", + "%idefine .386 CPU 386", + "%idefine .386C CPU 386", + "%idefine .386P CPU 386", + "%idefine .486 CPU 486", + "%idefine .486C CPU 486", + "%idefine .486P CPU 486", + "%idefine .586 CPU 586", + "%idefine .586C CPU 586", + "%idefine .586P CPU 586", + "", + "%imacro TITLE 1", + "%endm", + "%imacro NAME 1", + "%endm", + "", + "%imacro EXTRN 1-*.nolist", + "%rep %0", + "[extern %1]", + "%rotate 1", + "%endrep", + "%endmacro", + "", + "%imacro PUBLIC 1-*.nolist", + "%rep %0", + "[global %1]", + "%rotate 1", + "%endrep", + "%endmacro", + "", + "; this is not needed", + "%idefine PTR", + NULL +}; static int nested_mac_count, nested_rep_count; @@ -425,6 +475,7 @@ static void delete_Blocks(void); static Token *new_Token(Token * next, int type, const char *text, size_t txtlen); static Token *delete_Token(Token * t); +static Token *tokenise(char *line); /* * Macros for safe checking of token pointers, avoid *(NULL) @@ -439,69 +490,552 @@ static Token *delete_Token(Token * t); * place to do it for the moment, and it is a hack (ideally it would * be nice to be able to use the NASM pre-processor to do it). */ + +typedef struct TMEndItem { + int type; + void *data; + struct TMEndItem *next; +} TMEndItem; + +static TMEndItem *EndmStack = NULL, *EndsStack = NULL; + +char **TMParameters; + +struct TStrucField { + char *name; + char *type; + struct TStrucField *next; +}; +struct TStruc { + char *name; + struct TStrucField *fields, *lastField; + struct TStruc *next; +}; +static struct TStruc *TStrucs = NULL; +static int inTstruc = 0; + +struct TSegmentAssume { + char *segreg; + char *segment; +}; +struct TSegmentAssume *TAssumes; + +const char *tasm_get_segment_register(const char *segment) +{ + struct TSegmentAssume *assume; + if (!TAssumes) + return NULL; + for (assume = TAssumes; assume->segreg; assume++) { + if (!strcmp(assume->segment, segment)) + break; + } + return assume->segreg; +} + static char * check_tasm_directive(char *line) { int i, j, k, m; - size_t len; - char *p = line, *oldline, oldchar; + size_t len, len2; + char *p, *oldline, oldchar, *q, oldchar2; + TMEndItem *end; + + p = line; /* Skip whitespace */ - while (isspace(*p) && *p != 0) + while (isspace(*p) && *p != 0 && *p != ';') p++; + /* Ignore nasm directives */ + if (*p == '%') + return line; + /* Binary search for the directive name */ + len = 0; + while (!isspace(p[len]) && p[len] != 0 && p[len] != ';') + len++; + if (!len) + return line; + + oldchar = p[len]; + p[len] = 0; i = -1; j = elements(tasm_directives); - len = 0; - while (!isspace(p[len]) && p[len] != 0) - len++; - if (len) + while (j - i > 1) { - oldchar = p[len]; - p[len] = 0; - while (j - i > 1) + k = (j + i) / 2; + m = nasm_stricmp(p, tasm_directives[k]); + if (m == 0) { - k = (j + i) / 2; - m = nasm_stricmp(p, tasm_directives[k]); - if (m == 0) + /* We have found a directive, so jam a % in front of it + * so that NASM will then recognise it as one if it's own. + */ + p[len] = oldchar; + len = strlen(p); + oldline = line; + if (k == TM_IFDIFI) { - /* We have found a directive, so jam a % in front of it - * so that NASM will then recognise it as one if it's own. + /* NASM does not recognise IFDIFI, so we convert it to + * %ifdef BOGUS. This is not used in NASM comaptible + * code, but does need to parse for the TASM macro + * package. */ - p[len] = oldchar; + line = nasm_malloc(13); + strcpy(line, "%ifdef BOGUS"); + } + else if (k == TM_INCLUDE) + { + /* add double quotes around file name */ + p += 7 + 1; + while (isspace(*p) && *p) + p++; len = strlen(p); - oldline = line; + line = nasm_malloc(1 + 7 + 1 + 1 + len + 1 + 1); + sprintf(line, "%%include \"%s\"", p); + } + else + { line = nasm_malloc(len + 2); line[0] = '%'; - if (k == TM_IFDIFI) - { - /* NASM does not recognise IFDIFI, so we convert it to - * %ifdef BOGUS. This is not used in NASM comaptible - * code, but does need to parse for the TASM macro - * package. - */ - strcpy(line + 1, "ifdef BOGUS"); + memcpy(line + 1, p, len + 1); + } + nasm_free(oldline); + return line; + } + else if (m < 0) + { + j = k; + } + else + i = k; + } + + /* Not a simple directive */ + + if (!nasm_stricmp(p, "endm")) { + /* handle end of endm directive */ + char **parameter; + end = EndmStack; + /* undef parameters */ + if (!end) { + error(ERR_FATAL, "ENDM: not in an endm context"); + return line; + } + EndmStack = EndmStack->next; + nasm_free(line); + switch (end->type) { + case TM_MACRO: + len = 0; + for (parameter = end->data; *parameter; parameter++) + len += 6 + 1 + strlen(*parameter) + 1; + len += 5 + 1; + line = nasm_malloc(len); + p = line; + for (parameter = end->data; *parameter; parameter++) { + p += sprintf(p, "%%undef %s\n", *parameter); + nasm_free(*parameter); + } + nasm_free(end->data); + nasm_free(end); + sprintf(p, "%%endm"); + return line; + case TM_REPT: + nasm_free(end); + return nasm_strdup("%endrep"); + case TM_IRP: { + char **data; + const char *irp_format = + "%%undef %s\n" + "%%rotate 1\n" + "%%endrep\n" + "%%endm\n" + "irp %s\n" + "%%undef irp"; + data = end->data; + line = nasm_malloc(strlen(irp_format) - 4 + strlen(data[0]) + + strlen(data[1])); + sprintf(line, irp_format, data[0], data[1]); + nasm_free(data[0]); + nasm_free(data[1]); + nasm_free(data); + return line; + } + default: + error(ERR_FATAL, "ENDM: bogus endm context type %d\n",end->type); + return NULL; + } + } else if (!nasm_stricmp(p, "end")) { + nasm_free(line); + return nasm_strdup(""); + } else if (!nasm_stricmp(p, "rept")) { + /* handle repeat directive */ + end = nasm_malloc(sizeof(*end)); + end->type = TM_REPT; + end->next = EndmStack; + EndmStack = end; + memcpy(p, "%rep", 4); + p[len] = oldchar; + return line; + } else if (!nasm_stricmp(p, "locals")) { + tasm_locals = 1; + nasm_free(line); + return nasm_strdup(""); + } + + if (!oldchar) + return line; + + /* handle two-words directives */ + q = p + len + 1; + /* Skip whitespaces */ + while (isspace(*q) && *q) + q++; + + len2 = 0; + while (!isspace(q[len2]) && q[len2]!=',' && q[len2] != 0) + len2++; + oldchar2 = q[len2]; + q[len2] = '\0'; + + if (!nasm_stricmp(p, "irp")) { + /* handle indefinite repeat directive */ + const char *irp_format = + "%%imacro irp 0-*\n" + "%%rep %%0\n" + "%%define %s %%1\n"; + char **data; + + data = nasm_malloc(2*sizeof(char*)); + oldline = line; + line = nasm_malloc(strlen(irp_format) - 2 + len2 + 1); + sprintf(line,irp_format,q); + data[0] = nasm_strdup(q); + + if (!oldchar2) + error(ERR_FATAL, "%s: expected ", q + len2); + p = strchr(q + len2 + 1, '<'); + if (!p) + error(ERR_FATAL, "%s: expected ", q + len2); + p++; + q = strchr(p, '>'); + data[1] = nasm_strndup(p, q - p); + + end = nasm_malloc(sizeof(*end)); + end->type = TM_IRP; + end->next = EndmStack; + end->data = data; + EndmStack = end; + + nasm_free(oldline); + return line; + } else if (!nasm_stricmp(q, "macro")) { + char *name = p; + /* handle MACRO */ + /* count parameters */ + j = 1; + i = 0; + TMParameters = nasm_malloc(j*sizeof(*TMParameters)); + len = 0; + p = q + len2 + 1; + /* Skip whitespaces */ + while (isspace(*p) && *p) + p++; + while (*p) { + /* Get parameter name */ + for (q = p; !isspace(*q) && *q != ',' && *q; q++); + len2 = q-p; + if (len2 == 0) + error(ERR_FATAL, "'%s': expected parameter name", p); + TMParameters[i] = nasm_malloc(len2 + 1); + memcpy(TMParameters[i], p, len2); + TMParameters[i][len2] = '\0'; + len += len2; + i++; + if (i + 1 > j) { + j *= 2; + TMParameters = nasm_realloc(TMParameters, + j*sizeof(*TMParameters)); + } + if (i == 1000) + error(ERR_FATAL, "too many parameters for macro %s", name); + p = q; + while (isspace(*p) && *p) + p++; + if (!*p) + break; + if (*p != ',') + error(ERR_FATAL, "expected comma"); + p++; + while (isspace(*p) && *p) + p++; + } + TMParameters[i] = NULL; + TMParameters = nasm_realloc(TMParameters, + (i+1)*sizeof(*TMParameters)); + len += 1 + 6 + 1 + strlen(name) + 1 + 3; /* macro definition */ + len += i * (1 + 9 + 1 + 1 + 1 + 3 + 2); /* macro parameter definition */ + oldline = line; + p = line = nasm_malloc(len + 1); + p += sprintf(p, "%%imacro %s 0-*", name); + nasm_free(oldline); + for (j = 0; TMParameters[j]; j++) { + p += sprintf(p, "\n%%idefine %s %%{%-u}", TMParameters[j], j + 1); + } + end = nasm_malloc(sizeof(*end)); + end->type = TM_MACRO; + end->next = EndmStack; + end->data = TMParameters; + EndmStack = end; + return line; + } else if (!nasm_stricmp(q, "proc")) { + /* handle PROC */ + oldline = line; + line = nasm_malloc(2 + len + 1); + sprintf(line, "..%s",p); + nasm_free(oldline); + return line; + } else if (!nasm_stricmp(q, "struc")) { + /* handle struc */ + struct TStruc *struc; + if (inTstruc) { + error(ERR_FATAL, "STRUC: already in a struc context"); + return line; + } + oldline = line; + line = nasm_malloc(5 + 1 + len + 1); + sprintf(line, "struc %s", p); + struc = nasm_malloc(sizeof(*struc)); + struc->name = nasm_strdup(p); + struc->fields = NULL; + struc->lastField = NULL; + struc->next = TStrucs; + TStrucs = struc; + inTstruc = 1; + nasm_free(oldline); + end = nasm_malloc(sizeof(*end)); + end->type = TM_STRUC; + end->next = EndsStack; + EndsStack = end; + return line; + } else if (!nasm_stricmp(q, "segment")) { + /* handle SEGMENT */ + oldline = line; + line = nasm_strdup(oldchar2?q+len2+1:""); + if (tasm_segment) { + error(ERR_FATAL, "SEGMENT: already in a segment context"); + return line; + } + tasm_segment = nasm_strdup(p); + nasm_free(oldline); + end = nasm_malloc(sizeof(*end)); + end->type = TM_SEGMENT; + end->next = EndsStack; + EndsStack = end; + return line; + } else if (!nasm_stricmp(p, "ends") || !nasm_stricmp(q, "ends")) { + /* handle end of ends directive */ + end = EndsStack; + /* undef parameters */ + if (!end) { + error(ERR_FATAL, "ENDS: not in an ends context"); + return line; + } + EndsStack = EndsStack->next; + nasm_free(line); + switch (end->type) { + case TM_STRUC: + inTstruc = 0; + return nasm_strdup("endstruc"); + case TM_SEGMENT: + /* XXX: yes, we leak memory here, but that permits labels + * to avoid strduping... */ + tasm_segment = NULL; + return nasm_strdup(""); + default: + error(ERR_FATAL, "ENDS: bogus ends context type %d",end->type); + return NULL; + } + } else if (!nasm_stricmp(p, "endp") || !nasm_stricmp(q, "endp")) { + nasm_free(line); + return nasm_strdup(""); + } else if (!nasm_stricmp(p, "assume")) { + struct TSegmentAssume *assume; + /* handle ASSUME */ + if (!TAssumes) { + TAssumes = nasm_malloc(sizeof(*TAssumes)); + TAssumes[0].segreg = NULL; + } + i = 0; + q[len2] = oldchar2; + /* Skip whitespaces */ + while (isspace(*q) && *q) + q++; + while (*q && *q != ';') { + p = q; + for (; *q && *q != ';' && *q != ':' && !isspace(*q); q++); + if (!*q || *q == ';') + break; + /* segment register name */ + for (assume = TAssumes; assume->segreg; assume++) + if (strlen(assume->segreg) == (size_t)(q-p) && + !yasm__strncasecmp(assume->segreg, p, q-p)) + break; + if (!assume->segreg) { + i = assume - TAssumes + 1; + TAssumes = nasm_realloc(TAssumes, (i+1)*sizeof(*TAssumes)); + assume = TAssumes + i - 1; + assume->segreg = nasm_strndup(p, q-p); + assume[1].segreg = NULL; + } + for (; *q && *q != ';' && *q != ':' && isspace(*q); q++); + if (*q != ':') + error(ERR_FATAL, "expected `:' instead of `%c'", *q); + for (q++; *q && isspace(*q); q++); + + /* segment name */ + p = q; + for (; *q && *q != ';' && *q != ',' && !isspace(*q); q++); + assume->segment = nasm_strndup(p, q-p); + for (; *q && isspace(*q); q++); + if (*q && *q != ';' && *q != ',') + error(ERR_FATAL, "expected `,' instead of `%c'", *q); + + if (*q && *q != ';') + q++; + for (; *q && isspace(*q); q++); + } + TAssumes[i].segreg = NULL; + TAssumes = nasm_realloc(TAssumes, (i+1)*sizeof(*TAssumes)); + nasm_free(line); + return nasm_strdup(""); + } else if (inTstruc) { + struct TStrucField *field; + /* TODO: handle unnamed data */ + field = nasm_malloc(sizeof(*field)); + field->name = nasm_strdup(p); + /* TODO: type struc ! */ + field->type = nasm_strdup(q); + field->next = NULL; + if (!TStrucs->fields) + TStrucs->fields = field; + else if (TStrucs->lastField) + TStrucs->lastField->next = field; + TStrucs->lastField = field; + if (!oldchar2) { + error(ERR_FATAL, "Expected struc field initializer after %s %s", p, q); + return line; + } + oldline = line; + line = nasm_malloc(1 + len + 1 + len2 + 1 + strlen(q+len2+1) + 1); + sprintf(line, ".%s %s %s", p, q, q+len2+1); + nasm_free(oldline); + return line; + } + { + struct TStruc *struc; + for (struc = TStrucs; struc; struc = struc->next) { + if (!yasm__strcasecmp(q, struc->name)) { + char *r = q + len2 + 1, *s, *t, tasm_param[6]; + struct TStrucField *field = struc->fields; + int size, n; + if (!oldchar2) { + error(ERR_FATAL, "Expected struc field initializer after %s %s", p, q); + return line; } - else - { - memcpy(line + 1, p, len + 1); + r = strchr(r, '<'); + if (!r) { + error(ERR_FATAL, "Expected < for struc field initializer in %s %s %s", p, q, r); + return line; } + t = strchr(r + 1, '>'); + if (!t) { + error(ERR_FATAL, "Expected > for struc field initializer in %s %s %s", p, q, r); + return line; + } + *t = 0; + oldline = line; + size = len + len2 + 128; + line = nasm_malloc(size); + if (defining) + for (n=0;TMParameters[n];n++) + if (!strcmp(TMParameters[n],p)) { + sprintf(tasm_param,"%%{%d}",n+1); + p = tasm_param; + break; + } + n = sprintf(line, "%s: istruc %s\n", p, q); + /* use initialisers */ + while ((s = strchr(r + 1, ','))) { + if (!field) { + error(ERR_FATAL, "Too many initializers in structure %s %s", p, q); + return oldline; + } + *s = 0; + m = strlen(p) + 1 + strlen(field->name)*2 + 8 + + strlen(field->type) + 1 + strlen(r+1) + 2; + size += m; + line = nasm_realloc(line, size); + sprintf(line + n, "%s.%s: at .%s, %s %s\n", + p, field->name, field->name, field->type, r + 1); + n += m-1; + r = s; + field = field->next; + } + /* complete with last initializer and '?' */ + while(field) { + m = strlen(p) + 1 + strlen(field->name)*2 + 8 + + strlen(field->type) + 1 + (r ? strlen(r+1) : 1) + 2; + size += m; + line = nasm_realloc(line, size); + sprintf(line + n, "%s.%s: at .%s, %s %s\n", p, field->name, + field->name, field->type, r ? r + 1: "?"); + n += m-1; + r = NULL; + field = field->next; + } + line = nasm_realloc(line, n + 5); + sprintf(line + n, "iend"); nasm_free(oldline); return line; } - else if (m < 0) - { - j = k; - } - else - i = k; } - p[len] = oldchar; } + + q[len2] = oldchar2; + p[len] = oldchar; + return line; } +static Token * tasm_join_tokens(Token *tline) +{ + Token *t, *prev, *next; + for (prev = NULL, t = tline; t; prev = t, t = next) { + next = t->next; + if (t->type == TOK_OTHER && !strcmp(t->text,"&")) { + if (!prev) + error(ERR_FATAL, "no token before &"); + else if (!next) + error(ERR_FATAL, "no token after &"); + else if (prev->type != next->type) + error(ERR_FATAL, "can't handle different types of token around &"); + else if (!prev->text || !next->text) + error(ERR_FATAL, "can't handle empty token around &"); + else { + int lenp = strlen(prev->text); + int lenn = strlen(next->text); + prev->text = nasm_realloc(prev->text, lenp + lenn + 1); + strncpy(prev->text + lenp, next->text, lenn + 1); + (void) delete_Token(t); + prev->next = delete_Token(next); + t = prev; + next = t->next; + } + } + } + return tline; +} + /* * The pre-preprocessing stage... This function translates line * number indications as they emerge from GNU cpp (`# lineno "file" @@ -514,6 +1048,8 @@ prepreproc(char *line) int lineno; size_t fnlen; char *fname, *oldline; + char *c, *d, *ret; + Line *l, **lp; if (line[0] == '#' && line[1] == ' ') { @@ -529,8 +1065,30 @@ prepreproc(char *line) nasm_free(oldline); } if (tasm_compatible_mode) - return check_tasm_directive(line); - return line; + line = check_tasm_directive(line); + + if (!(c = strchr(line, '\n'))) + return line; + + /* Turn multiline macros into several lines */ + *c = '\0'; + ret = nasm_strdup(line); + + lp = &istk->expansion; + do { + d = strchr(c+1, '\n'); + if (d) + *d = '\0'; + l = nasm_malloc(sizeof(*l)); + l -> first = tokenise(c+1); + l -> finishes = NULL; + l -> next = *lp; + *lp = l; + c = d; + lp = &l -> next; + } while (c); + nasm_free(line); + return ret; } /* @@ -641,69 +1199,6 @@ read_line(void) char *buffer, *p, *q; int bufsize, continued_count; - Line *pd, *l; - Token *head, **tail, *t; - - /* Nasty hack for builtin defines */ - for (pd = builtindef; pd; pd = pd->next) - { - head = NULL; - tail = &head; - for (t = pd->first; t; t = t->next) - { - *tail = new_Token(NULL, t->type, t->text, 0); - tail = &(*tail)->next; - } - l = nasm_malloc(sizeof(Line)); - l->next = istk->expansion; - l->first = head; - l->finishes = FALSE; - istk->expansion = l; - } - - if (stdmacpos) - { - if (*stdmacpos) - { - char *ret = nasm_strdup(*stdmacpos++); - if (!*stdmacpos && any_extrastdmac) - { - stdmacpos = extrastdmac; - any_extrastdmac = FALSE; - return ret; - } - /* - * Nasty hack: here we push the contents of `predef' on - * to the top-level expansion stack, since this is the - * most convenient way to implement the pre-include and - * pre-define features. - */ - if (!*stdmacpos) - { - for (pd = predef; pd; pd = pd->next) - { - head = NULL; - tail = &head; - for (t = pd->first; t; t = t->next) - { - *tail = new_Token(NULL, t->type, t->text, 0); - tail = &(*tail)->next; - } - l = nasm_malloc(sizeof(Line)); - l->next = istk->expansion; - l->first = head; - l->finishes = FALSE; - istk->expansion = l; - } - } - return ret; - } - else - { - stdmacpos = NULL; - } - } - bufsize = BUF_DELTA; buffer = nasm_malloc(BUF_DELTA); p = buffer; @@ -1291,7 +1786,7 @@ static FILE * inc_fopen(char *file, char **newname) { FILE *fp; - char *combine = NULL; + char *combine = NULL, *c; char *pb, *p1, *p2, *file2 = NULL; /* Try to expand all %ENVVAR% in filename. Warn, and leave %string% @@ -1341,6 +1836,27 @@ inc_fopen(char *file, char **newname) fp = yasm_fopen_include(file2 ? file2 : file, nasm_src_get_fname(), "r", &combine); + if (!fp && tasm_compatible_mode) + { + char *thefile = file2 ? file2 : file; + /* try a few case combinations */ + do { + for (c = thefile; *c; c++) + *c = toupper(*c); + fp = yasm_fopen_include(thefile, nasm_src_get_fname(), "r", &combine); + if (fp) break; + *thefile = tolower(*thefile); + fp = yasm_fopen_include(thefile, nasm_src_get_fname(), "r", &combine); + if (fp) break; + for (c = thefile; *c; c++) + *c = tolower(*c); + fp = yasm_fopen_include(thefile, nasm_src_get_fname(), "r", &combine); + if (fp) break; + *thefile = toupper(*thefile); + fp = yasm_fopen_include(thefile, nasm_src_get_fname(), "r", &combine); + if (fp) break; + } while (0); + } if (!fp) error(ERR_FATAL, "unable to open include file `%s'", file2 ? file2 : file); @@ -1379,6 +1895,7 @@ smacro_defined(Context * ctx, char *name, int nparam, SMacro ** defn, int nocase) { SMacro *m; + int highest_level = -1; if (ctx) m = ctx->localmac; @@ -1396,8 +1913,9 @@ smacro_defined(Context * ctx, char *name, int nparam, SMacro ** defn, while (m) { if (!mstrcmp(m->name, name, m->casesense && nocase) && - (nparam <= 0 || m->nparam == 0 || nparam == m->nparam)) + (nparam <= 0 || m->nparam == 0 || nparam == m->nparam) && (highest_level < 0 || m->level > highest_level)) { + highest_level = m->level; if (defn) { if (nparam == m->nparam || nparam == -1) @@ -1405,12 +1923,11 @@ smacro_defined(Context * ctx, char *name, int nparam, SMacro ** defn, else *defn = NULL; } - return TRUE; } m = m->next; } - return FALSE; + return highest_level >= 0; } /* @@ -1732,7 +2249,10 @@ if_condition(Token * tline, int i) case PP_ELIFNUM: case PP_IFNNUM: case PP_ELIFNNUM: - j = (t->type == TOK_NUMBER); + while (tok_is_(t, "+") || tok_is_(t, "-") || + tok_type_(t, TOK_WHITESPACE)) + t = t->next; + j = (t && t->type == TOK_NUMBER); break; case PP_IFSTR: case PP_ELIFSTR: @@ -1793,6 +2313,9 @@ expand_macros_in_string(char **p) Token *line = tokenise(*p); line = expand_smacro(line); *p = detoken(line, FALSE); + do + line = delete_Token(line); + while (line); } /** @@ -2212,6 +2735,7 @@ do_directive(Token * tline) inc->next = istk; inc->conds = NULL; inc->fp = inc_fopen(p, &newname); + nasm_free(p); inc->fname = nasm_src_set_fname(newname); inc->lineno = nasm_src_set_linnum(0); inc->lineinc = 1; @@ -2276,7 +2800,70 @@ do_directive(Token * tline) free_tlist(origline); break; + case PP_SCOPE: + if (tline->next) + error(ERR_WARNING, "trailing garbage after `%%scope' ignored"); + Level++; + free_tlist(origline); + break; + + case PP_ENDSCOPE: + if (tline->next) + error(ERR_WARNING, "trailing garbage after `%%endscope' ignored"); + if (!Level) + error(ERR_NONFATAL, + "`%%endscope': already popped all levels"); + else + { + for (k = 0; k < NHASH; k++) + { + SMacro **smlast = &smacros[k]; + smac = smacros[k]; + while (smac) + { + if (smac->level < Level) + { + smlast = &smac->next; + smac = smac->next; + } + else + { + *smlast = smac->next; + nasm_free(smac->name); + free_tlist(smac->expansion); + nasm_free(smac); + smac = *smlast; + } + } + } + for (ctx = cstk; ctx; ctx = ctx->next) + { + SMacro **smlast = &ctx->localmac; + smac = ctx->localmac; + while (smac) + { + if (smac->level < Level) + { + smlast = &smac->next; + smac = smac->next; + } + else + { + *smlast = smac->next; + nasm_free(smac->name); + free_tlist(smac->expansion); + nasm_free(smac); + smac = *smlast; + } + } + } + Level--; + } + free_tlist(origline); + break; + case PP_ERROR: + case PP_WARNING: tline->next = expand_smacro(tline->next); tline = tline->next; skip_white_(tline); @@ -2285,7 +2872,7 @@ do_directive(Token * tline) p = tline->text + 1; /* point past the quote to the name */ p[strlen(p) - 1] = '\0'; /* remove the trailing quote */ expand_macros_in_string(&p); - error(ERR_NONFATAL, "%s", p); + error((i == PP_ERROR) ? ERR_NONFATAL : ERR_WARNING, "%s", p); nasm_free(p); } else @@ -2800,16 +3387,22 @@ do_directive(Token * tline) free_tlist(macro_start); return DIRECTIVE_FOUND; } - else + else if (smac->level == Level) { /* - * We're redefining, so we have to take over an - * existing SMacro structure. This means freeing - * what was already in it. + * We're redefining in the same level, so we have to + * take over an existing SMacro structure. This means + * freeing what was already in it. */ nasm_free(smac->name); free_tlist(smac->expansion); } + else + { + smac = nasm_malloc(sizeof(SMacro)); + smac->next = *smhead; + *smhead = smac; + } } else { @@ -2820,6 +3413,7 @@ do_directive(Token * tline) smac->name = nasm_strdup(mname); smac->casesense = ((i == PP_DEFINE) || (i == PP_XDEFINE)); smac->nparam = nparam; + smac->level = Level; smac->expansion = macro_start; smac->in_progress = FALSE; free_tlist(origline); @@ -2944,6 +3538,7 @@ do_directive(Token * tline) smac->name = nasm_strdup(mname); smac->casesense = (i == PP_STRLEN); smac->nparam = 0; + smac->level = 0; smac->expansion = macro_start; smac->in_progress = FALSE; free_tlist(tline); @@ -3054,6 +3649,7 @@ do_directive(Token * tline) smac->name = nasm_strdup(mname); smac->casesense = (i == PP_SUBSTR); smac->nparam = 0; + smac->level = 0; smac->expansion = macro_start; smac->in_progress = FALSE; free_tlist(tline); @@ -3149,6 +3745,7 @@ do_directive(Token * tline) smac->name = nasm_strdup(mname); smac->casesense = (i == PP_ASSIGN); smac->nparam = 0; + smac->level = 0; smac->expansion = macro_start; smac->in_progress = FALSE; free_tlist(origline); @@ -3269,105 +3866,51 @@ expand_mmac_params(Token * tline) char *text = NULL; int type = 0, cc; /* type = 0 to placate optimisers */ char tmpbuf[30]; + char *second_text = NULL; int n, i; MMacro *mac; t = tline; tline = tline->next; + second_text = strchr(t->text, ':'); + mac = istk->mstk; while (mac && !mac->name) /* avoid mistaking %reps for macros */ mac = mac->next_active; if (!mac) error(ERR_NONFATAL, "`%s': not in a macro call", t->text); else - switch (t->text[1]) + { + if (second_text) { - /* - * We have to make a substitution of one of the - * forms %1, %-1, %+1, %%foo, %0. - */ - case '0': - type = TOK_NUMBER; - sprintf(tmpbuf, "%ld", mac->nparam); - text = nasm_strdup(tmpbuf); - break; - case '%': - type = TOK_ID; - sprintf(tmpbuf, "..@%lu.", mac->unique); - text = nasm_strcat(tmpbuf, t->text + 2); - break; - case '-': - n = atoi(t->text + 2) - 1; - if (n >= mac->nparam) + int end = atoi(second_text+1)-1; + int is_fst = 1; + int k; + n = atoi(t->text + 1)-1; + if (end < 0) + end += mac->nparam; + + for (k = n; k <= end; k++) + { + if (k >= mac->nparam) tt = NULL; else { if (mac->nparam > 1) - n = (n + mac->rotate) % mac->nparam; - tt = mac->params[n]; - } - cc = find_cc(tt); - if (cc == -1) - { - error(ERR_NONFATAL, - "macro parameter %d is not a condition code", - n + 1); - text = NULL; - } - else - { - type = TOK_ID; - if (inverse_ccs[cc] == -1) - { - error(ERR_NONFATAL, - "condition code `%s' is not invertible", - conditions[cc]); - text = NULL; - } - else - text = - nasm_strdup(conditions[inverse_ccs - [cc]]); - } - break; - case '+': - n = atoi(t->text + 2) - 1; - if (n >= mac->nparam) - tt = NULL; - else - { - if (mac->nparam > 1) - n = (n + mac->rotate) % mac->nparam; - tt = mac->params[n]; - } - cc = find_cc(tt); - if (cc == -1) - { - error(ERR_NONFATAL, - "macro parameter %d is not a condition code", - n + 1); - text = NULL; - } - else - { - type = TOK_ID; - text = nasm_strdup(conditions[cc]); - } - break; - default: - n = atoi(t->text + 1) - 1; - if (n >= mac->nparam) - tt = NULL; - else - { - if (mac->nparam > 1) - n = (n + mac->rotate) % mac->nparam; - tt = mac->params[n]; + k = (k + mac->rotate) % mac->nparam; + tt = mac->params[k]; } if (tt) { - for (i = 0; i < mac->paramlen[n]; i++) + if (!is_fst && mac->paramlen[k]) + { + *tail = new_Token(NULL, TOK_OTHER, ",", 0); + tail = &(*tail)->next; + } + if (mac->paramlen[k]) + is_fst = 0; + for (i = 0; i < mac->paramlen[k]; i++) { *tail = new_Token(NULL, tt->type, tt->text, @@ -3377,8 +3920,131 @@ expand_mmac_params(Token * tline) } } text = NULL; /* we've done it here */ - break; + } } + else + { + switch (t->text[1]) + { + /* + * We have to make a substitution of one of the + * forms %1, %-1, %+1, %%foo, %0. + */ + case '0': + type = TOK_NUMBER; + sprintf(tmpbuf, "%ld", mac->nparam); + text = nasm_strdup(tmpbuf); + break; + case '%': + type = TOK_ID; + sprintf(tmpbuf, "..@%lu.", mac->unique); + text = nasm_strcat(tmpbuf, t->text + 2); + break; + case '-': + n = atoi(t->text + 2) - 1; + if (n >= mac->nparam) + tt = NULL; + else + { + if (mac->nparam > 1) + n = (n + mac->rotate) % mac->nparam; + tt = mac->params[n]; + } + if (!tt) + { + error(ERR_NONFATAL, + "macro parameter %d is not a condition code", + n + 1); + text = NULL; + } + else + { + cc = find_cc(tt); + if (cc == -1) + { + error(ERR_NONFATAL, + "macro parameter %d is not a condition code", + n + 1); + text = NULL; + } + else + { + type = TOK_ID; + if (inverse_ccs[cc] == -1) + { + error(ERR_NONFATAL, + "condition code `%s' is not invertible", + conditions[cc]); + text = NULL; + } + else + text = + nasm_strdup(conditions[inverse_ccs + [cc]]); + } + } + break; + case '+': + n = atoi(t->text + 2) - 1; + if (n >= mac->nparam) + tt = NULL; + else + { + if (mac->nparam > 1) + n = (n + mac->rotate) % mac->nparam; + tt = mac->params[n]; + } + if (!tt) + { + error(ERR_NONFATAL, + "macro parameter %d is not a condition code", + n + 1); + text = NULL; + } + else + { + cc = find_cc(tt); + if (cc == -1) + { + error(ERR_NONFATAL, + "macro parameter %d is not a condition code", + n + 1); + text = NULL; + } + else + { + type = TOK_ID; + text = nasm_strdup(conditions[cc]); + } + } + break; + default: + n = atoi(t->text + 1) - 1; + if (n >= mac->nparam) + tt = NULL; + else + { + if (mac->nparam > 1) + n = (n + mac->rotate) % mac->nparam; + tt = mac->params[n]; + } + if (tt) + { + for (i = 0; i < mac->paramlen[n]; i++) + { + *tail = + new_Token(NULL, tt->type, tt->text, + 0); + tail = &(*tail)->next; + tt = tt->next; + } + } + text = NULL; /* we've done it here */ + break; + } + } + } + if (!text) { delete_Token(t); @@ -4159,8 +4825,8 @@ expand_mmacro(Token * tline) } /* - * Since preprocessor always operate only on the line that didn't - * arrived yet, we should always use ERR_OFFBY1. Also since user + * Since preprocessor always operates only on the line that didn't + * arrive yet, we should always use ERR_OFFBY1. Also since user * won't want to see same error twice (preprocessing is done once * per pass) we will want to show errors only during pass one. */ @@ -4175,7 +4841,11 @@ error(int severity, const char *fmt, ...) return; va_start(arg, fmt); +#ifdef HAVE_VSNPRINTF + vsnprintf(buff, sizeof(buff), fmt, arg); +#else vsprintf(buff, fmt, arg); +#endif va_end(arg); if (istk && istk->mstk && istk->mstk->name) @@ -4213,15 +4883,42 @@ pp_reset(FILE *f, const char *file, int apass, efunc errfunc, evalfunc eval, smacros[h] = NULL; } unique = 0; - if (tasm_compatible_mode) { - stdmacpos = stdmac; - } else { - stdmacpos = &stdmac[TASM_MACRO_COUNT]; - } - any_extrastdmac = (extrastdmac != NULL); + if (tasm_compatible_mode) { + pp_extra_stdmac(tasm_compat_macros); + } list = listgen; evaluate = eval; pass = apass; + first_line = 1; +} + +/* + * Nasty hack: here we push the contents of `predef' on + * to the top-level expansion stack, since this is the + * most convenient way to implement the pre-include and + * pre-define features. + */ +static void +poke_predef(Line *predef_lines) +{ + Line *pd, *l; + Token *head, **tail, *t; + + for (pd = predef_lines; pd; pd = pd->next) + { + head = NULL; + tail = &head; + for (t = pd->first; t; t = t->next) + { + *tail = new_Token(NULL, t->type, t->text, 0); + tail = &(*tail)->next; + } + l = nasm_malloc(sizeof(Line)); + l->next = istk->expansion; + l->first = head; + l->finishes = FALSE; + istk->expansion = l; + } } static char * @@ -4237,6 +4934,18 @@ pp_getline(void) * buffer or from the input file. */ tline = NULL; + + if (first_line) + { + /* Reverse order */ + poke_predef(predef); + poke_predef(stddef); + poke_predef(builtindef); + first_line = 0; + } + + if (!istk) + return NULL; while (istk->expansion && istk->expansion->finishes) { Line *l = istk->expansion; @@ -4367,6 +5076,7 @@ pp_getline(void) } istk = i->next; list->downlevel(LIST_INCLUDE); + nasm_free(i->fname); nasm_free(i); if (!istk) return NULL; @@ -4441,6 +5151,9 @@ pp_getline(void) /* * De-tokenise the line again, and emit it. */ + if (tasm_compatible_mode) + tline = tasm_join_tokens(tline); + line = detoken(tline, TRUE); free_tlist(tline); break; @@ -4460,11 +5173,15 @@ pp_cleanup(int pass_) { int h; - if (defining) + if (pass_ == 1) { - error(ERR_NONFATAL, "end of file while still defining macro `%s'", - defining->name); - free_mmacro(defining); + if (defining) + { + error(ERR_NONFATAL, "end of file while still defining macro `%s'", + defining->name); + free_mmacro(defining); + } + return; } while (cstk) ctx_pop(); @@ -4499,8 +5216,15 @@ pp_cleanup(int pass_) if (pass_ == 0) { free_llist(builtindef); + free_llist(stddef); free_llist(predef); + builtindef = NULL; + stddef = NULL; + predef = NULL; + freeTokens = NULL; delete_Blocks(); + blocks.next = NULL; + blocks.chunk = NULL; } } @@ -4587,7 +5311,24 @@ pp_builtin_define(char *definition) void pp_extra_stdmac(const char **macros) { - extrastdmac = macros; + const char **lp; + + for (lp=macros; *lp; lp++) + { + char *macro; + Token *t; + Line *l; + + macro = nasm_strdup(*lp); + t = tokenise(macro); + nasm_free(macro); + + l = nasm_malloc(sizeof(Line)); + l->next = stddef; + l->first = t; + l->finishes = FALSE; + stddef = l; + } } static void @@ -4595,6 +5336,7 @@ make_tok_num(Token * tok, yasm_intnum *val) { tok->text = yasm_intnum_get_str(val); tok->type = TOK_NUMBER; + yasm_intnum_destroy(val); } Preproc nasmpp = { diff --git a/modules/preprocs/nasm/nasm-preproc.c b/modules/preprocs/nasm/nasm-preproc.c index 58f5a2f5..75e60157 100644 --- a/modules/preprocs/nasm/nasm-preproc.c +++ b/modules/preprocs/nasm/nasm-preproc.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "nasm.h" @@ -39,15 +37,19 @@ typedef struct yasm_preproc_nasm { yasm_preproc_base preproc; /* Base structure */ FILE *in; - char *line, *linepos; - size_t lineleft; + char *line; char *file_name; long prior_linnum; int lineinc; } yasm_preproc_nasm; +yasm_symtab *nasm_symtab; static yasm_linemap *cur_lm; static yasm_errwarns *cur_errwarns; int tasm_compatible_mode = 0; +int tasm_locals; +const char *tasm_segment; + +#include "nasm-version.c" typedef struct preproc_dep { STAILQ_ENTRY(preproc_dep) link; @@ -129,17 +131,28 @@ nasm_efunc(int severity, const char *fmt, ...) } static yasm_preproc * -nasm_preproc_create(FILE *f, const char *in_filename, yasm_linemap *lm, - yasm_errwarns *errwarns) +nasm_preproc_create(const char *in_filename, yasm_symtab *symtab, + yasm_linemap *lm, yasm_errwarns *errwarns) { + FILE *f; yasm_preproc_nasm *preproc_nasm = yasm_xmalloc(sizeof(yasm_preproc_nasm)); preproc_nasm->preproc.module = &yasm_nasm_LTX_preproc; + if (strcmp(in_filename, "-") != 0) { + f = fopen(in_filename, "r"); + if (!f) + yasm__fatal( N_("Could not open input file") ); + } + else + f = stdin; + preproc_nasm->in = f; + nasm_symtab = symtab; cur_lm = lm; cur_errwarns = errwarns; - preproc_deps = NULL; + preproc_deps = yasm_xmalloc(sizeof(struct preproc_dep_head)); + STAILQ_INIT(preproc_deps); done_dep_preproc = 0; preproc_nasm->line = NULL; preproc_nasm->file_name = NULL; @@ -147,6 +160,8 @@ nasm_preproc_create(FILE *f, const char *in_filename, yasm_linemap *lm, preproc_nasm->lineinc = 0; nasmpp.reset(f, in_filename, 2, nasm_efunc, nasm_evaluate, &nil_list); + pp_extra_stdmac(nasm_version_mac); + return (yasm_preproc *)preproc_nasm; } @@ -155,61 +170,56 @@ nasm_preproc_destroy(yasm_preproc *preproc) { yasm_preproc_nasm *preproc_nasm = (yasm_preproc_nasm *)preproc; nasmpp.cleanup(0); + if (preproc_nasm->line) + yasm_xfree(preproc_nasm->line); if (preproc_nasm->file_name) yasm_xfree(preproc_nasm->file_name); + if (preproc_nasm->in) + fclose(preproc_nasm->in); yasm_xfree(preproc); - if (preproc_deps) - yasm_xfree(preproc_deps); + while (!STAILQ_EMPTY(preproc_deps)) { + preproc_dep *dep = STAILQ_FIRST(preproc_deps); + STAILQ_REMOVE_HEAD(preproc_deps, link); + yasm_xfree(dep->name); + yasm_xfree(dep); + } + yasm_xfree(nasm_src_set_fname(NULL)); } -static size_t -nasm_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size) +static char * +nasm_preproc_get_line(yasm_preproc *preproc) { yasm_preproc_nasm *preproc_nasm = (yasm_preproc_nasm *)preproc; - size_t tot = 0, n; - long linnum = preproc_nasm->prior_linnum += preproc_nasm->lineinc; + long linnum; int altline; + char *line; - if (!preproc_nasm->line) { - preproc_nasm->line = nasmpp.getline(); - if (!preproc_nasm->line) - return 0; - preproc_nasm->linepos = preproc_nasm->line; - preproc_nasm->lineleft = strlen(preproc_nasm->line) + 1; - preproc_nasm->line[preproc_nasm->lineleft-1] = '\n'; - - altline = nasm_src_get(&linnum, &preproc_nasm->file_name); - if (altline) { - if (altline == 1 && preproc_nasm->lineinc == 1) { - *buf++ = '\n'; - max_size--; - tot++; - } else { - preproc_nasm->lineinc = - (altline != -1 || preproc_nasm->lineinc != 1); - n = sprintf(buf, "%%line %ld+%d %s\n", linnum, - preproc_nasm->lineinc, preproc_nasm->file_name); - buf += n; - max_size -= n; - tot += n; - } - preproc_nasm->prior_linnum = linnum; - } - } - - n = preproc_nasm->lineleftlineleft:max_size; - strncpy(buf, preproc_nasm->linepos, n); - tot += n; - - if (n == preproc_nasm->lineleft) { - yasm_xfree(preproc_nasm->line); + if (preproc_nasm->line) { + char *retval = preproc_nasm->line; preproc_nasm->line = NULL; - } else { - preproc_nasm->lineleft -= n; - preproc_nasm->linepos += n; + return retval; } - return tot; + line = nasmpp.getline(); + if (!line) + { + nasmpp.cleanup(1); + return NULL; /* EOF */ + } + + linnum = preproc_nasm->prior_linnum += preproc_nasm->lineinc; + altline = nasm_src_get(&linnum, &preproc_nasm->file_name); + if (altline != 0) { + preproc_nasm->lineinc = + (altline != -1 || preproc_nasm->lineinc != 1); + preproc_nasm->line = line; + line = yasm_xmalloc(40+strlen(preproc_nasm->file_name)); + sprintf(line, "%%line %ld+%d %s", linnum, + preproc_nasm->lineinc, preproc_nasm->file_name); + preproc_nasm->prior_linnum = linnum; + } + + return line; } void @@ -217,10 +227,6 @@ nasm_preproc_add_dep(char *name) { preproc_dep *dep; - /* If not processing dependencies, simply return */ - if (!preproc_deps) - return; - /* Save in preproc_deps */ dep = yasm_xmalloc(sizeof(preproc_dep)); dep->name = yasm__xstrdup(name); @@ -231,11 +237,6 @@ static size_t nasm_preproc_get_included_file(yasm_preproc *preproc, /*@out@*/ char *buf, size_t max_size) { - if (!preproc_deps) { - preproc_deps = yasm_xmalloc(sizeof(struct preproc_dep_head)); - STAILQ_INIT(preproc_deps); - } - for (;;) { char *line; @@ -296,16 +297,45 @@ nasm_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval) yasm_xfree(mnv); } +static void +nasm_preproc_add_standard(yasm_preproc *preproc, const char **macros) +{ + pp_extra_stdmac(macros); +} + /* Define preproc structure -- see preproc.h for details */ yasm_preproc_module yasm_nasm_LTX_preproc = { "Real NASM Preprocessor", "nasm", nasm_preproc_create, nasm_preproc_destroy, - nasm_preproc_input, + nasm_preproc_get_line, nasm_preproc_get_included_file, nasm_preproc_add_include_file, nasm_preproc_predefine_macro, nasm_preproc_undefine_macro, - nasm_preproc_define_builtin + nasm_preproc_define_builtin, + nasm_preproc_add_standard +}; + +static yasm_preproc * +tasm_preproc_create(const char *in_filename, yasm_symtab *symtab, + yasm_linemap *lm, yasm_errwarns *errwarns) +{ + tasm_compatible_mode = 1; + return nasm_preproc_create(in_filename, symtab, lm, errwarns); +} + +yasm_preproc_module yasm_tasm_LTX_preproc = { + "Real TASM Preprocessor", + "tasm", + tasm_preproc_create, + nasm_preproc_destroy, + nasm_preproc_get_line, + nasm_preproc_get_included_file, + nasm_preproc_add_include_file, + nasm_preproc_predefine_macro, + nasm_preproc_undefine_macro, + nasm_preproc_define_builtin, + nasm_preproc_add_standard }; diff --git a/modules/preprocs/nasm/nasm.h b/modules/preprocs/nasm/nasm.h index 792877b0..b3382ffe 100644 --- a/modules/preprocs/nasm/nasm.h +++ b/modules/preprocs/nasm/nasm.h @@ -276,5 +276,8 @@ enum { #define elements(x) ( sizeof(x) / sizeof(*(x)) ) extern int tasm_compatible_mode; +extern int tasm_locals; +extern const char *tasm_segment; +const char *tasm_get_segment_register(const char *segment); #endif diff --git a/modules/preprocs/nasm/standard.mac b/modules/preprocs/nasm/standard.mac deleted file mode 100644 index 6d285d9e..00000000 --- a/modules/preprocs/nasm/standard.mac +++ /dev/null @@ -1,285 +0,0 @@ -; Standard macro set for NASM -*- nasm -*- - -; Macros to make NASM ignore some TASM directives before the first include -; directive. - - %idefine IDEAL - %idefine JUMPS - %idefine P386 - %idefine P486 - %idefine P586 - %idefine END - -; This is a magic token which indicates the end of the TASM macros -*END*TASM*MACROS* - -; Note that although some user-level forms of directives are defined -; here, not all of them are: the user-level form of a format-specific -; directive should be defined in the module for that directive. - -; These two need to be defined, though the actual definitions will -; be constantly updated during preprocessing. -%define __FILE__ -%define __LINE__ - -%define __SECT__ [section .text] ; it ought to be defined, even if as nothing - -%imacro section 1+.nolist -%define __SECT__ [section %1] - __SECT__ -%endmacro -%imacro segment 1+.nolist -%define __SECT__ [segment %1] - __SECT__ -%endmacro - -%imacro absolute 1+.nolist -%define __SECT__ [absolute %1] - __SECT__ -%endmacro - -%imacro struc 1.nolist -%push struc -%define %$strucname %1 -[absolute 0] -%$strucname: ; allow definition of `.member' to work sanely -%endmacro -%imacro endstruc 0.nolist -%{$strucname}_size: -%pop -__SECT__ -%endmacro - -%imacro istruc 1.nolist -%push istruc -%define %$strucname %1 -%$strucstart: -%endmacro -%imacro at 1-2+.nolist - times %1-($-%$strucstart) db 0 - %2 -%endmacro -%imacro iend 0.nolist - times %{$strucname}_size-($-%$strucstart) db 0 -%pop -%endmacro - -%imacro align 1-2+.nolist nop -%ifidni %2,nop - [align %1] -%else - times ($$-$) & ((%1)-1) %2 -%endif -%endmacro -%imacro alignb 1-2+.nolist resb 1 - times ($$-$) & ((%1)-1) %2 -%endmacro - -%imacro extern 1-*.nolist -%rep %0 -[extern %1] -%rotate 1 -%endrep -%endmacro - -%imacro bits 1+.nolist -[bits %1] -%endmacro - -%imacro use16 0.nolist -[bits 16] -%endmacro -%imacro use32 0.nolist -[bits 32] -%endmacro -%imacro use64 0.nolist -[bits 64] -%endmacro - -%imacro global 1-*.nolist -%rep %0 -[global %1] -%rotate 1 -%endrep -%endmacro - -%imacro common 1-*.nolist -%rep %0 -[common %1] -%rotate 1 -%endrep -%endmacro - -%imacro cpu 1+.nolist -[cpu %1] -%endmacro - -; NASM compatibility shim -%define __OUTPUT_FORMAT__ __YASM_OBJFMT__ - -%ifidn __YASM_OBJFMT__,bin -%imacro org 1+.nolist -[org %1] -%endmacro -%endif - -%ifidn __YASM_OBJFMT__,win32 -%imacro export 1+.nolist -[export %1] -%endmacro -%endif - -%ifidn __YASM_OBJFMT__,win64 -%define __YASM_WIN64__ -%endif - -%ifidn __YASM_OBJFMT__,x64 -%define __YASM_WIN64__ -%endif - -%ifdef __YASM_WIN64__ -%undef __YASM_WIN64__ - -%imacro export 1+.nolist -[export %1] -%endmacro - -; Raw exception handling operations -%imacro proc_frame 1+.nolist -%1: -[proc_frame %1] -%endmacro - -%if 0 -; Disable these as they're too closely named to the macroized ones. -; MASM needs a preceding . to use these, so it seems reasonable for -; us to similarly require the []. -%imacro pushreg 1.nolist -[pushreg %1] -%endmacro - -%imacro setframe 1-2.nolist -[setframe %1 %2] -%endmacro - -%imacro allocstack 1.nolist -[allocstack %1] -%endmacro - -%imacro savereg 2.nolist -[savereg %1 %2] -%endmacro - -%imacro savexmm128 2.nolist -[savexmm128 %1 %2] -%endmacro - -%imacro pushframe 0-1.nolist -[pushframe %1] -%endmacro - -%imacro endprolog 0.nolist -[endprolog] -%endmacro -%endif - -%imacro endproc_frame 0.nolist -[endproc_frame] -%endmacro - -; Complex (macro) exception handling operations -; Mimics many macros provided by MASM's macamd64.inc -%imacro push_reg 1 -push %1 -[pushreg %1] -%endmacro - -%imacro rex_push_reg 1 -db 0x48 -push %1 -[pushreg %1] -%endmacro - -%imacro push_eflags 0 -pushfq -[allocstack 8] -%endmacro - -%imacro rex_push_eflags 0 -db 0x48 -pushfq -[allocstack 8] -%endmacro - -%imacro alloc_stack 1 -sub rsp, %1 -[allocstack %1] -%endmacro - -%imacro save_reg 2 -mov [rsp+%2], %1 -[savereg %1 %2] -%endmacro - -%imacro save_xmm128 2 -movdqa [rsp+%2], %1 -[savexmm128 %1 %2] -%endmacro - -%imacro push_frame 0-1.nolist -[pushframe %1] -%endmacro - -%imacro set_frame 1-2 -%if %0==1 -mov %1, rsp -%else -lea %1, [rsp+%2] -%endif -[setframe %1 %2] -%endmacro - -%imacro end_prolog 0.nolist -[endprolog] -%endmacro - -%imacro end_prologue 0.nolist -[endprolog] -%endmacro - -%endif - -%ifidn __YASM_OBJFMT__,elf -%define __YASM_ELF__ -%endif - -%ifidn __YASM_OBJFMT__,elf32 -%define __YASM_ELF__ -%endif - -%ifidn __YASM_OBJFMT__,elf64 -%define __YASM_ELF__ -%endif - -%ifdef __YASM_ELF__ -%undef __YASM_ELF__ -%imacro type 1+.nolist -[type %1] -%endmacro -%imacro size 1+.nolist -[size %1] -%endmacro -%imacro weak 1+.nolist -[weak %1] -%endmacro -%endif - -%ifidn __YASM_OBJFMT__,rdf -%imacro library 1+.nolist -[library %1] -%endmacro -%imacro module 1+.nolist -[module %1] -%endmacro -%endif - diff --git a/modules/preprocs/nasm/tests/Makefile.inc b/modules/preprocs/nasm/tests/Makefile.inc index 6d7dcfb5..3a6a8b60 100644 --- a/modules/preprocs/nasm/tests/Makefile.inc +++ b/modules/preprocs/nasm/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - TESTS += modules/preprocs/nasm/tests/nasmpp_test.sh EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp_test.sh @@ -9,14 +7,20 @@ EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.asm EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/longline.asm EXTRA_DIST += modules/preprocs/nasm/tests/longline.hex +EXTRA_DIST += modules/preprocs/nasm/tests/macroeof-err.asm +EXTRA_DIST += modules/preprocs/nasm/tests/macroeof-err.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.asm EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.asm EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.hex EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-decimal.asm EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-decimal.hex +EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-invalidcc.asm +EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-invalidcc.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-nested.asm EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-nested.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-nested.hex EXTRA_DIST += modules/preprocs/nasm/tests/orgsect.asm EXTRA_DIST += modules/preprocs/nasm/tests/orgsect.hex +EXTRA_DIST += modules/preprocs/nasm/tests/scope-err.asm +EXTRA_DIST += modules/preprocs/nasm/tests/scope-err.errwarn diff --git a/modules/preprocs/nasm/tests/ifcritical-err.errwarn b/modules/preprocs/nasm/tests/ifcritical-err.errwarn index 9c617cf7..73ca327c 100644 --- a/modules/preprocs/nasm/tests/ifcritical-err.errwarn +++ b/modules/preprocs/nasm/tests/ifcritical-err.errwarn @@ -1 +1 @@ --:5: cannot reference symbol `teststringlen' in preprocessor +-:5: error: non-constant value given to `%if' diff --git a/modules/preprocs/nasm/tests/macroeof-err.asm b/modules/preprocs/nasm/tests/macroeof-err.asm new file mode 100644 index 00000000..dd51488b --- /dev/null +++ b/modules/preprocs/nasm/tests/macroeof-err.asm @@ -0,0 +1 @@ +%macro foo 0 diff --git a/modules/preprocs/nasm/tests/macroeof-err.errwarn b/modules/preprocs/nasm/tests/macroeof-err.errwarn new file mode 100644 index 00000000..c92f71e4 --- /dev/null +++ b/modules/preprocs/nasm/tests/macroeof-err.errwarn @@ -0,0 +1 @@ +-:1: error: end of file while still defining macro `foo' diff --git a/modules/preprocs/nasm/tests/nasmpp-invalidcc.asm b/modules/preprocs/nasm/tests/nasmpp-invalidcc.asm new file mode 100644 index 00000000..989fc3c8 --- /dev/null +++ b/modules/preprocs/nasm/tests/nasmpp-invalidcc.asm @@ -0,0 +1,9 @@ +%macro ret_if_cc 1-* + j%+2 %%skip + ret + j%-2 %%skip + ret + %%skip: +%endmacro + +ret_if_cc ne diff --git a/modules/preprocs/nasm/tests/nasmpp-invalidcc.errwarn b/modules/preprocs/nasm/tests/nasmpp-invalidcc.errwarn new file mode 100644 index 00000000..37670af2 --- /dev/null +++ b/modules/preprocs/nasm/tests/nasmpp-invalidcc.errwarn @@ -0,0 +1,4 @@ +-:9: error: (ret_if_cc:1) macro parameter 2 is not a condition code +-:9: error: instruction expected after label +-:9: error: (ret_if_cc:3) macro parameter 2 is not a condition code +-:9: error: instruction expected after label diff --git a/modules/preprocs/nasm/tests/nasmpp-nested.errwarn b/modules/preprocs/nasm/tests/nasmpp-nested.errwarn index 4df49285..31839e33 100644 --- a/modules/preprocs/nasm/tests/nasmpp-nested.errwarn +++ b/modules/preprocs/nasm/tests/nasmpp-nested.errwarn @@ -1,3 +1,3 @@ --:27: warning: (WORK_1:4) 4 --:28: warning: (WORK_2:4) 4 --:29: warning: (DONT_WORK_1:6) 4 4 +-:27: warning: (WORK_1:2) 4 +-:28: warning: (WORK_2:2) 4 +-:29: warning: (DONT_WORK_1:3) 4 4 diff --git a/modules/preprocs/nasm/tests/nasmpp_test.sh b/modules/preprocs/nasm/tests/nasmpp_test.sh index e8e07081..c55c4204 100755 --- a/modules/preprocs/nasm/tests/nasmpp_test.sh +++ b/modules/preprocs/nasm/tests/nasmpp_test.sh @@ -1,4 +1,3 @@ #! /bin/sh -# $Id$ ${srcdir}/out_test.sh nasmpp_test modules/preprocs/nasm/tests "nasm preproc" "-f bin" "" exit $? diff --git a/modules/preprocs/nasm/tests/scope-err.asm b/modules/preprocs/nasm/tests/scope-err.asm new file mode 100644 index 00000000..0359532f --- /dev/null +++ b/modules/preprocs/nasm/tests/scope-err.asm @@ -0,0 +1,13 @@ +%define a b +%error a +%scope +%define a c +%error a +%scope +%define a d +%error a +%endscope +%error a +%endscope +%error a +%endscope diff --git a/modules/preprocs/nasm/tests/scope-err.errwarn b/modules/preprocs/nasm/tests/scope-err.errwarn new file mode 100644 index 00000000..32cea76c --- /dev/null +++ b/modules/preprocs/nasm/tests/scope-err.errwarn @@ -0,0 +1,6 @@ +-:2: warning: b +-:5: warning: c +-:8: warning: d +-:10: warning: c +-:12: warning: b +-:13: error: `%endscope': already popped all levels diff --git a/modules/preprocs/raw/CMakeLists.txt b/modules/preprocs/raw/CMakeLists.txt new file mode 100644 index 00000000..fc345386 --- /dev/null +++ b/modules/preprocs/raw/CMakeLists.txt @@ -0,0 +1,3 @@ +YASM_ADD_MODULE(preproc_raw + preprocs/raw/raw-preproc.c + ) diff --git a/modules/preprocs/raw/Makefile.inc b/modules/preprocs/raw/Makefile.inc index ad3ae673..5756ca91 100644 --- a/modules/preprocs/raw/Makefile.inc +++ b/modules/preprocs/raw/Makefile.inc @@ -1,5 +1,7 @@ -# $Id$ - libyasm_a_SOURCES += modules/preprocs/raw/raw-preproc.c YASM_MODULES += preproc_raw + +EXTRA_DIST += modules/preprocs/raw/tests/Makefile.inc + +include modules/preprocs/raw/tests/Makefile.inc diff --git a/modules/preprocs/raw/raw-preproc.c b/modules/preprocs/raw/raw-preproc.c index f58856c3..15fd7836 100644 --- a/modules/preprocs/raw/raw-preproc.c +++ b/modules/preprocs/raw/raw-preproc.c @@ -25,16 +25,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include +#define BSIZE 512 + typedef struct yasm_preproc_raw { yasm_preproc_base preproc; /* base structure */ - int is_interactive; FILE *in; yasm_linemap *cur_lm; yasm_errwarns *errwarns; @@ -42,21 +41,25 @@ typedef struct yasm_preproc_raw { yasm_preproc_module yasm_raw_LTX_preproc; -int isatty(int); - static yasm_preproc * -raw_preproc_create(FILE *f, const char *in_filename, yasm_linemap *lm, - yasm_errwarns *errwarns) +raw_preproc_create(const char *in_filename, yasm_symtab *symtab, + yasm_linemap *lm, yasm_errwarns *errwarns) { + FILE *f; yasm_preproc_raw *preproc_raw = yasm_xmalloc(sizeof(yasm_preproc_raw)); + if (strcmp(in_filename, "-") != 0) { + f = fopen(in_filename, "r"); + if (!f) + yasm__fatal( N_("Could not open input file") ); + } + else + f = stdin; + preproc_raw->preproc.module = &yasm_raw_LTX_preproc; preproc_raw->in = f; preproc_raw->cur_lm = lm; preproc_raw->errwarns = errwarns; - /*@-unrecog@*/ - preproc_raw->is_interactive = f ? (isatty(fileno(f)) > 0) : 0; - /*@=unrecog@*/ return (yasm_preproc *)preproc_raw; } @@ -67,32 +70,48 @@ raw_preproc_destroy(yasm_preproc *preproc) yasm_xfree(preproc); } -static size_t -raw_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size) +static char * +raw_preproc_get_line(yasm_preproc *preproc) { yasm_preproc_raw *preproc_raw = (yasm_preproc_raw *)preproc; - int c = '*'; - size_t n; + int bufsize = BSIZE; + char *buf = yasm_xmalloc((size_t)bufsize); + char *p; - if (preproc_raw->is_interactive) { - for (n = 0; n < max_size && (c = getc(preproc_raw->in)) != EOF && - c != '\n'; n++) - buf[n] = (char)c; - if (c == '\n') - buf[n++] = (char)c; - if (c == EOF && ferror(preproc_raw->in)) { - yasm_error_set(YASM_ERROR_IO, N_("error when reading from file")); - yasm_errwarn_propagate(preproc_raw->errwarns, - yasm_linemap_get_current(preproc_raw->cur_lm)); + /* Loop to ensure entire line is read (don't want to limit line length). */ + p = buf; + for (;;) { + if (!fgets(p, bufsize-(p-buf), preproc_raw->in)) { + if (ferror(preproc_raw->in)) { + yasm_error_set(YASM_ERROR_IO, + N_("error when reading from file")); + yasm_errwarn_propagate(preproc_raw->errwarns, + yasm_linemap_get_current(preproc_raw->cur_lm)); + } + break; + } + p += strlen(p); + if (p > buf && p[-1] == '\n') + break; + if ((p-buf)+1 >= bufsize) { + /* Increase size of buffer */ + char *oldbuf = buf; + bufsize *= 2; + buf = yasm_xrealloc(buf, (size_t)bufsize); + p = buf + (p-oldbuf); } - } else if (((n = fread(buf, 1, max_size, preproc_raw->in)) == 0) && - ferror(preproc_raw->in)) { - yasm_error_set(YASM_ERROR_IO, N_("error when reading from file")); - yasm_errwarn_propagate(preproc_raw->errwarns, - yasm_linemap_get_current(preproc_raw->cur_lm)); } - return n; + if (p == buf) { + /* No data; must be at EOF */ + yasm_xfree(buf); + return NULL; + } + + /* Strip the line ending */ + buf[strcspn(buf, "\r\n")] = '\0'; + + return buf; } static size_t @@ -127,6 +146,12 @@ raw_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval) /* no builtin defines */ } +static void +raw_preproc_add_standard(yasm_preproc *preproc, const char **macros) +{ + /* no standard macros */ +} + /* Define preproc structure -- see preproc.h for details */ yasm_preproc_module yasm_raw_LTX_preproc = { @@ -134,10 +159,11 @@ yasm_preproc_module yasm_raw_LTX_preproc = { "raw", raw_preproc_create, raw_preproc_destroy, - raw_preproc_input, + raw_preproc_get_line, raw_preproc_get_included_file, raw_preproc_add_include_file, raw_preproc_predefine_macro, raw_preproc_undefine_macro, - raw_preproc_define_builtin + raw_preproc_define_builtin, + raw_preproc_add_standard }; diff --git a/modules/preprocs/raw/tests/Makefile.inc b/modules/preprocs/raw/tests/Makefile.inc new file mode 100644 index 00000000..82923d51 --- /dev/null +++ b/modules/preprocs/raw/tests/Makefile.inc @@ -0,0 +1,5 @@ +TESTS += modules/preprocs/raw/tests/rawpp_test.sh + +EXTRA_DIST += modules/preprocs/raw/tests/rawpp_test.sh +EXTRA_DIST += modules/preprocs/raw/tests/longline.asm +EXTRA_DIST += modules/preprocs/raw/tests/longline.hex diff --git a/modules/preprocs/raw/tests/longline.asm b/modules/preprocs/raw/tests/longline.asm new file mode 100644 index 00000000..2d5931a1 --- /dev/null +++ b/modules/preprocs/raw/tests/longline.asm @@ -0,0 +1 @@ +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: diff --git a/modules/preprocs/raw/tests/longline.hex b/modules/preprocs/raw/tests/longline.hex new file mode 100644 index 00000000..e69de29b diff --git a/modules/preprocs/raw/tests/rawpp_test.sh b/modules/preprocs/raw/tests/rawpp_test.sh new file mode 100755 index 00000000..40339545 --- /dev/null +++ b/modules/preprocs/raw/tests/rawpp_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh rawpp_test modules/preprocs/raw/tests "raw preproc" "-f bin -r raw" "" +exit $? diff --git a/modules/preprocs/tasm/Makefile.inc b/modules/preprocs/tasm/Makefile.inc new file mode 100644 index 00000000..a9468351 --- /dev/null +++ b/modules/preprocs/tasm/Makefile.inc @@ -0,0 +1,3 @@ +EXTRA_DIST += modules/preprocs/tasm/tests/Makefile.inc + +include modules/preprocs/tasm/tests/Makefile.inc diff --git a/modules/preprocs/tasm/tests/Makefile.inc b/modules/preprocs/tasm/tests/Makefile.inc new file mode 100644 index 00000000..e2d56c19 --- /dev/null +++ b/modules/preprocs/tasm/tests/Makefile.inc @@ -0,0 +1,7 @@ +TESTS += modules/preprocs/tasm/tests/tasmpp_test.sh + +EXTRA_DIST += modules/preprocs/tasm/tests/tasmpp_test.sh +EXTRA_DIST += modules/preprocs/tasm/tests/tasm-assume-comment.asm +EXTRA_DIST += modules/preprocs/tasm/tests/tasm-assume-comment.hex +EXTRA_DIST += modules/preprocs/tasm/tests/tasm-comment-instr.asm +EXTRA_DIST += modules/preprocs/tasm/tests/tasm-comment-instr.hex diff --git a/modules/preprocs/tasm/tests/tasm-assume-comment.asm b/modules/preprocs/tasm/tests/tasm-assume-comment.asm new file mode 100644 index 00000000..6b7cc1bf --- /dev/null +++ b/modules/preprocs/tasm/tests/tasm-assume-comment.asm @@ -0,0 +1,3 @@ +assume cs:code,ds:code,es:code ; tiny model (CS=DS=ES) +assume ds:code,es:code; close comment +assume fs:code,gs:code diff --git a/modules/preprocs/tasm/tests/tasm-assume-comment.hex b/modules/preprocs/tasm/tests/tasm-assume-comment.hex new file mode 100644 index 00000000..e69de29b diff --git a/modules/preprocs/tasm/tests/tasm-comment-instr.asm b/modules/preprocs/tasm/tests/tasm-comment-instr.asm new file mode 100644 index 00000000..d93001b1 --- /dev/null +++ b/modules/preprocs/tasm/tests/tasm-comment-instr.asm @@ -0,0 +1 @@ +ansi_normal db 0x27,'[0;40;37m$' diff --git a/modules/preprocs/tasm/tests/tasm-comment-instr.hex b/modules/preprocs/tasm/tests/tasm-comment-instr.hex new file mode 100644 index 00000000..594d68f0 --- /dev/null +++ b/modules/preprocs/tasm/tests/tasm-comment-instr.hex @@ -0,0 +1,11 @@ +27 +5b +30 +3b +34 +30 +3b +33 +37 +6d +24 diff --git a/modules/preprocs/tasm/tests/tasmpp_test.sh b/modules/preprocs/tasm/tests/tasmpp_test.sh new file mode 100755 index 00000000..622e5a07 --- /dev/null +++ b/modules/preprocs/tasm/tests/tasmpp_test.sh @@ -0,0 +1,3 @@ +#! /bin/sh +${srcdir}/out_test.sh tasmpp_test modules/preprocs/tasm/tests "tasm preproc" "-f bin -p tasm" "" +exit $? diff --git a/modules/preprocs/yapp/Makefile.inc b/modules/preprocs/yapp/Makefile.inc index e1659032..137fe2fb 100644 --- a/modules/preprocs/yapp/Makefile.inc +++ b/modules/preprocs/yapp/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - libyasm_a_SOURCES += modules/preprocs/yapp/yapp-preproc.c libyasm_a_SOURCES += modules/preprocs/yapp/yapp-preproc.h libyasm_a_SOURCES += modules/preprocs/yapp/yapp-token.h diff --git a/modules/preprocs/yapp/tests/Makefile.inc b/modules/preprocs/yapp/tests/Makefile.inc index 7dd1285f..4ac216dc 100644 --- a/modules/preprocs/yapp/tests/Makefile.inc +++ b/modules/preprocs/yapp/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $IdPath$ - TESTS += modules/preprocs/yapp/tests/yapp_test.sh EXTRA_DIST += modules/preprocs/yapp/tests/Makefile.inc diff --git a/modules/preprocs/yapp/tests/yapp_test.sh b/modules/preprocs/yapp/tests/yapp_test.sh index 53143850..146d5ae6 100755 --- a/modules/preprocs/yapp/tests/yapp_test.sh +++ b/modules/preprocs/yapp/tests/yapp_test.sh @@ -1,5 +1,4 @@ #! /bin/sh -# $Id$ case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' @@ -29,7 +28,7 @@ do og=`echo ${asm} | sed 's,.asm$,.pre,'` e=${a}.ew eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` - if test \! -e ${eg}; then + if test \! -f ${eg}; then eg=/dev/null fi diff --git a/modules/preprocs/yapp/yapp-preproc.c b/modules/preprocs/yapp/yapp-preproc.c index 4f7767ac..ec91256e 100644 --- a/modules/preprocs/yapp/yapp-preproc.c +++ b/modules/preprocs/yapp/yapp-preproc.c @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -/*@unused@*/ RCSID("$Id$"); -#define YASM_LIB_INTERNAL #include #include "yapp-preproc.h" @@ -242,11 +240,20 @@ void expand_token_list(struct source_head *paramexp, struct source_head *to_head, source **to_tail); static yasm_preproc * -yapp_preproc_create(FILE *f, const char *in_filename, yasm_linemap *lm, +yapp_preproc_create(const char *in_filename, yasm_linemap *lm, yasm_errwarns *errwarns) { + FILE *f; yasm_preproc_yapp *preproc_yapp = yasm_xmalloc(sizeof(yasm_preproc_yapp)); + if (strcmp(in_filename, "-") != 0) { + f = fopen(in_filename, "r"); + if (!f) + yasm__fatal( N_("Could not open input file") ); + } + else + f = stdin; + preproc_yapp->preproc.module = &yasm_yapp_LTX_preproc; yapp_preproc_linemap = lm; @@ -469,7 +476,7 @@ append_to_return(struct source_head *to_head, source **to_tail) return 0; append_token(token, to_head, to_tail); token = yapp_preproc_lex(); - } + } return '\n'; } @@ -991,6 +998,12 @@ yapp_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval) /* TODO */ } +static void +yapp_preproc_add_standard(yasm_preproc *preproc, const char **macros) +{ + /* TODO */ +} + /* Define preproc structure -- see preproc.h for details */ yasm_preproc_module yasm_yapp_LTX_preproc = { "YAPP preprocessing (NASM style)", @@ -1002,5 +1015,6 @@ yasm_preproc_module yasm_yapp_LTX_preproc = { yapp_preproc_add_include_file, yapp_preproc_predefine_macro, yapp_preproc_undefine_macro, - yapp_preproc_define_builtin + yapp_preproc_define_builtin, + yapp_preproc_add_standard }; diff --git a/modules/preprocs/yapp/yapp-preproc.h b/modules/preprocs/yapp/yapp-preproc.h index 52f44b23..38065ab6 100644 --- a/modules/preprocs/yapp/yapp-preproc.h +++ b/modules/preprocs/yapp/yapp-preproc.h @@ -1,4 +1,4 @@ -/* $Id$ +/* * YAPP preprocessor (mimics NASM's preprocessor) header file * * Copyright (C) 2001 Michael Urman diff --git a/modules/preprocs/yapp/yapp-token.l b/modules/preprocs/yapp/yapp-token.l index 38a4c184..d1390777 100644 --- a/modules/preprocs/yapp/yapp-token.l +++ b/modules/preprocs/yapp/yapp-token.l @@ -26,7 +26,6 @@ */ %{ #include -/*@unused@*/ RCSID("$Id$"); #define YASM_LIB_INTERNAL #include diff --git a/out_test.sh b/out_test.sh index a0eb8be4..c5f6efc2 100755 --- a/out_test.sh +++ b/out_test.sh @@ -1,5 +1,4 @@ #! /bin/sh -# $Id$ YASM_TEST_SUITE=1 export YASM_TEST_SUITE @@ -29,8 +28,10 @@ do og=`echo ${asm} | sed 's,.asm$,.hex,'` e=${a}.ew eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` - if test \! -e ${eg}; then + egp=1 + if test \! -f ${eg}; then eg=/dev/null + egp=0 fi # Run within a subshell to prevent signal messages from displaying. @@ -43,7 +44,7 @@ do failedct=`expr $failedct + 1` elif test $status -gt 0; then echo ${asm} | grep err >/dev/null - if test $? -gt 0; then + if test \( $? -gt 0 \) -a \( \! $egp \); then # YASM detected errors but shouldn't have! echo $ECHO_N "E$ECHO_C" eval "failed$failedct='E: ${a} returned an error code!'" @@ -70,7 +71,7 @@ do failedct=`expr $failedct + 1` else ./test_hd results/${o} > results/${oh} - if diff ${og} results/${oh} >/dev/null; then + if diff -w ${og} results/${oh} >/dev/null; then if diff -w ${eg} results/${e} >/dev/null; then # Both object file and error/warnings match, it passes! echo $ECHO_N ".$ECHO_C" diff --git a/plugins/README b/plugins/README new file mode 100644 index 00000000..63a6a53c --- /dev/null +++ b/plugins/README @@ -0,0 +1,22 @@ +These directories contain example yasm plugins. +Yasm is only capable of loading plugins when it was built using cmake. +To build yasm with cmake on Unix, from the yasm source tree, do: + mkdir objdir + cd objdir + cmake .. + make + +The plugins are written to be compiled against an *installed* yasm. +Plugins may be loaded on the yasm command line using the -N command line +option, e.g.: + yasm -N ./libdbgmod.so + yasm -N Release/dbgmod.dll + yasm -N /usr/local/lib/libx86mod +(the .so will be automatically appended) +If no directory path is specified, yasm will search in standard library +locations (e.g. LD_LIBRARY_PATH, the rpath of the yasm executable, etc) to +try to load the plugin. Thus the last example (after installing the plugin) +could likely be written: + yasm -N x86mod + +Plugins may override builtin modules like x86. diff --git a/plugins/dbg/CMakeLists.txt b/plugins/dbg/CMakeLists.txt new file mode 100644 index 00000000..b0b9653f --- /dev/null +++ b/plugins/dbg/CMakeLists.txt @@ -0,0 +1,59 @@ +PROJECT(dbgmod) +CMAKE_MINIMUM_REQUIRED(VERSION 2.4) + +SET (YASM_POSSIBLE_PATHS + "$ENV{ProgramFiles}/Yasm/Bin" + /usr/bin + /usr/local/bin + ) + +FIND_PROGRAM(YASM_PATH yasm + PATHS ${YASM_POSSIBLE_PATHS} + ) + +SET (YASM_POSSIBLE_INCLUDE_PATHS + "${YASM_PATH}" + "${YASM_PATH}/../include" + "$ENV{ProgramFiles}/Yasm/Include" + /usr/include + /usr/local/include + ) + +FIND_PATH(YASM_INCLUDE_PATH NAMES libyasm.h + DOC "The path to the libyasm include files" + PATHS ${YASM_POSSIBLE_INCLUDE_PATHS} + ) + +IF (NOT YASM_INCLUDE_PATH) + MESSAGE(FATAL_ERROR "Could not find yasm include files") +ENDIF (NOT YASM_INCLUDE_PATH) + +INCLUDE_DIRECTORIES(${YASM_INCLUDE_PATH}) + +SET (YASM_POSSIBLE_LIB_PATHS + "${YASM_PATH}" + "${YASM_PATH}/../lib" + "${YASM_INCLUDE_PATH}/../lib" + "$ENV{ProgramFiles}/Yasm/Lib" + /usr/lib + /usr/local/lib + ) + +FIND_LIBRARY(YASM_LIBRARY + NAMES yasm + DOC "The path to the libyasm library" + PATHS ${YASM_POSSIBLE_LIB_PATHS} + ) + +IF (NOT YASM_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find yasm library") +ENDIF (NOT YASM_LIBRARY) + +ADD_LIBRARY(dbgmod MODULE + init_plugin.c + dbg-objfmt.c + ) +TARGET_LINK_LIBRARIES(dbgmod ${YASM_LIBRARY}) +if(WIN32) + SET_PROPERTY(TARGET dbgmod PROPERTY PREFIX "") +endif() diff --git a/plugins/dbg/README b/plugins/dbg/README new file mode 100644 index 00000000..d4fdbc58 --- /dev/null +++ b/plugins/dbg/README @@ -0,0 +1,21 @@ +This directory demonstrates how to build a basic plugin. +It does not need access to the yasm source, only an installed yasm. + +To build: + mkdir objdir + cd objdir + cmake .. + make + +Testing (on Windows): + yasm -N Release/dbgmod.dll -f dbg - + db 5 + ^Z + +Testing (on Unix): + yasm -N ./libdbgmod.so -f dbg - + db 5 + ^D + +Result lines will have PLUGIN prefixed to the function calls; this +demonstrates the plugin is being used rather than the builtin dbg module. diff --git a/plugins/dbg/dbg-objfmt.c b/plugins/dbg/dbg-objfmt.c new file mode 100644 index 00000000..1aef7c20 --- /dev/null +++ b/plugins/dbg/dbg-objfmt.c @@ -0,0 +1,175 @@ +/* + * Debugging object format (used to debug object format module interface) + * + * Copyright (C) 2001-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + +#define N_(String) (String) + +typedef struct yasm_objfmt_dbg { + yasm_objfmt_base objfmt; /* base structure */ + + FILE *dbgfile; +} yasm_objfmt_dbg; + +yasm_objfmt_module yasm_dbg_LTX_objfmt; + + +static yasm_objfmt * +dbg_objfmt_create(yasm_object *object) +{ + yasm_objfmt_dbg *objfmt_dbg = yasm_xmalloc(sizeof(yasm_objfmt_dbg)); + + objfmt_dbg->objfmt.module = &yasm_dbg_LTX_objfmt; + + objfmt_dbg->dbgfile = tmpfile(); + if (!objfmt_dbg->dbgfile) { + fprintf(stderr, N_("could not open temporary file")); + return 0; + } + fprintf(objfmt_dbg->dbgfile, "PLUGIN create()\n"); + return (yasm_objfmt *)objfmt_dbg; +} + +static void +dbg_objfmt_output(yasm_object *object, FILE *f, int all_syms, + yasm_errwarns *errwarns) +{ + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt; + char buf[1024]; + size_t i; + + /* Copy temp file to real output file */ + rewind(objfmt_dbg->dbgfile); + while ((i = fread(buf, 1, 1024, objfmt_dbg->dbgfile))) { + if (fwrite(buf, 1, i, f) != i) + break; + } + + /* Reassign objfmt debug file to output file */ + fclose(objfmt_dbg->dbgfile); + objfmt_dbg->dbgfile = f; + + fprintf(objfmt_dbg->dbgfile, "PLUGIN output(f, object->\n"); + yasm_object_print(object, objfmt_dbg->dbgfile, 1); + fprintf(objfmt_dbg->dbgfile, "%d)\n", all_syms); + fprintf(objfmt_dbg->dbgfile, " Symbol Table:\n"); + yasm_symtab_print(object->symtab, objfmt_dbg->dbgfile, 1); +} + +static void +dbg_objfmt_destroy(yasm_objfmt *objfmt) +{ + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)objfmt; + fprintf(objfmt_dbg->dbgfile, "PLUGIN destroy()\n"); + yasm_xfree(objfmt); +} + +static yasm_section * +dbg_objfmt_add_default_section(yasm_object *object) +{ + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt; + yasm_section *retval; + int isnew; + + retval = yasm_object_get_general(object, ".text", 0, 0, 0, &isnew, 0); + if (isnew) { + fprintf(objfmt_dbg->dbgfile, "(new) "); + yasm_symtab_define_label(object->symtab, ".text", + yasm_section_bcs_first(retval), 1, 0); + yasm_section_set_default(retval, 1); + } + return retval; +} + +static /*@observer@*/ /*@null@*/ yasm_section * +dbg_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, + /*@unused@*/ /*@null@*/ + yasm_valparamhead *objext_valparams, + unsigned long line) +{ + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt; + yasm_valparam *vp; + yasm_section *retval; + int isnew; + + fprintf(objfmt_dbg->dbgfile, "PLUGIN section_switch(headp, "); + yasm_vps_print(valparams, objfmt_dbg->dbgfile); + fprintf(objfmt_dbg->dbgfile, ", "); + yasm_vps_print(objext_valparams, objfmt_dbg->dbgfile); + fprintf(objfmt_dbg->dbgfile, ", %lu), returning ", line); + + vp = yasm_vps_first(valparams); + if (!yasm_vp_string(vp)) { + fprintf(objfmt_dbg->dbgfile, "NULL\n"); + return NULL; + } + retval = yasm_object_get_general(object, yasm_vp_string(vp), 0, 0, 0, + &isnew, line); + if (isnew) { + fprintf(objfmt_dbg->dbgfile, "(new) "); + yasm_symtab_define_label(object->symtab, vp->val, + yasm_section_bcs_first(retval), 1, line); + } + yasm_section_set_default(retval, 0); + fprintf(objfmt_dbg->dbgfile, "\"%s\" section\n", vp->val); + return retval; +} + +static /*@observer@*/ /*@null@*/ yasm_symrec * +dbg_objfmt_get_special_sym(yasm_object *object, const char *name, + const char *parser) +{ + yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt; + fprintf(objfmt_dbg->dbgfile, + "PLUGIN get_special_sym(object, \"%s\", \"%s\")\n", + name, parser); + return NULL; +} + +/* Define valid debug formats to use with this object format */ +static const char *dbg_objfmt_dbgfmt_keywords[] = { + "null", + NULL +}; + +/* Define objfmt structure -- see objfmt.h for details */ +yasm_objfmt_module yasm_dbg_LTX_objfmt = { + "Trace of all info passed to object format module", + "dbg", + "dbg", + 32, + dbg_objfmt_dbgfmt_keywords, + "null", + NULL, /* no directives */ + NULL, /* no standard macros */ + dbg_objfmt_create, + dbg_objfmt_output, + dbg_objfmt_destroy, + dbg_objfmt_add_default_section, + dbg_objfmt_section_switch, + dbg_objfmt_get_special_sym +}; diff --git a/plugins/dbg/init_plugin.c b/plugins/dbg/init_plugin.c new file mode 100644 index 00000000..5c4eb6aa --- /dev/null +++ b/plugins/dbg/init_plugin.c @@ -0,0 +1,13 @@ +#include +#include + +extern yasm_arch_module yasm_dbg_LTX_objfmt; + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void +yasm_init_plugin(void) +{ + yasm_register_module(YASM_MODULE_OBJFMT, "dbg", &yasm_dbg_LTX_objfmt); +} diff --git a/plugins/x86/CMakeLists.txt b/plugins/x86/CMakeLists.txt new file mode 100644 index 00000000..87343dd3 --- /dev/null +++ b/plugins/x86/CMakeLists.txt @@ -0,0 +1,149 @@ +PROJECT(x86mod) +CMAKE_MINIMUM_REQUIRED(VERSION 2.4) + +SET(YASM_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../.." + CACHE STRING "Location of Yasm source") + +IF (NOT YASM_SOURCE_DIR) + MESSAGE(FATAL_ERROR "YASM_SOURCE_DIR must be defined") +ENDIF (NOT YASM_SOURCE_DIR) + +SET(SOURCE_DIR "${YASM_SOURCE_DIR}/modules/arch/x86") + +SET (YASM_POSSIBLE_PATHS + "$ENV{ProgramFiles}/Yasm/Bin" + /usr/bin + /usr/local/bin + ) + +FIND_PROGRAM(YASM_PATH yasm + PATHS ${YASM_POSSIBLE_PATHS} + ) + +SET (GENPERF_POSSIBLE_PATHS + ${YASM_SOURCE_DIR}/objdir/tools/genperf + ${YASM_SOURCE_DIR}/objdir/tools/genperf/Debug + ${YASM_SOURCE_DIR}/objdir/tools/genperf/Release + ) + +FIND_PROGRAM(GENPERF_PATH genperf + DOC "The path to the yasm genperf executable" + PATHS ${GENPERF_POSSIBLE_PATHS} + ) + +IF (NOT GENPERF_PATH) + MESSAGE(FATAL_ERROR "Could not find genperf executable") +ENDIF (NOT GENPERF_PATH) + +SET (YASM_POSSIBLE_INCLUDE_PATHS + "${YASM_PATH}" + "${YASM_PATH}/../include" + "$ENV{ProgramFiles}/Yasm/Include" + /usr/include + /usr/local/include + ) + +FIND_PATH(YASM_INCLUDE_PATH NAMES libyasm.h + DOC "The path to the libyasm include files" + PATHS ${YASM_POSSIBLE_INCLUDE_PATHS} + ) + +IF (NOT YASM_INCLUDE_PATH) + MESSAGE(FATAL_ERROR "Could not find yasm include files") +ENDIF (NOT YASM_INCLUDE_PATH) + +INCLUDE_DIRECTORIES(${YASM_INCLUDE_PATH}) +INCLUDE_DIRECTORIES(${YASM_SOURCE_DIR}) + +SET (YASM_POSSIBLE_LIB_PATHS + "${YASM_PATH}" + "${YASM_PATH}/../lib" + "${YASM_INCLUDE_PATH}/../lib" + "$ENV{ProgramFiles}/Yasm/Lib" + /usr/lib + /usr/local/lib + ) + +FIND_LIBRARY(YASM_LIBRARY + NAMES yasm + DOC "The path to the libyasm library" + PATHS ${YASM_POSSIBLE_LIB_PATHS} + ) + +IF (NOT YASM_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find yasm library") +ENDIF (NOT YASM_LIBRARY) + +INCLUDE(FindPythonInterp) + +IF (NOT PYTHON_EXECUTABLE) + MESSAGE(FATAL_ERROR "Could not find Python executable") +ENDIF (NOT PYTHON_EXECUTABLE) + +INCLUDE_DIRECTORIES(${SOURCE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_CUSTOM_COMMAND( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf + COMMAND ${PYTHON_EXECUTABLE} ${SOURCE_DIR}/gen_x86_insn.py + ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf + MAIN_DEPENDENCY ${SOURCE_DIR}/gen_x86_insn.py + ) + +macro (YASM_GENPERF _in_NAME _out_NAME) + add_custom_command( + OUTPUT ${_out_NAME} + COMMAND ${GENPERF_PATH} ${_in_NAME} ${_out_NAME} + MAIN_DEPENDENCY ${_in_NAME} + ) +endmacro (YASM_GENPERF) + +YASM_GENPERF( + ${SOURCE_DIR}/x86cpu.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86cpu.c + ) + +YASM_GENPERF( + ${SOURCE_DIR}/x86regtmod.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86regtmod.c + ) + +YASM_GENPERF( + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c + ) + +YASM_GENPERF( + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c + ) + +SET(insn_DEPS + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c + ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c + ) + +SET_SOURCE_FILES_PROPERTIES(${SOURCE_DIR}/x86id.c PROPERTIES + OBJECT_DEPENDS "${insn_DEPS}" + ) + +ADD_LIBRARY(x86mod MODULE + init_plugin.c + ${SOURCE_DIR}/x86arch.c + ${SOURCE_DIR}/x86bc.c + ${SOURCE_DIR}/x86expr.c + ${SOURCE_DIR}/x86id.c + x86cpu.c + x86regtmod.c + ) +TARGET_LINK_LIBRARIES(x86mod ${YASM_LIBRARY}) + +if(WIN32) + SET_PROPERTY(TARGET x86mod PROPERTY PREFIX "") +endif() diff --git a/plugins/x86/README b/plugins/x86/README new file mode 100644 index 00000000..dddedd0d --- /dev/null +++ b/plugins/x86/README @@ -0,0 +1,19 @@ +This directory demonstrates how to build a yasm builtin module as a plugin. +This can be useful for integrating custom changes without +rebuilding/reinstalling yasm. + +It requires access to the yasm source. It defaults to assuming it is being +built inside of the yasm source tree. + +To build: + mkdir objdir + cd objdir + cmake .. + make + +Testing (on Windows): + yasm -N Release/x86mod.dll -f x86 ... + +Testing (on Unix): + yasm -N ./libx86mod.so -f x86 ... + diff --git a/plugins/x86/init_plugin.c b/plugins/x86/init_plugin.c new file mode 100644 index 00000000..39a94ed0 --- /dev/null +++ b/plugins/x86/init_plugin.c @@ -0,0 +1,13 @@ +#include +#include + +extern yasm_arch_module yasm_x86_LTX_arch; + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void +yasm_init_plugin(void) +{ + yasm_register_module(YASM_MODULE_ARCH, "x86", &yasm_x86_LTX_arch); +} diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 00000000..38039dfd --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,10 @@ +Makefile.in.in +POTFILES +cat-id-tbl.c +yasm.pot +stamp-cat-id +remove-potcdate.sed +Makefile +Makefile.in +.*.swp +stamp-po diff --git a/po/ChangeLog b/po/ChangeLog index e69de29b..3cafdef3 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -0,0 +1,9 @@ +2014-08-10 gettextize + + * Makefile.in.in: Upgrade to gettext-0.18.3. + * Rules-quot: Upgrade to gettext-0.18.3. + +2010-06-15 gettextize + + * Makefile.in.in: Upgrade to gettext-0.17. + diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 5022b8b1..fabdc76c 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -1,5 +1,5 @@ # Makefile for PO directory in any package using GNU gettext. -# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper +# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public @@ -8,12 +8,14 @@ # Please note that the actual code of GNU gettext is covered by the GNU # General Public License and is *not* in the public domain. # -# Origin: gettext-0.16 +# Origin: gettext-0.18.3 +GETTEXT_MACRO_VERSION = 0.18 PACKAGE = @PACKAGE@ VERSION = @VERSION@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +SED = @SED@ SHELL = /bin/sh @SET_MAKE@ @@ -87,8 +89,8 @@ CATALOGS = @CATALOGS@ .po.gmo: @lang=`echo $* | sed -e 's,.*/,,'`; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ - cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo .sin.sed: sed -e '/^#/d' $< > t-$@ @@ -100,6 +102,13 @@ all: all-@USE_NLS@ all-yes: stamp-po all-no: +# Ensure that the gettext macros and this Makefile.in.in are in sync. +CHECK_MACRO_VERSION = \ + test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ + || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ + exit 1; \ + } + # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because # we don't want to bother translators with empty POT files). We assume that @@ -115,6 +124,7 @@ all-no: # $(POFILES) has been designed to not touch files that don't need to be # changed. stamp-po: $(srcdir)/$(DOMAIN).pot + @$(CHECK_MACRO_VERSION) test ! -f $(srcdir)/$(DOMAIN).pot || \ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) @test ! -f $(srcdir)/$(DOMAIN).pot || { \ @@ -129,17 +139,43 @@ stamp-po: $(srcdir)/$(DOMAIN).pot # This target rebuilds $(DOMAIN).pot; it is an expensive operation. # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +# The determination of whether the package xyz is a GNU one is based on the +# heuristic whether some file in the top level directory mentions "GNU xyz". +# If GNU 'find' is available, we avoid grepping through monster files. $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \ + LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \ + else \ + LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \ + fi; \ + } | grep -v 'libtool:' >/dev/null; then \ + package_gnu='GNU '; \ + else \ + package_gnu=''; \ + fi; \ if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ else \ msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ fi; \ - $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ - --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ - --files-from=$(srcdir)/POTFILES.in \ - --copyright-holder='$(COPYRIGHT_HOLDER)' \ - --msgid-bugs-address="$$msgid_bugs_address" + case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + *) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --package-name="$${package_gnu}@PACKAGE@" \ + --package-version='@VERSION@' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + esac test ! -f $(DOMAIN).po || { \ if test -f $(srcdir)/$(DOMAIN).pot; then \ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ @@ -167,8 +203,15 @@ $(POFILES): $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ if test -f "$(srcdir)/$${lang}.po"; then \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ - cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) \ + && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \ + esac; \ + }; \ else \ $(MAKE) $${lang}.po-create; \ fi @@ -191,7 +234,6 @@ install-data: install-data-@USE_NLS@ fi install-data-no: all install-data-yes: all - $(mkdir_p) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ @@ -243,7 +285,6 @@ installdirs-data: installdirs-data-@USE_NLS@ fi installdirs-data-no: installdirs-data-yes: - $(mkdir_p) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ @@ -369,9 +410,15 @@ update-po: Makefile tmpdir=`pwd`; \ echo "$$lang:"; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ cd $(srcdir); \ - if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ + if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + esac; \ + }; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ @@ -392,9 +439,13 @@ $(DUMMYPOFILES): update-gmo: Makefile $(GMOFILES) @: +# Recreate Makefile by invoking config.status. Explicitly invoke the shell, +# because execution permission bits may not work on the current file system. +# Use @SHELL@, which is the shell determined by autoconf for the use by its +# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ - && $(SHELL) ./config.status $(subdir)/$@.in po-directories + && @SHELL@ ./config.status $(subdir)/$@.in po-directories force: diff --git a/po/Makevars b/po/Makevars index 89166e06..589f9f15 100644 --- a/po/Makevars +++ b/po/Makevars @@ -39,3 +39,15 @@ MSGID_BUGS_ADDRESS = bug-yasm@tortall.net # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = + +# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' +# context. Possible values are "yes" and "no". Set this to yes if the +# package uses functions taking also a message context, like pgettext(), or +# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. +USE_MSGCTXT = no + +# These options get passed to msgmerge. +# Useful options are in particular: +# --previous to keep previous msgids of translated messages, +# --quiet to reduce the verbosity. +MSGMERGE_OPTIONS = diff --git a/po/Makevars.template b/po/Makevars.template deleted file mode 100644 index 32692ab4..00000000 --- a/po/Makevars.template +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile variables for PO directory in any package using GNU gettext. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = Free Software Foundation, Inc. - -# This is the email address or URL to which the translators shall report -# bugs in the untranslated strings: -# - Strings which are not entire sentences, see the maintainer guidelines -# in the GNU gettext documentation, section 'Preparing Strings'. -# - Strings which use unclear terms or require additional context to be -# understood. -# - Strings which make invalid assumptions about notation of date, time or -# money. -# - Pluralisation problems. -# - Incorrect English spelling. -# - Incorrect formatting. -# It can be your email address, or a mailing list address where translators -# can write to without being subscribed, or the URL of a web page through -# which the translators can contact you. -MSGID_BUGS_ADDRESS = - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in index 987b022c..dc17f974 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,16 +1,12 @@ # List of source files containing translatable strings. # To update, try "find . -name \*.c | xargs grep -c _\( | grep -v :0 | sort" # Copyright (c) 2001 Peter Johnson -# -# $Id$ frontends/yasm/yasm-options.c frontends/yasm/yasm.c -#lc3bid.c libyasm/bc-align.c libyasm/bc-data.c libyasm/bc-incbin.c -libyasm/bc-insn.c libyasm/bc-org.c libyasm/bc-reserve.c libyasm/bitvect.c @@ -20,13 +16,15 @@ libyasm/expr.c libyasm/file.c libyasm/floatnum.c libyasm/hamt.c +libyasm/insn.c libyasm/intnum.c libyasm/section.c libyasm/symrec.c +libyasm/valparam.c libyasm/value.c libyasm/xmalloc.c -#modules/arch/lc3b/lc3barch.c -#modules/arch/lc3b/lc3bbc.c +modules/arch/lc3b/lc3barch.c +modules/arch/lc3b/lc3bbc.c modules/arch/x86/x86arch.c modules/arch/x86/x86bc.c modules/arch/x86/x86expr.c @@ -54,5 +52,9 @@ modules/parsers/gas/gas-parser.c modules/parsers/gas/gas-token.re modules/parsers/nasm/nasm-parse.c modules/parsers/nasm/nasm-token.re +modules/preprocs/cpp/cpp-preproc.c +modules/preprocs/gas/gas-preproc.c +modules/preprocs/gas/gas-eval.c +modules/preprocs/nasm/nasm-preproc.c modules/preprocs/nasm/nasm-pp.c modules/preprocs/raw/raw-preproc.c diff --git a/po/Rules-quot b/po/Rules-quot index 9c2a995e..5931e539 100644 --- a/po/Rules-quot +++ b/po/Rules-quot @@ -14,13 +14,13 @@ en@boldquot.po-update: en@boldquot.po-update-en .insert-header.po-update-en: @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ ll=`echo $$lang | sed -e 's/@.*//'`; \ LC_ALL=C; export LC_ALL; \ cd $(srcdir); \ - if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ diff --git a/splint.sh b/splint.sh index 03d1867f..56850ff3 100755 --- a/splint.sh +++ b/splint.sh @@ -11,33 +11,77 @@ splint \ -retvalother \ -shiftimplementation \ -shiftnegative \ + -fixedformalarray \ +ansi89limits \ - -I/usr/local/include \ - -Isrc \ - -Isrc/arch/x86 \ + +ansistrictlib \ + +trytorecover \ + -globs \ -I. \ + -I/usr/local/include \ -DHAVE_CONFIG_H \ - -DHAVE_BOGUS_SYS_QUEUE_H \ -Dlint \ - src/main.c \ - src/options.c \ - src/arch.c \ - src/bytecode.c \ - src/errwarn.c \ - src/expr.c \ - src/file.c \ - src/floatnum.c \ - src/globals.c \ - src/intnum.c \ - src/parser.c \ - src/section.c \ - src/arch/x86/x86arch.c \ - src/arch/x86/x86bc.c \ - src/arch/x86/x86expr.c \ - src/objfmts/dbg/dbg-objfmt.c \ - src/objfmts/bin/bin-objfmt.c \ - src/parsers/nasm/nasm-parser.c \ - src/preprocs/raw/raw-preproc.c \ - src/optimizers/basic/basic-optimizer.c \ - src/symrec.c \ - src/hamt.c + frontends/yasm/yasm-options.c \ + frontends/yasm/yasm.c \ + libyasm/arch.c \ + libyasm/assocdat.c \ + libyasm/bc-align.c \ + libyasm/bc-data.c \ + libyasm/bc-incbin.c \ + libyasm/bc-insn.c \ + libyasm/bc-org.c \ + libyasm/bc-reserve.c \ + libyasm/bytecode.c \ + libyasm/errwarn.c \ + libyasm/expr.c \ + libyasm/file.c \ + libyasm/floatnum.c \ + libyasm/hamt.c \ + libyasm/intnum.c \ + libyasm/inttree.c \ + libyasm/linemap.c \ + libyasm/md5.c \ + libyasm/mergesort.c \ + libyasm/phash.c \ + libyasm/section.c \ + libyasm/strcasecmp.c \ + libyasm/strsep.c \ + libyasm/symrec.c \ + libyasm/valparam.c \ + libyasm/value.c \ + libyasm/xmalloc.c \ + libyasm/xstrdup.c \ + modules/arch/lc3b/lc3barch.c \ + modules/arch/lc3b/lc3bbc.c \ + modules/arch/x86/x86arch.c \ + modules/arch/x86/x86bc.c \ + modules/arch/x86/x86expr.c \ + modules/arch/x86/x86id.c \ + modules/dbgfmts/codeview/cv-dbgfmt.c \ + modules/dbgfmts/codeview/cv-symline.c \ + modules/dbgfmts/codeview/cv-type.c \ + modules/dbgfmts/dwarf2/dwarf2-aranges.c \ + modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \ + modules/dbgfmts/dwarf2/dwarf2-info.c \ + modules/dbgfmts/dwarf2/dwarf2-line.c \ + modules/dbgfmts/null/null-dbgfmt.c \ + modules/dbgfmts/stabs/stabs-dbgfmt.c \ + modules/listfmts/nasm/nasm-listfmt.c \ + modules/objfmts/bin/bin-objfmt.c \ + modules/objfmts/coff/coff-objfmt.c \ + modules/objfmts/coff/win64-except.c \ + modules/objfmts/dbg/dbg-objfmt.c \ + modules/objfmts/elf/elf-objfmt.c \ + modules/objfmts/elf/elf-x86-amd64.c \ + modules/objfmts/elf/elf-x86-x86.c \ + modules/objfmts/elf/elf.c \ + modules/objfmts/macho/macho-objfmt.c \ + modules/objfmts/rdf/rdf-objfmt.c \ + modules/objfmts/xdf/xdf-objfmt.c \ + modules/parsers/gas/gas-parse.c \ + modules/parsers/gas/gas-parse-intel.c \ + modules/parsers/gas/gas-parser.c \ + modules/parsers/nasm/nasm-parse.c \ + modules/parsers/nasm/nasm-parser.c \ + modules/preprocs/nasm/nasm-preproc.c \ + modules/preprocs/raw/raw-preproc.c + diff --git a/test_hd.c b/test_hd.c index 05b53e53..8ae5cabe 100644 --- a/test_hd.c +++ b/test_hd.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * * Simple hexidecimal dump, two hex digits per line. * diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..4b83d4eb --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,3 @@ +ADD_SUBDIRECTORY(genmacro) +ADD_SUBDIRECTORY(genperf) +ADD_SUBDIRECTORY(re2c) diff --git a/tools/Makefile.inc b/tools/Makefile.inc index 56a4697f..dbc67fcb 100644 --- a/tools/Makefile.inc +++ b/tools/Makefile.inc @@ -1,9 +1,9 @@ -# $Id$ - EXTRA_DIST += tools/re2c/Makefile.inc -EXTRA_DIST += tools/gap/Makefile.inc +EXTRA_DIST += tools/genmacro/Makefile.inc +EXTRA_DIST += tools/genperf/Makefile.inc EXTRA_DIST += tools/python-yasm/Makefile.inc include tools/re2c/Makefile.inc -include tools/gap/Makefile.inc +include tools/genmacro/Makefile.inc +include tools/genperf/Makefile.inc include tools/python-yasm/Makefile.inc diff --git a/tools/gap/Makefile.inc b/tools/gap/Makefile.inc deleted file mode 100644 index 4457af76..00000000 --- a/tools/gap/Makefile.inc +++ /dev/null @@ -1,34 +0,0 @@ -# $Id$ - -# These utility programs have to be built for BUILD host in cross-build. -# This makes things rather non-standard automake - -noinst_PROGRAMS += gap - -gap_SOURCES = -EXTRA_DIST += tools/gap/gap.c -EXTRA_DIST += tools/gap/perfect.c -EXTRA_DIST += tools/gap/perfect.h -EXTRA_DIST += tools/gap/standard.h -gap_LDADD = gap.$(OBJEXT) -gap_LDADD += gap-perfect.$(OBJEXT) -gap_LDADD += gap-phash.$(OBJEXT) -gap_LDADD += gap-xmalloc.$(OBJEXT) -gap_LDADD += gap-xstrdup.$(OBJEXT) -gap_LINK = $(CCLD_FOR_BUILD) -o $@ - -gap.$(OBJEXT): tools/gap/gap.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/gap/gap.c || echo '$(srcdir)/'`tools/gap/gap.c - -gap-perfect.$(OBJEXT): tools/gap/perfect.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/gap/perfect.c || echo '$(srcdir)/'`tools/gap/perfect.c - -gap-phash.$(OBJEXT): libyasm/phash.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c - -gap-xmalloc.$(OBJEXT): libyasm/xmalloc.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c - -gap-xstrdup.$(OBJEXT): libyasm/xstrdup.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c - diff --git a/tools/gap/gap.c b/tools/gap/gap.c deleted file mode 100644 index 0f135bf7..00000000 --- a/tools/gap/gap.c +++ /dev/null @@ -1,854 +0,0 @@ -/* $Id$ - * - * Generate Arch Parser (GAP): generates ARCHparse.c from ARCHparse.gap. - * - * Copyright (C) 2006-2007 Peter Johnson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include -#include -#include -#include -#include "tools/gap/perfect.h" -#include "libyasm/compat-queue.h" -#include "libyasm/coretype.h" -#include "libyasm/errwarn.h" - -typedef STAILQ_HEAD(slist, sval) slist; -typedef struct sval { - STAILQ_ENTRY(sval) link; - char *str; -} sval; - -typedef STAILQ_HEAD(dir_list, dir) dir_list; -typedef struct dir { - STAILQ_ENTRY(dir) link; - char *name; - const char *func; - slist args; -} dir; - -typedef STAILQ_HEAD(dir_byp_list, dir_byp) dir_byp_list; -typedef struct dir_byp { - STAILQ_ENTRY(dir_byp) link; - /*@null@*/ char *parser; - dir_list dirs; -} dir_byp; - -typedef enum { - ARCH = 0, - PARSERS, - INSN, - CPU, - CPU_ALIAS, - CPU_FEATURE, - TARGETMOD, - PREFIX, - REG, - REGGROUP, - SEGREG, - NUM_DIRS -} dir_type; - -typedef struct { - void (*parse_insn) (void); /* arch-specific parse_insn */ - int multi_parser[NUM_DIRS]; /* whether it has an initial parser field */ -} arch_handler; - -static void x86_parse_insn(void); -static const arch_handler arch_x86 = { - x86_parse_insn, - {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0} -}; - -static struct { - const char *name; - const arch_handler *arch; -} archs[] = { - {"x86", &arch_x86}, -}; - -static char line[1024]; -static unsigned int cur_line = 0, next_line = 1; -static int errors = 0; -static const arch_handler *arch = NULL; - -/* Lists of directives, keyed by parser name */ -static dir_byp_list insnprefix_byp; -static dir_byp_list cpu_byp; -static dir_byp_list regtmod_byp; - -static void -report_error(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "%u: ", cur_line); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fputc('\n', stderr); - errors++; -} - -void -yasm__fatal(const char *message, ...) -{ - abort(); -} - -static void -dup_slist(slist *out, slist *in) -{ - sval *sv; - - STAILQ_INIT(out); - STAILQ_FOREACH(sv, in, link) { - sval *nsv = yasm_xmalloc(sizeof(sval)); - nsv->str = yasm__xstrdup(sv->str); - STAILQ_INSERT_TAIL(out, nsv, link); - } -} - -static dir * -dup_dir(dir *in) -{ - dir *out = yasm_xmalloc(sizeof(dir)); - out->name = yasm__xstrdup(in->name); - out->func = in->func; - dup_slist(&out->args, &in->args); - return out; -} - -static dir_list * -get_dirs(dir_byp_list *byp, /*@null@*/ const char *parser) -{ - dir_list *found = NULL; - dir_byp *db; - - if (STAILQ_EMPTY(byp)) { - report_error("PARSERS not yet specified"); - return NULL; - } - - STAILQ_FOREACH(db, byp, link) { - if ((!parser && !db->parser) || - (parser && db->parser && strcmp(parser, db->parser) == 0)) { - found = &db->dirs; - break; - } - } - - return found; -} - -/* Add a keyword/data to a slist of slist keyed by parser name. - * Returns nonzero on error. - */ -static int -add_dir(dir_byp_list *byp, /*@null@*/ const char *parser, dir *d) -{ - dir_list *found = get_dirs(byp, parser); - - if (found) { - STAILQ_INSERT_TAIL(found, d, link); - return 0; - } else if (!parser) { - /* Add separately to all */ - dir_byp *db; - int first = 1; - STAILQ_FOREACH(db, byp, link) { - if (!first) - d = dup_dir(d); - first = 0; - STAILQ_INSERT_TAIL(&db->dirs, d, link); - } - return 0; - } else { - report_error("parser not found"); - return 1; - } -} - -static char * -check_parser(dir_type type) -{ - char *parser = NULL; - - if (arch->multi_parser[type]) { - parser = strtok(NULL, " \t\n"); - if (strcmp(parser, "-") == 0) - parser = NULL; - } - - return parser; -} - -static void -parse_args(slist *args) -{ - char *tok; - sval *sv; - - STAILQ_INIT(args); - - tok = strtok(NULL, " \t\n"); - if (!tok) { - report_error("no args"); - return; - } - - while (tok) { - sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup(tok); - STAILQ_INSERT_TAIL(args, sv, link); - tok = strtok(NULL, " \t\n"); - } -} - -static dir * -parse_generic(dir_type type, const char *func, dir_byp_list *byp) -{ - char *parser = check_parser(type); - char *name = strtok(NULL, " \t\n"); - dir *d = yasm_xmalloc(sizeof(dir)); - - d->name = yasm__xstrdup(name); - d->func = func; - parse_args(&d->args); - - add_dir(byp, parser, d); - return d; -} - -static void -parse_arch(void) -{ - size_t i; - int found = 0; - char *tok = strtok(NULL, " \t\n"); - - if (!tok) { - report_error("ARCH requires an operand"); - return; - } - for (i=0; imulti_parser[INSN] || arch->multi_parser[PREFIX]) { - db = yasm_xmalloc(sizeof(dir_byp)); - db->parser = yasm__xstrdup(tok); - STAILQ_INIT(&db->dirs); - - STAILQ_INSERT_TAIL(&insnprefix_byp, db, link); - } - if (arch->multi_parser[CPU] || arch->multi_parser[CPU_ALIAS] || - arch->multi_parser[CPU_FEATURE]) { - db = yasm_xmalloc(sizeof(dir_byp)); - db->parser = yasm__xstrdup(tok); - STAILQ_INIT(&db->dirs); - - STAILQ_INSERT_TAIL(&cpu_byp, db, link); - } - if (arch->multi_parser[TARGETMOD] || arch->multi_parser[REG] || - arch->multi_parser[REGGROUP] || arch->multi_parser[SEGREG]) { - db = yasm_xmalloc(sizeof(dir_byp)); - db->parser = yasm__xstrdup(tok); - STAILQ_INIT(&db->dirs); - - STAILQ_INSERT_TAIL(®tmod_byp, db, link); - } - tok = strtok(NULL, " \t\n"); - } - - /* Add NULL (global) versions if not already created */ - if (STAILQ_EMPTY(&insnprefix_byp)) { - db = yasm_xmalloc(sizeof(dir_byp)); - db->parser = NULL; - STAILQ_INIT(&db->dirs); - - STAILQ_INSERT_TAIL(&insnprefix_byp, db, link); - } - if (STAILQ_EMPTY(&cpu_byp)) { - db = yasm_xmalloc(sizeof(dir_byp)); - db->parser = NULL; - STAILQ_INIT(&db->dirs); - - STAILQ_INSERT_TAIL(&cpu_byp, db, link); - } - if (STAILQ_EMPTY(®tmod_byp)) { - db = yasm_xmalloc(sizeof(dir_byp)); - db->parser = NULL; - STAILQ_INIT(&db->dirs); - - STAILQ_INSERT_TAIL(®tmod_byp, db, link); - } -} - -static void -x86_parse_insn(void) -{ - char *parser = check_parser(INSN); - char *bname = strtok(NULL, " \t\n"); - char *suffix = strtok(NULL, " \t\n"); - dir *d; - slist args; - sval *sv; - - if (!suffix) { - report_error("INSN requires suffix"); - return; - } - - /* save the remainder of args */ - parse_args(&args); - - if (suffix[0] != '"') { - /* Just one instruction to generate */ - sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup(suffix); - STAILQ_INSERT_HEAD(&args, sv, link); - - d = yasm_xmalloc(sizeof(dir)); - d->name = yasm__xstrdup(bname); - d->func = "INSN"; - d->args = args; - add_dir(&insnprefix_byp, parser, d); - } else { - /* Need to generate with suffixes for gas */ - char *p; - char sufstr[6]; - size_t bnamelen = strlen(bname); - - strcpy(sufstr, "SUF_X"); - - for (p = &suffix[1]; *p != '"'; p++) { - sufstr[4] = toupper(*p); - - d = yasm_xmalloc(sizeof(dir)); - - d->name = yasm_xmalloc(bnamelen+2); - strcpy(d->name, bname); - d->name[bnamelen] = tolower(*p); - d->name[bnamelen+1] = '\0'; - - d->func = "INSN"; - dup_slist(&d->args, &args); - - sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup(sufstr); - STAILQ_INSERT_HEAD(&d->args, sv, link); - - add_dir(&insnprefix_byp, "gas", d); - } - - /* And finally the version sans suffix */ - sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup("NONE"); - STAILQ_INSERT_HEAD(&args, sv, link); - - d = yasm_xmalloc(sizeof(dir)); - d->name = yasm__xstrdup(bname); - d->func = "INSN"; - d->args = args; - add_dir(&insnprefix_byp, parser, d); - } -} - -static void -parse_insn(void) -{ - if (!arch) { - report_error("ARCH not defined prior to INSN"); - return; - } - arch->parse_insn(); -} - -static void -parse_cpu(void) -{ - dir *d = parse_generic(CPU, "CPU", &cpu_byp); - sval *sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup("CPU_MODE_VERBATIM"); - STAILQ_INSERT_TAIL(&d->args, sv, link); -} - -static void -parse_cpu_alias(void) -{ - char *parser = check_parser(CPU_ALIAS); - char *name = strtok(NULL, " \t\n"); - char *alias = strtok(NULL, " \t\n"); - dir_list *dirs = get_dirs(&cpu_byp, parser); - dir *aliasd, *d; - - if (!alias) { - report_error("CPU_ALIAS requires an operand"); - return; - } - - STAILQ_FOREACH(aliasd, dirs, link) { - if (strcmp(aliasd->name, alias) == 0) - break; - } - if (!aliasd) { - report_error("could not find `%s'", alias); - return; - } - - d = yasm_xmalloc(sizeof(dir)); - d->name = yasm__xstrdup(name); - d->func = "CPU"; - dup_slist(&d->args, &aliasd->args); - - add_dir(&cpu_byp, parser, d); -} - -static void -parse_cpu_feature(void) -{ - char *parser = check_parser(CPU_FEATURE); - char *name = strtok(NULL, " \t\n"); - dir *name_dir = yasm_xmalloc(sizeof(dir)); - dir *noname_dir = yasm_xmalloc(sizeof(dir)); - sval *sv; - - name_dir->name = yasm__xstrdup(name); - name_dir->func = "CPU_FEATURE"; - parse_args(&name_dir->args); - - noname_dir->name = yasm_xmalloc(strlen(name)+3); - strcpy(noname_dir->name, "no"); - strcat(noname_dir->name, name); - noname_dir->func = name_dir->func; - dup_slist(&noname_dir->args, &name_dir->args); - - sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup("CPU_MODE_SET"); - STAILQ_INSERT_TAIL(&name_dir->args, sv, link); - - sv = yasm_xmalloc(sizeof(sval)); - sv->str = yasm__xstrdup("CPU_MODE_CLEAR"); - STAILQ_INSERT_TAIL(&noname_dir->args, sv, link); - - add_dir(&cpu_byp, parser, name_dir); - add_dir(&cpu_byp, parser, noname_dir); -} - -static void -parse_targetmod(void) -{ - parse_generic(TARGETMOD, "TARGETMOD", ®tmod_byp); -} - -static void -parse_prefix(void) -{ - parse_generic(PREFIX, "PREFIX", &insnprefix_byp); -} - -static void -parse_reg(void) -{ - parse_generic(REG, "REG", ®tmod_byp); -} - -static void -parse_reggroup(void) -{ - parse_generic(REGGROUP, "REGGROUP", ®tmod_byp); -} - -static void -parse_segreg(void) -{ - parse_generic(SEGREG, "SEGREG", ®tmod_byp); -} - -/* make the c output for the perfect hash tab array */ -static void -make_c_tab( - FILE *f, - const char *which, - const char *parser, - bstuff *tab, /* table indexed by b */ - ub4 smax, /* range of scramble[] */ - ub4 blen, /* b in 0..blen-1, power of 2 */ - ub4 *scramble) /* used in final hash */ -{ - ub4 i; - /* table for the mapping for the perfect hash */ - if (blen >= USE_SCRAMBLE) { - /* A way to make the 1-byte values in tab bigger */ - if (smax > UB2MAXVAL+1) { - fprintf(f, "static const unsigned long %s_", which); - if (parser) - fprintf(f, "%s_", parser); - fprintf(f, "scramble[] = {\n"); - for (i=0; i<=UB1MAXVAL; i+=4) - fprintf(f, "0x%.8lx, 0x%.8lx, 0x%.8lx, 0x%.8lx,\n", - scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3]); - } else { - fprintf(f, "static const unsigned short %s_", which); - if (parser) - fprintf(f, "%s_", parser); - fprintf(f, "scramble[] = {\n"); - for (i=0; i<=UB1MAXVAL; i+=8) - fprintf(f, -"0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx,\n", - scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3], - scramble[i+4], scramble[i+5], scramble[i+6], scramble[i+7]); - } - fprintf(f, "};\n"); - fprintf(f, "\n"); - } - - if (blen > 0) { - /* small adjustments to _a_ to make values distinct */ - if (smax <= UB1MAXVAL+1 || blen >= USE_SCRAMBLE) - fprintf(f, "static const unsigned char %s_", which); - else - fprintf(f, "static const unsigned short %s_", which); - if (parser) - fprintf(f, "%s_", parser); - fprintf(f, "tab[] = {\n"); - - if (blen < 16) { - for (i=0; iname_k = yasm__xstrdup(d->name); - k->len_k = (ub4)strlen(d->name); - k->next_k = keys; - keys = k; - nkeys++; - } - - /* find the hash */ - findhash(&tab, &tabh, &alen, &blen, &salt, &final, - scramble, &smax, keys, nkeys, &form); - - /* output the dir table: this should loop up to smax for NORMAL_HP, - * or up to pakd.nkeys for MINIMAL_HP. - */ - fprintf(out, "static const %s_parse_data %s_", which, which); - if (parser) - fprintf(out, "%s_", parser); - fprintf(out, "pd[%lu] = {\n", nkeys); - for (i=0; iname, tabh[i].key_h->name_k) == 0) - break; - } - if (!d) { - report_error("internal error: could not find `%s'", - tabh[i].key_h->name_k); - break; - } - if (cpumode) - fprintf(out, "{\"%s\",", d->name); - else - fprintf(out, "%s(\"%s\",", d->func, d->name); - STAILQ_FOREACH(sv, &d->args, link) { - fprintf(out, " %s", sv->str); - if (STAILQ_NEXT(sv, link)) - fprintf(out, ","); - } - fprintf(out, cpumode ? "}" : ")"); - } else - fprintf(out, " { NULL }"); - - if (i < nkeys-1) - fprintf(out, ","); - fprintf(out, "\n"); - } - fprintf(out, "};\n"); - - /* output the hash tab[] array */ - make_c_tab(out, which, parser, tab, smax, blen, scramble); - - /* The hash function */ - fprintf(out, "#define tab %s_", which); - if (parser) - fprintf(out, "%s_", parser); - fprintf(out, "tab\n"); - fprintf(out, "static const %s_parse_data *\n%s_", which, which); - if (parser) - fprintf(out, "%s_", parser); - fprintf(out, "find(const char *key, size_t len)\n"); - fprintf(out, "{\n"); - fprintf(out, " const %s_parse_data *ret;\n", which); - for (i=0; i= %lu) return NULL;\n", nkeys); - fprintf(out, " ret = &%s_", which); - if (parser) - fprintf(out, "%s_", parser); - fprintf(out, "pd[rsl];\n"); - fprintf(out, " if (strcmp(key, ret->name) != 0) return NULL;\n"); - fprintf(out, " return ret;\n"); - fprintf(out, "}\n"); - fprintf(out, "#undef tab\n\n"); - - free(tab); - free(tabh); -} - -/* Get an entire "real" line from the input file by combining any - * \\\n continuations. - */ -static int get_line(FILE *in) -{ - char *p = line; - cur_line = next_line; - - if (feof(in)) - return 0; - - while (p < &line[1023-128]) { - if (!fgets(p, 128, in)) - return 1; - next_line++; - /* if continuation, strip out leading whitespace */ - if (p > line) { - char *p2 = p; - while (isspace(*p2)) p2++; - if (p2 > p) - memmove(p, p2, strlen(p2)+1); - } - while (*p) p++; - if (p[-2] != '\\' || p[-1] != '\n') { - if (p[-1] == '\n') - p[-1] = '\0'; - return 1; - } - p -= 2; - } - return 0; -} - -static struct { - const char *name; - int indx; - void (*handler) (void); -} directives[] = { - {"ARCH", ARCH, parse_arch}, - {"PARSERS", PARSERS, parse_parsers}, - {"INSN", INSN, parse_insn}, - {"CPU", CPU, parse_cpu}, - {"CPU_ALIAS", CPU_ALIAS, parse_cpu_alias}, - {"CPU_FEATURE", CPU_FEATURE, parse_cpu_feature}, - {"TARGETMOD", TARGETMOD, parse_targetmod}, - {"PREFIX", PREFIX, parse_prefix}, - {"REG", REG, parse_reg}, - {"REGGROUP", REGGROUP, parse_reggroup}, - {"SEGREG", SEGREG, parse_segreg}, -}; - -int -main(int argc, char *argv[]) -{ - FILE *in, *out; - size_t i; - char *tok; - int count[NUM_DIRS]; - dir_byp *db; - - for (i=0; i \n"); - return EXIT_FAILURE; - } - - in = fopen(argv[1], "rt"); - if (!in) { - fprintf(stderr, "Could not open `%s' for reading\n", argv[1]); - return EXIT_FAILURE; - } - - STAILQ_INIT(&insnprefix_byp); - STAILQ_INIT(&cpu_byp); - STAILQ_INIT(®tmod_byp); - - /* Parse input file */ - while (get_line(in)) { - int found; - /*printf("%s\n", line);*/ - tok = strtok(line, " \t\n"); - if (!tok) - continue; - - /* Comments start with # as the first thing on a line */ - if (tok[0] == '#') - continue; - - /* Look for directive */ - found = 0; - for (i=0; i 0) - return EXIT_FAILURE; - - out = fopen(argv[2], "wt"); - if (!out) { - fprintf(stderr, "Could not open `%s' for writing\n", argv[2]); - return EXIT_FAILURE; - } - - /* Get perfect hashes for the three lists of directives */ - STAILQ_FOREACH(db, &insnprefix_byp, link) - perfect_dir(out, "insnprefix", db->parser, &db->dirs); - STAILQ_FOREACH(db, &cpu_byp, link) - perfect_dir(out, "cpu", db->parser, &db->dirs); - STAILQ_FOREACH(db, ®tmod_byp, link) - perfect_dir(out, "regtmod", db->parser, &db->dirs); - - if (errors > 0) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - diff --git a/tools/gencheck.py b/tools/gencheck.py new file mode 100755 index 00000000..6c25709e --- /dev/null +++ b/tools/gencheck.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# Generate expected binary hexdump output from specially formatted asm file. +# +# Copyright (C) 2009 Peter Johnson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +def gen_expected(fout, fin): + count = 0 + for line in fin: + if not line: + continue + if line.startswith(';'): + continue + # extract portion after ; character + (insn, sep, comment) = line.partition(';') + if not sep: + continue # ; not found + # comment must be formatted as 2-char hex and/or 3-char octal bytes + # separated by spaces + bytes = [] + for byte in comment.split(): + if len(byte) == 2: + bytes.append(int(byte, 16)) + elif len(byte) == 3: + bytes.append(int(byte, 8)) + else: + break + for byte in bytes: + print >>fout, "%02x " % byte + count += 1 + print "Processed %d instructions" % count + + +if __name__ == "__main__": + import sys + if len(sys.argv) != 3: + print >>sys.stderr, "Usage: gencheck.py " + sys.exit(2) + gen_expected(open(sys.argv[2], "w"), open(sys.argv[1], "r")) diff --git a/tools/genmacro/CMakeLists.txt b/tools/genmacro/CMakeLists.txt new file mode 100644 index 00000000..9e8933b0 --- /dev/null +++ b/tools/genmacro/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(genmacro + genmacro.c + ) + +if(CMAKE_CROSSCOMPILING) + find_program(GENMACRO_BIN NAMES genmacro REQUIRED) + add_executable(yasm::genmacro IMPORTED GLOBAL) + set_property(TARGET yasm::genmacro PROPERTY IMPORTED_LOCATION "${GENMACRO_BIN}") +else() + add_executable(yasm::genmacro ALIAS genmacro) +endif() diff --git a/tools/genmacro/Makefile.inc b/tools/genmacro/Makefile.inc new file mode 100644 index 00000000..722f95da --- /dev/null +++ b/tools/genmacro/Makefile.inc @@ -0,0 +1,14 @@ +# These utility programs have to be built for BUILD host in cross-build. +# This makes things rather non-standard automake + +noinst_PROGRAMS += genmacro + +genmacro_SOURCES = +EXTRA_DIST += tools/genmacro/genmacro.c +genmacro_LDADD = genmacro.$(OBJEXT) +genmacro_LINK = $(CCLD_FOR_BUILD) -o $@ + +genmacro.$(OBJEXT): tools/genmacro/genmacro.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c + diff --git a/modules/preprocs/nasm/genmacro.c b/tools/genmacro/genmacro.c similarity index 80% rename from modules/preprocs/nasm/genmacro.c rename to tools/genmacro/genmacro.c index e6f40193..73901bfc 100644 --- a/modules/preprocs/nasm/genmacro.c +++ b/tools/genmacro/genmacro.c @@ -1,8 +1,8 @@ -/* $Id$ +/* * * C version of NASM's macros.pl * - * Copyright (C) 2004-2007 Peter Johnson + * Copyright (C) 2004-2008 Peter Johnson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,7 +29,6 @@ #include #include -#define OUTPUT "nasm-macros.c" #define MAXLINE 1024 int @@ -41,20 +40,17 @@ main(int argc, char *argv[]) char *strp; char *charp; int fline; - int line = 0; - int lindex = 0; - int tasm_count = -1; size_t len; - if (argc < 2) { - fprintf(stderr, "Usage: %s [ ...]\n", argv[0]); + if (argc < 4) { + fprintf(stderr, "Usage: %s [ ...]\n", argv[0]); return EXIT_FAILURE; } - out = fopen(OUTPUT, "wt"); + out = fopen(argv[1], "wt"); if (!out) { - fprintf(stderr, "Could not open `%s'.\n", OUTPUT); + fprintf(stderr, "Could not open `%s'.\n", argv[1]); return EXIT_FAILURE; } @@ -62,21 +58,20 @@ main(int argc, char *argv[]) fprintf(out, "/* This file auto-generated from standard.mac by genmacro.c" " - don't edit it */\n\n#include \n\n" - "static const char *stdmac[] = {\n"); + "static const char *%s[] = {\n", argv[2]); - for (i=1; i 0 && (strp[len-1] == ' ' || strp[len-1] == '\t' || - strp[len-1] == '\n')) { + strp[len-1] == '\r' || strp[len-1] == '\n')) { strp[len-1] = '\0'; len--; } @@ -112,12 +107,6 @@ main(int argc, char *argv[]) if (len == 0) continue; - /* check for special TASM ending token */ - if (strcmp(strp, "*END*TASM*MACROS*") == 0) { - tasm_count = lindex; - continue; - } - /* output as string to output file */ fprintf(out, " \""); while (*strp != '\0') { @@ -127,16 +116,12 @@ main(int argc, char *argv[]) strp++; } fprintf(out, "\",\n"); - lindex++; } fclose(in); } fprintf(out, " NULL\n};\n"); - if (tasm_count == -1) - tasm_count = lindex; - fprintf(out, "#define TASM_MACRO_COUNT %d\n", tasm_count); fclose(out); free(str); diff --git a/tools/genperf/CMakeLists.txt b/tools/genperf/CMakeLists.txt new file mode 100644 index 00000000..c9db7c11 --- /dev/null +++ b/tools/genperf/CMakeLists.txt @@ -0,0 +1,16 @@ +add_executable(genperf + genperf.c + perfect.c + ../../libyasm/phash.c + ../../libyasm/xmalloc.c + ../../libyasm/xstrdup.c + ) +set_target_properties(genperf PROPERTIES COMPILE_FLAGS -DYASM_LIB_DECL=) + +if(CMAKE_CROSSCOMPILING) + find_program(GENPERF_BIN NAMES genperf REQUIRED) + add_executable(yasm::genperf IMPORTED GLOBAL) + set_property(TARGET yasm::genperf PROPERTY IMPORTED_LOCATION "${GENPERF_BIN}") +else() + add_executable(yasm::genperf ALIAS genperf) +endif() diff --git a/tools/genperf/Makefile.inc b/tools/genperf/Makefile.inc new file mode 100644 index 00000000..135da6b9 --- /dev/null +++ b/tools/genperf/Makefile.inc @@ -0,0 +1,42 @@ +# These utility programs have to be built for BUILD host in cross-build. +# This makes things rather non-standard automake + +noinst_PROGRAMS += genperf + +# Suffix rule for genperf +SUFFIXES += .gperf +.gperf.c: genperf$(EXEEXT) + $(top_builddir)/genperf$(EXEEXT) $< $@ + +genperf_SOURCES = +EXTRA_DIST += tools/genperf/genperf.c +EXTRA_DIST += tools/genperf/perfect.c +EXTRA_DIST += tools/genperf/perfect.h +EXTRA_DIST += tools/genperf/standard.h +genperf_LDADD = genperf.$(OBJEXT) +genperf_LDADD += gp-perfect.$(OBJEXT) +genperf_LDADD += gp-phash.$(OBJEXT) +genperf_LDADD += gp-xmalloc.$(OBJEXT) +genperf_LDADD += gp-xstrdup.$(OBJEXT) +genperf_LINK = $(CCLD_FOR_BUILD) -o $@ + +genperf.$(OBJEXT): tools/genperf/genperf.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c + +gp-perfect.$(OBJEXT): tools/genperf/perfect.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c + +gp-phash.$(OBJEXT): libyasm/phash.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c + +gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c + +gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c + diff --git a/tools/genperf/genperf.c b/tools/genperf/genperf.c new file mode 100644 index 00000000..073b7502 --- /dev/null +++ b/tools/genperf/genperf.c @@ -0,0 +1,540 @@ +/* + * + * Generate Minimal Perfect Hash (genperf) + * + * Copyright (C) 2006-2007 Peter Johnson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include +#include "tools/genperf/perfect.h" +#include "libyasm/compat-queue.h" +#include "libyasm/coretype.h" +#include "libyasm/errwarn.h" + +typedef STAILQ_HEAD(slist, sval) slist; +typedef struct sval { + STAILQ_ENTRY(sval) link; + char *str; +} sval; + +typedef STAILQ_HEAD(keyword_list, keyword) keyword_list; +typedef struct keyword { + STAILQ_ENTRY(keyword) link; + char *name; + char *args; + unsigned int line; +} keyword; + +static unsigned int cur_line = 1; +static int errors = 0; + +static void +report_error(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "%u: ", cur_line); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputc('\n', stderr); + errors++; +} + +void +yasm__fatal(const char *message, ...) +{ + abort(); +} + +/* make the c output for the perfect hash tab array */ +static void +make_c_tab( + FILE *f, + bstuff *tab, /* table indexed by b */ + ub4 smax, /* range of scramble[] */ + ub4 blen, /* b in 0..blen-1, power of 2 */ + ub4 *scramble) /* used in final hash */ +{ + ub4 i; + /* table for the mapping for the perfect hash */ + if (blen >= USE_SCRAMBLE) { + /* A way to make the 1-byte values in tab bigger */ + if (smax > UB2MAXVAL+1) { + fprintf(f, " static const unsigned long scramble[] = {\n"); + for (i=0; i<=UB1MAXVAL; i+=4) + fprintf(f, " 0x%.8lx, 0x%.8lx, 0x%.8lx, 0x%.8lx,\n", + scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3]); + } else { + fprintf(f, " static const unsigned short scramble[] = {\n"); + for (i=0; i<=UB1MAXVAL; i+=8) + fprintf(f, +" 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx,\n", + scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3], + scramble[i+4], scramble[i+5], scramble[i+6], scramble[i+7]); + } + fprintf(f, " };\n"); + fprintf(f, "\n"); + } + + if (blen > 0) { + /* small adjustments to _a_ to make values distinct */ + if (smax <= UB1MAXVAL+1 || blen >= USE_SCRAMBLE) + fprintf(f, " static const unsigned char "); + else + fprintf(f, " static const unsigned short "); + fprintf(f, "tab[] = {\n"); + + if (blen < 16) { + for (i=0; iname_k = yasm__xstrdup(kw->name); + k->len_k = (ub4)strlen(kw->name); + k->next_k = keys; + keys = k; + nkeys++; + } + + /* find the hash */ + findhash(&tab, &tabh, &alen, &blen, &salt, &final, + scramble, &smax, keys, nkeys, &form); + + /* The hash function beginning */ + fprintf(out, "static const struct %s *\n", struct_name); + fprintf(out, "%s(const char *key, size_t len)\n", lookup_function_name); + fprintf(out, "{\n"); + + /* output the dir table: this should loop up to smax for NORMAL_HP, + * or up to pakd.nkeys for MINIMAL_HP. + */ + fprintf(out, " static const struct %s pd[%lu] = {\n", struct_name, nkeys); + for (i=0; iname, tabh[i].key_h->name_k) == 0) + break; + } + if (!kw) { + report_error("internal error: could not find `%s'", + tabh[i].key_h->name_k); + break; + } + fprintf(out, "#line %u \"%s\"\n", kw->line, filename); + fprintf(out, " {\"%s\"%s}", kw->name, kw->args); + } else + fprintf(out, " { NULL }"); + + if (i < nkeys-1) + fprintf(out, ","); + fprintf(out, "\n"); + } + fprintf(out, " };\n"); + + /* output the hash tab[] array */ + make_c_tab(out, tab, smax, blen, scramble); + + /* The hash function body */ + fprintf(out, " const struct %s *ret;\n", struct_name); + for (i=0; i= %lu) return NULL;\n", nkeys); + fprintf(out, " ret = &pd[rsl];\n"); + fprintf(out, " if (strcmp(key, ret->name) != 0) return NULL;\n"); + fprintf(out, " return ret;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + + yasm_xfree(tab); + yasm_xfree(tabh); +} + +int +main(int argc, char *argv[]) +{ + FILE *in, *out; + size_t i; + char *ch; + static char line[1024], tmp[1024]; + static char struct_name[128] = ""; + static char lookup_function_name[128] = "in_word_set"; + static char language[16] = ""; + static char delimiters[16] = ",\r\n"; + static char name[128]; + static char filename[768]; + int need_struct = 0; + int have_struct = 0; + int go_keywords = 0; + int ignore_case = 0; + int compare_strncmp = 0; + int readonly_tables = 0; + slist usercode, usercode2; + keyword_list keywords; + sval *sv; + keyword *kw; + + if (argc != 3) { + fprintf(stderr, "Usage: genperf \n"); + return EXIT_FAILURE; + } + + in = fopen(argv[1], "rt"); + if (!in) { + fprintf(stderr, "Could not open `%s' for reading\n", argv[1]); + return EXIT_FAILURE; + } + + ch = argv[1]; + i = 0; + while (*ch && i < 767) { + if (*ch == '\\') { + filename[i++] = '/'; + ch++; + } else + filename[i++] = *ch++; + } + filename[i] = '\0'; + + STAILQ_INIT(&usercode); + STAILQ_INIT(&usercode2); + STAILQ_INIT(&keywords); + + /* Parse declarations section */ + while (fgets(line, 1024, in)) { + /* Comments start with # as the first thing on a line */ + if (line[0] == '#') { + cur_line++; + continue; + } + + /* Handle structure declaration */ + if (strncmp(line, "struct", 6) == 0) { + int braces; + + if (!need_struct) { + report_error("struct without %%struct-type declaration"); + return EXIT_FAILURE; + } + if (have_struct) { + report_error("more than one struct declaration"); + return EXIT_FAILURE; + } + have_struct = 1; + + /* copy struct name */ + ch = &line[6]; + while (isspace(*ch)) + ch++; + i = 0; + while ((isalnum(*ch) || *ch == '_') && i < 127) + struct_name[i++] = *ch++; + if (i == 127) { + report_error("struct name too long"); + return EXIT_FAILURE; + } + struct_name[i] = '\0'; + + sv = yasm_xmalloc(sizeof(sval)); + sprintf(tmp, "#line %u \"%s\"\n", cur_line, filename); + sv->str = yasm__xstrdup(tmp); + STAILQ_INSERT_TAIL(&usercode, sv, link); + + braces = 0; + do { + /* count braces to determine when we're done */ + ch = line; + while (*ch != '\0') { + if (*ch == '{') + braces++; + if (*ch == '}') + braces--; + ch++; + } + sv = yasm_xmalloc(sizeof(sval)); + sv->str = yasm__xstrdup(line); + STAILQ_INSERT_TAIL(&usercode, sv, link); + cur_line++; + if (braces <= 0) + break; + } while (fgets(line, 1024, in)); + cur_line++; + continue; + } + + /* Ignore non-declaration lines */ + if (line[0] != '%') { + cur_line++; + continue; + } + + /* %% terminates declarations section */ + if (line[1] == '%') { + if (need_struct && !have_struct) { + report_error("%%struct-type declaration, but no struct found"); + return EXIT_FAILURE; + } + go_keywords = 1; + break; /* move on to keywords section */ + } + + /* %{ begins a verbatim code section that ends with %} */ + if (line[1] == '{') { + sv = yasm_xmalloc(sizeof(sval)); + sprintf(tmp, "#line %u \"%s\"\n\n", cur_line, filename); + sv->str = yasm__xstrdup(tmp); + STAILQ_INSERT_TAIL(&usercode, sv, link); + + while (fgets(line, 1024, in)) { + cur_line++; + if (line[0] == '%' && line[1] == '}') + break; + sv = yasm_xmalloc(sizeof(sval)); + sv->str = yasm__xstrdup(line); + STAILQ_INSERT_TAIL(&usercode, sv, link); + } + cur_line++; + continue; + } + + if (strncmp(&line[1], "ignore-case", 11) == 0) { + ignore_case = 1; + } else if (strncmp(&line[1], "compare-strncmp", 15) == 0) { + compare_strncmp = 1; + } else if (strncmp(&line[1], "readonly-tables", 15) == 0) { + readonly_tables = 1; + } else if (strncmp(&line[1], "language=", 9) == 0) { + ch = &line[10]; + i = 0; + while (*ch != '\n' && i<15) + language[i++] = *ch++; + language[i] = '\0'; + } else if (strncmp(&line[1], "delimiters=", 11) == 0) { + ch = &line[12]; + i = 0; + while (i<15) + delimiters[i++] = *ch++; + delimiters[i] = '\0'; + } else if (strncmp(&line[1], "enum", 4) == 0) { + /* unused */ + } else if (strncmp(&line[1], "struct-type", 11) == 0) { + need_struct = 1; + } else if (strncmp(&line[1], "define", 6) == 0) { + /* Several different defines we need to handle */ + ch = &line[7]; + while (isspace(*ch)) + ch++; + + if (strncmp(ch, "hash-function-name", 18) == 0) { + /* unused */ + } else if (strncmp(ch, "lookup-function-name", 20) == 0) { + ch = &line[7+20+1]; + while (isspace(*ch)) + ch++; + i = 0; + while ((isalnum(*ch) || *ch == '_') && i < 127) + lookup_function_name[i++] = *ch++; + if (i == 127) { + report_error("struct name too long"); + return EXIT_FAILURE; + } + lookup_function_name[i] = '\0'; + } else { + fprintf(stderr, "%u: unrecognized define `%s'\n", cur_line, + line); + } + } else { + fprintf(stderr, "%u: unrecognized declaration `%s'\n", cur_line, + line); + } + + cur_line++; + } + + if (!go_keywords) { + report_error("no keywords section found"); + return EXIT_FAILURE; + } + + /* Parse keywords section */ + while (fgets(line, 1024, in)) { + char *d; + + /* Comments start with # as the first thing on a line */ + if (line[0] == '#') { + cur_line++; + continue; + } + + /* Keywords section terminated with %% */ + if (line[0] == '%' && line[1] == '%') + break; + + /* Look for name */ + ch = &line[0]; + i = 0; + while (strchr(delimiters, *ch) == NULL && i < 127) + name[i++] = *ch++; + if (i == 127) { + report_error("keyword name too long"); + return EXIT_FAILURE; + } + name[i] = '\0'; + + /* Strip EOL */ + d = strrchr(ch, '\n'); + if (d) + *d = '\0'; + d = strrchr(ch, '\r'); + if (d) + *d = '\0'; + kw = yasm_xmalloc(sizeof(keyword)); + kw->name = yasm__xstrdup(name); + kw->args = yasm__xstrdup(ch); + kw->line = cur_line; + STAILQ_INSERT_TAIL(&keywords, kw, link); + cur_line++; + } + + if (errors > 0) + return EXIT_FAILURE; + + /* Pull in any end code */ + if (!feof(in)) { + sv = yasm_xmalloc(sizeof(sval)); + sprintf(tmp, "#line %u \"%s\"\n\n", cur_line, filename); + sv->str = yasm__xstrdup(tmp); + STAILQ_INSERT_TAIL(&usercode2, sv, link); + + while (fgets(line, 1024, in)) { + sv = yasm_xmalloc(sizeof(sval)); + sv->str = yasm__xstrdup(line); + STAILQ_INSERT_TAIL(&usercode2, sv, link); + } + } + + /* output code */ + out = fopen(argv[2], "wt"); + if (!out) { + fprintf(stderr, "Could not open `%s' for writing\n", argv[2]); + return EXIT_FAILURE; + } + + fprintf(out, "/* %s code produced by genperf */\n", language); + fprintf(out, "/* Command-line: genperf %s %s */\n", argv[1], argv[2]); + + STAILQ_FOREACH(sv, &usercode, link) + fprintf(out, "%s", sv->str); + + /* Get perfect hash */ + perfect_gen(out, lookup_function_name, struct_name, &keywords, filename); + + STAILQ_FOREACH(sv, &usercode2, link) + fprintf(out, "%s", sv->str); + + fclose(out); + + if (errors > 0) { + remove(argv[2]); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + diff --git a/tools/gap/perfect.c b/tools/genperf/perfect.c similarity index 97% rename from tools/gap/perfect.c rename to tools/genperf/perfect.c index d1218040..318cb5e6 100644 --- a/tools/gap/perfect.c +++ b/tools/genperf/perfect.c @@ -1,6 +1,4 @@ -/* Modified for use with yasm by Peter Johnson. - * $Id$ - */ +/* Modified for use with yasm by Peter Johnson. */ /* ------------------------------------------------------------------------------ perfect.c: code to generate code for a hash for perfect hashing. @@ -50,10 +48,10 @@ determined a perfect hash for the whole set of keys. */ #include -#include "tools/gap/standard.h" +#include "tools/genperf/standard.h" #include "libyasm/coretype.h" #include "libyasm/phash.h" -#include "tools/gap/perfect.h" +#include "tools/genperf/perfect.h" #define CHECKSTATE 8 @@ -64,8 +62,7 @@ Find the mapping that will produce a perfect hash */ /* return the ceiling of the log (base 2) of val */ -ub4 phash_log2(val) -ub4 val; +ub4 phash_log2(ub4 val) { ub4 i; for (i=0; ((ub4)1<perfect == MINIMAL_HP) { - printf("fatal error: Cannot find perfect hash for user (A,B) pairs\n"); + fprintf(stderr, "fatal error: Cannot find perfect hash for user (A,B) pairs\n"); exit(EXIT_FAILURE); } else { /* try with 2*smax */ - free((void *)tabh); + yasm_xfree((void *)tabh); *smax = *smax * 2; scrambleinit(scramble, *smax); tabh = (hstuff *)yasm_xmalloc(sizeof(hstuff)*(form->perfect == MINIMAL_HP ? nkeys : *smax)); if (!perfect(*tabb, tabh, tabq, *blen, *smax, scramble, nkeys, form)) { - printf("fatal error: Cannot find perfect hash for user (A,B) pairs\n"); + fprintf(stderr, "fatal error: Cannot find perfect hash for user (A,B) pairs\n"); exit(EXIT_FAILURE); } } @@ -673,10 +670,8 @@ static void hash_ab( sprintf(final->line[0], " unsigned long rsl = (a ^ scramble[tab[b]]);\n"); } - printf("success, found a perfect hash\n"); - - free((void *)tabq); - free((void *)tabh); + yasm_xfree((void *)tabq); + yasm_xfree((void *)tabh); } @@ -754,6 +749,7 @@ static void initalen( case 0: *alen = 1; *blen = 1; + break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: *alen = (form->perfect == NORMAL_HP) ? *smax : *smax/2; *blen = *smax/2; @@ -886,15 +882,15 @@ void findhash( else if (*blen < *smax) { *blen *= 2; - free(tabq); - free(*tabb); + yasm_xfree(tabq); + yasm_xfree(*tabb); *tabb = (bstuff *)yasm_xmalloc((size_t)(sizeof(bstuff)*(*blen))); tabq = (qstuff *)yasm_xmalloc((size_t)(sizeof(qstuff)*(*blen+1))); } else { duplicates(*tabb, *blen, keys, form); /* check for duplicates */ - printf("fatal error: Cannot perfect hash: cannot find distinct (A,B)\n"); + fprintf(stderr, "fatal error: Cannot perfect hash: cannot find distinct (A,B)\n"); exit(EXIT_FAILURE); } bad_initkey = 0; @@ -903,8 +899,6 @@ void findhash( continue; /* two keys have same (a,b) pair */ } - printf("found distinct (A,B) on attempt %ld\n", trysalt); - /* Given distinct (A,B) for all keys, build a perfect hash */ if (!perfect(*tabb, *tabh, tabq, *blen, *smax, scramble, nkeys, form)) { @@ -914,15 +908,15 @@ void findhash( if (*blen < *smax) { *blen *= 2; - free(*tabb); - free(tabq); + yasm_xfree(*tabb); + yasm_xfree(tabq); *tabb = (bstuff *)yasm_xmalloc((size_t)(sizeof(bstuff)*(*blen))); tabq = (qstuff *)yasm_xmalloc((size_t)(sizeof(qstuff)*(*blen+1))); --trysalt; /* we know this salt got distinct (A,B) */ } else { - printf("fatal error: Cannot perfect hash: cannot build tab[]\n"); + fprintf(stderr, "fatal error: Cannot perfect hash: cannot build tab[]\n"); exit(EXIT_FAILURE); } bad_perfect = 0; @@ -934,10 +928,8 @@ void findhash( break; } - printf("built perfect hash table of size %ld\n", *blen); - /* free working memory */ - free((void *)tabq); + yasm_xfree((void *)tabq); } #if 0 @@ -1145,7 +1137,6 @@ hashform *form; /* user directives */ /* read in the list of keywords */ getkeys(&keys, &nkeys, textroot, keyroot, form); - printf("Read in %ld keys\n",nkeys); /* find the hash */ findhash(&tab, &alen, &blen, &salt, &final, @@ -1153,13 +1144,11 @@ hashform *form; /* user directives */ /* generate the phash.c file */ make_c(tab, smax, blen, scramble, &final, form); - printf("Wrote phash.c\n"); /* clean up memory sources */ refree(textroot); refree(keyroot); - free((void *)tab); - printf("Cleaned up\n"); + yasm_xfree((void *)tab); } diff --git a/tools/gap/perfect.h b/tools/genperf/perfect.h similarity index 100% rename from tools/gap/perfect.h rename to tools/genperf/perfect.h diff --git a/tools/gap/standard.h b/tools/genperf/standard.h similarity index 100% rename from tools/gap/standard.h rename to tools/genperf/standard.h diff --git a/tools/python-yasm/Makefile.inc b/tools/python-yasm/Makefile.inc index 9a1193c7..fce135b4 100644 --- a/tools/python-yasm/Makefile.inc +++ b/tools/python-yasm/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - PYBINDING_DEPS = tools/python-yasm/bytecode.pxi PYBINDING_DEPS += tools/python-yasm/errwarn.pxi PYBINDING_DEPS += tools/python-yasm/expr.pxi @@ -20,7 +18,7 @@ EXTRA_DIST += tools/python-yasm/setup.py EXTRA_DIST += tools/python-yasm/yasm.pyx EXTRA_DIST += $(PYBINDING_DEPS) -if HAVE_PYTHON +if HAVE_PYTHON_BINDINGS # Use Pyxelator to generate Pyrex function headers. _yasm.pxi: ${HEADERS} @@ -40,9 +38,9 @@ yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx CLEANFILES += yasm.pyx -# Actually run Pyrex +# Actually run Cython yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS) - $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \ + $(PYTHON) -c "from Cython.Compiler.Main import main; main(command_line=1)" \ -o $@ yasm.pyx CLEANFILES += yasm_python.c @@ -50,13 +48,13 @@ CLEANFILES += yasm_python.c # Now the Python build magic... python-setup.txt: Makefile echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt - echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt + echo "sources=${libyasm_a_SOURCES} ${nodist_libyasm_a_SOURCES}" >> python-setup.txt echo "srcdir=${srcdir}" >> python-setup.txt echo "gcc=${GCC}" >> python-setup.txt CLEANFILES += python-setup.txt -.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES} +.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES} ${nodist_libyasm_a_SOURCES} $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build touch .python-build python-build: .python-build diff --git a/tools/python-yasm/bytecode.pxi b/tools/python-yasm/bytecode.pxi index 8a077b0d..34aeaa57 100644 --- a/tools/python-yasm/bytecode.pxi +++ b/tools/python-yasm/bytecode.pxi @@ -28,7 +28,7 @@ cdef class Bytecode: cdef object __weakref__ # make weak-referenceable - def __new__(self, bc): + def __cinit__(self, bc): self.bc = NULL if PyCObject_Check(bc): self.bc = __get_voidp(bc, Bytecode) @@ -93,9 +93,9 @@ cdef object __make_bytecode(yasm_bytecode *bc): return bcobj # Org bytecode -def __org__new__(cls, start, line=0): +def __org__new__(cls, start, value=0, line=0): cdef yasm_bytecode *bc - bc = yasm_bc_create_org(start, line) + bc = yasm_bc_create_org(start, line, value) obj = Bytecode.__new__(cls, __pass_voidp(bc, Bytecode)) __bytecode_map[PyCObject_FromVoidPtr(bc, NULL)] = obj return obj diff --git a/tools/python-yasm/expr.pxi b/tools/python-yasm/expr.pxi index dea75d78..995a46ad 100644 --- a/tools/python-yasm/expr.pxi +++ b/tools/python-yasm/expr.pxi @@ -59,7 +59,7 @@ cdef object __make_expression(yasm_expr *expr): cdef class Expression: cdef yasm_expr *expr - def __new__(self, op, *args, **kwargs): + def __cinit__(self, op, *args, **kwargs): self.expr = NULL if isinstance(op, Expression): diff --git a/tools/python-yasm/floatnum.pxi b/tools/python-yasm/floatnum.pxi index 3939056f..b7bfbc30 100644 --- a/tools/python-yasm/floatnum.pxi +++ b/tools/python-yasm/floatnum.pxi @@ -25,7 +25,7 @@ cdef class FloatNum: cdef yasm_floatnum *flt - def __new__(self, value): + def __cinit__(self, value): self.flt = NULL if isinstance(value, FloatNum): self.flt = yasm_floatnum_copy((value).flt) diff --git a/tools/python-yasm/intnum.pxi b/tools/python-yasm/intnum.pxi index f99769e6..320ca1b0 100644 --- a/tools/python-yasm/intnum.pxi +++ b/tools/python-yasm/intnum.pxi @@ -57,7 +57,7 @@ cdef object __make_intnum(yasm_intnum *intn): cdef class IntNum: cdef yasm_intnum *intn - def __new__(self, value, base=None): + def __cinit__(self, value, base=None): cdef unsigned char buf[16] self.intn = NULL @@ -115,7 +115,7 @@ cdef class IntNum: def __neg__(self): return __intnum_op(self, YASM_EXPR_NEG, None) def __pos__(self): return self def __abs__(self): - if yasm_intnum_sign(self.intn) >= 0: return self + if yasm_intnum_sign(self.intn) >= 0: return IntNum(self) else: return __intnum_op(self, YASM_EXPR_NEG, None) def __nonzero__(self): return not yasm_intnum_is_zero(self.intn) def __invert__(self): return __intnum_op(self, YASM_EXPR_NOT, None) diff --git a/tools/python-yasm/pyxelator/genpyx.py b/tools/python-yasm/pyxelator/genpyx.py index 00cfa3f5..3f2a4cc2 100755 --- a/tools/python-yasm/pyxelator/genpyx.py +++ b/tools/python-yasm/pyxelator/genpyx.py @@ -16,7 +16,6 @@ So, for example, when we refer to Node we get ir.Node . import sys from datetime import datetime -from sets import Set # XX use this Context class instead of all those kw dicts !! XX class Context(object): diff --git a/tools/python-yasm/pyxelator/work_unit.py b/tools/python-yasm/pyxelator/work_unit.py index 0d888f8b..31ab3e56 100755 --- a/tools/python-yasm/pyxelator/work_unit.py +++ b/tools/python-yasm/pyxelator/work_unit.py @@ -16,6 +16,18 @@ import os import cparse import ir +def callcmd(cmd): + try: + from subprocess import call + try: + retcode = call(cmd, shell=True) + assert retcode == 0, "command failed: %s"%cmd + except OSError, e: + assert False, "command failed: %s"%e + except ImportError: + status = os.system( cmd ) + assert status == 0, "command failed: %s"%cmd + class WorkUnit(object): def __init__(self, files, modname, filename, std=False, strip=False, mark_cb=None, @@ -62,13 +74,11 @@ class WorkUnit(object): ifile.close() cmd = '%s %s %s > %s'%(self.CPP,name+'.h',self.CPPFLAGS,name+'.E') sys.stderr.write( "# %s\n" % cmd ) - status = os.system( cmd ) - assert status == 0, "command failed: %s"%cmd + callcmd( cmd ) assert open(name+'.E').read().count('\n') > 10, "failed to run preprocessor" cmd = '%s -dM %s %s > %s'%(self.CPP,name+'.h',self.CPPFLAGS,name+'.dM') sys.stderr.write( "# %s\n" % cmd ) - status = os.system( cmd ) - assert status == 0, "command failed: %s"%cmd + callcmd( cmd ) assert open(name+'.dM').read().count('\n') > 10, "failed to run preprocessor with -dM" return name @@ -157,7 +167,12 @@ def get_syms(libs, libdirs): accept = [ ' %s '%c for c in 'TVWBCDGRS' ] #f = open('syms.out','w') for libname in libnames: - fin, fout = os.popen2( 'nm %s' % libname ) + try: + from subprocess import Popen, PIPE + p = Popen(['nm', libname], bufsize=1, stdout=PIPE) + fout = p.stdout + except ImportError: + fin, fout = os.popen2( 'nm %s' % libname ) for line in fout.readlines(): for acc in accept: if line.count(acc): diff --git a/tools/python-yasm/pyxelator/wrap_yasm.py b/tools/python-yasm/pyxelator/wrap_yasm.py index 45ee6237..58553ab2 100755 --- a/tools/python-yasm/pyxelator/wrap_yasm.py +++ b/tools/python-yasm/pyxelator/wrap_yasm.py @@ -25,7 +25,7 @@ def mk_tao(CPPFLAGS = "", CPP = "gcc -E", modname = '_yasm', oname = None, YASM_ CPPFLAGS += " -DYASM_LIB_INTERNAL" CPPFLAGS += " -DYASM_BC_INTERNAL" CPPFLAGS += " -DYASM_EXPR_INTERNAL" - files = [ 'libyasm.h', 'libyasm/assocdat.h' ] + files = [ 'libyasm.h', 'libyasm/assocdat.h', 'libyasm/bitvect.h' ] syms = get_syms( ['yasm'], [YASM_DIR] ) def cb(trans_unit, node, *args): diff --git a/tools/python-yasm/setup.py b/tools/python-yasm/setup.py index 60e2364d..d4ce2f44 100644 --- a/tools/python-yasm/setup.py +++ b/tools/python-yasm/setup.py @@ -26,7 +26,7 @@ from distutils.core import setup from distutils.extension import Extension -from Pyrex.Distutils import build_ext +from Cython.Distutils import build_ext from os.path import basename, join, exists def ReadSetup(filename): @@ -52,8 +52,6 @@ def ParseSources(src, srcdir): for tok in src.split(): if tok.endswith(".c"): fn = tok - elif tok.endswith(".y"): - fn = basename(tok)[:-2] + ".c" else: continue if not exists(fn): @@ -74,8 +72,6 @@ def RunSetup(incldir, cppflags, sources): sources=sources, extra_compile_args=cppflags, include_dirs=incldir, - library_dirs=['.'], - libraries=['yasm'], ), ], cmdclass = dict(build_ext=build_ext), diff --git a/tools/python-yasm/symrec.pxi b/tools/python-yasm/symrec.pxi index d91fe7f5..eb56ccf0 100644 --- a/tools/python-yasm/symrec.pxi +++ b/tools/python-yasm/symrec.pxi @@ -26,7 +26,7 @@ cdef class Symbol: cdef yasm_symrec *sym - def __new__(self, symrec): + def __cinit__(self, symrec): self.sym = NULL if PyCObject_Check(symrec): self.sym = __get_voidp(symrec, Symbol) @@ -43,15 +43,15 @@ cdef class Symbol: cdef yasm_sym_status status s = set() status = yasm_symrec_get_status(self.sym) - if status & SYM_USED: s.add('used') - if status & SYM_DEFINED: s.add('defined') - if status & SYM_VALUED: s.add('valued') + if status & YASM_SYM_USED: s.add('used') + if status & YASM_SYM_DEFINED: s.add('defined') + if status & YASM_SYM_VALUED: s.add('valued') return s property in_table: def __get__(self): return bool(yasm_symrec_get_status(self.sym) & - SYM_NOTINTABLE) + YASM_SYM_NOTINTABLE) property visibility: def __get__(self): @@ -124,7 +124,7 @@ cdef class SymbolTable cdef class SymbolTableKeyIterator: cdef yasm_symtab_iter *iter - def __new__(self, symtab): + def __cinit__(self, symtab): if not isinstance(symtab, SymbolTable): raise TypeError self.iter = yasm_symtab_first((symtab).symtab) @@ -142,7 +142,7 @@ cdef class SymbolTableKeyIterator: cdef class SymbolTableValueIterator: cdef yasm_symtab_iter *iter - def __new__(self, symtab): + def __cinit__(self, symtab): if not isinstance(symtab, SymbolTable): raise TypeError self.iter = yasm_symtab_first((symtab).symtab) @@ -160,7 +160,7 @@ cdef class SymbolTableValueIterator: cdef class SymbolTableItemIterator: cdef yasm_symtab_iter *iter - def __new__(self, symtab): + def __cinit__(self, symtab): if not isinstance(symtab, SymbolTable): raise TypeError self.iter = yasm_symtab_first((symtab).symtab) @@ -190,7 +190,7 @@ cdef int __parse_vis(vis) except -1: cdef class SymbolTable: cdef yasm_symtab *symtab - def __new__(self): + def __cinit__(self): self.symtab = yasm_symtab_create() def __dealloc__(self): diff --git a/tools/python-yasm/tests/Makefile.inc b/tools/python-yasm/tests/Makefile.inc index 6bf72fdb..c6df22c5 100644 --- a/tools/python-yasm/tests/Makefile.inc +++ b/tools/python-yasm/tests/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - EXTRA_DIST += tools/python-yasm/tests/python_test.sh EXTRA_DIST += tools/python-yasm/tests/__init__.py EXTRA_DIST += tools/python-yasm/tests/test_bytecode.py @@ -7,7 +5,7 @@ EXTRA_DIST += tools/python-yasm/tests/test_expr.py EXTRA_DIST += tools/python-yasm/tests/test_intnum.py EXTRA_DIST += tools/python-yasm/tests/test_symrec.py -if HAVE_PYTHON +if HAVE_PYTHON_BINDINGS TESTS_ENVIRONMENT += PYTHON=${PYTHON} TESTS += tools/python-yasm/tests/python_test.sh diff --git a/tools/python-yasm/tests/__init__.py b/tools/python-yasm/tests/__init__.py index 6d608f28..f5afb30c 100644 --- a/tools/python-yasm/tests/__init__.py +++ b/tools/python-yasm/tests/__init__.py @@ -1,6 +1,5 @@ # Test wrapper from Quod Libet # http://www.sacredchao.net/quodlibet/ -# $Id$ import unittest, sys suites = [] add = registerCase = suites.append diff --git a/tools/python-yasm/tests/python_test.sh b/tools/python-yasm/tests/python_test.sh index 1f3896d6..18e7a69e 100755 --- a/tools/python-yasm/tests/python_test.sh +++ b/tools/python-yasm/tests/python_test.sh @@ -1,7 +1,6 @@ #!/bin/sh # Based on _sanity.sh from Quod Libet # http://www.sacredchao.net/quodlibet/ -# $Id$ set -e diff --git a/tools/python-yasm/tests/test_bytecode.py b/tools/python-yasm/tests/test_bytecode.py index fb6c2a2b..eb0e96db 100644 --- a/tools/python-yasm/tests/test_bytecode.py +++ b/tools/python-yasm/tests/test_bytecode.py @@ -1,4 +1,3 @@ -# $Id$ from tests import TestCase, add from yasm import Bytecode, Expression diff --git a/tools/python-yasm/tests/test_expr.py b/tools/python-yasm/tests/test_expr.py index 1fb930d0..97b021c3 100644 --- a/tools/python-yasm/tests/test_expr.py +++ b/tools/python-yasm/tests/test_expr.py @@ -1,4 +1,3 @@ -# $Id$ from tests import TestCase, add from yasm import Expression import operator diff --git a/tools/python-yasm/tests/test_intnum.py b/tools/python-yasm/tests/test_intnum.py index 65e09efc..a2220180 100644 --- a/tools/python-yasm/tests/test_intnum.py +++ b/tools/python-yasm/tests/test_intnum.py @@ -1,4 +1,3 @@ -# $Id$ from tests import TestCase, add from yasm import IntNum diff --git a/tools/python-yasm/tests/test_symrec.py b/tools/python-yasm/tests/test_symrec.py index a228eebd..a575b194 100644 --- a/tools/python-yasm/tests/test_symrec.py +++ b/tools/python-yasm/tests/test_symrec.py @@ -1,4 +1,3 @@ -# $Id$ from tests import TestCase, add from yasm import SymbolTable, Expression, YasmError diff --git a/tools/python-yasm/value.pxi b/tools/python-yasm/value.pxi index f2328dd4..5d78c054 100644 --- a/tools/python-yasm/value.pxi +++ b/tools/python-yasm/value.pxi @@ -25,7 +25,7 @@ cdef class Value: cdef yasm_value value - def __new__(self, value=None, size=None): + def __cinit__(self, value=None, size=None): cdef unsigned int sz if size is None: sz = 0 diff --git a/tools/python-yasm/yasm.pyx b/tools/python-yasm/yasm.pyx index f9c6ee4d..adbc734e 100644 --- a/tools/python-yasm/yasm.pyx +++ b/tools/python-yasm/yasm.pyx @@ -97,7 +97,7 @@ cdef void *__get_voidp(object obj, object forclass) except NULL: # cdef class __assoc_data_callback: cdef yasm_assoc_data_callback *cb - def __new__(self, destroy, print_): + def __cinit__(self, destroy, print_): self.cb = malloc(sizeof(yasm_assoc_data_callback)) self.cb.destroy = PyCObject_AsVoidPtr(destroy) #self.cb.print_ = PyCObject_AsVoidPtr(print_) @@ -107,7 +107,7 @@ cdef class __assoc_data_callback: cdef class Register: cdef unsigned long reg - def __new__(self, reg): + def __cinit__(self, reg): self.reg = reg include "errwarn.pxi" diff --git a/tools/re2c/CMakeLists.txt b/tools/re2c/CMakeLists.txt new file mode 100644 index 00000000..2a25f733 --- /dev/null +++ b/tools/re2c/CMakeLists.txt @@ -0,0 +1,19 @@ +add_executable(re2c + main.c + code.c + dfa.c + parser.c + actions.c + scanner.c + mbo_getopt.c + substr.c + translate.c + ) + +if(CMAKE_CROSSCOMPILING) + find_program(RE2C_BIN NAMES re2c REQUIRED) + add_executable(yasm::re2c IMPORTED GLOBAL) + set_property(TARGET yasm::re2c PROPERTY IMPORTED_LOCATION "${RE2C_BIN}") +else() + add_executable(yasm::re2c ALIAS re2c) +endif() diff --git a/tools/re2c/Makefile.inc b/tools/re2c/Makefile.inc index abd2db87..edb89a5d 100644 --- a/tools/re2c/Makefile.inc +++ b/tools/re2c/Makefile.inc @@ -1,5 +1,3 @@ -# $Id$ - # These utility programs have to be built for BUILD host in cross-build. # This makes things rather non-standard automake @@ -38,31 +36,40 @@ re2c_LDADD += re2c-translate.$(OBJEXT) re2c_LINK = $(CCLD_FOR_BUILD) -o $@ re2c-main.$(OBJEXT): tools/re2c/main.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c re2c-code.$(OBJEXT): tools/re2c/code.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c re2c-dfa.$(OBJEXT): tools/re2c/dfa.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c re2c-parser.$(OBJEXT): tools/re2c/parser.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c re2c-actions.$(OBJEXT): tools/re2c/actions.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c re2c-scanner.$(OBJEXT): tools/re2c/scanner.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c re2c-substr.$(OBJEXT): tools/re2c/substr.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c re2c-translate.$(OBJEXT): tools/re2c/translate.c - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) \ + -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c EXTRA_DIST += tools/re2c/CHANGELOG EXTRA_DIST += tools/re2c/NO_WARRANTY diff --git a/tools/re2c/code.c b/tools/re2c/code.c index 1c72517a..e870eb1c 100644 --- a/tools/re2c/code.c +++ b/tools/re2c/code.c @@ -1,3 +1,7 @@ +#ifdef _WIN32 +#include +#include +#endif #include #include #include @@ -6,6 +10,57 @@ #include "tools/re2c/dfa.h" #include "tools/re2c/parse.h" +#ifdef _WIN32 +/* tmpfile() replacment for Windows. + * + * On Windows tmpfile() creates the file in the root directory. This + * may fail due to unsufficient privileges. + */ +static FILE * +win32_tmpfile (void) +{ + DWORD path_len; + WCHAR path_name[MAX_PATH + 1]; + WCHAR file_name[MAX_PATH + 1]; + HANDLE handle; + int fd; + FILE *fp; + + path_len = GetTempPathW (MAX_PATH, path_name); + if (path_len <= 0 || path_len >= MAX_PATH) + return NULL; + + if (GetTempFileNameW (path_name, L"ps_", 0, file_name) == 0) + return NULL; + + handle = CreateFileW (file_name, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + DeleteFileW (file_name); + return NULL; + } + + fd = _open_osfhandle((intptr_t) handle, 0); + if (fd < 0) { + CloseHandle (handle); + return NULL; + } + + fp = fdopen(fd, "w+b"); + if (fp == NULL) { + _close(fd); + return NULL; + } + + return fp; +} +#endif + static void useLabel(size_t value) { while (value >= vUsedLabelAlloc) { vUsedLabels = realloc(vUsedLabels, vUsedLabelAlloc * 2); @@ -146,11 +201,11 @@ void BitMap_gen(FILE *o, unsigned int lb, unsigned int ub){ unsigned int n = ub - lb; unsigned int i; unsigned char *bm = malloc(sizeof(unsigned char)*n); - memset(bm, 0, n); fputs("\tstatic unsigned char yybm[] = {", o); for(i = 0; b; i += n){ unsigned char m; unsigned int j; + memset(bm, 0, n); for(m = 0x80; b && m; b = b->next, m >>= 1){ b->i = i; b->m = m; doGen(b->go, b->on, bm-lb, m); @@ -161,6 +216,7 @@ void BitMap_gen(FILE *o, unsigned int lb, unsigned int ub){ } } fputs("\n\t};\n", o); oline+=2; + free(bm); } } @@ -405,8 +461,8 @@ Go_genSwitch(Go *g, FILE *o, State *from, State *next, int *readCh){ if(g->span[i].to != def) *(t++) = &g->span[i]; - if (dFlag) - fputs("\tYYDEBUG(-1, yych);\n", o); + if (dFlag) + fputs("\tYYDEBUG(-1, yych);\n", o); #if 0 if (*readCh) { @@ -843,14 +899,17 @@ void DFA_emit(DFA *d, FILE *o){ nOrgOline = oline; maxFillIndexes = vFillIndexes; orgVFillIndexes = vFillIndexes; - tmpo = fopen("re2c.tmp", "wt"); +#ifdef _WIN32 + tmpo = win32_tmpfile(); +#else + tmpo = tmpfile(); +#endif for(s = d->head; s; s = s->next){ int readCh = 0; State_emit(s, tmpo, &readCh); Go_genGoto(&s->go, tmpo, s, s->next, &readCh); } fclose(tmpo); - remove("re2c.tmp"); maxFillIndexes = vFillIndexes; vFillIndexes = orgVFillIndexes; oline = nOrgOline; @@ -877,12 +936,12 @@ void DFA_emit(DFA *d, FILE *o){ oline++; useLabel(label); } else { - int i; + int j; fputs("\tswitch(YYGETSTATE()) {\n", o); fputs("\t\tcase -1: goto yy0;\n", o); - for (i=0; ilabel = 0; s->rule = NULL; + s->next = NULL; s->link = NULL; + s->depth = 0; s->kCount = 0; s->kernel = NULL; + s->isBase = 0; s->action = NULL; s->go.nSpans = 0; s->go.span = NULL; diff --git a/tools/re2c/main.c b/tools/re2c/main.c index f0baaf61..94843160 100644 --- a/tools/re2c/main.c +++ b/tools/re2c/main.c @@ -45,20 +45,23 @@ static void usage() "-? -h --help Display this info.\n" "\n" "-b --bit-vectors Implies -s. Use bit vectors as well in the attempt to\n" - " coax better code out of the compiler. Most useful for\n" + " coax better code out of the compiler. Most useful for\n"); + fprintf(stderr, " specifications with more than a few keywords (e.g. for\n" " most programming languages).\n" "\n" "-e --ecb Cross-compile from an ASCII platform to\n" " an EBCDIC one.\n" - "\n" + "\n"); + fprintf(stderr, "-s --nested-ifs Generate nested ifs for some switches. Many compilers\n" " need this assist to generate better code.\n" "\n" "-f --storable-state Generate a scanner with support for storable state\n" "\n" "-o --output=output Specify the output file instead of stdout\n" - "\n" + "\n"); + fprintf(stderr, "-d --debug-output Creates a parser that dumps information during\n" " about the current position and in which state the\n" " parser is.\n" @@ -159,7 +162,7 @@ int main(int argc, char *argv[]) } } - // set up the output stream + /* set up the output stream */ if (outputFileName == 0 || (fileName[0] == '-' && fileName[1] == '\0')) { outputFileName = mystrdup(""); output = stdout; diff --git a/tools/re2c/scanner.c b/tools/re2c/scanner.c index 4640ee4a..034c935b 100644 --- a/tools/re2c/scanner.c +++ b/tools/re2c/scanner.c @@ -48,7 +48,7 @@ fill(Scanner *s, unsigned char *cursor) s->lim -= cnt; } if((s->top - s->lim) < BSIZE){ - unsigned char *buf = malloc(((s->lim - s->bot) + BSIZE)); + unsigned char *buf = malloc(((s->lim - s->bot) + BSIZE) + 1); memcpy(buf, s->tok, s->lim - s->tok); s->tok = buf; s->ptr = &buf[s->ptr - s->bot]; diff --git a/tools/re2c/scanner.re b/tools/re2c/scanner.re index 10af0883..423835b6 100644 --- a/tools/re2c/scanner.re +++ b/tools/re2c/scanner.re @@ -45,7 +45,7 @@ fill(Scanner *s, unsigned char *cursor) s->lim -= cnt; } if((s->top - s->lim) < BSIZE){ - unsigned char *buf = malloc(((s->lim - s->bot) + BSIZE)); + unsigned char *buf = malloc(((s->lim - s->bot) + BSIZE) + 1); memcpy(buf, s->tok, s->lim - s->tok); s->tok = buf; s->ptr = &buf[s->ptr - s->bot]; diff --git a/tools/xdf/xdf.h b/tools/xdf/xdf.h index 8f13774b..e2150d25 100644 --- a/tools/xdf/xdf.h +++ b/tools/xdf/xdf.h @@ -1,6 +1,5 @@ /* XDF - Extended Dynamic Object Format */ /* Version 2.0 */ -/* $Id$ */ /* FILE HEADER */ /* SECTION HEADERS [] */ @@ -18,10 +17,12 @@ #ifndef XDF_H_INCLUDED #define XDF_H_INCLUDED -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; +#include + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; typedef enum { @@ -78,6 +79,7 @@ typedef struct { /* 16 bytes */ } FILE_HEADER; +#define FILE_HEADER_SIZE (4+4+4+4) typedef struct { /* 40 bytes */ @@ -94,6 +96,7 @@ typedef struct { /* 40 bytes */ } SECTION_HEADER; +#define SECTION_HEADER_SIZE (4+8+8+2+2+4+4+4+4) typedef struct { /* 16 bytes */ @@ -104,6 +107,7 @@ typedef struct { /* 16 bytes */ } SYMBOL_ENTRY; +#define SYMBOL_ENTRY_SIZE (4+4+4+4) typedef struct { /* 16 bytes */ diff --git a/tools/xdf/xdfdump.c b/tools/xdf/xdfdump.c index 15064c18..8d3df212 100644 --- a/tools/xdf/xdfdump.c +++ b/tools/xdf/xdfdump.c @@ -1,4 +1,4 @@ -/* $Id$ +/* * Extended Dynamic Object format dumper * * Copyright (C) 2004-2007 Peter Johnson @@ -39,6 +39,15 @@ print_file_header(const FILE_HEADER *filehead) printf("\tTotal Headers Size=%d\n", filehead->f_size); } +void +read_syment(SYMBOL_ENTRY *syment, FILE *f) +{ + fread(&syment->e_sect_idx, sizeof(syment->e_sect_idx), 1, f); + fread(&syment->e_sect_off, sizeof(syment->e_sect_off), 1, f); + fread(&syment->e_name_off, sizeof(syment->e_name_off), 1, f); + fread(&syment->e_flags, sizeof(syment->e_flags), 1, f); +} + const char * get_syment_name(const SYMBOL_ENTRY *syment, FILE *f) { @@ -56,8 +65,8 @@ get_sym_name(u32 idx, FILE *f, size_t symtab_off) { SYMBOL_ENTRY syment; long oldpos = ftell(f); - fseek(f, symtab_off+idx*sizeof(SYMBOL_ENTRY), SEEK_SET); - fread(&syment, sizeof(syment), 1, f); + fseek(f, symtab_off+idx*SYMBOL_ENTRY_SIZE, SEEK_SET); + read_syment(&syment, f); fseek(f, oldpos, SEEK_SET); return get_syment_name(&syment, f); } @@ -67,8 +76,8 @@ get_sect_name(u32 idx, FILE *f, size_t symtab_off, size_t secttab_off) { SECTION_HEADER secthead; long oldpos = ftell(f); - fseek(f, secttab_off+idx*sizeof(SECTION_HEADER), SEEK_SET); - fread(§head, sizeof(secthead), 1, f); + fseek(f, secttab_off+idx*SECTION_HEADER_SIZE, SEEK_SET); + fread(§head.s_name_idx, sizeof(secthead.s_name_idx), 1, f); fseek(f, oldpos, SEEK_SET); return get_sym_name(secthead.s_name_idx, f, symtab_off); } @@ -88,7 +97,7 @@ print_symbol(const SYMBOL_ENTRY *syment, FILE *f, size_t symtab_off, if (first>0) printf("None"); printf(" Name=`%s' Section=", get_syment_name(syment, f)); - if ((long)syment->e_sect_idx < 0) + if (syment->e_sect_idx >= 0x80000000) printf("%d\n", syment->e_sect_idx); else printf("`%s' (%d)\n", @@ -201,7 +210,10 @@ main(int argc, char **argv) return EXIT_FAILURE; } - fread(&filehead, sizeof(filehead), 1, f); + fread(&filehead.f_magic, sizeof(filehead.f_magic), 1, f); + fread(&filehead.f_nsect, sizeof(filehead.f_nsect), 1, f); + fread(&filehead.f_nsyms, sizeof(filehead.f_nsyms), 1, f); + fread(&filehead.f_size, sizeof(filehead.f_size), 1, f); if (filehead.f_magic != XDF_MAGIC) { fprintf(stderr, "Magic number mismatch (expected %08X, got %08X\n", @@ -210,17 +222,25 @@ main(int argc, char **argv) } print_file_header(&filehead); - symtab_off = sizeof(FILE_HEADER)+filehead.f_nsect*sizeof(SECTION_HEADER); + symtab_off = FILE_HEADER_SIZE+filehead.f_nsect*SECTION_HEADER_SIZE; for (i=0; i #include +#ifdef HAVE_STRINGS_H +#include +#endif + +#include #include #ifdef lint @@ -112,24 +117,8 @@ # define USE_OUR_OWN_STRCASECMP #endif -#if !defined(HAVE_TOASCII) || defined(lint) -# define toascii(c) ((c) & 0x7F) -#endif - #include -#ifdef HAVE_SYS_CDEFS_H -# include -#endif - -#ifdef __RCSID -# define RCSID(s) __RCSID(s) -#elif defined(__GNUC__) && defined(__ELF__) -# define RCSID(s) __asm__(".ident\t\"" s "\"") -#else -# define RCSID(s) static const char rcsid[] = s -#endif - #ifdef WITH_DMALLOC # include # define yasm__xstrdup(str) xstrdup(str) diff --git a/yasm.1 b/yasm.1 index 71db01e0..8b0d8456 100644 --- a/yasm.1 +++ b/yasm.1 @@ -1,47 +1,55 @@ +'\" t .\" Title: yasm .\" Author: Peter Johnson -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: April 2007 .\" Manual: The Yasm Modular Assembler .\" Source: Yasm +.\" Language: English .\" .TH "YASM" "1" "April 2007" "Yasm" "The Yasm Modular Assembler" +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" yasm \- The Yasm Modular Assembler .SH "SYNOPSIS" -.HP 5 +.HP \w'\fByasm\fR\ 'u \fByasm\fR [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-o\ \fR\fB\fIoutfile\fR\fR] [\fB\fIother\ options\fR\fR...] {\fIinfile\fR} -.HP 5 +.HP \w'\fByasm\fR\ 'u \fByasm\fR \fB\-h\fR .SH "DESCRIPTION" .PP The Yasm Modular Assembler is a portable, retargetable assembler written under the \(lqnew\(rq -(2 or 3 clause) BSD license. Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats. +(2 or 3 clause) BSD license\&. Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats\&. .PP YASM consists of the \fByasm\fR -command, libyasm, the core backend library, and a large number of modules. Currently, libyasm and the loadable modules are statically built into the +command, libyasm, the core backend library, and a large number of modules\&. Currently, libyasm and the loadable modules are statically built into the \fByasm\fR -executable. +executable\&. .PP The \fByasm\fR command assembles the file infile and directs output to the file \fIoutfile\fR -if specified. If +if specified\&. If \fIoutfile\fR is not specified, \fByasm\fR will derive a default output file name from the name of its input file, usually by appending -\fI.o\fR +\&.o or -\fI.obj\fR, or by removing all extensions for a raw binary file. Failing that, the output file name will be -\fIyasm.out\fR. +\&.obj, or by removing all extensions for a raw binary file\&. Failing that, the output file name will be +yasm\&.out\&. .PP If called with an \fIinfile\fR @@ -50,115 +58,115 @@ of \fByasm\fR assembles the standard input and directs output to the file \fIoutfile\fR, or -\fIyasm.out\fR +yasm\&.out if no \fIoutfile\fR -is specified. +is specified\&. .SH "OPTIONS" .PP -Many options may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name. Options are listed in alphabetical order. +Many options may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name\&. Options are listed in alphabetical order\&. .SS "General Options" .PP \fB\-a \fR\fB\fIarch\fR\fR or \fB\-\-arch=\fR\fB\fIarch\fR\fR: Select target architecture .RS 4 -Selects the target architecture. The default architecture is -\(lqx86\(rq, which supports both the IA\-32 and derivatives and AMD64 instruction sets. To print a list of available architectures to standard output, use +Selects the target architecture\&. The default architecture is +\(lqx86\(rq, which supports both the IA\-32 and derivatives and AMD64 instruction sets\&. To print a list of available architectures to standard output, use \(lqhelp\(rq as -\fIarch\fR. See +\fIarch\fR\&. See \fByasm_arch\fR(7) -for a list of supported architectures. +for a list of supported architectures\&. .RE .PP \fB\-f \fR\fB\fIformat\fR\fR or \fB\-\-oformat=\fR\fB\fIformat\fR\fR: Select object format .RS 4 -Selects the output object format. The default object format is -\(lqbin\(rq, which is a flat format binary with no relocation. To print a list of available object formats to standard output, use +Selects the output object format\&. The default object format is +\(lqbin\(rq, which is a flat format binary with no relocation\&. To print a list of available object formats to standard output, use \(lqhelp\(rq as -\fIformat\fR. See +\fIformat\fR\&. See \fByasm_objfmts\fR(7) -for a list of supported object formats. +for a list of supported object formats\&. .RE .PP \fB\-g \fR\fB\fIdebug\fR\fR or \fB\-\-dformat=\fR\fB\fIdebug\fR\fR: Select debugging format .RS 4 -Selects the debugging format for debug information. Debugging information can be used by a debugger to associate executable code back to the source file or get data structure and type information. Available debug formats vary between different object formats; +Selects the debugging format for debug information\&. Debugging information can be used by a debugger to associate executable code back to the source file or get data structure and type information\&. Available debug formats vary between different object formats; \fByasm\fR -will error when an invalid combination is selected. The default object format is selected by the object format. To print a list of available debugging formats to standard output, use +will error when an invalid combination is selected\&. The default object format is selected by the object format\&. To print a list of available debugging formats to standard output, use \(lqhelp\(rq as -\fIdebug\fR. See +\fIdebug\fR\&. See \fByasm_dbgfmts\fR(7) -for a list of supported debugging formats. -.RE -.PP -\fB\-h\fR or \fB\-\-help\fR: Print a summary of options -.RS 4 -Prints a summary of invocation options. All other options are ignored, and no output file is generated. +for a list of supported debugging formats\&. .RE .PP \fB\-L \fR\fB\fIlist\fR\fR or \fB\-\-lformat=\fR\fB\fIlist\fR\fR: Select list file format .RS 4 -Selects the format/style of the output list file. List files typically intermix the original source with the machine code generated by the assembler. The default list format is -\(lqnasm\(rq, which mimics the NASM list file format. To print a list of available list file formats to standard output, use +Selects the format/style of the output list file\&. List files typically intermix the original source with the machine code generated by the assembler\&. The default list format is +\(lqnasm\(rq, which mimics the NASM list file format\&. To print a list of available list file formats to standard output, use \(lqhelp\(rq as -\fIlist\fR. +\fIlist\fR\&. .RE .PP \fB\-l \fR\fB\fIlistfile\fR\fR or \fB\-\-list=\fR\fB\fIlistfile\fR\fR: Specify list filename .RS 4 -Specifies the name of the output list file. If this option is not used, no list file is generated. +Specifies the name of the output list file\&. If this option is not used, no list file is generated\&. .RE .PP \fB\-m \fR\fB\fImachine\fR\fR or \fB\-\-machine=\fR\fB\fImachine\fR\fR: Select target machine architecture .RS 4 -Selects the target machine architecture. Essentially a subtype of the selected architecture, the machine type selects between major subsets of an architecture. For example, for the +Selects the target machine architecture\&. Essentially a subtype of the selected architecture, the machine type selects between major subsets of an architecture\&. For example, for the \(lqx86\(rq architecture, the two available machines are \(lqx86\(rq, which is used for the IA\-32 and derivative 32\-bit instruction set, and -\(lqamd64\(rq, which is used for the 64\-bit instruction set. This differentiation is required to generate the proper object file for relocatable object formats such as COFF and ELF. To print a list of available machines for a given architecture to standard output, use +\(lqamd64\(rq, which is used for the 64\-bit instruction set\&. This differentiation is required to generate the proper object file for relocatable object formats such as COFF and ELF\&. To print a list of available machines for a given architecture to standard output, use \(lqhelp\(rq as \fImachine\fR and the given architecture using -\fB\-a \fR\fB\fIarch\fR\fR. See +\fB\-a \fR\fB\fIarch\fR\fR\&. See \fByasm_arch\fR(7) -for more details. +for more details\&. .RE .PP \fB\-o \fR\fB\fIfilename\fR\fR or \fB\-\-objfile=\fR\fB\fIfilename\fR\fR: Specify object filename .RS 4 -Specifies the name of the output file, overriding any default name generated by Yasm. +Specifies the name of the output file, overriding any default name generated by Yasm\&. .RE .PP \fB\-p \fR\fB\fIparser\fR\fR or \fB\-\-parser=\fR\fB\fIparser\fR\fR: Select parser .RS 4 -Selects the parser (the assembler syntax). The default parser is -\(lqnasm\(rq, which emulates the syntax of NASM, the Netwide Assembler. Another available parser is -\(lqgas\(rq, which emulates the syntax of GNU AS. To print a list of available parsers to standard output, use +Selects the parser (the assembler syntax)\&. The default parser is +\(lqnasm\(rq, which emulates the syntax of NASM, the Netwide Assembler\&. Another available parser is +\(lqgas\(rq, which emulates the syntax of GNU AS\&. To print a list of available parsers to standard output, use \(lqhelp\(rq as -\fIparser\fR. See +\fIparser\fR\&. See \fByasm_parsers\fR(7) -for a list of supported parsers. +for a list of supported parsers\&. .RE .PP \fB\-r \fR\fB\fIpreproc\fR\fR or \fB\-\-preproc=\fR\fB\fIpreproc\fR\fR: Select preprocessor .RS 4 -Selects the preprocessor to use on the input file before passing it to the parser. Preprocessors often provide macro functionality that is not included in the main parser. The default preprocessor is -\(lqnasm\(rq, which is an imported version of the actual NASM preprocessor. A +Selects the preprocessor to use on the input file before passing it to the parser\&. Preprocessors often provide macro functionality that is not included in the main parser\&. The default preprocessor is +\(lqnasm\(rq, which is an imported version of the actual NASM preprocessor\&. A \(lqraw\(rq -preprocessor is also available, which simply skips the preprocessing step, passing the input file directly to the parser. To print a list of available preprocessors to standard output, use +preprocessor is also available, which simply skips the preprocessing step, passing the input file directly to the parser\&. To print a list of available preprocessors to standard output, use \(lqhelp\(rq as -\fIpreproc\fR. +\fIpreproc\fR\&. +.RE +.PP +\fB\-h\fR or \fB\-\-help\fR: Print a summary of options +.RS 4 +Prints a summary of invocation options\&. All other options are ignored, and no output file is generated\&. .RE .PP \fB\-\-version\fR: Get the Yasm version .RS 4 -This option causes Yasm to prints the version number of Yasm as well as a license summary to standard output. All other options are ignored, and no output file is generated. +This option causes Yasm to prints the version number of Yasm as well as a license summary to standard output\&. All other options are ignored, and no output file is generated\&. .RE .SS "Warning Options" .PP @@ -166,71 +174,71 @@ This option causes Yasm to prints the version number of Yasm as well as a licens options have two contrary forms: \fB\-W\fR\fB\fIname\fR\fR and -\fB\-Wno\-\fR\fB\fIname\fR\fR. Only the non\-default forms are shown here. +\fB\-Wno\-\fR\fB\fIname\fR\fR\&. Only the non\-default forms are shown here\&. .PP The warning options are handled in the order given on the command line, so if \fB\-w\fR is followed by \fB\-Worphan\-labels\fR, all warnings are turned off \fIexcept\fR -for orphan\-labels. +for orphan\-labels\&. .PP \fB\-w\fR: Inhibit all warning messages .RS 4 -This option causes Yasm to inhibit all warning messages. As discussed above, this option may be followed by other options to re\-enable specified warnings. +This option causes Yasm to inhibit all warning messages\&. As discussed above, this option may be followed by other options to re\-enable specified warnings\&. .RE .PP \fB\-Werror\fR: Treat warnings as errors .RS 4 -This option causes Yasm to treat all warnings as errors. Normally warnings do not prevent an object file from being generated and do not result in a failure exit status from -\fByasm\fR, whereas errors do. This option makes warnings equivalent to errors in terms of this behavior. +This option causes Yasm to treat all warnings as errors\&. Normally warnings do not prevent an object file from being generated and do not result in a failure exit status from +\fByasm\fR, whereas errors do\&. This option makes warnings equivalent to errors in terms of this behavior\&. .RE .PP \fB\-Wno\-unrecognized\-char\fR: Do not warn on unrecognized input characters .RS 4 -Causes Yasm to not warn on unrecognized characters found in the input. Normally Yasm will generate a warning for any non\-ASCII character found in the input file. +Causes Yasm to not warn on unrecognized characters found in the input\&. Normally Yasm will generate a warning for any non\-ASCII character found in the input file\&. .RE .PP \fB\-Worphan\-labels\fR: Warn on labels lacking a trailing option .RS 4 -When using the NASM\-compatible parser, causes Yasm to warn about labels found alone on a line without a trailing colon. While these are legal labels in NASM syntax, they may be unintentional, due to typos or macro definition ordering. +When using the NASM\-compatible parser, causes Yasm to warn about labels found alone on a line without a trailing colon\&. While these are legal labels in NASM syntax, they may be unintentional, due to typos or macro definition ordering\&. .RE .PP \fB\-X \fR\fB\fIstyle\fR\fR: Change error/warning reporting style .RS 4 -Selects a specific output style for error and warning messages. The default is +Selects a specific output style for error and warning messages\&. The default is \(lqgnu\(rq style, which mimics the output of -\fBgcc\fR. The +\fBgcc\fR\&. The \(lqvc\(rq -style is also available, which mimics the output of Microsoft's Visual C++ compiler. +style is also available, which mimics the output of Microsoft\'s Visual C++ compiler\&. .sp This option is available so that Yasm integrates more naturally into IDE environments such as Visual Studio or -Emacs, allowing the IDE to correctly recognize the error/warning message as such and link back to the offending line of source code. +Emacs, allowing the IDE to correctly recognize the error/warning message as such and link back to the offending line of source code\&. .RE .SS "Preprocessor Options" .PP While these preprocessor options theoretically will affect any preprocessor, the only preprocessor currently in Yasm is the \(lqnasm\(rq -preprocessor. +preprocessor\&. .PP \fB\-D \fR\fB\fImacro[=value]\fR\fR: Pre\-define a macro .RS 4 -Pre\-defines a single\-line macro. The value is optional (if no value is given, the macro is still defined, but to an empty value). +Pre\-defines a single\-line macro\&. The value is optional (if no value is given, the macro is still defined, but to an empty value)\&. .RE .PP \fB\-e\fR or \fB\-\-preproc\-only\fR: Only preprocess .RS 4 -Stops assembly after the preprocessing stage; preprocessed output is sent to the specified output name or, if no output name is specified, the standard output. No object file is produced. +Stops assembly after the preprocessing stage; preprocessed output is sent to the specified output name or, if no output name is specified, the standard output\&. No object file is produced\&. .RE .PP \fB\-I \fR\fB\fIpath\fR\fR: Add include file path .RS 4 Adds directory \fIpath\fR -to the search path for include files. The search path defaults to only including the directory in which the source file resides. +to the search path for include files\&. The search path defaults to only including the directory in which the source file resides\&. .RE .PP \fB\-P \fR\fB\fIfilename\fR\fR: Pre\-include a file @@ -238,65 +246,77 @@ to the search path for include files. The search path defaults to only including Pre\-includes file \fIfilename\fR, making it look as though \fIfilename\fR -was prepended to the input. Can be useful for prepending multi\-line macros that the +was prepended to the input\&. Can be useful for prepending multi\-line macros that the \fB\-D\fR -can't support. +can\'t support\&. .RE .PP \fB\-U \fR\fB\fImacro\fR\fR: Undefine a macro .RS 4 Undefines a single\-line macro (may be either a built\-in macro or one defined earlier in the command line with -\fB\-D\fR. +\fB\-D\fR\&. .RE .SH "EXAMPLES" .PP To assemble NASM syntax, 32\-bit x86 source -\fIsource.asm\fR +source\&.asm into ELF file -\fIsource.o\fR, warning on orphan labels: +source\&.o, warning on orphan labels: .sp +.if n \{\ .RS 4 +.\} .nf -yasm \-f elf32 \-Worphan\-labels source.asm +yasm \-f elf32 \-Worphan\-labels source\&.asm .fi +.if n \{\ .RE +.\} .PP To assemble NASM syntax AMD64 source -\fIx.asm\fR +x\&.asm into Win64 file -\fIobject.obj\fR: +object\&.obj: .sp +.if n \{\ .RS 4 +.\} .nf -yasm \-f win64 \-o object.obj x.asm +yasm \-f win64 \-o object\&.obj x\&.asm .fi +.if n \{\ .RE +.\} .PP To assemble already preprocessed NASM syntax x86 source -\fIy.asm\fR +y\&.asm into flat binary file -\fIy.com\fR: +y\&.com: .sp +.if n \{\ .RS 4 +.\} .nf -yasm \-f bin \-r raw \-o y.com y.asm +yasm \-f bin \-r raw \-o y\&.com y\&.asm .fi +.if n \{\ .RE +.\} .SH "DIAGNOSTICS" .PP The \fByasm\fR -command exits 0 on success, and nonzero if an error occurs. +command exits 0 on success, and nonzero if an error occurs\&. .SH "COMPATIBILITY" .PP -Yasm's NASM parser and preprocessor, while they strive to be as compatible as possible with NASM, have a few incompatibilities due to YASM's different internal structure. +Yasm\'s NASM parser and preprocessor, while they strive to be as compatible as possible with NASM, have a few incompatibilities due to YASM\'s different internal structure\&. .PP -Yasm's GAS parser and preprocessor are missing a number of features present in GNU AS. +Yasm\'s GAS parser and preprocessor are missing a number of features present in GNU AS\&. .SH "RESTRICTIONS" .PP -As object files are often architecture and machine dependent, not all combinations of object formats, architectures, and machines are legal; trying to use an invalid combination will result in an error. +As object files are often architecture and machine dependent, not all combinations of object formats, architectures, and machines are legal; trying to use an invalid combination will result in an error\&. .PP -There is no support for symbol maps. +There is no support for symbol maps\&. .SH "SEE ALSO" .PP \fByasm_arch\fR(7), @@ -316,14 +336,14 @@ architecture, it is overly easy to generate AMD64 code (using the \fBBITS 64\fR directive) and generate a 32\-bit object file (by failing to specify \fB\-m amd64\fR -or selecting a 64\-bit object format such as ELF64 on the command line). +or selecting a 64\-bit object format such as ELF64 on the command line)\&. .SH "AUTHOR" .PP -\fBPeter Johnson\fR <\&peter@tortall.net\&> -.sp -1n -.IP "" 4 +\fBPeter Johnson\fR <\&peter@tortall\&.net\&> +.RS 4 Author. +.RE .SH "COPYRIGHT" +.br Copyright \(co 2004, 2005, 2006, 2007 Peter Johnson .br - diff --git a/yasm_arch.7 b/yasm_arch.7 index dd329c5b..ccdfd056 100644 --- a/yasm_arch.7 +++ b/yasm_arch.7 @@ -1,23 +1,40 @@ +'\" t .\" Title: yasm_arch .\" Author: Peter Johnson -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: October 2006 .\" Manual: Yasm Supported Architectures .\" Source: Yasm +.\" Language: English .\" .TH "YASM_ARCH" "7" "October 2006" "Yasm" "Yasm Supported Architectures" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" yasm_arch \- Yasm Supported Target Architectures .SH "SYNOPSIS" -.HP 5 -\fByasm\fR \fB\-a\ \fR\fB\fIarch\fR\fR [\fB\-m\ \fR\fB\fImachine\fR\fR] \fB\fI...\fR\fR +.HP \w'\fByasm\fR\ 'u +\fByasm\fR \fB\-a\ \fR\fB\fIarch\fR\fR [\fB\-m\ \fR\fB\fImachine\fR\fR] \fB\fI\&.\&.\&.\fR\fR .SH "DESCRIPTION" .PP -The standard Yasm distribution includes a number of modules for different target architectures. Each target architecture can support one or more machine architectures. +The standard Yasm distribution includes a number of modules for different target architectures\&. Each target architecture can support one or more machine architectures\&. .PP The architecture and machine are selected on the \fByasm\fR(1) @@ -25,9 +42,9 @@ command line by use of the \fB\-a \fR\fB\fIarch\fR\fR and \fB\-m \fR\fB\fImachine\fR\fR -command line options, respectively. +command line options, respectively\&. .PP -The machine architecture may also automatically be selected by certain object formats. For example, the +The machine architecture may also automatically be selected by certain object formats\&. For example, the \(lqelf32\(rq object format selects the \(lqx86\(rq @@ -35,318 +52,787 @@ machine architecture by default, while the \(lqelf64\(rq object format selects the \(lqamd64\(rq -machine architecture by default. +machine architecture by default\&. .SH "X86 ARCHITECTURE" .PP The \(lqx86\(rq -architecture supports the IA\-32 instruction set and derivatives and the AMD64 instruction set. It consists of two machines: +architecture supports the IA\-32 instruction set and derivatives and the AMD64 instruction set\&. It consists of two machines: \(lqx86\(rq (for the IA\-32 and derivatives) and \(lqamd64\(rq -(for the AMD64 and derivatives). The default machine for the +(for the AMD64 and derivatives)\&. The default machine for the \(lqx86\(rq architecture is the \(lqx86\(rq -machine. +machine\&. .SS "BITS Setting" .PP -The x86 architecture BITS setting specifies to Yasm the processor mode in which the generated code is intended to execute. x86 processors can run in three different major execution modes: 16\-bit, 32\-bit, and on AMD64\-supporting processors, 64\-bit. As the x86 instruction set contains portions whose function is execution\-mode dependent (such as operand\-size and address\-size override prefixes), Yasm cannot assemble x86 instructions correctly unless it is told by the user in what processor mode the code will execute. +The x86 architecture BITS setting specifies to Yasm the processor mode in which the generated code is intended to execute\&. x86 processors can run in three different major execution modes: 16\-bit, 32\-bit, and on AMD64\-supporting processors, 64\-bit\&. As the x86 instruction set contains portions whose function is execution\-mode dependent (such as operand\-size and address\-size override prefixes), Yasm cannot assemble x86 instructions correctly unless it is told by the user in what processor mode the code will execute\&. .PP -The BITS setting can be changed in a variety of ways. When using the NASM\-compatible parser, the BITS setting can be changed directly via the use of the +The BITS setting can be changed in a variety of ways\&. When using the NASM\-compatible parser, the BITS setting can be changed directly via the use of the \fBBITS xx\fR -assembler directive. The default BITS setting is determined by the object format in use. -.\" end of SS subsection "BITS Setting" +assembler directive\&. The default BITS setting is determined by the object format in use\&. .SS "BITS 64 Extensions" .PP -The AMD64 architecture is a new 64\-bit architecture developed by AMD, based on the 32\-bit x86 architecture. It extends the original x86 architecture by doubling the number of general purpose and SIMD registers, extending the arithmetic operations and address space to 64 bits, as well as other features. +The AMD64 architecture is a new 64\-bit architecture developed by AMD, based on the 32\-bit x86 architecture\&. It extends the original x86 architecture by doubling the number of general purpose and SIMD registers, extending the arithmetic operations and address space to 64 bits, as well as other features\&. .PP -Recently, Intel has introduced an essentially identical version of AMD64 called EM64T. +Recently, Intel has introduced an essentially identical version of AMD64 called EM64T\&. .PP -When an AMD64\-supporting processor is executing in 64\-bit mode, a number of additional extensions are available, including extra general purpose registers, extra SSE2 registers, and RIP\-relative addressing. +When an AMD64\-supporting processor is executing in 64\-bit mode, a number of additional extensions are available, including extra general purpose registers, extra SSE2 registers, and RIP\-relative addressing\&. .PP -Yasm extends the base NASM syntax to support AMD64 as follows. To enable assembly of instructions for the 64\-bit mode of AMD64 processors, use the directive -\fBBITS 64\fR. As with NASM's BITS directive, this does not change the format of the output object file to 64 bits; it only changes the assembler mode to assume that the instructions being assembled will be run in 64\-bit mode. To specify an AMD64 object file, use +Yasm extends the base NASM syntax to support AMD64 as follows\&. To enable assembly of instructions for the 64\-bit mode of AMD64 processors, use the directive +\fBBITS 64\fR\&. As with NASM\*(Aqs BITS directive, this does not change the format of the output object file to 64 bits; it only changes the assembler mode to assume that the instructions being assembled will be run in 64\-bit mode\&. To specify an AMD64 object file, use \fB\-m amd64\fR on the Yasm command line, or explicitly target a 64\-bit object format such as \fB\-f win64\fR or -\fB\-f elf64\fR. +\fB\-f elf64\fR\&. +\fB\-f elfx32\fR +can be used to select 32\-bit ELF object format for AMD64 processors\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br +.ps +1 \fBRegister Changes\fR -.RS +.RS 4 .PP -The additional 64\-bit general purpose registers are named r8\-r15. There are also 8\-bit (rXb), 16\-bit (rXw), and 32\-bit (rXd) subregisters that map to the least significant 8, 16, or 32 bits of the 64\-bit register. The original 8 general purpose registers have also been extended to 64\-bits: eax, edx, ecx, ebx, esi, edi, esp, and ebp have new 64\-bit versions called rax, rdx, rcx, rbx, rsi, rdi, rsp, and rbp respectively. The old 32\-bit registers map to the least significant bits of the new 64\-bit registers. +The additional 64\-bit general purpose registers are named r8\-r15\&. There are also 8\-bit (rXb), 16\-bit (rXw), and 32\-bit (rXd) subregisters that map to the least significant 8, 16, or 32 bits of the 64\-bit register\&. The original 8 general purpose registers have also been extended to 64\-bits: eax, edx, ecx, ebx, esi, edi, esp, and ebp have new 64\-bit versions called rax, rdx, rcx, rbx, rsi, rdi, rsp, and rbp respectively\&. The old 32\-bit registers map to the least significant bits of the new 64\-bit registers\&. .PP -New 8\-bit registers are also available that map to the 8 least significant bits of rsi, rdi, rsp, and rbp. These are called sil, dil, spl, and bpl respectively. Unfortunately, due to the way instructions are encoded, these new 8\-bit registers are encoded the same as the old 8\-bit registers ah, dh, ch, and bh. The processor tells which is being used by the presence of the new REX prefix that is used to specify the other extended registers. This means it is illegal to mix the use of ah, dh, ch, and bh with an instruction that requires the REX prefix for other reasons. For instance: +New 8\-bit registers are also available that map to the 8 least significant bits of rsi, rdi, rsp, and rbp\&. These are called sil, dil, spl, and bpl respectively\&. Unfortunately, due to the way instructions are encoded, these new 8\-bit registers are encoded the same as the old 8\-bit registers ah, dh, ch, and bh\&. The processor tells which is being used by the presence of the new REX prefix that is used to specify the other extended registers\&. This means it is illegal to mix the use of ah, dh, ch, and bh with an instruction that requires the REX prefix for other reasons\&. For instance: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf add ah, [r10] .fi +.if n \{\ .RE +.\} .PP -(NASM syntax) is not a legal instruction because the use of r10 requires a REX prefix, making it impossible to use ah. +(NASM syntax) is not a legal instruction because the use of r10 requires a REX prefix, making it impossible to use ah\&. .PP -In 64\-bit mode, an additional 8 SSE2 registers are also available. These are named xmm8\-xmm15. +In 64\-bit mode, an additional 8 SSE2 registers are also available\&. These are named xmm8\-xmm15\&. .RE -.\" end of subsection "Register Changes" .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br +.ps +1 \fB64 Bit Instructions\fR -.RS +.RS 4 .PP -By default, most operations in 64\-bit mode remain 32\-bit; operations that are 64\-bit usually require a REX prefix (one bit in the REX prefix determines whether an operation is 64\-bit or 32\-bit). Thus, essentially all 32\-bit instructions have a 64\-bit version, and the 64\-bit versions of instructions can use extended registers +By default, most operations in 64\-bit mode remain 32\-bit; operations that are 64\-bit usually require a REX prefix (one bit in the REX prefix determines whether an operation is 64\-bit or 32\-bit)\&. Thus, essentially all 32\-bit instructions have a 64\-bit version, and the 64\-bit versions of instructions can use extended registers \(lqfor free\(rq -(as the REX prefix is already present). Examples in NASM syntax: +(as the REX prefix is already present)\&. Examples in NASM syntax: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov eax, 1 ; 32\-bit instruction .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rcx, 1 ; 64\-bit instruction .fi +.if n \{\ .RE +.\} .PP -Instructions that modify the stack (push, pop, call, ret, enter, and leave) are implicitly 64\-bit. Their 32\-bit counterparts are not available, but their 16\-bit counterparts are. Examples in NASM syntax: +Instructions that modify the stack (push, pop, call, ret, enter, and leave) are implicitly 64\-bit\&. Their 32\-bit counterparts are not available, but their 16\-bit counterparts are\&. Examples in NASM syntax: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf push eax ; illegal instruction .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf push rbx ; 1\-byte instruction .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf push r11 ; 2\-byte instruction with REX prefix .fi +.if n \{\ .RE +.\} .RE -.\" end of subsection "64 Bit Instructions" .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br +.ps +1 \fBImplicit Zero Extension\fR -.RS +.RS 4 .PP -Results of 32\-bit operations are implicitly zero\-extended to the upper 32 bits of the corresponding 64\-bit register. 16 and 8 bit operations, on the other hand, do not affect upper bits of the register (just as in 32\-bit and 16\-bit modes). This can be used to generate smaller code in some instances. Examples in NASM syntax: +Results of 32\-bit operations are implicitly zero\-extended to the upper 32 bits of the corresponding 64\-bit register\&. 16 and 8 bit operations, on the other hand, do not affect upper bits of the register (just as in 32\-bit and 16\-bit modes)\&. This can be used to generate smaller code in some instances\&. Examples in NASM syntax: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov ecx, 1 ; 1 byte shorter than mov rcx, 1 .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf and edx, 3 ; equivalent to and rdx, 3 .fi +.if n \{\ .RE +.\} .RE -.\" end of subsection "Implicit Zero Extension" .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br +.ps +1 \fBImmediates\fR -.RS +.RS 4 .PP -For most instructions in 64\-bit mode, immediate values remain 32 bits; their value is sign\-extended into the upper 32 bits of the target register prior to being used. The exception is the mov instruction, which can take a 64\-bit immediate when the destination is a 64\-bit register. Examples in NASM syntax: +For most instructions in 64\-bit mode, immediate values remain 32 bits; their value is sign\-extended into the upper 32 bits of the target register prior to being used\&. The exception is the mov instruction, which can take a 64\-bit immediate when the destination is a 64\-bit register\&. Examples in NASM syntax: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf add rax, 1 ; optimized down to signed 8\-bit .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf add rax, dword 1 ; force size to 32\-bit .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf add rax, 0xffffffff ; sign\-extended 32\-bit .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf add rax, \-1 ; same as above .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf add rax, 0xffffffffffffffff ; truncated to 32\-bit (warning) .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov eax, 1 ; 5 byte .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rax, 1 ; 5 byte (optimized to signed 32\-bit) .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rax, qword 1 ; 10 byte (forced 64\-bit) .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rbx, 0x1234567890abcdef ; 10 byte .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rcx, 0xffffffff ; 10 byte (does not fit in signed 32\-bit) .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov ecx, \-1 ; 5 byte, equivalent to above .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rcx, sym ; 5 byte, 32\-bit size default for symbols .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov rcx, qword sym ; 10 byte, override default size .fi +.if n \{\ .RE +.\} +.PP +The handling of mov reg64, unsized immediate is different between YASM and NASM 2\&.x; YASM follows the above behavior, while NASM 2\&.x does the following: +.sp +.if n \{\ +.RS 4 +.\} +.nf +add rax, 0xffffffff ; sign\-extended 32\-bit immediate +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +add rax, \-1 ; same as above +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +add rax, 0xffffffffffffffff ; truncated 32\-bit (warning) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +add rax, sym ; sign\-extended 32\-bit immediate +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov eax, 1 ; 5 byte (32\-bit immediate) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov rax, 1 ; 10 byte (64\-bit immediate) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov rbx, 0x1234567890abcdef ; 10 byte instruction +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov rcx, 0xffffffff ; 10 byte instruction +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov ecx, \-1 ; 5 byte, equivalent to above +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov ecx, sym ; 5 byte (32\-bit immediate) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov rcx, sym ; 10 byte instruction +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov rcx, qword sym ; 10 byte (64\-bit immediate) +.fi +.if n \{\ +.RE +.\} .RE -.\" end of subsection "Immediates" .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br +.ps +1 \fBDisplacements\fR -.RS +.RS 4 .PP -Just like immediates, displacements, for the most part, remain 32 bits and are sign extended prior to use. Again, the exception is one restricted form of the mov instruction: between the al/ax/eax/rax register and a 64\-bit absolute address (no registers allowed in the effective address). In NASM syntax, use of the 64\-bit absolute form requires -\fB[qword]\fR. Examples in NASM syntax: +Just like immediates, displacements, for the most part, remain 32 bits and are sign extended prior to use\&. Again, the exception is one restricted form of the mov instruction: between the al/ax/eax/rax register and a 64\-bit absolute address (no registers allowed in the effective address)\&. In NASM syntax, use of the 64\-bit absolute form requires +\fB[qword]\fR\&. Examples in NASM syntax: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov eax, [1] ; 32 bit, with sign extension .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov al, [rax\-1] ; 32 bit, with sign extension .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov al, [qword 0x1122334455667788] ; 64\-bit absolute .fi +.if n \{\ .RE +.\} .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov al, [0x1122334455667788] ; truncated to 32\-bit (warning) .fi +.if n \{\ .RE +.\} .RE -.\" end of subsection "Displacements" .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br +.ps +1 \fBRIP Relative Addressing\fR -.RS +.RS 4 .PP -In 64\-bit mode, a new form of effective addressing is available to make it easier to write position\-independent code. Any memory reference may be made RIP relative (RIP is the instruction pointer register, which contains the address of the location immediately following the current instruction). +In 64\-bit mode, a new form of effective addressing is available to make it easier to write position\-independent code\&. Any memory reference may be made RIP relative (RIP is the instruction pointer register, which contains the address of the location immediately following the current instruction)\&. .PP In NASM syntax, there are two ways to specify RIP\-relative addressing: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov dword [rip+10], 1 .fi +.if n \{\ .RE +.\} .PP -stores the value 1 ten bytes after the end of the instruction. +stores the value 1 ten bytes after the end of the instruction\&. \fB10\fR -can also be a symbolic constant, and will be treated the same way. On the other hand, +can also be a symbolic constant, and will be treated the same way\&. On the other hand, .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov dword [symb wrt rip], 1 .fi +.if n \{\ .RE +.\} .PP stores the value 1 into the address of symbol -\fBsymb\fR. This is distinctly different than the behavior of: +\fBsymb\fR\&. This is distinctly different than the behavior of: .sp -.RS 3n +.if n \{\ +.RS 4 +.\} .nf mov dword [symb+rip], 1 .fi +.if n \{\ .RE +.\} .PP which takes the address of the end of the instruction, adds the address of \fBsymb\fR -to it, then stores the value 1 there. If +to it, then stores the value 1 there\&. If \fBsymb\fR is a variable, this will \fInot\fR store the value 1 into the \fBsymb\fR variable! +.PP +Yasm also supports the following syntax for RIP\-relative addressing: +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [rel sym], rax ; RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [abs sym], rax ; not RIP\-relative +.fi +.if n \{\ +.RE +.\} +.PP +The behavior of: +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [sym], rax +.fi +.if n \{\ +.RE +.\} +.PP +Depends on a mode set by the DEFAULT directive, as follows\&. The default mode is always "abs", and in "rel" mode, use of registers, an fs or gs segment override, or an explicit "abs" override will result in a non\-RIP\-relative effective address\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +default rel +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [sym], rbx ; RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [abs sym], rbx ; not RIP\-relative (explicit override) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [rbx+1], rbx ; not RIP\-relative (register use) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [fs:sym], rbx ; not RIP\-relative (fs or gs use) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [ds:sym], rbx ; RIP\-relative (segment, but not fs or gs) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [rel sym], rbx ; RIP\-relative (redundant override) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +default abs +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [sym], rbx ; not RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [abs sym], rbx ; not RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [rbx+1], rbx ; not RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [fs:sym], rbx ; not RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [ds:sym], rbx ; not RIP\-relative +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov [rel sym], rbx ; RIP\-relative (explicit override) +.fi +.if n \{\ +.RE +.\} +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBMemory references\fR +.RS 4 +.PP +Usually the size of a memory reference can be deduced by which registers you\*(Aqre moving\-\-for example, "mov [rax],ecx" is a 32\-bit move, because ecx is 32 bits\&. YASM currently gives the non\-obvious "invalid combination of opcode and operands" error if it can\*(Aqt figure out how much memory you\*(Aqre moving\&. The fix in this case is to add a memory size specifier: qword, dword, word, or byte\&. +.PP +Here\*(Aqs a 64\-bit memory move, which sets 8 bytes starting at rax: +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov qword [rax], 1 +.fi +.if n \{\ +.RE +.\} +.PP +Here\*(Aqs a 32\-bit memory move, which sets 4 bytes: +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov dword [rax], 1 +.fi +.if n \{\ +.RE +.\} +.PP +Here\*(Aqs a 16\-bit memory move, which sets 2 bytes: +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov word [rax], 1 +.fi +.if n \{\ +.RE +.\} +.PP +Here\*(Aqs an 8\-bit memory move, which sets 1 byte: +.sp +.if n \{\ +.RS 4 +.\} +.nf +mov byte [rax], 1 +.fi +.if n \{\ +.RE +.\} .RE -.\" end of subsection "RIP Relative Addressing" -.\" end of SS subsection "BITS 64 Extensions" .SH "LC3B ARCHITECTURE" .PP The \(lqlc3b\(rq -architecture supports the LC\-3b ISA as used in the ECE 312 (now ECE 411) course at the University of Illinois, Urbana\-Champaign, as well as other university courses. See -\fI\%http://courses.ece.uiuc.edu/ece411/\fR -for more details and example code. The +architecture supports the LC\-3b ISA as used in the ECE 312 (now ECE 411) course at the University of Illinois, Urbana\-Champaign, as well as other university courses\&. See +\m[blue]\fB\%http://courses.ece.uiuc.edu/ece411/\fR\m[] +for more details and example code\&. The \(lqlc3b\(rq architecture consists of only one machine: -\(lqlc3b\(rq. +\(lqlc3b\(rq\&. .SH "SEE ALSO" .PP \fByasm\fR(1) @@ -358,15 +844,17 @@ architecture, it is overly easy to generate AMD64 code (using the \fBBITS 64\fR directive) and generate a 32\-bit object file (by failing to specify \fB\-m amd64\fR -on the command line or selecting a 64\-bit object format). Similarly, specifying +on the command line or selecting a 64\-bit object format)\&. Similarly, specifying \fB\-m amd64\fR -does not default the BITS setting to 64. An easy way to avoid this is by directly specifying a 64\-bit object format such as -\fB\-f elf64\fR. +does not default the BITS setting to 64\&. An easy way to avoid this is by directly specifying a 64\-bit object format such as +\fB\-f elf64\fR\&. .SH "AUTHOR" .PP -\fBPeter\fR \fBJohnson\fR -.sp -1n -.IP "" 3n +\fBPeter Johnson\fR <\&peter@tortall\&.net\&> +.RS 4 Author. +.RE .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2006 Peter Johnson +.br +Copyright \(co 2004, 2005, 2006, 2007 Peter Johnson +.br diff --git a/yasm_dbgfmts.7 b/yasm_dbgfmts.7 index 2227d8cf..aed28823 100644 --- a/yasm_dbgfmts.7 +++ b/yasm_dbgfmts.7 @@ -1,53 +1,63 @@ +'\" t .\" Title: yasm_dbgfmts .\" Author: Peter Johnson -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: October 2006 .\" Manual: Yasm Supported Debug Formats .\" Source: Yasm +.\" Language: English .\" .TH "YASM_DBGFMTS" "7" "October 2006" "Yasm" "Yasm Supported Debug Formats" +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" yasm_dbgfmts \- Yasm Supported Debugging Formats .SH "SYNOPSIS" -.HP 5 -\fByasm\fR \fB\-g\ \fR\fB\fIdbgfmt\fR\fR \fB\fI...\fR\fR +.HP \w'\fByasm\fR\ 'u +\fByasm\fR \fB\-g\ \fR\fB\fIdbgfmt\fR\fR \fB\fI\&.\&.\&.\fR\fR .SH "DESCRIPTION" .PP -The standard Yasm distribution includes a number of modules for different debugging formats. The debugging information is embedded into the object file. Use of a non\-\(lqnull\(rq -debug format also causes Yasm to output all symbols to the object file (including local symbols). +The standard Yasm distribution includes a number of modules for different debugging formats\&. The debugging information is embedded into the object file\&. Use of a non\-\(lqnull\(rq +debug format also causes Yasm to output all symbols to the object file (including local symbols)\&. .PP The debug format is selected on the \fByasm\fR(1) command line by use of the \fB\-g \fR\fB\fIdbgfmt\fR\fR -command line option. +command line option\&. .SH "CV8" .PP -The CV8 debug format is used by Microsoft Visual Studio 2005 (version 8.0) and is completely undocumented, although it bears strong similarities to earlier CodeView formats. Yasm's support for the CV8 debug format is currently limited to generating assembly\-level line number information (to allow some level of source\-level debugging). The CV8 debug information is stored in the .debug$S and .debug$T sections of the Win64 object file. +The CV8 debug format is used by Microsoft Visual Studio 2005 (version 8\&.0) and is completely undocumented, although it bears strong similarities to earlier CodeView formats\&. Yasm\'s support for the CV8 debug format is currently limited to generating assembly\-level line number information (to allow some level of source\-level debugging)\&. The CV8 debug information is stored in the \&.debug$S and \&.debug$T sections of the Win64 object file\&. .SH "DWARF2" .PP -The DWARF 2 debug format is a complex, well\-documented standard for debugging information. It was created to overcome shortcomings in STABS, allowing for much more detailed and compact descriptions of data structures, data variable movement, and complex language structures such as in C++. The debugging information is stored in sections (just like normal program sections) in the object file. Yasm supports full pass\-through of DWARF2 debugging information (e.g. from a C++ compiler), and can also generate assembly\-level line number information. +The DWARF 2 debug format is a complex, well\-documented standard for debugging information\&. It was created to overcome shortcomings in STABS, allowing for much more detailed and compact descriptions of data structures, data variable movement, and complex language structures such as in C++\&. The debugging information is stored in sections (just like normal program sections) in the object file\&. Yasm supports full pass\-through of DWARF2 debugging information (e\&.g\&. from a C++ compiler), and can also generate assembly\-level line number information\&. .SH "NULL" .PP The \(lqnull\(rq -debug format is a placeholder; it adds no debugging information to the output file. +debug format is a placeholder; it adds no debugging information to the output file\&. .SH "STABS" .PP -The STABS debug format is a poorly documented, semi\-standard format for debugging information in COFF and ELF object files. The debugging information is stored as part of the object file's symbol table and thus is limited in complexity and scope. Despite this, STABS is a common debugging format on older Unix and compatible systems, as well as DJGPP. +The STABS debug format is a poorly documented, semi\-standard format for debugging information in COFF and ELF object files\&. The debugging information is stored as part of the object file\'s symbol table and thus is limited in complexity and scope\&. Despite this, STABS is a common debugging format on older Unix and compatible systems, as well as DJGPP\&. .SH "SEE ALSO" .PP \fByasm\fR(1), \fByasm_objfmts\fR(7) .SH "AUTHOR" .PP -\fBPeter\fR \fBJohnson\fR -.sp -1n -.IP "" 3n +\fBPeter Johnson\fR <\&peter@tortall\&.net\&> +.RS 4 Author. +.RE .SH "COPYRIGHT" +.br Copyright \(co 2006 Peter Johnson +.br diff --git a/yasm_objfmts.7 b/yasm_objfmts.7 index 9825c0ac..bc649860 100644 --- a/yasm_objfmts.7 +++ b/yasm_objfmts.7 @@ -1,81 +1,102 @@ +'\" t .\" Title: yasm_objfmts .\" Author: Peter Johnson -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: February 2007 .\" Manual: Yasm Supported Object Formats .\" Source: Yasm +.\" Language: English .\" .TH "YASM_OBJFMTS" "7" "February 2007" "Yasm" "Yasm Supported Object Formats" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" yasm_objfmts \- Yasm Supported Object Formats .SH "SYNOPSIS" -.HP 5 -\fByasm\fR \fB\-f\ \fR\fB\fIobjfmt\fR\fR \fB\fI...\fR\fR +.HP \w'\fByasm\fR\ 'u +\fByasm\fR \fB\-f\ \fR\fB\fIobjfmt\fR\fR \fB\fI\&.\&.\&.\fR\fR .SH "DESCRIPTION" .PP -The standard Yasm distribution includes a number of modules for different object formats (Yasm's primary output). +The standard Yasm distribution includes a number of modules for different object formats (Yasm\*(Aqs primary output)\&. .PP The object format is selected on the \fByasm\fR(1) command line by use of the \fB\-f \fR\fB\fIobjfmt\fR\fR -command line option. +command line option\&. .SH "BIN" .PP The \(lqbin\(rq -object format produces a flat\-format, non\-relocatable binary file. It is appropriate for producing DOS .COM executables or things like boot blocks. It supports only 3 sections and those sections are written in a predefined order to the output file. +object format produces a flat\-format, non\-relocatable binary file\&. It is appropriate for producing DOS \&.COM executables or things like boot blocks\&. It supports only 3 sections and those sections are written in a predefined order to the output file\&. .SH "COFF" .PP -The COFF object format is an older relocatable object format used on older Unix and compatible systems, and also (more recently) on the DJGPP development system for DOS. +The COFF object format is an older relocatable object format used on older Unix and compatible systems, and also (more recently) on the DJGPP development system for DOS\&. .SH "DBG" .PP The \(lqdbg\(rq object format is not a \(lqreal\(rq -object format; the output file it creates simply describes the sequence of calls made to it by Yasm and the final object and symbol table information in a human\-readable text format (that in a normal object format would get processed into that object format's particular binary representation). This object format is not intended for real use, but rather for debugging Yasm's internals. +object format; the output file it creates simply describes the sequence of calls made to it by Yasm and the final object and symbol table information in a human\-readable text format (that in a normal object format would get processed into that object format\*(Aqs particular binary representation)\&. This object format is not intended for real use, but rather for debugging Yasm\*(Aqs internals\&. .SH "ELF" .PP -The ELF object format really comes in two flavors: +The ELF object format really comes in three flavors: \(lqelf32\(rq -(for 32\-bit targets) and +(for 32\-bit targets), \(lqelf64\(rq -(for 64\-bit targets). ELF is a standard object format in common use on modern Unix and compatible systems (e.g. Linux, FreeBSD). ELF has complex support for relocatable and shared objects. +(for 64\-bit targets and +\(lqelfx32\(rq +(for x32 targets)\&. ELF is a standard object format in common use on modern Unix and compatible systems (e\&.g\&. Linux, FreeBSD)\&. ELF has complex support for relocatable and shared objects\&. .SH "MACHO" .PP The Mach\-O object format really comes in two flavors: \(lqmacho32\(rq (for 32\-bit targets) and \(lqmacho64\(rq -(for 64\-bit targets). Mach\-O is used as the object format on MacOS X. As Yasm currently only supports x86 and AMD64 instruction sets, it can only generate Mach\-O objects for Intel\-based Macs. +(for 64\-bit targets)\&. Mach\-O is used as the object format on MacOS X\&. As Yasm currently only supports x86 and AMD64 instruction sets, it can only generate Mach\-O objects for Intel\-based Macs\&. .SH "RDF" .PP -The RDOFF2 object format is a simple multi\-section format originally designed for NASM. It supports segment references but not WRT references. It was designed primarily for simplicity and has minimalistic headers for ease of loading and linking. A complete toolchain (linker, librarian, and loader) is distributed with NASM. +The RDOFF2 object format is a simple multi\-section format originally designed for NASM\&. It supports segment references but not WRT references\&. It was designed primarily for simplicity and has minimalistic headers for ease of loading and linking\&. A complete toolchain (linker, librarian, and loader) is distributed with NASM\&. .SH "WIN32" .PP -The Win32 object format produces object files compatible with Microsoft compilers (such as Visual C++) that target the 32\-bit x86 Windows platform. The object format itself is an extended version of COFF. +The Win32 object format produces object files compatible with Microsoft compilers (such as Visual C++) that target the 32\-bit x86 Windows platform\&. The object format itself is an extended version of COFF\&. .SH "WIN64" .PP The Win64 object format produces object files compatible with Microsoft compilers that target the 64\-bit \(lqx64\(rq -Windows platform. This format is very similar to the win32 object format, but produces 64\-bit objects. +Windows platform\&. This format is very similar to the win32 object format, but produces 64\-bit objects\&. .SH "XDF" .PP -The XDF object format is essentially a simplified version of COFF. It's a multi\-section relocatable format that supports 64\-bit physical and virtual addresses. +The XDF object format is essentially a simplified version of COFF\&. It\*(Aqs a multi\-section relocatable format that supports 64\-bit physical and virtual addresses\&. .SH "SEE ALSO" .PP \fByasm\fR(1), \fByasm_arch\fR(7) .SH "AUTHOR" .PP -\fBPeter\fR \fBJohnson\fR -.sp -1n -.IP "" 3n +\fBPeter Johnson\fR <\&peter@tortall\&.net\&> +.RS 4 Author. +.RE .SH "COPYRIGHT" +.br Copyright \(co 2006 Peter Johnson +.br diff --git a/yasm_parsers.7 b/yasm_parsers.7 index a418b6f1..058db4b7 100644 --- a/yasm_parsers.7 +++ b/yasm_parsers.7 @@ -1,48 +1,58 @@ +'\" t .\" Title: yasm_parsers .\" Author: Peter Johnson -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: October 2006 .\" Manual: Yasm Supported Parsers .\" Source: Yasm +.\" Language: English .\" .TH "YASM_PARSERS" "7" "October 2006" "Yasm" "Yasm Supported Parsers" +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" yasm_parsers \- Yasm Supported Parsers (Assembler Syntaxes) .SH "SYNOPSIS" -.HP 5 -\fByasm\fR \fB\-p\ \fR\fB\fIparser\fR\fR [\fB\-r\ \fR\fB\fIpreproc\fR\fR] \fB\fI...\fR\fR +.HP \w'\fByasm\fR\ 'u +\fByasm\fR \fB\-p\ \fR\fB\fIparser\fR\fR [\fB\-r\ \fR\fB\fIpreproc\fR\fR] \fB\fI\&.\&.\&.\fR\fR .SH "DESCRIPTION" .PP -The standard Yasm distribution includes a number of modules for different parsers (assembler syntaxes). +The standard Yasm distribution includes a number of modules for different parsers (assembler syntaxes)\&. .PP The parser is selected on the \fByasm\fR(1) command line by use of the \fB\-p \fR\fB\fIparser\fR\fR -command line option. +command line option\&. .SH "NASM PARSER" .PP NASM syntax, selected with -\fB\-p nasm\fR, is the most full\-featured syntax supported by Yasm. Yasm is nearly 100% compatible with NASM for 16\-bit and 32\-bit x86 code. Yasm additionally supports 64\-bit AMD64 code with Yasm extensions to the NASM syntax; see +\fB\-p nasm\fR, is the most full\-featured syntax supported by Yasm\&. Yasm is nearly 100% compatible with NASM for 16\-bit and 32\-bit x86 code\&. Yasm additionally supports 64\-bit AMD64 code with Yasm extensions to the NASM syntax; see \fByasm_arch\fR(7) -for details. NASM syntax is the Yasm default. +for details\&. NASM syntax is the Yasm default\&. .SH "GAS PARSER" .PP -The GNU Assembler (GAS) is the de\-facto cross\-platform assembler for modern Unix systems, and is used as the backend for the GCC compiler. Yasm's support for GAS syntax is moderately good, although immature: not all directives are supported, and only 32\-bit x86 and AMD64 architectures are supported. There is also no support for the GAS preprocessor. Despite these limitations, Yasm's GAS syntax support is good enough to handle essentially all x86 and AMD64 GCC compiler output. The GAS parser can be selected with -\fB\-p gas\fR. +The GNU Assembler (GAS) is the de\-facto cross\-platform assembler for modern Unix systems, and is used as the backend for the GCC compiler\&. Yasm\'s support for GAS syntax is moderately good, although immature: not all directives are supported, and only 32\-bit x86 and AMD64 architectures are supported\&. Nearly all of the GAS preprocessor is also supported\&. Yasm\'s GAS syntax support is good enough to handle essentially all x86 and AMD64 GCC compiler output\&. The GAS parser can be selected with +\fB\-p gas\fR\&. .SH "SEE ALSO" .PP \fByasm\fR(1), \fByasm_arch\fR(7) .SH "AUTHOR" .PP -\fBPeter\fR \fBJohnson\fR -.sp -1n -.IP "" 3n +\fBPeter Johnson\fR <\&peter@tortall\&.net\&> +.RS 4 Author. +.RE .SH "COPYRIGHT" +.br Copyright \(co 2006 Peter Johnson +.br