Commit graph

2656 commits

Author SHA1 Message Date
Cyrill Gorcunov
f0301980ab Make .git-ignore directory to ignore by scm
To stash various code which a developer not
need to be tracked.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-10 13:27:02 +04:00
Cyrill Gorcunov
579f161d48 Add IF_TBM flag
For TMB instructions

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-10 13:24:15 +04:00
Cyrill Gorcunov
ce6527459f BR3392253: Fix potential buffer overflow in number conversion
Reported-by: franck.uberto@esrf.fr
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-06 23:43:43 +04:00
Cyrill Gorcunov
1ac3459539 insns.dat: Udate year
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-04 02:24:38 +04:00
Cyrill Gorcunov
e3574117ed br3392250: insns -- Allow byte size in PREFETCHTx instructions
The PREFETCHTx instructions do allow mem8 (byte).

Reported-by: Agner <agner@agner.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-04 02:24:05 +04:00
Cyrill Gorcunov
f470011751 BR3392244: docs -- Fix "respectively" typo
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-28 15:07:38 +04:00
Cyrill Gorcunov
deb082d633 BR3392248: Update nasm -h output
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:37:17 +04:00
Cyrill Gorcunov
895139cbd5 BR3392248: Update nasm manual
Add -W description

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:24:01 +04:00
Cyrill Gorcunov
567cc681a4 ndisasm: man -- Add missing -p option
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:18:46 +04:00
Cyrill Gorcunov
24543963b4 BR3392248: Update ndisasm man
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:14:45 +04:00
Cyrill Gorcunov
4de8f4efb7 BR3392248: Update ndisasm man
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:13:51 +04:00
Cyrill Gorcunov
9563d09da6 BR3392248: Update nasm manual
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:10:15 +04:00
Philipp Kloke
c7b53ffe1f Fixed two more resource leaks in rdoff/rdlib.c
Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:17:46 +04:00
Philipp Kloke
efe66c65d1 Fixed three possible buffer overflows
Bug found by: CppCheck 1.59 (static source analysis tool)

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:16:58 +04:00
Philipp Kloke
dae212d049 Fixed several resource and memory leaks
Bug found by: CppCheck 1.59 (static source analysis tool)

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:16:27 +04:00
Philipp Kloke
b432f57741 Fixed wrong/redundant comparison according to documentation in comment above.
Bug found by: CppCheck 1.59 (static source analysis tool)

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:13:41 +04:00
Philipp Kloke
91a2f99346 Fixed wrong format specifier in format string
Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:11:51 +04:00
Philipp Kloke
c51a224ceb Remove unnecessary calls to memset
The C standard guarantees that strncpy pads
the string with zeros if source string is smaller
than destination buffer.

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:11:01 +04:00
Ben Rudiak-Gould
94ba02fa16 Make F2 and F3 SSE prefixes override 66
According to XED and experimentation, the 66 is ignored.

Signed-off-by: Ben Rudiak-Gould <benrudiak@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-10 21:46:12 +04:00
Ben Rudiak-Gould
6e87893f06 Drop SAME_AS flag from instruction matcher
It was there to support the SSE5 DREX encoding,
which as far as I know is dead forever.

Signed-off-by: Ben Rudiak-Gould <benrudiak@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-04 00:46:16 +04:00
Ben Rudiak-Gould
d1ac29a3cc insns: Remove pushseg/popseg internal bytecodes
This patch is getting rid of the following bytecodes
'pushseg','popseg','pushseg2','popseg2' and simplifies
overall code.

[gorcunov@: a few style fixes]
Signed-off-by: Ben Rudiak-Gould <benrudiak@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-03 20:50:46 +04:00
Cyrill Gorcunov
83e6924e1a Move conditional opcodes close to enum ccode definition
Thus if someone need to rework this code he won't need
to jump between files trying to figure out where enum
and opcodes lay.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-03 14:34:31 +04:00
Cyrill Gorcunov
bfb581c8e0 insns.pl: Various style polyshing
- convert tabs to spaces
 - align octal opcodes

No func changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-02 02:59:29 +04:00
Cyrill Gorcunov
982387606b assemble: Make emit_rex being a function
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-02 02:59:29 +04:00
Cyrill Gorcunov
59df421af3 assemble: Use case3/4 where appropriate
This allows to shrink code a bit.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-02 02:59:21 +04:00
Cyrill Gorcunov
62576a016d assemble: Add case3 helper
Signed-off-by: cyrill <cyrill@cyrills-MacBook-Pro.local>
2013-03-02 02:46:17 +04:00
Cyrill Gorcunov
c7ce6a4f22 process_ea: Drop redundant variable
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-02 02:45:53 +04:00
Ben Rudiak-Gould
4e8396b5cf Remove +s
It doesn't seem worth >200 lines of C and Perl to save ~50 lines in insns.dat.

