Commit Graph

61 Commits

Author SHA1 Message Date
Henrik Gramner
bca6b26a7e insns.dat: Add Intel Control-Flow Enforcement Technology (CET) instructions
Add instructions for Intel Control Flow Enforcement Technology (CET).

Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-27 16:12:37 -07:00
H. Peter Anvin (Intel)
d85a6101d7 BR 3392681: handle a64 instruction patters correctly
The a64 instruction patterns would incorrectly force REX to zero at a
point where REX prefixes have already been assigned. This is not only
incorrect in case of instructions which can use high registers, but it
causes an assertion failure. It happened to work for J*CXZ and LOOP*.

Reported-by: Philip Lantz <philip.lantz@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-22 13:52:02 -07:00
H. Peter Anvin (Intel)
221ff044ba avx512: remove bogus imm8 for specific VCMP and VPCMP operations
When using VCMP and VPCMP operations with the condition in the opcode,
we should not have an immediate operand!

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:07:17 -07:00
H. Peter Anvin (Intel)
801f0c7815 avx512: implement shorthand forms of VCMP and VPCMP opcodes
The VCMP and VPCMP pseudo-op forms where the destination is a mask
were simply broken. Fix them.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:01:52 -07:00
H. Peter Anvin (Intel)
152cbd37e2 BR 3392676: fix cmpxchg8b/16b with explicit size
CMPXCHG8b/16b should be legitimate with an explicit operand size.

Reported-by: Xusheng Li <xushengli@protonmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 20:22:34 -07:00
H. Peter Anvin
7002bb76a3 BR 3392674: fix handling of {ud1,ud2b} <reg>,<reg>
We need the instruction table to contain the correct information for
both the reg and the rm field in the various modes.

Reported-by: <fasdfqwer@mail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-01 16:03:54 -07:00
Henrik Gramner
284ad955a4 insns.dat: Fix the opcodes for the AVX512-VBMI2 instructions
The two VPSH{R|L}DV* instructions had the wrong opcode.

Reported-by: Henrik Gramner <herik@gramner.com>
Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392607
Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2020-04-22 00:10:08 +00:00
H. Peter Anvin (Intel)
02b60ddd1c LEA: allow immediate syntax; ignore operand size entirely
The memory operand size of LEA doesn't matter in any way as it isn't
"real memory". Add an ANYSIZE option to ignore sizes entirely.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-14 15:23:00 -07:00
H. Peter Anvin (Intel)
5b39461178 obsolete handing: handle a few more subcases in a useful way
Distinguish instructions which have once been valid (OBSOLETE) from
those that never saw the light of day (NEVER). Futhermore, flag
instructions which devolve to an architectural noop from those with
undefined behavior and possibly recycled opcodes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 14:52:16 -07:00
H. Peter Anvin (Intel)
177a05d0ce perl files: clean up warnings
Clean up some perl warnings, some of which were legitimate (apparently
undef doesn't actually take a list of arguments, a common enough
mistake that it is mentioned in the man page!, and a list of variables
after "my" can be cantankerous), and some of which were nuisance but
were easy enough to clean up.

Maybe this can resolve the problems with very old version of Perl?

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 13:30:19 -07:00
H. Peter Anvin (Intel)
b1e15f42fe Add implicitly sized versions of the K instructions
This allows the K instructions to be specified without a size suffix
as long as the operands are sized; this matches the way most other x86
instructions work. As this is not the syntax specified in the SDM,
don't use it for disassembly.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 02:44:46 -07:00
H. Peter Anvin (Intel)
602e67f932 insns.pl: use less cantankerous string expansion; better error info
The flags massaging in insns.pl could end up with things like double
commas in some pathological cases, which would make insns_flag_index()
very unhappy due to the appearance of an empty argument. Fix this by
processing the flags as a list already in insns.pl.

Be more explicit and consistent in error messages.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 02:41:37 -07:00
H. Peter Anvin
21b0aa4c29 x86/insns-iflags.ph: add comments in iflag.c
Add comments to iflag.c so a human user can have any hope of
figuring out what a particular bitmask actually means.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2019-08-07 01:11:21 -07:00
H. Peter Anvin (Intel)
67289aefb5 iflags.ph: add file missing from commit 418138c8f2
Add file missing from commit 418138c8f2:
iflags: move definitions to a separate file; auto-generate more

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-07 00:56:39 -07:00
H. Peter Anvin (Intel)
418138c8f2 iflags: move definitions to a separate file; auto-generate more
Move the definitions to a separate file, in order to separate code
from data better.

