Commit graph

2145 commits

Author SHA1 Message Date
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
H. Peter Anvin
0416b232ce Add RD*SBASE, WR*SBASE, RDRAND from AVX v7
Add the RD*SBASE, WR*SBASE and RDRAND instructions from version 7 of
the AVX specification, Intel document 319433-007.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-06 09:17:18 -07:00
Cyrill Gorcunov
4cc1064328 outbin: Cleanup bin_cleanup
No need for 'q' variable.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-06 19:40:02 +04:00
Cyrill Gorcunov
faf23d1302 outbin: Simplify reverse address computing
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-06 19:08:28 +04:00
Cyrill Gorcunov
2b416c9def BR3025702: outbin -- Fix byte ordering
In commit 55ae12052c we occasionally broke byte ordering. Fix it.
Note that current stable version 2.08.01 is not affected by this bug.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-06 18:33:29 +04:00
H. Peter Anvin
0d55110313 doc: inslist.src is an intermediate file, move to "make clean"
inslist.src is an intermediate file, it should be in "make clean"
rather than "make spotless"; otherwise it ends up in the xdoc tarball.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-25 13:40:10 -07:00
Cyrill Gorcunov
f85cd55731 BR 3020760: insns.dat -- confirm push imm32 on x86-64 explicitly
PUSH imm64 confuses ones who is trying to find this instruction in
processor programming manuals.

Actually it was introduced in a sake of "push `size' imm" consistency.
In other words -- to allow users to state "PUSH qword imm32" in 64bit code,
though on byte level (ie generated) code it still has a correct and valid
sign-extended "PUSH imm32" instruction.

To get rid of this ambiguie bite we make explicit "PUSH imm32"
being valid in 64bit code. This also makes "PUSH dword imm32"
valid in 64bit code as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-25 18:28:15 +04:00
Cyrill Gorcunov
efb358339d preproc.c: Get rid of signed/unsigned comparison warning
We need mac->nparam being explicictly int'fied otherwise
compiler issue a warning. Note that we might have been
using unsigned int but it would break an ability to pass
negative indices.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-20 01:52:19 +04:00
H. Peter Anvin
2df23513b3 BR 3018233: handle LFS, LGS and LSS with a 64-bit register
LFS, LGS and LSS are valid in 64-bit mode and have 64-bit (REX.W)
forms.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-18 16:24:46 -07:00
H. Peter Anvin
d68d9181df openwcom.mak: drop /f from delete commands
Classic DOS doesn't have del /f, and we don't really need it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-15 10:49:09 -07:00