Commit graph

866 commits

Author SHA1 Message Date
paulbarker
cd66a1f174 Merged changes r1927-r1963 from the trunk into multiarch branch.
svn path=/branches/multiarch/; revision=1964
2007-09-19 19:18:58 +00:00
Peter Johnson
31ef2e7a52 Support NASM's upcoming RIP-relative syntax, with a few differences.
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
2007-09-19 07:47:10 +00:00
Peter Johnson
6dfe4b13fd Support "oword", "do", and "reso" as aliases for "dqword", "ddq", and
"resdq" respectively, for compatibility with NASM (sigh).

svn path=/trunk/yasm/; revision=1962
2007-09-19 02:52:33 +00:00
paulbarker
5cbc876ef5 * Added code to the cpp module to pass include directories to the cpp program.
* Marked a string for gettext.
* Fixed a comment error.

svn path=/branches/multiarch/; revision=1961
2007-09-18 12:41:57 +00:00
Peter Johnson
779b7dd67e Include ctype.h into files that now use tolower().
svn path=/trunk/yasm/; revision=1956
2007-09-17 03:42:01 +00:00
Peter Johnson
4af823161d Make CPU feature flags and registers case insensitive again.
This was accidentally removed in [1929].
Add test case for these so it doesn't happen again.

svn path=/trunk/yasm/; revision=1955
2007-09-17 02:58:05 +00:00
Peter Johnson
1f6c405d98 Add support for IEEE-754r "half precision" (16-bit) float format.
This format is used by SSE5.
Update minor tests; more extensive tests will be added soon.

svn path=/trunk/yasm/; revision=1954
2007-09-16 20:41:16 +00:00
Peter Johnson
a1137cdf67 Add SSE5 (new AMD SSE) instructions support.
svn path=/trunk/yasm/; revision=1953
2007-09-16 20:29:59 +00:00
Peter Johnson
39913f32de Fix #114: Incorrect ELF32 ..gotpc address calculation.
Reported by: Loren Merritt
Fix by: mu@

We already had a testcase for this, but it had an incorrect "golden" result.

svn path=/trunk/yasm/; revision=1952
2007-09-15 06:40:27 +00:00
Peter Johnson
cbb1bd2771 Switch x86 operand storage from manual bitfields to C structure bitfields.
svn path=/trunk/yasm/; revision=1950
2007-09-13 07:26:17 +00:00
Peter Johnson
42b841418b Change modifiers from a prioritized shifted sequence into an ordered array.
Move GAS suffixes to a separate field in x86_insn_info rather than
having them embedded in the modifier field.

svn path=/trunk/yasm/; revision=1949
2007-09-13 06:35:24 +00:00
Peter Johnson
e19fd3ce2b Add Id tag.
svn path=/trunk/yasm/; revision=1947
2007-09-12 07:11:42 +00:00
Peter Johnson
f0e2e9a262 Now that we have more cpu feature bits, properly document SSE4a as such.
Also correct name of k8 chip (clawhammer) and add venice, k10 processors.

svn path=/trunk/yasm/; revision=1946
2007-09-12 07:10:26 +00:00
Peter Johnson
f61ca1e379 Restructure x86 CPU handling to allow for more than 30 CPU feature flags.
svn path=/trunk/yasm/; revision=1945
2007-09-12 06:55:51 +00:00
Peter Johnson
a7f73e3a6c Shrink the size of the x86_insn_info structure, particularly on 64-bit
systems, by combining operand lists into a single array (and trying to find
overlaps where possible).  This saves about 4K even on a 32-bit system.

Also shrink the generated gperf code by outputting the number of info
structures directly rather than using NELEMS().

svn path=/trunk/yasm/; revision=1943
2007-09-11 04:49:53 +00:00
paulbarker
11543884ff Added dependency generation to cpp module.
svn path=/branches/multiarch/; revision=1941
2007-09-10 10:46:31 +00:00
paulbarker
ca7439276e Delayed destruction of arguments list until cpp_preproc_destroy() in cpp module.
svn path=/branches/multiarch/; revision=1940
2007-09-10 10:17:19 +00:00
Peter Johnson
d0033b06c5 Change genperf to take input and output filenames rather than outputting to
standard output.  This makes for better error handling behavior with make
(redirecting the standard output could leave empty files behind on error).

