Commit Graph

5003 Commits

Author SHA1 Message Date
H. Peter Anvin
1618fa745b apx: support parsing special constants like {dfv=}
{dfv=} is basically a constant (immediate). Treat it as such during
parsing, except that if "naked" (not in an expression), it has special
matching properties and does not need a terminal comma.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-28 16:57:24 -07:00
H. Peter Anvin
bdfa9f952d eval: recognize TOKEN_BRCCONST as integers
If TOKEN_BRCCONST are used in an expression (including simply wrapping
them in parentheses), then just treat them as integers.  This makes
things like ({dfv=cf}|{dfv=of}) work.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-27 18:19:35 -07:00
H. Peter Anvin
6389ac8e47 scanner: generalize the handling of {dfv=}
Change the handling of {dfv=} to a more general "braced constant"
expression, to be tagged with an instruction flag to make sure they
match the instruction in question.

This really ought to be an operand flag, but the opflags are precious;
as the CCMP/CTEST instructions can also take an immediate it probably
is necessary to invent a "special immediate" operand type that can
fold these together.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-27 18:06:51 -07:00
H. Peter Anvin
4f0d89dbe6 apx: modify the tokenizer to be able to handle {dfv=...}
The {dfv=} prefix sequences for the CCMP and CTEST instructions need
special handling in the parser. This means a fair bit of new magic in
the handler of the parser, but it just adds to the fun.

Try to make this as general as possible, so we can use it for other
things.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-27 17:57:08 -07:00
H. Peter Anvin
caff3203bc Merge remote-tracking branch 'origin/nasm-2.16.xx' into apx 2024-07-27 17:46:55 -07:00
H. Peter Anvin
8ef2fa22a2 mkdep: handle breakage from srcdir changes
The handling of "path" and "fullpath" was inconsistent, resulting in a
lot of missing dependencies regardless if a separate build directory
was in use.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-27 17:43:34 -07:00
H. Peter Anvin
7cc9fc4773 stdscan: abstract out the saving/restoring of parser state
The parser state does not just necessarily include the position of the
buffer, but make it possible to maintain additional state.

Furthermore, add an explicit ability to push back a token.

All of this might make it easier at some point in the future to keep
track of horizontal position, although that will require lots of
changes to the preprocessor.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-24 14:15:35 -07:00
H. Peter Anvin
e03b9325e2 parser: tidy up handling of prefixes; allow braced prefix after insn
Clean up the handling of prefixes in general. Allow a set of braced
prefixes to follow the instruction; this is required for things like
{dfv=} but might also be a nicer syntax for things like {rex}.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-24 13:09:36 -07:00
H. Peter Anvin
a556ea3edf regs: clean up and somewhat automate register range flags
Doing the register range flags by hand is a bit more work than
necessary when dealing with APX, so auto-generate the flags for ranges
{0, 1-15, 16+} using 3 bits.

In theory we could handle even more automagically by splitting ranges
up further: the existing ranges are sets of {0, 1, 2, 3, 4-5, 6-7,
8-15, 16-31} which would require 7 bits, although it would remove most
of the subclass bits for registers; it would require separating the
subclass bits for EAs from the ones for registers (which might be a
good idea anyway...)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-23 16:04:47 -07:00
H. Peter Anvin
49640ed315 x86: move the bytecode defintion into a separate file in x86/
At least three files (asm/assemble.c, disasm/disasm.c, and
x86/insns.pl) depend on the bytecode defintions. It makes a lot more
sense for them to live in an explicit documentation file in the x86/
directory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-23 12:47:25 -07:00
H. Peter Anvin
77df155c70 .editorconfig: hard tabs are still 8 spaces
The hard tab character is 8 spaces, that's just how it is.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-06-10 21:12:52 -07:00
H. Peter Anvin
a1e3140808 doc: fix the equivalent description for %cond()
%cond(x,y,z) == %sel(1+!(x),y,z), not %sel(2-!(x),y,z).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-06-01 17:30:27 -07:00
Yegor Yefremov
9d38bed4d2 Add EditorConfig support
Provide common indentation configuration for the source files.

