When writing a Delphi procedure or function in assembly code, which registers must be saved and restored to the original value at the end of the procedure?
When calling another Delphi procedure or function from (inline) assembly code, what can I expect that other function to do with the registers? Which registers will be restored to their original values and which may not?
(Obviously, the same answer would apply to both questions)
I am assuming the default calling convention of Delphi. I know that EAX
is used for 32-bit return values. And looking at the asm code in SysUtils.pas, it seems that EBX
, ESI
and EDI
are pushed and restored, but the others are not. I cannot find any documentation about this, though.