Commit Graph

1339 Commits

Author SHA1 Message Date
H. Peter Anvin
4a532bc707 Document %unmacro 2008-09-03 14:31:20 -07:00
H. Peter Anvin
fafb6a50e2 outcoff: stylistic cleanups
Don't use explicit L's for things which are really size_t; not only is
it unnecessarily ugly, but it's wrong in a lot of ways.  Do some other
minor stylistic cleanups.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-02 12:56:39 -07:00
H. Peter Anvin
c00c897df7 outcoff: default output symbols to T_NULL
We would leave the output symbol type uninitialized.  Explicitly
initialize it to zero (T_NULL, meaning no symbol type information),
since that's what was effectively done.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-02 12:55:35 -07:00
H. Peter Anvin
91fb6f1626 BR 2048950: fix crash due to mmacro list overflow
When allocating the buffer for an mmacro list, we apparently failed to
guarantee space for the terminating NULL.  This almost certainly
caused the crash described in BR 2048950, and quite possibly BR
1284169.
2008-09-01 10:56:33 -07:00
H. Peter Anvin
5c10c17ba0 test/new: clean up whitespace 2008-08-29 18:04:16 -07:00
H. Peter Anvin
1c7cb9e28c Script to create new test case boilerplate 2008-08-29 17:27:00 -07:00
H. Peter Anvin
163e5874d9 Accept implicit memory size for VMREAD/VMWRITE 2008-08-28 18:05:23 -07:00
H. Peter Anvin
5e7d6f1105 BR 2029472: Wrong operand size for VMREAD/VMWRITE in 64-bit mode
Fix the operand size for VMREAD/VMWRITE in 64-bit mode
2008-08-28 18:03:49 -07:00
H. Peter Anvin
c5b37dbf5e .gitignore: ignore some editor backup files
Ignore a couple of variants of editor backup files.
2008-08-28 17:56:17 -07:00
H. Peter Anvin
dd1de39ece BR 2028995: Missing MOVNTI m64, r64
Fix MOVNTI with a 64-bit argument.
2008-08-28 17:54:55 -07:00
H. Peter Anvin
3ba3af3290 Testcase for XCRYPT 2008-08-28 17:48:34 -07:00
H. Peter Anvin
962e30519c BR 2029829: Accept VIA XCRYPT instructions with or without REP
Accept the VIA XCRYPT instructions either with or without a REP
prefix, as documented.

