platform/upstream/nasm.git
16 years agophash: canonicalize order, fix handling of ignored duplicates
H. Peter Anvin [Mon, 26 May 2008 01:44:44 +0000 (18:44 -0700)]
phash: canonicalize order, fix handling of ignored duplicates

Canonicalize the order of the prehash entries, so we don't have to
worry about looking up both pairs of edges.

When we find a collision that we decide to ignore, there is no point
in adding the same edge into the array again; instead, just skip the
current edge.

16 years agophash: allow collisions if the hash target is the same
H. Peter Anvin [Mon, 26 May 2008 01:17:49 +0000 (18:17 -0700)]
phash: allow collisions if the hash target is the same

If the hash target is the same value, we can permit collisions.  This
isn't relevant for the current applications of the hash generator, but
is useful for cases where one have a number of sources for the same
target.  It's easy to check, either way.

16 years agophash: massively speed up the perfect hash generator
H. Peter Anvin [Mon, 26 May 2008 01:10:57 +0000 (18:10 -0700)]
phash: massively speed up the perfect hash generator

Make the perfect hash generator about 200x faster by using a very
simple custom graph adjacency representation instead of using
Graph::Undirected.

16 years agoFix mnemnonics for SSE5 PCOMU instructions
H. Peter Anvin [Sun, 25 May 2008 16:25:47 +0000 (09:25 -0700)]
Fix mnemnonics for SSE5 PCOMU instructions

16 years agoFix mnemonics for VTESTP[SD] (BR 1971570)
H. Peter Anvin [Sun, 25 May 2008 05:15:56 +0000 (22:15 -0700)]
Fix mnemonics for VTESTP[SD] (BR 1971570)

Incorrectly entered as VPTEST* due to illogical placement in the manual.

16 years agoFix the VPSHUF*W instructions (BR 1971567)
H. Peter Anvin [Sun, 25 May 2008 05:13:33 +0000 (22:13 -0700)]
Fix the VPSHUF*W instructions (BR 1971567)

The VPSHUF*W instructions had both wrong mnemonics and opcodes.

16 years agoFix typo in VPCMPESTRM instruction (BR 1971565)
H. Peter Anvin [Sun, 25 May 2008 05:11:44 +0000 (22:11 -0700)]
Fix typo in VPCMPESTRM instruction (BR 1971565)

The VPCMPESTRM instruction was typoed.

16 years agoAdd VCVTSI2SS (BR 1971564)
H. Peter Anvin [Sun, 25 May 2008 05:09:51 +0000 (22:09 -0700)]
Add VCVTSI2SS (BR 1971564)

The VCVTSI2SS instruction was missing.

16 years agoFix immediate for PCLMULHQ* instructions (BR 1971555)
H. Peter Anvin [Sun, 25 May 2008 05:07:03 +0000 (22:07 -0700)]
Fix immediate for PCLMULHQ* instructions (BR 1971555)

The immediate for the PCLMULHQ* instructions was wrong.

16 years agoRemove imm from specific versions of VCMPxx
H. Peter Anvin [Sun, 25 May 2008 05:04:23 +0000 (22:04 -0700)]
Remove imm from specific versions of VCMPxx

For the versions of VCMPxx which already embed their condition code,
we do not want an extra immediate argument.

Todo: fix bytecode compiler to complain more about these.

16 years agoAdd VLDQQU as an alias for 256-bit VLDDQU (BR 1971539)
H. Peter Anvin [Sun, 25 May 2008 04:58:59 +0000 (21:58 -0700)]
Add VLDQQU as an alias for 256-bit VLDDQU (BR 1971539)

Accept VLDQQU as an alias for VLDDQU when used with 256-bit values.

16 years agoVFMSUBADDP[SD], not VFMADDSUBS[SD] (BR 1971573)
H. Peter Anvin [Sun, 25 May 2008 04:54:09 +0000 (21:54 -0700)]
VFMSUBADDP[SD], not VFMADDSUBS[SD] (BR 1971573)

There are VFMSUBADDP instructions, but there are no VFMADDSUBS
instructions.

16 years agoAdd note about SEH support
H. Peter Anvin [Sat, 24 May 2008 04:51:21 +0000 (21:51 -0700)]
Add note about SEH support

