Commit graph

47 commits

Author SHA1 Message Date
Peter Johnson
8178f883a5 Modify so that almost everything passes LCLint with the options in lclint.sh.
This is actually worthwhile; I found and fixed a few bugs/edge cases while
doing this.
For more information on LCLint, see <http://lclint.cs.virginia.edu/>.

svn path=/trunk/yasm/; revision=335
2001-11-17 08:33:23 +00:00
Peter Johnson
f58d7cb093 Split x86-specific stuff away from bytecode.
svn path=/trunk/yasm/; revision=316
2001-11-05 05:49:19 +00:00
Peter Johnson
a7ac50c918 Add coretype.h, make util.h do a lot more, use util.h to simplify include
sections of C files.  Also remove IdPath from top comment in files where
RCSID() is used.  Move RCSID() to immediately after util.h include.

svn path=/trunk/yasm/; revision=313
2001-11-03 05:17:51 +00:00
Peter Johnson
405df52913 bytecode_print(): Change how NULL values are output for imm and multiple.
bytecode_parser_finalize_insn(): Add some preliminary imm handling.  Handle
shift_op special-casing (,1 hack).

svn path=/trunk/yasm/; revision=312
2001-11-03 04:13:42 +00:00
Peter Johnson
4d95de5161 Plug memory leaks, and enhance finding later ones with *_delete functions.
Fix a *major* bug in expr_level_op().

svn path=/trunk/yasm/; revision=301
2001-10-29 04:52:44 +00:00
Peter Johnson
dc1c3c70f5 Get rid of all the extra filename strdup()'s. (Bug #14).
svn path=/trunk/yasm/; revision=300
2001-10-29 01:10:20 +00:00
Peter Johnson
7a6eaf8c03 Make InternalError() a bit easier to call. Also, reverse its file and line
parameters to match the *At() functions.

svn path=/trunk/yasm/; revision=299
2001-10-29 00:21:00 +00:00
Peter Johnson
6f708e3034 Add xfree() to replace calls to free().
This also fixes the build breakage caused by removing stdlib includes.

