Răsfoiți Sursa

+ no rex.w prefix support

git-svn-id: trunk@3037 -
florian 19 ani în urmă
părinte
comite
5519158dff

+ 10 - 10
compiler/i386/i386tab.inc

@@ -2951,7 +2951,7 @@
     opcode  : A_MOV;
     ops     : 2;
     optypes : (ot_reg32 or ot_bits64,ot_immediate,ot_none);
-    code    : #208#8#184#33;
+    code    : #208#8#184#29;
     flags   : if_386 or if_sd
   ),
   (
@@ -4470,14 +4470,14 @@
     opcode  : A_POP;
     ops     : 1;
     optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none);
-    code    : #208#8#88;
+    code    : #208#8#88#221;
     flags   : if_8086
   ),
   (
     opcode  : A_POP;
     ops     : 1;
     optypes : (ot_regmem or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none);
-    code    : #208#192#1#143#128;
+    code    : #208#192#1#143#128#221;
     flags   : if_8086
   ),
   (
@@ -4498,7 +4498,7 @@
     opcode  : A_POP;
     ops     : 1;
     optypes : (ot_reg_fsgs,ot_none,ot_none);
-    code    : #1#15#5;
+    code    : #1#15#5#221;
     flags   : if_386
   ),
   (
@@ -5310,42 +5310,42 @@
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none);
-    code    : #208#8#80;
+    code    : #208#8#80#221;
     flags   : if_8086
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_regmem or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none);
-    code    : #208#192#1#255#134;
+    code    : #208#192#1#255#134#221;
     flags   : if_8086
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_immediate or ot_bits32,ot_none,ot_none);
-    code    : #213#1#104#32;
+    code    : #213#1#104#32#221;
     flags   : if_386
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_immediate or ot_bits16,ot_none,ot_none);
-    code    : #212#1#104#24;
+    code    : #212#1#104#24#221;
     flags   : if_286
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_immediate or ot_bits8 or ot_signed,ot_none,ot_none);
-    code    : #1#106#12;
+    code    : #1#106#12#221;
     flags   : if_286
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_reg_fsgs,ot_none,ot_none);
-    code    : #1#15#7;
+    code    : #1#15#7#221;
     flags   : if_386 or if_nox86_64
   ),
   (

+ 15 - 0
compiler/x86/aasmcpu.pas

@@ -1793,6 +1793,18 @@ implementation
             217,218: ;
             219,220 :
               inc(len);
+            221:
+{$ifdef x86_64}
+              { remove rex competely? }
+              if rex=$48 then
+                begin
+                  rex:=0;
+                  dec(len);
+                end
+              else
+                rex:=rex and $f7
+{$endif x86_64}
+              ;
             64..191 :
               begin
 {$ifdef x86_64}
@@ -1865,6 +1877,7 @@ implementation
        * \327          - indicates that this instruction is only valid when the
        *                 operand size is the default (instruction to disassembler,
        *                 generates no code in the assembler)
+       * \335          - removes rex size prefix, i.e. rex.w must be the last opcode
       }
 
       var
@@ -2141,6 +2154,8 @@ implementation
                 bytes[0]:=$f2;
                 objdata.writebytes(bytes,1);
               end;
+            221:
+              ;
             201,
             202,
             213,

+ 9 - 9
compiler/x86/x86ins.dat

@@ -1452,11 +1452,11 @@ mmxreg,mem            \301\2\x0F\x58\110              PENT,MMX,SM,CYRIX
 
 [POP,popX]
 (Ch_Wop1, Ch_RWESP, Ch_None)
-reg16|32|64           \320\10\x58                     8086
-rm16|32|64            \320\300\1\x8F\200              8086
+reg16|32|64           \320\10\x58\335                 8086
+rm16|32|64            \320\300\1\x8F\200\335          8086
 reg_cs                \1\x0F                          8086,UNDOC,ND
 reg_dess              \4                              8086
-reg_fsgs              \1\x0F\5                        386
+reg_fsgs              \1\x0F\5\335                    386
 
 [POPA,popaX]
 (Ch_All, Ch_None, Ch_None)
@@ -1671,12 +1671,12 @@ xmmreg,xmmreg         \3\x66\x0F\x61\110              WILLAMETTE,SSE2
 
 [PUSH,pushX]
 (Ch_Rop1, Ch_RWESP, Ch_None)
-reg16|32|64           \320\10\x50                     8086
-rm16|32|64            \320\300\1\xFF\206              8086
-imm32                 \325\1\x68\40                   386
-imm16                 \324\1\x68\30                   286
-imm8                  \1\x6A\14                       286
-reg_fsgs              \1\x0F\7                        386,NOX86_64
+reg16|32|64           \320\10\x50\335                 8086
+rm16|32|64            \320\300\1\xFF\206\335          8086
+imm32                 \325\1\x68\40\335               386
+imm16                 \324\1\x68\30\335               286
+imm8                  \1\x6A\14\335                   286
+reg_fsgs              \1\x0F\7\335                    386,NOX86_64
 reg_sreg              \6                              8086,NOX86_64
 
 [PUSHA,pushaX]

+ 5 - 5
compiler/x86_64/x8664tab.inc

@@ -5289,35 +5289,35 @@
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none);
-    code    : #208#8#80;
+    code    : #208#8#80#221;
     flags   : if_8086
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_regmem or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none);
-    code    : #208#192#1#255#134;
+    code    : #208#192#1#255#134#221;
     flags   : if_8086
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_immediate or ot_bits32,ot_none,ot_none);
-    code    : #213#1#104#32;
+    code    : #213#1#104#32#221;
     flags   : if_386
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_immediate or ot_bits16,ot_none,ot_none);
-    code    : #212#1#104#24;
+    code    : #212#1#104#24#221;
     flags   : if_286
   ),
   (
     opcode  : A_PUSH;
     ops     : 1;
     optypes : (ot_immediate or ot_bits8 or ot_signed,ot_none,ot_none);
-    code    : #1#106#12;
+    code    : #1#106#12#221;
     flags   : if_286
   ),
   (