We can auto-generate more information about the instruction flags, so
let's do so.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-06 22:12:11 -07:00
Chang S. Bae
55f3dd5792 insns.dat: Fix MOVDDUP instruction
https://bugzilla.nasm.us/show_bug.cgi?id=3392554

Suggested-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2019-06-02 23:51:31 +03:00
H. Peter Anvin
26191f845a Merge tag 'nasm-2.14.01'
NASM 2.14.01

Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-22 18:53:17 -08:00
H. Peter Anvin
7f688841ce insns.dat: accept explicit ax/eax/rax operand to CLZERO
AMD documents this instruction with an rax operand. The error behavior
implies this is an address-size-sensitive instruction. Add support for
specifying the explicit operand, but consistent with normal ndisasm
behavior, don't disassemble the implicit operand.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-22 17:52:27 -08:00
H. Peter Anvin
5358b98405 Don't convert the various RESx instructions to RESB
All it does is complicate things; instead leave the opcode where it
is.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-18 18:06:26 -08:00
H. Peter Anvin (Intel)
8df822f79f insns.dat: add Intel Software Guard Extensions (SGX) instructions
Add SGX instructions ENCLS, ENCLU, ENCLV.

Bug report: https://bugzilla.nasm.us/show_bug.cgi?id=3392492

Reported-by: ff_ff <qqqqqqqqqfffffffff@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 23:09:38 -07:00
H. Peter Anvin (Intel)
70c09f0aac insns.dat: V4F(N)MADDSS are .lig not .512
These instructions ignore vector length.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 18:06:40 -07:00
H. Peter Anvin
bac9023d1c insns.dat: fix the opcodes for the V4FNM* instructions
The two V4FNM* instructions had the wrong opcodes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 17:22:41 -07:00
H. Peter Anvin
cd26fccab4 asm: support the +n syntax for register sets
Support the +n syntax for multiple contiguous registers, and emit it
in the output from ndisasm as well.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 17:15:08 -07:00
H. Peter Anvin (Intel)
2bf35e0b02 insns.dat: add support for the V4* and VP4* 4-way instructions
New instructions which do four full iterations of a data-reduction
operation (FMA, dot product.)

Bug report: https://bugzilla.nasm.us/show_bug.cgi?id=3392492

Reported-by: ff_ff <qqqqqqqqqfffffffff@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:51:15 -07:00
H. Peter Anvin (Intel)
26b810176f insns.dat: add PTWRITE instruction
Add PTWRITE instruction.  It is worth noting that we should
be able to do "ptwrite [eax]" in 32-bit mode, but the instruction
selector doesn't currently handle that well in a way that doesn't make
64-bit mode very confusing.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:35:05 -07:00
H. Peter Anvin
854730bf62 insns.dat: update with instructions from ISE 319433-034
Add instructions from the Intel Instruction Set Extensions and Future
Features Programming Reference, document 319433-034, May 2018.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-06-16 00:13:58 -07:00
Cyrill Gorcunov
562561640d insns.dat: Update UD0 encoding to fit the specification
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 18:50:52 +03:00
H. Peter Anvin
4dbf3a96a4 Merge remote-tracking branch 'origin/nasm-2.13.xx'
Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-20 12:40:11 -08:00
H. Peter Anvin
8524e16303 insns.dat: add aliases of the RET instruction with explicit operand size
Make it possible to generate variants of RET(F) with explicit operand
size specified without having to use o16/o32/o64.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-14 11:09:07 -08:00
H. Peter Anvin
1b53750430 Merge tag 'nasm-2.13.03'
NASM 2.13.03

Resolved Conflicts:
	include/iflag.h
	version
	x86/insns-iflags.ph

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-07 13:51:54 -08:00
H. Peter Anvin
a7ecf2646d iflag: automatically assign values, saner handling of CPU levels
Automatically assign values to the instruction flags; we ended up with
a case where pushing flags into the next dword caused comparison
failures due to other places in the code explicitly comparing
field[3].

This creates necessary defines for this not to happen; it also cleans
up a fair bit of the iflag code.

This resolves BR 3392454.

