diff --git a/packages/amunits/src/coreunits/amigalib.pas b/packages/amunits/src/coreunits/amigalib.pas index 3b52de77b0..3d1fe6c552 100644 --- a/packages/amunits/src/coreunits/amigalib.pas +++ b/packages/amunits/src/coreunits/amigalib.pas @@ -399,9 +399,9 @@ end; { Do *NOT* change this to nostackframe! } { The compiler will build a stackframe with link/unlk. So that will actually correct - the stackpointer for both Pascal/StdCall and cdecl functions, so the stackpointer will - be correct on exit. It also needs no manual RTS. The argument push order is also - correct for both. (KB) } + the stackpointer for both Pascal/StdCall and Cdecl functions, so the stackpointer + will be correct on exit. It also needs no manual RTS. The argument push order is + also correct for both. (KB) } procedure HookEntry; assembler; asm move.l a1,-(a7) // Msg @@ -411,6 +411,21 @@ asm jsr (a0) // Call the SubEntry end; +{ This is to be used with when the subentry function uses FPC's register calling + convention, also see the comments above HookEntry. It is advised to actually + declare Hook functions with cdecl instead of using this function, especially + when writing code which is platform independent. (KB) } +procedure HookEntryPas; assembler; +asm + move.l a2,-(a7) + move.l a1,-(a7) // Msg + move.l a2,a1 // Obj + // PHook is in a0 already + move.l 12(a0),a2 // h_SubEntry = Offset 12 + jsr (a2) // Call the SubEntry + move.l (a7)+,a2 +end; + procedure printf(Fmtstr : pchar; const Args : array of const); var i,j : longint;