Still need documentation from someone who actually knows anything
about how this works.

16 years agoWin64: IMAGEREL references (SEH support for Win64)
Andy Polyakov [Sat, 24 May 2008 02:45:39 +0000 (19:45 -0700)]
Win64: IMAGEREL references (SEH support for Win64)

Guess what, SEH again, but in Win64 context, which is completely
different matter from Win32. At lowest level this one boils down to
putting so called imagerel references, or in practical terms
relocations of type ADDR32NB, 0x0003, into .pdata and .xdata
segments. Two possibilities. 1. implement say 'wrt ..imagerel' or 'wrt
..imagebase'. 2. silently enforce ADDR32NB relocations in .pdata and
.xdata segments.

16 years agoMake SAFESEH syntax error ERR_NONFATAL
H. Peter Anvin [Sat, 24 May 2008 01:38:51 +0000 (18:38 -0700)]
Make SAFESEH syntax error ERR_NONFATAL

Incorrect use of SAFESEH is more suited for ERR_NONFATAL than ERR_FATAL

16 years agoSupport for Win32 safeseh (BR 195417)
Andy Polyakov [Sat, 24 May 2008 01:37:52 +0000 (18:37 -0700)]
Support for Win32 safeseh (BR 195417)

This is basically not a bug report, but a feature request.

It's desired to be able to link .obj modules compiled with 'nasm -f
win32' with Microsoft 'link /safeseh'. As well as to register symbols
(commonly subroutine's entry points or even external symbols) as "safe
handlers." In order to achieve this, several points are required.

First of all, object module has to have absolute symbol named @feat.00
with value of 1. This can actually be achived by adding 'absolute 1'
and '@feat.00:' to source code, but it's desirable that it's
autogenerated for win32 modules.

Handler registration is essentially symbol's *index* in current
module's symbol table in .sxdata, segment with 0x200 segment flags, an
"info" segment. It's also essential that symbol has type 0x20 (see
below). All this is depicted in following framgents of 'objdump -xD'
output:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .sxdata       00000004  00000000  00000000  0000003c  2**2
                  CONTENTS, READONLY, DEBUGGING

