Commit graph

1973 commits

Author SHA1 Message Date
H. Peter Anvin
c8d10038e2 insns.dat: in 64-bit mode, accept "monitor rax,ecx,edx".
The first argument to MONITOR is an address, so it should be 64 bits
(RAX) in 64-bit mode.

The preferred form is still just plain "monitor".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-01-06 16:07:26 -08:00
Cyrill Gorcunov
48a434e1a9 Mkfiles: Add depends on stabs.h for Elf output
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 16:19:43 +03:00
Cyrill Gorcunov
7a8098c7cb doc/changes.src: Update changes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 15:41:22 +03:00
Cyrill Gorcunov
a135658e83 ELF: Explicitly point out SYM_GLOBAL, SYM_LOCAL binding
Instead of implicit declaration of global symbols obtained
by STB_GLOBAL << 4, and local symbols by STB_LOCAL << 4
use ELF32_ST_MKBIND helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 15:04:46 +03:00
Cyrill Gorcunov
de623f2679 elf.h: Add ELFXX_ST_MKBIND and move ELFXX_ST_ helpers
The profit of ELFXX_ST_MKBIND helper is that we
will use it for SYM_GLOBAL explicitly pointing
out from where this magic 0x10 came from.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 15:04:41 +03:00
Cyrill Gorcunov
126faf2e3b output/outelfX.c: Use definitions from stabs.h
Also made Makefile.in to handle dependency.
There are some makefiles in Mkfiles\ should
be fixed as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 15:04:36 +03:00
Cyrill Gorcunov
d1428b23da Add common STABs definition into output/stabs.h
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 15:04:31 +03:00
Cyrill Gorcunov
c9862c009b outelfX.c: Trivial cleanup
Some tab\space convertions together with
trivial style nitfix.

