Commit graph

4932 commits

Author SHA1 Message Date
Tomasz Kantecki
5f684412c7 x86/insns.dat: SHA512-NI VEX support
Add support for VEX-encoded SHA512-NI instructions.

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:21:21 -08:00
H. Peter Anvin
24275695ff x86/insns.dat: PTWRITE requires the F3 prefix
PTWRITE takes an f3 prefix, not np.

Reported-by: Markus T. Metzger <markus.t.metzger@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:15:56 -08:00
H. Peter Anvin
0ba4500534 NASM 2.16.02rc7 2024-01-04 23:25:15 -08:00
H. Peter Anvin
a315659957 autoconf: more aggressively avoid cross-compilation problems
We could end up invoking WINE even when we didn't want to.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-04 23:21:44 -08:00
H. Peter Anvin
b4300ac280 x86: SMAP instructions are NP
The SMAP instructions are np; notably the prefixed versions of CLAC
are ERETU/ERETS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-12-14 17:57:27 -08:00
H. Peter Anvin
2fae1899ac NASM 2.16.02rc6 2023-12-14 17:06:51 -08:00
H. Peter Anvin
dd52f386b9 x86: implement FRED: ERETS, ERETU, LKGS
Kind of embarrassing... I had not implemented the FRED instruction,
despite personally being one of the architects of FRED ;)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-12-14 17:04:49 -08:00
H. Peter Anvin
84191667f9 NASM 2.16.02rc5 2023-10-16 17:25:27 -07:00
H. Peter Anvin
21c977e717 output/legacy: when converting OUT_SEGMENT, clear the offset
Legacy backends like obj/omf may depend on the offset being zero if
not in use.

Reported-by: Bernd Boeckmann <bernd-freedos@boeckmann.io>
Reported-by: Vladimir Chebotarev <vladimir.chebotarev@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 17:19:45 -07:00
H. Peter Anvin
7d5e549d63 asm/rdstrnum: always handle 64 bits
We should always support up to 8 characters, i.e. 64 bits, in a
string-to-numeric conversion.