SYMBOL TABLE:
...
[  5](sec -1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000001 @feat.00
[  6](sec  0)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000000 _handler
...
<.sxdata>
0: 06 00 00 00

Note [6] and (ty 20) in _handle line in SYMBOL TABLE. "06 00 00 00" in
.sxdata is little-endian 6, _handler's index. This is what makes up
"registration." It's impossible to achieve this with current nasm
facilities and it's probably appropriate to introduce a directive for
it, 'safeseh _handler' is probably most natural choice.

16 years agodoc: another reference to DY
H. Peter Anvin [Sat, 24 May 2008 01:24:03 +0000 (18:24 -0700)]
doc: another reference to DY

16 years agoCHANGES since 2.02, so far...
H. Peter Anvin [Sat, 24 May 2008 01:03:26 +0000 (18:03 -0700)]
CHANGES since 2.02, so far...

16 years agoDocument DY, RESY and YWORD
H. Peter Anvin [Sat, 24 May 2008 00:58:01 +0000 (17:58 -0700)]
Document DY, RESY and YWORD

16 years agoAVX FMA: Instruction table for the AVX FMA instructions
H. Peter Anvin [Sat, 24 May 2008 00:46:08 +0000 (17:46 -0700)]
AVX FMA: Instruction table for the AVX FMA instructions

This adds the AVX FMA instructions to the instruction table, which
should complete the AVX work.

16 years agoAVX: Remaining AVX instructions (still need FMA)
H. Peter Anvin [Sat, 24 May 2008 00:27:15 +0000 (17:27 -0700)]
AVX: Remaining AVX instructions (still need FMA)

Implement the remaining set of AVX instructions

16 years agoinsns.pl: better error messages, handle no-operand instructions better
H. Peter Anvin [Sat, 24 May 2008 00:25:54 +0000 (17:25 -0700)]
insns.pl: better error messages, handle no-operand instructions better

Better error messages, and allow "void" instructions to omit the
operand colon.

16 years agoAVX instruction table through "P"
H. Peter Anvin [Sat, 24 May 2008 00:03:30 +0000 (17:03 -0700)]
AVX instruction table through "P"

AVX instruction table through the letter P in the manual

16 years agofmtinsns.pl: handle compiler fields; do some case mangling
H. Peter Anvin [Fri, 23 May 2008 23:59:59 +0000 (16:59 -0700)]
fmtinsns.pl: handle compiler fields; do some case mangling

Handle compiler-generated fields, and at least try to do some case
mangling.

16 years agoUse hash tables even for context-sensitive macros
H. Peter Anvin [Thu, 22 May 2008 20:17:51 +0000 (13:17 -0700)]
Use hash tables even for context-sensitive macros

Normally, contexts aren't used with a large number of macros, but in
case someone does, do use hash tables for those as well.  This
simplifies the code somewhat, since *all* handling of macros is now
done via hash tables.

Future note: consider if it wouldn't be better to allow struct
hash_table to be allocated by the caller, instead of being allocated
by the hash table routine.

16 years agoAdd tokens vex.ww and vex.wx; vex.wx is the default
H. Peter Anvin [Thu, 22 May 2008 18:24:35 +0000 (11:24 -0700)]
Add tokens vex.ww and vex.wx; vex.wx is the default

Add vex.ww (for VEX.W follows REX.W) and vex.wx (for VEX.W is a don't
care); vex.wx is the default since that seems to match existing usage
better.

16 years agoAVX: instruction table up to PE
H. Peter Anvin [Thu, 22 May 2008 06:21:57 +0000 (23:21 -0700)]
AVX: instruction table up to PE

Complete the instruction table up to and including PE (document
319433-002, start next on page 5-330).

16 years agoAVX: instruction table through M
H. Peter Anvin [Thu, 22 May 2008 01:10:09 +0000 (18:10 -0700)]
AVX: instruction table through M

Implement the AVX instruction table through the letter M.

16 years agoinsns.pl: error if we have a 'v' operand and no vex.nds/ndd
H. Peter Anvin [Thu, 22 May 2008 01:09:17 +0000 (18:09 -0700)]
insns.pl: error if we have a 'v' operand and no vex.nds/ndd

Although redundant, the presence of a 'v' operand should match the
existence of a nds or ndd flag on vex; this should help catch typos.

16 years agoinsnsn.c: cleaner to *not* separate out conditional instructions
H. Peter Anvin [Wed, 21 May 2008 22:09:31 +0000 (15:09 -0700)]
insnsn.c: cleaner to *not* separate out conditional instructions

The disassembler code gets cleaner if we do *not* separate out the
conditional instructions; instead, rely on the fact that the
conditionals are always at the end and use FIRST_COND_OPCODE as a
barrier.

16 years agoAdd legacy blendvpd to avx.asm, as a disassembler test.
H. Peter Anvin [Wed, 21 May 2008 22:03:26 +0000 (15:03 -0700)]
Add legacy blendvpd to avx.asm, as a disassembler test.

16 years agoImplement aliases for specific SSE5 compare operations
H. Peter Anvin [Wed, 21 May 2008 22:02:30 +0000 (15:02 -0700)]
Implement aliases for specific SSE5 compare operations

Implement aliases for specific SSE5 compare operations, per BR 1930630.

16 years agoinsns.dat: reimplement SSE5 compares using the bytecode compiler
H. Peter Anvin [Wed, 21 May 2008 21:45:46 +0000 (14:45 -0700)]
insns.dat: reimplement SSE5 compares using the bytecode compiler

Use the bytecode compiler for the SSE5 compare instructions.  While we
are at it, give it correct flags.

16 years agoinsns.pl: match AMD documentation for DREX syntax
H. Peter Anvin [Wed, 21 May 2008 21:44:42 +0000 (14:44 -0700)]
insns.pl: match AMD documentation for DREX syntax

Adjust the compiler to give a syntax for DREX instructions that
matches the AMD documentation.

16 years agoAdd the PCLMUL instructions (BR 1933742)
H. Peter Anvin [Wed, 21 May 2008 21:28:42 +0000 (14:28 -0700)]
Add the PCLMUL instructions (BR 1933742)

Add the PCLMUL group instructions, from the AVX spec but not actually
AVX instructions.

16 years agoAdd INVEPT and INVVPID (BR 1956955)
H. Peter Anvin [Wed, 21 May 2008 21:17:33 +0000 (14:17 -0700)]
Add INVEPT and INVVPID (BR 1956955)

16 years agoUse "o64nw" instead of "o64i" for o64 without REX.W
H. Peter Anvin [Wed, 21 May 2008 21:16:49 +0000 (14:16 -0700)]
Use "o64nw" instead of "o64i" for o64 without REX.W

Use the somewhat more mnemonic "o64nw" for 64-bit operand size sans
REX.W.

16 years agoAdd the MOVBE instructions (BR 1956954)
H. Peter Anvin [Wed, 21 May 2008 21:03:56 +0000 (14:03 -0700)]
Add the MOVBE instructions (BR 1956954)

Add the MOVBE instructions (load/store and swap)

16 years agoinsns.pl: readabilty improvements for isnsnd.c
H. Peter Anvin [Wed, 21 May 2008 18:18:12 +0000 (11:18 -0700)]
insns.pl: readabilty improvements for isnsnd.c

Make insnsd.c a bit more consistent in style.

16 years agoDisassembler: select table based on VEX prefixes
H. Peter Anvin [Wed, 21 May 2008 18:05:39 +0000 (11:05 -0700)]
Disassembler: select table based on VEX prefixes

We can use the new VEX prefixes to select into a large table of new
opcode spaces.  Since the table is (currently) sparse, add logic so we
don't end up producing tons of empty tables for no good reason.

This is also necessary since VEX is likely to reuse opcode bytes that
would appear as prefixes at some point, which would cause conflicts
with the regular tables.

16 years agoFix skipping 0270 code when searching for disasm prefixes
H. Peter Anvin [Wed, 21 May 2008 17:34:33 +0000 (10:34 -0700)]
Fix skipping 0270 code when searching for disasm prefixes

The 0270 code was incorrectly entered as 270 (decimal), which meant
that instructions with vex but no .nds got misfiled in the improper
opcode tables.

16 years agoFix display for fixed xmm0/ymm0, SSE redundant prefixes
H. Peter Anvin [Wed, 21 May 2008 17:33:19 +0000 (10:33 -0700)]
Fix display for fixed xmm0/ymm0, SSE redundant prefixes

All singleton registers need to be displayable from register flags
alone!

When using the new 0360..0363 codes, make sure we appropriate avoid
displaying the legacy use of the prefixes.

16 years agoFix buffer overflow in preproc.c (BR 1942146)
Philipp Thomas [Wed, 21 May 2008 15:53:21 +0000 (08:53 -0700)]
Fix buffer overflow in preproc.c (BR 1942146)

Fix buffer overflow in preproc.c due to an incorrect test.  In the
code:

        for (r = p, s = ourcopy; *r; r++) {
    if (r >= p+MAX_KEYWORD)
     return tokval->t_type = TOKEN_ID; /* Not a keyword */
            *s++ = tolower(*r);
    }
        *s = '\0';

... the test really needs to be >= since for the pass where there are
equal:

a) a nonzero byte means we have > MAX_KEYWORD characters, and
b) s = ourcopy+MAX_KEYWORD; but if the test doesn't trigger,
   we can write one more character *plus* the null byte, overflowing
   ourcopy.

