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