mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 21:46:00 +02:00
+ x86 assembler: fixed MOVABS instruction (it is a x86_64-only subset of MOV with 8-byte immediates/offsets) and same-form encodings of MOV instruction.
git-svn-id: trunk@17666 -
This commit is contained in:
parent
aa064c569d
commit
354d0520b7
@ -1,2 +1,2 @@
|
|||||||
{ don't edit, this file is generated from x86ins.dat }
|
{ don't edit, this file is generated from x86ins.dat }
|
||||||
1202;
|
1203;
|
||||||
|
@ -2915,9 +2915,16 @@
|
|||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_mem_offs,ot_reg_ax or ot_bits32,ot_none);
|
optypes : (ot_mem_offs,ot_reg_ax,ot_none);
|
||||||
code : #208#1#163#28;
|
code : #212#1#163#36;
|
||||||
flags : if_8086 or if_sm or if_nox86_64
|
flags : if_8086 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_eax,ot_none);
|
||||||
|
code : #213#1#163#36;
|
||||||
|
flags : if_386 or if_sm
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
@ -2930,15 +2937,15 @@
|
|||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_reg_ax,ot_mem_offs,ot_none);
|
optypes : (ot_reg_ax,ot_mem_offs,ot_none);
|
||||||
code : #212#1#161#29;
|
code : #212#1#161#37;
|
||||||
flags : if_8086 or if_sm or if_nox86_64
|
flags : if_8086 or if_sm
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_reg_eax,ot_mem_offs,ot_none);
|
optypes : (ot_reg_eax,ot_mem_offs,ot_none);
|
||||||
code : #213#1#161#29;
|
code : #213#1#161#37;
|
||||||
flags : if_386 or if_sm or if_nox86_64
|
flags : if_386 or if_sm
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
@ -2950,8 +2957,8 @@
|
|||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_reg32 or ot_bits64,ot_immediate,ot_none);
|
optypes : (ot_reg32,ot_immediate,ot_none);
|
||||||
code : #208#8#184#29;
|
code : #213#8#184#33;
|
||||||
flags : if_386 or if_sd
|
flags : if_386 or if_sd
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -2979,8 +2986,8 @@
|
|||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_mem_offs,ot_reg_al,ot_none);
|
optypes : (ot_mem_offs,ot_reg_al,ot_none);
|
||||||
code : #1#162#28;
|
code : #1#162#36;
|
||||||
flags : if_8086 or if_sm or if_nox86_64
|
flags : if_8086 or if_sm
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
@ -2993,8 +3000,8 @@
|
|||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_reg_al,ot_mem_offs,ot_none);
|
optypes : (ot_reg_al,ot_mem_offs,ot_none);
|
||||||
code : #1#160#29;
|
code : #1#160#37;
|
||||||
flags : if_8086 or if_sm or if_nox86_64
|
flags : if_8086 or if_sm
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
|
@ -1767,14 +1767,15 @@ implementation
|
|||||||
else
|
else
|
||||||
inc(len,4);
|
inc(len,4);
|
||||||
end;
|
end;
|
||||||
|
36,37,38:
|
||||||
|
inc(len,sizeof(pint));
|
||||||
|
44,45,46:
|
||||||
|
inc(len,8);
|
||||||
32,33,34,
|
32,33,34,
|
||||||
52,53,54,
|
52,53,54,
|
||||||
56,57,58,
|
56,57,58,
|
||||||
172,173,174 :
|
172,173,174 :
|
||||||
inc(len,4);
|
inc(len,4);
|
||||||
192,193,194 :
|
|
||||||
if NeedAddrPrefix(c-192) then
|
|
||||||
inc(len);
|
|
||||||
208,209,210 :
|
208,209,210 :
|
||||||
begin
|
begin
|
||||||
case (oper[c-208]^.ot and OT_SIZE_MASK) of
|
case (oper[c-208]^.ot and OT_SIZE_MASK) of
|
||||||
@ -1884,7 +1885,10 @@ implementation
|
|||||||
* assembly mode or the address-size override on the operand
|
* assembly mode or the address-size override on the operand
|
||||||
* \37 - a word constant, from the _segment_ part of operand 0
|
* \37 - a word constant, from the _segment_ part of operand 0
|
||||||
* \40, \41, \42 - a long immediate operand, from operand 0, 1 or 2
|
* \40, \41, \42 - a long immediate operand, from operand 0, 1 or 2
|
||||||
|
* \44, \45, \46 - select between \3[012], \4[012] or \5[456] depending
|
||||||
|
on the address size of instruction
|
||||||
* \50, \51, \52 - a byte relative operand, from operand 0, 1 or 2
|
* \50, \51, \52 - a byte relative operand, from operand 0, 1 or 2
|
||||||
|
* \54, \55, \56 - a qword immediate, from operand 0, 1 or 2
|
||||||
* \60, \61, \62 - a word relative operand, from operand 0, 1 or 2
|
* \60, \61, \62 - a word relative operand, from operand 0, 1 or 2
|
||||||
* \64, \65, \66 - select between \6[012] and \7[012] depending on 16/32 bit
|
* \64, \65, \66 - select between \6[012] and \7[012] depending on 16/32 bit
|
||||||
* assembly mode or the address-size override on the operand
|
* assembly mode or the address-size override on the operand
|
||||||
@ -2170,6 +2174,21 @@ implementation
|
|||||||
else
|
else
|
||||||
objdata.writebytes(currval,4);
|
objdata.writebytes(currval,4);
|
||||||
end;
|
end;
|
||||||
|
36,37,38 : // 044..046 - select between word/dword/qword depending on
|
||||||
|
begin // address size (we support only default address sizes).
|
||||||
|
getvalsym(c-36);
|
||||||
|
{$ifdef x86_64}
|
||||||
|
if assigned(currsym) then
|
||||||
|
objdata_writereloc(currval,8,currsym,currabsreloc)
|
||||||
|
else
|
||||||
|
objdata.writebytes(currval,8);
|
||||||
|
{$else x86_64}
|
||||||
|
if assigned(currsym) then
|
||||||
|
objdata_writereloc(currval,4,currsym,currabsreloc32)
|
||||||
|
else
|
||||||
|
objdata.writebytes(currval,4);
|
||||||
|
{$endif x86_64}
|
||||||
|
end;
|
||||||
40,41,42 : // 050..052 - byte relative operand
|
40,41,42 : // 050..052 - byte relative operand
|
||||||
begin
|
begin
|
||||||
getvalsym(c-40);
|
getvalsym(c-40);
|
||||||
@ -2180,6 +2199,14 @@ implementation
|
|||||||
Message1(asmw_e_short_jmp_out_of_range,tostr(data));
|
Message1(asmw_e_short_jmp_out_of_range,tostr(data));
|
||||||
objdata.writebytes(data,1);
|
objdata.writebytes(data,1);
|
||||||
end;
|
end;
|
||||||
|
44,45,46: // 054..056 - qword immediate operand
|
||||||
|
begin
|
||||||
|
getvalsym(c-44);
|
||||||
|
if assigned(currsym) then
|
||||||
|
objdata_writereloc(currval,8,currsym,currabsreloc)
|
||||||
|
else
|
||||||
|
objdata.writebytes(currval,8);
|
||||||
|
end;
|
||||||
52,53,54 : // 064..066 - select between 16/32 address mode, but we support only 32
|
52,53,54 : // 064..066 - select between 16/32 address mode, but we support only 32
|
||||||
begin
|
begin
|
||||||
getvalsym(c-52);
|
getvalsym(c-52);
|
||||||
@ -2207,14 +2234,6 @@ implementation
|
|||||||
else
|
else
|
||||||
objdata.writebytes(currval,4);
|
objdata.writebytes(currval,4);
|
||||||
end;
|
end;
|
||||||
192,193,194 :
|
|
||||||
begin
|
|
||||||
if NeedAddrPrefix(c-192) then
|
|
||||||
begin
|
|
||||||
bytes[0]:=$67;
|
|
||||||
objdata.writebytes(bytes,1);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
200 : { fixed 16-bit addr }
|
200 : { fixed 16-bit addr }
|
||||||
{$ifndef x86_64}
|
{$ifndef x86_64}
|
||||||
begin
|
begin
|
||||||
|
@ -1024,19 +1024,23 @@ reg_eax,reg_ecx,reg_edx \3\x0F\x01\xC8 PRESCOTT,ND
|
|||||||
|
|
||||||
[MOV,movX]
|
[MOV,movX]
|
||||||
(Ch_Wop2, Ch_Rop1, Ch_None)
|
(Ch_Wop2, Ch_Rop1, Ch_None)
|
||||||
mem_offs,reg_ax|32 \320\1\xA3\34 8086,SM,NOX86_64
|
mem_offs,reg_ax \324\1\xA3\44 8086,SM
|
||||||
|
mem_offs,reg_eax \325\1\xA3\44 386,SM
|
||||||
|
mem_offs,reg_rax \326\1\xA3\44 X86_64,SM
|
||||||
regmem,reg16|32|64 \320\1\x89\101 8086,SM
|
regmem,reg16|32|64 \320\1\x89\101 8086,SM
|
||||||
reg_ax,mem_offs \324\1\xA1\35 8086,SM,NOX86_64
|
reg_ax,mem_offs \324\1\xA1\45 8086,SM
|
||||||
reg_eax,mem_offs \325\1\xA1\35 386,SM,NOX86_64
|
reg_eax,mem_offs \325\1\xA1\45 386,SM
|
||||||
|
reg_rax,mem_offs \326\1\xA1\45 X86_64,SM
|
||||||
reg16|32|64,regmem \320\1\x8B\110 8086,SM
|
reg16|32|64,regmem \320\1\x8B\110 8086,SM
|
||||||
reg32|64,imm \320\10\xB8\35 386,SD
|
reg32,imm \325\10\xB8\41 386,SD
|
||||||
|
reg64,imm \326\10\xB8\55 X86_64,SM
|
||||||
rm32,imm \325\1\xC7\200\41 386,SM
|
rm32,imm \325\1\xC7\200\41 386,SM
|
||||||
rm64,imm \326\1\xC7\200\255 X86_64,SM
|
rm64,imm \326\1\xC7\200\255 X86_64,SM
|
||||||
reg16,imm \324\10\xB8\31 8086,SW
|
reg16,imm \324\10\xB8\31 8086,SW
|
||||||
rm16,imm \324\1\xC7\200\31 8086,SW
|
rm16,imm \324\1\xC7\200\31 8086,SW
|
||||||
mem_offs,reg_al \1\xA2\34 8086,SM,NOX86_64
|
mem_offs,reg_al \1\xA2\44 8086,SM
|
||||||
rm8,reg8 \1\x88\101 8086
|
rm8,reg8 \1\x88\101 8086
|
||||||
reg_al,mem_offs \1\xA0\35 8086,SM,NOX86_64
|
reg_al,mem_offs \1\xA0\45 8086,SM
|
||||||
reg8,rm8 \1\x8A\110 8086,SM
|
reg8,rm8 \1\x8A\110 8086,SM
|
||||||
reg8,imm \10\xB0\21 8086,SB
|
reg8,imm \10\xB0\21 8086,SB
|
||||||
rm8,imm \1\xC6\200\21 8086,SB
|
rm8,imm \1\xC6\200\21 8086,SB
|
||||||
@ -3008,7 +3012,11 @@ void \2\x0F\x3A P6,CYRIX
|
|||||||
;
|
;
|
||||||
[MOVABS]
|
[MOVABS]
|
||||||
(Ch_Wop2, Ch_Rop1, Ch_None)
|
(Ch_Wop2, Ch_Rop1, Ch_None)
|
||||||
reg32,imm \325\10\xB8\41 X86_64
|
reg_al,mem_offs \1\xA0\45 X86_64,SM
|
||||||
|
reg_ax|32|64,mem_offs \320\1\xA1\45 X86_64,SM
|
||||||
|
mem_offs,reg_al \1\xA2\44 X86_64,SM
|
||||||
|
mem_offs,reg_ax|32|64 \321\xA3\44 X86_64,SM
|
||||||
|
reg64,imm \326\10\xB8\55 X86_64
|
||||||
|
|
||||||
[MOVSXD,movslq]
|
[MOVSXD,movslq]
|
||||||
(Ch_Wop2, Ch_Rop1, Ch_None)
|
(Ch_Wop2, Ch_Rop1, Ch_None)
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
{ don't edit, this file is generated from x86ins.dat }
|
{ don't edit, this file is generated from x86ins.dat }
|
||||||
1199;
|
1212;
|
||||||
|
@ -2758,6 +2758,27 @@
|
|||||||
code : #3#15#1#200;
|
code : #3#15#1#200;
|
||||||
flags : if_prescott
|
flags : if_prescott
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_ax,ot_none);
|
||||||
|
code : #212#1#163#36;
|
||||||
|
flags : if_8086 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_eax,ot_none);
|
||||||
|
code : #213#1#163#36;
|
||||||
|
flags : if_386 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_rax,ot_none);
|
||||||
|
code : #214#1#163#36;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
@ -2765,6 +2786,27 @@
|
|||||||
code : #208#1#137#65;
|
code : #208#1#137#65;
|
||||||
flags : if_8086 or if_sm
|
flags : if_8086 or if_sm
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg_ax,ot_mem_offs,ot_none);
|
||||||
|
code : #212#1#161#37;
|
||||||
|
flags : if_8086 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg_eax,ot_mem_offs,ot_none);
|
||||||
|
code : #213#1#161#37;
|
||||||
|
flags : if_386 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg_rax,ot_mem_offs,ot_none);
|
||||||
|
code : #214#1#161#37;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
@ -2775,10 +2817,17 @@
|
|||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_reg32 or ot_bits64,ot_immediate,ot_none);
|
optypes : (ot_reg32,ot_immediate,ot_none);
|
||||||
code : #208#8#184#29;
|
code : #213#8#184#33;
|
||||||
flags : if_386 or if_sd
|
flags : if_386 or if_sd
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg64,ot_immediate,ot_none);
|
||||||
|
code : #214#8#184#45;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
@ -2807,6 +2856,13 @@
|
|||||||
code : #212#1#199#128#25;
|
code : #212#1#199#128#25;
|
||||||
flags : if_8086 or if_sw
|
flags : if_8086 or if_sw
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_al,ot_none);
|
||||||
|
code : #1#162#36;
|
||||||
|
flags : if_8086 or if_sm
|
||||||
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
@ -2814,6 +2870,13 @@
|
|||||||
code : #1#136#65;
|
code : #1#136#65;
|
||||||
flags : if_8086
|
flags : if_8086
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOV;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg_al,ot_mem_offs,ot_none);
|
||||||
|
code : #1#160#37;
|
||||||
|
flags : if_8086 or if_sm
|
||||||
|
),
|
||||||
(
|
(
|
||||||
opcode : A_MOV;
|
opcode : A_MOV;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
@ -7563,8 +7626,36 @@
|
|||||||
(
|
(
|
||||||
opcode : A_MOVABS;
|
opcode : A_MOVABS;
|
||||||
ops : 2;
|
ops : 2;
|
||||||
optypes : (ot_reg32,ot_immediate,ot_none);
|
optypes : (ot_reg_al,ot_mem_offs,ot_none);
|
||||||
code : #213#8#184#33;
|
code : #1#160#37;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOVABS;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg_ax or ot_bits32 or ot_bits64,ot_mem_offs,ot_none);
|
||||||
|
code : #208#1#161#37;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOVABS;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_al,ot_none);
|
||||||
|
code : #1#162#36;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOVABS;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_mem_offs,ot_reg_ax or ot_bits32 or ot_bits64,ot_none);
|
||||||
|
code : #209#163#36;
|
||||||
|
flags : if_x86_64 or if_sm
|
||||||
|
),
|
||||||
|
(
|
||||||
|
opcode : A_MOVABS;
|
||||||
|
ops : 2;
|
||||||
|
optypes : (ot_reg64,ot_immediate,ot_none);
|
||||||
|
code : #214#8#184#45;
|
||||||
flags : if_x86_64
|
flags : if_x86_64
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user