platform/upstream/nasm.git
16 years agodisasm: introduce opy
H. Peter Anvin [Sat, 25 Oct 2008 07:42:51 +0000 (00:42 -0700)]
disasm: introduce opy

Introduce the opy pointer into the disassembler, and use it where
appropriate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoassemble: use opx and opy in a few more places
H. Peter Anvin [Sat, 25 Oct 2008 07:41:00 +0000 (00:41 -0700)]
assemble: use opx and opy in a few more places

Use opx and opy in a few more places where we can do so.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc/changes.src: retroactively document anonymous %push
H. Peter Anvin [Fri, 24 Oct 2008 23:53:53 +0000 (16:53 -0700)]
doc/changes.src: retroactively document anonymous %push

Retroactively document the anonymous %push, which was added in version
2.04 but not documented.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: don't macro-expand the argument to %use
H. Peter Anvin [Fri, 24 Oct 2008 23:38:17 +0000 (16:38 -0700)]
preproc: don't macro-expand the argument to %use

Use expand_id() for the argument to %use, instead of expand_smacro().
This really makes more sense for a "naked" argument.  This is a
semantic change, but is unlikely to break any real code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: document %pop with argument
H. Peter Anvin [Fri, 24 Oct 2008 23:27:11 +0000 (16:27 -0700)]
doc: document %pop with argument

Document that %pop can now take an argument, and what it does.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: allow %pop to take an identifier, unify %push/%repl/%pop
H. Peter Anvin [Fri, 24 Oct 2008 23:24:21 +0000 (16:24 -0700)]
preproc: allow %pop to take an identifier, unify %push/%repl/%pop

Allow the %pop directive to take an identifier (an assert on the
context name); unify the parsing parts of %push, %repl,  and %pop.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: document anonymous %push
H. Peter Anvin [Fri, 24 Oct 2008 23:19:03 +0000 (16:19 -0700)]
doc: document anonymous %push

The anonymous %push was never documented, document it now.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc/changes.src: begin the release notes for 2.06
H. Peter Anvin [Fri, 24 Oct 2008 23:05:19 +0000 (16:05 -0700)]
doc/changes.src: begin the release notes for 2.06

The next version will presumably be called 2.06; begin collecting
release notes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: fix awkward word order
H. Peter Anvin [Fri, 24 Oct 2008 17:15:46 +0000 (10:15 -0700)]
doc: fix awkward word order

"the exactly same" -> "exactly the same"

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoversion.pl: don't add an extra .00 for subminor if we don't need it
H. Peter Anvin [Fri, 24 Oct 2008 17:10:32 +0000 (10:10 -0700)]
version.pl: don't add an extra .00 for subminor if we don't need it

When producing the mangled version number, don't add a subminor if
there isn't a patch level or release candidate number.  Thus, 2.05p1
is 2.05.00.01, but 2.05 can just be 2.05.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoMerge branch 'indirect'
H. Peter Anvin [Fri, 24 Oct 2008 06:13:44 +0000 (23:13 -0700)]
Merge branch 'indirect'

16 years agoFix op2 references that had not yet been converted; introduce opy
H. Peter Anvin [Fri, 24 Oct 2008 06:07:53 +0000 (23:07 -0700)]
Fix op2 references that had not yet been converted; introduce opy

Fix op2 references not yet converted to accessing op2; add an opy
pointer similar to the opx pointer instead of multiple references.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodisasm: extension byte support in the disassembler
H. Peter Anvin [Wed, 15 Oct 2008 18:51:24 +0000 (11:51 -0700)]
disasm: extension byte support in the disassembler

Add support to the disassembler for the extension bytes (for operand
4+).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agoAdd extension bytecodes to support operands 4+
H. Peter Anvin [Sat, 11 Oct 2008 05:10:31 +0000 (22:10 -0700)]
Add extension bytecodes to support operands 4+

