2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Stubs to call C functions while preserving all registers, x86-64 version
8 #include "aros/x86_64/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
24 * r12 doesn't have to be preserved, however i need to keep stack
25 * alignment. So, i push r12.
26 * x86-64 ABI always suggests 16-byte-aligned stack. 64-bit Windows
27 * crashes in RaiseException() (used to implement kernel syscalls)
28 * if this requirement is not met.
54 #define STUB_ARG0(name) \
63 #define STUB_ARG1(name) \
72 #define STUB_ARG2(name) \
81 /* To save typing work */
82 #define STUB0(cname,name) \
88 #define STUB1(cname,name) \
95 #define STUB2(cname,name) \
104 /* Call functions and preserve registers */
106 STUB1
(AROS_SLIB_ENTRY
(Disable
,Exec
,20),AROS_CSYMNAME
(_Exec_20_Disable
))
107 STUB1
(AROS_SLIB_ENTRY
(Enable
,Exec
,21),AROS_CSYMNAME
(_Exec_21_Enable
))
108 STUB1
(AROS_SLIB_ENTRY
(Forbid
,Exec
,22),AROS_CSYMNAME
(_Exec_22_Forbid
))
109 STUB1
(AROS_SLIB_ENTRY
(Permit
,Exec
,23),AROS_CSYMNAME
(_Exec_23_Permit
))
111 STUB2
(AROS_SLIB_ENTRY
(ObtainSemaphore
,Exec
,94),AROS_CSYMNAME
(_Exec_94_ObtainSemaphore
))
112 STUB2
(AROS_SLIB_ENTRY
(ReleaseSemaphore
,Exec
,95),AROS_CSYMNAME
(_Exec_95_ReleaseSemaphore
))
113 STUB2
(AROS_SLIB_ENTRY
(ObtainSemaphoreShared
,Exec
,113),AROS_CSYMNAME
(_Exec_113_ObtainSemaphoreShared
))