platform/upstream/nasm.git
13 years agopreproc.c: free tokens when ignoring expansion definition lines
Keith Kanios [Sat, 18 Dec 2010 17:05:46 +0000 (11:05 -0600)]
preproc.c: free tokens when ignoring expansion definition lines

13 years agopreproc.c: placate tokenize() warnings during expansion definition
Keith Kanios [Sat, 18 Dec 2010 16:54:39 +0000 (10:54 -0600)]
preproc.c: placate tokenize() warnings during expansion definition

13 years agoNASM 2.10rc3
H. Peter Anvin [Sat, 18 Dec 2010 01:55:22 +0000 (17:55 -0800)]
NASM 2.10rc3

13 years agoinsns.pl: Fix up merge conflict for sure
Cyrill Gorcunov [Tue, 23 Nov 2010 17:21:45 +0000 (20:21 +0300)]
insns.pl: Fix up merge conflict for sure

Now it should be fixed in real (one code snipped
escaped me during merge conflict resolving).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoMerge branch 'insns'
Cyrill Gorcunov [Tue, 23 Nov 2010 16:26:24 +0000 (19:26 +0300)]
Merge branch 'insns'

Conflicts:
insns.pl

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoinsns: Fixup MOV[APS|UPS] for xmmrm cases
Cyrill Gorcunov [Tue, 23 Nov 2010 12:57:19 +0000 (15:57 +0300)]
insns: Fixup MOV[APS|UPS] for xmmrm cases

In fact it was written as

MOVAPS xmmreg,xmmreg \360\2\x0F\x28\110 KATMAI,SSE
MOVAPS xmmreg,xmmreg \360\2\x0F\x29\101 KATMAI,SSE

in first place

MOVUPS xmmreg,xmmreg \360\2\x0F\x10\110 KATMAI,SSE
MOVUPS xmmreg,xmmreg \360\2\x0F\x11\101 KATMAI,SSE

and for example x28 stands for xmmrm128,xmmreg and
x1 for xmmrm128,xmmreg.

TODO: Inspect and fix WILLAMETTE instructions.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoinsns: Implement size bits on KATMAI
Cyrill Gorcunov [Sat, 20 Nov 2010 18:43:34 +0000 (21:43 +0300)]
insns: Implement size bits on KATMAI

Perhaps not all of them are coevered yet, but mostly.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoinsns.pl: Clear tabs/space mess
Cyrill Gorcunov [Sat, 20 Nov 2010 22:04:46 +0000 (01:04 +0300)]
insns.pl: Clear tabs/space mess

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agomake: Lift up openwcom.mak for build on FreeDOS
Anthony Williams [Sat, 30 Oct 2010 16:07:50 +0000 (20:07 +0400)]
make: Lift up openwcom.mak for build on FreeDOS

Signed-off-by: Anthony Williams <rugxulo@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoMerge branch 'nasm-2.09.xx'
Cyrill Gorcunov [Sun, 21 Nov 2010 16:56:21 +0000 (19:56 +0300)]
Merge branch 'nasm-2.09.xx'

Conflicts:
version

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoNASM 2.09.04
Cyrill Gorcunov [Sun, 21 Nov 2010 16:53:07 +0000 (19:53 +0300)]
NASM 2.09.04

Some important fixes:

 - Fix incorrect labels offset for VEX intructions
 - Eliminate bogus warning on implicit operand size override.
 - %if term could not handle 64 bit numbers.
 - The COFF backend was limiting relocations number to 16 bits even if
   in real there were a way more relocations.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoChanges for 2.09.04
Cyrill Gorcunov [Sun, 21 Nov 2010 16:51:49 +0000 (19:51 +0300)]
Changes for 2.09.04

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoBR3104852: only warn once for repeated prefixes
Victor van den Elzen [Sun, 7 Nov 2010 22:47:13 +0000 (23:47 +0100)]
BR3104852: only warn once for repeated prefixes