16 years agoinsns typo fix: SSE5 FNM* instructions misspelled
H. Peter Anvin [Wed, 21 May 2008 15:45:17 +0000 (08:45 -0700)]
insns typo fix: SSE5 FNM* instructions misspelled

The SSE5 FNM* instructions were misspelled as FMN*

(Bug 1930322)

16 years agoMerge branch 'master' of git+ssh://repo.or.cz/srv/git/nasm
H. Peter Anvin [Wed, 21 May 2008 15:42:55 +0000 (08:42 -0700)]
Merge branch 'master' of git+ssh://repo.or.cz/srv/git/nasm

16 years agoUDx instructions are 186+, not 286+
H. Peter Anvin [Wed, 21 May 2008 15:41:58 +0000 (08:41 -0700)]
UDx instructions are 186+, not 286+

The UDx instructions are valid as far back as the #UD trap, which is
the 186, not the 286.

16 years agoVEX prefixes apply to VEX instructions only...
H. Peter Anvin [Wed, 21 May 2008 06:36:36 +0000 (23:36 -0700)]
VEX prefixes apply to VEX instructions only...

16 years agoAVX instructions up to VMINSS
H. Peter Anvin [Wed, 21 May 2008 06:28:46 +0000 (23:28 -0700)]
AVX instructions up to VMINSS

