Commit Graph

2818 Commits

Author SHA1 Message Date
H. Peter Anvin
31f23b05f4 NASM 2.11.01 2014-02-18 14:05:52 -08:00
H. Peter Anvin
f2d2569bb6 changes.src: changelog for 2.11.01
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-18 14:05:14 -08:00
H. Peter Anvin
0ace62cb6a outelf: Error out on "section align" without value
If someone specifies "section align" without =value, error out.

Reported-by: Ilya Albrekht <ilya.albrekht@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-18 13:30:44 -08:00
H. Peter Anvin
1eef781594 BR 3392275: Don't require xmm0 to be specified when implicit
BR 3392275 complains about xmm0 having to be explicitly included in
the assembly syntax when it is implicit in the encoding.  In the
interest of "be liberal in what you accept", accept either form in the
input.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-16 10:25:25 -08:00
Cyrill Gorcunov
d0293d3392 BR3392274: output: Elf -- Don't crash on erronious syntax
Elf align section attribute requires syntax "align=value",
but in case if '=' is missed we pass nil pointer into
atoi function which cause libc to crash.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2014-02-15 18:40:12 +04:00
H. Peter Anvin
af10bfe167 NASM 2.11 2013-12-31 10:40:10 -08:00
H. Peter Anvin
b2fcac9a1d doc: Document DEFAULT BND/NOBND in changes, add use case
Add DEFAULT BND/NOBND to the change history, and explain the use case.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-12-31 10:38:51 -08:00
H. Peter Anvin
be1d052fff changes: Document change in [nosplit reg]
Document that [nosplit reg] as opposed to [nosplit reg*1] will no
longer force an index register.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-12-31 10:35:12 -08:00
Jin Kyu Song
26ddad67ca nosplit: Generate index-only EA only when a multiplier is used.
[nosplit eax] has been encoded as [eax*1+0] since 0.98.34.
But this seems like unexpected behavior.
So only when a register is multiplied, that will be treated
as an index. ([nosplit eax*1] -> [eax*1+0])
Document is updated accordingly.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-18 22:38:44 -08:00
Jin Kyu Song
b0c729baeb mpx: Clean up instruction data
Cleaned up unneccessary size specifiers in the instruction data.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-18 22:37:36 -08:00
Jin Kyu Song
3d06af2bd9 nosplit: Limit the effect of NOSPLIT
[nosplit eax+eax] was encoded [eax*2] previously but
this seems against the user's intention.
So in this case, nosplit is ignored now and [eax+eax] will be
generated.
Document is also updated accordingly.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-18 22:37:30 -08:00
Jin Kyu Song
97f6faec62 mib: Avoid RIP-relative addressing in mib
Using RIP relative for mib operands causes #UD exception.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-18 22:27:47 -08:00
Cyrill Gorcunov
0b900cc7e1 insns: Mark LOADALL, LOADALL286 with ND flag
Otherwise disassembler treat syscall, sysret incorrectly.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-12-13 11:00:43 +04:00
Jin Kyu Song
4360ba28f0 mib: Handle MIB EA in a different way from regular EA's
In mib operands, users' intention should be preserved.
e.g.) [eax + eax*1] and [eax*2] must be distinguished and encoded differently.

So  a new EA flag EAF_MIB for mib operands is added.
And a new EA hint EAH_SUMMED for the case of [eax+eax*4] being parsed
as [eax*5] is also added.

NOSPLIT specifier does not have an effect in mib, so [nosplit eax + eax*1]
will be encoded as [eax, eax] rather than [eax*2] as in a regular EA.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-11 16:56:19 -08:00
H. Peter Anvin
478f2dafff misc/release: Generate manpages
asciidoc/xmlto are not tools we require every users to have, so each
tarball should contain them.  That means the release script needs to
know about them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-12-11 12:10:27 -08:00
Cyrill Gorcunov
d578b511c9 iflag: Don't use c99 array initialization
It's sad but not all compilers support c99 features, so drop
off IFLAG_INIT helper.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-12-10 11:10:19 +04:00
Cyrill Gorcunov
f8d12d5011 insns-iflags: Drop occasionally introduced \Tab's
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-12-07 16:15:03 +04:00
Cyrill Gorcunov
a32e79c658 iflag: \Tabs -> \Space
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-12-07 16:14:00 +04:00
Cyrill Gorcunov
71f71c0dbe iflag: Introduce IFLAG_INIT helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-12-07 16:12:07 +04:00
H. Peter Anvin
20df33d2a5 NASM 2.11rc4 2013-12-05 00:06:45 -08:00
Jin Kyu Song
009e54e0a1 doc: Update nasmdoc
Added bnd warning and nobnd prefix. DEFAULT directive section
has got more description about BND-related settings.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-04 20:51:13 -08:00
Jin Kyu Song
b287ff0ddb bnd: Add a new nobnd prefix
bnd and nobnd prifixes can be used for each instruction line to
direct whether bnd registers should be preserved or not.

