Commit Graph

219 Commits

Author SHA1 Message Date
H. Peter Anvin
2d31ec106a 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!
2008-05-20 18:21:11 -07:00
H. Peter Anvin
9681ef4144 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.
2008-05-20 18:14:30 -07:00
H. Peter Anvin
4ae88e1a83 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.
2008-05-20 17:14:17 -07:00
H. Peter Anvin
f99359c03a Finish the VCMP series... 2008-05-20 16:59:17 -07:00
H. Peter Anvin
e6d0eb4d68 More AVX instructions
Add additional AVX instructions to the list.
2008-05-20 16:48:34 -07:00
H. Peter Anvin
73252a92ae 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.
2008-05-20 13:07:09 -07:00
H. Peter Anvin
dfb918047b 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.
2008-05-20 11:43:53 -07:00
H. Peter Anvin
d82dd4f1a3 insns.dat: no subheader for "must be last" 2008-05-20 11:05:59 -07:00
H. Peter Anvin
1e5203872d 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.
2008-05-20 11:04:26 -07:00
H. Peter Anvin
8597e6900c 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.
2008-05-20 11:01:28 -07:00
H. Peter Anvin
2812ff5181 Use the \360..\363 annotations for SSE prefixes 2008-05-20 10:21:57 -07:00
H. Peter Anvin
aaa088fbf3 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.
2008-05-12 11:13:41 -07:00
H. Peter Anvin
e303936391 Fix encoding of VPERMIL2PS instructions 2008-05-06 20:06:14 -07:00
H. Peter Anvin
42a8caecb5 Sandy Bridge, not Sandy Banks; add Westmere 2008-05-06 19:54:28 -07:00
H. Peter Anvin
d85d250fa2 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.
2008-05-04 17:53:31 -07:00
H. Peter Anvin
32cd4c2a62 Correctly identify SBYTE in the optimizer
Correctly identify SBYTE in the optimizer, *HOWEVER*, this change will
cause nuisance warnings to be issued; that will have to be fixed.
2008-04-04 13:34:53 -07:00
Charles Crayne
fa93735742 Remove KATMAI support for CLFLUSH
Minimal cpu level is WILLAMETTE,SSE2
2008-03-22 20:07:08 -07:00
H. Peter Anvin
65e823978b insns.dat: add "MOV reg64,imm32" as a special rule
Add "MOV reg64,imm32" as a special rule, to handle the case of
"mov rax,dword <foo>", where <foo> is sign-extended; this is a 7-byte
form, as opposed to "mov eax,<foo>" (5 bytes) and "mov rax,<foo>" (10
bytes).

At some point, the optimizer needs to be able to handle these.
2008-03-19 14:42:20 -07:00
Charles Crayne
6372b9c5fc Correct opcode for CLFLUSH
Correct opcode is 0FAEh
2008-03-18 15:21:14 -07:00
H. Peter Anvin
373281afde BR 1893952: XGETBV is not privileged. 2008-02-16 13:29:56 -08:00
H. Peter Anvin
f6c51f084b Add XSAVE instruction features (CPU feature is bogus, but oh well.)
Add the XSAVE group of instructions: XSAVE, XRSTOR, XGETBV, XSETBV.
The CPU feature information is bogus, but so is our entire handling of
CPU feature sets for anything but the bare necessities (long jump
emulation, etc.)
2008-02-14 11:25:36 -08:00
Ismail Dönmez
e7d855209a BR 1879590: More MMX/SSE size fixes
Fix more instances of MMX/SSE having "SM" instead of "SQ" or "SO".
This should hopefully resolve bug report 1879590.
2008-01-30 14:09:45 -08:00
Charles Crayne
c17a0eb31b Add autogenerated instruction list to NASM documentation
1. Allow included files in rdsrc.pl
2. New program inslist.pl to generate instruction list from insns.dat
3. Mark certain comments in insns.dat as documentation subheaders
4. Add Instruction List appendix to nasmdoc.src
5. Update build process to invoke inslist.pl
2008-01-20 16:27:03 -08:00
Beroset
095e6a2973 regularized spelling of license to match name of LICENSE file 2007-12-29 09:44:23 -05:00
H. Peter Anvin
69f0557345 Remove bogus duplicates of the PREFETCH* instructions 2007-12-25 15:24:07 -08:00
H. Peter Anvin
1bec91e567 (Hopefully) fix the handing of MMX instructions with prefixes
Mark MMX instructions with \323 (do not add REX.W) unless they involve
the integer instruction file.

