Commit Graph

2646 Commits

Author SHA1 Message Date
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
Cyrill Gorcunov
8b5c9fba4e BR3392240: preproc: Don't fail on pasting of space expanded rvalue tokens
Reported-by: KO Myung-Hun <komh@chollian.net>
Tested-by: KO Myung-Hun <komh@chollian.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-04 10:18:21 +04:00
Cyrill Gorcunov
7c88b3a9d7 NASM 2.10.07 2013-01-02 12:42:01 +04:00
Cyrill Gorcunov
6cdebb463f docs: Update changes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-12-27 20:28:02 +04:00
Cyrill Gorcunov
490f85e73d br3392236: Don't treat \Space after \BackSlash as a sign for line continuation
In commit f1fe4fdeab I occasionally
made a \Space after \BackSlash being a sign of line continuation.

Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-12-27 20:04:28 +04:00
H. Peter Anvin
74ebbde14c NASM 2.10.06 2012-12-04 13:38:36 -08:00
H. Peter Anvin
f2ded5051d changes: document fix of macho64
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2012-12-04 13:36:42 -08:00
Keith Kanios
0863bc386b BR3392232: Fix relocations in MachO64
Signed-off-by: Keith Kanios <keith@kanios.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-11-28 20:05:20 +04:00
Cyrill Gorcunov
5fa17e8398 output: Add more Elf unification
One day the elf output routines would be abstracted
enough to be merged in one file. This patch simply
removes some differences from elf32/64 code.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-11-16 22:57:07 +04:00
Cyrill Gorcunov
7ce86b500c BR3392231: Fix get_closest_section_symbol_by_offset
This patch changes get_closest_section_symbol_by_offset
logic to lookup only the closest symbols which are at
or before the supplied offset.

Signed-off-by: Keith Kanios <keith@kanios.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-11-06 00:47:20 +04:00
Cyrill Gorcunov
f1fe4fdeab BR3392226 preproc: Rework line readin procedure
It's been reported that we handle MacOS eol wrong.
This patch fixes the problem.

http://bugzilla.nasm.us/show_bug.cgi?id=3392226

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-10-27 20:56:59 +04:00