And those are also added as options for DEFAULT directive.
Once bnd is set with default, DEFAULT BND, all bnd-prefix
available instructions are prefixed with bnd. To override it,
nobnd prefix can be used.

In the other way, DEFAULT NOBND can disable DEFAULT BND and
have nasm encode in the normal way.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-04 20:10:08 -08:00
Jin Kyu Song
bb8cf3fa77 bnd: Show warning when bnd prefix is dropped
When bnd prefix is dropped as jmp is encoded as jmp short,
nasm shows a warning message, which can be suppressed with a new
command line option, -w-bnd.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-04 20:06:23 -08:00
Jin Kyu Song
0873ef5626 pfmask: Limit the preferred mask to the vendor specific flags
In ndisasm, the priority follows the order of instructions in insns.dat.
Other iflags could affect this mechanism when a proper instruction form
had a higher iflag bit set.
The preferred mask bits are now limited to vendor flags (Cyrix and AMD)
and other flags do not affect disassembler any more.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-02 18:42:19 -08:00
H. Peter Anvin
50137b8274 doc: Make the bit about mib operands a bit clearer
Clean up the text about what a mib is.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-28 21:26:26 -08:00
H. Peter Anvin
ebfa6a6452 doc: Clean up changelog for 2.11
- We don't need to list internal infrastructure improvements.
- We don't list rc releases separately.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-28 21:24:09 -08:00
H. Peter Anvin
9a06652039 NASM 2.11rc3 2013-11-28 12:22:05 -08:00
H. Peter Anvin
621a69ac5c Add {vex3} and {vex2} prefixes by analogy with {evex}
Allow specifying {vex3} or {vex2} (the latter is currently always
redundant, unless we end up with instructions at some point can be
specified with legacy prefixes or VEX) to select a specific encoding
of VEX-encoded instructions.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-11-28 12:21:11 -08:00
H. Peter Anvin
2e15eca688 NASM 2.11rc2 2013-11-28 11:36:26 -08:00
H. Peter Anvin
ed8df3eaef Remove "high 16" register class macros for xmm/ymm/zmm
The "high 16" register class macros were actually incorrect, as they
simply aliased the corresponding whole set class.  In oder to keep
someone from getting confused and making mistakes, remove them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-28 11:35:34 -08:00
Jin Kyu Song
376701ef9a testcase: Remove escape characters - '\'
Since the multi-line macro preprocessor is modified to expand
grouped parameter with braces. The escape character is not needed
any more.
The testcase converter script is also modified not to generate '\'.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 21:01:01 -08:00
Jin Kyu Song
5eac14bb0e preproc: Handle curly braces in multi-line macro parameters
Multi-line macro uses curly braces for enclosing a parameter
containing comma(s). Passing curly braces as a part of a parameter
which is already enclosed with braces confuses the macro expander.

The number of braces in a group parameter is counted and any brace
in the outmost enclosing braces is treated as a part of parameter.
	e.g.) mmacro {1,2,3}, {4,{5,6}}
	      mmacro gets 2 parameters of '1,2,3' and '4,{5,6}'

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 20:54:07 -08:00
Jin Kyu Song
28f95668e0 Revert "AVX-512: Handle curly braces in multi-line macro parameters"
This reverts commit a800aed7b7.

