Commit Graph

2213 Commits

Author SHA1 Message Date
Cyrill Gorcunov
71787fda1b 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>
2010-10-27 21:40:59 +04:00
H. Peter Anvin
db6975919c doc: fix spelling of "compatibility"
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-10-06 16:28:07 -07:00
Cyrill Gorcunov
af6be576ac NASM 2.09.02
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-18 02:57:06 +04:00
Cyrill Gorcunov
a28db5f3c2 doc/changes.src: Describe changes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-18 02:55:46 +04:00
Cyrill Gorcunov
ae7c916b6a Add test-case for BR3066383
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-18 02:48:53 +04:00
Cyrill Gorcunov
8bc8017df8 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 ec88c1be, 51fd86e0, 1f6741fc, 985d880c 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>
2010-09-18 02:48:42 +04:00
Cyrill Gorcunov
831222f244 changes.src: Describe changes for 2.09.02
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:13:48 +04:00
Cyrill Gorcunov
cb6032340a BR3064376: ndisasm crash
ndisasm may crash due to lack of check of VEX table index.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:12:52 +04:00
Cyrill Gorcunov
530c1eddf5 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>
2010-09-15 21:12:37 +04:00
Cyrill Gorcunov
ccba110e69 doc/nasmdoc.src: Fix octal number prefix misprint
Reported-by: Anthony <anthony@cloudnet.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:12:14 +04:00
H. Peter Anvin
2c11f97ca8 changes: document fixed token reversal for %deftok
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-09-15 08:59:12 -07:00
H. Peter Anvin
b40992c929 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>
2010-09-15 08:57:21 -07:00
Cyrill Gorcunov
e6e6a9ae2c NASM 2.09.01
A couple of NULL dereferences fixed.
See NASM version history in documentation.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 21:00:19 +04:00
Cyrill Gorcunov
234e4edce7 changes.src: Describe changes for 2.09.01
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:57:36 +04:00
Cyrill Gorcunov
bf11db6aca 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>
2010-09-07 20:55:03 +04:00
Cyrill Gorcunov
8fccbf33db Handle %substr invalid parameters preventing NULL dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:54:50 +04:00
Cyrill Gorcunov
e165c1b69a nasm_quote: Use memcpy only if length provided
No need to call memcpy on empty strings

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:54:39 +04:00
Cyrill Gorcunov
49cd6fbccf Fix NULL dereferences on %substr missing operands
%substr with dangling id issues SIGSEV. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 00:10:23 +04:00
Cyrill Gorcunov
e12c50d274 BR3060469: Fix SIGSEV on missed %deftok second parameter
In case if a second parameter of %deftok is missed we hit
NULL dereference. Fix it.

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-06 19:44:51 +04:00
H. Peter Anvin
2d3dce2fd7 doc: document the %use fp macro package
Documentation for %use fp was missing...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-08-24 09:55:27 -07:00
H. Peter Anvin
83baad7d9a NASM 2.09 2010-08-24 09:13:34 -07:00
H. Peter Anvin
e7854b98fd insns.pl: make insnsd.c a bit easier to read
Formatting changes (no object code difference) to insnsd.c for
readability.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-19 17:20:18 -07:00
H. Peter Anvin
5d62e57a0c ndisasm: handle VEX.LIG
A lot of instructions ignore the L bit in the VEX prefix, just like
a lot of instructions ignore the W bit, so don't use them in the
sub-table select.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-19 17:04:36 -07:00
H. Peter Anvin
23f0b16c21 ndisasm: unify VEX handling
Unify VEX handling between the 026x and 0270 bytecodes.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-19 16:59:35 -07:00
H. Peter Anvin
7023d638de ndisasm: fix handing of byte codes 250-253, 324
Fix handling of byte codes 250-253 (sign-extended 32-bit immediate,
extended to 64 bits) and 324 (instruction must have osize 64).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-08-16 22:13:14 -07:00
H. Peter Anvin
8810e0f794 NASM 2.09rc7 2010-08-16 15:24:01 -07:00
H. Peter Anvin
dbdb6d3df6 test/avx: remove deleted instructions
Remove the deleted VPERMIL2 instructions.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 15:23:16 -07:00
H. Peter Anvin
96ba233088 insns.dat: permit contracted forms for VBLENDVP
Allow implicit operands for VBLENDVP, just as for other instructions,
since the semi-legacy forms now are removed.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 15:22:21 -07:00
H. Peter Anvin
229fa6c465 assmemble.c: fix VEX.W logic
Fix the generation logic for VEX.W, which unfortunately got the wrong
constants.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 15:21:48 -07:00
H. Peter Anvin
cfe6d20e3a insns.dat: fix encoding of VCVTSD2SS
Fix typo in the definition of VCVTSD2SS.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 15:08:51 -07:00
H. Peter Anvin
c23c52040f insns.dat: SSE encoding of VBLEND with VEX prefix is forbidden
Version 7 of the AVX spec specifically forbids (#UD) using the
66 0F 38 14/15 forms of the BLENDV instructions with a VEX prefix;
those encodings are strictly legacy SSE 4.1.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 15:05:25 -07:00
H. Peter Anvin
0217039cdb insns.dat: updates from AVX v7
Updates from the AVX version 7 specification: mostly tightening of the
rules for VEX.L and VEX.W, but remove the VPERMIL2 instructions.

Also encode all the full-length forms of the VCMP instructions and
prefer those for the disassembly.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 14:57:09 -07:00
H. Peter Anvin
421059c689 assemble: handle vex.lig
AVX version 7 introduces the concept of .lig, meaning VEX.L is
ignored.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 14:56:33 -07:00
H. Peter Anvin
978c2170fc vex: change .wx to .wig to match the latest AVX spec
Change the .wx (ignore the W field) to .wig, to match the latest
version of the AVX specification.  This is not a functional change,
but just makes instruction patterns a little easier to write.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-16 13:48:43 -07:00
Cyrill Gorcunov
84a9e308c3 doc: Update -O option description
We use -Ox by default since Nasm-2.09 so "-O0" is not
longer "default" option. But first paragraph still has
the reference which confuses people. Get rid of it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-16 13:53:22 +04:00
Cyrill Gorcunov
327edcfc7a doc: Fix typo in changes.src
Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-16 13:47:24 +04:00
Keith Kanios
88d947e909 preproc.c: revamped context-local fall-through warning message 2010-08-14 12:47:45 -05:00
Keith Kanios
c71cb6b72a doc/nasmdoc.src: revamped context fall-through entry 2010-08-14 12:36:49 -05:00
Cyrill Gorcunov
e1b6e5712b doc: Describe context-through lookup
Feel free to update this text as well,
and check it please for being more/less
readable.

CC: Keith Kanios <keith@kanios.net>
CC: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-13 12:32:53 +04:00
H. Peter Anvin
e54805b30d LICENSE: update year
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-08-12 20:15:27 -07:00
Cyrill Gorcunov
8cb43d3f68 sectalign: Implement on/off mode
And describe it in documentation. We've introduced
sectalign in 2.09rc series and have to provide an
ability to steer this feature.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-12 19:09:28 +04:00
Cyrill Gorcunov
41b17b1e31 standart.mac: Style nitfix
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-12 18:47:52 +04:00
Cyrill Gorcunov
d90693c79c preproc.c: Context-through single macros expansion is deprecated
For now we inform users about their sources need to be
updated and also since _all_ context case are legit
for single macros only we split lookup into two phases:

1) Lookup in active context, which is perfectly valid
2) Lookup in external contexts, which will be deprecated soon.

