platform/upstream/nasm.git
5 years agoFix regular expression at doc/rdsrc.pl 73/201173/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified accepted/tizen_unified accepted/tizen_unified_toolchain tizen tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix tizen_6.0 tizen_6.0_hotfix tizen_6.5 tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/5.5/unified/20191031.010846 accepted/tizen/5.5/unified/mobile/hotfix/20201027.073617 accepted/tizen/5.5/unified/wearable/hotfix/20201027.095926 accepted/tizen/6.0/unified/20201030.111207 accepted/tizen/6.0/unified/hotfix/20201102.231657 accepted/tizen/6.5/unified/20211028.223921 accepted/tizen/7.0/unified/20221110.061944 accepted/tizen/7.0/unified/hotfix/20221116.111151 accepted/tizen/8.0/unified/20231005.095241 accepted/tizen/unified/20190311.072555 accepted/tizen/unified/toolchain/20240128.235627 accepted/tizen/unified/toolchain/20240311.005236 submit/tizen/20190311.062915 submit/tizen_5.5/20191031.000007 submit/tizen_5.5_mobile_hotfix/20201026.185107 submit/tizen_5.5_wearable_hotfix/20201026.184307 submit/tizen_6.0/20201029.205503 submit/tizen_6.0_hotfix/20201102.192903 submit/tizen_6.0_hotfix/20201103.115103 submit/tizen_6.5/20211028.163601 tizen_5.5.m2_release tizen_6.0.m2_release tizen_6.5.m2_release tizen_7.0_m2_release tizen_8.0_m2_release
Dongkyun Son [Mon, 11 Mar 2019 06:00:02 +0000 (15:00 +0900)]
Fix regular expression at doc/rdsrc.pl

fix build error
"""
[  105s] perl ./rdsrc.pl html < nasmdoc.src
[  105s] Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\\{ <-- HERE / at ./rdsrc.pl line 252.
[  105s] Makefile:47: recipe for target 'html/nasmdoc0.html' failed
"""

Change-Id: Ic9dd399c02a8795deb301f42d68868d93c9bb5fd
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
5 years agoAdd perl include path 72/201172/1
Dongkyun Son [Mon, 11 Mar 2019 05:55:03 +0000 (14:55 +0900)]
Add perl include path

fix build error
"""
Can't locate insns-iflags.pl in @INC
"""

Change-Id: I01ae31fdfc9d5741166c4282ea3bf08389a6db8f
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
8 years agoAdd nasm.changes file to source file to make gbs build succeed 21/67321/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_3.0_mobile accepted/tizen_3.0_tv accepted/tizen_3.0_wearable accepted/tizen_4.0_unified accepted/tizen_5.0_unified accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable tizen_3.0 tizen_3.0.m2 tizen_3.0_tv tizen_4.0 tizen_4.0_tv tizen_5.0 accepted/tizen/3.0.m2/mobile/20170105.024743 accepted/tizen/3.0.m2/tv/20170105.024919 accepted/tizen/3.0.m2/wearable/20170105.025044 accepted/tizen/3.0/common/20161114.111334 accepted/tizen/3.0/ivi/20161011.055408 accepted/tizen/3.0/mobile/20161015.033958 accepted/tizen/3.0/tv/20161016.005424 accepted/tizen/3.0/wearable/20161015.083555 accepted/tizen/4.0/unified/20170816.012251 accepted/tizen/4.0/unified/20170828.222702 accepted/tizen/5.0/unified/20181102.025811 accepted/tizen/common/20160426.144005 accepted/tizen/ivi/20160426.103543 accepted/tizen/mobile/20160426.103646 accepted/tizen/tv/20160426.103457 accepted/tizen/unified/20170309.040235 accepted/tizen/wearable/20160426.103547 submit/tizen/20160426.085707 submit/tizen_3.0.m2/20170104.093753 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_ivi/20161010.000005 submit/tizen_3.0_mobile/20161015.000005 submit/tizen_3.0_tv/20161015.000004 submit/tizen_3.0_wearable/20161015.000004 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.100006 submit/tizen_5.0/20181101.000007 submit/tizen_unified/20170308.100415 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m1_release tizen_4.0.m2_release
SoonKyu Park [Tue, 26 Apr 2016 08:51:32 +0000 (17:51 +0900)]
Add nasm.changes file to source file to make gbs build succeed