16 years agoA few more AVX instructions (up to VLDMXCSR)
H. Peter Anvin [Wed, 21 May 2008 06:16:27 +0000 (23:16 -0700)]
A few more AVX instructions (up to VLDMXCSR)

More AVX instructions, up to VLDMXCSR

16 years agoHandle is4 bytes without meaningful information in the bottom bits
H. Peter Anvin [Wed, 21 May 2008 02:29:04 +0000 (19:29 -0700)]
Handle is4 bytes without meaningful information in the bottom bits

Support is4 bytes without meaningful information in the bottom bits.
This is equivalent to /is4=0 for the assembler, but makes the bottom
bits don't care for the disassembler.

16 years agoinslist.pl: deal with the new encoding format
H. Peter Anvin [Wed, 21 May 2008 01:33:40 +0000 (18:33 -0700)]
inslist.pl: deal with the new encoding format

Make it possible for inslist.pl to understand the new encoding format;
fix a few minor buglets.

16 years agoOfficially specify - as the symbol for an implicit operand
H. Peter Anvin [Wed, 21 May 2008 01:21:11 +0000 (18:21 -0700)]
Officially specify - as the symbol for an implicit operand

Use - to denote that an operand is implicit (not encoded).  This
*better* be a fixed operand!

16 years agoAVX: implement all the convert instructions...
H. Peter Anvin [Wed, 21 May 2008 01:14:30 +0000 (18:14 -0700)]
AVX: implement all the convert instructions...

Make our way through the AVX instructions: conversions.
This is all I have time for now... hopefully this can service as a
generous source of examples.

16 years agoAccept the gas mnemonics "ud2a" and "ud2b"; fix ud0
H. Peter Anvin [Wed, 21 May 2008 00:14:17 +0000 (17:14 -0700)]
Accept the gas mnemonics "ud2a" and "ud2b"; fix ud0

Accept the gas mnemonics "ud2a" and "ud2b" for the instructions we
call ud2 and ud1 respectively, and Intel call ud2 and undocumented :)

Also, 0F FF is ud0 regardless of prefixes, at least as far as we know.

16 years agondisasm: simple compare for conditional opcodes, no loop
H. Peter Anvin [Wed, 21 May 2008 00:07:57 +0000 (17:07 -0700)]
ndisasm: simple compare for conditional opcodes, no loop

We had a completely unnecessary loop to test for conditional opcodes.
Since we always put the conditional opcodes at the end, we might as
well just remember where that list starts and compare against it.

16 years agoFinish the VCMP series...
H. Peter Anvin [Tue, 20 May 2008 23:59:17 +0000 (16:59 -0700)]
Finish the VCMP series...

16 years agoMore AVX instructions
H. Peter Anvin [Tue, 20 May 2008 23:48:34 +0000 (16:48 -0700)]
More AVX instructions

Add additional AVX instructions to the list.

16 years agoMake the syntax for immediates match the docs better
H. Peter Anvin [Tue, 20 May 2008 23:47:42 +0000 (16:47 -0700)]
Make the syntax for immediates match the docs better

Use a more manual-like syntax for immediates (we still may have to use
extended syntax, but not always.)

16 years agoAdd support for ymm0 in instructions
H. Peter Anvin [Tue, 20 May 2008 23:47:12 +0000 (16:47 -0700)]
Add support for ymm0 in instructions

Make it possible to use ymm0 as a fixed operand in instructions

16 years agophash: cut random vector set down a bit
H. Peter Anvin [Tue, 20 May 2008 23:46:36 +0000 (16:46 -0700)]
phash: cut random vector set down a bit

Reduce the size of the random vector set somewhat

16 years agoNo 32-byte floating point format: fix error for DY
H. Peter Anvin [Tue, 20 May 2008 21:49:32 +0000 (14:49 -0700)]
No 32-byte floating point format: fix error for DY

