mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 05:32:19 +02:00
Use BX register instead of AX to reload DS at proc entry if register convention is used
git-svn-id: trunk@34024 -
This commit is contained in:
parent
8058f6b301
commit
fb50d0860b
@ -1688,7 +1688,7 @@ unit cgx86;
|
||||
which might trigger a range check error as
|
||||
reference_reset_base expects a longint value. }
|
||||
{$push} {$R-}{$Q-}
|
||||
al := longint (a);
|
||||
al := longint (a);
|
||||
{$pop}
|
||||
reference_reset_base(href,src,al,0);
|
||||
list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst));
|
||||
@ -3091,8 +3091,18 @@ unit cgx86;
|
||||
list.concat(Taicpu.op_reg(A_PUSH,S_W,NR_DS));
|
||||
reference_reset(fardataseg,0);
|
||||
fardataseg.refaddr:=addr_fardataseg;
|
||||
list.concat(Taicpu.Op_ref_reg(A_MOV,S_W,fardataseg,NR_AX));
|
||||
list.concat(Taicpu.Op_reg_reg(A_MOV,S_W,NR_AX,NR_DS));
|
||||
if current_procinfo.procdef.proccalloption=pocall_register then
|
||||
begin
|
||||
{ Use BX register if using register convention
|
||||
as it is not a register used to store parameters }
|
||||
list.concat(Taicpu.Op_ref_reg(A_MOV,S_W,fardataseg,NR_BX));
|
||||
list.concat(Taicpu.Op_reg_reg(A_MOV,S_W,NR_BX,NR_DS));
|
||||
end
|
||||
else
|
||||
begin
|
||||
list.concat(Taicpu.Op_ref_reg(A_MOV,S_W,fardataseg,NR_AX));
|
||||
list.concat(Taicpu.Op_reg_reg(A_MOV,S_W,NR_AX,NR_DS));
|
||||
end;
|
||||
end;
|
||||
{ SI and DI are volatile in the BP7 and FPC's pascal calling convention,
|
||||
but must be preserved in Microsoft C's pascal calling convention, and
|
||||
|
Loading…
Reference in New Issue
Block a user