cbe: implement optional slice representation change

This commit is contained in:
Jacob Young 2022-10-29 05:58:41 -04:00
commit 48a2783969
378 changed files with 21802 additions and 38980 deletions

View File

@ -68,7 +68,7 @@ test and debug from a git working tree.
- `make` is typically sufficient to build zig during development iterations.
- `make install` performs a build __and__ install.
- `msbuild -p:Configuration=Release INSTALL.vcxproj` on Windows performs a
build and install. To avoid install, pass cmake option `-DZIG_SKIP_INSTALL_LIB_FILES=ON`.
build and install. To avoid install, pass cmake option `-DZIG_NO_LIB=ON`.
To test changes, do the following from the build directory:

View File

@ -14,27 +14,20 @@ body:
attributes:
label: Zig Version
description: "The output of `zig version`"
placeholder: "0.9.0-dev.1275+ac52e0056"
placeholder: "0.10.0-dev.4583+875e98a57"
validations:
required: true
- type: textarea
id: repro
attributes:
label: Steps to Reproduce
description: What exactly can someone else do, in order to observe the problem that you observed?
label: Steps to Reproduce and Observed Behavior
description: What exactly can someone else do, in order to observe the problem that you observed? Include the output and all error messages.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What did you expect to happen?
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual Behavior
description: What happened instead? Be sure to include all error messages if any.
description: What did you expect to happen instead?
validations:
required: true

View File

@ -81,13 +81,20 @@ if("${ZIG_VERSION}" STREQUAL "")
endif()
message(STATUS "Configuring zig version ${ZIG_VERSION}")
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL
set(ZIG_NO_LIB off CACHE BOOL
"Disable copying lib/ files to install prefix during the build phase")
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL "Deprecated. Use ZIG_NO_LIB")
if(ZIG_SKIP_INSTALL_LIB_FILES)
message(WARNING "ZIG_SKIP_INSTALL_LIB_FILES is deprecated. Use ZIG_NO_LIB instead.")
set(ZIG_NO_LIB ON)
endif()
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
set(ZIG_STATIC_ZLIB off CACHE BOOL "Prefer linking against static zlib")
set(ZIG_STATIC_ZSTD off CACHE BOOL "Prefer linking against static zstd")
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
@ -97,6 +104,7 @@ endif()
if(ZIG_STATIC)
set(ZIG_STATIC_LLVM ON)
set(ZIG_STATIC_ZLIB ON)
set(ZIG_STATIC_ZSTD ON)
endif()
if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
@ -137,6 +145,12 @@ if(ZIG_STATIC_ZLIB)
list(APPEND LLVM_LIBRARIES "${ZLIB}")
endif()
if(ZIG_STATIC_ZSTD)
list(REMOVE_ITEM LLVM_LIBRARIES "-lzstd")
find_library(ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR)
list(APPEND LLVM_LIBRARIES "${ZSTD}")
endif()
if(APPLE AND ZIG_STATIC)
list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
find_library(CURSES NAMES libcurses.a libncurses.a NAMES_PER_DIR
@ -996,10 +1010,10 @@ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
else()
set(ZIG_RELEASE_ARG -Drelease -Dstrip)
endif()
if(ZIG_SKIP_INSTALL_LIB_FILES)
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files")
if(ZIG_NO_LIB)
set(ZIG_NO_LIB_ARG "-Dno-lib")
else()
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files=false")
set(ZIG_NO_LIB_ARG "")
endif()
if(ZIG_SINGLE_THREADED)
set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded")
@ -1072,7 +1086,7 @@ set(ZIG_BUILD_ARGS
"-Denable-stage1"
${ZIG_RELEASE_ARG}
${ZIG_STATIC_ARG}
${ZIG_SKIP_INSTALL_LIB_FILES_ARG}
${ZIG_NO_LIB_ARG}
${ZIG_SINGLE_THREADED_ARG}
"-Dtarget=${ZIG_TARGET_TRIPLE}"
"-Dcpu=${ZIG_TARGET_MCPU}"

View File

@ -61,7 +61,11 @@ pub fn build(b: *Builder) !void {
const skip_stage1 = b.option(bool, "skip-stage1", "Main test suite skips stage1 compile error tests") orelse false;
const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false;
const skip_install_lib_files = b.option(bool, "skip-install-lib-files", "Do not copy lib/ files to installation prefix") orelse false;
const deprecated_skip_install_lib_files = b.option(bool, "skip-install-lib-files", "deprecated. see no-lib") orelse false;
if (deprecated_skip_install_lib_files) {
std.log.warn("-Dskip-install-lib-files is deprecated in favor of -Dno-lib", .{});
}
const skip_install_lib_files = b.option(bool, "no-lib", "skip copying of lib/ files to installation prefix. Useful for development") orelse deprecated_skip_install_lib_files;
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
@ -122,8 +126,8 @@ pub fn build(b: *Builder) !void {
return;
const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source");
const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse false;
const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse false;
const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse (tracy != null);
const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse (tracy != null);
const force_gpa = b.option(bool, "force-gpa", "Force the compiler to use GeneralPurposeAllocator") orelse false;
const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse (enable_llvm or only_c);
const sanitize_thread = b.option(bool, "sanitize-thread", "Enable thread-sanitization") orelse false;
@ -378,7 +382,7 @@ pub fn build(b: *Builder) !void {
if (tracy) |tracy_path| {
const client_cpp = fs.path.join(
b.allocator,
&[_][]const u8{ tracy_path, "TracyClient.cpp" },
&[_][]const u8{ tracy_path, "public", "TracyClient.cpp" },
) catch unreachable;
// On mingw, we need to opt into windows 7+ to get some features required by tracy.
@ -635,6 +639,7 @@ fn addStaticLlvmOptionsToExe(exe: *std.build.LibExeObjStep) !void {
}
exe.linkSystemLibrary("z");
exe.linkSystemLibrary("zstd");
// This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
exe.linkSystemLibrary("c++");
@ -673,13 +678,12 @@ fn addCxxKnownPath(
exe.addObjectFile(path_unpadded);
// TODO a way to integrate with system c++ include files here
// cc -E -Wp,-v -xc++ /dev/null
// c++ -E -Wp,-v -xc++ /dev/null
if (need_cpp_includes) {
// I used these temporarily for testing something but we obviously need a
// more general purpose solution here.
//exe.addIncludePath("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0");
//exe.addIncludePath("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0/x86_64-unknown-linux-gnu");
//exe.addIncludePath("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0/backward");
//exe.addIncludePath("/nix/store/2lr0fc0ak8rwj0k8n3shcyz1hz63wzma-gcc-11.3.0/include/c++/11.3.0");
//exe.addIncludePath("/nix/store/2lr0fc0ak8rwj0k8n3shcyz1hz63wzma-gcc-11.3.0/include/c++/11.3.0/x86_64-unknown-linux-gnu");
}
}

View File

@ -9,7 +9,7 @@ ZIGDIR="$(pwd)"
ARCH="x86_64"
TARGET="$ARCH-macos-none"
MCPU="baseline"
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4111+5206832a8"
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0"
PREFIX="$HOME/$CACHE_BASENAME"
JOBS="-j2"
@ -55,12 +55,26 @@ stage3-release/bin/zig build test docs \
-Dskip-non-native \
--search-prefix "$PREFIX"
# Produce the experimental std lib documentation.
mkdir -p "stage3-release/doc/std"
stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \
--zig-lib-dir "$(pwd)/../lib" \
-femit-docs="$(pwd)/stage3-release/doc/std" \
-fno-emit-bin
if [ "${BUILD_REASON}" != "PullRequest" ]; then
mv ../LICENSE stage3-release/
mv ../zig-cache/langref.html stage3-release/
# Remove the unnecessary bin dir in stage3-release/bin/zig
mv stage3-release/bin/zig stage3-release/
rmdir stage3-release/bin
# Remove the unnecessary zig dir in stage3-release/lib/zig/std/std.zig
mv stage3-release/lib/zig stage3-release/lib2
rmdir stage3-release/lib
mv stage3-release/lib2 stage3-release/lib
mv ../LICENSE stage3-release/
mv ../zig-cache/langref.html stage3-release/doc
VERSION=$(stage3-release/zig version)
DIRNAME="zig-macos-$ARCH-$VERSION"
TARBALL="$DIRNAME.tar.xz"

View File

@ -16,7 +16,7 @@ jobs:
vmImage: 'windows-2019'
variables:
TARGET: 'x86_64-windows-gnu'
ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.10.0-dev.4459+4f9345d20'
ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.10.0-dev.4560+828735ac0'
ZIG_LLVM_CLANG_LLD_URL: 'https://ziglang.org/deps/${{ variables.ZIG_LLVM_CLANG_LLD_NAME }}.zip'
steps:
- pwsh: |
@ -60,6 +60,7 @@ jobs:
displayName: 'Build'
- pwsh: |
Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib"
Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$(ZIG_LLVM_CLANG_LLD_NAME)"
@ -75,6 +76,14 @@ jobs:
-Dstatic-llvm `
-Dskip-non-native
CheckLastExitCode
# Produce the experimental std lib documentation.
mkdir "$ZIGINSTALLDIR\doc\std" -force
& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" `
--zig-lib-dir "$ZIGLIBDIR" `
-femit-docs="$ZIGINSTALLDIR\doc\std" `
-fno-emit-bin
name: test
displayName: 'Test'

View File

@ -9,56 +9,56 @@ platform:
steps:
- name: build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/linux_script_build
- name: behavior
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_behavior
- name: std_Debug
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_std_Debug
- name: std_ReleaseSafe
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_std_ReleaseSafe
- name: std_ReleaseFast
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_std_ReleaseFast
- name: std_ReleaseSmall
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_std_ReleaseSmall
- name: misc
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_misc
- name: cases
depends_on:
- build
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
commands:
- ./ci/drone/test_linux_cases
@ -72,7 +72,7 @@ steps:
- std_ReleaseSmall
- misc
- cases
image: ziglang/static-base:llvm15-aarch64-2
image: ziglang/static-base:llvm15-aarch64-3
environment:
SRHT_OAUTH_TOKEN:
from_secret: SRHT_OAUTH_TOKEN

View File

@ -12,17 +12,20 @@ if [ -n "$DRONE_PULL_REQUEST" ]; then
exit 0
fi
apk update
apk add py3-pip perl-utils jq curl
pip3 install s3cmd
cd build
# Remove the unnecessary bin dir in $INSTALL_PREFIX/bin/zig
mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
rmdir "$INSTALL_PREFIX/bin"
# Remove the unnecessary zig dir in $INSTALL_PREFIX/lib/zig/std/std.zig
mv "$INSTALL_PREFIX/lib/zig" "$INSTALL_PREFIX/lib2"
rmdir "$INSTALL_PREFIX/lib"
mv "$INSTALL_PREFIX/lib2" "$INSTALL_PREFIX/lib"
mv ../LICENSE "$INSTALL_PREFIX/"
# https://github.com/ziglang/zig/issues/12689
# mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
rmdir "$INSTALL_PREFIX/bin"
# mv ../zig-cache/langref.html "$INSTALL_PREFIX/doc/"
GITBRANCH="$DRONE_BRANCH"
VERSION="$("$INSTALL_PREFIX/zig" version)"

View File

@ -13,3 +13,10 @@ $ZIG build test-std \
-Dskip-release-fast \
-Dskip-release-small \
-Dskip-non-native
# Produce the experimental std lib documentation.
mkdir -p "$INSTALL_PREFIX/doc/std"
$ZIG test "$DRONE_WORKSPACE/lib/std/std.zig" \
--zig-lib-dir "$DRONE_WORKSPACE/lib" \
-femit-docs="$INSTALL_PREFIX/doc/std" \
-fno-emit-bin

View File

@ -62,12 +62,26 @@ stage3/bin/zig build test docs \
-Dskip-stage1 \
-Dskip-non-native
# Produce the experimental std lib documentation.
mkdir -p "stage3/doc/std"
stage3/bin/zig test "$(pwd)/../lib/std/std.zig" \
--zig-lib-dir "$(pwd)/../lib" \
-femit-docs="$(pwd)/stage3/doc/std/" \
-fno-emit-bin
if [ -f ~/.s3cfg ]; then
mv ../LICENSE stage3/
mv ../zig-cache/langref.html stage3/
# Remove the unnecessary bin dir in stage3/bin/zig
mv stage3/bin/zig stage3/
rmdir stage3/bin
# Remove the unnecessary zig dir in stage3/lib/zig/std/std.zig
mv stage3/lib/zig stage3/lib2
rmdir stage3/lib
mv stage3/lib2 stage3/lib
mv ../LICENSE stage3/
mv ../zig-cache/langref.html stage3/doc/
GITBRANCH=$(basename $GITHUB_REF)
VERSION=$(stage3/zig version)
DIRNAME="zig-freebsd-x86_64-$VERSION"

View File

@ -48,7 +48,7 @@ wget "https://ziglang.org/builds/$NATIVE_TARBALL"
tar xf "$NATIVE_TARBALL"
ZIGDIR="$(pwd)/$(basename $NATIVE_TARBALL .tar.xz)"
ZIG="$ZIGDIR/zig"
LANGREF="$ZIGDIR/docs/langref.html"
LANGREF="$ZIGDIR/doc/langref.html"
SRCTARBALLDIR="zig-$VERSION"
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
mv "$SRCDIR" "$SRCTARBALLDIR"
@ -120,20 +120,20 @@ $S3CMD put -P --no-mime-magic \
$S3CMD put -P --no-mime-magic \
--add-header="Cache-Control: max-age=0, must-revalidate" \
"$ZIGDIR/docs/std/index.html" s3://ziglang.org/documentation/master/std/index.html
"$ZIGDIR/doc/std/index.html" s3://ziglang.org/documentation/master/std/index.html
$S3CMD put -P --no-mime-magic \
--add-header="Cache-Control: max-age=0, must-revalidate" \
"$ZIGDIR/docs/std/main.js" s3://ziglang.org/documentation/master/std/main.js
"$ZIGDIR/doc/std/main.js" s3://ziglang.org/documentation/master/std/main.js
$S3CMD put -P --no-mime-magic \
--add-header="Cache-Control: max-age=0, must-revalidate" \
"$ZIGDIR/docs/std/data.js" s3://ziglang.org/documentation/master/std/data.js
"$ZIGDIR/doc/std/data.js" s3://ziglang.org/documentation/master/std/data.js
$S3CMD put -P --no-mime-magic --recursive \
--add-header="Cache-Control: max-age=0, must-revalidate" \
-m "text/html" \
"$ZIGDIR/docs/std/src/" s3://ziglang.org/documentation/master/std/src/
"$ZIGDIR/doc/std/src/" s3://ziglang.org/documentation/master/std/src/
$S3CMD put -P --no-mime-magic \
--add-header="cache-control: public, max-age=31536000, immutable" \

View File

@ -10,28 +10,28 @@ workspace:
steps:
- name: configure_git
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
commands:
- ./ci/zinc/configure_git
- name: test_stage3_debug
depends_on:
- configure_git
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
commands:
- ./ci/zinc/linux_test_stage3_debug
- name: test_stage3_release
depends_on:
- configure_git
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
commands:
- ./ci/zinc/linux_test_stage3_release
- name: build_aarch64_macos
depends_on:
- test_stage3_release
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
commands:
- ./ci/zinc/build_aarch64_macos
@ -44,7 +44,7 @@ steps:
- master
event:
- push
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
@ -62,7 +62,7 @@ steps:
- master
event:
- push
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
@ -80,7 +80,7 @@ steps:
- master
event:
- push
image: ci/debian-amd64:11.1-11
image: ci/debian-amd64:11.1-12
environment:
SRHT_OAUTH_TOKEN:
from_secret: SRHT_OAUTH_TOKEN

View File

@ -44,17 +44,17 @@ ninja install
--zig-lib-dir "$(pwd)/../lib"
# Produce the experimental std lib documentation.
mkdir -p "$RELEASE_STAGING/docs/std"
mkdir -p "$RELEASE_STAGING/doc/std"
"$RELEASE_STAGING/bin/zig" test ../lib/std/std.zig \
-femit-docs=$RELEASE_STAGING/docs/std \
-femit-docs=$RELEASE_STAGING/doc/std \
-fno-emit-bin \
--zig-lib-dir "$(pwd)/../lib"
cp ../LICENSE $RELEASE_STAGING/
cp ../zig-cache/langref.html $RELEASE_STAGING/docs/
cp ../zig-cache/langref.html $RELEASE_STAGING/doc/
# Look for HTML errors.
tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html
tidy --drop-empty-elements no -qe $RELEASE_STAGING/doc/langref.html
# Explicit exit helps show last command duration.
exit

View File

@ -24,7 +24,7 @@ mv $INSTALL_PREFIX/lib/zig $INSTALL_PREFIX/lib2
rmdir $INSTALL_PREFIX/lib
mv $INSTALL_PREFIX/lib2 $INSTALL_PREFIX/lib
cp -r "$ZIG_PREFIX/docs" "$INSTALL_PREFIX/"
cp -r "$ZIG_PREFIX/doc" "$INSTALL_PREFIX/"
cp "$ZIG_PREFIX/LICENSE" "$INSTALL_PREFIX/"
mv "$INSTALL_PREFIX" "$BASENAME"

View File

@ -1168,7 +1168,7 @@ fn printSourceBlock(allocator: Allocator, docgen_tokenizer: *Tokenizer, out: any
try out.writeAll("</pre></figure>");
}
fn printShell(out: anytype, shell_content: []const u8) !void {
fn printShell(out: anytype, shell_content: []const u8, escape: bool) !void {
const trimmed_shell_content = mem.trim(u8, shell_content, " \n");
try out.writeAll("<figure><figcaption class=\"shell-cap\">Shell</figcaption><pre><samp>");
var cmd_cont: bool = false;
@ -1176,15 +1176,41 @@ fn printShell(out: anytype, shell_content: []const u8) !void {
while (iter.next()) |orig_line| {
const line = mem.trimRight(u8, orig_line, " ");
if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] != '\\') {
try out.print(start_line ++ "$ <kbd>{s}</kbd>" ++ end_line ++ "\n", .{std.mem.trimLeft(u8, line[1..], " ")});
try out.writeAll(start_line ++ "$ <kbd>");
const s = std.mem.trimLeft(u8, line[1..], " ");
if (escape) {
try writeEscaped(out, s);
} else {
try out.writeAll(s);
}
try out.writeAll("</kbd>" ++ end_line ++ "\n");
} else if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] == '\\') {
try out.print(start_line ++ "$ <kbd>{s}" ++ end_line ++ "\n", .{std.mem.trimLeft(u8, line[1..], " ")});
try out.writeAll(start_line ++ "$ <kbd>");
const s = std.mem.trimLeft(u8, line[1..], " ");
if (escape) {
try writeEscaped(out, s);
} else {
try out.writeAll(s);
}
try out.writeAll(end_line ++ "\n");
cmd_cont = true;
} else if (line.len > 0 and line[line.len - 1] != '\\' and cmd_cont) {
try out.print(start_line ++ "{s}</kbd>" ++ end_line ++ "\n", .{line});
try out.writeAll(start_line);
if (escape) {
try writeEscaped(out, line);
} else {
try out.writeAll(line);
}
try out.writeAll("</kbd>" ++ end_line ++ "\n");
cmd_cont = false;
} else {
try out.print(start_line ++ "{s}" ++ end_line ++ "\n", .{line});
try out.writeAll(start_line);
if (escape) {
try writeEscaped(out, line);
} else {
try out.writeAll(line);
}
try out.writeAll(end_line ++ "\n");
}
}
@ -1254,7 +1280,7 @@ fn genHtml(
},
.Shell => |content_tok| {
const raw_shell_content = tokenizer.buffer[content_tok.start..content_tok.end];
try printShell(out, raw_shell_content);
try printShell(out, raw_shell_content, true);
},
.SyntaxBlock => |syntax_block| {
try printSourceBlock(allocator, tokenizer, out, syntax_block);
@ -1730,7 +1756,7 @@ fn genHtml(
}
if (!code.just_check_syntax) {
try printShell(out, shell_buffer.items);
try printShell(out, shell_buffer.items, false);
}
},
}
@ -1788,7 +1814,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
std.log.emerg("{s}", .{buffer.items});
try testing.expectEqualSlices(u8, expected, buffer.items);
}
@ -1806,7 +1832,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1825,7 +1851,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1846,7 +1872,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1865,7 +1891,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1888,7 +1914,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1910,7 +1936,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1927,7 +1953,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1946,7 +1972,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
{
@ -1961,7 +1987,7 @@ test "shell parsed" {
var buffer = std.ArrayList(u8).init(test_allocator);
defer buffer.deinit();
try printShell(buffer.writer(), shell_out);
try printShell(buffer.writer(), shell_out, false);
try testing.expectEqualSlices(u8, expected, buffer.items);
}
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__addkf3, .{ .name = "__addkf3", .linkage = common.linkage });
@export(__addtf3, .{ .name = "__addkf3", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage });
} else {
@export(__addtf3, .{ .name = "__addtf3", .linkage = common.linkage });
}
@export(__addtf3, .{ .name = "__addtf3", .linkage = common.linkage });
}
pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 {
return addf3(f128, a, b);
}
fn __addkf3(a: f128, b: f128) callconv(.C) f128 {
return addf3(f128, a, b);
}
fn _Qp_add(c: *f128, a: *f128, b: *f128) callconv(.C) void {
c.* = addf3(f128, a.*, b.*);
}

View File

@ -18,8 +18,10 @@ comptime {
@export(ceilf, .{ .name = "ceilf", .linkage = common.linkage });
@export(ceil, .{ .name = "ceil", .linkage = common.linkage });
@export(__ceilx, .{ .name = "__ceilx", .linkage = common.linkage });
const ceilq_sym_name = if (common.want_ppc_abi) "ceilf128" else "ceilq";
@export(ceilq, .{ .name = ceilq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(ceilq, .{ .name = "ceilf128", .linkage = common.linkage });
}
@export(ceilq, .{ .name = "ceilq", .linkage = common.linkage });
@export(ceill, .{ .name = "ceill", .linkage = common.linkage });
}

View File

@ -7,10 +7,10 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__eqkf2, .{ .name = "__eqkf2", .linkage = common.linkage });
@export(__nekf2, .{ .name = "__nekf2", .linkage = common.linkage });
@export(__ltkf2, .{ .name = "__ltkf2", .linkage = common.linkage });
@export(__lekf2, .{ .name = "__lekf2", .linkage = common.linkage });
@export(__eqtf2, .{ .name = "__eqkf2", .linkage = common.linkage });
@export(__netf2, .{ .name = "__nekf2", .linkage = common.linkage });
@export(__lttf2, .{ .name = "__ltkf2", .linkage = common.linkage });
@export(__letf2, .{ .name = "__lekf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = common.linkage });
@export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = common.linkage });
@ -19,13 +19,12 @@ comptime {
@export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = common.linkage });
@export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = common.linkage });
@export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = common.linkage });
} else {
@export(__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage });
@export(__netf2, .{ .name = "__netf2", .linkage = common.linkage });
@export(__letf2, .{ .name = "__letf2", .linkage = common.linkage });
@export(__cmptf2, .{ .name = "__cmptf2", .linkage = common.linkage });
@export(__lttf2, .{ .name = "__lttf2", .linkage = common.linkage });
}
@export(__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage });
@export(__netf2, .{ .name = "__netf2", .linkage = common.linkage });
@export(__letf2, .{ .name = "__letf2", .linkage = common.linkage });
@export(__cmptf2, .{ .name = "__cmptf2", .linkage = common.linkage });
@export(__lttf2, .{ .name = "__lttf2", .linkage = common.linkage });
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
@ -64,22 +63,6 @@ fn __lttf2(a: f128, b: f128) callconv(.C) i32 {
return __cmptf2(a, b);
}
fn __eqkf2(a: f128, b: f128) callconv(.C) i32 {
return __cmptf2(a, b);
}
fn __nekf2(a: f128, b: f128) callconv(.C) i32 {
return __cmptf2(a, b);
}
fn __ltkf2(a: f128, b: f128) callconv(.C) i32 {
return __cmptf2(a, b);
}
fn __lekf2(a: f128, b: f128) callconv(.C) i32 {
return __cmptf2(a, b);
}
const SparcFCMP = enum(i32) {
Equal = 0,
Less = 1,

View File

@ -16,8 +16,10 @@ comptime {
@export(cosf, .{ .name = "cosf", .linkage = common.linkage });
@export(cos, .{ .name = "cos", .linkage = common.linkage });
@export(__cosx, .{ .name = "__cosx", .linkage = common.linkage });
const cosq_sym_name = if (common.want_ppc_abi) "cosf128" else "cosq";
@export(cosq, .{ .name = cosq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(cosq, .{ .name = "cosf128", .linkage = common.linkage });
}
@export(cosq, .{ .name = "cosq", .linkage = common.linkage });
@export(cosl, .{ .name = "cosl", .linkage = common.linkage });
}

View File

@ -9,22 +9,18 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__divkf3, .{ .name = "__divkf3", .linkage = common.linkage });
// TODO: why did this not error?
@export(__divtf3, .{ .name = "__divkf3", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage });
} else {
@export(__divtf3, .{ .name = "__divtf3", .linkage = common.linkage });
}
@export(__divtf3, .{ .name = "__divtf3", .linkage = common.linkage });
}
pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 {
return div(a, b);
}
fn __divkf3(a: f128, b: f128) callconv(.C) f128 {
return div(a, b);
}
fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
c.* = div(a.*, b.*);
}