Change-Id: Id07cdf0032b461bb4c4bdd8a143f583ec7ebbc01

9 years agopackaging: Bump to 2.11.05 52/30352/1 tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common tizen_3.0.2015.q2_common tizen_3.0.m1_mobile tizen_3.0.m1_tv tizen_3.0_ivi accepted/tizen/common/20141117.165123 accepted/tizen/ivi/20141124.011315 accepted/tizen/ivi/20160218.025211 submit/tizen_common/20141117.164353 submit/tizen_ivi/20141119.222222 submit/tizen_ivi/20141121.002037 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000006 submit/tizen_mobile/20141120.000000 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release tizen_3.0_ivi_release
Philippe Coval [Wed, 12 Nov 2014 17:33:36 +0000 (18:33 +0100)]
packaging: Bump to 2.11.05

Change-Id: I7c90daba4c08d44669cd4ce0e111dbf19563f1b4
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
9 years agopackaging: use tag from upstream git 51/30351/1
Philippe Coval [Wed, 12 Nov 2014 17:33:12 +0000 (18:33 +0100)]
packaging: use tag from upstream git

Change-Id: I9a4efc6da08e2dadfb0615fd4e703da04a2922a9
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
9 years agopackaging: resetting manifest requested domain to floor
Alexandru Cornea [Mon, 1 Jul 2013 18:25:03 +0000 (21:25 +0300)]
packaging: resetting manifest requested domain to floor

Change-Id: I7298c87a555157f173f56cbd044f29809bfad6e2

9 years agopackaging: Update to 2.10.07
Anas Nashif [Sun, 14 Apr 2013 08:10:29 +0000 (01:10 -0700)]
packaging: Update to 2.10.07

Change-Id: I9e8a1ba87239bca6505fe37e70ca2c3607a012a1

9 years agopackaging: add packaging
Anas Nashif [Mon, 5 Nov 2012 21:55:04 +0000 (13:55 -0800)]
packaging: add packaging

Change-Id: I0f62fb2bd3f696e6b79ea1a58117fe81ed4e84d7

9 years agopackaging: add packaging
Anas Nashif [Mon, 5 Nov 2012 20:56:52 +0000 (12:56 -0800)]
packaging: add packaging

Change-Id: Id5d0f3b9482dce77a640467ec475b5841dc23e41

9 years agoNASM 2.11.05 upstream nasm-2.11.05 upstream/2.11.05
H. Peter Anvin [Wed, 21 May 2014 15:29:41 +0000 (08:29 -0700)]
NASM 2.11.05

9 years agodoc: Document --v and duplicate REX prefix fix
H. Peter Anvin [Wed, 21 May 2014 15:28:21 +0000 (08:28 -0700)]
doc: Document --v and duplicate REX prefix fix

Document changes for 2.11.05.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
9 years agoBR 3392279: Fix duplicated REX prefixes
H. Peter Anvin [Wed, 21 May 2014 15:19:16 +0000 (08:19 -0700)]
BR 3392279: Fix duplicated REX prefixes

The fix for BR 3392278:

aa29b1d93f5a assemble.c: Don't drop rex prefix from instruction itself

... would cause multiple REX prefixes to be emitted for some
instructions.  Create a new flag to indicate that REX has already been
emitted, which can be cleared for each instance of an instruction.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
9 years agooptions: Add --v option
Cyrill Gorcunov [Fri, 9 May 2014 18:34:34 +0000 (22:34 +0400)]
options: Add --v option

It's been requested a long ago to handle '--v' option same was as
a regualar '-v'. From initial report

 | NASM and yasm are in many respects compatible but yasm uses --v
 | instead of -v for version.  As often --v is used for version I
 | end up using --v initially in NASM.  This patch allows me to compile
 | Mozilla apps which use yasm with NASM by merely renaming NASM to yasm
 | so that the build environment does not have to be updated (Mozilla
 | would not accept changes to allow use of NASM).

Reported-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
9 years agoNASM 2.11.04
H. Peter Anvin [Fri, 9 May 2014 22:04:42 +0000 (15:04 -0700)]
NASM 2.11.04

9 years agochanges: Document bug fixes
Jin Kyu Song [Wed, 7 May 2014 20:55:58 +0000 (13:55 -0700)]
changes: Document bug fixes

