Commit Graph

65 Commits

Author SHA1 Message Date
Cyrill Gorcunov
0835915c1d iflag: Start using new instruction flags engine
Here we start using instruction flags generator.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 13:20:59 +04:00
Jin Kyu Song
267d0af79c PREFETCHWT1: Add a new instruction flag
PREFETCHWT1 instruction's CPUID was TBD before.
Now it has its new CPUID bit : PREFETCHWT1

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
Jin Kyu Song
b4e1ae18e2 MPX: Move BND prefix indication from bytecode to iflags
As BND prefix validity check conflicts with jcc8 prefix,
IF_BND is added for the instruction templates which can have
bnd prefix for preserving the content of bound register.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
Jin Kyu Song
47e7389fdf iflags: Use UINT64_C() for 64bit values
UINT64_C() macro is used for iflags as it becomes 64bit.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
Jin Kyu Song
da1a5cd514 SHA: Add SHA instructions
New instruction extensions of SHA family are added.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
Jin Kyu Song
164d60740f MPX: Add MPX instructions
Added MPX instructions and corresponding parser and encoder.

ICC style mib - base + disp and index are separate - is supported.
E.g. bndstx [ebx+3], bnd2, edx -> ebx+3 : base+disp, edx : index

As a supplement to NASM style mib - split EA - parser,
omitted base+disp is now treated as 0 displacement.
E.g. bndstx [,edx], bnd2 -> bndstx [0,edx], bnd2

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:41 -08:00
H. Peter Anvin
0bc288f8b9 disasm: add support for emitting split EA format
Add support for emitting split EA format in the disassembler,
indicated by the MIB instruction flag.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:41 -08:00
Jin Kyu Song
eb595942b2 AVX-512: Added AVX-512PF instructions
Added Prefetch (AVX-512PF) instructions.
These instructions are supported
if CPUID.(EAX=07H, ECX=0):EBX.AVX512PF[bit 26] = 1.
CPUID feature flag for PREFETCHWT1 is TBD
but PREFETCHWT1 is included in this commit.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-14 01:27:10 +04:00
Jin Kyu Song
dd1c0c13c8 AVX-512: Add AVX-512ER instructions
Added Exponential and Reciprocal (AVX-512ER) instructions.
These instructions are supported
if CPUID.(EAX=07H, ECX=0):EBX.AVX512ER[bit 27] = 1.
IF_AVX512 is now shared by all AVX-512* instructions as a bit mask.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-14 01:27:06 +04:00
Jin Kyu Song
d4b2b5f17c AVX-512: Add AVX-512CD instructions
Added Conflict Detection (AVX-512CD) instructions.
These instructions are supported
if CPUID.(EAX=07H, ECX=0):EBX.AVX512CD[bit 28] = 1.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-14 01:27:02 +04:00
Jin Kyu Song
b21f97db0e AVX-512: Add IF_SPMASK and fix IF_PFMASK
Defined IF_SPMASK for specific processor types and
fixed IF_PFMASK to mask the exact preferred bits only.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-29 10:03:19 +04:00
Jin Kyu Song
9bb987d8e0 AVX-512: Change the data type for instruction flags
Increased the size of data type for instruction flags from 32bits to 64bits.
And a new type (iflags_t) is defined for better maintainability.