If (2) happens we yield warning.

A typical testcase is
---
  %macro one 0
  %push
    %$a:
    %assign %$b 12
      %push
        mov eax, %$a
        mov eax, %$b  ; hit -- context through
      %pop
    %pop
  %endmacro
  one
---

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-11 20:31:46 +04:00
Keith Kanios
404589e558 preproc.c: modified deprecation warning for context-local label fallthrough 2010-08-10 20:12:57 -05:00
Cyrill Gorcunov
71f4f8426c preproc.c: Fix error message typo
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-09 20:17:17 +04:00
Cyrill Gorcunov
753a60de63 test: Add br3041451 testcase
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-09 18:47:05 +04:00
Cyrill Gorcunov
e091d6ed62 BR3041451: Implement upper bound for %rep counter
Since %rep counter is a 64 bit signed integer we have to use some
"maximum possible value" limit (upper bound) otherwise there may be
a situation when %rep counter is 0 or even negative while user
has been passing big positive integer value.

Reported-by: nasm64developer
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-09 18:35:35 +04:00
Keith Kanios
fe55e918fa preproc.c: added deprecation warning for context-local label fallthrough 2010-08-09 00:55:44 -05:00
Cyrill Gorcunov
73b34a5006 NASM 2.09rc6
It likely to be the last -rc before final relase.
Give it a good testing. We should be in pretty good
shape.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-06 19:25:17 +04:00
Cyrill Gorcunov
acf1cbb250 test: Add automatizing annotations to imm64.asm
H. Peter Anvin pointed
|
| Btw, test/imm64.asm needs test engine annotations.
|

Make it so.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-04 20:18:30 +04:00