Change SM -> SQ for MMX instructions.

Something not complete attached, so my understanding is
mmxreg,mmxrm needs SQ

Something like xmmreg,reg32 needs SD
xmmreg,xmmrm needs SO
2007-12-25 15:18:12 -08:00
H. Peter Anvin
15c1e5aa4d Unbreak CMPSW/CMPSD/CMPSQ
The CMPSW/CMPSD/CMPSQ instructions were broken by checkin
a30cc07224 due to an incorrect removal
of \1 (should only have been removed after \144-147 and \154-157).  I
have verified that no other instructions were affected.
2007-11-20 21:45:16 -08:00
H. Peter Anvin
a30cc07224 BR 1834292: Fix multiple disassembler bugs
- Correct the building on the disassembler decision tree.
- Handle SSE instructions with F2 prefix (\332) correctly.
- Mark instructions which are now used as prefixes with ND.
  (In a future version when we have better CPU version handling,
  we should probably build the decision tree at runtime based on
  the selected CPU feature sets.)
- Sanitize the handling of \144-147 and \154-157 in both the assembler
  and disassembler.  They take an opcode byte as argument; don't
  pretend they don't.
2007-11-18 21:55:26 -08:00
H. Peter Anvin
7812644665 BR 993895: Support zero-operand floating-point insn
Support the zero-operand form of floating-point instructions.  Note
that in most cases, the form generated is actually the "popping" form,
e.g. "FADD" becomes "FADDP st0,st1".  This is in accordance with the
Intel documentation.  "FADDP" is also supported.
2007-11-15 14:38:19 -08:00
H. Peter Anvin
bb72f7f111 Un-special-case "xchg rax,rax"; disassemble o64
Un-special-case "xchg rax,rax"; allow it to be encoded as 48 90 for
orthogonality's sake.  It's a no-op, to be sure, but so are many other
instructions.

"xchg eax,eax" is still special-cased in 64-bit mode since it is not a
no-op; unadorned opcode 90 is now simply "nop" and nothing else.

Make the disassembler detect unused REX.W and display them as an "o64"
prefix.
2007-11-12 22:56:07 -08:00
H. Peter Anvin
4b3390eb47 BR 1828866: fix handling of LAR/LSL
Fix handling of LAR/LSL with various sized operands
2007-11-12 22:05:31 -08:00
H. Peter Anvin
2344010d26 Fix disassembly of XCHG
"REX.B 90" in 64-bit mode is "xchg eax,r8d" not "nop"; equivalent
situation for "REX.WB 90" (xchg rax,r8).
2007-11-12 21:02:33 -08:00
H. Peter Anvin
aff9c93aa4 Fix handling of XCHG in 64-bit mode
The handling of XCHG in 64-bit mode somewhat broken.  Add a register
flag for "not accumulator", so we can generate all the appropriate
modes.
2007-11-12 20:18:05 -08:00
H. Peter Anvin
ce6c8a7929 More \321 -> \324 bug fixes
Additional \321 flags (o32) that should be \324 (o64).
2007-11-12 19:36:13 -08:00
H. Peter Anvin
de4b89bb3e 64-bit addressing and prefix handling changes
Revamp the address- and prefix-handling code to make more sense in
64-bit mode.  We are now a lot closer to where we want to be, but
we're not quite there yet.