- Removed an error checking code for setting evex flags
- Fixed vector length matching bug

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
9 years agondisasm: Match vector length with EVEX.b set
Jin Kyu Song [Mon, 5 May 2014 20:58:51 +0000 (13:58 -0700)]
ndisasm: Match vector length with EVEX.b set

With broadcasting, EVEX.L'L should be matched even when EVEX.b is set.
Only in a case of embedded rounding, EVEX.L'L is ignored in matching
function since it becomes EVEX.RC.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
9 years agoAVX512: Remove invalid error checking
Jin Kyu Song [Mon, 5 May 2014 20:06:03 +0000 (13:06 -0700)]
AVX512: Remove invalid error checking

An offset-only memref can also have an opmask decorator.
e.g.) vmovdqu32 [0xabcd]{k1}, zmm0

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
9 years agoNASM 2.11.03
H. Peter Anvin [Mon, 5 May 2014 18:22:02 +0000 (11:22 -0700)]
NASM 2.11.03

9 years agochanges: Document TIMES bug
H. Peter Anvin [Mon, 5 May 2014 18:21:17 +0000 (11:21 -0700)]
changes: Document TIMES bug

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
9 years agoassemble.c: Don't drop rex prefix from instruction itself
Cyrill Gorcunov [Sun, 4 May 2014 20:30:58 +0000 (00:30 +0400)]
assemble.c: Don't drop rex prefix from instruction itself

emit_rex is supposed to write REX prefix into output stream
if needed, but we happen to drop it off on a first write
which breaks REX required instructions if TIMES directive
is used.

For example the code like

| times 4 movq xmm11, xmm11

compiles into

0000000000000000 <.text>:
|   0: f3 45 0f 7e db        movq   %xmm11,%xmm11
|   5: f3 0f 7e db           movq   %xmm3,%xmm3
|   9: f3 0f 7e db           movq   %xmm3,%xmm3
|   d: f3 0f 7e db           movq   %xmm3,%xmm3

instead of proper

0000000000000000 <.text>:
|   0: f3 45 0f 7e db        movq   %xmm11,%xmm11
|   5: f3 45 0f 7e db        movq   %xmm11,%xmm11
|   a: f3 45 0f 7e db        movq   %xmm11,%xmm11
|   f: f3 45 0f 7e db        movq   %xmm11,%xmm11

http://bugzilla.nasm.us/show_bug.cgi?id=3392278

Reported-by: Javier <elpochodelagente@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
10 years agoNASM 2.11.02
H. Peter Anvin [Wed, 19 Feb 2014 23:50:26 +0000 (15:50 -0800)]
NASM 2.11.02

10 years agoAdd CLFLUSHOPT instruction
H. Peter Anvin [Wed, 19 Feb 2014 23:39:57 +0000 (15:39 -0800)]
Add CLFLUSHOPT instruction

Add the CLFLUSHOPT instruction from the Intel Instruction Set
Architecture Extensions document version 319433-018 (Feb 2014).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
10 years agoinsns: add XSAVEC, XSAVES and XRSTORS instructions
H. Peter Anvin [Wed, 19 Feb 2014 22:55:54 +0000 (14:55 -0800)]
insns: add XSAVEC, XSAVES and XRSTORS instructions

Add the XSAVEC, XSAVES, and XRSTORS instructions from the Intel SDM
release 253665-050US (Feb 2014).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
10 years agoNASM 2.11.01
H. Peter Anvin [Tue, 18 Feb 2014 22:05:52 +0000 (14:05 -0800)]
NASM 2.11.01

10 years agochanges.src: changelog for 2.11.01
H. Peter Anvin [Tue, 18 Feb 2014 22:05:14 +0000 (14:05 -0800)]
changes.src: changelog for 2.11.01

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
10 years agooutelf: Error out on "section align" without value
H. Peter Anvin [Tue, 18 Feb 2014 21:23:27 +0000 (13:23 -0800)]
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>
10 years agoBR 3392275: Don't require xmm0 to be specified when implicit
H. Peter Anvin [Sun, 16 Feb 2014 18:25:25 +0000 (10:25 -0800)]
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>
10 years agoBR3392274: output: Elf -- Don't crash on erronious syntax
Cyrill Gorcunov [Sat, 15 Feb 2014 14:40:12 +0000 (18:40 +0400)]
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>
10 years agoNASM 2.11
H. Peter Anvin [Tue, 31 Dec 2013 18:40:10 +0000 (10:40 -0800)]
NASM 2.11