In order to make this work I had to rename sbyte16/sbyte32 so that
they can take an ordinary size suffix (their size suffix was formerly
treated specially).

This fixes one disassembly bug: 48C7C000000080 disassembles to mov
rax,0x80000000, which reassembles to B800000080, which loads a
different value.

Signed-off-by: Ben Rudiak-Gould <benrudiak@gmail.com>
Acked-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-03-01 10:28:32 +04:00
Andrew Nayenko
57162eb084 Fix warnings generated by clang 3.0
Fix warnings like this:

output/outelf32.c:2120:33: warning: equality comparison with extraneous
      parentheses [-Wparentheses-equality]
            if ((match->section == index)) {
                 ~~~~~~~~~~~~~~~^~~~~~~~
output/outelf32.c:2120:33: note: remove extraneous parentheses around the
      comparison to silence this warning
            if ((match->section == index)) {
                ~               ^       ~
output/outelf32.c:2120:33: note: use '=' to turn this equality comparison into
      an assignment
            if ((match->section == index)) {
                                ^~
                                =
1 warning generated.

Signed-off-by: Andrew Nayenko <resver@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-25 01:08:00 +04:00
Andrew Nayenko
842512c527 BR3392242: insns.dat -- Support AMD SVM instructions in 32bit mode
AMD CPUs do support SVM instructions in 32-bit mode thus drop X64
restriction from instructions template where appropriate.

Signed-off-by: Andrew Nayenko <resver@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-21 02:36:57 +04:00
Ben Rudiak-Gould
bf0f42390d Fix jmp/call near offsets in long mode
In long mode relative offsets are always 32 bits sign-extended to 64
bits and absolute near addresses are always 64 bits, regardless of the
operand size.

Signed-off-by: Ben Rudiak-Gould <benrudiak@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-20 23:25:59 +04:00
Ben Rudiak-Gould
d7ab1f9638 Add np and similar prefixes to instructions that should have them
This adds "np" to a bunch of SSE-style instructions that should have
it, "norep" (which was implemented but unused) on quasi-SSE instructions
that use F2 and F3 as instruction extensions but 66 for operand size,
"nof3" (newly implemented) on a few instructions, "norexw" on some
instructions that have only 32-bit and 64-bit versions, and one NOLONG.

It also removes some incorrect "np"s, changes some "f3"s to "f3i"s,
and fixes the decoding of the XCHG/NOP/PAUSE mess: F390 is always
PAUSE even when rex.b=1 (at least according to XED).

Signed-off-by: Ben Rudiak-Gould <benrudiak@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-20 23:25:54 +04:00
Cyrill Gorcunov
71ba1f0e7b eval: Use is_power2 helper instead of open code
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-18 01:38:11 +04:00
Cyrill Gorcunov
1930007f3f make: Don't forget to generate manpage for all target
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-18 01:31:59 +04:00
Cyrill Gorcunov
1a63699ce5 man: Generate manpages from asciidoc format
The asciidoc format is a way more easier to read
by a human.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-17 22:50:19 +04:00
Cyrill Gorcunov
a709e767f6 Update .gitignore
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-17 22:47:28 +04:00
Cyrill Gorcunov
190232f013 nasm.c: Convert GET_CURR_OFFS/SET_CURR_OFFS to functions
In future better to not work with global variables but
rather pass arguments.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:35:04 +04:00
Cyrill Gorcunov
f187eb7788 nasm.c: Update year in header
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:25:33 +04:00
Cyrill Gorcunov
52405e3727 nasm.c: Tabs to spaces in emit_dependencies
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:25:04 +04:00
Cyrill Gorcunov
9f56369883 nasm.c: Tabs to spaces in main
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:24:11 +04:00
Cyrill Gorcunov
45aa118fdf nasm.c: Tabs to spaces in copy_filename
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:22:59 +04:00
Cyrill Gorcunov
f831645ed8 nasm.c: Tabs to spaces in copy_filename
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:22:27 +04:00
Cyrill Gorcunov
331fd7c8aa nasm.c: Tabs to spaces in process_arg
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:20:58 +04:00
Cyrill Gorcunov
f196451d66 nasm.c: Tabs to spaces in process_response_file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:14:06 +04:00
Cyrill Gorcunov
1476319ced nasm.c: Tabs to spaces in assemble_file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:13:09 +04:00
Cyrill Gorcunov
04dba65098 nasm.c: Tabs to spaces in nasm_verror_gnu
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:21:07 +04:00
Cyrill Gorcunov
22ad904341 nasm.c: Tabs to spaces in nasm_verror_common
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:20:26 +04:00
Cyrill Gorcunov
cdaae1a8e3 nasm.c: Tabs to spaces in define_macros_early
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:16:58 +04:00
Cyrill Gorcunov
d59b2602b3 Drop trailing space from directive.pl
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:09:16 +04:00
Cyrill Gorcunov
3539225609 Align enum prefixes members
It's a way easier to read.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:06:24 +04:00