summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2013-10-02 18:25:19 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2013-10-02 18:28:49 -0700
commit9d5461069d80d0201efb1e98d31a29fdc0fcfbce (patch)
tree011fbf0a026325d6657c72cb06c9d4993dc01c18
parenta9ecfa5ae8ef8c770955c6aaf23a49f92ef576b5 (diff)
downloadnasm-9d5461069d80d0201efb1e98d31a29fdc0fcfbce.tar.gz
Add support for DZ and RESZ, document the ZWORD keyword
Add the DZ and RESZ pseudoinstructions and add ZWORD to the documentation. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--doc/nasmdoc.src50
-rw-r--r--insns.dat2
-rw-r--r--nasmlib.c4
-rw-r--r--parser.c13
4 files changed, 40 insertions, 29 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index 8386eacd..bfd75930 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -1,6 +1,6 @@
\# --------------------------------------------------------------------------
\#
-\# Copyright 1996-2012 The NASM Authors - All Rights Reserved
+\# Copyright 1996-2013 The NASM Authors - All Rights Reserved
\# See the file AUTHORS included with the NASM distribution for
\# the specific copyright holders.
\#
@@ -1264,18 +1264,18 @@ indicate what size of \i{memory operand} it refers to.
Pseudo-instructions are things which, though not real x86 machine
instructions, are used in the instruction field anyway because that's
the most convenient place to put them. The current pseudo-instructions
-are \i\c{DB}, \i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, \i\c{DO} and
-\i\c{DY}; their \i{uninitialized} counterparts \i\c{RESB}, \i\c{RESW},
-\i\c{RESD}, \i\c{RESQ}, \i\c{REST}, \i\c{RESO} and \i\c{RESY}; the
-\i\c{INCBIN} command, the \i\c{EQU} command, and the \i\c{TIMES}
-prefix.
+are \i\c{DB}, \i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, \i\c{DO},
+\i\c{DY} and \i\c\{DZ}; their \i{uninitialized} counterparts
+\i\c{RESB}, \i\c{RESW}, \i\c{RESD}, \i\c{RESQ}, \i\c{REST},
+\i\c{RESO}, \i\c{RESY} and \i\c\{RESZ}; the \i\c{INCBIN} command, the
+\i\c{EQU} command, and the \i\c{TIMES} prefix.
\S{db} \c{DB} and Friends: Declaring Initialized Data
-\i\c{DB}, \i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, \i\c{DO} and
-\i\c{DY} are used, much as in MASM, to declare initialized data in the
-output file. They can be invoked in a wide range of ways:
+\i\c{DB}, \i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, \i\c{DO}, \i\c{DY}
+and \i\c{DZ} are used, much as in MASM, to declare initialized data in
+the output file. They can be invoked in a wide range of ways:
\I{floating-point}\I{character constant}\I{string constant}
\c db 0x55 ; just the byte 0x55
@@ -1292,20 +1292,21 @@ output file. They can be invoked in a wide range of ways:
\c dq 1.234567e20 ; double-precision float
\c dt 1.234567e20 ; extended-precision float
-\c{DT}, \c{DO} and \c{DY} do not accept \i{numeric constants} as operands.
+\c{DT}, \c{DO}, \c{DY} and \c{DZ} do not accept \i{numeric constants}
+as operands.
\S{resb} \c{RESB} and Friends: Declaring \i{Uninitialized} Data
-\i\c{RESB}, \i\c{RESW}, \i\c{RESD}, \i\c{RESQ}, \i\c{REST}, \i\c{RESO}
-and \i\c{RESY} are designed to be used in the BSS section of a module:
-they declare \e{uninitialized} storage space. Each takes a single
-operand, which is the number of bytes, words, doublewords or whatever
-to reserve. As stated in \k{qsother}, NASM does not support the
-MASM/TASM syntax of reserving uninitialized space by writing
-\I\c{?}\c{DW ?} or similar things: this is what it does instead. The
-operand to a \c{RESB}-type pseudo-instruction is a \i\e{critical
-expression}: see \k{crit}.
+\i\c{RESB}, \i\c{RESW}, \i\c{RESD}, \i\c{RESQ}, \i\c{REST},
+\i\c{RESO}, \i\c{RESY} and \i\c\{RESZ} are designed to be used in the
+BSS section of a module: they declare \e{uninitialized} storage
+space. Each takes a single operand, which is the number of bytes,
+words, doublewords or whatever to reserve. As stated in \k{qsother},
+NASM does not support the MASM/TASM syntax of reserving uninitialized
+space by writing \I\c{?}\c{DW ?} or similar things: this is what it
+does instead. The operand to a \c{RESB}-type pseudo-instruction is a
+\i\e{critical expression}: see \k{crit}.
For example:
@@ -1313,6 +1314,7 @@ For example:
\c wordvar: resw 1 ; reserve a word
\c realarray resq 10 ; array of ten reals
\c ymmval: resy 1 ; one YMM register
+\c zmmvals: resz 32 ; 32 ZMM registers
\S{incbin} \i\c{INCBIN}: Including External \i{Binary Files}
@@ -1866,11 +1868,11 @@ invent one using the macro processor.
When assembling with the optimizer set to level 2 or higher (see
\k{opt-O}), NASM will use size specifiers (\c{BYTE}, \c{WORD},
-\c{DWORD}, \c{QWORD}, \c{TWORD}, \c{OWORD} or \c{YWORD}), but will
-give them the smallest possible size. The keyword \c{STRICT} can be
-used to inhibit optimization and force a particular operand to be
-emitted in the specified size. For example, with the optimizer on, and
-in \c{BITS 16} mode,
+\c{DWORD}, \c{QWORD}, \c{TWORD}, \c{OWORD}, \c{YWORD} or \c{ZWORD}),
+but will give them the smallest possible size. The keyword \c{STRICT}
+can be used to inhibit optimization and force a particular operand to
+be emitted in the specified size. For example, with the optimizer on,
+and in \c{BITS 16} mode,
\c push dword 33
diff --git a/insns.dat b/insns.dat
index 2439a9df..52aeff56 100644
--- a/insns.dat
+++ b/insns.dat
@@ -55,6 +55,7 @@ DQ ignore ignore ignore
DT ignore ignore ignore
DO ignore ignore ignore
DY ignore ignore ignore
+DZ ignore ignore ignore
RESB imm [ resb] 8086
RESW ignore ignore ignore
RESD ignore ignore ignore
@@ -62,6 +63,7 @@ RESQ ignore ignore ignore
REST ignore ignore ignore
RESO ignore ignore ignore
RESY ignore ignore ignore
+RESZ ignore ignore ignore
;# Conventional instructions
AAA void [ 37] 8086,NOLONG
diff --git a/nasmlib.c b/nasmlib.c
index 2367ff3d..e145a765 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2012 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2013 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -790,6 +790,8 @@ int idata_bytes(int opcode)
return 16;
case I_DY:
return 32;
+ case I_DZ:
+ return 64;
case I_none:
return -1;
default:
diff --git a/parser.c b/parser.c
index 1b086577..37a5e1cf 100644
--- a/parser.c
+++ b/parser.c
@@ -406,7 +406,8 @@ restart_parse:
if (result->opcode == I_DB || result->opcode == I_DW ||
result->opcode == I_DD || result->opcode == I_DQ ||
result->opcode == I_DT || result->opcode == I_DO ||
- result->opcode == I_DY || result->opcode == I_INCBIN) {
+ result->opcode == I_DY || result->opcode == I_DZ ||
+ result->opcode == I_INCBIN) {
extop *eop, **tail = &result->eops, **fixptr;
int oper_num = 0;
int32_t sign;
@@ -414,7 +415,7 @@ restart_parse:
result->eops_float = false;
/*
- * Begin to read the DB/DW/DD/DQ/DT/DO/INCBIN operands.
+ * Begin to read the DB/DW/DD/DQ/DT/DO/DY/DZ/INCBIN operands.
*/
while (1) {
i = stdscan(NULL, &tokval);
@@ -495,7 +496,7 @@ is_float:
eop->stringlen = idata_bytes(result->opcode);
if (eop->stringlen > 16) {
nasm_error(ERR_NONFATAL, "floating-point constant"
- " encountered in DY instruction");
+ " encountered in DY or DZ instruction");
eop->stringlen = 0;
} else if (eop->stringlen < 1) {
nasm_error(ERR_NONFATAL, "floating-point constant"
@@ -1049,7 +1050,7 @@ is_expression:
result->oprs[operand++].type = 0;
/*
- * Transform RESW, RESD, RESQ, REST, RESO, RESY into RESB.
+ * Transform RESW, RESD, RESQ, REST, RESO, RESY, RESZ into RESB.
*/
switch (result->opcode) {
case I_RESW:
@@ -1076,6 +1077,10 @@ is_expression:
result->opcode = I_RESB;
result->oprs[0].offset *= 32;
break;
+ case I_RESZ:
+ result->opcode = I_RESB;
+ result->oprs[0].offset *= 64;
+ break;
default:
break;
}