* x86 assembler: write REX prefix before the first literal byte of instruction (this becomes possible once the instruction table has all $66,$F2,$F3 prefixes changed to non-literal control codes). This way it is no longer necessary to manually specify position of REX in every instruction entry (code \323 becomes obsolete), and the situation when REX is not written (IE 200603191) is hopefully gone forever.

git-svn-id: trunk@17456 -
This commit is contained in:
sergei 2011-05-14 16:02:31 +00:00
parent 3064726d71
commit 86d0c7f4c5

View File

@ -2080,6 +2080,9 @@ implementation
break; break;
1,2,3 : 1,2,3 :
begin begin
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
objdata.writebytes(codes^,c); objdata.writebytes(codes^,c);
inc(codes,c); inc(codes,c);
end; end;
@ -2118,6 +2121,9 @@ implementation
end; end;
8,9,10 : 8,9,10 :
begin begin
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
bytes[0]:=ord(codes^)+regval(oper[c-8]^.reg); bytes[0]:=ord(codes^)+regval(oper[c-8]^.reg);
inc(codes); inc(codes);
objdata.writebytes(bytes,1); objdata.writebytes(bytes,1);
@ -2259,30 +2265,18 @@ implementation
Message(asmw_e_64bit_not_supported); Message(asmw_e_64bit_not_supported);
{$endif x86_64} {$endif x86_64}
end; end;
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
end; end;
211, 211,
213 : 213 : {no action needed};
begin
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
end;
212, 241 : 212, 241 :
begin begin
bytes[0]:=$66; bytes[0]:=$66;
objdata.writebytes(bytes,1); objdata.writebytes(bytes,1);
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
end; end;
214 : 214 :
begin begin
{$ifdef x86_64} {$ifndef x86_64}
maybewriterex;
{$else x86_64}
Message(asmw_e_64bit_not_supported); Message(asmw_e_64bit_not_supported);
{$endif x86_64} {$endif x86_64}
end; end;
@ -2290,17 +2284,11 @@ implementation
begin begin
bytes[0]:=$f3; bytes[0]:=$f3;
objdata.writebytes(bytes,1); objdata.writebytes(bytes,1);
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
end; end;
220 : 220 :
begin begin
bytes[0]:=$f2; bytes[0]:=$f2;
objdata.writebytes(bytes,1); objdata.writebytes(bytes,1);
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
end; end;
221: 221:
; ;
@ -2309,11 +2297,7 @@ implementation
217,218 : 217,218 :
begin begin
{ these are dissambler hints or 32 bit prefixes which { these are dissambler hints or 32 bit prefixes which
are not needed are not needed }
It's useful to write rex :) (FK) }
{$ifdef x86_64}
maybewriterex;
{$endif x86_64}
end; end;
31, 31,
48,49,50 : 48,49,50 :