Commit Graph

1829 Commits

Author SHA1 Message Date
H. Peter Anvin
3512d71748 parser.c: fix stylistic nitpick
Fix stray blank line in parser.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27 16:26:25 -07:00
H. Peter Anvin
4a5a6dfed0 assemble.c: stylistic nitpick
Fix stylistic nitpick

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27 16:14:18 -07:00
H. Peter Anvin
18f48793a9 preproc: use %if 0 instead of %ifdef BOGUS
When processing an unparsable TASM argument, convert it to %if 0 which
is guaranteed to not happen, rather than %ifdef BOGUS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27 15:56:27 -07:00
H. Peter Anvin
eac7892834 hashtbl: make hash_iterate() not crash on an uninitalized table
Trying to walk an uninitialized table (->table == NULL) should just
return nothing.  This can happen due when pp_cleanup() is called after
a failure.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27 15:54:25 -07:00
H. Peter Anvin
f7a9ecaffa nasm.c: clean up pass exit logic
Clean up the pass exit logic.  In particular, we had a whole routine
to do the same thing that the normal exit logic would do anyway if we
only would actually get there.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-27 15:34:32 -07:00
H. Peter Anvin
d28f07f7e3 ndisasm: fix disassembly of JRCXZ
Fix the disassembly of JRCXZ; in 64-bit mode, we should only accept
JECXZ for disassembly with 32-bit address size override.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-26 16:18:00 -07:00
H. Peter Anvin
b9893413ec NASM 2.06rc14 2009-06-26 15:15:46 -07:00
H. Peter Anvin
898fceb86d insns.dat: reformat
Reformat insns.dat with standard formatting

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-26 15:14:58 -07:00
H. Peter Anvin
6f5bcf114d insns.dat: add relaxed forms for XOP/FMA4/CVT16 instructions
Add relaxed forms of the XOP/FMA4/CVT16 instructions, without looking
too hard at if it makes sense.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-26 15:13:36 -07:00
H. Peter Anvin
9f01c1db4a Add Cyrill Gorcunov to AUTHORS 2009-06-26 14:57:33 -07:00
H. Peter Anvin
98df21629a insns.pl: remove stray whitespace
Clean up whitespace in insns.pl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 23:18:06 -07:00
H. Peter Anvin
51c7de27e8 insns.pl: add "nohi" code for REX_NH
Add a "nohi" code flag for the \325 byte code, which sets the REX_NH
flag.  That is, REX_P not required to support high registers, high
registers are not supported and spl/bpl/sil/dil enabled even in
non-64-bit mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 23:17:52 -07:00
H. Peter Anvin
f5051691c9 insns.pl: fix indentation
Canonicalize indentation of some blocks.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 23:17:52 -07:00
H. Peter Anvin
a564a02788 ELF: make debugging functions static
The debugging functions can and should all be static.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 17:43:54 -07:00
H. Peter Anvin
ca2a788edf ELF: remove loop invariant calculation of global offset
The global symbol offset is a loop invariant; no need to compute it
over and over.  The compiler probably will not be able to do this for
us due to global variables and function calls.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 17:30:58 -07:00
H. Peter Anvin
559d936ad7 ELF: clean up the arithmetic for global symbols
Clean up the arithmetic for global symbols; in particular, make it
clear where the dependency on the debug format comes from (DWARF needs
three symbol table entries all by itself.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 17:26:43 -07:00
H. Peter Anvin
3716238058 ELF: bump GLOBAL_TEMP_BASE
Bump GLOBAL_TEMP_BASE so far that it *cannot* conflict for ELF32
(which has 24-bit symbol table indicies) and is *unlikely* to conflict
for ELF64 (which has 32-bit symbol table indicies.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 17:25:35 -07:00
H. Peter Anvin
c4471462dc ELF: eliminate hard-coded section numbers
Eliminiate hard-coded section numbers, at least to the best of our
ability.  There is still a very odd piece of computation in
elf_build_reltab() which I can't really figure out...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 14:54:44 -07:00
H. Peter Anvin
1acf6ba822 Handle the new ELF headers in the dependency generation
The dependency machinery relies on properly rooted includes, so give
it to them... the path syntax munging machinery in the dependency
script handles it from a Makefile syntax perspective, and then we can
hope that C compilers are smart enough to deal with forward-slash
paths even when that is not the native syntax.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 13:06:49 -07:00
H. Peter Anvin
d219a3e46f ELF: add header files, begin merging common code, drop .comment
Add something approaching real ELF header files.

Begin merging the common ELF code, beginning with the section name
detection.

Drop automatic generation of .comment section, and in particular the
treatment of .common as a special section (if we decide generating
.comment is still a good idea, we should just do it as a macro.)

Augment the list of known sections, and make it table-driven.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-25 12:30:50 -07:00
H. Peter Anvin
538628803b NASM 2.06rc13 2009-06-25 11:27:18 -07:00
H. Peter Anvin
883735f4c3 changes.src: update 2009-06-25 11:23:37 -07:00
H. Peter Anvin
ef3ef70ccf insns: make the MMX version of PINSRW match the SSE/AVX ones
Make the MMX version of PINSRW match the SSE and AVX ones, and add it
to the tests.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 21:53:23 -07:00
H. Peter Anvin
d15bb009f6 Intel FMA: drop relaxed forms
The Intel FMA instructions are destructive, so relaxed forms are not
appropriate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 21:45:27 -07:00
H. Peter Anvin
1d3e304546 Fix the PINSR series of instructions
Clean up a number of errors in the PINSR series instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 21:43:04 -07:00
H. Peter Anvin
9472dab6ed Add support for instructions which always use low 8-bit registers
Add a byte code to explicitly support instructions which only uses the
low 8-bit registers (as if a REX prefix always was present.)  This is
usable for instructions which are officially documented as using "the
low byte of a 32-bit register" and so on.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 21:38:29 -07:00
H. Peter Anvin
f9fc3fde55 insns.dat: fix typos: VCMPORD_SP[SD] entered as VCMPORS_SP[SD]
Fix typos in two instructions in the relaxed forms.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 21:03:29 -07:00
H. Peter Anvin
79c2e37bc0 insns.dat: collapse relaxed forms
Change the relaxed forms to the compact representation.  This
*deliberately* does not fix bugs where the relaxed form does not match
the official form; this is strictly a "no change in output" checkin.

All remaining open-coded relaxed forms are very likely bugs, and need
to be individually audited.  Furthermore, it is questionable if the
Intel FMA instructions, being destructive, should have relaxed forms
at all.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 18:36:24 -07:00
H. Peter Anvin
37b3c59fc8 insns.pl: allow relaxed forms to be created without duplication
Allow a * to be put on an operand, indicating that it is optional and
should be replaced with the immediately preceding operand if it is
omitted.  This allows official and relaxed forms of nondestructive
instructions to be written on one line.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-24 18:06:26 -07:00
H. Peter Anvin
a5e0279cbd changes.src: fix some odd spacing 2009-06-24 16:50:54 -07:00
H. Peter Anvin
552bc2c394 parser: don't use midcode declarations
OpenWatcom can't handle midcode variable declarations.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-23 11:34:42 -07:00
Victor van den Elzen
02846d30c0 BR 2782055: reject invalid tokens after ]
A bracketed memory reference should be followed by a comma or
the end of the line. Enforce this.
2009-06-23 03:56:07 +02:00
H. Peter Anvin
1957e65ca4 specfile: update URLs
Update the URLs in the specfile to point to http://www.nasm.us/.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-26 16:09:15 -07:00
H. Peter Anvin
57fd9c2142 Nindent: add back the -nut option
NASM is developed under a bunch on environments, to tabs aren't the
best choice.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-25 21:57:27 -07:00
H. Peter Anvin
8bb4c6dafa Nindent: update with the -npro and -il0 options
Update with the -npro and, if recent enough, the -il0 options.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-25 21:40:06 -07:00
H. Peter Anvin
b9cc7f1449 doc: use NASM syntax for x87 registers
The x87 registers are called ST0 and ST1 in NASM syntax, not ST(0) and
ST(1).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-23 16:25:14 -07:00
Cyrill Gorcunov
e49b5bf21c insns.dat - fixup for XOP (SSE5) AMD instructions
1) A number of PMA -> VPM misprint fixed.
2) Spec points to ymmreg in mnemonics even for L=0 instructions. Fixed.

