Commit Graph

1928 Commits

Author SHA1 Message Date
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
Cyrill Gorcunov
acf256f4db nasmlib.h: Introduce nasm_build_assert
It's useful to protect our self from some
errors at build time.

For this sake we should use nasm_build_assert
if needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-05 23:35:04 +03:00
H. Peter Anvin
638c1ac078 test: imul.asm: move warning-generated tests under WARN
Only make the tests under WARN actually issue warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 16:35:19 -08:00
H. Peter Anvin
623fedfa59 test: imul.asm: more IMUL pattern tests
Test more IMUL patterns.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 15:59:47 -08:00
H. Peter Anvin
fc89fe80d7 NASM 2.08rc2 2009-11-03 15:59:24 -08:00
Cyrill Gorcunov
bc31bee760 matches: simplify check operand size actions
We may throw out j variable (since we break anyway)
and don't assign asize for free (since we don't
use it after).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-03 21:37:09 +03:00
Cyrill Gorcunov
b640a917cd IMUL: sbyteX fix -- last one
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-03 21:35:24 +03:00
H. Peter Anvin
b0a6230a80 IMUL: fix an additional incorrect sbyte use
One more incorrect use of sbyte in IMUL.

Overall, the IMUL patterns seem really messy.  *Furthermore*, despite
IMUL normally being thought of as signed, the 2- and 3-operand
versions don't produce a high half and are therefore
signedness-agnostic -- we could even add MUL patterns for those forms.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 09:34:09 -08:00
H. Peter Anvin
110e5ecec4 BR 2887108: fix incorrect sbyte usage in IMUL
Fix a very curious transposition in the instruction patterns for IMUL,
which caused 32-bit IMUL instructions with constants like 0x10001 to
be generated incorrectly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 09:26:58 -08:00
Cyrill Gorcunov
210c10110b Revert "BR 2887108: Use overflow_ helper to catch inappropriate imm optimization"
This reverts commit 41208028ff.
|
| From: "H. Peter Anvin" <hpa@zytor.com>
|
| The tests for overflow_signed() are wrong too.  Those are relevant for if a
| warning should be issued, but not for how the value should be encoded in
| the byte stream.
|

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2009-11-01 10:24:48 +03:00
Cyrill Gorcunov
beaef4a2ea stdscan.c: use TOKEN_EOS and string helpers
Also tab/space cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:05:50 +03:00
Cyrill Gorcunov
cfbcddf1a5 Various tab/space/comment cleanup
No change on binary level

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:05:32 +03:00
Cyrill Gorcunov
a353955a8d output/outelf32-64: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:03:29 +03:00
Cyrill Gorcunov
54e94a56e2 Remove outdated comments
From Frank Kotler:
| ...
| > -                stdscan_bufptr = saveme;        /* bugfix? fbk 8/10/00 */
| > +                stdscan_set(saveme);            /* bugfix? fbk 8/10/00 */
|
| While you're at it, you could remove my comment(s - it seems to have
| reproduced). It *is* a bugfix (apparently). "saveme" might have a better
| name, too...

So get rid of the comments.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:03:14 +03:00
Cyrill Gorcunov
917117ff69 stdscan: switch to stdscan_get/set routines
Instead of manipulating stdscan buffer pointer directly
we switch to a routine interface.

This allow us to unify stdscan access: ie caller should
"talk" to stdscan via stdscan_get/set routines.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:02:43 +03:00
Cyrill Gorcunov
bafd877d48 nasmlib: Introduce idata_bytes helper
This allow us to eliminate code duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:02:14 +03:00
Cyrill Gorcunov
41208028ff BR 2887108: Use overflow_ helper to catch inappropriate imm optimization
We should use overflow_ helpers before check if an immediate
operand fit a type range, otherwise we may loose high bits.

For example when we assemble the following instruction

	imul eax,eax,0x10000