13 years agoBR3058845: mostly fix bogus warning with implicit operand size override
Victor van den Elzen [Sun, 7 Nov 2010 18:56:14 +0000 (19:56 +0100)]
BR3058845: mostly fix bogus warning with implicit operand size override

The implicit operand size override code didn't set the operand size
prefix, which confused the size calculation code for the range check.

The BITS 64 operand size calculation is still off, but "fixing" it by
making it 32-bit unless REX.W is set breaks PUSH and maybe others.

13 years agomisc: Enhance tag-release
Cyrill Gorcunov [Sun, 21 Nov 2010 16:19:29 +0000 (19:19 +0300)]
misc: Enhance tag-release

It remains backward compatible

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoeval: rexp3 should operate with 64bit numbers
Cyrill Gorcunov [Sat, 6 Nov 2010 20:04:12 +0000 (23:04 +0300)]
eval: rexp3 should operate with 64bit numbers

reloc_value returns 64bit numbers but we strip it down
to 'int' which causes problems if the former value is
big enough to overflow 'int'. Fix it.

[ BR3104312 ]

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
13 years agoFix autoconf 2.68 warning.
Victor van den Elzen [Sun, 7 Nov 2010 16:31:27 +0000 (17:31 +0100)]
Fix autoconf 2.68 warning.

The first argument of AC_COMPILE_IFELSE needs to be wrapped with
AC_LANG_SOURCE.

13 years agocoff: Handle massive relocations
Cyrill Gorcunov [Sat, 20 Nov 2010 11:18:23 +0000 (14:18 +0300)]
coff: Handle massive relocations

The backport of

4db724fdd76e3a6cd0f5124ef86de976c495d666
359b63f8976375f071edc33092daea57efa768fb
01102ee8e6a967830bcd6f0134efe8976f473121
2672af737954fb17ec0ebf17e787219a504c4400

so coff output target to be able to handle
massive relocations.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branch 'nasm-2.09.xx'
H. Peter Anvin [Tue, 16 Nov 2010 17:40:03 +0000 (09:40 -0800)]
Merge branch 'nasm-2.09.xx'

14 years agoBR 3109604: Fix C4 vs C5 VEX form selection in calcsize()
H. Peter Anvin [Tue, 16 Nov 2010 17:36:58 +0000 (09:36 -0800)]
BR 3109604: Fix C4 vs C5 VEX form selection in calcsize()

calcsize() had the wrong criterion for when C5 prefixes are permitted
(REX.R is permitted, REX.X is forbidden.)  assemble() had the right
test already.  This caused symbol value errors.

14 years agopreproc.c: fix handling of %? and %??
Keith Kanios [Sat, 13 Nov 2010 15:34:34 +0000 (09:34 -0600)]
preproc.c: fix handling of %? and %??

14 years agoMerge branch 'cleanup'
Cyrill Gorcunov [Thu, 11 Nov 2010 20:09:22 +0000 (23:09 +0300)]
Merge branch 'cleanup'

14 years agoRevert 29cb0bb1b39f4e3c9e013993457e85fce14f5142
Cyrill Gorcunov [Thu, 11 Nov 2010 20:08:14 +0000 (23:08 +0300)]
Revert 29cb0bb1b39f4e3c9e013993457e85fce14f5142

Redundant call on nonsmart compilers doesn't
worth it in compare with two assignment operations.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Add dump_token helper
Cyrill Gorcunov [Thu, 11 Nov 2010 12:06:12 +0000 (15:06 +0300)]
preproc: Add dump_token helper

While being debugging some nifty problem I found
that it might be useful to produce a full dump of
tokens, in particular text of tokens.

For this reason dump_token is here just to not loose
it. It doesn't affect normal build procedure since it
requires a special -DNASM_TRACE to be passed to the
compiler. Which of course we don't in a regular
compilations.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Use nasm_zalloc more
Cyrill Gorcunov [Thu, 11 Nov 2010 10:44:51 +0000 (13:44 +0300)]
preproc: Use nasm_zalloc more

