platform/upstream/nasm.git
14 years agoNASM 2.08rc10
Cyrill Gorcunov [Sun, 28 Feb 2010 21:56:01 +0000 (00:56 +0300)]
NASM 2.08rc10

We decided to defer recursive macro support
for now.

Hope this is the last RC before 2.08 final release.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Turn off rmacro,exitmacro support
Cyrill Gorcunov [Sun, 28 Feb 2010 08:52:53 +0000 (11:52 +0300)]
preproc.c: Turn off rmacro,exitmacro support

We've a problem in supporting [i]rmacro, exitmacro
facilities at moment.

In a sake of not holding new NASM release any longer these
directives are just marked as being "forbidden".

This allow us to not squash much changes in current source
code base but remain on a safe side same time.

Reviewed-by: Keith Kanios <keith@kanios.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agophash.ph: we haven't required the Graph module for a long time
H. Peter Anvin [Thu, 18 Feb 2010 18:36:21 +0000 (10:36 -0800)]
phash.ph: we haven't required the Graph module for a long time

We removed the need for the Graph module back at checkin
c593173e110244f99a3498cb3e23d6c3c07bae35 in 2008.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agolabels.c: Fix NULL dereference on too long identifiers
Cyrill Gorcunov [Thu, 18 Feb 2010 16:06:14 +0000 (19:06 +0300)]
labels.c: Fix NULL dereference on too long identifiers

In case if label is local and exceed maximum allowed length
we get NULL dereference. Fix it and warn a user about an accident.

Note that we don't print identifier itself since we know it's too
big. Line number of error is enough.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoRevert "doc/nasmdoc.src: Get rid of id length restriction"
Cyrill Gorcunov [Tue, 16 Feb 2010 22:16:00 +0000 (01:16 +0300)]
Revert "doc/nasmdoc.src: Get rid of id length restriction"

This reverts commit 3012d5d430b64273b83f4b5890719d34e441a18c.

nasm64developer pointed out that we still have this
limit in label.c (IDLEN_MAX).

Reported-by: nasm64developer
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Eliminate parasite comment on PP_STACKSIZE
Cyrill Gorcunov [Tue, 16 Feb 2010 07:42:33 +0000 (10:42 +0300)]
preproc.c: Eliminate parasite comment on PP_STACKSIZE

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Fix tab\space mess
Cyrill Gorcunov [Tue, 16 Feb 2010 07:27:56 +0000 (10:27 +0300)]
preproc.c: Fix tab\space mess

It's really hard to read the code which is
terribly messed in tabs\spaces. Fix it all
at once. It's dirty work but has to be done
once.

No change on binary level.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: Get rid of id length restriction
Cyrill Gorcunov [Tue, 16 Feb 2010 10:45:27 +0000 (13:45 +0300)]
doc/nasmdoc.src: Get rid of id length restriction

We always allocate enough memory to hold identifiers
with any length. So lets remove restriction from
documentation.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: Point to the correct license file
Cyrill Gorcunov [Tue, 16 Feb 2010 10:18:04 +0000 (13:18 +0300)]
doc/nasmdoc.src: Point to the correct license file

There is no "COPYING" but "LICENSE" file.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: It's 2010 already
Cyrill Gorcunov [Tue, 16 Feb 2010 10:17:10 +0000 (13:17 +0300)]
doc/nasmdoc.src: It's 2010 already

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNASM 2.08rc9
H. Peter Anvin [Mon, 15 Feb 2010 18:16:18 +0000 (10:16 -0800)]
NASM 2.08rc9

14 years agodoc/changes.src: update in preparation of 2.08 release
H. Peter Anvin [Mon, 15 Feb 2010 18:15:53 +0000 (10:15 -0800)]
doc/changes.src: update in preparation of 2.08 release

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopreproc.c: Fix SIGSEV on missed %endm
Cyrill Gorcunov [Sun, 14 Feb 2010 14:19:38 +0000 (17:19 +0300)]
preproc.c: Fix SIGSEV on missed %endm