svn path=/trunk/yasm/; revision=1939
2007-09-10 07:15:50 +00:00
Peter Johnson
f150e45913 Change x86 instruction tables to be automatically generated.
This combines the C and perfect hash tables into a single source file,
and allows for easier future changes to the source-level structures.

The Python-built files are included in the distribution so that Python
is not added as a dependency.

The generated code has been verified equal against the old tables,
excepting a number of bugfixes.

Most of the bugs fixed are in the CPU field, plus a few GAS suffix fixes.

svn path=/trunk/yasm/; revision=1937
2007-09-10 06:59:47 +00:00
paulbarker
ac75ded379 Changed gas parser to only pass the first cpp line marker onto the debugging module.
svn path=/branches/multiarch/; revision=1935
2007-09-09 11:51:08 +00:00
Peter Johnson
1387e29705 Windows build fixes:
* modules.vcproj: Add x86cpu.c, x86regtmod.c, and lc3b arch files to fix build.
* x85geninsn.c: Clean up a couple of unused variables.
* genperf.c: Use sprintf instead of snprintf; convert filename backslashes to slashes.

svn path=/trunk/yasm/; revision=1932
2007-09-08 02:13:25 +00:00
Peter Johnson
00e958bcf6 Break apart perfect hash lookup generation and x86 arch-specific
instruction handling.

Use the GNU gperf file format, but continue to use our custom minimal
perfect hash generator.

svn path=/trunk/yasm/; revision=1929
2007-09-07 22:05:33 +00:00
Peter Johnson
32921a0d12 Unbreak distcheck in lc3b tests.
svn path=/trunk/yasm/; revision=1928
2007-09-07 22:03:34 +00:00
paulbarker
5e9f538bb3 Added code to gas parser to handle line markers produced by cpp.
svn path=/branches/multiarch/; revision=1926
2007-09-03 20:20:40 +00:00
paulbarker
d628c6a315 * Marked message strings so gettext can find them.
* Updated POTFILES.in

svn path=/branches/multiarch/; revision=1925
2007-09-01 20:11:11 +00:00
paulbarker
a956b0e1db Removed FILE* argument from preprocessor create() interface. The preprocessor now opens the input file itself.
svn path=/branches/multiarch/; revision=1923
2007-08-30 21:08:33 +00:00
paulbarker
76d60df7b8 Removed FILE* argument from parser interface. The FILE* given was simply stored and never used.
svn path=/branches/multiarch/; revision=1922
2007-08-30 21:00:38 +00:00
paulbarker
c88fd9dd7e Changed cpp module to destroy the argument list and free the memory it uses.
svn path=/branches/multiarch/; revision=1921
2007-08-30 19:36:57 +00:00
paulbarker
1069d0fce3 Modified cpp module to read directly from the preprocessor using a pipe, rather than storing the output in a temporary file.
svn path=/branches/multiarch/; revision=1920
2007-08-30 11:39:15 +00:00
paulbarker
dc23b37308 Simplified cpp module, re-structuring much of the code and improving comments.
svn path=/branches/multiarch/; revision=1919
2007-08-29 15:40:09 +00:00
paulbarker
09403aea2a Cleaned up cpp_invoke() function and removed call to asprintf().
svn path=/branches/multiarch/; revision=1917
2007-08-29 12:23:39 +00:00
paulbarker
4f95e61961 Initial version of cpp module (on multiarch branch).
svn path=/branches/multiarch/; revision=1916
2007-08-29 11:33:05 +00:00
Peter Johnson
d88cc90196 Merge [1912], [1913], [1914] into multiarch branch.
svn path=/branches/multiarch/; revision=1915
2007-08-20 05:16:33 +00:00
Peter Johnson
e510b205cb Unbitrot lc3b architecture.
Requested by: Paul Barker <paulbarker@mailsnare.net>

svn path=/trunk/yasm/; revision=1914
2007-08-20 05:13:35 +00:00
Peter Johnson
35f8e2b1fc Set value->sign appropriately instead of ineffective passing of -1 to
output_value().