View File

@ -18,8 +18,10 @@ comptime {
@export(expf, .{ .name = "expf", .linkage = common.linkage });
@export(exp, .{ .name = "exp", .linkage = common.linkage });
@export(__expx, .{ .name = "__expx", .linkage = common.linkage });
const expq_sym_name = if (common.want_ppc_abi) "expf128" else "expq";
@export(expq, .{ .name = expq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(expq, .{ .name = "expf128", .linkage = common.linkage });
}
@export(expq, .{ .name = "expq", .linkage = common.linkage });
@export(expl, .{ .name = "expl", .linkage = common.linkage });
}

View File

@ -18,8 +18,10 @@ comptime {
@export(exp2f, .{ .name = "exp2f", .linkage = common.linkage });
@export(exp2, .{ .name = "exp2", .linkage = common.linkage });
@export(__exp2x, .{ .name = "__exp2x", .linkage = common.linkage });
const exp2q_sym_name = if (common.want_ppc_abi) "exp2f128" else "exp2q";
@export(exp2q, .{ .name = exp2q_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(exp2q, .{ .name = "exp2f128", .linkage = common.linkage });
}
@export(exp2q, .{ .name = "exp2q", .linkage = common.linkage });
@export(exp2l, .{ .name = "exp2l", .linkage = common.linkage });
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__extenddfkf2, .{ .name = "__extenddfkf2", .linkage = common.linkage });
@export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = common.linkage });
} else {
@export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage });
}
@export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage });
}
pub fn __extenddftf2(a: f64) callconv(.C) f128 {
return extendf(f128, f64, @bitCast(u64, a));
}
fn __extenddfkf2(a: f64) callconv(.C) f128 {
return extendf(f128, f64, @bitCast(u64, a));
}
fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void {
c.* = extendf(f128, f64, @bitCast(u64, a));
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__extendsfkf2, .{ .name = "__extendsfkf2", .linkage = common.linkage });
@export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage });
} else {
@export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage });
}
@export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage });
}
pub fn __extendsftf2(a: f32) callconv(.C) f128 {
return extendf(f128, f32, @bitCast(u32, a));
}
fn __extendsfkf2(a: f32) callconv(.C) f128 {
return extendf(f128, f32, @bitCast(u32, a));
}
fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void {
c.* = extendf(f128, f32, @bitCast(u32, a));
}

View File

@ -10,8 +10,10 @@ comptime {
@export(fabsf, .{ .name = "fabsf", .linkage = common.linkage });
@export(fabs, .{ .name = "fabs", .linkage = common.linkage });
@export(__fabsx, .{ .name = "__fabsx", .linkage = common.linkage });
const fabsq_sym_name = if (common.want_ppc_abi) "fabsf128" else "fabsq";
@export(fabsq, .{ .name = fabsq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(fabsq, .{ .name = "fabsf128", .linkage = common.linkage });
}
@export(fabsq, .{ .name = "fabsq", .linkage = common.linkage });
@export(fabsl, .{ .name = "fabsl", .linkage = common.linkage });
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixkfdi, .{ .name = "__fixkfdi", .linkage = common.linkage });
@export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = common.linkage });
} else {
@export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage });
}
@export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage });
}
pub fn __fixtfdi(a: f128) callconv(.C) i64 {
return floatToInt(i64, a);
}
fn __fixkfdi(a: f128) callconv(.C) i64 {
return floatToInt(i64, a);
}
fn _Qp_qtox(a: *const f128) callconv(.C) i64 {
return floatToInt(i64, a.*);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixkfsi, .{ .name = "__fixkfsi", .linkage = common.linkage });
@export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = common.linkage });
} else {
@export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage });
}
@export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage });
}
pub fn __fixtfsi(a: f128) callconv(.C) i32 {
return floatToInt(i32, a);
}
fn __fixkfsi(a: f128) callconv(.C) i32 {
return floatToInt(i32, a);
}
fn _Qp_qtoi(a: *const f128) callconv(.C) i32 {
return floatToInt(i32, a.*);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixunskfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage });
@export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage });
} else {
@export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage });
}
@export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage });
}
pub fn __fixunstfdi(a: f128) callconv(.C) u64 {
return floatToInt(u64, a);
}
fn __fixunskfdi(a: f128) callconv(.C) u64 {
return floatToInt(u64, a);
}
fn _Qp_qtoux(a: *const f128) callconv(.C) u64 {
return floatToInt(u64, a.*);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixunskfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage });
@export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage });
} else {
@export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage });
}
@export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage });
}
pub fn __fixunstfsi(a: f128) callconv(.C) u32 {
return floatToInt(u32, a);
}
fn __fixunskfsi(a: f128) callconv(.C) u32 {
return floatToInt(u32, a);
}
fn _Qp_qtoui(a: *const f128) callconv(.C) u32 {
return floatToInt(u32, a.*);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatdikf, .{ .name = "__floatdikf", .linkage = common.linkage });
@export(__floatditf, .{ .name = "__floatdikf", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = common.linkage });
} else {
@export(__floatditf, .{ .name = "__floatditf", .linkage = common.linkage });
}
@export(__floatditf, .{ .name = "__floatditf", .linkage = common.linkage });
}
pub fn __floatditf(a: i64) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn __floatdikf(a: i64) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void {
c.* = intToFloat(f128, a);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatsikf, .{ .name = "__floatsikf", .linkage = common.linkage });
@export(__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage });
} else {
@export(__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage });
}
@export(__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage });
}
pub fn __floatsitf(a: i32) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn __floatsikf(a: i32) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void {
c.* = intToFloat(f128, a);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatundikf, .{ .name = "__floatundikf", .linkage = common.linkage });
@export(__floatunditf, .{ .name = "__floatundikf", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage });
} else {
@export(__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage });
}
@export(__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage });
}
pub fn __floatunditf(a: u64) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn __floatundikf(a: u64) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void {
c.* = intToFloat(f128, a);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatunsikf, .{ .name = "__floatunsikf", .linkage = common.linkage });
@export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage });
} else {
@export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage });
}
@export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage });
}
pub fn __floatunsitf(a: u32) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn __floatunsikf(a: u32) callconv(.C) f128 {
return intToFloat(f128, a);
}
fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {
c.* = intToFloat(f128, a);
}