Reported-by: Thomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-06 14:43:07 -08:00
Cyrill Gorcunov
da1cb0e000 Revert "insns.dat: Add VAESENC, VAESENCLAST instructions"
This reverts commit d625f85cd2.

Occasionally merged in from the master, while it was here
already in different form.
2018-02-05 20:20:48 +03:00
Tomasz Kantecki
d625f85cd2 insns.dat: Add VAESENC, VAESENCLAST instructions
Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-05 20:04:52 +03:00
Tomasz Kantecki
4764dfaa51 insns.dat: Add VPCLMULQDQ instruictions
https://bugzilla.nasm.us/show_bug.cgi?id=3392455

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-01-08 12:53:48 -08:00
Cyrill Gorcunov
7680602f86 insns-flags: Add VPCLMULQDQ flag
In sake of https://bugzilla.nasm.us/show_bug.cgi?id=3392455

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-01-08 12:53:41 -08:00
Cyrill Gorcunov
581fc6899b insns.dat: Move VAES instructions to AES group
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-01-08 12:53:32 -08:00
Tomasz Kantecki
1aebcc76e3 insns.dat: Add VAESENC, VAESENCLAST instructions
Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-01-08 12:53:26 -08:00
Cyrill Gorcunov
a8f3698cf3 insns-iflags: Add AES, VAES flags
In sake of https://bugzilla.nasm.us/show_bug.cgi?id=3392454

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-01-08 12:53:19 -08:00
Tomasz Kantecki
c90d99a655 insns.dat: Add VPCLMULQDQ instruictions
https://bugzilla.nasm.us/show_bug.cgi?id=3392455

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-12-29 17:20:33 +03:00
Cyrill Gorcunov
f1f8ef48f4 insns-flags: Add VPCLMULQDQ flag
In sake of https://bugzilla.nasm.us/show_bug.cgi?id=3392455

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-12-29 17:20:29 +03:00
Cyrill Gorcunov
0ba95b7767 insns.dat: Move VAES instructions to AES group
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-12-29 17:20:25 +03:00
Tomasz Kantecki
3a6c71f931 insns.dat: Add VAESENC, VAESENCLAST instructions
Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-12-29 17:20:21 +03:00
Cyrill Gorcunov
73ab510c71 insns-iflags: Add AES, VAES flags
In sake of https://bugzilla.nasm.us/show_bug.cgi?id=3392454

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-12-29 17:20:17 +03:00
H. Peter Anvin
ece809789e Merge remote-tracking branch 'origin/nasm-2.13.xx'
Resolved conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-01 10:37:18 -07:00
H. Peter Anvin
81fd01f9d0 BR 3392362: generate RMI versions of PEXTRW when possible
We could generate the MRI version (SSE 4.1) instead of the RMI
(SSE 2) version of these instructions if a 64-bit register was given
as the destination.

Reported-by: Vasiliy Olekhov <olekhov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:55:57 -07:00
H. Peter Anvin
3cee8b4a4a insns.dat: change the title of the pseudo-ops section
Use the term pseudo-ops, as this is a well-known assembly term.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 21:46:34 -07:00
H. Peter Anvin
af9fe8f597 Don't sort opcodes; move all pseudo-ops to the beginning
We don't need to sort opcodes anymore, since we are using an O(1) hash
and not binary search.  Instead, sort them in the order they first
appear in insns.dat; this lets us move all the pseudo-ops to a
contiguous range at the start of the file, for more efficient
handling.

Change the functions that process pseudo-ops accordingly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 21:44:24 -07:00
H. Peter Anvin
bdbaaa207c doc: clean up the instruction list in the documentation slightly
Compactify the instruction list in the documentation to have fewer
margin violations, and fix some of the headings (;#).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-07 09:51:24 -07:00
H. Peter Anvin
e83311c73d BR 3392396: fix EVEX compressed displacements
The fvm: annotation to generate the correct EVEX compressed
displacements had inadvertently gotten dropped from a handful of
instructions in checkin c33d95fde9:

BR 3392370: {z} decorator allowed on MOVDQ* memory operands

Put them back, and verify they work.

Reported-by: Henrik <henrik@gramner.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 18:52:08 -07:00
H. Peter Anvin
526a6c7390 Rename insns-iflags.pl -> insns-iflags.ph, add missing dependency
insns-iflags.ph is included from another Perl script, so rename it .ph
(Perl header).  Add missing dependency to the main Makefile.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 10:33:12 -07:00