2 * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
26 #include "../custom/SYS.h"
27 #include <mach/arm64/asm.h>
30 * Stubs are to handle the ARM64 ABI for variadic functions'
31 * not matching the ABI used by the system call handler.
35 * sem_t* sem_open(const char *name, int oflag, ...);
36 * sem_t* __sem_open(const char *name, int oflag, int mode, int value);
38 MI_ENTRY_POINT(_sem_open)
46 MI_CALL_EXTERNAL(___sem_open)
48 /* xnu returns a 64-bit '-1' on failure, but pointers must have the high
49 * 32-bits set to zero. The following instruction is equivalent to
50 * masking off the top 32-bits.
58 * int open(const char *name, int oflag, ...);
59 * int __open(const char *name, int oflag, int mode, int value);
69 MI_CALL_EXTERNAL(___open)
74 * int open_nocancel(const char *name, int oflag, ...);
75 * int __open_nocancel(const char *name, int oflag, int mode);
77 MI_ENTRY_POINT(_open$NOCANCEL)
85 MI_CALL_EXTERNAL(___open_nocancel)
90 * int openat(int fd,const char *name, int oflag, ...);
91 * int __openat(int fd, const char *name, int oflag, int mode, int value);
93 MI_ENTRY_POINT(_openat)
101 MI_CALL_EXTERNAL(___openat)
106 * int openat_nocancel(int fd, const char *name, int oflag, ...);
107 * int __openat_nocancel(int fd, const char *name, int oflag, int mode);
109 MI_ENTRY_POINT(_openat$NOCANCEL)
117 MI_CALL_EXTERNAL(___openat_nocancel)
122 * int shm_open(const char *, int, ...);
123 * int __shm_open(const char*, int oflag, int mode);
125 MI_ENTRY_POINT(_shm_open)
133 MI_CALL_EXTERNAL(___shm_open)
138 * int msgsys(int, ...);
139 * int __msgsys(int which, int a2, int a3, int a4, int a5);
141 MI_ENTRY_POINT(_msgsys)
145 ldp x1, x2, [fp, #16]
146 ldp x3, x4, [fp, #32]
148 ldp w1, w2, [fp, #16]
149 ldp w3, w4, [fp, #24]
151 MI_CALL_EXTERNAL(___msgsys)
155 * int semsys(int, ...);
156 * int __semsys(int which, int a2, int a3, int a4, int a5);
158 MI_ENTRY_POINT(_semsys)
162 ldp x1, x2, [fp, #16]
163 ldp x3, x4, [fp, #32]
165 ldp w1, w2, [fp, #16]
166 ldp w3, w4, [fp, #24]
168 MI_CALL_EXTERNAL(___semsys)
173 * int semctl(int, int, int, ...);
174 * int __semctl(int semid, int semnum, int cmd, semun_t arg);
176 MI_ENTRY_POINT(_semctl)
184 MI_CALL_EXTERNAL(___semctl)
189 * int shmsys(int, ...);
190 * int __shmsys(int which, int a2, int a3, int a4);
192 MI_ENTRY_POINT(_shmsys)
196 ldp x1, x2, [fp, #16]
199 ldp w1, w2, [fp, #16]
202 MI_CALL_EXTERNAL(___shmsys)
206 #endif /* defined(__arm64__) */