make the linux-ppc packags be in synch with other platforms
[tangerine.git] / arch / x86_64-all / exec / execstubs.s
blob0f1355519b873a4db86500c9e4235d129bea893d
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id: execstubs.s 21502 2004-04-09 00:29:38Z falemagn $
5 Desc: Stubs to call C functions while preserving all registers
6 Lang: english
7 */
8 #include "aros/x86_64/asm.h"
11 Macros:
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 #define STUB_ARG0(name) \
25 push %rbp ; \
26 mov %rsp,%rbp ; \
27 call name ; \
28 leave
29 ret
31 #define STUB_ARG1(name) \
32 push %rbp ; \
33 mov %rsp,%rbp ; \
34 call name ; \
35 leave ; \
36 ret
38 #define STUB_ARG2(name) \
39 push %rbp ; \
40 mov %rsp,%rbp ; \
41 call name ; \
42 leave ; \
43 ret
45 /* To save typing work */
46 #define STUB0(cname,name) \
47 .globl cname ; \
48 _FUNCTION(cname) ; \
49 cname: ; \
50 STUB_ARG0(name)
52 #define STUB1(cname,name) \
53 .globl cname ; \
54 _FUNCTION(cname) ; \
55 cname: ; \
56 STUB_ARG1(name)
59 #define STUB2(cname,name) \
60 .globl cname ; \
61 _FUNCTION(cname) ; \
62 cname: ; \
63 STUB_ARG2(name)
65 .text
66 _ALIGNMENT
68 /* Call functions and preserve registers */
69 #ifdef UseExecstubs
70 STUB1(AROS_SLIB_ENTRY(Forbid,Exec),AROS_CSYMNAME(_Exec_Forbid))
71 STUB1(AROS_SLIB_ENTRY(Permit,Exec),AROS_CSYMNAME(_Exec_Permit))
72 STUB1(AROS_SLIB_ENTRY(Disable,Exec),AROS_CSYMNAME(_Exec_Disable))
73 STUB1(AROS_SLIB_ENTRY(Enable,Exec),AROS_CSYMNAME(_Exec_Enable))
75 STUB2(AROS_SLIB_ENTRY(ObtainSemaphore,Exec),AROS_CSYMNAME(_Exec_ObtainSemaphore))
76 STUB2(AROS_SLIB_ENTRY(ReleaseSemaphore,Exec),AROS_CSYMNAME(_Exec_ReleaseSemaphore))
77 STUB2(AROS_SLIB_ENTRY(ObtainSemaphoreShared,Exec),AROS_CSYMNAME(_Exec_ObtainSemaphoreShared))
78 #endif