View File

@ -5,12 +5,13 @@ const intToFloat = @import("./int_to_float.zig").intToFloat;
pub const panic = common.panic;
comptime {
const symbol_name = if (common.want_ppc_abi) "__floatuntikf" else "__floatuntitf";
if (common.want_windows_v2u64_abi) {
@export(__floatuntitf_windows_x86_64, .{ .name = symbol_name, .linkage = common.linkage });
@export(__floatuntitf_windows_x86_64, .{ .name = "__floatuntitf", .linkage = common.linkage });
} else {
@export(__floatuntitf, .{ .name = symbol_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(__floatuntitf, .{ .name = "__floatuntikf", .linkage = common.linkage });
}
@export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = common.linkage });
}
}

View File

@ -18,8 +18,10 @@ comptime {
@export(floorf, .{ .name = "floorf", .linkage = common.linkage });
@export(floor, .{ .name = "floor", .linkage = common.linkage });
@export(__floorx, .{ .name = "__floorx", .linkage = common.linkage });
const floorq_sym_name = if (common.want_ppc_abi) "floorf128" else "floorq";
@export(floorq, .{ .name = floorq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(floorq, .{ .name = "floorf128", .linkage = common.linkage });
}
@export(floorq, .{ .name = "floorq", .linkage = common.linkage });
@export(floorl, .{ .name = "floorl", .linkage = common.linkage });
}

View File

@ -19,8 +19,10 @@ comptime {
@export(fmaf, .{ .name = "fmaf", .linkage = common.linkage });
@export(fma, .{ .name = "fma", .linkage = common.linkage });
@export(__fmax, .{ .name = "__fmax", .linkage = common.linkage });
const fmaq_sym_name = if (common.want_ppc_abi) "fmaf128" else "fmaq";
@export(fmaq, .{ .name = fmaq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(fmaq, .{ .name = "fmaf128", .linkage = common.linkage });
}
@export(fmaq, .{ .name = "fmaq", .linkage = common.linkage });
@export(fmal, .{ .name = "fmal", .linkage = common.linkage });
}

View File

@ -11,8 +11,10 @@ comptime {
@export(fmaxf, .{ .name = "fmaxf", .linkage = common.linkage });
@export(fmax, .{ .name = "fmax", .linkage = common.linkage });
@export(__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage });
const fmaxq_sym_name = if (common.want_ppc_abi) "fmaxf128" else "fmaxq";
@export(fmaxq, .{ .name = fmaxq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(fmaxq, .{ .name = "fmaxf128", .linkage = common.linkage });
}
@export(fmaxq, .{ .name = "fmaxq", .linkage = common.linkage });
@export(fmaxl, .{ .name = "fmaxl", .linkage = common.linkage });
}

View File

@ -11,8 +11,10 @@ comptime {
@export(fminf, .{ .name = "fminf", .linkage = common.linkage });
@export(fmin, .{ .name = "fmin", .linkage = common.linkage });
@export(__fminx, .{ .name = "__fminx", .linkage = common.linkage });
const fminq_sym_name = if (common.want_ppc_abi) "fminf128" else "fminq";
@export(fminq, .{ .name = fminq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(fminq, .{ .name = "fminf128", .linkage = common.linkage });
}
@export(fminq, .{ .name = "fminq", .linkage = common.linkage });
@export(fminl, .{ .name = "fminl", .linkage = common.linkage });
}

View File

@ -13,8 +13,10 @@ comptime {
@export(fmodf, .{ .name = "fmodf", .linkage = common.linkage });
@export(fmod, .{ .name = "fmod", .linkage = common.linkage });
@export(__fmodx, .{ .name = "__fmodx", .linkage = common.linkage });
const fmodq_sym_name = if (common.want_ppc_abi) "fmodf128" else "fmodq";
@export(fmodq, .{ .name = fmodq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(fmodq, .{ .name = "fmodf128", .linkage = common.linkage });
}
@export(fmodq, .{ .name = "fmodq", .linkage = common.linkage });
@export(fmodl, .{ .name = "fmodl", .linkage = common.linkage });
}

View File

@ -7,15 +7,14 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__gekf2, .{ .name = "__gekf2", .linkage = common.linkage });
@export(__gtkf2, .{ .name = "__gtkf2", .linkage = common.linkage });
@export(__getf2, .{ .name = "__gekf2", .linkage = common.linkage });
@export(__gttf2, .{ .name = "__gtkf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
// These exports are handled in cmptf2.zig because gt and ge on sparc
// are based on calling _Qp_cmp.
} else {
@export(__getf2, .{ .name = "__getf2", .linkage = common.linkage });
@export(__gttf2, .{ .name = "__gttf2", .linkage = common.linkage });
}
@export(__getf2, .{ .name = "__getf2", .linkage = common.linkage });
@export(__gttf2, .{ .name = "__gttf2", .linkage = common.linkage });
}
/// "These functions return a value greater than or equal to zero if neither
@ -29,11 +28,3 @@ fn __getf2(a: f128, b: f128) callconv(.C) i32 {
fn __gttf2(a: f128, b: f128) callconv(.C) i32 {
return __getf2(a, b);
}
fn __gekf2(a: f128, b: f128) callconv(.C) i32 {
return __getf2(a, b);
}
fn __gtkf2(a: f128, b: f128) callconv(.C) i32 {
return __getf2(a, b);
}

View File

@ -18,8 +18,10 @@ comptime {
@export(logf, .{ .name = "logf", .linkage = common.linkage });
@export(log, .{ .name = "log", .linkage = common.linkage });
@export(__logx, .{ .name = "__logx", .linkage = common.linkage });
const logq_sym_name = if (common.want_ppc_abi) "logf128" else "logq";
@export(logq, .{ .name = logq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(logq, .{ .name = "logf128", .linkage = common.linkage });
}
@export(logq, .{ .name = "logq", .linkage = common.linkage });
@export(logl, .{ .name = "logl", .linkage = common.linkage });
}

View File

@ -19,8 +19,10 @@ comptime {
@export(log10f, .{ .name = "log10f", .linkage = common.linkage });
@export(log10, .{ .name = "log10", .linkage = common.linkage });
@export(__log10x, .{ .name = "__log10x", .linkage = common.linkage });
const log10q_sym_name = if (common.want_ppc_abi) "log10f128" else "log10q";
@export(log10q, .{ .name = log10q_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(log10q, .{ .name = "log10f128", .linkage = common.linkage });
}
@export(log10q, .{ .name = "log10q", .linkage = common.linkage });
@export(log10l, .{ .name = "log10l", .linkage = common.linkage });
}

View File

@ -19,8 +19,10 @@ comptime {
@export(log2f, .{ .name = "log2f", .linkage = common.linkage });
@export(log2, .{ .name = "log2", .linkage = common.linkage });
@export(__log2x, .{ .name = "__log2x", .linkage = common.linkage });
const log2q_sym_name = if (common.want_ppc_abi) "log2f128" else "log2q";
@export(log2q, .{ .name = log2q_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(log2q, .{ .name = "log2f128", .linkage = common.linkage });
}
@export(log2q, .{ .name = "log2q", .linkage = common.linkage });
@export(log2l, .{ .name = "log2l", .linkage = common.linkage });
}

View File

@ -5,27 +5,26 @@ comptime {
@export(memcmp, .{ .name = "memcmp", .linkage = common.linkage });
}
pub fn memcmp(vl: ?[*]const u8, vr: ?[*]const u8, n: usize) callconv(.C) c_int {
@setRuntimeSafety(false);
var index: usize = 0;
while (index != n) : (index += 1) {
const compare_val = @bitCast(i8, vl.?[index] -% vr.?[index]);
if (compare_val != 0) {
return compare_val;
}
pub fn memcmp(vl: [*]const u8, vr: [*]const u8, n: usize) callconv(.C) c_int {
var i: usize = 0;
while (i < n) : (i += 1) {
const compared = @as(c_int, vl[i]) -% @as(c_int, vr[i]);
if (compared != 0) return compared;
}
return 0;
}
test "memcmp" {
const base_arr = &[_]u8{ 1, 1, 1 };
const arr0 = &[_]u8{ 1, 1, 1 };
const arr1 = &[_]u8{ 1, 1, 1 };
const arr2 = &[_]u8{ 1, 0, 1 };
const arr3 = &[_]u8{ 1, 2, 1 };
const arr4 = &[_]u8{ 1, 0xff, 1 };
try std.testing.expect(memcmp(base_arr[0..], arr1[0..], base_arr.len) == 0);
try std.testing.expect(memcmp(base_arr[0..], arr2[0..], base_arr.len) > 0);
try std.testing.expect(memcmp(base_arr[0..], arr3[0..], base_arr.len) < 0);
try std.testing.expect(memcmp(arr0, arr1, 3) == 0);
try std.testing.expect(memcmp(arr0, arr2, 3) > 0);
try std.testing.expect(memcmp(arr0, arr3, 3) < 0);
try std.testing.expect(memcmp(arr0, arr4, 3) < 0);
try std.testing.expect(memcmp(arr4, arr0, 3) > 0);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__mulkf3, .{ .name = "__mulkf3", .linkage = common.linkage });
@export(__multf3, .{ .name = "__mulkf3", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage });
} else {
@export(__multf3, .{ .name = "__multf3", .linkage = common.linkage });
}
@export(__multf3, .{ .name = "__multf3", .linkage = common.linkage });
}
pub fn __multf3(a: f128, b: f128) callconv(.C) f128 {
return mulf3(f128, a, b);
}
fn __mulkf3(a: f128, b: f128) callconv(.C) f128 {
return mulf3(f128, a, b);
}
fn _Qp_mul(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
c.* = mulf3(f128, a.*, b.*);
}

View File

@ -18,8 +18,10 @@ comptime {
@export(roundf, .{ .name = "roundf", .linkage = common.linkage });
@export(round, .{ .name = "round", .linkage = common.linkage });
@export(__roundx, .{ .name = "__roundx", .linkage = common.linkage });
const roundq_sym_name = if (common.want_ppc_abi) "roundf128" else "roundq";
@export(roundq, .{ .name = roundq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(roundq, .{ .name = "roundf128", .linkage = common.linkage });
}
@export(roundq, .{ .name = "roundq", .linkage = common.linkage });
@export(roundl, .{ .name = "roundl", .linkage = common.linkage });
}

View File

@ -22,8 +22,10 @@ comptime {
@export(sinf, .{ .name = "sinf", .linkage = common.linkage });
@export(sin, .{ .name = "sin", .linkage = common.linkage });
@export(__sinx, .{ .name = "__sinx", .linkage = common.linkage });
const sinq_sym_name = if (common.want_ppc_abi) "sinf128" else "sinq";
@export(sinq, .{ .name = sinq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(sinq, .{ .name = "sinf128", .linkage = common.linkage });
}
@export(sinq, .{ .name = "sinq", .linkage = common.linkage });
@export(sinl, .{ .name = "sinl", .linkage = common.linkage });
}

View File

@ -14,8 +14,10 @@ comptime {
@export(sincosf, .{ .name = "sincosf", .linkage = common.linkage });
@export(sincos, .{ .name = "sincos", .linkage = common.linkage });
@export(__sincosx, .{ .name = "__sincosx", .linkage = common.linkage });
const sincosq_sym_name = if (common.want_ppc_abi) "sincosf128" else "sincosq";
@export(sincosq, .{ .name = sincosq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(sincosq, .{ .name = "sincosf128", .linkage = common.linkage });
}
@export(sincosq, .{ .name = "sincosq", .linkage = common.linkage });
@export(sincosl, .{ .name = "sincosl", .linkage = common.linkage });
}

View File

@ -11,8 +11,10 @@ comptime {
@export(sqrtf, .{ .name = "sqrtf", .linkage = common.linkage });
@export(sqrt, .{ .name = "sqrt", .linkage = common.linkage });
@export(__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage });
const sqrtq_sym_name = if (common.want_ppc_abi) "sqrtf128" else "sqrtq";
@export(sqrtq, .{ .name = sqrtq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(sqrtq, .{ .name = "sqrtf128", .linkage = common.linkage });
}
@export(sqrtq, .{ .name = "sqrtq", .linkage = common.linkage });
@export(sqrtl, .{ .name = "sqrtl", .linkage = common.linkage });
}

View File

@ -4,22 +4,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__subkf3, .{ .name = "__subkf3", .linkage = common.linkage });
@export(__subtf3, .{ .name = "__subkf3", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage });
} else {
@export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage });
}
@export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage });
}
pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
return sub(a, b);
}
fn __subkf3(a: f128, b: f128) callconv(.C) f128 {
return sub(a, b);
}
fn _Qp_sub(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
c.* = sub(a.*, b.*);
}

View File

@ -18,8 +18,10 @@ comptime {
@export(truncf, .{ .name = "truncf", .linkage = common.linkage });
@export(trunc, .{ .name = "trunc", .linkage = common.linkage });
@export(__truncx, .{ .name = "__truncx", .linkage = common.linkage });
const truncq_sym_name = if (common.want_ppc_abi) "truncf128" else "truncq";
@export(truncq, .{ .name = truncq_sym_name, .linkage = common.linkage });
if (common.want_ppc_abi) {
@export(truncq, .{ .name = "truncf128", .linkage = common.linkage });
}
@export(truncq, .{ .name = "truncq", .linkage = common.linkage });
@export(truncl, .{ .name = "truncl", .linkage = common.linkage });
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__trunckfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage });
@export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage });
} else {
@export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage });
}
@export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage });
}
pub fn __trunctfdf2(a: f128) callconv(.C) f64 {
return truncf(f64, f128, a);
}
fn __trunckfdf2(a: f128) callconv(.C) f64 {
return truncf(f64, f128, a);
}
fn _Qp_qtod(a: *const f128) callconv(.C) f64 {
return truncf(f64, f128, a.*);
}

View File

@ -5,22 +5,17 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__trunckfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage });
@export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
@export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = common.linkage });
} else {
@export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage });
}
@export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage });
}
pub fn __trunctfsf2(a: f128) callconv(.C) f32 {
return truncf(f32, f128, a);
}
fn __trunckfsf2(a: f128) callconv(.C) f32 {
return truncf(f32, f128, a);
}
fn _Qp_qtos(a: *const f128) callconv(.C) f32 {
return truncf(f32, f128, a.*);
}

View File

