summaryrefslogtreecommitdiff
path: root/modules/parsers/nasm
Commit message (Collapse)AuthorAgeFilesLines
* Add testcase for struc with base offsetSimon Brenner2011-10-023-0/+17
|
* Implement the base offset parameter to 'struc'Simon Brenner2011-10-021-3/+3
|
* Remove $Id$ and RCSID() usage.Peter Johnson2011-08-1910-13/+2
| | | | These are useless now that we're using git.
* Fix #201: explicitly ignore [warning] directive and treat as warning.Peter Johnson2010-05-165-0/+21
| | | | svn path=/trunk/yasm/; revision=2323
* Support all unary operators in directive expressions.Peter Johnson2010-05-161-45/+22
| | | | svn path=/trunk/yasm/; revision=2322
* Add .intel_syntax and .gas_syntax support to GAS parser.Peter Johnson2010-01-191-0/+22
| | | | | | | | Uses the NASM parser for the .intel_syntax parsing heavy lifting. Contributed by: Alexei Svitkine svn path=/trunk/yasm/; revision=2279
* Add nasm-parser-struct.h to SOURCES.Peter Johnson2010-01-191-0/+1
| | | | svn path=/trunk/yasm/; revision=2278
* Nasm parser: Add some very basic MASM-ish syntax handling, along the linesPeter Johnson2010-01-195-4/+80
| | | | | | | | | | | 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
* Split yasm_parser_nasm structure out to separate header.Peter Johnson2010-01-192-61/+96
| | | | | | | | | 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
* Implement some linemap changes required for the GAS preprocessor.Peter Johnson2010-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* tasm parser: Support "not" keyword.Peter Johnson2009-04-171-0/+4
| | | | | | Requested by: Rugxulo <rugxulo@gmail.com> svn path=/trunk/yasm/; revision=2196
* Fix referencing of local label from line that defines nonlocal label.Peter Johnson2009-03-254-10/+27
| | | | | | Reported by: Brian Gladman svn path=/trunk/yasm/; revision=2190
* Remove long-obsolete "debug" flag from internal parser structures.Peter Johnson2009-01-022-5/+0
| | | | svn path=/trunk/yasm/; revision=2167
* Use yasm functions yasm__strcasecmp and nasm_strdup instead of relying onPeter Johnson2008-10-081-11/+11
| | | | | | | | | | | 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
* Don't use tasm_compatible_mode in nasm parser (use local var instead).Peter Johnson2008-10-074-30/+40
| | | | | | Fix a few warnings while here. svn path=/trunk/yasm/; revision=2134
* Add core TASM syntax support.Peter Johnson2008-10-075-39/+456
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Nasm lexer: Don't read past end of passed string.Peter Johnson2008-09-301-47/+38
| | | | | | | | | | 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
* Add cmake build infrastructure.Peter Johnson2008-05-221-0/+21
| | | | | | | | | | | | | | | | | 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
* Split NASM preprocessor standard macro set between various modules.Peter Johnson2008-05-093-1/+128
| | | | | | | | | | | | | | | | | | | | 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
* Allow underscores in the middle of binary, octal, and hex constants.Peter Johnson2008-04-124-9/+53
| | | | | | | This makes things like 00_11_22_33h okay. Allow 0X as well as 0x in directives (already allowed for normal case). svn path=/trunk/yasm/; revision=2063
* Add complete Intel Advanced Vector Extensions (AVX) support.Peter Johnson2008-04-114-0/+53
| | | | | | | | | | | | 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
* Fix #136: Unbreak ..@ non-local-label mechanism.Peter Johnson2008-03-276-28/+79
| | | | | | | | 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
* Fix #134: Allow '@' as the first character of an identifier, like NASM does.Peter Johnson2008-02-151-1/+1
| | | | svn path=/trunk/yasm/; revision=2038
* Enable use of sym@FOO constructs in GAS parser.Peter Johnson2008-02-092-3/+16
| | | | | | | | | | 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
* Make jmp with seg:off equ behave the same as NASM.Peter Johnson2008-01-191-45/+69
| | | | | | | | | | | | | | | | | | | | | | 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
* Check for 0-termination character rather than newline.Peter Johnson2007-12-071-3/+3
| | | | svn path=/trunk/yasm/; revision=2023
* Fix #122: Allow standalone prefixes.Peter Johnson2007-12-044-4/+19
| | | | | | Implementation copied from gas parser. svn path=/trunk/yasm/; revision=2021
* Fix #125: Improve reporting of operand and expression syntax errors.Peter Johnson2007-12-044-15/+99
| | | | | | | | | | 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
* Fix #127: Allow use of 0X in addition to 0x for hex constants.Peter Johnson2007-12-044-2/+14
| | | | svn path=/trunk/yasm/; revision=2017
* Change preprocessor interface from block-oriented to line-oriented.Peter Johnson2007-11-034-83/+28
| | | | | | | | | | 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
* Check correct variable for badly parsed expression.Peter Johnson2007-11-021-1/+1
| | | | svn path=/trunk/yasm/; revision=2006
* Follow NASM after all in only turning off default RIP-rel for FS and GS,Peter Johnson2007-09-201-4/+1
| | | | | | | not all segment registers. FS and GS are the only ones which can have a segment base != 0. svn path=/trunk/yasm/; revision=1971
* Merge r1916-r1961 (cpp preproc module) from multiarch into trunk.Peter Johnson2007-09-202-4/+1
|\ | | | | | | | | | | Contributed by: Paul Barker svn path=/trunk/yasm/; revision=1966
| * Removed FILE* argument from parser interface. The FILE* given was simply ↵paulbarker2007-08-302-4/+1
| | | | | | | | | | | | stored and never used. svn path=/branches/multiarch/; revision=1922
* | Support NASM's upcoming RIP-relative syntax, with a few differences.Peter Johnson2007-09-193-10/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Support "oword", "do", and "reso" as aliases for "dqword", "ddq", andPeter Johnson2007-09-191-0/+12
|/ | | | | | "resdq" respectively, for compatibility with NASM (sigh). svn path=/trunk/yasm/; revision=1962
* Merge expr-int.h into expr.h, removing YASM_EXPR_INTERNAL in the process.Peter Johnson2007-07-141-1/+0
| | | | svn path=/trunk/yasm/; revision=1895
* Remove YASM_LIB_INTERNAL. It never really gained us that much in terms ofPeter Johnson2007-07-143-3/+0
| | | | | | visibility savings, as basically everything defined it. svn path=/trunk/yasm/; revision=1893
* Clean up a number of obsolete autoconf-detected standard C things.Peter Johnson2007-07-131-3/+1
| | | | svn path=/trunk/yasm/; revision=1892
* Change handling of frontend (mnenomic) instructions to make it easier toPeter Johnson2007-07-083-37/+41
| | | | | | | | 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
* Fix a few bugs in new directive handling.Peter Johnson2007-06-011-3/+9
| | | | | | Found by: zzuf svn path=/trunk/yasm/; revision=1865
* Clean up directive handling. This standardizes error/warning messages andPeter Johnson2007-05-262-68/+43
| | | | | | | | 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
* Move absolute section handling into NASM parser, removing all traces of itPeter Johnson2007-05-158-28/+165
| | | | | | | | | 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
* Clean up expect_() in both parsers. In the nasm parser we were passing aPeter Johnson2007-05-131-32/+32
| | | | | | | raw string as a printf string which could have resulted in a random memory access. svn path=/trunk/yasm/; revision=1839
* Call yasm_symtab_parser_finalize() from parser so caller doesn't need toPeter Johnson2007-04-231-0/+3
| | | | | | figure out itself if undef should be changed into extern or not. svn path=/trunk/yasm/; revision=1828
* Update all copyright dates.Peter Johnson2007-04-224-4/+4
| | | | svn path=/trunk/yasm/; revision=1827
* Bite the bullet and convert tabs to spaces. Previously yasm's source hasPeter Johnson2007-04-224-1331/+1331
| | | | | | | | 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
* Unbreak Windows build by using yasm__strcasecmp instead of strcasecmp.Peter Johnson2007-03-231-2/+2
| | | | | | Patch by: Chris tophe <cohika@gmail.com> svn path=/trunk/yasm/; revision=1821
* Massive update of directive handling, including handling of extern, global,Peter Johnson2007-03-211-161/+25
| | | | | | | | | | 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
* Restructure yasm_object as the central clearing house for yasm_objfmt,Peter Johnson2007-03-054-74/+58
| | | | | | | | | | | | | | 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