Forráskód Böngészése

x86 assembler:
* Adjust rip-relative offsets using values known from calcsize, instead of reinterpreting the tail of instruction. This is simpler and remains the same regardless of particular codes used in opcode table.
* Reduced maxinfolen to 8.
- 'jmp imm64' and 64-bit versions of 'in' do not exist, removed.

git-svn-id: trunk@17546 -

sergei 14 éve
szülő
commit
d89aeeadaf

+ 3 - 3
compiler/i386/i386tab.inc

@@ -2369,7 +2369,7 @@
   (
     opcode  : A_IN;
     ops     : 2;
-    optypes : (ot_reg_ax or ot_bits32 or ot_bits64,ot_immediate,ot_none);
+    optypes : (ot_reg_ax or ot_bits32,ot_immediate,ot_none);
     code    : #208#1#229#21;
     flags   : if_8086 or if_sb
   ),
@@ -2383,7 +2383,7 @@
   (
     opcode  : A_IN;
     ops     : 2;
-    optypes : (ot_reg_ax or ot_bits32 or ot_bits64,ot_reg_dx,ot_none);
+    optypes : (ot_reg_ax or ot_bits32,ot_reg_dx,ot_none);
     code    : #208#1#237;
     flags   : if_8086
   ),
@@ -2530,7 +2530,7 @@
   (
     opcode  : A_JMP;
     ops     : 1;
-    optypes : (ot_immediate or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none);
+    optypes : (ot_immediate or ot_bits16 or ot_bits32,ot_none,ot_none);
     code    : #208#1#233#52;
     flags   : if_8086 or if_pass2
   ),

+ 4 - 11
compiler/x86/aasmcpu.pas

@@ -172,7 +172,7 @@ interface
 {$else x86_64}
       instabentries = {$i i386nop.inc}
 {$endif x86_64}
-      maxinfolen    = 11;
+      maxinfolen    = 8;
       MaxInsChanges = 3; { Max things a instruction can change }
 
     type
@@ -2358,17 +2358,10 @@ implementation
                            if oper[opidx]^.ref^.base=NR_RIP then
                              begin
                                currabsreloc:=RELOC_RELATIVE;
-                               { Adjust reloc value depending of immediate operand size,
-                                 but not if offset is specified by literal constant }
+                               { Adjust reloc value by number of bytes following the displacement,
+                                 but not if displacement is specified by literal constant }
                                if Assigned(currsym) then
-                                 case Ord(codes^) of
-                                   12,13,14,16,17,18,20,21,22:
-                                     Dec(currval, 1);
-                                   24,25,26:
-                                     Dec(currval, 2);
-                                   32,33,34,172,173,174:
-                                     Dec(currval, 4);
-                                 end;
+                                 Dec(currval,InsEnd-objdata.CurrObjSec.Size-ea_data.bytes);
                              end
                            else
 {$endif x86_64}

+ 4 - 3
compiler/x86/x86ins.dat

@@ -792,12 +792,13 @@ reg16,imm8            \324\1\x6B\100\15               286
 reg16,imm             \324\1\x69\100\31               286,SW
 rm8                   \1\xF6\205                      8086
 
+; 64-bit variant does not exist
 [IN,inX]
 (Ch_Wop2, Ch_Rop1, Ch_None)
 reg_al,imm            \1\xE4\25                       8086,SB
-reg_ax|32|64,imm      \320\1\xE5\25                   8086,SB
+reg_ax|32,imm         \320\1\xE5\25                   8086,SB
 reg_al,reg_dx         \1\xEC                          8086
-reg_ax|32|64,reg_dx   \320\1\xED                      8086
+reg_ax|32,reg_dx      \320\1\xED                      8086
 
 [INC,incX]
 (Ch_Mop1, Ch_WFlags, Ch_None)
@@ -876,7 +877,7 @@ imm                   \1\xE3\50                       X86_64
 [JMP,jmpX]
 (Ch_ROp1, Ch_None, Ch_None)
 imm8                  \1\xEB\50                       8086,PASS2
-imm16|32|64           \320\1\xE9\64                   8086,PASS2
+imm16|32              \320\1\xE9\64                   8086,PASS2
 rm16|32|64            \320\1\xFF\204                  8086
 imm|short             \1\xEB\50                       8086,PASS2
 imm|near              \320\1\xE9\64                   8086,ND,PASS2

+ 3 - 3
compiler/x86_64/x8664tab.inc

@@ -2306,7 +2306,7 @@
   (
     opcode  : A_IN;
     ops     : 2;
-    optypes : (ot_reg_ax or ot_bits32 or ot_bits64,ot_immediate,ot_none);
+    optypes : (ot_reg_ax or ot_bits32,ot_immediate,ot_none);
     code    : #208#1#229#21;
     flags   : if_8086 or if_sb
   ),
@@ -2320,7 +2320,7 @@
   (
     opcode  : A_IN;
     ops     : 2;
-    optypes : (ot_reg_ax or ot_bits32 or ot_bits64,ot_reg_dx,ot_none);
+    optypes : (ot_reg_ax or ot_bits32,ot_reg_dx,ot_none);
     code    : #208#1#237;
     flags   : if_8086
   ),
@@ -2453,7 +2453,7 @@
   (
     opcode  : A_JMP;
     ops     : 1;
-    optypes : (ot_immediate or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none);
+    optypes : (ot_immediate or ot_bits16 or ot_bits32,ot_none,ot_none);
     code    : #208#1#233#52;
     flags   : if_8086 or if_pass2
   ),