Commit graph

2235 commits

Author SHA1 Message Date
Cyrill Gorcunov
e6775697bb test: Add br3074517.asm
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-24 15:25:59 +04:00
Cyrill Gorcunov
4a35008733 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-09-24 15:24:42 +04:00
H. Peter Anvin
0e7370cfa6 phash: move sample function to the sample file
read_input() shouldn't be part of the phash.ph module; instead it
should go into the sample usage file phash.pl.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-09-22 14:02:28 -07:00
Cyrill Gorcunov
8fe1f65087 Merge branch 'nasm-2.09.xx' 2010-09-18 02:59:08 +04: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
14ad688d35 Merge branch 'nasm-2.09.xx' 2010-09-15 21:18:01 +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
c1ade75944 Merge branch 'nasm-2.09.xx' 2010-09-15 08:59:51 -07: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
84b4cbab54 preproc.c: Get rid of new TABs brought in recently
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-12 21:39:40 +04:00
Cyrill Gorcunov
9e1c9ce8e9 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-12 13:37:53 +04:00
Cyrill Gorcunov
5ace91d681 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-12 02:07:06 +04:00
Cyrill Gorcunov
9bcdd21efd doc/nasmdoc.src: Fix octal number prefix misprint
Reported-by: Anthony <anthony@cloudnet.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-10 22:40:27 +04:00
Cyrill Gorcunov
e2457c76d1 eval.c: Use OPFLAG_FORWARD instead of opencoded number
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-10 01:02:12 +04:00
Cyrill Gorcunov
55ce00907e Merge branches 'master' and 'nasm-2.09.xx' 2010-09-07 21:16:06 +04: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
cff031e1f7 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:31:11 +04:00
Cyrill Gorcunov
ab12287b4c Handle %substr invalid parameters preventing NULL dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 19:10:15 +04:00
Cyrill Gorcunov
a26efa45d8 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 19:10:10 +04:00
Cyrill Gorcunov
35519d6719 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:11:47 +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
Cyrill Gorcunov
6908e58560 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:36:15 +04:00
Cyrill Gorcunov
68a344003a parser.c: Drop space line and use hex notation
For big numbers it's easier to estimate bytes count
if they are written in hex notation. Let it be so.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-27 23:25:04 +04:00
H. Peter Anvin
21d4ccc3c3 BR 3052618: handle segment register operations in 64-bit mode
Handle segment register operations in 64-bit mode, and add a few
optimization patterns.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 17:30:00 -07:00
H. Peter Anvin
96e8d96045 doc: untabify
Fix tab-related problems

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 14:20:40 -07:00
H. Peter Anvin
d68466a33d doc: override optimization with STRICT
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 14:14:48 -07:00
H. Peter Anvin
af5cb1b4de doc: document imm64 optimization
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 14:13:32 -07:00
H. Peter Anvin
9df010725f Optimize mov r64,imm
Handle immediate-size optimization for "mov r64,imm" -- reduce it to
"mov r32,imm32" or "mov r64,imm32" as appropriate.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 14:08:16 -07:00
H. Peter Anvin
47fb7bc088 assemble: add an OPT instruction flags for optimizing assembly only
Add an OPT flag to only use a pattern for optimizing assembly only.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 13:53:22 -07: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