NASM 0.98p3.3
This commit is contained in:
parent
ce14ce6fc4
commit
b64535fd4e
8 changed files with 398 additions and 380 deletions
27
MODIFIED
27
MODIFIED
|
@ -2,22 +2,34 @@ This is a modified version of NASM, modified and released by H. Peter
|
||||||
Anvin <hpa@zytor.com>; it is not the original form released by the
|
Anvin <hpa@zytor.com>; it is not the original form released by the
|
||||||
NASM authors.
|
NASM authors.
|
||||||
|
|
||||||
|
For release 0.98p3.3:
|
||||||
|
|
||||||
For release 0.98.3.2:
|
* Patch from Conan Brink to allow nesting of %rep directives.
|
||||||
|
* If we're going to allow INT01 as an alias for INT1/ICEBP (one of
|
||||||
|
John's J4 changes), then we should allow INT03 as an alias for INT3
|
||||||
|
as well.
|
||||||
|
* Updated changes.asm to include the latest changes.
|
||||||
|
* Tried to clean up the <CR>s that had snuck in from a DOS/Windows
|
||||||
|
environment into my Unix environment, and try to make sure than
|
||||||
|
DOS/Windows users get them back.
|
||||||
|
* We would silently generate broken tools if insns.dat wasn't sorted
|
||||||
|
properly. Change insns.pl so that the order doesn't matter.
|
||||||
|
* Fix bug in insns.pl (introduced by me) which would cause conditional
|
||||||
|
instructions to have an extra "cc" in disassembly, e.g. "jnz"
|
||||||
|
disassembled as "jccnz".
|
||||||
|
|
||||||
|
|
||||||
|
For release 0.98p3.2:
|
||||||
|
|
||||||
* Merged in John S. Fine's changes from his 0.98-J4 prerelease; see
|
* Merged in John S. Fine's changes from his 0.98-J4 prerelease; see
|
||||||
http://www.csoft.net/cz/johnfine/
|
http://www.csoft.net/cz/johnfine/
|
||||||
|
|
||||||
* Changed previous "spotless" Makefile target (appropriate for distribution)
|
* Changed previous "spotless" Makefile target (appropriate for distribution)
|
||||||
to "distclean", and added "cleaner" target which is same as "clean"
|
to "distclean", and added "cleaner" target which is same as "clean"
|
||||||
except deletes files generated by Perl scripts; "spotless" is union.
|
except deletes files generated by Perl scripts; "spotless" is union.
|
||||||
|
|
||||||
* Removed BASIC programs from distribution. Get a Perl interpreter
|
* Removed BASIC programs from distribution. Get a Perl interpreter
|
||||||
instead (see below.)
|
instead (see below.)
|
||||||
|
|
||||||
* Calling this "pre-release 3.2" rather than "p3-hpa2" because of
|
* Calling this "pre-release 3.2" rather than "p3-hpa2" because of
|
||||||
John's contributions.
|
John's contributions.
|
||||||
|
|
||||||
* Actually link in the IEEE output format (zoutieee.c); fix a bunch of
|
* Actually link in the IEEE output format (zoutieee.c); fix a bunch of
|
||||||
compiler warnings in that file. Note I don't know what IEEE output
|
compiler warnings in that file. Note I don't know what IEEE output
|
||||||
is supposed to look like, so these changes were made "blind".
|
is supposed to look like, so these changes were made "blind".
|
||||||
|
@ -27,17 +39,16 @@ For release 0.98p3-hpa:
|
||||||
|
|
||||||
* Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully
|
* Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully
|
||||||
buildable version for Unix systems (Makefile.in updates, etc.)
|
buildable version for Unix systems (Makefile.in updates, etc.)
|
||||||
|
|
||||||
* Changed insns.pl to create the instruction tables in nasm.h and
|
* Changed insns.pl to create the instruction tables in nasm.h and
|
||||||
names.c, so that a new instruction can be added by adding it *only*
|
names.c, so that a new instruction can be added by adding it *only*
|
||||||
to insns.dat.
|
to insns.dat.
|
||||||
|
|
||||||
* Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE,
|
* Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE,
|
||||||
FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel
|
FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel
|
||||||
guarantee will never be used; one of them is documented as UD2 in
|
guarantee will never be used; one of them is documented as UD2 in
|
||||||
Intel documentation, the other one just as "Undefined Opcode" --
|
Intel documentation, the other one just as "Undefined Opcode" --
|
||||||
calling it UD1 seemed to make sense.)
|
calling it UD1 seemed to make sense.)
|
||||||
|
* MAX_SYMBOL was defined to be 9, but LOADALL286 and LOADALL386 are 10
|
||||||
|
characters long. Now MAX_SYMBOL is derived from insns.dat.
|
||||||
* A note on the BASIC programs included: forget them. insns.bas is
|
* A note on the BASIC programs included: forget them. insns.bas is
|
||||||
already out of date. Get yourself a Perl interpreter for your
|
already out of date. Get yourself a Perl interpreter for your
|
||||||
platform of choice at:
|
platform of choice at:
|
||||||
|
|
|
@ -91,7 +91,7 @@ clean:
|
||||||
cd rdoff; $(MAKE) clean
|
cd rdoff; $(MAKE) clean
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f config.* Makefile *~
|
rm -f config.* Makefile *~ *.bak changes.lst changes.bin
|
||||||
cd rdoff; $(MAKE) distclean
|
cd rdoff; $(MAKE) distclean
|
||||||
|
|
||||||
cleaner: clean
|
cleaner: clean
|
||||||
|
|
608
changes.asm
608
changes.asm
|
@ -1,292 +1,316 @@
|
||||||
;This file demonstrates many of the differences between NASM version X and NASM
|
;This file demonstrates many of the differences between NASM version X and NASM
|
||||||
;version 0.97
|
;version 0.97
|
||||||
;
|
;
|
||||||
; changes.asm is copyright (C) 1998 John S. Fine
|
; changes.asm is copyright (C) 1998 John S. Fine
|
||||||
;
|
;
|
||||||
; It may be redistributed under the same conditions as NASM as described in
|
; It may be redistributed under the same conditions as NASM as described in
|
||||||
; Licence file in the NASM archive
|
; Licence file in the NASM archive
|
||||||
;_________________________________
|
;_________________________________
|
||||||
;
|
;
|
||||||
; nasm changes.asm -l changes.lst
|
; nasm changes.asm -l changes.lst
|
||||||
;
|
;
|
||||||
; When assembled without any -d switches, it includes examples which:
|
; When assembled without any -d switches, it includes examples which:
|
||||||
; Work correctly in version X
|
; Work correctly in version X
|
||||||
; and Work incorrectly and/or display warnings in version 0.97
|
; and Work incorrectly and/or display warnings in version 0.97
|
||||||
; and Do not prevent the generation of output in version 0.97
|
; and Do not prevent the generation of output in version 0.97
|
||||||
;
|
;
|
||||||
; Not all the differences can be seen in the .lst file. I suggest that you use
|
; Not all the differences can be seen in the .lst file. I suggest that you use
|
||||||
; "ndisasm changes" to examine the code actually generated.
|
; "ndisasm changes" to examine the code actually generated.
|
||||||
;_________________________________
|
;_________________________________
|
||||||
;
|
;
|
||||||
; nasm changes.asm -l changes.lst -doldmsg
|
; nasm changes.asm -l changes.lst -doldmsg
|
||||||
;
|
;
|
||||||
; When assembled with -doldmsg, it adds examples which:
|
; When assembled with -doldmsg, it adds examples which:
|
||||||
; Work correctly in version X
|
; Work correctly in version X
|
||||||
; and Generate error messages in version 0.97 and do not generate output
|
; and Generate error messages in version 0.97 and do not generate output
|
||||||
;_________________________________
|
;_________________________________
|
||||||
;
|
;
|
||||||
; nasm changes.asm -l changes.lst -doldcrash
|
; nasm changes.asm -l changes.lst -doldcrash
|
||||||
;
|
;
|
||||||
; When assembled with -doldcrash, it adds examples which:
|
; When assembled with -doldcrash, it adds examples which:
|
||||||
; Work correctly in version X
|
; Work correctly in version X
|
||||||
; and Cause NASM to crash in version 0.97
|
; and Cause NASM to crash in version 0.97
|
||||||
;_________________________________
|
;_________________________________
|
||||||
;
|
;
|
||||||
; nasm changes.asm -l changes.lst -dnewmsg
|
; nasm changes.asm -l changes.lst -dnewmsg
|
||||||
;
|
;
|
||||||
; When assembled with -dnewmsg, it adds examples which:
|
; When assembled with -dnewmsg, it adds examples which:
|
||||||
; Generate error messages in version X
|
; Generate error messages in version X
|
||||||
; and Generate wrong output without warning or error message in version 0.97
|
; and Generate wrong output without warning or error message in version 0.97
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
|
|
||||||
; Please note that I have reported the name of the person who made the
|
; Please note that I have reported the name of the person who made the
|
||||||
; correction based on very limited information. In several cases, I am sure I
|
; correction based on very limited information. In several cases, I am sure I
|
||||||
; will identify the wrong author. Please send me any corrections; I don't
|
; will identify the wrong author. Please send me any corrections; I don't
|
||||||
; intend to insult or exclude anyone.
|
; intend to insult or exclude anyone.
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by Simon in assemble()
|
; Bug fixed by Simon in assemble()
|
||||||
;
|
;
|
||||||
; The following generated "call next" / "call next-1" instead of
|
; The following generated "call next" / "call next-1" instead of
|
||||||
; two copies of "call next"
|
; two copies of "call next"
|
||||||
;
|
;
|
||||||
times 2 a16 call next
|
times 2 a16 call next
|
||||||
next:
|
next:
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by John in parse_line() (and other routines)
|
; Bug fixed by John in parse_line() (and other routines)
|
||||||
;
|
;
|
||||||
; This used to jmp to prior.1, when it should be here.1
|
; This used to jmp to prior.1, when it should be here.1
|
||||||
;
|
;
|
||||||
prior:
|
prior:
|
||||||
.1:
|
.1:
|
||||||
here: jmp .1
|
here: jmp .1
|
||||||
.1:
|
.1:
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by John in assemble()
|
; Bug fixed by John in assemble()
|
||||||
;
|
;
|
||||||
; Strings used in dq and dt were not zero filled correctly
|
; Strings used in dq and dt were not zero filled correctly
|
||||||
;
|
;
|
||||||
dq 'b'
|
dq 'b'
|
||||||
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by Simon in isn_names[]
|
; Bug fixed by Simon in isn_names[]
|
||||||
;
|
;
|
||||||
; Was not recognised as an instruction
|
; Was not recognised as an instruction
|
||||||
;
|
;
|
||||||
int01
|
int01 ; Instead of INT1
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by Jim Hague in ???
|
; Bug fixed by Jim Hague in ???
|
||||||
;
|
;
|
||||||
; Forward references were instruction level rather than per operand
|
; Forward references were instruction level rather than per operand
|
||||||
;
|
;
|
||||||
shr word [forwardref],1
|
shr word [forwardref],1
|
||||||
forwardref:
|
forwardref:
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by John in preproc.c
|
; Bug fixed by John in preproc.c
|
||||||
;
|
;
|
||||||
; It used to silently discard id characters appended to a multi-line
|
; It used to silently discard id characters appended to a multi-line
|
||||||
; macro parameter (such as the x in %1x below).
|
; macro parameter (such as the x in %1x below).
|
||||||
;
|
;
|
||||||
%macro xxx 1
|
%macro xxx 1
|
||||||
%1: nop
|
%1: nop
|
||||||
%{1}x: jmp %1x
|
%{1}x: jmp %1x
|
||||||
%endmacro
|
%endmacro
|
||||||
xxx yyy
|
xxx yyy
|
||||||
|
|
||||||
%ifdef oldmsg
|
%ifdef oldmsg
|
||||||
;***************************************************************
|
;***************************************************************
|
||||||
;
|
;
|
||||||
; The following examples will generate error messages in 0.97 and will generate
|
; The following examples will generate error messages in 0.97 and will generate
|
||||||
; correct output in the new version.
|
; correct output in the new version.
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by Simon in isns.dat
|
; Bug fixed by Simon in isns.dat
|
||||||
;
|
;
|
||||||
; The optional "near" was not permitted on JMP and CALL
|
; The optional "near" was not permitted on JMP and CALL
|
||||||
;
|
;
|
||||||
jmp near here
|
jmp near here
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Feature added by Simon in stdscan()
|
; Feature added by Simon in stdscan()
|
||||||
;
|
;
|
||||||
; You can now use the numeric value of strings in %assign
|
; You can now use the numeric value of strings in %assign
|
||||||
;
|
;
|
||||||
%assign xxx 'ABCD'
|
%assign xxx 'ABCD'
|
||||||
dd xxx
|
dd xxx
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Feature added by John in add_vectors()
|
; Feature added by John in add_vectors()
|
||||||
;
|
;
|
||||||
; Stranger address expressions are now supported as long as they resolve to
|
; Stranger address expressions are now supported as long as they resolve to
|
||||||
; something valid.
|
; something valid.
|
||||||
;
|
;
|
||||||
mov ax, [eax + ebx + ecx - eax]
|
mov ax, [eax + ebx + ecx - eax]
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by Simon in ???
|
; Bug fixed by Simon in ???
|
||||||
;
|
;
|
||||||
; The EQU directive affected local labels in a way that was inconsistent
|
; The EQU directive affected local labels in a way that was inconsistent
|
||||||
; between passes
|
; between passes
|
||||||
;
|
;
|
||||||
.local:
|
.local:
|
||||||
neither equ $
|
neither equ $
|
||||||
jmp .local
|
jmp .local
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Feature added by Jules in parse_line
|
; Feature added by Jules in parse_line
|
||||||
;
|
;
|
||||||
; You can override a size specifier
|
; You can override a size specifier
|
||||||
;
|
;
|
||||||
%define arg1 dword [bp+4]
|
%define arg1 dword [bp+4]
|
||||||
cmp word arg1, 2
|
cmp word arg1, 2
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by John in preproc.c
|
; Bug fixed by John in preproc.c
|
||||||
;
|
;
|
||||||
; You could not use a label on the same line with a macro invocation, if the
|
; You could not use a label on the same line with a macro invocation, if the
|
||||||
; macro definition began with a preprocessor directive.
|
; macro definition began with a preprocessor directive.
|
||||||
;
|
;
|
||||||
struc mytype
|
struc mytype
|
||||||
.long resd 1
|
.long resd 1
|
||||||
endstruc
|
endstruc
|
||||||
|
|
||||||
lbl istruc mytype
|
lbl istruc mytype
|
||||||
at mytype.long, dd 'ABCD'
|
at mytype.long, dd 'ABCD'
|
||||||
iend
|
iend
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Warning removed by John in preproc.c
|
; Warning removed by John in preproc.c
|
||||||
;
|
;
|
||||||
; In order to allow macros that extend the definition of instructions, I
|
; In order to allow macros that extend the definition of instructions, I
|
||||||
; disabled the warning on a multi-line macro referencing itself.
|
; disabled the warning on a multi-line macro referencing itself.
|
||||||
;
|
;
|
||||||
%endif ;NASM 0.97 doesn't handle %0 etc. inside false %if
|
%endif ;NASM 0.97 doesn't handle %0 etc. inside false %if
|
||||||
%macro push 1-* ;
|
%macro push 1-* ;
|
||||||
%rep %0 ;
|
%rep %0 ;
|
||||||
push %1 ;
|
push %1 ;
|
||||||
%rotate 1 ;
|
%rotate 1 ;
|
||||||
%endrep ;
|
%endrep ;
|
||||||
%endmacro ;
|
%endmacro ;
|
||||||
%ifdef oldmsg ;
|
%ifdef oldmsg ;
|
||||||
|
|
||||||
push ax,bx
|
push ax,bx
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Warning removed by John in preproc.c
|
; Warning removed by John in preproc.c
|
||||||
;
|
;
|
||||||
; To support other types of macros that extend the definition of instructions,
|
; To support other types of macros that extend the definition of instructions,
|
||||||
; I disabled the warning on a multi-line macro called with the wrong number of
|
; I disabled the warning on a multi-line macro called with the wrong number of
|
||||||
; parameters. PUSH and POP can be extended equally well by either method, but
|
; parameters. PUSH and POP can be extended equally well by either method, but
|
||||||
; other intruction extensions may need one method or the other, so I made both
|
; other intruction extensions may need one method or the other, so I made both
|
||||||
; work.
|
; work.
|
||||||
;
|
;
|
||||||
; Note that neither of these warnings was really needed, because a later stage
|
; Note that neither of these warnings was really needed, because a later stage
|
||||||
; of NASM would almost always give an adequate error message if the macro use
|
; of NASM would almost always give an adequate error message if the macro use
|
||||||
; really was wrong.
|
; really was wrong.
|
||||||
;
|
;
|
||||||
%endif
|
%endif
|
||||||
%macro pop 2-*
|
%macro pop 2-*
|
||||||
%rep %0
|
%rep %0
|
||||||
pop %1
|
pop %1
|
||||||
%rotate 1
|
%rotate 1
|
||||||
%endrep
|
%endrep
|
||||||
%endmacro
|
%endmacro
|
||||||
%ifdef oldmsg
|
%ifdef oldmsg
|
||||||
|
|
||||||
pop ax,bx
|
pop ax,bx
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%ifdef newmsg ;***************************************************************
|
%ifdef newmsg ;***************************************************************
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by John in parse_line() (and other routines)
|
; Bug fixed by John in parse_line() (and other routines)
|
||||||
;
|
;
|
||||||
; This invalid code used to assemble without errors
|
; This invalid code used to assemble without errors
|
||||||
;
|
;
|
||||||
myself equ myself+1
|
myself equ myself+1
|
||||||
jmp myself
|
jmp myself
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Change made by John in preproc.c
|
; Change made by John in preproc.c
|
||||||
;
|
;
|
||||||
; In 0.97, an id that appears as a label on a macro invocation was always
|
; In 0.97, an id that appears as a label on a macro invocation was always
|
||||||
; prepended to the first line of the macro expansion. That caused several
|
; prepended to the first line of the macro expansion. That caused several
|
||||||
; bugs, but also could be used in tricks like the arg macro in c16.mac and
|
; bugs, but also could be used in tricks like the arg macro in c16.mac and
|
||||||
; c32.mac.
|
; c32.mac.
|
||||||
;
|
;
|
||||||
; In version X, an id that appears as a label on a macro invocation will
|
; In version X, an id that appears as a label on a macro invocation will
|
||||||
; normally be defined as a label for the address at which the macro is
|
; normally be defined as a label for the address at which the macro is
|
||||||
; invoked, regardless of whether the first line of the macro expansion is
|
; invoked, regardless of whether the first line of the macro expansion is
|
||||||
; something that can take a label. The new token %00 may be used for any
|
; something that can take a label. The new token %00 may be used for any
|
||||||
; of the situations in which the old prepend behavior was doing something
|
; of the situations in which the old prepend behavior was doing something
|
||||||
; tricky but useful. %00 can also be used more than once and in places
|
; tricky but useful. %00 can also be used more than once and in places
|
||||||
; other than the start of the expansion.
|
; other than the start of the expansion.
|
||||||
;
|
;
|
||||||
%endif
|
%endif
|
||||||
%assign arg_off 0
|
%assign arg_off 0
|
||||||
|
|
||||||
%imacro arg 0-1 2 ;arg defined the old way
|
%imacro arg 0-1 2 ;arg defined the old way
|
||||||
equ arg_off
|
equ arg_off
|
||||||
%assign arg_off %1+arg_off
|
%assign arg_off %1+arg_off
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%ifdef newmsg
|
%ifdef newmsg
|
||||||
arg_example arg
|
arg_example arg
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%imacro arg2 0-1 2 ;arg defined the new way
|
%imacro arg2 0-1 2 ;arg defined the new way
|
||||||
%00 equ arg_off
|
%00 equ arg_off
|
||||||
%assign arg_off %1+arg_off
|
%assign arg_off %1+arg_off
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%ifdef oldmsg
|
%ifdef oldmsg
|
||||||
arg_example2 arg2
|
arg_example2 arg2
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Change made by Jules and John in INSNS.DAT
|
; Change made by Jules and John in INSNS.DAT
|
||||||
;
|
;
|
||||||
; Various instruction in which the size of an immediate is built-in to the
|
; Various instruction in which the size of an immediate is built-in to the
|
||||||
; instruction set, now allow you to redundantly specify that size as long
|
; instruction set, now allow you to redundantly specify that size as long
|
||||||
; as you specify it correctly
|
; as you specify it correctly
|
||||||
;
|
;
|
||||||
AAD byte 5
|
AAD byte 5
|
||||||
AAM byte 5
|
AAM byte 5
|
||||||
BT bx, byte 3
|
BT bx, byte 3
|
||||||
BTC cx, byte 4
|
BTC cx, byte 4
|
||||||
BTR dx, byte 5
|
BTR dx, byte 5
|
||||||
BTS si, byte 6
|
BTS si, byte 6
|
||||||
IN eax, byte 0x40
|
IN eax, byte 0x40
|
||||||
INT byte 21h
|
INT byte 21h
|
||||||
OUT byte 70h, ax
|
OUT byte 70h, ax
|
||||||
RET word 2
|
RET word 2
|
||||||
RETN word 2
|
RETN word 2
|
||||||
RETF word 4
|
RETF word 4
|
||||||
|
|
||||||
; note "ENTER" has not been changed yet.
|
; note "ENTER" has not been changed yet.
|
||||||
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%ifdef oldcrash ;*************************************************************
|
%ifdef oldcrash ;*************************************************************
|
||||||
|
|
||||||
This_label_is_256_characters_long__There_used_to_be_a_bug_in_stdscan_which_made_it_crash_when_it_did_a_keyword_search_on_any_label_longer_than_255_characters__Now_anything_longer_than_MAX_KEYWORD_is_always_a_symbol__It_will_not_even_try_a_keyword_search___
|
This_label_is_256_characters_long__There_used_to_be_a_bug_in_stdscan_which_made_it_crash_when_it_did_a_keyword_search_on_any_label_longer_than_255_characters__Now_anything_longer_than_MAX_KEYWORD_is_always_a_symbol__It_will_not_even_try_a_keyword_search___
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Bug fixed by John in preproc.c
|
; Bug fixed by John in preproc.c
|
||||||
;
|
;
|
||||||
; Builds of NASM that prohibit dereferencing a NULL pointer used to crash if a
|
; Builds of NASM that prohibit dereferencing a NULL pointer used to crash if a
|
||||||
; macro that started with a blank line was invoked with a label
|
; macro that started with a blank line was invoked with a label
|
||||||
;
|
;
|
||||||
%macro empty_macro 0
|
%macro empty_macro 0
|
||||||
|
|
||||||
%endm
|
%endm
|
||||||
|
|
||||||
emlabel empty_macro
|
emlabel empty_macro
|
||||||
jmp emlabel
|
jmp emlabel
|
||||||
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
; Enhancement by hpa in insns.dat et al
|
||||||
|
;
|
||||||
|
; Simplified added new instructions, and added some missing instructions
|
||||||
|
;
|
||||||
|
int03 ; Instead of INT3
|
||||||
|
ud1 ; No documented mnemonic for this one
|
||||||
|
ud2
|
||||||
|
sysenter
|
||||||
|
sysexit
|
||||||
|
fxsave [ebx]
|
||||||
|
fxrstor [es:ebx+esi*4+0x3000]
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
; Enhancement by Conan Brink in preproc.c
|
||||||
|
;
|
||||||
|
; Allow %rep to be nested
|
||||||
|
;
|
||||||
|
%rep 4
|
||||||
|
%rep 5
|
||||||
|
nop
|
||||||
|
%endrep
|
||||||
|
%endrep
|
||||||
|
|
43
insns.dat
43
insns.dat
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
AAA void \1\x37 8086
|
AAA void \1\x37 8086
|
||||||
AAD void \2\xD5\x0A 8086
|
AAD void \2\xD5\x0A 8086
|
||||||
AAD imm \1\xD5\24 8086,SB
|
AAD imm \1\xD5\24 8086,SB
|
||||||
AAM void \2\xD4\x0A 8086
|
AAM void \2\xD4\x0A 8086
|
||||||
AAM imm \1\xD4\24 8086,SB
|
AAM imm \1\xD4\24 8086,SB
|
||||||
AAS void \1\x3F 8086
|
AAS void \1\x3F 8086
|
||||||
ADC mem,reg8 \300\1\x10\101 8086,SM
|
ADC mem,reg8 \300\1\x10\101 8086,SM
|
||||||
ADC reg8,reg8 \300\1\x10\101 8086
|
ADC reg8,reg8 \300\1\x10\101 8086
|
||||||
|
@ -102,26 +102,26 @@ BT mem,reg16 \320\300\2\x0F\xA3\101 386,SM
|
||||||
BT reg16,reg16 \320\300\2\x0F\xA3\101 386
|
BT reg16,reg16 \320\300\2\x0F\xA3\101 386
|
||||||
BT mem,reg32 \321\300\2\x0F\xA3\101 386,SM
|
BT mem,reg32 \321\300\2\x0F\xA3\101 386,SM
|
||||||
BT reg32,reg32 \321\300\2\x0F\xA3\101 386
|
BT reg32,reg32 \321\300\2\x0F\xA3\101 386
|
||||||
BT rm16,imm \320\300\2\x0F\xBA\204\25 386,SB
|
BT rm16,imm \320\300\2\x0F\xBA\204\25 386,SB
|
||||||
BT rm32,imm \321\300\2\x0F\xBA\204\25 386,SB
|
BT rm32,imm \321\300\2\x0F\xBA\204\25 386,SB
|
||||||
BTC mem,reg16 \320\300\2\x0F\xBB\101 386,SM
|
BTC mem,reg16 \320\300\2\x0F\xBB\101 386,SM
|
||||||
BTC reg16,reg16 \320\300\2\x0F\xBB\101 386
|
BTC reg16,reg16 \320\300\2\x0F\xBB\101 386
|
||||||
BTC mem,reg32 \321\300\2\x0F\xBB\101 386,SM
|
BTC mem,reg32 \321\300\2\x0F\xBB\101 386,SM
|
||||||
BTC reg32,reg32 \321\300\2\x0F\xBB\101 386
|
BTC reg32,reg32 \321\300\2\x0F\xBB\101 386
|
||||||
BTC rm16,imm \320\300\2\x0F\xBA\207\25 386,SB
|
BTC rm16,imm \320\300\2\x0F\xBA\207\25 386,SB
|
||||||
BTC rm32,imm \321\300\2\x0F\xBA\207\25 386,SB
|
BTC rm32,imm \321\300\2\x0F\xBA\207\25 386,SB
|
||||||
BTR mem,reg16 \320\300\2\x0F\xB3\101 386,SM
|
BTR mem,reg16 \320\300\2\x0F\xB3\101 386,SM
|
||||||
BTR reg16,reg16 \320\300\2\x0F\xB3\101 386
|
BTR reg16,reg16 \320\300\2\x0F\xB3\101 386
|
||||||
BTR mem,reg32 \321\300\2\x0F\xB3\101 386,SM
|
BTR mem,reg32 \321\300\2\x0F\xB3\101 386,SM
|
||||||
BTR reg32,reg32 \321\300\2\x0F\xB3\101 386
|
BTR reg32,reg32 \321\300\2\x0F\xB3\101 386
|
||||||
BTR rm16,imm \320\300\2\x0F\xBA\206\25 386,SB
|
BTR rm16,imm \320\300\2\x0F\xBA\206\25 386,SB
|
||||||
BTR rm32,imm \321\300\2\x0F\xBA\206\25 386,SB
|
BTR rm32,imm \321\300\2\x0F\xBA\206\25 386,SB
|
||||||
BTS mem,reg16 \320\300\2\x0F\xAB\101 386,SM
|
BTS mem,reg16 \320\300\2\x0F\xAB\101 386,SM
|
||||||
BTS reg16,reg16 \320\300\2\x0F\xAB\101 386
|
BTS reg16,reg16 \320\300\2\x0F\xAB\101 386
|
||||||
BTS mem,reg32 \321\300\2\x0F\xAB\101 386,SM
|
BTS mem,reg32 \321\300\2\x0F\xAB\101 386,SM
|
||||||
BTS reg32,reg32 \321\300\2\x0F\xAB\101 386
|
BTS reg32,reg32 \321\300\2\x0F\xAB\101 386
|
||||||
BTS rm16,imm \320\300\2\x0F\xBA\205\25 386,SB
|
BTS rm16,imm \320\300\2\x0F\xBA\205\25 386,SB
|
||||||
BTS rm32,imm \321\300\2\x0F\xBA\205\25 386,SB
|
BTS rm32,imm \321\300\2\x0F\xBA\205\25 386,SB
|
||||||
CALL imm \322\1\xE8\64 8086
|
CALL imm \322\1\xE8\64 8086
|
||||||
CALL imm|near \322\1\xE8\64 8086
|
CALL imm|near \322\1\xE8\64 8086
|
||||||
CALL imm|far \322\1\x9A\34\37 8086,ND
|
CALL imm|far \322\1\x9A\34\37 8086,ND
|
||||||
|
@ -397,7 +397,7 @@ IBTS mem,reg16 \320\300\2\x0F\xA7\101 386,SW,UNDOC,ND
|
||||||
IBTS reg16,reg16 \320\300\2\x0F\xA7\101 386,UNDOC,ND
|
IBTS reg16,reg16 \320\300\2\x0F\xA7\101 386,UNDOC,ND
|
||||||
IBTS mem,reg32 \321\300\2\x0F\xA7\101 386,SD,UNDOC,ND
|
IBTS mem,reg32 \321\300\2\x0F\xA7\101 386,SD,UNDOC,ND
|
||||||
IBTS reg32,reg32 \321\300\2\x0F\xA7\101 386,UNDOC,ND
|
IBTS reg32,reg32 \321\300\2\x0F\xA7\101 386,UNDOC,ND
|
||||||
ICEBP void \1\xF1 P6,ND
|
ICEBP void \1\xF1 386,ND
|
||||||
IDIV rm8 \300\1\xF6\207 8086
|
IDIV rm8 \300\1\xF6\207 8086
|
||||||
IDIV rm16 \320\300\1\xF7\207 8086
|
IDIV rm16 \320\300\1\xF7\207 8086
|
||||||
IDIV rm32 \321\300\1\xF7\207 386
|
IDIV rm32 \321\300\1\xF7\207 386
|
||||||
|
@ -420,9 +420,9 @@ IMUL reg16,imm8 \320\1\x6B\100\15 286
|
||||||
IMUL reg16,imm \320\1\x69\100\31 286,SM
|
IMUL reg16,imm \320\1\x69\100\31 286,SM
|
||||||
IMUL reg32,imm8 \321\1\x6B\100\15 386
|
IMUL reg32,imm8 \321\1\x6B\100\15 386
|
||||||
IMUL reg32,imm \321\1\x69\100\41 386,SM
|
IMUL reg32,imm \321\1\x69\100\41 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
|
||||||
IN reg_al,reg_dx \1\xEC 8086
|
IN reg_al,reg_dx \1\xEC 8086
|
||||||
IN reg_ax,reg_dx \320\1\xED 8086
|
IN reg_ax,reg_dx \320\1\xED 8086
|
||||||
IN reg_eax,reg_dx \321\1\xED 386
|
IN reg_eax,reg_dx \321\1\xED 386
|
||||||
|
@ -435,9 +435,10 @@ INCBIN ignore ignore ignore
|
||||||
INSB void \1\x6C 186
|
INSB void \1\x6C 186
|
||||||
INSD void \321\1\x6D 386
|
INSD void \321\1\x6D 386
|
||||||
INSW void \320\1\x6D 186
|
INSW void \320\1\x6D 186
|
||||||
INT imm \1\xCD\24 8086,SB
|
INT imm \1\xCD\24 8086,SB
|
||||||
INT01 void \1\xF1 P6,ND
|
INT01 void \1\xF1 386,ND
|
||||||
INT1 void \1\xF1 P6
|
INT1 void \1\xF1 386
|
||||||
|
INT03 void \1\xCC 8086,ND
|
||||||
INT3 void \1\xCC 8086
|
INT3 void \1\xCC 8086
|
||||||
INTO void \1\xCE 8086
|
INTO void \1\xCE 8086
|
||||||
INVD void \2\x0F\x08 486
|
INVD void \2\x0F\x08 486
|
||||||
|
@ -840,11 +841,11 @@ RESQ ignore ignore ignore
|
||||||
REST ignore ignore ignore
|
REST ignore ignore ignore
|
||||||
RESW ignore ignore ignore
|
RESW ignore ignore ignore
|
||||||
RET void \1\xC3 8086
|
RET void \1\xC3 8086
|
||||||
RET imm \1\xC2\30 8086,SW
|
RET imm \1\xC2\30 8086,SW
|
||||||
RETF void \1\xCB 8086
|
RETF void \1\xCB 8086
|
||||||
RETF imm \1\xCA\30 8086,SW
|
RETF imm \1\xCA\30 8086,SW
|
||||||
RETN void \1\xC3 8086
|
RETN void \1\xC3 8086
|
||||||
RETN imm \1\xC2\30 8086,SW
|
RETN imm \1\xC2\30 8086,SW
|
||||||
ROL rm8,unity \300\1\xD0\200 8086
|
ROL rm8,unity \300\1\xD0\200 8086
|
||||||
ROL rm8,reg_cl \300\1\xD2\200 8086
|
ROL rm8,reg_cl \300\1\xD2\200 8086
|
||||||
ROL rm8,imm \300\1\xC0\200\25 186,SB
|
ROL rm8,imm \300\1\xC0\200\25 186,SB
|
||||||
|
@ -1005,7 +1006,7 @@ TEST rm32,imm \321\300\1\xF7\200\41 386,SM
|
||||||
TEST mem,imm8 \300\1\xF6\200\21 8086,SM
|
TEST mem,imm8 \300\1\xF6\200\21 8086,SM
|
||||||
TEST mem,imm16 \320\300\1\xF7\200\31 8086,SM
|
TEST mem,imm16 \320\300\1\xF7\200\31 8086,SM
|
||||||
TEST mem,imm32 \321\300\1\xF7\200\41 386,SM
|
TEST mem,imm32 \321\300\1\xF7\200\41 386,SM
|
||||||
UD1 void \2\x0F\xB9 286
|
UD1 void \2\x0F\xB9 286,UNDOC
|
||||||
UD2 void \2\x0F\x0B 286
|
UD2 void \2\x0F\x0B 286
|
||||||
UMOV mem,reg8 \300\2\x0F\x10\101 386,UNDOC,SM
|
UMOV mem,reg8 \300\2\x0F\x10\101 386,UNDOC,SM
|
||||||
UMOV reg8,reg8 \300\2\x0F\x10\101 386,UNDOC
|
UMOV reg8,reg8 \300\2\x0F\x10\101 386,UNDOC
|
||||||
|
|
63
insns.pl
63
insns.pl
|
@ -13,7 +13,6 @@ $fname = "insns.dat" unless $fname = $ARGV[0];
|
||||||
open (F, $fname) || die "unable to open $fname";
|
open (F, $fname) || die "unable to open $fname";
|
||||||
|
|
||||||
$line = 0;
|
$line = 0;
|
||||||
$opcodes = 0;
|
|
||||||
$insns = 0;
|
$insns = 0;
|
||||||
while (<F>) {
|
while (<F>) {
|
||||||
$line++;
|
$line++;
|
||||||
|
@ -28,7 +27,12 @@ while (<F>) {
|
||||||
$aname = "aa_$_[0]";
|
$aname = "aa_$_[0]";
|
||||||
push @$aname, $formatted;
|
push @$aname, $formatted;
|
||||||
}
|
}
|
||||||
$opcodes[$opcodes++] = $_[0], $done{$_[0]} = 1 if !$done{$_[0]};
|
if ( $_[0] =~ /cc$/ ) {
|
||||||
|
$k_opcodes_cc{$_[0]}++;
|
||||||
|
} else {
|
||||||
|
$k_opcodes{$_[0]}++;
|
||||||
|
}
|
||||||
|
$done{$_[0]} = 1 if !$done{$_[0]};
|
||||||
if ($formatted && !$nd) {
|
if ($formatted && !$nd) {
|
||||||
push @big, $formatted;
|
push @big, $formatted;
|
||||||
foreach $i (&startbyte($_[2])) {
|
foreach $i (&startbyte($_[2])) {
|
||||||
|
@ -40,6 +44,9 @@ while (<F>) {
|
||||||
|
|
||||||
close F;
|
close F;
|
||||||
|
|
||||||
|
@opcodes = sort keys(%k_opcodes); # Unconditional instructions
|
||||||
|
@opcodes_cc = sort keys(%k_opcodes_cc); # Conditional instructions
|
||||||
|
|
||||||
print STDERR "Writing insnsa.c...\n";
|
print STDERR "Writing insnsa.c...\n";
|
||||||
|
|
||||||
open A, ">insnsa.c";
|
open A, ">insnsa.c";
|
||||||
|
@ -51,7 +58,7 @@ print A "#include \"nasm.h\"\n";
|
||||||
print A "#include \"insns.h\"\n";
|
print A "#include \"insns.h\"\n";
|
||||||
print A "\n";
|
print A "\n";
|
||||||
|
|
||||||
foreach $i (@opcodes) {
|
foreach $i (@opcodes, @opcodes_cc) {
|
||||||
print A "static struct itemplate instrux_${i}[] = {\n";
|
print A "static struct itemplate instrux_${i}[] = {\n";
|
||||||
$aname = "aa_$i";
|
$aname = "aa_$i";
|
||||||
foreach $j (@$aname) {
|
foreach $j (@$aname) {
|
||||||
|
@ -60,7 +67,7 @@ foreach $i (@opcodes) {
|
||||||
print A " {-1}\n};\n\n";
|
print A " {-1}\n};\n\n";
|
||||||
}
|
}
|
||||||
print A "struct itemplate *nasm_instructions[] = {\n";
|
print A "struct itemplate *nasm_instructions[] = {\n";
|
||||||
foreach $i (@opcodes) {
|
foreach $i (@opcodes, @opcodes_cc) {
|
||||||
print A " instrux_${i},\n";
|
print A " instrux_${i},\n";
|
||||||
}
|
}
|
||||||
print A "};\n";
|
print A "};\n";
|
||||||
|
@ -107,14 +114,14 @@ print STDERR "Writing insnsi.h...\n";
|
||||||
open I, ">insnsi.h";
|
open I, ">insnsi.h";
|
||||||
|
|
||||||
print I "/* This file is auto-generated from insns.dat by insns.pl" .
|
print I "/* This file is auto-generated from insns.dat by insns.pl" .
|
||||||
" - don't exit it */\n\n";
|
" - don't edit it */\n\n";
|
||||||
print I "/* This file in included by nasm.h */\n\n";
|
print I "/* This file in included by nasm.h */\n\n";
|
||||||
|
|
||||||
print I "/* Instruction names */\n";
|
print I "/* Instruction names */\n";
|
||||||
print I "enum {";
|
print I "enum {";
|
||||||
$first = 1;
|
$first = 1;
|
||||||
$maxlen = 0;
|
$maxlen = 0;
|
||||||
foreach $i (@opcodes) {
|
foreach $i (@opcodes, @opcodes_cc) {
|
||||||
print I "," if ( !$first );
|
print I "," if ( !$first );
|
||||||
$first = 0;
|
$first = 0;
|
||||||
print I "\n\tI_${i}";
|
print I "\n\tI_${i}";
|
||||||
|
@ -132,49 +139,39 @@ print STDERR "Writing insnsn.c...\n";
|
||||||
open N, ">insnsn.c";
|
open N, ">insnsn.c";
|
||||||
|
|
||||||
print N "/* This file is auto-generated from insns.dat by insns.pl" .
|
print N "/* This file is auto-generated from insns.dat by insns.pl" .
|
||||||
" - don't exit it */\n\n";
|
" - don't edit it */\n\n";
|
||||||
print N "/* This file in included by names.c */\n\n";
|
print N "/* This file in included by names.c */\n\n";
|
||||||
|
|
||||||
print N "static char *insn_names[] = {";
|
print N "static char *insn_names[] = {";
|
||||||
$first = 1;
|
$first = 1;
|
||||||
foreach $i (@opcodes) {
|
foreach $i (@opcodes) {
|
||||||
# Don't include conditional instructions
|
print N "," if ( !$first );
|
||||||
if ( $i !~ /cc$/ ) {
|
$first = 0;
|
||||||
print N "," if ( !$first );
|
$ilower = $i;
|
||||||
$first = 0;
|
$ilower =~ tr/A-Z/a-z/; # Change to lower case (Perl 4 compatible)
|
||||||
$ilower = $i;
|
print N "\n\t\"${ilower}\"";
|
||||||
$ilower =~ tr/A-Z/a-z/;
|
|
||||||
print N "\n\t\"${ilower}\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
print N "\n};\n\n";
|
print N "\n};\n\n";
|
||||||
print N "/* Conditional instructions */\n";
|
print N "/* Conditional instructions */\n";
|
||||||
print N "static char *icn[] = {";
|
print N "static char *icn[] = {";
|
||||||
$first = 1;
|
$first = 1;
|
||||||
foreach $i (@opcodes) {
|
foreach $i (@opcodes_cc) {
|
||||||
# Only conditional instructions
|
print N "," if ( !$first );
|
||||||
if ( $i =~ /cc$/ ) {
|
$first = 0;
|
||||||
$ins = $`; # Skip cc suffix
|
$ilower = $i;
|
||||||
print N "," if ( !$first );
|
$ilower =~ s/cc$//; # Skip cc suffix
|
||||||
$first = 0;
|
$ilower =~ tr/A-Z/a-z/; # Change to lower case (Perl 4 compatible)
|
||||||
$ilower = $i;
|
print N "\n\t\"${ilower}\"";
|
||||||
$ilower =~ tr/A-Z/a-z/;
|
|
||||||
print N "\n\t\"${ilower}\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print N "\n};\n\n";
|
print N "\n};\n\n";
|
||||||
print N "/* and the corresponding opcodes */\n";
|
print N "/* and the corresponding opcodes */\n";
|
||||||
print N "static int ico[] = {";
|
print N "static int ico[] = {";
|
||||||
$first = 1;
|
$first = 1;
|
||||||
foreach $i (@opcodes) {
|
foreach $i (@opcodes_cc) {
|
||||||
# Only conditional instructions
|
print N "," if ( !$first );
|
||||||
if ( $i =~ /cc$/ ) {
|
$first = 0;
|
||||||
$ins = $`; # Skip cc suffix
|
print N "\n\tI_$i";
|
||||||
print N "," if ( !$first );
|
|
||||||
$first = 0;
|
|
||||||
print N "\n\tI_$i";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print N "\n};\n";
|
print N "\n};\n";
|
||||||
|
|
2
nasm.h
2
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 pre-release 3.2"
|
#define NASM_VER "0.98 pre-release 3.3"
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
|
31
preproc.c
31
preproc.c
|
@ -75,6 +75,7 @@ struct MMacro {
|
||||||
Line *expansion;
|
Line *expansion;
|
||||||
|
|
||||||
MMacro *next_active;
|
MMacro *next_active;
|
||||||
|
MMacro *rep_nest; /* used for nesting %rep */
|
||||||
Token **params; /* actual parameters */
|
Token **params; /* actual parameters */
|
||||||
Token *iline; /* invocation line */
|
Token *iline; /* invocation line */
|
||||||
int nparam, rotate, *paramlen;
|
int nparam, rotate, *paramlen;
|
||||||
|
@ -1156,6 +1157,7 @@ static int do_directive (Token *tline)
|
||||||
Line *l;
|
Line *l;
|
||||||
struct tokenval tokval;
|
struct tokenval tokval;
|
||||||
expr *evalresult;
|
expr *evalresult;
|
||||||
|
MMacro *tmp_defining; /* Used when manipulating rep_nest */
|
||||||
|
|
||||||
origline = tline;
|
origline = tline;
|
||||||
|
|
||||||
|
@ -1472,6 +1474,7 @@ static int do_directive (Token *tline)
|
||||||
defining->plus = FALSE;
|
defining->plus = FALSE;
|
||||||
defining->nolist = FALSE;
|
defining->nolist = FALSE;
|
||||||
defining->in_progress = FALSE;
|
defining->in_progress = FALSE;
|
||||||
|
defining->rep_nest = NULL;
|
||||||
tline = tline->next;
|
tline = tline->next;
|
||||||
skip_white_(tline);
|
skip_white_(tline);
|
||||||
if (!tok_type_(tline, TOK_NUMBER)) {
|
if (!tok_type_(tline, TOK_NUMBER)) {
|
||||||
|
@ -1590,24 +1593,6 @@ static int do_directive (Token *tline)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PP_REP:
|
case PP_REP:
|
||||||
if (defining) {
|
|
||||||
/*
|
|
||||||
* We don't allow nested %reps, because of a strange bug
|
|
||||||
* that was causing a panic. The cause of the bug appears to be
|
|
||||||
* that the nested %rep isn't taken into account when matching
|
|
||||||
* against the %endreps, so some mechanism to count the
|
|
||||||
* %reps in and the %endreps out may well work here.
|
|
||||||
*
|
|
||||||
* That's for experimentation with later, though.
|
|
||||||
* For informations sake, the panic produced by
|
|
||||||
* nesting %reps was:
|
|
||||||
*
|
|
||||||
* istk->mstk has no name but defining is set at end
|
|
||||||
* of expansion
|
|
||||||
*/
|
|
||||||
error(ERR_NONFATAL, "nested `%%rep' invocation not allowed");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nolist = FALSE;
|
nolist = FALSE;
|
||||||
tline = tline->next;
|
tline = tline->next;
|
||||||
if (tline->next && tline->next->type == TOK_WHITESPACE)
|
if (tline->next && tline->next->type == TOK_WHITESPACE)
|
||||||
|
@ -1635,6 +1620,7 @@ static int do_directive (Token *tline)
|
||||||
"non-constant value given to `%%rep'");
|
"non-constant value given to `%%rep'");
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
tmp_defining = defining;
|
||||||
defining = nasm_malloc(sizeof(MMacro));
|
defining = nasm_malloc(sizeof(MMacro));
|
||||||
defining->name = NULL; /* flags this macro as a %rep block */
|
defining->name = NULL; /* flags this macro as a %rep block */
|
||||||
defining->casesense = 0;
|
defining->casesense = 0;
|
||||||
|
@ -1646,6 +1632,7 @@ static int do_directive (Token *tline)
|
||||||
defining->dlist = NULL;
|
defining->dlist = NULL;
|
||||||
defining->expansion = NULL;
|
defining->expansion = NULL;
|
||||||
defining->next_active = istk->mstk;
|
defining->next_active = istk->mstk;
|
||||||
|
defining->rep_nest = tmp_defining;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PP_ENDREP:
|
case PP_ENDREP:
|
||||||
|
@ -1675,7 +1662,8 @@ static int do_directive (Token *tline)
|
||||||
istk->mstk = defining;
|
istk->mstk = defining;
|
||||||
|
|
||||||
list->uplevel (defining->nolist ? LIST_MACRO_NOLIST : LIST_MACRO);
|
list->uplevel (defining->nolist ? LIST_MACRO_NOLIST : LIST_MACRO);
|
||||||
defining = NULL;
|
tmp_defining = defining;
|
||||||
|
defining = defining->rep_nest;
|
||||||
free_tlist (origline);
|
free_tlist (origline);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -2796,10 +2784,7 @@ static char *pp_getline (void)
|
||||||
if (defining->name)
|
if (defining->name)
|
||||||
error (ERR_PANIC,
|
error (ERR_PANIC,
|
||||||
"defining with name in expansion");
|
"defining with name in expansion");
|
||||||
else if (!istk->mstk->name)
|
else if (istk->mstk->name)
|
||||||
error (ERR_PANIC, "istk->mstk has no name but"
|
|
||||||
" defining is set at end of expansion");
|
|
||||||
else
|
|
||||||
error (ERR_FATAL, "`%%rep' without `%%endrep' within"
|
error (ERR_FATAL, "`%%rep' without `%%endrep' within"
|
||||||
" expansion of macro `%s'", istk->mstk->name);
|
" expansion of macro `%s'", istk->mstk->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ clean:
|
||||||
rm -f *.o rdfdump ldrdf rdx rdflib rdf2bin rdf2com
|
rm -f *.o rdfdump ldrdf rdx rdflib rdf2bin rdf2com
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile
|
rm -f Makefile *~ *.bak
|
||||||
|
|
||||||
cleaner: clean
|
cleaner: clean
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue