mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 01:09:25 +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! }
|
{ Do *NOT* change this to nostackframe! }
|
||||||
{ The compiler will build a stackframe with link/unlk. So that will actually correct
|
{ 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
|
the stackpointer for both Pascal/StdCall and Cdecl functions, so the stackpointer
|
||||||
be correct on exit. It also needs no manual RTS. The argument push order is also
|
will be correct on exit. It also needs no manual RTS. The argument push order is
|
||||||
correct for both. (KB) }
|
also correct for both. (KB) }
|
||||||
procedure HookEntry; assembler;
|
procedure HookEntry; assembler;
|
||||||
asm
|
asm
|
||||||
move.l a1,-(a7) // Msg
|
move.l a1,-(a7) // Msg
|
||||||
@ -411,6 +411,21 @@ asm
|
|||||||
jsr (a0) // Call the SubEntry
|
jsr (a0) // Call the SubEntry
|
||||||
end;
|
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);
|
procedure printf(Fmtstr : pchar; const Args : array of const);
|
||||||
var
|
var
|
||||||
i,j : longint;
|
i,j : longint;
|
||||||
|
Loading…
Reference in New Issue
Block a user