浏览代码

+ iretq for x86_64

git-svn-id: trunk@18273 -
florian 14 年之前
父节点
当前提交
c011949765

+ 1 - 0
.gitattributes

@@ -9140,6 +9140,7 @@ tests/tbs/tb0577.pp svneol=native#text/plain
 tests/tbs/tb0577a.pp svneol=native#text/plain
 tests/tbs/tb0578.pp svneol=native#text/pascal
 tests/tbs/tb0579.pp svneol=native#text/pascal
+tests/tbs/tb0580.pp svneol=native#text/pascal
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain

+ 1 - 0
compiler/i386/i386att.inc

@@ -161,6 +161,7 @@
 'iret',
 'iret',
 'iretw',
+'iretq',
 'jcxz',
 'jecxz',
 'jrcxz',

+ 1 - 0
compiler/i386/i386atts.inc

@@ -164,6 +164,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufINT,
 attsufNONE,
 attsufINT,

+ 1 - 0
compiler/i386/i386int.inc

@@ -161,6 +161,7 @@
 'iret',
 'iretd',
 'iretw',
+'iretq',
 'jcxz',
 'jecxz',
 'jrcxz',

+ 1 - 0
compiler/i386/i386op.inc

@@ -161,6 +161,7 @@ A_INVLPG,
 A_IRET,
 A_IRETD,
 A_IRETW,
+A_IRETQ,
 A_JCXZ,
 A_JECXZ,
 A_JRCXZ,

+ 1 - 0
compiler/i386/i386prop.inc

@@ -161,6 +161,7 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_RECX, Ch_None, Ch_None)),
 (Ch: (Ch_RECX, Ch_None, Ch_None)),
 (Ch: (Ch_RECX, Ch_None, Ch_None)),

+ 4 - 0
compiler/x86/x86ins.dat

@@ -862,6 +862,10 @@ void                  \325\1\xCF                      386
 (Ch_All, Ch_None, Ch_None)
 void                  \324\1\xCF                      8086
 
+[IRETQ]
+(Ch_All, Ch_None, Ch_None)
+void                  \326\1\xCF                      X86_64
+
 [JCXZ]
 (Ch_RECX, Ch_None, Ch_None)
 imm                   \310\1\xE3\50                   8086,NOX86_64

+ 1 - 0
compiler/x86_64/x8664ats.inc

@@ -164,6 +164,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufINT,
 attsufNONE,
 attsufINT,

+ 1 - 0
compiler/x86_64/x8664att.inc

@@ -161,6 +161,7 @@
 'iret',
 'iret',
 'iretw',
+'iretq',
 'jcxz',
 'jecxz',
 'jrcxz',

+ 1 - 0
compiler/x86_64/x8664int.inc

@@ -161,6 +161,7 @@
 'iret',
 'iretd',
 'iretw',
+'iretq',
 'jcxz',
 'jecxz',
 'jrcxz',

+ 1 - 1
compiler/x86_64/x8664nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1214;
+1215;

+ 1 - 0
compiler/x86_64/x8664op.inc

@@ -161,6 +161,7 @@ A_INVLPG,
 A_IRET,
 A_IRETD,
 A_IRETW,
+A_IRETQ,
 A_JCXZ,
 A_JECXZ,
 A_JRCXZ,

+ 1 - 0
compiler/x86_64/x8664pro.inc

@@ -161,6 +161,7 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_RECX, Ch_None, Ch_None)),
 (Ch: (Ch_RECX, Ch_None, Ch_None)),
 (Ch: (Ch_RECX, Ch_None, Ch_None)),

+ 7 - 0
compiler/x86_64/x8664tab.inc

@@ -2429,6 +2429,13 @@
     code    : #212#1#207;
     flags   : if_8086
   ),
+  (
+    opcode  : A_IRETQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #214#1#207;
+    flags   : if_x86_64
+  ),
   (
     opcode  : A_JECXZ;
     ops     : 1;

+ 30 - 0
tests/tbs/tb0580.pp

@@ -0,0 +1,30 @@
+{ %cpu=i386,x86_64 }
+procedure p;assembler;nostackframe;
+asm
+  iret
+  iretw
+{$ifdef cpux86_64}
+  iretq
+{$endif cpux86_64}
+end;
+
+
+const
+  test_expected : array[0..2{$ifdef cpux86_64}+2{$ifdef cpux86_64}] of byte = (
+    $CF,$66,$CF{$ifdef cpux86_64},$48,$cf{$endif cpux86_64});
+
+var
+  i : longint;
+
+
+begin
+  for i:=0 to high(test_expected) do
+    if test_expected[i]<>pbyte(@p)[i] then
+      begin
+        writeln('mismatch at offset $',hexstr(i,4), ', expected=$',
+          hexstr(test_expected[i],2),' actual=$',hexstr(pbyte(@p)[i],2));
+        halt(1);
+      end;
+  writeln('ok');
+end.
+end.