10 years agodoc: Document DEFAULT BND/NOBND in changes, add use case
H. Peter Anvin [Tue, 31 Dec 2013 18:38:51 +0000 (10:38 -0800)]
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>
10 years agochanges: Document change in [nosplit reg]
H. Peter Anvin [Tue, 31 Dec 2013 18:35:12 +0000 (10:35 -0800)]
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>
10 years agonosplit: Generate index-only EA only when a multiplier is used.
Jin Kyu Song [Thu, 19 Dec 2013 06:01:14 +0000 (22:01 -0800)]
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>
10 years agompx: Clean up instruction data
Jin Kyu Song [Thu, 19 Dec 2013 05:31:51 +0000 (21:31 -0800)]
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>
10 years agonosplit: Limit the effect of NOSPLIT
Jin Kyu Song [Thu, 19 Dec 2013 05:28:41 +0000 (21:28 -0800)]
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>
10 years agomib: Avoid RIP-relative addressing in mib
Jin Kyu Song [Thu, 19 Dec 2013 05:28:17 +0000 (21:28 -0800)]
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>
10 years agoinsns: Mark LOADALL, LOADALL286 with ND flag
Cyrill Gorcunov [Fri, 13 Dec 2013 06:59:39 +0000 (10:59 +0400)]
insns: Mark LOADALL, LOADALL286 with ND flag

Otherwise disassembler treat syscall, sysret incorrectly.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agomib: Handle MIB EA in a different way from regular EA's
Jin Kyu Song [Wed, 11 Dec 2013 00:24:45 +0000 (16:24 -0800)]
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>
10 years agomisc/release: Generate manpages
H. Peter Anvin [Wed, 11 Dec 2013 20:09:09 +0000 (12:09 -0800)]
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>
10 years agoiflag: Don't use c99 array initialization
Cyrill Gorcunov [Tue, 10 Dec 2013 07:09:49 +0000 (11:09 +0400)]
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>
10 years agoinsns-iflags: Drop occasionally introduced \Tab's
Cyrill Gorcunov [Sat, 7 Dec 2013 12:15:03 +0000 (16:15 +0400)]
insns-iflags: Drop occasionally introduced \Tab's

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agoiflag: \Tabs -> \Space
Cyrill Gorcunov [Sat, 7 Dec 2013 12:14:00 +0000 (16:14 +0400)]
iflag: \Tabs -> \Space

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agoiflag: Introduce IFLAG_INIT helper
Cyrill Gorcunov [Sat, 7 Dec 2013 12:12:07 +0000 (16:12 +0400)]
iflag: Introduce IFLAG_INIT helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agoNASM 2.11rc4
H. Peter Anvin [Thu, 5 Dec 2013 08:06:45 +0000 (00:06 -0800)]
NASM 2.11rc4

10 years agodoc: Update nasmdoc
Jin Kyu Song [Thu, 5 Dec 2013 04:51:13 +0000 (20:51 -0800)]
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>
10 years agobnd: Add a new nobnd prefix
Jin Kyu Song [Thu, 5 Dec 2013 04:05:55 +0000 (20:05 -0800)]
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>
10 years agobnd: Show warning when bnd prefix is dropped
Jin Kyu Song [Fri, 29 Nov 2013 08:38:29 +0000 (00:38 -0800)]
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>
10 years agopfmask: Limit the preferred mask to the vendor specific flags
Jin Kyu Song [Sun, 1 Dec 2013 00:38:42 +0000 (16:38 -0800)]
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>
10 years agodoc: Make the bit about mib operands a bit clearer
H. Peter Anvin [Fri, 29 Nov 2013 05:26:26 +0000 (21:26 -0800)]
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>
10 years agodoc: Clean up changelog for 2.11
H. Peter Anvin [Fri, 29 Nov 2013 05:24:09 +0000 (21:24 -0800)]
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>
10 years agoNASM 2.11rc3
H. Peter Anvin [Thu, 28 Nov 2013 20:22:05 +0000 (12:22 -0800)]
NASM 2.11rc3