For more information, visit https://editorconfig.org/.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2024-05-31 11:11:41 -07:00
H. Peter Anvin
aa03a95edd doc: improve the build from source documentation
Update and improve the build from source documentation, including add
an auto-generated list of Perl build dependencies.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2024-05-20 10:54:26 -07:00
H. Peter Anvin
2e0212bcd3 doc/rdsrc.pl: add \w{...} to reduce the verbosity of web links
Create a shorthand for a web link where the URL itself is also the text.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2024-05-20 10:31:57 -07:00
Cyrill Gorcunov
0421148e33 doc/nasmdoc.src: fix typo in web link
Reported-by: Danny Cohen <dannycoh@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2024-05-01 21:54:17 +03:00
H. Peter Anvin
68999937f3 doc/nasmdoc.css: @media only print -> @media print
There is no point in using "only" unless there is another
qualifier. The "only" is specifically to prevent older parsers from
unconditionally applying a section with qualifiers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-25 15:42:25 -07:00
H. Peter Anvin
6165d6c014 Merge remote-tracking branch 'github/nasm-2.16.xx'
Resolved Conflicts:
	doc/changes.src
2024-04-25 15:37:36 -07:00
H. Peter Anvin
68d59933f7 doc/changes.src: begin release notes for 2.16.04.
Better to keep up with it now...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-25 15:36:25 -07:00
H. Peter Anvin
cd1fd8ac8e nasm.c: tidy up the help text and break it into topics
The help output has gotten way too long to be shown on a single
command line. It can of course be piped to a pager, but to be a little
nicer to the user, break it up into subtopics that can be individually
displayed. --help all (-h all) can still show all the help information
as a single data dump.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-25 15:14:20 -07:00
H. Peter Anvin
3334c3c2dc Merge remote-tracking branch 'github/nasm-2.16.xx' 2024-04-18 15:32:59 -07:00
H. Peter Anvin
2553833cc1 nasm.spec.in: fix mistakes in previous checkin
Fix small mistakes in previous nasm.spec.in patch.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-18 15:31:51 -07:00
H. Peter Anvin
0537b16fdc doc: fix tag label for cl-2.16.03
cl-2.16.03 was incorrectly marked as a dup of cl-2.16.02.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-18 15:30:31 -07:00
H. Peter Anvin
843976d343 Merge remote-tracking branch 'github/nasm-2.16.xx'
Resolved Conflicts:
	autoconf/m4/pa_add_langflags.m4
	autoconf/m4/pa_option_lto.m4
	autogen.sh
	configure.ac
	doc/changes.src
2024-04-18 15:25:48 -07:00
H. Peter Anvin
0346e58b6e nasm.spec.in: add Obsoletes tags where applicable; fix License tag
Add Obsoletes tags: nasm-rdoff; old nasm-doc.

Add a few BuildRequires: tags.

Update License: tag to match SPDX.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2024-04-18 14:01:40 -07:00
H. Peter Anvin
cd37b81b32 NASM 2.16.03 2024-04-17 09:48:27 -07:00
H. Peter Anvin
e699956758 Mkfiles/README: recommend MSYS2 on Windows
Even Microsoft seems to recommend MSYS2 for autoconf compatibility
now.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-17 09:41:47 -07:00
H. Peter Anvin
c56472f6ad autoconf: updated pa_cross_compile
Probably unnecessary, but be more aggressive in defanging WINE.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-16 17:18:07 -07:00
H. Peter Anvin
2d710ad334 NASM 2.16.03rc3 2024-04-16 16:43:16 -07:00
H. Peter Anvin
c4b954931e doc/changes.src: update release notes
Update release notes to match the current status.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-16 16:35:34 -07:00
H. Peter Anvin
f932b338e3 spec: update embedded RPM spec file
The embedded RPM spec file seems to be a bit out of date. Update to
match the current RPM conventions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-16 16:35:22 -07:00
H. Peter Anvin
2d2ae91d7a autoconf: unbreak --enable-lto, fix some language macros
PA_ADD_LANGFLAGS() was broken, resulting in among other things
--enable-lto not working.

