CALL instruction in assembler procedures wrongly preserves EBX registers
Original Reporter info from Mantis: laaca@seznam.cz
-
Reporter name: Ladislav Lacina
Original Reporter info from Mantis: laaca@seznam.cz
- Reporter name: Ladislav Lacina
Description:
I have a procedure with "assembler" modifier and call from such procedure another procedure with "assembler". In this situation is wrongly preserved the EBX register.
This situation occurs in OLDFPCCALL calling mode. Not sure about new calling mode.
Steps to reproduce:
{$CALLING OLDFPCCALL}
var global_x, global_y:longint;
Procedure clipping;assembler;
{INPUT:
in EAX expects X coordinate
in EBX expects Y coordinate
OUTPUT:
in EAX modified X coord.
in EBX modifies Y coord.
}
asm
add eax,100
add ebx,100
end;
procedure dummy_draw(x,y:longint);assembler;
asm
mov eax,x
mov ebx,y
call clipping {??? Why now in EBX is not the new value but the old one ???}
mov global_x,eax
mov global_y,ebx
end;
---main---
begin
dummy_draw(1,2);
writeln('X: ',global_x); {prints "101" which is correct}
writeln('Y: ',global_y); {prints "2" but should print "102" instead}
end.
Mantis conversion info:
- Mantis ID: 29083
- OS: all
- Platform: all
- Version: 3.0.0
- Fixed in version: 3.1.1
- Fixed in revision: 32542 (#1b965e67),32608 (#5709127a)
- Monitored by: » laaca@seznam.cz (Ladislav Lacina)