Bigger data type is needed because more instruction set types are coming
but there were not enough space for them. Since they are not bit masks,
only one instruction set is allowed for each instruction.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-28 09:37:21 +04:00
Jin Kyu Song
cc1dc9de53 AVX-512: Add EVEX encoding and new instructions
EVEX encoding support includes 32 vector regs (XMM/YMM/ZMM),
opmask, broadcasting, embedded rounding mode,
suppress all exceptions, compressed displacement.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-16 09:06:15 +04:00
Cyrill Gorcunov
579f161d48 Add IF_TBM flag
For TMB instructions

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-10 13:24:15 +04:00
H. Peter Anvin
fb3f4e6ddb HLE: Change NOHLE to be an instruction flag
The way our matching system works we have to make NOHLE an instruction
flag rather than an byte code; by the time we run the byte code
interpreter we have already picked an instruction pattern once and for
all.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-25 22:22:07 -08:00
H. Peter Anvin
8cc8a1d836 Add support for warning on invalid LOCK prefixes
Add an LOCK flag to the instruction template, and make the presence of
a LOCK prefix trigger a warning if it is not set.  Simplify the LOCK
and HLE logic by hard-coding the knowledge that operand 0 has to be
memory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-25 11:11:42 -08:00
Cyrill Gorcunov
d0f773230e insns: Add AVX2 transactional synchronization extensions
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-02-09 16:20:57 -08:00
Cyrill Gorcunov
7248f8c9e9 Some cleanup on insns.h
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-07-17 17:52:03 +04:00
H. Peter Anvin
9f0dcfc724 A few more AVX2 spec instructions
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2011-07-08 16:08:34 -07:00
Jasper Neuman
619bfc87d1 insns.h: Add BMI1 and BMI2 flags for further usage
Signed-off-by: Jasper Neuman <jasper.neumann@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-07-07 00:03:49 +04:00
Cyrill Gorcunov
f753cd2fd3 Add IF_AVX2 flag
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-06-25 12:01:30 +04:00
H. Peter Anvin
47fb7bc088 assemble: add an OPT instruction flags for optimizing assembly only
Add an OPT flag to only use a pattern for optimizing assembly only.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-24 13:53:22 -07:00
H. Peter Anvin
5d62e57a0c ndisasm: handle VEX.LIG
A lot of instructions ignore the L bit in the VEX prefix, just like
a lot of instructions ignore the W bit, so don't use them in the
sub-table select.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-19 17:04:36 -07:00
H. Peter Anvin
a81655bffb Enable fuzzy matching of operand sizes
This allows automatic fuzzy matching of operand sizes.  If an operand
size is not specified, but there is exactly one possible size for the
instruction, select that instruction size.  This requires a second
pass through the instruction patterns, and so is slightly slower, but
should be a lot easier to get right than the S- flags, and works even
when there is more than one instruction.

The new SX (Size eXact) flag can be used to prevent fuzzy matching
completely.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-25 18:15:28 -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
d8e47f6da9 FMA instructions won't be in Sandy Bridge
The FMA instructions aren't scheduled for Sandy Bridge after all.
They will be "in a future processor", so create a placeholder for now.
2009-02-21 16:43:48 -08:00
H. Peter Anvin
dd84acedcc 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.
2008-05-23 17:46:08 -07:00
H. Peter Anvin
2fb033af18 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.
2008-05-21 11:05:39 -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
2c94c44f35 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.
2008-05-13 14:29:47 -07:00
H. Peter Anvin
3720f7beae 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.
2008-05-12 11:00:50 -07:00
H. Peter Anvin
4e0fd9fb63 Actually spell "Sandy Bridge" correctly 2008-05-06 19:58:52 -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
Beroset
095e6a2973 regularized spelling of license to match name of LICENSE file 2007-12-29 09:44:23 -05:00
H. Peter Anvin
dc467ba8af Support __float*__ for floating-point numbers in expressions
Add special operators to allow the use of floating-point constants in
contexts other than DW/DD/DQ/DT/DO.

As part of this checkin, make MAX_KEYWORD generated by tokhash.pl,
since it knows what all the keywords are so it can tell which one is
the longest.
2007-09-24 12:30:54 -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
f48bc6fb48 Support generating NaNs and infinities
Support generating NaNs and infinities as part of floating-point
constants.
2007-09-18 21:55:56 -07:00
H. Peter Anvin
19e2010536 Speed up the disassembler by allowing prefixed instruction tables
Modify the disassembler so that we can have separate instruction
tables for prefixed instructions.  As it was, all instructions which
started with 0F were linearly searched, and that is by now more than
half the instruction set.
2007-09-18 15:08:20 -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
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
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
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
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
2e7dd975eb Macros for SSSE3/SSE4 instruction sets
Add instruction set flags for the SSSE3, SSE4.1 and SSE4.2 instruction
subsets.
2007-09-12 21:04:51 -07:00
H. Peter Anvin
3360d79369 Make the big instruction arrays "const"
Make the big instruction arrays "const", so they end up in readonly
storage.  While we're at it, move their prototypes into insns.h.
2007-09-11 04:16:57 +00:00
H. Peter Anvin
ea6bfb8107 Use an actual enum for the opcode
Use an actual named enum for the opcode, that way it shows up in
cleartext while debugging.
2007-09-10 23:32:05 +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