No change on binary level.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 15:04:26 +03:00
Cyrill Gorcunov
762e401937 BR2924380: Add AMD LWP instructions
nasm64developer reported that we have no LWP support yet.
Add this feature.

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 14:58:06 +03:00
Cyrill Gorcunov
5890ab39f8 BR2924383: fix XOP instructions
nasm64developer reported a few nits in XOP
instruction templates. Plain typo in specification
(http://support.amd.com/us/Processor_TechDocs/43479.pdf)
and opcode errors.

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 00:40:54 +03:00
Cyrill Gorcunov
c09bd81ff3 BR2924583: fix FMA4 instructions
nasm64developer reported that VFNMADDSD and VFNMADDSS
have "m" and "s" operands swapped in instruction templates
file.

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-03 00:09:41 +03:00
Cyrill Gorcunov
3b4c769d99 Elf: Allow symbols binding to undefined section
Commit 2ddcd03900
did bind symbols (in case of omitted SECTION directive)
to .text section but break COMMON binding.
Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-02 23:00:43 +03:00
Cyrill Gorcunov
3e73cfc8b7 doc/nasmdoc.src: Update the number of sync points in docs
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-22 23:42:07 +03:00
Cyrill Gorcunov
faaad6e75d sync.c: Get sync points limit back
We should explicitly check if we can hold the sync
point, otherwise we may wrap the array index and
reach incorrect value (if we're lucky).

So instead we make the index "almost" unlmited.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-22 23:42:03 +03:00
Cyrill Gorcunov
f064c1cb02 sync.c: Style nitfix
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-22 23:41:59 +03:00
H. Peter Anvin
725ad3f80b NASM 2.08rc6 2009-12-18 16:26:02 -08:00
Cyrill Gorcunov
a2c4abb633 insns.dat: Restore default size of memory operands
During conversion of size of memory operands into
explicit form the compatibility with 2.07 has been
broken (for a small set of instructions). Lets restore
it. Details below.

This is due to specifics of our "fuzzy logic" algorithm.

For example consider the user wrote an instruction like

	VCVTTPD2DQ xmm0,[eax]

the last operand is memory reference. But template contains
the following two items (written in simplified form)

	VCVTTPD2DQ xmmreg,mem128
	VCVTTPD2DQ xmmreg,mem256

So this is impossible to find out what _exactly_ user meant:
either reference to 128 bit value in memory or 256 bit.

As a solution we've been using IF_Sx modifier written in
template which allows to choose "by-default" template
and break the tie.

Reported-by: Victor van den Elzen <victor.vde@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-16 18:50:22 +03:00
Cyrill Gorcunov
78debd0a57 doc/changes.src: describe changes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-13 14:13:35 +03:00
Cyrill Gorcunov
2ddcd03900 Elf: bind labels to text section by default
In case if SECTION directive is omitted but the real
code exist we form .text section by default and put compiled
code here. In turn labels are not handled in a same manner.

So lets bind them to text section by default as well.

[ BR: 2835192 ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-10 00:36:37 +03:00
Cyrill Gorcunov
6531d6d159 BR2907058: insn_size - close file handle before returning
As example of such behaviour is when fseek fails for
some reason.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-05 14:10:41 +03:00
Cyrill Gorcunov
416bd78bae nasm.c: Use copy_filename to set error message file
To prevent errname buffer overwrite we should
use copy_filename instead of strcpy.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-04 19:44:20 +03:00
Cyrill Gorcunov
8896ad0c65 insns.dat: AVX -- no need for IF_ARx in template
We describe the instruction arguments in explicit form
so IF_ARx is just not needed here.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-03 00:22:58 +03:00
H. Peter Anvin
6650557a35 Run "make alldeps" 2009-11-30 13:28:31 -08:00
H. Peter Anvin
3c9d7ea8a6 outrdf.c: remove obsolete file
The old RDF format has been unsupported for long time now.  Remove it
from the tree.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-30 13:27:49 -08:00
H. Peter Anvin
3b861a7766 outform.h: fix OF_NO_RDF2
OF_NO_RDF2 should turn off OF_RDF2, not OF_RDF

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-30 13:26:34 -08:00
H. Peter Anvin
801a218854 AUTHORS: convert to UTF-8
Convert Latin-1 character to UTF-8.  This is 2009.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-30 12:07:31 -08:00
H. Peter Anvin
b512fb56db outmacho32: replace error() -> nasm_error()
Somehow outmacho32.c escaped the global change of error variables to
hard-coded nasm_error().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-30 11:27:47 -08:00
H. Peter Anvin
f92befabba NASM 2.08rc5 2009-11-28 15:35:51 -08:00
H. Peter Anvin
1199cddebb test/Makefile: make it easier to inject options
Make it easier to inject options into test compiles.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-28 15:34:32 -08:00
Cyrill Gorcunov
bd38c8f231 preproc.c: expand_smacro -- break endless loop for interminable macro recursion
Frank reported:
|
| From the "expert questions" forum comes this:
|
| ---------------------
| By: jasper_neumann
|
| How can I delegate %undef?
|
| In the example below the assembler (called with "nasm.exe -t -f rdf q.asm")
| bemoans my code, displays
|
| "q.asm:19: error: interminable macro recursion"
|
| and hangs.
|
| q.asm
| -----
| bits 32
| CPU P4
|
| %macro my_def 2
|  %xdefine %1 esp+%2
| %endmacro
|
| %macro my_undef 1
|  %undef %1
| %endmacro
|
| global check_it
| check_it:
|  my_def x,4
|  mov eax,[x]
|  my_undef x
|
|  my_def x,8
|  add eax,[x]
|  my_undef x
|  ret
|

So in case of interminable macro recursion we should break
the expansion procedure that way to not return back and start
expand macro again.

This address a part of the original problem.
Nasm64developer pointed out:
|
| Btw, after you manage to fix this recursion problem, the code
| in question still faces the same fundamental issue -- the arg
| to the my_undef invocations (i.e. x) gets expanded first; thus
| the %undef inside the macro sees esp+4 and esp+8 instead
| of x, and fails. What you'd need is a means to prevent the ex-
| pansion -- look for e.g. %# in 4.1.4 of the manual.txt which is
| attached to SF #1842438; it implements exactly that -- I once
| filed SF #829879 for this feature.
|

In turn Keith Kanios said:
|
| Anon is also correct in that we would need a special directive to instruct
| the delay of macro expansion, although I don't see this as critical or even
| high priority at the moment. The intermediate solution for this is, don't
| use indirection if it is not needed... an inline %undef should be
| sufficient.
|

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Keith Kanios <keith@kanios.net>
2009-11-21 11:11:29 +03:00
Cyrill Gorcunov
bc0113d977 outcoff: BuildExportTable -- tab/space fix
Due to previous commit an indent by tab (occasionally) brought in.
Fix it as well. No change on binary level.

We're not that far from NASM release so it's a bit unpleasant
manner to push in such trivial change. But since it's the previous
commit dependent -- I dare to push it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-17 23:25:15 +03:00
Cyrill Gorcunov
bf8cebd813 outcoff: Do not fail on long export identifiers
If an export identifier is greater then 241 symbols
we do fail due to buffer overflow. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-17 20:49:58 +03:00
H. Peter Anvin
6293bd45eb NASM 2.08rc4 2009-11-13 14:12:37 -08:00
Victor van den Elzen
02c9a72fdd Update test files
Remove references to DREX instructions
2009-11-11 08:09:03 +01:00
Victor van den Elzen
30621f4d0c Add test/bisect.sh for use with "git bisect" 2009-11-11 07:47:39 +01:00
Victor van den Elzen
b9856a266e Don't boundcheck 64-bit numbers, it gives problems due to overflows 2009-11-11 07:39:21 +01:00
H. Peter Anvin
cfe46ecfec NASM 2.08rc3 2009-11-09 16:54:48 -08:00
H. Peter Anvin
96690c6ee4 insns.dat: remove non-DREX SSE5 instructions
Even the non-DREX SSE5 instructions appear to have been either
obsoleted or replaced with XOP varieties.  The only exception are the
ROUNDxx instructions, which are really SSE4.1 instructions and which
were simply duplicates.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-09 16:53:43 -08:00
H. Peter Anvin
5792483c7d changes.src: document removal of DREX instructions
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-09 14:58:45 -08:00
H. Peter Anvin
2dad3ccd17 SSE5: remove all DREX-based instructions
AMD has obsoleted the DREX-based SSE5 proposal, so remove all such
instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-09 14:57:19 -08:00
Cyrill Gorcunov
2e7a84b829 outelf32/64 - various cleanups in a sake of unification
Make a small step forward elf32/64 unification procedure.
Mostly style fixes. Nothing serious.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:59 +03:00
Cyrill Gorcunov
b15ed1f836 dwarfX_output: dont check for "ln" twice
And make dwarf64 version to be more familiar to
32bit version (preparation work for merge).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:54 +03:00
Cyrill Gorcunov
24f9398a6f output/outelf64.c: simplify stabs64_cleanup, dwarf64_cleanup
nasm_free is failsafe against NULL passed

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:49 +03:00
Cyrill Gorcunov
b9771908b6 Document BR 2887108 in changes.src
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:45 +03:00
Cyrill Gorcunov
a50f829435 Merge elf header files
Merge elfcommon.h, elf32.h, elf64.h into
single elf.h -- we do support both elf32
and elf64 anyway. Let put them into common
place.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:41 +03:00
Cyrill Gorcunov
4139c9af86 hash_init: check for size being power of two
It's really a bug if size is not power of
two. We must to be sure all callers are
sane.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:37 +03:00
Cyrill Gorcunov
2967fee0bb hashtbl.c: Unify common hash ops by macros
Instead of opencoded repeatable computation
use macro helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 21:58:48 +03:00
Cyrill Gorcunov
09e2895fbe Introduce is_power2 helper
We will need it for hash tables

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 21:01:45 +03:00
H. Peter Anvin
19f9f60efb MOVD xmmreg: not valid with REX.W
The xmmreg forms of MOVD are invalid with REX.W, since those are MOVQ
instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-06 09:36:11 -08:00
Cyrill Gorcunov
1de9500c89 Comment out matches() operand flags logic
Also space fix

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 00:08:38 +03:00