The instructions are still sorted in order of specification follows.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-17 14:50:30 -07:00
Cyrill Gorcunov
bc095662d5 insns.dat - introcuce base XOP (SSE5) AMD instructions
Introduce base XOP/FMA4/CVT16 instructions (SSE5)
based on official specification from AMD (rev 3.03).
Some fixes from Peter Johnson and H. Peter Anvin
included (not updated in AMD spec yet).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-15 07:20:08 -07:00
Cyrill Gorcunov
52fb2575f3 insns.pl - add handling of pp VEX/XOP fields
We already have such kind of aliases for L field
(via l0 and l1). Via p0,p1,p2 it's become easier
to follow AMD docs while encoding VEX/XOP commands.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-15 07:20:02 -07:00
H. Peter Anvin
40b81a40c7 Add symbolic constants for REX_V "classes" (VEX, XOP, ...)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-08 18:01:21 -07:00
H. Peter Anvin
03b9f94133 doc: remove insref.src
Remove the old, obsolete insref.src.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-08 17:56:59 -07:00
H. Peter Anvin
bd9e3a67c5 NASM 2.06rc12 2009-05-06 14:00:48 -07:00
H. Peter Anvin
ba7a0d0566 preproc: handle %+ even during early token replacement
Preexisting code seems to rely on %+ being processed even during early
token replacement, e.g. Syslinux contains the following code:

