···11+/*
22+ * Copyright (c) 1999-2010 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
2929+ *
3030+ * File: libc/ppc/sys/fork.s
3131+ *
3232+ * HISTORY
3333+ * 18-Nov-92 Ben Fathi (benf@next.com)
3434+ * Created from M88K sources
3535+ *
3636+ * 11-Jan-92 Peter King (king@next.com)
3737+ * Created from M68K sources
3838+ */
3939+4040+/*
4141+ * All of the asm stubs in this file have been adjusted so the pre/post
4242+ * fork handlers and dyld fixup are done in C inside Libc. As such, Libc
4343+ * expects the __fork asm to fix up the return code to be -1, 0 or pid
4444+ * and errno if needed.
4545+ */
4646+4747+#include "SYS.h"
4848+4949+#if defined(__i386__)
5050+5151+LEAF(___fork, 0)
5252+ subl $28, %esp // Align the stack, with 16 bytes of extra padding that we'll need
5353+5454+ movl $ SYS_fork,%eax; // code for fork -> eax
5555+#ifdef DARLING
5656+ call __darling_bsd_syscall
5757+ cmpl $0, %eax
5858+ jnb L1
5959+#else
6060+ UNIX_SYSCALL_TRAP // do the system call
6161+ jnc L1 // jump if CF==0
6262+#endif
6363+6464+ CALL_EXTERN(tramp_cerror)
6565+ movl $-1,%eax
6666+ addl $28, %esp // restore the stack
6767+ ret
6868+6969+L1:
7070+ orl %edx,%edx // CF=OF=0, ZF set if zero result
7171+ jz L2 // parent, since r1 == 0 in parent, 1 in child
7272+7373+ //child here...
7474+ xorl %eax,%eax // zero eax
7575+ REG_TO_EXTERN(%eax, __current_pid);
7676+L2:
7777+ addl $28, %esp // restore the stack
7878+ // parent ends up here skipping child portion
7979+ ret
8080+8181+#elif defined(__x86_64__)
8282+8383+LEAF(___fork, 0)
8484+ subq $24, %rsp // Align the stack, plus room for local storage
8585+8686+#ifdef DARLING
8787+ movl $ SYS_fork, %eax
8888+ call __darling_bsd_syscall
8989+ cmpq $0, %rax
9090+ jnb L1
9191+#else
9292+ movl $ SYSCALL_CONSTRUCT_UNIX(SYS_fork),%eax; // code for fork -> rax
9393+ UNIX_SYSCALL_TRAP // do the system call
9494+ jnc L1 // jump if CF==0
9595+#endif
9696+9797+ movq %rax, %rdi
9898+ CALL_EXTERN(_cerror)
9999+ movq $-1, %rax
100100+ addq $24, %rsp // restore the stack
101101+ ret
102102+103103+L1:
104104+#ifdef DARLING
105105+ testl %eax, %eax
106106+ jnz L2
107107+#else
108108+ orl %edx,%edx // CF=OF=0, ZF set if zero result
109109+ jz L2 // parent, since r1 == 0 in parent, 1 in child
110110+#endif
111111+112112+ //child here...
113113+ xorq %rax, %rax
114114+ PICIFY(__current_pid)
115115+ movl %eax,(%r11)
116116+L2:
117117+ // parent ends up here skipping child portion
118118+ addq $24, %rsp // restore the stack
119119+ ret
120120+121121+#elif defined(__arm__)
122122+123123+MI_ENTRY_POINT(___fork)
124124+ stmfd sp!, {r4, r7, lr}
125125+ add r7, sp, #4
126126+127127+ mov r1, #1 // prime results
128128+ mov r12, #SYS_fork
129129+ swi #SWI_SYSCALL // make the syscall
130130+ bcs Lbotch // error?
131131+132132+ cmp r1, #0 // parent (r1=0) or child(r1=1)
133133+ beq Lparent
134134+135135+ //child here...
136136+ MI_GET_ADDRESS(r3, __current_pid)
137137+ mov r0, #0
138138+ str r0, [r3] // clear cached pid in child
139139+ ldmfd sp!, {r4, r7, pc}
140140+141141+Lbotch:
142142+ MI_CALL_EXTERNAL(_cerror) // jump here on error
143143+ mov r0,#-1 // set the error
144144+ // fall thru
145145+Lparent:
146146+ ldmfd sp!, {r4, r7, pc} // pop and return
147147+148148+#elif defined(__arm64__)
149149+150150+#include <mach/arm64/asm.h>
151151+152152+MI_ENTRY_POINT(___fork)
153153+ ARM64_STACK_PROLOG
154154+ PUSH_FRAME
155155+ // ARM moves a 1 in to r1 here, but I can't see why.
156156+ mov x16, #SYS_fork // Syscall code
157157+ svc #SWI_SYSCALL // Trap to kernel
158158+ b.cs Lbotch // Carry bit indicates failure
159159+ cbz x1, Lparent // x1 == 0 indicates that we are the parent
160160+161161+ // Child
162162+ MI_GET_ADDRESS(x9, __current_pid) // Get address of cached "current pid"
163163+ mov w0, #0
164164+ str w0, [x9] // Clear cached current pid
165165+ POP_FRAME // And done
166166+ ARM64_STACK_EPILOG
167167+168168+Lbotch:
169169+ MI_CALL_EXTERNAL(_cerror) // Handle error
170170+ mov w0, #-1 // Return value is -1
171171+Lparent:
172172+ POP_FRAME // Return
173173+ ARM64_STACK_EPILOG
174174+175175+#else
176176+#error Unsupported architecture
177177+#endif
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__i386__)
3232+3333+ .data
3434+ .private_extern __current_pid
3535+L__current_pid_addr:
3636+ __current_pid:
3737+ .long 0
3838+3939+#if defined(__DYNAMIC__)
4040+#define GET_CURRENT_PID \
4141+ call 0f ; \
4242+0: ; \
4343+ popl %ecx ; \
4444+ leal L__current_pid_addr-0b(%ecx), %ecx
4545+4646+#define __current_pid (%ecx)
4747+4848+#else
4949+#define GET_CURRENT_PID
5050+#endif
5151+5252+/*
5353+ * If __current_pid is > 0, return it, else make syscall.
5454+ * If __current_pid is 0, cache result of syscall.
5555+ */
5656+TEXT
5757+LEAF(___getpid, 0)
5858+ GET_CURRENT_PID
5959+ movl __current_pid, %eax
6060+ testl %eax, %eax
6161+ jle 1f
6262+ ret
6363+1:
6464+ UNIX_SYSCALL_NONAME(getpid, 0, cerror_nocancel)
6565+ movl %eax, %edx
6666+ xorl %eax, %eax
6767+ GET_CURRENT_PID
6868+ lock
6969+ cmpxchgl %edx, __current_pid
7070+ movl %edx, %eax
7171+ ret
7272+7373+#elif defined(__x86_64__)
7474+7575+ .data
7676+ .private_extern __current_pid
7777+__current_pid:
7878+ .long 0
7979+8080+/*
8181+ * If __current_pid is > 0, return it, else make syscall.
8282+ * If __current_pid is 0, cache result of syscall.
8383+ */
8484+TEXT
8585+LEAF(___getpid, 0)
8686+ movl __current_pid(%rip), %eax
8787+ testl %eax, %eax
8888+ jle 1f
8989+ ret
9090+1:
9191+ UNIX_SYSCALL_NONAME(getpid, 0, cerror_nocancel)
9292+ movl %eax, %edx
9393+ xorl %eax, %eax
9494+ leaq __current_pid(%rip), %rcx
9595+ lock
9696+ cmpxchgl %edx, (%rcx)
9797+ movl %edx, %eax
9898+ ret
9999+100100+#elif defined(__arm__)
101101+102102+#include <arm/arch.h>
103103+104104+ .data
105105+ .globl __current_pid
106106+ .align 2
107107+__current_pid:
108108+ /* Cached pid. Possible values:
109109+ * 0: no value cached
110110+ * > 0: cached PID of current process
111111+ * < 0: negative number of vforks in progress
112112+ * INT_MIN: for pre-ARMv6, "looking" value (0x80000000)
113113+ */
114114+ .long 0
115115+116116+MI_ENTRY_POINT(___getpid)
117117+ ldr r3, L__current_pid
118118+L1: add r3, pc, r3 // r3 = &__current_pid
119119+ ldr r0, [r3] // get the cached pid
120120+ cmp r0, #0
121121+ bxgt lr // if positive, return it
122122+123123+ SYSCALL_NONAME(getpid, 0, cerror_nocancel)
124124+125125+#ifdef _ARM_ARCH_6
126126+ ldrex r2, [r3] // see if we can cache it
127127+ cmp r2, #0 // we can't if there are any...
128128+ bxlt lr // ...vforks in progress
129129+ strex r2, r0, [r3] // ignore conflicts
130130+#else
131131+ mov r1, #0x80000000 // load "looking" value
132132+ swp r2, r1, [r3] // look at the value, lock others out
133133+ cmp r2, r1 // anyone else trying to look?
134134+ bxeq lr // yes, so return immediately/
135135+ cmp r2, #0 // see if we can cache it
136136+ streq r0, [r3] // if zero, we can
137137+ strne r2, [r3] // otherwise restore previous value
138138+#endif
139139+140140+ bx lr
141141+142142+L__current_pid:
143143+ .long __current_pid - (L1+8)
144144+145145+#elif defined(__arm64__)
146146+ .data
147147+ .globl __current_pid
148148+ .align 2
149149+__current_pid:
150150+ /* cached pid. possible values:
151151+ * 0: no value cached
152152+ * > 0: cached pid of current process
153153+ * < 0: negative number of vforks in progress
154154+ * int_min: for pre-armv6, "looking" value (0x80000000)
155155+ */
156156+ .long 0
157157+158158+MI_ENTRY_POINT(___getpid)
159159+ MI_GET_ADDRESS(x9, __current_pid) // Get address of cached value
160160+ ldr w0, [x9] // Load it
161161+ cmp w0, #0 // See if there's a cached value
162162+ b.le L_notcached // If not, make syscall
163163+ ret // Else, we're done
164164+L_notcached:
165165+ SYSCALL_NONAME(getpid, 0, cerror_nocancel)
166166+ ldxr w10, [x9] // Exclusive load
167167+ cbnz w10, L_done // Unless unset, don't even try
168168+ stxr wzr, w0, [x9] // Try to store, but don't care if we fail (someone will win, or not)
169169+L_done:
170170+ ret // Done
171171+#else
172172+#error Unsupported architecture
173173+#endif
174174+#if defined(__i386__)
175175+ .globl _getpid
176176+ .set _getpid, ___getpid
177177+#endif
178178+179179+#if defined(__x86_64__)
180180+ .globl _getpid
181181+ .set _getpid, ___getpid
182182+#endif
183183+184184+#if defined(__ppc__)
185185+ .globl _getpid
186186+ .set _getpid, ___getpid
187187+#endif
188188+189189+#if defined(__arm64__)
190190+ .globl _getpid
191191+ .set _getpid, ___getpid
192192+#endif
193193+
+28
src/kernel/libsyscall/bsdsyscalls/___getrlimit.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_getrlimit
55+#error "SYS_getrlimit not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___getrlimit)
1010+SYSCALL_NONAME(getrlimit, 2, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___getrlimit, getrlimit, 2, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+1919+#if defined(__i386__)
2020+ .globl _getrlimit
2121+ .set _getrlimit, ___getrlimit
2222+#endif
2323+2424+#if defined(__ppc__)
2525+ .globl _getrlimit
2626+ .set _getrlimit, ___getrlimit
2727+#endif
2828+
···11+/*
22+ * Copyright (c) 1999-2016 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+/*
3232+ * A third argument, of type uint64_t*, was added to the gettimeofday syscall
3333+ * for use cases that also want to know the mach_absolute_time that matches the
3434+ * time value returned.
3535+ *
3636+ * __gettimeofday takes the traditional two arguments. It will zero out the
3737+ * third argument argument before entering the kernel, behaving like the old
3838+ * call.
3939+ *
4040+ * __gettimeofday_with_mach will pass it through and supporting kernels will
4141+ * copy-out the mach_absolute_time. Old kernels will leave the pointed to
4242+ * value alone.
4343+ */
4444+4545+.private_extern ___gettimeofday_with_mach
4646+4747+#if defined(__i386__)
4848+4949+LABEL(___gettimeofday)
5050+ pushl $0
5151+ pushl 12(%esp)
5252+ pushl 12(%esp)
5353+ calll ___gettimeofday_with_mach
5454+ addl $12, %esp
5555+ ret
5656+5757+LABEL(___gettimeofday_with_mach)
5858+ UNIX_SYSCALL_INT_NONAME(gettimeofday,0)
5959+ /*
6060+ * <rdar://problem/26410029>
6161+ * If eax is 0, we're on a new kernel and timeval was written by the kernel.
6262+ * Otherwise, eax:edx contains the timeval and we marshal into timeval.
6363+ */
6464+ cmp $0, %eax
6565+ je 2f
6666+ mov 4(%esp),%ecx
6767+ mov %eax,(%ecx)
6868+ mov %edx,4(%ecx)
6969+ xor %eax,%eax
7070+2:
7171+ ret
7272+7373+#elif defined(__x86_64__)
7474+7575+__SYSCALL(___gettimeofday_with_mach, gettimeofday, 3)
7676+7777+LABEL(___gettimeofday)
7878+ movq $0x0, %rdx // zero out third argument
7979+8080+ UNIX_SYSCALL_NONAME(gettimeofday,0,cerror_nocancel)
8181+ /*
8282+ * <rdar://problem/26410029>
8383+ * If rax is 0, we're on a new kernel and timeval was written by the kernel.
8484+ * Otherwise, rax:rdx contains the timeval and we marshal into timeval.
8585+ */
8686+ cmp $0, %rax
8787+ je 2f
8888+ movq %rax, (%rdi)
8989+ movl %edx, 8(%rdi)
9090+ xorl %eax, %eax
9191+2:
9292+ ret
9393+9494+#elif defined(__arm__)
9595+9696+__SYSCALL2(___gettimeofday_with_mach, gettimeofday, 3, cerror_nocancel)
9797+9898+.text
9999+.align 2
100100+.globl ___gettimeofday
101101+___gettimeofday:
102102+ mov r2, #0x0
103103+ SYSCALL_NONAME(gettimeofday, 3, cerror_nocancel)
104104+ bx lr
105105+106106+#elif defined(__arm64__)
107107+108108+__SYSCALL2(___gettimeofday_with_mach, gettimeofday, 3, cerror_nocancel)
109109+110110+.text
111111+.align 2
112112+.globl ___gettimeofday
113113+___gettimeofday:
114114+ movz x2, #0x0
115115+ SYSCALL_NONAME(gettimeofday, 3, cerror_nocancel)
116116+ ret
117117+118118+#else
119119+#error Unsupported architecture
120120+#endif
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__x86_64__)
3232+3333+__SYSCALL(___kdebug_trace_string, kdebug_trace_string, 3)
3434+3535+#elif defined(__i386__)
3636+3737+__SYSCALL_INT(___kdebug_trace_string, kdebug_trace_string, 3)
3838+3939+#elif defined(__arm__)
4040+4141+__SYSCALL(___kdebug_trace_string, kdebug_trace_string, 4)
4242+4343+#elif defined(__arm64__)
4444+4545+__SYSCALL(___kdebug_trace_string, kdebug_trace_string, 3)
4646+4747+#else
4848+#error Unsupported architecture
4949+#endif
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_log_data
55+#error "SYS_log_data not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___log_data)
1010+SYSCALL_NONAME(log_data, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___log_data, log_data, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+69
src/kernel/libsyscall/bsdsyscalls/___lseek.S
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__x86_64__)
3232+3333+__SYSCALL(___lseek, lseek, 3)
3434+3535+#elif defined(__i386__)
3636+3737+__SYSCALL_INT(___lseek, lseek, 3)
3838+3939+#elif defined(__arm__)
4040+4141+__SYSCALL(___lseek, lseek, 4)
4242+4343+#elif defined(__arm64__)
4444+4545+__SYSCALL(___lseek, lseek, 3)
4646+4747+#else
4848+#error Unsupported architecture
4949+#endif
5050+#if defined(__i386__)
5151+ .globl _lseek
5252+ .set _lseek, ___lseek
5353+#endif
5454+5555+#if defined(__x86_64__)
5656+ .globl _lseek
5757+ .set _lseek, ___lseek
5858+#endif
5959+6060+#if defined(__ppc__)
6161+ .globl _lseek
6262+ .set _lseek, ___lseek
6363+#endif
6464+6565+#if defined(__arm64__)
6666+ .globl _lseek
6767+ .set _lseek, ___lseek
6868+#endif
6969+
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_openat_nocancel
55+#error "SYS_openat_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___openat_nocancel)
1010+SYSCALL_NONAME(openat_nocancel, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___openat_nocancel, openat_nocancel, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+1919+#if defined(__i386__)
2020+ .globl _openat$NOCANCEL
2121+ .set _openat$NOCANCEL, ___openat_nocancel
2222+#endif
2323+2424+#if defined(__ppc__)
2525+ .globl _openat$NOCANCEL
2626+ .set _openat$NOCANCEL, ___openat_nocancel
2727+#endif
2828+
+18
src/kernel/libsyscall/bsdsyscalls/___persona.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 24
22+#include "SYS.h"
33+44+#ifndef SYS_persona
55+#error "SYS_persona not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___persona)
1010+SYSCALL_NONAME(persona, 6, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___persona, persona, 6, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+90
src/kernel/libsyscall/bsdsyscalls/___pipe.S
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved. */
2929+3030+#include "SYS.h"
3131+3232+#if defined(__i386__)
3333+3434+PSEUDO_INT(___pipe, pipe, 0)
3535+ movl 4(%esp),%ecx
3636+ movl %eax,(%ecx)
3737+ movl %edx,4(%ecx)
3838+ xorl %eax,%eax
3939+ ret
4040+4141+#elif defined(__x86_64__)
4242+4343+PSEUDO(___pipe, pipe, 0, cerror_nocancel)
4444+ movl %eax, (%rdi)
4545+ movl %edx, 4(%rdi)
4646+ xorl %eax, %eax
4747+ ret
4848+4949+#elif defined(__arm__)
5050+5151+MI_ENTRY_POINT(___pipe)
5252+ mov r3,r0 // save fildes across syscall
5353+ SYSCALL_NONAME(pipe, 0, cerror_nocancel)
5454+ str r0, [r3, #0]
5555+ str r1, [r3, #4]
5656+ mov r0,#0
5757+ bx lr
5858+5959+#elif defined(__arm64__)
6060+6161+MI_ENTRY_POINT(___pipe)
6262+ mov x9, x0 // Stash FD array
6363+ SYSCALL_NONAME(pipe, 0, cerror_nocancel)
6464+ stp w0, w1, [x9] // Save results
6565+ mov x0, #0 // Success
6666+ ret // Done
6767+6868+#else
6969+#error Unsupported architecture
7070+#endif
7171+#if defined(__i386__)
7272+ .globl _pipe
7373+ .set _pipe, ___pipe
7474+#endif
7575+7676+#if defined(__x86_64__)
7777+ .globl _pipe
7878+ .set _pipe, ___pipe
7979+#endif
8080+8181+#if defined(__ppc__)
8282+ .globl _pipe
8383+ .set _pipe, ___pipe
8484+#endif
8585+8686+#if defined(__arm64__)
8787+ .globl _pipe
8888+ .set _pipe, ___pipe
8989+#endif
9090+
···11+#define __SYSCALL_32BIT_ARG_BYTES 12
22+#include "SYS.h"
33+44+#ifndef SYS___pthread_sigmask
55+#error "SYS___pthread_sigmask not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___pthread_sigmask)
1010+SYSCALL_NONAME(__pthread_sigmask, 3, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___pthread_sigmask, __pthread_sigmask, 3, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+94
src/kernel/libsyscall/bsdsyscalls/___ptrace.S
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved. */
2929+3030+#include "SYS.h"
3131+3232+#if defined(__i386__)
3333+3434+ .globl _errno
3535+3636+LEAF(___ptrace, 0)
3737+ xorl %eax,%eax
3838+ REG_TO_EXTERN(%eax,_errno)
3939+ UNIX_SYSCALL_NONAME(ptrace, 4, cerror)
4040+ ret
4141+4242+#elif defined(__x86_64__)
4343+4444+ .globl _errno
4545+4646+LEAF(___ptrace, 0)
4747+ xorq %rax,%rax
4848+ PICIFY(_errno)
4949+ movl %eax,(%r11)
5050+ UNIX_SYSCALL_NONAME(ptrace, 4, cerror)
5151+ ret
5252+5353+#elif defined(__arm__)
5454+5555+MI_ENTRY_POINT(___ptrace)
5656+ MI_GET_ADDRESS(ip,_errno)
5757+ str r8, [sp, #-4]!
5858+ mov r8, #0
5959+ str r8, [ip]
6060+ ldr r8, [sp], #4
6161+ SYSCALL_NONAME(ptrace, 4, cerror)
6262+ bx lr
6363+6464+#elif defined(__arm64__)
6565+6666+MI_ENTRY_POINT(___ptrace)
6767+ MI_GET_ADDRESS(x9,_errno)
6868+ str wzr, [x9]
6969+ SYSCALL_NONAME(ptrace, 4, cerror)
7070+ ret
7171+7272+#else
7373+#error Unsupported architecture
7474+#endif
7575+#if defined(__i386__)
7676+ .globl _ptrace
7777+ .set _ptrace, ___ptrace
7878+#endif
7979+8080+#if defined(__x86_64__)
8181+ .globl _ptrace
8282+ .set _ptrace, ___ptrace
8383+#endif
8484+8585+#if defined(__ppc__)
8686+ .globl _ptrace
8787+ .set _ptrace, ___ptrace
8888+#endif
8989+9090+#if defined(__arm64__)
9191+ .globl _ptrace
9292+ .set _ptrace, ___ptrace
9393+#endif
9494+
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__x86_64__)
3232+3333+__SYSCALL(___sigaltstack, sigaltstack, 3)
3434+3535+#elif defined(__i386__)
3636+3737+__SYSCALL_INT(___sigaltstack, sigaltstack, 3)
3838+3939+#elif defined(__arm__)
4040+4141+__SYSCALL(___sigaltstack, sigaltstack, 3)
4242+4343+#elif defined(__arm64__)
4444+4545+__SYSCALL(___sigaltstack, sigaltstack, 3)
4646+4747+#else
4848+#error Unsupported architecture
4949+#endif
5050+#if defined(__i386__)
5151+ .globl _sigaltstack
5252+ .set _sigaltstack, ___sigaltstack
5353+#endif
5454+5555+#if defined(__ppc__)
5656+ .globl _sigaltstack
5757+ .set _sigaltstack, ___sigaltstack
5858+#endif
5959+
+49
src/kernel/libsyscall/bsdsyscalls/___sigreturn.S
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__x86_64__)
3232+3333+__SYSCALL(___sigreturn, sigreturn, 3)
3434+3535+#elif defined(__i386__)
3636+3737+__SYSCALL_INT(___sigreturn, sigreturn, 3)
3838+3939+#elif defined(__arm__)
4040+4141+__SYSCALL(___sigreturn, sigreturn, 3)
4242+4343+#elif defined(__arm64__)
4444+4545+__SYSCALL(___sigreturn, sigreturn, 3)
4646+4747+#else
4848+#error Unsupported architecture
4949+#endif
+18
src/kernel/libsyscall/bsdsyscalls/___sigsuspend.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 4
22+#include "SYS.h"
33+44+#ifndef SYS_sigsuspend
55+#error "SYS_sigsuspend not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___sigsuspend)
1010+SYSCALL_NONAME(sigsuspend, 1, cerror)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___sigsuspend, sigsuspend, 1, cerror)
1515+#endif
1616+1717+#endif
1818+
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_stat_extended
55+#error "SYS_stat_extended not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___stat_extended)
1010+SYSCALL_NONAME(stat_extended, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___stat_extended, stat_extended, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+93
src/kernel/libsyscall/bsdsyscalls/___syscall.S
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved. */
2929+3030+#include "SYS.h"
3131+3232+#if defined(__i386__)
3333+3434+LEAF(___syscall, 0)
3535+ popl %ecx // ret addr
3636+ popl %eax // syscall number
3737+ pushl %ecx
3838+ UNIX_SYSCALL_TRAP
3939+ movl (%esp),%edx // add one element to stack so
4040+ pushl %ecx // caller "pop" will work
4141+ jnb 2f
4242+ BRANCH_EXTERN(tramp_cerror)
4343+2:
4444+END(___syscall)
4545+4646+#elif defined(__x86_64__)
4747+4848+// For x86-64, the kernel slides the argument list for us.
4949+// The number of arguments here is variable, but our macros ignore
5050+// that value anyway.
5151+__SYSCALL(___syscall, syscall, 0);
5252+5353+#elif defined(__arm__)
5454+5555+__SYSCALL(___syscall, syscall, 7)
5656+5757+#elif defined(__arm64__)
5858+5959+/*
6060+ * Ignore nominal number of arguments: just pop from stack and let the kernel
6161+ * interpret.
6262+ */
6363+#include <mach/arm64/asm.h>
6464+MI_ENTRY_POINT(___syscall)
6565+ ldp x1, x2, [sp]
6666+ ldp x3, x4, [sp, #16]
6767+ ldp x5, x6, [sp, #32]
6868+ ldr x7, [sp, #48]
6969+ DO_SYSCALL(SYS_syscall, cerror)
7070+ ret
7171+#else
7272+#error Unsupported architecture
7373+#endif
7474+#if defined(__i386__)
7575+ .globl _syscall
7676+ .set _syscall, ___syscall
7777+#endif
7878+7979+#if defined(__x86_64__)
8080+ .globl _syscall
8181+ .set _syscall, ___syscall
8282+#endif
8383+8484+#if defined(__ppc__)
8585+ .globl _syscall
8686+ .set _syscall, ___syscall
8787+#endif
8888+8989+#if defined(__arm64__)
9090+ .globl _syscall
9191+ .set _syscall, ___syscall
9292+#endif
9393+
+19
src/kernel/libsyscall/bsdsyscalls/___sysctl.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 24
22+#include "SYS.h"
33+44+#ifndef SYS_sysctl
55+#error "SYS_sysctl not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___sysctl)
1010+ZERO_EXTEND(5)
1111+SYSCALL_NONAME(sysctl, 6, cerror_nocancel)
1212+ret
1313+#else
1414+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1515+__SYSCALL2(___sysctl, sysctl, 6, cerror_nocancel)
1616+#endif
1717+1818+#endif
1919+
···11+/*
22+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__x86_64__)
3232+3333+__SYSCALL(___thread_selfid, thread_selfid, 0)
3434+3535+#elif defined(__i386__)
3636+3737+__SYSCALL_INT(___thread_selfid, thread_selfid, 0)
3838+3939+#elif defined(__arm__)
4040+4141+__SYSCALL(___thread_selfid, thread_selfid, 0)
4242+4343+#elif defined(__arm64__)
4444+4545+__SYSCALL(___thread_selfid, thread_selfid, 0)
4646+4747+#endif
···11+/*
22+ * Copyright (c) 2014 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+2929+#include "SYS.h"
3030+3131+#if defined(__x86_64__)
3232+3333+__SYSCALL(___thread_selfusage, thread_selfusage, 0)
3434+3535+#elif defined(__i386__)
3636+3737+__SYSCALL_INT(___thread_selfusage, thread_selfusage, 0)
3838+3939+#elif defined(__arm__)
4040+4141+__SYSCALL(___thread_selfusage, thread_selfusage, 0)
4242+4343+#elif defined(__arm64__)
4444+4545+__SYSCALL(___thread_selfusage, thread_selfusage, 0)
4646+4747+#endif
+18
src/kernel/libsyscall/bsdsyscalls/___ulock_wait.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 20
22+#include "SYS.h"
33+44+#ifndef SYS_ulock_wait
55+#error "SYS_ulock_wait not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(___ulock_wait)
1010+SYSCALL_NONAME(ulock_wait, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(___ulock_wait, ulock_wait, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
···11+#define __SYSCALL_32BIT_ARG_BYTES 24
22+#include "SYS.h"
33+44+#ifndef SYS_fsgetpath_ext
55+#error "SYS_fsgetpath_ext not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_fsgetpath_ext)
1010+ZERO_EXTEND(1)
1111+SYSCALL_NONAME(fsgetpath_ext, 5, cerror_nocancel)
1212+ret
1313+#else
1414+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1515+__SYSCALL2(_fsgetpath_ext, fsgetpath_ext, 5, cerror_nocancel)
1616+#endif
1717+1818+#endif
1919+
+13
src/kernel/libsyscall/bsdsyscalls/_fstat.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_fstat
55+#error "SYS_fstat not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_fstat, fstat, 2, cerror)
1010+#else
1111+__SYSCALL2(___fstat, fstat, 2, cerror)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_fstatat
55+#error "SYS_fstatat not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_fstatat, fstatat, 4, cerror)
1010+#else
1111+__SYSCALL2(___fstatat, fstatat, 4, cerror)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_fstatfs
55+#error "SYS_fstatfs not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_fstatfs, fstatfs, 2, cerror_nocancel)
1010+#else
1111+__SYSCALL2(___fstatfs, fstatfs, 2, cerror_nocancel)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 0
22+#include "SYS.h"
33+44+#ifndef SYS_getdtablesize
55+#error "SYS_getdtablesize not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_getdtablesize)
1010+SYSCALL_NONAME(getdtablesize, 0, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_getdtablesize, getdtablesize, 0, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_getegid.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 0
22+#include "SYS.h"
33+44+#ifndef SYS_getegid
55+#error "SYS_getegid not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_getegid)
1010+SYSCALL_NONAME(getegid, 0, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_getegid, getegid, 0, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+19
src/kernel/libsyscall/bsdsyscalls/_getentropy.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_getentropy
55+#error "SYS_getentropy not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_getentropy)
1010+ZERO_EXTEND(1)
1111+SYSCALL_NONAME(getentropy, 2, cerror_nocancel)
1212+ret
1313+#else
1414+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1515+__SYSCALL2(_getentropy, getentropy, 2, cerror_nocancel)
1616+#endif
1717+1818+#endif
1919+
+18
src/kernel/libsyscall/bsdsyscalls/_geteuid.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 0
22+#include "SYS.h"
33+44+#ifndef SYS_geteuid
55+#error "SYS_geteuid not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_geteuid)
1010+SYSCALL_NONAME(geteuid, 0, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_geteuid, geteuid, 0, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_getfh.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_getfh
55+#error "SYS_getfh not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_getfh)
1010+SYSCALL_NONAME(getfh, 2, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_getfh, getfh, 2, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+13
src/kernel/libsyscall/bsdsyscalls/_getfsstat.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 12
22+#include "SYS.h"
33+44+#ifndef SYS_getfsstat
55+#error "SYS_getfsstat not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_getfsstat, getfsstat, 3, cerror_nocancel)
1010+#else
1111+__SYSCALL2(___getfsstat, getfsstat, 3, cerror_nocancel)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_guarded_writev_np
55+#error "SYS_guarded_writev_np not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_guarded_writev_np)
1010+SYSCALL_NONAME(guarded_writev_np, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_guarded_writev_np, guarded_writev_np, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_issetugid.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 0
22+#include "SYS.h"
33+44+#ifndef SYS_issetugid
55+#error "SYS_issetugid not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_issetugid)
1010+SYSCALL_NONAME(issetugid, 0, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_issetugid, issetugid, 0, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_kas_info.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 12
22+#include "SYS.h"
33+44+#ifndef SYS_kas_info
55+#error "SYS_kas_info not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_kas_info)
1010+SYSCALL_NONAME(kas_info, 3, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_kas_info, kas_info, 3, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_kevent.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 24
22+#include "SYS.h"
33+44+#ifndef SYS_kevent
55+#error "SYS_kevent not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_kevent)
1010+SYSCALL_NONAME(kevent, 6, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_kevent, kevent, 6, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_kevent64.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 28
22+#include "SYS.h"
33+44+#ifndef SYS_kevent64
55+#error "SYS_kevent64 not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_kevent64)
1010+SYSCALL_NONAME(kevent64, 7, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_kevent64, kevent64, 7, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_kevent_id.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 36
22+#include "SYS.h"
33+44+#ifndef SYS_kevent_id
55+#error "SYS_kevent_id not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_kevent_id)
1010+SYSCALL_NONAME(kevent_id, 8, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_kevent_id, kevent_id, 8, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_kevent_qos.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 32
22+#include "SYS.h"
33+44+#ifndef SYS_kevent_qos
55+#error "SYS_kevent_qos not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_kevent_qos)
1010+SYSCALL_NONAME(kevent_qos, 8, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_kevent_qos, kevent_qos, 8, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_kqueue.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 0
22+#include "SYS.h"
33+44+#ifndef SYS_kqueue
55+#error "SYS_kqueue not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_kqueue)
1010+SYSCALL_NONAME(kqueue, 0, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_kqueue, kqueue, 0, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_ledger.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_ledger
55+#error "SYS_ledger not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_ledger)
1010+SYSCALL_NONAME(ledger, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_ledger, ledger, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_link.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_link
55+#error "SYS_link not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_link)
1010+SYSCALL_NONAME(link, 2, cerror)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_link, link, 2, cerror)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_linkat.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 20
22+#include "SYS.h"
33+44+#ifndef SYS_linkat
55+#error "SYS_linkat not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_linkat)
1010+SYSCALL_NONAME(linkat, 5, cerror)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_linkat, linkat, 5, cerror)
1515+#endif
1616+1717+#endif
1818+
+18
src/kernel/libsyscall/bsdsyscalls/_lio_listio.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_lio_listio
55+#error "SYS_lio_listio not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_lio_listio)
1010+SYSCALL_NONAME(lio_listio, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_lio_listio, lio_listio, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+19
src/kernel/libsyscall/bsdsyscalls/_listxattr.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_listxattr
55+#error "SYS_listxattr not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_listxattr)
1010+ZERO_EXTEND(2)
1111+SYSCALL_NONAME(listxattr, 4, cerror_nocancel)
1212+ret
1313+#else
1414+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1515+__SYSCALL2(_listxattr, listxattr, 4, cerror_nocancel)
1616+#endif
1717+1818+#endif
1919+
+13
src/kernel/libsyscall/bsdsyscalls/_lstat.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_lstat
55+#error "SYS_lstat not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_lstat, lstat, 2, cerror)
1010+#else
1111+__SYSCALL2(___lstat, lstat, 2, cerror)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_socket_delegate
55+#error "SYS_socket_delegate not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_socket_delegate)
1010+SYSCALL_NONAME(socket_delegate, 4, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_socket_delegate, socket_delegate, 4, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+13
src/kernel/libsyscall/bsdsyscalls/_stat.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_stat
55+#error "SYS_stat not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_stat, stat, 2, cerror)
1010+#else
1111+__SYSCALL2(___stat, stat, 2, cerror)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 8
22+#include "SYS.h"
33+44+#ifndef SYS_statfs
55+#error "SYS_statfs not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
99+__SYSCALL2(_statfs, statfs, 2, cerror_nocancel)
1010+#else
1111+__SYSCALL2(___statfs, statfs, 2, cerror_nocancel)
1212+#endif
1313+
···11+#define __SYSCALL_32BIT_ARG_BYTES 12
22+#include "SYS.h"
33+44+#ifndef SYS_vm_pressure_monitor
55+#error "SYS_vm_pressure_monitor not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_vm_pressure_monitor)
1010+SYSCALL_NONAME(vm_pressure_monitor, 3, cerror_nocancel)
1111+ret
1212+#else
1313+#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm64__)
1414+__SYSCALL2(_vm_pressure_monitor, vm_pressure_monitor, 3, cerror_nocancel)
1515+#endif
1616+1717+#endif
1818+
+30
src/kernel/libsyscall/bsdsyscalls/_waitid.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 16
22+#include "SYS.h"
33+44+#ifndef SYS_waitid
55+#error "SYS_waitid not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_waitid)
1010+SYSCALL_NONAME(waitid, 4, cerror)
1111+ret
1212+#else
1313+#if defined(__x86_64__) || defined(__arm64__)
1414+__SYSCALL2(_waitid, waitid, 4, cerror)
1515+#else
1616+__SYSCALL2(___waitid, waitid, 4, cerror)
1717+#endif
1818+1919+#endif
2020+2121+#if defined(__i386__)
2222+ .globl _waitid$UNIX2003
2323+ .set _waitid$UNIX2003, ___waitid
2424+#endif
2525+2626+#if defined(__ppc__)
2727+ .globl _waitid$UNIX2003
2828+ .set _waitid$UNIX2003, ___waitid
2929+#endif
3030+
+31
src/kernel/libsyscall/bsdsyscalls/_write.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 12
22+#include "SYS.h"
33+44+#ifndef SYS_write
55+#error "SYS_write not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_write)
1010+ZERO_EXTEND(2)
1111+SYSCALL_NONAME(write, 3, cerror)
1212+ret
1313+#else
1414+#if defined(__x86_64__) || defined(__arm64__)
1515+__SYSCALL2(_write, write, 3, cerror)
1616+#else
1717+__SYSCALL2(___write, write, 3, cerror)
1818+#endif
1919+2020+#endif
2121+2222+#if defined(__i386__)
2323+ .globl _write$UNIX2003
2424+ .set _write$UNIX2003, ___write
2525+#endif
2626+2727+#if defined(__ppc__)
2828+ .globl _write$UNIX2003
2929+ .set _write$UNIX2003, ___write
3030+#endif
3131+
+30
src/kernel/libsyscall/bsdsyscalls/_writev.S
···11+#define __SYSCALL_32BIT_ARG_BYTES 12
22+#include "SYS.h"
33+44+#ifndef SYS_writev
55+#error "SYS_writev not defined. The header files libsyscall is building against do not match syscalls.master."
66+#endif
77+88+#if defined(__arm64__)
99+MI_ENTRY_POINT(_writev)
1010+SYSCALL_NONAME(writev, 3, cerror)
1111+ret
1212+#else
1313+#if defined(__x86_64__) || defined(__arm64__)
1414+__SYSCALL2(_writev, writev, 3, cerror)
1515+#else
1616+__SYSCALL2(___writev, writev, 3, cerror)
1717+#endif
1818+1919+#endif
2020+2121+#if defined(__i386__)
2222+ .globl _writev$UNIX2003
2323+ .set _writev$UNIX2003, ___writev
2424+#endif
2525+2626+#if defined(__ppc__)
2727+ .globl _writev$UNIX2003
2828+ .set _writev$UNIX2003, ___writev
2929+#endif
3030+
+149
src/kernel/libsyscall/bsdsyscalls/custom.S
···11+/*
22+ * Copyright (c) 1999-2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. The rights granted to you under the License
1010+ * may not be used to create, or enable the creation or redistribution of,
1111+ * unlawful or unlicensed copies of an Apple operating system, or to
1212+ * circumvent, violate, or enable the circumvention or violation of, any
1313+ * terms of an Apple operating system software license agreement.
1414+ *
1515+ * Please obtain a copy of the License at
1616+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717+ *
1818+ * The Original Code and all software distributed under the License are
1919+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2121+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2222+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323+ * Please see the License for the specific language governing rights and
2424+ * limitations under the License.
2525+ *
2626+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727+ */
2828+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
2929+ */
3030+3131+#include "SYS.h"
3232+3333+#if defined(__i386__)
3434+3535+/*
3636+ * i386 needs custom assembly to transform the return from syscalls
3737+ * into a proper stack for a function call out to cerror{,_nocancel}.
3838+ */
3939+4040+LABEL(tramp_cerror)
4141+ mov %esp, %edx
4242+ andl $0xfffffff0, %esp
4343+ subl $16, %esp
4444+ movl %edx, 4(%esp)
4545+ movl %eax, (%esp)
4646+ CALL_EXTERN(_cerror)
4747+ movl 4(%esp), %esp
4848+ ret
4949+5050+LABEL(tramp_cerror_nocancel)
5151+ mov %esp, %edx
5252+ andl $0xfffffff0, %esp
5353+ subl $16, %esp
5454+ movl %edx, 4(%esp)
5555+ movl %eax, (%esp)
5656+ CALL_EXTERN(_cerror_nocancel)
5757+ movl 4(%esp), %esp
5858+ ret
5959+6060+LABEL(__sysenter_trap)
6161+ popl %edx
6262+ movl %esp, %ecx
6363+ sysenter
6464+6565+ .globl _i386_get_ldt
6666+ ALIGN
6767+_i386_get_ldt:
6868+ movl $6,%eax
6969+ MACHDEP_SYSCALL_TRAP
7070+ jnb 2f
7171+ jmp tramp_cerror
7272+2: ret
7373+7474+7575+ .globl _i386_set_ldt
7676+ ALIGN
7777+_i386_set_ldt:
7878+ movl $5,%eax
7979+ MACHDEP_SYSCALL_TRAP
8080+ jnb 2f
8181+ jmp tramp_cerror
8282+2: ret
8383+8484+ ALIGN
8585+ .globl __thread_set_tsd_base
8686+__thread_set_tsd_base:
8787+ pushl 4(%esp)
8888+ pushl $0
8989+ movl $3,%eax
9090+ MACHDEP_SYSCALL_TRAP
9191+ addl $8,%esp
9292+ ret
9393+9494+#elif defined(__x86_64__)
9595+9696+ .globl _i386_get_ldt
9797+ ALIGN
9898+_i386_get_ldt:
9999+ movl $SYSCALL_CONSTRUCT_MDEP(6), %eax
100100+ MACHDEP_SYSCALL_TRAP
101101+ jnb 2f
102102+ movq %rax, %rdi
103103+ jmp _cerror
104104+2: ret
105105+106106+107107+ .globl _i386_set_ldt
108108+ ALIGN
109109+_i386_set_ldt:
110110+ movl $SYSCALL_CONSTRUCT_MDEP(5), %eax
111111+ MACHDEP_SYSCALL_TRAP
112112+ jnb 2f
113113+ movq %rax, %rdi
114114+ jmp _cerror
115115+2: ret
116116+117117+ ALIGN
118118+ .globl __thread_set_tsd_base
119119+__thread_set_tsd_base:
120120+ movl $0, %esi // 0 as the second argument
121121+ movl $ SYSCALL_CONSTRUCT_MDEP(3), %eax // Machine-dependent syscall number 3
122122+ MACHDEP_SYSCALL_TRAP
123123+ ret
124124+125125+#elif defined(__arm__)
126126+127127+ .align 2
128128+ .globl __thread_set_tsd_base
129129+__thread_set_tsd_base:
130130+ mov r3, #2
131131+ mov r12, #0x80000000
132132+ swi #SWI_SYSCALL
133133+ bx lr
134134+135135+#elif defined(__arm64__)
136136+137137+ .align 2
138138+ .globl __thread_set_tsd_base
139139+__thread_set_tsd_base:
140140+ mov x3, #2
141141+ mov x16, #0x80000000
142142+ svc #SWI_SYSCALL
143143+ ret
144144+145145+#else
146146+#error unknown architecture
147147+#endif
148148+149149+.subsections_via_symbols