mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 18:09:27 +02:00
amunits: new HookEntryPas function, to support hooks using the Register calling convention. It is actually advised to use cdecl functions instead.
git-svn-id: trunk@34829 -
This commit is contained in:
parent
38837ee973
commit
f31cefd240
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user