2 Copyright ? 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Stubs to call C functions while preserving all registers
8 #include "aros/ppc/asm.h"
12 PUSH - Save all registers on the stack
13 POP - Restore all registers from the stack
15 STUB_ARG0(name) - Call a function preserving all registers
16 which gets no arguments
17 STUB_ARG1(name) - Call a function preserving all registers
18 which gets a single argument
19 STUB_ARG2(name) - Call a function preserving all registers
20 which gets two arguments
23 #define NUM_REGS (32 + 2)
24 #define OFFSET ((NUM_REGS) * 4)
25 #define FIRST_ARG (((NUM_REGS + 0) * 4) + OFFSET)
26 #define SECOND_ARG (((NUM_REGS + 1) * 4) + OFFSET)
28 /* 4(1) is used by the called function
29 to store lr much the same way we do
45 #define STUB_ARG0(name)\
54 #define STUB_ARG1(name) \
65 #define STUB_ARG2(name) \
67 lwz 0,SECOND_ARG
(1); \
69 lwz 0,FIRST_ARG
(1) ; \
78 /* To save typing work */
79 #define STUB0(cname,name)\
85 #define STUB1(cname,name)\
91 #define STUB2(cname,name)\
100 /* Call functions and preserve registers */
102 STUB1
(AROS_SLIB_ENTRY
(Forbid
,Exec
),AROS_CSYMNAME
(_Exec_Forbid
))
103 STUB1
(AROS_SLIB_ENTRY
(Permit
,Exec
),AROS_CSYMNAME
(_Exec_Permit
))
104 STUB1
(AROS_SLIB_ENTRY
(Disable
,Exec
),AROS_CSYMNAME
(_Exec_Disable
))
105 STUB1
(AROS_SLIB_ENTRY
(Enable
,Exec
),AROS_CSYMNAME
(_Exec_Enable
))
107 STUB2
(AROS_SLIB_ENTRY
(ObtainSemaphore
,Exec
),AROS_CSYMNAME
(_Exec_ObtainSemaphore
))
108 STUB2
(AROS_SLIB_ENTRY
(ReleaseSemaphore
,Exec
),AROS_CSYMNAME
(_Exec_ReleaseSemaphore
))
109 STUB2
(AROS_SLIB_ENTRY
(ObtainSemaphoreShared
,Exec
),AROS_CSYMNAME
(_Exec_ObtainSemaphoreShared
))