Document CPU LATEVEX and the associated prefixes; add CPU EVEX and CPU
VEX flags to further control encodings.
Fix the error message for invalid encodings due to flags.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The masmdisp travis test incorrectly contained an expectation of
error, from the bug fixed in checkin
e0959432fe.
Fix the test to contain the actually expected output.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
For VEX instructions created *after* the corresponding EVEX
instructions, we need the user to either explicitly declare them {vex}
or specifying "cpu latevex".
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Bring doc/changes.src up to date with the current status of tree in
preparation for the 2.16 release.
Note that no 2.15.06 release ever was produced.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
"Why dup_tlist() here? We should own it."
Yes, we own it, but we still need to advance the tail pointer. Create
steal_tlist() for this purpose.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392774
Reported-and-Debugged-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Broken %if, %rep and %macro nesting can result in the %exitmacro
unwind overrunning the condition stack. Fix.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392796
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The argument to nasm_new() is the pointer, not the indirection from
the pointer. This code is only relevant when compiled without token
recycling (TOKEN_BLOCKSIZE not set), but it is still wrong...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Fix the expansion of the %00 mmacro parameter; broken due to a missing
change of the token type.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392803
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add the option of having strings only conditionally quoted (&&) -- do
not quote an already quoted string again -- as opposed to always
quoting a string.
This makes a lot of the string functions way simpler to implement, and
removes the need to share ad hoc parsing code with directives.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add the %abs() function, to produce the absolute value as an
always-positive decimal constant.
Change the order of the arguments for %num().
Refactor the handling of optional arguments, to reduce the amount of
redundant code. This is currently only used for builtin functions, but
might be extended in the future.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Include the version number in the output (misc/nasmtok.el) and add a
rule for generating it to the Makefiles.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add a simple script to auto-generate token lists for an emacs major
mode, e.g. https://github.com/skeeto/nasm-mode
It is recommended to use "require" this file separately from the main
code, so it can be automatically kept up to date.
If this ends up being used, I will include the generated result in the
NASM release distribution.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add the %num() preprocessor function, which returns a quoted string
with a number formatted in any base between 2 and 64 (using bash
encoding with '@' for 62 and '_' for 63.)
It can specify a fixed number of digits with or without truncation.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add vector instructions from the Intel Instruction Set Extensions
document, version 046, September 2022.
Still need to check for missing instructions that have already passed
through the ISE into the SDM.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Classify all remaining WARN_OTHER warnings in the preprocessor. Move
all preprocessor warnings except "user" under a common pp-* prefix.
Warn for an out-of-range argument to the %sel() function.
Finally, use "dname" in additional places for consistency and future
ease of use.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Implement the %cond() and %sel() functions that expand to a specific
one of the arguments. %cond(x,y,z) is basically a shorthand for
%sel(2-!(x),y,z) used when x is a boolean condition.
Fix a memory leak in %strcat and %strlen.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
In some of the preprocessor function examples, actually enforce
equivalence by using %xdefine in the function examples so the
expansion is at definition time.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Allow preprocessor function expansion to recurse. Nearly all the
machinery for recursive smacros was already in place; this merely
activates it for the specific case of preprocessor functions. Making
it a general facility should be deferred to a later relese, though.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Additional nonvector instructions from the Intel Instruction Set
Extensions document 319433-046 September 2022.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Instead of handling conditional instructions ad hoc, generate
individual instruction patterns as normal. This simplifies the code
and makes CMPccXADD support simpler (otherwise it would be necessary
to hack in the handling of a condition code in the middle of an
instruction.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Some preprocessor functions have the same name as directives. In those
cases, they should be expanded as functions if and only if they are
followed by a left parenthesis. Although it is not inherently true that
either preprocessor functions require a paren nor that directives
cannot start with one, but it is true and will remain true for all
cases where there is a namespace collision.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
%substr contained a token skip to "skip expanded ID", which is
incorrect, as that has already been skipped at that point. It worked
anyway, accidentally, as this token would always be a whitespace token
-- but we then do skip_white() immediately thereafter.
Delete this to allow this code to be factored.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The use of statements like "chapter", "section" and so on makes the
HTML index insanely verbose. Remove them; they don't add any
information.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Allow a single index entry key to be defined with \IR more than once,
generating multiple entries in the index; this is really useful for
example to always generate "macros, single-line" and "single-line
macros" entries sorted at different places.
Be smarter about sorting the index: sort (nearly) all special
characters before alphanumerics, and (attempt to) sort numbers in
numerical order rather than alphabetical (so BITS8 sorts before
BITS16).
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The web site currently assumes that the release history is always in
appendix C. Humor it for now, besides, it doesn't really make sense
for the huge machine-generated instruction list to be anywhere but the
end.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>