In case if EOF is reached (or due to any
other case pp_cleanup is being called) we
do free "defining" macro but forgot to set
pointer to NULL itself which leads to attempt
to free memory again for this macro on further
pp_cleanup calls.

14 years agopreproc.c: Fix NULL dereference on package absence
Cyrill Gorcunov [Fri, 12 Feb 2010 19:00:18 +0000 (22:00 +0300)]
preproc.c: Fix NULL dereference on package absence

If package can't be retrieved we should not attempt
to dereference NULL'ed pointer which leads to segmentation
fault.

Reported-by: Serge
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNASM 2.08rc8
Cyrill Gorcunov [Thu, 11 Feb 2010 19:11:16 +0000 (22:11 +0300)]
NASM 2.08rc8

14 years agooutput/outbin.c: Fix misprinted alignment bound
Cyrill Gorcunov [Thu, 11 Feb 2010 18:49:58 +0000 (21:49 +0300)]
output/outbin.c: Fix misprinted alignment bound

Due to a misprint in commit
9b66d8e4c3030474a75e598f699eccc118a3d651

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoexpand_smacro: Don't search for ID in global context
Cyrill Gorcunov [Thu, 11 Feb 2010 12:12:19 +0000 (15:12 +0300)]
expand_smacro: Don't search for ID in global context

The corner case is the code like

%define foo 1
%push bar
%$foo:
%pop

for which v2.07 ends up with "foo = 1" while 0.98.39
issue an error.

hpa said that ideally we may need to create a context
structure for the global context but this seems to be
too agressive for 2.08.

Based on patch from nasm64developer

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoElf: Drop useless SEG_ALIGN_1
Cyrill Gorcunov [Thu, 11 Feb 2010 18:24:39 +0000 (21:24 +0300)]
Elf: Drop useless SEG_ALIGN_1

No need for SEG_ALIGN_1 since we have switched
to ALIGN helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoUse ALIGN helper
Cyrill Gorcunov [Thu, 11 Feb 2010 18:23:50 +0000 (21:23 +0300)]
Use ALIGN helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasmlib.h: Introduce ALIGN helpers
Cyrill Gorcunov [Thu, 11 Feb 2010 06:03:51 +0000 (09:03 +0300)]
nasmlib.h: Introduce ALIGN helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Use 16 byte offset in "flat64" stack model
Per Jessen [Wed, 10 Feb 2010 21:16:59 +0000 (00:16 +0300)]
preproc.c: Use 16 byte offset in "flat64" stack model

The first argument passed on stack with "flat64" stack model
(stack frame with base pointer) should be pointed by
[rbp + 16].

Signed-off-by: Per Jessen <per@computer.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: Delete misplaced "point" sign
Cyrill Gorcunov [Wed, 10 Feb 2010 20:31:03 +0000 (23:31 +0300)]
doc/nasmdoc.src: Delete misplaced "point" sign

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocontrib/MSVC6.txt: Add guide how to use nasm in MSVC6
Alexander Ilyin [Sun, 24 Jan 2010 20:14:39 +0000 (23:14 +0300)]
contrib/MSVC6.txt: Add guide how to use nasm in MSVC6

It's possible to use nasm as asm compiled right within
MSVC6 IDE. Lets point it out via a small guide.

Signed-off-by: Alexander Ilyin <dragity@mail.ru>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasmlib.c: Use UINT64_C for 64bit constants
Cyrill Gorcunov [Sun, 24 Jan 2010 12:15:21 +0000 (15:15 +0300)]
nasmlib.c: Use UINT64_C for 64bit constants

In a sake of portability we should better use
UINT64_C instead of open-coded ULL postfix.

[ BR2938449 ]

Reported-by: Alexander Ilyin <dragity@mail.ru>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNASM 2.08rc7
H. Peter Anvin [Tue, 12 Jan 2010 17:07:02 +0000 (09:07 -0800)]
NASM 2.08rc7