To eliminate possible access into heap data

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Use memset for stack allocated structure
Cyrill Gorcunov [Thu, 11 Nov 2010 08:42:40 +0000 (11:42 +0300)]
preproc: Use memset for stack allocated structure

To be on safe side

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: inc_fopen -- set sl->next early
Cyrill Gorcunov [Thu, 11 Nov 2010 08:32:16 +0000 (11:32 +0300)]
preproc: inc_fopen -- set sl->next early

It's safer to init it early and be sure we not
miss anything after.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Use nasm_zalloc for new_ExpDef, new_ExpInv
Cyrill Gorcunov [Thu, 11 Nov 2010 08:29:40 +0000 (11:29 +0300)]
preproc: Use nasm_zalloc for new_ExpDef, new_ExpInv

Srink the code and make it a bit faster.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Use nasm_zalloc in new_Line
Cyrill Gorcunov [Thu, 11 Nov 2010 08:19:43 +0000 (11:19 +0300)]
preproc: Use nasm_zalloc in new_Line

It's shorter

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoautoconf: Add --with-ccache option
Cyrill Gorcunov [Thu, 11 Nov 2010 08:18:44 +0000 (11:18 +0300)]
autoconf: Add --with-ccache option

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Get rid of tab/space mess
Cyrill Gorcunov [Thu, 11 Nov 2010 07:14:45 +0000 (10:14 +0300)]
preproc.c: Get rid of tab/space mess

No change on binary level

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: do_directive: Allocate 'Include' from zeroified-memory
Cyrill Gorcunov [Wed, 10 Nov 2010 20:12:06 +0000 (23:12 +0300)]
preproc: do_directive: Allocate 'Include' from zeroified-memory

If not all members of structure being allocated from
heap get initialized we better to use nasm_zalloc instead
of nasm_malloc.

For example inc gets allocated in do_directive being parially
initialized and we erroniously get mmac_depth set to some
crappy value leading to SIGSEV in result.