Add the missing XCRYPTCTR instruction.
2008-08-28 17:47:16 -07:00
H. Peter Anvin
7b4dc622c6 BR 2039212: Handle indirect far jumps in 64-bit mode
Handle indirect far jumps in 64-bit mode.  Default to 64 bit unless
overridden, for consistency with other jumps.
2008-08-28 17:35:25 -07:00
H. Peter Anvin
5eff8912bc Include "nasm.h" in "float.h"
"float.h" references efunc, so it needs "nasm.h".
It also has uint8_t and so need <inttypes.h>, but that's part of
"nasm.h".
2008-08-28 13:36:10 -07:00
H. Peter Anvin
04f54809d2 Add 256-bit AVX stores per the latest AVX spec.
Add 256-bit forms of VMOVNTPD, VMOVNTPS, and VMOVNT[DQ]Q.
2008-08-27 18:47:05 -07:00
H. Peter Anvin
06425512ae Add AVX forms of the AES instructions (new in the latest AVX spec)
The AES instructions, too, have gotten VEX forms.
2008-08-27 18:42:26 -07:00
H. Peter Anvin
dace226187 test: Fix file with no final newline
Fix test/br2030823.asm, which had no final newline.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-08-24 18:17:09 -07:00
H. Peter Anvin
51e403152a BR 2067820: add the MOVSXD instruction
The official mnemonic for 32-to-64-bit sign extension is MOVSXD for
some idiotic reason.  Add support for it while continue to recognize
MOVSX for this as an alias.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-08-24 18:12:20 -07:00
H. Peter Anvin
19f15a50f6 BR 2067837: remove double add of VEX instruction length
We added the length of VEX prefixes twice in calcsize(); this resulted
in the wrong symbol addresses when compiling without the optimizer.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-08-24 18:09:04 -07:00
H. Peter Anvin
83b2e4f82c BR 2062342: ndisasm: r12 *can* be an index register
R12 can be used as an index register.  Special encodings in the modr/m
byte are done *without* consideration for the REX prefix, but special
encodings in the SIB byte *do* take the REX prefix into consideration,
since it doesn't affect the overall instruction format.
2008-08-20 09:42:47 -07:00
H. Peter Anvin
2a09b3bf11 BR 2030823: Problem with the 256-bit FMA instructions
Fix the 256-bit FMA instructions per bug report.
2008-08-13 16:25:08 -07:00
H. Peter Anvin
38c6b44909 BR 2043111: Typo in insns.dat: VCMPFT_OQPD VCMPFT_OQPS
Fix typo
2008-08-13 16:18:23 -07:00
Victor van den Elzen
a21194646a minor bugfix in performtest.pl 2008-08-06 15:15:01 +02:00
Victor van den Elzen
22343c2c72 Add macro-defaults warning class and documentation. 2008-08-06 14:48:55 +02:00
H. Peter Anvin
932de6c252 BR 2034542: fix crash when touching __FILE__
Touching __FILE__ would cause a dereference of an uninitialized
pointer.  Fix.
2008-07-31 18:46:11 -07:00
H. Peter Anvin
f7d863b7d1 BR 2028910: fix decoding of VEX prefixes in 16- and 32-bit mode
We would incorrectly set a bunch of VEX-related state for C4 and C5
bytes, even though we had already rejected it as not a VEX prefix due
to the top two bits of the following byte not being 11.
2008-07-30 17:30:12 -07:00
H. Peter Anvin
ecf8c3e382 BR 2025977: Handle SLDT with a 64-bit register operand
Handle SLDT with a 64-bit register operand.  Don't generate a REX.W
prefix in the assembler, since zero-extending is just fine, but do
support it in the disassembler.
2008-07-30 17:28:05 -07:00
H. Peter Anvin
ca348b6343 preproc: restore correct break; in do_directive()
Checkin a26433db68 incorrectly changed a
few break;s in do_directive() that were *inside loops* to returns.
This broke single-line macros as well as %exitrep; fix.
2008-07-23 10:52:43 -04:00
Victor van den Elzen
b916edecf4 BR 560960: warn about trailing garbage in %macro/%ifmacro 2008-07-23 15:14:22 +02:00
Victor van den Elzen
0e857f1fe5 Improve checking and documentation for %ifctx 2008-07-23 13:21:29 +02:00
H. Peter Anvin
bb266eaa4b BR 2023036: MOV reg32,dreg and vice versa are NOLONG
MOV reg32,dreg and MOV dreg,reg32 are NOLONG; in 64-bit mode we always
move to/from reg64.
2008-07-20 14:59:18 -07:00
H. Peter Anvin
0303f3b6f7 Err, "alignr" was really the same as the previous "alignb"
Replace "alignb" with the (slightly more optimized) "alignr" macro,
but keep the name "alignb".
2008-07-20 09:40:14 -07:00
H. Peter Anvin
aad26229b7 Add "alignr" standard macro (using resb)
Add an "alignr" standard macro, for use in BSS (nobits) and absolute
segments.
2008-07-20 09:32:31 -07:00
H. Peter Anvin
a70547f3ae Avoid redundant "const" for macros_t
Don't use a redundant "const" for macros_t (which is const unsigned
char), since OpenWatcom doesn't like it, and I believe it is incorrect
per the C standard.
2008-07-19 21:44:26 -07:00
H. Peter Anvin
289ff7e2a8 BR 2003451: add test case
Add test case for BR 2003451: forwardness leakage between operands.
2008-07-19 21:40:07 -07:00
H. Peter Anvin
1c3277b625 BR 2003451: avoid "forwardness" leaks between operands
Any use of ins->forw_ref that isn't related to control of the
optimizer is fundamentally broken.  Use
operand->opflags & OPERAND_FORWARD instead.  This even has the nice
side benefit of simplifying the code.
2008-07-19 21:38:56 -07:00
Slavik Gnatenko
1b67bd25b2 BR 2010180: outobj: Garbage may be written in a last PUBDEF
The testcase illustrates the problem. After "nasm -f obj
alonesym.nasm"
let's look to dump:

