macOS libc headers: downgrade to 10.15.7 (Catalina)

See ziglang/fetch-them-macos-headers#2 for more details. The path
forward looks like one of the following:

 * Ony provide headers for the oldest supported macOS (currently 10.13
   but soon to be bumped to 10.14).
 * Provide headers for multiple versions, and select based on the Zig
   target OS version range minimum.
 * Don't try to provide macOS headers.

If we don't tackle the version problem, we would have to re-introduce
the ability to detect and depend on native system headers if we wanted
to support C/C++ code that used newer OS definitions.

This patch also adds support for `#include <mach/mach_time.h>`.

Also related: #5236
master
Andrew Kelley 2020-11-17 11:32:12 -08:00
parent 21a77f7ac3
commit 2eee0582f8
136 changed files with 1166 additions and 2925 deletions

View File

@ -132,7 +132,130 @@
#define __API_TO_BE_DEPRECATED 100000
#endif
#include <AvailabilityVersions.h>
#ifndef __MAC_10_0
#define __MAC_10_0 1000
#define __MAC_10_1 1010
#define __MAC_10_2 1020
#define __MAC_10_3 1030
#define __MAC_10_4 1040
#define __MAC_10_5 1050
#define __MAC_10_6 1060
#define __MAC_10_7 1070
#define __MAC_10_8 1080
#define __MAC_10_9 1090
#define __MAC_10_10 101000
#define __MAC_10_10_2 101002
#define __MAC_10_10_3 101003
#define __MAC_10_11 101100
#define __MAC_10_11_2 101102
#define __MAC_10_11_3 101103
#define __MAC_10_11_4 101104
#define __MAC_10_12 101200
#define __MAC_10_12_1 101201
#define __MAC_10_12_2 101202
#define __MAC_10_12_4 101204
#define __MAC_10_13 101300
#define __MAC_10_13_1 101301
#define __MAC_10_13_2 101302
#define __MAC_10_13_4 101304
#define __MAC_10_14 101400
#define __MAC_10_14_1 101401
#define __MAC_10_14_4 101404
#define __MAC_10_15 101500
#define __MAC_10_15_1 101501
#define __MAC_10_15_4 101504
/* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
#define __IPHONE_2_0 20000
#define __IPHONE_2_1 20100
#define __IPHONE_2_2 20200
#define __IPHONE_3_0 30000
#define __IPHONE_3_1 30100
#define __IPHONE_3_2 30200
#define __IPHONE_4_0 40000
#define __IPHONE_4_1 40100
#define __IPHONE_4_2 40200
#define __IPHONE_4_3 40300
#define __IPHONE_5_0 50000
#define __IPHONE_5_1 50100
#define __IPHONE_6_0 60000
#define __IPHONE_6_1 60100
#define __IPHONE_7_0 70000
#define __IPHONE_7_1 70100
#define __IPHONE_8_0 80000
#define __IPHONE_8_1 80100
#define __IPHONE_8_2 80200
#define __IPHONE_8_3 80300
#define __IPHONE_8_4 80400
#define __IPHONE_9_0 90000
#define __IPHONE_9_1 90100
#define __IPHONE_9_2 90200
#define __IPHONE_9_3 90300
#define __IPHONE_10_0 100000
#define __IPHONE_10_1 100100
#define __IPHONE_10_2 100200
#define __IPHONE_10_3 100300
#define __IPHONE_11_0 110000
#define __IPHONE_11_1 110100
#define __IPHONE_11_2 110200
#define __IPHONE_11_3 110300
#define __IPHONE_11_4 110400
#define __IPHONE_12_0 120000
#define __IPHONE_12_1 120100
#define __IPHONE_12_2 120200
#define __IPHONE_12_3 120300
#define __IPHONE_13_0 130000
#define __IPHONE_13_1 130100
#define __IPHONE_13_2 130200
#define __IPHONE_13_3 130300
#define __IPHONE_13_4 130400
#define __IPHONE_13_5 130500
#define __IPHONE_13_6 130600
/* __IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
#define __TVOS_9_0 90000
#define __TVOS_9_1 90100
#define __TVOS_9_2 90200
#define __TVOS_10_0 100000
#define __TVOS_10_0_1 100001
#define __TVOS_10_1 100100
#define __TVOS_10_2 100200
#define __TVOS_11_0 110000
#define __TVOS_11_1 110100
#define __TVOS_11_2 110200
#define __TVOS_11_3 110300
#define __TVOS_11_4 110400
#define __TVOS_12_0 120000
#define __TVOS_12_1 120100
#define __TVOS_12_2 120200
#define __TVOS_12_3 120300
#define __TVOS_13_0 130000
#define __TVOS_13_2 130200
#define __TVOS_13_3 130300
#define __TVOS_13_4 130400
#define __WATCHOS_1_0 10000
#define __WATCHOS_2_0 20000
#define __WATCHOS_2_1 20100
#define __WATCHOS_2_2 20200
#define __WATCHOS_3_0 30000
#define __WATCHOS_3_1 30100
#define __WATCHOS_3_1_1 30101
#define __WATCHOS_3_2 30200
#define __WATCHOS_4_0 40000
#define __WATCHOS_4_1 40100
#define __WATCHOS_4_2 40200
#define __WATCHOS_4_3 40300
#define __WATCHOS_5_0 50000
#define __WATCHOS_5_1 50100
#define __WATCHOS_5_2 50200
#define __WATCHOS_6_0 60000
#define __WATCHOS_6_1 60100
#define __WATCHOS_6_2 60200
#define __DRIVERKIT_19_0 190000
#endif /* __MAC_10_0 */
#include <AvailabilityInternal.h>
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED

View File

@ -45,9 +45,6 @@
#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
/* compiler sets __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ when -miphoneos-version-min is used */
#define __IPHONE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
/* set to 1 when RC_FALLBACK_PLATFORM=iphoneos */
#elif 0
#define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_14_0
#endif
#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED */
@ -55,7 +52,7 @@
#ifdef __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
/* compiler sets __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ when -mtvos-version-min is used */
#define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_14_2
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_13_0
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
#endif
@ -65,7 +62,7 @@
#ifdef __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
/* compiler sets __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ when -mwatchos-version-min is used */
#define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
#define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_7_1
#define __WATCH_OS_VERSION_MAX_ALLOWED 60000
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
#endif
@ -75,7 +72,7 @@
#ifdef __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
#define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 50000
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 20000
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 110000
#endif
@ -90,14 +87,14 @@
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
/* make sure a default max version is set */
#ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_11_0
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_15
#endif
#endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
/* make sure a default max version is set */
#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_14_2
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_13_0
#endif
/* make sure a valid min is set */
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0
@ -2890,7 +2887,7 @@
#if __has_builtin(__is_target_environment)
#if __has_builtin(__is_target_variant_os)
#if __has_builtin(__is_target_variant_environment)
#if ((__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi))
#if (__is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi))
#define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION __attribute__((availability(ios,introduced=4.0)))
#define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION __attribute__((availability(ios,unavailable)))
#define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION_MSG(_msg) __attribute__((availability(ios,unavailable)))

View File

@ -117,9 +117,9 @@
#define MAC_OS_X_VERSION_10_14_1 101401
#define MAC_OS_X_VERSION_10_14_4 101404
#define MAC_OS_X_VERSION_10_15 101500
#define MAC_OS_VERSION_11_0 110000
#define MAC_OS_X_VERSION_10_15_1 101501
/*
/*
* If min OS not specified, assume 10.4 for intel
* Note: compiler driver may set _ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED_ based on MACOSX_DEPLOYMENT_TARGET environment variable
*/
@ -144,10 +144,10 @@
* if max OS not specified, assume larger of (10.15, min)
*/
#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_11_0
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_15
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
#else
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_11_0
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_15
#endif
#endif

View File

@ -1,208 +0,0 @@
/*
* Copyright (c) 2019 by Apple Inc.. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef __AVAILABILITY_VERSIONS__
#define __AVAILABILITY_VERSIONS__
#define __MAC_10_0 1000
#define __MAC_10_1 1010
#define __MAC_10_2 1020
#define __MAC_10_3 1030
#define __MAC_10_4 1040
#define __MAC_10_5 1050
#define __MAC_10_6 1060
#define __MAC_10_7 1070
#define __MAC_10_8 1080
#define __MAC_10_9 1090
#define __MAC_10_10 101000
#define __MAC_10_10_2 101002
#define __MAC_10_10_3 101003
#define __MAC_10_11 101100
#define __MAC_10_11_2 101102
#define __MAC_10_11_3 101103
#define __MAC_10_11_4 101104
#define __MAC_10_12 101200
#define __MAC_10_12_1 101201
#define __MAC_10_12_2 101202
#define __MAC_10_12_4 101204
#define __MAC_10_13 101300
#define __MAC_10_13_1 101301
#define __MAC_10_13_2 101302
#define __MAC_10_13_4 101304
#define __MAC_10_14 101400
#define __MAC_10_14_1 101401
#define __MAC_10_14_4 101404
#define __MAC_10_14_6 101406
#define __MAC_10_15 101500
#define __MAC_10_15_1 101501
#define __MAC_10_15_4 101504
#define __MAC_10_16 101600
#define __MAC_11_0 110000
/* __MAC_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
#define __IPHONE_2_0 20000
#define __IPHONE_2_1 20100
#define __IPHONE_2_2 20200
#define __IPHONE_3_0 30000
#define __IPHONE_3_1 30100
#define __IPHONE_3_2 30200
#define __IPHONE_4_0 40000
#define __IPHONE_4_1 40100
#define __IPHONE_4_2 40200
#define __IPHONE_4_3 40300
#define __IPHONE_5_0 50000
#define __IPHONE_5_1 50100
#define __IPHONE_6_0 60000
#define __IPHONE_6_1 60100
#define __IPHONE_7_0 70000
#define __IPHONE_7_1 70100
#define __IPHONE_8_0 80000
#define __IPHONE_8_1 80100
#define __IPHONE_8_2 80200
#define __IPHONE_8_3 80300
#define __IPHONE_8_4 80400
#define __IPHONE_9_0 90000
#define __IPHONE_9_1 90100
#define __IPHONE_9_2 90200
#define __IPHONE_9_3 90300
#define __IPHONE_10_0 100000
#define __IPHONE_10_1 100100
#define __IPHONE_10_2 100200
#define __IPHONE_10_3 100300
#define __IPHONE_11_0 110000
#define __IPHONE_11_1 110100
#define __IPHONE_11_2 110200
#define __IPHONE_11_3 110300
#define __IPHONE_11_4 110400
#define __IPHONE_12_0 120000
#define __IPHONE_12_1 120100
#define __IPHONE_12_2 120200
#define __IPHONE_12_3 120300
#define __IPHONE_12_4 120400
#define __IPHONE_13_0 130000
#define __IPHONE_13_1 130100
#define __IPHONE_13_2 130200
#define __IPHONE_13_3 130300
#define __IPHONE_13_4 130400
#define __IPHONE_13_5 130500
#define __IPHONE_13_6 130600
#define __IPHONE_13_7 130700
#define __IPHONE_14_0 140000
#define __IPHONE_14_1 140100
#define __IPHONE_14_2 140200
/* __IPHONE_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
#define __TVOS_9_0 90000
#define __TVOS_9_1 90100
#define __TVOS_9_2 90200
#define __TVOS_10_0 100000
#define __TVOS_10_0_1 100001
#define __TVOS_10_1 100100
#define __TVOS_10_2 100200
#define __TVOS_11_0 110000
#define __TVOS_11_1 110100
#define __TVOS_11_2 110200
#define __TVOS_11_3 110300
#define __TVOS_11_4 110400
#define __TVOS_12_0 120000
#define __TVOS_12_1 120100
#define __TVOS_12_2 120200
#define __TVOS_12_3 120300
#define __TVOS_12_4 120400
#define __TVOS_13_0 130000
#define __TVOS_13_2 130200
#define __TVOS_13_3 130300
#define __TVOS_13_4 130400
#define __TVOS_14_0 140000
#define __TVOS_14_1 140100
#define __TVOS_14_2 140200
#define __WATCHOS_1_0 10000
#define __WATCHOS_2_0 20000
#define __WATCHOS_2_1 20100
#define __WATCHOS_2_2 20200
#define __WATCHOS_3_0 30000
#define __WATCHOS_3_1 30100
#define __WATCHOS_3_1_1 30101
#define __WATCHOS_3_2 30200
#define __WATCHOS_4_0 40000
#define __WATCHOS_4_1 40100
#define __WATCHOS_4_2 40200
#define __WATCHOS_4_3 40300
#define __WATCHOS_5_0 50000
#define __WATCHOS_5_1 50100
#define __WATCHOS_5_2 50200
#define __WATCHOS_5_3 50300
#define __WATCHOS_6_0 60000
#define __WATCHOS_6_1 60100
#define __WATCHOS_6_2 60200
#define __WATCHOS_7_0 70000
#define __WATCHOS_7_1 70100
/*
* Set up standard Mac OS X versions
*/
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
#define MAC_OS_X_VERSION_10_0 1000
#define MAC_OS_X_VERSION_10_1 1010
#define MAC_OS_X_VERSION_10_2 1020
#define MAC_OS_X_VERSION_10_3 1030
#define MAC_OS_X_VERSION_10_4 1040
#define MAC_OS_X_VERSION_10_5 1050
#define MAC_OS_X_VERSION_10_6 1060
#define MAC_OS_X_VERSION_10_7 1070
#define MAC_OS_X_VERSION_10_8 1080
#define MAC_OS_X_VERSION_10_9 1090
#define MAC_OS_X_VERSION_10_10 101000
#define MAC_OS_X_VERSION_10_10_2 101002
#define MAC_OS_X_VERSION_10_10_3 101003
#define MAC_OS_X_VERSION_10_11 101100
#define MAC_OS_X_VERSION_10_11_2 101102
#define MAC_OS_X_VERSION_10_11_3 101103
#define MAC_OS_X_VERSION_10_11_4 101104
#define MAC_OS_X_VERSION_10_12 101200
#define MAC_OS_X_VERSION_10_12_1 101201
#define MAC_OS_X_VERSION_10_12_2 101202
#define MAC_OS_X_VERSION_10_12_4 101204
#define MAC_OS_X_VERSION_10_13 101300
#define MAC_OS_X_VERSION_10_13_1 101301
#define MAC_OS_X_VERSION_10_13_2 101302
#define MAC_OS_X_VERSION_10_13_4 101304
#define MAC_OS_X_VERSION_10_14 101400
#define MAC_OS_X_VERSION_10_14_1 101401
#define MAC_OS_X_VERSION_10_14_4 101404
#define MAC_OS_X_VERSION_10_14_6 101406
#define MAC_OS_X_VERSION_10_15 101500
#define MAC_OS_X_VERSION_10_15_1 101501
#define MAC_OS_X_VERSION_10_16 101600
#define MAC_OS_VERSION_11_0 110000
#endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */
#define __DRIVERKIT_19_0 190000
#define __DRIVERKIT_20_0 200000
#endif /* __AVAILABILITY_VERSIONS__ */

View File

@ -35,72 +35,71 @@
#ifndef __TARGETCONDITIONALS__
#define __TARGETCONDITIONALS__
/*
*
* TARGET_CPU_*
* These conditionals specify which microprocessor instruction set is being
* generated. At most one of these is true, the rest are false.
*
* TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode
* TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode
* TARGET_CPU_68K - Compiler is generating 680x0 instructions
* TARGET_CPU_X86 - Compiler is generating x86 instructions for 32-bit mode
* TARGET_CPU_X86_64 - Compiler is generating x86 instructions for 64-bit mode
* TARGET_CPU_ARM - Compiler is generating ARM instructions for 32-bit mode
* TARGET_CPU_ARM64 - Compiler is generating ARM instructions for 64-bit mode
* TARGET_CPU_MIPS - Compiler is generating MIPS instructions
* TARGET_CPU_SPARC - Compiler is generating Sparc instructions
* TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
*
*
* TARGET_OS_*
* These conditionals specify in which Operating System the generated code will
* run. Indention is used to show which conditionals are evolutionary subclasses.
*
* The MAC/WIN32/UNIX conditionals are mutually exclusive.
* The IOS/TV/WATCH conditionals are mutually exclusive.
*
*
* TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
* TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
* TARGET_OS_MAC - Generated code will run under Mac OS X variant
* TARGET_OS_OSX - Generated code will run under OS X devices
* TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
* TARGET_OS_IOS - Generated code will run under iOS
* TARGET_OS_TV - Generated code will run under Apple TV OS
* TARGET_OS_WATCH - Generated code will run under Apple Watch OS
* TARGET_OS_BRIDGE - Generated code will run under Bridge devices
* TARGET_OS_MACCATALYST - Generated code will run under macOS
* TARGET_OS_SIMULATOR - Generated code will run under a simulator
*
* TARGET_OS_EMBEDDED - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead
* TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR
* TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH
*
* +---------------------------------------------------------------------+
* | TARGET_OS_MAC |
* | +---+ +-----------------------------------------------+ +---------+ |
* | | | | TARGET_OS_IPHONE | | | |
* | | | | +---------------+ +----+ +-------+ +--------+ | | | |
* | | | | | IOS | | | | | | | | | | |
* | |OSX| | |+-------------+| | TV | | WATCH | | BRIDGE | | |DRIVERKIT| |
* | | | | || MACCATALYST || | | | | | | | | | |
* | | | | |+-------------+| | | | | | | | | | |
* | | | | +---------------+ +----+ +-------+ +--------+ | | | |
* | +---+ +-----------------------------------------------+ +---------+ |
* +---------------------------------------------------------------------+
*
* TARGET_RT_*
* These conditionals specify in which runtime the generated code will
* run. This is needed when the OS and CPU support more than one runtime
* (e.g. Mac OS X supports CFM and mach-o).
*
* TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
* TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers
* TARGET_RT_64_BIT - Generated code uses 64-bit pointers
* TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
* TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
*/
/****************************************************************************************************
TARGET_CPU_*
These conditionals specify which microprocessor instruction set is being
generated. At most one of these is true, the rest are false.
TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode
TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode
TARGET_CPU_68K - Compiler is generating 680x0 instructions
TARGET_CPU_X86 - Compiler is generating x86 instructions for 32-bit mode
TARGET_CPU_X86_64 - Compiler is generating x86 instructions for 64-bit mode
TARGET_CPU_ARM - Compiler is generating ARM instructions for 32-bit mode
TARGET_CPU_ARM64 - Compiler is generating ARM instructions for 64-bit mode
TARGET_CPU_MIPS - Compiler is generating MIPS instructions
TARGET_CPU_SPARC - Compiler is generating Sparc instructions
TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
TARGET_OS_*
These conditionals specify in which Operating System the generated code will
run. Indention is used to show which conditionals are evolutionary subclasses.
The MAC/WIN32/UNIX conditionals are mutually exclusive.
The IOS/TV/WATCH conditionals are mutually exclusive.
TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
TARGET_OS_MAC - Generated code will run under Mac OS X variant
TARGET_OS_OSX - Generated code will run under OS X devices
TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
TARGET_OS_IOS - Generated code will run under iOS
TARGET_OS_TV - Generated code will run under Apple TV OS
TARGET_OS_WATCH - Generated code will run under Apple Watch OS
TARGET_OS_BRIDGE - Generated code will run under Bridge devices
TARGET_OS_MACCATALYST - Generated code will run under macOS
TARGET_OS_SIMULATOR - Generated code will run under a simulator
TARGET_OS_EMBEDDED - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead
TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR
TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH
+----------------------------------------------------------------+
| TARGET_OS_MAC |
| +---+ +-----------------------------------------------------+ |
| | | | TARGET_OS_IPHONE | |
| |OSX| | +-----+ +----+ +-------+ +--------+ +-------------+ | |
| | | | | IOS | | TV | | WATCH | | BRIDGE | | MACCATALYST | | |
| | | | +-----+ +----+ +-------+ +--------+ +-------------+ | |
| +---+ +-----------------------------------------------------+ |
+----------------------------------------------------------------+
TARGET_RT_*
These conditionals specify in which runtime the generated code will
run. This is needed when the OS and CPU support more than one runtime
(e.g. Mac OS X supports CFM and mach-o).
TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers
TARGET_RT_64_BIT - Generated code uses 64-bit pointers
TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
****************************************************************************************************/
/*
* TARGET_OS conditionals can be enabled via clang preprocessor extensions:
@ -134,9 +133,7 @@
#if __has_builtin(__is_target_environment)
/* “-target=x86_64-apple-ios12-macabi” */
/* “-target=arm64-apple-ios12-macabi” */
/* “-target=arm64e-apple-ios12-macabi” */
#if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)
#if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)
#define TARGET_OS_OSX 0
#define TARGET_OS_IPHONE 1
#define TARGET_OS_IOS 1
@ -176,9 +173,7 @@
#endif
/* -target=x86_64-apple-driverkit19.0 */
/* -target=arm64-apple-driverkit19.0 */
/* -target=arm64e-apple-driverkit19.0 */
#if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(driverkit)
#if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(driverkit)
#define TARGET_OS_OSX 0
#define TARGET_OS_IPHONE 0
#define TARGET_OS_IOS 0
@ -236,8 +231,7 @@
#define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */
#define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */
#define TARGET_ABI_USES_IOS_VALUES (!TARGET_CPU_X86_64 || (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST))
#define TARGET_ABI_USES_IOS_VALUES (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST)
#if defined(__ppc__)
#define TARGET_CPU_PPC 1
#define TARGET_CPU_PPC64 0

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012, 2020 Apple Inc. All rights reserved.
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@ -23,13 +23,5 @@
#ifndef _CTERMID_H_
#define _CTERMID_H_
#include <sys/cdefs.h>
__BEGIN_DECLS
char *ctermid(char *);
__END_DECLS
#endif

View File