[ http://forum.nasm.us/index.php?topic=921.msg3257#msg3257 ]

nb: I've cleaned verror from tab/space mess while were at it

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: use nasm_strdup() rather than naked strdup()
H. Peter Anvin [Mon, 8 Nov 2010 16:36:36 +0000 (08:36 -0800)]
preproc.c: use nasm_strdup() rather than naked strdup()

14 years agopreproc.c: placate errors in OpenWatcom Compiler
Keith Kanios [Mon, 8 Nov 2010 06:58:02 +0000 (00:58 -0600)]
preproc.c: placate errors in OpenWatcom Compiler

14 years agoBR3104852: only warn once for repeated prefixes
Victor van den Elzen [Sun, 7 Nov 2010 22:47:13 +0000 (23:47 +0100)]
BR3104852: only warn once for repeated prefixes

14 years agoBR3058845: mostly fix bogus warning with implicit operand size override
Victor van den Elzen [Sun, 7 Nov 2010 18:56:14 +0000 (19:56 +0100)]
BR3058845: mostly fix bogus warning with implicit operand size override

The implicit operand size override code didn't set the operand size
prefix, which confused the size calculation code for the range check.

The BITS 64 operand size calculation is still off, but "fixing" it by
making it 32-bit unless REX.W is set breaks PUSH and maybe others.

14 years agopreproc.c: Fix OpenWatcom compiler error
Keith Kanios [Sun, 7 Nov 2010 22:21:00 +0000 (16:21 -0600)]
preproc.c: Fix OpenWatcom compiler error

14 years agopreproc.c: Fix OpenWatcom compiler error
Cyrill Gorcunov [Sun, 7 Nov 2010 21:47:10 +0000 (00:47 +0300)]
preproc.c: Fix OpenWatcom compiler error

It doesn't like when we mess scope of variables
declaration.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoFix autoconf 2.68 warning.
Victor van den Elzen [Sun, 7 Nov 2010 16:31:27 +0000 (17:31 +0100)]
Fix autoconf 2.68 warning.

The first argument of AC_COMPILE_IFELSE needs to be wrapped with
AC_LANG_SOURCE.

14 years agoFix Perl deprecation warnings.
Victor van den Elzen [Sun, 7 Nov 2010 16:20:23 +0000 (17:20 +0100)]
Fix Perl deprecation warnings.

Use of defined on aggregates (hashes and arrays) is deprecated.
You should instead use a simple test for size.

14 years agoNASM 2.10rc2
Keith Kanios [Sat, 6 Nov 2010 23:09:15 +0000 (18:09 -0500)]
NASM 2.10rc2

14 years agoversion: reverting back to 2.10rc1
Keith Kanios [Sat, 6 Nov 2010 23:08:32 +0000 (18:08 -0500)]
version: reverting back to 2.10rc1

14 years agopreproc.c: merge from preproc-rewrite branch
Keith Kanios [Sat, 6 Nov 2010 22:41:51 +0000 (17:41 -0500)]
preproc.c: merge from preproc-rewrite branch
pptok.dat: merge from preproc-rewrite branch
macros.pl: merge from preproc-rewrite branch
version: changed to 2.10rc2

14 years agocoff: Cover 'else' with cond compilation
Cyrill Gorcunov [Sat, 6 Nov 2010 22:09:36 +0000 (01:09 +0300)]
coff: Cover 'else' with cond compilation

It was a nit in first place.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agotest: Add br3104312.asm test
Cyrill Gorcunov [Sat, 6 Nov 2010 20:09:47 +0000 (23:09 +0300)]
test: Add br3104312.asm test

Not automated yet

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoeval: rexp3 should operate with 64bit numbers
Cyrill Gorcunov [Sat, 6 Nov 2010 20:04:12 +0000 (23:04 +0300)]
eval: rexp3 should operate with 64bit numbers

reloc_value returns 64bit numbers but we strip it down
to 'int' which causes problems if the former value is
big enough to overflow 'int'. Fix it.

[ BR3104312 ]

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branch 'owc'
Cyrill Gorcunov [Sat, 6 Nov 2010 15:50:10 +0000 (18:50 +0300)]
Merge branch 'owc'

14 years agotest: Add br3092924.asm
Cyrill Gorcunov [Sat, 6 Nov 2010 15:44:48 +0000 (18:44 +0300)]
test: Add br3092924.asm

coff massive relocations test

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Handle massive relocations
Cyrill Gorcunov [Sat, 6 Nov 2010 15:38:00 +0000 (18:38 +0300)]
coff: Handle massive relocations

 In case if relocations number exceed 16bit values
we have to hande such case by a special way, as described
in COFF specification.

 "IMAGE_SCN_LNK_NRELOC_OVFL indicates that the count of
relocations for the section exceeds the 16 bits that are
reserved for it in the section header. If the bit is set
and the NumberOfRelocations field in the section header
is 0xffff, the actual relocation count is stored in the
32-bit VirtualAddress field of the first relocation. It
is an error if IMAGE_SCN_LNK_NRELOC_OVFL is set and
there are fewer than 0xffff relocations in the section."

[ BR3092924 ]

Reported-by: Robert Yates
Investigated-by: nasm64developer
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Issue fatal signal on relocations more then 0xffff
Cyrill Gorcunov [Fri, 5 Nov 2010 23:45:45 +0000 (02:45 +0300)]
coff: Issue fatal signal on relocations more then 0xffff

Actually it's temporary action. We have to support more
relocations then that but it requires some more code rework.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agomake: Add tags and TAGS targets
Cyrill Gorcunov [Fri, 5 Nov 2010 11:18:51 +0000 (14:18 +0300)]
make: Add tags and TAGS targets

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Add IMAGE_SCN_MAX_RELOC constant
Cyrill Gorcunov [Fri, 5 Nov 2010 10:50:04 +0000 (13:50 +0300)]
coff: Add IMAGE_SCN_MAX_RELOC constant

We will need it to analyze if section relocations
are overflowed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agomake: Lift up openwcom.mak for build on FreeDOS
Anthony Williams [Sat, 30 Oct 2010 16:07:50 +0000 (20:07 +0400)]
make: Lift up openwcom.mak for build on FreeDOS

Signed-off-by: Anthony Williams <rugxulo@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agomake: Add "test" target into .PHONY
Cyrill Gorcunov [Thu, 28 Oct 2010 19:55:16 +0000 (23:55 +0400)]
make: Add "test" target into .PHONY

Michael proposed to run

 | sed -i -e '/^.PHONY: all/s/$/ test/' Makefile.in

since we have test/ directory. Good idea.

Reported-by: Michael Sterrett
Patch-by: Michael Sterrett
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branch 'nasm-2.09.xx'
Cyrill Gorcunov [Wed, 27 Oct 2010 18:42:12 +0000 (22:42 +0400)]
Merge branch 'nasm-2.09.xx'

Conflicts:
version

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNASM 2.09.03
Cyrill Gorcunov [Wed, 27 Oct 2010 17:52:40 +0000 (21:52 +0400)]
NASM 2.09.03

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc: Update changes for 2.09.03
Cyrill Gorcunov [Wed, 27 Oct 2010 17:50:20 +0000 (21:50 +0400)]
doc: Update changes for 2.09.03

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Restore concat rules on context local variables
Cyrill Gorcunov [Wed, 27 Oct 2010 17:43:03 +0000 (21:43 +0400)]
preproc.c: Restore concat rules on context local variables

This is a backport of commits

8dcbbd7af0d6d07b455de0b6460dca6db6113553
575d4289c9b1fb47774cb79764a24899a69a8d52

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Issue warning on unterminated %{ construct
Cyrill Gorcunov [Thu, 7 Oct 2010 15:30:54 +0000 (19:30 +0400)]
preproc: Issue warning on unterminated %{ construct

As being pointed by "matching braces" topic on
[ http://forum.nasm.us/index.php?topic=905.0 ]
we don't issue warning on missed match for "{"
brace opened.

Strictly speaking we should issue error instead and
force user to fix asm source code but since it's
here for a long time already -- lets be "admissive".

Reported-by: Klod
CC: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3079777: Explain %00 in documentation
Frank Kotler [Tue, 5 Oct 2010 14:37:57 +0000 (18:37 +0400)]
BR3079777: Explain %00 in documentation

Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3079550: NASM crash on run-time for OMF output format
Cyrill Gorcunov [Fri, 1 Oct 2010 21:21:00 +0000 (01:21 +0400)]
BR3079550: NASM crash on run-time for OMF output format

We could have accessed malloc'ed data on external symbols
in obj and ieee output formats. Fix it by using nasm_zalloc.

Reported-by: Jiri Malak
Patch-by: Jiri Malak
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3074517: Print %macro name inside %rep blocks
Cyrill Gorcunov [Fri, 24 Sep 2010 11:24:42 +0000 (15:24 +0400)]
BR3074517: Print %macro name inside %rep blocks

If we're to print inside %rep block we should find
out which %macro it belongs.

Reported-by: Rob Neff
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: Issue warning on unterminated %{ construct
Cyrill Gorcunov [Thu, 7 Oct 2010 15:30:54 +0000 (19:30 +0400)]
preproc: Issue warning on unterminated %{ construct

As being pointed by "matching braces" topic on
[ http://forum.nasm.us/index.php?topic=905.0 ]
we don't issue warning on missed match for "{"
brace opened.

Strictly speaking we should issue error instead and
force user to fix asm source code but since it's
here for a long time already -- lets be "admissive".

Reported-by: Klod
CC: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branch 'nasm-2.09.xx'
H. Peter Anvin [Wed, 6 Oct 2010 23:28:43 +0000 (16:28 -0700)]
Merge branch 'nasm-2.09.xx'

14 years agodoc: fix spelling of "compatibility"
H. Peter Anvin [Wed, 6 Oct 2010 23:28:07 +0000 (16:28 -0700)]
doc: fix spelling of "compatibility"

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agopreproc.c: Support multiple matches in paste_tokens
Cyrill Gorcunov [Tue, 5 Oct 2010 20:25:55 +0000 (00:25 +0400)]
preproc.c: Support multiple matches in paste_tokens

In mmacro params head TOK_NUM should be concat'ed with
tail TOK_NUM only, otherwise the weird construction like

    %define id1      1
    %define idid1    2
    %define TOK_NUM  1
    %define TOK_ID  id

    %macro m 2
        mov eax, 1%1id%2 ; this expands to 1idid1
                         ; where idid1 expands to 2
                         ; and then to 12
    %endmacro

    m TOK_ID, TOK_NUM

issue error.

N.B. I've checked nasm-0.98.39 and it compiles this macro
perfectly well, for the record.

Reported-by: nasm64developer@users.sf.net
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3079777: Explain %00 in documentation
Frank Kotler [Tue, 5 Oct 2010 14:37:57 +0000 (18:37 +0400)]
BR3079777: Explain %00 in documentation

Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoAdd SubmittingPatches file
Cyrill Gorcunov [Sun, 3 Oct 2010 17:02:08 +0000 (21:02 +0400)]
Add SubmittingPatches file

Adopted from Linux's Documentation/SubmittingPatches

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3079550: NASM crash on run-time for OMF output format
Cyrill Gorcunov [Fri, 1 Oct 2010 21:21:00 +0000 (01:21 +0400)]
BR3079550: NASM crash on run-time for OMF output format

We could have accessed malloc'ed data on external symbols
in obj and ieee output formats. Fix it by using nasm_zalloc.

Reported-by: Jiri Malak
Patch-by: Jiri Malak
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNASM 2.10rc1
Cyrill Gorcunov [Thu, 30 Sep 2010 18:45:57 +0000 (22:45 +0400)]
NASM 2.10rc1

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR30730640: Restore preprocessor token concatenation rules
Cyrill Gorcunov [Fri, 24 Sep 2010 22:33:20 +0000 (02:33 +0400)]
BR30730640: Restore preprocessor token concatenation rules

During nasm-2.06 development we broke the rules for
concatenation of preprocessor tokens (d784a083a3f1).

The former candidates for concatenation were (in terms of RE)

expand_smacro
    [(TOK_ID|TOK_PREPROC_ID)][(TOK_ID|TOK_PREPROC_ID|TOK_NUMBER)]

expand_mmac_params
    [(TOK_ID|TOK_NUMBER|TOK_FLOAT)][(TOK_ID|TOK_NUMBER|TOK_FLOAT|TOK_OTHER)]

[ nb: review commits ec88c1beac00 , 20a94ad7fe41 and 984279b1dde9 if
  you going to change this one ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMore tests automation
Cyrill Gorcunov [Fri, 24 Sep 2010 17:22:30 +0000 (21:22 +0400)]
More tests automation

Not all covered but still worth to put in

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agotest: Add br3074517.asm
Cyrill Gorcunov [Fri, 24 Sep 2010 11:25:59 +0000 (15:25 +0400)]
test: Add br3074517.asm

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3074517: Print %macro name inside %rep blocks
Cyrill Gorcunov [Fri, 24 Sep 2010 11:24:42 +0000 (15:24 +0400)]
BR3074517: Print %macro name inside %rep blocks

If we're to print inside %rep block we should find
out which %macro it belongs.

Reported-by: Rob Neff
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agophash: move sample function to the sample file
H. Peter Anvin [Wed, 22 Sep 2010 21:02:28 +0000 (14:02 -0700)]
phash: move sample function to the sample file

read_input() shouldn't be part of the phash.ph module; instead it
should go into the sample usage file phash.pl.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoMerge branch 'nasm-2.09.xx'
Cyrill Gorcunov [Fri, 17 Sep 2010 22:59:08 +0000 (02:59 +0400)]
Merge branch 'nasm-2.09.xx'

14 years agoNASM 2.09.02
Cyrill Gorcunov [Fri, 17 Sep 2010 22:57:06 +0000 (02:57 +0400)]
NASM 2.09.02

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/changes.src: Describe changes
Cyrill Gorcunov [Fri, 17 Sep 2010 22:55:46 +0000 (02:55 +0400)]
doc/changes.src: Describe changes

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoAdd test-case for BR3066383
Cyrill Gorcunov [Fri, 17 Sep 2010 17:53:16 +0000 (21:53 +0400)]
Add test-case for BR3066383

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3066383: Restore backward compatibility with token pasting
Cyrill Gorcunov [Wed, 15 Sep 2010 20:16:19 +0000 (00:16 +0400)]
BR3066383: Restore backward compatibility with token pasting

It seems to be a bit long story for the reason if this bug. But
lets be verbose and describe all byte-to-byte. And it is all about
preprocessor code, in particular paste_tokens and expand_mmac_params.

Initially the problem (not the same but similar) was noticed and
fixed in commit ec88c1be. The problem reveals itself with code snippets
like

 | %macro m 1
 |  %push
 |      %define %$arg %1
 | %%top_%$arg:
 |      resb ($ - %%top_%$arg)
 |  %pop
 | %endmacro

So with commits ec88c1be51fd86e01f6741fc985d880c we did expand
local single macro before processing tokens pasting unconditionally.

But then it being found that such approach breaks %assign directive.
The snippets like below didn't work

 | %macro m 1
 |  %push
 |      %assign %$arg %1
 |      %assign %$arg %1+%$arg
 |  %pop
 | %endmacro

So all these commits were reverted and we just stop pasting tokens
in paste_tokens() after TOK_PREPROC_ID (commit 20a94ad7). Unfortunately
this breaks %assign with compound preproc id

 | %macro m3 1
 |    %push
 |        %assign %$_uses 0
 |        %rep 4
 |            %assign %$_ur%$_uses %$_uses
 |            mov ecx, %$_ur%$_uses
 |            %assign %$_uses %$_uses+1
 |        %endrep
 |    %pop
 | %endmacro

To fix this bug we have to combine two approaches at once,
we should continue pasting after TOK_PREPROC_ID and expand
sequential TOK_PREPROC_IDs except first one.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branch 'nasm-2.09.xx'
Cyrill Gorcunov [Wed, 15 Sep 2010 17:18:01 +0000 (21:18 +0400)]
Merge branch 'nasm-2.09.xx'

14 years agochanges.src: Describe changes for 2.09.02
Cyrill Gorcunov [Wed, 15 Sep 2010 17:13:48 +0000 (21:13 +0400)]
changes.src: Describe changes for 2.09.02

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3064376: ndisasm crash
Cyrill Gorcunov [Sun, 12 Sep 2010 09:37:53 +0000 (13:37 +0400)]
BR3064376: ndisasm crash

ndisasm may crash due to lack of check of VEX table index.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3064459: Missing %endif doesn't always cause error
Cyrill Gorcunov [Sat, 11 Sep 2010 22:00:05 +0000 (02:00 +0400)]
BR3064459: Missing %endif doesn't always cause error

error() routine is conditional dependent so we should
use nasm_error instead to yield message unconditionally.

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: Fix octal number prefix misprint
Cyrill Gorcunov [Fri, 10 Sep 2010 18:40:27 +0000 (22:40 +0400)]
doc/nasmdoc.src: Fix octal number prefix misprint

Reported-by: Anthony <anthony@cloudnet.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branch 'nasm-2.09.xx'
H. Peter Anvin [Wed, 15 Sep 2010 15:59:51 +0000 (08:59 -0700)]
Merge branch 'nasm-2.09.xx'

14 years agochanges: document fixed token reversal for %deftok
H. Peter Anvin [Wed, 15 Sep 2010 15:59:12 +0000 (08:59 -0700)]
changes: document fixed token reversal for %deftok

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopreproc: reverse the order of the tokens in %deftok
H. Peter Anvin [Wed, 15 Sep 2010 15:57:21 +0000 (08:57 -0700)]
preproc: reverse the order of the tokens in %deftok

Smacros are apparently stored with the token stream reversed, so make
sure %deftok matches that sense of relatity.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopreproc.c: Get rid of new TABs brought in recently
Cyrill Gorcunov [Sun, 12 Sep 2010 17:39:40 +0000 (21:39 +0400)]
preproc.c: Get rid of new TABs brought in recently

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3064376: ndisasm crash
Cyrill Gorcunov [Sun, 12 Sep 2010 09:37:53 +0000 (13:37 +0400)]
BR3064376: ndisasm crash

ndisasm may crash due to lack of check of VEX table index.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3064459: Missing %endif doesn't always cause error
Cyrill Gorcunov [Sat, 11 Sep 2010 22:00:05 +0000 (02:00 +0400)]
BR3064459: Missing %endif doesn't always cause error

error() routine is conditional dependent so we should
use nasm_error instead to yield message unconditionally.

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: Fix octal number prefix misprint
Cyrill Gorcunov [Fri, 10 Sep 2010 18:40:27 +0000 (22:40 +0400)]
doc/nasmdoc.src: Fix octal number prefix misprint

Reported-by: Anthony <anthony@cloudnet.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoeval.c: Use OPFLAG_FORWARD instead of opencoded number
Cyrill Gorcunov [Thu, 9 Sep 2010 21:02:12 +0000 (01:02 +0400)]
eval.c: Use OPFLAG_FORWARD instead of opencoded number

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branches 'master' and 'nasm-2.09.xx'
Cyrill Gorcunov [Tue, 7 Sep 2010 17:16:06 +0000 (21:16 +0400)]
Merge branches 'master' and 'nasm-2.09.xx'

14 years agoNASM 2.09.01
Cyrill Gorcunov [Tue, 7 Sep 2010 17:00:19 +0000 (21:00 +0400)]
NASM 2.09.01

A couple of NULL dereferences fixed.
See NASM version history in documentation.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agochanges.src: Describe changes for 2.09.01
Cyrill Gorcunov [Tue, 7 Sep 2010 16:57:36 +0000 (20:57 +0400)]
changes.src: Describe changes for 2.09.01

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Make %substr robust
Cyrill Gorcunov [Tue, 7 Sep 2010 16:31:11 +0000 (20:31 +0400)]
preproc.c: Make %substr robust

Make %substr robust to handle -1,-1 parameters
and restore old behavior when number of characters
in substring is greater then length of string itself.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoHandle %substr invalid parameters preventing NULL dereference
Cyrill Gorcunov [Tue, 7 Sep 2010 06:42:02 +0000 (10:42 +0400)]
Handle %substr invalid parameters preventing NULL dereference

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm_quote: Use memcpy only if length provided
Cyrill Gorcunov [Tue, 7 Sep 2010 05:52:47 +0000 (09:52 +0400)]
nasm_quote: Use memcpy only if length provided

No need to call memcpy on empty strings

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Make %substr robust
Cyrill Gorcunov [Tue, 7 Sep 2010 16:31:11 +0000 (20:31 +0400)]
preproc.c: Make %substr robust

Make %substr robust to handle -1,-1 parameters
and restore old behavior when number of characters
in substring is greater then length of string itself.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>