platform/upstream/nasm.git
16 years agoThe POPCNT instruction does not need sizes on memory operands
H. Peter Anvin [Thu, 6 Nov 2008 17:39:48 +0000 (09:39 -0800)]
The POPCNT instruction does not need sizes on memory operands

The POPCNT instruction should not require sizes on memory operands.
Add the appropriate size flags for that to work.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR 2229703: POPCNT r64,rm64 not POPCNT r64,rm32
H. Peter Anvin [Thu, 6 Nov 2008 17:35:02 +0000 (09:35 -0800)]
BR 2229703: POPCNT r64,rm64 not POPCNT r64,rm32

The 64-bit version of the POPCNT instruction takes r64,rm64; not
r64,rm32.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: BR 2222615: fix segfault on bogus %ifmacro
H. Peter Anvin [Tue, 4 Nov 2008 22:24:34 +0000 (14:24 -0800)]
preproc: BR 2222615: fix segfault on bogus %ifmacro

BR 2222615: Fix segmentation fault on %ifmacro without an argument.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: fix typo in the description of %unmacro
H. Peter Anvin [Thu, 30 Oct 2008 03:46:30 +0000 (20:46 -0700)]
doc: fix typo in the description of %unmacro

The description of %unmacro used %unmacro in a place which should
obviously have been %macro.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: fix capitalization
H. Peter Anvin [Thu, 30 Oct 2008 01:17:59 +0000 (18:17 -0700)]
doc: fix capitalization

Make the capitalization of "The -t Option" consistent with the other
options.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: remove duplicate entry for the "error" warning class
H. Peter Anvin [Thu, 30 Oct 2008 01:16:31 +0000 (18:16 -0700)]
doc: remove duplicate entry for the "error" warning class

Remove duplicate entry for the "error" warning class; leave at the end
with "all", as being another meta-warning class.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: retroactively document updates to the warning options
H. Peter Anvin [Thu, 30 Oct 2008 01:14:03 +0000 (18:14 -0700)]
doc: retroactively document updates to the warning options

Retroactively document the following changes to the warning options:

  - gcc-like syntax (-Wfoo, -Wno-foo)
  - "all" alias
  - "error" metawarning

Added in 2.00rc1 but never documented.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05.01
H. Peter Anvin [Wed, 29 Oct 2008 17:52:53 +0000 (10:52 -0700)]
NASM 2.05.01

16 years agodoc/changes.src: document -W/-w fix as a NASM 2.05.01 feature.
H. Peter Anvin [Wed, 29 Oct 2008 17:51:51 +0000 (10:51 -0700)]
doc/changes.src: document -W/-w fix as a NASM 2.05.01 feature.

Make -W/-w fix a release note for NASM 2.05.01.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBetter description of the number-overflow warning
H. Peter Anvin [Sun, 26 Oct 2008 15:59:04 +0000 (08:59 -0700)]
Better description of the number-overflow warning