Output a more legible error message for floating-point with "DY".

16 years agoopenwcom.mak: wmake uses & for continuation, not \ (sigh)
H. Peter Anvin [Tue, 20 May 2008 21:42:53 +0000 (14:42 -0700)]
openwcom.mak: wmake uses & for continuation, not \ (sigh)

wmake uses & for continuation, since \ is used for pathname
separators.

16 years agoReadability improvements for regdis.c
H. Peter Anvin [Tue, 20 May 2008 21:38:21 +0000 (14:38 -0700)]
Readability improvements for regdis.c

16 years agonetware.mak: correct dependencies
H. Peter Anvin [Tue, 20 May 2008 21:35:34 +0000 (14:35 -0700)]
netware.mak: correct dependencies

The Makefile uses VPATH and stripped directory names for files, so
generate the dependencies accordingly.

16 years agordx: Add cast avoid warning from gcc
H. Peter Anvin [Tue, 20 May 2008 21:25:36 +0000 (14:25 -0700)]
rdx: Add cast avoid warning from gcc

Avoid a warning from gcc about casting an integer of different size to
a pointer.

16 years agoAvoid #including .c files; instead compile as separate units
H. Peter Anvin [Tue, 20 May 2008 21:21:29 +0000 (14:21 -0700)]
Avoid #including .c files; instead compile as separate units

Don't #include .c files, even if they are auto-generated; instead
compile them as separate compilation units and let the linker do its
job.

16 years agoPTEST is SSE4.1; although AMD says it's SSE5.
H. Peter Anvin [Tue, 20 May 2008 20:07:09 +0000 (13:07 -0700)]
PTEST is SSE4.1; although AMD says it's SSE5.

Fix this when we have proper support for feature sets, or forget about
the concept entirely.

16 years agoinsns.pl: don't require whitespace before / or \
H. Peter Anvin [Tue, 20 May 2008 20:03:39 +0000 (13:03 -0700)]
insns.pl: don't require whitespace before / or \

Use Perl's context-sensitive regular expressions to tell split that a
slash or backslash begins a new operator.

16 years agonasm.h: remove obsolete IP_REG definitions
H. Peter Anvin [Tue, 20 May 2008 18:47:01 +0000 (11:47 -0700)]
nasm.h: remove obsolete IP_REG definitions

16 years agoAdd DY, YWORD, and the SY instruction flag
H. Peter Anvin [Tue, 20 May 2008 18:43:53 +0000 (11:43 -0700)]
Add DY, YWORD, and the SY instruction flag

Add the DY instruction, YWORD keyword, and an SY marker for
instruction sizes.  Add a few more AVX sample instructions.

16 years agoinsns.pl: support operands that serve double duty
H. Peter Anvin [Tue, 20 May 2008 18:23:18 +0000 (11:23 -0700)]
insns.pl: support operands that serve double duty

Sometimes assembly syntax wants to permit a single operand to serve
multiple functions; allow this.

The disassembler could really use to be smarter about those.

16 years agoinsns.dat: no subheader for "must be last"
H. Peter Anvin [Tue, 20 May 2008 18:05:59 +0000 (11:05 -0700)]
insns.dat: no subheader for "must be last"

16 years agoinsns.dat: make even wider to make space for AVX
H. Peter Anvin [Tue, 20 May 2008 18:04:26 +0000 (11:04 -0700)]
insns.dat: make even wider to make space for AVX

The AVX instructions take more space, so add a few tab stops across
the entire file.

16 years agoinsns.dat: use compiler-generated bytecodes for AVX
H. Peter Anvin [Tue, 20 May 2008 18:01:28 +0000 (11:01 -0700)]
insns.dat: use compiler-generated bytecodes for AVX

Use compiler-generated bytecodes for the AVX instruction demos.  This
should make it a lot easier for other people (HINT, HINT) to add the
instruction table.

16 years agoinsns.pl: fix regex subgroup of /is4= codes
H. Peter Anvin [Tue, 20 May 2008 17:48:22 +0000 (10:48 -0700)]
insns.pl: fix regex subgroup of /is4= codes

