Naked 64-bit asm functions in Delphi and FPC

1.1k views Asked by At

Are FPC's nostackframe and Delphi's .NOFRAME directive exactly equivalent in 64-bit asm functions?

In other words does the next code template

procedure Naked(SomeArg: Integer);{$IFDEF FPC}nostackframe;{$ENDIF}
asm
{$IFNDEF FPC}
        .NOFRAME
{$ENDIF}
  ..
end;

generates identical naked 64-bit asm functions in Delphi and FPC?

1

There are 1 answers

1
PhiS On

As far as I've been able to determine, both .NOFRAME (Delphi) and nostackframe (FPC) do the same thing, i.e. prevent the generation of a stack frame. Note however that the conditions under which they take effect might not be identical in the two compilers.

For source code compatibility, also use {$ASMMODE INTEL} for FPC.

For the most part, FPC64 and DCC64 asm use the same syntax, but in some rare cases, there are some differences in what syntax the inline assemblers understand. Also be aware that non-Windows x64 platforms use different calling conventions.