Better grammar and fix incorrect description of the number-overflow
warning (it is not just limited to 64-bit arithmetic overflow, it also
triggers when trying to squeeze in a value which is too large into an
immediate.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR: 2196966: make the -w/-W options work again
H. Peter Anvin [Sun, 26 Oct 2008 15:57:13 +0000 (08:57 -0700)]
BR: 2196966: make the -w/-W options work again

The code to parse the -w/-W options was updating warning_on[], not
warning_on_global[], but warning_on[] is reset at the beginning of
each pass (to let the warning directive work); as a result the -w/-W
options don't actually do anything at all.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoWhen issuing warnings for EA displacements, use the *EA* operand
H. Peter Anvin [Fri, 24 Oct 2008 03:49:09 +0000 (20:49 -0700)]
When issuing warnings for EA displacements, use the *EA* operand

When issuing warnings for EA displacements during address generation,
actually look a the proper operand!

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05
H. Peter Anvin [Fri, 24 Oct 2008 02:42:17 +0000 (19:42 -0700)]
NASM 2.05

16 years agodoc/changes.src: update release notes
H. Peter Anvin [Fri, 24 Oct 2008 02:29:28 +0000 (19:29 -0700)]
doc/changes.src: update release notes

Update the release notes in preparation for NASM 2.05.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoThe CRC32 instructions can take 66 prefixes as well as F2
H. Peter Anvin [Thu, 23 Oct 2008 23:39:25 +0000 (16:39 -0700)]
The CRC32 instructions can take 66 prefixes as well as F2

The CRC32 instructions require F2, but can also take a 66 prefix to
set the operand size.  This is not the SSE model of prefix extension.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/crc32.asm: test the CRC32 instruction
H. Peter Anvin [Thu, 23 Oct 2008 23:24:02 +0000 (16:24 -0700)]
test/crc32.asm: test the CRC32 instruction

Test for the CRC32 instruction.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR 2190521: fix the CRC32 opcodes
H. Peter Anvin [Thu, 23 Oct 2008 23:23:19 +0000 (16:23 -0700)]
BR 2190521: fix the CRC32 opcodes

A stray \1 bytecode was hiding in the CRC32 opcodes, causing complete
havoc.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc8
H. Peter Anvin [Wed, 22 Oct 2008 18:23:18 +0000 (11:23 -0700)]
NASM 2.05rc8

16 years agoBR 2187210: Fix PFRCPV and PFRSQRTV
H. Peter Anvin [Wed, 22 Oct 2008 18:18:27 +0000 (11:18 -0700)]
BR 2187210: Fix PFRCPV and PFRSQRTV

Fix the Geode instructions PFRCPV and PFRSQRTV per bug report 2187210.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoassemble: not all backends handle intra-segment OUT_REL*ADR
H. Peter Anvin [Wed, 22 Oct 2008 18:15:00 +0000 (11:15 -0700)]
assemble: not all backends handle intra-segment OUT_REL*ADR

Not all backends can handle being handled an intrasegment OUT_REL*ADR,
and we don't fix them up in common code either (which would be the
logical thing to do -- right now we fix them up in a bunch of
individual places.)

For now, just fix up the one in address generation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR 2148448: fix relative addresses in bin output
H. Peter Anvin [Wed, 22 Oct 2008 18:03:09 +0000 (11:03 -0700)]
BR 2148448: fix relative addresses in bin output

The "bin" format was misinterpreting the overloading of the "size"
argument to out(), which caused another source of 64-bit relative
offset errors.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoUpdate .gitignore to include additional generated files
H. Peter Anvin [Mon, 20 Oct 2008 05:25:11 +0000 (22:25 -0700)]
Update .gitignore to include additional generated files

pptok.ph and doc/inslist.src are generated files; list them in
.gitignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc7
H. Peter Anvin [Sun, 19 Oct 2008 21:53:48 +0000 (14:53 -0700)]
NASM 2.05rc7

16 years agoELF64: once again, fix generation of "naked" OUT_REL*ADR
H. Peter Anvin [Sat, 18 Oct 2008 18:29:11 +0000 (11:29 -0700)]
ELF64: once again, fix generation of "naked" OUT_REL*ADR

It is unclear if we will ever see any "naked" (absolute bytes)
OUT_REL*ADR coming from the assembler, but if we do, we should
generate them correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc6
H. Peter Anvin [Sat, 18 Oct 2008 06:37:43 +0000 (23:37 -0700)]
NASM 2.05rc6

16 years agodoc/changes.src: document massive changes to ELF64 backend
H. Peter Anvin [Sat, 18 Oct 2008 06:36:45 +0000 (23:36 -0700)]
doc/changes.src: document massive changes to ELF64 backend

We didn't just fix the GOT stuff, but also now properly use RELA and
so forth.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: PLT32, GOTPCREL, and GOTPCREL64 really need exactitude
H. Peter Anvin [Sat, 18 Oct 2008 06:32:40 +0000 (23:32 -0700)]
ELF64: PLT32, GOTPCREL, and GOTPCREL64 really need exactitude

