Age | Commit message (Collapse) | Author | Files | Lines |
|
Move backend-specific code into the output/ directory, and make the
null debugging backend a separate file (it certainly isn't needed for
ndisasm...)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
WAIT is technically an instruction, but from an assembler standpoint
it behaves as if it had been a prefix. In particular, it has to be
ordered *before* any real hardware prefixes.
|
|
None of the strings passed to nasm_strcat() are modified, to
make them const.
|
|
We have a number of all-zero buffers in the code. Put a single
all-zero buffer in nasmlib.c. Additionally, add fwritezero()
which can be used to write an arbitrary number of all-zero bytes;
this prevents the situation where the all-zero buffer is simply
too small.
|
|
Fix nasm_str[n]icmp() on platforms which don't have this function
natively.
XXX: Given the new nasm_tolower() implementation, we should consider
if this might actually be a faster function than the platform-native
one.
|
|
ctype functions take an *int*, which the user is expected to have
taken the input character from getc() and friends, or taken a
character and cast it to (unsigned char).
We don't care about EOF (-1), so use macros that cast to (unsigned
char) for us.
|
|
On some platforms, tolower() is implemented as a function call, in
order to handle locale support. We never change locales, so can the
result of tolower() into a table, so we don't have to sit through the
function call every time.
~1.3% overall performance improvement on a macro-heavy benchmark under
Linux x86-64.
|
|
fwriteint*() don't require unaligned references, so they can be
optimized for WORDS_LITTLEENDIAN rather than X86_MEMORY...
|
|
The RAA code doesn't have to be in nasmlib; it is only used by nasm
itself, and is better handled in a separate module.
|
|
Move all the SAA code out of nasmlib; it's not used by anything than
nasm itself. Cleaning out the kitchen sink known as nasmlib is a good
thing, too.
|
|
Hopefully backquoted strings should work correctly now.
|
|
First attempt at properly handle quoted strings in the preprocessor.
This also adds range support in %substr.
No support in the assembler yet.
|
|
Add a nasm_unquote() function supporting the intended `...` syntax.
|
|
Introduce new preprocessor directives %depend and %pathsearch, and
make incbin a standard macro using these filenames. This lets us
remove the code that makes incbin search the path.
|
|
First cut at AVX machinery support. The only instruction implemented
is VPERMIL2PS, and it's probably buggy. I'm checking this in with the
hope that other people can start helping out with (a) testing this,
and (b) adding instructions.
NDISASM support is not there yet.
|
|
1. Port dwarf3 support from ELF64 to ELF32
2. Move common SAA extentions to nasmlib
|
|
Make the RAA size always a power of two, so we can use shifts instead
of multiple, expensive divides.
|
|
If we're logging nasm_free(), then log it before we actually call
free(); that way we can find out what the last thing was if free()
crashes.
|
|
In particular, we'd miss issuing warnings for out-of-range dword
values, and the message for constants too large (we can't deal with >
64 bits) said 32 bits, not 64.
|
|
|
|
raa_free() didn't actually do the proper job; it would only free leaf
nodes, not internal nodes.
|
|
1. Don't warn on 32-bit overflow
2. Change EM64T to Intel 64 in Defining CPU Dependencies
section of documentation.
|
|
Slight cleanup of the fwrite*() functions. This actually helps gcc
generate better code on i386, for no apparent reason.
|
|
If we're on an x86 host, we can do unaligned littleendian memory
references directly. Just do'em.
|
|
Address data is always int64_t even if the size itself is smaller;
this was broken on bigendian hosts (still need testing!)
Create simple "write sized object" macros.
|
|
Use the elements() macro to count the elements in a static array.
|
|
The string argument to bsi() and bsii() should be const.
|
|
|
|
|
|
Suffixed versions of zero will look like both a prefix and a suffix.
Reject the prefixed version as being too short to decode.
|
|
(pradix && pradix > sradix) etc. is unnecessary since pradix and
sradix cannot be negative, so zero is always the smallest value.
Put in a comment explaining why making the default radix == 10 doesn't
need any additional error checking.
|
|
Unbreak hex constants which contain 'b' or 'd' in potentially tricky
places.
|
|
Allow any radix letter from the set [bydtoqhx] to be used either
"Intel-style" (0...x) or "C-style" (0x...). In Intel style, the
leading 0 remains optional as long as the first digit is in the range
0-9.
As a consequence, allow the prefix "0h" for hexadecimal floating
point.
|
|
"Stealth whitespace" makes it harder to read diffs, and just generally
cause unwanted weirdness. Do a source-wide pass to get rid of it.
|
|
- Allow underscores as group separators in numbers, for example:
0x1234_5678 is now a legal number. The underscore is just ignored,
it adds no meaning.
- Recognize dotless floating-point numbers, such as "1e30". This
entails distinguishing hexadecimal numbers in the scanner, since
e.g. 0x1e30 is a perfectly legitimate hex constant.
|
|
'd', 't' and 'y' now recognized as radix suffixes.
|
|
Proper use of bool and enum makes code easier to debug. Do more of
it. In particular, we really should stomp out any residual uses of
magic constants that aren't enums or, in some cases, even #defines.
|
|
[rw]ptr represent the global position and need to be kept in sync with
[rw]pos:[rw]blk at all times. Failed to do that while seeking, with
obviously bad results.
|
|
Both C and C++ have "bool", "true" and "false" in lower case; C
requires <stdbool.h> for this, in C++ it is an inherent type built
into the compiler. Use those instead of the old macros; emulate with
a simple typedef enum if unavailable.
|
|
The direction of the overrun test in saa_rstruct was backwards.
|
|
"len" should properly be initialized on every turn of the loop. It
can be initialized to any value >= blk_len that fits in a size_t.
(size_t)~0 would work except for any possible noncompliant C compilers
that have a signed size_t (illegal per C99 7.17.2).
|
|
|
|
SAA's were never intended to allow random access, but several backends
do random or semirandom access via saa_fread() and saa_fwrite()
anyway. Rewrite the SAA system to allow for efficient random access.
On "label.pl 10000000" this improves performance by a factor of 12.
|
|
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)
Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
|
|
To deal with fools^Wpeople trying to keep really old systems alive,
create a proper framework for substitution functions, and make it
possible to deal with the lack of snprintf/vsnprintf in particular.
|
|
Add nasm_zalloc(), a wrapper around calloc(), to allocate
zero-initialized memory. For large allocations, this is often far
more efficient than allocating and zeroing, since the operating system
tends to keep a pool of zero pages around.
|
|
Clean up nasmlib to remove functions irrelevant for ndisasm; make
nasm_malloc() etc usable inside ndisasm.
|
|
|
|
Finish the perfect hash tokenizer, and actually enable it.
Move stdscan() et al to a separate file, since it's not needed in any
of the clients of nasmlib other than nasm itself.
Run make alldeps.
|
|
|