summaryrefslogtreecommitdiff
path: root/nasm.h
Commit message (Collapse)AuthorAgeFilesLines
* ofmt: Alias shortname must be used for __OUTPUT_FORMAT__ macroCyrill Gorcunov2011-04-061-1/+10
| | | | | | | | | | | | __OUTPUT_FORMAT__ must consist of shortname of output format or its alias, otherwise userspace ABI gets broken. For example source code still can refer to __OUTPUT_FORMAT__=elf, instead of __OUTPUT_FORMAT__=elf32. BR3246990 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Revert "Improve process_ea and introduce -OL"H. Peter Anvin2010-07-251-2/+1
| | | | | | | | | | This reverts commit ac732cb6a599836bf4c988e59ac6de4498758c72. Resolved Conflicts: doc/nasmdoc.src Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* nasm.h: move "regs.h" to top; make is_register() a boolH. Peter Anvin2010-07-251-5/+3
| | | | | | | Move the #include of regs.h to the top with the other includes, and make is_register() -- being a boolean predicate -- return bool. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* move is_register helper to nasm.hCyrill Gorcunov2010-07-251-0/+6
| | | | | | | | | | | | | | | H. Peter Anvin noted: | | Could we avoid putting static code that has no dynamic content in | dynamically generated files... it just complicates things unnecessarily. | | The above can move into nasm.h for example. | Good idea. CC: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Improve process_ea and introduce -OLVictor van den Elzen2010-07-241-1/+2
| | | | | | | | | | | | | | | | | | | Two fixes: 1. Optimization of [bx+0xFFFF] etc 0xFFFF is an sbyte under 16-bit semantics, so make sure to check it right. 2. Don't optimize displacements in -O0 Displacements that fit into an sbyte or can be removed should *not* be optimized in -O0. Implicit zero displacements are still optimized, e.g.: [eax] -> 0 bit displacement, [ebp] -> 8 bit displacement. However explicit displacements are not optimized: [eax+0] -> 32 bit displacement, [ebp+0] -> 32 bit displacement. Because #2 breaks compatibility with 0.98, I introduced a new optimization level: -OL, legacy.
* Rename filenames to 8.3 formatH. Peter Anvin2010-06-151-1/+1
| | | | | | | Apparently some people still care about compiling native on MS-DOS, and we don't have a significant number of files which need adjustment. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Add support for one-byte relocationsH. Peter Anvin2010-05-061-0/+1
| | | | | | | | | Add OUT_REL1ADR (one-byte relative address) and support for OUT_ADDRESs with size == 1. Add support for it in outbin and outdbg. *It still needs to be added to other backends*, both the OUT_REL*ADR and OUT_ADDRESS codepaths need to be handled. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Rename SEGALIGN to SECTALIGNCyrill Gorcunov2010-04-211-3/+3
| | | | | | | "sectalign" is preferred over "segalign" since it operates over section attributes. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* ofmt: Implement null_segalign stubsCyrill Gorcunov2010-04-211-0/+6
| | | | | | Set stubs for all targets Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* opflags: more int32_t -> opflags_t conversionsH. Peter Anvin2009-10-131-196/+1
| | | | | | | Hopefully this should catch all of them... but please keep an eye out for any other uses of int32_t for the operand flags. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* nasm.h: introduce is_class macro helperCyrill Gorcunov2009-10-131-0/+2
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* use opflags_t type for operandsCyrill Gorcunov2009-10-131-1/+1
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Drop efunc and evalfunc as input to the preprocessorH. Peter Anvin2009-07-181-1/+1
| | | | | | | We only ever invoked the preprocessor with fixed values for efunc and evalfunc, so call nasm_error() and evaluate() directly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Drop the ofmt and errfunc arguments to label definition functionsH. Peter Anvin2009-07-181-4/+2
| | | | | | | | We never set ofmt and errfunc to anything but the global values. Dropping them from the label definition function command line simplifies the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Remove function pointers in output, simplify error handlingH. Peter Anvin2009-07-181-23/+25
| | | | | | | | | | | | | | | Remove a bunch of function pointers in the output stage; they are never changed and don't add any value. Also make "ofile" a global variable and let the backend use it directly. All we ever did with these variables were stashing it in locals and using them as-is anyway for no benefit. Also change the global error function, nasm_error() into a true function which invokes a function pointer internally. That lets us use direct calls to it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Hash even backend-specific directives, unify null functionsH. Peter Anvin2009-07-121-1/+2
| | | | | | | | | Hash all directives, even the ones that are backend-specific, and instead pass the backend an already-parsed directive number. Furthermore, unify null functions across various backends. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* listing: preserve list file on error, include errorsH. Peter Anvin2009-07-071-1/+5
| | | | | | | | | Instead of removing the list file on error, keep the list file and include the errors in the list file. This makes it actually possible to debug things that involve deep macro recursion, where the line number is pretty much meaningless. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM: relicense under the 2-clause BSD licenseH. Peter Anvin2009-07-061-12/+0
| | | | | | | | *To the best of my knowledge*, we now have authorization from everyone who has significantly contributed to NASM in the past. As such, change the license to the 2-clause BSD license. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Make it possible for outputs to be either text or binaryH. Peter Anvin2009-07-051-5/+3
| | | | | | | | | | | Allow the backend to specify that an output format is either text or binary. For future uses, define this as a flag word so we can define other flags in the future if it would make sense. Currently, the ieee and dbg formats are text; all the others are binary. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add copyright headers to the *.c/*.h files in the main directoryH. Peter Anvin2009-06-281-6/+45
| | | | | | | | | | Add copyright headers to the *.c/*.h files in the main directory. For files where I'm sure enough that we have all the approvals, I have given them the 2-BSD license, the others have been given the "LGPL for now" license header. Most of them can probably be changed after auditing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add support for instructions which always use low 8-bit registersH. Peter Anvin2009-06-241-0/+1
| | | | | | | | | Add a byte code to explicitly support instructions which only uses the low 8-bit registers (as if a REX prefix always was present.) This is usable for instructions which are officially documented as using "the low byte of a 32-bit register" and so on. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add symbolic constants for REX_V "classes" (VEX, XOP, ...)H. Peter Anvin2009-05-081-0/+8
| | | | Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Infrastructure support for AMD's new XOP prefixH. Peter Anvin2009-05-031-2/+2
| | | | | | | Handle AMD's XOP prefixes; they use basically the same encoding as VEX prefixes, so treat them simply as a variant of VEX. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Do not confuse segmentless adresses and unknown forward referencesVictor van den Elzen2009-02-251-0/+2
| | | | Also be optimistic with immediate forward references.
* BR 2592476: Treat WAIT as a prefix even though it's really an instructionH. Peter Anvin2009-02-211-0/+2
| | | | | | 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.
* Move all version strings to a single compilation unit (ver.c)H. Peter Anvin2008-10-311-1/+9
| | | | | | | Move all the version strings to a single compilation unit, ver.c; this does not include the version macros, which are fed into macros.c. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* assemble.c: be smarter about when to suppress warnings due to SBYTEH. Peter Anvin2008-10-041-0/+1
| | | | | | | Be smarter and don't suppress warnings due to SBYTE when the SBYTE didn't actually match. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Avoid redundant "const" for macros_tH. Peter Anvin2008-07-191-1/+1
| | | | | | Don't use a redundant "const" for macros_t (which is const unsigned char), since OpenWatcom doesn't like it, and I believe it is incorrect per the C standard.
* BR 2003451: avoid "forwardness" leaks between operandsH. Peter Anvin2008-07-191-1/+1
| | | | | | | Any use of ins->forw_ref that isn't related to control of the optimizer is fundamentally broken. Use operand->opflags & OPERAND_FORWARD instead. This even has the nice side benefit of simplifying the code.
* Fix a few more <ctype.h> instancesH. Peter Anvin2008-06-211-3/+3
| | | | A few isolated instances of isalpha() and isxdigit().
* ctype.h: wrapper ctype functions with a cast to (unsigned char)H. Peter Anvin2008-06-211-3/+3
| | | | | | | | | 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.
* Move the output format macros into the macros.pl mechanismH. Peter Anvin2008-06-201-1/+2
| | | | | | | | | | Move the handling of "extra" macros (i.e. output format macros) into the macros.pl mechanism. This allows us to change the format of the internal macro store in the future - e.g. to a single byte store without redundant pointers. Also, stop using indicies into a long array when there is no good reason to not just use different arrays.
* Implement __utf16__() and __utf32__() for the DB familyH. Peter Anvin2008-06-141-7/+19
| | | | | Implement __utf16__() and __utf32__() for the DB family of pseudo-instructions. Not yet implemented for evaluation context.
* Make strings a first-class token type; defer evaluationH. Peter Anvin2008-06-091-3/+8
| | | | | | | Make strings a proper, first-class token type, instead of relying on the "TOKEN_NUM with tv_charptr" hack. Only convert a string to a number if requested in an expression context; this also makes it possible to actually issue a warning when it overflows.
* Add the -MP option to emit phony targetsH. Peter Anvin2008-05-291-1/+9
| | | | | | | Add the -MP option to emit phony targets. Since this means each header file has to be visited more than once, change the implementation to use an internal list of all the dependencies, and centralize the emission of the dependency files.
* Implement -MD, -MF, -MT, -MQH. Peter Anvin2008-05-291-2/+2
| | | | | | | | | Implement the dependency options: -MF: set the file to which dependencies are written. -MD: generate dependencies in parallel with compilation. -MT: set the name of the dependency target. -MQ: same as -MT, but *attempt* to quote it for Makefile safety.
* Add support for ymm0 in instructionsH. Peter Anvin2008-05-201-0/+4
| | | | Make it possible to use ymm0 as a fixed operand in instructions
* nasm.h: remove obsolete IP_REG definitionsH. Peter Anvin2008-05-201-3/+0
|
* Add DY, YWORD, and the SY instruction flagH. Peter Anvin2008-05-201-5/+7
| | | | | Add the DY instruction, YWORD keyword, and an SY marker for instruction sizes. Add a few more AVX sample instructions.
* Make MAX_OPERANDS a parameter in insns.pl as wellH. Peter Anvin2008-05-121-0/+1
| | | | | | MAX_OPERANDS is present in insns.pl as well (although proper C compilers shouldn't need this kind of zero padding.) Make sure it's clear to everyone.
* First cut at AVX machinery.H. Peter Anvin2008-05-041-12/+15
| | | | | | | | | 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.
* Initial support for YMM (AVX) registersH. Peter Anvin2008-04-211-1/+4
| | | | | Add support for ymm0..15 registers, and the "ymmreg" qualifier. No support yet for "yword" or "dy".
* Correctly identify SBYTE in the optimizerH. Peter Anvin2008-04-041-2/+6
| | | | | Correctly identify SBYTE in the optimizer, *HOWEVER*, this change will cause nuisance warnings to be issued; that will have to be fixed.
* nasm.h: make t_type an enumH. Peter Anvin2008-01-211-17/+17
| | | | Make t_type an enum to make debugging easier.
* Sanitize the pass logic, and only issue PASS1 warnings on pass0 == 1H. Peter Anvin2008-01-081-0/+1
| | | | | | For PASS1 warnings, only do them when pass0 == 1. The prior passes are to be considered training passes. This is a bit awkward if we then hit an error, but it's better than n repeated warnings.
* regularized spelling of license to match name of LICENSE fileBeroset2007-12-291-1/+1
|
* Fix handling of XCHG in 64-bit modeH. Peter Anvin2007-11-121-75/+81
| | | | | | The handling of XCHG in 64-bit mode somewhat broken. Add a register flag for "not accumulator", so we can generate all the appropriate modes.
* Don't combine type and size into a single argumentH. Peter Anvin2007-11-091-30/+30
| | | | | | | Don't combine type and size into a single argument; *every* backend immediately breaks them apart, so it's really just a huge waste of effort. Additionally, it avoids using short immediates in the resulting code, which is a bad thing.
* Fix building under OpenWatcomH. Peter Anvin2007-11-081-8/+9
| | | | | | | | OpenWatcom doesn't like 64-bit switch arguments; the change to 64-bit type arguments caused that to happen in outmacho.c. Hack around it for now; however, realistically speaking the whole bit stealing thing is probably a bad idea, especially since virtually all CPUs handle short immediates better than long ones.
* Move elements() to nasmlib.hH. Peter Anvin2007-11-081-13/+0
| | | | | Move elements() to nasmlib.h; that is the best place for this kind of utility macros.