svn path=/trunk/yasm/; revision=298
2001-10-29 00:11:14 +00:00
Peter Johnson
adf5a95e89 Add option for malloc debugging using dmalloc library (http://dmalloc.com/).
Remove unnecessary stdlib includes (because we use xmalloc instead of malloc).

svn path=/trunk/yasm/; revision=297
2001-10-29 00:01:31 +00:00
Peter Johnson
e7bab50cf2 Parse NOSPLIT.
Move some work to subfunctions in expr so they can be used for both 16-bit
and 32-bit checking.

svn path=/trunk/yasm/; revision=295
2001-10-28 23:39:14 +00:00
Peter Johnson
121f93b0a0 *COMPLETELY* rewrite most of expression handling.
Features:
- More complex memory expressions like [bx-(bx-di)] are now calculated through
  as valid.
- Much better simplification.
Internal changes:
- More flexible n-way tree (rather than old binary-only).
- Many new functions to simplify and deal with very complex expressions.

svn path=/trunk/yasm/; revision=294
2001-10-28 09:22:13 +00:00
Peter Johnson
e640f25da5 Update comment on disp.len to match changes in expr.c.
svn path=/trunk/yasm/; revision=288
2001-10-18 07:02:11 +00:00
Peter Johnson
6ac7d95579 Call expr_expand_equ() on effective address from bytecode_parser_finalize().
svn path=/trunk/yasm/; revision=285
2001-10-15 07:07:55 +00:00
Peter Johnson
0be7a0d444 Add first version of post-parsing bytecode finalization. Lots of work still
to be done at the bytecode and expression level.

svn path=/trunk/yasm/; revision=283
2001-10-15 04:42:47 +00:00
Peter Johnson
053329a368 Clarify and fix some usages of valid/need flags for modrm and sib bytes.
In bytecode_print(), check for NULL ea displacement and print out modrm and
sib bytes in octal (because it's easier to read the 2/3/3 format in octal).

svn path=/trunk/yasm/; revision=277
2001-10-12 02:29:31 +00:00
Peter Johnson
84de990744 Support TIMES prefix. Split expr parsing to have a no-float and no-string
version (for times and reserve space).

svn path=/trunk/yasm/; revision=275
2001-10-11 22:55:04 +00:00
Peter Johnson
193392dcb6 Fix LOTS of little nits. Primary changes:
- New intnum module to replace using just unsigned long (for >32 bit values).
   Read values using BitVector instead of strtoul().
 - Brought both floatnum and intnum into expr (still need to integrate calc for
   floatnum).
 - Add traversal function to ternary tree (for use by symrec_foreach).
 - Change floatnum output interface from single/double/extended to byte size.
 - Try to make floatnum/intnum interfaces very similar.  Still needs work.
 - Add/fix *_print functions, including interating ones for sections/bytecodes.
 - Fix handling of $ and $$.  Both now are properly parsed and bytecode'd.
 - Print out all sections and symbol table in main() in preparation for work
   on "cleanup" functionality between parser and optimizer stages (really part
   of the parser stage).

svn path=/trunk/yasm/; revision=270
2001-10-11 05:34:50 +00:00
Peter Johnson
217b33802c Make data.insn.imm within bytecode a pointer. This prevents leakage in calls to
bytecode_new_insn().

svn path=/trunk/yasm/; revision=266
2001-10-04 06:01:44 +00:00
Peter Johnson
48a36cdf22 Make most data structures opaque, keeping internals truly internal and making the
overall structure much more modular.
The test files, which need access to the internals of the structures being
tested, now include the source file instead of the header file to gain access
to all internal formats and functions.

svn path=/trunk/yasm/; revision=261
2001-10-03 20:42:17 +00:00
Peter Johnson
b13f4e4f87 malloc->xmalloc, strdup->xstrdup, and calloc->xcalloc. The x* family performs
error checking.  Remove check for strdup() from configure, as we don't need it.

svn path=/trunk/yasm/; revision=253
2001-10-03 02:27:41 +00:00
Peter Johnson
98e25fc1f6 Add some (optional through configure) additional warning flags. Add options
to configure to enable profiling and enable -Werror.  Make changes to ensure
everything builds with all additional warnings and -Werror enabled.  Most of
these changes consist of adding "const" modifiers for functions that get
constant literal strings.

svn path=/trunk/yasm/; revision=252
2001-10-03 01:44:47 +00:00
Peter Johnson
1abd74ba04 Fix large parts of expression and symbol handling. Actually link in labels
properly (bug #8).  Framework added for portable floating point support (bug
#7).  Lots of functions still not finished in this commit.

svn path=/trunk/yasm/; revision=229
2001-09-26 00:57:55 +00:00
Peter Johnson
60fd596a66 Cleaned up bytecode data structure, some effaddr functions. Made ea an
effaddr * instead of an effaddr to decrease size of bytecode.  Changed parser
to use effaddr * as well.  Finally fixed issue with ONE by adding flag to
bytecode.data.insn and utilizing spare bytes of the opcode.  Hackish, but
works.

svn path=/trunk/yasm/; revision=203
2001-09-20 03:21:26 +00:00
Peter Johnson
1fd753346c Build section linked list, and support the section directive, including
asking the objfmt module.  Add some utility functions for both bytecode
and section to better modularize their data structure usage and common
code.  Rename doparse to do_parse to be consistent in naming.

svn path=/trunk/yasm/; revision=196
2001-09-19 07:20:02 +00:00
Peter Johnson
b2890b8f9d $Id$ -> $IdPath$.
svn path=/trunk/yasm/; revision=174
2001-09-17 04:12:20 +00:00
Peter Johnson
695ab62056 Whoa, oops! Bad bug in bytecode_new_common (wasn't returning allocated bc).
svn path=/trunk/yasm/; revision=166
2001-09-16 20:17:23 +00:00
Peter Johnson
3c2a67ca1c Use bytecode * instead of bytecode in parser.
Rename and restructure bytecode functions to make this use clearer.

svn path=/trunk/yasm/; revision=164
2001-09-16 19:44:49 +00:00
Peter Johnson
45df22d110 Convert to using gettext instead of the ugly errwarn constant strings.
NOTE: gettextize now needs to be run before building.

svn path=/trunk/yasm/; revision=153
2001-08-30 03:45:26 +00:00
Peter Johnson
86f7268ea8 Add RCSID().
svn path=/trunk/yasm/; revision=151
2001-08-19 07:46:52 +00:00
Peter Johnson
77fc6dd491 Standardize order of include statements as well as autoconf'ing those source
files that weren't yet.

svn path=/trunk/yasm/; revision=150
2001-08-19 07:33:47 +00:00
Peter Johnson
ae600ce442 Use STAILQ's for datavals and bytecodes.
svn path=/trunk/yasm/; revision=146
2001-08-19 05:41:01 +00:00
Peter Johnson
edf74fe9ea Run through GNU indent using indent profile. Manually fix some changes
(particularly functions such as BuildBC_Insn() which have large numbers
of arguments).

svn path=/trunk/yasm/; revision=141
2001-08-19 03:52:58 +00:00
Peter Johnson
50cd4f238f Add global filename variable and handling for a filename passed on the
command line (no real command-line parsing yet).

svn path=/trunk/yasm/; revision=130
2001-08-18 22:15:12 +00:00
Peter Johnson
1fa31332b6 Add lexing, parsing, and internal format for strings and character constants.
Completely handle data declarations (db/dw/etc) and reserve space declarations
(resb/resw/etc).

svn path=/trunk/yasm/; revision=129
2001-07-25 00:33:10 +00:00
Peter Johnson
bb595a8f02 Formatting changes and starting to comment more heavily.
svn path=/trunk/yasm/; revision=128
2001-07-11 23:16:50 +00:00
Peter Johnson
fa5c9d5ea9 First attempt at supporting relative jump instructions. A few hacks, but
seems to work well.
A few other minor fixes/changes as well (noticed when coding).

svn path=/trunk/yasm/; revision=119
2001-07-11 04:07:11 +00:00
Michael Urman
c4d985f1ad Integrate expression handling into memory address expressions.
Consequently change Imm->EA, and update DebugPrintBC (fix segvs too)

svn path=/trunk/yasm/; revision=117
2001-07-06 06:25:53 +00:00
Michael Urman
0cb10aa577 Fixed the non-ansi attempts to pass a union member casted as the union
type.

svn path=/trunk/yasm/; revision=113
2001-07-05 09:32:58 +00:00
Michael Urman
84bae30656 Long hairy integration of expression handling into the grammar.
Added printing, getvalue functionality to expr.[ch]
Changed immval to house an expr* instead of an unsigned long.

gen_instr.pl needs to be updated for ONE cases to fix pointer compares.
bison s/r conflicts still need to be handled.

svn path=/trunk/yasm/; revision=109
2001-07-05 08:37:59 +00:00
Peter Johnson
4807c5b69b Reorganize (yet again) effective address, immediate value, and instruction
structures.
Add more interface functions to isolate structure internals and make it
easier to add warnings (such as for multiple overrides/prefixes).

svn path=/trunk/yasm/; revision=43
2001-05-30 07:41:03 +00:00
Peter Johnson
e75125dae3 Moved from 2-byte to 3-byte opcodes.
svn path=/trunk/yasm/; revision=39
2001-05-30 07:07:16 +00:00
Peter Johnson
8d656576e2 Added SetEASegment and SetEAAddressSize (not yet implemented).
svn path=/trunk/yasm/; revision=36
2001-05-22 20:46:13 +00:00
Peter Johnson
8b5a407ef2 Need to zero need_modrm in BuildBC_Insn() if no EA.
svn path=/trunk/yasm/; revision=24
2001-05-21 21:04:54 +00:00
Peter Johnson
e9bd95fd96 Added conversion from immediate value to effective address. Used for enter
instruction (which takes two immediate values).
To facilitate this change, changed meaning of "len" in bytecode structure
to be only the length of the offset (from being 1+length, the 1 being for the
Mod/RM byte), and added a need_modrm flag similar to the need_sib flag in
functionality.

svn path=/trunk/yasm/; revision=22
2001-05-21 20:17:51 +00:00
Michael Urman
3e9f321b66 Reformatted BuildBC_Insn's argument list to aligned one arg per line.
svn path=/trunk/yasm/; revision=20
2001-05-21 19:32:51 +00:00
Peter Johnson
2ddc3208dc Merge immediate and relative structures.
svn path=/trunk/yasm/; revision=11
2001-05-18 21:42:32 +00:00
Peter Johnson
d3a51f5835 Initial check-in.
svn path=/trunk/yasm/; revision=7
2001-05-15 05:28:44 +00:00