H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 1 | /* parser.c source line parser for the Netwide Assembler |
| 2 | * |
| 3 | * The Netwide Assembler is copyright (C) 1996 Simon Tatham and |
| 4 | * Julian Hall. All rights reserved. The software is |
| 5 | * redistributable under the licence given in the file "Licence" |
| 6 | * distributed in the NASM archive. |
| 7 | * |
| 8 | * initial version 27/iii/95 by Simon Tatham |
| 9 | */ |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <stddef.h> |
| 14 | #include <string.h> |
| 15 | #include <ctype.h> |
Keith Kanios | b7a8954 | 2007-04-12 02:40:54 +0000 | [diff] [blame] | 16 | #include <inttypes.h> |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 17 | |
| 18 | #include "nasm.h" |
H. Peter Anvin | 24cfef4 | 2002-09-12 16:34:06 +0000 | [diff] [blame] | 19 | #include "insns.h" |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 20 | #include "nasmlib.h" |
| 21 | #include "parser.h" |
| 22 | #include "float.h" |
| 23 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 24 | extern int in_abs_seg; /* ABSOLUTE segment flag */ |
Keith Kanios | b7a8954 | 2007-04-12 02:40:54 +0000 | [diff] [blame] | 25 | extern int32_t abs_seg; /* ABSOLUTE segment */ |
| 26 | extern int32_t abs_offset; /* ABSOLUTE segment offset */ |
H. Peter Anvin | d0e365d | 2002-05-26 18:19:19 +0000 | [diff] [blame] | 27 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 28 | #include "regflags.c" /* List of register flags */ |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 29 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 30 | enum { /* special tokens */ |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 31 | S_BYTE, S_DWORD, S_FAR, S_LONG, S_NEAR, S_NOSPLIT, S_QWORD, |
H. Peter Anvin | 01377d8 | 2002-05-21 03:16:33 +0000 | [diff] [blame] | 32 | S_SHORT, S_STRICT, S_TO, S_TWORD, S_WORD |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 33 | }; |
| 34 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 35 | static int is_comma_next(void); |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 36 | |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 37 | static int i; |
| 38 | static struct tokenval tokval; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 39 | static efunc error; |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 40 | static struct ofmt *outfmt; /* Structure of addresses of output routines */ |
| 41 | static loc_t *location; /* Pointer to current line's segment,offset */ |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 42 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 43 | void parser_global_info(struct ofmt *output, loc_t * locp) |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 44 | { |
| 45 | outfmt = output; |
| 46 | location = locp; |
| 47 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 48 | |
Keith Kanios | a6dfa78 | 2007-04-13 16:47:53 +0000 | [diff] [blame] | 49 | insn *parse_line(int pass, char *buffer, insn * result, |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 50 | efunc errfunc, evalfunc evaluate, ldfunc ldef) |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 51 | { |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 52 | int operand; |
| 53 | int critical; |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 54 | struct eval_hints hints; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 55 | |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 56 | result->forw_ref = FALSE; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 57 | error = errfunc; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 58 | |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 59 | stdscan_reset(); |
| 60 | stdscan_bufptr = buffer; |
| 61 | i = stdscan(NULL, &tokval); |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 62 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 63 | result->label = NULL; /* Assume no label */ |
| 64 | result->eops = NULL; /* must do this, whatever happens */ |
Keith Kanios | b7a8954 | 2007-04-12 02:40:54 +0000 | [diff] [blame] | 65 | result->operands = 0; /* must initialize this */ |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 66 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 67 | if (i == 0) { /* blank line - ignore */ |
| 68 | result->opcode = -1; /* and no instruction either */ |
| 69 | return result; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 70 | } |
| 71 | if (i != TOKEN_ID && i != TOKEN_INSN && i != TOKEN_PREFIX && |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 72 | (i != TOKEN_REG || (REG_SREG & ~reg_flags[tokval.t_integer]))) { |
| 73 | error(ERR_NONFATAL, "label or instruction expected" |
| 74 | " at start of line"); |
| 75 | result->opcode = -1; |
| 76 | return result; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 77 | } |
| 78 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 79 | if (i == TOKEN_ID) { /* there's a label here */ |
| 80 | result->label = tokval.t_charptr; |
| 81 | i = stdscan(NULL, &tokval); |
| 82 | if (i == ':') { /* skip over the optional colon */ |
| 83 | i = stdscan(NULL, &tokval); |
| 84 | } else if (i == 0) { |
| 85 | error(ERR_WARNING | ERR_WARN_OL | ERR_PASS1, |
| 86 | "label alone on a line without a colon might be in error"); |
| 87 | } |
| 88 | if (i != TOKEN_INSN || tokval.t_integer != I_EQU) { |
| 89 | /* |
| 90 | * FIXME: location->segment could be NO_SEG, in which case |
| 91 | * it is possible we should be passing 'abs_seg'. Look into this. |
| 92 | * Work out whether that is *really* what we should be doing. |
| 93 | * Generally fix things. I think this is right as it is, but |
| 94 | * am still not certain. |
| 95 | */ |
| 96 | ldef(result->label, in_abs_seg ? abs_seg : location->segment, |
| 97 | location->offset, NULL, TRUE, FALSE, outfmt, errfunc); |
| 98 | } |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 99 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 100 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 101 | if (i == 0) { |
| 102 | result->opcode = -1; /* this line contains just a label */ |
| 103 | return result; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | result->nprefix = 0; |
H. Peter Anvin | d7ed89e | 2002-04-30 20:52:08 +0000 | [diff] [blame] | 107 | result->times = 1L; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 108 | |
| 109 | while (i == TOKEN_PREFIX || |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 110 | (i == TOKEN_REG && !(REG_SREG & ~reg_flags[tokval.t_integer]))) |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 111 | { |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 112 | /* |
| 113 | * Handle special case: the TIMES prefix. |
| 114 | */ |
| 115 | if (i == TOKEN_PREFIX && tokval.t_integer == P_TIMES) { |
| 116 | expr *value; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 117 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 118 | i = stdscan(NULL, &tokval); |
| 119 | value = |
| 120 | evaluate(stdscan, NULL, &tokval, NULL, pass0, error, NULL); |
| 121 | i = tokval.t_type; |
| 122 | if (!value) { /* but, error in evaluator */ |
| 123 | result->opcode = -1; /* unrecoverable parse error: */ |
| 124 | return result; /* ignore this instruction */ |
| 125 | } |
| 126 | if (!is_simple(value)) { |
| 127 | error(ERR_NONFATAL, |
| 128 | "non-constant argument supplied to TIMES"); |
| 129 | result->times = 1L; |
| 130 | } else { |
| 131 | result->times = value->value; |
| 132 | if (value->value < 0) { |
| 133 | error(ERR_NONFATAL, "TIMES value %d is negative", |
| 134 | value->value); |
| 135 | result->times = 0; |
| 136 | } |
| 137 | } |
| 138 | } else { |
| 139 | if (result->nprefix == MAXPREFIX) |
| 140 | error(ERR_NONFATAL, |
| 141 | "instruction has more than %d prefixes", MAXPREFIX); |
| 142 | else |
| 143 | result->prefixes[result->nprefix++] = tokval.t_integer; |
| 144 | i = stdscan(NULL, &tokval); |
| 145 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | if (i != TOKEN_INSN) { |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 149 | if (result->nprefix > 0 && i == 0) { |
| 150 | /* |
| 151 | * Instruction prefixes are present, but no actual |
| 152 | * instruction. This is allowed: at this point we |
| 153 | * invent a notional instruction of RESB 0. |
| 154 | */ |
| 155 | result->opcode = I_RESB; |
| 156 | result->operands = 1; |
| 157 | result->oprs[0].type = IMMEDIATE; |
| 158 | result->oprs[0].offset = 0L; |
| 159 | result->oprs[0].segment = result->oprs[0].wrt = NO_SEG; |
| 160 | return result; |
| 161 | } else { |
| 162 | error(ERR_NONFATAL, "parser: instruction expected"); |
| 163 | result->opcode = -1; |
| 164 | return result; |
| 165 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | result->opcode = tokval.t_integer; |
| 169 | result->condition = tokval.t_inttwo; |
| 170 | |
| 171 | /* |
| 172 | * RESB, RESW and RESD cannot be satisfied with incorrectly |
| 173 | * evaluated operands, since the correct values _must_ be known |
| 174 | * on the first pass. Hence, even in pass one, we set the |
| 175 | * `critical' flag on calling evaluate(), so that it will bomb |
| 176 | * out on undefined symbols. Nasty, but there's nothing we can |
| 177 | * do about it. |
| 178 | * |
| 179 | * For the moment, EQU has the same difficulty, so we'll |
| 180 | * include that. |
| 181 | */ |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 182 | 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 */ |
| 183 | critical = pass0; |
| 184 | } else |
| 185 | critical = (pass == 2 ? 2 : 0); |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 186 | |
| 187 | if (result->opcode == I_DB || |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 188 | result->opcode == I_DW || |
| 189 | result->opcode == I_DD || |
| 190 | result->opcode == I_DQ || |
| 191 | result->opcode == I_DT || result->opcode == I_INCBIN) { |
| 192 | extop *eop, **tail = &result->eops, **fixptr; |
| 193 | int oper_num = 0; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 194 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 195 | result->eops_float = FALSE; |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 196 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 197 | /* |
| 198 | * Begin to read the DB/DW/DD/DQ/DT/INCBIN operands. |
| 199 | */ |
| 200 | while (1) { |
| 201 | i = stdscan(NULL, &tokval); |
| 202 | if (i == 0) |
| 203 | break; |
| 204 | fixptr = tail; |
| 205 | eop = *tail = nasm_malloc(sizeof(extop)); |
| 206 | tail = &eop->next; |
| 207 | eop->next = NULL; |
| 208 | eop->type = EOT_NOTHING; |
| 209 | oper_num++; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 210 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 211 | if (i == TOKEN_NUM && tokval.t_charptr && is_comma_next()) { |
| 212 | eop->type = EOT_DB_STRING; |
| 213 | eop->stringval = tokval.t_charptr; |
| 214 | eop->stringlen = tokval.t_inttwo; |
| 215 | i = stdscan(NULL, &tokval); /* eat the comma */ |
| 216 | continue; |
| 217 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 218 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 219 | if ((i == TOKEN_FLOAT && is_comma_next()) || i == '-') { |
Keith Kanios | b7a8954 | 2007-04-12 02:40:54 +0000 | [diff] [blame] | 220 | int32_t sign = +1L; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 221 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 222 | if (i == '-') { |
Keith Kanios | a6dfa78 | 2007-04-13 16:47:53 +0000 | [diff] [blame] | 223 | char *save = stdscan_bufptr; |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 224 | i = stdscan(NULL, &tokval); |
| 225 | sign = -1L; |
| 226 | if (i != TOKEN_FLOAT || !is_comma_next()) { |
| 227 | stdscan_bufptr = save; |
| 228 | i = tokval.t_type = '-'; |
| 229 | } |
| 230 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 231 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 232 | if (i == TOKEN_FLOAT) { |
| 233 | eop->type = EOT_DB_STRING; |
| 234 | result->eops_float = TRUE; |
| 235 | if (result->opcode == I_DD) |
| 236 | eop->stringlen = 4; |
| 237 | else if (result->opcode == I_DQ) |
| 238 | eop->stringlen = 8; |
| 239 | else if (result->opcode == I_DT) |
| 240 | eop->stringlen = 10; |
| 241 | else { |
| 242 | error(ERR_NONFATAL, "floating-point constant" |
| 243 | " encountered in `D%c' instruction", |
| 244 | result->opcode == I_DW ? 'W' : 'B'); |
| 245 | /* |
| 246 | * fix suggested by Pedro Gimeno... original line |
| 247 | * was: |
| 248 | * eop->type = EOT_NOTHING; |
| 249 | */ |
| 250 | eop->stringlen = 0; |
| 251 | } |
| 252 | eop = |
| 253 | nasm_realloc(eop, sizeof(extop) + eop->stringlen); |
| 254 | tail = &eop->next; |
| 255 | *fixptr = eop; |
Keith Kanios | a6dfa78 | 2007-04-13 16:47:53 +0000 | [diff] [blame] | 256 | eop->stringval = (char *)eop + sizeof(extop); |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 257 | if (eop->stringlen < 4 || |
| 258 | !float_const(tokval.t_charptr, sign, |
Keith Kanios | b7a8954 | 2007-04-12 02:40:54 +0000 | [diff] [blame] | 259 | (uint8_t *)eop->stringval, |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 260 | eop->stringlen, error)) |
| 261 | eop->type = EOT_NOTHING; |
| 262 | i = stdscan(NULL, &tokval); /* eat the comma */ |
| 263 | continue; |
| 264 | } |
| 265 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 266 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 267 | /* anything else */ |
| 268 | { |
| 269 | expr *value; |
| 270 | value = evaluate(stdscan, NULL, &tokval, NULL, |
| 271 | critical, error, NULL); |
| 272 | i = tokval.t_type; |
| 273 | if (!value) { /* error in evaluator */ |
| 274 | result->opcode = -1; /* unrecoverable parse error: */ |
| 275 | return result; /* ignore this instruction */ |
| 276 | } |
| 277 | if (is_unknown(value)) { |
| 278 | eop->type = EOT_DB_NUMBER; |
| 279 | eop->offset = 0; /* doesn't matter what we put */ |
| 280 | eop->segment = eop->wrt = NO_SEG; /* likewise */ |
| 281 | } else if (is_reloc(value)) { |
| 282 | eop->type = EOT_DB_NUMBER; |
| 283 | eop->offset = reloc_value(value); |
| 284 | eop->segment = reloc_seg(value); |
| 285 | eop->wrt = reloc_wrt(value); |
| 286 | } else { |
| 287 | error(ERR_NONFATAL, |
| 288 | "operand %d: expression is not simple" |
| 289 | " or relocatable", oper_num); |
| 290 | } |
| 291 | } |
H. Peter Anvin | 6768eb7 | 2002-04-30 20:52:26 +0000 | [diff] [blame] | 292 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 293 | /* |
| 294 | * We're about to call stdscan(), which will eat the |
| 295 | * comma that we're currently sitting on between |
| 296 | * arguments. However, we'd better check first that it |
| 297 | * _is_ a comma. |
| 298 | */ |
| 299 | if (i == 0) /* also could be EOL */ |
| 300 | break; |
| 301 | if (i != ',') { |
| 302 | error(ERR_NONFATAL, "comma expected after operand %d", |
| 303 | oper_num); |
| 304 | result->opcode = -1; /* unrecoverable parse error: */ |
| 305 | return result; /* ignore this instruction */ |
| 306 | } |
| 307 | } |
H. Peter Anvin | d7ed89e | 2002-04-30 20:52:08 +0000 | [diff] [blame] | 308 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 309 | if (result->opcode == I_INCBIN) { |
| 310 | /* |
| 311 | * Correct syntax for INCBIN is that there should be |
| 312 | * one string operand, followed by one or two numeric |
| 313 | * operands. |
| 314 | */ |
| 315 | if (!result->eops || result->eops->type != EOT_DB_STRING) |
| 316 | error(ERR_NONFATAL, "`incbin' expects a file name"); |
| 317 | else if (result->eops->next && |
| 318 | result->eops->next->type != EOT_DB_NUMBER) |
| 319 | error(ERR_NONFATAL, "`incbin': second parameter is", |
| 320 | " non-numeric"); |
| 321 | else if (result->eops->next && result->eops->next->next && |
| 322 | result->eops->next->next->type != EOT_DB_NUMBER) |
| 323 | error(ERR_NONFATAL, "`incbin': third parameter is", |
| 324 | " non-numeric"); |
| 325 | else if (result->eops->next && result->eops->next->next && |
| 326 | result->eops->next->next->next) |
| 327 | error(ERR_NONFATAL, |
| 328 | "`incbin': more than three parameters"); |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 329 | else |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 330 | return result; |
| 331 | /* |
| 332 | * If we reach here, one of the above errors happened. |
| 333 | * Throw the instruction away. |
| 334 | */ |
| 335 | result->opcode = -1; |
| 336 | return result; |
| 337 | } else /* DB ... */ if (oper_num == 0) |
| 338 | error(ERR_WARNING | ERR_PASS1, |
| 339 | "no operand for data declaration"); |
| 340 | else |
| 341 | result->operands = oper_num; |
H. Peter Anvin | d7ed89e | 2002-04-30 20:52:08 +0000 | [diff] [blame] | 342 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 343 | return result; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | /* right. Now we begin to parse the operands. There may be up to three |
| 347 | * of these, separated by commas, and terminated by a zero token. */ |
| 348 | |
| 349 | for (operand = 0; operand < 3; operand++) { |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 350 | expr *value; /* used most of the time */ |
| 351 | int mref; /* is this going to be a memory ref? */ |
| 352 | int bracket; /* is it a [] mref, or a & mref? */ |
| 353 | int setsize = 0; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 354 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 355 | result->oprs[operand].addr_size = 0; /* have to zero this whatever */ |
| 356 | result->oprs[operand].eaflags = 0; /* and this */ |
| 357 | result->oprs[operand].opflags = 0; |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 358 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 359 | i = stdscan(NULL, &tokval); |
| 360 | if (i == 0) |
| 361 | break; /* end of operands: get out of here */ |
| 362 | result->oprs[operand].type = 0; /* so far, no override */ |
| 363 | while (i == TOKEN_SPECIAL) { /* size specifiers */ |
| 364 | switch ((int)tokval.t_integer) { |
| 365 | case S_BYTE: |
| 366 | if (!setsize) /* we want to use only the first */ |
| 367 | result->oprs[operand].type |= BITS8; |
| 368 | setsize = 1; |
| 369 | break; |
| 370 | case S_WORD: |
| 371 | if (!setsize) |
| 372 | result->oprs[operand].type |= BITS16; |
| 373 | setsize = 1; |
| 374 | break; |
| 375 | case S_DWORD: |
| 376 | case S_LONG: |
| 377 | if (!setsize) |
| 378 | result->oprs[operand].type |= BITS32; |
| 379 | setsize = 1; |
| 380 | break; |
| 381 | case S_QWORD: |
| 382 | if (!setsize) |
| 383 | result->oprs[operand].type |= BITS64; |
| 384 | setsize = 1; |
| 385 | break; |
| 386 | case S_TWORD: |
| 387 | if (!setsize) |
| 388 | result->oprs[operand].type |= BITS80; |
| 389 | setsize = 1; |
| 390 | break; |
| 391 | case S_TO: |
| 392 | result->oprs[operand].type |= TO; |
| 393 | break; |
| 394 | case S_STRICT: |
| 395 | result->oprs[operand].type |= STRICT; |
| 396 | break; |
| 397 | case S_FAR: |
| 398 | result->oprs[operand].type |= FAR; |
| 399 | break; |
| 400 | case S_NEAR: |
| 401 | result->oprs[operand].type |= NEAR; |
| 402 | break; |
| 403 | case S_SHORT: |
| 404 | result->oprs[operand].type |= SHORT; |
| 405 | break; |
| 406 | default: |
| 407 | error(ERR_NONFATAL, "invalid operand size specification"); |
| 408 | } |
| 409 | i = stdscan(NULL, &tokval); |
| 410 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 411 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 412 | if (i == '[' || i == '&') { /* memory reference */ |
| 413 | mref = TRUE; |
| 414 | bracket = (i == '['); |
| 415 | i = stdscan(NULL, &tokval); |
| 416 | if (i == TOKEN_SPECIAL) { /* check for address size override */ |
| 417 | if (tasm_compatible_mode) { |
| 418 | switch ((int)tokval.t_integer) { |
| 419 | /* For TASM compatibility a size override inside the |
| 420 | * brackets changes the size of the operand, not the |
| 421 | * address type of the operand as it does in standard |
| 422 | * NASM syntax. Hence: |
| 423 | * |
| 424 | * mov eax,[DWORD val] |
| 425 | * |
| 426 | * is valid syntax in TASM compatibility mode. Note that |
| 427 | * you lose the ability to override the default address |
| 428 | * type for the instruction, but we never use anything |
| 429 | * but 32-bit flat model addressing in our code. |
| 430 | */ |
| 431 | case S_BYTE: |
| 432 | result->oprs[operand].type |= BITS8; |
| 433 | break; |
| 434 | case S_WORD: |
| 435 | result->oprs[operand].type |= BITS16; |
| 436 | break; |
| 437 | case S_DWORD: |
| 438 | case S_LONG: |
| 439 | result->oprs[operand].type |= BITS32; |
| 440 | break; |
| 441 | case S_QWORD: |
| 442 | result->oprs[operand].type |= BITS64; |
| 443 | break; |
| 444 | case S_TWORD: |
| 445 | result->oprs[operand].type |= BITS80; |
| 446 | break; |
| 447 | default: |
| 448 | error(ERR_NONFATAL, |
| 449 | "invalid operand size specification"); |
| 450 | } |
| 451 | } else { |
| 452 | /* Standard NASM compatible syntax */ |
| 453 | switch ((int)tokval.t_integer) { |
| 454 | case S_NOSPLIT: |
| 455 | result->oprs[operand].eaflags |= EAF_TIMESTWO; |
| 456 | break; |
| 457 | case S_BYTE: |
| 458 | result->oprs[operand].eaflags |= EAF_BYTEOFFS; |
| 459 | break; |
| 460 | case S_WORD: |
| 461 | result->oprs[operand].addr_size = 16; |
| 462 | result->oprs[operand].eaflags |= EAF_WORDOFFS; |
| 463 | break; |
| 464 | case S_DWORD: |
| 465 | case S_LONG: |
| 466 | result->oprs[operand].addr_size = 32; |
| 467 | result->oprs[operand].eaflags |= EAF_WORDOFFS; |
| 468 | break; |
| 469 | default: |
| 470 | error(ERR_NONFATAL, "invalid size specification in" |
| 471 | " effective address"); |
| 472 | } |
| 473 | } |
| 474 | i = stdscan(NULL, &tokval); |
| 475 | } |
| 476 | } else { /* immediate operand, or register */ |
| 477 | mref = FALSE; |
| 478 | bracket = FALSE; /* placate optimisers */ |
| 479 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 480 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 481 | if ((result->oprs[operand].type & FAR) && !mref && |
| 482 | result->opcode != I_JMP && result->opcode != I_CALL) { |
| 483 | error(ERR_NONFATAL, "invalid use of FAR operand specifier"); |
| 484 | } |
Debbie Wiles | 63b53f7 | 2002-06-04 19:31:24 +0000 | [diff] [blame] | 485 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 486 | value = evaluate(stdscan, NULL, &tokval, |
| 487 | &result->oprs[operand].opflags, |
| 488 | critical, error, &hints); |
| 489 | i = tokval.t_type; |
| 490 | if (result->oprs[operand].opflags & OPFLAG_FORWARD) { |
| 491 | result->forw_ref = TRUE; |
| 492 | } |
| 493 | if (!value) { /* error in evaluator */ |
| 494 | result->opcode = -1; /* unrecoverable parse error: */ |
| 495 | return result; /* ignore this instruction */ |
| 496 | } |
| 497 | if (i == ':' && mref) { /* it was seg:offset */ |
| 498 | /* |
| 499 | * Process the segment override. |
| 500 | */ |
| 501 | if (value[1].type != 0 || value->value != 1 || |
| 502 | REG_SREG & ~reg_flags[value->type]) |
| 503 | error(ERR_NONFATAL, "invalid segment override"); |
| 504 | else if (result->nprefix == MAXPREFIX) |
| 505 | error(ERR_NONFATAL, |
| 506 | "instruction has more than %d prefixes", MAXPREFIX); |
| 507 | else |
| 508 | result->prefixes[result->nprefix++] = value->type; |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 509 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 510 | i = stdscan(NULL, &tokval); /* then skip the colon */ |
| 511 | if (i == TOKEN_SPECIAL) { /* another check for size override */ |
| 512 | switch ((int)tokval.t_integer) { |
| 513 | case S_WORD: |
| 514 | result->oprs[operand].addr_size = 16; |
| 515 | break; |
| 516 | case S_DWORD: |
| 517 | case S_LONG: |
| 518 | result->oprs[operand].addr_size = 32; |
| 519 | break; |
| 520 | default: |
| 521 | error(ERR_NONFATAL, "invalid size specification in" |
| 522 | " effective address"); |
| 523 | } |
| 524 | i = stdscan(NULL, &tokval); |
| 525 | } |
| 526 | value = evaluate(stdscan, NULL, &tokval, |
| 527 | &result->oprs[operand].opflags, |
| 528 | critical, error, &hints); |
| 529 | i = tokval.t_type; |
| 530 | if (result->oprs[operand].opflags & OPFLAG_FORWARD) { |
| 531 | result->forw_ref = TRUE; |
| 532 | } |
| 533 | /* and get the offset */ |
| 534 | if (!value) { /* but, error in evaluator */ |
| 535 | result->opcode = -1; /* unrecoverable parse error: */ |
| 536 | return result; /* ignore this instruction */ |
| 537 | } |
| 538 | } |
| 539 | if (mref && bracket) { /* find ] at the end */ |
| 540 | if (i != ']') { |
| 541 | error(ERR_NONFATAL, "parser: expecting ]"); |
| 542 | do { /* error recovery again */ |
| 543 | i = stdscan(NULL, &tokval); |
| 544 | } while (i != 0 && i != ','); |
| 545 | } else /* we got the required ] */ |
| 546 | i = stdscan(NULL, &tokval); |
| 547 | } else { /* immediate operand */ |
| 548 | if (i != 0 && i != ',' && i != ':') { |
| 549 | error(ERR_NONFATAL, "comma or end of line expected"); |
| 550 | do { /* error recovery */ |
| 551 | i = stdscan(NULL, &tokval); |
| 552 | } while (i != 0 && i != ','); |
| 553 | } else if (i == ':') { |
| 554 | result->oprs[operand].type |= COLON; |
| 555 | } |
| 556 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 557 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 558 | /* now convert the exprs returned from evaluate() into operand |
| 559 | * descriptions... */ |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 560 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 561 | if (mref) { /* it's a memory reference */ |
| 562 | expr *e = value; |
| 563 | int b, i, s; /* basereg, indexreg, scale */ |
Keith Kanios | b7a8954 | 2007-04-12 02:40:54 +0000 | [diff] [blame] | 564 | int32_t o; /* offset */ |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 565 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 566 | b = i = -1, o = s = 0; |
| 567 | result->oprs[operand].hintbase = hints.base; |
| 568 | result->oprs[operand].hinttype = hints.type; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 569 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 570 | if (e->type && e->type <= EXPR_REG_END) { /* this bit's a register */ |
| 571 | if (e->value == 1) /* in fact it can be basereg */ |
| 572 | b = e->type; |
| 573 | else /* no, it has to be indexreg */ |
| 574 | i = e->type, s = e->value; |
| 575 | e++; |
| 576 | } |
| 577 | if (e->type && e->type <= EXPR_REG_END) { /* it's a 2nd register */ |
| 578 | if (b != -1) /* If the first was the base, ... */ |
| 579 | i = e->type, s = e->value; /* second has to be indexreg */ |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 580 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 581 | else if (e->value != 1) { /* If both want to be index */ |
| 582 | error(ERR_NONFATAL, |
| 583 | "beroset-p-592-invalid effective address"); |
| 584 | result->opcode = -1; |
| 585 | return result; |
| 586 | } else |
| 587 | b = e->type; |
| 588 | e++; |
| 589 | } |
| 590 | if (e->type != 0) { /* is there an offset? */ |
| 591 | if (e->type <= EXPR_REG_END) { /* in fact, is there an error? */ |
| 592 | error(ERR_NONFATAL, |
| 593 | "beroset-p-603-invalid effective address"); |
| 594 | result->opcode = -1; |
| 595 | return result; |
| 596 | } else { |
| 597 | if (e->type == EXPR_UNKNOWN) { |
| 598 | o = 0; /* doesn't matter what */ |
| 599 | result->oprs[operand].wrt = NO_SEG; /* nor this */ |
| 600 | result->oprs[operand].segment = NO_SEG; /* or this */ |
| 601 | while (e->type) |
| 602 | e++; /* go to the end of the line */ |
| 603 | } else { |
| 604 | if (e->type == EXPR_SIMPLE) { |
| 605 | o = e->value; |
| 606 | e++; |
| 607 | } |
| 608 | if (e->type == EXPR_WRT) { |
| 609 | result->oprs[operand].wrt = e->value; |
| 610 | e++; |
| 611 | } else |
| 612 | result->oprs[operand].wrt = NO_SEG; |
| 613 | /* |
| 614 | * Look for a segment base type. |
| 615 | */ |
| 616 | if (e->type && e->type < EXPR_SEGBASE) { |
| 617 | error(ERR_NONFATAL, |
| 618 | "beroset-p-630-invalid effective address"); |
| 619 | result->opcode = -1; |
| 620 | return result; |
| 621 | } |
| 622 | while (e->type && e->value == 0) |
| 623 | e++; |
| 624 | if (e->type && e->value != 1) { |
| 625 | error(ERR_NONFATAL, |
| 626 | "beroset-p-637-invalid effective address"); |
| 627 | result->opcode = -1; |
| 628 | return result; |
| 629 | } |
| 630 | if (e->type) { |
| 631 | result->oprs[operand].segment = |
| 632 | e->type - EXPR_SEGBASE; |
| 633 | e++; |
| 634 | } else |
| 635 | result->oprs[operand].segment = NO_SEG; |
| 636 | while (e->type && e->value == 0) |
| 637 | e++; |
| 638 | if (e->type) { |
| 639 | error(ERR_NONFATAL, |
| 640 | "beroset-p-650-invalid effective address"); |
| 641 | result->opcode = -1; |
| 642 | return result; |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | } else { |
| 647 | o = 0; |
| 648 | result->oprs[operand].wrt = NO_SEG; |
| 649 | result->oprs[operand].segment = NO_SEG; |
| 650 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 651 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 652 | if (e->type != 0) { /* there'd better be nothing left! */ |
| 653 | error(ERR_NONFATAL, |
| 654 | "beroset-p-663-invalid effective address"); |
| 655 | result->opcode = -1; |
| 656 | return result; |
| 657 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 658 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 659 | result->oprs[operand].type |= MEMORY; |
| 660 | if (b == -1 && (i == -1 || s == 0)) |
| 661 | result->oprs[operand].type |= MEM_OFFS; |
| 662 | result->oprs[operand].basereg = b; |
| 663 | result->oprs[operand].indexreg = i; |
| 664 | result->oprs[operand].scale = s; |
| 665 | result->oprs[operand].offset = o; |
| 666 | } else { /* it's not a memory reference */ |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 667 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 668 | if (is_just_unknown(value)) { /* it's immediate but unknown */ |
| 669 | result->oprs[operand].type |= IMMEDIATE; |
| 670 | result->oprs[operand].offset = 0; /* don't care */ |
| 671 | result->oprs[operand].segment = NO_SEG; /* don't care again */ |
| 672 | result->oprs[operand].wrt = NO_SEG; /* still don't care */ |
| 673 | } else if (is_reloc(value)) { /* it's immediate */ |
| 674 | result->oprs[operand].type |= IMMEDIATE; |
| 675 | result->oprs[operand].offset = reloc_value(value); |
| 676 | result->oprs[operand].segment = reloc_seg(value); |
| 677 | result->oprs[operand].wrt = reloc_wrt(value); |
| 678 | if (is_simple(value)) { |
| 679 | if (reloc_value(value) == 1) |
| 680 | result->oprs[operand].type |= UNITY; |
| 681 | if (optimizing >= 0 && |
| 682 | !(result->oprs[operand].type & STRICT)) { |
| 683 | if (reloc_value(value) >= -128 && |
| 684 | reloc_value(value) <= 127) |
| 685 | result->oprs[operand].type |= SBYTE; |
| 686 | } |
| 687 | } |
| 688 | } else { /* it's a register */ |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 689 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 690 | if (value->type >= EXPR_SIMPLE || value->value != 1) { |
| 691 | error(ERR_NONFATAL, "invalid operand type"); |
| 692 | result->opcode = -1; |
| 693 | return result; |
| 694 | } |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 695 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 696 | /* |
| 697 | * check that its only 1 register, not an expression... |
| 698 | */ |
| 699 | for (i = 1; value[i].type; i++) |
| 700 | if (value[i].value) { |
| 701 | error(ERR_NONFATAL, "invalid operand type"); |
| 702 | result->opcode = -1; |
| 703 | return result; |
| 704 | } |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 705 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 706 | /* clear overrides, except TO which applies to FPU regs */ |
| 707 | if (result->oprs[operand].type & ~TO) { |
| 708 | /* |
| 709 | * we want to produce a warning iff the specified size |
| 710 | * is different from the register size |
| 711 | */ |
| 712 | i = result->oprs[operand].type & SIZE_MASK; |
| 713 | } else |
| 714 | i = 0; |
| 715 | |
| 716 | result->oprs[operand].type &= TO; |
| 717 | result->oprs[operand].type |= REGISTER; |
| 718 | result->oprs[operand].type |= reg_flags[value->type]; |
| 719 | result->oprs[operand].basereg = value->type; |
| 720 | |
| 721 | if (i && (result->oprs[operand].type & SIZE_MASK) != i) |
| 722 | error(ERR_WARNING | ERR_PASS1, |
| 723 | "register size specification ignored"); |
| 724 | } |
| 725 | } |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 726 | } |
| 727 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 728 | result->operands = operand; /* set operand count */ |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 729 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 730 | while (operand < 3) /* clear remaining operands */ |
| 731 | result->oprs[operand++].type = 0; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 732 | |
| 733 | /* |
| 734 | * Transform RESW, RESD, RESQ, REST into RESB. |
| 735 | */ |
| 736 | switch (result->opcode) { |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 737 | case I_RESW: |
| 738 | result->opcode = I_RESB; |
| 739 | result->oprs[0].offset *= 2; |
| 740 | break; |
| 741 | case I_RESD: |
| 742 | result->opcode = I_RESB; |
| 743 | result->oprs[0].offset *= 4; |
| 744 | break; |
| 745 | case I_RESQ: |
| 746 | result->opcode = I_RESB; |
| 747 | result->oprs[0].offset *= 8; |
| 748 | break; |
| 749 | case I_REST: |
| 750 | result->opcode = I_RESB; |
| 751 | result->oprs[0].offset *= 10; |
| 752 | break; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 753 | } |
| 754 | |
| 755 | return result; |
| 756 | } |
| 757 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 758 | static int is_comma_next(void) |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 759 | { |
Keith Kanios | a6dfa78 | 2007-04-13 16:47:53 +0000 | [diff] [blame] | 760 | char *p; |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 761 | int i; |
| 762 | struct tokenval tv; |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 763 | |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 764 | p = stdscan_bufptr; |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 765 | i = stdscan(NULL, &tv); |
H. Peter Anvin | 76690a1 | 2002-04-30 20:52:49 +0000 | [diff] [blame] | 766 | stdscan_bufptr = p; |
| 767 | return (i == ',' || i == ';' || !i); |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 768 | } |
| 769 | |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 770 | void cleanup_insn(insn * i) |
H. Peter Anvin | eba20a7 | 2002-04-30 20:53:55 +0000 | [diff] [blame] | 771 | { |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 772 | extop *e; |
| 773 | |
| 774 | while (i->eops) { |
H. Peter Anvin | e2c8018 | 2005-01-15 22:15:51 +0000 | [diff] [blame] | 775 | e = i->eops; |
| 776 | i->eops = i->eops->next; |
| 777 | nasm_free(e); |
H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame] | 778 | } |
| 779 | } |