@ -332,24 +332,13 @@ struct au_evclass_map {
};
typedef struct au_evclass_map au_evclass_map_t;
#if !defined(_KERNEL) && !defined(KERNEL)
#include <Availability.h>
#define __AUDIT_API_DEPRECATED __API_DEPRECATED("audit is deprecated", macos(10.4, 11.0))
#else
#define __AUDIT_API_DEPRECATED
#endif
/*
* Audit system calls.
*/
#if !defined(_KERNEL) && !defined(KERNEL)
int audit(const void *, int)
__AUDIT_API_DEPRECATED;
int auditon(int, void *, int)
__AUDIT_API_DEPRECATED;
int auditctl(const char *)
__AUDIT_API_DEPRECATED;
int audit(const void *, int);
int auditon(int, void *, int);
int auditctl(const char *);
int getauid(au_id_t *);
int setauid(const au_id_t *);
int getaudit_addr(struct auditinfo_addr *, int);
@ -371,10 +360,8 @@ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
__IPHONE_2_0, __IPHONE_6_0);
#else
int getaudit(struct auditinfo *)
__AUDIT_API_DEPRECATED;
int setaudit(const struct auditinfo *)
__AUDIT_API_DEPRECATED;
int getaudit(struct auditinfo *);
int setaudit(const struct auditinfo *);
#endif /* !__APPLE__ */
#ifdef __APPLE_API_PRIVATE

View File

@ -323,7 +323,7 @@ dispatch_block_perform(dispatch_block_flags_t flags,
*/
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
intptr_t
long
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
/*!
@ -416,7 +416,7 @@ dispatch_block_cancel(dispatch_block_t block);
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
intptr_t
long
dispatch_block_testcancel(dispatch_block_t block);
__END_DECLS

View File

@ -37,14 +37,10 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <string.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <fcntl.h>
#if defined(_WIN32)
#include <time.h>
#endif
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__has_feature)
#if __has_feature(modules)
@ -61,7 +57,6 @@
#endif
#include <os/object.h>
#include <os/workgroup.h>
#include <dispatch/base.h>
#include <dispatch/time.h>
#include <dispatch/object.h>

View File

@ -160,7 +160,7 @@ dispatch_group_async_f(dispatch_group_t group,
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
intptr_t
long
dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);
/*!

View File

@ -456,7 +456,7 @@ dispatch_set_qos_class_floor(dispatch_object_t object,
*/
DISPATCH_UNAVAILABLE
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
intptr_t
long
dispatch_wait(void *object, dispatch_time_t timeout);
#if __has_extension(c_generic_selections)
#define dispatch_wait(object, timeout) \
@ -554,7 +554,7 @@ dispatch_cancel(void *object);
DISPATCH_UNAVAILABLE
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
intptr_t
long
dispatch_testcancel(void *object);
#if __has_extension(c_generic_selections)
#define dispatch_testcancel(object) \

View File

@ -661,7 +661,7 @@ typedef long dispatch_queue_priority_t;
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_queue_global_t
dispatch_get_global_queue(intptr_t identifier, uintptr_t flags);
dispatch_get_global_queue(long identifier, unsigned long flags);
/*!
* @typedef dispatch_queue_attr_t

View File

@ -61,7 +61,7 @@ API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
DISPATCH_NOTHROW
dispatch_semaphore_t
dispatch_semaphore_create(intptr_t value);
dispatch_semaphore_create(long value);
/*!
* @function dispatch_semaphore_wait
@ -85,7 +85,7 @@ dispatch_semaphore_create(intptr_t value);
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
intptr_t
long
dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
/*!
@ -107,7 +107,7 @@ dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
intptr_t
long
dispatch_semaphore_signal(dispatch_semaphore_t dsema);
__END_DECLS

View File

@ -389,7 +389,7 @@ DISPATCH_NOTHROW
dispatch_source_t
dispatch_source_create(dispatch_source_type_t type,
uintptr_t handle,
uintptr_t mask,
unsigned long mask,
dispatch_queue_t _Nullable queue);
/*!
@ -537,7 +537,7 @@ dispatch_source_cancel(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
intptr_t
long
dispatch_source_testcancel(dispatch_source_t source);
/*!
@ -601,7 +601,7 @@ dispatch_source_get_handle(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
uintptr_t
unsigned long
dispatch_source_get_mask(dispatch_source_t source);
/*!
@ -640,7 +640,7 @@ dispatch_source_get_mask(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
uintptr_t
unsigned long
dispatch_source_get_data(dispatch_source_t source);
/*!
@ -662,7 +662,7 @@ dispatch_source_get_data(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_source_merge_data(dispatch_source_t source, uintptr_t value);
dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
/*!
* @function dispatch_source_set_timer

View File

@ -129,33 +129,6 @@ void
dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop,
dispatch_autorelease_frequency_t frequency);
/*!
* @function dispatch_workloop_set_os_workgroup
*
* @abstract
* Associates an os_workgroup_t with the specified dispatch workloop.
*
* The worker thread will be a member of the specified os_workgroup_t while executing
* work items submitted to the workloop.
*
* @param workloop
* The dispatch workloop to modify.
*
* This workloop must be inactive, passing an activated object is undefined
* and will cause the process to be terminated.
*
* @param workgroup
* The workgroup to associate with this workloop.
*
* The workgroup specified is retained and the previously associated workgroup
* (if any) is released.
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_workloop_set_os_workgroup(dispatch_workloop_t workloop,
os_workgroup_t workgroup);
__END_DECLS
DISPATCH_ASSUME_NONNULL_END

View File

@ -37,10 +37,10 @@
* cast to any desired pointer type.
*/
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
#endif /* _I386__PARAM_H_ */

View File

@ -1,47 +0,0 @@
/*
* Copyright (c) 2020 Apple Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _DER_ITEM_H_
#define _DER_ITEM_H_
#if __has_include(<security_libDER/libDER/libDER_config.h>)
#include <security_libDER/libDER/libDER_config.h>
#else
#include <libDER/libDER_config.h>
#endif
__BEGIN_DECLS
/*
* Primary representation of a block of memory.
*/
typedef struct {
DERByte *data;
DERSize length;
} DERItem;
__END_DECLS
#endif /* _DER_ITEM_H_ */

View File

@ -1,121 +0,0 @@
/*
* Copyright (c) 2005-2007,2011-2012,2014 Apple Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* libDER_config.h - platform dependent #defines and typedefs for libDER
*
*/
#ifndef _LIB_DER_CONFIG_H_
#define _LIB_DER_CONFIG_H_
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#if defined(WIN32) && defined(__cplusplus)
#if !defined(__BEGIN_DECLS) || !defined(__END_DECLS)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#endif // __BEGIN_DECLS || __END_DECLS
#else
#include <sys/cdefs.h>
#endif // defined(WIN32) && defined(__cplusplus)
__BEGIN_DECLS
/*
* Basic data types: unsigned 8-bit integer, unsigned 32-bit integer
*/
typedef uint8_t DERByte;
typedef uint16_t DERShort;
typedef size_t DERSize;
/*
* Use these #defines of you have memset, memmove, and memcmp; else
* write your own equivalents.
*/
#define DERMemset(ptr, c, len) memset(ptr, c, len)
#define DERMemmove(dst, src, len) memmove(dst, src, len)
#define DERMemcmp(b1, b2, len) memcmp(b1, b2, len)
/***
*** Compile time options to trim size of the library.
***/
/* enable general DER encode */
#define DER_ENCODE_ENABLE 1
/* enable general DER decode */
#define DER_DECODE_ENABLE 1
#ifndef DER_MULTIBYTE_TAGS
/* enable multibyte tag support. */
#define DER_MULTIBYTE_TAGS 1
#endif
#ifndef DER_TAG_SIZE
/* Iff DER_MULTIBYTE_TAGS is 1 this is the sizeof(DERTag) in bytes. Note that
tags are still encoded and decoded from a minimally encoded DER
represantation. This value maintains compatibility with libImg4Decode/Encode. */
#define DER_TAG_SIZE 8
#endif
/* ---------------------- Do not edit below this line ---------------------- */
/*
* Logical representation of a tag (the encoded representation is always in
* the minimal number of bytes). The top 3 bits encode class and method
* The remaining bits encode the tag value. To obtain smaller DERItemSpecs
* sizes, choose the smallest type that fits your needs. Most standard ASN.1
* usage only needs single byte tags, but ocasionally custom applications
* require a larger tag namespace.
*/
#if DER_MULTIBYTE_TAGS
#if DER_TAG_SIZE == 1
typedef uint8_t DERTag;
#elif DER_TAG_SIZE == 2
typedef uint16_t DERTag;
#elif DER_TAG_SIZE == 4
typedef uint32_t DERTag;
#elif DER_TAG_SIZE == 8
typedef uint64_t DERTag;
#else
#error DER_TAG_SIZE invalid
#endif
#else /* DER_MULTIBYTE_TAGS */
typedef DERByte DERTag;
#endif /* !DER_MULTIBYTE_TAGS */
__END_DECLS
#endif /* _LIB_DER_CONFIG_H_ */

View File

@ -35,14 +35,13 @@
* is preferred.
*/
#include <Availability.h>
#if !(defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED)
#include <sys/cdefs.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <Availability.h>
#ifndef OSATOMIC_DEPRECATED
#define OSATOMIC_DEPRECATED 1
@ -162,7 +161,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
int32_t OSAtomicAdd32Barrier( int32_t __theAmount, volatile int32_t *__theValue );
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1
/*! @abstract Atomically increments a 32-bit value.
@result Returns the new value.
@ -249,7 +248,7 @@ int64_t OSAtomicAdd64Barrier( int64_t __theAmount,
volatile OSAtomic_int64_aligned64_t *__theValue );
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1
/*! @abstract Atomically increments a 64-bit value.
@result Returns the new value.
@ -362,7 +361,7 @@ int32_t OSAtomicOr32Orig( uint32_t __theMask, volatile uint32_t *__theValue );
This function performs the bitwise OR of the value given by <code>__theMask</code>
with the value in the memory location referenced by <code>__theValue</code>,
storing the result back to that memory location atomically.
This function is equivalent to {@link OSAtomicOr32Orig}
except that it also introduces a barrier.
@result Returns the original value referenced by <code>__theValue</code>.
@ -482,7 +481,7 @@ int32_t OSAtomicXor32Orig( uint32_t __theMask, volatile uint32_t *__theValue );
OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor)
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2)
int32_t OSAtomicXor32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue );
/*! @group Compare and swap
* Functions in this group return true if the swap occured. There are several versions,
@ -588,7 +587,7 @@ bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile
match, this function stores the value from <code>__newValue</code> into
that memory location atomically.
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
or {@link OSAtomicCompareAndSwap64} on 64-bit architectures.
@result Returns TRUE on a match, FALSE otherwise.
*/
@ -607,7 +606,7 @@ bool OSAtomicCompareAndSwapLong( long __oldValue, long __newValue, volatile long
This function is equivalent to {@link OSAtomicCompareAndSwapLong}
except that it also introduces a barrier.
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
or {@link OSAtomicCompareAndSwap64} on 64-bit architectures.
@result Returns TRUE on a match, FALSE otherwise.
*/
@ -707,7 +706,7 @@ bool OSAtomicTestAndSetBarrier( uint32_t __n, volatile void *__theAddress );
For example, if <code>__theAddress</code> points to a 64-bit value,
to compare the value of the most significant bit, you would specify
<code>56</code> for <code>__n</code>.
@result
Returns the original value of the bit being tested.
*/
@ -720,15 +719,15 @@ bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress );
@discussion
This function tests a bit in the value referenced by <code>__theAddress</code>
and if it is not cleared, clears it.
The bit is chosen by the value of <code>__n</code> such that the
operation will be performed on bit <code>(0x80 >> (__n & 7))</code>
of byte <code>((char *)__theAddress + (n >> 3))</code>.
For example, if <code>__theAddress</code> points to a 64-bit value,
to compare the value of the most significant bit, you would specify
<code>56</code> for <code>__n</code>.
This function is equivalent to {@link OSAtomicTestAndSet}
except that it also introduces a barrier.
@result
@ -737,7 +736,7 @@ bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress );
OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and)
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
bool OSAtomicTestAndClearBarrier( uint32_t __n, volatile void *__theAddress );
/*! @group Memory barriers */
@ -1175,92 +1174,4 @@ __END_DECLS
#endif // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED
#if TARGET_OS_OSX || TARGET_OS_DRIVERKIT
__BEGIN_DECLS
/*! @group Lockless atomic fifo enqueue and dequeue
* These routines manipulate singly-linked FIFO lists.
*
* This API is deprecated and no longer recommended
*/
/*! @abstract The data structure for a fifo queue head.
@discussion
You should always initialize a fifo queue head structure with the
initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use.
*/
#if defined(__LP64__)
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} __attribute__ ((aligned (16))) OSFifoQueueHead;
#else
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} OSFifoQueueHead;
#endif
/*! @abstract The initialization vector for a fifo queue head. */
#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, NULL, 0 }
/*! @abstract Enqueue an element onto a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list on which you want to enqueue the element.
@param __new
The element to add.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being queued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
@note
This API is deprecated and no longer recommended
*/
__API_DEPRECATED("No longer supported", macos(10.7, 11.0))
void OSAtomicFifoEnqueue( OSFifoQueueHead *__list, void *__new, size_t __offset);
/*! @abstract Dequeue an element from a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list from which you want to dequeue an element.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being dequeued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
@result
Returns the oldest enqueued element, or <code>NULL</code> if the
list is empty.
@note
This API is deprecated and no longer recommended
*/
__API_DEPRECATED("No longer supported", macos(10.7, 11.0))
void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset);
__END_DECLS
#endif /* TARGET_OS_OSX || TARGET_OS_DRIVERKIT */
#endif /* _OSATOMIC_DEPRECATED_H_ */

View File

@ -28,7 +28,6 @@
#include <sys/cdefs.h>
#include <stdint.h>
#include <stdbool.h>
#include "OSAtomicDeprecated.h"
#include <Availability.h>
@ -110,6 +109,83 @@ void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset);
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset);
#if defined(__x86_64__) || defined(__i386__)
/*! @group Lockless atomic fifo enqueue and dequeue
* These routines manipulate singly-linked FIFO lists.
*/
/*! @abstract The data structure for a fifo queue head.
@discussion
You should always initialize a fifo queue head structure with the
initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use.
*/
#if defined(__x86_64__)
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} __attribute__ ((aligned (16))) OSFifoQueueHead;
#else
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} OSFifoQueueHead;
#endif
/*! @abstract The initialization vector for a fifo queue head. */
#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, NULL, 0 }
/*! @abstract Enqueue an element onto a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list on which you want to enqueue the element.
@param __new
The element to add.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being queued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA)
void OSAtomicFifoEnqueue( OSFifoQueueHead *__list, void *__new, size_t __offset);
/*! @abstract Dequeue an element from a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list from which you want to dequeue an element.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being dequeued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
@result
Returns the oldest enqueued element, or <code>NULL</code> if the
list is empty.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA)
void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset);
#endif /* __i386__ || __x86_64__ */
__END_DECLS
#endif /* _OSATOMICQUEUE_H_ */

View File

