diff options
author | Richard Henderson <rth@redhat.com> | 1998-09-08 22:57:36 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 1998-09-08 22:57:36 +0000 |
commit | de1d28b669305e05fb8294513ac83fe0337f81bf (patch) | |
tree | f50a111321a743b9651e8657c5f9ac40153b4431 /gas/config/tc-i386.c | |
parent | 9ade226a4221cc362f1636d8b962cbd05d1098ed (diff) | |
download | fsf-binutils-gdb-de1d28b669305e05fb8294513ac83fe0337f81bf.zip fsf-binutils-gdb-de1d28b669305e05fb8294513ac83fe0337f81bf.tar.gz fsf-binutils-gdb-de1d28b669305e05fb8294513ac83fe0337f81bf.tar.bz2 |
* config/tc-i386.c (i386_operand): Detect non-segment registers
used as segment prefixes.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 88 |
1 files changed, 50 insertions, 38 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 825cdc3..49d2a7f 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2283,51 +2283,63 @@ i386_operand (operand_string) op_string = end_op; if (is_space_char (*op_string)) ++op_string; - if ((r->reg_type & (SReg2 | SReg3)) && *op_string == ':') + if (*op_string) { - switch (r->reg_num) + if (r->reg_type & (SReg2 | SReg3)) { - case 0: - i.seg[i.mem_operands] = &es; - break; - case 1: - i.seg[i.mem_operands] = &cs; - break; - case 2: - i.seg[i.mem_operands] = &ss; - break; - case 3: - i.seg[i.mem_operands] = &ds; - break; - case 4: - i.seg[i.mem_operands] = &fs; - break; - case 5: - i.seg[i.mem_operands] = &gs; - break; - } - - /* Skip the ':' and whitespace. */ - ++op_string; - if (is_space_char (*op_string)) - ++op_string; + switch (r->reg_num) + { + case 0: + i.seg[i.mem_operands] = &es; + break; + case 1: + i.seg[i.mem_operands] = &cs; + break; + case 2: + i.seg[i.mem_operands] = &ss; + break; + case 3: + i.seg[i.mem_operands] = &ds; + break; + case 4: + i.seg[i.mem_operands] = &fs; + break; + case 5: + i.seg[i.mem_operands] = &gs; + break; + } - operand_string = op_string; /* Pretend given string starts here. */ - if (!is_digit_char (*op_string) && !is_identifier_char (*op_string) - && *op_string != '(' && *op_string != ABSOLUTE_PREFIX) - { - as_bad (_("bad memory operand `%s'"), op_string); - return 0; - } - /* Handle case of %es:*foo. */ - if (*op_string == ABSOLUTE_PREFIX) - { + /* Skip the ':' and whitespace. */ ++op_string; if (is_space_char (*op_string)) ++op_string; - i.types[this_operand] |= JumpAbsolute; + + /* Pretend given string starts here. */ + operand_string = op_string; + if (!is_digit_char (*op_string) + && !is_identifier_char (*op_string) + && *op_string != '(' + && *op_string != ABSOLUTE_PREFIX) + { + as_bad (_("bad memory operand `%s'"), op_string); + return 0; + } + /* Handle case of %es:*foo. */ + if (*op_string == ABSOLUTE_PREFIX) + { + ++op_string; + if (is_space_char (*op_string)) + ++op_string; + i.types[this_operand] |= JumpAbsolute; + } + goto do_memory_reference; + } + else + { + as_bad (_("bad segment prefix `%c%s'"), + REGISTER_PREFIX, r->reg_name); + return 0; } - goto do_memory_reference; } i.types[this_operand] |= r->reg_type & ~BaseIndex; i.regs[this_operand] = r; |