authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-06-09 00:17:11+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-08 18:38:03-04:00
log2d43db1d767ec56183cd7cf3ee8c5fd929548beb
tree2d09e11b7e93e71c8cab94239375753baab43a2d
parentb57ac48773f1cb4ff34e2be1af7f5b29c2d36de7

libc,macos: update and add missing libc headers


44 files changed, 5346 insertions(+), 54 deletions(-)

lib/libc/include/aarch64-macos-gnu/CommonCrypto/CommonDigest.h created+337
...@@ -0,0 +1,337 @@
1/*
2 * Copyright (c) 2004 Apple Computer, 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/*
25 * CommonDigest.h - common digest routines: MD2, MD4, MD5, SHA1.
26 */
27
28#ifndef _CC_COMMON_DIGEST_H_
29#define _CC_COMMON_DIGEST_H_
30
31#include <stdint.h>
32
33#if defined(_MSC_VER)
34#include <availability.h>
35#else
36#include <os/availability.h>
37#endif
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#define CC_DIGEST_DEPRECATION_WARNING \
45 "This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger)."
46
47/*
48 * For compatibility with legacy implementations, the *Init(), *Update(),
49 * and *Final() functions declared here *always* return a value of 1 (one).
50 * This corresponds to "success" in the similar openssl implementations.
51 * There are no errors of any kind which can be, or are, reported here,
52 * so you can safely ignore the return values of all of these functions
53 * if you are implementing new code.
54 *
55 * The one-shot functions (CC_MD2(), CC_SHA1(), etc.) perform digest
56 * calculation and place the result in the caller-supplied buffer
57 * indicated by the md parameter. They return the md parameter.
58 * Unlike the opensssl counterparts, these one-shot functions require
59 * a non-NULL md pointer. Passing in NULL for the md parameter
60 * results in a NULL return and no digest calculation.
61 */
62
63typedef uint32_t CC_LONG; /* 32 bit unsigned integer */
64typedef uint64_t CC_LONG64; /* 64 bit unsigned integer */
65
66/*** MD2 ***/
67
68#define CC_MD2_DIGEST_LENGTH 16 /* digest length in bytes */
69#define CC_MD2_BLOCK_BYTES 64 /* block size in bytes */
70#define CC_MD2_BLOCK_LONG (CC_MD2_BLOCK_BYTES / sizeof(CC_LONG))
71
72typedef struct CC_MD2state_st
73{
74 int num;
75 unsigned char data[CC_MD2_DIGEST_LENGTH];
76 CC_LONG cksm[CC_MD2_BLOCK_LONG];
77 CC_LONG state[CC_MD2_BLOCK_LONG];
78} CC_MD2_CTX;
79
80extern int CC_MD2_Init(CC_MD2_CTX *c)
81API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
82
83extern int CC_MD2_Update(CC_MD2_CTX *c, const void *data, CC_LONG len)
84API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
85
86extern int CC_MD2_Final(unsigned char *md, CC_MD2_CTX *c)
87API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
88
89extern unsigned char *CC_MD2(const void *data, CC_LONG len, unsigned char *md)
90API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
91
92/*** MD4 ***/
93
94#define CC_MD4_DIGEST_LENGTH 16 /* digest length in bytes */
95#define CC_MD4_BLOCK_BYTES 64 /* block size in bytes */
96#define CC_MD4_BLOCK_LONG (CC_MD4_BLOCK_BYTES / sizeof(CC_LONG))
97
98typedef struct CC_MD4state_st
99{
100 CC_LONG A,B,C,D;
101 CC_LONG Nl,Nh;
102 CC_LONG data[CC_MD4_BLOCK_LONG];
103 uint32_t num;
104} CC_MD4_CTX;
105
106extern int CC_MD4_Init(CC_MD4_CTX *c)
107API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
108
109extern int CC_MD4_Update(CC_MD4_CTX *c, const void *data, CC_LONG len)
110API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
111
112extern int CC_MD4_Final(unsigned char *md, CC_MD4_CTX *c)
113API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
114
115extern unsigned char *CC_MD4(const void *data, CC_LONG len, unsigned char *md)
116API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
117
118
119/*** MD5 ***/
120
121#define CC_MD5_DIGEST_LENGTH 16 /* digest length in bytes */
122#define CC_MD5_BLOCK_BYTES 64 /* block size in bytes */
123#define CC_MD5_BLOCK_LONG (CC_MD5_BLOCK_BYTES / sizeof(CC_LONG))
124
125typedef struct CC_MD5state_st
126{
127 CC_LONG A,B,C,D;
128 CC_LONG Nl,Nh;
129 CC_LONG data[CC_MD5_BLOCK_LONG];
130 int num;
131} CC_MD5_CTX;
132
133extern int CC_MD5_Init(CC_MD5_CTX *c)
134API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
135
136extern int CC_MD5_Update(CC_MD5_CTX *c, const void *data, CC_LONG len)
137API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
138
139extern int CC_MD5_Final(unsigned char *md, CC_MD5_CTX *c)
140API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
141
142extern unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md)
143API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
144
145/*** SHA1 ***/
146
147#define CC_SHA1_DIGEST_LENGTH 20 /* digest length in bytes */
148#define CC_SHA1_BLOCK_BYTES 64 /* block size in bytes */
149#define CC_SHA1_BLOCK_LONG (CC_SHA1_BLOCK_BYTES / sizeof(CC_LONG))
150
151typedef struct CC_SHA1state_st
152{
153 CC_LONG h0,h1,h2,h3,h4;
154 CC_LONG Nl,Nh;
155 CC_LONG data[CC_SHA1_BLOCK_LONG];
156 int num;
157} CC_SHA1_CTX;
158
159extern int CC_SHA1_Init(CC_SHA1_CTX *c);
160
161extern int CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len);
162
163extern int CC_SHA1_Final(unsigned char *md, CC_SHA1_CTX *c);
164
165extern unsigned char *CC_SHA1(const void *data, CC_LONG len, unsigned char *md);
166
167/*** SHA224 ***/
168#define CC_SHA224_DIGEST_LENGTH 28 /* digest length in bytes */
169#define CC_SHA224_BLOCK_BYTES 64 /* block size in bytes */
170
171/* same context struct is used for SHA224 and SHA256 */
172typedef struct CC_SHA256state_st
173{ CC_LONG count[2];
174 CC_LONG hash[8];
175 CC_LONG wbuf[16];
176} CC_SHA256_CTX;
177
178extern int CC_SHA224_Init(CC_SHA256_CTX *c)
179API_AVAILABLE(macos(10.4), ios(2.0));
180
181extern int CC_SHA224_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len)
182API_AVAILABLE(macos(10.4), ios(2.0));
183
184extern int CC_SHA224_Final(unsigned char *md, CC_SHA256_CTX *c)
185API_AVAILABLE(macos(10.4), ios(2.0));
186
187extern unsigned char *CC_SHA224(const void *data, CC_LONG len, unsigned char *md)
188API_AVAILABLE(macos(10.4), ios(2.0));
189
190
191/*** SHA256 ***/
192
193#define CC_SHA256_DIGEST_LENGTH 32 /* digest length in bytes */
194#define CC_SHA256_BLOCK_BYTES 64 /* block size in bytes */
195
196extern int CC_SHA256_Init(CC_SHA256_CTX *c)
197API_AVAILABLE(macos(10.4), ios(2.0));
198
199extern int CC_SHA256_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len)
200API_AVAILABLE(macos(10.4), ios(2.0));
201
202extern int CC_SHA256_Final(unsigned char *md, CC_SHA256_CTX *c)
203API_AVAILABLE(macos(10.4), ios(2.0));
204
205extern unsigned char *CC_SHA256(const void *data, CC_LONG len, unsigned char *md)
206API_AVAILABLE(macos(10.4), ios(2.0));
207
208
209/*** SHA384 ***/
210
211#define CC_SHA384_DIGEST_LENGTH 48 /* digest length in bytes */
212#define CC_SHA384_BLOCK_BYTES 128 /* block size in bytes */
213
214/* same context struct is used for SHA384 and SHA512 */
215typedef struct CC_SHA512state_st
216{ CC_LONG64 count[2];
217 CC_LONG64 hash[8];
218 CC_LONG64 wbuf[16];
219} CC_SHA512_CTX;
220
221extern int CC_SHA384_Init(CC_SHA512_CTX *c)
222API_AVAILABLE(macos(10.4), ios(2.0));
223
224extern int CC_SHA384_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len)
225API_AVAILABLE(macos(10.4), ios(2.0));
226
227extern int CC_SHA384_Final(unsigned char *md, CC_SHA512_CTX *c)
228API_AVAILABLE(macos(10.4), ios(2.0));
229
230extern unsigned char *CC_SHA384(const void *data, CC_LONG len, unsigned char *md)
231API_AVAILABLE(macos(10.4), ios(2.0));
232
233
234/*** SHA512 ***/
235
236#define CC_SHA512_DIGEST_LENGTH 64 /* digest length in bytes */
237#define CC_SHA512_BLOCK_BYTES 128 /* block size in bytes */
238
239extern int CC_SHA512_Init(CC_SHA512_CTX *c)
240API_AVAILABLE(macos(10.4), ios(2.0));
241
242extern int CC_SHA512_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len)
243API_AVAILABLE(macos(10.4), ios(2.0));
244
245extern int CC_SHA512_Final(unsigned char *md, CC_SHA512_CTX *c)
246API_AVAILABLE(macos(10.4), ios(2.0));
247
248extern unsigned char *CC_SHA512(const void *data, CC_LONG len, unsigned char *md)
249API_AVAILABLE(macos(10.4), ios(2.0));
250
251/*
252 * To use the above digest functions with existing code which uses
253 * the corresponding openssl functions, #define the symbol
254 * COMMON_DIGEST_FOR_OPENSSL in your client code (BEFORE including
255 * this file), and simply link against libSystem (or System.framework)
256 * instead of libcrypto.
257 *
258 * You can *NOT* mix and match functions operating on a given data
259 * type from the two implementations; i.e., if you do a CC_MD5_Init()
260 * on a CC_MD5_CTX object, do not assume that you can do an openssl-style
261 * MD5_Update() on that same context.
262 */
263
264#ifdef COMMON_DIGEST_FOR_OPENSSL
265
266#define MD2_DIGEST_LENGTH CC_MD2_DIGEST_LENGTH
267#define MD2_CTX CC_MD2_CTX
268#define MD2_Init CC_MD2_Init
269#define MD2_Update CC_MD2_Update
270#define MD2_Final CC_MD2_Final
271
272#define MD4_DIGEST_LENGTH CC_MD4_DIGEST_LENGTH
273#define MD4_CTX CC_MD4_CTX
274#define MD4_Init CC_MD4_Init
275#define MD4_Update CC_MD4_Update
276#define MD4_Final CC_MD4_Final
277
278#define MD5_DIGEST_LENGTH CC_MD5_DIGEST_LENGTH
279#define MD5_CTX CC_MD5_CTX
280#define MD5_Init CC_MD5_Init
281#define MD5_Update CC_MD5_Update
282#define MD5_Final CC_MD5_Final
283
284#define SHA_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH
285#define SHA_CTX CC_SHA1_CTX
286#define SHA1_Init CC_SHA1_Init
287#define SHA1_Update CC_SHA1_Update
288#define SHA1_Final CC_SHA1_Final
289
290#define SHA224_DIGEST_LENGTH CC_SHA224_DIGEST_LENGTH
291#define SHA256_CTX CC_SHA256_CTX
292#define SHA224_Init CC_SHA224_Init
293#define SHA224_Update CC_SHA224_Update
294#define SHA224_Final CC_SHA224_Final
295
296#define SHA256_DIGEST_LENGTH CC_SHA256_DIGEST_LENGTH
297#define SHA256_Init CC_SHA256_Init
298#define SHA256_Update CC_SHA256_Update
299#define SHA256_Final CC_SHA256_Final
300
301#define SHA384_DIGEST_LENGTH CC_SHA384_DIGEST_LENGTH
302#define SHA512_CTX CC_SHA512_CTX
303#define SHA384_Init CC_SHA384_Init
304#define SHA384_Update CC_SHA384_Update
305#define SHA384_Final CC_SHA384_Final
306
307#define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH
308#define SHA512_Init CC_SHA512_Init
309#define SHA512_Update CC_SHA512_Update
310#define SHA512_Final CC_SHA512_Final
311
312
313#endif /* COMMON_DIGEST_FOR_OPENSSL */
314
315/*
316 * In a manner similar to that described above for openssl
317 * compatibility, these macros can be used to provide compatiblity
318 * with legacy implementations of MD5 using the interface defined
319 * in RFC 1321.
320 */
321
322#ifdef COMMON_DIGEST_FOR_RFC_1321
323
324#define MD5_CTX CC_MD5_CTX
325#define MD5Init CC_MD5_Init
326#define MD5Update CC_MD5_Update
327
328void MD5Final (unsigned char [16], MD5_CTX *)
329API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));
330
331#endif /* COMMON_DIGEST_FOR_RFC_1321 */
332
333#ifdef __cplusplus
334}
335#endif
336
337#endif /* _CC_COMMON_DIGEST_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/ar.h created+67
...@@ -0,0 +1,67 @@
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
9 *
10 * This code is derived from software contributed to Berkeley by
11 * Hugh Smith at The University of Guelph.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by the University of
24 * California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * @(#)ar.h 8.2 (Berkeley) 1/21/94
42 */
43
44#ifndef _AR_H_
45#define _AR_H_
46
47/* Pre-4BSD archives had these magic numbers in them. */
48#define OARMAG1 0177555
49#define OARMAG2 0177545
50
51#define ARMAG "!<arch>\n" /* ar "magic number" */
52#define SARMAG 8 /* strlen(ARMAG); */
53
54#define AR_EFMT1 "#1/" /* extended format #1 */
55
56struct ar_hdr {
57 char ar_name[16]; /* name */
58 char ar_date[12]; /* modification time */
59 char ar_uid[6]; /* user id */
60 char ar_gid[6]; /* group id */
61 char ar_mode[8]; /* octal file permissions */
62 char ar_size[10]; /* size in bytes */
63#define ARFMAG "`\n"
64 char ar_fmag[2]; /* consistency check */
65};
66
67#endif /* !_AR_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/arch.h created+150
...@@ -0,0 +1,150 @@
1/*
2 * Copyright (c) 1999 Apple Computer, 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#ifndef _MACH_O_ARCH_H_
24#define _MACH_O_ARCH_H_
25/*
26 * Copyright (c) 1997 Apple Computer, Inc.
27 *
28 * Functions that deal with information about architectures.
29 *
30 */
31
32#include <stdint.h>
33#include <mach/machine.h>
34#include <architecture/byte_order.h>
35
36/* The NXArchInfo structs contain the architectures symbolic name
37 * (such as "ppc"), its CPU type and CPU subtype as defined in
38 * mach/machine.h, the byte order for the architecture, and a
39 * describing string (such as "PowerPC").
40 * There will both be entries for specific CPUs (such as ppc604e) as
41 * well as generic "family" entries (such as ppc).
42 */
43typedef struct {
44 const char *name;
45 cpu_type_t cputype;
46 cpu_subtype_t cpusubtype;
47 enum NXByteOrder byteorder;
48 const char *description;
49} NXArchInfo;
50
51#ifdef __cplusplus
52extern "C" {
53#endif /* __cplusplus */
54
55/* NXGetAllArchInfos() returns a pointer to an array of all known
56 * NXArchInfo structures. The last NXArchInfo is marked by a NULL name.
57 */
58extern const NXArchInfo *NXGetAllArchInfos(void);
59
60/* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL
61 * if none is known.
62 */
63extern const NXArchInfo *NXGetLocalArchInfo(void);
64
65/* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the
66 * NXArchInfo from the architecture's name or cputype/cpusubtype
67 * combination. A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used
68 * to request the most general NXArchInfo known for the given cputype.
69 * NULL is returned if no matching NXArchInfo can be found.
70 */
71extern const NXArchInfo *NXGetArchInfoFromName(const char *name);
72extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
73 cpu_subtype_t cpusubtype);
74
75/* The above interfaces that return pointers to NXArchInfo structs in normal
76 * cases returns a pointer from the array returned in NXGetAllArchInfos().
77 * In some cases when the cputype is CPU_TYPE_I386 or CPU_TYPE_POWERPC it will
78 * retun malloc(3)'ed NXArchInfo struct which contains a string in the
79 * description field also a malloc(3)'ed pointer. To allow programs not to
80 * leak memory they can call NXFreeArchInfo() on pointers returned from the
81 * above interfaces. Since this is a new API on older systems can use the
82 * code below. Going forward the above interfaces will only return pointers
83 * from the array returned in NXGetAllArchInfos().
84 */
85extern void NXFreeArchInfo(const NXArchInfo *x);
86
87/* The code that can be used for NXFreeArchInfo() when it is not available is:
88 *
89 * static void NXFreeArchInfo(
90 * const NXArchInfo *x)
91 * {
92 * const NXArchInfo *p;
93 *
94 * p = NXGetAllArchInfos();
95 * while(p->name != NULL){
96 * if(x == p)
97 * return;
98 * p++;
99 * }
100 * free((char *)x->description);
101 * free((NXArchInfo *)x);
102 * }
103 */
104
105/* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
106 * fat_arch structs and selects the best one that matches (if any) and returns
107 * a pointer to that fat_arch struct (or NULL). The fat_arch structs must be
108 * in the host byte order and correct such that the fat_archs really points to
109 * enough memory for nfat_arch structs. It is possible that this routine could
110 * fail if new cputypes or cpusubtypes are added and an old version of this
111 * routine is used. But if there is an exact match between the cputype and
112 * cpusubtype and one of the fat_arch structs this routine will always succeed.
113 */
114extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
115 cpu_subtype_t cpusubtype,
116 struct fat_arch *fat_archs,
117 uint32_t nfat_archs);
118
119/* NXFindBestFatArch_64() is passed a cputype and cpusubtype and a set of
120 * fat_arch_64 structs and selects the best one that matches (if any) and
121 * returns a pointer to that fat_arch_64 struct (or NULL). The fat_arch_64
122 * structs must be in the host byte order and correct such that the fat_archs64
123 * really points to enough memory for nfat_arch structs. It is possible that
124 * this routine could fail if new cputypes or cpusubtypes are added and an old
125 * version of this routine is used. But if there is an exact match between the
126 * cputype and cpusubtype and one of the fat_arch_64 structs this routine will
127 * always succeed.
128 */
129extern struct fat_arch_64 *NXFindBestFatArch_64(cpu_type_t cputype,
130 cpu_subtype_t cpusubtype,
131 struct fat_arch_64 *fat_archs64,
132 uint32_t nfat_archs);
133
134/* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
135 * different cpusubtypes for the specified cputype. If the two cpusubtypes
136 * can't be combined (the specific subtypes are mutually exclusive) -1 is
137 * returned indicating it is an error to combine them. This can also fail and
138 * return -1 if new cputypes or cpusubtypes are added and an old version of
139 * this routine is used. But if the cpusubtypes are the same they can always
140 * be combined and this routine will return the cpusubtype pass in.
141 */
142extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
143 cpu_subtype_t cpusubtype1,
144 cpu_subtype_t cpusubtype2);
145
146#ifdef __cplusplus
147}
148#endif /* __cplusplus */
149
150#endif /* _MACH_O_ARCH_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/arm64/reloc.h created+68
...@@ -0,0 +1,68 @@
1/*
2 * Copyright (c) 2010 Apple Computer, 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#ifndef _MACHO_ARM64_RELOC_H_
25#define _MACHO_ARM64_RELOC_H_
26
27/*
28 * Relocation types used in the arm64 implementation.
29 */
30enum reloc_type_arm64
31{
32 ARM64_RELOC_UNSIGNED, // for pointers
33 ARM64_RELOC_SUBTRACTOR, // must be followed by a ARM64_RELOC_UNSIGNED
34 ARM64_RELOC_BRANCH26, // a B/BL instruction with 26-bit displacement
35 ARM64_RELOC_PAGE21, // pc-rel distance to page of target
36 ARM64_RELOC_PAGEOFF12, // offset within page, scaled by r_length
37 ARM64_RELOC_GOT_LOAD_PAGE21, // pc-rel distance to page of GOT slot
38 ARM64_RELOC_GOT_LOAD_PAGEOFF12, // offset within page of GOT slot,
39 // scaled by r_length
40 ARM64_RELOC_POINTER_TO_GOT, // for pointers to GOT slots
41 ARM64_RELOC_TLVP_LOAD_PAGE21, // pc-rel distance to page of TLVP slot
42 ARM64_RELOC_TLVP_LOAD_PAGEOFF12, // offset within page of TLVP slot,
43 // scaled by r_length
44 ARM64_RELOC_ADDEND, // must be followed by PAGE21 or PAGEOFF12
45
46 // An arm64e authenticated pointer.
47 //
48 // Represents a pointer to a symbol (like ARM64_RELOC_UNSIGNED).
49 // Additionally, the resulting pointer is signed. The signature is
50 // specified in the target location: the addend is restricted to the lower
51 // 32 bits (instead of the full 64 bits for ARM64_RELOC_UNSIGNED):
52 //
53 // |63|62|61-51|50-49| 48 |47 - 32|31 - 0|
54 // | 1| 0| 0 | key | addr | discriminator | addend |
55 //
56 // The key is one of:
57 // IA: 00 IB: 01
58 // DA: 10 DB: 11
59 //
60 // The discriminator field is used as extra signature diversification.
61 //
62 // The addr field indicates whether the target address should be blended
63 // into the discriminator.
64 //
65 ARM64_RELOC_AUTHENTICATED_POINTER,
66};
67
68#endif /* #ifndef _MACHO_ARM64_RELOC_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/compact_unwind_encoding.h created+532
...@@ -0,0 +1,532 @@
1//===------------------ mach-o/compact_unwind_encoding.h ------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//
8// Darwin's alternative to DWARF based unwind encodings.
9//
10//===----------------------------------------------------------------------===//
11
12
13#ifndef __COMPACT_UNWIND_ENCODING__
14#define __COMPACT_UNWIND_ENCODING__
15
16#include <stdint.h>
17
18//
19// Compilers can emit standard DWARF FDEs in the __TEXT,__eh_frame section
20// of object files. Or compilers can emit compact unwind information in
21// the __LD,__compact_unwind section.
22//
23// When the linker creates a final linked image, it will create a
24// __TEXT,__unwind_info section. This section is a small and fast way for the
25// runtime to access unwind info for any given function. If the compiler
26// emitted compact unwind info for the function, that compact unwind info will
27// be encoded in the __TEXT,__unwind_info section. If the compiler emitted
28// DWARF unwind info, the __TEXT,__unwind_info section will contain the offset
29// of the FDE in the __TEXT,__eh_frame section in the final linked image.
30//
31// Note: Previously, the linker would transform some DWARF unwind infos into
32// compact unwind info. But that is fragile and no longer done.
33
34
35//
36// The compact unwind endoding is a 32-bit value which encoded in an
37// architecture specific way, which registers to restore from where, and how
38// to unwind out of the function.
39//
40typedef uint32_t compact_unwind_encoding_t;
41
42
43// architecture independent bits
44enum {
45 UNWIND_IS_NOT_FUNCTION_START = 0x80000000,
46 UNWIND_HAS_LSDA = 0x40000000,
47 UNWIND_PERSONALITY_MASK = 0x30000000,
48};
49
50
51
52
53//
54// x86
55//
56// 1-bit: start
57// 1-bit: has lsda
58// 2-bit: personality index
59//
60// 4-bits: 0=old, 1=ebp based, 2=stack-imm, 3=stack-ind, 4=DWARF
61// ebp based:
62// 15-bits (5*3-bits per reg) register permutation
63// 8-bits for stack offset
64// frameless:
65// 8-bits stack size
66// 3-bits stack adjust
67// 3-bits register count
68// 10-bits register permutation
69//
70enum {
71 UNWIND_X86_MODE_MASK = 0x0F000000,
72 UNWIND_X86_MODE_EBP_FRAME = 0x01000000,
73 UNWIND_X86_MODE_STACK_IMMD = 0x02000000,
74 UNWIND_X86_MODE_STACK_IND = 0x03000000,
75 UNWIND_X86_MODE_DWARF = 0x04000000,
76
77 UNWIND_X86_EBP_FRAME_REGISTERS = 0x00007FFF,
78 UNWIND_X86_EBP_FRAME_OFFSET = 0x00FF0000,
79
80 UNWIND_X86_FRAMELESS_STACK_SIZE = 0x00FF0000,
81 UNWIND_X86_FRAMELESS_STACK_ADJUST = 0x0000E000,
82 UNWIND_X86_FRAMELESS_STACK_REG_COUNT = 0x00001C00,
83 UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF,
84
85 UNWIND_X86_DWARF_SECTION_OFFSET = 0x00FFFFFF,
86};
87
88enum {
89 UNWIND_X86_REG_NONE = 0,
90 UNWIND_X86_REG_EBX = 1,
91 UNWIND_X86_REG_ECX = 2,
92 UNWIND_X86_REG_EDX = 3,
93 UNWIND_X86_REG_EDI = 4,
94 UNWIND_X86_REG_ESI = 5,
95 UNWIND_X86_REG_EBP = 6,
96};
97
98//
99// For x86 there are four modes for the compact unwind encoding:
100// UNWIND_X86_MODE_EBP_FRAME:
101// EBP based frame where EBP is push on stack immediately after return address,
102// then ESP is moved to EBP. Thus, to unwind ESP is restored with the current
103// EPB value, then EBP is restored by popping off the stack, and the return
104// is done by popping the stack once more into the pc.
105// All non-volatile registers that need to be restored must have been saved
106// in a small range in the stack that starts EBP-4 to EBP-1020. The offset/4
107// is encoded in the UNWIND_X86_EBP_FRAME_OFFSET bits. The registers saved
108// are encoded in the UNWIND_X86_EBP_FRAME_REGISTERS bits as five 3-bit entries.
109// Each entry contains which register to restore.
110// UNWIND_X86_MODE_STACK_IMMD:
111// A "frameless" (EBP not used as frame pointer) function with a small
112// constant stack size. To return, a constant (encoded in the compact
113// unwind encoding) is added to the ESP. Then the return is done by
114// popping the stack into the pc.
115// All non-volatile registers that need to be restored must have been saved
116// on the stack immediately after the return address. The stack_size/4 is
117// encoded in the UNWIND_X86_FRAMELESS_STACK_SIZE (max stack size is 1024).
118// The number of registers saved is encoded in UNWIND_X86_FRAMELESS_STACK_REG_COUNT.
119// UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION constains which registers were
120// saved and their order.
121// UNWIND_X86_MODE_STACK_IND:
122// A "frameless" (EBP not used as frame pointer) function large constant
123// stack size. This case is like the previous, except the stack size is too
124// large to encode in the compact unwind encoding. Instead it requires that
125// the function contains "subl $nnnnnnnn,ESP" in its prolog. The compact
126// encoding contains the offset to the nnnnnnnn value in the function in
127// UNWIND_X86_FRAMELESS_STACK_SIZE.
128// UNWIND_X86_MODE_DWARF:
129// No compact unwind encoding is available. Instead the low 24-bits of the
130// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
131// This mode is never used in object files. It is only generated by the
132// linker in final linked images which have only DWARF unwind info for a
133// function.
134//
135// The permutation encoding is a Lehmer code sequence encoded into a
136// single variable-base number so we can encode the ordering of up to
137// six registers in a 10-bit space.
138//
139// The following is the algorithm used to create the permutation encoding used
140// with frameless stacks. It is passed the number of registers to be saved and
141// an array of the register numbers saved.
142//
143//uint32_t permute_encode(uint32_t registerCount, const uint32_t registers[6])
144//{
145// uint32_t renumregs[6];
146// for (int i=6-registerCount; i < 6; ++i) {
147// int countless = 0;
148// for (int j=6-registerCount; j < i; ++j) {
149// if ( registers[j] < registers[i] )
150// ++countless;
151// }
152// renumregs[i] = registers[i] - countless -1;
153// }
154// uint32_t permutationEncoding = 0;
155// switch ( registerCount ) {
156// case 6:
157// permutationEncoding |= (120*renumregs[0] + 24*renumregs[1]
158// + 6*renumregs[2] + 2*renumregs[3]
159// + renumregs[4]);
160// break;
161// case 5:
162// permutationEncoding |= (120*renumregs[1] + 24*renumregs[2]
163// + 6*renumregs[3] + 2*renumregs[4]
164// + renumregs[5]);
165// break;
166// case 4:
167// permutationEncoding |= (60*renumregs[2] + 12*renumregs[3]
168// + 3*renumregs[4] + renumregs[5]);
169// break;
170// case 3:
171// permutationEncoding |= (20*renumregs[3] + 4*renumregs[4]
172// + renumregs[5]);
173// break;
174// case 2:
175// permutationEncoding |= (5*renumregs[4] + renumregs[5]);
176// break;
177// case 1:
178// permutationEncoding |= (renumregs[5]);
179// break;
180// }
181// return permutationEncoding;
182//}
183//
184
185
186
187
188//
189// x86_64
190//
191// 1-bit: start
192// 1-bit: has lsda
193// 2-bit: personality index
194//
195// 4-bits: 0=old, 1=rbp based, 2=stack-imm, 3=stack-ind, 4=DWARF
196// rbp based:
197// 15-bits (5*3-bits per reg) register permutation
198// 8-bits for stack offset
199// frameless:
200// 8-bits stack size
201// 3-bits stack adjust
202// 3-bits register count
203// 10-bits register permutation
204//
205enum {
206 UNWIND_X86_64_MODE_MASK = 0x0F000000,
207 UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000,
208 UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000,
209 UNWIND_X86_64_MODE_STACK_IND = 0x03000000,
210 UNWIND_X86_64_MODE_DWARF = 0x04000000,
211
212 UNWIND_X86_64_RBP_FRAME_REGISTERS = 0x00007FFF,
213 UNWIND_X86_64_RBP_FRAME_OFFSET = 0x00FF0000,
214
215 UNWIND_X86_64_FRAMELESS_STACK_SIZE = 0x00FF0000,
216 UNWIND_X86_64_FRAMELESS_STACK_ADJUST = 0x0000E000,
217 UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT = 0x00001C00,
218 UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF,
219
220 UNWIND_X86_64_DWARF_SECTION_OFFSET = 0x00FFFFFF,
221};
222
223enum {
224 UNWIND_X86_64_REG_NONE = 0,
225 UNWIND_X86_64_REG_RBX = 1,
226 UNWIND_X86_64_REG_R12 = 2,
227 UNWIND_X86_64_REG_R13 = 3,
228 UNWIND_X86_64_REG_R14 = 4,
229 UNWIND_X86_64_REG_R15 = 5,
230 UNWIND_X86_64_REG_RBP = 6,
231};
232//
233// For x86_64 there are four modes for the compact unwind encoding:
234// UNWIND_X86_64_MODE_RBP_FRAME:
235// RBP based frame where RBP is push on stack immediately after return address,
236// then RSP is moved to RBP. Thus, to unwind RSP is restored with the current
237// EPB value, then RBP is restored by popping off the stack, and the return
238// is done by popping the stack once more into the pc.
239// All non-volatile registers that need to be restored must have been saved
240// in a small range in the stack that starts RBP-8 to RBP-2040. The offset/8
241// is encoded in the UNWIND_X86_64_RBP_FRAME_OFFSET bits. The registers saved
242// are encoded in the UNWIND_X86_64_RBP_FRAME_REGISTERS bits as five 3-bit entries.
243// Each entry contains which register to restore.
244// UNWIND_X86_64_MODE_STACK_IMMD:
245// A "frameless" (RBP not used as frame pointer) function with a small
246// constant stack size. To return, a constant (encoded in the compact
247// unwind encoding) is added to the RSP. Then the return is done by
248// popping the stack into the pc.
249// All non-volatile registers that need to be restored must have been saved
250// on the stack immediately after the return address. The stack_size/8 is
251// encoded in the UNWIND_X86_64_FRAMELESS_STACK_SIZE (max stack size is 2048).
252// The number of registers saved is encoded in UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT.
253// UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION constains which registers were
254// saved and their order.
255// UNWIND_X86_64_MODE_STACK_IND:
256// A "frameless" (RBP not used as frame pointer) function large constant
257// stack size. This case is like the previous, except the stack size is too
258// large to encode in the compact unwind encoding. Instead it requires that
259// the function contains "subq $nnnnnnnn,RSP" in its prolog. The compact
260// encoding contains the offset to the nnnnnnnn value in the function in
261// UNWIND_X86_64_FRAMELESS_STACK_SIZE.
262// UNWIND_X86_64_MODE_DWARF:
263// No compact unwind encoding is available. Instead the low 24-bits of the
264// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
265// This mode is never used in object files. It is only generated by the
266// linker in final linked images which have only DWARF unwind info for a
267// function.
268//
269
270
271// ARM64
272//
273// 1-bit: start
274// 1-bit: has lsda
275// 2-bit: personality index
276//
277// 4-bits: 4=frame-based, 3=DWARF, 2=frameless
278// frameless:
279// 12-bits of stack size
280// frame-based:
281// 4-bits D reg pairs saved
282// 5-bits X reg pairs saved
283// DWARF:
284// 24-bits offset of DWARF FDE in __eh_frame section
285//
286enum {
287 UNWIND_ARM64_MODE_MASK = 0x0F000000,
288 UNWIND_ARM64_MODE_FRAMELESS = 0x02000000,
289 UNWIND_ARM64_MODE_DWARF = 0x03000000,
290 UNWIND_ARM64_MODE_FRAME = 0x04000000,
291
292 UNWIND_ARM64_FRAME_X19_X20_PAIR = 0x00000001,
293 UNWIND_ARM64_FRAME_X21_X22_PAIR = 0x00000002,
294 UNWIND_ARM64_FRAME_X23_X24_PAIR = 0x00000004,
295 UNWIND_ARM64_FRAME_X25_X26_PAIR = 0x00000008,
296 UNWIND_ARM64_FRAME_X27_X28_PAIR = 0x00000010,
297 UNWIND_ARM64_FRAME_D8_D9_PAIR = 0x00000100,
298 UNWIND_ARM64_FRAME_D10_D11_PAIR = 0x00000200,
299 UNWIND_ARM64_FRAME_D12_D13_PAIR = 0x00000400,
300 UNWIND_ARM64_FRAME_D14_D15_PAIR = 0x00000800,
301
302 UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK = 0x00FFF000,
303 UNWIND_ARM64_DWARF_SECTION_OFFSET = 0x00FFFFFF,
304};
305// For arm64 there are three modes for the compact unwind encoding:
306// UNWIND_ARM64_MODE_FRAME:
307// This is a standard arm64 prolog where FP/LR are immediately pushed on the
308// stack, then SP is copied to FP. If there are any non-volatile registers
309// saved, then are copied into the stack frame in pairs in a contiguous
310// range right below the saved FP/LR pair. Any subset of the five X pairs
311// and four D pairs can be saved, but the memory layout must be in register
312// number order.
313// UNWIND_ARM64_MODE_FRAMELESS:
314// A "frameless" leaf function, where FP/LR are not saved. The return address
315// remains in LR throughout the function. If any non-volatile registers
316// are saved, they must be pushed onto the stack before any stack space is
317// allocated for local variables. The stack sized (including any saved
318// non-volatile registers) divided by 16 is encoded in the bits
319// UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK.
320// UNWIND_ARM64_MODE_DWARF:
321// No compact unwind encoding is available. Instead the low 24-bits of the
322// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
323// This mode is never used in object files. It is only generated by the
324// linker in final linked images which have only DWARF unwind info for a
325// function.
326//
327
328
329#ifndef __OPEN_SOURCE__
330//
331// armv7k
332//
333// 1-bit: start
334// 1-bit: has lsda
335// 2-bit: personality index
336//
337// 4-bits: 1=frame, 2=frame+dregs, 4=dwarf
338//
339enum {
340 UNWIND_ARM_MODE_MASK = 0x0F000000,
341 UNWIND_ARM_MODE_FRAME = 0x01000000,
342 UNWIND_ARM_MODE_FRAME_D = 0x02000000,
343 UNWIND_ARM_MODE_DWARF = 0x04000000,
344
345 UNWIND_ARM_FRAME_STACK_ADJUST_MASK = 0x00C00000,
346
347 UNWIND_ARM_FRAME_FIRST_PUSH_R4 = 0x00000001,
348 UNWIND_ARM_FRAME_FIRST_PUSH_R5 = 0x00000002,
349 UNWIND_ARM_FRAME_FIRST_PUSH_R6 = 0x00000004,
350
351 UNWIND_ARM_FRAME_SECOND_PUSH_R8 = 0x00000008,
352 UNWIND_ARM_FRAME_SECOND_PUSH_R9 = 0x00000010,
353 UNWIND_ARM_FRAME_SECOND_PUSH_R10 = 0x00000020,
354 UNWIND_ARM_FRAME_SECOND_PUSH_R11 = 0x00000040,
355 UNWIND_ARM_FRAME_SECOND_PUSH_R12 = 0x00000080,
356
357 UNWIND_ARM_FRAME_D_REG_COUNT_MASK = 0x00000700,
358
359 UNWIND_ARM_DWARF_SECTION_OFFSET = 0x00FFFFFF,
360};
361// For armv7k there are three modes for the compact unwind encoding:
362// UNWIND_ARM_MODE_FRAME:
363// This is a standard arm prolog where lr/r7 are immediately pushed on the
364// stack. As part of that first push r4, r5, or r6 can be also pushed
365// and if so the FIRST_PUSH bit is set in the compact unwind. Additionally
366// there can be a second push multiple which can save r8 through r12.
367// If that is used, the registers saved is recorded with a SECOND_PUSH bit.
368// Lastly, for var-args support, the prolog may save r1, r2, r3 to the
369// stack before the frame push. If that is done the STACK_ADJUST_MASK
370// records that the stack pointer must be adjust (e.g 0x00800000 means
371// the stack pointer was adjusted 8 bytes down and the unwinder would
372// need to add back 8 bytes to SP when unwinding through this function.
373// UNWIND_ARM_MODE_FRAME_D:
374// This is the same as UNWIND_ARM_MODE_FRAME, except that additionally
375// some D registers were saved. The D_REG_COUNT_MASK contains which
376// set if D registers were saved and where. There are currently 8 (0-7)
377// possible D register save patterns supported.
378// UNWIND_ARM_MODE_DWARF:
379// No compact unwind encoding is available. Instead the low 24-bits of the
380// compact encoding is the offset of the dwarf FDE in the __eh_frame section.
381// The offset only exists in final linked images. It is zero in object files.
382#endif
383
384
385
386
387
388////////////////////////////////////////////////////////////////////////////////
389//
390// Relocatable Object Files: __LD,__compact_unwind
391//
392////////////////////////////////////////////////////////////////////////////////
393
394//
395// A compiler can generated compact unwind information for a function by adding
396// a "row" to the __LD,__compact_unwind section. This section has the
397// S_ATTR_DEBUG bit set, so the section will be ignored by older linkers.
398// It is removed by the new linker, so never ends up in final executables.
399// This section is a table, initially with one row per function (that needs
400// unwind info). The table columns and some conceptual entries are:
401//
402// range-start pointer to start of function/range
403// range-length
404// compact-unwind-encoding 32-bit encoding
405// personality-function or zero if no personality function
406// lsda or zero if no LSDA data
407//
408// The length and encoding fields are 32-bits. The other are all pointer sized.
409//
410// In x86_64 assembly, these entry would look like:
411//
412// .section __LD,__compact_unwind,regular,debug
413//
414// #compact unwind for _foo
415// .quad _foo
416// .set L1,LfooEnd-_foo
417// .long L1
418// .long 0x01010001
419// .quad 0
420// .quad 0
421//
422// #compact unwind for _bar
423// .quad _bar
424// .set L2,LbarEnd-_bar
425// .long L2
426// .long 0x01020011
427// .quad __gxx_personality
428// .quad except_tab1
429//
430//
431// Notes: There is no need for any labels in the the __compact_unwind section.
432// The use of the .set directive is to force the evaluation of the
433// range-length at assembly time, instead of generating relocations.
434//
435// To support future compiler optimizations where which non-volatile registers
436// are saved changes within a function (e.g. delay saving non-volatiles until
437// necessary), there can by multiple lines in the __compact_unwind table for one
438// function, each with a different (non-overlapping) range and each with
439// different compact unwind encodings that correspond to the non-volatiles
440// saved at that range of the function.
441//
442// If a particular function is so wacky that there is no compact unwind way
443// to encode it, then the compiler can emit traditional DWARF unwind info.
444// The runtime will use which ever is available.
445//
446// Runtime support for compact unwind encodings are only available on 10.6
447// and later. So, the compiler should not generate it when targeting pre-10.6.
448
449
450
451
452////////////////////////////////////////////////////////////////////////////////
453//
454// Final Linked Images: __TEXT,__unwind_info
455//
456////////////////////////////////////////////////////////////////////////////////
457
458//
459// The __TEXT,__unwind_info section is laid out for an efficient two level lookup.
460// The header of the section contains a coarse index that maps function address
461// to the page (4096 byte block) containing the unwind info for that function.
462//
463
464#define UNWIND_SECTION_VERSION 1
465struct unwind_info_section_header
466{
467 uint32_t version; // UNWIND_SECTION_VERSION
468 uint32_t commonEncodingsArraySectionOffset;
469 uint32_t commonEncodingsArrayCount;
470 uint32_t personalityArraySectionOffset;
471 uint32_t personalityArrayCount;
472 uint32_t indexSectionOffset;
473 uint32_t indexCount;
474 // compact_unwind_encoding_t[]
475 // uint32_t personalities[]
476 // unwind_info_section_header_index_entry[]
477 // unwind_info_section_header_lsda_index_entry[]
478};
479
480struct unwind_info_section_header_index_entry
481{
482 uint32_t functionOffset;
483 uint32_t secondLevelPagesSectionOffset; // section offset to start of regular or compress page
484 uint32_t lsdaIndexArraySectionOffset; // section offset to start of lsda_index array for this range
485};
486
487struct unwind_info_section_header_lsda_index_entry
488{
489 uint32_t functionOffset;
490 uint32_t lsdaOffset;
491};
492
493//
494// There are two kinds of second level index pages: regular and compressed.
495// A compressed page can hold up to 1021 entries, but it cannot be used
496// if too many different encoding types are used. The regular page holds
497// 511 entries.
498//
499
500struct unwind_info_regular_second_level_entry
501{
502 uint32_t functionOffset;
503 compact_unwind_encoding_t encoding;
504};
505
506#define UNWIND_SECOND_LEVEL_REGULAR 2
507struct unwind_info_regular_second_level_page_header
508{
509 uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR
510 uint16_t entryPageOffset;
511 uint16_t entryCount;
512 // entry array
513};
514
515#define UNWIND_SECOND_LEVEL_COMPRESSED 3
516struct unwind_info_compressed_second_level_page_header
517{
518 uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED
519 uint16_t entryPageOffset;
520 uint16_t entryCount;
521 uint16_t encodingsPageOffset;
522 uint16_t encodingsCount;
523 // 32-bit entry array
524 // encodings array
525};
526
527#define UNWIND_INFO_COMPRESSED_ENTRY_FUNC_OFFSET(entry) (entry & 0x00FFFFFF)
528#define UNWIND_INFO_COMPRESSED_ENTRY_ENCODING_INDEX(entry) ((entry >> 24) & 0xFF)
529
530
531
532#endif
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/fat.h created+83
...@@ -0,0 +1,83 @@
1/*
2 * Copyright (c) 2016 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#ifndef _MACH_O_FAT_H_
24#define _MACH_O_FAT_H_
25/*
26 * This header file describes the structures of the file format for "fat"
27 * architecture specific file (wrapper design). At the begining of the file
28 * there is one fat_header structure followed by a number of fat_arch
29 * structures. For each architecture in the file, specified by a pair of
30 * cputype and cpusubtype, the fat_header describes the file offset, file
31 * size and alignment in the file of the architecture specific member.
32 * The padded bytes in the file to place each member on it's specific alignment
33 * are defined to be read as zeros and can be left as "holes" if the file system
34 * can support them as long as they read as zeros.
35 *
36 * All structures defined here are always written and read to/from disk
37 * in big-endian order.
38 */
39
40/*
41 * <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
42 * and contains the constants for the possible values of these types.
43 */
44#include <stdint.h>
45#include <mach/machine.h>
46#include <architecture/byte_order.h>
47
48#define FAT_MAGIC 0xcafebabe
49#define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */
50
51struct fat_header {
52 uint32_t magic; /* FAT_MAGIC or FAT_MAGIC_64 */
53 uint32_t nfat_arch; /* number of structs that follow */
54};
55
56struct fat_arch {
57 cpu_type_t cputype; /* cpu specifier (int) */
58 cpu_subtype_t cpusubtype; /* machine specifier (int) */
59 uint32_t offset; /* file offset to this object file */
60 uint32_t size; /* size of this object file */
61 uint32_t align; /* alignment as a power of 2 */
62};
63
64/*
65 * The support for the 64-bit fat file format described here is a work in
66 * progress and not yet fully supported in all the Apple Developer Tools.
67 *
68 * When a slice is greater than 4mb or an offset to a slice is greater than 4mb
69 * then the 64-bit fat file format is used.
70 */
71#define FAT_MAGIC_64 0xcafebabf
72#define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */
73
74struct fat_arch_64 {
75 cpu_type_t cputype; /* cpu specifier (int) */
76 cpu_subtype_t cpusubtype; /* machine specifier (int) */
77 uint64_t offset; /* file offset to this object file */
78 uint64_t size; /* size of this object file */
79 uint32_t align; /* alignment as a power of 2 */
80 uint32_t reserved; /* reserved */
81};
82
83#endif /* _MACH_O_FAT_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/nlist.h created+324
...@@ -0,0 +1,324 @@
1/*
2 * Copyright (c) 1999-2003 Apple Computer, 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#ifndef _MACHO_NLIST_H_
24#define _MACHO_NLIST_H_
25/* $NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $ */
26
27/*-
28 * Copyright (c) 1991, 1993
29 * The Regents of the University of California. All rights reserved.
30 * (c) UNIX System Laboratories, Inc.
31 * All or some portions of this file are derived from material licensed
32 * to the University of California by American Telephone and Telegraph
33 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
34 * the permission of UNIX System Laboratories, Inc.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)nlist.h 8.2 (Berkeley) 1/21/94
65 */
66#include <stdint.h>
67
68/*
69 * Format of a symbol table entry of a Mach-O file for 32-bit architectures.
70 * Modified from the BSD format. The modifications from the original format
71 * were changing n_other (an unused field) to n_sect and the addition of the
72 * N_SECT type. These modifications are required to support symbols in a larger
73 * number of sections not just the three sections (text, data and bss) in a BSD
74 * file.
75 */
76struct nlist {
77 union {
78#ifndef __LP64__
79 char *n_name; /* for use when in-core */
80#endif
81 uint32_t n_strx; /* index into the string table */
82 } n_un;
83 uint8_t n_type; /* type flag, see below */
84 uint8_t n_sect; /* section number or NO_SECT */
85 int16_t n_desc; /* see <mach-o/stab.h> */
86 uint32_t n_value; /* value of this symbol (or stab offset) */
87};
88
89/*
90 * This is the symbol table entry structure for 64-bit architectures.
91 */
92struct nlist_64 {
93 union {
94 uint32_t n_strx; /* index into the string table */
95 } n_un;
96 uint8_t n_type; /* type flag, see below */
97 uint8_t n_sect; /* section number or NO_SECT */
98 uint16_t n_desc; /* see <mach-o/stab.h> */
99 uint64_t n_value; /* value of this symbol (or stab offset) */
100};
101
102/*
103 * Symbols with a index into the string table of zero (n_un.n_strx == 0) are
104 * defined to have a null, "", name. Therefore all string indexes to non null
105 * names must not have a zero string index. This is bit historical information
106 * that has never been well documented.
107 */
108
109/*
110 * The n_type field really contains four fields:
111 * unsigned char N_STAB:3,
112 * N_PEXT:1,
113 * N_TYPE:3,
114 * N_EXT:1;
115 * which are used via the following masks.
116 */
117#define N_STAB 0xe0 /* if any of these bits set, a symbolic debugging entry */
118#define N_PEXT 0x10 /* private external symbol bit */
119#define N_TYPE 0x0e /* mask for the type bits */
120#define N_EXT 0x01 /* external symbol bit, set for external symbols */
121
122/*
123 * Only symbolic debugging entries have some of the N_STAB bits set and if any
124 * of these bits are set then it is a symbolic debugging entry (a stab). In
125 * which case then the values of the n_type field (the entire field) are given
126 * in <mach-o/stab.h>
127 */
128
129/*
130 * Values for N_TYPE bits of the n_type field.
131 */
132#define N_UNDF 0x0 /* undefined, n_sect == NO_SECT */
133#define N_ABS 0x2 /* absolute, n_sect == NO_SECT */
134#define N_SECT 0xe /* defined in section number n_sect */
135#define N_PBUD 0xc /* prebound undefined (defined in a dylib) */
136#define N_INDR 0xa /* indirect */
137
138/*
139 * If the type is N_INDR then the symbol is defined to be the same as another
140 * symbol. In this case the n_value field is an index into the string table
141 * of the other symbol's name. When the other symbol is defined then they both
142 * take on the defined type and value.
143 */
144
145/*
146 * If the type is N_SECT then the n_sect field contains an ordinal of the
147 * section the symbol is defined in. The sections are numbered from 1 and
148 * refer to sections in order they appear in the load commands for the file
149 * they are in. This means the same ordinal may very well refer to different
150 * sections in different files.
151 *
152 * The n_value field for all symbol table entries (including N_STAB's) gets
153 * updated by the link editor based on the value of it's n_sect field and where
154 * the section n_sect references gets relocated. If the value of the n_sect
155 * field is NO_SECT then it's n_value field is not changed by the link editor.
156 */
157#define NO_SECT 0 /* symbol is not in any section */
158#define MAX_SECT 255 /* 1 thru 255 inclusive */
159
160/*
161 * Common symbols are represented by undefined (N_UNDF) external (N_EXT) types
162 * who's values (n_value) are non-zero. In which case the value of the n_value
163 * field is the size (in bytes) of the common symbol. The n_sect field is set
164 * to NO_SECT. The alignment of a common symbol may be set as a power of 2
165 * between 2^1 and 2^15 as part of the n_desc field using the macros below. If
166 * the alignment is not set (a value of zero) then natural alignment based on
167 * the size is used.
168 */
169#define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f)
170#define SET_COMM_ALIGN(n_desc,align) \
171 (n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8))
172
173/*
174 * To support the lazy binding of undefined symbols in the dynamic link-editor,
175 * the undefined symbols in the symbol table (the nlist structures) are marked
176 * with the indication if the undefined reference is a lazy reference or
177 * non-lazy reference. If both a non-lazy reference and a lazy reference is
178 * made to the same symbol the non-lazy reference takes precedence. A reference
179 * is lazy only when all references to that symbol are made through a symbol
180 * pointer in a lazy symbol pointer section.
181 *
182 * The implementation of marking nlist structures in the symbol table for
183 * undefined symbols will be to use some of the bits of the n_desc field as a
184 * reference type. The mask REFERENCE_TYPE will be applied to the n_desc field
185 * of an nlist structure for an undefined symbol to determine the type of
186 * undefined reference (lazy or non-lazy).
187 *
188 * The constants for the REFERENCE FLAGS are propagated to the reference table
189 * in a shared library file. In that case the constant for a defined symbol,
190 * REFERENCE_FLAG_DEFINED, is also used.
191 */
192/* Reference type bits of the n_desc field of undefined symbols */
193#define REFERENCE_TYPE 0x7
194/* types of references */
195#define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0
196#define REFERENCE_FLAG_UNDEFINED_LAZY 1
197#define REFERENCE_FLAG_DEFINED 2
198#define REFERENCE_FLAG_PRIVATE_DEFINED 3
199#define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4
200#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5
201
202/*
203 * To simplify stripping of objects that use are used with the dynamic link
204 * editor, the static link editor marks the symbols defined an object that are
205 * referenced by a dynamicly bound object (dynamic shared libraries, bundles).
206 * With this marking strip knows not to strip these symbols.
207 */
208#define REFERENCED_DYNAMICALLY 0x0010
209
210/*
211 * For images created by the static link editor with the -twolevel_namespace
212 * option in effect the flags field of the mach header is marked with
213 * MH_TWOLEVEL. And the binding of the undefined references of the image are
214 * determined by the static link editor. Which library an undefined symbol is
215 * bound to is recorded by the static linker in the high 8 bits of the n_desc
216 * field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded
217 * references the libraries listed in the Mach-O's LC_LOAD_DYLIB,
218 * LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and
219 * LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the
220 * headers. The library ordinals start from 1.
221 * For a dynamic library that is built as a two-level namespace image the
222 * undefined references from module defined in another use the same nlist struct
223 * an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For
224 * defined symbols in all images they also must have the library ordinal set to
225 * SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable
226 * image for references from plugins that refer to the executable that loads
227 * them.
228 *
229 * The DYNAMIC_LOOKUP_ORDINAL is for undefined symbols in a two-level namespace
230 * image that are looked up by the dynamic linker with flat namespace semantics.
231 * This ordinal was added as a feature in Mac OS X 10.3 by reducing the
232 * value of MAX_LIBRARY_ORDINAL by one. So it is legal for existing binaries
233 * or binaries built with older tools to have 0xfe (254) dynamic libraries. In
234 * this case the ordinal value 0xfe (254) must be treated as a library ordinal
235 * for compatibility.
236 */
237#define GET_LIBRARY_ORDINAL(n_desc) (((n_desc) >> 8) & 0xff)
238#define SET_LIBRARY_ORDINAL(n_desc,ordinal) \
239 (n_desc) = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8))
240#define SELF_LIBRARY_ORDINAL 0x0
241#define MAX_LIBRARY_ORDINAL 0xfd
242#define DYNAMIC_LOOKUP_ORDINAL 0xfe
243#define EXECUTABLE_ORDINAL 0xff
244
245/*
246 * The bit 0x0020 of the n_desc field is used for two non-overlapping purposes
247 * and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED.
248 */
249
250/*
251 * The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a
252 * relocatable .o file (MH_OBJECT filetype). And is used to indicate to the
253 * static link editor it is never to dead strip the symbol.
254 */
255#define N_NO_DEAD_STRIP 0x0020 /* symbol is not to be dead stripped */
256
257/*
258 * The N_DESC_DISCARDED bit of the n_desc field never appears in linked image.
259 * But is used in very rare cases by the dynamic link editor to mark an in
260 * memory symbol as discared and longer used for linking.
261 */
262#define N_DESC_DISCARDED 0x0020 /* symbol is discarded */
263
264/*
265 * The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that
266 * the undefined symbol is allowed to be missing and is to have the address of
267 * zero when missing.
268 */
269#define N_WEAK_REF 0x0040 /* symbol is weak referenced */
270
271/*
272 * The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic
273 * linkers that the symbol definition is weak, allowing a non-weak symbol to
274 * also be used which causes the weak definition to be discared. Currently this
275 * is only supported for symbols in coalesed sections.
276 */
277#define N_WEAK_DEF 0x0080 /* coalesed symbol is a weak definition */
278
279/*
280 * The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker
281 * that the undefined symbol should be resolved using flat namespace searching.
282 */
283#define N_REF_TO_WEAK 0x0080 /* reference to a weak symbol */
284
285/*
286 * The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is
287 * a defintion of a Thumb function.
288 */
289#define N_ARM_THUMB_DEF 0x0008 /* symbol is a Thumb function (ARM) */
290
291/*
292 * The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the
293 * that the function is actually a resolver function and should
294 * be called to get the address of the real function to use.
295 * This bit is only available in .o files (MH_OBJECT filetype)
296 */
297#define N_SYMBOL_RESOLVER 0x0100
298
299/*
300 * The N_ALT_ENTRY bit of the n_desc field indicates that the
301 * symbol is pinned to the previous content.
302 */
303#define N_ALT_ENTRY 0x0200
304
305/*
306 * The N_COLD_FUNC bit of the n_desc field indicates that the symbol is used
307 * infrequently and the linker should order it towards the end of the section.
308 */
309#define N_COLD_FUNC 0x0400
310
311#ifndef __STRICT_BSD__
312#ifdef __cplusplus
313extern "C" {
314#endif /* __cplusplus */
315/*
316 * The function nlist(3) from the C library.
317 */
318extern int nlist (const char *filename, struct nlist *list);
319#ifdef __cplusplus
320}
321#endif /* __cplusplus */
322#endif /* __STRICT_BSD__ */
323
324#endif /* _MACHO_LIST_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/ranlib.h created+90
...@@ -0,0 +1,90 @@
1/*
2 * Copyright (c) 2016 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/* ranlib.h 4.1 83/05/03 */
24#ifndef _MACH_O_RANLIB_H_
25#define _MACH_O_RANLIB_H_
26
27#include <stdint.h>
28#include <sys/types.h> /* off_t */
29
30/*
31 * There are two known orders of table of contents for archives. The first is
32 * the order ranlib(1) originally produced and still produces without any
33 * options. This table of contents has the archive member name "__.SYMDEF"
34 * This order has the ranlib structures in the order the objects appear in the
35 * archive and the symbol names of those objects in the order of symbol table.
36 * The second know order is sorted by symbol name and is produced with the -s
37 * option to ranlib(1). This table of contents has the archive member name
38 * "__.SYMDEF SORTED" and many programs (notably the 1.0 version of ld(1) can't
39 * tell the difference between names because of the imbedded blank in the name
40 * and works with either table of contents). This second order is used by the
41 * post 1.0 link editor to produce faster linking. The original 1.0 version of
42 * ranlib(1) gets confused when it is run on a archive with the second type of
43 * table of contents because it and ar(1) which it uses use different ways to
44 * determined the member name (ar(1) treats all blanks in the name as
45 * significant and ranlib(1) only checks for the first one).
46 */
47#define SYMDEF "__.SYMDEF"
48#define SYMDEF_SORTED "__.SYMDEF SORTED"
49
50/*
51 * Structure of the __.SYMDEF table of contents for an archive.
52 * __.SYMDEF begins with a uint32_t giving the size in bytes of the ranlib
53 * structures which immediately follow, and then continues with a string
54 * table consisting of a uint32_t giving the number of bytes of strings which
55 * follow and then the strings themselves. The ran_strx fields index the
56 * string table whose first byte is numbered 0.
57 */
58struct ranlib {
59 union {
60 uint32_t ran_strx; /* string table index of */
61#ifndef __LP64__
62 char *ran_name; /* symbol defined by */
63#endif
64 } ran_un;
65 uint32_t ran_off; /* library member at this offset */
66};
67
68#define SYMDEF_64 "__.SYMDEF_64"
69#define SYMDEF_64_SORTED "__.SYMDEF_64 SORTED"
70
71/*
72 * The support for the 64-bit table of contents described here is a work in
73 * progress and not yet fully supported in all the Apple Developer Tools.
74 *
75 * When an archive offset to a library member is more than 32-bits then this is
76 * the structure of the __.SYMDEF_64 table of contents for an archive.
77 * __.SYMDEF_64 begins with a uint64_t giving the size in bytes of the ranlib
78 * structures which immediately follow, and then continues with a string
79 * table consisting of a uint64_t giving the number of bytes of strings which
80 * follow and then the strings themselves. The ran_strx fields index the
81 * string table whose first byte is numbered 0.
82 */
83
84struct ranlib_64 {
85 union {
86 uint64_t ran_strx; /* string table index of */
87 } ran_un;
88 uint64_t ran_off; /* library member at this offset */
89};
90#endif /* _MACH_O_RANLIB_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/reloc.h created+203
...@@ -0,0 +1,203 @@
1/*
2 * Copyright (c) 1999 Apple Computer, 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/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
24
25/*
26 * Copyright (c) 1993 Christopher G. Demetriou
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 * 3. The name of the author may not be used to endorse or promote products
38 * derived from this software without specific prior written permission
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
41 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
42 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
43 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
44 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
49 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 */
51
52#ifndef _MACHO_RELOC_H_
53#define _MACHO_RELOC_H_
54#include <stdint.h>
55
56/*
57 * Format of a relocation entry of a Mach-O file. Modified from the 4.3BSD
58 * format. The modifications from the original format were changing the value
59 * of the r_symbolnum field for "local" (r_extern == 0) relocation entries.
60 * This modification is required to support symbols in an arbitrary number of
61 * sections not just the three sections (text, data and bss) in a 4.3BSD file.
62 * Also the last 4 bits have had the r_type tag added to them.
63 */
64struct relocation_info {
65 int32_t r_address; /* offset in the section to what is being
66 relocated */
67 uint32_t r_symbolnum:24, /* symbol index if r_extern == 1 or section
68 ordinal if r_extern == 0 */
69 r_pcrel:1, /* was relocated pc relative already */
70 r_length:2, /* 0=byte, 1=word, 2=long, 3=quad */
71 r_extern:1, /* does not include value of sym referenced */
72 r_type:4; /* if not 0, machine specific relocation type */
73};
74#define R_ABS 0 /* absolute relocation type for Mach-O files */
75
76/*
77 * The r_address is not really the address as it's name indicates but an offset.
78 * In 4.3BSD a.out objects this offset is from the start of the "segment" for
79 * which relocation entry is for (text or data). For Mach-O object files it is
80 * also an offset but from the start of the "section" for which the relocation
81 * entry is for. See comments in <mach-o/loader.h> about the r_address feild
82 * in images for used with the dynamic linker.
83 *
84 * In 4.3BSD a.out objects if r_extern is zero then r_symbolnum is an ordinal
85 * for the segment the symbol being relocated is in. These ordinals are the
86 * symbol types N_TEXT, N_DATA, N_BSS or N_ABS. In Mach-O object files these
87 * ordinals refer to the sections in the object file in the order their section
88 * structures appear in the headers of the object file they are in. The first
89 * section has the ordinal 1, the second 2, and so on. This means that the
90 * same ordinal in two different object files could refer to two different
91 * sections. And further could have still different ordinals when combined
92 * by the link-editor. The value R_ABS is used for relocation entries for
93 * absolute symbols which need no further relocation.
94 */
95
96/*
97 * For RISC machines some of the references are split across two instructions
98 * and the instruction does not contain the complete value of the reference.
99 * In these cases a second, or paired relocation entry, follows each of these
100 * relocation entries, using a PAIR r_type, which contains the other part of the
101 * reference not contained in the instruction. This other part is stored in the
102 * pair's r_address field. The exact number of bits of the other part of the
103 * reference store in the r_address field is dependent on the particular
104 * relocation type for the particular architecture.
105 */
106
107/*
108 * To make scattered loading by the link editor work correctly "local"
109 * relocation entries can't be used when the item to be relocated is the value
110 * of a symbol plus an offset (where the resulting expresion is outside the
111 * block the link editor is moving, a blocks are divided at symbol addresses).
112 * In this case. where the item is a symbol value plus offset, the link editor
113 * needs to know more than just the section the symbol was defined. What is
114 * needed is the actual value of the symbol without the offset so it can do the
115 * relocation correctly based on where the value of the symbol got relocated to
116 * not the value of the expression (with the offset added to the symbol value).
117 * So for the NeXT 2.0 release no "local" relocation entries are ever used when
118 * there is a non-zero offset added to a symbol. The "external" and "local"
119 * relocation entries remain unchanged.
120 *
121 * The implemention is quite messy given the compatibility with the existing
122 * relocation entry format. The ASSUMPTION is that a section will never be
123 * bigger than 2**24 - 1 (0x00ffffff or 16,777,215) bytes. This assumption
124 * allows the r_address (which is really an offset) to fit in 24 bits and high
125 * bit of the r_address field in the relocation_info structure to indicate
126 * it is really a scattered_relocation_info structure. Since these are only
127 * used in places where "local" relocation entries are used and not where
128 * "external" relocation entries are used the r_extern field has been removed.
129 *
130 * For scattered loading to work on a RISC machine where some of the references
131 * are split across two instructions the link editor needs to be assured that
132 * each reference has a unique 32 bit reference (that more than one reference is
133 * NOT sharing the same high 16 bits for example) so it move each referenced
134 * item independent of each other. Some compilers guarantees this but the
135 * compilers don't so scattered loading can be done on those that do guarantee
136 * this.
137 */
138#if defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)
139/*
140 * The reason for the ifdef's of __BIG_ENDIAN__ and __LITTLE_ENDIAN__ are that
141 * when stattered relocation entries were added the mistake of using a mask
142 * against a structure that is made up of bit fields was used. To make this
143 * design work this structure must be laid out in memory the same way so the
144 * mask can be applied can check the same bit each time (r_scattered).
145 */
146#endif /* defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__) */
147#define R_SCATTERED 0x80000000 /* mask to be applied to the r_address field
148 of a relocation_info structure to tell that
149 is is really a scattered_relocation_info
150 stucture */
151struct scattered_relocation_info {
152#ifdef __BIG_ENDIAN__
153 uint32_t r_scattered:1, /* 1=scattered, 0=non-scattered (see above) */
154 r_pcrel:1, /* was relocated pc relative already */
155 r_length:2, /* 0=byte, 1=word, 2=long, 3=quad */
156 r_type:4, /* if not 0, machine specific relocation type */
157 r_address:24; /* offset in the section to what is being
158 relocated */
159 int32_t r_value; /* the value the item to be relocated is
160 refering to (without any offset added) */
161#endif /* __BIG_ENDIAN__ */
162#ifdef __LITTLE_ENDIAN__
163 uint32_t
164 r_address:24, /* offset in the section to what is being
165 relocated */
166 r_type:4, /* if not 0, machine specific relocation type */
167 r_length:2, /* 0=byte, 1=word, 2=long, 3=quad */
168 r_pcrel:1, /* was relocated pc relative already */
169 r_scattered:1; /* 1=scattered, 0=non-scattered (see above) */
170 int32_t r_value; /* the value the item to be relocated is
171 refering to (without any offset added) */
172#endif /* __LITTLE_ENDIAN__ */
173};
174
175/*
176 * Relocation types used in a generic implementation. Relocation entries for
177 * normal things use the generic relocation as discribed above and their r_type
178 * is GENERIC_RELOC_VANILLA (a value of zero).
179 *
180 * Another type of generic relocation, GENERIC_RELOC_SECTDIFF, is to support
181 * the difference of two symbols defined in different sections. That is the
182 * expression "symbol1 - symbol2 + constant" is a relocatable expression when
183 * both symbols are defined in some section. For this type of relocation the
184 * both relocations entries are scattered relocation entries. The value of
185 * symbol1 is stored in the first relocation entry's r_value field and the
186 * value of symbol2 is stored in the pair's r_value field.
187 *
188 * A special case for a prebound lazy pointer is needed to beable to set the
189 * value of the lazy pointer back to its non-prebound state. This is done
190 * using the GENERIC_RELOC_PB_LA_PTR r_type. This is a scattered relocation
191 * entry where the r_value feild is the value of the lazy pointer not prebound.
192 */
193enum reloc_type_generic
194{
195 GENERIC_RELOC_VANILLA, /* generic relocation as discribed above */
196 GENERIC_RELOC_PAIR, /* Only follows a GENERIC_RELOC_SECTDIFF */
197 GENERIC_RELOC_SECTDIFF,
198 GENERIC_RELOC_PB_LA_PTR, /* prebound lazy pointer */
199 GENERIC_RELOC_LOCAL_SECTDIFF,
200 GENERIC_RELOC_TLV /* thread local variables */
201};
202
203#endif /* _MACHO_RELOC_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/stab.h created+126
...@@ -0,0 +1,126 @@
1/*
2 * Copyright (c) 1999 Apple Computer, 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#ifndef _MACHO_STAB_H_
24#define _MACHO_STAB_H_
25/* $NetBSD: stab.h,v 1.4 1994/10/26 00:56:25 cgd Exp $ */
26
27/*-
28 * Copyright (c) 1991 The Regents of the University of California.
29 * All rights reserved.
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE.
58 *
59 * @(#)stab.h 5.2 (Berkeley) 4/4/91
60 */
61
62/*
63 * This file gives definitions supplementing <nlist.h> for permanent symbol
64 * table entries of Mach-O files. Modified from the BSD definitions. The
65 * modifications from the original definitions were changing what the values of
66 * what was the n_other field (an unused field) which is now the n_sect field.
67 * These modifications are required to support symbols in an arbitrary number of
68 * sections not just the three sections (text, data and bss) in a BSD file.
69 * The values of the defined constants have NOT been changed.
70 *
71 * These must have one of the N_STAB bits on. The n_value fields are subject
72 * to relocation according to the value of their n_sect field. So for types
73 * that refer to things in sections the n_sect field must be filled in with the
74 * proper section ordinal. For types that are not to have their n_value field
75 * relocatated the n_sect field must be NO_SECT.
76 */
77
78/*
79 * Symbolic debugger symbols. The comments give the conventional use for
80 *
81 * .stabs "n_name", n_type, n_sect, n_desc, n_value
82 *
83 * where n_type is the defined constant and not listed in the comment. Other
84 * fields not listed are zero. n_sect is the section ordinal the entry is
85 * refering to.
86 */
87#define N_GSYM 0x20 /* global symbol: name,,NO_SECT,type,0 */
88#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,NO_SECT,0,0 */
89#define N_FUN 0x24 /* procedure: name,,n_sect,linenumber,address */
90#define N_STSYM 0x26 /* static symbol: name,,n_sect,type,address */
91#define N_LCSYM 0x28 /* .lcomm symbol: name,,n_sect,type,address */
92#define N_BNSYM 0x2e /* begin nsect sym: 0,,n_sect,0,address */
93#define N_AST 0x32 /* AST file path: name,,NO_SECT,0,0 */
94#define N_OPT 0x3c /* emitted with gcc2_compiled and in gcc source */
95#define N_RSYM 0x40 /* register sym: name,,NO_SECT,type,register */
96#define N_SLINE 0x44 /* src line: 0,,n_sect,linenumber,address */
97#define N_ENSYM 0x4e /* end nsect sym: 0,,n_sect,0,address */
98#define N_SSYM 0x60 /* structure elt: name,,NO_SECT,type,struct_offset */
99#define N_SO 0x64 /* source file name: name,,n_sect,0,address */
100#define N_OSO 0x66 /* object file name: name,,(see below),0,st_mtime */
101 /* historically N_OSO set n_sect to 0. The N_OSO
102 * n_sect may instead hold the low byte of the
103 * cpusubtype value from the Mach-O header. */
104#define N_LSYM 0x80 /* local sym: name,,NO_SECT,type,offset */
105#define N_BINCL 0x82 /* include file beginning: name,,NO_SECT,0,sum */
106#define N_SOL 0x84 /* #included file name: name,,n_sect,0,address */
107#define N_PARAMS 0x86 /* compiler parameters: name,,NO_SECT,0,0 */
108#define N_VERSION 0x88 /* compiler version: name,,NO_SECT,0,0 */
109#define N_OLEVEL 0x8A /* compiler -O level: name,,NO_SECT,0,0 */
110#define N_PSYM 0xa0 /* parameter: name,,NO_SECT,type,offset */
111#define N_EINCL 0xa2 /* include file end: name,,NO_SECT,0,0 */
112#define N_ENTRY 0xa4 /* alternate entry: name,,n_sect,linenumber,address */
113#define N_LBRAC 0xc0 /* left bracket: 0,,NO_SECT,nesting level,address */
114#define N_EXCL 0xc2 /* deleted include file: name,,NO_SECT,0,sum */
115#define N_RBRAC 0xe0 /* right bracket: 0,,NO_SECT,nesting level,address */
116#define N_BCOMM 0xe2 /* begin common: name,,NO_SECT,0,0 */
117#define N_ECOMM 0xe4 /* end common: name,,n_sect,0,0 */
118#define N_ECOML 0xe8 /* end common (local name): 0,,n_sect,0,address */
119#define N_LENG 0xfe /* second stab entry with length information */
120
121/*
122 * for the berkeley pascal compiler, pc(1):
123 */
124#define N_PC 0x30 /* global pascal symbol: name,,NO_SECT,subtype,line */
125
126#endif /* _MACHO_STAB_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach-o/x86_64/reloc.h created+185
...@@ -0,0 +1,185 @@
1/*
2 * Copyright (c) 2006 Apple Computer, 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 * Relocations for x86_64 are a bit different than for other architectures in
25 * Mach-O: Scattered relocations are not used. Almost all relocations produced
26 * by the compiler are external relocations. An external relocation has the
27 * r_extern bit set to 1 and the r_symbolnum field contains the symbol table
28 * index of the target label.
29 *
30 * When the assembler is generating relocations, if the target label is a local
31 * label (begins with 'L'), then the previous non-local label in the same
32 * section is used as the target of the external relocation. An addend is used
33 * with the distance from that non-local label to the target label. Only when
34 * there is no previous non-local label in the section is an internal
35 * relocation used.
36 *
37 * The addend (i.e. the 4 in _foo+4) is encoded in the instruction (Mach-O does
38 * not have RELA relocations). For PC-relative relocations, the addend is
39 * stored directly in the instruction. This is different from other Mach-O
40 * architectures, which encode the addend minus the current section offset.
41 *
42 * The relocation types are:
43 *
44 * X86_64_RELOC_UNSIGNED // for absolute addresses
45 * X86_64_RELOC_SIGNED // for signed 32-bit displacement
46 * X86_64_RELOC_BRANCH // a CALL/JMP instruction with 32-bit displacement
47 * X86_64_RELOC_GOT_LOAD // a MOVQ load of a GOT entry
48 * X86_64_RELOC_GOT // other GOT references
49 * X86_64_RELOC_SUBTRACTOR // must be followed by a X86_64_RELOC_UNSIGNED
50 *
51 * The following are sample assembly instructions, followed by the relocation
52 * and section content they generate in an object file:
53 *
54 * call _foo
55 * r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
56 * E8 00 00 00 00
57 *
58 * call _foo+4
59 * r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
60 * E8 04 00 00 00
61 *
62 * movq _foo@GOTPCREL(%rip), %rax
63 * r_type=X86_64_RELOC_GOT_LOAD, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
64 * 48 8B 05 00 00 00 00
65 *
66 * pushq _foo@GOTPCREL(%rip)
67 * r_type=X86_64_RELOC_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
68 * FF 35 00 00 00 00
69 *
70 * movl _foo(%rip), %eax
71 * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
72 * 8B 05 00 00 00 00
73 *
74 * movl _foo+4(%rip), %eax
75 * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
76 * 8B 05 04 00 00 00
77 *
78 * movb $0x12, _foo(%rip)
79 * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
80 * C6 05 FF FF FF FF 12
81 *
82 * movl $0x12345678, _foo(%rip)
83 * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
84 * C7 05 FC FF FF FF 78 56 34 12
85 *
86 * .quad _foo
87 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
88 * 00 00 00 00 00 00 00 00
89 *
90 * .quad _foo+4
91 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
92 * 04 00 00 00 00 00 00 00
93 *
94 * .quad _foo - _bar
95 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar
96 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
97 * 00 00 00 00 00 00 00 00
98 *
99 * .quad _foo - _bar + 4
100 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar
101 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
102 * 04 00 00 00 00 00 00 00
103 *
104 * .long _foo - _bar
105 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_bar
106 * r_type=X86_64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
107 * 00 00 00 00
108 *
109 * lea L1(%rip), %rax
110 * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_prev
111 * 48 8d 05 12 00 00 00
112 * // assumes _prev is the first non-local label 0x12 bytes before L1
113 *
114 * lea L0(%rip), %rax
115 * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=0, r_pcrel=1, r_symbolnum=3
116 * 48 8d 05 56 00 00 00
117 * // assumes L0 is in third section and there is no previous non-local label.
118 * // The rip-relative-offset of 0x00000056 is L0-address_of_next_instruction.
119 * // address_of_next_instruction is the address of the relocation + 4.
120 *
121 * add $6,L0(%rip)
122 * r_type=X86_64_RELOC_SIGNED_1, r_length=2, r_extern=0, r_pcrel=1, r_symbolnum=3
123 * 83 05 18 00 00 00 06
124 * // assumes L0 is in third section and there is no previous non-local label.
125 * // The rip-relative-offset of 0x00000018 is L0-address_of_next_instruction.
126 * // address_of_next_instruction is the address of the relocation + 4 + 1.
127 * // The +1 comes from SIGNED_1. This is used because the relocation is not
128 * // at the end of the instruction.
129 *
130 * .quad L1
131 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
132 * 12 00 00 00 00 00 00 00
133 * // assumes _prev is the first non-local label 0x12 bytes before L1
134 *
135 * .quad L0
136 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=0, r_pcrel=0, r_symbolnum=3
137 * 56 00 00 00 00 00 00 00
138 * // assumes L0 is in third section, has an address of 0x00000056 in .o
139 * // file, and there is no previous non-local label
140 *
141 * .quad _foo - .
142 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
143 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
144 * EE FF FF FF FF FF FF FF
145 * // assumes _prev is the first non-local label 0x12 bytes before this
146 * // .quad
147 *
148 * .quad _foo - L1
149 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
150 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
151 * EE FF FF FF FF FF FF FF
152 * // assumes _prev is the first non-local label 0x12 bytes before L1
153 *
154 * .quad L1 - _prev
155 * // No relocations. This is an assembly time constant.
156 * 12 00 00 00 00 00 00 00
157 * // assumes _prev is the first non-local label 0x12 bytes before L1
158 *
159 *
160 *
161 * In final linked images, there are only two valid relocation kinds:
162 *
163 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_pcrel=0, r_extern=1, r_symbolnum=sym_index
164 * This tells dyld to add the address of a symbol to a pointer sized (8-byte)
165 * piece of data (i.e on disk the 8-byte piece of data contains the addend). The
166 * r_symbolnum contains the index into the symbol table of the target symbol.
167 *
168 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_pcrel=0, r_extern=0, r_symbolnum=0
169 * This tells dyld to adjust the pointer sized (8-byte) piece of data by the amount
170 * the containing image was loaded from its base address (e.g. slide).
171 *
172 */
173enum reloc_type_x86_64
174{
175 X86_64_RELOC_UNSIGNED, // for absolute addresses
176 X86_64_RELOC_SIGNED, // for signed 32-bit displacement
177 X86_64_RELOC_BRANCH, // a CALL/JMP instruction with 32-bit displacement
178 X86_64_RELOC_GOT_LOAD, // a MOVQ load of a GOT entry
179 X86_64_RELOC_GOT, // other GOT references
180 X86_64_RELOC_SUBTRACTOR, // must be followed by a X86_64_RELOC_UNSIGNED
181 X86_64_RELOC_SIGNED_1, // for signed 32-bit displacement with a -1 addend
182 X86_64_RELOC_SIGNED_2, // for signed 32-bit displacement with a -2 addend
183 X86_64_RELOC_SIGNED_4, // for signed 32-bit displacement with a -4 addend
184 X86_64_RELOC_TLV, // for thread local variables
185};
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/mach/kern_return.h+8
...@@ -327,6 +327,14 @@...@@ -327,6 +327,14 @@
327/* Denied by security policy327/* Denied by security policy
328 */328 */
329329
330#define KERN_MISSING_KC 54
331/* The KC on which the function is operating is missing
332 */
333
334#define KERN_INVALID_KC 55
335/* The KC on which the function is operating is invalid
336 */
337
330#define KERN_RETURN_MAX 0x100338#define KERN_RETURN_MAX 0x100
331/* Maximum return value allowable339/* Maximum return value allowable
332 */340 */
lib/libc/include/aarch64-macos-gnu/mach/mach_traps.h+5
...@@ -102,6 +102,11 @@ extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(...@@ -102,6 +102,11 @@ extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
102 mach_vm_size_t size102 mach_vm_size_t size
103 );103 );
104104
105extern kern_return_t task_dyld_process_info_notify_get(
106 mach_port_name_array_t names_addr,
107 natural_t *names_count_addr
108 );
109
105extern kern_return_t _kernelrpc_mach_vm_protect_trap(110extern kern_return_t _kernelrpc_mach_vm_protect_trap(
106 mach_port_name_t target,111 mach_port_name_t target,
107 mach_vm_address_t address,112 mach_vm_address_t address,
lib/libc/include/aarch64-macos-gnu/mach/mach_types.h+7-3
...@@ -146,6 +146,7 @@ typedef mach_port_t arcade_register_t;...@@ -146,6 +146,7 @@ typedef mach_port_t arcade_register_t;
146typedef mach_port_t ipc_eventlink_t;146typedef mach_port_t ipc_eventlink_t;
147typedef mach_port_t eventlink_port_pair_t[2];147typedef mach_port_t eventlink_port_pair_t[2];
148typedef mach_port_t suid_cred_t;148typedef mach_port_t suid_cred_t;
149typedef mach_port_t task_id_token_t;
149150
150151
151/*152/*
...@@ -168,6 +169,8 @@ typedef mach_port_t io_master_t;...@@ -168,6 +169,8 @@ typedef mach_port_t io_master_t;
168typedef mach_port_t UNDServerRef;169typedef mach_port_t UNDServerRef;
169typedef mach_port_t mach_eventlink_t;170typedef mach_port_t mach_eventlink_t;
170171
172typedef ipc_info_port_t exception_handler_info_t;
173
171/*174/*
172 * Mig doesn't translate the components of an array.175 * Mig doesn't translate the components of an array.
173 * For example, Mig won't use the thread_t translations176 * For example, Mig won't use the thread_t translations
...@@ -246,25 +249,26 @@ typedef uint32_t suid_cred_uid_t;...@@ -246,25 +249,26 @@ typedef uint32_t suid_cred_uid_t;
246#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0)249#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0)
247#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0)250#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0)
248#define SUID_CRED_NULL ((suid_cred_t) 0)251#define SUID_CRED_NULL ((suid_cred_t) 0)
252#define TASK_ID_TOKEN_NULL ((task_id_token_t) 0)
249253
250/* capability strictly _DECREASING_.254/* capability strictly _DECREASING_.
251 * not ordered the other way around because we want TASK_FLAVOR_CONTROL255 * not ordered the other way around because we want TASK_FLAVOR_CONTROL
252 * to be closest to the itk_lock. see task.h.256 * to be closest to the itk_lock. see task.h.
253 */257 */
254typedef unsigned int mach_task_flavor_t;258typedef unsigned int mach_task_flavor_t;
255#define TASK_FLAVOR_CONTROL 0 /* a task_t */259#define TASK_FLAVOR_CONTROL 0 /* a task_t */
256#define TASK_FLAVOR_READ 1 /* a task_read_t */260#define TASK_FLAVOR_READ 1 /* a task_read_t */
257#define TASK_FLAVOR_INSPECT 2 /* a task_inspect_t */261#define TASK_FLAVOR_INSPECT 2 /* a task_inspect_t */
258#define TASK_FLAVOR_NAME 3 /* a task_name_t */262#define TASK_FLAVOR_NAME 3 /* a task_name_t */
259263
260/* capability strictly _DECREASING_ */264/* capability strictly _DECREASING_ */
261typedef unsigned int mach_thread_flavor_t;265typedef unsigned int mach_thread_flavor_t;
262#define THREAD_FLAVOR_CONTROL 0 /* a thread_t */266#define THREAD_FLAVOR_CONTROL 0 /* a thread_t */
263#define THREAD_FLAVOR_READ 1 /* a thread_read_t */267#define THREAD_FLAVOR_READ 1 /* a thread_read_t */
264#define THREAD_FLAVOR_INSPECT 2 /* a thread_inspect_t */268#define THREAD_FLAVOR_INSPECT 2 /* a thread_inspect_t */
265269
266/* DEPRECATED */270/* DEPRECATED */
267typedef natural_t ledger_item_t;271typedef natural_t ledger_item_t;
268#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))272#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
269273
270typedef int64_t ledger_amount_t;274typedef int64_t ledger_amount_t;
lib/libc/include/aarch64-macos-gnu/mach/machine.h-2
...@@ -376,9 +376,7 @@ typedef integer_t cpu_threadtype_t;...@@ -376,9 +376,7 @@ typedef integer_t cpu_threadtype_t;
376#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f376#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
377#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246377#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
378#define CPUFAMILY_INTEL_ICELAKE 0x38435547378#define CPUFAMILY_INTEL_ICELAKE 0x38435547
379#if !defined(RC_HIDE_XNU_COMETLAKE)
380#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e379#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
381#endif /* not RC_HIDE_XNU_COMETLAKE */
382#define CPUFAMILY_ARM_9 0xe73283ae380#define CPUFAMILY_ARM_9 0xe73283ae
383#define CPUFAMILY_ARM_11 0x8ff620d8381#define CPUFAMILY_ARM_11 0x8ff620d8
384#define CPUFAMILY_ARM_XSCALE 0x53b005f5382#define CPUFAMILY_ARM_XSCALE 0x53b005f5
lib/libc/include/aarch64-macos-gnu/mach/port.h+18-2
...@@ -211,7 +211,6 @@ typedef mach_port_type_t *mach_port_type_array_t;...@@ -211,7 +211,6 @@ typedef mach_port_type_t *mach_port_type_array_t;
211#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */211#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */
212212
213213
214
215/* Convenient combinations. */214/* Convenient combinations. */
216215
217#define MACH_PORT_TYPE_SEND_RECEIVE \216#define MACH_PORT_TYPE_SEND_RECEIVE \
...@@ -388,9 +387,16 @@ enum mach_port_guard_exception_codes {...@@ -388,9 +387,16 @@ enum mach_port_guard_exception_codes {
388 kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,387 kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,
389 kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,388 kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
390 kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */389 kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */
390 kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21,
391 kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22,
391};392};
392393
393#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6)394#define MAX_FATAL_kGUARD_EXC_CODE (1u << 7)
395
396/*
397 * Mach port guard flags.
398 */
399#define MPG_FLAGS_NONE (0x00ull)
394400
395/*401/*
396 * These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.402 * These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.
...@@ -402,6 +408,16 @@ enum mach_port_guard_exception_codes {...@@ -402,6 +408,16 @@ enum mach_port_guard_exception_codes {
402#define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)408#define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)
403#define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)409#define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)
404410
411/*
412 * These flags are used as bits in the subcode of kGUARD_EXC_MOD_REFS exceptions.
413 */
414#define MPG_FLAGS_MOD_REFS_PINNED_DEALLOC (0x01ull << 56)
415
416/*
417 * These flags are used as bits in the subcode of kGUARD_EXC_IMMOVABLE exceptions.
418 */
419#define MPG_FLAGS_IMMOVABLE_PINNED (0x01ull << 56)
420
405/*421/*
406 * Flags for mach_port_guard_with_flags. These flags extend422 * Flags for mach_port_guard_with_flags. These flags extend
407 * the attributes associated with a guarded port.423 * the attributes associated with a guarded port.
lib/libc/include/aarch64-macos-gnu/mach/task.h+218-8
...@@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;...@@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;
49#endif /* AUTOTEST */49#endif /* AUTOTEST */
5050
51#ifndef task_MSG_COUNT51#ifndef task_MSG_COUNT
52#define task_MSG_COUNT 5552#define task_MSG_COUNT 61
53#endif /* task_MSG_COUNT */53#endif /* task_MSG_COUNT */
5454
55#include <mach/std_types.h>55#include <mach/std_types.h>
...@@ -175,7 +175,7 @@ __WATCHOS_PROHIBITED...@@ -175,7 +175,7 @@ __WATCHOS_PROHIBITED
175__TVOS_PROHIBITED175__TVOS_PROHIBITED
176kern_return_t task_suspend176kern_return_t task_suspend
177(177(
178 task_t target_task178 task_read_t target_task
179);179);
180180
181/* Routine task_resume */181/* Routine task_resume */
...@@ -188,7 +188,7 @@ __WATCHOS_PROHIBITED...@@ -188,7 +188,7 @@ __WATCHOS_PROHIBITED
188__TVOS_PROHIBITED188__TVOS_PROHIBITED
189kern_return_t task_resume189kern_return_t task_resume
190(190(
191 task_t target_task191 task_read_t target_task
192);192);
193193
194/* Routine task_get_special_port */194/* Routine task_get_special_port */
...@@ -305,7 +305,7 @@ kern_return_t task_swap_exception_ports...@@ -305,7 +305,7 @@ kern_return_t task_swap_exception_ports
305 thread_state_flavor_t new_flavor,305 thread_state_flavor_t new_flavor,
306 exception_mask_array_t masks,306 exception_mask_array_t masks,
307 mach_msg_type_number_t *masksCnt,307 mach_msg_type_number_t *masksCnt,
308 exception_handler_array_t old_handlerss,308 exception_handler_array_t old_handlers,
309 exception_behavior_array_t old_behaviors,309 exception_behavior_array_t old_behaviors,
310 exception_flavor_array_t old_flavors310 exception_flavor_array_t old_flavors
311);311);
...@@ -606,7 +606,7 @@ __WATCHOS_PROHIBITED...@@ -606,7 +606,7 @@ __WATCHOS_PROHIBITED
606__TVOS_PROHIBITED606__TVOS_PROHIBITED
607kern_return_t task_suspend2607kern_return_t task_suspend2
608(608(
609 task_t target_task,609 task_read_t target_task,
610 task_suspension_token_t *suspend_token610 task_suspension_token_t *suspend_token
611);611);
612612
...@@ -687,7 +687,7 @@ extern...@@ -687,7 +687,7 @@ extern
687#endif /* mig_external */687#endif /* mig_external */
688kern_return_t task_generate_corpse688kern_return_t task_generate_corpse
689(689(
690 task_t task,690 task_read_t task,
691 mach_port_t *corpse_task_port691 mach_port_t *corpse_task_port
692);692);
693693
...@@ -848,6 +848,72 @@ kern_return_t task_create_suid_cred...@@ -848,6 +848,72 @@ kern_return_t task_create_suid_cred
848 suid_cred_t *delegation848 suid_cred_t *delegation
849);849);
850850
851/* Routine task_dyld_process_info_notify_register */
852#ifdef mig_external
853mig_external
854#else
855extern
856#endif /* mig_external */
857kern_return_t task_dyld_process_info_notify_register
858(
859 task_read_t target_task,
860 mach_port_t notify
861);
862
863/* Routine task_create_identity_token */
864#ifdef mig_external
865mig_external
866#else
867extern
868#endif /* mig_external */
869kern_return_t task_create_identity_token
870(
871 task_t task,
872 task_id_token_t *token
873);
874
875/* Routine task_identity_token_get_task_port */
876#ifdef mig_external
877mig_external
878#else
879extern
880#endif /* mig_external */
881kern_return_t task_identity_token_get_task_port
882(
883 task_id_token_t token,
884 task_flavor_t flavor,
885 mach_port_t *task_port
886);
887
888/* Routine task_dyld_process_info_notify_deregister */
889#ifdef mig_external
890mig_external
891#else
892extern
893#endif /* mig_external */
894kern_return_t task_dyld_process_info_notify_deregister
895(
896 task_read_t target_task,
897 mach_port_name_t notify
898);
899
900/* Routine task_get_exception_ports_info */
901#ifdef mig_external
902mig_external
903#else
904extern
905#endif /* mig_external */
906kern_return_t task_get_exception_ports_info
907(
908 mach_port_t port,
909 exception_mask_t exception_mask,
910 exception_mask_array_t masks,
911 mach_msg_type_number_t *masksCnt,
912 exception_handler_info_array_t old_handlers_info,
913 exception_behavior_array_t old_behaviors,
914 exception_flavor_array_t old_flavors
915);
916
851__END_DECLS917__END_DECLS
852918
853/********************** Caution **************************/919/********************** Caution **************************/
...@@ -1586,6 +1652,66 @@ __END_DECLS...@@ -1586,6 +1652,66 @@ __END_DECLS
1586#ifdef __MigPackStructs1652#ifdef __MigPackStructs
1587#pragma pack(pop)1653#pragma pack(pop)
1588#endif1654#endif
1655
1656#ifdef __MigPackStructs
1657#pragma pack(push, 4)
1658#endif
1659 typedef struct {
1660 mach_msg_header_t Head;
1661 /* start of the kernel processed data */
1662 mach_msg_body_t msgh_body;
1663 mach_msg_port_descriptor_t notify;
1664 /* end of the kernel processed data */
1665 } __Request__task_dyld_process_info_notify_register_t __attribute__((unused));
1666#ifdef __MigPackStructs
1667#pragma pack(pop)
1668#endif
1669
1670#ifdef __MigPackStructs
1671#pragma pack(push, 4)
1672#endif
1673 typedef struct {
1674 mach_msg_header_t Head;
1675 } __Request__task_create_identity_token_t __attribute__((unused));
1676#ifdef __MigPackStructs
1677#pragma pack(pop)
1678#endif
1679
1680#ifdef __MigPackStructs
1681#pragma pack(push, 4)
1682#endif
1683 typedef struct {
1684 mach_msg_header_t Head;
1685 NDR_record_t NDR;
1686 task_flavor_t flavor;
1687 } __Request__task_identity_token_get_task_port_t __attribute__((unused));
1688#ifdef __MigPackStructs
1689#pragma pack(pop)
1690#endif
1691
1692#ifdef __MigPackStructs
1693#pragma pack(push, 4)
1694#endif
1695 typedef struct {
1696 mach_msg_header_t Head;
1697 NDR_record_t NDR;
1698 mach_port_name_t notify;
1699 } __Request__task_dyld_process_info_notify_deregister_t __attribute__((unused));
1700#ifdef __MigPackStructs
1701#pragma pack(pop)
1702#endif
1703
1704#ifdef __MigPackStructs
1705#pragma pack(push, 4)
1706#endif
1707 typedef struct {
1708 mach_msg_header_t Head;
1709 NDR_record_t NDR;
1710 exception_mask_t exception_mask;
1711 } __Request__task_get_exception_ports_info_t __attribute__((unused));
1712#ifdef __MigPackStructs
1713#pragma pack(pop)
1714#endif
1589#endif /* !__Request__task_subsystem__defined */1715#endif /* !__Request__task_subsystem__defined */
15901716
1591/* union of all requests */1717/* union of all requests */
...@@ -1648,6 +1774,11 @@ union __RequestUnion__task_subsystem {...@@ -1648,6 +1774,11 @@ union __RequestUnion__task_subsystem {
1648 __Request__task_get_exc_guard_behavior_t Request_task_get_exc_guard_behavior;1774 __Request__task_get_exc_guard_behavior_t Request_task_get_exc_guard_behavior;
1649 __Request__task_set_exc_guard_behavior_t Request_task_set_exc_guard_behavior;1775 __Request__task_set_exc_guard_behavior_t Request_task_set_exc_guard_behavior;
1650 __Request__task_create_suid_cred_t Request_task_create_suid_cred;1776 __Request__task_create_suid_cred_t Request_task_create_suid_cred;
1777 __Request__task_dyld_process_info_notify_register_t Request_task_dyld_process_info_notify_register;
1778 __Request__task_create_identity_token_t Request_task_create_identity_token;
1779 __Request__task_identity_token_get_task_port_t Request_task_identity_token_get_task_port;
1780 __Request__task_dyld_process_info_notify_deregister_t Request_task_dyld_process_info_notify_deregister;
1781 __Request__task_get_exception_ports_info_t Request_task_get_exception_ports_info;
1651};1782};
1652#endif /* !__RequestUnion__task_subsystem__defined */1783#endif /* !__RequestUnion__task_subsystem__defined */
1653/* typedefs for all replies */1784/* typedefs for all replies */
...@@ -1867,7 +1998,7 @@ union __RequestUnion__task_subsystem {...@@ -1867,7 +1998,7 @@ union __RequestUnion__task_subsystem {
1867 mach_msg_header_t Head;1998 mach_msg_header_t Head;
1868 /* start of the kernel processed data */1999 /* start of the kernel processed data */
1869 mach_msg_body_t msgh_body;2000 mach_msg_body_t msgh_body;
1870 mach_msg_port_descriptor_t old_handlerss[32];2001 mach_msg_port_descriptor_t old_handlers[32];
1871 /* end of the kernel processed data */2002 /* end of the kernel processed data */
1872 NDR_record_t NDR;2003 NDR_record_t NDR;
1873 mach_msg_type_number_t masksCnt;2004 mach_msg_type_number_t masksCnt;
...@@ -2392,6 +2523,75 @@ union __RequestUnion__task_subsystem {...@@ -2392,6 +2523,75 @@ union __RequestUnion__task_subsystem {
2392#ifdef __MigPackStructs2523#ifdef __MigPackStructs
2393#pragma pack(pop)2524#pragma pack(pop)
2394#endif2525#endif
2526
2527#ifdef __MigPackStructs
2528#pragma pack(push, 4)
2529#endif
2530 typedef struct {
2531 mach_msg_header_t Head;
2532 NDR_record_t NDR;
2533 kern_return_t RetCode;
2534 } __Reply__task_dyld_process_info_notify_register_t __attribute__((unused));
2535#ifdef __MigPackStructs
2536#pragma pack(pop)
2537#endif
2538
2539#ifdef __MigPackStructs
2540#pragma pack(push, 4)
2541#endif
2542 typedef struct {
2543 mach_msg_header_t Head;
2544 /* start of the kernel processed data */
2545 mach_msg_body_t msgh_body;
2546 mach_msg_port_descriptor_t token;
2547 /* end of the kernel processed data */
2548 } __Reply__task_create_identity_token_t __attribute__((unused));
2549#ifdef __MigPackStructs
2550#pragma pack(pop)
2551#endif
2552
2553#ifdef __MigPackStructs
2554#pragma pack(push, 4)
2555#endif
2556 typedef struct {
2557 mach_msg_header_t Head;
2558 /* start of the kernel processed data */
2559 mach_msg_body_t msgh_body;
2560 mach_msg_port_descriptor_t task_port;
2561 /* end of the kernel processed data */
2562 } __Reply__task_identity_token_get_task_port_t __attribute__((unused));
2563#ifdef __MigPackStructs
2564#pragma pack(pop)
2565#endif
2566
2567#ifdef __MigPackStructs
2568#pragma pack(push, 4)
2569#endif
2570 typedef struct {
2571 mach_msg_header_t Head;
2572 NDR_record_t NDR;
2573 kern_return_t RetCode;
2574 } __Reply__task_dyld_process_info_notify_deregister_t __attribute__((unused));
2575#ifdef __MigPackStructs
2576#pragma pack(pop)
2577#endif
2578
2579#ifdef __MigPackStructs
2580#pragma pack(push, 4)
2581#endif
2582 typedef struct {
2583 mach_msg_header_t Head;
2584 NDR_record_t NDR;
2585 kern_return_t RetCode;
2586 mach_msg_type_number_t masksCnt;
2587 exception_mask_t masks[32];
2588 exception_handler_info_t old_handlers_info[32];
2589 exception_behavior_t old_behaviors[32];
2590 thread_state_flavor_t old_flavors[32];
2591 } __Reply__task_get_exception_ports_info_t __attribute__((unused));
2592#ifdef __MigPackStructs
2593#pragma pack(pop)
2594#endif
2395#endif /* !__Reply__task_subsystem__defined */2595#endif /* !__Reply__task_subsystem__defined */
23962596
2397/* union of all replies */2597/* union of all replies */
...@@ -2454,6 +2654,11 @@ union __ReplyUnion__task_subsystem {...@@ -2454,6 +2654,11 @@ union __ReplyUnion__task_subsystem {
2454 __Reply__task_get_exc_guard_behavior_t Reply_task_get_exc_guard_behavior;2654 __Reply__task_get_exc_guard_behavior_t Reply_task_get_exc_guard_behavior;
2455 __Reply__task_set_exc_guard_behavior_t Reply_task_set_exc_guard_behavior;2655 __Reply__task_set_exc_guard_behavior_t Reply_task_set_exc_guard_behavior;
2456 __Reply__task_create_suid_cred_t Reply_task_create_suid_cred;2656 __Reply__task_create_suid_cred_t Reply_task_create_suid_cred;
2657 __Reply__task_dyld_process_info_notify_register_t Reply_task_dyld_process_info_notify_register;
2658 __Reply__task_create_identity_token_t Reply_task_create_identity_token;
2659 __Reply__task_identity_token_get_task_port_t Reply_task_identity_token_get_task_port;
2660 __Reply__task_dyld_process_info_notify_deregister_t Reply_task_dyld_process_info_notify_deregister;
2661 __Reply__task_get_exception_ports_info_t Reply_task_get_exception_ports_info;
2457};2662};
2458#endif /* !__RequestUnion__task_subsystem__defined */2663#endif /* !__RequestUnion__task_subsystem__defined */
24592664
...@@ -2513,7 +2718,12 @@ union __ReplyUnion__task_subsystem {...@@ -2513,7 +2718,12 @@ union __ReplyUnion__task_subsystem {
2513 { "task_inspect", 3451 },\2718 { "task_inspect", 3451 },\
2514 { "task_get_exc_guard_behavior", 3452 },\2719 { "task_get_exc_guard_behavior", 3452 },\
2515 { "task_set_exc_guard_behavior", 3453 },\2720 { "task_set_exc_guard_behavior", 3453 },\
2516 { "task_create_suid_cred", 3454 }2721 { "task_create_suid_cred", 3454 },\
2722 { "task_dyld_process_info_notify_register", 3456 },\
2723 { "task_create_identity_token", 3457 },\
2724 { "task_identity_token_get_task_port", 3458 },\
2725 { "task_dyld_process_info_notify_deregister", 3459 },\
2726 { "task_get_exception_ports_info", 3460 }
2517#endif2727#endif
25182728
2519#ifdef __AfterMigUserHeader2729#ifdef __AfterMigUserHeader
lib/libc/include/aarch64-macos-gnu/mach/task_special_ports.h+3-1
...@@ -81,7 +81,9 @@ typedef int task_special_port_t;...@@ -81,7 +81,9 @@ typedef int task_special_port_t;
8181
82#define TASK_READ_PORT 6 /* The read port for task. */82#define TASK_READ_PORT 6 /* The read port for task. */
8383
8484/*
85 * Evolving and likely to change.
86 */
8587
86#define TASK_SEATBELT_PORT 7 /* Seatbelt compiler/DEM port for task. */88#define TASK_SEATBELT_PORT 7 /* Seatbelt compiler/DEM port for task. */
8789
lib/libc/include/aarch64-macos-gnu/mach/thread_act.h+53-4
...@@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;...@@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;
49#endif /* AUTOTEST */49#endif /* AUTOTEST */
5050
51#ifndef thread_act_MSG_COUNT51#ifndef thread_act_MSG_COUNT
52#define thread_act_MSG_COUNT 2952#define thread_act_MSG_COUNT 31
53#endif /* thread_act_MSG_COUNT */53#endif /* thread_act_MSG_COUNT */
5454
55#include <mach/std_types.h>55#include <mach/std_types.h>
...@@ -149,7 +149,7 @@ extern...@@ -149,7 +149,7 @@ extern
149__WATCHOS_PROHIBITED149__WATCHOS_PROHIBITED
150kern_return_t thread_suspend150kern_return_t thread_suspend
151(151(
152 thread_act_t target_act152 thread_read_t target_act
153);153);
154154
155/* Routine thread_resume */155/* Routine thread_resume */
...@@ -161,7 +161,7 @@ extern...@@ -161,7 +161,7 @@ extern
161__WATCHOS_PROHIBITED161__WATCHOS_PROHIBITED
162kern_return_t thread_resume162kern_return_t thread_resume
163(163(
164 thread_act_t target_act164 thread_read_t target_act
165);165);
166166
167/* Routine thread_abort */167/* Routine thread_abort */
...@@ -484,6 +484,23 @@ kern_return_t thread_convert_thread_state...@@ -484,6 +484,23 @@ kern_return_t thread_convert_thread_state
484 mach_msg_type_number_t *out_stateCnt484 mach_msg_type_number_t *out_stateCnt
485);485);
486486
487/* Routine thread_get_exception_ports_info */
488#ifdef mig_external
489mig_external
490#else
491extern
492#endif /* mig_external */
493kern_return_t thread_get_exception_ports_info
494(
495 mach_port_t port,
496 exception_mask_t exception_mask,
497 exception_mask_array_t masks,
498 mach_msg_type_number_t *masksCnt,
499 exception_handler_info_array_t old_handlers_info,
500 exception_behavior_array_t old_behaviors,
501 exception_flavor_array_t old_flavors
502);
503
487__END_DECLS504__END_DECLS
488505
489/********************** Caution **************************/506/********************** Caution **************************/
...@@ -884,6 +901,18 @@ __END_DECLS...@@ -884,6 +901,18 @@ __END_DECLS
884#ifdef __MigPackStructs901#ifdef __MigPackStructs
885#pragma pack(pop)902#pragma pack(pop)
886#endif903#endif
904
905#ifdef __MigPackStructs
906#pragma pack(push, 4)
907#endif
908 typedef struct {
909 mach_msg_header_t Head;
910 NDR_record_t NDR;
911 exception_mask_t exception_mask;
912 } __Request__thread_get_exception_ports_info_t __attribute__((unused));
913#ifdef __MigPackStructs
914#pragma pack(pop)
915#endif
887#endif /* !__Request__thread_act_subsystem__defined */916#endif /* !__Request__thread_act_subsystem__defined */
888917
889/* union of all requests */918/* union of all requests */
...@@ -920,6 +949,7 @@ union __RequestUnion__thread_act_subsystem {...@@ -920,6 +949,7 @@ union __RequestUnion__thread_act_subsystem {
920 __Request__thread_set_mach_voucher_t Request_thread_set_mach_voucher;949 __Request__thread_set_mach_voucher_t Request_thread_set_mach_voucher;
921 __Request__thread_swap_mach_voucher_t Request_thread_swap_mach_voucher;950 __Request__thread_swap_mach_voucher_t Request_thread_swap_mach_voucher;
922 __Request__thread_convert_thread_state_t Request_thread_convert_thread_state;951 __Request__thread_convert_thread_state_t Request_thread_convert_thread_state;
952 __Request__thread_get_exception_ports_info_t Request_thread_get_exception_ports_info;
923};953};
924#endif /* !__RequestUnion__thread_act_subsystem__defined */954#endif /* !__RequestUnion__thread_act_subsystem__defined */
925/* typedefs for all replies */955/* typedefs for all replies */
...@@ -1307,6 +1337,23 @@ union __RequestUnion__thread_act_subsystem {...@@ -1307,6 +1337,23 @@ union __RequestUnion__thread_act_subsystem {
1307#ifdef __MigPackStructs1337#ifdef __MigPackStructs
1308#pragma pack(pop)1338#pragma pack(pop)
1309#endif1339#endif
1340
1341#ifdef __MigPackStructs
1342#pragma pack(push, 4)
1343#endif
1344 typedef struct {
1345 mach_msg_header_t Head;
1346 NDR_record_t NDR;
1347 kern_return_t RetCode;
1348 mach_msg_type_number_t masksCnt;
1349 exception_mask_t masks[32];
1350 exception_handler_info_t old_handlers_info[32];
1351 exception_behavior_t old_behaviors[32];
1352 thread_state_flavor_t old_flavors[32];
1353 } __Reply__thread_get_exception_ports_info_t __attribute__((unused));
1354#ifdef __MigPackStructs
1355#pragma pack(pop)
1356#endif
1310#endif /* !__Reply__thread_act_subsystem__defined */1357#endif /* !__Reply__thread_act_subsystem__defined */
13111358
1312/* union of all replies */1359/* union of all replies */
...@@ -1343,6 +1390,7 @@ union __ReplyUnion__thread_act_subsystem {...@@ -1343,6 +1390,7 @@ union __ReplyUnion__thread_act_subsystem {
1343 __Reply__thread_set_mach_voucher_t Reply_thread_set_mach_voucher;1390 __Reply__thread_set_mach_voucher_t Reply_thread_set_mach_voucher;
1344 __Reply__thread_swap_mach_voucher_t Reply_thread_swap_mach_voucher;1391 __Reply__thread_swap_mach_voucher_t Reply_thread_swap_mach_voucher;
1345 __Reply__thread_convert_thread_state_t Reply_thread_convert_thread_state;1392 __Reply__thread_convert_thread_state_t Reply_thread_convert_thread_state;
1393 __Reply__thread_get_exception_ports_info_t Reply_thread_get_exception_ports_info;
1346};1394};
1347#endif /* !__RequestUnion__thread_act_subsystem__defined */1395#endif /* !__RequestUnion__thread_act_subsystem__defined */
13481396
...@@ -1376,7 +1424,8 @@ union __ReplyUnion__thread_act_subsystem {...@@ -1376,7 +1424,8 @@ union __ReplyUnion__thread_act_subsystem {
1376 { "thread_get_mach_voucher", 3625 },\1424 { "thread_get_mach_voucher", 3625 },\
1377 { "thread_set_mach_voucher", 3626 },\1425 { "thread_set_mach_voucher", 3626 },\
1378 { "thread_swap_mach_voucher", 3627 },\1426 { "thread_swap_mach_voucher", 3627 },\
1379 { "thread_convert_thread_state", 3628 }1427 { "thread_convert_thread_state", 3628 },\
1428 { "thread_get_exception_ports_info", 3630 }
1380#endif1429#endif
13811430
1382#ifdef __AfterMigUserHeader1431#ifdef __AfterMigUserHeader
lib/libc/include/aarch64-macos-gnu/mach/thread_special_ports.h+1
...@@ -73,6 +73,7 @@...@@ -73,6 +73,7 @@
7373
74#define THREAD_READ_PORT 3 /* The read port for thread. */74#define THREAD_READ_PORT 3 /* The read port for thread. */
7575
76#define THREAD_MAX_SPECIAL_PORT THREAD_READ_PORT
76/*77/*
77 * Definitions for ease of use78 * Definitions for ease of use
78 */79 */
lib/libc/include/aarch64-macos-gnu/mach/vm_statistics.h+2
...@@ -272,6 +272,7 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;...@@ -272,6 +272,7 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
272#define VM_FLAGS_NO_CACHE 0x0010272#define VM_FLAGS_NO_CACHE 0x0010
273#define VM_FLAGS_RESILIENT_CODESIGN 0x0020273#define VM_FLAGS_RESILIENT_CODESIGN 0x0020
274#define VM_FLAGS_RESILIENT_MEDIA 0x0040274#define VM_FLAGS_RESILIENT_MEDIA 0x0040
275#define VM_FLAGS_PERMANENT 0x0080
275#define VM_FLAGS_OVERWRITE 0x4000 /* delete any existing mappings first */276#define VM_FLAGS_OVERWRITE 0x4000 /* delete any existing mappings first */
276/*277/*
277 * VM_FLAGS_SUPERPAGE_MASK278 * VM_FLAGS_SUPERPAGE_MASK
...@@ -295,6 +296,7 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;...@@ -295,6 +296,7 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
295 VM_FLAGS_4GB_CHUNK | \296 VM_FLAGS_4GB_CHUNK | \
296 VM_FLAGS_RANDOM_ADDR | \297 VM_FLAGS_RANDOM_ADDR | \
297 VM_FLAGS_NO_CACHE | \298 VM_FLAGS_NO_CACHE | \
299 VM_FLAGS_PERMANENT | \
298 VM_FLAGS_OVERWRITE | \300 VM_FLAGS_OVERWRITE | \
299 VM_FLAGS_SUPERPAGE_MASK | \301 VM_FLAGS_SUPERPAGE_MASK | \
300 VM_FLAGS_ALIAS_MASK)302 VM_FLAGS_ALIAS_MASK)
lib/libc/include/aarch64-macos-gnu/net/route.h+3-2
...@@ -127,7 +127,8 @@ struct rt_metrics {...@@ -127,7 +127,8 @@ struct rt_metrics {
127#define RTF_PROXY 0x8000000 /* proxying, no interface scope */127#define RTF_PROXY 0x8000000 /* proxying, no interface scope */
128#define RTF_ROUTER 0x10000000 /* host is a router */128#define RTF_ROUTER 0x10000000 /* host is a router */
129#define RTF_DEAD 0x20000000 /* Route entry is being freed */129#define RTF_DEAD 0x20000000 /* Route entry is being freed */
130 /* 0x40000000 and up unassigned */130#define RTF_GLOBAL 0x40000000 /* route to destination of the global internet */
131 /* 0x80000000 unassigned */
131132
132#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */133#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */
133#define RTF_BITS \134#define RTF_BITS \
...@@ -135,7 +136,7 @@ struct rt_metrics {...@@ -135,7 +136,7 @@ struct rt_metrics {
135 "\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \136 "\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \
136 "\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \137 "\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \
137 "\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \138 "\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \
138 "\33IFREF\34PROXY\35ROUTER"139 "\33IFREF\34PROXY\35ROUTER\37GLOBAL"
139140
140#define IS_DIRECT_HOSTROUTE(rt) \141#define IS_DIRECT_HOSTROUTE(rt) \
141 (((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST)142 (((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST)
lib/libc/include/aarch64-macos-gnu/objc/objc-api.h+18
...@@ -283,4 +283,22 @@...@@ -283,4 +283,22 @@
283# endif283# endif
284#endif284#endif
285285
286/* OBJC_COLD: very rarely called, e.g. on error path */
287#if !defined(OBJC_COLD)
288# if __OBJC__ && __has_attribute(cold)
289# define OBJC_COLD __attribute__((cold))
290# else
291# define OBJC_COLD
292# endif
293#endif
294
295/* OBJC_NORETURN: does not return normally, but may throw */
296#if !defined(OBJC_NORETURN)
297# if __OBJC__ && __has_attribute(noreturn)
298# define OBJC_NORETURN __attribute__((noreturn))
299# else
300# define OBJC_NORETURN
301# endif
302#endif
303
286#endif304#endif
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/pthread.h+2-2
...@@ -557,11 +557,11 @@ __API_AVAILABLE(macos(10.4), ios(2.0))...@@ -557,11 +557,11 @@ __API_AVAILABLE(macos(10.4), ios(2.0))
557void pthread_yield_np(void);557void pthread_yield_np(void);
558558
559__API_AVAILABLE(macos(11.0))559__API_AVAILABLE(macos(11.0))
560__API_UNAVAILABLE(ios, tvos, watchos)560__API_UNAVAILABLE(ios, tvos, watchos, driverkit)
561void pthread_jit_write_protect_np(int enabled);561void pthread_jit_write_protect_np(int enabled);
562562
563__API_AVAILABLE(macos(11.0))563__API_AVAILABLE(macos(11.0))
564__API_UNAVAILABLE(ios, tvos, watchos)564__API_UNAVAILABLE(ios, tvos, watchos, driverkit)
565int pthread_jit_write_protect_supported_np(void);565int pthread_jit_write_protect_supported_np(void);
566566
567/*!567/*!
lib/libc/include/aarch64-macos-gnu/simd/packed.h+1-1
...@@ -15,7 +15,7 @@...@@ -15,7 +15,7 @@
15 *15 *
16 * <pre>16 * <pre>
17 * @textblock17 * @textblock
18 * simd_float4 vector = *(packed_simd_float4 *)&array[i];18 * simd_float4 vector = *(simd_packed_float4 *)&array[i];
19 * // do something with vector ...19 * // do something with vector ...
20 * @/textblock20 * @/textblock
21 * </pre>21 * </pre>
lib/libc/include/aarch64-macos-gnu/sys/_symbol_aliasing.h+12
...@@ -335,6 +335,12 @@...@@ -335,6 +335,12 @@
335#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x)335#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x)
336#endif336#endif
337337
338#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140500
339#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_5(x) x
340#else
341#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_5(x)
342#endif
343
338#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000344#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000
339#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x345#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x
340#else346#else
...@@ -543,4 +549,10 @@...@@ -543,4 +549,10 @@
543#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) x549#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) x
544#else550#else
545#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x)551#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x)
552#endif
553
554#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110300
555#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_3(x) x
556#else
557#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_3(x)
546#endif558#endif
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/sys/proc.h+2
...@@ -80,6 +80,8 @@...@@ -80,6 +80,8 @@
80#include <mach/boolean.h>80#include <mach/boolean.h>
8181
8282
83#include <Availability.h>
84
8385
84struct session;86struct session;
85struct pgrp;87struct pgrp;
lib/libc/include/aarch64-macos-gnu/sys/random.h created+40
...@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) 1999, 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef __SYS_RANDOM_H__
30#define __SYS_RANDOM_H__
31
32#include <sys/appleapiopts.h>
33#include <sys/cdefs.h>
34
35__BEGIN_DECLS
36 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
37int getentropy(void* buffer, size_t size);
38__END_DECLS
39
40#endif /* __SYS_RANDOM_H__ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/sys/resource.h+8
...@@ -457,6 +457,8 @@ struct proc_rlimit_control_wakeupmon {...@@ -457,6 +457,8 @@ struct proc_rlimit_control_wakeupmon {
457#define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4457#define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4
458#define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5458#define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5
459#define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6459#define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6
460#define IOPOL_TYPE_VFS_IGNORE_PERMISSIONS 7
461#define IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE 8
460462
461/* scope */463/* scope */
462#define IOPOL_SCOPE_PROCESS 0464#define IOPOL_SCOPE_PROCESS 0
...@@ -492,6 +494,12 @@ struct proc_rlimit_control_wakeupmon {...@@ -492,6 +494,12 @@ struct proc_rlimit_control_wakeupmon {
492#define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0494#define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0
493#define IOPOL_VFS_CONTENT_PROTECTION_IGNORE 1495#define IOPOL_VFS_CONTENT_PROTECTION_IGNORE 1
494496
497#define IOPOL_VFS_IGNORE_PERMISSIONS_OFF 0
498#define IOPOL_VFS_IGNORE_PERMISSIONS_ON 1
499
500#define IOPOL_VFS_SKIP_MTIME_UPDATE_OFF 0
501#define IOPOL_VFS_SKIP_MTIME_UPDATE_ON 1
502
495#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */503#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
496504
497505
lib/libc/include/aarch64-macos-gnu/sys/sysctl.h+23-22
...@@ -81,10 +81,10 @@...@@ -81,10 +81,10 @@
81#include <sys/appleapiopts.h>81#include <sys/appleapiopts.h>
82#include <sys/time.h>82#include <sys/time.h>
83#include <sys/ucred.h>83#include <sys/ucred.h>
84
84#include <sys/proc.h>85#include <sys/proc.h>
85#include <sys/vm.h>86#include <sys/vm.h>
8687
87
88/*88/*
89 * Definitions for sysctl call. The sysctl call uses a hierarchical name89 * Definitions for sysctl call. The sysctl call uses a hierarchical name
90 * for objects that can be examined or modified. The name is expressed as90 * for objects that can be examined or modified. The name is expressed as
...@@ -135,25 +135,26 @@ struct ctlname {...@@ -135,25 +135,26 @@ struct ctlname {
135 int ctl_type; /* type of name */135 int ctl_type; /* type of name */
136};136};
137137
138#define CTLTYPE 0xf /* Mask for the type */138#define CTLTYPE 0xf /* Mask for the type */
139#define CTLTYPE_NODE 1 /* name is a node */139#define CTLTYPE_NODE 1 /* name is a node */
140#define CTLTYPE_INT 2 /* name describes an integer */140#define CTLTYPE_INT 2 /* name describes an integer */
141#define CTLTYPE_STRING 3 /* name describes a string */141#define CTLTYPE_STRING 3 /* name describes a string */
142#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */142#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
143#define CTLTYPE_OPAQUE 5 /* name describes a structure */143#define CTLTYPE_OPAQUE 5 /* name describes a structure */
144#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */144#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
145145
146#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */146#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
147#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */147#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
148#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)148#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
149#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */149#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
150#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */150#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
151#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */151#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
152#define CTLFLAG_MASKED 0x04000000 /* deprecated variable, do not display */152#define CTLFLAG_MASKED 0x04000000 /* deprecated variable, do not display */
153#define CTLFLAG_NOAUTO 0x02000000 /* do not auto-register */153#define CTLFLAG_NOAUTO 0x02000000 /* do not auto-register */
154#define CTLFLAG_KERN 0x01000000 /* valid inside the kernel */154#define CTLFLAG_KERN 0x01000000 /* valid inside the kernel */
155#define CTLFLAG_LOCKED 0x00800000 /* node will handle locking itself */155#define CTLFLAG_LOCKED 0x00800000 /* node will handle locking itself */
156#define CTLFLAG_OID2 0x00400000 /* struct sysctl_oid has version info */156#define CTLFLAG_OID2 0x00400000 /* struct sysctl_oid has version info */
157#define CTLFLAG_EXPERIMENT 0x00100000 /* Allows writing w/ the trial experiment entitlement. */
157158
158/*159/*
159 * USE THIS instead of a hardwired number from the categories below160 * USE THIS instead of a hardwired number from the categories below
...@@ -168,8 +169,8 @@ struct ctlname {...@@ -168,8 +169,8 @@ struct ctlname {
168 * in I/O-Kit. In this case, you have to call sysctl_register_oid()169 * in I/O-Kit. In this case, you have to call sysctl_register_oid()
169 * manually - just like in a KEXT.170 * manually - just like in a KEXT.
170 */171 */
171#define OID_AUTO (-1)172#define OID_AUTO (-1)
172#define OID_AUTO_START 100 /* conventional */173#define OID_AUTO_START 100 /* conventional */
173174
174175
175#define SYSCTL_DEF_ENABLED176#define SYSCTL_DEF_ENABLED
lib/libc/include/any-macos-any/mach/exception_types.h+2
...@@ -181,6 +181,7 @@...@@ -181,6 +181,7 @@
181#include <mach/port.h>181#include <mach/port.h>
182#include <mach/thread_status.h>182#include <mach/thread_status.h>
183#include <mach/machine/vm_types.h>183#include <mach/machine/vm_types.h>
184#include <mach_debug/ipc_info.h>
184/*185/*
185 * Exported types186 * Exported types
186 */187 */
...@@ -196,6 +197,7 @@ typedef exception_mask_t *exception_mask_array_t;...@@ -196,6 +197,7 @@ typedef exception_mask_t *exception_mask_array_t;
196typedef exception_behavior_t *exception_behavior_array_t;197typedef exception_behavior_t *exception_behavior_array_t;
197typedef thread_state_flavor_t *exception_flavor_array_t;198typedef thread_state_flavor_t *exception_flavor_array_t;
198typedef mach_port_t *exception_port_array_t;199typedef mach_port_t *exception_port_array_t;
200typedef ipc_info_port_t *exception_port_info_array_t;
199typedef mach_exception_data_type_t mach_exception_code_t;201typedef mach_exception_data_type_t mach_exception_code_t;
200typedef mach_exception_data_type_t mach_exception_subcode_t;202typedef mach_exception_data_type_t mach_exception_subcode_t;
201203
lib/libc/include/any-macos-any/mach/host_special_ports.h+10-2
...@@ -108,9 +108,10 @@...@@ -108,9 +108,10 @@
108#define HOST_SYSPOLICYD_PORT (22 + HOST_MAX_SPECIAL_KERNEL_PORT)108#define HOST_SYSPOLICYD_PORT (22 + HOST_MAX_SPECIAL_KERNEL_PORT)
109#define HOST_FILECOORDINATIOND_PORT (23 + HOST_MAX_SPECIAL_KERNEL_PORT)109#define HOST_FILECOORDINATIOND_PORT (23 + HOST_MAX_SPECIAL_KERNEL_PORT)
110#define HOST_FAIRPLAYD_PORT (24 + HOST_MAX_SPECIAL_KERNEL_PORT)110#define HOST_FAIRPLAYD_PORT (24 + HOST_MAX_SPECIAL_KERNEL_PORT)
111#define HOST_IOCOMPRESSIONSTATS_PORT (25 + HOST_MAX_SPECIAL_KERNEL_PORT)
111112
112#define HOST_MAX_SPECIAL_PORT HOST_FAIRPLAYD_PORT113#define HOST_MAX_SPECIAL_PORT HOST_IOCOMPRESSIONSTATS_PORT
113/* MAX = last since rdar://35861175 */114/* MAX = last since rdar://59872249 */
114115
115/* obsolete name */116/* obsolete name */
116#define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT117#define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT
...@@ -274,6 +275,13 @@...@@ -274,6 +275,13 @@
274#define host_set_fairplayd_port(host, port) \275#define host_set_fairplayd_port(host, port) \
275 (host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port)))276 (host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port)))
276277
278#define host_get_iocompressionstats_port(host, port) \
279 (host_get_special_port((host), \
280 HOST_LOCAL_NODE, HOST_IOCOMPRESSIONSTATS_PORT, (port)))
281#define host_set_iocompressionstats_port(host, port) \
282 (host_set_special_port((host), HOST_IOCOMPRESSIONSTATS_PORT, (port)))
283
284
277/* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences.285/* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences.
278 * All lookups go through send_resource_violation()286 * All lookups go through send_resource_violation()
279 */287 */
lib/libc/include/any-macos-any/mach/mach_init.h+6
...@@ -64,6 +64,10 @@...@@ -64,6 +64,10 @@
6464
65#include <sys/cdefs.h>65#include <sys/cdefs.h>
6666
67#ifndef KERNEL
68#include <Availability.h>
69#endif
70
67/*71/*
68 * Kernel-related ports; how a task/thread controls itself72 * Kernel-related ports; how a task/thread controls itself
69 */73 */
...@@ -71,6 +75,8 @@...@@ -71,6 +75,8 @@
71__BEGIN_DECLS75__BEGIN_DECLS
72extern mach_port_t mach_host_self(void);76extern mach_port_t mach_host_self(void);
73extern mach_port_t mach_thread_self(void);77extern mach_port_t mach_thread_self(void);
78__API_AVAILABLE(macos(11.3), ios(14.5), tvos(14.5), watchos(7.3))
79extern boolean_t mach_task_is_self(task_name_t task);
74extern kern_return_t host_page_size(host_t, vm_size_t *);80extern kern_return_t host_page_size(host_t, vm_size_t *);
7581
76extern mach_port_t mach_task_self_;82extern mach_port_t mach_task_self_;
lib/libc/include/any-macos-any/mach/memory_object_types.h+6
...@@ -79,6 +79,7 @@...@@ -79,6 +79,7 @@
7979
80#include <sys/cdefs.h>80#include <sys/cdefs.h>
8181
82
82#define VM_64_BIT_DATA_OBJECTS83#define VM_64_BIT_DATA_OBJECTS
8384
84typedef unsigned long long memory_object_offset_t;85typedef unsigned long long memory_object_offset_t;
...@@ -95,6 +96,11 @@ typedef unsigned long long vm_object_id_t;...@@ -95,6 +96,11 @@ typedef unsigned long long vm_object_id_t;
9596
9697
97typedef mach_port_t memory_object_t;98typedef mach_port_t memory_object_t;
99/*
100 * vestigial, maintained for source compatibility,
101 * no MIG interface will accept or return non NULL
102 * objects for those.
103 */
98typedef mach_port_t memory_object_control_t;104typedef mach_port_t memory_object_control_t;
99105
100106
lib/libc/include/any-macos-any/mach/vm_map.h+65-2
...@@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;...@@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;
49#endif /* AUTOTEST */49#endif /* AUTOTEST */
5050
51#ifndef vm_map_MSG_COUNT51#ifndef vm_map_MSG_COUNT
52#define vm_map_MSG_COUNT 3252#define vm_map_MSG_COUNT 33
53#endif /* vm_map_MSG_COUNT */53#endif /* vm_map_MSG_COUNT */
5454
55#include <mach/std_types.h>55#include <mach/std_types.h>
...@@ -493,6 +493,27 @@ kern_return_t vm_map_exec_lockdown...@@ -493,6 +493,27 @@ kern_return_t vm_map_exec_lockdown
493 vm_map_t target_task493 vm_map_t target_task
494);494);
495495
496/* Routine vm_remap_new */
497#ifdef mig_external
498mig_external
499#else
500extern
501#endif /* mig_external */
502kern_return_t vm_remap_new
503(
504 vm_map_t target_task,
505 vm_address_t *target_address,
506 vm_size_t size,
507 vm_address_t mask,
508 int flags,
509 vm_map_read_t src_task,
510 vm_address_t src_address,
511 boolean_t copy,
512 vm_prot_t *cur_protection,
513 vm_prot_t *max_protection,
514 vm_inherit_t inheritance
515);
516
496__END_DECLS517__END_DECLS
497518
498/********************** Caution **************************/519/********************** Caution **************************/
...@@ -924,6 +945,30 @@ __END_DECLS...@@ -924,6 +945,30 @@ __END_DECLS
924#ifdef __MigPackStructs945#ifdef __MigPackStructs
925#pragma pack(pop)946#pragma pack(pop)
926#endif947#endif
948
949#ifdef __MigPackStructs
950#pragma pack(push, 4)
951#endif
952 typedef struct {
953 mach_msg_header_t Head;
954 /* start of the kernel processed data */
955 mach_msg_body_t msgh_body;
956 mach_msg_port_descriptor_t src_task;
957 /* end of the kernel processed data */
958 NDR_record_t NDR;
959 vm_address_t target_address;
960 vm_size_t size;
961 vm_address_t mask;
962 int flags;
963 vm_address_t src_address;
964 boolean_t copy;
965 vm_prot_t cur_protection;
966 vm_prot_t max_protection;
967 vm_inherit_t inheritance;
968 } __Request__vm_remap_new_t __attribute__((unused));
969#ifdef __MigPackStructs
970#pragma pack(pop)
971#endif
927#endif /* !__Request__vm_map_subsystem__defined */972#endif /* !__Request__vm_map_subsystem__defined */
928973
929/* union of all requests */974/* union of all requests */
...@@ -959,6 +1004,7 @@ union __RequestUnion__vm_map_subsystem {...@@ -959,6 +1004,7 @@ union __RequestUnion__vm_map_subsystem {
959 __Request__vm_map_64_t Request_vm_map_64;1004 __Request__vm_map_64_t Request_vm_map_64;
960 __Request__vm_purgable_control_t Request_vm_purgable_control;1005 __Request__vm_purgable_control_t Request_vm_purgable_control;
961 __Request__vm_map_exec_lockdown_t Request_vm_map_exec_lockdown;1006 __Request__vm_map_exec_lockdown_t Request_vm_map_exec_lockdown;
1007 __Request__vm_remap_new_t Request_vm_remap_new;
962};1008};
963#endif /* !__RequestUnion__vm_map_subsystem__defined */1009#endif /* !__RequestUnion__vm_map_subsystem__defined */
964/* typedefs for all replies */1010/* typedefs for all replies */
...@@ -1363,6 +1409,21 @@ union __RequestUnion__vm_map_subsystem {...@@ -1363,6 +1409,21 @@ union __RequestUnion__vm_map_subsystem {
1363#ifdef __MigPackStructs1409#ifdef __MigPackStructs
1364#pragma pack(pop)1410#pragma pack(pop)
1365#endif1411#endif
1412
1413#ifdef __MigPackStructs
1414#pragma pack(push, 4)
1415#endif
1416 typedef struct {
1417 mach_msg_header_t Head;
1418 NDR_record_t NDR;
1419 kern_return_t RetCode;
1420 vm_address_t target_address;
1421 vm_prot_t cur_protection;
1422 vm_prot_t max_protection;
1423 } __Reply__vm_remap_new_t __attribute__((unused));
1424#ifdef __MigPackStructs
1425#pragma pack(pop)
1426#endif
1366#endif /* !__Reply__vm_map_subsystem__defined */1427#endif /* !__Reply__vm_map_subsystem__defined */
13671428
1368/* union of all replies */1429/* union of all replies */
...@@ -1398,6 +1459,7 @@ union __ReplyUnion__vm_map_subsystem {...@@ -1398,6 +1459,7 @@ union __ReplyUnion__vm_map_subsystem {
1398 __Reply__vm_map_64_t Reply_vm_map_64;1459 __Reply__vm_map_64_t Reply_vm_map_64;
1399 __Reply__vm_purgable_control_t Reply_vm_purgable_control;1460 __Reply__vm_purgable_control_t Reply_vm_purgable_control;
1400 __Reply__vm_map_exec_lockdown_t Reply_vm_map_exec_lockdown;1461 __Reply__vm_map_exec_lockdown_t Reply_vm_map_exec_lockdown;
1462 __Reply__vm_remap_new_t Reply_vm_remap_new;
1401};1463};
1402#endif /* !__RequestUnion__vm_map_subsystem__defined */1464#endif /* !__RequestUnion__vm_map_subsystem__defined */
14031465
...@@ -1430,7 +1492,8 @@ union __ReplyUnion__vm_map_subsystem {...@@ -1430,7 +1492,8 @@ union __ReplyUnion__vm_map_subsystem {
1430 { "mach_make_memory_entry_64", 3825 },\1492 { "mach_make_memory_entry_64", 3825 },\
1431 { "vm_map_64", 3826 },\1493 { "vm_map_64", 3826 },\
1432 { "vm_purgable_control", 3830 },\1494 { "vm_purgable_control", 3830 },\
1433 { "vm_map_exec_lockdown", 3831 }1495 { "vm_map_exec_lockdown", 3831 },\
1496 { "vm_remap_new", 3832 }
1434#endif1497#endif
14351498
1436#ifdef __AfterMigUserHeader1499#ifdef __AfterMigUserHeader
lib/libc/include/any-macos-any/mach_debug/ipc_info.h+7
...@@ -113,4 +113,11 @@ typedef struct ipc_info_tree_name {...@@ -113,4 +113,11 @@ typedef struct ipc_info_tree_name {
113113
114typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t;114typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t;
115115
116typedef struct ipc_info_port {
117 natural_t iip_port_object; /* port object identifier */
118 natural_t iip_receiver_object; /* receiver task identifier (if any) */
119} ipc_info_port_t;
120
121typedef ipc_info_port_t *exception_handler_info_array_t;
122
116#endif /* _MACH_DEBUG_IPC_INFO_H_ */123#endif /* _MACH_DEBUG_IPC_INFO_H_ */
\ No newline at end of file
lib/libc/include/any-macos-any/time.h+3-3
...@@ -190,9 +190,9 @@ int clock_settime(clockid_t __clock_id, const struct timespec *__tp);...@@ -190,9 +190,9 @@ int clock_settime(clockid_t __clock_id, const struct timespec *__tp);
190#endif /* __DARWIN_C_LEVEL */190#endif /* __DARWIN_C_LEVEL */
191#endif /* _DARWIN_FEATURE_CLOCK_GETTIME */191#endif /* _DARWIN_FEATURE_CLOCK_GETTIME */
192192
193#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \193#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) || \
194 ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \194 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
195 (defined(__cplusplus) && __cplusplus >= 201703L))195 (defined(__cplusplus) && __cplusplus >= 201703L)
196/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */196/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */
197#define TIME_UTC 1 /* time elapsed since epoch */197#define TIME_UTC 1 /* time elapsed since epoch */
198__API_AVAILABLE(macosx(10.15), ios(13.0), tvos(13.0), watchos(6.0))198__API_AVAILABLE(macosx(10.15), ios(13.0), tvos(13.0), watchos(6.0))
lib/libc/include/x86_64-macos-gnu/mach/exception_types.h created+204
...@@ -0,0 +1,204 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59#ifndef _MACH_EXCEPTION_TYPES_H_
60#define _MACH_EXCEPTION_TYPES_H_
61
62#include <mach/machine/exception.h>
63
64/*
65 * Machine-independent exception definitions.
66 */
67
68#define EXC_BAD_ACCESS 1 /* Could not access memory */
69/* Code contains kern_return_t describing error. */
70/* Subcode contains bad memory address. */
71
72#define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
73/* Illegal or undefined instruction or operand */
74
75#define EXC_ARITHMETIC 3 /* Arithmetic exception */
76/* Exact nature of exception is in code field */
77
78#define EXC_EMULATION 4 /* Emulation instruction */
79/* Emulation support instruction encountered */
80/* Details in code and subcode fields */
81
82#define EXC_SOFTWARE 5 /* Software generated exception */
83/* Exact exception is in code field. */
84/* Codes 0 - 0xFFFF reserved to hardware */
85/* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
86
87#define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
88/* Details in code field. */
89
90#define EXC_SYSCALL 7 /* System calls. */
91
92#define EXC_MACH_SYSCALL 8 /* Mach system calls. */
93
94#define EXC_RPC_ALERT 9 /* RPC alert */
95
96#define EXC_CRASH 10 /* Abnormal process exit */
97
98#define EXC_RESOURCE 11 /* Hit resource consumption limit */
99/* Exact resource is in code field. */
100
101#define EXC_GUARD 12 /* Violated guarded resource protections */
102
103#define EXC_CORPSE_NOTIFY 13 /* Abnormal process exited to corpse state */
104
105#define EXC_CORPSE_VARIANT_BIT 0x100 /* bit set for EXC_*_CORPSE variants of EXC_* */
106
107
108/*
109 * Machine-independent exception behaviors
110 */
111
112# define EXCEPTION_DEFAULT 1
113/* Send a catch_exception_raise message including the identity.
114 */
115
116# define EXCEPTION_STATE 2
117/* Send a catch_exception_raise_state message including the
118 * thread state.
119 */
120
121# define EXCEPTION_STATE_IDENTITY 3
122/* Send a catch_exception_raise_state_identity message including
123 * the thread identity and state.
124 */
125
126#define MACH_EXCEPTION_ERRORS 0x40000000
127/* include additional exception specific errors, not used yet. */
128
129#define MACH_EXCEPTION_CODES 0x80000000
130/* Send 64-bit code and subcode in the exception header */
131
132#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | MACH_EXCEPTION_ERRORS)
133/*
134 * Masks for exception definitions, above
135 * bit zero is unused, therefore 1 word = 31 exception types
136 */
137
138#define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS)
139#define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION)
140#define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC)
141#define EXC_MASK_EMULATION (1 << EXC_EMULATION)
142#define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE)
143#define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT)
144#define EXC_MASK_SYSCALL (1 << EXC_SYSCALL)
145#define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL)
146#define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT)
147#define EXC_MASK_CRASH (1 << EXC_CRASH)
148#define EXC_MASK_RESOURCE (1 << EXC_RESOURCE)
149#define EXC_MASK_GUARD (1 << EXC_GUARD)
150#define EXC_MASK_CORPSE_NOTIFY (1 << EXC_CORPSE_NOTIFY)
151
152#define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
153 EXC_MASK_BAD_INSTRUCTION | \
154 EXC_MASK_ARITHMETIC | \
155 EXC_MASK_EMULATION | \
156 EXC_MASK_SOFTWARE | \
157 EXC_MASK_BREAKPOINT | \
158 EXC_MASK_SYSCALL | \
159 EXC_MASK_MACH_SYSCALL | \
160 EXC_MASK_RPC_ALERT | \
161 EXC_MASK_RESOURCE | \
162 EXC_MASK_GUARD | \
163 EXC_MASK_MACHINE)
164
165
166#define FIRST_EXCEPTION 1 /* ZERO is illegal */
167
168/*
169 * Machine independent codes for EXC_SOFTWARE
170 * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
171 * 0x10000 - 0x10002 in use for unix signals
172 * 0x20000 - 0x2FFFF reserved for MACF
173 */
174#define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
175
176#define EXC_MACF_MIN 0x20000 /* MACF exceptions */
177#define EXC_MACF_MAX 0x2FFFF
178
179#ifndef ASSEMBLER
180
181#include <mach/port.h>
182#include <mach/thread_status.h>
183#include <mach/machine/vm_types.h>
184/*
185 * Exported types
186 */
187
188typedef int exception_type_t;
189typedef integer_t exception_data_type_t;
190typedef int64_t mach_exception_data_type_t;
191typedef int exception_behavior_t;
192typedef exception_data_type_t *exception_data_t;
193typedef mach_exception_data_type_t *mach_exception_data_t;
194typedef unsigned int exception_mask_t;
195typedef exception_mask_t *exception_mask_array_t;
196typedef exception_behavior_t *exception_behavior_array_t;
197typedef thread_state_flavor_t *exception_flavor_array_t;
198typedef mach_port_t *exception_port_array_t;
199typedef mach_exception_data_type_t mach_exception_code_t;
200typedef mach_exception_data_type_t mach_exception_subcode_t;
201
202#endif /* ASSEMBLER */
203
204#endif /* _MACH_EXCEPTION_TYPES_H_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/mach/host_special_ports.h created+281
...@@ -0,0 +1,281 @@
1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: mach/host_special_ports.h
60 *
61 * Defines codes for access to host-wide special ports.
62 */
63
64#ifndef _MACH_HOST_SPECIAL_PORTS_H_
65#define _MACH_HOST_SPECIAL_PORTS_H_
66
67/*
68 * Cannot be set or gotten from user space
69 */
70#define HOST_SECURITY_PORT 0
71
72#define HOST_MIN_SPECIAL_PORT HOST_SECURITY_PORT
73
74/*
75 * Always provided by kernel (cannot be set from user-space).
76 */
77#define HOST_PORT 1
78#define HOST_PRIV_PORT 2
79#define HOST_IO_MASTER_PORT 3
80#define HOST_MAX_SPECIAL_KERNEL_PORT 7 /* room to grow */
81
82#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MASTER_PORT
83
84/*
85 * Not provided by kernel
86 */
87#define HOST_DYNAMIC_PAGER_PORT (1 + HOST_MAX_SPECIAL_KERNEL_PORT)
88#define HOST_AUDIT_CONTROL_PORT (2 + HOST_MAX_SPECIAL_KERNEL_PORT)
89#define HOST_USER_NOTIFICATION_PORT (3 + HOST_MAX_SPECIAL_KERNEL_PORT)
90#define HOST_AUTOMOUNTD_PORT (4 + HOST_MAX_SPECIAL_KERNEL_PORT)
91#define HOST_LOCKD_PORT (5 + HOST_MAX_SPECIAL_KERNEL_PORT)
92#define HOST_KTRACE_BACKGROUND_PORT (6 + HOST_MAX_SPECIAL_KERNEL_PORT)
93#define HOST_SEATBELT_PORT (7 + HOST_MAX_SPECIAL_KERNEL_PORT)
94#define HOST_KEXTD_PORT (8 + HOST_MAX_SPECIAL_KERNEL_PORT)
95#define HOST_LAUNCHCTL_PORT (9 + HOST_MAX_SPECIAL_KERNEL_PORT)
96#define HOST_UNFREED_PORT (10 + HOST_MAX_SPECIAL_KERNEL_PORT)
97#define HOST_AMFID_PORT (11 + HOST_MAX_SPECIAL_KERNEL_PORT)
98#define HOST_GSSD_PORT (12 + HOST_MAX_SPECIAL_KERNEL_PORT)
99#define HOST_TELEMETRY_PORT (13 + HOST_MAX_SPECIAL_KERNEL_PORT)
100#define HOST_ATM_NOTIFICATION_PORT (14 + HOST_MAX_SPECIAL_KERNEL_PORT)
101#define HOST_COALITION_PORT (15 + HOST_MAX_SPECIAL_KERNEL_PORT)
102#define HOST_SYSDIAGNOSE_PORT (16 + HOST_MAX_SPECIAL_KERNEL_PORT)
103#define HOST_XPC_EXCEPTION_PORT (17 + HOST_MAX_SPECIAL_KERNEL_PORT)
104#define HOST_CONTAINERD_PORT (18 + HOST_MAX_SPECIAL_KERNEL_PORT)
105#define HOST_NODE_PORT (19 + HOST_MAX_SPECIAL_KERNEL_PORT)
106#define HOST_RESOURCE_NOTIFY_PORT (20 + HOST_MAX_SPECIAL_KERNEL_PORT)
107#define HOST_CLOSURED_PORT (21 + HOST_MAX_SPECIAL_KERNEL_PORT)
108#define HOST_SYSPOLICYD_PORT (22 + HOST_MAX_SPECIAL_KERNEL_PORT)
109#define HOST_FILECOORDINATIOND_PORT (23 + HOST_MAX_SPECIAL_KERNEL_PORT)
110#define HOST_FAIRPLAYD_PORT (24 + HOST_MAX_SPECIAL_KERNEL_PORT)
111
112#define HOST_MAX_SPECIAL_PORT HOST_FAIRPLAYD_PORT
113/* MAX = last since rdar://35861175 */
114
115/* obsolete name */
116#define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT
117
118/*
119 * Special node identifier to always represent the local node.
120 */
121#define HOST_LOCAL_NODE -1
122
123/*
124 * Definitions for ease of use.
125 *
126 * In the get call, the host parameter can be any host, but will generally
127 * be the local node host port. In the set call, the host must the per-node
128 * host port for the node being affected.
129 */
130#define host_get_host_port(host, port) \
131 (host_get_special_port((host), \
132 HOST_LOCAL_NODE, HOST_PORT, (port)))
133#define host_set_host_port(host, port) (KERN_INVALID_ARGUMENT)
134
135#define host_get_host_priv_port(host, port) \
136 (host_get_special_port((host), \
137 HOST_LOCAL_NODE, HOST_PRIV_PORT, (port)))
138#define host_set_host_priv_port(host, port) (KERN_INVALID_ARGUMENT)
139
140#define host_get_io_master_port(host, port) \
141 (host_get_special_port((host), \
142 HOST_LOCAL_NODE, HOST_IO_MASTER_PORT, (port)))
143#define host_set_io_master_port(host, port) (KERN_INVALID_ARGUMENT)
144
145/*
146 * User-settable special ports.
147 */
148#define host_get_dynamic_pager_port(host, port) \
149 (host_get_special_port((host), \
150 HOST_LOCAL_NODE, HOST_DYNAMIC_PAGER_PORT, (port)))
151#define host_set_dynamic_pager_port(host, port) \
152 (host_set_special_port((host), HOST_DYNAMIC_PAGER_PORT, (port)))
153
154#define host_get_audit_control_port(host, port) \
155 (host_get_special_port((host), \
156 HOST_LOCAL_NODE, HOST_AUDIT_CONTROL_PORT, (port)))
157#define host_set_audit_control_port(host, port) \
158 (host_set_special_port((host), HOST_AUDIT_CONTROL_PORT, (port)))
159
160#define host_get_user_notification_port(host, port) \
161 (host_get_special_port((host), \
162 HOST_LOCAL_NODE, HOST_USER_NOTIFICATION_PORT, (port)))
163#define host_set_user_notification_port(host, port) \
164 (host_set_special_port((host), HOST_USER_NOTIFICATION_PORT, (port)))
165
166#define host_get_automountd_port(host, port) \
167 (host_get_special_port((host), \
168 HOST_LOCAL_NODE, HOST_AUTOMOUNTD_PORT, (port)))
169#define host_set_automountd_port(host, port) \
170 (host_set_special_port((host), HOST_AUTOMOUNTD_PORT, (port)))
171
172#define host_get_lockd_port(host, port) \
173 (host_get_special_port((host), \
174 HOST_LOCAL_NODE, HOST_LOCKD_PORT, (port)))
175#define host_set_lockd_port(host, port) \
176 (host_set_special_port((host), HOST_LOCKD_PORT, (port)))
177
178#define host_get_ktrace_background_port(host, port) \
179 (host_get_special_port((host), \
180 HOST_LOCAL_NODE, HOST_KTRACE_BACKGROUND_PORT, (port)))
181#define host_set_ktrace_background_port(host, port) \
182 (host_set_special_port((host), HOST_KTRACE_BACKGROUND_PORT, (port)))
183
184#define host_get_kextd_port(host, port) \
185 (host_get_special_port((host), \
186 HOST_LOCAL_NODE, HOST_KEXTD_PORT, (port)))
187#define host_set_kextd_port(host, port) \
188 (host_set_special_port((host), HOST_KEXTD_PORT, (port)))
189
190#define host_get_launchctl_port(host, port) \
191 (host_get_special_port((host), HOST_LOCAL_NODE, HOST_LAUNCHCTL_PORT, \
192 (port)))
193#define host_set_launchctl_port(host, port) \
194 (host_set_special_port((host), HOST_LAUNCHCTL_PORT, (port)))
195
196#define host_get_chud_port(host, port) host_get_launchctl_port(host, port)
197#define host_set_chud_port(host, port) host_set_launchctl_port(host, port)
198
199#define host_get_unfreed_port(host, port) \
200 (host_get_special_port((host), \
201 HOST_LOCAL_NODE, HOST_UNFREED_PORT, (port)))
202#define host_set_unfreed_port(host, port) \
203 (host_set_special_port((host), HOST_UNFREED_PORT, (port)))
204
205#define host_get_amfid_port(host, port) \
206 (host_get_special_port((host), \
207 HOST_LOCAL_NODE, HOST_AMFID_PORT, (port)))
208#define host_set_amfid_port(host, port) \
209 (host_set_special_port((host), HOST_AMFID_PORT, (port)))
210
211#define host_get_gssd_port(host, port) \
212 (host_get_special_port((host), \
213 HOST_LOCAL_NODE, HOST_GSSD_PORT, (port)))
214#define host_set_gssd_port(host, port) \
215 (host_set_special_port((host), HOST_GSSD_PORT, (port)))
216
217#define host_get_telemetry_port(host, port) \
218 (host_get_special_port((host), \
219 HOST_LOCAL_NODE, HOST_TELEMETRY_PORT, (port)))
220#define host_set_telemetry_port(host, port) \
221 (host_set_special_port((host), HOST_TELEMETRY_PORT, (port)))
222
223#define host_get_atm_notification_port(host, port) \
224 (host_get_special_port((host), \
225 HOST_LOCAL_NODE, HOST_ATM_NOTIFICATION_PORT, (port)))
226#define host_set_atm_notification_port(host, port) \
227 (host_set_special_port((host), HOST_ATM_NOTIFICATION_PORT, (port)))
228
229#define host_get_coalition_port(host, port) \
230 (host_get_special_port((host), \
231 HOST_LOCAL_NODE, HOST_COALITION_PORT, (port)))
232#define host_set_coalition_port(host, port) \
233 (host_set_special_port((host), HOST_COALITION_PORT, (port)))
234
235#define host_get_sysdiagnose_port(host, port) \
236 (host_get_special_port((host), \
237 HOST_LOCAL_NODE, HOST_SYSDIAGNOSE_PORT, (port)))
238#define host_set_sysdiagnose_port(host, port) \
239 (host_set_special_port((host), HOST_SYSDIAGNOSE_PORT, (port)))
240
241#define host_get_container_port(host, port) \
242 (host_get_special_port((host), \
243 HOST_LOCAL_NODE, HOST_CONTAINERD_PORT, (port)))
244#define host_set_container_port(host, port) \
245 (host_set_special_port((host), HOST_CONTAINERD_PORT, (port)))
246
247#define host_get_node_port(host, port) \
248 (host_get_special_port((host), \
249 HOST_LOCAL_NODE, HOST_NODE_PORT, (port)))
250#define host_set_node_port(host, port) \
251 (host_set_special_port((host), HOST_NODE_PORT, (port)))
252
253#define host_get_closured_port(host, port) \
254 (host_get_special_port((host), \
255 HOST_LOCAL_NODE, HOST_CLOSURED_PORT, (port)))
256#define host_set_closured_port(host, port) \
257 (host_set_special_port((host), HOST_CLOSURED_PORT, (port)))
258
259#define host_get_syspolicyd_port(host, port) \
260 (host_get_special_port((host), \
261 HOST_LOCAL_NODE, HOST_SYSPOLICYD_PORT, (port)))
262#define host_set_syspolicyd_port(host, port) \
263 (host_set_special_port((host), HOST_SYSPOLICYD_PORT, (port)))
264
265#define host_get_filecoordinationd_port(host, port) \
266 (host_get_special_port((host), \
267 HOST_LOCAL_NODE, HOST_FILECOORDINATIOND_PORT, (port)))
268#define host_set_filecoordinationd_port(host, port) \
269 (host_set_special_port((host), HOST_FILECOORDINATIOND_PORT, (port)))
270
271#define host_get_fairplayd_port(host, port) \
272 (host_get_special_port((host), \
273 HOST_LOCAL_NODE, HOST_FAIRPLAYD_PORT, (port)))
274#define host_set_fairplayd_port(host, port) \
275 (host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port)))
276
277/* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences.
278 * All lookups go through send_resource_violation()
279 */
280
281#endif /* _MACH_HOST_SPECIAL_PORTS_H_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/mach/mach_init.h created+110
...@@ -0,0 +1,110 @@
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987,1986 Carnegie Mellon University
31 * All Rights Reserved.
32 *
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
38 *
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53
54/*
55 * Items provided by the Mach environment initialization.
56 */
57
58#ifndef _MACH_INIT_
59#define _MACH_INIT_ 1
60
61#include <mach/mach_types.h>
62#include <mach/vm_page_size.h>
63#include <stdarg.h>
64
65#include <sys/cdefs.h>
66
67/*
68 * Kernel-related ports; how a task/thread controls itself
69 */
70
71__BEGIN_DECLS
72extern mach_port_t mach_host_self(void);
73extern mach_port_t mach_thread_self(void);
74extern kern_return_t host_page_size(host_t, vm_size_t *);
75
76extern mach_port_t mach_task_self_;
77#define mach_task_self() mach_task_self_
78#define current_task() mach_task_self()
79
80__END_DECLS
81#include <mach/mach_traps.h>
82__BEGIN_DECLS
83
84/*
85 * Other important ports in the Mach user environment
86 */
87
88extern mach_port_t bootstrap_port;
89
90/*
91 * Where these ports occur in the "mach_ports_register"
92 * collection... only servers or the runtime library need know.
93 */
94
95#define NAME_SERVER_SLOT 0
96#define ENVIRONMENT_SLOT 1
97#define SERVICE_SLOT 2
98
99#define MACH_PORTS_SLOTS_USED 3
100
101/*
102 * fprintf_stderr uses vprintf_stderr_func to produce
103 * error messages, this can be overridden by a user
104 * application to point to a user-specified output function
105 */
106extern int (*vprintf_stderr_func)(const char *format, va_list ap);
107
108__END_DECLS
109
110#endif /* _MACH_INIT_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/mach/memory_object_types.h created+299
...@@ -0,0 +1,299 @@
1/*
2 * Copyright (c) 2000-2016 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: memory_object.h
60 * Author: Michael Wayne Young
61 *
62 * External memory management interface definition.
63 */
64
65#ifndef _MACH_MEMORY_OBJECT_TYPES_H_
66#define _MACH_MEMORY_OBJECT_TYPES_H_
67
68/*
69 * User-visible types used in the external memory
70 * management interface:
71 */
72
73#include <mach/port.h>
74#include <mach/message.h>
75#include <mach/vm_prot.h>
76#include <mach/vm_sync.h>
77#include <mach/vm_types.h>
78#include <mach/machine/vm_types.h>
79
80#include <sys/cdefs.h>
81
82#define VM_64_BIT_DATA_OBJECTS
83
84typedef unsigned long long memory_object_offset_t;
85typedef unsigned long long memory_object_size_t;
86typedef natural_t memory_object_cluster_size_t;
87typedef natural_t * memory_object_fault_info_t;
88
89typedef unsigned long long vm_object_id_t;
90
91
92/*
93 * Temporary until real EMMI version gets re-implemented
94 */
95
96
97typedef mach_port_t memory_object_t;
98typedef mach_port_t memory_object_control_t;
99
100
101typedef memory_object_t *memory_object_array_t;
102/* A memory object ... */
103/* Used by the kernel to retrieve */
104/* or store data */
105
106typedef mach_port_t memory_object_name_t;
107/* Used to describe the memory ... */
108/* object in vm_regions() calls */
109
110typedef mach_port_t memory_object_default_t;
111/* Registered with the host ... */
112/* for creating new internal objects */
113
114#define MEMORY_OBJECT_NULL ((memory_object_t) 0)
115#define MEMORY_OBJECT_CONTROL_NULL ((memory_object_control_t) 0)
116#define MEMORY_OBJECT_NAME_NULL ((memory_object_name_t) 0)
117#define MEMORY_OBJECT_DEFAULT_NULL ((memory_object_default_t) 0)
118
119
120typedef int memory_object_copy_strategy_t;
121/* How memory manager handles copy: */
122#define MEMORY_OBJECT_COPY_NONE 0
123/* ... No special support */
124#define MEMORY_OBJECT_COPY_CALL 1
125/* ... Make call on memory manager */
126#define MEMORY_OBJECT_COPY_DELAY 2
127/* ... Memory manager doesn't
128 * change data externally.
129 */
130#define MEMORY_OBJECT_COPY_TEMPORARY 3
131/* ... Memory manager doesn't
132 * change data externally, and
133 * doesn't need to see changes.
134 */
135#define MEMORY_OBJECT_COPY_SYMMETRIC 4
136/* ... Memory manager doesn't
137 * change data externally,
138 * doesn't need to see changes,
139 * and object will not be
140 * multiply mapped.
141 *
142 * XXX
143 * Not yet safe for non-kernel use.
144 */
145
146#define MEMORY_OBJECT_COPY_INVALID 5
147/* ... An invalid copy strategy,
148 * for external objects which
149 * have not been initialized.
150 * Allows copy_strategy to be
151 * examined without also
152 * examining pager_ready and
153 * internal.
154 */
155
156typedef int memory_object_return_t;
157/* Which pages to return to manager
158 * this time (lock_request) */
159#define MEMORY_OBJECT_RETURN_NONE 0
160/* ... don't return any. */
161#define MEMORY_OBJECT_RETURN_DIRTY 1
162/* ... only dirty pages. */
163#define MEMORY_OBJECT_RETURN_ALL 2
164/* ... dirty and precious pages. */
165#define MEMORY_OBJECT_RETURN_ANYTHING 3
166/* ... any resident page. */
167
168/*
169 * Data lock request flags
170 */
171
172#define MEMORY_OBJECT_DATA_FLUSH 0x1
173#define MEMORY_OBJECT_DATA_NO_CHANGE 0x2
174#define MEMORY_OBJECT_DATA_PURGE 0x4
175#define MEMORY_OBJECT_COPY_SYNC 0x8
176#define MEMORY_OBJECT_DATA_SYNC 0x10
177#define MEMORY_OBJECT_IO_SYNC 0x20
178#define MEMORY_OBJECT_DATA_FLUSH_ALL 0x40
179
180/*
181 * Types for the memory object flavor interfaces
182 */
183
184#define MEMORY_OBJECT_INFO_MAX (1024)
185typedef int *memory_object_info_t;
186typedef int memory_object_flavor_t;
187typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
188
189
190#define MEMORY_OBJECT_PERFORMANCE_INFO 11
191#define MEMORY_OBJECT_ATTRIBUTE_INFO 14
192#define MEMORY_OBJECT_BEHAVIOR_INFO 15
193
194
195struct memory_object_perf_info {
196 memory_object_cluster_size_t cluster_size;
197 boolean_t may_cache;
198};
199
200struct memory_object_attr_info {
201 memory_object_copy_strategy_t copy_strategy;
202 memory_object_cluster_size_t cluster_size;
203 boolean_t may_cache_object;
204 boolean_t temporary;
205};
206
207struct memory_object_behave_info {
208 memory_object_copy_strategy_t copy_strategy;
209 boolean_t temporary;
210 boolean_t invalidate;
211 boolean_t silent_overwrite;
212 boolean_t advisory_pageout;
213};
214
215
216typedef struct memory_object_behave_info *memory_object_behave_info_t;
217typedef struct memory_object_behave_info memory_object_behave_info_data_t;
218
219typedef struct memory_object_perf_info *memory_object_perf_info_t;
220typedef struct memory_object_perf_info memory_object_perf_info_data_t;
221
222typedef struct memory_object_attr_info *memory_object_attr_info_t;
223typedef struct memory_object_attr_info memory_object_attr_info_data_t;
224
225#define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t) \
226 (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
227#define MEMORY_OBJECT_PERF_INFO_COUNT ((mach_msg_type_number_t) \
228 (sizeof(memory_object_perf_info_data_t)/sizeof(int)))
229#define MEMORY_OBJECT_ATTR_INFO_COUNT ((mach_msg_type_number_t) \
230 (sizeof(memory_object_attr_info_data_t)/sizeof(int)))
231
232#define invalid_memory_object_flavor(f) \
233 (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \
234 f != MEMORY_OBJECT_PERFORMANCE_INFO && \
235 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \
236 f != MEMORY_OBJECT_BEHAVIOR_INFO && \
237 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
238
239
240/*
241 * Used to support options on memory_object_release_name call
242 */
243#define MEMORY_OBJECT_TERMINATE_IDLE 0x1
244#define MEMORY_OBJECT_RESPECT_CACHE 0x2
245#define MEMORY_OBJECT_RELEASE_NO_OP 0x4
246
247
248/* named entry processor mapping options */
249/* enumerated */
250#define MAP_MEM_NOOP 0
251#define MAP_MEM_COPYBACK 1
252#define MAP_MEM_IO 2
253#define MAP_MEM_WTHRU 3
254#define MAP_MEM_WCOMB 4 /* Write combining mode */
255 /* aka store gather */
256#define MAP_MEM_INNERWBACK 5
257#define MAP_MEM_POSTED 6
258#define MAP_MEM_RT 7
259#define MAP_MEM_POSTED_REORDERED 8
260#define MAP_MEM_POSTED_COMBINED_REORDERED 9
261
262#define GET_MAP_MEM(flags) \
263 ((((unsigned int)(flags)) >> 24) & 0xFF)
264
265#define SET_MAP_MEM(caching, flags) \
266 ((flags) = ((((unsigned int)(caching)) << 24) \
267 & 0xFF000000) | ((flags) & 0xFFFFFF));
268
269/* leave room for vm_prot bits (0xFF ?) */
270#define MAP_MEM_LEDGER_TAGGED 0x002000 /* object owned by a specific task and ledger */
271#define MAP_MEM_PURGABLE_KERNEL_ONLY 0x004000 /* volatility controlled by kernel */
272#define MAP_MEM_GRAB_SECLUDED 0x008000 /* can grab secluded pages */
273#define MAP_MEM_ONLY 0x010000 /* change processor caching */
274#define MAP_MEM_NAMED_CREATE 0x020000 /* create extant object */
275#define MAP_MEM_PURGABLE 0x040000 /* create a purgable VM object */
276#define MAP_MEM_NAMED_REUSE 0x080000 /* reuse provided entry if identical */
277#define MAP_MEM_USE_DATA_ADDR 0x100000 /* preserve address of data, rather than base of page */
278#define MAP_MEM_VM_COPY 0x200000 /* make a copy of a VM range */
279#define MAP_MEM_VM_SHARE 0x400000 /* extract a VM range for remap */
280#define MAP_MEM_4K_DATA_ADDR 0x800000 /* preserve 4K aligned address of data */
281
282#define MAP_MEM_FLAGS_MASK 0x00FFFF00
283#define MAP_MEM_FLAGS_USER ( \
284 MAP_MEM_PURGABLE_KERNEL_ONLY | \
285 MAP_MEM_GRAB_SECLUDED | \
286 MAP_MEM_ONLY | \
287 MAP_MEM_NAMED_CREATE | \
288 MAP_MEM_PURGABLE | \
289 MAP_MEM_NAMED_REUSE | \
290 MAP_MEM_USE_DATA_ADDR | \
291 MAP_MEM_VM_COPY | \
292 MAP_MEM_VM_SHARE | \
293 MAP_MEM_LEDGER_TAGGED | \
294 MAP_MEM_4K_DATA_ADDR)
295#define MAP_MEM_FLAGS_ALL ( \
296 MAP_MEM_FLAGS_USER)
297
298
299#endif /* _MACH_MEMORY_OBJECT_TYPES_H_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/mach/vm_map.h created+1440
...@@ -0,0 +1,1440 @@
1#ifndef _vm_map_user_
2#define _vm_map_user_
3
4/* Module vm_map */
5
6#include <string.h>
7#include <mach/ndr.h>
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/notify.h>
11#include <mach/mach_types.h>
12#include <mach/message.h>
13#include <mach/mig_errors.h>
14#include <mach/port.h>
15
16/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
17
18#if defined(__has_include)
19#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
20#ifndef USING_MIG_STRNCPY_ZEROFILL
21#define USING_MIG_STRNCPY_ZEROFILL
22#endif
23#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
24#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
25#ifdef __cplusplus
26extern "C" {
27#endif
28 extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
29#ifdef __cplusplus
30}
31#endif
32#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
33#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
34#endif /* __has_include */
35
36/* END MIG_STRNCPY_ZEROFILL CODE */
37
38
39#ifdef AUTOTEST
40#ifndef FUNCTION_PTR_T
41#define FUNCTION_PTR_T
42typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
43typedef struct {
44 char *name;
45 function_ptr_t function;
46} function_table_entry;
47typedef function_table_entry *function_table_t;
48#endif /* FUNCTION_PTR_T */
49#endif /* AUTOTEST */
50
51#ifndef vm_map_MSG_COUNT
52#define vm_map_MSG_COUNT 32
53#endif /* vm_map_MSG_COUNT */
54
55#include <mach/std_types.h>
56#include <mach/mig.h>
57#include <mach/mig.h>
58#include <mach/mach_types.h>
59#include <mach_debug/mach_debug_types.h>
60
61#ifdef __BeforeMigUserHeader
62__BeforeMigUserHeader
63#endif /* __BeforeMigUserHeader */
64
65#include <sys/cdefs.h>
66__BEGIN_DECLS
67
68
69/* Routine vm_region */
70#ifdef mig_external
71mig_external
72#else
73extern
74#endif /* mig_external */
75kern_return_t vm_region
76(
77 vm_map_t target_task,
78 vm_address_t *address,
79 vm_size_t *size,
80 vm_region_flavor_t flavor,
81 vm_region_info_t info,
82 mach_msg_type_number_t *infoCnt,
83 mach_port_t *object_name
84);
85
86/* Routine vm_allocate */
87#ifdef mig_external
88mig_external
89#else
90extern
91#endif /* mig_external */
92kern_return_t vm_allocate
93(
94 vm_map_t target_task,
95 vm_address_t *address,
96 vm_size_t size,
97 int flags
98);
99
100/* Routine vm_deallocate */
101#ifdef mig_external
102mig_external
103#else
104extern
105#endif /* mig_external */
106kern_return_t vm_deallocate
107(
108 vm_map_t target_task,
109 vm_address_t address,
110 vm_size_t size
111);
112
113/* Routine vm_protect */
114#ifdef mig_external
115mig_external
116#else
117extern
118#endif /* mig_external */
119kern_return_t vm_protect
120(
121 vm_map_t target_task,
122 vm_address_t address,
123 vm_size_t size,
124 boolean_t set_maximum,
125 vm_prot_t new_protection
126);
127
128/* Routine vm_inherit */
129#ifdef mig_external
130mig_external
131#else
132extern
133#endif /* mig_external */
134kern_return_t vm_inherit
135(
136 vm_map_t target_task,
137 vm_address_t address,
138 vm_size_t size,
139 vm_inherit_t new_inheritance
140);
141
142/* Routine vm_read */
143#ifdef mig_external
144mig_external
145#else
146extern
147#endif /* mig_external */
148kern_return_t vm_read
149(
150 vm_map_t target_task,
151 vm_address_t address,
152 vm_size_t size,
153 vm_offset_t *data,
154 mach_msg_type_number_t *dataCnt
155);
156
157/* Routine vm_read_list */
158#ifdef mig_external
159mig_external
160#else
161extern
162#endif /* mig_external */
163kern_return_t vm_read_list
164(
165 vm_map_t target_task,
166 vm_read_entry_t data_list,
167 natural_t count
168);
169
170/* Routine vm_write */
171#ifdef mig_external
172mig_external
173#else
174extern
175#endif /* mig_external */
176kern_return_t vm_write
177(
178 vm_map_t target_task,
179 vm_address_t address,
180 vm_offset_t data,
181 mach_msg_type_number_t dataCnt
182);
183
184/* Routine vm_copy */
185#ifdef mig_external
186mig_external
187#else
188extern
189#endif /* mig_external */
190kern_return_t vm_copy
191(
192 vm_map_t target_task,
193 vm_address_t source_address,
194 vm_size_t size,
195 vm_address_t dest_address
196);
197
198/* Routine vm_read_overwrite */
199#ifdef mig_external
200mig_external
201#else
202extern
203#endif /* mig_external */
204kern_return_t vm_read_overwrite
205(
206 vm_map_t target_task,
207 vm_address_t address,
208 vm_size_t size,
209 vm_address_t data,
210 vm_size_t *outsize
211);
212
213/* Routine vm_msync */
214#ifdef mig_external
215mig_external
216#else
217extern
218#endif /* mig_external */
219kern_return_t vm_msync
220(
221 vm_map_t target_task,
222 vm_address_t address,
223 vm_size_t size,
224 vm_sync_t sync_flags
225);
226
227/* Routine vm_behavior_set */
228#ifdef mig_external
229mig_external
230#else
231extern
232#endif /* mig_external */
233kern_return_t vm_behavior_set
234(
235 vm_map_t target_task,
236 vm_address_t address,
237 vm_size_t size,
238 vm_behavior_t new_behavior
239);
240
241/* Routine vm_map */
242#ifdef mig_external
243mig_external
244#else
245extern
246#endif /* mig_external */
247kern_return_t vm_map
248(
249 vm_map_t target_task,
250 vm_address_t *address,
251 vm_size_t size,
252 vm_address_t mask,
253 int flags,
254 mem_entry_name_port_t object,
255 vm_offset_t offset,
256 boolean_t copy,
257 vm_prot_t cur_protection,
258 vm_prot_t max_protection,
259 vm_inherit_t inheritance
260);
261
262/* Routine vm_machine_attribute */
263#ifdef mig_external
264mig_external
265#else
266extern
267#endif /* mig_external */
268kern_return_t vm_machine_attribute
269(
270 vm_map_t target_task,
271 vm_address_t address,
272 vm_size_t size,
273 vm_machine_attribute_t attribute,
274 vm_machine_attribute_val_t *value
275);
276
277/* Routine vm_remap */
278#ifdef mig_external
279mig_external
280#else
281extern
282#endif /* mig_external */
283kern_return_t vm_remap
284(
285 vm_map_t target_task,
286 vm_address_t *target_address,
287 vm_size_t size,
288 vm_address_t mask,
289 int flags,
290 vm_map_t src_task,
291 vm_address_t src_address,
292 boolean_t copy,
293 vm_prot_t *cur_protection,
294 vm_prot_t *max_protection,
295 vm_inherit_t inheritance
296);
297
298/* Routine task_wire */
299#ifdef mig_external
300mig_external
301#else
302extern
303#endif /* mig_external */
304__WATCHOS_PROHIBITED
305__TVOS_PROHIBITED
306kern_return_t task_wire
307(
308 vm_map_t target_task,
309 boolean_t must_wire
310);
311
312/* Routine mach_make_memory_entry */
313#ifdef mig_external
314mig_external
315#else
316extern
317#endif /* mig_external */
318kern_return_t mach_make_memory_entry
319(
320 vm_map_t target_task,
321 vm_size_t *size,
322 vm_offset_t offset,
323 vm_prot_t permission,
324 mem_entry_name_port_t *object_handle,
325 mem_entry_name_port_t parent_entry
326);
327
328/* Routine vm_map_page_query */
329#ifdef mig_external
330mig_external
331#else
332extern
333#endif /* mig_external */
334kern_return_t vm_map_page_query
335(
336 vm_map_t target_map,
337 vm_offset_t offset,
338 integer_t *disposition,
339 integer_t *ref_count
340);
341
342/* Routine mach_vm_region_info */
343#ifdef mig_external
344mig_external
345#else
346extern
347#endif /* mig_external */
348kern_return_t mach_vm_region_info
349(
350 vm_map_t task,
351 vm_address_t address,
352 vm_info_region_t *region,
353 vm_info_object_array_t *objects,
354 mach_msg_type_number_t *objectsCnt
355);
356
357/* Routine vm_mapped_pages_info */
358#ifdef mig_external
359mig_external
360#else
361extern
362#endif /* mig_external */
363kern_return_t vm_mapped_pages_info
364(
365 vm_map_t task,
366 page_address_array_t *pages,
367 mach_msg_type_number_t *pagesCnt
368);
369
370/* Routine vm_region_recurse */
371#ifdef mig_external
372mig_external
373#else
374extern
375#endif /* mig_external */
376kern_return_t vm_region_recurse
377(
378 vm_map_t target_task,
379 vm_address_t *address,
380 vm_size_t *size,
381 natural_t *nesting_depth,
382 vm_region_recurse_info_t info,
383 mach_msg_type_number_t *infoCnt
384);
385
386/* Routine vm_region_recurse_64 */
387#ifdef mig_external
388mig_external
389#else
390extern
391#endif /* mig_external */
392kern_return_t vm_region_recurse_64
393(
394 vm_map_t target_task,
395 vm_address_t *address,
396 vm_size_t *size,
397 natural_t *nesting_depth,
398 vm_region_recurse_info_t info,
399 mach_msg_type_number_t *infoCnt
400);
401
402/* Routine mach_vm_region_info_64 */
403#ifdef mig_external
404mig_external
405#else
406extern
407#endif /* mig_external */
408kern_return_t mach_vm_region_info_64
409(
410 vm_map_t task,
411 vm_address_t address,
412 vm_info_region_64_t *region,
413 vm_info_object_array_t *objects,
414 mach_msg_type_number_t *objectsCnt
415);
416
417/* Routine vm_region_64 */
418#ifdef mig_external
419mig_external
420#else
421extern
422#endif /* mig_external */
423kern_return_t vm_region_64
424(
425 vm_map_t target_task,
426 vm_address_t *address,
427 vm_size_t *size,
428 vm_region_flavor_t flavor,
429 vm_region_info_t info,
430 mach_msg_type_number_t *infoCnt,
431 mach_port_t *object_name
432);
433
434/* Routine mach_make_memory_entry_64 */
435#ifdef mig_external
436mig_external
437#else
438extern
439#endif /* mig_external */
440kern_return_t mach_make_memory_entry_64
441(
442 vm_map_t target_task,
443 memory_object_size_t *size,
444 memory_object_offset_t offset,
445 vm_prot_t permission,
446 mach_port_t *object_handle,
447 mem_entry_name_port_t parent_entry
448);
449
450/* Routine vm_map_64 */
451#ifdef mig_external
452mig_external
453#else
454extern
455#endif /* mig_external */
456kern_return_t vm_map_64
457(
458 vm_map_t target_task,
459 vm_address_t *address,
460 vm_size_t size,
461 vm_address_t mask,
462 int flags,
463 mem_entry_name_port_t object,
464 memory_object_offset_t offset,
465 boolean_t copy,
466 vm_prot_t cur_protection,
467 vm_prot_t max_protection,
468 vm_inherit_t inheritance
469);
470
471/* Routine vm_purgable_control */
472#ifdef mig_external
473mig_external
474#else
475extern
476#endif /* mig_external */
477kern_return_t vm_purgable_control
478(
479 vm_map_t target_task,
480 vm_address_t address,
481 vm_purgable_t control,
482 int *state
483);
484
485/* Routine vm_map_exec_lockdown */
486#ifdef mig_external
487mig_external
488#else
489extern
490#endif /* mig_external */
491kern_return_t vm_map_exec_lockdown
492(
493 vm_map_t target_task
494);
495
496__END_DECLS
497
498/********************** Caution **************************/
499/* The following data types should be used to calculate */
500/* maximum message sizes only. The actual message may be */
501/* smaller, and the position of the arguments within the */
502/* message layout may vary from what is presented here. */
503/* For example, if any of the arguments are variable- */
504/* sized, and less than the maximum is sent, the data */
505/* will be packed tight in the actual message to reduce */
506/* the presence of holes. */
507/********************** Caution **************************/
508
509/* typedefs for all requests */
510
511#ifndef __Request__vm_map_subsystem__defined
512#define __Request__vm_map_subsystem__defined
513
514#ifdef __MigPackStructs
515#pragma pack(push, 4)
516#endif
517 typedef struct {
518 mach_msg_header_t Head;
519 NDR_record_t NDR;
520 vm_address_t address;
521 vm_region_flavor_t flavor;
522 mach_msg_type_number_t infoCnt;
523 } __Request__vm_region_t __attribute__((unused));
524#ifdef __MigPackStructs
525#pragma pack(pop)
526#endif
527
528#ifdef __MigPackStructs
529#pragma pack(push, 4)
530#endif
531 typedef struct {
532 mach_msg_header_t Head;
533 NDR_record_t NDR;
534 vm_address_t address;
535 vm_size_t size;
536 int flags;
537 } __Request__vm_allocate_t __attribute__((unused));
538#ifdef __MigPackStructs
539#pragma pack(pop)
540#endif
541
542#ifdef __MigPackStructs
543#pragma pack(push, 4)
544#endif
545 typedef struct {
546 mach_msg_header_t Head;
547 NDR_record_t NDR;
548 vm_address_t address;
549 vm_size_t size;
550 } __Request__vm_deallocate_t __attribute__((unused));
551#ifdef __MigPackStructs
552#pragma pack(pop)
553#endif
554
555#ifdef __MigPackStructs
556#pragma pack(push, 4)
557#endif
558 typedef struct {
559 mach_msg_header_t Head;
560 NDR_record_t NDR;
561 vm_address_t address;
562 vm_size_t size;
563 boolean_t set_maximum;
564 vm_prot_t new_protection;
565 } __Request__vm_protect_t __attribute__((unused));
566#ifdef __MigPackStructs
567#pragma pack(pop)
568#endif
569
570#ifdef __MigPackStructs
571#pragma pack(push, 4)
572#endif
573 typedef struct {
574 mach_msg_header_t Head;
575 NDR_record_t NDR;
576 vm_address_t address;
577 vm_size_t size;
578 vm_inherit_t new_inheritance;
579 } __Request__vm_inherit_t __attribute__((unused));
580#ifdef __MigPackStructs
581#pragma pack(pop)
582#endif
583
584#ifdef __MigPackStructs
585#pragma pack(push, 4)
586#endif
587 typedef struct {
588 mach_msg_header_t Head;
589 NDR_record_t NDR;
590 vm_address_t address;
591 vm_size_t size;
592 } __Request__vm_read_t __attribute__((unused));
593#ifdef __MigPackStructs
594#pragma pack(pop)
595#endif
596
597#ifdef __MigPackStructs
598#pragma pack(push, 4)
599#endif
600 typedef struct {
601 mach_msg_header_t Head;
602 NDR_record_t NDR;
603 vm_read_entry_t data_list;
604 natural_t count;
605 } __Request__vm_read_list_t __attribute__((unused));
606#ifdef __MigPackStructs
607#pragma pack(pop)
608#endif
609
610#ifdef __MigPackStructs
611#pragma pack(push, 4)
612#endif
613 typedef struct {
614 mach_msg_header_t Head;
615 /* start of the kernel processed data */
616 mach_msg_body_t msgh_body;
617 mach_msg_ool_descriptor_t data;
618 /* end of the kernel processed data */
619 NDR_record_t NDR;
620 vm_address_t address;
621 mach_msg_type_number_t dataCnt;
622 } __Request__vm_write_t __attribute__((unused));
623#ifdef __MigPackStructs
624#pragma pack(pop)
625#endif
626
627#ifdef __MigPackStructs
628#pragma pack(push, 4)
629#endif
630 typedef struct {
631 mach_msg_header_t Head;
632 NDR_record_t NDR;
633 vm_address_t source_address;
634 vm_size_t size;
635 vm_address_t dest_address;
636 } __Request__vm_copy_t __attribute__((unused));
637#ifdef __MigPackStructs
638#pragma pack(pop)
639#endif
640
641#ifdef __MigPackStructs
642#pragma pack(push, 4)
643#endif
644 typedef struct {
645 mach_msg_header_t Head;
646 NDR_record_t NDR;
647 vm_address_t address;
648 vm_size_t size;
649 vm_address_t data;
650 } __Request__vm_read_overwrite_t __attribute__((unused));
651#ifdef __MigPackStructs
652#pragma pack(pop)
653#endif
654
655#ifdef __MigPackStructs
656#pragma pack(push, 4)
657#endif
658 typedef struct {
659 mach_msg_header_t Head;
660 NDR_record_t NDR;
661 vm_address_t address;
662 vm_size_t size;
663 vm_sync_t sync_flags;
664 } __Request__vm_msync_t __attribute__((unused));
665#ifdef __MigPackStructs
666#pragma pack(pop)
667#endif
668
669#ifdef __MigPackStructs
670#pragma pack(push, 4)
671#endif
672 typedef struct {
673 mach_msg_header_t Head;
674 NDR_record_t NDR;
675 vm_address_t address;
676 vm_size_t size;
677 vm_behavior_t new_behavior;
678 } __Request__vm_behavior_set_t __attribute__((unused));
679#ifdef __MigPackStructs
680#pragma pack(pop)
681#endif
682
683#ifdef __MigPackStructs
684#pragma pack(push, 4)
685#endif
686 typedef struct {
687 mach_msg_header_t Head;
688 /* start of the kernel processed data */
689 mach_msg_body_t msgh_body;
690 mach_msg_port_descriptor_t object;
691 /* end of the kernel processed data */
692 NDR_record_t NDR;
693 vm_address_t address;
694 vm_size_t size;
695 vm_address_t mask;
696 int flags;
697 vm_offset_t offset;
698 boolean_t copy;
699 vm_prot_t cur_protection;
700 vm_prot_t max_protection;
701 vm_inherit_t inheritance;
702 } __Request__vm_map_t __attribute__((unused));
703#ifdef __MigPackStructs
704#pragma pack(pop)
705#endif
706
707#ifdef __MigPackStructs
708#pragma pack(push, 4)
709#endif
710 typedef struct {
711 mach_msg_header_t Head;
712 NDR_record_t NDR;
713 vm_address_t address;
714 vm_size_t size;
715 vm_machine_attribute_t attribute;
716 vm_machine_attribute_val_t value;
717 } __Request__vm_machine_attribute_t __attribute__((unused));
718#ifdef __MigPackStructs
719#pragma pack(pop)
720#endif
721
722#ifdef __MigPackStructs
723#pragma pack(push, 4)
724#endif
725 typedef struct {
726 mach_msg_header_t Head;
727 /* start of the kernel processed data */
728 mach_msg_body_t msgh_body;
729 mach_msg_port_descriptor_t src_task;
730 /* end of the kernel processed data */
731 NDR_record_t NDR;
732 vm_address_t target_address;
733 vm_size_t size;
734 vm_address_t mask;
735 int flags;
736 vm_address_t src_address;
737 boolean_t copy;
738 vm_inherit_t inheritance;
739 } __Request__vm_remap_t __attribute__((unused));
740#ifdef __MigPackStructs
741#pragma pack(pop)
742#endif
743
744#ifdef __MigPackStructs
745#pragma pack(push, 4)
746#endif
747 typedef struct {
748 mach_msg_header_t Head;
749 NDR_record_t NDR;
750 boolean_t must_wire;
751 } __Request__task_wire_t __attribute__((unused));
752#ifdef __MigPackStructs
753#pragma pack(pop)
754#endif
755
756#ifdef __MigPackStructs
757#pragma pack(push, 4)
758#endif
759 typedef struct {
760 mach_msg_header_t Head;
761 /* start of the kernel processed data */
762 mach_msg_body_t msgh_body;
763 mach_msg_port_descriptor_t parent_entry;
764 /* end of the kernel processed data */
765 NDR_record_t NDR;
766 vm_size_t size;
767 vm_offset_t offset;
768 vm_prot_t permission;
769 } __Request__mach_make_memory_entry_t __attribute__((unused));
770#ifdef __MigPackStructs
771#pragma pack(pop)
772#endif
773
774#ifdef __MigPackStructs
775#pragma pack(push, 4)
776#endif
777 typedef struct {
778 mach_msg_header_t Head;
779 NDR_record_t NDR;
780 vm_offset_t offset;
781 } __Request__vm_map_page_query_t __attribute__((unused));
782#ifdef __MigPackStructs
783#pragma pack(pop)
784#endif
785
786#ifdef __MigPackStructs
787#pragma pack(push, 4)
788#endif
789 typedef struct {
790 mach_msg_header_t Head;
791 NDR_record_t NDR;
792 vm_address_t address;
793 } __Request__mach_vm_region_info_t __attribute__((unused));
794#ifdef __MigPackStructs
795#pragma pack(pop)
796#endif
797
798#ifdef __MigPackStructs
799#pragma pack(push, 4)
800#endif
801 typedef struct {
802 mach_msg_header_t Head;
803 } __Request__vm_mapped_pages_info_t __attribute__((unused));
804#ifdef __MigPackStructs
805#pragma pack(pop)
806#endif
807
808#ifdef __MigPackStructs
809#pragma pack(push, 4)
810#endif
811 typedef struct {
812 mach_msg_header_t Head;
813 NDR_record_t NDR;
814 vm_address_t address;
815 natural_t nesting_depth;
816 mach_msg_type_number_t infoCnt;
817 } __Request__vm_region_recurse_t __attribute__((unused));
818#ifdef __MigPackStructs
819#pragma pack(pop)
820#endif
821
822#ifdef __MigPackStructs
823#pragma pack(push, 4)
824#endif
825 typedef struct {
826 mach_msg_header_t Head;
827 NDR_record_t NDR;
828 vm_address_t address;
829 natural_t nesting_depth;
830 mach_msg_type_number_t infoCnt;
831 } __Request__vm_region_recurse_64_t __attribute__((unused));
832#ifdef __MigPackStructs
833#pragma pack(pop)
834#endif
835
836#ifdef __MigPackStructs
837#pragma pack(push, 4)
838#endif
839 typedef struct {
840 mach_msg_header_t Head;
841 NDR_record_t NDR;
842 vm_address_t address;
843 } __Request__mach_vm_region_info_64_t __attribute__((unused));
844#ifdef __MigPackStructs
845#pragma pack(pop)
846#endif
847
848#ifdef __MigPackStructs
849#pragma pack(push, 4)
850#endif
851 typedef struct {
852 mach_msg_header_t Head;
853 NDR_record_t NDR;
854 vm_address_t address;
855 vm_region_flavor_t flavor;
856 mach_msg_type_number_t infoCnt;
857 } __Request__vm_region_64_t __attribute__((unused));
858#ifdef __MigPackStructs
859#pragma pack(pop)
860#endif
861
862#ifdef __MigPackStructs
863#pragma pack(push, 4)
864#endif
865 typedef struct {
866 mach_msg_header_t Head;
867 /* start of the kernel processed data */
868 mach_msg_body_t msgh_body;
869 mach_msg_port_descriptor_t parent_entry;
870 /* end of the kernel processed data */
871 NDR_record_t NDR;
872 memory_object_size_t size;
873 memory_object_offset_t offset;
874 vm_prot_t permission;
875 } __Request__mach_make_memory_entry_64_t __attribute__((unused));
876#ifdef __MigPackStructs
877#pragma pack(pop)
878#endif
879
880#ifdef __MigPackStructs
881#pragma pack(push, 4)
882#endif
883 typedef struct {
884 mach_msg_header_t Head;
885 /* start of the kernel processed data */
886 mach_msg_body_t msgh_body;
887 mach_msg_port_descriptor_t object;
888 /* end of the kernel processed data */
889 NDR_record_t NDR;
890 vm_address_t address;
891 vm_size_t size;
892 vm_address_t mask;
893 int flags;
894 memory_object_offset_t offset;
895 boolean_t copy;
896 vm_prot_t cur_protection;
897 vm_prot_t max_protection;
898 vm_inherit_t inheritance;
899 } __Request__vm_map_64_t __attribute__((unused));
900#ifdef __MigPackStructs
901#pragma pack(pop)
902#endif
903
904#ifdef __MigPackStructs
905#pragma pack(push, 4)
906#endif
907 typedef struct {
908 mach_msg_header_t Head;
909 NDR_record_t NDR;
910 vm_address_t address;
911 vm_purgable_t control;
912 int state;
913 } __Request__vm_purgable_control_t __attribute__((unused));
914#ifdef __MigPackStructs
915#pragma pack(pop)
916#endif
917
918#ifdef __MigPackStructs
919#pragma pack(push, 4)
920#endif
921 typedef struct {
922 mach_msg_header_t Head;
923 } __Request__vm_map_exec_lockdown_t __attribute__((unused));
924#ifdef __MigPackStructs
925#pragma pack(pop)
926#endif
927#endif /* !__Request__vm_map_subsystem__defined */
928
929/* union of all requests */
930
931#ifndef __RequestUnion__vm_map_subsystem__defined
932#define __RequestUnion__vm_map_subsystem__defined
933union __RequestUnion__vm_map_subsystem {
934 __Request__vm_region_t Request_vm_region;
935 __Request__vm_allocate_t Request_vm_allocate;
936 __Request__vm_deallocate_t Request_vm_deallocate;
937 __Request__vm_protect_t Request_vm_protect;
938 __Request__vm_inherit_t Request_vm_inherit;
939 __Request__vm_read_t Request_vm_read;
940 __Request__vm_read_list_t Request_vm_read_list;
941 __Request__vm_write_t Request_vm_write;
942 __Request__vm_copy_t Request_vm_copy;
943 __Request__vm_read_overwrite_t Request_vm_read_overwrite;
944 __Request__vm_msync_t Request_vm_msync;
945 __Request__vm_behavior_set_t Request_vm_behavior_set;
946 __Request__vm_map_t Request_vm_map;
947 __Request__vm_machine_attribute_t Request_vm_machine_attribute;
948 __Request__vm_remap_t Request_vm_remap;
949 __Request__task_wire_t Request_task_wire;
950 __Request__mach_make_memory_entry_t Request_mach_make_memory_entry;
951 __Request__vm_map_page_query_t Request_vm_map_page_query;
952 __Request__mach_vm_region_info_t Request_mach_vm_region_info;
953 __Request__vm_mapped_pages_info_t Request_vm_mapped_pages_info;
954 __Request__vm_region_recurse_t Request_vm_region_recurse;
955 __Request__vm_region_recurse_64_t Request_vm_region_recurse_64;
956 __Request__mach_vm_region_info_64_t Request_mach_vm_region_info_64;
957 __Request__vm_region_64_t Request_vm_region_64;
958 __Request__mach_make_memory_entry_64_t Request_mach_make_memory_entry_64;
959 __Request__vm_map_64_t Request_vm_map_64;
960 __Request__vm_purgable_control_t Request_vm_purgable_control;
961 __Request__vm_map_exec_lockdown_t Request_vm_map_exec_lockdown;
962};
963#endif /* !__RequestUnion__vm_map_subsystem__defined */
964/* typedefs for all replies */
965
966#ifndef __Reply__vm_map_subsystem__defined
967#define __Reply__vm_map_subsystem__defined
968
969#ifdef __MigPackStructs
970#pragma pack(push, 4)
971#endif
972 typedef struct {
973 mach_msg_header_t Head;
974 /* start of the kernel processed data */
975 mach_msg_body_t msgh_body;
976 mach_msg_port_descriptor_t object_name;
977 /* end of the kernel processed data */
978 NDR_record_t NDR;
979 vm_address_t address;
980 vm_size_t size;
981 mach_msg_type_number_t infoCnt;
982 int info[10];
983 } __Reply__vm_region_t __attribute__((unused));
984#ifdef __MigPackStructs
985#pragma pack(pop)
986#endif
987
988#ifdef __MigPackStructs
989#pragma pack(push, 4)
990#endif
991 typedef struct {
992 mach_msg_header_t Head;
993 NDR_record_t NDR;
994 kern_return_t RetCode;
995 vm_address_t address;
996 } __Reply__vm_allocate_t __attribute__((unused));
997#ifdef __MigPackStructs
998#pragma pack(pop)
999#endif
1000
1001#ifdef __MigPackStructs
1002#pragma pack(push, 4)
1003#endif
1004 typedef struct {
1005 mach_msg_header_t Head;
1006 NDR_record_t NDR;
1007 kern_return_t RetCode;
1008 } __Reply__vm_deallocate_t __attribute__((unused));
1009#ifdef __MigPackStructs
1010#pragma pack(pop)
1011#endif
1012
1013#ifdef __MigPackStructs
1014#pragma pack(push, 4)
1015#endif
1016 typedef struct {
1017 mach_msg_header_t Head;
1018 NDR_record_t NDR;
1019 kern_return_t RetCode;
1020 } __Reply__vm_protect_t __attribute__((unused));
1021#ifdef __MigPackStructs
1022#pragma pack(pop)
1023#endif
1024
1025#ifdef __MigPackStructs
1026#pragma pack(push, 4)
1027#endif
1028 typedef struct {
1029 mach_msg_header_t Head;
1030 NDR_record_t NDR;
1031 kern_return_t RetCode;
1032 } __Reply__vm_inherit_t __attribute__((unused));
1033#ifdef __MigPackStructs
1034#pragma pack(pop)
1035#endif
1036
1037#ifdef __MigPackStructs
1038#pragma pack(push, 4)
1039#endif
1040 typedef struct {
1041 mach_msg_header_t Head;
1042 /* start of the kernel processed data */
1043 mach_msg_body_t msgh_body;
1044 mach_msg_ool_descriptor_t data;
1045 /* end of the kernel processed data */
1046 NDR_record_t NDR;
1047 mach_msg_type_number_t dataCnt;
1048 } __Reply__vm_read_t __attribute__((unused));
1049#ifdef __MigPackStructs
1050#pragma pack(pop)
1051#endif
1052
1053#ifdef __MigPackStructs
1054#pragma pack(push, 4)
1055#endif
1056 typedef struct {
1057 mach_msg_header_t Head;
1058 NDR_record_t NDR;
1059 kern_return_t RetCode;
1060 vm_read_entry_t data_list;
1061 } __Reply__vm_read_list_t __attribute__((unused));
1062#ifdef __MigPackStructs
1063#pragma pack(pop)
1064#endif
1065
1066#ifdef __MigPackStructs
1067#pragma pack(push, 4)
1068#endif
1069 typedef struct {
1070 mach_msg_header_t Head;
1071 NDR_record_t NDR;
1072 kern_return_t RetCode;
1073 } __Reply__vm_write_t __attribute__((unused));
1074#ifdef __MigPackStructs
1075#pragma pack(pop)
1076#endif
1077
1078#ifdef __MigPackStructs
1079#pragma pack(push, 4)
1080#endif
1081 typedef struct {
1082 mach_msg_header_t Head;
1083 NDR_record_t NDR;
1084 kern_return_t RetCode;
1085 } __Reply__vm_copy_t __attribute__((unused));
1086#ifdef __MigPackStructs
1087#pragma pack(pop)
1088#endif
1089
1090#ifdef __MigPackStructs
1091#pragma pack(push, 4)
1092#endif
1093 typedef struct {
1094 mach_msg_header_t Head;
1095 NDR_record_t NDR;
1096 kern_return_t RetCode;
1097 vm_size_t outsize;
1098 } __Reply__vm_read_overwrite_t __attribute__((unused));
1099#ifdef __MigPackStructs
1100#pragma pack(pop)
1101#endif
1102
1103#ifdef __MigPackStructs
1104#pragma pack(push, 4)
1105#endif
1106 typedef struct {
1107 mach_msg_header_t Head;
1108 NDR_record_t NDR;
1109 kern_return_t RetCode;
1110 } __Reply__vm_msync_t __attribute__((unused));
1111#ifdef __MigPackStructs
1112#pragma pack(pop)
1113#endif
1114
1115#ifdef __MigPackStructs
1116#pragma pack(push, 4)
1117#endif
1118 typedef struct {
1119 mach_msg_header_t Head;
1120 NDR_record_t NDR;
1121 kern_return_t RetCode;
1122 } __Reply__vm_behavior_set_t __attribute__((unused));
1123#ifdef __MigPackStructs
1124#pragma pack(pop)
1125#endif
1126
1127#ifdef __MigPackStructs
1128#pragma pack(push, 4)
1129#endif
1130 typedef struct {
1131 mach_msg_header_t Head;
1132 NDR_record_t NDR;
1133 kern_return_t RetCode;
1134 vm_address_t address;
1135 } __Reply__vm_map_t __attribute__((unused));
1136#ifdef __MigPackStructs
1137#pragma pack(pop)
1138#endif
1139
1140#ifdef __MigPackStructs
1141#pragma pack(push, 4)
1142#endif
1143 typedef struct {
1144 mach_msg_header_t Head;
1145 NDR_record_t NDR;
1146 kern_return_t RetCode;
1147 vm_machine_attribute_val_t value;
1148 } __Reply__vm_machine_attribute_t __attribute__((unused));
1149#ifdef __MigPackStructs
1150#pragma pack(pop)
1151#endif
1152
1153#ifdef __MigPackStructs
1154#pragma pack(push, 4)
1155#endif
1156 typedef struct {
1157 mach_msg_header_t Head;
1158 NDR_record_t NDR;
1159 kern_return_t RetCode;
1160 vm_address_t target_address;
1161 vm_prot_t cur_protection;
1162 vm_prot_t max_protection;
1163 } __Reply__vm_remap_t __attribute__((unused));
1164#ifdef __MigPackStructs
1165#pragma pack(pop)
1166#endif
1167
1168#ifdef __MigPackStructs
1169#pragma pack(push, 4)
1170#endif
1171 typedef struct {
1172 mach_msg_header_t Head;
1173 NDR_record_t NDR;
1174 kern_return_t RetCode;
1175 } __Reply__task_wire_t __attribute__((unused));
1176#ifdef __MigPackStructs
1177#pragma pack(pop)
1178#endif
1179
1180#ifdef __MigPackStructs
1181#pragma pack(push, 4)
1182#endif
1183 typedef struct {
1184 mach_msg_header_t Head;
1185 /* start of the kernel processed data */
1186 mach_msg_body_t msgh_body;
1187 mach_msg_port_descriptor_t object_handle;
1188 /* end of the kernel processed data */
1189 NDR_record_t NDR;
1190 vm_size_t size;
1191 } __Reply__mach_make_memory_entry_t __attribute__((unused));
1192#ifdef __MigPackStructs
1193#pragma pack(pop)
1194#endif
1195
1196#ifdef __MigPackStructs
1197#pragma pack(push, 4)
1198#endif
1199 typedef struct {
1200 mach_msg_header_t Head;
1201 NDR_record_t NDR;
1202 kern_return_t RetCode;
1203 integer_t disposition;
1204 integer_t ref_count;
1205 } __Reply__vm_map_page_query_t __attribute__((unused));
1206#ifdef __MigPackStructs
1207#pragma pack(pop)
1208#endif
1209
1210#ifdef __MigPackStructs
1211#pragma pack(push, 4)
1212#endif
1213 typedef struct {
1214 mach_msg_header_t Head;
1215 /* start of the kernel processed data */
1216 mach_msg_body_t msgh_body;
1217 mach_msg_ool_descriptor_t objects;
1218 /* end of the kernel processed data */
1219 NDR_record_t NDR;
1220 vm_info_region_t region;
1221 mach_msg_type_number_t objectsCnt;
1222 } __Reply__mach_vm_region_info_t __attribute__((unused));
1223#ifdef __MigPackStructs
1224#pragma pack(pop)
1225#endif
1226
1227#ifdef __MigPackStructs
1228#pragma pack(push, 4)
1229#endif
1230 typedef struct {
1231 mach_msg_header_t Head;
1232 /* start of the kernel processed data */
1233 mach_msg_body_t msgh_body;
1234 mach_msg_ool_descriptor_t pages;
1235 /* end of the kernel processed data */
1236 NDR_record_t NDR;
1237 mach_msg_type_number_t pagesCnt;
1238 } __Reply__vm_mapped_pages_info_t __attribute__((unused));
1239#ifdef __MigPackStructs
1240#pragma pack(pop)
1241#endif
1242
1243#ifdef __MigPackStructs
1244#pragma pack(push, 4)
1245#endif
1246 typedef struct {
1247 mach_msg_header_t Head;
1248 NDR_record_t NDR;
1249 kern_return_t RetCode;
1250 vm_address_t address;
1251 vm_size_t size;
1252 natural_t nesting_depth;
1253 mach_msg_type_number_t infoCnt;
1254 int info[19];
1255 } __Reply__vm_region_recurse_t __attribute__((unused));
1256#ifdef __MigPackStructs
1257#pragma pack(pop)
1258#endif
1259
1260#ifdef __MigPackStructs
1261#pragma pack(push, 4)
1262#endif
1263 typedef struct {
1264 mach_msg_header_t Head;
1265 NDR_record_t NDR;
1266 kern_return_t RetCode;
1267 vm_address_t address;
1268 vm_size_t size;
1269 natural_t nesting_depth;
1270 mach_msg_type_number_t infoCnt;
1271 int info[19];
1272 } __Reply__vm_region_recurse_64_t __attribute__((unused));
1273#ifdef __MigPackStructs
1274#pragma pack(pop)
1275#endif
1276
1277#ifdef __MigPackStructs
1278#pragma pack(push, 4)
1279#endif
1280 typedef struct {
1281 mach_msg_header_t Head;
1282 /* start of the kernel processed data */
1283 mach_msg_body_t msgh_body;
1284 mach_msg_ool_descriptor_t objects;
1285 /* end of the kernel processed data */
1286 NDR_record_t NDR;
1287 vm_info_region_64_t region;
1288 mach_msg_type_number_t objectsCnt;
1289 } __Reply__mach_vm_region_info_64_t __attribute__((unused));
1290#ifdef __MigPackStructs
1291#pragma pack(pop)
1292#endif
1293
1294#ifdef __MigPackStructs
1295#pragma pack(push, 4)
1296#endif
1297 typedef struct {
1298 mach_msg_header_t Head;
1299 /* start of the kernel processed data */
1300 mach_msg_body_t msgh_body;
1301 mach_msg_port_descriptor_t object_name;
1302 /* end of the kernel processed data */
1303 NDR_record_t NDR;
1304 vm_address_t address;
1305 vm_size_t size;
1306 mach_msg_type_number_t infoCnt;
1307 int info[10];
1308 } __Reply__vm_region_64_t __attribute__((unused));
1309#ifdef __MigPackStructs
1310#pragma pack(pop)
1311#endif
1312
1313#ifdef __MigPackStructs
1314#pragma pack(push, 4)
1315#endif
1316 typedef struct {
1317 mach_msg_header_t Head;
1318 /* start of the kernel processed data */
1319 mach_msg_body_t msgh_body;
1320 mach_msg_port_descriptor_t object_handle;
1321 /* end of the kernel processed data */
1322 NDR_record_t NDR;
1323 memory_object_size_t size;
1324 } __Reply__mach_make_memory_entry_64_t __attribute__((unused));
1325#ifdef __MigPackStructs
1326#pragma pack(pop)
1327#endif
1328
1329#ifdef __MigPackStructs
1330#pragma pack(push, 4)
1331#endif
1332 typedef struct {
1333 mach_msg_header_t Head;
1334 NDR_record_t NDR;
1335 kern_return_t RetCode;
1336 vm_address_t address;
1337 } __Reply__vm_map_64_t __attribute__((unused));
1338#ifdef __MigPackStructs
1339#pragma pack(pop)
1340#endif
1341
1342#ifdef __MigPackStructs
1343#pragma pack(push, 4)
1344#endif
1345 typedef struct {
1346 mach_msg_header_t Head;
1347 NDR_record_t NDR;
1348 kern_return_t RetCode;
1349 int state;
1350 } __Reply__vm_purgable_control_t __attribute__((unused));
1351#ifdef __MigPackStructs
1352#pragma pack(pop)
1353#endif
1354
1355#ifdef __MigPackStructs
1356#pragma pack(push, 4)
1357#endif
1358 typedef struct {
1359 mach_msg_header_t Head;
1360 NDR_record_t NDR;
1361 kern_return_t RetCode;
1362 } __Reply__vm_map_exec_lockdown_t __attribute__((unused));
1363#ifdef __MigPackStructs
1364#pragma pack(pop)
1365#endif
1366#endif /* !__Reply__vm_map_subsystem__defined */
1367
1368/* union of all replies */
1369
1370#ifndef __ReplyUnion__vm_map_subsystem__defined
1371#define __ReplyUnion__vm_map_subsystem__defined
1372union __ReplyUnion__vm_map_subsystem {
1373 __Reply__vm_region_t Reply_vm_region;
1374 __Reply__vm_allocate_t Reply_vm_allocate;
1375 __Reply__vm_deallocate_t Reply_vm_deallocate;
1376 __Reply__vm_protect_t Reply_vm_protect;
1377 __Reply__vm_inherit_t Reply_vm_inherit;
1378 __Reply__vm_read_t Reply_vm_read;
1379 __Reply__vm_read_list_t Reply_vm_read_list;
1380 __Reply__vm_write_t Reply_vm_write;
1381 __Reply__vm_copy_t Reply_vm_copy;
1382 __Reply__vm_read_overwrite_t Reply_vm_read_overwrite;
1383 __Reply__vm_msync_t Reply_vm_msync;
1384 __Reply__vm_behavior_set_t Reply_vm_behavior_set;
1385 __Reply__vm_map_t Reply_vm_map;
1386 __Reply__vm_machine_attribute_t Reply_vm_machine_attribute;
1387 __Reply__vm_remap_t Reply_vm_remap;
1388 __Reply__task_wire_t Reply_task_wire;
1389 __Reply__mach_make_memory_entry_t Reply_mach_make_memory_entry;
1390 __Reply__vm_map_page_query_t Reply_vm_map_page_query;
1391 __Reply__mach_vm_region_info_t Reply_mach_vm_region_info;
1392 __Reply__vm_mapped_pages_info_t Reply_vm_mapped_pages_info;
1393 __Reply__vm_region_recurse_t Reply_vm_region_recurse;
1394 __Reply__vm_region_recurse_64_t Reply_vm_region_recurse_64;
1395 __Reply__mach_vm_region_info_64_t Reply_mach_vm_region_info_64;
1396 __Reply__vm_region_64_t Reply_vm_region_64;
1397 __Reply__mach_make_memory_entry_64_t Reply_mach_make_memory_entry_64;
1398 __Reply__vm_map_64_t Reply_vm_map_64;
1399 __Reply__vm_purgable_control_t Reply_vm_purgable_control;
1400 __Reply__vm_map_exec_lockdown_t Reply_vm_map_exec_lockdown;
1401};
1402#endif /* !__RequestUnion__vm_map_subsystem__defined */
1403
1404#ifndef subsystem_to_name_map_vm_map
1405#define subsystem_to_name_map_vm_map \
1406 { "vm_region", 3800 },\
1407 { "vm_allocate", 3801 },\
1408 { "vm_deallocate", 3802 },\
1409 { "vm_protect", 3803 },\
1410 { "vm_inherit", 3804 },\
1411 { "vm_read", 3805 },\
1412 { "vm_read_list", 3806 },\
1413 { "vm_write", 3807 },\
1414 { "vm_copy", 3808 },\
1415 { "vm_read_overwrite", 3809 },\
1416 { "vm_msync", 3810 },\
1417 { "vm_behavior_set", 3811 },\
1418 { "vm_map", 3812 },\
1419 { "vm_machine_attribute", 3813 },\
1420 { "vm_remap", 3814 },\
1421 { "task_wire", 3815 },\
1422 { "mach_make_memory_entry", 3816 },\
1423 { "vm_map_page_query", 3817 },\
1424 { "mach_vm_region_info", 3818 },\
1425 { "vm_mapped_pages_info", 3819 },\
1426 { "vm_region_recurse", 3821 },\
1427 { "vm_region_recurse_64", 3822 },\
1428 { "mach_vm_region_info_64", 3823 },\
1429 { "vm_region_64", 3824 },\
1430 { "mach_make_memory_entry_64", 3825 },\
1431 { "vm_map_64", 3826 },\
1432 { "vm_purgable_control", 3830 },\
1433 { "vm_map_exec_lockdown", 3831 }
1434#endif
1435
1436#ifdef __AfterMigUserHeader
1437__AfterMigUserHeader
1438#endif /* __AfterMigUserHeader */
1439
1440#endif /* _vm_map_user_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/mach_debug/ipc_info.h created+116
...@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: mach_debug/ipc_info.h
60 * Author: Rich Draves
61 * Date: March, 1990
62 *
63 * Definitions for the IPC debugging interface.
64 */
65
66#ifndef _MACH_DEBUG_IPC_INFO_H_
67#define _MACH_DEBUG_IPC_INFO_H_
68
69#include <mach/boolean.h>
70#include <mach/port.h>
71#include <mach/machine/vm_types.h>
72
73/*
74 * Remember to update the mig type definitions
75 * in mach_debug_types.defs when adding/removing fields.
76 */
77
78typedef struct ipc_info_space {
79 natural_t iis_genno_mask; /* generation number mask */
80 natural_t iis_table_size; /* size of table */
81 natural_t iis_table_next; /* next possible size of table */
82 natural_t iis_tree_size; /* size of tree (UNUSED) */
83 natural_t iis_tree_small; /* # of small entries in tree (UNUSED) */
84 natural_t iis_tree_hash; /* # of hashed entries in tree (UNUSED) */
85} ipc_info_space_t;
86
87typedef struct ipc_info_space_basic {
88 natural_t iisb_genno_mask; /* generation number mask */
89 natural_t iisb_table_size; /* size of table */
90 natural_t iisb_table_next; /* next possible size of table */
91 natural_t iisb_table_inuse; /* number of entries in use */
92 natural_t iisb_reserved[2]; /* future expansion */
93} ipc_info_space_basic_t;
94
95typedef struct ipc_info_name {
96 mach_port_name_t iin_name; /* port name, including gen number */
97/*boolean_t*/ integer_t iin_collision; /* collision at this entry? */
98 mach_port_type_t iin_type; /* straight port type */
99 mach_port_urefs_t iin_urefs; /* user-references */
100 natural_t iin_object; /* object pointer/identifier */
101 natural_t iin_next; /* marequest/next in free list */
102 natural_t iin_hash; /* hash index */
103} ipc_info_name_t;
104
105typedef ipc_info_name_t *ipc_info_name_array_t;
106
107/* UNUSED */
108typedef struct ipc_info_tree_name {
109 ipc_info_name_t iitn_name;
110 mach_port_name_t iitn_lchild; /* name of left child */
111 mach_port_name_t iitn_rchild; /* name of right child */
112} ipc_info_tree_name_t;
113
114typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t;
115
116#endif /* _MACH_DEBUG_IPC_INFO_H_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/time.h created+208
...@@ -0,0 +1,208 @@
1/*
2 * Copyright (c) 2000 Apple Computer, 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 * Copyright (c) 1989, 1993
25 * The Regents of the University of California. All rights reserved.
26 * (c) UNIX System Laboratories, Inc.
27 * All or some portions of this file are derived from material licensed
28 * to the University of California by American Telephone and Telegraph
29 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
30 * the permission of UNIX System Laboratories, Inc.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)time.h 8.3 (Berkeley) 1/21/94
61 */
62
63#ifndef _TIME_H_
64#define _TIME_H_
65
66#include <_types.h>
67#include <sys/cdefs.h>
68#include <Availability.h>
69#include <sys/_types/_clock_t.h>
70#include <sys/_types/_null.h>
71#include <sys/_types/_size_t.h>
72#include <sys/_types/_time_t.h>
73#include <sys/_types/_timespec.h>
74
75struct tm {
76 int tm_sec; /* seconds after the minute [0-60] */
77 int tm_min; /* minutes after the hour [0-59] */
78 int tm_hour; /* hours since midnight [0-23] */
79 int tm_mday; /* day of the month [1-31] */
80 int tm_mon; /* months since January [0-11] */
81 int tm_year; /* years since 1900 */
82 int tm_wday; /* days since Sunday [0-6] */
83 int tm_yday; /* days since January 1 [0-365] */
84 int tm_isdst; /* Daylight Savings Time flag */
85 long tm_gmtoff; /* offset from UTC in seconds */
86 char *tm_zone; /* timezone abbreviation */
87};
88
89#if __DARWIN_UNIX03
90#define CLOCKS_PER_SEC 1000000 /* [XSI] */
91#else /* !__DARWIN_UNIX03 */
92#include <machine/_limits.h> /* Include file containing CLK_TCK. */
93
94#define CLOCKS_PER_SEC (__DARWIN_CLK_TCK)
95#endif /* __DARWIN_UNIX03 */
96
97#ifndef _ANSI_SOURCE
98extern char *tzname[];
99#endif
100
101extern int getdate_err;
102#if __DARWIN_UNIX03
103extern long timezone __DARWIN_ALIAS(timezone);
104#endif /* __DARWIN_UNIX03 */
105extern int daylight;
106
107__BEGIN_DECLS
108char *asctime(const struct tm *);
109clock_t clock(void) __DARWIN_ALIAS(clock);
110char *ctime(const time_t *);
111double difftime(time_t, time_t);
112struct tm *getdate(const char *);
113struct tm *gmtime(const time_t *);
114struct tm *localtime(const time_t *);
115time_t mktime(struct tm *) __DARWIN_ALIAS(mktime);
116size_t strftime(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict) __DARWIN_ALIAS(strftime);
117char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict) __DARWIN_ALIAS(strptime);
118time_t time(time_t *);
119
120#ifndef _ANSI_SOURCE
121void tzset(void);
122#endif /* not ANSI */
123
124/* [TSF] Thread safe functions */
125char *asctime_r(const struct tm * __restrict, char * __restrict);
126char *ctime_r(const time_t *, char *);
127struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
128struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict);
129
130#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
131time_t posix2time(time_t);
132#if !__DARWIN_UNIX03
133char *timezone(int, int);
134#endif /* !__DARWIN_UNIX03 */
135void tzsetwall(void);
136time_t time2posix(time_t);
137time_t timelocal(struct tm * const);
138time_t timegm(struct tm * const);
139#endif /* neither ANSI nor POSIX */
140
141#if !defined(_ANSI_SOURCE)
142int nanosleep(const struct timespec *__rqtp, struct timespec *__rmtp) __DARWIN_ALIAS_C(nanosleep);
143#endif
144
145#if !defined(_DARWIN_FEATURE_CLOCK_GETTIME) || _DARWIN_FEATURE_CLOCK_GETTIME != 0
146#if __DARWIN_C_LEVEL >= 199309L
147#if __has_feature(enumerator_attributes)
148#define __CLOCK_AVAILABILITY __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
149#else
150#define __CLOCK_AVAILABILITY
151#endif
152
153typedef enum {
154_CLOCK_REALTIME __CLOCK_AVAILABILITY = 0,
155#define CLOCK_REALTIME _CLOCK_REALTIME
156_CLOCK_MONOTONIC __CLOCK_AVAILABILITY = 6,
157#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
158#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
159_CLOCK_MONOTONIC_RAW __CLOCK_AVAILABILITY = 4,
160#define CLOCK_MONOTONIC_RAW _CLOCK_MONOTONIC_RAW
161_CLOCK_MONOTONIC_RAW_APPROX __CLOCK_AVAILABILITY = 5,
162#define CLOCK_MONOTONIC_RAW_APPROX _CLOCK_MONOTONIC_RAW_APPROX
163_CLOCK_UPTIME_RAW __CLOCK_AVAILABILITY = 8,
164#define CLOCK_UPTIME_RAW _CLOCK_UPTIME_RAW
165_CLOCK_UPTIME_RAW_APPROX __CLOCK_AVAILABILITY = 9,
166#define CLOCK_UPTIME_RAW_APPROX _CLOCK_UPTIME_RAW_APPROX
167#endif
168_CLOCK_PROCESS_CPUTIME_ID __CLOCK_AVAILABILITY = 12,
169#define CLOCK_PROCESS_CPUTIME_ID _CLOCK_PROCESS_CPUTIME_ID
170_CLOCK_THREAD_CPUTIME_ID __CLOCK_AVAILABILITY = 16
171#define CLOCK_THREAD_CPUTIME_ID _CLOCK_THREAD_CPUTIME_ID
172} clockid_t;
173
174__CLOCK_AVAILABILITY
175int clock_getres(clockid_t __clock_id, struct timespec *__res);
176
177__CLOCK_AVAILABILITY
178int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
179
180#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
181__CLOCK_AVAILABILITY
182__uint64_t clock_gettime_nsec_np(clockid_t __clock_id);
183#endif
184
185__OSX_AVAILABLE(10.12) __IOS_PROHIBITED
186__TVOS_PROHIBITED __WATCHOS_PROHIBITED
187int clock_settime(clockid_t __clock_id, const struct timespec *__tp);
188
189#undef __CLOCK_AVAILABILITY
190#endif /* __DARWIN_C_LEVEL */
191#endif /* _DARWIN_FEATURE_CLOCK_GETTIME */
192
193#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \
194 ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
195 (defined(__cplusplus) && __cplusplus >= 201703L))
196/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */
197#define TIME_UTC 1 /* time elapsed since epoch */
198__API_AVAILABLE(macosx(10.15), ios(13.0), tvos(13.0), watchos(6.0))
199int timespec_get(struct timespec *ts, int base);
200#endif
201
202__END_DECLS
203
204#ifdef _USE_EXTENDED_LOCALES_
205#include <xlocale/_time.h>
206#endif /* _USE_EXTENDED_LOCALES_ */
207
208#endif /* !_TIME_H_ */
\ No newline at end of file