summaryrefslogtreecommitdiff
path: root/libyasm/bc-reserve.c
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2008-10-07 05:38:11 +0000
committerPeter Johnson <peter@tortall.net>2008-10-07 05:38:11 +0000
commit1e77ce6c40f369c01672c915ed4afd57eb2a6283 (patch)
tree157edcc816900069c22d59ae81002d641fe27b94 /libyasm/bc-reserve.c
parent63e1873a8ea01edfd49af750c2c4480c34bca2e1 (diff)
downloadyasm-1e77ce6c40f369c01672c915ed4afd57eb2a6283.tar.gz
Add core TASM syntax support.
Contributed by: Samuel Thibault <samuel.thibault@ens-lyon.org> It is built on top of the NASM parser and preproc, with the following notable extensions for TASM syntax: - case insensitive symbols and filenames, - support for segment and size of labels, which permits to avoid giving them on each memory dereference, - support for data reservation (i.e. e.g. "var dd ?"), - support for multiples (i.e. e.g. "var dd 1 dup 10"), - little endian string integer constants, - additional expression operators: shl, shr, and, or, low, high, - additional offset keyword, - additional fword and df, - support for doubled quotes within quotes, - support for array-like and structure-like notations: t[eax] and [var].field, - support for tasm directives: macro, rept, irp, locals, proc, struc, segment, assume. Notes: - Almost all extensions are only effective when tasm_compatible_mode is set, so we should have very reduced possible breakage. - Because the "and" keyword can be an expression operator and an instruction name, the data pseudo-instructions explicitly switch the lexer state to INSTRUCTION state to fix the ambiguity. - In gen_x86_insn.py, several instructions (namely lds and lea) now take relaxed memory sizes. The reason is that in the case of tasm, the size of the actual pointed data is passed up to there, and thus any type of data should be accepted. With all of this, loadlin can be compiled by yasm with quite reduced modifications. A new TASM-like frontend is also included. svn path=/trunk/yasm/; revision=2130
Diffstat (limited to 'libyasm/bc-reserve.c')
-rw-r--r--libyasm/bc-reserve.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libyasm/bc-reserve.c b/libyasm/bc-reserve.c
index 32f524f9..5cfd38a0 100644
--- a/libyasm/bc-reserve.c
+++ b/libyasm/bc-reserve.c
@@ -46,6 +46,7 @@ typedef struct bytecode_reserve {
static void bc_reserve_destroy(void *contents);
static void bc_reserve_print(const void *contents, FILE *f, int indent_level);
static void bc_reserve_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc);
+static int bc_reserve_elem_size(yasm_bytecode *bc);
static int bc_reserve_calc_len(yasm_bytecode *bc,
yasm_bc_add_span_func add_span,
void *add_span_data);
@@ -57,6 +58,7 @@ static const yasm_bytecode_callback bc_reserve_callback = {
bc_reserve_destroy,
bc_reserve_print,
bc_reserve_finalize,
+ bc_reserve_elem_size,
bc_reserve_calc_len,
yasm_bc_expand_common,
bc_reserve_tobytes,
@@ -96,6 +98,13 @@ bc_reserve_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc)
}
static int
+bc_reserve_elem_size(yasm_bytecode *bc)
+{
+ bytecode_reserve *reserve = (bytecode_reserve *)bc->contents;
+ return reserve->itemsize;
+}
+
+static int
bc_reserve_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span,
void *add_span_data)
{