Now when the assembler is properly generating the address that we push
down to the backend, enable requesting an exact value for these
relocations (these are pointing to a specific GOT or PLT slot; the
addend is used to adjust the computed value in the instruction, not
for offset for the symbol.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: the "size" argument to OUT_REL*ADR isn't really the size
H. Peter Anvin [Sat, 18 Oct 2008 06:30:54 +0000 (23:30 -0700)]
ELF64: the "size" argument to OUT_REL*ADR isn't really the size

The "size" argument to the OUT_REL*ADR output types is actually
intra-instruction offset, not the actual size.  Thus, emit the size
properly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoassemble: for OUT_REL*ADR, the "size" argument is not really size...
H. Peter Anvin [Sat, 18 Oct 2008 06:29:11 +0000 (23:29 -0700)]
assemble: for OUT_REL*ADR, the "size" argument is not really size...

For OUT_REL*ADR, the "size" argument is actually the offset inside the
instruction; that is in fact why we encode the real size in the
instruction itself.  Thus, emit the offsets properly using this
mechanism when generating relative EAs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/elf64so.asm: demonstrate a case where we bind to the wrong symbol
H. Peter Anvin [Sat, 18 Oct 2008 06:14:53 +0000 (23:14 -0700)]
test/elf64so.asm: demonstrate a case where we bind to the wrong symbol

Show an artificial case where we bind to the wrong symbol, due to the
confusion in the output system between the size of relative symbols
and their position.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: actually generate relative GOT/PLT references correctly
H. Peter Anvin [Sat, 18 Oct 2008 06:06:46 +0000 (23:06 -0700)]
ELF64: actually generate relative GOT/PLT references correctly

Fix the arithmetic for relative GOT/PLT references.

We still can't enable exactitude, because of the assumption that
"size" is always the proper adjustment for the offset of the
displacement inside the instruction, which is wrong in the case of
displacements that are followed by an immediate.  This also affects
the list file, so it really should be fixed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/Makefile: enable debugging info for elftest/elftest64
H. Peter Anvin [Sat, 18 Oct 2008 06:03:04 +0000 (23:03 -0700)]
test/Makefile: enable debugging info for elftest/elftest64

Enable debugging information for the ELF tests.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: GOTOFF64 doesn't need a gsym at all
H. Peter Anvin [Sat, 18 Oct 2008 05:22:17 +0000 (22:22 -0700)]
ELF64: GOTOFF64 doesn't need a gsym at all

GOTOFF64 is used for local variables (as a 64-bit offset from the GOT;
only needed in the Medium PIC or Large PIC models.)  It therefore
should *not* be a elf_add_gsym_reloc() invocation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: We apparently don't need exactitude for GOTOFF64
H. Peter Anvin [Sat, 18 Oct 2008 05:11:20 +0000 (22:11 -0700)]
ELF64: We apparently don't need exactitude for GOTOFF64

I am having a bit of a hard time understanding the proper operation of
the "exact" flag to elf_add_gsym_reloc().  We apparently won't
generate proper GOTOFF64 relocations with this flag set; it is
possible that there are *no* proper uses of this flag.  This clearly
needs to be figured out.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoelftest64: both Small PIC and Medium PIC model tests
H. Peter Anvin [Sat, 18 Oct 2008 05:10:33 +0000 (22:10 -0700)]
elftest64: both Small PIC and Medium PIC model tests

Try both Small PIC and Medium PIC model references.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: GOT and PLT references need a symbol (a slot!) to reference
H. Peter Anvin [Sat, 18 Oct 2008 03:01:16 +0000 (20:01 -0700)]
ELF64: GOT and PLT references need a symbol (a slot!) to reference

GOT and PLT references need a symbol; after all, they reference a GOT
or PLT slot.  Thus, they need elf_add_gsym_reloc().  Mungify the
interface so that they can communicate the need for the PC-shifted
offset into the relocation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: unbreak generating no-segment addresses
H. Peter Anvin [Sat, 18 Oct 2008 02:32:10 +0000 (19:32 -0700)]
ELF64: unbreak generating no-segment addresses

When generating an address that is *not* tied to a symbol, we just
want to emit the bytes.  I believe the assembler is already supposed
to do that for us, but just in case, do it right here too.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoSAA: add saa_writeaddr() similar to other locations
H. Peter Anvin [Sat, 18 Oct 2008 02:30:34 +0000 (19:30 -0700)]
SAA: add saa_writeaddr() similar to other locations

Provide saa_writeaddr() to write an integer in x86 format.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/Makefile: the elftest objects depend on $(NASM)
H. Peter Anvin [Sat, 18 Oct 2008 02:29:15 +0000 (19:29 -0700)]
test/Makefile: the elftest objects depend on $(NASM)

If NASM has changed, we logically want to re-run the ELF tests...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: use the RELA addend field instead of relying on the code stream
H. Peter Anvin [Sat, 18 Oct 2008 01:23:29 +0000 (18:23 -0700)]
ELF64: use the RELA addend field instead of relying on the code stream

The x86-64 ABI wants the symbol addend to reside in the addend field
of the RELA relocation, not in the code stream.  Apparently it's
something one can get away with, but the linker would still botch it
for some cases.  Change it so we pass the proper output and emit zero
into the code stream.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoTest and Makefile rules for 32- and 64-bit ELF shared libraries
H. Peter Anvin [Sat, 18 Oct 2008 00:13:26 +0000 (17:13 -0700)]
Test and Makefile rules for 32- and 64-bit ELF shared libraries

Add Makefile rules for the 32-bit ELF shared library test, and add a
64-bit ELF shared library test (still work in progress.)

16 years agoNASM 2.05rc5
H. Peter Anvin [Thu, 16 Oct 2008 20:05:09 +0000 (13:05 -0700)]
NASM 2.05rc5

16 years agoTest for BR 2172659
H. Peter Anvin [Thu, 16 Oct 2008 20:03:40 +0000 (13:03 -0700)]
Test for BR 2172659

Test for the bug fix for BR 2172659 (invalid byte-sized immediates.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR 2172659: Fix incorrect output value for byte operands
H. Peter Anvin [Thu, 16 Oct 2008 20:01:43 +0000 (13:01 -0700)]
BR 2172659: Fix incorrect output value for byte operands

A typo in checkin c1377e9a98dd5ca6f7900c048df5d346d1733d05 caused a
bunch of signed-byte immediates to incorrectly be issued as zero.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoAdd reference to %+ from macro parameter concatenation
H. Peter Anvin [Wed, 15 Oct 2008 23:18:17 +0000 (16:18 -0700)]
Add reference to %+ from macro parameter concatenation

Add a reference to the %+ operator from the section on macro parameter
concatenation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: minor editorial change
H. Peter Anvin [Wed, 15 Oct 2008 23:14:39 +0000 (16:14 -0700)]
doc: minor editorial change

Use the terms "defined" and "expanded" for single-line macros more
consistently.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoELF64: fix various GOT relocations
H. Peter Anvin [Wed, 15 Oct 2008 22:23:18 +0000 (15:23 -0700)]
ELF64: fix various GOT relocations

Try to make the various GOT relocations do the right thing in ELF64,
including erring out when appropriate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoTest for various ELF64 GOT references
H. Peter Anvin [Wed, 15 Oct 2008 22:22:03 +0000 (15:22 -0700)]
Test for various ELF64 GOT references

Try to test for various GOT references in ELF64.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: add link to the macro packages when talking about them
H. Peter Anvin [Wed, 15 Oct 2008 18:15:48 +0000 (11:15 -0700)]
doc: add link to the macro packages when talking about them

When discussing the standard macro packages in the context of
__USE_*__ macros, link to them as well as to the %use directive.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR 2164053: --prefix _ not --prefix_
H. Peter Anvin [Mon, 13 Oct 2008 17:17:27 +0000 (10:17 -0700)]
BR 2164053: --prefix _ not --prefix_

The --prefix option takes a separate argument, not an attached
argument.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc4
H. Peter Anvin [Mon, 13 Oct 2008 04:17:34 +0000 (21:17 -0700)]
NASM 2.05rc4

16 years agoDocument RIP-relative GOT fixes in ELF64
H. Peter Anvin [Mon, 13 Oct 2008 04:17:04 +0000 (21:17 -0700)]
Document RIP-relative GOT fixes in ELF64

16 years agoFix typo in previous outelf64.c commit
Charles Crayne [Sun, 12 Oct 2008 21:14:45 +0000 (14:14 -0700)]
Fix typo in previous outelf64.c commit

Stray line fragment left in when removing debug code.

16 years agoRIP rel relocations for PIC released for testing.
Charles Crayne [Sun, 12 Oct 2008 21:00:11 +0000 (14:00 -0700)]
RIP rel relocations for PIC released for testing.

Expressions like
  mov r15,[rel integer wrt ..got]
  lea   rax,[rel integer wrt ..gotoff]
now assemble correctly.

In addition, a fix has been made to the corresponding
abs relocations.

Both of these areas still need additional testing.

16 years agoassemble.c: use case4() macros like in disasm.c
H. Peter Anvin [Thu, 9 Oct 2008 22:37:10 +0000 (15:37 -0700)]
assemble.c: use case4() macros like in disasm.c

Use the case4() macros as we already do in disasm.c.  It helps reduce
visual clutter, and more clearly demonstrates that groups of four
belong together.  Furthermore, it makes the text compact enough that
we can now use case statements to mask down the EA patterns correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodisasm: collapse all the segment register push/pop bytecodes
H. Peter Anvin [Thu, 9 Oct 2008 21:15:36 +0000 (14:15 -0700)]
disasm: collapse all the segment register push/pop bytecodes

As far as the disassembler is concerned, the segment register push/pop
bytecodes can be collapsed to a simple expression; the remaining
differences are handled by the filter expressions in insns.pl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/pushseg.asm: add "pop cs"
H. Peter Anvin [Thu, 9 Oct 2008 06:32:33 +0000 (23:32 -0700)]
test/pushseg.asm: add "pop cs"

"pop cs" is an 8086-only opcode; we support it for assembly but not
for disassembly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/pushseg.asm: test for push/pop of segment registers
H. Peter Anvin [Thu, 9 Oct 2008 06:30:41 +0000 (23:30 -0700)]
test/pushseg.asm: test for push/pop of segment registers

Simple test for push/pop of segment registers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoReshuffle and move the bytecodes for segment register push/pop
H. Peter Anvin [Thu, 9 Oct 2008 04:17:32 +0000 (21:17 -0700)]
Reshuffle and move the bytecodes for segment register push/pop

Reshuffle the bytecodes for segment register push/pop to make more
sense, and move them from \4 to \344, thus freeing up the single-digit
bytecodes \4..\7 for future use.  It doesn't really make sense to use
single-digit bytecodes for this very oddball use.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoCollect statistics on bytecode use in insnsb.c
H. Peter Anvin [Wed, 8 Oct 2008 23:56:35 +0000 (16:56 -0700)]
Collect statistics on bytecode use in insnsb.c

We are starting to have to worry about running short on available
bytecodes, especially where we encode the operand number in the byte
code.  Thus, compile a table of bytecode usage and include as a
comment in insnsb.c.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc3
H. Peter Anvin [Wed, 8 Oct 2008 23:25:26 +0000 (16:25 -0700)]
NASM 2.05rc3

16 years agotest/imul.asm: remove obsolete ERROR marker
H. Peter Anvin [Tue, 7 Oct 2008 23:53:49 +0000 (16:53 -0700)]
test/imul.asm: remove obsolete ERROR marker

Error already fixed...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoTest for various IMUL patterns
H. Peter Anvin [Tue, 7 Oct 2008 18:28:29 +0000 (11:28 -0700)]
Test for various IMUL patterns

Test for IMUL patterns.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoAdd missing IMUL pattern: reg64,imm8
H. Peter Anvin [Tue, 7 Oct 2008 18:26:41 +0000 (11:26 -0700)]
Add missing IMUL pattern: reg64,imm8

Make "imul rax,byte 5" work as expected.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoAdd a few missing \15 -> \275 conversions
H. Peter Anvin [Tue, 7 Oct 2008 17:56:32 +0000 (10:56 -0700)]
Add a few missing \15 -> \275 conversions

Add a few \15 -> \275 conversions that had been missed earlier.
Still haven't done the work on IMUL.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoChange \40 class opcodes to \254, except IMUL
H. Peter Anvin [Tue, 7 Oct 2008 17:53:08 +0000 (10:53 -0700)]
Change \40 class opcodes to \254, except IMUL

Change \40 class opcodes which need to be changed to \254.  IMUL will
need a separate audit; I'm not convinced we are really sure what all
the IMUL conditions should be.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNew opcode for 32->64 bit sign-extended immediate with warning
H. Peter Anvin [Tue, 7 Oct 2008 17:05:10 +0000 (10:05 -0700)]
New opcode for 32->64 bit sign-extended immediate with warning

Add a new opcode for 32->64 bit sign-extended immediate, with warning
on the number not matching.

This unfortunately calls for an audit of all the \4[0123] opcodes, if
they should be replaced by \25[4567].  This only replaces one
instruction (MOV reg64,imm32); other instructions need to be
considered.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/immwarn.asm: add a few more non-warning tests
H. Peter Anvin [Tue, 7 Oct 2008 16:59:18 +0000 (09:59 -0700)]
test/immwarn.asm: add a few more non-warning tests

A few non-warning conditions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoRemove is_sbyte64() and replace with is_sbyte32() plus custom warning
H. Peter Anvin [Tue, 7 Oct 2008 16:56:38 +0000 (09:56 -0700)]
Remove is_sbyte64() and replace with is_sbyte32() plus custom warning

is_sbyte64() was equivalent to is_sbyte32() plus the warning; however,
the warning is only used in one place (and conflicts with another
warning there), so remove the function.

Furthermore, add back the test for pure immediates in
possible_sbyte(); they had been broken out but never folded back in --
and are essential.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoAvoid double warning for signed dword immediate
H. Peter Anvin [Tue, 7 Oct 2008 06:47:58 +0000 (23:47 -0700)]
Avoid double warning for signed dword immediate

Avoid double warning for the case where a signed dword immediate is
incorrectly extended to 64 bits.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNew opcodes to deal with 8-bit immediate sign extended to opsize
H. Peter Anvin [Tue, 7 Oct 2008 06:40:31 +0000 (23:40 -0700)]
New opcodes to deal with 8-bit immediate sign extended to opsize

New opcodes to deal with 8-bit immediates which are then sign-extended
to the operand size.  These allow us to warn appropriately.
Not sure I'm using these in all the proper places; need audit of all
uses of the \14..\17 opcodes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc2
H. Peter Anvin [Tue, 7 Oct 2008 02:16:27 +0000 (19:16 -0700)]
NASM 2.05rc2

16 years agochanges: document immediate fix
H. Peter Anvin [Tue, 7 Oct 2008 02:15:42 +0000 (19:15 -0700)]
changes: document immediate fix

16 years agoBR 2148448: Fix RIP-relative addressing with an immediate
H. Peter Anvin [Tue, 7 Oct 2008 02:11:07 +0000 (19:11 -0700)]
BR 2148448: Fix RIP-relative addressing with an immediate

When there is an immediate in the instruction, a RIP-relative offset
may not be relative to the end of the offset itself, since it is
relative to the end of the *instruction*, not the end of the *offset*.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoimmwarn: more immediate warnings test, with notes of where we fail
H. Peter Anvin [Tue, 7 Oct 2008 01:49:00 +0000 (18:49 -0700)]
immwarn: more immediate warnings test, with notes of where we fail

More tests for immediate warnings, with notes for the ones where we
currently fail to do the right thing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBetter warnings for out-of-range values
H. Peter Anvin [Mon, 6 Oct 2008 02:42:55 +0000 (19:42 -0700)]
Better warnings for out-of-range values

Issue better warnings for out-of-range values.  This is not yet
complete.

In particular, note we may have out-of-range for values that end up
being subject to optimization.  That is because the optimization takes
place on the *truncated* value, not the pre-truncated value.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest: change .stdout/.stderr to stdout/stderr
H. Peter Anvin [Tue, 7 Oct 2008 01:27:30 +0000 (18:27 -0700)]
test: change .stdout/.stderr to stdout/stderr

Using hidden files are rather antisocial, and rather pointless in this
particular context.  Change .stdout and .stderr to simply stdout and
stderr.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agochanges: document CVT fixes.
H. Peter Anvin [Tue, 7 Oct 2008 01:00:13 +0000 (18:00 -0700)]
changes: document CVT fixes.

Document fixes to the CVT instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoBR 2148476: Fix arguments for a bunch of the CVT* instructions
H. Peter Anvin [Tue, 7 Oct 2008 00:58:57 +0000 (17:58 -0700)]
BR 2148476: Fix arguments for a bunch of the CVT* instructions

Fix bugs exposed by test for BR 2148476.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/br2148476.asm: comprehensive test of the CVT* instructions
H. Peter Anvin [Tue, 7 Oct 2008 00:57:18 +0000 (17:57 -0700)]
test/br2148476.asm: comprehensive test of the CVT* instructions

Do a best attempt at a comprehensive test of the various CVT* SSE
instructions.  This includes the bug of BR 2148476.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/immwarn.asm: new test for immediate warnings
H. Peter Anvin [Mon, 6 Oct 2008 02:41:32 +0000 (19:41 -0700)]
test/immwarn.asm: new test for immediate warnings

Test for various conditions that should or should not generate
immediate warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/Makefile: rule to run performtest --diff
H. Peter Anvin [Sun, 5 Oct 2008 05:02:44 +0000 (22:02 -0700)]
test/Makefile: rule to run performtest --diff

Rule to run performtest with the --diff option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoperformtest: use -u with diff
H. Peter Anvin [Sun, 5 Oct 2008 05:01:42 +0000 (22:01 -0700)]
performtest: use -u with diff

Unified diffs are the only sane option.  When calling diff, pass the
-u option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest/Makefile: add rules for the automatic tests
H. Peter Anvin [Sun, 5 Oct 2008 04:59:38 +0000 (21:59 -0700)]
test/Makefile: add rules for the automatic tests

Add Makefile rules to run the automatic tests.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoassemble.c: be smarter about when to suppress warnings due to SBYTE
H. Peter Anvin [Sun, 5 Oct 2008 02:02:30 +0000 (19:02 -0700)]
assemble.c: be smarter about when to suppress warnings due to SBYTE

Be smarter and don't suppress warnings due to SBYTE when the SBYTE
didn't actually match.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoassemble.c: do not warn on valid SBYTE optimizations
H. Peter Anvin [Sun, 5 Oct 2008 01:50:47 +0000 (18:50 -0700)]
assemble.c: do not warn on valid SBYTE optimizations

Do not warn on valid SBYTE optimizations.  If we are optimizing and
match one of the SBYTE conditions, do not error out.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoNASM 2.05rc1
H. Peter Anvin [Wed, 1 Oct 2008 23:08:23 +0000 (16:08 -0700)]
NASM 2.05rc1

16 years agodoc/changes.src: update
H. Peter Anvin [Wed, 1 Oct 2008 17:02:44 +0000 (10:02 -0700)]
doc/changes.src: update

Add information about the recent bug fixes.

16 years agoAlready aligned aligns should be 0 bytes, not %1.
Victor van den Elzen [Wed, 1 Oct 2008 11:16:26 +0000 (13:16 +0200)]
Already aligned aligns should be 0 bytes, not %1.

16 years agoApply patch from BR 890790
Victor van den Elzen [Wed, 1 Oct 2008 11:08:50 +0000 (13:08 +0200)]
Apply patch from BR 890790

16 years agoApply patch from BR 1197827
Victor van den Elzen [Wed, 1 Oct 2008 10:18:28 +0000 (12:18 +0200)]
Apply patch from BR 1197827

16 years agochanges.src: document JMP reg64 fix.
H. Peter Anvin [Wed, 1 Oct 2008 00:14:54 +0000 (17:14 -0700)]
changes.src: document JMP reg64 fix.

Document the fixed JMP reg64.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agordsrc.pl: handle tabs in the input
H. Peter Anvin [Wed, 1 Oct 2008 00:12:19 +0000 (17:12 -0700)]
rdsrc.pl: handle tabs in the input

It is just to painful to keep the source files tab-free.  Handle tabs
in the input as required.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: remove tab
H. Peter Anvin [Wed, 1 Oct 2008 00:07:14 +0000 (17:07 -0700)]
doc: remove tab

The documentation processor doesn't like tabs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoPut the static information about warnings in a structure
H. Peter Anvin [Wed, 1 Oct 2008 00:01:23 +0000 (17:01 -0700)]
Put the static information about warnings in a structure

Put the static information about warnings in a structure, so one can
see what goes with what.  Also, change the sense so "true" means
enabled.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoAllow %warning output to be suppressed
H. Peter Anvin [Tue, 30 Sep 2008 23:39:17 +0000 (16:39 -0700)]
Allow %warning output to be suppressed

Allow the user to suppress user-specified warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoassemble.c: cleanups
H. Peter Anvin [Tue, 30 Sep 2008 23:31:06 +0000 (16:31 -0700)]
assemble.c: cleanups

Formatting and some other minor cleanups.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoDocument the -O0 and -O1 behaviors.
H. Peter Anvin [Tue, 30 Sep 2008 23:24:47 +0000 (16:24 -0700)]
Document the -O0 and -O1 behaviors.

Document the way the -O0 and -O1 options actually behave.  -O0, in
particular, is NASM 0.98 compatibility mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoChange behavior of -O0 and -O1 for backward compatibility
Charles Crayne [Tue, 30 Sep 2008 23:11:32 +0000 (16:11 -0700)]
Change behavior of -O0 and -O1 for backward compatibility

-O0: JMP default to NEAR, Jcc/LOOP/JCXZ default to SHORT.
      In other words, this is reverting to full-blown 0.98 behavior, not
      0.98.39.
-O1: JMP and Jcc default to NEAR, LOOP/JCXZ default to SHORT (only
      possible form).

16 years agoDocument a64 and o64 qualifiers
Charles Crayne [Sat, 27 Sep 2008 00:13:09 +0000 (17:13 -0700)]
Document a64 and o64 qualifiers

Add references and index entries for a64 and o64.