@ -5,19 +5,14 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__unordkf2, .{ .name = "__unordkf2", .linkage = common.linkage });
@export(__unordtf2, .{ .name = "__unordkf2", .linkage = common.linkage });
} else if (common.want_sparc_abi) {
// These exports are handled in cmptf2.zig because unordered comparisons
// are based on calling _Qp_cmp.
} else {
@export(__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage });
}
@export(__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage });
}
fn __unordtf2(a: f128, b: f128) callconv(.C) i32 {
return comparef.unordcmp(f128, a, b);
}
fn __unordkf2(a: f128, b: f128) callconv(.C) i32 {
return comparef.unordcmp(f128, a, b);
}

File diff suppressed because it is too large Load Diff

3931
lib/libc/darwin/libSystem.13.tbd vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
/*
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
*/
#ifndef _ARM__LIMITS_H_
#define _ARM__LIMITS_H_
#if defined (__arm__) || defined (__arm64__)
#define __DARWIN_CLK_TCK 100 /* ticks per second */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM__LIMITS_H_ */

View File

@ -0,0 +1,95 @@
/*
* 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
* 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 __ARM_MCONTEXT_H_
#define __ARM_MCONTEXT_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
#include <sys/appleapiopts.h>
#include <mach/machine/_structs.h>
#ifndef _STRUCT_MCONTEXT32
#if __DARWIN_UNIX03
#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
_STRUCT_MCONTEXT32
{
_STRUCT_ARM_EXCEPTION_STATE __es;
_STRUCT_ARM_THREAD_STATE __ss;
_STRUCT_ARM_VFP_STATE __fs;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_MCONTEXT32 struct mcontext32
_STRUCT_MCONTEXT32
{
_STRUCT_ARM_EXCEPTION_STATE es;
_STRUCT_ARM_THREAD_STATE ss;
_STRUCT_ARM_VFP_STATE fs;
};
#endif /* __DARWIN_UNIX03 */
#endif /* _STRUCT_MCONTEXT32 */
#ifndef _STRUCT_MCONTEXT64
#if __DARWIN_UNIX03
#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
_STRUCT_MCONTEXT64
{
_STRUCT_ARM_EXCEPTION_STATE64 __es;
_STRUCT_ARM_THREAD_STATE64 __ss;
_STRUCT_ARM_NEON_STATE64 __ns;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_MCONTEXT64 struct mcontext64
_STRUCT_MCONTEXT64
{
_STRUCT_ARM_EXCEPTION_STATE64 es;
_STRUCT_ARM_THREAD_STATE64 ss;
_STRUCT_ARM_NEON_STATE64 ns;
};
#endif /* __DARWIN_UNIX03 */
#endif /* _STRUCT_MCONTEXT32 */
#ifndef _MCONTEXT_T
#define _MCONTEXT_T
#if defined(__arm64__)
typedef _STRUCT_MCONTEXT64 *mcontext_t;
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
#else
typedef _STRUCT_MCONTEXT32 *mcontext_t;
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
#endif
#endif /* _MCONTEXT_T */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* __ARM_MCONTEXT_H_ */

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
*/
#ifndef _ARM__PARAM_H_
#define _ARM__PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#include <arm/_types.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
* data types (int, long, ...). The result is unsigned int and must be
* 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_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM__PARAM_H_ */

View File

@ -0,0 +1,102 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
#ifndef _BSD_ARM__TYPES_H_
#define _BSD_ARM__TYPES_H_
#if defined (__arm__) || defined (__arm64__)
/*
* This header file contains integer types. It's intended to also contain
* flotaing point and other arithmetic types, as needed, later.
*/
#ifdef __GNUC__
typedef __signed char __int8_t;
#else /* !__GNUC__ */
typedef char __int8_t;
#endif /* !__GNUC__ */
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
typedef long __darwin_intptr_t;
typedef unsigned int __darwin_natural_t;
/*
* The rune type below is declared to be an ``int'' instead of the more natural
* ``unsigned long'' or ``long''. Two things are happening here. It is not
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
* it looks like 10646 will be a 31 bit standard. This means that if your
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
* chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
* here, you lose a bit of ANSI conformance, but your programs will still
* work.
*
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
* be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
* rune_t must be the same type. Also wint_t must be no narrower than
* wchar_t, and should also be able to hold all members of the largest
* character set plus one extra value (WEOF). wint_t must be at least 16 bits.
*/
typedef int __darwin_ct_rune_t; /* ct_rune_t */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
typedef union {
char __mbstate8[128];
long long _mbstateL; /* for alignment */
} __mbstate_t;
typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
#if defined(__PTRDIFF_TYPE__)
typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#elif defined(__LP64__)
typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#else
typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#endif /* __GNUC__ */
#if defined(__SIZE_TYPE__)
typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
#else
typedef unsigned long __darwin_size_t; /* sizeof() */
#endif
#if (__GNUC__ > 2)
typedef __builtin_va_list __darwin_va_list; /* va_list */
#else
typedef void * __darwin_va_list; /* va_list */
#endif
#if defined(__WCHAR_TYPE__)
typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
#else
typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
#endif
typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
#if defined(__WINT_TYPE__)
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
#else
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
#endif
typedef unsigned long __darwin_clock_t; /* clock() */
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
typedef long __darwin_ssize_t; /* byte count or error */
typedef long __darwin_time_t; /* time() */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _BSD_ARM__TYPES_H_ */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Apple Inc. All rights reserved.
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -25,18 +25,47 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_ARCH_H
#define _ARM_ARCH_H
#ifndef __GETHOSTUUID_H
#define __GETHOSTUUID_H
#if defined (__arm__) || defined (__arm64__)
#include <sys/_types/_timespec.h>
#include <sys/_types/_uuid_t.h>
#include <Availability.h>
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0, "gethostuuid() is no longer supported");
#else
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
/* Collect the __ARM_ARCH_*__ compiler flags into something easier to use. */
#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__)
#define _ARM_ARCH_7
#endif
#endif /* __GETHOSTUUID_H */
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
#define _ARM_ARCH_6K
#endif
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
#define _ARM_ARCH_6Z
#endif
#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
defined (_ARM_ARCH_6Z) || defined (_ARM_ARCH_6K)
#define _ARM_ARCH_6
#endif
#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5E__) || \
defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__)
#define _ARM_ARCH_5E
#endif
#if defined (_ARM_ARCH_5E) || defined (__ARM_ARCH_5__) || \
defined (__ARM_ARCH_5T__)
#define _ARM_ARCH_5
#endif
#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
#define _ARM_ARCH_4T
#endif
#if defined (_ARM_ARCH_4T) || defined (__ARM_ARCH_4__)
#define _ARM_ARCH_4
#endif
#endif /* defined (__arm__) || defined (__arm64__) */
#endif

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
/*
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)endian.h 8.1 (Berkeley) 6/11/93
*/
#ifndef _ARM__ENDIAN_H_
#define _ARM__ENDIAN_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
/*
* Define _NOQUAD if the compiler does NOT support 64-bit integers.
*/
/* #define _NOQUAD */
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define __DARWIN_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define __DARWIN_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define __DARWIN_PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN
#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
#define PDP_ENDIAN __DARWIN_PDP_ENDIAN
#define BYTE_ORDER __DARWIN_BYTE_ORDER
#include <sys/_endian.h>
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* !_ARM__ENDIAN_H_ */

View File

@ -0,0 +1,114 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
*/
#ifndef _ARM_LIMITS_H_
#define _ARM_LIMITS_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
#include <arm/_limits.h>
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions. The subtraction for
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
* are written as hex so that GCC will be quiet about large integer constants.
*/
#define SCHAR_MAX 127 /* min value for a signed char */
#define SCHAR_MIN (-128) /* max value for a signed char */
#define UCHAR_MAX 255 /* max value for an unsigned char */
#define CHAR_MAX 127 /* max value for a char */
#define CHAR_MIN (-128) /* min value for a char */
#define USHRT_MAX 65535 /* max value for an unsigned short */
#define SHRT_MAX 32767 /* max value for a short */
#define SHRT_MIN (-32768) /* min value for a short */
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
#define INT_MAX 2147483647 /* max value for an int */
#define INT_MIN (-2147483647-1) /* min value for an int */
#ifdef __LP64__
#define ULONG_MAX 0xffffffffffffffffUL /* max unsigned long */
#define LONG_MAX 0x7fffffffffffffffL /* max signed long */
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min signed long */
#else /* !__LP64__ */
#define ULONG_MAX 0xffffffffUL /* max unsigned long */
#define LONG_MAX 2147483647L /* max signed long */
#define LONG_MIN (-2147483647L-1) /* min signed long */
#endif /* __LP64__ */
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
#if !defined(_ANSI_SOURCE)
#ifdef __LP64__
#define LONG_BIT 64
#else /* !__LP64__ */
#define LONG_BIT 32
#endif /* __LP64__ */
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
#define WORD_BIT 32
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
#define UQUAD_MAX ULLONG_MAX
#define QUAD_MAX LLONG_MAX
#define QUAD_MIN LLONG_MIN
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
#endif /* !_ANSI_SOURCE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_LIMITS_H_ */

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2000-2010 Apple Inc. All rights reserved.
*/
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)param.h 8.1 (Berkeley) 4/4/95
*/
/*
* Machine dependent constants for ARM
*/
#ifndef _ARM_PARAM_H_
#define _ARM_PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#include <arm/_param.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
* data types (int, long, ...). The result is unsigned int and must be
* cast to any desired pointer type.
*/
#define ALIGNBYTES __DARWIN_ALIGNBYTES
#define ALIGN(p) __DARWIN_ALIGN(p)
#define NBPG 4096 /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
#define PGSHIFT 12 /* LOG2(NBPG) */
#define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define BLKDEV_IOSIZE 2048
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
#define CLSIZE 1
#define CLSIZELOG2 0
/*
* Constants related to network buffer management.
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
* on machines that exchange pages of input or output buffers with mbuf
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
* of the hardware page size.
*/
#define MSIZESHIFT 8 /* 256 */
#define MSIZE (1 << MSIZESHIFT) /* size of an mbuf */
#define MCLSHIFT 11 /* 2048 */
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
#define MBIGCLSHIFT 12 /* 4096 */
#define MBIGCLBYTES (1 << MBIGCLSHIFT) /* size of a big cluster */
#define M16KCLSHIFT 14 /* 16384 */
#define M16KCLBYTES (1 << M16KCLSHIFT) /* size of a jumbo cluster */
#define MCLOFSET (MCLBYTES - 1)
#ifndef NMBCLUSTERS
#define NMBCLUSTERS CONFIG_NMBCLUSTERS /* cl map size */
#endif
/*
* Some macros for units conversion
*/
/* Core clicks (NeXT_page_size bytes) to segments and vice versa */
#define ctos(x) (x)
#define stoc(x) (x)
/* Core clicks (4096 bytes) to disk blocks */
#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
#define dtob(x) ((x)<<DEV_BSHIFT)
/* clicks to bytes */
#define ctob(x) ((x)<<PGSHIFT)
/* bytes to clicks */
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
#ifdef __APPLE__
#define btodb(bytes, devBlockSize) \
((unsigned)(bytes) / devBlockSize)
#define dbtob(db, devBlockSize) \
((unsigned)(db) * devBlockSize)
#else
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
((unsigned)(bytes) >> DEV_BSHIFT)
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
((unsigned)(db) << DEV_BSHIFT)
#endif
/*
* Map a ``block device block'' to a file system block.
* This should be device dependent, and will be if we
* add an entry to cdevsw/bdevsw for that purpose.
* For now though just use DEV_BSIZE.
*/
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
/*
* Macros to decode (and encode) processor status word.
*/
#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl))
#define USERMODE(x) (((x) & 3) == 3)
#define BASEPRI(x) (((x) & (255 << 8)) == 0)
#if defined(KERNEL) || defined(STANDALONE)
#define DELAY(n) delay(n)
#else /* defined(KERNEL) || defined(STANDALONE) */
#define DELAY(n) { int N = (n); while (--N > 0); }
#endif /* defined(KERNEL) || defined(STANDALONE) */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_PARAM_H_ */

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2000-2009 Apple, Inc. All rights reserved.
*/
/*
* Copyright (c) 1992 NeXT Computer, Inc.
*
*/
#ifndef _ARM_SIGNAL_
#define _ARM_SIGNAL_ 1
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
#ifndef _ANSI_SOURCE
typedef int sig_atomic_t;
#endif /* ! _ANSI_SOURCE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_SIGNAL_ */

View File

@ -0,0 +1,111 @@
/*
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
*/
#ifndef _ARM_MACHTYPES_H_
#define _ARM_MACHTYPES_H_
#define _MACHTYPES_H_
#if defined (__arm__) || defined (__arm64__)
#ifndef __ASSEMBLER__
#include <arm/_types.h>
#include <sys/cdefs.h>
/*
* Basic integral types. Omit the typedef if
* not possible for a machine/compiler combination.
*/
#include <sys/_types/_int8_t.h>
#include <sys/_types/_int16_t.h>
#include <sys/_types/_int32_t.h>
#include <sys/_types/_int64_t.h>
#include <sys/_types/_u_int8_t.h>
#include <sys/_types/_u_int16_t.h>
#include <sys/_types/_u_int32_t.h>
#include <sys/_types/_u_int64_t.h>
#if __LP64__
typedef int64_t register_t;
#else
typedef int32_t register_t;
#endif
#include <sys/_types/_intptr_t.h>
#include <sys/_types/_uintptr_t.h>
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
/* These types are used for reserving the largest possible size. */
#ifdef __arm64__
typedef u_int64_t user_addr_t;
typedef u_int64_t user_size_t;
typedef int64_t user_ssize_t;
typedef int64_t user_long_t;
typedef u_int64_t user_ulong_t;
typedef int64_t user_time_t;
typedef int64_t user_off_t;
#else
typedef u_int32_t user_addr_t;
typedef u_int32_t user_size_t;
typedef int32_t user_ssize_t;
typedef int32_t user_long_t;
typedef u_int32_t user_ulong_t;
typedef int32_t user_time_t;
typedef int64_t user_off_t;
#endif
#define USER_ADDR_NULL ((user_addr_t) 0)
#define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr)))
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/* This defines the size of syscall arguments after copying into the kernel: */
#if defined(__arm__)
typedef u_int32_t syscall_arg_t;
#elif defined(__arm64__)
typedef u_int64_t syscall_arg_t;
#else
#error Unknown architecture.
#endif
#endif /* __ASSEMBLER__ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_MACHTYPES_H_ */

View File

@ -35,13 +35,14 @@
* 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
@ -161,7 +162,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
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT
/*! @abstract Atomically increments a 32-bit value.
@result Returns the new value.
@ -248,7 +249,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
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT
/*! @abstract Atomically increments a 64-bit value.
@result Returns the new value.
@ -361,7 +362,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>.
@ -481,7 +482,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,
@ -587,7 +588,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.
*/
@ -606,7 +607,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.
*/
@ -706,7 +707,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.
*/
@ -719,15 +720,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
@ -736,7 +737,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 */
@ -1174,4 +1175,92 @@ __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,6 +28,7 @@
#include <sys/cdefs.h>
#include <stdint.h>
#include <stdbool.h>
#include "OSAtomicDeprecated.h"
#include <Availability.h>
@ -109,83 +110,6 @@ 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

