of the TASM "mode".
These code paths aren't used yet; they will be used for GAS .intel_syntax
handling.
Contributed by: Alexei Svitkine
svn path=/trunk/yasm/; revision=2277
This is needed so that other parsers can get access to this structure without
naming conflicts.
Contributed by: Alexei Svitkine
svn path=/trunk/yasm/; revision=2276
Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com>
- yasm_linemap_set() now takes virtual_line as a parameter, instead of
always using linemap->current. If 0 is passed for the virtual_line,
then linemap->current is used, as before.
This is because linemap->current was only incremented by the parser
(and never decremented), so the preprocessor was not able to set
mappings during the preprocessing phase (whereas with these changes,
it now does).
Additionally, setting a mapping for a line number will now delete any
existing mappings for line numbers equal or greater to that line
number. This allows the code to correctly handle the case when the
preprocessor first sets mappings from pre-pp lines to post-pp lines,
and later those mappings getting superseded by .line directives in the
original source.
This change also required making a change to yasm_linemap_lookup() to
set *file_line to 0 when line is 0 (i.e. preventing line 0 - which
means "don't display line number in output" - from getting mapped).
svn path=/trunk/yasm/; revision=2259
platform to have them.
Also, instead of using snprintf, preallocate and then use sprintf. This
also avoids the while() reallocation loop.
Reported by: Brian Gladman
svn path=/trunk/yasm/; revision=2139
Contributed by: Samuel Thibault <samuel.thibault@ens-lyon.org>
It is built on top of the NASM parser and preproc, with the following
notable extensions for TASM syntax:
- case insensitive symbols and filenames,
- support for segment and size of labels, which permits to avoid giving
them on each memory dereference,
- support for data reservation (i.e. e.g. "var dd ?"),
- support for multiples (i.e. e.g. "var dd 1 dup 10"),
- little endian string integer constants,
- additional expression operators: shl, shr, and, or, low, high,
- additional offset keyword,
- additional fword and df,
- support for doubled quotes within quotes,
- support for array-like and structure-like notations: t[eax] and
[var].field,
- support for tasm directives: macro, rept, irp, locals, proc, struc,
segment, assume.
Notes:
- Almost all extensions are only effective when tasm_compatible_mode is
set, so we should have very reduced possible breakage.
- Because the "and" keyword can be an expression operator and an
instruction name, the data pseudo-instructions explicitly switch the
lexer state to INSTRUCTION state to fix the ambiguity.
- In gen_x86_insn.py, several instructions (namely lds and lea) now take
relaxed memory sizes. The reason is that in the case of tasm, the size
of the actual pointed data is passed up to there, and thus any type of
data should be accepted.
With all of this, loadlin can be compiled by yasm with quite reduced
modifications.
A new TASM-like frontend is also included.
svn path=/trunk/yasm/; revision=2130
This was because the re2c-generated code always reads the next character
prior to user code being executed. Instead, check for the \0 marker prior
to entering the re2c code. Retain the re2c check just for sanity.
Reported by: Samuel Thibault (on yasm-devel@)
svn path=/trunk/yasm/; revision=2122
Not default nor even distributed in the .tar.gz, the cmake build allows for
loadable yasm plugins by building libyasm as a shared library.
Example plugins are in the plugins/ directory, and may be loaded into a
cmake-built yasm using the -N command line option (non-cmake builds will
not have this option).
Tested only on Linux so far, but should be relatively painless to port to
Windows thanks to the use of cmake rather than libtool to create shared
libraries.
The only modification to the main source tree is some conditional-compiled
additions to yasm.c.
svn path=/trunk/yasm/; revision=2098
Standard macro sets are looked up based on parser and preprocessor keyword
from individual modules.
The "standard" NASM parser macros now reside in the NASM parser, so when
the GAS parser is used with the NASM preprocessor, the NASM-specific macros
are no longer defined.
Object-format specific macros are now individually defined by each object
formatm module. This allows for the object formats to be independent of the
NASM preprocessor module and yields a small optimization benefit as unused
object format macros don't need to be skipped over.
Also add GAS macro equivalents for the Win64 SEH more complex directives [1].
[1] Requested by Brian Gladman <brg@gladman.plus.com>
svn path=/trunk/yasm/; revision=2082
A full testcase for NASM mode based on the AVX programming reference is
included. GAS mode should work, but is untested at present.
V-prefix aliases are present for all supported instructions to allow easy
use of the VEX prefix version without significant code modifications.
All comparison and other pseudo-ops are included.
svn path=/trunk/yasm/; revision=2051
Add testcase for this.
Also fix $-prefixed labels to match non-$-prefixed label behavior
(this has been broken for a very long time).
svn path=/trunk/yasm/; revision=2045
To do this, restructure how special symbols are handled between the parser
and object format. Instead of creating special symbols with the right
names, instead have the parser call the object format to see if a match
is found into the special symbols, which are no longer stored in the
symbol table.
svn path=/trunk/yasm/; revision=2035
Formerly:
foo equ 1:2
jmp foo
would result in a far jump. Now, an explicit "far" is required:
jmp far foo
to generate a far jump.
In addition, the direct use of seg:off in immediates and effective
addresses will result in an error; the use of EQU'ed seg:off values
is still legal (and will still result in just the offset). This
behavior is more sane and also matches NASM behavior.
Thus:
foo equ 1:2
mov ax, foo ; okay, just 2
mov ax, [foo] ; okay, just 2
mov ax, 1:2 ; illegal
mov ax, [1:2] ; illegal
svn path=/trunk/yasm/; revision=2028
Now instead of the generic "expression syntax error", more informative
error messages such as the following are reported:
- unexpected `:' after instruction
- expected expression after `%'
- expected operand, got `%'
svn path=/trunk/yasm/; revision=2020
This will make certain types of parser-preprocessor synchronization
easier for upcoming feature enhancements.
Due to additional complexity in GAS (rept), internally GAS converts
lines back into blocks.
svn path=/trunk/yasm/; revision=2007
This adds a "default" directive that takes either "rel" or "abs". This
sets whether the default mode for simple displacements is RIP-relative (rel)
or not (abs). The default without a directive is "abs".
Also added is corresponding "rel" and "abs" effective address modifiers
to override whatever default is set:
[rel label] is RIP-relative
[abs label] is not.
In default rel mode, [label] defaults to the former, in default abs mode,
the latter. Also, segment overrides (note difference from NASM below) are
abs regardless of mode, unless explicitly overridden with rel:
[fs:label] is always abs
[rel fs:label] is always rel
However, we have a number of differences from NASM in this handling due to
what I feel to be yasm's more sane handling of [dword ...] and [qword ...].
In yasm, these set the displacement size, rather than the address size; the
latter is set using a a32/a64 prefix. I feel this is more sane as in 64-bit
mode the two can be different in the MovOffs (A0/A1 mov *ax) case.
Also, yasm disables default-rel mode if any segment register is used, not
just FS or GS as NASM currently does.
See modules/arch/x86/tests/riprel1.asm and
modules/arch/x86/tests/riprel2.asm for examples, as well as my recent
posting to the nasm-devel mailing list on SF.
svn path=/trunk/yasm/; revision=1963
customize on the arch side of things. Instead of passing around an
arch_data[4] for instructions, now the arch can extend the structure itself
to add additional information in any format it likes.
svn path=/trunk/yasm/; revision=1889
makes value/parameters more well-defined and flexible enough to handle
string parameters. Value/parameters would now be better called name/values,
but avoid changing the name for now.
svn path=/trunk/yasm/; revision=1851
from libyasm core. Now absolute sections are tracked locally to the parser
and the parser generates EQUs directly for labels in absolute sections.
Fixes#106 and #103.
svn path=/trunk/yasm/; revision=1842
been using a mix of tabs and 4 spaces to indent; this looks horrible if
tab size is ever not 8. While I debated converting to tab-only indentation
that would have been a far higher impact to the source.
svn path=/trunk/yasm/; revision=1825
and common declare. The latter no longer passes through objfmt at parse time;
instead the objfmt must handle them at output time (objfmt-specific
extensions are parsed & stored by the parser). Directives are now handled
using a list (with function pointers) rather than a single function entry
point.
svn path=/trunk/yasm/; revision=1819
yasm_dbgfmt, and yasm_arch. This eliminates a lot of redundant keeping
track of this information in the individual object and debug formats and
also simplifies a fair amount of code.
I'm still not happy with how arch gets passed around in output code, but
there may not be much of an alternative there.
While I'm here, clean up some unused variables and functions and re-enable
the warning for unused variables in configure.ac.
svn path=/trunk/yasm/; revision=1812
LOCKREP. According to mailing list traffic, Intel prefers this order
(apparently for SIMD?) and AMD doesn't care.
GAS commit by: H.J. Lu <hongjiu.lu@intel.com>
svn path=/trunk/yasm/; revision=1807