%macro          superb 1
bx %+ %1        equ SuperInfo+($-superblock)*8+4
bs %+ %1        equ $
                zb 1
%endmacro

... which is expected to work when invoked as:

                superb Media

As a result, set handle_paste_tokens to true at all times; assuming
this turns out to be the way things are we can really just remove it
as an option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-04 10:11:22 -07:00
H. Peter Anvin
0bff6a48fd Use lower case for VEX and XOP in instructions table
Use lower case for VEX and XOP ("vex", "xop") to avoid visual
confusion (and in the future potential real confusion) with upper-case
hexadecimal numbers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-03 22:14:03 -07:00
H. Peter Anvin
a04019c7f4 Infrastructure support for AMD's new XOP prefix
Handle AMD's XOP prefixes; they use basically the same encoding as VEX
prefixes, so treat them simply as a variant of VEX.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-05-03 21:42:34 -07:00
H. Peter Anvin
34c768fcc5 outbin: replace fprintf(rf, not_defined); with fputs(not_defined, rf);
Some vendors get nervous about parameterized printf patterns;
furthermore, it's completely unnecessary in this case.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-04-30 08:06:25 -07:00
H. Peter Anvin
37d3357623 NASM 2.06rc11 2009-04-20 14:04:17 -07:00
H. Peter Anvin
d784a083a3 preproc: unify token-pasting code
Unify the token-pasting code between the macro expansion and the
preprocessor parameter case.  Parameterize whether or not to handle %+
tokens during expansion (%+ tokens have late binding semantics.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2009-04-20 14:01:18 -07:00
H. Peter Anvin
6ca419e7c5 doc: slightly tidy the copyright page of the manual. 2009-04-19 17:26:09 -07:00
H. Peter Anvin
8e1f81110a preproc: make $ and $$ TOKEN_OTHER
Recognize $ and $$ as TOKEN_OTHER; they aren't really either
TOK_NUMBER nor TOK_ID, even though we have traditionally considered
them TOK_NUMBER.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2009-04-17 14:22:49 -07:00