Commit Graph

104 Commits

Author SHA1 Message Date
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