summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-18 13:01:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-18 13:01:32 -0700
commit41c9f6fde06091199f1a95e0c045230baaa25bf4 (patch)
tree35df1b3c570cd4e3611acd94f7e2ee0b51d45f3e /parser.c
parent5255fd1f36eece1cbf4000ffc3120dbcb9bf5038 (diff)
downloadnasm-41c9f6fde06091199f1a95e0c045230baaa25bf4.tar.gz
nasm-41c9f6fde06091199f1a95e0c045230baaa25bf4.tar.bz2
nasm-41c9f6fde06091199f1a95e0c045230baaa25bf4.zip
Implement "oword" (128 bits) as a first-class size
Implement oword, reso, do, as well as the SO flag to instructions. No instructions are actually flagged with SO yet, but this allows us to specify 128-bit sizes in instruction patterns.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/parser.c b/parser.c
index 16164d7..ca12a09 100644
--- a/parser.c
+++ b/parser.c
@@ -175,23 +175,25 @@ insn *parse_line(int pass, char *buffer, insn * result,
* For the moment, EQU has the same difficulty, so we'll
* include that.
*/
- if (result->opcode == I_RESB || result->opcode == I_RESW || result->opcode == I_RESD || result->opcode == I_RESQ || result->opcode == I_REST || result->opcode == I_EQU || result->opcode == I_INCBIN) { /* fbk */
+ if (result->opcode == I_RESB || result->opcode == I_RESW ||
+ result->opcode == I_RESD || result->opcode == I_RESQ ||
+ result->opcode == I_REST || result->opcode == I_RESO ||
+ result->opcode == I_EQU || result->opcode == I_INCBIN) {
critical = pass0;
} else
critical = (pass == 2 ? 2 : 0);
- if (result->opcode == I_DB ||
- result->opcode == I_DW ||
- result->opcode == I_DD ||
- result->opcode == I_DQ ||
- result->opcode == I_DT || result->opcode == I_INCBIN) {
+ 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_INCBIN) {
extop *eop, **tail = &result->eops, **fixptr;
int oper_num = 0;
result->eops_float = FALSE;
/*
- * Begin to read the DB/DW/DD/DQ/DT/INCBIN operands.
+ * Begin to read the DB/DW/DD/DQ/DT/DO/INCBIN operands.
*/
while (1) {
i = stdscan(NULL, &tokval);
@@ -234,6 +236,8 @@ insn *parse_line(int pass, char *buffer, insn * result,
eop->stringlen = 8;
else if (result->opcode == I_DT)
eop->stringlen = 10;
+ else if (result->opcode == I_DO)
+ eop->stringlen = 16;
else {
error(ERR_NONFATAL, "floating-point constant"
" encountered in `D%c' instruction",
@@ -245,8 +249,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
*/
eop->stringlen = 0;
}
- eop =
- nasm_realloc(eop, sizeof(extop) + eop->stringlen);
+ eop = nasm_realloc(eop, sizeof(extop) + eop->stringlen);
tail = &eop->next;
*fixptr = eop;
eop->stringval = (char *)eop + sizeof(extop);
@@ -384,6 +387,11 @@ insn *parse_line(int pass, char *buffer, insn * result,
result->oprs[operand].type |= BITS80;
setsize = 1;
break;
+ case S_OWORD:
+ if (!setsize)
+ result->oprs[operand].type |= BITS128;
+ setsize = 1;
+ break;
case S_TO:
result->oprs[operand].type |= TO;
break;
@@ -440,6 +448,9 @@ insn *parse_line(int pass, char *buffer, insn * result,
case S_TWORD:
result->oprs[operand].type |= BITS80;
break;
+ case S_OWORD:
+ result->oprs[operand].type |= BITS128;
+ break;
default:
error(ERR_NONFATAL,
"invalid operand size specification");
@@ -751,7 +762,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
result->oprs[operand++].type = 0;
/*
- * Transform RESW, RESD, RESQ, REST into RESB.
+ * Transform RESW, RESD, RESQ, REST, RESO into RESB.
*/
switch (result->opcode) {
case I_RESW:
@@ -770,6 +781,10 @@ insn *parse_line(int pass, char *buffer, insn * result,
result->opcode = I_RESB;
result->oprs[0].offset *= 10;
break;
+ case I_RESO:
+ result->opcode = I_RESB;
+ result->oprs[0].offset *= 16;
+ break;
default:
break;
}