ndisasm may very well have problems, or give counterintuitive output.
However, checking it in so we can make forward progress.
2007-10-28 22:04:00 -07:00
H. Peter Anvin
826ffa9c8e Fix FISTTP opcodes (BR 689695) 2007-10-15 19:53:10 -07:00
H. Peter Anvin
17394a7d8e insns.dat: add systematic names for the hinting NOPs (0F18-0F1F)
0F 18-1F are reserved for hinting NOPs; they all take a single memory
operand which may be sized.  Allow the use of systematic names; this
also makes sure they get sensibly disassembled.
2007-10-02 15:09:33 -07:00
H. Peter Anvin
c58642fbba Correct the handling of "MOV" with immediate in 64-bit mode
Correct the handling of "MOV" with immediate in 64-bit mode.  With
these changes, movimm.asm produces the desired results.
2007-09-25 15:40:36 -07:00
H. Peter Anvin
3e1aaa9dd0 Fix BR 1490407: size of the second operand of LAR/LSL
The second operand of LAR/LSL is always 16 bits.
2007-09-25 14:26:03 -07:00
H. Peter Anvin
415c7ced1d insns.dat: SMINT - mark ND, DMINT - fix opcode
Fix the opcode for DMINT (0F 39); mark SMINT (0F 38) as ND since 0F 38
is used as a prefix by newer processors.
2007-09-24 15:56:02 -07:00
H. Peter Anvin
2a5156b284 Additional compaction missed by script
Additional mmxreg/mem -> mmxrm and xmmreg/mem -> xmmrm compactions
which the script missed.
2007-09-24 15:48:09 -07:00
H. Peter Anvin
86317c423d insns.dat: machine-generated compaction mmx/xmmreg,mem -> mmx/xmmrm
Reduce the total instruction count by compacting mmxreg:mem pairs to
mmxrm and d:o for xmmreg:mem -> xmmrm.
2007-09-24 15:42:53 -07:00
H. Peter Anvin
fc565dd362 Implement INVLPGA according to the documentation
INVLPGA is defined as taking rax,ecx but "the portion of rax used to
form the address is determined by the effective address size", so it
is really ax/eax/rax.
2007-09-22 22:35:28 -07:00
H. Peter Anvin
438ed48c49 Reformat insns.dat to uniform column width
Add a script to reformat insns.dat to uniform width, and use it.
2007-09-22 22:02:34 -07:00
H. Peter Anvin
c5b9ce0a84 Auto-generate 0x67 prefixes without the need for \30x codes
Auto-generate 0x67 prefixes without the need for \30x codes; the
prefix is automatically added when there is a memory operand with
address size differing from the current address size (and impossible
combinations checked for.)
2007-09-22 21:49:51 -07:00
H. Peter Anvin
8fcca64a2a LDDQU needs \301 (BR 1103549) 2007-09-22 19:52:11 -07:00
H. Peter Anvin
dcb4b885d5 RDTSCP and INVLPGA aren't 64-bit specific
X64 means X86_64,LM -- long mode only.
2007-09-22 19:51:13 -07:00
H. Peter Anvin
f5c8cf0027 Cyrix GX1 instructions: BBx_RESET, CPU_READ, CPU_WRITE 2007-09-22 19:40:37 -07:00
H. Peter Anvin
763cb77c90 Centaur XSHA1, XSHA256, MONTMUL 2007-09-22 19:28:14 -07:00
H. Peter Anvin
4d283f685f Implement Centaur's XCRYPT instructions
Implement Centaur's XCRYPT instruction (RFE 825529)
2007-09-22 19:20:56 -07:00
H. Peter Anvin
83828b6ce8 Add Geode LX (AMD's Cyrix-derived core) instructions
Add Geode's instructions: DMINT, RDM, PFRCP, PFRSQRT
2007-09-22 19:13:05 -07:00
H. Peter Anvin
48f7a93c0a Add the GETSEC instruction for Intel SMX 2007-09-22 19:05:11 -07:00
H. Peter Anvin
4ca9d78c5f Add the AMD SSE4a and LZCNT instructions
Add AMD SSE4a and LZCNT
2007-09-22 18:59:18 -07:00
H. Peter Anvin
57f38cdc0b Tag UMOV as ND (no disassembly) to avoid collision
The UMOV opcodes have been recycled; tag UMOV as ND until we have a
better way to specify to the disassembler exactly how it wants
instructions interpreted.
2007-09-22 18:23:20 -07:00
H. Peter Anvin
510a2508e6 Merge commit 'origin/master' into sse5 2007-09-18 15:43:40 -07:00
H. Peter Anvin
eef59fc328 Add NOP with argument to the instruction list
0F 1F /0 is documented as an EA-taking NOP since the P6.
0F 18..1F + EA are all "hinting nops" (instructions which, when
unimplemented, have no effect rather than #UD) but 0F 1F /0
specifically has no operation whatsoever.
2007-09-18 15:43:08 -07:00
H. Peter Anvin
41c9f6fde0 Implement "oword" (128 bits) as a first-class size
Implement oword, reso, do, as well as the SO flag to instructions.  No
instructions are actually flagged with SO yet, but this allows us to
specify 128-bit sizes in instruction patterns.
2007-09-18 13:01:32 -07:00
H. Peter Anvin
3ce3715fba SSE5 instruction table
Implement the full SSE5 instruction table.
2007-09-18 12:23:21 -07:00
H. Peter Anvin
0a80739c46 insns.dat: All SSE5 instructions are AMD
SSE5 is an AMD-defined instruction set, so tag those AMD.
2007-09-17 17:27:46 -07:00
H. Peter Anvin
cf5180a955 Actually generate SSE5 instructions
This checkin completes what is required to actually generate SSE5
instructions.  No support in the disassembler yet.

This checkin covers:

- Support for actually generating DREX prefixes.
- Support for matching operand "operand X must match Y"
2007-09-17 17:25:27 -07:00
H. Peter Anvin
18b78815b9 Merge commit 'origin/master' into sse5 2007-09-17 15:49:53 -07:00
H. Peter Anvin
7eb4a38793 Initial support for four arguments per instruction
For SSE5, we will need to support four arguments per instruction.
2007-09-17 15:49:30 -07:00
H. Peter Anvin
2dba5c218d CLFLUSH: Neither an x64 instruction nor AMD
CLFLUSH was introduced at least in Katmai, if not sooner.  It's
available in all modes.
2007-09-17 15:48:32 -07:00
H. Peter Anvin
388b3ab3a3 Fix literal F2 and F3 prefixes
Correct literal F2 and F3 prefixes and instead use \332 and \333.
Otherwise we get the REX prefixes in the wrong place.
2007-09-12 22:02:06 -07:00
H. Peter Anvin
cb9b690ae6 Add (untested!) SSSE3, SSE4.1, SSE4.2 instructions
Add the SSSE3, SSE4.1 and SSE4.2 instruction sets.  Change \332 to be
a literal 0xF2 prefix, by analog with \333 for 0xF3 prefix (the
previous \332 flag changed to \335).  This is necessary to get the REX
prefix in the right place for instructions that use it.

We are going to have to go in and change existing instruction patterns
which use these, as well.
2007-09-12 21:58:51 -07:00
H. Peter Anvin
daffd79372 Add support for Tejas New Instructions (SSSE3)
Add the SSSE3 instruction set.
2007-09-12 21:06:36 -07:00
H. Peter Anvin
d105682096 Remove $Id$ tags (useless with git)
Remove CVS $Id$ tags, since git doesn't use them.
2007-09-12 21:05:06 -07:00
H. Peter Anvin
c9f8ee92f0 Use rm32 operands for VMREAD/VMWRITE
Use rm32 instead of coding reg32 and mem32 separately.
2007-09-12 21:04:58 -07:00
H. Peter Anvin
62cb606f68 Handle instructions which can have both REX.W and OSP 2007-09-11 22:44:03 +00:00
H. Peter Anvin
53a3c687dd Fix some MMX/SSE irregularities which interact with the 64-bit support 2007-09-02 16:37:03 +00:00
Keith Kanios
48af17738c Fixed issues with REX prefix effective address generation. Fixed XMM instruction output. 2007-08-17 07:37:52 +00:00
H. Peter Anvin
021993cf64 Machine-generated \321->\324 corrections
Use a script to find \321's that should be \324's.  This is not in any
way guaranteed to be an exhaustive list, however, I have manually verified
that all the items that *were* changed *should* be changed.
2007-05-30 22:20:01 +00:00
H. Peter Anvin
06bf8db596 More \321 -> \324
More \321 that should be \324...
2007-05-30 03:44:50 +00:00
H. Peter Anvin
1cf9c9d3ab MOV reg64,reg64 takes \324 (64 bit with REX) not \321 (32 bit) 2007-05-30 02:48:51 +00:00
H. Peter Anvin
0db11e236b Handle "LOCK as REX.R" for MOV CRx; fix warning for invalid 64-bit regs
- MOV gpr,CRx or MOV CRx,gpr can access high control registers with a LOCK
  prefix; handle that in both the assembler and disassembler.
- Get a saner error message when trying to access high resources in
  non-64-bit mode.
2007-04-17 20:23:11 +00:00
Keith Kanios
fd626d6770 MEM_OFFSET Instructions Fixed. 2007-04-16 18:16:46 +00:00
Keith Kanios
56e3528b4a Fixed long mode MEM_OFFS issue. 2007-04-16 14:05:01 +00:00
H. Peter Anvin
ed45f4c6f2 More \321 -> \324 for 64-bit instructions
The assembler doesn't seem to care, but for the disassembler, it's
vitally important that we get our operand-size hints correctly.  We
probably need to audit insns.dat for this kinds of errors.
2007-04-16 05:26:29 +00:00
H. Peter Anvin
7cf03aff4f More 64-bit ndisasm fixes.
In particular, now we should handle A0-A3 instructions.
2007-04-16 02:39:56 +00:00
H. Peter Anvin
b061d595fb Fixes for 64-bit ndisasm.
This fixes some of the most glaring bugs in ndisasm 64-bit mode.  We're
still getting redundant prefixes for unknown reason, however.
2007-04-16 02:02:06 +00:00
H. Peter Anvin
e2eb92d055 CR8 is not special in any way as far as the assembler is concerned.
CR8 is not special in any way as far as the assembler is concerned.  It's
listed as having a special form in the Intel documentation, but that is
only because there are no other CRs which require a REX prefix.

MOV to CR8 is special in the sense that it's a non-serializing
instruction, but that's irrelevant to the assembler.

Furthermore, it's totally unclear how TRs should be handled in long mode;
there are no CPUs which uses TRs which also have long mode, so the easiest
is to simply mark those instructions NOLONG.

Finally, add PRIV to some privileged instructions.
2007-04-15 23:09:23 +00:00
Keith Kanios
b7a89544d0 General push for x86-64 support, dubbed 0.99.00. 2007-04-12 02:40:54 +00:00
Eric Christopher
aa348dec7d Add VMX instructions. 2006-03-02 18:35:09 +00:00
H. Peter Anvin
cd342f0f7e STR also has SMSW/SLDT-like semantics for operand size 2003-09-02 21:38:48 +00:00
H. Peter Anvin
539f81d517 SMSW and SLDT are implicitly 16 bits when accessing memory, but can set
the upper part of a 16-bit register if used with a 32-bit register
argument.
2003-08-27 21:25:44 +00:00
H. Peter Anvin
eea289f908 Add Cyrix XSTORE 2003-03-12 04:57:51 +00:00
H. Peter Anvin
10101f26bc Add support for the new instructions in Prescott 2003-02-24 23:22:45 +00:00
Frank Kotler
761c5cc5d3 bugfixes to insns.dat pmovhps, pmovlps, sysexit 2003-02-04 17:13:49 +00:00
H. Peter Anvin
08a3377059 Fix bug 615409 (UNPCKHPD xmmreg,mem not vice versa) 2002-11-08 20:18:51 +00:00
Debbie Wiles
0fde2f574e Removed unnecessary address size flags from register only versions of instructions 2002-06-07 07:12:49 +00:00
H. Peter Anvin
232badbbbc This is the "megapatch":
a) Automatically generate dependencies for all Makefiles;
b) Move register definitions to a separate .dat file;
c) Add support for "unimplemented but there in theory" registers.
2002-06-06 02:41:20 +00:00
H. Peter Anvin
3ab8de6a14 Add the JMPE instruction. 2002-05-28 01:25:06 +00:00
H. Peter Anvin
3ba467795a Deal with another case of address/operand size confusion, BR 560873 2002-05-27 23:19:35 +00:00
Debbie Wiles
d71fe8ec11 *** empty log message *** 2002-05-10 23:07:02 +00:00
Debbie Wiles
1c7da40456 *** empty log message *** 2002-05-09 21:23:55 +00:00
H. Peter Anvin
10eb0c3e47 Processor level fixes from John Coffman 2002-05-09 20:55:50 +00:00
H. Peter Anvin
8ac364139a NASM 0.98.30 2002-04-30 21:09:12 +00:00
H. Peter Anvin
9a633fa3b9 NASM 0.98.25alt 2002-04-30 21:08:11 +00:00
H. Peter Anvin
9f39464e5b NASM 0.98.25 2002-04-30 21:07:51 +00:00
H. Peter Anvin
dce1e2f795 NASM 0.98.23 2002-04-30 21:06:37 +00:00
H. Peter Anvin
09f6acbb75 NASM 0.98.21 2002-04-30 21:05:55 +00:00
H. Peter Anvin
788e6c10e1 NASM 0.98.12 2002-04-30 21:02:01 +00:00
H. Peter Anvin
4cf1748e68 NASM 0.98.11 2002-04-30 21:01:38 +00:00
H. Peter Anvin
734b188090 NASM 0.98.09 2002-04-30 21:01:08 +00:00
H. Peter Anvin
1cd0e2d5bf NASM 0.98.08 2002-04-30 21:00:33 +00:00
H. Peter Anvin
af535c16cf NASM 0.98.03 2002-04-30 20:59:21 +00:00
H. Peter Anvin
41bf8002b2 NASM 0.98 2002-04-30 20:58:18 +00:00
H. Peter Anvin
ef7468f4ec NASM 0.98p7 2002-04-30 20:57:59 +00:00
H. Peter Anvin
620515ab4e NASM 0.98p6 2002-04-30 20:57:38 +00:00
H. Peter Anvin
f443eb3d0d NASM 0.98p3.6 2002-04-30 20:57:02 +00:00
H. Peter Anvin
4836e3374e NASM 0.98p3.5 2002-04-30 20:56:43 +00:00
H. Peter Anvin
b64535fd4e NASM 0.98p3.3 2002-04-30 20:55:37 +00:00
H. Peter Anvin
ce14ce6fc4 NASM 0.98p3.2 2002-04-30 20:54:58 +00:00
H. Peter Anvin
900fa5b26b NASM 0.98p3-hpa 2002-04-30 20:54:13 +00:00
H. Peter Anvin
eba20a73f2 NASM 0.98p3 2002-04-30 20:53:55 +00:00
H. Peter Anvin
76690a12ad NASM 0.96 2002-04-30 20:52:49 +00:00
H. Peter Anvin
d7ed89eac9 NASM 0.94 2002-04-30 20:52:08 +00:00
H. Peter Anvin
ea8382740d NASM 0.93 2002-04-30 20:51:53 +00:00
H. Peter Anvin
ea6e34db64 NASM 0.91 2002-04-30 20:51:32 +00:00