@ -37,22 +37,10 @@
#define OSSwapConstInt32(x) __DARWIN_OSSwapConstInt32(x)
#define OSSwapConstInt64(x) __DARWIN_OSSwapConstInt64(x)
#if !defined(__DARWIN_OS_INLINE)
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define __DARWIN_OS_INLINE static inline
# elif defined(__MWERKS__) || defined(__cplusplus)
# define __DARWIN_OS_INLINE static inline
# else
# define __DARWIN_OS_INLINE static __inline__
# endif
#endif
#if defined(__GNUC__)
#if (defined(__i386__) || defined(__x86_64__))
#include <libkern/i386/OSByteOrder.h>
#elif defined (__arm__) || defined(__arm64__)
#include <libkern/arm/OSByteOrder.h>
#else
#include <libkern/machine/OSByteOrder.h>
#endif
@ -73,7 +61,7 @@ enum {
OSBigEndian
};
__DARWIN_OS_INLINE
OS_INLINE
int32_t
OSHostByteOrder(void)
{
@ -97,7 +85,7 @@ OSHostByteOrder(void)
/* Functions for loading native endian values. */
__DARWIN_OS_INLINE
OS_INLINE
uint16_t
_OSReadInt16(
const volatile void * base,
@ -107,7 +95,7 @@ _OSReadInt16(
return *(volatile uint16_t *)((uintptr_t)base + byteOffset);
}
__DARWIN_OS_INLINE
OS_INLINE
uint32_t
_OSReadInt32(
const volatile void * base,
@ -117,7 +105,7 @@ _OSReadInt32(
return *(volatile uint32_t *)((uintptr_t)base + byteOffset);
}
__DARWIN_OS_INLINE
OS_INLINE
uint64_t
_OSReadInt64(
const volatile void * base,
@ -129,7 +117,7 @@ _OSReadInt64(
/* Functions for storing native endian values. */
__DARWIN_OS_INLINE
OS_INLINE
void
_OSWriteInt16(
volatile void * base,
@ -140,7 +128,7 @@ _OSWriteInt16(
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = data;
}
__DARWIN_OS_INLINE
OS_INLINE
void
_OSWriteInt32(
volatile void * base,
@ -151,7 +139,7 @@ _OSWriteInt32(
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = data;
}
__DARWIN_OS_INLINE
OS_INLINE
void
_OSWriteInt64(
volatile void * base,

View File

@ -41,14 +41,14 @@
/* Macros for swapping constant values in the preprocessing stage. */
#define __DARWIN_OSSwapConstInt16(x) \
((__uint16_t)((((__uint16_t)(x) & 0xff00U) >> 8) | \
(((__uint16_t)(x) & 0x00ffU) << 8)))
((__uint16_t)((((__uint16_t)(x) & 0xff00) >> 8) | \
(((__uint16_t)(x) & 0x00ff) << 8)))
#define __DARWIN_OSSwapConstInt32(x) \
((__uint32_t)((((__uint32_t)(x) & 0xff000000U) >> 24) | \
(((__uint32_t)(x) & 0x00ff0000U) >> 8) | \
(((__uint32_t)(x) & 0x0000ff00U) << 8) | \
(((__uint32_t)(x) & 0x000000ffU) << 24)))
((__uint32_t)((((__uint32_t)(x) & 0xff000000) >> 24) | \
(((__uint32_t)(x) & 0x00ff0000) >> 8) | \
(((__uint32_t)(x) & 0x0000ff00) << 8) | \
(((__uint32_t)(x) & 0x000000ff) << 24)))
#define __DARWIN_OSSwapConstInt64(x) \
((__uint64_t)((((__uint64_t)(x) & 0xff00000000000000ULL) >> 56) | \
@ -62,23 +62,10 @@
#if defined(__GNUC__)
#if !defined(__DARWIN_OS_INLINE)
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define __DARWIN_OS_INLINE static inline
# elif defined(__MWERKS__) || defined(__cplusplus)
# define __DARWIN_OS_INLINE static inline
# else
# define __DARWIN_OS_INLINE static __inline__
# endif
#endif
#if defined(__i386__) || defined(__x86_64__)
#include <libkern/i386/_OSByteOrder.h>
#endif
#if defined (__arm__) || defined(__arm64__)
#include <libkern/arm/OSByteOrder.h>
#endif
#define __DARWIN_OSSwapInt16(x) \
@ -94,6 +81,16 @@
#if defined(__i386__) || defined(__x86_64__)
#if !defined(__DARWIN_OS_INLINE)
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define __DARWIN_OS_INLINE static inline
# elif defined(__MWERKS__) || defined(__cplusplus)
# define __DARWIN_OS_INLINE static inline
# else
# define __DARWIN_OS_INLINE static __inline__
# endif
#endif
__DARWIN_OS_INLINE
uint16_t
_OSSwapInt16(

View File

@ -112,15 +112,6 @@ extern void _tlv_atexit(void (*termFunc)(void* objAddr), void* objAddr) __O
*/
extern void _tlv_bootstrap(void) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) DYLD_DRIVERKIT_UNAVAILABLE ;
/*
* Dylibs that are incorporated into the dyld cache are removed from disk. That means code
* cannot stat() the file to see if it "exists". This function is like a stat() call that checks if a
* path is to a dylib that was removed from disk and is incorporated into the active dyld cache.
*/
extern bool _dyld_shared_cache_contains_path(const char* path) __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) DYLD_DRIVERKIT_UNAVAILABLE;
/*
* The following dyld API's are deprecated as of Mac OS X 10.5. They are either
* no longer necessary or are superceeded by dlopen and friends in <dlfcn.h>.

View File

@ -115,14 +115,11 @@ struct mach_header_64 {
#define MH_DYLIB 0x6 /* dynamically bound shared library */
#define MH_DYLINKER 0x7 /* dynamic link editor */
#define MH_BUNDLE 0x8 /* dynamically bound bundle file */
#define MH_DYLIB_STUB 0x9 /* shared library stub for static
linking only, no section contents */
#define MH_DSYM 0xa /* companion file with only debug
sections */
#define MH_DYLIB_STUB 0x9 /* shared library stub for static */
/* linking only, no section contents */
#define MH_DSYM 0xa /* companion file with only debug */
/* sections */
#define MH_KEXT_BUNDLE 0xb /* x86_64 kexts */
#define MH_FILESET 0xc /* a file composed of other Mach-Os to
be run in the same userspace sharing
a single linkedit. */
/* Constants for the flags field of the mach_header */
#define MH_NOUNDEFS 0x1 /* the object file has no undefined
@ -325,7 +322,6 @@ struct load_command {
#define LC_BUILD_VERSION 0x32 /* build for platform min OS version */
#define LC_DYLD_EXPORTS_TRIE (0x33 | LC_REQ_DYLD) /* used with linkedit_data_command, payload is trie */
#define LC_DYLD_CHAINED_FIXUPS (0x34 | LC_REQ_DYLD) /* used with linkedit_data_command */
#define LC_FILESET_ENTRY (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */
/*
* A variable length string in a load command is represented by an lc_str
@ -1269,6 +1265,9 @@ struct build_tool_version {
#define PLATFORM_WATCHOS 4
#define PLATFORM_BRIDGEOS 5
#define PLATFORM_MACCATALYST 6
#if (!defined(PLATFORM_MACCATALYST))
#define PLATFORM_MACCATALYST 6
#endif
#define PLATFORM_IOSSIMULATOR 7
#define PLATFORM_TVOSSIMULATOR 8
#define PLATFORM_WATCHOSSIMULATOR 9
@ -1575,27 +1574,4 @@ struct note_command {
uint64_t size; /* length of data region */
};
/*
* LC_FILESET_ENTRY commands describe constituent Mach-O files that are part
* of a fileset. In one implementation, entries are dylibs with individual
* mach headers and repositionable text and data segments. Each entry is
* further described by its own mach header.
*/
struct fileset_entry_command {
uint32_t cmd; /* LC_FILESET_ENTRY */
uint32_t cmdsize; /* includes entry_id string */
uint64_t vmaddr; /* memory address of the entry */
uint64_t fileoff; /* file offset of the entry */
union lc_str entry_id; /* contained entry id */
uint32_t reserved; /* reserved */
};
/*
* These deprecated values may still be used within Apple but are mechanically
* removed from public API. The mechanical process may produce unusual results.
*/
#if (!defined(PLATFORM_MACCATALYST))
#define PLATFORM_MACCATALYST PLATFORM_MACCATALYST
#endif
#endif /* _MACHO_LOADER_H_ */

View File

@ -603,48 +603,7 @@ _STRUCT_X86_DEBUG_STATE32
unsigned int __dr6;
unsigned int __dr7;
};
#define _STRUCT_X86_INSTRUCTION_STATE struct __x86_instruction_state
_STRUCT_X86_INSTRUCTION_STATE
{
int __insn_stream_valid_bytes;
int __insn_offset;
int __out_of_synch; /*
* non-zero when the cacheline that includes the insn_offset
* is replaced in the insn_bytes array due to a mismatch
* detected when comparing it with the same cacheline in memory
*/
#define _X86_INSTRUCTION_STATE_MAX_INSN_BYTES (2448 - 64 - 4)
__uint8_t __insn_bytes[_X86_INSTRUCTION_STATE_MAX_INSN_BYTES];
#define _X86_INSTRUCTION_STATE_CACHELINE_SIZE 64
__uint8_t __insn_cacheline[_X86_INSTRUCTION_STATE_CACHELINE_SIZE];
};
#define _STRUCT_LAST_BRANCH_RECORD struct __last_branch_record
_STRUCT_LAST_BRANCH_RECORD
{
__uint64_t __from_ip;
__uint64_t __to_ip;
__uint32_t __mispredict : 1,
__tsx_abort : 1,
__in_tsx : 1,
__cycle_count: 16,
__reserved : 13;
};
#define _STRUCT_LAST_BRANCH_STATE struct __last_branch_state
_STRUCT_LAST_BRANCH_STATE
{
int __lbr_count;
__uint32_t __lbr_supported_tsx : 1,
__lbr_supported_cycle_count : 1,
__reserved : 30;
#define __LASTBRANCH_MAX 32
_STRUCT_LAST_BRANCH_RECORD __lbrs[__LASTBRANCH_MAX];
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_X86_DEBUG_STATE32 struct x86_debug_state32
_STRUCT_X86_DEBUG_STATE32
{
@ -657,45 +616,6 @@ _STRUCT_X86_DEBUG_STATE32
unsigned int dr6;
unsigned int dr7;
};
#define _STRUCT_X86_INSTRUCTION_STATE struct __x86_instruction_state
_STRUCT_X86_INSTRUCTION_STATE
{
int insn_stream_valid_bytes;
int insn_offset;
int out_of_synch; /*
* non-zero when the cacheline that includes the insn_offset
* is replaced in the insn_bytes array due to a mismatch
* detected when comparing it with the same cacheline in memory
*/
#define x86_INSTRUCTION_STATE_MAX_INSN_BYTES (2448 - 64 - 4)
__uint8_t insn_bytes[x86_INSTRUCTION_STATE_MAX_INSN_BYTES];
#define x86_INSTRUCTION_STATE_CACHELINE_SIZE 64
__uint8_t insn_cacheline[x86_INSTRUCTION_STATE_CACHELINE_SIZE];
};
#define _STRUCT_LAST_BRANCH_RECORD struct __last_branch_record
_STRUCT_LAST_BRANCH_RECORD
{
__uint64_t from_ip;
__uint64_t to_ip;
__uint32_t mispredict : 1,
tsx_abort : 1,
in_tsx : 1,
cycle_count: 16,
reserved : 13;
};
#define _STRUCT_LAST_BRANCH_STATE struct __last_branch_state
_STRUCT_LAST_BRANCH_STATE
{
int lbr_count;
__uint32_t lbr_supported_tsx : 1,
lbr_supported_cycle_count : 1,
reserved : 30;
#define __LASTBRANCH_MAX 32
_STRUCT_LAST_BRANCH_RECORD lbrs[__LASTBRANCH_MAX];
};
#endif /* !__DARWIN_UNIX03 */
#define _STRUCT_X86_PAGEIN_STATE struct __x86_pagein_state

View File

@ -32,7 +32,7 @@
#ifndef _MACH_I386_THREAD_STATE_H_
#define _MACH_I386_THREAD_STATE_H_
/* Size of maximum exported thread state in 32-bit words */
/* Size of maximum exported thread state in words */
#define I386_THREAD_STATE_MAX (614) /* Size of biggest state possible */
#if defined (__i386__) || defined(__x86_64__)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2020 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -121,8 +121,6 @@
#define x86_AVX512_STATE (x86_AVX512_STATE32 + 2)
#define x86_PAGEIN_STATE 22
#define x86_THREAD_FULL_STATE64 23
#define x86_INSTRUCTION_STATE 24
#define x86_LAST_BRANCH_STATE 25
/*
* Largest state on this machine:
@ -157,8 +155,6 @@
(x == x86_AVX512_STATE64) || \
(x == x86_AVX512_STATE) || \
(x == x86_PAGEIN_STATE) || \
(x == x86_INSTRUCTION_STATE) || \
(x == x86_LAST_BRANCH_STATE) || \
(x == THREAD_STATE_NONE))
struct x86_state_hdr {
@ -263,19 +259,6 @@ typedef _STRUCT_X86_PAGEIN_STATE x86_pagein_state_t;
#define X86_PAGEIN_STATE_COUNT x86_PAGEIN_STATE_COUNT
typedef _STRUCT_X86_INSTRUCTION_STATE x86_instruction_state_t;
#define x86_INSTRUCTION_STATE_COUNT \
((mach_msg_type_number_t)(sizeof(x86_instruction_state_t) / sizeof(int)))
#define X86_INSTRUCTION_STATE_COUNT x86_INSTRUCTION_STATE_COUNT
typedef _STRUCT_LAST_BRANCH_STATE last_branch_state_t;
#define x86_LAST_BRANCH_STATE_COUNT \
((mach_msg_type_number_t)(sizeof(last_branch_state_t) / sizeof(int)))
#define X86_LAST_BRANCH_STATE_COUNT x86_LAST_BRANCH_STATE_COUNT
/*
* Combined thread, float and exception states
*/

View File

@ -90,34 +90,47 @@
#ifndef _MACH_I386_VM_PARAM_H_
#define _MACH_I386_VM_PARAM_H_
#if !defined(KERNEL) && !defined(__ASSEMBLER__)
#include <mach/vm_page_size.h>
#endif
#define BYTE_SIZE 8 /* byte size in bits */
#define I386_PGBYTES 4096 /* bytes per 80386 page */
#define I386_PGSHIFT 12 /* bitshift for pages */
#if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600)
#define PAGE_SHIFT I386_PGSHIFT
#define PAGE_SIZE I386_PGBYTES
#define PAGE_MASK (PAGE_SIZE-1)
#else /* !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) */
#define PAGE_SHIFT vm_page_shift
#define PAGE_SIZE vm_page_size
#define PAGE_MASK vm_page_mask
#endif /* !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) */
#define PAGE_SHIFT I386_PGSHIFT
#define PAGE_MASK (PAGE_SIZE - 1)
#define PAGE_MAX_SHIFT 14
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
#define PAGE_MAX_SHIFT PAGE_SHIFT
#define PAGE_MAX_SIZE PAGE_SIZE
#define PAGE_MAX_MASK PAGE_MASK
#define PAGE_MIN_SHIFT PAGE_SHIFT
#define PAGE_MIN_SIZE PAGE_SIZE
#define PAGE_MIN_MASK PAGE_MASK
#define I386_LPGBYTES 2*1024*1024 /* bytes per large page */
#define I386_LPGSHIFT 21 /* bitshift for large pages */
#define I386_LPGMASK (I386_LPGBYTES-1)
/*
* Convert bytes to pages and convert pages to bytes.
* No rounding is used.
*/
#define i386_btop(x) ((ppnum_t)((x) >> I386_PGSHIFT))
#define machine_btop(x) i386_btop(x)
#define i386_ptob(x) (((pmap_paddr_t)(x)) << I386_PGSHIFT)
#define machine_ptob(x) i386_ptob(x)
/*
* Round off or truncate to the nearest page. These will work
* for either addresses or counts. (i.e. 1 byte rounds to 1 page
* bytes.
*/
#define i386_round_page(x) ((((pmap_paddr_t)(x)) + I386_PGBYTES - 1) & \
~(I386_PGBYTES-1))
#define i386_trunc_page(x) (((pmap_paddr_t)(x)) & ~(I386_PGBYTES-1))
#define PAGE_MIN_SHIFT 12
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
#define VM_MIN_ADDRESS64 ((user_addr_t) 0x0000000000000000ULL)

View File

@ -70,6 +70,7 @@
#ifndef ASSEMBLER
#include <i386/_types.h>
#include <mach/i386/vm_param.h>
#include <stdint.h>
/*

View File

@ -323,10 +323,6 @@
/* The provided buffer is of insufficient size for the requested data.
*/
#define KERN_DENIED 53
/* Denied by security policy
*/
#define KERN_RETURN_MAX 0x100
/* Maximum return value allowable
*/

View File

@ -226,7 +226,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_get_set_status
(
ipc_space_read_t task,
ipc_space_inspect_t task,
mach_port_name_t name,
mach_port_name_array_t *members,
mach_msg_type_number_t *membersCnt
@ -312,7 +312,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_get_attributes
(
ipc_space_read_t task,
ipc_space_inspect_t task,
mach_port_name_t name,
mach_port_flavor_t flavor,
mach_port_info_t port_info_out,
@ -398,7 +398,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_space_info
(
ipc_space_read_t space,
ipc_space_inspect_t task,
ipc_info_space_t *space_info,
ipc_info_name_array_t *table_info,
mach_msg_type_number_t *table_infoCnt,
@ -428,7 +428,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_kernel_object
(
ipc_space_read_t task,
ipc_space_inspect_t task,
mach_port_name_t name,
unsigned *object_type,
unsigned *object_addr
@ -468,7 +468,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_get_context
(
ipc_space_read_t task,
ipc_space_inspect_t task,
mach_port_name_t name,
mach_port_context_t *context
);
@ -494,7 +494,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_kobject
(
ipc_space_read_t task,
ipc_space_inspect_t task,
mach_port_name_t name,
natural_t *object_type,
mach_vm_address_t *object_addr
@ -603,7 +603,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_kobject_description
(
ipc_space_read_t task,
ipc_space_inspect_t task,
mach_port_name_t name,
natural_t *object_type,
mach_vm_address_t *object_addr,

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2001-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACH_MACH_TIME_H_
#define _MACH_MACH_TIME_H_
#include <mach/mach_types.h>
#include <sys/cdefs.h>
#include <Availability.h>
struct mach_timebase_info {
uint32_t numer;
uint32_t denom;
};
typedef struct mach_timebase_info *mach_timebase_info_t;
typedef struct mach_timebase_info mach_timebase_info_data_t;
__BEGIN_DECLS
kern_return_t mach_timebase_info(
mach_timebase_info_t info);
kern_return_t mach_wait_until(
uint64_t deadline);
uint64_t mach_absolute_time(void);
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
uint64_t mach_approximate_time(void);
/*
* like mach_absolute_time, but advances during sleep
*/
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
uint64_t mach_continuous_time(void);
/*
* like mach_approximate_time, but advances during sleep
*/
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
uint64_t mach_continuous_approximate_time(void);
__END_DECLS
#endif /* _MACH_MACH_TIME_H_ */

View File

@ -131,6 +131,12 @@ extern kern_return_t _kernelrpc_mach_port_allocate_trap(
mach_port_name_t *name
);
extern kern_return_t _kernelrpc_mach_port_destroy_trap(
mach_port_name_t target,
mach_port_name_t name
);
extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
mach_port_name_t target,
mach_port_name_t name

View File

@ -117,17 +117,12 @@
*/
typedef mach_port_t task_t;
typedef mach_port_t task_name_t;
typedef mach_port_t task_policy_set_t;
typedef mach_port_t task_policy_get_t;
typedef mach_port_t task_inspect_t;
typedef mach_port_t task_read_t;
typedef mach_port_t task_suspension_token_t;
typedef mach_port_t thread_t;
typedef mach_port_t thread_act_t;
typedef mach_port_t thread_inspect_t;
typedef mach_port_t thread_read_t;
typedef mach_port_t ipc_space_t;
typedef mach_port_t ipc_space_read_t;
typedef mach_port_t ipc_space_inspect_t;
typedef mach_port_t coalition_t;
typedef mach_port_t host_t;
@ -143,8 +138,6 @@ typedef mach_port_t alarm_t;
typedef mach_port_t clock_serv_t;
typedef mach_port_t clock_ctrl_t;
typedef mach_port_t arcade_register_t;
typedef mach_port_t ipc_eventlink_t;
typedef mach_port_t eventlink_port_pair_t[2];
typedef mach_port_t suid_cred_t;
@ -166,7 +159,6 @@ typedef exception_handler_t *exception_handler_array_t;
typedef mach_port_t vm_task_entry_t;
typedef mach_port_t io_master_t;
typedef mach_port_t UNDServerRef;
typedef mach_port_t mach_eventlink_t;
/*
* Mig doesn't translate the components of an array.
@ -220,15 +212,12 @@ typedef uint32_t suid_cred_uid_t;
#define TASK_NULL ((task_t) 0)
#define TASK_NAME_NULL ((task_name_t) 0)
#define TASK_INSPECT_NULL ((task_inspect_t) 0)
#define TASK_READ_NULL ((task_read_t) 0)
#define TASK_INSPECT_NULL ((task_inspect_t) 0)
#define THREAD_NULL ((thread_t) 0)
#define THREAD_INSPECT_NULL ((thread_inspect_t) 0)
#define THREAD_READ_NULL ((thread_read_t) 0)
#define TID_NULL ((uint64_t) 0)
#define THR_ACT_NULL ((thread_act_t) 0)
#define IPC_SPACE_NULL ((ipc_space_t) 0)
#define IPC_SPACE_READ_NULL ((ipc_space_read_t) 0)
#define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) 0)
#define COALITION_NULL ((coalition_t) 0)
#define HOST_NULL ((host_t) 0)
@ -243,25 +232,7 @@ typedef uint32_t suid_cred_uid_t;
#define CLOCK_NULL ((clock_t) 0)
#define UND_SERVER_NULL ((UNDServerRef) 0)
#define ARCADE_REG_NULL ((arcade_register_t) 0)
#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0)
#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0)
#define SUID_CRED_NULL ((suid_cred_t) 0)
/* capability strictly _DECREASING_.
* not ordered the other way around because we want TASK_FLAVOR_CONTROL
* to be closest to the itk_lock. see task.h.
*/
typedef unsigned int mach_task_flavor_t;
#define TASK_FLAVOR_CONTROL 0 /* a task_t */
#define TASK_FLAVOR_READ 1 /* a task_read_t */
#define TASK_FLAVOR_INSPECT 2 /* a task_inspect_t */
#define TASK_FLAVOR_NAME 3 /* a task_name_t */
/* capability strictly _DECREASING_ */
typedef unsigned int mach_thread_flavor_t;
#define THREAD_FLAVOR_CONTROL 0 /* a thread_t */
#define THREAD_FLAVOR_READ 1 /* a thread_read_t */
#define THREAD_FLAVOR_INSPECT 2 /* a thread_inspect_t */
#define SUID_CRED_NULL ((suid_cred_t) 0)
/* DEPRECATED */
typedef natural_t ledger_item_t;

View File

@ -118,9 +118,6 @@ typedef integer_t cpu_threadtype_t;
#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
/* skip ((cpu_type_t) 19) */
/* skip ((cpu_type_t) 20 */
/* skip ((cpu_type_t) 21 */
/* skip ((cpu_type_t) 22 */
/*
* Machine subtypes (these are defined here, instead of in a machine
@ -133,14 +130,7 @@ typedef integer_t cpu_threadtype_t;
*/
#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */
/*
* When selecting a slice, ANY will pick the slice with the best
* grading for the selected cpu_type_t, unlike the "ALL" subtypes,
* which are the slices that can run on any hardware for that cpu type.
*/
#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1)
/*
* Object files that are hand-crafted to run on any
@ -375,7 +365,9 @@ typedef integer_t cpu_threadtype_t;
#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
#if !defined(RC_HIDE_XNU_ICELAKE)
#define CPUFAMILY_INTEL_ICELAKE 0x38435547
#endif /* not RC_HIDE_XNU_ICELAKE */
#if !defined(RC_HIDE_XNU_COMETLAKE)
#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
#endif /* not RC_HIDE_XNU_COMETLAKE */
@ -394,14 +386,6 @@ typedef integer_t cpu_threadtype_t;
#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
#define CPUSUBFAMILY_UNKNOWN 0
#define CPUSUBFAMILY_ARM_HP 1
#define CPUSUBFAMILY_ARM_HG 2
#define CPUSUBFAMILY_ARM_M 3
#define CPUSUBFAMILY_ARM_HS 4
#define CPUSUBFAMILY_ARM_HC_HD 5
/* The following synonyms are deprecated: */
#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/_structs.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/_structs.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/boolean.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/boolean.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/exception.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/exception.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/kern_return.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/kern_return.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/processor_info.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/processor_info.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/rpc.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/rpc.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/thread_state.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/thread_state.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/thread_status.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/thread_status.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/vm_param.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/vm_param.h"
#else
#error architecture not supported
#endif

View File

@ -31,8 +31,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/vm_types.h"
#elif defined (__arm__) || defined (__arm64__)
#include "mach/arm/vm_types.h"
#else
#error architecture not supported
#endif

View File

@ -228,7 +228,6 @@ typedef unsigned int mach_msg_priority_t;
#define MACH_MSG_PRIORITY_UNSPECIFIED (mach_msg_priority_t) 0
typedef unsigned int mach_msg_type_name_t;
#define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive right */
@ -500,9 +499,6 @@ typedef struct{
mach_port_name_t sender;
} msg_labels_t;
typedef int mach_msg_filter_id;
#define MACH_MSG_FILTER_POLICY_ALLOW (mach_msg_filter_id)0
/*
* Trailer type to pass MAC policy label info as a mach message trailer.
*
@ -515,7 +511,7 @@ typedef struct{
security_token_t msgh_sender;
audit_token_t msgh_audit;
mach_port_context_t msgh_context;
mach_msg_filter_id msgh_ad;
int msgh_ad;
msg_labels_t msgh_labels;
} mach_msg_mac_trailer_t;
@ -803,8 +799,6 @@ typedef kern_return_t mach_msg_return_t;
/* compatibility: no longer a returned error */
#define MACH_SEND_NO_GRANT_DEST 0x10000016
/* The destination port doesn't accept ports in body */
#define MACH_SEND_MSG_FILTERED 0x10000017
/* Message send was rejected by message filter */
#define MACH_RCV_IN_PROGRESS 0x10004001
/* Thread is waiting for receive. (Internal use only.) */

View File

@ -339,9 +339,6 @@ typedef struct mach_port_qos {
#define MPO_STRICT 0x20 /* Apply strict guarding for port */
#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
#define MPO_FILTER_MSG 0x100 /* Allow message filtering */
#define MPO_TG_BLOCK_TRACKING 0x200 /* Track blocking relationship for thread group during sync IPC */
/*
* Structure to define optional attributes for a newly
* constructed port.
@ -349,10 +346,7 @@ typedef struct mach_port_qos {
typedef struct mach_port_options {
uint32_t flags; /* Flags defining attributes for port */
mach_port_limits_t mpl; /* Message queue limit for port */
union {
uint64_t reserved[2]; /* Reserved */
mach_port_name_t work_interval_port; /* Work interval port */
};
uint64_t reserved[2]; /* Reserved */
}mach_port_options_t;
typedef mach_port_options_t *mach_port_options_ptr_t;
@ -373,7 +367,6 @@ enum mach_port_guard_exception_codes {
kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
kGUARD_EXC_IMMOVABLE = 1u << 5,
kGUARD_EXC_STRICT_REPLY = 1u << 6,
kGUARD_EXC_MSG_FILTERED = 1u << 7,
/* start of [optionally] non-fatal guards */
kGUARD_EXC_INVALID_RIGHT = 1u << 8,
kGUARD_EXC_INVALID_NAME = 1u << 9,

View File

@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef processor_set_MSG_COUNT
#define processor_set_MSG_COUNT 11
#define processor_set_MSG_COUNT 10
#endif /* processor_set_MSG_COUNT */
#include <mach/std_types.h>
@ -200,20 +200,6 @@ kern_return_t processor_set_info
mach_msg_type_number_t *info_outCnt
);
/* Routine processor_set_tasks_with_flavor */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t processor_set_tasks_with_flavor
(
processor_set_t processor_set,
mach_task_flavor_t flavor,
task_array_t *task_list,
mach_msg_type_number_t *task_listCnt
);
__END_DECLS
/********************** Caution **************************/
@ -350,18 +336,6 @@ __END_DECLS
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_task_flavor_t flavor;
} __Request__processor_set_tasks_with_flavor_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__processor_set_subsystem__defined */
/* union of all requests */
@ -379,7 +353,6 @@ union __RequestUnion__processor_set_subsystem {
__Request__processor_set_policy_control_t Request_processor_set_policy_control;
__Request__processor_set_stack_usage_t Request_processor_set_stack_usage;
__Request__processor_set_info_t Request_processor_set_info;
__Request__processor_set_tasks_with_flavor_t Request_processor_set_tasks_with_flavor;
};
#endif /* !__RequestUnion__processor_set_subsystem__defined */
/* typedefs for all replies */
@ -526,22 +499,6 @@ union __RequestUnion__processor_set_subsystem {
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_ool_ports_descriptor_t task_list;
/* end of the kernel processed data */
NDR_record_t NDR;
mach_msg_type_number_t task_listCnt;
} __Reply__processor_set_tasks_with_flavor_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__processor_set_subsystem__defined */
/* union of all replies */
@ -559,7 +516,6 @@ union __ReplyUnion__processor_set_subsystem {
__Reply__processor_set_policy_control_t Reply_processor_set_policy_control;
__Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage;
__Reply__processor_set_info_t Reply_processor_set_info;
__Reply__processor_set_tasks_with_flavor_t Reply_processor_set_tasks_with_flavor;
};
#endif /* !__RequestUnion__processor_set_subsystem__defined */
@ -574,8 +530,7 @@ union __ReplyUnion__processor_set_subsystem {
{ "processor_set_threads", 4006 },\
{ "processor_set_policy_control", 4007 },\
{ "processor_set_stack_usage", 4008 },\
{ "processor_set_info", 4009 },\
{ "processor_set_tasks_with_flavor", 4010 }
{ "processor_set_info", 4009 }
#endif
#ifdef __AfterMigUserHeader

View File

@ -279,7 +279,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t task_get_exception_ports
(
task_t task,
task_inspect_t task,
exception_mask_t exception_mask,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
@ -372,7 +372,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t task_policy_set
(
task_policy_set_t task,
task_t task,
task_policy_flavor_t flavor,
task_policy_t policy_info,
mach_msg_type_number_t policy_infoCnt
@ -388,7 +388,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t task_policy_get
(
task_policy_get_t task,
task_t task,
task_policy_flavor_t flavor,
task_policy_t policy_info,
mach_msg_type_number_t *policy_infoCnt,
@ -487,7 +487,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t task_zone_info
(
task_inspect_t target_task,
task_t target_task,
mach_zone_name_array_t *names,
mach_msg_type_number_t *namesCnt,
task_zone_info_array_t *info,
@ -527,7 +527,7 @@ extern
#endif /* mig_external */
kern_return_t task_get_assignment
(
task_inspect_t task,
task_t task,
processor_set_name_t *assigned_set
);
@ -559,7 +559,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t task_get_state
(
task_read_t task,
task_t task,
thread_state_flavor_t flavor,
thread_state_t old_state,
mach_msg_type_number_t *old_stateCnt
@ -631,7 +631,7 @@ extern
#endif /* mig_external */
kern_return_t task_purgable_info
(
task_inspect_t task,
task_t task,
task_purgable_info_t *stats
);
@ -645,7 +645,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t task_get_mach_voucher
(
task_read_t task,
task_t task,
mach_voucher_selector_t which,
ipc_voucher_t *voucher
);
@ -700,7 +700,7 @@ extern
kern_return_t task_map_corpse_info
(
task_t task,
task_read_t corspe_task,
task_t corspe_task,
vm_address_t *kcd_addr_begin,
uint32_t *kcd_size
);
@ -739,7 +739,7 @@ extern
#endif /* mig_external */
kern_return_t task_get_dyld_image_infos
(
task_read_t task,
task_inspect_t task,
dyld_kernel_image_info_array_t *dyld_images,
mach_msg_type_number_t *dyld_imagesCnt
);
@ -791,7 +791,7 @@ extern
kern_return_t task_map_corpse_info_64
(
task_t task,
task_read_t corspe_task,
task_t corspe_task,
mach_vm_address_t *kcd_addr_begin,
mach_vm_size_t *kcd_size
);
@ -1022,7 +1022,7 @@ __END_DECLS
NDR_record_t NDR;
thread_state_flavor_t flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[1296];
natural_t new_state[614];
} __Request__thread_create_running_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@ -1331,7 +1331,7 @@ __END_DECLS
NDR_record_t NDR;
thread_state_flavor_t flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[1296];
natural_t new_state[614];
} __Request__task_set_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@ -2111,7 +2111,7 @@ union __RequestUnion__task_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[1296];
natural_t old_state[614];
} __Reply__task_get_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)

View File

@ -112,13 +112,8 @@ typedef struct task_basic_info_32 *task_basic_info_32_t;
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
struct task_basic_info_64 {
integer_t suspend_count; /* suspend count for task */
#if defined(__arm__) || defined(__arm64__)
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
mach_vm_size_t resident_size; /* resident memory size (bytes) */
#else /* defined(__arm__) || defined(__arm64__) */
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
mach_vm_size_t resident_size; /* resident memory size (bytes) */
#endif /* defined(__arm__) || defined(__arm64__) */
time_value_t user_time; /* total user run time for
* terminated threads */
time_value_t system_time; /* total system run time for
@ -128,26 +123,9 @@ struct task_basic_info_64 {
typedef struct task_basic_info_64 task_basic_info_64_data_t;
typedef struct task_basic_info_64 *task_basic_info_64_t;
#if defined(__arm__) || defined(__arm64__)
#if defined(__arm__) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
/*
* Note: arm64 can't use the old flavor. If you somehow manage to,
* you can cope with the nonsense data yourself.
*/
#define TASK_BASIC_INFO_64 5
#define TASK_BASIC_INFO_64_COUNT \
(sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
#else
#define TASK_BASIC_INFO_64 TASK_BASIC_INFO_64_2
#define TASK_BASIC_INFO_64_COUNT TASK_BASIC_INFO_64_2_COUNT
#endif
#else /* defined(__arm__) || defined(__arm64__) */
#define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
#define TASK_BASIC_INFO_64_COUNT \
(sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
#endif
/* localized structure - cannot be safely passed between tasks of differing sizes */
@ -271,27 +249,6 @@ typedef struct task_dyld_info *task_dyld_info_t;
#define TASK_DYLD_ALL_IMAGE_INFO_32 0 /* format value */
#define TASK_DYLD_ALL_IMAGE_INFO_64 1 /* format value */
#if defined(__arm__) || defined(__arm64__)
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
/* Compatibility for old 32-bit mach_vm_*_t */
#define TASK_BASIC_INFO_64_2 18 /* 64-bit capable basic info */
struct task_basic_info_64_2 {
integer_t suspend_count; /* suspend count for task */
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
mach_vm_size_t resident_size; /* resident memory size (bytes) */
time_value_t user_time; /* total user run time for
* terminated threads */
time_value_t system_time; /* total system run time for
* terminated threads */
policy_t policy; /* default policy for new threads */
};
typedef struct task_basic_info_64_2 task_basic_info_64_2_data_t;
typedef struct task_basic_info_64_2 *task_basic_info_64_2_t;
#define TASK_BASIC_INFO_64_2_COUNT \
(sizeof(task_basic_info_64_2_data_t) / sizeof(natural_t))
#endif
#define TASK_EXTMOD_INFO 19
@ -420,7 +377,7 @@ typedef struct task_vm_info *task_vm_info_t;
typedef struct vm_purgeable_info task_purgable_info_t;
#define TASK_TRACE_MEMORY_INFO 24 /* no longer supported */
#define TASK_TRACE_MEMORY_INFO 24
struct task_trace_memory_info {
uint64_t user_memory_address; /* address of start of trace memory buffer */
uint64_t buffer_size; /* size of buffer in bytes */
@ -455,9 +412,6 @@ typedef gpu_energy_data *gpu_energy_data_t;
struct task_power_info_v2 {
task_power_info_data_t cpu_energy;
gpu_energy_data gpu_energy;
#if defined(__arm__) || defined(__arm64__)
uint64_t task_energy;
#endif /* defined(__arm__) || defined(__arm64__) */
uint64_t task_ptime;
uint64_t task_pset_switches;
};

View File

@ -110,7 +110,8 @@ typedef integer_t *task_policy_t;
#define TASK_BASE_LATENCY_QOS_POLICY 10
#define TASK_BASE_THROUGHPUT_QOS_POLICY 11
typedef enum task_role {
enum task_role {
TASK_RENICED = -1,
TASK_UNSPECIFIED = 0,
TASK_FOREGROUND_APPLICATION = 1,
@ -121,7 +122,9 @@ typedef enum task_role {
TASK_NONUI_APPLICATION = 6,
TASK_DEFAULT_APPLICATION = 7,
TASK_DARWINBG_APPLICATION = 8,
} task_role_t;
};
typedef integer_t task_role_t;
struct task_category_policy {
task_role_t role;

View File

@ -69,19 +69,18 @@
typedef int task_special_port_t;
#define TASK_KERNEL_PORT 1 /* The full task port for task. */
#define TASK_KERNEL_PORT 1 /* Represents task to the outside
* world.*/
#define TASK_HOST_PORT 2 /* The host (priv) port for task. */
#define TASK_NAME_PORT 3 /* The name port for task. */
#define TASK_NAME_PORT 3 /* the name (unpriv) port for task */
#define TASK_BOOTSTRAP_PORT 4 /* Bootstrap environment for task. */
#define TASK_INSPECT_PORT 5 /* The inspect port for task. */
#define TASK_READ_PORT 6 /* The read port for task. */
/*
* Evolving and likely to change.
*/
#define TASK_SEATBELT_PORT 7 /* Seatbelt compiler/DEM port for task. */

View File

@ -49,7 +49,7 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef thread_act_MSG_COUNT
#define thread_act_MSG_COUNT 29
#define thread_act_MSG_COUNT 28
#endif /* thread_act_MSG_COUNT */
#include <mach/std_types.h>
@ -88,7 +88,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t act_get_state
(
thread_read_t target_act,
thread_act_t target_act,
int flavor,
thread_state_t old_state,
mach_msg_type_number_t *old_stateCnt
@ -119,7 +119,7 @@ extern
__WATCHOS_PROHIBITED
kern_return_t thread_get_state
(
thread_read_t target_act,
thread_act_t target_act,
thread_state_flavor_t flavor,
thread_state_t old_state,
mach_msg_type_number_t *old_stateCnt
@ -211,7 +211,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t thread_get_special_port
(
thread_inspect_t thr_act,
thread_act_t thr_act,
int which_port,
mach_port_t *special_port
);
@ -272,7 +272,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t thread_get_exception_ports
(
thread_act_t thread,
thread_inspect_t thread,
exception_mask_t exception_mask,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
@ -402,7 +402,7 @@ extern
#endif /* mig_external */
kern_return_t thread_get_assignment
(
thread_inspect_t thread,
thread_act_t thread,
processor_set_name_t *assigned_set
);
@ -433,7 +433,7 @@ __WATCHOS_PROHIBITED
__TVOS_PROHIBITED
kern_return_t thread_get_mach_voucher
(
thread_read_t thr_act,
thread_act_t thr_act,
mach_voucher_selector_t which,
ipc_voucher_t *voucher
);
@ -467,23 +467,6 @@ kern_return_t thread_swap_mach_voucher
ipc_voucher_t *old_voucher
);
/* Routine thread_convert_thread_state */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t thread_convert_thread_state
(
thread_act_t thread,
int direction,
thread_state_flavor_t flavor,
thread_state_t in_state,
mach_msg_type_number_t in_stateCnt,
thread_state_t out_state,
mach_msg_type_number_t *out_stateCnt
);
__END_DECLS
/********************** Caution **************************/
@ -533,7 +516,7 @@ __END_DECLS
NDR_record_t NDR;
int flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[1296];
natural_t new_state[614];
} __Request__act_set_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@ -560,7 +543,7 @@ __END_DECLS
NDR_record_t NDR;
thread_state_flavor_t flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[1296];
natural_t new_state[614];
} __Request__thread_set_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@ -868,22 +851,6 @@ __END_DECLS
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int direction;
thread_state_flavor_t flavor;
mach_msg_type_number_t in_stateCnt;
natural_t in_state[1296];
mach_msg_type_number_t out_stateCnt;
} __Request__thread_convert_thread_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__thread_act_subsystem__defined */
/* union of all requests */
@ -919,7 +886,6 @@ union __RequestUnion__thread_act_subsystem {
__Request__thread_get_mach_voucher_t Request_thread_get_mach_voucher;
__Request__thread_set_mach_voucher_t Request_thread_set_mach_voucher;
__Request__thread_swap_mach_voucher_t Request_thread_swap_mach_voucher;
__Request__thread_convert_thread_state_t Request_thread_convert_thread_state;
};
#endif /* !__RequestUnion__thread_act_subsystem__defined */
/* typedefs for all replies */
@ -947,7 +913,7 @@ union __RequestUnion__thread_act_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[1296];
natural_t old_state[614];
} __Reply__act_get_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@ -973,7 +939,7 @@ union __RequestUnion__thread_act_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[1296];
natural_t old_state[614];
} __Reply__thread_get_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@ -1293,20 +1259,6 @@ union __RequestUnion__thread_act_subsystem {
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t out_stateCnt;
natural_t out_state[1296];
} __Reply__thread_convert_thread_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__thread_act_subsystem__defined */
/* union of all replies */
@ -1342,7 +1294,6 @@ union __ReplyUnion__thread_act_subsystem {
__Reply__thread_get_mach_voucher_t Reply_thread_get_mach_voucher;
__Reply__thread_set_mach_voucher_t Reply_thread_set_mach_voucher;
__Reply__thread_swap_mach_voucher_t Reply_thread_swap_mach_voucher;
__Reply__thread_convert_thread_state_t Reply_thread_convert_thread_state;
};
#endif /* !__RequestUnion__thread_act_subsystem__defined */
@ -1375,8 +1326,7 @@ union __ReplyUnion__thread_act_subsystem {
{ "thread_set_policy", 3624 },\
{ "thread_get_mach_voucher", 3625 },\
{ "thread_set_mach_voucher", 3626 },\
{ "thread_swap_mach_voucher", 3627 },\
{ "thread_convert_thread_state", 3628 }
{ "thread_swap_mach_voucher", 3627 }
#endif
#ifdef __AfterMigUserHeader

View File

@ -67,11 +67,8 @@
#ifndef _MACH_THREAD_SPECIAL_PORTS_H_
#define _MACH_THREAD_SPECIAL_PORTS_H_
#define THREAD_KERNEL_PORT 1 /* The full thread port for thread. */
#define THREAD_INSPECT_PORT 2 /* The inspect port for thread. */
#define THREAD_READ_PORT 3 /* The read port for thread. */
#define THREAD_KERNEL_PORT 1 /* Represents the thread to the outside
* world.*/
/*
* Definitions for ease of use

View File

@ -94,7 +94,4 @@ typedef natural_t thread_state_data_t[THREAD_STATE_MAX];
typedef int thread_state_flavor_t;
typedef thread_state_flavor_t *thread_state_flavor_array_t;
#define THREAD_CONVERT_THREAD_STATE_TO_SELF 1
#define THREAD_CONVERT_THREAD_STATE_FROM_SELF 2
#endif /* _MACH_THREAD_STATUS_H_ */

View File

@ -149,5 +149,4 @@ typedef int vm_prot_t;
#define VM_PROT_STRIP_READ ((vm_prot_t) 0x80)
#define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
#endif /* _MACH_VM_PROT_H_ */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -66,12 +66,8 @@
#ifndef _MACH_VM_STATISTICS_H_
#define _MACH_VM_STATISTICS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <mach/machine/vm_types.h>
#include <mach/machine/kern_return.h>
/*
* vm_statistics
@ -171,8 +167,6 @@ struct vm_statistics64 {
typedef struct vm_statistics64 *vm_statistics64_t;
typedef struct vm_statistics64 vm_statistics64_data_t;
kern_return_t vm_stats(void *info, unsigned int *count);
/*
* VM_STATISTICS_TRUNCATE_TO_32_BIT
*
@ -358,7 +352,6 @@ enum virtual_memory_guard_exception_codes {
#define VM_MEMORY_MALLOC_NANO 11
#define VM_MEMORY_MALLOC_MEDIUM 12
#define VM_MEMORY_MALLOC_PGUARD 13
#define VM_MEMORY_MACH_MSG 20
#define VM_MEMORY_IOKIT 21
@ -519,22 +512,6 @@ enum virtual_memory_guard_exception_codes {
/* memory allocated by CoreMedia for global image registration of frames */
#define VM_MEMORY_CM_REGWARP 101
/* memory allocated by EmbeddedAcousticRecognition for speech decoder */
#define VM_MEMORY_EAR_DECODER 102
/* CoreUI cached image data */
#define VM_MEMORY_COREUI_CACHED_IMAGE_DATA 103
/* Reserve 230-239 for Rosetta */
#define VM_MEMORY_ROSETTA 230
#define VM_MEMORY_ROSETTA_THREAD_CONTEXT 231
#define VM_MEMORY_ROSETTA_INDIRECT_BRANCH_MAP 232
#define VM_MEMORY_ROSETTA_RETURN_STACK 233
#define VM_MEMORY_ROSETTA_EXECUTABLE_HEAP 234
#define VM_MEMORY_ROSETTA_USER_LDT 235
#define VM_MEMORY_ROSETTA_ARENA 236
#define VM_MEMORY_ROSETTA_10 239
/* Reserve 240-255 for application */
#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
@ -543,8 +520,4 @@ enum virtual_memory_guard_exception_codes {
#ifdef __cplusplus
}
#endif
#endif /* _MACH_VM_STATISTICS_H_ */

View File

@ -70,12 +70,10 @@ typedef uint32_t ppnum_t; /* Physical page number */
typedef mach_port_t vm_map_t, vm_map_read_t, vm_map_inspect_t;
typedef mach_port_t vm_map_t;
#define VM_MAP_NULL ((vm_map_t) 0)
#define VM_MAP_INSPECT_NULL ((vm_map_inspect_t) 0)
#define VM_MAP_READ_NULL ((vm_map_read_t) 0)
/*
* Evolving definitions, likely to change.

View File

@ -27,8 +27,6 @@
*/
#if defined (__i386__) || defined (__x86_64__)
#include "i386/_mcontext.h"
#elif defined (__arm__) || defined (__arm64__)
#include "arm/_mcontext.h"
#else
#error architecture not supported
#endif

View File

@ -26,9 +26,7 @@
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if defined (__i386__) || defined (__x86_64__)
#include <i386/_param.h>
#elif defined (__arm__) || defined (__arm64__)
#include <arm/_param.h>
#include "i386/_param.h"
#else
#error architecture not supported
#endif

View File

@ -30,8 +30,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "i386/_types.h"
#elif defined (__arm__) || defined (__arm64__)
#include "arm/_types.h"
#else
#error architecture not supported
#endif

View File

@ -33,8 +33,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "i386/endian.h"
#elif defined (__arm__) || defined (__arm64__)
#include "arm/endian.h"
#else
#error architecture not supported
#endif

View File

@ -4,8 +4,6 @@
* This file is public domain. */
#if defined (__i386__) || defined(__x86_64__)
#include <i386/limits.h>
#elif defined (__arm__) || defined (__arm64__)
#include <arm/limits.h>
#else
#error architecture not supported
#endif

View File

@ -32,9 +32,7 @@
#define _BSD_MACHINE_PARAM_H_
#if defined (__i386__) || defined(__x86_64__)
#include <i386/param.h>
#elif defined (__arm__) || defined (__arm64__)
#include <arm/param.h>
#include "i386/param.h"
#else
#error architecture not supported
#endif

View File

@ -30,8 +30,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "i386/signal.h"
#elif defined (__arm__) || defined (__arm64__)
#include "arm/signal.h"
#else
#error architecture not supported
#endif

View File

@ -33,8 +33,6 @@
#if defined (__i386__) || defined(__x86_64__)
#include "i386/types.h"
#elif defined (__arm__) || defined (__arm64__)
#include "arm/types.h"
#else
#error architecture not supported
#endif

View File

@ -44,9 +44,9 @@ void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2);
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
void *valloc(size_t) __alloc_size(1);
#endif // !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
(defined(__cplusplus) && __cplusplus >= 201703L)
#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \
((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
(defined(__cplusplus) && __cplusplus >= 201703L))
void *aligned_alloc(size_t __alignment, size_t __size) __result_use_check __alloc_size(2) __OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
#endif
int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);

View File

@ -547,7 +547,6 @@ extern long double fmal(long double, long double, long double);
#define islessgreater(x, y) __builtin_islessgreater((x),(y))
#define isunordered(x, y) __builtin_isunordered((x),(y))
#if defined __i386__ || defined __x86_64__
/* Deprecated functions; use the INFINITY and NAN macros instead. */
extern float __inff(void)
__API_DEPRECATED("use `(float)INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
@ -557,7 +556,6 @@ extern long double __infl(void)
__API_DEPRECATED("use `(long double)INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
extern float __nan(void)
__API_DEPRECATED("use `NAN` instead", macos(10.0, 10.14)) __API_UNAVAILABLE(ios, watchos, tvos);
#endif
/******************************************************************************
* Reentrant variants of lgamma[fl] *
@ -738,7 +736,6 @@ extern int signgam;
#define TLOSS 5
#define PLOSS 6
#if defined __i386__ || defined __x86_64__
/* Legacy BSD API; use the C99 `lrint( )` function instead. */
extern long int rinttol(double)
__API_DEPRECATED_WITH_REPLACEMENT("lrint", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
@ -757,7 +754,6 @@ __API_DEPRECATED_WITH_REPLACEMENT("tgamma", macos(10.0, 10.9)) __API_UNAVAILABLE
/* Legacy BSD API; use `2*frexp( )` or `scalbn(x, -ilogb(x))` instead. */
extern double significand(double)
__API_DEPRECATED("Use `2*frexp( )` or `scalbn(x, -ilogb(x))` instead.", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
#endif
#if !defined __cplusplus
struct exception {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -70,7 +70,6 @@
#include <sys/time.h>
#include <sys/queue.h> /* get TAILQ macros */
#ifdef BSD_KERN_PRIVATE
#include <net/pktsched/pktsched.h>
#include <sys/eventhandler.h>
#endif

View File

@ -63,14 +63,14 @@
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
#include <sys/appleapiopts.h>
#include <sys/_types.h>
#include <stdint.h> /* uint(8|16|32)_t */
#include <Availability.h>
#include <sys/_types/_in_addr_t.h>
#include <sys/_types/_in_port_t.h>
/*
@ -435,7 +435,6 @@ struct ip_opts {
#define IP_PKTINFO 26 /* get pktinfo on recv socket, set src on sent dgram */
#define IP_RECVPKTINFO IP_PKTINFO /* receive pktinfo w/dgram */
#define IP_RECVTOS 27 /* bool; receive IP TOS w/dgram */
#define IP_DONTFRAG 28 /* don't fragment packet */
#define IP_FW_ADD 40 /* add a firewall rule to chain */
#define IP_FW_DEL 41 /* delete a firewall rule from chain */

View File

@ -63,13 +63,11 @@
#ifndef _NETINET_TCP_H_
#define _NETINET_TCP_H_
#include <sys/types.h>
#include <sys/appleapiopts.h>
#include <machine/endian.h>
#include <machine/types.h> /* __uint32_t */
#include <sys/types.h>
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
typedef __uint32_t tcp_seq;
typedef __uint32_t tcp_cc; /* connection count per rfc1644 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2020 Apple Inc. All rights reserved.
* Copyright (c) 2008-2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -98,7 +98,6 @@
#ifndef _NETINET6_IN6_H_
#define _NETINET6_IN6_H_
#include <sys/appleapiopts.h>
#include <sys/_types.h>
#include <sys/_types/_sa_family_t.h>
@ -179,7 +178,6 @@ struct sockaddr_in6 {
/*
* Definition of some useful macros to handle IP6 addresses
*/
@ -208,7 +206,6 @@ struct sockaddr_in6 {
#define IN6ADDR_V4MAPPED_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_MULTICAST_PREFIX IN6MASK8
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
extern const struct in6_addr in6addr_any;
@ -300,16 +297,6 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0)
#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10
#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20
#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX)
#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED))
/*
* Unique Local IPv6 Unicast Addresses (per RFC 4193)
*/
@ -324,9 +311,8 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && \
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
@ -383,9 +369,9 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 mcast loopback */
#define IPV6_MULTICAST_IF 9 /* __uint8_t; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* __uint8_t; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* __uint8_t; set/get IP6 mcast loopback */
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
@ -677,5 +663,5 @@ extern int inet6_rth_segments(const void *);
extern struct in6_addr *inet6_rth_getaddr(const void *, int);
__END_DECLS
#endif /* PLATFORM_DriverKit */
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#endif /* !_NETINET6_IN6_H_ */

View File

@ -96,12 +96,6 @@
# define NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER 1
#endif
/* The arm64 ABI requires proper casting to ensure arguments are passed
* * correctly. */
#if defined(__arm64__) && !__swift__
# undef OBJC_OLD_DISPATCH_PROTOTYPES
# define OBJC_OLD_DISPATCH_PROTOTYPES 0
#endif
/* OBJC_OLD_DISPATCH_PROTOTYPES == 0 enforces the rule that the dispatch
* functions must be cast to an appropriate function pointer type. */

View File

@ -1765,6 +1765,43 @@ OBJC_EXPORT void objc_setHook_getClass(objc_hook_getClass _Nonnull newValue,
OBJC_AVAILABLE(10.14.4, 12.2, 12.2, 5.2, 3.2);
#endif
/**
* Function type for a hook that assists objc_setAssociatedObject().
*
* @param object The source object for the association.
* @param key The key for the association.
* @param value The value to associate with the key key for object. Pass nil to clear an existing association.
* @param policy The policy for the association. For possible values, see Associative Object Behaviors.
*
* @see objc_setAssociatedObject
* @see objc_setHook_setAssociatedObject
*/
typedef void (*objc_hook_setAssociatedObject)(id _Nonnull object, const void * _Nonnull key,
id _Nullable value, objc_AssociationPolicy policy);
/**
* Install a hook for objc_setAssociatedObject().
*
* @param newValue The hook function to install.
* @param outOldValue The address of a function pointer variable. On return,
* the old hook function is stored in the variable.
*
* @note The store to *outOldValue is thread-safe: the variable will be
* updated before objc_setAssociatedObject() calls your new hook to read it,
* even if your new hook is called from another thread before this
* setter completes.
* @note Your hook should always call the previous hook.
*
* @see objc_setAssociatedObject
* @see objc_hook_setAssociatedObject
*/
#if !(TARGET_OS_OSX && __i386__)
#define OBJC_SETASSOCIATEDOBJECTHOOK_DEFINED 1
OBJC_EXPORT void objc_setHook_setAssociatedObject(objc_hook_setAssociatedObject _Nonnull newValue,
objc_hook_setAssociatedObject _Nullable * _Nonnull outOldValue)
OBJC_AVAILABLE(10.15, 13.0, 13.0, 6.0, 4.0);
#endif
/**
* Function type for a function that is called when an image is loaded.
*
@ -1792,39 +1829,7 @@ typedef void (*objc_func_loadImage)(const struct mach_header * _Nonnull header);
OBJC_EXPORT void objc_addLoadImageFunc(objc_func_loadImage _Nonnull func)
OBJC_AVAILABLE(10.15, 13.0, 13.0, 6.0, 4.0);
/**
* Function type for a hook that provides a name for lazily named classes.
*
* @param cls The class to generate a name for.
* @return The name of the class, or NULL if the name isn't known or can't me generated.
*
* @see objc_setHook_lazyClassNamer
*/
typedef const char * _Nullable (*objc_hook_lazyClassNamer)(_Nonnull Class cls);
/**
* Install a hook to provide a name for lazily-named classes.
*
* @param newValue The hook function to install.
* @param outOldValue The address of a function pointer variable. On return,
* the old hook function is stored in the variable.
*
* @note The store to *outOldValue is thread-safe: the variable will be
* updated before objc_getClass() calls your new hook to read it,
* even if your new hook is called from another thread before this
* setter completes.
* @note Your hook must call the previous hook for class names
* that you do not recognize.
*/
#if !(TARGET_OS_OSX && __i386__)
#define OBJC_SETHOOK_LAZYCLASSNAMER_DEFINED 1
OBJC_EXPORT
void objc_setHook_lazyClassNamer(_Nonnull objc_hook_lazyClassNamer newValue,
_Nonnull objc_hook_lazyClassNamer * _Nonnull oldOutValue)
OBJC_AVAILABLE(11.0, 14.0, 14.0, 7.0, 5.0);
#endif
/**
/**
* Callback from Objective-C to Swift to perform Swift class initialization.
*/
#if !(TARGET_OS_OSX && __i386__)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2020 Apple Inc. All rights reserved.
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
@ -23,7 +23,6 @@
#include <sys/cdefs.h>
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
@ -74,7 +73,7 @@
#define OS_ALWAYS_INLINE __attribute__((__always_inline__))
#define OS_TRANSPARENT_UNION __attribute__((__transparent_union__))
#define OS_ALIGNED(n) __attribute__((__aligned__((n))))
#define OS_FORMAT_PRINTF(x, y) __attribute__((__format__(printf,x,y)))
#define OS_FORMAT_PRINTF(x,y) __attribute__((__format__(printf,x,y)))
#define OS_EXPORT extern __attribute__((__visibility__("default")))
#define OS_INLINE static __inline__
#define OS_EXPECT(x, v) __builtin_expect((x), (v))
@ -111,7 +110,7 @@
#define OS_ALWAYS_INLINE
#define OS_TRANSPARENT_UNION
#define OS_ALIGNED(n)
#define OS_FORMAT_PRINTF(x, y)
#define OS_FORMAT_PRINTF(x,y)
#define OS_EXPORT extern
#define OS_INLINE static inline
#define OS_EXPECT(x, v) (x)
@ -125,8 +124,6 @@
#if defined(__cplusplus) && defined(__clang__)
#define OS_FALLTHROUGH [[clang::fallthrough]]
#elif __has_attribute(fallthrough)
#define OS_FALLTHROUGH __attribute__((__fallthrough__))
#else
#define OS_FALLTHROUGH
#endif
@ -167,21 +164,30 @@
* -Wassign-enum prevents you from assigning illegal values to a variable of the
* enum type.
*/
#ifndef __OPEN_SOURCE__
/*!
* @internal
* <rdar://problem/37799789>
*/
#endif // __OPEN_SOURCE__
#define __OS_OPTIONS_ATTR __attribute__((flag_enum))
#else
#define __OS_OPTIONS_ATTR
#endif // __has_attribute(flag_enum)
#if __has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum) || \
__has_extension(cxx_strong_enums)
__has_extension(cxx_strong_enums)
#define OS_ENUM(_name, _type, ...) \
typedef enum : _type { __VA_ARGS__ } _name##_t
typedef enum : _type { __VA_ARGS__ } _name##_t
#define OS_CLOSED_ENUM(_name, _type, ...) \
typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED _name##_t
typedef enum : _type { __VA_ARGS__ } \
__OS_ENUM_ATTR_CLOSED _name##_t
#define OS_OPTIONS(_name, _type, ...) \
typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR __OS_OPTIONS_ATTR _name##_t
typedef enum : _type { __VA_ARGS__ } \
__OS_ENUM_ATTR __OS_OPTIONS_ATTR _name##_t
#define OS_CLOSED_OPTIONS(_name, _type, ...) \
typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR _name##_t
typedef enum : _type { __VA_ARGS__ } \
__OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR _name##_t
#else
/*!
* There is unfortunately no good way in plain C to have both fixed-type enums
@ -214,25 +220,25 @@
* When compiling in ObjC or C++, both of the above assignments are illegal.
*/
#define __OS_ENUM_C_FALLBACK(_name, _type, ...) \
typedef _type _name##_t; enum _name { __VA_ARGS__ }
typedef _type _name##_t; enum _name { __VA_ARGS__ }
#define OS_ENUM(_name, _type, ...) \
typedef _type _name##_t; enum { __VA_ARGS__ }
typedef _type _name##_t; enum { __VA_ARGS__ }
#define OS_CLOSED_ENUM(_name, _type, ...) \
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
__OS_ENUM_ATTR_CLOSED
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
__OS_ENUM_ATTR_CLOSED
#define OS_OPTIONS(_name, _type, ...) \
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
__OS_ENUM_ATTR __OS_OPTIONS_ATTR
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
__OS_ENUM_ATTR __OS_OPTIONS_ATTR
#define OS_CLOSED_OPTIONS(_name, _type, ...) \
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
__OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
__OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR
#endif // __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
#if __has_feature(attribute_availability_swift)
// equivalent to __SWIFT_UNAVAILABLE from Availability.h
#define OS_SWIFT_UNAVAILABLE(_msg) \
__attribute__((__availability__(swift, unavailable, message=_msg)))
__attribute__((__availability__(swift, unavailable, message=_msg)))
#else
#define OS_SWIFT_UNAVAILABLE(_msg)
#endif
@ -256,12 +262,12 @@
#ifdef __GNUC__
#define os_prevent_tail_call_optimization() __asm__("")
#define os_is_compile_time_constant(expr) __builtin_constant_p(expr)
#define os_compiler_barrier() __asm__ __volatile__("" ::: "memory")
#define os_is_compile_time_constant(expr) __builtin_constant_p(expr)
#define os_compiler_barrier() __asm__ __volatile__("" ::: "memory")
#else
#define os_prevent_tail_call_optimization() do { } while (0)
#define os_is_compile_time_constant(expr) 0
#define os_compiler_barrier() do { } while (0)
#define os_is_compile_time_constant(expr) 0
#define os_compiler_barrier() do { } while (0)
#endif
#if __has_attribute(not_tail_called)
@ -270,7 +276,6 @@
#define OS_NOT_TAIL_CALLED
#endif
typedef void (*os_function_t)(void *_Nullable);
#ifdef __BLOCKS__
@ -317,6 +322,4 @@ typedef void (*os_function_t)(void *_Nullable);
typedef void (^os_block_t)(void);
#endif
#endif // __OS_BASE__

View File

@ -1,18 +0,0 @@
#ifndef __OS_CLOCK__
#define __OS_CLOCK__
#include <os/base.h>
#include <stdint.h>
/*
* @typedef os_clockid_t
*
* @abstract
* Describes the kind of clock that the workgroup timestamp parameters are
* specified in
*/
OS_ENUM(os_clockid, uint32_t,
OS_CLOCK_MACH_ABSOLUTE_TIME = 32,
);
#endif /* __OS_CLOCK__ */

View File

@ -98,15 +98,6 @@
#endif // __swift__
#endif // OS_OBJECT_SWIFT3
#if __has_feature(assume_nonnull)
#define OS_OBJECT_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
#define OS_OBJECT_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#else
#define OS_OBJECT_ASSUME_NONNULL_BEGIN
#define OS_OBJECT_ASSUME_NONNULL_END
#endif
#define OS_OBJECT_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
#if OS_OBJECT_USE_OBJC
#import <objc/NSObject.h>
#if __has_attribute(objc_independent_class)
@ -125,9 +116,9 @@
#define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, proto) \
OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL( \
OS_OBJECT_CLASS(name), OS_OBJECT_CLASS(proto))
#define OS_OBJECT_DECL_IMPL(name, adhere, ...) \
#define OS_OBJECT_DECL_IMPL(name, ...) \
OS_OBJECT_DECL_PROTOCOL(name, __VA_ARGS__) \
typedef adhere<OS_OBJECT_CLASS(name)> \
typedef NSObject<OS_OBJECT_CLASS(name)> \
* OS_OBJC_INDEPENDENT_CLASS name##_t
#define OS_OBJECT_DECL_BASE(name, ...) \
@interface OS_OBJECT_CLASS(name) : __VA_ARGS__ \
@ -138,9 +129,9 @@
typedef OS_OBJECT_CLASS(name) \
* OS_OBJC_INDEPENDENT_CLASS name##_t
#define OS_OBJECT_DECL(name, ...) \
OS_OBJECT_DECL_IMPL(name, NSObject, <NSObject>)
OS_OBJECT_DECL_IMPL(name, <NSObject>)
#define OS_OBJECT_DECL_SUBCLASS(name, super) \
OS_OBJECT_DECL_IMPL(name, NSObject, <OS_OBJECT_CLASS(super)>)
OS_OBJECT_DECL_IMPL(name, <OS_OBJECT_CLASS(super)>)
#if __has_attribute(ns_returns_retained)
#define OS_OBJECT_RETURNS_RETAINED __attribute__((__ns_returns_retained__))
#else
@ -158,8 +149,6 @@
#define OS_OBJECT_BRIDGE
#define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT
#endif
#if __has_attribute(objc_runtime_visible) && \
((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12) || \
@ -174,7 +163,7 @@
/*
* To provide backward deployment of ObjC objects in Swift on pre-10.12
* SDKs, OS_object classes can be marked as OS_OBJECT_OBJC_RUNTIME_VISIBLE.
* When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0,
* When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0,
* tvOS 10.0, watchOS 3.0) the Swift compiler will only refer to this type at
* runtime (using the ObjC runtime).
*/
@ -198,9 +187,9 @@
#define OS_OBJECT_DECL_SUBCLASS_SWIFT(name, super) \
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
OS_OBJECT_DECL_IMPL_CLASS(name, OS_OBJECT_CLASS(super))
#endif // OS_OBJECT_SWIFT3
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE
OS_OBJECT_DECL_BASE(object, NSObject);
#endif // OS_OBJECT_SWIFT3
#else
/*! @parseOnly */
#define OS_OBJECT_RETURNS_RETAINED
@ -226,27 +215,6 @@ OS_OBJECT_DECL_BASE(object, NSObject);
typedef struct name##_s *name##_t
#endif
#if OS_OBJECT_USE_OBJC
/* Declares a class of the specific name and exposes the interface and typedefs
* name##_t to the pointer to the class */
#define OS_OBJECT_SHOW_CLASS(name, ...) \
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
OS_OBJECT_DECL_IMPL_CLASS(name, ## __VA_ARGS__ )
/* Declares a subclass of the same name, and
* subclass adheres to protocol specified. Typedefs baseclass<proto> * to subclass##_t */
#define OS_OBJECT_SHOW_SUBCLASS(subclass_name, super, proto_name) \
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
OS_OBJECT_DECL_BASE(subclass_name, OS_OBJECT_CLASS(super)<OS_OBJECT_CLASS(proto_name)>); \
typedef OS_OBJECT_CLASS(super)<OS_OBJECT_CLASS(proto_name)> \
* OS_OBJC_INDEPENDENT_CLASS subclass_name##_t
#else /* Plain C */
#define OS_OBJECT_DECL_PROTOCOL(name, ...)
#define OS_OBJECT_SHOW_CLASS(name, ...) \
typedef struct name##_s *name##_t
#define OS_OBJECT_SHOW_SUBCLASS(name, super, ...) \
typedef super##_t name##_t
#endif
#define OS_OBJECT_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object))
__BEGIN_DECLS

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2020 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
#ifndef __OS_WORKGROUP__
#define __OS_WORKGROUP__
#ifndef __DISPATCH_BUILDING_DISPATCH__
#ifndef __OS_WORKGROUP_INDIRECT__
#define __OS_WORKGROUP_INDIRECT__
#endif /* __OS_WORKGROUP_INDIRECT__ */
#include <os/workgroup_base.h>
#include <os/workgroup_object.h>
#include <os/workgroup_interval.h>
#include <os/workgroup_parallel.h>
#undef __OS_WORKGROUP_INDIRECT__
#endif /* __DISPATCH_BUILDING_DISPATCH__ */
#endif /* __OS_WORKGROUP__ */

View File

@ -1,78 +0,0 @@
#ifndef __OS_WORKGROUP_BASE__
#define __OS_WORKGROUP_BASE__
#ifndef __OS_WORKGROUP_INDIRECT__
#error "Please #include <os/workgroup.h> instead of this file directly."
#endif
#include <sys/types.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <mach/port.h>
#include <Availability.h>
#include <os/base.h>
#include <os/object.h>
#include <os/clock.h>
#if __has_feature(assume_nonnull)
#define OS_WORKGROUP_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
#define OS_WORKGROUP_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#else
#define OS_WORKGROUP_ASSUME_NONNULL_BEGIN
#define OS_WORKGROUP_ASSUME_NONNULL_END
#endif
#define OS_WORKGROUP_WARN_RESULT __attribute__((__warn_unused_result__))
#define OS_WORKGROUP_EXPORT OS_EXPORT
#define OS_WORKGROUP_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED
#define OS_WORKGROUP_DECL(name, swift_name) \
OS_SWIFT_NAME(swift_name) \
OS_OBJECT_SHOW_CLASS(name, OS_OBJECT_CLASS(object))
#if OS_OBJECT_USE_OBJC
#define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...) \
OS_SWIFT_NAME(swift_name) \
OS_OBJECT_DECL_PROTOCOL(name ## __VA_ARGS__ )
#else
#define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...)
#endif
#define OS_WORKGROUP_SUBCLASS_DECL(name, super, swift_name, ...) \
OS_SWIFT_NAME(swift_name) \
OS_OBJECT_SHOW_SUBCLASS(name, super, name, ## __VA_ARGS__)
#if defined(__LP64__)
#define __OS_WORKGROUP_ATTR_SIZE__ 60
#define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56
#define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 36
#else
#define __OS_WORKGROUP_ATTR_SIZE__ 60
#define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56
#define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 28
#endif
#define _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT 0x2FA863B4
#define _OS_WORKGROUP_ATTR_SIG_EMPTY_INIT 0x2FA863C4
struct OS_REFINED_FOR_SWIFT os_workgroup_attr_opaque_s {
uint32_t sig;
char opaque[__OS_WORKGROUP_ATTR_SIZE__];
};
#define _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT 0x52A74C4D
struct OS_REFINED_FOR_SWIFT os_workgroup_interval_data_opaque_s {
uint32_t sig;
char opaque[__OS_WORKGROUP_INTERVAL_DATA_SIZE__];
};
struct OS_REFINED_FOR_SWIFT os_workgroup_join_token_opaque_s {
uint32_t sig;
char opaque[__OS_WORKGROUP_JOIN_TOKEN_SIZE__];
};
#endif /* __OS_WORKGROUP_BASE__ */

View File

@ -1,155 +0,0 @@
/*
* Copyright (c) 2020 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
#ifndef __OS_WORKGROUP_INTERVAL__
#define __OS_WORKGROUP_INTERVAL__
#ifndef __OS_WORKGROUP_INDIRECT__
#error "Please #include <os/workgroup.h> instead of this file directly."
#include <os/workgroup_base.h> // For header doc
#endif
__BEGIN_DECLS
OS_WORKGROUP_ASSUME_NONNULL_BEGIN
/*!
* @typedef os_workgroup_interval_t
*
* @abstract
* A subclass of an os_workgroup_t for tracking work performed as part of
* a repeating interval-driven workload.
*/
OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_interval, Repeatable);
OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_interval, os_workgroup, WorkGroupInterval);
/* During the first instance of this API, the only supported interval
* workgroups are for audio workloads. Please refer to the AudioToolbox
* framework for more information.
*/
/*
* @typedef os_workgroup_interval_data, os_workgroup_interval_data_t
*
* @abstract
* An opaque structure containing additional configuration for the workgroup
* interval.
*/
typedef struct os_workgroup_interval_data_opaque_s os_workgroup_interval_data_s;
typedef struct os_workgroup_interval_data_opaque_s *os_workgroup_interval_data_t;
#define OS_WORKGROUP_INTERVAL_DATA_INITIALIZER \
{ .sig = _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT }
/*!
* @function os_workgroup_interval_start
*
* @abstract
* Indicates to the system that the member threads of this
* os_workgroup_interval_t have begun working on an instance of the repeatable
* interval workload with the specified timestamps. This function is real time
* safe.
*
* This function will set and return an errno in the following cases:
*
* - The current thread is not a member of the os_workgroup_interval_t
* - The os_workgroup_interval_t has been cancelled
* - The timestamps passed in are malformed
* - os_workgroup_interval_start() was previously called on the
* os_workgroup_interval_t without an intervening os_workgroup_interval_finish()
* - A concurrent workgroup interval configuration operation is taking place.
*
* @param start
* Start timestamp specified in the os_clockid_t with which the
* os_workgroup_interval_t was created. This is generally a time in the past and
* indicates when the workgroup started working on an interval period
*
* @param deadline
* Deadline timestamp specified in the os_clockid_t with which the
* os_workgroup_interval_t was created. This specifies the deadline which the
* interval period would like to meet.
*
* @param data
* This field is currently unused and should be NULL
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
int
os_workgroup_interval_start(os_workgroup_interval_t wg, uint64_t start, uint64_t
deadline, os_workgroup_interval_data_t _Nullable data);
/*!
* @function os_workgroup_interval_update
*
* @abstract
* Updates an already started interval workgroup to have the new
* deadline specified. This function is real time safe.
*
* This function will return an error in the following cases:
* - The current thread is not a member of the os_workgroup_interval_t
* - The os_workgroup_interval_t has been cancelled
* - The timestamp passed in is malformed
* - os_workgroup_interval_start() was not previously called on the
* os_workgroup_interval_t or was already matched with an
* os_workgroup_interval_finish()
* - A concurrent workgroup interval configuration operation is taking place
*
* @param deadline
* Timestamp specified in the os_clockid_t with
* which the os_workgroup_interval_t was created.
*
* @param data
* This field is currently unused and should be NULL
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
int
os_workgroup_interval_update(os_workgroup_interval_t wg, uint64_t deadline,
os_workgroup_interval_data_t _Nullable data);
/*!
* @function os_workgroup_interval_finish
*
* @abstract
* Indicates to the system that the member threads of
* this os_workgroup_interval_t have finished working on the current instance
* of the interval workload. This function is real time safe.
*
* This function will return an error in the following cases:
* - The current thread is not a member of the os_workgroup_interval_t
* - os_workgroup_interval_start() was not previously called on the
* os_workgroup_interval_t or was already matched with an
* os_workgroup_interval_finish()
* - A concurrent workgroup interval configuration operation is taking place.
*
* @param data
* This field is currently unused and should be NULL
*
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
int
os_workgroup_interval_finish(os_workgroup_interval_t wg,
os_workgroup_interval_data_t _Nullable data);
OS_WORKGROUP_ASSUME_NONNULL_END
__END_DECLS
#endif /* __OS_WORKGROUP_INTERVAL__ */

View File

@ -1,357 +0,0 @@
/*
* Copyright (c) 2020 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
#ifndef __OS_WORKGROUP_OBJECT__
#define __OS_WORKGROUP_OBJECT__
#ifndef __OS_WORKGROUP_INDIRECT__
#error "Please #include <os/workgroup.h> instead of this file directly."
#include <os/workgroup_base.h> // For header doc
#endif
__BEGIN_DECLS
OS_WORKGROUP_ASSUME_NONNULL_BEGIN
/*!
* @typedef os_workgroup_t
*
* @abstract
* A reference counted os object representing a workload that needs to
* be distinctly recognized and tracked by the system. The workgroup
* tracks a collection of threads all working cooperatively. An os_workgroup
* object - when not an instance of a specific os_workgroup_t subclass -
* represents a generic workload and makes no assumptions about the kind of
* work done.
*
* @discussion
* Threads can explicitly join an os_workgroup_t to mark themselves as
* participants in the workload.
*/
OS_WORKGROUP_DECL(os_workgroup, WorkGroup);
/* Attribute creation and specification */
/*!
* @typedef os_workgroup_attr_t
*
* @abstract
* Pointer to an opaque structure for describing attributes that can be
* configured on a workgroup at creation.
*/
typedef struct os_workgroup_attr_opaque_s os_workgroup_attr_s;
typedef struct os_workgroup_attr_opaque_s *os_workgroup_attr_t;
/* os_workgroup_t attributes need to be initialized before use. This initializer
* allows you to create a workgroup with the system default attributes. */
#define OS_WORKGROUP_ATTR_INITIALIZER_DEFAULT \
{ .sig = _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT }
/* The main use of the workgroup API is through instantiations of the concrete
* subclasses - please refer to os/workgroup_interval.h and
* os/workgroup_parallel.h for more information on creating workgroups.
*
* The functions below operate on all subclasses of os_workgroup_t.
*/
/*!
* @function os_workgroup_copy_port
*
* @abstract
* Returns a reference to a send right representing this workgroup that is to be
* sent to other processes. This port is to be passed to
* os_workgroup_create_with_port() to create a workgroup object.
*
* It is the client's responsibility to release the send right reference.
*
* If an error is encountered, errno is set and returned.
*/
API_AVAILABLE(macos(11.0))
API_UNAVAILABLE(ios, tvos, watchos)
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
int
os_workgroup_copy_port(os_workgroup_t wg, mach_port_t *mach_port_out);
/*!
* @function os_workgroup_create_with_port
*
* @abstract
* Create an os_workgroup_t object from a send right returned by a previous
* call to os_workgroup_copy_port, potentially in a different process.
*
* A newly created os_workgroup_t has no initial member threads - in particular
* the creating thread does not join the os_workgroup_t implicitly.
*
* @param name
* A client specified string for labelling the workgroup. This parameter is
* optional and can be NULL.
*
* @param mach_port
* The send right to create the workgroup from. No reference is consumed
* on the specified send right.
*/
API_AVAILABLE(macos(11.0))
API_UNAVAILABLE(ios, tvos, watchos)
OS_SWIFT_NAME(WorkGroup.init(__name:port:)) OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED
os_workgroup_t _Nullable
os_workgroup_create_with_port(const char *_Nullable name, mach_port_t mach_port);
/*!
* @function os_workgroup_create_with_workgroup
*
* @abstract
* Create a new os_workgroup object from an existing os_workgroup.
*
* The newly created os_workgroup has no initial member threads - in particular
* the creating threaad does not join the os_workgroup_t implicitly.
*
* @param name
* A client specified string for labelling the workgroup. This parameter is
* optional and can be NULL.
*
* @param wg
* The existing workgroup to create a new workgroup object from.
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED
os_workgroup_t _Nullable
os_workgroup_create_with_workgroup(const char * _Nullable name, os_workgroup_t wg);
/*!
* @typedef os_workgroup_join_token, os_workgroup_join_token_t
*
* @abstract
* An opaque join token which the client needs to pass to os_workgroup_join
* and os_workgroup_leave
*/
OS_REFINED_FOR_SWIFT
typedef struct os_workgroup_join_token_opaque_s os_workgroup_join_token_s;
OS_REFINED_FOR_SWIFT
typedef struct os_workgroup_join_token_opaque_s *os_workgroup_join_token_t;
/*!
* @function os_workgroup_join
*
* @abstract
* Joins the current thread to the specified workgroup and populates the join
* token that has been passed in. This API is real-time safe.
*
* @param wg
* The workgroup that the current thread would like to join
*
* @param token_out
* Pointer to a client allocated struct which the function will populate
* with the join token. This token must be passed in by the thread when it calls
* os_workgroup_leave().
*
* Errors will be returned in the following cases:
*
* EALREADY The thread is already part of a workgroup that the specified
* workgroup does not nest with
* EINVAL The workgroup has been cancelled
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
int
os_workgroup_join(os_workgroup_t wg, os_workgroup_join_token_t token_out);
/*!
* @function os_workgroup_leave
*
* @abstract
* This removes the current thread from a workgroup it has previously
* joined. Threads must leave all workgroups in the reverse order that they
* have joined them. Failing to do so before exiting will result in undefined
* behavior.
*
* If the join token is malformed, the process will be aborted.
*
* This API is real time safe.
*
* @param wg
* The workgroup that the current thread would like to leave.
*
* @param token
* This is the join token populated by the most recent call to
* os_workgroup_join().
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
void
os_workgroup_leave(os_workgroup_t wg, os_workgroup_join_token_t token);
/* Working Arena index of a thread in a workgroup */
typedef uint32_t os_workgroup_index;
/* Destructor for Working Arena */
typedef void (*os_workgroup_working_arena_destructor_t)(void * _Nullable);
/*!
* @function os_workgroup_set_working_arena
*
* @abstract
* Associates a client defined working arena with the workgroup. The arena
* is local to the workgroup object in the process. This is intended for
* distributing a manually managed memory allocation between member threads
* of the workgroup.
*
* This function can be called multiple times and the client specified
* destructor will be called on the previously assigned arena, if any. This
* function can only be called when no threads have currently joined the
* workgroup and all workloops associated with the workgroup are idle.
*
* @param wg
* The workgroup to associate the working arena with
*
* @param arena
* The client managed arena to associate with the workgroup. This value can
* be NULL.
*
* @param max_workers
* The maximum number of threads that will ever query the workgroup for the
* arena and request an index into it. If the arena is not used to partition
* work amongst member threads, then this field can be 0.
*
* @param destructor
* A destructor to call on the previously assigned working arena, if any
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
int
os_workgroup_set_working_arena(os_workgroup_t wg, void * _Nullable arena,
uint32_t max_workers, os_workgroup_working_arena_destructor_t destructor);
/*!
* @function os_workgroup_get_working_arena
*
* @abstract
* Returns the working arena associated with the workgroup and the current
* thread's index in the workgroup. This function can only be called by a member
* of the workgroup. Multiple calls to this API by a member thread will return
* the same arena and index until the thread leaves the workgroup.
*
* For workloops with an associated workgroup, every work item on the workloop
* will receive the same index in the arena.
*
* This method returns NULL if no arena is set on the workgroup. The index
* returned by this function is zero-based and is namespaced per workgroup
* object in the process. The indices provided are strictly monotonic and never
* reused until a future call to os_workgroup_set_working_arena.
*
* @param wg
* The workgroup to get the working arena from.
*
* @param index_out
* A pointer to a os_workgroup_index which will be populated by the caller's
* index in the workgroup.
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
void * _Nullable
os_workgroup_get_working_arena(os_workgroup_t wg,
os_workgroup_index * _Nullable index_out);
/*!
* @function os_workgroup_cancel
*
* @abstract
* This API invalidates a workgroup and indicates to the system that the
* workload is no longer relevant to the caller.
*
* No new work should be initiated for a cancelled workgroup and
* work that is already underway should periodically check for
* cancellation with os_workgroup_testcancel and initiate cleanup if needed.
*
* Threads currently in the workgroup continue to be tracked together but no
* new threads may join this workgroup - the only possible operation allowed is
* to leave the workgroup. Other actions may have undefined behavior or
* otherwise fail.
*
* This API is idempotent. Cancellation is local to the workgroup object
* it is called on and does not affect other workgroups.
*
* @param wg
* The workgroup that that the thread would like to cancel
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
void
os_workgroup_cancel(os_workgroup_t wg);
/*!
* @function os_workgroup_testcancel
*
* @abstract
* Returns true if the workgroup object has been cancelled. See also
* os_workgroup_cancel
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
bool
os_workgroup_testcancel(os_workgroup_t wg);
/*!
* @typedef os_workgroup_max_parallel_threads_attr_t
*
* @abstract
* A pointer to a structure describing the set of properties of a workgroup to
* override with the explicitly specified values in the structure.
*
* See also os_workgroup_max_parallel_threads.
*/
OS_REFINED_FOR_SWIFT
typedef struct os_workgroup_max_parallel_threads_attr_s os_workgroup_mpt_attr_s;
OS_REFINED_FOR_SWIFT
typedef struct os_workgroup_max_parallel_threads_attr_s *os_workgroup_mpt_attr_t;
/*!
* @function os_workgroup_max_parallel_threads
*
* @abstract
* Returns the system's recommendation for maximum number of threads the client
* should make for a multi-threaded workload in a given workgroup.
*
* This API takes into consideration the current hardware the code is running on
* and the attributes of the workgroup. It does not take into consideration the
* current load of the system and therefore always provides the most optimal
* recommendation for the workload.
*
* @param wg
* The workgroup in which the multi-threaded workload will be performed in. The
* threads performing the multi-threaded workload are expected to join this
* workgroup.
*
* @param attr
* This value is currently unused and should be NULL.
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
int
os_workgroup_max_parallel_threads(os_workgroup_t wg, os_workgroup_mpt_attr_t
_Nullable attr);
OS_WORKGROUP_ASSUME_NONNULL_END
__END_DECLS
#endif /* __OS_WORKGROUP_OBJECT__ */

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) 2020 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
#ifndef __OS_WORKGROUP_PARALLEL__
#define __OS_WORKGROUP_PARALLEL__
#ifndef __OS_WORKGROUP_INDIRECT__
#error "Please #include <os/workgroup.h> instead of this file directly."
#include <os/workgroup_base.h> // For header doc
#endif
#include <os/workgroup_object.h>
__BEGIN_DECLS
OS_WORKGROUP_ASSUME_NONNULL_BEGIN
/*!
* @typedef os_workgroup_parallel_t
*
* @abstract
* A subclass of an os_workgroup_t for tracking parallel work.
*/
OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_parallel, Parallelizable);
OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_parallel, os_workgroup, WorkGroupParallel);
/*!
* @function os_workgroup_parallel_create
*
* @abstract
* Creates an os_workgroup_t which tracks a parallel workload.
* A newly created os_workgroup_interval_t has no initial member threads -
* in particular the creating thread does not join the os_workgroup_parallel_t
* implicitly.
*
* See also os_workgroup_max_parallel_threads().
*
* @param name
* A client specified string for labelling the workgroup. This parameter is
* optional and can be NULL.
*
* @param attr
* The requested set of workgroup attributes. NULL is to be specified for the
* default set of attributes.
*/
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED
OS_SWIFT_NAME(WorkGroupParallel.init(__name:attr:))
os_workgroup_parallel_t _Nullable
os_workgroup_parallel_create(const char * _Nullable name,
os_workgroup_attr_t _Nullable attr);
OS_WORKGROUP_ASSUME_NONNULL_END
__END_DECLS
#endif /* __OS_WORKGROUP_PARALLEL__ */

View File

@ -53,6 +53,9 @@
#define _PTHREAD_H
#include <_types.h>
#ifndef __POSIX_LIB__
#include <pthread/pthread_impl.h>
#endif
#include <pthread/sched.h>
#include <time.h>
#include <sys/_pthread/_pthread_types.h>
@ -556,33 +559,6 @@ int pthread_sigmask(int, const sigset_t * _Nullable, sigset_t * _Nullable)
__API_AVAILABLE(macos(10.4), ios(2.0))
void pthread_yield_np(void);
__API_AVAILABLE(macos(11.0))
__API_UNAVAILABLE(ios, tvos, watchos)
void pthread_jit_write_protect_np(int enabled);
__API_AVAILABLE(macos(11.0))
__API_UNAVAILABLE(ios, tvos, watchos)
int pthread_jit_write_protect_supported_np(void);
/*!
* @function pthread_cpu_number_np
*
* @param cpu_number_out
* The CPU number that the thread was running on at the time of query.
* This cpu number is in the interval [0, ncpus) (from sysctlbyname("hw.ncpu"))
*
* @result
* This function returns 0 or the value of errno if an error occurred.
*
* @note
* Optimizations of per-CPU datastructures based on the result of this function
* still require synchronization since it is not guaranteed that the thread will
* still be on the same CPU by the time the function returns.
*/
__API_AVAILABLE(macos(11.0), ios(14.2), tvos(14.2), watchos(7.1))
int
pthread_cpu_number_np(size_t *cpu_number_out);
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE || __cplusplus */
__END_DECLS
#if __has_feature(assume_nonnull)

View File

@ -25,7 +25,7 @@
#define _SCHED_H_
#include <sys/cdefs.h>
#include <pthread/pthread_impl.h>
#include <pthread_impl.h>
__BEGIN_DECLS
/*
@ -33,8 +33,6 @@ __BEGIN_DECLS
*/
#ifndef __POSIX_LIB__
struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; };
#else
struct sched_param;
#endif
extern int sched_yield(void);

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _PTHREAD_IMPL_H_
#define _PTHREAD_IMPL_H_
/*
* Internal implementation details
*/
/* This whole header file will disappear, so don't depend on it... */
#if __has_feature(assume_nonnull)
_Pragma("clang assume_nonnull begin")
#endif
#ifndef __POSIX_LIB__
/*
* [Internal] data structure signatures
*/
#define _PTHREAD_MUTEX_SIG_init 0x32AAABA7
#define _PTHREAD_ERRORCHECK_MUTEX_SIG_init 0x32AAABA1
#define _PTHREAD_RECURSIVE_MUTEX_SIG_init 0x32AAABA2
#define _PTHREAD_FIRSTFIT_MUTEX_SIG_init 0x32AAABA3
#define _PTHREAD_COND_SIG_init 0x3CB0B1BB
#define _PTHREAD_ONCE_SIG_init 0x30B1BCBA
#define _PTHREAD_RWLOCK_SIG_init 0x2DA8B3B4
/*
* POSIX scheduling policies
*/
#define SCHED_OTHER 1
#define SCHED_FIFO 4
#define SCHED_RR 2
#define __SCHED_PARAM_SIZE__ 4
#endif /* __POSIX_LIB__ */
#if __has_feature(assume_nonnull)
_Pragma("clang assume_nonnull end")
#endif
#endif /* _PTHREAD_IMPL_H_ */

View File

@ -25,7 +25,7 @@
#define _SCHED_H_
#include <sys/cdefs.h>
#include <pthread/pthread_impl.h>
#include <pthread_impl.h>
__BEGIN_DECLS
/*
@ -33,8 +33,6 @@ __BEGIN_DECLS
*/
#ifndef __POSIX_LIB__
struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; };
#else
struct sched_param;
#endif
extern int sched_yield(void);

View File

@ -108,11 +108,16 @@ int sigvec(int, struct sigvec *, struct sigvec *);
__END_DECLS
/* List definitions after function declarations, or Reiser cpp gets upset. */
#if defined(__i386__) || defined(__x86_64__)
/* The left shift operator on intel is modulo 32 */
__header_always_inline int
__sigbits(int __signo)
{
return __signo > __DARWIN_NSIG ? 0 : (1 << (__signo - 1));
}
#else /* !__i386__ && !__x86_64__ */
#define __sigbits(signo) (1 << ((signo) - 1))
#endif /* __i386__ || __x86_64__ */
#define sigaddset(set, signo) (*(set) |= __sigbits(signo), 0)
#define sigdelset(set, signo) (*(set) &= ~__sigbits(signo), 0)

View File

@ -1977,7 +1977,7 @@ static inline SIMD_CFUNC simd_char16 simd_abs(simd_char16 x) {
#if defined __arm__ || defined __arm64__
return vabsq_s8(x);
#elif defined __SSE4_1__
return (simd_char16) _mm_abs_epi8((__m128i)x);
return _mm_abs_epi8(x);
#else
simd_char16 mask = x >> 7; return (x ^ mask) - mask;
#endif
@ -2019,7 +2019,7 @@ static inline SIMD_CFUNC simd_short8 simd_abs(simd_short8 x) {
#if defined __arm__ || defined __arm64__
return vabsq_s16(x);
#elif defined __SSE4_1__
return (simd_short8) _mm_abs_epi16((__m128i)x);
return _mm_abs_epi16(x);
#else
simd_short8 mask = x >> 15; return (x ^ mask) - mask;
#endif
@ -2057,7 +2057,7 @@ static inline SIMD_CFUNC simd_int4 simd_abs(simd_int4 x) {
#if defined __arm__ || defined __arm64__
return vabsq_s32(x);
#elif defined __SSE4_1__
return (simd_int4) _mm_abs_epi32((__m128i)x);
return _mm_abs_epi32(x);
#else
simd_int4 mask = x >> 31; return (x ^ mask) - mask;
#endif
@ -2103,7 +2103,7 @@ static inline SIMD_CFUNC simd_long2 simd_abs(simd_long2 x) {
#if defined __arm64__
return vabsq_s64(x);
#elif defined __SSE4_1__
return (simd_long2) _mm_abs_epi64((__m128i)x);
return _mm_abs_epi64(x);
#else
simd_long2 mask = x >> 63; return (x ^ mask) - mask;
#endif
@ -2170,7 +2170,7 @@ static inline SIMD_CFUNC simd_char16 simd_min(simd_char16 x, simd_char16 y) {
#if defined __arm__ || defined __arm64__
return vminq_s8(x, y);
#elif defined __SSE4_1__
return (simd_char16) _mm_min_epi8((__m128i)x, (__m128i)y);
return _mm_min_epi8(x, y);
#else
return simd_bitselect(x, y, y < x);
#endif
@ -2217,7 +2217,7 @@ static inline SIMD_CFUNC simd_uchar16 simd_min(simd_uchar16 x, simd_uchar16 y) {
#if defined __arm__ || defined __arm64__
return vminq_u8(x, y);
#elif defined __SSE4_1__
return (simd_uchar16) _mm_min_epu8((__m128i)x, (__m128i)y);
return _mm_min_epu8(x, y);
#else
return simd_bitselect(x, y, y < x);
#endif
@ -2260,7 +2260,7 @@ static inline SIMD_CFUNC simd_short8 simd_min(simd_short8 x, simd_short8 y) {
#if defined __arm__ || defined __arm64__
return vminq_s16(x, y);
#elif defined __SSE4_1__
return (simd_short8) _mm_min_epi16((__m128i)x, (__m128i)y);
return _mm_min_epi16(x, y);
#else
return simd_bitselect(x, y, y < x);
#endif
@ -2303,7 +2303,7 @@ static inline SIMD_CFUNC simd_ushort8 simd_min(simd_ushort8 x, simd_ushort8 y) {
#if defined __arm__ || defined __arm64__
return vminq_u16(x, y);
#elif defined __SSE4_1__
return (simd_ushort8) _mm_min_epu16((__m128i)x, (__m128i)y);
return _mm_min_epu16(x, y);
#else
return simd_bitselect(x, y, y < x);
#endif
@ -2342,7 +2342,7 @@ static inline SIMD_CFUNC simd_int4 simd_min(simd_int4 x, simd_int4 y) {
#if defined __arm__ || defined __arm64__
return vminq_s32(x, y);
#elif defined __SSE4_1__
return (simd_int4) _mm_min_epi32((__m128i)x, (__m128i)y);
return _mm_min_epi32(x, y);
#else
return simd_bitselect(x, y, y < x);
#endif
@ -2381,7 +2381,7 @@ static inline SIMD_CFUNC simd_uint4 simd_min(simd_uint4 x, simd_uint4 y) {
#if defined __arm__ || defined __arm64__
return vminq_u32(x, y);
#elif defined __SSE4_1__
return (simd_uint4) _mm_min_epu32((__m128i)x, (__m128i)y);
return _mm_min_epu32(x, y);
#else
return simd_bitselect(x, y, y < x);
#endif
@ -2528,7 +2528,7 @@ static inline SIMD_CFUNC simd_char16 simd_max(simd_char16 x, simd_char16 y) {
#if defined __arm__ || defined __arm64__
return vmaxq_s8(x, y);
#elif defined __SSE4_1__
return (simd_char16) _mm_max_epi8((__m128i)x, (__m128i)y);
return _mm_max_epi8(x, y);
#else
return simd_bitselect(x, y, x < y);
#endif
@ -2575,7 +2575,7 @@ static inline SIMD_CFUNC simd_uchar16 simd_max(simd_uchar16 x, simd_uchar16 y) {
#if defined __arm__ || defined __arm64__
return vmaxq_u8(x, y);
#elif defined __SSE4_1__
return (simd_uchar16) _mm_max_epu8((__m128i)x, (__m128i)y);
return _mm_max_epu8(x, y);
#else
return simd_bitselect(x, y, x < y);
#endif
@ -2618,7 +2618,7 @@ static inline SIMD_CFUNC simd_short8 simd_max(simd_short8 x, simd_short8 y) {
#if defined __arm__ || defined __arm64__
return vmaxq_s16(x, y);
#elif defined __SSE4_1__
return (simd_short8) _mm_max_epi16((__m128i)x, (__m128i)y);
return _mm_max_epi16(x, y);
#else
return simd_bitselect(x, y, x < y);
#endif
@ -2661,7 +2661,7 @@ static inline SIMD_CFUNC simd_ushort8 simd_max(simd_ushort8 x, simd_ushort8 y) {
#if defined __arm__ || defined __arm64__
return vmaxq_u16(x, y);
#elif defined __SSE4_1__
return (simd_ushort8) _mm_max_epu16((__m128i)x, (__m128i)y);
return _mm_max_epu16(x, y);
#else
return simd_bitselect(x, y, x < y);
#endif
@ -2700,7 +2700,7 @@ static inline SIMD_CFUNC simd_int4 simd_max(simd_int4 x, simd_int4 y) {
#if defined __arm__ || defined __arm64__
return vmaxq_s32(x, y);
#elif defined __SSE4_1__
return (simd_int4) _mm_max_epi32((__m128i)x, (__m128i)y);
return _mm_max_epi32(x, y);
#else
return simd_bitselect(x, y, x < y);
#endif
@ -2739,7 +2739,7 @@ static inline SIMD_CFUNC simd_uint4 simd_max(simd_uint4 x, simd_uint4 y) {
#if defined __arm__ || defined __arm64__
return vmaxq_u32(x, y);
#elif defined __SSE4_1__
return (simd_uint4) _mm_max_epu32((__m128i)x, (__m128i)y);
return _mm_max_epu32(x, y);
#else
return simd_bitselect(x, y, x < y);
#endif
@ -3083,7 +3083,7 @@ static inline SIMD_CFUNC simd_double8 simd_clamp(simd_double8 x, simd_double8 mi
static inline SIMD_CFUNC float simd_sign(float x) {
return (x == 0 | x != x) ? 0 : copysign(1,x);
return x == 0 | x != x ? 0 : copysign(1,x);
}
static inline SIMD_CFUNC simd_float2 simd_sign(simd_float2 x) {
@ -3107,7 +3107,7 @@ static inline SIMD_CFUNC simd_float16 simd_sign(simd_float16 x) {
}
static inline SIMD_CFUNC double simd_sign(double x) {
return (x == 0 | x != x) ? 0 : copysign(1,x);
return x == 0 | x != x ? 0 : copysign(1,x);
}
static inline SIMD_CFUNC simd_double2 simd_sign(simd_double2 x) {

View File

@ -559,11 +559,6 @@ static simd_int2 SIMD_CFUNC simd_int_sat(simd_ulong2 __x);
static simd_int3 SIMD_CFUNC simd_int_sat(simd_ulong3 __x);
static simd_int4 SIMD_CFUNC simd_int_sat(simd_ulong4 __x);
static simd_int8 SIMD_CFUNC simd_int_sat(simd_ulong8 __x);
static simd_int2 SIMD_CFUNC simd_int_rte(simd_float2 __x);
static simd_int3 SIMD_CFUNC simd_int_rte(simd_float3 __x);
static simd_int4 SIMD_CFUNC simd_int_rte(simd_float4 __x);
static simd_int8 SIMD_CFUNC simd_int_rte(simd_float8 __x);
static simd_int16 SIMD_CFUNC simd_int_rte(simd_float16 __x);
#define vector_int simd_int
#define vector_int_sat simd_int_sat
@ -793,10 +788,6 @@ static simd_long2 SIMD_CFUNC simd_long_sat(simd_ulong2 __x);
static simd_long3 SIMD_CFUNC simd_long_sat(simd_ulong3 __x);
static simd_long4 SIMD_CFUNC simd_long_sat(simd_ulong4 __x);
static simd_long8 SIMD_CFUNC simd_long_sat(simd_ulong8 __x);
static simd_long2 SIMD_CFUNC simd_long_rte(simd_double2 __x);
static simd_long3 SIMD_CFUNC simd_long_rte(simd_double3 __x);
static simd_long4 SIMD_CFUNC simd_long_rte(simd_double4 __x);
static simd_long8 SIMD_CFUNC simd_long_rte(simd_double8 __x);
#define vector_long simd_long
#define vector_long_sat simd_long_sat
@ -1120,7 +1111,6 @@ static simd_char2 SIMD_CFUNC simd_char_sat(simd_ulong2 __x) { return simd_cha
static simd_char3 SIMD_CFUNC simd_char_sat(simd_ulong3 __x) { return simd_char(simd_min(__x,0x7f)); }
static simd_char4 SIMD_CFUNC simd_char_sat(simd_ulong4 __x) { return simd_char(simd_min(__x,0x7f)); }
static simd_char8 SIMD_CFUNC simd_char_sat(simd_ulong8 __x) { return simd_char(simd_min(__x,0x7f)); }
static simd_uchar2 SIMD_CFUNC simd_uchar(simd_char2 __x) { return (simd_uchar2)__x; }
static simd_uchar3 SIMD_CFUNC simd_uchar(simd_char3 __x) { return (simd_uchar3)__x; }
@ -1225,7 +1215,6 @@ static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_ulong2 __x) { return simd_u
static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_ulong3 __x) { return simd_uchar(simd_min(__x,0xff)); }
static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_ulong4 __x) { return simd_uchar(simd_min(__x,0xff)); }
static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_ulong8 __x) { return simd_uchar(simd_min(__x,0xff)); }
static simd_short2 SIMD_CFUNC simd_short(simd_char2 __x) { return __builtin_convertvector(__x, simd_short2); }
static simd_short3 SIMD_CFUNC simd_short(simd_char3 __x) { return __builtin_convertvector(__x, simd_short3); }
@ -1330,7 +1319,6 @@ static simd_short2 SIMD_CFUNC simd_short_sat(simd_ulong2 __x) { return simd_s
static simd_short3 SIMD_CFUNC simd_short_sat(simd_ulong3 __x) { return simd_short(simd_min(__x,0x7fff)); }
static simd_short4 SIMD_CFUNC simd_short_sat(simd_ulong4 __x) { return simd_short(simd_min(__x,0x7fff)); }
static simd_short8 SIMD_CFUNC simd_short_sat(simd_ulong8 __x) { return simd_short(simd_min(__x,0x7fff)); }
static simd_ushort2 SIMD_CFUNC simd_ushort(simd_char2 __x) { return simd_ushort(simd_short(__x)); }
static simd_ushort3 SIMD_CFUNC simd_ushort(simd_char3 __x) { return simd_ushort(simd_short(__x)); }
@ -1435,7 +1423,6 @@ static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_ulong2 __x) { return simd
static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_ulong3 __x) { return simd_ushort(simd_min(__x, 0xffff)); }
static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_ulong4 __x) { return simd_ushort(simd_min(__x, 0xffff)); }
static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_ulong8 __x) { return simd_ushort(simd_min(__x, 0xffff)); }
static simd_int2 SIMD_CFUNC simd_int(simd_char2 __x) { return __builtin_convertvector(__x, simd_int2); }
static simd_int3 SIMD_CFUNC simd_int(simd_char3 __x) { return __builtin_convertvector(__x, simd_int3); }
@ -1532,46 +1519,6 @@ static simd_int2 SIMD_CFUNC simd_int_sat(simd_ulong2 __x) { return simd_int(s
static simd_int3 SIMD_CFUNC simd_int_sat(simd_ulong3 __x) { return simd_int(simd_min(__x,0x7fffffff)); }
static simd_int4 SIMD_CFUNC simd_int_sat(simd_ulong4 __x) { return simd_int(simd_min(__x,0x7fffffff)); }
static simd_int8 SIMD_CFUNC simd_int_sat(simd_ulong8 __x) { return simd_int(simd_min(__x,0x7fffffff)); }
static simd_int2 SIMD_CFUNC simd_int_rte(simd_float2 __x) {
#if defined __arm64__
return vcvtn_s32_f32(__x);
#else
return simd_make_int2(simd_int_rte(simd_make_float4_undef(__x)));
#endif
}
static simd_int3 SIMD_CFUNC simd_int_rte(simd_float3 __x) {
return simd_make_int3(simd_int_rte(simd_make_float4_undef(__x)));
}
static simd_int4 SIMD_CFUNC simd_int_rte(simd_float4 __x) {
#if defined __SSE2__
return _mm_cvtps_epi32(__x);
#elif defined __arm64__
return vcvtnq_s32_f32(__x);
#else
simd_float4 magic = __tg_copysign(0x1.0p23, __x);
simd_int4 x_is_small = __tg_fabs(__x) < 0x1.0p23;
return __builtin_convertvector(simd_bitselect(__x, (__x + magic) - magic, x_is_small & 0x7fffffff), simd_int4);
#endif
}
static simd_int8 SIMD_CFUNC simd_int_rte(simd_float8 __x) {
#if defined __AVX__
return _mm256_cvtps_epi32(__x);
#else
return simd_make_int8(simd_int_rte(__x.lo), simd_int_rte(__x.hi));
#endif
}
static simd_int16 SIMD_CFUNC simd_int_rte(simd_float16 __x) {
#if defined __AVX512F__
return _mm512_cvt_roundps_epi32(__x, _MM_FROUND_RINT);
#else
return simd_make_int16(simd_int_rte(__x.lo), simd_int_rte(__x.hi));
#endif
}
static simd_uint2 SIMD_CFUNC simd_uint(simd_char2 __x) { return simd_uint(simd_int(__x)); }
static simd_uint3 SIMD_CFUNC simd_uint(simd_char3 __x) { return simd_uint(simd_int(__x)); }
@ -1668,7 +1615,6 @@ static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_ulong2 __x) { return simd_uin
static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_ulong3 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); }
static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_ulong4 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); }
static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_ulong8 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); }
static simd_float2 SIMD_CFUNC simd_float(simd_char2 __x) { return (simd_float2)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; }
static simd_float3 SIMD_CFUNC simd_float(simd_char3 __x) { return (simd_float3)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; }
@ -1717,7 +1663,6 @@ static simd_float2 SIMD_CFUNC simd_float(simd_double2 __x) { return __builtin_
static simd_float3 SIMD_CFUNC simd_float(simd_double3 __x) { return __builtin_convertvector(__x,simd_float3); }
static simd_float4 SIMD_CFUNC simd_float(simd_double4 __x) { return __builtin_convertvector(__x,simd_float4); }
static simd_float8 SIMD_CFUNC simd_float(simd_double8 __x) { return __builtin_convertvector(__x,simd_float8); }
static simd_long2 SIMD_CFUNC simd_long(simd_char2 __x) { return __builtin_convertvector(__x,simd_long2); }
static simd_long3 SIMD_CFUNC simd_long(simd_char3 __x) { return __builtin_convertvector(__x,simd_long3); }
@ -1800,39 +1745,6 @@ static simd_long2 SIMD_CFUNC simd_long_sat(simd_ulong2 __x) { return simd_lon
static simd_long3 SIMD_CFUNC simd_long_sat(simd_ulong3 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); }
static simd_long4 SIMD_CFUNC simd_long_sat(simd_ulong4 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); }
static simd_long8 SIMD_CFUNC simd_long_sat(simd_ulong8 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); }
static simd_long2 SIMD_CFUNC simd_long_rte(simd_double2 __x) {
#if defined __AVX512F__
return _mm_cvtpd_epi64(__x);
#elif defined __arm64__
return vcvtnq_s64_f64(__x);
#else
simd_double2 magic = __tg_copysign(0x1.0p52, __x);
simd_long2 x_is_small = __tg_fabs(__x) < 0x1.0p52;
return __builtin_convertvector(simd_bitselect(__x, (__x + magic) - magic, x_is_small & 0x7fffffffffffffff), simd_long2);
#endif
}
static simd_long3 SIMD_CFUNC simd_long_rte(simd_double3 __x) {
return simd_make_long3(simd_long_rte(simd_make_double4_undef(__x)));
}
static simd_long4 SIMD_CFUNC simd_long_rte(simd_double4 __x) {
#if defined __AVX512F__
return _mm256_cvtpd_epi64(__x);
#else
return simd_make_long4(simd_long_rte(__x.lo), simd_long_rte(__x.hi));
#endif
}
static simd_long8 SIMD_CFUNC simd_long_rte(simd_double8 __x) {
#if defined __AVX512F__
return _mm512_cvt_roundpd_epi64(__x, _MM_FROUND_RINT);
#else
return simd_make_long8(simd_long_rte(__x.lo), simd_long_rte(__x.hi));
#endif
}
static simd_ulong2 SIMD_CFUNC simd_ulong(simd_char2 __x) { return simd_ulong(simd_long(__x)); }
static simd_ulong3 SIMD_CFUNC simd_ulong(simd_char3 __x) { return simd_ulong(simd_long(__x)); }
@ -1915,7 +1827,6 @@ static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_ulong2 __x) { return __x; }
static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_ulong3 __x) { return __x; }
static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_ulong4 __x) { return __x; }
static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_ulong8 __x) { return __x; }
static simd_double2 SIMD_CFUNC simd_double(simd_char2 __x) { return simd_double(simd_int(__x)); }
static simd_double3 SIMD_CFUNC simd_double(simd_char3 __x) { return simd_double(simd_int(__x)); }
@ -1957,11 +1868,9 @@ static simd_double2 SIMD_CFUNC simd_double(simd_double2 __x) { return __builti
static simd_double3 SIMD_CFUNC simd_double(simd_double3 __x) { return __builtin_convertvector(__x, simd_double3); }
static simd_double4 SIMD_CFUNC simd_double(simd_double4 __x) { return __builtin_convertvector(__x, simd_double4); }
static simd_double8 SIMD_CFUNC simd_double(simd_double8 __x) { return __builtin_convertvector(__x, simd_double8); }
#ifdef __cplusplus
}
#endif
#endif // SIMD_COMPILER_HAS_REQUIRED_FEATURES
#endif // __SIMD_CONVERSION_HEADER__

View File

@ -628,7 +628,7 @@ extern "C" {
static inline SIMD_CFUNC simd_bool simd_any(simd_char2 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x3);
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x3);
#elif defined __arm64__
return simd_any(x.xyxy);
#else
@ -638,7 +638,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char2 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_char3 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x7);
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x7);
#elif defined __arm64__
return simd_any(x.xyzz);
#else
@ -648,7 +648,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char3 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_char4 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xf);
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xf);
#elif defined __arm64__
return simd_any(x.xyzwxyzw);
#else
@ -658,7 +658,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char4 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_char8 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xff);
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xff);
#elif defined __arm64__
return vmaxv_u8(x) & 0x80;
#else
@ -668,7 +668,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char8 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_char16 x) {
#if defined __SSE2__
return _mm_movemask_epi8((__m128i)x);
return _mm_movemask_epi8(x);
#elif defined __arm64__
return vmaxvq_u8(x) & 0x80;
#else
@ -708,7 +708,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_uchar64 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_short2 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xa);
return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xa);
#elif defined __arm64__
return simd_any(x.xyxy);
#else
@ -718,7 +718,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_short2 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_short3 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0x2a);
return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0x2a);
#elif defined __arm64__
return simd_any(x.xyzz);
#else
@ -728,7 +728,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_short3 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_short4 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xaa);
return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xaa);
#elif defined __arm64__
return vmaxv_u16(x) & 0x8000;
#else
@ -738,7 +738,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_short4 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_short8 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)x) & 0xaaaa);
return (_mm_movemask_epi8(x) & 0xaaaa);
#elif defined __arm64__
return vmaxvq_u16(x) & 0x8000;
#else
@ -775,7 +775,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_ushort32 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_int2 x) {
#if defined __SSE2__
return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x3);
return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x3);
#elif defined __arm64__
return vmaxv_u32(x) & 0x80000000;
#else
@ -785,7 +785,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_int2 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_int3 x) {
#if defined __SSE2__
return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x7);
return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x7);
#elif defined __arm64__
return simd_any(x.xyzz);
#else
@ -794,7 +794,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_int3 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_int4 x) {
#if defined __SSE2__
return _mm_movemask_ps((__m128)x);
return _mm_movemask_ps(x);
#elif defined __arm64__
return vmaxvq_u32(x) & 0x80000000;
#else
@ -828,7 +828,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_uint16 x) {
}
static inline SIMD_CFUNC simd_bool simd_any(simd_long2 x) {
#if defined __SSE2__
return _mm_movemask_pd((__m128d)x);
return _mm_movemask_pd(x);
#elif defined __arm64__
return (x.x | x.y) & 0x8000000000000000U;
#else
@ -867,7 +867,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_ulong8 x) {
static inline SIMD_CFUNC simd_bool simd_all(simd_char2 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x3) == 0x3;
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x3) == 0x3;
#elif defined __arm64__
return simd_all(x.xyxy);
#else
@ -877,7 +877,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char2 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_char3 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x7) == 0x7;
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x7) == 0x7;
#elif defined __arm64__
return simd_all(x.xyzz);
#else
@ -887,7 +887,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char3 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_char4 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xf) == 0xf;
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xf) == 0xf;
#elif defined __arm64__
return simd_all(x.xyzwxyzw);
#else
@ -897,7 +897,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char4 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_char8 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xff) == 0xff;
return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xff) == 0xff;
#elif defined __arm64__
return vminv_u8(x) & 0x80;
#else
@ -907,7 +907,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char8 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_char16 x) {
#if defined __SSE2__
return _mm_movemask_epi8((__m128i)x) == 0xffff;
return _mm_movemask_epi8(x) == 0xffff;
#elif defined __arm64__
return vminvq_u8(x) & 0x80;
#else
@ -947,7 +947,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_uchar64 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_short2 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xa) == 0xa;
return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xa) == 0xa;
#elif defined __arm64__
return simd_all(x.xyxy);
#else
@ -957,7 +957,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_short2 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_short3 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0x2a) == 0x2a;
return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0x2a) == 0x2a;
#elif defined __arm64__
return simd_all(x.xyzz);
#else
@ -967,7 +967,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_short3 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_short4 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xaa) == 0xaa;
return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xaa) == 0xaa;
#elif defined __arm64__
return vminv_u16(x) & 0x8000;
#else
@ -977,7 +977,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_short4 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_short8 x) {
#if defined __SSE2__
return (_mm_movemask_epi8((__m128i)x) & 0xaaaa) == 0xaaaa;
return (_mm_movemask_epi8(x) & 0xaaaa) == 0xaaaa;
#elif defined __arm64__
return vminvq_u16(x) & 0x8000;
#else
@ -1014,7 +1014,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_ushort32 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_int2 x) {
#if defined __SSE2__
return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x3) == 0x3;
return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x3) == 0x3;
#elif defined __arm64__
return vminv_u32(x) & 0x80000000;
#else
@ -1024,7 +1024,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_int2 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_int3 x) {
#if defined __SSE2__
return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x7) == 0x7;
return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x7) == 0x7;
#elif defined __arm64__
return simd_all(x.xyzz);
#else
@ -1033,7 +1033,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_int3 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_int4 x) {
#if defined __SSE2__
return _mm_movemask_ps((__m128)x) == 0xf;
return _mm_movemask_ps(x) == 0xf;
#elif defined __arm64__
return vminvq_u32(x) & 0x80000000;
#else
@ -1067,7 +1067,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_uint16 x) {
}
static inline SIMD_CFUNC simd_bool simd_all(simd_long2 x) {
#if defined __SSE2__
return _mm_movemask_pd((__m128d)x) == 0x3;
return _mm_movemask_pd(x) == 0x3;
#elif defined __arm64__
return (x.x & x.y) & 0x8000000000000000U;
#else
@ -1112,7 +1112,7 @@ static inline SIMD_CFUNC simd_float3 simd_select(simd_float3 x, simd_float3 y, s
}
static inline SIMD_CFUNC simd_float4 simd_select(simd_float4 x, simd_float4 y, simd_int4 mask) {
#if defined __SSE4_1__
return _mm_blendv_ps(x, y, (__m128)mask);
return _mm_blendv_ps(x, y, mask);
#else
return simd_bitselect(x, y, mask >> 31);
#endif
@ -1129,7 +1129,7 @@ static inline SIMD_CFUNC simd_float16 simd_select(simd_float16 x, simd_float16 y
}
static inline SIMD_CFUNC simd_double2 simd_select(simd_double2 x, simd_double2 y, simd_long2 mask) {
#if defined __SSE4_1__
return _mm_blendv_pd(x, y, (__m128d)mask);
return _mm_blendv_pd(x, y, mask);
#else
return simd_bitselect(x, y, mask >> 63);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -35,22 +35,22 @@
/*! @abstract A vector of two 8-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::char2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
* simd::packed_char2. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(1))) char simd_packed_char2;
/*! @abstract A vector of four 8-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::char4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
* simd::packed_char4. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(1))) char simd_packed_char4;
/*! @abstract A vector of eight 8-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ this type is also available as simd::packed::char8.
* @description In C++ this type is also available as simd::packed_char8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -58,7 +58,7 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(1))) char simd_packed_
/*! @abstract A vector of sixteen 8-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::char16.
* @description In C++ this type is also available as simd::packed_char16.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -66,7 +66,7 @@ typedef __attribute__((__ext_vector_type__(16),__aligned__(1))) char simd_packed
/*! @abstract A vector of thirty-two 8-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::char32.
* @description In C++ this type is also available as simd::packed_char32.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -74,7 +74,7 @@ typedef __attribute__((__ext_vector_type__(32),__aligned__(1))) char simd_packed
/*! @abstract A vector of sixty-four 8-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::char64.
* @description In C++ this type is also available as simd::packed_char64.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -83,7 +83,7 @@ typedef __attribute__((__ext_vector_type__(64),__aligned__(1))) char simd_packed
/*! @abstract A vector of two 8-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::uchar2. The alignment of this type is that of the
* simd::packed_uchar2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(1))) unsigned char simd_packed_uchar2;
@ -91,14 +91,14 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(1))) unsigned char sim
/*! @abstract A vector of four 8-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::uchar4. The alignment of this type is that of the
* simd::packed_uchar4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(1))) unsigned char simd_packed_uchar4;
/*! @abstract A vector of eight 8-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as simd::packed::uchar8.
* @description In C++ this type is also available as simd::packed_uchar8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -106,32 +106,32 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(1))) unsigned char sim
/*! @abstract A vector of sixteen 8-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::uchar16. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_uchar16.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(16),__aligned__(1))) unsigned char simd_packed_uchar16;
/*! @abstract A vector of thirty-two 8-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::uchar32. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_uchar32.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(32),__aligned__(1))) unsigned char simd_packed_uchar32;
/*! @abstract A vector of sixty-four 8-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::uchar64. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_uchar64.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(64),__aligned__(1))) unsigned char simd_packed_uchar64;
/*! @abstract A vector of two 16-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::short2. The alignment of this type is that of the
* simd::packed_short2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(2))) short simd_packed_short2;
@ -139,14 +139,14 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(2))) short simd_packed
/*! @abstract A vector of four 16-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::short4. The alignment of this type is that of the
* simd::packed_short4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(2))) short simd_packed_short4;
/*! @abstract A vector of eight 16-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::short8.
* @description In C++ this type is also available as simd::packed_short8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -154,24 +154,24 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(2))) short simd_packed
/*! @abstract A vector of sixteen 16-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as
* simd::packed::short16. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_short16.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(16),__aligned__(2))) short simd_packed_short16;
/*! @abstract A vector of thirty-two 16-bit signed (twos-complement)
* integers with relaxed alignment.
* @description In C++ this type is also available as
* simd::packed::short32. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_short32.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(32),__aligned__(2))) short simd_packed_short32;
/*! @abstract A vector of two 16-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::ushort2. The alignment of this type is that of the
* simd::packed_ushort2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(2))) unsigned short simd_packed_ushort2;
@ -179,23 +179,23 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(2))) unsigned short si
/*! @abstract A vector of four 16-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::ushort4. The alignment of this type is that of the
* simd::packed_ushort4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(2))) unsigned short simd_packed_ushort4;
/*! @abstract A vector of eight 16-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::ushort8. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_ushort8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(8),__aligned__(2))) unsigned short simd_packed_ushort8;
/*! @abstract A vector of sixteen 16-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::ushort16. This type is not available in Metal. The
* simd::packed_ushort16. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
typedef __attribute__((__ext_vector_type__(16),__aligned__(2))) unsigned short simd_packed_ushort16;
@ -203,7 +203,7 @@ typedef __attribute__((__ext_vector_type__(16),__aligned__(2))) unsigned short s
/*! @abstract A vector of thirty-two 16-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::ushort32. This type is not available in Metal. The
* simd::packed_ushort32. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
typedef __attribute__((__ext_vector_type__(32),__aligned__(2))) unsigned short simd_packed_ushort32;
@ -211,7 +211,7 @@ typedef __attribute__((__ext_vector_type__(32),__aligned__(2))) unsigned short s
/*! @abstract A vector of two 32-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::int2. The alignment of this type is that of the underlying
* simd::packed_int2. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) int simd_packed_int2;
@ -219,14 +219,14 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) int simd_packed_i
/*! @abstract A vector of four 32-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::int4. The alignment of this type is that of the underlying
* simd::packed_int4. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) int simd_packed_int4;
/*! @abstract A vector of eight 32-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::int8.
* @description In C++ this type is also available as simd::packed_int8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -234,7 +234,7 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) int simd_packed_i
/*! @abstract A vector of sixteen 32-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::int16.
* @description In C++ this type is also available as simd::packed_int16.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -243,22 +243,22 @@ typedef __attribute__((__ext_vector_type__(16),__aligned__(4))) int simd_packed_
/*! @abstract A vector of two 32-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::uint2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
* simd::packed_uint2. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) unsigned int simd_packed_uint2;
/*! @abstract A vector of four 32-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::uint4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
* simd::packed_uint4. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) unsigned int simd_packed_uint4;
/*! @abstract A vector of eight 32-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as simd::packed::uint8.
* @description In C++ this type is also available as simd::packed_uint8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -266,7 +266,7 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) unsigned int simd
/*! @abstract A vector of sixteen 32-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as simd::packed::uint16.
* @description In C++ this type is also available as simd::packed_uint16.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -275,7 +275,7 @@ typedef __attribute__((__ext_vector_type__(16),__aligned__(4))) unsigned int sim
/*! @abstract A vector of two 32-bit floating-point numbers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::float2. The alignment of this type is that of the
* simd::packed_float2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) float simd_packed_float2;
@ -283,14 +283,14 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) float simd_packed
/*! @abstract A vector of four 32-bit floating-point numbers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::float4. The alignment of this type is that of the
* simd::packed_float4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) float simd_packed_float4;
/*! @abstract A vector of eight 32-bit floating-point numbers with relaxed
* alignment.
* @description In C++ this type is also available as simd::packed::float8.
* @description In C++ this type is also available as simd::packed_float8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -298,18 +298,18 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) float simd_packed
/*! @abstract A vector of sixteen 32-bit floating-point numbers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::float16. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_float16.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
typedef __attribute__((__ext_vector_type__(16),__aligned__(4))) float simd_packed_float16;
/*! @abstract A vector of two 64-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::long2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
* simd::packed_long2. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
#if defined __LP64__
typedef __attribute__((__ext_vector_type__(2),__aligned__(8))) simd_long1 simd_packed_long2;
#else
@ -319,9 +319,9 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) simd_long1 simd_p
/*! @abstract A vector of four 64-bit signed (twos-complement) integers with
* relaxed alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::long4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
* simd::packed_long4. The alignment of this type is that of the underlying
* scalar element type, so you can use it to load or store from an array of
* that type. */
#if defined __LP64__
typedef __attribute__((__ext_vector_type__(4),__aligned__(8))) simd_long1 simd_packed_long4;
#else
@ -330,7 +330,7 @@ typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) simd_long1 simd_p
/*! @abstract A vector of eight 64-bit signed (twos-complement) integers
* with relaxed alignment.
* @description In C++ this type is also available as simd::packed::long8.
* @description In C++ this type is also available as simd::packed_long8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -343,7 +343,7 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) simd_long1 simd_p
/*! @abstract A vector of two 64-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::ulong2. The alignment of this type is that of the
* simd::packed_ulong2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
#if defined __LP64__
@ -355,7 +355,7 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) simd_ulong1 simd_
/*! @abstract A vector of four 64-bit unsigned integers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::ulong4. The alignment of this type is that of the
* simd::packed_ulong4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
#if defined __LP64__
@ -366,7 +366,7 @@ typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) simd_ulong1 simd_
/*! @abstract A vector of eight 64-bit unsigned integers with relaxed
* alignment.
* @description In C++ this type is also available as simd::packed::ulong8.
* @description In C++ this type is also available as simd::packed_ulong8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
@ -379,7 +379,7 @@ typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) simd_ulong1 simd_
/*! @abstract A vector of two 64-bit floating-point numbers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::double2. The alignment of this type is that of the
* simd::packed_double2. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
#if defined __LP64__
@ -391,7 +391,7 @@ typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) double simd_packe
/*! @abstract A vector of four 64-bit floating-point numbers with relaxed
* alignment.
* @description In C++ and Metal, this type is also available as
* simd::packed::double4. The alignment of this type is that of the
* simd::packed_double4. The alignment of this type is that of the
* underlying scalar element type, so you can use it to load or store from
* an array of that type. */
#if defined __LP64__
@ -402,10 +402,10 @@ typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) double simd_packe
/*! @abstract A vector of eight 64-bit floating-point numbers with relaxed
* alignment.
* @description In C++ this type is also available as
* simd::packed::double8. This type is not available in Metal. The
* alignment of this type is only that of the underlying scalar element
* type, so you can use it to load or store from an array of that type. */
* @description In C++ this type is also available as simd::packed_double8.
* This type is not available in Metal. The alignment of this type is only
* that of the underlying scalar element type, so you can use it to load or
* store from an array of that type. */
#if defined __LP64__
typedef __attribute__((__ext_vector_type__(8),__aligned__(8))) double simd_packed_double8;
#else
@ -772,259 +772,259 @@ typedef ::simd_packed_double8 double8;
/*! @abstract A vector of two 8-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_char2
* or simd::packed::char2 instead. */
* or simd::packed_char2 instead. */
typedef simd_packed_char2 packed_char2;
/*! @abstract A vector of four 8-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_char4
* or simd::packed::char4 instead. */
* or simd::packed_char4 instead. */
typedef simd_packed_char4 packed_char4;
/*! @abstract A vector of eight 8-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_char8
* or simd::packed::char8 instead. */
* or simd::packed_char8 instead. */
typedef simd_packed_char8 packed_char8;
/*! @abstract A vector of sixteen 8-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_char16
* or simd::packed::char16 instead. */
* or simd::packed_char16 instead. */
typedef simd_packed_char16 packed_char16;
/*! @abstract A vector of thirty-two 8-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_char32
* or simd::packed::char32 instead. */
* or simd::packed_char32 instead. */
typedef simd_packed_char32 packed_char32;
/*! @abstract A vector of sixty-four 8-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_char64
* or simd::packed::char64 instead. */
* or simd::packed_char64 instead. */
typedef simd_packed_char64 packed_char64;
/*! @abstract A vector of two 8-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uchar2
* or simd::packed::uchar2 instead. */
* or simd::packed_uchar2 instead. */
typedef simd_packed_uchar2 packed_uchar2;
/*! @abstract A vector of four 8-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uchar4
* or simd::packed::uchar4 instead. */
* or simd::packed_uchar4 instead. */
typedef simd_packed_uchar4 packed_uchar4;
/*! @abstract A vector of eight 8-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uchar8
* or simd::packed::uchar8 instead. */
* or simd::packed_uchar8 instead. */
typedef simd_packed_uchar8 packed_uchar8;
/*! @abstract A vector of sixteen 8-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uchar16
* or simd::packed::uchar16 instead. */
* or simd::packed_uchar16 instead. */
typedef simd_packed_uchar16 packed_uchar16;
/*! @abstract A vector of thirty-two 8-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uchar32
* or simd::packed::uchar32 instead. */
* or simd::packed_uchar32 instead. */
typedef simd_packed_uchar32 packed_uchar32;
/*! @abstract A vector of sixty-four 8-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uchar64
* or simd::packed::uchar64 instead. */
* or simd::packed_uchar64 instead. */
typedef simd_packed_uchar64 packed_uchar64;
/*! @abstract A vector of two 16-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_short2
* or simd::packed::short2 instead. */
* or simd::packed_short2 instead. */
typedef simd_packed_short2 packed_short2;
/*! @abstract A vector of four 16-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_short4
* or simd::packed::short4 instead. */
* or simd::packed_short4 instead. */
typedef simd_packed_short4 packed_short4;
/*! @abstract A vector of eight 16-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_short8
* or simd::packed::short8 instead. */
* or simd::packed_short8 instead. */
typedef simd_packed_short8 packed_short8;
/*! @abstract A vector of sixteen 16-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_short16
* or simd::packed::short16 instead. */
* or simd::packed_short16 instead. */
typedef simd_packed_short16 packed_short16;
/*! @abstract A vector of thirty-two 16-bit signed (twos-complement)
* integers with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_short32
* or simd::packed::short32 instead. */
* or simd::packed_short32 instead. */
typedef simd_packed_short32 packed_short32;
/*! @abstract A vector of two 16-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_ushort2
* or simd::packed::ushort2 instead. */
* or simd::packed_ushort2 instead. */
typedef simd_packed_ushort2 packed_ushort2;
/*! @abstract A vector of four 16-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_ushort4
* or simd::packed::ushort4 instead. */
* or simd::packed_ushort4 instead. */
typedef simd_packed_ushort4 packed_ushort4;
/*! @abstract A vector of eight 16-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_ushort8
* or simd::packed::ushort8 instead. */
* or simd::packed_ushort8 instead. */
typedef simd_packed_ushort8 packed_ushort8;
/*! @abstract A vector of sixteen 16-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use
* simd_packed_ushort16 or simd::packed::ushort16 instead. */
* simd_packed_ushort16 or simd::packed_ushort16 instead. */
typedef simd_packed_ushort16 packed_ushort16;
/*! @abstract A vector of thirty-two 16-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use
* simd_packed_ushort32 or simd::packed::ushort32 instead. */
* simd_packed_ushort32 or simd::packed_ushort32 instead. */
typedef simd_packed_ushort32 packed_ushort32;
/*! @abstract A vector of two 32-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_int2 or
* simd::packed::int2 instead. */
* simd::packed_int2 instead. */
typedef simd_packed_int2 packed_int2;
/*! @abstract A vector of four 32-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_int4 or
* simd::packed::int4 instead. */
* simd::packed_int4 instead. */
typedef simd_packed_int4 packed_int4;
/*! @abstract A vector of eight 32-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_int8 or
* simd::packed::int8 instead. */
* simd::packed_int8 instead. */
typedef simd_packed_int8 packed_int8;
/*! @abstract A vector of sixteen 32-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_int16
* or simd::packed::int16 instead. */
* or simd::packed_int16 instead. */
typedef simd_packed_int16 packed_int16;
/*! @abstract A vector of two 32-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uint2
* or simd::packed::uint2 instead. */
* or simd::packed_uint2 instead. */
typedef simd_packed_uint2 packed_uint2;
/*! @abstract A vector of four 32-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uint4
* or simd::packed::uint4 instead. */
* or simd::packed_uint4 instead. */
typedef simd_packed_uint4 packed_uint4;
/*! @abstract A vector of eight 32-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uint8
* or simd::packed::uint8 instead. */
* or simd::packed_uint8 instead. */
typedef simd_packed_uint8 packed_uint8;
/*! @abstract A vector of sixteen 32-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_uint16
* or simd::packed::uint16 instead. */
* or simd::packed_uint16 instead. */
typedef simd_packed_uint16 packed_uint16;
/*! @abstract A vector of two 32-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_float2
* or simd::packed::float2 instead. */
* or simd::packed_float2 instead. */
typedef simd_packed_float2 packed_float2;
/*! @abstract A vector of four 32-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_float4
* or simd::packed::float4 instead. */
* or simd::packed_float4 instead. */
typedef simd_packed_float4 packed_float4;
/*! @abstract A vector of eight 32-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_float8
* or simd::packed::float8 instead. */
* or simd::packed_float8 instead. */
typedef simd_packed_float8 packed_float8;
/*! @abstract A vector of sixteen 32-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_float16
* or simd::packed::float16 instead. */
* or simd::packed_float16 instead. */
typedef simd_packed_float16 packed_float16;
/*! @abstract A vector of two 64-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_long2
* or simd::packed::long2 instead. */
* or simd::packed_long2 instead. */
typedef simd_packed_long2 packed_long2;
/*! @abstract A vector of four 64-bit signed (twos-complement) integers with
* relaxed alignment.
* @description This type is deprecated; you should use simd_packed_long4
* or simd::packed::long4 instead. */
* or simd::packed_long4 instead. */
typedef simd_packed_long4 packed_long4;
/*! @abstract A vector of eight 64-bit signed (twos-complement) integers
* with relaxed alignment.
* @description This type is deprecated; you should use simd_packed_long8
* or simd::packed::long8 instead. */
* or simd::packed_long8 instead. */
typedef simd_packed_long8 packed_long8;
/*! @abstract A vector of two 64-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_ulong2
* or simd::packed::ulong2 instead. */
* or simd::packed_ulong2 instead. */
typedef simd_packed_ulong2 packed_ulong2;
/*! @abstract A vector of four 64-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_ulong4
* or simd::packed::ulong4 instead. */
* or simd::packed_ulong4 instead. */
typedef simd_packed_ulong4 packed_ulong4;
/*! @abstract A vector of eight 64-bit unsigned integers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_ulong8
* or simd::packed::ulong8 instead. */
* or simd::packed_ulong8 instead. */
typedef simd_packed_ulong8 packed_ulong8;
/*! @abstract A vector of two 64-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_double2
* or simd::packed::double2 instead. */
* or simd::packed_double2 instead. */
typedef simd_packed_double2 packed_double2;
/*! @abstract A vector of four 64-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_double4
* or simd::packed::double4 instead. */
* or simd::packed_double4 instead. */
typedef simd_packed_double4 packed_double4;
/*! @abstract A vector of eight 64-bit floating-point numbers with relaxed
* alignment.
* @description This type is deprecated; you should use simd_packed_double8
* or simd::packed::double8 instead. */
* or simd::packed_double8 instead. */
typedef simd_packed_double8 packed_double8;
# endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */

View File

@ -435,7 +435,7 @@ static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float3 from, simd_float3 to
// Because from and to are more than 90 degrees apart, we compute the
// rotation in two stages (from -> half), (half -> to) to preserve numerical
// accuracy.
simd_float3 half = from + to;
simd_float3 half = simd_normalize(from + to);
if (simd_length_squared(half) == 0) {
// half is nearly zero, so from and to point in nearly opposite directions
@ -449,9 +449,8 @@ static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float3 from, simd_float3 to
else
return _simd_quaternion(simd_normalize(simd_cross(from, (simd_float3){0,0,1})), 0.f);
}
// Compute the two-step rotation. */
half = simd_normalize(half);
return simd_mul(_simd_quaternion_reduced(from, half),
_simd_quaternion_reduced(half, to));
}
@ -1021,7 +1020,7 @@ static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double3 from, simd_double3
// Because from and to are more than 90 degrees apart, we compute the
// rotation in two stages (from -> half), (half -> to) to preserve numerical
// accuracy.
simd_double3 half = from + to;
simd_double3 half = simd_normalize(from + to);
if (simd_length_squared(half) == 0) {
// half is nearly zero, so from and to point in nearly opposite directions
@ -1035,9 +1034,8 @@ static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double3 from, simd_double3
else
return _simd_quaternion(simd_normalize(simd_cross(from, (simd_double3){0,0,1})), 0.f);
}
// Compute the two-step rotation. */
half = simd_normalize(half);
return simd_mul(_simd_quaternion_reduced(from, half),
_simd_quaternion_reduced(half, to));
}

