NASM 0.98.09
This commit is contained in:
parent
1cd0e2d5bf
commit
734b188090
29 changed files with 5169 additions and 3572 deletions
2
AUTHORS
2
AUTHORS
|
@ -1,5 +1,5 @@
|
||||||
This is the AUTHORS file for the NASM project located at:
|
This is the AUTHORS file for the NASM project located at:
|
||||||
http://nasm.rm-f.net/
|
http://nasm.2y.net/
|
||||||
|
|
||||||
Names should be inserted as follows:
|
Names should be inserted as follows:
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ bindir = @bindir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CFLAGS = @CFLAGS@ @GCCFLAGS@ -I$(srcdir) -I.
|
CFLAGS = @CFLAGS@ @GCCFLAGS@ -I$(srcdir) -I.
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
|
|
|
@ -7,13 +7,19 @@
|
||||||
#
|
#
|
||||||
# This Makefile is designed to build NASM with the latest
|
# This Makefile is designed to build NASM with the latest
|
||||||
# version of Borland C++Builder and has been tested with
|
# version of Borland C++Builder and has been tested with
|
||||||
# Borland C++ 5.3 (Borland C++Builder 3.0) and Borland C++ 5.4
|
# Borland C++ 5.5 (Borland C++Builder 5.0) in combination
|
||||||
# (Borland C++Builder 4.0) in combination with
|
# Borland MAKE 5.2
|
||||||
# Borland MAKE versions 5.1 and 5.2
|
#
|
||||||
|
# Additionally, the free Borland C++ Compiler 5.5 is supported;
|
||||||
|
# see
|
||||||
|
#
|
||||||
|
# http://www.borland.com/bcppbuilder/freecompiler/
|
||||||
#
|
#
|
||||||
# MAKEFILE is maintained by Stefan.Hoffmeister@Econos.de
|
# MAKEFILE is maintained by Stefan.Hoffmeister@Econos.de
|
||||||
#
|
#
|
||||||
|
|
||||||
|
srcdir=.
|
||||||
|
BINDIR=e:\devel\bcb5\cbuilder5\bin
|
||||||
|
|
||||||
# If "BINDIR=C:\...." has not been defined on the command line
|
# If "BINDIR=C:\...." has not been defined on the command line
|
||||||
# assume that the binary files are in the same directory as the
|
# assume that the binary files are in the same directory as the
|
||||||
|
@ -35,15 +41,19 @@
|
||||||
|
|
||||||
|
|
||||||
CC=$(BINDIR)\bcc32
|
CC=$(BINDIR)\bcc32
|
||||||
CCFLAGS=-tWC -c -O2 -A
|
CCFLAGS=-q -Q -tWC -c -O2 -A -w-8057
|
||||||
|
# /q: Suppress compiler identification banner
|
||||||
|
# /Q: Extended compiler error information
|
||||||
# /-tWC: Windows console mode application
|
# /-tWC: Windows console mode application
|
||||||
# /c: Compile, do not link
|
# /c: Compile, do not link
|
||||||
# /O2: Optimize for speed
|
# /O2: Optimize for speed
|
||||||
# /A: ANSI compatible code only
|
# /A: ANSI compatible code only
|
||||||
|
# /-w-8057: Turn off "Parameter <param> never used in function <func>" warning
|
||||||
|
|
||||||
LINK=$(BINDIR)\ilink32
|
LINK=$(BINDIR)\ilink32
|
||||||
LINKFLAGS=/V4.0 /x /c /ap /L$(BINDIR)\..\LIB # /L -> default LIB directory
|
LINKFLAGS=/V4.0 /q /x /c /ap /L$(BINDIR)\..\LIB # /L -> default LIB directory
|
||||||
# /V4.0: marked as Win95 / NT application in PE header
|
# /V4.0: marked as Win95 / NT application in PE header
|
||||||
|
# /q: suppress command-line banner
|
||||||
# /x: no map file
|
# /x: no map file
|
||||||
# /c: case sensitive link
|
# /c: case sensitive link
|
||||||
# /ap: link for 32-bit console application
|
# /ap: link for 32-bit console application
|
||||||
|
@ -131,7 +141,30 @@ parser.$(OBJ): parser.c nasm.h insnsi.h nasmlib.h parser.h float.h names.c insns
|
||||||
preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h insnsi.h nasmlib.h
|
preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h insnsi.h nasmlib.h
|
||||||
sync.$(OBJ): sync.c sync.h
|
sync.$(OBJ): sync.c sync.h
|
||||||
|
|
||||||
|
# These source files are automagically generated from a single
|
||||||
|
# instruction-table file by a Perl script. They're distributed,
|
||||||
|
# though, so it isn't necessary to have Perl just to recompile NASM
|
||||||
|
# from the distribution.
|
||||||
|
|
||||||
|
insnsa.c: InstructionData
|
||||||
|
insnsd.c: InstructionData
|
||||||
|
insnsi.h: InstructionData
|
||||||
|
insnsn.c: InstructionData
|
||||||
|
|
||||||
|
InstructionData: insns.dat insns.pl
|
||||||
|
perl $(srcdir)/insns.pl -a $(srcdir)/insns.dat
|
||||||
|
|
||||||
|
# This source file is generated from the standard macros file
|
||||||
|
# `standard.mac' by another Perl script. Again, it's part of the
|
||||||
|
# standard distribution.
|
||||||
|
|
||||||
|
macros.c: standard.mac macros.pl
|
||||||
|
perl $(srcdir)/macros.pl $(srcdir)/standard.mac
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
del *.obj
|
@-del /S *.obj 2> NUL 1>&2
|
||||||
del nasm$(SUFFIX)$(EXE)
|
@-del /S *.il? 2> NUL 1>&2
|
||||||
del ndisasm$(SUFFIX)$(EXE)
|
@-del /S *.tds 2> NUL 1>&2
|
||||||
|
@-del /S *.~* 2> NUL 1>&2
|
||||||
|
@-del /S nasm$(SUFFIX)$(EXE) 2> NUL 1>&2
|
||||||
|
@-del /S ndisasm$(SUFFIX)$(EXE) 2> NUL 1>&2
|
||||||
|
|
46
Mkfiles/Makefile.dl
Normal file
46
Mkfiles/Makefile.dl
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# Makefile for the Netwide Assembler under 16-bit DOS
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# This Makefile is designed to build NASM using David Lindauer's
|
||||||
|
# cc386
|
||||||
|
|
||||||
|
CC = cc386 /C+N
|
||||||
|
LINK = valx -case -use32 -map
|
||||||
|
LINKFLAGS =
|
||||||
|
LIBRARIES =
|
||||||
|
OBJ = obj
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
$(CC) $&
|
||||||
|
&nasm -fobj $&.ASM
|
||||||
|
|
||||||
|
NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) nasmlib.$(OBJ) \
|
||||||
|
insnsd.$(OBJ)
|
||||||
|
|
||||||
|
NASMOBJS = nasm.$(OBJ) nasmlib.$(OBJ) eval.$(OBJ) float.$(OBJ) insnsa.$(OBJ) \
|
||||||
|
assemble.$(OBJ) labels.$(OBJ) parser.$(OBJ) outform.$(OBJ) \
|
||||||
|
outbin.$(OBJ) outaout.$(OBJ) outcoff.$(OBJ) outelf.$(OBJ) \
|
||||||
|
outobj.$(OBJ) outas86.$(OBJ) outrdf.$(OBJ) outrdf2.$(OBJ) outdbg.$(OBJ) \
|
||||||
|
preproc.$(OBJ) listing.$(OBJ) zoutieee.$(OBJ)
|
||||||
|
|
||||||
|
all : nasm.exe ndisasm.exe
|
||||||
|
|
||||||
|
# We have to have a horrible kludge here to get round the 128 character
|
||||||
|
# limit, as usual...
|
||||||
|
LINKOBJS = a*.obj e*.obj f*.obj insnsa.obj l*.obj na*.obj o*.obj p*.obj z*.obj
|
||||||
|
nasm.exe: $(NASMOBJS)
|
||||||
|
$(LINK) \cc386\lib\c0dos $(LINKOBJS:.obj=),nasm,nasm,\cc386\lib\cldos
|
||||||
|
|
||||||
|
ndisasm.exe: $(NDISASMOBJS)
|
||||||
|
$(LINK) \cc386\lib\c0dos.obj $(NDISASMOBJS:.obj=),ndisasm,ndisasm,\cc386\lib\cldos
|
||||||
|
|
||||||
|
clean :
|
||||||
|
del *.asm
|
||||||
|
del *.obj
|
||||||
|
del *.map
|
||||||
|
del *.exe
|
||||||
|
|
|
@ -546,7 +546,9 @@ static int is_sbyte (insn *ins, int op, int size)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = !(ins->forw_ref && ins->oprs[op].opflags ) && /* dead in the water on forward reference or External */
|
ret = !(ins->forw_ref && ins->oprs[op].opflags ) && /* dead in the water on forward reference or External */
|
||||||
ins->oprs[op].wrt==NO_SEG && ins->oprs[op].segment==NO_SEG;
|
!(ins->oprs[op].type & (BITS16|BITS32)) && /* John Coffman's 3/24/01 patch - fbk - 10/16/01 */
|
||||||
|
ins->oprs[op].wrt==NO_SEG && ins->oprs[op].segment==NO_SEG;
|
||||||
|
|
||||||
v = ins->oprs[op].offset;
|
v = ins->oprs[op].offset;
|
||||||
if (size==16) v = (signed short)v; /* sign extend if 16 bits */
|
if (size==16) v = (signed short)v; /* sign extend if 16 bits */
|
||||||
|
|
||||||
|
|
254
doc/makedocs.bat
Normal file
254
doc/makedocs.bat
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
@echo off
|
||||||
|
if "%1"=="clean" goto makeclean
|
||||||
|
if "%1"=="CLEAN" goto makeclean
|
||||||
|
if "%1"=="spotless" goto spotless
|
||||||
|
if "%1"=="SPOTLESS" goto spotless
|
||||||
|
if "%1"=="install" goto install
|
||||||
|
if "%1"=="INSTALL" goto install
|
||||||
|
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Usage:
|
||||||
|
echo.
|
||||||
|
echo makedocs - no parameters - makes all Docs
|
||||||
|
echo makedocs install - installs already made docs in subdirectories
|
||||||
|
echo makedocs clean - removes docs from current directory
|
||||||
|
echo makedocs spotless - removes all - including default install dirs
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Makedocs(.bat), with no parameters will create Nasm Documentation
|
||||||
|
echo in several formats: plain ascii text, ps, html, rtf, Windows help
|
||||||
|
echo format, and if you've got an "info" system installed, info format.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo This requires Perl, and almost 4MB disk space.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Proceed with making docs? "
|
||||||
|
if errorlevel 2 goto exit
|
||||||
|
|
||||||
|
:makeall
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo This takes a while. Stretch!
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
perl rdsrc.pl<nasmdoc.src
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Make *info* files? "
|
||||||
|
if errorlevel 2 goto noinfo
|
||||||
|
:makeinfo
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
makeinfo nasmdoc.tex
|
||||||
|
|
||||||
|
:noinfo
|
||||||
|
|
||||||
|
:install
|
||||||
|
|
||||||
|
if not exist nasmdoc.txt goto nofiles
|
||||||
|
if not exist nasmdoc0.htm goto nofiles
|
||||||
|
if not exist nasmdo10.htm goto nofiles
|
||||||
|
if not exist nasmdoc.hpj goto nofiles
|
||||||
|
if not exist nasmdoc.rtf goto nofiles
|
||||||
|
if not exist nasmdoc.ps goto nofiles
|
||||||
|
if not exist nasmdoc.tex goto nofiles
|
||||||
|
goto gotfiles
|
||||||
|
:nofiles
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Alert! Files missing!
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Would you like to make them now? "
|
||||||
|
if errorlevel 2 goto exit
|
||||||
|
goto makeall
|
||||||
|
|
||||||
|
:gotfiles
|
||||||
|
|
||||||
|
:: get current path
|
||||||
|
|
||||||
|
set oldprompt=%prompt%
|
||||||
|
echo @prompt set nasdoc=$p>temp1.bat
|
||||||
|
command /c temp1.bat>temp2.bat
|
||||||
|
call temp2
|
||||||
|
del temp1.bat
|
||||||
|
del temp2.bat
|
||||||
|
set prompt=%oldprompt%
|
||||||
|
set oldprompt=
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Current Directory is %nasdoc%
|
||||||
|
echo Nasm Documentation will be installed under this
|
||||||
|
echo as %nasdoc%\text\nasmdoc.txt, etc.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Change this directory? "
|
||||||
|
if errorlevel 2 goto dirok
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Directory *above* the directory you name (at least) should exist.
|
||||||
|
echo Nasm documentation will be installed *under* the directory you
|
||||||
|
echo name. E.G. \docs\nasm\html, etc. No trailing backslash!
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
echo Enter new name for base directory:
|
||||||
|
set input=
|
||||||
|
fc con nul /lb1 /n|date|find "1:">magic.bat
|
||||||
|
echo set input=%%5>enter.bat
|
||||||
|
call magic
|
||||||
|
set nasdoc=%input%
|
||||||
|
del magic.bat
|
||||||
|
del enter.bat
|
||||||
|
set input=
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
md %nasdoc%
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
choice " Install Text docs in %nasdoc%\text ? "
|
||||||
|
if errorlevel 2 goto notext
|
||||||
|
md %nasdoc%\text
|
||||||
|
copy nasmdoc.txt %nasdoc%\text
|
||||||
|
:notext
|
||||||
|
|
||||||
|
choice " Install Html docs in %nasdoc%\html ? "
|
||||||
|
if errorlevel 2 goto nohtml
|
||||||
|
md %nasdoc%\html
|
||||||
|
copy *.htm %nasdoc%\html
|
||||||
|
:nohtml
|
||||||
|
|
||||||
|
choice " Install Info docs in %nasdoc%\info ? "
|
||||||
|
if errorlevel 2 goto noinfodocs
|
||||||
|
if not exist nasm.inf goto inofiles
|
||||||
|
if not exist nasm.i9 goto inofiles
|
||||||
|
goto gotifiles
|
||||||
|
:inofiles
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Alert! Files missing!
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Would you like to make them now? "
|
||||||
|
if errorlevel 2 goto noinfodocs
|
||||||
|
if not exist nasmdoc.tex goto makeall
|
||||||
|
goto makeinfo
|
||||||
|
|
||||||
|
:gotifiles
|
||||||
|
|
||||||
|
md %nasdoc%\info
|
||||||
|
copy nasm.i* %nasdoc%\info
|
||||||
|
:noinfodocs
|
||||||
|
|
||||||
|
choice " Install Winhelp docs in %nasdoc%\winhelp ? "
|
||||||
|
if errorlevel 2 goto nowinhelp
|
||||||
|
md %nasdoc%\winhelp
|
||||||
|
copy nasmdoc.rtf %nasdoc%\winhelp
|
||||||
|
copy nasmdoc.hpj %nasdoc%\winhelp
|
||||||
|
:nowinhelp
|
||||||
|
|
||||||
|
choice " Install Postscript docs in %nasdoc%\ps ? "
|
||||||
|
if errorlevel 2 goto nops
|
||||||
|
md %nasdoc%\ps
|
||||||
|
copy nasmdoc.ps %nasdoc%\ps
|
||||||
|
:nops
|
||||||
|
goto cleanup
|
||||||
|
|
||||||
|
:dirok
|
||||||
|
|
||||||
|
choice " Install Text docs in .\text ? "
|
||||||
|
if errorlevel 2 goto notext2
|
||||||
|
md text
|
||||||
|
copy nasmdoc.txt text
|
||||||
|
:notext2
|
||||||
|
|
||||||
|
choice " Install Html docs in .\html ? "
|
||||||
|
if errorlevel 2 goto nohtml2
|
||||||
|
md html
|
||||||
|
copy *.htm html
|
||||||
|
:nohtml2
|
||||||
|
|
||||||
|
choice " Install Info docs in .\info ? "
|
||||||
|
if errorlevel 2 goto nid2
|
||||||
|
|
||||||
|
if not exist nasm.inf goto inof2
|
||||||
|
if not exist nasm.i9 goto inof2
|
||||||
|
goto gifiles2
|
||||||
|
:inof2
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Alert! Files missing!
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Would you like to make them now? "
|
||||||
|
if errorlevel 2 goto nid2
|
||||||
|
if not exist nasmdoc.tex goto makeall
|
||||||
|
goto makeinfo
|
||||||
|
|
||||||
|
:gifiles2
|
||||||
|
|
||||||
|
md info
|
||||||
|
copy nasm.i* info
|
||||||
|
:nid2
|
||||||
|
|
||||||
|
choice " Install Winhelp docs in .\winhelp ? "
|
||||||
|
if errorlevel 2 goto nwhelp2
|
||||||
|
md winhelp
|
||||||
|
copy nasmdoc.rtf winhelp
|
||||||
|
copy nasmdoc.hpj winhelp
|
||||||
|
:nwhelp2
|
||||||
|
|
||||||
|
choice " Install Postscript docs in .\ps ? "
|
||||||
|
if errorlevel 2 goto nops2
|
||||||
|
md ps
|
||||||
|
copy nasmdoc.ps ps
|
||||||
|
:nops2
|
||||||
|
|
||||||
|
|
||||||
|
:cleanup
|
||||||
|
set nasdoc=
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
choice " Remove all files created, but not installed?"
|
||||||
|
if not errorlevel 2 goto makeclean
|
||||||
|
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
:spotless
|
||||||
|
deltree /y text
|
||||||
|
deltree /y html
|
||||||
|
deltree /y info
|
||||||
|
deltree /y winhelp
|
||||||
|
deltree /y ps
|
||||||
|
|
||||||
|
:makeclean
|
||||||
|
del *.htm
|
||||||
|
del *.rtf
|
||||||
|
del *.hpj
|
||||||
|
del *.txt
|
||||||
|
del *.tex
|
||||||
|
del *.ps
|
||||||
|
del nasm.i*
|
||||||
|
|
||||||
|
:exit
|
149
doc/nasmdoc.src
149
doc/nasmdoc.src
|
@ -592,6 +592,39 @@ and increase compilation speeds. The \c{-a} option, requiring no
|
||||||
argument, instructs NASM to replace its powerful \i{preprocessor}
|
argument, instructs NASM to replace its powerful \i{preprocessor}
|
||||||
with a \i{stub preprocessor} which does nothing.
|
with a \i{stub preprocessor} which does nothing.
|
||||||
|
|
||||||
|
\S{opt-t} The \i\c{-t} option: Enable TASM Compatibility Mode
|
||||||
|
|
||||||
|
NASM includes a limited form of compatibility with Borland's TASM.
|
||||||
|
When NASM's -t option is used, the following changes are made:
|
||||||
|
|
||||||
|
\b local labels may be prefixed with \c{@@} instead of \c{.}
|
||||||
|
|
||||||
|
\b TASM-style response files beginning with \c{@} may be specified on
|
||||||
|
the command line. This is different from the \c{-@resp} style that NASM
|
||||||
|
natively supports.
|
||||||
|
|
||||||
|
\b size override is supported within brackets. In TASM compatible mode,
|
||||||
|
a size override inside square brackets changes the size of the operand,
|
||||||
|
and not the address type of the operand as it does in NASM syntax. E.g.
|
||||||
|
\c{mov eax,[DWORD val]} is valid syntax in TASM compatibility mode.
|
||||||
|
Note that you lose the ability to override the default address type for
|
||||||
|
the instruction.
|
||||||
|
|
||||||
|
\b \c{%arg} preprocessor directive is supported which is similar to
|
||||||
|
TASM's ARG directive.
|
||||||
|
|
||||||
|
\b \c{%local} preprocessor directive
|
||||||
|
|
||||||
|
\b \c{%stacksize} preprocessor directive
|
||||||
|
|
||||||
|
\b unprefixed forms of some directives supported (arg, elif, else,
|
||||||
|
endif, if, ifdef, ifdifi, ifndef, include, local)
|
||||||
|
|
||||||
|
\b more...
|
||||||
|
|
||||||
|
For more information on the directives, see the section on TASM
|
||||||
|
Compatiblity preprocessor directives in \k{tasmcompat}.
|
||||||
|
|
||||||
\S{opt-w} The \i\c{-w} Option: Enable or Disable Assembly \i{Warnings}
|
\S{opt-w} The \i\c{-w} Option: Enable or Disable Assembly \i{Warnings}
|
||||||
|
|
||||||
NASM can observe many conditions during the course of assembly which
|
NASM can observe many conditions during the course of assembly which
|
||||||
|
@ -2585,6 +2618,111 @@ boundary, for example, is a waste of effort. Again, NASM does not
|
||||||
check that the section's alignment characteristics are sensible for
|
check that the section's alignment characteristics are sensible for
|
||||||
the use of \c{ALIGN} or \c{ALIGNB}.
|
the use of \c{ALIGN} or \c{ALIGNB}.
|
||||||
|
|
||||||
|
\H{tasmcompat} \i{TASM Compatible Preprocessor Directives}
|
||||||
|
|
||||||
|
The following preprocessor directives may only be used when TASM
|
||||||
|
compatibility is turned on using the \c{-t} command line switch
|
||||||
|
(This switch is described in \k{opt-t}.)
|
||||||
|
|
||||||
|
\b\c{%arg} (see \k{arg})
|
||||||
|
|
||||||
|
\b\c{%stacksize} (see \k{stacksize})
|
||||||
|
|
||||||
|
\b\c{%local} (see \k{local})
|
||||||
|
|
||||||
|
\S{arg} \i\c{%arg} Directive
|
||||||
|
|
||||||
|
The \c{%arg} directive is used to simplify the handling of
|
||||||
|
parameters passed on the stack. Stack based parameter passing
|
||||||
|
is used by many high level languages, including C, C++ and Pascal.
|
||||||
|
|
||||||
|
While NASM comes with macros which attempt to duplicate this
|
||||||
|
functionality (see \k{16cmacro}), the syntax is not particularly
|
||||||
|
convenient to use and is not TASM compatible. Here is an example
|
||||||
|
which shows the use of \c{%arg} without any external macros:
|
||||||
|
|
||||||
|
\c some_function:
|
||||||
|
\c %push mycontext ; save the current context
|
||||||
|
\c %stacksize large ; tell NASM to use bp
|
||||||
|
\c %arg i:word, j_ptr:word
|
||||||
|
\c mov ax,[i]
|
||||||
|
\c mov bx,[j_ptr]
|
||||||
|
\c add ax,[bx]
|
||||||
|
\c ret
|
||||||
|
\c %pop ; restore original context
|
||||||
|
|
||||||
|
This is similar to the procedure defined in \k{16cmacro} and adds
|
||||||
|
the value in i to the value pointed to by j_ptr and returns the
|
||||||
|
sum in the ax register. See \k{pushpop} for an explanation of
|
||||||
|
\c{push} and \c{pop} and the use of context stacks.
|
||||||
|
|
||||||
|
\S{stacksize} \i\c{%stacksize} Directive
|
||||||
|
|
||||||
|
The \c{%stacksize} directive is used in conjunction with the
|
||||||
|
\c{%arg} (see \k{arg}) and the \c{%local} (see \k{local}) directives.
|
||||||
|
It tells NASM the default size to use for subsequent \c{%arg} and
|
||||||
|
\c{%local} directives. The \c{%stacksize} directive takes one
|
||||||
|
required argument which is one of \c{flat}, \c{large} or \c{small}.
|
||||||
|
|
||||||
|
\c %stacksize flat
|
||||||
|
|
||||||
|
This form causes NASM to use stack-based parameter addressing
|
||||||
|
relative to \c{ebp} and it assumes that a near form of call was used
|
||||||
|
to get to this label (i.e. that \c{eip} is on the stack).
|
||||||
|
|
||||||
|
\c %stacksize large
|
||||||
|
|
||||||
|
This form uses \c{bp} to do stack-based parameter addressing and
|
||||||
|
assumes that a far form of call was used to get to this address
|
||||||
|
(i.e. that \c{ip} and \c{cs} are on the stack).
|
||||||
|
|
||||||
|
\c %stacksize small
|
||||||
|
|
||||||
|
This form also uses \c{bp} to address stack parameters, but it is
|
||||||
|
different from \c{large} because it also assumes that the old value
|
||||||
|
of bp is pushed onto the stack (i.e. it expects an \c{ENTER}
|
||||||
|
instruction). In other words, it expects that \c{bp}, \c{ip} and
|
||||||
|
\c{cs} are on the top of the stack, underneath any local space which
|
||||||
|
may have been allocated by \c{ENTER}. This form is probably most
|
||||||
|
useful when used in combination with the \c{%local} directive
|
||||||
|
(see \k{local}).
|
||||||
|
|
||||||
|
\S{local} \i\c{%local} Directive
|
||||||
|
|
||||||
|
The \c{%local} directive is used to simplify the use of local
|
||||||
|
temporary stack variables allocated in a stack frame. Automatic
|
||||||
|
local variables in C are an example of this kind of variable. The
|
||||||
|
\c{%local} directive is most useful when used with the \c{%stacksize}
|
||||||
|
(see \k{stacksize} and is also compatible with the \c{%arg} directive
|
||||||
|
(see \k{arg}). It allows simplified reference to variables on the
|
||||||
|
stack which have been allocated typically by using the \c{ENTER}
|
||||||
|
instruction (see \k{insENTER} for a description of that instruction).
|
||||||
|
An example of its use is the following:
|
||||||
|
|
||||||
|
\c silly_swap:
|
||||||
|
\c %push mycontext ; save the current context
|
||||||
|
\c %stacksize small ; tell NASM to use bp
|
||||||
|
\c %assign %$localsize 0 ; see text for explanation
|
||||||
|
\c %local old_ax:word, old_dx:word
|
||||||
|
\c enter %$localsize,0 ; see text for explanation
|
||||||
|
\c mov [old_ax],ax ; swap ax & bx
|
||||||
|
\c mov [old_dx],dx ; and swap dx & cx
|
||||||
|
\c mov ax,bx
|
||||||
|
\c mov dx,cx
|
||||||
|
\c mov bx,[old_ax]
|
||||||
|
\c mov cx,[old_dx]
|
||||||
|
\c leave ; restore old bp
|
||||||
|
\c ret ;
|
||||||
|
\c %pop ; restore original context
|
||||||
|
|
||||||
|
The \c{%$localsize} variable is used internally by the
|
||||||
|
\c{%local} directive and \e{must} be defined within the
|
||||||
|
current context before the \c{%local} directive may be used.
|
||||||
|
Failure to do so will result in one expression syntax error for
|
||||||
|
each \c{%local} variable declared. It then may be used in
|
||||||
|
the construction of an appropriately sized ENTER instruction
|
||||||
|
as shown in the example.
|
||||||
|
|
||||||
\C{directive} \i{Assembler Directives}
|
\C{directive} \i{Assembler Directives}
|
||||||
|
|
||||||
NASM, though it attempts to avoid the bureaucracy of assemblers like
|
NASM, though it attempts to avoid the bureaucracy of assemblers like
|
||||||
|
@ -4173,6 +4311,9 @@ directory, is a file \c{c16.mac} of macros. It defines three macros:
|
||||||
used for C-style procedure definitions, and they automate a lot of
|
used for C-style procedure definitions, and they automate a lot of
|
||||||
the work involved in keeping track of the calling convention.
|
the work involved in keeping track of the calling convention.
|
||||||
|
|
||||||
|
(An alternative, TASM compatible form of \c{arg} is also now built
|
||||||
|
into NASM's preprocessor. See \k{tasmcompat} for details.)
|
||||||
|
|
||||||
An example of an assembly function using the macro set is given
|
An example of an assembly function using the macro set is given
|
||||||
here:
|
here:
|
||||||
|
|
||||||
|
@ -5371,7 +5512,7 @@ The encodings for the various classes of register are:
|
||||||
\b \i{Segment registers}: \c{ES} is 0, \c{CS} is 1, \c{SS} is 2, \c{DS}
|
\b \i{Segment registers}: \c{ES} is 0, \c{CS} is 1, \c{SS} is 2, \c{DS}
|
||||||
is 3, \c{FS} is 4, and \c{GS} is 5.
|
is 3, \c{FS} is 4, and \c{GS} is 5.
|
||||||
|
|
||||||
\b \I{floating-point, registers}{Floating-point registers}: \c{ST0}
|
\b \I{floating-point, registers}Floating-point registers: \c{ST0}
|
||||||
is 0, \c{ST1} is 1, \c{ST2} is 2, \c{ST3} is 3, \c{ST4} is 4,
|
is 0, \c{ST1} is 1, \c{ST2} is 2, \c{ST3} is 3, \c{ST4} is 4,
|
||||||
\c{ST5} is 5, \c{ST6} is 6, and \c{ST7} is 7.
|
\c{ST5} is 5, \c{ST6} is 6, and \c{ST7} is 7.
|
||||||
|
|
||||||
|
@ -6296,7 +6437,7 @@ of both their operands.
|
||||||
\c DIVSS xmmreg,memory ; F3,0F,5E,/r [KATMAI,SSE]
|
\c DIVSS xmmreg,memory ; F3,0F,5E,/r [KATMAI,SSE]
|
||||||
\c DIVSS xmmreg,xmmreg ; ?? [KATMAI,SSE]
|
\c DIVSS xmmreg,xmmreg ; ?? [KATMAI,SSE]
|
||||||
|
|
||||||
c\{DIVSS}-The DIVSS instructions divide the lowest SP FP numbers
|
\c{DIVSS}-The DIVSS instructions divide the lowest SP FP numbers
|
||||||
of both operands; the upper three fields are passed through from xmm1.
|
of both operands; the upper three fields are passed through from xmm1.
|
||||||
|
|
||||||
|
|
||||||
|
@ -6404,7 +6545,7 @@ register stack.
|
||||||
\c{FCHS} negates the number in \c{ST0}: negative numbers become
|
\c{FCHS} negates the number in \c{ST0}: negative numbers become
|
||||||
positive, and vice versa.
|
positive, and vice versa.
|
||||||
|
|
||||||
\H{insFCLEX} \i\c{FCLEX}, \{FNCLEX}: Clear Floating-Point Exceptions
|
\H{insFCLEX} \i\c{FCLEX}, \c{FNCLEX}: Clear Floating-Point Exceptions
|
||||||
|
|
||||||
\c FCLEX ; 9B DB E2 [8086,FPU]
|
\c FCLEX ; 9B DB E2 [8086,FPU]
|
||||||
\c FNCLEX ; DB E2 [8086,FPU]
|
\c FNCLEX ; DB E2 [8086,FPU]
|
||||||
|
@ -7964,7 +8105,7 @@ operation on the 64-bit MMX registers.
|
||||||
\c OUT DX,AX ; o16 EF [8086]
|
\c OUT DX,AX ; o16 EF [8086]
|
||||||
\c OUT DX,EAX ; o32 EF [386]
|
\c OUT DX,EAX ; o32 EF [386]
|
||||||
|
|
||||||
\c{IN} writes the contents of the given source register to the
|
\c{OUT} writes the contents of the given source register to the
|
||||||
specified I/O port. The port number may be specified as an immediate
|
specified I/O port. The port number may be specified as an immediate
|
||||||
value if it is between 0 and 255, and otherwise must be stored in
|
value if it is between 0 and 255, and otherwise must be stored in
|
||||||
\c{DX}. See also \c{IN} (\k{insIN}).
|
\c{DX}. See also \c{IN} (\k{insIN}).
|
||||||
|
|
794
insns.dat
794
insns.dat
|
@ -6,7 +6,7 @@
|
||||||
; redistributable under the licence given in the file "Licence"
|
; redistributable under the licence given in the file "Licence"
|
||||||
; distributed in the NASM archive.
|
; distributed in the NASM archive.
|
||||||
;
|
;
|
||||||
; Format of file: all four fields must be present on every functional
|
; Format of file: All four fields must be present on every functional
|
||||||
; line. Hence `void' for no-operand instructions, and `\0' for such
|
; line. Hence `void' for no-operand instructions, and `\0' for such
|
||||||
; as EQU. If the last three fields are all `ignore', no action is
|
; as EQU. If the last three fields are all `ignore', no action is
|
||||||
; taken except to register the opcode as being present.
|
; taken except to register the opcode as being present.
|
||||||
|
@ -37,14 +37,14 @@ ADC rm16,imm8 \320\300\1\x83\202\15 8086
|
||||||
ADC rm32,imm8 \321\300\1\x83\202\15 386
|
ADC rm32,imm8 \321\300\1\x83\202\15 386
|
||||||
ADC reg_al,imm \1\x14\21 8086,SM
|
ADC reg_al,imm \1\x14\21 8086,SM
|
||||||
ADC reg_ax,imm \320\1\x15\31 8086,SM
|
ADC reg_ax,imm \320\1\x15\31 8086,SM
|
||||||
ADC reg_eax,sbyte \321\1\x83\202\15 386,ND
|
ADC reg_eax,sbyte \321\1\x83\202\15 386,ND
|
||||||
ADC reg_eax,imm \321\1\x15\41 386,SM
|
ADC reg_eax,imm \321\1\x15\41 386,SM
|
||||||
ADC rm8,imm \300\1\x80\202\21 8086,SM
|
ADC rm8,imm \300\1\x80\202\21 8086,SM
|
||||||
ADC rm16,imm \320\300\134\1\x81\202\131 8086,SM,ND
|
ADC rm16,imm \320\300\134\1\x81\202\131 8086,SM,ND
|
||||||
ADC rm32,imm \321\300\144\1\x81\202\141 386,SM,ND
|
ADC rm32,imm \321\300\144\1\x81\202\141 386,SM,ND
|
||||||
ADC mem,imm8 \300\1\x80\202\21 8086,SM
|
ADC mem,imm8 \300\1\x80\202\21 8086,SM
|
||||||
ADC mem,imm16 \320\300\134\1\x81\202\131 8086,SM,ND
|
ADC mem,imm16 \320\300\134\1\x81\202\131 8086,SM,ND
|
||||||
ADC mem,imm32 \321\300\144\1\x81\202\141 386,SM,ND
|
ADC mem,imm32 \321\300\144\1\x81\202\141 386,SM,ND
|
||||||
ADD mem,reg8 \300\17\101 8086,SM
|
ADD mem,reg8 \300\17\101 8086,SM
|
||||||
ADD reg8,reg8 \300\17\101 8086
|
ADD reg8,reg8 \300\17\101 8086
|
||||||
ADD mem,reg16 \320\300\1\x01\101 8086,SM
|
ADD mem,reg16 \320\300\1\x01\101 8086,SM
|
||||||
|
@ -61,14 +61,14 @@ ADD rm16,imm8 \320\300\1\x83\200\15 8086
|
||||||
ADD rm32,imm8 \321\300\1\x83\200\15 386
|
ADD rm32,imm8 \321\300\1\x83\200\15 386
|
||||||
ADD reg_al,imm \1\x04\21 8086,SM
|
ADD reg_al,imm \1\x04\21 8086,SM
|
||||||
ADD reg_ax,imm \320\1\x05\31 8086,SM
|
ADD reg_ax,imm \320\1\x05\31 8086,SM
|
||||||
ADD reg_eax,sbyte \321\1\x83\200\15 386,ND
|
ADD reg_eax,sbyte \321\1\x83\200\15 386,ND
|
||||||
ADD reg_eax,imm \321\1\x05\41 386,SM
|
ADD reg_eax,imm \321\1\x05\41 386,SM
|
||||||
ADD rm8,imm \300\1\x80\200\21 8086,SM
|
ADD rm8,imm \300\1\x80\200\21 8086,SM
|
||||||
ADD rm16,imm \320\300\134\1\x81\200\131 8086,SM,ND
|
ADD rm16,imm \320\300\134\1\x81\200\131 8086,SM,ND
|
||||||
ADD rm32,imm \321\300\144\1\x81\200\141 386,SM,ND
|
ADD rm32,imm \321\300\144\1\x81\200\141 386,SM,ND
|
||||||
ADD mem,imm8 \300\1\x80\200\21 8086,SM
|
ADD mem,imm8 \300\1\x80\200\21 8086,SM
|
||||||
ADD mem,imm16 \320\300\134\1\x81\200\131 8086,SM,ND
|
ADD mem,imm16 \320\300\134\1\x81\200\131 8086,SM,ND
|
||||||
ADD mem,imm32 \321\300\144\1\x81\200\141 386,SM,ND
|
ADD mem,imm32 \321\300\144\1\x81\200\141 386,SM,ND
|
||||||
AND mem,reg8 \300\1\x20\101 8086,SM
|
AND mem,reg8 \300\1\x20\101 8086,SM
|
||||||
AND reg8,reg8 \300\1\x20\101 8086
|
AND reg8,reg8 \300\1\x20\101 8086
|
||||||
AND mem,reg16 \320\300\1\x21\101 8086,SM
|
AND mem,reg16 \320\300\1\x21\101 8086,SM
|
||||||
|
@ -85,14 +85,14 @@ AND rm16,imm8 \320\300\1\x83\204\15 8086
|
||||||
AND rm32,imm8 \321\300\1\x83\204\15 386
|
AND rm32,imm8 \321\300\1\x83\204\15 386
|
||||||
AND reg_al,imm \1\x24\21 8086,SM
|
AND reg_al,imm \1\x24\21 8086,SM
|
||||||
AND reg_ax,imm \320\1\x25\31 8086,SM
|
AND reg_ax,imm \320\1\x25\31 8086,SM
|
||||||
AND reg_eax,sbyte \321\1\x83\204\15 386,ND
|
AND reg_eax,sbyte \321\1\x83\204\15 386,ND
|
||||||
AND reg_eax,imm \321\1\x25\41 386,SM
|
AND reg_eax,imm \321\1\x25\41 386,SM
|
||||||
AND rm8,imm \300\1\x80\204\21 8086,SM
|
AND rm8,imm \300\1\x80\204\21 8086,SM
|
||||||
AND rm16,imm \320\300\134\1\x81\204\131 8086,SM,ND
|
AND rm16,imm \320\300\134\1\x81\204\131 8086,SM,ND
|
||||||
AND rm32,imm \321\300\144\1\x81\204\141 386,SM,ND
|
AND rm32,imm \321\300\144\1\x81\204\141 386,SM,ND
|
||||||
AND mem,imm8 \300\1\x80\204\21 8086,SM
|
AND mem,imm8 \300\1\x80\204\21 8086,SM
|
||||||
AND mem,imm16 \320\300\134\1\x81\204\131 8086,SM,ND
|
AND mem,imm16 \320\300\134\1\x81\204\131 8086,SM,ND
|
||||||
AND mem,imm32 \321\300\144\1\x81\204\141 386,SM,ND
|
AND mem,imm32 \321\300\144\1\x81\204\141 386,SM,ND
|
||||||
ARPL mem,reg16 \300\1\x63\101 286,PROT,SM
|
ARPL mem,reg16 \300\1\x63\101 286,PROT,SM
|
||||||
ARPL reg16,reg16 \300\1\x63\101 286,PROT
|
ARPL reg16,reg16 \300\1\x63\101 286,PROT
|
||||||
BOUND reg16,mem \320\301\1\x62\110 186
|
BOUND reg16,mem \320\301\1\x62\110 186
|
||||||
|
@ -178,14 +178,14 @@ CMP rm16,imm8 \320\300\1\x83\207\15 8086
|
||||||
CMP rm32,imm8 \321\300\1\x83\207\15 386
|
CMP rm32,imm8 \321\300\1\x83\207\15 386
|
||||||
CMP reg_al,imm \1\x3C\21 8086,SM
|
CMP reg_al,imm \1\x3C\21 8086,SM
|
||||||
CMP reg_ax,imm \320\1\x3D\31 8086,SM
|
CMP reg_ax,imm \320\1\x3D\31 8086,SM
|
||||||
CMP reg_eax,sbyte \321\1\x83\207\15 386,ND
|
CMP reg_eax,sbyte \321\1\x83\207\15 386,ND
|
||||||
CMP reg_eax,imm \321\1\x3D\41 386,SM
|
CMP reg_eax,imm \321\1\x3D\41 386,SM
|
||||||
CMP rm8,imm \300\1\x80\207\21 8086,SM
|
CMP rm8,imm \300\1\x80\207\21 8086,SM
|
||||||
CMP rm16,imm \320\300\134\1\x81\207\131 8086,SM,ND
|
CMP rm16,imm \320\300\134\1\x81\207\131 8086,SM,ND
|
||||||
CMP rm32,imm \321\300\144\1\x81\207\141 386,SM,ND
|
CMP rm32,imm \321\300\144\1\x81\207\141 386,SM,ND
|
||||||
CMP mem,imm8 \300\1\x80\207\21 8086,SM
|
CMP mem,imm8 \300\1\x80\207\21 8086,SM
|
||||||
CMP mem,imm16 \320\300\134\1\x81\207\131 8086,SM,ND
|
CMP mem,imm16 \320\300\134\1\x81\207\131 8086,SM,ND
|
||||||
CMP mem,imm32 \321\300\144\1\x81\207\141 386,SM,ND
|
CMP mem,imm32 \321\300\144\1\x81\207\141 386,SM,ND
|
||||||
CMPSB void \332\1\xA6 8086
|
CMPSB void \332\1\xA6 8086
|
||||||
CMPSD void \332\321\1\xA7 386
|
CMPSD void \332\321\1\xA7 386
|
||||||
CMPSW void \332\320\1\xA7 8086
|
CMPSW void \332\320\1\xA7 8086
|
||||||
|
@ -424,16 +424,16 @@ IMUL reg32,mem \321\301\2\x0F\xAF\110 386,SM
|
||||||
IMUL reg32,reg32 \321\2\x0F\xAF\110 386
|
IMUL reg32,reg32 \321\2\x0F\xAF\110 386
|
||||||
IMUL reg16,mem,imm8 \320\301\1\x6B\110\16 186,SM
|
IMUL reg16,mem,imm8 \320\301\1\x6B\110\16 186,SM
|
||||||
IMUL reg16,reg16,imm8 \320\301\1\x6B\110\16 186
|
IMUL reg16,reg16,imm8 \320\301\1\x6B\110\16 186
|
||||||
IMUL reg16,mem,imm \320\301\135\1\x69\110\132 186,SM
|
IMUL reg16,mem,imm \320\301\135\1\x69\110\132 186,SM
|
||||||
IMUL reg16,reg16,imm \320\135\1\x69\110\132 186,SM
|
IMUL reg16,reg16,imm \320\135\1\x69\110\132 186,SM
|
||||||
IMUL reg32,mem,imm8 \321\301\1\x6B\110\16 386,SM
|
IMUL reg32,mem,imm8 \321\301\1\x6B\110\16 386,SM
|
||||||
IMUL reg32,reg32,imm8 \321\1\x6B\110\16 386
|
IMUL reg32,reg32,imm8 \321\1\x6B\110\16 386
|
||||||
IMUL reg32,mem,imm \321\301\145\1\x69\110\142 386,SM
|
IMUL reg32,mem,imm \321\301\145\1\x69\110\142 386,SM
|
||||||
IMUL reg32,reg32,imm \321\145\1\x69\110\142 386,SM
|
IMUL reg32,reg32,imm \321\145\1\x69\110\142 386,SM
|
||||||
IMUL reg16,imm8 \320\1\x6B\100\15 186
|
IMUL reg16,imm8 \320\1\x6B\100\15 186
|
||||||
IMUL reg16,imm \320\134\1\x69\100\131 186,SM
|
IMUL reg16,imm \320\134\1\x69\100\131 186,SM
|
||||||
IMUL reg32,imm8 \321\1\x6B\100\15 386
|
IMUL reg32,imm8 \321\1\x6B\100\15 386
|
||||||
IMUL reg32,imm \321\144\1\x69\100\141 386,SM
|
IMUL reg32,imm \321\144\1\x69\100\141 386,SM
|
||||||
IN reg_al,imm \1\xE4\25 8086,SB
|
IN reg_al,imm \1\xE4\25 8086,SB
|
||||||
IN reg_ax,imm \320\1\xE5\25 8086,SB
|
IN reg_ax,imm \320\1\xE5\25 8086,SB
|
||||||
IN reg_eax,imm \321\1\xE5\25 386,SB
|
IN reg_eax,imm \321\1\xE5\25 386,SB
|
||||||
|
@ -463,7 +463,7 @@ IRETW void \320\1\xCF 8086
|
||||||
JCXZ imm \310\1\xE3\50 8086
|
JCXZ imm \310\1\xE3\50 8086
|
||||||
JECXZ imm \311\1\xE3\50 386
|
JECXZ imm \311\1\xE3\50 386
|
||||||
JMP imm|short \1\xEB\50 8086
|
JMP imm|short \1\xEB\50 8086
|
||||||
JMP imm \370\1\xEB\50 8086,ND
|
JMP imm \370\1\xEB\50 8086,ND
|
||||||
JMP imm \322\1\xE9\64 8086
|
JMP imm \322\1\xE9\64 8086
|
||||||
JMP imm|near \322\1\xE9\64 8086,ND
|
JMP imm|near \322\1\xE9\64 8086,ND
|
||||||
JMP imm|far \322\1\xEA\34\37 8086,ND
|
JMP imm|far \322\1\xEA\34\37 8086,ND
|
||||||
|
@ -542,21 +542,21 @@ LSS reg32,mem \321\301\2\x0F\xB2\110 386
|
||||||
LTR mem \300\1\x0F\17\203 286,PROT,PRIV
|
LTR mem \300\1\x0F\17\203 286,PROT,PRIV
|
||||||
LTR mem16 \300\1\x0F\17\203 286,PROT,PRIV
|
LTR mem16 \300\1\x0F\17\203 286,PROT,PRIV
|
||||||
LTR reg16 \300\1\x0F\17\203 286,PROT,PRIV
|
LTR reg16 \300\1\x0F\17\203 286,PROT,PRIV
|
||||||
MOV mem,reg_cs \320\300\1\x8C\201 8086,SM
|
MOV mem,reg_cs \300\1\x8C\201 8086,SM
|
||||||
MOV mem,reg_dess \320\300\1\x8C\101 8086,SM
|
MOV mem,reg_dess \300\1\x8C\101 8086,SM
|
||||||
MOV mem,reg_fsgs \320\300\1\x8C\101 386,SM
|
MOV mem,reg_fsgs \300\1\x8C\101 386,SM
|
||||||
MOV reg16,reg_cs \320\300\1\x8C\201 8086
|
MOV reg16,reg_cs \320\300\1\x8C\201 8086
|
||||||
MOV reg16,reg_dess \320\300\1\x8C\101 8086
|
MOV reg16,reg_dess \320\300\1\x8C\101 8086
|
||||||
MOV reg16,reg_fsgs \320\300\1\x8C\101 386
|
MOV reg16,reg_fsgs \320\300\1\x8C\101 386
|
||||||
MOV rm32,reg_cs \321\300\1\x8C\201 8086
|
MOV reg32,reg_cs \321\300\1\x8C\201 8086
|
||||||
MOV rm32,reg_dess \321\300\1\x8C\101 8086
|
MOV reg32,reg_dess \321\300\1\x8C\101 8086
|
||||||
MOV rm32,reg_fsgs \321\300\1\x8C\101 386
|
MOV reg32,reg_fsgs \321\300\1\x8C\101 386
|
||||||
MOV reg_dess,mem \320\301\1\x8E\110 8086,SM
|
MOV reg_dess,mem \301\1\x8E\110 8086,SM
|
||||||
MOV reg_fsgs,mem \320\301\1\x8E\110 386,SM
|
MOV reg_fsgs,mem \301\1\x8E\110 386,SM
|
||||||
MOV reg_dess,reg16 \320\301\1\x8E\110 8086
|
MOV reg_dess,reg16 \301\1\x8E\110 8086
|
||||||
MOV reg_fsgs,reg16 \320\301\1\x8E\110 386
|
MOV reg_fsgs,reg16 \301\1\x8E\110 386
|
||||||
MOV reg_dess,rm32 \321\301\1\x8E\110 8086
|
MOV reg_dess,reg32 \301\1\x8E\110 8086
|
||||||
MOV reg_fsgs,rm32 \321\301\1\x8E\110 386
|
MOV reg_fsgs,reg32 \301\1\x8E\110 386
|
||||||
MOV reg_al,mem_offs \301\1\xA0\35 8086,SM
|
MOV reg_al,mem_offs \301\1\xA0\35 8086,SM
|
||||||
MOV reg_ax,mem_offs \301\320\1\xA1\35 8086,SM
|
MOV reg_ax,mem_offs \301\320\1\xA1\35 8086,SM
|
||||||
MOV reg_eax,mem_offs \301\321\1\xA1\35 386,SM
|
MOV reg_eax,mem_offs \301\321\1\xA1\35 386,SM
|
||||||
|
@ -637,14 +637,14 @@ OR rm16,imm8 \320\300\1\x83\201\15 8086
|
||||||
OR rm32,imm8 \321\300\1\x83\201\15 386
|
OR rm32,imm8 \321\300\1\x83\201\15 386
|
||||||
OR reg_al,imm \1\x0C\21 8086,SM
|
OR reg_al,imm \1\x0C\21 8086,SM
|
||||||
OR reg_ax,imm \320\1\x0D\31 8086,SM
|
OR reg_ax,imm \320\1\x0D\31 8086,SM
|
||||||
OR reg_eax,sbyte \321\1\x83\201\15 386,ND
|
OR reg_eax,sbyte \321\1\x83\201\15 386,ND
|
||||||
OR reg_eax,imm \321\1\x0D\41 386,SM
|
OR reg_eax,imm \321\1\x0D\41 386,SM
|
||||||
OR rm8,imm \300\1\x80\201\21 8086,SM
|
OR rm8,imm \300\1\x80\201\21 8086,SM
|
||||||
OR rm16,imm \320\300\134\1\x81\201\131 8086,SM,ND
|
OR rm16,imm \320\300\134\1\x81\201\131 8086,SM,ND
|
||||||
OR rm32,imm \321\300\144\1\x81\201\141 386,SM,ND
|
OR rm32,imm \321\300\144\1\x81\201\141 386,SM,ND
|
||||||
OR mem,imm8 \300\1\x80\201\21 8086,SM
|
OR mem,imm8 \300\1\x80\201\21 8086,SM
|
||||||
OR mem,imm16 \320\300\134\1\x81\201\131 8086,SM,ND
|
OR mem,imm16 \320\300\134\1\x81\201\131 8086,SM,ND
|
||||||
OR mem,imm32 \321\300\144\1\x81\201\141 386,SM,ND
|
OR mem,imm32 \321\300\144\1\x81\201\141 386,SM,ND
|
||||||
OUT imm,reg_al \1\xE6\24 8086,SB
|
OUT imm,reg_al \1\xE6\24 8086,SB
|
||||||
OUT imm,reg_ax \320\1\xE7\24 8086,SB
|
OUT imm,reg_ax \320\1\xE7\24 8086,SB
|
||||||
OUT imm,reg_eax \321\1\xE7\24 386,SB
|
OUT imm,reg_eax \321\1\xE7\24 386,SB
|
||||||
|
@ -888,8 +888,8 @@ ROR rm16,imm \320\300\1\xC1\201\25 186,SB
|
||||||
ROR rm32,unity \321\300\1\xD1\201 386
|
ROR rm32,unity \321\300\1\xD1\201 386
|
||||||
ROR rm32,reg_cl \321\300\1\xD3\201 386
|
ROR rm32,reg_cl \321\300\1\xD3\201 386
|
||||||
ROR rm32,imm \321\300\1\xC1\201\25 386,SB
|
ROR rm32,imm \321\300\1\xC1\201\25 386,SB
|
||||||
RSDC reg_sreg,mem80 \301\2\x0F\x79\110 486,CYRIX,SMM
|
RSDC reg_sreg,mem80 \301\2\x0F\x79\110 486,CYRIX,SMM
|
||||||
RSLDT mem80 \300\2\x0F\x7B\200 486,CYRIX,SMM
|
RSLDT mem80 \300\2\x0F\x7B\200 486,CYRIX,SMM
|
||||||
RSM void \2\x0F\xAA PENT,SMM
|
RSM void \2\x0F\xAA PENT,SMM
|
||||||
RSTS mem80 \300\2\x0F\x7D\200 486,CYRIX,SMM
|
RSTS mem80 \300\2\x0F\x7D\200 486,CYRIX,SMM
|
||||||
SAHF void \1\x9E 8086
|
SAHF void \1\x9E 8086
|
||||||
|
@ -928,14 +928,14 @@ SBB rm16,imm8 \320\300\1\x83\203\15 8086
|
||||||
SBB rm32,imm8 \321\300\1\x83\203\15 8086
|
SBB rm32,imm8 \321\300\1\x83\203\15 8086
|
||||||
SBB reg_al,imm \1\x1C\21 8086,SM
|
SBB reg_al,imm \1\x1C\21 8086,SM
|
||||||
SBB reg_ax,imm \320\1\x1D\31 8086,SM
|
SBB reg_ax,imm \320\1\x1D\31 8086,SM
|
||||||
SBB reg_eax,sbyte \321\1\x83\203\15 386,ND
|
SBB reg_eax,sbyte \321\1\x83\203\15 386,ND
|
||||||
SBB reg_eax,imm \321\1\x1D\41 386,SM
|
SBB reg_eax,imm \321\1\x1D\41 386,SM
|
||||||
SBB rm8,imm \300\1\x80\203\21 8086,SM
|
SBB rm8,imm \300\1\x80\203\21 8086,SM
|
||||||
SBB rm16,imm \320\300\134\1\x81\203\131 8086,SM,ND
|
SBB rm16,imm \320\300\134\1\x81\203\131 8086,SM,ND
|
||||||
SBB rm32,imm \321\300\144\1\x81\203\141 386,SM,ND
|
SBB rm32,imm \321\300\144\1\x81\203\141 386,SM,ND
|
||||||
SBB mem,imm8 \300\1\x80\203\21 8086,SM
|
SBB mem,imm8 \300\1\x80\203\21 8086,SM
|
||||||
SBB mem,imm16 \320\300\134\1\x81\203\131 8086,SM,ND
|
SBB mem,imm16 \320\300\134\1\x81\203\131 8086,SM,ND
|
||||||
SBB mem,imm32 \321\300\144\1\x81\203\141 386,SM,ND
|
SBB mem,imm32 \321\300\144\1\x81\203\141 386,SM,ND
|
||||||
SCASB void \332\1\xAE 8086
|
SCASB void \332\1\xAE 8086
|
||||||
SCASD void \332\321\1\xAF 386
|
SCASD void \332\321\1\xAF 386
|
||||||
SCASW void \332\320\1\xAF 8086
|
SCASW void \332\320\1\xAF 8086
|
||||||
|
@ -1010,21 +1010,21 @@ SUB rm16,imm8 \320\300\1\x83\205\15 8086
|
||||||
SUB rm32,imm8 \321\300\1\x83\205\15 386
|
SUB rm32,imm8 \321\300\1\x83\205\15 386
|
||||||
SUB reg_al,imm \1\x2C\21 8086,SM
|
SUB reg_al,imm \1\x2C\21 8086,SM
|
||||||
SUB reg_ax,imm \320\1\x2D\31 8086,SM
|
SUB reg_ax,imm \320\1\x2D\31 8086,SM
|
||||||
SUB reg_eax,sbyte \321\1\x83\205\15 386,ND
|
SUB reg_eax,sbyte \321\1\x83\205\15 386,ND
|
||||||
SUB reg_eax,imm \321\1\x2D\41 386,SM
|
SUB reg_eax,imm \321\1\x2D\41 386,SM
|
||||||
SUB rm8,imm \300\1\x80\205\21 8086,SM
|
SUB rm8,imm \300\1\x80\205\21 8086,SM
|
||||||
SUB rm16,imm \320\300\134\1\x81\205\131 8086,SM,ND
|
SUB rm16,imm \320\300\134\1\x81\205\131 8086,SM,ND
|
||||||
SUB rm32,imm \321\300\144\1\x81\205\141 386,SM,ND
|
SUB rm32,imm \321\300\144\1\x81\205\141 386,SM,ND
|
||||||
SUB mem,imm8 \300\1\x80\205\21 8086,SM
|
SUB mem,imm8 \300\1\x80\205\21 8086,SM
|
||||||
SUB mem,imm16 \320\300\134\1\x81\205\131 8086,SM,ND
|
SUB mem,imm16 \320\300\134\1\x81\205\131 8086,SM,ND
|
||||||
SUB mem,imm32 \321\300\144\1\x81\205\141 386,SM,ND
|
SUB mem,imm32 \321\300\144\1\x81\205\141 386,SM,ND
|
||||||
SVDC mem80,reg_sreg \300\2\x0F\x78\101 486,CYRIX,SMM
|
SVDC mem80,reg_sreg \300\2\x0F\x78\101 486,CYRIX,SMM
|
||||||
SVLDT mem80 \300\2\x0F\x7A\200 486,CYRIX,SMM
|
SVLDT mem80 \300\2\x0F\x7A\200 486,CYRIX,SMM
|
||||||
SVTS mem80 \300\2\x0F\x7C\200 486,CYRIX,SMM
|
SVTS mem80 \300\2\x0F\x7C\200 486,CYRIX,SMM
|
||||||
SYSCALL void \2\x0F\x05 P6,AMD
|
SYSCALL void \2\x0F\x05 P6,AMD
|
||||||
SYSENTER void \2\x0F\x34 P6
|
SYSENTER void \2\x0F\x34 P6
|
||||||
SYSEXIT void \2\x0F\x36 P6,PRIV
|
SYSEXIT void \2\x0F\x36 P6,PRIV
|
||||||
SYSRET void \2\x0F\x07 P6,PRIV,AMD
|
SYSRET void \2\x0F\x07 P6,PRIV,AMD
|
||||||
TEST mem,reg8 \300\1\x84\101 8086,SM
|
TEST mem,reg8 \300\1\x84\101 8086,SM
|
||||||
TEST reg8,reg8 \300\1\x84\101 8086
|
TEST reg8,reg8 \300\1\x84\101 8086
|
||||||
TEST mem,reg16 \320\300\1\x85\101 8086,SM
|
TEST mem,reg16 \320\300\1\x85\101 8086,SM
|
||||||
|
@ -1112,14 +1112,14 @@ XOR rm16,imm8 \320\300\1\x83\206\15 8086
|
||||||
XOR rm32,imm8 \321\300\1\x83\206\15 386
|
XOR rm32,imm8 \321\300\1\x83\206\15 386
|
||||||
XOR reg_al,imm \1\x34\21 8086,SM
|
XOR reg_al,imm \1\x34\21 8086,SM
|
||||||
XOR reg_ax,imm \320\1\x35\31 8086,SM
|
XOR reg_ax,imm \320\1\x35\31 8086,SM
|
||||||
XOR reg_eax,sbyte \321\1\x83\206\15 386,ND
|
XOR reg_eax,sbyte \321\1\x83\206\15 386,ND
|
||||||
XOR reg_eax,imm \321\1\x35\41 386,SM
|
XOR reg_eax,imm \321\1\x35\41 386,SM
|
||||||
XOR rm8,imm \300\1\x80\206\21 8086,SM
|
XOR rm8,imm \300\1\x80\206\21 8086,SM
|
||||||
XOR rm16,imm \320\300\134\1\x81\206\131 8086,SM,ND
|
XOR rm16,imm \320\300\134\1\x81\206\131 8086,SM,ND
|
||||||
XOR rm32,imm \321\300\144\1\x81\206\141 386,SM,ND
|
XOR rm32,imm \321\300\144\1\x81\206\141 386,SM,ND
|
||||||
XOR mem,imm8 \300\1\x80\206\21 8086,SM
|
XOR mem,imm8 \300\1\x80\206\21 8086,SM
|
||||||
XOR mem,imm16 \320\300\134\1\x81\206\131 8086,SM,ND
|
XOR mem,imm16 \320\300\134\1\x81\206\131 8086,SM,ND
|
||||||
XOR mem,imm32 \321\300\144\1\x81\206\141 386,SM,ND
|
XOR mem,imm32 \321\300\144\1\x81\206\141 386,SM,ND
|
||||||
CMOVcc reg16,mem \320\301\1\x0F\330\x40\110 P6,SM
|
CMOVcc reg16,mem \320\301\1\x0F\330\x40\110 P6,SM
|
||||||
CMOVcc reg16,reg16 \320\301\1\x0F\330\x40\110 P6
|
CMOVcc reg16,reg16 \320\301\1\x0F\330\x40\110 P6
|
||||||
CMOVcc reg32,mem \321\301\1\x0F\330\x40\110 P6,SM
|
CMOVcc reg32,mem \321\301\1\x0F\330\x40\110 P6,SM
|
||||||
|
@ -1128,9 +1128,9 @@ Jcc imm|near \322\1\x0F\330\x80\64 386
|
||||||
Jcc imm16|near \320\1\x0F\330\x80\64 386
|
Jcc imm16|near \320\1\x0F\330\x80\64 386
|
||||||
Jcc imm32|near \321\1\x0F\330\x80\64 386
|
Jcc imm32|near \321\1\x0F\330\x80\64 386
|
||||||
Jcc imm|short \330\x70\50 8086,ND
|
Jcc imm|short \330\x70\50 8086,ND
|
||||||
Jcc imm \370\330\x70\50 8086,ND
|
Jcc imm \370\330\x70\50 8086,ND
|
||||||
Jcc imm \1\x0F\330\x80\64 386,ND
|
Jcc imm \1\x0F\330\x80\64 386,ND
|
||||||
Jcc imm \330\x71\373\1\xE9\64 8086,ND
|
Jcc imm \330\x71\373\1\xE9\64 8086,ND
|
||||||
Jcc imm \330\x70\50 8086
|
Jcc imm \330\x70\50 8086
|
||||||
SETcc mem \300\1\x0F\330\x90\200 386,SB
|
SETcc mem \300\1\x0F\330\x90\200 386,SB
|
||||||
SETcc reg8 \300\1\x0F\330\x90\200 386
|
SETcc reg8 \300\1\x0F\330\x90\200 386
|
||||||
|
@ -1177,11 +1177,11 @@ CMPUNORDPS xmmreg,xmmreg \331\2\x0F\xC2\110\1\x03 KATMAI,S
|
||||||
CMPUNORDSS xmmreg,mem \301\333\2\x0F\xC2\110\1\x03 KATMAI,SSE
|
CMPUNORDSS xmmreg,mem \301\333\2\x0F\xC2\110\1\x03 KATMAI,SSE
|
||||||
CMPUNORDSS xmmreg,xmmreg \333\2\x0F\xC2\110\1\x03 KATMAI,SSE
|
CMPUNORDSS xmmreg,xmmreg \333\2\x0F\xC2\110\1\x03 KATMAI,SSE
|
||||||
; CMPPS/CMPSS must come after the specific ops; that way the disassembler will find the
|
; CMPPS/CMPSS must come after the specific ops; that way the disassembler will find the
|
||||||
; specific ops first and only disassemble illegal ones as cmpps.
|
; specific ops first and only disassemble illegal ones as cmpps/cmpss.
|
||||||
CMPPS xmmreg,mem,imm \301\331\2\x0F\xC2\110\22 KATMAI,SSE,SB,AR2
|
CMPPS xmmreg,mem,imm \301\331\2\x0F\xC2\110\26 KATMAI,SSE,SB,AR2
|
||||||
CMPPS xmmreg,xmmreg,imm \331\2\x0F\xC2\110\22 KATMAI,SSE,SB,AR2
|
CMPPS xmmreg,xmmreg,imm \331\2\x0F\xC2\110\26 KATMAI,SSE,SB,AR2
|
||||||
CMPSS xmmreg,mem,imm \301\333\2\x0F\xC2\110\22 KATMAI,SSE,SB,AR2
|
CMPSS xmmreg,mem,imm \301\333\2\x0F\xC2\110\26 KATMAI,SSE,SB,AR2
|
||||||
CMPSS xmmreg,xmmreg,imm \333\2\x0F\xC2\110\22 KATMAI,SSE,SB,AR2
|
CMPSS xmmreg,xmmreg,imm \333\2\x0F\xC2\110\26 KATMAI,SSE,SB,AR2
|
||||||
COMISS xmmreg,mem \301\2\x0F\x2F\110 KATMAI,SSE
|
COMISS xmmreg,mem \301\2\x0F\x2F\110 KATMAI,SSE
|
||||||
COMISS xmmreg,xmmreg \2\x0F\x2F\110 KATMAI,SSE
|
COMISS xmmreg,xmmreg \2\x0F\x2F\110 KATMAI,SSE
|
||||||
CVTPI2PS xmmreg,mem \301\331\2\x0F\x2A\110 KATMAI,SSE,MMX
|
CVTPI2PS xmmreg,mem \301\331\2\x0F\x2A\110 KATMAI,SSE,MMX
|
||||||
|
@ -1222,7 +1222,7 @@ MOVLPS mem,xmmreg \300\2\x0F\x13\101 KATMAI,S
|
||||||
MOVLPS xmmreg,xmmreg \2\x0F\x12\101 KATMAI,SSE,ND
|
MOVLPS xmmreg,xmmreg \2\x0F\x12\101 KATMAI,SSE,ND
|
||||||
MOVHLPS xmmreg,xmmreg \2\x0F\x12\110 KATMAI,SSE
|
MOVHLPS xmmreg,xmmreg \2\x0F\x12\110 KATMAI,SSE
|
||||||
MOVMSKPS reg32,xmmreg \2\x0F\x50\110 KATMAI,SSE
|
MOVMSKPS reg32,xmmreg \2\x0F\x50\110 KATMAI,SSE
|
||||||
MOVNTPS mem,xmmreg \2\x0F\x2B\101 KATMAI,SSE
|
MOVNTPS mem,xmmreg \300\2\x0F\x2B\101 KATMAI,SSE
|
||||||
MOVSS xmmreg,mem \301\333\2\x0F\x10\110 KATMAI,SSE
|
MOVSS xmmreg,mem \301\333\2\x0F\x10\110 KATMAI,SSE
|
||||||
MOVSS mem,xmmreg \300\333\2\x0F\x11\101 KATMAI,SSE
|
MOVSS mem,xmmreg \300\333\2\x0F\x11\101 KATMAI,SSE
|
||||||
MOVSS xmmreg,xmmreg \333\2\x0F\x10\110 KATMAI,SSE
|
MOVSS xmmreg,xmmreg \333\2\x0F\x10\110 KATMAI,SSE
|
||||||
|
@ -1245,8 +1245,8 @@ RSQRTPS xmmreg,mem \301\331\2\x0F\x52\110 KATMAI,S
|
||||||
RSQRTPS xmmreg,xmmreg \331\2\x0F\x52\110 KATMAI,SSE
|
RSQRTPS xmmreg,xmmreg \331\2\x0F\x52\110 KATMAI,SSE
|
||||||
RSQRTSS xmmreg,mem \301\333\2\x0F\x52\110 KATMAI,SSE
|
RSQRTSS xmmreg,mem \301\333\2\x0F\x52\110 KATMAI,SSE
|
||||||
RSQRTSS xmmreg,xmmreg \333\2\x0F\x52\110 KATMAI,SSE
|
RSQRTSS xmmreg,xmmreg \333\2\x0F\x52\110 KATMAI,SSE
|
||||||
SHUFPS xmmreg,mem,imm \301\2\x0F\xC6\110\22 KATMAI,SSE,SB,AR2
|
SHUFPS xmmreg,mem,imm \301\2\x0F\xC6\110\26 KATMAI,SSE,SB,AR2
|
||||||
SHUFPS xmmreg,xmmreg,imm \2\x0F\xC6\110\22 KATMAI,SSE,SB,AR2
|
SHUFPS xmmreg,xmmreg,imm \2\x0F\xC6\110\26 KATMAI,SSE,SB,AR2
|
||||||
SQRTPS xmmreg,mem \301\331\2\x0F\x51\110 KATMAI,SSE
|
SQRTPS xmmreg,mem \301\331\2\x0F\x51\110 KATMAI,SSE
|
||||||
SQRTPS xmmreg,xmmreg \331\2\x0F\x51\110 KATMAI,SSE
|
SQRTPS xmmreg,xmmreg \331\2\x0F\x51\110 KATMAI,SSE
|
||||||
SQRTSS xmmreg,mem \301\333\2\x0F\x51\110 KATMAI,SSE
|
SQRTSS xmmreg,mem \301\333\2\x0F\x51\110 KATMAI,SSE
|
||||||
|
@ -1265,11 +1265,11 @@ UNPCKLPS xmmreg,xmmreg \2\x0F\x14\110 KATMAI,S
|
||||||
XORPS xmmreg,mem \301\2\x0F\x57\110 KATMAI,SSE
|
XORPS xmmreg,mem \301\2\x0F\x57\110 KATMAI,SSE
|
||||||
XORPS xmmreg,xmmreg \2\x0F\x57\110 KATMAI,SSE
|
XORPS xmmreg,xmmreg \2\x0F\x57\110 KATMAI,SSE
|
||||||
|
|
||||||
; Introduced in Dechutes but necessary for SSE support
|
; Introduced in Deschutes but necessary for SSE support
|
||||||
FXRSTOR mem \300\2\x0F\xAE\201 P6,SSE,FPU
|
FXRSTOR mem \300\2\x0F\xAE\201 P6,SSE,FPU
|
||||||
FXSAVE mem \300\2\x0F\xAE\200 P6,SSE,FPU
|
FXSAVE mem \300\2\x0F\xAE\200 P6,SSE,FPU
|
||||||
|
|
||||||
; These instructions aren't SSE-specific; they are generic memory operations
|
; These instructions are not SSE-specific; they are generic memory operations
|
||||||
; and work even if CR4.OSFXFR == 0
|
; and work even if CR4.OSFXFR == 0
|
||||||
PREFETCHNTA mem \300\2\x0F\x18\200 KATMAI
|
PREFETCHNTA mem \300\2\x0F\x18\200 KATMAI
|
||||||
PREFETCHT0 mem \300\2\x0F\x18\201 KATMAI
|
PREFETCHT0 mem \300\2\x0F\x18\201 KATMAI
|
||||||
|
@ -1278,307 +1278,351 @@ PREFETCHT2 mem \300\2\x0F\x18\203 KATMAI
|
||||||
SFENCE void \3\x0F\xAE\xF8 KATMAI
|
SFENCE void \3\x0F\xAE\xF8 KATMAI
|
||||||
|
|
||||||
; New MMX instructions introduced in Katmai
|
; New MMX instructions introduced in Katmai
|
||||||
MASKMOVQ mmxreg,mmxreg \2\x0F\xF7\110 KATMAI,MMX
|
MASKMOVQ mmxreg,mmxreg \2\x0F\xF7\110 KATMAI,MMX
|
||||||
MOVNTQ mem,mmxreg \2\x0F\xE7\101 KATMAI,MMX,SM
|
MOVNTQ mem,mmxreg \300\2\x0F\xE7\101 KATMAI,MMX,SM
|
||||||
PAVGB mmxreg,mmxreg \2\x0F\xE0\110 KATMAI,MMX
|
PAVGB mmxreg,mmxreg \2\x0F\xE0\110 KATMAI,MMX
|
||||||
PAVGB mmxreg,mem \301\2\x0F\xE0\110 KATMAI,MMX,SM
|
PAVGB mmxreg,mem \301\2\x0F\xE0\110 KATMAI,MMX,SM
|
||||||
PAVGW mmxreg,mmxreg \2\x0F\xE3\110 KATMAI,MMX
|
PAVGW mmxreg,mmxreg \2\x0F\xE3\110 KATMAI,MMX
|
||||||
PAVGW mmxreg,mem \301\2\x0F\xE3\110 KATMAI,MMX,SM
|
PAVGW mmxreg,mem \301\2\x0F\xE3\110 KATMAI,MMX,SM
|
||||||
PEXTRW reg32,mmxreg,imm \2\x0F\xC5\110\22 KATMAI,MMX,SB,AR2
|
PEXTRW reg32,mmxreg,imm \2\x0F\xC5\110\26 KATMAI,MMX,SB,AR2
|
||||||
; PINSRW is documented as using a reg32, but it's really using only 16 bit
|
; PINSRW is documented as using a reg32, but it's really using only 16 bit
|
||||||
; -- accept either, but be truthful in disassembly
|
; -- accept either, but be truthful in disassembly
|
||||||
PINSRW mmxreg,reg16,imm \2\x0F\xC4\110\22 KATMAI,MMX,SB,AR2
|
PINSRW mmxreg,reg16,imm \2\x0F\xC4\110\26 KATMAI,MMX,SB,AR2
|
||||||
PINSRW mmxreg,reg32,imm \2\x0F\xC4\110\22 KATMAI,MMX,SB,AR2,ND
|
PINSRW mmxreg,reg32,imm \2\x0F\xC4\110\26 KATMAI,MMX,SB,AR2,ND
|
||||||
PINSRW mmxreg,mem,imm \301\2\x0F\xC4\110\22 KATMAI,MMX,SB,AR2
|
PINSRW mmxreg,mem,imm \301\2\x0F\xC4\110\26 KATMAI,MMX,SB,AR2
|
||||||
PINSRW mmxreg,mem16,imm \301\2\x0F\xC4\110\22 KATMAI,MMX,SB,AR2,ND
|
PINSRW mmxreg,mem16,imm \301\2\x0F\xC4\110\26 KATMAI,MMX,SB,AR2,ND
|
||||||
PMAXSW mmxreg,mmxreg \2\x0F\xEE\110 KATMAI,MMX
|
PMAXSW mmxreg,mmxreg \2\x0F\xEE\110 KATMAI,MMX
|
||||||
PMAXSW mmxreg,mem \301\2\x0F\xEE\110 KATMAI,MMX,SM
|
PMAXSW mmxreg,mem \301\2\x0F\xEE\110 KATMAI,MMX,SM
|
||||||
PMAXUB mmxreg,mmxreg \2\x0F\xDE\110 KATMAI,MMX
|
PMAXUB mmxreg,mmxreg \2\x0F\xDE\110 KATMAI,MMX
|
||||||
PMAXUB mmxreg,mem \301\2\x0F\xDE\110 KATMAI,MMX,SM
|
PMAXUB mmxreg,mem \301\2\x0F\xDE\110 KATMAI,MMX,SM
|
||||||
PMINSW mmxreg,mmxreg \2\x0F\xEA\110 KATMAI,MMX
|
PMINSW mmxreg,mmxreg \2\x0F\xEA\110 KATMAI,MMX
|
||||||
PMINSW mmxreg,mem \301\2\x0F\xEA\110 KATMAI,MMX,SM
|
PMINSW mmxreg,mem \301\2\x0F\xEA\110 KATMAI,MMX,SM
|
||||||
PMINUB mmxreg,mmxreg \2\x0F\xDA\110 KATMAI,MMX
|
PMINUB mmxreg,mmxreg \2\x0F\xDA\110 KATMAI,MMX
|
||||||
PMINUB mmxreg,mem \301\2\x0F\xDA\110 KATMAI,MMX,SM
|
PMINUB mmxreg,mem \301\2\x0F\xDA\110 KATMAI,MMX,SM
|
||||||
PMOVMSKB reg32,mmxreg \2\x0F\xD7\110 KATMAI,MMX
|
PMOVMSKB reg32,mmxreg \2\x0F\xD7\110 KATMAI,MMX
|
||||||
PMULHUW mmxreg,mmxreg \2\x0F\xE4\110 KATMAI,MMX
|
PMULHUW mmxreg,mmxreg \2\x0F\xE4\110 KATMAI,MMX
|
||||||
PMULHUW mmxreg,mem \301\2\x0F\xE4\110 KATMAI,MMX,SM
|
PMULHUW mmxreg,mem \301\2\x0F\xE4\110 KATMAI,MMX,SM
|
||||||
PSADBW mmxreg,mmxreg \2\x0F\xF6\110 KATMAI,MMX
|
PSADBW mmxreg,mmxreg \2\x0F\xF6\110 KATMAI,MMX
|
||||||
PSADBW mmxreg,mem \301\2\x0F\xF6\110 KATMAI,MMX,SM
|
PSADBW mmxreg,mem \301\2\x0F\xF6\110 KATMAI,MMX,SM
|
||||||
PSHUFW mmxreg,mmxreg,imm \2\x0F\x70\110\22 KATMAI,MMX,SB,AR2
|
PSHUFW mmxreg,mmxreg,imm \2\x0F\x70\110\22 KATMAI,MMX,SB,AR2
|
||||||
PSHUFW mmxreg,mem,imm \301\2\x0F\x70\110\22 KATMAI,MMX,SM2,SB,AR2
|
PSHUFW mmxreg,mem,imm \301\2\x0F\x70\110\22 KATMAI,MMX,SM2,SB,AR2
|
||||||
|
|
||||||
; The five new Athlon instructions
|
; AMD Enhanced 3DNow! (Athlon) instructions
|
||||||
PF2IW mmxreg,mem \301\2\x0F\x0F\110\01\x1C PENT,3DNOW,SM
|
PF2IW mmxreg,mem \301\2\x0F\x0F\110\01\x1C PENT,3DNOW,SM
|
||||||
PF2IW mmxreg,mmxreg \2\x0F\x0F\110\01\x1C PENT,3DNOW
|
PF2IW mmxreg,mmxreg \2\x0F\x0F\110\01\x1C PENT,3DNOW
|
||||||
PFNACC mmxreg,mem \301\2\x0F\x0F\110\01\x8A PENT,3DNOW,SM
|
PFNACC mmxreg,mem \301\2\x0F\x0F\110\01\x8A PENT,3DNOW,SM
|
||||||
PFNACC mmxreg,mmxreg \2\x0F\x0F\110\01\x8A PENT,3DNOW
|
PFNACC mmxreg,mmxreg \2\x0F\x0F\110\01\x8A PENT,3DNOW
|
||||||
PFPNACC mmxreg,mem \301\2\x0F\x0F\110\01\x8E PENT,3DNOW,SM
|
PFPNACC mmxreg,mem \301\2\x0F\x0F\110\01\x8E PENT,3DNOW,SM
|
||||||
PFPNACC mmxreg,mmxreg \2\x0F\x0F\110\01\x8E PENT,3DNOW
|
PFPNACC mmxreg,mmxreg \2\x0F\x0F\110\01\x8E PENT,3DNOW
|
||||||
PI2FW mmxreg,mem \301\2\x0F\x0F\110\01\x0C PENT,3DNOW,SM
|
PI2FW mmxreg,mem \301\2\x0F\x0F\110\01\x0C PENT,3DNOW,SM
|
||||||
PI2FW mmxreg,mmxreg \2\x0F\x0F\110\01\x0C PENT,3DNOW
|
PI2FW mmxreg,mmxreg \2\x0F\x0F\110\01\x0C PENT,3DNOW
|
||||||
PSWAPD mmxreg,mem \301\2\x0F\x0F\110\01\xBB PENT,3DNOW,SM
|
PSWAPD mmxreg,mem \301\2\x0F\x0F\110\01\xBB PENT,3DNOW,SM
|
||||||
PSWAPD mmxreg,mmxreg \2\x0F\x0F\110\01\xBB PENT,3DNOW
|
PSWAPD mmxreg,mmxreg \2\x0F\x0F\110\01\xBB PENT,3DNOW
|
||||||
|
|
||||||
; Introduced in Willamette
|
; Willamette SSE2 Cacheability Instructions
|
||||||
; opcode parameters assembly range
|
MASKMOVDQU xmmreg,xmmreg \3\x66\x0F\xF7\110 WILLAMETTE,SSE2
|
||||||
MASKMOVDQU xmmreg,xmmreg \3\x66\x0F\xF7 WILLAMETTE
|
; CLFLUSH needs its own feature flag implemented one day
|
||||||
CLFLUSH mem \2\x0F\xAE WILLAMETTE
|
CLFLUSH mem \300\2\x0F\xAE\207 WILLAMETTE,SSE2
|
||||||
MOVNTDQ xmmreg,mem \3\x66\x0F\xEF WILLAMETTE
|
MOVNTDQ mem,xmmreg \300\3\x66\x0F\xE7\101 WILLAMETTE,SSE2,SM
|
||||||
MOVNTI reg32,mem \2\x0F\xC3 WILLAMETTE
|
MOVNTI mem,reg32 \300\2\x0F\xC3\101 WILLAMETTE,SSE2,SM
|
||||||
PAUSE void \2\xF3\x90 WILLAMETTE
|
MOVNTPD mem,xmmreg \300\3\x66\x0F\x2B\101 WILLAMETTE,SSE2,SM
|
||||||
LFENCE void \3\x0F\xAE\xF8 WILLAMETTE
|
PAUSE void \333\1\x90 WILLAMETTE,SSE2
|
||||||
MFENCE void \3\x0F\xAE\xF8 WILLAMETTE
|
LFENCE void \3\x0F\xAE\xE8 WILLAMETTE,SSE2
|
||||||
|
MFENCE void \3\x0F\xAE\xF0 WILLAMETTE,SSE2
|
||||||
|
|
||||||
|
; Willamette MMX instructions (SSE2 SIMD Integer Instructions)
|
||||||
|
MOVD xmmreg,reg32 \3\x66\x0F\x6E\110 WILLAMETTE,SSE2
|
||||||
|
MOVD reg32,xmmreg \3\x66\x0F\x7E\101 WILLAMETTE,SSE2
|
||||||
|
MOVD mem,xmmreg \300\3\x66\x0F\x7E\101 WILLAMETTE,SSE2
|
||||||
|
MOVD xmmreg,mem \301\3\x66\x0F\x6E\110 WILLAMETTE,SSE2
|
||||||
|
MOVDQA xmmreg,xmmreg \3\x66\x0F\x6F\110 WILLAMETTE,SSE2
|
||||||
|
MOVDQA mem,xmmreg \300\3\x66\x0F\x7F\101 WILLAMETTE,SSE2,SM
|
||||||
|
MOVDQA xmmreg,mem \301\3\x66\x0F\x6F\110 WILLAMETTE,SSE2,SM
|
||||||
|
MOVDQA xmmreg,xmmreg \3\x66\x0F\x7F\110 WILLAMETTE,SSE2
|
||||||
|
MOVDQU xmmreg,xmmreg \333\2\x0F\x6F\110 WILLAMETTE,SSE2
|
||||||
|
MOVDQU mem,xmmreg \333\300\2\x0F\x7F\101 WILLAMETTE,SSE2,SM
|
||||||
|
MOVDQU xmmreg,mem \301\333\2\x0F\x6F\110 WILLAMETTE,SSE2,SM
|
||||||
|
MOVDQU xmmreg,xmmreg \333\2\x0F\x7F\110 WILLAMETTE,SSE2
|
||||||
|
MOVDQ2Q mmxreg,xmmreg \3\xF2\x0F\xD6\110 WILLAMETTE,SSE2
|
||||||
|
MOVQ xmmreg,xmmreg \333\2\x0F\x7E\110 WILLAMETTE,SSE2
|
||||||
|
MOVQ xmmreg,xmmreg \3\x66\x0F\xD6\110 WILLAMETTE,SSE2
|
||||||
|
MOVQ mem,xmmreg \300\3\x66\x0F\xD6\101 WILLAMETTE,SSE2
|
||||||
|
MOVQ xmmreg,mem \301\333\2\x0F\x7E\110 WILLAMETTE,SSE2
|
||||||
|
MOVQ2DQ xmmreg,mmxreg \333\2\x0F\xD6\110 WILLAMETTE,SSE2
|
||||||
|
PACKSSWB xmmreg,xmmreg \3\x66\x0F\x63\110 WILLAMETTE,SSE2
|
||||||
|
PACKSSWB xmmreg,mem \301\3\x66\x0F\x63\110 WILLAMETTE,SSE2,SM
|
||||||
|
PACKSSDW xmmreg,xmmreg \3\x66\x0F\x6B\110 WILLAMETTE,SSE2
|
||||||
|
PACKSSDW xmmreg,mem \301\3\x66\x0F\x6B\110 WILLAMETTE,SSE2,SM
|
||||||
|
PACKUSWB xmmreg,xmmreg \3\x66\x0F\x67\110 WILLAMETTE,SSE2
|
||||||
|
PACKUSWB xmmreg,mem \301\3\x66\x0F\x67\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDB xmmreg,xmmreg \3\x66\x0F\xFC\110 WILLAMETTE,SSE2
|
||||||
|
PADDB xmmreg,mem \301\3\x66\x0F\xFC\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDW xmmreg,xmmreg \3\x66\x0F\xFD\110 WILLAMETTE,SSE2
|
||||||
|
PADDW xmmreg,mem \301\3\x66\x0F\xFD\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDD xmmreg,xmmreg \3\x66\x0F\xFE\110 WILLAMETTE,SSE2
|
||||||
|
PADDD xmmreg,mem \301\3\x66\x0F\xFE\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDQ mmxreg,mmxreg \2\x0F\xD4\110 WILLAMETTE,SSE2
|
||||||
|
PADDQ mmxreg,mem \301\2\x0F\xD4\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDQ xmmreg,xmmreg \3\x66\x0F\xD4\110 WILLAMETTE,SSE2
|
||||||
|
PADDQ xmmreg,mem \301\3\x66\x0F\xD4\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDSB xmmreg,mem \301\3\x66\x0F\xEC\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDSB xmmreg,xmmreg \3\x66\x0F\xEC\110 WILLAMETTE,SSE2
|
||||||
|
PADDSW xmmreg,mem \301\3\x66\x0F\xED\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDSW xmmreg,xmmreg \3\x66\x0F\xED\110 WILLAMETTE,SSE2
|
||||||
|
PADDUSB xmmreg,mem \301\3\x66\x0F\xDC\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDUSB xmmreg,xmmreg \3\x66\x0F\xDC\110 WILLAMETTE,SSE2
|
||||||
|
PADDUSW xmmreg,mem \301\3\x66\x0F\xDD\110 WILLAMETTE,SSE2,SM
|
||||||
|
PADDUSW xmmreg,xmmreg \3\x66\x0F\xDD\110 WILLAMETTE,SSE2
|
||||||
|
PAND xmmreg,xmmreg \3\x66\x0F\xDB\110 WILLAMETTE,SSE2
|
||||||
|
PAND xmmreg,mem \301\3\x66\x0F\xDB\110 WILLAMETTE,SSE2,SM
|
||||||
|
PANDN xmmreg,xmmreg \3\x66\x0F\xDF\110 WILLAMETTE,SSE2
|
||||||
|
PANDN xmmreg,mem \301\3\x66\x0F\xDF\110 WILLAMETTE,SSE2,SM
|
||||||
|
PAVGB xmmreg,xmmreg \3\x66\x0F\xE0\110 WILLAMETTE,SSE2
|
||||||
|
PAVGB xmmreg,mem \301\3\x66\x0F\xE0\110 WILLAMETTE,SSE2,SM
|
||||||
|
PAVGW xmmreg,xmmreg \3\x66\x0F\xE3\110 WILLAMETTE,SSE2
|
||||||
|
PAVGW xmmreg,mem \301\3\x66\x0F\xE3\110 WILLAMETTE,SSE2,SM
|
||||||
|
PCMPEQB xmmreg,xmmreg \3\x66\x0F\x74\110 WILLAMETTE,SSE2
|
||||||
|
PCMPEQB xmmreg,mem \301\3\x66\x0F\x74\110 WILLAMETTE,SSE2,SM
|
||||||
|
PCMPEQW xmmreg,xmmreg \3\x66\x0F\x75\110 WILLAMETTE,SSE2
|
||||||
|
PCMPEQW xmmreg,mem \301\3\x66\x0F\x75\110 WILLAMETTE,SSE2,SM
|
||||||
|
PCMPEQD xmmreg,xmmreg \3\x66\x0F\x76\110 WILLAMETTE,SSE2
|
||||||
|
PCMPEQD xmmreg,mem \301\3\x66\x0F\x76\110 WILLAMETTE,SSE2,SM
|
||||||
|
PCMPGTB xmmreg,xmmreg \3\x66\x0F\x64\110 WILLAMETTE,SSE2
|
||||||
|
PCMPGTB xmmreg,mem \301\3\x66\x0F\x64\110 WILLAMETTE,SSE2,SM
|
||||||
|
PCMPGTW xmmreg,xmmreg \3\x66\x0F\x65\110 WILLAMETTE,SSE2
|
||||||
|
PCMPGTW xmmreg,mem \301\3\x66\x0F\x65\110 WILLAMETTE,SSE2,SM
|
||||||
|
PCMPGTD xmmreg,xmmreg \3\x66\x0F\x66\110 WILLAMETTE,SSE2
|
||||||
|
PCMPGTD xmmreg,mem \301\3\x66\x0F\x66\110 WILLAMETTE,SSE2,SM
|
||||||
|
PEXTRW reg32,xmmreg,imm \3\x66\x0F\xC5\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
PINSRW xmmreg,reg16,imm \3\x66\x0F\xC4\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
PINSRW xmmreg,reg32,imm \3\x66\x0F\xC4\110\26 WILLAMETTE,SSE2,SB,AR2,ND
|
||||||
|
PINSRW xmmreg,mem,imm \301\3\x66\x0F\xC4\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
PINSRW xmmreg,mem16,imm \301\3\x66\x0F\xC4\110\26 WILLAMETTE,SSE2,SB,AR2,ND
|
||||||
|
PMADDWD xmmreg,mem \301\3\x66\x0F\xF5\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMADDWD xmmreg,xmmreg \3\x66\x0F\xF5\110 WILLAMETTE,SSE2
|
||||||
|
PMAXSW xmmreg,xmmreg \3\x66\x0F\xEE\110 WILLAMETTE,SSE2
|
||||||
|
PMAXSW xmmreg,mem \301\3\x66\x0F\xEE\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMAXUB xmmreg,xmmreg \3\x66\x0F\xDE\110 WILLAMETTE,SSE2
|
||||||
|
PMAXUB xmmreg,mem \301\3\x66\x0F\xDE\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMINSW xmmreg,xmmreg \3\x66\x0F\xEA\110 WILLAMETTE,SSE2
|
||||||
|
PMINSW xmmreg,mem \301\3\x66\x0F\xEA\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMINUB xmmreg,xmmreg \3\x66\x0F\xDA\110 WILLAMETTE,SSE2
|
||||||
|
PMINUB xmmreg,mem \301\3\x66\x0F\xDA\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMOVMSKB reg32,xmmreg \3\x66\x0F\xD7\110 WILLAMETTE,SSE2
|
||||||
|
PMULHUW xmmreg,xmmreg \3\x66\x0F\xE4\110 WILLAMETTE,SSE2
|
||||||
|
PMULHUW xmmreg,mem \301\3\x66\x0F\xE4\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMULHW xmmreg,mem \301\3\x66\x0F\xE5\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMULHW xmmreg,xmmreg \3\x66\x0F\xE5\110 WILLAMETTE,SSE2
|
||||||
|
PMULLW xmmreg,mem \301\3\x66\x0F\xD5\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMULLW xmmreg,xmmreg \3\x66\x0F\xD5\110 WILLAMETTE,SSE2
|
||||||
|
PMULUDQ mmxreg,mmxreg \2\x0F\xF4\110 WILLAMETTE,SSE2
|
||||||
|
PMULUDQ mmxreg,mem \301\2\x0F\xF4\110 WILLAMETTE,SSE2,SM
|
||||||
|
PMULUDQ xmmreg,xmmreg \3\x66\x0F\xF4\110 WILLAMETTE,SSE2
|
||||||
|
PMULUDQ xmmreg,mem \301\3\x66\x0F\xF4\110 WILLAMETTE,SSE2,SM
|
||||||
|
POR xmmreg,mem \301\3\x66\x0F\xEB\110 WILLAMETTE,SSE2,SM
|
||||||
|
POR xmmreg,xmmreg \3\x66\x0F\xEB\110 WILLAMETTE,SSE2
|
||||||
|
PSADBW xmmreg,xmmreg \3\x66\x0F\xF6\110 WILLAMETTE,SSE2
|
||||||
|
PSADBW xmmreg,mem \301\3\x66\x0F\xF6\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSHUFD xmmreg,xmmreg,imm \3\x66\x0F\x70\110\22 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
PSHUFD xmmreg,mem,imm \301\3\x66\x0F\x70\110\22 WILLAMETTE,SSE2,SM2,SB,AR2
|
||||||
|
PSHUFHW xmmreg,xmmreg,imm \333\2\x0F\x70\110\22 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
PSHUFHW xmmreg,mem,imm \301\333\2\x0F\x70\110\22 WILLAMETTE,SSE2,SM2,SB,AR2
|
||||||
|
PSHUFLW xmmreg,xmmreg,imm \3\xF2\x0F\x70\110\22 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
PSHUFLW xmmreg,mem,imm \301\3\xF2\x0F\x70\110\22 WILLAMETTE,SSE2,SM2,SB,AR2
|
||||||
|
PSLLDQ xmmreg,imm \3\x66\x0F\x73\207\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSLLW xmmreg,mem \301\3\x66\x0F\xF1\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSLLW xmmreg,xmmreg \3\x66\x0F\xF1\110 WILLAMETTE,SSE2
|
||||||
|
PSLLW xmmreg,imm \3\x66\x0F\x71\206\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSLLD xmmreg,mem \301\3\x66\x0F\xF2\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSLLD xmmreg,xmmreg \3\x66\x0F\xF2\110 WILLAMETTE,SSE2
|
||||||
|
PSLLD xmmreg,imm \3\x66\x0F\x72\206\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSLLQ xmmreg,mem \301\3\x66\x0F\xF3\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSLLQ xmmreg,xmmreg \3\x66\x0F\xF3\110 WILLAMETTE,SSE2
|
||||||
|
PSLLQ xmmreg,imm \3\x66\x0F\x73\206\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSRAW xmmreg,mem \301\3\x66\x0F\xE1\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSRAW xmmreg,xmmreg \3\x66\x0F\xE1\110 WILLAMETTE,SSE2
|
||||||
|
PSRAW xmmreg,imm \3\x66\x0F\x71\204\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSRAD xmmreg,mem \301\3\x66\x0F\xE2\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSRAD xmmreg,xmmreg \3\x66\x0F\xE2\110 WILLAMETTE,SSE2
|
||||||
|
PSRAD xmmreg,imm \3\x66\x0F\x72\204\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSRLDQ xmmreg,imm \3\x66\x0F\x73\203\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSRLW xmmreg,mem \301\3\x66\x0F\xD1\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSRLW xmmreg,xmmreg \3\x66\x0F\xD1\110 WILLAMETTE,SSE2
|
||||||
|
PSRLW xmmreg,imm \3\x66\x0F\x71\202\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSRLD xmmreg,mem \301\3\x66\x0F\xD2\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSRLD xmmreg,xmmreg \3\x66\x0F\xD2\110 WILLAMETTE,SSE2
|
||||||
|
PSRLD xmmreg,imm \3\x66\x0F\x72\202\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSRLQ xmmreg,mem \301\3\x66\x0F\xD3\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSRLQ xmmreg,xmmreg \3\x66\x0F\xD3\110 WILLAMETTE,SSE2
|
||||||
|
PSRLQ xmmreg,imm \3\x66\x0F\x73\202\25 WILLAMETTE,SSE2,SB,AR1
|
||||||
|
PSUBB xmmreg,mem \301\3\x66\x0F\xF8\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBB xmmreg,xmmreg \3\x66\x0F\xF8\110 WILLAMETTE,SSE2
|
||||||
|
PSUBW xmmreg,mem \301\3\x66\x0F\xF9\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBW xmmreg,xmmreg \3\x66\x0F\xF9\110 WILLAMETTE,SSE2
|
||||||
|
PSUBD xmmreg,mem \301\3\x66\x0F\xFA\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBD xmmreg,xmmreg \3\x66\x0F\xFA\110 WILLAMETTE,SSE2
|
||||||
|
PSUBQ mmxreg,mmxreg \2\x0F\xFB\110 WILLAMETTE,SSE2
|
||||||
|
PSUBQ mmxreg,mem \301\2\x0F\xFB\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBQ xmmreg,xmmreg \3\x66\x0F\xFB\110 WILLAMETTE,SSE2
|
||||||
|
PSUBQ xmmreg,mem \301\3\x66\x0F\xFB\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBSB xmmreg,mem \301\3\x66\x0F\xE8\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBSB xmmreg,xmmreg \3\x66\x0F\xE8\110 WILLAMETTE,SSE2
|
||||||
|
PSUBSW xmmreg,mem \301\3\x66\x0F\xE9\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBSW xmmreg,xmmreg \3\x66\x0F\xE9\110 WILLAMETTE,SSE2
|
||||||
|
PSUBUSB xmmreg,mem \301\3\x66\x0F\xD8\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBUSB xmmreg,xmmreg \3\x66\x0F\xD8\110 WILLAMETTE,SSE2
|
||||||
|
PSUBUSW xmmreg,mem \301\3\x66\x0F\xD9\110 WILLAMETTE,SSE2,SM
|
||||||
|
PSUBUSW xmmreg,xmmreg \3\x66\x0F\xD9\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKHBW xmmreg,mem \301\3\x66\x0F\x68\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKHBW xmmreg,xmmreg \3\x66\x0F\x68\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKHWD xmmreg,mem \301\3\x66\x0F\x69\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKHWD xmmreg,xmmreg \3\x66\x0F\x69\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKHDQ xmmreg,mem \301\3\x66\x0F\x6A\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKHDQ xmmreg,xmmreg \3\x66\x0F\x6A\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKHQDQ xmmreg,xmmreg \3\x66\x0F\x6D\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKHQDQ xmmreg,mem \301\3\x66\x0F\x6D\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKLBW xmmreg,mem \301\3\x66\x0F\x60\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKLBW xmmreg,xmmreg \3\x66\x0F\x60\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKLWD xmmreg,mem \301\3\x66\x0F\x61\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKLWD xmmreg,xmmreg \3\x66\x0F\x61\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKLDQ xmmreg,mem \301\3\x66\x0F\x62\110 WILLAMETTE,SSE2,SM
|
||||||
|
PUNPCKLDQ xmmreg,xmmreg \3\x66\x0F\x62\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKLQDQ xmmreg,xmmreg \3\x66\x0F\x6C\110 WILLAMETTE,SSE2
|
||||||
|
PUNPCKLQDQ xmmreg,mem \301\3\x66\x0F\x6C\110 WILLAMETTE,SSE2,SM
|
||||||
|
PXOR xmmreg,mem \301\3\x66\x0F\xEF\110 WILLAMETTE,SSE2,SM
|
||||||
|
PXOR xmmreg,xmmreg \3\x66\x0F\xEF\110 WILLAMETTE,SSE2
|
||||||
|
|
||||||
; Willamette MMX instructions (SSE2)
|
|
||||||
MOVD xmmreg,reg32 \3\x66\x0F\x6E WILLAMETTE
|
|
||||||
MOVD reg32,xmmreg \3\x66\x0F\x7E WILLAMETTE
|
|
||||||
MOVD mem,xmmreg \3\x66\x0F\x7E WILLAMETTE
|
|
||||||
MOVD xmmreg,mem \3\x66\x0F\x6E WILLAMETTE
|
|
||||||
MOVDQA xmmreg,reg32 \3\x66\x0F\x6F WILLAMETTE
|
|
||||||
MOVDQA mem,xmmreg \3\x66\x0F\x7F WILLAMETTE
|
|
||||||
MOVDQA xmmreg,mem \3\x66\x0F\x6F WILLAMETTE
|
|
||||||
MOVDQA reg32,xmmreg \3\x66\x0F\x7F WILLAMETTE
|
|
||||||
MOVDQU xmmreg,reg32 \3\xF3\x0F\x6F WILLAMETTE
|
|
||||||
MOVDQU mem,xmmreg \3\xF3\x0F\x7F WILLAMETTE
|
|
||||||
MOVDQU xmmreg,mem \3\xF3\x0F\x6F WILLAMETTE
|
|
||||||
MOVDQU reg32,xmmreg \3\xF3\x0F\x7F WILLAMETTE
|
|
||||||
MOVQ2DQ mmxreg,xmmreg \3\xF2\x0F\xD6 WILLAMETTE
|
|
||||||
PACKSSWB xmmreg,xmmreg \3\x66\x0F\x63 WILLAMETTE
|
|
||||||
PACKSSWB xmmreg,mem \3\x66\x0F\x63 WILLAMETTE
|
|
||||||
PACKSSDW xmmreg,xmmreg \3\x66\x0F\x6B WILLAMETTE
|
|
||||||
PACKSSDW xmmreg,mem \3\x66\x0F\x6B WILLAMETTE
|
|
||||||
PACKUSWB xmmreg,xmmreg \3\x66\x0F\x67 WILLAMETTE
|
|
||||||
PACKUSWB xmmreg,mem \3\x66\x0F\x67 WILLAMETTE
|
|
||||||
PADDQ xmmreg,mmxreg \3\x66\x0F\xD4 WILLAMETTE
|
|
||||||
PADDQ xmmreg,mem \3\x66\x0F\xD4 WILLAMETTE
|
|
||||||
PADDD xmmreg,xmmreg \3\x66\x0F\xFE WILLAMETTE
|
|
||||||
PADDD xmmreg,mem \3\x66\x0F\xFE WILLAMETTE
|
|
||||||
PADDSB xmmreg,mem \3\x66\x0F\xEC WILLAMETTE
|
|
||||||
PADDSB xmmreg,xmmreg \3\x66\x0F\xEC WILLAMETTE
|
|
||||||
PADDSW xmmreg,mem \3\x66\x0F\xED WILLAMETTE
|
|
||||||
PADDSW xmmreg,xmmreg \3\x66\x0F\xED WILLAMETTE
|
|
||||||
PADDUSB xmmreg,mem \3\x66\x0F\xDC WILLAMETTE
|
|
||||||
PADDUSB xmmreg,xmmreg \3\x66\x0F\xDC WILLAMETTE
|
|
||||||
PADDUSW xmmreg,mem \3\x66\x0F\xDD WILLAMETTE
|
|
||||||
PADDUSW xmmreg,xmmreg \3\x66\x0F\xDD WILLAMETTE
|
|
||||||
PAND xmmreg,xmmreg \3\x66\x0F\xDB WILLAMETTE
|
|
||||||
PAND xmmreg,mem \3\x66\x0F\xDB WILLAMETTE
|
|
||||||
PANDN xmmreg,xmmreg \3\x66\x0F\xDF WILLAMETTE
|
|
||||||
PANDN xmmreg,mem \3\x66\x0F\xDF WILLAMETTE
|
|
||||||
PAVGB xmmreg,xmmreg \3\x66\x0F\xE0 WILLAMETTE
|
|
||||||
PAVGB xmmreg,mem \3\x66\x0F\xE0 WILLAMETTE
|
|
||||||
PAVGW xmmreg,xmmreg \3\x66\x0F\xE3 WILLAMETTE
|
|
||||||
PAVGW xmmreg,mem \3\x66\x0F\xE3 WILLAMETTE
|
|
||||||
PCMPEQB xmmreg,xmmreg \3\x66\x0F\x74 WILLAMETTE
|
|
||||||
PCMPEQB xmmreg,mem \3\x66\x0F\x74 WILLAMETTE
|
|
||||||
PCMPEQW xmmreg,xmmreg \3\x66\x0F\x75 WILLAMETTE
|
|
||||||
PCMPEQW xmmreg,mem \3\x66\x0F\x75 WILLAMETTE
|
|
||||||
PCMPEQD xmmreg,xmmreg \3\x66\x0F\x76 WILLAMETTE
|
|
||||||
PCMPEQD xmmreg,mem \3\x66\x0F\x76 WILLAMETTE
|
|
||||||
PCMPGTB xmmreg,xmmreg \3\x66\x0F\x64 WILLAMETTE
|
|
||||||
PCMPGTB xmmreg,mem \3\x66\x0F\x64 WILLAMETTE
|
|
||||||
PCMPGTW xmmreg,xmmreg \3\x66\x0F\x65 WILLAMETTE
|
|
||||||
PCMPGTW xmmreg,mem \3\x66\x0F\x65 WILLAMETTE
|
|
||||||
PCMPGTD xmmreg,xmmreg \3\x66\x0F\x66 WILLAMETTE
|
|
||||||
PCMPGTD xmmreg,mem \3\x66\x0F\x66 WILLAMETTE
|
|
||||||
PEXTRW reg32,xmmreg,imm8 \3\x66\x0F\xC5\110\22 WILLAMETTE
|
|
||||||
PINSRW xmmreg,reg16,imm \3\x66\x0F\xC4\110\22 WILLAMETTE,MMX,SB,AR2
|
|
||||||
PINSRW xmmreg,reg32,imm \3\x66\x0F\xC4\110\22 WILLAMETTE,MMX,SB,AR2,ND
|
|
||||||
PINSRW xmmreg,mem,imm \301\3\x66\x0F\xC4\110\22 WILLAMETTE,MMX,SB,AR2
|
|
||||||
PINSRW xmmreg,mem16,imm \301\3\x66\x0F\xC4\110\22 WILLAMETTE,MMX,SB,AR2,ND
|
|
||||||
PMAXSW xmmreg,xmmreg \3\x66\x0F\xEE\110 WILLAMETTE,MMX
|
|
||||||
PMAXSW xmmreg,mem \301\3\x66\x0F\xEE\110 WILLAMETTE,MMX,SM
|
|
||||||
PMAXUB xmmreg,xmmreg \3\x66\x0F\xDE\110 WILLAMETTE,MMX
|
|
||||||
PMAXUB xmmreg,mem \301\3\x66\x0F\xDE\110 WILLAMETTE,MMX,SM
|
|
||||||
PMINSW xmmreg,xmmreg \3\x66\x0F\xEA\110 WILLAMETTE,MMX
|
|
||||||
PMINSW xmmreg,mem \301\3\x66\x0F\xEA\110 WILLAMETTE,MMX,SM
|
|
||||||
PMINUB xmmreg,xmmreg \3\x66\x0F\xDA\110 WILLAMETTE,MMX
|
|
||||||
PMINUB xmmreg,mem \301\3\x66\x0F\xDA\110 WILLAMETTE,MMX,SM
|
|
||||||
PMOVMSKB reg32,xmmreg \3\x66\x0F\xD7\110 WILLAMETTE,MMX
|
|
||||||
PMULHUW xmmreg,xmmreg \3\x66\x0F\xE4\110 WILLAMETTE,MMX
|
|
||||||
PMULHUW xmmreg,mem \301\3\x66\x0F\xE4\110 WILLAMETTE,MMX,SM
|
|
||||||
PSADBW xmmreg,xmmreg \3\x66\x0F\xF6\110 WILLAMETTE,MMX
|
|
||||||
PSADBW xmmreg,mem \301\3\x66\x0F\xF6\110 WILLAMETTE,MMX,SM
|
|
||||||
PSHUFD xmmreg,xmmreg,imm \3\x66\x0F\x70\110\22 WILLAMETTE,MMX,SB,AR2
|
|
||||||
PSHUFD xmmreg,mem,imm \301\3\x66\x0F\x70\110\22 WILLAMETTE,MMX,SM2,SB,AR2
|
|
||||||
PMADDWD xmmreg,mem \301\3\x66\x0F\xF5\110 WILLAMETTE,MMX,SM
|
|
||||||
PMADDWD xmmreg,xmmreg \3\x66\x0F\xF5\110 WILLAMETTE,MMX
|
|
||||||
PMULLW xmmreg,mem \301\3\x66\x0F\xD5\110 WILLAMETTE,MMX,SM
|
|
||||||
PMULLW xmmreg,xmmreg \3\x66\x0F\xD5\110 WILLAMETTE,MMX
|
|
||||||
PMULUDQ mmxreg,mmxreg \2\x0F\xF4 WILLAMETTE
|
|
||||||
PMULUDQ mmxreg,mem \2\x0F\xF4 WILLAMETTE
|
|
||||||
PMULUDQ xmmreg,xmmreg \3\x66\x0F\xF4 WILLAMETTE
|
|
||||||
PMULUDQ xmmreg,mem \3\x66\x0F\xF4 WILLAMETTE
|
|
||||||
POR xmmreg,mem \301\3\x66\x0F\xEB\110 WILLAMETTE,MMX,SM
|
|
||||||
POR xmmreg,xmmreg \3\x66\x0F\xEB\110 WILLAMETTE,MMX
|
|
||||||
PSHUFLW xmmreg,xmmreg,imm8 \3\xF2\x0F\x70 WILLAMETTE
|
|
||||||
PSHUFLW xmmreg,mem,imm8 \3\xF2\x0F\x70 WILLAMETTE
|
|
||||||
PSHUFHW xmmreg,xmmreg,imm8 \3\xF3\x0F\x70 WILLAMETTE
|
|
||||||
PSHUFHW xmmreg,mem,imm8 \3\xF3\x0F\x70 WILLAMETTE
|
|
||||||
PSLLDQ xmmreg,imm8 \3\x66\x0F\x73 WILLAMETTE
|
|
||||||
PSLLD xmmreg,mem \301\3\x66\x0F\xF2\110 WILLAMETTE,MMX,SM
|
|
||||||
PSLLD xmmreg,xmmreg \3\x66\x0F\xF2\110 WILLAMETTE,MMX
|
|
||||||
PSLLD xmmreg,imm \3\x66\x0F\x72\206\25 WILLAMETTE,MMX
|
|
||||||
PSLLQ xmmreg,mem \301\3\x66\x0F\xF3\110 WILLAMETTE,MMX,SM
|
|
||||||
PSLLQ xmmreg,xmmreg \3\x66\x0F\xF3\110 WILLAMETTE,MMX
|
|
||||||
PSLLQ xmmreg,imm \3\x66\x0F\x73\206\25 WILLAMETTE,MMX
|
|
||||||
PSLLW xmmreg,mem \301\3\x66\x0F\xF1\110 WILLAMETTE,MMX,SM
|
|
||||||
PSLLW xmmreg,xmmreg \3\x66\x0F\xF1\110 WILLAMETTE,MMX
|
|
||||||
PSLLW xmmreg,imm \3\x66\x0F\x71\206\25 WILLAMETTE,MMX
|
|
||||||
PSRAD xmmreg,mem \301\3\x66\x0F\xE2\110 WILLAMETTE,MMX,SM
|
|
||||||
PSRAD xmmreg,xmmreg \3\x66\x0F\xE2\110 WILLAMETTE,MMX
|
|
||||||
PSRAD xmmreg,imm \3\x66\x0F\x72\204\25 WILLAMETTE,MMX
|
|
||||||
PSRAW xmmreg,mem \301\3\x66\x0F\xE1\110 WILLAMETTE,MMX,SM
|
|
||||||
PSRAW xmmreg,xmmreg \3\x66\x0F\xE1\110 WILLAMETTE,MMX
|
|
||||||
PSRAW xmmreg,imm \3\x66\x0F\x71\204\25 WILLAMETTE,MMX
|
|
||||||
PSRLW xmmreg,imm \3\x66\x0F\x73\202\25 WILLAMETTE,MMX
|
|
||||||
PSRLD xmmreg,mem \301\3\x66\x0F\xD2\110 WILLAMETTE,MMX,SM
|
|
||||||
PSRLD xmmreg,xmmreg \3\x66\x0F\xD2\110 WILLAMETTE,MMX
|
|
||||||
PSRLD xmmreg,imm \3\x66\x0F\x72\202\25 WILLAMETTE,MMX
|
|
||||||
PSRLQ xmmreg,mem \301\3\x66\x0F\xD3\110 WILLAMETTE,MMX,SM
|
|
||||||
PSRLQ xmmreg,xmmreg \3\x66\x0F\xD3\110 WILLAMETTE,MMX
|
|
||||||
PSRLQ xmmreg,imm \3\x66\x0F\x73\202\25 WILLAMETTE,MMX
|
|
||||||
PSRLW xmmreg,mem \301\3\x66\x0F\xD1\110 WILLAMETTE,MMX,SM
|
|
||||||
PSRLW xmmreg,xmmreg \3\x66\x0F\xD1\110 WILLAMETTE,MMX
|
|
||||||
PSRLW xmmreg,imm \3\x66\x0F\x71\202\25 WILLAMETTE,MMX
|
|
||||||
PSUBQ mmxreg,mmxreg \2\x0F\xFB WILLAMETTE
|
|
||||||
PSUBQ mmxreg,mem \2\x0F\xFB WILLAMETTE
|
|
||||||
PSUBQ xmmreg,xmmreg \3\x66\x0F\xFB WILLAMETTE
|
|
||||||
PSUBQ xmmreg,mem \3\x66\x0F\xFB WILLAMETTE
|
|
||||||
PSUBB xmmreg,mem \301\3\x66\x0F\xF8\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBB xmmreg,xmmreg \3\x66\x0F\xF8\110 WILLAMETTE,MMX
|
|
||||||
PSUBD xmmreg,mem \301\3\x66\x0F\xFA\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBD xmmreg,xmmreg \3\x66\x0F\xFA\110 WILLAMETTE,MMX
|
|
||||||
PSUBSB xmmreg,mem \301\3\x66\x0F\xE8\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBSB xmmreg,xmmreg \3\x66\x0F\xE8\110 WILLAMETTE,MMX
|
|
||||||
PSUBSW xmmreg,mem \301\3\x66\x0F\xE9\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBSW xmmreg,xmmreg \3\x66\x0F\xE9\110 WILLAMETTE,MMX
|
|
||||||
PSUBUSB xmmreg,mem \301\3\x66\x0F\xD8\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBUSB xmmreg,xmmreg \3\x66\x0F\xD8\110 WILLAMETTE,MMX
|
|
||||||
PSUBUSW xmmreg,mem \301\3\x66\x0F\xD9\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBUSW xmmreg,xmmreg \3\x66\x0F\xD9\110 WILLAMETTE,MMX
|
|
||||||
PSUBW xmmreg,mem \301\3\x66\x0F\xF9\110 WILLAMETTE,MMX,SM
|
|
||||||
PSUBW xmmreg,xmmreg \3\x66\x0F\xF9\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKHBW xmmreg,mem \301\3\x66\x0F\x68\110 WILLAMETTE,MMX,SM
|
|
||||||
PUNPCKHBW xmmreg,xmmreg \3\x66\x0F\x68\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKHDQ xmmreg,mem \301\3\x66\x0F\x6A\110 WILLAMETTE,MMX,SM
|
|
||||||
PUNPCKHDQ xmmreg,xmmreg \3\x66\x0F\x6A\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKHWD xmmreg,mem \301\3\x66\x0F\x69\110 WILLAMETTE,MMX,SM
|
|
||||||
PUNPCKHWD xmmreg,xmmreg \3\x66\x0F\x69\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKLBW xmmreg,mem \301\3\x66\x0F\x60\110 WILLAMETTE,MMX,SM
|
|
||||||
PUNPCKLBW xmmreg,xmmreg \3\x66\x0F\x60\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKLDQ xmmreg,mem \301\3\x66\x0F\x62\110 WILLAMETTE,MMX,SM
|
|
||||||
PUNPCKLDQ xmmreg,xmmreg \3\x66\x0F\x62\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKLWD xmmreg,mem \301\3\x66\x0F\x61\110 WILLAMETTE,MMX,SM
|
|
||||||
PUNPCKLWD xmmreg,xmmreg \3\x66\x0F\x61\110 WILLAMETTE,MMX
|
|
||||||
PUNPCKLQDQ xmmreg,xmmreg \3\x66\x0F\x6C\110 WILLAMETTE
|
|
||||||
PUNPCKLQDQ xmmreg,mem \301\3\x66\x0F\x6C\110 WILLAMETTE
|
|
||||||
PUNPCKHQDQ xmmreg,xmmreg \3\x66\x0F\x6D\110 WILLAMETTE
|
|
||||||
PUNPCKHQDQ xmmreg,mem \301\3\x66\x0F\x6D\110 WILLAMETTE
|
|
||||||
PXOR xmmreg,mem \301\3\x66\x0F\xEF\110 WILLAMETTE,MMX,SM
|
|
||||||
PXOR xmmreg,xmmreg \3\x66\x0F\xEF\110 WILLAMETTE,MMX
|
|
||||||
; Willamette Streaming SIMD instructions (SSE2)
|
; Willamette Streaming SIMD instructions (SSE2)
|
||||||
; opcode parameters assembly range
|
ADDPD xmmreg,xmmreg \331\3\x66\x0F\x58\110 WILLAMETTE,SSE2
|
||||||
ADDPD xmmreg,xmmreg \3\x66\x0F\x58 WILLAMETTE,SSE2
|
ADDPD xmmreg,mem \301\331\3\x66\x0F\x58\110 WILLAMETTE,SSE2,SM
|
||||||
ADDPD mem,xmmreg \3\x66\x0F\x58 WILLAMETTE,SSE2
|
ADDSD xmmreg,xmmreg \331\3\xF2\x0F\x58\110 WILLAMETTE,SSE2
|
||||||
ADDSD xmmreg,xmmreg \3\xF2\x0F\x58 WILLAMETTE,SSE2
|
ADDSD xmmreg,mem \301\331\3\xF2\x0F\x58\110 WILLAMETTE,SSE2
|
||||||
ADDSD mem,xmmreg \3\xF2\x0F\x58 WILLAMETTE,SSE2
|
ANDNPD xmmreg,xmmreg \331\3\x66\x0F\x55\110 WILLAMETTE,SSE2
|
||||||
ANDNPD xmmreg,xmmreg \3\x66\x0F\x54 WILLAMETTE,SSE2
|
ANDNPD xmmreg,mem \301\331\3\x66\x0F\x55\110 WILLAMETTE,SSE2,SM
|
||||||
ANDNPD mem,xmmreg \3\x66\x0F\x54 WILLAMETTE,SSE2
|
ANDPD xmmreg,xmmreg \331\3\x66\x0F\x54\110 WILLAMETTE,SSE2
|
||||||
ANDDPD xmmreg,xmmreg \3\x66\x0F\x55 WILLAMETTE,SSE2
|
ANDPD xmmreg,mem \301\331\3\x66\x0F\x54\110 WILLAMETTE,SSE2,SM
|
||||||
ANDDPD mem,xmmreg \3\x66\x0F\x55 WILLAMETTE,SSE2
|
CMPEQPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x00 WILLAMETTE,SSE2,SM
|
||||||
CMPPD xmmreg,xmmreg,imm8 \3\x66\x0F\xC2 WILLAMETTE,SSE2
|
CMPEQPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x00 WILLAMETTE,SSE2
|
||||||
CMPPD mem,xmmreg,imm8 \3\x66\x0F\xC2 WILLAMETTE,SSE2
|
CMPEQSD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x00 WILLAMETTE,SSE2
|
||||||
CMPSD xmmreg,xmmreg,imm8 \1\xA7 WILLAMETTE,SSE2
|
CMPEQSD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x00 WILLAMETTE,SSE2
|
||||||
CMPSD mem,xmmreg,imm8 \1\xA7 WILLAMETTE,SSE2
|
CMPLEPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x02 WILLAMETTE,SSE2,SM
|
||||||
COMISD xmmreg,xmmreg \3\x66\x0F\x2F WILLAMETTE,SSE2
|
CMPLEPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x02 WILLAMETTE,SSE2
|
||||||
COMISD mem,xmmreg \3\x66\x0F\x2F WILLAMETTE,SSE2
|
CMPLESD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x02 WILLAMETTE,SSE2
|
||||||
CVTPI2PD mmxreg,xmmreg \3\x66\x0F\x2A WILLAMETTE,SSE2
|
CMPLESD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x02 WILLAMETTE,SSE2
|
||||||
CVTPI2PD mem,xmmreg \3\x66\x0F\x2A WILLAMETTE,SSE2
|
CMPLTPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x01 WILLAMETTE,SSE2,SM
|
||||||
CVTPD2PI xmmreg,mmxreg \3\x66\x0F\x2C WILLAMETTE,SSE2
|
CMPLTPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x01 WILLAMETTE,SSE2
|
||||||
CVTPD2PI mem,mmxreg \3\x66\x0F\x2C WILLAMETTE,SSE2
|
CMPLTSD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x01 WILLAMETTE,SSE2
|
||||||
CVTSI2SD reg32,xmmreg \3\xF2\x0F\x2A WILLAMETTE,SSE2
|
CMPLTSD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x01 WILLAMETTE,SSE2
|
||||||
CVTSI2SD mem,xmmreg \3\xF2\x0F\x2A WILLAMETTE,SSE2
|
CMPNEQPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x04 WILLAMETTE,SSE2,SM
|
||||||
CVTSD2SI xmmreg,reg32 \3\xF2\x0F\x2D WILLAMETTE,SSE2
|
CMPNEQPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x04 WILLAMETTE,SSE2
|
||||||
CVTSD2SI mem,reg32 \3\xF2\x0F\x2D WILLAMETTE,SSE2
|
CMPNEQSD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x04 WILLAMETTE,SSE2
|
||||||
CVTPD2PS xmmreg,xmmreg \2\x0F\x2A WILLAMETTE,SSE2
|
CMPNEQSD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x04 WILLAMETTE,SSE2
|
||||||
CVTPD2PS mem,xmmreg \2\x0F\x2A WILLAMETTE,SSE2
|
CMPNLEPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x06 WILLAMETTE,SSE2,SM
|
||||||
CVTPS2PD xmmreg,xmmreg \2\x0F\x5A WILLAMETTE,SSE2
|
CMPNLEPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x06 WILLAMETTE,SSE2
|
||||||
CVTPS2PD mem,xmmreg \2\x0F\x5A WILLAMETTE,SSE2
|
CMPNLESD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x06 WILLAMETTE,SSE2
|
||||||
CVTSD2SS xmmreg,xmmreg \3\xF2\x0F\x5A WILLAMETTE,SSE2
|
CMPNLESD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x06 WILLAMETTE,SSE2
|
||||||
CVTSD2SS mem,xmmreg \3\xF2\x0F\x5A WILLAMETTE,SSE2
|
CMPNLTPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x05 WILLAMETTE,SSE2,SM
|
||||||
CVTSS2SD xmmreg,xmmreg \3\xF3\x0F\x5A WILLAMETTE,SSE2
|
CMPNLTPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x05 WILLAMETTE,SSE2
|
||||||
CVTSS2SD mem,xmmreg \3\xF3\x0F\x5A WILLAMETTE,SSE2
|
CMPNLTSD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x05 WILLAMETTE,SSE2
|
||||||
CVTPD2DQ xmmreg,xmmreg \3\xF2\x0F\xE6 WILLAMETTE,SSE2
|
CMPNLTSD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x05 WILLAMETTE,SSE2
|
||||||
CVTPD2DQ mem,xmmreg \3\xF2\x0F\xE6 WILLAMETTE,SSE2
|
CMPORDPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x07 WILLAMETTE,SSE2,SM
|
||||||
CVTDQ2PD xmmreg,xmmreg \3\xF3\x0F\xE6 WILLAMETTE,SSE2
|
CMPORDPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x07 WILLAMETTE,SSE2
|
||||||
CVTDQ2PD mem,xmmreg \3\xF3\x0F\xE6 WILLAMETTE,SSE2
|
CMPORDSD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x07 WILLAMETTE,SSE2
|
||||||
CVTDQ2PS xmmreg,xmmreg \2\x0F\x5B WILLAMETTE,SSE2
|
CMPORDSD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x07 WILLAMETTE,SSE2
|
||||||
CVTDQ2PS mem,xmmreg \2\x0F\x5B WILLAMETTE,SSE2
|
CMPUNORDPD xmmreg,mem \301\331\3\x66\x0F\xC2\110\1\x03 WILLAMETTE,SSE2,SM
|
||||||
CVTPS2DQ xmmreg,xmmreg \3\x66\x0F\x5B WILLAMETTE,SSE2
|
CMPUNORDPD xmmreg,xmmreg \331\3\x66\x0F\xC2\110\1\x03 WILLAMETTE,SSE2
|
||||||
CVTPS2DQ mem,xmmreg \3\x66\x0F\x5B WILLAMETTE,SSE2
|
CMPUNORDSD xmmreg,mem \301\331\3\xF2\x0F\xC2\110\1\x03 WILLAMETTE,SSE2
|
||||||
CVTTPD2PI mmxreg,xmmreg \3\x66\x0F\x2C WILLAMETTE,SSE2
|
CMPUNORDSD xmmreg,xmmreg \331\3\xF2\x0F\xC2\110\1\x03 WILLAMETTE,SSE2
|
||||||
CVTTPD2PI mem,xmmreg \3\x66\x0F\x2C WILLAMETTE,SSE2
|
; CMPPD/CMPSD must come after the specific ops; that way the disassembler will find the
|
||||||
CVTTPD2DQ mmxreg,xmmreg \3\x66\x0F\xE6 WILLAMETTE,SSE2
|
; specific ops first and only disassemble illegal ones as cmppd/cmpsd.
|
||||||
CVTTPD2DQ mem,xmmreg \3\x66\x0F\xE6 WILLAMETTE,SSE2
|
CMPPD xmmreg,xmmreg,imm \331\3\x66\x0F\xC2\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
CVTTPS2DQ mmxreg,xmmreg \3\xF3\x0F\x5B WILLAMETTE,SSE2
|
CMPPD xmmreg,mem,imm \301\331\3\x66\x0F\xC2\110\26 WILLAMETTE,SSE2,SM2,SB,AR2
|
||||||
CVTTPS2DQ mem,xmmreg \3\xF3\x0F\x5B WILLAMETTE,SSE2
|
CMPSD xmmreg,xmmreg,imm \331\3\xF2\x0F\xC2\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
CVTTPS2PI mmxreg,xmmreg \3\x0F\x2C WILLAMETTE,SSE2
|
CMPSD xmmreg,mem,imm \301\331\3\xF2\x0F\xC2\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
CVTTPS2PI mem,xmmreg \3\x0F\x2C WILLAMETTE,SSE2
|
COMISD xmmreg,xmmreg \331\3\x66\x0F\x2F\110 WILLAMETTE,SSE2
|
||||||
CVTTSD2SI mmxreg,xmmreg \3\xF2\x0F\x2C WILLAMETTE,SSE2
|
COMISD xmmreg,mem \301\331\3\x66\x0F\x2F\110 WILLAMETTE,SSE2
|
||||||
CVTTSD2SI mem,xmmreg \3\xF2\x0F\x2C WILLAMETTE,SSE2
|
CVTDQ2PD xmmreg,xmmreg \333\2\x0F\xE6\110 WILLAMETTE,SSE2
|
||||||
CVTTSS2SI mmxreg,xmmreg \3\xF3\x0F\x2C WILLAMETTE,SSE2
|
CVTDQ2PD xmmreg,mem \301\333\2\x0F\xE6\110 WILLAMETTE,SSE2
|
||||||
CVTTSS2SI mem,xmmreg \3\xF3\x0F\x2C WILLAMETTE,SSE2
|
CVTDQ2PS xmmreg,xmmreg \2\x0F\x5B\110 WILLAMETTE,SSE2
|
||||||
DIVPD xmmreg,xmmreg \3\x66\x0F\x5E WILLAMETTE,SSE2
|
CVTDQ2PS xmmreg,mem \301\2\x0F\x5B\110 WILLAMETTE,SSE2,SM
|
||||||
DIVPD mem,xmmreg \3\x66\x0F\x5E WILLAMETTE,SSE2
|
CVTPD2DQ xmmreg,xmmreg \3\xF2\x0F\xE6\110 WILLAMETTE,SSE2
|
||||||
DIVSD xmmreg,xmmreg \3\xF2\x0F\x5E WILLAMETTE,SSE2
|
CVTPD2DQ xmmreg,mem \301\3\xF2\x0F\xE6\110 WILLAMETTE,SSE2,SM
|
||||||
DIVSD mem,xmmreg \3\xF2\x0F\x5E WILLAMETTE,SSE2
|
CVTPD2PI mmxreg,xmmreg \3\x66\x0F\x2D\110 WILLAMETTE,SSE2
|
||||||
MAXPD xmmreg,xmmreg \3\x66\x0F\x5F WILLAMETTE,SSE2
|
CVTPD2PI mmxreg,mem \301\3\x66\x0F\x2D\110 WILLAMETTE,SSE2
|
||||||
MAXPD mem,xmmreg \3\x66\x0F\x5F WILLAMETTE,SSE2
|
CVTPD2PS xmmreg,xmmreg \3\x66\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MAXSD xmmreg,xmmreg \3\xF2\x0F\x5F WILLAMETTE,SSE2
|
CVTPD2PS xmmreg,mem \301\3\x66\x0F\x5A\110 WILLAMETTE,SSE2,SM
|
||||||
MAXSD mem,xmmreg \3\xF2\x0F\x5F WILLAMETTE,SSE2
|
CVTPI2PD xmmreg,mmxreg \3\x66\x0F\x2A\110 WILLAMETTE,SSE2
|
||||||
MINPD xmmreg,xmmreg \3\x66\x0F\x5D WILLAMETTE,SSE2
|
CVTPI2PD xmmreg,mem \301\3\x66\x0F\x2A\110 WILLAMETTE,SSE2
|
||||||
MINPD mem,xmmreg \3\x66\x0F\x5D WILLAMETTE,SSE2
|
CVTPS2DQ xmmreg,xmmreg \3\x66\x0F\x5B\110 WILLAMETTE,SSE2
|
||||||
MINSD xmmreg,xmmreg \3\xF2\x0F\x5D WILLAMETTE,SSE2
|
CVTPS2DQ xmmreg,mem \301\3\x66\x0F\x5B\110 WILLAMETTE,SSE2,SM
|
||||||
MINSD mem,xmmreg \3\xF2\x0F\x5D WILLAMETTE,SSE2
|
CVTPS2PD xmmreg,xmmreg \2\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MOVAPD xmmreg,xmmreg \3\x66\x0F\x28 WILLAMETTE,SSE2
|
CVTPS2PD xmmreg,mem \301\2\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MOVAPD xmmreg,xmmreg \3\x66\x0F\x29 WILLAMETTE,SSE2
|
CVTSD2SI reg32,xmmreg \3\xF2\x0F\x2D\110 WILLAMETTE,SSE2
|
||||||
MOVAPD mem,xmmreg \3\x66\x0F\x29 WILLAMETTE,SSE2
|
CVTSD2SI reg32,mem \301\3\xF2\x0F\x2D\110 WILLAMETTE,SSE2
|
||||||
MOVAPD xmmreg,mem \3\x66\x0F\x28 WILLAMETTE,SSE2
|
CVTSD2SS xmmreg,xmmreg \3\xF2\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MOVHPD mem,xmmreg \3\x66\x0F\x17 WILLAMETTE,SSE2
|
CVTSD2SS xmmreg,mem \301\3\xF2\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MOVHPD xmmreg,xmmreg \3\x66\x0F\x16 WILLAMETTE,SSE2
|
CVTSI2SD xmmreg,reg32 \3\xF2\x0F\x2A\110 WILLAMETTE,SSE2
|
||||||
MOVLPD mem,xmmreg \3\x66\x0F\x13 WILLAMETTE,SSE2
|
CVTSI2SD xmmreg,mem \301\3\xF2\x0F\x2A\110 WILLAMETTE,SSE2
|
||||||
MOVLPD xmmreg,xmmreg \3\x66\x0F\x12 WILLAMETTE,SSE2
|
CVTSS2SD xmmreg,xmmreg \333\2\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MOVMSKPD xmmreg,reg32 \3\x66\x0F\x50 WILLAMETTE,SSE2
|
CVTSS2SD xmmreg,mem \301\333\2\x0F\x5A\110 WILLAMETTE,SSE2
|
||||||
MOVSD xmmreg,xmmreg \3\xF2\x0F\x10 WILLAMETTE,SSE2
|
CVTTPD2PI mmxreg,xmmreg \3\x66\x0F\x2C\110 WILLAMETTE,SSE2
|
||||||
MOVSD xmmreg,xmmreg \3\xF2\x0F\x11 WILLAMETTE,SSE2
|
CVTTPD2PI mmxreg,mem \301\3\x66\x0F\x2C\110 WILLAMETTE,SSE2
|
||||||
MOVSD mem,xmmreg \3\xF2\x0F\x11 WILLAMETTE,SSE2
|
CVTTPD2DQ xmmreg,xmmreg \3\x66\x0F\xE6\110 WILLAMETTE,SSE2
|
||||||
MOVSD xmmreg,mem \3\xF2\x0F\x10 WILLAMETTE,SSE2
|
CVTTPD2DQ xmmreg,mem \301\3\x66\x0F\xE6\110 WILLAMETTE,SSE2,SM
|
||||||
MOVUPD xmmreg,xmmreg \3\x66\x0F\x10 WILLAMETTE,SSE2
|
CVTTPS2DQ xmmreg,xmmreg \333\2\x0F\x5B\110 WILLAMETTE,SSE2
|
||||||
MOVUPD xmmreg,xmmreg \3\x66\x0F\x11 WILLAMETTE,SSE2
|
CVTTPS2DQ xmmreg,mem \301\333\2\x0F\x5B\110 WILLAMETTE,SSE2,SM
|
||||||
MOVUPD mem,xmmreg \3\x66\x0F\x11 WILLAMETTE,SSE2
|
CVTTSD2SI reg32,xmmreg \3\xF2\x0F\x2C\110 WILLAMETTE,SSE2
|
||||||
MOVUPD xmmreg,mem \3\x66\x0F\x10 WILLAMETTE,SSE2
|
CVTTSD2SI reg32,mem \301\3\xF2\x0F\x2C\110 WILLAMETTE,SSE2
|
||||||
MULPD xmmreg,xmmreg \3\x66\x0F\x59 WILLAMETTE,SSE2
|
DIVPD xmmreg,xmmreg \3\x66\x0F\x5E\110 WILLAMETTE,SSE2
|
||||||
MULPD mem,xmmreg \3\x66\x0F\x59 WILLAMETTE,SSE2
|
DIVPD xmmreg,mem \301\3\x66\x0F\x5E\110 WILLAMETTE,SSE2,SM
|
||||||
MULSD xmmreg,xmmreg \3\xF2\x0F\x59 WILLAMETTE,SSE2
|
DIVSD xmmreg,xmmreg \3\xF2\x0F\x5E\110 WILLAMETTE,SSE2
|
||||||
MULSD mem,xmmreg \3\xF2\x0F\x59 WILLAMETTE,SSE2
|
DIVSD xmmreg,mem \301\3\xF2\x0F\x5E\110 WILLAMETTE,SSE2
|
||||||
ORPD mem,xmmreg \3\x66\x0F\x56 WILLAMETTE,SSE2
|
MAXPD xmmreg,xmmreg \3\x66\x0F\x5F\110 WILLAMETTE,SSE2
|
||||||
ORPD xmmreg,xmmreg,imm8 \3\x66\x0F\x56 WILLAMETTE,SSE2
|
MAXPD xmmreg,mem \301\3\x66\x0F\x5F\110 WILLAMETTE,SSE2,SM
|
||||||
SHUFPD xmmreg,xmmreg,imm8 \3\x66\x0F\xC6 WILLAMETTE,SSE2
|
MAXSD xmmreg,xmmreg \3\xF2\x0F\x5F\110 WILLAMETTE,SSE2
|
||||||
SHUFPD mem,xmmreg \3\x66\x0F\xC6 WILLAMETTE,SSE2
|
MAXSD xmmreg,mem \301\3\xF2\x0F\x5F\110 WILLAMETTE,SSE2
|
||||||
SQRTPD xmmreg,xmmreg \3\x66\x0F\x51 WILLAMETTE,SSE2
|
MINPD xmmreg,xmmreg \3\x66\x0F\x5D\110 WILLAMETTE,SSE2
|
||||||
SQRTPD mem,xmmreg \3\x66\x0F\x51 WILLAMETTE,SSE2
|
MINPD xmmreg,mem \301\3\x66\x0F\x5D\110 WILLAMETTE,SSE2,SM
|
||||||
SQRTSD xmmreg,xmmreg \3\xF2\x0F\x51 WILLAMETTE,SSE2
|
MINSD xmmreg,xmmreg \3\xF2\x0F\x5D\110 WILLAMETTE,SSE2
|
||||||
SQRTSD mem,xmmreg \3\xF2\x0F\x51 WILLAMETTE,SSE2
|
MINSD xmmreg,mem \301\3\xF2\x0F\x5D\110 WILLAMETTE,SSE2
|
||||||
SUBPD xmmreg,xmmreg \3\x66\x0F\x5C WILLAMETTE,SSE2
|
MOVAPD xmmreg,xmmreg \3\x66\x0F\x28\110 WILLAMETTE,SSE2
|
||||||
SUBPD mem,xmmreg \3\x66\x0F\x5C WILLAMETTE,SSE2
|
MOVAPD xmmreg,xmmreg \3\x66\x0F\x29\110 WILLAMETTE,SSE2
|
||||||
SUBSD xmmreg,xmmreg \3\xF2\x0F\x5C WILLAMETTE,SSE2
|
MOVAPD mem,xmmreg \300\3\x66\x0F\x29\101 WILLAMETTE,SSE2,SM
|
||||||
SUBSD mem,xmmreg \3\xF2\x0F\x5C WILLAMETTE,SSE2
|
MOVAPD xmmreg,mem \301\3\x66\x0F\x28\110 WILLAMETTE,SSE2,SM
|
||||||
UCOMISD xmmreg,xmmreg \3\x66\x0F\x2E WILLAMETTE,SSE2
|
MOVHPD mem,xmmreg \300\3\x66\x0F\x17\101 WILLAMETTE,SSE2
|
||||||
UCOMISD mem,xmmreg \3\x66\x0F\x2E WILLAMETTE,SSE2
|
MOVHPD xmmreg,mem \301\3\x66\x0F\x16\110 WILLAMETTE,SSE2
|
||||||
UNPCKHPD xmmreg,xmmreg \3\x66\x0F\x15 WILLAMETTE,SSE2
|
MOVLPD mem,xmmreg \300\3\x66\x0F\x13\101 WILLAMETTE,SSE2
|
||||||
UNPCKHPD mem,xmmreg \3\x66\x0F\x15 WILLAMETTE,SSE2
|
MOVLPD xmmreg,mem \301\3\x66\x0F\x12\110 WILLAMETTE,SSE2
|
||||||
UNPCKLPD xmmreg,xmmreg \3\x66\x0F\x14 WILLAMETTE,SSE2
|
MOVMSKPD reg32,xmmreg \3\x66\x0F\x50\110 WILLAMETTE,SSE2
|
||||||
UNPCKLPD mem,xmmreg \3\x66\x0F\x14 WILLAMETTE,SSE2
|
MOVSD xmmreg,xmmreg \3\xF2\x0F\x10\110 WILLAMETTE,SSE2
|
||||||
XORPD xmmreg,xmmreg \3\x66\x0F\x57 WILLAMETTE,SSE2
|
MOVSD xmmreg,xmmreg \3\xF2\x0F\x11\110 WILLAMETTE,SSE2
|
||||||
XORPD mem,xmmreg \3\x66\x0F\x57 WILLAMETTE,SSE2
|
MOVSD mem,xmmreg \300\3\xF2\x0F\x11\101 WILLAMETTE,SSE2
|
||||||
|
MOVSD xmmreg,mem \301\3\xF2\x0F\x10\110 WILLAMETTE,SSE2
|
||||||
|
MOVUPD xmmreg,xmmreg \3\x66\x0F\x10\110 WILLAMETTE,SSE2
|
||||||
|
MOVUPD xmmreg,xmmreg \3\x66\x0F\x11\110 WILLAMETTE,SSE2
|
||||||
|
MOVUPD mem,xmmreg \300\3\x66\x0F\x11\101 WILLAMETTE,SSE2,SM
|
||||||
|
MOVUPD xmmreg,mem \301\3\x66\x0F\x10\110 WILLAMETTE,SSE2,SM
|
||||||
|
MULPD xmmreg,xmmreg \3\x66\x0F\x59\110 WILLAMETTE,SSE2
|
||||||
|
MULPD xmmreg,mem \301\3\x66\x0F\x59\110 WILLAMETTE,SSE2,SM
|
||||||
|
MULSD xmmreg,xmmreg \3\xF2\x0F\x59\110 WILLAMETTE,SSE2
|
||||||
|
MULSD xmmreg,mem \301\3\xF2\x0F\x59\110 WILLAMETTE,SSE2
|
||||||
|
ORPD xmmreg,mem \301\3\x66\x0F\x56\110 WILLAMETTE,SSE2,SM
|
||||||
|
ORPD xmmreg,xmmreg \3\x66\x0F\x56\110 WILLAMETTE,SSE2
|
||||||
|
SHUFPD xmmreg,xmmreg,imm \3\x66\x0F\xC6\110\26 WILLAMETTE,SSE2,SB,AR2
|
||||||
|
SHUFPD xmmreg,mem,imm \301\3\x66\x0F\xC6\110\26 WILLAMETTE,SSE2,SM,SB,AR2
|
||||||
|
SQRTPD xmmreg,xmmreg \3\x66\x0F\x51\110 WILLAMETTE,SSE2
|
||||||
|
SQRTPD xmmreg,mem \301\3\x66\x0F\x51\110 WILLAMETTE,SSE2,SM
|
||||||
|
SQRTSD xmmreg,xmmreg \3\xF2\x0F\x51\110 WILLAMETTE,SSE2
|
||||||
|
SQRTSD xmmreg,mem \301\3\xF2\x0F\x51\110 WILLAMETTE,SSE2
|
||||||
|
SUBPD xmmreg,xmmreg \3\x66\x0F\x5C\110 WILLAMETTE,SSE2
|
||||||
|
SUBPD xmmreg,mem \301\3\x66\x0F\x5C\110 WILLAMETTE,SSE2,SM
|
||||||
|
SUBSD xmmreg,xmmreg \3\xF2\x0F\x5C\110 WILLAMETTE,SSE2
|
||||||
|
SUBSD xmmreg,mem \301\3\xF2\x0F\x5C\110 WILLAMETTE,SSE2
|
||||||
|
UCOMISD xmmreg,xmmreg \3\x66\x0F\x2E\110 WILLAMETTE,SSE2
|
||||||
|
UCOMISD xmmreg,mem \301\3\x66\x0F\x2E\110 WILLAMETTE,SSE2
|
||||||
|
UNPCKHPD xmmreg,xmmreg \3\x66\x0F\x15\110 WILLAMETTE,SSE2
|
||||||
|
UNPCKHPD mem,xmmreg \300\3\x66\x0F\x15\101 WILLAMETTE,SSE2,SM
|
||||||
|
UNPCKLPD xmmreg,xmmreg \3\x66\x0F\x14\110 WILLAMETTE,SSE2
|
||||||
|
UNPCKLPD xmmreg,mem \301\3\x66\x0F\x14\110 WILLAMETTE,SSE2,SM
|
||||||
|
XORPD xmmreg,xmmreg \3\x66\x0F\x57\110 WILLAMETTE,SSE2
|
||||||
|
XORPD xmmreg,mem \301\3\x66\x0F\x57\110 WILLAMETTE,SSE2,SM
|
||||||
|
|
5
labels.c
5
labels.c
|
@ -20,7 +20,6 @@
|
||||||
* @@, so @@local is a TASM compatible local label. Note that we only
|
* @@, so @@local is a TASM compatible local label. Note that we only
|
||||||
* check for the first @ symbol, although TASM requires both.
|
* check for the first @ symbol, although TASM requires both.
|
||||||
*/
|
*/
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
#define islocal(l) \
|
#define islocal(l) \
|
||||||
(tasm_compatible_mode ? \
|
(tasm_compatible_mode ? \
|
||||||
(((l)[0] == '.' || (l)[0] == '@') && (l)[1] != '.') : \
|
(((l)[0] == '.' || (l)[0] == '@') && (l)[1] != '.') : \
|
||||||
|
@ -29,10 +28,6 @@
|
||||||
(tasm_compatible_mode ? \
|
(tasm_compatible_mode ? \
|
||||||
((c) == '.' || (c) == '@') : \
|
((c) == '.' || (c) == '@') : \
|
||||||
((c) == '.'))
|
((c) == '.'))
|
||||||
#else
|
|
||||||
#define islocal(l) ((l)[0] == '.' && (l)[1] != '.')
|
|
||||||
#define islocalchar(c) ((c) == '.')
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LABEL_BLOCK 32 /* no. of labels/block */
|
#define LABEL_BLOCK 32 /* no. of labels/block */
|
||||||
#define LBLK_SIZE (LABEL_BLOCK*sizeof(union label))
|
#define LBLK_SIZE (LABEL_BLOCK*sizeof(union label))
|
||||||
|
|
|
@ -122,7 +122,7 @@ static void list_out (long offset, char *str)
|
||||||
|
|
||||||
static void list_output (long offset, void *data, unsigned long type)
|
static void list_output (long offset, void *data, unsigned long type)
|
||||||
{
|
{
|
||||||
long typ, size;
|
unsigned long typ, size;
|
||||||
|
|
||||||
if (!listp || suppress || user_nolist) /* fbk - 9/2/00 */
|
if (!listp || suppress || user_nolist) /* fbk - 9/2/00 */
|
||||||
return;
|
return;
|
||||||
|
|
38
macros.pl
38
macros.pl
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl -w
|
||||||
#
|
#
|
||||||
# macros.pl produce macros.c from standard.mac
|
# macros.pl produce macros.c from standard.mac
|
||||||
#
|
#
|
||||||
|
@ -6,6 +6,11 @@
|
||||||
# Julian Hall. All rights reserved. The software is
|
# Julian Hall. All rights reserved. The software is
|
||||||
# redistributable under the licence given in the file "Licence"
|
# redistributable under the licence given in the file "Licence"
|
||||||
# distributed in the NASM archive.
|
# distributed in the NASM archive.
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my $fname;
|
||||||
|
my $line = 0;
|
||||||
|
my $index = 0;
|
||||||
|
|
||||||
$fname = "standard.mac" unless $fname = $ARGV[0];
|
$fname = "standard.mac" unless $fname = $ARGV[0];
|
||||||
open INPUT,$fname || die "unable to open $fname\n";
|
open INPUT,$fname || die "unable to open $fname\n";
|
||||||
|
@ -15,14 +20,25 @@ print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
|
||||||
" - don't edit it */\n\nstatic char *stdmac[] = {\n";
|
" - don't edit it */\n\nstatic char *stdmac[] = {\n";
|
||||||
|
|
||||||
while (<INPUT>) {
|
while (<INPUT>) {
|
||||||
chomp;
|
$line++;
|
||||||
# this regexp ought to match anything at all, so why bother with
|
chomp;
|
||||||
# a sensible error message ;-)
|
if (m/^\s*((\s*([^"';\s]+|"[^"]*"|'[^']*'))*)\s*(;.*)?$/) {
|
||||||
die "swirly thing alert" unless /^\s*((\s*([^"';\s]+|"[^"]*"|'[^']*'))*)/;
|
$_ = $1;
|
||||||
$_ = $1;
|
s/\\/\\\\/g;
|
||||||
s/\\/\\\\/g;
|
s/"/\\"/g;
|
||||||
s/"/\\"/g;
|
if (length > 0) {
|
||||||
print OUTPUT " \"$_\",\n" if length > 0;
|
print OUTPUT " \"$_\",\n";
|
||||||
|
if ($index >= 0) {
|
||||||
|
if (m/__NASM_MAJOR__/) {
|
||||||
|
$index = -$index;
|
||||||
|
} else {
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die "$fname:$line: error unterminated quote";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$index = -$index;
|
||||||
print OUTPUT " NULL\n};\n"
|
print OUTPUT " NULL\n};\n#define TASM_MACRO_COUNT $index\n"
|
||||||
|
|
1223
misc/scitech.mac
Normal file
1223
misc/scitech.mac
Normal file
File diff suppressed because it is too large
Load diff
160
nasm.c
160
nasm.c
|
@ -38,9 +38,8 @@ static void register_output_formats(void);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
static int using_debug_info;
|
static int using_debug_info;
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
int tasm_compatible_mode = FALSE;
|
int tasm_compatible_mode = FALSE;
|
||||||
#endif
|
int pass0;
|
||||||
|
|
||||||
static char inname[FILENAME_MAX];
|
static char inname[FILENAME_MAX];
|
||||||
static char outname[FILENAME_MAX];
|
static char outname[FILENAME_MAX];
|
||||||
|
@ -131,7 +130,7 @@ static int want_usage;
|
||||||
static int terminate_after_phase;
|
static int terminate_after_phase;
|
||||||
int user_nolist = 0; /* fbk 9/2/00 */
|
int user_nolist = 0; /* fbk 9/2/00 */
|
||||||
|
|
||||||
static void nasm_fputs(char *line, FILE *ofile)
|
static void nasm_fputs(char *line, FILE *ofile)
|
||||||
{
|
{
|
||||||
if (ofile) {
|
if (ofile) {
|
||||||
fputs(line, ofile);
|
fputs(line, ofile);
|
||||||
|
@ -140,7 +139,7 @@ static void nasm_fputs(char *line, FILE *ofile)
|
||||||
puts(line);
|
puts(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
pass0 = 1;
|
pass0 = 1;
|
||||||
want_usage = terminate_after_phase = FALSE;
|
want_usage = terminate_after_phase = FALSE;
|
||||||
|
@ -151,7 +150,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
preproc = &nasmpp;
|
preproc = &nasmpp;
|
||||||
operating_mode = op_normal;
|
operating_mode = op_normal;
|
||||||
|
|
||||||
error_file = stderr;
|
error_file = stderr;
|
||||||
|
|
||||||
seg_init();
|
seg_init();
|
||||||
|
@ -160,7 +159,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
parse_cmdline(argc, argv);
|
parse_cmdline(argc, argv);
|
||||||
|
|
||||||
if (terminate_after_phase)
|
if (terminate_after_phase)
|
||||||
{
|
{
|
||||||
if (want_usage)
|
if (want_usage)
|
||||||
usage();
|
usage();
|
||||||
|
@ -201,7 +200,7 @@ int main(int argc, char **argv)
|
||||||
char *file_name = NULL;
|
char *file_name = NULL;
|
||||||
long prior_linnum=0;
|
long prior_linnum=0;
|
||||||
int lineinc=0;
|
int lineinc=0;
|
||||||
|
|
||||||
if (*outname) {
|
if (*outname) {
|
||||||
ofile = fopen(outname, "w");
|
ofile = fopen(outname, "w");
|
||||||
if (!ofile)
|
if (!ofile)
|
||||||
|
@ -209,9 +208,9 @@ int main(int argc, char **argv)
|
||||||
"unable to open output file `%s'", outname);
|
"unable to open output file `%s'", outname);
|
||||||
} else
|
} else
|
||||||
ofile = NULL;
|
ofile = NULL;
|
||||||
|
|
||||||
location.known = FALSE;
|
location.known = FALSE;
|
||||||
|
|
||||||
/* pass = 1; */
|
/* pass = 1; */
|
||||||
preproc->reset (inname, 2, report_error, evaluate, &nasmlist);
|
preproc->reset (inname, 2, report_error, evaluate, &nasmlist);
|
||||||
while ( (line = preproc->getline()) ) {
|
while ( (line = preproc->getline()) ) {
|
||||||
|
@ -280,7 +279,7 @@ int main(int argc, char **argv)
|
||||||
* so we're leaving out the one here.
|
* so we're leaving out the one here.
|
||||||
* fclose (ofile);
|
* fclose (ofile);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
remove(outname);
|
remove(outname);
|
||||||
if (listname[0])
|
if (listname[0])
|
||||||
remove(listname);
|
remove(listname);
|
||||||
|
@ -288,10 +287,10 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (want_usage)
|
if (want_usage)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
raa_free (offsets);
|
raa_free (offsets);
|
||||||
saa_free (forwrefs);
|
saa_free (forwrefs);
|
||||||
eval_cleanup ();
|
eval_cleanup ();
|
||||||
|
@ -354,7 +353,7 @@ static int process_arg (char *p, char *q)
|
||||||
if (!p || !p[0])
|
if (!p || !p[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (p[0]=='-' && ! stopoptions)
|
if (p[0]=='-' && ! stopoptions)
|
||||||
{
|
{
|
||||||
switch (p[1]) {
|
switch (p[1]) {
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -364,9 +363,11 @@ static int process_arg (char *p, char *q)
|
||||||
case 'O':
|
case 'O':
|
||||||
case 'f':
|
case 'f':
|
||||||
case 'p':
|
case 'p':
|
||||||
|
case 'P':
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'i':
|
case 'i':
|
||||||
|
case 'I':
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'F':
|
case 'F':
|
||||||
|
@ -425,20 +426,18 @@ static int process_arg (char *p, char *q)
|
||||||
printf("usage: nasm [-@ response file] [-o outfile] [-f format] "
|
printf("usage: nasm [-@ response file] [-o outfile] [-f format] "
|
||||||
"[-l listfile]\n"
|
"[-l listfile]\n"
|
||||||
" [options...] [--] filename\n"
|
" [options...] [--] filename\n"
|
||||||
" or nasm -r for version info\n\n"
|
" or nasm -r for version info (obsolete)\n"
|
||||||
#ifdef TASM_COMPAT
|
" or nasm -v for version info (preferred)\n\n"
|
||||||
" -t Assemble in SciTech TASM compatible mode\n"
|
" -t Assemble in SciTech TASM compatible mode\n"
|
||||||
" -g Generate debug information in selected format.\n"
|
" -g Generate debug information in selected format.\n"
|
||||||
#endif
|
|
||||||
" -e preprocess only (writes output to stdout by default)\n"
|
" -e preprocess only (writes output to stdout by default)\n"
|
||||||
" -a don't preprocess (assemble only)\n"
|
" -a don't preprocess (assemble only)\n"
|
||||||
" -M generate Makefile dependencies on stdout\n\n"
|
" -M generate Makefile dependencies on stdout\n\n"
|
||||||
" -E<file> redirect error messages to file\n"
|
" -E<file> redirect error messages to file\n"
|
||||||
" -s redirect error messages to stdout\n\n"
|
" -s redirect error messages to stdout\n\n"
|
||||||
" -g enable debug info\n"
|
|
||||||
" -F format select a debugging format\n\n"
|
" -F format select a debugging format\n\n"
|
||||||
" -I<path> adds a pathname to the include file path\n"
|
" -I<path> adds a pathname to the include file path\n"
|
||||||
" -O<digit> optimize branch offsets -O0 disables, -O2 default\n"
|
" -O<digit> optimize branch offsets (-O0 disables, default)\n"
|
||||||
" -P<file> pre-includes a file\n"
|
" -P<file> pre-includes a file\n"
|
||||||
" -D<macro>[=<value>] pre-defines a macro\n"
|
" -D<macro>[=<value>] pre-defines a macro\n"
|
||||||
" -U<macro> undefines a macro\n"
|
" -U<macro> undefines a macro\n"
|
||||||
|
@ -468,20 +467,16 @@ static int process_arg (char *p, char *q)
|
||||||
dfmt_list(ofmt, stdout);
|
dfmt_list(ofmt, stdout);
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
case 't':
|
case 't':
|
||||||
tasm_compatible_mode = TRUE;
|
tasm_compatible_mode = TRUE;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case 'r':
|
case 'r':
|
||||||
#ifdef TASM_COMPAT
|
case 'v':
|
||||||
printf("NASM version %s - SciTech TASM compatible additions\n", NASM_VER);
|
printf("NASM version %s compiled "
|
||||||
#else
|
|
||||||
printf("NASM version %s\n", NASM_VER);
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Compiled with -DDEBUG on " __DATE__ "\n");
|
"with -DDEBUG "
|
||||||
#endif
|
#endif
|
||||||
|
"on " __DATE__ "\n", NASM_VER);
|
||||||
exit (0); /* never need usage message here */
|
exit (0); /* never need usage message here */
|
||||||
break;
|
break;
|
||||||
case 'e': /* preprocess only */
|
case 'e': /* preprocess only */
|
||||||
|
@ -507,7 +502,7 @@ static int process_arg (char *p, char *q)
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
operating_mode = op_depend;
|
operating_mode = op_depend;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
{
|
{
|
||||||
|
@ -575,8 +570,8 @@ static int process_arg (char *p, char *q)
|
||||||
p[1]);
|
p[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*inname) {
|
if (*inname) {
|
||||||
report_error (ERR_NONFATAL | ERR_NOFILE | ERR_USAGE,
|
report_error (ERR_NONFATAL | ERR_NOFILE | ERR_USAGE,
|
||||||
|
@ -655,7 +650,6 @@ static void process_respfile (FILE *rfile)
|
||||||
* argv array. Used by the environment variable and response file
|
* argv array. Used by the environment variable and response file
|
||||||
* processing.
|
* processing.
|
||||||
*/
|
*/
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
static void process_args (char *args) {
|
static void process_args (char *args) {
|
||||||
char *p, *q, *arg, *prevarg;
|
char *p, *q, *arg, *prevarg;
|
||||||
char separator = ' ';
|
char separator = ' ';
|
||||||
|
@ -676,16 +670,11 @@ static void process_args (char *args) {
|
||||||
if (arg)
|
if (arg)
|
||||||
process_arg (arg, NULL);
|
process_arg (arg, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void parse_cmdline(int argc, char **argv)
|
static void parse_cmdline(int argc, char **argv)
|
||||||
{
|
{
|
||||||
FILE *rfile;
|
FILE *rfile;
|
||||||
char *envreal, *envcopy=NULL, *p, *arg;
|
char *envreal, *envcopy=NULL, *p, *arg;
|
||||||
#ifndef TASM_COMPAT
|
|
||||||
char *q, *prevarg;
|
|
||||||
char separator = ' ';
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*inname = *outname = *listname = '\0';
|
*inname = *outname = *listname = '\0';
|
||||||
|
|
||||||
|
@ -696,24 +685,7 @@ static void parse_cmdline(int argc, char **argv)
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
if (envreal) {
|
if (envreal) {
|
||||||
envcopy = nasm_strdup(envreal);
|
envcopy = nasm_strdup(envreal);
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
process_args(envcopy);
|
process_args(envcopy);
|
||||||
#else
|
|
||||||
p = envcopy;
|
|
||||||
if (*p && *p != '-')
|
|
||||||
separator = *p++;
|
|
||||||
while (*p) {
|
|
||||||
q = p;
|
|
||||||
while (*p && *p != separator) p++;
|
|
||||||
while (*p == separator) *p++ = '\0';
|
|
||||||
prevarg = arg;
|
|
||||||
arg = q;
|
|
||||||
if (process_arg (prevarg, arg))
|
|
||||||
arg = NULL;
|
|
||||||
}
|
|
||||||
if (arg)
|
|
||||||
process_arg (arg, NULL);
|
|
||||||
#endif
|
|
||||||
nasm_free (envcopy);
|
nasm_free (envcopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,7 +696,6 @@ static void parse_cmdline(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
argv++;
|
argv++;
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
if (argv[0][0] == '@') {
|
if (argv[0][0] == '@') {
|
||||||
/* We have a response file, so process this as a set of
|
/* We have a response file, so process this as a set of
|
||||||
* arguments like the environment variable. This allows us
|
* arguments like the environment variable. This allows us
|
||||||
|
@ -748,7 +719,6 @@ static void parse_cmdline(int argc, char **argv)
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (!stopoptions && argv[0][0] == '-' && argv[0][1] == '@') {
|
if (!stopoptions && argv[0][0] == '-' && argv[0][1] == '@') {
|
||||||
if ((p = get_param (argv[0], argc > 1 ? argv[1] : NULL, &i))) {
|
if ((p = get_param (argv[0], argc > 1 ? argv[1] : NULL, &i))) {
|
||||||
if ((rfile = fopen(p, "r"))) {
|
if ((rfile = fopen(p, "r"))) {
|
||||||
|
@ -793,9 +763,9 @@ static void assemble_file (char *fname)
|
||||||
pass1 = pass < pass_max ? 1 : 2; /* seq is 1, 1, 1,..., 1, 2 */
|
pass1 = pass < pass_max ? 1 : 2; /* seq is 1, 1, 1,..., 1, 2 */
|
||||||
pass2 = pass > 1 ? 2 : 1; /* seq is 1, 2, 2,..., 2, 2 */
|
pass2 = pass > 1 ? 2 : 1; /* seq is 1, 2, 2,..., 2, 2 */
|
||||||
/* pass0 seq is 0, 0, 0,..., 1, 2 */
|
/* pass0 seq is 0, 0, 0,..., 1, 2 */
|
||||||
|
|
||||||
def_label = pass > 1 ? redefine_label : define_label;
|
def_label = pass > 1 ? redefine_label : define_label;
|
||||||
|
|
||||||
|
|
||||||
sb = cmd_sb; /* set 'bits' to command line default */
|
sb = cmd_sb; /* set 'bits' to command line default */
|
||||||
cpu = cmd_cpu;
|
cpu = cmd_cpu;
|
||||||
|
@ -817,13 +787,13 @@ static void assemble_file (char *fname)
|
||||||
if (pass == 1) location.known = TRUE;
|
if (pass == 1) location.known = TRUE;
|
||||||
location.offset = offs = GET_CURR_OFFS;
|
location.offset = offs = GET_CURR_OFFS;
|
||||||
|
|
||||||
while ( (line = preproc->getline()) )
|
while ( (line = preproc->getline()) )
|
||||||
{
|
{
|
||||||
globallineno++;
|
globallineno++;
|
||||||
|
|
||||||
/* here we parse our directives; this is not handled by the 'real'
|
/* here we parse our directives; this is not handled by the 'real'
|
||||||
* parser. */
|
* parser. */
|
||||||
if ( (i = getkw (line, &value)) )
|
if ( (i = getkw (line, &value)) )
|
||||||
{
|
{
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 1: /* [SEGMENT n] */
|
case 1: /* [SEGMENT n] */
|
||||||
|
@ -1046,7 +1016,7 @@ static void assemble_file (char *fname)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!ofmt->directive (line+1, value, pass2))
|
if (!ofmt->directive (line+1, value, pass2))
|
||||||
report_error (pass1==1 ? ERR_NONFATAL : ERR_PANIC,
|
report_error (pass1==1 ? ERR_NONFATAL : ERR_PANIC,
|
||||||
"unrecognised directive [%s]",
|
"unrecognised directive [%s]",
|
||||||
line+1);
|
line+1);
|
||||||
}
|
}
|
||||||
|
@ -1054,7 +1024,7 @@ static void assemble_file (char *fname)
|
||||||
else /* it isn't a directive */
|
else /* it isn't a directive */
|
||||||
{
|
{
|
||||||
parse_line (pass1, line, &output_ins,
|
parse_line (pass1, line, &output_ins,
|
||||||
report_error, evaluate,
|
report_error, evaluate,
|
||||||
def_label);
|
def_label);
|
||||||
|
|
||||||
if (!optimizing && pass == 2) {
|
if (!optimizing && pass == 2) {
|
||||||
|
@ -1069,12 +1039,12 @@ static void assemble_file (char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!optimizing && output_ins.forw_ref)
|
if (!optimizing && output_ins.forw_ref)
|
||||||
{
|
{
|
||||||
if (pass == 1) {
|
if (pass == 1) {
|
||||||
for(i = 0; i < output_ins.operands; i++)
|
for(i = 0; i < output_ins.operands; i++)
|
||||||
{
|
{
|
||||||
if (output_ins.oprs[i].opflags & OPFLAG_FORWARD)
|
if (output_ins.oprs[i].opflags & OPFLAG_FORWARD)
|
||||||
{
|
{
|
||||||
struct forwrefinfo *fwinf =
|
struct forwrefinfo *fwinf =
|
||||||
(struct forwrefinfo *)saa_wstruct(forwrefs);
|
(struct forwrefinfo *)saa_wstruct(forwrefs);
|
||||||
|
@ -1103,7 +1073,7 @@ static void assemble_file (char *fname)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (output_ins.operands >= 2 &&
|
if (output_ins.operands >= 2 &&
|
||||||
(output_ins.oprs[1].opflags & OPFLAG_FORWARD))
|
(output_ins.oprs[1].opflags & OPFLAG_FORWARD))
|
||||||
{
|
{
|
||||||
output_ins.oprs[1].type &= ~(ONENESS|BYTENESS);
|
output_ins.oprs[1].type &= ~(ONENESS|BYTENESS);
|
||||||
}
|
}
|
||||||
|
@ -1127,18 +1097,18 @@ static void assemble_file (char *fname)
|
||||||
|
|
||||||
else if (output_ins.label[0] != '.' ||
|
else if (output_ins.label[0] != '.' ||
|
||||||
output_ins.label[1] != '.' ||
|
output_ins.label[1] != '.' ||
|
||||||
output_ins.label[2] == '@')
|
output_ins.label[2] == '@')
|
||||||
{
|
{
|
||||||
if (output_ins.operands == 1 &&
|
if (output_ins.operands == 1 &&
|
||||||
(output_ins.oprs[0].type & IMMEDIATE) &&
|
(output_ins.oprs[0].type & IMMEDIATE) &&
|
||||||
output_ins.oprs[0].wrt == NO_SEG)
|
output_ins.oprs[0].wrt == NO_SEG)
|
||||||
{
|
{
|
||||||
int isext = output_ins.oprs[0].opflags & OPFLAG_EXTERN;
|
int isext = output_ins.oprs[0].opflags & OPFLAG_EXTERN;
|
||||||
def_label (output_ins.label,
|
def_label (output_ins.label,
|
||||||
output_ins.oprs[0].segment,
|
output_ins.oprs[0].segment,
|
||||||
output_ins.oprs[0].offset,
|
output_ins.oprs[0].offset,
|
||||||
NULL, FALSE, isext, ofmt, report_error);
|
NULL, FALSE, isext, ofmt, report_error);
|
||||||
}
|
}
|
||||||
else if (output_ins.operands == 2 &&
|
else if (output_ins.operands == 2 &&
|
||||||
(output_ins.oprs[0].type & IMMEDIATE) &&
|
(output_ins.oprs[0].type & IMMEDIATE) &&
|
||||||
(output_ins.oprs[0].type & COLON) &&
|
(output_ins.oprs[0].type & COLON) &&
|
||||||
|
@ -1146,13 +1116,13 @@ static void assemble_file (char *fname)
|
||||||
output_ins.oprs[0].wrt == NO_SEG &&
|
output_ins.oprs[0].wrt == NO_SEG &&
|
||||||
(output_ins.oprs[1].type & IMMEDIATE) &&
|
(output_ins.oprs[1].type & IMMEDIATE) &&
|
||||||
output_ins.oprs[1].segment == NO_SEG &&
|
output_ins.oprs[1].segment == NO_SEG &&
|
||||||
output_ins.oprs[1].wrt == NO_SEG)
|
output_ins.oprs[1].wrt == NO_SEG)
|
||||||
{
|
{
|
||||||
def_label (output_ins.label,
|
def_label (output_ins.label,
|
||||||
output_ins.oprs[0].offset | SEG_ABS,
|
output_ins.oprs[0].offset | SEG_ABS,
|
||||||
output_ins.oprs[1].offset,
|
output_ins.oprs[1].offset,
|
||||||
NULL, FALSE, FALSE, ofmt, report_error);
|
NULL, FALSE, FALSE, ofmt, report_error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
report_error(ERR_NONFATAL, "bad syntax for EQU");
|
report_error(ERR_NONFATAL, "bad syntax for EQU");
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1133,7 @@ static void assemble_file (char *fname)
|
||||||
*/
|
*/
|
||||||
if (output_ins.label[0] == '.' &&
|
if (output_ins.label[0] == '.' &&
|
||||||
output_ins.label[1] == '.' &&
|
output_ins.label[1] == '.' &&
|
||||||
output_ins.label[2] != '@')
|
output_ins.label[2] != '@')
|
||||||
{
|
{
|
||||||
if (output_ins.operands == 1 &&
|
if (output_ins.operands == 1 &&
|
||||||
(output_ins.oprs[0].type & IMMEDIATE)) {
|
(output_ins.oprs[0].type & IMMEDIATE)) {
|
||||||
|
@ -1171,19 +1141,19 @@ static void assemble_file (char *fname)
|
||||||
output_ins.oprs[0].segment,
|
output_ins.oprs[0].segment,
|
||||||
output_ins.oprs[0].offset,
|
output_ins.oprs[0].offset,
|
||||||
NULL, FALSE, FALSE, ofmt, report_error);
|
NULL, FALSE, FALSE, ofmt, report_error);
|
||||||
}
|
}
|
||||||
else if (output_ins.operands == 2 &&
|
else if (output_ins.operands == 2 &&
|
||||||
(output_ins.oprs[0].type & IMMEDIATE) &&
|
(output_ins.oprs[0].type & IMMEDIATE) &&
|
||||||
(output_ins.oprs[0].type & COLON) &&
|
(output_ins.oprs[0].type & COLON) &&
|
||||||
output_ins.oprs[0].segment == NO_SEG &&
|
output_ins.oprs[0].segment == NO_SEG &&
|
||||||
(output_ins.oprs[1].type & IMMEDIATE) &&
|
(output_ins.oprs[1].type & IMMEDIATE) &&
|
||||||
output_ins.oprs[1].segment == NO_SEG)
|
output_ins.oprs[1].segment == NO_SEG)
|
||||||
{
|
{
|
||||||
define_label (output_ins.label,
|
define_label (output_ins.label,
|
||||||
output_ins.oprs[0].offset | SEG_ABS,
|
output_ins.oprs[0].offset | SEG_ABS,
|
||||||
output_ins.oprs[1].offset,
|
output_ins.oprs[1].offset,
|
||||||
NULL, FALSE, FALSE, ofmt, report_error);
|
NULL, FALSE, FALSE, ofmt, report_error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
report_error(ERR_NONFATAL, "bad syntax for EQU");
|
report_error(ERR_NONFATAL, "bad syntax for EQU");
|
||||||
}
|
}
|
||||||
|
@ -1196,26 +1166,26 @@ static void assemble_file (char *fname)
|
||||||
&output_ins, report_error);
|
&output_ins, report_error);
|
||||||
|
|
||||||
/* if (using_debug_info) && output_ins.opcode != -1)*/
|
/* if (using_debug_info) && output_ins.opcode != -1)*/
|
||||||
if (using_debug_info); /* fbk 12/29/00 */
|
if (using_debug_info) /* fbk 03/25/01 */
|
||||||
|
|
||||||
{
|
{
|
||||||
/* this is done here so we can do debug type info */
|
/* this is done here so we can do debug type info */
|
||||||
long typeinfo = TYS_ELEMENTS(output_ins.operands);
|
long typeinfo = TYS_ELEMENTS(output_ins.operands);
|
||||||
switch (output_ins.opcode) {
|
switch (output_ins.opcode) {
|
||||||
case I_RESB:
|
case I_RESB:
|
||||||
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_BYTE;
|
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_BYTE;
|
||||||
break;
|
break;
|
||||||
case I_RESW:
|
case I_RESW:
|
||||||
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_WORD;
|
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_WORD;
|
||||||
break;
|
break;
|
||||||
case I_RESD:
|
case I_RESD:
|
||||||
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_DWORD;
|
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_DWORD;
|
||||||
break;
|
break;
|
||||||
case I_RESQ:
|
case I_RESQ:
|
||||||
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_QWORD;
|
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_QWORD;
|
||||||
break;
|
break;
|
||||||
case I_REST:
|
case I_REST:
|
||||||
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_TBYTE;
|
typeinfo = TYS_ELEMENTS(output_ins.oprs[0].offset) | TY_TBYTE;
|
||||||
break;
|
break;
|
||||||
case I_DB:
|
case I_DB:
|
||||||
typeinfo |= TY_BYTE;
|
typeinfo |= TY_BYTE;
|
||||||
|
@ -1247,7 +1217,7 @@ static void assemble_file (char *fname)
|
||||||
offs += l;
|
offs += l;
|
||||||
SET_CURR_OFFS (offs);
|
SET_CURR_OFFS (offs);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* else l == -1 => invalid instruction, which will be
|
* else l == -1 => invalid instruction, which will be
|
||||||
* flagged as an error on pass 2
|
* flagged as an error on pass 2
|
||||||
*/
|
*/
|
||||||
|
@ -1282,7 +1252,7 @@ static void assemble_file (char *fname)
|
||||||
pass0++;
|
pass0++;
|
||||||
if (pass0==2) pass = pass_max - 1;
|
if (pass0==2) pass = pass_max - 1;
|
||||||
} else if (!optimizing) pass0++;
|
} else if (!optimizing) pass0++;
|
||||||
|
|
||||||
} /* for (pass=1; pass<=2; pass++) */
|
} /* for (pass=1; pass<=2; pass++) */
|
||||||
|
|
||||||
nasmlist.cleanup();
|
nasmlist.cleanup();
|
||||||
|
@ -1290,11 +1260,11 @@ static void assemble_file (char *fname)
|
||||||
if (optimizing && using_debug_info) /* -On and -g switches */
|
if (optimizing && using_debug_info) /* -On and -g switches */
|
||||||
fprintf(error_file,
|
fprintf(error_file,
|
||||||
"info:: assembly required 1+%d+1 passes\n", pass_cnt-2);
|
"info:: assembly required 1+%d+1 passes\n", pass_cnt-2);
|
||||||
#endif
|
#endif
|
||||||
} /* exit from assemble_file (...) */
|
} /* exit from assemble_file (...) */
|
||||||
|
|
||||||
|
|
||||||
static int getkw (char *buf, char **value)
|
static int getkw (char *buf, char **value)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
|
@ -1330,7 +1300,7 @@ static int getkw (char *buf, char **value)
|
||||||
while (*buf!=']') buf++;
|
while (*buf!=']') buf++;
|
||||||
*buf++ = '\0';
|
*buf++ = '\0';
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
for (q=p; *q; q++)
|
for (q=p; *q; q++)
|
||||||
*q = tolower(*q);
|
*q = tolower(*q);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1357,7 +1327,7 @@ static int getkw (char *buf, char **value)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void report_error (int severity, char *fmt, ...)
|
static void report_error (int severity, char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -1397,7 +1367,7 @@ static void report_error (int severity, char *fmt, ...)
|
||||||
case ERR_DEBUG:
|
case ERR_DEBUG:
|
||||||
fputs("debug: ", error_file); break;
|
fputs("debug: ", error_file); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
vfprintf (error_file, fmt, ap);
|
vfprintf (error_file, fmt, ap);
|
||||||
fputc ('\n', error_file);
|
fputc ('\n', error_file);
|
||||||
|
@ -1429,12 +1399,12 @@ static void report_error (int severity, char *fmt, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fputs("type `nasm -h' for help\n", error_file);
|
fputs("type `nasm -h' for help\n", error_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void register_output_formats(void)
|
static void register_output_formats(void)
|
||||||
{
|
{
|
||||||
ofmt = ofmt_register (report_error);
|
ofmt = ofmt_register (report_error);
|
||||||
}
|
}
|
||||||
|
@ -1447,7 +1417,7 @@ static ListGen *no_pp_list;
|
||||||
static long no_pp_lineinc;
|
static long no_pp_lineinc;
|
||||||
|
|
||||||
static void no_pp_reset (char *file, int pass, efunc error, evalfunc eval,
|
static void no_pp_reset (char *file, int pass, efunc error, evalfunc eval,
|
||||||
ListGen *listgen)
|
ListGen *listgen)
|
||||||
{
|
{
|
||||||
src_set_fname(nasm_strdup(file));
|
src_set_fname(nasm_strdup(file));
|
||||||
src_set_linnum(0);
|
src_set_linnum(0);
|
||||||
|
@ -1462,7 +1432,7 @@ static void no_pp_reset (char *file, int pass, efunc error, evalfunc eval,
|
||||||
(void) eval; /* placate compilers */
|
(void) eval; /* placate compilers */
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *no_pp_getline (void)
|
static char *no_pp_getline (void)
|
||||||
{
|
{
|
||||||
char *buffer, *p, *q;
|
char *buffer, *p, *q;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
|
@ -1521,20 +1491,20 @@ static char *no_pp_getline (void)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void no_pp_cleanup (void)
|
static void no_pp_cleanup (void)
|
||||||
{
|
{
|
||||||
fclose(no_pp_fp);
|
fclose(no_pp_fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long get_cpu (char *value)
|
static unsigned long get_cpu (char *value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!strcmp(value, "8086")) return IF_8086;
|
if (!strcmp(value, "8086")) return IF_8086;
|
||||||
if (!strcmp(value, "186")) return IF_186;
|
if (!strcmp(value, "186")) return IF_186;
|
||||||
if (!strcmp(value, "286")) return IF_286;
|
if (!strcmp(value, "286")) return IF_286;
|
||||||
if (!strcmp(value, "386")) return IF_386;
|
if (!strcmp(value, "386")) return IF_386;
|
||||||
if (!strcmp(value, "486")) return IF_486;
|
if (!strcmp(value, "486")) return IF_486;
|
||||||
if (!strcmp(value, "586") ||
|
if (!strcmp(value, "586") ||
|
||||||
!nasm_stricmp(value, "pentium") ) return IF_PENT;
|
!nasm_stricmp(value, "pentium") ) return IF_PENT;
|
||||||
if (!strcmp(value, "686") ||
|
if (!strcmp(value, "686") ||
|
||||||
!nasm_stricmp(value, "ppro") ||
|
!nasm_stricmp(value, "ppro") ||
|
||||||
|
@ -1543,7 +1513,7 @@ static unsigned long get_cpu (char *value)
|
||||||
!nasm_stricmp(value, "katmai") ) return IF_KATMAI;
|
!nasm_stricmp(value, "katmai") ) return IF_KATMAI;
|
||||||
|
|
||||||
report_error (pass0<2 ? ERR_NONFATAL : ERR_FATAL, "unknown 'cpu' type");
|
report_error (pass0<2 ? ERR_NONFATAL : ERR_FATAL, "unknown 'cpu' type");
|
||||||
|
|
||||||
return IF_PLEVEL; /* the maximum level */
|
return IF_PLEVEL; /* the maximum level */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1551,7 +1521,7 @@ static unsigned long get_cpu (char *value)
|
||||||
static int get_bits (char *value)
|
static int get_bits (char *value)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((i = atoi(value)) == 16) return i; /* set for a 16-bit segment */
|
if ((i = atoi(value)) == 16) return i; /* set for a 16-bit segment */
|
||||||
else if (i == 32) {
|
else if (i == 32) {
|
||||||
if (cpu < IF_386) {
|
if (cpu < IF_386) {
|
||||||
|
|
6
nasm.h
6
nasm.h
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#define NASM_MAJOR_VER 0
|
#define NASM_MAJOR_VER 0
|
||||||
#define NASM_MINOR_VER 98
|
#define NASM_MINOR_VER 98
|
||||||
#define NASM_VER "0.98.08"
|
#define NASM_VER "0.98.09"
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
@ -856,9 +856,7 @@ struct dfmt {
|
||||||
|
|
||||||
#define elements(x) ( sizeof(x) / sizeof(*(x)) )
|
#define elements(x) ( sizeof(x) / sizeof(*(x)) )
|
||||||
|
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
extern int tasm_compatible_mode;
|
extern int tasm_compatible_mode;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This declaration passes the "pass" number to all other modules
|
* This declaration passes the "pass" number to all other modules
|
||||||
|
@ -868,6 +866,6 @@ extern int tasm_compatible_mode;
|
||||||
* 2 = pass 2
|
* 2 = pass 2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int pass0; /* this is globally known */
|
extern int pass0; /* this is globally known */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -757,9 +757,9 @@ int stdscan (void *private_data, struct tokenval *tv)
|
||||||
if ((tv->t_integer=bsi(ourcopy, special_names,
|
if ((tv->t_integer=bsi(ourcopy, special_names,
|
||||||
elements(special_names)))>=0)
|
elements(special_names)))>=0)
|
||||||
return tv->t_type = TOKEN_SPECIAL;
|
return tv->t_type = TOKEN_SPECIAL;
|
||||||
if (!strcmp(ourcopy, "seg"))
|
if (!nasm_stricmp(ourcopy, "seg"))
|
||||||
return tv->t_type = TOKEN_SEG;
|
return tv->t_type = TOKEN_SEG;
|
||||||
if (!strcmp(ourcopy, "wrt"))
|
if (!nasm_stricmp(ourcopy, "wrt"))
|
||||||
return tv->t_type = TOKEN_WRT;
|
return tv->t_type = TOKEN_WRT;
|
||||||
return tv->t_type = TOKEN_ID;
|
return tv->t_type = TOKEN_ID;
|
||||||
} else if (*stdscan_bufptr == '$' && !isnumchar(stdscan_bufptr[1])) {
|
} else if (*stdscan_bufptr == '$' && !isnumchar(stdscan_bufptr[1])) {
|
||||||
|
|
|
@ -825,10 +825,10 @@ static void aout_write_relocs (struct Reloc *r)
|
||||||
|
|
||||||
static void aout_write_syms (void)
|
static void aout_write_syms (void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned long i;
|
||||||
|
|
||||||
saa_rewind (syms);
|
saa_rewind (syms);
|
||||||
for (i=0; i<nsyms; i++) {
|
for (i = 0; i < nsyms; i++) {
|
||||||
struct Symbol *sym = saa_rstruct(syms);
|
struct Symbol *sym = saa_rstruct(syms);
|
||||||
fwritelong (sym->strpos, aoutfp);
|
fwritelong (sym->strpos, aoutfp);
|
||||||
fwritelong ((long)sym->type & ~SYM_WITH_SIZE, aoutfp);
|
fwritelong ((long)sym->type & ~SYM_WITH_SIZE, aoutfp);
|
||||||
|
|
|
@ -350,7 +350,7 @@ static void as86_out (long segto, void *data, unsigned long type,
|
||||||
|
|
||||||
static void as86_write(void)
|
static void as86_write(void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned long i;
|
||||||
long symlen, seglen, segsize;
|
long symlen, seglen, segsize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
671
outbin.c
671
outbin.c
|
@ -1,5 +1,5 @@
|
||||||
/* outbin.c output routines for the Netwide Assembler to produce
|
/* outbin.c output routines for the Netwide Assembler to produce
|
||||||
* flat-form binary files
|
* flat-form binary files
|
||||||
*
|
*
|
||||||
* The Netwide Assembler is copyright (C) 1996 Simon Tatham and
|
* The Netwide Assembler is copyright (C) 1996 Simon Tatham and
|
||||||
* Julian Hall. All rights reserved. The software is
|
* Julian Hall. All rights reserved. The software is
|
||||||
|
@ -7,6 +7,13 @@
|
||||||
* distributed in the NASM archive.
|
* distributed in the NASM archive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* version with multiple sections support
|
||||||
|
*
|
||||||
|
* sections go in order defined by their org's if present
|
||||||
|
* if no org present, sections go in sequence they appear.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -22,11 +29,16 @@ static FILE *fp;
|
||||||
static efunc error;
|
static efunc error;
|
||||||
|
|
||||||
static struct Section {
|
static struct Section {
|
||||||
|
struct Section *next;
|
||||||
struct SAA *contents;
|
struct SAA *contents;
|
||||||
long length;
|
long length;
|
||||||
long index;
|
long org; /* assigned org */
|
||||||
} textsect, datasect;
|
long pos; /* file position of section ?? */
|
||||||
static long bsslen, bssindex;
|
long pad; /* padding bytes to next section in file */
|
||||||
|
long index; /* the NASM section id */
|
||||||
|
long align; /* section alignment, cannot be absolute addr */
|
||||||
|
char *name;
|
||||||
|
} *sections, **sectail;
|
||||||
|
|
||||||
static struct Reloc {
|
static struct Reloc {
|
||||||
struct Reloc *next;
|
struct Reloc *next;
|
||||||
|
@ -37,12 +49,10 @@ static struct Reloc {
|
||||||
struct Section *target;
|
struct Section *target;
|
||||||
} *relocs, **reloctail;
|
} *relocs, **reloctail;
|
||||||
|
|
||||||
static long data_align, bss_align;
|
static long current_section;
|
||||||
|
|
||||||
static long start_point;
|
|
||||||
|
|
||||||
static void add_reloc (struct Section *s, long bytes, long secref,
|
static void add_reloc (struct Section *s, long bytes, long secref,
|
||||||
long secrel)
|
long secrel)
|
||||||
{
|
{
|
||||||
struct Reloc *r;
|
struct Reloc *r;
|
||||||
|
|
||||||
|
@ -56,307 +66,491 @@ static void add_reloc (struct Section *s, long bytes, long secref,
|
||||||
r->target = s;
|
r->target = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_init (FILE *afp, efunc errfunc, ldfunc ldef, evalfunc eval)
|
static struct Section *find_section_by_name(char *name)
|
||||||
{
|
{
|
||||||
fp = afp;
|
struct Section *s;
|
||||||
|
|
||||||
(void) eval; /* Don't warn that this parameter is unused */
|
for (s = sections; s; s = s->next)
|
||||||
|
if (!strcmp(s->name,name))
|
||||||
|
break;
|
||||||
|
|
||||||
error = errfunc;
|
return s;
|
||||||
(void) ldef; /* placate optimisers */
|
|
||||||
|
|
||||||
start_point = 0L; /* default */
|
|
||||||
textsect.contents = saa_init(1L);
|
|
||||||
datasect.contents = saa_init(1L);
|
|
||||||
textsect.length = datasect.length = 0;
|
|
||||||
textsect.index = seg_alloc();
|
|
||||||
datasect.index = seg_alloc();
|
|
||||||
bsslen = 0;
|
|
||||||
bssindex = seg_alloc();
|
|
||||||
relocs = NULL;
|
|
||||||
reloctail = &relocs;
|
|
||||||
data_align = bss_align = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_cleanup (int debuginfo)
|
static struct Section *find_section_by_index(long index)
|
||||||
{
|
{
|
||||||
struct Reloc *r;
|
struct Section *s;
|
||||||
long datapos, datagap, bsspos;
|
|
||||||
|
|
||||||
(void) debuginfo;
|
for (s = sections; s; s = s->next)
|
||||||
|
if ( s->index == index )
|
||||||
|
break;
|
||||||
|
|
||||||
datapos = start_point + textsect.length;
|
return s;
|
||||||
datapos = (datapos + data_align-1) & ~(data_align-1);
|
}
|
||||||
datagap = datapos - (start_point + textsect.length);
|
|
||||||
bsspos = datapos + datasect.length;
|
|
||||||
bsspos = (bsspos + bss_align-1) & ~(bss_align-1);
|
|
||||||
|
|
||||||
saa_rewind (textsect.contents);
|
static struct Section *alloc_section(char *name)
|
||||||
saa_rewind (datasect.contents);
|
{
|
||||||
|
struct Section *s;
|
||||||
|
|
||||||
for (r = relocs; r; r = r->next)
|
s = find_section_by_name(name);
|
||||||
{
|
if(s)
|
||||||
unsigned char *p, *q, mydata[4];
|
error(ERR_PANIC, "section %s re-defined", name);
|
||||||
long l;
|
|
||||||
|
|
||||||
saa_fread (r->target->contents, r->posn, mydata, r->bytes);
|
s = nasm_malloc(sizeof(struct Section));
|
||||||
p = q = mydata;
|
*sectail = s;
|
||||||
l = *p++;
|
sectail = &s->next;
|
||||||
if (r->bytes > 1) {
|
s->next = NULL;
|
||||||
l += ((long)*p++) << 8;
|
|
||||||
if (r->bytes == 4) {
|
|
||||||
l += ((long)*p++) << 16;
|
|
||||||
l += ((long)*p++) << 24;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r->secref == textsect.index)
|
s->contents = saa_init(1L);
|
||||||
l += start_point;
|
s->length = 0;
|
||||||
else if (r->secref == datasect.index)
|
s->pos = 0;
|
||||||
l += datapos;
|
s->org = -1; /* default org is -1 because we want
|
||||||
else if (r->secref == bssindex)
|
* to adjust sections one after another
|
||||||
l += bsspos;
|
*/
|
||||||
|
s->index = seg_alloc();
|
||||||
|
s->align = 4;
|
||||||
|
s->pad = 0;
|
||||||
|
s->name = nasm_strdup(name);
|
||||||
|
|
||||||
if (r->secrel == textsect.index)
|
return s;
|
||||||
l -= start_point;
|
}
|
||||||
else if (r->secrel == datasect.index)
|
|
||||||
l -= datapos;
|
|
||||||
else if (r->secrel == bssindex)
|
|
||||||
l -= bsspos;
|
|
||||||
|
|
||||||
if (r->bytes == 4)
|
static void bin_init (FILE *afp, efunc errfunc, ldfunc ldef, evalfunc eval)
|
||||||
WRITELONG(q, l);
|
{
|
||||||
else if (r->bytes == 2)
|
fp = afp;
|
||||||
WRITESHORT(q, l);
|
error = errfunc;
|
||||||
else
|
|
||||||
*q++ = l & 0xFF;
|
(void) eval; /* Don't warn that this parameter is unused */
|
||||||
saa_fwrite (r->target->contents, r->posn, mydata, r->bytes);
|
(void) ldef; /* placate optimisers */
|
||||||
}
|
|
||||||
saa_fpwrite (textsect.contents, fp);
|
current_section = -1L;
|
||||||
if (datasect.length > 0) {
|
relocs = NULL;
|
||||||
while (datagap--)
|
reloctail = &relocs;
|
||||||
fputc('\0', fp);
|
sections = NULL;
|
||||||
saa_fpwrite (datasect.contents, fp);
|
sectail = §ions;
|
||||||
}
|
}
|
||||||
fclose (fp);
|
|
||||||
saa_free (textsect.contents);
|
static void bin_cleanup (int debuginfo)
|
||||||
saa_free (datasect.contents);
|
{
|
||||||
while (relocs) {
|
struct Section *outsections, **outstail;
|
||||||
r = relocs->next;
|
struct Section *s, *o, *ls, *lo;
|
||||||
nasm_free (relocs);
|
struct Reloc *r;
|
||||||
relocs = r;
|
long least_org;
|
||||||
}
|
|
||||||
|
(void) debuginfo;
|
||||||
|
|
||||||
|
/* sort sections by their orgs
|
||||||
|
* sections without org follow their natural order
|
||||||
|
* after the org'd sections
|
||||||
|
*/
|
||||||
|
outsections = NULL;
|
||||||
|
outstail = &outsections;
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
least_org = 0x7fffffff;
|
||||||
|
|
||||||
|
ls = lo = NULL;
|
||||||
|
for( s = sections, o = NULL; s; o = s, s = s->next )
|
||||||
|
if( s->org != -1 && s->org < least_org )
|
||||||
|
{
|
||||||
|
least_org = s->org;
|
||||||
|
ls = s;
|
||||||
|
lo = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ls) /* relink to outsections */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stdout, "bin_cleanup: relinking section %s org %ld\n", ls->name, ls->org);
|
||||||
|
#endif
|
||||||
|
/* unlink from sections */
|
||||||
|
if(lo)
|
||||||
|
lo->next = ls->next;
|
||||||
|
else
|
||||||
|
if(ls == sections)
|
||||||
|
sections = ls->next;
|
||||||
|
|
||||||
|
/* link in to outsections */
|
||||||
|
if( ls->length > 0 )
|
||||||
|
{
|
||||||
|
*outstail = ls;
|
||||||
|
outstail = &ls->next;
|
||||||
|
ls->next = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* link outsections at start of sections */
|
||||||
|
*outstail = sections;
|
||||||
|
sections = outsections;
|
||||||
|
|
||||||
|
/* calculate sections positions */
|
||||||
|
for(s = sections, o = NULL; s; s = s->next)
|
||||||
|
{
|
||||||
|
if(!strcmp(s->name,".bss")) continue; /* don't count .bss yet */
|
||||||
|
|
||||||
|
if(o)
|
||||||
|
{
|
||||||
|
/* if section doesn't have its
|
||||||
|
* own org, align from prev section
|
||||||
|
*/
|
||||||
|
if( s->org == -1 )
|
||||||
|
s->org = o->org + o->length;
|
||||||
|
|
||||||
|
/* check orgs */
|
||||||
|
if( s->org - o->org < o->length )
|
||||||
|
error( ERR_PANIC, "sections %s and %s overlap!", o->name, s->name );
|
||||||
|
|
||||||
|
/* align previous section */
|
||||||
|
o->pad = ((o->pos + o->length + o->align-1) & ~(o->align-1)) - (o->pos + o->length);
|
||||||
|
|
||||||
|
if( s->org - o->org > o->length )
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stdout, "forced padding: %ld\n", s->org - o->org - o->length);
|
||||||
|
#endif
|
||||||
|
o->pad = s->org - o->org - o->length;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->pos += o->pos + o->length + o->pad;
|
||||||
|
s->org = s->pos + sections->org;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stdout, "bin_cleanup: section %s at %ld(%lx) org %ld(%lx) prev <pos %ld(%lx)+size %ld(%lx)+pad %ld(%lx)> size %ld(%lx) align %ld(%lx)\n",
|
||||||
|
s->name, s->pos, s->pos, s->org, s->org, o?o->pos:0, o?o->pos:0,
|
||||||
|
o?o->length:0, o?o->length:0, o?o->pad:0, o?o->pad:0, s->length, s->length,
|
||||||
|
s->align, s->align);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* prepare for relocating by the way */
|
||||||
|
saa_rewind( s->contents );
|
||||||
|
|
||||||
|
o = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* adjust .bss */
|
||||||
|
s = find_section_by_name(".bss");
|
||||||
|
if(s)
|
||||||
|
{
|
||||||
|
s->org = o->org + o->length + o->pad;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stdout, "bin_cleanup: section %s at %ld org %ld prev (pos %ld+size %ld+pad %ld) size %ld align %ld\n",
|
||||||
|
s->name, s->pos, s->org, o?o->pos:0, o?o->length:0, o?o->pad:0, s->length, s->align);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* apply relocations */
|
||||||
|
for (r = relocs; r; r = r->next)
|
||||||
|
{
|
||||||
|
unsigned char *p, *q, mydata[4];
|
||||||
|
long l;
|
||||||
|
|
||||||
|
saa_fread (r->target->contents, r->posn, mydata, r->bytes);
|
||||||
|
p = q = mydata;
|
||||||
|
l = *p++;
|
||||||
|
|
||||||
|
if (r->bytes > 1) {
|
||||||
|
l += ((long)*p++) << 8;
|
||||||
|
if (r->bytes == 4) {
|
||||||
|
l += ((long)*p++) << 16;
|
||||||
|
l += ((long)*p++) << 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s = find_section_by_index(r->secref);
|
||||||
|
if(s)
|
||||||
|
l += s->org;
|
||||||
|
|
||||||
|
s = find_section_by_index(r->secrel);
|
||||||
|
if(s)
|
||||||
|
l -= s->org;
|
||||||
|
|
||||||
|
if (r->bytes == 4)
|
||||||
|
WRITELONG(q, l);
|
||||||
|
else if (r->bytes == 2)
|
||||||
|
WRITESHORT(q, l);
|
||||||
|
else
|
||||||
|
*q++ = l & 0xFF;
|
||||||
|
saa_fwrite (r->target->contents, r->posn, mydata, r->bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write sections to file */
|
||||||
|
for(s = outsections; s; s = s->next)
|
||||||
|
{
|
||||||
|
if(s->length > 0 && strcmp(s->name,".bss"))
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stdout, "bin_cleanup: writing section %s\n", s->name);
|
||||||
|
#endif
|
||||||
|
saa_fpwrite (s->contents, fp);
|
||||||
|
if( s->next )
|
||||||
|
while( s->pad-- > 0 )
|
||||||
|
fputc('\0', fp);
|
||||||
|
/* could pad with nops, since we don't
|
||||||
|
* know if this is code section or not
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
|
while (relocs) {
|
||||||
|
r = relocs->next;
|
||||||
|
nasm_free (relocs);
|
||||||
|
relocs = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (outsections) {
|
||||||
|
s = outsections->next;
|
||||||
|
saa_free (outsections->contents);
|
||||||
|
nasm_free (outsections->name);
|
||||||
|
nasm_free (outsections);
|
||||||
|
outsections = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_out (long segto, void *data, unsigned long type,
|
static void bin_out (long segto, void *data, unsigned long type,
|
||||||
long segment, long wrt)
|
long segment, long wrt)
|
||||||
{
|
{
|
||||||
unsigned char *p, mydata[4];
|
unsigned char *p, mydata[4];
|
||||||
struct Section *s;
|
struct Section *s, *sec;
|
||||||
long realbytes;
|
long realbytes;
|
||||||
|
|
||||||
if (wrt != NO_SEG) {
|
if (wrt != NO_SEG) {
|
||||||
wrt = NO_SEG; /* continue to do _something_ */
|
wrt = NO_SEG; /* continue to do _something_ */
|
||||||
error (ERR_NONFATAL, "WRT not supported by binary output format");
|
error (ERR_NONFATAL, "WRT not supported by binary output format");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* handle absolute-assembly (structure definitions)
|
* handle absolute-assembly (structure definitions)
|
||||||
*/
|
*/
|
||||||
if (segto == NO_SEG) {
|
if (segto == NO_SEG) {
|
||||||
if ((type & OUT_TYPMASK) != OUT_RESERVE)
|
if ((type & OUT_TYPMASK) != OUT_RESERVE)
|
||||||
error (ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
|
error (ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
|
||||||
" space");
|
" space");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (segto == bssindex) { /* BSS */
|
/*
|
||||||
if ((type & OUT_TYPMASK) != OUT_RESERVE)
|
* Find the segment we are targetting.
|
||||||
error(ERR_WARNING, "attempt to initialise memory in the"
|
*/
|
||||||
" BSS section: ignored");
|
s = find_section_by_index(segto);
|
||||||
s = NULL;
|
if (!s)
|
||||||
} else if (segto == textsect.index) {
|
error (ERR_PANIC, "code directed to nonexistent segment?");
|
||||||
s = &textsect;
|
|
||||||
} else if (segto == datasect.index) {
|
if (!strcmp(s->name, ".bss")) { /* BSS */
|
||||||
s = &datasect;
|
if ((type & OUT_TYPMASK) != OUT_RESERVE)
|
||||||
} else {
|
error(ERR_WARNING, "attempt to initialise memory in the"
|
||||||
error(ERR_WARNING, "attempt to assemble code in"
|
" BSS section: ignored");
|
||||||
" segment %d: defaulting to `.text'", segto);
|
s = NULL;
|
||||||
s = &textsect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type & OUT_TYPMASK) == OUT_ADDRESS) {
|
if ((type & OUT_TYPMASK) == OUT_ADDRESS) {
|
||||||
if (segment != NO_SEG &&
|
|
||||||
segment != textsect.index &&
|
if (segment != NO_SEG && !find_section_by_index(segment)) {
|
||||||
segment != datasect.index &&
|
if (segment % 2)
|
||||||
segment != bssindex) {
|
error(ERR_NONFATAL, "binary output format does not support"
|
||||||
if (segment % 2)
|
" segment base references");
|
||||||
error(ERR_NONFATAL, "binary output format does not support"
|
else
|
||||||
" segment base references");
|
error(ERR_NONFATAL, "binary output format does not support"
|
||||||
else
|
" external references");
|
||||||
error(ERR_NONFATAL, "binary output format does not support"
|
segment = NO_SEG;
|
||||||
" external references");
|
}
|
||||||
segment = NO_SEG;
|
|
||||||
}
|
if (s) {
|
||||||
if (s) {
|
if (segment != NO_SEG)
|
||||||
if (segment != NO_SEG)
|
add_reloc (s, type & OUT_SIZMASK, segment, -1L);
|
||||||
add_reloc (s, type & OUT_SIZMASK, segment, -1L);
|
p = mydata;
|
||||||
p = mydata;
|
if ((type & OUT_SIZMASK) == 4)
|
||||||
if ((type & OUT_SIZMASK) == 4)
|
WRITELONG (p, *(long *)data);
|
||||||
WRITELONG (p, *(long *)data);
|
else
|
||||||
else
|
WRITESHORT (p, *(long *)data);
|
||||||
WRITESHORT (p, *(long *)data);
|
saa_wbytes (s->contents, mydata, type & OUT_SIZMASK);
|
||||||
saa_wbytes (s->contents, mydata, type & OUT_SIZMASK);
|
s->length += type & OUT_SIZMASK;
|
||||||
s->length += type & OUT_SIZMASK;
|
} else {
|
||||||
} else
|
sec = find_section_by_name(".bss");
|
||||||
bsslen += type & OUT_SIZMASK;
|
if(!sec)
|
||||||
} else if ((type & OUT_TYPMASK) == OUT_RAWDATA) {
|
error(ERR_PANIC, ".bss section is not present");
|
||||||
type &= OUT_SIZMASK;
|
sec->length += type & OUT_SIZMASK;
|
||||||
p = data;
|
}
|
||||||
if (s) {
|
|
||||||
saa_wbytes (s->contents, data, type);
|
} else if ((type & OUT_TYPMASK) == OUT_RAWDATA) {
|
||||||
s->length += type;
|
type &= OUT_SIZMASK;
|
||||||
} else
|
p = data;
|
||||||
bsslen += type;
|
if (s) {
|
||||||
} else if ((type & OUT_TYPMASK) == OUT_RESERVE) {
|
saa_wbytes (s->contents, data, type);
|
||||||
if (s) {
|
s->length += type;
|
||||||
error(ERR_WARNING, "uninitialised space declared in"
|
} else {
|
||||||
" %s section: zeroing",
|
sec = find_section_by_name(".bss");
|
||||||
(segto == textsect.index ? "code" : "data"));
|
if(!sec)
|
||||||
}
|
error(ERR_PANIC, ".bss section is not present");
|
||||||
type &= OUT_SIZMASK;
|
sec->length += type;
|
||||||
if (s) {
|
}
|
||||||
saa_wbytes (s->contents, NULL, type);
|
|
||||||
s->length += type;
|
} else if ((type & OUT_TYPMASK) == OUT_RESERVE) {
|
||||||
} else
|
if (s) {
|
||||||
bsslen += type;
|
error(ERR_WARNING, "uninitialised space declared in"
|
||||||
}
|
" %s section: zeroing", s->name);
|
||||||
else if ((type & OUT_TYPMASK) == OUT_REL2ADR ||
|
}
|
||||||
(type & OUT_TYPMASK) == OUT_REL4ADR)
|
type &= OUT_SIZMASK;
|
||||||
{
|
if (s) {
|
||||||
realbytes = ((type & OUT_TYPMASK) == OUT_REL4ADR ? 4 : 2);
|
saa_wbytes (s->contents, NULL, type);
|
||||||
if (segment != NO_SEG &&
|
s->length += type;
|
||||||
segment != textsect.index &&
|
} else {
|
||||||
segment != datasect.index &&
|
sec = find_section_by_name(".bss");
|
||||||
segment != bssindex) {
|
if(!sec)
|
||||||
if (segment % 2)
|
error(ERR_PANIC, ".bss section is not present");
|
||||||
error(ERR_NONFATAL, "binary output format does not support"
|
sec->length += type;
|
||||||
" segment base references");
|
}
|
||||||
else
|
}
|
||||||
error(ERR_NONFATAL, "binary output format does not support"
|
else if ((type & OUT_TYPMASK) == OUT_REL2ADR ||
|
||||||
" external references");
|
(type & OUT_TYPMASK) == OUT_REL4ADR)
|
||||||
segment = NO_SEG;
|
{
|
||||||
}
|
realbytes = ((type & OUT_TYPMASK) == OUT_REL4ADR ? 4 : 2);
|
||||||
if (s) {
|
|
||||||
add_reloc (s, realbytes, segment, segto);
|
if (segment != NO_SEG && !find_section_by_index(segment)) {
|
||||||
p = mydata;
|
if (segment % 2)
|
||||||
if (realbytes == 4)
|
error(ERR_NONFATAL, "binary output format does not support"
|
||||||
WRITELONG (p, *(long*)data - realbytes - s->length);
|
" segment base references");
|
||||||
else
|
else
|
||||||
WRITESHORT (p, *(long*)data - realbytes - s->length);
|
error(ERR_NONFATAL, "binary output format does not support"
|
||||||
saa_wbytes (s->contents, mydata, realbytes);
|
" external references");
|
||||||
s->length += realbytes;
|
segment = NO_SEG;
|
||||||
} else
|
}
|
||||||
bsslen += realbytes;
|
|
||||||
}
|
if (s) {
|
||||||
|
add_reloc (s, realbytes, segment, segto);
|
||||||
|
p = mydata;
|
||||||
|
if (realbytes == 4)
|
||||||
|
WRITELONG (p, *(long*)data - realbytes - s->length);
|
||||||
|
else
|
||||||
|
WRITESHORT (p, *(long*)data - realbytes - s->length);
|
||||||
|
saa_wbytes (s->contents, mydata, realbytes);
|
||||||
|
s->length += realbytes;
|
||||||
|
} else {
|
||||||
|
sec = find_section_by_name(".bss");
|
||||||
|
if(!sec)
|
||||||
|
error(ERR_PANIC, ".bss section is not present");
|
||||||
|
sec->length += realbytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_deflabel (char *name, long segment, long offset,
|
static void bin_deflabel (char *name, long segment, long offset,
|
||||||
int is_global, char *special)
|
int is_global, char *special)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) segment; /* Don't warn that this parameter is unused */
|
(void) segment; /* Don't warn that this parameter is unused */
|
||||||
(void) offset; /* Don't warn that this parameter is unused */
|
(void) offset; /* Don't warn that this parameter is unused */
|
||||||
|
|
||||||
if (special)
|
if (special)
|
||||||
error (ERR_NONFATAL, "binary format does not support any"
|
error (ERR_NONFATAL, "binary format does not support any"
|
||||||
" special symbol types");
|
" special symbol types");
|
||||||
|
|
||||||
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
|
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
|
||||||
error (ERR_NONFATAL, "unrecognised special symbol `%s'", name);
|
error (ERR_NONFATAL, "unrecognised special symbol `%s'", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_global == 2) {
|
if (is_global == 2) {
|
||||||
error (ERR_NONFATAL, "binary output format does not support common"
|
error (ERR_NONFATAL, "binary output format does not support common"
|
||||||
" variables");
|
" variables");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static long bin_secname (char *name, int pass, int *bits)
|
static long bin_secname (char *name, int pass, int *bits)
|
||||||
{
|
{
|
||||||
int sec_index;
|
int sec_index;
|
||||||
long *sec_align;
|
long *sec_align;
|
||||||
char *p;
|
char *p;
|
||||||
|
struct Section *sec;
|
||||||
|
|
||||||
(void) pass; /* Don't warn that this parameter is unused */
|
(void) pass; /* Don't warn that this parameter is unused */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default is 16 bits.
|
* Default is 16 bits .text segment
|
||||||
*/
|
*/
|
||||||
if (!name)
|
if (!name)
|
||||||
*bits = 16;
|
{
|
||||||
|
*bits = 16;
|
||||||
|
sec = find_section_by_name(".text");
|
||||||
|
if(!sec) sec = alloc_section(".text");
|
||||||
|
sec->org = 0; /* default .text org */
|
||||||
|
current_section = sec->index;
|
||||||
|
return sec->index;
|
||||||
|
}
|
||||||
|
|
||||||
if (!name)
|
p = name;
|
||||||
return textsect.index;
|
while (*p && !isspace(*p)) p++;
|
||||||
|
if (*p) *p++ = '\0';
|
||||||
p = name;
|
if (!strcmp(name, ".text")) {
|
||||||
while (*p && !isspace(*p)) p++;
|
sec = find_section_by_name(".text");
|
||||||
if (*p) *p++ = '\0';
|
if(!sec) sec = alloc_section(".text");
|
||||||
if (!strcmp(name, ".text")) {
|
sec_index = sec->index;
|
||||||
sec_index = textsect.index;
|
sec_align = NULL;
|
||||||
sec_align = NULL;
|
} else {
|
||||||
} else if (!strcmp(name, ".data")) {
|
sec = find_section_by_name(name);
|
||||||
sec_index = datasect.index;
|
if(!sec) sec = alloc_section(name);
|
||||||
sec_align = &data_align;
|
sec_index = sec->index;
|
||||||
} else if (!strcmp(name, ".bss")) {
|
sec_align = &sec->align;
|
||||||
sec_index = bssindex;
|
}
|
||||||
sec_align = &bss_align;
|
|
||||||
} else
|
|
||||||
return NO_SEG;
|
|
||||||
|
|
||||||
if (*p) {
|
if (*p) {
|
||||||
if (!nasm_strnicmp(p,"align=",6)) {
|
if (!nasm_strnicmp(p,"align=",6)) {
|
||||||
if (sec_align == NULL)
|
if (sec_align == NULL)
|
||||||
error(ERR_NONFATAL, "cannot specify an alignment to"
|
error(ERR_NONFATAL, "cannot specify an alignment to"
|
||||||
" the `.text' section");
|
" the .text section");
|
||||||
else if (p[6+strspn(p+6,"0123456789")])
|
else if (p[6+strspn(p+6,"0123456789")])
|
||||||
error(ERR_NONFATAL, "argument to `align' is not numeric");
|
error(ERR_NONFATAL, "argument to `align' is not numeric");
|
||||||
else {
|
else {
|
||||||
unsigned int align = atoi(p+6);
|
unsigned int align = atoi(p+6);
|
||||||
if (!align || ((align-1) & align))
|
if (!align || ((align-1) & align))
|
||||||
error(ERR_NONFATAL, "argument to `align' is not a"
|
error(ERR_NONFATAL, "argument to `align' is not a"
|
||||||
" power of two");
|
" power of two");
|
||||||
else
|
else
|
||||||
*sec_align = align;
|
*sec_align = align;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sec_index;
|
current_section = sec->index;
|
||||||
|
return sec_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long bin_segbase (long segment)
|
static long bin_segbase (long segment)
|
||||||
{
|
{
|
||||||
return segment;
|
return segment;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bin_directive (char *directive, char *value, int pass)
|
static int bin_directive (char *directive, char *value, int pass)
|
||||||
{
|
{
|
||||||
int rn_error;
|
struct Section *s;
|
||||||
|
int rn_error;
|
||||||
|
|
||||||
(void) pass; /* Don't warn that this parameter is unused */
|
(void) pass; /* Don't warn that this parameter is unused */
|
||||||
|
|
||||||
if (!strcmp(directive, "org")) {
|
if (!nasm_stricmp(directive, "org")) {
|
||||||
start_point = readnum (value, &rn_error);
|
if(current_section == -1)
|
||||||
if (rn_error)
|
error(ERR_PANIC, "org of cosmic space specified");
|
||||||
error (ERR_NONFATAL, "argument to ORG should be numeric");
|
|
||||||
return 1;
|
s = find_section_by_index(current_section);
|
||||||
} else
|
if(!s)
|
||||||
return 0;
|
error(ERR_PANIC, "current_section points nowhere");
|
||||||
|
|
||||||
|
s->org = readnum (value, &rn_error);
|
||||||
|
if (rn_error)
|
||||||
|
error (ERR_NONFATAL, "argument to ORG should be numeric");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_filename (char *inname, char *outname, efunc error)
|
static void bin_filename (char *inname, char *outname, efunc error)
|
||||||
{
|
{
|
||||||
standard_extension (inname, outname, "", error);
|
standard_extension (inname, outname, "", error);
|
||||||
}
|
}
|
||||||
|
@ -375,8 +569,9 @@ static int bin_set_info(enum geninfo type, char **val)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ofmt of_bin = {
|
struct ofmt of_bin = {
|
||||||
"flat-form binary files (e.g. DOS .COM, .SYS)",
|
"flat-form binary files (e.g. DOS .COM, .SYS) multisection support test",
|
||||||
"bin",
|
"bin",
|
||||||
NULL,
|
NULL,
|
||||||
null_debug_arr,
|
null_debug_arr,
|
||||||
|
|
|
@ -651,10 +651,10 @@ static void coff_symbol (char *name, long strpos, long value,
|
||||||
fputc (aux, coffp);
|
fputc (aux, coffp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void coff_write_symbols (void)
|
static void coff_write_symbols (void)
|
||||||
{
|
{
|
||||||
char filename[18];
|
char filename[18];
|
||||||
int i;
|
unsigned long i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The `.file' record, and the file name auxiliary record.
|
* The `.file' record, and the file name auxiliary record.
|
||||||
|
@ -669,7 +669,7 @@ static void coff_write_symbols (void)
|
||||||
*/
|
*/
|
||||||
memset (filename, 0, 18); /* useful zeroed buffer */
|
memset (filename, 0, 18); /* useful zeroed buffer */
|
||||||
|
|
||||||
for (i=0; i<nsects; i++) {
|
for (i = 0; i < nsects; i++) {
|
||||||
coff_symbol (sects[i]->name, 0L, 0L, i+1, 3, 1);
|
coff_symbol (sects[i]->name, 0L, 0L, i+1, 3, 1);
|
||||||
fwritelong (sects[i]->len, coffp);
|
fwritelong (sects[i]->len, coffp);
|
||||||
fwriteshort (sects[i]->nrelocs, coffp);
|
fwriteshort (sects[i]->nrelocs, coffp);
|
||||||
|
@ -685,7 +685,7 @@ static void coff_write_symbols (void)
|
||||||
* The real symbols.
|
* The real symbols.
|
||||||
*/
|
*/
|
||||||
saa_rewind (syms);
|
saa_rewind (syms);
|
||||||
for (i=0; i<nsyms; i++) {
|
for (i = 0; i < nsyms; i++) {
|
||||||
struct Symbol *sym = saa_rstruct (syms);
|
struct Symbol *sym = saa_rstruct (syms);
|
||||||
coff_symbol (sym->strpos == -1 ? sym->name : NULL,
|
coff_symbol (sym->strpos == -1 ? sym->name : NULL,
|
||||||
sym->strpos, sym->value, sym->section,
|
sym->strpos, sym->value, sym->section,
|
||||||
|
|
2
outelf.c
2
outelf.c
|
@ -105,7 +105,7 @@ extern struct ofmt of_elf;
|
||||||
#define SYM_DATA 0x01
|
#define SYM_DATA 0x01
|
||||||
#define SYM_FUNCTION 0x02
|
#define SYM_FUNCTION 0x02
|
||||||
|
|
||||||
#define GLOBAL_TEMP_BASE 6 /* bigger than any constant sym id */
|
#define GLOBAL_TEMP_BASE 15 /* bigger than any constant sym id */
|
||||||
|
|
||||||
#define SEG_ALIGN 16 /* alignment of sections in file */
|
#define SEG_ALIGN 16 /* alignment of sections in file */
|
||||||
#define SEG_ALIGN_1 (SEG_ALIGN-1)
|
#define SEG_ALIGN_1 (SEG_ALIGN-1)
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* finally... override any format specifically specifed to be off */
|
/* finally... override any format specifically specified to be off */
|
||||||
#ifdef OF_NO_BIN
|
#ifdef OF_NO_BIN
|
||||||
#undef OF_BIN
|
#undef OF_BIN
|
||||||
#endif
|
#endif
|
||||||
|
|
2
outobj.c
2
outobj.c
|
@ -977,7 +977,7 @@ static void obj_write_fixup (ObjRecord *orp, int bytes,
|
||||||
static void obj_out (long segto, void *data, unsigned long type,
|
static void obj_out (long segto, void *data, unsigned long type,
|
||||||
long segment, long wrt)
|
long segment, long wrt)
|
||||||
{
|
{
|
||||||
long size, realtype;
|
unsigned long size, realtype;
|
||||||
unsigned char *ucdata;
|
unsigned char *ucdata;
|
||||||
long ldata;
|
long ldata;
|
||||||
struct Segment *seg;
|
struct Segment *seg;
|
||||||
|
|
16
parser.c
16
parser.c
|
@ -423,7 +423,6 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
bracket = (i == '[');
|
bracket = (i == '[');
|
||||||
i = stdscan(NULL, &tokval);
|
i = stdscan(NULL, &tokval);
|
||||||
if (i == TOKEN_SPECIAL) { /* check for address size override */
|
if (i == TOKEN_SPECIAL) { /* check for address size override */
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
if (tasm_compatible_mode) {
|
if (tasm_compatible_mode) {
|
||||||
switch ((int)tokval.t_integer) {
|
switch ((int)tokval.t_integer) {
|
||||||
/* For TASM compatibility a size override inside the
|
/* For TASM compatibility a size override inside the
|
||||||
|
@ -458,7 +457,6 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
error (ERR_NONFATAL, "invalid operand size specification");
|
error (ERR_NONFATAL, "invalid operand size specification");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif
|
|
||||||
/* Standard NASM compatible syntax */
|
/* Standard NASM compatible syntax */
|
||||||
switch ((int)tokval.t_integer) {
|
switch ((int)tokval.t_integer) {
|
||||||
case S_NOSPLIT:
|
case S_NOSPLIT:
|
||||||
|
@ -480,9 +478,7 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
error (ERR_NONFATAL, "invalid size specification in"
|
error (ERR_NONFATAL, "invalid size specification in"
|
||||||
" effective address");
|
" effective address");
|
||||||
}
|
}
|
||||||
#ifdef TASM_COMPAT
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
i = stdscan(NULL, &tokval);
|
i = stdscan(NULL, &tokval);
|
||||||
}
|
}
|
||||||
} else { /* immediate operand, or register */
|
} else { /* immediate operand, or register */
|
||||||
|
@ -589,7 +585,7 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
|
|
||||||
else if (e->value != 1) /* If both want to be index */
|
else if (e->value != 1) /* If both want to be index */
|
||||||
{
|
{
|
||||||
error(ERR_NONFATAL, "invalid effective address");
|
error(ERR_NONFATAL, "beroset-p-592-invalid effective address");
|
||||||
result->opcode = -1;
|
result->opcode = -1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -600,7 +596,7 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
if (e->type != 0) { /* is there an offset? */
|
if (e->type != 0) { /* is there an offset? */
|
||||||
if (e->type <= EXPR_REG_END) /* in fact, is there an error? */
|
if (e->type <= EXPR_REG_END) /* in fact, is there an error? */
|
||||||
{
|
{
|
||||||
error (ERR_NONFATAL, "invalid effective address");
|
error (ERR_NONFATAL, "beroset-p-603-invalid effective address");
|
||||||
result->opcode = -1;
|
result->opcode = -1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -627,14 +623,14 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
* Look for a segment base type.
|
* Look for a segment base type.
|
||||||
*/
|
*/
|
||||||
if (e->type && e->type < EXPR_SEGBASE) {
|
if (e->type && e->type < EXPR_SEGBASE) {
|
||||||
error (ERR_NONFATAL, "invalid effective address");
|
error (ERR_NONFATAL, "beroset-p-630-invalid effective address");
|
||||||
result->opcode = -1;
|
result->opcode = -1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
while (e->type && e->value == 0)
|
while (e->type && e->value == 0)
|
||||||
e++;
|
e++;
|
||||||
if (e->type && e->value != 1) {
|
if (e->type && e->value != 1) {
|
||||||
error (ERR_NONFATAL, "invalid effective address");
|
error (ERR_NONFATAL, "beroset-p-637-invalid effective address");
|
||||||
result->opcode = -1;
|
result->opcode = -1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -647,7 +643,7 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
while (e->type && e->value == 0)
|
while (e->type && e->value == 0)
|
||||||
e++;
|
e++;
|
||||||
if (e->type) {
|
if (e->type) {
|
||||||
error (ERR_NONFATAL, "invalid effective address");
|
error (ERR_NONFATAL, "beroset-p-650-invalid effective address");
|
||||||
result->opcode = -1;
|
result->opcode = -1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +656,7 @@ insn *parse_line (int pass, char *buffer, insn *result,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->type != 0) { /* there'd better be nothing left! */
|
if (e->type != 0) { /* there'd better be nothing left! */
|
||||||
error (ERR_NONFATAL, "invalid effective address");
|
error (ERR_NONFATAL, "beroset-p-663-invalid effective address");
|
||||||
result->opcode = -1;
|
result->opcode = -1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,9 @@ rdflib.o: rdflib.c
|
||||||
segtab.o: segtab.c
|
segtab.o: segtab.c
|
||||||
|
|
||||||
nasmlib.o: $(top_srcdir)/nasmlib.c
|
nasmlib.o: $(top_srcdir)/nasmlib.c
|
||||||
$(CC) -c $(CFLAGS) $(top_srcdir)/nasmlib.c
|
## $(CC) -c $(CFLAGS) $(top_srcdir)/nasmlib.c
|
||||||
|
cd $(top_srcdir);make nasmlib.o
|
||||||
|
cp $(top_srcdir)/nasmlib.o $(srcdir)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o rdfdump ldrdf rdx rdflib rdf2bin rdf2com rdf2ihx
|
rm -f *.o rdfdump ldrdf rdx rdflib rdf2bin rdf2com rdf2ihx
|
||||||
|
|
12
rdoff/README
12
rdoff/README
|
@ -4,8 +4,16 @@ RDOFF Utils v0.3
|
||||||
The files contained in this directory are the C source code of a set
|
The files contained in this directory are the C source code of a set
|
||||||
of tools (and general purpose library files) for the manipulation of
|
of tools (and general purpose library files) for the manipulation of
|
||||||
RDOFF version 2 object files. Note that these programs (with the
|
RDOFF version 2 object files. Note that these programs (with the
|
||||||
exception of 'rdfdump') will NOT work with version 1 object files. Version 1
|
exception of 'rdfdump') will NOT work with version 1 object files. See
|
||||||
of RDOFF is no longer supported. You should be using v2 instead now.
|
the subdirectory v1 for programs that perform that task.
|
||||||
|
|
||||||
|
Note: If you do not have a v1 subdirectory, you may have unpacked the
|
||||||
|
ZIP file without specifying the 'restore directory structure' option -
|
||||||
|
delete these files, and run your ZIP extracter again with this option
|
||||||
|
turned on ('-d' for PKUNZIP).
|
||||||
|
|
||||||
|
RDOFF version 1 is no longer really supported, you should be using
|
||||||
|
v2 instead now.
|
||||||
|
|
||||||
There is also a 'Changes' file, which documents the differences between
|
There is also a 'Changes' file, which documents the differences between
|
||||||
RDOFF 1 and 2, and an 'rdoff2.txt' file, with complete documentation for the
|
RDOFF 1 and 2, and an 'rdoff2.txt' file, with complete documentation for the
|
||||||
|
|
728
rdoff/ldrdf1.c
728
rdoff/ldrdf1.c
|
@ -1,728 +0,0 @@
|
||||||
/* ldrdf.c RDOFF Object File linker/loader main program
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* TODO: Make the system skip a module (other than the first) if none
|
|
||||||
* of the other specified modules contain a reference to it.
|
|
||||||
* May require the system to make an extra pass of the modules to be
|
|
||||||
* loaded eliminating those that aren't required.
|
|
||||||
*
|
|
||||||
* Support all the existing documented options...
|
|
||||||
*
|
|
||||||
* Support libaries (.a files - requires a 'ranlib' type utility)
|
|
||||||
* (I think I've got this working, so I've upped the version)
|
|
||||||
*
|
|
||||||
* -s option to strip resolved symbols from exports. (Could make this an
|
|
||||||
* external utility)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "rdoff.h"
|
|
||||||
#include "nasmlib.h"
|
|
||||||
#include "symtab.h"
|
|
||||||
#include "collectn.h"
|
|
||||||
#include "rdlib.h"
|
|
||||||
|
|
||||||
#define LDRDF_VERSION "0.30"
|
|
||||||
|
|
||||||
/* global variables - those to set options: */
|
|
||||||
|
|
||||||
int verbose = 0; /* reflects setting of command line switch */
|
|
||||||
int align = 16;
|
|
||||||
int errors = 0; /* set by functions to cause halt after current
|
|
||||||
stage of processing */
|
|
||||||
|
|
||||||
/* the linked list of modules that must be loaded & linked */
|
|
||||||
|
|
||||||
struct modulenode {
|
|
||||||
rdffile f; /* the file */
|
|
||||||
long coderel; /* module's code relocation factor */
|
|
||||||
long datarel; /* module's data relocation factor */
|
|
||||||
long bssrel; /* module's bss data reloc. factor */
|
|
||||||
void * header; /* header location, if loaded */
|
|
||||||
char * name; /* filename */
|
|
||||||
struct modulenode *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define newstr(str) strcpy(malloc(strlen(str) + 1),str)
|
|
||||||
#define newstrcat(s1,s2) strcat(strcpy(malloc(strlen(s1)+strlen(s2)+1),s1),s2)
|
|
||||||
|
|
||||||
|
|
||||||
struct modulenode *modules = NULL,*lastmodule = NULL;
|
|
||||||
|
|
||||||
/* the linked list of libraries to be searched for missing imported
|
|
||||||
symbols */
|
|
||||||
|
|
||||||
struct librarynode * libraries = NULL, * lastlib = NULL;
|
|
||||||
|
|
||||||
void *symtab; /* The symbol table */
|
|
||||||
|
|
||||||
rdf_headerbuf * newheader ; /* New header to be written to output */
|
|
||||||
|
|
||||||
/* loadmodule - find the characteristics of a module and add it to the
|
|
||||||
* list of those being linked together */
|
|
||||||
|
|
||||||
void loadmodule(char *filename)
|
|
||||||
{
|
|
||||||
struct modulenode *prev;
|
|
||||||
if (! modules) {
|
|
||||||
modules = malloc(sizeof(struct modulenode));
|
|
||||||
lastmodule = modules;
|
|
||||||
prev = NULL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lastmodule->next = malloc(sizeof(struct modulenode));
|
|
||||||
prev = lastmodule;
|
|
||||||
lastmodule = lastmodule->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! lastmodule) {
|
|
||||||
fputs("ldrdf: not enough memory\n",stderr);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rdfopen(&lastmodule->f,filename)) {
|
|
||||||
rdfperror("ldrdf",filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastmodule->header = NULL; /* header hasn't been loaded */
|
|
||||||
lastmodule->name = filename;
|
|
||||||
lastmodule->next = NULL;
|
|
||||||
|
|
||||||
if (prev) {
|
|
||||||
lastmodule->coderel = prev->coderel + prev->f.code_len;
|
|
||||||
if (lastmodule->coderel % align != 0)
|
|
||||||
lastmodule->coderel += align - (lastmodule->coderel % align);
|
|
||||||
lastmodule->datarel = prev->datarel + prev->f.data_len;
|
|
||||||
if (lastmodule->datarel % align != 0)
|
|
||||||
lastmodule->datarel += align - (lastmodule->datarel % align);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lastmodule->coderel = 0;
|
|
||||||
lastmodule->datarel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
printf("%s code = %08lx (+%04lx), data = %08lx (+%04lx)\n",filename,
|
|
||||||
lastmodule->coderel,lastmodule->f.code_len,
|
|
||||||
lastmodule->datarel,lastmodule->f.data_len);
|
|
||||||
|
|
||||||
lastmodule->header = malloc(lastmodule->f.header_len);
|
|
||||||
if (!lastmodule->header) {
|
|
||||||
fprintf(stderr,"ldrdf: out of memory\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rdfloadseg(&lastmodule->f,RDOFF_HEADER,lastmodule->header))
|
|
||||||
{
|
|
||||||
rdfperror("ldrdf",filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load_library add a library to list of libraries to search
|
|
||||||
* for undefined symbols
|
|
||||||
*/
|
|
||||||
|
|
||||||
void load_library(char * name)
|
|
||||||
{
|
|
||||||
if (verbose)
|
|
||||||
printf("adding library %s to search path\n",name);
|
|
||||||
|
|
||||||
if (! lastlib) {
|
|
||||||
lastlib = libraries = malloc(sizeof(struct librarynode));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastlib->next = malloc(sizeof(struct librarynode));
|
|
||||||
lastlib = lastlib->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! lastlib) {
|
|
||||||
fprintf(stderr, "ldrdf: out of memory\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
strcpy (lastlib->name = malloc (1+strlen(name)), name);
|
|
||||||
lastlib->fp = NULL;
|
|
||||||
lastlib->referenced = 0;
|
|
||||||
lastlib->next = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* build_symbols() step through each module's header, and locate
|
|
||||||
* exported symbols, placing them in a global table
|
|
||||||
*/
|
|
||||||
|
|
||||||
long bsslength;
|
|
||||||
|
|
||||||
void mod_addsymbols(struct modulenode * mod)
|
|
||||||
{
|
|
||||||
rdfheaderrec *r;
|
|
||||||
symtabEnt e;
|
|
||||||
long cbBss;
|
|
||||||
|
|
||||||
mod->bssrel = bsslength;
|
|
||||||
cbBss = 0;
|
|
||||||
rdfheaderrewind(&mod->f);
|
|
||||||
while ((r = rdfgetheaderrec(&mod->f)))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (r->type == 5) /* Allocate BSS */
|
|
||||||
cbBss += r->b.amount;
|
|
||||||
|
|
||||||
if (r->type != 3) continue; /* ignore all but export recs */
|
|
||||||
|
|
||||||
e.segment = r->e.segment;
|
|
||||||
e.offset = r->e.offset +
|
|
||||||
(e.segment == 0 ? mod->coderel : /* 0 -> code */
|
|
||||||
e.segment == 1 ? mod->datarel : /* 1 -> data */
|
|
||||||
mod->bssrel) ; /* 2 -> bss */
|
|
||||||
|
|
||||||
e.flags = 0;
|
|
||||||
e.name = malloc(strlen(r->e.label) + 1);
|
|
||||||
if (! e.name)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"ldrdf: out of memory\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
strcpy(e.name,r->e.label);
|
|
||||||
symtabInsert(symtab,&e);
|
|
||||||
}
|
|
||||||
bsslength += cbBss;
|
|
||||||
}
|
|
||||||
|
|
||||||
void build_symbols()
|
|
||||||
{
|
|
||||||
struct modulenode *mod;
|
|
||||||
|
|
||||||
if (verbose) printf("building global symbol table:\n");
|
|
||||||
newheader = rdfnewheader();
|
|
||||||
|
|
||||||
symtab = symtabNew();
|
|
||||||
bsslength = 0; /* keep track of location of BSS symbols */
|
|
||||||
|
|
||||||
for (mod = modules; mod; mod = mod->next)
|
|
||||||
{
|
|
||||||
mod_addsymbols( mod );
|
|
||||||
}
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
symtabDump(symtab,stdout);
|
|
||||||
printf("BSS length = %ld bytes\n\n",bsslength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* scan_libraries() search through headers of modules for undefined
|
|
||||||
* symbols, and scan libraries for those symbols,
|
|
||||||
* adding library modules found to list of modules
|
|
||||||
* to load. */
|
|
||||||
|
|
||||||
void scan_libraries(void)
|
|
||||||
{
|
|
||||||
struct modulenode * mod, * nm;
|
|
||||||
struct librarynode * lib;
|
|
||||||
rdfheaderrec * r;
|
|
||||||
int found;
|
|
||||||
char * tmp;
|
|
||||||
|
|
||||||
if (verbose) printf("Scanning libraries for unresolved symbols...\n");
|
|
||||||
|
|
||||||
mod = modules;
|
|
||||||
|
|
||||||
while (mod)
|
|
||||||
{
|
|
||||||
rdfheaderrewind(&mod->f);
|
|
||||||
|
|
||||||
while ((r = rdfgetheaderrec(&mod->f)))
|
|
||||||
{
|
|
||||||
if (r->type != 2) continue; /* not an import record */
|
|
||||||
if ( symtabFind (symtab,r->i.label) )
|
|
||||||
continue; /* symbol already defined */
|
|
||||||
|
|
||||||
/* okay, we have an undefined symbol... step through
|
|
||||||
the libraries now */
|
|
||||||
if (verbose >= 2) {
|
|
||||||
printf("undefined symbol '%s'...",r->i.label);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
lib = libraries;
|
|
||||||
found = 0;
|
|
||||||
|
|
||||||
tmp = newstr(r->i.label);
|
|
||||||
while (! found && lib)
|
|
||||||
{
|
|
||||||
/* move this to an outer loop...! */
|
|
||||||
nm = malloc(sizeof(struct modulenode));
|
|
||||||
|
|
||||||
if (rdl_searchlib(lib,tmp,&nm->f))
|
|
||||||
{ /* found a module in the library */
|
|
||||||
|
|
||||||
/* create a modulenode for it */
|
|
||||||
|
|
||||||
if (! nm) {
|
|
||||||
fprintf(stderr,"ldrdf: out of memory\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
nm->name = newstrcat(lib->name,nm->f.name);
|
|
||||||
if (verbose >= 2) printf("found in '%s'\n",nm->name);
|
|
||||||
|
|
||||||
nm->coderel = lastmodule->coderel + lastmodule->f.code_len;
|
|
||||||
if (nm->coderel % align != 0)
|
|
||||||
nm->coderel += align - (nm->coderel % align);
|
|
||||||
|
|
||||||
nm->datarel = lastmodule->datarel + lastmodule->f.data_len;
|
|
||||||
if (nm->datarel % align != 0)
|
|
||||||
nm->datarel += align - (nm->datarel % align);
|
|
||||||
|
|
||||||
nm->header = malloc(nm->f.header_len);
|
|
||||||
if (! nm->header)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"ldrdf: out of memory\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rdfloadseg(&nm->f,RDOFF_HEADER,nm->header))
|
|
||||||
{
|
|
||||||
rdfperror("ldrdf",nm->name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
nm->next = NULL;
|
|
||||||
found = 1;
|
|
||||||
lastmodule->next = nm;
|
|
||||||
lastmodule = nm;
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
printf("%s code = %08lx (+%04lx), data = %08lx "
|
|
||||||
"(+%04lx)\n",lastmodule->name,
|
|
||||||
lastmodule->coderel,lastmodule->f.code_len,
|
|
||||||
lastmodule->datarel,lastmodule->f.data_len);
|
|
||||||
|
|
||||||
/* add the module's info to the symbol table */
|
|
||||||
mod_addsymbols(nm);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rdl_error) {
|
|
||||||
rdl_perror("ldrdf",lib->name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
free(nm);
|
|
||||||
}
|
|
||||||
lib = lib->next;
|
|
||||||
}
|
|
||||||
free(tmp);
|
|
||||||
if (!found && verbose >= 2) printf("not found\n");
|
|
||||||
}
|
|
||||||
mod = mod->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load_segments() allocates memory for & loads the code & data segs
|
|
||||||
* from the RDF modules
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *text,*data;
|
|
||||||
long textlength,datalength;
|
|
||||||
|
|
||||||
void load_segments(void)
|
|
||||||
{
|
|
||||||
struct modulenode *mod;
|
|
||||||
|
|
||||||
if (!modules) {
|
|
||||||
fprintf(stderr,"ldrdf: nothing to do\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (!lastmodule) {
|
|
||||||
fprintf(stderr,"ldrdf: panic: module list exists, but lastmodule=NULL\n");
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
printf("loading modules into memory\n");
|
|
||||||
|
|
||||||
/* The following stops 16 bit DOS from crashing whilst attempting to
|
|
||||||
work using segments > 64K */
|
|
||||||
if (sizeof(int) == 2) { /* expect a 'code has no effect' warning on 32 bit
|
|
||||||
platforms... */
|
|
||||||
if (lastmodule->coderel + lastmodule->f.code_len > 65535 ||
|
|
||||||
lastmodule->datarel + lastmodule->f.data_len > 65535) {
|
|
||||||
fprintf(stderr,"ldrdf: segment length has exceeded 64K; use a 32 bit "
|
|
||||||
"version.\nldrdf: code size = %05lx, data size = %05lx\n",
|
|
||||||
lastmodule->coderel + lastmodule->f.code_len,
|
|
||||||
lastmodule->datarel + lastmodule->f.data_len);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
text = malloc(textlength = lastmodule->coderel + lastmodule->f.code_len);
|
|
||||||
data = malloc(datalength = lastmodule->datarel + lastmodule->f.data_len);
|
|
||||||
|
|
||||||
if (!text || !data) {
|
|
||||||
fprintf(stderr,"ldrdf: out of memory\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
mod = modules;
|
|
||||||
while (mod) { /* load the segments for each module */
|
|
||||||
if (verbose >= 2) printf(" loading %s\n",mod->name);
|
|
||||||
if (rdfloadseg(&mod->f,RDOFF_CODE,&text[mod->coderel]) ||
|
|
||||||
rdfloadseg(&mod->f,RDOFF_DATA,&data[mod->datarel])) {
|
|
||||||
rdfperror("ldrdf",mod->name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
rdfclose(&mod->f); /* close file; segments remain */
|
|
||||||
mod = mod->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* link_segments() step through relocation records in each module's
|
|
||||||
* header, fixing up references.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void link_segments(void)
|
|
||||||
{
|
|
||||||
struct modulenode *mod;
|
|
||||||
Collection imports;
|
|
||||||
symtabEnt *s;
|
|
||||||
long rel,relto;
|
|
||||||
char *seg;
|
|
||||||
rdfheaderrec *r;
|
|
||||||
int bRelative;
|
|
||||||
|
|
||||||
if (verbose) printf("linking segments\n");
|
|
||||||
|
|
||||||
collection_init(&imports);
|
|
||||||
|
|
||||||
for (mod = modules; mod; mod = mod->next) {
|
|
||||||
if (verbose >= 2) printf("* processing %s\n",mod->name);
|
|
||||||
rdfheaderrewind(&mod->f);
|
|
||||||
while((r = rdfgetheaderrec(&mod->f))) {
|
|
||||||
if (verbose >= 3) printf("record type: %d\n",r->type);
|
|
||||||
switch(r->type) {
|
|
||||||
case 1: /* relocation record */
|
|
||||||
if (r->r.segment >= 64) { /* Relative relocation; */
|
|
||||||
bRelative = 1; /* need to find location relative */
|
|
||||||
r->r.segment -= 64; /* to start of this segment */
|
|
||||||
relto = r->r.segment == 0 ? mod->coderel : mod->datarel;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bRelative = 0; /* non-relative - need to relocate
|
|
||||||
* at load time */
|
|
||||||
relto = 0; /* placate optimiser warnings */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* calculate absolute offset of reference, not rel to beginning of
|
|
||||||
segment */
|
|
||||||
r->r.offset += r->r.segment == 0 ? mod->coderel : mod->datarel;
|
|
||||||
|
|
||||||
/* calculate the relocation factor to apply to the operand -
|
|
||||||
the base address of one of this modules segments if referred
|
|
||||||
segment is 0 - 2, or the address of an imported symbol
|
|
||||||
otherwise. */
|
|
||||||
|
|
||||||
if (r->r.refseg == 0) rel = mod->coderel;
|
|
||||||
else if (r->r.refseg == 1) rel = mod->datarel;
|
|
||||||
else if (r->r.refseg == 2) rel = mod->bssrel;
|
|
||||||
else { /* cross module link - find reference */
|
|
||||||
s = *colln(&imports,r->r.refseg - 2);
|
|
||||||
if (!s) {
|
|
||||||
fprintf(stderr,"ldrdf: link to undefined segment %04x in"
|
|
||||||
" %s:%d\n", r->r.refseg,mod->name,r->r.segment);
|
|
||||||
errors = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
rel = s->offset;
|
|
||||||
|
|
||||||
r->r.refseg = s->segment; /* change referred segment,
|
|
||||||
so that new header is
|
|
||||||
correct */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bRelative) /* Relative - subtract current segment start */
|
|
||||||
rel -= relto;
|
|
||||||
else
|
|
||||||
{ /* Add new relocation header */
|
|
||||||
rdfaddheader(newheader,r);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Work out which segment we're making changes to ... */
|
|
||||||
if (r->r.segment == 0) seg = text;
|
|
||||||
else if (r->r.segment == 1) seg = data;
|
|
||||||
else {
|
|
||||||
fprintf(stderr,"ldrdf: relocation in unknown segment %d in "
|
|
||||||
"%s\n", r->r.segment,mod->name);
|
|
||||||
errors = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the relocation factor to the datum specified: */
|
|
||||||
|
|
||||||
if (verbose >= 3)
|
|
||||||
printf(" - relocating %d:%08lx by %08lx\n",r->r.segment,
|
|
||||||
r->r.offset,rel);
|
|
||||||
|
|
||||||
/**** The following code is non-portable. Rewrite it... ****/
|
|
||||||
switch(r->r.length) {
|
|
||||||
case 1:
|
|
||||||
seg[r->r.offset] += (char) rel;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
*(int16 *)(seg + r->r.offset) += (int16) rel;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
*(long *)(seg + r->r.offset) += rel;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: /* import record */
|
|
||||||
s = symtabFind(symtab, r->i.label);
|
|
||||||
if (s == NULL) {
|
|
||||||
/* Need to add support for dynamic linkage */
|
|
||||||
fprintf(stderr,"ldrdf: undefined symbol %s in module %s\n",
|
|
||||||
r->i.label,mod->name);
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*colln(&imports,r->i.segment - 2) = s;
|
|
||||||
if (verbose >= 2)
|
|
||||||
printf("imported %s as %04x\n", r->i.label, r->i.segment);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3: /* export; dump to output new version */
|
|
||||||
s = symtabFind(symtab, r->e.label);
|
|
||||||
if (! s) {
|
|
||||||
fprintf(stderr,"ldrdf: internal error - undefined symbol %s "
|
|
||||||
"exported in header of '%s'\n",r->e.label,mod->name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
r->e.offset = s->offset;
|
|
||||||
rdfaddheader(newheader,r);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4: /* DLL record */
|
|
||||||
rdfaddheader(newheader,r); /* copy straight to output */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (rdf_errno != 0) {
|
|
||||||
rdfperror("ldrdf",mod->name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
collection_reset(&imports);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* write_output() write linked program out to a file */
|
|
||||||
|
|
||||||
void write_output(char *filename)
|
|
||||||
{
|
|
||||||
FILE * fp;
|
|
||||||
rdfheaderrec r;
|
|
||||||
|
|
||||||
if (verbose) printf("writing output to '%s'\n",filename);
|
|
||||||
|
|
||||||
fp = fopen(filename,"wb");
|
|
||||||
if (! fp)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"ldrdf: could not open '%s' for writing\n",filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* add BSS length count to header... */
|
|
||||||
if (bsslength)
|
|
||||||
{
|
|
||||||
r.type = 5;
|
|
||||||
r.b.amount = bsslength;
|
|
||||||
rdfaddheader(newheader,&r);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write header */
|
|
||||||
rdfwriteheader(fp,newheader);
|
|
||||||
rdfdoneheader(newheader);
|
|
||||||
newheader = NULL;
|
|
||||||
|
|
||||||
/* Write text */
|
|
||||||
if (fwrite(&textlength,1,4,fp) != 4
|
|
||||||
|| fwrite(text,1,textlength,fp) !=textlength)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"ldrdf: error writing %s\n",filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write data */
|
|
||||||
if (fwrite(&datalength,1,4,fp) != 4 ||
|
|
||||||
fwrite(data,1,datalength,fp) != datalength)
|
|
||||||
{
|
|
||||||
fprintf (stderr,"ldrdf: error writing %s\n", filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* main program: interpret command line, and pass parameters on to
|
|
||||||
* individual module loaders & the linker
|
|
||||||
*
|
|
||||||
* Command line format:
|
|
||||||
* ldrdf [-o outfile | -x] [-r xxxx] [-v] [--] infile [infile ...]
|
|
||||||
*
|
|
||||||
* Default action is to output a file named 'aout.rdx'. -x specifies
|
|
||||||
* that the linked object program should be executed, rather than
|
|
||||||
* written to a file. -r specifies that the object program should
|
|
||||||
* be prelocated at address 'xxxx'. This option cannot be used
|
|
||||||
* in conjunction with -x.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char *usagemsg = "usage:\n"
|
|
||||||
" ldrdf [-o outfile | -x] [-a x] [-v] [-p x] [--] infile [infile ...]\n"
|
|
||||||
" [-l<libname> ...]\n\n"
|
|
||||||
" ldrdf -h displays this message\n"
|
|
||||||
" ldrdf -r displays version information\n\n"
|
|
||||||
" -o selects output filename (default is aout.rdx)\n"
|
|
||||||
" -x causes ldrdx to link & execute rather than write to file\n"
|
|
||||||
" -a x causes object program to be statically relocated to address 'x'\n"
|
|
||||||
" -v turns on verbose mode\n"
|
|
||||||
" -p x causes segments to be aligned (padded) to x byte boundaries\n"
|
|
||||||
" (default is 16 bytes)\n"
|
|
||||||
" -l<name> causes 'name' to be linked in as a library. Note no search is\n"
|
|
||||||
" performed - the entire pathname MUST be specified.\n";
|
|
||||||
|
|
||||||
void usage(void)
|
|
||||||
{
|
|
||||||
fputs(usagemsg,stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc,char **argv)
|
|
||||||
{
|
|
||||||
char *ofilename = "aout.rdx";
|
|
||||||
long relocateaddr = -1; /* -1 if no relocation is to occur */
|
|
||||||
int execute = 0; /* 1 to execute after linking, 0 otherwise */
|
|
||||||
int procsw = 1; /* set to 0 by '--' */
|
|
||||||
int tmp;
|
|
||||||
|
|
||||||
if (argc == 1) {
|
|
||||||
usage();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* process command line switches, and add modules specified to linked list
|
|
||||||
of modules, keeping track of total memory required to load them */
|
|
||||||
|
|
||||||
while(argv++,--argc) {
|
|
||||||
if (procsw && !strcmp(*argv,"-h")) { /* Help command */
|
|
||||||
usage(); exit(1);
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"-r")) {
|
|
||||||
printf("ldrdf version %s (%s) (%s)\n",LDRDF_VERSION,_RDOFF_H,
|
|
||||||
sizeof(int) == 2 ? "16 bit" : "32 bit");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"-o")) {
|
|
||||||
ofilename = *++argv;
|
|
||||||
--argc;
|
|
||||||
if (execute) {
|
|
||||||
fprintf(stderr,"ldrdf: -o and -x switches incompatible\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (verbose > 1) printf("output filename set to '%s'\n",ofilename);
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"-x")) {
|
|
||||||
execute++;
|
|
||||||
if (verbose > 1) printf("will execute linked object\n");
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"-a")) {
|
|
||||||
relocateaddr = readnum(*++argv,&tmp);
|
|
||||||
--argc;
|
|
||||||
if (tmp) {
|
|
||||||
fprintf(stderr,"ldrdf: error in parameter to '-a' switch: '%s'\n",
|
|
||||||
*argv);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (execute) {
|
|
||||||
fprintf(stderr,"ldrdf: -a and -x switches incompatible\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (verbose) printf("will relocate to %08lx\n",relocateaddr);
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"-v")) {
|
|
||||||
verbose++;
|
|
||||||
if (verbose == 1) printf("verbose mode selected\n");
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"-p")) {
|
|
||||||
align = readnum(*++argv,&tmp);
|
|
||||||
--argc;
|
|
||||||
if (tmp) {
|
|
||||||
fprintf(stderr,"ldrdf: error in parameter to '-p' switch: '%s'\n",
|
|
||||||
*argv);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (align != 1 && align != 2 && align != 4 && align != 8 && align != 16
|
|
||||||
&& align != 32 && align != 256) {
|
|
||||||
fprintf(stderr,"ldrdf: %d is an invalid alignment factor - must be"
|
|
||||||
"1,2,4,8,16 or 256\n",align);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (verbose > 1) printf("alignment %d selected\n",align);
|
|
||||||
}
|
|
||||||
else if (procsw && !strncmp(*argv,"-l",2)) {
|
|
||||||
load_library(*argv + 2);
|
|
||||||
}
|
|
||||||
else if (procsw && !strcmp(*argv,"--")) {
|
|
||||||
procsw = 0;
|
|
||||||
}
|
|
||||||
else { /* is a filename */
|
|
||||||
if (verbose > 1) printf("processing module %s\n",*argv);
|
|
||||||
loadmodule(*argv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we should be scanning for unresolved references, and removing
|
|
||||||
unreferenced modules from the list of modules here, so that
|
|
||||||
we know about the final size once libraries have been linked in */
|
|
||||||
|
|
||||||
build_symbols(); /* build a global symbol table... */
|
|
||||||
|
|
||||||
scan_libraries(); /* check for imported symbols not in table,
|
|
||||||
and ensure the relevant library modules
|
|
||||||
are loaded */
|
|
||||||
|
|
||||||
load_segments(); /* having calculated size of reqd segments, load
|
|
||||||
each rdoff module's segments into memory */
|
|
||||||
|
|
||||||
link_segments(); /* step through each module's header, and resolve
|
|
||||||
references to the global symbol table.
|
|
||||||
This also does local address fixups. */
|
|
||||||
|
|
||||||
if (errors) {
|
|
||||||
fprintf(stderr,"ldrdf: there were errors - aborted\n");
|
|
||||||
exit(errors);
|
|
||||||
}
|
|
||||||
if (execute) {
|
|
||||||
fprintf(stderr,"ldrdf: module execution not yet supported\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (relocateaddr != -1) {
|
|
||||||
fprintf(stderr,"ldrdf: static relocation not yet supported\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
write_output(ofilename);
|
|
||||||
return 0;
|
|
||||||
}
|
|
22
standard.mac
22
standard.mac
|
@ -1,4 +1,15 @@
|
||||||
; Standard macro set for NASM 0.98 -*- nasm -*-
|
; Standard macro set for NASM 0.98 -*- 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
|
||||||
|
|
||||||
; Note that although some user-level forms of directives are defined
|
; 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
|
; here, not all of them are: the user-level form of a format-specific
|
||||||
; directive should be defined in the module for that directive.
|
; directive should be defined in the module for that directive.
|
||||||
|
@ -32,7 +43,7 @@
|
||||||
%define %$strucname %1
|
%define %$strucname %1
|
||||||
[absolute 0]
|
[absolute 0]
|
||||||
%$strucname: ; allow definition of `.member' to work sanely
|
%$strucname: ; allow definition of `.member' to work sanely
|
||||||
%endmacro
|
%endmacro
|
||||||
%imacro endstruc 0.nolist
|
%imacro endstruc 0.nolist
|
||||||
%{$strucname}_size:
|
%{$strucname}_size:
|
||||||
%pop
|
%pop
|
||||||
|
@ -97,12 +108,3 @@ __SECT__
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
|
|
||||||
; 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
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ extern struct ofmt of_ieee;
|
||||||
|
|
||||||
static void ieee_data_new(struct ieeeSection *);
|
static void ieee_data_new(struct ieeeSection *);
|
||||||
static void ieee_write_fixup (long, long, struct ieeeSection *,
|
static void ieee_write_fixup (long, long, struct ieeeSection *,
|
||||||
int, long, long);
|
int, unsigned long, long);
|
||||||
static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *);
|
static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *);
|
||||||
static long ieee_segment (char *, int, int *);
|
static long ieee_segment (char *, int, int *);
|
||||||
static void ieee_write_file(int debuginfo);
|
static void ieee_write_file(int debuginfo);
|
||||||
|
@ -369,7 +369,7 @@ static void ieee_deflabel (char *name, long segment,
|
||||||
*/
|
*/
|
||||||
static void ieee_out (long segto, void *data, unsigned long type,
|
static void ieee_out (long segto, void *data, unsigned long type,
|
||||||
long segment, long wrt) {
|
long segment, long wrt) {
|
||||||
long size, realtype;
|
unsigned long size, realtype;
|
||||||
unsigned char *ucdata;
|
unsigned char *ucdata;
|
||||||
long ldata;
|
long ldata;
|
||||||
struct ieeeSection *seg;
|
struct ieeeSection *seg;
|
||||||
|
@ -447,7 +447,7 @@ static void ieee_data_new(struct ieeeSection *segto) {
|
||||||
* If anyone wants to optimize this is a good canditate!
|
* If anyone wants to optimize this is a good canditate!
|
||||||
*/
|
*/
|
||||||
static void ieee_write_fixup (long segment, long wrt, struct ieeeSection * segto,
|
static void ieee_write_fixup (long segment, long wrt, struct ieeeSection * segto,
|
||||||
int size, long realtype, long offset) {
|
int size, unsigned long realtype, long offset) {
|
||||||
struct ieeeSection *target;
|
struct ieeeSection *target;
|
||||||
struct ieeeFixupp s;
|
struct ieeeFixupp s;
|
||||||
|
|
||||||
|
@ -1312,7 +1312,7 @@ static void dbgls_linnum (const char *lnfname, long lineno, long segto)
|
||||||
}
|
}
|
||||||
ieee_write_byte(seghead, fn->index);
|
ieee_write_byte(seghead, fn->index);
|
||||||
ieee_write_word(seghead, lineno);
|
ieee_write_word(seghead, lineno);
|
||||||
ieee_write_fixup (segto, NO_SEG, seghead, 4,OUT_ADDRESS,seg->currentpos);
|
ieee_write_fixup (segto, NO_SEG, seghead, 4, OUT_ADDRESS, seg->currentpos);
|
||||||
|
|
||||||
}
|
}
|
||||||
static void dbgls_deflabel (char *name, long segment,
|
static void dbgls_deflabel (char *name, long segment,
|
||||||
|
|
Loading…
Reference in a new issue