The argument is now $1, not $2...

16 years agoinsns.pl: fix splitting of bracketted operations
H. Peter Anvin [Tue, 20 May 2008 17:39:15 +0000 (10:39 -0700)]
insns.pl: fix splitting of bracketted operations

16 years agoOpcode listing notation is /is4, consistently
H. Peter Anvin [Tue, 20 May 2008 17:29:11 +0000 (10:29 -0700)]
Opcode listing notation is /is4, consistently

16 years agoUse the \360..\363 annotations for SSE prefixes
H. Peter Anvin [Tue, 20 May 2008 17:21:57 +0000 (10:21 -0700)]
Use the \360..\363 annotations for SSE prefixes

16 years agoSame some space by introducing shorthand byte codes for SSE prefixes
H. Peter Anvin [Tue, 20 May 2008 16:46:24 +0000 (09:46 -0700)]
Same some space by introducing shorthand byte codes for SSE prefixes

Properly done, all SSE instructions which has the 66/F2/F3 opcode
multiplex need two prefixes: one to control the use of OSP and one to
control the use of REP.  However, it's a four-way select: np/66/F2/F3;
so introduce shorthand bytecodes for that purpose.

16 years agoAllow explicit immediate syntax for imz2 as well as is4
H. Peter Anvin [Tue, 20 May 2008 16:36:41 +0000 (09:36 -0700)]
Allow explicit immediate syntax for imz2 as well as is4

imz2 is just an alias for is4 as far as we are concerned...

16 years agoinsns.pl: escape literal special character in regex
H. Peter Anvin [Tue, 20 May 2008 04:10:14 +0000 (21:10 -0700)]
insns.pl: escape literal special character in regex

In Perl code, it is good practice to escape special characters
intended to be literal.

16 years agoBytecode compiler: add support for is4/imz2 operands
H. Peter Anvin [Tue, 20 May 2008 04:07:08 +0000 (21:07 -0700)]
Bytecode compiler: add support for is4/imz2 operands

16 years agoMore work on bytecode compiler (not finished yet...)
H. Peter Anvin [Tue, 20 May 2008 02:08:03 +0000 (19:08 -0700)]
More work on bytecode compiler (not finished yet...)

More work on the bytecode compiler.  Not all useful bytecodes are
implemented yet, however.

16 years agoinsns.pl: first steps toward a "smart" bytecode compiler
H. Peter Anvin [Tue, 20 May 2008 01:19:42 +0000 (18:19 -0700)]
insns.pl: first steps toward a "smart" bytecode compiler

First steps toward a smart(er) bytecode compiler, using a syntax that
can be more directly taken from the manuals.

16 years agoMake insnsb.c an actual compilation unit
H. Peter Anvin [Tue, 13 May 2008 21:29:47 +0000 (14:29 -0700)]
Make insnsb.c an actual compilation unit

"make alldeps" doesn't really like it when included files end in *.c.
Instead of renaming insnsb.c to insnsb.h, make it an actual
compilation unit, since there really isn't any reason for it not to
be.

16 years agoinsnsb.c: use 5 digits for index, not 4
H. Peter Anvin [Mon, 12 May 2008 22:28:33 +0000 (15:28 -0700)]
insnsb.c: use 5 digits for index, not 4

We already have indexes up to 9500, so use 5 digits instead of 4.

16 years agoMake MAX_OPERANDS a parameter in insns.pl as well
H. Peter Anvin [Mon, 12 May 2008 18:36:24 +0000 (11:36 -0700)]
Make MAX_OPERANDS a parameter in insns.pl as well

MAX_OPERANDS is present in insns.pl as well (although proper C
compilers shouldn't need this kind of zero padding.)  Make sure it's
clear to everyone.

16 years agoRemove special hacks to avoid zero bytecodes
H. Peter Anvin [Mon, 12 May 2008 18:13:41 +0000 (11:13 -0700)]
Remove special hacks to avoid zero bytecodes

We can now have zero bytecodes with impunity, so remove any special
hacks we had to avoid zeroes in the bytecode.

16 years agoGenerate a byte array instead of using strings for the byte codes
H. Peter Anvin [Mon, 12 May 2008 18:00:50 +0000 (11:00 -0700)]
Generate a byte array instead of using strings for the byte codes

Generate a byte array instead of using C compiler strings for the byte
codes.  This has a few advantages:

- No need to special-case zero due to broken C compilers.
- Only insns.pl only ever reads the string, so we can invent our own
  syntax.
- Compaction.
- We can give it the proper, unsigned type.

16 years agoFactor out string decoder in insns.pl
H. Peter Anvin [Mon, 12 May 2008 17:17:27 +0000 (10:17 -0700)]
Factor out string decoder in insns.pl

Factor out the string decoder into its own subroutine.  This will be
useful shortly ;)

