From b7240065b3828ccd6ef9f793f8f7ed885f32688c Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 13 Feb 2008 13:41:26 +0000 Subject: gas/ 2008-02-13 Jan Beulich * config/tc-i386.c (parse_real_register): Don't return 'FLAT' if not in Intel mode. (i386_intel_operand): Ignore segment overrides in immediate and offset operands. (intel_e11): Range-check i.mem_operands before use as array index. Filter out FLAT for uses other than as segment override. (intel_get_token): Remove broken promotion of "FLAT:" to mean "offset FLAT:". gas/testsuite/ 2008-02-13 Jan Beulich * gas/i386/intelok.s: Replace invalid offset expression with valid ones. * gas/i386/x86_64.s: Likewise. opcodes/ 2008-02-13 Jan Beulich * i386-opc.h (RegFlat): New. * i386-reg.tbl (flat): Add. * i386-tbl.h: Re-generate. --- gas/ChangeLog | 11 +++++++++++ gas/config/tc-i386.c | 31 ++++++++++++++++++++----------- gas/testsuite/ChangeLog | 6 ++++++ gas/testsuite/gas/i386/intelok.s | 4 ++-- gas/testsuite/gas/i386/x86_64.s | 8 ++++---- 5 files changed, 43 insertions(+), 17 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 952ee07..cd82737 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,16 @@ 2008-02-13 Jan Beulich + * config/tc-i386.c (parse_real_register): Don't return 'FLAT' + if not in Intel mode. + (i386_intel_operand): Ignore segment overrides in immediate and + offset operands. + (intel_e11): Range-check i.mem_operands before use as array + index. Filter out FLAT for uses other than as segment override. + (intel_get_token): Remove broken promotion of "FLAT:" to mean + "offset FLAT:". + +2008-02-13 Jan Beulich + * config/tc-i386.c (intel_e09): Also special-case 'bound'. 2008-02-13 Jan Beulich diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index ccb46ae..cc5b200 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -7076,6 +7076,9 @@ parse_real_register (char *reg_string, char **end_op) && flag_code != CODE_64BIT) return (const reg_entry *) NULL; + if (r->reg_type.bitfield.sreg3 && r->reg_num == RegFlat && !intel_syntax) + return (const reg_entry *) NULL; + return r; } @@ -8133,7 +8136,15 @@ i386_intel_operand (char *operand_string, int got_a_float) /* Constant and OFFSET expressions are handled by i386_immediate. */ else if ((intel_parser.op_modifier & (1 << T_OFFSET)) || intel_parser.reg == NULL) - ret = i386_immediate (intel_parser.disp); + { + if (i.mem_operands < 2 && i.seg[i.mem_operands]) + { + if (!(intel_parser.op_modifier & (1 << T_OFFSET))) + as_warn (_("Segment override ignored")); + i.seg[i.mem_operands] = NULL; + } + ret = i386_immediate (intel_parser.disp); + } if (intel_parser.next_operand && this_operand >= MAX_OPERANDS - 1) ret = 0; @@ -8667,6 +8678,8 @@ intel_e11 (void) reg->reg_name); return 0; } + else if (i.mem_operands >= 2) + as_warn (_("Segment override ignored")); else if (i.seg[i.mem_operands]) as_warn (_("Extra segment override ignored")); else @@ -8697,6 +8710,12 @@ intel_e11 (void) } } + else if (reg->reg_type.bitfield.sreg3 && reg->reg_num == RegFlat) + { + as_bad (_("cannot use `FLAT' here")); + return 0; + } + /* Not a segment register. Check for register scaling. */ else if (cur_token.code == '*') { @@ -9088,16 +9107,6 @@ intel_get_token (void) strcat (new_token.str, " FLAT:"); } - /* ??? This is not mentioned in the MASM grammar. */ - else if (strcasecmp (new_token.str, "FLAT") == 0) - { - new_token.code = T_OFFSET; - if (*q == ':') - strcat (new_token.str, ":"); - else - as_bad (_("`:' expected")); - } - else new_token.code = T_ID; } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index c924af1..da2e733 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2008-02-13 Jan Beulich + * gas/i386/intelok.s: Replace invalid offset expression with + valid ones. + * gas/i386/x86_64.s: Likewise. + +2008-02-13 Jan Beulich + * gas/i386/intelbad.s, gas/i386/intelok.s: Add 'bound' tests. * gas/i386/intelbad.l, gas/i386/intelok.l, gas/i386/intelok.e, gas/i386/opcode-intel.d: Adjust. diff --git a/gas/testsuite/gas/i386/intelok.s b/gas/testsuite/gas/i386/intelok.s index 5916b03..2f78929 100644 --- a/gas/testsuite/gas/i386/intelok.s +++ b/gas/testsuite/gas/i386/intelok.s @@ -168,10 +168,10 @@ start: mov eax, offset x mov eax, offset flat:x - mov eax, flat:x + mov eax, offset gs:x mov eax, offset [x] mov eax, offset flat:[x] - mov eax, flat:[x] + mov eax, offset gs:[x] mov eax, [offset x] mov eax, [eax + offset x] mov eax, [eax + offset 1] diff --git a/gas/testsuite/gas/i386/x86_64.s b/gas/testsuite/gas/i386/x86_64.s index 75d055a..34c8cdf 100644 --- a/gas/testsuite/gas/i386/x86_64.s +++ b/gas/testsuite/gas/i386/x86_64.s @@ -127,10 +127,10 @@ mov symbol(%rip), %eax .intel_syntax noprefix #immediates - various sizes: -mov al, flat:symbol -mov ax, flat:symbol -mov eax, flat:symbol -mov rax, flat:symbol +mov al, offset flat:symbol +mov ax, offset flat:symbol +mov eax, offset flat:symbol +mov rax, offset flat:symbol #parts aren't supported by the parser, yet (and not at all for symbol refs) #mov eax, high part symbol -- cgit v1.1