As recommended by the community, braces inside a group parameter
of multi-line macro should be parsed without a need of a leading
escape character such as "\{ab,c\}".

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 20:23:53 -08:00
Jin Kyu Song
487f352b62 stdscan: Rework curly brace parsing routines
As recommended by the community, a comma-separated decorators ({k1,z})
and nested braces ({{k1},{z}}) are dropped out. So only standard syntax
is supported from now.

This rework made source code neat and easy to maintain. Most of the codes
for handling corner cases are removed.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 15:43:33 -08:00
Jin Kyu Song
6cfa968e8d iflags: Add IF_EVEX for checking {evex} availability
For checking the availability of {evex} prefix, AVX512 iflag
has been used. But this is a flag for an instruction set
not for an encoding scheme. And there are some AVX512 instructions
encoded with VEX prefix.

So a new instruction flag (IF_EVEX) is added for the instructions
which are actually encoded with EVEX prefix.

This flag is automatically added by insns.pl, so no need to add manually
in insns.dat.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 15:43:33 -08:00
Jin Kyu Song
08ae610ec9 opflags: Separate vector registers into low-16 and high-16
Since only EVEX supports all 32 vector registers encoding for now,
VEX/REX encoded instructions should not take high-16 registers as operands.

This filtering had been done using instruction flag so far, but
using the opflags makes more sense.

[XYZ]MMREG operands used for non-EVEX instructions are automatically
converted to [XYZ]MM_L16 in insns.pl

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 15:43:32 -08:00
Jin Kyu Song
1ab16e4673 doc: Update the change history and nasmdoc
Added the list of features added since 2.10 release.
Nasmdoc is also updated with those new features.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 15:43:32 -08:00
H. Peter Anvin
3143a462c2 disasm: Don't rely on iflag_cmp() returning +/-1
It is safer to just rely on the sign, for future options.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-11-27 13:43:45 -08:00
H. Peter Anvin
afcb66f412 iflag: Do the equality test in iflag_cmp() first
The equality test indicates how long we spin, so do that first.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-11-27 13:41:50 -08:00
H. Peter Anvin
80d18b5555 iflag: In iflag_cmp() scan from the most significant word down
In order for iflag_cmp() to return an ordering that makes sense, we
need to scan from the most significant word downward.  That way the
bits with the higher index consistently are the more significant.

This fixes the disassembler vendor selection algorithm.  While we are
doing that, make that dependency more explicit in the comments.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-26 15:21:15 -08:00
H. Peter Anvin
4b47c77d89 iflag: Drop the use of double underscores
Double underscores are reserved for the implementation, i.e. the C
compiler and its libraries.  NASM is an application and should not use
this namespace.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 17:14:34 -08:00
H. Peter Anvin
af90d3520f iflag: Make the insns_flags array const
Make the insns_flags array const, and change the helper functions to
match.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 17:13:20 -08:00
H. Peter Anvin
54c7711858 insns.dat: Fix a typo in a comment
isnsn-iflags.pl not insns-iflag.pl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 17:07:33 -08:00
H. Peter Anvin
9a1db45895 iflag: Move instruction flag comment
Move the instruction flag comment to the Perl file where they are
defined.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 11:53:38 -08:00
H. Peter Anvin
8b0e5a34fc iflag: remove C99 constructs, don't hardcode the number of words
Avoid using C99 constructs when not necessary.  Don't hardcode the
number of words when we can autodiscover them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 11:49:24 -08:00
H. Peter Anvin
cd4c89bbb9 "make alldeps"
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 11:18:50 -08:00
H. Peter Anvin
45a22d9a61 iflag: Fix dependencies, factor out static components of iflag.h
Multi-dependencies don't work as expected, especially not across Make
versions, this is why we don't use them and read the instructions list
multiple times.

iflag.h has a lot of static content, so factor out the static content.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 11:13:10 -08:00
H. Peter Anvin
015774dc3f "make alldeps"
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 10:56:49 -08:00
Cyrill Gorcunov
ea882d0b59 insns: Restore back MMX,FPU flags
In commit 9bb987d8e0
we had to drop some flags due to flags type used
in nasm code.

Since now flags internal structure is reworked, we
can restore them back.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 13:21:04 +04:00
Cyrill Gorcunov
970df6f47f Update .gitignore
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 13:21:04 +04:00