]> git.saurik.com Git - apple/xnu.git/blob - libsyscall/wrappers/varargs_wrappers.s
6a22a53958b42ccc894b4a08e41796123b4c8ebc
[apple/xnu.git] / libsyscall / wrappers / varargs_wrappers.s
1 /*
2 * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifdef __arm64__
25
26 #include "../custom/SYS.h"
27 #include <mach/arm64/asm.h>
28
29 /*
30 * Stubs are to handle the ARM64 ABI for variadic functions'
31 * not matching the ABI used by the system call handler.
32 */
33
34 /*
35 * sem_t* sem_open(const char *name, int oflag, ...);
36 * sem_t* __sem_open(const char *name, int oflag, int mode, int value);
37 */
38 MI_ENTRY_POINT(_sem_open)
39 PUSH_FRAME
40 ldp x2, x3, [fp, #16]
41 MI_CALL_EXTERNAL(___sem_open)
42 POP_FRAME
43 ret
44
45 /*
46 * int open(const char *name, int oflag, ...);
47 * int __open(const char *name, int oflag, int mode, int value);
48 */
49 MI_ENTRY_POINT(_open)
50 PUSH_FRAME
51 ldr x2, [fp, #16]
52 MI_CALL_EXTERNAL(___open)
53 POP_FRAME
54 ret
55
56 /*
57 * int open_nocancel(const char *name, int oflag, ...);
58 * int __open_nocancel(const char *name, int oflag, int mode);
59 */
60 MI_ENTRY_POINT(_open$NOCANCEL)
61 PUSH_FRAME
62 ldr x2, [fp, #16]
63 MI_CALL_EXTERNAL(___open_nocancel)
64 POP_FRAME
65 ret
66
67 /*
68 * int openat(int fd,const char *name, int oflag, ...);
69 * int __openat(int fd, const char *name, int oflag, int mode, int value);
70 */
71 MI_ENTRY_POINT(_openat)
72 PUSH_FRAME
73 ldr x3, [fp, #16]
74 MI_CALL_EXTERNAL(___openat)
75 POP_FRAME
76 ret
77
78 /*
79 * int openat_nocancel(int fd, const char *name, int oflag, ...);
80 * int __openat_nocancel(int fd, const char *name, int oflag, int mode);
81 */
82 MI_ENTRY_POINT(_openat$NOCANCEL)
83 PUSH_FRAME
84 ldr x3, [fp, #16]
85 MI_CALL_EXTERNAL(___openat_nocancel)
86 POP_FRAME
87 ret
88
89 /*
90 * int shm_open(const char *, int, ...);
91 * int __shm_open(const char*, int oflag, int mode);
92 */
93 MI_ENTRY_POINT(_shm_open)
94 PUSH_FRAME
95 ldr x2, [fp, #16]
96 MI_CALL_EXTERNAL(___shm_open)
97 POP_FRAME
98 ret
99
100 /*
101 * int msgsys(int, ...);
102 * int __msgsys(int which, int a2, int a3, int a4, int a5);
103 */
104 MI_ENTRY_POINT(_msgsys)
105 PUSH_FRAME
106 ldp x1, x2, [fp, #16]
107 ldp x3, x4, [fp, #32]
108 MI_CALL_EXTERNAL(___msgsys)
109 POP_FRAME
110 ret
111
112 /*
113 * int semsys(int, ...);
114 * int __semsys(int which, int a2, int a3, int a4, int a5);
115 */
116 MI_ENTRY_POINT(_semsys)
117 PUSH_FRAME
118 ldp x1, x2, [fp, #16]
119 ldp x3, x4, [fp, #32]
120 MI_CALL_EXTERNAL(___semsys)
121 POP_FRAME
122 ret
123
124 /*
125 * int semctl(int, int, int, ...);
126 * int __semctl(int semid, int semnum, int cmd, semun_t arg);
127 */
128 MI_ENTRY_POINT(_semctl)
129 PUSH_FRAME
130 ldr x3, [fp, #16]
131 MI_CALL_EXTERNAL(___semctl)
132 POP_FRAME
133 ret
134
135 /*
136 * int shmsys(int, ...);
137 * int __shmsys(int which, int a2, int a3, int a4);
138 */
139 MI_ENTRY_POINT(_shmsys)
140 PUSH_FRAME
141 ldp x1, x2, [fp, #16]
142 ldr x3, [fp, #32]
143 MI_CALL_EXTERNAL(___shmsys)
144 POP_FRAME
145 ret
146
147 #endif /* defined(__arm64__) */