gas/
authorJan Beulich <jbeulich@novell.com>
Wed, 13 Feb 2008 13:41:26 +0000 (13:41 +0000)
committerJan Beulich <jbeulich@novell.com>
Wed, 13 Feb 2008 13:41:26 +0000 (13:41 +0000)
2008-02-13  Jan Beulich  <jbeulich@novell.com>

* 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  <jbeulich@novell.com>

* gas/i386/intelok.s: Replace invalid offset expression with
valid ones.
* gas/i386/x86_64.s: Likewise.

opcodes/
2008-02-13  Jan Beulich  <jbeulich@novell.com>

* i386-opc.h (RegFlat): New.
* i386-reg.tbl (flat): Add.
* i386-tbl.h: Re-generate.

gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/intelok.s
gas/testsuite/gas/i386/x86_64.s
opcodes/ChangeLog
opcodes/i386-opc.h
opcodes/i386-reg.tbl
opcodes/i386-tbl.h

index 952ee0772014f6b09b266dccb6c36f41a1eb4b11..cd82737ca0ef54b88f23b4ecf449deed489c3ef6 100644 (file)
@@ -1,3 +1,14 @@
+2008-02-13  Jan Beulich  <jbeulich@novell.com>
+
+       * 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  <jbeulich@novell.com>
 
        * config/tc-i386.c (intel_e09): Also special-case 'bound'.
index ccb46ae6bc9dbf5b0c19439a67936dbc29962e09..cc5b200e2c0cb19151eb4e17e3bb2960471c32f5 100644 (file)
@@ -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;
        }
index c924af14a8b982673c4f1a98d810291c87d53780..da2e733cae1bd070f8d7d95db8393204d472ad7f 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-13  Jan Beulich  <jbeulich@novell.com>
+
+       * gas/i386/intelok.s: Replace invalid offset expression with
+       valid ones.
+       * gas/i386/x86_64.s: Likewise.
+
 2008-02-13  Jan Beulich  <jbeulich@novell.com>
 
        * gas/i386/intelbad.s, gas/i386/intelok.s: Add 'bound' tests.
index 5916b035ea22afc6b8e7cc14107efc0f354b38e1..2f78929d1b8200a1b7d2ef9adb77d1c470b17f2c 100644 (file)
@@ -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]
index 75d055ab7c0d92c9522643d7e6bea6d0380a9de4..34c8cdf8f2db4dae7d694d41ee19be0795215509 100644 (file)
@@ -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
index a2d9646e18c8b65807e93437d88cd094d6bb9513..d6a245a8c25322c176df070e6a7ca4618ca9f2f6 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-13  Jan Beulich  <jbeulich@novell.com>
+
+       * i386-opc.h (RegFlat): New.
+       * i386-reg.tbl (flat): Add.
+       * i386-tbl.h: Re-generate.
+
 2008-02-13  Jan Beulich  <jbeulich@novell.com>
 
        * i386-dis.c (a_mode): New.
index 95c315b972391f2cdf9a6c86415a855522a18410..d66f02bbbde7208b35a7b99bff9231240c263f6c 100644 (file)
@@ -501,6 +501,8 @@ typedef struct
 /* EIZ and RIZ are fake index registers.  */
 #define RegEiz (RegEip - 1)
 #define RegRiz (RegEiz - 1)
+/* FLAT is a fake segment register (Intel mode).  */
+#define RegFlat     ((unsigned char) ~0)
   signed char dw2_regnum[2];
 #define Dw2Inval (-1)
 }
index 11f2ee74a92048bd24a182ca089ba852c3a4e05a..6aa89fc4d9479caa6f1399c917c21a9acff152fd 100644 (file)
@@ -103,6 +103,7 @@ ss, SReg2, 0, 2, 42, 52
 ds, SReg2, 0, 3, 43, 53
 fs, SReg3, 0, 4, 44, 54
 gs, SReg3, 0, 5, 45, 55
+flat, SReg3, 0, RegFlat, Dw2Inval, Dw2Inval
 // Control registers.
 cr0, Control, 0, 0, Dw2Inval, Dw2Inval
 cr1, Control, 0, 1, Dw2Inval, Dw2Inval
index 13ad14fc28d3bc24e264ae81a304c0a9170866a0..36399b532c8398baea4fdf74701d960e478c0521 100644 (file)
@@ -17385,6 +17385,11 @@ const reg_entry i386_regtab[] =
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0 } },
     0, 5, { 45, 55 } },
+  { "flat",
+    { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0 } },
+    0, RegFlat, { Dw2Inval, Dw2Inval } },
   { "cr0",
     { { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
This page took 0.048032 seconds and 4 git commands to generate.