@ -0,0 +1,216 @@
/*
* Copyright (c) 1999-2007 Apple Inc. All rights reserved.
*/
#ifndef _OS_OSBYTEORDERARM_H
#define _OS_OSBYTEORDERARM_H
#include <stdint.h>
#include <arm/arch.h> /* for _ARM_ARCH_6 */
/* Generic byte swapping functions. */
__DARWIN_OS_INLINE
uint16_t
_OSSwapInt16(
uint16_t _data
)
{
/* Reduces to 'rev16' with clang */
return (uint16_t)(_data << 8 | _data >> 8);
}
__DARWIN_OS_INLINE
uint32_t
_OSSwapInt32(
uint32_t _data
)
{
#if defined(__llvm__)
_data = __builtin_bswap32(_data);
#else
/* This actually generates the best code */
_data = (((_data ^ (_data >> 16 | (_data << 16))) & 0xFF00FFFF) >> 8) ^ (_data >> 8 | _data << 24);
#endif
return _data;
}
__DARWIN_OS_INLINE
uint64_t
_OSSwapInt64(
uint64_t _data
)
{
#if defined(__llvm__)
return __builtin_bswap64(_data);
#else
union {
uint64_t _ull;
uint32_t _ul[2];
} _u;
/* This actually generates the best code */
_u._ul[0] = (uint32_t)(_data >> 32);
_u._ul[1] = (uint32_t)(_data & 0xffffffff);
_u._ul[0] = _OSSwapInt32(_u._ul[0]);
_u._ul[1] = _OSSwapInt32(_u._ul[1]);
return _u._ull;
#endif
}
/* Functions for byte reversed loads. */
struct _OSUnalignedU16 {
volatile uint16_t __val;
} __attribute__((__packed__));
struct _OSUnalignedU32 {
volatile uint32_t __val;
} __attribute__((__packed__));
struct _OSUnalignedU64 {
volatile uint64_t __val;
} __attribute__((__packed__));
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
uint16_t
_OSReadSwapInt16(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
}
#else
__DARWIN_OS_INLINE
uint16_t
OSReadSwapInt16(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
uint32_t
_OSReadSwapInt32(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
}
#else
__DARWIN_OS_INLINE
uint32_t
OSReadSwapInt32(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
uint64_t
_OSReadSwapInt64(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
}
#else
__DARWIN_OS_INLINE
uint64_t
OSReadSwapInt64(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
}
#endif
/* Functions for byte reversed stores. */
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
void
_OSWriteSwapInt16(
volatile void * _base,
uintptr_t _offset,
uint16_t _data
)
{
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
}
#else
__DARWIN_OS_INLINE
void
OSWriteSwapInt16(
volatile void * _base,
uintptr_t _offset,
uint16_t _data
)
{
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
void
_OSWriteSwapInt32(
volatile void * _base,
uintptr_t _offset,
uint32_t _data
)
{
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
}
#else
__DARWIN_OS_INLINE
void
OSWriteSwapInt32(
volatile void * _base,
uintptr_t _offset,
uint32_t _data
)
{
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
void
_OSWriteSwapInt64(
volatile void * _base,
uintptr_t _offset,
uint64_t _data
)
{
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
}
#else
__DARWIN_OS_INLINE
void
OSWriteSwapInt64(
volatile void * _base,
uintptr_t _offset,
uint64_t _data
)
{
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
}
#endif
#endif /* ! _OS_OSBYTEORDERARM_H */

View File

@ -0,0 +1,683 @@
/*
* Copyright (c) 2004-2007 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
* 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@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_ARM__STRUCTS_H_
#define _MACH_ARM__STRUCTS_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
#include <machine/types.h> /* __uint32_t */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state
_STRUCT_ARM_EXCEPTION_STATE
{
__uint32_t __exception; /* number of arm exception taken */
__uint32_t __fsr; /* Fault status */
__uint32_t __far; /* Virtual Fault Address */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state
_STRUCT_ARM_EXCEPTION_STATE
{
__uint32_t exception; /* number of arm exception taken */
__uint32_t fsr; /* Fault status */
__uint32_t far; /* Virtual Fault Address */
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64
_STRUCT_ARM_EXCEPTION_STATE64
{
__uint64_t __far; /* Virtual Fault Address */
__uint32_t __esr; /* Exception syndrome */
__uint32_t __exception; /* number of arm exception taken */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64
_STRUCT_ARM_EXCEPTION_STATE64
{
__uint64_t far; /* Virtual Fault Address */
__uint32_t esr; /* Exception syndrome */
__uint32_t exception; /* number of arm exception taken */
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state
_STRUCT_ARM_THREAD_STATE
{
__uint32_t __r[13]; /* General purpose register r0-r12 */
__uint32_t __sp; /* Stack pointer r13 */
__uint32_t __lr; /* Link register r14 */
__uint32_t __pc; /* Program counter r15 */
__uint32_t __cpsr; /* Current program status register */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_THREAD_STATE struct arm_thread_state
_STRUCT_ARM_THREAD_STATE
{
__uint32_t r[13]; /* General purpose register r0-r12 */
__uint32_t sp; /* Stack pointer r13 */
__uint32_t lr; /* Link register r14 */
__uint32_t pc; /* Program counter r15 */
__uint32_t cpsr; /* Current program status register */
};
#endif /* __DARWIN_UNIX03 */
/*
* By default, the pointer fields in the arm_thread_state64_t structure are
* opaque on the arm64e architecture and require the use of accessor macros.
* This mode can also be enabled on the arm64 architecture by building with
* -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
*/
#if defined(__arm64__) && defined(__LP64__)
#if __has_feature(ptrauth_calls)
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
#endif /* __has_feature(ptrauth_calls) */
#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
#endif
#else /* defined(__arm64__) && defined(__LP64__) */
#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
#endif /* defined(__arm64__) && defined(__LP64__) */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t __x[29]; /* General purpose registers x0-x28 */
void* __opaque_fp; /* Frame pointer x29 */
void* __opaque_lr; /* Link register x30 */
void* __opaque_sp; /* Stack pointer x31 */
void* __opaque_pc; /* Program counter */
__uint32_t __cpsr; /* Current program status register */
__uint32_t __opaque_flags; /* Flags describing structure format */
};
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t __x[29]; /* General purpose registers x0-x28 */
__uint64_t __fp; /* Frame pointer x29 */
__uint64_t __lr; /* Link register x30 */
__uint64_t __sp; /* Stack pointer x31 */
__uint64_t __pc; /* Program counter */
__uint32_t __cpsr; /* Current program status register */
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
};
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t x[29]; /* General purpose registers x0-x28 */
void* __opaque_fp; /* Frame pointer x29 */
void* __opaque_lr; /* Link register x30 */
void* __opaque_sp; /* Stack pointer x31 */
void* __opaque_pc; /* Program counter */
__uint32_t cpsr; /* Current program status register */
__uint32_t __opaque_flags; /* Flags describing structure format */
};
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t x[29]; /* General purpose registers x0-x28 */
__uint64_t fp; /* Frame pointer x29 */
__uint64_t lr; /* Link register x30 */
__uint64_t sp; /* Stack pointer x31 */
__uint64_t pc; /* Program counter */
__uint32_t cpsr; /* Current program status register */
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
};
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
/* Accessor macros for arm_thread_state64_t pointer fields */
#if __has_feature(ptrauth_calls) && defined(__LP64__)
#include <ptrauth.h>
#if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64
#error "Invalid configuration"
#endif
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC 0x4
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR 0x8
#define __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK 0xff000000
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_data(__tsp->__opaque_pc, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("pc")) : \
ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); })
/* Return pc field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_function(__tsp->__opaque_pc, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("pc")) : \
ptrauth_string_discriminator("pc")) : NULL); })
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
__typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \
(__f ? (!(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
ptrauth_key_process_independent_code, \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("pc")) : \
ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \
ptrauth_key_function_pointer, 0)) : __f); \
__tsp->__opaque_flags &= \
~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC; })
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
ptrauth_auth_data(__tsp->__opaque_lr, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("lr")) : \
ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); })
/* Return lr field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
ptrauth_auth_function(__tsp->__opaque_lr, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("lr")) : \
ptrauth_string_discriminator("lr")) : NULL); })
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
__typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \
(__f ? (!(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \
&= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
ptrauth_key_process_independent_code, \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("lr")) : \
ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \
ptrauth_key_function_pointer, 0)) : __f); __tsp->__opaque_flags &= \
~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR; })
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_data(__tsp->__opaque_sp, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); })
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \
(__p && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_sign_unauthenticated(__p, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("sp")) : __p); })
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_data(__tsp->__opaque_fp, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); })
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \
(__p && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_sign_unauthenticated(__p, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("fp")) : __p); })
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
__tsp->__opaque_pc = ((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \
ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \
__tsp->__opaque_lr = ((__tsp->__opaque_flags & \
(__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \
ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \
__tsp->__opaque_sp = ((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \
ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \
__tsp->__opaque_fp = ((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \
ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \
__tsp->__opaque_flags |= \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; __tsp->__opaque_flags &= \
~(__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR); })
#else /* __has_feature(ptrauth_calls) && defined(__LP64__) */
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
#ifndef __LP64__
#error "Invalid configuration"
#endif
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
((uintptr_t)((ts).__opaque_pc))
/* Return pc field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
((ts).__opaque_pc)
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
((ts).__opaque_pc = (fptr))
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
((uintptr_t)((ts).__opaque_lr))
/* Return lr field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
((ts).__opaque_lr)
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
((ts).__opaque_lr = (fptr))
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
((uintptr_t)((ts).__opaque_sp))
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
((ts).__opaque_sp = (void*)(uintptr_t)(ptr))
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
((uintptr_t)((ts).__opaque_fp))
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
((ts).__opaque_fp = (void*)(uintptr_t)(ptr))
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
(void)(ts)
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#if __DARWIN_UNIX03
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
((ts).__pc)
/* Return pc field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
((void*)(uintptr_t)((ts).__pc))
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
((ts).__pc = (uintptr_t)(fptr))
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
((ts).__lr)
/* Return lr field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
((void*)(uintptr_t)((ts).__lr))
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
((ts).__lr = (uintptr_t)(fptr))
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
((ts).__sp)
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
((ts).__sp = (uintptr_t)(ptr))
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
((ts).__fp)
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
((ts).__fp = (uintptr_t)(ptr))
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
(void)(ts)
#else /* __DARWIN_UNIX03 */
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
((ts).pc)
/* Return pc field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
((void*)(uintptr_t)((ts).pc))
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
((ts).pc = (uintptr_t)(fptr))
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
((ts).lr)
/* Return lr field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
((void*)(uintptr_t)((ts).lr))
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
((ts).lr = (uintptr_t)(fptr))
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
((ts).sp)
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
((ts).sp = (uintptr_t)(ptr))
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
((ts).fp)
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
((ts).fp = (uintptr_t)(ptr))
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
(void)(ts)
#endif /* __DARWIN_UNIX03 */
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state
_STRUCT_ARM_VFP_STATE
{
__uint32_t __r[64];
__uint32_t __fpscr;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_VFP_STATE struct arm_vfp_state
_STRUCT_ARM_VFP_STATE
{
__uint32_t r[64];
__uint32_t fpscr;
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64
#define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state
#if defined(__arm64__)
_STRUCT_ARM_NEON_STATE64
{
__uint128_t __v[32];
__uint32_t __fpsr;
__uint32_t __fpcr;
};
_STRUCT_ARM_NEON_STATE
{
__uint128_t __v[16];
__uint32_t __fpsr;
__uint32_t __fpcr;
};
#elif defined(__arm__)
/*
* No 128-bit intrinsic for ARM; leave it opaque for now.
*/
_STRUCT_ARM_NEON_STATE64
{
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
_STRUCT_ARM_NEON_STATE
{
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
#else
#error Unknown architecture.
#endif
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64
#define _STRUCT_ARM_NEON_STATE struct arm_neon_state
#if defined(__arm64__)
_STRUCT_ARM_NEON_STATE64
{
__uint128_t q[32];
uint32_t fpsr;
uint32_t fpcr;
};
_STRUCT_ARM_NEON_STATE
{
__uint128_t q[16];
uint32_t fpsr;
uint32_t fpcr;
};
#elif defined(__arm__)
/*
* No 128-bit intrinsic for ARM; leave it opaque for now.
*/
_STRUCT_ARM_NEON_STATE64
{
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
_STRUCT_ARM_NEON_STATE
{
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
#else
#error Unknown architecture.
#endif
#endif /* __DARWIN_UNIX03 */
#define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state
_STRUCT_ARM_PAGEIN_STATE
{
int __pagein_error;
};
/*
* Debug State
*/
#if defined(__arm__)
/* Old-fashioned debug state is only for ARM */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state
_STRUCT_ARM_DEBUG_STATE
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state
_STRUCT_ARM_DEBUG_STATE
{
__uint32_t bvr[16];
__uint32_t bcr[16];
__uint32_t wvr[16];
__uint32_t wcr[16];
};
#endif /* __DARWIN_UNIX03 */
#elif defined(__arm64__)
/* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct __arm_legacy_debug_state
_STRUCT_ARM_LEGACY_DEBUG_STATE
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
};
#else /* __DARWIN_UNIX03 */
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
_STRUCT_ARM_LEGACY_DEBUG_STATE
{
__uint32_t bvr[16];
__uint32_t bcr[16];
__uint32_t wvr[16];
__uint32_t wcr[16];
};
#endif /* __DARWIN_UNIX03 */
#else
#error unknown architecture
#endif
#if __DARWIN_UNIX03
#define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32
_STRUCT_ARM_DEBUG_STATE32
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64
_STRUCT_ARM_DEBUG_STATE64
{
__uint64_t __bvr[16];
__uint64_t __bcr[16];
__uint64_t __wvr[16];
__uint64_t __wcr[16];
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32
_STRUCT_ARM_DEBUG_STATE32
{
__uint32_t bvr[16];
__uint32_t bcr[16];
__uint32_t wvr[16];
__uint32_t wcr[16];
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64
_STRUCT_ARM_DEBUG_STATE64
{
__uint64_t bvr[16];
__uint64_t bcr[16];
__uint64_t wvr[16];
__uint64_t wcr[16];
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64
_STRUCT_ARM_CPMU_STATE64
{
__uint64_t __ctrs[16];
};
#else /* __DARWIN_UNIX03 */
#define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64
_STRUCT_ARM_CPMU_STATE64
{
__uint64_t ctrs[16];
};
#endif /* !__DARWIN_UNIX03 */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM__STRUCTS_H_ */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -30,7 +30,7 @@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@ -55,19 +55,20 @@
*/
/*
*/
/*
* File: mach/vm_param.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
* Date: 1985
*
* Machine independent virtual memory parameters.
* File: boolean.h
*
* Boolean type, for ARM.
*/
#ifndef _MACH_VM_PARAM_H_
#define _MACH_VM_PARAM_H_
#ifndef _MACH_ARM_BOOLEAN_H_
#define _MACH_ARM_BOOLEAN_H_
#include <mach/machine/vm_param.h>
#if defined (__arm__) || defined (__arm64__)
typedef int boolean_t;
#endif /* _MACH_VM_PARAM_H_ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_BOOLEAN_H_ */

View File

@ -0,0 +1,82 @@
/*
* Copyright (c) 2007 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
* 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_ARM_EXCEPTION_H_
#define _MACH_ARM_EXCEPTION_H_
#if defined (__arm__) || defined (__arm64__)
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
#define EXC_MASK_MACHINE 0
#define EXCEPTION_CODE_MAX 2 /* code and subcode */
/*
* Trap numbers as defined by the hardware exception vectors.
*/
/*
* EXC_BAD_INSTRUCTION
*/
#define EXC_ARM_UNDEFINED 1 /* Undefined */
/*
* EXC_ARITHMETIC
*/
#define EXC_ARM_FP_UNDEFINED 0 /* Undefined Floating Point Exception */
#define EXC_ARM_FP_IO 1 /* Invalid Floating Point Operation */
#define EXC_ARM_FP_DZ 2 /* Floating Point Divide by Zero */
#define EXC_ARM_FP_OF 3 /* Floating Point Overflow */
#define EXC_ARM_FP_UF 4 /* Floating Point Underflow */
#define EXC_ARM_FP_IX 5 /* Inexact Floating Point Result */
#define EXC_ARM_FP_ID 6 /* Floating Point Denormal Input */
/*
* EXC_BAD_ACCESS
* Note: do not conflict with kern_return_t values returned by vm_fault
*/
#define EXC_ARM_DA_ALIGN 0x101 /* Alignment Fault */
#define EXC_ARM_DA_DEBUG 0x102 /* Debug (watch/break) Fault */
#define EXC_ARM_SP_ALIGN 0x103 /* SP Alignment Fault */
#define EXC_ARM_SWP 0x104 /* SWP instruction */
#define EXC_ARM_PAC_FAIL 0x105 /* PAC authentication failure */
/*
* EXC_BREAKPOINT
*/
#define EXC_ARM_BREAKPOINT 1 /* breakpoint trap */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_EXCEPTION_H_ */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@ -30,7 +30,7 @@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@ -55,29 +55,24 @@
*/
/*
*/
/*
* File: mach/thread_special_ports.h
*
* Defines codes for special_purpose thread ports. These are NOT
* port identifiers - they are only used for the thread_get_special_port
* and thread_set_special_port routines.
*
*/
#ifndef _MACH_THREAD_SPECIAL_PORTS_H_
#define _MACH_THREAD_SPECIAL_PORTS_H_
#define THREAD_KERNEL_PORT 1 /* Represents the thread to the outside
* world.*/
/*
* Definitions for ease of use
* File: kern_return.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
* Date: 1985
*
* Machine-dependent kernel return definitions.
*/
#define thread_get_kernel_port(thread, port) \
(thread_get_special_port((thread), THREAD_KERNEL_PORT, (port)))
#ifndef _MACH_ARM_KERN_RETURN_H_
#define _MACH_ARM_KERN_RETURN_H_
#define thread_set_kernel_port(thread, port) \
(thread_set_special_port((thread), THREAD_KERNEL_PORT, (port)))
#if defined (__arm__) || defined (__arm64__)
#endif /* _MACH_THREAD_SPECIAL_PORTS_H_ */
#ifndef ASSEMBLER
typedef int kern_return_t;
#endif /* ASSEMBLER */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_KERN_RETURN_H_ */

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 2007-2018 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
* 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_ARM_PROCESSOR_INFO_H_
#define _MACH_ARM_PROCESSOR_INFO_H_
#if defined (__arm__) || defined (__arm64__)
#define PROCESSOR_CPU_STAT 0x10000003 /* Low-level CPU statistics */
#define PROCESSOR_CPU_STAT64 0x10000004 /* Low-level CPU statistics, in full 64-bit */
#include <stdint.h> /* uint32_t, uint64_t */
struct processor_cpu_stat {
uint32_t irq_ex_cnt;
uint32_t ipi_cnt;
uint32_t timer_cnt;
uint32_t undef_ex_cnt;
uint32_t unaligned_cnt;
uint32_t vfp_cnt;
uint32_t vfp_shortv_cnt;
uint32_t data_ex_cnt;
uint32_t instr_ex_cnt;
};
typedef struct processor_cpu_stat processor_cpu_stat_data_t;
typedef struct processor_cpu_stat *processor_cpu_stat_t;
#define PROCESSOR_CPU_STAT_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_cpu_stat_data_t) / sizeof(natural_t)))
struct processor_cpu_stat64 {
uint64_t irq_ex_cnt;
uint64_t ipi_cnt;
uint64_t timer_cnt;
uint64_t undef_ex_cnt;
uint64_t unaligned_cnt;
uint64_t vfp_cnt;
uint64_t vfp_shortv_cnt;
uint64_t data_ex_cnt;
uint64_t instr_ex_cnt;
uint64_t pmi_cnt;
} __attribute__((packed, aligned(4)));
typedef struct processor_cpu_stat64 processor_cpu_stat64_data_t;
typedef struct processor_cpu_stat64 *processor_cpu_stat64_t;
#define PROCESSOR_CPU_STAT64_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_cpu_stat64_data_t) / sizeof(integer_t)))
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_PROCESSOR_INFO_H_ */

View File

@ -25,14 +25,15 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_MACHINE_RPC_H_
#define _MACH_MACHINE_RPC_H_
#ifndef _MACH_ARM_RPC_H_
#define _MACH_ARM_RPC_H_
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/rpc.h"
#else
#error architecture not supported
#endif
#if defined (__arm__) || defined (__arm64__)
#endif /* _MACH_MACHINE_RPC_H_ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_RPC_H_ */

View File

@ -26,15 +26,17 @@
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
* @OSF_COPYRIGHT@
*/
#ifndef _BSD_MACHINE_TYPES_H_
#define _BSD_MACHINE_TYPES_H_
#if defined (__i386__) || defined(__x86_64__)
#include "i386/types.h"
#else
#error architecture not supported
#endif
#ifndef _MACH_ARM_THREAD_STATE_H_
#define _MACH_ARM_THREAD_STATE_H_
#endif /* _BSD_MACHINE_TYPES_H_ */
#if defined (__arm__) || defined (__arm64__)
/* Size of maximum exported thread state in words */
#define ARM_THREAD_STATE_MAX (1296) /* Size of biggest state possible */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_THREAD_STATE_H_ */

View File

@ -0,0 +1,236 @@
/*
* Copyright (c) 2007 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
* 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@
*/
/*
* FILE_ID: thread_status.h
*/
#ifndef _ARM_THREAD_STATUS_H_
#define _ARM_THREAD_STATUS_H_
#if defined (__arm__) || defined (__arm64__)
#include <mach/machine/_structs.h>
#include <mach/machine/thread_state.h>
#include <mach/message.h>
#include <mach/vm_types.h>
/*
* Support for determining the state of a thread
*/
/*
* Flavors
*/
#define ARM_THREAD_STATE 1
#define ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE
#define ARM_VFP_STATE 2
#define ARM_EXCEPTION_STATE 3
#define ARM_DEBUG_STATE 4 /* pre-armv8 */
#define THREAD_STATE_NONE 5
#define ARM_THREAD_STATE64 6
#define ARM_EXCEPTION_STATE64 7
// ARM_THREAD_STATE_LAST 8 /* legacy */
#define ARM_THREAD_STATE32 9
/* API */
#define ARM_DEBUG_STATE32 14
#define ARM_DEBUG_STATE64 15
#define ARM_NEON_STATE 16
#define ARM_NEON_STATE64 17
#define ARM_CPMU_STATE64 18
#define ARM_PAGEIN_STATE 27
#ifndef ARM_STATE_FLAVOR_IS_OTHER_VALID
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0
#endif
#define VALID_THREAD_STATE_FLAVOR(x) \
((x == ARM_THREAD_STATE) || \
(x == ARM_VFP_STATE) || \
(x == ARM_EXCEPTION_STATE) || \
(x == ARM_DEBUG_STATE) || \
(x == THREAD_STATE_NONE) || \
(x == ARM_THREAD_STATE32) || \
(x == ARM_THREAD_STATE64) || \
(x == ARM_EXCEPTION_STATE64) || \
(x == ARM_NEON_STATE) || \
(x == ARM_NEON_STATE64) || \
(x == ARM_DEBUG_STATE32) || \
(x == ARM_DEBUG_STATE64) || \
(x == ARM_PAGEIN_STATE) || \
(ARM_STATE_FLAVOR_IS_OTHER_VALID(x)))
struct arm_state_hdr {
uint32_t flavor;
uint32_t count;
};
typedef struct arm_state_hdr arm_state_hdr_t;
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state_t;
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state32_t;
typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t;
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
/* Accessor macros for arm_thread_state64_t pointer fields */
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_pc(ts) \
__darwin_arm_thread_state64_get_pc(ts)
/* Return pc field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the arm_thread_state64_get_pc() macro in that case. */
#define arm_thread_state64_get_pc_fptr(ts) \
__darwin_arm_thread_state64_get_pc_fptr(ts)
/* Set pc field of arm_thread_state64_t to a function pointer */
#define arm_thread_state64_set_pc_fptr(ts, fptr) \
__darwin_arm_thread_state64_set_pc_fptr(ts, fptr)
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_lr(ts) \
__darwin_arm_thread_state64_get_lr(ts)
/* Return lr field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the arm_thread_state64_get_lr() macro in that case. */
#define arm_thread_state64_get_lr_fptr(ts) \
__darwin_arm_thread_state64_get_lr_fptr(ts)
/* Set lr field of arm_thread_state64_t to a function pointer */
#define arm_thread_state64_set_lr_fptr(ts, fptr) \
__darwin_arm_thread_state64_set_lr_fptr(ts, fptr)
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_sp(ts) \
__darwin_arm_thread_state64_get_sp(ts)
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define arm_thread_state64_set_sp(ts, ptr) \
__darwin_arm_thread_state64_set_sp(ts, ptr)
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_fp(ts) \
__darwin_arm_thread_state64_get_fp(ts)
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define arm_thread_state64_set_fp(ts, ptr) \
__darwin_arm_thread_state64_set_fp(ts, ptr)
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define arm_thread_state64_ptrauth_strip(ts) \
__darwin_arm_thread_state64_ptrauth_strip(ts)
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
struct arm_unified_thread_state {
arm_state_hdr_t ash;
union {
arm_thread_state32_t ts_32;
arm_thread_state64_t ts_64;
} uts;
};
#define ts_32 uts.ts_32
#define ts_64 uts.ts_64
typedef struct arm_unified_thread_state arm_unified_thread_state_t;
#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_thread_state_t)/sizeof(uint32_t)))
#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_thread_state32_t)/sizeof(uint32_t)))
#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_thread_state64_t)/sizeof(uint32_t)))
#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_unified_thread_state_t)/sizeof(uint32_t)))
typedef _STRUCT_ARM_VFP_STATE arm_vfp_state_t;
typedef _STRUCT_ARM_NEON_STATE arm_neon_state_t;
typedef _STRUCT_ARM_NEON_STATE arm_neon_state32_t;
typedef _STRUCT_ARM_NEON_STATE64 arm_neon_state64_t;
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state_t;
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state32_t;
typedef _STRUCT_ARM_EXCEPTION_STATE64 arm_exception_state64_t;
typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t;
typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t;
typedef _STRUCT_ARM_PAGEIN_STATE arm_pagein_state_t;
/*
* Otherwise not ARM64 kernel and we must preserve legacy ARM definitions of
* arm_debug_state for binary compatability of userland consumers of this file.
*/
#if defined(__arm__)
typedef _STRUCT_ARM_DEBUG_STATE arm_debug_state_t;
#elif defined(__arm64__)
typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t;
#else /* defined(__arm__) */
#error Undefined architecture
#endif /* defined(__arm__) */
#define ARM_VFP_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_vfp_state_t)/sizeof(uint32_t)))
#define ARM_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_exception_state_t)/sizeof(uint32_t)))
#define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_exception_state64_t)/sizeof(uint32_t)))
#define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_debug_state_t)/sizeof(uint32_t)))
#define ARM_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_debug_state32_t)/sizeof(uint32_t)))
#define ARM_PAGEIN_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_pagein_state_t)/sizeof(uint32_t)))
#define ARM_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_debug_state64_t)/sizeof(uint32_t)))
#define ARM_NEON_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_neon_state_t)/sizeof(uint32_t)))
#define ARM_NEON_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_neon_state64_t)/sizeof(uint32_t)))
#define MACHINE_THREAD_STATE ARM_THREAD_STATE
#define MACHINE_THREAD_STATE_COUNT ARM_UNIFIED_THREAD_STATE_COUNT
/*
* Largest state on this machine:
*/
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_THREAD_STATUS_H_ */

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2007 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
* 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@
*/
/*
* FILE_ID: vm_param.h
*/
/*
* ARM machine dependent virtual memory parameters.
*/
#ifndef _MACH_ARM_VM_PARAM_H_
#define _MACH_ARM_VM_PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#if !defined (KERNEL) && !defined (__ASSEMBLER__)
#include <mach/vm_page_size.h>
#endif
#define BYTE_SIZE 8 /* byte size in bits */
#define PAGE_SHIFT vm_page_shift
#define PAGE_SIZE vm_page_size
#define PAGE_MASK vm_page_mask
#define VM_PAGE_SIZE vm_page_size
#define machine_ptob(x) ((x) << PAGE_SHIFT)
#define PAGE_MAX_SHIFT 14
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
#define PAGE_MIN_SHIFT 12
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS
#ifndef __ASSEMBLER__
#if defined (__arm__)
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
#elif defined (__arm64__)
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
#define VM_MAX_ADDRESS ((vm_address_t) 0x00000000F0000000ULL)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW)
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW)
#else /* defined(__arm64__) */
#error architecture not supported
#endif
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
#endif /* !__ASSEMBLER__ */
#define SWI_SYSCALL 0x80
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_VM_PARAM_H_ */

View File

@ -0,0 +1,162 @@
/*
* Copyright (c) 2000-2007 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
* 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@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: vm_types.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* Header file for VM data types. ARM version.
*/
#ifndef _MACH_ARM_VM_TYPES_H_
#define _MACH_ARM_VM_TYPES_H_
#if defined (__arm__) || defined (__arm64__)
#ifndef ASSEMBLER
#include <arm/_types.h>
#include <stdint.h>
#include <Availability.h>
#include <sys/cdefs.h>
/*
* natural_t and integer_t are Mach's legacy types for machine-
* independent integer types (unsigned, and signed, respectively).
* Their original purpose was to define other types in a machine/
* compiler independent way.
*
* They also had an implicit "same size as pointer" characteristic
* to them (i.e. Mach's traditional types are very ILP32 or ILP64
* centric). We will likely support x86 ABIs that do not follow
* either ofthese models (specifically LP64). Therefore, we had to
* make a choice between making these types scale with pointers or stay
* tied to integers. Because their use is predominantly tied to
* to the size of an integer, we are keeping that association and
* breaking free from pointer size guarantees.
*
* New use of these types is discouraged.
*/
typedef __darwin_natural_t natural_t;
typedef int integer_t;
/*
* A vm_offset_t is a type-neutral pointer,
* e.g. an offset into a virtual memory space.
*/
#ifdef __LP64__
typedef uintptr_t vm_offset_t __kernel_ptr_semantics;
typedef uintptr_t vm_size_t;
typedef uint64_t mach_vm_address_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_size_t;
typedef uint64_t vm_map_offset_t __kernel_ptr_semantics;
typedef uint64_t vm_map_address_t __kernel_ptr_semantics;
typedef uint64_t vm_map_size_t;
#else
typedef natural_t vm_offset_t __kernel_ptr_semantics;
/*
* A vm_size_t is the proper type for e.g.
* expressing the difference between two
* vm_offset_t entities.
*/
typedef natural_t vm_size_t;
/*
* This new type is independent of a particular vm map's
* implementation size - and represents appropriate types
* for all possible maps. This is used for interfaces
* where the size of the map is not known - or we don't
* want to have to distinguish.
*/
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
typedef uint32_t mach_vm_address_t;
typedef uint32_t mach_vm_offset_t;
typedef uint32_t mach_vm_size_t;
#else
typedef uint64_t mach_vm_address_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_size_t;
#endif
typedef uint32_t vm_map_offset_t __kernel_ptr_semantics;
typedef uint32_t vm_map_address_t __kernel_ptr_semantics;
typedef uint32_t vm_map_size_t;
#endif /* __LP64__ */
typedef uint32_t vm32_offset_t;
typedef uint32_t vm32_address_t;
typedef uint32_t vm32_size_t;
typedef vm_offset_t mach_port_context_t;
#endif /* ASSEMBLER */
/*
* If composing messages by hand (please do not)
*/
#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_VM_TYPES_H_ */

View File

@ -31,6 +31,14 @@
#include <sys/cdefs.h>
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
#define RENAME_RESERVED1 0x00000008
#define RENAME_NOFOLLOW_ANY 0x00000010
#endif
#if __DARWIN_C_LEVEL >= 200809L
#include <Availability.h>
@ -40,9 +48,6 @@ int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING(
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);

View File

@ -31,14 +31,6 @@
#include <sys/cdefs.h>
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
#define RENAME_RESERVED1 0x00000008
#define RENAME_NOFOLLOW_ANY 0x00000010
#endif
#if __DARWIN_C_LEVEL >= 200809L
#include <Availability.h>
@ -48,6 +40,9 @@ int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING(
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);

View File

@ -132,130 +132,37 @@
#define __API_TO_BE_DEPRECATED 100000
#endif
#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 */
#ifndef __API_TO_BE_DEPRECATED_MACOS
#define __API_TO_BE_DEPRECATED_MACOS 100000
#endif
#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 */
#ifndef __API_TO_BE_DEPRECATED_IOS
#define __API_TO_BE_DEPRECATED_IOS 100000
#endif
#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
#ifndef __API_TO_BE_DEPRECATED_TVOS
#define __API_TO_BE_DEPRECATED_TVOS 100000
#endif
#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
#ifndef __API_TO_BE_DEPRECATED_WATCHOS
#define __API_TO_BE_DEPRECATED_WATCHOS 100000
#endif
#define __DRIVERKIT_19_0 190000
#endif /* __MAC_10_0 */
#ifndef __API_TO_BE_DEPRECATED_BRIDGEOS
#endif
#ifndef __API_TO_BE_DEPRECATED_MACCATALYST
#define __API_TO_BE_DEPRECATED_MACCATALYST 100000
#endif
#ifndef __API_TO_BE_DEPRECATED_DRIVERKIT
#define __API_TO_BE_DEPRECATED_DRIVERKIT 100000
#endif
#include <AvailabilityVersions.h>
#include <AvailabilityInternal.h>
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
@ -454,6 +361,8 @@
#endif
/* for use marking APIs unavailable for swift */
#if defined(__has_feature)
#if __has_feature(attribute_availability_swift)
@ -501,9 +410,9 @@
* __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
* __API_AVAILABLE(driverkit(19.0))
*/
#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE8, __API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
#define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN8, __API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_AVAILABLE_END _Pragma("clang attribute pop")
/*
@ -522,13 +431,13 @@
* __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
* __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
*/
#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG9, __API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP9,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG9, __API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_END _Pragma("clang attribute pop")
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP9, __API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop")
/*
@ -539,9 +448,9 @@
* __API_UNAVAILABLE(macos)
* __API_UNAVAILABLE(watchos, tvos)
*/
#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE8,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN8,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE_END _Pragma("clang attribute pop")
#else

View File

@ -45,6 +45,9 @@
#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 0
#endif
#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED */
@ -52,7 +55,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_13_0
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_16_1
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
#endif
@ -62,7 +65,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 60000
#define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_9_1
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
#endif
@ -72,7 +75,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 20000
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 70100
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 110000
#endif
@ -87,14 +90,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_10_15
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_13_0
#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_13_0
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_16_1
#endif
/* make sure a valid min is set */
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0
@ -2887,7 +2890,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_vendor(apple) && __is_target_os(ios) && __is_target_environment(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))
#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)))
@ -4452,6 +4455,7 @@
#endif
#define __API_AVAILABLE_PLATFORM_driverkit(x) driverkit,introduced=x
#if defined(__has_attribute)
#if __has_attribute(availability)
#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))
@ -4469,7 +4473,8 @@
#define __API_AVAILABLE5(x,y,z,t,b) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b)
#define __API_AVAILABLE6(x,y,z,t,b,m) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m)
#define __API_AVAILABLE7(x,y,z,t,b,m,d) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) __API_A(d)
#define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_AVAILABLE8(x,y,z,t,b,m,d,l) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) __API_A(d) __API_A(l)
#define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_APPLY_TO any(record, enum, enum_constant, function, objc_method, objc_category, objc_protocol, objc_interface, objc_property, type_alias, variable, field)
#define __API_RANGE_STRINGIFY(x) __API_RANGE_STRINGIFY2(x)
@ -4484,7 +4489,8 @@
#define __API_AVAILABLE_BEGIN5(a,b,c,d,e) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e)
#define __API_AVAILABLE_BEGIN6(a,b,c,d,e,f) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f)
#define __API_AVAILABLE_BEGIN7(a,b,c,d,e,f,g) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) __API_A_BEGIN(g)
#define __API_AVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_AVAILABLE_BEGIN8(a,b,c,d,e,f,g,h) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) __API_A_BEGIN(g) __API_A_BEGIN(h)
#define __API_AVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_PLATFORM_macos(x,y) macos,introduced=x,deprecated=y
@ -4500,6 +4506,7 @@
#endif
#define __API_DEPRECATED_PLATFORM_driverkit(x,y) driverkit,introduced=x,deprecated=y
#if defined(__has_attribute)
#if __has_attribute(availability)
#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))
@ -4517,7 +4524,8 @@
#define __API_DEPRECATED_MSG6(msg,x,y,z,t,b) __API_DEPRECATED_MSG5(msg,x,y,z,t) __API_D(msg,b)
#define __API_DEPRECATED_MSG7(msg,x,y,z,t,b,m) __API_DEPRECATED_MSG6(msg,x,y,z,t,b) __API_D(msg,m)
#define __API_DEPRECATED_MSG8(msg,x,y,z,t,b,m,d) __API_DEPRECATED_MSG7(msg,x,y,z,t,b,m) __API_D(msg,d)
#define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_MSG9(msg,x,y,z,t,b,m,d,l) __API_DEPRECATED_MSG8(msg,x,y,z,t,b,m,d) __API_D(msg,l)
#define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
#define __API_D_BEGIN(msg, x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))), apply_to = __API_APPLY_TO)))
@ -4528,7 +4536,8 @@
#define __API_DEPRECATED_BEGIN_MSG6(msg,a,b,c,d,e) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e)
#define __API_DEPRECATED_BEGIN_MSG7(msg,a,b,c,d,e,f) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f)
#define __API_DEPRECATED_BEGIN_MSG8(msg,a,b,c,d,e,f,g) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) __API_D_BEGIN(msg,g)
#define __API_DEPRECATED_BEGIN_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_BEGIN_MSG9(msg,a,b,c,d,e,f,g,h) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) __API_D_BEGIN(msg,g) __API_D_BEGIN(msg,h)
#define __API_DEPRECATED_BEGIN_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
#if __has_feature(attribute_availability_with_replacement)
#define __API_R(rep,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep)))
@ -4543,7 +4552,8 @@
#define __API_DEPRECATED_REP6(rep,x,y,z,t,b) __API_DEPRECATED_REP5(rep,x,y,z,t) __API_R(rep,b)
#define __API_DEPRECATED_REP7(rep,x,y,z,t,b,m) __API_DEPRECATED_REP6(rep,x,y,z,t,b) __API_R(rep,m)
#define __API_DEPRECATED_REP8(rep,x,y,z,t,b,m,d) __API_DEPRECATED_REP7(rep,x,y,z,t,b,m) __API_R(rep,d)
#define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_REP9(rep,x,y,z,t,b,m,d,l) __API_DEPRECATED_REP8(rep,x,y,z,t,b,m,d) __API_R(rep,l)
#define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
#if __has_feature(attribute_availability_with_replacement)
#define __API_R_BEGIN(rep,x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep))), apply_to = __API_APPLY_TO)))
@ -4558,7 +4568,9 @@
#define __API_DEPRECATED_BEGIN_REP6(rep,a,b,c,d,e) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e)
#define __API_DEPRECATED_BEGIN_REP7(rep,a,b,c,d,e,f) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f)
#define __API_DEPRECATED_BEGIN_REP8(rep,a,b,c,d,e,f,g) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) __API_R_BEGIN(rep,g)
#define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_BEGIN_REP9(rep,a,b,c,d,e,f,g,h) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) __API_R_BEGIN(rep,g) __API_R_BEGIN(rep,h)
#define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
/*
* API Unavailability
@ -4581,6 +4593,7 @@
#endif
#define __API_UNAVAILABLE_PLATFORM_driverkit driverkit,unavailable
#if defined(__has_attribute)
#if __has_attribute(availability)
#define __API_U(x) __attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x)))
@ -4598,7 +4611,8 @@
#define __API_UNAVAILABLE5(x,y,z,t,b) __API_UNAVAILABLE4(x,y,z,t) __API_U(b)
#define __API_UNAVAILABLE6(x,y,z,t,b,m) __API_UNAVAILABLE5(x,y,z,t,b) __API_U(m)
#define __API_UNAVAILABLE7(x,y,z,t,b,m,d) __API_UNAVAILABLE6(x,y,z,t,b,m) __API_U(d)
#define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_UNAVAILABLE8(x,y,z,t,b,m,d,l) __API_UNAVAILABLE7(x,y,z,t,b,m,d) __API_U(l)
#define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_U_BEGIN(x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x))), apply_to = __API_APPLY_TO)))
@ -4608,8 +4622,9 @@
#define __API_UNAVAILABLE_BEGIN4(a,b,c,d) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d)
#define __API_UNAVAILABLE_BEGIN5(a,b,c,d,e) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e)
#define __API_UNAVAILABLE_BEGIN6(a,b,c,d,e,f) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f)
#define __API_UNAVAILABLE_BEGIN7(a,b,c,d,e,f) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g)
#define __API_UNAVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_UNAVAILABLE_BEGIN7(a,b,c,d,e,f,g) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g)
#define __API_UNAVAILABLE_BEGIN8(a,b,c,d,e,f,g,h) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g) __API_U_BEGIN(h)
#define __API_UNAVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#else
/*
@ -4643,7 +4658,7 @@
/*
* Swift compiler version
* Allows for project-agnostic epochs for frameworks imported into Swift via the Clang importer, like #if _compiler_version for Swift
* Allows for project-agnostic "epochs" for frameworks imported into Swift via the Clang importer, like #if _compiler_version for Swift
* Example:
*
* #if __swift_compiler_version_at_least(800, 2, 20)

View File

@ -117,9 +117,14 @@
#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_X_VERSION_10_15_1 101501
#define MAC_OS_VERSION_11_0 110000
#define MAC_OS_VERSION_11_1 110100
#define MAC_OS_VERSION_11_3 110300
#define MAC_OS_VERSION_12_0 120000
#define MAC_OS_VERSION_13_0 130000
#define MAC_OS_VERSION_13_1 130100
/*
/*
* 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 +149,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_X_VERSION_10_15
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_1
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
#else
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_15
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_1
#endif
#endif

View File

@ -0,0 +1,255 @@
/*
* 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
#define __MAC_11_1 110100
#define __MAC_11_3 110300
#define __MAC_11_4 110400
#define __MAC_11_5 110500
#define __MAC_11_6 110600
#define __MAC_12_0 120000
#define __MAC_12_1 120100
#define __MAC_12_2 120200
#define __MAC_12_3 120300
#define __MAC_13_0 130000
/* __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
#define __IPHONE_14_3 140300
#define __IPHONE_14_5 140500
#define __IPHONE_14_6 140600
#define __IPHONE_14_7 140700
#define __IPHONE_14_8 140800
#define __IPHONE_15_0 150000
#define __IPHONE_15_1 150100
#define __IPHONE_15_2 150200
#define __IPHONE_15_3 150300
#define __IPHONE_15_4 150400
#define __IPHONE_16_0 160000
#define __IPHONE_16_1 160100
/* __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 __TVOS_14_3 140300
#define __TVOS_14_5 140500
#define __TVOS_14_6 140600
#define __TVOS_14_7 140700
#define __TVOS_15_0 150000
#define __TVOS_15_1 150100
#define __TVOS_15_2 150200
#define __TVOS_15_3 150300
#define __TVOS_15_4 150400
#define __TVOS_16_0 160000
#define __TVOS_16_1 160100
#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
#define __WATCHOS_7_2 70200
#define __WATCHOS_7_3 70300
#define __WATCHOS_7_4 70400
#define __WATCHOS_7_5 70500
#define __WATCHOS_7_6 70600
#define __WATCHOS_8_0 80000
#define __WATCHOS_8_1 80100
#define __WATCHOS_8_3 80300
#define __WATCHOS_8_4 80400
#define __WATCHOS_8_5 80500
#define __WATCHOS_9_0 90000
#define __WATCHOS_9_1 90100
/*
* 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
#define MAC_OS_VERSION_12_0 120000
#define MAC_OS_VERSION_13_0 130000
#endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */
#define __DRIVERKIT_19_0 190000
#define __DRIVERKIT_20_0 200000
#define __DRIVERKIT_21_0 210000
#endif /* __AVAILABILITY_VERSIONS__ */

View File

@ -0,0 +1,65 @@
/*
* Block.h
*
* Copyright (c) 2008-2010 Apple Inc. All rights reserved.
*
* @APPLE_LLVM_LICENSE_HEADER@
*
*/
#ifndef _Block_H_
#define _Block_H_
#if !defined(BLOCK_EXPORT)
# if defined(__cplusplus)
# define BLOCK_EXPORT extern "C"
# else
# define BLOCK_EXPORT extern
# endif
#endif
#include <Availability.h>
#include <TargetConditionals.h>
#include <sys/cdefs.h>
#if __cplusplus
extern "C" {
#endif
// Create a heap based copy of a Block or simply add a reference to an existing one.
// This must be paired with Block_release to recover memory, even when running
// under Objective-C Garbage Collection.
BLOCK_EXPORT void *__single _Block_copy(const void *__single aBlock)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
// Lose the reference, and if heap based and last reference, recover the memory
BLOCK_EXPORT void _Block_release(const void *__single aBlock)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
// Used by the compiler. Do not call this function yourself.
BLOCK_EXPORT void _Block_object_assign(void *, const void *, const int)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
// Used by the compiler. Do not call this function yourself.
BLOCK_EXPORT void _Block_object_dispose(const void *, const int)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
// Used by the compiler. Do not use these variables yourself.
BLOCK_EXPORT void * _NSConcreteGlobalBlock[32]
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
BLOCK_EXPORT void * _NSConcreteStackBlock[32]
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#if __cplusplus
}
#endif
// Type correct macros
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
#endif

View File

@ -0,0 +1,137 @@
/*
* Copyright (c) 2004-2021 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 _COPYFILE_H_ /* version 0.1 */
#define _COPYFILE_H_
/*
* This API facilitates the copying of files and their associated
* metadata. There are several open source projects that need
* modifications to support preserving extended attributes and ACLs
* and this API collapses several hundred lines of modifications into
* one or two calls.
*/
/* private */
#include <sys/cdefs.h>
#include <stdint.h>
__BEGIN_DECLS
__ptrcheck_abi_assume_single()
struct _copyfile_state;
typedef struct _copyfile_state * copyfile_state_t;
typedef uint32_t copyfile_flags_t;
/* public */
/* receives:
* from path to source file system object
* to path to destination file system object
* state opaque blob for future extensibility
* Must be NULL in current implementation
* flags (described below)
* returns:
* int negative for error
*/
int copyfile(const char *__unsafe_indexable from, const char *__unsafe_indexable to, copyfile_state_t state, copyfile_flags_t flags);
int fcopyfile(int from_fd, int to_fd, copyfile_state_t, copyfile_flags_t flags);
int copyfile_state_free(copyfile_state_t);
copyfile_state_t copyfile_state_alloc(void);
int copyfile_state_get(copyfile_state_t s, uint32_t flag, void * dst);
int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src);
typedef int (*copyfile_callback_t)(int, int, copyfile_state_t, const char *__unsafe_indexable, const char *__unsafe_indexable, void *);
#define COPYFILE_STATE_SRC_FD 1
#define COPYFILE_STATE_SRC_FILENAME 2
#define COPYFILE_STATE_DST_FD 3
#define COPYFILE_STATE_DST_FILENAME 4
#define COPYFILE_STATE_QUARANTINE 5
#define COPYFILE_STATE_STATUS_CB 6
#define COPYFILE_STATE_STATUS_CTX 7
#define COPYFILE_STATE_COPIED 8
#define COPYFILE_STATE_XATTRNAME 9
#define COPYFILE_STATE_WAS_CLONED 10
#define COPYFILE_STATE_SRC_BSIZE 11
#define COPYFILE_STATE_DST_BSIZE 12
#define COPYFILE_STATE_BSIZE 13
#define COPYFILE_DISABLE_VAR "COPYFILE_DISABLE"
/* flags for copyfile */
#define COPYFILE_ACL (1<<0)
#define COPYFILE_STAT (1<<1)
#define COPYFILE_XATTR (1<<2)
#define COPYFILE_DATA (1<<3)
#define COPYFILE_SECURITY (COPYFILE_STAT | COPYFILE_ACL)
#define COPYFILE_METADATA (COPYFILE_SECURITY | COPYFILE_XATTR)
#define COPYFILE_ALL (COPYFILE_METADATA | COPYFILE_DATA)
#define COPYFILE_RECURSIVE (1<<15) /* Descend into hierarchies */
#define COPYFILE_CHECK (1<<16) /* return flags for xattr or acls if set */
#define COPYFILE_EXCL (1<<17) /* fail if destination exists */
#define COPYFILE_NOFOLLOW_SRC (1<<18) /* don't follow if source is a symlink */
#define COPYFILE_NOFOLLOW_DST (1<<19) /* don't follow if dst is a symlink */
#define COPYFILE_MOVE (1<<20) /* unlink src after copy */
#define COPYFILE_UNLINK (1<<21) /* unlink dst before copy */
#define COPYFILE_NOFOLLOW (COPYFILE_NOFOLLOW_SRC | COPYFILE_NOFOLLOW_DST)
#define COPYFILE_PACK (1<<22)
#define COPYFILE_UNPACK (1<<23)
#define COPYFILE_CLONE (1<<24)
#define COPYFILE_CLONE_FORCE (1<<25)
#define COPYFILE_RUN_IN_PLACE (1<<26)
#define COPYFILE_DATA_SPARSE (1<<27)
#define COPYFILE_PRESERVE_DST_TRACKED (1<<28)
#define COPYFILE_VERBOSE (1<<30)
#define COPYFILE_RECURSE_ERROR 0
#define COPYFILE_RECURSE_FILE 1
#define COPYFILE_RECURSE_DIR 2
#define COPYFILE_RECURSE_DIR_CLEANUP 3
#define COPYFILE_COPY_DATA 4
#define COPYFILE_COPY_XATTR 5
#define COPYFILE_START 1
#define COPYFILE_FINISH 2
#define COPYFILE_ERR 3
#define COPYFILE_PROGRESS 4
#define COPYFILE_CONTINUE 0
#define COPYFILE_SKIP 1
#define COPYFILE_QUIT 2
__END_DECLS
#endif /* _COPYFILE_H_ */

View File

@ -127,6 +127,33 @@
#define DISPATCH_UNAVAILABLE_MSG(msg)
#endif
#if defined(__cplusplus)
# if __cplusplus >= 201703L
# define DISPATCH_FALLTHROUGH [[fallthrough]]
# elif __cplusplus >= 201103L
# if defined(__clang__)
# define DISPATCH_FALLTHROUGH [[clang::fallthrough]]
# elif defined(__GNUC__) && __GNUC__ >= 7
# define DISPATCH_FALLTHROUGH [[gnu::fallthrough]]
# else
# define DISPATCH_FALLTHROUGH
# endif
# else
# define DISPATCH_FALLTHROUGH
# endif
#elif defined(__GNUC__) && __GNUC__ >= 7
# define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__))
#elif defined(__clang__)
# if __has_attribute(fallthrough) && __clang_major__ >= 5
# define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__))
# else
# define DISPATCH_FALLTHROUGH
# endif
#else
# define DISPATCH_FALLTHROUGH
#endif
#define DISPATCH_LINUX_UNAVAILABLE()
#ifdef __FreeBSD__
@ -203,6 +230,20 @@
#define DISPATCH_ASSUME_NONNULL_END
#endif
#if __has_feature(bounds_attributes)
#define DISPATCH_ASSUME_ABI_SINGLE_BEGIN _Pragma("clang abi_ptr_attr set(single)")
#define DISPATCH_ASSUME_ABI_SINGLE_END _Pragma("clang abi_ptr_attr set(unsafe_indexable)")
#define DISPATCH_UNSAFE_INDEXABLE __attribute__((__unsafe_indexable__))
#define DISPATCH_COUNTED_BY(X) __attribute__((__counted_by__(X)))
#define DISPATCH_SIZED_BY(X) __attribute__((__sized_by__(X)))
#else
#define DISPATCH_ASSUME_ABI_SINGLE_BEGIN
#define DISPATCH_ASSUME_ABI_SINGLE_END
#define DISPATCH_UNSAFE_INDEXABLE
#define DISPATCH_COUNTED_BY(X)
#define DISPATCH_SIZED_BY(X)
#endif
#if !__has_feature(nullability)
#ifndef _Nullable
#define _Nullable
@ -301,6 +342,10 @@
#define DISPATCH_TRANSPARENT_UNION
#endif
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
typedef void (*dispatch_function_t)(void *_Nullable);
DISPATCH_ASSUME_ABI_SINGLE_END
#endif

View File

@ -33,6 +33,7 @@
*/
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
__BEGIN_DECLS
@ -323,7 +324,7 @@ dispatch_block_perform(dispatch_block_flags_t flags,
*/
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
long
intptr_t
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
/*!
@ -416,11 +417,12 @@ 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
long
intptr_t
dispatch_block_testcancel(dispatch_block_t block);
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif // __BLOCKS__

View File

@ -0,0 +1,280 @@
/*
* Copyright (c) 2009-2013 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 __DISPATCH_DATA__
#define __DISPATCH_DATA__
#ifndef __DISPATCH_INDIRECT__
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
#include <dispatch/base.h> // for HeaderDoc
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
__BEGIN_DECLS
/*! @header
* Dispatch data objects describe contiguous or sparse regions of memory that
* may be managed by the system or by the application.
* Dispatch data objects are immutable, any direct access to memory regions
* represented by dispatch objects must not modify that memory.
*/
/*!
* @typedef dispatch_data_t
* A dispatch object representing memory regions.
*/
DISPATCH_DATA_DECL(dispatch_data);
/*!
* @var dispatch_data_empty
* @discussion The singleton dispatch data object representing a zero-length
* memory region.
*/
#define dispatch_data_empty \
DISPATCH_GLOBAL_OBJECT(dispatch_data_t, _dispatch_data_empty)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty;
/*!
* @const DISPATCH_DATA_DESTRUCTOR_DEFAULT
* @discussion The default destructor for dispatch data objects.
* Used at data object creation to indicate that the supplied buffer should
* be copied into internal storage managed by the system.
*/
#define DISPATCH_DATA_DESTRUCTOR_DEFAULT NULL
#ifdef __BLOCKS__
/*! @parseOnly */
#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \
DISPATCH_EXPORT const dispatch_block_t _dispatch_data_destructor_##name
#else
#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \
DISPATCH_EXPORT const dispatch_function_t \
_dispatch_data_destructor_##name
#endif /* __BLOCKS__ */
/*!
* @const DISPATCH_DATA_DESTRUCTOR_FREE
* @discussion The destructor for dispatch data objects created from a malloc'd
* buffer. Used at data object creation to indicate that the supplied buffer
* was allocated by the malloc() family and should be destroyed with free(3).
*/
#define DISPATCH_DATA_DESTRUCTOR_FREE (_dispatch_data_destructor_free)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free);
/*!
* @const DISPATCH_DATA_DESTRUCTOR_MUNMAP
* @discussion The destructor for dispatch data objects that have been created
* from buffers that require deallocation with munmap(2).
*/
#define DISPATCH_DATA_DESTRUCTOR_MUNMAP (_dispatch_data_destructor_munmap)
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap);
#ifdef __BLOCKS__
/*!
* @function dispatch_data_create
* Creates a dispatch data object from the given contiguous buffer of memory. If
* a non-default destructor is provided, ownership of the buffer remains with
* the caller (i.e. the bytes will not be copied). The last release of the data
* object will result in the invocation of the specified destructor on the
* specified queue to free the buffer.
*
* If the DISPATCH_DATA_DESTRUCTOR_FREE destructor is provided the buffer will
* be freed via free(3) and the queue argument ignored.
*
* If the DISPATCH_DATA_DESTRUCTOR_DEFAULT destructor is provided, data object
* creation will copy the buffer into internal memory managed by the system.
*
* @param buffer A contiguous buffer of data.
* @param size The size of the contiguous buffer of data.
* @param queue The queue to which the destructor should be submitted.
* @param destructor The destructor responsible for freeing the data when it
* is no longer needed.
* @result A newly created dispatch data object.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
dispatch_data_create(const void *DISPATCH_SIZED_BY(size) buffer,
size_t size,
dispatch_queue_t _Nullable queue,
dispatch_block_t _Nullable destructor);
#endif /* __BLOCKS__ */
/*!
* @function dispatch_data_get_size
* Returns the logical size of the memory region(s) represented by the specified
* dispatch data object.
*
* @param data The dispatch data object to query.
* @result The number of bytes represented by the data object.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_PURE DISPATCH_NONNULL1 DISPATCH_NOTHROW
size_t
dispatch_data_get_size(dispatch_data_t data);
/*!
* @function dispatch_data_create_map
* Maps the memory represented by the specified dispatch data object as a single
* contiguous memory region and returns a new data object representing it.
* If non-NULL references to a pointer and a size variable are provided, they
* are filled with the location and extent of that region. These allow direct
* read access to the represented memory, but are only valid until the returned
* object is released. Under ARC, if that object is held in a variable with
* automatic storage, care needs to be taken to ensure that it is not released
* by the compiler before memory access via the pointer has been completed.
*
* @param data The dispatch data object to map.
* @param buffer_ptr A pointer to a pointer variable to be filled with the
* location of the mapped contiguous memory region, or
* NULL.
* @param size_ptr A pointer to a size_t variable to be filled with the
* size of the mapped contiguous memory region, or NULL.
* @result A newly created dispatch data object.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
dispatch_data_create_map(dispatch_data_t data,
const void *_Nullable DISPATCH_SIZED_BY(*size_ptr) *_Nullable buffer_ptr,
size_t *_Nullable size_ptr);
/*!
* @function dispatch_data_create_concat
* Returns a new dispatch data object representing the concatenation of the
* specified data objects. Those objects may be released by the application
* after the call returns (however, the system might not deallocate the memory
* region(s) described by them until the newly created object has also been
* released).
*
* @param data1 The data object representing the region(s) of memory to place
* at the beginning of the newly created object.
* @param data2 The data object representing the region(s) of memory to place
* at the end of the newly created object.
* @result A newly created object representing the concatenation of the
* data1 and data2 objects.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
dispatch_data_create_concat(dispatch_data_t data1, dispatch_data_t data2);
/*!
* @function dispatch_data_create_subrange
* Returns a new dispatch data object representing a subrange of the specified
* data object, which may be released by the application after the call returns
* (however, the system might not deallocate the memory region(s) described by
* that object until the newly created object has also been released).
*
* @param data The data object representing the region(s) of memory to
* create a subrange of.
* @param offset The offset into the data object where the subrange
* starts.
* @param length The length of the range.
* @result A newly created object representing the specified
* subrange of the data object.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
dispatch_data_create_subrange(dispatch_data_t data,
size_t offset,
size_t length);
#ifdef __BLOCKS__
/*!
* @typedef dispatch_data_applier_t
* A block to be invoked for every contiguous memory region in a data object.
*
* @param region A data object representing the current region.
* @param offset The logical offset of the current region to the start
* of the data object.
* @param buffer The location of the memory for the current region.
* @param size The size of the memory for the current region.
* @result A Boolean indicating whether traversal should continue.
*/
typedef bool (^dispatch_data_applier_t)(dispatch_data_t region,
size_t offset,
const void *DISPATCH_SIZED_BY(size) buffer,
size_t size);
/*!
* @function dispatch_data_apply
* Traverse the memory regions represented by the specified dispatch data object
* in logical order and invoke the specified block once for every contiguous
* memory region encountered.
*
* Each invocation of the block is passed a data object representing the current
* region and its logical offset, along with the memory location and extent of
* the region. These allow direct read access to the memory region, but are only
* valid until the passed-in region object is released. Note that the region
* object is released by the system when the block returns, it is the
* responsibility of the application to retain it if the region object or the
* associated memory location are needed after the block returns.
*
* @param data The data object to traverse.
* @param applier The block to be invoked for every contiguous memory
* region in the data object.
* @result A Boolean indicating whether traversal completed
* successfully.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
bool
dispatch_data_apply(dispatch_data_t data,
DISPATCH_NOESCAPE dispatch_data_applier_t applier);
#endif /* __BLOCKS__ */
/*!
* @function dispatch_data_copy_region
* Finds the contiguous memory region containing the specified location among
* the regions represented by the specified object and returns a copy of the
* internal dispatch data object representing that region along with its logical
* offset in the specified object.
*
* @param data The dispatch data object to query.
* @param location The logical position in the data object to query.
* @param offset_ptr A pointer to a size_t variable to be filled with the
* logical offset of the returned region object to the
* start of the queried data object.
* @result A newly created dispatch data object.
*/
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
dispatch_data_copy_region(dispatch_data_t data,
size_t location,
size_t *offset_ptr);
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif /* __DISPATCH_DATA__ */

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