14 years agonasm.c: Restore strings broken by `indent`
Cyrill Gorcunov [Sat, 9 Jan 2010 13:40:03 +0000 (16:40 +0300)]
nasm.c: Restore strings broken by `indent`

A number of strings are broken by nindent passed over the nasm.c.
Though the compiler doesn't care about this fact it's really
unpleasant to have a string split at "dot" symbol.

Lets restore it in a sake of readability.

(No change on binary level)

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoREADME: add note to see the AUTHORS file
H. Peter Anvin [Thu, 7 Jan 2010 04:56:11 +0000 (20:56 -0800)]
README: add note to see the AUTHORS file

14 years agoinsns.dat: in 64-bit mode, accept "monitor rax,ecx,edx".
H. Peter Anvin [Thu, 7 Jan 2010 00:07:26 +0000 (16:07 -0800)]
insns.dat: in 64-bit mode, accept "monitor rax,ecx,edx".

The first argument to MONITOR is an address, so it should be 64 bits
(RAX) in 64-bit mode.

The preferred form is still just plain "monitor".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMkfiles: Add depends on stabs.h for Elf output
Cyrill Gorcunov [Sun, 3 Jan 2010 13:19:43 +0000 (16:19 +0300)]
Mkfiles: Add depends on stabs.h for Elf output

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/changes.src: Update changes
Cyrill Gorcunov [Sun, 3 Jan 2010 12:41:22 +0000 (15:41 +0300)]
doc/changes.src: Update changes

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoELF: Explicitly point out SYM_GLOBAL, SYM_LOCAL binding
Cyrill Gorcunov [Sat, 2 Jan 2010 12:53:11 +0000 (15:53 +0300)]
ELF: Explicitly point out SYM_GLOBAL, SYM_LOCAL binding

Instead of implicit declaration of global symbols obtained
by STB_GLOBAL << 4, and local symbols by STB_LOCAL << 4
use ELF32_ST_MKBIND helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoelf.h: Add ELFXX_ST_MKBIND and move ELFXX_ST_ helpers
Cyrill Gorcunov [Fri, 1 Jan 2010 20:53:30 +0000 (23:53 +0300)]
elf.h: Add ELFXX_ST_MKBIND and move ELFXX_ST_ helpers

The profit of ELFXX_ST_MKBIND helper is that we
will use it for SYM_GLOBAL explicitly pointing
out from where this magic 0x10 came from.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/outelfX.c: Use definitions from stabs.h
Cyrill Gorcunov [Fri, 1 Jan 2010 12:16:52 +0000 (15:16 +0300)]
output/outelfX.c: Use definitions from stabs.h

Also made Makefile.in to handle dependency.
There are some makefiles in Mkfiles\ should
be fixed as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoAdd common STABs definition into output/stabs.h
Cyrill Gorcunov [Fri, 1 Jan 2010 11:41:25 +0000 (14:41 +0300)]
Add common STABs definition into output/stabs.h

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutelfX.c: Trivial cleanup
Cyrill Gorcunov [Fri, 1 Jan 2010 11:24:47 +0000 (14:24 +0300)]
outelfX.c: Trivial cleanup

Some tab\space convertions together with
trivial style nitfix.

No change on binary level.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR2924380: Add AMD LWP instructions
Cyrill Gorcunov [Sun, 3 Jan 2010 11:58:06 +0000 (14:58 +0300)]
BR2924380: Add AMD LWP instructions

nasm64developer reported that we have no LWP support yet.
Add this feature.

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR2924383: fix XOP instructions
Cyrill Gorcunov [Sat, 2 Jan 2010 21:40:54 +0000 (00:40 +0300)]
BR2924383: fix XOP instructions