======
PUBDEF386(91) recnum:5, offset:0000005bh, len:03f9h, chksum:bbh(bb)
Group: 0, Seg: 1
00020000h - 'sym0000' Type:0
00020004h - 'sym0001' Type:0
....
00020134h - 'sym0077' Type:0

PUBDEF(90) recnum:6, offset:00000457h, len:000ah, chksum:b6h(b6)
Group: 0, Seg: 1
00000138h - 's' Type:2
0000b600h - '' Type:0
======

The problem is while 's' offset is 20138h it is marked as type 90h not
91h.  The root cause is located in obj_x():

static ObjRecord *obj_x(ObjRecord * orp, uint32_t val)
{
    if (orp->type & 1)
    	orp->x_size = 32;
    if (val > 0xFFFF)
        orp = obj_force(orp, 32);
    if (orp->x_size == 32)
        return (obj_dword(orp, val));
    orp->x_size = 16;
    return (obj_word(orp, val));
}

It sets up x_size and than writes data. In the testcase data are the
offset and this offset overflows a record. In this case the record is
emitted and its x_size is cleared. Because this is last PUBDEF the new
record with only 's' symbol is emitted also but its x_size is not 32
(it's still zero) so obj_fwrite doesn't switch to 91h type.

The problem seems to be very generic and expected to be occurred on
many other record types as well.

        ----

And the fix is simple:

if (orp->x_size == 32)
{
  ObjRecord * nxt = obj_dword(orp, val);
  nxt->x_size = 32; /* x_size is cleared when a record overflows */
  return nxt;
}
2008-07-19 19:27:41 -07:00
H. Peter Anvin
4fb7ed0566 test: more smart alignment test 2008-07-17 14:29:07 -07:00
H. Peter Anvin
7f0ac96fed smartalign: use context-local label
Use a context-local label in the smart align macro.
2008-07-17 14:28:29 -07:00
H. Peter Anvin
ca66ec5eec smartalign: adjust the alignment threshold
Apparently the current recommendation is for a smaller threshold when
using the "generic"-style alignment macros (short jumps are cheaper on
newer CPUs.)

Also change the alignment threshold definition to reflect the maximum
number of padding instead of when to start using jumps.
2008-07-17 14:22:10 -07:00
H. Peter Anvin
1ac41d34ba smartalign: 16-bit generic alignment macros
Smart alignment content for 16-bit "generic" mode
2008-07-17 14:20:06 -07:00
H. Peter Anvin
47b0c2d428 smartalign: 16-bit P6 NOPs
Add 16-bit P6 NOPs
2008-07-17 14:13:53 -07:00
H. Peter Anvin
f5975eead1 smartalign.mac: smart alignments macro package
"%use smartalign" followed by an optional "alignmode" can be used to
enable smart macros.
2008-07-16 14:41:39 -07:00
H. Peter Anvin
a26433db68 preproc: add %un[i]macro, add cleanups
Add %un[i]macro, and a few stylistic cleanups.

Note: unlike %undef, %un[i]macro takes an argument specification,
which must *exactly* match the macro being undefined.  Similarly,
%unimacro has to be used to undefine a macro defined with %imacro, and
vice versa.
2008-07-16 14:40:01 -07:00
H. Peter Anvin
f9a725aeb7 standard.mac: allow non-power-of-2 alignments
Allow aligning to a non-power-of-2 boundary.  It's probably useless,
but doesn't really hurt.
2008-07-16 14:38:58 -07:00
H. Peter Anvin
90e6e811c9 preproc.c: fix %ifn, %elifn
The sense of %ifn and %elifn was reversed due to a bogus nonstandard
return sequence.
2008-07-16 14:38:24 -07:00
Victor van den Elzen
819703afce Fix multipass inline warning (dis/en)abling
Also add a new form: resetting warnings to their original value.
2008-07-16 15:20:56 +02:00
Victor van den Elzen
8f1120ff47 Fix %rep ... %endmacro crash
Also improved a comment and an error message.
2008-07-16 13:41:37 +02:00
Victor van den Elzen
1f1f38bcd0 update tests 2008-07-16 12:20:26 +02:00
Victor van den Elzen
c7deefaa3a fix unitialized variable in eval_strfunc 2008-07-16 12:20:25 +02:00