with -Ox passed we optimze it up to imm8 though it must be imm32.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 10:35:11 +03:00
Keith Kanios
4ea846623a changes.src: document preprocessor directives added since 2.07
nasmdoc.src: document %exitmacro
2009-10-25 14:06:24 -05:00
Keith Kanios
3c0d91f3d5 preproc.c: fix exitmacro to account for if/endif blocks 2009-10-25 13:28:03 -05:00
Cyrill Gorcunov
e4f526be5c continue using is_class helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-18 12:41:14 +04:00
Cyrill Gorcunov
66ba8cdba1 changes.src: describe changes since version 2.07 up to 2.08rc1
There are already new commits which fix other bugs
but at moment only changes up to 2.08rc1.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-18 01:09:40 +04:00
Keith Kanios
d2a553c072 BR 2840300: fix macho symbol alignment bug 2009-10-16 21:53:59 -05:00
Cyrill Gorcunov
c2509508b5 parser.c: pasrse_line -- fix alignment
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-14 19:39:22 +04:00
H. Peter Anvin
a7643f4c04 assemble: xsizeflags[] is an opflags_t variable
One more case of int32_t instead of opflags_t...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-13 12:32:20 -07:00
H. Peter Anvin
f8563f7a98 opflags: more int32_t -> opflags_t conversions
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>
2009-10-13 12:29:01 -07:00
H. Peter Anvin
970b1012ee NASM 2.08rc1 2009-10-13 12:05:01 -07:00
H. Peter Anvin
ff800417a1 nasm: rename nasm_zap_spaces() to nasm_zap_spaces_fwd()
By analogy with nasm_zap_spaces_rev() have nasm_zap_spaces_fwd().  The
forward version isn't a super-common operation, and it might be
possible to think the reverse one is the "normal" version... therefore
we might as well be explicit.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-13 12:03:37 -07:00
Cyrill Gorcunov
d61debfc91 nasm.c: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:14 +04:00
Cyrill Gorcunov
f66ac7deb0 preproc.c: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:10 +04:00
Cyrill Gorcunov
bd416c6860 nasm.c: getkw -- use string helpers
This allow us to shrink code a bit and
make it easy to read.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:05 +04:00
Cyrill Gorcunov
c7e8f1bf6f nasmlib: introduce string helpers
To make code more compact we introduce the
following string helpers:

1) nasm_scip_spaces - skip leading spaces
2) nasm_skip_word - skip leading non-spaces
3) nasm_zap_spaces - zap leading spaces with zero
4) nasm_zap_spaces_rev - zap spaces in reverse order

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:01 +04:00
Cyrill Gorcunov
9ccabd2922 assemble.c: check constants for overflow
Lets check if a constant supplied to DB and etc
does not overflow storage size and emit warning
if needed.

[ Bug #2857628 http://sourceforge.net/tracker/?func=detail&aid=2857628&group_id=6208&atid=106208 ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:57 +04:00
Cyrill Gorcunov
4b67cc371e introduce "overflow" helpers
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:53 +04:00
Cyrill Gorcunov
8a6345ca47 assemble.c: use is_class helper
is_class does not checking flags "strictly". Which means
it may fail if type is specified to REGMEM and you check for
is_class(MEMORY, ...).

Anyway in current patch we check for REGISTER which doesn't
overlap and it is safe to use is_class here.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:49 +04:00
Cyrill Gorcunov
1985416b0b nasm.h: introduce is_class macro helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:45 +04:00
Cyrill Gorcunov
1f75420d61 use opflags_t type for operands
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:41 +04:00
Cyrill Gorcunov
1598a23ba3 style cleanup
Convert tabs to spaces.
Eliminate empty comments.

No change on binary level.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:37 +04:00
H. Peter Anvin
8d2c4edd22 assemble: when looking for a REGISTER operand, do an exclusive test
Do an "exclusive" test for a REGISTER operand when deciding to treat
sizes as wildcards.  "Exclusive" meaning don't just accept any class
that could be REGISTER, but something that is strictly a part of the
REGISTER class.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-06 09:58:40 -07:00
H. Peter Anvin
ff5d656929 assemble: treat register operands without size as wildcards
Register with no size are a bit special: we don't honor extrinsic
register sizes in the first place ("oword xmm1" gives a warning,
even), and they should match any xmmrm size.  As such, explicitly
handle sizeless register operands as a hard match, instead of relying
on the fuzzy-matching mechanism to handle them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-05 14:08:05 -07:00
Cyrill Gorcunov
8186a0061a nasm.nsi: use "delete recursively" specificator
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-27 16:00:06 +04:00
Cyrill Gorcunov
54c8ccb443 nsis.nsi: add VS8 rules file to install
Add "VS8 intergartion" section with appropriate
files to be installed on user request.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-26 11:21:20 +04:00
Cyrill Gorcunov
946debb627 doc/nasmdoc.src: NASMENV -- fixup backslashes
−i option (include file search directories) should
contain trailing slash.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-26 01:06:18 +04:00
Henry Tumblin
ac9aaeeff0 Visual Studio 2008 NASM integration
Add integration rules in order to use NASM
seamlessly in your VS2k8.

Signed-off-by: Henry Tumblin <htumblin@users.sourceforge.net>
Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-25 20:49:51 +04:00
Cyrill Gorcunov
81d07c127d nasm.nsi: fixup shortcut target on nasm manual
There is no "manual.pdf" but "nasmdoc.pdf" instead.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 23:33:11 +04:00
Cyrill Gorcunov
0c1bd06a6c nasm.nsi: fixup output name
Sigh... It should be PACKAGE_SHORT_NAME
rather then PRODUCT_SHORT_NAME.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 21:29:57 +04:00
Cyrill Gorcunov
587f10ec47 nasm.nsi: set compressor before MUI macros
MULTIUSER_MUI may set own compressor so we
need to set it earlies to success.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 21:14:32 +04:00