Commit graph

2154 commits

Author SHA1 Message Date
Cyrill Gorcunov
d6f31240c5 assemble.c: Style nitfix
Various tabs/space mixture cleaned and some more.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-26 23:16:45 +04:00
H. Peter Anvin
ab5bd05d82 Revert "Improve process_ea and introduce -OL"
This reverts commit ac732cb6a5.

Resolved Conflicts:

	doc/nasmdoc.src

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-25 12:43:30 -07:00
H. Peter Anvin
b453c866ab nasm.h: move "regs.h" to top; make is_register() a bool
Move the #include of regs.h to the top with the other includes, and
make is_register() -- being a boolean predicate -- return bool.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-25 00:17:12 -07:00
Cyrill Gorcunov
a38b86aecf move is_register helper to nasm.h
H. Peter Anvin noted:
 |
 | Could we avoid putting static code that has no dynamic content in
 | dynamically generated files... it just complicates things unnecessarily.
 |
 | The above can move into nasm.h for example.
 |

Good idea.

CC: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-25 11:09:56 +04:00
Cyrill Gorcunov
2124b7b7dc Use is_register helper
Save us some line of code

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-25 01:16:33 +04:00
Cyrill Gorcunov
79699d8eda regs.pl: Introduce is_register() helper
Instead of opencoded check use inline helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-25 01:10:17 +04:00
Victor van den Elzen
b8e699fb3d Remove redundant sentence in docs 2010-07-24 22:24:15 +02:00
Victor van den Elzen
ac732cb6a5 Improve process_ea and introduce -OL
Two fixes:
1. Optimization of [bx+0xFFFF] etc
   0xFFFF is an sbyte under 16-bit semantics,
   so make sure to check it right.

2. Don't optimize displacements in -O0
   Displacements that fit into an sbyte or
   can be removed should *not* be optimized in -O0.

   Implicit zero displacements are still optimized, e.g.:
   [eax] -> 0 bit displacement, [ebp] -> 8 bit displacement.
   However explicit displacements are not optimized:
   [eax+0] -> 32 bit displacement, [ebp+0] -> 32 bit displacement.

Because #2 breaks compatibility with 0.98,
I introduced a new optimization level: -OL, legacy.
2010-07-24 22:00:12 +02:00
Cyrill Gorcunov
088d151130 doc: Update changes.src
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-23 18:57:40 +04:00
Cyrill Gorcunov
4e1d5ab0cf preproc.: Fix NULL dereference on broken %strlen argument
Under particular circumstances %strlen may cause SIGSEG. A typical
example is %strlen with nonexistent macro argument.