16 years agoAdd support for register-number immediates with fixed 4-bit values
H. Peter Anvin [Wed, 7 May 2008 03:11:14 +0000 (20:11 -0700)]
Add support for register-number immediates with fixed 4-bit values

Add support for imm8 bytes which has a register value in the top four
bits and an arbitrary fixed value in the bottom four bits.

16 years agoFix encoding of VPERMIL2PS instructions
H. Peter Anvin [Wed, 7 May 2008 03:06:14 +0000 (20:06 -0700)]
Fix encoding of VPERMIL2PS instructions

16 years agoActually spell "Sandy Bridge" correctly
H. Peter Anvin [Wed, 7 May 2008 02:58:52 +0000 (19:58 -0700)]
Actually spell "Sandy Bridge" correctly

16 years agoSandy Bridge, not Sandy Banks; add Westmere
H. Peter Anvin [Wed, 7 May 2008 02:54:28 +0000 (19:54 -0700)]
Sandy Bridge, not Sandy Banks; add Westmere

16 years agoInitial NDISASM support for AVX instructions/VEX prefixes
H. Peter Anvin [Tue, 6 May 2008 01:47:27 +0000 (18:47 -0700)]
Initial NDISASM support for AVX instructions/VEX prefixes

Initial NDISASM support for AVX instructions and VEX prefixes.  It
doesn't mean it's correct, but it seems to match my current
understanding.  It can disassemble *some*, but not *all*, of the AVX
test cases (which are known to be at least partially incorrect...)

16 years agoThe AVX R,X,B, and V fields (but not W) are inverted.
H. Peter Anvin [Mon, 5 May 2008 06:15:13 +0000 (23:15 -0700)]
The AVX R,X,B, and V fields (but not W) are inverted.

The AVX test cases are still not generated correctly, though.

16 years agoFirst cut at AVX machinery.
H. Peter Anvin [Mon, 5 May 2008 00:53:31 +0000 (17:53 -0700)]
First cut at AVX machinery.

First cut at AVX machinery support.  The only instruction implemented
is VPERMIL2PS, and it's probably buggy.  I'm checking this in with the
hope that other people can start helping out with (a) testing this,
and (b) adding instructions.

NDISASM support is not there yet.

16 years agoInitial support for YMM (AVX) registers
H. Peter Anvin [Tue, 22 Apr 2008 02:44:55 +0000 (22:44 -0400)]
Initial support for YMM (AVX) registers

Add support for ymm0..15 registers, and the "ymmreg" qualifier.
No support yet for "yword" or "dy".

16 years agoAvoid long line warning when generating nasm docs
Charles Crayne [Sat, 12 Apr 2008 20:35:43 +0000 (13:35 -0700)]
Avoid long line warning when generating nasm docs

rdsrc.pl limits lines to 68 characters for some formats

16 years agoAvoid some warnings in rdoff/rdf2bin.c
Bo Borgerson [Sat, 12 Apr 2008 15:47:57 +0000 (11:47 -0400)]
Avoid some warnings in rdoff/rdf2bin.c

I received some warnings when running make on the head revision of
nasm from git:

----
rdf2bin.c: In function 'main':
rdf2bin.c:122: warning: comparison between signed and unsigned
rdf2bin.c:123: warning: comparison between signed and unsigned
rdf2bin.c:124: warning: comparison between signed and unsigned
----

I think these warnings are innocuous and should be safely avoidable
with simple casts (please see attached patch).

* rdoff/rdf2bin.c
(main): cast to size_t for comparison with fwrite return value

Signed-off-by: Bo Borgerson <gigabo@gmail.com>