0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-07-24 10:25:42 -04:00

4858 Commits

Author SHA1 Message Date
H. Peter Anvin
2d5cf17130 misc/emacstbl.pl: add NASM version to output, add to Makefile
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>
2022-11-17 12:52:52 -08:00
H. Peter Anvin
b58771d827 misc/emacstbl.el: script to produce token lists for an emacs mode
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>
2022-11-17 11:50:03 -08:00
H. Peter Anvin
e7dd0e8e3f doc: document the %num() function
Add documentation for the %num() preprocessor function.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-15 17:13:22 -08:00
H. Peter Anvin
1d1ba9c7d7 preproc: add %num() to format a number in an arbitrary base
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>
2022-11-15 16:58:20 -08:00
H. Peter Anvin
5a25ad12b2 insns: fix instruction flags for the ENQCMD instructions
Set a more complete set of flags for the ENQCMD family instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-14 17:53:06 -08:00
H. Peter Anvin
7c784b0ddb insns: add HRESET instruction
Add the HRESET instruction

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-14 17:45:29 -08:00
H. Peter Anvin
3630bf2f3e NASM 2.16rc8 nasm-2.16rc8 2022-11-14 17:31:47 -08:00
H. Peter Anvin
4369faf827 insns: add vector instructions from ISE 046, Sept 2022
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>
2022-11-14 17:28:52 -08:00
H. Peter Anvin
91b273cb98 NASM 2.16rc7 nasm-2.16rc7 2022-11-14 13:35:49 -08:00
H. Peter Anvin
db6549c5aa preproc: classify warnings, move into common pp-* namespace
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>
2022-11-14 13:12:01 -08:00
H. Peter Anvin
664a79473d preproc: add %count() function
Add %count(), giving a count of the number of arguments.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-14 01:48:38 -08:00
H. Peter Anvin
16b49d4229 NASM 2.16rc6 nasm-2.16rc6 2022-11-13 23:02:55 -08:00
H. Peter Anvin
02384ec6ac doc: add clarification to %sel()
Add clarification that %sel(), like %cond(), never expands
non-selected arguments.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-13 23:02:05 -08:00
H. Peter Anvin
d9b36e3c9c preproc: implement the %cond() and %sel() functions; fix memory leak
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>
2022-11-13 22:59:16 -08:00
H. Peter Anvin
8de66e9a50 doc: replace %define with %xdefine in some preproc function examples
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>
2022-11-13 21:11:11 -08:00
H. Peter Anvin
51ad8e1486 preproc: allow preprocessor function expansion to recurse
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>
2022-11-13 20:34:04 -08:00
H. Peter Anvin
2b01ddf2ec x86/insns.dat: non-vector instructions from ISE 319433-046 2022-09
Additional nonvector instructions from the Intel Instruction Set
Extensions document 319433-046 September 2022.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-12 13:15:03 -08:00
H. Peter Anvin
a3fd34ab80 x86/insns.pl: sort conditional instructions alphabetically
Makes the build a bit more predictable and debuggable.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-12 12:59:23 -08:00
H. Peter Anvin
a2eabbe1d7 insns: drop special handling of conditional instructions
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>
2022-11-12 12:37:37 -08:00
H. Peter Anvin
5fd5426832 NASM 2.16rc5 nasm-2.16rc5 2022-11-11 20:26:48 -08:00
H. Peter Anvin
392b2b18a0 doc: document preprocessor functions
Add documentation for preprocessor functions, as well as the flow of
preprocessor expansion.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-11 20:25:49 -08:00
H. Peter Anvin
3fe5b3f5a1 preproc: distinguish between directives and functions
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>
2022-11-11 19:51:22 -08:00
H. Peter Anvin
359e21e773 preproc: implement %strlen as a preprocessor function
Implement a %strlen() preprocessor function, equivalent to the %strlen
directive.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-11 19:15:35 -08:00
H. Peter Anvin
4150848a7d preproc: implement %substr() and %tok() preprocessor functions
Implement preprocessor functions equivalent to the %substr and %deftok
directive.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-11 19:02:41 -08:00
H. Peter Anvin
913901e529 preproc: skip invalid advance in %substr
%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>
2022-11-11 18:28:11 -08:00
H. Peter Anvin
57fbd34d9f preproc: implement %str() and %strcat() functions
Add function equivalents of the %defstr and %strcat directives.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-11 18:18:04 -08:00
H. Peter Anvin
a5d0284634 doc: improve the HTML index readability
Make the HTML index more like what you would expect an index to look
like.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-09 21:37:16 -08:00
H. Peter Anvin
df243389e0 doc/changes.src: begin changes.src for 2.16
Once again, need to write these damned release notes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-09 19:04:01 -08:00
H. Peter Anvin
5219d14e6f doc: don't include "chapter", "section" etc in the HTML index
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>
2022-11-09 19:02:56 -08:00
H. Peter Anvin
beabb3ccb7 warnings.pl: add back formatting for group alias lists
Add back proper formatting for the list of warnings represented by a
group alias.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-09 19:01:54 -08:00
H. Peter Anvin
f7163e343c doc: allow replicated index entries (\IR), make index sorting smarter
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>
2022-11-09 18:38:45 -08:00
H. Peter Anvin
7727fbb59a doc: move instruction list to the end
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>
2022-11-08 18:40:11 -08:00
H. Peter Anvin
ebbe01b573 NASM 2.16rc4 nasm-2.16rc4 2022-11-08 18:30:21 -08:00
H. Peter Anvin
d794e0e593 nsis: remove references to RDOFF tools
The rdoff tools are gone; obviously we can't expect to install them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-08 18:22:25 -08:00
H. Peter Anvin
15a02b5474 NASM 2.16rc3 nasm-2.16rc3 2022-11-08 18:12:11 -08:00
H. Peter Anvin
caffd140c0 asm: factor out more warnings into warning classes
Hopefully we'll eventually get rid of WARN_OTHER completely...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-08 17:50:45 -08:00
H. Peter Anvin
63049146f6 warnings.pl: format the warning class list better
Better formatting for the warning class list (a little bit less like
trying to be prose.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-08 15:26:03 -08:00
H. Peter Anvin
a5fc643cb9 doc/genps.pl: handle large lists of index entries
If a list of index entries is so long that the whole list can't fit
onto a single page, we *have* to break it. Treat the hanging-comma
line as a potential widow, but allow column breaks elsewhere in the
list.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-08 15:24:24 -08:00
H. Peter Anvin
d77a86b666 psfonts.ph: add more font aliases
Add a bunch more aliases for various fonts. Apparently this really can
be in flux.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-08 15:12:31 -08:00
H. Peter Anvin
61db795f3b NASM 2.16rc2 nasm-2.16rc2 2022-11-07 17:06:57 -08:00
H. Peter Anvin
b9646f9e39 nasmlib: fix stub when os_fstat() is not defined
Use the correct variable to quiet unused variable warning in
os_fstat() stub.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 16:56:56 -08:00
H. Peter Anvin
3f08242752 Merge remote-tracking branch 'chengzhycn/fix/fonts' 2022-11-07 16:52:02 -08:00
H. Peter Anvin
93548c2de2 rdoff: kill it off
RDOFF has been deprecated as it has unfixable problems, and has been
announced that it will be killed off in NASM 2.16.

This deletes it once and for all.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 16:49:13 -08:00
Marco Vanotti
6224dd0b45 preproc: don't unmacro if macro cannot be found.
This commit adds a check to see if the macro that we want to unmacro exists.
A previous commit, introduced a check to see if the unmacro was undefining a macro being expanded, but that same check included a null pointer dereference if the macro to undefine did not exist.

The following code reproduced the issue:

```asm
%macro baz 0
  %unmacro F 0
%endmacro
baz
```

Compile with:
```shell
$ nasm -f elf64 -g -FDWARF -o tmp.o -werror file.asm
```

[hpa: adjusted code to match NASM style]

Fixes bug 3392761

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 16:30:49 -08:00
H. Peter Anvin
1e50772539 Merge remote-tracking branch 'Gramner/vpexpand' 2022-11-07 16:28:12 -08:00
H. Peter Anvin
ec2074d27f fp16: fix incorred handling of broadcast flags
The FP16 patch had a case of bit overlap. Clean up the handling of
broadcast flags a little in the process.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 16:24:39 -08:00
H. Peter Anvin
8f2e3cc376 asm/assemble.c: fix bogus warnings on explicit [rel]
Warnings with explicit [rel] would pretty much *always* warn after
checkin f4e7a636a85bab02e7ac0067c5c58768779900a0. Fix this.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 16:20:04 -08:00
H. Peter Anvin
665e5e3da8 travis: update COFF tests to not expect an embedded filename
When doing a reproducible build with COFF, since checkin
e1423b057304b4fc8af7d1fc048ccaa5cc66a2bd the filename is suppressed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 16:18:50 -08:00
H. Peter Anvin
1a5fcb070a Revert "preproc: fix memory leak (and possibly CVEs?)"
This reverts commit 8fcc785f95b842694015e03d909a3131cbadbeb3.

This patch causes test a32offs.asm, and in general *any* use of the
"bits" macro, to totally fail.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 13:08:30 -08:00
H. Peter Anvin
d9593aaaca Merge remote-tracking branch 'hut8/master' 2022-11-07 12:55:20 -08:00