[ Testcase test/strlen.asm ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-23 18:51:51 +04:00
H. Peter Anvin
077fb93d2b preproc: allow non-identifier character in environment variables
Allow non-identifier characters in the name of environment variables,
by surrounding them with string quotes (subject to ordinary
string-quoting rules.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-20 14:56:30 -07:00
Cyrill Gorcunov
aed4eaa8f3 changes.src: Fix misprint in "instructions" word.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-17 18:24:13 +04:00
H. Peter Anvin
6c74498114 nasmdoc: we still miss Chuck, but...
We still miss Chuck, but I don't think we can really say anymore we're
doing this particular release in his memory.

Requiescat in pace, our friend.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 22:51:26 -07:00
H. Peter Anvin
abe61900e4 Merge branch 'nasm-2.08.xx'
Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 22:45:04 -07:00
H. Peter Anvin
5bc03271bd changes.src: update with the 2.08.xx changes
Patchlevels should be documented, too...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 22:44:03 -07:00
H. Peter Anvin
c23adff39b NASM 2.09rc4 2010-07-15 18:32:32 -07:00
H. Peter Anvin
31387b2d04 Make -Ox the default
Make -Ox the default; it's the optimization level expected by most
users, and it is clearly still causing confusion that it has to be
specified manually.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 18:30:18 -07:00
Bryant Keller
a537d4964e Documentation: describe %ifenv and friends
Signed-off-by: Bryant Keller <bkeller@assembly.ath.cx>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 23:49:39 +04:00
H. Peter Anvin
6d9b2b59b5 preproc: add %ifenv
Add %ifenv to test for the presence of an environment variable.  The
environment variable can, but does not have to be, prefixed with %!.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-13 12:00:58 -07:00
H. Peter Anvin
5b00bf4d49 BR3028880: Revert to nonfatal, better error message, cleanup
Revert to issuing a nonfatal error (it makes no sense to make it a
fatal error, but it probably makes sense for it to be an error instead
of a warning, especially since a lot of prior versions would crash and
apparently noone noticed.)  We might have to revisit this based on
user requirements, and/or provide a method for the user to detect an
existing environment variable (%ifenv?).

Issue a better error message, indicating the nature of the failure.

Simplify the code by just updating the string in "p".

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-13 11:46:37 -07:00
Cyrill Gorcunov
702df6d6cc Update changes.src
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:54 +04:00
Cyrill Gorcunov
41c5c6c36d BR3028880: Make nonexistent environment variable being fatal error
Frank suggested to just print out an error if environment
variable is not there. Agreed.

Suggested-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:49 +04:00
Cyrill Gorcunov
6405229b6d Check in test for BR3028880
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:31 +04:00
Cyrill Gorcunov
385d3e9c53 BR3028880: Fix NULL dereference on nonexistent environment variable
Frank reported we hit NULL dereference on nonexistent
environment variables. Fix it by leaving empty string
in text field of such token and yielding warning.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:24 +04:00
Cyrill Gorcunov
c6360a757b tokenize: Fix wrong string index in indirect strings
At moment of calling the nasm_skip_string the string pointer
is already incremented which makes tokenize fail on correct
indirect strings.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:16 +04:00
Cyrill Gorcunov
15bdc51187 preproc: Extract reading line from predefined macros from read_line
It makes read_line less complex

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:10 +04:00
Cyrill Gorcunov
924df0d498 Documentation updates
Various small fixes.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:03 +04:00
Cyrill Gorcunov
69ce75076c No need for \n at __OUTPUT_FORMAT__ macro end
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:16:57 +04:00
Cyrill Gorcunov
fed61a547f Merge branches 'master' and 'preproc-paste-fix' 2010-07-13 21:16:05 +04:00
Cyrill Gorcunov
984279b1dd BR3026808: Assign to local preprocessor variable does not work in 2.09
The commits

20a94ad7fe
29c96651de
13dbfad76b
6f5f7ef417
ddd08c3ccc

seems to do the tricks we need. Eventually
get rid of commented "case".

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:13:24 +04:00
H. Peter Anvin
dc2152ed0a nasmdoc: remove obsolete Sourceforge references
Remove obsolete Sourceforge references, replace with nasm.us.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-09 19:04:59 -07:00
H. Peter Anvin
7d43804633 NASM 2.09rc3 2010-07-09 19:02:28 -07:00
Cyrill Gorcunov
5483d495a7 NASM 2.08.02 2010-07-10 02:37:49 +04:00
Cyrill Gorcunov
7d96ac6a56 preproc.c: Fix NULL deref on token pasting
In case if there is a whitespace before
'paste' token we may reach NULL dereference
in strlen since paste_head will point to
TOK_WHITESPACE. Fix it.

[mainstream adabc1576b]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-10 02:34:05 +04:00
Cyrill Gorcunov
adabc1576b preproc.c: Fix NULL deref on token pasting
In case if there is a whitespace before
'paste' token we may reach NULL dereference
in strlen since paste_head will point to
TOK_WHITESPACE. Fix it.

[test: paste.asm]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-10 02:14:24 +04:00
Cyrill Gorcunov
8ab945a259 preproc: add another test case
Add another test case for preprocessor token pasting.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-09 15:05:32 -07:00
H. Peter Anvin
20a94ad7fe preproc: don't paste TOK_PREPROC_ID
Trying to deal with bug reports 3005117 and 3026808: don't paste after
TOK_PREPROC_ID.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-08 11:52:57 -07:00
H. Peter Anvin
29c96651de Revert "BR3005117: Expland local single macro before pasting tokens"
This reverts commit ec88c1beac.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-08 08:35:32 -07:00
H. Peter Anvin
13dbfad76b Revert "expand_mmac_params: Don't forget to handle TOK_OTHER"
This reverts commit 51fd86e0fe.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-08 08:34:41 -07:00
H. Peter Anvin
6f5f7ef417 Revert "expand_mmac_params: Expand local single macros unconditionally"
This reverts commit 1f6741fc78.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-08 08:33:47 -07:00
H. Peter Anvin
ddd08c3ccc Revert "expand_mmac_params: Expand local single macros unconditionally"
This reverts commit 985d880c15.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-08 08:33:14 -07:00
H. Peter Anvin
f86b8b22e1 Check in test case from bug report br3005117
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-08 08:30:23 -07:00
H. Peter Anvin
4106753f6c br3026808: add test case
Add test case for BR 3026808 (%assign %$local).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-08 07:31:45 -07:00
H. Peter Anvin
3a014348ca insns: add FXSAVE64/FXRSTOR64, drop np prefix
Add FXSAVE64 and FXRSTOR64; drop the np prefix on 0F AE instructions:
none of the rest of the 0F AE instructions have them, and there are no
conflicts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-07 17:20:19 -07:00
H. Peter Anvin
9eb663c087 Merge branch 'master' of ssh://repo.or.cz/srv/git/nasm 2010-07-07 17:17:30 -07:00
H. Peter Anvin
a7407bb5c9 insns.dat: add XSAVE/XRSTOR64, XSAVEOPT, VCVTPH2PS/VCVTPS2PH
Add XSAVE64/XRSTOR64 (previously missing), XSAVEOPT/XSAVEOPT64 (per
AVX 007 spec), and VCVTPH2PS/VCVTPS2PH (per AVX 007) spec.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-07 13:48:14 -07:00
H. Peter Anvin
1b8423e1b8 insns.dat: remove VCVTPH2PS/VCVTPS2PH as AMD instructions
Remove VCVTPH2PS/VCVTPS2PH as AMD instructions based on version 3.04
of the AMD spec.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-06 19:38:35 -07:00
H. Peter Anvin
c66ec090a0 NASM 2.09rc2 2010-07-06 15:06:51 -07:00
Cyrill Gorcunov
f2c1cb06e0 doc: Update changes.src
Before soon-coming 2.09rc2.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-07 01:48:33 +04:00
H. Peter Anvin
1e3805f975 insns.dat: fix CPU flags for new instructions
FUTURE is a CPU level flag, and cannot be combined with X64 (which is
shorthand for X86_64,LONG).  Also, make sure we add LONG annotations
to everything that is 64-bit mode only.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-06 09:23:24 -07:00