10 years agoAdd {vex3} and {vex2} prefixes by analogy with {evex}
H. Peter Anvin [Thu, 28 Nov 2013 20:11:24 +0000 (12:11 -0800)]
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>
10 years agoNASM 2.11rc2
H. Peter Anvin [Thu, 28 Nov 2013 19:36:26 +0000 (11:36 -0800)]
NASM 2.11rc2

10 years agoRemove "high 16" register class macros for xmm/ymm/zmm
H. Peter Anvin [Thu, 28 Nov 2013 19:33:28 +0000 (11:33 -0800)]
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>
10 years agotestcase: Remove escape characters - '\'
Jin Kyu Song [Thu, 28 Nov 2013 04:52:22 +0000 (20:52 -0800)]
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>
10 years agopreproc: Handle curly braces in multi-line macro parameters
Jin Kyu Song [Thu, 28 Nov 2013 04:52:16 +0000 (20:52 -0800)]
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>
10 years agoRevert "AVX-512: Handle curly braces in multi-line macro parameters"
Jin Kyu Song [Thu, 28 Nov 2013 04:23:53 +0000 (20:23 -0800)]
Revert "AVX-512: Handle curly braces in multi-line macro parameters"

This reverts commit a800aed7b75d56114f2e1e4928cbc48ecf96a4a0.

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>
10 years agostdscan: Rework curly brace parsing routines
Jin Kyu Song [Wed, 27 Nov 2013 22:10:40 +0000 (14:10 -0800)]
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>
10 years agoiflags: Add IF_EVEX for checking {evex} availability
Jin Kyu Song [Wed, 27 Nov 2013 01:27:48 +0000 (17:27 -0800)]
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>
10 years agoopflags: Separate vector registers into low-16 and high-16
Jin Kyu Song [Wed, 27 Nov 2013 01:14:07 +0000 (17:14 -0800)]
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>
10 years agodoc: Update the change history and nasmdoc
Jin Kyu Song [Tue, 26 Nov 2013 01:59:25 +0000 (17:59 -0800)]
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>
10 years agodisasm: Don't rely on iflag_cmp() returning +/-1
H. Peter Anvin [Wed, 27 Nov 2013 21:43:45 +0000 (13:43 -0800)]
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>
10 years agoiflag: Do the equality test in iflag_cmp() first
H. Peter Anvin [Wed, 27 Nov 2013 21:41:50 +0000 (13:41 -0800)]
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>
10 years agoiflag: In iflag_cmp() scan from the most significant word down
H. Peter Anvin [Tue, 26 Nov 2013 23:21:15 +0000 (15:21 -0800)]
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>
10 years agoiflag: Drop the use of double underscores
H. Peter Anvin [Mon, 25 Nov 2013 01:14:34 +0000 (17:14 -0800)]
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>
10 years agoiflag: Make the insns_flags array const
H. Peter Anvin [Mon, 25 Nov 2013 01:13:20 +0000 (17:13 -0800)]
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>
10 years agoinsns.dat: Fix a typo in a comment
H. Peter Anvin [Mon, 25 Nov 2013 01:07:33 +0000 (17:07 -0800)]
insns.dat: Fix a typo in a comment

isnsn-iflags.pl not insns-iflag.pl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
10 years agoiflag: Move instruction flag comment
H. Peter Anvin [Sun, 24 Nov 2013 19:52:32 +0000 (11:52 -0800)]
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>
10 years agoiflag: remove C99 constructs, don't hardcode the number of words
H. Peter Anvin [Sun, 24 Nov 2013 19:49:24 +0000 (11:49 -0800)]
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>
10 years ago"make alldeps"
H. Peter Anvin [Sun, 24 Nov 2013 19:18:50 +0000 (11:18 -0800)]
"make alldeps"

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
10 years agoiflag: Fix dependencies, factor out static components of iflag.h
H. Peter Anvin [Sun, 24 Nov 2013 19:13:10 +0000 (11:13 -0800)]
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>
10 years ago"make alldeps"
H. Peter Anvin [Sun, 24 Nov 2013 18:56:49 +0000 (10:56 -0800)]
"make alldeps"

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
10 years agoinsns: Restore back MMX,FPU flags
Cyrill Gorcunov [Sun, 10 Nov 2013 07:45:24 +0000 (11:45 +0400)]
insns: Restore back MMX,FPU flags