svn path=/trunk/yasm/; revision=1913
2007-08-20 05:11:11 +00:00
Peter Johnson
4b142ea112 GAS parser: Push down directive lookup to parser to simplify tokenizer.
svn path=/trunk/yasm/; revision=1910
2007-08-19 23:59:08 +00:00
Peter Johnson
aea53cfd9e Add support for the following AMD instructions added in their July 2007
documentation update:
 - LZCNT
 - POPCNT
 - EXTRQ
 - INSERTQ
 - MOVNTSD
 - MOVNTSS

This required some new tricks in the x86 code, as EXTRQ and INSERTQ have
two imm8 parameters (the first one of which goes into the EA field), and
INSERTQ has a *4* parameter version (xmm1, xmm2, imm8, imm8).  Instead of
globally making the structures 4 wide, we just special-case INSERTQ.

svn path=/trunk/yasm/; revision=1909
2007-08-16 05:50:59 +00:00
Peter Johnson
36cdd57be2 Add support for second parameter (fill value) to .org directive in GAS
parser.

Add testcase for both local labels and .org fill.

Noticed by: Jung Lee <moorang@gmail.com>
Testcase from: Xiaoming Mo <xiaoming.mo@skelix.org>

svn path=/trunk/yasm/; revision=1899
2007-07-20 03:40:59 +00:00
Peter Johnson
328320cc2b Add support for GAS local labels (1:, 1f, 1b).
Noticed by: Jung Lee <moorang@gmail.com>

svn path=/trunk/yasm/; revision=1898
2007-07-20 03:28:24 +00:00
Peter Johnson
2bb74148c1 Merge expr-int.h into expr.h, removing YASM_EXPR_INTERNAL in the process.
svn path=/trunk/yasm/; revision=1895
2007-07-14 05:31:08 +00:00
Peter Johnson
a958ef6df8 Merge bc-int.h into bytecode.h, removing YASM_BC_INTERNAL in the process.
svn path=/trunk/yasm/; revision=1894
2007-07-14 04:34:41 +00:00
Peter Johnson
ab13bd719e Remove YASM_LIB_INTERNAL. It never really gained us that much in terms of
visibility savings, as basically everything defined it.

svn path=/trunk/yasm/; revision=1893
2007-07-14 03:11:32 +00:00
Peter Johnson
69fc913eec Clean up a number of obsolete autoconf-detected standard C things.
svn path=/trunk/yasm/; revision=1892
2007-07-13 20:56:28 +00:00
Peter Johnson
fb8b8b8936 Change handling of frontend (mnenomic) instructions to make it easier to
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
2007-07-08 05:31:59 +00:00
Peter Johnson
9d14c17d5e Remove errant else. This should not have had any serious effects, as
combining IP-relative and shifts is very unusual (and probably not possible).

svn path=/trunk/yasm/; revision=1883
2007-06-10 03:44:27 +00:00
Peter Johnson
01b18c53e9 Fix bin objfmt handling of cross-section RIP-relative values; also clean
up absolute value handling.

svn path=/trunk/yasm/; revision=1878
2007-06-04 01:12:37 +00:00
Peter Johnson
99a8519e63 Make sure objfmt_coff->win64 gets set to 0 in win32 mode.
svn path=/trunk/yasm/; revision=1873
2007-06-02 08:34:40 +00:00
Peter Johnson
c12eca767a Fix uninitialized variable, memory leak.
svn path=/trunk/yasm/; revision=1872
2007-06-02 08:23:29 +00:00
Peter Johnson
1a6cf7dab0 Correct CPU definitions for Prescott, Conroe, Penryn, and Nehalem.
All are 64-bit capable and thus should set CPU_Hammer; Prescott
was mistakingly also setting AMD features such as 3DNow.

svn path=/trunk/yasm/; revision=1870
2007-06-02 05:21:33 +00:00
Peter Johnson
1e604828b1 Don't try to yasm_expr_copy(NULL).
Found by: zzuf

svn path=/trunk/yasm/; revision=1867
2007-06-01 19:44:38 +00:00