From c0119497653383e5730bc53adadc104c13223ead Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 19 Aug 2011 12:56:26 +0000 Subject: [PATCH] + iretq for x86_64 git-svn-id: trunk@18273 - --- .gitattributes | 1 + compiler/i386/i386att.inc | 1 + compiler/i386/i386atts.inc | 1 + compiler/i386/i386int.inc | 1 + compiler/i386/i386op.inc | 1 + compiler/i386/i386prop.inc | 1 + compiler/x86/x86ins.dat | 4 ++++ compiler/x86_64/x8664ats.inc | 1 + compiler/x86_64/x8664att.inc | 1 + compiler/x86_64/x8664int.inc | 1 + compiler/x86_64/x8664nop.inc | 2 +- compiler/x86_64/x8664op.inc | 1 + compiler/x86_64/x8664pro.inc | 1 + compiler/x86_64/x8664tab.inc | 7 +++++++ tests/tbs/tb0580.pp | 30 ++++++++++++++++++++++++++++++ 15 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tests/tbs/tb0580.pp diff --git a/.gitattributes b/.gitattributes index 6ea6506a41..aa20c919ba 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/i386/i386att.inc b/compiler/i386/i386att.inc index c9dfb3275a..a591dad220 100644 --- a/compiler/i386/i386att.inc +++ b/compiler/i386/i386att.inc @@ -161,6 +161,7 @@ 'iret', 'iret', 'iretw', +'iretq', 'jcxz', 'jecxz', 'jrcxz', diff --git a/compiler/i386/i386atts.inc b/compiler/i386/i386atts.inc index 11d473453c..31bc9cd421 100644 --- a/compiler/i386/i386atts.inc +++ b/compiler/i386/i386atts.inc @@ -164,6 +164,7 @@ attsufNONE, attsufNONE, attsufNONE, attsufNONE, +attsufNONE, attsufINT, attsufNONE, attsufINT, diff --git a/compiler/i386/i386int.inc b/compiler/i386/i386int.inc index 66d9034d2f..b6cc4caa78 100644 --- a/compiler/i386/i386int.inc +++ b/compiler/i386/i386int.inc @@ -161,6 +161,7 @@ 'iret', 'iretd', 'iretw', +'iretq', 'jcxz', 'jecxz', 'jrcxz', diff --git a/compiler/i386/i386op.inc b/compiler/i386/i386op.inc index 891fc6c514..4070734e54 100644 --- a/compiler/i386/i386op.inc +++ b/compiler/i386/i386op.inc @@ -161,6 +161,7 @@ A_INVLPG, A_IRET, A_IRETD, A_IRETW, +A_IRETQ, A_JCXZ, A_JECXZ, A_JRCXZ, diff --git a/compiler/i386/i386prop.inc b/compiler/i386/i386prop.inc index e26ad6943c..bd5ada742c 100644 --- a/compiler/i386/i386prop.inc +++ b/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)), diff --git a/compiler/x86/x86ins.dat b/compiler/x86/x86ins.dat index 6e039d9818..59b02aa6d2 100644 --- a/compiler/x86/x86ins.dat +++ b/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 diff --git a/compiler/x86_64/x8664ats.inc b/compiler/x86_64/x8664ats.inc index 11d473453c..31bc9cd421 100644 --- a/compiler/x86_64/x8664ats.inc +++ b/compiler/x86_64/x8664ats.inc @@ -164,6 +164,7 @@ attsufNONE, attsufNONE, attsufNONE, attsufNONE, +attsufNONE, attsufINT, attsufNONE, attsufINT, diff --git a/compiler/x86_64/x8664att.inc b/compiler/x86_64/x8664att.inc index c9dfb3275a..a591dad220 100644 --- a/compiler/x86_64/x8664att.inc +++ b/compiler/x86_64/x8664att.inc @@ -161,6 +161,7 @@ 'iret', 'iret', 'iretw', +'iretq', 'jcxz', 'jecxz', 'jrcxz', diff --git a/compiler/x86_64/x8664int.inc b/compiler/x86_64/x8664int.inc index 66d9034d2f..b6cc4caa78 100644 --- a/compiler/x86_64/x8664int.inc +++ b/compiler/x86_64/x8664int.inc @@ -161,6 +161,7 @@ 'iret', 'iretd', 'iretw', +'iretq', 'jcxz', 'jecxz', 'jrcxz', diff --git a/compiler/x86_64/x8664nop.inc b/compiler/x86_64/x8664nop.inc index d862384b93..011999b15f 100644 --- a/compiler/x86_64/x8664nop.inc +++ b/compiler/x86_64/x8664nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -1214; +1215; diff --git a/compiler/x86_64/x8664op.inc b/compiler/x86_64/x8664op.inc index 891fc6c514..4070734e54 100644 --- a/compiler/x86_64/x8664op.inc +++ b/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, diff --git a/compiler/x86_64/x8664pro.inc b/compiler/x86_64/x8664pro.inc index e26ad6943c..bd5ada742c 100644 --- a/compiler/x86_64/x8664pro.inc +++ b/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)), diff --git a/compiler/x86_64/x8664tab.inc b/compiler/x86_64/x8664tab.inc index f0d3e18e5b..7873e14b7a 100644 --- a/compiler/x86_64/x8664tab.inc +++ b/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; diff --git a/tests/tbs/tb0580.pp b/tests/tbs/tb0580.pp new file mode 100644 index 0000000000..60a4a33170 --- /dev/null +++ b/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.