Make autogen.sh fail if aclocal return error.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-16 16:31:28 -07:00
H. Peter Anvin
b11802c425 NASM 2.16.03rc2 2024-04-15 05:46:27 -07:00
H. Peter Anvin
3db22ed63e tools/release: use "make dist"
This target exists; use it, instead of effectively open-coding it into
the release script, causing bit rot and testing problems.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-15 05:18:53 -07:00
H. Peter Anvin
e72d4bf519 mkdep.pl: do not generate a selfrule for embedded dependencies
If we are using embedded dependencies, do not generate a selfrule. It
is meaningless.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:47:54 -07:00
H. Peter Anvin
99fec7e7d0 Makefile: more cleanup/dist fixes
Even more fixes to the various clean and dist targets, sigh.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:35:56 -07:00
H. Peter Anvin
0553c6f306 Makefile: fix "make dist" and "make tar"
These aren't used to actually make a distribution, but they are useful
for testing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:21:51 -07:00
H. Peter Anvin
ff78ddc6af autogen.sh: remove configure~
Remove configure~ backup file; we have no use for it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:20:59 -07:00
H. Peter Anvin
25f701e689 spec generation: try to distinguish use pragmas from modules
Assume module names (for "use") always start with a capital letter,
and that anything that doesn't is a pragma.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:05:32 -07:00
H. Peter Anvin
03469f5bd0 NASM 2.16.03rc1 2024-04-12 13:24:41 -07:00
H. Peter Anvin
a518f3bc72 changes.src: begin release notes for 2.16.03
Probably will have to release a 2.16.03 soon. Start the release notes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 13:24:04 -07:00
H. Peter Anvin
caaf81c22e deps: don't break if run in a build directory; don't delete unconfig.h
Don't break Makefile.dep generation if run from a separate build
directory.

config/unconfig.h is a bit special; it is kept in the repository for
the benefit of non-configure users. Therefore, don't have "make
spotless" delete it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 13:17:40 -07:00
H. Peter Anvin
392f47d06e Makefile: fix "make spotless"
Fix "make spotless" and some of the related targets so they actually
behave sensibly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 12:05:52 -07:00
H. Peter Anvin
99d3342033 doc: make it clearer than -O0 and -O1 are almost never useful
-Ox is the default, and the preferred mode for almost all users.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 11:08:37 -07:00
H. Peter Anvin
6f44296adc doc: get rid of some unnecessarily wordy option descriptions
Some options had unnecessarily wordy titles. Also change Make ->
\c{make}.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 11:06:03 -07:00
H. Peter Anvin
1ad669bf06 nasmdoc.css: simplify some media queries
Some media queries were needlessly complicated and misinterpreted by
some browsers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 15:15:05 -07:00
H. Peter Anvin
b11cd3a426 warnings: more improvements to warnings generation
Try to better sort out the necessary dependencies for warning
generation.

Fix regex for cleaning up nasmdoc markup: nasmdoc markup does not
nest, although it may include \} sequences.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 14:18:34 -07:00
H. Peter Anvin
5a03edfdd9 tools/release: run autoconf/clean.sh if it exists
If autoconf/clean.sh exists, run it after "make distclean" as a
redundancy measure.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 13:50:50 -07:00
H. Peter Anvin
99175565d8 Makefile.in: remove configure remnants from "make distclean"
"make distclean" (which is used to generate release tarballs) should
remove configure-generated files.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 13:45:29 -07:00
H. Peter Anvin
1f055d9e8f NASM 2.16.02 2024-04-04 13:25:49 -07:00