View File

@ -135,18 +135,12 @@ __BEGIN_DECLS
int posix_spawnattr_getbinpref_np(const posix_spawnattr_t * __restrict,
size_t, cpu_type_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
int posix_spawnattr_getarchpref_np(const posix_spawnattr_t * __restrict,
size_t, cpu_type_t *__restrict, cpu_subtype_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(11.0), ios(14.0)) __API_UNAVAILABLE(watchos, tvos);
int posix_spawnattr_setauditsessionport_np(posix_spawnattr_t * __restrict,
mach_port_t) __API_AVAILABLE(macos(10.6), ios(3.2));
int posix_spawnattr_setbinpref_np(posix_spawnattr_t * __restrict,
size_t, cpu_type_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
int posix_spawnattr_setarchpref_np(posix_spawnattr_t * __restrict,
size_t, cpu_type_t *__restrict, cpu_subtype_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(11.0), ios(14.0)) __API_UNAVAILABLE(watchos, tvos);
int posix_spawnattr_setexceptionports_np(posix_spawnattr_t * __restrict,
exception_mask_t, mach_port_t,
exception_behavior_t, thread_state_flavor_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
@ -156,22 +150,6 @@ int posix_spawnattr_setspecialport_np(posix_spawnattr_t * __restrict,
int posix_spawnattr_setsuidcredport_np(posix_spawnattr_t * __restrict, mach_port_t) __API_UNAVAILABLE(ios, macos);
int posix_spawnattr_setnosmt_np(const posix_spawnattr_t * __restrict attr) __API_AVAILABLE(macos(11.0));
/*
* Set CPU Security Mitigation on the spawned process
* This attribute affects all threads and is inherited on fork and exec
*/
int posix_spawnattr_set_csm_np(const posix_spawnattr_t * __restrict attr, uint32_t flags) __API_AVAILABLE(macos(11.0));
/*
* flags for CPU Security Mitigation attribute
* POSIX_SPAWN_NP_CSM_ALL should be used in most cases,
* the individual flags are provided only for performance evaluation etc
*/
#define POSIX_SPAWN_NP_CSM_ALL 0x0001
#define POSIX_SPAWN_NP_CSM_NOSMT 0x0002
#define POSIX_SPAWN_NP_CSM_TECS 0x0004
int posix_spawn_file_actions_addinherit_np(posix_spawn_file_actions_t *,
int) __API_AVAILABLE(macos(10.7), ios(4.3)) __API_UNAVAILABLE(watchos, tvos);

View File

@ -217,7 +217,7 @@ __END_DECLS
/* Additional functionality provided by:
* POSIX.2-1992 C Language Binding Option
*/
#if TARGET_OS_IPHONE
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg)

View File

@ -178,7 +178,7 @@ unsigned long long
strtoull(const char *__str, char **__endptr, int __base);
#endif /* !__DARWIN_NO_LONG_LONG */
#if TARGET_OS_IPHONE
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg)
@ -347,9 +347,6 @@ int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__
void sranddev(void);
void srandomdev(void);
void *reallocf(void *__ptr, size_t __size) __alloc_size(2);
long long
strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp)
__API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0));
#if !__DARWIN_NO_LONG_LONG
long long
strtoq(const char *__str, char **__endptr, int __base);

View File

@ -170,10 +170,6 @@ void swab(const void * __restrict, void * __restrict, ssize_t);
__OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1)
__TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1)
int timingsafe_bcmp(const void *__b1, const void *__b2, size_t __len);
__OSX_AVAILABLE(11.0) __IOS_AVAILABLE(14.0)
__TVOS_AVAILABLE(14.0) __WATCHOS_AVAILABLE(7.0)
int strsignal_r(int __sig, char *__strsignalbuf, size_t __buflen);
__END_DECLS
/* Some functions historically defined in string.h were placed in strings.h

View File

@ -2,7 +2,7 @@
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@ -22,11 +22,11 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _PTHREAD_ATTR_T
#define _PTHREAD_ATTR_T
#ifndef _PTHREAD_ATTR_T
#define _PTHREAD_ATTR_T
#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_attr_t */
typedef __darwin_pthread_attr_t pthread_attr_t;
#endif /* _PTHREAD_ATTR_T */

View File

@ -2,7 +2,7 @@
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@ -22,7 +22,7 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _PTHREAD_COND_T

Some files were not shown because too many files have changed in this diff Show More