Reported-by: Aleksandras Krupica <vaikutisasa@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 16:54:11 -07:00
H. Peter Anvin
a7b1f26057 misc/omfdump: #include <string.h>
Add missing <string.h> include.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 16:53:35 -07:00
H. Peter Anvin
3c8a2913bc NASM 2.16.02rc4 2023-10-16 14:17:45 -07:00
H. Peter Anvin
9f83c383e4 preproc, %map(): require second colon, update documentation
Require the second colon before the grouped parameter count; otherwise
the syntax is ambiguous since an expression can start with (.

Update/complete the documentation and the examples.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 13:42:16 -07:00
H. Peter Anvin
cb96db9b70 preproc: add the ability for %map() to have fixed arguments
Add the ability to have fixed arguments in %map. This is extremely
useful for parameterizing the invoked macro using arguments to a
surrounding macro.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 02:56:13 -07:00
H. Peter Anvin
78bde7562d preproc: factor expand_one_smacro() even more
Separate out counting and parsing smacro parameters into separate
functions. This not only makes the code *way* easier to read, but
these can be re-used e.g. for %map().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 02:03:56 -07:00
H. Peter Anvin
8584bce804 preproc: handle empty expansion in %map
%map(foo) should expand to the empty string, but instead crashed NASM.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 01:24:20 -07:00
H. Peter Anvin
e10b7f902b NASM 2.16.02rc3 2023-10-16 00:27:43 -07:00
H. Peter Anvin
34eefd3803 preproc: add %map() function and radix specifiers
Add the %map() function which can apply arguments to a macro from a
list.

Allow the user to specify the desired radix for an evaluated
parameter. It doesn't make any direct difference, but can be nice for
debugging or turning into strings.

As part of this, split expand_one_smacro() into two parts: parameter
parsing and macro expansion. This is a very straightforward splitting
of two mostly unrelated pieces of functionality.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-15 22:43:28 -07:00
H. Peter Anvin
bab37b3501 doc: %hex() is not a chapter!
%hex() is a subsection, not a chapter. Oops!

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 21:33:25 -07:00
H. Peter Anvin
94b053a59c doc: one instance of a __foo__ macro didn't get updated to __?foo?__
__USE_package__ should be __?USE_package?__.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 21:28:36 -07:00
H. Peter Anvin
432ea5b2b0 doc: editorial changes
Fix a few typos and poor grammar.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 21:25:48 -07:00
H. Peter Anvin
2a5c87362b doc: one more correction to the Dx syntax grammar
The commas in the lists are literal commas.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 21:15:25 -07:00
H. Peter Anvin
d7d51e39ce doc: correct a minor problem in the grammar for Dx statements
The production "value := type value" was not correct; should have been
"type atom", which can be merged with the "atom" production to "[type]
atom".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 21:10:59 -07:00
H. Peter Anvin
07cef15235 travis: update the warning message in hle.stderr
Nothing wrong, but the text of the warning message has changed after
subordinating it to another warning.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 20:54:56 -07:00
H. Peter Anvin
2e9120e56f BR 3392893: preproc: correctly handle empty %rep blocks
When expanding %rep blocks, if any of the %rep blocks are empty, there
may be need to unwind the %rep stack multiple times. The code would
not do so -- there was a break; in the loop, which incidentally turned
it into something that wasn't a loop at all.

Reported-by: E. C. Maslock <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 20:51:52 -07:00
H. Peter Anvin
dcac46d973 preproc: add options for a base prefix to %num(), add %hex()
Make it possible to add a base prefix to %num().

Add the %hex() function, producing hexadecimal values that are
nevertheless valid NASM numeric constants.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 17:50:55 -07:00
H. Peter Anvin
e2dc551796 preproc: fix the parameter number in error messages
The user would generally expect the parameter number to be counted
from 1 for human purposes, and that is also consistent with %1, %2,
... for multi-line macros.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 17:21:12 -07:00
H. Peter Anvin
156b61b614 doc: correct %expr -> %eval
%expr() was a pre-release development name for this function, however,
the released name is %eval().

See BR 3392837.

Reported-by: Michael <mikar_gibbros@yahoo.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 17:14:11 -07:00
H. Peter Anvin
6198a2396c doc: slightly more wordsmithing
Tidy up the new text for the bin format a little more.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 17:09:25 -07:00
H. Peter Anvin
d31dca5860 doc: be more clear than .bin is simply a linker built into NASM
.bin really is nothing other than a linker built into NASM. Make that
very very clear to users.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-13 17:05:53 -07:00
H. Peter Anvin
e993b75aa6 XCHG: adjust lock prefix warning, add specific warning for LOCK XCHG
"LOCK XCHG reg,mem" would issue a warning for being unlockable, which
is incorrect. In this case the RM encoding is simply an alias for the
MR encoding. Add a "LOCK1" bit to deal with that.

However, XCHG is *always* locked, so create a new warning to
explicitly flag a user-specified LOCK XCHG; default off.

Consider optimizing that prefix away in the future, but for now, let's
stick to the user-requested code sequence.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-12 14:53:40 -07:00
H. Peter Anvin
4d9c102e44 Nindent: modernize (greatly simplify) and move to tools/ 2023-10-12 14:28:58 -07:00
H. Peter Anvin
03490692b0 BR 3392832: fix dependency list generation
The dependency list needs to be updated for all passes, not just the
last one. The dependency list is already uniquized, so it doesn't
cause problems with multiple entires.

The reasons it needs to be done for all passes is first of all that an
%include could be pass-dependent, and secondly that we only record a
dependency for an %include or %require for the first occurrence of
that file, when pathnames are resolved.

Reported-by <michael@mehlich@com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 14:35:49 -07:00
H. Peter Anvin
cba25274a3 NASM 2.16.02rc2 2023-10-11 14:17:03 -07:00
C. Masloch
d48839780d BR 3392892: fix memory leak related to BR 3392414
The fix for BR 3392414 introduced a fairly serious memory
leak. C. Masloch was kind enough to track down the proper root cause
and fix it correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:58:48 -07:00
H. Peter Anvin
8fc4af0cf9 assemble.c: fix a typo in warning texts
Fix a typo in the help text for the -w+reloc options.

Reported-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:42:31 -07:00
H. Peter Anvin
2daa5989ab error: macro to bypass disabled warning generation
At least attempt to not spend time generating a warning message that
is just going to be suppressed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:35:58 -07:00
H. Peter Anvin
0e7eae99e8 autoconf: add detection of variadic macros support
Variadic macros are really useful, even if we can only use them
conditionally.

Unfortunately this means removing -Wc90-c99-compat, because apparently
-Wno-variadic-macros is broken in gcc 13.2. Fortunately it is 2023...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:32:52 -07:00
H. Peter Anvin
e64ae0a0c6 BR 3392571: allow the user to request warnings for relocations
Some target environments may have specific restrictions on what kinds
of relocations are possible or allowed. Allow users to opt-in to
specific warnings as to the relocations they cannot support.

Requested-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 12:34:52 -07:00
H. Peter Anvin
73676357de BR 3392906: error out on bad syntax "db 1 2"
NASM would try to "eat the comma token" in db expressions, even for
cases where the token was not a comma. Fix that and error out
properly.

To give better error messages, track where in the input string a token
starts or ends. This information is only valid as long as the input
string is kept, but that is just fine for error messages during
parsing.

Reported-by: Peter Cordes <pcordes@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 12:06:58 -07:00
H. Peter Anvin
816f50e5f5 compiler.h: add missing new #include "autoconf/attributes.h"
The attributes macro is contained in a header file; this header file
needs to be included.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 12:06:18 -07:00
H. Peter Anvin
0e96487608 autoconf: modernize autoconf and update a lot of m4 macros 2023-10-11 10:47:09 -07:00
H. Peter Anvin
b9528913aa NASM 2.16.02rc1 2023-02-19 21:39:16 -08:00
H. Peter Anvin
ea49bac9b9 autogen: add --cleanenv option and use it in the release script
Make sure we don't pick up any local things from the environment.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-02-19 21:37:37 -08:00
H. Peter Anvin
8ce37daeea doc/changes.src: update to reflect current state
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-02-19 21:28:49 -08:00
H. Peter Anvin
5a2d629501 autoconf: a much of macro fixes... not sure how this ever worked?
Exposed a bunch of problems with the autoconf m4 macro
library. Hopefulyy fix it, and tidy it up in the process.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-02-19 21:26:15 -08:00
H. Peter Anvin
7e80d6b834 Make: handle warning files while building in a directory
The dependency on the warning files breaks when we are building in a
directory *and* the files already exist from being shipped with the
distribution tarballs. The make VPATH simply isn't sophisticated
enough to deal with it, so let the C compiler handle it by #including
the generated file from a dummy C file.

Reported-by: Rudi Heitbaum <rudi@heitbaum.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-01-17 13:05:55 -08:00
H. Peter Anvin
66a91c3796 Makefile: unbreak "make dist"
Things used by "make dist" haven't been updated for a while, it seems;
in particular have not kept up with the existence of autogen.sh.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-01-17 12:27:10 -08:00
H. Peter Anvin
80eebbcb5c .gitignore: add misc/nasmtok.el, make whole rdoff directory ignored
misc/nasmtok.el is a generated file.
The whole rdoff directory is obsolete; if someone still has it it can
be ignored.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-21 18:37:26 -08:00
H. Peter Anvin
d41598b335 NASM 2.16.01 2022-12-21 18:36:24 -08:00