The bytecode format assumes max 4 operands pretty strictly, but we
already have one instruction with 5 operands, and it's likely to get
more.  Support them via extension prefixes (similar to REX prefixes).
For bytecodes which use argument bytes we encode the number directly,
however.

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 agotest/ppindirect.asm: test token pasting inside %[...]
H. Peter Anvin [Mon, 20 Oct 2008 05:23:12 +0000 (22:23 -0700)]
test/ppindirect.asm: test token pasting inside %[...]

Test for token pasting inside %[...].

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: fix terminal token pasting in indirect sequences
H. Peter Anvin [Mon, 20 Oct 2008 05:22:05 +0000 (22:22 -0700)]
preproc: fix terminal token pasting in indirect sequences

Fix the case where the terminal token pastes with the first token of
the unmodified sequence.  This is a really ugly version; we need to
merge the two instances plus the one in expand_mmac_params().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: error on unterminated %[...]
H. Peter Anvin [Mon, 20 Oct 2008 05:14:30 +0000 (22:14 -0700)]
preproc: error on unterminated %[...]

Make unterminated %[...] constructs an error.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: fix exit conditions for indirection loop
H. Peter Anvin [Mon, 20 Oct 2008 05:12:06 +0000 (22:12 -0700)]
preproc: fix exit conditions for indirection loop

When locating the end of a %[...] construct, we need to end up with
the pointer pointing to the terminating character.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: correctly handle quoted strings inside %[...] constructs
H. Peter Anvin [Mon, 20 Oct 2008 02:30:11 +0000 (19:30 -0700)]
preproc: correctly handle quoted strings inside %[...] constructs

We need to skip quoted strings when determining the ending point of
%[...] constructs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodoc: document the %[...] construct.
H. Peter Anvin [Mon, 20 Oct 2008 00:00:52 +0000 (17:00 -0700)]
doc: document the %[...] construct.

Add documentation for the %[...] construct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest: better smartalign tests
H. Peter Anvin [Sun, 19 Oct 2008 23:47:53 +0000 (16:47 -0700)]
test: better smartalign tests

Smartalign tests for 16, 32 and 64-bit mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agosmartalign: use a "times" construct rather than %rep
H. Peter Anvin [Sun, 19 Oct 2008 23:45:27 +0000 (16:45 -0700)]
smartalign: use a "times" construct rather than %rep

Use a "times" construct rather than "%rep" for higher performance.
No need to preprocess the same line over and over for no good reason.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agomacros.pl: handle \-continuation lines in macros.pl
H. Peter Anvin [Sun, 19 Oct 2008 23:44:02 +0000 (16:44 -0700)]
macros.pl: handle \-continuation lines in macros.pl

Correctly handle \-continuation lines in macros.pl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agosmartalign: rewrite to use the indirect construct, %[...]
H. Peter Anvin [Sun, 19 Oct 2008 23:38:28 +0000 (16:38 -0700)]
smartalign: rewrite to use the indirect construct, %[...]

This code can be made so much smaller with clever use of the
indirection construct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agotest: add test for preprocessor indirection construct
H. Peter Anvin [Sun, 19 Oct 2008 23:25:57 +0000 (16:25 -0700)]
test: add test for preprocessor indirection construct

Add a test for the preprocessor indirection construct, %[...].

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: fix list iteration in the case of expand_indirect()
H. Peter Anvin [Sun, 19 Oct 2008 23:24:53 +0000 (16:24 -0700)]
preproc: fix list iteration in the case of expand_indirect()

Linked lists where an element may be deleted or substituted during
processing can be subtle to deal with.  Fix the iteration conditions
in this particular case.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agopreproc: Add new %[...] indirection construct
H. Peter Anvin [Sun, 19 Oct 2008 22:45:05 +0000 (15:45 -0700)]
preproc: Add new %[...] indirection construct

Add a new %[...] construct to support indirect macro expansion.

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>