In commit 9bb987d8e0330429afba42015b1fc7c7ca0d1b16
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>
10 years agoUpdate .gitignore
Cyrill Gorcunov [Sat, 9 Nov 2013 18:28:52 +0000 (22:28 +0400)]
Update .gitignore

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agomake: Update deps
Cyrill Gorcunov [Sat, 9 Nov 2013 18:28:05 +0000 (22:28 +0400)]
make: Update deps

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agoiflag: Start using new instruction flags engine
Cyrill Gorcunov [Sat, 9 Nov 2013 18:16:11 +0000 (22:16 +0400)]
iflag: Start using new instruction flags engine

Here we start using instruction flags generator.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agoinsns: Introduce insns-flags.pl
Cyrill Gorcunov [Sat, 26 Oct 2013 21:20:42 +0000 (01:20 +0400)]
insns: Introduce insns-flags.pl

It been found that 64 bits for instruction flags is too small,
so instead we start using indirect addressing scheme to keep
instruction flags in bitvectors instead.

Using one bitvector per instruction template entry is wastefull
(especially if vector grow in future, at moment it's 128 bit length),
so we use indirect addressing, which is generated as follow

 - read instruction flags from insns.dat
 - flag sequence sorted and joined into one key string
 - this key string become a hash index
 - all hash entries are compacted into one array
 - every instruction template uses array offset instead
   of flags bitfield

Just for info, at moment we have 195 unique flags combination,
but since instruction template will use index as unsigned
integer, we can use a way more wider combination of flags
in future.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agomake: Add 'golden' target
Cyrill Gorcunov [Sun, 24 Nov 2013 08:26:35 +0000 (12:26 +0400)]
make: Add 'golden' target

We've 'test' target in toplevel Makefile, lets be
complete and allow to generate "golden" tests from
toplevel as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
10 years agobnd: Drop bnd prefix for relaxed short jmp instructions
Jin Kyu Song [Fri, 22 Nov 2013 03:40:42 +0000 (19:40 -0800)]
bnd: Drop bnd prefix for relaxed short jmp instructions

Reverted the redundant branch instruction patterns for bnd prefix.
And when a relaxed jmp instruction becomes a short (Jb) form,
bnd prefix is not needed because it does not initialize bnd registers.
So in that case, bnd prefix is silently dropped.

BND JMP foo       -> drops bnd prefix
BND JMP short foo -> shows an explicit error

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisp8: Consolidate a logic to get compressed displacement
Jin Kyu Song [Wed, 20 Nov 2013 23:32:52 +0000 (15:32 -0800)]
disp8: Consolidate a logic to get compressed displacement

Consolidated two separate but similar functions in nasm and ndisasm
into a commonly linked source code.
To encode and decode the compressed displacement (disp8*N) for EVEX,
N value should be derived using various conditions.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisasm: Add suport for bnd registers
Jin Kyu Song [Wed, 20 Nov 2013 02:44:13 +0000 (18:44 -0800)]
disasm: Add suport for bnd registers

MPX uses a new bnd registers and a new mib syntax.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisasm: Add EVEX decorator syntax
Jin Kyu Song [Wed, 20 Nov 2013 02:43:04 +0000 (18:43 -0800)]
disasm: Add EVEX decorator syntax

Broadcasting, opmask, embedded rounding and SAE decorators
are not added at proper position.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisasm: Add ZMM vsib
Jin Kyu Song [Fri, 15 Nov 2013 21:20:55 +0000 (13:20 -0800)]
disasm: Add ZMM vsib

ZMM registers can be used for vsib index and the number of registers
has been increased to 32.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisasm: Support EVEX compressed displacement
Jin Kyu Song [Fri, 15 Nov 2013 21:18:32 +0000 (13:18 -0800)]
disasm: Support EVEX compressed displacement

When tuple type is indicated in the bytecode, disp8 is
treated as a compressed disp and gets calculated back to disp8*N.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisasm: Add basic AVX512 support
Jin Kyu Song [Mon, 11 Nov 2013 19:49:10 +0000 (11:49 -0800)]
disasm: Add basic AVX512 support

Disassembler can translate EVEX prefix, count up to 32 vector registers
and recognize new ZMM / opmask registers.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agodisasm: style cleanup
Jin Kyu Song [Sat, 9 Nov 2013 01:22:24 +0000 (17:22 -0800)]
disasm: style cleanup

Fix indentation.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agomatch: Check the number of elements in broadcasting operands
Jin Kyu Song [Wed, 30 Oct 2013 10:12:45 +0000 (03:12 -0700)]
match: Check the number of elements in broadcasting operands

The broadcasting decorator {1to##} must describe exactly how many times
the memory element is repeated in order to clearly match the correct
instruction format.

For example,
    vaddpd zmm30,zmm29,QWORD [rdx+0x3f8]{1to8}   ; good
    vaddpd zmm30,zmm29,QWORD [rdx+0x3f8]{1to16}  ; fail qword * 16 = 1024b

    vaddps zmm30,zmm29,DWORD [rcx]{1to16}  ; good
    vaddps zmm30,zmm29,DWORD [rcx]{1to8}  ; fail dword * 8 = 256b

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agomatch: Improve broadcast opsize matching
Jin Kyu Song [Wed, 30 Oct 2013 10:00:12 +0000 (03:00 -0700)]
match: Improve broadcast opsize matching

Broadcasting operand size is different from the original
operand size because 32b or 64b element is repeated to form a vector.
So when matching a broadcasting operand, opsize should be treated
differently.
The broadcasting element size is specified in the decorator information.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoBuild: Suppress warning messages
Jin Kyu Song [Tue, 29 Oct 2013 00:07:57 +0000 (17:07 -0700)]
Build: Suppress warning messages

Giving a correct printf format specifier supresses the warning message.
And a local pointer variable is initialized with NULL.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoAVX-512: Add {evex} instruction prefix
Jin Kyu Song [Sat, 26 Oct 2013 02:29:53 +0000 (19:29 -0700)]
AVX-512: Add {evex} instruction prefix

For instructions that can be encoded either in VEX or EVEX,
{evex} forces nasm to encode in EVEX.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoPREFETCHWT1: Add a new instruction flag
Jin Kyu Song [Thu, 24 Oct 2013 01:39:03 +0000 (18:39 -0700)]
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>
10 years agoAVX512: Update instruction group
Jin Kyu Song [Fri, 18 Oct 2013 03:37:26 +0000 (20:37 -0700)]
AVX512: Update instruction group

CPUID bit for vptestnm[dq] changed.
vptestnm[dq]: AVX512CD -> AVX512F

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoMPX: Move BND prefix indication from bytecode to iflags
Jin Kyu Song [Fri, 8 Nov 2013 21:31:58 +0000 (13:31 -0800)]
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>
10 years agoMPX: Adapt GAS's mib syntax with an index reg only
Jin Kyu Song [Fri, 8 Nov 2013 19:41:12 +0000 (11:41 -0800)]
MPX: Adapt GAS's mib syntax with an index reg only

GAS uses *1 multiplier for explicitly marking an index register in mib operand.
e.g.) [rdx * 1 + 3] is equivalent to [3, rdx] in NASM's split EA format
So only for mib operands, this is encoded same as gas does.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoiflags: Use UINT64_C() for 64bit values
Jin Kyu Song [Wed, 16 Oct 2013 02:59:10 +0000 (19:59 -0700)]
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>
10 years agoSHA: SHA test cases
Jin Kyu Song [Wed, 16 Oct 2013 03:49:54 +0000 (20:49 -0700)]
SHA: SHA test cases

32bit and 64bit test asm files.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoSHA: Add SHA instructions
Jin Kyu Song [Wed, 16 Oct 2013 02:44:03 +0000 (19:44 -0700)]
SHA: Add SHA instructions

New instruction extensions of SHA family are added.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoMPX: Add test cases for MPX
Jin Kyu Song [Wed, 16 Oct 2013 02:42:41 +0000 (19:42 -0700)]
MPX: Add test cases for MPX

MPX test asm files are added. These include all three different styles of
mib syntax (NASM, ICC and gas).

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoMPX: Add BND prefix for branch instructions
Jin Kyu Song [Wed, 16 Oct 2013 02:38:51 +0000 (19:38 -0700)]
MPX: Add BND prefix for branch instructions

BND prefix is used for adding bounds checking protection
across flow control changes such as call, ret, jmp and jcc calls.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
10 years agoMPX: Add MPX instructions
Jin Kyu Song [Wed, 16 Oct 2013 02:10:13 +0000 (19:10 -0700)]
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>
10 years agodisasm: add support for emitting split EA format
H. Peter Anvin [Fri, 27 Sep 2013 23:53:51 +0000 (16:53 -0700)]
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>