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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>