nasm64developer reported a few nits in XOP
instruction templates. Plain typo in specification
(http://support.amd.com/us/Processor_TechDocs/43479.pdf)
and opcode errors.

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR2924583: fix FMA4 instructions
Cyrill Gorcunov [Sat, 2 Jan 2010 21:09:41 +0000 (00:09 +0300)]
BR2924583: fix FMA4 instructions

nasm64developer reported that VFNMADDSD and VFNMADDSS
have "m" and "s" operands swapped in instruction templates
file.

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoElf: Allow symbols binding to undefined section
Cyrill Gorcunov [Sat, 2 Jan 2010 20:00:43 +0000 (23:00 +0300)]
Elf: Allow symbols binding to undefined section

Commit 2ddcd03900d134772e98acf8cab17a12cc0c3f2a
did bind symbols (in case of omitted SECTION directive)
to .text section but break COMMON binding.
Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: Update the number of sync points in docs
Cyrill Gorcunov [Tue, 22 Dec 2009 20:36:46 +0000 (23:36 +0300)]
doc/nasmdoc.src: Update the number of sync points in docs

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agosync.c: Get sync points limit back
Cyrill Gorcunov [Tue, 22 Dec 2009 20:33:40 +0000 (23:33 +0300)]
sync.c: Get sync points limit back

We should explicitly check if we can hold the sync
point, otherwise we may wrap the array index and
reach incorrect value (if we're lucky).

So instead we make the index "almost" unlmited.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agosync.c: Style nitfix
Cyrill Gorcunov [Mon, 21 Dec 2009 16:31:45 +0000 (19:31 +0300)]
sync.c: Style nitfix

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNASM 2.08rc6
H. Peter Anvin [Sat, 19 Dec 2009 00:26:02 +0000 (16:26 -0800)]
NASM 2.08rc6

14 years agoinsns.dat: Restore default size of memory operands
Cyrill Gorcunov [Wed, 16 Dec 2009 12:44:58 +0000 (15:44 +0300)]
insns.dat: Restore default size of memory operands

During conversion of size of memory operands into
explicit form the compatibility with 2.07 has been
broken (for a small set of instructions). Lets restore
it. Details below.

This is due to specifics of our "fuzzy logic" algorithm.

For example consider the user wrote an instruction like

VCVTTPD2DQ xmm0,[eax]

the last operand is memory reference. But template contains
the following two items (written in simplified form)

VCVTTPD2DQ xmmreg,mem128
VCVTTPD2DQ xmmreg,mem256

So this is impossible to find out what _exactly_ user meant:
either reference to 128 bit value in memory or 256 bit.

As a solution we've been using IF_Sx modifier written in
template which allows to choose "by-default" template
and break the tie.

Reported-by: Victor van den Elzen <victor.vde@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/changes.src: describe changes
Cyrill Gorcunov [Sun, 13 Dec 2009 11:13:35 +0000 (14:13 +0300)]
doc/changes.src: describe changes

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoElf: bind labels to text section by default
Cyrill Gorcunov [Sun, 29 Nov 2009 20:21:16 +0000 (23:21 +0300)]
Elf: bind labels to text section by default

In case if SECTION directive is omitted but the real
code exist we form .text section by default and put compiled
code here. In turn labels are not handled in a same manner.

So lets bind them to text section by default as well.

[ BR: 2835192 ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR2907058: insn_size - close file handle before returning
Cyrill Gorcunov [Sat, 5 Dec 2009 11:04:55 +0000 (14:04 +0300)]
BR2907058: insn_size - close file handle before returning

As example of such behaviour is when fseek fails for
some reason.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.c: Use copy_filename to set error message file
Cyrill Gorcunov [Fri, 4 Dec 2009 16:44:20 +0000 (19:44 +0300)]
nasm.c: Use copy_filename to set error message file

To prevent errname buffer overwrite we should
use copy_filename instead of strcpy.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoinsns.dat: AVX -- no need for IF_ARx in template
Cyrill Gorcunov [Wed, 2 Dec 2009 16:03:20 +0000 (19:03 +0300)]
insns.dat: AVX -- no need for IF_ARx in template

We describe the instruction arguments in explicit form
so IF_ARx is just not needed here.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoRun "make alldeps"
H. Peter Anvin [Mon, 30 Nov 2009 21:28:31 +0000 (13:28 -0800)]
Run "make alldeps"

14 years agooutrdf.c: remove obsolete file
H. Peter Anvin [Mon, 30 Nov 2009 21:27:49 +0000 (13:27 -0800)]
outrdf.c: remove obsolete file

The old RDF format has been unsupported for long time now.  Remove it
from the tree.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agooutform.h: fix OF_NO_RDF2
H. Peter Anvin [Mon, 30 Nov 2009 21:26:34 +0000 (13:26 -0800)]
outform.h: fix OF_NO_RDF2

OF_NO_RDF2 should turn off OF_RDF2, not OF_RDF

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoAUTHORS: convert to UTF-8
H. Peter Anvin [Mon, 30 Nov 2009 20:07:31 +0000 (12:07 -0800)]
AUTHORS: convert to UTF-8

Convert Latin-1 character to UTF-8.  This is 2009.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agooutmacho32: replace error() -> nasm_error()
H. Peter Anvin [Mon, 30 Nov 2009 19:27:47 +0000 (11:27 -0800)]
outmacho32: replace error() -> nasm_error()

Somehow outmacho32.c escaped the global change of error variables to
hard-coded nasm_error().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoNASM 2.08rc5
H. Peter Anvin [Sat, 28 Nov 2009 23:35:51 +0000 (15:35 -0800)]
NASM 2.08rc5

14 years agotest/Makefile: make it easier to inject options
H. Peter Anvin [Sat, 28 Nov 2009 23:34:32 +0000 (15:34 -0800)]
test/Makefile: make it easier to inject options

Make it easier to inject options into test compiles.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopreproc.c: expand_smacro -- break endless loop for interminable macro recursion
Cyrill Gorcunov [Sat, 21 Nov 2009 08:11:23 +0000 (11:11 +0300)]
preproc.c: expand_smacro -- break endless loop for interminable macro recursion

Frank reported:
|
| From the "expert questions" forum comes this:
|
| ---------------------
| By: jasper_neumann
|
| How can I delegate %undef?
|
| In the example below the assembler (called with "nasm.exe -t -f rdf q.asm")
| bemoans my code, displays
|
| "q.asm:19: error: interminable macro recursion"
|
| and hangs.
|
| q.asm
| -----
| bits 32
| CPU P4
|
| %macro my_def 2
|  %xdefine %1 esp+%2
| %endmacro
|
| %macro my_undef 1
|  %undef %1
| %endmacro
|
| global check_it
| check_it:
|  my_def x,4
|  mov eax,[x]
|  my_undef x
|
|  my_def x,8
|  add eax,[x]
|  my_undef x
|  ret
|

So in case of interminable macro recursion we should break
the expansion procedure that way to not return back and start
expand macro again.

This address a part of the original problem.
Nasm64developer pointed out:
|
| Btw, after you manage to fix this recursion problem, the code
| in question still faces the same fundamental issue -- the arg
| to the my_undef invocations (i.e. x) gets expanded first; thus
| the %undef inside the macro sees esp+4 and esp+8 instead
| of x, and fails. What you'd need is a means to prevent the ex-
| pansion -- look for e.g. %# in 4.1.4 of the manual.txt which is
| attached to SF #1842438; it implements exactly that -- I once
| filed SF #829879 for this feature.
|

In turn Keith Kanios said:
|
| Anon is also correct in that we would need a special directive to instruct
| the delay of macro expansion, although I don't see this as critical or even
| high priority at the moment. The intermediate solution for this is, don't
| use indirection if it is not needed... an inline %undef should be
| sufficient.
|

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Keith Kanios <keith@kanios.net>
15 years agooutcoff: BuildExportTable -- tab/space fix
Cyrill Gorcunov [Tue, 17 Nov 2009 18:58:08 +0000 (21:58 +0300)]
outcoff: BuildExportTable -- tab/space fix

Due to previous commit an indent by tab (occasionally) brought in.
Fix it as well. No change on binary level.

We're not that far from NASM release so it's a bit unpleasant
manner to push in such trivial change. But since it's the previous
commit dependent -- I dare to push it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agooutcoff: Do not fail on long export identifiers
Cyrill Gorcunov [Tue, 17 Nov 2009 17:49:58 +0000 (20:49 +0300)]
outcoff: Do not fail on long export identifiers

If an export identifier is greater then 241 symbols
we do fail due to buffer overflow. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoNASM 2.08rc4
H. Peter Anvin [Fri, 13 Nov 2009 22:12:37 +0000 (14:12 -0800)]
NASM 2.08rc4

15 years agoUpdate test files
Victor van den Elzen [Wed, 11 Nov 2009 07:09:03 +0000 (08:09 +0100)]
Update test files

Remove references to DREX instructions

15 years agoAdd test/bisect.sh for use with "git bisect"
Victor van den Elzen [Wed, 11 Nov 2009 06:47:39 +0000 (07:47 +0100)]
Add test/bisect.sh for use with "git bisect"

15 years agoDon't boundcheck 64-bit numbers, it gives problems due to overflows
Victor van den Elzen [Wed, 11 Nov 2009 06:39:21 +0000 (07:39 +0100)]
Don't boundcheck 64-bit numbers, it gives problems due to overflows

15 years agoNASM 2.08rc3
H. Peter Anvin [Tue, 10 Nov 2009 00:54:48 +0000 (16:54 -0800)]
NASM 2.08rc3

15 years agoinsns.dat: remove non-DREX SSE5 instructions
H. Peter Anvin [Tue, 10 Nov 2009 00:53:43 +0000 (16:53 -0800)]
insns.dat: remove non-DREX SSE5 instructions

Even the non-DREX SSE5 instructions appear to have been either
obsoleted or replaced with XOP varieties.  The only exception are the
ROUNDxx instructions, which are really SSE4.1 instructions and which
were simply duplicates.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agochanges.src: document removal of DREX instructions
H. Peter Anvin [Mon, 9 Nov 2009 22:58:45 +0000 (14:58 -0800)]
changes.src: document removal of DREX instructions

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoSSE5: remove all DREX-based instructions
H. Peter Anvin [Mon, 9 Nov 2009 22:57:19 +0000 (14:57 -0800)]
SSE5: remove all DREX-based instructions

AMD has obsoleted the DREX-based SSE5 proposal, so remove all such
instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutelf32/64 - various cleanups in a sake of unification
Cyrill Gorcunov [Fri, 6 Nov 2009 12:48:47 +0000 (15:48 +0300)]
outelf32/64 - various cleanups in a sake of unification

Make a small step forward elf32/64 unification procedure.
Mostly style fixes. Nothing serious.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agodwarfX_output: dont check for "ln" twice
Cyrill Gorcunov [Fri, 6 Nov 2009 08:53:31 +0000 (11:53 +0300)]
dwarfX_output: dont check for "ln" twice

And make dwarf64 version to be more familiar to
32bit version (preparation work for merge).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agooutput/outelf64.c: simplify stabs64_cleanup, dwarf64_cleanup
Cyrill Gorcunov [Fri, 6 Nov 2009 08:42:11 +0000 (11:42 +0300)]
output/outelf64.c: simplify stabs64_cleanup, dwarf64_cleanup

nasm_free is failsafe against NULL passed

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoDocument BR 2887108 in changes.src
Cyrill Gorcunov [Fri, 6 Nov 2009 08:24:54 +0000 (11:24 +0300)]
Document BR 2887108 in changes.src

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoMerge elf header files
Cyrill Gorcunov [Fri, 6 Nov 2009 08:15:37 +0000 (11:15 +0300)]
Merge elf header files

Merge elfcommon.h, elf32.h, elf64.h into
single elf.h -- we do support both elf32
and elf64 anyway. Let put them into common
place.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agohash_init: check for size being power of two
Cyrill Gorcunov [Fri, 6 Nov 2009 07:22:49 +0000 (10:22 +0300)]
hash_init: check for size being power of two

It's really a bug if size is not power of
two. We must to be sure all callers are
sane.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agohashtbl.c: Unify common hash ops by macros
Cyrill Gorcunov [Fri, 6 Nov 2009 18:58:48 +0000 (21:58 +0300)]
hashtbl.c: Unify common hash ops by macros

Instead of opencoded repeatable computation
use macro helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoIntroduce is_power2 helper
Cyrill Gorcunov [Fri, 6 Nov 2009 06:03:08 +0000 (09:03 +0300)]
Introduce is_power2 helper

We will need it for hash tables

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoMOVD xmmreg: not valid with REX.W
H. Peter Anvin [Fri, 6 Nov 2009 17:36:11 +0000 (09:36 -0800)]
MOVD xmmreg: not valid with REX.W

The xmmreg forms of MOVD are invalid with REX.W, since those are MOVQ
instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoComment out matches() operand flags logic
Cyrill Gorcunov [Thu, 5 Nov 2009 21:08:38 +0000 (00:08 +0300)]
Comment out matches() operand flags logic

Also space fix

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agonasmlib.h: Introduce nasm_build_assert
Cyrill Gorcunov [Thu, 5 Nov 2009 20:35:04 +0000 (23:35 +0300)]
nasmlib.h: Introduce nasm_build_assert

It's useful to protect our self from some
errors at build time.

For this sake we should use nasm_build_assert
if needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agotest: imul.asm: move warning-generated tests under WARN
H. Peter Anvin [Wed, 4 Nov 2009 00:35:19 +0000 (16:35 -0800)]
test: imul.asm: move warning-generated tests under WARN

Only make the tests under WARN actually issue warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agotest: imul.asm: more IMUL pattern tests
H. Peter Anvin [Tue, 3 Nov 2009 23:59:47 +0000 (15:59 -0800)]
test: imul.asm: more IMUL pattern tests

Test more IMUL patterns.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNASM 2.08rc2
H. Peter Anvin [Tue, 3 Nov 2009 23:59:24 +0000 (15:59 -0800)]
NASM 2.08rc2

15 years agomatches: simplify check operand size actions
Cyrill Gorcunov [Sun, 1 Nov 2009 20:16:01 +0000 (23:16 +0300)]
matches: simplify check operand size actions

We may throw out j variable (since we break anyway)
and don't assign asize for free (since we don't
use it after).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoIMUL: sbyteX fix -- last one
Cyrill Gorcunov [Tue, 3 Nov 2009 18:35:24 +0000 (21:35 +0300)]
IMUL: sbyteX fix -- last one

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoIMUL: fix an additional incorrect sbyte use
H. Peter Anvin [Tue, 3 Nov 2009 17:34:09 +0000 (09:34 -0800)]
IMUL: fix an additional incorrect sbyte use

One more incorrect use of sbyte in IMUL.

Overall, the IMUL patterns seem really messy.  *Furthermore*, despite
IMUL normally being thought of as signed, the 2- and 3-operand
versions don't produce a high half and are therefore
signedness-agnostic -- we could even add MUL patterns for those forms.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoBR 2887108: fix incorrect sbyte usage in IMUL
H. Peter Anvin [Tue, 3 Nov 2009 17:26:58 +0000 (09:26 -0800)]
BR 2887108: fix incorrect sbyte usage in IMUL

Fix a very curious transposition in the instruction patterns for IMUL,
which caused 32-bit IMUL instructions with constants like 0x10001 to
be generated incorrectly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoRevert "BR 2887108: Use overflow_ helper to catch inappropriate imm optimization"
Cyrill Gorcunov [Sun, 1 Nov 2009 07:24:48 +0000 (10:24 +0300)]
Revert "BR 2887108: Use overflow_ helper to catch inappropriate imm optimization"

This reverts commit 41208028ff52d190044ee7532bf14c5aca0f899a.
|
| From: "H. Peter Anvin" <hpa@zytor.com>
|
| The tests for overflow_signed() are wrong too.  Those are relevant for if a
| warning should be issued, but not for how the value should be encoded in
| the byte stream.
|

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
15 years agostdscan.c: use TOKEN_EOS and string helpers
Cyrill Gorcunov [Fri, 30 Oct 2009 08:29:43 +0000 (11:29 +0300)]
stdscan.c: use TOKEN_EOS and string helpers

Also tab/space cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoVarious tab/space/comment cleanup
Cyrill Gorcunov [Sat, 31 Oct 2009 17:05:32 +0000 (20:05 +0300)]
Various tab/space/comment cleanup

No change on binary level

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agooutput/outelf32-64: use string helpers
Cyrill Gorcunov [Fri, 30 Oct 2009 06:24:05 +0000 (09:24 +0300)]
output/outelf32-64: use string helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoRemove outdated comments
Cyrill Gorcunov [Thu, 29 Oct 2009 21:23:48 +0000 (00:23 +0300)]
Remove outdated comments

From Frank Kotler:
| ...
| > -                stdscan_bufptr = saveme;        /* bugfix? fbk 8/10/00 */
| > +                stdscan_set(saveme);            /* bugfix? fbk 8/10/00 */
|
| While you're at it, you could remove my comment(s - it seems to have
| reproduced). It *is* a bugfix (apparently). "saveme" might have a better
| name, too...

So get rid of the comments.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agostdscan: switch to stdscan_get/set routines
Cyrill Gorcunov [Thu, 29 Oct 2009 20:09:18 +0000 (23:09 +0300)]
stdscan: switch to stdscan_get/set routines

Instead of manipulating stdscan buffer pointer directly
we switch to a routine interface.

This allow us to unify stdscan access: ie caller should
"talk" to stdscan via stdscan_get/set routines.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agonasmlib: Introduce idata_bytes helper
Cyrill Gorcunov [Sat, 31 Oct 2009 17:02:14 +0000 (20:02 +0300)]
nasmlib: Introduce idata_bytes helper

This allow us to eliminate code duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoBR 2887108: Use overflow_ helper to catch inappropriate imm optimization
Cyrill Gorcunov [Sat, 31 Oct 2009 07:34:43 +0000 (10:34 +0300)]
BR 2887108: Use overflow_ helper to catch inappropriate imm optimization

We should use overflow_ helpers before check if an immediate
operand fit a type range, otherwise we may loose high bits.

For example when we assemble the following instruction

imul eax,eax,0x10000

with -Ox passed we optimze it up to imm8 though it must be imm32.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agochanges.src: document preprocessor directives added since 2.07
Keith Kanios [Sun, 25 Oct 2009 19:06:24 +0000 (14:06 -0500)]
changes.src: document preprocessor directives added since 2.07
nasmdoc.src: document %exitmacro

15 years agopreproc.c: fix exitmacro to account for if/endif blocks
Keith Kanios [Sun, 25 Oct 2009 18:28:03 +0000 (13:28 -0500)]
preproc.c: fix exitmacro to account for if/endif blocks

15 years agocontinue using is_class helper
Cyrill Gorcunov [Sun, 18 Oct 2009 08:41:14 +0000 (12:41 +0400)]
continue using is_class helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agochanges.src: describe changes since version 2.07 up to 2.08rc1
Cyrill Gorcunov [Sat, 17 Oct 2009 21:09:40 +0000 (01:09 +0400)]
changes.src: describe changes since version 2.07 up to 2.08rc1

There are already new commits which fix other bugs
but at moment only changes up to 2.08rc1.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoBR 2840300: fix macho symbol alignment bug
Keith Kanios [Sat, 17 Oct 2009 02:53:59 +0000 (21:53 -0500)]
BR 2840300: fix macho symbol alignment bug

15 years agoparser.c: pasrse_line -- fix alignment
Cyrill Gorcunov [Wed, 14 Oct 2009 11:36:45 +0000 (15:36 +0400)]
parser.c: pasrse_line -- fix alignment

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoassemble: xsizeflags[] is an opflags_t variable
H. Peter Anvin [Tue, 13 Oct 2009 19:32:20 +0000 (12:32 -0700)]
assemble: xsizeflags[] is an opflags_t variable

One more case of int32_t instead of opflags_t...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>