Initial commit for Dhrystone benchmark
diff --git a/.gn b/.gn new file mode 100644 index 0000000..2a082ff --- /dev/null +++ b/.gn
@@ -0,0 +1,6 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# The location of the build configuration file. +buildconfig = "//build/BUILDCONFIG.gn"
diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000..9dd0d66 --- /dev/null +++ b/BUILD.gn
@@ -0,0 +1,10 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +group("default") { + deps = [ + "//third_party/dhrystone", + ] +} +
diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cf21574 --- /dev/null +++ b/LICENSE
@@ -0,0 +1,27 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT +// OWNER 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.
diff --git a/README.md b/README.md new file mode 100644 index 0000000..691d6d3 --- /dev/null +++ b/README.md
@@ -0,0 +1,16 @@ +# Setup +1. Install required dependencies for building: `sudo apt-get install curl unzip python python2`. +2. Change directory to the root of the repo: `cd fuchsia-benchmarks` and run the setup script `./scripts/download-build-tools.sh` +3. Generate ninja files: ./buildtools/linux64/gn gen out/core.astro-release --args='target_os="fuchsia" target_cpu="arm64"' +4. Build: ./buildtools/linux64/ninja -C out/core.astro-release +5. Start the package server: ./third_party/fuchsia-sdk/bin/fserve.sh + +# Dhrystone Benchmark +See https://en.wikipedia.org/wiki/Dhrystone. + +## How to Run +1. Follow previous steps from the Setup section +2. Publish the Dhrystone component: ./third_party/fuchsia-sdk/bin/fpublish.sh out/core.astro-release/gen/third_party/dhrystone/dhrystone/dhrystone.far +3. Run the benchmark: ./third_party/fuchsia-sdk/bin/fssh.sh run fuchsia-pkg://fuchsia.com/dhrystone#meta/dhrystone.cmx 10 + +* This is not an officially supported Google product*
diff --git a/build/BUILD.gn b/build/BUILD.gn new file mode 100644 index 0000000..f5eb934 --- /dev/null +++ b/build/BUILD.gn
@@ -0,0 +1,19 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +config("compiler_defaults") { + if (current_os == "linux") { + cflags = [ + "-fPIC", + "-pthread", + ] + } +} + +config("executable_ldconfig") { + ldflags = [ + "-Wl,-rpath=\$ORIGIN/", + "-Wl,-rpath-link=", + ] +}
diff --git a/build/BUILDCONFIG.gn b/build/BUILDCONFIG.gn new file mode 100644 index 0000000..21a1902 --- /dev/null +++ b/build/BUILDCONFIG.gn
@@ -0,0 +1,159 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +if (target_os == "") { + target_os = host_os +} + +if (target_cpu == "") { + target_cpu = host_cpu +} + +if (current_cpu == "") { + current_cpu = target_cpu +} +if (current_os == "") { + current_os = target_os +} + +is_fuchsia = current_os == "fuchsia" +is_linux = current_os == "linux" +is_debug = false + +# Set the host_toolchain +declare_args() { + host_toolchain = "" +} + +# ============================================================================== +# TOOLCHAIN SETUP +# ============================================================================== +# +# Here we set the default toolchain, as well as the variable host_toolchain +# which will identify the toolchain corresponding to the local system when +# doing cross-compiles. When not cross-compiling, this will be the same as the +# default toolchain. +# +# We do this before anything else to make sure we complain about any +# unsupported os/cpu combinations as early as possible. + +if (host_toolchain == "") { + # This should only happen in the top-level context. + # In a specific toolchain context, the toolchain_args() + # block should have propagated a value down. + + if (host_os == "linux") { + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" + } else if (host_os == "mac") { + host_toolchain = "//build/toolchain/mac:$host_cpu" + } else { + assert(false, "Unsupported host_os: $host_os") + } +} + +# Set toolchain based on target_os and target_cpu +_default_toolchain = "" + +if (target_os == "linux") { + _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" +} else if (target_os == "fuchsia") { + _default_toolchain = "//build/toolchain/fuchsia:$target_cpu" +} else { + assert(false, "Unsupported target_os: $target_os") +} + +set_default_toolchain(_default_toolchain) + +# Set compiler defaults + +# Holds all configs used for running the compiler. +default_compiler_configs = [ + "//build:compiler_defaults", + "//build/config/compiler:assembler_debug_dir", + "//build/config/compiler:compiler", + "//build/config/compiler:compiler_arm_fpu", + "//build/config/compiler:c++", + "//build/config/compiler:default_include_dirs", + "//build/config/compiler:default_optimization", + "//build/config/compiler:default_symbols", + "//build/config/compiler:no_exceptions", + "//build/config/compiler:no_rtti", + "//build/config/compiler:runtime_library", + "//build/config/compiler:extra_warnings", + "//build/config/compiler:symbol_visibility_hidden", +] + +if (is_fuchsia) { + default_compiler_configs += [ + "//third_party/fuchsia-sdk/build/config:compiler", + "//third_party/fuchsia-sdk/build/config:runtime_library", + ] + + # these are additional flags recommended + default_compiler_configs += [ "//build/config/compiler:default_stack_frames" ] +} + +# Debug/release-related defines. +if (is_debug) { + default_compiler_configs += [ "//build/config:debug" ] +} else { + default_compiler_configs += [ "//build/config:release" ] +} + +# Static libraries and source sets use only the compiler ones. +set_defaults("static_library") { + configs = default_compiler_configs +} +set_defaults("source_set") { + configs = default_compiler_configs +} + +# Executable defaults. +default_executable_configs = default_compiler_configs + [ + "//build:executable_ldconfig", + "//build/config:default_libs", + ] +set_defaults("executable") { + configs = default_executable_configs +} + +# Shared library and loadable module defaults (also for components in component +# mode). +default_shared_library_configs = + default_compiler_configs + [ "//build/config:default_libs" ] + +set_defaults("shared_library") { + configs = default_shared_library_configs +} +set_defaults("loadable_module") { + configs = default_shared_library_configs +} + +if (is_fuchsia) { + # Sets default dependencies for executable and shared_library targets. + # + # Variables + # no_default_deps: If true, no standard dependencies will be added. + foreach(_target_type, + [ + "executable", + "shared_library", + ]) { + template(_target_type) { + target(_target_type, target_name) { + forward_variables_from(invoker, "*", [ "no_default_deps" ]) + if (!defined(deps)) { + deps = [] + } + if (!defined(data_deps)) { + data_deps = [] + } + if (!defined(invoker.no_default_deps) || !invoker.no_default_deps) { + data_deps += [ "//build/config/clang:c++-runtime-deps" ] + deps += [ "//third_party/fuchsia-sdk/build/config:runtime_library_group" ] + } + } + } + } +}
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn new file mode 100644 index 0000000..73babcb --- /dev/null +++ b/build/config/BUILD.gn
@@ -0,0 +1,37 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Debug/release ---------------------------------------------------------------- + +config("debug") { + defines = [ + "_DEBUG", + "DYNAMIC_ANNOTATIONS_ENABLED=1", + "WTF_USE_DYNAMIC_ANNOTATIONS=1", + ] + + if (current_cpu == "x64") { + # Enable libstdc++ debugging facilities to help catch problems early. + defines += [ "_GLIBCXX_DEBUG=1" ] + } +} + +config("release") { + defines = [ "NDEBUG" ] + defines += [ "NVALGRIND" ] + defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=0" ] +} + +# Default libraries ------------------------------------------------------------ + +# This config defines the default libraries applied to all targets. +config("default_libs") { + if (is_linux) { + libs = [ + "dl", + "pthread", + "rt", + ] + } +}
diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn new file mode 100644 index 0000000..2866aa7 --- /dev/null +++ b/build/config/clang/BUILD.gn
@@ -0,0 +1,31 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/clang/clang.gni") + +# This adds the runtime deps for C++ for usage when cross compiling. +group("c++-runtime-deps") { + data_deps = [ + ":clang-runtime-libs", + ] +} + +copy("clang-runtime-libs") { + if (target_cpu == "arm64") { + arch = "aarch64" + } else if (target_cpu == "x64") { + arch = "x86_64" + } + vendor = "unknown" + + sys = target_os + sources = [ + "${clang_base_path}/lib/${arch}-${vendor}-${sys}/c++/libc++.so.2.0", + "${clang_base_path}/lib/${arch}-${vendor}-${sys}/c++/libc++abi.so.1.0", + "${clang_base_path}/lib/${arch}-${vendor}-${sys}/c++/libunwind.so.1.0", + ] + outputs = [ + "${root_out_dir}/lib/{{source_name_part}}", + ] +}
diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni new file mode 100644 index 0000000..0c1579b --- /dev/null +++ b/build/config/clang/clang.gni
@@ -0,0 +1,5 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +clang_base_path = "//buildtools/linux64/clang-linux-amd64"
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn new file mode 100644 index 0000000..1a1169d --- /dev/null +++ b/build/config/compiler/BUILD.gn
@@ -0,0 +1,235 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# compiler --------------------------------------------------------------------- +# +# Base compiler configuration. +# +# See also "runtime_library" below for related stuff and a discussion about +# where stuff should go. Put warning related stuff in the "warnings" config. + +import("//build/config/clang/clang.gni") + +config("compiler") { + asmflags = [] + cflags = [] + cflags_c = [] + cflags_cc = [] + cflags_objc = [] + cflags_objcc = [] + ldflags = [] + defines = [] + configs = [] + + # System-specific flags. If your compiler flags apply to one of the + # categories here, add it to the associated file to keep this shared config + # smaller. + + cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 + cflags += [ "-fcolor-diagnostics" ] + cflags += [ "-fmerge-all-constants" ] + cflags += [ "-fcomplete-member-pointers" ] + + cflags += [ + "-Xclang", + "-mllvm", + "-Xclang", + "-instcombine-lower-dbg-declare=0", + ] + + asmflags += [ "-fPIC" ] + cflags += [ "-fPIC" ] + ldflags += [ "-fPIC" ] + + ldflags += [ + "-Wl,-z,noexecstack", + "-Wl,-z,relro", + ] + + ldflags += [ "-Wl,-z,now" ] + + # Compiler instrumentation can introduce dependencies in DSOs to symbols in + # the executable they are loaded into, so they are unresolved at link-time. + ldflags += [ + "-Wl,-z,defs", + "-Wl,--as-needed", + ] + + if (is_debug) { + # Allow comparing the address of references and 'this' against 0 + # in debug builds. Technically, these can never be null in + # well-defined C/C++ and Clang can optimize such checks away in + # release builds, but they may be used in asserts in debug builds. + cflags_cc += [ + "-Wno-undefined-bool-conversion", + "-Wno-tautological-undefined-compare", + ] + } + + cflags_c += [ "-std=c11" ] + cflags_cc += [ "-std=c++14" ] + + # Pass the same C/C++ flags to the objective C/C++ compiler. + cflags_objc += cflags_c + cflags_objcc += cflags_cc +} + +config("c++") { + cflags_cc = [ "-isystem" + rebase_path(clang_base_path, root_build_dir) ] +} + +config("assembler_debug_dir") { + asmflags = [ "-Wa,-fdebug-compilation-dir,." ] +} + +# This config causes functions not to be automatically exported from shared +# libraries. By default, all symbols are exported but this means there are +# lots of exports that slow everything down. In general we explicitly mark +# which functions we want to export from components. +# +# Some third_party code assumes all functions are exported so this is separated +# into its own config so such libraries can remove this config to make symbols +# public again. +# +# See http://gcc.gnu.org/wiki/Visibility +config("symbol_visibility_hidden") { + cflags = [ "-fvisibility=hidden" ] + cflags_cc = [ "-fvisibility-inlines-hidden" ] + cflags_objcc = cflags_cc +} + +config("compiler_arm_fpu") { + if (current_cpu == "arm") { + cflags = [ "-mfpu=$arm_fpu" ] + asmflags = cflags + } +} + +# export_dynamic --------------------------------------------------------------- +# +# Ensures all exported symbols are added to the dynamic symbol table. This is +# necessary to expose Chrome's custom operator new() and operator delete() (and +# other memory-related symbols) to libraries. Otherwise, they might +# (de)allocate memory on a different heap, which would spell trouble if pointers +# to heap-allocated memory are passed over shared library boundaries. +config("export_dynamic") { +} + +# default_include_dirs --------------------------------------------------------- +# +# This is a separate config so that third_party code (which would not use the +# source root and might have conflicting versions of some headers) can remove +# this and specify their own include paths. +config("default_include_dirs") { + include_dirs = [ + "//", + root_gen_dir, + ] +} + +config("default_stack_frames") { + cflags = [ "-fomit-frame-pointer" ] +} + +# The default optimization applied to all targets. This will be equivalent to +# either "optimize" or "no_optimize", depending on the build flags. +config("default_optimization") { + if (is_debug) { + configs = [ ":no_optimize" ] + } else { + configs = [ ":optimize" ] + } +} + +config("optimize") { + cflags = [ + "-O2", + "-fno-ident", + "-fdata-sections", + "-ffunction-sections", + ] + ldflags = [ + "-Wl,-O2", + "-Wl,--gc-sections", + ] +} + +# Turn off optimizations. +config("no_optimize") { + cflags = [ "-O0" ] + ldflags = [] +} + +# Full symbols. +config("symbols") { + cflags = [] + if (current_cpu == "arm") { + cflags += [ "-gdwarf-3" ] + } + cflags += [ "-g2" ] + + asmflags = cflags + ldflags = [] + + cflags += [ "-ggnu-pubnames" ] +} + +# No symbols. +config("no_symbols") { + cflags = [ "-g0" ] + asmflags = cflags +} + +# Default symbols. +config("default_symbols") { + if (is_debug) { + configs = [ ":symbols" ] + } else { + configs = [ ":no_symbols" ] + } +} + +config("no_exceptions") { + cflags_cc = [ "-fno-exceptions" ] + cflags_objcc = cflags_cc +} + +config("exceptions") { + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +config("no_rtti") { + cflags_cc = [ "-fno-rtti" ] + cflags_objcc = cflags_cc +} + +config("rtti") { + cflags_cc = [ "-frtti" ] + cflags_objcc = cflags_cc +} + +config("runtime_library") { + libs = [ "pthread" ] +} + +# Enables some extra Clang-specific warnings. Some third-party code won't +# compile with these so may want to remove this config. +config("extra_warnings") { + cflags = [ + "-Wheader-hygiene", + + # Warns when a const char[] is converted to bool. + "-Wstring-conversion", + + "-Wtautological-overlap-compare", + ] +} + +# Settings for executables. +config("executable_config") { + configs = [] + ldflags = [ "-pie" ] + ldflags += [ "-Wl,--disable-new-dtags" ] +}
diff --git a/build/toolchain/clang_toolchain.gni b/build/toolchain/clang_toolchain.gni new file mode 100644 index 0000000..d22641e --- /dev/null +++ b/build/toolchain/clang_toolchain.gni
@@ -0,0 +1,456 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/clang/clang.gni") + +# This template defines a toolchain. +# +# It requires the following variables specifying the executables to run: +# - ar +# - cc +# - cxx +# - ld +# +# Optional parameters that control the tools: +# +# - extra_cflags +# Extra flags to be appended when compiling C files (but not C++ files). +# - extra_cppflags +# Extra flags to be appended when compiling both C and C++ files. "CPP" +# stands for "C PreProcessor" in this context, although it can be +# used for non-preprocessor flags as well. Not to be confused with +# "CXX" (which follows). +# - extra_cxxflags +# Extra flags to be appended when compiling C++ files (but not C files). +# - extra_asmflags +# Extra flags to be appended when compiling assembly. +# - extra_ldflags +# Extra flags to be appended when linking +# +# - libs_section_prefix +# - libs_section_postfix +# The contents of these strings, if specified, will be placed around +# the libs section of the linker line. It allows one to inject libraries +# at the beginning and end for all targets in a toolchain. +# - solink_libs_section_prefix +# - solink_libs_section_postfix +# Same as libs_section_{pre,post}fix except used for solink instead of link. +# - link_outputs +# The content of this array, if specified, will be added to the list of +# outputs from the link command. This can be useful in conjunction with +# the post_link parameter. +# - use_unstripped_as_runtime_outputs +# When |strip| is set, mark unstripped executables as runtime deps rather +# than stripped ones. +# - post_link +# The content of this string, if specified, will be run as a separate +# command following the the link command. +# - deps +# Just forwarded to the toolchain definition. +# - executable_extension +# If this string is specified it will be used for the file extension +# for an executable, rather than using no extension; targets will +# still be able to override the extension using the output_extension +# variable. +# - rebuild_define +# The contents of this string, if specified, will be passed as a #define +# to the toolchain. It can be used to force recompiles whenever a +# toolchain is updated. +# - shlib_extension +# If this string is specified it will be used for the file extension +# for a shared library, rather than default value specified in +# toolchain.gni +# - strip +# Location of the strip executable. When specified, strip will be run on +# all shared libraries and executables as they are built. The pre-stripped +# artifacts will be put in lib.unstripped/ and exe.unstripped/. +template("clang_toolchain") { + declare_args() { + shlib_prefix = "lib" + shlib_extension = ".so" + } + + params = { + if (defined(invoker.prefix)) { + prefix = invoker.prefix + } else { + prefix = rebase_path("$clang_base_path/bin", root_build_dir) + } + if (defined(invoker.ar)) { + ar = invoker.ar + } else { + ar = "${prefix}/llvm-ar" + } + + if (defined(invoker.cc)) { + cc = invoker.cc + } else { + cc = "${prefix}/clang" + } + + if (defined(invoker.cxx)) { + cxx = invoker.cxx + } else { + cxx = "${prefix}/clang++" + } + + if (defined(invoker.ld)) { + ld = invoker.ld + } else { + ld = cxx + } + } + + toolchain(target_name) { + assert(defined(params.ar), "clang_toolchain() must specify a \"ar\" value") + assert(defined(params.cc), "clang_toolchain() must specify a \"cc\" value") + assert(defined(params.cxx), "clang_toolchain() must specify a \"cxx\" value") + assert(defined(params.ld), "clang_toolchain() must specify a \"ld\" value") + + # This define changes when the toolchain changes, forcing a rebuild. + # Nothing should ever use this define. + if (defined(invoker.rebuild_define)) { + rebuild_string = "-D" + invoker.rebuild_define + " " + } else { + rebuild_string = "" + } + + # GN's syntax can't handle more than one scope dereference at once, like + # "invoker.toolchain_args.foo", so make a temporary to hold the toolchain + # args so we can do "invoker_toolchain_args.foo". + assert(defined(invoker.toolchain_args), + "Toolchains must specify toolchain_args") + invoker_toolchain_args = invoker.toolchain_args + assert(defined(invoker_toolchain_args.current_cpu), + "toolchain_args must specify a current_cpu") + assert(defined(invoker_toolchain_args.current_os), + "toolchain_args must specify a current_os") + + # When invoking this toolchain not as the default one, these args will be + # passed to the build. They are ignored when this is the default toolchain. + toolchain_args = { + # Populate toolchain args from the invoker. + forward_variables_from(invoker_toolchain_args, "*") + + # The host toolchain value computed by the default toolchain's setup + # needs to be passed through unchanged to all secondary toolchains to + # ensure that it's always the same, regardless of the values that may be + # set on those toolchains. + host_toolchain = host_toolchain + } + + compiler_prefix = " " + + # Create a distinct variable for "asm", since analysis runs pass # a bunch + # of flags to clang/clang++ that are nonsensical on assembler runs. + asm_prefix = compiler_prefix + + cc = compiler_prefix + params.cc + cxx = compiler_prefix + params.cxx + asm = asm_prefix + params.cc + ar = params.ar + ld = params.ld + + if (defined(invoker.shlib_extension)) { + default_shlib_extension = invoker.shlib_extension + } else { + default_shlib_extension = shlib_extension + } + + if (defined(invoker.default_shlib_subdir)) { + default_shlib_subdir = invoker.default_shlib_subdir + } else { + default_shlib_subdir = "" + } + + if (defined(invoker.executable_extension)) { + default_executable_extension = invoker.executable_extension + } else { + default_executable_extension = "" + } + + # Bring these into our scope for string interpolation with default values. + if (defined(invoker.libs_section_prefix)) { + libs_section_prefix = invoker.libs_section_prefix + } else { + libs_section_prefix = "" + } + + if (defined(invoker.libs_section_postfix)) { + libs_section_postfix = invoker.libs_section_postfix + } else { + libs_section_postfix = "" + } + + if (defined(invoker.solink_libs_section_prefix)) { + solink_libs_section_prefix = invoker.solink_libs_section_prefix + } else { + solink_libs_section_prefix = "" + } + + if (defined(invoker.solink_libs_section_postfix)) { + solink_libs_section_postfix = invoker.solink_libs_section_postfix + } else { + solink_libs_section_postfix = "" + } + + if (defined(invoker.extra_cflags) && invoker.extra_cflags != "") { + extra_cflags = " " + invoker.extra_cflags + } else { + extra_cflags = "" + } + + if (defined(invoker.extra_cppflags) && invoker.extra_cppflags != "") { + extra_cppflags = " " + invoker.extra_cppflags + } else { + extra_cppflags = "" + } + + if (defined(invoker.extra_cxxflags) && invoker.extra_cxxflags != "") { + extra_cxxflags = " " + invoker.extra_cxxflags + } else { + extra_cxxflags = "" + } + + if (defined(invoker.extra_asmflags) && invoker.extra_asmflags != "") { + extra_asmflags = " " + invoker.extra_asmflags + } else { + extra_asmflags = "" + } + + if (defined(invoker.extra_ldflags) && invoker.extra_ldflags != "") { + extra_ldflags = " " + invoker.extra_ldflags + } else { + extra_ldflags = "" + } + + # These library switches can apply to all tools below. + lib_switch = "-l" + lib_dir_switch = "-L" + + # Object files go in this directory. + object_subdir = "{{target_out_dir}}/{{label_name}}" + + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "$object_subdir/{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "$object_subdir/{{source_name_part}}.o", + ] + } + + tool("asm") { + # For clang we can just use the C compiler to compile assembly. + depfile = "{{output}}.d" + command = "$asm -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}}${extra_asmflags} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "ASM {{output}}" + outputs = [ + "$object_subdir/{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = "\"$ar\" {{arflags}} -r -c -s -D {{output}} @\"$rspfile\"" + + # Remove the output file first so that ar doesn't try to modify the + # existing file. + command = "rm -f {{output}} && $command" + + # Almost all targets build with //build/config/compiler:thin_archive which + # adds -T to arflags. + description = "AR {{output}}" + outputs = [ + "{{output_dir}}/{{target_output_name}}{{output_extension}}", + ] + + # Shared libraries go in the target out directory by default so we can + # generate different targets with the same name and not have them collide. + default_output_dir = "{{target_out_dir}}" + default_output_extension = ".a" + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir. + rspfile = sofile + ".rsp" + + if (defined(invoker.strip)) { + unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" + } else { + unstripped_sofile = sofile + } + + # These variables are not built into GN but are helpers that + # implement (1) linking to produce a .so, (2) extracting the symbols + # from that file (3) if the extracted list differs from the existing + # .TOC file, overwrite it, otherwise, don't change it. + tocfile = sofile + ".TOC" + + link_command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" -Wl,-soname=\"$soname\" @\"$rspfile\"" + + # Generate a map file to be used for binary size analysis. + if (defined(invoker.strip)) { + strip_switch = "--strip=${invoker.strip} " + } + + command = "$link_command" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" + description = "SOLINK $sofile" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = default_shlib_extension + + default_output_dir = "{{root_out_dir}}${default_shlib_subdir}" + + output_prefix = "lib" + + # Since the above commands only updates the .TOC file when it changes, ask + # Ninja to check if the timestamp actually changed to know if downstream + # dependencies should be recompiled. + restat = true + + # Tell GN about the output files. It will link to the sofile but use the + # tocfile for dependency management. + outputs = [ + sofile, + tocfile, + ] + if (sofile != unstripped_sofile) { + outputs += [ unstripped_sofile ] + if (defined(invoker.use_unstripped_as_runtime_outputs) && + invoker.use_unstripped_as_runtime_outputs) { + runtime_outputs = [ unstripped_sofile ] + } + } + if (defined(map_file)) { + outputs += [ map_file ] + } + link_output = sofile + depend_output = tocfile + } + + tool("solink_module") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + sofile = "{{output_dir}}/$soname" + rspfile = sofile + ".rsp" + + if (defined(invoker.strip)) { + unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" + } else { + unstripped_sofile = sofile + } + + command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" -Wl,-soname=\"$soname\" @\"$rspfile\"" + + if (defined(invoker.strip)) { + strip_command = "${invoker.strip} -o \"$sofile\" \"$unstripped_sofile\"" + command += " && " + strip_command + } + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" + + description = "SOLINK_MODULE $sofile" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + if (defined(invoker.loadable_module_extension)) { + default_output_extension = invoker.loadable_module_extension + } else { + default_output_extension = default_shlib_extension + } + + default_output_dir = "{{root_out_dir}}${default_shlib_subdir}" + + output_prefix = "lib" + + outputs = [ + sofile, + ] + if (sofile != unstripped_sofile) { + outputs += [ unstripped_sofile ] + if (defined(invoker.use_unstripped_as_runtime_outputs) && + invoker.use_unstripped_as_runtime_outputs) { + runtime_outputs = [ unstripped_sofile ] + } + } + } + + tool("link") { + exename = "{{target_output_name}}{{output_extension}}" + outfile = "{{output_dir}}/$exename" + rspfile = "$outfile.rsp" + unstripped_outfile = outfile + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = default_executable_extension + + default_output_dir = "{{root_out_dir}}" + + if (defined(invoker.strip)) { + unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" + } + + # Generate a map file to be used for binary size analysis. + # Map file adds ~10% to the link time on a z620. + # With target_os="android", libchrome.so.map.gz is ~20MB. + start_group_flag = "-Wl,--start-group" + end_group_flag = "-Wl,--end-group " + link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag $libs_section_prefix {{libs}} $libs_section_postfix" + + command = "$link_command" + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + if (outfile != unstripped_outfile) { + outputs += [ unstripped_outfile ] + if (defined(invoker.use_unstripped_as_runtime_outputs) && + invoker.use_unstripped_as_runtime_outputs) { + runtime_outputs = [ unstripped_outfile ] + } + } + if (defined(invoker.link_outputs)) { + outputs += invoker.link_outputs + } + if (defined(map_file)) { + outputs += [ map_file ] + } + } + + # These two are really entirely generic, but have to be repeated in + # each toolchain because GN doesn't allow a template to be used here. + # See //build/toolchain/toolchain.gni for details. + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + tool("copy") { + command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" + description = "COPY {{source}} {{output}}" + } + + forward_variables_from(invoker, [ "deps" ]) + } +}
diff --git a/build/toolchain/fuchsia/BUILD.gn b/build/toolchain/fuchsia/BUILD.gn new file mode 100644 index 0000000..8d2ba5c --- /dev/null +++ b/build/toolchain/fuchsia/BUILD.gn
@@ -0,0 +1,31 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/toolchain/clang_toolchain.gni") + +# Fuchsia builds using the Clang toolchain, with most parameters common across +# the different target architectures. +template("fuchsia_toolchain") { + clang_toolchain(target_name) { + assert(host_os == "linux" || host_os == "mac") + assert(defined(invoker.toolchain_args), + "toolchain_args must be defined for fuchsia_clang_toolchain()") + + default_shlib_subdir = "/lib" + toolchain_args = invoker.toolchain_args + toolchain_args.current_os = "fuchsia" + } +} + +fuchsia_toolchain("x64") { + toolchain_args = { + current_cpu = "x64" + } +} + +fuchsia_toolchain("arm64") { + toolchain_args = { + current_cpu = "arm64" + } +}
diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn new file mode 100644 index 0000000..60e4027 --- /dev/null +++ b/build/toolchain/linux/BUILD.gn
@@ -0,0 +1,21 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/toolchain/clang_toolchain.gni") + +template("linux_toolchain") { + clang_toolchain(target_name) { + assert(host_os == "linux") + assert(defined(invoker.toolchain_args), + "toolchain_args must be defined for linux_toolchain()") + + toolchain_args = invoker.toolchain_args + toolchain_args.current_os = "linux" + } +} +linux_toolchain("clang_x64") { + toolchain_args = { + current_cpu = "x64" + } +}
diff --git a/out/core.astro-release/.ninja_deps b/out/core.astro-release/.ninja_deps new file mode 100644 index 0000000..f3f0e01 --- /dev/null +++ b/out/core.astro-release/.ninja_deps Binary files differ
diff --git a/out/core.astro-release/.ninja_log b/out/core.astro-release/.ninja_log new file mode 100644 index 0000000..8b33ae0 --- /dev/null +++ b/out/core.astro-release/.ninja_log
@@ -0,0 +1,87 @@ +# ninja log v5 +1 17 315475200000000000 lib/libc++.so.2 ee46729cd52af503 +1 17 315475200000000000 lib/libc++abi.so.1 f671c24d4f61fc66 +2 18 315475200000000000 lib/libunwind.so.1 d60c36afd6aa1cd3 +3 18 1587411117000000000 lib/ld.so.1 ac3cbec5c26be1cf +4 19 1587411114000000000 lib/libfdio.so 9a287126e71be341 +18 23 1587411706802172839 obj/build/config/clang/clang-runtime-libs.stamp aa752f47ea7054ce +19 24 1587411706802172839 obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp 8d92d9795bd7e12b +19 24 1587411706802172839 obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp f00c166e57b559ea +23 28 1587411706806172850 obj/build/config/clang/c++-runtime-deps.stamp 57357c7a6b6ec668 +24 31 1587411706810172860 obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a 88df563c2e735709 +31 34 1587411706814172870 obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp b7b7a1937485a311 +3 46 1587411706822172892 obj/src/dhrystone/dhrystone_bin/dhry_2.o f1efe85914f0d6b4 +6 75 1587411706850172964 obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o 37b4b8c6e0db8ac4 +4 75 1587411706850172964 obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o d85b694abae78d65 +7 80 1587411706858172985 obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o ac0ad8d41fbdaa43 +17 85 1587411706862172996 obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o 4f60121b9dbccd0a +16 85 1587411706862172996 obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o f9ec532500fdb85a +5 95 1587411706870173016 obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o 68964a882cc12c8c +6 99 1587411706874173027 obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o 4f185375928a1b25 +10 100 1587411706874173027 obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o a3fc1fd6d856ebd6 +5 101 1587411706878173038 obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o 9d87064f18bb31a0 +13 104 1587411706882173047 obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o ef64efb780df93ce +10 104 1587411706882173047 obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o 3263643e9cdfb24f +7 105 1587411706882173047 obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o dee30624722a0463 +8 105 1587411706882173047 obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o 9f6b72acaa0a9036 +13 105 1587411706882173047 obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o 8d53c9913d66a812 +12 105 1587411706882173047 obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o 4c36db13aa9328f9 +15 108 1587411706886173058 obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o d1ed20b7fe925018 +9 108 1587411706886173058 obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o fa3abc6d50a13908 +14 108 1587411706886173058 obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o 434f872f6fc2c2e1 +11 109 1587411706886173058 obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o ef0a38da4aa5a9b8 +9 109 1587411706886173058 obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o 38df95f2c912b01f +11 111 1587411706886173058 obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o 746d6758c70fc12c +15 111 1587411706890173068 obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o 3a846c44bc5d8b1f +111 115 1587411706894173079 obj/third_party/fuchsia-sdk/pkg/zx/libzx.a 6ae6d8055a9c1190 +2 140 1587411706918173142 obj/src/dhrystone/dhrystone_bin/dhry_1.o a54bed2d8e259c4e +140 172 1587411706946173214 dhrystone_bin cb2d05f02cd1f1ad +172 176 1587411706954173235 obj/src/dhrystone/dhrystone_cmx.stamp 49bf52a5f622d724 +176 227 1587411707002173360 gen/src/dhrystone/dhrystone/dhrystone.archive_manifest 6939674628a2ebc7 +176 227 1587411707002173360 gen/src/dhrystone/dhrystone/ids.txt 6939674628a2ebc7 +176 227 1587411707002173360 gen/src/dhrystone/dhrystone/package 6939674628a2ebc7 +227 231 1587411707010173381 obj/src/dhrystone/dhrystone_package__archive-manifest.stamp 22a54a2ff570c77a +231 281 1587411707054173495 gen/src/dhrystone/dhrystone/meta.far 683eaecb5f9b4482 +231 281 1587411707054173495 gen/src/dhrystone/dhrystone/package_manifest.json 683eaecb5f9b4482 +281 285 1587411707062173516 obj/src/dhrystone/dhrystone_package__archive-metadata.stamp 368104d9d2c1aa19 +285 328 1587411707102173621 gen/src/dhrystone/dhrystone/dhrystone.far f44f520c0caf6bfd +328 332 1587411707110173641 obj/src/dhrystone/dhrystone_package.stamp 460e0a3303cdb6f0 +332 336 1587411707114173651 obj/src/dhrystone/dhrystone.stamp cd8bbdf554205453 +336 339 1587411707118173662 obj/default.stamp 779238219a0eff9c +2 55 1587419777718045001 obj/src/dhrystone/dhrystone_bin/dhry_2.o 4eaac9e89c44ad4e +7 73 1587419777734045039 obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o 75860eb82aa56b5b +6 74 1587419777734045039 obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o 9bb56f97fdd7fff3 +7 74 1587419777738045048 obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o 5e1ee328cb5b56cc +5 75 1587419777738045048 obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o 4e56d5134ce7555e +6 80 1587419777742045057 obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o 6773d780e4a17678 +8 82 1587419777746045067 obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o f99b9bee1ed6f7aa +12 86 1587419777750045076 obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o 79bd6b42f44d5974 +3 94 1587419777758045095 obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o f85d5126aa847494 +4 97 1587419777758045095 obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o 33340632bbec1608 +2 101 1587419777762045105 obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o 12cd309c926c54e0 +4 103 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o b8a1eea217409f24 +3 103 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o 16eff5976b56a640 +5 103 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o 8f801c2e98a24aab +10 104 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o 5fd9122a5cfa75cf +5 104 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o ff67a9ec24b08d09 +10 104 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o 9686dbb1ad1c045e +13 105 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o 8e5f447854ca4249 +11 105 1587419777766045113 obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o 5980c56ee08eca29 +8 108 1587419777770045124 obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o 307c16e9502c469f +11 108 1587419777770045124 obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o 7e26a4e36d377f47 +13 108 1587419777770045124 obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o 9f65e887e0343dee +9 112 1587419777774045132 obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o 629632a052ef021 +112 116 1587419777782045152 obj/third_party/fuchsia-sdk/pkg/zx/libzx.a 6ae6d8055a9c1190 +1 150 1587419777814045227 obj/src/dhrystone/dhrystone_bin/dhry_1.o 6526941014f399e +150 175 1587419777834045274 dhrystone_bin d46fc42cea5891b3 +175 226 1587419777886045395 gen/src/dhrystone/dhrystone/dhrystone.archive_manifest 6939674628a2ebc7 +175 226 1587419777886045395 gen/src/dhrystone/dhrystone/ids.txt 6939674628a2ebc7 +175 226 1587419777886045395 gen/src/dhrystone/dhrystone/package 6939674628a2ebc7 +226 229 1587419777894045414 obj/src/dhrystone/dhrystone_package__archive-manifest.stamp 22a54a2ff570c77a +230 271 1587419777930045500 gen/src/dhrystone/dhrystone/meta.far 683eaecb5f9b4482 +230 271 1587419777930045500 gen/src/dhrystone/dhrystone/package_manifest.json 683eaecb5f9b4482 +271 274 1587419777938045517 obj/src/dhrystone/dhrystone_package__archive-metadata.stamp 368104d9d2c1aa19 +274 318 1587419777978045612 gen/src/dhrystone/dhrystone/dhrystone.far f44f520c0caf6bfd +318 321 1587419777986045631 obj/src/dhrystone/dhrystone_package.stamp 460e0a3303cdb6f0 +321 324 1587419777990045640 obj/src/dhrystone/dhrystone.stamp cd8bbdf554205453 +324 327 1587419777990045640 obj/default.stamp 779238219a0eff9c
diff --git a/out/core.astro-release/args.gn b/out/core.astro-release/args.gn new file mode 100644 index 0000000..058cfc3 --- /dev/null +++ b/out/core.astro-release/args.gn
@@ -0,0 +1,2 @@ +target_os = "fuchsia" +target_cpu = "arm64"
diff --git a/out/core.astro-release/build.ninja b/out/core.astro-release/build.ninja new file mode 100644 index 0000000..a5a6bab --- /dev/null +++ b/out/core.astro-release/build.ninja
@@ -0,0 +1,67 @@ +ninja_required_version = 1.7.2 + +rule gn + command = ../../buildtools/downloads/gn-linux-amd64-git_revision:239533d2d91a04b3317ca9101cf7189f4e651e4d/gn --root=../.. -q gen . + description = Regenerating ninja files + +build build.ninja: gn + generator = 1 + depfile = build.ninja.d + +subninja toolchain.ninja + +build default: phony obj/default.stamp +build c++-runtime-deps: phony obj/build/config/clang/c++-runtime-deps.stamp +build clang-runtime-libs: phony obj/build/config/clang/clang-runtime-libs.stamp +build dhrystone: phony obj/src/dhrystone/dhrystone.stamp +build dhrystone_cmx: phony obj/src/dhrystone/dhrystone_cmx.stamp +build dhrystone_package: phony obj/src/dhrystone/dhrystone_package.stamp +build dhrystone_package__archive-manifest: phony obj/src/dhrystone/dhrystone_package__archive-manifest.stamp +build dhrystone_package__archive-metadata: phony obj/src/dhrystone/dhrystone_package__archive-metadata.stamp +build dhrystone_packaged_components_metadata: phony obj/src/dhrystone/dhrystone_packaged_components_metadata.stamp +build fdio: phony obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a +build fdio_dist_libs: phony obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp +build runtime_library_group: phony obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp +build sysroot_dist_libs: phony obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp +build zx: phony obj/third_party/fuchsia-sdk/pkg/zx/libzx.a +build $:default: phony obj/default.stamp +build build/config/clang$:c++-runtime-deps: phony obj/build/config/clang/c++-runtime-deps.stamp +build build/config/clang$:clang-runtime-libs: phony obj/build/config/clang/clang-runtime-libs.stamp +build src/dhrystone$:dhrystone: phony obj/src/dhrystone/dhrystone.stamp +build src/dhrystone: phony obj/src/dhrystone/dhrystone.stamp +build src/dhrystone$:dhrystone_bin: phony ./dhrystone_bin +build src/dhrystone$:dhrystone_cmx: phony obj/src/dhrystone/dhrystone_cmx.stamp +build src/dhrystone$:dhrystone_package: phony obj/src/dhrystone/dhrystone_package.stamp +build src/dhrystone$:dhrystone_package__archive-manifest: phony obj/src/dhrystone/dhrystone_package__archive-manifest.stamp +build src/dhrystone$:dhrystone_package__archive-metadata: phony obj/src/dhrystone/dhrystone_package__archive-metadata.stamp +build src/dhrystone$:dhrystone_packaged_components_metadata: phony obj/src/dhrystone/dhrystone_packaged_components_metadata.stamp +build third_party/fuchsia-sdk/build/config$:runtime_library_group: phony obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp +build third_party/fuchsia-sdk/build/config$:sysroot_dist_libs: phony obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp +build third_party/fuchsia-sdk/pkg/fdio$:all: phony obj/third_party/fuchsia-sdk/pkg/fdio/all.stamp +build third_party/fuchsia-sdk/pkg/fdio$:fdio: phony obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a +build third_party/fuchsia-sdk/pkg/fdio: phony obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a +build third_party/fuchsia-sdk/pkg/fdio$:fdio_dist_libs: phony obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp +build third_party/fuchsia-sdk/pkg/zx$:all: phony obj/third_party/fuchsia-sdk/pkg/zx/all.stamp +build third_party/fuchsia-sdk/pkg/zx$:zx: phony obj/third_party/fuchsia-sdk/pkg/zx/libzx.a +build third_party/fuchsia-sdk/pkg/zx: phony obj/third_party/fuchsia-sdk/pkg/zx/libzx.a + +build all: phony $ + obj/default.stamp $ + obj/build/config/clang/c++-runtime-deps.stamp $ + obj/build/config/clang/clang-runtime-libs.stamp $ + obj/src/dhrystone/dhrystone.stamp $ + ./dhrystone_bin $ + obj/src/dhrystone/dhrystone_cmx.stamp $ + obj/src/dhrystone/dhrystone_package.stamp $ + obj/src/dhrystone/dhrystone_package__archive-manifest.stamp $ + obj/src/dhrystone/dhrystone_package__archive-metadata.stamp $ + obj/src/dhrystone/dhrystone_packaged_components_metadata.stamp $ + obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp $ + obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp $ + obj/third_party/fuchsia-sdk/pkg/fdio/all.stamp $ + obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a $ + obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp $ + obj/third_party/fuchsia-sdk/pkg/zx/all.stamp $ + obj/third_party/fuchsia-sdk/pkg/zx/libzx.a + +default default
diff --git a/out/core.astro-release/build.ninja.d b/out/core.astro-release/build.ninja.d new file mode 100644 index 0000000..3633f6f --- /dev/null +++ b/out/core.astro-release/build.ninja.d
@@ -0,0 +1 @@ +build.ninja: ../../.gn ../../BUILD.gn ../../build/BUILD.gn ../../build/BUILDCONFIG.gn ../../build/config/BUILD.gn ../../build/config/clang/BUILD.gn ../../build/config/clang/clang.gni ../../build/config/compiler/BUILD.gn ../../build/toolchain/clang_toolchain.gni ../../build/toolchain/fuchsia/BUILD.gn ./args.gn ../../src/dhrystone/BUILD.gn ../../third_party/fuchsia-sdk/build/cmc.gni ../../third_party/fuchsia-sdk/build/component.gni ../../third_party/fuchsia-sdk/build/config/BUILD.gn ../../third_party/fuchsia-sdk/build/config/config.gni ../../third_party/fuchsia-sdk/build/fuchsia_sdk_pkg.gni ../../third_party/fuchsia-sdk/build/package.gni ../../third_party/fuchsia-sdk/build/pm_tool.gni ../../third_party/fuchsia-sdk/meta/manifest.json ../../third_party/fuchsia-sdk/pkg/fdio/BUILD.gn ../../third_party/fuchsia-sdk/pkg/zx/BUILD.gn \ No newline at end of file
diff --git a/out/core.astro-release/dhrystone_bin b/out/core.astro-release/dhrystone_bin new file mode 100755 index 0000000..6372bec --- /dev/null +++ b/out/core.astro-release/dhrystone_bin Binary files differ
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.archive_manifest b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.archive_manifest new file mode 100644 index 0000000..9bbfc68 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.archive_manifest
@@ -0,0 +1,8 @@ +meta/package=gen/src/dhrystone/dhrystone/package +lib/libfdio.so=lib/libfdio.so +lib/libunwind.so.1=lib/libunwind.so.1 +lib/libc++.so.2=lib/libc++.so.2 +dhrystone_bin=dhrystone_bin +lib/ld.so.1=lib/ld.so.1 +lib/libc++abi.so.1=lib/libc++abi.so.1 +meta/dhrystone.cmx=gen/src/dhrystone/dhrystone/dhrystone.cmx
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.cmx b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.cmx new file mode 100644 index 0000000..151ce0c --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.cmx
@@ -0,0 +1,6 @@ +{ + "program": { + "binary" : "dhrystone_bin" + } + +} \ No newline at end of file
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.far b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.far new file mode 100644 index 0000000..45178fc --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.far Binary files differ
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.runtime_deps b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.runtime_deps new file mode 100644 index 0000000..8832193 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone.runtime_deps
@@ -0,0 +1,6 @@ +./dhrystone_bin +lib/libc++.so.2 +lib/libc++abi.so.1 +lib/libunwind.so.1 +lib/ld.so.1 +lib/libfdio.so
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/ids.txt b/out/core.astro-release/gen/src/dhrystone/dhrystone/ids.txt new file mode 100644 index 0000000..8ee6311 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/ids.txt
@@ -0,0 +1,6 @@ +ff6959a5ccf92c5b ../../../../lib/libfdio.so +393e362e6a016296 ../../../../lib/libunwind.so.1 +ef9f9272b514463a ../../../../lib/libc++abi.so.1 +d12fb0ac271c9330 ../../../../dhrystone_bin +fa39648a29eb2f06 ../../../../lib/ld.so.1 +a03ee9f443e83e8b ../../../../lib/libc++.so.2
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far new file mode 100644 index 0000000..f0a83a0 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far Binary files differ
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far.d b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far.d new file mode 100644 index 0000000..c9850b1 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far.d
@@ -0,0 +1 @@ +gen/src/dhrystone/dhrystone/meta.far: lib/libfdio.so lib/libunwind.so.1 lib/ld.so.1 lib/libc++abi.so.1 gen/src/dhrystone/dhrystone/dhrystone.cmx gen/src/dhrystone/dhrystone/package lib/libc++.so.2 dhrystone_bin gen/src/dhrystone/dhrystone/dhrystone.archive_manifest \ No newline at end of file
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far.merkle b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far.merkle new file mode 100755 index 0000000..830cdae --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta.far.merkle
@@ -0,0 +1 @@ +4d77989aa72b906a745fae10e2a82ad18f6ed88e51c78153ab8270ed9f866b2c \ No newline at end of file
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/meta/contents b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta/contents new file mode 100755 index 0000000..c17f061 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/meta/contents
@@ -0,0 +1,6 @@ +dhrystone_bin=a5ad491ae86ed86ab1fdadcc7af9ba2db0e1cb86c064ae4305c1d103312351bd +lib/ld.so.1=452412abbe2649d773f3e62a373262cd802c4c6991e7e693f01d72d284aa84bb +lib/libc++.so.2=2b154f638d98d9b899656da322a954c8ccbebe6c4950ac2ae8fdc853dd8a8a45 +lib/libc++abi.so.1=7cbbb4cfc47887848061dc83b250af42db252682e6d64a84ddd4974a8bc9412e +lib/libfdio.so=e53c82434c34b3390478e8a7acebb483999046894a192fe8e72f977dc0f4eb24 +lib/libunwind.so.1=80eae8a517234fe02ff42de4d3cccfebfa234c752361caf31eacb442bb1af5c4
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/package b/out/core.astro-release/gen/src/dhrystone/dhrystone/package new file mode 100644 index 0000000..a365baf --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/package
@@ -0,0 +1 @@ +{"version": "0", "name": "dhrystone"} \ No newline at end of file
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone/package_manifest.json b/out/core.astro-release/gen/src/dhrystone/dhrystone/package_manifest.json new file mode 100644 index 0000000..8083234 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone/package_manifest.json
@@ -0,0 +1,51 @@ +{ + "version": "1", + "package": { + "name": "dhrystone", + "version": "0" + }, + "blobs": [ + { + "source_path": "gen/src/dhrystone/dhrystone/meta.far", + "path": "meta/", + "merkle": "4d77989aa72b906a745fae10e2a82ad18f6ed88e51c78153ab8270ed9f866b2c", + "size": 16384 + }, + { + "source_path": "dhrystone_bin", + "path": "dhrystone_bin", + "merkle": "a5ad491ae86ed86ab1fdadcc7af9ba2db0e1cb86c064ae4305c1d103312351bd", + "size": 201792 + }, + { + "source_path": "lib/ld.so.1", + "path": "lib/ld.so.1", + "merkle": "452412abbe2649d773f3e62a373262cd802c4c6991e7e693f01d72d284aa84bb", + "size": 660184 + }, + { + "source_path": "lib/libc++.so.2", + "path": "lib/libc++.so.2", + "merkle": "2b154f638d98d9b899656da322a954c8ccbebe6c4950ac2ae8fdc853dd8a8a45", + "size": 853560 + }, + { + "source_path": "lib/libc++abi.so.1", + "path": "lib/libc++abi.so.1", + "merkle": "7cbbb4cfc47887848061dc83b250af42db252682e6d64a84ddd4974a8bc9412e", + "size": 329176 + }, + { + "source_path": "lib/libfdio.so", + "path": "lib/libfdio.so", + "merkle": "e53c82434c34b3390478e8a7acebb483999046894a192fe8e72f977dc0f4eb24", + "size": 311984 + }, + { + "source_path": "lib/libunwind.so.1", + "path": "lib/libunwind.so.1", + "merkle": "80eae8a517234fe02ff42de4d3cccfebfa234c752361caf31eacb442bb1af5c4", + "size": 198024 + } + ] +} \ No newline at end of file
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone_package_stamp.d b/out/core.astro-release/gen/src/dhrystone/dhrystone_package_stamp.d new file mode 100644 index 0000000..ec0b6f1 --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone_package_stamp.d
@@ -0,0 +1 @@ +gen/src/dhrystone/dhrystone/dhrystone.archive_manifest: lib/libfdio.so lib/libunwind.so.1 lib/libc++.so.2 dhrystone_bin lib/ld.so.1 lib/libc++abi.so.1 \ No newline at end of file
diff --git a/out/core.astro-release/gen/src/dhrystone/dhrystone_packaged_components_metadata.json b/out/core.astro-release/gen/src/dhrystone/dhrystone_packaged_components_metadata.json new file mode 100644 index 0000000..7aeceac --- /dev/null +++ b/out/core.astro-release/gen/src/dhrystone/dhrystone_packaged_components_metadata.json
@@ -0,0 +1,14 @@ +[ + [ + { + "source": "/usr/local/google/home/pshickel/src/fuchsia-benchmarks/src/dhrystone/:dhrystone_bin", + "type": "dep" + }, + { + "manifest_version": "v1", + "output_name": "dhrystone", + "source": "/usr/local/google/home/pshickel/src/fuchsia-benchmarks/src/dhrystone/dhrystone.cmx", + "type": "manifest" + } + ] +] \ No newline at end of file
diff --git a/out/core.astro-release/lib/ld.so.1 b/out/core.astro-release/lib/ld.so.1 new file mode 100755 index 0000000..1d39253 --- /dev/null +++ b/out/core.astro-release/lib/ld.so.1 Binary files differ
diff --git a/out/core.astro-release/lib/libc++.so.2 b/out/core.astro-release/lib/libc++.so.2 new file mode 100755 index 0000000..dc9d316 --- /dev/null +++ b/out/core.astro-release/lib/libc++.so.2 Binary files differ
diff --git a/out/core.astro-release/lib/libc++abi.so.1 b/out/core.astro-release/lib/libc++abi.so.1 new file mode 100755 index 0000000..5eb0a55 --- /dev/null +++ b/out/core.astro-release/lib/libc++abi.so.1 Binary files differ
diff --git a/out/core.astro-release/lib/libfdio.so b/out/core.astro-release/lib/libfdio.so new file mode 100755 index 0000000..47ef705 --- /dev/null +++ b/out/core.astro-release/lib/libfdio.so Binary files differ
diff --git a/out/core.astro-release/lib/libunwind.so.1 b/out/core.astro-release/lib/libunwind.so.1 new file mode 100755 index 0000000..39bba3b --- /dev/null +++ b/out/core.astro-release/lib/libunwind.so.1 Binary files differ
diff --git a/out/core.astro-release/obj/build/config/clang/c++-runtime-deps.stamp b/out/core.astro-release/obj/build/config/clang/c++-runtime-deps.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/build/config/clang/c++-runtime-deps.stamp
diff --git a/out/core.astro-release/obj/build/config/clang/clang-runtime-libs.stamp b/out/core.astro-release/obj/build/config/clang/clang-runtime-libs.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/build/config/clang/clang-runtime-libs.stamp
diff --git a/out/core.astro-release/obj/default.stamp b/out/core.astro-release/obj/default.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/default.stamp
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone.stamp b/out/core.astro-release/obj/src/dhrystone/dhrystone.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone.stamp
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_bin.ninja b/out/core.astro-release/obj/src/dhrystone/dhrystone_bin.ninja new file mode 100644 index 0000000..34b47d1 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_bin.ninja
@@ -0,0 +1,17 @@ +defines = -DFUCHSIA_SDK_VERSION=0.20200420.1.1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 +include_dirs = -I../.. -Igen -I../../third_party/fuchsia-sdk/pkg/zx/include +cflags = -Wall -pedantic -O3 -ffast-math -I src -DTIME -fno-strict-aliasing -fcolor-diagnostics -fmerge-all-constants -fcomplete-member-pointers -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -fPIC -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -fvisibility=hidden --target=aarch64-fuchsia --sysroot=../../third_party/fuchsia-sdk/arch/arm64/sysroot -fomit-frame-pointer +cflags_cc = -std=c++14 -isystem../../buildtools/linux64/clang-linux-amd64 -fno-exceptions -fno-rtti -fvisibility-inlines-hidden +label_name = dhrystone_bin +target_out_dir = obj/src/dhrystone +target_output_name = dhrystone_bin + +build obj/src/dhrystone/dhrystone_bin/dhry_1.o: cxx ../../src/dhrystone/dhry_1.cc +build obj/src/dhrystone/dhrystone_bin/dhry_2.o: cxx ../../src/dhrystone/dhry_2.cc + +build ./dhrystone_bin: link obj/src/dhrystone/dhrystone_bin/dhry_1.o obj/src/dhrystone/dhrystone_bin/dhry_2.o obj/third_party/fuchsia-sdk/pkg/zx/libzx.a || obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp obj/build/config/clang/c++-runtime-deps.stamp + ldflags = -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -Wl,-O2 -Wl,--gc-sections -Wl,--no-as-needed -lfdio -Wl,--as-needed --target=aarch64-fuchsia --sysroot=../../third_party/fuchsia-sdk/arch/arm64/sysroot -Wl,-rpath=\$$ORIGIN/ -Wl,-rpath-link= -L../../third_party/fuchsia-sdk/arch/arm64/lib + libs = -lpthread -lzircon + frameworks = + output_extension = + output_dir = .
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_bin/dhry_1.o b/out/core.astro-release/obj/src/dhrystone/dhrystone_bin/dhry_1.o new file mode 100644 index 0000000..b30c805 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_bin/dhry_1.o Binary files differ
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_bin/dhry_2.o b/out/core.astro-release/obj/src/dhrystone/dhrystone_bin/dhry_2.o new file mode 100644 index 0000000..3deed83 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_bin/dhry_2.o Binary files differ
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_cmx.stamp b/out/core.astro-release/obj/src/dhrystone/dhrystone_cmx.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_cmx.stamp
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_package.stamp b/out/core.astro-release/obj/src/dhrystone/dhrystone_package.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_package.stamp
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_package__archive-manifest.stamp b/out/core.astro-release/obj/src/dhrystone/dhrystone_package__archive-manifest.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_package__archive-manifest.stamp
diff --git a/out/core.astro-release/obj/src/dhrystone/dhrystone_package__archive-metadata.stamp b/out/core.astro-release/obj/src/dhrystone/dhrystone_package__archive-metadata.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/src/dhrystone/dhrystone_package__archive-metadata.stamp
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp b/out/core.astro-release/obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp b/out/core.astro-release/obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/fdio.ninja b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/fdio.ninja new file mode 100644 index 0000000..c3e3100 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/fdio.ninja
@@ -0,0 +1,11 @@ +defines = -DFUCHSIA_SDK_VERSION=0.20200420.1.1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 +include_dirs = -I../.. -Igen -I../../third_party/fuchsia-sdk/pkg/fdio/include +label_name = fdio +target_out_dir = obj/third_party/fuchsia-sdk/pkg/fdio +target_output_name = libfdio + + +build obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a: alink || obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp + arflags = + output_extension = .a + output_dir = obj/third_party/fuchsia-sdk/pkg/fdio
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a new file mode 100644 index 0000000..8b277f0 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a
@@ -0,0 +1 @@ +!<arch>
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/libzx.a b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/libzx.a new file mode 100644 index 0000000..5db968d --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/libzx.a Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx.ninja b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx.ninja new file mode 100644 index 0000000..0027893 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx.ninja
@@ -0,0 +1,35 @@ +defines = -DFUCHSIA_SDK_VERSION=0.20200420.1.1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 +include_dirs = -I../.. -Igen -I../../third_party/fuchsia-sdk/pkg/zx/include +cflags = -fno-strict-aliasing -fcolor-diagnostics -fmerge-all-constants -fcomplete-member-pointers -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -fPIC -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -fvisibility=hidden --target=aarch64-fuchsia --sysroot=../../third_party/fuchsia-sdk/arch/arm64/sysroot -fomit-frame-pointer +cflags_cc = -std=c++14 -isystem../../buildtools/linux64/clang-linux-amd64 -fno-exceptions -fno-rtti -fvisibility-inlines-hidden +label_name = zx +target_out_dir = obj/third_party/fuchsia-sdk/pkg/zx +target_output_name = libzx + +build obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/bti.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/channel.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/debuglog.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/event.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/eventpair.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/fifo.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/guest.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/interrupt.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/iommu.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/job.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/pager.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/port.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/process.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/profile.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/resource.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/socket.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/stream.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/thread.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/timer.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/vcpu.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/vmar.cc +build obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o: cxx ../../third_party/fuchsia-sdk/pkg/zx/vmo.cc + +build obj/third_party/fuchsia-sdk/pkg/zx/libzx.a: alink obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o + arflags = + output_extension = .a + output_dir = obj/third_party/fuchsia-sdk/pkg/zx
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o new file mode 100644 index 0000000..f0fa4b0 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/bti.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o new file mode 100644 index 0000000..a1123aa --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/channel.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o new file mode 100644 index 0000000..ec743f8 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/debuglog.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o new file mode 100644 index 0000000..787ad0f --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/event.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o new file mode 100644 index 0000000..ed66dde --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/eventpair.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o new file mode 100644 index 0000000..863ff58 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/fifo.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o new file mode 100644 index 0000000..6e32f39 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/guest.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o new file mode 100644 index 0000000..3d529cd --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/interrupt.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o new file mode 100644 index 0000000..c96ec11 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/iommu.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o new file mode 100644 index 0000000..9745437 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/job.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o new file mode 100644 index 0000000..af7d0ab --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/pager.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o new file mode 100644 index 0000000..af03506 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/port.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o new file mode 100644 index 0000000..773741c --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/process.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o new file mode 100644 index 0000000..cf22e77 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/profile.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o new file mode 100644 index 0000000..353ef7a --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/resource.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o new file mode 100644 index 0000000..3a87b18 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/socket.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o new file mode 100644 index 0000000..b1df1c1 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/stream.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o new file mode 100644 index 0000000..33db1fc --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/thread.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o new file mode 100644 index 0000000..d20e937 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/timer.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o new file mode 100644 index 0000000..d96ce6c --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vcpu.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o new file mode 100644 index 0000000..c1e70c8 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vmar.o Binary files differ
diff --git a/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o new file mode 100644 index 0000000..ec486f4 --- /dev/null +++ b/out/core.astro-release/obj/third_party/fuchsia-sdk/pkg/zx/zx/vmo.o Binary files differ
diff --git a/out/core.astro-release/toolchain.ninja b/out/core.astro-release/toolchain.ninja new file mode 100644 index 0000000..c507c7d --- /dev/null +++ b/out/core.astro-release/toolchain.ninja
@@ -0,0 +1,91 @@ +rule solink + command = ../../buildtools/linux64/clang-linux-amd64/bin/clang++ -shared ${ldflags} -o "${output_dir}/${target_output_name}${output_extension}" -Wl,-soname="${target_output_name}${output_extension}" @"${output_dir}/${target_output_name}${output_extension}.rsp" + description = SOLINK ${output_dir}/${target_output_name}${output_extension} + rspfile = ${output_dir}/${target_output_name}${output_extension}.rsp + rspfile_content = -Wl,--whole-archive ${in} ${solibs} -Wl,--no-whole-archive ${libs} + restat = 1 +rule alink + command = rm -f ${out} && "../../buildtools/linux64/clang-linux-amd64/bin/llvm-ar" ${arflags} -r -c -s -D ${out} @"${out}.rsp" + description = AR ${out} + rspfile = ${out}.rsp + rspfile_content = ${in} +rule stamp + command = touch ${out} + description = STAMP ${out} +rule link + command = ../../buildtools/linux64/clang-linux-amd64/bin/clang++ ${ldflags} -o "${output_dir}/${target_output_name}${output_extension}" -Wl,--start-group @"${output_dir}/${target_output_name}${output_extension}.rsp" ${solibs} -Wl,--end-group ${libs} + description = LINK ${output_dir}/${target_output_name}${output_extension} + rspfile = ${output_dir}/${target_output_name}${output_extension}.rsp + rspfile_content = ${in} +rule cxx + command = ../../buildtools/linux64/clang-linux-amd64/bin/clang++ -MMD -MF ${out}.d ${defines} ${include_dirs} ${cflags} ${cflags_cc} -c ${in} -o ${out} + description = CXX ${out} + depfile = ${out}.d + deps = gcc +rule solink_module + command = ../../buildtools/linux64/clang-linux-amd64/bin/clang++ -shared ${ldflags} -o "${output_dir}/${target_output_name}${output_extension}" -Wl,-soname="${target_output_name}${output_extension}" @"${output_dir}/${target_output_name}${output_extension}.rsp" + description = SOLINK_MODULE ${output_dir}/${target_output_name}${output_extension} + rspfile = ${output_dir}/${target_output_name}${output_extension}.rsp + rspfile_content = -Wl,--whole-archive ${in} ${solibs} -Wl,--no-whole-archive ${libs} +rule cc + command = ../../buildtools/linux64/clang-linux-amd64/bin/clang -MMD -MF ${out}.d ${defines} ${include_dirs} ${cflags} ${cflags_c} -c ${in} -o ${out} + description = CC ${out} + depfile = ${out}.d + deps = gcc +rule asm + command = ../../buildtools/linux64/clang-linux-amd64/bin/clang -MMD -MF ${out}.d ${defines} ${include_dirs} ${asmflags} -c ${in} -o ${out} + description = ASM ${out} + depfile = ${out}.d + deps = gcc +rule copy + command = ln -f ${in} ${out} 2>/dev/null || (rm -rf ${out} && cp -af ${in} ${out}) + description = COPY ${in} ${out} + +build obj/default.stamp: stamp obj/src/dhrystone/dhrystone.stamp +build obj/build/config/clang/c++-runtime-deps.stamp: stamp || obj/build/config/clang/clang-runtime-libs.stamp +build lib/libc++.so.2: copy ../../buildtools/linux64/clang-linux-amd64/lib/aarch64-unknown-fuchsia/c++/libc++.so.2.0 +build lib/libc++abi.so.1: copy ../../buildtools/linux64/clang-linux-amd64/lib/aarch64-unknown-fuchsia/c++/libc++abi.so.1.0 +build lib/libunwind.so.1: copy ../../buildtools/linux64/clang-linux-amd64/lib/aarch64-unknown-fuchsia/c++/libunwind.so.1.0 + +build obj/build/config/clang/clang-runtime-libs.stamp: stamp lib/libc++.so.2 lib/libc++abi.so.1 lib/libunwind.so.1 +build obj/src/dhrystone/dhrystone.stamp: stamp ./dhrystone_bin obj/src/dhrystone/dhrystone_package.stamp +subninja obj/src/dhrystone/dhrystone_bin.ninja +build obj/src/dhrystone/dhrystone_cmx.stamp: stamp || ./dhrystone_bin +rule __src_dhrystone_dhrystone_package___build_toolchain_fuchsia_arm64__rule + command = python ../../third_party/fuchsia-sdk/build/gn_run_binary.py ../../third_party/fuchsia-sdk/tools/pm -o gen/src/dhrystone/dhrystone -m gen/src/dhrystone/dhrystone/dhrystone.archive_manifest archive --output /usr/local/google/home/pshickel/src/fuchsia-benchmarks/out/core.astro-release/gen/src/dhrystone/dhrystone/dhrystone + description = ACTION //src/dhrystone:dhrystone_package(//build/toolchain/fuchsia:arm64) + restat = 1 + +build gen/src/dhrystone/dhrystone/dhrystone.far: __src_dhrystone_dhrystone_package___build_toolchain_fuchsia_arm64__rule | ../../third_party/fuchsia-sdk/build/gn_run_binary.py ../../third_party/fuchsia-sdk/meta/manifest.json ../../third_party/fuchsia-sdk/tools/pm gen/src/dhrystone/dhrystone/dhrystone.archive_manifest gen/src/dhrystone/dhrystone/meta.far obj/src/dhrystone/dhrystone_package__archive-metadata.stamp + +build obj/src/dhrystone/dhrystone_package.stamp: stamp gen/src/dhrystone/dhrystone/dhrystone.far +rule __src_dhrystone_dhrystone_package__archive-manifest___build_toolchain_fuchsia_arm64__rule + command = python ../../third_party/fuchsia-sdk/build/prepare_package_inputs.py --root-dir ../../ --out-dir . --app-name dhrystone --runtime-deps-file gen/src/dhrystone/dhrystone/dhrystone.runtime_deps --depfile-path gen/src/dhrystone/dhrystone_package_stamp.d --manifest-path gen/src/dhrystone/dhrystone/dhrystone.archive_manifest --build-ids-file gen/src/dhrystone/dhrystone/ids.txt --json-file /usr/local/google/home/pshickel/src/fuchsia-benchmarks/out/core.astro-release/gen/src/dhrystone/dhrystone_packaged_components_metadata.json + description = ACTION //src/dhrystone:dhrystone_package__archive-manifest(//build/toolchain/fuchsia:arm64) + restat = 1 + +build gen/src/dhrystone/dhrystone/dhrystone.archive_manifest gen/src/dhrystone/dhrystone/ids.txt gen/src/dhrystone/dhrystone/package: __src_dhrystone_dhrystone_package__archive-manifest___build_toolchain_fuchsia_arm64__rule | ../../third_party/fuchsia-sdk/build/prepare_package_inputs.py gen/src/dhrystone/dhrystone/dhrystone.runtime_deps obj/src/dhrystone/dhrystone_cmx.stamp + depfile = gen/src/dhrystone/dhrystone_package_stamp.d + +build obj/src/dhrystone/dhrystone_package__archive-manifest.stamp: stamp gen/src/dhrystone/dhrystone/dhrystone.archive_manifest gen/src/dhrystone/dhrystone/ids.txt gen/src/dhrystone/dhrystone/package || obj/src/dhrystone/dhrystone_cmx.stamp +rule __src_dhrystone_dhrystone_package__archive-metadata___build_toolchain_fuchsia_arm64__rule + command = python ../../third_party/fuchsia-sdk/build/gn_run_binary.py ../../third_party/fuchsia-sdk/tools/pm -o gen/src/dhrystone/dhrystone -m gen/src/dhrystone/dhrystone/dhrystone.archive_manifest build -depfile -output-package-manifest gen/src/dhrystone/dhrystone/package_manifest.json + description = ACTION //src/dhrystone:dhrystone_package__archive-metadata(//build/toolchain/fuchsia:arm64) + restat = 1 + +build gen/src/dhrystone/dhrystone/meta.far gen/src/dhrystone/dhrystone/package_manifest.json: __src_dhrystone_dhrystone_package__archive-metadata___build_toolchain_fuchsia_arm64__rule | ../../third_party/fuchsia-sdk/build/gn_run_binary.py ../../third_party/fuchsia-sdk/meta/manifest.json ../../third_party/fuchsia-sdk/tools/pm gen/src/dhrystone/dhrystone/dhrystone.archive_manifest obj/src/dhrystone/dhrystone_package__archive-manifest.stamp + depfile = gen/src/dhrystone/dhrystone/meta.far.d + +build obj/src/dhrystone/dhrystone_package__archive-metadata.stamp: stamp gen/src/dhrystone/dhrystone/meta.far gen/src/dhrystone/dhrystone/package_manifest.json +build obj/src/dhrystone/dhrystone_packaged_components_metadata.stamp: stamp obj/src/dhrystone/dhrystone_cmx.stamp +build obj/third_party/fuchsia-sdk/build/config/runtime_library_group.stamp: stamp || obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a +build lib/ld.so.1: copy ../../third_party/fuchsia-sdk/arch/arm64/sysroot/dist/lib/ld.so.1 + +build obj/third_party/fuchsia-sdk/build/config/sysroot_dist_libs.stamp: stamp lib/ld.so.1 +build obj/third_party/fuchsia-sdk/pkg/fdio/all.stamp: stamp obj/third_party/fuchsia-sdk/pkg/fdio/libfdio.a +subninja obj/third_party/fuchsia-sdk/pkg/fdio/fdio.ninja +build lib/libfdio.so: copy ../../third_party/fuchsia-sdk/arch/arm64/dist/libfdio.so + +build obj/third_party/fuchsia-sdk/pkg/fdio/fdio_dist_libs.stamp: stamp lib/libfdio.so +build obj/third_party/fuchsia-sdk/pkg/zx/all.stamp: stamp obj/third_party/fuchsia-sdk/pkg/zx/libzx.a +subninja obj/third_party/fuchsia-sdk/pkg/zx/zx.ninja
diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100755 index 0000000..c8f5654 --- /dev/null +++ b/scripts/common.sh
@@ -0,0 +1,54 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -eu # Error checking +err_print() { + echo "Error on line $1" +} +trap 'err_print $LINENO' ERR +DEBUG_LINE() { + "$@" +} + +function get_gn_root() { + ROOT_DIR="$(pwd)" + while [[ "${ROOT_DIR}" != "/" ]]; do + if [[ -f "${ROOT_DIR}/.gn" ]]; then + break + fi + ROOT_DIR="$(dirname "${ROOT_DIR}")" + done + if [[ "${ROOT_DIR}" == "/" ]]; then + echo "Error! could not find the root of the project. The current working directory needs to be under the root of the project" + exit 2 + fi + echo "${ROOT_DIR}" +} + +function get_buildtools_dir() { + echo "$(get_gn_root)/buildtools" +} + +function get_third_party_dir() { + echo "$(get_gn_root)/third_party" +} + +function get_depot_tools_dir() { + # Make the host os specific subdir + # The directory structure is designed to be compatibile with + # Chromium Depot tools + # see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md#install + case "$(uname -s)" in + Linux*) HOST_DIR="linux64";; + Darwin*) HOST_DIR="mac64";; + *) echo "Unsupported host os: $(uname -s)" && exit 1 + esac + echo "$(get_buildtools_dir)/${HOST_DIR}" +} + +function is-mac { + [[ "$(uname -s)" == "Darwin" ]] && return 0 + return 1 +}
diff --git a/scripts/download-build-tools.sh b/scripts/download-build-tools.sh new file mode 100755 index 0000000..9235225 --- /dev/null +++ b/scripts/download-build-tools.sh
@@ -0,0 +1,142 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -eu # Error checking +err_print() { + cleanup + echo "Error on line $1" +} +trap 'err_print $LINENO' ERR +DEBUG_LINE() { + "$@" +} + +SCRIPT_SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +FORCE=0 + +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/common.sh" || exit $? +REPO_ROOT="$(get_gn_root)" # finds path to REPO_ROOT +BUILD_TOOLS_DIR="$(get_buildtools_dir)" # finds path to BUILD_TOOLS_DIR +DEPOT_TOOLS_DIR="$(get_depot_tools_dir)" # finds path to DEPOT_TOOLS_DIR +DOWNLOADS_DIR="${BUILD_TOOLS_DIR}/downloads" + +cleanup() { + echo "Cleaning up downloaded build tools..." + # Remove the download directories + rm -rf "${BUILD_TOOLS_DIR}" "${DEPOT_TOOLS_DIR}" +} + +function usage { + echo "Usage: $0" + echo " [--force]" + echo " Delete build tools directory before downloading" +} + +# Parse command line +for i in "$@" +do +case "${i}" in + -f|--force) + FORCE=1 + ;; + *) + # unknown option + usage + exit 1 + ;; +esac +done + +# If force option is set, cleanup all downloaded tools +if (( FORCE )); then + cleanup +fi + +# Create build tools directory if it doesn't exist +if [ ! -d "${BUILD_TOOLS_DIR}" ]; then + mkdir "${BUILD_TOOLS_DIR}" +fi + +# Create depot tools directory if it doesn't exist +if [[ ! -d "${DEPOT_TOOLS_DIR}" ]]; then + mkdir "${DEPOT_TOOLS_DIR}" +fi + +# Create build tools download directory if it doesn't exist +if [ ! -d "${DOWNLOADS_DIR}" ]; then + mkdir "${DOWNLOADS_DIR}" +fi + +if is-mac; then + ARCH=mac-amd64 +else + ARCH=linux-amd64 +fi + +# Download a CIPD archive and extract it to a directory based on the name and ${ARCH} +# download_cipd [name] [cipd-ref] [cipd-version] [cipd-architecture] +function download_cipd { + CIPD_NAME="$1" + # Valid cipd references can be found with the command-line tool: cipd ls -r | grep $search + CIPD_REF="$2" + # Valid cipd versions can be of many types, such as "latest", a git_revision, or a version string + CIPD_VERSION="$3" + # Download for a specific architecture, if empty string then download a generic version + # For CIPD urls, replace /dl/ with /p/ if you want to inspect the directory in a web browser + if [[ "$4" == "" ]]; then + CIPD_URL="https://chrome-infra-packages.appspot.com/dl/${CIPD_REF}/+/${CIPD_VERSION}" + else + CIPD_URL="https://chrome-infra-packages.appspot.com/dl/${CIPD_REF}/${4}/+/${CIPD_VERSION}" + fi + CIPD_FILE="${DOWNLOADS_DIR}/${CIPD_NAME}-${ARCH}-${CIPD_VERSION}.zip" + CIPD_TMP="${DOWNLOADS_DIR}/tmp-${CIPD_NAME}-${ARCH}-${CIPD_VERSION}" + CIPD_DIR="${DOWNLOADS_DIR}/${CIPD_NAME}-${ARCH}-${CIPD_VERSION}" + if [ ! -f "${CIPD_FILE}" ]; then + mkdir -p "${DOWNLOADS_DIR}" + echo "Downloading ${CIPD_NAME} archive ${CIPD_URL} ..." + curl -L "${CIPD_URL}" -o "${CIPD_FILE}" -# + echo -e "Verifying ${CIPD_NAME} download ${CIPD_FILE} ...\c" + # CIPD will return a file containing "no such ref" if the URL is invalid, so need to verify the ZIP file + if ! unzip -qq -t "${CIPD_FILE}" &> /dev/null; then + rm -f "${CIPD_FILE}" + echo "Error: Downloaded archive from ${CIPD_URL} failed with invalid data" + exit 1 + fi + rm -rf "${CIPD_TMP}" "${CIPD_DIR}" + echo "complete." + fi + if [ ! -d "${CIPD_DIR}" ]; then + echo -e "Extracting ${CIPD_NAME} archive to ${CIPD_DIR} ...\c" + rm -rf "${CIPD_TMP}" + unzip -q "${CIPD_FILE}" -d "${CIPD_TMP}" + ln -sf "${CIPD_NAME}-${ARCH}-${CIPD_VERSION}" "${DOWNLOADS_DIR}/${CIPD_NAME}-${ARCH}" + mv "${CIPD_TMP}" "${CIPD_DIR}" + echo "complete." + fi +} + +# Download prebuilt binaries with specific versions known to work with the SDK. +# These values can be found in $FUCHSIA_ROOT/integration/prebuilts but should +# not need to be updated regularly since these tools do not change very often. +download_cipd "clang" "fuchsia/third_party/clang" "git_revision:b25fc4123c77097c05ea221e023fa5c6a16e0f41" "${ARCH}" +download_cipd "gn" "gn/gn" "git_revision:239533d2d91a04b3317ca9101cf7189f4e651e4d" "${ARCH}" +download_cipd "ninja" "infra/ninja" "version:1.9.0" "${ARCH}" +# Download python version of gsutil, not referenced by $FUCHSIA_ROOT/integration/prebuilts, with generic architecture +download_cipd "gsutil" "infra/gsutil" "version:4.46" "" + +# Always refresh the symlinks because this script may have been updated +echo -e "Rebuilding symlinks in ${DEPOT_TOOLS_DIR} ...\c" +ln -sf "../downloads/clang-${ARCH}" "${DEPOT_TOOLS_DIR}/clang-${ARCH}" +ln -sf "../downloads/clang-${ARCH}/bin/clang-format" "${DEPOT_TOOLS_DIR}/clang-format" +ln -sf "../downloads/gn-${ARCH}/gn" "${DEPOT_TOOLS_DIR}/gn" +ln -sf "../downloads/ninja-${ARCH}/ninja" "${DEPOT_TOOLS_DIR}/ninja" +ln -sf "../downloads/gsutil-${ARCH}/gsutil" "${DEPOT_TOOLS_DIR}/gsutil" +if [ ! -x "$(command -v gsutil)" ]; then + ln -sf "../../../buildtools/downloads/gsutil-${ARCH}/gsutil" "${REPO_ROOT}/third_party/fuchsia-sdk/bin/gsutil" +fi +echo "complete." + +echo "All build tools downloaded and extracted successfully to ${BUILD_TOOLS_DIR}"
diff --git a/scripts/update-fuchsia-sdk.sh b/scripts/update-fuchsia-sdk.sh new file mode 100755 index 0000000..d485e68 --- /dev/null +++ b/scripts/update-fuchsia-sdk.sh
@@ -0,0 +1,99 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Specify the version of the tools to download +if [[ "$1" == "" ]]; then + VER_FUCHSIA_SDK="latest" +else + VER_FUCHSIA_SDK="$1" +fi + +set -eu # Error checking +err_print() { + cleanup + echo "Error on line $1" +} +trap 'err_print $LINENO' ERR +DEBUG_LINE() { + "$@" +} + +SCRIPT_SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# Common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/common.sh" || exit $? +THIRD_PARTY_DIR="$(get_third_party_dir)" # finds path to //third_party +FUCHSIA_SDK_DIR="${THIRD_PARTY_DIR}/fuchsia-sdk" # finds path to //third_party/fuchsia-sdk +TMP_SDK_DOWNLOAD_DIR=$(mktemp -d) +DOWNLOADED_SDK_PATH="${TMP_SDK_DOWNLOAD_DIR}/gn-sdk.tar.gz" +TMP_SDK_DIR=$(mktemp -d) + +cleanup() { + # Remove the SDK downloads directory + if [ -f "${TMP_SDK_DOWNLOAD_DIR}" ]; then + rm -rf "${TMP_SDK_DOWNLOAD_DIR}" + fi + if [ -d "${TMP_SDK_DIR}" ]; then + rm -rf "${TMP_SDK_DIR}" + fi +} + +if is-mac; then + PLATFORM="mac" +else + PLATFORM="linux" +fi +ARCH="${PLATFORM}-amd64" + +# You can browse the GCS bucket from here to look for builds https://console.cloud.google.com/storage/browser/fuchsia/development +# You can get the instance ID with the following curl commands: +# Linux: `curl -sL "https://storage.googleapis.com/fuchsia/development/LATEST_LINUX` +# Mac: `curl -sL "https://storage.googleapis.com/fuchsia/development/LATEST_MAC` +# You can use the gsutil command-line tool to browse and search as well: +# Get the instance ID: +# Linux: `gsutil cat gs://fuchsia/development/LATEST_LINUX` +# Mac: `gsutil cat gs://fuchsia/development/LATEST_MAC` +# List the SDKs available for the instance ID +# `gsutil ls -r gs://fuchsia/development/$INSTANCE_ID/sdk` +# Download a SDK from GCS to your current directory: +# Linux: `gsutil cp gs://fuchsia/development/$INSTANCE_ID/sdk/linux-amd64/gn.tar.gz .` +# Mac: `gsutil cp gs://fuchsia/development/$INSTANCE_ID/sdk/mac-amd64/gn.tar.gz .` + +# If specified version is "latest" get the latest version number +if [ "${VER_FUCHSIA_SDK}" == "latest" ]; then + PLATFORM_UPPER="$(echo "${PLATFORM}" | tr '[:lower:]' '[:upper:]')" + VER_FUCHSIA_SDK="$(curl -sL "https://storage.googleapis.com/fuchsia/development/LATEST_${PLATFORM_UPPER}")" +fi + +echo "Downloading Fuchsia SDK ${VER_FUCHSIA_SDK} ..." +# Example URL: https://storage.googleapis.com/fuchsia/development/8888449404525421136/sdk/linux-amd64/gn.tar.gz +curl -sL "https://storage.googleapis.com/fuchsia/development/${VER_FUCHSIA_SDK}/sdk/${ARCH}/gn.tar.gz" -o "${DOWNLOADED_SDK_PATH}" +echo "complete." +echo + +echo "Extracting Fuchsia SDK..." +tar -xf "${DOWNLOADED_SDK_PATH}" -C "${TMP_SDK_DIR}" +echo "complete." +echo + + +# Delete existing SDK +if [ -d "${FUCHSIA_SDK_DIR}" ]; then + echo "Removing existing SDK..." + # Remove entire folder and remake folder of the same name to remove hidden files + # e.g. third_party/fuchsia-sdk/.build-id/ + rm -rf "${FUCHSIA_SDK_DIR}" + mkdir "${FUCHSIA_SDK_DIR}" + echo "complete." + echo +fi + +# Copy new SDK to SDK dir +cp -r "${TMP_SDK_DIR}/." "${FUCHSIA_SDK_DIR}" + +cleanup + +echo "New SDK downloaded and extracted successfully to ${FUCHSIA_SDK_DIR}."
diff --git a/third_party/dhrystone/BUILD.gn b/third_party/dhrystone/BUILD.gn new file mode 100644 index 0000000..e228911 --- /dev/null +++ b/third_party/dhrystone/BUILD.gn
@@ -0,0 +1,45 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# default group +group("dhrystone") { + deps = [ + ":dhrystone_bin", + ] + if (is_fuchsia) { + deps += [ ":dhrystone_package" ] + } +} + +executable("dhrystone_bin") { + sources = [ + "dhry_1.cc", + "dhry_2.cc" + ] + + deps = [ + "//third_party/fuchsia-sdk/pkg/zx" + ] + + cflags = ["-Wall", "-pedantic", "-O3", "-ffast-math", "-I", "src", "-DTIME"] +} + +if (is_fuchsia) { + import("//third_party/fuchsia-sdk/build/component.gni") + import("//third_party/fuchsia-sdk/build/package.gni") + + fuchsia_component("dhrystone_cmx") { + manifest = "dhrystone.cmx" + data_deps = [ + ":dhrystone_bin", + ] + } + + fuchsia_package("dhrystone_package") { + package_name = "dhrystone" + deps = [ + ":dhrystone_cmx", + ] + } +}
diff --git a/third_party/dhrystone/LICENSE.txt b/third_party/dhrystone/LICENSE.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/third_party/dhrystone/LICENSE.txt
@@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License.
diff --git a/third_party/dhrystone/dhry.h b/third_party/dhrystone/dhry.h new file mode 100644 index 0000000..34a4ada --- /dev/null +++ b/third_party/dhrystone/dhry.h
@@ -0,0 +1,435 @@ +/***************************************************************************** + * The BYTE UNIX Benchmarks - Release 3 + * Module: dhry.h SID: 3.4 5/15/91 19:30:21 + * + ***************************************************************************** + * Bug reports, patches, comments, suggestions should be sent to: + * + * Ben Smith, Rick Grehan or Tom Yager + * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com + * + ***************************************************************************** + * Modification Log: + * addapted from: + * + * + * "DHRYSTONE" Benchmark Program + * ----------------------------- + * + * Version: C, Version 2.1 + * + * File: dhry.h (part 1 of 3) + * + * Date: May 25, 1988 + * + * Author: Reinhold P. Weicker + * Siemens AG, AUT E 51 + * Postfach 3220 + * 8520 Erlangen + * Germany (West) + * Phone: [+49]-9131-7-20330 + * (8-17 Central European Time) + * Usenet: ..!mcvax!unido!estevax!weicker + * + * Original Version (in Ada) published in + * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984), + * pp. 1013 - 1030, together with the statistics + * on which the distribution of statements etc. is based. + * + * In this C version, the following C library functions are used: + * - strcpy, strcmp (inside the measurement loop) + * - printf, scanf (outside the measurement loop) + * In addition, Berkeley UNIX system calls "times ()" or "time ()" + * are used for execution time measurement. For measurements + * on other systems, these calls have to be changed. + * + * Collection of Results: + * Reinhold Weicker (address see above) and + * + * Rick Richardson + * PC Research. Inc. + * 94 Apple Orchard Drive + * Tinton Falls, NJ 07724 + * Phone: (201) 834-1378 (9-17 EST) + * Usenet: ...!seismo!uunet!pcrat!rick + * + * Please send results to Rick Richardson and/or Reinhold Weicker. + * Complete information should be given on hardware and software used. + * Hardware information includes: Machine type, CPU, type and size + * of caches; for microprocessors: clock frequency, memory speed + * (number of wait states). + * Software information includes: Compiler (and runtime library) + * manufacturer and version, compilation switches, OS version. + * The Operating System version may give an indication about the + * compiler; Dhrystone itself performs no OS calls in the measurement loop. + * + * The complete output generated by the program should be mailed + * such that at least some checks for correctness can be made. + * + *************************************************************************** + * + * History: This version C/2.1 has been made for two reasons: + * + * 1) There is an obvious need for a common C version of + * Dhrystone, since C is at present the most popular system + * programming language for the class of processors + * (microcomputers, minicomputers) where Dhrystone is used most. + * There should be, as far as possible, only one C version of + * Dhrystone such that results can be compared without + * restrictions. In the past, the C versions distributed + * by Rick Richardson (Version 1.1) and by Reinhold Weicker + * had small (though not significant) differences. + * + * 2) As far as it is possible without changes to the Dhrystone + * statistics, optimizing compilers should be prevented from + * removing significant statements. + * + * This C version has been developed in cooperation with + * Rick Richardson (Tinton Falls, NJ), it incorporates many + * ideas from the "Version 1.1" distributed previously by + * him over the UNIX network Usenet. + * I also thank Chaim Benedelac (National Semiconductor), + * David Ditzel (SUN), Earl Killian and John Mashey (MIPS), + * Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley) + * for their help with comments on earlier versions of the + * benchmark. + * + * Changes: In the initialization part, this version follows mostly + * Rick Richardson's version distributed via Usenet, not the + * version distributed earlier via floppy disk by Reinhold Weicker. + * As a concession to older compilers, names have been made + * unique within the first 8 characters. + * Inside the measurement loop, this version follows the + * version previously distributed by Reinhold Weicker. + * + * At several places in the benchmark, code has been added, + * but within the measurement loop only in branches that + * are not executed. The intention is that optimizing compilers + * should be prevented from moving code out of the measurement + * loop, or from removing code altogether. Since the statements + * that are executed within the measurement loop have NOT been + * changed, the numbers defining the "Dhrystone distribution" + * (distribution of statements, operand types and locality) + * still hold. Except for sophisticated optimizing compilers, + * execution times for this version should be the same as + * for previous versions. + * + * Since it has proven difficult to subtract the time for the + * measurement loop overhead in a correct way, the loop check + * has been made a part of the benchmark. This does have + * an impact - though a very minor one - on the distribution + * statistics which have been updated for this version. + * + * All changes within the measurement loop are described + * and discussed in the companion paper "Rationale for + * Dhrystone version 2". + * + * Because of the self-imposed limitation that the order and + * distribution of the executed statements should not be + * changed, there are still cases where optimizing compilers + * may not generate code for some statements. To a certain + * degree, this is unavoidable for small synthetic benchmarks. + * Users of the benchmark are advised to check code listings + * whether code is generated for all statements of Dhrystone. + * + * Version 2.1 is identical to version 2.0 distributed via + * the UNIX network Usenet in March 1988 except that it corrects + * some minor deficiencies that were found by users of version 2.0. + * The only change within the measurement loop is that a + * non-executed "else" part was added to the "if" statement in + * Func_3, and a non-executed "else" part removed from Proc_3. + * + *************************************************************************** + * + * Defines: The following "Defines" are possible: + * -DREG=register (default: Not defined) + * As an approximation to what an average C programmer + * might do, the "register" storage class is applied + * (if enabled by -DREG=register) + * - for local variables, if they are used (dynamically) + * five or more times + * - for parameters if they are used (dynamically) + * six or more times + * Note that an optimal "register" strategy is + * compiler-dependent, and that "register" declarations + * do not necessarily lead to faster execution. + * -DNOSTRUCTASSIGN (default: Not defined) + * Define if the C compiler does not support + * assignment of structures. + * -DNOENUMS (default: Not defined) + * Define if the C compiler does not support + * enumeration types. + * -DTIMES (default) + * -DTIME + * The "times" function of UNIX (returning process times) + * or the "time" function (returning wallclock time) + * is used for measurement. + * For single user machines, "time ()" is adequate. For + * multi-user machines where you cannot get single-user + * access, use the "times ()" function. If you have + * neither, use a stopwatch in the dead of night. + * "printf"s are provided marking the points "Start Timer" + * and "Stop Timer". DO NOT use the UNIX "time(1)" + * command, as this will measure the total time to + * run this program, which will (erroneously) include + * the time to allocate storage (malloc) and to perform + * the initialization. + * -DHZ=nnn + * In Berkeley UNIX, the function "times" returns process + * time in 1/HZ seconds, with HZ = 60 for most systems. + * CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY + * A VALUE. + * + *************************************************************************** + * + * Compilation model and measurement (IMPORTANT): + * + * This C version of Dhrystone consists of three files: + * - dhry.h (this file, containing global definitions and comments) + * - dhry_1.c (containing the code corresponding to Ada package Pack_1) + * - dhry_2.c (containing the code corresponding to Ada package Pack_2) + * + * The following "ground rules" apply for measurements: + * - Separate compilation + * - No procedure merging + * - Otherwise, compiler optimizations are allowed but should be indicated + * - Default results are those without register declarations + * See the companion paper "Rationale for Dhrystone Version 2" for a more + * detailed discussion of these ground rules. + * + * For 16-Bit processors (e.g. 80186, 80286), times for all compilation + * models ("small", "medium", "large" etc.) should be given if possible, + * together with a definition of these models for the compiler system used. + * + ************************************************************************** + * + * Dhrystone (C version) statistics: + * + * [Comment from the first distribution, updated for version 2. + * Note that because of language differences, the numbers are slightly + * different from the Ada version.] + * + * The following program contains statements of a high level programming + * language (here: C) in a distribution considered representative: + * + * assignments 52 (51.0 %) + * control statements 33 (32.4 %) + * procedure, function calls 17 (16.7 %) + * + * 103 statements are dynamically executed. The program is balanced with + * respect to the three aspects: + * + * - statement type + * - operand type + * - operand locality + * operand global, local, parameter, or constant. + * + * The combination of these three aspects is balanced only approximately. + * + * 1. Statement Type: + * ----------------- number + * + * V1 = V2 9 + * (incl. V1 = F(..) + * V = Constant 12 + * Assignment, 7 + * with array element + * Assignment, 6 + * with record component + * -- + * 34 34 + * + * X = Y +|-|"&&"|"|" Z 5 + * X = Y +|-|"==" Constant 6 + * X = X +|- 1 3 + * X = Y *|/ Z 2 + * X = Expression, 1 + * two operators + * X = Expression, 1 + * three operators + * -- + * 18 18 + * + * if .... 14 + * with "else" 7 + * without "else" 7 + * executed 3 + * not executed 4 + * for ... 7 | counted every time + * while ... 4 | the loop condition + * do ... while 1 | is evaluated + * switch ... 1 + * break 1 + * declaration with 1 + * initialization + * -- + * 34 34 + * + * P (...) procedure call 11 + * user procedure 10 + * library procedure 1 + * X = F (...) + * function call 6 + * user function 5 + * library function 1 + * -- + * 17 17 + * --- + * 103 + * + * The average number of parameters in procedure or function calls + * is 1.82 (not counting the function values as implicit parameters). + * + * + * 2. Operators + * ------------ + * number approximate + * percentage + * + * Arithmetic 32 50.8 + * + * + 21 33.3 + * - 7 11.1 + * * 3 4.8 + * / (int div) 1 1.6 + * + * Comparison 27 42.8 + * + * == 9 14.3 + * /= 4 6.3 + * > 1 1.6 + * < 3 4.8 + * >= 1 1.6 + * <= 9 14.3 + * + * Logic 4 6.3 + * + * && (AND-THEN) 1 1.6 + * | (OR) 1 1.6 + * ! (NOT) 2 3.2 + * + * -- ----- + * 63 100.1 + * + * + * 3. Operand Type (counted once per operand reference): + * --------------- + * number approximate + * percentage + * + * Integer 175 72.3 % + * Character 45 18.6 % + * Pointer 12 5.0 % + * String30 6 2.5 % + * Array 2 0.8 % + * Record 2 0.8 % + * --- ------- + * 242 100.0 % + * + * When there is an access path leading to the final operand (e.g. a record + * component), only the final data type on the access path is counted. + * + * + * 4. Operand Locality: + * ------------------- + * number approximate + * percentage + * + * local variable 114 47.1 % + * global variable 22 9.1 % + * parameter 45 18.6 % + * value 23 9.5 % + * reference 22 9.1 % + * function result 6 2.5 % + * constant 55 22.7 % + * --- ------- + * 242 100.0 % + * + * + * The program does not compute anything meaningful, but it is syntactically + * and semantically correct. All variables have a value assigned to them + * before they are used as a source operand. + * + * There has been no explicit effort to account for the effects of a + * cache, or to balance the use of long or short displacements for code or + * data. + * + *************************************************************************** + */ + + +/* Compiler and system dependent definitions: */ + +#ifndef TIME +#define TIMES +#endif + /* Use times(2) time function unless */ + /* explicitly defined otherwise */ + +#ifdef TIMES +#include <sys/types.h> +#include <sys/times.h> + /* for "times" */ +#endif + +#define Mic_secs_Per_Second 1000000.0 + /* Berkeley UNIX C returns process times in seconds/HZ */ + +#ifdef NOSTRUCTASSIGN +#define structassign(d, s) memcpy(&(d), &(s), sizeof(d)) +#else +#define structassign(d, s) d = s +#endif + +#ifdef NOENUM +#define Ident_1 0 +#define Ident_2 1 +#define Ident_3 2 +#define Ident_4 3 +#define Ident_5 4 + typedef int Enumeration; +#else + typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} + Enumeration; +#endif + /* for boolean and enumeration types in Ada, Pascal */ + +/* General definitions: */ + +#include <stdio.h> + /* for strcpy, strcmp */ + +#define Null 0 + /* Value of a Null pointer */ +#define true 1 +#define false 0 + +typedef int One_Thirty; +typedef int One_Fifty; +typedef char Capital_Letter; +typedef int Boolean; +typedef char Str_30 [31]; +typedef int Arr_1_Dim [50]; +typedef int Arr_2_Dim [50] [50]; + +typedef struct record + { + struct record *Ptr_Comp; + Enumeration Discr; + union { + struct { + Enumeration Enum_Comp; + int Int_Comp; + char Str_Comp [31]; + } var_1; + struct { + Enumeration E_Comp_2; + char Str_2_Comp [31]; + } var_2; + struct { + char Ch_1_Comp; + char Ch_2_Comp; + } var_3; + } variant; + } Rec_Type, *Rec_Pointer; +
diff --git a/third_party/dhrystone/dhry_1.cc b/third_party/dhrystone/dhry_1.cc new file mode 100644 index 0000000..cbfc476 --- /dev/null +++ b/third_party/dhrystone/dhry_1.cc
@@ -0,0 +1,430 @@ +/***************************************************************************** + * The BYTE UNIX Benchmarks - Release 3 + * Module: dhry_1.c SID: 3.4 5/15/91 19:30:21 + * + ***************************************************************************** + * Bug reports, patches, comments, suggestions should be sent to: + * + * Ben Smith, Rick Grehan or Tom Yager + * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com + * + ***************************************************************************** + * + * *** WARNING **** With BYTE's modifications applied, results obtained with + * ******* this version of the Dhrystone program may not be applicable + * to other versions. + * + * Modification Log: + * 10/22/97 - code cleanup to remove ANSI C compiler warnings + * Andy Kahn <kahn@zk3.dec.com> + * + * Adapted from: + * + * "DHRYSTONE" Benchmark Program + * ----------------------------- + * + * Version: C, Version 2.1 + * + * File: dhry_1.c (part 2 of 3) + * + * Date: May 25, 1988 + * + * Author: Reinhold P. Weicker + * + ***************************************************************************/ +char SCCSid[] = "@(#) @(#)dhry_1.c:3.4 -- 5/15/91 19:30:21"; + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "dhry.h" +#include "timeit.c" +#include <atomic> + +// unsigned long Run_Index; +std::atomic<unsigned long> Run_Index; + +void report() +{ + fprintf(stderr,"COUNT|%ld|1|lps\n", Run_Index.load()); + exit(0); +} + +/* Global Variables: */ + +Rec_Pointer Ptr_Glob, + Next_Ptr_Glob; +int Int_Glob; +Boolean Bool_Glob; +char Ch_1_Glob, + Ch_2_Glob; +int Arr_1_Glob [50]; +int Arr_2_Glob [50] [50]; + +// Enumeration Func_1 (); +Enumeration Func_1 (Capital_Letter, Capital_Letter); + /* forward declaration necessary since Enumeration may not simply be int */ + +#ifndef REG + Boolean Reg = false; +#define REG + /* REG becomes defined as empty */ + /* i.e. no register variables */ +#else + Boolean Reg = true; +#endif + +/* variables for time measurement: */ + +#ifdef TIMES +#include <time.h> +#include <sys/times.h> +#define Too_Small_Time 120 + /* Measurements should last at least about 2 seconds */ +#endif +#ifdef TIME +#include <time.h> +#define Too_Small_Time 2 + /* Measurements should last at least 2 seconds */ +#endif + +long Begin_Time, + End_Time, + User_Time; +float Microseconds, + Dhrystones_Per_Second; + +/* end of variables for time measurement */ + +void Proc_1 (REG Rec_Pointer Ptr_Val_Par); +void Proc_2 (One_Fifty *Int_Par_Ref); +void Proc_3 (Rec_Pointer *Ptr_Ref_Par); +void Proc_4 (void); +void Proc_5 (void); + + +extern Boolean Func_2(Str_30, Str_30); +extern void Proc_6(Enumeration, Enumeration *); +extern void Proc_7(One_Fifty, One_Fifty, One_Fifty *); +extern void Proc_8(Arr_1_Dim, Arr_2_Dim, int, int); + +int main (int argc, char *argv[]) + /* main program, corresponds to procedures */ + /* Main and Proc_0 in the Ada version */ +{ + int duration; + One_Fifty Int_1_Loc; + REG One_Fifty Int_2_Loc; + One_Fifty Int_3_Loc; + REG char Ch_Index; + Enumeration Enum_Loc; + Str_30 Str_1_Loc; + Str_30 Str_2_Loc; + + /* Initializations */ + + Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); + Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); + + Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; + Ptr_Glob->Discr = Ident_1; + Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; + Ptr_Glob->variant.var_1.Int_Comp = 40; + strcpy (Ptr_Glob->variant.var_1.Str_Comp, + "DHRYSTONE PROGRAM, SOME STRING"); + strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); + + Arr_2_Glob [8][7] = 10; + /* Was missing in published program. Without this statement, */ + /* Arr_2_Glob [8][7] would have an undefined value. */ + /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */ + /* overflow may occur for this array element. */ + +#ifdef PRATTLE + printf ("\n"); + printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n"); + printf ("\n"); + if (Reg) + { + printf ("Program compiled with 'register' attribute\n"); + printf ("\n"); + } + else + { + printf ("Program compiled without 'register' attribute\n"); + printf ("\n"); + } + printf ("Please give the number of runs through the benchmark: "); + { + int n; + scanf ("%d", &n); + Number_Of_Runs = n; + } + printf ("\n"); + + printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs); +#endif /* PRATTLE */ + + if (argc != 2) { + fprintf(stderr, "Usage: %s duration\n", argv[0]); + exit(1); + } + + duration = atoi(argv[1]); + Run_Index = 0; + wake_me(duration, report); + + /***************/ + /* Start timer */ + /***************/ + +#ifdef SELF_TIMED +#ifdef TIMES + times (&time_info); + Begin_Time = (long) time_info.tms_utime; +#endif +#ifdef TIME + Begin_Time = time ( (long *) 0); +#endif +#endif /* SELF_TIMED */ + + for (Run_Index = 1; ; Run_Index.fetch_add(1, std::memory_order_relaxed)) + { + + Proc_5(); + Proc_4(); + /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */ + Int_1_Loc = 2; + Int_2_Loc = 3; + strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING"); + Enum_Loc = Ident_2; + Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc); + /* Bool_Glob == 1 */ + while (Int_1_Loc < Int_2_Loc) /* loop body executed once */ + { + Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc; + /* Int_3_Loc == 7 */ + Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc); + /* Int_3_Loc == 7 */ + Int_1_Loc += 1; + } /* while */ + /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ + Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc); + /* Int_Glob == 5 */ + Proc_1 (Ptr_Glob); + for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index) + /* loop body executed twice */ + { + if (Enum_Loc == Func_1 (Ch_Index, 'C')) + /* then, not executed */ + { + Proc_6 (Ident_1, &Enum_Loc); + strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING"); + Int_2_Loc = Run_Index; + Int_Glob = Run_Index; + } + } + /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ + Int_2_Loc = Int_2_Loc * Int_1_Loc; + Int_1_Loc = Int_2_Loc / Int_3_Loc; + Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; + /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */ + Proc_2 (&Int_1_Loc); + /* Int_1_Loc == 5 */ + + } /* loop "for Run_Index" */ + + /**************/ + /* Stop timer */ + /**************/ +#ifdef SELF_TIMED +#ifdef TIMES + times (&time_info); + End_Time = (long) time_info.tms_utime; +#endif +#ifdef TIME + End_Time = time ( (long *) 0); +#endif +#endif /* SELF_TIMED */ + + /* BYTE version never executes this stuff */ +#ifdef SELF_TIMED + printf ("Execution ends\n"); + printf ("\n"); + printf ("Final values of the variables used in the benchmark:\n"); + printf ("\n"); + printf ("Int_Glob: %d\n", Int_Glob); + printf (" should be: %d\n", 5); + printf ("Bool_Glob: %d\n", Bool_Glob); + printf (" should be: %d\n", 1); + printf ("Ch_1_Glob: %c\n", Ch_1_Glob); + printf (" should be: %c\n", 'A'); + printf ("Ch_2_Glob: %c\n", Ch_2_Glob); + printf (" should be: %c\n", 'B'); + printf ("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]); + printf (" should be: %d\n", 7); + printf ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]); + printf (" should be: Number_Of_Runs + 10\n"); + printf ("Ptr_Glob->\n"); + printf (" Ptr_Comp: %d\n", (int) Ptr_Glob->Ptr_Comp); + printf (" should be: (implementation-dependent)\n"); + printf (" Discr: %d\n", Ptr_Glob->Discr); + printf (" should be: %d\n", 0); + printf (" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp); + printf (" should be: %d\n", 2); + printf (" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp); + printf (" should be: %d\n", 17); + printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp); + printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); + printf ("Next_Ptr_Glob->\n"); + printf (" Ptr_Comp: %d\n", (int) Next_Ptr_Glob->Ptr_Comp); + printf (" should be: (implementation-dependent), same as above\n"); + printf (" Discr: %d\n", Next_Ptr_Glob->Discr); + printf (" should be: %d\n", 0); + printf (" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp); + printf (" should be: %d\n", 1); + printf (" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp); + printf (" should be: %d\n", 18); + printf (" Str_Comp: %s\n", + Next_Ptr_Glob->variant.var_1.Str_Comp); + printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); + printf ("Int_1_Loc: %d\n", Int_1_Loc); + printf (" should be: %d\n", 5); + printf ("Int_2_Loc: %d\n", Int_2_Loc); + printf (" should be: %d\n", 13); + printf ("Int_3_Loc: %d\n", Int_3_Loc); + printf (" should be: %d\n", 7); + printf ("Enum_Loc: %d\n", Enum_Loc); + printf (" should be: %d\n", 1); + printf ("Str_1_Loc: %s\n", Str_1_Loc); + printf (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n"); + printf ("Str_2_Loc: %s\n", Str_2_Loc); + printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n"); + printf ("\n"); + + User_Time = End_Time - Begin_Time; + + if (User_Time < Too_Small_Time) + { + printf ("Measured time too small to obtain meaningful results\n"); + printf ("Please increase number of runs\n"); + printf ("\n"); + } + else + { +#ifdef TIME + Microseconds = (float) User_Time * Mic_secs_Per_Second + / (float) Number_Of_Runs; + Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time; +#else + Microseconds = (float) User_Time * Mic_secs_Per_Second + / ((float) HZ * ((float) Number_Of_Runs)); + Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs) + / (float) User_Time; +#endif + printf ("Microseconds for one run through Dhrystone: "); + printf ("%6.1f \n", Microseconds); + printf ("Dhrystones per Second: "); + printf ("%6.1f \n", Dhrystones_Per_Second); + printf ("\n"); + } +#endif /* SELF_TIMED */ +} + + +void Proc_1 (REG Rec_Pointer Ptr_Val_Par) + /* executed once */ +{ + REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; + /* == Ptr_Glob_Next */ + /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ + /* corresponds to "rename" in Ada, "with" in Pascal */ + + structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); + Ptr_Val_Par->variant.var_1.Int_Comp = 5; + Next_Record->variant.var_1.Int_Comp + = Ptr_Val_Par->variant.var_1.Int_Comp; + Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; + Proc_3 (&Next_Record->Ptr_Comp); + /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp + == Ptr_Glob->Ptr_Comp */ + if (Next_Record->Discr == Ident_1) + /* then, executed */ + { + Next_Record->variant.var_1.Int_Comp = 6; + Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, + &Next_Record->variant.var_1.Enum_Comp); + Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; + Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, + &Next_Record->variant.var_1.Int_Comp); + } + else /* not executed */ + structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); +} /* Proc_1 */ + + +void Proc_2 (One_Fifty *Int_Par_Ref) + /* executed once */ + /* *Int_Par_Ref == 1, becomes 4 */ +{ + One_Fifty Int_Loc; + Enumeration Enum_Loc; + + Enum_Loc = Ident_1; + + Int_Loc = *Int_Par_Ref + 10; + do /* executed once */ + if (Ch_1_Glob == 'A') + /* then, executed */ + { + Int_Loc -= 1; + *Int_Par_Ref = Int_Loc - Int_Glob; + Enum_Loc = Ident_1; + } /* if */ + while (Enum_Loc != Ident_1); /* true */ +} /* Proc_2 */ + + +void Proc_3 (Rec_Pointer *Ptr_Ref_Par) + /* executed once */ + /* Ptr_Ref_Par becomes Ptr_Glob */ +{ + if (Ptr_Glob != Null) + /* then, executed */ + *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp; + Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp); +} /* Proc_3 */ + + +void Proc_4 (void) /* without parameters */ + /* executed once */ +{ + Boolean Bool_Loc; + + Bool_Loc = Ch_1_Glob == 'A'; + Bool_Glob = Bool_Loc | Bool_Glob; + Ch_2_Glob = 'B'; +} /* Proc_4 */ + +void Proc_5 (void) /* without parameters */ +/*******/ + /* executed once */ +{ + Ch_1_Glob = 'A'; + Bool_Glob = false; +} /* Proc_5 */ + + + /* Procedure for the assignment of structures, */ + /* if the C compiler doesn't support this feature */ +#ifdef NOSTRUCTASSIGN +memcpy (d, s, l) +register char *d; +register char *s; +register int l; +{ + while (l--) *d++ = *s++; +} +#endif + +
diff --git a/third_party/dhrystone/dhry_2.cc b/third_party/dhrystone/dhry_2.cc new file mode 100644 index 0000000..daac987 --- /dev/null +++ b/third_party/dhrystone/dhry_2.cc
@@ -0,0 +1,198 @@ +/***************************************************************************** + * The BYTE UNIX Benchmarks - Release 3 + * Module: dhry_2.c SID: 3.4 5/15/91 19:30:22 + * + ***************************************************************************** + * Bug reports, patches, comments, suggestions should be sent to: + * + * Ben Smith, Rick Grehan or Tom Yager + * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com + * + ***************************************************************************** + * Modification Log: + * 10/22/97 - code cleanup to remove ANSI C compiler warnings + * Andy Kahn <kahn@zk3.dec.com> + * + * Adapted from: + * + * "DHRYSTONE" Benchmark Program + * ----------------------------- + * + * **** WARNING **** See warning in n.dhry_1.c + * + * Version: C, Version 2.1 + * + * File: dhry_2.c (part 3 of 3) + * + * Date: May 25, 1988 + * + * Author: Reinhold P. Weicker + * + ****************************************************************************/ +/* SCCSid is defined in dhry_1.c */ + +#include <string.h> +#include "dhry.h" + +#ifndef REG +#define REG + /* REG becomes defined as empty */ + /* i.e. no register variables */ +#endif + +extern int Int_Glob; +extern char Ch_1_Glob; + +void Proc_6(Enumeration, Enumeration *); +void Proc_7(One_Fifty, One_Fifty, One_Fifty *); +void Proc_8(Arr_1_Dim, Arr_2_Dim, int, int); +Enumeration Func_1(Capital_Letter, Capital_Letter); +Boolean Func_2(Str_30, Str_30); +Boolean Func_3(Enumeration); + +void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par) + /* executed once */ + /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */ +{ + *Enum_Ref_Par = Enum_Val_Par; + if (! Func_3 (Enum_Val_Par)) + /* then, not executed */ + *Enum_Ref_Par = Ident_4; + switch (Enum_Val_Par) + { + case Ident_1: + *Enum_Ref_Par = Ident_1; + break; + case Ident_2: + if (Int_Glob > 100) + /* then */ + *Enum_Ref_Par = Ident_1; + else *Enum_Ref_Par = Ident_4; + break; + case Ident_3: /* executed */ + *Enum_Ref_Par = Ident_2; + break; + case Ident_4: break; + case Ident_5: + *Enum_Ref_Par = Ident_3; + break; + } /* switch */ +} /* Proc_6 */ + +void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref) +/**********************************************/ + /* executed three times */ + /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */ + /* Int_Par_Ref becomes 7 */ + /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */ + /* Int_Par_Ref becomes 17 */ + /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */ + /* Int_Par_Ref becomes 18 */ +{ + One_Fifty Int_Loc; + + Int_Loc = Int_1_Par_Val + 2; + *Int_Par_Ref = Int_2_Par_Val + Int_Loc; +} /* Proc_7 */ + + +void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val) +/*********************************************************************/ + /* executed once */ + /* Int_Par_Val_1 == 3 */ + /* Int_Par_Val_2 == 7 */ +{ + REG One_Fifty Int_Index; + REG One_Fifty Int_Loc; + + Int_Loc = Int_1_Par_Val + 5; + Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val; + Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc]; + Arr_1_Par_Ref [Int_Loc+30] = Int_Loc; + for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index) + Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc; + Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1; + Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc]; + Int_Glob = 5; +} /* Proc_8 */ + + +Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val) +/*************************************************/ + /* executed three times */ + /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */ + /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */ + /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */ +{ + Capital_Letter Ch_1_Loc; + Capital_Letter Ch_2_Loc; + + Ch_1_Loc = Ch_1_Par_Val; + Ch_2_Loc = Ch_1_Loc; + if (Ch_2_Loc != Ch_2_Par_Val) + /* then, executed */ + return (Ident_1); + else /* not executed */ + { + Ch_1_Glob = Ch_1_Loc; + return (Ident_2); + } +} /* Func_1 */ + + + +Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref) +/*************************************************/ + /* executed once */ + /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */ + /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */ +{ + REG One_Thirty Int_Loc; + Capital_Letter Ch_Loc; + + Ch_Loc = 'A'; + Int_Loc = 2; + while (Int_Loc <= 2) /* loop body executed once */ + if (Func_1 (Str_1_Par_Ref[Int_Loc], + Str_2_Par_Ref[Int_Loc+1]) == Ident_1) + /* then, executed */ + { + Ch_Loc = 'A'; + Int_Loc += 1; + } /* if, while */ + if (Ch_Loc >= 'W' && Ch_Loc < 'Z') + /* then, not executed */ + Int_Loc = 7; + if (Ch_Loc == 'R') + /* then, not executed */ + return (true); + else /* executed */ + { + if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0) + /* then, not executed */ + { + Int_Loc += 7; + Int_Glob = Int_Loc; + return (true); + } + else /* executed */ + return (false); + } /* if Ch_Loc */ +} /* Func_2 */ + + +Boolean Func_3 (Enumeration Enum_Par_Val) +/***************************/ + /* executed once */ + /* Enum_Par_Val == Ident_3 */ +{ + Enumeration Enum_Loc; + + Enum_Loc = Enum_Par_Val; + if (Enum_Loc == Ident_3) + /* then, executed */ + return (true); + else /* not executed */ + return (false); +} /* Func_3 */ +
diff --git a/third_party/dhrystone/dhrystone.cmx b/third_party/dhrystone/dhrystone.cmx new file mode 100644 index 0000000..151ce0c --- /dev/null +++ b/third_party/dhrystone/dhrystone.cmx
@@ -0,0 +1,6 @@ +{ + "program": { + "binary" : "dhrystone_bin" + } + +} \ No newline at end of file
diff --git a/third_party/dhrystone/timeit.c b/third_party/dhrystone/timeit.c new file mode 100644 index 0000000..9d7dd7a --- /dev/null +++ b/third_party/dhrystone/timeit.c
@@ -0,0 +1,56 @@ +/******************************************************************************* + * + * The BYTE UNIX Benchmarks - Release 3 + * Module: timeit.c SID: 3.3 5/15/91 19:30:21 + ******************************************************************************* + * Bug reports, patches, comments, suggestions should be sent to: + * + * Ben Smith, Rick Grehan or Tom Yager + * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com + * + ******************************************************************************* + * Modification Log: + * May 12, 1989 - modified empty loops to avoid nullifying by optimizing + * compilers + * August 28, 1990 - changed timing relationship--now returns total number + * of iterations (ty) + * October 22, 1997 - code cleanup to remove ANSI C compiler warnings + * Andy Kahn <kahn@zk3.dec.com> + * + ******************************************************************************/ + +/* this module is #included in other modules--no separate SCCS ID */ + +/* + * Timing routine + * + */ + +#include <signal.h> +#include <unistd.h> + +#include <pthread.h> +#include <lib/zx/time.h> + +struct TimerArgs { + int seconds; + void (*func)(); +}; + +pthread_t gTimerThread; +TimerArgs gTimerArgs; + +void * timerFunc(void *arg) { + zx::nanosleep(zx::deadline_after(zx::sec(gTimerArgs.seconds))); + gTimerArgs.func(); + return NULL; +} + +void wake_me(int seconds, void (*func)()) +{ + gTimerArgs.seconds = seconds; + gTimerArgs.func = func; + + pthread_create(&gTimerThread, NULL, &timerFunc, NULL); +} +
diff --git a/third_party/fuchsia-sdk/.build-id/07/b0d3ac8f42e1e7.debug b/third_party/fuchsia-sdk/.build-id/07/b0d3ac8f42e1e7.debug new file mode 100755 index 0000000..8695283 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/07/b0d3ac8f42e1e7.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/0e/754a242d3990b5.debug b/third_party/fuchsia-sdk/.build-id/0e/754a242d3990b5.debug new file mode 100755 index 0000000..ccb6eeb --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/0e/754a242d3990b5.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/19/dfb7dfc513c781.debug b/third_party/fuchsia-sdk/.build-id/19/dfb7dfc513c781.debug new file mode 100755 index 0000000..43f3215 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/19/dfb7dfc513c781.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/2f/61d6b2df790300.debug b/third_party/fuchsia-sdk/.build-id/2f/61d6b2df790300.debug new file mode 100755 index 0000000..fc8f68a --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/2f/61d6b2df790300.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/47/c225b4c387e374.debug b/third_party/fuchsia-sdk/.build-id/47/c225b4c387e374.debug new file mode 100755 index 0000000..ffadfd1 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/47/c225b4c387e374.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/4c/570772eef1424d.debug b/third_party/fuchsia-sdk/.build-id/4c/570772eef1424d.debug new file mode 100755 index 0000000..30ef708 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/4c/570772eef1424d.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/55/2eec3497a99775.debug b/third_party/fuchsia-sdk/.build-id/55/2eec3497a99775.debug new file mode 100755 index 0000000..f82f809 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/55/2eec3497a99775.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/7b/adfd381297bf6f.debug b/third_party/fuchsia-sdk/.build-id/7b/adfd381297bf6f.debug new file mode 100755 index 0000000..e0fab91 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/7b/adfd381297bf6f.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/85/7fd35c7c483025.debug b/third_party/fuchsia-sdk/.build-id/85/7fd35c7c483025.debug new file mode 100755 index 0000000..0a5d20f --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/85/7fd35c7c483025.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/88/90c23f2347327f.debug b/third_party/fuchsia-sdk/.build-id/88/90c23f2347327f.debug new file mode 100755 index 0000000..4892d09 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/88/90c23f2347327f.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/91/d1859cac2f8ed7.debug b/third_party/fuchsia-sdk/.build-id/91/d1859cac2f8ed7.debug new file mode 100755 index 0000000..06422b1 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/91/d1859cac2f8ed7.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/94/49060f220c6b71.debug b/third_party/fuchsia-sdk/.build-id/94/49060f220c6b71.debug new file mode 100755 index 0000000..59c2ff6 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/94/49060f220c6b71.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/99/7608d3dc8531e7.debug b/third_party/fuchsia-sdk/.build-id/99/7608d3dc8531e7.debug new file mode 100755 index 0000000..19cfb6b --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/99/7608d3dc8531e7.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/ab/9f1945a249d81a.debug b/third_party/fuchsia-sdk/.build-id/ab/9f1945a249d81a.debug new file mode 100755 index 0000000..a40723d --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/ab/9f1945a249d81a.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/b9/5927328f66db02.debug b/third_party/fuchsia-sdk/.build-id/b9/5927328f66db02.debug new file mode 100755 index 0000000..394ba86 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/b9/5927328f66db02.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/e5/b5b39218398272.debug b/third_party/fuchsia-sdk/.build-id/e5/b5b39218398272.debug new file mode 100755 index 0000000..614a041 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/e5/b5b39218398272.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/ea/46fea0942ef671.debug b/third_party/fuchsia-sdk/.build-id/ea/46fea0942ef671.debug new file mode 100755 index 0000000..68b82a4 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/ea/46fea0942ef671.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/fa/39648a29eb2f06.debug b/third_party/fuchsia-sdk/.build-id/fa/39648a29eb2f06.debug new file mode 100755 index 0000000..fedc0d4 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/fa/39648a29eb2f06.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/fd/0aaad880fd8e81.debug b/third_party/fuchsia-sdk/.build-id/fd/0aaad880fd8e81.debug new file mode 100755 index 0000000..71d9539 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/fd/0aaad880fd8e81.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.build-id/ff/6959a5ccf92c5b.debug b/third_party/fuchsia-sdk/.build-id/ff/6959a5ccf92c5b.debug new file mode 100755 index 0000000..6941c04 --- /dev/null +++ b/third_party/fuchsia-sdk/.build-id/ff/6959a5ccf92c5b.debug Binary files differ
diff --git a/third_party/fuchsia-sdk/.gitignore b/third_party/fuchsia-sdk/.gitignore new file mode 100644 index 0000000..20de49f --- /dev/null +++ b/third_party/fuchsia-sdk/.gitignore
@@ -0,0 +1,4 @@ +# gitignore for GN SDK +/images/ +/bin/gsutil +/authkeys.txt
diff --git a/third_party/fuchsia-sdk/AUTHORS b/third_party/fuchsia-sdk/AUTHORS new file mode 100644 index 0000000..61ae302 --- /dev/null +++ b/third_party/fuchsia-sdk/AUTHORS
@@ -0,0 +1,10 @@ +# This is the list of Fuchsia Authors. + +# Names should be added to this file as one of +# Organization's name +# Individual's name <submission email address> +# Individual's name <submission email address> <email2> <emailN> + +Google Inc. +The Chromium Authors +The Go Authors
diff --git a/third_party/fuchsia-sdk/COPYRIGHT.musl b/third_party/fuchsia-sdk/COPYRIGHT.musl new file mode 100644 index 0000000..faebed7 --- /dev/null +++ b/third_party/fuchsia-sdk/COPYRIGHT.musl
@@ -0,0 +1,129 @@ +musl as a whole is licensed under the following standard MIT license: + +---------------------------------------------------------------------- +Copyright © 2005-2014 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- + +Authors/contributors include: + +Alex Dowad +Alexander Monakov +Anthony G. Basile +Arvid Picciani +Bobby Bingham +Boris Brezillon +Brent Cook +Chris Spiegel +Clément Vasseur +Daniel Micay +Denys Vlasenko +Emil Renner Berthing +Felix Fietkau +Felix Janda +Gianluca Anzolin +Hauke Mehrtens +Hiltjo Posthuma +Isaac Dunham +Jaydeep Patil +Jens Gustedt +Jeremy Huntwork +Jo-Philipp Wich +Joakim Sindholt +John Spencer +Josiah Worcester +Justin Cormack +Khem Raj +Kylie McClain +Luca Barbato +Luka Perkov +M Farkas-Dyck (Strake) +Mahesh Bodapati +Michael Forney +Natanael Copa +Nicholas J. Kain +orc +Pascal Cuoq +Petr Hosek +Pierre Carrier +Rich Felker +Richard Pennington +Shiz +sin +Solar Designer +Stefan Kristiansson +Szabolcs Nagy +Timo Teräs +Trutz Behn +Valentin Ochs +William Haddon + +Portions of this software are derived from third-party works licensed +under terms compatible with the above MIT license: + +Much of the math library code (third_party/math/* and +third_party/complex/*, and third_party/include/libm.h) is +Copyright © 1993,2004 Sun Microsystems or +Copyright © 2003-2011 David Schultz or +Copyright © 2003-2009 Steven G. Kargl or +Copyright © 2003-2009 Bruce D. Evans or +Copyright © 2008 Stephen L. Moshier +and labelled as such in comments in the individual source files. All +have been licensed under extremely permissive terms. + +The smoothsort implementation (third_party/smoothsort/qsort.c) is +Copyright © 2011 Valentin Ochs and is licensed under an MIT-style +license. + +The x86_64 files in third_party/arch were written by Nicholas J. Kain +and is licensed under the standard MIT terms. + +All other files which have no copyright comments are original works +produced specifically for use as part of this library, written either +by Rich Felker, the main author of the library, or by one or more +contibutors listed above. Details on authorship of individual files +can be found in the git version control history of the project. The +omission of copyright and license comments in each file is in the +interest of source tree size. + +In addition, permission is hereby granted for all public header files +(include/* and arch/*/bits/*) and crt files intended to be linked into +applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit +the copyright notice and permission notice otherwise required by the +license, and to use these files without any requirement of +attribution. These files include substantial contributions from: + +Bobby Bingham +John Spencer +Nicholas J. Kain +Rich Felker +Richard Pennington +Stefan Kristiansson +Szabolcs Nagy + +all of whom have explicitly granted such permission. + +This file previously contained text expressing a belief that most of +the files covered by the above exception were sufficiently trivial not +to be subject to copyright, resulting in confusion over whether it +negated the permissions granted in the license. In the spirit of +permissive licensing, and of not having licensing issues being an +obstacle to adoption, that text has been removed.
diff --git a/third_party/fuchsia-sdk/LICENSE b/third_party/fuchsia-sdk/LICENSE new file mode 100644 index 0000000..87f152c --- /dev/null +++ b/third_party/fuchsia-sdk/LICENSE
@@ -0,0 +1,27 @@ +Copyright 2019 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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.
diff --git a/third_party/fuchsia-sdk/LICENSE.vulkan b/third_party/fuchsia-sdk/LICENSE.vulkan new file mode 100644 index 0000000..6599e31 --- /dev/null +++ b/third_party/fuchsia-sdk/LICENSE.vulkan
@@ -0,0 +1,207 @@ +The majority of files in this project use the Apache 2.0 License. +There are a few exceptions and their license can be found in the source. +Any license deviations from Apache 2.0 are "more permissive" licenses. + +=========================================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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.
diff --git a/third_party/fuchsia-sdk/PATENTS b/third_party/fuchsia-sdk/PATENTS new file mode 100644 index 0000000..2746e78 --- /dev/null +++ b/third_party/fuchsia-sdk/PATENTS
@@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Fuchsia project. + +Google hereby grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this +section) patent license to make, have made, use, offer to sell, sell, +import, transfer, and otherwise run, modify and propagate the contents +of this implementation of Fuchsia, where such license applies only to +those patent claims, both currently owned by Google and acquired in +the future, licensable by Google that are necessarily infringed by +this implementation. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute +or order or agree to the institution of patent litigation or any other +patent enforcement activity against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that this +implementation of Fuchsia constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of +Fuchsia shall terminate as of the date such litigation is filed.
diff --git a/third_party/fuchsia-sdk/README.GN.md b/third_party/fuchsia-sdk/README.GN.md new file mode 100644 index 0000000..34fd511 --- /dev/null +++ b/third_party/fuchsia-sdk/README.GN.md
@@ -0,0 +1,5 @@ +# GN SDK for Fuchsia + +See https://fuchsia.dev/fuchsia-src/development/sdk/gn for information on using +this SDK. +
diff --git a/third_party/fuchsia-sdk/README.md b/third_party/fuchsia-sdk/README.md new file mode 100644 index 0000000..b50c6b0 --- /dev/null +++ b/third_party/fuchsia-sdk/README.md
@@ -0,0 +1,113 @@ +# Fuchsia Core SDK + +This archive contains the Fuchsia Core SDK, which is a small set of +Fuchsia-specific libraries and tools required to start building and running +programs for Fuchsia. + +This SDK differs from traditional SDKs in that it is not readily usable out of +the box. +For example, it does not contain any build system, favor any +toolchain, or provide standard non-Fuchsia libraries (e.g. for crypto or +graphics). +Instead, it provides metadata accurately describing its various +parts, so that this SDK can be post-processed and augmented with all the pieces +necessary for a satisfactory end-to-end development experience. + +Most developers who wish to build something for Fuchsia should not need to +deal directly with this particular SDK. +They will instead consume a transformed version of it, for instance within the +development environment and ecosystem supporting a given language runtime. +Maintainers of development environments who wish to add support for Fuchsia are +the main audience for this SDK. +See [the section below](#ingestion) for a description of how to process this +SDK. + +As such, the Core SDK is the representation of the Fuchsia platform developers' +contract with other developers who work with Fuchsia. +While that contract is absolutely necessary, as this SDK contains the very bits +that are unique to Fuchsia, it is not sufficient and will be complemented by +other "contracts". +The Fuchsia Core SDK is mirroring the Fuchsia platform in that respect: highly +composable and extensible, with a clear separation of concerns. + + +## Structure + +From this point on, the root of the SDK archive will be referred to as `//`. + +### Metadata + +Metadata is present throughout this SDK in the form of JSON files. +Every element in this SDK has its own metadata file: for example, a FIDL library +`//fidl/fuchsia.foobar` has its metadata encoded in +`//fidl/fuchsia.foobar/meta.json`. + +Every metadata file follows a JSON schema available under `//meta/schemas`: for +example, a FIDL library's metadata file conforms to +`//meta/schemas/fidl_library.json`. +Schemas act as the documentation for the metadata and may be used to facilitate +the SDK ingestion process. + +### Documentation + +General documentation is available under [`//docs`](docs/README.md). +Some individual SDK elements will also provide documentation directly under the +path where they are hosted in the SDK. + +### Target prebuilts + +Target prebuilts are hosted under `//arch/<architecture>`. +This includes a full-fledged sysroot for each available architecture. + +### Source libraries + +The SDK contains sources for a large number of FIDL libraries (under +`//fidl`) as well as a few C/C++ libraries (under `//pkg`). + +### Host tools + +Multiple host-side tools can be found under `//tools`. +This includes tools for building programs, deploying to a device, debugging, +etc... +Some information about how to use these tools can be found under `//docs`. + +### Images + +`//device` contains metadata describing device configurations matching a given +version of the SDK. +This metadata contains pointers to images that can be flashed onto said devices. + + +## Ingestion + +This section describes the basic process of consuming the Core SDK and turning +it into something usable. + +The main entry point for the ingestion process is a file at +`//meta/manifest.json`. +As with every metadata file in the SDK, the manifest follows a JSON schema which +is included under `//meta/schemas/manifest.json`. + +This file contains a list of all the elements included in this SDK, represented +by the path to their respective metadata file. +Each element file is guaranteed to contain a top-level `type` attribute, which +may be used to apply different treatments to different element types, e.g. +generating a build file for a FIDL library vs. just moving a host tool to a +convenient location in the final development environment. + +The existence of the various metadata files as well as the exhaustiveness of +their contents should make it so that the ingestion process may be fully +automated. +JSON schemas may even be used to generate code representing the metadata +containers and let the ingestion program handle idiomatic data structures +instead of raw JSON representations. + +The metadata schemas will evolve over time. +In order to allow consumers of that metadata to adjust to schema changes, the +main metadata file contains a property named `schema_version` which is an opaque +version identifier for these schemas. +This version identifier will be modified every time the metadata schemas evolve +in a way that requires the attention of a developer. +SDK consumers may record the version identifier of the metadata they used to last +ingest an SDK and compare that version identifier to next SDK's version +identifier in order to detect when developer action may be required.
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_core_validation.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_core_validation.so new file mode 100755 index 0000000..708f073 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_core_validation.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_image_pipe_swapchain.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_image_pipe_swapchain.so new file mode 100755 index 0000000..b7e433a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_image_pipe_swapchain.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_khronos_validation.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_khronos_validation.so new file mode 100755 index 0000000..77d483f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_khronos_validation.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_object_lifetimes.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_object_lifetimes.so new file mode 100755 index 0000000..51f9096 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_object_lifetimes.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_stateless_validation.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_stateless_validation.so new file mode 100755 index 0000000..0226451 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_stateless_validation.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_thread_safety.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_thread_safety.so new file mode 100755 index 0000000..24d750d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_thread_safety.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_unique_objects.so b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_unique_objects.so new file mode 100755 index 0000000..5177ddd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/VkLayer_unique_objects.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libasync-default.so b/third_party/fuchsia-sdk/arch/arm64/dist/libasync-default.so new file mode 100755 index 0000000..c25a530 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libasync-default.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libfdio.so b/third_party/fuchsia-sdk/arch/arm64/dist/libfdio.so new file mode 100755 index 0000000..47ef705 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libfdio.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libmemfs.so b/third_party/fuchsia-sdk/arch/arm64/dist/libmemfs.so new file mode 100755 index 0000000..e5c9981 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libmemfs.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libsvc.so b/third_party/fuchsia-sdk/arch/arm64/dist/libsvc.so new file mode 100755 index 0000000..09a6407 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libsvc.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libsyslog.so b/third_party/fuchsia-sdk/arch/arm64/dist/libsyslog.so new file mode 100755 index 0000000..2f936fb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libsyslog.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libtrace-engine.so b/third_party/fuchsia-sdk/arch/arm64/dist/libtrace-engine.so new file mode 100755 index 0000000..e5149b4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libtrace-engine.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libtrace-provider-so.so b/third_party/fuchsia-sdk/arch/arm64/dist/libtrace-provider-so.so new file mode 100755 index 0000000..435d074 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libtrace-provider-so.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/dist/libvulkan.so b/third_party/fuchsia-sdk/arch/arm64/dist/libvulkan.so new file mode 100755 index 0000000..df72921 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/dist/libvulkan.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libasync-default.so b/third_party/fuchsia-sdk/arch/arm64/lib/libasync-default.so new file mode 100755 index 0000000..8695283 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libasync-default.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libasync-loop-default.a b/third_party/fuchsia-sdk/arch/arm64/lib/libasync-loop-default.a new file mode 100644 index 0000000..5a3001f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libasync-loop-default.a Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libfdio.so b/third_party/fuchsia-sdk/arch/arm64/lib/libfdio.so new file mode 100755 index 0000000..6941c04 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libfdio.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libmemfs.so b/third_party/fuchsia-sdk/arch/arm64/lib/libmemfs.so new file mode 100755 index 0000000..30ef708 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libmemfs.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libsvc.so b/third_party/fuchsia-sdk/arch/arm64/lib/libsvc.so new file mode 100755 index 0000000..09a6407 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libsvc.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libsync.a b/third_party/fuchsia-sdk/arch/arm64/lib/libsync.a new file mode 100644 index 0000000..f5f8e08 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libsync.a Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libsyslog.so b/third_party/fuchsia-sdk/arch/arm64/lib/libsyslog.so new file mode 100755 index 0000000..68b82a4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libsyslog.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libtrace-engine.so b/third_party/fuchsia-sdk/arch/arm64/lib/libtrace-engine.so new file mode 100755 index 0000000..ffadfd1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libtrace-engine.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libtrace-provider-so.so b/third_party/fuchsia-sdk/arch/arm64/lib/libtrace-provider-so.so new file mode 100755 index 0000000..43f3215 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libtrace-provider-so.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/lib/libvulkan.so b/third_party/fuchsia-sdk/arch/arm64/lib/libvulkan.so new file mode 100755 index 0000000..df72921 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/lib/libvulkan.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/dist/lib/ld.so.1 b/third_party/fuchsia-sdk/arch/arm64/sysroot/dist/lib/ld.so.1 new file mode 100755 index 0000000..1d39253 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/dist/lib/ld.so.1 Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/alloca.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/alloca.h new file mode 100644 index 0000000..7deb5b9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/alloca.h
@@ -0,0 +1,21 @@ +#ifndef SYSROOT_ALLOCA_H_ +#define SYSROOT_ALLOCA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#include <bits/alltypes.h> + +void* alloca(size_t); + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ALLOCA_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ar.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ar.h new file mode 100644 index 0000000..d0d4176 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ar.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_AR_H_ +#define SYSROOT_AR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ARMAG "!<arch>\n" +#define SARMAG 8 +#define ARFMAG "`\n" + +struct ar_hdr { + char ar_name[16]; + char ar_date[12]; + char ar_uid[6], ar_gid[6]; + char ar_mode[8]; + char ar_size[10]; + char ar_fmag[2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_AR_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/ftp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/ftp.h new file mode 100644 index 0000000..7d86bec --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/ftp.h
@@ -0,0 +1,37 @@ +#ifndef SYSROOT_ARPA_FTP_H_ +#define SYSROOT_ARPA_FTP_H_ + +#define PRELIM 1 +#define COMPLETE 2 +#define CONTINUE 3 +#define TRANSIENT 4 +#define ERROR 5 +#define TYPE_A 1 +#define TYPE_E 2 +#define TYPE_I 3 +#define TYPE_L 4 +#define FORM_N 1 +#define FORM_T 2 +#define FORM_C 3 +#define STRU_F 1 +#define STRU_R 2 +#define STRU_P 3 +#define MODE_S 1 +#define MODE_B 2 +#define MODE_C 3 +#define REC_ESC '\377' +#define REC_EOR '\001' +#define REC_EOF '\002' +#define BLK_EOR 0x80 +#define BLK_EOF 0x40 +#define BLK_ERRORS 0x20 +#define BLK_RESTART 0x10 +#define BLK_BYTECOUNT 2 +#ifdef FTP_NAMES +char* modenames[] = {"0", "Stream", "Block", "Compressed"}; +char* strunames[] = {"0", "File", "Record", "Page"}; +char* typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local"}; +char* formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control"}; +#endif + +#endif // SYSROOT_ARPA_FTP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/inet.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/inet.h new file mode 100644 index 0000000..4fa0af5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/inet.h
@@ -0,0 +1,36 @@ +#ifndef SYSROOT_ARPA_INET_H_ +#define SYSROOT_ARPA_INET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <netinet/in.h> + +uint32_t htonl(uint32_t); +uint16_t htons(uint16_t); +uint32_t ntohl(uint32_t); +uint16_t ntohs(uint16_t); + +in_addr_t inet_addr(const char*); +in_addr_t inet_network(const char*); +char* inet_ntoa(struct in_addr); +int inet_pton(int, const char* __restrict, void* __restrict); +const char* inet_ntop(int, const void* __restrict, char* __restrict, socklen_t); + +int inet_aton(const char*, struct in_addr*); +struct in_addr inet_makeaddr(in_addr_t, in_addr_t); +in_addr_t inet_lnaof(struct in_addr); +in_addr_t inet_netof(struct in_addr); + +#undef INET_ADDRSTRLEN +#undef INET6_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ARPA_INET_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/nameser.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/nameser.h new file mode 100644 index 0000000..734d205 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/nameser.h
@@ -0,0 +1,451 @@ +#ifndef SYSROOT_ARPA_NAMESER_H_ +#define SYSROOT_ARPA_NAMESER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stddef.h> +#include <stdint.h> + +#define __NAMESER 19991006 +#define NS_PACKETSZ 512 +#define NS_MAXDNAME 1025 +#define NS_MAXMSG 65535 +#define NS_MAXCDNAME 255 +#define NS_MAXLABEL 63 +#define NS_HFIXEDSZ 12 +#define NS_QFIXEDSZ 4 +#define NS_RRFIXEDSZ 10 +#define NS_INT32SZ 4 +#define NS_INT16SZ 2 +#define NS_INT8SZ 1 +#define NS_INADDRSZ 4 +#define NS_IN6ADDRSZ 16 +#define NS_CMPRSFLGS 0xc0 +#define NS_DEFAULTPORT 53 + +typedef enum __ns_sect { + ns_s_qd = 0, + ns_s_zn = 0, + ns_s_an = 1, + ns_s_pr = 1, + ns_s_ns = 2, + ns_s_ud = 2, + ns_s_ar = 3, + ns_s_max = 4 +} ns_sect; + +typedef struct __ns_msg { + const unsigned char *_msg, *_eom; + uint16_t _id, _flags, _counts[ns_s_max]; + const unsigned char* _sections[ns_s_max]; + ns_sect _sect; + int _rrnum; + const unsigned char* _msg_ptr; +} ns_msg; + +struct _ns_flagdata { + int mask, shift; +}; +extern const struct _ns_flagdata _ns_flagdata[]; + +#define ns_msg_id(handle) ((handle)._id + 0) +#define ns_msg_base(handle) ((handle)._msg + 0) +#define ns_msg_end(handle) ((handle)._eom + 0) +#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) +#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) +#define ns_msg_getflag(handle, flag) \ + (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift) + +typedef struct __ns_rr { + char name[NS_MAXDNAME]; + uint16_t type; + uint16_t rr_class; + uint32_t ttl; + uint16_t rdlength; + const unsigned char* rdata; +} ns_rr; + +#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") +#define ns_rr_type(rr) ((ns_type)((rr).type + 0)) +#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) +#define ns_rr_ttl(rr) ((rr).ttl + 0) +#define ns_rr_rdlen(rr) ((rr).rdlength + 0) +#define ns_rr_rdata(rr) ((rr).rdata + 0) + +typedef enum __ns_flag { + ns_f_qr, + ns_f_opcode, + ns_f_aa, + ns_f_tc, + ns_f_rd, + ns_f_ra, + ns_f_z, + ns_f_ad, + ns_f_cd, + ns_f_rcode, + ns_f_max +} ns_flag; + +typedef enum __ns_opcode { + ns_o_query = 0, + ns_o_iquery = 1, + ns_o_status = 2, + ns_o_notify = 4, + ns_o_update = 5, + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, + ns_r_formerr = 1, + ns_r_servfail = 2, + ns_r_nxdomain = 3, + ns_r_notimpl = 4, + ns_r_refused = 5, + ns_r_yxdomain = 6, + ns_r_yxrrset = 7, + ns_r_nxrrset = 8, + ns_r_notauth = 9, + ns_r_notzone = 10, + ns_r_max = 11, + ns_r_badvers = 16, + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +typedef enum __ns_update_operation { + ns_uop_delete = 0, + ns_uop_add = 1, + ns_uop_max = 2 +} ns_update_operation; + +struct ns_tsig_key { + char name[NS_MAXDNAME], alg[NS_MAXDNAME]; + unsigned char* data; + int len; +}; +typedef struct ns_tsig_key ns_tsig_key; + +struct ns_tcp_tsig_state { + int counter; + struct dst_key* key; + void* ctx; + unsigned char sig[NS_PACKETSZ]; + int siglen; +}; +typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; + +#define NS_TSIG_FUDGE 300 +#define NS_TSIG_TCP_COUNT 100 +#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" + +#define NS_TSIG_ERROR_NO_TSIG -10 +#define NS_TSIG_ERROR_NO_SPACE -11 +#define NS_TSIG_ERROR_FORMERR -12 + +typedef enum __ns_type { + ns_t_invalid = 0, + ns_t_a = 1, + ns_t_ns = 2, + ns_t_md = 3, + ns_t_mf = 4, + ns_t_cname = 5, + ns_t_soa = 6, + ns_t_mb = 7, + ns_t_mg = 8, + ns_t_mr = 9, + ns_t_null = 10, + ns_t_wks = 11, + ns_t_ptr = 12, + ns_t_hinfo = 13, + ns_t_minfo = 14, + ns_t_mx = 15, + ns_t_txt = 16, + ns_t_rp = 17, + ns_t_afsdb = 18, + ns_t_x25 = 19, + ns_t_isdn = 20, + ns_t_rt = 21, + ns_t_nsap = 22, + ns_t_nsap_ptr = 23, + ns_t_sig = 24, + ns_t_key = 25, + ns_t_px = 26, + ns_t_gpos = 27, + ns_t_aaaa = 28, + ns_t_loc = 29, + ns_t_nxt = 30, + ns_t_eid = 31, + ns_t_nimloc = 32, + ns_t_srv = 33, + ns_t_atma = 34, + ns_t_naptr = 35, + ns_t_kx = 36, + ns_t_cert = 37, + ns_t_a6 = 38, + ns_t_dname = 39, + ns_t_sink = 40, + ns_t_opt = 41, + ns_t_apl = 42, + ns_t_tkey = 249, + ns_t_tsig = 250, + ns_t_ixfr = 251, + ns_t_axfr = 252, + ns_t_mailb = 253, + ns_t_maila = 254, + ns_t_any = 255, + ns_t_zxfr = 256, + ns_t_max = 65536 +} ns_type; + +#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || (t) == ns_t_mailb || (t) == ns_t_maila) +#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) +#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) +#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) +#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || (t) == ns_t_zxfr) + +typedef enum __ns_class { + ns_c_invalid = 0, + ns_c_in = 1, + ns_c_2 = 2, + ns_c_chaos = 3, + ns_c_hs = 4, + ns_c_none = 254, + ns_c_any = 255, + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_key_types { + ns_kt_rsa = 1, + ns_kt_dh = 2, + ns_kt_dsa = 3, + ns_kt_private = 254 +} ns_key_types; + +typedef enum __ns_cert_types { + cert_t_pkix = 1, + cert_t_spki = 2, + cert_t_pgp = 3, + cert_t_url = 253, + cert_t_oid = 254 +} ns_cert_types; + +#define NS_KEY_TYPEMASK 0xC000 +#define NS_KEY_TYPE_AUTH_CONF 0x0000 +#define NS_KEY_TYPE_CONF_ONLY 0x8000 +#define NS_KEY_TYPE_AUTH_ONLY 0x4000 +#define NS_KEY_TYPE_NO_KEY 0xC000 +#define NS_KEY_NO_AUTH 0x8000 +#define NS_KEY_NO_CONF 0x4000 +#define NS_KEY_RESERVED2 0x2000 +#define NS_KEY_EXTENDED_FLAGS 0x1000 +#define NS_KEY_RESERVED4 0x0800 +#define NS_KEY_RESERVED5 0x0400 +#define NS_KEY_NAME_TYPE 0x0300 +#define NS_KEY_NAME_USER 0x0000 +#define NS_KEY_NAME_ENTITY 0x0200 +#define NS_KEY_NAME_ZONE 0x0100 +#define NS_KEY_NAME_RESERVED 0x0300 +#define NS_KEY_RESERVED8 0x0080 +#define NS_KEY_RESERVED9 0x0040 +#define NS_KEY_RESERVED10 0x0020 +#define NS_KEY_RESERVED11 0x0010 +#define NS_KEY_SIGNATORYMASK 0x000F +#define NS_KEY_RESERVED_BITMASK \ + (NS_KEY_RESERVED2 | NS_KEY_RESERVED4 | NS_KEY_RESERVED5 | NS_KEY_RESERVED8 | NS_KEY_RESERVED9 | \ + NS_KEY_RESERVED10 | NS_KEY_RESERVED11) +#define NS_KEY_RESERVED_BITMASK2 0xFFFF +#define NS_ALG_MD5RSA 1 +#define NS_ALG_DH 2 +#define NS_ALG_DSA 3 +#define NS_ALG_DSS NS_ALG_DSA +#define NS_ALG_EXPIRE_ONLY 253 +#define NS_ALG_PRIVATE_OID 254 + +#define NS_KEY_PROT_TLS 1 +#define NS_KEY_PROT_EMAIL 2 +#define NS_KEY_PROT_DNSSEC 3 +#define NS_KEY_PROT_IPSEC 4 +#define NS_KEY_PROT_ANY 255 + +#define NS_MD5RSA_MIN_BITS 512 +#define NS_MD5RSA_MAX_BITS 4096 +#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS + 7 / 8) * 2 + 3) +#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES + 2) / 3) * 4) +#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS + 7) / 8) +#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS + 7) / 8) + +#define NS_DSA_SIG_SIZE 41 +#define NS_DSA_MIN_SIZE 213 +#define NS_DSA_MAX_BYTES 405 + +#define NS_SIG_TYPE 0 +#define NS_SIG_ALG 2 +#define NS_SIG_LABELS 3 +#define NS_SIG_OTTL 4 +#define NS_SIG_EXPIR 8 +#define NS_SIG_SIGNED 12 +#define NS_SIG_FOOT 16 +#define NS_SIG_SIGNER 18 +#define NS_NXT_BITS 8 +#define NS_NXT_BIT_SET(n, p) (p[(n) / NS_NXT_BITS] |= (0x80 >> ((n) % NS_NXT_BITS))) +#define NS_NXT_BIT_CLEAR(n, p) (p[(n) / NS_NXT_BITS] &= ~(0x80 >> ((n) % NS_NXT_BITS))) +#define NS_NXT_BIT_ISSET(n, p) (p[(n) / NS_NXT_BITS] & (0x80 >> ((n) % NS_NXT_BITS))) +#define NS_NXT_MAX 127 + +#define NS_OPT_DNSSEC_OK 0x8000U +#define NS_OPT_NSID 3 + +#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp) += 2) - 2)) +#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp) += 4) - 4)) +#define NS_PUT16(s, cp) ns_put16((s), ((cp) += 2) - 2) +#define NS_PUT32(l, cp) ns_put32((l), ((cp) += 4) - 4) + +unsigned ns_get16(const unsigned char*); +unsigned long ns_get32(const unsigned char*); +void ns_put16(unsigned, unsigned char*); +void ns_put32(unsigned long, unsigned char*); + +int ns_initparse(const unsigned char*, int, ns_msg*); +int ns_parserr(ns_msg*, ns_sect, int, ns_rr*); +int ns_skiprr(const unsigned char*, const unsigned char*, ns_sect, int); +int ns_name_uncompress(const unsigned char*, const unsigned char*, const unsigned char*, char*, + size_t); + +#define __BIND 19950621 + +typedef struct { + unsigned id : 16; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned qr : 1; + unsigned opcode : 4; + unsigned aa : 1; + unsigned tc : 1; + unsigned rd : 1; + unsigned ra : 1; + unsigned unused : 1; + unsigned ad : 1; + unsigned cd : 1; + unsigned rcode : 4; +#else + unsigned rd : 1; + unsigned tc : 1; + unsigned aa : 1; + unsigned opcode : 4; + unsigned qr : 1; + unsigned rcode : 4; + unsigned cd : 1; + unsigned ad : 1; + unsigned unused : 1; + unsigned ra : 1; +#endif + unsigned qdcount : 16; + unsigned ancount : 16; + unsigned nscount : 16; + unsigned arcount : 16; +} HEADER; + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INT32SZ NS_INT32SZ +#define INT16SZ NS_INT16SZ +#define INT8SZ NS_INT8SZ +#define INADDRSZ NS_INADDRSZ +#define IN6ADDRSZ NS_IN6ADDRSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define S_ZONE ns_s_zn +#define S_PREREQ ns_s_pr +#define S_UPDATE ns_s_ud +#define S_ADDT ns_s_ar + +#define QUERY ns_o_query +#define IQUERY ns_o_iquery +#define STATUS ns_o_status +#define NS_NOTIFY_OP ns_o_notify +#define NS_UPDATE_OP ns_o_update + +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define SERVFAIL ns_r_servfail +#define NXDOMAIN ns_r_nxdomain +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#define YXDOMAIN ns_r_yxdomain +#define YXRRSET ns_r_yxrrset +#define NXRRSET ns_r_nxrrset +#define NOTAUTH ns_r_notauth +#define NOTZONE ns_r_notzone + +#define DELETE ns_uop_delete +#define ADD ns_uop_add + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_A6 ns_t_a6 +#define T_DNAME ns_t_dname +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define GETSHORT NS_GET16 +#define GETLONG NS_GET32 +#define PUTSHORT NS_PUT16 +#define PUTLONG NS_PUT32 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ARPA_NAMESER_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/nameser_compat.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/nameser_compat.h new file mode 100644 index 0000000..ee3b1a9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/nameser_compat.h
@@ -0,0 +1 @@ +#include <arpa/nameser.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/telnet.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/telnet.h new file mode 100644 index 0000000..2da3eda --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/telnet.h
@@ -0,0 +1,279 @@ +#ifndef SYSROOT_ARPA_TELNET_H_ +#define SYSROOT_ARPA_TELNET_H_ + +#define IAC 255 +#define DONT 254 +#define DO 253 +#define WONT 252 +#define WILL 251 +#define SB 250 +#define GA 249 +#define EL 248 +#define EC 247 +#define AYT 246 +#define AO 245 +#define IP 244 +#define BREAK 243 +#define DM 242 +#define NOP 241 +#define SE 240 +#define EOR 239 +#define ABORT 238 +#define SUSP 237 +#define xEOF 236 + +#define SYNCH 242 + +#define telcmds \ + ((char[][6]){"EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", \ + "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0}) + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +#define TELOPT_BINARY 0 +#define TELOPT_ECHO 1 +#define TELOPT_RCP 2 +#define TELOPT_SGA 3 +#define TELOPT_NAMS 4 +#define TELOPT_STATUS 5 +#define TELOPT_TM 6 +#define TELOPT_RCTE 7 +#define TELOPT_NAOL 8 +#define TELOPT_NAOP 9 +#define TELOPT_NAOCRD 10 +#define TELOPT_NAOHTS 11 +#define TELOPT_NAOHTD 12 +#define TELOPT_NAOFFD 13 +#define TELOPT_NAOVTS 14 +#define TELOPT_NAOVTD 15 +#define TELOPT_NAOLFD 16 +#define TELOPT_XASCII 17 +#define TELOPT_LOGOUT 18 +#define TELOPT_BM 19 +#define TELOPT_DET 20 +#define TELOPT_SUPDUP 21 +#define TELOPT_SUPDUPOUTPUT 22 +#define TELOPT_SNDLOC 23 +#define TELOPT_TTYPE 24 +#define TELOPT_EOR 25 +#define TELOPT_TUID 26 +#define TELOPT_OUTMRK 27 +#define TELOPT_TTYLOC 28 +#define TELOPT_3270REGIME 29 +#define TELOPT_X3PAD 30 +#define TELOPT_NAWS 31 +#define TELOPT_TSPEED 32 +#define TELOPT_LFLOW 33 +#define TELOPT_LINEMODE 34 +#define TELOPT_XDISPLOC 35 +#define TELOPT_OLD_ENVIRON 36 +#define TELOPT_AUTHENTICATION 37 /* Authenticate */ +#define TELOPT_ENCRYPT 38 +#define TELOPT_NEW_ENVIRON 39 +#define TELOPT_EXOPL 255 + +#define NTELOPTS (1 + TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char* telopts[NTELOPTS + 1] = { + "BINARY", + "ECHO", + "RCP", + "SUPPRESS GO AHEAD", + "NAME", + "STATUS", + "TIMING MARK", + "RCTE", + "NAOL", + "NAOP", + "NAOCRD", + "NAOHTS", + "NAOHTD", + "NAOFFD", + "NAOVTS", + "NAOVTD", + "NAOLFD", + "EXTEND ASCII", + "LOGOUT", + "BYTE MACRO", + "DATA ENTRY TERMINAL", + "SUPDUP", + "SUPDUP OUTPUT", + "SEND LOCATION", + "TERMINAL TYPE", + "END OF RECORD", + "TACACS UID", + "OUTPUT MARKING", + "TTYLOC", + "3270 REGIME", + "X.3 PAD", + "NAWS", + "TSPEED", + "LFLOW", + "LINEMODE", + "XDISPLOC", + "OLD-ENVIRON", + "AUTHENTICATION", + "ENCRYPT", + "NEW-ENVIRON", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +#define TELQUAL_IS 0 +#define TELQUAL_SEND 1 +#define TELQUAL_INFO 2 +#define TELQUAL_REPLY 2 +#define TELQUAL_NAME 3 + +#define LFLOW_OFF 0 +#define LFLOW_ON 1 +#define LFLOW_RESTART_ANY 2 +#define LFLOW_RESTART_XON 3 + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +#define SLC_NAMELIST \ + "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char* slc_names[] = {SLC_NAMELIST}; +#else +extern char* slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +#define AUTH_WHO_CLIENT 0 +#define AUTH_WHO_SERVER 1 +#define AUTH_WHO_MASK 1 + +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char* authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char* authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +#define ENCRYPT_IS 0 +#define ENCRYPT_SUPPORT 1 +#define ENCRYPT_REPLY 2 +#define ENCRYPT_START 3 +#define ENCRYPT_END 4 +#define ENCRYPT_REQSTART 5 +#define ENCRYPT_REQEND 6 +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char* encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", "REQUEST-START", + "REQUEST-END", "ENC-KEYID", "DEC-KEYID", 0, +}; +char* enctype_names[] = { + "ANY", + "DES_CFB64", + "DES_OFB64", + 0, +}; +#else +extern char* encrypt_names[]; +extern char* enctype_names[]; +#endif + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif // SYSROOT_ARPA_TELNET_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/tftp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/tftp.h new file mode 100644 index 0000000..e091368 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/arpa/tftp.h
@@ -0,0 +1,32 @@ +#ifndef SYSROOT_ARPA_TFTP_H_ +#define SYSROOT_ARPA_TFTP_H_ + +#define SEGSIZE 512 +#define RRQ 01 +#define WRQ 02 +#define DATA 03 +#define ACK 04 +#define ERROR 05 +struct tftphdr { + short th_opcode; + union { + unsigned short tu_block; + short tu_code; + char tu_stuff[1]; + } th_u; + char th_data[1]; +}; +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data +#define EUNDEF 0 +#define ENOTFOUND 1 +#define EACCESS 2 +#define ENOSPACE 3 +#define EBADOP 4 +#define EBADID 5 +#define EEXISTS 6 +#define ENOUSER 7 + +#endif // SYSROOT_ARPA_TFTP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/assert.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/assert.h new file mode 100644 index 0000000..02e96dc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/assert.h
@@ -0,0 +1,23 @@ +#include <features.h> + +#undef assert + +#ifdef NDEBUG +#define assert(x) (void)0 +#else +#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__), 0))) +#endif + +#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) && !defined(static_assert) +#define static_assert _Static_assert +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void __assert_fail(const char*, const char*, int, const char*); + +#ifdef __cplusplus +} +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/endian.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/endian.h new file mode 100644 index 0000000..7a74d2f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/endian.h
@@ -0,0 +1,5 @@ +#if __AARCH64EB__ +#define __BYTE_ORDER __BIG_ENDIAN +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/fenv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/fenv.h new file mode 100644 index 0000000..a370540 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/fenv.h
@@ -0,0 +1,19 @@ +#define FE_INVALID 1 +#define FE_DIVBYZERO 2 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 8 +#define FE_INEXACT 16 +#define FE_ALL_EXCEPT 31 +#define FE_TONEAREST 0 +#define FE_DOWNWARD 0x800000 +#define FE_UPWARD 0x400000 +#define FE_TOWARDZERO 0xc00000 + +typedef unsigned int fexcept_t; + +typedef struct { + unsigned int __fpcr; + unsigned int __fpsr; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t*)-1)
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/io.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/io.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/io.h
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/ioctl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/ioctl.h new file mode 100644 index 0000000..40835ba --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/ioctl.h
@@ -0,0 +1,213 @@ +#define _IOC(a, b, c, d) (((a) << 30) | ((b) << 8) | (c) | ((d) << 16)) +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IO(a, b) _IOC(_IOC_NONE, (a), (b), 0) +#define _IOW(a, b, c) _IOC(_IOC_WRITE, (a), (b), sizeof(c)) +#define _IOR(a, b, c) _IOC(_IOC_READ, (a), (b), sizeof(c)) +#define _IOWR(a, b, c) _IOC(_IOC_READ | _IOC_WRITE, (a), (b), sizeof(c)) + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCTTYGSTRUCT 0x5426 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGRS485 0x542E +#define TIOCSRS485 0x542F +#define TIOCGPTN _IOR('T', 0x30, unsigned int) +#define TIOCSPTLCK _IOW('T', 0x31, int) +#define TIOCGDEV _IOR('T', 0x32, unsigned int) +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 +#define TIOCSIG 0x40045436 +#define TIOCVHANGUP 0x5437 +#define TIOCGPKT 0x80045438 +#define TIOCGPTLCK 0x80045439 +#define TIOCGEXCL 0x80045440 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERGETLSR 0x5459 +#define TIOCSERGETMULTI 0x545A +#define TIOCSERSETMULTI 0x545B + +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define FIOQSIZE 0x5460 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 +#define TIOCPKT_IOCTL 64 + +#define TIOCSER_TEMT 0x01 + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 +#define TIOCM_MODEM_BITS TIOCM_OUT2 + +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 +#define N_6PACK 7 +#define N_MASC 8 +#define N_R3964 9 +#define N_PROFIBUS_FDL 10 +#define N_IRDA 11 +#define N_SMSBLOCK 12 +#define N_HDLC 13 +#define N_SYNC_PPP 14 +#define N_HCI 15 +#define N_GIGASET_M101 16 +#define N_SLCAN 17 +#define N_PPS 18 +#define N_V253 19 +#define N_CAIF 20 +#define N_GSM0710 21 +#define N_TI_WL 22 +#define N_TRACESINK 23 +#define N_TRACEROUTER 24 + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 +#define SIOCGSTAMPNS 0x8907 + +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D + +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX SIOCGIFINDEX +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 + +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 + +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 + +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 + +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 + +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 + +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 + +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/ipc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/ipc.h new file mode 100644 index 0000000..26161a2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/ipc.h
@@ -0,0 +1,14 @@ +struct ipc_perm { + key_t __ipc_perm_key; + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; + unsigned short __ipc_perm_seq; + + unsigned long __pad1; + unsigned long __pad2; +}; + +#define IPC_64 0
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/reg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/reg.h new file mode 100644 index 0000000..2633f39 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/reg.h
@@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 64
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/setjmp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/setjmp.h new file mode 100644 index 0000000..c37aeb8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/setjmp.h
@@ -0,0 +1 @@ +typedef unsigned long long int __jmp_buf[23];
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/signal.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/signal.h new file mode 100644 index 0000000..64e57f3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/signal.h
@@ -0,0 +1,107 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 6144 +#define SIGSTKSZ 12288 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long greg_t; +typedef unsigned long gregset_t[34]; + +typedef struct { + long double vregs[32]; + unsigned int fpsr; + unsigned int fpcr; +} fpregset_t; +typedef struct sigcontext { + unsigned long fault_address; + unsigned long regs[31]; + unsigned long sp, pc, pstate; + long double __reserved[256]; +} mcontext_t; + +#define FPSIMD_MAGIC 0x46508001 +#define ESR_MAGIC 0x45535201 +struct _aarch64_ctx { + unsigned int magic; + unsigned int size; +}; +struct fpsimd_context { + struct _aarch64_ctx head; + unsigned int fpsr; + unsigned int fpcr; + long double vregs[32]; +}; +struct esr_context { + struct _aarch64_ctx head; + unsigned long esr; +}; +#else +typedef struct { + long double __regs[18 + 256]; +} mcontext_t; +#endif + +struct sigaltstack { + void* ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct ucontext* uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + mcontext_t uc_mcontext; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/stat.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/stat.h new file mode 100644 index 0000000..02102fa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/aarch64/stat.h
@@ -0,0 +1,18 @@ +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned __unused1[2]; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/alltypes.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/alltypes.h new file mode 100644 index 0000000..95da44c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/alltypes.h
@@ -0,0 +1,544 @@ +#if defined(__cplusplus) && !defined(__clang__) +#define __C11_ATOMIC(t) t +#else +#define __C11_ATOMIC(t) _Atomic(t) +#endif + +#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t) +typedef __UINT8_TYPE__ uint8_t; +#define __DEFINED_uint8_t +#endif + +#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t) +typedef __UINT16_TYPE__ uint16_t; +#define __DEFINED_uint16_t +#endif + +#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t) +typedef __UINT32_TYPE__ uint32_t; +#define __DEFINED_uint32_t +#endif + +#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t) +typedef __UINT64_TYPE__ uint64_t; +#define __DEFINED_uint64_t +#endif + +#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t) +typedef __INT8_TYPE__ int8_t; +#define __DEFINED_int8_t +#endif + +#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t) +typedef __INT16_TYPE__ int16_t; +#define __DEFINED_int16_t +#endif + +#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t) +typedef __INT32_TYPE__ int32_t; +#define __DEFINED_int32_t +#endif + +#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t) +typedef __INT64_TYPE__ int64_t; +#define __DEFINED_int64_t +#endif + +#if defined(__NEED_uint_least8_t) && !defined(__DEFINED_uint_least8_t) +typedef __UINT_LEAST8_TYPE__ uint_least8_t; +#define __DEFINED_uint_least8_t +#endif + +#if defined(__NEED_uint_least16_t) && !defined(__DEFINED_uint_least16_t) +typedef __UINT_LEAST16_TYPE__ uint_least16_t; +#define __DEFINED_uint_least16_t +#endif + +#if defined(__NEED_uint_least32_t) && !defined(__DEFINED_uint_least32_t) +typedef __UINT_LEAST32_TYPE__ uint_least32_t; +#define __DEFINED_uint_least32_t +#endif + +#if defined(__NEED_uint_least64_t) && !defined(__DEFINED_uint_least64_t) +typedef __UINT_LEAST64_TYPE__ uint_least64_t; +#define __DEFINED_uint_least64_t +#endif + +#if defined(__NEED_int_least8_t) && !defined(__DEFINED_int_least8_t) +typedef __INT_LEAST8_TYPE__ int_least8_t; +#define __DEFINED_int_least8_t +#endif + +#if defined(__NEED_int_least16_t) && !defined(__DEFINED_int_least16_t) +typedef __INT_LEAST16_TYPE__ int_least16_t; +#define __DEFINED_int_least16_t +#endif + +#if defined(__NEED_int_least32_t) && !defined(__DEFINED_int_least32_t) +typedef __INT_LEAST32_TYPE__ int_least32_t; +#define __DEFINED_int_least32_t +#endif + +#if defined(__NEED_int_least64_t) && !defined(__DEFINED_int_least64_t) +typedef __INT_LEAST64_TYPE__ int_least64_t; +#define __DEFINED_int_least64_t +#endif + +#if defined(__NEED_uint_fast8_t) && !defined(__DEFINED_uint_fast8_t) +typedef __UINT_FAST8_TYPE__ uint_fast8_t; +#define __DEFINED_uint_fast8_t +#endif + +#if defined(__NEED_uint_fast16_t) && !defined(__DEFINED_uint_fast16_t) +typedef __UINT_FAST16_TYPE__ uint_fast16_t; +#define __DEFINED_uint_fast16_t +#endif + +#if defined(__NEED_uint_fast32_t) && !defined(__DEFINED_uint_fast32_t) +typedef __UINT_FAST32_TYPE__ uint_fast32_t; +#define __DEFINED_uint_fast32_t +#endif + +#if defined(__NEED_uint_fast64_t) && !defined(__DEFINED_uint_fast64_t) +typedef __UINT_FAST64_TYPE__ uint_fast64_t; +#define __DEFINED_uint_fast64_t +#endif + +#if defined(__NEED_int_fast8_t) && !defined(__DEFINED_int_fast8_t) +typedef __INT_FAST8_TYPE__ int_fast8_t; +#define __DEFINED_int_fast8_t +#endif + +#if defined(__NEED_int_fast16_t) && !defined(__DEFINED_int_fast16_t) +typedef __INT_FAST16_TYPE__ int_fast16_t; +#define __DEFINED_int_fast16_t +#endif + +#if defined(__NEED_int_fast32_t) && !defined(__DEFINED_int_fast32_t) +typedef __INT_FAST32_TYPE__ int_fast32_t; +#define __DEFINED_int_fast32_t +#endif + +#if defined(__NEED_int_fast64_t) && !defined(__DEFINED_int_fast64_t) +typedef __INT_FAST64_TYPE__ int_fast64_t; +#define __DEFINED_int_fast64_t +#endif + +#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t) +typedef __INTPTR_TYPE__ intptr_t; +#define __DEFINED_intptr_t +#endif + +#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t) +typedef __UINTPTR_TYPE__ uintptr_t; +#define __DEFINED_uintptr_t +#endif + +#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t) +typedef __INTMAX_TYPE__ intmax_t; +#define __DEFINED_intmax_t +#endif + +#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t) +typedef __UINTMAX_TYPE__ uintmax_t; +#define __DEFINED_uintmax_t +#endif + +#ifndef __cplusplus +#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t) +typedef __WCHAR_TYPE__ wchar_t; +#define __DEFINED_wchar_t +#endif +#endif + +#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t) +typedef unsigned wint_t; +#define __DEFINED_wint_t +#endif + +#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t) +typedef unsigned long wctype_t; +#define __DEFINED_wctype_t +#endif + +#if defined(__NEED_size_t) && !defined(__DEFINED_size_t) +typedef __SIZE_TYPE__ size_t; +#define __DEFINED_size_t +#endif + +#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t) +typedef __PTRDIFF_TYPE__ ptrdiff_t; +#define __DEFINED_ptrdiff_t +#endif + +#if defined(__NEED_va_list) && !defined(__DEFINED_va_list) +typedef __builtin_va_list va_list; +#define __DEFINED_va_list +#endif + +#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list) +typedef __builtin_va_list __isoc_va_list; +#define __DEFINED___isoc_va_list +#endif + +#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t) +typedef long ssize_t; +#define __DEFINED_ssize_t +#endif + +#if defined(__NEED_time_t) && !defined(__DEFINED_time_t) +typedef long time_t; +#define __DEFINED_time_t +#endif + +#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t) +typedef struct { + long long __ll; + long double __ld; +} max_align_t; +#define __DEFINED_max_align_t +#endif + +#if defined(__x86_64__) && defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2 +#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) +typedef long double float_t; +#define __DEFINED_float_t +#endif + +#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) +typedef long double double_t; +#define __DEFINED_double_t +#endif + +#else +#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) +typedef float float_t; +#define __DEFINED_float_t +#endif + +#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) +typedef double double_t; +#define __DEFINED_double_t +#endif + +#endif + +#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t) +typedef long suseconds_t; +#define __DEFINED_suseconds_t +#endif + +#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t) +typedef unsigned useconds_t; +#define __DEFINED_useconds_t +#endif + +#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t) +typedef int clockid_t; +#define __DEFINED_clockid_t +#endif + +#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t) +typedef long clock_t; +#define __DEFINED_clock_t +#endif + +#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t) +typedef int pid_t; +#define __DEFINED_pid_t +#endif + +#if defined(__NEED_id_t) && !defined(__DEFINED_id_t) +typedef unsigned id_t; +#define __DEFINED_id_t +#endif + +#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t) +typedef unsigned uid_t; +#define __DEFINED_uid_t +#endif + +#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t) +typedef unsigned gid_t; +#define __DEFINED_gid_t +#endif + +#if defined(__NEED_register_t) && !defined(__DEFINED_register_t) +typedef long register_t; +#define __DEFINED_register_t +#endif + +#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t) +typedef unsigned long nlink_t; +#define __DEFINED_nlink_t +#endif + +#if defined(__NEED_off_t) && !defined(__DEFINED_off_t) +typedef long long off_t; +#define __DEFINED_off_t +#endif + +#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t) +typedef unsigned long long ino_t; +#define __DEFINED_ino_t +#endif + +#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t) +typedef unsigned long long dev_t; +#define __DEFINED_dev_t +#endif + +#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t) +typedef long blksize_t; +#define __DEFINED_blksize_t +#endif + +#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t) +typedef long long blkcnt_t; +#define __DEFINED_blkcnt_t +#endif + +#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t) +typedef unsigned long long fsblkcnt_t; +#define __DEFINED_fsblkcnt_t +#endif + +#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t) +typedef unsigned long long fsfilcnt_t; +#define __DEFINED_fsfilcnt_t +#endif + +#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec) +struct iovec { + void* iov_base; + size_t iov_len; +}; +#define __DEFINED_struct_iovec +#endif + +#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval) +struct timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; +#define __DEFINED_struct_timeval +#endif + +#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec) +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#define __DEFINED_struct_timespec +#endif + +#if defined(__NEED_key_t) && !defined(__DEFINED_key_t) +typedef int key_t; +#define __DEFINED_key_t +#endif + +#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t) +typedef void* timer_t; +#define __DEFINED_timer_t +#endif + +#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t) +typedef long regoff_t; +#define __DEFINED_regoff_t +#endif + +#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t) +typedef unsigned socklen_t; +#define __DEFINED_socklen_t +#endif + +#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t) +typedef unsigned short sa_family_t; +#define __DEFINED_sa_family_t +#endif + +#if defined(__NEED_FILE) && !defined(__DEFINED_FILE) +typedef struct _IO_FILE FILE; +#define __DEFINED_FILE +#endif + +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t) +typedef struct __locale_struct* locale_t; +#define __DEFINED_locale_t +#endif + +#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t) +typedef unsigned mode_t; +#define __DEFINED_mode_t +#endif + +#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t) +typedef struct __sigset_t { + unsigned long __bits[128 / sizeof(long)]; +} sigset_t; +#define __DEFINED_sigset_t +#endif + +#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t) +typedef __C11_ATOMIC(int) pthread_once_t; +#define __DEFINED_pthread_once_t +#endif + +#if defined(__NEED_once_flag) && !defined(__DEFINED_once_flag) +typedef __C11_ATOMIC(int) once_flag; +#define __DEFINED_once_flag +#endif + +#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t) +typedef unsigned pthread_key_t; +#define __DEFINED_pthread_key_t +#endif + +#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t) +typedef __C11_ATOMIC(int) pthread_spinlock_t; +#define __DEFINED_pthread_spinlock_t +#endif + +#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t) +typedef struct { + unsigned __attr; +} pthread_mutexattr_t; +#define __DEFINED_pthread_mutexattr_t +#endif + +#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t) +typedef struct { + unsigned __attr; +} pthread_condattr_t; +#define __DEFINED_pthread_condattr_t +#endif + +#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t) +typedef struct { + unsigned __attr; +} pthread_barrierattr_t; +#define __DEFINED_pthread_barrierattr_t +#endif + +#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t) +typedef struct { + unsigned __attr[2]; +} pthread_rwlockattr_t; +#define __DEFINED_pthread_rwlockattr_t +#endif + +#ifdef __cplusplus +#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) +typedef unsigned long pthread_t; +#define __DEFINED_pthread_t +#endif + +#else +#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) +typedef struct __pthread* pthread_t; +#define __DEFINED_pthread_t +#endif + +#endif + +#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t) +typedef struct __mbstate_t { + unsigned __opaque1, __opaque2; +} mbstate_t; +#define __DEFINED_mbstate_t +#endif + +#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t) +typedef struct { + const char* __name; + int __c11; + size_t _a_stacksize; + size_t _a_guardsize; + void* _a_stackaddr; + int _a_detach; + int _a_sched; + int _a_policy; + int _a_prio; +} pthread_attr_t; +#define __DEFINED_pthread_attr_t +#endif + +#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t) +typedef struct { + unsigned _m_attr; + __C11_ATOMIC(int) + _m_lock; + __C11_ATOMIC(int) + _m_waiters; + int _m_count; +} pthread_mutex_t; +#define __DEFINED_pthread_mutex_t +#endif + +#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t) +typedef struct +#if defined(__clang__) + __attribute__((__capability__("mutex"))) +#endif +{ + int __i[1]; +} mtx_t; +#define __DEFINED_mtx_t +#endif + +#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t) +typedef struct { + void* _c_head; + int _c_clock; + void* _c_tail; + __C11_ATOMIC(int) + _c_lock; +} pthread_cond_t; +#define __DEFINED_pthread_cond_t +#endif + +#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t) +typedef struct { + void* _c_head; + int _c_clock; + void* _c_tail; + __C11_ATOMIC(int) _c_lock; +} cnd_t; +#define __DEFINED_cnd_t +#endif + +#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t) +typedef struct { + __C11_ATOMIC(int) + _rw_lock; + __C11_ATOMIC(int) + _rw_waiters; +} pthread_rwlock_t; +#define __DEFINED_pthread_rwlock_t +#endif + +#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t) +typedef struct { + __C11_ATOMIC(int) + _b_lock; + __C11_ATOMIC(int) + _b_waiters; + unsigned int _b_limit; + __C11_ATOMIC(int) + _b_count; + __C11_ATOMIC(int) + _b_waiters2; + void* _b_inst; +} pthread_barrier_t; +#define __DEFINED_pthread_barrier_t +#endif + +#if defined(__NEED_sem_t) && !defined(__DEFINED_sem_t) +typedef struct { + __C11_ATOMIC(int) + _s_value; + __C11_ATOMIC(int) + _s_waiters; +} sem_t; +#define __DEFINED_sem_t +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/endian.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/endian.h new file mode 100644 index 0000000..ed44e80 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/endian.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/endian.h" +#elif defined(__aarch64__) +#include "aarch64/endian.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/errno.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/errno.h new file mode 100644 index 0000000..b9ebc31 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/errno.h
@@ -0,0 +1,134 @@ +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EDEADLK 35 +#define ENAMETOOLONG 36 +#define ENOLCK 37 +#define ENOSYS 38 +#define ENOTEMPTY 39 +#define ELOOP 40 +#define EWOULDBLOCK EAGAIN +#define ENOMSG 42 +#define EIDRM 43 +#define ECHRNG 44 +#define EL2NSYNC 45 +#define EL3HLT 46 +#define EL3RST 47 +#define ELNRNG 48 +#define EUNATCH 49 +#define ENOCSI 50 +#define EL2HLT 51 +#define EBADE 52 +#define EBADR 53 +#define EXFULL 54 +#define ENOANO 55 +#define EBADRQC 56 +#define EBADSLT 57 +#define EDEADLOCK EDEADLK +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EMULTIHOP 72 +#define EDOTDOT 73 +#define EBADMSG 74 +#define EOVERFLOW 75 +#define ENOTUNIQ 76 +#define EBADFD 77 +#define EREMCHG 78 +#define ELIBACC 79 +#define ELIBBAD 80 +#define ELIBSCN 81 +#define ELIBMAX 82 +#define ELIBEXEC 83 +#define EILSEQ 84 +#define ERESTART 85 +#define ESTRPIPE 86 +#define EUSERS 87 +#define ENOTSOCK 88 +#define EDESTADDRREQ 89 +#define EMSGSIZE 90 +#define EPROTOTYPE 91 +#define ENOPROTOOPT 92 +#define EPROTONOSUPPORT 93 +#define ESOCKTNOSUPPORT 94 +#define EOPNOTSUPP 95 +#define ENOTSUP EOPNOTSUPP +#define EPFNOSUPPORT 96 +#define EAFNOSUPPORT 97 +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 +#define ENETRESET 102 +#define ECONNABORTED 103 +#define ECONNRESET 104 +#define ENOBUFS 105 +#define EISCONN 106 +#define ENOTCONN 107 +#define ESHUTDOWN 108 +#define ETOOMANYREFS 109 +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 +#define ESTALE 116 +#define EUCLEAN 117 +#define ENOTNAM 118 +#define ENAVAIL 119 +#define EISNAM 120 +#define EREMOTEIO 121 +#define EDQUOT 122 +#define ENOMEDIUM 123 +#define EMEDIUMTYPE 124 +#define ECANCELED 125 +#define ENOKEY 126 +#define EKEYEXPIRED 127 +#define EKEYREVOKED 128 +#define EKEYREJECTED 129 +#define EOWNERDEAD 130 +#define ENOTRECOVERABLE 131 +#define ERFKILL 132 +#define EHWPOISON 133
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/fcntl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/fcntl.h new file mode 100644 index 0000000..c96e45f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/fcntl.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/fcntl.h" +#elif defined(__aarch64__) +#include "aarch64/fcntl.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/fenv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/fenv.h new file mode 100644 index 0000000..99ca0ba --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/fenv.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/fenv.h" +#elif defined(__aarch64__) +#include "aarch64/fenv.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/io.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/io.h new file mode 100644 index 0000000..480bbaf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/io.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/io.h" +#elif defined(__aarch64__) +#include "aarch64/io.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/ioctl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/ioctl.h new file mode 100644 index 0000000..d8bcfa3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/ioctl.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/ioctl.h" +#elif defined(__aarch64__) +#include "aarch64/ioctl.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/ipc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/ipc.h new file mode 100644 index 0000000..a81d510 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/ipc.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/ipc.h" +#elif defined(__aarch64__) +#include "aarch64/ipc.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/limits.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/limits.h new file mode 100644 index 0000000..8d1910b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/limits.h
@@ -0,0 +1,8 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define PAGE_SIZE 4096 +#define LONG_BIT 64 +#endif + +#define LONG_MAX 0x7fffffffffffffffL +#define LLONG_MAX 0x7fffffffffffffffLL
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/msg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/msg.h new file mode 100644 index 0000000..1c8034b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/msg.h
@@ -0,0 +1,12 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + time_t msg_stime; + time_t msg_rtime; + time_t msg_ctime; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + unsigned long __unused[2]; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/null.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/null.h new file mode 100644 index 0000000..76e7b77 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/null.h
@@ -0,0 +1,15 @@ +// Copyright 2017 The Fuchsia Authors +// +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT + +#ifndef SYSROOT_BITS_NULL_H_ +#define SYSROOT_BITS_NULL_H_ + +// The compiler's <stddef.h> defines NULL without defining anything +// else if __need_NULL is defined first. +#define __need_NULL +#include <stddef.h> + +#endif // SYSROOT_BITS_NULL_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/poll.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/poll.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/poll.h
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/posix.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/posix.h new file mode 100644 index 0000000..8068ce9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/posix.h
@@ -0,0 +1,2 @@ +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V7_LP64_OFF64 1
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/reg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/reg.h new file mode 100644 index 0000000..ad220cc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/reg.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/reg.h" +#elif defined(__aarch64__) +#include "aarch64/reg.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/resource.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/resource.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/resource.h
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/sem.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/sem.h new file mode 100644 index 0000000..db4102f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/sem.h
@@ -0,0 +1,14 @@ +struct semid_ds { + struct ipc_perm sem_perm; + time_t sem_otime; + time_t sem_ctime; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(time_t) - sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(time_t) - sizeof(short)]; + unsigned short sem_nsems; +#endif + time_t __unused3; + time_t __unused4; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/setjmp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/setjmp.h new file mode 100644 index 0000000..d42af58 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/setjmp.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/setjmp.h" +#elif defined(__aarch64__) +#include "aarch64/setjmp.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/shm.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/shm.h new file mode 100644 index 0000000..a3b9dcc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/shm.h
@@ -0,0 +1,24 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; +}; + +struct shminfo { + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; +}; + +struct shm_info { + int __used_ids; + unsigned long shm_tot, shm_rss, shm_swp; + unsigned long __swap_attempts, __swap_successes; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/signal.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/signal.h new file mode 100644 index 0000000..021a17f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/signal.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/signal.h" +#elif defined(__aarch64__) +#include "aarch64/signal.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/socket.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/socket.h new file mode 100644 index 0000000..1127d5b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/socket.h
@@ -0,0 +1,33 @@ +#include <endian.h> + +struct msghdr { + void* msg_name; + socklen_t msg_namelen; + struct iovec* msg_iov; +#if __BYTE_ORDER == __BIG_ENDIAN + int __pad1, msg_iovlen; +#else + int msg_iovlen, __pad1; +#endif + void* msg_control; +#if __BYTE_ORDER == __BIG_ENDIAN + int __pad2; + socklen_t msg_controllen; +#else + socklen_t msg_controllen; + int __pad2; +#endif + int msg_flags; +}; + +struct cmsghdr { +#if __BYTE_ORDER == __BIG_ENDIAN + int __pad1; + socklen_t cmsg_len; +#else + socklen_t cmsg_len; + int __pad1; +#endif + int cmsg_level; + int cmsg_type; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/stat.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/stat.h new file mode 100644 index 0000000..308b256 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/stat.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/stat.h" +#elif defined(__aarch64__) +#include "aarch64/stat.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/statfs.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/statfs.h new file mode 100644 index 0000000..ef2bbe3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/statfs.h
@@ -0,0 +1,7 @@ +struct statfs { + unsigned long f_type, f_bsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree; + fsid_t f_fsid; + unsigned long f_namelen, f_frsize, f_flags, f_spare[4]; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/termios.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/termios.h new file mode 100644 index 0000000..d9a7359 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/termios.h
@@ -0,0 +1,159 @@ +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[NCCS]; + speed_t __c_ispeed; + speed_t __c_ospeed; +}; + +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#define B0 0000000 +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 + +#define CBAUD 0010017 + +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 + +#define ISIG 0000001 +#define ICANON 0000002 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define IEXTEN 0100000 + +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define CBAUDEX 0010000 +#define CRTSCTS 020000000000 +#define EXTPROC 0200000 +#define XTABS 0014000 +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/endian.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/endian.h new file mode 100644 index 0000000..172c338 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/endian.h
@@ -0,0 +1 @@ +#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/fenv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/fenv.h new file mode 100644 index 0000000..32e7dbf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/fenv.h
@@ -0,0 +1,34 @@ +#define FE_INVALID 1 +#define __FE_DENORM 2 +#define FE_DIVBYZERO 4 +#define FE_OVERFLOW 8 +#define FE_UNDERFLOW 16 +#define FE_INEXACT 32 + +#define FE_ALL_EXCEPT 63 + +#define FE_TONEAREST 0 +#define FE_DOWNWARD 0x400 +#define FE_UPWARD 0x800 +#define FE_TOWARDZERO 0xc00 + +typedef unsigned short fexcept_t; + +typedef struct { + unsigned short __control_word; + unsigned short __unused1; + unsigned short __status_word; + unsigned short __unused2; + unsigned short __tags; + unsigned short __unused3; + unsigned int __eip; + unsigned short __cs_selector; + unsigned int __opcode : 11; + unsigned int __unused4 : 5; + unsigned int __data_offset; + unsigned short __data_selector; + unsigned short __unused5; + unsigned int __mxcsr; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t*)-1)
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/io.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/io.h new file mode 100644 index 0000000..7234422 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/io.h
@@ -0,0 +1,53 @@ +static __inline void outb(unsigned char __val, unsigned short __port) { + __asm__ volatile("outb %0,%1" : : "a"(__val), "dN"(__port)); +} + +static __inline void outw(unsigned short __val, unsigned short __port) { + __asm__ volatile("outw %0,%1" : : "a"(__val), "dN"(__port)); +} + +static __inline void outl(unsigned int __val, unsigned short __port) { + __asm__ volatile("outl %0,%1" : : "a"(__val), "dN"(__port)); +} + +static __inline unsigned char inb(unsigned short __port) { + unsigned char __val; + __asm__ volatile("inb %1,%0" : "=a"(__val) : "dN"(__port)); + return __val; +} + +static __inline unsigned short inw(unsigned short __port) { + unsigned short __val; + __asm__ volatile("inw %1,%0" : "=a"(__val) : "dN"(__port)); + return __val; +} + +static __inline unsigned int inl(unsigned short __port) { + unsigned int __val; + __asm__ volatile("inl %1,%0" : "=a"(__val) : "dN"(__port)); + return __val; +} + +static __inline void outsb(unsigned short __port, const void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; outsb" : "+S"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void outsw(unsigned short __port, const void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; outsw" : "+S"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void outsl(unsigned short __port, const void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; outsl" : "+S"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void insb(unsigned short __port, void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; insb" : "+D"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void insw(unsigned short __port, void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; insw" : "+D"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void insl(unsigned short __port, void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; insl" : "+D"(__buf), "+c"(__n) : "d"(__port)); +}
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/ioctl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/ioctl.h new file mode 100644 index 0000000..bc8d16a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/ioctl.h
@@ -0,0 +1,197 @@ +#define _IOC(a, b, c, d) (((a) << 30) | ((b) << 8) | (c) | ((d) << 16)) +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IO(a, b) _IOC(_IOC_NONE, (a), (b), 0) +#define _IOW(a, b, c) _IOC(_IOC_WRITE, (a), (b), sizeof(c)) +#define _IOR(a, b, c) _IOC(_IOC_READ, (a), (b), sizeof(c)) +#define _IOWR(a, b, c) _IOC(_IOC_READ | _IOC_WRITE, (a), (b), sizeof(c)) + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCTTYGSTRUCT 0x5426 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGPTN 0x80045430 +#define TIOCSPTLCK 0x40045431 +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERGETLSR 0x5459 +#define TIOCSERGETMULTI 0x545A +#define TIOCSERSETMULTI 0x545B + +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define TIOCGHAYESESP 0x545E +#define TIOCSHAYESESP 0x545F +#define FIOQSIZE 0x5460 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 +#define TIOCPKT_IOCTL 64 + +#define TIOCSER_TEMT 0x01 + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 +#define TIOCM_MODEM_BITS TIOCM_OUT2 + +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 +#define N_6PACK 7 +#define N_MASC 8 +#define N_R3964 9 +#define N_PROFIBUS_FDL 10 +#define N_IRDA 11 +#define N_SMSBLOCK 12 +#define N_HDLC 13 +#define N_SYNC_PPP 14 +#define N_HCI 15 + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 + +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D + +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX SIOCGIFINDEX +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 + +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 + +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 + +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 + +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 + +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 + +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 + +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/ipc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/ipc.h new file mode 100644 index 0000000..c66f9ed --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/ipc.h
@@ -0,0 +1,13 @@ +struct ipc_perm { + key_t __ipc_perm_key; + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; + int __ipc_perm_seq; + long __pad1; + long __pad2; +}; + +#define IPC_64 0
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/reg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/reg.h new file mode 100644 index 0000000..12d43c5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/reg.h
@@ -0,0 +1,29 @@ +#undef __WORDSIZE +#define __WORDSIZE 64 +#define R15 0 +#define R14 1 +#define R13 2 +#define R12 3 +#define RBP 4 +#define RBX 5 +#define R11 6 +#define R10 7 +#define R9 8 +#define R8 9 +#define RAX 10 +#define RCX 11 +#define RDX 12 +#define RSI 13 +#define RDI 14 +#define ORIG_RAX 15 +#define RIP 16 +#define CS 17 +#define EFLAGS 18 +#define RSP 19 +#define SS 20 +#define FS_BASE 21 +#define GS_BASE 22 +#define DS 23 +#define ES 24 +#define FS 25 +#define GS 26
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/setjmp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/setjmp.h new file mode 100644 index 0000000..29336e4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/setjmp.h
@@ -0,0 +1 @@ +typedef unsigned long long int __jmp_buf[9];
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/signal.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/signal.h new file mode 100644 index 0000000..26095e9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/signal.h
@@ -0,0 +1,129 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +#endif + +#ifdef _GNU_SOURCE +#define REG_R8 0 +#define REG_R9 1 +#define REG_R10 2 +#define REG_R11 3 +#define REG_R12 4 +#define REG_R13 5 +#define REG_R14 6 +#define REG_R15 7 +#define REG_RDI 8 +#define REG_RSI 9 +#define REG_RBP 10 +#define REG_RBX 11 +#define REG_RDX 12 +#define REG_RAX 13 +#define REG_RCX 14 +#define REG_RSP 15 +#define REG_RIP 16 +#define REG_EFL 17 +#define REG_CSGSFS 18 +#define REG_ERR 19 +#define REG_TRAPNO 20 +#define REG_OLDMASK 21 +#define REG_CR2 22 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef long long greg_t, gregset_t[23]; +typedef struct _fpstate { + unsigned short cwd, swd, ftw, fop; + unsigned long long rip, rdp; + unsigned mxcsr, mxcr_mask; + struct { + unsigned short significand[4], exponent, padding[3]; + } _st[8]; + struct { + unsigned element[4]; + } _xmm[16]; + unsigned padding[24]; +} * fpregset_t; +struct sigcontext { + unsigned long r8, r9, r10, r11, r12, r13, r14, r15; + unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags; + unsigned short cs, gs, fs, __pad0; + unsigned long err, trapno, oldmask, cr2; + struct _fpstate* fpstate; + unsigned long __reserved1[8]; +}; +typedef struct { + gregset_t gregs; + fpregset_t fpregs; + unsigned long long __reserved1[8]; +} mcontext_t; +#else +typedef struct { + unsigned long __space[32]; +} mcontext_t; +#endif + +struct sigaltstack { + void* ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct __ucontext* uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + unsigned long __fpregs_mem[64]; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/stat.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/stat.h new file mode 100644 index 0000000..9533ce5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/bits/x86_64/stat.h
@@ -0,0 +1,22 @@ +/* copied from kernel definition, but with padding replaced + * by the corresponding correctly-sized userspace types. */ + +struct stat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + unsigned int __pad0; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __unused1[3]; +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/byteswap.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/byteswap.h new file mode 100644 index 0000000..54d1c36 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/byteswap.h
@@ -0,0 +1,21 @@ +#ifndef SYSROOT_BYTESWAP_H_ +#define SYSROOT_BYTESWAP_H_ + +#include <features.h> +#include <stdint.h> + +static __inline uint16_t __bswap_16(uint16_t __x) { return (uint16_t)(__x << 8 | __x >> 8); } + +static __inline uint32_t __bswap_32(uint32_t __x) { + return __x >> 24 | ((__x >> 8) & 0xff00) | ((__x << 8) & 0xff0000) | __x << 24; +} + +static __inline uint64_t __bswap_64(uint64_t __x) { + return ((uint64_t)__bswap_32((uint32_t)__x)) << 32 | __bswap_32((uint32_t)(__x >> 32)); +} + +#define bswap_16(x) __bswap_16(x) +#define bswap_32(x) __bswap_32(x) +#define bswap_64(x) __bswap_64(x) + +#endif // SYSROOT_BYTESWAP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/complex.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/complex.h new file mode 100644 index 0000000..c4bb294 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/complex.h
@@ -0,0 +1,138 @@ +#ifndef SYSROOT_COMPLEX_H_ +#define SYSROOT_COMPLEX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define complex _Complex +#ifdef __GNUC__ +#define _Complex_I (__extension__(0.0f + 1.0fj)) +#else +#define _Complex_I (0.0f + 1.0fj) +#endif +#define I _Complex_I + +double complex cacos(double complex); +float complex cacosf(float complex); +long double complex cacosl(long double complex); + +double complex casin(double complex); +float complex casinf(float complex); +long double complex casinl(long double complex); + +double complex catan(double complex); +float complex catanf(float complex); +long double complex catanl(long double complex); + +double complex ccos(double complex); +float complex ccosf(float complex); +long double complex ccosl(long double complex); + +double complex csin(double complex); +float complex csinf(float complex); +long double complex csinl(long double complex); + +double complex ctan(double complex); +float complex ctanf(float complex); +long double complex ctanl(long double complex); + +double complex cacosh(double complex); +float complex cacoshf(float complex); +long double complex cacoshl(long double complex); + +double complex casinh(double complex); +float complex casinhf(float complex); +long double complex casinhl(long double complex); + +double complex catanh(double complex); +float complex catanhf(float complex); +long double complex catanhl(long double complex); + +double complex ccosh(double complex); +float complex ccoshf(float complex); +long double complex ccoshl(long double complex); + +double complex csinh(double complex); +float complex csinhf(float complex); +long double complex csinhl(long double complex); + +double complex ctanh(double complex); +float complex ctanhf(float complex); +long double complex ctanhl(long double complex); + +double complex cexp(double complex); +float complex cexpf(float complex); +long double complex cexpl(long double complex); + +double complex clog(double complex); +float complex clogf(float complex); +long double complex clogl(long double complex); + +double cabs(double complex); +float cabsf(float complex); +long double cabsl(long double complex); + +double complex cpow(double complex, double complex); +float complex cpowf(float complex, float complex); +long double complex cpowl(long double complex, long double complex); + +double complex csqrt(double complex); +float complex csqrtf(float complex); +long double complex csqrtl(long double complex); + +double carg(double complex); +float cargf(float complex); +long double cargl(long double complex); + +double cimag(double complex); +float cimagf(float complex); +long double cimagl(long double complex); + +double complex conj(double complex); +float complex conjf(float complex); +long double complex conjl(long double complex); + +double complex cproj(double complex); +float complex cprojf(float complex); +long double complex cprojl(long double complex); + +double creal(double complex); +float crealf(float complex); +long double creall(long double complex); + +#ifndef __cplusplus +#define __CIMAG(x, t) \ + (+(union { \ + _Complex t __z; \ + t __xy[2]; \ + }){(_Complex t)(x)} \ + .__xy[1]) + +#define creal(x) ((double)(x)) +#define crealf(x) ((float)(x)) +#define creall(x) ((long double)(x)) + +#define cimag(x) __CIMAG(x, double) +#define cimagf(x) __CIMAG(x, float) +#define cimagl(x) __CIMAG(x, long double) +#endif + +#if __STDC_VERSION__ >= 201112L +#if defined(_Imaginary_I) +#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I * (t)(y)) +#elif defined(__clang__) +#define __CMPLX(x, y, t) (+(_Complex t){(t)(x), (t)(y)}) +#else +#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y))) +#endif +#define CMPLX(x, y) __CMPLX(x, y, double) +#define CMPLXF(x, y) __CMPLX(x, y, float) +#define CMPLXL(x, y) __CMPLX(x, y, long double) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_COMPLEX_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/cpio.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/cpio.h new file mode 100644 index 0000000..21d069e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/cpio.h
@@ -0,0 +1,29 @@ +#ifndef SYSROOT_CPIO_H_ +#define SYSROOT_CPIO_H_ + +#define MAGIC "070707" + +#define C_IRUSR 000400 +#define C_IWUSR 000200 +#define C_IXUSR 000100 +#define C_IRGRP 000040 +#define C_IWGRP 000020 +#define C_IXGRP 000010 +#define C_IROTH 000004 +#define C_IWOTH 000002 +#define C_IXOTH 000001 + +#define C_ISUID 004000 +#define C_ISGID 002000 +#define C_ISVTX 001000 + +#define C_ISBLK 060000 +#define C_ISCHR 020000 +#define C_ISDIR 040000 +#define C_ISFIFO 010000 +#define C_ISSOCK 0140000 +#define C_ISLNK 0120000 +#define C_ISCTG 0110000 +#define C_ISREG 0100000 + +#endif // SYSROOT_CPIO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ctype.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ctype.h new file mode 100644 index 0000000..12be80d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ctype.h
@@ -0,0 +1,52 @@ +#ifndef SYSROOT_CTYPE_H_ +#define SYSROOT_CTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +int isalnum(int); +int isalpha(int); +int isblank(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); +int tolower(int); +int toupper(int); + +#ifndef __cplusplus +static __inline int __isspace(int _c) { return _c == ' ' || (unsigned)_c - '\t' < 5; } + +#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a) | 32) - 'a') < 26) +#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a) - '0') < 10) +#define islower(a) (0 ? islower(a) : ((unsigned)(a) - 'a') < 26) +#define isupper(a) (0 ? isupper(a) : ((unsigned)(a) - 'A') < 26) +#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f) +#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e) +#define isspace(a) __isspace(a) +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +int isascii(int); +int toascii(int); +#define _tolower(a) ((a) | 0x20) +#define _toupper(a) ((a)&0x5f) +#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_CTYPE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/dirent.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/dirent.h new file mode 100644 index 0000000..4542825 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/dirent.h
@@ -0,0 +1,67 @@ +#ifndef SYSROOT_DIRENT_H_ +#define SYSROOT_DIRENT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_ino_t +#define __NEED_off_t +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define __NEED_size_t +#endif + +#include <bits/alltypes.h> + +typedef struct __dirstream DIR; + +struct dirent { + ino_t d_ino; + off_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; + +#define d_fileno d_ino + +int closedir(DIR*); +DIR* fdopendir(int); +DIR* opendir(const char*); +struct dirent* readdir(DIR*); +int readdir_r(DIR* __restrict, struct dirent* __restrict, struct dirent** __restrict); +void rewinddir(DIR*); +void seekdir(DIR*, long); +long telldir(DIR*); +int dirfd(DIR*); + +int alphasort(const struct dirent**, const struct dirent**); +int scandir(const char*, struct dirent***, int (*)(const struct dirent*), + int (*)(const struct dirent**, const struct dirent**)); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#define IFTODT(x) ((x) >> 12 & 017) +#define DTTOIF(x) ((x) << 12) +int getdents(int, struct dirent*, size_t); +#endif + +#ifdef _GNU_SOURCE +int versionsort(const struct dirent**, const struct dirent**); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_DIRENT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/dlfcn.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/dlfcn.h new file mode 100644 index 0000000..ff069c9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/dlfcn.h
@@ -0,0 +1,42 @@ +#ifndef SYSROOT_DLFCN_H_ +#define SYSROOT_DLFCN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define RTLD_LAZY 1 +#define RTLD_NOW 2 +#define RTLD_NOLOAD 4 +#define RTLD_NODELETE 4096 +#define RTLD_GLOBAL 256 +#define RTLD_LOCAL 0 + +#define RTLD_NEXT ((void*)-1) +#define RTLD_DEFAULT ((void*)0) + +#define RTLD_DI_LINKMAP 2 + +int dlclose(void*); +char* dlerror(void); +void* dlopen(const char*, int); +void* dlsym(void* __restrict, const char* __restrict); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef struct { + const char* dli_fname; + void* dli_fbase; + const char* dli_sname; + void* dli_saddr; +} Dl_info; +int dladdr(const void*, Dl_info*); +int dlinfo(void*, int, void*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_DLFCN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/elf.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/elf.h new file mode 100644 index 0000000..88a35f0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/elf.h
@@ -0,0 +1,2585 @@ +#ifndef SYSROOT_ELF_H_ +#define SYSROOT_ELF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; + +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; + +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; + +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; + +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; + +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + +#define EI_NIDENT (16) + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +#define EI_MAG0 0 +#define ELFMAG0 0x7f + +#define EI_MAG1 1 +#define ELFMAG1 'E' + +#define EI_MAG2 2 +#define ELFMAG2 'L' + +#define EI_MAG3 3 +#define ELFMAG3 'F' + +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 +#define ELFCLASSNONE 0 +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define EI_DATA 5 +#define ELFDATANONE 0 +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 +#define ELFDATANUM 3 + +#define EI_VERSION 6 + +#define EI_OSABI 7 +#define ELFOSABI_NONE 0 +#define ELFOSABI_SYSV 0 +#define ELFOSABI_HPUX 1 +#define ELFOSABI_NETBSD 2 +#define ELFOSABI_LINUX 3 +#define ELFOSABI_GNU 3 +#define ELFOSABI_SOLARIS 6 +#define ELFOSABI_AIX 7 +#define ELFOSABI_IRIX 8 +#define ELFOSABI_FREEBSD 9 +#define ELFOSABI_TRU64 10 +#define ELFOSABI_MODESTO 11 +#define ELFOSABI_OPENBSD 12 +#define ELFOSABI_ARM 97 +#define ELFOSABI_STANDALONE 255 + +#define EI_ABIVERSION 8 + +#define EI_PAD 9 + +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_NUM 5 +#define ET_LOOS 0xfe00 +#define ET_HIOS 0xfeff +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_860 7 +#define EM_MIPS 8 +#define EM_S370 9 +#define EM_MIPS_RS3_LE 10 + +#define EM_PARISC 15 +#define EM_VPP500 17 +#define EM_SPARC32PLUS 18 +#define EM_960 19 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 + +#define EM_V800 36 +#define EM_FR20 37 +#define EM_RH32 38 +#define EM_RCE 39 +#define EM_ARM 40 +#define EM_FAKE_ALPHA 41 +#define EM_SH 42 +#define EM_SPARCV9 43 +#define EM_TRICORE 44 +#define EM_ARC 45 +#define EM_H8_300 46 +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_H8_500 49 +#define EM_IA_64 50 +#define EM_MIPS_X 51 +#define EM_COLDFIRE 52 +#define EM_68HC12 53 +#define EM_MMA 54 +#define EM_PCP 55 +#define EM_NCPU 56 +#define EM_NDR1 57 +#define EM_STARCORE 58 +#define EM_ME16 59 +#define EM_ST100 60 +#define EM_TINYJ 61 +#define EM_X86_64 62 +#define EM_PDSP 63 + +#define EM_FX66 66 +#define EM_ST9PLUS 67 +#define EM_ST7 68 +#define EM_68HC16 69 +#define EM_68HC11 70 +#define EM_68HC08 71 +#define EM_68HC05 72 +#define EM_SVX 73 +#define EM_ST19 74 +#define EM_VAX 75 +#define EM_CRIS 76 +#define EM_JAVELIN 77 +#define EM_FIREPATH 78 +#define EM_ZSP 79 +#define EM_MMIX 80 +#define EM_HUANY 81 +#define EM_PRISM 82 +#define EM_AVR 83 +#define EM_FR30 84 +#define EM_D10V 85 +#define EM_D30V 86 +#define EM_V850 87 +#define EM_M32R 88 +#define EM_MN10300 89 +#define EM_MN10200 90 +#define EM_PJ 91 +#define EM_OR1K 92 +#define EM_ARC_A5 93 +#define EM_XTENSA 94 +#define EM_AARCH64 183 +#define EM_TILEPRO 188 +#define EM_MICROBLAZE 189 +#define EM_TILEGX 191 +#define EM_NUM 192 +#define EM_ALPHA 0x9026 + +#define EV_NONE 0 +#define EV_CURRENT 1 +#define EV_NUM 2 + +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +typedef struct { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_BEFORE 0xff00 + +#define SHN_AFTER 0xff01 + +#define SHN_HIPROC 0xff1f +#define SHN_LOOS 0xff20 +#define SHN_HIOS 0xff3f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_XINDEX 0xffff +#define SHN_HIRESERVE 0xffff + +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_INIT_ARRAY 14 +#define SHT_FINI_ARRAY 15 +#define SHT_PREINIT_ARRAY 16 +#define SHT_GROUP 17 +#define SHT_SYMTAB_SHNDX 18 +#define SHT_NUM 19 +#define SHT_LOOS 0x60000000 +#define SHT_GNU_ATTRIBUTES 0x6ffffff5 +#define SHT_GNU_HASH 0x6ffffff6 +#define SHT_GNU_LIBLIST 0x6ffffff7 +#define SHT_CHECKSUM 0x6ffffff8 +#define SHT_LOSUNW 0x6ffffffa +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd +#define SHT_GNU_verneed 0x6ffffffe +#define SHT_GNU_versym 0x6fffffff +#define SHT_HISUNW 0x6fffffff +#define SHT_HIOS 0x6fffffff +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0x8fffffff + +#define SHF_WRITE (1 << 0) +#define SHF_ALLOC (1 << 1) +#define SHF_EXECINSTR (1 << 2) +#define SHF_MERGE (1 << 4) +#define SHF_STRINGS (1 << 5) +#define SHF_INFO_LINK (1 << 6) +#define SHF_LINK_ORDER (1 << 7) +#define SHF_OS_NONCONFORMING (1 << 8) + +#define SHF_GROUP (1 << 9) +#define SHF_TLS (1 << 10) +#define SHF_MASKOS 0x0ff00000 +#define SHF_MASKPROC 0xf0000000 +#define SHF_ORDERED (1 << 30) +#define SHF_EXCLUDE (1U << 31) + +#define GRP_COMDAT 0x1 + +typedef struct { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Section st_shndx; +} Elf32_Sym; + +typedef struct { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Section st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; + +typedef struct { + Elf32_Half si_boundto; + Elf32_Half si_flags; +} Elf32_Syminfo; + +typedef struct { + Elf64_Half si_boundto; + Elf64_Half si_flags; +} Elf64_Syminfo; + +#define SYMINFO_BT_SELF 0xffff +#define SYMINFO_BT_PARENT 0xfffe +#define SYMINFO_BT_LOWRESERVE 0xff00 + +#define SYMINFO_FLG_DIRECT 0x0001 +#define SYMINFO_FLG_PASSTHRU 0x0002 +#define SYMINFO_FLG_COPY 0x0004 +#define SYMINFO_FLG_LAZYLOAD 0x0008 + +#define SYMINFO_NONE 0 +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + +#define ELF32_ST_BIND(val) (((unsigned char)(val)) >> 4) +#define ELF32_ST_TYPE(val) ((val)&0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type)&0xf)) + +#define ELF64_ST_BIND(val) ELF32_ST_BIND(val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE(val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO((bind), (type)) + +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_NUM 3 +#define STB_LOOS 10 +#define STB_GNU_UNIQUE 10 +#define STB_HIOS 12 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 +#define STT_NUM 7 +#define STT_LOOS 10 +#define STT_GNU_IFUNC 10 +#define STT_HIOS 12 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + +#define STN_UNDEF 0 + +#define ELF32_ST_VISIBILITY(o) ((o)&0x03) +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY(o) + +#define STV_DEFAULT 0 +#define STV_INTERNAL 1 +#define STV_HIDDEN 2 +#define STV_PROTECTED 3 + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; +} Elf64_Rel; + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +} Elf64_Rela; + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val)&0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type)&0xff)) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i)&0xffffffff) +#define ELF64_R_INFO(sym, type) ((((Elf64_Xword)(sym)) << 32) + (type)) + +typedef struct { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 +#define PT_NUM 8 +#define PT_LOOS 0x60000000 +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa +#define PT_SUNWSTACK 0x6ffffffb +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff + +#define PN_XNUM 0xffff + +#define PF_X (1 << 0) +#define PF_W (1 << 1) +#define PF_R (1 << 2) +#define PF_MASKOS 0x0ff00000 +#define PF_MASKPROC 0xf0000000 + +#define NT_PRSTATUS 1 +#define NT_FPREGSET 2 +#define NT_PRPSINFO 3 +#define NT_PRXREG 4 +#define NT_TASKSTRUCT 4 +#define NT_PLATFORM 5 +#define NT_AUXV 6 +#define NT_GWINDOWS 7 +#define NT_ASRS 8 +#define NT_PSTATUS 10 +#define NT_PSINFO 13 +#define NT_PRCRED 14 +#define NT_UTSNAME 15 +#define NT_LWPSTATUS 16 +#define NT_LWPSINFO 17 +#define NT_PRFPXREG 20 +#define NT_SIGINFO 0x53494749 +#define NT_FILE 0x46494c45 +#define NT_PRXFPREG 0x46e62b7f +#define NT_PPC_VMX 0x100 +#define NT_PPC_SPE 0x101 +#define NT_PPC_VSX 0x102 +#define NT_386_TLS 0x200 +#define NT_386_IOPERM 0x201 +#define NT_X86_XSTATE 0x202 +#define NT_S390_HIGH_GPRS 0x300 +#define NT_S390_TIMER 0x301 +#define NT_S390_TODCMP 0x302 +#define NT_S390_TODPREG 0x303 +#define NT_S390_CTRS 0x304 +#define NT_S390_PREFIX 0x305 +#define NT_S390_LAST_BREAK 0x306 +#define NT_S390_SYSTEM_CALL 0x307 +#define NT_S390_TDB 0x308 +#define NT_ARM_VFP 0x400 +#define NT_ARM_TLS 0x401 +#define NT_ARM_HW_BREAK 0x402 +#define NT_ARM_HW_WATCH 0x403 +#define NT_METAG_CBUF 0x500 +#define NT_METAG_RPIPE 0x501 +#define NT_METAG_TLS 0x502 +#define NT_VERSION 1 + +typedef struct { + Elf32_Sword d_tag; + union { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Sxword d_tag; + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_BIND_NOW 24 +#define DT_INIT_ARRAY 25 +#define DT_FINI_ARRAY 26 +#define DT_INIT_ARRAYSZ 27 +#define DT_FINI_ARRAYSZ 28 +#define DT_RUNPATH 29 +#define DT_FLAGS 30 +#define DT_ENCODING 32 +#define DT_PREINIT_ARRAY 32 +#define DT_PREINIT_ARRAYSZ 33 +#define DT_RELRSZ 35 +#define DT_RELR 36 +#define DT_RELRENT 37 +#define DT_NUM 38 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff +#define DT_PROCNUM DT_MIPS_NUM + +#define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 +#define DT_CHECKSUM 0x6ffffdf8 +#define DT_PLTPADSZ 0x6ffffdf9 +#define DT_MOVEENT 0x6ffffdfa +#define DT_MOVESZ 0x6ffffdfb +#define DT_FEATURE_1 0x6ffffdfc +#define DT_POSFLAG_1 0x6ffffdfd + +#define DT_SYMINSZ 0x6ffffdfe +#define DT_SYMINENT 0x6ffffdff +#define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) +#define DT_VALNUM 12 + +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 +#define DT_TLSDESC_PLT 0x6ffffef6 +#define DT_TLSDESC_GOT 0x6ffffef7 +#define DT_GNU_CONFLICT 0x6ffffef8 +#define DT_GNU_LIBLIST 0x6ffffef9 +#define DT_CONFIG 0x6ffffefa +#define DT_DEPAUDIT 0x6ffffefb +#define DT_AUDIT 0x6ffffefc +#define DT_PLTPAD 0x6ffffefd +#define DT_MOVETAB 0x6ffffefe +#define DT_SYMINFO 0x6ffffeff +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) +#define DT_ADDRNUM 11 + +#define DT_VERSYM 0x6ffffff0 + +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa + +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc + +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe + +#define DT_VERNEEDNUM 0x6fffffff +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) +#define DT_VERSIONTAGNUM 16 + +#define DT_AUXILIARY 0x7ffffffd +#define DT_FILTER 0x7fffffff +#define DT_EXTRATAGIDX(tag) ((Elf32_Word) - ((Elf32_Sword)(tag) << 1 >> 1) - 1) +#define DT_EXTRANUM 3 + +#define DF_ORIGIN 0x00000001 +#define DF_SYMBOLIC 0x00000002 +#define DF_TEXTREL 0x00000004 +#define DF_BIND_NOW 0x00000008 +#define DF_STATIC_TLS 0x00000010 + +#define DF_1_NOW 0x00000001 +#define DF_1_GLOBAL 0x00000002 +#define DF_1_GROUP 0x00000004 +#define DF_1_NODELETE 0x00000008 +#define DF_1_LOADFLTR 0x00000010 +#define DF_1_INITFIRST 0x00000020 +#define DF_1_NOOPEN 0x00000040 +#define DF_1_ORIGIN 0x00000080 +#define DF_1_DIRECT 0x00000100 +#define DF_1_TRANS 0x00000200 +#define DF_1_INTERPOSE 0x00000400 +#define DF_1_NODEFLIB 0x00000800 +#define DF_1_NODUMP 0x00001000 +#define DF_1_CONFALT 0x00002000 +#define DF_1_ENDFILTEE 0x00004000 +#define DF_1_DISPRELDNE 0x00008000 +#define DF_1_DISPRELPND 0x00010000 +#define DF_1_NODIRECT 0x00020000 +#define DF_1_IGNMULDEF 0x00040000 +#define DF_1_NOKSYMS 0x00080000 +#define DF_1_NOHDR 0x00100000 +#define DF_1_EDITED 0x00200000 +#define DF_1_NORELOC 0x00400000 +#define DF_1_SYMINTPOSE 0x00800000 +#define DF_1_GLOBAUDIT 0x01000000 +#define DF_1_SINGLETON 0x02000000 + +#define DTF_1_PARINIT 0x00000001 +#define DTF_1_CONFEXP 0x00000002 + +#define DF_P1_LAZYLOAD 0x00000001 +#define DF_P1_GROUPPERM 0x00000002 + +typedef struct { + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + +#define VER_DEF_NONE 0 +#define VER_DEF_CURRENT 1 +#define VER_DEF_NUM 2 + +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 +#define VER_NDX_LORESERVE 0xff00 +#define VER_NDX_ELIMINATE 0xff01 + +typedef struct { + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + +typedef struct { + Elf32_Half vn_version; + Elf32_Half vn_cnt; + Elf32_Word vn_file; + Elf32_Word vn_aux; + Elf32_Word vn_next; +} Elf32_Verneed; + +typedef struct { + Elf64_Half vn_version; + Elf64_Half vn_cnt; + Elf64_Word vn_file; + Elf64_Word vn_aux; + Elf64_Word vn_next; +} Elf64_Verneed; + +#define VER_NEED_NONE 0 +#define VER_NEED_CURRENT 1 +#define VER_NEED_NUM 2 + +typedef struct { + Elf32_Word vna_hash; + Elf32_Half vna_flags; + Elf32_Half vna_other; + Elf32_Word vna_name; + Elf32_Word vna_next; +} Elf32_Vernaux; + +typedef struct { + Elf64_Word vna_hash; + Elf64_Half vna_flags; + Elf64_Half vna_other; + Elf64_Word vna_name; + Elf64_Word vna_next; +} Elf64_Vernaux; + +#define VER_FLG_WEAK 0x2 + +typedef struct { + uint32_t a_type; + union { + uint32_t a_val; + } a_un; +} Elf32_auxv_t; + +typedef struct { + uint64_t a_type; + union { + uint64_t a_val; + } a_un; +} Elf64_auxv_t; + +#define AT_NULL 0 +#define AT_IGNORE 1 +#define AT_EXECFD 2 +#define AT_PHDR 3 +#define AT_PHENT 4 +#define AT_PHNUM 5 +#define AT_PAGESZ 6 +#define AT_BASE 7 +#define AT_FLAGS 8 +#define AT_ENTRY 9 +#define AT_NOTELF 10 +#define AT_UID 11 +#define AT_EUID 12 +#define AT_GID 13 +#define AT_EGID 14 +#define AT_CLKTCK 17 + +#define AT_PLATFORM 15 +#define AT_HWCAP 16 + +#define AT_FPUCW 18 + +#define AT_DCACHEBSIZE 19 +#define AT_ICACHEBSIZE 20 +#define AT_UCACHEBSIZE 21 + +#define AT_IGNOREPPC 22 + +#define AT_SECURE 23 + +#define AT_BASE_PLATFORM 24 + +#define AT_RANDOM 25 + +#define AT_HWCAP2 26 + +#define AT_EXECFN 31 + +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 + +typedef struct { + Elf32_Word n_namesz; + Elf32_Word n_descsz; + Elf32_Word n_type; +} Elf32_Nhdr; + +typedef struct { + Elf64_Word n_namesz; + Elf64_Word n_descsz; + Elf64_Word n_type; +} Elf64_Nhdr; + +#define ELF_NOTE_SOLARIS "SUNW Solaris" + +#define ELF_NOTE_GNU "GNU" + +#define ELF_NOTE_PAGESIZE_HINT 1 + +#define NT_GNU_ABI_TAG 1 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG + +#define ELF_NOTE_OS_LINUX 0 +#define ELF_NOTE_OS_GNU 1 +#define ELF_NOTE_OS_SOLARIS2 2 +#define ELF_NOTE_OS_FREEBSD 3 + +#define NT_GNU_BUILD_ID 3 +#define NT_GNU_GOLD_VERSION 4 + +typedef struct { + Elf32_Xword m_value; + Elf32_Word m_info; + Elf32_Word m_poffset; + Elf32_Half m_repeat; + Elf32_Half m_stride; +} Elf32_Move; + +typedef struct { + Elf64_Xword m_value; + Elf64_Xword m_info; + Elf64_Xword m_poffset; + Elf64_Half m_repeat; + Elf64_Half m_stride; +} Elf64_Move; + +#define ELF32_M_SYM(info) ((info) >> 8) +#define ELF32_M_SIZE(info) ((unsigned char)(info)) +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) + +#define ELF64_M_SYM(info) ELF32_M_SYM(info) +#define ELF64_M_SIZE(info) ELF32_M_SIZE(info) +#define ELF64_M_INFO(sym, size) ELF32_M_INFO(sym, size) + +#define EF_CPU32 0x00810000 + +#define R_68K_NONE 0 +#define R_68K_32 1 +#define R_68K_16 2 +#define R_68K_8 3 +#define R_68K_PC32 4 +#define R_68K_PC16 5 +#define R_68K_PC8 6 +#define R_68K_GOT32 7 +#define R_68K_GOT16 8 +#define R_68K_GOT8 9 +#define R_68K_GOT32O 10 +#define R_68K_GOT16O 11 +#define R_68K_GOT8O 12 +#define R_68K_PLT32 13 +#define R_68K_PLT16 14 +#define R_68K_PLT8 15 +#define R_68K_PLT32O 16 +#define R_68K_PLT16O 17 +#define R_68K_PLT8O 18 +#define R_68K_COPY 19 +#define R_68K_GLOB_DAT 20 +#define R_68K_JMP_SLOT 21 +#define R_68K_RELATIVE 22 +#define R_68K_NUM 23 + +#define R_386_NONE 0 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_386_GOT32 3 +#define R_386_PLT32 4 +#define R_386_COPY 5 +#define R_386_GLOB_DAT 6 +#define R_386_JMP_SLOT 7 +#define R_386_RELATIVE 8 +#define R_386_GOTOFF 9 +#define R_386_GOTPC 10 +#define R_386_32PLT 11 +#define R_386_TLS_TPOFF 14 +#define R_386_TLS_IE 15 +#define R_386_TLS_GOTIE 16 +#define R_386_TLS_LE 17 +#define R_386_TLS_GD 18 +#define R_386_TLS_LDM 19 +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_TLS_GD_32 24 +#define R_386_TLS_GD_PUSH 25 +#define R_386_TLS_GD_CALL 26 +#define R_386_TLS_GD_POP 27 +#define R_386_TLS_LDM_32 28 +#define R_386_TLS_LDM_PUSH 29 +#define R_386_TLS_LDM_CALL 30 +#define R_386_TLS_LDM_POP 31 +#define R_386_TLS_LDO_32 32 +#define R_386_TLS_IE_32 33 +#define R_386_TLS_LE_32 34 +#define R_386_TLS_DTPMOD32 35 +#define R_386_TLS_DTPOFF32 36 +#define R_386_TLS_TPOFF32 37 +#define R_386_SIZE32 38 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 +#define R_386_IRELATIVE 42 +#define R_386_NUM 43 + +#define STT_SPARC_REGISTER 13 + +#define EF_SPARCV9_MM 3 +#define EF_SPARCV9_TSO 0 +#define EF_SPARCV9_PSO 1 +#define EF_SPARCV9_RMO 2 +#define EF_SPARC_LEDATA 0x800000 +#define EF_SPARC_EXT_MASK 0xFFFF00 +#define EF_SPARC_32PLUS 0x000100 +#define EF_SPARC_SUN_US1 0x000200 +#define EF_SPARC_HAL_R1 0x000400 +#define EF_SPARC_SUN_US3 0x000800 + +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 + +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 +#define R_SPARC_GOTDATA_HIX22 80 +#define R_SPARC_GOTDATA_LOX10 81 +#define R_SPARC_GOTDATA_OP_HIX22 82 +#define R_SPARC_GOTDATA_OP_LOX10 83 +#define R_SPARC_GOTDATA_OP 84 +#define R_SPARC_H34 85 +#define R_SPARC_SIZE32 86 +#define R_SPARC_SIZE64 87 +#define R_SPARC_GNU_VTINHERIT 250 +#define R_SPARC_GNU_VTENTRY 251 +#define R_SPARC_REV32 252 + +#define R_SPARC_NUM 253 + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM 2 + +#define EF_MIPS_NOREORDER 1 +#define EF_MIPS_PIC 2 +#define EF_MIPS_CPIC 4 +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_NAN2008 1024 +#define EF_MIPS_ARCH 0xf0000000 + +#define EF_MIPS_ARCH_1 0x00000000 +#define EF_MIPS_ARCH_2 0x10000000 +#define EF_MIPS_ARCH_3 0x20000000 +#define EF_MIPS_ARCH_4 0x30000000 +#define EF_MIPS_ARCH_5 0x40000000 +#define EF_MIPS_ARCH_32 0x50000000 +#define EF_MIPS_ARCH_64 0x60000000 +#define EF_MIPS_ARCH_32R2 0x70000000 +#define EF_MIPS_ARCH_64R2 0x80000000 + +#define E_MIPS_ARCH_1 0x00000000 +#define E_MIPS_ARCH_2 0x10000000 +#define E_MIPS_ARCH_3 0x20000000 +#define E_MIPS_ARCH_4 0x30000000 +#define E_MIPS_ARCH_5 0x40000000 +#define E_MIPS_ARCH_32 0x50000000 +#define E_MIPS_ARCH_64 0x60000000 + +#define SHN_MIPS_ACOMMON 0xff00 +#define SHN_MIPS_TEXT 0xff01 +#define SHN_MIPS_DATA 0xff02 +#define SHN_MIPS_SCOMMON 0xff03 +#define SHN_MIPS_SUNDEFINED 0xff04 + +#define SHT_MIPS_LIBLIST 0x70000000 +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 +#define SHT_MIPS_GPTAB 0x70000003 +#define SHT_MIPS_UCODE 0x70000004 +#define SHT_MIPS_DEBUG 0x70000005 +#define SHT_MIPS_REGINFO 0x70000006 +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + +#define SHF_MIPS_GPREL 0x10000000 +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + +#define STB_MIPS_SPLIT_COMMON 13 + +typedef union { + struct { + Elf32_Word gt_current_g_value; + Elf32_Word gt_unused; + } gt_header; + struct { + Elf32_Word gt_g_value; + Elf32_Word gt_bytes; + } gt_entry; +} Elf32_gptab; + +typedef struct { + Elf32_Word ri_gprmask; + Elf32_Word ri_cprmask[4]; + Elf32_Sword ri_gp_value; +} Elf32_RegInfo; + +typedef struct { + unsigned char kind; + + unsigned char size; + Elf32_Section section; + + Elf32_Word info; +} Elf_Options; + +#define ODK_NULL 0 +#define ODK_REGINFO 1 +#define ODK_EXCEPTIONS 2 +#define ODK_PAD 3 +#define ODK_HWPATCH 4 +#define ODK_FILL 5 +#define ODK_TAGS 6 +#define ODK_HWAND 7 +#define ODK_HWOR 8 + +#define OEX_FPU_MIN 0x1f +#define OEX_FPU_MAX 0x1f00 +#define OEX_PAGE0 0x10000 +#define OEX_SMM 0x20000 +#define OEX_FPDBUG 0x40000 +#define OEX_PRECISEFP OEX_FPDBUG +#define OEX_DISMISS 0x80000 + +#define OEX_FPU_INVAL 0x10 +#define OEX_FPU_DIV0 0x08 +#define OEX_FPU_OFLO 0x04 +#define OEX_FPU_UFLO 0x02 +#define OEX_FPU_INEX 0x01 + +#define OHW_R4KEOP 0x1 +#define OHW_R8KPFETCH 0x2 +#define OHW_R5KEOP 0x4 +#define OHW_R5KCVTL 0x8 + +#define OPAD_PREFIX 0x1 +#define OPAD_POSTFIX 0x2 +#define OPAD_SYMBOL 0x4 + +typedef struct { + Elf32_Word hwp_flags1; + Elf32_Word hwp_flags2; +} Elf_Options_Hw; + +#define OHWA0_R4KEOP_CHECKED 0x00000001 +#define OHWA1_R4KEOP_CLEAN 0x00000002 + +#define R_MIPS_NONE 0 +#define R_MIPS_16 1 +#define R_MIPS_32 2 +#define R_MIPS_REL32 3 +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_GPREL16 7 +#define R_MIPS_LITERAL 8 +#define R_MIPS_GOT16 9 +#define R_MIPS_PC16 10 +#define R_MIPS_CALL16 11 +#define R_MIPS_GPREL32 12 + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 +#define R_MIPS_TLS_DTPREL32 39 +#define R_MIPS_TLS_DTPMOD64 40 +#define R_MIPS_TLS_DTPREL64 41 +#define R_MIPS_TLS_GD 42 +#define R_MIPS_TLS_LDM 43 +#define R_MIPS_TLS_DTPREL_HI16 44 +#define R_MIPS_TLS_DTPREL_LO16 45 +#define R_MIPS_TLS_GOTTPREL 46 +#define R_MIPS_TLS_TPREL32 47 +#define R_MIPS_TLS_TPREL64 48 +#define R_MIPS_TLS_TPREL_HI16 49 +#define R_MIPS_TLS_TPREL_LO16 50 +#define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 + +#define R_MIPS_NUM 128 + +#define PT_MIPS_REGINFO 0x70000000 +#define PT_MIPS_RTPROC 0x70000001 +#define PT_MIPS_OPTIONS 0x70000002 + +#define PF_MIPS_LOCAL 0x10000000 + +#define DT_MIPS_RLD_VERSION 0x70000001 +#define DT_MIPS_TIME_STAMP 0x70000002 +#define DT_MIPS_ICHECKSUM 0x70000003 +#define DT_MIPS_IVERSION 0x70000004 +#define DT_MIPS_FLAGS 0x70000005 +#define DT_MIPS_BASE_ADDRESS 0x70000006 +#define DT_MIPS_MSYM 0x70000007 +#define DT_MIPS_CONFLICT 0x70000008 +#define DT_MIPS_LIBLIST 0x70000009 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a +#define DT_MIPS_CONFLICTNO 0x7000000b +#define DT_MIPS_LIBLISTNO 0x70000010 +#define DT_MIPS_SYMTABNO 0x70000011 +#define DT_MIPS_UNREFEXTNO 0x70000012 +#define DT_MIPS_GOTSYM 0x70000013 +#define DT_MIPS_HIPAGENO 0x70000014 +#define DT_MIPS_RLD_MAP 0x70000016 +#define DT_MIPS_DELTA_CLASS 0x70000017 +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 + +#define DT_MIPS_DELTA_INSTANCE 0x70000019 +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a + +#define DT_MIPS_DELTA_RELOC 0x7000001b +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c + +#define DT_MIPS_DELTA_SYM 0x7000001d + +#define DT_MIPS_DELTA_SYM_NO 0x7000001e + +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 + +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 + +#define DT_MIPS_CXX_FLAGS 0x70000022 +#define DT_MIPS_PIXIE_INIT 0x70000023 +#define DT_MIPS_SYMBOL_LIB 0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS 0x70000029 +#define DT_MIPS_INTERFACE 0x7000002a +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d + +#define DT_MIPS_PERF_SUFFIX 0x7000002e + +#define DT_MIPS_COMPACT_SIZE 0x7000002f +#define DT_MIPS_GP_VALUE 0x70000030 +#define DT_MIPS_AUX_DYNAMIC 0x70000031 + +#define DT_MIPS_PLTGOT 0x70000032 + +#define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_NUM 0x35 + +#define RHF_NONE 0 +#define RHF_QUICKSTART (1 << 0) +#define RHF_NOTPOT (1 << 1) +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) +#define RHF_NO_MOVE (1 << 3) +#define RHF_SGI_ONLY (1 << 4) +#define RHF_GUARANTEE_INIT (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS (1 << 6) +#define RHF_GUARANTEE_START_INIT (1 << 7) +#define RHF_PIXIE (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD (1 << 9) +#define RHF_REQUICKSTART (1 << 10) +#define RHF_REQUICKSTARTED (1 << 11) +#define RHF_CORD (1 << 12) +#define RHF_NO_UNRES_UNDEF (1 << 13) +#define RHF_RLD_ORDER_SAFE (1 << 14) + +typedef struct { + Elf32_Word l_name; + Elf32_Word l_time_stamp; + Elf32_Word l_checksum; + Elf32_Word l_version; + Elf32_Word l_flags; +} Elf32_Lib; + +typedef struct { + Elf64_Word l_name; + Elf64_Word l_time_stamp; + Elf64_Word l_checksum; + Elf64_Word l_version; + Elf64_Word l_flags; +} Elf64_Lib; + +#define LL_NONE 0 +#define LL_EXACT_MATCH (1 << 0) +#define LL_IGNORE_INT_VER (1 << 1) +#define LL_REQUIRE_MINOR (1 << 2) +#define LL_EXPORTS (1 << 3) +#define LL_DELAY_LOAD (1 << 4) +#define LL_DELTA (1 << 5) + +typedef Elf32_Addr Elf32_Conflict; + +#define EF_PARISC_TRAPNIL 0x00010000 +#define EF_PARISC_EXT 0x00020000 +#define EF_PARISC_LSB 0x00040000 +#define EF_PARISC_WIDE 0x00080000 +#define EF_PARISC_NO_KABP 0x00100000 + +#define EF_PARISC_LAZYSWAP 0x00400000 +#define EF_PARISC_ARCH 0x0000ffff + +#define EFA_PARISC_1_0 0x020b +#define EFA_PARISC_1_1 0x0210 +#define EFA_PARISC_2_0 0x0214 + +#define SHN_PARISC_ANSI_COMMON 0xff00 + +#define SHN_PARISC_HUGE_COMMON 0xff01 + +#define SHT_PARISC_EXT 0x70000000 +#define SHT_PARISC_UNWIND 0x70000001 +#define SHT_PARISC_DOC 0x70000002 + +#define SHF_PARISC_SHORT 0x20000000 +#define SHF_PARISC_HUGE 0x40000000 +#define SHF_PARISC_SBP 0x80000000 + +#define STT_PARISC_MILLICODE 13 + +#define STT_HP_OPAQUE (STT_LOOS + 0x1) +#define STT_HP_STUB (STT_LOOS + 0x2) + +#define R_PARISC_NONE 0 +#define R_PARISC_DIR32 1 +#define R_PARISC_DIR21L 2 +#define R_PARISC_DIR17R 3 +#define R_PARISC_DIR17F 4 +#define R_PARISC_DIR14R 6 +#define R_PARISC_PCREL32 9 +#define R_PARISC_PCREL21L 10 +#define R_PARISC_PCREL17R 11 +#define R_PARISC_PCREL17F 12 +#define R_PARISC_PCREL14R 14 +#define R_PARISC_DPREL21L 18 +#define R_PARISC_DPREL14R 22 +#define R_PARISC_GPREL21L 26 +#define R_PARISC_GPREL14R 30 +#define R_PARISC_LTOFF21L 34 +#define R_PARISC_LTOFF14R 38 +#define R_PARISC_SECREL32 41 +#define R_PARISC_SEGBASE 48 +#define R_PARISC_SEGREL32 49 +#define R_PARISC_PLTOFF21L 50 +#define R_PARISC_PLTOFF14R 54 +#define R_PARISC_LTOFF_FPTR32 57 +#define R_PARISC_LTOFF_FPTR21L 58 +#define R_PARISC_LTOFF_FPTR14R 62 +#define R_PARISC_FPTR64 64 +#define R_PARISC_PLABEL32 65 +#define R_PARISC_PLABEL21L 66 +#define R_PARISC_PLABEL14R 70 +#define R_PARISC_PCREL64 72 +#define R_PARISC_PCREL22F 74 +#define R_PARISC_PCREL14WR 75 +#define R_PARISC_PCREL14DR 76 +#define R_PARISC_PCREL16F 77 +#define R_PARISC_PCREL16WF 78 +#define R_PARISC_PCREL16DF 79 +#define R_PARISC_DIR64 80 +#define R_PARISC_DIR14WR 83 +#define R_PARISC_DIR14DR 84 +#define R_PARISC_DIR16F 85 +#define R_PARISC_DIR16WF 86 +#define R_PARISC_DIR16DF 87 +#define R_PARISC_GPREL64 88 +#define R_PARISC_GPREL14WR 91 +#define R_PARISC_GPREL14DR 92 +#define R_PARISC_GPREL16F 93 +#define R_PARISC_GPREL16WF 94 +#define R_PARISC_GPREL16DF 95 +#define R_PARISC_LTOFF64 96 +#define R_PARISC_LTOFF14WR 99 +#define R_PARISC_LTOFF14DR 100 +#define R_PARISC_LTOFF16F 101 +#define R_PARISC_LTOFF16WF 102 +#define R_PARISC_LTOFF16DF 103 +#define R_PARISC_SECREL64 104 +#define R_PARISC_SEGREL64 112 +#define R_PARISC_PLTOFF14WR 115 +#define R_PARISC_PLTOFF14DR 116 +#define R_PARISC_PLTOFF16F 117 +#define R_PARISC_PLTOFF16WF 118 +#define R_PARISC_PLTOFF16DF 119 +#define R_PARISC_LTOFF_FPTR64 120 +#define R_PARISC_LTOFF_FPTR14WR 123 +#define R_PARISC_LTOFF_FPTR14DR 124 +#define R_PARISC_LTOFF_FPTR16F 125 +#define R_PARISC_LTOFF_FPTR16WF 126 +#define R_PARISC_LTOFF_FPTR16DF 127 +#define R_PARISC_LORESERVE 128 +#define R_PARISC_COPY 128 +#define R_PARISC_IPLT 129 +#define R_PARISC_EPLT 130 +#define R_PARISC_TPREL32 153 +#define R_PARISC_TPREL21L 154 +#define R_PARISC_TPREL14R 158 +#define R_PARISC_LTOFF_TP21L 162 +#define R_PARISC_LTOFF_TP14R 166 +#define R_PARISC_LTOFF_TP14F 167 +#define R_PARISC_TPREL64 216 +#define R_PARISC_TPREL14WR 219 +#define R_PARISC_TPREL14DR 220 +#define R_PARISC_TPREL16F 221 +#define R_PARISC_TPREL16WF 222 +#define R_PARISC_TPREL16DF 223 +#define R_PARISC_LTOFF_TP64 224 +#define R_PARISC_LTOFF_TP14WR 227 +#define R_PARISC_LTOFF_TP14DR 228 +#define R_PARISC_LTOFF_TP16F 229 +#define R_PARISC_LTOFF_TP16WF 230 +#define R_PARISC_LTOFF_TP16DF 231 +#define R_PARISC_GNU_VTENTRY 232 +#define R_PARISC_GNU_VTINHERIT 233 +#define R_PARISC_TLS_GD21L 234 +#define R_PARISC_TLS_GD14R 235 +#define R_PARISC_TLS_GDCALL 236 +#define R_PARISC_TLS_LDM21L 237 +#define R_PARISC_TLS_LDM14R 238 +#define R_PARISC_TLS_LDMCALL 239 +#define R_PARISC_TLS_LDO21L 240 +#define R_PARISC_TLS_LDO14R 241 +#define R_PARISC_TLS_DTPMOD32 242 +#define R_PARISC_TLS_DTPMOD64 243 +#define R_PARISC_TLS_DTPOFF32 244 +#define R_PARISC_TLS_DTPOFF64 245 +#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L +#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R +#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L +#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R +#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 +#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 +#define R_PARISC_HIRESERVE 255 + +#define PT_HP_TLS (PT_LOOS + 0x0) +#define PT_HP_CORE_NONE (PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) +#define PT_HP_CORE_COMM (PT_LOOS + 0x4) +#define PT_HP_CORE_PROC (PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) +#define PT_HP_CORE_STACK (PT_LOOS + 0x7) +#define PT_HP_CORE_SHM (PT_LOOS + 0x8) +#define PT_HP_CORE_MMF (PT_LOOS + 0x9) +#define PT_HP_PARALLEL (PT_LOOS + 0x10) +#define PT_HP_FASTBIND (PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) +#define PT_HP_STACK (PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT 0x70000000 +#define PT_PARISC_UNWIND 0x70000001 + +#define PF_PARISC_SBP 0x08000000 + +#define PF_HP_PAGE_SIZE 0x00100000 +#define PF_HP_FAR_SHARED 0x00200000 +#define PF_HP_NEAR_SHARED 0x00400000 +#define PF_HP_CODE 0x01000000 +#define PF_HP_MODIFY 0x02000000 +#define PF_HP_LAZYSWAP 0x04000000 +#define PF_HP_SBP 0x08000000 + +#define EF_ALPHA_32BIT 1 +#define EF_ALPHA_CANRELAX 2 + +#define SHT_ALPHA_DEBUG 0x70000001 +#define SHT_ALPHA_REGINFO 0x70000002 + +#define SHF_ALPHA_GPREL 0x10000000 + +#define STO_ALPHA_NOPV 0x80 +#define STO_ALPHA_STD_GPLOAD 0x88 + +#define R_ALPHA_NONE 0 +#define R_ALPHA_REFLONG 1 +#define R_ALPHA_REFQUAD 2 +#define R_ALPHA_GPREL32 3 +#define R_ALPHA_LITERAL 4 +#define R_ALPHA_LITUSE 5 +#define R_ALPHA_GPDISP 6 +#define R_ALPHA_BRADDR 7 +#define R_ALPHA_HINT 8 +#define R_ALPHA_SREL16 9 +#define R_ALPHA_SREL32 10 +#define R_ALPHA_SREL64 11 +#define R_ALPHA_GPRELHIGH 17 +#define R_ALPHA_GPRELLOW 18 +#define R_ALPHA_GPREL16 19 +#define R_ALPHA_COPY 24 +#define R_ALPHA_GLOB_DAT 25 +#define R_ALPHA_JMP_SLOT 26 +#define R_ALPHA_RELATIVE 27 +#define R_ALPHA_TLS_GD_HI 28 +#define R_ALPHA_TLSGD 29 +#define R_ALPHA_TLS_LDM 30 +#define R_ALPHA_DTPMOD64 31 +#define R_ALPHA_GOTDTPREL 32 +#define R_ALPHA_DTPREL64 33 +#define R_ALPHA_DTPRELHI 34 +#define R_ALPHA_DTPRELLO 35 +#define R_ALPHA_DTPREL16 36 +#define R_ALPHA_GOTTPREL 37 +#define R_ALPHA_TPREL64 38 +#define R_ALPHA_TPRELHI 39 +#define R_ALPHA_TPRELLO 40 +#define R_ALPHA_TPREL16 41 + +#define R_ALPHA_NUM 46 + +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLS_GD 4 +#define LITUSE_ALPHA_TLS_LDM 5 + +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 + +#define EF_PPC_EMB 0x80000000 + +#define EF_PPC_RELOCATABLE 0x00010000 +#define EF_PPC_RELOCATABLE_LIB 0x00008000 + +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +#define R_PPC_TLS 67 +#define R_PPC_DTPMOD32 68 +#define R_PPC_TPREL16 69 +#define R_PPC_TPREL16_LO 70 +#define R_PPC_TPREL16_HI 71 +#define R_PPC_TPREL16_HA 72 +#define R_PPC_TPREL32 73 +#define R_PPC_DTPREL16 74 +#define R_PPC_DTPREL16_LO 75 +#define R_PPC_DTPREL16_HI 76 +#define R_PPC_DTPREL16_HA 77 +#define R_PPC_DTPREL32 78 +#define R_PPC_GOT_TLSGD16 79 +#define R_PPC_GOT_TLSGD16_LO 80 +#define R_PPC_GOT_TLSGD16_HI 81 +#define R_PPC_GOT_TLSGD16_HA 82 +#define R_PPC_GOT_TLSLD16 83 +#define R_PPC_GOT_TLSLD16_LO 84 +#define R_PPC_GOT_TLSLD16_HI 85 +#define R_PPC_GOT_TLSLD16_HA 86 +#define R_PPC_GOT_TPREL16 87 +#define R_PPC_GOT_TPREL16_LO 88 +#define R_PPC_GOT_TPREL16_HI 89 +#define R_PPC_GOT_TPREL16_HA 90 +#define R_PPC_GOT_DTPREL16 91 +#define R_PPC_GOT_DTPREL16_LO 92 +#define R_PPC_GOT_DTPREL16_HI 93 +#define R_PPC_GOT_DTPREL16_HA 94 + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + +#define R_PPC_DIAB_SDA21_LO 180 +#define R_PPC_DIAB_SDA21_HI 181 +#define R_PPC_DIAB_SDA21_HA 182 +#define R_PPC_DIAB_RELSDA_LO 183 +#define R_PPC_DIAB_RELSDA_HI 184 +#define R_PPC_DIAB_RELSDA_HA 185 + +#define R_PPC_IRELATIVE 248 + +#define R_PPC_REL16 249 +#define R_PPC_REL16_LO 250 +#define R_PPC_REL16_HI 251 +#define R_PPC_REL16_HA 252 + +#define R_PPC_TOC16 255 + +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_NUM 1 + +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 +#define R_PPC64_ADDR24 R_PPC_ADDR24 +#define R_PPC64_ADDR16 R_PPC_ADDR16 +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA +#define R_PPC64_ADDR14 R_PPC_ADDR14 +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 +#define R_PPC64_REL14 R_PPC_REL14 +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 +#define R_PPC64_ADDR64 38 +#define R_PPC64_ADDR16_HIGHER 39 +#define R_PPC64_ADDR16_HIGHERA 40 +#define R_PPC64_ADDR16_HIGHEST 41 +#define R_PPC64_ADDR16_HIGHESTA 42 +#define R_PPC64_UADDR64 43 +#define R_PPC64_REL64 44 +#define R_PPC64_PLT64 45 +#define R_PPC64_PLTREL64 46 +#define R_PPC64_TOC16 47 +#define R_PPC64_TOC16_LO 48 +#define R_PPC64_TOC16_HI 49 +#define R_PPC64_TOC16_HA 50 +#define R_PPC64_TOC 51 +#define R_PPC64_PLTGOT16 52 +#define R_PPC64_PLTGOT16_LO 53 +#define R_PPC64_PLTGOT16_HI 54 +#define R_PPC64_PLTGOT16_HA 55 + +#define R_PPC64_ADDR16_DS 56 +#define R_PPC64_ADDR16_LO_DS 57 +#define R_PPC64_GOT16_DS 58 +#define R_PPC64_GOT16_LO_DS 59 +#define R_PPC64_PLT16_LO_DS 60 +#define R_PPC64_SECTOFF_DS 61 +#define R_PPC64_SECTOFF_LO_DS 62 +#define R_PPC64_TOC16_DS 63 +#define R_PPC64_TOC16_LO_DS 64 +#define R_PPC64_PLTGOT16_DS 65 +#define R_PPC64_PLTGOT16_LO_DS 66 + +#define R_PPC64_TLS 67 +#define R_PPC64_DTPMOD64 68 +#define R_PPC64_TPREL16 69 +#define R_PPC64_TPREL16_LO 70 +#define R_PPC64_TPREL16_HI 71 +#define R_PPC64_TPREL16_HA 72 +#define R_PPC64_TPREL64 73 +#define R_PPC64_DTPREL16 74 +#define R_PPC64_DTPREL16_LO 75 +#define R_PPC64_DTPREL16_HI 76 +#define R_PPC64_DTPREL16_HA 77 +#define R_PPC64_DTPREL64 78 +#define R_PPC64_GOT_TLSGD16 79 +#define R_PPC64_GOT_TLSGD16_LO 80 +#define R_PPC64_GOT_TLSGD16_HI 81 +#define R_PPC64_GOT_TLSGD16_HA 82 +#define R_PPC64_GOT_TLSLD16 83 +#define R_PPC64_GOT_TLSLD16_LO 84 +#define R_PPC64_GOT_TLSLD16_HI 85 +#define R_PPC64_GOT_TLSLD16_HA 86 +#define R_PPC64_GOT_TPREL16_DS 87 +#define R_PPC64_GOT_TPREL16_LO_DS 88 +#define R_PPC64_GOT_TPREL16_HI 89 +#define R_PPC64_GOT_TPREL16_HA 90 +#define R_PPC64_GOT_DTPREL16_DS 91 +#define R_PPC64_GOT_DTPREL16_LO_DS 92 +#define R_PPC64_GOT_DTPREL16_HI 93 +#define R_PPC64_GOT_DTPREL16_HA 94 +#define R_PPC64_TPREL16_DS 95 +#define R_PPC64_TPREL16_LO_DS 96 +#define R_PPC64_TPREL16_HIGHER 97 +#define R_PPC64_TPREL16_HIGHERA 98 +#define R_PPC64_TPREL16_HIGHEST 99 +#define R_PPC64_TPREL16_HIGHESTA 100 +#define R_PPC64_DTPREL16_DS 101 +#define R_PPC64_DTPREL16_LO_DS 102 +#define R_PPC64_DTPREL16_HIGHER 103 +#define R_PPC64_DTPREL16_HIGHERA 104 +#define R_PPC64_DTPREL16_HIGHEST 105 +#define R_PPC64_DTPREL16_HIGHESTA 106 + +#define R_PPC64_JMP_IREL 247 +#define R_PPC64_IRELATIVE 248 +#define R_PPC64_REL16 249 +#define R_PPC64_REL16_LO 250 +#define R_PPC64_REL16_HI 251 +#define R_PPC64_REL16_HA 252 + +#define DT_PPC64_GLINK (DT_LOPROC + 0) +#define DT_PPC64_OPD (DT_LOPROC + 1) +#define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_NUM 3 + +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 +#define EF_ARM_SOFT_FLOAT 0x200 +#define EF_ARM_VFP_FLOAT 0x400 +#define EF_ARM_MAVERICK_FLOAT 0x800 + +#define EF_ARM_ABI_FLOAT_SOFT 0x200 +#define EF_ARM_ABI_FLOAT_HARD 0x400 + +#define EF_ARM_SYMSARESORTED 0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST 0x10 +#define EF_ARM_EABIMASK 0XFF000000 + +#define EF_ARM_BE8 0x00800000 +#define EF_ARM_LE8 0x00400000 + +#define EF_ARM_EABI_VERSION(flags) ((flags)&EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 +#define EF_ARM_EABI_VER3 0x03000000 +#define EF_ARM_EABI_VER4 0x04000000 +#define EF_ARM_EABI_VER5 0x05000000 + +#define STT_ARM_TFUNC STT_LOPROC +#define STT_ARM_16BIT STT_HIPROC + +#define SHF_ARM_ENTRYSECT 0x10000000 +#define SHF_ARM_COMDEF 0x80000000 + +#define PF_ARM_SB 0x10000000 + +#define PF_ARM_PI 0x20000000 +#define PF_ARM_ABS 0x40000000 + +#define PT_ARM_EXIDX (PT_LOPROC + 1) + +#define SHT_ARM_EXIDX (SHT_LOPROC + 1) +#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) +#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) + +#define R_AARCH64_NONE 0 +#define R_AARCH64_ABS64 257 +#define R_AARCH64_ABS32 258 +#define R_AARCH64_ABS16 259 +#define R_AARCH64_PREL64 260 +#define R_AARCH64_PREL32 261 +#define R_AARCH64_PREL16 262 +#define R_AARCH64_MOVW_UABS_G0 263 +#define R_AARCH64_MOVW_UABS_G0_NC 264 +#define R_AARCH64_MOVW_UABS_G1 265 +#define R_AARCH64_MOVW_UABS_G1_NC 266 +#define R_AARCH64_MOVW_UABS_G2 267 +#define R_AARCH64_MOVW_UABS_G2_NC 268 +#define R_AARCH64_MOVW_UABS_G3 269 +#define R_AARCH64_MOVW_SABS_G0 270 +#define R_AARCH64_MOVW_SABS_G1 271 +#define R_AARCH64_MOVW_SABS_G2 272 +#define R_AARCH64_LD_PREL_LO19 273 +#define R_AARCH64_ADR_PREL_LO21 274 +#define R_AARCH64_ADR_PREL_PG_HI21 275 +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 +#define R_AARCH64_ADD_ABS_LO12_NC 277 +#define R_AARCH64_LDST8_ABS_LO12_NC 278 +#define R_AARCH64_TSTBR14 279 +#define R_AARCH64_CONDBR19 280 +#define R_AARCH64_JUMP26 282 +#define R_AARCH64_CALL26 283 +#define R_AARCH64_LDST16_ABS_LO12_NC 284 +#define R_AARCH64_LDST32_ABS_LO12_NC 285 +#define R_AARCH64_LDST64_ABS_LO12_NC 286 +#define R_AARCH64_MOVW_PREL_G0 287 +#define R_AARCH64_MOVW_PREL_G0_NC 288 +#define R_AARCH64_MOVW_PREL_G1 289 +#define R_AARCH64_MOVW_PREL_G1_NC 290 +#define R_AARCH64_MOVW_PREL_G2 291 +#define R_AARCH64_MOVW_PREL_G2_NC 292 +#define R_AARCH64_MOVW_PREL_G3 293 +#define R_AARCH64_LDST128_ABS_LO12_NC 299 +#define R_AARCH64_MOVW_GOTOFF_G0 300 +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 +#define R_AARCH64_MOVW_GOTOFF_G1 302 +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 +#define R_AARCH64_MOVW_GOTOFF_G2 304 +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 +#define R_AARCH64_MOVW_GOTOFF_G3 306 +#define R_AARCH64_GOTREL64 307 +#define R_AARCH64_GOTREL32 308 +#define R_AARCH64_GOT_LD_PREL19 309 +#define R_AARCH64_LD64_GOTOFF_LO15 310 +#define R_AARCH64_ADR_GOT_PAGE 311 +#define R_AARCH64_LD64_GOT_LO12_NC 312 +#define R_AARCH64_LD64_GOTPAGE_LO15 313 +#define R_AARCH64_TLSGD_ADR_PREL21 512 +#define R_AARCH64_TLSGD_ADR_PAGE21 513 +#define R_AARCH64_TLSGD_ADD_LO12_NC 514 +#define R_AARCH64_TLSGD_MOVW_G1 515 +#define R_AARCH64_TLSGD_MOVW_G0_NC 516 +#define R_AARCH64_TLSLD_ADR_PREL21 517 +#define R_AARCH64_TLSLD_ADR_PAGE21 518 +#define R_AARCH64_TLSLD_ADD_LO12_NC 519 +#define R_AARCH64_TLSLD_MOVW_G1 520 +#define R_AARCH64_TLSLD_MOVW_G0_NC 521 +#define R_AARCH64_TLSLD_LD_PREL19 522 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 +#define R_AARCH64_TLSDESC_LD_PREL19 560 +#define R_AARCH64_TLSDESC_ADR_PREL21 561 +#define R_AARCH64_TLSDESC_ADR_PAGE21 562 +#define R_AARCH64_TLSDESC_LD64_LO12 563 +#define R_AARCH64_TLSDESC_ADD_LO12 564 +#define R_AARCH64_TLSDESC_OFF_G1 565 +#define R_AARCH64_TLSDESC_OFF_G0_NC 566 +#define R_AARCH64_TLSDESC_LDR 567 +#define R_AARCH64_TLSDESC_ADD 568 +#define R_AARCH64_TLSDESC_CALL 569 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 +#define R_AARCH64_COPY 1024 +#define R_AARCH64_GLOB_DAT 1025 +#define R_AARCH64_JUMP_SLOT 1026 +#define R_AARCH64_RELATIVE 1027 +#define R_AARCH64_TLS_DTPMOD64 1028 +#define R_AARCH64_TLS_DTPREL64 1029 +#define R_AARCH64_TLS_TPREL64 1030 +#define R_AARCH64_TLSDESC 1031 + +#define R_ARM_NONE 0 +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_TLS_DESC 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_TLS_DTPMOD32 17 +#define R_ARM_TLS_DTPOFF32 18 +#define R_ARM_TLS_TPOFF32 19 +#define R_ARM_COPY 20 +#define R_ARM_GLOB_DAT 21 +#define R_ARM_JUMP_SLOT 22 +#define R_ARM_RELATIVE 23 +#define R_ARM_GOTOFF 24 +#define R_ARM_GOTPC 25 +#define R_ARM_GOT32 26 +#define R_ARM_PLT32 27 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_THM_JUMP24 30 +#define R_ARM_BASE_ABS 31 +#define R_ARM_ALU_PCREL_7_0 32 +#define R_ARM_ALU_PCREL_15_8 33 +#define R_ARM_ALU_PCREL_23_15 34 +#define R_ARM_LDR_SBREL_11_0 35 +#define R_ARM_ALU_SBREL_19_12 36 +#define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_TARGET1 38 +#define R_ARM_SBREL31 39 +#define R_ARM_V4BX 40 +#define R_ARM_TARGET2 41 +#define R_ARM_PREL31 42 +#define R_ARM_MOVW_ABS_NC 43 +#define R_ARM_MOVT_ABS 44 +#define R_ARM_MOVW_PREL_NC 45 +#define R_ARM_MOVT_PREL 46 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 +#define R_ARM_THM_MOVW_PREL_NC 49 +#define R_ARM_THM_MOVT_PREL 50 +#define R_ARM_THM_JUMP19 51 +#define R_ARM_THM_JUMP6 52 +#define R_ARM_THM_ALU_PREL_11_0 53 +#define R_ARM_THM_PC12 54 +#define R_ARM_ABS32_NOI 55 +#define R_ARM_REL32_NOI 56 +#define R_ARM_ALU_PC_G0_NC 57 +#define R_ARM_ALU_PC_G0 58 +#define R_ARM_ALU_PC_G1_NC 59 +#define R_ARM_ALU_PC_G1 60 +#define R_ARM_ALU_PC_G2 61 +#define R_ARM_LDR_PC_G1 62 +#define R_ARM_LDR_PC_G2 63 +#define R_ARM_LDRS_PC_G0 64 +#define R_ARM_LDRS_PC_G1 65 +#define R_ARM_LDRS_PC_G2 66 +#define R_ARM_LDC_PC_G0 67 +#define R_ARM_LDC_PC_G1 68 +#define R_ARM_LDC_PC_G2 69 +#define R_ARM_ALU_SB_G0_NC 70 +#define R_ARM_ALU_SB_G0 71 +#define R_ARM_ALU_SB_G1_NC 72 +#define R_ARM_ALU_SB_G1 73 +#define R_ARM_ALU_SB_G2 74 +#define R_ARM_LDR_SB_G0 75 +#define R_ARM_LDR_SB_G1 76 +#define R_ARM_LDR_SB_G2 77 +#define R_ARM_LDRS_SB_G0 78 +#define R_ARM_LDRS_SB_G1 79 +#define R_ARM_LDRS_SB_G2 80 +#define R_ARM_LDC_SB_G0 81 +#define R_ARM_LDC_SB_G1 82 +#define R_ARM_LDC_SB_G2 83 +#define R_ARM_MOVW_BREL_NC 84 +#define R_ARM_MOVT_BREL 85 +#define R_ARM_MOVW_BREL 86 +#define R_ARM_THM_MOVW_BREL_NC 87 +#define R_ARM_THM_MOVT_BREL 88 +#define R_ARM_THM_MOVW_BREL 89 +#define R_ARM_TLS_GOTDESC 90 +#define R_ARM_TLS_CALL 91 +#define R_ARM_TLS_DESCSEQ 92 +#define R_ARM_THM_TLS_CALL 93 +#define R_ARM_PLT32_ABS 94 +#define R_ARM_GOT_ABS 95 +#define R_ARM_GOT_PREL 96 +#define R_ARM_GOT_BREL12 97 +#define R_ARM_GOTOFF12 98 +#define R_ARM_GOTRELAX 99 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 +#define R_ARM_THM_PC9 103 +#define R_ARM_TLS_GD32 104 + +#define R_ARM_TLS_LDM32 105 + +#define R_ARM_TLS_LDO32 106 + +#define R_ARM_TLS_IE32 107 + +#define R_ARM_TLS_LE32 108 +#define R_ARM_TLS_LDO12 109 +#define R_ARM_TLS_LE12 110 +#define R_ARM_TLS_IE12GP 111 +#define R_ARM_ME_TOO 128 +#define R_ARM_THM_TLS_DESCSEQ 129 +#define R_ARM_THM_TLS_DESCSEQ16 129 +#define R_ARM_THM_TLS_DESCSEQ32 130 +#define R_ARM_THM_GOT_BREL12 131 +#define R_ARM_IRELATIVE 160 +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + +#define R_ARM_NUM 256 + +#define EF_IA_64_MASKOS 0x0000000f +#define EF_IA_64_ABI64 0x00000010 +#define EF_IA_64_ARCH 0xff000000 + +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) +#define PT_IA_64_UNWIND (PT_LOPROC + 1) +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) + +#define PF_IA_64_NORECOV 0x80000000 + +#define SHT_IA_64_EXT (SHT_LOPROC + 0) +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) + +#define SHF_IA_64_SHORT 0x10000000 +#define SHF_IA_64_NORECOV 0x20000000 + +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) +#define DT_IA_64_NUM 1 + +#define R_IA64_NONE 0x00 +#define R_IA64_IMM14 0x21 +#define R_IA64_IMM22 0x22 +#define R_IA64_IMM64 0x23 +#define R_IA64_DIR32MSB 0x24 +#define R_IA64_DIR32LSB 0x25 +#define R_IA64_DIR64MSB 0x26 +#define R_IA64_DIR64LSB 0x27 +#define R_IA64_GPREL22 0x2a +#define R_IA64_GPREL64I 0x2b +#define R_IA64_GPREL32MSB 0x2c +#define R_IA64_GPREL32LSB 0x2d +#define R_IA64_GPREL64MSB 0x2e +#define R_IA64_GPREL64LSB 0x2f +#define R_IA64_LTOFF22 0x32 +#define R_IA64_LTOFF64I 0x33 +#define R_IA64_PLTOFF22 0x3a +#define R_IA64_PLTOFF64I 0x3b +#define R_IA64_PLTOFF64MSB 0x3e +#define R_IA64_PLTOFF64LSB 0x3f +#define R_IA64_FPTR64I 0x43 +#define R_IA64_FPTR32MSB 0x44 +#define R_IA64_FPTR32LSB 0x45 +#define R_IA64_FPTR64MSB 0x46 +#define R_IA64_FPTR64LSB 0x47 +#define R_IA64_PCREL60B 0x48 +#define R_IA64_PCREL21B 0x49 +#define R_IA64_PCREL21M 0x4a +#define R_IA64_PCREL21F 0x4b +#define R_IA64_PCREL32MSB 0x4c +#define R_IA64_PCREL32LSB 0x4d +#define R_IA64_PCREL64MSB 0x4e +#define R_IA64_PCREL64LSB 0x4f +#define R_IA64_LTOFF_FPTR22 0x52 +#define R_IA64_LTOFF_FPTR64I 0x53 +#define R_IA64_LTOFF_FPTR32MSB 0x54 +#define R_IA64_LTOFF_FPTR32LSB 0x55 +#define R_IA64_LTOFF_FPTR64MSB 0x56 +#define R_IA64_LTOFF_FPTR64LSB 0x57 +#define R_IA64_SEGREL32MSB 0x5c +#define R_IA64_SEGREL32LSB 0x5d +#define R_IA64_SEGREL64MSB 0x5e +#define R_IA64_SEGREL64LSB 0x5f +#define R_IA64_SECREL32MSB 0x64 +#define R_IA64_SECREL32LSB 0x65 +#define R_IA64_SECREL64MSB 0x66 +#define R_IA64_SECREL64LSB 0x67 +#define R_IA64_REL32MSB 0x6c +#define R_IA64_REL32LSB 0x6d +#define R_IA64_REL64MSB 0x6e +#define R_IA64_REL64LSB 0x6f +#define R_IA64_LTV32MSB 0x74 +#define R_IA64_LTV32LSB 0x75 +#define R_IA64_LTV64MSB 0x76 +#define R_IA64_LTV64LSB 0x77 +#define R_IA64_PCREL21BI 0x79 +#define R_IA64_PCREL22 0x7a +#define R_IA64_PCREL64I 0x7b +#define R_IA64_IPLTMSB 0x80 +#define R_IA64_IPLTLSB 0x81 +#define R_IA64_COPY 0x84 +#define R_IA64_SUB 0x85 +#define R_IA64_LTOFF22X 0x86 +#define R_IA64_LDXMOV 0x87 +#define R_IA64_TPREL14 0x91 +#define R_IA64_TPREL22 0x92 +#define R_IA64_TPREL64I 0x93 +#define R_IA64_TPREL64MSB 0x96 +#define R_IA64_TPREL64LSB 0x97 +#define R_IA64_LTOFF_TPREL22 0x9a +#define R_IA64_DTPMOD64MSB 0xa6 +#define R_IA64_DTPMOD64LSB 0xa7 +#define R_IA64_LTOFF_DTPMOD22 0xaa +#define R_IA64_DTPREL14 0xb1 +#define R_IA64_DTPREL22 0xb2 +#define R_IA64_DTPREL64I 0xb3 +#define R_IA64_DTPREL32MSB 0xb4 +#define R_IA64_DTPREL32LSB 0xb5 +#define R_IA64_DTPREL64MSB 0xb6 +#define R_IA64_DTPREL64LSB 0xb7 +#define R_IA64_LTOFF_DTPREL22 0xba + +#define R_SH_NONE 0 +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_DIR8WPN 3 +#define R_SH_IND12W 4 +#define R_SH_DIR8WPL 5 +#define R_SH_DIR8WPZ 6 +#define R_SH_DIR8BP 7 +#define R_SH_DIR8W 8 +#define R_SH_DIR8L 9 +#define R_SH_SWITCH16 25 +#define R_SH_SWITCH32 26 +#define R_SH_USES 27 +#define R_SH_COUNT 28 +#define R_SH_ALIGN 29 +#define R_SH_CODE 30 +#define R_SH_DATA 31 +#define R_SH_LABEL 32 +#define R_SH_SWITCH8 33 +#define R_SH_GNU_VTINHERIT 34 +#define R_SH_GNU_VTENTRY 35 +#define R_SH_TLS_GD_32 144 +#define R_SH_TLS_LD_32 145 +#define R_SH_TLS_LDO_32 146 +#define R_SH_TLS_IE_32 147 +#define R_SH_TLS_LE_32 148 +#define R_SH_TLS_DTPMOD32 149 +#define R_SH_TLS_DTPOFF32 150 +#define R_SH_TLS_TPOFF32 151 +#define R_SH_GOT32 160 +#define R_SH_PLT32 161 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 +#define R_SH_GOTOFF 166 +#define R_SH_GOTPC 167 +#define R_SH_GOT20 201 +#define R_SH_GOTOFF20 202 +#define R_SH_GOTFUNCDESC 203 +#define R_SH_GOTFUNCDEST20 204 +#define R_SH_GOTOFFFUNCDESC 205 +#define R_SH_GOTOFFFUNCDEST20 206 +#define R_SH_FUNCDESC 207 +#define R_SH_FUNCDESC_VALUE 208 + +#define R_SH_NUM 256 + +#define R_390_NONE 0 +#define R_390_8 1 +#define R_390_12 2 +#define R_390_16 3 +#define R_390_32 4 +#define R_390_PC32 5 +#define R_390_GOT12 6 +#define R_390_GOT32 7 +#define R_390_PLT32 8 +#define R_390_COPY 9 +#define R_390_GLOB_DAT 10 +#define R_390_JMP_SLOT 11 +#define R_390_RELATIVE 12 +#define R_390_GOTOFF32 13 +#define R_390_GOTPC 14 +#define R_390_GOT16 15 +#define R_390_PC16 16 +#define R_390_PC16DBL 17 +#define R_390_PLT16DBL 18 +#define R_390_PC32DBL 19 +#define R_390_PLT32DBL 20 +#define R_390_GOTPCDBL 21 +#define R_390_64 22 +#define R_390_PC64 23 +#define R_390_GOT64 24 +#define R_390_PLT64 25 +#define R_390_GOTENT 26 +#define R_390_GOTOFF16 27 +#define R_390_GOTOFF64 28 +#define R_390_GOTPLT12 29 +#define R_390_GOTPLT16 30 +#define R_390_GOTPLT32 31 +#define R_390_GOTPLT64 32 +#define R_390_GOTPLTENT 33 +#define R_390_PLTOFF16 34 +#define R_390_PLTOFF32 35 +#define R_390_PLTOFF64 36 +#define R_390_TLS_LOAD 37 +#define R_390_TLS_GDCALL 38 + +#define R_390_TLS_LDCALL 39 + +#define R_390_TLS_GD32 40 + +#define R_390_TLS_GD64 41 + +#define R_390_TLS_GOTIE12 42 + +#define R_390_TLS_GOTIE32 43 + +#define R_390_TLS_GOTIE64 44 + +#define R_390_TLS_LDM32 45 + +#define R_390_TLS_LDM64 46 + +#define R_390_TLS_IE32 47 + +#define R_390_TLS_IE64 48 + +#define R_390_TLS_IEENT 49 + +#define R_390_TLS_LE32 50 + +#define R_390_TLS_LE64 51 + +#define R_390_TLS_LDO32 52 + +#define R_390_TLS_LDO64 53 + +#define R_390_TLS_DTPMOD 54 +#define R_390_TLS_DTPOFF 55 +#define R_390_TLS_TPOFF 56 + +#define R_390_20 57 +#define R_390_GOT20 58 +#define R_390_GOTPLT20 59 +#define R_390_TLS_GOTIE20 60 + +#define R_390_NUM 61 + +#define R_CRIS_NONE 0 +#define R_CRIS_8 1 +#define R_CRIS_16 2 +#define R_CRIS_32 3 +#define R_CRIS_8_PCREL 4 +#define R_CRIS_16_PCREL 5 +#define R_CRIS_32_PCREL 6 +#define R_CRIS_GNU_VTINHERIT 7 +#define R_CRIS_GNU_VTENTRY 8 +#define R_CRIS_COPY 9 +#define R_CRIS_GLOB_DAT 10 +#define R_CRIS_JUMP_SLOT 11 +#define R_CRIS_RELATIVE 12 +#define R_CRIS_16_GOT 13 +#define R_CRIS_32_GOT 14 +#define R_CRIS_16_GOTPLT 15 +#define R_CRIS_32_GOTPLT 16 +#define R_CRIS_32_GOTREL 17 +#define R_CRIS_32_PLT_GOTREL 18 +#define R_CRIS_32_PLT_PCREL 19 + +#define R_CRIS_NUM 20 + +#define R_X86_64_NONE 0 +#define R_X86_64_64 1 +#define R_X86_64_PC32 2 +#define R_X86_64_GOT32 3 +#define R_X86_64_PLT32 4 +#define R_X86_64_COPY 5 +#define R_X86_64_GLOB_DAT 6 +#define R_X86_64_JUMP_SLOT 7 +#define R_X86_64_RELATIVE 8 +#define R_X86_64_GOTPCREL 9 + +#define R_X86_64_32 10 +#define R_X86_64_32S 11 +#define R_X86_64_16 12 +#define R_X86_64_PC16 13 +#define R_X86_64_8 14 +#define R_X86_64_PC8 15 +#define R_X86_64_DTPMOD64 16 +#define R_X86_64_DTPOFF64 17 +#define R_X86_64_TPOFF64 18 +#define R_X86_64_TLSGD 19 + +#define R_X86_64_TLSLD 20 + +#define R_X86_64_DTPOFF32 21 +#define R_X86_64_GOTTPOFF 22 + +#define R_X86_64_TPOFF32 23 +#define R_X86_64_PC64 24 +#define R_X86_64_GOTOFF64 25 +#define R_X86_64_GOTPC32 26 +#define R_X86_64_GOT64 27 +#define R_X86_64_GOTPCREL64 28 +#define R_X86_64_GOTPC64 29 +#define R_X86_64_GOTPLT64 30 +#define R_X86_64_PLTOFF64 31 +#define R_X86_64_SIZE32 32 +#define R_X86_64_SIZE64 33 + +#define R_X86_64_GOTPC32_TLSDESC 34 +#define R_X86_64_TLSDESC_CALL 35 + +#define R_X86_64_TLSDESC 36 +#define R_X86_64_IRELATIVE 37 +#define R_X86_64_RELATIVE64 38 +#define R_X86_64_NUM 39 + +#define R_MN10300_NONE 0 +#define R_MN10300_32 1 +#define R_MN10300_16 2 +#define R_MN10300_8 3 +#define R_MN10300_PCREL32 4 +#define R_MN10300_PCREL16 5 +#define R_MN10300_PCREL8 6 +#define R_MN10300_GNU_VTINHERIT 7 +#define R_MN10300_GNU_VTENTRY 8 +#define R_MN10300_24 9 +#define R_MN10300_GOTPC32 10 +#define R_MN10300_GOTPC16 11 +#define R_MN10300_GOTOFF32 12 +#define R_MN10300_GOTOFF24 13 +#define R_MN10300_GOTOFF16 14 +#define R_MN10300_PLT32 15 +#define R_MN10300_PLT16 16 +#define R_MN10300_GOT32 17 +#define R_MN10300_GOT24 18 +#define R_MN10300_GOT16 19 +#define R_MN10300_COPY 20 +#define R_MN10300_GLOB_DAT 21 +#define R_MN10300_JMP_SLOT 22 +#define R_MN10300_RELATIVE 23 + +#define R_MN10300_NUM 24 + +#define R_M32R_NONE 0 +#define R_M32R_16 1 +#define R_M32R_32 2 +#define R_M32R_24 3 +#define R_M32R_10_PCREL 4 +#define R_M32R_18_PCREL 5 +#define R_M32R_26_PCREL 6 +#define R_M32R_HI16_ULO 7 +#define R_M32R_HI16_SLO 8 +#define R_M32R_LO16 9 +#define R_M32R_SDA16 10 +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 + +#define R_M32R_16_RELA 33 +#define R_M32R_32_RELA 34 +#define R_M32R_24_RELA 35 +#define R_M32R_10_PCREL_RELA 36 +#define R_M32R_18_PCREL_RELA 37 +#define R_M32R_26_PCREL_RELA 38 +#define R_M32R_HI16_ULO_RELA 39 +#define R_M32R_HI16_SLO_RELA 40 +#define R_M32R_LO16_RELA 41 +#define R_M32R_SDA16_RELA 42 +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 +#define R_M32R_REL32 45 + +#define R_M32R_GOT24 48 +#define R_M32R_26_PLTREL 49 +#define R_M32R_COPY 50 +#define R_M32R_GLOB_DAT 51 +#define R_M32R_JMP_SLOT 52 +#define R_M32R_RELATIVE 53 +#define R_M32R_GOTOFF 54 +#define R_M32R_GOTPC24 55 +#define R_M32R_GOT16_HI_ULO 56 + +#define R_M32R_GOT16_HI_SLO 57 + +#define R_M32R_GOT16_LO 58 +#define R_M32R_GOTPC_HI_ULO 59 + +#define R_M32R_GOTPC_HI_SLO 60 + +#define R_M32R_GOTPC_LO 61 + +#define R_M32R_GOTOFF_HI_ULO 62 + +#define R_M32R_GOTOFF_HI_SLO 63 + +#define R_M32R_GOTOFF_LO 64 +#define R_M32R_NUM 256 + +#define R_MICROBLAZE_NONE 0 +#define R_MICROBLAZE_32 1 +#define R_MICROBLAZE_32_PCREL 2 +#define R_MICROBLAZE_64_PCREL 3 +#define R_MICROBLAZE_32_PCREL_LO 4 +#define R_MICROBLAZE_64 5 +#define R_MICROBLAZE_32_LO 6 +#define R_MICROBLAZE_SRO32 7 +#define R_MICROBLAZE_SRW32 8 +#define R_MICROBLAZE_64_NONE 9 +#define R_MICROBLAZE_32_SYM_OP_SYM 10 +#define R_MICROBLAZE_GNU_VTINHERIT 11 +#define R_MICROBLAZE_GNU_VTENTRY 12 +#define R_MICROBLAZE_GOTPC_64 13 +#define R_MICROBLAZE_GOT_64 14 +#define R_MICROBLAZE_PLT_64 15 +#define R_MICROBLAZE_REL 16 +#define R_MICROBLAZE_JUMP_SLOT 17 +#define R_MICROBLAZE_GLOB_DAT 18 +#define R_MICROBLAZE_GOTOFF_64 19 +#define R_MICROBLAZE_GOTOFF_32 20 +#define R_MICROBLAZE_COPY 21 +#define R_MICROBLAZE_TLS 22 +#define R_MICROBLAZE_TLSGD 23 +#define R_MICROBLAZE_TLSLD 24 +#define R_MICROBLAZE_TLSDTPMOD32 25 +#define R_MICROBLAZE_TLSDTPREL32 26 +#define R_MICROBLAZE_TLSDTPREL64 27 +#define R_MICROBLAZE_TLSGOTTPREL32 28 +#define R_MICROBLAZE_TLSTPREL32 29 + +#define R_OR1K_NONE 0 +#define R_OR1K_32 1 +#define R_OR1K_16 2 +#define R_OR1K_8 3 +#define R_OR1K_LO_16_IN_INSN 4 +#define R_OR1K_HI_16_IN_INSN 5 +#define R_OR1K_INSN_REL_26 6 +#define R_OR1K_GNU_VTENTRY 7 +#define R_OR1K_GNU_VTINHERIT 8 +#define R_OR1K_32_PCREL 9 +#define R_OR1K_16_PCREL 10 +#define R_OR1K_8_PCREL 11 +#define R_OR1K_GOTPC_HI16 12 +#define R_OR1K_GOTPC_LO16 13 +#define R_OR1K_GOT16 14 +#define R_OR1K_PLT26 15 +#define R_OR1K_GOTOFF_HI16 16 +#define R_OR1K_GOTOFF_LO16 17 +#define R_OR1K_COPY 18 +#define R_OR1K_GLOB_DAT 19 +#define R_OR1K_JMP_SLOT 20 +#define R_OR1K_RELATIVE 21 +#define R_OR1K_TLS_GD_HI16 22 +#define R_OR1K_TLS_GD_LO16 23 +#define R_OR1K_TLS_LDM_HI16 24 +#define R_OR1K_TLS_LDM_LO16 25 +#define R_OR1K_TLS_LDO_HI16 26 +#define R_OR1K_TLS_LDO_LO16 27 +#define R_OR1K_TLS_IE_HI16 28 +#define R_OR1K_TLS_IE_LO16 29 +#define R_OR1K_TLS_LE_HI16 30 +#define R_OR1K_TLS_LE_LO16 31 +#define R_OR1K_TLS_TPOFF 32 +#define R_OR1K_TLS_DTPOFF 33 +#define R_OR1K_TLS_DTPMOD 34 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ELF_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/endian.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/endian.h new file mode 100644 index 0000000..5ca6625 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/endian.h
@@ -0,0 +1,77 @@ +#ifndef SYSROOT_ENDIAN_H_ +#define SYSROOT_ENDIAN_H_ + +#include <features.h> + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __PDP_ENDIAN 3412 + +#if defined(__GNUC__) && defined(__BYTE_ORDER__) +#define __BYTE_ORDER __BYTE_ORDER__ +#else +#include <bits/endian.h> +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define BIG_ENDIAN __BIG_ENDIAN +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#include <stdint.h> + +static __inline uint16_t __bswap16(uint16_t __x) { return (uint16_t)(__x << 8 | __x >> 8); } + +static __inline uint32_t __bswap32(uint32_t __x) { + return (uint32_t)(__x >> 24 | ((__x >> 8) & 0xff00) | ((__x << 8) & 0xff0000) | __x << 24); +} + +static __inline uint64_t __bswap64(uint64_t __x) { + return ((uint64_t)__bswap32((uint32_t)__x)) << 32 | (uint64_t)__bswap32((uint32_t)(__x >> 32)); +} + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobe16(x) __bswap16(x) +#define be16toh(x) __bswap16(x) +#define betoh16(x) __bswap16(x) +#define htobe32(x) __bswap32(x) +#define be32toh(x) __bswap32(x) +#define betoh32(x) __bswap32(x) +#define htobe64(x) __bswap64(x) +#define be64toh(x) __bswap64(x) +#define betoh64(x) __bswap64(x) +#define htole16(x) (uint16_t)(x) +#define le16toh(x) (uint16_t)(x) +#define letoh16(x) (uint16_t)(x) +#define htole32(x) (uint32_t)(x) +#define le32toh(x) (uint32_t)(x) +#define letoh32(x) (uint32_t)(x) +#define htole64(x) (uint64_t)(x) +#define le64toh(x) (uint64_t)(x) +#define letoh64(x) (uint64_t)(x) +#else +#define htobe16(x) (uint16_t)(x) +#define be16toh(x) (uint16_t)(x) +#define betoh16(x) (uint16_t)(x) +#define htobe32(x) (uint32_t)(x) +#define be32toh(x) (uint32_t)(x) +#define betoh32(x) (uint32_t)(x) +#define htobe64(x) (uint64_t)(x) +#define be64toh(x) (uint64_t)(x) +#define betoh64(x) (uint64_t)(x) +#define htole16(x) __bswap16(x) +#define le16toh(x) __bswap16(x) +#define letoh16(x) __bswap16(x) +#define htole32(x) __bswap32(x) +#define le32toh(x) __bswap32(x) +#define letoh32(x) __bswap32(x) +#define htole64(x) __bswap64(x) +#define le64toh(x) __bswap64(x) +#define letoh64(x) __bswap64(x) +#endif + +#endif + +#endif // SYSROOT_ENDIAN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/err.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/err.h new file mode 100644 index 0000000..29842fe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/err.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_ERR_H_ +#define SYSROOT_ERR_H_ + +#include <features.h> +#include <stdarg.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void warn(const char*, ...); +void vwarn(const char*, va_list); +void warnx(const char*, ...); +void vwarnx(const char*, va_list); + +_Noreturn void err(int, const char*, ...); +_Noreturn void verr(int, const char*, va_list); +_Noreturn void errx(int, const char*, ...); +_Noreturn void verrx(int, const char*, va_list); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ERR_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/errno.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/errno.h new file mode 100644 index 0000000..af13f58 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/errno.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_ERRNO_H_ +#define SYSROOT_ERRNO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/errno.h> + +int* __errno_location(void); +#define errno (*__errno_location()) + +#ifdef _GNU_SOURCE +extern char *program_invocation_short_name, *program_invocation_name; +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ERRNO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fcntl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fcntl.h new file mode 100644 index 0000000..e5e47bd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fcntl.h
@@ -0,0 +1,224 @@ +#ifndef SYSROOT_FCNTL_H_ +#define SYSROOT_FCNTL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_mode_t + +#ifdef _GNU_SOURCE +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec +#endif + +#include <bits/alltypes.h> + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +int creat(const char*, mode_t); +int fcntl(int, int, ...); +int open(const char*, int, ...); +int openat(int, const char*, int, ...); +int posix_fadvise(int, off_t, off_t, int); +int posix_fallocate(int, off_t, off_t); + +#define O_SEARCH O_PATH +#define O_EXEC O_PATH + +// clang-format off +#define O_ACCMODE (03 | O_SEARCH) +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 + +// Flags which align with ZXIO_FS_* +// system/ulib/fdio/unistd.c asserts that these flags are aligned +// with the ZXIO_FS_* versions. +#define O_CREAT 0x00010000 +#define O_EXCL 0x00020000 +#define O_TRUNC 0x00040000 +#define O_DIRECTORY 0x00080000 +#define O_APPEND 0x00100000 +#define O_PATH 0x00400000 +#ifdef _ALL_SOURCE +#define O_NOREMOTE 0x00200000 +#define O_ADMIN 0x00000004 +#endif + +// Flags which do not align with ZXIO_FS_* +#define O_NONBLOCK 0x00000010 +#define O_DSYNC 0x00000020 +#define O_SYNC (0x00000040 | O_DSYNC) +#define O_RSYNC O_SYNC +#define O_NOFOLLOW 0x00000080 +#define O_CLOEXEC 0x00000100 +#define O_NOCTTY 0x00000200 +#define O_ASYNC 0x00000400 +#define O_DIRECT 0x00000800 +#define O_LARGEFILE 0x00001000 +#define O_NOATIME 0x00002000 +#define O_TMPFILE 0x00004000 + +// clang-format on + +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 + +#define F_OFD_GETLK 36 +#define F_OFD_SETLK 37 +#define F_OFD_SETLKW 38 + +#define F_DUPFD_CLOEXEC 1030 + +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +#define FD_CLOEXEC 1 + +#define AT_FDCWD (-100) +#define AT_SYMLINK_NOFOLLOW 0x100 +#define AT_REMOVEDIR 0x200 +#define AT_SYMLINK_FOLLOW 0x400 +#define AT_EACCESS 0x200 + +#define POSIX_FADV_NORMAL 0 +#define POSIX_FADV_RANDOM 1 +#define POSIX_FADV_SEQUENTIAL 2 +#define POSIX_FADV_WILLNEED 3 +#define POSIX_FADV_DONTNEED 4 +#define POSIX_FADV_NOREUSE 5 + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define AT_NO_AUTOMOUNT 0x800 +#define AT_EMPTY_PATH 0x1000 + +#define FAPPEND O_APPEND +#define FFSYNC O_FSYNC +#define FASYNC O_ASYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 + +#define F_SETLEASE 1024 +#define F_GETLEASE 1025 +#define F_NOTIFY 1026 +#define F_CANCELLK 1029 +#define F_SETPIPE_SZ 1031 +#define F_GETPIPE_SZ 1032 +#define F_ADD_SEALS 1033 +#define F_GET_SEALS 1034 + +#define F_SEAL_SEAL 0x0001 +#define F_SEAL_SHRINK 0x0002 +#define F_SEAL_GROW 0x0004 +#define F_SEAL_WRITE 0x0008 + +#define DN_ACCESS 0x00000001 +#define DN_MODIFY 0x00000002 +#define DN_CREATE 0x00000004 +#define DN_DELETE 0x00000008 +#define DN_RENAME 0x00000010 +#define DN_ATTRIB 0x00000020 +#define DN_MULTISHOT 0x80000000 + +int lockf(int, int, off_t); +#endif + +#if defined(_GNU_SOURCE) +#define F_OWNER_TID 0 +#define F_OWNER_PID 1 +#define F_OWNER_PGRP 2 +#define F_OWNER_GID 2 +struct f_owner_ex { + int type; + pid_t pid; +}; +#define FALLOC_FL_KEEP_SIZE 1 +#define FALLOC_FL_PUNCH_HOLE 2 +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 +#define SYNC_FILE_RANGE_WRITE 2 +#define SYNC_FILE_RANGE_WAIT_AFTER 4 +#define SPLICE_F_MOVE 1 +#define SPLICE_F_NONBLOCK 2 +#define SPLICE_F_MORE 4 +#define SPLICE_F_GIFT 8 +int fallocate(int, int, off_t, off_t); +#define fallocate64 fallocate +ssize_t readahead(int, off_t, size_t); +int sync_file_range(int, off_t, off_t, unsigned); +ssize_t vmsplice(int, const struct iovec*, size_t, unsigned); +ssize_t splice(int, off_t*, int, off_t*, size_t, unsigned); +ssize_t tee(int, int, size_t, unsigned); +#define loff_t off_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FCNTL_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/features.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/features.h new file mode 100644 index 0000000..1520efb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/features.h
@@ -0,0 +1,35 @@ +#ifndef SYSROOT_FEATURES_H_ +#define SYSROOT_FEATURES_H_ + +#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE) +#define _GNU_SOURCE 1 +#endif + +#if !defined(_BSD_SOURCE) +#define _BSD_SOURCE 1 +#endif + +#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && \ + !defined(_GNU_SOURCE) && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__) +#define _BSD_SOURCE 1 +#define _XOPEN_SOURCE 700 +#endif + +#if __STDC_VERSION__ >= 199901L +#define __restrict restrict +#elif !defined(__GNUC__) +#define __restrict +#endif + +#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) +#define __inline inline +#endif + +#if __STDC_VERSION__ >= 201112L +#elif defined(__GNUC__) +#define _Noreturn __attribute__((__noreturn__)) +#else +#define _Noreturn +#endif + +#endif // SYSROOT_FEATURES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fenv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fenv.h new file mode 100644 index 0000000..391f59f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fenv.h
@@ -0,0 +1,28 @@ +#ifndef SYSROOT_FENV_H_ +#define SYSROOT_FENV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <bits/fenv.h> + +int feclearexcept(int); +int fegetexceptflag(fexcept_t*, int); +int feraiseexcept(int); +int fesetexceptflag(const fexcept_t*, int); +int fetestexcept(int); + +int fegetround(void); +int fesetround(int); + +int fegetenv(fenv_t*); +int feholdexcept(fenv_t*); +int fesetenv(const fenv_t*); +int feupdateenv(const fenv_t*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FENV_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fmtmsg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fmtmsg.h new file mode 100644 index 0000000..51abcc5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fmtmsg.h
@@ -0,0 +1,47 @@ +#ifndef SYSROOT_FMTMSG_H_ +#define SYSROOT_FMTMSG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MM_HARD 1 +#define MM_SOFT 2 +#define MM_FIRM 4 + +#define MM_APPL 8 +#define MM_UTIL 16 +#define MM_OPSYS 32 + +#define MM_RECOVER 64 +#define MM_NRECOV 128 + +#define MM_PRINT 256 +#define MM_CONSOLE 512 + +#define MM_NULLMC 0L + +#define MM_HALT 1 +#define MM_ERROR 2 +#define MM_WARNING 3 +#define MM_INFO 4 +#define MM_NOSEV 0 + +#define MM_OK 0 +#define MM_NOTOK (-1) +#define MM_NOMSG 1 +#define MM_NOCON 4 + +#define MM_NULLLBL ((char*)0) +#define MM_NULLTXT ((char*)0) +#define MM_NULLACT ((char*)0) +#define MM_NULLTAG ((char*)0) +#define MM_NULLSEV 0 + +int fmtmsg(long, const char*, int, const char*, const char*, const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FMTMSG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fnmatch.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fnmatch.h new file mode 100644 index 0000000..2e0f6cc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/fnmatch.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_FNMATCH_H_ +#define SYSROOT_FNMATCH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define FNM_PATHNAME 0x1 +#define FNM_NOESCAPE 0x2 +#define FNM_PERIOD 0x4 +#define FNM_LEADING_DIR 0x8 +#define FNM_CASEFOLD 0x10 +#define FNM_FILE_NAME FNM_PATHNAME + +#define FNM_NOMATCH 1 +#define FNM_NOSYS (-1) + +int fnmatch(const char*, const char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FNMATCH_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/getopt.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/getopt.h new file mode 100644 index 0000000..bcc632d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/getopt.h
@@ -0,0 +1,30 @@ +#ifndef SYSROOT_GETOPT_H_ +#define SYSROOT_GETOPT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int getopt(int, char* const[], const char*); +extern char* optarg; +extern int optind, opterr, optopt, optreset; + +struct option { + const char* name; + int has_arg; + int* flag; + int val; +}; + +int getopt_long(int, char* const*, const char*, const struct option*, int*); +int getopt_long_only(int, char* const*, const char*, const struct option*, int*); + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_GETOPT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/glob.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/glob.h new file mode 100644 index 0000000..98ff3f6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/glob.h
@@ -0,0 +1,43 @@ +#ifndef SYSROOT_GLOB_H_ +#define SYSROOT_GLOB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +typedef struct { + size_t gl_pathc; + char** gl_pathv; + size_t gl_offs; + int __dummy1; + void* __dummy2[5]; +} glob_t; + +int glob(const char* __restrict, int, int (*)(const char*, int), glob_t* __restrict); +void globfree(glob_t*); + +#define GLOB_ERR 0x01 +#define GLOB_MARK 0x02 +#define GLOB_NOSORT 0x04 +#define GLOB_DOOFFS 0x08 +#define GLOB_NOCHECK 0x10 +#define GLOB_APPEND 0x20 +#define GLOB_NOESCAPE 0x40 +#define GLOB_PERIOD 0x80 + +#define GLOB_NOSPACE 1 +#define GLOB_ABORTED 2 +#define GLOB_NOMATCH 3 +#define GLOB_NOSYS 4 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_GLOB_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/grp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/grp.h new file mode 100644 index 0000000..4cfdd08 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/grp.h
@@ -0,0 +1,51 @@ +#ifndef SYSROOT_GRP_H_ +#define SYSROOT_GRP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include <bits/alltypes.h> + +struct group { + char* gr_name; + char* gr_passwd; + gid_t gr_gid; + char** gr_mem; +}; + +struct group* getgrgid(gid_t); +struct group* getgrnam(const char*); + +int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**); +int getgrnam_r(const char*, struct group*, char*, size_t, struct group**); + +struct group* getgrent(void); +void endgrent(void); +void setgrent(void); + +#ifdef _GNU_SOURCE +struct group* fgetgrent(FILE* stream); +int putgrent(const struct group*, FILE*); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int getgrouplist(const char*, gid_t, gid_t*, int*); +int setgroups(size_t, const gid_t*); +int initgroups(const char*, gid_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_GRP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/iconv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/iconv.h new file mode 100644 index 0000000..c0c056b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/iconv.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_ICONV_H_ +#define SYSROOT_ICONV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +typedef void* iconv_t; + +iconv_t iconv_open(const char*, const char*); +size_t iconv(iconv_t, char** __restrict, size_t* __restrict, char** __restrict, size_t* __restrict); +int iconv_close(iconv_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ICONV_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ifaddrs.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ifaddrs.h new file mode 100644 index 0000000..908945e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ifaddrs.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_IFADDRS_H_ +#define SYSROOT_IFADDRS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <netinet/in.h> +#include <sys/socket.h> + +struct ifaddrs { + struct ifaddrs* ifa_next; + char* ifa_name; + unsigned ifa_flags; + struct sockaddr* ifa_addr; + struct sockaddr* ifa_netmask; + union { + struct sockaddr* ifu_broadaddr; + struct sockaddr* ifu_dstaddr; + } ifa_ifu; + void* ifa_data; +}; +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + +void freeifaddrs(struct ifaddrs* ifp); +int getifaddrs(struct ifaddrs** ifap); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_IFADDRS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/inttypes.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/inttypes.h new file mode 100644 index 0000000..43bf604 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/inttypes.h
@@ -0,0 +1,356 @@ +#ifndef SYSROOT_INTTYPES_H_ +#define SYSROOT_INTTYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define __NEED_wchar_t +#include <bits/alltypes.h> + +typedef struct { + intmax_t quot, rem; +} imaxdiv_t; + +intmax_t imaxabs(intmax_t); +imaxdiv_t imaxdiv(intmax_t, intmax_t); + +intmax_t strtoimax(const char* __restrict, char** __restrict, int); +uintmax_t strtoumax(const char* __restrict, char** __restrict, int); + +intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int); +uintmax_t wcstoumax(const wchar_t* __restrict, wchar_t** __restrict, int); + +// Clang predefines macros __<type>_FMT<letter>__ for each type, +// with <letter> being i and for signed types, and o, u, x, and X +// for unsigned types. That lets <inttypes.h> do its work without +// any special knowledge of what the underlying types are. +// Unfortunately, GCC does not define these macros. +#ifndef __INTMAX_FMTd__ + +#define __INT8_FMT_MODIFIER__ "hh" +#define __INT16_FMT_MODIFIER__ "h" +#define __INT32_FMT_MODIFIER__ "" + +#define __INT_LEAST8_FMT_MODIFIER__ __INT8_FMT_MODIFIER__ +#define __INT_LEAST16_FMT_MODIFIER__ __INT16_FMT_MODIFIER__ +#define __INT_LEAST32_FMT_MODIFIER__ __INT32_FMT_MODIFIER__ +#define __INT_LEAST64_FMT_MODIFIER__ __INT64_FMT_MODIFIER__ + +// The *-elf and arm-eabi GCC targets use 'int' for the fast{8,16,32} +// types. On LP64 systems, 'long' is used for the fast64 type. +#define __INT_FAST8_FMT_MODIFIER__ "" +#define __INT_FAST16_FMT_MODIFIER__ "" +#define __INT_FAST32_FMT_MODIFIER__ "" +#define __INT_FAST64_FMT_MODIFIER__ "l" + +// On machines where 'long' types are 64 bits, the compiler defines +// __INT64_TYPE__ et al using 'long', not 'long long', though both are +// 64-bit types. +#define __INT64_FMT_MODIFIER__ "l" +#define __INTPTR_FMT_MODIFIER__ "l" + +#define __INTMAX_FMT_MODIFIER__ __INT64_FMT_MODIFIER__ + +#define __INTMAX_FMTd__ __INTMAX_FMT_MODIFIER__ "d" +#define __INTMAX_FMTi__ __INTMAX_FMT_MODIFIER__ "i" +#define __UINTMAX_FMTo__ __INTMAX_FMT_MODIFIER__ "o" +#define __UINTMAX_FMTu__ __INTMAX_FMT_MODIFIER__ "u" +#define __UINTMAX_FMTx__ __INTMAX_FMT_MODIFIER__ "x" +#define __UINTMAX_FMTX__ __INTMAX_FMT_MODIFIER__ "X" +#define __INTPTR_FMTd__ __INTPTR_FMT_MODIFIER__ "d" +#define __INTPTR_FMTi__ __INTPTR_FMT_MODIFIER__ "i" +#define __UINTPTR_FMTo__ __INTPTR_FMT_MODIFIER__ "o" +#define __UINTPTR_FMTu__ __INTPTR_FMT_MODIFIER__ "u" +#define __UINTPTR_FMTx__ __INTPTR_FMT_MODIFIER__ "x" +#define __UINTPTR_FMTX__ __INTPTR_FMT_MODIFIER__ "X" +#define __INT8_FMTd__ __INT8_FMT_MODIFIER__ "d" +#define __INT8_FMTi__ __INT8_FMT_MODIFIER__ "i" +#define __INT16_FMTd__ __INT16_FMT_MODIFIER__ "d" +#define __INT16_FMTi__ __INT16_FMT_MODIFIER__ "i" +#define __INT32_FMTd__ __INT32_FMT_MODIFIER__ "d" +#define __INT32_FMTi__ __INT32_FMT_MODIFIER__ "i" +#define __INT64_FMTd__ __INT64_FMT_MODIFIER__ "d" +#define __INT64_FMTi__ __INT64_FMT_MODIFIER__ "i" +#define __UINT8_FMTo__ __INT8_FMT_MODIFIER__ "o" +#define __UINT8_FMTu__ __INT8_FMT_MODIFIER__ "u" +#define __UINT8_FMTx__ __INT8_FMT_MODIFIER__ "x" +#define __UINT8_FMTX__ __INT8_FMT_MODIFIER__ "X" +#define __UINT16_FMTo__ __INT16_FMT_MODIFIER__ "o" +#define __UINT16_FMTu__ __INT16_FMT_MODIFIER__ "u" +#define __UINT16_FMTx__ __INT16_FMT_MODIFIER__ "x" +#define __UINT16_FMTX__ __INT16_FMT_MODIFIER__ "X" +#define __UINT32_FMTo__ __INT32_FMT_MODIFIER__ "o" +#define __UINT32_FMTu__ __INT32_FMT_MODIFIER__ "u" +#define __UINT32_FMTx__ __INT32_FMT_MODIFIER__ "x" +#define __UINT32_FMTX__ __INT32_FMT_MODIFIER__ "X" +#define __UINT64_FMTo__ __INT64_FMT_MODIFIER__ "o" +#define __UINT64_FMTu__ __INT64_FMT_MODIFIER__ "u" +#define __UINT64_FMTx__ __INT64_FMT_MODIFIER__ "x" +#define __UINT64_FMTX__ __INT64_FMT_MODIFIER__ "X" +#define __INT_LEAST8_FMTd__ __INT_LEAST8_FMT_MODIFIER__ "d" +#define __INT_LEAST8_FMTi__ __INT_LEAST8_FMT_MODIFIER__ "i" +#define __UINT_LEAST8_FMTo__ __INT_LEAST8_FMT_MODIFIER__ "o" +#define __UINT_LEAST8_FMTu__ __INT_LEAST8_FMT_MODIFIER__ "u" +#define __UINT_LEAST8_FMTx__ __INT_LEAST8_FMT_MODIFIER__ "x" +#define __UINT_LEAST8_FMTX__ __INT_LEAST8_FMT_MODIFIER__ "X" +#define __INT_LEAST16_FMTd__ __INT_LEAST16_FMT_MODIFIER__ "d" +#define __INT_LEAST16_FMTi__ __INT_LEAST16_FMT_MODIFIER__ "i" +#define __UINT_LEAST16_FMTo__ __INT_LEAST16_FMT_MODIFIER__ "o" +#define __UINT_LEAST16_FMTu__ __INT_LEAST16_FMT_MODIFIER__ "u" +#define __UINT_LEAST16_FMTx__ __INT_LEAST16_FMT_MODIFIER__ "x" +#define __UINT_LEAST16_FMTX__ __INT_LEAST16_FMT_MODIFIER__ "X" +#define __INT_LEAST32_FMTd__ __INT_LEAST32_FMT_MODIFIER__ "d" +#define __INT_LEAST32_FMTi__ __INT_LEAST32_FMT_MODIFIER__ "i" +#define __UINT_LEAST32_FMTo__ __INT_LEAST32_FMT_MODIFIER__ "o" +#define __UINT_LEAST32_FMTu__ __INT_LEAST32_FMT_MODIFIER__ "u" +#define __UINT_LEAST32_FMTx__ __INT_LEAST32_FMT_MODIFIER__ "x" +#define __UINT_LEAST32_FMTX__ __INT_LEAST32_FMT_MODIFIER__ "X" +#define __INT_LEAST64_FMTd__ __INT_LEAST64_FMT_MODIFIER__ "d" +#define __INT_LEAST64_FMTi__ __INT_LEAST64_FMT_MODIFIER__ "i" +#define __UINT_LEAST64_FMTo__ __INT_LEAST64_FMT_MODIFIER__ "o" +#define __UINT_LEAST64_FMTu__ __INT_LEAST64_FMT_MODIFIER__ "u" +#define __UINT_LEAST64_FMTx__ __INT_LEAST64_FMT_MODIFIER__ "x" +#define __UINT_LEAST64_FMTX__ __INT_LEAST64_FMT_MODIFIER__ "X" +#define __INT_FAST8_FMTd__ __INT_FAST8_FMT_MODIFIER__ "d" +#define __INT_FAST8_FMTi__ __INT_FAST8_FMT_MODIFIER__ "i" +#define __UINT_FAST8_FMTo__ __INT_FAST8_FMT_MODIFIER__ "o" +#define __UINT_FAST8_FMTu__ __INT_FAST8_FMT_MODIFIER__ "u" +#define __UINT_FAST8_FMTx__ __INT_FAST8_FMT_MODIFIER__ "x" +#define __UINT_FAST8_FMTX__ __INT_FAST8_FMT_MODIFIER__ "X" +#define __INT_FAST16_FMTd__ __INT_FAST16_FMT_MODIFIER__ "d" +#define __INT_FAST16_FMTi__ __INT_FAST16_FMT_MODIFIER__ "i" +#define __UINT_FAST16_FMTo__ __INT_FAST16_FMT_MODIFIER__ "o" +#define __UINT_FAST16_FMTu__ __INT_FAST16_FMT_MODIFIER__ "u" +#define __UINT_FAST16_FMTx__ __INT_FAST16_FMT_MODIFIER__ "x" +#define __UINT_FAST16_FMTX__ __INT_FAST16_FMT_MODIFIER__ "X" +#define __INT_FAST32_FMTd__ __INT_FAST32_FMT_MODIFIER__ "d" +#define __INT_FAST32_FMTi__ __INT_FAST32_FMT_MODIFIER__ "i" +#define __UINT_FAST32_FMTo__ __INT_FAST32_FMT_MODIFIER__ "o" +#define __UINT_FAST32_FMTu__ __INT_FAST32_FMT_MODIFIER__ "u" +#define __UINT_FAST32_FMTx__ __INT_FAST32_FMT_MODIFIER__ "x" +#define __UINT_FAST32_FMTX__ __INT_FAST32_FMT_MODIFIER__ "X" +#define __INT_FAST64_FMTd__ __INT_FAST64_FMT_MODIFIER__ "d" +#define __INT_FAST64_FMTi__ __INT_FAST64_FMT_MODIFIER__ "i" +#define __UINT_FAST64_FMTo__ __INT_FAST64_FMT_MODIFIER__ "o" +#define __UINT_FAST64_FMTu__ __INT_FAST64_FMT_MODIFIER__ "u" +#define __UINT_FAST64_FMTx__ __INT_FAST64_FMT_MODIFIER__ "x" +#define __UINT_FAST64_FMTX__ __INT_FAST64_FMT_MODIFIER__ "X" + +#endif + +#define PRId8 __INT8_FMTd__ +#define PRId16 __INT16_FMTd__ +#define PRId32 __INT32_FMTd__ +#define PRId64 __INT64_FMTd__ + +#define PRIdLEAST8 __INT_LEAST8_FMTd__ +#define PRIdLEAST16 __INT_LEAST16_FMTd__ +#define PRIdLEAST32 __INT_LEAST32_FMTd__ +#define PRIdLEAST64 __INT_LEAST64_FMTd__ + +#define PRIdFAST8 __INT_FAST8_FMTd__ +#define PRIdFAST16 __INT_FAST16_FMTd__ +#define PRIdFAST32 __INT_FAST32_FMTd__ +#define PRIdFAST64 __INT_FAST64_FMTd__ + +#define PRIi8 __INT8_FMTi__ +#define PRIi16 __INT16_FMTi__ +#define PRIi32 __INT32_FMTi__ +#define PRIi64 __INT64_FMTi__ + +#define PRIiLEAST8 __INT_LEAST8_FMTi__ +#define PRIiLEAST16 __INT_LEAST16_FMTi__ +#define PRIiLEAST32 __INT_LEAST32_FMTi__ +#define PRIiLEAST64 __INT_LEAST64_FMTi__ + +#define PRIiFAST8 __INT_FAST8_FMTi__ +#define PRIiFAST16 __INT_FAST16_FMTi__ +#define PRIiFAST32 __INT_FAST32_FMTi__ +#define PRIiFAST64 __INT_FAST64_FMTi__ + +#define PRIo8 __UINT8_FMTo__ +#define PRIo16 __UINT16_FMTo__ +#define PRIo32 __UINT32_FMTo__ +#define PRIo64 __UINT64_FMTo__ + +#define PRIoLEAST8 __UINT_LEAST8_FMTo__ +#define PRIoLEAST16 __UINT_LEAST16_FMTo__ +#define PRIoLEAST32 __UINT_LEAST32_FMTo__ +#define PRIoLEAST64 __UINT_LEAST64_FMTo__ + +#define PRIoFAST8 __UINT_FAST8_FMTo__ +#define PRIoFAST16 __UINT_FAST16_FMTo__ +#define PRIoFAST32 __UINT_FAST32_FMTo__ +#define PRIoFAST64 __UINT_FAST64_FMTo__ + +#define PRIu8 __UINT8_FMTu__ +#define PRIu16 __UINT16_FMTu__ +#define PRIu32 __UINT32_FMTu__ +#define PRIu64 __UINT64_FMTu__ + +#define PRIuLEAST8 __UINT_LEAST8_FMTu__ +#define PRIuLEAST16 __UINT_LEAST16_FMTu__ +#define PRIuLEAST32 __UINT_LEAST32_FMTu__ +#define PRIuLEAST64 __UINT_LEAST64_FMTu__ + +#define PRIuFAST8 __UINT_FAST8_FMTu__ +#define PRIuFAST16 __UINT_FAST16_FMTu__ +#define PRIuFAST32 __UINT_FAST32_FMTu__ +#define PRIuFAST64 __UINT_FAST64_FMTu__ + +#define PRIx8 __UINT8_FMTx__ +#define PRIx16 __UINT16_FMTx__ +#define PRIx32 __UINT32_FMTx__ +#define PRIx64 __UINT64_FMTx__ + +#define PRIxLEAST8 __UINT_LEAST8_FMTx__ +#define PRIxLEAST16 __UINT_LEAST16_FMTx__ +#define PRIxLEAST32 __UINT_LEAST32_FMTx__ +#define PRIxLEAST64 __UINT_LEAST64_FMTx__ + +#define PRIxFAST8 __UINT_FAST8_FMTx__ +#define PRIxFAST16 __UINT_FAST16_FMTx__ +#define PRIxFAST32 __UINT_FAST32_FMTx__ +#define PRIxFAST64 __UINT_FAST64_FMTx__ + +#define PRIX8 __UINT8_FMTX__ +#define PRIX16 __UINT16_FMTX__ +#define PRIX32 __UINT32_FMTX__ +#define PRIX64 __UINT64_FMTX__ + +#define PRIXLEAST8 __UINT_LEAST8_FMTX__ +#define PRIXLEAST16 __UINT_LEAST16_FMTX__ +#define PRIXLEAST32 __UINT_LEAST32_FMTX__ +#define PRIXLEAST64 __UINT_LEAST64_FMTX__ + +#define PRIXFAST8 __UINT_FAST8_FMTX__ +#define PRIXFAST16 __UINT_FAST16_FMTX__ +#define PRIXFAST32 __UINT_FAST32_FMTX__ +#define PRIXFAST64 __UINT_FAST64_FMTX__ + +#define PRIdMAX __INTMAX_FMTd__ +#define PRIiMAX __INTMAX_FMTi__ +#define PRIoMAX __UINTMAX_FMTo__ +#define PRIuMAX __UINTMAX_FMTu__ +#define PRIxMAX __UINTMAX_FMTx__ +#define PRIXMAX __UINTMAX_FMTX__ + +#define PRIdPTR __INTPTR_FMTd__ +#define PRIiPTR __INTPTR_FMTi__ +#define PRIoPTR __UINTPTR_FMTo__ +#define PRIuPTR __UINTPTR_FMTu__ +#define PRIxPTR __UINTPTR_FMTx__ +#define PRIXPTR __UINTPTR_FMTX__ + +#define SCNd8 __INT8_FMTd__ +#define SCNd16 __INT16_FMTd__ +#define SCNd32 __INT32_FMTd__ +#define SCNd64 __INT64_FMTd__ + +#define SCNdLEAST8 __INT_LEAST8_FMTd__ +#define SCNdLEAST16 __INT_LEAST16_FMTd__ +#define SCNdLEAST32 __INT_LEAST32_FMTd__ +#define SCNdLEAST64 __INT_LEAST64_FMTd__ + +#define SCNdFAST8 __INT_FAST8_FMTd__ +#define SCNdFAST16 __INT_FAST16_FMTd__ +#define SCNdFAST32 __INT_FAST32_FMTd__ +#define SCNdFAST64 __INT_FAST64_FMTd__ + +#define SCNi8 __INT8_FMTi__ +#define SCNi16 __INT16_FMTi__ +#define SCNi32 __INT32_FMTi__ +#define SCNi64 __INT64_FMTi__ + +#define SCNiLEAST8 __INT_LEAST8_FMTi__ +#define SCNiLEAST16 __INT_LEAST16_FMTi__ +#define SCNiLEAST32 __INT_LEAST32_FMTi__ +#define SCNiLEAST64 __INT_LEAST64_FMTi__ + +#define SCNiFAST8 __INT_FAST8_FMTi__ +#define SCNiFAST16 __INT_FAST16_FMTi__ +#define SCNiFAST32 __INT_FAST32_FMTi__ +#define SCNiFAST64 __INT_FAST64_FMTi__ + +#define SCNo8 __UINT8_FMTo__ +#define SCNo16 __UINT16_FMTo__ +#define SCNo32 __UINT32_FMTo__ +#define SCNo64 __UINT64_FMTo__ + +#define SCNoLEAST8 __UINT_LEAST8_FMTo__ +#define SCNoLEAST16 __UINT_LEAST16_FMTo__ +#define SCNoLEAST32 __UINT_LEAST32_FMTo__ +#define SCNoLEAST64 __UINT_LEAST64_FMTo__ + +#define SCNoFAST8 __UINT_FAST8_FMTo__ +#define SCNoFAST16 __UINT_FAST16_FMTo__ +#define SCNoFAST32 __UINT_FAST32_FMTo__ +#define SCNoFAST64 __UINT_FAST64_FMTo__ + +#define SCNu8 __UINT8_FMTu__ +#define SCNu16 __UINT16_FMTu__ +#define SCNu32 __UINT32_FMTu__ +#define SCNu64 __UINT64_FMTu__ + +#define SCNuLEAST8 __UINT_LEAST8_FMTu__ +#define SCNuLEAST16 __UINT_LEAST16_FMTu__ +#define SCNuLEAST32 __UINT_LEAST32_FMTu__ +#define SCNuLEAST64 __UINT_LEAST64_FMTu__ + +#define SCNuFAST8 __UINT_FAST8_FMTu__ +#define SCNuFAST16 __UINT_FAST16_FMTu__ +#define SCNuFAST32 __UINT_FAST32_FMTu__ +#define SCNuFAST64 __UINT_FAST64_FMTu__ + +#define SCNx8 __UINT8_FMTx__ +#define SCNx16 __UINT16_FMTx__ +#define SCNx32 __UINT32_FMTx__ +#define SCNx64 __UINT64_FMTx__ + +#define SCNxLEAST8 __UINT_LEAST8_FMTx__ +#define SCNxLEAST16 __UINT_LEAST16_FMTx__ +#define SCNxLEAST32 __UINT_LEAST32_FMTx__ +#define SCNxLEAST64 __UINT_LEAST64_FMTx__ + +#define SCNxFAST8 __UINT_FAST8_FMTx__ +#define SCNxFAST16 __UINT_FAST16_FMTx__ +#define SCNxFAST32 __UINT_FAST32_FMTx__ +#define SCNxFAST64 __UINT_FAST64_FMTx__ + +#define SCNX8 __UINT8_FMTX__ +#define SCNX16 __UINT16_FMTX__ +#define SCNX32 __UINT32_FMTX__ +#define SCNX64 __UINT64_FMTX__ + +#define SCNXLEAST8 __UINT_LEAST8_FMTX__ +#define SCNXLEAST16 __UINT_LEAST16_FMTX__ +#define SCNXLEAST32 __UINT_LEAST32_FMTX__ +#define SCNXLEAST64 __UINT_LEAST64_FMTX__ + +#define SCNXFAST8 __UINT_FAST8_FMTX__ +#define SCNXFAST16 __UINT_FAST16_FMTX__ +#define SCNXFAST32 __UINT_FAST32_FMTX__ +#define SCNXFAST64 __UINT_FAST64_FMTX__ + +#define SCNdMAX __INTMAX_FMTd__ +#define SCNiMAX __INTMAX_FMTi__ +#define SCNoMAX __UINTMAX_FMTo__ +#define SCNuMAX __UINTMAX_FMTu__ +#define SCNxMAX __UINTMAX_FMTx__ +#define SCNXMAX __UINTMAX_FMTX__ + +#define SCNdPTR __INTPTR_FMTd__ +#define SCNiPTR __INTPTR_FMTi__ +#define SCNoPTR __UINTPTR_FMTo__ +#define SCNuPTR __UINTPTR_FMTu__ +#define SCNxPTR __UINTPTR_FMTx__ +#define SCNXPTR __UINTPTR_FMTX__ + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_INTTYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/iso646.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/iso646.h new file mode 100644 index 0000000..8b7dda8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/iso646.h
@@ -0,0 +1,20 @@ +#ifndef SYSROOT_ISO646_H_ +#define SYSROOT_ISO646_H_ + +#ifndef __cplusplus + +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= + +#endif + +#endif // SYSROOT_ISO646_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/langinfo.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/langinfo.h new file mode 100644 index 0000000..a14fcfd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/langinfo.h
@@ -0,0 +1,92 @@ +#ifndef SYSROOT_LANGINFO_H_ +#define SYSROOT_LANGINFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <nl_types.h> + +#define __NEED_locale_t + +#include <bits/alltypes.h> + +#define ABDAY_1 0x20000 +#define ABDAY_2 0x20001 +#define ABDAY_3 0x20002 +#define ABDAY_4 0x20003 +#define ABDAY_5 0x20004 +#define ABDAY_6 0x20005 +#define ABDAY_7 0x20006 + +#define DAY_1 0x20007 +#define DAY_2 0x20008 +#define DAY_3 0x20009 +#define DAY_4 0x2000A +#define DAY_5 0x2000B +#define DAY_6 0x2000C +#define DAY_7 0x2000D + +#define ABMON_1 0x2000E +#define ABMON_2 0x2000F +#define ABMON_3 0x20010 +#define ABMON_4 0x20011 +#define ABMON_5 0x20012 +#define ABMON_6 0x20013 +#define ABMON_7 0x20014 +#define ABMON_8 0x20015 +#define ABMON_9 0x20016 +#define ABMON_10 0x20017 +#define ABMON_11 0x20018 +#define ABMON_12 0x20019 + +#define MON_1 0x2001A +#define MON_2 0x2001B +#define MON_3 0x2001C +#define MON_4 0x2001D +#define MON_5 0x2001E +#define MON_6 0x2001F +#define MON_7 0x20020 +#define MON_8 0x20021 +#define MON_9 0x20022 +#define MON_10 0x20023 +#define MON_11 0x20024 +#define MON_12 0x20025 + +#define AM_STR 0x20026 +#define PM_STR 0x20027 + +#define D_T_FMT 0x20028 +#define D_FMT 0x20029 +#define T_FMT 0x2002A +#define T_FMT_AMPM 0x2002B + +#define ERA 0x2002C +#define ERA_D_FMT 0x2002E +#define ALT_DIGITS 0x2002F +#define ERA_D_T_FMT 0x20030 +#define ERA_T_FMT 0x20031 + +#define CODESET 14 + +#define CRNCYSTR 0x4000F + +#define RADIXCHAR 0x10000 +#define THOUSEP 0x10001 +#define YESEXPR 0x50000 +#define NOEXPR 0x50001 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define YESSTR 0x50002 +#define NOSTR 0x50003 +#endif + +char* nl_langinfo(nl_item); +char* nl_langinfo_l(nl_item, locale_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LANGINFO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/libgen.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/libgen.h new file mode 100644 index 0000000..f7f79b6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/libgen.h
@@ -0,0 +1,15 @@ +#ifndef SYSROOT_LIBGEN_H_ +#define SYSROOT_LIBGEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +char* dirname(char*); +char* basename(char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LIBGEN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/limits.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/limits.h new file mode 100644 index 0000000..cf60386 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/limits.h
@@ -0,0 +1,153 @@ +#ifndef SYSROOT_LIMITS_H_ +#define SYSROOT_LIMITS_H_ + +#include <features.h> + +/* Most limits are system-specific */ + +#include <bits/limits.h> + +/* Support signed or unsigned plain-char */ + +#if '\0' - 1 > 0 +#define CHAR_MIN 0 +#define CHAR_MAX 255 +#else +#define CHAR_MIN (-128) +#define CHAR_MAX 127 +#endif + +/* Some universal constants... */ + +#define CHAR_BIT 8 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 255 +#define SHRT_MIN (-1 - 0x7fff) +#define SHRT_MAX 0x7fff +#define USHRT_MAX 0xffff +#define INT_MIN (-1 - 0x7fffffff) +#define INT_MAX 0x7fffffff +#define UINT_MAX 0xffffffffU +#define LONG_MIN (-LONG_MAX - 1) +#define ULONG_MAX (2UL * LONG_MAX + 1) +#define LLONG_MIN (-LLONG_MAX - 1) +#define ULLONG_MAX (2ULL * LLONG_MAX + 1) + +#define MB_LEN_MAX 4 + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define PIPE_BUF 4096 +#ifdef PAGE_SIZE +#define PAGESIZE PAGE_SIZE +#endif +#define FILESIZEBITS 64 +#define NAME_MAX 255 +#define SYMLINK_MAX 255 +#define PATH_MAX 4096 +#define NZERO 20 +#define NGROUPS_MAX 32 +#define IOV_MAX 1024 +#define SYMLOOP_MAX 40 +#define WORD_BIT 32 +#define SSIZE_MAX LONG_MAX +#define TZNAME_MAX 6 +#define TTY_NAME_MAX 32 +#define HOST_NAME_MAX 255 + +/* Implementation choices... */ + +#define PTHREAD_KEYS_MAX 128 +#define PTHREAD_STACK_MIN 3072 +#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +#define SEM_VALUE_MAX 0x7fffffff +#define SEM_NSEMS_MAX 256 +#define DELAYTIMER_MAX 0x7fffffff +#define MQ_PRIO_MAX 32768 +#define LOGIN_NAME_MAX 256 + +/* Arbitrary numbers... */ + +#define BC_BASE_MAX 99 +#define BC_DIM_MAX 2048 +#define BC_SCALE_MAX 99 +#define BC_STRING_MAX 1000 +#define CHARCLASS_NAME_MAX 14 +#define COLL_WEIGHTS_MAX 2 +#define EXPR_NEST_MAX 32 +#define LINE_MAX 4096 +#define RE_DUP_MAX 255 + +#define NL_ARGMAX 9 +#define NL_LANGMAX 32 +#define NL_MSGMAX 32767 +#define NL_SETMAX 255 +#define NL_TEXTMAX 2048 + +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) + +#define NL_NMAX 16 + +#endif + +/* POSIX/SUS requirements follow. These numbers come directly + * from SUS and have nothing to do with the host system. */ + +#define _POSIX_AIO_LISTIO_MAX 2 +#define _POSIX_AIO_MAX 1 +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 25 +#define _POSIX_CLOCKRES_MIN 20000000 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_HOST_NAME_MAX 255 +#define _POSIX_LINK_MAX 8 +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_MQ_OPEN_MAX 8 +#define _POSIX_MQ_PRIO_MAX 32 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 8 +#define _POSIX_OPEN_MAX 20 +#define _POSIX_PATH_MAX 256 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_RE_DUP_MAX 255 +#define _POSIX_RTSIG_MAX 8 +#define _POSIX_SEM_NSEMS_MAX 256 +#define _POSIX_SEM_VALUE_MAX 32767 +#define _POSIX_SIGQUEUE_MAX 32 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_SS_REPL_MAX 4 +#define _POSIX_SYMLINK_MAX 255 +#define _POSIX_SYMLOOP_MAX 8 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 128 +#define _POSIX_THREAD_THREADS_MAX 64 +#define _POSIX_TIMER_MAX 32 +#define _POSIX_TRACE_EVENT_NAME_MAX 30 +#define _POSIX_TRACE_NAME_MAX 8 +#define _POSIX_TRACE_SYS_MAX 8 +#define _POSIX_TRACE_USER_EVENT_MAX 32 +#define _POSIX_TTY_NAME_MAX 9 +#define _POSIX_TZNAME_MAX 6 +#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_CHARCLASS_NAME_MAX 14 +#define _POSIX2_COLL_WEIGHTS_MAX 2 +#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_RE_DUP_MAX 255 + +#define _XOPEN_IOV_MAX 16 +#define _XOPEN_NAME_MAX 255 +#define _XOPEN_PATH_MAX 1024 + +#endif // SYSROOT_LIMITS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/link.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/link.h new file mode 100644 index 0000000..78ebd48 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/link.h
@@ -0,0 +1,61 @@ +#ifndef SYSROOT_LINK_H_ +#define SYSROOT_LINK_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <elf.h> +#define __NEED_size_t +#define __NEED_uint32_t +#include <bits/alltypes.h> + +#define ElfW(type) Elf64_##type + +/* this is the same everywhere except alpha and s390 */ +typedef uint32_t Elf_Symndx; + +struct dl_phdr_info { + ElfW(Addr) dlpi_addr; + const char* dlpi_name; + const ElfW(Phdr) * dlpi_phdr; + ElfW(Half) dlpi_phnum; + unsigned long long int dlpi_adds; + unsigned long long int dlpi_subs; + size_t dlpi_tls_modid; + void* dlpi_tls_data; +}; + +struct link_map { + ElfW(Addr) l_addr; + char* l_name; + ElfW(Dyn) * l_ld; + struct link_map *l_next, *l_prev; +}; + +struct r_debug { + int r_version; + struct link_map* r_map; + ElfW(Addr) r_brk; + + /* This is the address of a function internal to the run-time linker + that triggers a debug trap. This function will always be called + when the linker begins to map in a library or unmap it, and again + when the mapping change is complete. + + The debugger can compare the address of a sw exception to this value + to determine whether the debug trap was triggered by the run-time + linker. */ + ElfW(Addr) r_brk_on_load; + + enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state; + ElfW(Addr) r_ldbase; +}; + +int dl_iterate_phdr(int (*)(struct dl_phdr_info*, size_t, void*), void*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LINK_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/locale.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/locale.h new file mode 100644 index 0000000..ce78a02 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/locale.h
@@ -0,0 +1,79 @@ +#ifndef SYSROOT_LOCALE_H_ +#define SYSROOT_LOCALE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define LC_CTYPE 0 +#define LC_NUMERIC 1 +#define LC_TIME 2 +#define LC_COLLATE 3 +#define LC_MONETARY 4 +#define LC_MESSAGES 5 +#define LC_ALL 6 + +struct lconv { + char* decimal_point; + char* thousands_sep; + char* grouping; + + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +}; + +char* setlocale(int, const char*); +struct lconv* localeconv(void); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define __NEED_locale_t + +#include <bits/alltypes.h> + +#define LC_GLOBAL_LOCALE ((locale_t)-1) + +#define LC_CTYPE_MASK (1 << LC_CTYPE) +#define LC_NUMERIC_MASK (1 << LC_NUMERIC) +#define LC_TIME_MASK (1 << LC_TIME) +#define LC_COLLATE_MASK (1 << LC_COLLATE) +#define LC_MONETARY_MASK (1 << LC_MONETARY) +#define LC_MESSAGES_MASK (1 << LC_MESSAGES) +#define LC_ALL_MASK 0x7fffffff + +locale_t duplocale(locale_t); +void freelocale(locale_t); +locale_t newlocale(int, const char*, locale_t); +locale_t uselocale(locale_t); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LOCALE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/malloc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/malloc.h new file mode 100644 index 0000000..6abb854 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/malloc.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_MALLOC_H_ +#define SYSROOT_MALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t + +#include <bits/alltypes.h> + +void* malloc(size_t); +void* calloc(size_t, size_t); +void* realloc(void*, size_t); +void free(void*); +void* valloc(size_t); +void* memalign(size_t, size_t); + +size_t malloc_usable_size(void*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_MALLOC_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/math.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/math.h new file mode 100644 index 0000000..089c266 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/math.h
@@ -0,0 +1,430 @@ +#ifndef SYSROOT_MATH_H_ +#define SYSROOT_MATH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_float_t +#define __NEED_double_t +#include <bits/alltypes.h> + +#if 100 * __GNUC__ + __GNUC_MINOR__ >= 303 +#define NAN __builtin_nanf("") +#define INFINITY __builtin_inff() +#else +#define NAN (0.0f / 0.0f) +#define INFINITY 1e5000f +#endif + +#define HUGE_VALF INFINITY +#define HUGE_VAL ((double)INFINITY) +#define HUGE_VALL ((long double)INFINITY) + +#define MATH_ERRNO 1 +#define MATH_ERREXCEPT 2 +#define math_errhandling 2 + +#define FP_ILOGBNAN (-1 - (int)(((unsigned)-1) >> 1)) +#define FP_ILOGB0 FP_ILOGBNAN + +#define FP_NAN 0 +#define FP_INFINITE 1 +#define FP_ZERO 2 +#define FP_SUBNORMAL 3 +#define FP_NORMAL 4 + +int __fpclassify(double); +int __fpclassifyf(float); +int __fpclassifyl(long double); + +static __inline unsigned __FLOAT_BITS(float __f) { + union { + float __f; + unsigned __i; + } __u; + __u.__f = __f; + return __u.__i; +} +static __inline unsigned long long __DOUBLE_BITS(double __f) { + union { + double __f; + unsigned long long __i; + } __u; + __u.__f = __f; + return __u.__i; +} + +#define fpclassify(x) \ + (sizeof(x) == sizeof(float) ? __fpclassifyf(x) \ + : sizeof(x) == sizeof(double) ? __fpclassify(x) : __fpclassifyl(x)) + +#define isinf(x) \ + (sizeof(x) == sizeof(float) \ + ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 \ + : sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL >> 1) == 0x7ffULL << 52 \ + : __fpclassifyl(x) == FP_INFINITE) + +#define isnan(x) \ + (sizeof(x) == sizeof(float) \ + ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 \ + : sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL >> 1) > 0x7ffULL << 52 \ + : __fpclassifyl(x) == FP_NAN) + +#define isnormal(x) \ + (sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x) + 0x00800000) & 0x7fffffff) >= 0x01000000 \ + : sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x) + (1ULL << 52)) & \ + -1ULL >> 1) >= 1ULL << 53 \ + : __fpclassifyl(x) == FP_NORMAL) + +#define isfinite(x) \ + (sizeof(x) == sizeof(float) \ + ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 \ + : sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL >> 1) < 0x7ffULL << 52 \ + : __fpclassifyl(x) > FP_INFINITE) + +int __signbit(double); +int __signbitf(float); +int __signbitl(long double); + +#define signbit(x) \ + (sizeof(x) == sizeof(float) \ + ? (int)(__FLOAT_BITS(x) >> 31) \ + : sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x) >> 63) : __signbitl(x)) + +#define isunordered(x, y) __builtin_isunordered(x, y) + +#define __ISREL_DEF(rel, op, type) \ + static __inline int __is##rel(type __x, type __y) { return !isunordered(__x, __y) && __x op __y; } + +__ISREL_DEF(lessf, <, float_t) +__ISREL_DEF(less, <, double_t) +__ISREL_DEF(lessl, <, long double) +__ISREL_DEF(lessequalf, <=, float_t) +__ISREL_DEF(lessequal, <=, double_t) +__ISREL_DEF(lessequall, <=, long double) +__ISREL_DEF(lessgreaterf, !=, float_t) +__ISREL_DEF(lessgreater, !=, double_t) +__ISREL_DEF(lessgreaterl, !=, long double) +__ISREL_DEF(greaterf, >, float_t) +__ISREL_DEF(greater, >, double_t) +__ISREL_DEF(greaterl, >, long double) +__ISREL_DEF(greaterequalf, >=, float_t) +__ISREL_DEF(greaterequal, >=, double_t) +__ISREL_DEF(greaterequall, >=, long double) + +#define isless(x, y) __builtin_isless(x, y) +#define islessequal(x, y) __builtin_islessequal(x, y) +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#define isgreater(x, y) __builtin_isgreater(x, y) +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) + +double acos(double); +float acosf(float); +long double acosl(long double); + +double acosh(double); +float acoshf(float); +long double acoshl(long double); + +double asin(double); +float asinf(float); +long double asinl(long double); + +double asinh(double); +float asinhf(float); +long double asinhl(long double); + +double atan(double); +float atanf(float); +long double atanl(long double); + +double atan2(double, double); +float atan2f(float, float); +long double atan2l(long double, long double); + +double atanh(double); +float atanhf(float); +long double atanhl(long double); + +double cbrt(double); +float cbrtf(float); +long double cbrtl(long double); + +double ceil(double); +float ceilf(float); +long double ceill(long double); + +double copysign(double, double); +float copysignf(float, float); +long double copysignl(long double, long double); + +double cos(double); +float cosf(float); +long double cosl(long double); + +double cosh(double); +float coshf(float); +long double coshl(long double); + +double erf(double); +float erff(float); +long double erfl(long double); + +double erfc(double); +float erfcf(float); +long double erfcl(long double); + +double exp(double); +float expf(float); +long double expl(long double); + +double exp2(double); +float exp2f(float); +long double exp2l(long double); + +double expm1(double); +float expm1f(float); +long double expm1l(long double); + +double fabs(double); +float fabsf(float); +long double fabsl(long double); + +double fdim(double, double); +float fdimf(float, float); +long double fdiml(long double, long double); + +double floor(double); +float floorf(float); +long double floorl(long double); + +double fma(double, double, double); +float fmaf(float, float, float); +long double fmal(long double, long double, long double); + +double fmax(double, double); +float fmaxf(float, float); +long double fmaxl(long double, long double); + +double fmin(double, double); +float fminf(float, float); +long double fminl(long double, long double); + +double fmod(double, double); +float fmodf(float, float); +long double fmodl(long double, long double); + +double frexp(double, int*); +float frexpf(float, int*); +long double frexpl(long double, int*); + +double hypot(double, double); +float hypotf(float, float); +long double hypotl(long double, long double); + +int ilogb(double); +int ilogbf(float); +int ilogbl(long double); + +double ldexp(double, int); +float ldexpf(float, int); +long double ldexpl(long double, int); + +double lgamma(double); +float lgammaf(float); +long double lgammal(long double); + +long long llrint(double); +long long llrintf(float); +long long llrintl(long double); + +long long llround(double); +long long llroundf(float); +long long llroundl(long double); + +double log(double); +float logf(float); +long double logl(long double); + +double log10(double); +float log10f(float); +long double log10l(long double); + +double log1p(double); +float log1pf(float); +long double log1pl(long double); + +double log2(double); +float log2f(float); +long double log2l(long double); + +double logb(double); +float logbf(float); +long double logbl(long double); + +long lrint(double); +long lrintf(float); +long lrintl(long double); + +long lround(double); +long lroundf(float); +long lroundl(long double); + +double modf(double, double*); +float modff(float, float*); +long double modfl(long double, long double*); + +double nan(const char*); +float nanf(const char*); +long double nanl(const char*); + +double nearbyint(double); +float nearbyintf(float); +long double nearbyintl(long double); + +double nextafter(double, double); +float nextafterf(float, float); +long double nextafterl(long double, long double); + +double nexttoward(double, long double); +float nexttowardf(float, long double); +long double nexttowardl(long double, long double); + +double pow(double, double); +float powf(float, float); +long double powl(long double, long double); + +double remainder(double, double); +float remainderf(float, float); +long double remainderl(long double, long double); + +double remquo(double, double, int*); +float remquof(float, float, int*); +long double remquol(long double, long double, int*); + +double rint(double); +float rintf(float); +long double rintl(long double); + +double round(double); +float roundf(float); +long double roundl(long double); + +double scalbln(double, long); +float scalblnf(float, long); +long double scalblnl(long double, long); + +double scalbn(double, int); +float scalbnf(float, int); +long double scalbnl(long double, int); + +double sin(double); +float sinf(float); +long double sinl(long double); + +double sinh(double); +float sinhf(float); +long double sinhl(long double); + +double sqrt(double); +float sqrtf(float); +long double sqrtl(long double); + +double tan(double); +float tanf(float); +long double tanl(long double); + +double tanh(double); +float tanhf(float); +long double tanhl(long double); + +double tgamma(double); +float tgammaf(float); +long double tgammal(long double); + +double trunc(double); +float truncf(float); +long double truncl(long double); + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) +#undef MAXFLOAT +#define MAXFLOAT 3.40282346638528859812e+38F +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define M_E 2.7182818284590452354 /* e */ +#define M_LOG2E 1.4426950408889634074 /* log_2 e */ +#define M_LOG10E 0.43429448190325182765 /* log_10 e */ +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#define M_PI 3.14159265358979323846 /* pi */ +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +extern int signgam; + +double j0(double); +double j1(double); +double jn(int, double); + +double y0(double); +double y1(double); +double yn(int, double); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define HUGE 3.40282346638528859812e+38F + +double drem(double, double); +float dremf(float, float); + +int finite(double); +int finitef(float); + +double scalb(double, double); +float scalbf(float, float); + +double significand(double); +float significandf(float); + +double lgamma_r(double, int*); +float lgammaf_r(float, int*); + +float j0f(float); +float j1f(float); +float jnf(int, float); + +float y0f(float); +float y1f(float); +float ynf(int, float); +#endif + +#ifdef _GNU_SOURCE +long double lgammal_r(long double, int*); + +void sincos(double, double*, double*); +void sincosf(float, float*, float*); +void sincosl(long double, long double*, long double*); + +double exp10(double); +float exp10f(float); +long double exp10l(long double); + +double pow10(double); +float pow10f(float); +long double pow10l(long double); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_MATH_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/memory.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/memory.h new file mode 100644 index 0000000..3b2f590 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/memory.h
@@ -0,0 +1 @@ +#include <string.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/monetary.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/monetary.h new file mode 100644 index 0000000..d1955fa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/monetary.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_MONETARY_H_ +#define SYSROOT_MONETARY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_ssize_t +#define __NEED_size_t +#define __NEED_locale_t + +#include <bits/alltypes.h> + +ssize_t strfmon(char* __restrict, size_t, const char* __restrict, ...); +ssize_t strfmon_l(char* __restrict, size_t, locale_t, const char* __restrict, ...); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_MONETARY_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/ethernet.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/ethernet.h new file mode 100644 index 0000000..9cee87d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/ethernet.h
@@ -0,0 +1,53 @@ +#ifndef SYSROOT_NET_ETHERNET_H_ +#define SYSROOT_NET_ETHERNET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/if_ether.h> +#include <stdint.h> +#include <sys/types.h> + +struct ether_addr { + uint8_t ether_addr_octet[ETH_ALEN]; +}; + +struct ether_header { + uint8_t ether_dhost[ETH_ALEN]; + uint8_t ether_shost[ETH_ALEN]; + uint16_t ether_type; +}; + +#define ETHERTYPE_PUP 0x0200 +#define ETHERTYPE_SPRITE 0x0500 +#define ETHERTYPE_IP 0x0800 +#define ETHERTYPE_ARP 0x0806 +#define ETHERTYPE_REVARP 0x8035 +#define ETHERTYPE_AT 0x809B +#define ETHERTYPE_AARP 0x80F3 +#define ETHERTYPE_VLAN 0x8100 +#define ETHERTYPE_IPX 0x8137 +#define ETHERTYPE_IPV6 0x86dd +#define ETHERTYPE_LOOPBACK 0x9000 + +#define ETHER_ADDR_LEN ETH_ALEN +#define ETHER_TYPE_LEN 2 +#define ETHER_CRC_LEN 4 +#define ETHER_HDR_LEN ETH_HLEN +#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) +#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) + +#define ETHER_IS_VALID_LEN(foo) ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +#define ETHERTYPE_TRAIL 0x1000 +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU ETH_DATA_LEN +#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_ETHERNET_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/if.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/if.h new file mode 100644 index 0000000..e97c3ee --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/if.h
@@ -0,0 +1,132 @@ +#ifndef SYSROOT_NET_IF_H_ +#define SYSROOT_NET_IF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define IF_NAMESIZE 16 + +struct if_nameindex { + unsigned int if_index; + char* if_name; +}; + +unsigned int if_nametoindex(const char*); +char* if_indextoname(unsigned int, char*); +struct if_nameindex* if_nameindex(void); +void if_freenameindex(struct if_nameindex*); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#include <sys/socket.h> + +#define IFF_UP 0x1 +#define IFF_BROADCAST 0x2 +#define IFF_DEBUG 0x4 +#define IFF_LOOPBACK 0x8 +#define IFF_POINTOPOINT 0x10 +#define IFF_NOTRAILERS 0x20 +#define IFF_RUNNING 0x40 +#define IFF_NOARP 0x80 +#define IFF_PROMISC 0x100 +#define IFF_ALLMULTI 0x200 +#define IFF_MASTER 0x400 +#define IFF_SLAVE 0x800 +#define IFF_MULTICAST 0x1000 +#define IFF_PORTSEL 0x2000 +#define IFF_AUTOMEDIA 0x4000 +#define IFF_DYNAMIC 0x8000 +#define IFF_LOWER_UP 0x10000 +#define IFF_DORMANT 0x20000 +#define IFF_ECHO 0x40000 +#define IFF_VOLATILE \ + (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST | IFF_ECHO | IFF_MASTER | IFF_SLAVE | \ + IFF_RUNNING | IFF_LOWER_UP | IFF_DORMANT) + +struct ifaddr { + struct sockaddr ifa_addr; + union { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct iface* ifa_ifp; + struct ifaddr* ifa_next; +}; + +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + +struct ifmap { + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; +}; + +#define IFHWADDRLEN 6 +#define IFNAMSIZ IF_NAMESIZE + +struct ifreq { + union { + char ifrn_name[IFNAMSIZ]; + } ifr_ifrn; + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; + char ifru_newname[IFNAMSIZ]; + void* ifru_data; + } ifr_ifru; +}; + +#define ifr_name ifr_ifrn.ifrn_name +#define ifr_hwaddr ifr_ifru.ifru_hwaddr +#define ifr_addr ifr_ifru.ifru_addr +#define ifr_dstaddr ifr_ifru.ifru_dstaddr +#define ifr_broadaddr ifr_ifru.ifru_broadaddr +#define ifr_netmask ifr_ifru.ifru_netmask +#define ifr_flags ifr_ifru.ifru_flags +#define ifr_metric ifr_ifru.ifru_ivalue +#define ifr_mtu ifr_ifru.ifru_mtu +#define ifr_map ifr_ifru.ifru_map +#define ifr_slave ifr_ifru.ifru_slave +#define ifr_data ifr_ifru.ifru_data +#define ifr_ifindex ifr_ifru.ifru_ivalue +#define ifr_bandwidth ifr_ifru.ifru_ivalue +#define ifr_qlen ifr_ifru.ifru_ivalue +#define ifr_newname ifr_ifru.ifru_newname +#define _IOT_ifreq _IOT(_IOTS(char), IFNAMSIZ, _IOTS(char), 16, 0, 0) +#define _IOT_ifreq_short _IOT(_IOTS(char), IFNAMSIZ, _IOTS(short), 1, 0, 0) +#define _IOT_ifreq_int _IOT(_IOTS(char), IFNAMSIZ, _IOTS(int), 1, 0, 0) + +struct ifconf { + int ifc_len; + union { + void* ifcu_buf; + struct ifreq* ifcu_req; + } ifc_ifcu; +}; + +#define ifc_buf ifc_ifcu.ifcu_buf +#define ifc_req ifc_ifcu.ifcu_req +#define _IOT_ifconf _IOT(_IOTS(struct ifconf), 1, 0, 0, 0, 0) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_IF_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/if_arp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/if_arp.h new file mode 100644 index 0000000..40b902d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/if_arp.h
@@ -0,0 +1,139 @@ +/* Nonstandard header */ + +#ifndef SYSROOT_NET_IF_ARP_H_ +#define SYSROOT_NET_IF_ARP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <inttypes.h> +#include <sys/socket.h> +#include <sys/types.h> + +#define MAX_ADDR_LEN 7 + +#define ARPOP_REQUEST 1 +#define ARPOP_REPLY 2 +#define ARPOP_RREQUEST 3 +#define ARPOP_RREPLY 4 +#define ARPOP_InREQUEST 8 +#define ARPOP_InREPLY 9 +#define ARPOP_NAK 10 + +struct arphdr { + uint16_t ar_hrd; + uint16_t ar_pro; + uint8_t ar_hln; + uint8_t ar_pln; + uint16_t ar_op; +}; + +#define ARPHRD_NETROM 0 +#define ARPHRD_ETHER 1 +#define ARPHRD_EETHER 2 +#define ARPHRD_AX25 3 +#define ARPHRD_PRONET 4 +#define ARPHRD_CHAOS 5 +#define ARPHRD_IEEE802 6 +#define ARPHRD_ARCNET 7 +#define ARPHRD_APPLETLK 8 +#define ARPHRD_DLCI 15 +#define ARPHRD_ATM 19 +#define ARPHRD_METRICOM 23 +#define ARPHRD_IEEE1394 24 +#define ARPHRD_EUI64 27 +#define ARPHRD_INFINIBAND 32 +#define ARPHRD_SLIP 256 +#define ARPHRD_CSLIP 257 +#define ARPHRD_SLIP6 258 +#define ARPHRD_CSLIP6 259 +#define ARPHRD_RSRVD 260 +#define ARPHRD_ADAPT 264 +#define ARPHRD_ROSE 270 +#define ARPHRD_X25 271 +#define ARPHRD_HWX25 272 +#define ARPHRD_CAN 280 +#define ARPHRD_PPP 512 +#define ARPHRD_CISCO 513 +#define ARPHRD_HDLC ARPHRD_CISCO +#define ARPHRD_LAPB 516 +#define ARPHRD_DDCMP 517 +#define ARPHRD_RAWHDLC 518 + +#define ARPHRD_TUNNEL 768 +#define ARPHRD_TUNNEL6 769 +#define ARPHRD_FRAD 770 +#define ARPHRD_SKIP 771 +#define ARPHRD_LOOPBACK 772 +#define ARPHRD_LOCALTLK 773 +#define ARPHRD_FDDI 774 +#define ARPHRD_BIF 775 +#define ARPHRD_SIT 776 +#define ARPHRD_IPDDP 777 +#define ARPHRD_IPGRE 778 +#define ARPHRD_PIMREG 779 +#define ARPHRD_HIPPI 780 +#define ARPHRD_ASH 781 +#define ARPHRD_ECONET 782 +#define ARPHRD_IRDA 783 +#define ARPHRD_FCPP 784 +#define ARPHRD_FCAL 785 +#define ARPHRD_FCPL 786 +#define ARPHRD_FCFABRIC 787 +#define ARPHRD_IEEE802_TR 800 +#define ARPHRD_IEEE80211 801 +#define ARPHRD_IEEE80211_PRISM 802 +#define ARPHRD_IEEE80211_RADIOTAP 803 +#define ARPHRD_IEEE802154 804 +#define ARPHRD_IEEE802154_MONITOR 805 +#define ARPHRD_PHONET 820 +#define ARPHRD_PHONET_PIPE 821 +#define ARPHRD_CAIF 822 +#define ARPHRD_IP6GRE 823 +#define ARPHRD_NETLINK 824 + +#define ARPHRD_VOID 0xFFFF +#define ARPHRD_NONE 0xFFFE + +struct arpreq { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; + char arp_dev[16]; +}; + +struct arpreq_old { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; +}; + +#define ATF_COM 0x02 +#define ATF_PERM 0x04 +#define ATF_PUBL 0x08 +#define ATF_USETRAILERS 0x10 +#define ATF_NETMASK 0x20 +#define ATF_DONTPUB 0x40 +#define ATF_MAGIC 0x80 + +#define ARPD_UPDATE 0x01 +#define ARPD_LOOKUP 0x02 +#define ARPD_FLUSH 0x03 + +struct arpd_request { + unsigned short req; + uint32_t ip; + unsigned long dev; + unsigned long stamp; + unsigned long updated; + unsigned char ha[MAX_ADDR_LEN]; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_IF_ARP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/route.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/route.h new file mode 100644 index 0000000..dc5960b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/net/route.h
@@ -0,0 +1,119 @@ +#ifndef SYSROOT_NET_ROUTE_H_ +#define SYSROOT_NET_ROUTE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/in.h> +#include <stdint.h> +#include <sys/socket.h> +#include <sys/types.h> + +struct rtentry { + unsigned long int rt_pad1; + struct sockaddr rt_dst; + struct sockaddr rt_gateway; + struct sockaddr rt_genmask; + unsigned short int rt_flags; + short int rt_pad2; + unsigned long int rt_pad3; + unsigned char rt_tos; + unsigned char rt_class; + short int rt_pad4[sizeof(long) / 2 - 1]; + short int rt_metric; + char* rt_dev; + unsigned long int rt_mtu; + unsigned long int rt_window; + unsigned short int rt_irtt; +}; + +#define rt_mss rt_mtu + +struct in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + uint32_t rtmsg_type; + uint16_t rtmsg_dst_len; + uint16_t rtmsg_src_len; + uint32_t rtmsg_metric; + unsigned long int rtmsg_info; + uint32_t rtmsg_flags; + int rtmsg_ifindex; +}; + +#define RTF_UP 0x0001 +#define RTF_GATEWAY 0x0002 + +#define RTF_HOST 0x0004 +#define RTF_REINSTATE 0x0008 +#define RTF_DYNAMIC 0x0010 +#define RTF_MODIFIED 0x0020 +#define RTF_MTU 0x0040 +#define RTF_MSS RTF_MTU +#define RTF_WINDOW 0x0080 +#define RTF_IRTT 0x0100 +#define RTF_REJECT 0x0200 +#define RTF_STATIC 0x0400 +#define RTF_XRESOLVE 0x0800 +#define RTF_NOFORWARD 0x1000 +#define RTF_THROW 0x2000 +#define RTF_NOPMTUDISC 0x4000 + +#define RTF_DEFAULT 0x00010000 +#define RTF_ALLONLINK 0x00020000 +#define RTF_ADDRCONF 0x00040000 + +#define RTF_LINKRT 0x00100000 +#define RTF_NONEXTHOP 0x00200000 + +#define RTF_CACHE 0x01000000 +#define RTF_FLOW 0x02000000 +#define RTF_POLICY 0x04000000 + +#define RTCF_VALVE 0x00200000 +#define RTCF_MASQ 0x00400000 +#define RTCF_NAT 0x00800000 +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_LOG 0x02000000 +#define RTCF_DIRECTSRC 0x04000000 + +#define RTF_LOCAL 0x80000000 +#define RTF_INTERFACE 0x40000000 +#define RTF_MULTICAST 0x20000000 +#define RTF_BROADCAST 0x10000000 +#define RTF_NAT 0x08000000 + +#define RTF_ADDRCLASSMASK 0xF8000000 +#define RT_ADDRCLASS(flags) ((uint32_t)flags >> 23) + +#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) + +#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)) + +#define RT_CLASS_UNSPEC 0 +#define RT_CLASS_DEFAULT 253 + +#define RT_CLASS_MAIN 254 +#define RT_CLASS_LOCAL 255 +#define RT_CLASS_MAX 255 + +#define RTMSG_ACK NLMSG_ACK +#define RTMSG_OVERRUN NLMSG_OVERRUN + +#define RTMSG_NEWDEVICE 0x11 +#define RTMSG_DELDEVICE 0x12 +#define RTMSG_NEWROUTE 0x21 +#define RTMSG_DELROUTE 0x22 +#define RTMSG_NEWRULE 0x31 +#define RTMSG_DELRULE 0x32 +#define RTMSG_CONTROL 0x40 + +#define RTMSG_AR_FAILED 0x51 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_ROUTE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netdb.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netdb.h new file mode 100644 index 0000000..d5bb5ef --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netdb.h
@@ -0,0 +1,155 @@ +#ifndef SYSROOT_NETDB_H_ +#define SYSROOT_NETDB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <netinet/in.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#include <bits/alltypes.h> +#endif + +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr* ai_addr; + char* ai_canonname; + struct addrinfo* ai_next; +}; + +#define IPPORT_RESERVED 1024 + +#define AI_PASSIVE 0x01 +#define AI_CANONNAME 0x02 +#define AI_NUMERICHOST 0x04 +#define AI_V4MAPPED 0x08 +#define AI_ALL 0x10 +#define AI_ADDRCONFIG 0x20 +#define AI_NUMERICSERV 0x400 + +#define NI_NUMERICHOST 0x01 +#define NI_NUMERICSERV 0x02 +#define NI_NOFQDN 0x04 +#define NI_NAMEREQD 0x08 +#define NI_DGRAM 0x10 +#define NI_NUMERICSCOPE 0x100 + +#define EAI_BADFLAGS -1 +#define EAI_NONAME -2 +#define EAI_AGAIN -3 +#define EAI_FAIL -4 +#define EAI_FAMILY -6 +#define EAI_SOCKTYPE -7 +#define EAI_SERVICE -8 +#define EAI_MEMORY -10 +#define EAI_SYSTEM -11 +#define EAI_OVERFLOW -12 + +int getaddrinfo(const char* __restrict, const char* __restrict, const struct addrinfo* __restrict, + struct addrinfo** __restrict); +void freeaddrinfo(struct addrinfo*); +int getnameinfo(const struct sockaddr* __restrict, socklen_t, char* __restrict, socklen_t, + char* __restrict, socklen_t, int); +const char* gai_strerror(int); + +/* Legacy functions follow (marked OBsolete in SUS) */ + +struct netent { + char* n_name; + char** n_aliases; + int n_addrtype; + uint32_t n_net; +}; + +struct hostent { + char* h_name; + char** h_aliases; + int h_addrtype; + int h_length; + char** h_addr_list; +}; +#define h_addr h_addr_list[0] + +struct servent { + char* s_name; + char** s_aliases; + int s_port; + char* s_proto; +}; + +struct protoent { + char* p_name; + char** p_aliases; + int p_proto; +}; + +void sethostent(int); +void endhostent(void); +struct hostent* gethostent(void); + +void setnetent(int); +void endnetent(void); +struct netent* getnetent(void); +struct netent* getnetbyaddr(uint32_t, int); +struct netent* getnetbyname(const char*); + +void setservent(int); +void endservent(void); +struct servent* getservent(void); +struct servent* getservbyname(const char*, const char*); +struct servent* getservbyport(int, const char*); + +void setprotoent(int); +void endprotoent(void); +struct protoent* getprotoent(void); +struct protoent* getprotobyname(const char*); +struct protoent* getprotobynumber(int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) || \ + (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE + 0 < 200809L) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) +struct hostent* gethostbyname(const char*); +struct hostent* gethostbyaddr(const void*, socklen_t, int); +int* __h_errno_location(void); +#define h_errno (*__h_errno_location()) +#define HOST_NOT_FOUND 1 +#define TRY_AGAIN 2 +#define NO_RECOVERY 3 +#define NO_DATA 4 +#define NO_ADDRESS NO_DATA +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void herror(const char*); +const char* hstrerror(int); +int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*); +int gethostbyname2_r(const char*, int, struct hostent*, char*, size_t, struct hostent**, int*); +struct hostent* gethostbyname2(const char*, int); +int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, + int*); +int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**); +int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**); +#define EAI_NODATA -5 +#define EAI_ADDRFAMILY -9 +#define EAI_INPROGRESS -100 +#define EAI_CANCELED -101 +#define EAI_NOTCANCELED -102 +#define EAI_ALLDONE -103 +#define EAI_INTR -104 +#define EAI_IDN_ENCODE -105 +#define NI_MAXHOST 255 +#define NI_MAXSERV 32 +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETDB_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ether.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ether.h new file mode 100644 index 0000000..74668fb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ether.h
@@ -0,0 +1,22 @@ +#ifndef SYSROOT_NETINET_ETHER_H_ +#define SYSROOT_NETINET_ETHER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/if_ether.h> + +char* ether_ntoa(const struct ether_addr*); +struct ether_addr* ether_aton(const char*); +char* ether_ntoa_r(const struct ether_addr*, char*); +struct ether_addr* ether_aton_r(const char*, struct ether_addr*); +int ether_line(const char*, struct ether_addr*, char*); +int ether_ntohost(char*, const struct ether_addr*); +int ether_hostton(const char*, struct ether_addr*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_ETHER_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/icmp6.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/icmp6.h new file mode 100644 index 0000000..dde64cb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/icmp6.h
@@ -0,0 +1,303 @@ +#ifndef SYSROOT_NETINET_ICMP6_H_ +#define SYSROOT_NETINET_ICMP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/in.h> +#include <stdint.h> +#include <string.h> +#include <sys/types.h> + +#define ICMP6_FILTER 1 + +#define ICMP6_FILTER_BLOCK 1 +#define ICMP6_FILTER_PASS 2 +#define ICMP6_FILTER_BLOCKOTHERS 3 +#define ICMP6_FILTER_PASSONLY 4 + +struct icmp6_filter { + uint32_t icmp6_filt[8]; +}; + +struct icmp6_hdr { + uint8_t icmp6_type; + uint8_t icmp6_code; + uint16_t icmp6_cksum; + union { + uint32_t icmp6_un_data32[1]; + uint16_t icmp6_un_data16[2]; + uint8_t icmp6_un_data8[4]; + } icmp6_dataun; +}; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] +#define icmp6_mtu icmp6_data32[0] +#define icmp6_id icmp6_data16[0] +#define icmp6_seq icmp6_data16[1] +#define icmp6_maxdelay icmp6_data16[0] + +#define ICMP6_DST_UNREACH 1 +#define ICMP6_PACKET_TOO_BIG 2 +#define ICMP6_TIME_EXCEEDED 3 +#define ICMP6_PARAM_PROB 4 + +#define ICMP6_INFOMSG_MASK 0x80 + +#define ICMP6_ECHO_REQUEST 128 +#define ICMP6_ECHO_REPLY 129 +#define MLD_LISTENER_QUERY 130 +#define MLD_LISTENER_REPORT 131 +#define MLD_LISTENER_REDUCTION 132 + +#define ICMP6_DST_UNREACH_NOROUTE 0 +#define ICMP6_DST_UNREACH_ADMIN 1 +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 +#define ICMP6_DST_UNREACH_ADDR 3 +#define ICMP6_DST_UNREACH_NOPORT 4 + +#define ICMP6_TIME_EXCEED_TRANSIT 0 +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 + +#define ICMP6_PARAMPROB_HEADER 0 +#define ICMP6_PARAMPROB_NEXTHEADER 1 +#define ICMP6_PARAMPROB_OPTION 2 + +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type)&31))) == 0) + +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type)&31))) != 0) + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type)&31)))) + +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type)&31)))) + +#define ICMP6_FILTER_SETPASSALL(filterp) memset(filterp, 0, sizeof(struct icmp6_filter)); + +#define ICMP6_FILTER_SETBLOCKALL(filterp) memset(filterp, 0xFF, sizeof(struct icmp6_filter)); + +#define ND_ROUTER_SOLICIT 133 +#define ND_ROUTER_ADVERT 134 +#define ND_NEIGHBOR_SOLICIT 135 +#define ND_NEIGHBOR_ADVERT 136 +#define ND_REDIRECT 137 + +struct nd_router_solicit { + struct icmp6_hdr nd_rs_hdr; +}; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { + struct icmp6_hdr nd_ra_hdr; + uint32_t nd_ra_reachable; + uint32_t nd_ra_retransmit; +}; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HOME_AGENT 0x20 +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; +}; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; +}; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if __BYTE_ORDER == __BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else +#define ND_NA_FLAG_ROUTER 0x00000080 +#define ND_NA_FLAG_SOLICITED 0x00000040 +#define ND_NA_FLAG_OVERRIDE 0x00000020 +#endif + +struct nd_redirect { + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; + struct in6_addr nd_rd_dst; +}; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr { + uint8_t nd_opt_type; + uint8_t nd_opt_len; +}; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_RTR_ADV_INTERVAL 7 +#define ND_OPT_HOME_AGENT_INFO 8 + +struct nd_opt_prefix_info { + uint8_t nd_opt_pi_type; + uint8_t nd_opt_pi_len; + uint8_t nd_opt_pi_prefix_len; + uint8_t nd_opt_pi_flags_reserved; + uint32_t nd_opt_pi_valid_time; + uint32_t nd_opt_pi_preferred_time; + uint32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; +}; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_RADDR 0x20 + +struct nd_opt_rd_hdr { + uint8_t nd_opt_rh_type; + uint8_t nd_opt_rh_len; + uint16_t nd_opt_rh_reserved1; + uint32_t nd_opt_rh_reserved2; +}; + +struct nd_opt_mtu { + uint8_t nd_opt_mtu_type; + uint8_t nd_opt_mtu_len; + uint16_t nd_opt_mtu_reserved; + uint32_t nd_opt_mtu_mtu; +}; + +struct mld_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; +}; + +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +#define ICMP6_ROUTER_RENUMBERING 138 + +struct icmp6_router_renum { + struct icmp6_hdr rr_hdr; + uint8_t rr_segnum; + uint8_t rr_flags; + uint16_t rr_maxdelay; + uint32_t rr_reserved; +}; + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +struct rr_pco_match { + uint8_t rpm_code; + uint8_t rpm_len; + uint8_t rpm_ordinal; + uint8_t rpm_matchlen; + uint8_t rpm_minlen; + uint8_t rpm_maxlen; + uint16_t rpm_reserved; + struct in6_addr rpm_prefix; +}; + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 + +struct rr_pco_use { + uint8_t rpu_uselen; + uint8_t rpu_keeplen; + uint8_t rpu_ramask; + uint8_t rpu_raflags; + uint32_t rpu_vltime; + uint32_t rpu_pltime; + uint32_t rpu_flags; + struct in6_addr rpu_prefix; +}; + +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 + +#if __BYTE_ORDER == __BIG_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 +#else +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 +#endif + +struct rr_result { + uint16_t rrr_flags; + uint8_t rrr_ordinal; + uint8_t rrr_matchedlen; + uint32_t rrr_ifid; + struct in6_addr rrr_prefix; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#else +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +struct nd_opt_adv_interval { + uint8_t nd_opt_adv_interval_type; + uint8_t nd_opt_adv_interval_len; + uint16_t nd_opt_adv_interval_reserved; + uint32_t nd_opt_adv_interval_ival; +}; + +struct nd_opt_home_agent_info { + uint8_t nd_opt_home_agent_info_type; + uint8_t nd_opt_home_agent_info_len; + uint16_t nd_opt_home_agent_info_reserved; + uint16_t nd_opt_home_agent_info_preference; + uint16_t nd_opt_home_agent_info_lifetime; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_ICMP6_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/if_ether.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/if_ether.h new file mode 100644 index 0000000..f826e96 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/if_ether.h
@@ -0,0 +1,128 @@ +#ifndef SYSROOT_NETINET_IF_ETHER_H_ +#define SYSROOT_NETINET_IF_ETHER_H_ + +#include <stdint.h> +#include <sys/types.h> + +#define ETH_ALEN 6 +#define ETH_HLEN 14 +#define ETH_ZLEN 60 +#define ETH_DATA_LEN 1500 +#define ETH_FRAME_LEN 1514 +#define ETH_FCS_LEN 4 + +#define ETH_P_LOOP 0x0060 +#define ETH_P_PUP 0x0200 +#define ETH_P_PUPAT 0x0201 +#define ETH_P_IP 0x0800 +#define ETH_P_X25 0x0805 +#define ETH_P_ARP 0x0806 +#define ETH_P_BPQ 0x08FF +#define ETH_P_IEEEPUP 0x0a00 +#define ETH_P_IEEEPUPAT 0x0a01 +#define ETH_P_BATMAN 0x4305 +#define ETH_P_DEC 0x6000 +#define ETH_P_DNA_DL 0x6001 +#define ETH_P_DNA_RC 0x6002 +#define ETH_P_DNA_RT 0x6003 +#define ETH_P_LAT 0x6004 +#define ETH_P_DIAG 0x6005 +#define ETH_P_CUST 0x6006 +#define ETH_P_SCA 0x6007 +#define ETH_P_TEB 0x6558 +#define ETH_P_RARP 0x8035 +#define ETH_P_ATALK 0x809B +#define ETH_P_AARP 0x80F3 +#define ETH_P_8021Q 0x8100 +#define ETH_P_IPX 0x8137 +#define ETH_P_IPV6 0x86DD +#define ETH_P_PAUSE 0x8808 +#define ETH_P_SLOW 0x8809 +#define ETH_P_WCCP 0x883E +#define ETH_P_MPLS_UC 0x8847 +#define ETH_P_MPLS_MC 0x8848 +#define ETH_P_ATMMPOA 0x884c +#define ETH_P_PPP_DISC 0x8863 +#define ETH_P_PPP_SES 0x8864 +#define ETH_P_LINK_CTL 0x886c +#define ETH_P_ATMFATE 0x8884 +#define ETH_P_PAE 0x888E +#define ETH_P_AOE 0x88A2 +#define ETH_P_8021AD 0x88A8 +#define ETH_P_802_EX1 0x88B5 +#define ETH_P_TIPC 0x88CA +#define ETH_P_8021AH 0x88E7 +#define ETH_P_MVRP 0x88F5 +#define ETH_P_1588 0x88F7 +#define ETH_P_PRP 0x88FB +#define ETH_P_FCOE 0x8906 +#define ETH_P_TDLS 0x890D +#define ETH_P_FIP 0x8914 +#define ETH_P_80221 0x8917 +#define ETH_P_LOOPBACK 0x9000 +#define ETH_P_QINQ1 0x9100 +#define ETH_P_QINQ2 0x9200 +#define ETH_P_QINQ3 0x9300 +#define ETH_P_EDSA 0xDADA +#define ETH_P_AF_IUCV 0xFBFB + +#define ETH_P_802_3_MIN 0x0600 + +#define ETH_P_802_3 0x0001 +#define ETH_P_AX25 0x0002 +#define ETH_P_ALL 0x0003 +#define ETH_P_802_2 0x0004 +#define ETH_P_SNAP 0x0005 +#define ETH_P_DDCMP 0x0006 +#define ETH_P_WAN_PPP 0x0007 +#define ETH_P_PPP_MP 0x0008 +#define ETH_P_LOCALTALK 0x0009 +#define ETH_P_CAN 0x000C +#define ETH_P_CANFD 0x000D +#define ETH_P_PPPTALK 0x0010 +#define ETH_P_TR_802_2 0x0011 +#define ETH_P_MOBITEX 0x0015 +#define ETH_P_CONTROL 0x0016 +#define ETH_P_IRDA 0x0017 +#define ETH_P_ECONET 0x0018 +#define ETH_P_HDLC 0x0019 +#define ETH_P_ARCNET 0x001A +#define ETH_P_DSA 0x001B +#define ETH_P_TRAILER 0x001C +#define ETH_P_PHONET 0x00F5 +#define ETH_P_IEEE802154 0x00F6 +#define ETH_P_CAIF 0x00F7 + +struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; +}; + +#include <net/ethernet.h> +#include <net/if_arp.h> + +struct ether_arp { + struct arphdr ea_hdr; + uint8_t arp_sha[ETH_ALEN]; + uint8_t arp_spa[4]; + uint8_t arp_tha[ETH_ALEN]; + uint8_t arp_tpa[4]; +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + do { \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((uint8_t*)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((uint8_t*)ipaddr)[2]; \ + (enaddr)[5] = ((uint8_t*)ipaddr)[3]; \ + } while (0) + +#endif // SYSROOT_NETINET_IF_ETHER_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/igmp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/igmp.h new file mode 100644 index 0000000..99eb989 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/igmp.h
@@ -0,0 +1,45 @@ +#ifndef SYSROOT_NETINET_IGMP_H_ +#define SYSROOT_NETINET_IGMP_H_ + +#include <netinet/in.h> +#include <stdint.h> + +struct igmp { + uint8_t igmp_type; + uint8_t igmp_code; + uint16_t igmp_cksum; + struct in_addr igmp_group; +}; + +#define IGMP_MINLEN 8 + +#define IGMP_MEMBERSHIP_QUERY 0x11 +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 +#define IGMP_V2_LEAVE_GROUP 0x17 + +#define IGMP_DVMRP 0x13 +#define IGMP_PIM 0x14 +#define IGMP_TRACE 0x15 + +#define IGMP_MTRACE_RESP 0x1e +#define IGMP_MTRACE 0x1f + +#define IGMP_MAX_HOST_REPORT_DELAY 10 +#define IGMP_TIMER_SCALE 10 + +#define IGMP_DELAYING_MEMBER 1 +#define IGMP_IDLE_MEMBER 2 +#define IGMP_LAZY_MEMBER 3 +#define IGMP_SLEEPING_MEMBER 4 +#define IGMP_AWAKENING_MEMBER 5 + +#define IGMP_v1_ROUTER 1 +#define IGMP_v2_ROUTER 2 + +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +#endif // SYSROOT_NETINET_IGMP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/in.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/in.h new file mode 100644 index 0000000..6d18e44 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/in.h
@@ -0,0 +1,397 @@ +#ifndef SYSROOT_NETINET_IN_H_ +#define SYSROOT_NETINET_IN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <inttypes.h> +#include <sys/socket.h> + +typedef uint16_t in_port_t; +typedef uint32_t in_addr_t; +struct in_addr { + in_addr_t s_addr; +}; + +struct sockaddr_in { + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + uint8_t sin_zero[8]; +}; + +struct in6_addr { + union { + uint8_t __s6_addr[16]; + uint16_t __s6_addr16[8]; + uint32_t __s6_addr32[4]; + } __in6_union; +}; +#define s6_addr __in6_union.__s6_addr +#define s6_addr16 __in6_union.__s6_addr16 +#define s6_addr32 __in6_union.__s6_addr32 + +struct sockaddr_in6 { + sa_family_t sin6_family; + in_port_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; + uint32_t sin6_scope_id; +}; + +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + unsigned ipv6mr_interface; +}; + +#define INADDR_ANY ((in_addr_t)0x00000000) +#define INADDR_BROADCAST ((in_addr_t)0xffffffff) +#define INADDR_NONE ((in_addr_t)0xffffffff) +#define INADDR_LOOPBACK ((in_addr_t)0x7f000001) + +#define INADDR_UNSPEC_GROUP ((in_addr_t)0xe0000000) +#define INADDR_ALLHOSTS_GROUP ((in_addr_t)0xe0000001) +#define INADDR_ALLRTRS_GROUP ((in_addr_t)0xe0000002) +#define INADDR_MAX_LOCAL_GROUP ((in_addr_t)0xe00000ff) + +#define IN6ADDR_ANY_INIT \ + { \ + { \ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } \ + } \ + } +#define IN6ADDR_LOOPBACK_INIT \ + { \ + { \ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } \ + } \ + } + +extern const struct in6_addr in6addr_any, in6addr_loopback; + +#undef INET_ADDRSTRLEN +#undef INET6_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +uint32_t htonl(uint32_t); +uint16_t htons(uint16_t); +uint32_t ntohl(uint32_t); +uint16_t ntohs(uint16_t); + +#define IPPROTO_IP 0 +#define IPPROTO_HOPOPTS 0 +#define IPPROTO_ICMP 1 +#define IPPROTO_IGMP 2 +#define IPPROTO_IPIP 4 +#define IPPROTO_TCP 6 +#define IPPROTO_EGP 8 +#define IPPROTO_PUP 12 +#define IPPROTO_UDP 17 +#define IPPROTO_IDP 22 +#define IPPROTO_TP 29 +#define IPPROTO_DCCP 33 +#define IPPROTO_IPV6 41 +#define IPPROTO_ROUTING 43 +#define IPPROTO_FRAGMENT 44 +#define IPPROTO_RSVP 46 +#define IPPROTO_GRE 47 +#define IPPROTO_ESP 50 +#define IPPROTO_AH 51 +#define IPPROTO_ICMPV6 58 +#define IPPROTO_NONE 59 +#define IPPROTO_DSTOPTS 60 +#define IPPROTO_MTP 92 +#define IPPROTO_BEETPH 94 +#define IPPROTO_ENCAP 98 +#define IPPROTO_PIM 103 +#define IPPROTO_COMP 108 +#define IPPROTO_SCTP 132 +#define IPPROTO_MH 135 +#define IPPROTO_UDPLITE 136 +#define IPPROTO_MPLS 137 +#define IPPROTO_RAW 255 +#define IPPROTO_MAX 256 + +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint32_t*)(a))[2] == 0 && \ + ((uint32_t*)(a))[3] == 0) + +#define IN6_IS_ADDR_LOOPBACK(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint32_t*)(a))[2] == 0 && \ + ((uint8_t*)(a))[12] == 0 && ((uint8_t*)(a))[13] == 0 && ((uint8_t*)(a))[14] == 0 && \ + ((uint8_t*)(a))[15] == 1) + +#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t*)(a))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(a) \ + ((((uint8_t*)(a))[0]) == 0xfe && (((uint8_t*)(a))[1] & 0xc0) == 0x80) + +#define IN6_IS_ADDR_SITELOCAL(a) \ + ((((uint8_t*)(a))[0]) == 0xfe && (((uint8_t*)(a))[1] & 0xc0) == 0xc0) + +#define IN6_IS_ADDR_V4MAPPED(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint8_t*)(a))[8] == 0 && \ + ((uint8_t*)(a))[9] == 0 && ((uint8_t*)(a))[10] == 0xff && ((uint8_t*)(a))[11] == 0xff) + +#define IN6_IS_ADDR_V4COMPAT(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint32_t*)(a))[2] == 0 && \ + ((uint8_t*)(a))[15] > 1) + +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x1)) + +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x2)) + +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x5)) + +#define IN6_IS_ADDR_MC_ORGLOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x8)) + +#define IN6_IS_ADDR_MC_GLOBAL(a) (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0xe)) + +#define __ARE_4_EQUAL(a, b) \ + (!((0 [a] - 0 [b]) | (1 [a] - 1 [b]) | (2 [a] - 2 [b]) | (3 [a] - 3 [b]))) +#define IN6_ARE_ADDR_EQUAL(a, b) __ARE_4_EQUAL((const uint32_t*)(a), (const uint32_t*)(b)) + +#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 +#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 +#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) +#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) + +#define IN_LOOPBACKNET 127 + +#define IP_TOS 1 +#define IP_TTL 2 +#define IP_HDRINCL 3 +#define IP_OPTIONS 4 +#define IP_ROUTER_ALERT 5 +#define IP_RECVOPTS 6 +#define IP_RETOPTS 7 +#define IP_PKTINFO 8 +#define IP_PKTOPTIONS 9 +#define IP_PMTUDISC 10 +#define IP_MTU_DISCOVER 10 +#define IP_RECVERR 11 +#define IP_RECVTTL 12 +#define IP_RECVTOS 13 +#define IP_MTU 14 +#define IP_FREEBIND 15 +#define IP_IPSEC_POLICY 16 +#define IP_XFRM_POLICY 17 +#define IP_PASSSEC 18 +#define IP_TRANSPARENT 19 +#define IP_ORIGDSTADDR 20 +#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR +#define IP_MINTTL 21 +#define IP_NODEFRAG 22 +#define IP_CHECKSUM 23 +#define IP_BIND_ADDRESS_NO_PORT 24 +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 +#define IP_UNBLOCK_SOURCE 37 +#define IP_BLOCK_SOURCE 38 +#define IP_ADD_SOURCE_MEMBERSHIP 39 +#define IP_DROP_SOURCE_MEMBERSHIP 40 +#define IP_MSFILTER 41 +#define IP_MULTICAST_ALL 49 +#define IP_UNICAST_IF 50 + +#define IP_RECVRETOPTS IP_RETOPTS + +#define IP_PMTUDISC_DONT 0 +#define IP_PMTUDISC_WANT 1 +#define IP_PMTUDISC_DO 2 +#define IP_PMTUDISC_PROBE 3 +#define IP_PMTUDISC_INTERFACE 4 +#define IP_PMTUDISC_OMIT 5 + +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +struct ip_opts { + struct in_addr ip_dst; + char ip_opts[40]; +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define MCAST_JOIN_GROUP 42 +#define MCAST_BLOCK_SOURCE 43 +#define MCAST_UNBLOCK_SOURCE 44 +#define MCAST_LEAVE_GROUP 45 +#define MCAST_JOIN_SOURCE_GROUP 46 +#define MCAST_LEAVE_SOURCE_GROUP 47 +#define MCAST_MSFILTER 48 + +#define MCAST_EXCLUDE 0 +#define MCAST_INCLUDE 1 + +struct ip_mreq { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; +}; + +struct ip_mreqn { + struct in_addr imr_multiaddr; + struct in_addr imr_address; + int imr_ifindex; +}; + +struct ip_mreq_source { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; + struct in_addr imr_sourceaddr; +}; + +struct ip_msfilter { + struct in_addr imsf_multiaddr; + struct in_addr imsf_interface; + uint32_t imsf_fmode; + uint32_t imsf_numsrc; + struct in_addr imsf_slist[1]; +}; +#define IP_MSFILTER_SIZE(numsrc) \ + (sizeof(struct ip_msfilter) - sizeof(struct in_addr) + (numsrc) * sizeof(struct in_addr)) + +struct group_req { + uint32_t gr_interface; + struct sockaddr_storage gr_group; +}; + +struct group_source_req { + uint32_t gsr_interface; + struct sockaddr_storage gsr_group; + struct sockaddr_storage gsr_source; +}; + +struct group_filter { + uint32_t gf_interface; + struct sockaddr_storage gf_group; + uint32_t gf_fmode; + uint32_t gf_numsrc; + struct sockaddr_storage gf_slist[1]; +}; +#define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) + \ + (numsrc) * sizeof(struct sockaddr_storage)) + +struct in_pktinfo { + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + unsigned ipi6_ifindex; +}; + +struct ip6_mtuinfo { + struct sockaddr_in6 ip6m_addr; + uint32_t ip6m_mtu; +}; +#endif + +#define IPV6_ADDRFORM 1 +#define IPV6_2292PKTINFO 2 +#define IPV6_2292HOPOPTS 3 +#define IPV6_2292DSTOPTS 4 +#define IPV6_2292RTHDR 5 +#define IPV6_2292PKTOPTIONS 6 +#define IPV6_CHECKSUM 7 +#define IPV6_2292HOPLIMIT 8 +#define IPV6_NEXTHOP 9 +#define IPV6_AUTHHDR 10 +#define IPV6_UNICAST_HOPS 16 +#define IPV6_MULTICAST_IF 17 +#define IPV6_MULTICAST_HOPS 18 +#define IPV6_MULTICAST_LOOP 19 +#define IPV6_JOIN_GROUP 20 +#define IPV6_LEAVE_GROUP 21 +#define IPV6_ROUTER_ALERT 22 +#define IPV6_MTU_DISCOVER 23 +#define IPV6_MTU 24 +#define IPV6_RECVERR 25 +#define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 +#define IPV6_IPSEC_POLICY 34 +#define IPV6_XFRM_POLICY 35 +#define IPV6_HDRINCL 36 + +#define IPV6_RECVPKTINFO 49 +#define IPV6_PKTINFO 50 +#define IPV6_RECVHOPLIMIT 51 +#define IPV6_HOPLIMIT 52 +#define IPV6_RECVHOPOPTS 53 +#define IPV6_HOPOPTS 54 +#define IPV6_RTHDRDSTOPTS 55 +#define IPV6_RECVRTHDR 56 +#define IPV6_RTHDR 57 +#define IPV6_RECVDSTOPTS 58 +#define IPV6_DSTOPTS 59 +#define IPV6_RECVPATHMTU 60 +#define IPV6_PATHMTU 61 +#define IPV6_DONTFRAG 62 +#define IPV6_RECVTCLASS 66 +#define IPV6_TCLASS 67 +#define IPV6_AUTOFLOWLABEL 70 +#define IPV6_ADDR_PREFERENCES 72 +#define IPV6_MINHOPCOUNT 73 +#define IPV6_ORIGDSTADDR 74 +#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR +#define IPV6_TRANSPARENT 75 +#define IPV6_UNICAST_IF 76 + +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +#define IPV6_RXHOPOPTS IPV6_HOPOPTS +#define IPV6_RXDSTOPTS IPV6_DSTOPTS + +#define IPV6_PMTUDISC_DONT 0 +#define IPV6_PMTUDISC_WANT 1 +#define IPV6_PMTUDISC_DO 2 +#define IPV6_PMTUDISC_PROBE 3 +#define IPV6_PMTUDISC_INTERFACE 4 +#define IPV6_PMTUDISC_OMIT 5 + +#define IPV6_PREFER_SRC_TMP 0x0001 +#define IPV6_PREFER_SRC_PUBLIC 0x0002 +#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 +#define IPV6_PREFER_SRC_COA 0x0004 +#define IPV6_PREFER_SRC_HOME 0x0400 +#define IPV6_PREFER_SRC_CGA 0x0008 +#define IPV6_PREFER_SRC_NONCGA 0x0800 + +#define IPV6_RTHDR_LOOSE 0 +#define IPV6_RTHDR_STRICT 1 + +#define IPV6_RTHDR_TYPE_0 0 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/in_systm.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/in_systm.h new file mode 100644 index 0000000..8e688ab --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/in_systm.h
@@ -0,0 +1,9 @@ +#ifndef SYSROOT_NETINET_IN_SYSTM_H_ +#define SYSROOT_NETINET_IN_SYSTM_H_ + +#include <stdint.h> + +typedef uint16_t n_short; +typedef uint32_t n_long, n_time; + +#endif // SYSROOT_NETINET_IN_SYSTM_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip.h new file mode 100644 index 0000000..c795ef0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip.h
@@ -0,0 +1,198 @@ +#ifndef SYSROOT_NETINET_IP_H_ +#define SYSROOT_NETINET_IP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <endian.h> +#include <netinet/in.h> +#include <stdint.h> + +struct timestamp { + uint8_t len; + uint8_t ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int flags : 4; + unsigned int overflow : 4; +#else + unsigned int overflow : 4; + unsigned int flags : 4; +#endif + uint32_t data[9]; +}; + +struct iphdr { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ihl : 4; + unsigned int version : 4; +#else + unsigned int version : 4; + unsigned int ihl : 4; +#endif + uint8_t tos; + uint16_t tot_len; + uint16_t id; + uint16_t frag_off; + uint8_t ttl; + uint8_t protocol; + uint16_t check; + uint32_t saddr; + uint32_t daddr; +}; + +struct ip { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ip_hl : 4; + unsigned int ip_v : 4; +#else + unsigned int ip_v : 4; + unsigned int ip_hl : 4; +#endif + uint8_t ip_tos; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_off; + uint8_t ip_ttl; + uint8_t ip_p; + uint16_t ip_sum; + struct in_addr ip_src, ip_dst; +}; + +#define IP_RF 0x8000 +#define IP_DF 0x4000 +#define IP_MF 0x2000 +#define IP_OFFMASK 0x1fff + +struct ip_timestamp { + uint8_t ipt_code; + uint8_t ipt_len; + uint8_t ipt_ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ipt_flg : 4; + unsigned int ipt_oflw : 4; +#else + unsigned int ipt_oflw : 4; + unsigned int ipt_flg : 4; +#endif + uint32_t data[9]; +}; + +#define IPVERSION 4 +#define IP_MAXPACKET 65535 + +#define IPTOS_ECN_MASK 0x03 +#define IPTOS_ECN(x) ((x)&IPTOS_ECN_MASK) +#define IPTOS_ECN_NOT_ECT 0x00 +#define IPTOS_ECN_ECT1 0x01 +#define IPTOS_ECN_ECT0 0x02 +#define IPTOS_ECN_CE 0x03 + +#define IPTOS_DSCP_MASK 0xfc +#define IPTOS_DSCP(x) ((x)&IPTOS_DSCP_MASK) +#define IPTOS_DSCP_AF11 0x28 +#define IPTOS_DSCP_AF12 0x30 +#define IPTOS_DSCP_AF13 0x38 +#define IPTOS_DSCP_AF21 0x48 +#define IPTOS_DSCP_AF22 0x50 +#define IPTOS_DSCP_AF23 0x58 +#define IPTOS_DSCP_AF31 0x68 +#define IPTOS_DSCP_AF32 0x70 +#define IPTOS_DSCP_AF33 0x78 +#define IPTOS_DSCP_AF41 0x88 +#define IPTOS_DSCP_AF42 0x90 +#define IPTOS_DSCP_AF43 0x98 +#define IPTOS_DSCP_EF 0xb8 + +#define IPTOS_CLASS_MASK 0xe0 +#define IPTOS_CLASS(x) ((x)&IPTOS_CLASS_MASK) +#define IPTOS_CLASS_CS0 0x00 +#define IPTOS_CLASS_CS1 0x20 +#define IPTOS_CLASS_CS2 0x40 +#define IPTOS_CLASS_CS3 0x60 +#define IPTOS_CLASS_CS4 0x80 +#define IPTOS_CLASS_CS5 0xa0 +#define IPTOS_CLASS_CS6 0xc0 +#define IPTOS_CLASS_CS7 0xe0 +#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0 + +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_LOWCOST 0x02 +#define IPTOS_MINCOST IPTOS_LOWCOST + +#define IPTOS_PREC_MASK 0xe0 +#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +#define IPOPT_COPY 0x80 +#define IPOPT_CLASS_MASK 0x60 +#define IPOPT_NUMBER_MASK 0x1f + +#define IPOPT_COPIED(o) ((o)&IPOPT_COPY) +#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) +#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_MEASUREMENT IPOPT_DEBMEAS +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 +#define IPOPT_END IPOPT_EOL +#define IPOPT_NOP 1 +#define IPOPT_NOOP IPOPT_NOP + +#define IPOPT_RR 7 +#define IPOPT_TS 68 +#define IPOPT_TIMESTAMP IPOPT_TS +#define IPOPT_SECURITY 130 +#define IPOPT_SEC IPOPT_SECURITY +#define IPOPT_LSRR 131 +#define IPOPT_SATID 136 +#define IPOPT_SID IPOPT_SATID +#define IPOPT_SSRR 137 +#define IPOPT_RA 148 + +#define IPOPT_OPTVAL 0 +#define IPOPT_OLEN 1 +#define IPOPT_OFFSET 2 +#define IPOPT_MINOFF 4 + +#define MAX_IPOPTLEN 40 + +#define IPOPT_TS_TSONLY 0 +#define IPOPT_TS_TSANDADDR 1 +#define IPOPT_TS_PRESPEC 3 + +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +#define MAXTTL 255 +#define IPDEFTTL 64 +#define IPFRAGTTL 60 +#define IPTTLDEC 1 + +#define IP_MSS 576 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip6.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip6.h new file mode 100644 index 0000000..45f1c68 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip6.h
@@ -0,0 +1,142 @@ +#ifndef SYSROOT_NETINET_IP6_H_ +#define SYSROOT_NETINET_IP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <endian.h> +#include <netinet/in.h> +#include <stdint.h> + +struct ip6_hdr { + union { + struct ip6_hdrctl { + uint32_t ip6_un1_flow; + uint16_t ip6_un1_plen; + uint8_t ip6_un1_nxt; + uint8_t ip6_un1_hlim; + } ip6_un1; + uint8_t ip6_un2_vfc; + } ip6_ctlun; + struct in6_addr ip6_src; + struct in6_addr ip6_dst; +}; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +struct ip6_ext { + uint8_t ip6e_nxt; + uint8_t ip6e_len; +}; + +struct ip6_hbh { + uint8_t ip6h_nxt; + uint8_t ip6h_len; +}; + +struct ip6_dest { + uint8_t ip6d_nxt; + uint8_t ip6d_len; +}; + +struct ip6_rthdr { + uint8_t ip6r_nxt; + uint8_t ip6r_len; + uint8_t ip6r_type; + uint8_t ip6r_segleft; +}; + +struct ip6_rthdr0 { + uint8_t ip6r0_nxt; + uint8_t ip6r0_len; + uint8_t ip6r0_type; + uint8_t ip6r0_segleft; + uint8_t ip6r0_reserved; + uint8_t ip6r0_slmap[3]; + struct in6_addr ip6r0_addr[]; +}; + +struct ip6_frag { + uint8_t ip6f_nxt; + uint8_t ip6f_reserved; + uint16_t ip6f_offlg; + uint32_t ip6f_ident; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 +#define IP6F_RESERVED_MASK 0x0006 +#define IP6F_MORE_FRAG 0x0001 +#else +#define IP6F_OFF_MASK 0xf8ff +#define IP6F_RESERVED_MASK 0x0600 +#define IP6F_MORE_FRAG 0x0100 +#endif + +struct ip6_opt { + uint8_t ip6o_type; + uint8_t ip6o_len; +}; + +#define IP6OPT_TYPE(o) ((o)&0xc0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xc0 +#define IP6OPT_TYPE_MUTABLE 0x20 + +#define IP6OPT_PAD1 0 +#define IP6OPT_PADN 1 + +#define IP6OPT_JUMBO 0xc2 +#define IP6OPT_NSAP_ADDR 0xc3 +#define IP6OPT_TUNNEL_LIMIT 0x04 +#define IP6OPT_ROUTER_ALERT 0x05 + +struct ip6_opt_jumbo { + uint8_t ip6oj_type; + uint8_t ip6oj_len; + uint8_t ip6oj_jumbo_len[4]; +}; +#define IP6OPT_JUMBO_LEN 6 + +struct ip6_opt_nsap { + uint8_t ip6on_type; + uint8_t ip6on_len; + uint8_t ip6on_src_nsap_len; + uint8_t ip6on_dst_nsap_len; +}; + +struct ip6_opt_tunnel { + uint8_t ip6ot_type; + uint8_t ip6ot_len; + uint8_t ip6ot_encap_limit; +}; + +struct ip6_opt_router { + uint8_t ip6or_type; + uint8_t ip6or_len; + uint8_t ip6or_value[2]; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0001 +#define IP6_ALERT_AN 0x0002 +#else +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0100 +#define IP6_ALERT_AN 0x0200 +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IP6_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip_icmp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip_icmp.h new file mode 100644 index 0000000..c239456 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/ip_icmp.h
@@ -0,0 +1,189 @@ +#ifndef SYSROOT_NETINET_IP_ICMP_H_ +#define SYSROOT_NETINET_IP_ICMP_H_ + +#include <netinet/in.h> +#include <netinet/ip.h> +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct icmphdr { + uint8_t type; + uint8_t code; + uint16_t checksum; + union { + struct { + uint16_t id; + uint16_t sequence; + } echo; + uint32_t gateway; + struct { + uint16_t __unused; + uint16_t mtu; + } frag; + } un; +}; + +#define ICMP_ECHOREPLY 0 +#define ICMP_DEST_UNREACH 3 +#define ICMP_SOURCE_QUENCH 4 +#define ICMP_REDIRECT 5 +#define ICMP_ECHO 8 +#define ICMP_TIME_EXCEEDED 11 +#define ICMP_PARAMETERPROB 12 +#define ICMP_TIMESTAMP 13 +#define ICMP_TIMESTAMPREPLY 14 +#define ICMP_INFO_REQUEST 15 +#define ICMP_INFO_REPLY 16 +#define ICMP_ADDRESS 17 +#define ICMP_ADDRESSREPLY 18 +#define NR_ICMP_TYPES 18 + +#define ICMP_NET_UNREACH 0 +#define ICMP_HOST_UNREACH 1 +#define ICMP_PROT_UNREACH 2 +#define ICMP_PORT_UNREACH 3 +#define ICMP_FRAG_NEEDED 4 +#define ICMP_SR_FAILED 5 +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 +#define ICMP_PREC_VIOLATION 14 +#define ICMP_PREC_CUTOFF 15 +#define NR_ICMP_UNREACH 15 + +#define ICMP_REDIR_NET 0 +#define ICMP_REDIR_HOST 1 +#define ICMP_REDIR_NETTOS 2 +#define ICMP_REDIR_HOSTTOS 3 + +#define ICMP_EXC_TTL 0 +#define ICMP_EXC_FRAGTIME 1 + +struct icmp_ra_addr { + uint32_t ira_addr; + uint32_t ira_preference; +}; + +struct icmp { + uint8_t icmp_type; + uint8_t icmp_code; + uint16_t icmp_cksum; + union { + uint8_t ih_pptr; + struct in_addr ih_gwaddr; + struct ih_idseq { + uint16_t icd_id; + uint16_t icd_seq; + } ih_idseq; + uint32_t ih_void; + + struct ih_pmtu { + uint16_t ipm_void; + uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + uint8_t irt_num_addrs; + uint8_t irt_wpa; + uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; + union { + struct { + uint32_t its_otime; + uint32_t its_rtime; + uint32_t its_ttime; + } id_ts; + struct { + struct ip idi_ip; + } id_ip; + struct icmp_ra_addr id_radv; + uint32_t id_mask; + uint8_t id_data[1]; + } icmp_dun; +}; + +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data + +#define ICMP_MINLEN 8 +#define ICMP_TSLEN (8 + 3 * sizeof(n_time)) +#define ICMP_MASKLEN 12 +#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8) +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + +#define ICMP_UNREACH 3 +#define ICMP_SOURCEQUENCH 4 +#define ICMP_ROUTERADVERT 9 +#define ICMP_ROUTERSOLICIT 10 +#define ICMP_TIMXCEED 11 +#define ICMP_PARAMPROB 12 +#define ICMP_TSTAMP 13 +#define ICMP_TSTAMPREPLY 14 +#define ICMP_IREQ 15 +#define ICMP_IREQREPLY 16 +#define ICMP_MASKREQ 17 +#define ICMP_MASKREPLY 18 +#define ICMP_MAXTYPE 18 + +#define ICMP_UNREACH_NET 0 +#define ICMP_UNREACH_HOST 1 +#define ICMP_UNREACH_PROTOCOL 2 +#define ICMP_UNREACH_PORT 3 +#define ICMP_UNREACH_NEEDFRAG 4 +#define ICMP_UNREACH_SRCFAIL 5 +#define ICMP_UNREACH_NET_UNKNOWN 6 +#define ICMP_UNREACH_HOST_UNKNOWN 7 +#define ICMP_UNREACH_ISOLATED 8 +#define ICMP_UNREACH_NET_PROHIB 9 +#define ICMP_UNREACH_HOST_PROHIB 10 +#define ICMP_UNREACH_TOSNET 11 +#define ICMP_UNREACH_TOSHOST 12 +#define ICMP_UNREACH_FILTER_PROHIB 13 +#define ICMP_UNREACH_HOST_PRECEDENCE 14 +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 + +#define ICMP_REDIRECT_NET 0 +#define ICMP_REDIRECT_HOST 1 +#define ICMP_REDIRECT_TOSNET 2 +#define ICMP_REDIRECT_TOSHOST 3 + +#define ICMP_TIMXCEED_INTRANS 0 +#define ICMP_TIMXCEED_REASS 1 + +#define ICMP_PARAMPROB_OPTABSENT 1 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || (type) == ICMP_ROUTERADVERT || \ + (type) == ICMP_ROUTERSOLICIT || (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || (type) == ICMP_MASKREQ || \ + (type) == ICMP_MASKREPLY) + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IP_ICMP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/tcp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/tcp.h new file mode 100644 index 0000000..e892dd2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/tcp.h
@@ -0,0 +1,201 @@ +#ifndef SYSROOT_NETINET_TCP_H_ +#define SYSROOT_NETINET_TCP_H_ + +#include <features.h> + +#define TCP_NODELAY 1 +#define TCP_MAXSEG 2 +#define TCP_CORK 3 +#define TCP_KEEPIDLE 4 +#define TCP_KEEPINTVL 5 +#define TCP_KEEPCNT 6 +#define TCP_SYNCNT 7 +#define TCP_LINGER2 8 +#define TCP_DEFER_ACCEPT 9 +#define TCP_WINDOW_CLAMP 10 +#define TCP_INFO 11 +#define TCP_QUICKACK 12 +#define TCP_CONGESTION 13 +#define TCP_MD5SIG 14 +#define TCP_THIN_LINEAR_TIMEOUTS 16 +#define TCP_THIN_DUPACK 17 +#define TCP_USER_TIMEOUT 18 +#define TCP_REPAIR 19 +#define TCP_REPAIR_QUEUE 20 +#define TCP_QUEUE_SEQ 21 +#define TCP_REPAIR_OPTIONS 22 +#define TCP_FASTOPEN 23 +#define TCP_TIMESTAMP 24 +#define TCP_NOTSENT_LOWAT 25 +#define TCP_CC_INFO 26 +#define TCP_SAVE_SYN 27 +#define TCP_SAVED_SYN 28 + +#define TCP_ESTABLISHED 1 +#define TCP_SYN_SENT 2 +#define TCP_SYN_RECV 3 +#define TCP_FIN_WAIT1 4 +#define TCP_FIN_WAIT2 5 +#define TCP_TIME_WAIT 6 +#define TCP_CLOSE 7 +#define TCP_CLOSE_WAIT 8 +#define TCP_LAST_ACK 9 +#define TCP_LISTEN 10 +#define TCP_CLOSING 11 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOPT_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 +#define TCPOPT_SACK 5 +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOLEN_WINDOW 3 +#define TCPOLEN_MAXSEG 4 +#define TCPOLEN_TIMESTAMP 10 + +#define SOL_TCP 6 + +#include <endian.h> +#include <stdint.h> +#include <sys/socket.h> +#include <sys/types.h> + +typedef uint32_t tcp_seq; + +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + +struct tcphdr { +#ifdef _GNU_SOURCE +#ifdef __GNUC__ + __extension__ +#endif + union { + struct { + uint16_t source; + uint16_t dest; + uint32_t seq; + uint32_t ack_seq; +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint16_t res1 : 4; + uint16_t doff : 4; + uint16_t fin : 1; + uint16_t syn : 1; + uint16_t rst : 1; + uint16_t psh : 1; + uint16_t ack : 1; + uint16_t urg : 1; + uint16_t res2 : 2; +#else + uint16_t doff : 4; + uint16_t res1 : 4; + uint16_t res2 : 2; + uint16_t urg : 1; + uint16_t ack : 1; + uint16_t psh : 1; + uint16_t rst : 1; + uint16_t syn : 1; + uint16_t fin : 1; +#endif + uint16_t window; + uint16_t check; + uint16_t urg_ptr; + }; + struct { +#endif + + uint16_t th_sport; + uint16_t th_dport; + uint32_t th_seq; + uint32_t th_ack; +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t th_x2 : 4; + uint8_t th_off : 4; +#else + uint8_t th_off : 4; + uint8_t th_x2 : 4; +#endif + uint8_t th_flags; + uint16_t th_win; + uint16_t th_sum; + uint16_t th_urp; + +#ifdef _GNU_SOURCE + }; + }; +#endif +}; +#endif + +#ifdef _GNU_SOURCE +#define TCPI_OPT_TIMESTAMPS 1 +#define TCPI_OPT_SACK 2 +#define TCPI_OPT_WSCALE 4 +#define TCPI_OPT_ECN 8 + +#define TCP_CA_Open 0 +#define TCP_CA_Disorder 1 +#define TCP_CA_CWR 2 +#define TCP_CA_Recovery 3 +#define TCP_CA_Loss 4 + +struct tcp_info { + uint8_t tcpi_state; + uint8_t tcpi_ca_state; + uint8_t tcpi_retransmits; + uint8_t tcpi_probes; + uint8_t tcpi_backoff; + uint8_t tcpi_options; + uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + uint32_t tcpi_rto; + uint32_t tcpi_ato; + uint32_t tcpi_snd_mss; + uint32_t tcpi_rcv_mss; + uint32_t tcpi_unacked; + uint32_t tcpi_sacked; + uint32_t tcpi_lost; + uint32_t tcpi_retrans; + uint32_t tcpi_fackets; + uint32_t tcpi_last_data_sent; + uint32_t tcpi_last_ack_sent; + uint32_t tcpi_last_data_recv; + uint32_t tcpi_last_ack_recv; + uint32_t tcpi_pmtu; + uint32_t tcpi_rcv_ssthresh; + uint32_t tcpi_rtt; + uint32_t tcpi_rttvar; + uint32_t tcpi_snd_ssthresh; + uint32_t tcpi_snd_cwnd; + uint32_t tcpi_advmss; + uint32_t tcpi_reordering; + uint32_t tcpi_rcv_rtt; + uint32_t tcpi_rcv_space; + uint32_t tcpi_total_retrans; + uint64_t tcpi_pacing_rate; + uint64_t tcpi_max_pacing_rate; + uint64_t tcpi_bytes_acked; + uint64_t tcpi_bytes_received; + uint32_t tcpi_segs_out; + uint32_t tcpi_segs_in; +}; + +#define TCP_MD5SIG_MAXKEYLEN 80 + +struct tcp_md5sig { + struct sockaddr_storage tcpm_addr; + uint16_t __tcpm_pad1; + uint16_t tcpm_keylen; + uint32_t __tcpm_pad2; + uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; +}; + +#endif + +#endif // SYSROOT_NETINET_TCP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/udp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/udp.h new file mode 100644 index 0000000..1a0fba7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netinet/udp.h
@@ -0,0 +1,38 @@ +#ifndef SYSROOT_NETINET_UDP_H_ +#define SYSROOT_NETINET_UDP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <stdint.h> + +#ifdef _GNU_SOURCE +#define uh_sport source +#define uh_dport dest +#define uh_ulen len +#define uh_sum check +#endif + +struct udphdr { + uint16_t uh_sport; + uint16_t uh_dport; + uint16_t uh_ulen; + uint16_t uh_sum; +}; + +#define UDP_CORK 1 +#define UDP_ENCAP 100 + +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 +#define UDP_ENCAP_ESPINUDP 2 +#define UDP_ENCAP_L2TPINUDP 3 + +#define SOL_UDP 17 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_UDP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netpacket/packet.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netpacket/packet.h new file mode 100644 index 0000000..3066046 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/netpacket/packet.h
@@ -0,0 +1,61 @@ +#ifndef SYSROOT_NETPACKET_PACKET_H_ +#define SYSROOT_NETPACKET_PACKET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct sockaddr_ll { + unsigned short sll_family, sll_protocol; + int sll_ifindex; + unsigned short sll_hatype; + unsigned char sll_pkttype, sll_halen; + unsigned char sll_addr[8]; +}; + +struct packet_mreq { + int mr_ifindex; + unsigned short int mr_type, mr_alen; + unsigned char mr_address[8]; +}; + +#define PACKET_HOST 0 +#define PACKET_BROADCAST 1 +#define PACKET_MULTICAST 2 +#define PACKET_OTHERHOST 3 +#define PACKET_OUTGOING 4 +#define PACKET_LOOPBACK 5 +#define PACKET_FASTROUTE 6 + +#define PACKET_ADD_MEMBERSHIP 1 +#define PACKET_DROP_MEMBERSHIP 2 +#define PACKET_RECV_OUTPUT 3 +#define PACKET_RX_RING 5 +#define PACKET_STATISTICS 6 +#define PACKET_COPY_THRESH 7 +#define PACKET_AUXDATA 8 +#define PACKET_ORIGDEV 9 +#define PACKET_VERSION 10 +#define PACKET_HDRLEN 11 +#define PACKET_RESERVE 12 +#define PACKET_TX_RING 13 +#define PACKET_LOSS 14 +#define PACKET_VNET_HDR 15 +#define PACKET_TX_TIMESTAMP 16 +#define PACKET_TIMESTAMP 17 +#define PACKET_FANOUT 18 +#define PACKET_TX_HAS_OFF 19 +#define PACKET_QDISC_BYPASS 20 +#define PACKET_ROLLOVER_STATS 21 +#define PACKET_FANOUT_DATA 22 + +#define PACKET_MR_MULTICAST 0 +#define PACKET_MR_PROMISC 1 +#define PACKET_MR_ALLMULTI 2 +#define PACKET_MR_UNICAST 3 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETPACKET_PACKET_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/nl_types.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/nl_types.h new file mode 100644 index 0000000..e30f86e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/nl_types.h
@@ -0,0 +1,22 @@ +#ifndef SYSROOT_NL_TYPES_H_ +#define SYSROOT_NL_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define NL_SETD 1 +#define NL_CAT_LOCALE 1 + +typedef int nl_item; +typedef void* nl_catd; + +nl_catd catopen(const char*, int); +char* catgets(nl_catd, int, int, const char*); +int catclose(nl_catd); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NL_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/paths.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/paths.h new file mode 100644 index 0000000..0ff06aa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/paths.h
@@ -0,0 +1,28 @@ +#ifndef SYSROOT_PATHS_H_ +#define SYSROOT_PATHS_H_ + +#define _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin" +#define _PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_KLOG "/proc/kmsg" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MNTTAB "/etc/fstab" +#define _PATH_MOUNTED "/etc/mtab" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_VI "/usr/bin/vi" +#define _PATH_WTMP "/dev/null/wtmp" + +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/lib/misc/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" + +#endif // SYSROOT_PATHS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/poll.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/poll.h new file mode 100644 index 0000000..4c7c800 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/poll.h
@@ -0,0 +1,51 @@ +#ifndef SYSROOT_POLL_H_ +#define SYSROOT_POLL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/poll.h> + +#define POLLIN 0x001 +#define POLLPRI 0x002 +#define POLLOUT 0x004 +#define POLLERR 0x008 +#define POLLHUP 0x010 +#define POLLNVAL 0x020 +#define POLLRDNORM 0x040 +#define POLLRDBAND 0x080 +#ifndef POLLWRNORM +#define POLLWRNORM 0x100 +#define POLLWRBAND 0x200 +#endif +#ifndef POLLMSG +#define POLLMSG 0x400 +#define POLLRDHUP 0x2000 +#endif + +typedef unsigned long nfds_t; + +struct pollfd { + int fd; + short events; + short revents; +}; + +int poll(struct pollfd*, nfds_t, int); + +#ifdef _GNU_SOURCE +#define __NEED_time_t +#define __NEED_struct_timespec +#define __NEED_sigset_t +#include <bits/alltypes.h> +int ppoll(struct pollfd*, nfds_t, const struct timespec*, const sigset_t*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_POLL_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/pthread.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/pthread.h new file mode 100644 index 0000000..d4b9f00 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/pthread.h
@@ -0,0 +1,200 @@ +#ifndef SYSROOT_PTHREAD_H_ +#define SYSROOT_PTHREAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_time_t +#define __NEED_clockid_t +#define __NEED_struct_timespec +#define __NEED_sigset_t +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t +#define __NEED_size_t + +#include <sched.h> +#include <time.h> + +#include <bits/alltypes.h> + +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_CREATE_DETACHED 1 + +#define PTHREAD_MUTEX_NORMAL 0 +#define PTHREAD_MUTEX_DEFAULT 0 +#define PTHREAD_MUTEX_RECURSIVE 1 +#define PTHREAD_MUTEX_ERRORCHECK 2 + +#define PTHREAD_MUTEX_STALLED 0 +#define PTHREAD_MUTEX_ROBUST 1 + +#define PTHREAD_PRIO_NONE 0 +#define PTHREAD_PRIO_INHERIT 1 +#define PTHREAD_PRIO_PROTECT 2 + +#define PTHREAD_INHERIT_SCHED 0 +#define PTHREAD_EXPLICIT_SCHED 1 + +#define PTHREAD_SCOPE_SYSTEM 0 +#define PTHREAD_SCOPE_PROCESS 1 + +#define PTHREAD_PROCESS_PRIVATE 0 + +#define PTHREAD_MUTEX_INITIALIZER \ + {} +#define PTHREAD_RWLOCK_INITIALIZER \ + {} +#define PTHREAD_COND_INITIALIZER \ + {} +#define PTHREAD_ONCE_INIT 0 + +#define PTHREAD_CANCEL_ENABLE 0 +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_MASKED 2 + +#define PTHREAD_CANCEL_DEFERRED 0 +#define PTHREAD_CANCEL_ASYNCHRONOUS 1 + +#define PTHREAD_CANCELED ((void*)-1) + +#define PTHREAD_BARRIER_SERIAL_THREAD (-1) + +int pthread_create(pthread_t* __restrict, const pthread_attr_t* __restrict, void* (*)(void*), + void* __restrict); +int pthread_detach(pthread_t); +_Noreturn void pthread_exit(void*); +int pthread_join(pthread_t, void**); + +pthread_t pthread_self(void); + +int pthread_equal(pthread_t, pthread_t); +#ifndef __cplusplus +#define pthread_equal(x, y) ((x) == (y)) +#endif + +int pthread_setcancelstate(int, int*); +int pthread_setcanceltype(int, int*); +void pthread_testcancel(void); +int pthread_cancel(pthread_t); + +int pthread_once(pthread_once_t*, void (*)(void)); + +int pthread_mutex_init(pthread_mutex_t* __restrict, const pthread_mutexattr_t* __restrict); +int pthread_mutex_lock(pthread_mutex_t*); +int pthread_mutex_unlock(pthread_mutex_t*); +int pthread_mutex_trylock(pthread_mutex_t*); +int pthread_mutex_timedlock(pthread_mutex_t* __restrict, const struct timespec* __restrict); +int pthread_mutex_destroy(pthread_mutex_t*); +int pthread_mutex_consistent(pthread_mutex_t*); + +int pthread_mutex_getprioceiling(const pthread_mutex_t* __restrict, int* __restrict); +int pthread_mutex_setprioceiling(pthread_mutex_t* __restrict, int, int* __restrict); + +int pthread_cond_init(pthread_cond_t* __restrict, const pthread_condattr_t* __restrict); +int pthread_cond_destroy(pthread_cond_t*); +int pthread_cond_wait(pthread_cond_t* __restrict, pthread_mutex_t* __restrict); +int pthread_cond_timedwait(pthread_cond_t* __restrict, pthread_mutex_t* __restrict, + const struct timespec* __restrict); +int pthread_cond_broadcast(pthread_cond_t*); +int pthread_cond_signal(pthread_cond_t*); + +int pthread_rwlock_init(pthread_rwlock_t* __restrict, const pthread_rwlockattr_t* __restrict); +int pthread_rwlock_destroy(pthread_rwlock_t*); +int pthread_rwlock_rdlock(pthread_rwlock_t*); +int pthread_rwlock_tryrdlock(pthread_rwlock_t*); +int pthread_rwlock_timedrdlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict); +int pthread_rwlock_wrlock(pthread_rwlock_t*); +int pthread_rwlock_trywrlock(pthread_rwlock_t*); +int pthread_rwlock_timedwrlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict); +int pthread_rwlock_unlock(pthread_rwlock_t*); + +int pthread_spin_init(pthread_spinlock_t*, int); +int pthread_spin_destroy(pthread_spinlock_t*); +int pthread_spin_lock(pthread_spinlock_t*); +int pthread_spin_trylock(pthread_spinlock_t*); +int pthread_spin_unlock(pthread_spinlock_t*); + +int pthread_barrier_init(pthread_barrier_t* __restrict, const pthread_barrierattr_t* __restrict, + unsigned); +int pthread_barrier_destroy(pthread_barrier_t*); +int pthread_barrier_wait(pthread_barrier_t*); + +int pthread_key_create(pthread_key_t*, void (*)(void*)); +int pthread_key_delete(pthread_key_t); +void* pthread_getspecific(pthread_key_t); +int pthread_setspecific(pthread_key_t, const void*); + +int pthread_attr_init(pthread_attr_t*); +int pthread_attr_destroy(pthread_attr_t*); + +int pthread_attr_getguardsize(const pthread_attr_t* __restrict, size_t* __restrict); +int pthread_attr_setguardsize(pthread_attr_t*, size_t); +int pthread_attr_getstacksize(const pthread_attr_t* __restrict, size_t* __restrict); +int pthread_attr_setstacksize(pthread_attr_t*, size_t); +int pthread_attr_getdetachstate(const pthread_attr_t*, int*); +int pthread_attr_setdetachstate(pthread_attr_t*, int); +int pthread_attr_getstack(const pthread_attr_t* __restrict, void** __restrict, size_t* __restrict); +int pthread_attr_setstack(pthread_attr_t*, void*, size_t) __attribute__((__deprecated__( + "pthread_attr_setstack is not available in Fuchsia; perhaps pthread_attr_setstacksize and/or " + "pthread_attr_setguardsize is sufficient for your needs?"))); +int pthread_attr_getschedparam(const pthread_attr_t* __restrict, struct sched_param* __restrict); +int pthread_attr_setschedparam(pthread_attr_t* __restrict, const struct sched_param* __restrict); + +int pthread_mutexattr_destroy(pthread_mutexattr_t*); +int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_getrobust(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_gettype(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_init(pthread_mutexattr_t*); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t*, int); +int pthread_mutexattr_setprotocol(pthread_mutexattr_t*, int); +int pthread_mutexattr_setrobust(pthread_mutexattr_t*, int); +int pthread_mutexattr_settype(pthread_mutexattr_t*, int); + +int pthread_condattr_init(pthread_condattr_t*); +int pthread_condattr_destroy(pthread_condattr_t*); +int pthread_condattr_setclock(pthread_condattr_t*, clockid_t); +int pthread_condattr_getclock(const pthread_condattr_t* __restrict, clockid_t* __restrict); + +int pthread_rwlockattr_init(pthread_rwlockattr_t*); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t*); + +int pthread_barrierattr_destroy(pthread_barrierattr_t*); +int pthread_barrierattr_init(pthread_barrierattr_t*); + +int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); + +int pthread_getconcurrency(void); +int pthread_setconcurrency(int); + +int pthread_getcpuclockid(pthread_t, clockid_t*); + +#define pthread_cleanup_push(f, x) +#define pthread_cleanup_pop(r) + +#ifdef _GNU_SOURCE +struct cpu_set_t; +int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t*); +int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t*); +int pthread_getattr_np(pthread_t, pthread_attr_t*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_PTHREAD_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/pwd.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/pwd.h new file mode 100644 index 0000000..213eefa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/pwd.h
@@ -0,0 +1,48 @@ +#ifndef SYSROOT_PWD_H_ +#define SYSROOT_PWD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_uid_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include <bits/alltypes.h> + +struct passwd { + char* pw_name; + char* pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char* pw_gecos; + char* pw_dir; + char* pw_shell; +}; + +void setpwent(void); +void endpwent(void); +struct passwd* getpwent(void); + +struct passwd* getpwuid(uid_t); +struct passwd* getpwnam(const char*); +int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**); +int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**); + +#ifdef _GNU_SOURCE +struct passwd* fgetpwent(FILE*); +int putpwent(const struct passwd*, FILE*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_PWD_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/regex.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/regex.h new file mode 100644 index 0000000..53fac22 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/regex.h
@@ -0,0 +1,62 @@ +#ifndef SYSROOT_REGEX_H_ +#define SYSROOT_REGEX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_regoff_t +#define __NEED_size_t + +#include <bits/alltypes.h> + +typedef struct re_pattern_buffer { + size_t re_nsub; + void *__opaque, *__padding[4]; + size_t __nsub2; + char __padding2; +} regex_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +#define REG_EXTENDED 1 +#define REG_ICASE 2 +#define REG_NEWLINE 4 +#define REG_NOSUB 8 + +#define REG_NOTBOL 1 +#define REG_NOTEOL 2 + +#define REG_OK 0 +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 + +#define REG_ENOSYS -1 + +int regcomp(regex_t* __restrict, const char* __restrict, int); +int regexec(const regex_t* __restrict, const char* __restrict, size_t, regmatch_t* __restrict, int); +void regfree(regex_t*); + +size_t regerror(int, const regex_t* __restrict, char* __restrict, size_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_REGEX_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/resolv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/resolv.h new file mode 100644 index 0000000..a90e0e8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/resolv.h
@@ -0,0 +1,143 @@ +#ifndef SYSROOT_RESOLV_H_ +#define SYSROOT_RESOLV_H_ + +#include <arpa/nameser.h> +#include <netinet/in.h> +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAXNS 3 +#define MAXDFLSRCH 3 +#define MAXDNSRCH 6 +#define LOCALDOMAINPARTS 2 + +#define RES_TIMEOUT 5 +#define MAXRESOLVSORT 10 +#define RES_MAXNDOTS 15 +#define RES_MAXRETRANS 30 +#define RES_MAXRETRY 5 +#define RES_DFLRETRY 2 +#define RES_MAXTIME 65535 + +/* unused; purely for broken apps */ +typedef struct __res_state { + int retrans; + int retry; + unsigned long options; + int nscount; + struct sockaddr_in nsaddr_list[MAXNS]; +#define nsaddr nsaddr_list[0] + unsigned short id; + char* dnsrch[MAXDNSRCH + 1]; + char defdname[256]; + unsigned long pfcode; + unsigned ndots : 4; + unsigned nsort : 4; + unsigned ipv6_unavail : 1; + unsigned unused : 23; + struct { + struct in_addr addr; + uint32_t mask; + } sort_list[MAXRESOLVSORT]; + void* qhook; + void* rhook; + int res_h_errno; + int _vcsock; + unsigned _flags; + union { + char pad[52]; + struct { + uint16_t nscount; + uint16_t nsmap[MAXNS]; + int nssocks[MAXNS]; + uint16_t nscount6; + uint16_t nsinit; + struct sockaddr_in6* nsaddrs[MAXNS]; + unsigned int _initstamp[2]; + } _ext; + } _u; +} * res_state; + +#define __RES 19991006 + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +struct res_sym { + int number; + char* name; + char* humanname; +}; + +#define RES_F_VC 0x00000001 +#define RES_F_CONN 0x00000002 +#define RES_F_EDNS0ERR 0x00000004 + +#define RES_EXHAUSTIVE 0x00000001 + +#define RES_INIT 0x00000001 +#define RES_DEBUG 0x00000002 +#define RES_AAONLY 0x00000004 +#define RES_USEVC 0x00000008 +#define RES_PRIMARY 0x00000010 +#define RES_IGNTC 0x00000020 +#define RES_RECURSE 0x00000040 +#define RES_DEFNAMES 0x00000080 +#define RES_STAYOPEN 0x00000100 +#define RES_DNSRCH 0x00000200 +#define RES_INSECURE1 0x00000400 +#define RES_INSECURE2 0x00000800 +#define RES_NOALIASES 0x00001000 +#define RES_USE_INET6 0x00002000 +#define RES_ROTATE 0x00004000 +#define RES_NOCHECKNAME 0x00008000 +#define RES_KEEPTSIG 0x00010000 +#define RES_BLAST 0x00020000 +#define RES_USEBSTRING 0x00040000 +#define RES_NOIP6DOTINT 0x00080000 +#define RES_USE_EDNS0 0x00100000 +#define RES_SNGLKUP 0x00200000 +#define RES_SNGLKUPREOP 0x00400000 +#define RES_USE_DNSSEC 0x00800000 + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH | RES_NOIP6DOTINT) + +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 + +struct __res_state* __res_state(void); +#define _res (*__res_state()) + +int res_init(void); +int res_query(const char*, int, int, unsigned char*, int); +int res_querydomain(const char*, const char*, int, int, unsigned char*, int); +int res_search(const char*, int, int, unsigned char*, int); +int res_mkquery(int, const char*, int, int, const unsigned char*, int, const unsigned char*, + unsigned char*, int); +int res_send(const unsigned char*, int, unsigned char*, int); +int dn_comp(const char*, unsigned char*, int, unsigned char**, unsigned char**); +int dn_expand(const unsigned char*, const unsigned char*, const unsigned char*, char*, int); +int dn_skipname(const unsigned char*, const unsigned char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_RESOLV_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sched.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sched.h new file mode 100644 index 0000000..ac06166 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sched.h
@@ -0,0 +1,110 @@ +#ifndef SYSROOT_SCHED_H_ +#define SYSROOT_SCHED_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_struct_timespec +#define __NEED_pid_t +#define __NEED_time_t + +#ifdef _GNU_SOURCE +#define __NEED_size_t +#endif + +#include <bits/alltypes.h> + +struct sched_param { + int sched_priority; + int sched_ss_low_priority; + struct timespec sched_ss_repl_period; + struct timespec sched_ss_init_budget; + int sched_ss_max_repl; +}; + +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_getparam(pid_t, struct sched_param*); +int sched_getscheduler(pid_t); +int sched_rr_get_interval(pid_t, struct timespec*); +int sched_setparam(pid_t, const struct sched_param*); +int sched_setscheduler(pid_t, int, const struct sched_param*); +int sched_yield(void); + +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#define SCHED_BATCH 3 +#define SCHED_IDLE 5 +#define SCHED_DEADLINE 6 +#define SCHED_RESET_ON_FORK 0x40000000 + +#ifdef _GNU_SOURCE +void* memcpy(void* __restrict, const void* __restrict, size_t); +int memcmp(const void*, const void*, size_t); +void* calloc(size_t, size_t); +void free(void*); + +typedef struct cpu_set_t { + unsigned long __bits[128 / sizeof(long)]; +} cpu_set_t; +int __sched_cpucount(size_t, const cpu_set_t*); +int sched_getcpu(void); +int sched_getaffinity(pid_t, size_t, cpu_set_t*); +int sched_setaffinity(pid_t, size_t, const cpu_set_t*); + +#define __CPU_op_S(i, size, set, op) \ + ((i) / 8U >= (size) \ + ? 0 \ + : ((set)->__bits[(i) / 8 / sizeof(long)] op(1UL << ((i) % (8 * sizeof(long)))))) + +#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=) +#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &= ~) +#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &) + +#define __CPU_op_func_S(func, op) \ + static __inline void __CPU_##func##_S(size_t __size, cpu_set_t* __dest, const cpu_set_t* __src1, \ + const cpu_set_t* __src2) { \ + size_t __i; \ + for (__i = 0; __i < __size / sizeof(long); __i++) \ + __dest->__bits[__i] = __src1->__bits[__i] op __src2->__bits[__i]; \ + } + +__CPU_op_func_S(AND, &) __CPU_op_func_S(OR, |) __CPU_op_func_S(XOR, ^) + +#define CPU_AND_S(a, b, c, d) __CPU_AND_S(a, b, c, d) +#define CPU_OR_S(a, b, c, d) __CPU_OR_S(a, b, c, d) +#define CPU_XOR_S(a, b, c, d) __CPU_XOR_S(a, b, c, d) + +#define CPU_COUNT_S(size, set) __sched_cpucount(size, set) +#define CPU_ZERO_S(size, set) memset(set, 0, size) +#define CPU_EQUAL_S(size, set1, set2) (!memcmp(set1, set2, size)) + +#define CPU_ALLOC_SIZE(n) \ + (sizeof(long) * ((n) / (8 * sizeof(long)) + \ + ((n) % (8 * sizeof(long)) + 8 * sizeof(long) - 1) / (8 * sizeof(long)))) +#define CPU_ALLOC(n) ((cpu_set_t*)calloc(1, CPU_ALLOC_SIZE(n))) +#define CPU_FREE(set) free(set) + +#define CPU_SETSIZE 128 + +#define CPU_SET(i, set) CPU_SET_S(i, sizeof(cpu_set_t), set) +#define CPU_CLR(i, set) CPU_CLR_S(i, sizeof(cpu_set_t), set) +#define CPU_ISSET(i, set) CPU_ISSET_S(i, sizeof(cpu_set_t), set) +#define CPU_AND(d, s1, s2) CPU_AND_S(sizeof(cpu_set_t), d, s1, s2) +#define CPU_OR(d, s1, s2) CPU_OR_S(sizeof(cpu_set_t), d, s1, s2) +#define CPU_XOR(d, s1, s2) CPU_XOR_S(sizeof(cpu_set_t), d, s1, s2) +#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t), set) +#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t), set) +#define CPU_EQUAL(s1, s2) CPU_EQUAL_S(sizeof(cpu_set_t), s1, s2) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SCHED_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/search.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/search.h new file mode 100644 index 0000000..5348eab --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/search.h
@@ -0,0 +1,61 @@ +#ifndef SYSROOT_SEARCH_H_ +#define SYSROOT_SEARCH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#include <bits/alltypes.h> + +typedef enum { FIND, ENTER } ACTION; +typedef enum { preorder, postorder, endorder, leaf } VISIT; + +typedef struct entry { + char* key; + void* data; +} ENTRY; + +int hcreate(size_t); +void hdestroy(void); +ENTRY* hsearch(ENTRY, ACTION); + +#ifdef _GNU_SOURCE +struct hsearch_data { + struct __tab* __tab; + unsigned int __unused1; + unsigned int __unused2; +}; + +int hcreate_r(size_t, struct hsearch_data*); +void hdestroy_r(struct hsearch_data*); +int hsearch_r(ENTRY, ACTION, ENTRY**, struct hsearch_data*); +#endif + +void insque(void*, void*); +void remque(void*); + +void* lsearch(const void*, void*, size_t*, size_t, int (*)(const void*, const void*)); +void* lfind(const void*, const void*, size_t*, size_t, int (*)(const void*, const void*)); + +void* tdelete(const void* __restrict, void** __restrict, int (*)(const void*, const void*)); +void* tfind(const void*, void* const*, int (*)(const void*, const void*)); +void* tsearch(const void*, void**, int (*)(const void*, const void*)); +void twalk(const void*, void (*)(const void*, VISIT, int)); + +#ifdef _GNU_SOURCE +struct qelem { + struct qelem *q_forw, *q_back; + char q_data[1]; +}; + +void tdestroy(void*, void (*)(void*)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SEARCH_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/semaphore.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/semaphore.h new file mode 100644 index 0000000..d9e996e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/semaphore.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_SEMAPHORE_H_ +#define SYSROOT_SEMAPHORE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_sem_t +#define __NEED_time_t +#define __NEED_struct_timespec +#include <fcntl.h> + +#include <bits/alltypes.h> + +#define SEM_FAILED ((sem_t*)0) + +int sem_close(sem_t*); +int sem_destroy(sem_t*); +int sem_getvalue(sem_t* __restrict, int* __restrict); +int sem_init(sem_t*, int, unsigned); +sem_t* sem_open(const char*, int, ...); +int sem_post(sem_t*); +int sem_timedwait(sem_t* __restrict, const struct timespec* __restrict); +int sem_trywait(sem_t*); +int sem_unlink(const char*); +int sem_wait(sem_t*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SEMAPHORE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/setjmp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/setjmp.h new file mode 100644 index 0000000..65971b7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/setjmp.h
@@ -0,0 +1,39 @@ +#ifndef SYSROOT_SETJMP_H_ +#define SYSROOT_SETJMP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/setjmp.h> + +typedef struct __jmp_buf_tag { + __jmp_buf __jb; + unsigned long __fl; + unsigned long __ss[128 / sizeof(long)]; +} jmp_buf[1]; + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef jmp_buf sigjmp_buf; +int sigsetjmp(sigjmp_buf, int); +_Noreturn void siglongjmp(sigjmp_buf, int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int _setjmp(jmp_buf); +_Noreturn void _longjmp(jmp_buf, int); +#endif + +int setjmp(jmp_buf); +_Noreturn void longjmp(jmp_buf, int); + +#define setjmp setjmp + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SETJMP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/signal.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/signal.h new file mode 100644 index 0000000..594cf80 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/signal.h
@@ -0,0 +1,263 @@ +#ifndef SYSROOT_SIGNAL_H_ +#define SYSROOT_SIGNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#ifdef _GNU_SOURCE +#define __ucontext ucontext +#endif + +#define __NEED_size_t +#define __NEED_pid_t +#define __NEED_uid_t +#define __NEED_struct_timespec +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_time_t +#define __NEED_clock_t +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 + +#define SI_ASYNCNL (-60) +#define SI_TKILL (-6) +#define SI_SIGIO (-5) +#define SI_ASYNCIO (-4) +#define SI_MESGQ (-3) +#define SI_TIMER (-2) +#define SI_QUEUE (-1) +#define SI_USER 0 +#define SI_KERNEL 128 + +typedef struct sigaltstack stack_t; + +#endif + +#include <bits/signal.h> + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define SIG_HOLD ((void (*)(int))2) + +#define FPE_INTDIV 1 +#define FPE_INTOVF 2 +#define FPE_FLTDIV 3 +#define FPE_FLTOVF 4 +#define FPE_FLTUND 5 +#define FPE_FLTRES 6 +#define FPE_FLTINV 7 +#define FPE_FLTSUB 8 + +#define ILL_ILLOPC 1 +#define ILL_ILLOPN 2 +#define ILL_ILLADR 3 +#define ILL_ILLTRP 4 +#define ILL_PRVOPC 5 +#define ILL_PRVREG 6 +#define ILL_COPROC 7 +#define ILL_BADSTK 8 + +#define SEGV_MAPERR 1 +#define SEGV_ACCERR 2 +#define SEGV_BNDERR 3 + +#define BUS_ADRALN 1 +#define BUS_ADRERR 2 +#define BUS_OBJERR 3 +#define BUS_MCEERR_AR 4 +#define BUS_MCEERR_AO 5 + +#define CLD_EXITED 1 +#define CLD_KILLED 2 +#define CLD_DUMPED 3 +#define CLD_TRAPPED 4 +#define CLD_STOPPED 5 +#define CLD_CONTINUED 6 + +union sigval { + int sival_int; + void* sival_ptr; +}; + +typedef struct { +#ifdef __SI_SWAP_ERRNO_CODE + int si_signo, si_code, si_errno; +#else + int si_signo, si_errno, si_code; +#endif + union { + char __pad[128 - 2 * sizeof(int) - sizeof(long)]; + struct { + union { + struct { + pid_t si_pid; + uid_t si_uid; + } __piduid; + struct { + int si_timerid; + int si_overrun; + } __timer; + } __first; + union { + union sigval si_value; + struct { + int si_status; + clock_t si_utime, si_stime; + } __sigchld; + } __second; + } __si_common; + struct { + void* si_addr; + short si_addr_lsb; + struct { + void* si_lower; + void* si_upper; + } __addr_bnd; + } __sigfault; + struct { + long si_band; + int si_fd; + } __sigpoll; + struct { + void* si_call_addr; + int si_syscall; + unsigned si_arch; + } __sigsys; + } __si_fields; +} siginfo_t; +#define si_pid __si_fields.__si_common.__first.__piduid.si_pid +#define si_uid __si_fields.__si_common.__first.__piduid.si_uid +#define si_status __si_fields.__si_common.__second.__sigchld.si_status +#define si_utime __si_fields.__si_common.__second.__sigchld.si_utime +#define si_stime __si_fields.__si_common.__second.__sigchld.si_stime +#define si_value __si_fields.__si_common.__second.si_value +#define si_addr __si_fields.__sigfault.si_addr +#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb +#define si_lower __si_fields.__sigfault.__addr_bnd.si_lower +#define si_upper __si_fields.__sigfault.__addr_bnd.si_upper +#define si_band __si_fields.__sigpoll.si_band +#define si_fd __si_fields.__sigpoll.si_fd +#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid +#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun +#define si_ptr si_value.sival_ptr +#define si_int si_value.sival_int +#define si_call_addr __si_fields.__sigsys.si_call_addr +#define si_syscall __si_fields.__sigsys.si_syscall +#define si_arch __si_fields.__sigsys.si_arch + +struct sigaction { + union { + void (*sa_handler)(int); + void (*sa_sigaction)(int, siginfo_t*, void*); + } __sa_handler; + sigset_t sa_mask; + int sa_flags; + void (*sa_restorer)(void); +}; +#define sa_handler __sa_handler.sa_handler +#define sa_sigaction __sa_handler.sa_sigaction + +struct sigevent { + union sigval sigev_value; + int sigev_signo; + int sigev_notify; + void (*sigev_notify_function)(union sigval); + pthread_attr_t* sigev_notify_attributes; + char __pad[56 - 3 * sizeof(long)]; +}; + +#define SIGEV_SIGNAL 0 +#define SIGEV_NONE 1 +#define SIGEV_THREAD 2 + +int __libc_current_sigrtmin(void); +int __libc_current_sigrtmax(void); + +#define SIGRTMIN (__libc_current_sigrtmin()) +#define SIGRTMAX (__libc_current_sigrtmax()) + +int kill(pid_t, int); + +int sigemptyset(sigset_t*); +int sigfillset(sigset_t*); +int sigaddset(sigset_t*, int); +int sigdelset(sigset_t*, int); +int sigismember(const sigset_t*, int); + +int sigprocmask(int, const sigset_t* __restrict, sigset_t* __restrict); +int sigsuspend(const sigset_t*); +int sigaction(int, const struct sigaction* __restrict, struct sigaction* __restrict); +int sigpending(sigset_t*); +int sigwait(const sigset_t* __restrict, int* __restrict); +int sigwaitinfo(const sigset_t* __restrict, siginfo_t* __restrict); +int sigtimedwait(const sigset_t* __restrict, siginfo_t* __restrict, + const struct timespec* __restrict); +int sigqueue(pid_t, int, const union sigval); + +int pthread_sigmask(int, const sigset_t* __restrict, sigset_t* __restrict); +int pthread_kill(pthread_t, int); + +void psiginfo(const siginfo_t*, const char*); +void psignal(int, const char*); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +int killpg(pid_t, int); +int sigaltstack(const stack_t* __restrict, stack_t* __restrict); +int siginterrupt(int, int); +int sigpause(int); +#define TRAP_BRKPT 1 +#define TRAP_TRACE 2 +#define POLL_IN 1 +#define POLL_OUT 2 +#define POLL_MSG 3 +#define POLL_ERR 4 +#define POLL_PRI 5 +#define POLL_HUP 6 +#define SS_ONSTACK 1 +#define SS_DISABLE 2 +#endif + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define NSIG _NSIG +typedef void (*sig_t)(int); +#endif + +#ifdef _GNU_SOURCE +typedef void (*sighandler_t)(int); +void (*bsd_signal(int, void (*)(int)))(int); +int sigisemptyset(const sigset_t*); +int sigorset(sigset_t*, const sigset_t*, const sigset_t*); +int sigandset(sigset_t*, const sigset_t*, const sigset_t*); + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#endif + +#define SIG_ERR ((void (*)(int)) - 1) +#define SIG_DFL ((void (*)(int))0) +#define SIG_IGN ((void (*)(int))1) + +typedef int sig_atomic_t; + +void (*signal(int, void (*)(int)))(int); +int raise(int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SIGNAL_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/spawn.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/spawn.h new file mode 100644 index 0000000..1c70bb2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/spawn.h
@@ -0,0 +1,79 @@ +#ifndef SYSROOT_SPAWN_H_ +#define SYSROOT_SPAWN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_mode_t +#define __NEED_pid_t +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +struct sched_param; + +#define POSIX_SPAWN_RESETIDS 1 +#define POSIX_SPAWN_SETPGROUP 2 +#define POSIX_SPAWN_SETSIGDEF 4 +#define POSIX_SPAWN_SETSIGMASK 8 +#define POSIX_SPAWN_SETSCHEDPARAM 16 +#define POSIX_SPAWN_SETSCHEDULER 32 + +typedef struct { + int __flags; + pid_t __pgrp; + sigset_t __def, __mask; + int __prio, __pol, __pad[16]; +} posix_spawnattr_t; + +typedef struct { + int __pad0[2]; + void* __actions; + int __pad[16]; +} posix_spawn_file_actions_t; + +int posix_spawn(pid_t* __restrict, const char* __restrict, const posix_spawn_file_actions_t*, + const posix_spawnattr_t* __restrict, char* const* __restrict, + char* const* __restrict); +int posix_spawnp(pid_t* __restrict, const char* __restrict, const posix_spawn_file_actions_t*, + const posix_spawnattr_t* __restrict, char* const* __restrict, + char* const* __restrict); + +int posix_spawnattr_init(posix_spawnattr_t*); +int posix_spawnattr_destroy(posix_spawnattr_t*); + +int posix_spawnattr_setflags(posix_spawnattr_t*, short); +int posix_spawnattr_getflags(const posix_spawnattr_t* __restrict, short* __restrict); + +int posix_spawnattr_setpgroup(posix_spawnattr_t*, pid_t); +int posix_spawnattr_getpgroup(const posix_spawnattr_t* __restrict, pid_t* __restrict); + +int posix_spawnattr_setsigmask(posix_spawnattr_t* __restrict, const sigset_t* __restrict); +int posix_spawnattr_getsigmask(const posix_spawnattr_t* __restrict, sigset_t* __restrict); + +int posix_spawnattr_setsigdefault(posix_spawnattr_t* __restrict, const sigset_t* __restrict); +int posix_spawnattr_getsigdefault(const posix_spawnattr_t* __restrict, sigset_t* __restrict); + +int posix_spawnattr_setschedparam(posix_spawnattr_t* __restrict, + const struct sched_param* __restrict); +int posix_spawnattr_getschedparam(const posix_spawnattr_t* __restrict, + struct sched_param* __restrict); +int posix_spawnattr_setschedpolicy(posix_spawnattr_t*, int); +int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* __restrict, int* __restrict); + +int posix_spawn_file_actions_init(posix_spawn_file_actions_t*); +int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t*); + +int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* __restrict, int, + const char* __restrict, int, mode_t); +int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t*, int); +int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t*, int, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SPAWN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stdio.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stdio.h new file mode 100644 index 0000000..c08aba0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stdio.h
@@ -0,0 +1,185 @@ +#ifndef SYSROOT_STDIO_H_ +#define SYSROOT_STDIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __printflike(__fmt, __varargs) __attribute__((__format__(__printf__, __fmt, __varargs))) +#define __scanflike(__fmt, __varargs) __attribute__((__format__(__scanf__, __fmt, __varargs))) + +#define __NEED_FILE +#define __NEED___isoc_va_list +#define __NEED_size_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_ssize_t +#define __NEED_off_t +#define __NEED_va_list +#endif + +#include <bits/alltypes.h> +#include <bits/null.h> + +#undef EOF +#define EOF (-1) + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 + +#define BUFSIZ 1024 +#define FILENAME_MAX 4096 +#define FOPEN_MAX 1000 +#define TMP_MAX 10000 +#define L_tmpnam 20 + +typedef union _G_fpos64_t { + char __opaque[16]; + double __align; +} fpos_t; + +extern FILE* const stdin; +extern FILE* const stdout; +extern FILE* const stderr; + +#define stdin (stdin) +#define stdout (stdout) +#define stderr (stderr) + +FILE* fopen(const char* __restrict, const char* __restrict); +FILE* freopen(const char* __restrict, const char* __restrict, FILE* __restrict); +int fclose(FILE*); + +int remove(const char*); +int rename(const char*, const char*); + +int feof(FILE*); +int ferror(FILE*); +int fflush(FILE*); +void clearerr(FILE*); + +int fseek(FILE*, long, int); +long ftell(FILE*); +void rewind(FILE*); + +int fgetpos(FILE* __restrict, fpos_t* __restrict); +int fsetpos(FILE*, const fpos_t*); + +size_t fread(void* __restrict, size_t, size_t, FILE* __restrict); +size_t fwrite(const void* __restrict, size_t, size_t, FILE* __restrict); + +int fgetc(FILE*); +int getc(FILE*); +int getchar(void); +int ungetc(int, FILE*); + +int fputc(int, FILE*); +int putc(int, FILE*); +int putchar(int); + +char* fgets(char* __restrict, int, FILE* __restrict); +#if __STDC_VERSION__ < 201112L +char* gets(char*); +#endif + +int fputs(const char* __restrict, FILE* __restrict); +int puts(const char*); + +int printf(const char* __restrict, ...) __printflike(1, 2); +int fprintf(FILE* __restrict, const char* __restrict, ...) __printflike(2, 3); +int sprintf(char* __restrict, const char* __restrict, ...) __printflike(2, 3); +int snprintf(char* __restrict, size_t, const char* __restrict, ...) __printflike(3, 4); + +int vprintf(const char* __restrict, __isoc_va_list) __printflike(1, 0); +int vfprintf(FILE* __restrict, const char* __restrict, __isoc_va_list) __printflike(2, 0); +int vsprintf(char* __restrict, const char* __restrict, __isoc_va_list) __printflike(2, 0); +int vsnprintf(char* __restrict, size_t, const char* __restrict, __isoc_va_list) __printflike(3, 0); + +int scanf(const char* __restrict, ...) __scanflike(1, 2); +int fscanf(FILE* __restrict, const char* __restrict, ...) __scanflike(2, 3); +int sscanf(const char* __restrict, const char* __restrict, ...) __scanflike(2, 3); +int vscanf(const char* __restrict, __isoc_va_list) __scanflike(1, 0); +int vfscanf(FILE* __restrict, const char* __restrict, __isoc_va_list) __scanflike(2, 0); +int vsscanf(const char* __restrict, const char* __restrict, __isoc_va_list) __scanflike(2, 0); + +void perror(const char*); + +int setvbuf(FILE* __restrict, char* __restrict, int, size_t); +void setbuf(FILE* __restrict, char* __restrict); + +char* tmpnam(char*); +FILE* tmpfile(void); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +FILE* fmemopen(void* __restrict, size_t, const char* __restrict); +FILE* open_memstream(char**, size_t*); +FILE* fdopen(int, const char*); +FILE* popen(const char*, const char*); +int pclose(FILE*); +int fileno(FILE*); +int fseeko(FILE*, off_t, int); +off_t ftello(FILE*); +int dprintf(int, const char* __restrict, ...) __printflike(2, 3); +int vdprintf(int, const char* __restrict, __isoc_va_list) __printflike(2, 0); +void flockfile(FILE*); +int ftrylockfile(FILE*); +void funlockfile(FILE*); +int getc_unlocked(FILE*); +int getchar_unlocked(void); +int putc_unlocked(int, FILE*); +int putchar_unlocked(int); +ssize_t getdelim(char** __restrict, size_t* __restrict, int, FILE* __restrict); +ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict); +int renameat(int, const char*, int, const char*); +char* ctermid(char*); +#define L_ctermid 20 +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define P_tmpdir "/tmp" +char* tempnam(const char*, const char*); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define L_cuserid 20 +char* cuserid(char*); +void setlinebuf(FILE*); +void setbuffer(FILE*, char*, size_t); +int fgetc_unlocked(FILE*); +int fputc_unlocked(int, FILE*); +int fflush_unlocked(FILE*); +size_t fread_unlocked(void*, size_t, size_t, FILE*); +size_t fwrite_unlocked(const void*, size_t, size_t, FILE*); +void clearerr_unlocked(FILE*); +int feof_unlocked(FILE*); +int ferror_unlocked(FILE*); +int fileno_unlocked(FILE*); +int getw(FILE*); +int putw(int, FILE*); +char* fgetln(FILE*, size_t*); +int asprintf(char**, const char*, ...) __printflike(2, 3); +int vasprintf(char**, const char*, __isoc_va_list) __printflike(2, 0); +#endif + +#ifdef _GNU_SOURCE +char* fgets_unlocked(char*, int, FILE*); +int fputs_unlocked(const char*, FILE*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STDIO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stdlib.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stdlib.h new file mode 100644 index 0000000..862c83f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stdlib.h
@@ -0,0 +1,157 @@ +#ifndef SYSROOT_STDLIB_H_ +#define SYSROOT_STDLIB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_size_t +#define __NEED_wchar_t + +#include <bits/alltypes.h> + +int atoi(const char*); +long atol(const char*); +long long atoll(const char*); +double atof(const char*); + +float strtof(const char* __restrict, char** __restrict); +double strtod(const char* __restrict, char** __restrict); +long double strtold(const char* __restrict, char** __restrict); + +long strtol(const char* __restrict, char** __restrict, int); +unsigned long strtoul(const char* __restrict, char** __restrict, int); +long long strtoll(const char* __restrict, char** __restrict, int); +unsigned long long strtoull(const char* __restrict, char** __restrict, int); + +int rand(void); +void srand(unsigned); + +void* malloc(size_t); +void* calloc(size_t, size_t); +void* realloc(void*, size_t); +void free(void*); +void* aligned_alloc(size_t alignment, size_t size); + +_Noreturn void abort(void); +int atexit(void (*)(void)); +_Noreturn void exit(int); +_Noreturn void _Exit(int); +int at_quick_exit(void (*)(void)); +_Noreturn void quick_exit(int); + +char* getenv(const char*); + +int system(const char*); + +void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); +void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); + +int abs(int); +long labs(long); +long long llabs(long long); + +typedef struct { + int quot, rem; +} div_t; +typedef struct { + long quot, rem; +} ldiv_t; +typedef struct { + long long quot, rem; +} lldiv_t; + +div_t div(int, int); +ldiv_t ldiv(long, long); +lldiv_t lldiv(long long, long long); + +int mblen(const char*, size_t); +int mbtowc(wchar_t* __restrict, const char* __restrict, size_t); +int wctomb(char*, wchar_t); +size_t mbstowcs(wchar_t* __restrict, const char* __restrict, size_t); +size_t wcstombs(char* __restrict, const wchar_t* __restrict, size_t); + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +size_t __ctype_get_mb_cur_max(void); +#define MB_CUR_MAX (__ctype_get_mb_cur_max()) + +#define RAND_MAX (0x7fffffff) + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define WNOHANG 1 +#define WUNTRACED 2 + +#define WEXITSTATUS(s) (((s)&0xff00) >> 8) +#define WTERMSIG(s) ((s)&0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) ((short)((((s)&0xffff) * 0x10001) >> 8) > 0x7f00) +#define WIFSIGNALED(s) (((s)&0xffff) - 1U < 0xffu) + +int posix_memalign(void**, size_t, size_t); +int setenv(const char*, const char*, int); +int unsetenv(const char*); +int mkstemp(char*); +int mkostemp(char*, int); +char* mkdtemp(char*); +int getsubopt(char**, char* const*, char**); +int rand_r(unsigned*); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char* realpath(const char* __restrict, char* __restrict); +long int random(void); +void srandom(unsigned int); +char* initstate(unsigned int, char*, size_t); +char* setstate(char*); +int putenv(char*); +int posix_openpt(int); +int grantpt(int); +int unlockpt(int); +char* ptsname(int); +long a64l(const char*); +void setkey(const char*); +double drand48(void); +double erand48(unsigned short[3]); +long int lrand48(void); +long int nrand48(unsigned short[3]); +long mrand48(void); +long jrand48(unsigned short[3]); +void srand48(long); +unsigned short* seed48(unsigned short[3]); +void lcong48(unsigned short[7]); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include <alloca.h> +char* mktemp(char*); +int mkstemps(char*, int); +int mkostemps(char*, int, int); +void* valloc(size_t); +void* memalign(size_t, size_t); +int clearenv(void); +#define WCOREDUMP(s) ((s)&0x80) +#define WIFCONTINUED(s) ((s) == 0xffff) +#endif + +#ifdef _GNU_SOURCE +int ptsname_r(int, char*, size_t); +char* ecvt(double, int, int*, int*); +char* fcvt(double, int, int*, int*); +char* gcvt(double, int, char*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STDLIB_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/string.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/string.h new file mode 100644 index 0000000..0265b57 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/string.h
@@ -0,0 +1,90 @@ +#ifndef SYSROOT_STRING_H_ +#define SYSROOT_STRING_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +void* memcpy(void* __restrict, const void* __restrict, size_t); +void* memmove(void*, const void*, size_t); +void* memset(void*, int, size_t); +int memcmp(const void*, const void*, size_t); +void* memchr(const void*, int, size_t); + +char* strcpy(char* __restrict, const char* __restrict); +char* strncpy(char* __restrict, const char* __restrict, size_t); + +char* strcat(char* __restrict, const char* __restrict); +char* strncat(char* __restrict, const char* __restrict, size_t); + +int strcmp(const char*, const char*); +int strncmp(const char*, const char*, size_t); + +int strcoll(const char*, const char*); +size_t strxfrm(char* __restrict, const char* __restrict, size_t); + +char* strchr(const char*, int); +char* strrchr(const char*, int); + +size_t strcspn(const char*, const char*); +size_t strspn(const char*, const char*); +char* strpbrk(const char*, const char*); +char* strstr(const char*, const char*); +char* strtok(char* __restrict, const char* __restrict); + +size_t strlen(const char*); + +char* strerror(int); + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#include <strings.h> +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char* strtok_r(char* __restrict, const char* __restrict, char** __restrict); +int strerror_r(int, char*, size_t); +char* stpcpy(char* __restrict, const char* __restrict); +char* stpncpy(char* __restrict, const char* __restrict, size_t); +size_t strnlen(const char*, size_t); +char* strdup(const char*); +char* strndup(const char*, size_t); +char* strsignal(int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void* memccpy(void* __restrict, const void* __restrict, int, size_t); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char* strsep(char**, const char*); +size_t strlcat(char*, const char*, size_t); +size_t strlcpy(char*, const char*, size_t); +#endif + +#ifdef _GNU_SOURCE +#define strdupa(x) strcpy(alloca(strlen(x) + 1), x) +int strverscmp(const char*, const char*); +char* strchrnul(const char*, int); +char* strcasestr(const char*, const char*); +void* memmem(const void*, size_t, const void*, size_t); +void* memrchr(const void*, int, size_t); +void* mempcpy(void*, const void*, size_t); +#ifndef __cplusplus +char* basename(char*); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STRING_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/strings.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/strings.h new file mode 100644 index 0000000..eb703d1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/strings.h
@@ -0,0 +1,38 @@ +#ifndef SYSROOT_STRINGS_H_ +#define SYSROOT_STRINGS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#define __NEED_locale_t +#include <bits/alltypes.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) || \ + (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE + 0 < 200809L) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) +int bcmp(const void*, const void*, size_t); +void bcopy(const void*, void*, size_t); +void bzero(void*, size_t); +char* index(const char*, int); +char* rindex(const char*, int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int ffs(int); +int ffsl(long); +int ffsll(long long); +#endif + +int strcasecmp(const char*, const char*); +int strncasecmp(const char*, const char*, size_t); + +int strcasecmp_l(const char*, const char*, locale_t); +int strncasecmp_l(const char*, const char*, size_t, locale_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STRINGS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stropts.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stropts.h new file mode 100644 index 0000000..92eb968 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/stropts.h
@@ -0,0 +1,139 @@ +#ifndef SYSROOT_STROPTS_H_ +#define SYSROOT_STROPTS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __SID ('S' << 8) + +#define I_NREAD (__SID | 1) +#define I_PUSH (__SID | 2) +#define I_POP (__SID | 3) +#define I_LOOK (__SID | 4) +#define I_FLUSH (__SID | 5) +#define I_SRDOPT (__SID | 6) +#define I_GRDOPT (__SID | 7) +#define I_STR (__SID | 8) +#define I_SETSIG (__SID | 9) +#define I_GETSIG (__SID | 10) +#define I_FIND (__SID | 11) +#define I_LINK (__SID | 12) +#define I_UNLINK (__SID | 13) +#define I_PEEK (__SID | 15) +#define I_FDINSERT (__SID | 16) +#define I_SENDFD (__SID | 17) +#define I_RECVFD (__SID | 14) +#define I_SWROPT (__SID | 19) +#define I_GWROPT (__SID | 20) +#define I_LIST (__SID | 21) +#define I_PLINK (__SID | 22) +#define I_PUNLINK (__SID | 23) +#define I_FLUSHBAND (__SID | 28) +#define I_CKBAND (__SID | 29) +#define I_GETBAND (__SID | 30) +#define I_ATMARK (__SID | 31) +#define I_SETCLTIME (__SID | 32) +#define I_GETCLTIME (__SID | 33) +#define I_CANPUT (__SID | 34) + +#define FMNAMESZ 8 + +#define FLUSHR 0x01 +#define FLUSHW 0x02 +#define FLUSHRW 0x03 +#define FLUSHBAND 0x04 + +#define S_INPUT 0x0001 +#define S_HIPRI 0x0002 +#define S_OUTPUT 0x0004 +#define S_MSG 0x0008 +#define S_ERROR 0x0010 +#define S_HANGUP 0x0020 +#define S_RDNORM 0x0040 +#define S_WRNORM S_OUTPUT +#define S_RDBAND 0x0080 +#define S_WRBAND 0x0100 +#define S_BANDURG 0x0200 + +#define RS_HIPRI 0x01 + +#define RNORM 0x0000 +#define RMSGD 0x0001 +#define RMSGN 0x0002 +#define RPROTDAT 0x0004 +#define RPROTDIS 0x0008 +#define RPROTNORM 0x0010 +#define RPROTMASK 0x001C + +#define SNDZERO 0x001 +#define SNDPIPE 0x002 + +#define ANYMARK 0x01 +#define LASTMARK 0x02 + +#define MUXID_ALL (-1) + +#define MSG_HIPRI 0x01 +#define MSG_ANY 0x02 +#define MSG_BAND 0x04 + +#define MORECTL 1 +#define MOREDATA 2 + +struct bandinfo { + unsigned char bi_pri; + int bi_flag; +}; + +struct strbuf { + int maxlen; + int len; + char* buf; +}; + +struct strpeek { + struct strbuf ctlbuf; + struct strbuf databuf; + unsigned flags; +}; + +struct strfdinsert { + struct strbuf ctlbuf; + struct strbuf databuf; + unsigned flags; + int fildes; + int offset; +}; + +struct strioctl { + int ic_cmd; + int ic_timout; + int ic_len; + char* ic_dp; +}; + +struct strrecvfd { + int fd; + int uid; + int gid; + char __fill[8]; +}; + +struct str_mlist { + char l_name[FMNAMESZ + 1]; +}; + +struct str_list { + int sl_nmods; + struct str_mlist* sl_modlist; +}; + +int isastream(int); +int ioctl(int, int, ...); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STROPTS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/acct.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/acct.h new file mode 100644 index 0000000..8561ad0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/acct.h
@@ -0,0 +1,72 @@ +#ifndef SYSROOT_SYS_ACCT_H_ +#define SYSROOT_SYS_ACCT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <endian.h> +#include <features.h> +#include <stdint.h> +#include <time.h> + +#define ACCT_COMM 16 + +typedef uint16_t comp_t; + +struct acct { + char ac_flag; + uint16_t ac_uid; + uint16_t ac_gid; + uint16_t ac_tty; + uint32_t ac_btime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_etime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + uint32_t ac_exitcode; + char ac_comm[ACCT_COMM + 1]; + char ac_pad[10]; +}; + +struct acct_v3 { + char ac_flag; + char ac_version; + uint16_t ac_tty; + uint32_t ac_exitcode; + uint32_t ac_uid; + uint32_t ac_gid; + uint32_t ac_pid; + uint32_t ac_ppid; + uint32_t ac_btime; + float ac_etime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + char ac_comm[ACCT_COMM]; +}; + +#define AFORK 1 +#define ASU 2 +#define ACORE 8 +#define AXSIG 16 +#define ACCT_BYTEORDER (128 * (__BYTE_ORDER == __BIG_ENDIAN)) +#define AHZ 100 + +int acct(const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_ACCT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/auxv.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/auxv.h new file mode 100644 index 0000000..61ddea0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/auxv.h
@@ -0,0 +1,16 @@ +#ifndef SYSROOT_SYS_AUXV_H_ +#define SYSROOT_SYS_AUXV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <elf.h> + +unsigned long getauxval(unsigned long); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_AUXV_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/dir.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/dir.h new file mode 100644 index 0000000..9ba1c79 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/dir.h
@@ -0,0 +1,2 @@ +#include <dirent.h> +#define direct dirent
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/errno.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/errno.h new file mode 100644 index 0000000..35a3e5a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/errno.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/errno.h> to <errno.h> +#include <errno.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/eventfd.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/eventfd.h new file mode 100644 index 0000000..4259bac --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/eventfd.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_SYS_EVENTFD_H_ +#define SYSROOT_SYS_EVENTFD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fcntl.h> +#include <stdint.h> + +typedef uint64_t eventfd_t; + +#define EFD_SEMAPHORE 1 +#define EFD_CLOEXEC O_CLOEXEC +#define EFD_NONBLOCK O_NONBLOCK + +int eventfd(unsigned int, int); +int eventfd_read(int, eventfd_t*); +int eventfd_write(int, eventfd_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_EVENTFD_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/fcntl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/fcntl.h new file mode 100644 index 0000000..3dd928e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/fcntl.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> +#include <fcntl.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/file.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/file.h new file mode 100644 index 0000000..fe17290 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/file.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_SYS_FILE_H_ +#define SYSROOT_SYS_FILE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 + +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 + +int flock(int, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_FILE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/fsuid.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/fsuid.h new file mode 100644 index 0000000..a9f654c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/fsuid.h
@@ -0,0 +1,20 @@ +#ifndef SYSROOT_SYS_FSUID_H_ +#define SYSROOT_SYS_FSUID_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_uid_t +#define __NEED_gid_t + +#include <bits/alltypes.h> + +int setfsuid(uid_t); +int setfsgid(gid_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_FSUID_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/io.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/io.h new file mode 100644 index 0000000..89617e5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/io.h
@@ -0,0 +1,19 @@ +#ifndef SYSROOT_SYS_IO_H_ +#define SYSROOT_SYS_IO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/io.h> + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_IO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ioctl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ioctl.h new file mode 100644 index 0000000..ad22a3b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ioctl.h
@@ -0,0 +1,16 @@ +#ifndef SYSROOT_SYS_IOCTL_H_ +#define SYSROOT_SYS_IOCTL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <bits/ioctl.h> + +int ioctl(int, int, ...); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_IOCTL_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ipc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ipc.h new file mode 100644 index 0000000..5d019f4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ipc.h
@@ -0,0 +1,44 @@ +#ifndef SYSROOT_SYS_IPC_H_ +#define SYSROOT_SYS_IPC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_mode_t +#define __NEED_key_t + +#include <bits/alltypes.h> + +#define __ipc_perm_key __key +#define __ipc_perm_seq __seq + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __key key +#define __seq seq +#endif + +#include <bits/ipc.h> + +#define IPC_CREAT 01000 +#define IPC_EXCL 02000 +#define IPC_NOWAIT 04000 + +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_STAT 2 +#define IPC_INFO 3 + +#define IPC_PRIVATE ((key_t)0) + +key_t ftok(const char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_IPC_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/klog.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/klog.h new file mode 100644 index 0000000..b182302 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/klog.h
@@ -0,0 +1,14 @@ +#ifndef SYSROOT_SYS_KLOG_H_ +#define SYSROOT_SYS_KLOG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int klogctl(int, char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_KLOG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mman.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mman.h new file mode 100644 index 0000000..7a913ae --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mman.h
@@ -0,0 +1,102 @@ +#ifndef SYSROOT_SYS_MMAN_H_ +#define SYSROOT_SYS_MMAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_mode_t +#define __NEED_size_t +#define __NEED_off_t + +#include <bits/alltypes.h> + +#define MAP_FAILED ((void*)-1) + +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 +#define MAP_TYPE 0x0f +#define MAP_FIXED 0x10 +#define MAP_ANON 0x20 +#define MAP_ANONYMOUS MAP_ANON +#define MAP_NORESERVE 0x4000 +#define MAP_GROWSDOWN 0x0100 +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_LOCKED 0x2000 +#define MAP_POPULATE 0x8000 +#define MAP_NONBLOCK 0x10000 +#define MAP_STACK 0x20000 +#define MAP_HUGETLB 0x40000 +#define MAP_JIT 0x80000 +#define MAP_FILE 0 + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 + +#define MS_ASYNC 1 +#define MS_INVALIDATE 2 +#define MS_SYNC 4 + +#define MCL_CURRENT 1 +#define MCL_FUTURE 2 +#define MCL_ONFAULT 4 + +#define POSIX_MADV_NORMAL 0 +#define POSIX_MADV_RANDOM 1 +#define POSIX_MADV_SEQUENTIAL 2 +#define POSIX_MADV_WILLNEED 3 +#define POSIX_MADV_DONTNEED 4 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_SEQUENTIAL 2 +#define MADV_WILLNEED 3 +#define MADV_DONTNEED 4 +#define MADV_FREE 8 +#define MADV_REMOVE 9 +#define MADV_DONTFORK 10 +#define MADV_DOFORK 11 +#define MADV_MERGEABLE 12 +#define MADV_UNMERGEABLE 13 +#define MADV_HUGEPAGE 14 +#define MADV_NOHUGEPAGE 15 +#define MADV_DONTDUMP 16 +#define MADV_DODUMP 17 +#define MADV_HWPOISON 100 +#define MADV_SOFT_OFFLINE 101 +#endif + +void* mmap(void*, size_t, int, int, int, off_t); +int munmap(void*, size_t); + +int mprotect(void*, size_t, int); +int msync(void*, size_t, int); + +int posix_madvise(void*, size_t, int); + +int mlock(const void*, size_t); +int munlock(const void*, size_t); +int mlockall(int); +int munlockall(void); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MLOCK_ONFAULT 0x01 +int madvise(void*, size_t, int); +#endif + +int shm_open(const char*, int, mode_t); +int shm_unlink(const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_MMAN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mount.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mount.h new file mode 100644 index 0000000..53181ea --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mount.h
@@ -0,0 +1,73 @@ +#ifndef SYSROOT_SYS_MOUNT_H_ +#define SYSROOT_SYS_MOUNT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/ioctl.h> + +#define BLKROSET _IO(0x12, 93) +#define BLKROGET _IO(0x12, 94) +#define BLKRRPART _IO(0x12, 95) +#define BLKGETSIZE _IO(0x12, 96) +#define BLKFLSBUF _IO(0x12, 97) +#define BLKRASET _IO(0x12, 98) +#define BLKRAGET _IO(0x12, 99) +#define BLKFRASET _IO(0x12, 100) +#define BLKFRAGET _IO(0x12, 101) +#define BLKSECTSET _IO(0x12, 102) +#define BLKSECTGET _IO(0x12, 103) +#define BLKSSZGET _IO(0x12, 104) +#define BLKBSZGET _IOR(0x12, 112, size_t) +#define BLKBSZSET _IOW(0x12, 113, size_t) +#define BLKGETSIZE64 _IOR(0x12, 114, size_t) + +#define MS_RDONLY 1 +#define MS_NOSUID 2 +#define MS_NODEV 4 +#define MS_NOEXEC 8 +#define MS_SYNCHRONOUS 16 +#define MS_REMOUNT 32 +#define MS_MANDLOCK 64 +#define MS_DIRSYNC 128 +#define MS_NOATIME 1024 +#define MS_NODIRATIME 2048 +#define MS_BIND 4096 +#define MS_MOVE 8192 +#define MS_REC 16384 +#define MS_SILENT 32768 +#define MS_POSIXACL (1 << 16) +#define MS_UNBINDABLE (1 << 17) +#define MS_PRIVATE (1 << 18) +#define MS_SLAVE (1 << 19) +#define MS_SHARED (1 << 20) +#define MS_RELATIME (1 << 21) +#define MS_KERNMOUNT (1 << 22) +#define MS_I_VERSION (1 << 23) +#define MS_STRICTATIME (1 << 24) +#define MS_LAZYTIME (1 << 25) +#define MS_NOSEC (1 << 28) +#define MS_BORN (1 << 29) +#define MS_ACTIVE (1 << 30) +#define MS_NOUSER (1U << 31) + +#define MS_RMT_MASK (MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME) + +#define MS_MGC_VAL 0xc0ed0000 +#define MS_MGC_MSK 0xffff0000 + +#define MNT_FORCE 1 +#define MNT_DETACH 2 +#define MNT_EXPIRE 4 +#define UMOUNT_NOFOLLOW 8 + +int mount(const char*, const char*, const char*, unsigned long, const void*); +int umount(const char*); +int umount2(const char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_MOUNT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/msg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/msg.h new file mode 100644 index 0000000..be0114b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/msg.h
@@ -0,0 +1,52 @@ +#ifndef SYSROOT_SYS_MSG_H_ +#define SYSROOT_SYS_MSG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/ipc.h> + +#define __NEED_pid_t +#define __NEED_key_t +#define __NEED_time_t +#define __NEED_size_t +#define __NEED_ssize_t + +#include <bits/alltypes.h> + +typedef unsigned long msgqnum_t; +typedef unsigned long msglen_t; + +#include <bits/msg.h> + +#define __msg_cbytes msg_cbytes + +#define MSG_NOERROR 010000 +#define MSG_EXCEPT 020000 + +#define MSG_STAT 11 +#define MSG_INFO 12 + +struct msginfo { + int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql; + unsigned short msgseg; +}; + +int msgctl(int, int, struct msqid_ds*); +int msgget(key_t, int); +ssize_t msgrcv(int, void*, size_t, long, int); +int msgsnd(int, const void*, size_t, int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct msgbuf { + long mtype; + char mtext[1]; +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_MSG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mtio.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mtio.h new file mode 100644 index 0000000..3d9f753 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/mtio.h
@@ -0,0 +1,183 @@ +#ifndef SYSROOT_SYS_MTIO_H_ +#define SYSROOT_SYS_MTIO_H_ + +#include <sys/ioctl.h> +#include <sys/types.h> + +struct mtop { + short mt_op; + int mt_count; +}; + +#define _IOT_mtop _IOT(_IOTS(short), 1, _IOTS(int), 1, 0, 0) +#define _IOT_mtget _IOT(_IOTS(long), 7, 0, 0, 0, 0) +#define _IOT_mtpos _IOT_SIMPLE(long) +#define _IOT_mtconfiginfo _IOT(_IOTS(long), 2, _IOTS(short), 3, _IOTS(long), 1) + +#define MTRESET 0 +#define MTFSF 1 +#define MTBSF 2 +#define MTFSR 3 +#define MTBSR 4 +#define MTWEOF 5 +#define MTREW 6 +#define MTOFFL 7 +#define MTNOP 8 +#define MTRETEN 9 +#define MTBSFM 10 +#define MTFSFM 11 +#define MTEOM 12 +#define MTERASE 13 +#define MTRAS1 14 +#define MTRAS2 15 +#define MTRAS3 16 +#define MTSETBLK 20 +#define MTSETDENSITY 21 +#define MTSEEK 22 +#define MTTELL 23 +#define MTSETDRVBUFFER 24 +#define MTFSS 25 +#define MTBSS 26 +#define MTWSM 27 +#define MTLOCK 28 +#define MTUNLOCK 29 +#define MTLOAD 30 +#define MTUNLOAD 31 +#define MTCOMPRESSION 32 +#define MTSETPART 33 +#define MTMKPART 34 + +struct mtget { + long mt_type; + long mt_resid; + long mt_dsreg; + long mt_gstat; + long mt_erreg; + int mt_fileno; + int mt_blkno; +}; + +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 +#define MT_ISWT5150 0x03 +#define MT_ISARCHIVE_5945L2 0x04 +#define MT_ISCMSJ500 0x05 +#define MT_ISTDC3610 0x06 +#define MT_ISARCHIVE_VP60I 0x07 +#define MT_ISARCHIVE_2150L 0x08 +#define MT_ISARCHIVE_2060L 0x09 +#define MT_ISARCHIVESC499 0x0A +#define MT_ISQIC02_ALL_FEATURES 0x0F +#define MT_ISWT5099EEN24 0x11 +#define MT_ISTEAC_MT2ST 0x12 +#define MT_ISEVEREX_FT40A 0x32 +#define MT_ISDDS1 0x51 +#define MT_ISDDS2 0x52 +#define MT_ISSCSI1 0x71 +#define MT_ISSCSI2 0x72 +#define MT_ISFTAPE_UNKNOWN 0x800000 +#define MT_ISFTAPE_FLAG 0x800000 + +struct mt_tape_info { + long t_type; + char* t_name; +}; + +#define MT_TAPE_INFO \ + { \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, { \ + 0, 0 \ + } \ + } + +struct mtpos { + long mt_blkno; +}; + +struct mtconfiginfo { + long mt_type; + long ifc_type; + unsigned short irqnr; + unsigned short dmanr; + unsigned short port; + unsigned long debug; + unsigned have_dens : 1; + unsigned have_bsf : 1; + unsigned have_fsr : 1; + unsigned have_bsr : 1; + unsigned have_eod : 1; + unsigned have_seek : 1; + unsigned have_tell : 1; + unsigned have_ras1 : 1; + unsigned have_ras2 : 1; + unsigned have_ras3 : 1; + unsigned have_qfa : 1; + unsigned pad1 : 5; + char reserved[10]; +}; + +#define MTIOCTOP _IOW('m', 1, struct mtop) +#define MTIOCGET _IOR('m', 2, struct mtget) +#define MTIOCPOS _IOR('m', 3, struct mtpos) + +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) +#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) + +#define GMT_EOF(x) ((x)&0x80000000) +#define GMT_BOT(x) ((x)&0x40000000) +#define GMT_EOT(x) ((x)&0x20000000) +#define GMT_SM(x) ((x)&0x10000000) +#define GMT_EOD(x) ((x)&0x08000000) +#define GMT_WR_PROT(x) ((x)&0x04000000) +#define GMT_ONLINE(x) ((x)&0x01000000) +#define GMT_D_6250(x) ((x)&0x00800000) +#define GMT_D_1600(x) ((x)&0x00400000) +#define GMT_D_800(x) ((x)&0x00200000) +#define GMT_DR_OPEN(x) ((x)&0x00040000) +#define GMT_IM_REP_EN(x) ((x)&0x00010000) + +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) +#define MT_ST_HPLOADER_OFFSET 10000 +#ifndef DEFTAPE +#define DEFTAPE "/dev/tape" +#endif + +#endif // SYSROOT_SYS_MTIO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/param.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/param.h new file mode 100644 index 0000000..301bba7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/param.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_SYS_PARAM_H_ +#define SYSROOT_SYS_PARAM_H_ + +#define MAXSYMLINKS 20 +#define MAXHOSTNAMELEN 64 +#define MAXNAMLEN 255 +#define MAXPATHLEN 4096 +#define NBBY 8 +#define NGROUPS 32 +#define CANBSIZE 255 +#define NOFILE 256 +#define NCARGS 131072 +#define DEV_BSIZE 512 +#define NOGROUP (-1) + +#undef MIN +#undef MAX +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#define __bitop(x, i, o) ((x)[(i) / 8] o(1 << (i) % 8)) +#define setbit(x, i) __bitop(x, i, |=) +#define clrbit(x, i) __bitop(x, i, &= ~) +#define isset(x, i) __bitop(x, i, &) +#define isclr(x, i) !isset(x, i) + +#define howmany(n, d) (((n) + ((d)-1)) / (d)) +#define roundup(n, d) (howmany(n, d) * (d)) +#define powerof2(n) !(((n)-1) & (n)) + +#include <endian.h> +#include <limits.h> + +#endif // SYSROOT_SYS_PARAM_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/personality.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/personality.h new file mode 100644 index 0000000..b32d1eb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/personality.h
@@ -0,0 +1,47 @@ +#ifndef SYSROOT_SYS_PERSONALITY_H_ +#define SYSROOT_SYS_PERSONALITY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ADDR_NO_RANDOMIZE 0x0040000 +#define MMAP_PAGE_ZERO 0x0100000 +#define ADDR_COMPAT_LAYOUT 0x0200000 +#define READ_IMPLIES_EXEC 0x0400000 +#define ADDR_LIMIT_32BIT 0x0800000 +#define SHORT_INODE 0x1000000 +#define WHOLE_SECONDS 0x2000000 +#define STICKY_TIMEOUTS 0x4000000 +#define ADDR_LIMIT_3GB 0x8000000 + +#define PER_LINUX 0 +#define PER_LINUX_32BIT ADDR_LIMIT_32BIT +#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE) +#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS) +#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_ISCR4 (5 | STICKY_TIMEOUTS) +#define PER_BSD 6 +#define PER_SUNOS (6 | STICKY_TIMEOUTS) +#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_LINUX32 8 +#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB) +#define PER_IRIX32 (9 | STICKY_TIMEOUTS) +#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS) +#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS) +#define PER_RISCOS 0xc +#define PER_SOLARIS (0xd | STICKY_TIMEOUTS) +#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#define PER_OSF4 0xf +#define PER_HPUX 0x10 +#define PER_MASK 0xff + +int personality(unsigned long); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_PERSONALITY_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/poll.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/poll.h new file mode 100644 index 0000000..9917040 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/poll.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/poll.h> to <poll.h> +#include <poll.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/quota.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/quota.h new file mode 100644 index 0000000..aec5dc9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/quota.h
@@ -0,0 +1,102 @@ +#ifndef SYSROOT_SYS_QUOTA_H_ +#define SYSROOT_SYS_QUOTA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define _LINUX_QUOTA_VERSION 2 + +#define dbtob(num) ((num) << 10) +#define btodb(num) ((num) >> 10) +#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024) + +#define MAX_IQ_TIME 604800 +#define MAX_DQ_TIME 604800 + +#define MAXQUOTAS 2 +#define USRQUOTA 0 +#define GRPQUOTA 1 + +#define INITQFNAMES {"user", "group", "undefined"}; + +#define QUOTAFILENAME "quota" +#define QUOTAGROUP "staff" + +#define NR_DQHASH 43 +#define NR_DQUOTS 256 + +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type)&SUBCMDMASK)) + +#define Q_SYNC 0x800001 +#define Q_QUOTAON 0x800002 +#define Q_QUOTAOFF 0x800003 +#define Q_GETFMT 0x800004 +#define Q_GETINFO 0x800005 +#define Q_SETINFO 0x800006 +#define Q_GETQUOTA 0x800007 +#define Q_SETQUOTA 0x800008 + +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 +#define QFMT_OCFS2 3 +#define QFMT_VFS_V1 4 + +#define QIF_BLIMITS 1 +#define QIF_SPACE 2 +#define QIF_ILIMITS 4 +#define QIF_INODES 8 +#define QIF_BTIME 16 +#define QIF_ITIME 32 +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct dqblk { + uint64_t dqb_bhardlimit; + uint64_t dqb_bsoftlimit; + uint64_t dqb_curspace; + uint64_t dqb_ihardlimit; + uint64_t dqb_isoftlimit; + uint64_t dqb_curinodes; + uint64_t dqb_btime; + uint64_t dqb_itime; + uint32_t dqb_valid; +}; + +#define dq_bhardlimit dq_dqb.dqb_bhardlimit +#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit +#define dq_curspace dq_dqb.dqb_curspace +#define dq_valid dq_dqb.dqb_valid +#define dq_ihardlimit dq_dqb.dqb_ihardlimit +#define dq_isoftlimit dq_dqb.dqb_isoftlimit +#define dq_curinodes dq_dqb.dqb_curinodes +#define dq_btime dq_dqb.dqb_btime +#define dq_itime dq_dqb.dqb_itime + +#define dqoff(UID) ((long long)(UID) * sizeof(struct dqblk)) + +#define IIF_BGRACE 1 +#define IIF_IGRACE 2 +#define IIF_FLAGS 4 +#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct dqinfo { + uint64_t dqi_bgrace; + uint64_t dqi_igrace; + uint32_t dqi_flags; + uint32_t dqi_valid; +}; + +int quotactl(int, const char*, int, char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_QUOTA_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/random.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/random.h new file mode 100644 index 0000000..258201d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/random.h
@@ -0,0 +1,16 @@ +#ifndef SYSROOT_SYS_RANDOM_H_ +#define SYSROOT_SYS_RANDOM_H_ + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +int getentropy(void* buffer, size_t length) __attribute__((__warn_unused_result__)); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_RANDOM_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/reboot.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/reboot.h new file mode 100644 index 0000000..a83629c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/reboot.h
@@ -0,0 +1,22 @@ +#ifndef SYSROOT_SYS_REBOOT_H_ +#define SYSROOT_SYS_REBOOT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define RB_AUTOBOOT 0x01234567 +#define RB_HALT_SYSTEM 0xcdef0123 +#define RB_ENABLE_CAD 0x89abcdef +#define RB_DISABLE_CAD 0 +#define RB_POWER_OFF 0x4321fedc +#define RB_SW_SUSPEND 0xd000fce2 +#define RB_KEXEC 0x45584543 + +int reboot(int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_REBOOT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/reg.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/reg.h new file mode 100644 index 0000000..0f37ffe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/reg.h
@@ -0,0 +1,9 @@ +#ifndef SYSROOT_SYS_REG_H_ +#define SYSROOT_SYS_REG_H_ + +#include <limits.h> +#include <unistd.h> + +#include <bits/reg.h> + +#endif // SYSROOT_SYS_REG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/select.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/select.h new file mode 100644 index 0000000..5d4fd7d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/select.h
@@ -0,0 +1,54 @@ +#ifndef SYSROOT_SYS_SELECT_H_ +#define SYSROOT_SYS_SELECT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_time_t +#define __NEED_suseconds_t +#define __NEED_struct_timeval +#define __NEED_struct_timespec +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +#define FD_SETSIZE 1024 + +typedef unsigned long fd_mask; + +typedef struct { + unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)]; +} fd_set; + +#define FD_ZERO(s) \ + do { \ + int __i; \ + unsigned long* __b = (s)->fds_bits; \ + for (__i = sizeof(fd_set) / sizeof(long); __i; __i--) \ + *__b++ = 0; \ + } while (0) +#define FD_SET(d, s) \ + ((s)->fds_bits[(d) / (8 * sizeof(long))] |= (1UL << ((d) % (8 * sizeof(long))))) +#define FD_CLR(d, s) \ + ((s)->fds_bits[(d) / (8 * sizeof(long))] &= ~(1UL << ((d) % (8 * sizeof(long))))) +#define FD_ISSET(d, s) \ + !!((s)->fds_bits[(d) / (8 * sizeof(long))] & (1UL << ((d) % (8 * sizeof(long))))) + +int select(int, fd_set* __restrict, fd_set* __restrict, fd_set* __restrict, + struct timeval* __restrict); +int pselect(int, fd_set* __restrict, fd_set* __restrict, fd_set* __restrict, + const struct timespec* __restrict, const sigset_t* __restrict); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NFDBITS (8 * (int)sizeof(long)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SELECT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/sem.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/sem.h new file mode 100644 index 0000000..a4330af --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/sem.h
@@ -0,0 +1,69 @@ +#ifndef SYSROOT_SYS_SEM_H_ +#define SYSROOT_SYS_SEM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_pid_t +#define __NEED_time_t +#ifdef _GNU_SOURCE +#define __NEED_struct_timespec +#endif +#include <sys/ipc.h> + +#include <bits/alltypes.h> + +#define SEM_UNDO 0x1000 +#define GETPID 11 +#define GETVAL 12 +#define GETALL 13 +#define GETNCNT 14 +#define GETZCNT 15 +#define SETVAL 16 +#define SETALL 17 + +#include <endian.h> + +#include <bits/sem.h> + +#define _SEM_SEMUN_UNDEFINED 1 + +#define SEM_STAT 18 +#define SEM_INFO 19 + +struct seminfo { + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvzx; + int semaem; +}; + +struct sembuf { + unsigned short sem_num; + short sem_op; + short sem_flg; +}; + +int semctl(int, int, int, ...); +int semget(key_t, int, int); +int semop(int, struct sembuf*, size_t); + +#ifdef _GNU_SOURCE +int semtimedop(int, struct sembuf*, size_t, const struct timespec*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SEM_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/shm.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/shm.h new file mode 100644 index 0000000..55b4389 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/shm.h
@@ -0,0 +1,54 @@ +#ifndef SYSROOT_SYS_SHM_H_ +#define SYSROOT_SYS_SHM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_time_t +#define __NEED_size_t +#define __NEED_pid_t + +#include <sys/ipc.h> + +#include <bits/alltypes.h> + +#ifdef _GNU_SOURCE +#define __used_ids used_ids +#define __swap_attempts swap_attempts +#define __swap_successes swap_successes +#endif + +#include <bits/shm.h> + +#define SHM_R 0400 +#define SHM_W 0200 + +#define SHM_RDONLY 010000 +#define SHM_RND 020000 +#define SHM_REMAP 040000 +#define SHM_EXEC 0100000 + +#define SHM_LOCK 11 +#define SHM_UNLOCK 12 +#define SHM_STAT 13 +#define SHM_INFO 14 +#define SHM_DEST 01000 +#define SHM_LOCKED 02000 +#define SHM_HUGETLB 04000 +#define SHM_NORESERVE 010000 + +typedef unsigned long shmatt_t; + +void* shmat(int, const void*, int); +int shmctl(int, int, struct shmid_ds*); +int shmdt(const void*); +int shmget(key_t, size_t, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SHM_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/signal.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/signal.h new file mode 100644 index 0000000..45bdcc6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/signal.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/signal.h> to <signal.h> +#include <signal.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/signalfd.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/signalfd.h new file mode 100644 index 0000000..46a5489 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/signalfd.h
@@ -0,0 +1,45 @@ +#ifndef SYSROOT_SYS_SIGNALFD_H_ +#define SYSROOT_SYS_SIGNALFD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fcntl.h> +#include <stdint.h> + +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +#define SFD_CLOEXEC O_CLOEXEC +#define SFD_NONBLOCK O_NONBLOCK + +int signalfd(int, const sigset_t*, int); + +struct signalfd_siginfo { + uint32_t ssi_signo; + int32_t ssi_errno; + int32_t ssi_code; + uint32_t ssi_pid; + uint32_t ssi_uid; + int32_t ssi_fd; + uint32_t ssi_tid; + uint32_t ssi_band; + uint32_t ssi_overrun; + uint32_t ssi_trapno; + int32_t ssi_status; + int32_t ssi_int; + uint64_t ssi_ptr; + uint64_t ssi_utime; + uint64_t ssi_stime; + uint64_t ssi_addr; + uint16_t ssi_addr_lsb; + uint8_t pad[128 - 12 * 4 - 4 * 8 - 2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SIGNALFD_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/socket.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/socket.h new file mode 100644 index 0000000..7f68e6e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/socket.h
@@ -0,0 +1,322 @@ +#ifndef SYSROOT_SYS_SOCKET_H_ +#define SYSROOT_SYS_SOCKET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_socklen_t +#define __NEED_sa_family_t +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_uid_t +#define __NEED_pid_t +#define __NEED_gid_t +#define __NEED_struct_iovec + +#include <bits/alltypes.h> +#include <bits/socket.h> + +#ifdef _GNU_SOURCE +struct ucred { + pid_t pid; + uid_t uid; + gid_t gid; +}; + +struct mmsghdr { + struct msghdr msg_hdr; + unsigned int msg_len; +}; + +struct timespec; + +int sendmmsg(int, struct mmsghdr*, unsigned int, unsigned int); +int recvmmsg(int, struct mmsghdr*, unsigned int, unsigned int, struct timespec*); +#endif + +struct linger { + int l_onoff; + int l_linger; +}; + +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 + +#ifndef SOCK_STREAM +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#endif + +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SOCK_DCCP 6 +#define SOCK_PACKET 10 + +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 02000000 +#define SOCK_NONBLOCK 04000 +#endif + +#define PF_UNSPEC 0 +#define PF_LOCAL 1 +#define PF_UNIX PF_LOCAL +#define PF_FILE PF_LOCAL +#define PF_INET 2 +#define PF_AX25 3 +#define PF_IPX 4 +#define PF_APPLETALK 5 +#define PF_NETROM 6 +#define PF_BRIDGE 7 +#define PF_ATMPVC 8 +#define PF_X25 9 +#define PF_INET6 10 +#define PF_ROSE 11 +#define PF_DECnet 12 +#define PF_NETBEUI 13 +#define PF_SECURITY 14 +#define PF_KEY 15 +#define PF_NETLINK 16 +#define PF_ROUTE PF_NETLINK +#define PF_PACKET 17 +#define PF_ASH 18 +#define PF_ECONET 19 +#define PF_ATMSVC 20 +#define PF_RDS 21 +#define PF_SNA 22 +#define PF_IRDA 23 +#define PF_PPPOX 24 +#define PF_WANPIPE 25 +#define PF_LLC 26 +#define PF_IB 27 +#define PF_MPLS 28 +#define PF_TIPC 30 +#define PF_BLUETOOTH 31 +#define PF_IUCV 32 +#define PF_RXRPC 33 +#define PF_ISDN 34 +#define PF_PHONET 35 +#define PF_IEEE802154 36 +#define PF_CAIF 37 +#define PF_ALG 38 +#define PF_NFC 39 +#define PF_VSOCK 40 +#define PF_MAX 41 + +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX AF_LOCAL +#define AF_FILE AF_LOCAL +#define AF_INET PF_INET +#define AF_AX25 PF_AX25 +#define AF_IPX PF_IPX +#define AF_APPLETALK PF_APPLETALK +#define AF_NETROM PF_NETROM +#define AF_BRIDGE PF_BRIDGE +#define AF_ATMPVC PF_ATMPVC +#define AF_X25 PF_X25 +#define AF_INET6 PF_INET6 +#define AF_ROSE PF_ROSE +#define AF_DECnet PF_DECnet +#define AF_NETBEUI PF_NETBEUI +#define AF_SECURITY PF_SECURITY +#define AF_KEY PF_KEY +#define AF_NETLINK PF_NETLINK +#define AF_ROUTE PF_ROUTE +#define AF_PACKET PF_PACKET +#define AF_ASH PF_ASH +#define AF_ECONET PF_ECONET +#define AF_ATMSVC PF_ATMSVC +#define AF_RDS PF_RDS +#define AF_SNA PF_SNA +#define AF_IRDA PF_IRDA +#define AF_PPPOX PF_PPPOX +#define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_IB PF_IB +#define AF_MPLS PF_MPLS +#define AF_TIPC PF_TIPC +#define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG +#define AF_NFC PF_NFC +#define AF_VSOCK PF_VSOCK +#define AF_MAX PF_MAX + +#ifndef SO_DEBUG +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +#define SO_BSDCOMPAT 14 +#define SO_REUSEPORT 15 +#define SO_PASSCRED 16 +#define SO_PEERCRED 17 +#define SO_RCVLOWAT 18 +#define SO_SNDLOWAT 19 +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 +#define SO_ACCEPTCONN 30 +#define SO_SNDBUFFORCE 32 +#define SO_RCVBUFFORCE 33 +#define SO_PROTOCOL 38 +#define SO_DOMAIN 39 +#endif + +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + +#define SO_BINDTODEVICE 25 + +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 +#define SO_GET_FILTER SO_ATTACH_FILTER + +#define SO_PEERNAME 28 +#define SO_TIMESTAMP 29 +#define SCM_TIMESTAMP SO_TIMESTAMP + +#define SO_PEERSEC 31 +#define SO_PASSSEC 34 +#define SO_TIMESTAMPNS 35 +#define SCM_TIMESTAMPNS SO_TIMESTAMPNS +#define SO_MARK 36 +#define SO_TIMESTAMPING 37 +#define SCM_TIMESTAMPING SO_TIMESTAMPING +#define SO_RXQ_OVFL 40 +#define SO_WIFI_STATUS 41 +#define SCM_WIFI_STATUS SO_WIFI_STATUS +#define SO_PEEK_OFF 42 +#define SO_NOFCS 43 +#define SO_LOCK_FILTER 44 +#define SO_SELECT_ERR_QUEUE 45 +#define SO_BUSY_POLL 46 +#define SO_MAX_PACING_RATE 47 +#define SO_BPF_EXTENSIONS 48 +#define SO_INCOMING_CPU 49 +#define SO_ATTACH_BPF 50 +#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_ATTACH_REUSEPORT_CBPF 51 +#define SO_ATTACH_REUSEPORT_EBPF 52 + +#ifndef SOL_SOCKET +#define SOL_SOCKET 1 +#endif + +#define SOL_IP 0 +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 + +#define SOL_RAW 255 +#define SOL_DECNET 261 +#define SOL_X25 262 +#define SOL_PACKET 263 +#define SOL_ATM 264 +#define SOL_AAL 265 +#define SOL_IRDA 266 + +#define SOMAXCONN 128 + +#define MSG_OOB 0x0001 +#define MSG_PEEK 0x0002 +#define MSG_DONTROUTE 0x0004 +#define MSG_CTRUNC 0x0008 +#define MSG_PROXY 0x0010 +#define MSG_TRUNC 0x0020 +#define MSG_DONTWAIT 0x0040 +#define MSG_EOR 0x0080 +#define MSG_WAITALL 0x0100 +#define MSG_FIN 0x0200 +#define MSG_SYN 0x0400 +#define MSG_CONFIRM 0x0800 +#define MSG_RST 0x1000 +#define MSG_ERRQUEUE 0x2000 +#define MSG_MORE 0x8000 +#define MSG_WAITFORONE 0x10000 +#define MSG_FASTOPEN 0x20000000 +#define MSG_CMSG_CLOEXEC 0x40000000 + +#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1)) +#define __CMSG_NEXT(cmsg) ((unsigned char*)(cmsg) + __CMSG_LEN(cmsg)) +#define __MHDR_END(mhdr) ((unsigned char*)(mhdr)->msg_control + (mhdr)->msg_controllen) + +#define CMSG_DATA(cmsg) ((unsigned char*)(((struct cmsghdr*)(cmsg)) + 1)) +#define CMSG_NXTHDR(mhdr, cmsg) \ + ((cmsg)->cmsg_len < sizeof(struct cmsghdr) \ + ? (struct cmsghdr*)0 \ + : (__CMSG_NEXT(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) \ + ? (struct cmsghdr*)0 \ + : ((struct cmsghdr*)__CMSG_NEXT(cmsg)))) +#define CMSG_FIRSTHDR(mhdr) \ + ((size_t)(mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? (struct cmsghdr*)(mhdr)->msg_control \ + : (struct cmsghdr*)0) + +#define CMSG_ALIGN(len) (((len) + sizeof(size_t) - 1) & (size_t) ~(sizeof(size_t) - 1)) +#define CMSG_SPACE(len) (CMSG_ALIGN(len) + CMSG_ALIGN(sizeof(struct cmsghdr))) +#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) + +#define SCM_RIGHTS 0x01 +#define SCM_CREDENTIALS 0x02 + +struct sockaddr { + sa_family_t sa_family; + char sa_data[14]; +}; + +struct sockaddr_storage { + sa_family_t ss_family; + unsigned long __ss_align; + char __ss_padding[128 - 2 * sizeof(unsigned long)]; +}; + +int socket(int, int, int); +int socketpair(int, int, int, int[2]); + +int shutdown(int, int); + +int bind(int, const struct sockaddr*, socklen_t); +int connect(int, const struct sockaddr*, socklen_t); +int listen(int, int); +int accept(int, struct sockaddr* __restrict, socklen_t* __restrict); +int accept4(int, struct sockaddr* __restrict, socklen_t* __restrict, int); + +int getsockname(int, struct sockaddr* __restrict, socklen_t* __restrict); +int getpeername(int, struct sockaddr* __restrict, socklen_t* __restrict); + +ssize_t send(int, const void*, size_t, int); +ssize_t recv(int, void*, size_t, int); +ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t); +ssize_t recvfrom(int, void* __restrict, size_t, int, struct sockaddr* __restrict, + socklen_t* __restrict); +ssize_t sendmsg(int, const struct msghdr*, int); +ssize_t recvmsg(int, struct msghdr*, int); + +int getsockopt(int, int, int, void* __restrict, socklen_t* __restrict); +int setsockopt(int, int, int, const void*, socklen_t); + +int sockatmark(int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SOCKET_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/stat.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/stat.h new file mode 100644 index 0000000..d58e26c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/stat.h
@@ -0,0 +1,102 @@ +#ifndef SYSROOT_SYS_STAT_H_ +#define SYSROOT_SYS_STAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_dev_t +#define __NEED_ino_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_time_t +#define __NEED_blksize_t +#define __NEED_blkcnt_t +#define __NEED_struct_timespec + +#include <bits/alltypes.h> +#include <bits/stat.h> + +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec + +#define S_IFMT 0170000 + +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFBLK 0060000 +#define S_IFREG 0100000 +#define S_IFIFO 0010000 +#define S_IFLNK 0120000 +#define S_IFSOCK 0140000 + +#define S_TYPEISMQ(buf) 0 +#define S_TYPEISSEM(buf) 0 +#define S_TYPEISSHM(buf) 0 +#define S_TYPEISTMO(buf) 0 + +#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#define S_ISCHR(mode) (((mode)&S_IFMT) == S_IFCHR) +#define S_ISBLK(mode) (((mode)&S_IFMT) == S_IFBLK) +#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG) +#define S_ISFIFO(mode) (((mode)&S_IFMT) == S_IFIFO) +#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK) +#define S_ISSOCK(mode) (((mode)&S_IFMT) == S_IFSOCK) + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#define UTIME_NOW 0x3fffffff +#define UTIME_OMIT 0x3ffffffe + +int stat(const char* __restrict, struct stat* __restrict); +int fstat(int, struct stat*); +int lstat(const char* __restrict, struct stat* __restrict); +int fstatat(int, const char* __restrict, struct stat* __restrict, int); +int chmod(const char*, mode_t); +int fchmod(int, mode_t); +int fchmodat(int, const char*, mode_t, int); +mode_t umask(mode_t); +int mkdir(const char*, mode_t); +int mknod(const char*, mode_t, dev_t); +int mkfifo(const char*, mode_t); +int mkdirat(int, const char*, mode_t); +int mknodat(int, const char*, mode_t, dev_t); +int mkfifoat(int, const char*, mode_t); + +int futimens(int, const struct timespec[2]); +int utimensat(int, const char*, const struct timespec[2], int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int lchmod(const char*, mode_t); +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_STAT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/statfs.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/statfs.h new file mode 100644 index 0000000..1459181 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/statfs.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_SYS_STATFS_H_ +#define SYSROOT_SYS_STATFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <sys/statvfs.h> + +typedef struct __fsid_t { + int __val[2]; +} fsid_t; + +#include <bits/statfs.h> + +int statfs(const char*, struct statfs*); +int fstatfs(int, struct statfs*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_STATFS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/statvfs.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/statvfs.h new file mode 100644 index 0000000..0423246 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/statvfs.h
@@ -0,0 +1,50 @@ +#ifndef SYSROOT_SYS_STATVFS_H_ +#define SYSROOT_SYS_STATVFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t +#include <endian.h> + +#include <bits/alltypes.h> + +struct statvfs { + unsigned long f_bsize, f_frsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree, f_favail; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned long f_fsid; + unsigned : 8 * (2 * sizeof(int) - sizeof(long)); +#else + unsigned : 8 * (2 * sizeof(int) - sizeof(long)); + unsigned long f_fsid; +#endif + unsigned long f_flag, f_namemax; + int __reserved[6]; +}; + +int statvfs(const char* __restrict, struct statvfs* __restrict); +int fstatvfs(int, struct statvfs*); + +#define ST_RDONLY 1 +#define ST_NOSUID 2 +#define ST_NODEV 4 +#define ST_NOEXEC 8 +#define ST_SYNCHRONOUS 16 +#define ST_MANDLOCK 64 +#define ST_WRITE 128 +#define ST_APPEND 256 +#define ST_IMMUTABLE 512 +#define ST_NOATIME 1024 +#define ST_NODIRATIME 2048 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_STATVFS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/stropts.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/stropts.h new file mode 100644 index 0000000..5b5bc02 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/stropts.h
@@ -0,0 +1 @@ +#include <stropts.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/swap.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/swap.h new file mode 100644 index 0000000..6420606 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/swap.h
@@ -0,0 +1,20 @@ +#ifndef SYSROOT_SYS_SWAP_H_ +#define SYSROOT_SYS_SWAP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SWAP_FLAG_PREFER 0x8000 +#define SWAP_FLAG_PRIO_MASK 0x7fff +#define SWAP_FLAG_PRIO_SHIFT 0 +#define SWAP_FLAG_DISCARD 0x10000 + +int swapon(const char*, int); +int swapoff(const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SWAP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/syslog.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/syslog.h new file mode 100644 index 0000000..7761ece --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/syslog.h
@@ -0,0 +1 @@ +#include <syslog.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/termios.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/termios.h new file mode 100644 index 0000000..f5f751f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/termios.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/termios.h> to <termios.h> +#include <termios.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/time.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/time.h new file mode 100644 index 0000000..a9476c7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/time.h
@@ -0,0 +1,65 @@ +#ifndef SYSROOT_SYS_TIME_H_ +#define SYSROOT_SYS_TIME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <sys/select.h> + +int gettimeofday(struct timeval* __restrict, void* __restrict); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; + struct timeval it_value; +}; + +int getitimer(int, struct itimerval*); +int setitimer(int, const struct itimerval* __restrict, struct itimerval* __restrict); +int utimes(const char*, const struct timeval[2]); + +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; +int futimes(int, const struct timeval[2]); +int futimesat(int, const char*, const struct timeval[2]); +int lutimes(const char*, const struct timeval[2]); +int settimeofday(const struct timeval*, const struct timezone*); +int adjtime(const struct timeval*, struct timeval*); +#define timerisset(t) ((t)->tv_sec || (t)->tv_usec) +#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0) +#define timercmp(s, t, op) \ + ((s)->tv_sec == (t)->tv_sec ? (s)->tv_usec op(t)->tv_usec : (s)->tv_sec op(t)->tv_sec) +#define timeradd(s, t, a) \ + (void)((a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \ + ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \ + ((a)->tv_usec -= 1000000, (a)->tv_sec++)) +#define timersub(s, t, a) \ + (void)((a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \ + ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \ + ((a)->tv_usec += 1000000, (a)->tv_sec--)) +#endif + +#if defined(_GNU_SOURCE) +#define TIMEVAL_TO_TIMESPEC(tv, ts) \ + ((ts)->tv_sec = (tv)->tv_sec, (ts)->tv_nsec = (tv)->tv_usec * 1000, (void)0) +#define TIMESPEC_TO_TIMEVAL(tv, ts) \ + ((tv)->tv_sec = (ts)->tv_sec, (tv)->tv_usec = (ts)->tv_nsec / 1000, (void)0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIME_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timeb.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timeb.h new file mode 100644 index 0000000..bbb7e34 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timeb.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_SYS_TIMEB_H_ +#define SYSROOT_SYS_TIMEB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_time_t + +#include <bits/alltypes.h> + +struct timeb { + time_t time; + unsigned short millitm; + short timezone, dstflag; +}; + +int ftime(struct timeb*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMEB_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timerfd.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timerfd.h new file mode 100644 index 0000000..499a938 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timerfd.h
@@ -0,0 +1,26 @@ +#ifndef SYSROOT_SYS_TIMERFD_H_ +#define SYSROOT_SYS_TIMERFD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fcntl.h> +#include <time.h> + +#define TFD_NONBLOCK O_NONBLOCK +#define TFD_CLOEXEC O_CLOEXEC + +#define TFD_TIMER_ABSTIME 1 + +struct itimerspec; + +int timerfd_create(int, int); +int timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*); +int timerfd_gettime(int, struct itimerspec*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMERFD_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/times.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/times.h new file mode 100644 index 0000000..ec5d3d6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/times.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_SYS_TIMES_H_ +#define SYSROOT_SYS_TIMES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_clock_t +#include <bits/alltypes.h> + +struct tms { + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; + +clock_t times(struct tms*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timex.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timex.h new file mode 100644 index 0000000..9981c93 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/timex.h
@@ -0,0 +1,99 @@ +#ifndef SYSROOT_SYS_TIMEX_H_ +#define SYSROOT_SYS_TIMEX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_clockid_t + +#include <sys/time.h> + +#include <bits/alltypes.h> + +struct ntptimeval { + struct timeval time; + long maxerror, esterror; +}; + +struct timex { + unsigned modes; + long offset, freq, maxerror, esterror; + int status; + long constant, precision, tolerance; + struct timeval time; + long tick, ppsfreq, jitter; + int shift; + long stabil, jitcnt, calcnt, errcnt, stbcnt; + int tai; + int __padding[11]; +}; + +#define ADJ_OFFSET 0x0001 +#define ADJ_FREQUENCY 0x0002 +#define ADJ_MAXERROR 0x0004 +#define ADJ_ESTERROR 0x0008 +#define ADJ_STATUS 0x0010 +#define ADJ_TIMECONST 0x0020 +#define ADJ_TAI 0x0080 +#define ADJ_SETOFFSET 0x0100 +#define ADJ_MICRO 0x1000 +#define ADJ_NANO 0x2000 +#define ADJ_TICK 0x4000 +#define ADJ_OFFSET_SINGLESHOT 0x8001 +#define ADJ_OFFSET_SS_READ 0xa001 + +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT +#define MOD_TAI ADJ_TAI +#define MOD_MICRO ADJ_MICRO +#define MOD_NANO ADJ_NANO + +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 + +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 + +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 + +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 + +#define STA_RONLY \ + (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR | STA_CLOCKERR | STA_NANO | \ + STA_MODE | STA_CLK) + +#define TIME_OK 0 +#define TIME_INS 1 +#define TIME_DEL 2 +#define TIME_OOP 3 +#define TIME_WAIT 4 +#define TIME_ERROR 5 +#define TIME_BAD TIME_ERROR + +#define MAXTC 6 + +int adjtimex(struct timex*); +int clock_adjtime(clockid_t, struct timex*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMEX_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ttydefaults.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ttydefaults.h new file mode 100644 index 0000000..e4994fe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ttydefaults.h
@@ -0,0 +1,39 @@ +#ifndef SYSROOT_SYS_TTYDEFAULTS_H_ +#define SYSROOT_SYS_TTYDEFAULTS_H_ + +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE | ECHOKE | ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) +#define TTYDEF_SPEED (B9600) +#define CTRL(x) (x & 037) +#define CEOF CTRL('d') + +#ifdef _POSIX_VDISABLE +#define CEOL _POSIX_VDISABLE +#define CSTATUS _POSIX_VDISABLE +#else +#define CEOL '\0' +#define CSTATUS '\0' +#endif + +#define CERASE 0177 +#define CINTR CTRL('c') +#define CKILL CTRL('u') +#define CMIN 1 +#define CQUIT 034 +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT CTRL('v') +#define CDISCARD CTRL('o') +#define CWERASE CTRL('w') +#define CREPRINT CTRL('r') +#define CEOT CEOF +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD + +#endif // SYSROOT_SYS_TTYDEFAULTS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/types.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/types.h new file mode 100644 index 0000000..ea195a0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/types.h
@@ -0,0 +1,76 @@ +#ifndef SYSROOT_SYS_TYPES_H_ +#define SYSROOT_SYS_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_ino_t +#define __NEED_dev_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_time_t +#define __NEED_timer_t +#define __NEED_clockid_t + +#define __NEED_blkcnt_t +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t + +#define __NEED_id_t +#define __NEED_key_t +#define __NEED_clock_t +#define __NEED_suseconds_t +#define __NEED_blksize_t + +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t +#define __NEED_useconds_t + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include <stdint.h> +#define __NEED_u_int64_t +#define __NEED_register_t +#endif + +#include <bits/alltypes.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned u_int32_t; +typedef char* caddr_t; +typedef unsigned char u_char; +typedef unsigned short u_short, ushort; +typedef unsigned u_int, uint; +typedef unsigned long u_long, ulong; +typedef long long quad_t; +typedef unsigned long long u_quad_t; +#include <endian.h> +#include <sys/select.h> +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ucontext.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ucontext.h new file mode 100644 index 0000000..5fdbd63 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/ucontext.h
@@ -0,0 +1 @@ +#include <ucontext.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/uio.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/uio.h new file mode 100644 index 0000000..4762083 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/uio.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_SYS_UIO_H_ +#define SYSROOT_SYS_UIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_off_t +#endif + +#include <bits/alltypes.h> + +#define UIO_MAXIOV 1024 + +ssize_t readv(int, const struct iovec*, int); +ssize_t writev(int, const struct iovec*, int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +ssize_t preadv(int, const struct iovec*, int, off_t); +ssize_t pwritev(int, const struct iovec*, int, off_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_UIO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/un.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/un.h new file mode 100644 index 0000000..425c801 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/un.h
@@ -0,0 +1,31 @@ +#ifndef SYSROOT_SYS_UN_H_ +#define SYSROOT_SYS_UN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_sa_family_t +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#endif + +#include <bits/alltypes.h> + +struct sockaddr_un { + sa_family_t sun_family; + char sun_path[108]; +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +size_t strlen(const char*); +#define SUN_LEN(s) (2 + strlen((s)->sun_path)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_UN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/utsname.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/utsname.h new file mode 100644 index 0000000..5d5fee1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/utsname.h
@@ -0,0 +1,30 @@ +#ifndef SYSROOT_SYS_UTSNAME_H_ +#define SYSROOT_SYS_UTSNAME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <limits.h> + +struct utsname { + char sysname[65]; + char nodename[HOST_NAME_MAX + 1]; + char release[65]; + char version[65]; + char machine[65]; +#ifdef _GNU_SOURCE + char domainname[65]; +#else + char __domainname[65]; +#endif +}; + +int uname(struct utsname*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_UTSNAME_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/vfs.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/vfs.h new file mode 100644 index 0000000..a899db2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/vfs.h
@@ -0,0 +1 @@ +#include <sys/statfs.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/wait.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/wait.h new file mode 100644 index 0000000..3b33520 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sys/wait.h
@@ -0,0 +1,46 @@ +#ifndef SYSROOT_SYS_WAIT_H_ +#define SYSROOT_SYS_WAIT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_pid_t +#define __NEED_id_t +#include <bits/alltypes.h> + +typedef enum { P_ALL = 0, P_PID = 1, P_PGID = 2 } idtype_t; + +pid_t wait(int*); +pid_t waitpid(pid_t, int*, int); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include <signal.h> +int waitid(idtype_t, id_t, siginfo_t*, int); +#endif + +#define WNOHANG 1 +#define WUNTRACED 2 + +#define WSTOPPED 2 +#define WEXITED 4 +#define WCONTINUED 8 +#define WNOWAIT 0x1000000 + +#define WEXITSTATUS(s) (((s)&0xff00) >> 8) +#define WTERMSIG(s) ((s)&0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WCOREDUMP(s) ((s)&0x80) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) ((short)((((s)&0xffff) * 0x10001) >> 8) > 0x7f00) +#define WIFSIGNALED(s) (((s)&0xffff) - 1U < 0xffu) +#define WIFCONTINUED(s) ((s) == 0xffff) + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_WAIT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sysexits.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sysexits.h new file mode 100644 index 0000000..ca2782d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/sysexits.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_SYSEXITS_H_ +#define SYSROOT_SYSEXITS_H_ + +#define EX_OK 0 +#define EX__BASE 64 +#define EX_USAGE 64 +#define EX_DATAERR 65 +#define EX_NOINPUT 66 +#define EX_NOUSER 67 +#define EX_NOHOST 68 +#define EX_UNAVAILABLE 69 +#define EX_SOFTWARE 70 +#define EX_OSERR 71 +#define EX_OSFILE 72 +#define EX_CANTCREAT 73 +#define EX_IOERR 74 +#define EX_TEMPFAIL 75 +#define EX_PROTOCOL 76 +#define EX_NOPERM 77 +#define EX_CONFIG 78 +#define EX__MAX 78 + +#endif // SYSROOT_SYSEXITS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/syslog.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/syslog.h new file mode 100644 index 0000000..dcb09e3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/syslog.h
@@ -0,0 +1,121 @@ +#ifndef SYSROOT_SYSLOG_H_ +#define SYSROOT_SYSLOG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 7 +#define LOG_PRI(p) ((p)&LOG_PRIMASK) +#define LOG_MAKEPRI(f, p) (((f) << 3) | (p)) + +#define LOG_MASK(p) (1 << (p)) +#define LOG_UPTO(p) ((1 << ((p) + 1)) - 1) + +#define LOG_KERN (0 << 3) +#define LOG_USER (1 << 3) +#define LOG_MAIL (2 << 3) +#define LOG_DAEMON (3 << 3) +#define LOG_AUTH (4 << 3) +#define LOG_SYSLOG (5 << 3) +#define LOG_LPR (6 << 3) +#define LOG_NEWS (7 << 3) +#define LOG_UUCP (8 << 3) +#define LOG_CRON (9 << 3) +#define LOG_AUTHPRIV (10 << 3) +#define LOG_FTP (11 << 3) + +#define LOG_LOCAL0 (16 << 3) +#define LOG_LOCAL1 (17 << 3) +#define LOG_LOCAL2 (18 << 3) +#define LOG_LOCAL3 (19 << 3) +#define LOG_LOCAL4 (20 << 3) +#define LOG_LOCAL5 (21 << 3) +#define LOG_LOCAL6 (22 << 3) +#define LOG_LOCAL7 (23 << 3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x3f8 +#define LOG_FAC(p) (((p)&LOG_FACMASK) >> 3) + +#define LOG_PID 0x01 +#define LOG_CONS 0x02 +#define LOG_ODELAY 0x04 +#define LOG_NDELAY 0x08 +#define LOG_NOWAIT 0x10 +#define LOG_PERROR 0x20 + +void closelog(void); +void openlog(const char*, int, int); +int setlogmask(int); +void syslog(int, const char*, ...); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define _PATH_LOG "/dev/log" +#define __NEED_va_list +#include <bits/alltypes.h> +void vsyslog(int, const char*, va_list); +#if defined(SYSLOG_NAMES) +#define INTERNAL_NOPRI 0x10 +#define INTERNAL_MARK (LOG_NFACILITIES << 3) +typedef struct { + char* c_name; + int c_val; +} CODE; +#define prioritynames \ + ((CODE*)(const CODE[]){{"alert", LOG_ALERT}, \ + {"crit", LOG_CRIT}, \ + {"debug", LOG_DEBUG}, \ + {"emerg", LOG_EMERG}, \ + {"err", LOG_ERR}, \ + {"error", LOG_ERR}, \ + {"info", LOG_INFO}, \ + {"none", INTERNAL_NOPRI}, \ + {"notice", LOG_NOTICE}, \ + {"panic", LOG_EMERG}, \ + {"warn", LOG_WARNING}, \ + {"warning", LOG_WARNING}, \ + {0, -1}}) +#define facilitynames \ + ((CODE*)(const CODE[]){{"auth", LOG_AUTH}, \ + {"authpriv", LOG_AUTHPRIV}, \ + {"cron", LOG_CRON}, \ + {"daemon", LOG_DAEMON}, \ + {"ftp", LOG_FTP}, \ + {"kern", LOG_KERN}, \ + {"lpr", LOG_LPR}, \ + {"mail", LOG_MAIL}, \ + {"mark", INTERNAL_MARK}, \ + {"news", LOG_NEWS}, \ + {"security", LOG_AUTH}, \ + {"syslog", LOG_SYSLOG}, \ + {"user", LOG_USER}, \ + {"uucp", LOG_UUCP}, \ + {"local0", LOG_LOCAL0}, \ + {"local1", LOG_LOCAL1}, \ + {"local2", LOG_LOCAL2}, \ + {"local3", LOG_LOCAL3}, \ + {"local4", LOG_LOCAL4}, \ + {"local5", LOG_LOCAL5}, \ + {"local6", LOG_LOCAL6}, \ + {"local7", LOG_LOCAL7}, \ + {0, -1}}) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYSLOG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/tar.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/tar.h new file mode 100644 index 0000000..2dcb983 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/tar.h
@@ -0,0 +1,33 @@ +#ifndef SYSROOT_TAR_H_ +#define SYSROOT_TAR_H_ + +#define TSUID 04000 +#define TSGID 02000 +#define TSVTX 01000 +#define TUREAD 00400 +#define TUWRITE 00200 +#define TUEXEC 00100 +#define TGREAD 00040 +#define TGWRITE 00020 +#define TGEXEC 00010 +#define TOREAD 00004 +#define TOWRITE 00002 +#define TOEXEC 00001 + +#define REGTYPE '0' +#define AREGTYPE '\0' +#define LNKTYPE '1' +#define SYMTYPE '2' +#define CHRTYPE '3' +#define BLKTYPE '4' +#define DIRTYPE '5' +#define FIFOTYPE '6' +#define CONTTYPE '7' + +#define TMAGIC "ustar" +#define TMAGLEN 6 + +#define TVERSION "00" +#define TVERSLEN 2 + +#endif // SYSROOT_TAR_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/termios.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/termios.h new file mode 100644 index 0000000..4ccfe13 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/termios.h
@@ -0,0 +1,46 @@ +#ifndef SYSROOT_TERMIOS_H_ +#define SYSROOT_TERMIOS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_pid_t + +#include <bits/alltypes.h> + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 + +#include <bits/termios.h> + +speed_t cfgetospeed(const struct termios*); +speed_t cfgetispeed(const struct termios*); +int cfsetospeed(struct termios*, speed_t); +int cfsetispeed(struct termios*, speed_t); + +int tcgetattr(int, struct termios*); +int tcsetattr(int, int, const struct termios*); + +int tcsendbreak(int, int); +int tcdrain(int); +int tcflush(int, int); +int tcflow(int, int); + +pid_t tcgetsid(int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void cfmakeraw(struct termios*); +int cfsetspeed(struct termios*, speed_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_TERMIOS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/threads.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/threads.h new file mode 100644 index 0000000..480a6f7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/threads.h
@@ -0,0 +1,108 @@ +#ifndef SYSROOT_THREADS_H_ +#define SYSROOT_THREADS_H_ + +#include <features.h> +#include <time.h> + +#ifdef __cplusplus +extern "C" { +typedef unsigned long thrd_t; +#else +typedef struct __pthread* thrd_t; +#define thread_local _Thread_local +#endif + +typedef unsigned tss_t; +typedef int (*thrd_start_t)(void*); +typedef void (*tss_dtor_t)(void*); + +#define __NEED_cnd_t +#define __NEED_mtx_t +#define __NEED_once_flag + +#include <bits/alltypes.h> + +#define TSS_DTOR_ITERATIONS 4 + +enum { + thrd_success = 0, + thrd_busy = 1, + thrd_error = 2, + thrd_nomem = 3, + thrd_timedout = 4, +}; + +// These are bitfield values; initialize with e.g. (mtx_plain|mtx_timed). +// mtx_recursive is not implemented. +enum { + mtx_plain = 0, + mtx_recursive = 1, + mtx_timed = 2, +}; + +#ifdef _ALL_SOURCE +#define MTX_INIT \ + {} +#define CND_INIT \ + {} +#endif + +#define ONCE_FLAG_INIT 0 + +int thrd_create(thrd_t*, thrd_start_t, void*); +#ifdef _ALL_SOURCE +// |name| is silently truncated to a maximum of ZX_MAX_NAME_LEN-1 characters. +int thrd_create_with_name(thrd_t*, thrd_start_t, void*, const char* name); +#endif +_Noreturn void thrd_exit(int); + +int thrd_detach(thrd_t); +int thrd_join(thrd_t, int*); + +int thrd_sleep(const struct timespec*, struct timespec*); +void thrd_yield(void); + +thrd_t thrd_current(void); +int thrd_equal(thrd_t, thrd_t); +#ifndef __cplusplus +#define thrd_equal(A, B) ((A) == (B)) +#endif + +void call_once(once_flag*, void (*)(void)); + +int mtx_init(mtx_t*, int); +void mtx_destroy(mtx_t*); + +int mtx_lock(mtx_t* __m) +#ifdef __clang__ + __attribute__((__acquire_capability__(__m))) +#endif + ; +int mtx_timedlock(mtx_t* __restrict, const struct timespec* __restrict); +int mtx_trylock(mtx_t*); +int mtx_unlock(mtx_t* __m) +#ifdef __clang__ + __attribute__((__release_capability__(__m))) +#endif + ; + +int cnd_init(cnd_t*); +void cnd_destroy(cnd_t*); + +int cnd_broadcast(cnd_t*); +int cnd_signal(cnd_t*); + +int cnd_timedwait(cnd_t* __restrict, mtx_t* __restrict, const struct timespec* __restrict); +int cnd_wait(cnd_t*, mtx_t*); + +int tss_create(tss_t*, tss_dtor_t); +void tss_delete(tss_t key); + +int tss_set(tss_t, void*); +void* tss_get(tss_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_THREADS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/time.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/time.h new file mode 100644 index 0000000..b81da45 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/time.h
@@ -0,0 +1,124 @@ +#ifndef SYSROOT_TIME_H_ +#define SYSROOT_TIME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_size_t +#define __NEED_time_t +#define __NEED_clock_t +#define __NEED_struct_timespec + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_clockid_t +#define __NEED_timer_t +#define __NEED_pid_t +#endif + +#include <bits/alltypes.h> + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define __tm_gmtoff tm_gmtoff +#define __tm_zone tm_zone +#endif + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + long __tm_gmtoff; + const char* __tm_zone; +}; + +clock_t clock(void); +time_t time(time_t*); +double difftime(time_t, time_t); +time_t mktime(struct tm*); +size_t strftime(char* __restrict, size_t, const char* __restrict, const struct tm* __restrict); +struct tm* gmtime(const time_t*); +struct tm* localtime(const time_t*); +char* asctime(const struct tm*); +char* ctime(const time_t*); +int timespec_get(struct timespec*, int); + +#define CLOCKS_PER_SEC 1000000L + +#define TIME_UTC 1 + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +struct tm* gmtime_r(const time_t* __restrict, struct tm* __restrict); +struct tm* localtime_r(const time_t* __restrict, struct tm* __restrict); +char* asctime_r(const struct tm* __restrict, char* __restrict); +char* ctime_r(const time_t*, char*); + +void tzset(void); + +struct itimerspec { + struct timespec it_interval; + struct timespec it_value; +}; + +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 1 +#define CLOCK_PROCESS_CPUTIME_ID 2 +#define CLOCK_THREAD_CPUTIME_ID 3 +#define CLOCK_MONOTONIC_RAW 4 +#define CLOCK_REALTIME_COARSE 5 +#define CLOCK_MONOTONIC_COARSE 6 +#define CLOCK_BOOTTIME 7 +#define CLOCK_REALTIME_ALARM 8 +#define CLOCK_BOOTTIME_ALARM 9 +#define CLOCK_SGI_CYCLE 10 +#define CLOCK_TAI 11 + +#define TIMER_ABSTIME 1 + +int nanosleep(const struct timespec*, struct timespec*); +int clock_getres(clockid_t, struct timespec*); +int clock_gettime(clockid_t, struct timespec*); +int clock_settime(clockid_t, const struct timespec*); +int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*); +int clock_getcpuclockid(pid_t, clockid_t*); + +struct sigevent; +int timer_create(clockid_t, struct sigevent* __restrict, timer_t* __restrict); +int timer_delete(timer_t); +int timer_settime(timer_t, int, const struct itimerspec* __restrict, struct itimerspec* __restrict); +int timer_gettime(timer_t, struct itimerspec*); +int timer_getoverrun(timer_t); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +char* strptime(const char* __restrict, const char* __restrict, struct tm* __restrict); +extern int daylight; +extern long timezone; +extern char* tzname[2]; +extern int getdate_err; +struct tm* getdate(const char*); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int stime(const time_t*); +time_t timegm(struct tm*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_TIME_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/uchar.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/uchar.h new file mode 100644 index 0000000..79cda7c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/uchar.h
@@ -0,0 +1,28 @@ +#ifndef SYSROOT_UCHAR_H_ +#define SYSROOT_UCHAR_H_ + +#ifdef __cplusplus +extern "C" { +#else +typedef unsigned short char16_t; +typedef unsigned char32_t; +#endif + +#define __NEED_mbstate_t +#define __NEED_size_t + +#include <features.h> + +#include <bits/alltypes.h> + +size_t c16rtomb(char* __restrict, char16_t, mbstate_t* __restrict); +size_t mbrtoc16(char16_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict); + +size_t c32rtomb(char* __restrict, char32_t, mbstate_t* __restrict); +size_t mbrtoc32(char32_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UCHAR_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ucontext.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ucontext.h new file mode 100644 index 0000000..ccd910f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/ucontext.h
@@ -0,0 +1,26 @@ +#ifndef SYSROOT_UCONTEXT_H_ +#define SYSROOT_UCONTEXT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <signal.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NGREG (sizeof(gregset_t) / sizeof(greg_t)) +#endif + +struct __ucontext; + +int getcontext(struct __ucontext*); +void makecontext(struct __ucontext*, void (*)(void), int, ...); +int setcontext(const struct __ucontext*); +int swapcontext(struct __ucontext*, const struct __ucontext*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UCONTEXT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/unistd.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/unistd.h new file mode 100644 index 0000000..e400030 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/unistd.h
@@ -0,0 +1,436 @@ +#ifndef SYSROOT_UNISTD_H_ +#define SYSROOT_UNISTD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_intptr_t +#define __NEED_useconds_t + +#include <bits/alltypes.h> + +int pipe(int[2]); +int pipe2(int[2], int); +int close(int); +int posix_close(int, int); +int dup(int); +int dup2(int, int); +int dup3(int, int, int); +off_t lseek(int, off_t, int); +int fsync(int); +int fdatasync(int); + +ssize_t read(int, void*, size_t); +ssize_t write(int, const void*, size_t); +ssize_t pread(int, void*, size_t, off_t); +ssize_t pwrite(int, const void*, size_t, off_t); + +int chown(const char*, uid_t, gid_t); +int fchown(int, uid_t, gid_t); +int lchown(const char*, uid_t, gid_t); +int fchownat(int, const char*, uid_t, gid_t, int); + +int link(const char*, const char*); +int linkat(int, const char*, int, const char*, int); +int symlink(const char*, const char*); +int symlinkat(const char*, int, const char*); +ssize_t readlink(const char* __restrict, char* __restrict, size_t); +ssize_t readlinkat(int, const char* __restrict, char* __restrict, size_t); +int unlink(const char*); +int unlinkat(int, const char*, int); +int rmdir(const char*); +int truncate(const char*, off_t); +int ftruncate(int, off_t); + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 + +int access(const char*, int); +int faccessat(int, const char*, int, int); + +int chdir(const char*); +char* getcwd(char*, size_t); + +unsigned alarm(unsigned); +unsigned sleep(unsigned); +int pause(void); + +pid_t fork(void); +int execve(const char*, char* const[], char* const[]); +int execv(const char*, char* const[]); +int execle(const char*, const char*, ...); +int execl(const char*, const char*, ...); +int execvp(const char*, char* const[]); +int execlp(const char*, const char*, ...); +int fexecve(int, char* const[], char* const[]); +_Noreturn void _exit(int); + +pid_t getpid(void); +pid_t getppid(void); +pid_t getpgrp(void); +pid_t getpgid(pid_t); +int setpgid(pid_t, pid_t); +pid_t setsid(void); +pid_t getsid(pid_t); +char* ttyname(int); +int ttyname_r(int, char*, size_t); +int isatty(int); +pid_t tcgetpgrp(int); +int tcsetpgrp(int, pid_t); + +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); +int getgroups(int, gid_t[]); +int setuid(uid_t); +int setreuid(uid_t, uid_t); +int seteuid(uid_t); +int setgid(gid_t); +int setregid(gid_t, gid_t); +int setegid(gid_t); + +char* getlogin(void); +int getlogin_r(char*, size_t); +int gethostname(char*, size_t); +char* ctermid(char*); + +int getopt(int, char* const[], const char*); +extern char* optarg; +extern int optind, opterr, optopt; + +long pathconf(const char*, int); +long fpathconf(int, int); +long sysconf(int); +size_t confstr(int, char*, size_t); + +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int lockf(int, int, off_t); +long gethostid(void); +void sync(void); +int syncfs(int); +pid_t setpgrp(void); +void swab(const void* __restrict, void* __restrict, ssize_t); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) +int usleep(unsigned); +unsigned ualarm(unsigned, unsigned); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 +int vhangup(void); +int getpagesize(void); +int getdtablesize(void); +int sethostname(const char*, size_t); +int getdomainname(char*, size_t); +int setdomainname(const char*, size_t); +int setgroups(size_t, const gid_t*); +char* getpass(const char*); +int acct(const char*); +int execvpe(const char*, char* const[], char* const[]); +int issetugid(void); +#endif + +#ifdef _GNU_SOURCE +extern char** environ; +int setresuid(uid_t, uid_t, uid_t); +int setresgid(gid_t, gid_t, gid_t); +int getresuid(uid_t*, uid_t*, uid_t*); +int getresgid(gid_t*, gid_t*, gid_t*); +char* get_current_dir_name(void); +int euidaccess(const char*, int); +int eaccess(const char*, int); +#endif + +#define POSIX_CLOSE_RESTART 0 + +#define _XOPEN_VERSION 700 +#define _XOPEN_UNIX 1 +#define _XOPEN_ENH_I18N 1 + +#define _POSIX_VERSION 200809L +#define _POSIX2_VERSION _POSIX_VERSION + +#define _POSIX_ADVISORY_INFO _POSIX_VERSION +#define _POSIX_CHOWN_RESTRICTED 1 +#define _POSIX_IPV6 _POSIX_VERSION +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_MAPPED_FILES _POSIX_VERSION +#define _POSIX_MEMLOCK _POSIX_VERSION +#define _POSIX_MEMLOCK_RANGE _POSIX_VERSION +#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION +#define _POSIX_MESSAGE_PASSING _POSIX_VERSION +#define _POSIX_FSYNC _POSIX_VERSION +#define _POSIX_NO_TRUNC 1 +#define _POSIX_RAW_SOCKETS _POSIX_VERSION +#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION +#define _POSIX_REGEXP 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_SHELL 1 +#define _POSIX_SPAWN _POSIX_VERSION +#define _POSIX_VDISABLE 0 + +#define _POSIX_THREADS _POSIX_VERSION +#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION +#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION +#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION +#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION +/* #define _POSIX_THREAD_PRIORITY_SCHEDULING -1 */ +#define _POSIX_THREAD_CPUTIME _POSIX_VERSION +#define _POSIX_TIMERS _POSIX_VERSION +#define _POSIX_TIMEOUTS _POSIX_VERSION +#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION +#define _POSIX_CPUTIME _POSIX_VERSION +#define _POSIX_CLOCK_SELECTION _POSIX_VERSION +#define _POSIX_BARRIERS _POSIX_VERSION +#define _POSIX_SPIN_LOCKS _POSIX_VERSION +#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION +#define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION +#define _POSIX_SEMAPHORES _POSIX_VERSION +#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION + +#define _POSIX2_C_BIND _POSIX_VERSION + +#include <bits/posix.h> + +#define _PC_LINK_MAX 0 +#define _PC_MAX_CANON 1 +#define _PC_MAX_INPUT 2 +#define _PC_NAME_MAX 3 +#define _PC_PATH_MAX 4 +#define _PC_PIPE_BUF 5 +#define _PC_CHOWN_RESTRICTED 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 +#define _PC_SYNC_IO 9 +#define _PC_ASYNC_IO 10 +#define _PC_PRIO_IO 11 +#define _PC_SOCK_MAXBUF 12 +#define _PC_FILESIZEBITS 13 +#define _PC_REC_INCR_XFER_SIZE 14 +#define _PC_REC_MAX_XFER_SIZE 15 +#define _PC_REC_MIN_XFER_SIZE 16 +#define _PC_REC_XFER_ALIGN 17 +#define _PC_ALLOC_SIZE_MIN 18 +#define _PC_SYMLINK_MAX 19 +#define _PC_2_SYMLINKS 20 + +#define _SC_ARG_MAX 0 +#define _SC_CHILD_MAX 1 +#define _SC_CLK_TCK 2 +#define _SC_NGROUPS_MAX 3 +#define _SC_OPEN_MAX 4 +#define _SC_STREAM_MAX 5 +#define _SC_TZNAME_MAX 6 +#define _SC_JOB_CONTROL 7 +#define _SC_SAVED_IDS 8 +#define _SC_REALTIME_SIGNALS 9 +#define _SC_PRIORITY_SCHEDULING 10 +#define _SC_TIMERS 11 +#define _SC_ASYNCHRONOUS_IO 12 +#define _SC_PRIORITIZED_IO 13 +#define _SC_SYNCHRONIZED_IO 14 +#define _SC_FSYNC 15 +#define _SC_MAPPED_FILES 16 +#define _SC_MEMLOCK 17 +#define _SC_MEMLOCK_RANGE 18 +#define _SC_MEMORY_PROTECTION 19 +#define _SC_MESSAGE_PASSING 20 +#define _SC_SEMAPHORES 21 +#define _SC_SHARED_MEMORY_OBJECTS 22 +#define _SC_AIO_LISTIO_MAX 23 +#define _SC_AIO_MAX 24 +#define _SC_AIO_PRIO_DELTA_MAX 25 +#define _SC_DELAYTIMER_MAX 26 +#define _SC_MQ_OPEN_MAX 27 +#define _SC_MQ_PRIO_MAX 28 +#define _SC_VERSION 29 +#define _SC_PAGE_SIZE 30 +#define _SC_PAGESIZE 30 /* !! */ +#define _SC_RTSIG_MAX 31 +#define _SC_SEM_NSEMS_MAX 32 +#define _SC_SEM_VALUE_MAX 33 +#define _SC_SIGQUEUE_MAX 34 +#define _SC_TIMER_MAX 35 +#define _SC_BC_BASE_MAX 36 +#define _SC_BC_DIM_MAX 37 +#define _SC_BC_SCALE_MAX 38 +#define _SC_BC_STRING_MAX 39 +#define _SC_COLL_WEIGHTS_MAX 40 +#define _SC_EXPR_NEST_MAX 42 +#define _SC_LINE_MAX 43 +#define _SC_RE_DUP_MAX 44 +#define _SC_2_VERSION 46 +#define _SC_2_C_BIND 47 +#define _SC_2_C_DEV 48 +#define _SC_2_FORT_DEV 49 +#define _SC_2_FORT_RUN 50 +#define _SC_2_SW_DEV 51 +#define _SC_2_LOCALEDEF 52 +#define _SC_UIO_MAXIOV 60 /* !! */ +#define _SC_IOV_MAX 60 +#define _SC_THREADS 67 +#define _SC_THREAD_SAFE_FUNCTIONS 68 +#define _SC_GETGR_R_SIZE_MAX 69 +#define _SC_GETPW_R_SIZE_MAX 70 +#define _SC_LOGIN_NAME_MAX 71 +#define _SC_TTY_NAME_MAX 72 +#define _SC_THREAD_DESTRUCTOR_ITERATIONS 73 +#define _SC_THREAD_KEYS_MAX 74 +#define _SC_THREAD_STACK_MIN 75 +#define _SC_THREAD_THREADS_MAX 76 +#define _SC_THREAD_ATTR_STACKADDR 77 +#define _SC_THREAD_ATTR_STACKSIZE 78 +#define _SC_THREAD_PRIORITY_SCHEDULING 79 +#define _SC_THREAD_PRIO_INHERIT 80 +#define _SC_THREAD_PRIO_PROTECT 81 +#define _SC_THREAD_PROCESS_SHARED 82 +#define _SC_NPROCESSORS_CONF 83 +#define _SC_NPROCESSORS_ONLN 84 +#define _SC_PHYS_PAGES 85 +#define _SC_AVPHYS_PAGES 86 +#define _SC_ATEXIT_MAX 87 +#define _SC_PASS_MAX 88 +#define _SC_XOPEN_VERSION 89 +#define _SC_XOPEN_XCU_VERSION 90 +#define _SC_XOPEN_UNIX 91 +#define _SC_XOPEN_CRYPT 92 +#define _SC_XOPEN_ENH_I18N 93 +#define _SC_XOPEN_SHM 94 +#define _SC_2_CHAR_TERM 95 +#define _SC_2_UPE 97 +#define _SC_XOPEN_XPG2 98 +#define _SC_XOPEN_XPG3 99 +#define _SC_XOPEN_XPG4 100 +#define _SC_NZERO 109 +#define _SC_XBS5_ILP32_OFF32 125 +#define _SC_XBS5_ILP32_OFFBIG 126 +#define _SC_XBS5_LP64_OFF64 127 +#define _SC_XBS5_LPBIG_OFFBIG 128 +#define _SC_XOPEN_LEGACY 129 +#define _SC_XOPEN_REALTIME 130 +#define _SC_XOPEN_REALTIME_THREADS 131 +#define _SC_ADVISORY_INFO 132 +#define _SC_BARRIERS 133 +#define _SC_CLOCK_SELECTION 137 +#define _SC_CPUTIME 138 +#define _SC_THREAD_CPUTIME 139 +#define _SC_MONOTONIC_CLOCK 149 +#define _SC_READER_WRITER_LOCKS 153 +#define _SC_SPIN_LOCKS 154 +#define _SC_REGEXP 155 +#define _SC_SHELL 157 +#define _SC_SPAWN 159 +#define _SC_SPORADIC_SERVER 160 +#define _SC_THREAD_SPORADIC_SERVER 161 +#define _SC_TIMEOUTS 164 +#define _SC_TYPED_MEMORY_OBJECTS 165 +#define _SC_2_PBS 168 +#define _SC_2_PBS_ACCOUNTING 169 +#define _SC_2_PBS_LOCATE 170 +#define _SC_2_PBS_MESSAGE 171 +#define _SC_2_PBS_TRACK 172 +#define _SC_SYMLOOP_MAX 173 +#define _SC_STREAMS 174 +#define _SC_2_PBS_CHECKPOINT 175 +#define _SC_V6_ILP32_OFF32 176 +#define _SC_V6_ILP32_OFFBIG 177 +#define _SC_V6_LP64_OFF64 178 +#define _SC_V6_LPBIG_OFFBIG 179 +#define _SC_HOST_NAME_MAX 180 +#define _SC_TRACE 181 +#define _SC_TRACE_EVENT_FILTER 182 +#define _SC_TRACE_INHERIT 183 +#define _SC_TRACE_LOG 184 + +#define _SC_IPV6 235 +#define _SC_RAW_SOCKETS 236 +#define _SC_V7_ILP32_OFF32 237 +#define _SC_V7_ILP32_OFFBIG 238 +#define _SC_V7_LP64_OFF64 239 +#define _SC_V7_LPBIG_OFFBIG 240 +#define _SC_SS_REPL_MAX 241 +#define _SC_TRACE_EVENT_NAME_MAX 242 +#define _SC_TRACE_NAME_MAX 243 +#define _SC_TRACE_SYS_MAX 244 +#define _SC_TRACE_USER_EVENT_MAX 245 +#define _SC_XOPEN_STREAMS 246 +#define _SC_THREAD_ROBUST_PRIO_INHERIT 247 +#define _SC_THREAD_ROBUST_PRIO_PROTECT 248 + +#define _CS_PATH 0 +#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1 +#define _CS_GNU_LIBC_VERSION 2 +#define _CS_GNU_LIBPTHREAD_VERSION 3 +#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS 4 +#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 5 + +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 1116 +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 1117 +#define _CS_POSIX_V6_ILP32_OFF32_LIBS 1118 +#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS 1119 +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 1120 +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 1121 +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 1122 +#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS 1123 +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 1124 +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 1125 +#define _CS_POSIX_V6_LP64_OFF64_LIBS 1126 +#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS 1127 +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 1128 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 1129 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 1130 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS 1131 +#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1132 +#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 1133 +#define _CS_POSIX_V7_ILP32_OFF32_LIBS 1134 +#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS 1135 +#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 1136 +#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 1137 +#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 1138 +#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS 1139 +#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 1140 +#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 1141 +#define _CS_POSIX_V7_LP64_OFF64_LIBS 1142 +#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS 1143 +#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 1144 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 1145 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 1146 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UNISTD_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/utime.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/utime.h new file mode 100644 index 0000000..b4368aa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/utime.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_UTIME_H_ +#define SYSROOT_UTIME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_time_t + +#include <bits/alltypes.h> + +struct utimbuf { + time_t actime; + time_t modtime; +}; + +int utime(const char*, const struct utimbuf*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UTIME_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/values.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/values.h new file mode 100644 index 0000000..0862584 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/values.h
@@ -0,0 +1,39 @@ +#ifndef SYSROOT_VALUES_H_ +#define SYSROOT_VALUES_H_ + +#include <limits.h> + +#define CHARBITS (sizeof(char) * 8) +#define SHORTBITS (sizeof(short) * 8) +#define INTBITS (sizeof(int) * 8) +#define LONGBITS (sizeof(long) * 8) +#define PTRBITS (sizeof(char*) * 8) +#define DOUBLEBITS (sizeof(double) * 8) +#define FLOATBITS (sizeof(float) * 8) + +#define MINSHORT SHRT_MIN +#define MININT INT_MIN +#define MINLONG LONG_MIN + +#define MAXSHORT SHRT_MAX +#define MAXINT INT_MAX +#define MAXLONG LONG_MAX + +#define HIBITS MINSHORT +#define HIBITL MINLONG + +#include <float.h> + +#define MAXDOUBLE DBL_MAX +#undef MAXFLOAT +#define MAXFLOAT FLT_MAX +#define MINDOUBLE DBL_MIN +#define MINFLOAT FLT_MIN +#define DMINEXP DBL_MIN_EXP +#define FMINEXP FLT_MIN_EXP +#define DMAXEXP DBL_MAX_EXP +#define FMAXEXP FLT_MAX_EXP + +#define BITSPERBYTE CHAR_BIT + +#endif // SYSROOT_VALUES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wait.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wait.h new file mode 100644 index 0000000..98396e2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wait.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <wait.h> to <sys/wait.h> +#include <sys/wait.h>
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wchar.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wchar.h new file mode 100644 index 0000000..aaa7e9e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wchar.h
@@ -0,0 +1,185 @@ +#ifndef SYSROOT_WCHAR_H_ +#define SYSROOT_WCHAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_FILE +#define __NEED___isoc_va_list +#define __NEED_size_t +#define __NEED_wchar_t +#define __NEED_wint_t +#define __NEED_mbstate_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_va_list +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_wctype_t +#endif + +#include <bits/alltypes.h> + +#ifndef WCHAR_MAX +#define WCHAR_MAX __WCHAR_MAX__ +#endif + +#ifndef WCHAR_MIN +#if defined(__WCHAR_MIN__) +#define WCHAR_MIN __WCHAR_MIN__ +#else // defined(__WCHAR_MIN__) +#if defined(__WCHAR_UNSIGNED__) +#define WCHAR_MIN (L'\0' + 0) +#else +#define WCHAR_MIN (-WCHAR_MAX - 1) +#endif // defined (__WCHAR_UNSIGNED) +#endif // defined(__WCHAR_MIN__) +#endif + +#undef WEOF +#define WEOF 0xffffffffU + +wchar_t* wcscpy(wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcsncpy(wchar_t* __restrict, const wchar_t* __restrict, size_t); + +wchar_t* wcscat(wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcsncat(wchar_t* __restrict, const wchar_t* __restrict, size_t); + +int wcscmp(const wchar_t*, const wchar_t*); +int wcsncmp(const wchar_t*, const wchar_t*, size_t); + +int wcscoll(const wchar_t*, const wchar_t*); +size_t wcsxfrm(wchar_t* __restrict, const wchar_t* __restrict, size_t n); + +wchar_t* wcschr(const wchar_t*, wchar_t); +wchar_t* wcsrchr(const wchar_t*, wchar_t); + +size_t wcscspn(const wchar_t*, const wchar_t*); +size_t wcsspn(const wchar_t*, const wchar_t*); +wchar_t* wcspbrk(const wchar_t*, const wchar_t*); + +wchar_t* wcstok(wchar_t* __restrict, const wchar_t* __restrict, wchar_t** __restrict); + +size_t wcslen(const wchar_t*); + +wchar_t* wcsstr(const wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcswcs(const wchar_t*, const wchar_t*); + +wchar_t* wmemchr(const wchar_t*, wchar_t, size_t); +int wmemcmp(const wchar_t*, const wchar_t*, size_t); +wchar_t* wmemcpy(wchar_t* __restrict, const wchar_t* __restrict, size_t); +wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t); +wchar_t* wmemset(wchar_t*, wchar_t, size_t); + +wint_t btowc(int); +int wctob(wint_t); + +int mbsinit(const mbstate_t*); +size_t mbrtowc(wchar_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict); +size_t wcrtomb(char* __restrict, wchar_t, mbstate_t* __restrict); + +size_t mbrlen(const char* __restrict, size_t, mbstate_t* __restrict); + +size_t mbsrtowcs(wchar_t* __restrict, const char** __restrict, size_t, mbstate_t* __restrict); +size_t wcsrtombs(char* __restrict, const wchar_t** __restrict, size_t, mbstate_t* __restrict); + +float wcstof(const wchar_t* __restrict, wchar_t** __restrict); +double wcstod(const wchar_t* __restrict, wchar_t** __restrict); +long double wcstold(const wchar_t* __restrict, wchar_t** __restrict); + +long wcstol(const wchar_t* __restrict, wchar_t** __restrict, int); +unsigned long wcstoul(const wchar_t* __restrict, wchar_t** __restrict, int); + +long long wcstoll(const wchar_t* __restrict, wchar_t** __restrict, int); +unsigned long long wcstoull(const wchar_t* __restrict, wchar_t** __restrict, int); + +int fwide(FILE*, int); + +int wprintf(const wchar_t* __restrict, ...); +int fwprintf(FILE* __restrict, const wchar_t* __restrict, ...); +int swprintf(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...); + +int vwprintf(const wchar_t* __restrict, __isoc_va_list); +int vfwprintf(FILE* __restrict, const wchar_t* __restrict, __isoc_va_list); +int vswprintf(wchar_t* __restrict, size_t, const wchar_t* __restrict, __isoc_va_list); + +int wscanf(const wchar_t* __restrict, ...); +int fwscanf(FILE* __restrict, const wchar_t* __restrict, ...); +int swscanf(const wchar_t* __restrict, const wchar_t* __restrict, ...); + +int vwscanf(const wchar_t* __restrict, __isoc_va_list); +int vfwscanf(FILE* __restrict, const wchar_t* __restrict, __isoc_va_list); +int vswscanf(const wchar_t* __restrict, const wchar_t* __restrict, __isoc_va_list); + +wint_t fgetwc(FILE*); +wint_t getwc(FILE*); +wint_t getwchar(void); + +wint_t fputwc(wchar_t, FILE*); +wint_t putwc(wchar_t, FILE*); +wint_t putwchar(wchar_t); + +wchar_t* fgetws(wchar_t* __restrict, int, FILE* __restrict); +int fputws(const wchar_t* __restrict, FILE* __restrict); + +wint_t ungetwc(wint_t, FILE*); + +struct tm; +size_t wcsftime(wchar_t* __restrict, size_t, const wchar_t* __restrict, + const struct tm* __restrict); + +#undef iswdigit + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +FILE* open_wmemstream(wchar_t**, size_t*); +size_t mbsnrtowcs(wchar_t* __restrict, const char** __restrict, size_t, size_t, + mbstate_t* __restrict); +size_t wcsnrtombs(char* __restrict, const wchar_t** __restrict, size_t, size_t, + mbstate_t* __restrict); +wchar_t* wcsdup(const wchar_t*); +size_t wcsnlen(const wchar_t*, size_t); +wchar_t* wcpcpy(wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcpncpy(wchar_t* __restrict, const wchar_t* __restrict, size_t); +int wcscasecmp(const wchar_t*, const wchar_t*); +int wcsncasecmp(const wchar_t*, const wchar_t*, size_t); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int wcwidth(wchar_t); +int wcswidth(const wchar_t*, size_t); +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctype_t wctype(const char*); + +#ifndef __cplusplus +#undef iswdigit +#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a) - '0') < 10) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_WCHAR_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wctype.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wctype.h new file mode 100644 index 0000000..5a04bb8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wctype.h
@@ -0,0 +1,60 @@ +#ifndef SYSROOT_WCTYPE_H_ +#define SYSROOT_WCTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_wint_t +#define __NEED_wctype_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_locale_t +#endif + +#include <bits/alltypes.h> + +typedef const int* wctrans_t; + +#undef WEOF +#define WEOF 0xffffffffU + +#undef iswdigit + +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t towctrans(wint_t, wctrans_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctrans_t wctrans(const char*); +wctype_t wctype(const char*); + +#ifndef __cplusplus +#undef iswdigit +#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a) - '0') < 10) +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_WCTYPE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wordexp.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wordexp.h new file mode 100644 index 0000000..dd6caa0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/wordexp.h
@@ -0,0 +1,41 @@ +#ifndef SYSROOT_WORDEXP_H_ +#define SYSROOT_WORDEXP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +#define WRDE_DOOFFS 1 +#define WRDE_APPEND 2 +#define WRDE_NOCMD 4 +#define WRDE_REUSE 8 +#define WRDE_SHOWERR 16 +#define WRDE_UNDEF 32 + +typedef struct { + size_t we_wordc; + char** we_wordv; + size_t we_offs; +} wordexp_t; + +#define WRDE_NOSYS -1 +#define WRDE_NOSPACE 1 +#define WRDE_BADCHAR 2 +#define WRDE_BADVAL 3 +#define WRDE_CMDSUB 4 +#define WRDE_SYNTAX 5 + +int wordexp(const char* __restrict, wordexp_t* __restrict, int); +void wordfree(wordexp_t*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_WORDEXP_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/assert.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/assert.h new file mode 100644 index 0000000..d53115d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/assert.h
@@ -0,0 +1,101 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_ASSERT_ +#define SYSROOT_ZIRCON_ASSERT_ + +// For a description of which asserts are enabled at which debug levels, see the documentation for +// GN build argument |assert_level|. + +#ifdef _KERNEL +#include <assert.h> +#define ZX_PANIC(args...) PANIC(args) +#define ZX_ASSERT(args...) ASSERT(args) +#define ZX_ASSERT_MSG(args...) ASSERT_MSG(args) +#define ZX_DEBUG_ASSERT(args...) DEBUG_ASSERT(args) +#define ZX_DEBUG_ASSERT_MSG(args...) DEBUG_ASSERT_MSG(args) +#define ZX_DEBUG_ASSERT_COND(args...) DEBUG_ASSERT_COND(args) +#define ZX_DEBUG_ASSERT_MSG_COND(args...) DEBUG_ASSERT_MSG_COND(args) +#define ZX_DEBUG_ASSERT_IMPLEMENTED DEBUG_ASSERT_IMPLEMENTED + +#else // #ifdef _KERNEL + +#include <zircon/compiler.h> + +__BEGIN_CDECLS +void __zx_panic(const char* format, ...) __NO_RETURN __PRINTFLIKE(1, 2); +__END_CDECLS + +#define ZX_PANIC(fmt, ...) __zx_panic((fmt), ##__VA_ARGS__) + +// Assert that |x| is true, else panic. +// +// ZX_ASSERT is always enabled and |x| will be evaluated regardless of any build arguments. +#define ZX_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + ZX_PANIC("ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); \ + } \ + } while (0) + +// Assert that |x| is true, else panic with the given message. +// +// ZX_ASSERT_MSG is always enabled and |x| will be evaluated regardless of any build arguments. +#define ZX_ASSERT_MSG(x, msg, msgargs...) \ + do { \ + if (unlikely(!(x))) { \ + ZX_PANIC("ASSERT FAILED at (%s:%d): %s\n" msg "\n", __FILE__, __LINE__, #x, ##msgargs); \ + } \ + } while (0) + +// Conditionally implement ZX_DEBUG_ASSERT based on ZX_ASSERT_LEVEL. +#ifdef ZX_ASSERT_LEVEL + +// ZX_DEBUG_ASSERT_IMPLEMENTED is intended to be used to conditionalize code that is logically part +// of a debug assert. It's useful for performing complex consistency checks that are difficult to +// work into a ZX_DEBUG_ASSERT statement. +#define ZX_DEBUG_ASSERT_IMPLEMENTED (ZX_ASSERT_LEVEL > 1) +#else +#define ZX_DEBUG_ASSERT_IMPLEMENTED 0 +#endif + +// Assert that |x| is true, else panic. +// +// Depending on build arguments, ZX_DEBUG_ASSERT may or may not be enabled. When disabled, |x| will +// not be evaluated. +#define ZX_DEBUG_ASSERT(x) \ + do { \ + if (ZX_DEBUG_ASSERT_IMPLEMENTED && unlikely(!(x))) { \ + ZX_PANIC("DEBUG ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); \ + } \ + } while (0) + +// Assert that |x| is true, else panic with the given message. +// +// Depending on build arguments, ZX_DEBUG_ASSERT_MSG may or may not be enabled. When disabled, |x| +// will not be evaluated. +#define ZX_DEBUG_ASSERT_MSG(x, msg, msgargs...) \ + do { \ + if (ZX_DEBUG_ASSERT_IMPLEMENTED && unlikely(!(x))) { \ + ZX_PANIC("DEBUG ASSERT FAILED at (%s:%d): %s\n" msg "\n", __FILE__, __LINE__, #x, \ + ##msgargs); \ + } \ + } while (0) + +// implement _COND versions of ZX_DEBUG_ASSERT which only emit the body if +// ZX_DEBUG_ASSERT_IMPLEMENTED is set +#if ZX_DEBUG_ASSERT_IMPLEMENTED +#define ZX_DEBUG_ASSERT_COND(x) ZX_DEBUG_ASSERT(x) +#define ZX_DEBUG_ASSERT_MSG_COND(x, msg, msgargs...) ZX_DEBUG_ASSERT_MSG(x, msg, msgargs) +#else +#define ZX_DEBUG_ASSERT_COND(x) \ + do { \ + } while (0) +#define ZX_DEBUG_ASSERT_MSG_COND(x, msg, msgargs...) \ + do { \ + } while (0) +#endif +#endif // #ifdef _KERNEL + +#endif // SYSROOT_ZIRCON_ASSERT_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/driver-config.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/driver-config.h new file mode 100644 index 0000000..8565ba6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/driver-config.h
@@ -0,0 +1,170 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_DRIVER_CONFIG_H_ +#define SYSROOT_ZIRCON_BOOT_DRIVER_CONFIG_H_ + +#include <stdint.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +// ZBI_TYPE_KERNEL_DRIVER item types (for zbi_header_t.extra) +#define KDRV_ARM_PSCI 0x49435350 // 'PSCI' +#define KDRV_ARM_GIC_V2 0x32434947 // 'GIC2' +#define KDRV_ARM_GIC_V3 0x33434947 // 'GIC3' +#define KDRV_ARM_GENERIC_TIMER 0x4D495441 // 'ATIM' +#define KDRV_PL011_UART 0x55304C50 // 'PL0U' +#define KDRV_AMLOGIC_UART 0x554C4D41 // 'AMLU' +#define KDRV_NXP_IMX_UART 0x55584D49 // 'IMXU' +#define KDRV_MT8167_UART 0x5538544D // 'MT8U' +#define KDRV_HISILICON_POWER 0x4F505348 // 'HSPO' +#define KDRV_AMLOGIC_HDCP 0x484C4D41 // 'AMLH' +#define KDRV_MSM_UART 0x554D534D // 'MSMU' +#define KDRV_MSM_POWER 1347244877 // 'MSMP' +#define KDRV_DW8250_UART 0x44573855 // 'DW8U' +#define KDRV_AS370_POWER 0x50303733 // '370P' +#define KDRV_AMLOGIC_RNG 0x484C4D52 // 'AMLR' +#define KDRV_GENERIC_32BIT_WATCHDOG 0x32334457 // 'WD32' +#define KDRV_I8250_PIO_UART 0x30353238 // '8250' +#define KDRV_I8250_MMIO_UART 0x4d353238 // '825M' + +// Kernel driver struct that can be used for simple drivers. +// Used by KDRV_PL011_UART, KDRV_AMLOGIC_UART, KDRV_NXP_IMX_UART, +// and KDRV_I8250_MMIO_UART. +typedef struct { + uint64_t mmio_phys; + uint32_t irq; +} dcfg_simple_t; + +// Used by KDRV_I8250_PIO_UART. +typedef struct { + uint16_t base; + uint32_t irq; +} dcfg_simple_pio_t; + +// for KDRV_MT8167_UART +typedef struct { + uint64_t soc_mmio_phys; + uint64_t uart_mmio_phys; + uint32_t irq; +} dcfg_soc_uart_t; + +// for KDRV_ARM_PSCI +typedef struct { + bool use_hvc; + uint64_t shutdown_args[3]; + uint64_t reboot_args[3]; + uint64_t reboot_bootloader_args[3]; + uint64_t reboot_recovery_args[3]; +} dcfg_arm_psci_driver_t; + +typedef struct { + uint64_t soc_imem_phys; + uint64_t soc_imem_offset; +} dcfg_msm_power_driver_t; + +// for KDRV_ARM_GIC_V2 +typedef struct { + uint64_t mmio_phys; + uint64_t msi_frame_phys; + uint64_t gicd_offset; + uint64_t gicc_offset; + uint64_t gich_offset; + uint64_t gicv_offset; + uint32_t ipi_base; + bool optional; + bool use_msi; +} dcfg_arm_gicv2_driver_t; + +// for KDRV_ARM_GIC_V3 +typedef struct { + uint64_t mmio_phys; + uint64_t gicd_offset; + uint64_t gicr_offset; + uint64_t gicr_stride; + uint64_t mx8_gpr_phys; + uint32_t ipi_base; + bool optional; +} dcfg_arm_gicv3_driver_t; + +// for KDRV_ARM_GENERIC_TIMER +typedef struct { + uint32_t irq_phys; + uint32_t irq_virt; + uint32_t irq_sphys; + uint32_t freq_override; +} dcfg_arm_generic_timer_driver_t; + +// for KDRV_HISILICON_POWER +typedef struct { + uint64_t sctrl_phys; + uint64_t pmu_phys; +} dcfg_hisilicon_power_driver_t; + +// for KDRV_AMLOGIC_HDCP +typedef struct { + uint64_t preset_phys; + uint64_t hiu_phys; + uint64_t hdmitx_phys; +} dcfg_amlogic_hdcp_driver_t; + +// for KDRV_AMLOGIC_RNG +typedef struct { + uint64_t rng_data_phys; + uint64_t rng_status_phys; + uint64_t rng_refresh_interval_usec; +} dcfg_amlogic_rng_driver_t; + +// Defines a register write action for a generic kernel watchdog driver. An +// action consists of the following steps. +// +// 1) Read from the register located a physical address |addr| +// 2) Clear all of the bits in the value which was read using the |clr_mask| +// 3) Set all of the bits in the value using the |set_mask| +// 4) Write this value back to the address located at addr. +// +typedef struct { + uint64_t addr; + uint32_t clr_mask; + uint32_t set_mask; +} dcfg_generic_32bit_watchdog_action_t; + +#define KDRV_GENERIC_32BIT_WATCHDOG_FLAG_ENABLED ((uint32_t)0x00000001) +#define KDRV_GENERIC_32BIT_WATCHDOG_MIN_PERIOD ZX_MSEC(1) + +// Definitions of actions which may be taken by a generic 32 bit watchdog timer +// kernel driver which may be passed by a bootloader. Field definitions are as +// follows. +// +// |pet_action| +// The address and masks needed to "pet" (aka, dismiss) a hardware watchdog timer. +// +// |enable_action| +// The address and masks needed to enable a hardware watchdog timer. If enable +// is an unsupported operation, the addr of the |enable_action| shall be zero. +// +// |disable_action| +// The address and masks needed to disable a hardware watchdog timer. If +// disable is an unsupported operation, the addr of the |disable_action| shall +// be zero. +// +// |watchdog_period_nsec| +// The period of the watchdog timer given in nanoseconds. When enabled, the +// watchdog timer driver must pet the watch dog at least this often. The value +// must be at least 1 mSec, typically much larger (on the order of a second or +// two) +// +// |flags| +// Storage for additional flags. Currently, only one flag is defined, +// "FLAG_ENABLED". When this flag is set, it indicates that the watchdog timer +// was left enabled by the bootloader at startup. +typedef struct { + dcfg_generic_32bit_watchdog_action_t pet_action; + dcfg_generic_32bit_watchdog_action_t enable_action; + dcfg_generic_32bit_watchdog_action_t disable_action; + zx_duration_t watchdog_period_nsec; + uint32_t flags; +} dcfg_generic_32bit_watchdog_t; + +#endif // SYSROOT_ZIRCON_BOOT_DRIVER_CONFIG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/e820.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/e820.h new file mode 100644 index 0000000..f0f98f0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/e820.h
@@ -0,0 +1,23 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_E820_H_ +#define SYSROOT_ZIRCON_BOOT_E820_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 +#define E820_NVS 4 +#define E820_UNUSABLE 5 + +typedef struct e820entry { + uint64_t addr; + uint64_t size; + uint32_t type; +} __PACKED e820entry_t; + +#endif // SYSROOT_ZIRCON_BOOT_E820_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/image.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/image.h new file mode 100644 index 0000000..1e23a25 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/image.h
@@ -0,0 +1,636 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_IMAGE_H_ +#define SYSROOT_ZIRCON_BOOT_IMAGE_H_ + +// This file contains assembly code that cannot be clang formatted. +// clang-format off + +#ifndef __ASSEMBLER__ +#include <stdint.h> +#endif + +// Zircon Boot Image format (ZBI). +// +// A Zircon Boot Image consists of a container header followed by boot +// items. Each boot item has a header (zbi_header_t) and then a payload of +// zbi_header_t.length bytes, which can be any size. The zbi_header_t.type +// field indicates how to interpret the payload. Many types specify an +// additional type-specific header that begins a variable-sized payload. +// zbi_header_t.length does not include the zbi_header_t itself, but does +// include any type-specific headers as part of the payload. All fields in +// all header formats are little-endian. +// +// Padding bytes appear after each item as needed to align the payload size +// up to a ZBI_ALIGNMENT (8-byte) boundary. This padding is not reflected +// in the zbi_header_t.length value. +// +// A "complete" ZBI can be booted by a Zircon-compatible boot loader. +// It contains one ZBI_TYPE_KERNEL_{ARCH} boot item that must come first, +// followed by any number of additional boot items, which must include +// exactly one ZBI_TYPE_STORAGE_BOOTFS item. +// +// A partial ZBI cannot be booted, and is only used during the build process. +// It contains one or more boot items and can be combined with other ZBIs to +// make a complete ZBI. + +// All items begin at an 8-byte aligned offset into the image. +#ifdef __ASSEMBLER__ +#define ZBI_ALIGNMENT (8) +#else +#define ZBI_ALIGNMENT (8u) +#endif + +// Round n up to the next 8 byte boundary +#ifndef __ASSEMBLER__ +#ifdef __cplusplus +constexpr +#endif +static inline uint32_t ZBI_ALIGN(uint32_t n) { + return ((n + ZBI_ALIGNMENT - 1) & -ZBI_ALIGNMENT); +} +#endif + +// LSW of sha256("bootdata") +#define ZBI_CONTAINER_MAGIC (0x868cf7e6) + +// LSW of sha256("bootitem") +#define ZBI_ITEM_MAGIC (0xb5781729) + +// This flag is always required. +#define ZBI_FLAG_VERSION (0x00010000) + +// ZBI items with the CRC32 flag must have a valid crc32. +// Otherwise their crc32 field must contain ZBI_ITEM_NO_CRC32 +#define ZBI_FLAG_CRC32 (0x00020000) + +// Value for zbi_header_t.crc32 when ZBI_FLAG_CRC32 is not set. +#define ZBI_ITEM_NO_CRC32 (0x4a87e8d6) + +#ifndef __ASSEMBLER__ +// Each header must be 8-byte aligned. The length field specifies the +// actual payload length and does not include the size of padding. +typedef struct { + // ZBI_TYPE_* constant, see below. + uint32_t type; + + // Size of the payload immediately following this header. This + // does not include the header itself nor any alignment padding + // after the payload. + uint32_t length; + + // Type-specific extra data. Each type specifies the use of this + // field; see below. When not explicitly specified, it should be zero. + uint32_t extra; + + // Flags for this item. This must always include ZBI_FLAG_VERSION. + // It should contain ZBI_FLAG_CRC32 for any item where it's feasible + // to compute the CRC32 at build time. Other flags are specific to + // each type; see below. + uint32_t flags; + + // For future expansion. Set to 0. + uint32_t reserved0; + uint32_t reserved1; + + // Must be ZBI_ITEM_MAGIC. + uint32_t magic; + + // Must be the CRC32 of payload if ZBI_FLAG_CRC32 is set, + // otherwise must be ZBI_ITEM_NO_CRC32. + uint32_t crc32; +} zbi_header_t; +#endif + +// Be sure to add new types to ZBI_ALL_TYPES. +#define ZBI_ALL_TYPES(macro) \ + macro(ZBI_TYPE_CONTAINER, "CONTAINER", ".bin") \ + macro(ZBI_TYPE_KERNEL_X64, "KERNEL_X64", ".bin") \ + macro(ZBI_TYPE_KERNEL_ARM64, "KERNEL_ARM64", ".bin") \ + macro(ZBI_TYPE_DISCARD, "DISCARD", ".bin") \ + macro(ZBI_TYPE_STORAGE_RAMDISK, "RAMDISK", ".bin") \ + macro(ZBI_TYPE_STORAGE_BOOTFS, "BOOTFS", ".bin") \ + macro(ZBI_TYPE_STORAGE_BOOTFS_FACTORY, "BOOTFS_FACTORY", ".bin") \ + macro(ZBI_TYPE_CMDLINE, "CMDLINE", ".txt") \ + macro(ZBI_TYPE_CRASHLOG, "CRASHLOG", ".bin") \ + macro(ZBI_TYPE_NVRAM, "NVRAM", ".bin") \ + macro(ZBI_TYPE_PLATFORM_ID, "PLATFORM_ID", ".bin") \ + macro(ZBI_TYPE_CPU_CONFIG, "CPU_CONFIG", ".bin") /* Deprecated */ \ + macro(ZBI_TYPE_CPU_TOPOLOGY, "CPU_TOPOLOGY", ".bin") \ + macro(ZBI_TYPE_MEM_CONFIG, "MEM_CONFIG", ".bin") \ + macro(ZBI_TYPE_KERNEL_DRIVER, "KERNEL_DRIVER", ".bin") \ + macro(ZBI_TYPE_ACPI_RSDP, "ACPI_RSDP", ".bin") \ + macro(ZBI_TYPE_SMBIOS, "SMBIOS", ".bin") \ + macro(ZBI_TYPE_EFI_MEMORY_MAP, "EFI_MEMORY_MAP", ".bin") \ + macro(ZBI_TYPE_EFI_SYSTEM_TABLE, "EFI_SYSTEM_TABLE", ".bin") \ + macro(ZBI_TYPE_E820_TABLE, "E820_TABLE", ".bin") \ + macro(ZBI_TYPE_FRAMEBUFFER, "FRAMEBUFFER", ".bin") \ + macro(ZBI_TYPE_DRV_MAC_ADDRESS, "DRV_MAC_ADDRESS", ".bin") \ + macro(ZBI_TYPE_DRV_PARTITION_MAP, "DRV_PARTITION_MAP", ".bin") \ + macro(ZBI_TYPE_DRV_BOARD_PRIVATE, "DRV_BOARD_PRIVATE", ".bin") \ + macro(ZBI_TYPE_DRV_BOARD_INFO, "DRV_BOARD_INFO", ".bin") \ + macro(ZBI_TYPE_IMAGE_ARGS, "IMAGE_ARGS", ".txt") \ + macro(ZBI_TYPE_BOOT_VERSION, "BOOT_VERSION", ".bin") \ + macro(ZBI_TYPE_HW_REBOOT_REASON, "HW_REBOOT_REASON", ".bin") + +// Each ZBI starts with a container header. +// length: Total size of the image after this header. +// This includes all item headers, payloads, and padding. +// It does not include the container header itself. +// Must be a multiple of ZBI_ALIGNMENT. +// extra: Must be ZBI_CONTAINER_MAGIC. +// flags: Must be ZBI_FLAG_VERSION and no other flags. +#define ZBI_TYPE_CONTAINER (0x544f4f42) // BOOT + +// Define a container header in assembly code. The symbol name is defined +// as a local label; use .global symbol to make it global. The length +// argument can use assembly label arithmetic like any immediate operand. +#ifdef __ASSEMBLER__ +#define ZBI_CONTAINER_HEADER(symbol, length) \ + .balign ZBI_ALIGNMENT; \ + symbol: \ + .int ZBI_TYPE_CONTAINER; \ + .int (length); \ + .int ZBI_CONTAINER_MAGIC; \ + .int ZBI_FLAG_VERSION; \ + .int 0; \ + .int 0; \ + .int ZBI_ITEM_MAGIC; \ + .int ZBI_ITEM_NO_CRC32; \ + .size symbol, . - symbol; \ + .type symbol, %object +#else +#define ZBI_CONTAINER_HEADER(length) { \ + ZBI_TYPE_CONTAINER, \ + (length), \ + ZBI_CONTAINER_MAGIC, \ + ZBI_FLAG_VERSION, \ + 0, \ + 0, \ + ZBI_ITEM_MAGIC, \ + ZBI_ITEM_NO_CRC32, \ +} +#endif + + +// The kernel image. In a complete ZBI this item must always be first, +// immediately after the ZBI_TYPE_CONTAINER header. The contiguous memory +// image of the kernel is formed from the ZBI_TYPE_CONTAINER header, the +// ZBI_TYPE_KERNEL_{ARCH} header, and the payload. +// +// The boot loader loads the whole image starting with the container header +// through to the end of the kernel item's payload into contiguous physical +// memory. It then constructs a partial ZBI elsewhere in memory, which has +// a ZBI_TYPE_CONTAINER header of its own followed by all the other items +// that were in the booted ZBI plus other items synthesized by the boot +// loader to describe the machine. This partial ZBI must be placed at an +// address (where the container header is found) that is aligned to the +// machine's page size. The precise protocol for transferring control to +// the kernel's entry point varies by machine. +// +// On all machines, the kernel requires some amount of scratch memory to be +// available immediately after the kernel image at boot. It needs this +// space for early setup work before it has a chance to read any memory-map +// information from the boot loader. The `reserve_memory_size` field tells +// the boot loader how much space after the kernel's load image it must +// leave available for the kernel's use. The boot loader must place its +// constructed ZBI or other reserved areas at least this many bytes after +// the kernel image. +// +// x86-64 +// +// The kernel assumes it was loaded at a fixed physical address of +// 0x100000 (1MB). zbi_kernel_t.entry is the absolute physical address +// of the PC location where the kernel will start. +// TODO(SEC-31): Perhaps this will change?? +// The processor is in 64-bit mode with direct virtual to physical +// mapping covering the physical memory where the kernel and +// bootloader-constructed ZBI were loaded. +// The %rsi register holds the physical address of the +// bootloader-constructed ZBI. +// All other registers are unspecified. +// +// ARM64 +// +// zbi_kernel_t.entry is an offset from the beginning of the image +// (i.e., the ZBI_TYPE_CONTAINER header before the ZBI_TYPE_KERNEL_ARM64 +// header) to the PC location in the image where the kernel will +// start. The processor is in physical address mode at EL1 or +// above. The kernel image and the bootloader-constructed ZBI each +// can be loaded anywhere in physical memory. The x0 register +// holds the physical address of the bootloader-constructed ZBI. +// All other registers are unspecified. +// +#define ZBI_TYPE_KERNEL_PREFIX (0x004e524b) // KRN\0 +#define ZBI_TYPE_KERNEL_MASK (0x00FFFFFF) +#define ZBI_TYPE_KERNEL_X64 (0x4c4e524b) // KRNL +#define ZBI_TYPE_KERNEL_ARM64 (0x384e524b) // KRN8 +#define ZBI_IS_KERNEL_BOOTITEM(x) (((x) & ZBI_TYPE_KERNEL_MASK) == \ + ZBI_TYPE_KERNEL_PREFIX) + +#ifndef __ASSEMBLER__ +typedef struct { + // Entry-point address. The interpretation of this differs by machine. + uint64_t entry; + // Minimum amount (in bytes) of scratch memory that the kernel requires + // immediately after its load image. + uint64_t reserve_memory_size; +} zbi_kernel_t; + +// The whole contiguous image loaded into memory by the boot loader. +typedef struct { + zbi_header_t hdr_file; + zbi_header_t hdr_kernel; + zbi_kernel_t data_kernel; + uint8_t contents[/*hdr_kernel.length - sizeof(zbi_kernel_t)*/]; + // data_kernel.reserve_memory_size bytes in memory are free after contents. +} zircon_kernel_t; +#endif + + +// A discarded item that should just be ignored. This is used for an +// item that was already processed and should be ignored by whatever +// stage is now looking at the ZBI. An earlier stage already "consumed" +// this information, but avoided copying data around to remove it from +// the ZBI item stream. +#define ZBI_TYPE_DISCARD (0x50494b53) // SKIP + + +// ZBI_TYPE_STORAGE_* types represent an image that might otherwise +// appear on some block storage device, i.e. a RAM disk of some sort. +// All zbi_header_t fields have the same meanings for all these types. +// The interpretation of the payload (after possible decompression) is +// indicated by the specific zbi_header_t.type value. +// +// **Note:** The ZBI_TYPE_STORAGE_* types are not a long-term stable ABI. +// - Items of these types are always packed for a specific version of the +// kernel and userland boot services, often in the same build that compiles +// the kernel. +// - These item types are **not** expected to be synthesized or +// examined by boot loaders. +// - New versions of the `zbi` tool will usually retain the ability to +// read old formats and non-default switches to write old formats, for +// diagnostic use. +// +// The zbi_header_t.extra field always gives the exact size of the +// original, uncompressed payload. That equals zbi_header_t.length when +// the payload is not compressed. If ZBI_FLAG_STORAGE_COMPRESSED is set in +// zbi_header_t.flags, then the payload is compressed. +// +// **Note:** Magic-number and header bytes at the start of the compressed +// payload indicate the compression algorithm and parameters. The set of +// compression formats is not a long-term stable ABI. +// - Zircon [userboot](../../../../docs/userboot.md) and core services +// do the decompression. A given kernel build's `userboot` will usually +// only support one particular compression format. +// - The `zbi` tool will usually retain the ability to compress and +// decompress for old formats, and can be used to convert between formats. +#define ZBI_FLAG_STORAGE_COMPRESSED (0x00000001) + +// A virtual disk image. This is meant to be treated as if it were a +// storage device. The payload (after decompression) is the contents of +// the storage device, in whatever format that might be. +#define ZBI_TYPE_STORAGE_RAMDISK (0x4b534452) // RDSK + +// The /boot filesystem in BOOTFS format, specified in <zircon/boot/bootfs.h>. +// A complete ZBI must have exactly one ZBI_TYPE_STORAGE_BOOTFS item. +// Zircon [userboot](../../../../docs/userboot.md) handles the contents +// of this filesystem. +#define ZBI_TYPE_STORAGE_BOOTFS (0x42534642) // BFSB + +// Device-specific factory data, stored in BOOTFS format, specified below. +#define ZBI_TYPE_STORAGE_BOOTFS_FACTORY (0x46534642) // BFSF + +// The remaining types are used to communicate information from the boot +// loader to the kernel. Usually these are synthesized in memory by the +// boot loader, but they can also be included in a ZBI along with the +// kernel and BOOTFS. Some boot loaders may set the zbi_header_t flags +// and crc32 fields to zero, though setting them to ZBI_FLAG_VERSION and +// ZBI_ITEM_NO_CRC32 is specified. The kernel doesn't check. + + +// A kernel command line fragment, a NUL-terminated UTF-8 string. +// Multiple ZBI_TYPE_CMDLINE items can appear. They are treated as if +// concatenated with ' ' between each item, in the order they appear: +// first items in the complete ZBI containing the kernel; then items in +// the ZBI synthesized by the boot loader. The kernel interprets the +// [whole command line](../../../../docs/kernel_cmdline.md). +#define ZBI_TYPE_CMDLINE (0x4c444d43) // CMDL + +// The crash log from the previous boot, a UTF-8 string. +#define ZBI_TYPE_CRASHLOG (0x4d4f4f42) // BOOM + +// Physical memory region that will persist across warm boots. +// zbi_nvram_t gives the physical base address and length in bytes. +#define ZBI_TYPE_NVRAM (0x4c4c564e) // NVLL +// This reflects a typo we need to support for a while. +#define ZBI_TYPE_NVRAM_DEPRECATED (0x4c4c5643) // CVLL +#ifndef __ASSEMBLER__ +typedef struct { + uint64_t base; + uint64_t length; +} zbi_nvram_t; +#endif + +#define ZBI_BOARD_NAME_LEN 32 + +// Platform ID Information. +#define ZBI_TYPE_PLATFORM_ID (0x44494C50) // PLID +#ifndef __ASSEMBLER__ +typedef struct { + uint32_t vid; + uint32_t pid; + char board_name[ZBI_BOARD_NAME_LEN]; +} zbi_platform_id_t; +#endif + +#define ZBI_TYPE_DRV_BOARD_INFO (0x4953426D) // mBSI +// Board-specific information. +#ifndef __ASSEMBLER__ +typedef struct { + uint32_t revision; +} zbi_board_info_t; +#endif + +// CPU configuration, a zbi_cpu_config_t header followed by one or more +// zbi_cpu_cluster_t entries. zbi_header_t.length must equal +// zbi_cpu_config_t.cluster_count * sizeof(zbi_cpu_cluster_t). +#define ZBI_TYPE_CPU_CONFIG (0x43555043) // CPUC +#ifndef __ASSEMBLER__ +typedef struct { + // Number of CPU cores in the cluster. + uint32_t cpu_count; + + // Reserved for future use. Set to 0. + uint32_t type; + uint32_t flags; + uint32_t reserved; +} zbi_cpu_cluster_t; + +typedef struct { + // Number of zbi_cpu_cluster_t entries following this header. + uint32_t cluster_count; + + // Reserved for future use. Set to 0. + uint32_t reserved[3]; + + // cluster_count entries follow. + zbi_cpu_cluster_t clusters[]; +} zbi_cpu_config_t; +#endif + +#define ZBI_TYPE_CPU_TOPOLOGY (0x544F504F) // TOPO + +#ifndef __ASSEMBLER__ + +#define ZBI_MAX_SMT 4 + +// These are Used in the flags field of zbi_topology_processor_t. + +// This is the processor that boots the system and the last to be shutdown. +#define ZBI_TOPOLOGY_PROCESSOR_PRIMARY 0b1 + +// This is the processor that handles all interrupts, some architectures will +// not have one. +#define ZBI_TOPOLOGY_PROCESSOR_INTERRUPT 0b10 + +#define ZBI_TOPOLOGY_NO_PARENT 0xFFFF + +typedef enum { + ZBI_TOPOLOGY_ARCH_UNDEFINED = 0, // Intended primarily for testing. + ZBI_TOPOLOGY_ARCH_X86 = 1, + ZBI_TOPOLOGY_ARCH_ARM = 2, +} zbi_topology_architecture_t; + +typedef struct { + // Cluster ids for each level, one being closest to the cpu. + // These map to aff1, aff2, and aff3 values in the ARM registers. + uint8_t cluster_1_id; + uint8_t cluster_2_id; + uint8_t cluster_3_id; + + // Id of the cpu inside of the bottom-most cluster, aff0 value. + uint8_t cpu_id; + + // The GIC interface number for this processor. + // In GIC v3+ this is not necessary as the processors are addressed by their + // affinity routing (all cluster ids followed by cpu_id). + uint8_t gic_id; +} zbi_topology_arm_info_t; + +typedef struct { + // Indexes here correspond to the logical_ids index for the thread. + uint32_t apic_ids[ZBI_MAX_SMT]; + uint32_t apic_id_count; +} zbi_topology_x86_info_t; + +typedef struct { + uint16_t logical_ids[ZBI_MAX_SMT]; + uint8_t logical_id_count; + + uint16_t flags; + + // Should be one of zbi_topology_arm_info_t. + // If UNDEFINED then nothing will be set in arch_info. + uint8_t architecture; + union { + zbi_topology_arm_info_t arm; + zbi_topology_x86_info_t x86; + } architecture_info; + +} zbi_topology_processor_t; + +typedef struct { + // Relative performance level of this processor in the system, with 0 + // representing the lowest performance. + // For example on a two cluster ARM big.LITTLE system 0 would be the little + // cores and 1 would represent the big cores. + uint8_t performance_class; +} zbi_topology_cluster_t; + +typedef struct { + // Starting and ending memory addresses of this numa region. + uint64_t start_address; + uint64_t end_address; +} zbi_topology_numa_region_t; + +typedef enum { + ZBI_TOPOLOGY_ENTITY_UNDEFINED = 0, // Unused default. + ZBI_TOPOLOGY_ENTITY_PROCESSOR = 1, + ZBI_TOPOLOGY_ENTITY_CLUSTER = 2, + ZBI_TOPOLOGY_ENTITY_CACHE = 3, + ZBI_TOPOLOGY_ENTITY_DIE = 4, + ZBI_TOPOLOGY_ENTITY_SOCKET = 5, + ZBI_TOPOLOGY_ENTITY_POWER_PLANE = 6, + ZBI_TOPOLOGY_ENTITY_NUMA_REGION = 7, +} zbi_topology_entity_type_t; + +typedef struct { + // Should be one of zbi_topology_entity_type_t. + uint8_t entity_type; + uint16_t parent_index; + union { + zbi_topology_processor_t processor; + zbi_topology_cluster_t cluster; + zbi_topology_numa_region_t numa_region; + } entity; +} zbi_topology_node_t; + +#endif + +// Memory configuration, one or more zbi_mem_range_t entries. +// zbi_header_t.length is sizeof(zbi_mem_range_t) times the number of entries. +#define ZBI_TYPE_MEM_CONFIG (0x434D454D) // MEMC +#ifndef __ASSEMBLER__ +typedef struct { + uint64_t paddr; + uint64_t length; + uint32_t type; + uint32_t reserved; +} zbi_mem_range_t; +#endif +#define ZBI_MEM_RANGE_RAM (1) +#define ZBI_MEM_RANGE_PERIPHERAL (2) +#define ZBI_MEM_RANGE_RESERVED (3) + +// Kernel driver configuration. The zbi_header_t.extra field gives a +// KDRV_* type that determines the payload format. +// See [driver-config.h](<zircon/boot/driver-config.h>) for details. +#define ZBI_TYPE_KERNEL_DRIVER (0x5652444B) // KDRV + +// ACPI Root Table Pointer, a uint64_t physical address. +#define ZBI_TYPE_ACPI_RSDP (0x50445352) // RSDP + +// SMBIOS entry point, a uint64_t physical address. +#define ZBI_TYPE_SMBIOS (0x49424d53) // SMBI + +// EFI memory map, a uint64_t entry size followed by a sequence of +// EFI memory descriptors aligned on that entry size. +#define ZBI_TYPE_EFI_MEMORY_MAP (0x4d494645) // EFIM + +// EFI system table, a uint64_t physical address. +#define ZBI_TYPE_EFI_SYSTEM_TABLE (0x53494645) // EFIS + +// E820 memory table, an array of e820entry_t. +#define ZBI_TYPE_E820_TABLE (0x30323845) // E820 + +/* EFI Variable for Crash Log */ +#define ZIRCON_VENDOR_GUID \ + {0x82305eb2, 0xd39e, 0x4575, {0xa0, 0xc8, 0x6c, 0x20, 0x72, 0xd0, 0x84, 0x4c}} +#define ZIRCON_CRASHLOG_EFIVAR \ + { 'c', 'r', 'a', 's', 'h', 'l', 'o', 'g', 0 } +#define ZIRCON_CRASHLOG_EFIATTR \ + (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) + +// Framebuffer parameters, a zbi_swfb_t entry. +#define ZBI_TYPE_FRAMEBUFFER (0x42465753) // SWFB + +// The image arguments, data is a trivial text format of one "key=value" per line +// with leading whitespace stripped and "#" comment lines and blank lines ignored. +// It is processed by bootsvc and parsed args are shared to others via Arguments service. +// TODO: the format can be streamlined after the /config/devmgr compat support is removed. +#define ZBI_TYPE_IMAGE_ARGS (0x47524149) // IARG + +// A copy of the boot version stored within the sysconfig +// partition +#define ZBI_TYPE_BOOT_VERSION (0x53525642) // BVRS + +#ifndef __ASSEMBLER__ +typedef struct { + // Physical memory address. + uint64_t base; + + // Pixel layout and format. + // See [../pixelformat.h](<zircon/pixelformat.h>). + uint32_t width; + uint32_t height; + uint32_t stride; + uint32_t format; +} zbi_swfb_t; +#endif + + +// ZBI_TYPE_DRV_* types (LSB is 'm') contain driver metadata. +#define ZBI_TYPE_DRV_METADATA(type) (((type) & 0xFF) == 0x6D) // 'm' + +// MAC address for Ethernet, Wifi, Bluetooth, etc. zbi_header_t.extra +// is a board-specific index to specify which device the MAC address +// applies to. zbi_header_t.length gives the size in bytes, which +// varies depending on the type of address appropriate for the device. +#define ZBI_TYPE_DRV_MAC_ADDRESS (0x43414D6D) // mMAC + +// A partition map for a storage device, a zbi_partition_map_t header +// followed by one or more zbi_partition_t entries. zbi_header_t.extra +// is a board-specific index to specify which device this applies to. +#define ZBI_TYPE_DRV_PARTITION_MAP (0x5452506D) // mPRT +#define ZBI_PARTITION_NAME_LEN (32) +#define ZBI_PARTITION_GUID_LEN (16) + +// Private information for the board driver. +#define ZBI_TYPE_DRV_BOARD_PRIVATE (0x524F426D) // mBOR + +#ifndef __ASSEMBLER__ +typedef struct { + // GUID specifying the format and use of data stored in the partition. + uint8_t type_guid[ZBI_PARTITION_GUID_LEN]; + + // GUID unique to this partition. + uint8_t uniq_guid[ZBI_PARTITION_GUID_LEN]; + + // First and last block occupied by this partition. + uint64_t first_block; + uint64_t last_block; + + // Reserved for future use. Set to 0. + uint64_t flags; + + char name[ZBI_PARTITION_NAME_LEN]; +} zbi_partition_t; + +typedef struct { + // Total blocks used on the device. + uint64_t block_count; + // Size of each block in bytes. + uint64_t block_size; + + // Number of partitions in the map. + uint32_t partition_count; + + // Reserved for future use. + uint32_t reserved; + + // Device GUID. + uint8_t guid[ZBI_PARTITION_GUID_LEN]; + + // partition_count partition entries follow. + zbi_partition_t partitions[]; +} zbi_partition_map_t; +#endif + + +#define ZBI_TYPE_HW_REBOOT_REASON (0x42525748) // HWRB + +#define ZBI_HW_REBOOT_UNDEFINED ((uint32_t)0) +#define ZBI_HW_REBOOT_COLD ((uint32_t)1) +#define ZBI_HW_REBOOT_WARM ((uint32_t)2) +#define ZBI_HW_REBOOT_BROWNOUT ((uint32_t)3) +#define ZBI_HW_REBOOT_WATCHDOG ((uint32_t)4) + +#ifndef __ASSEMBLER__ +#ifndef __cplusplus +typedef uint32_t zbi_hw_reboot_reason_t; +#else +enum class ZbiHwRebootReason : uint32_t { + Undefined = ZBI_HW_REBOOT_UNDEFINED, + Cold = ZBI_HW_REBOOT_COLD, + Warm = ZBI_HW_REBOOT_WARM, + Brownout = ZBI_HW_REBOOT_BROWNOUT, + Watchdog = ZBI_HW_REBOOT_WATCHDOG, +}; +using zbi_hw_reboot_reason_t = ZbiHwRebootReason; +#endif // __cplusplus +#endif // __ASSEMBLER__ + +#endif // SYSROOT_ZIRCON_BOOT_IMAGE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/multiboot.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/multiboot.h new file mode 100644 index 0000000..85cf0a6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/multiboot.h
@@ -0,0 +1,114 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright (c) 2009 Corey Tabaka + +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_MULTIBOOT_H_ +#define SYSROOT_ZIRCON_MULTIBOOT_H_ + +/* magic number for multiboot header */ +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 + +// Flags for multiboot header: +// 0x00000002: Boot loader should provide memory map. +// 0x00010000: *_addr fields in multiboot_header_t are used. +#define MULTIBOOT_HEADER_FLAGS 0x00010002 + +/* magic number passed by multiboot-compliant boot loaders */ +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 + +#ifndef __ASSEMBLER__ + +#include <stdint.h> + +/* multiboot header */ +typedef struct multiboot_header { + uint32_t magic; + uint32_t flags; + uint32_t checksum; + uint32_t header_addr; + uint32_t load_addr; + uint32_t load_end_addr; + uint32_t bss_end_addr; + uint32_t entry_addr; +} multiboot_header_t; + +/* symbol table for a.out */ +typedef struct aout_symbol_table { + uint32_t tabsize; + uint32_t strsize; + uint32_t addr; + uint32_t reserved; +} aout_symbol_table_t; + +/* section header table for ELF */ +typedef struct elf_section_header_table { + uint32_t num; + uint32_t size; + uint32_t addr; + uint32_t shndx; +} elf_section_header_table_t; + +/* multiboot info */ +typedef struct multiboot_info { + uint32_t flags; + uint32_t mem_lower; + uint32_t mem_upper; + uint32_t boot_device; + uint32_t cmdline; + uint32_t mods_count; + uint32_t mods_addr; + union { + aout_symbol_table_t aout_sym; + elf_section_header_table_t elf_sec; + } u; + uint32_t mmap_length; + uint32_t mmap_addr; + uint32_t drives_length; + uint32_t drives_addr; + uint32_t config_table; + uint32_t boot_loader_name; + uint32_t apm_table; +} multiboot_info_t; + +#define MB_INFO_MEM_SIZE 0x001 +#define MB_INFO_BOOT_DEV 0x002 +#define MB_INFO_CMD_LINE 0x004 +#define MB_INFO_MODS 0x008 +#define MB_INFO_SYMS 0x010 +#define MB_INFO_SHDR 0x020 +#define MB_INFO_MMAP 0x040 +#define MB_INFO_DRIVES 0x080 +#define MB_INFO_CONFIG 0x100 +#define MB_INFO_BOOT_LOADER 0x200 +#define MB_INFO_APM_TABLE 0x400 +#define MB_INFO_VBE 0x800 + +/* module structure */ +typedef struct module { + uint32_t mod_start; + uint32_t mod_end; + uint32_t string; + uint32_t reserved; +} module_t; + +/* memory map - be careful that the offset 0 is base_addr_low without size */ +typedef struct memory_map { + uint32_t size; + uint32_t base_addr_low; + uint32_t base_addr_high; + uint32_t length_low; + uint32_t length_high; + uint32_t type; +} memory_map_t; + +/* memory map entry types */ +#define MB_MMAP_TYPE_AVAILABLE 0x01 +#define MB_MMAP_TYPE_RESERVED 0x02 +#define MB_MMAP_TYPE_ACPI_RECLAIM 0x03 +#define MB_MMAP_TYPE_ACPI_NVS 0x04 + +#endif + +#endif // SYSROOT_ZIRCON_BOOT_MULTIBOOT_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/netboot.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/netboot.h new file mode 100644 index 0000000..edbfd53 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/netboot.h
@@ -0,0 +1,150 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_NETBOOT_H_ +#define SYSROOT_ZIRCON_BOOT_NETBOOT_H_ + +#include <stddef.h> +#include <stdint.h> +#include <zircon/types.h> + +// clang-format off + +#define BOOTLOADER_VERSION "0.7.22" + +#define NB_MAGIC 0xAA774217 +#define NB_DEBUGLOG_MAGIC 0xAEAE1123 + +#define NB_SERVER_PORT 33330 +#define NB_ADVERT_PORT 33331 +#define NB_CMD_PORT_START 33332 +#define NB_CMD_PORT_END 33339 +#define NB_TFTP_OUTGOING_PORT 33340 +#define NB_TFTP_INCOMING_PORT 33341 + + +#define NB_COMMAND 1 // arg=0, data=command +#define NB_SEND_FILE 2 // arg=size, data=filename +#define NB_DATA 3 // arg=offset, data=data +#define NB_BOOT 4 // arg=0 +#define NB_QUERY 5 // arg=0, data=hostname (or "*") +#define NB_SHELL_CMD 6 // arg=0, data=command string +#define NB_OPEN 7 // arg=O_RDONLY|O_WRONLY, data=filename +#define NB_READ 8 // arg=blocknum +#define NB_WRITE 9 // arg=blocknum, data=data +#define NB_CLOSE 10 // arg=0 +#define NB_LAST_DATA 11 // arg=offset, data=data +#define NB_REBOOT 12 // arg=0 +#define NB_GET_ADVERT 13 // arg=0 + +#define NB_ACK 0 // arg=0 or -err, NB_READ: data=data +#define NB_FILE_RECEIVED 0x70000001 // arg=size + +#define NB_ADVERTISE 0x77777777 + +#define NB_ERROR 0x80000000 +#define NB_ERROR_BAD_CMD 0x80000001 +#define NB_ERROR_BAD_PARAM 0x80000002 +#define NB_ERROR_TOO_LARGE 0x80000003 +#define NB_ERROR_BAD_FILE 0x80000004 + +#define NB_VERSION_1_0 0x0001000 +#define NB_VERSION_1_1 0x0001010 +#define NB_VERSION_1_2 0x0001020 +#define NB_VERSION_1_3 0x0001030 +#define NB_VERSION_CURRENT NB_VERSION_1_3 + +#define NB_FILENAME_PREFIX "<<netboot>>" +#define NB_KERNEL_FILENAME NB_FILENAME_PREFIX "kernel.bin" +#define NB_RAMDISK_FILENAME NB_FILENAME_PREFIX "ramdisk.bin" +#define NB_CMDLINE_FILENAME NB_FILENAME_PREFIX "cmdline" + +#define NB_IMAGE_PREFIX "<<image>>" +#define NB_FVM_HOST_FILENAME "sparse.fvm" +#define NB_FVM_FILENAME NB_IMAGE_PREFIX NB_FVM_HOST_FILENAME +#define NB_BOOTLOADER_HOST_FILENAME "bootloader.img" +#define NB_BOOTLOADER_FILENAME NB_IMAGE_PREFIX NB_BOOTLOADER_HOST_FILENAME +// Firmware images are slightly different, as they have an optional type suffix: +// firmware_ <- type = "" (the default) +// firmware_foo <- type = "foo" +#define NB_FIRMWARE_HOST_FILENAME_PREFIX "firmware_" +#define NB_FIRMWARE_FILENAME_PREFIX NB_IMAGE_PREFIX NB_FIRMWARE_HOST_FILENAME_PREFIX +#define NB_ZIRCONA_HOST_FILENAME "zircona.img" +#define NB_ZIRCONA_FILENAME NB_IMAGE_PREFIX NB_ZIRCONA_HOST_FILENAME +#define NB_ZIRCONB_HOST_FILENAME "zirconb.img" +#define NB_ZIRCONB_FILENAME NB_IMAGE_PREFIX NB_ZIRCONB_HOST_FILENAME +#define NB_ZIRCONR_HOST_FILENAME "zirconr.img" +#define NB_ZIRCONR_FILENAME NB_IMAGE_PREFIX NB_ZIRCONR_HOST_FILENAME +#define NB_VBMETAA_HOST_FILENAME "vbmetaa.img" +#define NB_VBMETAA_FILENAME NB_IMAGE_PREFIX NB_VBMETAA_HOST_FILENAME +#define NB_VBMETAB_HOST_FILENAME "vbmetab.img" +#define NB_VBMETAB_FILENAME NB_IMAGE_PREFIX NB_VBMETAB_HOST_FILENAME +#define NB_VBMETAR_HOST_FILENAME "vbmetar.img" +#define NB_VBMETAR_FILENAME NB_IMAGE_PREFIX NB_VBMETAR_HOST_FILENAME +#define NB_SSHAUTH_HOST_FILENAME "authorized_keys" +#define NB_SSHAUTH_FILENAME NB_IMAGE_PREFIX NB_SSHAUTH_HOST_FILENAME +#define NB_BOARD_NAME_HOST_FILENAME "board_name" +#define NB_BOARD_NAME_FILENAME NB_IMAGE_PREFIX NB_BOARD_NAME_HOST_FILENAME +#define NB_BOARD_REVISION_HOST_FILENAME "board_revision" +#define NB_BOARD_REVISION_FILENAME NB_IMAGE_PREFIX NB_BOARD_REVISION_HOST_FILENAME +#define NB_BOARD_INFO_HOST_FILENAME "board_info" +#define NB_BOARD_INFO_FILENAME NB_IMAGE_PREFIX NB_BOARD_INFO_HOST_FILENAME +#define NB_INIT_PARTITION_TABLES_HOST_FILENAME "init_partition_tables" +#define NB_INIT_PARTITION_TABLES_FILENAME NB_IMAGE_PREFIX NB_INIT_PARTITION_TABLES_HOST_FILENAME +#define NB_WIPE_PARTITION_TABLES_HOST_FILENAME "wipe_partition_tables" +#define NB_WIPE_PARTITION_TABLES_FILENAME NB_IMAGE_PREFIX NB_WIPE_PARTITION_TABLES_HOST_FILENAME + +// Should match paver FIDL definition. +// Length does not include the '\0' terminator, so when allocating a character +// buffer to hold the type use (NB_FIRMWARE_TYPE_MAX_LENGTH + 1). +#define NB_FIRMWARE_TYPE_MAX_LENGTH 256 + +typedef struct board_info { + char board_name[ZX_MAX_NAME_LEN]; + uint32_t board_revision; + uint8_t mac_address[8]; +} board_info_t; + +typedef struct modify_partition_table_info { + // Path of block device to initialize or wipe. + char block_device_path[ZX_MAX_NAME_LEN + 1]; +} modify_partition_table_info_t; + +typedef struct nbmsg_t { + uint32_t magic; + uint32_t cookie; + uint32_t cmd; + uint32_t arg; + uint8_t data[0]; +} nbmsg; + +typedef struct nbfile_t { + uint8_t* data; + size_t size; // max size of buffer + size_t offset; // write pointer +} nbfile; + +int netboot_init(const char* nodename); +const char* netboot_nodename(void); +int netboot_poll(void); +void netboot_close(void); + +// Ask for a buffer suitable to put the file /name/ in +// Return NULL to indicate /name/ is not wanted. +nbfile* netboot_get_buffer(const char* name, size_t size); + +#define DEBUGLOG_PORT 33337 +#define DEBUGLOG_ACK_PORT 33338 + +#define MAX_LOG_DATA 1216 +#define MAX_NODENAME_LENGTH 64 + +typedef struct logpacket { + uint32_t magic; + uint32_t seqno; + char nodename[MAX_NODENAME_LENGTH]; + char data[MAX_LOG_DATA]; +} logpacket_t; + +#endif // SYSROOT_ZIRCON_BOOT_NETBOOT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/sysconfig.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/sysconfig.h new file mode 100644 index 0000000..1f7d49b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/boot/sysconfig.h
@@ -0,0 +1,29 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_SYSCONFIG_H_ +#define SYSROOT_ZIRCON_BOOT_SYSCONFIG_H_ + +// Zircon sysconfig partition format +// +// The sysconfig partition consists of four kvstore sections, each 32K in size. +// The sections are: +// +// version-a: System configuration used when booting from Zircon-A. +// +// version-b: System configuration used when booting from Zircon-B. +// +// boot-default: Default bootloader configuration. +// +// boot-oneshot: Bootloader configuration for one-time use. +// If present, this overrides boot-default, and the bootloader +// deletes this section after use. + +#define ZX_SYSCONFIG_KVSTORE_SIZE 32768 +#define ZX_SYSCONFIG_VERSION_A_OFFSET (0 * ZX_SYSCONFIG_KVSTORE_SIZE) +#define ZX_SYSCONFIG_VERSION_B_OFFSET (1 * ZX_SYSCONFIG_KVSTORE_SIZE) +#define ZX_SYSCONFIG_BOOT_DEFAULT_OFFSET (2 * ZX_SYSCONFIG_KVSTORE_SIZE) +#define ZX_SYSCONFIG_BOOT_ONESHOT_OFFSET (3 * ZX_SYSCONFIG_KVSTORE_SIZE) + +#endif // SYSROOT_ZIRCON_BOOT_SYSCONFIG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/compiler.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/compiler.h new file mode 100644 index 0000000..ce2bcea --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/compiler.h
@@ -0,0 +1,191 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_COMPILER_H_ +#define SYSROOT_ZIRCON_COMPILER_H_ + +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + +#ifndef __has_cpp_attribute +#define __has_cpp_attribute(x) 0 +#endif + +#ifndef __ASSEMBLER__ + +#if !defined(__GNUC__) && !defined(__clang__) +#error "Unrecognized compiler!" +#endif + +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#define __UNUSED __attribute__((__unused__)) +#define __USED __attribute__((__used__)) +#define __PACKED __attribute__((packed)) +#define __ALIGNED(x) __attribute__((aligned(x))) +#define __PRINTFLIKE(__fmt, __varargs) __attribute__((__format__(__printf__, __fmt, __varargs))) +#define __SCANFLIKE(__fmt, __varargs) __attribute__((__format__(__scanf__, __fmt, __varargs))) +#define __SECTION(x) __attribute__((__section__(x))) +#define __PURE __attribute__((__pure__)) +#define __CONST __attribute__((__const__)) +#define __NO_RETURN __attribute__((__noreturn__)) +#define __MALLOC __attribute__((__malloc__)) +#define __WEAK __attribute__((__weak__)) +#define __GNU_INLINE __attribute__((__gnu_inline__)) +#define __GET_CALLER(x) __builtin_return_address(0) +#define __GET_FRAME(x) __builtin_frame_address(0) +#define __NAKED __attribute__((__naked__)) +#define __ISCONSTANT(x) __builtin_constant_p(x) +#define __NO_INLINE __attribute__((__noinline__)) +#define __SRAM __NO_INLINE __SECTION(".sram.text") +#define __CONSTRUCTOR __attribute__((__constructor__)) +#define __DESTRUCTOR __attribute__((__destructor__)) +#define __RESTRICT __restrict + +#ifndef __clang__ +#define __LEAF_FN __attribute__((__leaf__)) +#define __OPTIMIZE(x) __attribute__((__optimize__(x))) +#define __EXTERNALLY_VISIBLE __attribute__((__externally_visible__)) +#define __NO_SAFESTACK +#define __THREAD_ANNOTATION(x) +#else +#define __LEAF_FN +#define __OPTIMIZE(x) +#define __EXTERNALLY_VISIBLE +// The thread safety annotations are frequently used with C++ standard library +// types in userspace, so only enable the annotations if we know that the C++ +// standard library types are annotated or if we're in kernel code. +#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) || defined(_KERNEL) +#define __THREAD_ANNOTATION(x) __attribute__((x)) +#else +#define __THREAD_ANNOTATION(x) +#endif // _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS +#define __NO_SAFESTACK __attribute__((__no_sanitize__("safe-stack", "shadow-call-stack"))) +#endif + +#define __ALWAYS_INLINE __attribute__((__always_inline__)) +#define __MAY_ALIAS __attribute__((__may_alias__)) +#define __NONNULL(x) __attribute__((__nonnull__ x)) +#define __WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) +#define __UNREACHABLE __builtin_unreachable() +#define __WEAK_ALIAS(x) __attribute__((__weak__, __alias__(x))) +#define __ALIAS(x) __attribute__((__alias__(x))) +#define __EXPORT __attribute__((__visibility__("default"))) +#define __LOCAL __attribute__((__visibility__("hidden"))) +#define __THREAD __thread +#define __offsetof(type, field) __builtin_offsetof(type, field) + +// Only define __NO_UNIQUE_ADDRESS for C++, since it doesn't make sense in C. +#ifdef __cplusplus +#if __has_cpp_attribute(no_unique_address) +#define __NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +#define __NO_UNIQUE_ADDRESS +#endif +#endif // ifdef __cplusplus + +#if defined(__cplusplus) && __cplusplus >= 201703L +#define __FALLTHROUGH [[fallthrough]] +#elif defined(__cplusplus) && defined(__clang__) +#define __FALLTHROUGH [[clang::fallthrough]] +// The GNU style attribute is supported by Clang for C code, but __GNUC__ for +// clang right now is 4. +#elif __GNUC__ >= 7 || (!defined(__cplusplus) && defined(__clang__)) +#define __FALLTHROUGH __attribute__((__fallthrough__)) +#else +#define __FALLTHROUGH \ + do { \ + } while (0) +#endif + +// C++17 onwards supports [[nodiscard]] on a constructor, warning if +// a temporary object is created without a name. Such objects would be +// immediately destroyed again, while the user's expectation might be +// that it would last the scope. +// +// We could ideally just use [[nodiscard]] (or __WARN_UNUSED_RESULT) +// directly, except GCC < 10.0 has a bug preventing it from being used +// on constructors. __WARN_UNUSED_CONSTRUCTOR allows us to tag +// constructors in supported compilers, and is simply ignored in older +// compilers. +#if defined(__cplusplus) +// Clang and GCC versions >= 10.0 support [[nodiscard]] on constructors. +#if __cplusplus >= 201703L && (defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 10))) +#define __WARN_UNUSED_CONSTRUCTOR [[nodiscard]] +#else +#define __WARN_UNUSED_CONSTRUCTOR +#endif +#endif + +// Publicly exposed thread annotation macros. These have a long and ugly name to +// minimize the chance of collision with consumers of Zircon's public headers. +#define __TA_CAPABILITY(x) __THREAD_ANNOTATION(__capability__(x)) +#define __TA_GUARDED(x) __THREAD_ANNOTATION(__guarded_by__(x)) +#define __TA_ACQUIRE(...) __THREAD_ANNOTATION(__acquire_capability__(__VA_ARGS__)) +#define __TA_ACQUIRE_SHARED(...) __THREAD_ANNOTATION(__acquire_shared_capability__(__VA_ARGS__)) +#define __TA_TRY_ACQUIRE(...) __THREAD_ANNOTATION(__try_acquire_capability__(__VA_ARGS__)) +#define __TA_ACQUIRED_BEFORE(...) __THREAD_ANNOTATION(__acquired_before__(__VA_ARGS__)) +#define __TA_ACQUIRED_AFTER(...) __THREAD_ANNOTATION(__acquired_after__(__VA_ARGS__)) +#define __TA_RELEASE(...) __THREAD_ANNOTATION(__release_capability__(__VA_ARGS__)) +#define __TA_RELEASE_SHARED(...) __THREAD_ANNOTATION(__release_shared_capability__(__VA_ARGS__)) +#define __TA_REQUIRES(...) __THREAD_ANNOTATION(__requires_capability__(__VA_ARGS__)) +#define __TA_REQUIRES_SHARED(...) __THREAD_ANNOTATION(__requires_shared_capability__(__VA_ARGS__)) +#define __TA_EXCLUDES(...) __THREAD_ANNOTATION(__locks_excluded__(__VA_ARGS__)) +#define __TA_ASSERT(...) __THREAD_ANNOTATION(__assert_capability__(__VA_ARGS__)) +#define __TA_ASSERT_SHARED(...) __THREAD_ANNOTATION(__assert_shared_capability__(__VA_ARGS__)) +#define __TA_RETURN_CAPABILITY(x) __THREAD_ANNOTATION(__lock_returned__(x)) +#define __TA_SCOPED_CAPABILITY __THREAD_ANNOTATION(__scoped_lockable__) +#define __TA_NO_THREAD_SAFETY_ANALYSIS __THREAD_ANNOTATION(__no_thread_safety_analysis__) + +#endif // ifndef __ASSEMBLER__ + +#if !defined(__DEPRECATE) +#define __DEPRECATE __attribute__((__deprecated__)) +#endif + +/* TODO: add type check */ +#if !defined(countof) +#define countof(a) (sizeof(a) / sizeof((a)[0])) +#endif + +/* CPP header guards */ +#ifdef __cplusplus +#define __BEGIN_CDECLS extern "C" { +#define __END_CDECLS } +#else +#define __BEGIN_CDECLS +#define __END_CDECLS +#endif + +// constexpr annotation for use in static inlines usable in both C and C++ +#ifdef __cplusplus +#define __CONSTEXPR constexpr +#else +#define __CONSTEXPR +#endif + +#define add_overflow(a, b, c) __builtin_add_overflow(a, b, c) +#define sub_overflow(a, b, c) __builtin_sub_overflow(a, b, c) +#define mul_overflow(a, b, c) __builtin_mul_overflow(a, b, c) + +// A workaround to help static analyzer identify assertion failures +#if defined(__clang__) +#define __ANALYZER_CREATE_SINK __attribute__((analyzer_noreturn)) +#else +#define __ANALYZER_CREATE_SINK // no-op +#endif + +// Lifetime analysis +#ifndef __OWNER +#ifdef __clang__ +#define __OWNER(x) [[gsl::Owner(x)]] +#define __POINTER(x) [[gsl::Pointer(x)]] +#else +#define __OWNER(x) +#define __POINTER(x) +#endif +#endif + +#endif // SYSROOT_ZIRCON_COMPILER_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/device/audio.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/device/audio.h new file mode 100644 index 0000000..47da2d2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/device/audio.h
@@ -0,0 +1,460 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_DEVICE_AUDIO_H_ +#define SYSROOT_ZIRCON_DEVICE_AUDIO_H_ + +#include <sys/types.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +#include <cassert> +#include <cstdio> + +// When communicating with an Audio driver using zx_channel_call, do not use +// the AUDIO_INVALID_TRANSACTION_ID as your message's transaction ID. It is +// reserved for async notifications sent from the driver to the application. +#define AUDIO_INVALID_TRANSACTION_ID ((zx_txid_t)0) + +__BEGIN_CDECLS + +typedef uint32_t audio_cmd_t; + +// Commands sent on the stream channel +#define AUDIO_STREAM_CMD_GET_FORMATS ((audio_cmd_t)0x1000) +#define AUDIO_STREAM_CMD_SET_FORMAT ((audio_cmd_t)0x1001) +#define AUDIO_STREAM_CMD_GET_GAIN ((audio_cmd_t)0x1002) +#define AUDIO_STREAM_CMD_SET_GAIN ((audio_cmd_t)0x1003) +#define AUDIO_STREAM_CMD_PLUG_DETECT ((audio_cmd_t)0x1004) +#define AUDIO_STREAM_CMD_GET_UNIQUE_ID ((audio_cmd_t)0x1005) +#define AUDIO_STREAM_CMD_GET_STRING ((audio_cmd_t)0x1006) +#define AUDIO_STREAM_CMD_GET_CLOCK_DOMAIN ((audio_cmd_t)0x1007) + +// Async notifications sent on the stream channel. +#define AUDIO_STREAM_PLUG_DETECT_NOTIFY ((audio_cmd_t)0x2000) + +// Commands sent on the ring buffer channel +#define AUDIO_RB_CMD_GET_FIFO_DEPTH ((audio_cmd_t)0x3000) +#define AUDIO_RB_CMD_GET_BUFFER ((audio_cmd_t)0x3001) +#define AUDIO_RB_CMD_START ((audio_cmd_t)0x3002) +#define AUDIO_RB_CMD_STOP ((audio_cmd_t)0x3003) + +// Async notifications sent on the ring buffer channel. +#define AUDIO_RB_POSITION_NOTIFY ((audio_cmd_t)0x4000) + +// Flags used to modify commands. +// The NO_ACK flag can be used with the SET_GAIN and PLUG_DETECT commands. +#define AUDIO_FLAG_NO_ACK ((audio_cmd_t)0x80000000) + +typedef struct audio_cmd_hdr { + zx_txid_t transaction_id; + audio_cmd_t cmd; +} audio_cmd_hdr_t; + +static_assert(sizeof(audio_cmd_hdr_t) == 8, + "audio_cmd_hdr_t should be 8 bytes! " + "If sizeof(zx_txid_t has changed from 4 to 8, " + "consider repacking the structs in audio.h"); + +// audio_sample_format_t +// +// Bitfield which describes audio sample format as they reside in memory. +// +typedef uint32_t audio_sample_format_t; +#define AUDIO_SAMPLE_FORMAT_BITSTREAM ((audio_sample_format_t)(1u << 0)) +#define AUDIO_SAMPLE_FORMAT_8BIT ((audio_sample_format_t)(1u << 1)) +#define AUDIO_SAMPLE_FORMAT_16BIT ((audio_sample_format_t)(1u << 2)) +#define AUDIO_SAMPLE_FORMAT_20BIT_PACKED ((audio_sample_format_t)(1u << 4)) +#define AUDIO_SAMPLE_FORMAT_24BIT_PACKED ((audio_sample_format_t)(1u << 5)) +#define AUDIO_SAMPLE_FORMAT_20BIT_IN32 ((audio_sample_format_t)(1u << 6)) +#define AUDIO_SAMPLE_FORMAT_24BIT_IN32 ((audio_sample_format_t)(1u << 7)) +#define AUDIO_SAMPLE_FORMAT_32BIT ((audio_sample_format_t)(1u << 8)) +#define AUDIO_SAMPLE_FORMAT_32BIT_FLOAT ((audio_sample_format_t)(1u << 9)) +#define AUDIO_SAMPLE_FORMAT_FLAG_UNSIGNED ((audio_sample_format_t)(1u << 30)) +#define AUDIO_SAMPLE_FORMAT_FLAG_INVERT_ENDIAN ((audio_sample_format_t)(1u << 31)) +#define AUDIO_SAMPLE_FORMAT_FLAG_MASK \ + ((audio_sample_format_t)(AUDIO_SAMPLE_FORMAT_FLAG_UNSIGNED | \ + AUDIO_SAMPLE_FORMAT_FLAG_INVERT_ENDIAN)) + +// audio_stream_format_range_t +// +// A structure used along with the AUDIO_STREAM_CMD_GET_FORMATS command in order +// to describe the formats supported by an audio stream. +#define ASF_RANGE_FLAG_FPS_CONTINUOUS ((uint16_t)(1u << 0)) +#define ASF_RANGE_FLAG_FPS_48000_FAMILY ((uint16_t)(1u << 1)) +#define ASF_RANGE_FLAG_FPS_44100_FAMILY ((uint16_t)(1u << 2)) +typedef struct audio_stream_format_range { + audio_sample_format_t sample_formats; + uint32_t min_frames_per_second; + uint32_t max_frames_per_second; + uint8_t min_channels; + uint8_t max_channels; + uint16_t flags; +} __PACKED audio_stream_format_range_t; + +static_assert(sizeof(audio_stream_format_range_t) == 16, + "audio_stream_format_range_t should be 16 bytes!"); + +// audio_set_gain_flags_t +// +// Flags used by the AUDIO_STREAM_CMD_SET_GAIN message. +// +typedef uint32_t audio_set_gain_flags_t; +#define AUDIO_SGF_MUTE_VALID \ + ((audio_set_gain_flags_t)0x1) // Whether or not the mute flag is valid. +#define AUDIO_SGF_AGC_VALID ((audio_set_gain_flags_t)0x2) // Whether or not the agc flag is valid. +#define AUDIO_SGF_GAIN_VALID \ + ((audio_set_gain_flags_t)0x4) // Whether or not the gain float is valid. +#define AUDIO_SGF_MUTE ((audio_set_gain_flags_t)0x40000000) // Whether or not to mute the stream. +#define AUDIO_SGF_AGC \ + ((audio_set_gain_flags_t)0x80000000) // Whether or not enable AGC for the stream. + +// audio_pd_flags_t +// +// Flags used by AUDIO_STREAM_CMD_PLUG_DETECT commands to enable or disable +// asynchronous plug detect notifications. +// +typedef uint32_t audio_pd_flags_t; +#define AUDIO_PDF_NONE ((audio_pd_flags_t)0) +#define AUDIO_PDF_ENABLE_NOTIFICATIONS ((audio_pd_flags_t)0x40000000) +#define AUDIO_PDF_DISABLE_NOTIFICATIONS ((audio_pd_flags_t)0x80000000) + +// audio_pd_notify_flags_t +// +// Flags used by responses to the AUDIO_STREAM_CMD_PLUG_DETECT +// message, and by AUDIO_STREAM_PLUG_DETECT_NOTIFY messages. +// +typedef uint32_t audio_pd_notify_flags_t; +#define AUDIO_PDNF_HARDWIRED \ + ((audio_pd_notify_flags_t)0x1) // Stream is hardwired (will always be plugged in) +#define AUDIO_PDNF_CAN_NOTIFY \ + ((audio_pd_notify_flags_t)0x2) // Stream is able to notify of plug state changes. +#define AUDIO_PDNF_PLUGGED ((audio_pd_notify_flags_t)0x80000000) // Stream is currently plugged in. + +// AUDIO_STREAM_CMD_GET_FORMATS +// +// Must not be used with the NO_ACK flag. +#define AUDIO_STREAM_CMD_GET_FORMATS_MAX_RANGES_PER_RESPONSE (15u) +typedef struct audio_stream_cmd_get_formats_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_formats_req_t; + +// TODO(johngro) : Figure out if zx_txid_t is ever going to go up to 8 bytes or +// not. If it is, just remove the _pad field below. If not, either keep it as +// a _pad field, or repurpose it for some flags of some form. Right now, we use +// it to make sure that format_ranges is aligned to a 16 byte boundary. +typedef struct audio_stream_cmd_get_formats_resp { + audio_cmd_hdr_t hdr; + uint32_t _pad; + uint16_t format_range_count; + uint16_t first_format_range_ndx; + audio_stream_format_range_t format_ranges[AUDIO_STREAM_CMD_GET_FORMATS_MAX_RANGES_PER_RESPONSE]; +} audio_stream_cmd_get_formats_resp_t; + +static_assert(sizeof(audio_stream_cmd_get_formats_resp_t) == 256, + "audio_stream_cmd_get_formats_resp_t must be 256 bytes"); + +// AUDIO_STREAM_CMD_SET_FORMAT +// +// Must not be used with the NO_ACK flag. +typedef struct audio_stream_cmd_set_format_req { + audio_cmd_hdr_t hdr; + uint32_t frames_per_second; + audio_sample_format_t sample_format; + uint16_t channels; +} audio_stream_cmd_set_format_req_t; + +typedef struct audio_stream_cmd_set_format_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + uint64_t external_delay_nsec; + + // Note: Upon success, a channel used to control the audio buffer will also + // be returned. +} audio_stream_cmd_set_format_resp_t; + +// AUDIO_STREAM_CMD_GET_GAIN +// +// Request that a gain notification be sent with the current details of the +// streams current gain settings as well as gain setting capabilities. +// +// Must not be used with the NO_ACK flag. +typedef struct audio_stream_cmd_get_gain_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_gain_req_t; + +typedef struct audio_stream_cmd_get_gain_resp { + // TODO(johngro) : Is there value in exposing the gain step to the level + // above the lowest level stream interface, or should we have all drivers + // behave as if they have continuous control at all times? + audio_cmd_hdr_t hdr; + + bool cur_mute; // True if the stream is currently muted. + bool cur_agc; // True if the stream has AGC currently enabled. + float cur_gain; // The current setting gain of the stream in dB + + bool can_mute; // True if the stream is capable of muting + bool can_agc; // True if the stream has support for AGC + float min_gain; // The minimum valid gain setting, in dB + float max_gain; // The maximum valid gain setting, in dB + float gain_step; // The smallest valid gain increment, counted from the minimum gain. +} audio_stream_cmd_get_gain_resp_t; + +// AUDIO_STREAM_CMD_SET_GAIN +// +// Request that a stream change its gain settings to most closely match those +// requested. Gain values for Valid requests will be rounded to the nearest +// gain step. For example, if a stream can control its gain on the range from +// -60.0 to 0.0 dB, a request to set the gain to -33.3 dB will result in a gain +// of -33.5 being applied. +// +// Gain change requests outside of the capabilities of the stream's +// amplifier will be rejected with a result of ZX_ERR_INVALID_ARGS. Using the +// previous example, requests for gains of -65.0 or +3dB would be rejected. +// Similarly, If an amplifier is capable of gain control but cannot mute, a +// request to mute will be rejected. +// +// TODO(johngro) : Is this the correct behavior? Should we just apply sensible +// limits instead? IOW - If the user requests a gain of -1000 dB, should we +// just set the gain to -60dB? Likewise, if they request mute but the amplifier +// has no hard mute feature, should we just set the gain to the minimum +// permitted gain? +// +// May be used with the NO_ACK flag. +typedef struct audio_stream_cmd_set_gain_req { + audio_cmd_hdr_t hdr; + audio_set_gain_flags_t flags; + float gain; +} audio_stream_cmd_set_gain_req_t; + +typedef struct audio_stream_cmd_set_gain_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + // The current gain settings observed immediately after processing the set + // gain request. + bool cur_mute; + bool cur_agc; + float cur_gain; +} audio_stream_cmd_set_gain_resp_t; + +// AUDIO_STREAM_CMD_PLUG_DETECT +// +// Trigger a plug detect operation and/or enable/disable asynchronous plug +// detect notifications. +// +// May be used with the NO_ACK flag. +typedef struct audio_stream_cmd_plug_detect_req { + audio_cmd_hdr_t hdr; + audio_pd_flags_t flags; // Options used to enable or disable notifications +} audio_stream_cmd_plug_detect_req_t; + +typedef struct audio_stream_cmd_plug_detect_resp { + audio_cmd_hdr_t hdr; + audio_pd_notify_flags_t flags; // The current plug state and capabilities + zx_time_t plug_state_time; // The time of the plug state last change. +} audio_stream_cmd_plug_detect_resp_t; + +// AUDIO_STREAM_PLUG_DETECT_NOTIFY +// +// Message asynchronously in response to a plug state change to clients who have +// registered for plug state notifications. +// +// Note: Solicited and unsolicited plug detect messages currently use the same +// structure and contain the same information. The difference between the two +// is that Solicited messages, use AUDIO_STREAM_CMD_PLUG_DETECT as the value of +// the `cmd` field of their header and the transaction ID of the request sent by +// the client. Unsolicited messages use AUDIO_STREAM_PLUG_DETECT_NOTIFY as the +// value value of the `cmd` field of their header, and +// AUDIO_INVALID_TRANSACTION_ID for their transaction ID. +typedef audio_stream_cmd_plug_detect_resp_t audio_stream_plug_detect_notify_t; + +// AUDIO_STREAM_CMD_GET_UNIQUE_ID +// +// Fetch a globally unique, but persistent ID for the stream. +// +// Drivers should make every effort to return as unique an identifier as +// possible for each stream that they publish. This ID must not change between +// boots. When available, using a globally unique device serial number is +// strongly encouraged. Other possible sources of unique-ness include a +// driver's physical connection path, driver binding information, manufacturer +// calibration data, and so on. +// +// Note: a small number of hardcoded unique ID has been provided for built-in +// devices. Platform drivers for systems with hardwired audio devices may use +// these unique IDs as appropriate to signal which audio streams represent the +// built-in devices for the system. Drivers for hot-pluggable audio devices +// should *never* use these identifiers. +// +// Even given this, higher level code should *not* depend on these identifiers +// being perfectly unique, and should be prepared to take steps to de-dupe +// identifiers when needed. +typedef struct audio_stream_cmd_get_unique_id_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_unique_id_req_t; + +typedef struct audio_stream_unique_id { + uint8_t data[16]; +} audio_stream_unique_id_t; + +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_SPEAKERS \ + { \ + .data = { 0x01, 0x00 } \ + } +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_HEADPHONE_JACK \ + { \ + .data = { 0x02, 0x00 } \ + } +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_MICROPHONE \ + { \ + .data = { 0x03, 0x00 } \ + } +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_HEADSET_JACK \ + { \ + .data = { 0x04, 0x00 } \ + } + +typedef struct audio_stream_cmd_get_unique_id_resp { + audio_cmd_hdr_t hdr; + audio_stream_unique_id_t unique_id; +} audio_stream_cmd_get_unique_id_resp_t; + +// AUDIO_STREAM_CMD_GET_STRING +// +// Fetch the specified string from a device's static string table. Strings +// returned by the device driver... +// +// ++ Must be encoded using UTF8 +// ++ May contain embedded NULLs +// ++ May not be NULL terminated +// +// Drivers are encouraged to NULL terminate all of their strings whenever +// possible, but are not required to do so if the response buffer is too small. +// +typedef uint32_t audio_stream_string_id_t; +#define AUDIO_STREAM_STR_ID_MANUFACTURER ((audio_stream_string_id_t)0x80000000) +#define AUDIO_STREAM_STR_ID_PRODUCT ((audio_stream_string_id_t)0x80000001) + +typedef struct audio_stream_cmd_get_string_req { + audio_cmd_hdr_t hdr; + audio_stream_string_id_t id; +} audio_stream_cmd_get_string_req_t; + +typedef struct audio_stream_cmd_get_string_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + audio_stream_string_id_t id; + uint32_t strlen; + uint8_t str[256 - sizeof(audio_cmd_hdr_t) - (3 * sizeof(uint32_t))]; +} audio_stream_cmd_get_string_resp_t; + +static_assert(sizeof(audio_stream_cmd_get_string_resp_t) == 256, + "audio_stream_cmd_get_string_resp_t must be exactly 256 bytes"); + +// AUDIO_STREAM_CMD_GET_CLOCK_DOMAIN +// +// Fetch the hardware clock domain for this device. +// On products containing audio devices that are not locked to the local system clock, the board +// driver will provide a clock tree entry to the audio driver at driver startup time. From that, +// the audio driver can extract the clock domain and provide it to the sender, upon receiving this +// command. This domain value is all that the sender needs, in order to locate controls for that +// clock domain in the clock tree and trim that clock domain's rate. +// On products containing audio devices that are locked to the local system monotonic clock, a clock +// domain value of 0 should be returned. +// +// Must not be used with the NO_ACK flag. +typedef struct audio_stream_cmd_get_clock_domain_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_clock_domain_req_t; + +typedef struct audio_stream_cmd_get_clock_domain_resp { + audio_cmd_hdr_t hdr; + int32_t clock_domain; +} audio_stream_cmd_get_clock_domain_resp_t; + +// +// Ring-buffer commands +// + +// AUDIO_RB_CMD_GET_FIFO_DEPTH +// +// TODO(johngro) : Is calling this "FIFO" depth appropriate? Should it be some +// direction neutral form of something like "max-read-ahead-amount" or something +// instead? +// +// Must not be used with the NO_ACK flag. +typedef struct audio_rb_cmd_get_fifo_depth_req { + audio_cmd_hdr_t hdr; +} audio_rb_cmd_get_fifo_depth_req_t; + +typedef struct audio_rb_cmd_get_fifo_depth_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + + // A representation (in bytes) of how far ahead audio hardware may read + // into the stream (in the case of output) or may hold onto audio before + // writing it to memory (in the case of input). + uint32_t fifo_depth; +} audio_rb_cmd_get_fifo_depth_resp_t; + +// AUDIO_RB_CMD_GET_BUFFER +typedef struct audio_rb_cmd_get_buffer_req { + audio_cmd_hdr_t hdr; + + uint32_t min_ring_buffer_frames; + uint32_t notifications_per_ring; +} audio_rb_cmd_get_buffer_req_t; + +typedef struct audio_rb_cmd_get_buffer_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + uint32_t num_ring_buffer_frames; + + // NOTE: If result == ZX_OK, a VMO handle representing the ring buffer to + // be used will be returned as well. Clients may map this buffer with + // read-write permissions in the case of an output stream, or read-only + // permissions in the case of an input stream. The size of the VMO + // indicates where the wrap point of the ring (in bytes) is located in the + // VMO. This size *must* always be an integral number of audio frames. + // + // TODO(johngro) : Should we provide some indication of whether or not this + // memory is being used directly for HW DMA and may need explicit cache + // flushing/invalidation? +} audio_rb_cmd_get_buffer_resp_t; + +// AUDIO_RB_CMD_START +typedef struct audio_rb_cmd_start_req { + audio_cmd_hdr_t hdr; +} audio_rb_cmd_start_req_t; + +typedef struct audio_rb_cmd_start_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + uint64_t start_time; +} audio_rb_cmd_start_resp_t; + +// AUDIO_RB_CMD_STOP +typedef struct audio_rb_cmd_stop_req { + audio_cmd_hdr_t hdr; +} audio_rb_cmd_stop_req_t; + +typedef struct audio_rb_cmd_stop_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; +} audio_rb_cmd_stop_resp_t; + +// AUDIO_RB_POSITION_NOTIFY +typedef struct audio_rb_position_notify { + audio_cmd_hdr_t hdr; + + // The time, per system monotonic clock, of the below byte position. + zx_time_t monotonic_time; + + // The current position (in bytes) of the driver/hardware's read (output) or + // write (input) pointer in the ring buffer. + uint32_t ring_buffer_pos; +} audio_rb_position_notify_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_DEVICE_AUDIO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/dlfcn.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/dlfcn.h new file mode 100644 index 0000000..f37e9be --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/dlfcn.h
@@ -0,0 +1,35 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_DLFCN_H_ +#define SYSROOT_ZIRCON_DLFCN_H_ + +#include <dlfcn.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Loads a dynamic shared object stored in |vmo|. +// Acts identically to dlopen, but acts on a vmo +// instead of a file path. +// +// Does not take ownership of the input vmo. +void* dlopen_vmo(zx_handle_t vmo, int mode); + +// Replace the handle to the "loader service" used to map names +// to VM objects for dlopen et al. This takes ownership of the +// given handle, and gives the caller ownership of the old handle +// in the return value. +zx_handle_t dl_set_loader_service(zx_handle_t new_svc); + +// Ask the active "loader service" (if there is one), to return +// a new connection. Not all loader services need support this. +// On success, a channel handle to the new connection is returned +// via out. +zx_status_t dl_clone_loader_service(zx_handle_t* out); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_DLFCN_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/driver/binding.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/driver/binding.h new file mode 100644 index 0000000..82f513e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/driver/binding.h
@@ -0,0 +1,310 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_DRIVER_BINDING_H_ +#define SYSROOT_ZIRCON_DRIVER_BINDING_H_ + +#include <assert.h> +#include <stdalign.h> +#include <stddef.h> +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// COAABBBB VVVVVVVV Condition Opcode paramA paramB Value + +#define OP_ABORT 0x0 // if (cond) return no-match +#define OP_MATCH 0x1 // if (cond) return match +#define OP_GOTO 0x2 // if (cond) advance to next LABEL(paramA) +#define OP_LABEL 0x5 // no-op, labels line with paramA + +#define COND_AL 0x0 // true +#define COND_EQ 0x1 // bind(paramB) == Value +#define COND_NE 0x2 // bind(paramB) != Value +#define COND_GT 0x3 // bind(paramB) > Value +#define COND_LT 0x4 // bind(paramB) < Value +#define COND_GE 0x5 // bind(paramB) >= Value +#define COND_LE 0x6 // bind(paramB) <= Value + +// branches are forward-only +// branches always go to the first matching LABEL +// branches that cannot find a matching LABEL are treated as ABORTs +// there is an implied unconditional ABORT after the last instruction +// flags are initially zero, may be set/cleared with SET/CLEAR +// flags may be tested by comparison against BIND_FLAGS + +#define BINDINST(c, o, a, b, v) \ + { (((c)&0xF) << 28) | (((o)&0xF) << 24) | (((a)&0xFF) << 16) | ((b)&0xFFFF), (v), 0 /* debug */ } + +#define BINDINST_CC(n) ((n) >> 28) +#define BINDINST_OP(n) (((n) >> 24) & 0xF) +#define BINDINST_PA(n) (((n) >> 16) & 0xFF) +#define BINDINST_PB(n) ((n)&0xFFFF) + +#define BI_ABORT() BINDINST(COND_AL, OP_ABORT, 0, 0, 0) +#define BI_MATCH() BINDINST(COND_AL, OP_MATCH, 0, 0, 0) +#define BI_GOTO(n) BINDINST(COND_AL, OP_GOTO, n, 0, 0) +#define BI_LABEL(n) BINDINST(COND_AL, OP_LABEL, n, 0, 0) + +#define BI_ABORT_IF(c, b, v) BINDINST(COND_##c, OP_ABORT, 0, b, v) +#define BI_MATCH_IF(c, b, v) BINDINST(COND_##c, OP_MATCH, 0, b, v) +#define BI_GOTO_IF(c, b, v, n) BINDINST(COND_##c, OP_GOTO, n, b, v) + +// for drivers that only want to be bound on user request +#define BI_ABORT_IF_AUTOBIND BI_ABORT_IF(NE, BIND_AUTOBIND, 0) + +// global binding variables at 0x00XX +#define BIND_FLAGS 0x0000 // value of the flags register +#define BIND_PROTOCOL 0x0001 // primary protocol of the device +#define BIND_AUTOBIND 0x0002 // if this is an automated bind/load + +// pci binding variables at 0x01XX +#define BIND_PCI_VID 0x0100 +#define BIND_PCI_DID 0x0101 +#define BIND_PCI_CLASS 0x0102 +#define BIND_PCI_SUBCLASS 0x0103 +#define BIND_PCI_INTERFACE 0x0104 +#define BIND_PCI_REVISION 0x0105 + +// usb binding variables at 0x02XX +// these are used for both ZX_PROTOCOL_USB and ZX_PROTOCOL_USB_FUNCTION +#define BIND_USB_VID 0x0200 +#define BIND_USB_PID 0x0201 +#define BIND_USB_CLASS 0x0202 +#define BIND_USB_SUBCLASS 0x0203 +#define BIND_USB_PROTOCOL 0x0204 + +// Platform bus binding variables at 0x03XX +#define BIND_PLATFORM_DEV_VID 0x0300 +#define BIND_PLATFORM_DEV_PID 0x0301 +#define BIND_PLATFORM_DEV_DID 0x0302 +#define BIND_PLATFORM_PROTO 0x0303 + +// ACPI binding variables at 0x04XX +// The _HID is a 7- or 8-byte string. Because a bind property is 32-bit, use 2 +// properties to bind using the _HID. They are encoded in big endian order for +// human readability. In the case of 7-byte _HID's, the 8th-byte shall be 0. +#define BIND_ACPI_HID_0_3 0x0400 // char 0-3 +#define BIND_ACPI_HID_4_7 0x0401 // char 4-7 +// The _CID may be a valid HID value or a bus-specific string. The ACPI bus +// driver only publishes those that are valid HID values. +#define BIND_ACPI_CID_0_3 0x0402 // char 0-3 +#define BIND_ACPI_CID_4_7 0x0403 // char 4-7 + +// Intel HDA Codec binding variables at 0x05XX +#define BIND_IHDA_CODEC_VID 0x0500 +#define BIND_IHDA_CODEC_DID 0x0501 +#define BIND_IHDA_CODEC_MAJOR_REV 0x0502 +#define BIND_IHDA_CODEC_MINOR_REV 0x0503 +#define BIND_IHDA_CODEC_VENDOR_REV 0x0504 +#define BIND_IHDA_CODEC_VENDOR_STEP 0x0505 + +// Serial binding variables at 0x06XX +#define BIND_SERIAL_CLASS 0x0600 +#define BIND_SERIAL_VID 0x0601 +#define BIND_SERIAL_PID 0x0602 + +// NAND binding variables at 0x07XX +#define BIND_NAND_CLASS 0x0700 + +// Bluetooth binding variables at 0x08XX +#define BIND_BT_GATT_SVC_UUID16 0x0800 +// 128-bit UUID is split across 4 32-bit unsigned ints +#define BIND_BT_GATT_SVC_UUID128_1 0x0801 +#define BIND_BT_GATT_SVC_UUID128_2 0x0802 +#define BIND_BT_GATT_SVC_UUID128_3 0x0803 +#define BIND_BT_GATT_SVC_UUID128_4 0x0804 + +// SDIO binding variables at 0x09XX +#define BIND_SDIO_VID 0x0900 +#define BIND_SDIO_PID 0x0901 +#define BIND_SDIO_FUNCTION 0x0902 + +// I2C binding variables at 0x0A0X +#define BIND_I2C_CLASS 0x0A00 +#define BIND_I2C_BUS_ID 0x0A01 +#define BIND_I2C_ADDRESS 0x0A02 + +// GPIO binding variables at 0x0A1X +#define BIND_GPIO_PIN 0x0A10 + +// POWER binding variables at 0x0A2X +#define BIND_POWER_DOMAIN 0x0A20 +#define BIND_POWER_DOMAIN_COMPOSITE 0x0A21 + +// POWER binding variables at 0x0A3X +#define BIND_CLOCK_ID 0x0A30 + +// SPI binding variables at 0x0A4X +#define BIND_SPI_CLASS 0x0A40 +#define BIND_SPI_BUS_ID 0x0A41 +#define BIND_SPI_CHIP_SELECT 0x0A42 + +// PWM binding variables at 0x0A5X +#define BIND_PWM_ID 0x0A50 + +// Init Step binding variables at 0x0A6X +#define BIND_INIT_STEP 0x0A60 + +// Fuchsia-defined topological path properties are at 0x0B00 through 0x0B7F. +// Vendor-defined topological path properties are at 0x0B80 to 0x0BFF. +// For vendor properties, it is recommended that a vendor ID be included +// and checked via some other property. +#define BIND_TOPO_START 0x0B00 +#define BIND_TOPO_PCI 0x0B00 +#define BIND_TOPO_I2C 0x0B01 +#define BIND_TOPO_SPI 0x0B02 +#define BIND_TOPO_VENDOR_START 0x0B80 +#define BIND_TOPO_VENDOR_END 0x0BFF +#define BIND_TOPO_END 0x0BFF + +#define BIND_TOPO_PCI_PACK(bus, dev, func) (((bus) << 8) | (dev << 3) | (func)) +#define BIND_TOPO_PCI_UNPACK_BUS(topo) (((topo) >> 8) & 0xff) +#define BIND_TOPO_PCI_UNPACK_DEVICE(topo) (((topo) >> 3) & 0x1f) +#define BIND_TOPO_PCI_UNPACK_FUNCTION(topo) ((topo)&0x7) + +#define BIND_TOPO_I2C_PACK(addr) ((addr)) +#define BIND_TOPO_I2C_UNPACK(topo) ((topo)) + +#define BIND_TOPO_SPI_PACK(bus, chip_select) (((bus) << 8) | (chip_select)) +#define BIND_TOPO_SPI_UNPACK_BUS_ID(topo) (((topo) >> 8) && 0xff) +#define BIND_TOPO_SPI_UNPACK_CHIP_SELECT(topo) ((topo)&0xff) + +typedef struct zx_bind_inst { + uint32_t op; + uint32_t arg; + uint32_t debug; +} zx_bind_inst_t; + +typedef struct zx_device_prop { + uint16_t id; + uint16_t reserved; + uint32_t value; +} zx_device_prop_t; + +// simple example +#if 0 +zx_bind_inst_t i915_binding[] = { + BI_ABORT_IF(NE, BIND_PROTOCOL, ZX_PROTOCOL_PCI), + BI_ABORT_IF(NE, BIND_PCI_VID, 0x8086), + BI_MATCH_IF(EQ, BIND_PCI_DID, 0x1616), // broadwell + BI_MATCH_IF(EQ, BIND_PCI_DID, 0x1916), // skylake + BI_ABORT(), +}; +#endif + +#define ZIRCON_NOTE_NAME "Zircon" +#define ZIRCON_NOTE_DRIVER 0x31565244 // DRV1 + +typedef struct { + // Elf64_Nhdr fields: + uint32_t namesz; + uint32_t descsz; + uint32_t type; + // ELF note name. namesz is the exact size of the name (including '\0'), + // but the storage size is always rounded up to a multiple of 4 bytes. + char name[(sizeof(ZIRCON_NOTE_NAME) + 3) & -4]; +} zircon_driver_note_header_t; + +#define ZIRCON_DRIVER_NOTE_HEADER_INIT(object) \ + { \ + /* .namesz = */ sizeof(ZIRCON_NOTE_NAME), \ + /* .descsz = */ (sizeof(object) - sizeof(zircon_driver_note_header_t)), \ + /* .type = */ ZIRCON_NOTE_DRIVER, /* .name = */ ZIRCON_NOTE_NAME, \ + } + +typedef struct { + // See flag bits below. + uint32_t flags; + + // Driver Metadata + uint32_t bindcount; + uint32_t reserved0; + char name[32]; + char vendor[16]; + char version[16]; + + // Driver Bind Program follows +} zircon_driver_note_payload_t; + +// Flag bits in the driver note: + +// Driver is built with `-fsanitize=address` and can only be loaded into a +// devhost that supports the ASan runtime. +#define ZIRCON_DRIVER_NOTE_FLAG_ASAN (1u << 0) + +#define ZIRCON_DRIVER_NOTE_PAYLOAD_INIT(Driver, VendorName, Version, BindCount) \ + { \ + /* .flags = */ ZIRCON_DRIVER_NOTE_FLAGS, /* .bindcount = */ (BindCount), /* .reserved0 = */ 0, \ + /* .name = */ #Driver, /* .vendor = */ VendorName, /* .version = */ Version, \ + } + +#define ZIRCON_DRIVER_NOTE_FLAGS \ + (__has_feature(address_sanitizer) ? ZIRCON_DRIVER_NOTE_FLAG_ASAN : 0) + +typedef struct { + zircon_driver_note_header_t header; + zircon_driver_note_payload_t payload; +} zircon_driver_note_t; + +static_assert(offsetof(zircon_driver_note_t, payload) == sizeof(zircon_driver_note_header_t), + "alignment snafu?"); + +// Without this, ASan will add redzone padding after the object, which +// would make it invalid ELF note format. +#if __has_feature(address_sanitizer) +#define ZIRCON_DRIVER_NOTE_ASAN __attribute__((no_sanitize("address"))) +#else +#define ZIRCON_DRIVER_NOTE_ASAN +#endif + +// GCC has a quirk about how '__attribute__((visibility("default")))' +// (__EXPORT here) works for const variables in C++. The attribute has no +// effect when used on the definition of a const variable, and GCC gives a +// warning/error about that. The attribute must appear on the "extern" +// declaration of the variable instead. + +// We explicitly align the note to 4 bytes. That's its natural alignment +// anyway, but the compilers sometimes like to over-align as an +// optimization while other tools sometimes like to complain if SHT_NOTE +// sections are over-aligned (since this could result in padding being +// inserted that makes it violate the ELF note format). Standard C11 +// doesn't permit alignas(...) on a type but we could use __ALIGNED(4) on +// all the types (i.e. GNU __attribute__ syntax instead of C11 syntax). +// But the alignment of the types is not actually the issue: it's the +// compiler deciding to over-align the individual object regardless of its +// type's alignment, so we have to explicitly set the alignment of the +// object to defeat any compiler default over-alignment. + +#define ZIRCON_DRIVER_BEGIN(Driver, Ops, VendorName, Version, BindCount) \ + const zx_driver_ops_t* __zircon_driver_ops__ __EXPORT = &(Ops); \ + zx_driver_rec_t __zircon_driver_rec__ __EXPORT = { \ + /* .ops = */ &(Ops), /* .driver = */ NULL, \ + /* .log_flags = */ 7, /* DDK_LOG_ERROR | DDK_LOG_WARN | DDK_LOG_INFO */ \ + }; \ + extern const struct zircon_driver_note __zircon_driver_note__ __EXPORT; \ + alignas(4) __SECTION(".note.zircon.driver." #Driver) \ + ZIRCON_DRIVER_NOTE_ASAN const struct zircon_driver_note { \ + zircon_driver_note_t note; \ + zx_bind_inst_t binding[BindCount]; \ + } __zircon_driver_note__ = { \ + /* .note = */ { \ + ZIRCON_DRIVER_NOTE_HEADER_INIT(__zircon_driver_note__), \ + ZIRCON_DRIVER_NOTE_PAYLOAD_INIT(Driver, VendorName, Version, BindCount), \ + }, \ + /* .binding = */ { +#define ZIRCON_DRIVER_END(Driver) \ + } \ + } \ + ; + +// TODO: if we moved the Ops from the BEGIN() to END() macro we +// could add a zircon_driver_note_t* to the zx_driver_rec_t, +// define it in END(), and have only one symbol to dlsym() +// when loading drivers + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_DRIVER_BINDING_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/errors.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/errors.h new file mode 100644 index 0000000..4e0da7d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/errors.h
@@ -0,0 +1,233 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_ERRORS_H_ +#define SYSROOT_ZIRCON_ERRORS_H_ + +// Zircon statuses are signed 32 bit integers. The space of values is +// divided as follows: +// - The zero value is for the OK status. +// - Negative values are defined by the system, in this file. +// - Positive values are reserved for protocol-specific error values, +// and will never be defined by the system. + +#define ZX_OK (0) + +// ======= Internal failures ======= +// ZX_ERR_INTERNAL: The system encountered an otherwise unspecified error +// while performing the operation. +#define ZX_ERR_INTERNAL (-1) + +// ZX_ERR_NOT_SUPPORTED: The operation is not implemented, supported, +// or enabled. +#define ZX_ERR_NOT_SUPPORTED (-2) + +// ZX_ERR_NO_RESOURCES: The system was not able to allocate some resource +// needed for the operation. +#define ZX_ERR_NO_RESOURCES (-3) + +// ZX_ERR_NO_MEMORY: The system was not able to allocate memory needed +// for the operation. +#define ZX_ERR_NO_MEMORY (-4) + +// -5 used to be ZX_ERR_CALL_FAILED. + +// ZX_ERR_INTERNAL_INTR_RETRY: The system call was interrupted, but should be +// retried. This should not be seen outside of the VDSO. +#define ZX_ERR_INTERNAL_INTR_RETRY (-6) + +// ======= Parameter errors ======= +// ZX_ERR_INVALID_ARGS: an argument is invalid, ex. null pointer +#define ZX_ERR_INVALID_ARGS (-10) + +// ZX_ERR_BAD_HANDLE: A specified handle value does not refer to a handle. +#define ZX_ERR_BAD_HANDLE (-11) + +// ZX_ERR_WRONG_TYPE: The subject of the operation is the wrong type to +// perform the operation. +// Example: Attempting a message_read on a thread handle. +#define ZX_ERR_WRONG_TYPE (-12) + +// ZX_ERR_BAD_SYSCALL: The specified syscall number is invalid. +#define ZX_ERR_BAD_SYSCALL (-13) + +// ZX_ERR_OUT_OF_RANGE: An argument is outside the valid range for this +// operation. +#define ZX_ERR_OUT_OF_RANGE (-14) + +// ZX_ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for +// this operation. +#define ZX_ERR_BUFFER_TOO_SMALL (-15) + +// ======= Precondition or state errors ======= +// ZX_ERR_BAD_STATE: operation failed because the current state of the +// object does not allow it, or a precondition of the operation is +// not satisfied +#define ZX_ERR_BAD_STATE (-20) + +// ZX_ERR_TIMED_OUT: The time limit for the operation elapsed before +// the operation completed. +#define ZX_ERR_TIMED_OUT (-21) + +// ZX_ERR_SHOULD_WAIT: The operation cannot be performed currently but +// potentially could succeed if the caller waits for a prerequisite +// to be satisfied, for example waiting for a handle to be readable +// or writable. +// Example: Attempting to read from a channel that has no +// messages waiting but has an open remote will return ZX_ERR_SHOULD_WAIT. +// Attempting to read from a channel that has no messages waiting +// and has a closed remote end will return ZX_ERR_PEER_CLOSED. +#define ZX_ERR_SHOULD_WAIT (-22) + +// ZX_ERR_CANCELED: The in-progress operation (e.g. a wait) has been +// canceled. +#define ZX_ERR_CANCELED (-23) + +// ZX_ERR_PEER_CLOSED: The operation failed because the remote end of the +// subject of the operation was closed. +#define ZX_ERR_PEER_CLOSED (-24) + +// ZX_ERR_NOT_FOUND: The requested entity is not found. +#define ZX_ERR_NOT_FOUND (-25) + +// ZX_ERR_ALREADY_EXISTS: An object with the specified identifier +// already exists. +// Example: Attempting to create a file when a file already exists +// with that name. +#define ZX_ERR_ALREADY_EXISTS (-26) + +// ZX_ERR_ALREADY_BOUND: The operation failed because the named entity +// is already owned or controlled by another entity. The operation +// could succeed later if the current owner releases the entity. +#define ZX_ERR_ALREADY_BOUND (-27) + +// ZX_ERR_UNAVAILABLE: The subject of the operation is currently unable +// to perform the operation. +// Note: This is used when there's no direct way for the caller to +// observe when the subject will be able to perform the operation +// and should thus retry. +#define ZX_ERR_UNAVAILABLE (-28) + +// ======= Permission check errors ======= +// ZX_ERR_ACCESS_DENIED: The caller did not have permission to perform +// the specified operation. +#define ZX_ERR_ACCESS_DENIED (-30) + +// ======= Input-output errors ======= +// ZX_ERR_IO: Otherwise unspecified error occurred during I/O. +#define ZX_ERR_IO (-40) + +// ZX_ERR_REFUSED: The entity the I/O operation is being performed on +// rejected the operation. +// Example: an I2C device NAK'ing a transaction or a disk controller +// rejecting an invalid command, or a stalled USB endpoint. +#define ZX_ERR_IO_REFUSED (-41) + +// ZX_ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity +// check and is possibly corrupted. +// Example: CRC or Parity error. +#define ZX_ERR_IO_DATA_INTEGRITY (-42) + +// ZX_ERR_IO_DATA_LOSS: The data in the operation is currently unavailable +// and may be permanently lost. +// Example: A disk block is irrecoverably damaged. +#define ZX_ERR_IO_DATA_LOSS (-43) + +// ZX_ERR_IO_NOT_PRESENT: The device is no longer available (has been +// unplugged from the system, powered down, or the driver has been +// unloaded) +#define ZX_ERR_IO_NOT_PRESENT (-44) + +// ZX_ERR_IO_OVERRUN: More data was received from the device than expected. +// Example: a USB "babble" error due to a device sending more data than +// the host queued to receive. +#define ZX_ERR_IO_OVERRUN (-45) + +// ZX_ERR_IO_MISSED_DEADLINE: An operation did not complete within the required timeframe. +// Example: A USB isochronous transfer that failed to complete due to an overrun or underrun. +#define ZX_ERR_IO_MISSED_DEADLINE (-46) + +// ZX_ERR_IO_INVALID: The data in the operation is invalid parameter or is out of range. +// Example: A USB transfer that failed to complete with TRB Error +#define ZX_ERR_IO_INVALID (-47) + +// ======== Filesystem Errors ======== +// ZX_ERR_BAD_PATH: Path name is too long. +#define ZX_ERR_BAD_PATH (-50) + +// ZX_ERR_NOT_DIR: Object is not a directory or does not support +// directory operations. +// Example: Attempted to open a file as a directory or +// attempted to do directory operations on a file. +#define ZX_ERR_NOT_DIR (-51) + +// ZX_ERR_NOT_FILE: Object is not a regular file. +#define ZX_ERR_NOT_FILE (-52) + +// ZX_ERR_FILE_BIG: This operation would cause a file to exceed a +// filesystem-specific size limit +#define ZX_ERR_FILE_BIG (-53) + +// ZX_ERR_NO_SPACE: Filesystem or device space is exhausted. +#define ZX_ERR_NO_SPACE (-54) + +// ZX_ERR_NOT_EMPTY: Directory is not empty. +#define ZX_ERR_NOT_EMPTY (-55) + +// ======== Flow Control ======== +// These are not errors, as such, and will never be returned +// by a syscall or public API. They exist to allow callbacks +// to request changes in operation. +// +// ZX_ERR_STOP: Do not call again. +// Example: A notification callback will be called on every +// event until it returns something other than ZX_OK. +// This status allows differentiation between "stop due to +// an error" and "stop because the work is done." +#define ZX_ERR_STOP (-60) + +// ZX_ERR_NEXT: Advance to the next item. +// Example: A notification callback will use this response +// to indicate it did not "consume" an item passed to it, +// but by choice, not due to an error condition. +#define ZX_ERR_NEXT (-61) + +// ZX_ERR_ASYNC: Ownership of the item has moved to an asynchronous worker. +// +// Unlike ZX_ERR_STOP, which implies that iteration on an object +// should stop, and ZX_ERR_NEXT, which implies that iteration +// should continue to the next item, ZX_ERR_ASYNC implies +// that an asynchronous worker is responsible for continuing iteration. +// +// Example: A notification callback will be called on every +// event, but one event needs to handle some work asynchronously +// before it can continue. ZX_ERR_ASYNC implies the worker is +// responsible for resuming iteration once its work has completed. +#define ZX_ERR_ASYNC (-62) + +// ======== Network-related errors ======== + +// ZX_ERR_PROTOCOL_NOT_SUPPORTED: Specified protocol is not +// supported. +#define ZX_ERR_PROTOCOL_NOT_SUPPORTED (-70) + +// ZX_ERR_ADDRESS_UNREACHABLE: Host is unreachable. +#define ZX_ERR_ADDRESS_UNREACHABLE (-71) + +// ZX_ERR_ADDRESS_IN_USE: Address is being used by someone else. +#define ZX_ERR_ADDRESS_IN_USE (-72) + +// ZX_ERR_NOT_CONNECTED: Socket is not connected. +#define ZX_ERR_NOT_CONNECTED (-73) + +// ZX_ERR_CONNECTION_REFUSED: Remote peer rejected the connection. +#define ZX_ERR_CONNECTION_REFUSED (-74) + +// ZX_ERR_CONNECTION_RESET: Connection was reset. +#define ZX_ERR_CONNECTION_RESET (-75) + +// ZX_ERR_CONNECTION_ABORTED: Connection was aborted. +#define ZX_ERR_CONNECTION_ABORTED (-76) + +#endif // SYSROOT_ZIRCON_ERRORS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/exception.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/exception.h new file mode 100644 index 0000000..bf3843b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/exception.h
@@ -0,0 +1,19 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include <zircon/syscalls/exception.h> + +#ifdef __cplusplus +extern "C" { +#endif + +__EXPORT const char* _zx_exception_get_string(zx_excp_type_t exception); +__EXPORT const char* zx_exception_get_string(zx_excp_type_t exception); + +#ifdef __cplusplus +} +#endif +
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/features.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/features.h new file mode 100644 index 0000000..d60e724 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/features.h
@@ -0,0 +1,47 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_FEATURES_H_ +#define SYSROOT_ZIRCON_FEATURES_H_ + +// clang-format off + +// types of features that can be retrieved via |zx_system_get_features| +#define ZX_FEATURE_KIND_CPU ((uint32_t)0) +#define ZX_FEATURE_KIND_HW_BREAKPOINT_COUNT ((uint32_t)1) +#define ZX_FEATURE_KIND_HW_WATCHPOINT_COUNT ((uint32_t)2) + +// arch-independent CPU features +#define ZX_HAS_CPU_FEATURES ((uint32_t)(1u << 0)) + +#if defined(__x86_64__) + +// x86-64 CPU features +// None; use cpuid instead + +#elif defined(__aarch64__) + +// arm64 CPU features +#define ZX_ARM64_FEATURE_ISA_FP ((uint32_t)(1u << 1)) +#define ZX_ARM64_FEATURE_ISA_ASIMD ((uint32_t)(1u << 2)) +#define ZX_ARM64_FEATURE_ISA_AES ((uint32_t)(1u << 3)) +#define ZX_ARM64_FEATURE_ISA_PMULL ((uint32_t)(1u << 4)) +#define ZX_ARM64_FEATURE_ISA_SHA1 ((uint32_t)(1u << 5)) +#define ZX_ARM64_FEATURE_ISA_SHA2 ((uint32_t)(1u << 6)) +#define ZX_ARM64_FEATURE_ISA_CRC32 ((uint32_t)(1u << 7)) +#define ZX_ARM64_FEATURE_ISA_ATOMICS ((uint32_t)(1u << 8)) +#define ZX_ARM64_FEATURE_ISA_RDM ((uint32_t)(1u << 9)) +#define ZX_ARM64_FEATURE_ISA_SHA3 ((uint32_t)(1u << 10)) +#define ZX_ARM64_FEATURE_ISA_SM3 ((uint32_t)(1u << 11)) +#define ZX_ARM64_FEATURE_ISA_SM4 ((uint32_t)(1u << 12)) +#define ZX_ARM64_FEATURE_ISA_DP ((uint32_t)(1u << 13)) +#define ZX_ARM64_FEATURE_ISA_DPB ((uint32_t)(1u << 14)) + +#else + +#error what architecture? + +#endif + +#endif // SYSROOT_ZIRCON_FEATURES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/fidl.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/fidl.h new file mode 100644 index 0000000..152843a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/fidl.h
@@ -0,0 +1,452 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_FIDL_H_ +#define SYSROOT_ZIRCON_FIDL_H_ + +#include <assert.h> // NOLINT(modernize-deprecated-headers, foobar) +#include <stdalign.h> // NOLINT(modernize-deprecated-headers) +#include <stdint.h> // NOLINT(modernize-*) +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Fidl data types have a representation in a wire format. This wire +// format is shared by all language bindings, including C11 and C++. +// +// The C bindings also define a representation of fidl data types. For +// a given type, the size and alignment of all parts of the type agree +// with the wire format's representation. The C representation differs +// in the representation of pointers to out-of-line allocations. On +// the wire, allocations are encoded as either present or not. In C, +// they are actual pointers. The C representation also places any +// transferred handle types (including requests) inline. The wire +// format tracks handles separately, just like the underlying channel +// transport does. +// +// Turning the wire format into the C format is called decoding. +// +// Turning the C format into the wire format is called encoding. +// +// The formats are designed to allow for in-place coding, assuming all +// out-of-line allocations placed are in traversal order (defined +// below) with natural alignment. + +// Bounds. + +// Various fidl types, such as strings and vectors, may be bounded. If +// no explicit bound is given, then FIDL_MAX_SIZE is implied. + +#define FIDL_MAX_SIZE UINT32_MAX + +// Out of line allocations. + +// The fidl wire format represents potential out-of-line allocations +// (corresponding to actual pointer types in the C format) as +// uintptr_t. For allocations that are actually present and that will +// be patched up with pointers during decoding, the FIDL_ALLOC_PRESENT +// value is used. For non-present nullable allocations, the +// FIDL_ALLOC_ABSENT value is used. + +#define FIDL_ALLOC_PRESENT ((uintptr_t)UINTPTR_MAX) +#define FIDL_ALLOC_ABSENT ((uintptr_t)0) + +// Out of line allocations are all 8 byte aligned. +// TODO(fxb/42792): Remove either this FIDL_ALIGN macro or the FidlAlign function in +// fidl/internal.h. +#define FIDL_ALIGNMENT ((size_t)8) +#define FIDL_ALIGN(a) (((a) + 7u) & ~7u) +#define FIDL_ALIGNDECL alignas(FIDL_ALIGNMENT) + +// An opaque struct representing the encoding of a particular fidl +// type. +typedef struct fidl_type fidl_type_t; + +// Primitive types. + +// Both on the wire and once deserialized, primitive fidl types +// correspond directly to C types. There is no intermediate layer of +// typedefs. For instance, fidl's float64 is generated as double. + +// All primitive types are non-nullable. + +// All primitive types are naturally sized and aligned on the wire. + +// fidl C Meaning. +// --------------------------------------------- +// bool bool A boolean. +// int8 int8_t An 8 bit signed integer. +// int16 int16_t A 16 bit signed integer. +// int32 int32_t A 32 bit signed integer. +// int64 int64_t A 64 bit signed integer. +// uint8 uint8_t An 8 bit unsigned integer. +// uint16 uint16_t A 16 bit unsigned integer. +// uint32 uint32_t A 32 bit unsigned integer. +// uint64 uint64_t A 64 bit unsigned integer. +// float32 float A 32 bit IEEE-754 float. +// float64 double A 64 bit IEEE-754 float. + +// Enums. + +// Fidl enums have an undering integer type (one of int8, int16, +// int32, int64, uint8, uint16, uint32, or uint64). The wire format of +// an enum and the C format of an enum are the same as the +// corresponding primitive type. + +// String types. + +// Fidl strings are variable-length UTF-8 strings. Strings can be +// nullable (string?) or nonnullable (string); if nullable, the null +// string is distinct from the empty string. Strings can be bounded to +// a fixed byte length (e.g. string:40? is a nullable string of at +// most 40 bytes). + +// Strings are not guaranteed to be nul terminated. Strings can +// contain embedded nuls throughout their length. + +// The fidl wire format dictates that strings are valid UTF-8. It is +// up to clients to provide well-formed UTF-8 and servers to check for +// it. Message encoding and decoding can, but does not by default, +// perform this check. + +// All deserialized string types are represented by the fidl_string_t +// structure. This structure consists of a size (in bytes) and a +// pointer to an out-of-line allocation of uint8_t, guaranteed to be +// at least as long as the length. + +// The bound on a string type is not present in the serialized format, +// but is checked as part of validation. + +typedef struct fidl_string { + // Number of UTF-8 code units (bytes), must be 0 if |data| is null. + uint64_t size; + + // Pointer to UTF-8 code units (bytes) or null + char* data; +} fidl_string_t; + +// When encoded, an absent nullable string is represented as a +// fidl_string_t with size 0 and FIDL_ALLOC_ABSENT data, with no +// out-of-line allocation associated with it. A present string +// (nullable or not) is represented as a fidl_string_t with some size +// and with data equal to FIDL_ALLOC_PRESENT, which the decoding +// process replaces with an actual pointer to the next out-of-line +// allocation. + +// All string types: + +// fidl C Meaning +// ----------------------------------------------------------------- +// string fidl_string_t A string of arbitrary length. +// string? fidl_string_t An optional string of arbitrary length. +// string:N fidl_string_t A string up to N bytes long. +// string:N? fidl_string_t An optional string up to N bytes long. + +// Arrays. + +// On the wire, an array of N objects of type T (array<T, N>) is +// represented the same as N contiguous Ts. Equivalently, it is +// represented the same as a nonnullable struct containing N fields +// all of type T. + +// In C, this is just represented as a C array of the corresponding C +// type. + +// Vector types. + +// Fidl vectors are variable-length arrays of a given type T. Vectors +// can be nullable (vector<T>?) or nonnullable (vector<T>); if +// nullable, the null vector is distinct from the empty +// vector. Vectors can be bounded to a fixed element length +// (e.g. vector<T>:40? is a nullable vector of at most 40 Ts). + +// All deserialized vector types are represented by the fidl_vector_t +// structure. This structure consists of a count and a pointer to the +// bytes. + +// The bound on a vector type is not present in the serialized format, +// but is checked as part of validation. + +typedef struct fidl_vector { + // Number of elements, must be 0 if |data| is null. + uint64_t count; + + // Pointer to element data or null. + void* data; +} fidl_vector_t; + +// When encoded, an absent nullable vector is represented as a +// fidl_vector_t with size 0 and FIDL_ALLOC_ABSENT data, with no +// out-of-line allocation associated with it. A present vector +// (nullable or not) is represented as a fidl_vector_t with some size +// and with data equal to FIDL_ALLOC_PRESENT, which the decoding +// process replaces with an actual pointer to the next out-of-line +// allocation. + +// All vector types: + +// fidl C Meaning +// -------------------------------------------------------------------------- +// vector<T> fidl_vector_t A vector of T, of arbitrary length. +// vector<T>? fidl_vector_t An optional vector of T, of arbitrary length. +// vector<T>:N fidl_vector_t A vector of T, up to N elements. +// vector<T>:N? fidl_vector_t An optional vector of T, up to N elements. + +// Envelope. + +// An efficient way to encapsulate uninterpreted FIDL messages. +// - Stores a variable size uninterpreted payload out-of-line. +// - Payload may contain an arbitrary number of bytes and handles. +// - Allows for encapsulation of one FIDL message inside of another. +// - Building block for extensible structures such as tables & extensible +// unions. + +// When encoded for transfer, |data| indicates presence of content: +// - FIDL_ALLOC_ABSENT : envelope is null +// - FIDL_ALLOC_PRESENT : envelope is non-null, |data| is the next out-of-line object +// When decoded for consumption, |data| is a pointer to content. +// - nullptr : envelope is null +// - <valid pointer> : envelope is non-null, |data| is at indicated memory address + +typedef struct { + // The size of the entire envelope contents, including any additional + // out-of-line objects that the envelope may contain. For example, a + // vector<string>'s num_bytes for ["hello", "world"] would include the + // string contents in the size, not just the outer vector. Always a multiple + // of 8; must be zero if envelope is null. + uint32_t num_bytes; + + // The number of handles in the envelope, including any additional + // out-of-line objects that the envelope contains. Must be zero if envelope is null. + uint32_t num_handles; + + // A pointer to the out-of-line envelope data in decoded form, or + // FIDL_ALLOC_(ABSENT|PRESENT) in encoded form. + union { + void* data; + uintptr_t presence; + }; +} fidl_envelope_t; + +// Handle types. + +// Handle types are encoded directly. Just like primitive types, there +// is no fidl-specific handle type. Generated fidl structures simply +// mention zx_handle_t. + +// Handle types are either nullable (handle?), or not (handle); and +// either explicitly typed (e.g. handle<Channel> or handle<Job>), or +// not. + +// All fidl handle types, regardless of subtype, are represented as +// zx_handle_t. The encoding tables do know the handle subtypes, +// however, for clients which wish to perform explicit checking. + +// The following are the possible handle subtypes. + +// process +// thread +// vmo +// channel +// event +// port +// interrupt +// iomap +// pci +// log +// socket +// resource +// eventpair +// job +// vmar +// fifo +// hypervisor +// guest +// timer + +// All handle types are 4 byte sized and aligned on the wire. + +// When encoded, absent nullable handles are represented as +// FIDL_HANDLE_ABSENT. Present handles, whether nullable or not, are +// represented as FIDL_HANDLE_PRESENT, which the decoding process will +// overwrite with the next handle value in the channel message. + +#define FIDL_HANDLE_ABSENT ((zx_handle_t)ZX_HANDLE_INVALID) +#define FIDL_HANDLE_PRESENT ((zx_handle_t)UINT32_MAX) + +// fidl C Meaning +// ------------------------------------------------------------------ +// handle zx_handle_t Any valid handle. +// handle? zx_handle_t Any valid handle, or ZX_HANDLE_INVALID. +// handle<T> zx_handle_t Any valid T handle. +// handle<T>? zx_handle_t Any valid T handle, or ZX_HANDLE_INVALID. + +// Unions. + +// Fidl unions are a tagged sum type. The tag is a 4 bytes. For every +// union type, the fidl compiler generates an enum representing the +// different variants of the enum. This is followed, in C and on the +// wire, by large enough and aligned enough storage for all members of +// the union. + +// Unions may be nullable. Nullable unions are represented as a +// pointer to an out of line allocation of tag-and-member. As with +// other out-of-line allocations, ones present on the wire take the +// value FIDL_ALLOC_PRESENT and those that are not are represented by +// FIDL_ALLOC_NULL. Nonnullable unions are represented inline as a +// tag-and-member. + +// For each fidl union type, a corresponding C type is generated. They +// are all structs consisting of a fidl_union_tag_t discriminant, +// followed by an anonymous union of all the union members. + +typedef uint32_t fidl_union_tag_t; + +// fidl C Meaning +// -------------------------------------------------------------------- +// union foo {...} struct union_foo { An inline union. +// fidl_union_tag_t tag; +// union {...}; +// } +// +// union foo {...}? struct union_foo* A pointer to a +// union_foo, or else +// FIDL_ALLOC_ABSENT. + +// Tables. + +// Tables are 'flexible structs', where all members are optional, and new +// members can be added, or old members removed while preserving ABI +// compatibility. Each table member is referenced by ordinal, sequentially +// assigned from 1 onward, with no gaps. Each member content is stored +// out-of-line in an envelope, and a table is simply a vector of these envelopes +// with the requirement that the last envelope must be present in order +// to guarantee a canonical representation. + +typedef struct { + fidl_vector_t envelopes; +} fidl_table_t; + +// Extensible unions. + +// Extensible unions, or "xunions" (colloquially pronounced "zoo-nions") are +// similar to unions, except that storage for union members are out-of-line +// rather than inline. This enables union members to be added and removed while +// preserving ABI compatibility with the existing xunion definition. + +typedef uint64_t fidl_xunion_tag_t; + +enum { + kFidlXUnionEmptyTag = 0, // The tag representing an empty xunion. +}; + +typedef struct { + fidl_xunion_tag_t tag; + fidl_envelope_t envelope; +} fidl_xunion_t; + +// Messages. + +// All fidl messages share a common 16 byte header. + +enum { + kFidlWireFormatMagicNumberInitial = 1, +}; + +typedef struct fidl_message_header { + zx_txid_t txid; + uint8_t flags[3]; + // This value indicates the message's wire format. Two sides with different + // wire formats are incompatible with each other + uint8_t magic_number; + uint64_t ordinal; +} fidl_message_header_t; + +// Messages which do not have a response use zero as a special +// transaction id. + +#define FIDL_TXID_NO_RESPONSE 0ul + +// A FIDL message. +typedef struct fidl_msg { + // The bytes of the message. + // + // The bytes of the message might be in the encoded or decoded form. + // Functions that take a |fidl_msg_t| as an argument should document whether + // the expect encoded or decoded messages. + // + // See |num_bytes| for the number of bytes in the message. + void* bytes; + + // The handles of the message. + // + // See |num_bytes| for the number of bytes in the message. + zx_handle_t* handles; + + // The number of bytes in |bytes|. + uint32_t num_bytes; + + // The number of handles in |handles|. + uint32_t num_handles; +} fidl_msg_t; + +// An outstanding FIDL transaction. +typedef struct fidl_txn fidl_txn_t; +struct fidl_txn { + // Replies to the outstanding request and complete the FIDL transaction. + // + // Pass the |fidl_txn_t| object itself as the first parameter. The |msg| + // should already be encoded. This function always consumes any handles + // present in |msg|. + // + // Call |reply| only once for each |txn| object. After |reply| returns, the + // |txn| object is considered invalid and might have been freed or reused + // for another purpose. + zx_status_t (*reply)(fidl_txn_t* txn, const fidl_msg_t* msg); +}; + +// An epitaph is a message that a server sends just prior to closing the +// connection. It provides an indication of why the connection is being closed. +// Epitaphs are defined in the FIDL wire format specification. Once sent down +// the wire, the channel should be closed. +typedef struct fidl_epitaph { + FIDL_ALIGNDECL + + // The method ordinal for all epitaphs must be kFidlOrdinalEpitaph + fidl_message_header_t hdr; + + // The error associated with this epitaph is stored as a struct{int32} in + // the message payload. System errors must be constants of type zx_status_t, + // which are all negative. Positive numbers should be used for application + // errors. A value of ZX_OK indicates no error. + zx_status_t error; +} fidl_epitaph_t; + +// This ordinal value is reserved for Epitaphs. +enum { + kFidlOrdinalEpitaph = 0xFFFFFFFFFFFFFFFF, +}; + +// Assumptions. + +// Ensure that FIDL_ALIGNMENT is sufficient. +static_assert(alignof(bool) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int8_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int16_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int32_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int64_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint8_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint16_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint32_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint64_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(float) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(double) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(void*) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(fidl_union_tag_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(fidl_message_header_t) <= FIDL_ALIGNMENT, ""); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_FIDL_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/gpt.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/gpt.h new file mode 100644 index 0000000..005415c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/gpt.h
@@ -0,0 +1,300 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_GPT_H_ +#define SYSROOT_ZIRCON_HW_GPT_H_ + +#include <assert.h> +#include <stdbool.h> +#include <stdint.h> +#include <zircon/compiler.h> + +#define GPT_MAGIC (0x5452415020494645ull) // 'EFI PART' +#define GPT_HEADER_SIZE 0x5c +#define GPT_ENTRY_SIZE 0x80 +#define GPT_GUID_LEN 16 +#define GPT_GUID_STRLEN 37 +#define GPT_NAME_LEN 72 + +typedef struct gpt_header { + uint64_t magic; // Magic number. + uint32_t revision; // Revision. + uint32_t size; // Size of the header. + uint32_t crc32; // Checksum of this header. + uint32_t reserved0; // Reserved field. + uint64_t current; // Block where this table is stored. + uint64_t backup; // Block where other copy of partition table is stored. + uint64_t first; // First usable block. Block after primary partition table ends. + uint64_t last; // Last usable block. Block before backup partition table starts. + uint8_t guid[GPT_GUID_LEN]; // Disk GUID. + uint64_t entries; // Starting block where entries for this partition tables are found. + // Value equals 2 for primary copy. + uint32_t entries_count; // Total number of entries. + uint32_t entries_size; // Size of each entry. + uint32_t entries_crc; // Checksum of the entire entries array. +} __PACKED gpt_header_t; + +static_assert(GPT_HEADER_SIZE == sizeof(gpt_header_t), "Gpt header size invalid"); + +typedef struct gpt_entry { + uint8_t type[GPT_GUID_LEN]; + uint8_t guid[GPT_GUID_LEN]; + uint64_t first; + uint64_t last; + uint64_t flags; + uint8_t name[GPT_NAME_LEN]; // UTF-16 on disk +} gpt_entry_t; + +static_assert(GPT_ENTRY_SIZE == sizeof(gpt_entry_t), "Gpt entry size invalid"); + +// clang-format off +#define GUID_EMPTY_STRING "00000000-0000-0000-0000-000000000000" +#define GUID_EMPTY_VALUE { \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, \ + 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ +} +#define GUID_EMPTY_NAME "empty" + +#define GUID_EFI_STRING "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" +#define GUID_EFI_VALUE { \ + 0x28, 0x73, 0x2a, 0xc1, \ + 0x1f, 0xf8, \ + 0xd2, 0x11, \ + 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b \ +} +#define GUID_EFI_NAME "efi-system" + +// GUID for a system partition +#define GUID_SYSTEM_STRING "606B000B-B7C7-4653-A7D5-B737332C899D" +#define GUID_SYSTEM_VALUE { \ + 0x0b, 0x00, 0x6b, 0x60, \ + 0xc7, 0xb7, \ + 0x53, 0x46, \ + 0xa7, 0xd5, 0xb7, 0x37, 0x33, 0x2c, 0x89, 0x9d \ +} +#define GUID_SYSTEM_NAME "fuchsia-system" + +// GUID for a data partition +#define GUID_DATA_STRING "08185F0C-892D-428A-A789-DBEEC8F55E6A" +#define GUID_DATA_VALUE { \ + 0x0c, 0x5f, 0x18, 0x08, \ + 0x2d, 0x89, \ + 0x8a, 0x42, \ + 0xa7, 0x89, 0xdb, 0xee, 0xc8, 0xf5, 0x5e, 0x6a \ +} +#define GUID_DATA_NAME "fuchsia-data" + +// GUID for a installer partition +#define GUID_INSTALL_STRING "48435546-4953-2041-494E-5354414C4C52" +#define GUID_INSTALL_VALUE { \ + 0x46, 0x55, 0x43, 0x48, \ + 0x53, 0x49, \ + 0x41, 0x20, \ + 0x49, 0x4E, 0x53, 0x54, 0x41, 0x4C, 0x4C, 0x52 \ +} +#define GUID_INSTALL_NAME "fuchsia-install" + +#define GUID_BLOB_STRING "2967380E-134C-4CBB-B6DA-17E7CE1CA45D" +#define GUID_BLOB_VALUE { \ + 0x0e, 0x38, 0x67, 0x29, \ + 0x4c, 0x13, \ + 0xbb, 0x4c, \ + 0xb6, 0xda, 0x17, 0xe7, 0xce, 0x1c, 0xa4, 0x5d \ +} +#define GUID_BLOB_NAME "fuchsia-blob" + +#define GUID_FVM_STRING "41D0E340-57E3-954E-8C1E-17ECAC44CFF5" +#define GUID_FVM_VALUE { \ + 0x40, 0xe3, 0xd0, 0x41, \ + 0xe3, 0x57, \ + 0x4e, 0x95, \ + 0x8c, 0x1e, 0x17, 0xec, 0xac, 0x44, 0xcf, 0xf5 \ +} +#define GUID_FVM_NAME "fuchsia-fvm" + +#define GUID_ZIRCON_A_STRING "DE30CC86-1F4A-4A31-93C4-66F147D33E05" +#define GUID_ZIRCON_A_VALUE { \ + 0x86, 0xcc, 0x30, 0xde, \ + 0x4a, 0x1f, \ + 0x31, 0x4a, \ + 0x93, 0xc4, 0x66, 0xf1, 0x47, 0xd3, 0x3e, 0x05, \ +} +#define GUID_ZIRCON_A_NAME "zircon-a" + +#define GUID_ZIRCON_B_STRING "23CC04DF-C278-4CE7-8471-897D1A4BCDF7" +#define GUID_ZIRCON_B_VALUE { \ + 0xdf, 0x04, 0xcc, 0x23, \ + 0x78, 0xc2, \ + 0xe7, 0x4c, \ + 0x84, 0x71, 0x89, 0x7d, 0x1a, 0x4b, 0xcd, 0xf7 \ +} +#define GUID_ZIRCON_B_NAME "zircon-b" + +#define GUID_ZIRCON_R_STRING "A0E5CF57-2DEF-46BE-A80C-A2067C37CD49" +#define GUID_ZIRCON_R_VALUE { \ + 0x57, 0xcf, 0xe5, 0xa0, \ + 0xef, 0x2d, \ + 0xbe, 0x46, \ + 0xa8, 0x0c, 0xa2, 0x06, 0x7c, 0x37, 0xcd, 0x49 \ +} +#define GUID_ZIRCON_R_NAME "zircon-r" + +#define GUID_SYS_CONFIG_STRING "4E5E989E-4C86-11E8-A15B-480FCF35F8E6" +#define GUID_SYS_CONFIG_VALUE { \ + 0x9e, 0x98, 0x5e, 0x4e, \ + 0x86, 0x4c, \ + 0xe8, 0x11, \ + 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ +} +#define GUID_SYS_CONFIG_NAME "sys-config" + +#define GUID_FACTORY_CONFIG_STRING "5A3A90BE-4C86-11E8-A15B-480FCF35F8E6" +#define GUID_FACTORY_CONFIG_VALUE { \ + 0xbe, 0x90, 0x3a, 0x5a, \ + 0x86, 0x4c, \ + 0xe8, 0x11, \ + 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ +} +#define GUID_FACTORY_CONFIG_NAME "factory" + +#define GUID_BOOTLOADER_STRING "5ECE94FE-4C86-11E8-A15B-480FCF35F8E6" +#define GUID_BOOTLOADER_VALUE { \ + 0xfe, 0x94, 0xce, 0x5e, \ + 0x86, 0x4c, \ + 0xe8, 0x11, \ + 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ +} +#define GUID_BOOTLOADER_NAME "bootloader" + +#define GUID_TEST_STRING "8B94D043-30BE-4871-9DFA-D69556E8C1F3" +#define GUID_TEST_VALUE { \ + 0x43, 0xD0, 0x94, 0x8b, \ + 0xbe, 0x30, \ + 0x71, 0x48, \ + 0x9d, 0xfa, 0xd6, 0x95, 0x56, 0xe8, 0xc1, 0xf3 \ +} +#define GUID_TEST_NAME "guid-test" + +#define GUID_VBMETA_A_STRING "A13B4D9A-EC5F-11E8-97D8-6C3BE52705BF" +#define GUID_VBMETA_A_VALUE { \ + 0x9a, 0x4d, 0x3b, 0xa1, \ + 0x5f, 0xec, \ + 0xe8, 0x11, \ + 0x97, 0xd8, 0x6c, 0x3b, 0xe5, 0x27, 0x05, 0xbf \ +} +#define GUID_VBMETA_A_NAME "vbmeta_a" + +#define GUID_VBMETA_B_STRING "A288ABF2-EC5F-11E8-97D8-6C3BE52705BF" +#define GUID_VBMETA_B_VALUE { \ + 0xf2, 0xab, 0x88, 0xa2, \ + 0x5f, 0xec, \ + 0xe8, 0x11, \ + 0x97, 0xd8, 0x6c, 0x3b, 0xe5, 0x27, 0x05, 0xbf \ +} +#define GUID_VBMETA_B_NAME "vbmeta_b" + +#define GUID_VBMETA_R_STRING "6A2460C3-CD11-4E8B-80A8-12CCE268ED0A" +#define GUID_VBMETA_R_VALUE { \ + 0xc3, 0x60, 0x24, 0x6a, \ + 0x11, 0xcd, \ + 0x8b, 0x4e, \ + 0x80, 0xa8, 0x12, 0xcc, 0xe2, 0x68, 0xed, 0x0a \ +} +#define GUID_VBMETA_R_NAME "vbmeta_r" + +#define GUID_ABR_META_STRING "1D75395D-F2C6-476B-A8B7-45CC1C97B476" +#define GUID_ABR_META_VALUE { \ + 0x5d, 0x39, 0x75, 0x1d, \ + 0xc6, 0xf2, \ + 0x6b, 0x47, \ + 0xa8, 0xb7, 0x45, 0xcc, 0x1c, 0x97, 0xb4, 0x76 \ +} +#define GUID_ABR_META_NAME "misc" + +#define GUID_CROS_KERNEL_STRING "FE3A2A5D-4F32-41A7-B725-ACCC3285A309" +#define GUID_CROS_KERNEL_VALUE { \ + 0x5d, 0x2a, 0x3a, 0xfe, \ + 0x32, 0x4f, \ + 0xa7, 0x41, \ + 0xb7, 0x25, 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 \ +} +#define GUID_CROS_KERNEL_NAME "cros-kernel" + +#define GUID_CROS_ROOTFS_STRING "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC" +#define GUID_CROS_ROOTFS_VALUE { \ + 0x02, 0xe2, 0xb8, 0x3C, \ + 0x7e, 0x3b, \ + 0xdd, 0x47, \ + 0x8a, 0x3c, 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec \ +} +#define GUID_CROS_ROOTFS_NAME "cros-rootfs" + +#define GUID_CROS_RESERVED_STRING "2E0A753D-9E48-43B0-8337-B15192CB1B5E" +#define GUID_CROS_RESERVED_VALUE { \ + 0x3d, 0x75, 0x0a, 0x2e, \ + 0x48, 0x9e, \ + 0xb0, 0x43, \ + 0x83, 0x37, 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e \ +} +#define GUID_CROS_RESERVED_NAME "cros-reserved" + +#define GUID_CROS_FIRMWARE_STRING "CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3" +#define GUID_CROS_FIRMWARE_VALUE { \ + 0x8e, 0xe8, 0xb6, 0xca, \ + 0xf3, 0xab, \ + 0x02, 0x41, \ + 0xa0, 0x7a, 0xd4, 0xbb, 0x9b, 0xe3, 0xc1, 0xd3 \ +} +#define GUID_CROS_FIRMWARE_NAME "cros-firmware" + +#define GUID_CROS_DATA_STRING "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" +#define GUID_CROS_DATA_VALUE { \ + 0xa2, 0xa0, 0xd0, 0xeb, \ + 0xe5, 0xb9, \ + 0x33, 0x44, \ + 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 \ +} +#define GUID_CROS_DATA_NAME "cros-data" + +#define GUID_BIOS_STRING "21686148-6449-6E6F-744E-656564454649" +#define GUID_BIOS_VALUE { \ + 0x48, 0x61, 0x68, 0x21, \ + 0x49, 0x64, \ + 0x6f, 0x6e, \ + 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 \ +} +#define GUID_BIOS_NAME "bios" + +#define GUID_EMMC_BOOT1_STRING "900B0FC5-90CD-4D4F-84F9-9F8ED579DB88" +#define GUID_EMMC_BOOT1_VALUE { \ + 0xc5, 0x0f, 0x0b, 0x90, \ + 0xcd, 0x90, \ + 0x4f, 0x4d, \ + 0x84, 0xf9, 0x9f, 0x8e, 0xd5, 0x79, 0xdb, 0x88 \ +} +#define GUID_EMMC_BOOT1_NAME "emmc-boot1" + +#define GUID_EMMC_BOOT2_STRING "B2B2E8D1-7C10-4EBC-A2D0-4614568260AD" +#define GUID_EMMC_BOOT2_VALUE { \ + 0xd1, 0xe8, 0xb2, 0xb2, \ + 0x10, 0x7c, \ + 0xbc, 0x4e, \ + 0xa2, 0xd0, 0x46, 0x14, 0x56, 0x82, 0x60, 0xad \ +} +#define GUID_EMMC_BOOT2_NAME "emmc-boot2" + +#define GUID_LINUX_FILESYSTEM_DATA_STRING "0FC63DAF-8483-4772-8E79-3D69D8477DE4" +#define GUID_LINUX_FILESYSTEM_DATA_VALUE { \ + 0xaf, 0x3d, 0xc6, 0x0f, \ + 0x83, 0x84, \ + 0x72, 0x47, \ + 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4 \ +} +#define GUID_LINUX_FILESYSTEM_DATA_NAME "linux-filesystem" + +// clang-format on + +#endif // SYSROOT_ZIRCON_HW_GPT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/i2c.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/i2c.h new file mode 100644 index 0000000..e35b6f1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/i2c.h
@@ -0,0 +1,10 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_I2C_H_ +#define SYSROOT_ZIRCON_HW_I2C_H_ + +#define I2C_CLASS_HID 1 + +#endif // SYSROOT_ZIRCON_HW_I2C_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/pci.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/pci.h new file mode 100644 index 0000000..7de1bca --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/pci.h
@@ -0,0 +1,50 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_PCI_H_ +#define SYSROOT_ZIRCON_HW_PCI_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// Structure for passing around PCI address information +typedef struct pci_bdf { + uint8_t bus_id; + uint8_t device_id; + uint8_t function_id; +} pci_bdf_t; + +// TODO(cja): This header is used for the transition of these defines from +// kernel to userspace, but due to pci_bdf_t some of the kernel includes it. +// Make sure defines here don't clash with those in pci_common.h by having this +// guard, but remove it after the transition. +#ifndef WITH_KERNEL_PCIE + +#define PCI_MAX_BUSES (256u) +#define PCI_MAX_DEVICES_PER_BUS (32u) +#define PCI_MAX_FUNCTIONS_PER_DEVICE (8u) +#define PCI_MAX_FUNCTIONS_PER_BUS (PCI_MAX_DEVICES_PER_BUS * PCI_MAX_FUNCTIONS_PER_DEVICE) + +#define PCI_STANDARD_CONFIG_HDR_SIZE (64u) +#define PCI_BASE_CONFIG_SIZE (256u) +#define PCIE_EXTENDED_CONFIG_SIZE (4096u) +#define PCIE_ECAM_BYTES_PER_BUS (PCIE_EXTENDED_CONFIG_SIZE * PCI_MAX_FUNCTIONS_PER_BUS) + +#define PCI_BAR_REGS_PER_BRIDGE (2u) +#define PCI_BAR_REGS_PER_DEVICE (6u) +#define PCI_MAX_BAR_REGS (6u) + +#define PCI_MAX_LEGACY_IRQ_PINS (4u) +#define PCI_MAX_MSI_IRQS (32u) +#define PCIE_MAX_MSIX_IRQS (2048u) + +#define PCI_INVALID_VENDOR_ID (0xFFFF) + +#endif // WITH_KERNEL_PCIE + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_PCI_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb.h new file mode 100644 index 0000000..8256c2e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb.h
@@ -0,0 +1,281 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_H_ +#define SYSROOT_ZIRCON_HW_USB_H_ + +// clang-format off + +#include <endian.h> +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// maximum number of endpoints per device +#define USB_MAX_EPS 32 + +/* Request Types */ +#define USB_DIR_OUT (0 << 7) +#define USB_DIR_IN (1 << 7) +#define USB_DIR_MASK (1 << 7) +#define USB_TYPE_STANDARD (0 << 5) +#define USB_TYPE_CLASS (1 << 5) +#define USB_TYPE_VENDOR (2 << 5) +#define USB_TYPE_MASK (3 << 5) +#define USB_RECIP_DEVICE (0 << 0) +#define USB_RECIP_INTERFACE (1 << 0) +#define USB_RECIP_ENDPOINT (2 << 0) +#define USB_RECIP_OTHER (3 << 0) +#define USB_RECIP_MASK (0x1f << 0) + +/* 1.0 Request Values */ +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +#define USB_REQ_SET_FEATURE 0x03 +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIGURATION 0x08 +#define USB_REQ_SET_CONFIGURATION 0x09 +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C + +/* USB device/interface classes */ +#define USB_CLASS_AUDIO 0x01 +#define USB_CLASS_COMM 0x02 +#define USB_CLASS_HID 0x03 +#define USB_CLASS_PHYSICAL 0x05 +#define USB_CLASS_IMAGING 0x06 +#define USB_CLASS_PRINTER 0x07 +#define USB_CLASS_MSC 0x08 +#define USB_CLASS_HUB 0x09 +#define USB_CLASS_CDC 0x0a +#define USB_CLASS_CCID 0x0b +#define USB_CLASS_SECURITY 0x0d +#define USB_CLASS_VIDEO 0x0e +#define USB_CLASS_HEALTHCARE 0x0f +#define USB_CLASS_DIAGNOSTIC 0xdc +#define USB_CLASS_WIRELESS 0xe0 +#define USB_CLASS_MISC 0xef +#define USB_CLASS_APPLICATION_SPECIFIC 0xfe +#define USB_CLASS_VENDOR 0xFf + +#define USB_SUBCLASS_MSC_SCSI 0x06 +#define USB_PROTOCOL_MSC_BULK_ONLY 0x50 + +#define USB_SUBCLASS_DFU 0x01 +#define USB_PROTOCOL_DFU 0x02 + +#define USB_SUBCLASS_VENDOR 0xFF +#define USB_PROTOCOL_TEST_FTDI 0x01 +#define USB_PROTOCOL_TEST_HID_ONE_ENDPOINT 0x02 +#define USB_PROTOCOL_TEST_HID_TWO_ENDPOINT 0x03 + +/* Descriptor Types */ +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 +#define USB_DT_DEVICE_QUALIFIER 0x06 +#define USB_DT_OTHER_SPEED_CONFIG 0x07 +#define USB_DT_INTERFACE_POWER 0x08 +#define USB_DT_INTERFACE_ASSOCIATION 0x0b +#define USB_DT_HID 0x21 +#define USB_DT_HIDREPORT 0x22 +#define USB_DT_HIDPHYSICAL 0x23 +#define USB_DT_CS_INTERFACE 0x24 +#define USB_DT_CS_ENDPOINT 0x25 +#define USB_DT_SS_EP_COMPANION 0x30 +#define USB_DT_SS_ISOCH_EP_COMPANION 0x31 + +/* USB device feature selectors */ +#define USB_DEVICE_SELF_POWERED 0x00 +#define USB_DEVICE_REMOTE_WAKEUP 0x01 +#define USB_DEVICE_TEST_MODE 0x02 + +/* Configuration attributes (bmAttributes) */ +#define USB_CONFIGURATION_REMOTE_WAKEUP 0x20 +#define USB_CONFIGURATION_SELF_POWERED 0x40 +#define USB_CONFIGURATION_RESERVED_7 0x80 // This bit must be set + +/* Endpoint direction (bEndpointAddress) */ +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 +#define USB_ENDPOINT_DIR_MASK 0x80 +#define USB_ENDPOINT_NUM_MASK 0x1F + +/* Endpoint types (bmAttributes) */ +#define USB_ENDPOINT_CONTROL 0x00 +#define USB_ENDPOINT_ISOCHRONOUS 0x01 +#define USB_ENDPOINT_BULK 0x02 +#define USB_ENDPOINT_INTERRUPT 0x03 +#define USB_ENDPOINT_TYPE_MASK 0x03 + +/* Endpoint synchronization type (bmAttributes) */ +#define USB_ENDPOINT_NO_SYNCHRONIZATION 0x00 +#define USB_ENDPOINT_ASYNCHRONOUS 0x04 +#define USB_ENDPOINT_ADAPTIVE 0x08 +#define USB_ENDPOINT_SYNCHRONOUS 0x0C +#define USB_ENDPOINT_SYNCHRONIZATION_MASK 0x0C + +/* Endpoint usage type (bmAttributes) */ +#define USB_ENDPOINT_DATA 0x00 +#define USB_ENDPOINT_FEEDBACK 0x10 +#define USB_ENDPOINT_IMPLICIT_FEEDBACK 0x20 +#define USB_ENDPOINT_USAGE_MASK 0x30 + +#define USB_ENDPOINT_HALT 0x00 + +// Values in this set match those used in XHCI and other parts of the USB specification +#define USB_SPEED_UNDEFINED 0 +#define USB_SPEED_FULL 1 +#define USB_SPEED_LOW 2 +#define USB_SPEED_HIGH 3 +#define USB_SPEED_SUPER 4 +typedef uint32_t usb_speed_t; + +/* general USB defines */ +typedef struct { + uint8_t bmRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} __attribute__ ((packed)) usb_setup_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; +} __attribute__ ((packed)) usb_descriptor_header_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_DEVICE + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; +} __attribute__ ((packed)) usb_device_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CONFIG + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; +} __attribute__ ((packed)) usb_configuration_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_STRING + uint8_t bString[]; +} __attribute__ ((packed)) usb_string_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_INTERFACE + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; +} __attribute__ ((packed)) usb_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_ENDPOINT + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; +} __attribute__ ((packed)) usb_endpoint_descriptor_t; +#define usb_ep_num(ep) ((ep)->bEndpointAddress & USB_ENDPOINT_NUM_MASK) +// usb_ep_num2() useful with you have bEndpointAddress outside of a descriptor. +#define usb_ep_num2(addr) ((addr) & USB_ENDPOINT_NUM_MASK) +#define usb_ep_direction(ep) ((ep)->bEndpointAddress & USB_ENDPOINT_DIR_MASK) +#define usb_ep_type(ep) ((ep)->bmAttributes & USB_ENDPOINT_TYPE_MASK) +#define usb_ep_sync_type(ep) ((ep)->bmAttributes & USB_ENDPOINT_SYNCHRONIZATION_MASK) +// max packet size is in bits 10..0 +#define usb_ep_max_packet(ep) (le16toh((ep)->wMaxPacketSize) & 0x07FF) +// for high speed interrupt and isochronous endpoints, additional transactions per microframe +// are in bits 12..11 +#define usb_ep_add_mf_transactions(ep) ((le16toh((ep)->wMaxPacketSize) >> 11) & 3) + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_DEVICE_QUALIFIER + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint8_t bNumConfigurations; + uint8_t bReserved; +} __attribute__ ((packed)) usb_device_qualifier_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_SS_EP_COMPANION + uint8_t bMaxBurst; + uint8_t bmAttributes; + uint16_t wBytesPerInterval; +} __attribute__ ((packed)) usb_ss_ep_comp_descriptor_t; +#define usb_ss_ep_comp_isoc_mult(ep) ((ep)->bmAttributes & 0x3) +#define usb_ss_ep_comp_isoc_comp(ep) (!!((ep)->bmAttributes & 0x80)) + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_SS_ISOCH_EP_COMPANION + uint16_t wReserved; + uint32_t dwBytesPerInterval; +} __attribute__ ((packed)) usb_ss_isoch_ep_comp_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_INTERFACE_ASSOCIATION + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; +} __attribute__ ((packed)) usb_interface_assoc_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; +} __attribute__ ((packed)) usb_cs_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_STRING + uint16_t wLangIds[127]; +} __attribute__ ((packed)) usb_langid_desc_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_STRING + uint16_t code_points[127]; +} __attribute__ ((packed)) usb_string_desc_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/audio.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/audio.h new file mode 100644 index 0000000..4e68f87 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/audio.h
@@ -0,0 +1,527 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_AUDIO_H_ +#define SYSROOT_ZIRCON_HW_USB_AUDIO_H_ + +// clang-format off + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +//////////////////////////////////////////////////// +// +// General Audio interface constants +// +//////////////////////////////////////////////////// + +// audio interface subclasses +#define USB_SUBCLASS_AUDIO_CONTROL 0x01 +#define USB_SUBCLASS_AUDIO_STREAMING 0x02 +#define USB_SUBCLASS_MIDI_STREAMING 0x03 + +// audio class specific descriptor types +#define USB_AUDIO_CS_DEVICE 0x21 +#define USB_AUDIO_CS_CONFIGURATION 0x22 +#define USB_AUDIO_CS_STRING 0x23 +#define USB_AUDIO_CS_INTERFACE 0x24 +#define USB_AUDIO_CS_ENDPOINT 0x25 + +//////////////////////////////////////////////////// +// +// Audio Control interface constants +// +//////////////////////////////////////////////////// + +// audio class specific AC interface descriptor subtypes +#define USB_AUDIO_AC_HEADER 0x01 +#define USB_AUDIO_AC_INPUT_TERMINAL 0x02 +#define USB_AUDIO_AC_OUTPUT_TERMINAL 0x03 +#define USB_AUDIO_AC_MIXER_UNIT 0x04 +#define USB_AUDIO_AC_SELECTOR_UNIT 0x05 +#define USB_AUDIO_AC_FEATURE_UNIT 0x06 +#define USB_AUDIO_AC_PROCESSING_UNIT 0x07 +#define USB_AUDIO_AC_EXTENSION_UNIT 0x08 + +// processing unit process types +#define USB_AUDIO_UP_DOWN_MIX_PROCESS 0x01 +#define USB_AUDIO_DOLBY_PROLOGIC_PROCESS 0x02 +#define USB_AUDIO_3D_STEREO_EXTENDER_PROCESS 0x03 +#define USB_AUDIO_REVERBERATION_PROCESS 0x04 +#define USB_AUDIO_CHORUS_PROCESS 0x05 +#define USB_AUDIO_DYN_RANGE_COMP_PROCESS 0x06 + +// audio class specific endpoint descriptor subtypes +#define USB_AUDIO_EP_GENERAL 0x01 + +// audio class specific request codes +#define USB_AUDIO_SET_CUR 0x01 +#define USB_AUDIO_GET_CUR 0x81 +#define USB_AUDIO_SET_MIN 0x02 +#define USB_AUDIO_GET_MIN 0x82 +#define USB_AUDIO_SET_MAX 0x03 +#define USB_AUDIO_GET_MAX 0x83 +#define USB_AUDIO_SET_RES 0x04 +#define USB_AUDIO_GET_RES 0x84 +#define USB_AUDIO_SET_MEM 0x05 +#define USB_AUDIO_GET_MEM 0x85 +#define USB_AUDIO_GET_STAT 0xFF + +// terminal control selectors +#define USB_AUDIO_COPY_PROTECT_CONTROL 0x01 + +// feature unit control selectors +#define USB_AUDIO_MUTE_CONTROL 0x01 +#define USB_AUDIO_VOLUME_CONTROL 0x02 +#define USB_AUDIO_BASS_CONTROL 0x03 +#define USB_AUDIO_MID_CONTROL 0x04 +#define USB_AUDIO_TREBLE_CONTROL 0x05 +#define USB_AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06 +#define USB_AUDIO_AUTOMATIC_GAIN_CONTROL 0x07 +#define USB_AUDIO_DELAY_CONTROL 0x08 +#define USB_AUDIO_BASS_BOOST_CONTROL 0x09 +#define USB_AUDIO_LOUDNESS_CONTROL 0x0A + +// feature unit control support bitmasks +#define USB_AUDIO_FU_BMA_MUTE (1u << 0u) +#define USB_AUDIO_FU_BMA_VOLUME (1u << 1u) +#define USB_AUDIO_FU_BMA_BASS (1u << 2u) +#define USB_AUDIO_FU_BMA_MID (1u << 3u) +#define USB_AUDIO_FU_BMA_TREBLE (1u << 4u) +#define USB_AUDIO_FU_BMA_GRAPHIC_EQUALIZER (1u << 5u) +#define USB_AUDIO_FU_BMA_AUTOMATIC_GAIN (1u << 6u) +#define USB_AUDIO_FU_BMA_DELAY (1u << 7u) +#define USB_AUDIO_FU_BMA_BASS_BOOST (1u << 8u) +#define USB_AUDIO_FU_BMA_LOUDNESS (1u << 9u) + +// up/down mix processing unit control selectors +#define USB_AUDIO_UD_ENABLE_CONTROL 0x01 +#define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02 +#define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02 + +// Dolby Prologic processing unit control selectors +#define USB_AUDIO_DP_ENABLE_CONTROL 0x01 +#define USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02 + +// 3D stereo extender processing unit control selectors +#define USB_AUDIO_3D_ENABLE_CONTROL 0x01 +#define USB_AUDIO_SPACIOUSNESS_CONTROL 0x03 + +// reverberation processing unit control selectors +#define USB_AUDIO_RV_ENABLE_CONTROL 0x01 +#define USB_AUDIO_REVERB_LEVEL_CONTROL 0x02 +#define USB_AUDIO_REVERB_TIME_CONTROL 0x03 +#define USB_AUDIO_REVERB_FEEDBACK_CONTROL 0x04 + +// chorus processing unit control selectors +#define USB_AUDIO_CH_ENABLE_CONTROL 0x01 +#define USB_AUDIO_CHORUS_LEVEL_CONTROL 0x02 +#define USB_AUDIO_CHORUS_RATE_CONTROL 0x03 +#define USB_AUDIO_CHORUS_DEPTH_CONTROL 0x04 + +// dynamic range compressor processing unit control selectors +#define USB_AUDIO_DR_ENABLE_CONTROL 0x01 +#define USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02 +#define USB_AUDIO_MAXAMPL_CONTROL 0x03 +#define USB_AUDIO_THRESHOLD_CONTROL 0x04 +#define USB_AUDIO_ATTACK_TIME 0x05 +#define USB_AUDIO_RELEASE_TIME 0x06 + +// extension unit control selectors +#define USB_AUDIO_XU_ENABLE_CONTROL 0x01 + +// endpoint control selectors +#define USB_AUDIO_SAMPLING_FREQ_CONTROL 0x01 +#define USB_AUDIO_PITCH_CONTROL 0x02 + +// USB audio terminal types +#define USB_AUDIO_TERMINAL_USB_UNDEFINED 0x0100 +#define USB_AUDIO_TERMINAL_USB_STREAMING 0x0101 +#define USB_AUDIO_TERMINAL_USB_VENDOR 0x01FF +#define USB_AUDIO_TERMINAL_INPUT_UNDEFINED 0x0200 +#define USB_AUDIO_TERMINAL_MICROPHONE 0x0201 +#define USB_AUDIO_TERMINAL_DESKTOP_MICROPHONE 0x0202 +#define USB_AUDIO_TERMINAL_PERSONAL_MICROPHONE 0x0203 +#define USB_AUDIO_TERMINAL_OMNI_DIRECTIONAL_MICROPHONE 0x0204 +#define USB_AUDIO_TERMINAL_MICROPHONE_ARRAY 0x0205 +#define USB_AUDIO_TERMINAL_PROCESSING_MICROPHONE_ARRAY 0x0206 +#define USB_AUDIO_TERMINAL_OUTPUT_UNDEFINED 0x0300 +#define USB_AUDIO_TERMINAL_SPEAKER 0x0301 +#define USB_AUDIO_TERMINAL_HEADPHONES 0x0302 +#define USB_AUDIO_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x0303 +#define USB_AUDIO_TERMINAL_DESKTOP_SPEAKER 0x0304 +#define USB_AUDIO_TERMINAL_ROOM_SPEAKER 0x0305 +#define USB_AUDIO_TERMINAL_COMMUNICATION_SPEAKER 0x0306 +#define USB_AUDIO_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x0307 +#define USB_AUDIO_TERMINAL_BIDIRECTIONAL_UNDEFINED 0x0400 +#define USB_AUDIO_TERMINAL_HANDSET 0x0401 +#define USB_AUDIO_TERMINAL_HEADSET 0x0402 +#define USB_AUDIO_TERMINAL_SPEAKERPHONE 0x0403 +#define USB_AUDIO_TERMINAL_ECHO_SUPPRESSING_SPEAKERPHONE 0x0404 +#define USB_AUDIO_TERMINAL_ECHO_CANCELING_SPEAKERPHONE 0x0405 +#define USB_AUDIO_TERMINAL_TELEPHONY_UNDEFINED 0x0500 +#define USB_AUDIO_TERMINAL_PHONE_LINE 0x0501 +#define USB_AUDIO_TERMINAL_TELEPHONE 0x0502 +#define USB_AUDIO_TERMINAL_DOWN_LINE_PHONE 0x0503 +#define USB_AUDIO_TERMINAL_EXTERNAL_UNDEFINED 0x0600 +#define USB_AUDIO_TERMINAL_ANALOG_CONNECTOR 0x0601 +#define USB_AUDIO_TERMINAL_DIGITAL_AUDIO_INTERFACE 0x0602 +#define USB_AUDIO_TERMINAL_LINE_CONNECTOR 0x0603 +#define USB_AUDIO_TERMINAL_LEGACY_AUDIO_CONNECTOR 0x0604 +#define USB_AUDIO_TERMINAL_SPDIF_INTERFACE 0x0605 +#define USB_AUDIO_TERMINAL_1394_DA_STREAM 0x0606 +#define USB_AUDIO_TERMINAL_1394_DV_STREAM_SOUNDTRACK 0x0607 +#define USB_AUDIO_TERMINAL_EMBEDDED_UNDEFINED 0x0700 +#define USB_AUDIO_TERMINAL_LEVEL_CALIBRATION_NOISE_SOURCE 0x0701 +#define USB_AUDIO_TERMINAL_EQUALIZATION_NOISE 0x0702 +#define USB_AUDIO_TERMINAL_CD_PLAYER 0x0703 +#define USB_AUDIO_TERMINAL_DAT 0x0704 +#define USB_AUDIO_TERMINAL_DCC 0x0705 +#define USB_AUDIO_TERMINAL_MINI_DISK 0x0706 +#define USB_AUDIO_TERMINAL_ANALOG_TAPE 0x0707 +#define USB_AUDIO_TERMINAL_PHONOGRAPH 0x0708 +#define USB_AUDIO_TERMINAL_VCR_AUDIO 0x0709 +#define USB_AUDIO_TERMINAL_VIDEO_DISK_AUDIO 0x070A +#define USB_AUDIO_TERMINAL_DVD_AUDIO 0x070B +#define USB_AUDIO_TERMINAL_TV_TUNER_AUDIO 0x070C +#define USB_AUDIO_TERMINAL_SATELLITE_RECEIVER_AUDIO 0x070D +#define USB_AUDIO_TERMINAL_CABLE_TUNER_AUDIO 0x070E +#define USB_AUDIO_TERMINAL_DSS_AUDIO 0x070F +#define USB_AUDIO_TERMINAL_RADIO_RECEIVER 0x0710 +#define USB_AUDIO_TERMINAL_RADIO_TRANSMITTER 0x0711 +#define USB_AUDIO_TERMINAL_MULTI_TRACK_RECORDER 0x0712 +#define USB_AUDIO_TERMINAL_SYNTHESIZER 0x0713 + +//////////////////////////////////////////////////// +// +// Audio streaming interface constants +// +//////////////////////////////////////////////////// + +// Audio stream class-specific AS interface descriptor subtypes +#define USB_AUDIO_AS_GENERAL 0x01 +#define USB_AUDIO_AS_FORMAT_TYPE 0x02 +#define USB_AUDIO_AS_FORMAT_SPECIFIC 0x03 + +// wFormatTag values present in the class specific AS header +// Defined in Section A.1 of USB Device Class Definition for Audio Data Formats +#define USB_AUDIO_AS_FT_TYPE_I_UNDEFINED 0x0000 +#define USB_AUDIO_AS_FT_PCM 0x0001 +#define USB_AUDIO_AS_FT_PCM8 0x0002 +#define USB_AUDIO_AS_FT_IEEE_FLOAT 0x0003 +#define USB_AUDIO_AS_FT_ALAW 0x0004 +#define USB_AUDIO_AS_FT_MULAW 0x0005 +#define USB_AUDIO_AS_FT_TYPE_II_UNDEFINED 0x1000 +#define USB_AUDIO_AS_FT_MPEG 0x1001 +#define USB_AUDIO_AS_FT_AC3 0x1002 +#define USB_AUDIO_AS_FT_TYPE_III_UNDEFINED 0x2000 +#define USB_AUDIO_AS_FT_IEC1937_AC3 0x2001 +#define USB_AUDIO_AS_FT_IEC1937_MPEG1_L1 0x2002 +#define USB_AUDIO_AS_FT_IEC1937_MPEG1_L23 0x2003 +#define USB_AUDIO_AS_FT_IEC1937_MPEG2_EXT 0x2004 +#define USB_AUDIO_AS_FT_IEC1937_MPEG2_L1_LS 0x2005 +#define USB_AUDIO_AS_FT_IEC1937_MPEG2_L23_LS 0x2006 + +// Audio stream class-specific format-specific types +#define USB_AUDIO_FORMAT_TYPE_UNDEFINED 0x00 +#define USB_AUDIO_FORMAT_TYPE_I 0x01 +#define USB_AUDIO_FORMAT_TYPE_II 0x02 +#define USB_AUDIO_FORMAT_TYPE_III 0x03 + +//////////////////////////////////////////////////// +// +// MIDI streaming interface constants +// +//////////////////////////////////////////////////// + +// MIDI class specific MS interface descriptor subtypes +#define USB_MIDI_MS_HEADER 0x01 +#define USB_MIDI_IN_JACK 0x02 +#define USB_MIDI_OUT_JACK 0x03 +#define USB_MIDI_ELEMENT 0x04 + +// MIDI class specific MS endpoint descriptor subtypes +#define USB_MIDI_MS_GENERAL 0x01 + +// MIDI IN and OUT jack types +#define USB_MIDI_JACK_EMBEDDED 0x01 +#define USB_MIDI_JACK_INTERNAL 0x02 + +// MIDI endpoint control selectors +#define USB_MIDI_ASSOCIATION_CONTROL 0x01 + + +// Top level header structure shared by all USB audio descriptors. +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; +} __PACKED usb_audio_desc_header; + +// Audio Control Interface descriptor definitions +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_HEADER + uint16_t bcdADC; + uint16_t wTotalLength; + uint8_t bInCollection; + uint8_t baInterfaceNr[]; +} __PACKED usb_audio_ac_header_desc; + +// Common header structure shared by all unit and terminal descriptors found in +// an Audio Control interface descriptor. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_.*_(TERMINAL|UNIT) + uint8_t bID; +} __PACKED usb_audio_ac_ut_desc; + +// Common header structure shared by all terminal descriptors found in an Audio +// Control interface descriptor. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_(INPUT|OUTPUT)_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; +} __PACKED usb_audio_ac_terminal_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_INPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t iTerminal; +} __PACKED usb_audio_ac_input_terminal_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_OUTPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t bSourceID; + uint8_t iTerminal; +} __PACKED usb_audio_ac_output_terminal_desc; + +// Note: Mixer unit descriptors contain two inlined variable length arrays, each +// with descriptor data following them. They are therefor described using 3 +// structure definitions which are logically concatenated, but separated by the +// inline arrays. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_MIXER_UNIT + uint8_t bUnitID; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_mixer_unit_desc_0; + +typedef struct { + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t bmControls[]; +} __PACKED usb_audio_ac_mixer_unit_desc_1; + +typedef struct { + uint8_t iMixer; +} __PACKED usb_audio_ac_mixer_unit_desc_2; + +// Note: Selector unit descriptors contain an inlined variable length array with +// descriptor data following it. They are therefor described using 2 structure +// definitions which are logically concatenated, but separated by the inline +// array. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_SELECTOR_UNIT + uint8_t bUnitID; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_selector_unit_desc_0; + +typedef struct { + uint8_t iSelector; +} __PACKED usb_audio_ac_selector_unit_desc_1; + +// Note: Feature unit descriptors contain an inlined variable length array with +// descriptor data following it. They are therefor described using 2 structure +// definitions which are logically concatenated, but separated by the inline +// array. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_FEATURE_UNIT + uint8_t bUnitID; + uint8_t bSourceID; + uint8_t bControlSize; + uint8_t bmaControls[]; +} __PACKED usb_audio_ac_feature_unit_desc_0; + +typedef struct { + uint8_t iFeature; +} __PACKED usb_audio_ac_feature_unit_desc_1; + +// Note: Processing unit descriptors contain two inlined variable length arrays, +// each with descriptor data following them. They are therefor described using +// 3 structure definitions which are logically concatenated, but separated by +// the inline arrays. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_PROCESSING_UNIT + uint8_t bUnitID; + uint16_t wProcessType; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_processing_unit_desc_0; + +typedef struct { + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t bControlSize; + uint8_t bmControls[]; +} __PACKED usb_audio_ac_processing_unit_desc_1; + +typedef struct { + uint8_t iProcessing; + // Note: The Process-specific control structure follows this with the + // structure type determined by wProcessType + // TODO(johngro) : Define the process specific control structures. As of + // the 1.0 revision of the USB audio spec, the types to be defined are... + // + // ** Up/Down-mix + // ** Dolby Prologic + // ** 3D-Stereo Extender + // ** Reverberation + // ** Chorus + // ** Dynamic Range Compressor +} __PACKED usb_audio_ac_processing_unit_desc_2; + +// Note: Extension unit descriptors contain two inlined variable length arrays, +// each with descriptor data following them. They are therefor described using +// 3 structure definitions which are logically concatenated, but separated by +// the inline arrays. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_EXTENSION_UNIT + uint8_t bUnitID; + uint16_t wExtensionCode; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_extension_unit_desc_0; + +typedef struct { + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t bControlSize; + uint8_t bmControls[]; +} __PACKED usb_audio_ac_extension_unit_desc_1; + +typedef struct { + uint8_t iExtension; +} __PACKED usb_audio_ac_extension_unit_desc_2; + +// Audio Streaming Interface descriptor definitions +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AS_GENERAL + uint8_t bTerminalLink; + uint8_t bDelay; + uint16_t wFormatTag; +} __PACKED usb_audio_as_header_desc; + +typedef struct { + uint8_t freq[3]; // 24 bit unsigned integer, little-endian +} __PACKED usb_audio_as_samp_freq; + +// Common header used by all format type descriptors +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AS_FORMAT_TYPE + uint8_t bFormatType; +} __PACKED usb_audio_as_format_type_hdr; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AS_FORMAT_TYPE + uint8_t bFormatType; // USB_AUDIO_FORMAT_TYPE_I + uint8_t bNrChannels; + uint8_t bSubFrameSize; + uint8_t bBitResolution; + uint8_t bSamFreqType; // number of sampling frequencies + usb_audio_as_samp_freq tSamFreq[]; // list of sampling frequencies (3 bytes each) +} __PACKED usb_audio_as_format_type_i_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_ENDPOINT + uint8_t bDescriptorSubtype; // USB_AUDIO_EP_GENERAL + uint8_t bmAttributes; + uint8_t bLockDelayUnits; + uint16_t wLockDelay; +} __PACKED usb_audio_as_isoch_ep_desc; + +// MIDI Streaming Interface descriptor definitions +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_MIDI_MS_HEADER + uint16_t bcdMSC; + uint16_t wTotalLength; +} __PACKED usb_midi_ms_header_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_MIDI_IN_JACK + uint8_t bJackType; + uint8_t bJackID; + uint8_t iJack; +} __PACKED usb_midi_ms_in_jack_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_MIDI_OUT_JACK + uint8_t bJackType; + uint8_t bJackID; + uint8_t bNrInputPins; + uint8_t baSourceID; + uint8_t baSourcePin; +} __PACKED usb_midi_ms_out_jack_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_ENDPOINT + uint8_t bDescriptorSubtype; // USB_MIDI_MS_GENERAL + uint8_t bNumEmbMIDIJack; + uint8_t baAssocJackID[]; +} __PACKED usb_midi_ms_endpoint_desc; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_AUDIO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/cdc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/cdc.h new file mode 100644 index 0000000..67ac8c7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/cdc.h
@@ -0,0 +1,150 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_CDC_H_ +#define SYSROOT_ZIRCON_HW_USB_CDC_H_ + +#include <stdint.h> + +// clang-format off + +#include <zircon/compiler.h> + +/* CDC Subclasses for the Communications Interface Class */ +#define USB_CDC_SUBCLASS_DIRECT_LINE 0x01 +#define USB_CDC_SUBCLASS_ABSTRACT 0x02 +#define USB_CDC_SUBCLASS_TELEPHONE 0x03 +#define USB_CDC_SUBCLASS_MULTI_CHANNEL 0x04 +#define USB_CDC_SUBCLASS_CAPI 0x05 +#define USB_CDC_SUBCLASS_ETHERNET 0x06 +#define USB_CDC_SUBCLASS_ATM 0x07 +#define USB_CDC_SUBCLASS_WIRELESS_HANDSET 0x08 +#define USB_CDC_SUBCLASS_DEVICE_MGMT 0x09 +#define USB_CDC_SUBCLASS_MOBILE_DIRECT 0x0A +#define USB_CDC_SUBCLASS_OBEX 0x0B +#define USB_CDC_SUBCLASS_ETHERNET_EMU 0x0C +#define USB_CDC_SUBCLASS_NETWORK_CTRL 0x0D + +/* CDC Descriptor SubTypes */ +#define USB_CDC_DST_HEADER 0x00 +#define USB_CDC_DST_CALL_MGMT 0x01 +#define USB_CDC_DST_ABSTRACT_CTRL_MGMT 0x02 +#define USB_CDC_DST_DIRECT_LINE_MGMT 0x03 +#define USB_CDC_DST_TELEPHONE_RINGER 0x04 +#define USB_CDC_DST_TELEPHONE_CALL_REPORTING 0x05 +#define USB_CDC_DST_UNION 0x06 +#define USB_CDC_DST_COUNTRY_SELECTION 0x07 +#define USB_CDC_DST_TELEPHONE_OP_MODES 0x08 +#define USB_CDC_DST_USB_TERMINAL 0x09 +#define USB_CDC_DST_NETWORK_CHANNEL 0x0A +#define USB_CDC_DST_PROTOCOL_UNIT 0x0B +#define USB_CDC_DST_EXTENSION_UNIT 0x0C +#define USB_CDC_DST_MULTI_CHANNEL_MGMT 0x0D +#define USB_CDC_DST_CAPI_CTRL_MGMT 0x0E +#define USB_CDC_DST_ETHERNET 0x0F +#define USB_CDC_DST_ATM_NETWORKING 0x10 +#define USB_CDC_DST_WIRELESS_HANDSET_CTRL 0x11 +#define USB_CDC_DST_MOBILE_DIRECT_LINE 0x12 +#define USB_CDC_DST_MDLM_DETAIL 0x13 +#define USB_CDC_DST_DEVICE_MGMT 0x14 +#define USB_CDC_DST_OBEX 0x15 +#define USB_CDC_DST_COMMAND_SET 0x16 +#define USB_CDC_DST_COMMAND_SET_DETAIL 0x17 +#define USB_CDC_DST_TELEPHONE_CTRL 0x18 +#define USB_CDC_DST_OBEX_SERVICE_ID 0x19 +#define USB_CDC_DST_NCM 0x1A + +/* CDC Class-Specific Notification Codes */ +#define USB_CDC_NC_NETWORK_CONNECTION 0x00 +#define USB_CDC_NC_RESPONSE_AVAILABLE 0x01 +#define USB_CDC_NC_SERIAL_STATE 0x20 +#define USB_CDC_NC_CONNECTION_SPEED_CHANGE 0x2A + +/* CDC Ethernet Class-Specific Request Codes */ +#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 +#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 +#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 +#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 +#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 + +/* CDC Ethernet Packet Filter Modes Bits */ +#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) +#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) +#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) +#define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) +#define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) + +/* CDC Class-Specific Requests */ +#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 +#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 + +__BEGIN_CDECLS + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_HEADER + uint16_t bcdCDC; +} __attribute__ ((packed)) usb_cs_header_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_CALL_MGMT + uint8_t bmCapabilities; + uint8_t bDataInterface; +} __attribute__ ((packed)) usb_cs_call_mgmt_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_ABSTRACT_CTRL_MGMT + uint8_t bmCapabilities; +} __attribute__ ((packed)) usb_cs_abstract_ctrl_mgmt_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_UNION + uint8_t bControlInterface; + uint8_t bSubordinateInterface[]; +} __attribute__ ((packed)) usb_cs_union_interface_descriptor_t; + +// fixed size version of usb_cs_union_interface_descriptor_t +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_UNION + uint8_t bControlInterface; + uint8_t bSubordinateInterface; +} __attribute__ ((packed)) usb_cs_union_interface_descriptor_1_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_ETHERNET + uint8_t iMACAddress; + uint32_t bmEthernetStatistics; + uint16_t wMaxSegmentSize; + uint16_t wNumberMCFilters; + uint8_t bNumberPowerFilters; +} __attribute__ ((packed)) usb_cs_ethernet_interface_descriptor_t; + +typedef struct { + uint8_t bmRequestType; + uint8_t bNotification; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} __attribute__ ((packed)) usb_cdc_notification_t; + +typedef struct { + usb_cdc_notification_t notification; + uint32_t downlink_br; + uint32_t uplink_br; + } __attribute__ ((packed)) usb_cdc_speed_change_notification_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_CDC_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/dfu.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/dfu.h new file mode 100644 index 0000000..7ca40f0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/dfu.h
@@ -0,0 +1,82 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_DFU_H_ +#define SYSROOT_ZIRCON_HW_USB_DFU_H_ + +// clang-format off + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// USB DFU Spec, Rev 1.1 + +// DFU Class-Specific Request Values +// Table 3.2 +#define USB_DFU_DETACH 0x00 +#define USB_DFU_DNLOAD 0x01 +#define USB_DFU_UPLOAD 0x02 +#define USB_DFU_GET_STATUS 0x03 +#define USB_DFU_CLR_STATUS 0x04 +#define USB_DFU_GET_STATE 0x05 +#define USB_DFU_ABORT 0x06 + +// DFU Class-Specific Descriptor Types +// Table 4.1.3 +#define USB_DFU_CS_FUNCTIONAL 0x21 + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DFU_CS_FUNCTIONAL + uint8_t bmAttributes; + uint16_t wDetachTimeOut; + uint16_t wTransferSize; + uint16_t bcdDFUVersion; +} __PACKED usb_dfu_func_desc_t; + +// DFU_GET_STATUS Response +// Section 6.1.2 +typedef struct { + uint8_t bStatus; + uint8_t bwPollTimeout[3]; // 24 bit unsigned integer + uint8_t bState; + uint8_t bString; +} __PACKED usb_dfu_get_status_data_t; + +// DFU Device Status Values +#define USB_DFU_STATUS_OK 0x00 +#define USB_DFU_STATUS_ERR_TARGET 0x01 +#define USB_DFU_STATUS_ERR_FILE 0x02 +#define USB_DFU_STATUS_ERR_WRITE 0x03 +#define USB_DFU_STATUS_ERR_ERASE 0x04 +#define USB_DFU_STATUS_ERR_CHECK_ERASED 0x05 +#define USB_DFU_STATUS_ERR_PROG 0x06 +#define USB_DFU_STATUS_ERR_VERIFY 0x07 +#define USB_DFU_STATUS_ERR_ADDRESS 0x08 +#define USB_DFU_STATUS_ERR_NOT_DONE 0x09 +#define USB_DFU_STATUS_ERR_FIRMWARE 0x0A +#define USB_DFU_STATUS_ERR_VENDOR 0x0B +#define USB_DFU_STATUS_ERR_USER 0x0C +#define USB_DFU_STATUS_ERR_POR 0x0D +#define USB_DFU_STATUS_ERR_UNKNOWN 0x0E +#define USB_DFU_STATUS_ERR_STALLED_PKT 0x0F + +// DFU Device State Values +#define USB_DFU_STATE_APP_IDLE 0x00 +#define USB_DFU_STATE_APP_DETACH 0x01 +#define USB_DFU_STATE_DFU_IDLE 0x02 +#define USB_DFU_STATE_DFU_DNLOAD_SYNC 0x03 +#define USB_DFU_STATE_DFU_DNBUSY 0x04 +#define USB_DFU_STATE_DFU_DNLOAD_IDLE 0x05 +#define USB_DFU_STATE_DFU_MANIFEST_SYNC 0x06 +#define USB_DFU_STATE_DFU_MANIFEST 0x07 +#define USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET 0x08 +#define USB_DFU_STATE_DFU_UPLOAD_IDLE 0x09 +#define USB_DFU_STATE_DFU_ERROR 0x0A + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_DFU_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/hid.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/hid.h new file mode 100644 index 0000000..97dea4e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/hid.h
@@ -0,0 +1,46 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_HID_H_ +#define SYSROOT_ZIRCON_HW_USB_HID_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// clang-format off + +// HID Request Values. +#define USB_HID_GET_REPORT 0x01 +#define USB_HID_GET_IDLE 0x02 +#define USB_HID_GET_PROTOCOL 0x03 +#define USB_HID_SET_REPORT 0x09 +#define USB_HID_SET_IDLE 0x0A +#define USB_HID_SET_PROTOCOL 0x0B + +// HID USB protocols +#define USB_HID_PROTOCOL_KBD 0x01 +#define USB_HID_PROTOCOL_MOUSE 0x02 +#define USB_HID_SUBCLASS_BOOT 0x01 + +// clang-format on + +typedef struct { + uint8_t bDescriptorType; + uint16_t wDescriptorLength; +} __attribute__((packed)) usb_hid_descriptor_entry_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + usb_hid_descriptor_entry_t descriptors[]; +} __attribute__((packed)) usb_hid_descriptor_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_HID_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/hub.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/hub.h new file mode 100644 index 0000000..10ed110 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/hub.h
@@ -0,0 +1,120 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_HUB_H_ +#define SYSROOT_ZIRCON_HW_USB_HUB_H_ + +#include <zircon/compiler.h> +#include <zircon/types.h> + +// clang-format off + +__BEGIN_CDECLS + +// Hub request types +#define USB_RECIP_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) +#define USB_RECIP_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) + +// Hub requests +#define USB_HUB_SET_DEPTH 12 + +// Hub descriptor types +#define USB_HUB_DESC_TYPE 0x29 +#define USB_HUB_DESC_TYPE_SS 0x2A // for superspeed hubs + +// Hub Class Feature Selectors (USB 2.0 spec Table 11.17) +#define USB_FEATURE_C_HUB_LOCAL_POWER 0 +#define USB_FEATURE_C_HUB_OVER_CURRENT 1 +#define USB_FEATURE_PORT_CONNECTION 0 +#define USB_FEATURE_PORT_ENABLE 1 +#define USB_FEATURE_PORT_SUSPEND 2 +#define USB_FEATURE_PORT_OVER_CURRENT 3 +#define USB_FEATURE_PORT_RESET 4 +#define USB_FEATURE_PORT_LINK_STATE 5 +#define USB_FEATURE_PORT_POWER 8 +#define USB_FEATURE_PORT_LOW_SPEED 9 +#define USB_FEATURE_C_PORT_CONNECTION 16 +#define USB_FEATURE_C_PORT_ENABLE 17 +#define USB_FEATURE_C_PORT_SUSPEND 18 +#define USB_FEATURE_C_PORT_OVER_CURRENT 19 +#define USB_FEATURE_C_PORT_RESET 20 +#define USB_FEATURE_PORT_TEST 21 +#define USB_FEATURE_PORT_INDICATOR 22 +#define USB_FEATURE_PORT_INDICATOR 22 +#define USB_FEATURE_PORT_U1_TIMEOUT 23 +#define USB_FEATURE_PORT_U2_TIMEOUT 24 +#define USB_FEATURE_C_PORT_LINK_STATE 25 +#define USB_FEATURE_C_PORT_CONFIG_ERROR 26 +#define USB_FEATURE_PORT_REMOTE_WAKE_MASK 27 +#define USB_FEATURE_BH_PORT_RESET 28 +#define USB_FEATURE_C_BH_PORT_RESET 29 +#define USB_FEATURE_FORCE_LINKPM_ACCEPT 30 + +typedef struct { + uint8_t bDescLength; + uint8_t bDescriptorType; + uint8_t bNbrPorts; + uint16_t wHubCharacteristics; + uint8_t bPowerOn2PwrGood; + uint8_t bHubContrCurrent; + union { + // USB 2.0 + struct { + // variable length depending on number of ports + uint8_t DeviceRemovable[4]; + uint8_t PortPwrCtrlMask[4]; + } __attribute__ ((packed)) hs; + // USB 3.0 + struct { + uint8_t bHubHdrDecLat; + uint16_t wHubDelay; + uint16_t DeviceRemovable; + } __attribute__ ((packed)) ss; + } __attribute__ ((packed)); +} __attribute__ ((packed)) usb_hub_descriptor_t; + +typedef struct { + uint16_t wHubStatus; + uint16_t wHubChange; +} __attribute__ ((packed)) usb_hub_status_t; + +// wHubStatus bits +#define USB_HUB_LOCAL_POWER (1 << 0) +#define USB_HUB_OVER_CURRENT (1 << 1) + +typedef struct { + uint16_t wPortStatus; + uint16_t wPortChange; +} __attribute__ ((packed)) usb_port_status_t; + +// Port Status bits +#define USB_PORT_CONNECTION (1 << 0) +#define USB_PORT_ENABLE (1 << 1) +#define USB_PORT_SUSPEND (1 << 2) // USB 2.0 only +#define USB_PORT_OVER_CURRENT (1 << 3) +#define USB_PORT_RESET (1 << 4) +#define USB_PORT_POWER (1 << 8) // USB 2.0 only +#define USB_PORT_LOW_SPEED (1 << 9) // USB 2.0 only +#define USB_PORT_HIGH_SPEED (1 << 10) // USB 2.0 only +#define USB_PORT_TEST_MODE (1 << 11) // USB 2.0 only +#define USB_PORT_INDICATOR_CONTROL (1 << 12) // USB 2.0 only + +// Port Status Changed bits +#define USB_C_PORT_CONNECTION (1 << 0) +#define USB_C_PORT_ENABLE (1 << 1) // USB 2.0 only +#define USB_C_PORT_SUSPEND (1 << 2) // USB 2.0 only +#define USB_C_PORT_OVER_CURRENT (1 << 3) +#define USB_C_PORT_RESET (1 << 4) +#define USB_C_BH_PORT_RESET (1 << 5) // USB 3.0 only +#define USB_C_PORT_LINK_STATE (1 << 6) // USB 3.0 only +#define USB_C_PORT_CONFIG_ERROR (1 << 7) // USB 3.0 only +#define USB_C_PORT_POWER (1 << 8) // USB 2.0 only +#define USB_C_PORT_LOW_SPEED (1 << 9) // USB 2.0 only +#define USB_C_PORT_HIGH_SPEED (1 << 10) // USB 2.0 only +#define USB_C_PORT_TEST_MODE (1 << 11) // USB 2.0 only +#define USB_C_PORT_INDICATOR_CONTROL (1 << 12) // USB 2.0 only + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_HUB_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/ums.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/ums.h new file mode 100644 index 0000000..6640803 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/ums.h
@@ -0,0 +1,159 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_UMS_H_ +#define SYSROOT_ZIRCON_HW_USB_UMS_H_ + +// clang-format off + +// SCSI commands +#define UMS_TEST_UNIT_READY 0x00 +#define UMS_REQUEST_SENSE 0x03 +#define UMS_INQUIRY 0x12 +#define UMS_MODE_SELECT6 0x15 +#define UMS_MODE_SENSE6 0x1A +#define UMS_START_STOP_UNIT 0x1B +#define UMS_TOGGLE_REMOVABLE 0x1E +#define UMS_READ_FORMAT_CAPACITIES 0x23 +#define UMS_READ_CAPACITY10 0x25 +#define UMS_READ10 0x28 +#define UMS_WRITE10 0x2A +#define UMS_SYNCHRONIZE_CACHE 0x35 +#define UMS_MODE_SELECT10 0x55 +#define UMS_MODE_SENSE10 0x5A +#define UMS_READ16 0x88 +#define UMS_WRITE16 0x8A +#define UMS_READ_CAPACITY16 0x9E +#define UMS_READ12 0xA8 +#define UMS_WRITE12 0xAA + +// control request values +#define USB_REQ_RESET 0xFF +#define USB_REQ_GET_MAX_LUN 0xFE + +// error codes for CSW processing +typedef uint32_t csw_status_t; +#define CSW_SUCCESS ((csw_status_t)0) +#define CSW_FAILED ((csw_status_t)1) +#define CSW_PHASE_ERROR ((csw_status_t)2) +#define CSW_INVALID ((csw_status_t)3) +#define CSW_TAG_MISMATCH ((csw_status_t)4) + +// signatures in header and status +#define CBW_SIGNATURE 0x43425355 +#define CSW_SIGNATURE 0x53425355 + +// transfer lengths +#define UMS_INQUIRY_TRANSFER_LENGTH 0x24 +#define UMS_REQUEST_SENSE_TRANSFER_LENGTH 0x12 +#define UMS_READ_FORMAT_CAPACITIES_TRANSFER_LENGTH 0xFC + +// 6 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint16_t lba; // logical block address + uint8_t length; + uint8_t control; +} __PACKED scsi_command6_t; +static_assert(sizeof(scsi_command6_t) == 6, ""); + +// 10 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint32_t lba; // logical block address + uint8_t misc2; + uint8_t length_hi; // break length into two pieces to avoid odd alignment + uint8_t length_lo; + uint8_t control; +} __PACKED scsi_command10_t; +static_assert(sizeof(scsi_command10_t) == 10, ""); + +// 12 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint32_t lba; // logical block address + uint32_t length; + uint8_t misc2; + uint8_t control; +} __PACKED scsi_command12_t; +static_assert(sizeof(scsi_command12_t) == 12, ""); + +// 16 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint64_t lba; // logical block address + uint32_t length; + uint8_t misc2; + uint8_t control; +} __PACKED scsi_command16_t; +static_assert(sizeof(scsi_command16_t) == 16, ""); + +// SCSI Read Capacity 10 payload +// This is big endian +typedef struct { + uint32_t lba; + uint32_t block_length; +} __PACKED scsi_read_capacity_10_t; +static_assert(sizeof(scsi_read_capacity_10_t) == 8, ""); + +// SCSI Read Capacity 16 payload +// This is big endian +typedef struct { + uint64_t lba; + uint32_t block_length; + uint8_t ptype_prot_en; // bit 0: PROT_EN, bits 1-3: P_TYPE + uint8_t resesrved[19]; +} __PACKED scsi_read_capacity_16_t; +static_assert(sizeof(scsi_read_capacity_16_t) == 32, ""); + +// SCSI Mode Sense 6 command +typedef struct { + uint8_t opcode; // UMS_MODE_SENSE6 + uint8_t disable_block_desc; + uint8_t page; + uint8_t subpage; + uint8_t allocation_length; + uint8_t control; +} __PACKED scsi_mode_sense_6_command_t; +static_assert(sizeof(scsi_mode_sense_6_command_t) == 6, ""); + +// SCSI Mode Sense 6 data response +typedef struct { + uint8_t mode_data_length; + uint8_t medium_type; + uint8_t device_specific_param; + uint8_t block_desc_length; +} __PACKED scsi_mode_sense_6_data_t; +#define MODE_SENSE_DSP_RO 0x80 // bit 7 of device_specific_param: read-only + +// Command Block Wrapper +typedef struct { + uint32_t dCBWSignature; // CBW_SIGNATURE + uint32_t dCBWTag; + uint32_t dCBWDataTransferLength; + uint8_t bmCBWFlags; + uint8_t bCBWLUN; + uint8_t bCBWCBLength; + uint8_t CBWCB[16]; +} __PACKED ums_cbw_t; +static_assert(sizeof(ums_cbw_t) == 31, ""); + +// Command Status Wrapper +typedef struct { + uint32_t dCSWSignature; // CSW_SIGNATURE + uint32_t dCSWTag; + uint32_t dCSWDataResidue; + uint8_t bmCSWStatus; +} __PACKED ums_csw_t; +static_assert(sizeof(ums_csw_t) == 13, ""); + +#endif // SYSROOT_ZIRCON_HW_USB_UMS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/video.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/video.h new file mode 100644 index 0000000..925b5b6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/hw/usb/video.h
@@ -0,0 +1,308 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_VIDEO_H_ +#define SYSROOT_ZIRCON_HW_USB_VIDEO_H_ + +// clang-format off + +#include <zircon/compiler.h> +#include <stdint.h> + +__BEGIN_CDECLS; + +// video interface subclasses +#define USB_SUBCLASS_VIDEO_CONTROL 0x01 +#define USB_SUBCLASS_VIDEO_STREAMING 0x02 +#define USB_SUBCLASS_VIDEO_INTERFACE_COLLECTION 0x03 + +// video class specific descriptor types +#define USB_VIDEO_CS_DEVICE 0x21 +#define USB_VIDEO_CS_CONFIGURATION 0x22 +#define USB_VIDEO_CS_STRING 0x23 +#define USB_VIDEO_CS_INTERFACE 0x24 +#define USB_VIDEO_CS_ENDPOINT 0x25 + +// video class specific VC interface descriptor subtypes +#define USB_VIDEO_VC_HEADER 0x01 +#define USB_VIDEO_VC_INPUT_TERMINAL 0x02 +#define USB_VIDEO_VC_OUTPUT_TERMINAL 0x03 +#define USB_VIDEO_VC_SELECTOR_UNIT 0x04 +#define USB_VIDEO_VC_PROCESSING_UNIT 0x05 +#define USB_VIDEO_VC_EXTENSION_UNIT 0x06 +#define USB_VIDEO_VC_ENCODING_UNIT 0x07 + +// video class specific VS interface descriptor subtypes +#define USB_VIDEO_VS_INPUT_HEADER 0x01 +#define USB_VIDEO_VS_OUTPUT_HEADER 0x02 +#define USB_VIDEO_VS_STILL_IMAGE_FRAME 0x03 +#define USB_VIDEO_VS_FORMAT_UNCOMPRESSED 0x04 +#define USB_VIDEO_VS_FRAME_UNCOMPRESSED 0x05 +#define USB_VIDEO_VS_FORMAT_MJPEG 0x06 +#define USB_VIDEO_VS_FRAME_MJPEG 0x07 +#define USB_VIDEO_VS_FORMAT_MPEG2TS 0x0A +#define USB_VIDEO_VS_FORMAT_DV 0x0C +#define USB_VIDEO_VS_COLORFORMAT 0x0D +#define USB_VIDEO_VS_FORMAT_FRAME_BASED 0x10 +#define USB_VIDEO_VS_FRAME_FRAME_BASED 0x11 +#define USB_VIDEO_VS_FORMAT_STREAM_BASED 0x12 +#define USB_VIDEO_VS_FORMAT_H264 0x13 +#define USB_VIDEO_VS_FRAME_H264 0x14 +#define USB_VIDEO_VS_FORMAT_H264_SIMULCAST 0x15 +#define USB_VIDEO_VS_FORMAT_VP8 0x16 +#define USB_VIDEO_VS_FRAME_VP8 0x17 +#define USB_VIDEO_VS_FORMAT_VP8_SIMULCAST 0x18 + +// video class specific endpoint descriptor subtypes +#define USB_VIDEO_EP_GENERAL 0x01 +#define USB_VIDEO_EP_ENDPOINT 0x02 +#define USB_VIDEO_EP_INTERRUPT 0x03 + +// video class specific request codes +#define USB_VIDEO_SET_CUR 0x01 +#define USB_VIDEO_SET_CUR_ALL 0x11 +#define USB_VIDEO_GET_CUR 0x81 +#define USB_VIDEO_GET_MIN 0x82 +#define USB_VIDEO_GET_MAX 0x83 +#define USB_VIDEO_GET_RES 0x84 +#define USB_VIDEO_GET_LEN 0x85 +#define USB_VIDEO_GET_INFO 0x86 +#define USB_VIDEO_GET_DEF 0x87 +#define USB_VIDEO_GET_CUR_ALL 0x91 +#define USB_VIDEO_GET_MIN_ALL 0x92 +#define USB_VIDEO_GET_MAX_ALL 0x93 +#define USB_VIDEO_GET_RES_ALL 0x94 +#define USB_VIDEO_GET_DEF_ALL 0x97 + +// video streaming interface control selectors +#define USB_VIDEO_VS_PROBE_CONTROL 0x01 +#define USB_VIDEO_VS_COMMIT_CONTROL 0x02 +#define USB_VIDEO_VS_STILL_PROBE_CONTROL 0x03 +#define USB_VIDEO_VS_STILL_COMMIT_CONTROL 0x04 +#define USB_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 +#define USB_VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06 +#define USB_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07 +#define USB_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 +#define USB_VIDEO_VS_SYNCH_DELAY_CONTROL 0x09 + +// header for usb_video_vc_* below +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; +} __PACKED usb_video_vc_desc_header; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VC_HEADER + uint16_t bcdUVC; + uint16_t wTotalLength; + uint32_t dwClockFrequency; + uint8_t bInCollection; + uint8_t baInterfaceNr[]; +} __PACKED usb_video_vc_header_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VC_INPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t iTerminal; +} __PACKED usb_video_vc_input_terminal_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VC_OUTPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t bSourceID; + uint8_t iTerminal; +} __PACKED usb_video_vc_output_terminal_desc; + +// class specific VC interrupt endpoint descriptor +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_ENDPOINT + uint8_t bDescriptorSubtype; // USB_ENDPOINT_INTERRUPT + uint16_t wMaxTransferSize; +} __PACKED usb_video_vc_interrupt_endpoint_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VS_HEADER + uint8_t bNumFormats; + uint16_t wTotalLength; + uint8_t bEndpointAddress; + uint8_t bmInfo; + uint8_t bTerminalLink; + uint8_t bStillCaptureMethod; + uint8_t bTriggerSupport; + uint8_t bTriggerUsage; + uint8_t bControlSize; + uint8_t bmaControls[]; +} __PACKED usb_video_vs_input_header_desc; + +#define GUID_LENGTH 16 + +// A GUID consists of a: +// - four-byte integer +// - two-byte integer +// - two-byte integer +// - eight-byte array +// +// The string representation uses big endian format, so to convert it +// to a byte array we need to reverse the byte order of the three integers. +// +// See USB Video Class revision 1.5, FAQ section 2.9 +// for GUID Data Structure Layout. + +#define USB_VIDEO_GUID_YUY2_STRING "32595559-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_YUY2_VALUE { \ + 0x59, 0x55, 0x59, 0x32, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +#define USB_VIDEO_GUID_NV12_STRING "3231564E-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_NV12_VALUE { \ + 0x4e, 0x56, 0x31, 0x32, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +#define USB_VIDEO_GUID_M420_STRING "3032344D-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_M420_VALUE { \ + 0x4d, 0x34, 0x32, 0x30, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +#define USB_VIDEO_GUID_I420_STRING "30323449-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_I420_VALUE { \ + 0x49, 0x34, 0x32, 0x30, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +// USB Video Payload Uncompressed +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_UNCOMPRESSED + uint8_t bFormatIndex; + uint8_t bNumFrameDescriptors; + uint8_t guidFormat[GUID_LENGTH]; + uint8_t bBitsPerPixel; + uint8_t bDefaultFrameIndex; + uint8_t bAspectRatioX; + uint8_t bAspectRatioY; + uint8_t bmInterfaceFlags; + uint8_t bCopyProtect; +} __PACKED usb_video_vs_uncompressed_format_desc; + +// USB Video Payload MJPEG +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_MJPEG + uint8_t bFormatIndex; + uint8_t bNumFrameDescriptors; + uint8_t bmFlags; + uint8_t bDefaultFrameIndex; + uint8_t bAspectRatioX; + uint8_t bAspectRatioY; + uint8_t bmInterfaceFlags; + uint8_t bCopyProtect; +} __PACKED usb_video_vs_mjpeg_format_desc; + +// Uncompressed and MJPEG formats have the same frame descriptor structure. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_VIDEO_VS_FRAME_UNCOMPRESSED / USB_VIDEO_VS_FRAME_MJPEG + uint8_t bFrameIndex; + uint8_t bmCapabilities; + uint16_t wWidth; + uint16_t wHeight; + uint32_t dwMinBitRate; + uint32_t dwMaxBitRate; + uint32_t dwMaxVideoFrameBufferSize; + uint32_t dwDefaultFrameInterval; + uint8_t bFrameIntervalType; + uint32_t dwFrameInterval[]; +} __PACKED usb_video_vs_frame_desc; + +// Stream negotiation +#define USB_VIDEO_BM_HINT_FRAME_INTERVAL (1 << 0) +#define USB_VIDEO_BM_HINT_KEY_FRAME_RATE (1 << 1) +#define USB_VIDEO_BM_HINT_P_FRAME_RATE (1 << 2) +#define USB_VIDEO_BM_HINT_COMP_QUALITY (1 << 3) +#define USB_VIDEO_BM_HINT_COMP_WINDOW_SIZE (1 << 4) + +typedef struct { + uint16_t bmHint; + uint8_t bFormatIndex; + uint8_t bFrameIndex; + uint32_t dwFrameInterval; + uint16_t wKeyFrameRate; + uint16_t wPFrameRate; + uint16_t wCompQuality; + uint16_t wCompWindowSize; + uint16_t wDelay; + uint32_t dwMaxVideoFrameSize; + uint32_t dwMaxPayloadTransferSize; + // The following fields are optional. + uint32_t dwClockFrequency; + uint8_t bmFramingInfo; + uint8_t bPreferedVersion; + uint8_t bMinVersion; + uint8_t bMaxVersion; + uint8_t bUsage; + uint8_t bBitDepthLuma; + uint8_t bmSettings; + uint8_t bMaxNumberOfRefFramesPlus1; + uint16_t bmRateControlModes; + uint32_t bmLayoutPerStream; +} __PACKED usb_video_vc_probe_and_commit_controls; + +// For accessing payload bmHeaderInfo bitmap +#define USB_VIDEO_VS_PAYLOAD_HEADER_FID (1 << 0) +#define USB_VIDEO_VS_PAYLOAD_HEADER_EOF (1 << 1) +#define USB_VIDEO_VS_PAYLOAD_HEADER_PTS (1 << 2) +#define USB_VIDEO_VS_PAYLOAD_HEADER_SCR (1 << 3) +#define USB_VIDEO_VS_PAYLOAD_HEADER_RES (1 << 4) +#define USB_VIDEO_VS_PAYLOAD_HEADER_STI (1 << 5) +#define USB_VIDEO_VS_PAYLOAD_HEADER_ERR (1 << 6) +#define USB_VIDEO_VS_PAYLOAD_HEADER_EOH (1 << 7) + +// Common header for all payloads. +typedef struct { + uint8_t bHeaderLength; + uint8_t bmHeaderInfo; + +} __PACKED usb_video_vs_payload_header; + +typedef struct { + uint8_t bHeaderLength; + uint8_t bmHeaderInfo; + uint32_t dwPresentationTime; + uint32_t scrSourceTimeClock; + // Frame number when the source clock was sampled. + uint16_t scrSourceClockSOFCounter; +} __PACKED usb_video_vs_uncompressed_payload_header; + +__END_CDECLS; + + +#endif // SYSROOT_ZIRCON_HW_USB_VIDEO_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/limits.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/limits.h new file mode 100644 index 0000000..f062d5e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/limits.h
@@ -0,0 +1,14 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_LIMITS_H_ +#define SYSROOT_ZIRCON_LIMITS_H_ + +#include <stdint.h> + +#define ZX_PAGE_SHIFT ((uint32_t)12u) +#define ZX_PAGE_SIZE ((uintptr_t)(1u << ZX_PAGE_SHIFT)) +#define ZX_PAGE_MASK (ZX_PAGE_SIZE - 1u) + +#endif // SYSROOT_ZIRCON_LIMITS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/listnode.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/listnode.h new file mode 100644 index 0000000..fb64acf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/listnode.h
@@ -0,0 +1,300 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_LISTNODE_H_ +#define SYSROOT_ZIRCON_LISTNODE_H_ + +#include <stdbool.h> +#include <stddef.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +#define containerof(ptr, type, member) ((type*)((uintptr_t)(ptr)-offsetof(type, member))) + +typedef struct list_node list_node_t; + +struct list_node { + list_node_t* prev; + list_node_t* next; +}; + +#define LIST_INITIAL_VALUE(list) \ + { &(list), &(list) } +#define LIST_INITIAL_CLEARED_VALUE \ + { NULL, NULL } + +static inline void list_initialize(list_node_t* list) { list->prev = list->next = list; } + +static inline void list_clear_node(list_node_t* item) { item->prev = item->next = 0; } + +static inline bool list_in_list(const list_node_t* item) { + if (item->prev == 0 && item->next == 0) + return false; + else + return true; +} + +static inline void list_add_head(list_node_t* list, list_node_t* item) { + item->next = list->next; + item->prev = list; + list->next->prev = item; + list->next = item; +} + +#define list_add_after(entry, new_entry) list_add_head(entry, new_entry) + +static inline void list_add_tail(list_node_t* list, list_node_t* item) { + item->prev = list->prev; + item->next = list; + list->prev->next = item; + list->prev = item; +} + +#define list_add_before(entry, new_entry) list_add_tail(entry, new_entry) + +static inline void list_delete(list_node_t* item) { + item->next->prev = item->prev; + item->prev->next = item->next; + item->prev = item->next = 0; +} + +static inline void list_replace_node(list_node_t* old_node, list_node_t* new_node) { + // replace a spot in a list with a new node + // assumes old_node is part of a list and new_node is not + new_node->next = old_node->next; + new_node->prev = old_node->prev; + old_node->prev = old_node->next = 0; + + new_node->next->prev = new_node; + new_node->prev->next = new_node; +} + +static inline list_node_t* list_remove_head(list_node_t* list) { + if (list->next != list) { + list_node_t* item = list->next; + list_delete(item); + return item; + } else { + return NULL; + } +} + +#define list_remove_head_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_remove_head(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_remove_tail(list_node_t* list) { + if (list->prev != list) { + list_node_t* item = list->prev; + list_delete(item); + return item; + } else { + return NULL; + } +} + +#define list_remove_tail_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_remove_tail(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_peek_head(const list_node_t* list) { + if (list->next != list) { + return list->next; + } else { + return NULL; + } +} + +#define list_peek_head_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_peek_head(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_peek_tail(const list_node_t* list) { + if (list->prev != list) { + return list->prev; + } else { + return NULL; + } +} + +#define list_peek_tail_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_peek_tail(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_prev(list_node_t* list, list_node_t* item) { + if (item->prev != list) + return item->prev; + else + return NULL; +} + +#define list_prev_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_prev(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_prev_wrap(list_node_t* list, list_node_t* item) { + if (item->prev != list) + return item->prev; + else if (item->prev->prev != list) + return item->prev->prev; + else + return NULL; +} + +#define list_prev_wrap_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_prev_wrap(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_next(list_node_t* list, list_node_t* item) { + if (item->next != list) + return item->next; + else + return NULL; +} + +#define list_next_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_next(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_next_wrap(list_node_t* list, list_node_t* item) { + if (item->next != list) + return item->next; + else if (item->next->next != list) + return item->next->next; + else + return NULL; +} + +#define list_next_wrap_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_next_wrap(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +// iterates over the list, node should be list_node_t* +#define list_for_every(list, node) for (node = (list)->next; node != (list); node = node->next) + +// iterates over the list in a safe way for deletion of current node +// node and temp_node should be list_node_t* +#define list_for_every_safe(list, node, temp_node) \ + for (node = (list)->next, temp_node = (node)->next; node != (list); \ + node = temp_node, temp_node = (node)->next) + +// iterates over the list, entry should be the container structure type * +#define list_for_every_entry(list, entry, type, member) \ + for ((entry) = containerof((list)->next, type, member); &(entry)->member != (list); \ + (entry) = containerof((entry)->member.next, type, member)) + +// iterates over the list in a safe way for deletion of current node +// entry and temp_entry should be the container structure type * +#define list_for_every_entry_safe(list, entry, temp_entry, type, member) \ + for (entry = containerof((list)->next, type, member), \ + temp_entry = containerof((entry)->member.next, type, member); \ + &(entry)->member != (list); \ + entry = temp_entry, temp_entry = containerof((temp_entry)->member.next, type, member)) + +static inline bool list_is_empty(const list_node_t* list) { + return (list->next == list) ? true : false; +} + +static inline size_t list_length(const list_node_t* list) { + size_t cnt = 0; + const list_node_t* node = list; + list_for_every(list, node) { cnt++; } + + return cnt; +} + +// Splice the contents of splice_from into the list immediately following pos. +static inline void list_splice_after(list_node_t* splice_from, list_node_t* pos) { + if (list_is_empty(splice_from)) { + return; + } + splice_from->next->prev = pos; + splice_from->prev->next = pos->next; + pos->next->prev = splice_from->prev; + pos->next = splice_from->next; + list_initialize(splice_from); +} + +// Split the contents of list after (but not including) pos, into split_to +// (which should be empty). +static inline void list_split_after(list_node_t* list, list_node_t* pos, list_node_t* split_to) { + if (pos->next == list) { + list_initialize(split_to); + return; + } + split_to->prev = list->prev; + split_to->prev->next = split_to; + split_to->next = pos->next; + split_to->next->prev = split_to; + pos->next = list; + list->prev = pos; +} + +// Moves all the contents of old_list (which may or may not be empty) +// to new_list (which should be empty). +static inline void list_move(list_node_t* old_list, list_node_t* new_list) { + list_initialize(new_list); + list_splice_after(old_list, new_list); +} + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_LISTNODE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/pixelformat.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/pixelformat.h new file mode 100644 index 0000000..f28f35f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/pixelformat.h
@@ -0,0 +1,28 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_PIXELFORMAT_H_ +#define SYSROOT_ZIRCON_PIXELFORMAT_H_ + +#include <stdint.h> + +typedef uint32_t zx_pixel_format_t; +// clang-format off + +#define ZX_PIXEL_FORMAT_NONE ((zx_pixel_format_t)0x00000000) + +#define ZX_PIXEL_FORMAT_RGB_565 ((zx_pixel_format_t)0x00020001) +#define ZX_PIXEL_FORMAT_RGB_332 ((zx_pixel_format_t)0x00010002) +#define ZX_PIXEL_FORMAT_RGB_2220 ((zx_pixel_format_t)0x00010003) +#define ZX_PIXEL_FORMAT_ARGB_8888 ((zx_pixel_format_t)0x00040004) +#define ZX_PIXEL_FORMAT_RGB_x888 ((zx_pixel_format_t)0x00040005) +#define ZX_PIXEL_FORMAT_MONO_8 ((zx_pixel_format_t)0x00010007) +#define ZX_PIXEL_FORMAT_GRAY_8 ((zx_pixel_format_t)0x00010007) +#define ZX_PIXEL_FORMAT_NV12 ((zx_pixel_format_t)0x00010008) +#define ZX_PIXEL_FORMAT_RGB_888 ((zx_pixel_format_t)0x00030009) +#define ZX_PIXEL_FORMAT_ABGR_8888 ((zx_pixel_format_t)0x0004000a) +#define ZX_PIXEL_FORMAT_BGR_888x ((zx_pixel_format_t)0x0004000b) +#define ZX_PIXEL_FORMAT_BYTES(pf) (((pf) >> 16) & 7) + +#endif // SYSROOT_ZIRCON_PIXELFORMAT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/process.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/process.h new file mode 100644 index 0000000..ef2bcb1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/process.h
@@ -0,0 +1,35 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_PROCESS_H_ +#define SYSROOT_ZIRCON_PROCESS_H_ + +#include <stdint.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Accessors for Zircon-specific state maintained by the language runtime + +// Examines the set of handles received at process startup for one matching +// |hnd_info|. If one is found, atomically returns it and removes it from the +// set available to future calls. +// |hnd_info| is a value returned by PA_HND(). +zx_handle_t zx_take_startup_handle(uint32_t hnd_info); + +zx_handle_t _zx_thread_self(void); +zx_handle_t zx_thread_self(void); + +zx_handle_t _zx_process_self(void); +zx_handle_t zx_process_self(void); + +zx_handle_t _zx_vmar_root_self(void); +zx_handle_t zx_vmar_root_self(void); + +zx_handle_t _zx_job_default(void); +zx_handle_t zx_job_default(void); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_PROCESS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/processargs.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/processargs.h new file mode 100644 index 0000000..fbad376 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/processargs.h
@@ -0,0 +1,170 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_PROCESSARGS_H_ +#define SYSROOT_ZIRCON_PROCESSARGS_H_ + +#include <stdint.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// This is a protocol for passing state to a new process +// via a message in a channel. + +#define ZX_PROCARGS_PROTOCOL ((uint32_t)0x4150585du) // MXPA +#define ZX_PROCARGS_VERSION ((uint32_t)0x0001000u) + +typedef struct zx_proc_args zx_proc_args_t; + +struct zx_proc_args { + // Protocol and version identifiers to allow for + // different process start message protocols and + // versioning of the same. + uint32_t protocol; + uint32_t version; + + // Offset from start of message to handle info + // array, which contains one uint32_t per handle + // passed along with the message. + uint32_t handle_info_off; + + // Offset from start of message to arguments and + // count of arguments. Arguments are provided as + // a set of null-terminated utf-8 strings, one + // after the other. + uint32_t args_off; + uint32_t args_num; + + // Offset from start of message to environment strings and count of + // them. Environment entries are provided as a set of null-terminated + // UTF-8 strings, one after the other. Canonically each string has + // the form "NAME=VALUE", but nothing enforces this. + uint32_t environ_off; + uint32_t environ_num; + + // Offset from start of message to name strings and count of them. + // These strings are packed similar to the argument strings, + // but are referenced by PA_NS_* handle table entries and used + // to set up namespaces. + // + // Specifically: In a handle table entry with PA_HND_TYPE(info) + // of PA_NS_*, PA_HND_ARG(info) is an index into this name table. + uint32_t names_off; + uint32_t names_num; +}; + +// Handle Info entries associate a type and optional +// argument with each handle included in the process +// arguments message. +#define PA_HND(type, arg) (((type)&0xFF) | (((arg)&0xFFFF) << 16)) +#define PA_HND_TYPE(n) ((n)&0xFF) +#define PA_HND_ARG(n) (((n) >> 16) & 0xFFFF) + +// --- Core Runtime Handles --- +// Used by libc init (or equivalent) and dynamic loader + +// Handle to our own process. +#define PA_PROC_SELF 0x01u + +// Handle to the initial thread of our own process. +#define PA_THREAD_SELF 0x02u + +// Handle to a job object which can be used to make child processes. +// +// The job can be the same as the one used to create this process or it can +// be different. +#define PA_JOB_DEFAULT 0x03u + +// Handle to the root of our address space +#define PA_VMAR_ROOT 0x04u + +// Handle to the VMAR used to load the initial program image. +#define PA_VMAR_LOADED 0x05u + +// --- Loader Service and VMO Handles --- +// Used by libc init (or equivalent) and dynamic loader + +// Service for loading shared libraries. +// +// See |fuchsia.ldsvc.Loader| for the interface definition. +#define PA_LDSVC_LOADER 0x10u + +// Handle to the VMO containing the ELF image of the system vDSO. This +// handle is duplicable, transferable, readable, and executable, but not +// writable. The contents of the VM object should be treated like any +// other general-purpose ELF file image of type ET_DYN. A process only +// needs this handle so that it can map the vDSO into new processes it +// might create or propagate it on to its children so they can do so. +// Each process's own vDSO was mapped in by its creator before the +// process started, its address passed as an argument to entry point. +#define PA_VMO_VDSO 0x11u + +// Handle to the VMO used to map the initial thread's stack. This +// handle usually has all rights. The protocol between process creator +// and new process is that this entire VM object has been mapped in +// before the process starts. The initial value for the SP register in +// the new process is the high edge of the mapping (assuming stacks grow +// downwards), adjusted down as required by the particular machine's C +// calling convention for function entry. Thus the new process can +// compute its exact stack bounds by subtracting the size reported by +// this VMO from the (adjusted back up) initial SP value. +#define PA_VMO_STACK 0x13u + +// VM object handle for the main executable file +#define PA_VMO_EXECUTABLE 0x14u + +// Used by kernel and userboot during startup +#define PA_VMO_BOOTDATA 0x1Au + +// Used by kernel and userboot during startup +#define PA_VMO_BOOTFS 0x1Bu + +// Used by the kernel to export debug information as a file in bootfs. When +// devmgr starts, it looks for handles of this type, and adds them as files in +// /boot/kernel/<vmo-name>. +#define PA_VMO_KERNEL_FILE 0x1Cu + +// --- Namespace Handles --- + +// A handle which will handle OPEN requests relative +// to a particular path which is specified by the +// nametable entry referred to by the "arg" field +#define PA_NS_DIR 0x20u + +// --- File Descriptor Handles --- + +// A handle which will be used as a file descriptor. +#define PA_FD 0x30u + +// -- Lifecyle handle -- +// +// A Handle to a channel on which the process may receive lifecycle events from +// the ELF runner by serving the |fuchsia.process.Lifecycle| protocol. +#define PA_LIFECYCLE 0x3Au + +// Server endpoint for handling connection to appmgr services. +#define PA_DIRECTORY_REQUEST 0x3Bu + +// Used by devmgr and devhosts +#define PA_RESOURCE 0x3Fu + +// --- Clock handles --- +// +// A clock which provides access to UTC. Used by runtimes which are expected to +// provide access to UTC via their standard libraries. +// +#define PA_CLOCK_UTC 0x40u + +// --- Various --- + +// Handle types for one-off use and prototyping +#define PA_USER0 0xF0u +#define PA_USER1 0xF1u +#define PA_USER2 0xF2u + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_PROCESSARGS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/rights.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/rights.h new file mode 100644 index 0000000..2ab61b9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/rights.h
@@ -0,0 +1,123 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_RIGHTS_H_ +#define SYSROOT_ZIRCON_RIGHTS_H_ + +#include <stdint.h> + +typedef uint32_t zx_rights_t; +#define ZX_RIGHT_NONE ((zx_rights_t)0u) +#define ZX_RIGHT_DUPLICATE ((zx_rights_t)1u << 0) +#define ZX_RIGHT_TRANSFER ((zx_rights_t)1u << 1) +#define ZX_RIGHT_READ ((zx_rights_t)1u << 2) +#define ZX_RIGHT_WRITE ((zx_rights_t)1u << 3) +#define ZX_RIGHT_EXECUTE ((zx_rights_t)1u << 4) +#define ZX_RIGHT_MAP ((zx_rights_t)1u << 5) +#define ZX_RIGHT_GET_PROPERTY ((zx_rights_t)1u << 6) +#define ZX_RIGHT_SET_PROPERTY ((zx_rights_t)1u << 7) +#define ZX_RIGHT_ENUMERATE ((zx_rights_t)1u << 8) +#define ZX_RIGHT_DESTROY ((zx_rights_t)1u << 9) +#define ZX_RIGHT_SET_POLICY ((zx_rights_t)1u << 10) +#define ZX_RIGHT_GET_POLICY ((zx_rights_t)1u << 11) +#define ZX_RIGHT_SIGNAL ((zx_rights_t)1u << 12) +#define ZX_RIGHT_SIGNAL_PEER ((zx_rights_t)1u << 13) +#define ZX_RIGHT_WAIT ((zx_rights_t)1u << 14) +#define ZX_RIGHT_INSPECT ((zx_rights_t)1u << 15) +#define ZX_RIGHT_MANAGE_JOB ((zx_rights_t)1u << 16) +#define ZX_RIGHT_MANAGE_PROCESS ((zx_rights_t)1u << 17) +#define ZX_RIGHT_MANAGE_THREAD ((zx_rights_t)1u << 18) +#define ZX_RIGHT_APPLY_PROFILE ((zx_rights_t)1u << 19) +#define ZX_RIGHT_SAME_RIGHTS ((zx_rights_t)1u << 31) + +// Convenient names for commonly grouped rights. +#define ZX_RIGHTS_BASIC (ZX_RIGHT_TRANSFER | ZX_RIGHT_DUPLICATE | ZX_RIGHT_WAIT | ZX_RIGHT_INSPECT) + +#define ZX_RIGHTS_IO (ZX_RIGHT_READ | ZX_RIGHT_WRITE) + +#define ZX_RIGHTS_PROPERTY (ZX_RIGHT_GET_PROPERTY | ZX_RIGHT_SET_PROPERTY) + +#define ZX_RIGHTS_POLICY (ZX_RIGHT_GET_POLICY | ZX_RIGHT_SET_POLICY) + +#define ZX_DEFAULT_CHANNEL_RIGHTS \ + ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_DUPLICATE)) | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL | \ + ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_EVENT_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_SYSTEM_EVENT_LOW_MEMORY_RIGHTS \ + (ZX_RIGHT_WAIT | ZX_RIGHT_DUPLICATE | ZX_RIGHT_TRANSFER) + +#define ZX_DEFAULT_EVENTPAIR_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_SIGNAL | ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_FIFO_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL | ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_GUEST_RIGHTS \ + (ZX_RIGHT_TRANSFER | ZX_RIGHT_DUPLICATE | ZX_RIGHT_WRITE | ZX_RIGHT_INSPECT | \ + ZX_RIGHT_MANAGE_PROCESS) + +#define ZX_DEFAULT_INTERRUPT_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_IO_MAPPING_RIGHTS (ZX_RIGHT_READ | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_JOB_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHTS_POLICY | ZX_RIGHT_ENUMERATE | \ + ZX_RIGHT_DESTROY | ZX_RIGHT_SIGNAL | ZX_RIGHT_MANAGE_JOB | ZX_RIGHT_MANAGE_PROCESS | \ + ZX_RIGHT_MANAGE_THREAD) + +#define ZX_DEFAULT_LOG_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_WRITE | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_MSI_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_PCI_DEVICE_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO) + +#define ZX_DEFAULT_PCI_INTERRUPT_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_PORT_RIGHTS ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) | ZX_RIGHTS_IO) + +#define ZX_DEFAULT_PROCESS_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHT_ENUMERATE | ZX_RIGHT_DESTROY | \ + ZX_RIGHT_SIGNAL | ZX_RIGHT_MANAGE_PROCESS | ZX_RIGHT_MANAGE_THREAD) + +#define ZX_DEFAULT_RESOURCE_RIGHTS \ + (ZX_RIGHT_TRANSFER | ZX_RIGHT_DUPLICATE | ZX_RIGHT_WRITE | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_SOCKET_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_GET_PROPERTY | ZX_RIGHT_SET_PROPERTY | \ + ZX_RIGHT_SIGNAL | ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_STREAM_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_PROPERTY | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_THREAD_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHT_DESTROY | ZX_RIGHT_SIGNAL | \ + ZX_RIGHT_MANAGE_THREAD) + +#define ZX_DEFAULT_TIMER_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_WRITE | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_VCPU_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_EXECUTE | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_VMAR_RIGHTS (ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) + +#define ZX_DEFAULT_VMO_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHT_MAP | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_IOMMU_RIGHTS (ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) + +#define ZX_DEFAULT_BTI_RIGHTS ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) | ZX_RIGHTS_IO | ZX_RIGHT_MAP) + +#define ZX_DEFAULT_PROFILE_RIGHTS ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) | ZX_RIGHT_APPLY_PROFILE) + +#define ZX_DEFAULT_PMT_RIGHTS (ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_SUSPEND_TOKEN_RIGHTS (ZX_RIGHT_TRANSFER | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_PAGER_RIGHTS \ + (ZX_RIGHT_INSPECT | ZX_RIGHT_GET_PROPERTY | ZX_RIGHT_SET_PROPERTY | ZX_RIGHT_TRANSFER) + +#define ZX_DEFAULT_EXCEPTION_RIGHTS (ZX_RIGHT_TRANSFER | ZX_RIGHTS_PROPERTY | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_CLOCK_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO) + +#endif // SYSROOT_ZIRCON_RIGHTS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/sanitizer.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/sanitizer.h new file mode 100644 index 0000000..c2f2e8e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/sanitizer.h
@@ -0,0 +1,171 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SANITIZER_H_ +#define SYSROOT_ZIRCON_SANITIZER_H_ + +// Interfaces declared in this file are intended for the use of sanitizer +// runtime library implementation code. Each sanitizer runtime works only +// with the appropriately sanitized build of libc. These functions should +// never be called when using the unsanitized libc. But these names are +// always exported so that the libc ABI is uniform across sanitized and +// unsanitized builds (only unsanitized shared library binaries are used at +// link time, including linking the sanitizer runtime shared libraries). + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <threads.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// These are aliases for the functions defined in libc, which are always +// the unsanitized versions. The sanitizer runtimes can call them by these +// aliases when they are overriding libc's definitions of the unadorned +// symbols. +__typeof(memcpy) __unsanitized_memcpy; +__typeof(memmove) __unsanitized_memmove; +__typeof(memset) __unsanitized_memset; + +// The sanitized libc allocates the shadow memory in the appropriate ratio for +// the particular sanitizer (shadow_base == shadow_limit >> SHADOW_SCALE) +// early during startup, before any other address space allocations can occur. +// Shadow memory always starts at address zero: +// [memory_limit, UINTPTR_MAX) Address space reserved by the system. +// [shadow_limit, memory_limit) Address space available to the user. +// [shadow_base, shadow_limit) Shadow memory, preallocated. +// [0, shadow_base) Shadow gap, cannot be allocated. +typedef struct saniziter_shadow_bounds { + uintptr_t shadow_base; + uintptr_t shadow_limit; + uintptr_t memory_limit; +} sanitizer_shadow_bounds_t; + +// Returns the shadow bounds for the current process. +sanitizer_shadow_bounds_t __sanitizer_shadow_bounds(void); + +// Fill the shadow memory corresponding to [base, base+size) with |value|. The +// threshold is used as a hint to determine when to switch to a more efficient +// mechanism when zero-filling large shadow regions. This assumes that both +// |base| and |size| are aligned to the shadow multiple. +void __sanitizer_fill_shadow(uintptr_t base, size_t size, uint8_t value, size_t threshold); + +// Write logging information from the sanitizer runtime. The buffer +// is expected to be printable text with '\n' ending each line. +// Timestamps and globally unique identifiers of the calling process +// and thread (zx_koid_t) are attached to all messages, so there is no +// need to include those details in the text. The log of messages +// written with this call automatically includes address and ELF build +// ID details of the program and all shared libraries sufficient to +// translate raw address values into program symbols or source +// locations via a post-processor that has access to the original ELF +// files and their debugging information. The text can contain markup +// around address values that should be resolved symbolically; see +// TODO(mcgrathr) for the format and details of the post-processor. +void __sanitizer_log_write(const char* buffer, size_t len); + +// Runtimes that have binary data to publish (e.g. coverage) use this +// interface. The name describes the data sink that will receive this +// blob of data; the string is not used after this call returns. The +// caller creates a VMO (e.g. zx_vmo_create) and passes it in; the VMO +// handle is consumed by this call. Each particular data sink has its +// own conventions about both the format of the data in the VMO and the +// protocol for when data must be written there. For some sinks, the +// VMO's data is used immediately. For other sinks, the caller is +// expected to have the VMO mapped in and be writing more data there +// throughout the life of the process, to be analyzed only after the +// process terminates. Yet others might use an asynchronous shared +// memory protocol between producer and consumer. +void __sanitizer_publish_data(const char* sink_name, zx_handle_t vmo); + +// Runtimes that want to read configuration files use this interface. +// The name is a string from the user (something akin to a file name +// but not necessarily actually a file name); the string is not used +// after this call returns. On success, this yields a read-only VMO +// handle from which the contents associated with that name can be +// read; the caller is responsible for closing this handle. +zx_status_t __sanitizer_get_configuration(const char* config_name, zx_handle_t* out_vmo); + +// Changes protection of the code in the range of len bytes starting +// from addr. The writable argument specifies whether the code should +// be made writable or not. This function is only valid on ranges within +// the caller's own code segment. +// TODO(phosek) removes this when the proper debugging interface exists. +zx_status_t __sanitizer_change_code_protection(uintptr_t addr, size_t len, bool writable); + +// This stops all other threads in the process so memory should be quiescent. +// Then it makes callbacks for memory regions containing non-const global +// variables, thread stacks, thread registers, and thread-local storage +// regions (this includes thread_local variables as well as tss_set or +// pthread_setspecific values). Each callback is optional; no such callbacks +// are made if a null function pointer is given. The memory region passed to +// each callback can be accessed only during that single callback and might no +// longer be valid once the callback returns. Then it makes a final callback +// before allowing other threads to resume running normally. If there are +// problems stopping threads, no memory callbacks will be made and the +// argument to the final callback will get an error code rather than ZX_OK. +typedef void sanitizer_memory_snapshot_callback_t(void* mem, size_t len, void* arg); +void __sanitizer_memory_snapshot(sanitizer_memory_snapshot_callback_t* globals, + sanitizer_memory_snapshot_callback_t* stacks, + sanitizer_memory_snapshot_callback_t* regs, + sanitizer_memory_snapshot_callback_t* tls, + void (*done)(zx_status_t, void*), void* arg); + +// The "hook" interfaces are functions that the sanitizer runtime library +// can define and libc will call. There are default definitions in libc +// which do nothing, but any other definitions will override those. These +// declarations use __EXPORT (i.e. explicit STV_DEFAULT) to ensure any user +// definitions are seen by libc even if the user code is being compiled +// with -fvisibility=hidden or equivalent. + +// This is called at program startup, with the arguments that will be +// passed to main. This is called before any other application code, +// including both static constructors and initialization of things like +// fdio and zx_take_startup_handle. It's basically the first thing called +// after libc's most basic internal global initialization is complete and +// the initial thread has switched to its real thread stack. Since not +// even all of libc's own constructors have run yet, this should not call +// into libc or other library code. +__EXPORT void __sanitizer_startup_hook(int argc, char** argv, char** envp, void* stack_base, + size_t stack_size); + +// This is called when a new thread has been created but is not yet +// running. Its C11 thrd_t value has been determined and its stack has +// been allocated. All that remains is to actually start the thread +// running (which can fail only in catastrophic bug situations). Its +// return value will be passed to __sanitizer_thread_create_hook, below. +__EXPORT void* __sanitizer_before_thread_create_hook(thrd_t thread, bool detached, const char* name, + void* stack_base, size_t stack_size); + +// This is called after a new thread has been created or creation has +// failed at the final stage; __sanitizer_before_thread_create_hook has +// been called first, and its return value is the first argument here. +// The second argument is what the return value of C11 thrd_create would +// be for this creation attempt (which might have been instigated by +// either thrd_create or pthread_create). If it's thrd_success, then +// the new thread has now started running. Otherwise (it's a different +// <threads.h> thrd_* value), thread creation has failed and the thread +// details reported to __sanitizer_before_thread_create_hook will be +// freed without the thread ever starting. +__EXPORT void __sanitizer_thread_create_hook(void* hook, thrd_t thread, int error); + +// This is called in each new thread as it starts up. The argument is +// the same one returned by __sanitizer_before_thread_create_hook and +// previously passed to __sanitizer_thread_create_hook. +__EXPORT void __sanitizer_thread_start_hook(void* hook, thrd_t self); + +// This is called in each thread just before it dies. +// All thread-specific destructors have been run. +// The argument is the same one passed to __sanitizer_thread_start_hook. +__EXPORT void __sanitizer_thread_exit_hook(void* hook, thrd_t self); + +// This is called with the argument to _exit and its return value +// is the actual exit status for the process. +__EXPORT int __sanitizer_process_exit_hook(int status); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SANITIZER_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/status.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/status.h new file mode 100644 index 0000000..798d2b0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/status.h
@@ -0,0 +1,23 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include <zircon/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Given one of the status codes defined in <zircon/errors.h> (ZX_ERR_* or +// ZX_OK), this function returns an identifier string for the status code. +// +// For example, zx_status_get_string(ZX_ERR_TIMED_OUT) returns the string +// "ZX_ERR_TIMED_OUT". +__EXPORT const char* _zx_status_get_string(zx_status_t status); +__EXPORT const char* zx_status_get_string(zx_status_t status); + +#ifdef __cplusplus +} +#endif
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/string_view.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/string_view.h new file mode 100644 index 0000000..f54ff2a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/string_view.h
@@ -0,0 +1,67 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include <stddef.h> +#if __cplusplus >= 201103L && __has_include(<type_traits>) +#include <type_traits> +#endif + +// This represents a UTF-8 string constant provided by the vDSO itself. +// This pointer remains valid and the string doesn't change for the +// life of the process (if not the system). +// +// This type exists to be the return value type for vDSO functions. +// In current machine ABIs, it's returned "for free" in two registers. +// To a C caller, these functions have ABIs indistinguishable from if +// they simply returned `const char*` so there is no overhead to +// supporting the explicit-length API as well as the traditional C +// string API, though it does require writing out `.c_str` in the +// source. C++ 17 callers can take advantage of direct coercion to +// the standard std::string_view and std::u8string_view types, which +// also allows e.g. direct construction of std::string. +typedef struct { + const char* c_str; // UTF-8, guaranteed to be '\0'-terminated. + size_t length; // Length, not including the '\0' terminator. + +#ifdef __cplusplus + // This is ABI-identical to the usual implementation of std::string_view, + // when applied to NUL-terminated C strings. But this API doesn't presume + // that std::string_view has a particular implementation or exists at all. + // For convenience of use without directly using the C++ standard library + // API, a templatized implicit coercion is defined to types that have the + // API of std::string_view or std::u8string_view. With the most common + // implementations, this coercion will be compiled away to nothing. + template < + typename _T +#if __cplusplus >= 201103L && __has_include(<type_traits>) + , + typename = typename std::enable_if<sizeof(typename _T::value_type) == sizeof(char)>::type +#endif + > + operator _T() { + // It's preferable to exclude incompatible types via SFINAE so that + // the user's diagnostic experience is exactly as if no coercion + // operator existed. SFINAE should exclude this definition when a + // C++11 <type_traits> is available to define std::enable_if. If + // no standard C++ library header is available, this will provide + // a specific diagnostic. + static_assert(sizeof(typename _T::value_type) == sizeof(char), + "zx_string_view_t can be coerced to C++ 17 std::string_view" + " or std::u8string_view or types with equivalent API"); + return {reinterpret_cast<typename _T::const_pointer>(c_str), length}; + } + + // Preferably zx_string_view_t values should just be coerced to + // std::string_view. But it provides the most minimal aspects of + // the equivalent API in case a return value expression is used + // directly as `zx_foo_string().data()`, for example. + using value_type = char; + using const_pointer = const char*; + using size_type = size_t; + const_pointer data() const { return c_str; } + size_type size() const { return length; } +#endif +} zx_string_view_t;
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls.h new file mode 100644 index 0000000..9e79e55 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls.h
@@ -0,0 +1,41 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_H_ +#define SYSROOT_ZIRCON_SYSCALLS_H_ + +#include <zircon/string_view.h> +#include <zircon/syscalls/object.h> +#include <zircon/syscalls/pci.h> +#include <zircon/syscalls/profile.h> +#include <zircon/syscalls/types.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +#define _ZX_SYSCALL_DECL(name, type, attrs, nargs, arglist, prototype) \ + extern attrs type zx_##name prototype; \ + extern attrs type _zx_##name prototype; + +#ifdef __clang__ +#define _ZX_SYSCALL_ANNO(attr) __attribute__((attr)) +#else +#define _ZX_SYSCALL_ANNO(attr) // Nothing for compilers without the support. +#endif + +#include <zircon/syscalls/internal/cdecls.inc> + +#undef _ZX_SYSCALL_ANNO +#undef _ZX_SYSCALL_DECL + +// Compatibility wrappers for deprecated syscalls also go here, when +// there are any. + +// This DEPRECATED interface is replaced by zx_system_get_version_string. +zx_status_t zx_system_get_version(char* version, size_t version_size) __LEAF_FN; +zx_status_t _zx_system_get_version(char* version, size_t version_size) __LEAF_FN; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/clock.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/clock.h new file mode 100644 index 0000000..eab1cd1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/clock.h
@@ -0,0 +1,90 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_CLOCK_H_ +#define SYSROOT_ZIRCON_SYSCALLS_CLOCK_H_ + +#include <zircon/time.h> + +// clang-format off + +// Argument version identifiers. +// +// All zx_clock_* syscalls which fetch or receive a structure's worth of +// arguments encode a version number in the options field of the syscall. This +// version field is in the same location and is the same size for each syscall, +// so a common set of macros may be used for encoding and decoding. +#define ZX_CLOCK_ARGS_VERSION_SHIFT ((uint64_t)58u) +#define ZX_CLOCK_ARGS_VERSION_BITS ((uint64_t)6u) +#define ZX_CLOCK_ARGS_VERSION_MASK \ + (((((uint64_t)1) << ZX_CLOCK_ARGS_VERSION_BITS) - 1) << ZX_CLOCK_ARGS_VERSION_SHIFT) +#define ZX_CLOCK_ARGS_VERSION(_N) \ + (((uint64_t)(_N) << ZX_CLOCK_ARGS_VERSION_SHIFT) & ZX_CLOCK_ARGS_VERSION_MASK) + +// Clock creation options. +#define ZX_CLOCK_OPT_MONOTONIC ((uint64_t)1u << 0) +#define ZX_CLOCK_OPT_CONTINUOUS ((uint64_t)1u << 1) +#define ZX_CLOCK_OPT_AUTO_START ((uint64_t)1u << 2) + +#define ZX_CLOCK_OPTS_ALL ( \ + ZX_CLOCK_OPT_MONOTONIC | \ + ZX_CLOCK_OPT_CONTINUOUS | \ + ZX_CLOCK_OPT_AUTO_START) + +// Clock update flags +#define ZX_CLOCK_UPDATE_OPTION_VALUE_VALID ((uint64_t)1u << 0) +#define ZX_CLOCK_UPDATE_OPTION_RATE_ADJUST_VALID ((uint64_t)1u << 1) +#define ZX_CLOCK_UPDATE_OPTION_ERROR_BOUND_VALID ((uint64_t)1u << 2) + +#define ZX_CLOCK_UPDATE_OPTIONS_ALL ( \ + ZX_CLOCK_UPDATE_OPTION_VALUE_VALID | \ + ZX_CLOCK_UPDATE_OPTION_RATE_ADJUST_VALID | \ + ZX_CLOCK_UPDATE_OPTION_ERROR_BOUND_VALID) + +// Clock rate adjustment limits +#define ZX_CLOCK_UPDATE_MIN_RATE_ADJUST ((int32_t)-1000) +#define ZX_CLOCK_UPDATE_MAX_RATE_ADJUST ((int32_t)1000) + +// Special clock error values +#define ZX_CLOCK_UNKNOWN_ERROR ((uint64_t)0xFFFFFFFFFFFFFFFF) + +// clang-format on + +typedef struct zx_clock_create_args_v1 { + zx_time_t backstop_time; +} zx_clock_create_args_v1_t; + +typedef struct zx_clock_rate { + uint32_t synthetic_ticks; + uint32_t reference_ticks; +} zx_clock_rate_t; + +typedef struct zx_clock_transformation { + int64_t reference_offset; + int64_t synthetic_offset; + zx_clock_rate_t rate; +} zx_clock_transformation_t; + +typedef struct zx_clock_details_v1 { + uint64_t options; + zx_time_t backstop_time; + zx_clock_transformation_t ticks_to_synthetic; + zx_clock_transformation_t mono_to_synthetic; + uint64_t error_bound; + zx_ticks_t query_ticks; + zx_ticks_t last_value_update_ticks; + zx_ticks_t last_rate_adjust_update_ticks; + zx_ticks_t last_error_bounds_update_ticks; + uint32_t generation_counter; + uint8_t padding1[4]; +} zx_clock_details_v1_t; + +typedef struct zx_clock_update_args_v1 { + int32_t rate_adjust; + uint8_t padding1[4]; + int64_t value; + uint64_t error_bound; +} zx_clock_update_args_v1_t; + +#endif // SYSROOT_ZIRCON_SYSCALLS_CLOCK_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/debug.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/debug.h new file mode 100644 index 0000000..373381f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/debug.h
@@ -0,0 +1,179 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_DEBUG_ +#define SYSROOT_ZIRCON_SYSCALLS_DEBUG_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +#if defined(__x86_64__) + +// Value for ZX_THREAD_STATE_GENERAL_REGS on x86-64 platforms. +typedef struct zx_thread_state_general_regs { + uint64_t rax; + uint64_t rbx; + uint64_t rcx; + uint64_t rdx; + uint64_t rsi; + uint64_t rdi; + uint64_t rbp; + uint64_t rsp; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rip; + uint64_t rflags; + uint64_t fs_base; + uint64_t gs_base; +} zx_thread_state_general_regs_t; + +// Value for ZX_THREAD_STATE_FP_REGS on x64. Holds x87 and MMX state. +typedef struct zx_thread_state_fp_regs { + uint16_t fcw; // Control word. + uint16_t fsw; // Status word. + uint8_t ftw; // Tag word. + uint8_t reserved; + uint16_t fop; // Opcode. + uint64_t fip; // Instruction pointer. + uint64_t fdp; // Data pointer. + + uint8_t padding1[8]; + + // The x87/MMX state. For x87 the each "st" entry has the low 80 bits used for the register + // contents. For MMX, the low 64 bits are used. The higher bits are unused. + __ALIGNED(16) + struct { + uint64_t low; + uint64_t high; + } st[8]; +} zx_thread_state_fp_regs_t; + +// Value for ZX_THREAD_STATE_VECTOR_REGS on x64. Holds SSE and AVX registers. +// +// Setting vector registers will only work for threads that have previously executed an +// instruction using the corresponding register class. +typedef struct zx_thread_state_vector_regs { + // When only 16 registers are supported (pre-AVX-512), zmm[16-31] will be 0. + // YMM registers (256 bits) are v[0-4], XMM registers (128 bits) are v[0-2]. + struct { + uint64_t v[8]; + } zmm[32]; + + // AVX-512 opmask registers. Will be 0 unless AVX-512 is supported. + uint64_t opmask[8]; + + // SIMD control and status register. + uint32_t mxcsr; + + uint8_t padding1[4]; +} zx_thread_state_vector_regs_t; + +// Value for ZX_THREAD_STATE_DEBUG_REGS on x64 platforms. +typedef struct zx_thread_state_debug_regs { + uint64_t dr[4]; + // DR4 and D5 are not used. + uint64_t dr6; // Status register. + uint64_t dr7; // Control register. +} zx_thread_state_debug_regs_t; + +#elif defined(__aarch64__) + +// Value for ZX_THREAD_STATE_GENERAL_REGS on ARM64 platforms. +typedef struct zx_thread_state_general_regs { + uint64_t r[30]; + uint64_t lr; + uint64_t sp; + uint64_t pc; + uint64_t cpsr; + uint64_t tpidr; +} zx_thread_state_general_regs_t; + +// Value for ZX_THREAD_STATE_FP_REGS on ARM64 platforms. +// This is unused because vector state is used for all floating point on ARM64. +typedef struct zx_thread_state_fp_regs { + // Avoids sizing differences for empty structs between C and C++. + uint32_t unused; +} zx_thread_state_fp_regs_t; + +// Value for ZX_THREAD_STATE_VECTOR_REGS on ARM64 platforms. +typedef struct zx_thread_state_vector_regs { + uint32_t fpcr; + uint32_t fpsr; + struct { + uint64_t low; + uint64_t high; + } v[32]; +} zx_thread_state_vector_regs_t; + +// ARMv8-A provides 2 to 16 hardware breakpoint registers. +// The number is obtained by the BRPs field in the EDDFR register. +#define AARCH64_MAX_HW_BREAKPOINTS 16 +// ARMv8-A provides 2 to 16 watchpoint breakpoint registers. +// The number is obtained by the WRPs field in the EDDFR register. +#define AARCH64_MAX_HW_WATCHPOINTS 16 + +// Value for XZ_THREAD_STATE_DEBUG_REGS for ARM64 platforms. +typedef struct zx_thread_state_debug_regs { + struct { + uint32_t dbgbcr; // HW Breakpoint Control register. + uint8_t padding1[4]; + uint64_t dbgbvr; // HW Breakpoint Value register. + } hw_bps[AARCH64_MAX_HW_BREAKPOINTS]; + // Number of HW Breakpoints in the platform. + // Will be set on read and ignored on write. + + struct { + uint32_t dbgwcr; // HW Watchpoint Control register. + uint8_t padding1[4]; + uint64_t dbgwvr; // HW Watchpoint Value register. + } hw_wps[AARCH64_MAX_HW_WATCHPOINTS]; + + // Faulting Virtual Address for watchpoint exceptions. + // Read-only, values are ignored on write. + uint64_t far; + + // The esr value since the last exception. + // Read-only, values are ignored on write. + uint32_t esr; + + // Number of HW Breakpoints/Watchpoints in the platform. + // Will be set on read and ignored on write. + uint8_t hw_bps_count; + uint8_t hw_wps_count; + + uint8_t padding1[2]; + +} zx_thread_state_debug_regs_t; + +#endif + +// Value for ZX_THREAD_STATE_SINGLE_STEP. The value can be 0 (not single-stepping), or 1 +// (single-stepping). Other values will give ZX_ERR_INVALID_ARGS. +typedef uint32_t zx_thread_state_single_step_t; + +// Values for ZX_THREAD_X86_REGISTER_FS and ZX_THREAD_X86_REGISTER_GS; +typedef uint64_t zx_thread_x86_register_fs_t; +typedef uint64_t zx_thread_x86_register_gs_t; + +// Possible values for "kind" in zx_thread_read_state and zx_thread_write_state. +typedef uint32_t zx_thread_state_topic_t; +#define ZX_THREAD_STATE_GENERAL_REGS ((uint32_t)0) // zx_thread_state_general_regs_t value. +#define ZX_THREAD_STATE_FP_REGS ((uint32_t)1) // zx_thread_state_fp_regs_t value. +#define ZX_THREAD_STATE_VECTOR_REGS ((uint32_t)2) // zx_thread_state_vector_regs_t value. +#define ZX_THREAD_STATE_DEBUG_REGS ((uint32_t)4) // zx_thread_state_debug_regs_t value. +#define ZX_THREAD_STATE_SINGLE_STEP ((uint32_t)5) // zx_thread_state_single_step_t value. +#define ZX_THREAD_X86_REGISTER_FS ((uint32_t)6) // zx_thread_x86_register_fs_t value. +#define ZX_THREAD_X86_REGISTER_GS ((uint32_t)7) // zx_thread_x86_register_gs_t value. + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_DEBUG_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/exception.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/exception.h new file mode 100644 index 0000000..6191e0f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/exception.h
@@ -0,0 +1,136 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_EXCEPTION_H_ +#define SYSROOT_ZIRCON_SYSCALLS_EXCEPTION_H_ + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +// The following exception values were chosen for historical reasons. + +// Architectural exceptions. +// +// Depending on the exception, further information can be found in +// |report.context.arch|. + +#define ZX_EXCP_GENERAL ((uint32_t) 0x008u) +#define ZX_EXCP_FATAL_PAGE_FAULT ((uint32_t) 0x108u) +#define ZX_EXCP_UNDEFINED_INSTRUCTION ((uint32_t) 0x208u) +#define ZX_EXCP_SW_BREAKPOINT ((uint32_t) 0x308u) +#define ZX_EXCP_HW_BREAKPOINT ((uint32_t) 0x408u) +#define ZX_EXCP_UNALIGNED_ACCESS ((uint32_t) 0x508u) + +// Synthetic exceptions. + +// These bits are set for synthetic exceptions to distinguish them from +// architectural exceptions. +#define ZX_EXCP_SYNTH ((uint32_t) 0x8000u) + +// A thread is starting. +// This exception is sent to debuggers only (ZX_EXCEPTION_CHANNEL_TYPE_DEBUGGER). +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_THREAD_STARTING ((uint32_t) 0x008u | ZX_EXCP_SYNTH) + +// A thread is exiting. +// This exception is sent to debuggers only (ZX_EXCEPTION_CHANNEL_TYPE_DEBUGGER). +// This exception is different from ZX_EXCP_GONE in that a debugger can +// still examine thread state. +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_THREAD_EXITING ((uint32_t) 0x108u | ZX_EXCP_SYNTH) + +// This exception is generated when a syscall fails with a job policy +// error (for example, an invalid handle argument is passed to the +// syscall when the ZX_POL_BAD_HANDLE policy is enabled) and +// ZX_POL_ACTION_EXCEPTION is set for the policy. +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_POLICY_ERROR ((uint32_t) 0x208u | ZX_EXCP_SYNTH) + +// A process is starting. +// This exception is sent to job debuggers only +// (ZX_EXCEPTION_CHANNEL_TYPE_JOB_DEBUGGER). +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_PROCESS_STARTING ((uint32_t) 0x308u | ZX_EXCP_SYNTH) + +typedef uint32_t zx_excp_type_t; + +// Assuming |excp| is an exception type, the following returns true if the +// type is architectural. +#define ZX_EXCP_IS_ARCH(excp) (((excp) & ZX_EXCP_SYNTH) == 0) + +typedef struct zx_x86_64_exc_data { + uint64_t vector; + uint64_t err_code; + uint64_t cr2; +} zx_x86_64_exc_data_t; + +typedef struct zx_arm64_exc_data { + uint32_t esr; + uint8_t padding1[4]; + uint64_t far; +} zx_arm64_exc_data_t; + +// data associated with an exception (siginfo in linux parlance) +// Things available from regsets (e.g., pc) are not included here. +// For an example list of things one might add, see linux siginfo. +typedef struct zx_exception_context { + struct { + union { + zx_x86_64_exc_data_t x86_64; + struct { + zx_arm64_exc_data_t arm_64; + uint8_t padding1[8]; + }; + } u; + } arch; +} zx_exception_context_t; + +// The common header of all exception reports. +typedef struct zx_exception_header { + // The actual size, in bytes, of the report (including this field). + uint32_t size; + + zx_excp_type_t type; +} zx_exception_header_t; + +// Data reported to an exception handler for most exceptions. +typedef struct zx_exception_report { + zx_exception_header_t header; + // The remainder of the report is exception-specific. + zx_exception_context_t context; +} zx_exception_report_t; + +// Basic info sent along with the handle over an exception channel. +typedef struct zx_exception_info { + zx_koid_t pid; + zx_koid_t tid; + zx_excp_type_t type; + uint8_t padding1[4]; +} zx_exception_info_t; + +// Options for zx_create_exception_channel. +// When creating an exception channel, use the task's debug channel. +#define ZX_EXCEPTION_CHANNEL_DEBUGGER ((uint32_t)1) + +// The type of exception handler a thread may be waiting for a response from. +// These values are reported in zx_info_thread_t.wait_exception_channel_type. +#define ZX_EXCEPTION_CHANNEL_TYPE_NONE ((uint32_t)0u) +#define ZX_EXCEPTION_CHANNEL_TYPE_DEBUGGER ((uint32_t)1u) +#define ZX_EXCEPTION_CHANNEL_TYPE_THREAD ((uint32_t)2u) +#define ZX_EXCEPTION_CHANNEL_TYPE_PROCESS ((uint32_t)3u) +#define ZX_EXCEPTION_CHANNEL_TYPE_JOB ((uint32_t)4u) +#define ZX_EXCEPTION_CHANNEL_TYPE_JOB_DEBUGGER ((uint32_t)5u) + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_EXCEPTION_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h new file mode 100644 index 0000000..f574d4e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h
@@ -0,0 +1,78 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_HYPERVISOR_H_ +#define SYSROOT_ZIRCON_SYSCALLS_HYPERVISOR_H_ + +#include <assert.h> + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// clang-format off +typedef uint32_t zx_guest_trap_t; + +#define ZX_GUEST_TRAP_BELL ((zx_guest_trap_t) 0u) +#define ZX_GUEST_TRAP_MEM ((zx_guest_trap_t) 1u) +#define ZX_GUEST_TRAP_IO ((zx_guest_trap_t) 2u) + +typedef uint32_t zx_vcpu_t; + +#define ZX_VCPU_STATE ((zx_vcpu_t) 0u) +#define ZX_VCPU_IO ((zx_vcpu_t) 1u) +// clang-format on + +// Structure to read and write VCPU state. +typedef struct zx_vcpu_state { +#if __aarch64__ + uint64_t x[31]; + uint64_t sp; + // Contains only the user-controllable upper 4-bits (NZCV). + uint32_t cpsr; + uint8_t padding1[4]; +#elif __x86_64__ + uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t rbx; + uint64_t rsp; + uint64_t rbp; + uint64_t rsi; + uint64_t rdi; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + // Contains only the user-controllable lower 32-bits. + uint64_t rflags; +#endif +} zx_vcpu_state_t; + +// Structure to read and write VCPU state for IO ports. +typedef struct zx_vcpu_io { + uint8_t access_size; + uint8_t padding1[3]; + union { + struct { + uint8_t u8; + uint8_t padding2[3]; + }; + struct { + uint16_t u16; + uint8_t padding3[2]; + }; + uint32_t u32; + uint8_t data[4]; + }; +} zx_vcpu_io_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_HYPERVISOR_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/internal/cdecls.inc b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/internal/cdecls.inc new file mode 100644 index 0000000..1a14308 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/internal/cdecls.inc
@@ -0,0 +1,1057 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// WARNING: THIS FILE IS MACHINE GENERATED BY //tools/kazoo. DO NOT EDIT. + +#ifndef _ZX_SYSCALL_DECL +#error "<zircon/syscalls.h> is the public API header" +#endif + +_ZX_SYSCALL_DECL(bti_create, zx_status_t, /* no attributes */, 4, + (iommu, options, bti_id, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t iommu, + uint32_t options, + uint64_t bti_id, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(bti_pin, zx_status_t, /* no attributes */, 8, + (handle, options, vmo, offset, size, addrs, num_addrs, pmt), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + uint64_t offset, + uint64_t size, + zx_paddr_t* addrs, + size_t num_addrs, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* pmt)) + +_ZX_SYSCALL_DECL(bti_release_quarantine, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(cache_flush, zx_status_t, /* no attributes */, 3, + (addr, size, options), ( + const void* addr, + size_t size, + uint32_t options)) + +_ZX_SYSCALL_DECL(channel_create, zx_status_t, /* no attributes */, 3, + (options, out0, out1), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(channel_read, zx_status_t, /* no attributes */, 8, + (handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles), ( + _ZX_SYSCALL_ANNO(use_handle("FuchsiaUnchecked")) zx_handle_t handle, + uint32_t options, + void* bytes, + _ZX_SYSCALL_ANNO(acquire_handle("FuchsiaUnchecked")) zx_handle_t* handles, + uint32_t num_bytes, + uint32_t num_handles, + uint32_t* actual_bytes, + uint32_t* actual_handles)) + +_ZX_SYSCALL_DECL(channel_read_etc, zx_status_t, /* no attributes */, 8, + (handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + void* bytes, + zx_handle_info_t* handles, + uint32_t num_bytes, + uint32_t num_handles, + uint32_t* actual_bytes, + uint32_t* actual_handles)) + +_ZX_SYSCALL_DECL(channel_write, zx_status_t, /* no attributes */, 6, + (handle, options, bytes, num_bytes, handles, num_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* bytes, + uint32_t num_bytes, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) const zx_handle_t* handles, + uint32_t num_handles)) + +_ZX_SYSCALL_DECL(channel_write_etc, zx_status_t, /* no attributes */, 6, + (handle, options, bytes, num_bytes, handles, num_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* bytes, + uint32_t num_bytes, + zx_handle_disposition_t* handles, + uint32_t num_handles)) + +_ZX_SYSCALL_DECL(channel_call, zx_status_t, /* no attributes */, 6, + (handle, options, deadline, args, actual_bytes, actual_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_time_t deadline, + const zx_channel_call_args_t* args, + uint32_t* actual_bytes, + uint32_t* actual_handles)) + +_ZX_SYSCALL_DECL(clock_get, zx_status_t, /* no attributes */, 2, + (clock_id, out), ( + zx_clock_t clock_id, + zx_time_t* out)) + +_ZX_SYSCALL_DECL(clock_get_monotonic, zx_time_t, /* no attributes */, 0, + (), (void)) + +_ZX_SYSCALL_DECL(clock_adjust, zx_status_t, /* no attributes */, 3, + (handle, clock_id, offset), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_clock_t clock_id, + int64_t offset)) + +_ZX_SYSCALL_DECL(clock_create, zx_status_t, /* no attributes */, 3, + (options, args, out), ( + uint64_t options, + const void* args, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(clock_read, zx_status_t, /* no attributes */, 2, + (handle, now), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t* now)) + +_ZX_SYSCALL_DECL(clock_get_details, zx_status_t, /* no attributes */, 3, + (handle, options, details), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t options, + void* details)) + +_ZX_SYSCALL_DECL(clock_update, zx_status_t, /* no attributes */, 3, + (handle, options, args), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t options, + const void* args)) + +_ZX_SYSCALL_DECL(cprng_draw, void, /* no attributes */, 2, + (buffer, buffer_size), ( + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(cprng_add_entropy, zx_status_t, /* no attributes */, 2, + (buffer, buffer_size), ( + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debug_read, zx_status_t, /* no attributes */, 4, + (handle, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + char* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(debug_write, zx_status_t, /* no attributes */, 2, + (buffer, buffer_size), ( + const char* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debug_send_command, zx_status_t, /* no attributes */, 3, + (resource, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + const char* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debuglog_create, zx_status_t, /* no attributes */, 3, + (resource, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(debuglog_write, zx_status_t, /* no attributes */, 4, + (handle, options, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debuglog_read, zx_status_t, /* no attributes */, 4, + (handle, options, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(event_create, zx_status_t, /* no attributes */, 2, + (options, out), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(eventpair_create, zx_status_t, /* no attributes */, 3, + (options, out0, out1), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(exception_get_thread, zx_status_t, /* no attributes */, 2, + (handle, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(exception_get_process, zx_status_t, /* no attributes */, 2, + (handle, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(fifo_create, zx_status_t, /* no attributes */, 5, + (elem_count, elem_size, options, out0, out1), ( + size_t elem_count, + size_t elem_size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(fifo_read, zx_status_t, /* no attributes */, 5, + (handle, elem_size, data, data_size, actual_count), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + size_t elem_size, + void* data, + size_t data_size, + size_t* actual_count)) + +_ZX_SYSCALL_DECL(fifo_write, zx_status_t, /* no attributes */, 5, + (handle, elem_size, data, count, actual_count), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + size_t elem_size, + const void* data, + size_t count, + size_t* actual_count)) + +_ZX_SYSCALL_DECL(framebuffer_get_info, zx_status_t, /* no attributes */, 5, + (resource, format, width, height, stride), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t* format, + uint32_t* width, + uint32_t* height, + uint32_t* stride)) + +_ZX_SYSCALL_DECL(framebuffer_set_range, zx_status_t, /* no attributes */, 7, + (resource, vmo, len, format, width, height, stride), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + uint32_t len, + uint32_t format, + uint32_t width, + uint32_t height, + uint32_t stride)) + +_ZX_SYSCALL_DECL(futex_wait, zx_status_t, /* no attributes */, 4, + (value_ptr, current_value, new_futex_owner, deadline), ( + const zx_futex_t* value_ptr, + zx_futex_t current_value, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t new_futex_owner, + zx_time_t deadline)) + +_ZX_SYSCALL_DECL(futex_wake, zx_status_t, /* no attributes */, 2, + (value_ptr, wake_count), ( + const zx_futex_t* value_ptr, + uint32_t wake_count)) + +_ZX_SYSCALL_DECL(futex_requeue, zx_status_t, /* no attributes */, 6, + (value_ptr, wake_count, current_value, requeue_ptr, requeue_count, new_requeue_owner), ( + const zx_futex_t* value_ptr, + uint32_t wake_count, + zx_futex_t current_value, + const zx_futex_t* requeue_ptr, + uint32_t requeue_count, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t new_requeue_owner)) + +_ZX_SYSCALL_DECL(futex_wake_single_owner, zx_status_t, /* no attributes */, 1, + (value_ptr), ( + const zx_futex_t* value_ptr)) + +_ZX_SYSCALL_DECL(futex_requeue_single_owner, zx_status_t, /* no attributes */, 5, + (value_ptr, current_value, requeue_ptr, requeue_count, new_requeue_owner), ( + const zx_futex_t* value_ptr, + zx_futex_t current_value, + const zx_futex_t* requeue_ptr, + uint32_t requeue_count, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t new_requeue_owner)) + +_ZX_SYSCALL_DECL(futex_get_owner, zx_status_t, /* no attributes */, 2, + (value_ptr, koid), ( + const zx_futex_t* value_ptr, + zx_koid_t* koid)) + +_ZX_SYSCALL_DECL(guest_create, zx_status_t, /* no attributes */, 4, + (resource, options, guest_handle, vmar_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* guest_handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* vmar_handle)) + +_ZX_SYSCALL_DECL(guest_set_trap, zx_status_t, /* no attributes */, 6, + (handle, kind, addr, size, port_handle, key), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + zx_vaddr_t addr, + size_t size, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port_handle, + uint64_t key)) + +_ZX_SYSCALL_DECL(handle_close, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(handle_close_many, zx_status_t, /* no attributes */, 2, + (handles, num_handles), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) const zx_handle_t* handles, + size_t num_handles)) + +_ZX_SYSCALL_DECL(handle_duplicate, zx_status_t, /* no attributes */, 3, + (handle, rights, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_rights_t rights, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(handle_replace, zx_status_t, /* no attributes */, 3, + (handle, rights, out), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t handle, + zx_rights_t rights, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(interrupt_create, zx_status_t, /* no attributes */, 4, + (src_obj, src_num, options, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t src_obj, + uint32_t src_num, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(interrupt_bind, zx_status_t, /* no attributes */, 4, + (handle, port_handle, key, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port_handle, + uint64_t key, + uint32_t options)) + +_ZX_SYSCALL_DECL(interrupt_wait, zx_status_t, /* no attributes */, 2, + (handle, out_timestamp), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t* out_timestamp)) + +_ZX_SYSCALL_DECL(interrupt_destroy, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(interrupt_ack, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(interrupt_trigger, zx_status_t, /* no attributes */, 3, + (handle, options, timestamp), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_time_t timestamp)) + +_ZX_SYSCALL_DECL(interrupt_bind_vcpu, zx_status_t, /* no attributes */, 3, + (handle, vcpu, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vcpu, + uint32_t options)) + +_ZX_SYSCALL_DECL(iommu_create, zx_status_t, /* no attributes */, 5, + (resource, type, desc, desc_size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t type, + const void* desc, + size_t desc_size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(ioports_request, zx_status_t, /* no attributes */, 3, + (resource, io_addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint16_t io_addr, + uint32_t len)) + +_ZX_SYSCALL_DECL(ioports_release, zx_status_t, /* no attributes */, 3, + (resource, io_addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint16_t io_addr, + uint32_t len)) + +_ZX_SYSCALL_DECL(job_create, zx_status_t, /* no attributes */, 3, + (parent_job, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t parent_job, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(job_set_policy, zx_status_t, /* no attributes */, 5, + (handle, options, topic, policy, policy_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + uint32_t topic, + const void* policy, + uint32_t policy_size)) + +_ZX_SYSCALL_DECL(job_set_critical, zx_status_t, /* no attributes */, 3, + (job, options, process), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t job, + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t process)) + +_ZX_SYSCALL_DECL(ktrace_read, zx_status_t, /* no attributes */, 5, + (handle, data, offset, data_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + void* data, + uint32_t offset, + size_t data_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(ktrace_control, zx_status_t, /* no attributes */, 4, + (handle, action, options, ptr), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t action, + uint32_t options, + void* ptr)) + +_ZX_SYSCALL_DECL(ktrace_write, zx_status_t, /* no attributes */, 4, + (handle, id, arg0, arg1), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t id, + uint32_t arg0, + uint32_t arg1)) + +_ZX_SYSCALL_DECL(nanosleep, zx_status_t, /* no attributes */, 1, + (deadline), ( + zx_time_t deadline)) + +_ZX_SYSCALL_DECL(ticks_get, zx_ticks_t, /* no attributes */, 0, + (), (void)) + +_ZX_SYSCALL_DECL(ticks_per_second, zx_ticks_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(deadline_after, zx_time_t, /* no attributes */, 1, + (nanoseconds), ( + zx_duration_t nanoseconds)) + +_ZX_SYSCALL_DECL(vmar_unmap_handle_close_thread_exit, zx_status_t, /* no attributes */, 4, + (vmar_handle, addr, size, close_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmar_handle, + zx_vaddr_t addr, + size_t size, + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t close_handle)) + +_ZX_SYSCALL_DECL(futex_wake_handle_close_thread_exit, void, __NO_RETURN, 4, + (value_ptr, wake_count, new_value, close_handle), ( + const zx_futex_t* value_ptr, + uint32_t wake_count, + int32_t new_value, + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t close_handle)) + +_ZX_SYSCALL_DECL(mtrace_control, zx_status_t, /* no attributes */, 6, + (handle, kind, action, options, ptr, ptr_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + uint32_t action, + uint32_t options, + void* ptr, + size_t ptr_size)) + +_ZX_SYSCALL_DECL(object_wait_one, zx_status_t, /* no attributes */, 4, + (handle, signals, deadline, observed), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_signals_t signals, + zx_time_t deadline, + zx_signals_t* observed)) + +_ZX_SYSCALL_DECL(object_wait_many, zx_status_t, /* no attributes */, 3, + (items, num_items, deadline), ( + zx_wait_item_t* items, + size_t num_items, + zx_time_t deadline)) + +_ZX_SYSCALL_DECL(object_wait_async, zx_status_t, /* no attributes */, 5, + (handle, port, key, signals, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port, + uint64_t key, + zx_signals_t signals, + uint32_t options)) + +_ZX_SYSCALL_DECL(object_signal, zx_status_t, /* no attributes */, 3, + (handle, clear_mask, set_mask), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t clear_mask, + uint32_t set_mask)) + +_ZX_SYSCALL_DECL(object_signal_peer, zx_status_t, /* no attributes */, 3, + (handle, clear_mask, set_mask), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t clear_mask, + uint32_t set_mask)) + +_ZX_SYSCALL_DECL(object_get_property, zx_status_t, /* no attributes */, 4, + (handle, property, value, value_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t property, + void* value, + size_t value_size)) + +_ZX_SYSCALL_DECL(object_set_property, zx_status_t, /* no attributes */, 4, + (handle, property, value, value_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t property, + const void* value, + size_t value_size)) + +_ZX_SYSCALL_DECL(object_get_info, zx_status_t, /* no attributes */, 6, + (handle, topic, buffer, buffer_size, actual, avail), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t topic, + void* buffer, + size_t buffer_size, + size_t* actual, + size_t* avail)) + +_ZX_SYSCALL_DECL(object_get_child, zx_status_t, /* no attributes */, 4, + (handle, koid, rights, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t koid, + zx_rights_t rights, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(object_set_profile, zx_status_t, /* no attributes */, 3, + (handle, profile, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t profile, + uint32_t options)) + +_ZX_SYSCALL_DECL(pager_create, zx_status_t, /* no attributes */, 2, + (options, out), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(pager_create_vmo, zx_status_t, /* no attributes */, 6, + (pager, options, port, key, size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager, + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port, + uint64_t key, + uint64_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(pager_detach_vmo, zx_status_t, /* no attributes */, 2, + (pager, vmo), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo)) + +_ZX_SYSCALL_DECL(pager_supply_pages, zx_status_t, /* no attributes */, 6, + (pager, pager_vmo, offset, length, aux_vmo, aux_offset), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager_vmo, + uint64_t offset, + uint64_t length, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t aux_vmo, + uint64_t aux_offset)) + +_ZX_SYSCALL_DECL(pc_firmware_tables, zx_status_t, /* no attributes */, 3, + (handle, acpi_rsdp, smbios), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_paddr_t* acpi_rsdp, + zx_paddr_t* smbios)) + +_ZX_SYSCALL_DECL(pci_get_nth_device, zx_status_t, /* no attributes */, 4, + (handle, index, out_info, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t index, + zx_pcie_device_info_t* out_info, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(pci_enable_bus_master, zx_status_t, /* no attributes */, 2, + (handle, enable), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + bool enable)) + +_ZX_SYSCALL_DECL(pci_reset_device, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(pci_config_read, zx_status_t, /* no attributes */, 4, + (handle, offset, width, out_val), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint16_t offset, + size_t width, + uint32_t* out_val)) + +_ZX_SYSCALL_DECL(pci_config_write, zx_status_t, /* no attributes */, 4, + (handle, offset, width, val), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint16_t offset, + size_t width, + uint32_t val)) + +_ZX_SYSCALL_DECL(pci_cfg_pio_rw, zx_status_t, /* no attributes */, 8, + (handle, bus, dev, func, offset, val, width, write), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint8_t bus, + uint8_t dev, + uint8_t func, + uint8_t offset, + uint32_t* val, + size_t width, + bool write)) + +_ZX_SYSCALL_DECL(pci_get_bar, zx_status_t, /* no attributes */, 4, + (handle, bar_num, out_bar, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t bar_num, + zx_pci_bar_t* out_bar, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(pci_map_interrupt, zx_status_t, /* no attributes */, 3, + (handle, which_irq, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + int32_t which_irq, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(pci_query_irq_mode, zx_status_t, /* no attributes */, 3, + (handle, mode, out_max_irqs), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t mode, + uint32_t* out_max_irqs)) + +_ZX_SYSCALL_DECL(pci_set_irq_mode, zx_status_t, /* no attributes */, 3, + (handle, mode, requested_irq_count), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t mode, + uint32_t requested_irq_count)) + +_ZX_SYSCALL_DECL(pci_init, zx_status_t, /* no attributes */, 3, + (handle, init_buf, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const zx_pci_init_arg_t* init_buf, + uint32_t len)) + +_ZX_SYSCALL_DECL(pci_add_subtract_io_range, zx_status_t, /* no attributes */, 5, + (handle, mmio, base, len, add), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + bool mmio, + uint64_t base, + uint64_t len, + bool add)) + +_ZX_SYSCALL_DECL(pmt_unpin, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(port_create, zx_status_t, /* no attributes */, 2, + (options, out), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(port_queue, zx_status_t, /* no attributes */, 2, + (handle, packet), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const zx_port_packet_t* packet)) + +_ZX_SYSCALL_DECL(port_wait, zx_status_t, /* no attributes */, 3, + (handle, deadline, packet), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t deadline, + zx_port_packet_t* packet)) + +_ZX_SYSCALL_DECL(port_cancel, zx_status_t, /* no attributes */, 3, + (handle, source, key), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t source, + uint64_t key)) + +_ZX_SYSCALL_DECL(process_exit, void, __NO_RETURN, 1, + (retcode), ( + int64_t retcode)) + +_ZX_SYSCALL_DECL(process_create, zx_status_t, /* no attributes */, 6, + (job, name, name_size, options, proc_handle, vmar_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t job, + const char* name, + size_t name_size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* proc_handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* vmar_handle)) + +_ZX_SYSCALL_DECL(process_start, zx_status_t, /* no attributes */, 6, + (handle, thread, entry, stack, arg1, arg2), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t thread, + zx_vaddr_t entry, + zx_vaddr_t stack, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t arg1, + uintptr_t arg2)) + +_ZX_SYSCALL_DECL(process_read_memory, zx_status_t, /* no attributes */, 5, + (handle, vaddr, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t vaddr, + void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(process_write_memory, zx_status_t, /* no attributes */, 5, + (handle, vaddr, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t vaddr, + const void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(profile_create, zx_status_t, /* no attributes */, 4, + (root_job, options, profile, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t root_job, + uint32_t options, + const zx_profile_info_t* profile, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(resource_create, zx_status_t, /* no attributes */, 7, + (parent_rsrc, options, base, size, name, name_size, resource_out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t parent_rsrc, + uint32_t options, + uint64_t base, + size_t size, + const char* name, + size_t name_size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* resource_out)) + +_ZX_SYSCALL_DECL(smc_call, zx_status_t, /* no attributes */, 3, + (handle, parameters, out_smc_result), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const zx_smc_parameters_t* parameters, + zx_smc_result_t* out_smc_result)) + +_ZX_SYSCALL_DECL(socket_create, zx_status_t, /* no attributes */, 3, + (options, out0, out1), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(socket_write, zx_status_t, /* no attributes */, 5, + (handle, options, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(socket_read, zx_status_t, /* no attributes */, 5, + (handle, options, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(socket_shutdown, zx_status_t, /* no attributes */, 2, + (handle, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options)) + +_ZX_SYSCALL_DECL(stream_create, zx_status_t, /* no attributes */, 4, + (options, vmo, seek, out_stream), ( + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + zx_off_t seek, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_stream)) + +_ZX_SYSCALL_DECL(stream_writev, zx_status_t, /* no attributes */, 5, + (handle, options, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_writev_at, zx_status_t, /* no attributes */, 6, + (handle, options, offset, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_off_t offset, + const zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_readv, zx_status_t, /* no attributes */, 5, + (handle, options, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_readv_at, zx_status_t, /* no attributes */, 6, + (handle, options, offset, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_off_t offset, + zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_seek, zx_status_t, /* no attributes */, 4, + (handle, whence, offset, out_seek), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_stream_seek_origin_t whence, + int64_t offset, + zx_off_t* out_seek)) + +_ZX_SYSCALL_DECL(system_get_dcache_line_size, uint32_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_num_cpus, uint32_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_version_string, zx_string_view_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_physmem, uint64_t, /* no attributes */, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_features, zx_status_t, /* no attributes */, 2, + (kind, features), ( + uint32_t kind, + uint32_t* features)) + +_ZX_SYSCALL_DECL(system_get_event, zx_status_t, /* no attributes */, 3, + (root_job, kind, event), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t root_job, + uint32_t kind, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* event)) + +_ZX_SYSCALL_DECL(system_mexec, zx_status_t, /* no attributes */, 3, + (resource, kernel_vmo, bootimage_vmo), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t kernel_vmo, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t bootimage_vmo)) + +_ZX_SYSCALL_DECL(system_mexec_payload_get, zx_status_t, /* no attributes */, 3, + (resource, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(system_powerctl, zx_status_t, /* no attributes */, 3, + (resource, cmd, arg), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t cmd, + const zx_system_powerctl_arg_t* arg)) + +_ZX_SYSCALL_DECL(task_suspend, zx_status_t, /* no attributes */, 2, + (handle, token), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* token)) + +_ZX_SYSCALL_DECL(task_suspend_token, zx_status_t, /* no attributes */, 2, + (handle, token), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* token)) + +_ZX_SYSCALL_DECL(task_create_exception_channel, zx_status_t, /* no attributes */, 3, + (handle, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(task_kill, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(thread_exit, void, __NO_RETURN, 0, + (), (void)) + +_ZX_SYSCALL_DECL(thread_create, zx_status_t, /* no attributes */, 5, + (process, name, name_size, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t process, + const char* name, + size_t name_size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(thread_start, zx_status_t, /* no attributes */, 5, + (handle, thread_entry, stack, arg1, arg2), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t thread_entry, + zx_vaddr_t stack, + uintptr_t arg1, + uintptr_t arg2)) + +_ZX_SYSCALL_DECL(thread_read_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(thread_write_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(timer_create, zx_status_t, /* no attributes */, 3, + (options, clock_id, out), ( + uint32_t options, + zx_clock_t clock_id, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(timer_set, zx_status_t, /* no attributes */, 3, + (handle, deadline, slack), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t deadline, + zx_duration_t slack)) + +_ZX_SYSCALL_DECL(timer_cancel, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(vcpu_create, zx_status_t, /* no attributes */, 4, + (guest, options, entry, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t guest, + uint32_t options, + zx_vaddr_t entry, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vcpu_resume, zx_status_t, /* no attributes */, 2, + (handle, packet), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_port_packet_t* packet)) + +_ZX_SYSCALL_DECL(vcpu_interrupt, zx_status_t, /* no attributes */, 2, + (handle, vector), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t vector)) + +_ZX_SYSCALL_DECL(vcpu_read_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vcpu_write_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmar_allocate, zx_status_t, /* no attributes */, 6, + (parent_vmar, options, offset, size, child_vmar, child_addr), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t parent_vmar, + zx_vm_option_t options, + size_t offset, + size_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* child_vmar, + zx_vaddr_t* child_addr)) + +_ZX_SYSCALL_DECL(vmar_destroy, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(vmar_map, zx_status_t, /* no attributes */, 7, + (handle, options, vmar_offset, vmo, vmo_offset, len, mapped_addr), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vm_option_t options, + size_t vmar_offset, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + uint64_t vmo_offset, + size_t len, + zx_vaddr_t* mapped_addr)) + +_ZX_SYSCALL_DECL(vmar_unmap, zx_status_t, /* no attributes */, 3, + (handle, addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t addr, + size_t len)) + +_ZX_SYSCALL_DECL(vmar_protect, zx_status_t, /* no attributes */, 4, + (handle, options, addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vm_option_t options, + zx_vaddr_t addr, + size_t len)) + +_ZX_SYSCALL_DECL(vmar_op_range, zx_status_t, /* no attributes */, 6, + (handle, op, address, size, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t op, + zx_vaddr_t address, + size_t size, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_create, zx_status_t, /* no attributes */, 3, + (size, options, out), ( + uint64_t size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_read, zx_status_t, /* no attributes */, 4, + (handle, buffer, offset, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + void* buffer, + uint64_t offset, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_write, zx_status_t, /* no attributes */, 4, + (handle, buffer, offset, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const void* buffer, + uint64_t offset, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_get_size, zx_status_t, /* no attributes */, 2, + (handle, size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t* size)) + +_ZX_SYSCALL_DECL(vmo_set_size, zx_status_t, /* no attributes */, 2, + (handle, size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t size)) + +_ZX_SYSCALL_DECL(vmo_op_range, zx_status_t, /* no attributes */, 6, + (handle, op, offset, size, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t op, + uint64_t offset, + uint64_t size, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_create_child, zx_status_t, /* no attributes */, 5, + (handle, options, offset, size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + uint64_t offset, + uint64_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_set_cache_policy, zx_status_t, /* no attributes */, 2, + (handle, cache_policy), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t cache_policy)) + +_ZX_SYSCALL_DECL(vmo_replace_as_executable, zx_status_t, /* no attributes */, 3, + (handle, vmex, out), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmex, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_create_contiguous, zx_status_t, /* no attributes */, 4, + (bti, size, alignment_log2, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t bti, + size_t size, + uint32_t alignment_log2, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_create_physical, zx_status_t, /* no attributes */, 4, + (resource, paddr, size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + zx_paddr_t paddr, + size_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) +
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/iommu.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/iommu.h new file mode 100644 index 0000000..708b606 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/iommu.h
@@ -0,0 +1,97 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_IOMMU_H_ +#define SYSROOT_ZIRCON_SYSCALLS_IOMMU_H_ + +#include <assert.h> +#include <stdbool.h> +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +#define ZX_IOMMU_MAX_DESC_LEN 4096 + +// Values for the |type| argument of the zx_iommu_create() syscall. +#define ZX_IOMMU_TYPE_DUMMY 0 +#define ZX_IOMMU_TYPE_INTEL 1 + +// Data structures for creating a dummy IOMMU instance +typedef struct zx_iommu_desc_dummy { + uint8_t reserved; +} zx_iommu_desc_dummy_t; + +// Data structures for creating an Intel IOMMU instance + +// This scope represents a single PCI endpoint device +#define ZX_IOMMU_INTEL_SCOPE_ENDPOINT 0 +// This scope represents a PCI-PCI bridge. The bridge and all of its downstream +// devices will be included in this scope. +#define ZX_IOMMU_INTEL_SCOPE_BRIDGE 1 + +// TODO(teisenbe): Investigate FIDL for this. Multiple embedded lists seems +// right up its alley. +typedef struct zx_iommu_desc_intel_scope { + uint8_t type; + // The bus number of the first bus decoded by the host bridge this scope is attached to. + uint8_t start_bus; + // Number of bridges (including the host bridge) between host bridge and the + // device. + uint8_t num_hops; + // The device number and function numbers of the bridges along the way, + // ending with the device itself. + // |dev_func[0]| is the address on |start_bus| of the first bridge in the + // path (excluding the host bridge). |dev_func[num_hops-1]| is the address + // of the device itself. + uint8_t dev_func[5]; +} zx_iommu_desc_intel_scope_t; + +typedef struct zx_iommu_desc_intel_reserved_memory { + uint64_t base_addr; // Physical address of the base of reserved memory. + uint64_t len; // Number of bytes of reserved memory. + + // The number of bytes of zx_iommu_desc_intel_scope_t's that follow this descriptor. + uint8_t scope_bytes; + + uint8_t _reserved[7]; // Padding + + // This is a list of all devices that need access to this memory range. + // + // zx_iommu_desc_intel_scope_t scopes[num_scopes]; +} zx_iommu_desc_intel_reserved_memory_t; + +typedef struct zx_iommu_desc_intel { + uint64_t register_base; // Physical address of registers + uint16_t pci_segment; // The PCI segment associated with this IOMMU + + // If true, this IOMMU has all PCI devices in its segment under its scope. + // In this case, the list of scopes acts as a blacklist. + bool whole_segment; + + // The number of bytes of zx_iommu_desc_intel_scope_t's that follow this descriptor. + uint8_t scope_bytes; + + // The number of bytes of zx_iommu_desc_intel_reserved_memory_t's that follow the scope + // list. + uint16_t reserved_memory_bytes; + + uint8_t _reserved[2]; // Padding + + // If |whole_segment| is false, this is a list of all devices managed by + // this IOMMU. If |whole_segment| is true, this is a list of all devices on + // this segment *not* managed by this IOMMU. It has a total length in bytes of + // |scope_bytes|. + // + // zx_iommu_desc_intel_scope_t scopes[]; + + // A list of all BIOS-reserved memory regions this IOMMU needs to translate. + // It has a total length in bytes of |reserved_memory_bytes|. + // + // zx_iommu_desc_intel_reserved_memory_t reserved_mem[]; +} zx_iommu_desc_intel_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_IOMMU_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/log.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/log.h new file mode 100644 index 0000000..0ea4c04 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/log.h
@@ -0,0 +1,58 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_LOG_H_ +#define SYSROOT_ZIRCON_SYSCALLS_LOG_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Defines and structures for zx_log_*() +typedef struct zx_log_record { + uint32_t reserved; + uint16_t datalen; + uint16_t flags; + zx_time_t timestamp; + uint64_t pid; + uint64_t tid; + char data[]; +} zx_log_record_t; + +// ask clang format not to mess up the indentation: +// clang-format off + +#define ZX_LOG_RECORD_MAX 256 + +// Common Log Levels +#define ZX_LOG_ERROR (0x0001) +#define ZX_LOG_WARN (0x0002) +#define ZX_LOG_INFO (0x0004) + +// Verbose log levels +#define ZX_LOG_TRACE (0x0010) +#define ZX_LOG_SPEW (0x0020) + +// Custom Log Levels +#define ZX_LOG_DEBUG1 (0x0100) +#define ZX_LOG_DEBUG2 (0x0200) +#define ZX_LOG_DEBUG3 (0x0400) +#define ZX_LOG_DEBUG4 (0x0800) + +// Filter Flags + +// Do not forward this message via network +// (for logging in network core and drivers) +#define ZX_LOG_LOCAL (0x1000) + +#define ZX_LOG_LEVEL_MASK (0x0FFF) +#define ZX_LOG_FLAGS_MASK (0xFFFF) + +// Options + +#define ZX_LOG_FLAG_READABLE 0x40000000 + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_LOG_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/object.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/object.h new file mode 100644 index 0000000..7139ffe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/object.h
@@ -0,0 +1,685 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_OBJECT_H_ +#define SYSROOT_ZIRCON_SYSCALLS_OBJECT_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +// Valid topics for zx_object_get_info. +typedef uint32_t zx_object_info_topic_t; +#define ZX_INFO_NONE ((zx_object_info_topic_t) 0u) +#define ZX_INFO_HANDLE_VALID ((zx_object_info_topic_t) 1u) +#define ZX_INFO_HANDLE_BASIC ((zx_object_info_topic_t) 2u) // zx_info_handle_basic_t[1] +#define ZX_INFO_PROCESS ((zx_object_info_topic_t) 3u) // zx_info_process_t[1] +#define ZX_INFO_PROCESS_THREADS ((zx_object_info_topic_t) 4u) // zx_koid_t[n] +#define ZX_INFO_VMAR ((zx_object_info_topic_t) 7u) // zx_info_vmar_t[1] +#define ZX_INFO_JOB_CHILDREN ((zx_object_info_topic_t) 8u) // zx_koid_t[n] +#define ZX_INFO_JOB_PROCESSES ((zx_object_info_topic_t) 9u) // zx_koid_t[n] +#define ZX_INFO_THREAD ((zx_object_info_topic_t) 10u) // zx_info_thread_t[1] +#define ZX_INFO_THREAD_EXCEPTION_REPORT ((zx_object_info_topic_t) 11u) // zx_exception_report_t[1] +#define ZX_INFO_TASK_STATS ((zx_object_info_topic_t) 12u) // zx_info_task_stats_t[1] +#define ZX_INFO_PROCESS_MAPS ((zx_object_info_topic_t) 13u) // zx_info_maps_t[n] +#define ZX_INFO_PROCESS_VMOS ((zx_object_info_topic_t) 14u) // zx_info_vmo_t[n] +#define ZX_INFO_THREAD_STATS ((zx_object_info_topic_t) 15u) // zx_info_thread_stats_t[1] +#define ZX_INFO_CPU_STATS ((zx_object_info_topic_t) 16u) // zx_info_cpu_stats_t[n] +#define ZX_INFO_KMEM_STATS ((zx_object_info_topic_t) 17u) // zx_info_kmem_stats_t[1] +#define ZX_INFO_RESOURCE ((zx_object_info_topic_t) 18u) // zx_info_resource_t[1] +#define ZX_INFO_HANDLE_COUNT ((zx_object_info_topic_t) 19u) // zx_info_handle_count_t[1] +#define ZX_INFO_BTI ((zx_object_info_topic_t) 20u) // zx_info_bti_t[1] +#define ZX_INFO_PROCESS_HANDLE_STATS ((zx_object_info_topic_t) 21u) // zx_info_process_handle_stats_t[1] +#define ZX_INFO_SOCKET ((zx_object_info_topic_t) 22u) // zx_info_socket_t[1] +#define ZX_INFO_VMO ((zx_object_info_topic_t) 23u) // zx_info_vmo_t[1] +#define ZX_INFO_JOB ((zx_object_info_topic_t) 24u) // zx_info_job_t[1] +#define ZX_INFO_TIMER ((zx_object_info_topic_t) 25u) // zx_info_timer_t[1] +#define ZX_INFO_STREAM ((zx_object_info_topic_t) 26u) // zx_info_stream_t[1] +#define ZX_INFO_HANDLE_TABLE ((zx_object_info_topic_t) 27u) // zx_info_handle_extended_t[n] +#define ZX_INFO_MSI ((zx_object_info_topic_t) 28u) // zx_info_msi_t[1] +#define ZX_INFO_GUEST_STATS ((zx_object_info_topic_t) 29u) // zx_info_guest_stats_t[1] + +typedef uint32_t zx_obj_props_t; +#define ZX_OBJ_PROP_NONE ((zx_obj_props_t) 0u) +#define ZX_OBJ_PROP_WAITABLE ((zx_obj_props_t) 1u) + +// Return codes set when a task is killed. +#define ZX_TASK_RETCODE_SYSCALL_KILL ((int64_t) -1024) // via zx_task_kill(). +#define ZX_TASK_RETCODE_OOM_KILL ((int64_t) -1025) // by the OOM killer. +#define ZX_TASK_RETCODE_POLICY_KILL ((int64_t) -1026) // by the Job policy. +#define ZX_TASK_RETCODE_VDSO_KILL ((int64_t) -1027) // by the VDSO. +#define ZX_TASK_RETCODE_EXCEPTION_KILL ((int64_t) -1028) // Exception not handled. +#define ZX_TASK_RETCODE_CRITICAL_PROCESS_KILL ((int64_t) -1029) // by a critical process. + +// Sentinel indicating an invalid or missing CPU. +#define ZX_INFO_INVALID_CPU ((uint32_t)0xFFFFFFFFu) + + +typedef struct zx_info_handle_basic { + // The unique id assigned by kernel to the object referenced by the + // handle. + zx_koid_t koid; + + // The immutable rights assigned to the handle. Two handles that + // have the same koid and the same rights are equivalent and + // interchangeable. + zx_rights_t rights; + + // The object type: channel, event, socket, etc. + zx_obj_type_t type; + + // If the object referenced by the handle is related to another (such + // as the other end of a channel, or the parent of a job) then + // |related_koid| is the koid of that object, otherwise it is zero. + // This relationship is immutable: an object's |related_koid| does + // not change even if the related object no longer exists. + zx_koid_t related_koid; + + // Set to ZX_OBJ_PROP_WAITABLE if the object referenced by the + // handle can be waited on; zero otherwise. + zx_obj_props_t props; + + uint8_t padding1[4]; +} zx_info_handle_basic_t; + +typedef struct zx_info_handle_extended { + // The object type: channel, event, socket, etc. + zx_obj_type_t type; + + // The handle value which is only valid for the process which + // was passed to ZX_INFO_HANDLE_TABLE. + zx_handle_t handle_value; + + // The immutable rights assigned to the handle. Two handles that + // have the same koid and the same rights are equivalent and + // interchangeable. + zx_rights_t rights; + + // Set to ZX_OBJ_PROP_WAITABLE if the object referenced by the + // handle can be waited on; zero otherwise. + zx_obj_props_t props; + + // The unique id assigned by kernel to the object referenced by the + // handle. + zx_koid_t koid; + + // If the object referenced by the handle is related to another (such + // as the other end of a channel, or the parent of a job) then + // |related_koid| is the koid of that object, otherwise it is zero. + // This relationship is immutable: an object's |related_koid| does + // not change even if the related object no longer exists. + zx_koid_t related_koid; + + // If the object referenced by the handle has a peer, like the + // other end of a channel, then this is the koid of the process + // which currently owns it. This value is not stable; the process + // can change the owner at any moment. + // + // This is currently unimplemented and contains 0. + zx_koid_t peer_owner_koid; +} zx_info_handle_extended_t; + +typedef struct zx_info_handle_count { + // The number of outstanding handles to a kernel object. + uint32_t handle_count; +} zx_info_handle_count_t; + +typedef struct zx_info_process_handle_stats { + // The number of outstanding handles to kernel objects of each type. + uint32_t handle_count[ZX_OBJ_TYPE_UPPER_BOUND]; +} zx_info_process_handle_stats_t; + +typedef struct zx_info_process { + // The process's return code; only valid if |exited| is true. + // If the process was killed, it will be one of the ZX_TASK_RETCODE values. + int64_t return_code; + + // True if the process has ever left the initial creation state, + // even if it has exited as well. + bool started; + + // If true, the process has exited and |return_code| is valid. + bool exited; + + // True if a debugger is attached to the process. + bool debugger_attached; + + uint8_t padding1[5]; +} zx_info_process_t; + +typedef struct zx_info_job { + // The job's return code; only valid if |exited| is true. + // If the process was killed, it will be one of the ZX_TASK_RETCODE values. + int64_t return_code; + + // If true, the job has exited and |return_code| is valid. + bool exited; + + // True if the ZX_PROP_JOB_KILL_ON_OOM was set. + bool kill_on_oom; + + // True if a debugger is attached to the job. + bool debugger_attached; + + uint8_t padding1[5]; +} zx_info_job_t; + +typedef struct zx_info_timer { + // The options passed to zx_timer_create(). + uint32_t options; + + uint8_t padding1[4]; + + // The deadline with respect to ZX_CLOCK_MONOTONIC at which the timer will + // fire next. + // + // This value will be zero if the timer is not set to fire. + zx_time_t deadline; + + // Specifies a range from deadline - slack to deadline + slack during which + // the timer is allowed to fire. The system uses this parameter as a hint to + // coalesce nearby timers. + // + // The precise coalescing behavior is controlled by the options parameter + // specified when the timer was created. + // + // This value will be zero if the timer is not set to fire. + zx_duration_t slack; +} zx_info_timer_t; + +typedef struct zx_info_stream { + // The options passed to zx_stream_create(). + uint32_t options; + + uint8_t padding1[4]; + + // The current seek offset. + // + // Used by zx_stream_readv and zx_stream_writev to determine where to read + // and write the stream. + zx_off_t seek; + + // The current size of the stream. + // + // The number of bytes in the stream that store data. The stream itself + // might have a larger capacity to avoid reallocating the underlying storage + // as the stream grows or shrinks. + uint64_t content_size; +} zx_info_stream_t; + +typedef uint32_t zx_thread_state_t; + +typedef struct zx_info_thread { + // One of ZX_THREAD_STATE_* values. + zx_thread_state_t state; + + // If |state| is ZX_THREAD_STATE_BLOCKED_EXCEPTION, the thread has gotten + // an exception and is waiting for the exception response from the specified + // handler. + + // The value is one of ZX_EXCEPTION_CHANNEL_TYPE_*. + uint32_t wait_exception_channel_type; + + // CPUs this thread may be scheduled on, as specified by + // a profile object applied to this thread. + // + // The kernel may not internally store invalid CPUs in the mask, so + // this may not exactly match the mask applied to the thread for + // CPUs beyond what the system is able to use. + zx_cpu_set_t cpu_affinity_mask; +} zx_info_thread_t; + +typedef struct zx_info_thread_stats { + // Total accumulated running time of the thread. + zx_duration_t total_runtime; + + // CPU number that this thread was last scheduled on, or ZX_INFO_INVALID_CPU + // if the thread has never been scheduled on a CPU. By the time this call + // returns, the thread may have been scheduled elsewhere, so this + // information should only be used as a hint or for statistics. + uint32_t last_scheduled_cpu; + + uint8_t padding1[4]; +} zx_info_thread_stats_t; + +// Statistics about resources (e.g., memory) used by a task. Can be relatively +// expensive to gather. +typedef struct zx_info_task_stats { + // The total size of mapped memory ranges in the task. + // Not all will be backed by physical memory. + size_t mem_mapped_bytes; + + // For the fields below, a byte is considered committed if it's backed by + // physical memory. Some of the memory may be double-mapped, and thus + // double-counted. + + // Committed memory that is only mapped into this task. + size_t mem_private_bytes; + + // Committed memory that is mapped into this and at least one other task. + size_t mem_shared_bytes; + + // A number that estimates the fraction of mem_shared_bytes that this + // task is responsible for keeping alive. + // + // An estimate of: + // For each shared, committed byte: + // mem_scaled_shared_bytes += 1 / (number of tasks mapping this byte) + // + // This number is strictly smaller than mem_shared_bytes. + size_t mem_scaled_shared_bytes; +} zx_info_task_stats_t; + +typedef struct zx_info_vmar { + // Base address of the region. + uintptr_t base; + + // Length of the region, in bytes. + size_t len; +} zx_info_vmar_t; + +typedef struct zx_info_bti { + // zx_bti_pin will always be able to return addresses that are contiguous for at + // least this many bytes. E.g. if this returns 1MB, then a call to + // zx_bti_pin() with a size of 2MB will return at most two physically-contiguous runs. + // If the size were 2.5MB, it will return at most three physically-contiguous runs. + uint64_t minimum_contiguity; + + // The number of bytes in the device's address space (UINT64_MAX if 2^64). + uint64_t aspace_size; + + // The count of the pinned memory object tokens. Requesting this count is + // racy, so this should only be used for informative reasons. + uint64_t pmo_count; + + // The count of the quarantined pinned memory object tokens. Requesting this count is + // racy, so this should only be used for informative reasons. + uint64_t quarantine_count; +} zx_info_bti_t; + +typedef struct zx_info_socket { + // The options passed to zx_socket_create(). + uint32_t options; + + uint8_t padding1[4]; + + // The maximum size of the receive buffer of a socket, in bytes. + // + // The receive buffer may become full at a capacity less than the maximum + // due to overhead. + size_t rx_buf_max; + + // The size of the receive buffer of a socket, in bytes. + size_t rx_buf_size; + + // The amount of data, in bytes, that is available for reading in a single + // zx_socket_read call. + // + // For stream sockets, this value will match |rx_buf_size|. For datagram + // sockets, this value will be the size of the next datagram in the receive + // buffer. + size_t rx_buf_available; + + // The maximum size of the transmit buffer of a socket, in bytes. + // + // The transmit buffer may become full at a capacity less than the maximum + // due to overhead. + // + // Will be zero if the peer endpoint is closed. + size_t tx_buf_max; + + // The size of the transmit buffer of a socket, in bytes. + // + // Will be zero if the peer endpoint is closed. + size_t tx_buf_size; +} zx_info_socket_t; + +// Types and values used by ZX_INFO_PROCESS_MAPS. + +// Describes a VM mapping. +typedef struct zx_info_maps_mapping { + // MMU flags for the mapping. + // Bitwise OR of ZX_VM_PERM_{READ,WRITE,EXECUTE} values. + zx_vm_option_t mmu_flags; + uint8_t padding1[4]; + // koid of the mapped VMO. + zx_koid_t vmo_koid; + // Offset into the above VMO. + uint64_t vmo_offset; + // The number of PAGE_SIZE pages in the mapped region of the VMO + // that are backed by physical memory. + size_t committed_pages; +} zx_info_maps_mapping_t; + +// Types of entries represented by zx_info_maps_t. +// Can't use zx_obj_type_t because not all of these are +// user-visible kernel object types. +typedef uint32_t zx_info_maps_type_t; +#define ZX_INFO_MAPS_TYPE_NONE ((zx_info_maps_type_t) 0u) +#define ZX_INFO_MAPS_TYPE_ASPACE ((zx_info_maps_type_t) 1u) +#define ZX_INFO_MAPS_TYPE_VMAR ((zx_info_maps_type_t) 2u) +#define ZX_INFO_MAPS_TYPE_MAPPING ((zx_info_maps_type_t) 3u) + +// Describes a node in the aspace/vmar/mapping hierarchy for a user process. +typedef struct zx_info_maps { + // Name if available; empty string otherwise. + char name[ZX_MAX_NAME_LEN]; + // Base address. + zx_vaddr_t base; + // Size in bytes. + size_t size; + + // The depth of this node in the tree. + // Can be used for indentation, or to rebuild the tree from an array + // of zx_info_maps_t entries, which will be in depth-first pre-order. + size_t depth; + // The type of this entry; indicates which union entry is valid. + zx_info_maps_type_t type; + uint8_t padding1[4]; + union { + zx_info_maps_mapping_t mapping; + // No additional fields for other types. + } u; +} zx_info_maps_t; + + +// Values and types used by ZX_INFO_PROCESS_VMOS. + +// The VMO is backed by RAM, consuming memory. +// Mutually exclusive with ZX_INFO_VMO_TYPE_PHYSICAL. +// See ZX_INFO_VMO_TYPE(flags) +#define ZX_INFO_VMO_TYPE_PAGED (1u<<0) + +// The VMO points to a physical address range, and does not consume memory. +// Typically used to access memory-mapped hardware. +// Mutually exclusive with ZX_INFO_VMO_TYPE_PAGED. +// See ZX_INFO_VMO_TYPE(flags) +#define ZX_INFO_VMO_TYPE_PHYSICAL (0u<<0) + +// Returns a VMO's type based on its flags, allowing for checks like +// if (ZX_INFO_VMO_TYPE(f) == ZX_INFO_VMO_TYPE_PAGED) +#define ZX_INFO_VMO_TYPE(flags) ((flags) & (1u<<0)) + +// The VMO is resizable. +#define ZX_INFO_VMO_RESIZABLE (1u<<1) + +// The VMO is a child, and is a copy-on-write clone. +#define ZX_INFO_VMO_IS_COW_CLONE (1u<<2) + +// When reading a list of VMOs pointed to by a process, indicates that the +// process has a handle to the VMO, which isn't necessarily mapped. +#define ZX_INFO_VMO_VIA_HANDLE (1u<<3) + +// When reading a list of VMOs pointed to by a process, indicates that the +// process maps the VMO into a VMAR, but doesn't necessarily have a handle to +// the VMO. +#define ZX_INFO_VMO_VIA_MAPPING (1u<<4) + +// The VMO is a pager owned VMO created by zx_pager_create_vmo or is +// a clone of a VMO with this flag set. Will only be set on VMOs with +// the ZX_INFO_VMO_TYPE_PAGED flag set. +#define ZX_INFO_VMO_PAGER_BACKED (1u<<5) + +// The VMO is contiguous +#define ZX_INFO_VMO_CONTIGUOUS (1u<<6) + +// Describes a VMO. For mapping information, see |zx_info_maps_t|. +typedef struct zx_info_vmo { + // The koid of this VMO. + zx_koid_t koid; + + // The name of this VMO. + char name[ZX_MAX_NAME_LEN]; + + // The size of this VMO; i.e., the amount of virtual address space it + // would consume if mapped. + uint64_t size_bytes; + + // If this VMO is a clone, the koid of its parent. Otherwise, zero. + // See |flags| for the type of clone. + zx_koid_t parent_koid; + + // The number of clones of this VMO, if any. + size_t num_children; + + // The number of times this VMO is currently mapped into VMARs. + // Note that the same process will often map the same VMO twice, + // and both mappings will be counted here. (I.e., this is not a count + // of the number of processes that map this VMO; see share_count.) + size_t num_mappings; + + // An estimate of the number of unique address spaces that + // this VMO is mapped into. Every process has its own address space, + // and so does the kernel. + size_t share_count; + + // Bitwise OR of ZX_INFO_VMO_* values. + uint32_t flags; + + uint8_t padding1[4]; + + // If |ZX_INFO_VMO_TYPE(flags) == ZX_INFO_VMO_TYPE_PAGED|, the amount of + // memory currently allocated to this VMO; i.e., the amount of physical + // memory it consumes. Undefined otherwise. + uint64_t committed_bytes; + + // If |flags & ZX_INFO_VMO_VIA_HANDLE|, the handle rights. + // Undefined otherwise. + zx_rights_t handle_rights; + + // VMO mapping cache policy. One of ZX_CACHE_POLICY_* + uint32_t cache_policy; +} zx_info_vmo_t; + +typedef struct zx_info_guest_stats { + uint32_t cpu_number; + uint32_t flags; + + uint64_t vm_entries; + uint64_t vm_exits; +#ifdef __aarch64__ + uint64_t wfi_wfe_instructions; + uint64_t instruction_aborts; + uint64_t data_aborts; + uint64_t system_instructions; + uint64_t smc_instructions; + uint64_t interrupts; +#else + uint64_t interrupts; + uint64_t interrupt_windows; + uint64_t cpuid_instructions; + uint64_t hlt_instructions; + uint64_t control_register_accesses; + uint64_t io_instructions; + uint64_t rdmsr_instructions; + uint64_t wrmsr_instructions; + uint64_t ept_violations; + uint64_t xsetbv_instructions; + uint64_t pause_instructions; + uint64_t vmcall_instructions; +#endif +} zx_info_guest_stats_t; + +// kernel statistics per cpu +// TODO(cpu), expose the deprecated stats via a new syscall. +typedef struct zx_info_cpu_stats { + uint32_t cpu_number; + uint32_t flags; + + zx_duration_t idle_time; + + // kernel scheduler counters + uint64_t reschedules; + uint64_t context_switches; + uint64_t irq_preempts; + uint64_t preempts; + uint64_t yields; + + // cpu level interrupts and exceptions + uint64_t ints; // hardware interrupts, minus timer interrupts or inter-processor interrupts + uint64_t timer_ints; // timer interrupts + uint64_t timers; // timer callbacks + uint64_t page_faults; // (deprecated, returns 0) page faults + uint64_t exceptions; // (deprecated, returns 0) exceptions such as undefined opcode + uint64_t syscalls; + + // inter-processor interrupts + uint64_t reschedule_ipis; + uint64_t generic_ipis; +} zx_info_cpu_stats_t; + +// Information about kernel memory usage. +// Can be expensive to gather. +typedef struct zx_info_kmem_stats { + // The total amount of physical memory available to the system. + uint64_t total_bytes; + + // The amount of unallocated memory. + uint64_t free_bytes; + + // The amount of memory reserved by and mapped into the kernel for reasons + // not covered by other fields in this struct. Typically for readonly data + // like the ram disk and kernel image, and for early-boot dynamic memory. + uint64_t wired_bytes; + + // The amount of memory allocated to the kernel heap. + uint64_t total_heap_bytes; + + // The portion of |total_heap_bytes| that is not in use. + uint64_t free_heap_bytes; + + // The amount of memory committed to VMOs, both kernel and user. + // A superset of all userspace memory. + // Does not include certain VMOs that fall under |wired_bytes|. + // + // TODO(dbort): Break this into at least two pieces: userspace VMOs that + // have koids, and kernel VMOs that don't. Or maybe look at VMOs + // mapped into the kernel aspace vs. everything else. + uint64_t vmo_bytes; + + // The amount of memory used for architecture-specific MMU metadata + // like page tables. + uint64_t mmu_overhead_bytes; + + // The amount of memory in use by IPC. + uint64_t ipc_bytes; + + // Non-free memory that isn't accounted for in any other field. + uint64_t other_bytes; +} zx_info_kmem_stats_t; + +typedef struct zx_info_resource { + // The resource kind; resource object kinds are detailed in the resource.md + uint32_t kind; + // Resource's creation flags + uint32_t flags; + // Resource's base value (inclusive) + uint64_t base; + // Resource's length value + size_t size; + char name[ZX_MAX_NAME_LEN]; +} zx_info_resource_t; + +typedef struct zx_info_msi { + // The target adress for write transactions. + uint64_t target_addr; + // The data that the device ill write when triggering an IRQ. + uint32_t target_data; + // The first IRQ in the allocated block. + uint32_t base_irq_id; + // The number of IRQs in the allocated block. + uint32_t num_irq; +} zx_info_msi_t; + + +#define ZX_INFO_CPU_STATS_FLAG_ONLINE (1u<<0) + +// Object properties. + +// Argument is a char[ZX_MAX_NAME_LEN]. +#define ZX_PROP_NAME ((uint32_t) 3u) + +#if __x86_64__ +// Argument is a uintptr_t. +#define ZX_PROP_REGISTER_GS ((uint32_t) 2u) +#define ZX_PROP_REGISTER_FS ((uint32_t) 4u) +#endif + +// Argument is the value of ld.so's _dl_debug_addr, a uintptr_t. If the +// property is set to the magic value of ZX_PROCESS_DEBUG_ADDR_BREAK_ON_SET +// on process startup, ld.so will trigger a debug breakpoint immediately after +// setting the property to the correct value. +#define ZX_PROP_PROCESS_DEBUG_ADDR ((uint32_t) 5u) +#define ZX_PROCESS_DEBUG_ADDR_BREAK_ON_SET ((uintptr_t) 1u) + +// Argument is the base address of the vDSO mapping (or zero), a uintptr_t. +#define ZX_PROP_PROCESS_VDSO_BASE_ADDRESS ((uint32_t) 6u) + +// Whether the dynamic loader should issue a debug trap when loading a shared library, +// either initially or when running (e.g. dlopen). +// +// See docs/reference/syscalls/object_get_property.md +// See third_party/ulib/musl/ldso/dynlink.c. +#define ZX_PROP_PROCESS_BREAK_ON_LOAD ((uint32_t) 7u) + +// The process's context id as recorded by h/w instruction tracing, a uintptr_t. +// On X86 this is the cr3 value. +// TODO(dje): Wasn't sure whether the gaps in property numbers are unusable +// due to being old dleeted values. For now I just picked something. +#define ZX_PROP_PROCESS_HW_TRACE_CONTEXT_ID ((uint32_t) 8u) + +// Argument is a size_t. +#define ZX_PROP_SOCKET_RX_THRESHOLD 12u +#define ZX_PROP_SOCKET_TX_THRESHOLD 13u + +// Terminate this job if the system is low on memory. +#define ZX_PROP_JOB_KILL_ON_OOM 15u + +// Exception close behavior. +#define ZX_PROP_EXCEPTION_STATE 16u + +// The size of the content in a VMO, in bytes. +// +// The content size of a VMO can be larger or smaller than the actual size of +// the VMO. +// +// Argument is a uint64_t. +#define ZX_PROP_VMO_CONTENT_SIZE 17u + +// Basic thread states, in zx_info_thread_t.state. +#define ZX_THREAD_STATE_NEW ((zx_thread_state_t) 0x0000u) +#define ZX_THREAD_STATE_RUNNING ((zx_thread_state_t) 0x0001u) +#define ZX_THREAD_STATE_SUSPENDED ((zx_thread_state_t) 0x0002u) +// ZX_THREAD_STATE_BLOCKED is never returned by itself. +// It is always returned with a more precise reason. +// See ZX_THREAD_STATE_BLOCKED_* below. +#define ZX_THREAD_STATE_BLOCKED ((zx_thread_state_t) 0x0003u) +#define ZX_THREAD_STATE_DYING ((zx_thread_state_t) 0x0004u) +#define ZX_THREAD_STATE_DEAD ((zx_thread_state_t) 0x0005u) + +// More precise thread states. +#define ZX_THREAD_STATE_BLOCKED_EXCEPTION ((zx_thread_state_t) 0x0103u) +#define ZX_THREAD_STATE_BLOCKED_SLEEPING ((zx_thread_state_t) 0x0203u) +#define ZX_THREAD_STATE_BLOCKED_FUTEX ((zx_thread_state_t) 0x0303u) +#define ZX_THREAD_STATE_BLOCKED_PORT ((zx_thread_state_t) 0x0403u) +#define ZX_THREAD_STATE_BLOCKED_CHANNEL ((zx_thread_state_t) 0x0503u) +#define ZX_THREAD_STATE_BLOCKED_WAIT_ONE ((zx_thread_state_t) 0x0603u) +#define ZX_THREAD_STATE_BLOCKED_WAIT_MANY ((zx_thread_state_t) 0x0703u) +#define ZX_THREAD_STATE_BLOCKED_INTERRUPT ((zx_thread_state_t) 0x0803u) +#define ZX_THREAD_STATE_BLOCKED_PAGER ((zx_thread_state_t) 0x0903u) + +// Reduce possibly-more-precise state to a basic state. +// Useful if, for example, you want to check for BLOCKED on anything. +#define ZX_THREAD_STATE_BASIC(n) ((n) & 0xff) + +// How a thread should behave when the current exception is closed. +#define ZX_EXCEPTION_STATE_TRY_NEXT 0u +#define ZX_EXCEPTION_STATE_HANDLED 1u + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_OBJECT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/pci.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/pci.h new file mode 100644 index 0000000..d1049c2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/pci.h
@@ -0,0 +1,134 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_PCI_H_ +#define SYSROOT_ZIRCON_SYSCALLS_PCI_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + + +// Base Address Registers are accessed in userspace via the get_bar protocol method. The +// Bar is represented via a pci_bar_t struct which contains a handle pointer to a VMO +// in the case of an MMIO bar, as well as a PIO addr/size pair for the memory region +// to access if a PIO bar. In the latter case, the protocol will acquire the appropriate +// permissions for the process to write to that PIO region on that architecture. +typedef uint32_t zx_pci_bar_types_t; +#define ZX_PCI_BAR_TYPE_UNUSED ((zx_pci_bar_types_t) 0u) +#define ZX_PCI_BAR_TYPE_MMIO ((zx_pci_bar_types_t) 1u) +#define ZX_PCI_BAR_TYPE_PIO ((zx_pci_bar_types_t) 2u) + +// TODO(cja): This makes some assumptions that anything in an arch's PIO region +// is going to be defined as a base address and size. This will need to be +// updated to a per-platform structure in the event that doesn't pan out +// in the future. +typedef struct zx_pci_bar { + uint32_t id; + uint32_t type; + size_t size; + union { + uintptr_t addr; + struct { + zx_handle_t handle; + uint8_t padding1[4]; + }; + }; +} zx_pci_bar_t; + +// Defines and structures related to zx_pci_*() +// Info returned to dev manager for PCIe devices when probing. +typedef struct zx_pcie_device_info { + uint16_t vendor_id; + uint16_t device_id; + + uint8_t base_class; + uint8_t sub_class; + uint8_t program_interface; + uint8_t revision_id; + + uint8_t bus_id; + uint8_t dev_id; + uint8_t func_id; + + uint8_t padding1; +} zx_pcie_device_info_t; + +#define ZX_PCI_MAX_BUSSES (256u) +#define ZX_PCI_MAX_DEVICES_PER_BUS (32u) +#define ZX_PCI_MAX_FUNCTIONS_PER_DEVICE (8u) +#define ZX_PCI_MAX_FUNCTIONS_PER_BUS (ZX_PCI_MAX_DEVICES_PER_BUS * ZX_PCI_MAX_FUNCTIONS_PER_DEVICE) + +#define ZX_PCI_MAX_LEGACY_IRQ_PINS (4u) +#define ZX_PCI_MAX_MSI_IRQS (32u) +#define ZX_PCI_MAX_MSIX_IRQS (2048u) + +#define ZX_PCI_STANDARD_CONFIG_HDR_SIZE (64u) +#define ZX_PCI_BASE_CONFIG_SIZE (256u) +#define ZX_PCI_EXTENDED_CONFIG_SIZE (4096u) +#define ZX_PCI_ECAM_BYTE_PER_BUS (ZX_PCI_EXTENDED_CONFIG_SIZE * ZX_PCI_MAX_FUNCTIONS_PER_BUS) + +#define ZX_PCI_BAR_REGS_PER_BRIDGE (2u) +#define ZX_PCI_BAR_REGS_PER_DEVICE (6u) +#define ZX_PCI_MAX_BAR_REGS (6u) + +#define ZX_PCI_NO_IRQ_MAPPING UINT32_MAX + +// Used for zx_pci_init_arg_t::addr_windows::cfg_space_type +#define PCI_CFG_SPACE_TYPE_PIO (0u) +#define PCI_CFG_SPACE_TYPE_MMIO (1u) +#define PCI_CFG_SPACE_TYPE_DW_ROOT (2u) // Designware Root Bridge ECAM +#define PCI_CFG_SPACE_TYPE_DW_DS (3u) // Designware Downstream ECAM + +// Dimensions: device id, function id, legacy pin number +// ZX_PCI_NO_IRQ_MAPPING if no mapping specified. +typedef uint32_t zx_pci_irq_swizzle_lut_t[ZX_PCI_MAX_DEVICES_PER_BUS] + [ZX_PCI_MAX_FUNCTIONS_PER_DEVICE] + [ZX_PCI_MAX_LEGACY_IRQ_PINS]; + +// We support up to 224 IRQs on a system, this is the maximum supported by +// LAPICs (today) so this should be a safe number. +#define ZX_PCI_MAX_IRQS 224 + +typedef struct zx_pci_init_arg { + zx_pci_irq_swizzle_lut_t dev_pin_to_global_irq; + + uint32_t num_irqs; + struct { + uint32_t global_irq; + bool level_triggered; + bool active_high; + uint8_t padding1[2]; + } irqs[ZX_PCI_MAX_IRQS]; + + uint32_t addr_window_count; + struct { + uint64_t base; + size_t size; + uint8_t bus_start; + uint8_t bus_end; + uint8_t cfg_space_type; + bool has_ecam; + uint8_t padding1[4]; + } addr_windows[]; +} zx_pci_init_arg_t; + +#define ZX_PCI_INIT_ARG_MAX_ECAM_WINDOWS 2 +#define ZX_PCI_INIT_ARG_MAX_SIZE (sizeof(((zx_pci_init_arg_t*)NULL)->addr_windows[0]) * \ + ZX_PCI_INIT_ARG_MAX_ECAM_WINDOWS + \ + sizeof(zx_pci_init_arg_t)) + +// Enum used to select PCIe IRQ modes +typedef uint32_t zx_pci_irq_mode_t; +#define ZX_PCIE_IRQ_MODE_DISABLED ((zx_pci_irq_mode_t) 0u) +#define ZX_PCIE_IRQ_MODE_LEGACY ((zx_pci_irq_mode_t) 1u) +#define ZX_PCIE_IRQ_MODE_MSI ((zx_pci_irq_mode_t) 2u) +#define ZX_PCIE_IRQ_MODE_MSI_X ((zx_pci_irq_mode_t) 3u) + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_PCI_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/policy.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/policy.h new file mode 100644 index 0000000..158c604 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/policy.h
@@ -0,0 +1,89 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_POLICY_H_ +#define SYSROOT_ZIRCON_SYSCALLS_POLICY_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +// Policy is applied for the conditions that are not +// specified by the parent job policy. +#define ZX_JOB_POL_RELATIVE 0u +// Policy is either applied as-is or the syscall fails. +#define ZX_JOB_POL_ABSOLUTE 1u + +// Basic policy topic. +#define ZX_JOB_POL_BASIC_V1 0u +#define ZX_JOB_POL_BASIC_V2 0x01000000u + +// Timer slack policy topic. +#define ZX_JOB_POL_TIMER_SLACK 1u + +// Input structure to use with ZX_JOB_POL_BASIC_V1. +typedef struct zx_policy_basic_v1 { + uint32_t condition; + uint32_t policy; +} zx_policy_basic_v1_t; + +// Input structure to use with ZX_JOB_POL_BASIC_V2. +typedef struct zx_policy_basic_v2 { + uint32_t condition; + uint32_t action; + uint32_t flags; +} zx_policy_basic_v2_t; + +#define ZX_JOB_POL_BASIC ZX_JOB_POL_BASIC_V1 +typedef struct zx_policy_basic_v1 zx_policy_basic; +typedef struct zx_policy_basic_v1 zx_policy_basic_t; + +// Conditions handled by job policy. +#define ZX_POL_BAD_HANDLE 0u +#define ZX_POL_WRONG_OBJECT 1u +#define ZX_POL_VMAR_WX 2u +#define ZX_POL_NEW_ANY 3u +#define ZX_POL_NEW_VMO 4u +#define ZX_POL_NEW_CHANNEL 5u +#define ZX_POL_NEW_EVENT 6u +#define ZX_POL_NEW_EVENTPAIR 7u +#define ZX_POL_NEW_PORT 8u +#define ZX_POL_NEW_SOCKET 9u +#define ZX_POL_NEW_FIFO 10u +#define ZX_POL_NEW_TIMER 11u +#define ZX_POL_NEW_PROCESS 12u +#define ZX_POL_NEW_PROFILE 13u +#define ZX_POL_AMBIENT_MARK_VMO_EXEC 14u +#ifdef _KERNEL +#define ZX_POL_MAX 15u +#endif + +// Policy actions. +#define ZX_POL_ACTION_ALLOW 0u +#define ZX_POL_ACTION_DENY 1u +#define ZX_POL_ACTION_ALLOW_EXCEPTION 2u +#define ZX_POL_ACTION_DENY_EXCEPTION 3u +#define ZX_POL_ACTION_KILL 4u +#ifdef _KERNEL +#define ZX_POL_ACTION_MAX 5u +#endif + +// Policy override. +#define ZX_POL_OVERRIDE_ALLOW 0u +#define ZX_POL_OVERRIDE_DENY 1u + + +// Input structure to use with ZX_JOB_POL_TIMER_SLACK. +typedef struct zx_policy_timer_slack { + zx_duration_t min_slack; + uint32_t default_mode; + uint8_t padding1[4]; +} zx_policy_timer_slack_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_POLICY_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/port.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/port.h new file mode 100644 index 0000000..9feb4dc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/port.h
@@ -0,0 +1,173 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_PORT_H_ +#define SYSROOT_ZIRCON_SYSCALLS_PORT_H_ + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// clang-format off + +// zx_object_wait_async() options +#define ZX_WAIT_ASYNC_ONCE ((uint32_t)0u) +#define ZX_WAIT_ASYNC_TIMESTAMP ((uint32_t)1u) + +// packet types. zx_port_packet_t::type +#define ZX_PKT_TYPE_USER ((uint8_t)0x00u) +#define ZX_PKT_TYPE_SIGNAL_ONE ((uint8_t)0x01u) +// 0x02 was previously used for "ZX_PKT_TYPE_SIGNAL_REP". +#define ZX_PKT_TYPE_GUEST_BELL ((uint8_t)0x03u) +#define ZX_PKT_TYPE_GUEST_MEM ((uint8_t)0x04u) +#define ZX_PKT_TYPE_GUEST_IO ((uint8_t)0x05u) +#define ZX_PKT_TYPE_GUEST_VCPU ((uint8_t)0x06u) +#define ZX_PKT_TYPE_INTERRUPT ((uint8_t)0x07u) +#define ZX_PKT_TYPE_PAGE_REQUEST ((uint8_t)0x09u) + +// For options passed to port_create +#define ZX_PORT_BIND_TO_INTERRUPT ((uint32_t)(0x1u << 0)) + +#define ZX_PKT_TYPE_MASK ((uint32_t)0x000000FFu) + +#define ZX_PKT_IS_USER(type) ((type) == ZX_PKT_TYPE_USER) +#define ZX_PKT_IS_SIGNAL_ONE(type) ((type) == ZX_PKT_TYPE_SIGNAL_ONE) +#define ZX_PKT_IS_GUEST_BELL(type) ((type) == ZX_PKT_TYPE_GUEST_BELL) +#define ZX_PKT_IS_GUEST_MEM(type) ((type) == ZX_PKT_TYPE_GUEST_MEM) +#define ZX_PKT_IS_GUEST_IO(type) ((type) == ZX_PKT_TYPE_GUEST_IO) +#define ZX_PKT_IS_GUEST_VCPU(type) ((type) == ZX_PKT_TYPE_GUEST_VCPU) +#define ZX_PKT_IS_INTERRUPT(type) ((type) == ZX_PKT_TYPE_INTERRUPT) +#define ZX_PKT_IS_PAGE_REQUEST(type) ((type) == ZX_PKT_TYPE_PAGE_REQUEST) + +// zx_packet_guest_vcpu_t::type +#define ZX_PKT_GUEST_VCPU_INTERRUPT ((uint8_t)0) +#define ZX_PKT_GUEST_VCPU_STARTUP ((uint8_t)1) + +// zx_packet_page_request_t::command +#define ZX_PAGER_VMO_READ ((uint16_t) 0) +#define ZX_PAGER_VMO_COMPLETE ((uint16_t) 1) +// clang-format on + +// port_packet_t::type ZX_PKT_TYPE_USER. +typedef union zx_packet_user { + uint64_t u64[4]; + uint32_t u32[8]; + uint16_t u16[16]; + uint8_t c8[32]; +} zx_packet_user_t; + +// port_packet_t::type ZX_PKT_TYPE_SIGNAL_ONE. +typedef struct zx_packet_signal { + zx_signals_t trigger; + zx_signals_t observed; + uint64_t count; + uint64_t timestamp; + uint64_t reserved1; +} zx_packet_signal_t; + +typedef struct zx_packet_guest_bell { + zx_gpaddr_t addr; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; +} zx_packet_guest_bell_t; + +typedef struct zx_packet_guest_mem { + zx_gpaddr_t addr; +#if __aarch64__ + uint8_t access_size; + bool sign_extend; + uint8_t xt; + bool read; + uint8_t padding1[4]; + uint64_t data; + uint64_t reserved; +#elif __x86_64__ +// NOTE: x86 instructions are guaranteed to be 15 bytes or fewer. +#define X86_MAX_INST_LEN 15u + uint8_t inst_len; + uint8_t inst_buf[X86_MAX_INST_LEN]; + // This is the default operand size as determined by the CS and EFER register (Volume 3, + // Section 5.2.1). If operating in 64-bit mode then near branches and all instructions, except + // far branches, that implicitly reference the RSP will actually have a default operand size of + // 64-bits (Volume 2, Section 2.2.1.7), and not the 32-bits that will be given here. + uint8_t default_operand_size; + uint8_t reserved[7]; +#endif +} zx_packet_guest_mem_t; + +typedef struct zx_packet_guest_io { + uint16_t port; + uint8_t access_size; + bool input; + union { + struct { + uint8_t u8; + uint8_t padding1[3]; + }; + struct { + uint16_t u16; + uint8_t padding2[2]; + }; + uint32_t u32; + uint8_t data[4]; + }; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; +} zx_packet_guest_io_t; + +typedef struct zx_packet_guest_vcpu { + union { + struct { + uint64_t mask; + uint8_t vector; + uint8_t padding1[7]; + } interrupt; + struct { + uint64_t id; + zx_gpaddr_t entry; + } startup; + }; + uint8_t type; + uint8_t padding1[7]; + uint64_t reserved; +} zx_packet_guest_vcpu_t; + +typedef struct zx_packet_interrupt { + zx_time_t timestamp; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; +} zx_packet_interrupt_t; + +typedef struct zx_packet_page_request { + uint16_t command; + uint16_t flags; + uint32_t reserved0; + uint64_t offset; + uint64_t length; + uint64_t reserved1; +} zx_packet_page_request_t; + +typedef struct zx_port_packet { + uint64_t key; + uint32_t type; + zx_status_t status; + union { + zx_packet_user_t user; + zx_packet_signal_t signal; + zx_packet_guest_bell_t guest_bell; + zx_packet_guest_mem_t guest_mem; + zx_packet_guest_io_t guest_io; + zx_packet_guest_vcpu_t guest_vcpu; + zx_packet_interrupt_t interrupt; + zx_packet_page_request_t page_request; + }; +} zx_port_packet_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_PORT_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/profile.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/profile.h new file mode 100644 index 0000000..5abf561 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/profile.h
@@ -0,0 +1,49 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_PROFILE_H_ +#define SYSROOT_ZIRCON_SYSCALLS_PROFILE_H_ + +#include <zircon/syscalls/scheduler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +#define ZX_PRIORITY_LOWEST 0 +#define ZX_PRIORITY_LOW 8 +#define ZX_PRIORITY_DEFAULT 16 +#define ZX_PRIORITY_HIGH 24 +#define ZX_PRIORITY_HIGHEST 31 + +#define ZX_PROFILE_INFO_FLAG_PRIORITY (1 << 0) +#define ZX_PROFILE_INFO_FLAG_CPU_MASK (1 << 1) +#define ZX_PROFILE_INFO_FLAG_DEADLINE (1 << 2) + +typedef struct zx_profile_info { + // A bitmask of ZX_PROFILE_INFO_FLAG_* values. Specifies which fields + // below have been specified. Other fields are considered unset. + uint32_t flags; + + uint8_t padding1[4]; + + union { + struct { + // Scheduling priority. |flags| must have ZX_PROFILE_INFO_FLAG_PRIORITY set. + int32_t priority; + + uint8_t padding2[20]; + }; + + // Scheduling deadline. |flags| must have ZX_PROFILE_INFO_FLAG_DEADLINE set. + zx_sched_deadline_params_t deadline_params; + }; + + // CPUs that threads may be scheduled on. |flags| must have + // ZX_PROFILE_INFO_FLAG_CPU_MASK set. + zx_cpu_set_t cpu_affinity_mask; +} zx_profile_info_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_PROFILE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/resource.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/resource.h new file mode 100644 index 0000000..84b12a1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/resource.h
@@ -0,0 +1,37 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_RESOURCE_H_ +#define SYSROOT_ZIRCON_SYSCALLS_RESOURCE_H_ + +#include <stdint.h> + +#include <zircon/compiler.h> + +// Resources that require a region allocator to handle exclusive reservations +// are defined in a contiguous block starting at 0 up to ZX_RSRC_KIND_COUNT-1. +// After that point, all resource 'kinds' are abstract and need no underlying +// bookkeeping. It's important that ZX_RSRC_KIND_COUNT is defined for each +// architecture to properly allocate only the bookkeeping necessary. +// +// TODO(ZX-2419): Don't expose ZX_RSRC_KIND_COUNT to userspace + +typedef uint32_t zx_rsrc_kind_t; +#define ZX_RSRC_KIND_MMIO ((zx_rsrc_kind_t)0u) +#define ZX_RSRC_KIND_IRQ ((zx_rsrc_kind_t)1u) +#define ZX_RSRC_KIND_IOPORT ((zx_rsrc_kind_t)2u) +#define ZX_RSRC_KIND_HYPERVISOR ((zx_rsrc_kind_t)3u) +#define ZX_RSRC_KIND_ROOT ((zx_rsrc_kind_t)4u) +#define ZX_RSRC_KIND_VMEX ((zx_rsrc_kind_t)5u) +#define ZX_RSRC_KIND_SMC ((zx_rsrc_kind_t)6u) +#define ZX_RSRC_KIND_COUNT ((zx_rsrc_kind_t)7u) + +typedef uint32_t zx_rsrc_flags_t; +#define ZX_RSRC_FLAG_EXCLUSIVE ((zx_rsrc_flags_t)0x00010000u) +#define ZX_RSRC_FLAGS_MASK ((zx_rsrc_flags_t)ZX_RSRC_FLAG_EXCLUSIVE) + +#define ZX_RSRC_EXTRACT_KIND(x) ((x)&0x0000FFFF) +#define ZX_RSRC_EXTRACT_FLAGS(x) ((x)&0xFFFF0000) + +#endif // SYSROOT_ZIRCON_SYSCALLS_RESOURCE_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/scheduler.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/scheduler.h new file mode 100644 index 0000000..c119562 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/scheduler.h
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_SCHEDULER_H_ +#define SYSROOT_ZIRCON_SYSCALLS_SCHEDULER_H_ + +#include <zircon/compiler.h> +#include <zircon/time.h> + +__BEGIN_CDECLS + +// Parameters for deadline scheduler profiles. +// +// At minimum, the following relation must hold: +// +// 0 < capacity <= relative_deadline <= period +// +// Additional restrictions on the range and granularity of the parameters may be +// enforced, which can vary from system to system. +// +typedef struct zx_sched_deadline_params { + // The worst case execution time of the deadline work per interarrival period. + zx_duration_t capacity; + + // The worst case finish time of the deadline work, relative to the beginning + // of the current interarrival period. + zx_duration_t relative_deadline; + + // The worst case interarrival period of the deadline work. + zx_duration_t period; +} zx_sched_deadline_params_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_SCHEDULER_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/smc.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/smc.h new file mode 100644 index 0000000..93f1761 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/smc.h
@@ -0,0 +1,47 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_SMC_H_ +#define SYSROOT_ZIRCON_SYSCALLS_SMC_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Silicon Partner. +#define ARM_SMC_SERVICE_CALL_NUM_SIP_SERVICE_BASE 0x02 +#define ARM_SMC_SERVICE_CALL_NUM_SIP_SERVICE_LENGTH 0x01 +#define ARM_SMC_SERVICE_CALL_NUM_TRUSTED_OS_BASE 0x32 +#define ARM_SMC_SERVICE_CALL_NUM_TRUSTED_OS_LENGTH 0xE +#define ARM_SMC_SERVICE_CALL_NUM_MAX 0x3F +#define ARM_SMC_SERVICE_CALL_NUM_MASK 0x3F +#define ARM_SMC_SERVICE_CALL_NUM_SHIFT 24 +#define ARM_SMC_GET_SERVICE_CALL_NUM_FROM_FUNC_ID(func_id) \ + (((func_id) >> ARM_SMC_SERVICE_CALL_NUM_SHIFT) & ARM_SMC_SERVICE_CALL_NUM_MASK) + +typedef struct zx_smc_parameters { + uint32_t func_id; + uint8_t padding1[4]; + uint64_t arg1; + uint64_t arg2; + uint64_t arg3; + uint64_t arg4; + uint64_t arg5; + uint64_t arg6; + uint16_t client_id; + uint16_t secure_os_id; + uint8_t padding2[4]; +} zx_smc_parameters_t; + +typedef struct zx_smc_result { + uint64_t arg0; + uint64_t arg1; + uint64_t arg2; + uint64_t arg3; + uint64_t arg6; // at least one implementation uses it as a way to return session_id. +} zx_smc_result_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_SMC_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/system.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/system.h new file mode 100644 index 0000000..b54d443 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/system.h
@@ -0,0 +1,44 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_SYSTEM_H_ +#define SYSROOT_ZIRCON_SYSCALLS_SYSTEM_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Commands used by zx_system_powerctl() +#define ZX_SYSTEM_POWERCTL_ENABLE_ALL_CPUS 1u +#define ZX_SYSTEM_POWERCTL_DISABLE_ALL_CPUS_BUT_PRIMARY 2u +#define ZX_SYSTEM_POWERCTL_ACPI_TRANSITION_S_STATE 3u +#define ZX_SYSTEM_POWERCTL_X86_SET_PKG_PL1 4u +#define ZX_SYSTEM_POWERCTL_REBOOT 5u +#define ZX_SYSTEM_POWERCTL_REBOOT_BOOTLOADER 6u +#define ZX_SYSTEM_POWERCTL_REBOOT_RECOVERY 7u +#define ZX_SYSTEM_POWERCTL_SHUTDOWN 8u + +typedef struct zx_system_powerctl_arg { + union { + struct { + struct { + uint8_t target_s_state; // Value between 1 and 5 indicating which S-state + uint8_t sleep_type_a; // Value from ACPI VM (SLP_TYPa) + uint8_t sleep_type_b; // Value from ACPI VM (SLP_TYPb) + } acpi_transition_s_state; + uint8_t padding1[9]; + }; + struct { + uint32_t power_limit; // PL1 value in milliwatts + uint32_t time_window; // PL1 time window in microseconds + uint8_t clamp; // PL1 clamping enable + uint8_t enable; // PL1 enable + uint8_t padding2[2]; + } x86_power_limit; + }; +} zx_system_powerctl_arg_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_SYSTEM_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/types.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/types.h new file mode 100644 index 0000000..b7910f2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/syscalls/types.h
@@ -0,0 +1,25 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_TYPES_H_ +#define SYSROOT_ZIRCON_SYSCALLS_TYPES_H_ + +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// forward declarations needed by syscalls.h +typedef struct zx_port_packet zx_port_packet_t; +typedef struct zx_pci_bar zx_pci_bar_t; +typedef struct zx_pcie_device_info zx_pcie_device_info_t; +typedef struct zx_pci_init_arg zx_pci_init_arg_t; +typedef union zx_rrec zx_rrec_t; +typedef struct zx_system_powerctl_arg zx_system_powerctl_arg_t; +typedef struct zx_profile_info zx_profile_info_t; +typedef struct zx_smc_parameters zx_smc_parameters_t; +typedef struct zx_smc_result zx_smc_result_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/testonly-syscalls.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/testonly-syscalls.h new file mode 100644 index 0000000..d994d86 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/testonly-syscalls.h
@@ -0,0 +1,30 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TESTONLY_SYSCALLS_H_ +#define SYSROOT_ZIRCON_TESTONLY_SYSCALLS_H_ + +#include <zircon/syscalls.h> + +__BEGIN_CDECLS + +// Make sure this matches <zircon/syscalls.h>. +#define _ZX_SYSCALL_DECL(name, type, attrs, nargs, arglist, prototype) \ + extern attrs type zx_##name prototype; \ + extern attrs type _zx_##name prototype; + +#ifdef __clang__ +#define _ZX_SYSCALL_ANNO(attr) __attribute__((attr)) +#else +#define _ZX_SYSCALL_ANNO(attr) // Nothing for compilers without the support. +#endif + +#include <zircon/syscalls/internal/testonly-cdecls.inc> + +#undef _ZX_SYSCALL_ANNO +#undef _ZX_SYSCALL_DECL + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_ONLY_SYSCALLS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/threads.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/threads.h new file mode 100644 index 0000000..5bfc4b0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/threads.h
@@ -0,0 +1,40 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_THREADS_H_ +#define SYSROOT_ZIRCON_THREADS_H_ + +#include <threads.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Get the zx_handle_t corresponding to the thrd_t. This handle is +// still owned by the C11 thread, and will not persist after the +// thread exits and is joined or detached. Callers must duplicate the +// handle, therefore, if they wish the thread handle to outlive the +// execution of the C11 thread. +zx_handle_t thrd_get_zx_handle(thrd_t t); + +// Converts a threads.h-style status value to an |zx_status_t|. +static inline zx_status_t __PURE thrd_status_to_zx_status(int thrd_status) { + switch (thrd_status) { + case thrd_success: + return ZX_OK; + case thrd_nomem: + return ZX_ERR_NO_MEMORY; + case thrd_timedout: + return ZX_ERR_TIMED_OUT; + case thrd_busy: + return ZX_ERR_SHOULD_WAIT; + default: + case thrd_error: + return ZX_ERR_INTERNAL; + } +} + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_THREADS_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/time.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/time.h new file mode 100644 index 0000000..e6bd862 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/time.h
@@ -0,0 +1,153 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TIME_H_ +#define SYSROOT_ZIRCON_TIME_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// absolute time in nanoseconds (generally with respect to the monotonic clock) +typedef int64_t zx_time_t; +// a duration in nanoseconds +typedef int64_t zx_duration_t; +// a duration in hardware ticks +typedef int64_t zx_ticks_t; + +#define ZX_TIME_INFINITE INT64_MAX +#define ZX_TIME_INFINITE_PAST INT64_MIN + +// These functions perform overflow-safe time arithmetic and unit conversion, clamping to +// ZX_TIME_INFINITE in case of overflow and ZX_TIME_INFINITE_PAST in case of underflow. +// +// C++ code should use zx::time and zx::duration instead. +// +// For arithmetic the naming scheme is: +// zx_<first argument>_<operation>_<second argument> +// +// For unit conversion the naming scheme is: +// zx_duration_from_<unit of argument> +// +// TODO(maniscalco): Consider expanding the set of operations to include division, modulo, and +// floating point math. + +__CONSTEXPR static inline zx_time_t zx_time_add_duration(zx_time_t time, zx_duration_t duration) { + zx_time_t x = 0; + if (unlikely(add_overflow(time, duration, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_time_t zx_time_sub_duration(zx_time_t time, zx_duration_t duration) { + zx_time_t x = 0; + if (unlikely(sub_overflow(time, duration, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_time_sub_time(zx_time_t time1, zx_time_t time2) { + zx_duration_t x = 0; + if (unlikely(sub_overflow(time1, time2, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_duration_add_duration(zx_duration_t dur1, + zx_duration_t dur2) { + zx_duration_t x = 0; + if (unlikely(add_overflow(dur1, dur2, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_duration_sub_duration(zx_duration_t dur1, + zx_duration_t dur2) { + zx_duration_t x = 0; + if (unlikely(sub_overflow(dur1, dur2, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_duration_mul_int64(zx_duration_t duration, + int64_t multiplier) { + zx_duration_t x = 0; + if (unlikely(mul_overflow(duration, multiplier, &x))) { + if ((duration > 0 && multiplier > 0) || (duration < 0 && multiplier < 0)) { + return ZX_TIME_INFINITE; + } else { + return ZX_TIME_INFINITE_PAST; + } + } + return x; +} + +__CONSTEXPR static inline int64_t zx_nsec_from_duration(zx_duration_t n) { return n; } + +__CONSTEXPR static inline zx_duration_t zx_duration_from_nsec(int64_t n) { + return zx_duration_mul_int64(1, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_usec(int64_t n) { + return zx_duration_mul_int64(1000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_msec(int64_t n) { + return zx_duration_mul_int64(1000000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_sec(int64_t n) { + return zx_duration_mul_int64(1000000000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_min(int64_t n) { + return zx_duration_mul_int64(60000000000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_hour(int64_t n) { + return zx_duration_mul_int64(3600000000000, n); +} + +// Similar to the functions above, these macros perform overflow-safe unit conversion. Prefer to use +// the functions above instead of these macros. +#define ZX_NSEC(n) (__ISCONSTANT(n) ? ((zx_duration_t)(1LL * (n))) : (zx_duration_from_nsec(n))) +#define ZX_USEC(n) (__ISCONSTANT(n) ? ((zx_duration_t)(1000LL * (n))) : (zx_duration_from_usec(n))) +#define ZX_MSEC(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(1000000LL * (n))) : (zx_duration_from_msec(n))) +#define ZX_SEC(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(1000000000LL * (n))) : (zx_duration_from_sec(n))) +#define ZX_MIN(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(60LL * 1000000000LL * (n))) : (zx_duration_from_min(n))) +#define ZX_HOUR(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(3600LL * 1000000000LL * (n))) : (zx_duration_from_hour(n))) + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_TIME_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/tls.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/tls.h new file mode 100644 index 0000000..dae9694 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/tls.h
@@ -0,0 +1,29 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TLS_ +#define SYSROOT_ZIRCON_TLS_ + +// These constants are part of the C/C++ ABI known to compilers for +// *-fuchsia targets. These are offsets from the thread pointer. + +// This file must be includable in assembly files. + +#if defined(__x86_64__) + +#define ZX_TLS_STACK_GUARD_OFFSET 0x10 +#define ZX_TLS_UNSAFE_SP_OFFSET 0x18 + +#elif defined(__aarch64__) + +#define ZX_TLS_STACK_GUARD_OFFSET (-0x10) +#define ZX_TLS_UNSAFE_SP_OFFSET (-0x8) + +#else + +#error what architecture? + +#endif + +#endif // SYSROOT_ZIRCON_TLS_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/types.h b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/types.h new file mode 100644 index 0000000..10faebb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/include/zircon/types.h
@@ -0,0 +1,489 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TYPES_H_ +#define SYSROOT_ZIRCON_TYPES_H_ + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <zircon/compiler.h> +#include <zircon/errors.h> +#include <zircon/limits.h> +#include <zircon/rights.h> +#include <zircon/time.h> + +#ifndef __cplusplus +#ifndef _KERNEL +// We don't want to include <stdatomic.h> from the kernel code because the +// kernel definitions of atomic operations are incompatible with those defined +// in <stdatomic.h>. +// +// A better solution would be to use <stdatomic.h> and C11 atomic operation +// even in the kernel, but that would require modifying all the code that uses +// the existing homegrown atomics. +#include <stdatomic.h> +#endif +#endif + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +typedef uint32_t zx_handle_t; + +#define ZX_HANDLE_INVALID ((zx_handle_t)0) +#define ZX_HANDLE_FIXED_BITS_MASK ((zx_handle_t)0x3) + +// See errors.h for the values zx_status_t can take. +typedef int32_t zx_status_t; + +// clock ids +typedef uint32_t zx_clock_t; +#define ZX_CLOCK_MONOTONIC ((zx_clock_t)0) +#define ZX_CLOCK_UTC ((zx_clock_t)1) +#define ZX_CLOCK_THREAD ((zx_clock_t)2) + +typedef uint32_t zx_signals_t; + +#define ZX_SIGNAL_NONE ((zx_signals_t)0u) +#define ZX_USER_SIGNAL_ALL ((zx_signals_t)0xff000000u) + +// Implementation details (__ZX_* not intended for public consumption) +// +// Signals that have a common meaning where used are named with that +// meaning. Signals that do not, or are not yet in use, are named +// generically. +#define __ZX_OBJECT_SIGNAL_ALL ((zx_signals_t)0x00ffffffu) +#define __ZX_OBJECT_READABLE ((zx_signals_t)1u << 0) +#define __ZX_OBJECT_WRITABLE ((zx_signals_t)1u << 1) +#define __ZX_OBJECT_PEER_CLOSED ((zx_signals_t)1u << 2) +#define __ZX_OBJECT_SIGNALED ((zx_signals_t)1u << 3) +#define __ZX_OBJECT_SIGNAL_4 ((zx_signals_t)1u << 4) +#define __ZX_OBJECT_SIGNAL_5 ((zx_signals_t)1u << 5) +#define __ZX_OBJECT_SIGNAL_6 ((zx_signals_t)1u << 6) +#define __ZX_OBJECT_SIGNAL_7 ((zx_signals_t)1u << 7) +#define __ZX_OBJECT_SIGNAL_8 ((zx_signals_t)1u << 8) +#define __ZX_OBJECT_SIGNAL_9 ((zx_signals_t)1u << 9) +#define __ZX_OBJECT_SIGNAL_10 ((zx_signals_t)1u << 10) +#define __ZX_OBJECT_SIGNAL_11 ((zx_signals_t)1u << 11) +#define __ZX_OBJECT_SIGNAL_12 ((zx_signals_t)1u << 12) +#define __ZX_OBJECT_SIGNAL_13 ((zx_signals_t)1u << 13) +#define __ZX_OBJECT_SIGNAL_14 ((zx_signals_t)1u << 14) +#define __ZX_OBJECT_SIGNAL_15 ((zx_signals_t)1u << 15) +#define __ZX_OBJECT_SIGNAL_16 ((zx_signals_t)1u << 16) +#define __ZX_OBJECT_SIGNAL_17 ((zx_signals_t)1u << 17) +#define __ZX_OBJECT_SIGNAL_18 ((zx_signals_t)1u << 18) +#define __ZX_OBJECT_SIGNAL_19 ((zx_signals_t)1u << 19) +#define __ZX_OBJECT_SIGNAL_20 ((zx_signals_t)1u << 20) +#define __ZX_OBJECT_SIGNAL_21 ((zx_signals_t)1u << 21) +#define __ZX_OBJECT_SIGNAL_22 ((zx_signals_t)1u << 22) +#define __ZX_OBJECT_HANDLE_CLOSED ((zx_signals_t)1u << 23) + + + +// User Signals (for zx_object_signal() and zx_object_signal_peer()) +#define ZX_USER_SIGNAL_0 ((zx_signals_t)1u << 24) +#define ZX_USER_SIGNAL_1 ((zx_signals_t)1u << 25) +#define ZX_USER_SIGNAL_2 ((zx_signals_t)1u << 26) +#define ZX_USER_SIGNAL_3 ((zx_signals_t)1u << 27) +#define ZX_USER_SIGNAL_4 ((zx_signals_t)1u << 28) +#define ZX_USER_SIGNAL_5 ((zx_signals_t)1u << 29) +#define ZX_USER_SIGNAL_6 ((zx_signals_t)1u << 30) +#define ZX_USER_SIGNAL_7 ((zx_signals_t)1u << 31) + +// Cancellation (handle was closed while waiting with it) +#define ZX_SIGNAL_HANDLE_CLOSED __ZX_OBJECT_HANDLE_CLOSED + +// Event +#define ZX_EVENT_SIGNALED __ZX_OBJECT_SIGNALED +#define ZX_EVENT_SIGNAL_MASK (ZX_USER_SIGNAL_ALL | __ZX_OBJECT_SIGNALED) + +// EventPair +#define ZX_EVENTPAIR_SIGNALED __ZX_OBJECT_SIGNALED +#define ZX_EVENTPAIR_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED +#define ZX_EVENTPAIR_SIGNAL_MASK (ZX_USER_SIGNAL_ALL | __ZX_OBJECT_SIGNALED | __ZX_OBJECT_PEER_CLOSED) + +// Channel +#define ZX_CHANNEL_READABLE __ZX_OBJECT_READABLE +#define ZX_CHANNEL_WRITABLE __ZX_OBJECT_WRITABLE +#define ZX_CHANNEL_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED + +// Clock +#define ZX_CLOCK_STARTED __ZX_OBJECT_SIGNAL_4 + +// Socket +#define ZX_SOCKET_READABLE __ZX_OBJECT_READABLE +#define ZX_SOCKET_WRITABLE __ZX_OBJECT_WRITABLE +#define ZX_SOCKET_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED +#define ZX_SOCKET_PEER_WRITE_DISABLED __ZX_OBJECT_SIGNAL_4 +#define ZX_SOCKET_WRITE_DISABLED __ZX_OBJECT_SIGNAL_5 +#define ZX_SOCKET_READ_THRESHOLD __ZX_OBJECT_SIGNAL_10 +#define ZX_SOCKET_WRITE_THRESHOLD __ZX_OBJECT_SIGNAL_11 + +// Fifo +#define ZX_FIFO_READABLE __ZX_OBJECT_READABLE +#define ZX_FIFO_WRITABLE __ZX_OBJECT_WRITABLE +#define ZX_FIFO_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED + +// Task signals (process, thread, job) +#define ZX_TASK_TERMINATED __ZX_OBJECT_SIGNALED + +// Job +#define ZX_JOB_TERMINATED __ZX_OBJECT_SIGNALED +#define ZX_JOB_NO_JOBS __ZX_OBJECT_SIGNAL_4 +#define ZX_JOB_NO_PROCESSES __ZX_OBJECT_SIGNAL_5 + +// Process +#define ZX_PROCESS_TERMINATED __ZX_OBJECT_SIGNALED + +// Thread +#define ZX_THREAD_TERMINATED __ZX_OBJECT_SIGNALED +#define ZX_THREAD_RUNNING __ZX_OBJECT_SIGNAL_4 +#define ZX_THREAD_SUSPENDED __ZX_OBJECT_SIGNAL_5 + +// Log +#define ZX_LOG_READABLE __ZX_OBJECT_READABLE +#define ZX_LOG_WRITABLE __ZX_OBJECT_WRITABLE + +// Timer +#define ZX_TIMER_SIGNALED __ZX_OBJECT_SIGNALED + +// VMO +#define ZX_VMO_ZERO_CHILDREN __ZX_OBJECT_SIGNALED + +// global kernel object id. +// Note: kernel object ids use 63 bits, with the most significant bit being zero. +// The remaining values (msb==1) are for use by programs and tools that wish to +// create koids for artificial objects. +typedef uint64_t zx_koid_t; +#define ZX_KOID_INVALID ((uint64_t) 0) +#define ZX_KOID_KERNEL ((uint64_t) 1) +// The first non-reserved koid. The first 1024 are reserved. +#define ZX_KOID_FIRST ((uint64_t) 1024) + +// Maximum number of wait items allowed for zx_object_wait_many() +#define ZX_WAIT_MANY_MAX_ITEMS ((size_t)64) + +// Structure for zx_object_wait_many(): +typedef struct zx_wait_item { + zx_handle_t handle; + zx_signals_t waitfor; + zx_signals_t pending; +} zx_wait_item_t; + +// VM Object creation options +#define ZX_VMO_RESIZABLE ((uint32_t)1u << 1) + +// VM Object opcodes +#define ZX_VMO_OP_COMMIT ((uint32_t)1u) +#define ZX_VMO_OP_DECOMMIT ((uint32_t)2u) +#define ZX_VMO_OP_LOCK ((uint32_t)3u) +#define ZX_VMO_OP_UNLOCK ((uint32_t)4u) +// opcode 5 was ZX_VMO_OP_LOOKUP, but is now unused. +#define ZX_VMO_OP_CACHE_SYNC ((uint32_t)6u) +#define ZX_VMO_OP_CACHE_INVALIDATE ((uint32_t)7u) +#define ZX_VMO_OP_CACHE_CLEAN ((uint32_t)8u) +#define ZX_VMO_OP_CACHE_CLEAN_INVALIDATE ((uint32_t)9u) +#define ZX_VMO_OP_ZERO ((uint32_t)10u) + +// VM Object clone flags +#define ZX_VMO_CHILD_SNAPSHOT ((uint32_t)1u << 0) +#define ZX_VMO_CHILD_SNAPSHOT_AT_LEAST_ON_WRITE ((uint32_t)1u << 4) +#define ZX_VMO_CHILD_RESIZABLE ((uint32_t)1u << 2) +#define ZX_VMO_CHILD_SLICE ((uint32_t)1u << 3) +#define ZX_VMO_CHILD_NO_WRITE ((uint32_t)1u << 5) +// Old clone flags that are on the path to deprecation. +#define ZX_VMO_CLONE_COPY_ON_WRITE ((uint32_t)1u << 4) +#define ZX_VMO_CHILD_COPY_ON_WRITE ((uint32_t)1u << 4) +#define ZX_VMO_CHILD_PRIVATE_PAGER_COPY ((uint32_t)1u << 4) + +typedef uint32_t zx_vm_option_t; +// Mapping flags to vmar routines +#define ZX_VM_PERM_READ ((zx_vm_option_t)(1u << 0)) +#define ZX_VM_PERM_WRITE ((zx_vm_option_t)(1u << 1)) +#define ZX_VM_PERM_EXECUTE ((zx_vm_option_t)(1u << 2)) +#define ZX_VM_COMPACT ((zx_vm_option_t)(1u << 3)) +#define ZX_VM_SPECIFIC ((zx_vm_option_t)(1u << 4)) +#define ZX_VM_SPECIFIC_OVERWRITE ((zx_vm_option_t)(1u << 5)) +#define ZX_VM_CAN_MAP_SPECIFIC ((zx_vm_option_t)(1u << 6)) +#define ZX_VM_CAN_MAP_READ ((zx_vm_option_t)(1u << 7)) +#define ZX_VM_CAN_MAP_WRITE ((zx_vm_option_t)(1u << 8)) +#define ZX_VM_CAN_MAP_EXECUTE ((zx_vm_option_t)(1u << 9)) +#define ZX_VM_MAP_RANGE ((zx_vm_option_t)(1u << 10)) +#define ZX_VM_REQUIRE_NON_RESIZABLE ((zx_vm_option_t)(1u << 11)) +#define ZX_VM_ALLOW_FAULTS ((zx_vm_option_t)(1u << 12)) + +#define ZX_VM_ALIGN_BASE 24 +#define ZX_VM_ALIGN_1KB ((zx_vm_option_t)(10u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_2KB ((zx_vm_option_t)(11u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_4KB ((zx_vm_option_t)(12u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_8KB ((zx_vm_option_t)(13u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_16KB ((zx_vm_option_t)(14u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_32KB ((zx_vm_option_t)(15u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_64KB ((zx_vm_option_t)(16u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_128KB ((zx_vm_option_t)(17u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_256KB ((zx_vm_option_t)(18u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_512KB ((zx_vm_option_t)(19u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_1MB ((zx_vm_option_t)(20u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_2MB ((zx_vm_option_t)(21u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_4MB ((zx_vm_option_t)(22u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_8MB ((zx_vm_option_t)(23u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_16MB ((zx_vm_option_t)(24u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_32MB ((zx_vm_option_t)(25u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_64MB ((zx_vm_option_t)(26u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_128MB ((zx_vm_option_t)(27u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_256MB ((zx_vm_option_t)(28u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_512MB ((zx_vm_option_t)(29u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_1GB ((zx_vm_option_t)(30u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_2GB ((zx_vm_option_t)(31u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_4GB ((zx_vm_option_t)(32u << ZX_VM_ALIGN_BASE)) + +// virtual address +typedef uintptr_t zx_vaddr_t; + +// physical address +typedef uintptr_t zx_paddr_t; +// low mem physical address +typedef uint32_t zx_paddr32_t; +// Hypervisor guest physical addresses. +typedef uintptr_t zx_gpaddr_t; + +// offset +typedef uint64_t zx_off_t; + +// vectorized I/O +typedef struct zx_iovec { + void* buffer; + size_t capacity; +} zx_iovec_t; + +// Maximum string length for kernel names (process name, thread name, etc) +#define ZX_MAX_NAME_LEN ((size_t)32u) + +// Buffer size limits on the cprng syscalls +#define ZX_CPRNG_DRAW_MAX_LEN ((size_t)256u) +#define ZX_CPRNG_ADD_ENTROPY_MAX_LEN ((size_t)256u) + +// interrupt_create flags +#define ZX_INTERRUPT_REMAP_IRQ ((uint32_t)0x1u) +#define ZX_INTERRUPT_MODE_DEFAULT ((uint32_t)0u << 1) +#define ZX_INTERRUPT_MODE_EDGE_LOW ((uint32_t)1u << 1) +#define ZX_INTERRUPT_MODE_EDGE_HIGH ((uint32_t)2u << 1) +#define ZX_INTERRUPT_MODE_LEVEL_LOW ((uint32_t)3u << 1) +#define ZX_INTERRUPT_MODE_LEVEL_HIGH ((uint32_t)4u << 1) +#define ZX_INTERRUPT_MODE_EDGE_BOTH ((uint32_t)5u << 1) +#define ZX_INTERRUPT_MODE_MASK ((uint32_t)0xe) +#define ZX_INTERRUPT_VIRTUAL ((uint32_t)0x10) + +// interrupt_bind flags +#define ZX_INTERRUPT_BIND ((uint32_t)0x0u) +#define ZX_INTERRUPT_UNBIND ((uint32_t)0x1u) + +// Preallocated virtual interrupt slot, typically used for signaling interrupt threads to exit. +#define ZX_INTERRUPT_SLOT_USER ((uint32_t)62u) +// interrupt wait slots must be in the range 0 - 62 inclusive +#define ZX_INTERRUPT_MAX_SLOTS ((uint32_t)62u) + +// PCI interrupt handles use interrupt slot 0 for the PCI hardware interrupt +#define ZX_PCI_INTERRUPT_SLOT ((uint32_t)0u) + +// Channel options and limits. +#define ZX_CHANNEL_READ_MAY_DISCARD ((uint32_t)1u) + +#define ZX_CHANNEL_MAX_MSG_BYTES ((uint32_t)65536u) +#define ZX_CHANNEL_MAX_MSG_HANDLES ((uint32_t)64u) + +// Fifo limits. +#define ZX_FIFO_MAX_SIZE_BYTES ZX_PAGE_SIZE + +// Socket options and limits. +// These options can be passed to zx_socket_shutdown(). +#define ZX_SOCKET_SHUTDOWN_WRITE ((uint32_t)1u << 0) +#define ZX_SOCKET_SHUTDOWN_READ ((uint32_t)1u << 1) +#define ZX_SOCKET_SHUTDOWN_MASK (ZX_SOCKET_SHUTDOWN_WRITE | ZX_SOCKET_SHUTDOWN_READ) + +// These can be passed to zx_socket_create(). +#define ZX_SOCKET_STREAM ((uint32_t)0u) +#define ZX_SOCKET_DATAGRAM ((uint32_t)1u << 0) +#define ZX_SOCKET_CREATE_MASK (ZX_SOCKET_DATAGRAM) + +// These can be passed to zx_socket_read(). +#define ZX_SOCKET_PEEK ((uint32_t)1u << 3) + +// These can be passed to zx_stream_create(). +#define ZX_STREAM_MODE_READ ((uint32_t)1u << 0) +#define ZX_STREAM_MODE_WRITE ((uint32_t)1u << 1) +#define ZX_STREAM_CREATE_MASK (ZX_STREAM_MODE_READ | ZX_STREAM_MODE_WRITE) + +// These can be passed to zx_stream_writev(). +#define ZX_STREAM_APPEND ((uint32_t)1u << 0) + +typedef uint32_t zx_stream_seek_origin_t; +#define ZX_STREAM_SEEK_ORIGIN_START ((zx_stream_seek_origin_t)0u) +#define ZX_STREAM_SEEK_ORIGIN_CURRENT ((zx_stream_seek_origin_t)1u) +#define ZX_STREAM_SEEK_ORIGIN_END ((zx_stream_seek_origin_t)2u) + +// Flags which can be used to to control cache policy for APIs which map memory. +#define ZX_CACHE_POLICY_CACHED ((uint32_t)0u) +#define ZX_CACHE_POLICY_UNCACHED ((uint32_t)1u) +#define ZX_CACHE_POLICY_UNCACHED_DEVICE ((uint32_t)2u) +#define ZX_CACHE_POLICY_WRITE_COMBINING ((uint32_t)3u) +#define ZX_CACHE_POLICY_MASK ((uint32_t)3u) + +// Flag bits for zx_cache_flush. +#define ZX_CACHE_FLUSH_INSN ((uint32_t)1u << 0) +#define ZX_CACHE_FLUSH_DATA ((uint32_t)1u << 1) +#define ZX_CACHE_FLUSH_INVALIDATE ((uint32_t)1u << 2) + +// Timer options. +#define ZX_TIMER_SLACK_CENTER ((uint32_t)0u) +#define ZX_TIMER_SLACK_EARLY ((uint32_t)1u) +#define ZX_TIMER_SLACK_LATE ((uint32_t)2u) + +// Bus Transaction Initiator options. +#define ZX_BTI_PERM_READ ((uint32_t)1u << 0) +#define ZX_BTI_PERM_WRITE ((uint32_t)1u << 1) +#define ZX_BTI_PERM_EXECUTE ((uint32_t)1u << 2) +#define ZX_BTI_COMPRESS ((uint32_t)1u << 3) +#define ZX_BTI_CONTIGUOUS ((uint32_t)1u << 4) + +// Job options. +// These options can be passed to zx_job_set_critical(). +#define ZX_JOB_CRITICAL_PROCESS_RETCODE_NONZERO ((uint32_t)1u << 0) + +typedef uint32_t zx_obj_type_t; + +#define ZX_OBJ_TYPE_NONE ((zx_obj_type_t)0u) +#define ZX_OBJ_TYPE_PROCESS ((zx_obj_type_t)1u) +#define ZX_OBJ_TYPE_THREAD ((zx_obj_type_t)2u) +#define ZX_OBJ_TYPE_VMO ((zx_obj_type_t)3u) +#define ZX_OBJ_TYPE_CHANNEL ((zx_obj_type_t)4u) +#define ZX_OBJ_TYPE_EVENT ((zx_obj_type_t)5u) +#define ZX_OBJ_TYPE_PORT ((zx_obj_type_t)6u) +#define ZX_OBJ_TYPE_INTERRUPT ((zx_obj_type_t)9u) +#define ZX_OBJ_TYPE_PCI_DEVICE ((zx_obj_type_t)11u) +#define ZX_OBJ_TYPE_LOG ((zx_obj_type_t)12u) +#define ZX_OBJ_TYPE_SOCKET ((zx_obj_type_t)14u) +#define ZX_OBJ_TYPE_RESOURCE ((zx_obj_type_t)15u) +#define ZX_OBJ_TYPE_EVENTPAIR ((zx_obj_type_t)16u) +#define ZX_OBJ_TYPE_JOB ((zx_obj_type_t)17u) +#define ZX_OBJ_TYPE_VMAR ((zx_obj_type_t)18u) +#define ZX_OBJ_TYPE_FIFO ((zx_obj_type_t)19u) +#define ZX_OBJ_TYPE_GUEST ((zx_obj_type_t)20u) +#define ZX_OBJ_TYPE_VCPU ((zx_obj_type_t)21u) +#define ZX_OBJ_TYPE_TIMER ((zx_obj_type_t)22u) +#define ZX_OBJ_TYPE_IOMMU ((zx_obj_type_t)23u) +#define ZX_OBJ_TYPE_BTI ((zx_obj_type_t)24u) +#define ZX_OBJ_TYPE_PROFILE ((zx_obj_type_t)25u) +#define ZX_OBJ_TYPE_PMT ((zx_obj_type_t)26u) +#define ZX_OBJ_TYPE_SUSPEND_TOKEN ((zx_obj_type_t)27u) +#define ZX_OBJ_TYPE_PAGER ((zx_obj_type_t)28u) +#define ZX_OBJ_TYPE_EXCEPTION ((zx_obj_type_t)29u) +#define ZX_OBJ_TYPE_CLOCK ((zx_obj_type_t)30u) +#define ZX_OBJ_TYPE_STREAM ((zx_obj_type_t)31u) +#define ZX_OBJ_TYPE_MSI_ALLOCATION ((zx_obj_type_t)32u) +#define ZX_OBJ_TYPE_MSI_INTERRUPT ((zx_obj_type_t)33u) + +// System ABI commits to having no more than 64 object types. +// +// See zx_info_process_handle_stats_t for an example of a binary interface that +// depends on having an upper bound for the number of object types. +#define ZX_OBJ_TYPE_UPPER_BOUND ((zx_obj_type_t)64u) + +typedef uint32_t zx_system_event_type_t; +#define ZX_SYSTEM_EVENT_OUT_OF_MEMORY ((zx_system_event_type_t)1u) +#define ZX_SYSTEM_EVENT_MEMORY_PRESSURE_CRITICAL ((zx_system_event_type_t)2u) +#define ZX_SYSTEM_EVENT_MEMORY_PRESSURE_WARNING ((zx_system_event_type_t)3u) +#define ZX_SYSTEM_EVENT_MEMORY_PRESSURE_NORMAL ((zx_system_event_type_t)4u) + +// Used in channel_read_etc. +typedef struct zx_handle_info { + zx_handle_t handle; + zx_obj_type_t type; + zx_rights_t rights; + uint32_t unused; +} zx_handle_info_t; + +typedef uint32_t zx_handle_op_t; + +#define ZX_HANDLE_OP_MOVE ((zx_handle_op_t)0u) +#define ZX_HANDLE_OP_DUPLICATE ((zx_handle_op_t)1u) + +// Used in channel_write_etc. +typedef struct zx_handle_disposition { + zx_handle_op_t operation; + zx_handle_t handle; + zx_obj_type_t type; + zx_rights_t rights; + zx_status_t result; +} zx_handle_disposition_t; + +// Transaction ID and argument types for zx_channel_call. +typedef uint32_t zx_txid_t; + +typedef struct zx_channel_call_args { + const void* wr_bytes; + const zx_handle_t* wr_handles; + void *rd_bytes; + zx_handle_t* rd_handles; + uint32_t wr_num_bytes; + uint32_t wr_num_handles; + uint32_t rd_num_bytes; + uint32_t rd_num_handles; +} zx_channel_call_args_t; + +// The ZX_VM_FLAG_* constants are to be deprecated in favor of the ZX_VM_* +// versions. +#define ZX_VM_FLAG_PERM_READ ((uint32_t)1u << 0) +#define ZX_VM_FLAG_PERM_WRITE ((uint32_t)1u << 1) +#define ZX_VM_FLAG_PERM_EXECUTE ((uint32_t)1u << 2) +#define ZX_VM_FLAG_COMPACT ((uint32_t)1u << 3) +#define ZX_VM_FLAG_SPECIFIC ((uint32_t)1u << 4) +#define ZX_VM_FLAG_SPECIFIC_OVERWRITE ((uint32_t)1u << 5) +#define ZX_VM_FLAG_CAN_MAP_SPECIFIC ((uint32_t)1u << 6) +#define ZX_VM_FLAG_CAN_MAP_READ ((uint32_t)1u << 7) +#define ZX_VM_FLAG_CAN_MAP_WRITE ((uint32_t)1u << 8) +#define ZX_VM_FLAG_CAN_MAP_EXECUTE ((uint32_t)1u << 9) +#define ZX_VM_FLAG_MAP_RANGE ((uint32_t)1u << 10) +#define ZX_VM_FLAG_REQUIRE_NON_RESIZABLE ((uint32_t)1u << 11) + +// CPU masks specifying sets of CPUs. +// +// We currently are limited to systems with 512 CPUs or less. +#define ZX_CPU_SET_MAX_CPUS 512 +#define ZX_CPU_SET_BITS_PER_WORD 64 + +typedef struct zx_cpu_set { + // The |N|'th CPU is considered in the CPU set if the bit: + // + // cpu_mask[N / ZX_CPU_SET_BITS_PER_WORD] + // & (1 << (N % ZX_CPU_SET_BITS_PER_WORD)) + // + // is set. + uint64_t mask[ZX_CPU_SET_MAX_CPUS / ZX_CPU_SET_BITS_PER_WORD]; +} zx_cpu_set_t; + +#ifdef __cplusplus +// We cannot use <stdatomic.h> with C++ code as _Atomic qualifier defined by +// C11 is not valid in C++11. There is not a single standard name that can +// be used in both C and C++. C++ <atomic> defines names which are equivalent +// to those in <stdatomic.h>, but these are contained in the std namespace. +// +// In kernel, the only operation done is a user_copy (of sizeof(int)) inside a +// lock; otherwise the futex address is treated as a key. +typedef int zx_futex_t; +#else +#ifdef _KERNEL +typedef int zx_futex_t; +#else +typedef atomic_int zx_futex_t; +#endif +#endif +typedef int zx_futex_storage_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/Scrt1.o b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/Scrt1.o new file mode 100644 index 0000000..330b0d5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/Scrt1.o Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libc.so b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libc.so new file mode 100755 index 0000000..fedc0d4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libc.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libdl.so b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libdl.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libdl.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libm.so b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libm.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libm.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libpthread.so b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libpthread.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libpthread.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/librt.so b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/librt.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/librt.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libzircon.so b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libzircon.so new file mode 100755 index 0000000..a40723d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/sysroot/lib/libzircon.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/alias_workarounds.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/alias_workarounds.fidl new file mode 100644 index 0000000..bdcfc5f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/alias_workarounds.fidl
@@ -0,0 +1,100 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// These are all aliases that will be subsumed by the future implementation of +// templating, constraints, etc. in fidlc. +// +// The right hand side is completely ignored by kazoo, that is, only the name of +// the alias is significant. Generally the right hand side is set so that if +// there were no handling of the alias (and the alias was "expanded" as is the +// default behaviour), it would result in something sensible. + +// TODO(fidlc): (mutable) char* +using charptr = uint64; + +// TODO(fidl) +using const_futexptr = int32; + +// TODO(fidlc): const void* +using const_voidptr = uint64; + +// TODO(fidlc): mutable<string> +using mutable_string = string; + +// TODO(fidlc): mutable<uint32> +using mutable_uint32 = uint32; + +// TODO(fidlc): mutable<usize> +using mutable_usize = usize; + +// TODO(fidlc): uint32 size +// TODO(fidlc): mutable<vector<HandleDisposition> +using mutable_vector_HandleDisposition_u32size = vector<HandleDisposition>; + +// TODO(fidlc): mutable<vector<WaitItem>> +using mutable_vector_WaitItem = vector<WaitItem>; + +// TODO(fidlc): uint32 size +// TODO(fidlc): mutable<vector<handle> +using mutable_vector_handle_u32size = vector<handle>; + +// TODO(fidlc): mutable<vector<void>> +using mutable_vector_void = vector<byte>; + +// TODO(fidlc): uint32 size +// TODO(fidlc): mutable<vector<void>> +using mutable_vector_void_u32size = vector<byte>; + +// TODO(fidlc): optional<PciBar> +using optional_PciBar = PciBar; + +// TODO(fidlc): optional<PortPacket> +using optional_PortPacket = PortPacket; + +// TODO(fidlc): optional<koid> +using optional_koid = koid; + +// TODO(fidlc): optional<signals> +using optional_signals = signals; + +// TODO(fidlc): optional<time> +using optional_time = time; + +// TODO(fidlc): optional<uint32> +using optional_uint32 = uint32; + +// TODO(fidlc): optional<usize> +using optional_usize = usize; + +// TODO(fidlc): optional<usize> +using optional_off = off; + +// TODO(fidlc): uint32 size +// TODO(fidlc): vector<HandleInfo> +using vector_HandleInfo_u32size = vector<HandleInfo>; + +// TODO(fidlc): vector<handle> uint32 size +using vector_handle_u32size = vector<handle>; + +// TODO(fidlc): vector<paddr>> +using vector_paddr = vector<paddr>; + +// TODO(fidlc): vector<void> +using vector_void = vector<byte>; + +// TODO(fidlc): vector<iovec> +using vector_iovec = vector<byte>; + +// TODO(fidlc): uint32 size +// TODO(fidlc): vector<void> +using vector_void_u32size = vector<byte>; + +// TODO(fidlc): (mutable) void* +using voidptr = uint64; + +// This is <zircon/string_view.h>'s zx_string_view_t in C/C++. +using string_view = uint64;
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/bti.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/bti.fidl new file mode 100644 index 0000000..8ec1c08 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/bti.fidl
@@ -0,0 +1,32 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol bti { + /// Create a new bus transaction initiator. + /// Rights: iommu must be of type ZX_OBJ_TYPE_IOMMU and have ZX_RIGHT_NONE. + // TODO(ZX-2967): This is an unusual rights spec. + bti_create(handle<iommu> iommu, uint32 options, uint64 bti_id) -> (status status, handle<bti> out); + + /// Pin pages and grant devices access to them. + /// Rights: handle must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_MAP. + /// Rights: vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_MAP. + /// Rights: If options & ZX_BTI_PERM_READ, vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: If options & ZX_BTI_PERM_WRITE, vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If options & ZX_BTI_PERM_EXECUTE, vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + // READ is intentional in the EXECUTE condition. + bti_pin(handle<bti> handle, + uint32 options, + handle<vmo> vmo, + uint64 offset, + uint64 size) + -> (status status, vector_paddr addrs, handle<pmt> pmt); + + /// Releases all quarantined PMTs. + /// Rights: handle must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_WRITE. + bti_release_quarantine(handle<bti> handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/cache.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/cache.fidl new file mode 100644 index 0000000..f1f8567 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/cache.fidl
@@ -0,0 +1,13 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol cache { + /// Flush CPU data and/or instruction caches. + [vdsocall] + cache_flush(const_voidptr addr, usize size, uint32 options) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/channel.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/channel.fidl new file mode 100644 index 0000000..25c8ca3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/channel.fidl
@@ -0,0 +1,107 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +using ObjType = uint32; + +// TODO(scottmg): ZX_OBJ_TYPE_xyz here. + +using HandleOp = uint32; + +// TODO(scottmg): ZX_HANDLE_OP_xyz here. + +struct HandleInfo { + handle handle; + ObjType type; + rights rights; + uint32 unused; +}; + +struct ChannelCallArgs { + vector<byte> wr_bytes; + vector<handle> wr_handles; + // TODO(scottmg): mutable_vector_void + vector<byte> rd_bytes; + // TODO(scottmg): mutable_vector_handle + vector<handle> rd_handles; +}; + +struct HandleDisposition { + HandleOp operation; + handle handle; + ObjType type; + rights rights; + status result; +}; + +[Transport = "Syscall"] +protocol channel { + /// Create a channel. + channel_create(uint32 options) -> (status status, handle out0, handle out1); + + /// Read a message from a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ. + [ArgReorder = "handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles", + HandleUnchecked] + channel_read(handle<channel> handle, + uint32 options) + -> (status status, + vector_void_u32size bytes, + vector_handle_u32size handles, + optional_uint32 actual_bytes, + optional_uint32 actual_handles); + + /// Read a message from a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ. + [ArgReorder = "handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles"] + channel_read_etc(handle<channel> handle, + uint32 options) + -> (status status, + vector_void_u32size bytes, + vector_HandleInfo_u32size handles, + optional_uint32 actual_bytes, + optional_uint32 actual_handles); + + /// Write a message to a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_WRITE. + /// Rights: Every entry of handles must have ZX_RIGHT_TRANSFER. + channel_write(handle<channel> handle, + uint32 options, + vector_void_u32size bytes, + vector_handle_u32size handles) + -> (status status); + + /// Write a message to a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_WRITE. + /// Rights: Every entry of handles must have ZX_RIGHT_TRANSFER. + channel_write_etc(handle<channel> handle, + uint32 options, + vector_void_u32size bytes, + mutable_vector_HandleDisposition_u32size handles) + -> (status status); + + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + /// Rights: All wr_handles of args must have ZX_RIGHT_TRANSFER. + [internal] + channel_call_noretry(handle<channel> handle, + uint32 options, + time deadline, + ChannelCallArgs args) + -> (status status, uint32 actual_bytes, uint32 actual_handles); + + [internal] + channel_call_finish(time deadline, ChannelCallArgs args) + -> (status status, uint32 actual_bytes, uint32 actual_handles); + + /// Send a message to a channel and await a reply. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + /// Rights: All wr_handles of args must have ZX_RIGHT_TRANSFER. + [blocking, + vdsocall] + // TODO(scottmg): Express "All wr_handles of args must have ZX_RIGHT_TRANSFER." + channel_call(handle handle, uint32 options, time deadline, ChannelCallArgs args) + -> (status status, uint32 actual_bytes, uint32 actual_handles); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/clock.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/clock.fidl new file mode 100644 index 0000000..5aecb3b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/clock.fidl
@@ -0,0 +1,51 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +enum Clock : uint32 { + MONOTONIC = 0; + UTC = 1; + THREAD = 2; +}; + +[Transport = "Syscall"] +protocol clock { + /// Acquire the current time. + clock_get(Clock clock_id) -> (status status, time out); + + /// Acquire the current monotonic time. + [vdsocall] + clock_get_monotonic() -> (time time); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + clock_adjust(handle<resource> handle, Clock clock_id, int64 offset) -> (status status); + + // Read clock monotonic, but demand that the read be performed using a + // syscall, instead of a vdso call. + // + // See the notes for ticks_get_via_kernel; this is not a syscall meant + // to be used by application code. + [internal] + clock_get_monotonic_via_kernel() -> (time time); + + // TODO: handle<clock> for all of these. + + /// Create a new clock object. + /// Rights: None. + clock_create(uint64 options, const_voidptr args) -> (status status, handle out); + + /// Perform a basic read of the clock. + /// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_READ. + clock_read(handle handle) -> (status status, time now); + + /// Fetch all of the low level details of the clock's current status. + /// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_READ. + clock_get_details(handle handle, uint64 options) -> (status status, voidptr details); + + /// Make adjustments to a clock object. + /// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_WRITE. + clock_update(handle handle, uint64 options, const_voidptr args) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/cprng.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/cprng.fidl new file mode 100644 index 0000000..7431bde --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/cprng.fidl
@@ -0,0 +1,19 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol cprng { + [internal] + cprng_draw_once() -> (status status, vector_void buffer); + + /// Draw from the kernel's CPRNG. + [vdsocall] + cprng_draw() -> (vector_void buffer); + + /// Add entropy to the kernel CPRNG. + cprng_add_entropy(vector_void buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/debug.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/debug.fidl new file mode 100644 index 0000000..e629799 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/debug.fidl
@@ -0,0 +1,17 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol debug { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + debug_read(handle<resource> handle) -> (status status, string buffer, usize actual); + + debug_write(string buffer) -> (status status); + + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + debug_send_command(handle<resource> resource, string buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/debuglog.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/debuglog.fidl new file mode 100644 index 0000000..23e1faf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/debuglog.fidl
@@ -0,0 +1,20 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol debuglog { + // TODO(ZX-2967): handle == ZX_HANDLE_INVALID accepted. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + debuglog_create(handle<resource> resource, uint32 options) + -> (status status, handle<debuglog> out); + + /// Rights: handle must be of type ZX_OBJ_TYPE_LOG and have ZX_RIGHT_WRITE. + debuglog_write(handle<debuglog> handle, uint32 options, vector_void buffer) -> (status status); + + /// Rights: handle must be of type ZX_OBJ_TYPE_LOG and have ZX_RIGHT_READ. + debuglog_read(handle<debuglog> handle, uint32 options) -> (status status, vector_void buffer); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/event.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/event.fidl new file mode 100644 index 0000000..4f12cd8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/event.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol event { + /// Create an event. + event_create(uint32 options) -> (status status, handle<event> out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/eventpair.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/eventpair.fidl new file mode 100644 index 0000000..a7a3e38 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/eventpair.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol eventpair { + /// Create an event pair. + eventpair_create(uint32 options) -> (status status, handle<event> out0, handle<event> out1); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/exception.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/exception.fidl new file mode 100644 index 0000000..db3e45a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/exception.fidl
@@ -0,0 +1,17 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol exception { + /// Create a handle for the exception's thread. + /// Rights: handle must be of type ZX_OBJ_TYPE_EXCEPTION. + exception_get_thread(handle<exception> handle) -> (status status, handle<thread> out); + + /// Create a handle for the exception's process. + /// Rights: handle must be of type ZX_OBJ_TYPE_EXCEPTION. + exception_get_process(handle<exception> handle) -> (status status, handle<process> out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/fifo.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/fifo.fidl new file mode 100644 index 0000000..0e9ee21 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/fifo.fidl
@@ -0,0 +1,23 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol fifo { + /// Create a fifo. + fifo_create(usize elem_count, usize elem_size, uint32 options) + -> (status status, handle<fifo> out0, handle<fifo> out1); + + /// Read data from a fifo. + /// Rights: handle must be of type ZX_OBJ_TYPE_FIFO and have ZX_RIGHT_READ. + fifo_read(handle<fifo> handle, usize elem_size) + -> (status status, vector_void data, optional_usize actual_count); + + /// Write data to a fifo. + /// Rights: handle must be of type ZX_OBJ_TYPE_FIFO and have ZX_RIGHT_WRITE. + fifo_write(handle<fifo> handle, usize elem_size, const_voidptr data, usize count) + -> (status status, optional_usize actual_count); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/framebuffer.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/framebuffer.fidl new file mode 100644 index 0000000..2ab69c7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/framebuffer.fidl
@@ -0,0 +1,24 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol framebuffer { + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + framebuffer_get_info(handle<resource> resource) + -> (status status, uint32 format, uint32 width, uint32 height, uint32 stride); + + // TODO(ZX-2967): vmo ZX_OBJ_TYPE_VMO; No rights required? + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + framebuffer_set_range(handle<resource> resource, + handle<vmo> vmo, + uint32 len, + uint32 format, + uint32 width, + uint32 height, + uint32 stride) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/futex.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/futex.fidl new file mode 100644 index 0000000..69ab6dc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/futex.fidl
@@ -0,0 +1,58 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): This is approximately right, but will need to match the +// current definition of zx_futex_t (atomic_int in some #if branches). +using Futex = int32; + +// TODO(scottmg): The futex is unusual in that by virtue of being an int, +// sometimes it's passed by pointer, and sometimes by value. + +[Transport = "Syscall"] +protocol futex { + /// Wait on a futex. + /// Rights: None. + [blocking] + futex_wait(const_futexptr value_ptr, Futex current_value, handle new_futex_owner, time deadline) + -> (status status); + + /// Wake some number of threads waiting on a futex, and set the ownership of the futex to nothing. + /// Rights: None. + futex_wake(const_futexptr value_ptr, uint32 wake_count) -> (status status); + + /// Wake some number of threads waiting on a futex, and move more waiters to another wait queue. + /// Rights: None. + futex_requeue(const_futexptr value_ptr, + uint32 wake_count, + Futex current_value, + const_futexptr requeue_ptr, + uint32 requeue_count, + handle new_requeue_owner) + -> (status status); + + /// Wake one thread waiting on a futex. If a thread is woken, + /// ownership of the futex is transferred to that thread. If no + /// thread is woken (because none are waiting), ownership of the + /// futex is set to none. + /// Rights: None. + futex_wake_single_owner(const_futexptr value_ptr) -> (status status); + + /// Wake one thread waiting on a futex, and move more waiters to + /// another wait queue. Ownership is transferred to the woken thread, + /// or cancelled, as with |futex_wake_single_owner|. + /// Rights: None. + futex_requeue_single_owner(const_futexptr value_ptr, + Futex current_value, + const_futexptr requeue_ptr, + uint32 requeue_count, + handle new_requeue_owner) + -> (status status); + + /// Fetch the koid current owner of a futex, if any. + /// Rights: None. + futex_get_owner(const_futexptr value_ptr) -> (status status, optional_koid koid); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/guest.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/guest.fidl new file mode 100644 index 0000000..a75093e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/guest.fidl
@@ -0,0 +1,25 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol guest { + /// Create a guest. + /// Rights: resource must have resource kind ZX_RSRC_KIND_HYPERVISOR. + guest_create(handle<resource> resource, uint32 options) + -> (status status, handle<guest> guest_handle, handle<vmar> vmar_handle); + + /// Sets a trap within a guest. + /// Rights: handle must be of type ZX_OBJ_TYPE_GUEST and have ZX_RIGHT_WRITE. + /// Rights: port_handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + guest_set_trap(handle<guest> handle, + uint32 kind, + vaddr addr, + usize size, + handle<port> port_handle, + uint64 key) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/handle.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/handle.fidl new file mode 100644 index 0000000..b29842b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/handle.fidl
@@ -0,0 +1,25 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol handle { + /// Close a handle. + /// Rights: None. + handle_close([Release] handle handle) -> (status status); + + /// Close a number of handles. + /// Rights: None. + handle_close_many([Release] vector<handle> handles) -> (status status); + + /// Duplicate a handle. + /// Rights: handle must have ZX_RIGHT_DUPLICATE. + handle_duplicate(handle handle, rights rights) -> (status status, handle out); + + /// Replace a handle. + /// Rights: None. + handle_replace([Release] handle handle, rights rights) -> (status status, handle out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/interrupt.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/interrupt.fidl new file mode 100644 index 0000000..506df65 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/interrupt.fidl
@@ -0,0 +1,43 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol interrupt { + /// Create an interrupt object. + /// Rights: src_obj must have resource kind ZX_RSRC_KIND_IRQ. + interrupt_create(handle<resource> src_obj, uint32 src_num, uint32 options) + -> (status status, handle<interrupt> out_handle); + + /// Bind an interrupt object to a port. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_READ. + /// Rights: port_handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + interrupt_bind(handle<interrupt> handle, handle<port> port_handle, uint64 key, uint32 options) + -> (status status); + + /// Wait for an interrupt. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_WAIT. + [blocking] + interrupt_wait(handle<interrupt> handle) -> (status status, optional_time out_timestamp); + + // TODO(ZX-2967): No DESTROY rights here. + /// Destroys an interrupt object. + interrupt_destroy(handle<interrupt> handle) -> (status status); + + /// Acknowledge an interrupt and re-arm it. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_WRITE. + interrupt_ack(handle<interrupt> handle) -> (status status); + + /// Triggers a virtual interrupt object. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_SIGNAL. + interrupt_trigger(handle<interrupt> handle, uint32 options, time timestamp) -> (status status); + + /// Bind an interrupt object to a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_READ. + /// Rights: vcpu must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_WRITE. + interrupt_bind_vcpu(handle<interrupt> handle, handle<vcpu> vcpu, uint32 options) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/iommu.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/iommu.fidl new file mode 100644 index 0000000..84ac2a9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/iommu.fidl
@@ -0,0 +1,14 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol iommu { + /// Create a new IOMMU object in the kernel. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + iommu_create(handle<resource> resource, uint32 type, vector_void desc) + -> (status status, handle<iommu> out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/ioports.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/ioports.fidl new file mode 100644 index 0000000..72353d3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/ioports.fidl
@@ -0,0 +1,15 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol ioports { + /// Rights: resource must have resource kind ZX_RSRC_KIND_IOPORT. + ioports_request(handle<resource> resource, uint16 io_addr, uint32 len) -> (status status); + + /// Rights: resource must have resource kind ZX_RSRC_KIND_IOPORT. + ioports_release(handle<resource> resource, uint16 io_addr, uint32 len) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/job.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/job.fidl new file mode 100644 index 0000000..edbdd2c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/job.fidl
@@ -0,0 +1,24 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol job { + // TODO(ZX-2967): parent_job with ZX_RIGHT_WRITE is also accepted. + /// Create a new job. + /// Rights: parent_job must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_MANAGE_JOB. + job_create(handle<job> parent_job, uint32 options) -> (status status, handle<job> out); + + /// Set job security and resource policies. + /// Rights: handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_SET_POLICY. + job_set_policy(handle<job> handle, uint32 options, uint32 topic, vector_void_u32size policy) + -> (status status); + + /// Set a process as critical to a job. + /// Rights: job must have ZX_RIGHT_DESTROY. + /// Rights: process must have ZX_RIGHT_WAIT. + job_set_critical(handle<job> job, uint32 options, handle<process> process) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/ktrace.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/ktrace.fidl new file mode 100644 index 0000000..d3234e6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/ktrace.fidl
@@ -0,0 +1,26 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol ktrace { + // TODO(scottmg): This is another one where it's: + // (handle, data, offset, data_size) + // rather than: + // (handle, data, data_size, offset). + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + [ArgReorder = "handle, data, offset, data_size, actual"] + ktrace_read(handle<resource> handle, uint32 offset) + -> (status status, vector_void data, usize actual); + + // TODO(scottmg): syscalls.banjo had the length of |ptr| being |action|? + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + ktrace_control(handle<resource> handle, uint32 action, uint32 options, voidptr ptr) + -> (status status); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + ktrace_write(handle<resource> handle, uint32 id, uint32 arg0, uint32 arg1) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/misc.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/misc.fidl new file mode 100644 index 0000000..6c0e4c4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/misc.fidl
@@ -0,0 +1,57 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): These syscalls don't match the general naming convention of +// zx_something_name(), they're just zx_name(), so NoProtocolPrefix tells the +// generator to exclude putting "Misc" in the name. +[Transport = "Syscall", +NoProtocolPrefix] +protocol misc { + /// High resolution sleep. + /// Rights: None. + [blocking] + nanosleep(time deadline) -> (status status); + + /// Read the number of high-precision timer ticks since boot. + [vdsocall] + ticks_get() -> (ticks ticks); + + /// Read the number of high-precision timer ticks in a second. + [const, + vdsocall] + ticks_per_second() -> (ticks ticks); + + /// Convert a time relative to now to an absolute deadline. + [vdsocall] + deadline_after(duration nanoseconds) -> (time time); + + /// Unmap memory, close handle, exit. + [vdsocall] + vmar_unmap_handle_close_thread_exit(handle<vmar> vmar_handle, + vaddr addr, usize size, + [Release] handle close_handle) + -> (status status); + + /// Write to futex, wake futex, close handle, exit. + [noreturn, + vdsocall] + futex_wake_handle_close_thread_exit(const_futexptr value_ptr, + uint32 wake_count, + int32 new_value, + [Release] handle close_handle); + + // Read the number of high-precision timer ticks since boot, but demand + // that the read be performed using a syscall, instead of a vdso call. + // + // Note that this is an internal syscall, not meant to be used by + // application code. By default, the vdso version of this syscall will do + // the proper thing, either directly reading from the hardware register + // backing the tick counter, or by making a syscall if the register is not + // accessible from user mode code (for whatever reason). + [internal] + ticks_get_via_kernel() -> (ticks ticks); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/mtrace.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/mtrace.fidl new file mode 100644 index 0000000..f3c1f1c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/mtrace.fidl
@@ -0,0 +1,17 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol mtrace { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + mtrace_control(handle<resource> handle, + uint32 kind, + uint32 action, + uint32 options, + mutable_vector_void ptr) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/object.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/object.fidl new file mode 100644 index 0000000..f510fec --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/object.fidl
@@ -0,0 +1,95 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): Apply rights spec from WaitMany on |items| to |handle| here, +// somehow. +struct WaitItem { + handle handle; + signals waitfor; + signals pending; +}; + +[Transport = "Syscall"] +protocol object { + /// Wait for signals on an object. + /// Rights: handle must have ZX_RIGHT_WAIT. + [blocking] + object_wait_one(handle handle, signals signals, time deadline) + -> (status status, optional_signals observed); + + /// Wait for signals on multiple objects. + /// Rights: Every entry of items must have a handle field with ZX_RIGHT_WAIT. + [blocking] + object_wait_many(mutable_vector_WaitItem items, time deadline) -> (status status); + + /// Subscribe for signals on an object. + /// Rights: handle must have ZX_RIGHT_WAIT. + /// Rights: port must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + object_wait_async(handle handle, handle<port> port, uint64 key, signals signals, uint32 options) + -> (status status); + + /// Signal an object. + /// Rights: handle must have ZX_RIGHT_SIGNAL. + object_signal(handle handle, uint32 clear_mask, uint32 set_mask) -> (status status); + + /// Signal an object's peer. + /// Rights: handle must have ZX_RIGHT_SIGNAL_PEER. + object_signal_peer(handle handle, uint32 clear_mask, uint32 set_mask) -> (status status); + + /// Ask for various properties of various kernel objects. + /// Rights: handle must have ZX_RIGHT_GET_PROPERTY. + /// Rights: If property is ZX_PROP_PROCESS_DEBUG_ADDR, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_PROCESS_BREAK_ON_LOAD, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_PROCESS_VDSO_BASE_ADDRESS, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_SOCKET_RX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + /// Rights: If property is ZX_PROP_SOCKET_TX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + object_get_property(handle handle, uint32 property) -> (status status, vector_void value); + + /// Set various properties of various kernel objects. + /// Rights: handle must have ZX_RIGHT_SET_PROPERTY. + /// Rights: If property is ZX_PROP_PROCESS_DEBUG_ADDR, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_PROCESS_BREAK_ON_LOAD, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_SOCKET_RX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + /// Rights: If property is ZX_PROP_SOCKET_TX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + /// Rights: If property is ZX_PROP_JOB_KILL_ON_OOM, handle must be of type ZX_OBJ_TYPE_JOB. + object_set_property(handle handle, uint32 property, vector_void value) -> (status status); + + /// Query information about an object. + /// Rights: If topic is ZX_INFO_PROCESS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_JOB, handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_THREADS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_ENUMERATE. + /// Rights: If topic is ZX_INFO_JOB_CHILDREN, handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_ENUMERATE. + /// Rights: If topic is ZX_INFO_JOB_PROCESSES, handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_ENUMERATE. + /// Rights: If topic is ZX_INFO_THREAD, handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_THREAD_EXCEPTION_REPORT, handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_THREAD_STATS, handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_TASK_STATS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_MAPS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_VMOS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_VMO, handle must be of type ZX_OBJ_TYPE_VMO. + /// TODO(ZX-2967), Should this require INSPECT? + /// Rights: If topic is ZX_INFO_VMAR, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_CPU_STATS, handle must have resource kind ZX_RSRC_KIND_ROOT. + /// Rights: If topic is ZX_INFO_KMEM_STATS, handle must have resource kind ZX_RSRC_KIND_ROOT. + /// Rights: If topic is ZX_INFO_RESOURCE, handle must be of type ZX_OBJ_TYPE_RESOURCE and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_HANDLE_COUNT, handle must have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_BTI, handle must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_HANDLE_STATS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_SOCKET, handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_INSPECT. + object_get_info(handle handle, uint32 topic) + -> (status status, vector_void buffer, optional_usize actual, optional_usize avail); + + /// Given a kernel object with children objects, obtain a handle to the child specified by the provided kernel object id. + /// Rights: handle must have ZX_RIGHT_ENUMERATE. + object_get_child(handle handle, uint64 koid, rights rights) -> (status status, handle out); + + /// Apply a scheduling profile to a thread. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_MANAGE_THREAD. + /// Rights: profile must be of type ZX_OBJ_TYPE_PROFILE and have ZX_RIGHT_APPLY_PROFILE. + object_set_profile(handle<thread> handle, handle<profile> profile, uint32 options) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/pager.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/pager.fidl new file mode 100644 index 0000000..6c7c581 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/pager.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol pager { + /// Create a new pager object. + /// Rights: None. + pager_create(uint32 options) -> (status status, handle<pager> out); + + /// Create a pager owned vmo. + /// Rights: pager must be of type ZX_OBJ_TYPE_PAGER. + /// Rights: port must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + pager_create_vmo(handle<pager> pager, uint32 options, handle<port> port, uint64 key, uint64 size) + -> (status status, handle<vmo> out); + + /// Detaches a vmo from a pager. + /// Rights: pager must be of type ZX_OBJ_TYPE_PAGER. + /// Rights: vmo must be of type ZX_OBJ_TYPE_VMO. + pager_detach_vmo(handle<pager> pager, handle<vmo> vmo) -> (status status); + + /// Supply pages into a pager owned vmo. + /// Rights: pager must be of type ZX_OBJ_TYPE_PAGER. + /// Rights: pager_vmo must be of type ZX_OBJ_TYPE_VMO. + /// Rights: aux_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pager_supply_pages(handle<pager> pager, + handle<vmo> pager_vmo, + uint64 offset, + uint64 length, + handle<vmo> aux_vmo, + uint64 aux_offset) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/pc.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/pc.fidl new file mode 100644 index 0000000..cb10baa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/pc.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol pc { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pc_firmware_tables(handle<resource> handle) -> (status status, paddr acpi_rsdp, paddr smbios); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/pci.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/pci.fidl new file mode 100644 index 0000000..d5c80db --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/pci.fidl
@@ -0,0 +1,127 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(cja): This makes some assumptions that anything in an arch's PIO region +// is going to be defined as a base address and size. This will need to be +// updated to a per-platform structure in the event that doesn't pan out +// in the future. +struct PciBar { + uint32 id; + uint32 type; + usize size; + // TODO(scottmg): Unnamed union. + //union { + // uintptr_t addr; + // zx_handle_t handle; + //}; +}; + +// Defines and structures related to zx_pci_*() +// Info returned to dev manager for PCIe devices when probing. +struct PcieDeviceInfo { + uint16 vendor_id; + uint16 device_id; + + uint8 base_class; + uint8 sub_class; + uint8 program_interface; + uint8 revision_id; + + uint8 bus_id; + uint8 dev_id; + uint8 func_id; +}; + +// TODO(scottmg): Lots of constants here. + +// TODO(scottmg): This one is hard. +struct PciInitArg { + // TODO(scottmg): [][][] array. + // zx_pci_irq_swizzle_lut_t dev_pin_to_global_irq; + + uint32 num_irqs; + //struct { + // uint32_t global_irq; + // bool level_triggered; + // bool active_high; + //} irqs[ZX_PCI_MAX_IRQS]; + + uint32 addr_window_count; + // TODO(scottmg): struct-hack sized. + //struct { + // uint64_t base; + // size_t size; + // uint8_t bus_start; + // uint8_t bus_end; + // uint8_t cfg_space_type; + // bool has_ecam; + //} addr_windows[]; +}; + +[Transport = "Syscall"] +protocol pci { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_get_nth_device(handle<resource> handle, uint32 index) + -> (status status, PcieDeviceInfo out_info, handle out_handle); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_WRITE. + pci_enable_bus_master(handle<pcidevice> handle, bool enable) -> (status status); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_WRITE. + pci_reset_device(handle<pcidevice> handle) -> (status status); + + // TODO(scottmg): In banjo/abigen out_val wasn't optional, but was an input + // OUT, so didn't get the __NONNULL() tag, so we match by making it optional + // here. I think this is probably not the intention, and it should be + // non-optional. + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pci_config_read(handle<pcidevice> handle, uint16 offset, usize width) + -> (status status, optional_uint32 out_val); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pci_config_write(handle<pcidevice> handle, uint16 offset, usize width, uint32 val) + -> (status status); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_cfg_pio_rw(handle<resource> handle, + uint8 bus, + uint8 dev, + uint8 func, + uint8 offset, + mutable_uint32 val, + usize width, + bool write) + -> (status status); + + // TODO(scottmg): type of out_handle? + // TODO(scottmg): In banjo/abigen out_bar wasn't optional, but was an input + // OUT, so has no __NONNULL(). I think this is probably not the intention. + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pci_get_bar(handle<pcidevice> handle, uint32 bar_num) + -> (status status, optional_PciBar out_bar, handle out_handle); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ. + pci_map_interrupt(handle<pcidevice> handle, int32 which_irq) + -> (status status, handle out_handle); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ. + pci_query_irq_mode(handle<pcidevice> handle, uint32 mode) + -> (status status, uint32 out_max_irqs); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_WRITE. + pci_set_irq_mode(handle<pcidevice> handle, uint32 mode, uint32 requested_irq_count) + -> (status status); + + // Note that init_buf isn't a vector of PciInitArg, it's a variable sized + // structure starting with a zx_pci_init_arg_t. + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_init(handle<resource> handle, PciInitArg init_buf, uint32 len) -> (status status); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_add_subtract_io_range(handle<resource> handle, bool mmio, uint64 base, uint64 len, bool add) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/pmt.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/pmt.fidl new file mode 100644 index 0000000..0e37311 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/pmt.fidl
@@ -0,0 +1,13 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol pmt { + // TODO(ZX-2967): handle ZX_OBJ_TYPE_PMT; No rights required? + /// Unpin pages and revoke device access to them. + pmt_unpin(handle<pmt> handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/port.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/port.fidl new file mode 100644 index 0000000..b07fb7b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/port.fidl
@@ -0,0 +1,146 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// port_packet_t::type ZX_PKT_TYPE_USER. +union PacketUser { + 1: array<uint64>:4 u64; + 2: array<uint32>:8 u32; + 3: array<uint16>:16 u16; + 4: array<int8>:32 c8; +}; + +// port_packet_t::type ZX_PKT_TYPE_SIGNAL_ONE. +struct PacketSignal { + signals trigger; + signals observed; + uint64 count; + uint64 reserved0; + uint64 reserved1; +}; + +struct PacketException { + uint64 pid; + uint64 tid; + uint64 reserved0; + uint64 reserved1; +}; + +struct PacketGuestBell { + gpaddr addr; + uint64 reserved0; + uint64 reserved1; + uint64 reserved2; +}; + +// TODO(scottmg): Arch-specific definition. +struct PacketGuestMem { + gpaddr addr; + //#if __aarch64__ + //uint8_t access_size; + //bool sign_extend; + //uint8_t xt; + //bool read; + //uint64_t data; + //uint64_t reserved; + //#elif __x86_64__ + //// NOTE: x86 instructions are guaranteed to be 15 bytes or fewer. + //#define X86_MAX_INST_LEN 15u + //uint8_t inst_len; + //uint8_t inst_buf[X86_MAX_INST_LEN]; + //// This is the default operand size as determined by the CS and EFER register (Volume 3, + //// Section 5.2.1). If operating in 64-bit mode then near branches and all instructions, except + //// far branches, that implicitly reference the RSP will actually have a default operand size of + //// 64-bits (Volume 2, Section 2.2.1.7), and not the 32-bits that will be given here. + //uint8_t default_operand_size; + //uint8_t reserved[7]; + //#endif +}; + +struct PacketGuestIo { + uint16 port; + uint8 access_size; + bool input; + // TODO(scottmg): Unnamed union. + //union { + // uint8_t u8; + // uint16_t u16; + // uint32_t u32; + // uint8_t data[4]; + //}; + uint64 reserved0; + uint64 reserved1; + uint64 reserved2; +}; + +struct PacketGuestVcpu { + // TODO(scottmg): Unnamed union. + //union { + // struct { + // uint64_t mask; + // uint8_t vector; + // } interrupt; + // struct { + // uint64_t id; + // zx_gpaddr_t entry; + // } startup; + //}; + uint8 type; + uint64 reserved; +}; + +struct PacketInterrupt { + time timestamp; + uint64 reserved0; + uint64 reserved1; + uint64 reserved2; +}; + +struct PacketPageRequest { + uint16 command; + uint16 flags; + uint32 reserved0; + uint64 offset; + uint64 length; + uint64 reserved1; +}; + +struct PortPacket { + uint64 key; + uint32 type; + status status; + // TODO(scottmg): Unnamed union. + // union { + PacketUser user; + PacketSignal signal; + PacketException exception; + PacketGuestBell guest_bell; + PacketGuestMem guest_mem; + PacketGuestIo guest_io; + PacketGuestVcpu guest_vcpu; + PacketInterrupt interrupt; + PacketPageRequest page_request; + // }; +}; + +[Transport = "Syscall"] +protocol port { + /// Create an IO port. + port_create(uint32 options) -> (status status, handle<port> out); + + /// Queue a packet to a port. + /// Rights: handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + port_queue(handle<port> handle, PortPacket packet) -> (status status); + + /// Wait for a packet arrival in a port. + /// Rights: handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_READ. + [blocking] + port_wait(handle<port> handle, time deadline) -> (status status, optional_PortPacket packet); + + /// Cancels async port notifications on an object. + /// Rights: handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + port_cancel(handle<port> handle, handle source, uint64 key) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/process.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/process.fidl new file mode 100644 index 0000000..b9c3eb3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/process.fidl
@@ -0,0 +1,38 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol process { + /// Exits the currently running process. + [noreturn] + process_exit(int64 retcode); + + // TODO(ZX-2967): job with ZX_RIGHT_WRITE is also accepted. + /// Create a new process. + /// Rights: job must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_MANAGE_PROCESS. + process_create(handle<job> job, string name, uint32 options) + -> (status status, handle<process> proc_handle, handle<vmar> vmar_handle); + + /// Start execution on a process. + /// Rights: handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + /// Rights: thread must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_WRITE. + /// Rights: arg1 must have ZX_RIGHT_TRANSFER. + process_start(handle<process> handle, handle<thread> thread, + vaddr entry, vaddr stack, + handle arg1, uintptr arg2) + -> (status status); + + /// Read from the given process's address space. + /// Rights: handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + process_read_memory(handle<process> handle, vaddr vaddr) + -> (status status, vector_void buffer, usize actual); + + /// Write into the given process's address space. + /// Rights: handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + process_write_memory(handle<process> handle, vaddr vaddr, vector_void buffer) + -> (status status, usize actual); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/profile.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/profile.fidl new file mode 100644 index 0000000..c808f4d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/profile.fidl
@@ -0,0 +1,43 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +enum ProfileInfoType { + ZX_PROFILE_INFO_SCHEDULER = 1; +}; + +union ProfileScheduler { + 1: int32 priority; + 2: uint32 boost; + 3: uint32 deboost; + 4: uint32 quantum; +}; + +const int32 ZX_PRIORITY_LOWEST = 0; +const int32 ZX_PRIORITY_LOW = 8; +const int32 ZX_PRIORITY_DEFAULT = 16; +const int32 ZX_PRIORITY_HIGH = 24; +const int32 ZX_PRIORITY_HIGHEST = 31; + +union ProfileInfoData { + 1: ProfileScheduler scheduler; +}; + +struct ProfileInfo { + ProfileInfoType type; + // TODO(scottmg): This needs to be presented as an unnamed union in C, and + // ProfileInfoData doesn't really need a name. Not sure if the semantics of + // fidl unions make sense here. + ProfileInfoData unnamed; +}; + +[Transport = "Syscall"] +protocol profile { + /// Create a scheduler profile. + /// Rights: root_job must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_MANAGE_PROCESS. + profile_create(handle<job> root_job, uint32 options, ProfileInfo profile) + -> (status status, handle<profile> out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/resource.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/resource.fidl new file mode 100644 index 0000000..1854504 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/resource.fidl
@@ -0,0 +1,18 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol resource { + /// Create a resource object. + /// Rights: parent_rsrc must be of type ZX_OBJ_TYPE_RESOURCE and have ZX_RIGHT_WRITE. + resource_create(handle<resource> parent_rsrc, + uint32 options, + uint64 base, + usize size, + string name) + -> (status status, handle<resource> resource_out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/rights.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/rights.fidl new file mode 100644 index 0000000..69ba88f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/rights.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): (1 << 4) notation or something else for bits would be nice. +bits rights : uint32 { + // TODO(scottmg): "bits members must be powers of two" + // NONE = 0x00000000; + DUPLICATE = 0x00000001; + TRANSFER = 0x00000002; + READ = 0x00000004; + WRITE = 0x00000008; + EXECUTE = 0x00000010; + MAP = 0x00000020; + GET_PROPERTY = 0x00000040; + SET_PROPERTY = 0x00000080; + ENUMERATE = 0x00000100; + DESTROY = 0x00000200; + SET_POLICY = 0x00000400; + GET_POLICY = 0x00000800; + SIGNAL = 0x00001000; + SIGNAL_PEER = 0x00002000; + WAIT = 0x00004000; + INSPECT = 0x00008000; + MANAGE_JOB = 0x00010000; + MANAGE_PROCESS = 0x00020000; + MANAGE_THREAD = 0x00040000; + APPLY_PROFILE = 0x00080000; + SAME_RIGHTS = 0x80000000; + + // TODO(scottmg): Derived settings using |, &, ~, e.g.: + // BASIC = (TRANSFER | DUPLICATE | WAIT | INSPECT); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/smc.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/smc.fidl new file mode 100644 index 0000000..b039311 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/smc.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): ARM_SMC_xyz. + +struct SmcParameters { + uint32 func_id; + uint64 arg1; + uint64 arg2; + uint64 arg3; + uint64 arg4; + uint64 arg5; + uint64 arg6; + uint16 client_id; + uint16 secure_os_id; +}; + +struct SmcResult { + uint64 arg0; + uint64 arg1; + uint64 arg2; + uint64 arg3; + uint64 arg6; // at least one implementation uses it as a way to return session_id. +}; + +[Transport = "Syscall"] +protocol smc { + // TODO(ZX-2967): handle No rights required? + // TODO(scottmg): No handle type? + /// Make Secure Monitor Call (SMC) from user space. + smc_call(handle handle, SmcParameters parameters) -> (status status, SmcResult out_smc_result); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/socket.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/socket.fidl new file mode 100644 index 0000000..00f7159 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/socket.fidl
@@ -0,0 +1,26 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol socket { + /// Create a socket. + socket_create(uint32 options) -> (status status, handle out0, handle out1); + + /// Write data to a socket. + /// Rights: handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_WRITE. + socket_write(handle<socket> handle, uint32 options, vector_void buffer) + -> (status status, optional_usize actual); + + /// Read data from a socket. + /// Rights: handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_READ. + socket_read(handle<socket> handle, uint32 options) + -> (status status, vector_void buffer, optional_usize actual); + + /// Prevent reading or writing. + /// Rights: handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_WRITE. + socket_shutdown(handle<socket> handle, uint32 options) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/stream.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/stream.fidl new file mode 100644 index 0000000..cf6cdbd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/stream.fidl
@@ -0,0 +1,44 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +enum stream_seek_origin : uint32 { + START = 0; + CURRENT = 1; + END = 2; +}; + +[Transport = "Syscall"] +protocol stream { + /// Create a stream from a VMO. + stream_create(uint32 options, handle<vmo> vmo, off seek) + -> (status status, handle<stream> out_stream); + + /// Write data to a stream at the current seek offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_WRITE. + stream_writev(handle<stream> handle, uint32 options, vector_iovec vector) + -> (status status, optional_usize actual); + + /// Write data to a stream at the given offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_WRITE. + stream_writev_at(handle<stream> handle, uint32 options, off offset, vector_iovec vector) + -> (status status, optional_usize actual); + + /// Read data from a stream at the current seek offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_READ. + stream_readv(handle<stream> handle, uint32 options) + -> (status status, vector_iovec vector, optional_usize actual); + + /// Read data from a stream at the given offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_READ. + stream_readv_at(handle<stream> handle, uint32 options, off offset) + -> (status status, vector_iovec vector, optional_usize actual); + + /// Modify the seek offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_READ or have ZX_RIGHT_WRITE. + stream_seek(handle<stream> handle, stream_seek_origin whence, int64 offset) + -> (status status, optional_off out_seek); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/syscall.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/syscall.fidl new file mode 100644 index 0000000..06e5683 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/syscall.fidl
@@ -0,0 +1,46 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol syscall { + [testonly] + syscall_test_0() -> (status status); + + [testonly, + test_category1] + syscall_test_1(int32 a) -> (status status); + + [testonly, + test_category1] + syscall_test_2(int32 a, int32 b) -> (status status); + + [testonly, + test_category2] + syscall_test_3(int32 a, int32 b, int32 c) -> (status status); + + [testonly] + syscall_test_4(int32 a, int32 b, int32 c, int32 d) -> (status status); + + [testonly] + syscall_test_5(int32 a, int32 b, int32 c, int32 d, int32 e) -> (status status); + + [testonly] + syscall_test_6(int32 a, int32 b, int32 c, int32 d, int32 e, int32 f) -> (status status); + + [testonly] + syscall_test_7(int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 g) -> (status status); + + [testonly] + syscall_test_8(int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 g, int32 h) + -> (status status); + + [testonly] + syscall_test_wrapper(int32 a, int32 b, int32 c) -> (status status); + + [testonly] + syscall_test_handle_create(status return_value) -> (status status, handle<event> out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/system.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/system.fidl new file mode 100644 index 0000000..12ada66 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/system.fidl
@@ -0,0 +1,65 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +struct SystemPowerctlArg { + // TODO(scottmg): More unnamed unions. + //union { + // struct { + // uint8_t target_s_state; // Value between 1 and 5 indicating which S-state + // uint8_t sleep_type_a; // Value from ACPI VM (SLP_TYPa) + // uint8_t sleep_type_b; // Value from ACPI VM (SLP_TYPb) + // } acpi_transition_s_state; + // struct { + // uint32_t power_limit; // PL1 value in milliwatts + // uint32_t time_window; // PL1 time window in microseconds + // uint8_t clamp; // PL1 clamping enable + // uint8_t enable; // PL1 enable + // } x86_power_limit; + //}; +}; + +[Transport = "Syscall"] +protocol system { + [const, vdsocall] + system_get_dcache_line_size() -> (uint32 size); + + /// Get number of logical processors on the system. + [const, vdsocall] + system_get_num_cpus() -> (uint32 count); + + /// Get version string for system. + [const, vdsocall] + system_get_version_string() -> (string_view version); + + /// Get amount of physical memory on the system. + [vdsocall] + system_get_physmem() -> (uint64 physmem); + + // TODO(scottmg): "features" has a features attribute. I'm not sure if/how it's used. + /// Get supported hardware capabilities. + [vdsocall] + system_get_features(uint32 kind) -> (status status, uint32 features); + + /// Retrieve a handle to a system event. + /// Rights: None. + system_get_event(handle<job> root_job, uint32 kind) -> (status status, handle<event> event); + + /// Soft reboot the system with a new kernel and bootimage. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + /// Rights: kernel_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: bootimage_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + system_mexec(handle<resource> resource, handle<vmo> kernel_vmo, handle<vmo> bootimage_vmo) + -> (status status); + + /// Return a ZBI containing ZBI entries necessary to boot this system. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + system_mexec_payload_get(handle<resource> resource) -> (status status, vector_void buffer); + + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + system_powerctl(handle<resource> resource, uint32 cmd, SystemPowerctlArg arg) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/task.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/task.fidl new file mode 100644 index 0000000..56cc556 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/task.fidl
@@ -0,0 +1,29 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol task { + // TODO(scottmg): Need something like handle<task> in this file to mean {job, process, thread}. + // Or otherwise some way to express multiple options for constraints on inputs in this protocol. + + /// Suspend the given task. Currently only thread or process handles may be suspended. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD or ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + task_suspend(handle handle) -> (status status, handle token); + + /// Suspend the given task. Currently only thread or process handles may be suspended. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD or ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + task_suspend_token(handle handle) -> (status status, handle token); + + /// Create an exception channel for a given job, process, or thread. + /// Rights: handle must have ZX_RIGHT_INSPECT and have ZX_RIGHT_DUPLICATE and have ZX_RIGHT_TRANSFER and have ZX_RIGHT_MANAGE_THREAD. + /// Rights: If handle is of type ZX_OBJ_TYPE_JOB or ZX_OBJ_TYPE_PROCESS, it must have ZX_RIGHT_ENUMERATE. + task_create_exception_channel(handle handle, uint32 options) -> (status status, handle<channel> out); + + /// Kill the provided task (job, process, or thread). + /// Rights: handle must have ZX_RIGHT_DESTROY. + task_kill(handle handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/thread.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/thread.fidl new file mode 100644 index 0000000..9754d05 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/thread.fidl
@@ -0,0 +1,31 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol thread { + /// Terminate the current running thread. + [noreturn] + thread_exit(); + + /// Create a thread. + /// Rights: process must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_MANAGE_THREAD. + thread_create(handle<process> process, string name, uint32 options) + -> (status status, handle<thread> out); + + /// Start execution on a thread. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_MANAGE_THREAD. + thread_start(handle<thread> handle, vaddr thread_entry, vaddr stack, uintptr arg1, uintptr arg2) + -> (status status); + + /// Read one aspect of thread state. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_READ. + thread_read_state(handle<thread> handle, uint32 kind) -> (status status, vector_void buffer); + + /// Write one aspect of thread state. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_WRITE. + thread_write_state(handle<thread> handle, uint32 kind, vector_void buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/timer.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/timer.fidl new file mode 100644 index 0000000..1eae5a9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/timer.fidl
@@ -0,0 +1,20 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol timer { + /// Create a timer. + timer_create(uint32 options, Clock clock_id) -> (status status, handle<timer> out); + + /// Start a timer. + /// Rights: handle must be of type ZX_OBJ_TYPE_TIMER and have ZX_RIGHT_WRITE. + timer_set(handle<timer> handle, time deadline, duration slack) -> (status status); + + /// Cancel a timer. + /// Rights: handle must be of type ZX_OBJ_TYPE_TIMER and have ZX_RIGHT_WRITE. + timer_cancel(handle<timer> handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/vcpu.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/vcpu.fidl new file mode 100644 index 0000000..72cc954 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/vcpu.fidl
@@ -0,0 +1,31 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol vcpu { + /// Create a VCPU. + /// Rights: guest must be of type ZX_OBJ_TYPE_GUEST and have ZX_RIGHT_MANAGE_PROCESS. + vcpu_create(handle<guest> guest, uint32 options, vaddr entry) -> (status status, handle<vcpu> out); + + // See port.fidl for definition of PortPacket. + /// Resume execution of a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_EXECUTE. + [blocking] + vcpu_resume(handle<vcpu> handle) -> (status status, PortPacket packet); + + /// Raise an interrupt on a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_SIGNAL. + vcpu_interrupt(handle<vcpu> handle, uint32 vector) -> (status status); + + /// Read the state of a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_READ. + vcpu_read_state(handle<vcpu> handle, uint32 kind) -> (status status, vector_void buffer); + + /// Write the state of a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_WRITE. + vcpu_write_state(handle<vcpu> handle, uint32 kind, vector_void buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/vmar.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/vmar.fidl new file mode 100644 index 0000000..0256623 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/vmar.fidl
@@ -0,0 +1,53 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +using VmOption = uint32; + +// TODO(scottmg): bits for ZX_VM_xyz flags, and const for ZX_VM_ALIGN_xyz. + +[Transport = "Syscall"] +protocol vmar { + /// Allocate a new subregion. + /// Rights: If options & ZX_VM_CAN_MAP_READ, parent_vmar must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_READ. + /// Rights: If options & ZX_VM_CAN_MAP_WRITE, parent_vmar must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_WRITE. + /// Rights: If options & ZX_VM_CAN_MAP_EXECUTE, parent_vmar must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_EXECUTE. + vmar_allocate(handle<vmar> parent_vmar, VmOption options, usize offset, usize size) + -> (status status, handle<vmar> child_vmar, vaddr child_addr); + + // TODO(ZX-2967): handle No rights required? + /// Destroy a virtual memory address region. + vmar_destroy(handle<vmar> handle) -> (status status); + + // TODO(ZX-2399): TODO handle and vmo and options must all match, and options can't specify them. + /// Add a memory mapping. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMAR. + /// Rights: vmo must be of type ZX_OBJ_TYPE_VMO. + vmar_map(handle<vmar> handle, VmOption options, usize vmar_offset, + handle<vmo> vmo, uint64 vmo_offset, + usize len) + -> (status status, vaddr mapped_addr); + + // TODO(ZX-2967): handle No rights required? + /// Unmap virtual memory pages. + vmar_unmap(handle<vmo> handle, vaddr addr, usize len) -> (status status); + + /// Set protection of virtual memory pages. + /// Rights: If options & ZX_VM_PERM_READ, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_READ. + /// Rights: If options & ZX_VM_PERM_WRITE, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_WRITE. + /// Rights: If options & ZX_VM_PERM_EXECUTE, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_EXECUTE. + vmar_protect(handle<vmo> handle, VmOption options, vaddr addr, usize len) -> (status status); + + /// Perform an operation on VMOs mapped into this VMAR. + /// Rights: If op is ZX_VMO_OP_DECOMMIT, affected mappings must be writable. + [Blocking] + vmar_op_range(handle<vmar> handle, + uint32 op, + vaddr address, + usize size, + mutable_vector_void buffer) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/vmo.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/vmo.fidl new file mode 100644 index 0000000..060d4cd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/vmo.fidl
@@ -0,0 +1,81 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol vmo { + /// Create a VM object. + vmo_create(uint64 size, uint32 options) -> (status status, handle<vmo> out); + + // TODO(scottmg): This syscall is very weird, it's currently: + // (handle, buffer, offset, buffer_size) + // rather than: + // (handle, buffer, buffer_size, offset) + // which means the vector<byte> buffer won't work. Unfortunately offset and + // buffer_size have the same underlying type, so moving them will be + // error-prone. + /// Read bytes from the VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + [blocking, + ArgReorder = "handle, buffer, offset, buffer_size"] + vmo_read(handle<vmo> handle, uint64 offset) -> (status status, vector_void buffer); + + // TODO(scottmg): Same problem as Read() above. + /// Write bytes to the VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + [blocking, + ArgReorder = "handle, buffer, offset, buffer_size"] + vmo_write(handle<vmo> handle, vector_void buffer, uint64 offset) -> (status status); + + // TODO(ZX-2967): No rights required? + /// Read the current size of a VMO object. + vmo_get_size(handle<vmo> handle) -> (status status, uint64 size); + + /// Resize a VMO object. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + vmo_set_size(handle<vmo> handle, uint64 size) -> (status status); + + /// Perform an operation on a range of a VMO. + /// Rights: If op is ZX_VMO_OP_COMMIT, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If op is ZX_VMO_OP_DECOMMIT, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If op is ZX_VMO_OP_CACHE_SYNC, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: If op is ZX_VMO_OP_CACHE_INVALIDATE, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If op is ZX_VMO_OP_CACHE_CLEAN, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: If op is ZX_VMO_OP_CACHE_CLEAN_INVALIDATE, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + [blocking] + vmo_op_range(handle<vmo> handle, + uint32 op, + uint64 offset, + uint64 size, + mutable_vector_void buffer) + -> (status status); + + /// Create a child of a VM Object. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_DUPLICATE and have ZX_RIGHT_READ. + vmo_create_child(handle<vmo> handle, uint32 options, uint64 offset, uint64 size) + -> (status status, handle<vmo> out); + + /// Set the caching policy for pages held by a VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_MAP. + vmo_set_cache_policy(handle<vmo> handle, uint32 cache_policy) -> (status status); + + // TODO(ZX-2967): handle: No rights required, ZX_RIGHT_EXECUTE added to dup out + // TODO(ZX-2967): vmex == ZX_HANDLE_INVALID also accepted. + /// Add execute rights to a VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO. + /// Rights: vmex must have resource kind ZX_RSRC_KIND_VMEX. + vmo_replace_as_executable([Release] handle<vmo> handle, handle<resource> vmex) + -> (status status, handle<vmo> out); + + /// Rights: bti must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_MAP. + vmo_create_contiguous(handle<bti> bti, usize size, uint32 alignment_log2) + -> (status status, handle<vmo> out); + + /// Create a VM object referring to a specific contiguous range of physical memory. + /// Rights: resource must have resource kind ZX_RSRC_KIND_MMIO. + vmo_create_physical(handle<resource> resource, paddr paddr, usize size) + -> (status status, handle<vmo> out); +};
diff --git a/third_party/fuchsia-sdk/arch/arm64/vdso/zx.fidl b/third_party/fuchsia-sdk/arch/arm64/vdso/zx.fidl new file mode 100644 index 0000000..ac9903a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/arm64/vdso/zx.fidl
@@ -0,0 +1,41 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(scottmg): This library is temporarily "zz" instead of "zx" because a +// "zx" is force-injected by fidlc. Eventually, we'll stop that and use this one +// instead as "zx". fxb/39732. +library zz; + +using status = int32; + +using time = int64; +using duration = int64; +using ticks = uint64; + +using koid = uint64; + +using vaddr = uint64; +using paddr = uint64; +using paddr32 = uint32; +using gpaddr = uint64; +using off = uint64; + +// TODO(scottmg): Not sure what this is. +using procarg = uint32; + +const uint64 CHANNEL_MAX_MSG_BYTES = 65536; +const uint64 CHANNEL_MAX_MSG_HANDLES = 64; + +// TODO(scottmg): == size_t, not sure if this is a good idea. +using usize = uint64; + +// TODO(scottmg): == uintptr_t, not sure if this is a good idea. +using uintptr = uint64; + +// TODO(scottmg): Maybe a void for vector<void> (or vector<any>?) to distinguish +// polymorphic arguments that are passed as void* from buffers of bytes. + +using signals = uint32; +// TODO(scottmg): Lots of aliases/variations required here. Not sure if bits +// make sense.
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_core_validation.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_core_validation.so new file mode 100755 index 0000000..3d351d3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_core_validation.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_image_pipe_swapchain.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_image_pipe_swapchain.so new file mode 100755 index 0000000..a01a3c4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_image_pipe_swapchain.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_khronos_validation.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_khronos_validation.so new file mode 100755 index 0000000..eb9075c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_khronos_validation.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_object_lifetimes.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_object_lifetimes.so new file mode 100755 index 0000000..c22b3cd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_object_lifetimes.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_stateless_validation.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_stateless_validation.so new file mode 100755 index 0000000..2afde9e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_stateless_validation.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_thread_safety.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_thread_safety.so new file mode 100755 index 0000000..05b60b5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_thread_safety.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_unique_objects.so b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_unique_objects.so new file mode 100755 index 0000000..d9289de --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/VkLayer_unique_objects.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libasync-default.so b/third_party/fuchsia-sdk/arch/x64/dist/libasync-default.so new file mode 100755 index 0000000..8882194 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libasync-default.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libfdio.so b/third_party/fuchsia-sdk/arch/x64/dist/libfdio.so new file mode 100755 index 0000000..5d93240 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libfdio.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libmemfs.so b/third_party/fuchsia-sdk/arch/x64/dist/libmemfs.so new file mode 100755 index 0000000..b2a80bd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libmemfs.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libsvc.so b/third_party/fuchsia-sdk/arch/x64/dist/libsvc.so new file mode 100755 index 0000000..c2d28cb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libsvc.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libsyslog.so b/third_party/fuchsia-sdk/arch/x64/dist/libsyslog.so new file mode 100755 index 0000000..d4b4bca --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libsyslog.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libtrace-engine.so b/third_party/fuchsia-sdk/arch/x64/dist/libtrace-engine.so new file mode 100755 index 0000000..cf0b787 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libtrace-engine.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libtrace-provider-so.so b/third_party/fuchsia-sdk/arch/x64/dist/libtrace-provider-so.so new file mode 100755 index 0000000..5bc691a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libtrace-provider-so.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/dist/libvulkan.so b/third_party/fuchsia-sdk/arch/x64/dist/libvulkan.so new file mode 100755 index 0000000..6fc7a98 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/dist/libvulkan.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libasync-default.so b/third_party/fuchsia-sdk/arch/x64/lib/libasync-default.so new file mode 100755 index 0000000..fc8f68a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libasync-default.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libasync-loop-default.a b/third_party/fuchsia-sdk/arch/x64/lib/libasync-loop-default.a new file mode 100644 index 0000000..7782b25 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libasync-loop-default.a Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libfdio.so b/third_party/fuchsia-sdk/arch/x64/lib/libfdio.so new file mode 100755 index 0000000..06422b1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libfdio.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libmemfs.so b/third_party/fuchsia-sdk/arch/x64/lib/libmemfs.so new file mode 100755 index 0000000..71d9539 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libmemfs.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libsvc.so b/third_party/fuchsia-sdk/arch/x64/lib/libsvc.so new file mode 100755 index 0000000..c2d28cb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libsvc.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libsync.a b/third_party/fuchsia-sdk/arch/x64/lib/libsync.a new file mode 100644 index 0000000..521c6a3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libsync.a Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libsyslog.so b/third_party/fuchsia-sdk/arch/x64/lib/libsyslog.so new file mode 100755 index 0000000..ccb6eeb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libsyslog.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libtrace-engine.so b/third_party/fuchsia-sdk/arch/x64/lib/libtrace-engine.so new file mode 100755 index 0000000..4892d09 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libtrace-engine.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libtrace-provider-so.so b/third_party/fuchsia-sdk/arch/x64/lib/libtrace-provider-so.so new file mode 100755 index 0000000..f82f809 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libtrace-provider-so.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/lib/libvulkan.so b/third_party/fuchsia-sdk/arch/x64/lib/libvulkan.so new file mode 100755 index 0000000..6fc7a98 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/lib/libvulkan.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/dist/lib/ld.so.1 b/third_party/fuchsia-sdk/arch/x64/sysroot/dist/lib/ld.so.1 new file mode 100755 index 0000000..f589b62 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/dist/lib/ld.so.1 Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/alloca.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/alloca.h new file mode 100644 index 0000000..7deb5b9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/alloca.h
@@ -0,0 +1,21 @@ +#ifndef SYSROOT_ALLOCA_H_ +#define SYSROOT_ALLOCA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#include <bits/alltypes.h> + +void* alloca(size_t); + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ALLOCA_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/ar.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ar.h new file mode 100644 index 0000000..d0d4176 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ar.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_AR_H_ +#define SYSROOT_AR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ARMAG "!<arch>\n" +#define SARMAG 8 +#define ARFMAG "`\n" + +struct ar_hdr { + char ar_name[16]; + char ar_date[12]; + char ar_uid[6], ar_gid[6]; + char ar_mode[8]; + char ar_size[10]; + char ar_fmag[2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_AR_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/ftp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/ftp.h new file mode 100644 index 0000000..7d86bec --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/ftp.h
@@ -0,0 +1,37 @@ +#ifndef SYSROOT_ARPA_FTP_H_ +#define SYSROOT_ARPA_FTP_H_ + +#define PRELIM 1 +#define COMPLETE 2 +#define CONTINUE 3 +#define TRANSIENT 4 +#define ERROR 5 +#define TYPE_A 1 +#define TYPE_E 2 +#define TYPE_I 3 +#define TYPE_L 4 +#define FORM_N 1 +#define FORM_T 2 +#define FORM_C 3 +#define STRU_F 1 +#define STRU_R 2 +#define STRU_P 3 +#define MODE_S 1 +#define MODE_B 2 +#define MODE_C 3 +#define REC_ESC '\377' +#define REC_EOR '\001' +#define REC_EOF '\002' +#define BLK_EOR 0x80 +#define BLK_EOF 0x40 +#define BLK_ERRORS 0x20 +#define BLK_RESTART 0x10 +#define BLK_BYTECOUNT 2 +#ifdef FTP_NAMES +char* modenames[] = {"0", "Stream", "Block", "Compressed"}; +char* strunames[] = {"0", "File", "Record", "Page"}; +char* typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local"}; +char* formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control"}; +#endif + +#endif // SYSROOT_ARPA_FTP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/inet.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/inet.h new file mode 100644 index 0000000..4fa0af5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/inet.h
@@ -0,0 +1,36 @@ +#ifndef SYSROOT_ARPA_INET_H_ +#define SYSROOT_ARPA_INET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <netinet/in.h> + +uint32_t htonl(uint32_t); +uint16_t htons(uint16_t); +uint32_t ntohl(uint32_t); +uint16_t ntohs(uint16_t); + +in_addr_t inet_addr(const char*); +in_addr_t inet_network(const char*); +char* inet_ntoa(struct in_addr); +int inet_pton(int, const char* __restrict, void* __restrict); +const char* inet_ntop(int, const void* __restrict, char* __restrict, socklen_t); + +int inet_aton(const char*, struct in_addr*); +struct in_addr inet_makeaddr(in_addr_t, in_addr_t); +in_addr_t inet_lnaof(struct in_addr); +in_addr_t inet_netof(struct in_addr); + +#undef INET_ADDRSTRLEN +#undef INET6_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ARPA_INET_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/nameser.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/nameser.h new file mode 100644 index 0000000..734d205 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/nameser.h
@@ -0,0 +1,451 @@ +#ifndef SYSROOT_ARPA_NAMESER_H_ +#define SYSROOT_ARPA_NAMESER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stddef.h> +#include <stdint.h> + +#define __NAMESER 19991006 +#define NS_PACKETSZ 512 +#define NS_MAXDNAME 1025 +#define NS_MAXMSG 65535 +#define NS_MAXCDNAME 255 +#define NS_MAXLABEL 63 +#define NS_HFIXEDSZ 12 +#define NS_QFIXEDSZ 4 +#define NS_RRFIXEDSZ 10 +#define NS_INT32SZ 4 +#define NS_INT16SZ 2 +#define NS_INT8SZ 1 +#define NS_INADDRSZ 4 +#define NS_IN6ADDRSZ 16 +#define NS_CMPRSFLGS 0xc0 +#define NS_DEFAULTPORT 53 + +typedef enum __ns_sect { + ns_s_qd = 0, + ns_s_zn = 0, + ns_s_an = 1, + ns_s_pr = 1, + ns_s_ns = 2, + ns_s_ud = 2, + ns_s_ar = 3, + ns_s_max = 4 +} ns_sect; + +typedef struct __ns_msg { + const unsigned char *_msg, *_eom; + uint16_t _id, _flags, _counts[ns_s_max]; + const unsigned char* _sections[ns_s_max]; + ns_sect _sect; + int _rrnum; + const unsigned char* _msg_ptr; +} ns_msg; + +struct _ns_flagdata { + int mask, shift; +}; +extern const struct _ns_flagdata _ns_flagdata[]; + +#define ns_msg_id(handle) ((handle)._id + 0) +#define ns_msg_base(handle) ((handle)._msg + 0) +#define ns_msg_end(handle) ((handle)._eom + 0) +#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) +#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) +#define ns_msg_getflag(handle, flag) \ + (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift) + +typedef struct __ns_rr { + char name[NS_MAXDNAME]; + uint16_t type; + uint16_t rr_class; + uint32_t ttl; + uint16_t rdlength; + const unsigned char* rdata; +} ns_rr; + +#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") +#define ns_rr_type(rr) ((ns_type)((rr).type + 0)) +#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) +#define ns_rr_ttl(rr) ((rr).ttl + 0) +#define ns_rr_rdlen(rr) ((rr).rdlength + 0) +#define ns_rr_rdata(rr) ((rr).rdata + 0) + +typedef enum __ns_flag { + ns_f_qr, + ns_f_opcode, + ns_f_aa, + ns_f_tc, + ns_f_rd, + ns_f_ra, + ns_f_z, + ns_f_ad, + ns_f_cd, + ns_f_rcode, + ns_f_max +} ns_flag; + +typedef enum __ns_opcode { + ns_o_query = 0, + ns_o_iquery = 1, + ns_o_status = 2, + ns_o_notify = 4, + ns_o_update = 5, + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, + ns_r_formerr = 1, + ns_r_servfail = 2, + ns_r_nxdomain = 3, + ns_r_notimpl = 4, + ns_r_refused = 5, + ns_r_yxdomain = 6, + ns_r_yxrrset = 7, + ns_r_nxrrset = 8, + ns_r_notauth = 9, + ns_r_notzone = 10, + ns_r_max = 11, + ns_r_badvers = 16, + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +typedef enum __ns_update_operation { + ns_uop_delete = 0, + ns_uop_add = 1, + ns_uop_max = 2 +} ns_update_operation; + +struct ns_tsig_key { + char name[NS_MAXDNAME], alg[NS_MAXDNAME]; + unsigned char* data; + int len; +}; +typedef struct ns_tsig_key ns_tsig_key; + +struct ns_tcp_tsig_state { + int counter; + struct dst_key* key; + void* ctx; + unsigned char sig[NS_PACKETSZ]; + int siglen; +}; +typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; + +#define NS_TSIG_FUDGE 300 +#define NS_TSIG_TCP_COUNT 100 +#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" + +#define NS_TSIG_ERROR_NO_TSIG -10 +#define NS_TSIG_ERROR_NO_SPACE -11 +#define NS_TSIG_ERROR_FORMERR -12 + +typedef enum __ns_type { + ns_t_invalid = 0, + ns_t_a = 1, + ns_t_ns = 2, + ns_t_md = 3, + ns_t_mf = 4, + ns_t_cname = 5, + ns_t_soa = 6, + ns_t_mb = 7, + ns_t_mg = 8, + ns_t_mr = 9, + ns_t_null = 10, + ns_t_wks = 11, + ns_t_ptr = 12, + ns_t_hinfo = 13, + ns_t_minfo = 14, + ns_t_mx = 15, + ns_t_txt = 16, + ns_t_rp = 17, + ns_t_afsdb = 18, + ns_t_x25 = 19, + ns_t_isdn = 20, + ns_t_rt = 21, + ns_t_nsap = 22, + ns_t_nsap_ptr = 23, + ns_t_sig = 24, + ns_t_key = 25, + ns_t_px = 26, + ns_t_gpos = 27, + ns_t_aaaa = 28, + ns_t_loc = 29, + ns_t_nxt = 30, + ns_t_eid = 31, + ns_t_nimloc = 32, + ns_t_srv = 33, + ns_t_atma = 34, + ns_t_naptr = 35, + ns_t_kx = 36, + ns_t_cert = 37, + ns_t_a6 = 38, + ns_t_dname = 39, + ns_t_sink = 40, + ns_t_opt = 41, + ns_t_apl = 42, + ns_t_tkey = 249, + ns_t_tsig = 250, + ns_t_ixfr = 251, + ns_t_axfr = 252, + ns_t_mailb = 253, + ns_t_maila = 254, + ns_t_any = 255, + ns_t_zxfr = 256, + ns_t_max = 65536 +} ns_type; + +#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || (t) == ns_t_mailb || (t) == ns_t_maila) +#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) +#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) +#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) +#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || (t) == ns_t_zxfr) + +typedef enum __ns_class { + ns_c_invalid = 0, + ns_c_in = 1, + ns_c_2 = 2, + ns_c_chaos = 3, + ns_c_hs = 4, + ns_c_none = 254, + ns_c_any = 255, + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_key_types { + ns_kt_rsa = 1, + ns_kt_dh = 2, + ns_kt_dsa = 3, + ns_kt_private = 254 +} ns_key_types; + +typedef enum __ns_cert_types { + cert_t_pkix = 1, + cert_t_spki = 2, + cert_t_pgp = 3, + cert_t_url = 253, + cert_t_oid = 254 +} ns_cert_types; + +#define NS_KEY_TYPEMASK 0xC000 +#define NS_KEY_TYPE_AUTH_CONF 0x0000 +#define NS_KEY_TYPE_CONF_ONLY 0x8000 +#define NS_KEY_TYPE_AUTH_ONLY 0x4000 +#define NS_KEY_TYPE_NO_KEY 0xC000 +#define NS_KEY_NO_AUTH 0x8000 +#define NS_KEY_NO_CONF 0x4000 +#define NS_KEY_RESERVED2 0x2000 +#define NS_KEY_EXTENDED_FLAGS 0x1000 +#define NS_KEY_RESERVED4 0x0800 +#define NS_KEY_RESERVED5 0x0400 +#define NS_KEY_NAME_TYPE 0x0300 +#define NS_KEY_NAME_USER 0x0000 +#define NS_KEY_NAME_ENTITY 0x0200 +#define NS_KEY_NAME_ZONE 0x0100 +#define NS_KEY_NAME_RESERVED 0x0300 +#define NS_KEY_RESERVED8 0x0080 +#define NS_KEY_RESERVED9 0x0040 +#define NS_KEY_RESERVED10 0x0020 +#define NS_KEY_RESERVED11 0x0010 +#define NS_KEY_SIGNATORYMASK 0x000F +#define NS_KEY_RESERVED_BITMASK \ + (NS_KEY_RESERVED2 | NS_KEY_RESERVED4 | NS_KEY_RESERVED5 | NS_KEY_RESERVED8 | NS_KEY_RESERVED9 | \ + NS_KEY_RESERVED10 | NS_KEY_RESERVED11) +#define NS_KEY_RESERVED_BITMASK2 0xFFFF +#define NS_ALG_MD5RSA 1 +#define NS_ALG_DH 2 +#define NS_ALG_DSA 3 +#define NS_ALG_DSS NS_ALG_DSA +#define NS_ALG_EXPIRE_ONLY 253 +#define NS_ALG_PRIVATE_OID 254 + +#define NS_KEY_PROT_TLS 1 +#define NS_KEY_PROT_EMAIL 2 +#define NS_KEY_PROT_DNSSEC 3 +#define NS_KEY_PROT_IPSEC 4 +#define NS_KEY_PROT_ANY 255 + +#define NS_MD5RSA_MIN_BITS 512 +#define NS_MD5RSA_MAX_BITS 4096 +#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS + 7 / 8) * 2 + 3) +#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES + 2) / 3) * 4) +#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS + 7) / 8) +#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS + 7) / 8) + +#define NS_DSA_SIG_SIZE 41 +#define NS_DSA_MIN_SIZE 213 +#define NS_DSA_MAX_BYTES 405 + +#define NS_SIG_TYPE 0 +#define NS_SIG_ALG 2 +#define NS_SIG_LABELS 3 +#define NS_SIG_OTTL 4 +#define NS_SIG_EXPIR 8 +#define NS_SIG_SIGNED 12 +#define NS_SIG_FOOT 16 +#define NS_SIG_SIGNER 18 +#define NS_NXT_BITS 8 +#define NS_NXT_BIT_SET(n, p) (p[(n) / NS_NXT_BITS] |= (0x80 >> ((n) % NS_NXT_BITS))) +#define NS_NXT_BIT_CLEAR(n, p) (p[(n) / NS_NXT_BITS] &= ~(0x80 >> ((n) % NS_NXT_BITS))) +#define NS_NXT_BIT_ISSET(n, p) (p[(n) / NS_NXT_BITS] & (0x80 >> ((n) % NS_NXT_BITS))) +#define NS_NXT_MAX 127 + +#define NS_OPT_DNSSEC_OK 0x8000U +#define NS_OPT_NSID 3 + +#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp) += 2) - 2)) +#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp) += 4) - 4)) +#define NS_PUT16(s, cp) ns_put16((s), ((cp) += 2) - 2) +#define NS_PUT32(l, cp) ns_put32((l), ((cp) += 4) - 4) + +unsigned ns_get16(const unsigned char*); +unsigned long ns_get32(const unsigned char*); +void ns_put16(unsigned, unsigned char*); +void ns_put32(unsigned long, unsigned char*); + +int ns_initparse(const unsigned char*, int, ns_msg*); +int ns_parserr(ns_msg*, ns_sect, int, ns_rr*); +int ns_skiprr(const unsigned char*, const unsigned char*, ns_sect, int); +int ns_name_uncompress(const unsigned char*, const unsigned char*, const unsigned char*, char*, + size_t); + +#define __BIND 19950621 + +typedef struct { + unsigned id : 16; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned qr : 1; + unsigned opcode : 4; + unsigned aa : 1; + unsigned tc : 1; + unsigned rd : 1; + unsigned ra : 1; + unsigned unused : 1; + unsigned ad : 1; + unsigned cd : 1; + unsigned rcode : 4; +#else + unsigned rd : 1; + unsigned tc : 1; + unsigned aa : 1; + unsigned opcode : 4; + unsigned qr : 1; + unsigned rcode : 4; + unsigned cd : 1; + unsigned ad : 1; + unsigned unused : 1; + unsigned ra : 1; +#endif + unsigned qdcount : 16; + unsigned ancount : 16; + unsigned nscount : 16; + unsigned arcount : 16; +} HEADER; + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INT32SZ NS_INT32SZ +#define INT16SZ NS_INT16SZ +#define INT8SZ NS_INT8SZ +#define INADDRSZ NS_INADDRSZ +#define IN6ADDRSZ NS_IN6ADDRSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define S_ZONE ns_s_zn +#define S_PREREQ ns_s_pr +#define S_UPDATE ns_s_ud +#define S_ADDT ns_s_ar + +#define QUERY ns_o_query +#define IQUERY ns_o_iquery +#define STATUS ns_o_status +#define NS_NOTIFY_OP ns_o_notify +#define NS_UPDATE_OP ns_o_update + +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define SERVFAIL ns_r_servfail +#define NXDOMAIN ns_r_nxdomain +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#define YXDOMAIN ns_r_yxdomain +#define YXRRSET ns_r_yxrrset +#define NXRRSET ns_r_nxrrset +#define NOTAUTH ns_r_notauth +#define NOTZONE ns_r_notzone + +#define DELETE ns_uop_delete +#define ADD ns_uop_add + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_A6 ns_t_a6 +#define T_DNAME ns_t_dname +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define GETSHORT NS_GET16 +#define GETLONG NS_GET32 +#define PUTSHORT NS_PUT16 +#define PUTLONG NS_PUT32 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ARPA_NAMESER_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/nameser_compat.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/nameser_compat.h new file mode 100644 index 0000000..ee3b1a9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/nameser_compat.h
@@ -0,0 +1 @@ +#include <arpa/nameser.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/telnet.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/telnet.h new file mode 100644 index 0000000..2da3eda --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/telnet.h
@@ -0,0 +1,279 @@ +#ifndef SYSROOT_ARPA_TELNET_H_ +#define SYSROOT_ARPA_TELNET_H_ + +#define IAC 255 +#define DONT 254 +#define DO 253 +#define WONT 252 +#define WILL 251 +#define SB 250 +#define GA 249 +#define EL 248 +#define EC 247 +#define AYT 246 +#define AO 245 +#define IP 244 +#define BREAK 243 +#define DM 242 +#define NOP 241 +#define SE 240 +#define EOR 239 +#define ABORT 238 +#define SUSP 237 +#define xEOF 236 + +#define SYNCH 242 + +#define telcmds \ + ((char[][6]){"EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", \ + "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0}) + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +#define TELOPT_BINARY 0 +#define TELOPT_ECHO 1 +#define TELOPT_RCP 2 +#define TELOPT_SGA 3 +#define TELOPT_NAMS 4 +#define TELOPT_STATUS 5 +#define TELOPT_TM 6 +#define TELOPT_RCTE 7 +#define TELOPT_NAOL 8 +#define TELOPT_NAOP 9 +#define TELOPT_NAOCRD 10 +#define TELOPT_NAOHTS 11 +#define TELOPT_NAOHTD 12 +#define TELOPT_NAOFFD 13 +#define TELOPT_NAOVTS 14 +#define TELOPT_NAOVTD 15 +#define TELOPT_NAOLFD 16 +#define TELOPT_XASCII 17 +#define TELOPT_LOGOUT 18 +#define TELOPT_BM 19 +#define TELOPT_DET 20 +#define TELOPT_SUPDUP 21 +#define TELOPT_SUPDUPOUTPUT 22 +#define TELOPT_SNDLOC 23 +#define TELOPT_TTYPE 24 +#define TELOPT_EOR 25 +#define TELOPT_TUID 26 +#define TELOPT_OUTMRK 27 +#define TELOPT_TTYLOC 28 +#define TELOPT_3270REGIME 29 +#define TELOPT_X3PAD 30 +#define TELOPT_NAWS 31 +#define TELOPT_TSPEED 32 +#define TELOPT_LFLOW 33 +#define TELOPT_LINEMODE 34 +#define TELOPT_XDISPLOC 35 +#define TELOPT_OLD_ENVIRON 36 +#define TELOPT_AUTHENTICATION 37 /* Authenticate */ +#define TELOPT_ENCRYPT 38 +#define TELOPT_NEW_ENVIRON 39 +#define TELOPT_EXOPL 255 + +#define NTELOPTS (1 + TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char* telopts[NTELOPTS + 1] = { + "BINARY", + "ECHO", + "RCP", + "SUPPRESS GO AHEAD", + "NAME", + "STATUS", + "TIMING MARK", + "RCTE", + "NAOL", + "NAOP", + "NAOCRD", + "NAOHTS", + "NAOHTD", + "NAOFFD", + "NAOVTS", + "NAOVTD", + "NAOLFD", + "EXTEND ASCII", + "LOGOUT", + "BYTE MACRO", + "DATA ENTRY TERMINAL", + "SUPDUP", + "SUPDUP OUTPUT", + "SEND LOCATION", + "TERMINAL TYPE", + "END OF RECORD", + "TACACS UID", + "OUTPUT MARKING", + "TTYLOC", + "3270 REGIME", + "X.3 PAD", + "NAWS", + "TSPEED", + "LFLOW", + "LINEMODE", + "XDISPLOC", + "OLD-ENVIRON", + "AUTHENTICATION", + "ENCRYPT", + "NEW-ENVIRON", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +#define TELQUAL_IS 0 +#define TELQUAL_SEND 1 +#define TELQUAL_INFO 2 +#define TELQUAL_REPLY 2 +#define TELQUAL_NAME 3 + +#define LFLOW_OFF 0 +#define LFLOW_ON 1 +#define LFLOW_RESTART_ANY 2 +#define LFLOW_RESTART_XON 3 + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +#define SLC_NAMELIST \ + "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char* slc_names[] = {SLC_NAMELIST}; +#else +extern char* slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +#define AUTH_WHO_CLIENT 0 +#define AUTH_WHO_SERVER 1 +#define AUTH_WHO_MASK 1 + +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char* authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char* authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +#define ENCRYPT_IS 0 +#define ENCRYPT_SUPPORT 1 +#define ENCRYPT_REPLY 2 +#define ENCRYPT_START 3 +#define ENCRYPT_END 4 +#define ENCRYPT_REQSTART 5 +#define ENCRYPT_REQEND 6 +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char* encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", "REQUEST-START", + "REQUEST-END", "ENC-KEYID", "DEC-KEYID", 0, +}; +char* enctype_names[] = { + "ANY", + "DES_CFB64", + "DES_OFB64", + 0, +}; +#else +extern char* encrypt_names[]; +extern char* enctype_names[]; +#endif + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif // SYSROOT_ARPA_TELNET_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/tftp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/tftp.h new file mode 100644 index 0000000..e091368 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/arpa/tftp.h
@@ -0,0 +1,32 @@ +#ifndef SYSROOT_ARPA_TFTP_H_ +#define SYSROOT_ARPA_TFTP_H_ + +#define SEGSIZE 512 +#define RRQ 01 +#define WRQ 02 +#define DATA 03 +#define ACK 04 +#define ERROR 05 +struct tftphdr { + short th_opcode; + union { + unsigned short tu_block; + short tu_code; + char tu_stuff[1]; + } th_u; + char th_data[1]; +}; +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data +#define EUNDEF 0 +#define ENOTFOUND 1 +#define EACCESS 2 +#define ENOSPACE 3 +#define EBADOP 4 +#define EBADID 5 +#define EEXISTS 6 +#define ENOUSER 7 + +#endif // SYSROOT_ARPA_TFTP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/assert.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/assert.h new file mode 100644 index 0000000..02e96dc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/assert.h
@@ -0,0 +1,23 @@ +#include <features.h> + +#undef assert + +#ifdef NDEBUG +#define assert(x) (void)0 +#else +#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__), 0))) +#endif + +#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) && !defined(static_assert) +#define static_assert _Static_assert +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void __assert_fail(const char*, const char*, int, const char*); + +#ifdef __cplusplus +} +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/endian.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/endian.h new file mode 100644 index 0000000..7a74d2f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/endian.h
@@ -0,0 +1,5 @@ +#if __AARCH64EB__ +#define __BYTE_ORDER __BIG_ENDIAN +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/fenv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/fenv.h new file mode 100644 index 0000000..a370540 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/fenv.h
@@ -0,0 +1,19 @@ +#define FE_INVALID 1 +#define FE_DIVBYZERO 2 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 8 +#define FE_INEXACT 16 +#define FE_ALL_EXCEPT 31 +#define FE_TONEAREST 0 +#define FE_DOWNWARD 0x800000 +#define FE_UPWARD 0x400000 +#define FE_TOWARDZERO 0xc00000 + +typedef unsigned int fexcept_t; + +typedef struct { + unsigned int __fpcr; + unsigned int __fpsr; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t*)-1)
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/io.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/io.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/io.h
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/ioctl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/ioctl.h new file mode 100644 index 0000000..40835ba --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/ioctl.h
@@ -0,0 +1,213 @@ +#define _IOC(a, b, c, d) (((a) << 30) | ((b) << 8) | (c) | ((d) << 16)) +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IO(a, b) _IOC(_IOC_NONE, (a), (b), 0) +#define _IOW(a, b, c) _IOC(_IOC_WRITE, (a), (b), sizeof(c)) +#define _IOR(a, b, c) _IOC(_IOC_READ, (a), (b), sizeof(c)) +#define _IOWR(a, b, c) _IOC(_IOC_READ | _IOC_WRITE, (a), (b), sizeof(c)) + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCTTYGSTRUCT 0x5426 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGRS485 0x542E +#define TIOCSRS485 0x542F +#define TIOCGPTN _IOR('T', 0x30, unsigned int) +#define TIOCSPTLCK _IOW('T', 0x31, int) +#define TIOCGDEV _IOR('T', 0x32, unsigned int) +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 +#define TIOCSIG 0x40045436 +#define TIOCVHANGUP 0x5437 +#define TIOCGPKT 0x80045438 +#define TIOCGPTLCK 0x80045439 +#define TIOCGEXCL 0x80045440 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERGETLSR 0x5459 +#define TIOCSERGETMULTI 0x545A +#define TIOCSERSETMULTI 0x545B + +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define FIOQSIZE 0x5460 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 +#define TIOCPKT_IOCTL 64 + +#define TIOCSER_TEMT 0x01 + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 +#define TIOCM_MODEM_BITS TIOCM_OUT2 + +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 +#define N_6PACK 7 +#define N_MASC 8 +#define N_R3964 9 +#define N_PROFIBUS_FDL 10 +#define N_IRDA 11 +#define N_SMSBLOCK 12 +#define N_HDLC 13 +#define N_SYNC_PPP 14 +#define N_HCI 15 +#define N_GIGASET_M101 16 +#define N_SLCAN 17 +#define N_PPS 18 +#define N_V253 19 +#define N_CAIF 20 +#define N_GSM0710 21 +#define N_TI_WL 22 +#define N_TRACESINK 23 +#define N_TRACEROUTER 24 + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 +#define SIOCGSTAMPNS 0x8907 + +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D + +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX SIOCGIFINDEX +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 + +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 + +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 + +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 + +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 + +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 + +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 + +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/ipc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/ipc.h new file mode 100644 index 0000000..26161a2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/ipc.h
@@ -0,0 +1,14 @@ +struct ipc_perm { + key_t __ipc_perm_key; + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; + unsigned short __ipc_perm_seq; + + unsigned long __pad1; + unsigned long __pad2; +}; + +#define IPC_64 0
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/reg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/reg.h new file mode 100644 index 0000000..2633f39 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/reg.h
@@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 64
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/setjmp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/setjmp.h new file mode 100644 index 0000000..c37aeb8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/setjmp.h
@@ -0,0 +1 @@ +typedef unsigned long long int __jmp_buf[23];
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/signal.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/signal.h new file mode 100644 index 0000000..64e57f3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/signal.h
@@ -0,0 +1,107 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 6144 +#define SIGSTKSZ 12288 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long greg_t; +typedef unsigned long gregset_t[34]; + +typedef struct { + long double vregs[32]; + unsigned int fpsr; + unsigned int fpcr; +} fpregset_t; +typedef struct sigcontext { + unsigned long fault_address; + unsigned long regs[31]; + unsigned long sp, pc, pstate; + long double __reserved[256]; +} mcontext_t; + +#define FPSIMD_MAGIC 0x46508001 +#define ESR_MAGIC 0x45535201 +struct _aarch64_ctx { + unsigned int magic; + unsigned int size; +}; +struct fpsimd_context { + struct _aarch64_ctx head; + unsigned int fpsr; + unsigned int fpcr; + long double vregs[32]; +}; +struct esr_context { + struct _aarch64_ctx head; + unsigned long esr; +}; +#else +typedef struct { + long double __regs[18 + 256]; +} mcontext_t; +#endif + +struct sigaltstack { + void* ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct ucontext* uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + mcontext_t uc_mcontext; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/stat.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/stat.h new file mode 100644 index 0000000..02102fa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/aarch64/stat.h
@@ -0,0 +1,18 @@ +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned __unused1[2]; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/alltypes.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/alltypes.h new file mode 100644 index 0000000..95da44c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/alltypes.h
@@ -0,0 +1,544 @@ +#if defined(__cplusplus) && !defined(__clang__) +#define __C11_ATOMIC(t) t +#else +#define __C11_ATOMIC(t) _Atomic(t) +#endif + +#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t) +typedef __UINT8_TYPE__ uint8_t; +#define __DEFINED_uint8_t +#endif + +#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t) +typedef __UINT16_TYPE__ uint16_t; +#define __DEFINED_uint16_t +#endif + +#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t) +typedef __UINT32_TYPE__ uint32_t; +#define __DEFINED_uint32_t +#endif + +#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t) +typedef __UINT64_TYPE__ uint64_t; +#define __DEFINED_uint64_t +#endif + +#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t) +typedef __INT8_TYPE__ int8_t; +#define __DEFINED_int8_t +#endif + +#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t) +typedef __INT16_TYPE__ int16_t; +#define __DEFINED_int16_t +#endif + +#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t) +typedef __INT32_TYPE__ int32_t; +#define __DEFINED_int32_t +#endif + +#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t) +typedef __INT64_TYPE__ int64_t; +#define __DEFINED_int64_t +#endif + +#if defined(__NEED_uint_least8_t) && !defined(__DEFINED_uint_least8_t) +typedef __UINT_LEAST8_TYPE__ uint_least8_t; +#define __DEFINED_uint_least8_t +#endif + +#if defined(__NEED_uint_least16_t) && !defined(__DEFINED_uint_least16_t) +typedef __UINT_LEAST16_TYPE__ uint_least16_t; +#define __DEFINED_uint_least16_t +#endif + +#if defined(__NEED_uint_least32_t) && !defined(__DEFINED_uint_least32_t) +typedef __UINT_LEAST32_TYPE__ uint_least32_t; +#define __DEFINED_uint_least32_t +#endif + +#if defined(__NEED_uint_least64_t) && !defined(__DEFINED_uint_least64_t) +typedef __UINT_LEAST64_TYPE__ uint_least64_t; +#define __DEFINED_uint_least64_t +#endif + +#if defined(__NEED_int_least8_t) && !defined(__DEFINED_int_least8_t) +typedef __INT_LEAST8_TYPE__ int_least8_t; +#define __DEFINED_int_least8_t +#endif + +#if defined(__NEED_int_least16_t) && !defined(__DEFINED_int_least16_t) +typedef __INT_LEAST16_TYPE__ int_least16_t; +#define __DEFINED_int_least16_t +#endif + +#if defined(__NEED_int_least32_t) && !defined(__DEFINED_int_least32_t) +typedef __INT_LEAST32_TYPE__ int_least32_t; +#define __DEFINED_int_least32_t +#endif + +#if defined(__NEED_int_least64_t) && !defined(__DEFINED_int_least64_t) +typedef __INT_LEAST64_TYPE__ int_least64_t; +#define __DEFINED_int_least64_t +#endif + +#if defined(__NEED_uint_fast8_t) && !defined(__DEFINED_uint_fast8_t) +typedef __UINT_FAST8_TYPE__ uint_fast8_t; +#define __DEFINED_uint_fast8_t +#endif + +#if defined(__NEED_uint_fast16_t) && !defined(__DEFINED_uint_fast16_t) +typedef __UINT_FAST16_TYPE__ uint_fast16_t; +#define __DEFINED_uint_fast16_t +#endif + +#if defined(__NEED_uint_fast32_t) && !defined(__DEFINED_uint_fast32_t) +typedef __UINT_FAST32_TYPE__ uint_fast32_t; +#define __DEFINED_uint_fast32_t +#endif + +#if defined(__NEED_uint_fast64_t) && !defined(__DEFINED_uint_fast64_t) +typedef __UINT_FAST64_TYPE__ uint_fast64_t; +#define __DEFINED_uint_fast64_t +#endif + +#if defined(__NEED_int_fast8_t) && !defined(__DEFINED_int_fast8_t) +typedef __INT_FAST8_TYPE__ int_fast8_t; +#define __DEFINED_int_fast8_t +#endif + +#if defined(__NEED_int_fast16_t) && !defined(__DEFINED_int_fast16_t) +typedef __INT_FAST16_TYPE__ int_fast16_t; +#define __DEFINED_int_fast16_t +#endif + +#if defined(__NEED_int_fast32_t) && !defined(__DEFINED_int_fast32_t) +typedef __INT_FAST32_TYPE__ int_fast32_t; +#define __DEFINED_int_fast32_t +#endif + +#if defined(__NEED_int_fast64_t) && !defined(__DEFINED_int_fast64_t) +typedef __INT_FAST64_TYPE__ int_fast64_t; +#define __DEFINED_int_fast64_t +#endif + +#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t) +typedef __INTPTR_TYPE__ intptr_t; +#define __DEFINED_intptr_t +#endif + +#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t) +typedef __UINTPTR_TYPE__ uintptr_t; +#define __DEFINED_uintptr_t +#endif + +#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t) +typedef __INTMAX_TYPE__ intmax_t; +#define __DEFINED_intmax_t +#endif + +#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t) +typedef __UINTMAX_TYPE__ uintmax_t; +#define __DEFINED_uintmax_t +#endif + +#ifndef __cplusplus +#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t) +typedef __WCHAR_TYPE__ wchar_t; +#define __DEFINED_wchar_t +#endif +#endif + +#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t) +typedef unsigned wint_t; +#define __DEFINED_wint_t +#endif + +#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t) +typedef unsigned long wctype_t; +#define __DEFINED_wctype_t +#endif + +#if defined(__NEED_size_t) && !defined(__DEFINED_size_t) +typedef __SIZE_TYPE__ size_t; +#define __DEFINED_size_t +#endif + +#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t) +typedef __PTRDIFF_TYPE__ ptrdiff_t; +#define __DEFINED_ptrdiff_t +#endif + +#if defined(__NEED_va_list) && !defined(__DEFINED_va_list) +typedef __builtin_va_list va_list; +#define __DEFINED_va_list +#endif + +#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list) +typedef __builtin_va_list __isoc_va_list; +#define __DEFINED___isoc_va_list +#endif + +#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t) +typedef long ssize_t; +#define __DEFINED_ssize_t +#endif + +#if defined(__NEED_time_t) && !defined(__DEFINED_time_t) +typedef long time_t; +#define __DEFINED_time_t +#endif + +#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t) +typedef struct { + long long __ll; + long double __ld; +} max_align_t; +#define __DEFINED_max_align_t +#endif + +#if defined(__x86_64__) && defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2 +#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) +typedef long double float_t; +#define __DEFINED_float_t +#endif + +#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) +typedef long double double_t; +#define __DEFINED_double_t +#endif + +#else +#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) +typedef float float_t; +#define __DEFINED_float_t +#endif + +#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) +typedef double double_t; +#define __DEFINED_double_t +#endif + +#endif + +#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t) +typedef long suseconds_t; +#define __DEFINED_suseconds_t +#endif + +#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t) +typedef unsigned useconds_t; +#define __DEFINED_useconds_t +#endif + +#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t) +typedef int clockid_t; +#define __DEFINED_clockid_t +#endif + +#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t) +typedef long clock_t; +#define __DEFINED_clock_t +#endif + +#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t) +typedef int pid_t; +#define __DEFINED_pid_t +#endif + +#if defined(__NEED_id_t) && !defined(__DEFINED_id_t) +typedef unsigned id_t; +#define __DEFINED_id_t +#endif + +#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t) +typedef unsigned uid_t; +#define __DEFINED_uid_t +#endif + +#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t) +typedef unsigned gid_t; +#define __DEFINED_gid_t +#endif + +#if defined(__NEED_register_t) && !defined(__DEFINED_register_t) +typedef long register_t; +#define __DEFINED_register_t +#endif + +#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t) +typedef unsigned long nlink_t; +#define __DEFINED_nlink_t +#endif + +#if defined(__NEED_off_t) && !defined(__DEFINED_off_t) +typedef long long off_t; +#define __DEFINED_off_t +#endif + +#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t) +typedef unsigned long long ino_t; +#define __DEFINED_ino_t +#endif + +#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t) +typedef unsigned long long dev_t; +#define __DEFINED_dev_t +#endif + +#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t) +typedef long blksize_t; +#define __DEFINED_blksize_t +#endif + +#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t) +typedef long long blkcnt_t; +#define __DEFINED_blkcnt_t +#endif + +#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t) +typedef unsigned long long fsblkcnt_t; +#define __DEFINED_fsblkcnt_t +#endif + +#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t) +typedef unsigned long long fsfilcnt_t; +#define __DEFINED_fsfilcnt_t +#endif + +#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec) +struct iovec { + void* iov_base; + size_t iov_len; +}; +#define __DEFINED_struct_iovec +#endif + +#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval) +struct timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; +#define __DEFINED_struct_timeval +#endif + +#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec) +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#define __DEFINED_struct_timespec +#endif + +#if defined(__NEED_key_t) && !defined(__DEFINED_key_t) +typedef int key_t; +#define __DEFINED_key_t +#endif + +#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t) +typedef void* timer_t; +#define __DEFINED_timer_t +#endif + +#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t) +typedef long regoff_t; +#define __DEFINED_regoff_t +#endif + +#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t) +typedef unsigned socklen_t; +#define __DEFINED_socklen_t +#endif + +#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t) +typedef unsigned short sa_family_t; +#define __DEFINED_sa_family_t +#endif + +#if defined(__NEED_FILE) && !defined(__DEFINED_FILE) +typedef struct _IO_FILE FILE; +#define __DEFINED_FILE +#endif + +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t) +typedef struct __locale_struct* locale_t; +#define __DEFINED_locale_t +#endif + +#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t) +typedef unsigned mode_t; +#define __DEFINED_mode_t +#endif + +#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t) +typedef struct __sigset_t { + unsigned long __bits[128 / sizeof(long)]; +} sigset_t; +#define __DEFINED_sigset_t +#endif + +#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t) +typedef __C11_ATOMIC(int) pthread_once_t; +#define __DEFINED_pthread_once_t +#endif + +#if defined(__NEED_once_flag) && !defined(__DEFINED_once_flag) +typedef __C11_ATOMIC(int) once_flag; +#define __DEFINED_once_flag +#endif + +#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t) +typedef unsigned pthread_key_t; +#define __DEFINED_pthread_key_t +#endif + +#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t) +typedef __C11_ATOMIC(int) pthread_spinlock_t; +#define __DEFINED_pthread_spinlock_t +#endif + +#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t) +typedef struct { + unsigned __attr; +} pthread_mutexattr_t; +#define __DEFINED_pthread_mutexattr_t +#endif + +#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t) +typedef struct { + unsigned __attr; +} pthread_condattr_t; +#define __DEFINED_pthread_condattr_t +#endif + +#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t) +typedef struct { + unsigned __attr; +} pthread_barrierattr_t; +#define __DEFINED_pthread_barrierattr_t +#endif + +#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t) +typedef struct { + unsigned __attr[2]; +} pthread_rwlockattr_t; +#define __DEFINED_pthread_rwlockattr_t +#endif + +#ifdef __cplusplus +#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) +typedef unsigned long pthread_t; +#define __DEFINED_pthread_t +#endif + +#else +#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) +typedef struct __pthread* pthread_t; +#define __DEFINED_pthread_t +#endif + +#endif + +#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t) +typedef struct __mbstate_t { + unsigned __opaque1, __opaque2; +} mbstate_t; +#define __DEFINED_mbstate_t +#endif + +#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t) +typedef struct { + const char* __name; + int __c11; + size_t _a_stacksize; + size_t _a_guardsize; + void* _a_stackaddr; + int _a_detach; + int _a_sched; + int _a_policy; + int _a_prio; +} pthread_attr_t; +#define __DEFINED_pthread_attr_t +#endif + +#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t) +typedef struct { + unsigned _m_attr; + __C11_ATOMIC(int) + _m_lock; + __C11_ATOMIC(int) + _m_waiters; + int _m_count; +} pthread_mutex_t; +#define __DEFINED_pthread_mutex_t +#endif + +#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t) +typedef struct +#if defined(__clang__) + __attribute__((__capability__("mutex"))) +#endif +{ + int __i[1]; +} mtx_t; +#define __DEFINED_mtx_t +#endif + +#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t) +typedef struct { + void* _c_head; + int _c_clock; + void* _c_tail; + __C11_ATOMIC(int) + _c_lock; +} pthread_cond_t; +#define __DEFINED_pthread_cond_t +#endif + +#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t) +typedef struct { + void* _c_head; + int _c_clock; + void* _c_tail; + __C11_ATOMIC(int) _c_lock; +} cnd_t; +#define __DEFINED_cnd_t +#endif + +#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t) +typedef struct { + __C11_ATOMIC(int) + _rw_lock; + __C11_ATOMIC(int) + _rw_waiters; +} pthread_rwlock_t; +#define __DEFINED_pthread_rwlock_t +#endif + +#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t) +typedef struct { + __C11_ATOMIC(int) + _b_lock; + __C11_ATOMIC(int) + _b_waiters; + unsigned int _b_limit; + __C11_ATOMIC(int) + _b_count; + __C11_ATOMIC(int) + _b_waiters2; + void* _b_inst; +} pthread_barrier_t; +#define __DEFINED_pthread_barrier_t +#endif + +#if defined(__NEED_sem_t) && !defined(__DEFINED_sem_t) +typedef struct { + __C11_ATOMIC(int) + _s_value; + __C11_ATOMIC(int) + _s_waiters; +} sem_t; +#define __DEFINED_sem_t +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/endian.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/endian.h new file mode 100644 index 0000000..ed44e80 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/endian.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/endian.h" +#elif defined(__aarch64__) +#include "aarch64/endian.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/errno.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/errno.h new file mode 100644 index 0000000..b9ebc31 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/errno.h
@@ -0,0 +1,134 @@ +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EDEADLK 35 +#define ENAMETOOLONG 36 +#define ENOLCK 37 +#define ENOSYS 38 +#define ENOTEMPTY 39 +#define ELOOP 40 +#define EWOULDBLOCK EAGAIN +#define ENOMSG 42 +#define EIDRM 43 +#define ECHRNG 44 +#define EL2NSYNC 45 +#define EL3HLT 46 +#define EL3RST 47 +#define ELNRNG 48 +#define EUNATCH 49 +#define ENOCSI 50 +#define EL2HLT 51 +#define EBADE 52 +#define EBADR 53 +#define EXFULL 54 +#define ENOANO 55 +#define EBADRQC 56 +#define EBADSLT 57 +#define EDEADLOCK EDEADLK +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EMULTIHOP 72 +#define EDOTDOT 73 +#define EBADMSG 74 +#define EOVERFLOW 75 +#define ENOTUNIQ 76 +#define EBADFD 77 +#define EREMCHG 78 +#define ELIBACC 79 +#define ELIBBAD 80 +#define ELIBSCN 81 +#define ELIBMAX 82 +#define ELIBEXEC 83 +#define EILSEQ 84 +#define ERESTART 85 +#define ESTRPIPE 86 +#define EUSERS 87 +#define ENOTSOCK 88 +#define EDESTADDRREQ 89 +#define EMSGSIZE 90 +#define EPROTOTYPE 91 +#define ENOPROTOOPT 92 +#define EPROTONOSUPPORT 93 +#define ESOCKTNOSUPPORT 94 +#define EOPNOTSUPP 95 +#define ENOTSUP EOPNOTSUPP +#define EPFNOSUPPORT 96 +#define EAFNOSUPPORT 97 +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 +#define ENETRESET 102 +#define ECONNABORTED 103 +#define ECONNRESET 104 +#define ENOBUFS 105 +#define EISCONN 106 +#define ENOTCONN 107 +#define ESHUTDOWN 108 +#define ETOOMANYREFS 109 +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 +#define ESTALE 116 +#define EUCLEAN 117 +#define ENOTNAM 118 +#define ENAVAIL 119 +#define EISNAM 120 +#define EREMOTEIO 121 +#define EDQUOT 122 +#define ENOMEDIUM 123 +#define EMEDIUMTYPE 124 +#define ECANCELED 125 +#define ENOKEY 126 +#define EKEYEXPIRED 127 +#define EKEYREVOKED 128 +#define EKEYREJECTED 129 +#define EOWNERDEAD 130 +#define ENOTRECOVERABLE 131 +#define ERFKILL 132 +#define EHWPOISON 133
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/fcntl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/fcntl.h new file mode 100644 index 0000000..c96e45f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/fcntl.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/fcntl.h" +#elif defined(__aarch64__) +#include "aarch64/fcntl.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/fenv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/fenv.h new file mode 100644 index 0000000..99ca0ba --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/fenv.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/fenv.h" +#elif defined(__aarch64__) +#include "aarch64/fenv.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/io.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/io.h new file mode 100644 index 0000000..480bbaf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/io.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/io.h" +#elif defined(__aarch64__) +#include "aarch64/io.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/ioctl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/ioctl.h new file mode 100644 index 0000000..d8bcfa3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/ioctl.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/ioctl.h" +#elif defined(__aarch64__) +#include "aarch64/ioctl.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/ipc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/ipc.h new file mode 100644 index 0000000..a81d510 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/ipc.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/ipc.h" +#elif defined(__aarch64__) +#include "aarch64/ipc.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/limits.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/limits.h new file mode 100644 index 0000000..8d1910b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/limits.h
@@ -0,0 +1,8 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define PAGE_SIZE 4096 +#define LONG_BIT 64 +#endif + +#define LONG_MAX 0x7fffffffffffffffL +#define LLONG_MAX 0x7fffffffffffffffLL
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/msg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/msg.h new file mode 100644 index 0000000..1c8034b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/msg.h
@@ -0,0 +1,12 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + time_t msg_stime; + time_t msg_rtime; + time_t msg_ctime; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + unsigned long __unused[2]; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/null.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/null.h new file mode 100644 index 0000000..76e7b77 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/null.h
@@ -0,0 +1,15 @@ +// Copyright 2017 The Fuchsia Authors +// +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT + +#ifndef SYSROOT_BITS_NULL_H_ +#define SYSROOT_BITS_NULL_H_ + +// The compiler's <stddef.h> defines NULL without defining anything +// else if __need_NULL is defined first. +#define __need_NULL +#include <stddef.h> + +#endif // SYSROOT_BITS_NULL_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/poll.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/poll.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/poll.h
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/posix.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/posix.h new file mode 100644 index 0000000..8068ce9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/posix.h
@@ -0,0 +1,2 @@ +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V7_LP64_OFF64 1
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/reg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/reg.h new file mode 100644 index 0000000..ad220cc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/reg.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/reg.h" +#elif defined(__aarch64__) +#include "aarch64/reg.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/resource.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/resource.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/resource.h
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/sem.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/sem.h new file mode 100644 index 0000000..db4102f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/sem.h
@@ -0,0 +1,14 @@ +struct semid_ds { + struct ipc_perm sem_perm; + time_t sem_otime; + time_t sem_ctime; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(time_t) - sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(time_t) - sizeof(short)]; + unsigned short sem_nsems; +#endif + time_t __unused3; + time_t __unused4; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/setjmp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/setjmp.h new file mode 100644 index 0000000..d42af58 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/setjmp.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/setjmp.h" +#elif defined(__aarch64__) +#include "aarch64/setjmp.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/shm.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/shm.h new file mode 100644 index 0000000..a3b9dcc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/shm.h
@@ -0,0 +1,24 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; +}; + +struct shminfo { + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; +}; + +struct shm_info { + int __used_ids; + unsigned long shm_tot, shm_rss, shm_swp; + unsigned long __swap_attempts, __swap_successes; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/signal.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/signal.h new file mode 100644 index 0000000..021a17f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/signal.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/signal.h" +#elif defined(__aarch64__) +#include "aarch64/signal.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/socket.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/socket.h new file mode 100644 index 0000000..1127d5b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/socket.h
@@ -0,0 +1,33 @@ +#include <endian.h> + +struct msghdr { + void* msg_name; + socklen_t msg_namelen; + struct iovec* msg_iov; +#if __BYTE_ORDER == __BIG_ENDIAN + int __pad1, msg_iovlen; +#else + int msg_iovlen, __pad1; +#endif + void* msg_control; +#if __BYTE_ORDER == __BIG_ENDIAN + int __pad2; + socklen_t msg_controllen; +#else + socklen_t msg_controllen; + int __pad2; +#endif + int msg_flags; +}; + +struct cmsghdr { +#if __BYTE_ORDER == __BIG_ENDIAN + int __pad1; + socklen_t cmsg_len; +#else + socklen_t cmsg_len; + int __pad1; +#endif + int cmsg_level; + int cmsg_type; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/stat.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/stat.h new file mode 100644 index 0000000..308b256 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/stat.h
@@ -0,0 +1,7 @@ +#if defined(__x86_64__) +#include "x86_64/stat.h" +#elif defined(__aarch64__) +#include "aarch64/stat.h" +#else +#error Unsupported architecture! +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/statfs.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/statfs.h new file mode 100644 index 0000000..ef2bbe3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/statfs.h
@@ -0,0 +1,7 @@ +struct statfs { + unsigned long f_type, f_bsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree; + fsid_t f_fsid; + unsigned long f_namelen, f_frsize, f_flags, f_spare[4]; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/termios.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/termios.h new file mode 100644 index 0000000..d9a7359 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/termios.h
@@ -0,0 +1,159 @@ +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[NCCS]; + speed_t __c_ispeed; + speed_t __c_ospeed; +}; + +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#define B0 0000000 +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 + +#define CBAUD 0010017 + +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 + +#define ISIG 0000001 +#define ICANON 0000002 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define IEXTEN 0100000 + +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define CBAUDEX 0010000 +#define CRTSCTS 020000000000 +#define EXTPROC 0200000 +#define XTABS 0014000 +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/endian.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/endian.h new file mode 100644 index 0000000..172c338 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/endian.h
@@ -0,0 +1 @@ +#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/fenv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/fenv.h new file mode 100644 index 0000000..32e7dbf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/fenv.h
@@ -0,0 +1,34 @@ +#define FE_INVALID 1 +#define __FE_DENORM 2 +#define FE_DIVBYZERO 4 +#define FE_OVERFLOW 8 +#define FE_UNDERFLOW 16 +#define FE_INEXACT 32 + +#define FE_ALL_EXCEPT 63 + +#define FE_TONEAREST 0 +#define FE_DOWNWARD 0x400 +#define FE_UPWARD 0x800 +#define FE_TOWARDZERO 0xc00 + +typedef unsigned short fexcept_t; + +typedef struct { + unsigned short __control_word; + unsigned short __unused1; + unsigned short __status_word; + unsigned short __unused2; + unsigned short __tags; + unsigned short __unused3; + unsigned int __eip; + unsigned short __cs_selector; + unsigned int __opcode : 11; + unsigned int __unused4 : 5; + unsigned int __data_offset; + unsigned short __data_selector; + unsigned short __unused5; + unsigned int __mxcsr; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t*)-1)
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/io.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/io.h new file mode 100644 index 0000000..7234422 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/io.h
@@ -0,0 +1,53 @@ +static __inline void outb(unsigned char __val, unsigned short __port) { + __asm__ volatile("outb %0,%1" : : "a"(__val), "dN"(__port)); +} + +static __inline void outw(unsigned short __val, unsigned short __port) { + __asm__ volatile("outw %0,%1" : : "a"(__val), "dN"(__port)); +} + +static __inline void outl(unsigned int __val, unsigned short __port) { + __asm__ volatile("outl %0,%1" : : "a"(__val), "dN"(__port)); +} + +static __inline unsigned char inb(unsigned short __port) { + unsigned char __val; + __asm__ volatile("inb %1,%0" : "=a"(__val) : "dN"(__port)); + return __val; +} + +static __inline unsigned short inw(unsigned short __port) { + unsigned short __val; + __asm__ volatile("inw %1,%0" : "=a"(__val) : "dN"(__port)); + return __val; +} + +static __inline unsigned int inl(unsigned short __port) { + unsigned int __val; + __asm__ volatile("inl %1,%0" : "=a"(__val) : "dN"(__port)); + return __val; +} + +static __inline void outsb(unsigned short __port, const void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; outsb" : "+S"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void outsw(unsigned short __port, const void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; outsw" : "+S"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void outsl(unsigned short __port, const void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; outsl" : "+S"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void insb(unsigned short __port, void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; insb" : "+D"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void insw(unsigned short __port, void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; insw" : "+D"(__buf), "+c"(__n) : "d"(__port)); +} + +static __inline void insl(unsigned short __port, void* __buf, unsigned long __n) { + __asm__ volatile("cld; rep; insl" : "+D"(__buf), "+c"(__n) : "d"(__port)); +}
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/ioctl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/ioctl.h new file mode 100644 index 0000000..bc8d16a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/ioctl.h
@@ -0,0 +1,197 @@ +#define _IOC(a, b, c, d) (((a) << 30) | ((b) << 8) | (c) | ((d) << 16)) +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IO(a, b) _IOC(_IOC_NONE, (a), (b), 0) +#define _IOW(a, b, c) _IOC(_IOC_WRITE, (a), (b), sizeof(c)) +#define _IOR(a, b, c) _IOC(_IOC_READ, (a), (b), sizeof(c)) +#define _IOWR(a, b, c) _IOC(_IOC_READ | _IOC_WRITE, (a), (b), sizeof(c)) + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCTTYGSTRUCT 0x5426 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGPTN 0x80045430 +#define TIOCSPTLCK 0x40045431 +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERGETLSR 0x5459 +#define TIOCSERGETMULTI 0x545A +#define TIOCSERSETMULTI 0x545B + +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define TIOCGHAYESESP 0x545E +#define TIOCSHAYESESP 0x545F +#define FIOQSIZE 0x5460 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 +#define TIOCPKT_IOCTL 64 + +#define TIOCSER_TEMT 0x01 + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 +#define TIOCM_MODEM_BITS TIOCM_OUT2 + +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 +#define N_6PACK 7 +#define N_MASC 8 +#define N_R3964 9 +#define N_PROFIBUS_FDL 10 +#define N_IRDA 11 +#define N_SMSBLOCK 12 +#define N_HDLC 13 +#define N_SYNC_PPP 14 +#define N_HCI 15 + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 + +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D + +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX SIOCGIFINDEX +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 + +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 + +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 + +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 + +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 + +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 + +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 + +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/ipc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/ipc.h new file mode 100644 index 0000000..c66f9ed --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/ipc.h
@@ -0,0 +1,13 @@ +struct ipc_perm { + key_t __ipc_perm_key; + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; + int __ipc_perm_seq; + long __pad1; + long __pad2; +}; + +#define IPC_64 0
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/reg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/reg.h new file mode 100644 index 0000000..12d43c5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/reg.h
@@ -0,0 +1,29 @@ +#undef __WORDSIZE +#define __WORDSIZE 64 +#define R15 0 +#define R14 1 +#define R13 2 +#define R12 3 +#define RBP 4 +#define RBX 5 +#define R11 6 +#define R10 7 +#define R9 8 +#define R8 9 +#define RAX 10 +#define RCX 11 +#define RDX 12 +#define RSI 13 +#define RDI 14 +#define ORIG_RAX 15 +#define RIP 16 +#define CS 17 +#define EFLAGS 18 +#define RSP 19 +#define SS 20 +#define FS_BASE 21 +#define GS_BASE 22 +#define DS 23 +#define ES 24 +#define FS 25 +#define GS 26
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/setjmp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/setjmp.h new file mode 100644 index 0000000..29336e4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/setjmp.h
@@ -0,0 +1 @@ +typedef unsigned long long int __jmp_buf[9];
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/signal.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/signal.h new file mode 100644 index 0000000..26095e9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/signal.h
@@ -0,0 +1,129 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +#endif + +#ifdef _GNU_SOURCE +#define REG_R8 0 +#define REG_R9 1 +#define REG_R10 2 +#define REG_R11 3 +#define REG_R12 4 +#define REG_R13 5 +#define REG_R14 6 +#define REG_R15 7 +#define REG_RDI 8 +#define REG_RSI 9 +#define REG_RBP 10 +#define REG_RBX 11 +#define REG_RDX 12 +#define REG_RAX 13 +#define REG_RCX 14 +#define REG_RSP 15 +#define REG_RIP 16 +#define REG_EFL 17 +#define REG_CSGSFS 18 +#define REG_ERR 19 +#define REG_TRAPNO 20 +#define REG_OLDMASK 21 +#define REG_CR2 22 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef long long greg_t, gregset_t[23]; +typedef struct _fpstate { + unsigned short cwd, swd, ftw, fop; + unsigned long long rip, rdp; + unsigned mxcsr, mxcr_mask; + struct { + unsigned short significand[4], exponent, padding[3]; + } _st[8]; + struct { + unsigned element[4]; + } _xmm[16]; + unsigned padding[24]; +} * fpregset_t; +struct sigcontext { + unsigned long r8, r9, r10, r11, r12, r13, r14, r15; + unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags; + unsigned short cs, gs, fs, __pad0; + unsigned long err, trapno, oldmask, cr2; + struct _fpstate* fpstate; + unsigned long __reserved1[8]; +}; +typedef struct { + gregset_t gregs; + fpregset_t fpregs; + unsigned long long __reserved1[8]; +} mcontext_t; +#else +typedef struct { + unsigned long __space[32]; +} mcontext_t; +#endif + +struct sigaltstack { + void* ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct __ucontext* uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + unsigned long __fpregs_mem[64]; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/stat.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/stat.h new file mode 100644 index 0000000..9533ce5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/bits/x86_64/stat.h
@@ -0,0 +1,22 @@ +/* copied from kernel definition, but with padding replaced + * by the corresponding correctly-sized userspace types. */ + +struct stat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + unsigned int __pad0; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __unused1[3]; +};
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/byteswap.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/byteswap.h new file mode 100644 index 0000000..54d1c36 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/byteswap.h
@@ -0,0 +1,21 @@ +#ifndef SYSROOT_BYTESWAP_H_ +#define SYSROOT_BYTESWAP_H_ + +#include <features.h> +#include <stdint.h> + +static __inline uint16_t __bswap_16(uint16_t __x) { return (uint16_t)(__x << 8 | __x >> 8); } + +static __inline uint32_t __bswap_32(uint32_t __x) { + return __x >> 24 | ((__x >> 8) & 0xff00) | ((__x << 8) & 0xff0000) | __x << 24; +} + +static __inline uint64_t __bswap_64(uint64_t __x) { + return ((uint64_t)__bswap_32((uint32_t)__x)) << 32 | __bswap_32((uint32_t)(__x >> 32)); +} + +#define bswap_16(x) __bswap_16(x) +#define bswap_32(x) __bswap_32(x) +#define bswap_64(x) __bswap_64(x) + +#endif // SYSROOT_BYTESWAP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/complex.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/complex.h new file mode 100644 index 0000000..c4bb294 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/complex.h
@@ -0,0 +1,138 @@ +#ifndef SYSROOT_COMPLEX_H_ +#define SYSROOT_COMPLEX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define complex _Complex +#ifdef __GNUC__ +#define _Complex_I (__extension__(0.0f + 1.0fj)) +#else +#define _Complex_I (0.0f + 1.0fj) +#endif +#define I _Complex_I + +double complex cacos(double complex); +float complex cacosf(float complex); +long double complex cacosl(long double complex); + +double complex casin(double complex); +float complex casinf(float complex); +long double complex casinl(long double complex); + +double complex catan(double complex); +float complex catanf(float complex); +long double complex catanl(long double complex); + +double complex ccos(double complex); +float complex ccosf(float complex); +long double complex ccosl(long double complex); + +double complex csin(double complex); +float complex csinf(float complex); +long double complex csinl(long double complex); + +double complex ctan(double complex); +float complex ctanf(float complex); +long double complex ctanl(long double complex); + +double complex cacosh(double complex); +float complex cacoshf(float complex); +long double complex cacoshl(long double complex); + +double complex casinh(double complex); +float complex casinhf(float complex); +long double complex casinhl(long double complex); + +double complex catanh(double complex); +float complex catanhf(float complex); +long double complex catanhl(long double complex); + +double complex ccosh(double complex); +float complex ccoshf(float complex); +long double complex ccoshl(long double complex); + +double complex csinh(double complex); +float complex csinhf(float complex); +long double complex csinhl(long double complex); + +double complex ctanh(double complex); +float complex ctanhf(float complex); +long double complex ctanhl(long double complex); + +double complex cexp(double complex); +float complex cexpf(float complex); +long double complex cexpl(long double complex); + +double complex clog(double complex); +float complex clogf(float complex); +long double complex clogl(long double complex); + +double cabs(double complex); +float cabsf(float complex); +long double cabsl(long double complex); + +double complex cpow(double complex, double complex); +float complex cpowf(float complex, float complex); +long double complex cpowl(long double complex, long double complex); + +double complex csqrt(double complex); +float complex csqrtf(float complex); +long double complex csqrtl(long double complex); + +double carg(double complex); +float cargf(float complex); +long double cargl(long double complex); + +double cimag(double complex); +float cimagf(float complex); +long double cimagl(long double complex); + +double complex conj(double complex); +float complex conjf(float complex); +long double complex conjl(long double complex); + +double complex cproj(double complex); +float complex cprojf(float complex); +long double complex cprojl(long double complex); + +double creal(double complex); +float crealf(float complex); +long double creall(long double complex); + +#ifndef __cplusplus +#define __CIMAG(x, t) \ + (+(union { \ + _Complex t __z; \ + t __xy[2]; \ + }){(_Complex t)(x)} \ + .__xy[1]) + +#define creal(x) ((double)(x)) +#define crealf(x) ((float)(x)) +#define creall(x) ((long double)(x)) + +#define cimag(x) __CIMAG(x, double) +#define cimagf(x) __CIMAG(x, float) +#define cimagl(x) __CIMAG(x, long double) +#endif + +#if __STDC_VERSION__ >= 201112L +#if defined(_Imaginary_I) +#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I * (t)(y)) +#elif defined(__clang__) +#define __CMPLX(x, y, t) (+(_Complex t){(t)(x), (t)(y)}) +#else +#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y))) +#endif +#define CMPLX(x, y) __CMPLX(x, y, double) +#define CMPLXF(x, y) __CMPLX(x, y, float) +#define CMPLXL(x, y) __CMPLX(x, y, long double) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_COMPLEX_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/cpio.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/cpio.h new file mode 100644 index 0000000..21d069e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/cpio.h
@@ -0,0 +1,29 @@ +#ifndef SYSROOT_CPIO_H_ +#define SYSROOT_CPIO_H_ + +#define MAGIC "070707" + +#define C_IRUSR 000400 +#define C_IWUSR 000200 +#define C_IXUSR 000100 +#define C_IRGRP 000040 +#define C_IWGRP 000020 +#define C_IXGRP 000010 +#define C_IROTH 000004 +#define C_IWOTH 000002 +#define C_IXOTH 000001 + +#define C_ISUID 004000 +#define C_ISGID 002000 +#define C_ISVTX 001000 + +#define C_ISBLK 060000 +#define C_ISCHR 020000 +#define C_ISDIR 040000 +#define C_ISFIFO 010000 +#define C_ISSOCK 0140000 +#define C_ISLNK 0120000 +#define C_ISCTG 0110000 +#define C_ISREG 0100000 + +#endif // SYSROOT_CPIO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/ctype.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ctype.h new file mode 100644 index 0000000..12be80d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ctype.h
@@ -0,0 +1,52 @@ +#ifndef SYSROOT_CTYPE_H_ +#define SYSROOT_CTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +int isalnum(int); +int isalpha(int); +int isblank(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); +int tolower(int); +int toupper(int); + +#ifndef __cplusplus +static __inline int __isspace(int _c) { return _c == ' ' || (unsigned)_c - '\t' < 5; } + +#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a) | 32) - 'a') < 26) +#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a) - '0') < 10) +#define islower(a) (0 ? islower(a) : ((unsigned)(a) - 'a') < 26) +#define isupper(a) (0 ? isupper(a) : ((unsigned)(a) - 'A') < 26) +#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f) +#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e) +#define isspace(a) __isspace(a) +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +int isascii(int); +int toascii(int); +#define _tolower(a) ((a) | 0x20) +#define _toupper(a) ((a)&0x5f) +#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_CTYPE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/dirent.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/dirent.h new file mode 100644 index 0000000..4542825 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/dirent.h
@@ -0,0 +1,67 @@ +#ifndef SYSROOT_DIRENT_H_ +#define SYSROOT_DIRENT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_ino_t +#define __NEED_off_t +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define __NEED_size_t +#endif + +#include <bits/alltypes.h> + +typedef struct __dirstream DIR; + +struct dirent { + ino_t d_ino; + off_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; + +#define d_fileno d_ino + +int closedir(DIR*); +DIR* fdopendir(int); +DIR* opendir(const char*); +struct dirent* readdir(DIR*); +int readdir_r(DIR* __restrict, struct dirent* __restrict, struct dirent** __restrict); +void rewinddir(DIR*); +void seekdir(DIR*, long); +long telldir(DIR*); +int dirfd(DIR*); + +int alphasort(const struct dirent**, const struct dirent**); +int scandir(const char*, struct dirent***, int (*)(const struct dirent*), + int (*)(const struct dirent**, const struct dirent**)); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#define IFTODT(x) ((x) >> 12 & 017) +#define DTTOIF(x) ((x) << 12) +int getdents(int, struct dirent*, size_t); +#endif + +#ifdef _GNU_SOURCE +int versionsort(const struct dirent**, const struct dirent**); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_DIRENT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/dlfcn.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/dlfcn.h new file mode 100644 index 0000000..ff069c9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/dlfcn.h
@@ -0,0 +1,42 @@ +#ifndef SYSROOT_DLFCN_H_ +#define SYSROOT_DLFCN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define RTLD_LAZY 1 +#define RTLD_NOW 2 +#define RTLD_NOLOAD 4 +#define RTLD_NODELETE 4096 +#define RTLD_GLOBAL 256 +#define RTLD_LOCAL 0 + +#define RTLD_NEXT ((void*)-1) +#define RTLD_DEFAULT ((void*)0) + +#define RTLD_DI_LINKMAP 2 + +int dlclose(void*); +char* dlerror(void); +void* dlopen(const char*, int); +void* dlsym(void* __restrict, const char* __restrict); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef struct { + const char* dli_fname; + void* dli_fbase; + const char* dli_sname; + void* dli_saddr; +} Dl_info; +int dladdr(const void*, Dl_info*); +int dlinfo(void*, int, void*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_DLFCN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/elf.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/elf.h new file mode 100644 index 0000000..88a35f0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/elf.h
@@ -0,0 +1,2585 @@ +#ifndef SYSROOT_ELF_H_ +#define SYSROOT_ELF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; + +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; + +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; + +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; + +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; + +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + +#define EI_NIDENT (16) + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +#define EI_MAG0 0 +#define ELFMAG0 0x7f + +#define EI_MAG1 1 +#define ELFMAG1 'E' + +#define EI_MAG2 2 +#define ELFMAG2 'L' + +#define EI_MAG3 3 +#define ELFMAG3 'F' + +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 +#define ELFCLASSNONE 0 +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define EI_DATA 5 +#define ELFDATANONE 0 +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 +#define ELFDATANUM 3 + +#define EI_VERSION 6 + +#define EI_OSABI 7 +#define ELFOSABI_NONE 0 +#define ELFOSABI_SYSV 0 +#define ELFOSABI_HPUX 1 +#define ELFOSABI_NETBSD 2 +#define ELFOSABI_LINUX 3 +#define ELFOSABI_GNU 3 +#define ELFOSABI_SOLARIS 6 +#define ELFOSABI_AIX 7 +#define ELFOSABI_IRIX 8 +#define ELFOSABI_FREEBSD 9 +#define ELFOSABI_TRU64 10 +#define ELFOSABI_MODESTO 11 +#define ELFOSABI_OPENBSD 12 +#define ELFOSABI_ARM 97 +#define ELFOSABI_STANDALONE 255 + +#define EI_ABIVERSION 8 + +#define EI_PAD 9 + +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_NUM 5 +#define ET_LOOS 0xfe00 +#define ET_HIOS 0xfeff +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_860 7 +#define EM_MIPS 8 +#define EM_S370 9 +#define EM_MIPS_RS3_LE 10 + +#define EM_PARISC 15 +#define EM_VPP500 17 +#define EM_SPARC32PLUS 18 +#define EM_960 19 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 + +#define EM_V800 36 +#define EM_FR20 37 +#define EM_RH32 38 +#define EM_RCE 39 +#define EM_ARM 40 +#define EM_FAKE_ALPHA 41 +#define EM_SH 42 +#define EM_SPARCV9 43 +#define EM_TRICORE 44 +#define EM_ARC 45 +#define EM_H8_300 46 +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_H8_500 49 +#define EM_IA_64 50 +#define EM_MIPS_X 51 +#define EM_COLDFIRE 52 +#define EM_68HC12 53 +#define EM_MMA 54 +#define EM_PCP 55 +#define EM_NCPU 56 +#define EM_NDR1 57 +#define EM_STARCORE 58 +#define EM_ME16 59 +#define EM_ST100 60 +#define EM_TINYJ 61 +#define EM_X86_64 62 +#define EM_PDSP 63 + +#define EM_FX66 66 +#define EM_ST9PLUS 67 +#define EM_ST7 68 +#define EM_68HC16 69 +#define EM_68HC11 70 +#define EM_68HC08 71 +#define EM_68HC05 72 +#define EM_SVX 73 +#define EM_ST19 74 +#define EM_VAX 75 +#define EM_CRIS 76 +#define EM_JAVELIN 77 +#define EM_FIREPATH 78 +#define EM_ZSP 79 +#define EM_MMIX 80 +#define EM_HUANY 81 +#define EM_PRISM 82 +#define EM_AVR 83 +#define EM_FR30 84 +#define EM_D10V 85 +#define EM_D30V 86 +#define EM_V850 87 +#define EM_M32R 88 +#define EM_MN10300 89 +#define EM_MN10200 90 +#define EM_PJ 91 +#define EM_OR1K 92 +#define EM_ARC_A5 93 +#define EM_XTENSA 94 +#define EM_AARCH64 183 +#define EM_TILEPRO 188 +#define EM_MICROBLAZE 189 +#define EM_TILEGX 191 +#define EM_NUM 192 +#define EM_ALPHA 0x9026 + +#define EV_NONE 0 +#define EV_CURRENT 1 +#define EV_NUM 2 + +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +typedef struct { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_BEFORE 0xff00 + +#define SHN_AFTER 0xff01 + +#define SHN_HIPROC 0xff1f +#define SHN_LOOS 0xff20 +#define SHN_HIOS 0xff3f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_XINDEX 0xffff +#define SHN_HIRESERVE 0xffff + +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_INIT_ARRAY 14 +#define SHT_FINI_ARRAY 15 +#define SHT_PREINIT_ARRAY 16 +#define SHT_GROUP 17 +#define SHT_SYMTAB_SHNDX 18 +#define SHT_NUM 19 +#define SHT_LOOS 0x60000000 +#define SHT_GNU_ATTRIBUTES 0x6ffffff5 +#define SHT_GNU_HASH 0x6ffffff6 +#define SHT_GNU_LIBLIST 0x6ffffff7 +#define SHT_CHECKSUM 0x6ffffff8 +#define SHT_LOSUNW 0x6ffffffa +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd +#define SHT_GNU_verneed 0x6ffffffe +#define SHT_GNU_versym 0x6fffffff +#define SHT_HISUNW 0x6fffffff +#define SHT_HIOS 0x6fffffff +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0x8fffffff + +#define SHF_WRITE (1 << 0) +#define SHF_ALLOC (1 << 1) +#define SHF_EXECINSTR (1 << 2) +#define SHF_MERGE (1 << 4) +#define SHF_STRINGS (1 << 5) +#define SHF_INFO_LINK (1 << 6) +#define SHF_LINK_ORDER (1 << 7) +#define SHF_OS_NONCONFORMING (1 << 8) + +#define SHF_GROUP (1 << 9) +#define SHF_TLS (1 << 10) +#define SHF_MASKOS 0x0ff00000 +#define SHF_MASKPROC 0xf0000000 +#define SHF_ORDERED (1 << 30) +#define SHF_EXCLUDE (1U << 31) + +#define GRP_COMDAT 0x1 + +typedef struct { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Section st_shndx; +} Elf32_Sym; + +typedef struct { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Section st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; + +typedef struct { + Elf32_Half si_boundto; + Elf32_Half si_flags; +} Elf32_Syminfo; + +typedef struct { + Elf64_Half si_boundto; + Elf64_Half si_flags; +} Elf64_Syminfo; + +#define SYMINFO_BT_SELF 0xffff +#define SYMINFO_BT_PARENT 0xfffe +#define SYMINFO_BT_LOWRESERVE 0xff00 + +#define SYMINFO_FLG_DIRECT 0x0001 +#define SYMINFO_FLG_PASSTHRU 0x0002 +#define SYMINFO_FLG_COPY 0x0004 +#define SYMINFO_FLG_LAZYLOAD 0x0008 + +#define SYMINFO_NONE 0 +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + +#define ELF32_ST_BIND(val) (((unsigned char)(val)) >> 4) +#define ELF32_ST_TYPE(val) ((val)&0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type)&0xf)) + +#define ELF64_ST_BIND(val) ELF32_ST_BIND(val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE(val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO((bind), (type)) + +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_NUM 3 +#define STB_LOOS 10 +#define STB_GNU_UNIQUE 10 +#define STB_HIOS 12 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 +#define STT_NUM 7 +#define STT_LOOS 10 +#define STT_GNU_IFUNC 10 +#define STT_HIOS 12 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + +#define STN_UNDEF 0 + +#define ELF32_ST_VISIBILITY(o) ((o)&0x03) +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY(o) + +#define STV_DEFAULT 0 +#define STV_INTERNAL 1 +#define STV_HIDDEN 2 +#define STV_PROTECTED 3 + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; +} Elf64_Rel; + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +} Elf64_Rela; + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val)&0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type)&0xff)) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i)&0xffffffff) +#define ELF64_R_INFO(sym, type) ((((Elf64_Xword)(sym)) << 32) + (type)) + +typedef struct { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 +#define PT_NUM 8 +#define PT_LOOS 0x60000000 +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa +#define PT_SUNWSTACK 0x6ffffffb +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff + +#define PN_XNUM 0xffff + +#define PF_X (1 << 0) +#define PF_W (1 << 1) +#define PF_R (1 << 2) +#define PF_MASKOS 0x0ff00000 +#define PF_MASKPROC 0xf0000000 + +#define NT_PRSTATUS 1 +#define NT_FPREGSET 2 +#define NT_PRPSINFO 3 +#define NT_PRXREG 4 +#define NT_TASKSTRUCT 4 +#define NT_PLATFORM 5 +#define NT_AUXV 6 +#define NT_GWINDOWS 7 +#define NT_ASRS 8 +#define NT_PSTATUS 10 +#define NT_PSINFO 13 +#define NT_PRCRED 14 +#define NT_UTSNAME 15 +#define NT_LWPSTATUS 16 +#define NT_LWPSINFO 17 +#define NT_PRFPXREG 20 +#define NT_SIGINFO 0x53494749 +#define NT_FILE 0x46494c45 +#define NT_PRXFPREG 0x46e62b7f +#define NT_PPC_VMX 0x100 +#define NT_PPC_SPE 0x101 +#define NT_PPC_VSX 0x102 +#define NT_386_TLS 0x200 +#define NT_386_IOPERM 0x201 +#define NT_X86_XSTATE 0x202 +#define NT_S390_HIGH_GPRS 0x300 +#define NT_S390_TIMER 0x301 +#define NT_S390_TODCMP 0x302 +#define NT_S390_TODPREG 0x303 +#define NT_S390_CTRS 0x304 +#define NT_S390_PREFIX 0x305 +#define NT_S390_LAST_BREAK 0x306 +#define NT_S390_SYSTEM_CALL 0x307 +#define NT_S390_TDB 0x308 +#define NT_ARM_VFP 0x400 +#define NT_ARM_TLS 0x401 +#define NT_ARM_HW_BREAK 0x402 +#define NT_ARM_HW_WATCH 0x403 +#define NT_METAG_CBUF 0x500 +#define NT_METAG_RPIPE 0x501 +#define NT_METAG_TLS 0x502 +#define NT_VERSION 1 + +typedef struct { + Elf32_Sword d_tag; + union { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Sxword d_tag; + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_BIND_NOW 24 +#define DT_INIT_ARRAY 25 +#define DT_FINI_ARRAY 26 +#define DT_INIT_ARRAYSZ 27 +#define DT_FINI_ARRAYSZ 28 +#define DT_RUNPATH 29 +#define DT_FLAGS 30 +#define DT_ENCODING 32 +#define DT_PREINIT_ARRAY 32 +#define DT_PREINIT_ARRAYSZ 33 +#define DT_RELRSZ 35 +#define DT_RELR 36 +#define DT_RELRENT 37 +#define DT_NUM 38 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff +#define DT_PROCNUM DT_MIPS_NUM + +#define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 +#define DT_CHECKSUM 0x6ffffdf8 +#define DT_PLTPADSZ 0x6ffffdf9 +#define DT_MOVEENT 0x6ffffdfa +#define DT_MOVESZ 0x6ffffdfb +#define DT_FEATURE_1 0x6ffffdfc +#define DT_POSFLAG_1 0x6ffffdfd + +#define DT_SYMINSZ 0x6ffffdfe +#define DT_SYMINENT 0x6ffffdff +#define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) +#define DT_VALNUM 12 + +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 +#define DT_TLSDESC_PLT 0x6ffffef6 +#define DT_TLSDESC_GOT 0x6ffffef7 +#define DT_GNU_CONFLICT 0x6ffffef8 +#define DT_GNU_LIBLIST 0x6ffffef9 +#define DT_CONFIG 0x6ffffefa +#define DT_DEPAUDIT 0x6ffffefb +#define DT_AUDIT 0x6ffffefc +#define DT_PLTPAD 0x6ffffefd +#define DT_MOVETAB 0x6ffffefe +#define DT_SYMINFO 0x6ffffeff +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) +#define DT_ADDRNUM 11 + +#define DT_VERSYM 0x6ffffff0 + +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa + +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc + +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe + +#define DT_VERNEEDNUM 0x6fffffff +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) +#define DT_VERSIONTAGNUM 16 + +#define DT_AUXILIARY 0x7ffffffd +#define DT_FILTER 0x7fffffff +#define DT_EXTRATAGIDX(tag) ((Elf32_Word) - ((Elf32_Sword)(tag) << 1 >> 1) - 1) +#define DT_EXTRANUM 3 + +#define DF_ORIGIN 0x00000001 +#define DF_SYMBOLIC 0x00000002 +#define DF_TEXTREL 0x00000004 +#define DF_BIND_NOW 0x00000008 +#define DF_STATIC_TLS 0x00000010 + +#define DF_1_NOW 0x00000001 +#define DF_1_GLOBAL 0x00000002 +#define DF_1_GROUP 0x00000004 +#define DF_1_NODELETE 0x00000008 +#define DF_1_LOADFLTR 0x00000010 +#define DF_1_INITFIRST 0x00000020 +#define DF_1_NOOPEN 0x00000040 +#define DF_1_ORIGIN 0x00000080 +#define DF_1_DIRECT 0x00000100 +#define DF_1_TRANS 0x00000200 +#define DF_1_INTERPOSE 0x00000400 +#define DF_1_NODEFLIB 0x00000800 +#define DF_1_NODUMP 0x00001000 +#define DF_1_CONFALT 0x00002000 +#define DF_1_ENDFILTEE 0x00004000 +#define DF_1_DISPRELDNE 0x00008000 +#define DF_1_DISPRELPND 0x00010000 +#define DF_1_NODIRECT 0x00020000 +#define DF_1_IGNMULDEF 0x00040000 +#define DF_1_NOKSYMS 0x00080000 +#define DF_1_NOHDR 0x00100000 +#define DF_1_EDITED 0x00200000 +#define DF_1_NORELOC 0x00400000 +#define DF_1_SYMINTPOSE 0x00800000 +#define DF_1_GLOBAUDIT 0x01000000 +#define DF_1_SINGLETON 0x02000000 + +#define DTF_1_PARINIT 0x00000001 +#define DTF_1_CONFEXP 0x00000002 + +#define DF_P1_LAZYLOAD 0x00000001 +#define DF_P1_GROUPPERM 0x00000002 + +typedef struct { + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + +#define VER_DEF_NONE 0 +#define VER_DEF_CURRENT 1 +#define VER_DEF_NUM 2 + +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 +#define VER_NDX_LORESERVE 0xff00 +#define VER_NDX_ELIMINATE 0xff01 + +typedef struct { + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + +typedef struct { + Elf32_Half vn_version; + Elf32_Half vn_cnt; + Elf32_Word vn_file; + Elf32_Word vn_aux; + Elf32_Word vn_next; +} Elf32_Verneed; + +typedef struct { + Elf64_Half vn_version; + Elf64_Half vn_cnt; + Elf64_Word vn_file; + Elf64_Word vn_aux; + Elf64_Word vn_next; +} Elf64_Verneed; + +#define VER_NEED_NONE 0 +#define VER_NEED_CURRENT 1 +#define VER_NEED_NUM 2 + +typedef struct { + Elf32_Word vna_hash; + Elf32_Half vna_flags; + Elf32_Half vna_other; + Elf32_Word vna_name; + Elf32_Word vna_next; +} Elf32_Vernaux; + +typedef struct { + Elf64_Word vna_hash; + Elf64_Half vna_flags; + Elf64_Half vna_other; + Elf64_Word vna_name; + Elf64_Word vna_next; +} Elf64_Vernaux; + +#define VER_FLG_WEAK 0x2 + +typedef struct { + uint32_t a_type; + union { + uint32_t a_val; + } a_un; +} Elf32_auxv_t; + +typedef struct { + uint64_t a_type; + union { + uint64_t a_val; + } a_un; +} Elf64_auxv_t; + +#define AT_NULL 0 +#define AT_IGNORE 1 +#define AT_EXECFD 2 +#define AT_PHDR 3 +#define AT_PHENT 4 +#define AT_PHNUM 5 +#define AT_PAGESZ 6 +#define AT_BASE 7 +#define AT_FLAGS 8 +#define AT_ENTRY 9 +#define AT_NOTELF 10 +#define AT_UID 11 +#define AT_EUID 12 +#define AT_GID 13 +#define AT_EGID 14 +#define AT_CLKTCK 17 + +#define AT_PLATFORM 15 +#define AT_HWCAP 16 + +#define AT_FPUCW 18 + +#define AT_DCACHEBSIZE 19 +#define AT_ICACHEBSIZE 20 +#define AT_UCACHEBSIZE 21 + +#define AT_IGNOREPPC 22 + +#define AT_SECURE 23 + +#define AT_BASE_PLATFORM 24 + +#define AT_RANDOM 25 + +#define AT_HWCAP2 26 + +#define AT_EXECFN 31 + +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 + +typedef struct { + Elf32_Word n_namesz; + Elf32_Word n_descsz; + Elf32_Word n_type; +} Elf32_Nhdr; + +typedef struct { + Elf64_Word n_namesz; + Elf64_Word n_descsz; + Elf64_Word n_type; +} Elf64_Nhdr; + +#define ELF_NOTE_SOLARIS "SUNW Solaris" + +#define ELF_NOTE_GNU "GNU" + +#define ELF_NOTE_PAGESIZE_HINT 1 + +#define NT_GNU_ABI_TAG 1 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG + +#define ELF_NOTE_OS_LINUX 0 +#define ELF_NOTE_OS_GNU 1 +#define ELF_NOTE_OS_SOLARIS2 2 +#define ELF_NOTE_OS_FREEBSD 3 + +#define NT_GNU_BUILD_ID 3 +#define NT_GNU_GOLD_VERSION 4 + +typedef struct { + Elf32_Xword m_value; + Elf32_Word m_info; + Elf32_Word m_poffset; + Elf32_Half m_repeat; + Elf32_Half m_stride; +} Elf32_Move; + +typedef struct { + Elf64_Xword m_value; + Elf64_Xword m_info; + Elf64_Xword m_poffset; + Elf64_Half m_repeat; + Elf64_Half m_stride; +} Elf64_Move; + +#define ELF32_M_SYM(info) ((info) >> 8) +#define ELF32_M_SIZE(info) ((unsigned char)(info)) +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) + +#define ELF64_M_SYM(info) ELF32_M_SYM(info) +#define ELF64_M_SIZE(info) ELF32_M_SIZE(info) +#define ELF64_M_INFO(sym, size) ELF32_M_INFO(sym, size) + +#define EF_CPU32 0x00810000 + +#define R_68K_NONE 0 +#define R_68K_32 1 +#define R_68K_16 2 +#define R_68K_8 3 +#define R_68K_PC32 4 +#define R_68K_PC16 5 +#define R_68K_PC8 6 +#define R_68K_GOT32 7 +#define R_68K_GOT16 8 +#define R_68K_GOT8 9 +#define R_68K_GOT32O 10 +#define R_68K_GOT16O 11 +#define R_68K_GOT8O 12 +#define R_68K_PLT32 13 +#define R_68K_PLT16 14 +#define R_68K_PLT8 15 +#define R_68K_PLT32O 16 +#define R_68K_PLT16O 17 +#define R_68K_PLT8O 18 +#define R_68K_COPY 19 +#define R_68K_GLOB_DAT 20 +#define R_68K_JMP_SLOT 21 +#define R_68K_RELATIVE 22 +#define R_68K_NUM 23 + +#define R_386_NONE 0 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_386_GOT32 3 +#define R_386_PLT32 4 +#define R_386_COPY 5 +#define R_386_GLOB_DAT 6 +#define R_386_JMP_SLOT 7 +#define R_386_RELATIVE 8 +#define R_386_GOTOFF 9 +#define R_386_GOTPC 10 +#define R_386_32PLT 11 +#define R_386_TLS_TPOFF 14 +#define R_386_TLS_IE 15 +#define R_386_TLS_GOTIE 16 +#define R_386_TLS_LE 17 +#define R_386_TLS_GD 18 +#define R_386_TLS_LDM 19 +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_TLS_GD_32 24 +#define R_386_TLS_GD_PUSH 25 +#define R_386_TLS_GD_CALL 26 +#define R_386_TLS_GD_POP 27 +#define R_386_TLS_LDM_32 28 +#define R_386_TLS_LDM_PUSH 29 +#define R_386_TLS_LDM_CALL 30 +#define R_386_TLS_LDM_POP 31 +#define R_386_TLS_LDO_32 32 +#define R_386_TLS_IE_32 33 +#define R_386_TLS_LE_32 34 +#define R_386_TLS_DTPMOD32 35 +#define R_386_TLS_DTPOFF32 36 +#define R_386_TLS_TPOFF32 37 +#define R_386_SIZE32 38 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 +#define R_386_IRELATIVE 42 +#define R_386_NUM 43 + +#define STT_SPARC_REGISTER 13 + +#define EF_SPARCV9_MM 3 +#define EF_SPARCV9_TSO 0 +#define EF_SPARCV9_PSO 1 +#define EF_SPARCV9_RMO 2 +#define EF_SPARC_LEDATA 0x800000 +#define EF_SPARC_EXT_MASK 0xFFFF00 +#define EF_SPARC_32PLUS 0x000100 +#define EF_SPARC_SUN_US1 0x000200 +#define EF_SPARC_HAL_R1 0x000400 +#define EF_SPARC_SUN_US3 0x000800 + +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 + +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 +#define R_SPARC_GOTDATA_HIX22 80 +#define R_SPARC_GOTDATA_LOX10 81 +#define R_SPARC_GOTDATA_OP_HIX22 82 +#define R_SPARC_GOTDATA_OP_LOX10 83 +#define R_SPARC_GOTDATA_OP 84 +#define R_SPARC_H34 85 +#define R_SPARC_SIZE32 86 +#define R_SPARC_SIZE64 87 +#define R_SPARC_GNU_VTINHERIT 250 +#define R_SPARC_GNU_VTENTRY 251 +#define R_SPARC_REV32 252 + +#define R_SPARC_NUM 253 + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM 2 + +#define EF_MIPS_NOREORDER 1 +#define EF_MIPS_PIC 2 +#define EF_MIPS_CPIC 4 +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_NAN2008 1024 +#define EF_MIPS_ARCH 0xf0000000 + +#define EF_MIPS_ARCH_1 0x00000000 +#define EF_MIPS_ARCH_2 0x10000000 +#define EF_MIPS_ARCH_3 0x20000000 +#define EF_MIPS_ARCH_4 0x30000000 +#define EF_MIPS_ARCH_5 0x40000000 +#define EF_MIPS_ARCH_32 0x50000000 +#define EF_MIPS_ARCH_64 0x60000000 +#define EF_MIPS_ARCH_32R2 0x70000000 +#define EF_MIPS_ARCH_64R2 0x80000000 + +#define E_MIPS_ARCH_1 0x00000000 +#define E_MIPS_ARCH_2 0x10000000 +#define E_MIPS_ARCH_3 0x20000000 +#define E_MIPS_ARCH_4 0x30000000 +#define E_MIPS_ARCH_5 0x40000000 +#define E_MIPS_ARCH_32 0x50000000 +#define E_MIPS_ARCH_64 0x60000000 + +#define SHN_MIPS_ACOMMON 0xff00 +#define SHN_MIPS_TEXT 0xff01 +#define SHN_MIPS_DATA 0xff02 +#define SHN_MIPS_SCOMMON 0xff03 +#define SHN_MIPS_SUNDEFINED 0xff04 + +#define SHT_MIPS_LIBLIST 0x70000000 +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 +#define SHT_MIPS_GPTAB 0x70000003 +#define SHT_MIPS_UCODE 0x70000004 +#define SHT_MIPS_DEBUG 0x70000005 +#define SHT_MIPS_REGINFO 0x70000006 +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + +#define SHF_MIPS_GPREL 0x10000000 +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + +#define STB_MIPS_SPLIT_COMMON 13 + +typedef union { + struct { + Elf32_Word gt_current_g_value; + Elf32_Word gt_unused; + } gt_header; + struct { + Elf32_Word gt_g_value; + Elf32_Word gt_bytes; + } gt_entry; +} Elf32_gptab; + +typedef struct { + Elf32_Word ri_gprmask; + Elf32_Word ri_cprmask[4]; + Elf32_Sword ri_gp_value; +} Elf32_RegInfo; + +typedef struct { + unsigned char kind; + + unsigned char size; + Elf32_Section section; + + Elf32_Word info; +} Elf_Options; + +#define ODK_NULL 0 +#define ODK_REGINFO 1 +#define ODK_EXCEPTIONS 2 +#define ODK_PAD 3 +#define ODK_HWPATCH 4 +#define ODK_FILL 5 +#define ODK_TAGS 6 +#define ODK_HWAND 7 +#define ODK_HWOR 8 + +#define OEX_FPU_MIN 0x1f +#define OEX_FPU_MAX 0x1f00 +#define OEX_PAGE0 0x10000 +#define OEX_SMM 0x20000 +#define OEX_FPDBUG 0x40000 +#define OEX_PRECISEFP OEX_FPDBUG +#define OEX_DISMISS 0x80000 + +#define OEX_FPU_INVAL 0x10 +#define OEX_FPU_DIV0 0x08 +#define OEX_FPU_OFLO 0x04 +#define OEX_FPU_UFLO 0x02 +#define OEX_FPU_INEX 0x01 + +#define OHW_R4KEOP 0x1 +#define OHW_R8KPFETCH 0x2 +#define OHW_R5KEOP 0x4 +#define OHW_R5KCVTL 0x8 + +#define OPAD_PREFIX 0x1 +#define OPAD_POSTFIX 0x2 +#define OPAD_SYMBOL 0x4 + +typedef struct { + Elf32_Word hwp_flags1; + Elf32_Word hwp_flags2; +} Elf_Options_Hw; + +#define OHWA0_R4KEOP_CHECKED 0x00000001 +#define OHWA1_R4KEOP_CLEAN 0x00000002 + +#define R_MIPS_NONE 0 +#define R_MIPS_16 1 +#define R_MIPS_32 2 +#define R_MIPS_REL32 3 +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_GPREL16 7 +#define R_MIPS_LITERAL 8 +#define R_MIPS_GOT16 9 +#define R_MIPS_PC16 10 +#define R_MIPS_CALL16 11 +#define R_MIPS_GPREL32 12 + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 +#define R_MIPS_TLS_DTPREL32 39 +#define R_MIPS_TLS_DTPMOD64 40 +#define R_MIPS_TLS_DTPREL64 41 +#define R_MIPS_TLS_GD 42 +#define R_MIPS_TLS_LDM 43 +#define R_MIPS_TLS_DTPREL_HI16 44 +#define R_MIPS_TLS_DTPREL_LO16 45 +#define R_MIPS_TLS_GOTTPREL 46 +#define R_MIPS_TLS_TPREL32 47 +#define R_MIPS_TLS_TPREL64 48 +#define R_MIPS_TLS_TPREL_HI16 49 +#define R_MIPS_TLS_TPREL_LO16 50 +#define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 + +#define R_MIPS_NUM 128 + +#define PT_MIPS_REGINFO 0x70000000 +#define PT_MIPS_RTPROC 0x70000001 +#define PT_MIPS_OPTIONS 0x70000002 + +#define PF_MIPS_LOCAL 0x10000000 + +#define DT_MIPS_RLD_VERSION 0x70000001 +#define DT_MIPS_TIME_STAMP 0x70000002 +#define DT_MIPS_ICHECKSUM 0x70000003 +#define DT_MIPS_IVERSION 0x70000004 +#define DT_MIPS_FLAGS 0x70000005 +#define DT_MIPS_BASE_ADDRESS 0x70000006 +#define DT_MIPS_MSYM 0x70000007 +#define DT_MIPS_CONFLICT 0x70000008 +#define DT_MIPS_LIBLIST 0x70000009 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a +#define DT_MIPS_CONFLICTNO 0x7000000b +#define DT_MIPS_LIBLISTNO 0x70000010 +#define DT_MIPS_SYMTABNO 0x70000011 +#define DT_MIPS_UNREFEXTNO 0x70000012 +#define DT_MIPS_GOTSYM 0x70000013 +#define DT_MIPS_HIPAGENO 0x70000014 +#define DT_MIPS_RLD_MAP 0x70000016 +#define DT_MIPS_DELTA_CLASS 0x70000017 +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 + +#define DT_MIPS_DELTA_INSTANCE 0x70000019 +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a + +#define DT_MIPS_DELTA_RELOC 0x7000001b +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c + +#define DT_MIPS_DELTA_SYM 0x7000001d + +#define DT_MIPS_DELTA_SYM_NO 0x7000001e + +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 + +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 + +#define DT_MIPS_CXX_FLAGS 0x70000022 +#define DT_MIPS_PIXIE_INIT 0x70000023 +#define DT_MIPS_SYMBOL_LIB 0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS 0x70000029 +#define DT_MIPS_INTERFACE 0x7000002a +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d + +#define DT_MIPS_PERF_SUFFIX 0x7000002e + +#define DT_MIPS_COMPACT_SIZE 0x7000002f +#define DT_MIPS_GP_VALUE 0x70000030 +#define DT_MIPS_AUX_DYNAMIC 0x70000031 + +#define DT_MIPS_PLTGOT 0x70000032 + +#define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_NUM 0x35 + +#define RHF_NONE 0 +#define RHF_QUICKSTART (1 << 0) +#define RHF_NOTPOT (1 << 1) +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) +#define RHF_NO_MOVE (1 << 3) +#define RHF_SGI_ONLY (1 << 4) +#define RHF_GUARANTEE_INIT (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS (1 << 6) +#define RHF_GUARANTEE_START_INIT (1 << 7) +#define RHF_PIXIE (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD (1 << 9) +#define RHF_REQUICKSTART (1 << 10) +#define RHF_REQUICKSTARTED (1 << 11) +#define RHF_CORD (1 << 12) +#define RHF_NO_UNRES_UNDEF (1 << 13) +#define RHF_RLD_ORDER_SAFE (1 << 14) + +typedef struct { + Elf32_Word l_name; + Elf32_Word l_time_stamp; + Elf32_Word l_checksum; + Elf32_Word l_version; + Elf32_Word l_flags; +} Elf32_Lib; + +typedef struct { + Elf64_Word l_name; + Elf64_Word l_time_stamp; + Elf64_Word l_checksum; + Elf64_Word l_version; + Elf64_Word l_flags; +} Elf64_Lib; + +#define LL_NONE 0 +#define LL_EXACT_MATCH (1 << 0) +#define LL_IGNORE_INT_VER (1 << 1) +#define LL_REQUIRE_MINOR (1 << 2) +#define LL_EXPORTS (1 << 3) +#define LL_DELAY_LOAD (1 << 4) +#define LL_DELTA (1 << 5) + +typedef Elf32_Addr Elf32_Conflict; + +#define EF_PARISC_TRAPNIL 0x00010000 +#define EF_PARISC_EXT 0x00020000 +#define EF_PARISC_LSB 0x00040000 +#define EF_PARISC_WIDE 0x00080000 +#define EF_PARISC_NO_KABP 0x00100000 + +#define EF_PARISC_LAZYSWAP 0x00400000 +#define EF_PARISC_ARCH 0x0000ffff + +#define EFA_PARISC_1_0 0x020b +#define EFA_PARISC_1_1 0x0210 +#define EFA_PARISC_2_0 0x0214 + +#define SHN_PARISC_ANSI_COMMON 0xff00 + +#define SHN_PARISC_HUGE_COMMON 0xff01 + +#define SHT_PARISC_EXT 0x70000000 +#define SHT_PARISC_UNWIND 0x70000001 +#define SHT_PARISC_DOC 0x70000002 + +#define SHF_PARISC_SHORT 0x20000000 +#define SHF_PARISC_HUGE 0x40000000 +#define SHF_PARISC_SBP 0x80000000 + +#define STT_PARISC_MILLICODE 13 + +#define STT_HP_OPAQUE (STT_LOOS + 0x1) +#define STT_HP_STUB (STT_LOOS + 0x2) + +#define R_PARISC_NONE 0 +#define R_PARISC_DIR32 1 +#define R_PARISC_DIR21L 2 +#define R_PARISC_DIR17R 3 +#define R_PARISC_DIR17F 4 +#define R_PARISC_DIR14R 6 +#define R_PARISC_PCREL32 9 +#define R_PARISC_PCREL21L 10 +#define R_PARISC_PCREL17R 11 +#define R_PARISC_PCREL17F 12 +#define R_PARISC_PCREL14R 14 +#define R_PARISC_DPREL21L 18 +#define R_PARISC_DPREL14R 22 +#define R_PARISC_GPREL21L 26 +#define R_PARISC_GPREL14R 30 +#define R_PARISC_LTOFF21L 34 +#define R_PARISC_LTOFF14R 38 +#define R_PARISC_SECREL32 41 +#define R_PARISC_SEGBASE 48 +#define R_PARISC_SEGREL32 49 +#define R_PARISC_PLTOFF21L 50 +#define R_PARISC_PLTOFF14R 54 +#define R_PARISC_LTOFF_FPTR32 57 +#define R_PARISC_LTOFF_FPTR21L 58 +#define R_PARISC_LTOFF_FPTR14R 62 +#define R_PARISC_FPTR64 64 +#define R_PARISC_PLABEL32 65 +#define R_PARISC_PLABEL21L 66 +#define R_PARISC_PLABEL14R 70 +#define R_PARISC_PCREL64 72 +#define R_PARISC_PCREL22F 74 +#define R_PARISC_PCREL14WR 75 +#define R_PARISC_PCREL14DR 76 +#define R_PARISC_PCREL16F 77 +#define R_PARISC_PCREL16WF 78 +#define R_PARISC_PCREL16DF 79 +#define R_PARISC_DIR64 80 +#define R_PARISC_DIR14WR 83 +#define R_PARISC_DIR14DR 84 +#define R_PARISC_DIR16F 85 +#define R_PARISC_DIR16WF 86 +#define R_PARISC_DIR16DF 87 +#define R_PARISC_GPREL64 88 +#define R_PARISC_GPREL14WR 91 +#define R_PARISC_GPREL14DR 92 +#define R_PARISC_GPREL16F 93 +#define R_PARISC_GPREL16WF 94 +#define R_PARISC_GPREL16DF 95 +#define R_PARISC_LTOFF64 96 +#define R_PARISC_LTOFF14WR 99 +#define R_PARISC_LTOFF14DR 100 +#define R_PARISC_LTOFF16F 101 +#define R_PARISC_LTOFF16WF 102 +#define R_PARISC_LTOFF16DF 103 +#define R_PARISC_SECREL64 104 +#define R_PARISC_SEGREL64 112 +#define R_PARISC_PLTOFF14WR 115 +#define R_PARISC_PLTOFF14DR 116 +#define R_PARISC_PLTOFF16F 117 +#define R_PARISC_PLTOFF16WF 118 +#define R_PARISC_PLTOFF16DF 119 +#define R_PARISC_LTOFF_FPTR64 120 +#define R_PARISC_LTOFF_FPTR14WR 123 +#define R_PARISC_LTOFF_FPTR14DR 124 +#define R_PARISC_LTOFF_FPTR16F 125 +#define R_PARISC_LTOFF_FPTR16WF 126 +#define R_PARISC_LTOFF_FPTR16DF 127 +#define R_PARISC_LORESERVE 128 +#define R_PARISC_COPY 128 +#define R_PARISC_IPLT 129 +#define R_PARISC_EPLT 130 +#define R_PARISC_TPREL32 153 +#define R_PARISC_TPREL21L 154 +#define R_PARISC_TPREL14R 158 +#define R_PARISC_LTOFF_TP21L 162 +#define R_PARISC_LTOFF_TP14R 166 +#define R_PARISC_LTOFF_TP14F 167 +#define R_PARISC_TPREL64 216 +#define R_PARISC_TPREL14WR 219 +#define R_PARISC_TPREL14DR 220 +#define R_PARISC_TPREL16F 221 +#define R_PARISC_TPREL16WF 222 +#define R_PARISC_TPREL16DF 223 +#define R_PARISC_LTOFF_TP64 224 +#define R_PARISC_LTOFF_TP14WR 227 +#define R_PARISC_LTOFF_TP14DR 228 +#define R_PARISC_LTOFF_TP16F 229 +#define R_PARISC_LTOFF_TP16WF 230 +#define R_PARISC_LTOFF_TP16DF 231 +#define R_PARISC_GNU_VTENTRY 232 +#define R_PARISC_GNU_VTINHERIT 233 +#define R_PARISC_TLS_GD21L 234 +#define R_PARISC_TLS_GD14R 235 +#define R_PARISC_TLS_GDCALL 236 +#define R_PARISC_TLS_LDM21L 237 +#define R_PARISC_TLS_LDM14R 238 +#define R_PARISC_TLS_LDMCALL 239 +#define R_PARISC_TLS_LDO21L 240 +#define R_PARISC_TLS_LDO14R 241 +#define R_PARISC_TLS_DTPMOD32 242 +#define R_PARISC_TLS_DTPMOD64 243 +#define R_PARISC_TLS_DTPOFF32 244 +#define R_PARISC_TLS_DTPOFF64 245 +#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L +#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R +#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L +#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R +#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 +#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 +#define R_PARISC_HIRESERVE 255 + +#define PT_HP_TLS (PT_LOOS + 0x0) +#define PT_HP_CORE_NONE (PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) +#define PT_HP_CORE_COMM (PT_LOOS + 0x4) +#define PT_HP_CORE_PROC (PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) +#define PT_HP_CORE_STACK (PT_LOOS + 0x7) +#define PT_HP_CORE_SHM (PT_LOOS + 0x8) +#define PT_HP_CORE_MMF (PT_LOOS + 0x9) +#define PT_HP_PARALLEL (PT_LOOS + 0x10) +#define PT_HP_FASTBIND (PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) +#define PT_HP_STACK (PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT 0x70000000 +#define PT_PARISC_UNWIND 0x70000001 + +#define PF_PARISC_SBP 0x08000000 + +#define PF_HP_PAGE_SIZE 0x00100000 +#define PF_HP_FAR_SHARED 0x00200000 +#define PF_HP_NEAR_SHARED 0x00400000 +#define PF_HP_CODE 0x01000000 +#define PF_HP_MODIFY 0x02000000 +#define PF_HP_LAZYSWAP 0x04000000 +#define PF_HP_SBP 0x08000000 + +#define EF_ALPHA_32BIT 1 +#define EF_ALPHA_CANRELAX 2 + +#define SHT_ALPHA_DEBUG 0x70000001 +#define SHT_ALPHA_REGINFO 0x70000002 + +#define SHF_ALPHA_GPREL 0x10000000 + +#define STO_ALPHA_NOPV 0x80 +#define STO_ALPHA_STD_GPLOAD 0x88 + +#define R_ALPHA_NONE 0 +#define R_ALPHA_REFLONG 1 +#define R_ALPHA_REFQUAD 2 +#define R_ALPHA_GPREL32 3 +#define R_ALPHA_LITERAL 4 +#define R_ALPHA_LITUSE 5 +#define R_ALPHA_GPDISP 6 +#define R_ALPHA_BRADDR 7 +#define R_ALPHA_HINT 8 +#define R_ALPHA_SREL16 9 +#define R_ALPHA_SREL32 10 +#define R_ALPHA_SREL64 11 +#define R_ALPHA_GPRELHIGH 17 +#define R_ALPHA_GPRELLOW 18 +#define R_ALPHA_GPREL16 19 +#define R_ALPHA_COPY 24 +#define R_ALPHA_GLOB_DAT 25 +#define R_ALPHA_JMP_SLOT 26 +#define R_ALPHA_RELATIVE 27 +#define R_ALPHA_TLS_GD_HI 28 +#define R_ALPHA_TLSGD 29 +#define R_ALPHA_TLS_LDM 30 +#define R_ALPHA_DTPMOD64 31 +#define R_ALPHA_GOTDTPREL 32 +#define R_ALPHA_DTPREL64 33 +#define R_ALPHA_DTPRELHI 34 +#define R_ALPHA_DTPRELLO 35 +#define R_ALPHA_DTPREL16 36 +#define R_ALPHA_GOTTPREL 37 +#define R_ALPHA_TPREL64 38 +#define R_ALPHA_TPRELHI 39 +#define R_ALPHA_TPRELLO 40 +#define R_ALPHA_TPREL16 41 + +#define R_ALPHA_NUM 46 + +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLS_GD 4 +#define LITUSE_ALPHA_TLS_LDM 5 + +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 + +#define EF_PPC_EMB 0x80000000 + +#define EF_PPC_RELOCATABLE 0x00010000 +#define EF_PPC_RELOCATABLE_LIB 0x00008000 + +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +#define R_PPC_TLS 67 +#define R_PPC_DTPMOD32 68 +#define R_PPC_TPREL16 69 +#define R_PPC_TPREL16_LO 70 +#define R_PPC_TPREL16_HI 71 +#define R_PPC_TPREL16_HA 72 +#define R_PPC_TPREL32 73 +#define R_PPC_DTPREL16 74 +#define R_PPC_DTPREL16_LO 75 +#define R_PPC_DTPREL16_HI 76 +#define R_PPC_DTPREL16_HA 77 +#define R_PPC_DTPREL32 78 +#define R_PPC_GOT_TLSGD16 79 +#define R_PPC_GOT_TLSGD16_LO 80 +#define R_PPC_GOT_TLSGD16_HI 81 +#define R_PPC_GOT_TLSGD16_HA 82 +#define R_PPC_GOT_TLSLD16 83 +#define R_PPC_GOT_TLSLD16_LO 84 +#define R_PPC_GOT_TLSLD16_HI 85 +#define R_PPC_GOT_TLSLD16_HA 86 +#define R_PPC_GOT_TPREL16 87 +#define R_PPC_GOT_TPREL16_LO 88 +#define R_PPC_GOT_TPREL16_HI 89 +#define R_PPC_GOT_TPREL16_HA 90 +#define R_PPC_GOT_DTPREL16 91 +#define R_PPC_GOT_DTPREL16_LO 92 +#define R_PPC_GOT_DTPREL16_HI 93 +#define R_PPC_GOT_DTPREL16_HA 94 + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + +#define R_PPC_DIAB_SDA21_LO 180 +#define R_PPC_DIAB_SDA21_HI 181 +#define R_PPC_DIAB_SDA21_HA 182 +#define R_PPC_DIAB_RELSDA_LO 183 +#define R_PPC_DIAB_RELSDA_HI 184 +#define R_PPC_DIAB_RELSDA_HA 185 + +#define R_PPC_IRELATIVE 248 + +#define R_PPC_REL16 249 +#define R_PPC_REL16_LO 250 +#define R_PPC_REL16_HI 251 +#define R_PPC_REL16_HA 252 + +#define R_PPC_TOC16 255 + +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_NUM 1 + +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 +#define R_PPC64_ADDR24 R_PPC_ADDR24 +#define R_PPC64_ADDR16 R_PPC_ADDR16 +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA +#define R_PPC64_ADDR14 R_PPC_ADDR14 +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 +#define R_PPC64_REL14 R_PPC_REL14 +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 +#define R_PPC64_ADDR64 38 +#define R_PPC64_ADDR16_HIGHER 39 +#define R_PPC64_ADDR16_HIGHERA 40 +#define R_PPC64_ADDR16_HIGHEST 41 +#define R_PPC64_ADDR16_HIGHESTA 42 +#define R_PPC64_UADDR64 43 +#define R_PPC64_REL64 44 +#define R_PPC64_PLT64 45 +#define R_PPC64_PLTREL64 46 +#define R_PPC64_TOC16 47 +#define R_PPC64_TOC16_LO 48 +#define R_PPC64_TOC16_HI 49 +#define R_PPC64_TOC16_HA 50 +#define R_PPC64_TOC 51 +#define R_PPC64_PLTGOT16 52 +#define R_PPC64_PLTGOT16_LO 53 +#define R_PPC64_PLTGOT16_HI 54 +#define R_PPC64_PLTGOT16_HA 55 + +#define R_PPC64_ADDR16_DS 56 +#define R_PPC64_ADDR16_LO_DS 57 +#define R_PPC64_GOT16_DS 58 +#define R_PPC64_GOT16_LO_DS 59 +#define R_PPC64_PLT16_LO_DS 60 +#define R_PPC64_SECTOFF_DS 61 +#define R_PPC64_SECTOFF_LO_DS 62 +#define R_PPC64_TOC16_DS 63 +#define R_PPC64_TOC16_LO_DS 64 +#define R_PPC64_PLTGOT16_DS 65 +#define R_PPC64_PLTGOT16_LO_DS 66 + +#define R_PPC64_TLS 67 +#define R_PPC64_DTPMOD64 68 +#define R_PPC64_TPREL16 69 +#define R_PPC64_TPREL16_LO 70 +#define R_PPC64_TPREL16_HI 71 +#define R_PPC64_TPREL16_HA 72 +#define R_PPC64_TPREL64 73 +#define R_PPC64_DTPREL16 74 +#define R_PPC64_DTPREL16_LO 75 +#define R_PPC64_DTPREL16_HI 76 +#define R_PPC64_DTPREL16_HA 77 +#define R_PPC64_DTPREL64 78 +#define R_PPC64_GOT_TLSGD16 79 +#define R_PPC64_GOT_TLSGD16_LO 80 +#define R_PPC64_GOT_TLSGD16_HI 81 +#define R_PPC64_GOT_TLSGD16_HA 82 +#define R_PPC64_GOT_TLSLD16 83 +#define R_PPC64_GOT_TLSLD16_LO 84 +#define R_PPC64_GOT_TLSLD16_HI 85 +#define R_PPC64_GOT_TLSLD16_HA 86 +#define R_PPC64_GOT_TPREL16_DS 87 +#define R_PPC64_GOT_TPREL16_LO_DS 88 +#define R_PPC64_GOT_TPREL16_HI 89 +#define R_PPC64_GOT_TPREL16_HA 90 +#define R_PPC64_GOT_DTPREL16_DS 91 +#define R_PPC64_GOT_DTPREL16_LO_DS 92 +#define R_PPC64_GOT_DTPREL16_HI 93 +#define R_PPC64_GOT_DTPREL16_HA 94 +#define R_PPC64_TPREL16_DS 95 +#define R_PPC64_TPREL16_LO_DS 96 +#define R_PPC64_TPREL16_HIGHER 97 +#define R_PPC64_TPREL16_HIGHERA 98 +#define R_PPC64_TPREL16_HIGHEST 99 +#define R_PPC64_TPREL16_HIGHESTA 100 +#define R_PPC64_DTPREL16_DS 101 +#define R_PPC64_DTPREL16_LO_DS 102 +#define R_PPC64_DTPREL16_HIGHER 103 +#define R_PPC64_DTPREL16_HIGHERA 104 +#define R_PPC64_DTPREL16_HIGHEST 105 +#define R_PPC64_DTPREL16_HIGHESTA 106 + +#define R_PPC64_JMP_IREL 247 +#define R_PPC64_IRELATIVE 248 +#define R_PPC64_REL16 249 +#define R_PPC64_REL16_LO 250 +#define R_PPC64_REL16_HI 251 +#define R_PPC64_REL16_HA 252 + +#define DT_PPC64_GLINK (DT_LOPROC + 0) +#define DT_PPC64_OPD (DT_LOPROC + 1) +#define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_NUM 3 + +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 +#define EF_ARM_SOFT_FLOAT 0x200 +#define EF_ARM_VFP_FLOAT 0x400 +#define EF_ARM_MAVERICK_FLOAT 0x800 + +#define EF_ARM_ABI_FLOAT_SOFT 0x200 +#define EF_ARM_ABI_FLOAT_HARD 0x400 + +#define EF_ARM_SYMSARESORTED 0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST 0x10 +#define EF_ARM_EABIMASK 0XFF000000 + +#define EF_ARM_BE8 0x00800000 +#define EF_ARM_LE8 0x00400000 + +#define EF_ARM_EABI_VERSION(flags) ((flags)&EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 +#define EF_ARM_EABI_VER3 0x03000000 +#define EF_ARM_EABI_VER4 0x04000000 +#define EF_ARM_EABI_VER5 0x05000000 + +#define STT_ARM_TFUNC STT_LOPROC +#define STT_ARM_16BIT STT_HIPROC + +#define SHF_ARM_ENTRYSECT 0x10000000 +#define SHF_ARM_COMDEF 0x80000000 + +#define PF_ARM_SB 0x10000000 + +#define PF_ARM_PI 0x20000000 +#define PF_ARM_ABS 0x40000000 + +#define PT_ARM_EXIDX (PT_LOPROC + 1) + +#define SHT_ARM_EXIDX (SHT_LOPROC + 1) +#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) +#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) + +#define R_AARCH64_NONE 0 +#define R_AARCH64_ABS64 257 +#define R_AARCH64_ABS32 258 +#define R_AARCH64_ABS16 259 +#define R_AARCH64_PREL64 260 +#define R_AARCH64_PREL32 261 +#define R_AARCH64_PREL16 262 +#define R_AARCH64_MOVW_UABS_G0 263 +#define R_AARCH64_MOVW_UABS_G0_NC 264 +#define R_AARCH64_MOVW_UABS_G1 265 +#define R_AARCH64_MOVW_UABS_G1_NC 266 +#define R_AARCH64_MOVW_UABS_G2 267 +#define R_AARCH64_MOVW_UABS_G2_NC 268 +#define R_AARCH64_MOVW_UABS_G3 269 +#define R_AARCH64_MOVW_SABS_G0 270 +#define R_AARCH64_MOVW_SABS_G1 271 +#define R_AARCH64_MOVW_SABS_G2 272 +#define R_AARCH64_LD_PREL_LO19 273 +#define R_AARCH64_ADR_PREL_LO21 274 +#define R_AARCH64_ADR_PREL_PG_HI21 275 +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 +#define R_AARCH64_ADD_ABS_LO12_NC 277 +#define R_AARCH64_LDST8_ABS_LO12_NC 278 +#define R_AARCH64_TSTBR14 279 +#define R_AARCH64_CONDBR19 280 +#define R_AARCH64_JUMP26 282 +#define R_AARCH64_CALL26 283 +#define R_AARCH64_LDST16_ABS_LO12_NC 284 +#define R_AARCH64_LDST32_ABS_LO12_NC 285 +#define R_AARCH64_LDST64_ABS_LO12_NC 286 +#define R_AARCH64_MOVW_PREL_G0 287 +#define R_AARCH64_MOVW_PREL_G0_NC 288 +#define R_AARCH64_MOVW_PREL_G1 289 +#define R_AARCH64_MOVW_PREL_G1_NC 290 +#define R_AARCH64_MOVW_PREL_G2 291 +#define R_AARCH64_MOVW_PREL_G2_NC 292 +#define R_AARCH64_MOVW_PREL_G3 293 +#define R_AARCH64_LDST128_ABS_LO12_NC 299 +#define R_AARCH64_MOVW_GOTOFF_G0 300 +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 +#define R_AARCH64_MOVW_GOTOFF_G1 302 +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 +#define R_AARCH64_MOVW_GOTOFF_G2 304 +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 +#define R_AARCH64_MOVW_GOTOFF_G3 306 +#define R_AARCH64_GOTREL64 307 +#define R_AARCH64_GOTREL32 308 +#define R_AARCH64_GOT_LD_PREL19 309 +#define R_AARCH64_LD64_GOTOFF_LO15 310 +#define R_AARCH64_ADR_GOT_PAGE 311 +#define R_AARCH64_LD64_GOT_LO12_NC 312 +#define R_AARCH64_LD64_GOTPAGE_LO15 313 +#define R_AARCH64_TLSGD_ADR_PREL21 512 +#define R_AARCH64_TLSGD_ADR_PAGE21 513 +#define R_AARCH64_TLSGD_ADD_LO12_NC 514 +#define R_AARCH64_TLSGD_MOVW_G1 515 +#define R_AARCH64_TLSGD_MOVW_G0_NC 516 +#define R_AARCH64_TLSLD_ADR_PREL21 517 +#define R_AARCH64_TLSLD_ADR_PAGE21 518 +#define R_AARCH64_TLSLD_ADD_LO12_NC 519 +#define R_AARCH64_TLSLD_MOVW_G1 520 +#define R_AARCH64_TLSLD_MOVW_G0_NC 521 +#define R_AARCH64_TLSLD_LD_PREL19 522 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 +#define R_AARCH64_TLSDESC_LD_PREL19 560 +#define R_AARCH64_TLSDESC_ADR_PREL21 561 +#define R_AARCH64_TLSDESC_ADR_PAGE21 562 +#define R_AARCH64_TLSDESC_LD64_LO12 563 +#define R_AARCH64_TLSDESC_ADD_LO12 564 +#define R_AARCH64_TLSDESC_OFF_G1 565 +#define R_AARCH64_TLSDESC_OFF_G0_NC 566 +#define R_AARCH64_TLSDESC_LDR 567 +#define R_AARCH64_TLSDESC_ADD 568 +#define R_AARCH64_TLSDESC_CALL 569 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 +#define R_AARCH64_COPY 1024 +#define R_AARCH64_GLOB_DAT 1025 +#define R_AARCH64_JUMP_SLOT 1026 +#define R_AARCH64_RELATIVE 1027 +#define R_AARCH64_TLS_DTPMOD64 1028 +#define R_AARCH64_TLS_DTPREL64 1029 +#define R_AARCH64_TLS_TPREL64 1030 +#define R_AARCH64_TLSDESC 1031 + +#define R_ARM_NONE 0 +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_TLS_DESC 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_TLS_DTPMOD32 17 +#define R_ARM_TLS_DTPOFF32 18 +#define R_ARM_TLS_TPOFF32 19 +#define R_ARM_COPY 20 +#define R_ARM_GLOB_DAT 21 +#define R_ARM_JUMP_SLOT 22 +#define R_ARM_RELATIVE 23 +#define R_ARM_GOTOFF 24 +#define R_ARM_GOTPC 25 +#define R_ARM_GOT32 26 +#define R_ARM_PLT32 27 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_THM_JUMP24 30 +#define R_ARM_BASE_ABS 31 +#define R_ARM_ALU_PCREL_7_0 32 +#define R_ARM_ALU_PCREL_15_8 33 +#define R_ARM_ALU_PCREL_23_15 34 +#define R_ARM_LDR_SBREL_11_0 35 +#define R_ARM_ALU_SBREL_19_12 36 +#define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_TARGET1 38 +#define R_ARM_SBREL31 39 +#define R_ARM_V4BX 40 +#define R_ARM_TARGET2 41 +#define R_ARM_PREL31 42 +#define R_ARM_MOVW_ABS_NC 43 +#define R_ARM_MOVT_ABS 44 +#define R_ARM_MOVW_PREL_NC 45 +#define R_ARM_MOVT_PREL 46 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 +#define R_ARM_THM_MOVW_PREL_NC 49 +#define R_ARM_THM_MOVT_PREL 50 +#define R_ARM_THM_JUMP19 51 +#define R_ARM_THM_JUMP6 52 +#define R_ARM_THM_ALU_PREL_11_0 53 +#define R_ARM_THM_PC12 54 +#define R_ARM_ABS32_NOI 55 +#define R_ARM_REL32_NOI 56 +#define R_ARM_ALU_PC_G0_NC 57 +#define R_ARM_ALU_PC_G0 58 +#define R_ARM_ALU_PC_G1_NC 59 +#define R_ARM_ALU_PC_G1 60 +#define R_ARM_ALU_PC_G2 61 +#define R_ARM_LDR_PC_G1 62 +#define R_ARM_LDR_PC_G2 63 +#define R_ARM_LDRS_PC_G0 64 +#define R_ARM_LDRS_PC_G1 65 +#define R_ARM_LDRS_PC_G2 66 +#define R_ARM_LDC_PC_G0 67 +#define R_ARM_LDC_PC_G1 68 +#define R_ARM_LDC_PC_G2 69 +#define R_ARM_ALU_SB_G0_NC 70 +#define R_ARM_ALU_SB_G0 71 +#define R_ARM_ALU_SB_G1_NC 72 +#define R_ARM_ALU_SB_G1 73 +#define R_ARM_ALU_SB_G2 74 +#define R_ARM_LDR_SB_G0 75 +#define R_ARM_LDR_SB_G1 76 +#define R_ARM_LDR_SB_G2 77 +#define R_ARM_LDRS_SB_G0 78 +#define R_ARM_LDRS_SB_G1 79 +#define R_ARM_LDRS_SB_G2 80 +#define R_ARM_LDC_SB_G0 81 +#define R_ARM_LDC_SB_G1 82 +#define R_ARM_LDC_SB_G2 83 +#define R_ARM_MOVW_BREL_NC 84 +#define R_ARM_MOVT_BREL 85 +#define R_ARM_MOVW_BREL 86 +#define R_ARM_THM_MOVW_BREL_NC 87 +#define R_ARM_THM_MOVT_BREL 88 +#define R_ARM_THM_MOVW_BREL 89 +#define R_ARM_TLS_GOTDESC 90 +#define R_ARM_TLS_CALL 91 +#define R_ARM_TLS_DESCSEQ 92 +#define R_ARM_THM_TLS_CALL 93 +#define R_ARM_PLT32_ABS 94 +#define R_ARM_GOT_ABS 95 +#define R_ARM_GOT_PREL 96 +#define R_ARM_GOT_BREL12 97 +#define R_ARM_GOTOFF12 98 +#define R_ARM_GOTRELAX 99 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 +#define R_ARM_THM_PC9 103 +#define R_ARM_TLS_GD32 104 + +#define R_ARM_TLS_LDM32 105 + +#define R_ARM_TLS_LDO32 106 + +#define R_ARM_TLS_IE32 107 + +#define R_ARM_TLS_LE32 108 +#define R_ARM_TLS_LDO12 109 +#define R_ARM_TLS_LE12 110 +#define R_ARM_TLS_IE12GP 111 +#define R_ARM_ME_TOO 128 +#define R_ARM_THM_TLS_DESCSEQ 129 +#define R_ARM_THM_TLS_DESCSEQ16 129 +#define R_ARM_THM_TLS_DESCSEQ32 130 +#define R_ARM_THM_GOT_BREL12 131 +#define R_ARM_IRELATIVE 160 +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + +#define R_ARM_NUM 256 + +#define EF_IA_64_MASKOS 0x0000000f +#define EF_IA_64_ABI64 0x00000010 +#define EF_IA_64_ARCH 0xff000000 + +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) +#define PT_IA_64_UNWIND (PT_LOPROC + 1) +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) + +#define PF_IA_64_NORECOV 0x80000000 + +#define SHT_IA_64_EXT (SHT_LOPROC + 0) +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) + +#define SHF_IA_64_SHORT 0x10000000 +#define SHF_IA_64_NORECOV 0x20000000 + +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) +#define DT_IA_64_NUM 1 + +#define R_IA64_NONE 0x00 +#define R_IA64_IMM14 0x21 +#define R_IA64_IMM22 0x22 +#define R_IA64_IMM64 0x23 +#define R_IA64_DIR32MSB 0x24 +#define R_IA64_DIR32LSB 0x25 +#define R_IA64_DIR64MSB 0x26 +#define R_IA64_DIR64LSB 0x27 +#define R_IA64_GPREL22 0x2a +#define R_IA64_GPREL64I 0x2b +#define R_IA64_GPREL32MSB 0x2c +#define R_IA64_GPREL32LSB 0x2d +#define R_IA64_GPREL64MSB 0x2e +#define R_IA64_GPREL64LSB 0x2f +#define R_IA64_LTOFF22 0x32 +#define R_IA64_LTOFF64I 0x33 +#define R_IA64_PLTOFF22 0x3a +#define R_IA64_PLTOFF64I 0x3b +#define R_IA64_PLTOFF64MSB 0x3e +#define R_IA64_PLTOFF64LSB 0x3f +#define R_IA64_FPTR64I 0x43 +#define R_IA64_FPTR32MSB 0x44 +#define R_IA64_FPTR32LSB 0x45 +#define R_IA64_FPTR64MSB 0x46 +#define R_IA64_FPTR64LSB 0x47 +#define R_IA64_PCREL60B 0x48 +#define R_IA64_PCREL21B 0x49 +#define R_IA64_PCREL21M 0x4a +#define R_IA64_PCREL21F 0x4b +#define R_IA64_PCREL32MSB 0x4c +#define R_IA64_PCREL32LSB 0x4d +#define R_IA64_PCREL64MSB 0x4e +#define R_IA64_PCREL64LSB 0x4f +#define R_IA64_LTOFF_FPTR22 0x52 +#define R_IA64_LTOFF_FPTR64I 0x53 +#define R_IA64_LTOFF_FPTR32MSB 0x54 +#define R_IA64_LTOFF_FPTR32LSB 0x55 +#define R_IA64_LTOFF_FPTR64MSB 0x56 +#define R_IA64_LTOFF_FPTR64LSB 0x57 +#define R_IA64_SEGREL32MSB 0x5c +#define R_IA64_SEGREL32LSB 0x5d +#define R_IA64_SEGREL64MSB 0x5e +#define R_IA64_SEGREL64LSB 0x5f +#define R_IA64_SECREL32MSB 0x64 +#define R_IA64_SECREL32LSB 0x65 +#define R_IA64_SECREL64MSB 0x66 +#define R_IA64_SECREL64LSB 0x67 +#define R_IA64_REL32MSB 0x6c +#define R_IA64_REL32LSB 0x6d +#define R_IA64_REL64MSB 0x6e +#define R_IA64_REL64LSB 0x6f +#define R_IA64_LTV32MSB 0x74 +#define R_IA64_LTV32LSB 0x75 +#define R_IA64_LTV64MSB 0x76 +#define R_IA64_LTV64LSB 0x77 +#define R_IA64_PCREL21BI 0x79 +#define R_IA64_PCREL22 0x7a +#define R_IA64_PCREL64I 0x7b +#define R_IA64_IPLTMSB 0x80 +#define R_IA64_IPLTLSB 0x81 +#define R_IA64_COPY 0x84 +#define R_IA64_SUB 0x85 +#define R_IA64_LTOFF22X 0x86 +#define R_IA64_LDXMOV 0x87 +#define R_IA64_TPREL14 0x91 +#define R_IA64_TPREL22 0x92 +#define R_IA64_TPREL64I 0x93 +#define R_IA64_TPREL64MSB 0x96 +#define R_IA64_TPREL64LSB 0x97 +#define R_IA64_LTOFF_TPREL22 0x9a +#define R_IA64_DTPMOD64MSB 0xa6 +#define R_IA64_DTPMOD64LSB 0xa7 +#define R_IA64_LTOFF_DTPMOD22 0xaa +#define R_IA64_DTPREL14 0xb1 +#define R_IA64_DTPREL22 0xb2 +#define R_IA64_DTPREL64I 0xb3 +#define R_IA64_DTPREL32MSB 0xb4 +#define R_IA64_DTPREL32LSB 0xb5 +#define R_IA64_DTPREL64MSB 0xb6 +#define R_IA64_DTPREL64LSB 0xb7 +#define R_IA64_LTOFF_DTPREL22 0xba + +#define R_SH_NONE 0 +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_DIR8WPN 3 +#define R_SH_IND12W 4 +#define R_SH_DIR8WPL 5 +#define R_SH_DIR8WPZ 6 +#define R_SH_DIR8BP 7 +#define R_SH_DIR8W 8 +#define R_SH_DIR8L 9 +#define R_SH_SWITCH16 25 +#define R_SH_SWITCH32 26 +#define R_SH_USES 27 +#define R_SH_COUNT 28 +#define R_SH_ALIGN 29 +#define R_SH_CODE 30 +#define R_SH_DATA 31 +#define R_SH_LABEL 32 +#define R_SH_SWITCH8 33 +#define R_SH_GNU_VTINHERIT 34 +#define R_SH_GNU_VTENTRY 35 +#define R_SH_TLS_GD_32 144 +#define R_SH_TLS_LD_32 145 +#define R_SH_TLS_LDO_32 146 +#define R_SH_TLS_IE_32 147 +#define R_SH_TLS_LE_32 148 +#define R_SH_TLS_DTPMOD32 149 +#define R_SH_TLS_DTPOFF32 150 +#define R_SH_TLS_TPOFF32 151 +#define R_SH_GOT32 160 +#define R_SH_PLT32 161 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 +#define R_SH_GOTOFF 166 +#define R_SH_GOTPC 167 +#define R_SH_GOT20 201 +#define R_SH_GOTOFF20 202 +#define R_SH_GOTFUNCDESC 203 +#define R_SH_GOTFUNCDEST20 204 +#define R_SH_GOTOFFFUNCDESC 205 +#define R_SH_GOTOFFFUNCDEST20 206 +#define R_SH_FUNCDESC 207 +#define R_SH_FUNCDESC_VALUE 208 + +#define R_SH_NUM 256 + +#define R_390_NONE 0 +#define R_390_8 1 +#define R_390_12 2 +#define R_390_16 3 +#define R_390_32 4 +#define R_390_PC32 5 +#define R_390_GOT12 6 +#define R_390_GOT32 7 +#define R_390_PLT32 8 +#define R_390_COPY 9 +#define R_390_GLOB_DAT 10 +#define R_390_JMP_SLOT 11 +#define R_390_RELATIVE 12 +#define R_390_GOTOFF32 13 +#define R_390_GOTPC 14 +#define R_390_GOT16 15 +#define R_390_PC16 16 +#define R_390_PC16DBL 17 +#define R_390_PLT16DBL 18 +#define R_390_PC32DBL 19 +#define R_390_PLT32DBL 20 +#define R_390_GOTPCDBL 21 +#define R_390_64 22 +#define R_390_PC64 23 +#define R_390_GOT64 24 +#define R_390_PLT64 25 +#define R_390_GOTENT 26 +#define R_390_GOTOFF16 27 +#define R_390_GOTOFF64 28 +#define R_390_GOTPLT12 29 +#define R_390_GOTPLT16 30 +#define R_390_GOTPLT32 31 +#define R_390_GOTPLT64 32 +#define R_390_GOTPLTENT 33 +#define R_390_PLTOFF16 34 +#define R_390_PLTOFF32 35 +#define R_390_PLTOFF64 36 +#define R_390_TLS_LOAD 37 +#define R_390_TLS_GDCALL 38 + +#define R_390_TLS_LDCALL 39 + +#define R_390_TLS_GD32 40 + +#define R_390_TLS_GD64 41 + +#define R_390_TLS_GOTIE12 42 + +#define R_390_TLS_GOTIE32 43 + +#define R_390_TLS_GOTIE64 44 + +#define R_390_TLS_LDM32 45 + +#define R_390_TLS_LDM64 46 + +#define R_390_TLS_IE32 47 + +#define R_390_TLS_IE64 48 + +#define R_390_TLS_IEENT 49 + +#define R_390_TLS_LE32 50 + +#define R_390_TLS_LE64 51 + +#define R_390_TLS_LDO32 52 + +#define R_390_TLS_LDO64 53 + +#define R_390_TLS_DTPMOD 54 +#define R_390_TLS_DTPOFF 55 +#define R_390_TLS_TPOFF 56 + +#define R_390_20 57 +#define R_390_GOT20 58 +#define R_390_GOTPLT20 59 +#define R_390_TLS_GOTIE20 60 + +#define R_390_NUM 61 + +#define R_CRIS_NONE 0 +#define R_CRIS_8 1 +#define R_CRIS_16 2 +#define R_CRIS_32 3 +#define R_CRIS_8_PCREL 4 +#define R_CRIS_16_PCREL 5 +#define R_CRIS_32_PCREL 6 +#define R_CRIS_GNU_VTINHERIT 7 +#define R_CRIS_GNU_VTENTRY 8 +#define R_CRIS_COPY 9 +#define R_CRIS_GLOB_DAT 10 +#define R_CRIS_JUMP_SLOT 11 +#define R_CRIS_RELATIVE 12 +#define R_CRIS_16_GOT 13 +#define R_CRIS_32_GOT 14 +#define R_CRIS_16_GOTPLT 15 +#define R_CRIS_32_GOTPLT 16 +#define R_CRIS_32_GOTREL 17 +#define R_CRIS_32_PLT_GOTREL 18 +#define R_CRIS_32_PLT_PCREL 19 + +#define R_CRIS_NUM 20 + +#define R_X86_64_NONE 0 +#define R_X86_64_64 1 +#define R_X86_64_PC32 2 +#define R_X86_64_GOT32 3 +#define R_X86_64_PLT32 4 +#define R_X86_64_COPY 5 +#define R_X86_64_GLOB_DAT 6 +#define R_X86_64_JUMP_SLOT 7 +#define R_X86_64_RELATIVE 8 +#define R_X86_64_GOTPCREL 9 + +#define R_X86_64_32 10 +#define R_X86_64_32S 11 +#define R_X86_64_16 12 +#define R_X86_64_PC16 13 +#define R_X86_64_8 14 +#define R_X86_64_PC8 15 +#define R_X86_64_DTPMOD64 16 +#define R_X86_64_DTPOFF64 17 +#define R_X86_64_TPOFF64 18 +#define R_X86_64_TLSGD 19 + +#define R_X86_64_TLSLD 20 + +#define R_X86_64_DTPOFF32 21 +#define R_X86_64_GOTTPOFF 22 + +#define R_X86_64_TPOFF32 23 +#define R_X86_64_PC64 24 +#define R_X86_64_GOTOFF64 25 +#define R_X86_64_GOTPC32 26 +#define R_X86_64_GOT64 27 +#define R_X86_64_GOTPCREL64 28 +#define R_X86_64_GOTPC64 29 +#define R_X86_64_GOTPLT64 30 +#define R_X86_64_PLTOFF64 31 +#define R_X86_64_SIZE32 32 +#define R_X86_64_SIZE64 33 + +#define R_X86_64_GOTPC32_TLSDESC 34 +#define R_X86_64_TLSDESC_CALL 35 + +#define R_X86_64_TLSDESC 36 +#define R_X86_64_IRELATIVE 37 +#define R_X86_64_RELATIVE64 38 +#define R_X86_64_NUM 39 + +#define R_MN10300_NONE 0 +#define R_MN10300_32 1 +#define R_MN10300_16 2 +#define R_MN10300_8 3 +#define R_MN10300_PCREL32 4 +#define R_MN10300_PCREL16 5 +#define R_MN10300_PCREL8 6 +#define R_MN10300_GNU_VTINHERIT 7 +#define R_MN10300_GNU_VTENTRY 8 +#define R_MN10300_24 9 +#define R_MN10300_GOTPC32 10 +#define R_MN10300_GOTPC16 11 +#define R_MN10300_GOTOFF32 12 +#define R_MN10300_GOTOFF24 13 +#define R_MN10300_GOTOFF16 14 +#define R_MN10300_PLT32 15 +#define R_MN10300_PLT16 16 +#define R_MN10300_GOT32 17 +#define R_MN10300_GOT24 18 +#define R_MN10300_GOT16 19 +#define R_MN10300_COPY 20 +#define R_MN10300_GLOB_DAT 21 +#define R_MN10300_JMP_SLOT 22 +#define R_MN10300_RELATIVE 23 + +#define R_MN10300_NUM 24 + +#define R_M32R_NONE 0 +#define R_M32R_16 1 +#define R_M32R_32 2 +#define R_M32R_24 3 +#define R_M32R_10_PCREL 4 +#define R_M32R_18_PCREL 5 +#define R_M32R_26_PCREL 6 +#define R_M32R_HI16_ULO 7 +#define R_M32R_HI16_SLO 8 +#define R_M32R_LO16 9 +#define R_M32R_SDA16 10 +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 + +#define R_M32R_16_RELA 33 +#define R_M32R_32_RELA 34 +#define R_M32R_24_RELA 35 +#define R_M32R_10_PCREL_RELA 36 +#define R_M32R_18_PCREL_RELA 37 +#define R_M32R_26_PCREL_RELA 38 +#define R_M32R_HI16_ULO_RELA 39 +#define R_M32R_HI16_SLO_RELA 40 +#define R_M32R_LO16_RELA 41 +#define R_M32R_SDA16_RELA 42 +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 +#define R_M32R_REL32 45 + +#define R_M32R_GOT24 48 +#define R_M32R_26_PLTREL 49 +#define R_M32R_COPY 50 +#define R_M32R_GLOB_DAT 51 +#define R_M32R_JMP_SLOT 52 +#define R_M32R_RELATIVE 53 +#define R_M32R_GOTOFF 54 +#define R_M32R_GOTPC24 55 +#define R_M32R_GOT16_HI_ULO 56 + +#define R_M32R_GOT16_HI_SLO 57 + +#define R_M32R_GOT16_LO 58 +#define R_M32R_GOTPC_HI_ULO 59 + +#define R_M32R_GOTPC_HI_SLO 60 + +#define R_M32R_GOTPC_LO 61 + +#define R_M32R_GOTOFF_HI_ULO 62 + +#define R_M32R_GOTOFF_HI_SLO 63 + +#define R_M32R_GOTOFF_LO 64 +#define R_M32R_NUM 256 + +#define R_MICROBLAZE_NONE 0 +#define R_MICROBLAZE_32 1 +#define R_MICROBLAZE_32_PCREL 2 +#define R_MICROBLAZE_64_PCREL 3 +#define R_MICROBLAZE_32_PCREL_LO 4 +#define R_MICROBLAZE_64 5 +#define R_MICROBLAZE_32_LO 6 +#define R_MICROBLAZE_SRO32 7 +#define R_MICROBLAZE_SRW32 8 +#define R_MICROBLAZE_64_NONE 9 +#define R_MICROBLAZE_32_SYM_OP_SYM 10 +#define R_MICROBLAZE_GNU_VTINHERIT 11 +#define R_MICROBLAZE_GNU_VTENTRY 12 +#define R_MICROBLAZE_GOTPC_64 13 +#define R_MICROBLAZE_GOT_64 14 +#define R_MICROBLAZE_PLT_64 15 +#define R_MICROBLAZE_REL 16 +#define R_MICROBLAZE_JUMP_SLOT 17 +#define R_MICROBLAZE_GLOB_DAT 18 +#define R_MICROBLAZE_GOTOFF_64 19 +#define R_MICROBLAZE_GOTOFF_32 20 +#define R_MICROBLAZE_COPY 21 +#define R_MICROBLAZE_TLS 22 +#define R_MICROBLAZE_TLSGD 23 +#define R_MICROBLAZE_TLSLD 24 +#define R_MICROBLAZE_TLSDTPMOD32 25 +#define R_MICROBLAZE_TLSDTPREL32 26 +#define R_MICROBLAZE_TLSDTPREL64 27 +#define R_MICROBLAZE_TLSGOTTPREL32 28 +#define R_MICROBLAZE_TLSTPREL32 29 + +#define R_OR1K_NONE 0 +#define R_OR1K_32 1 +#define R_OR1K_16 2 +#define R_OR1K_8 3 +#define R_OR1K_LO_16_IN_INSN 4 +#define R_OR1K_HI_16_IN_INSN 5 +#define R_OR1K_INSN_REL_26 6 +#define R_OR1K_GNU_VTENTRY 7 +#define R_OR1K_GNU_VTINHERIT 8 +#define R_OR1K_32_PCREL 9 +#define R_OR1K_16_PCREL 10 +#define R_OR1K_8_PCREL 11 +#define R_OR1K_GOTPC_HI16 12 +#define R_OR1K_GOTPC_LO16 13 +#define R_OR1K_GOT16 14 +#define R_OR1K_PLT26 15 +#define R_OR1K_GOTOFF_HI16 16 +#define R_OR1K_GOTOFF_LO16 17 +#define R_OR1K_COPY 18 +#define R_OR1K_GLOB_DAT 19 +#define R_OR1K_JMP_SLOT 20 +#define R_OR1K_RELATIVE 21 +#define R_OR1K_TLS_GD_HI16 22 +#define R_OR1K_TLS_GD_LO16 23 +#define R_OR1K_TLS_LDM_HI16 24 +#define R_OR1K_TLS_LDM_LO16 25 +#define R_OR1K_TLS_LDO_HI16 26 +#define R_OR1K_TLS_LDO_LO16 27 +#define R_OR1K_TLS_IE_HI16 28 +#define R_OR1K_TLS_IE_LO16 29 +#define R_OR1K_TLS_LE_HI16 30 +#define R_OR1K_TLS_LE_LO16 31 +#define R_OR1K_TLS_TPOFF 32 +#define R_OR1K_TLS_DTPOFF 33 +#define R_OR1K_TLS_DTPMOD 34 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ELF_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/endian.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/endian.h new file mode 100644 index 0000000..5ca6625 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/endian.h
@@ -0,0 +1,77 @@ +#ifndef SYSROOT_ENDIAN_H_ +#define SYSROOT_ENDIAN_H_ + +#include <features.h> + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __PDP_ENDIAN 3412 + +#if defined(__GNUC__) && defined(__BYTE_ORDER__) +#define __BYTE_ORDER __BYTE_ORDER__ +#else +#include <bits/endian.h> +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define BIG_ENDIAN __BIG_ENDIAN +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#include <stdint.h> + +static __inline uint16_t __bswap16(uint16_t __x) { return (uint16_t)(__x << 8 | __x >> 8); } + +static __inline uint32_t __bswap32(uint32_t __x) { + return (uint32_t)(__x >> 24 | ((__x >> 8) & 0xff00) | ((__x << 8) & 0xff0000) | __x << 24); +} + +static __inline uint64_t __bswap64(uint64_t __x) { + return ((uint64_t)__bswap32((uint32_t)__x)) << 32 | (uint64_t)__bswap32((uint32_t)(__x >> 32)); +} + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobe16(x) __bswap16(x) +#define be16toh(x) __bswap16(x) +#define betoh16(x) __bswap16(x) +#define htobe32(x) __bswap32(x) +#define be32toh(x) __bswap32(x) +#define betoh32(x) __bswap32(x) +#define htobe64(x) __bswap64(x) +#define be64toh(x) __bswap64(x) +#define betoh64(x) __bswap64(x) +#define htole16(x) (uint16_t)(x) +#define le16toh(x) (uint16_t)(x) +#define letoh16(x) (uint16_t)(x) +#define htole32(x) (uint32_t)(x) +#define le32toh(x) (uint32_t)(x) +#define letoh32(x) (uint32_t)(x) +#define htole64(x) (uint64_t)(x) +#define le64toh(x) (uint64_t)(x) +#define letoh64(x) (uint64_t)(x) +#else +#define htobe16(x) (uint16_t)(x) +#define be16toh(x) (uint16_t)(x) +#define betoh16(x) (uint16_t)(x) +#define htobe32(x) (uint32_t)(x) +#define be32toh(x) (uint32_t)(x) +#define betoh32(x) (uint32_t)(x) +#define htobe64(x) (uint64_t)(x) +#define be64toh(x) (uint64_t)(x) +#define betoh64(x) (uint64_t)(x) +#define htole16(x) __bswap16(x) +#define le16toh(x) __bswap16(x) +#define letoh16(x) __bswap16(x) +#define htole32(x) __bswap32(x) +#define le32toh(x) __bswap32(x) +#define letoh32(x) __bswap32(x) +#define htole64(x) __bswap64(x) +#define le64toh(x) __bswap64(x) +#define letoh64(x) __bswap64(x) +#endif + +#endif + +#endif // SYSROOT_ENDIAN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/err.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/err.h new file mode 100644 index 0000000..29842fe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/err.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_ERR_H_ +#define SYSROOT_ERR_H_ + +#include <features.h> +#include <stdarg.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void warn(const char*, ...); +void vwarn(const char*, va_list); +void warnx(const char*, ...); +void vwarnx(const char*, va_list); + +_Noreturn void err(int, const char*, ...); +_Noreturn void verr(int, const char*, va_list); +_Noreturn void errx(int, const char*, ...); +_Noreturn void verrx(int, const char*, va_list); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ERR_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/errno.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/errno.h new file mode 100644 index 0000000..af13f58 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/errno.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_ERRNO_H_ +#define SYSROOT_ERRNO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/errno.h> + +int* __errno_location(void); +#define errno (*__errno_location()) + +#ifdef _GNU_SOURCE +extern char *program_invocation_short_name, *program_invocation_name; +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ERRNO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/fcntl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fcntl.h new file mode 100644 index 0000000..e5e47bd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fcntl.h
@@ -0,0 +1,224 @@ +#ifndef SYSROOT_FCNTL_H_ +#define SYSROOT_FCNTL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_mode_t + +#ifdef _GNU_SOURCE +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec +#endif + +#include <bits/alltypes.h> + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +int creat(const char*, mode_t); +int fcntl(int, int, ...); +int open(const char*, int, ...); +int openat(int, const char*, int, ...); +int posix_fadvise(int, off_t, off_t, int); +int posix_fallocate(int, off_t, off_t); + +#define O_SEARCH O_PATH +#define O_EXEC O_PATH + +// clang-format off +#define O_ACCMODE (03 | O_SEARCH) +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 + +// Flags which align with ZXIO_FS_* +// system/ulib/fdio/unistd.c asserts that these flags are aligned +// with the ZXIO_FS_* versions. +#define O_CREAT 0x00010000 +#define O_EXCL 0x00020000 +#define O_TRUNC 0x00040000 +#define O_DIRECTORY 0x00080000 +#define O_APPEND 0x00100000 +#define O_PATH 0x00400000 +#ifdef _ALL_SOURCE +#define O_NOREMOTE 0x00200000 +#define O_ADMIN 0x00000004 +#endif + +// Flags which do not align with ZXIO_FS_* +#define O_NONBLOCK 0x00000010 +#define O_DSYNC 0x00000020 +#define O_SYNC (0x00000040 | O_DSYNC) +#define O_RSYNC O_SYNC +#define O_NOFOLLOW 0x00000080 +#define O_CLOEXEC 0x00000100 +#define O_NOCTTY 0x00000200 +#define O_ASYNC 0x00000400 +#define O_DIRECT 0x00000800 +#define O_LARGEFILE 0x00001000 +#define O_NOATIME 0x00002000 +#define O_TMPFILE 0x00004000 + +// clang-format on + +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 + +#define F_OFD_GETLK 36 +#define F_OFD_SETLK 37 +#define F_OFD_SETLKW 38 + +#define F_DUPFD_CLOEXEC 1030 + +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +#define FD_CLOEXEC 1 + +#define AT_FDCWD (-100) +#define AT_SYMLINK_NOFOLLOW 0x100 +#define AT_REMOVEDIR 0x200 +#define AT_SYMLINK_FOLLOW 0x400 +#define AT_EACCESS 0x200 + +#define POSIX_FADV_NORMAL 0 +#define POSIX_FADV_RANDOM 1 +#define POSIX_FADV_SEQUENTIAL 2 +#define POSIX_FADV_WILLNEED 3 +#define POSIX_FADV_DONTNEED 4 +#define POSIX_FADV_NOREUSE 5 + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define AT_NO_AUTOMOUNT 0x800 +#define AT_EMPTY_PATH 0x1000 + +#define FAPPEND O_APPEND +#define FFSYNC O_FSYNC +#define FASYNC O_ASYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 + +#define F_SETLEASE 1024 +#define F_GETLEASE 1025 +#define F_NOTIFY 1026 +#define F_CANCELLK 1029 +#define F_SETPIPE_SZ 1031 +#define F_GETPIPE_SZ 1032 +#define F_ADD_SEALS 1033 +#define F_GET_SEALS 1034 + +#define F_SEAL_SEAL 0x0001 +#define F_SEAL_SHRINK 0x0002 +#define F_SEAL_GROW 0x0004 +#define F_SEAL_WRITE 0x0008 + +#define DN_ACCESS 0x00000001 +#define DN_MODIFY 0x00000002 +#define DN_CREATE 0x00000004 +#define DN_DELETE 0x00000008 +#define DN_RENAME 0x00000010 +#define DN_ATTRIB 0x00000020 +#define DN_MULTISHOT 0x80000000 + +int lockf(int, int, off_t); +#endif + +#if defined(_GNU_SOURCE) +#define F_OWNER_TID 0 +#define F_OWNER_PID 1 +#define F_OWNER_PGRP 2 +#define F_OWNER_GID 2 +struct f_owner_ex { + int type; + pid_t pid; +}; +#define FALLOC_FL_KEEP_SIZE 1 +#define FALLOC_FL_PUNCH_HOLE 2 +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 +#define SYNC_FILE_RANGE_WRITE 2 +#define SYNC_FILE_RANGE_WAIT_AFTER 4 +#define SPLICE_F_MOVE 1 +#define SPLICE_F_NONBLOCK 2 +#define SPLICE_F_MORE 4 +#define SPLICE_F_GIFT 8 +int fallocate(int, int, off_t, off_t); +#define fallocate64 fallocate +ssize_t readahead(int, off_t, size_t); +int sync_file_range(int, off_t, off_t, unsigned); +ssize_t vmsplice(int, const struct iovec*, size_t, unsigned); +ssize_t splice(int, off_t*, int, off_t*, size_t, unsigned); +ssize_t tee(int, int, size_t, unsigned); +#define loff_t off_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FCNTL_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/features.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/features.h new file mode 100644 index 0000000..1520efb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/features.h
@@ -0,0 +1,35 @@ +#ifndef SYSROOT_FEATURES_H_ +#define SYSROOT_FEATURES_H_ + +#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE) +#define _GNU_SOURCE 1 +#endif + +#if !defined(_BSD_SOURCE) +#define _BSD_SOURCE 1 +#endif + +#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && \ + !defined(_GNU_SOURCE) && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__) +#define _BSD_SOURCE 1 +#define _XOPEN_SOURCE 700 +#endif + +#if __STDC_VERSION__ >= 199901L +#define __restrict restrict +#elif !defined(__GNUC__) +#define __restrict +#endif + +#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) +#define __inline inline +#endif + +#if __STDC_VERSION__ >= 201112L +#elif defined(__GNUC__) +#define _Noreturn __attribute__((__noreturn__)) +#else +#define _Noreturn +#endif + +#endif // SYSROOT_FEATURES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/fenv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fenv.h new file mode 100644 index 0000000..391f59f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fenv.h
@@ -0,0 +1,28 @@ +#ifndef SYSROOT_FENV_H_ +#define SYSROOT_FENV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <bits/fenv.h> + +int feclearexcept(int); +int fegetexceptflag(fexcept_t*, int); +int feraiseexcept(int); +int fesetexceptflag(const fexcept_t*, int); +int fetestexcept(int); + +int fegetround(void); +int fesetround(int); + +int fegetenv(fenv_t*); +int feholdexcept(fenv_t*); +int fesetenv(const fenv_t*); +int feupdateenv(const fenv_t*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FENV_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/fmtmsg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fmtmsg.h new file mode 100644 index 0000000..51abcc5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fmtmsg.h
@@ -0,0 +1,47 @@ +#ifndef SYSROOT_FMTMSG_H_ +#define SYSROOT_FMTMSG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MM_HARD 1 +#define MM_SOFT 2 +#define MM_FIRM 4 + +#define MM_APPL 8 +#define MM_UTIL 16 +#define MM_OPSYS 32 + +#define MM_RECOVER 64 +#define MM_NRECOV 128 + +#define MM_PRINT 256 +#define MM_CONSOLE 512 + +#define MM_NULLMC 0L + +#define MM_HALT 1 +#define MM_ERROR 2 +#define MM_WARNING 3 +#define MM_INFO 4 +#define MM_NOSEV 0 + +#define MM_OK 0 +#define MM_NOTOK (-1) +#define MM_NOMSG 1 +#define MM_NOCON 4 + +#define MM_NULLLBL ((char*)0) +#define MM_NULLTXT ((char*)0) +#define MM_NULLACT ((char*)0) +#define MM_NULLTAG ((char*)0) +#define MM_NULLSEV 0 + +int fmtmsg(long, const char*, int, const char*, const char*, const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FMTMSG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/fnmatch.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fnmatch.h new file mode 100644 index 0000000..2e0f6cc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/fnmatch.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_FNMATCH_H_ +#define SYSROOT_FNMATCH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define FNM_PATHNAME 0x1 +#define FNM_NOESCAPE 0x2 +#define FNM_PERIOD 0x4 +#define FNM_LEADING_DIR 0x8 +#define FNM_CASEFOLD 0x10 +#define FNM_FILE_NAME FNM_PATHNAME + +#define FNM_NOMATCH 1 +#define FNM_NOSYS (-1) + +int fnmatch(const char*, const char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_FNMATCH_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/getopt.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/getopt.h new file mode 100644 index 0000000..bcc632d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/getopt.h
@@ -0,0 +1,30 @@ +#ifndef SYSROOT_GETOPT_H_ +#define SYSROOT_GETOPT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int getopt(int, char* const[], const char*); +extern char* optarg; +extern int optind, opterr, optopt, optreset; + +struct option { + const char* name; + int has_arg; + int* flag; + int val; +}; + +int getopt_long(int, char* const*, const char*, const struct option*, int*); +int getopt_long_only(int, char* const*, const char*, const struct option*, int*); + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_GETOPT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/glob.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/glob.h new file mode 100644 index 0000000..98ff3f6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/glob.h
@@ -0,0 +1,43 @@ +#ifndef SYSROOT_GLOB_H_ +#define SYSROOT_GLOB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +typedef struct { + size_t gl_pathc; + char** gl_pathv; + size_t gl_offs; + int __dummy1; + void* __dummy2[5]; +} glob_t; + +int glob(const char* __restrict, int, int (*)(const char*, int), glob_t* __restrict); +void globfree(glob_t*); + +#define GLOB_ERR 0x01 +#define GLOB_MARK 0x02 +#define GLOB_NOSORT 0x04 +#define GLOB_DOOFFS 0x08 +#define GLOB_NOCHECK 0x10 +#define GLOB_APPEND 0x20 +#define GLOB_NOESCAPE 0x40 +#define GLOB_PERIOD 0x80 + +#define GLOB_NOSPACE 1 +#define GLOB_ABORTED 2 +#define GLOB_NOMATCH 3 +#define GLOB_NOSYS 4 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_GLOB_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/grp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/grp.h new file mode 100644 index 0000000..4cfdd08 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/grp.h
@@ -0,0 +1,51 @@ +#ifndef SYSROOT_GRP_H_ +#define SYSROOT_GRP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include <bits/alltypes.h> + +struct group { + char* gr_name; + char* gr_passwd; + gid_t gr_gid; + char** gr_mem; +}; + +struct group* getgrgid(gid_t); +struct group* getgrnam(const char*); + +int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**); +int getgrnam_r(const char*, struct group*, char*, size_t, struct group**); + +struct group* getgrent(void); +void endgrent(void); +void setgrent(void); + +#ifdef _GNU_SOURCE +struct group* fgetgrent(FILE* stream); +int putgrent(const struct group*, FILE*); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int getgrouplist(const char*, gid_t, gid_t*, int*); +int setgroups(size_t, const gid_t*); +int initgroups(const char*, gid_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_GRP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/iconv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/iconv.h new file mode 100644 index 0000000..c0c056b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/iconv.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_ICONV_H_ +#define SYSROOT_ICONV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +typedef void* iconv_t; + +iconv_t iconv_open(const char*, const char*); +size_t iconv(iconv_t, char** __restrict, size_t* __restrict, char** __restrict, size_t* __restrict); +int iconv_close(iconv_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_ICONV_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/ifaddrs.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ifaddrs.h new file mode 100644 index 0000000..908945e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ifaddrs.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_IFADDRS_H_ +#define SYSROOT_IFADDRS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <netinet/in.h> +#include <sys/socket.h> + +struct ifaddrs { + struct ifaddrs* ifa_next; + char* ifa_name; + unsigned ifa_flags; + struct sockaddr* ifa_addr; + struct sockaddr* ifa_netmask; + union { + struct sockaddr* ifu_broadaddr; + struct sockaddr* ifu_dstaddr; + } ifa_ifu; + void* ifa_data; +}; +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + +void freeifaddrs(struct ifaddrs* ifp); +int getifaddrs(struct ifaddrs** ifap); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_IFADDRS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/inttypes.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/inttypes.h new file mode 100644 index 0000000..43bf604 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/inttypes.h
@@ -0,0 +1,356 @@ +#ifndef SYSROOT_INTTYPES_H_ +#define SYSROOT_INTTYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define __NEED_wchar_t +#include <bits/alltypes.h> + +typedef struct { + intmax_t quot, rem; +} imaxdiv_t; + +intmax_t imaxabs(intmax_t); +imaxdiv_t imaxdiv(intmax_t, intmax_t); + +intmax_t strtoimax(const char* __restrict, char** __restrict, int); +uintmax_t strtoumax(const char* __restrict, char** __restrict, int); + +intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int); +uintmax_t wcstoumax(const wchar_t* __restrict, wchar_t** __restrict, int); + +// Clang predefines macros __<type>_FMT<letter>__ for each type, +// with <letter> being i and for signed types, and o, u, x, and X +// for unsigned types. That lets <inttypes.h> do its work without +// any special knowledge of what the underlying types are. +// Unfortunately, GCC does not define these macros. +#ifndef __INTMAX_FMTd__ + +#define __INT8_FMT_MODIFIER__ "hh" +#define __INT16_FMT_MODIFIER__ "h" +#define __INT32_FMT_MODIFIER__ "" + +#define __INT_LEAST8_FMT_MODIFIER__ __INT8_FMT_MODIFIER__ +#define __INT_LEAST16_FMT_MODIFIER__ __INT16_FMT_MODIFIER__ +#define __INT_LEAST32_FMT_MODIFIER__ __INT32_FMT_MODIFIER__ +#define __INT_LEAST64_FMT_MODIFIER__ __INT64_FMT_MODIFIER__ + +// The *-elf and arm-eabi GCC targets use 'int' for the fast{8,16,32} +// types. On LP64 systems, 'long' is used for the fast64 type. +#define __INT_FAST8_FMT_MODIFIER__ "" +#define __INT_FAST16_FMT_MODIFIER__ "" +#define __INT_FAST32_FMT_MODIFIER__ "" +#define __INT_FAST64_FMT_MODIFIER__ "l" + +// On machines where 'long' types are 64 bits, the compiler defines +// __INT64_TYPE__ et al using 'long', not 'long long', though both are +// 64-bit types. +#define __INT64_FMT_MODIFIER__ "l" +#define __INTPTR_FMT_MODIFIER__ "l" + +#define __INTMAX_FMT_MODIFIER__ __INT64_FMT_MODIFIER__ + +#define __INTMAX_FMTd__ __INTMAX_FMT_MODIFIER__ "d" +#define __INTMAX_FMTi__ __INTMAX_FMT_MODIFIER__ "i" +#define __UINTMAX_FMTo__ __INTMAX_FMT_MODIFIER__ "o" +#define __UINTMAX_FMTu__ __INTMAX_FMT_MODIFIER__ "u" +#define __UINTMAX_FMTx__ __INTMAX_FMT_MODIFIER__ "x" +#define __UINTMAX_FMTX__ __INTMAX_FMT_MODIFIER__ "X" +#define __INTPTR_FMTd__ __INTPTR_FMT_MODIFIER__ "d" +#define __INTPTR_FMTi__ __INTPTR_FMT_MODIFIER__ "i" +#define __UINTPTR_FMTo__ __INTPTR_FMT_MODIFIER__ "o" +#define __UINTPTR_FMTu__ __INTPTR_FMT_MODIFIER__ "u" +#define __UINTPTR_FMTx__ __INTPTR_FMT_MODIFIER__ "x" +#define __UINTPTR_FMTX__ __INTPTR_FMT_MODIFIER__ "X" +#define __INT8_FMTd__ __INT8_FMT_MODIFIER__ "d" +#define __INT8_FMTi__ __INT8_FMT_MODIFIER__ "i" +#define __INT16_FMTd__ __INT16_FMT_MODIFIER__ "d" +#define __INT16_FMTi__ __INT16_FMT_MODIFIER__ "i" +#define __INT32_FMTd__ __INT32_FMT_MODIFIER__ "d" +#define __INT32_FMTi__ __INT32_FMT_MODIFIER__ "i" +#define __INT64_FMTd__ __INT64_FMT_MODIFIER__ "d" +#define __INT64_FMTi__ __INT64_FMT_MODIFIER__ "i" +#define __UINT8_FMTo__ __INT8_FMT_MODIFIER__ "o" +#define __UINT8_FMTu__ __INT8_FMT_MODIFIER__ "u" +#define __UINT8_FMTx__ __INT8_FMT_MODIFIER__ "x" +#define __UINT8_FMTX__ __INT8_FMT_MODIFIER__ "X" +#define __UINT16_FMTo__ __INT16_FMT_MODIFIER__ "o" +#define __UINT16_FMTu__ __INT16_FMT_MODIFIER__ "u" +#define __UINT16_FMTx__ __INT16_FMT_MODIFIER__ "x" +#define __UINT16_FMTX__ __INT16_FMT_MODIFIER__ "X" +#define __UINT32_FMTo__ __INT32_FMT_MODIFIER__ "o" +#define __UINT32_FMTu__ __INT32_FMT_MODIFIER__ "u" +#define __UINT32_FMTx__ __INT32_FMT_MODIFIER__ "x" +#define __UINT32_FMTX__ __INT32_FMT_MODIFIER__ "X" +#define __UINT64_FMTo__ __INT64_FMT_MODIFIER__ "o" +#define __UINT64_FMTu__ __INT64_FMT_MODIFIER__ "u" +#define __UINT64_FMTx__ __INT64_FMT_MODIFIER__ "x" +#define __UINT64_FMTX__ __INT64_FMT_MODIFIER__ "X" +#define __INT_LEAST8_FMTd__ __INT_LEAST8_FMT_MODIFIER__ "d" +#define __INT_LEAST8_FMTi__ __INT_LEAST8_FMT_MODIFIER__ "i" +#define __UINT_LEAST8_FMTo__ __INT_LEAST8_FMT_MODIFIER__ "o" +#define __UINT_LEAST8_FMTu__ __INT_LEAST8_FMT_MODIFIER__ "u" +#define __UINT_LEAST8_FMTx__ __INT_LEAST8_FMT_MODIFIER__ "x" +#define __UINT_LEAST8_FMTX__ __INT_LEAST8_FMT_MODIFIER__ "X" +#define __INT_LEAST16_FMTd__ __INT_LEAST16_FMT_MODIFIER__ "d" +#define __INT_LEAST16_FMTi__ __INT_LEAST16_FMT_MODIFIER__ "i" +#define __UINT_LEAST16_FMTo__ __INT_LEAST16_FMT_MODIFIER__ "o" +#define __UINT_LEAST16_FMTu__ __INT_LEAST16_FMT_MODIFIER__ "u" +#define __UINT_LEAST16_FMTx__ __INT_LEAST16_FMT_MODIFIER__ "x" +#define __UINT_LEAST16_FMTX__ __INT_LEAST16_FMT_MODIFIER__ "X" +#define __INT_LEAST32_FMTd__ __INT_LEAST32_FMT_MODIFIER__ "d" +#define __INT_LEAST32_FMTi__ __INT_LEAST32_FMT_MODIFIER__ "i" +#define __UINT_LEAST32_FMTo__ __INT_LEAST32_FMT_MODIFIER__ "o" +#define __UINT_LEAST32_FMTu__ __INT_LEAST32_FMT_MODIFIER__ "u" +#define __UINT_LEAST32_FMTx__ __INT_LEAST32_FMT_MODIFIER__ "x" +#define __UINT_LEAST32_FMTX__ __INT_LEAST32_FMT_MODIFIER__ "X" +#define __INT_LEAST64_FMTd__ __INT_LEAST64_FMT_MODIFIER__ "d" +#define __INT_LEAST64_FMTi__ __INT_LEAST64_FMT_MODIFIER__ "i" +#define __UINT_LEAST64_FMTo__ __INT_LEAST64_FMT_MODIFIER__ "o" +#define __UINT_LEAST64_FMTu__ __INT_LEAST64_FMT_MODIFIER__ "u" +#define __UINT_LEAST64_FMTx__ __INT_LEAST64_FMT_MODIFIER__ "x" +#define __UINT_LEAST64_FMTX__ __INT_LEAST64_FMT_MODIFIER__ "X" +#define __INT_FAST8_FMTd__ __INT_FAST8_FMT_MODIFIER__ "d" +#define __INT_FAST8_FMTi__ __INT_FAST8_FMT_MODIFIER__ "i" +#define __UINT_FAST8_FMTo__ __INT_FAST8_FMT_MODIFIER__ "o" +#define __UINT_FAST8_FMTu__ __INT_FAST8_FMT_MODIFIER__ "u" +#define __UINT_FAST8_FMTx__ __INT_FAST8_FMT_MODIFIER__ "x" +#define __UINT_FAST8_FMTX__ __INT_FAST8_FMT_MODIFIER__ "X" +#define __INT_FAST16_FMTd__ __INT_FAST16_FMT_MODIFIER__ "d" +#define __INT_FAST16_FMTi__ __INT_FAST16_FMT_MODIFIER__ "i" +#define __UINT_FAST16_FMTo__ __INT_FAST16_FMT_MODIFIER__ "o" +#define __UINT_FAST16_FMTu__ __INT_FAST16_FMT_MODIFIER__ "u" +#define __UINT_FAST16_FMTx__ __INT_FAST16_FMT_MODIFIER__ "x" +#define __UINT_FAST16_FMTX__ __INT_FAST16_FMT_MODIFIER__ "X" +#define __INT_FAST32_FMTd__ __INT_FAST32_FMT_MODIFIER__ "d" +#define __INT_FAST32_FMTi__ __INT_FAST32_FMT_MODIFIER__ "i" +#define __UINT_FAST32_FMTo__ __INT_FAST32_FMT_MODIFIER__ "o" +#define __UINT_FAST32_FMTu__ __INT_FAST32_FMT_MODIFIER__ "u" +#define __UINT_FAST32_FMTx__ __INT_FAST32_FMT_MODIFIER__ "x" +#define __UINT_FAST32_FMTX__ __INT_FAST32_FMT_MODIFIER__ "X" +#define __INT_FAST64_FMTd__ __INT_FAST64_FMT_MODIFIER__ "d" +#define __INT_FAST64_FMTi__ __INT_FAST64_FMT_MODIFIER__ "i" +#define __UINT_FAST64_FMTo__ __INT_FAST64_FMT_MODIFIER__ "o" +#define __UINT_FAST64_FMTu__ __INT_FAST64_FMT_MODIFIER__ "u" +#define __UINT_FAST64_FMTx__ __INT_FAST64_FMT_MODIFIER__ "x" +#define __UINT_FAST64_FMTX__ __INT_FAST64_FMT_MODIFIER__ "X" + +#endif + +#define PRId8 __INT8_FMTd__ +#define PRId16 __INT16_FMTd__ +#define PRId32 __INT32_FMTd__ +#define PRId64 __INT64_FMTd__ + +#define PRIdLEAST8 __INT_LEAST8_FMTd__ +#define PRIdLEAST16 __INT_LEAST16_FMTd__ +#define PRIdLEAST32 __INT_LEAST32_FMTd__ +#define PRIdLEAST64 __INT_LEAST64_FMTd__ + +#define PRIdFAST8 __INT_FAST8_FMTd__ +#define PRIdFAST16 __INT_FAST16_FMTd__ +#define PRIdFAST32 __INT_FAST32_FMTd__ +#define PRIdFAST64 __INT_FAST64_FMTd__ + +#define PRIi8 __INT8_FMTi__ +#define PRIi16 __INT16_FMTi__ +#define PRIi32 __INT32_FMTi__ +#define PRIi64 __INT64_FMTi__ + +#define PRIiLEAST8 __INT_LEAST8_FMTi__ +#define PRIiLEAST16 __INT_LEAST16_FMTi__ +#define PRIiLEAST32 __INT_LEAST32_FMTi__ +#define PRIiLEAST64 __INT_LEAST64_FMTi__ + +#define PRIiFAST8 __INT_FAST8_FMTi__ +#define PRIiFAST16 __INT_FAST16_FMTi__ +#define PRIiFAST32 __INT_FAST32_FMTi__ +#define PRIiFAST64 __INT_FAST64_FMTi__ + +#define PRIo8 __UINT8_FMTo__ +#define PRIo16 __UINT16_FMTo__ +#define PRIo32 __UINT32_FMTo__ +#define PRIo64 __UINT64_FMTo__ + +#define PRIoLEAST8 __UINT_LEAST8_FMTo__ +#define PRIoLEAST16 __UINT_LEAST16_FMTo__ +#define PRIoLEAST32 __UINT_LEAST32_FMTo__ +#define PRIoLEAST64 __UINT_LEAST64_FMTo__ + +#define PRIoFAST8 __UINT_FAST8_FMTo__ +#define PRIoFAST16 __UINT_FAST16_FMTo__ +#define PRIoFAST32 __UINT_FAST32_FMTo__ +#define PRIoFAST64 __UINT_FAST64_FMTo__ + +#define PRIu8 __UINT8_FMTu__ +#define PRIu16 __UINT16_FMTu__ +#define PRIu32 __UINT32_FMTu__ +#define PRIu64 __UINT64_FMTu__ + +#define PRIuLEAST8 __UINT_LEAST8_FMTu__ +#define PRIuLEAST16 __UINT_LEAST16_FMTu__ +#define PRIuLEAST32 __UINT_LEAST32_FMTu__ +#define PRIuLEAST64 __UINT_LEAST64_FMTu__ + +#define PRIuFAST8 __UINT_FAST8_FMTu__ +#define PRIuFAST16 __UINT_FAST16_FMTu__ +#define PRIuFAST32 __UINT_FAST32_FMTu__ +#define PRIuFAST64 __UINT_FAST64_FMTu__ + +#define PRIx8 __UINT8_FMTx__ +#define PRIx16 __UINT16_FMTx__ +#define PRIx32 __UINT32_FMTx__ +#define PRIx64 __UINT64_FMTx__ + +#define PRIxLEAST8 __UINT_LEAST8_FMTx__ +#define PRIxLEAST16 __UINT_LEAST16_FMTx__ +#define PRIxLEAST32 __UINT_LEAST32_FMTx__ +#define PRIxLEAST64 __UINT_LEAST64_FMTx__ + +#define PRIxFAST8 __UINT_FAST8_FMTx__ +#define PRIxFAST16 __UINT_FAST16_FMTx__ +#define PRIxFAST32 __UINT_FAST32_FMTx__ +#define PRIxFAST64 __UINT_FAST64_FMTx__ + +#define PRIX8 __UINT8_FMTX__ +#define PRIX16 __UINT16_FMTX__ +#define PRIX32 __UINT32_FMTX__ +#define PRIX64 __UINT64_FMTX__ + +#define PRIXLEAST8 __UINT_LEAST8_FMTX__ +#define PRIXLEAST16 __UINT_LEAST16_FMTX__ +#define PRIXLEAST32 __UINT_LEAST32_FMTX__ +#define PRIXLEAST64 __UINT_LEAST64_FMTX__ + +#define PRIXFAST8 __UINT_FAST8_FMTX__ +#define PRIXFAST16 __UINT_FAST16_FMTX__ +#define PRIXFAST32 __UINT_FAST32_FMTX__ +#define PRIXFAST64 __UINT_FAST64_FMTX__ + +#define PRIdMAX __INTMAX_FMTd__ +#define PRIiMAX __INTMAX_FMTi__ +#define PRIoMAX __UINTMAX_FMTo__ +#define PRIuMAX __UINTMAX_FMTu__ +#define PRIxMAX __UINTMAX_FMTx__ +#define PRIXMAX __UINTMAX_FMTX__ + +#define PRIdPTR __INTPTR_FMTd__ +#define PRIiPTR __INTPTR_FMTi__ +#define PRIoPTR __UINTPTR_FMTo__ +#define PRIuPTR __UINTPTR_FMTu__ +#define PRIxPTR __UINTPTR_FMTx__ +#define PRIXPTR __UINTPTR_FMTX__ + +#define SCNd8 __INT8_FMTd__ +#define SCNd16 __INT16_FMTd__ +#define SCNd32 __INT32_FMTd__ +#define SCNd64 __INT64_FMTd__ + +#define SCNdLEAST8 __INT_LEAST8_FMTd__ +#define SCNdLEAST16 __INT_LEAST16_FMTd__ +#define SCNdLEAST32 __INT_LEAST32_FMTd__ +#define SCNdLEAST64 __INT_LEAST64_FMTd__ + +#define SCNdFAST8 __INT_FAST8_FMTd__ +#define SCNdFAST16 __INT_FAST16_FMTd__ +#define SCNdFAST32 __INT_FAST32_FMTd__ +#define SCNdFAST64 __INT_FAST64_FMTd__ + +#define SCNi8 __INT8_FMTi__ +#define SCNi16 __INT16_FMTi__ +#define SCNi32 __INT32_FMTi__ +#define SCNi64 __INT64_FMTi__ + +#define SCNiLEAST8 __INT_LEAST8_FMTi__ +#define SCNiLEAST16 __INT_LEAST16_FMTi__ +#define SCNiLEAST32 __INT_LEAST32_FMTi__ +#define SCNiLEAST64 __INT_LEAST64_FMTi__ + +#define SCNiFAST8 __INT_FAST8_FMTi__ +#define SCNiFAST16 __INT_FAST16_FMTi__ +#define SCNiFAST32 __INT_FAST32_FMTi__ +#define SCNiFAST64 __INT_FAST64_FMTi__ + +#define SCNo8 __UINT8_FMTo__ +#define SCNo16 __UINT16_FMTo__ +#define SCNo32 __UINT32_FMTo__ +#define SCNo64 __UINT64_FMTo__ + +#define SCNoLEAST8 __UINT_LEAST8_FMTo__ +#define SCNoLEAST16 __UINT_LEAST16_FMTo__ +#define SCNoLEAST32 __UINT_LEAST32_FMTo__ +#define SCNoLEAST64 __UINT_LEAST64_FMTo__ + +#define SCNoFAST8 __UINT_FAST8_FMTo__ +#define SCNoFAST16 __UINT_FAST16_FMTo__ +#define SCNoFAST32 __UINT_FAST32_FMTo__ +#define SCNoFAST64 __UINT_FAST64_FMTo__ + +#define SCNu8 __UINT8_FMTu__ +#define SCNu16 __UINT16_FMTu__ +#define SCNu32 __UINT32_FMTu__ +#define SCNu64 __UINT64_FMTu__ + +#define SCNuLEAST8 __UINT_LEAST8_FMTu__ +#define SCNuLEAST16 __UINT_LEAST16_FMTu__ +#define SCNuLEAST32 __UINT_LEAST32_FMTu__ +#define SCNuLEAST64 __UINT_LEAST64_FMTu__ + +#define SCNuFAST8 __UINT_FAST8_FMTu__ +#define SCNuFAST16 __UINT_FAST16_FMTu__ +#define SCNuFAST32 __UINT_FAST32_FMTu__ +#define SCNuFAST64 __UINT_FAST64_FMTu__ + +#define SCNx8 __UINT8_FMTx__ +#define SCNx16 __UINT16_FMTx__ +#define SCNx32 __UINT32_FMTx__ +#define SCNx64 __UINT64_FMTx__ + +#define SCNxLEAST8 __UINT_LEAST8_FMTx__ +#define SCNxLEAST16 __UINT_LEAST16_FMTx__ +#define SCNxLEAST32 __UINT_LEAST32_FMTx__ +#define SCNxLEAST64 __UINT_LEAST64_FMTx__ + +#define SCNxFAST8 __UINT_FAST8_FMTx__ +#define SCNxFAST16 __UINT_FAST16_FMTx__ +#define SCNxFAST32 __UINT_FAST32_FMTx__ +#define SCNxFAST64 __UINT_FAST64_FMTx__ + +#define SCNX8 __UINT8_FMTX__ +#define SCNX16 __UINT16_FMTX__ +#define SCNX32 __UINT32_FMTX__ +#define SCNX64 __UINT64_FMTX__ + +#define SCNXLEAST8 __UINT_LEAST8_FMTX__ +#define SCNXLEAST16 __UINT_LEAST16_FMTX__ +#define SCNXLEAST32 __UINT_LEAST32_FMTX__ +#define SCNXLEAST64 __UINT_LEAST64_FMTX__ + +#define SCNXFAST8 __UINT_FAST8_FMTX__ +#define SCNXFAST16 __UINT_FAST16_FMTX__ +#define SCNXFAST32 __UINT_FAST32_FMTX__ +#define SCNXFAST64 __UINT_FAST64_FMTX__ + +#define SCNdMAX __INTMAX_FMTd__ +#define SCNiMAX __INTMAX_FMTi__ +#define SCNoMAX __UINTMAX_FMTo__ +#define SCNuMAX __UINTMAX_FMTu__ +#define SCNxMAX __UINTMAX_FMTx__ +#define SCNXMAX __UINTMAX_FMTX__ + +#define SCNdPTR __INTPTR_FMTd__ +#define SCNiPTR __INTPTR_FMTi__ +#define SCNoPTR __UINTPTR_FMTo__ +#define SCNuPTR __UINTPTR_FMTu__ +#define SCNxPTR __UINTPTR_FMTx__ +#define SCNXPTR __UINTPTR_FMTX__ + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_INTTYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/iso646.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/iso646.h new file mode 100644 index 0000000..8b7dda8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/iso646.h
@@ -0,0 +1,20 @@ +#ifndef SYSROOT_ISO646_H_ +#define SYSROOT_ISO646_H_ + +#ifndef __cplusplus + +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= + +#endif + +#endif // SYSROOT_ISO646_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/langinfo.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/langinfo.h new file mode 100644 index 0000000..a14fcfd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/langinfo.h
@@ -0,0 +1,92 @@ +#ifndef SYSROOT_LANGINFO_H_ +#define SYSROOT_LANGINFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <nl_types.h> + +#define __NEED_locale_t + +#include <bits/alltypes.h> + +#define ABDAY_1 0x20000 +#define ABDAY_2 0x20001 +#define ABDAY_3 0x20002 +#define ABDAY_4 0x20003 +#define ABDAY_5 0x20004 +#define ABDAY_6 0x20005 +#define ABDAY_7 0x20006 + +#define DAY_1 0x20007 +#define DAY_2 0x20008 +#define DAY_3 0x20009 +#define DAY_4 0x2000A +#define DAY_5 0x2000B +#define DAY_6 0x2000C +#define DAY_7 0x2000D + +#define ABMON_1 0x2000E +#define ABMON_2 0x2000F +#define ABMON_3 0x20010 +#define ABMON_4 0x20011 +#define ABMON_5 0x20012 +#define ABMON_6 0x20013 +#define ABMON_7 0x20014 +#define ABMON_8 0x20015 +#define ABMON_9 0x20016 +#define ABMON_10 0x20017 +#define ABMON_11 0x20018 +#define ABMON_12 0x20019 + +#define MON_1 0x2001A +#define MON_2 0x2001B +#define MON_3 0x2001C +#define MON_4 0x2001D +#define MON_5 0x2001E +#define MON_6 0x2001F +#define MON_7 0x20020 +#define MON_8 0x20021 +#define MON_9 0x20022 +#define MON_10 0x20023 +#define MON_11 0x20024 +#define MON_12 0x20025 + +#define AM_STR 0x20026 +#define PM_STR 0x20027 + +#define D_T_FMT 0x20028 +#define D_FMT 0x20029 +#define T_FMT 0x2002A +#define T_FMT_AMPM 0x2002B + +#define ERA 0x2002C +#define ERA_D_FMT 0x2002E +#define ALT_DIGITS 0x2002F +#define ERA_D_T_FMT 0x20030 +#define ERA_T_FMT 0x20031 + +#define CODESET 14 + +#define CRNCYSTR 0x4000F + +#define RADIXCHAR 0x10000 +#define THOUSEP 0x10001 +#define YESEXPR 0x50000 +#define NOEXPR 0x50001 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define YESSTR 0x50002 +#define NOSTR 0x50003 +#endif + +char* nl_langinfo(nl_item); +char* nl_langinfo_l(nl_item, locale_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LANGINFO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/libgen.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/libgen.h new file mode 100644 index 0000000..f7f79b6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/libgen.h
@@ -0,0 +1,15 @@ +#ifndef SYSROOT_LIBGEN_H_ +#define SYSROOT_LIBGEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +char* dirname(char*); +char* basename(char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LIBGEN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/limits.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/limits.h new file mode 100644 index 0000000..cf60386 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/limits.h
@@ -0,0 +1,153 @@ +#ifndef SYSROOT_LIMITS_H_ +#define SYSROOT_LIMITS_H_ + +#include <features.h> + +/* Most limits are system-specific */ + +#include <bits/limits.h> + +/* Support signed or unsigned plain-char */ + +#if '\0' - 1 > 0 +#define CHAR_MIN 0 +#define CHAR_MAX 255 +#else +#define CHAR_MIN (-128) +#define CHAR_MAX 127 +#endif + +/* Some universal constants... */ + +#define CHAR_BIT 8 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 255 +#define SHRT_MIN (-1 - 0x7fff) +#define SHRT_MAX 0x7fff +#define USHRT_MAX 0xffff +#define INT_MIN (-1 - 0x7fffffff) +#define INT_MAX 0x7fffffff +#define UINT_MAX 0xffffffffU +#define LONG_MIN (-LONG_MAX - 1) +#define ULONG_MAX (2UL * LONG_MAX + 1) +#define LLONG_MIN (-LLONG_MAX - 1) +#define ULLONG_MAX (2ULL * LLONG_MAX + 1) + +#define MB_LEN_MAX 4 + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define PIPE_BUF 4096 +#ifdef PAGE_SIZE +#define PAGESIZE PAGE_SIZE +#endif +#define FILESIZEBITS 64 +#define NAME_MAX 255 +#define SYMLINK_MAX 255 +#define PATH_MAX 4096 +#define NZERO 20 +#define NGROUPS_MAX 32 +#define IOV_MAX 1024 +#define SYMLOOP_MAX 40 +#define WORD_BIT 32 +#define SSIZE_MAX LONG_MAX +#define TZNAME_MAX 6 +#define TTY_NAME_MAX 32 +#define HOST_NAME_MAX 255 + +/* Implementation choices... */ + +#define PTHREAD_KEYS_MAX 128 +#define PTHREAD_STACK_MIN 3072 +#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +#define SEM_VALUE_MAX 0x7fffffff +#define SEM_NSEMS_MAX 256 +#define DELAYTIMER_MAX 0x7fffffff +#define MQ_PRIO_MAX 32768 +#define LOGIN_NAME_MAX 256 + +/* Arbitrary numbers... */ + +#define BC_BASE_MAX 99 +#define BC_DIM_MAX 2048 +#define BC_SCALE_MAX 99 +#define BC_STRING_MAX 1000 +#define CHARCLASS_NAME_MAX 14 +#define COLL_WEIGHTS_MAX 2 +#define EXPR_NEST_MAX 32 +#define LINE_MAX 4096 +#define RE_DUP_MAX 255 + +#define NL_ARGMAX 9 +#define NL_LANGMAX 32 +#define NL_MSGMAX 32767 +#define NL_SETMAX 255 +#define NL_TEXTMAX 2048 + +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) + +#define NL_NMAX 16 + +#endif + +/* POSIX/SUS requirements follow. These numbers come directly + * from SUS and have nothing to do with the host system. */ + +#define _POSIX_AIO_LISTIO_MAX 2 +#define _POSIX_AIO_MAX 1 +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 25 +#define _POSIX_CLOCKRES_MIN 20000000 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_HOST_NAME_MAX 255 +#define _POSIX_LINK_MAX 8 +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_MQ_OPEN_MAX 8 +#define _POSIX_MQ_PRIO_MAX 32 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 8 +#define _POSIX_OPEN_MAX 20 +#define _POSIX_PATH_MAX 256 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_RE_DUP_MAX 255 +#define _POSIX_RTSIG_MAX 8 +#define _POSIX_SEM_NSEMS_MAX 256 +#define _POSIX_SEM_VALUE_MAX 32767 +#define _POSIX_SIGQUEUE_MAX 32 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_SS_REPL_MAX 4 +#define _POSIX_SYMLINK_MAX 255 +#define _POSIX_SYMLOOP_MAX 8 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 128 +#define _POSIX_THREAD_THREADS_MAX 64 +#define _POSIX_TIMER_MAX 32 +#define _POSIX_TRACE_EVENT_NAME_MAX 30 +#define _POSIX_TRACE_NAME_MAX 8 +#define _POSIX_TRACE_SYS_MAX 8 +#define _POSIX_TRACE_USER_EVENT_MAX 32 +#define _POSIX_TTY_NAME_MAX 9 +#define _POSIX_TZNAME_MAX 6 +#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_CHARCLASS_NAME_MAX 14 +#define _POSIX2_COLL_WEIGHTS_MAX 2 +#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_RE_DUP_MAX 255 + +#define _XOPEN_IOV_MAX 16 +#define _XOPEN_NAME_MAX 255 +#define _XOPEN_PATH_MAX 1024 + +#endif // SYSROOT_LIMITS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/link.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/link.h new file mode 100644 index 0000000..78ebd48 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/link.h
@@ -0,0 +1,61 @@ +#ifndef SYSROOT_LINK_H_ +#define SYSROOT_LINK_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <elf.h> +#define __NEED_size_t +#define __NEED_uint32_t +#include <bits/alltypes.h> + +#define ElfW(type) Elf64_##type + +/* this is the same everywhere except alpha and s390 */ +typedef uint32_t Elf_Symndx; + +struct dl_phdr_info { + ElfW(Addr) dlpi_addr; + const char* dlpi_name; + const ElfW(Phdr) * dlpi_phdr; + ElfW(Half) dlpi_phnum; + unsigned long long int dlpi_adds; + unsigned long long int dlpi_subs; + size_t dlpi_tls_modid; + void* dlpi_tls_data; +}; + +struct link_map { + ElfW(Addr) l_addr; + char* l_name; + ElfW(Dyn) * l_ld; + struct link_map *l_next, *l_prev; +}; + +struct r_debug { + int r_version; + struct link_map* r_map; + ElfW(Addr) r_brk; + + /* This is the address of a function internal to the run-time linker + that triggers a debug trap. This function will always be called + when the linker begins to map in a library or unmap it, and again + when the mapping change is complete. + + The debugger can compare the address of a sw exception to this value + to determine whether the debug trap was triggered by the run-time + linker. */ + ElfW(Addr) r_brk_on_load; + + enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state; + ElfW(Addr) r_ldbase; +}; + +int dl_iterate_phdr(int (*)(struct dl_phdr_info*, size_t, void*), void*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LINK_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/locale.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/locale.h new file mode 100644 index 0000000..ce78a02 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/locale.h
@@ -0,0 +1,79 @@ +#ifndef SYSROOT_LOCALE_H_ +#define SYSROOT_LOCALE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define LC_CTYPE 0 +#define LC_NUMERIC 1 +#define LC_TIME 2 +#define LC_COLLATE 3 +#define LC_MONETARY 4 +#define LC_MESSAGES 5 +#define LC_ALL 6 + +struct lconv { + char* decimal_point; + char* thousands_sep; + char* grouping; + + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +}; + +char* setlocale(int, const char*); +struct lconv* localeconv(void); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define __NEED_locale_t + +#include <bits/alltypes.h> + +#define LC_GLOBAL_LOCALE ((locale_t)-1) + +#define LC_CTYPE_MASK (1 << LC_CTYPE) +#define LC_NUMERIC_MASK (1 << LC_NUMERIC) +#define LC_TIME_MASK (1 << LC_TIME) +#define LC_COLLATE_MASK (1 << LC_COLLATE) +#define LC_MONETARY_MASK (1 << LC_MONETARY) +#define LC_MESSAGES_MASK (1 << LC_MESSAGES) +#define LC_ALL_MASK 0x7fffffff + +locale_t duplocale(locale_t); +void freelocale(locale_t); +locale_t newlocale(int, const char*, locale_t); +locale_t uselocale(locale_t); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_LOCALE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/malloc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/malloc.h new file mode 100644 index 0000000..6abb854 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/malloc.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_MALLOC_H_ +#define SYSROOT_MALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t + +#include <bits/alltypes.h> + +void* malloc(size_t); +void* calloc(size_t, size_t); +void* realloc(void*, size_t); +void free(void*); +void* valloc(size_t); +void* memalign(size_t, size_t); + +size_t malloc_usable_size(void*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_MALLOC_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/math.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/math.h new file mode 100644 index 0000000..089c266 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/math.h
@@ -0,0 +1,430 @@ +#ifndef SYSROOT_MATH_H_ +#define SYSROOT_MATH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_float_t +#define __NEED_double_t +#include <bits/alltypes.h> + +#if 100 * __GNUC__ + __GNUC_MINOR__ >= 303 +#define NAN __builtin_nanf("") +#define INFINITY __builtin_inff() +#else +#define NAN (0.0f / 0.0f) +#define INFINITY 1e5000f +#endif + +#define HUGE_VALF INFINITY +#define HUGE_VAL ((double)INFINITY) +#define HUGE_VALL ((long double)INFINITY) + +#define MATH_ERRNO 1 +#define MATH_ERREXCEPT 2 +#define math_errhandling 2 + +#define FP_ILOGBNAN (-1 - (int)(((unsigned)-1) >> 1)) +#define FP_ILOGB0 FP_ILOGBNAN + +#define FP_NAN 0 +#define FP_INFINITE 1 +#define FP_ZERO 2 +#define FP_SUBNORMAL 3 +#define FP_NORMAL 4 + +int __fpclassify(double); +int __fpclassifyf(float); +int __fpclassifyl(long double); + +static __inline unsigned __FLOAT_BITS(float __f) { + union { + float __f; + unsigned __i; + } __u; + __u.__f = __f; + return __u.__i; +} +static __inline unsigned long long __DOUBLE_BITS(double __f) { + union { + double __f; + unsigned long long __i; + } __u; + __u.__f = __f; + return __u.__i; +} + +#define fpclassify(x) \ + (sizeof(x) == sizeof(float) ? __fpclassifyf(x) \ + : sizeof(x) == sizeof(double) ? __fpclassify(x) : __fpclassifyl(x)) + +#define isinf(x) \ + (sizeof(x) == sizeof(float) \ + ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 \ + : sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL >> 1) == 0x7ffULL << 52 \ + : __fpclassifyl(x) == FP_INFINITE) + +#define isnan(x) \ + (sizeof(x) == sizeof(float) \ + ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 \ + : sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL >> 1) > 0x7ffULL << 52 \ + : __fpclassifyl(x) == FP_NAN) + +#define isnormal(x) \ + (sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x) + 0x00800000) & 0x7fffffff) >= 0x01000000 \ + : sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x) + (1ULL << 52)) & \ + -1ULL >> 1) >= 1ULL << 53 \ + : __fpclassifyl(x) == FP_NORMAL) + +#define isfinite(x) \ + (sizeof(x) == sizeof(float) \ + ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 \ + : sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL >> 1) < 0x7ffULL << 52 \ + : __fpclassifyl(x) > FP_INFINITE) + +int __signbit(double); +int __signbitf(float); +int __signbitl(long double); + +#define signbit(x) \ + (sizeof(x) == sizeof(float) \ + ? (int)(__FLOAT_BITS(x) >> 31) \ + : sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x) >> 63) : __signbitl(x)) + +#define isunordered(x, y) __builtin_isunordered(x, y) + +#define __ISREL_DEF(rel, op, type) \ + static __inline int __is##rel(type __x, type __y) { return !isunordered(__x, __y) && __x op __y; } + +__ISREL_DEF(lessf, <, float_t) +__ISREL_DEF(less, <, double_t) +__ISREL_DEF(lessl, <, long double) +__ISREL_DEF(lessequalf, <=, float_t) +__ISREL_DEF(lessequal, <=, double_t) +__ISREL_DEF(lessequall, <=, long double) +__ISREL_DEF(lessgreaterf, !=, float_t) +__ISREL_DEF(lessgreater, !=, double_t) +__ISREL_DEF(lessgreaterl, !=, long double) +__ISREL_DEF(greaterf, >, float_t) +__ISREL_DEF(greater, >, double_t) +__ISREL_DEF(greaterl, >, long double) +__ISREL_DEF(greaterequalf, >=, float_t) +__ISREL_DEF(greaterequal, >=, double_t) +__ISREL_DEF(greaterequall, >=, long double) + +#define isless(x, y) __builtin_isless(x, y) +#define islessequal(x, y) __builtin_islessequal(x, y) +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#define isgreater(x, y) __builtin_isgreater(x, y) +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) + +double acos(double); +float acosf(float); +long double acosl(long double); + +double acosh(double); +float acoshf(float); +long double acoshl(long double); + +double asin(double); +float asinf(float); +long double asinl(long double); + +double asinh(double); +float asinhf(float); +long double asinhl(long double); + +double atan(double); +float atanf(float); +long double atanl(long double); + +double atan2(double, double); +float atan2f(float, float); +long double atan2l(long double, long double); + +double atanh(double); +float atanhf(float); +long double atanhl(long double); + +double cbrt(double); +float cbrtf(float); +long double cbrtl(long double); + +double ceil(double); +float ceilf(float); +long double ceill(long double); + +double copysign(double, double); +float copysignf(float, float); +long double copysignl(long double, long double); + +double cos(double); +float cosf(float); +long double cosl(long double); + +double cosh(double); +float coshf(float); +long double coshl(long double); + +double erf(double); +float erff(float); +long double erfl(long double); + +double erfc(double); +float erfcf(float); +long double erfcl(long double); + +double exp(double); +float expf(float); +long double expl(long double); + +double exp2(double); +float exp2f(float); +long double exp2l(long double); + +double expm1(double); +float expm1f(float); +long double expm1l(long double); + +double fabs(double); +float fabsf(float); +long double fabsl(long double); + +double fdim(double, double); +float fdimf(float, float); +long double fdiml(long double, long double); + +double floor(double); +float floorf(float); +long double floorl(long double); + +double fma(double, double, double); +float fmaf(float, float, float); +long double fmal(long double, long double, long double); + +double fmax(double, double); +float fmaxf(float, float); +long double fmaxl(long double, long double); + +double fmin(double, double); +float fminf(float, float); +long double fminl(long double, long double); + +double fmod(double, double); +float fmodf(float, float); +long double fmodl(long double, long double); + +double frexp(double, int*); +float frexpf(float, int*); +long double frexpl(long double, int*); + +double hypot(double, double); +float hypotf(float, float); +long double hypotl(long double, long double); + +int ilogb(double); +int ilogbf(float); +int ilogbl(long double); + +double ldexp(double, int); +float ldexpf(float, int); +long double ldexpl(long double, int); + +double lgamma(double); +float lgammaf(float); +long double lgammal(long double); + +long long llrint(double); +long long llrintf(float); +long long llrintl(long double); + +long long llround(double); +long long llroundf(float); +long long llroundl(long double); + +double log(double); +float logf(float); +long double logl(long double); + +double log10(double); +float log10f(float); +long double log10l(long double); + +double log1p(double); +float log1pf(float); +long double log1pl(long double); + +double log2(double); +float log2f(float); +long double log2l(long double); + +double logb(double); +float logbf(float); +long double logbl(long double); + +long lrint(double); +long lrintf(float); +long lrintl(long double); + +long lround(double); +long lroundf(float); +long lroundl(long double); + +double modf(double, double*); +float modff(float, float*); +long double modfl(long double, long double*); + +double nan(const char*); +float nanf(const char*); +long double nanl(const char*); + +double nearbyint(double); +float nearbyintf(float); +long double nearbyintl(long double); + +double nextafter(double, double); +float nextafterf(float, float); +long double nextafterl(long double, long double); + +double nexttoward(double, long double); +float nexttowardf(float, long double); +long double nexttowardl(long double, long double); + +double pow(double, double); +float powf(float, float); +long double powl(long double, long double); + +double remainder(double, double); +float remainderf(float, float); +long double remainderl(long double, long double); + +double remquo(double, double, int*); +float remquof(float, float, int*); +long double remquol(long double, long double, int*); + +double rint(double); +float rintf(float); +long double rintl(long double); + +double round(double); +float roundf(float); +long double roundl(long double); + +double scalbln(double, long); +float scalblnf(float, long); +long double scalblnl(long double, long); + +double scalbn(double, int); +float scalbnf(float, int); +long double scalbnl(long double, int); + +double sin(double); +float sinf(float); +long double sinl(long double); + +double sinh(double); +float sinhf(float); +long double sinhl(long double); + +double sqrt(double); +float sqrtf(float); +long double sqrtl(long double); + +double tan(double); +float tanf(float); +long double tanl(long double); + +double tanh(double); +float tanhf(float); +long double tanhl(long double); + +double tgamma(double); +float tgammaf(float); +long double tgammal(long double); + +double trunc(double); +float truncf(float); +long double truncl(long double); + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) +#undef MAXFLOAT +#define MAXFLOAT 3.40282346638528859812e+38F +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define M_E 2.7182818284590452354 /* e */ +#define M_LOG2E 1.4426950408889634074 /* log_2 e */ +#define M_LOG10E 0.43429448190325182765 /* log_10 e */ +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#define M_PI 3.14159265358979323846 /* pi */ +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +extern int signgam; + +double j0(double); +double j1(double); +double jn(int, double); + +double y0(double); +double y1(double); +double yn(int, double); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define HUGE 3.40282346638528859812e+38F + +double drem(double, double); +float dremf(float, float); + +int finite(double); +int finitef(float); + +double scalb(double, double); +float scalbf(float, float); + +double significand(double); +float significandf(float); + +double lgamma_r(double, int*); +float lgammaf_r(float, int*); + +float j0f(float); +float j1f(float); +float jnf(int, float); + +float y0f(float); +float y1f(float); +float ynf(int, float); +#endif + +#ifdef _GNU_SOURCE +long double lgammal_r(long double, int*); + +void sincos(double, double*, double*); +void sincosf(float, float*, float*); +void sincosl(long double, long double*, long double*); + +double exp10(double); +float exp10f(float); +long double exp10l(long double); + +double pow10(double); +float pow10f(float); +long double pow10l(long double); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_MATH_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/memory.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/memory.h new file mode 100644 index 0000000..3b2f590 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/memory.h
@@ -0,0 +1 @@ +#include <string.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/monetary.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/monetary.h new file mode 100644 index 0000000..d1955fa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/monetary.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_MONETARY_H_ +#define SYSROOT_MONETARY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_ssize_t +#define __NEED_size_t +#define __NEED_locale_t + +#include <bits/alltypes.h> + +ssize_t strfmon(char* __restrict, size_t, const char* __restrict, ...); +ssize_t strfmon_l(char* __restrict, size_t, locale_t, const char* __restrict, ...); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_MONETARY_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/ethernet.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/ethernet.h new file mode 100644 index 0000000..9cee87d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/ethernet.h
@@ -0,0 +1,53 @@ +#ifndef SYSROOT_NET_ETHERNET_H_ +#define SYSROOT_NET_ETHERNET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/if_ether.h> +#include <stdint.h> +#include <sys/types.h> + +struct ether_addr { + uint8_t ether_addr_octet[ETH_ALEN]; +}; + +struct ether_header { + uint8_t ether_dhost[ETH_ALEN]; + uint8_t ether_shost[ETH_ALEN]; + uint16_t ether_type; +}; + +#define ETHERTYPE_PUP 0x0200 +#define ETHERTYPE_SPRITE 0x0500 +#define ETHERTYPE_IP 0x0800 +#define ETHERTYPE_ARP 0x0806 +#define ETHERTYPE_REVARP 0x8035 +#define ETHERTYPE_AT 0x809B +#define ETHERTYPE_AARP 0x80F3 +#define ETHERTYPE_VLAN 0x8100 +#define ETHERTYPE_IPX 0x8137 +#define ETHERTYPE_IPV6 0x86dd +#define ETHERTYPE_LOOPBACK 0x9000 + +#define ETHER_ADDR_LEN ETH_ALEN +#define ETHER_TYPE_LEN 2 +#define ETHER_CRC_LEN 4 +#define ETHER_HDR_LEN ETH_HLEN +#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) +#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) + +#define ETHER_IS_VALID_LEN(foo) ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +#define ETHERTYPE_TRAIL 0x1000 +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU ETH_DATA_LEN +#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_ETHERNET_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/if.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/if.h new file mode 100644 index 0000000..e97c3ee --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/if.h
@@ -0,0 +1,132 @@ +#ifndef SYSROOT_NET_IF_H_ +#define SYSROOT_NET_IF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define IF_NAMESIZE 16 + +struct if_nameindex { + unsigned int if_index; + char* if_name; +}; + +unsigned int if_nametoindex(const char*); +char* if_indextoname(unsigned int, char*); +struct if_nameindex* if_nameindex(void); +void if_freenameindex(struct if_nameindex*); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#include <sys/socket.h> + +#define IFF_UP 0x1 +#define IFF_BROADCAST 0x2 +#define IFF_DEBUG 0x4 +#define IFF_LOOPBACK 0x8 +#define IFF_POINTOPOINT 0x10 +#define IFF_NOTRAILERS 0x20 +#define IFF_RUNNING 0x40 +#define IFF_NOARP 0x80 +#define IFF_PROMISC 0x100 +#define IFF_ALLMULTI 0x200 +#define IFF_MASTER 0x400 +#define IFF_SLAVE 0x800 +#define IFF_MULTICAST 0x1000 +#define IFF_PORTSEL 0x2000 +#define IFF_AUTOMEDIA 0x4000 +#define IFF_DYNAMIC 0x8000 +#define IFF_LOWER_UP 0x10000 +#define IFF_DORMANT 0x20000 +#define IFF_ECHO 0x40000 +#define IFF_VOLATILE \ + (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST | IFF_ECHO | IFF_MASTER | IFF_SLAVE | \ + IFF_RUNNING | IFF_LOWER_UP | IFF_DORMANT) + +struct ifaddr { + struct sockaddr ifa_addr; + union { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct iface* ifa_ifp; + struct ifaddr* ifa_next; +}; + +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + +struct ifmap { + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; +}; + +#define IFHWADDRLEN 6 +#define IFNAMSIZ IF_NAMESIZE + +struct ifreq { + union { + char ifrn_name[IFNAMSIZ]; + } ifr_ifrn; + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; + char ifru_newname[IFNAMSIZ]; + void* ifru_data; + } ifr_ifru; +}; + +#define ifr_name ifr_ifrn.ifrn_name +#define ifr_hwaddr ifr_ifru.ifru_hwaddr +#define ifr_addr ifr_ifru.ifru_addr +#define ifr_dstaddr ifr_ifru.ifru_dstaddr +#define ifr_broadaddr ifr_ifru.ifru_broadaddr +#define ifr_netmask ifr_ifru.ifru_netmask +#define ifr_flags ifr_ifru.ifru_flags +#define ifr_metric ifr_ifru.ifru_ivalue +#define ifr_mtu ifr_ifru.ifru_mtu +#define ifr_map ifr_ifru.ifru_map +#define ifr_slave ifr_ifru.ifru_slave +#define ifr_data ifr_ifru.ifru_data +#define ifr_ifindex ifr_ifru.ifru_ivalue +#define ifr_bandwidth ifr_ifru.ifru_ivalue +#define ifr_qlen ifr_ifru.ifru_ivalue +#define ifr_newname ifr_ifru.ifru_newname +#define _IOT_ifreq _IOT(_IOTS(char), IFNAMSIZ, _IOTS(char), 16, 0, 0) +#define _IOT_ifreq_short _IOT(_IOTS(char), IFNAMSIZ, _IOTS(short), 1, 0, 0) +#define _IOT_ifreq_int _IOT(_IOTS(char), IFNAMSIZ, _IOTS(int), 1, 0, 0) + +struct ifconf { + int ifc_len; + union { + void* ifcu_buf; + struct ifreq* ifcu_req; + } ifc_ifcu; +}; + +#define ifc_buf ifc_ifcu.ifcu_buf +#define ifc_req ifc_ifcu.ifcu_req +#define _IOT_ifconf _IOT(_IOTS(struct ifconf), 1, 0, 0, 0, 0) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_IF_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/if_arp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/if_arp.h new file mode 100644 index 0000000..40b902d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/if_arp.h
@@ -0,0 +1,139 @@ +/* Nonstandard header */ + +#ifndef SYSROOT_NET_IF_ARP_H_ +#define SYSROOT_NET_IF_ARP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <inttypes.h> +#include <sys/socket.h> +#include <sys/types.h> + +#define MAX_ADDR_LEN 7 + +#define ARPOP_REQUEST 1 +#define ARPOP_REPLY 2 +#define ARPOP_RREQUEST 3 +#define ARPOP_RREPLY 4 +#define ARPOP_InREQUEST 8 +#define ARPOP_InREPLY 9 +#define ARPOP_NAK 10 + +struct arphdr { + uint16_t ar_hrd; + uint16_t ar_pro; + uint8_t ar_hln; + uint8_t ar_pln; + uint16_t ar_op; +}; + +#define ARPHRD_NETROM 0 +#define ARPHRD_ETHER 1 +#define ARPHRD_EETHER 2 +#define ARPHRD_AX25 3 +#define ARPHRD_PRONET 4 +#define ARPHRD_CHAOS 5 +#define ARPHRD_IEEE802 6 +#define ARPHRD_ARCNET 7 +#define ARPHRD_APPLETLK 8 +#define ARPHRD_DLCI 15 +#define ARPHRD_ATM 19 +#define ARPHRD_METRICOM 23 +#define ARPHRD_IEEE1394 24 +#define ARPHRD_EUI64 27 +#define ARPHRD_INFINIBAND 32 +#define ARPHRD_SLIP 256 +#define ARPHRD_CSLIP 257 +#define ARPHRD_SLIP6 258 +#define ARPHRD_CSLIP6 259 +#define ARPHRD_RSRVD 260 +#define ARPHRD_ADAPT 264 +#define ARPHRD_ROSE 270 +#define ARPHRD_X25 271 +#define ARPHRD_HWX25 272 +#define ARPHRD_CAN 280 +#define ARPHRD_PPP 512 +#define ARPHRD_CISCO 513 +#define ARPHRD_HDLC ARPHRD_CISCO +#define ARPHRD_LAPB 516 +#define ARPHRD_DDCMP 517 +#define ARPHRD_RAWHDLC 518 + +#define ARPHRD_TUNNEL 768 +#define ARPHRD_TUNNEL6 769 +#define ARPHRD_FRAD 770 +#define ARPHRD_SKIP 771 +#define ARPHRD_LOOPBACK 772 +#define ARPHRD_LOCALTLK 773 +#define ARPHRD_FDDI 774 +#define ARPHRD_BIF 775 +#define ARPHRD_SIT 776 +#define ARPHRD_IPDDP 777 +#define ARPHRD_IPGRE 778 +#define ARPHRD_PIMREG 779 +#define ARPHRD_HIPPI 780 +#define ARPHRD_ASH 781 +#define ARPHRD_ECONET 782 +#define ARPHRD_IRDA 783 +#define ARPHRD_FCPP 784 +#define ARPHRD_FCAL 785 +#define ARPHRD_FCPL 786 +#define ARPHRD_FCFABRIC 787 +#define ARPHRD_IEEE802_TR 800 +#define ARPHRD_IEEE80211 801 +#define ARPHRD_IEEE80211_PRISM 802 +#define ARPHRD_IEEE80211_RADIOTAP 803 +#define ARPHRD_IEEE802154 804 +#define ARPHRD_IEEE802154_MONITOR 805 +#define ARPHRD_PHONET 820 +#define ARPHRD_PHONET_PIPE 821 +#define ARPHRD_CAIF 822 +#define ARPHRD_IP6GRE 823 +#define ARPHRD_NETLINK 824 + +#define ARPHRD_VOID 0xFFFF +#define ARPHRD_NONE 0xFFFE + +struct arpreq { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; + char arp_dev[16]; +}; + +struct arpreq_old { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; +}; + +#define ATF_COM 0x02 +#define ATF_PERM 0x04 +#define ATF_PUBL 0x08 +#define ATF_USETRAILERS 0x10 +#define ATF_NETMASK 0x20 +#define ATF_DONTPUB 0x40 +#define ATF_MAGIC 0x80 + +#define ARPD_UPDATE 0x01 +#define ARPD_LOOKUP 0x02 +#define ARPD_FLUSH 0x03 + +struct arpd_request { + unsigned short req; + uint32_t ip; + unsigned long dev; + unsigned long stamp; + unsigned long updated; + unsigned char ha[MAX_ADDR_LEN]; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_IF_ARP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/route.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/route.h new file mode 100644 index 0000000..dc5960b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/net/route.h
@@ -0,0 +1,119 @@ +#ifndef SYSROOT_NET_ROUTE_H_ +#define SYSROOT_NET_ROUTE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/in.h> +#include <stdint.h> +#include <sys/socket.h> +#include <sys/types.h> + +struct rtentry { + unsigned long int rt_pad1; + struct sockaddr rt_dst; + struct sockaddr rt_gateway; + struct sockaddr rt_genmask; + unsigned short int rt_flags; + short int rt_pad2; + unsigned long int rt_pad3; + unsigned char rt_tos; + unsigned char rt_class; + short int rt_pad4[sizeof(long) / 2 - 1]; + short int rt_metric; + char* rt_dev; + unsigned long int rt_mtu; + unsigned long int rt_window; + unsigned short int rt_irtt; +}; + +#define rt_mss rt_mtu + +struct in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + uint32_t rtmsg_type; + uint16_t rtmsg_dst_len; + uint16_t rtmsg_src_len; + uint32_t rtmsg_metric; + unsigned long int rtmsg_info; + uint32_t rtmsg_flags; + int rtmsg_ifindex; +}; + +#define RTF_UP 0x0001 +#define RTF_GATEWAY 0x0002 + +#define RTF_HOST 0x0004 +#define RTF_REINSTATE 0x0008 +#define RTF_DYNAMIC 0x0010 +#define RTF_MODIFIED 0x0020 +#define RTF_MTU 0x0040 +#define RTF_MSS RTF_MTU +#define RTF_WINDOW 0x0080 +#define RTF_IRTT 0x0100 +#define RTF_REJECT 0x0200 +#define RTF_STATIC 0x0400 +#define RTF_XRESOLVE 0x0800 +#define RTF_NOFORWARD 0x1000 +#define RTF_THROW 0x2000 +#define RTF_NOPMTUDISC 0x4000 + +#define RTF_DEFAULT 0x00010000 +#define RTF_ALLONLINK 0x00020000 +#define RTF_ADDRCONF 0x00040000 + +#define RTF_LINKRT 0x00100000 +#define RTF_NONEXTHOP 0x00200000 + +#define RTF_CACHE 0x01000000 +#define RTF_FLOW 0x02000000 +#define RTF_POLICY 0x04000000 + +#define RTCF_VALVE 0x00200000 +#define RTCF_MASQ 0x00400000 +#define RTCF_NAT 0x00800000 +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_LOG 0x02000000 +#define RTCF_DIRECTSRC 0x04000000 + +#define RTF_LOCAL 0x80000000 +#define RTF_INTERFACE 0x40000000 +#define RTF_MULTICAST 0x20000000 +#define RTF_BROADCAST 0x10000000 +#define RTF_NAT 0x08000000 + +#define RTF_ADDRCLASSMASK 0xF8000000 +#define RT_ADDRCLASS(flags) ((uint32_t)flags >> 23) + +#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) + +#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)) + +#define RT_CLASS_UNSPEC 0 +#define RT_CLASS_DEFAULT 253 + +#define RT_CLASS_MAIN 254 +#define RT_CLASS_LOCAL 255 +#define RT_CLASS_MAX 255 + +#define RTMSG_ACK NLMSG_ACK +#define RTMSG_OVERRUN NLMSG_OVERRUN + +#define RTMSG_NEWDEVICE 0x11 +#define RTMSG_DELDEVICE 0x12 +#define RTMSG_NEWROUTE 0x21 +#define RTMSG_DELROUTE 0x22 +#define RTMSG_NEWRULE 0x31 +#define RTMSG_DELRULE 0x32 +#define RTMSG_CONTROL 0x40 + +#define RTMSG_AR_FAILED 0x51 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NET_ROUTE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netdb.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netdb.h new file mode 100644 index 0000000..d5bb5ef --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netdb.h
@@ -0,0 +1,155 @@ +#ifndef SYSROOT_NETDB_H_ +#define SYSROOT_NETDB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <netinet/in.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#include <bits/alltypes.h> +#endif + +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr* ai_addr; + char* ai_canonname; + struct addrinfo* ai_next; +}; + +#define IPPORT_RESERVED 1024 + +#define AI_PASSIVE 0x01 +#define AI_CANONNAME 0x02 +#define AI_NUMERICHOST 0x04 +#define AI_V4MAPPED 0x08 +#define AI_ALL 0x10 +#define AI_ADDRCONFIG 0x20 +#define AI_NUMERICSERV 0x400 + +#define NI_NUMERICHOST 0x01 +#define NI_NUMERICSERV 0x02 +#define NI_NOFQDN 0x04 +#define NI_NAMEREQD 0x08 +#define NI_DGRAM 0x10 +#define NI_NUMERICSCOPE 0x100 + +#define EAI_BADFLAGS -1 +#define EAI_NONAME -2 +#define EAI_AGAIN -3 +#define EAI_FAIL -4 +#define EAI_FAMILY -6 +#define EAI_SOCKTYPE -7 +#define EAI_SERVICE -8 +#define EAI_MEMORY -10 +#define EAI_SYSTEM -11 +#define EAI_OVERFLOW -12 + +int getaddrinfo(const char* __restrict, const char* __restrict, const struct addrinfo* __restrict, + struct addrinfo** __restrict); +void freeaddrinfo(struct addrinfo*); +int getnameinfo(const struct sockaddr* __restrict, socklen_t, char* __restrict, socklen_t, + char* __restrict, socklen_t, int); +const char* gai_strerror(int); + +/* Legacy functions follow (marked OBsolete in SUS) */ + +struct netent { + char* n_name; + char** n_aliases; + int n_addrtype; + uint32_t n_net; +}; + +struct hostent { + char* h_name; + char** h_aliases; + int h_addrtype; + int h_length; + char** h_addr_list; +}; +#define h_addr h_addr_list[0] + +struct servent { + char* s_name; + char** s_aliases; + int s_port; + char* s_proto; +}; + +struct protoent { + char* p_name; + char** p_aliases; + int p_proto; +}; + +void sethostent(int); +void endhostent(void); +struct hostent* gethostent(void); + +void setnetent(int); +void endnetent(void); +struct netent* getnetent(void); +struct netent* getnetbyaddr(uint32_t, int); +struct netent* getnetbyname(const char*); + +void setservent(int); +void endservent(void); +struct servent* getservent(void); +struct servent* getservbyname(const char*, const char*); +struct servent* getservbyport(int, const char*); + +void setprotoent(int); +void endprotoent(void); +struct protoent* getprotoent(void); +struct protoent* getprotobyname(const char*); +struct protoent* getprotobynumber(int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) || \ + (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE + 0 < 200809L) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) +struct hostent* gethostbyname(const char*); +struct hostent* gethostbyaddr(const void*, socklen_t, int); +int* __h_errno_location(void); +#define h_errno (*__h_errno_location()) +#define HOST_NOT_FOUND 1 +#define TRY_AGAIN 2 +#define NO_RECOVERY 3 +#define NO_DATA 4 +#define NO_ADDRESS NO_DATA +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void herror(const char*); +const char* hstrerror(int); +int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*); +int gethostbyname2_r(const char*, int, struct hostent*, char*, size_t, struct hostent**, int*); +struct hostent* gethostbyname2(const char*, int); +int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, + int*); +int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**); +int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**); +#define EAI_NODATA -5 +#define EAI_ADDRFAMILY -9 +#define EAI_INPROGRESS -100 +#define EAI_CANCELED -101 +#define EAI_NOTCANCELED -102 +#define EAI_ALLDONE -103 +#define EAI_INTR -104 +#define EAI_IDN_ENCODE -105 +#define NI_MAXHOST 255 +#define NI_MAXSERV 32 +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETDB_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ether.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ether.h new file mode 100644 index 0000000..74668fb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ether.h
@@ -0,0 +1,22 @@ +#ifndef SYSROOT_NETINET_ETHER_H_ +#define SYSROOT_NETINET_ETHER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/if_ether.h> + +char* ether_ntoa(const struct ether_addr*); +struct ether_addr* ether_aton(const char*); +char* ether_ntoa_r(const struct ether_addr*, char*); +struct ether_addr* ether_aton_r(const char*, struct ether_addr*); +int ether_line(const char*, struct ether_addr*, char*); +int ether_ntohost(char*, const struct ether_addr*); +int ether_hostton(const char*, struct ether_addr*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_ETHER_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/icmp6.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/icmp6.h new file mode 100644 index 0000000..dde64cb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/icmp6.h
@@ -0,0 +1,303 @@ +#ifndef SYSROOT_NETINET_ICMP6_H_ +#define SYSROOT_NETINET_ICMP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <netinet/in.h> +#include <stdint.h> +#include <string.h> +#include <sys/types.h> + +#define ICMP6_FILTER 1 + +#define ICMP6_FILTER_BLOCK 1 +#define ICMP6_FILTER_PASS 2 +#define ICMP6_FILTER_BLOCKOTHERS 3 +#define ICMP6_FILTER_PASSONLY 4 + +struct icmp6_filter { + uint32_t icmp6_filt[8]; +}; + +struct icmp6_hdr { + uint8_t icmp6_type; + uint8_t icmp6_code; + uint16_t icmp6_cksum; + union { + uint32_t icmp6_un_data32[1]; + uint16_t icmp6_un_data16[2]; + uint8_t icmp6_un_data8[4]; + } icmp6_dataun; +}; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] +#define icmp6_mtu icmp6_data32[0] +#define icmp6_id icmp6_data16[0] +#define icmp6_seq icmp6_data16[1] +#define icmp6_maxdelay icmp6_data16[0] + +#define ICMP6_DST_UNREACH 1 +#define ICMP6_PACKET_TOO_BIG 2 +#define ICMP6_TIME_EXCEEDED 3 +#define ICMP6_PARAM_PROB 4 + +#define ICMP6_INFOMSG_MASK 0x80 + +#define ICMP6_ECHO_REQUEST 128 +#define ICMP6_ECHO_REPLY 129 +#define MLD_LISTENER_QUERY 130 +#define MLD_LISTENER_REPORT 131 +#define MLD_LISTENER_REDUCTION 132 + +#define ICMP6_DST_UNREACH_NOROUTE 0 +#define ICMP6_DST_UNREACH_ADMIN 1 +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 +#define ICMP6_DST_UNREACH_ADDR 3 +#define ICMP6_DST_UNREACH_NOPORT 4 + +#define ICMP6_TIME_EXCEED_TRANSIT 0 +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 + +#define ICMP6_PARAMPROB_HEADER 0 +#define ICMP6_PARAMPROB_NEXTHEADER 1 +#define ICMP6_PARAMPROB_OPTION 2 + +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type)&31))) == 0) + +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type)&31))) != 0) + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type)&31)))) + +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type)&31)))) + +#define ICMP6_FILTER_SETPASSALL(filterp) memset(filterp, 0, sizeof(struct icmp6_filter)); + +#define ICMP6_FILTER_SETBLOCKALL(filterp) memset(filterp, 0xFF, sizeof(struct icmp6_filter)); + +#define ND_ROUTER_SOLICIT 133 +#define ND_ROUTER_ADVERT 134 +#define ND_NEIGHBOR_SOLICIT 135 +#define ND_NEIGHBOR_ADVERT 136 +#define ND_REDIRECT 137 + +struct nd_router_solicit { + struct icmp6_hdr nd_rs_hdr; +}; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { + struct icmp6_hdr nd_ra_hdr; + uint32_t nd_ra_reachable; + uint32_t nd_ra_retransmit; +}; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HOME_AGENT 0x20 +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; +}; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; +}; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if __BYTE_ORDER == __BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else +#define ND_NA_FLAG_ROUTER 0x00000080 +#define ND_NA_FLAG_SOLICITED 0x00000040 +#define ND_NA_FLAG_OVERRIDE 0x00000020 +#endif + +struct nd_redirect { + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; + struct in6_addr nd_rd_dst; +}; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr { + uint8_t nd_opt_type; + uint8_t nd_opt_len; +}; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_RTR_ADV_INTERVAL 7 +#define ND_OPT_HOME_AGENT_INFO 8 + +struct nd_opt_prefix_info { + uint8_t nd_opt_pi_type; + uint8_t nd_opt_pi_len; + uint8_t nd_opt_pi_prefix_len; + uint8_t nd_opt_pi_flags_reserved; + uint32_t nd_opt_pi_valid_time; + uint32_t nd_opt_pi_preferred_time; + uint32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; +}; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_RADDR 0x20 + +struct nd_opt_rd_hdr { + uint8_t nd_opt_rh_type; + uint8_t nd_opt_rh_len; + uint16_t nd_opt_rh_reserved1; + uint32_t nd_opt_rh_reserved2; +}; + +struct nd_opt_mtu { + uint8_t nd_opt_mtu_type; + uint8_t nd_opt_mtu_len; + uint16_t nd_opt_mtu_reserved; + uint32_t nd_opt_mtu_mtu; +}; + +struct mld_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; +}; + +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +#define ICMP6_ROUTER_RENUMBERING 138 + +struct icmp6_router_renum { + struct icmp6_hdr rr_hdr; + uint8_t rr_segnum; + uint8_t rr_flags; + uint16_t rr_maxdelay; + uint32_t rr_reserved; +}; + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +struct rr_pco_match { + uint8_t rpm_code; + uint8_t rpm_len; + uint8_t rpm_ordinal; + uint8_t rpm_matchlen; + uint8_t rpm_minlen; + uint8_t rpm_maxlen; + uint16_t rpm_reserved; + struct in6_addr rpm_prefix; +}; + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 + +struct rr_pco_use { + uint8_t rpu_uselen; + uint8_t rpu_keeplen; + uint8_t rpu_ramask; + uint8_t rpu_raflags; + uint32_t rpu_vltime; + uint32_t rpu_pltime; + uint32_t rpu_flags; + struct in6_addr rpu_prefix; +}; + +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 + +#if __BYTE_ORDER == __BIG_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 +#else +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 +#endif + +struct rr_result { + uint16_t rrr_flags; + uint8_t rrr_ordinal; + uint8_t rrr_matchedlen; + uint32_t rrr_ifid; + struct in6_addr rrr_prefix; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#else +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +struct nd_opt_adv_interval { + uint8_t nd_opt_adv_interval_type; + uint8_t nd_opt_adv_interval_len; + uint16_t nd_opt_adv_interval_reserved; + uint32_t nd_opt_adv_interval_ival; +}; + +struct nd_opt_home_agent_info { + uint8_t nd_opt_home_agent_info_type; + uint8_t nd_opt_home_agent_info_len; + uint16_t nd_opt_home_agent_info_reserved; + uint16_t nd_opt_home_agent_info_preference; + uint16_t nd_opt_home_agent_info_lifetime; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_ICMP6_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/if_ether.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/if_ether.h new file mode 100644 index 0000000..f826e96 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/if_ether.h
@@ -0,0 +1,128 @@ +#ifndef SYSROOT_NETINET_IF_ETHER_H_ +#define SYSROOT_NETINET_IF_ETHER_H_ + +#include <stdint.h> +#include <sys/types.h> + +#define ETH_ALEN 6 +#define ETH_HLEN 14 +#define ETH_ZLEN 60 +#define ETH_DATA_LEN 1500 +#define ETH_FRAME_LEN 1514 +#define ETH_FCS_LEN 4 + +#define ETH_P_LOOP 0x0060 +#define ETH_P_PUP 0x0200 +#define ETH_P_PUPAT 0x0201 +#define ETH_P_IP 0x0800 +#define ETH_P_X25 0x0805 +#define ETH_P_ARP 0x0806 +#define ETH_P_BPQ 0x08FF +#define ETH_P_IEEEPUP 0x0a00 +#define ETH_P_IEEEPUPAT 0x0a01 +#define ETH_P_BATMAN 0x4305 +#define ETH_P_DEC 0x6000 +#define ETH_P_DNA_DL 0x6001 +#define ETH_P_DNA_RC 0x6002 +#define ETH_P_DNA_RT 0x6003 +#define ETH_P_LAT 0x6004 +#define ETH_P_DIAG 0x6005 +#define ETH_P_CUST 0x6006 +#define ETH_P_SCA 0x6007 +#define ETH_P_TEB 0x6558 +#define ETH_P_RARP 0x8035 +#define ETH_P_ATALK 0x809B +#define ETH_P_AARP 0x80F3 +#define ETH_P_8021Q 0x8100 +#define ETH_P_IPX 0x8137 +#define ETH_P_IPV6 0x86DD +#define ETH_P_PAUSE 0x8808 +#define ETH_P_SLOW 0x8809 +#define ETH_P_WCCP 0x883E +#define ETH_P_MPLS_UC 0x8847 +#define ETH_P_MPLS_MC 0x8848 +#define ETH_P_ATMMPOA 0x884c +#define ETH_P_PPP_DISC 0x8863 +#define ETH_P_PPP_SES 0x8864 +#define ETH_P_LINK_CTL 0x886c +#define ETH_P_ATMFATE 0x8884 +#define ETH_P_PAE 0x888E +#define ETH_P_AOE 0x88A2 +#define ETH_P_8021AD 0x88A8 +#define ETH_P_802_EX1 0x88B5 +#define ETH_P_TIPC 0x88CA +#define ETH_P_8021AH 0x88E7 +#define ETH_P_MVRP 0x88F5 +#define ETH_P_1588 0x88F7 +#define ETH_P_PRP 0x88FB +#define ETH_P_FCOE 0x8906 +#define ETH_P_TDLS 0x890D +#define ETH_P_FIP 0x8914 +#define ETH_P_80221 0x8917 +#define ETH_P_LOOPBACK 0x9000 +#define ETH_P_QINQ1 0x9100 +#define ETH_P_QINQ2 0x9200 +#define ETH_P_QINQ3 0x9300 +#define ETH_P_EDSA 0xDADA +#define ETH_P_AF_IUCV 0xFBFB + +#define ETH_P_802_3_MIN 0x0600 + +#define ETH_P_802_3 0x0001 +#define ETH_P_AX25 0x0002 +#define ETH_P_ALL 0x0003 +#define ETH_P_802_2 0x0004 +#define ETH_P_SNAP 0x0005 +#define ETH_P_DDCMP 0x0006 +#define ETH_P_WAN_PPP 0x0007 +#define ETH_P_PPP_MP 0x0008 +#define ETH_P_LOCALTALK 0x0009 +#define ETH_P_CAN 0x000C +#define ETH_P_CANFD 0x000D +#define ETH_P_PPPTALK 0x0010 +#define ETH_P_TR_802_2 0x0011 +#define ETH_P_MOBITEX 0x0015 +#define ETH_P_CONTROL 0x0016 +#define ETH_P_IRDA 0x0017 +#define ETH_P_ECONET 0x0018 +#define ETH_P_HDLC 0x0019 +#define ETH_P_ARCNET 0x001A +#define ETH_P_DSA 0x001B +#define ETH_P_TRAILER 0x001C +#define ETH_P_PHONET 0x00F5 +#define ETH_P_IEEE802154 0x00F6 +#define ETH_P_CAIF 0x00F7 + +struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; +}; + +#include <net/ethernet.h> +#include <net/if_arp.h> + +struct ether_arp { + struct arphdr ea_hdr; + uint8_t arp_sha[ETH_ALEN]; + uint8_t arp_spa[4]; + uint8_t arp_tha[ETH_ALEN]; + uint8_t arp_tpa[4]; +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + do { \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((uint8_t*)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((uint8_t*)ipaddr)[2]; \ + (enaddr)[5] = ((uint8_t*)ipaddr)[3]; \ + } while (0) + +#endif // SYSROOT_NETINET_IF_ETHER_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/igmp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/igmp.h new file mode 100644 index 0000000..99eb989 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/igmp.h
@@ -0,0 +1,45 @@ +#ifndef SYSROOT_NETINET_IGMP_H_ +#define SYSROOT_NETINET_IGMP_H_ + +#include <netinet/in.h> +#include <stdint.h> + +struct igmp { + uint8_t igmp_type; + uint8_t igmp_code; + uint16_t igmp_cksum; + struct in_addr igmp_group; +}; + +#define IGMP_MINLEN 8 + +#define IGMP_MEMBERSHIP_QUERY 0x11 +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 +#define IGMP_V2_LEAVE_GROUP 0x17 + +#define IGMP_DVMRP 0x13 +#define IGMP_PIM 0x14 +#define IGMP_TRACE 0x15 + +#define IGMP_MTRACE_RESP 0x1e +#define IGMP_MTRACE 0x1f + +#define IGMP_MAX_HOST_REPORT_DELAY 10 +#define IGMP_TIMER_SCALE 10 + +#define IGMP_DELAYING_MEMBER 1 +#define IGMP_IDLE_MEMBER 2 +#define IGMP_LAZY_MEMBER 3 +#define IGMP_SLEEPING_MEMBER 4 +#define IGMP_AWAKENING_MEMBER 5 + +#define IGMP_v1_ROUTER 1 +#define IGMP_v2_ROUTER 2 + +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +#endif // SYSROOT_NETINET_IGMP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/in.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/in.h new file mode 100644 index 0000000..6d18e44 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/in.h
@@ -0,0 +1,397 @@ +#ifndef SYSROOT_NETINET_IN_H_ +#define SYSROOT_NETINET_IN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <inttypes.h> +#include <sys/socket.h> + +typedef uint16_t in_port_t; +typedef uint32_t in_addr_t; +struct in_addr { + in_addr_t s_addr; +}; + +struct sockaddr_in { + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + uint8_t sin_zero[8]; +}; + +struct in6_addr { + union { + uint8_t __s6_addr[16]; + uint16_t __s6_addr16[8]; + uint32_t __s6_addr32[4]; + } __in6_union; +}; +#define s6_addr __in6_union.__s6_addr +#define s6_addr16 __in6_union.__s6_addr16 +#define s6_addr32 __in6_union.__s6_addr32 + +struct sockaddr_in6 { + sa_family_t sin6_family; + in_port_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; + uint32_t sin6_scope_id; +}; + +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + unsigned ipv6mr_interface; +}; + +#define INADDR_ANY ((in_addr_t)0x00000000) +#define INADDR_BROADCAST ((in_addr_t)0xffffffff) +#define INADDR_NONE ((in_addr_t)0xffffffff) +#define INADDR_LOOPBACK ((in_addr_t)0x7f000001) + +#define INADDR_UNSPEC_GROUP ((in_addr_t)0xe0000000) +#define INADDR_ALLHOSTS_GROUP ((in_addr_t)0xe0000001) +#define INADDR_ALLRTRS_GROUP ((in_addr_t)0xe0000002) +#define INADDR_MAX_LOCAL_GROUP ((in_addr_t)0xe00000ff) + +#define IN6ADDR_ANY_INIT \ + { \ + { \ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } \ + } \ + } +#define IN6ADDR_LOOPBACK_INIT \ + { \ + { \ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } \ + } \ + } + +extern const struct in6_addr in6addr_any, in6addr_loopback; + +#undef INET_ADDRSTRLEN +#undef INET6_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +uint32_t htonl(uint32_t); +uint16_t htons(uint16_t); +uint32_t ntohl(uint32_t); +uint16_t ntohs(uint16_t); + +#define IPPROTO_IP 0 +#define IPPROTO_HOPOPTS 0 +#define IPPROTO_ICMP 1 +#define IPPROTO_IGMP 2 +#define IPPROTO_IPIP 4 +#define IPPROTO_TCP 6 +#define IPPROTO_EGP 8 +#define IPPROTO_PUP 12 +#define IPPROTO_UDP 17 +#define IPPROTO_IDP 22 +#define IPPROTO_TP 29 +#define IPPROTO_DCCP 33 +#define IPPROTO_IPV6 41 +#define IPPROTO_ROUTING 43 +#define IPPROTO_FRAGMENT 44 +#define IPPROTO_RSVP 46 +#define IPPROTO_GRE 47 +#define IPPROTO_ESP 50 +#define IPPROTO_AH 51 +#define IPPROTO_ICMPV6 58 +#define IPPROTO_NONE 59 +#define IPPROTO_DSTOPTS 60 +#define IPPROTO_MTP 92 +#define IPPROTO_BEETPH 94 +#define IPPROTO_ENCAP 98 +#define IPPROTO_PIM 103 +#define IPPROTO_COMP 108 +#define IPPROTO_SCTP 132 +#define IPPROTO_MH 135 +#define IPPROTO_UDPLITE 136 +#define IPPROTO_MPLS 137 +#define IPPROTO_RAW 255 +#define IPPROTO_MAX 256 + +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint32_t*)(a))[2] == 0 && \ + ((uint32_t*)(a))[3] == 0) + +#define IN6_IS_ADDR_LOOPBACK(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint32_t*)(a))[2] == 0 && \ + ((uint8_t*)(a))[12] == 0 && ((uint8_t*)(a))[13] == 0 && ((uint8_t*)(a))[14] == 0 && \ + ((uint8_t*)(a))[15] == 1) + +#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t*)(a))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(a) \ + ((((uint8_t*)(a))[0]) == 0xfe && (((uint8_t*)(a))[1] & 0xc0) == 0x80) + +#define IN6_IS_ADDR_SITELOCAL(a) \ + ((((uint8_t*)(a))[0]) == 0xfe && (((uint8_t*)(a))[1] & 0xc0) == 0xc0) + +#define IN6_IS_ADDR_V4MAPPED(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint8_t*)(a))[8] == 0 && \ + ((uint8_t*)(a))[9] == 0 && ((uint8_t*)(a))[10] == 0xff && ((uint8_t*)(a))[11] == 0xff) + +#define IN6_IS_ADDR_V4COMPAT(a) \ + (((uint32_t*)(a))[0] == 0 && ((uint32_t*)(a))[1] == 0 && ((uint32_t*)(a))[2] == 0 && \ + ((uint8_t*)(a))[15] > 1) + +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x1)) + +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x2)) + +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x5)) + +#define IN6_IS_ADDR_MC_ORGLOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0x8)) + +#define IN6_IS_ADDR_MC_GLOBAL(a) (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t*)(a))[1] & 0xf) == 0xe)) + +#define __ARE_4_EQUAL(a, b) \ + (!((0 [a] - 0 [b]) | (1 [a] - 1 [b]) | (2 [a] - 2 [b]) | (3 [a] - 3 [b]))) +#define IN6_ARE_ADDR_EQUAL(a, b) __ARE_4_EQUAL((const uint32_t*)(a), (const uint32_t*)(b)) + +#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 +#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 +#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) +#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) + +#define IN_LOOPBACKNET 127 + +#define IP_TOS 1 +#define IP_TTL 2 +#define IP_HDRINCL 3 +#define IP_OPTIONS 4 +#define IP_ROUTER_ALERT 5 +#define IP_RECVOPTS 6 +#define IP_RETOPTS 7 +#define IP_PKTINFO 8 +#define IP_PKTOPTIONS 9 +#define IP_PMTUDISC 10 +#define IP_MTU_DISCOVER 10 +#define IP_RECVERR 11 +#define IP_RECVTTL 12 +#define IP_RECVTOS 13 +#define IP_MTU 14 +#define IP_FREEBIND 15 +#define IP_IPSEC_POLICY 16 +#define IP_XFRM_POLICY 17 +#define IP_PASSSEC 18 +#define IP_TRANSPARENT 19 +#define IP_ORIGDSTADDR 20 +#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR +#define IP_MINTTL 21 +#define IP_NODEFRAG 22 +#define IP_CHECKSUM 23 +#define IP_BIND_ADDRESS_NO_PORT 24 +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 +#define IP_UNBLOCK_SOURCE 37 +#define IP_BLOCK_SOURCE 38 +#define IP_ADD_SOURCE_MEMBERSHIP 39 +#define IP_DROP_SOURCE_MEMBERSHIP 40 +#define IP_MSFILTER 41 +#define IP_MULTICAST_ALL 49 +#define IP_UNICAST_IF 50 + +#define IP_RECVRETOPTS IP_RETOPTS + +#define IP_PMTUDISC_DONT 0 +#define IP_PMTUDISC_WANT 1 +#define IP_PMTUDISC_DO 2 +#define IP_PMTUDISC_PROBE 3 +#define IP_PMTUDISC_INTERFACE 4 +#define IP_PMTUDISC_OMIT 5 + +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +struct ip_opts { + struct in_addr ip_dst; + char ip_opts[40]; +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define MCAST_JOIN_GROUP 42 +#define MCAST_BLOCK_SOURCE 43 +#define MCAST_UNBLOCK_SOURCE 44 +#define MCAST_LEAVE_GROUP 45 +#define MCAST_JOIN_SOURCE_GROUP 46 +#define MCAST_LEAVE_SOURCE_GROUP 47 +#define MCAST_MSFILTER 48 + +#define MCAST_EXCLUDE 0 +#define MCAST_INCLUDE 1 + +struct ip_mreq { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; +}; + +struct ip_mreqn { + struct in_addr imr_multiaddr; + struct in_addr imr_address; + int imr_ifindex; +}; + +struct ip_mreq_source { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; + struct in_addr imr_sourceaddr; +}; + +struct ip_msfilter { + struct in_addr imsf_multiaddr; + struct in_addr imsf_interface; + uint32_t imsf_fmode; + uint32_t imsf_numsrc; + struct in_addr imsf_slist[1]; +}; +#define IP_MSFILTER_SIZE(numsrc) \ + (sizeof(struct ip_msfilter) - sizeof(struct in_addr) + (numsrc) * sizeof(struct in_addr)) + +struct group_req { + uint32_t gr_interface; + struct sockaddr_storage gr_group; +}; + +struct group_source_req { + uint32_t gsr_interface; + struct sockaddr_storage gsr_group; + struct sockaddr_storage gsr_source; +}; + +struct group_filter { + uint32_t gf_interface; + struct sockaddr_storage gf_group; + uint32_t gf_fmode; + uint32_t gf_numsrc; + struct sockaddr_storage gf_slist[1]; +}; +#define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) + \ + (numsrc) * sizeof(struct sockaddr_storage)) + +struct in_pktinfo { + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + unsigned ipi6_ifindex; +}; + +struct ip6_mtuinfo { + struct sockaddr_in6 ip6m_addr; + uint32_t ip6m_mtu; +}; +#endif + +#define IPV6_ADDRFORM 1 +#define IPV6_2292PKTINFO 2 +#define IPV6_2292HOPOPTS 3 +#define IPV6_2292DSTOPTS 4 +#define IPV6_2292RTHDR 5 +#define IPV6_2292PKTOPTIONS 6 +#define IPV6_CHECKSUM 7 +#define IPV6_2292HOPLIMIT 8 +#define IPV6_NEXTHOP 9 +#define IPV6_AUTHHDR 10 +#define IPV6_UNICAST_HOPS 16 +#define IPV6_MULTICAST_IF 17 +#define IPV6_MULTICAST_HOPS 18 +#define IPV6_MULTICAST_LOOP 19 +#define IPV6_JOIN_GROUP 20 +#define IPV6_LEAVE_GROUP 21 +#define IPV6_ROUTER_ALERT 22 +#define IPV6_MTU_DISCOVER 23 +#define IPV6_MTU 24 +#define IPV6_RECVERR 25 +#define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 +#define IPV6_IPSEC_POLICY 34 +#define IPV6_XFRM_POLICY 35 +#define IPV6_HDRINCL 36 + +#define IPV6_RECVPKTINFO 49 +#define IPV6_PKTINFO 50 +#define IPV6_RECVHOPLIMIT 51 +#define IPV6_HOPLIMIT 52 +#define IPV6_RECVHOPOPTS 53 +#define IPV6_HOPOPTS 54 +#define IPV6_RTHDRDSTOPTS 55 +#define IPV6_RECVRTHDR 56 +#define IPV6_RTHDR 57 +#define IPV6_RECVDSTOPTS 58 +#define IPV6_DSTOPTS 59 +#define IPV6_RECVPATHMTU 60 +#define IPV6_PATHMTU 61 +#define IPV6_DONTFRAG 62 +#define IPV6_RECVTCLASS 66 +#define IPV6_TCLASS 67 +#define IPV6_AUTOFLOWLABEL 70 +#define IPV6_ADDR_PREFERENCES 72 +#define IPV6_MINHOPCOUNT 73 +#define IPV6_ORIGDSTADDR 74 +#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR +#define IPV6_TRANSPARENT 75 +#define IPV6_UNICAST_IF 76 + +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +#define IPV6_RXHOPOPTS IPV6_HOPOPTS +#define IPV6_RXDSTOPTS IPV6_DSTOPTS + +#define IPV6_PMTUDISC_DONT 0 +#define IPV6_PMTUDISC_WANT 1 +#define IPV6_PMTUDISC_DO 2 +#define IPV6_PMTUDISC_PROBE 3 +#define IPV6_PMTUDISC_INTERFACE 4 +#define IPV6_PMTUDISC_OMIT 5 + +#define IPV6_PREFER_SRC_TMP 0x0001 +#define IPV6_PREFER_SRC_PUBLIC 0x0002 +#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 +#define IPV6_PREFER_SRC_COA 0x0004 +#define IPV6_PREFER_SRC_HOME 0x0400 +#define IPV6_PREFER_SRC_CGA 0x0008 +#define IPV6_PREFER_SRC_NONCGA 0x0800 + +#define IPV6_RTHDR_LOOSE 0 +#define IPV6_RTHDR_STRICT 1 + +#define IPV6_RTHDR_TYPE_0 0 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/in_systm.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/in_systm.h new file mode 100644 index 0000000..8e688ab --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/in_systm.h
@@ -0,0 +1,9 @@ +#ifndef SYSROOT_NETINET_IN_SYSTM_H_ +#define SYSROOT_NETINET_IN_SYSTM_H_ + +#include <stdint.h> + +typedef uint16_t n_short; +typedef uint32_t n_long, n_time; + +#endif // SYSROOT_NETINET_IN_SYSTM_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip.h new file mode 100644 index 0000000..c795ef0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip.h
@@ -0,0 +1,198 @@ +#ifndef SYSROOT_NETINET_IP_H_ +#define SYSROOT_NETINET_IP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <endian.h> +#include <netinet/in.h> +#include <stdint.h> + +struct timestamp { + uint8_t len; + uint8_t ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int flags : 4; + unsigned int overflow : 4; +#else + unsigned int overflow : 4; + unsigned int flags : 4; +#endif + uint32_t data[9]; +}; + +struct iphdr { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ihl : 4; + unsigned int version : 4; +#else + unsigned int version : 4; + unsigned int ihl : 4; +#endif + uint8_t tos; + uint16_t tot_len; + uint16_t id; + uint16_t frag_off; + uint8_t ttl; + uint8_t protocol; + uint16_t check; + uint32_t saddr; + uint32_t daddr; +}; + +struct ip { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ip_hl : 4; + unsigned int ip_v : 4; +#else + unsigned int ip_v : 4; + unsigned int ip_hl : 4; +#endif + uint8_t ip_tos; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_off; + uint8_t ip_ttl; + uint8_t ip_p; + uint16_t ip_sum; + struct in_addr ip_src, ip_dst; +}; + +#define IP_RF 0x8000 +#define IP_DF 0x4000 +#define IP_MF 0x2000 +#define IP_OFFMASK 0x1fff + +struct ip_timestamp { + uint8_t ipt_code; + uint8_t ipt_len; + uint8_t ipt_ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ipt_flg : 4; + unsigned int ipt_oflw : 4; +#else + unsigned int ipt_oflw : 4; + unsigned int ipt_flg : 4; +#endif + uint32_t data[9]; +}; + +#define IPVERSION 4 +#define IP_MAXPACKET 65535 + +#define IPTOS_ECN_MASK 0x03 +#define IPTOS_ECN(x) ((x)&IPTOS_ECN_MASK) +#define IPTOS_ECN_NOT_ECT 0x00 +#define IPTOS_ECN_ECT1 0x01 +#define IPTOS_ECN_ECT0 0x02 +#define IPTOS_ECN_CE 0x03 + +#define IPTOS_DSCP_MASK 0xfc +#define IPTOS_DSCP(x) ((x)&IPTOS_DSCP_MASK) +#define IPTOS_DSCP_AF11 0x28 +#define IPTOS_DSCP_AF12 0x30 +#define IPTOS_DSCP_AF13 0x38 +#define IPTOS_DSCP_AF21 0x48 +#define IPTOS_DSCP_AF22 0x50 +#define IPTOS_DSCP_AF23 0x58 +#define IPTOS_DSCP_AF31 0x68 +#define IPTOS_DSCP_AF32 0x70 +#define IPTOS_DSCP_AF33 0x78 +#define IPTOS_DSCP_AF41 0x88 +#define IPTOS_DSCP_AF42 0x90 +#define IPTOS_DSCP_AF43 0x98 +#define IPTOS_DSCP_EF 0xb8 + +#define IPTOS_CLASS_MASK 0xe0 +#define IPTOS_CLASS(x) ((x)&IPTOS_CLASS_MASK) +#define IPTOS_CLASS_CS0 0x00 +#define IPTOS_CLASS_CS1 0x20 +#define IPTOS_CLASS_CS2 0x40 +#define IPTOS_CLASS_CS3 0x60 +#define IPTOS_CLASS_CS4 0x80 +#define IPTOS_CLASS_CS5 0xa0 +#define IPTOS_CLASS_CS6 0xc0 +#define IPTOS_CLASS_CS7 0xe0 +#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0 + +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_LOWCOST 0x02 +#define IPTOS_MINCOST IPTOS_LOWCOST + +#define IPTOS_PREC_MASK 0xe0 +#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +#define IPOPT_COPY 0x80 +#define IPOPT_CLASS_MASK 0x60 +#define IPOPT_NUMBER_MASK 0x1f + +#define IPOPT_COPIED(o) ((o)&IPOPT_COPY) +#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) +#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_MEASUREMENT IPOPT_DEBMEAS +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 +#define IPOPT_END IPOPT_EOL +#define IPOPT_NOP 1 +#define IPOPT_NOOP IPOPT_NOP + +#define IPOPT_RR 7 +#define IPOPT_TS 68 +#define IPOPT_TIMESTAMP IPOPT_TS +#define IPOPT_SECURITY 130 +#define IPOPT_SEC IPOPT_SECURITY +#define IPOPT_LSRR 131 +#define IPOPT_SATID 136 +#define IPOPT_SID IPOPT_SATID +#define IPOPT_SSRR 137 +#define IPOPT_RA 148 + +#define IPOPT_OPTVAL 0 +#define IPOPT_OLEN 1 +#define IPOPT_OFFSET 2 +#define IPOPT_MINOFF 4 + +#define MAX_IPOPTLEN 40 + +#define IPOPT_TS_TSONLY 0 +#define IPOPT_TS_TSANDADDR 1 +#define IPOPT_TS_PRESPEC 3 + +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +#define MAXTTL 255 +#define IPDEFTTL 64 +#define IPFRAGTTL 60 +#define IPTTLDEC 1 + +#define IP_MSS 576 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip6.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip6.h new file mode 100644 index 0000000..45f1c68 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip6.h
@@ -0,0 +1,142 @@ +#ifndef SYSROOT_NETINET_IP6_H_ +#define SYSROOT_NETINET_IP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <endian.h> +#include <netinet/in.h> +#include <stdint.h> + +struct ip6_hdr { + union { + struct ip6_hdrctl { + uint32_t ip6_un1_flow; + uint16_t ip6_un1_plen; + uint8_t ip6_un1_nxt; + uint8_t ip6_un1_hlim; + } ip6_un1; + uint8_t ip6_un2_vfc; + } ip6_ctlun; + struct in6_addr ip6_src; + struct in6_addr ip6_dst; +}; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +struct ip6_ext { + uint8_t ip6e_nxt; + uint8_t ip6e_len; +}; + +struct ip6_hbh { + uint8_t ip6h_nxt; + uint8_t ip6h_len; +}; + +struct ip6_dest { + uint8_t ip6d_nxt; + uint8_t ip6d_len; +}; + +struct ip6_rthdr { + uint8_t ip6r_nxt; + uint8_t ip6r_len; + uint8_t ip6r_type; + uint8_t ip6r_segleft; +}; + +struct ip6_rthdr0 { + uint8_t ip6r0_nxt; + uint8_t ip6r0_len; + uint8_t ip6r0_type; + uint8_t ip6r0_segleft; + uint8_t ip6r0_reserved; + uint8_t ip6r0_slmap[3]; + struct in6_addr ip6r0_addr[]; +}; + +struct ip6_frag { + uint8_t ip6f_nxt; + uint8_t ip6f_reserved; + uint16_t ip6f_offlg; + uint32_t ip6f_ident; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 +#define IP6F_RESERVED_MASK 0x0006 +#define IP6F_MORE_FRAG 0x0001 +#else +#define IP6F_OFF_MASK 0xf8ff +#define IP6F_RESERVED_MASK 0x0600 +#define IP6F_MORE_FRAG 0x0100 +#endif + +struct ip6_opt { + uint8_t ip6o_type; + uint8_t ip6o_len; +}; + +#define IP6OPT_TYPE(o) ((o)&0xc0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xc0 +#define IP6OPT_TYPE_MUTABLE 0x20 + +#define IP6OPT_PAD1 0 +#define IP6OPT_PADN 1 + +#define IP6OPT_JUMBO 0xc2 +#define IP6OPT_NSAP_ADDR 0xc3 +#define IP6OPT_TUNNEL_LIMIT 0x04 +#define IP6OPT_ROUTER_ALERT 0x05 + +struct ip6_opt_jumbo { + uint8_t ip6oj_type; + uint8_t ip6oj_len; + uint8_t ip6oj_jumbo_len[4]; +}; +#define IP6OPT_JUMBO_LEN 6 + +struct ip6_opt_nsap { + uint8_t ip6on_type; + uint8_t ip6on_len; + uint8_t ip6on_src_nsap_len; + uint8_t ip6on_dst_nsap_len; +}; + +struct ip6_opt_tunnel { + uint8_t ip6ot_type; + uint8_t ip6ot_len; + uint8_t ip6ot_encap_limit; +}; + +struct ip6_opt_router { + uint8_t ip6or_type; + uint8_t ip6or_len; + uint8_t ip6or_value[2]; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0001 +#define IP6_ALERT_AN 0x0002 +#else +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0100 +#define IP6_ALERT_AN 0x0200 +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IP6_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip_icmp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip_icmp.h new file mode 100644 index 0000000..c239456 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/ip_icmp.h
@@ -0,0 +1,189 @@ +#ifndef SYSROOT_NETINET_IP_ICMP_H_ +#define SYSROOT_NETINET_IP_ICMP_H_ + +#include <netinet/in.h> +#include <netinet/ip.h> +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct icmphdr { + uint8_t type; + uint8_t code; + uint16_t checksum; + union { + struct { + uint16_t id; + uint16_t sequence; + } echo; + uint32_t gateway; + struct { + uint16_t __unused; + uint16_t mtu; + } frag; + } un; +}; + +#define ICMP_ECHOREPLY 0 +#define ICMP_DEST_UNREACH 3 +#define ICMP_SOURCE_QUENCH 4 +#define ICMP_REDIRECT 5 +#define ICMP_ECHO 8 +#define ICMP_TIME_EXCEEDED 11 +#define ICMP_PARAMETERPROB 12 +#define ICMP_TIMESTAMP 13 +#define ICMP_TIMESTAMPREPLY 14 +#define ICMP_INFO_REQUEST 15 +#define ICMP_INFO_REPLY 16 +#define ICMP_ADDRESS 17 +#define ICMP_ADDRESSREPLY 18 +#define NR_ICMP_TYPES 18 + +#define ICMP_NET_UNREACH 0 +#define ICMP_HOST_UNREACH 1 +#define ICMP_PROT_UNREACH 2 +#define ICMP_PORT_UNREACH 3 +#define ICMP_FRAG_NEEDED 4 +#define ICMP_SR_FAILED 5 +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 +#define ICMP_PREC_VIOLATION 14 +#define ICMP_PREC_CUTOFF 15 +#define NR_ICMP_UNREACH 15 + +#define ICMP_REDIR_NET 0 +#define ICMP_REDIR_HOST 1 +#define ICMP_REDIR_NETTOS 2 +#define ICMP_REDIR_HOSTTOS 3 + +#define ICMP_EXC_TTL 0 +#define ICMP_EXC_FRAGTIME 1 + +struct icmp_ra_addr { + uint32_t ira_addr; + uint32_t ira_preference; +}; + +struct icmp { + uint8_t icmp_type; + uint8_t icmp_code; + uint16_t icmp_cksum; + union { + uint8_t ih_pptr; + struct in_addr ih_gwaddr; + struct ih_idseq { + uint16_t icd_id; + uint16_t icd_seq; + } ih_idseq; + uint32_t ih_void; + + struct ih_pmtu { + uint16_t ipm_void; + uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + uint8_t irt_num_addrs; + uint8_t irt_wpa; + uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; + union { + struct { + uint32_t its_otime; + uint32_t its_rtime; + uint32_t its_ttime; + } id_ts; + struct { + struct ip idi_ip; + } id_ip; + struct icmp_ra_addr id_radv; + uint32_t id_mask; + uint8_t id_data[1]; + } icmp_dun; +}; + +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data + +#define ICMP_MINLEN 8 +#define ICMP_TSLEN (8 + 3 * sizeof(n_time)) +#define ICMP_MASKLEN 12 +#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8) +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + +#define ICMP_UNREACH 3 +#define ICMP_SOURCEQUENCH 4 +#define ICMP_ROUTERADVERT 9 +#define ICMP_ROUTERSOLICIT 10 +#define ICMP_TIMXCEED 11 +#define ICMP_PARAMPROB 12 +#define ICMP_TSTAMP 13 +#define ICMP_TSTAMPREPLY 14 +#define ICMP_IREQ 15 +#define ICMP_IREQREPLY 16 +#define ICMP_MASKREQ 17 +#define ICMP_MASKREPLY 18 +#define ICMP_MAXTYPE 18 + +#define ICMP_UNREACH_NET 0 +#define ICMP_UNREACH_HOST 1 +#define ICMP_UNREACH_PROTOCOL 2 +#define ICMP_UNREACH_PORT 3 +#define ICMP_UNREACH_NEEDFRAG 4 +#define ICMP_UNREACH_SRCFAIL 5 +#define ICMP_UNREACH_NET_UNKNOWN 6 +#define ICMP_UNREACH_HOST_UNKNOWN 7 +#define ICMP_UNREACH_ISOLATED 8 +#define ICMP_UNREACH_NET_PROHIB 9 +#define ICMP_UNREACH_HOST_PROHIB 10 +#define ICMP_UNREACH_TOSNET 11 +#define ICMP_UNREACH_TOSHOST 12 +#define ICMP_UNREACH_FILTER_PROHIB 13 +#define ICMP_UNREACH_HOST_PRECEDENCE 14 +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 + +#define ICMP_REDIRECT_NET 0 +#define ICMP_REDIRECT_HOST 1 +#define ICMP_REDIRECT_TOSNET 2 +#define ICMP_REDIRECT_TOSHOST 3 + +#define ICMP_TIMXCEED_INTRANS 0 +#define ICMP_TIMXCEED_REASS 1 + +#define ICMP_PARAMPROB_OPTABSENT 1 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || (type) == ICMP_ROUTERADVERT || \ + (type) == ICMP_ROUTERSOLICIT || (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || (type) == ICMP_MASKREQ || \ + (type) == ICMP_MASKREPLY) + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_IP_ICMP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/tcp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/tcp.h new file mode 100644 index 0000000..e892dd2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/tcp.h
@@ -0,0 +1,201 @@ +#ifndef SYSROOT_NETINET_TCP_H_ +#define SYSROOT_NETINET_TCP_H_ + +#include <features.h> + +#define TCP_NODELAY 1 +#define TCP_MAXSEG 2 +#define TCP_CORK 3 +#define TCP_KEEPIDLE 4 +#define TCP_KEEPINTVL 5 +#define TCP_KEEPCNT 6 +#define TCP_SYNCNT 7 +#define TCP_LINGER2 8 +#define TCP_DEFER_ACCEPT 9 +#define TCP_WINDOW_CLAMP 10 +#define TCP_INFO 11 +#define TCP_QUICKACK 12 +#define TCP_CONGESTION 13 +#define TCP_MD5SIG 14 +#define TCP_THIN_LINEAR_TIMEOUTS 16 +#define TCP_THIN_DUPACK 17 +#define TCP_USER_TIMEOUT 18 +#define TCP_REPAIR 19 +#define TCP_REPAIR_QUEUE 20 +#define TCP_QUEUE_SEQ 21 +#define TCP_REPAIR_OPTIONS 22 +#define TCP_FASTOPEN 23 +#define TCP_TIMESTAMP 24 +#define TCP_NOTSENT_LOWAT 25 +#define TCP_CC_INFO 26 +#define TCP_SAVE_SYN 27 +#define TCP_SAVED_SYN 28 + +#define TCP_ESTABLISHED 1 +#define TCP_SYN_SENT 2 +#define TCP_SYN_RECV 3 +#define TCP_FIN_WAIT1 4 +#define TCP_FIN_WAIT2 5 +#define TCP_TIME_WAIT 6 +#define TCP_CLOSE 7 +#define TCP_CLOSE_WAIT 8 +#define TCP_LAST_ACK 9 +#define TCP_LISTEN 10 +#define TCP_CLOSING 11 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOPT_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 +#define TCPOPT_SACK 5 +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOLEN_WINDOW 3 +#define TCPOLEN_MAXSEG 4 +#define TCPOLEN_TIMESTAMP 10 + +#define SOL_TCP 6 + +#include <endian.h> +#include <stdint.h> +#include <sys/socket.h> +#include <sys/types.h> + +typedef uint32_t tcp_seq; + +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + +struct tcphdr { +#ifdef _GNU_SOURCE +#ifdef __GNUC__ + __extension__ +#endif + union { + struct { + uint16_t source; + uint16_t dest; + uint32_t seq; + uint32_t ack_seq; +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint16_t res1 : 4; + uint16_t doff : 4; + uint16_t fin : 1; + uint16_t syn : 1; + uint16_t rst : 1; + uint16_t psh : 1; + uint16_t ack : 1; + uint16_t urg : 1; + uint16_t res2 : 2; +#else + uint16_t doff : 4; + uint16_t res1 : 4; + uint16_t res2 : 2; + uint16_t urg : 1; + uint16_t ack : 1; + uint16_t psh : 1; + uint16_t rst : 1; + uint16_t syn : 1; + uint16_t fin : 1; +#endif + uint16_t window; + uint16_t check; + uint16_t urg_ptr; + }; + struct { +#endif + + uint16_t th_sport; + uint16_t th_dport; + uint32_t th_seq; + uint32_t th_ack; +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t th_x2 : 4; + uint8_t th_off : 4; +#else + uint8_t th_off : 4; + uint8_t th_x2 : 4; +#endif + uint8_t th_flags; + uint16_t th_win; + uint16_t th_sum; + uint16_t th_urp; + +#ifdef _GNU_SOURCE + }; + }; +#endif +}; +#endif + +#ifdef _GNU_SOURCE +#define TCPI_OPT_TIMESTAMPS 1 +#define TCPI_OPT_SACK 2 +#define TCPI_OPT_WSCALE 4 +#define TCPI_OPT_ECN 8 + +#define TCP_CA_Open 0 +#define TCP_CA_Disorder 1 +#define TCP_CA_CWR 2 +#define TCP_CA_Recovery 3 +#define TCP_CA_Loss 4 + +struct tcp_info { + uint8_t tcpi_state; + uint8_t tcpi_ca_state; + uint8_t tcpi_retransmits; + uint8_t tcpi_probes; + uint8_t tcpi_backoff; + uint8_t tcpi_options; + uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + uint32_t tcpi_rto; + uint32_t tcpi_ato; + uint32_t tcpi_snd_mss; + uint32_t tcpi_rcv_mss; + uint32_t tcpi_unacked; + uint32_t tcpi_sacked; + uint32_t tcpi_lost; + uint32_t tcpi_retrans; + uint32_t tcpi_fackets; + uint32_t tcpi_last_data_sent; + uint32_t tcpi_last_ack_sent; + uint32_t tcpi_last_data_recv; + uint32_t tcpi_last_ack_recv; + uint32_t tcpi_pmtu; + uint32_t tcpi_rcv_ssthresh; + uint32_t tcpi_rtt; + uint32_t tcpi_rttvar; + uint32_t tcpi_snd_ssthresh; + uint32_t tcpi_snd_cwnd; + uint32_t tcpi_advmss; + uint32_t tcpi_reordering; + uint32_t tcpi_rcv_rtt; + uint32_t tcpi_rcv_space; + uint32_t tcpi_total_retrans; + uint64_t tcpi_pacing_rate; + uint64_t tcpi_max_pacing_rate; + uint64_t tcpi_bytes_acked; + uint64_t tcpi_bytes_received; + uint32_t tcpi_segs_out; + uint32_t tcpi_segs_in; +}; + +#define TCP_MD5SIG_MAXKEYLEN 80 + +struct tcp_md5sig { + struct sockaddr_storage tcpm_addr; + uint16_t __tcpm_pad1; + uint16_t tcpm_keylen; + uint32_t __tcpm_pad2; + uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; +}; + +#endif + +#endif // SYSROOT_NETINET_TCP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/udp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/udp.h new file mode 100644 index 0000000..1a0fba7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netinet/udp.h
@@ -0,0 +1,38 @@ +#ifndef SYSROOT_NETINET_UDP_H_ +#define SYSROOT_NETINET_UDP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <stdint.h> + +#ifdef _GNU_SOURCE +#define uh_sport source +#define uh_dport dest +#define uh_ulen len +#define uh_sum check +#endif + +struct udphdr { + uint16_t uh_sport; + uint16_t uh_dport; + uint16_t uh_ulen; + uint16_t uh_sum; +}; + +#define UDP_CORK 1 +#define UDP_ENCAP 100 + +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 +#define UDP_ENCAP_ESPINUDP 2 +#define UDP_ENCAP_L2TPINUDP 3 + +#define SOL_UDP 17 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETINET_UDP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/netpacket/packet.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netpacket/packet.h new file mode 100644 index 0000000..3066046 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/netpacket/packet.h
@@ -0,0 +1,61 @@ +#ifndef SYSROOT_NETPACKET_PACKET_H_ +#define SYSROOT_NETPACKET_PACKET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct sockaddr_ll { + unsigned short sll_family, sll_protocol; + int sll_ifindex; + unsigned short sll_hatype; + unsigned char sll_pkttype, sll_halen; + unsigned char sll_addr[8]; +}; + +struct packet_mreq { + int mr_ifindex; + unsigned short int mr_type, mr_alen; + unsigned char mr_address[8]; +}; + +#define PACKET_HOST 0 +#define PACKET_BROADCAST 1 +#define PACKET_MULTICAST 2 +#define PACKET_OTHERHOST 3 +#define PACKET_OUTGOING 4 +#define PACKET_LOOPBACK 5 +#define PACKET_FASTROUTE 6 + +#define PACKET_ADD_MEMBERSHIP 1 +#define PACKET_DROP_MEMBERSHIP 2 +#define PACKET_RECV_OUTPUT 3 +#define PACKET_RX_RING 5 +#define PACKET_STATISTICS 6 +#define PACKET_COPY_THRESH 7 +#define PACKET_AUXDATA 8 +#define PACKET_ORIGDEV 9 +#define PACKET_VERSION 10 +#define PACKET_HDRLEN 11 +#define PACKET_RESERVE 12 +#define PACKET_TX_RING 13 +#define PACKET_LOSS 14 +#define PACKET_VNET_HDR 15 +#define PACKET_TX_TIMESTAMP 16 +#define PACKET_TIMESTAMP 17 +#define PACKET_FANOUT 18 +#define PACKET_TX_HAS_OFF 19 +#define PACKET_QDISC_BYPASS 20 +#define PACKET_ROLLOVER_STATS 21 +#define PACKET_FANOUT_DATA 22 + +#define PACKET_MR_MULTICAST 0 +#define PACKET_MR_PROMISC 1 +#define PACKET_MR_ALLMULTI 2 +#define PACKET_MR_UNICAST 3 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NETPACKET_PACKET_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/nl_types.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/nl_types.h new file mode 100644 index 0000000..e30f86e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/nl_types.h
@@ -0,0 +1,22 @@ +#ifndef SYSROOT_NL_TYPES_H_ +#define SYSROOT_NL_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define NL_SETD 1 +#define NL_CAT_LOCALE 1 + +typedef int nl_item; +typedef void* nl_catd; + +nl_catd catopen(const char*, int); +char* catgets(nl_catd, int, int, const char*); +int catclose(nl_catd); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_NL_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/paths.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/paths.h new file mode 100644 index 0000000..0ff06aa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/paths.h
@@ -0,0 +1,28 @@ +#ifndef SYSROOT_PATHS_H_ +#define SYSROOT_PATHS_H_ + +#define _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin" +#define _PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_KLOG "/proc/kmsg" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MNTTAB "/etc/fstab" +#define _PATH_MOUNTED "/etc/mtab" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_VI "/usr/bin/vi" +#define _PATH_WTMP "/dev/null/wtmp" + +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/lib/misc/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" + +#endif // SYSROOT_PATHS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/poll.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/poll.h new file mode 100644 index 0000000..4c7c800 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/poll.h
@@ -0,0 +1,51 @@ +#ifndef SYSROOT_POLL_H_ +#define SYSROOT_POLL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/poll.h> + +#define POLLIN 0x001 +#define POLLPRI 0x002 +#define POLLOUT 0x004 +#define POLLERR 0x008 +#define POLLHUP 0x010 +#define POLLNVAL 0x020 +#define POLLRDNORM 0x040 +#define POLLRDBAND 0x080 +#ifndef POLLWRNORM +#define POLLWRNORM 0x100 +#define POLLWRBAND 0x200 +#endif +#ifndef POLLMSG +#define POLLMSG 0x400 +#define POLLRDHUP 0x2000 +#endif + +typedef unsigned long nfds_t; + +struct pollfd { + int fd; + short events; + short revents; +}; + +int poll(struct pollfd*, nfds_t, int); + +#ifdef _GNU_SOURCE +#define __NEED_time_t +#define __NEED_struct_timespec +#define __NEED_sigset_t +#include <bits/alltypes.h> +int ppoll(struct pollfd*, nfds_t, const struct timespec*, const sigset_t*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_POLL_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/pthread.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/pthread.h new file mode 100644 index 0000000..d4b9f00 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/pthread.h
@@ -0,0 +1,200 @@ +#ifndef SYSROOT_PTHREAD_H_ +#define SYSROOT_PTHREAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_time_t +#define __NEED_clockid_t +#define __NEED_struct_timespec +#define __NEED_sigset_t +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t +#define __NEED_size_t + +#include <sched.h> +#include <time.h> + +#include <bits/alltypes.h> + +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_CREATE_DETACHED 1 + +#define PTHREAD_MUTEX_NORMAL 0 +#define PTHREAD_MUTEX_DEFAULT 0 +#define PTHREAD_MUTEX_RECURSIVE 1 +#define PTHREAD_MUTEX_ERRORCHECK 2 + +#define PTHREAD_MUTEX_STALLED 0 +#define PTHREAD_MUTEX_ROBUST 1 + +#define PTHREAD_PRIO_NONE 0 +#define PTHREAD_PRIO_INHERIT 1 +#define PTHREAD_PRIO_PROTECT 2 + +#define PTHREAD_INHERIT_SCHED 0 +#define PTHREAD_EXPLICIT_SCHED 1 + +#define PTHREAD_SCOPE_SYSTEM 0 +#define PTHREAD_SCOPE_PROCESS 1 + +#define PTHREAD_PROCESS_PRIVATE 0 + +#define PTHREAD_MUTEX_INITIALIZER \ + {} +#define PTHREAD_RWLOCK_INITIALIZER \ + {} +#define PTHREAD_COND_INITIALIZER \ + {} +#define PTHREAD_ONCE_INIT 0 + +#define PTHREAD_CANCEL_ENABLE 0 +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_MASKED 2 + +#define PTHREAD_CANCEL_DEFERRED 0 +#define PTHREAD_CANCEL_ASYNCHRONOUS 1 + +#define PTHREAD_CANCELED ((void*)-1) + +#define PTHREAD_BARRIER_SERIAL_THREAD (-1) + +int pthread_create(pthread_t* __restrict, const pthread_attr_t* __restrict, void* (*)(void*), + void* __restrict); +int pthread_detach(pthread_t); +_Noreturn void pthread_exit(void*); +int pthread_join(pthread_t, void**); + +pthread_t pthread_self(void); + +int pthread_equal(pthread_t, pthread_t); +#ifndef __cplusplus +#define pthread_equal(x, y) ((x) == (y)) +#endif + +int pthread_setcancelstate(int, int*); +int pthread_setcanceltype(int, int*); +void pthread_testcancel(void); +int pthread_cancel(pthread_t); + +int pthread_once(pthread_once_t*, void (*)(void)); + +int pthread_mutex_init(pthread_mutex_t* __restrict, const pthread_mutexattr_t* __restrict); +int pthread_mutex_lock(pthread_mutex_t*); +int pthread_mutex_unlock(pthread_mutex_t*); +int pthread_mutex_trylock(pthread_mutex_t*); +int pthread_mutex_timedlock(pthread_mutex_t* __restrict, const struct timespec* __restrict); +int pthread_mutex_destroy(pthread_mutex_t*); +int pthread_mutex_consistent(pthread_mutex_t*); + +int pthread_mutex_getprioceiling(const pthread_mutex_t* __restrict, int* __restrict); +int pthread_mutex_setprioceiling(pthread_mutex_t* __restrict, int, int* __restrict); + +int pthread_cond_init(pthread_cond_t* __restrict, const pthread_condattr_t* __restrict); +int pthread_cond_destroy(pthread_cond_t*); +int pthread_cond_wait(pthread_cond_t* __restrict, pthread_mutex_t* __restrict); +int pthread_cond_timedwait(pthread_cond_t* __restrict, pthread_mutex_t* __restrict, + const struct timespec* __restrict); +int pthread_cond_broadcast(pthread_cond_t*); +int pthread_cond_signal(pthread_cond_t*); + +int pthread_rwlock_init(pthread_rwlock_t* __restrict, const pthread_rwlockattr_t* __restrict); +int pthread_rwlock_destroy(pthread_rwlock_t*); +int pthread_rwlock_rdlock(pthread_rwlock_t*); +int pthread_rwlock_tryrdlock(pthread_rwlock_t*); +int pthread_rwlock_timedrdlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict); +int pthread_rwlock_wrlock(pthread_rwlock_t*); +int pthread_rwlock_trywrlock(pthread_rwlock_t*); +int pthread_rwlock_timedwrlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict); +int pthread_rwlock_unlock(pthread_rwlock_t*); + +int pthread_spin_init(pthread_spinlock_t*, int); +int pthread_spin_destroy(pthread_spinlock_t*); +int pthread_spin_lock(pthread_spinlock_t*); +int pthread_spin_trylock(pthread_spinlock_t*); +int pthread_spin_unlock(pthread_spinlock_t*); + +int pthread_barrier_init(pthread_barrier_t* __restrict, const pthread_barrierattr_t* __restrict, + unsigned); +int pthread_barrier_destroy(pthread_barrier_t*); +int pthread_barrier_wait(pthread_barrier_t*); + +int pthread_key_create(pthread_key_t*, void (*)(void*)); +int pthread_key_delete(pthread_key_t); +void* pthread_getspecific(pthread_key_t); +int pthread_setspecific(pthread_key_t, const void*); + +int pthread_attr_init(pthread_attr_t*); +int pthread_attr_destroy(pthread_attr_t*); + +int pthread_attr_getguardsize(const pthread_attr_t* __restrict, size_t* __restrict); +int pthread_attr_setguardsize(pthread_attr_t*, size_t); +int pthread_attr_getstacksize(const pthread_attr_t* __restrict, size_t* __restrict); +int pthread_attr_setstacksize(pthread_attr_t*, size_t); +int pthread_attr_getdetachstate(const pthread_attr_t*, int*); +int pthread_attr_setdetachstate(pthread_attr_t*, int); +int pthread_attr_getstack(const pthread_attr_t* __restrict, void** __restrict, size_t* __restrict); +int pthread_attr_setstack(pthread_attr_t*, void*, size_t) __attribute__((__deprecated__( + "pthread_attr_setstack is not available in Fuchsia; perhaps pthread_attr_setstacksize and/or " + "pthread_attr_setguardsize is sufficient for your needs?"))); +int pthread_attr_getschedparam(const pthread_attr_t* __restrict, struct sched_param* __restrict); +int pthread_attr_setschedparam(pthread_attr_t* __restrict, const struct sched_param* __restrict); + +int pthread_mutexattr_destroy(pthread_mutexattr_t*); +int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_getrobust(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_gettype(const pthread_mutexattr_t* __restrict, int* __restrict); +int pthread_mutexattr_init(pthread_mutexattr_t*); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t*, int); +int pthread_mutexattr_setprotocol(pthread_mutexattr_t*, int); +int pthread_mutexattr_setrobust(pthread_mutexattr_t*, int); +int pthread_mutexattr_settype(pthread_mutexattr_t*, int); + +int pthread_condattr_init(pthread_condattr_t*); +int pthread_condattr_destroy(pthread_condattr_t*); +int pthread_condattr_setclock(pthread_condattr_t*, clockid_t); +int pthread_condattr_getclock(const pthread_condattr_t* __restrict, clockid_t* __restrict); + +int pthread_rwlockattr_init(pthread_rwlockattr_t*); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t*); + +int pthread_barrierattr_destroy(pthread_barrierattr_t*); +int pthread_barrierattr_init(pthread_barrierattr_t*); + +int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); + +int pthread_getconcurrency(void); +int pthread_setconcurrency(int); + +int pthread_getcpuclockid(pthread_t, clockid_t*); + +#define pthread_cleanup_push(f, x) +#define pthread_cleanup_pop(r) + +#ifdef _GNU_SOURCE +struct cpu_set_t; +int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t*); +int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t*); +int pthread_getattr_np(pthread_t, pthread_attr_t*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_PTHREAD_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/pwd.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/pwd.h new file mode 100644 index 0000000..213eefa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/pwd.h
@@ -0,0 +1,48 @@ +#ifndef SYSROOT_PWD_H_ +#define SYSROOT_PWD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_uid_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include <bits/alltypes.h> + +struct passwd { + char* pw_name; + char* pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char* pw_gecos; + char* pw_dir; + char* pw_shell; +}; + +void setpwent(void); +void endpwent(void); +struct passwd* getpwent(void); + +struct passwd* getpwuid(uid_t); +struct passwd* getpwnam(const char*); +int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**); +int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**); + +#ifdef _GNU_SOURCE +struct passwd* fgetpwent(FILE*); +int putpwent(const struct passwd*, FILE*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_PWD_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/regex.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/regex.h new file mode 100644 index 0000000..53fac22 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/regex.h
@@ -0,0 +1,62 @@ +#ifndef SYSROOT_REGEX_H_ +#define SYSROOT_REGEX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_regoff_t +#define __NEED_size_t + +#include <bits/alltypes.h> + +typedef struct re_pattern_buffer { + size_t re_nsub; + void *__opaque, *__padding[4]; + size_t __nsub2; + char __padding2; +} regex_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +#define REG_EXTENDED 1 +#define REG_ICASE 2 +#define REG_NEWLINE 4 +#define REG_NOSUB 8 + +#define REG_NOTBOL 1 +#define REG_NOTEOL 2 + +#define REG_OK 0 +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 + +#define REG_ENOSYS -1 + +int regcomp(regex_t* __restrict, const char* __restrict, int); +int regexec(const regex_t* __restrict, const char* __restrict, size_t, regmatch_t* __restrict, int); +void regfree(regex_t*); + +size_t regerror(int, const regex_t* __restrict, char* __restrict, size_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_REGEX_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/resolv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/resolv.h new file mode 100644 index 0000000..a90e0e8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/resolv.h
@@ -0,0 +1,143 @@ +#ifndef SYSROOT_RESOLV_H_ +#define SYSROOT_RESOLV_H_ + +#include <arpa/nameser.h> +#include <netinet/in.h> +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAXNS 3 +#define MAXDFLSRCH 3 +#define MAXDNSRCH 6 +#define LOCALDOMAINPARTS 2 + +#define RES_TIMEOUT 5 +#define MAXRESOLVSORT 10 +#define RES_MAXNDOTS 15 +#define RES_MAXRETRANS 30 +#define RES_MAXRETRY 5 +#define RES_DFLRETRY 2 +#define RES_MAXTIME 65535 + +/* unused; purely for broken apps */ +typedef struct __res_state { + int retrans; + int retry; + unsigned long options; + int nscount; + struct sockaddr_in nsaddr_list[MAXNS]; +#define nsaddr nsaddr_list[0] + unsigned short id; + char* dnsrch[MAXDNSRCH + 1]; + char defdname[256]; + unsigned long pfcode; + unsigned ndots : 4; + unsigned nsort : 4; + unsigned ipv6_unavail : 1; + unsigned unused : 23; + struct { + struct in_addr addr; + uint32_t mask; + } sort_list[MAXRESOLVSORT]; + void* qhook; + void* rhook; + int res_h_errno; + int _vcsock; + unsigned _flags; + union { + char pad[52]; + struct { + uint16_t nscount; + uint16_t nsmap[MAXNS]; + int nssocks[MAXNS]; + uint16_t nscount6; + uint16_t nsinit; + struct sockaddr_in6* nsaddrs[MAXNS]; + unsigned int _initstamp[2]; + } _ext; + } _u; +} * res_state; + +#define __RES 19991006 + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +struct res_sym { + int number; + char* name; + char* humanname; +}; + +#define RES_F_VC 0x00000001 +#define RES_F_CONN 0x00000002 +#define RES_F_EDNS0ERR 0x00000004 + +#define RES_EXHAUSTIVE 0x00000001 + +#define RES_INIT 0x00000001 +#define RES_DEBUG 0x00000002 +#define RES_AAONLY 0x00000004 +#define RES_USEVC 0x00000008 +#define RES_PRIMARY 0x00000010 +#define RES_IGNTC 0x00000020 +#define RES_RECURSE 0x00000040 +#define RES_DEFNAMES 0x00000080 +#define RES_STAYOPEN 0x00000100 +#define RES_DNSRCH 0x00000200 +#define RES_INSECURE1 0x00000400 +#define RES_INSECURE2 0x00000800 +#define RES_NOALIASES 0x00001000 +#define RES_USE_INET6 0x00002000 +#define RES_ROTATE 0x00004000 +#define RES_NOCHECKNAME 0x00008000 +#define RES_KEEPTSIG 0x00010000 +#define RES_BLAST 0x00020000 +#define RES_USEBSTRING 0x00040000 +#define RES_NOIP6DOTINT 0x00080000 +#define RES_USE_EDNS0 0x00100000 +#define RES_SNGLKUP 0x00200000 +#define RES_SNGLKUPREOP 0x00400000 +#define RES_USE_DNSSEC 0x00800000 + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH | RES_NOIP6DOTINT) + +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 + +struct __res_state* __res_state(void); +#define _res (*__res_state()) + +int res_init(void); +int res_query(const char*, int, int, unsigned char*, int); +int res_querydomain(const char*, const char*, int, int, unsigned char*, int); +int res_search(const char*, int, int, unsigned char*, int); +int res_mkquery(int, const char*, int, int, const unsigned char*, int, const unsigned char*, + unsigned char*, int); +int res_send(const unsigned char*, int, unsigned char*, int); +int dn_comp(const char*, unsigned char*, int, unsigned char**, unsigned char**); +int dn_expand(const unsigned char*, const unsigned char*, const unsigned char*, char*, int); +int dn_skipname(const unsigned char*, const unsigned char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_RESOLV_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sched.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sched.h new file mode 100644 index 0000000..ac06166 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sched.h
@@ -0,0 +1,110 @@ +#ifndef SYSROOT_SCHED_H_ +#define SYSROOT_SCHED_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_struct_timespec +#define __NEED_pid_t +#define __NEED_time_t + +#ifdef _GNU_SOURCE +#define __NEED_size_t +#endif + +#include <bits/alltypes.h> + +struct sched_param { + int sched_priority; + int sched_ss_low_priority; + struct timespec sched_ss_repl_period; + struct timespec sched_ss_init_budget; + int sched_ss_max_repl; +}; + +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_getparam(pid_t, struct sched_param*); +int sched_getscheduler(pid_t); +int sched_rr_get_interval(pid_t, struct timespec*); +int sched_setparam(pid_t, const struct sched_param*); +int sched_setscheduler(pid_t, int, const struct sched_param*); +int sched_yield(void); + +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#define SCHED_BATCH 3 +#define SCHED_IDLE 5 +#define SCHED_DEADLINE 6 +#define SCHED_RESET_ON_FORK 0x40000000 + +#ifdef _GNU_SOURCE +void* memcpy(void* __restrict, const void* __restrict, size_t); +int memcmp(const void*, const void*, size_t); +void* calloc(size_t, size_t); +void free(void*); + +typedef struct cpu_set_t { + unsigned long __bits[128 / sizeof(long)]; +} cpu_set_t; +int __sched_cpucount(size_t, const cpu_set_t*); +int sched_getcpu(void); +int sched_getaffinity(pid_t, size_t, cpu_set_t*); +int sched_setaffinity(pid_t, size_t, const cpu_set_t*); + +#define __CPU_op_S(i, size, set, op) \ + ((i) / 8U >= (size) \ + ? 0 \ + : ((set)->__bits[(i) / 8 / sizeof(long)] op(1UL << ((i) % (8 * sizeof(long)))))) + +#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=) +#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &= ~) +#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &) + +#define __CPU_op_func_S(func, op) \ + static __inline void __CPU_##func##_S(size_t __size, cpu_set_t* __dest, const cpu_set_t* __src1, \ + const cpu_set_t* __src2) { \ + size_t __i; \ + for (__i = 0; __i < __size / sizeof(long); __i++) \ + __dest->__bits[__i] = __src1->__bits[__i] op __src2->__bits[__i]; \ + } + +__CPU_op_func_S(AND, &) __CPU_op_func_S(OR, |) __CPU_op_func_S(XOR, ^) + +#define CPU_AND_S(a, b, c, d) __CPU_AND_S(a, b, c, d) +#define CPU_OR_S(a, b, c, d) __CPU_OR_S(a, b, c, d) +#define CPU_XOR_S(a, b, c, d) __CPU_XOR_S(a, b, c, d) + +#define CPU_COUNT_S(size, set) __sched_cpucount(size, set) +#define CPU_ZERO_S(size, set) memset(set, 0, size) +#define CPU_EQUAL_S(size, set1, set2) (!memcmp(set1, set2, size)) + +#define CPU_ALLOC_SIZE(n) \ + (sizeof(long) * ((n) / (8 * sizeof(long)) + \ + ((n) % (8 * sizeof(long)) + 8 * sizeof(long) - 1) / (8 * sizeof(long)))) +#define CPU_ALLOC(n) ((cpu_set_t*)calloc(1, CPU_ALLOC_SIZE(n))) +#define CPU_FREE(set) free(set) + +#define CPU_SETSIZE 128 + +#define CPU_SET(i, set) CPU_SET_S(i, sizeof(cpu_set_t), set) +#define CPU_CLR(i, set) CPU_CLR_S(i, sizeof(cpu_set_t), set) +#define CPU_ISSET(i, set) CPU_ISSET_S(i, sizeof(cpu_set_t), set) +#define CPU_AND(d, s1, s2) CPU_AND_S(sizeof(cpu_set_t), d, s1, s2) +#define CPU_OR(d, s1, s2) CPU_OR_S(sizeof(cpu_set_t), d, s1, s2) +#define CPU_XOR(d, s1, s2) CPU_XOR_S(sizeof(cpu_set_t), d, s1, s2) +#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t), set) +#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t), set) +#define CPU_EQUAL(s1, s2) CPU_EQUAL_S(sizeof(cpu_set_t), s1, s2) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SCHED_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/search.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/search.h new file mode 100644 index 0000000..5348eab --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/search.h
@@ -0,0 +1,61 @@ +#ifndef SYSROOT_SEARCH_H_ +#define SYSROOT_SEARCH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#include <bits/alltypes.h> + +typedef enum { FIND, ENTER } ACTION; +typedef enum { preorder, postorder, endorder, leaf } VISIT; + +typedef struct entry { + char* key; + void* data; +} ENTRY; + +int hcreate(size_t); +void hdestroy(void); +ENTRY* hsearch(ENTRY, ACTION); + +#ifdef _GNU_SOURCE +struct hsearch_data { + struct __tab* __tab; + unsigned int __unused1; + unsigned int __unused2; +}; + +int hcreate_r(size_t, struct hsearch_data*); +void hdestroy_r(struct hsearch_data*); +int hsearch_r(ENTRY, ACTION, ENTRY**, struct hsearch_data*); +#endif + +void insque(void*, void*); +void remque(void*); + +void* lsearch(const void*, void*, size_t*, size_t, int (*)(const void*, const void*)); +void* lfind(const void*, const void*, size_t*, size_t, int (*)(const void*, const void*)); + +void* tdelete(const void* __restrict, void** __restrict, int (*)(const void*, const void*)); +void* tfind(const void*, void* const*, int (*)(const void*, const void*)); +void* tsearch(const void*, void**, int (*)(const void*, const void*)); +void twalk(const void*, void (*)(const void*, VISIT, int)); + +#ifdef _GNU_SOURCE +struct qelem { + struct qelem *q_forw, *q_back; + char q_data[1]; +}; + +void tdestroy(void*, void (*)(void*)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SEARCH_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/semaphore.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/semaphore.h new file mode 100644 index 0000000..d9e996e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/semaphore.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_SEMAPHORE_H_ +#define SYSROOT_SEMAPHORE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_sem_t +#define __NEED_time_t +#define __NEED_struct_timespec +#include <fcntl.h> + +#include <bits/alltypes.h> + +#define SEM_FAILED ((sem_t*)0) + +int sem_close(sem_t*); +int sem_destroy(sem_t*); +int sem_getvalue(sem_t* __restrict, int* __restrict); +int sem_init(sem_t*, int, unsigned); +sem_t* sem_open(const char*, int, ...); +int sem_post(sem_t*); +int sem_timedwait(sem_t* __restrict, const struct timespec* __restrict); +int sem_trywait(sem_t*); +int sem_unlink(const char*); +int sem_wait(sem_t*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SEMAPHORE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/setjmp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/setjmp.h new file mode 100644 index 0000000..65971b7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/setjmp.h
@@ -0,0 +1,39 @@ +#ifndef SYSROOT_SETJMP_H_ +#define SYSROOT_SETJMP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/setjmp.h> + +typedef struct __jmp_buf_tag { + __jmp_buf __jb; + unsigned long __fl; + unsigned long __ss[128 / sizeof(long)]; +} jmp_buf[1]; + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef jmp_buf sigjmp_buf; +int sigsetjmp(sigjmp_buf, int); +_Noreturn void siglongjmp(sigjmp_buf, int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int _setjmp(jmp_buf); +_Noreturn void _longjmp(jmp_buf, int); +#endif + +int setjmp(jmp_buf); +_Noreturn void longjmp(jmp_buf, int); + +#define setjmp setjmp + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SETJMP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/signal.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/signal.h new file mode 100644 index 0000000..594cf80 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/signal.h
@@ -0,0 +1,263 @@ +#ifndef SYSROOT_SIGNAL_H_ +#define SYSROOT_SIGNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#ifdef _GNU_SOURCE +#define __ucontext ucontext +#endif + +#define __NEED_size_t +#define __NEED_pid_t +#define __NEED_uid_t +#define __NEED_struct_timespec +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_time_t +#define __NEED_clock_t +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 + +#define SI_ASYNCNL (-60) +#define SI_TKILL (-6) +#define SI_SIGIO (-5) +#define SI_ASYNCIO (-4) +#define SI_MESGQ (-3) +#define SI_TIMER (-2) +#define SI_QUEUE (-1) +#define SI_USER 0 +#define SI_KERNEL 128 + +typedef struct sigaltstack stack_t; + +#endif + +#include <bits/signal.h> + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define SIG_HOLD ((void (*)(int))2) + +#define FPE_INTDIV 1 +#define FPE_INTOVF 2 +#define FPE_FLTDIV 3 +#define FPE_FLTOVF 4 +#define FPE_FLTUND 5 +#define FPE_FLTRES 6 +#define FPE_FLTINV 7 +#define FPE_FLTSUB 8 + +#define ILL_ILLOPC 1 +#define ILL_ILLOPN 2 +#define ILL_ILLADR 3 +#define ILL_ILLTRP 4 +#define ILL_PRVOPC 5 +#define ILL_PRVREG 6 +#define ILL_COPROC 7 +#define ILL_BADSTK 8 + +#define SEGV_MAPERR 1 +#define SEGV_ACCERR 2 +#define SEGV_BNDERR 3 + +#define BUS_ADRALN 1 +#define BUS_ADRERR 2 +#define BUS_OBJERR 3 +#define BUS_MCEERR_AR 4 +#define BUS_MCEERR_AO 5 + +#define CLD_EXITED 1 +#define CLD_KILLED 2 +#define CLD_DUMPED 3 +#define CLD_TRAPPED 4 +#define CLD_STOPPED 5 +#define CLD_CONTINUED 6 + +union sigval { + int sival_int; + void* sival_ptr; +}; + +typedef struct { +#ifdef __SI_SWAP_ERRNO_CODE + int si_signo, si_code, si_errno; +#else + int si_signo, si_errno, si_code; +#endif + union { + char __pad[128 - 2 * sizeof(int) - sizeof(long)]; + struct { + union { + struct { + pid_t si_pid; + uid_t si_uid; + } __piduid; + struct { + int si_timerid; + int si_overrun; + } __timer; + } __first; + union { + union sigval si_value; + struct { + int si_status; + clock_t si_utime, si_stime; + } __sigchld; + } __second; + } __si_common; + struct { + void* si_addr; + short si_addr_lsb; + struct { + void* si_lower; + void* si_upper; + } __addr_bnd; + } __sigfault; + struct { + long si_band; + int si_fd; + } __sigpoll; + struct { + void* si_call_addr; + int si_syscall; + unsigned si_arch; + } __sigsys; + } __si_fields; +} siginfo_t; +#define si_pid __si_fields.__si_common.__first.__piduid.si_pid +#define si_uid __si_fields.__si_common.__first.__piduid.si_uid +#define si_status __si_fields.__si_common.__second.__sigchld.si_status +#define si_utime __si_fields.__si_common.__second.__sigchld.si_utime +#define si_stime __si_fields.__si_common.__second.__sigchld.si_stime +#define si_value __si_fields.__si_common.__second.si_value +#define si_addr __si_fields.__sigfault.si_addr +#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb +#define si_lower __si_fields.__sigfault.__addr_bnd.si_lower +#define si_upper __si_fields.__sigfault.__addr_bnd.si_upper +#define si_band __si_fields.__sigpoll.si_band +#define si_fd __si_fields.__sigpoll.si_fd +#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid +#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun +#define si_ptr si_value.sival_ptr +#define si_int si_value.sival_int +#define si_call_addr __si_fields.__sigsys.si_call_addr +#define si_syscall __si_fields.__sigsys.si_syscall +#define si_arch __si_fields.__sigsys.si_arch + +struct sigaction { + union { + void (*sa_handler)(int); + void (*sa_sigaction)(int, siginfo_t*, void*); + } __sa_handler; + sigset_t sa_mask; + int sa_flags; + void (*sa_restorer)(void); +}; +#define sa_handler __sa_handler.sa_handler +#define sa_sigaction __sa_handler.sa_sigaction + +struct sigevent { + union sigval sigev_value; + int sigev_signo; + int sigev_notify; + void (*sigev_notify_function)(union sigval); + pthread_attr_t* sigev_notify_attributes; + char __pad[56 - 3 * sizeof(long)]; +}; + +#define SIGEV_SIGNAL 0 +#define SIGEV_NONE 1 +#define SIGEV_THREAD 2 + +int __libc_current_sigrtmin(void); +int __libc_current_sigrtmax(void); + +#define SIGRTMIN (__libc_current_sigrtmin()) +#define SIGRTMAX (__libc_current_sigrtmax()) + +int kill(pid_t, int); + +int sigemptyset(sigset_t*); +int sigfillset(sigset_t*); +int sigaddset(sigset_t*, int); +int sigdelset(sigset_t*, int); +int sigismember(const sigset_t*, int); + +int sigprocmask(int, const sigset_t* __restrict, sigset_t* __restrict); +int sigsuspend(const sigset_t*); +int sigaction(int, const struct sigaction* __restrict, struct sigaction* __restrict); +int sigpending(sigset_t*); +int sigwait(const sigset_t* __restrict, int* __restrict); +int sigwaitinfo(const sigset_t* __restrict, siginfo_t* __restrict); +int sigtimedwait(const sigset_t* __restrict, siginfo_t* __restrict, + const struct timespec* __restrict); +int sigqueue(pid_t, int, const union sigval); + +int pthread_sigmask(int, const sigset_t* __restrict, sigset_t* __restrict); +int pthread_kill(pthread_t, int); + +void psiginfo(const siginfo_t*, const char*); +void psignal(int, const char*); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +int killpg(pid_t, int); +int sigaltstack(const stack_t* __restrict, stack_t* __restrict); +int siginterrupt(int, int); +int sigpause(int); +#define TRAP_BRKPT 1 +#define TRAP_TRACE 2 +#define POLL_IN 1 +#define POLL_OUT 2 +#define POLL_MSG 3 +#define POLL_ERR 4 +#define POLL_PRI 5 +#define POLL_HUP 6 +#define SS_ONSTACK 1 +#define SS_DISABLE 2 +#endif + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define NSIG _NSIG +typedef void (*sig_t)(int); +#endif + +#ifdef _GNU_SOURCE +typedef void (*sighandler_t)(int); +void (*bsd_signal(int, void (*)(int)))(int); +int sigisemptyset(const sigset_t*); +int sigorset(sigset_t*, const sigset_t*, const sigset_t*); +int sigandset(sigset_t*, const sigset_t*, const sigset_t*); + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#endif + +#define SIG_ERR ((void (*)(int)) - 1) +#define SIG_DFL ((void (*)(int))0) +#define SIG_IGN ((void (*)(int))1) + +typedef int sig_atomic_t; + +void (*signal(int, void (*)(int)))(int); +int raise(int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SIGNAL_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/spawn.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/spawn.h new file mode 100644 index 0000000..1c70bb2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/spawn.h
@@ -0,0 +1,79 @@ +#ifndef SYSROOT_SPAWN_H_ +#define SYSROOT_SPAWN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_mode_t +#define __NEED_pid_t +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +struct sched_param; + +#define POSIX_SPAWN_RESETIDS 1 +#define POSIX_SPAWN_SETPGROUP 2 +#define POSIX_SPAWN_SETSIGDEF 4 +#define POSIX_SPAWN_SETSIGMASK 8 +#define POSIX_SPAWN_SETSCHEDPARAM 16 +#define POSIX_SPAWN_SETSCHEDULER 32 + +typedef struct { + int __flags; + pid_t __pgrp; + sigset_t __def, __mask; + int __prio, __pol, __pad[16]; +} posix_spawnattr_t; + +typedef struct { + int __pad0[2]; + void* __actions; + int __pad[16]; +} posix_spawn_file_actions_t; + +int posix_spawn(pid_t* __restrict, const char* __restrict, const posix_spawn_file_actions_t*, + const posix_spawnattr_t* __restrict, char* const* __restrict, + char* const* __restrict); +int posix_spawnp(pid_t* __restrict, const char* __restrict, const posix_spawn_file_actions_t*, + const posix_spawnattr_t* __restrict, char* const* __restrict, + char* const* __restrict); + +int posix_spawnattr_init(posix_spawnattr_t*); +int posix_spawnattr_destroy(posix_spawnattr_t*); + +int posix_spawnattr_setflags(posix_spawnattr_t*, short); +int posix_spawnattr_getflags(const posix_spawnattr_t* __restrict, short* __restrict); + +int posix_spawnattr_setpgroup(posix_spawnattr_t*, pid_t); +int posix_spawnattr_getpgroup(const posix_spawnattr_t* __restrict, pid_t* __restrict); + +int posix_spawnattr_setsigmask(posix_spawnattr_t* __restrict, const sigset_t* __restrict); +int posix_spawnattr_getsigmask(const posix_spawnattr_t* __restrict, sigset_t* __restrict); + +int posix_spawnattr_setsigdefault(posix_spawnattr_t* __restrict, const sigset_t* __restrict); +int posix_spawnattr_getsigdefault(const posix_spawnattr_t* __restrict, sigset_t* __restrict); + +int posix_spawnattr_setschedparam(posix_spawnattr_t* __restrict, + const struct sched_param* __restrict); +int posix_spawnattr_getschedparam(const posix_spawnattr_t* __restrict, + struct sched_param* __restrict); +int posix_spawnattr_setschedpolicy(posix_spawnattr_t*, int); +int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* __restrict, int* __restrict); + +int posix_spawn_file_actions_init(posix_spawn_file_actions_t*); +int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t*); + +int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* __restrict, int, + const char* __restrict, int, mode_t); +int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t*, int); +int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t*, int, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SPAWN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/stdio.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/stdio.h new file mode 100644 index 0000000..c08aba0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/stdio.h
@@ -0,0 +1,185 @@ +#ifndef SYSROOT_STDIO_H_ +#define SYSROOT_STDIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __printflike(__fmt, __varargs) __attribute__((__format__(__printf__, __fmt, __varargs))) +#define __scanflike(__fmt, __varargs) __attribute__((__format__(__scanf__, __fmt, __varargs))) + +#define __NEED_FILE +#define __NEED___isoc_va_list +#define __NEED_size_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_ssize_t +#define __NEED_off_t +#define __NEED_va_list +#endif + +#include <bits/alltypes.h> +#include <bits/null.h> + +#undef EOF +#define EOF (-1) + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 + +#define BUFSIZ 1024 +#define FILENAME_MAX 4096 +#define FOPEN_MAX 1000 +#define TMP_MAX 10000 +#define L_tmpnam 20 + +typedef union _G_fpos64_t { + char __opaque[16]; + double __align; +} fpos_t; + +extern FILE* const stdin; +extern FILE* const stdout; +extern FILE* const stderr; + +#define stdin (stdin) +#define stdout (stdout) +#define stderr (stderr) + +FILE* fopen(const char* __restrict, const char* __restrict); +FILE* freopen(const char* __restrict, const char* __restrict, FILE* __restrict); +int fclose(FILE*); + +int remove(const char*); +int rename(const char*, const char*); + +int feof(FILE*); +int ferror(FILE*); +int fflush(FILE*); +void clearerr(FILE*); + +int fseek(FILE*, long, int); +long ftell(FILE*); +void rewind(FILE*); + +int fgetpos(FILE* __restrict, fpos_t* __restrict); +int fsetpos(FILE*, const fpos_t*); + +size_t fread(void* __restrict, size_t, size_t, FILE* __restrict); +size_t fwrite(const void* __restrict, size_t, size_t, FILE* __restrict); + +int fgetc(FILE*); +int getc(FILE*); +int getchar(void); +int ungetc(int, FILE*); + +int fputc(int, FILE*); +int putc(int, FILE*); +int putchar(int); + +char* fgets(char* __restrict, int, FILE* __restrict); +#if __STDC_VERSION__ < 201112L +char* gets(char*); +#endif + +int fputs(const char* __restrict, FILE* __restrict); +int puts(const char*); + +int printf(const char* __restrict, ...) __printflike(1, 2); +int fprintf(FILE* __restrict, const char* __restrict, ...) __printflike(2, 3); +int sprintf(char* __restrict, const char* __restrict, ...) __printflike(2, 3); +int snprintf(char* __restrict, size_t, const char* __restrict, ...) __printflike(3, 4); + +int vprintf(const char* __restrict, __isoc_va_list) __printflike(1, 0); +int vfprintf(FILE* __restrict, const char* __restrict, __isoc_va_list) __printflike(2, 0); +int vsprintf(char* __restrict, const char* __restrict, __isoc_va_list) __printflike(2, 0); +int vsnprintf(char* __restrict, size_t, const char* __restrict, __isoc_va_list) __printflike(3, 0); + +int scanf(const char* __restrict, ...) __scanflike(1, 2); +int fscanf(FILE* __restrict, const char* __restrict, ...) __scanflike(2, 3); +int sscanf(const char* __restrict, const char* __restrict, ...) __scanflike(2, 3); +int vscanf(const char* __restrict, __isoc_va_list) __scanflike(1, 0); +int vfscanf(FILE* __restrict, const char* __restrict, __isoc_va_list) __scanflike(2, 0); +int vsscanf(const char* __restrict, const char* __restrict, __isoc_va_list) __scanflike(2, 0); + +void perror(const char*); + +int setvbuf(FILE* __restrict, char* __restrict, int, size_t); +void setbuf(FILE* __restrict, char* __restrict); + +char* tmpnam(char*); +FILE* tmpfile(void); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +FILE* fmemopen(void* __restrict, size_t, const char* __restrict); +FILE* open_memstream(char**, size_t*); +FILE* fdopen(int, const char*); +FILE* popen(const char*, const char*); +int pclose(FILE*); +int fileno(FILE*); +int fseeko(FILE*, off_t, int); +off_t ftello(FILE*); +int dprintf(int, const char* __restrict, ...) __printflike(2, 3); +int vdprintf(int, const char* __restrict, __isoc_va_list) __printflike(2, 0); +void flockfile(FILE*); +int ftrylockfile(FILE*); +void funlockfile(FILE*); +int getc_unlocked(FILE*); +int getchar_unlocked(void); +int putc_unlocked(int, FILE*); +int putchar_unlocked(int); +ssize_t getdelim(char** __restrict, size_t* __restrict, int, FILE* __restrict); +ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict); +int renameat(int, const char*, int, const char*); +char* ctermid(char*); +#define L_ctermid 20 +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define P_tmpdir "/tmp" +char* tempnam(const char*, const char*); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define L_cuserid 20 +char* cuserid(char*); +void setlinebuf(FILE*); +void setbuffer(FILE*, char*, size_t); +int fgetc_unlocked(FILE*); +int fputc_unlocked(int, FILE*); +int fflush_unlocked(FILE*); +size_t fread_unlocked(void*, size_t, size_t, FILE*); +size_t fwrite_unlocked(const void*, size_t, size_t, FILE*); +void clearerr_unlocked(FILE*); +int feof_unlocked(FILE*); +int ferror_unlocked(FILE*); +int fileno_unlocked(FILE*); +int getw(FILE*); +int putw(int, FILE*); +char* fgetln(FILE*, size_t*); +int asprintf(char**, const char*, ...) __printflike(2, 3); +int vasprintf(char**, const char*, __isoc_va_list) __printflike(2, 0); +#endif + +#ifdef _GNU_SOURCE +char* fgets_unlocked(char*, int, FILE*); +int fputs_unlocked(const char*, FILE*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STDIO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/stdlib.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/stdlib.h new file mode 100644 index 0000000..862c83f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/stdlib.h
@@ -0,0 +1,157 @@ +#ifndef SYSROOT_STDLIB_H_ +#define SYSROOT_STDLIB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_size_t +#define __NEED_wchar_t + +#include <bits/alltypes.h> + +int atoi(const char*); +long atol(const char*); +long long atoll(const char*); +double atof(const char*); + +float strtof(const char* __restrict, char** __restrict); +double strtod(const char* __restrict, char** __restrict); +long double strtold(const char* __restrict, char** __restrict); + +long strtol(const char* __restrict, char** __restrict, int); +unsigned long strtoul(const char* __restrict, char** __restrict, int); +long long strtoll(const char* __restrict, char** __restrict, int); +unsigned long long strtoull(const char* __restrict, char** __restrict, int); + +int rand(void); +void srand(unsigned); + +void* malloc(size_t); +void* calloc(size_t, size_t); +void* realloc(void*, size_t); +void free(void*); +void* aligned_alloc(size_t alignment, size_t size); + +_Noreturn void abort(void); +int atexit(void (*)(void)); +_Noreturn void exit(int); +_Noreturn void _Exit(int); +int at_quick_exit(void (*)(void)); +_Noreturn void quick_exit(int); + +char* getenv(const char*); + +int system(const char*); + +void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); +void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); + +int abs(int); +long labs(long); +long long llabs(long long); + +typedef struct { + int quot, rem; +} div_t; +typedef struct { + long quot, rem; +} ldiv_t; +typedef struct { + long long quot, rem; +} lldiv_t; + +div_t div(int, int); +ldiv_t ldiv(long, long); +lldiv_t lldiv(long long, long long); + +int mblen(const char*, size_t); +int mbtowc(wchar_t* __restrict, const char* __restrict, size_t); +int wctomb(char*, wchar_t); +size_t mbstowcs(wchar_t* __restrict, const char* __restrict, size_t); +size_t wcstombs(char* __restrict, const wchar_t* __restrict, size_t); + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +size_t __ctype_get_mb_cur_max(void); +#define MB_CUR_MAX (__ctype_get_mb_cur_max()) + +#define RAND_MAX (0x7fffffff) + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define WNOHANG 1 +#define WUNTRACED 2 + +#define WEXITSTATUS(s) (((s)&0xff00) >> 8) +#define WTERMSIG(s) ((s)&0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) ((short)((((s)&0xffff) * 0x10001) >> 8) > 0x7f00) +#define WIFSIGNALED(s) (((s)&0xffff) - 1U < 0xffu) + +int posix_memalign(void**, size_t, size_t); +int setenv(const char*, const char*, int); +int unsetenv(const char*); +int mkstemp(char*); +int mkostemp(char*, int); +char* mkdtemp(char*); +int getsubopt(char**, char* const*, char**); +int rand_r(unsigned*); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char* realpath(const char* __restrict, char* __restrict); +long int random(void); +void srandom(unsigned int); +char* initstate(unsigned int, char*, size_t); +char* setstate(char*); +int putenv(char*); +int posix_openpt(int); +int grantpt(int); +int unlockpt(int); +char* ptsname(int); +long a64l(const char*); +void setkey(const char*); +double drand48(void); +double erand48(unsigned short[3]); +long int lrand48(void); +long int nrand48(unsigned short[3]); +long mrand48(void); +long jrand48(unsigned short[3]); +void srand48(long); +unsigned short* seed48(unsigned short[3]); +void lcong48(unsigned short[7]); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include <alloca.h> +char* mktemp(char*); +int mkstemps(char*, int); +int mkostemps(char*, int, int); +void* valloc(size_t); +void* memalign(size_t, size_t); +int clearenv(void); +#define WCOREDUMP(s) ((s)&0x80) +#define WIFCONTINUED(s) ((s) == 0xffff) +#endif + +#ifdef _GNU_SOURCE +int ptsname_r(int, char*, size_t); +char* ecvt(double, int, int*, int*); +char* fcvt(double, int, int*, int*); +char* gcvt(double, int, char*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STDLIB_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/string.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/string.h new file mode 100644 index 0000000..0265b57 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/string.h
@@ -0,0 +1,90 @@ +#ifndef SYSROOT_STRING_H_ +#define SYSROOT_STRING_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +void* memcpy(void* __restrict, const void* __restrict, size_t); +void* memmove(void*, const void*, size_t); +void* memset(void*, int, size_t); +int memcmp(const void*, const void*, size_t); +void* memchr(const void*, int, size_t); + +char* strcpy(char* __restrict, const char* __restrict); +char* strncpy(char* __restrict, const char* __restrict, size_t); + +char* strcat(char* __restrict, const char* __restrict); +char* strncat(char* __restrict, const char* __restrict, size_t); + +int strcmp(const char*, const char*); +int strncmp(const char*, const char*, size_t); + +int strcoll(const char*, const char*); +size_t strxfrm(char* __restrict, const char* __restrict, size_t); + +char* strchr(const char*, int); +char* strrchr(const char*, int); + +size_t strcspn(const char*, const char*); +size_t strspn(const char*, const char*); +char* strpbrk(const char*, const char*); +char* strstr(const char*, const char*); +char* strtok(char* __restrict, const char* __restrict); + +size_t strlen(const char*); + +char* strerror(int); + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#include <strings.h> +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char* strtok_r(char* __restrict, const char* __restrict, char** __restrict); +int strerror_r(int, char*, size_t); +char* stpcpy(char* __restrict, const char* __restrict); +char* stpncpy(char* __restrict, const char* __restrict, size_t); +size_t strnlen(const char*, size_t); +char* strdup(const char*); +char* strndup(const char*, size_t); +char* strsignal(int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void* memccpy(void* __restrict, const void* __restrict, int, size_t); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char* strsep(char**, const char*); +size_t strlcat(char*, const char*, size_t); +size_t strlcpy(char*, const char*, size_t); +#endif + +#ifdef _GNU_SOURCE +#define strdupa(x) strcpy(alloca(strlen(x) + 1), x) +int strverscmp(const char*, const char*); +char* strchrnul(const char*, int); +char* strcasestr(const char*, const char*); +void* memmem(const void*, size_t, const void*, size_t); +void* memrchr(const void*, int, size_t); +void* mempcpy(void*, const void*, size_t); +#ifndef __cplusplus +char* basename(char*); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STRING_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/strings.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/strings.h new file mode 100644 index 0000000..eb703d1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/strings.h
@@ -0,0 +1,38 @@ +#ifndef SYSROOT_STRINGS_H_ +#define SYSROOT_STRINGS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#define __NEED_locale_t +#include <bits/alltypes.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) || \ + (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE + 0 < 200809L) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) +int bcmp(const void*, const void*, size_t); +void bcopy(const void*, void*, size_t); +void bzero(void*, size_t); +char* index(const char*, int); +char* rindex(const char*, int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int ffs(int); +int ffsl(long); +int ffsll(long long); +#endif + +int strcasecmp(const char*, const char*); +int strncasecmp(const char*, const char*, size_t); + +int strcasecmp_l(const char*, const char*, locale_t); +int strncasecmp_l(const char*, const char*, size_t, locale_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STRINGS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/stropts.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/stropts.h new file mode 100644 index 0000000..92eb968 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/stropts.h
@@ -0,0 +1,139 @@ +#ifndef SYSROOT_STROPTS_H_ +#define SYSROOT_STROPTS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __SID ('S' << 8) + +#define I_NREAD (__SID | 1) +#define I_PUSH (__SID | 2) +#define I_POP (__SID | 3) +#define I_LOOK (__SID | 4) +#define I_FLUSH (__SID | 5) +#define I_SRDOPT (__SID | 6) +#define I_GRDOPT (__SID | 7) +#define I_STR (__SID | 8) +#define I_SETSIG (__SID | 9) +#define I_GETSIG (__SID | 10) +#define I_FIND (__SID | 11) +#define I_LINK (__SID | 12) +#define I_UNLINK (__SID | 13) +#define I_PEEK (__SID | 15) +#define I_FDINSERT (__SID | 16) +#define I_SENDFD (__SID | 17) +#define I_RECVFD (__SID | 14) +#define I_SWROPT (__SID | 19) +#define I_GWROPT (__SID | 20) +#define I_LIST (__SID | 21) +#define I_PLINK (__SID | 22) +#define I_PUNLINK (__SID | 23) +#define I_FLUSHBAND (__SID | 28) +#define I_CKBAND (__SID | 29) +#define I_GETBAND (__SID | 30) +#define I_ATMARK (__SID | 31) +#define I_SETCLTIME (__SID | 32) +#define I_GETCLTIME (__SID | 33) +#define I_CANPUT (__SID | 34) + +#define FMNAMESZ 8 + +#define FLUSHR 0x01 +#define FLUSHW 0x02 +#define FLUSHRW 0x03 +#define FLUSHBAND 0x04 + +#define S_INPUT 0x0001 +#define S_HIPRI 0x0002 +#define S_OUTPUT 0x0004 +#define S_MSG 0x0008 +#define S_ERROR 0x0010 +#define S_HANGUP 0x0020 +#define S_RDNORM 0x0040 +#define S_WRNORM S_OUTPUT +#define S_RDBAND 0x0080 +#define S_WRBAND 0x0100 +#define S_BANDURG 0x0200 + +#define RS_HIPRI 0x01 + +#define RNORM 0x0000 +#define RMSGD 0x0001 +#define RMSGN 0x0002 +#define RPROTDAT 0x0004 +#define RPROTDIS 0x0008 +#define RPROTNORM 0x0010 +#define RPROTMASK 0x001C + +#define SNDZERO 0x001 +#define SNDPIPE 0x002 + +#define ANYMARK 0x01 +#define LASTMARK 0x02 + +#define MUXID_ALL (-1) + +#define MSG_HIPRI 0x01 +#define MSG_ANY 0x02 +#define MSG_BAND 0x04 + +#define MORECTL 1 +#define MOREDATA 2 + +struct bandinfo { + unsigned char bi_pri; + int bi_flag; +}; + +struct strbuf { + int maxlen; + int len; + char* buf; +}; + +struct strpeek { + struct strbuf ctlbuf; + struct strbuf databuf; + unsigned flags; +}; + +struct strfdinsert { + struct strbuf ctlbuf; + struct strbuf databuf; + unsigned flags; + int fildes; + int offset; +}; + +struct strioctl { + int ic_cmd; + int ic_timout; + int ic_len; + char* ic_dp; +}; + +struct strrecvfd { + int fd; + int uid; + int gid; + char __fill[8]; +}; + +struct str_mlist { + char l_name[FMNAMESZ + 1]; +}; + +struct str_list { + int sl_nmods; + struct str_mlist* sl_modlist; +}; + +int isastream(int); +int ioctl(int, int, ...); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_STROPTS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/acct.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/acct.h new file mode 100644 index 0000000..8561ad0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/acct.h
@@ -0,0 +1,72 @@ +#ifndef SYSROOT_SYS_ACCT_H_ +#define SYSROOT_SYS_ACCT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <endian.h> +#include <features.h> +#include <stdint.h> +#include <time.h> + +#define ACCT_COMM 16 + +typedef uint16_t comp_t; + +struct acct { + char ac_flag; + uint16_t ac_uid; + uint16_t ac_gid; + uint16_t ac_tty; + uint32_t ac_btime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_etime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + uint32_t ac_exitcode; + char ac_comm[ACCT_COMM + 1]; + char ac_pad[10]; +}; + +struct acct_v3 { + char ac_flag; + char ac_version; + uint16_t ac_tty; + uint32_t ac_exitcode; + uint32_t ac_uid; + uint32_t ac_gid; + uint32_t ac_pid; + uint32_t ac_ppid; + uint32_t ac_btime; + float ac_etime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + char ac_comm[ACCT_COMM]; +}; + +#define AFORK 1 +#define ASU 2 +#define ACORE 8 +#define AXSIG 16 +#define ACCT_BYTEORDER (128 * (__BYTE_ORDER == __BIG_ENDIAN)) +#define AHZ 100 + +int acct(const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_ACCT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/auxv.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/auxv.h new file mode 100644 index 0000000..61ddea0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/auxv.h
@@ -0,0 +1,16 @@ +#ifndef SYSROOT_SYS_AUXV_H_ +#define SYSROOT_SYS_AUXV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <elf.h> + +unsigned long getauxval(unsigned long); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_AUXV_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/dir.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/dir.h new file mode 100644 index 0000000..9ba1c79 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/dir.h
@@ -0,0 +1,2 @@ +#include <dirent.h> +#define direct dirent
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/errno.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/errno.h new file mode 100644 index 0000000..35a3e5a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/errno.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/errno.h> to <errno.h> +#include <errno.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/eventfd.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/eventfd.h new file mode 100644 index 0000000..4259bac --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/eventfd.h
@@ -0,0 +1,25 @@ +#ifndef SYSROOT_SYS_EVENTFD_H_ +#define SYSROOT_SYS_EVENTFD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fcntl.h> +#include <stdint.h> + +typedef uint64_t eventfd_t; + +#define EFD_SEMAPHORE 1 +#define EFD_CLOEXEC O_CLOEXEC +#define EFD_NONBLOCK O_NONBLOCK + +int eventfd(unsigned int, int); +int eventfd_read(int, eventfd_t*); +int eventfd_write(int, eventfd_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_EVENTFD_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/fcntl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/fcntl.h new file mode 100644 index 0000000..3dd928e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/fcntl.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> +#include <fcntl.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/file.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/file.h new file mode 100644 index 0000000..fe17290 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/file.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_SYS_FILE_H_ +#define SYSROOT_SYS_FILE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 + +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 + +int flock(int, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_FILE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/fsuid.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/fsuid.h new file mode 100644 index 0000000..a9f654c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/fsuid.h
@@ -0,0 +1,20 @@ +#ifndef SYSROOT_SYS_FSUID_H_ +#define SYSROOT_SYS_FSUID_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_uid_t +#define __NEED_gid_t + +#include <bits/alltypes.h> + +int setfsuid(uid_t); +int setfsgid(gid_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_FSUID_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/io.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/io.h new file mode 100644 index 0000000..89617e5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/io.h
@@ -0,0 +1,19 @@ +#ifndef SYSROOT_SYS_IO_H_ +#define SYSROOT_SYS_IO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/io.h> + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_IO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ioctl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ioctl.h new file mode 100644 index 0000000..ad22a3b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ioctl.h
@@ -0,0 +1,16 @@ +#ifndef SYSROOT_SYS_IOCTL_H_ +#define SYSROOT_SYS_IOCTL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <bits/ioctl.h> + +int ioctl(int, int, ...); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_IOCTL_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ipc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ipc.h new file mode 100644 index 0000000..5d019f4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ipc.h
@@ -0,0 +1,44 @@ +#ifndef SYSROOT_SYS_IPC_H_ +#define SYSROOT_SYS_IPC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_mode_t +#define __NEED_key_t + +#include <bits/alltypes.h> + +#define __ipc_perm_key __key +#define __ipc_perm_seq __seq + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __key key +#define __seq seq +#endif + +#include <bits/ipc.h> + +#define IPC_CREAT 01000 +#define IPC_EXCL 02000 +#define IPC_NOWAIT 04000 + +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_STAT 2 +#define IPC_INFO 3 + +#define IPC_PRIVATE ((key_t)0) + +key_t ftok(const char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_IPC_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/klog.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/klog.h new file mode 100644 index 0000000..b182302 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/klog.h
@@ -0,0 +1,14 @@ +#ifndef SYSROOT_SYS_KLOG_H_ +#define SYSROOT_SYS_KLOG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int klogctl(int, char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_KLOG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mman.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mman.h new file mode 100644 index 0000000..7a913ae --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mman.h
@@ -0,0 +1,102 @@ +#ifndef SYSROOT_SYS_MMAN_H_ +#define SYSROOT_SYS_MMAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_mode_t +#define __NEED_size_t +#define __NEED_off_t + +#include <bits/alltypes.h> + +#define MAP_FAILED ((void*)-1) + +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 +#define MAP_TYPE 0x0f +#define MAP_FIXED 0x10 +#define MAP_ANON 0x20 +#define MAP_ANONYMOUS MAP_ANON +#define MAP_NORESERVE 0x4000 +#define MAP_GROWSDOWN 0x0100 +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_LOCKED 0x2000 +#define MAP_POPULATE 0x8000 +#define MAP_NONBLOCK 0x10000 +#define MAP_STACK 0x20000 +#define MAP_HUGETLB 0x40000 +#define MAP_JIT 0x80000 +#define MAP_FILE 0 + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 + +#define MS_ASYNC 1 +#define MS_INVALIDATE 2 +#define MS_SYNC 4 + +#define MCL_CURRENT 1 +#define MCL_FUTURE 2 +#define MCL_ONFAULT 4 + +#define POSIX_MADV_NORMAL 0 +#define POSIX_MADV_RANDOM 1 +#define POSIX_MADV_SEQUENTIAL 2 +#define POSIX_MADV_WILLNEED 3 +#define POSIX_MADV_DONTNEED 4 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_SEQUENTIAL 2 +#define MADV_WILLNEED 3 +#define MADV_DONTNEED 4 +#define MADV_FREE 8 +#define MADV_REMOVE 9 +#define MADV_DONTFORK 10 +#define MADV_DOFORK 11 +#define MADV_MERGEABLE 12 +#define MADV_UNMERGEABLE 13 +#define MADV_HUGEPAGE 14 +#define MADV_NOHUGEPAGE 15 +#define MADV_DONTDUMP 16 +#define MADV_DODUMP 17 +#define MADV_HWPOISON 100 +#define MADV_SOFT_OFFLINE 101 +#endif + +void* mmap(void*, size_t, int, int, int, off_t); +int munmap(void*, size_t); + +int mprotect(void*, size_t, int); +int msync(void*, size_t, int); + +int posix_madvise(void*, size_t, int); + +int mlock(const void*, size_t); +int munlock(const void*, size_t); +int mlockall(int); +int munlockall(void); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MLOCK_ONFAULT 0x01 +int madvise(void*, size_t, int); +#endif + +int shm_open(const char*, int, mode_t); +int shm_unlink(const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_MMAN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mount.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mount.h new file mode 100644 index 0000000..53181ea --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mount.h
@@ -0,0 +1,73 @@ +#ifndef SYSROOT_SYS_MOUNT_H_ +#define SYSROOT_SYS_MOUNT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/ioctl.h> + +#define BLKROSET _IO(0x12, 93) +#define BLKROGET _IO(0x12, 94) +#define BLKRRPART _IO(0x12, 95) +#define BLKGETSIZE _IO(0x12, 96) +#define BLKFLSBUF _IO(0x12, 97) +#define BLKRASET _IO(0x12, 98) +#define BLKRAGET _IO(0x12, 99) +#define BLKFRASET _IO(0x12, 100) +#define BLKFRAGET _IO(0x12, 101) +#define BLKSECTSET _IO(0x12, 102) +#define BLKSECTGET _IO(0x12, 103) +#define BLKSSZGET _IO(0x12, 104) +#define BLKBSZGET _IOR(0x12, 112, size_t) +#define BLKBSZSET _IOW(0x12, 113, size_t) +#define BLKGETSIZE64 _IOR(0x12, 114, size_t) + +#define MS_RDONLY 1 +#define MS_NOSUID 2 +#define MS_NODEV 4 +#define MS_NOEXEC 8 +#define MS_SYNCHRONOUS 16 +#define MS_REMOUNT 32 +#define MS_MANDLOCK 64 +#define MS_DIRSYNC 128 +#define MS_NOATIME 1024 +#define MS_NODIRATIME 2048 +#define MS_BIND 4096 +#define MS_MOVE 8192 +#define MS_REC 16384 +#define MS_SILENT 32768 +#define MS_POSIXACL (1 << 16) +#define MS_UNBINDABLE (1 << 17) +#define MS_PRIVATE (1 << 18) +#define MS_SLAVE (1 << 19) +#define MS_SHARED (1 << 20) +#define MS_RELATIME (1 << 21) +#define MS_KERNMOUNT (1 << 22) +#define MS_I_VERSION (1 << 23) +#define MS_STRICTATIME (1 << 24) +#define MS_LAZYTIME (1 << 25) +#define MS_NOSEC (1 << 28) +#define MS_BORN (1 << 29) +#define MS_ACTIVE (1 << 30) +#define MS_NOUSER (1U << 31) + +#define MS_RMT_MASK (MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME) + +#define MS_MGC_VAL 0xc0ed0000 +#define MS_MGC_MSK 0xffff0000 + +#define MNT_FORCE 1 +#define MNT_DETACH 2 +#define MNT_EXPIRE 4 +#define UMOUNT_NOFOLLOW 8 + +int mount(const char*, const char*, const char*, unsigned long, const void*); +int umount(const char*); +int umount2(const char*, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_MOUNT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/msg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/msg.h new file mode 100644 index 0000000..be0114b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/msg.h
@@ -0,0 +1,52 @@ +#ifndef SYSROOT_SYS_MSG_H_ +#define SYSROOT_SYS_MSG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/ipc.h> + +#define __NEED_pid_t +#define __NEED_key_t +#define __NEED_time_t +#define __NEED_size_t +#define __NEED_ssize_t + +#include <bits/alltypes.h> + +typedef unsigned long msgqnum_t; +typedef unsigned long msglen_t; + +#include <bits/msg.h> + +#define __msg_cbytes msg_cbytes + +#define MSG_NOERROR 010000 +#define MSG_EXCEPT 020000 + +#define MSG_STAT 11 +#define MSG_INFO 12 + +struct msginfo { + int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql; + unsigned short msgseg; +}; + +int msgctl(int, int, struct msqid_ds*); +int msgget(key_t, int); +ssize_t msgrcv(int, void*, size_t, long, int); +int msgsnd(int, const void*, size_t, int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct msgbuf { + long mtype; + char mtext[1]; +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_MSG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mtio.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mtio.h new file mode 100644 index 0000000..3d9f753 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/mtio.h
@@ -0,0 +1,183 @@ +#ifndef SYSROOT_SYS_MTIO_H_ +#define SYSROOT_SYS_MTIO_H_ + +#include <sys/ioctl.h> +#include <sys/types.h> + +struct mtop { + short mt_op; + int mt_count; +}; + +#define _IOT_mtop _IOT(_IOTS(short), 1, _IOTS(int), 1, 0, 0) +#define _IOT_mtget _IOT(_IOTS(long), 7, 0, 0, 0, 0) +#define _IOT_mtpos _IOT_SIMPLE(long) +#define _IOT_mtconfiginfo _IOT(_IOTS(long), 2, _IOTS(short), 3, _IOTS(long), 1) + +#define MTRESET 0 +#define MTFSF 1 +#define MTBSF 2 +#define MTFSR 3 +#define MTBSR 4 +#define MTWEOF 5 +#define MTREW 6 +#define MTOFFL 7 +#define MTNOP 8 +#define MTRETEN 9 +#define MTBSFM 10 +#define MTFSFM 11 +#define MTEOM 12 +#define MTERASE 13 +#define MTRAS1 14 +#define MTRAS2 15 +#define MTRAS3 16 +#define MTSETBLK 20 +#define MTSETDENSITY 21 +#define MTSEEK 22 +#define MTTELL 23 +#define MTSETDRVBUFFER 24 +#define MTFSS 25 +#define MTBSS 26 +#define MTWSM 27 +#define MTLOCK 28 +#define MTUNLOCK 29 +#define MTLOAD 30 +#define MTUNLOAD 31 +#define MTCOMPRESSION 32 +#define MTSETPART 33 +#define MTMKPART 34 + +struct mtget { + long mt_type; + long mt_resid; + long mt_dsreg; + long mt_gstat; + long mt_erreg; + int mt_fileno; + int mt_blkno; +}; + +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 +#define MT_ISWT5150 0x03 +#define MT_ISARCHIVE_5945L2 0x04 +#define MT_ISCMSJ500 0x05 +#define MT_ISTDC3610 0x06 +#define MT_ISARCHIVE_VP60I 0x07 +#define MT_ISARCHIVE_2150L 0x08 +#define MT_ISARCHIVE_2060L 0x09 +#define MT_ISARCHIVESC499 0x0A +#define MT_ISQIC02_ALL_FEATURES 0x0F +#define MT_ISWT5099EEN24 0x11 +#define MT_ISTEAC_MT2ST 0x12 +#define MT_ISEVEREX_FT40A 0x32 +#define MT_ISDDS1 0x51 +#define MT_ISDDS2 0x52 +#define MT_ISSCSI1 0x71 +#define MT_ISSCSI2 0x72 +#define MT_ISFTAPE_UNKNOWN 0x800000 +#define MT_ISFTAPE_FLAG 0x800000 + +struct mt_tape_info { + long t_type; + char* t_name; +}; + +#define MT_TAPE_INFO \ + { \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, { \ + 0, 0 \ + } \ + } + +struct mtpos { + long mt_blkno; +}; + +struct mtconfiginfo { + long mt_type; + long ifc_type; + unsigned short irqnr; + unsigned short dmanr; + unsigned short port; + unsigned long debug; + unsigned have_dens : 1; + unsigned have_bsf : 1; + unsigned have_fsr : 1; + unsigned have_bsr : 1; + unsigned have_eod : 1; + unsigned have_seek : 1; + unsigned have_tell : 1; + unsigned have_ras1 : 1; + unsigned have_ras2 : 1; + unsigned have_ras3 : 1; + unsigned have_qfa : 1; + unsigned pad1 : 5; + char reserved[10]; +}; + +#define MTIOCTOP _IOW('m', 1, struct mtop) +#define MTIOCGET _IOR('m', 2, struct mtget) +#define MTIOCPOS _IOR('m', 3, struct mtpos) + +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) +#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) + +#define GMT_EOF(x) ((x)&0x80000000) +#define GMT_BOT(x) ((x)&0x40000000) +#define GMT_EOT(x) ((x)&0x20000000) +#define GMT_SM(x) ((x)&0x10000000) +#define GMT_EOD(x) ((x)&0x08000000) +#define GMT_WR_PROT(x) ((x)&0x04000000) +#define GMT_ONLINE(x) ((x)&0x01000000) +#define GMT_D_6250(x) ((x)&0x00800000) +#define GMT_D_1600(x) ((x)&0x00400000) +#define GMT_D_800(x) ((x)&0x00200000) +#define GMT_DR_OPEN(x) ((x)&0x00040000) +#define GMT_IM_REP_EN(x) ((x)&0x00010000) + +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) +#define MT_ST_HPLOADER_OFFSET 10000 +#ifndef DEFTAPE +#define DEFTAPE "/dev/tape" +#endif + +#endif // SYSROOT_SYS_MTIO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/param.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/param.h new file mode 100644 index 0000000..301bba7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/param.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_SYS_PARAM_H_ +#define SYSROOT_SYS_PARAM_H_ + +#define MAXSYMLINKS 20 +#define MAXHOSTNAMELEN 64 +#define MAXNAMLEN 255 +#define MAXPATHLEN 4096 +#define NBBY 8 +#define NGROUPS 32 +#define CANBSIZE 255 +#define NOFILE 256 +#define NCARGS 131072 +#define DEV_BSIZE 512 +#define NOGROUP (-1) + +#undef MIN +#undef MAX +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#define __bitop(x, i, o) ((x)[(i) / 8] o(1 << (i) % 8)) +#define setbit(x, i) __bitop(x, i, |=) +#define clrbit(x, i) __bitop(x, i, &= ~) +#define isset(x, i) __bitop(x, i, &) +#define isclr(x, i) !isset(x, i) + +#define howmany(n, d) (((n) + ((d)-1)) / (d)) +#define roundup(n, d) (howmany(n, d) * (d)) +#define powerof2(n) !(((n)-1) & (n)) + +#include <endian.h> +#include <limits.h> + +#endif // SYSROOT_SYS_PARAM_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/personality.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/personality.h new file mode 100644 index 0000000..b32d1eb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/personality.h
@@ -0,0 +1,47 @@ +#ifndef SYSROOT_SYS_PERSONALITY_H_ +#define SYSROOT_SYS_PERSONALITY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ADDR_NO_RANDOMIZE 0x0040000 +#define MMAP_PAGE_ZERO 0x0100000 +#define ADDR_COMPAT_LAYOUT 0x0200000 +#define READ_IMPLIES_EXEC 0x0400000 +#define ADDR_LIMIT_32BIT 0x0800000 +#define SHORT_INODE 0x1000000 +#define WHOLE_SECONDS 0x2000000 +#define STICKY_TIMEOUTS 0x4000000 +#define ADDR_LIMIT_3GB 0x8000000 + +#define PER_LINUX 0 +#define PER_LINUX_32BIT ADDR_LIMIT_32BIT +#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE) +#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS) +#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_ISCR4 (5 | STICKY_TIMEOUTS) +#define PER_BSD 6 +#define PER_SUNOS (6 | STICKY_TIMEOUTS) +#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_LINUX32 8 +#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB) +#define PER_IRIX32 (9 | STICKY_TIMEOUTS) +#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS) +#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS) +#define PER_RISCOS 0xc +#define PER_SOLARIS (0xd | STICKY_TIMEOUTS) +#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#define PER_OSF4 0xf +#define PER_HPUX 0x10 +#define PER_MASK 0xff + +int personality(unsigned long); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_PERSONALITY_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/poll.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/poll.h new file mode 100644 index 0000000..9917040 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/poll.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/poll.h> to <poll.h> +#include <poll.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/quota.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/quota.h new file mode 100644 index 0000000..aec5dc9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/quota.h
@@ -0,0 +1,102 @@ +#ifndef SYSROOT_SYS_QUOTA_H_ +#define SYSROOT_SYS_QUOTA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define _LINUX_QUOTA_VERSION 2 + +#define dbtob(num) ((num) << 10) +#define btodb(num) ((num) >> 10) +#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024) + +#define MAX_IQ_TIME 604800 +#define MAX_DQ_TIME 604800 + +#define MAXQUOTAS 2 +#define USRQUOTA 0 +#define GRPQUOTA 1 + +#define INITQFNAMES {"user", "group", "undefined"}; + +#define QUOTAFILENAME "quota" +#define QUOTAGROUP "staff" + +#define NR_DQHASH 43 +#define NR_DQUOTS 256 + +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type)&SUBCMDMASK)) + +#define Q_SYNC 0x800001 +#define Q_QUOTAON 0x800002 +#define Q_QUOTAOFF 0x800003 +#define Q_GETFMT 0x800004 +#define Q_GETINFO 0x800005 +#define Q_SETINFO 0x800006 +#define Q_GETQUOTA 0x800007 +#define Q_SETQUOTA 0x800008 + +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 +#define QFMT_OCFS2 3 +#define QFMT_VFS_V1 4 + +#define QIF_BLIMITS 1 +#define QIF_SPACE 2 +#define QIF_ILIMITS 4 +#define QIF_INODES 8 +#define QIF_BTIME 16 +#define QIF_ITIME 32 +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct dqblk { + uint64_t dqb_bhardlimit; + uint64_t dqb_bsoftlimit; + uint64_t dqb_curspace; + uint64_t dqb_ihardlimit; + uint64_t dqb_isoftlimit; + uint64_t dqb_curinodes; + uint64_t dqb_btime; + uint64_t dqb_itime; + uint32_t dqb_valid; +}; + +#define dq_bhardlimit dq_dqb.dqb_bhardlimit +#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit +#define dq_curspace dq_dqb.dqb_curspace +#define dq_valid dq_dqb.dqb_valid +#define dq_ihardlimit dq_dqb.dqb_ihardlimit +#define dq_isoftlimit dq_dqb.dqb_isoftlimit +#define dq_curinodes dq_dqb.dqb_curinodes +#define dq_btime dq_dqb.dqb_btime +#define dq_itime dq_dqb.dqb_itime + +#define dqoff(UID) ((long long)(UID) * sizeof(struct dqblk)) + +#define IIF_BGRACE 1 +#define IIF_IGRACE 2 +#define IIF_FLAGS 4 +#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct dqinfo { + uint64_t dqi_bgrace; + uint64_t dqi_igrace; + uint32_t dqi_flags; + uint32_t dqi_valid; +}; + +int quotactl(int, const char*, int, char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_QUOTA_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/random.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/random.h new file mode 100644 index 0000000..258201d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/random.h
@@ -0,0 +1,16 @@ +#ifndef SYSROOT_SYS_RANDOM_H_ +#define SYSROOT_SYS_RANDOM_H_ + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +int getentropy(void* buffer, size_t length) __attribute__((__warn_unused_result__)); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_RANDOM_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/reboot.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/reboot.h new file mode 100644 index 0000000..a83629c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/reboot.h
@@ -0,0 +1,22 @@ +#ifndef SYSROOT_SYS_REBOOT_H_ +#define SYSROOT_SYS_REBOOT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define RB_AUTOBOOT 0x01234567 +#define RB_HALT_SYSTEM 0xcdef0123 +#define RB_ENABLE_CAD 0x89abcdef +#define RB_DISABLE_CAD 0 +#define RB_POWER_OFF 0x4321fedc +#define RB_SW_SUSPEND 0xd000fce2 +#define RB_KEXEC 0x45584543 + +int reboot(int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_REBOOT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/reg.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/reg.h new file mode 100644 index 0000000..0f37ffe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/reg.h
@@ -0,0 +1,9 @@ +#ifndef SYSROOT_SYS_REG_H_ +#define SYSROOT_SYS_REG_H_ + +#include <limits.h> +#include <unistd.h> + +#include <bits/reg.h> + +#endif // SYSROOT_SYS_REG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/select.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/select.h new file mode 100644 index 0000000..5d4fd7d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/select.h
@@ -0,0 +1,54 @@ +#ifndef SYSROOT_SYS_SELECT_H_ +#define SYSROOT_SYS_SELECT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_time_t +#define __NEED_suseconds_t +#define __NEED_struct_timeval +#define __NEED_struct_timespec +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +#define FD_SETSIZE 1024 + +typedef unsigned long fd_mask; + +typedef struct { + unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)]; +} fd_set; + +#define FD_ZERO(s) \ + do { \ + int __i; \ + unsigned long* __b = (s)->fds_bits; \ + for (__i = sizeof(fd_set) / sizeof(long); __i; __i--) \ + *__b++ = 0; \ + } while (0) +#define FD_SET(d, s) \ + ((s)->fds_bits[(d) / (8 * sizeof(long))] |= (1UL << ((d) % (8 * sizeof(long))))) +#define FD_CLR(d, s) \ + ((s)->fds_bits[(d) / (8 * sizeof(long))] &= ~(1UL << ((d) % (8 * sizeof(long))))) +#define FD_ISSET(d, s) \ + !!((s)->fds_bits[(d) / (8 * sizeof(long))] & (1UL << ((d) % (8 * sizeof(long))))) + +int select(int, fd_set* __restrict, fd_set* __restrict, fd_set* __restrict, + struct timeval* __restrict); +int pselect(int, fd_set* __restrict, fd_set* __restrict, fd_set* __restrict, + const struct timespec* __restrict, const sigset_t* __restrict); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NFDBITS (8 * (int)sizeof(long)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SELECT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/sem.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/sem.h new file mode 100644 index 0000000..a4330af --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/sem.h
@@ -0,0 +1,69 @@ +#ifndef SYSROOT_SYS_SEM_H_ +#define SYSROOT_SYS_SEM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_pid_t +#define __NEED_time_t +#ifdef _GNU_SOURCE +#define __NEED_struct_timespec +#endif +#include <sys/ipc.h> + +#include <bits/alltypes.h> + +#define SEM_UNDO 0x1000 +#define GETPID 11 +#define GETVAL 12 +#define GETALL 13 +#define GETNCNT 14 +#define GETZCNT 15 +#define SETVAL 16 +#define SETALL 17 + +#include <endian.h> + +#include <bits/sem.h> + +#define _SEM_SEMUN_UNDEFINED 1 + +#define SEM_STAT 18 +#define SEM_INFO 19 + +struct seminfo { + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvzx; + int semaem; +}; + +struct sembuf { + unsigned short sem_num; + short sem_op; + short sem_flg; +}; + +int semctl(int, int, int, ...); +int semget(key_t, int, int); +int semop(int, struct sembuf*, size_t); + +#ifdef _GNU_SOURCE +int semtimedop(int, struct sembuf*, size_t, const struct timespec*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SEM_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/shm.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/shm.h new file mode 100644 index 0000000..55b4389 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/shm.h
@@ -0,0 +1,54 @@ +#ifndef SYSROOT_SYS_SHM_H_ +#define SYSROOT_SYS_SHM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_time_t +#define __NEED_size_t +#define __NEED_pid_t + +#include <sys/ipc.h> + +#include <bits/alltypes.h> + +#ifdef _GNU_SOURCE +#define __used_ids used_ids +#define __swap_attempts swap_attempts +#define __swap_successes swap_successes +#endif + +#include <bits/shm.h> + +#define SHM_R 0400 +#define SHM_W 0200 + +#define SHM_RDONLY 010000 +#define SHM_RND 020000 +#define SHM_REMAP 040000 +#define SHM_EXEC 0100000 + +#define SHM_LOCK 11 +#define SHM_UNLOCK 12 +#define SHM_STAT 13 +#define SHM_INFO 14 +#define SHM_DEST 01000 +#define SHM_LOCKED 02000 +#define SHM_HUGETLB 04000 +#define SHM_NORESERVE 010000 + +typedef unsigned long shmatt_t; + +void* shmat(int, const void*, int); +int shmctl(int, int, struct shmid_ds*); +int shmdt(const void*); +int shmget(key_t, size_t, int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SHM_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/signal.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/signal.h new file mode 100644 index 0000000..45bdcc6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/signal.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/signal.h> to <signal.h> +#include <signal.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/signalfd.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/signalfd.h new file mode 100644 index 0000000..46a5489 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/signalfd.h
@@ -0,0 +1,45 @@ +#ifndef SYSROOT_SYS_SIGNALFD_H_ +#define SYSROOT_SYS_SIGNALFD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fcntl.h> +#include <stdint.h> + +#define __NEED_sigset_t + +#include <bits/alltypes.h> + +#define SFD_CLOEXEC O_CLOEXEC +#define SFD_NONBLOCK O_NONBLOCK + +int signalfd(int, const sigset_t*, int); + +struct signalfd_siginfo { + uint32_t ssi_signo; + int32_t ssi_errno; + int32_t ssi_code; + uint32_t ssi_pid; + uint32_t ssi_uid; + int32_t ssi_fd; + uint32_t ssi_tid; + uint32_t ssi_band; + uint32_t ssi_overrun; + uint32_t ssi_trapno; + int32_t ssi_status; + int32_t ssi_int; + uint64_t ssi_ptr; + uint64_t ssi_utime; + uint64_t ssi_stime; + uint64_t ssi_addr; + uint16_t ssi_addr_lsb; + uint8_t pad[128 - 12 * 4 - 4 * 8 - 2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SIGNALFD_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/socket.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/socket.h new file mode 100644 index 0000000..7f68e6e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/socket.h
@@ -0,0 +1,322 @@ +#ifndef SYSROOT_SYS_SOCKET_H_ +#define SYSROOT_SYS_SOCKET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_socklen_t +#define __NEED_sa_family_t +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_uid_t +#define __NEED_pid_t +#define __NEED_gid_t +#define __NEED_struct_iovec + +#include <bits/alltypes.h> +#include <bits/socket.h> + +#ifdef _GNU_SOURCE +struct ucred { + pid_t pid; + uid_t uid; + gid_t gid; +}; + +struct mmsghdr { + struct msghdr msg_hdr; + unsigned int msg_len; +}; + +struct timespec; + +int sendmmsg(int, struct mmsghdr*, unsigned int, unsigned int); +int recvmmsg(int, struct mmsghdr*, unsigned int, unsigned int, struct timespec*); +#endif + +struct linger { + int l_onoff; + int l_linger; +}; + +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 + +#ifndef SOCK_STREAM +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#endif + +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SOCK_DCCP 6 +#define SOCK_PACKET 10 + +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 02000000 +#define SOCK_NONBLOCK 04000 +#endif + +#define PF_UNSPEC 0 +#define PF_LOCAL 1 +#define PF_UNIX PF_LOCAL +#define PF_FILE PF_LOCAL +#define PF_INET 2 +#define PF_AX25 3 +#define PF_IPX 4 +#define PF_APPLETALK 5 +#define PF_NETROM 6 +#define PF_BRIDGE 7 +#define PF_ATMPVC 8 +#define PF_X25 9 +#define PF_INET6 10 +#define PF_ROSE 11 +#define PF_DECnet 12 +#define PF_NETBEUI 13 +#define PF_SECURITY 14 +#define PF_KEY 15 +#define PF_NETLINK 16 +#define PF_ROUTE PF_NETLINK +#define PF_PACKET 17 +#define PF_ASH 18 +#define PF_ECONET 19 +#define PF_ATMSVC 20 +#define PF_RDS 21 +#define PF_SNA 22 +#define PF_IRDA 23 +#define PF_PPPOX 24 +#define PF_WANPIPE 25 +#define PF_LLC 26 +#define PF_IB 27 +#define PF_MPLS 28 +#define PF_TIPC 30 +#define PF_BLUETOOTH 31 +#define PF_IUCV 32 +#define PF_RXRPC 33 +#define PF_ISDN 34 +#define PF_PHONET 35 +#define PF_IEEE802154 36 +#define PF_CAIF 37 +#define PF_ALG 38 +#define PF_NFC 39 +#define PF_VSOCK 40 +#define PF_MAX 41 + +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX AF_LOCAL +#define AF_FILE AF_LOCAL +#define AF_INET PF_INET +#define AF_AX25 PF_AX25 +#define AF_IPX PF_IPX +#define AF_APPLETALK PF_APPLETALK +#define AF_NETROM PF_NETROM +#define AF_BRIDGE PF_BRIDGE +#define AF_ATMPVC PF_ATMPVC +#define AF_X25 PF_X25 +#define AF_INET6 PF_INET6 +#define AF_ROSE PF_ROSE +#define AF_DECnet PF_DECnet +#define AF_NETBEUI PF_NETBEUI +#define AF_SECURITY PF_SECURITY +#define AF_KEY PF_KEY +#define AF_NETLINK PF_NETLINK +#define AF_ROUTE PF_ROUTE +#define AF_PACKET PF_PACKET +#define AF_ASH PF_ASH +#define AF_ECONET PF_ECONET +#define AF_ATMSVC PF_ATMSVC +#define AF_RDS PF_RDS +#define AF_SNA PF_SNA +#define AF_IRDA PF_IRDA +#define AF_PPPOX PF_PPPOX +#define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_IB PF_IB +#define AF_MPLS PF_MPLS +#define AF_TIPC PF_TIPC +#define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG +#define AF_NFC PF_NFC +#define AF_VSOCK PF_VSOCK +#define AF_MAX PF_MAX + +#ifndef SO_DEBUG +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +#define SO_BSDCOMPAT 14 +#define SO_REUSEPORT 15 +#define SO_PASSCRED 16 +#define SO_PEERCRED 17 +#define SO_RCVLOWAT 18 +#define SO_SNDLOWAT 19 +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 +#define SO_ACCEPTCONN 30 +#define SO_SNDBUFFORCE 32 +#define SO_RCVBUFFORCE 33 +#define SO_PROTOCOL 38 +#define SO_DOMAIN 39 +#endif + +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + +#define SO_BINDTODEVICE 25 + +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 +#define SO_GET_FILTER SO_ATTACH_FILTER + +#define SO_PEERNAME 28 +#define SO_TIMESTAMP 29 +#define SCM_TIMESTAMP SO_TIMESTAMP + +#define SO_PEERSEC 31 +#define SO_PASSSEC 34 +#define SO_TIMESTAMPNS 35 +#define SCM_TIMESTAMPNS SO_TIMESTAMPNS +#define SO_MARK 36 +#define SO_TIMESTAMPING 37 +#define SCM_TIMESTAMPING SO_TIMESTAMPING +#define SO_RXQ_OVFL 40 +#define SO_WIFI_STATUS 41 +#define SCM_WIFI_STATUS SO_WIFI_STATUS +#define SO_PEEK_OFF 42 +#define SO_NOFCS 43 +#define SO_LOCK_FILTER 44 +#define SO_SELECT_ERR_QUEUE 45 +#define SO_BUSY_POLL 46 +#define SO_MAX_PACING_RATE 47 +#define SO_BPF_EXTENSIONS 48 +#define SO_INCOMING_CPU 49 +#define SO_ATTACH_BPF 50 +#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_ATTACH_REUSEPORT_CBPF 51 +#define SO_ATTACH_REUSEPORT_EBPF 52 + +#ifndef SOL_SOCKET +#define SOL_SOCKET 1 +#endif + +#define SOL_IP 0 +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 + +#define SOL_RAW 255 +#define SOL_DECNET 261 +#define SOL_X25 262 +#define SOL_PACKET 263 +#define SOL_ATM 264 +#define SOL_AAL 265 +#define SOL_IRDA 266 + +#define SOMAXCONN 128 + +#define MSG_OOB 0x0001 +#define MSG_PEEK 0x0002 +#define MSG_DONTROUTE 0x0004 +#define MSG_CTRUNC 0x0008 +#define MSG_PROXY 0x0010 +#define MSG_TRUNC 0x0020 +#define MSG_DONTWAIT 0x0040 +#define MSG_EOR 0x0080 +#define MSG_WAITALL 0x0100 +#define MSG_FIN 0x0200 +#define MSG_SYN 0x0400 +#define MSG_CONFIRM 0x0800 +#define MSG_RST 0x1000 +#define MSG_ERRQUEUE 0x2000 +#define MSG_MORE 0x8000 +#define MSG_WAITFORONE 0x10000 +#define MSG_FASTOPEN 0x20000000 +#define MSG_CMSG_CLOEXEC 0x40000000 + +#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1)) +#define __CMSG_NEXT(cmsg) ((unsigned char*)(cmsg) + __CMSG_LEN(cmsg)) +#define __MHDR_END(mhdr) ((unsigned char*)(mhdr)->msg_control + (mhdr)->msg_controllen) + +#define CMSG_DATA(cmsg) ((unsigned char*)(((struct cmsghdr*)(cmsg)) + 1)) +#define CMSG_NXTHDR(mhdr, cmsg) \ + ((cmsg)->cmsg_len < sizeof(struct cmsghdr) \ + ? (struct cmsghdr*)0 \ + : (__CMSG_NEXT(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) \ + ? (struct cmsghdr*)0 \ + : ((struct cmsghdr*)__CMSG_NEXT(cmsg)))) +#define CMSG_FIRSTHDR(mhdr) \ + ((size_t)(mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? (struct cmsghdr*)(mhdr)->msg_control \ + : (struct cmsghdr*)0) + +#define CMSG_ALIGN(len) (((len) + sizeof(size_t) - 1) & (size_t) ~(sizeof(size_t) - 1)) +#define CMSG_SPACE(len) (CMSG_ALIGN(len) + CMSG_ALIGN(sizeof(struct cmsghdr))) +#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) + +#define SCM_RIGHTS 0x01 +#define SCM_CREDENTIALS 0x02 + +struct sockaddr { + sa_family_t sa_family; + char sa_data[14]; +}; + +struct sockaddr_storage { + sa_family_t ss_family; + unsigned long __ss_align; + char __ss_padding[128 - 2 * sizeof(unsigned long)]; +}; + +int socket(int, int, int); +int socketpair(int, int, int, int[2]); + +int shutdown(int, int); + +int bind(int, const struct sockaddr*, socklen_t); +int connect(int, const struct sockaddr*, socklen_t); +int listen(int, int); +int accept(int, struct sockaddr* __restrict, socklen_t* __restrict); +int accept4(int, struct sockaddr* __restrict, socklen_t* __restrict, int); + +int getsockname(int, struct sockaddr* __restrict, socklen_t* __restrict); +int getpeername(int, struct sockaddr* __restrict, socklen_t* __restrict); + +ssize_t send(int, const void*, size_t, int); +ssize_t recv(int, void*, size_t, int); +ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t); +ssize_t recvfrom(int, void* __restrict, size_t, int, struct sockaddr* __restrict, + socklen_t* __restrict); +ssize_t sendmsg(int, const struct msghdr*, int); +ssize_t recvmsg(int, struct msghdr*, int); + +int getsockopt(int, int, int, void* __restrict, socklen_t* __restrict); +int setsockopt(int, int, int, const void*, socklen_t); + +int sockatmark(int); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SOCKET_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/stat.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/stat.h new file mode 100644 index 0000000..d58e26c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/stat.h
@@ -0,0 +1,102 @@ +#ifndef SYSROOT_SYS_STAT_H_ +#define SYSROOT_SYS_STAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_dev_t +#define __NEED_ino_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_time_t +#define __NEED_blksize_t +#define __NEED_blkcnt_t +#define __NEED_struct_timespec + +#include <bits/alltypes.h> +#include <bits/stat.h> + +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec + +#define S_IFMT 0170000 + +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFBLK 0060000 +#define S_IFREG 0100000 +#define S_IFIFO 0010000 +#define S_IFLNK 0120000 +#define S_IFSOCK 0140000 + +#define S_TYPEISMQ(buf) 0 +#define S_TYPEISSEM(buf) 0 +#define S_TYPEISSHM(buf) 0 +#define S_TYPEISTMO(buf) 0 + +#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#define S_ISCHR(mode) (((mode)&S_IFMT) == S_IFCHR) +#define S_ISBLK(mode) (((mode)&S_IFMT) == S_IFBLK) +#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG) +#define S_ISFIFO(mode) (((mode)&S_IFMT) == S_IFIFO) +#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK) +#define S_ISSOCK(mode) (((mode)&S_IFMT) == S_IFSOCK) + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#define UTIME_NOW 0x3fffffff +#define UTIME_OMIT 0x3ffffffe + +int stat(const char* __restrict, struct stat* __restrict); +int fstat(int, struct stat*); +int lstat(const char* __restrict, struct stat* __restrict); +int fstatat(int, const char* __restrict, struct stat* __restrict, int); +int chmod(const char*, mode_t); +int fchmod(int, mode_t); +int fchmodat(int, const char*, mode_t, int); +mode_t umask(mode_t); +int mkdir(const char*, mode_t); +int mknod(const char*, mode_t, dev_t); +int mkfifo(const char*, mode_t); +int mkdirat(int, const char*, mode_t); +int mknodat(int, const char*, mode_t, dev_t); +int mkfifoat(int, const char*, mode_t); + +int futimens(int, const struct timespec[2]); +int utimensat(int, const char*, const struct timespec[2], int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int lchmod(const char*, mode_t); +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_STAT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/statfs.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/statfs.h new file mode 100644 index 0000000..1459181 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/statfs.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_SYS_STATFS_H_ +#define SYSROOT_SYS_STATFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <sys/statvfs.h> + +typedef struct __fsid_t { + int __val[2]; +} fsid_t; + +#include <bits/statfs.h> + +int statfs(const char*, struct statfs*); +int fstatfs(int, struct statfs*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_STATFS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/statvfs.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/statvfs.h new file mode 100644 index 0000000..0423246 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/statvfs.h
@@ -0,0 +1,50 @@ +#ifndef SYSROOT_SYS_STATVFS_H_ +#define SYSROOT_SYS_STATVFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t +#include <endian.h> + +#include <bits/alltypes.h> + +struct statvfs { + unsigned long f_bsize, f_frsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree, f_favail; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned long f_fsid; + unsigned : 8 * (2 * sizeof(int) - sizeof(long)); +#else + unsigned : 8 * (2 * sizeof(int) - sizeof(long)); + unsigned long f_fsid; +#endif + unsigned long f_flag, f_namemax; + int __reserved[6]; +}; + +int statvfs(const char* __restrict, struct statvfs* __restrict); +int fstatvfs(int, struct statvfs*); + +#define ST_RDONLY 1 +#define ST_NOSUID 2 +#define ST_NODEV 4 +#define ST_NOEXEC 8 +#define ST_SYNCHRONOUS 16 +#define ST_MANDLOCK 64 +#define ST_WRITE 128 +#define ST_APPEND 256 +#define ST_IMMUTABLE 512 +#define ST_NOATIME 1024 +#define ST_NODIRATIME 2048 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_STATVFS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/stropts.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/stropts.h new file mode 100644 index 0000000..5b5bc02 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/stropts.h
@@ -0,0 +1 @@ +#include <stropts.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/swap.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/swap.h new file mode 100644 index 0000000..6420606 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/swap.h
@@ -0,0 +1,20 @@ +#ifndef SYSROOT_SYS_SWAP_H_ +#define SYSROOT_SYS_SWAP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SWAP_FLAG_PREFER 0x8000 +#define SWAP_FLAG_PRIO_MASK 0x7fff +#define SWAP_FLAG_PRIO_SHIFT 0 +#define SWAP_FLAG_DISCARD 0x10000 + +int swapon(const char*, int); +int swapoff(const char*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_SWAP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/syslog.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/syslog.h new file mode 100644 index 0000000..7761ece --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/syslog.h
@@ -0,0 +1 @@ +#include <syslog.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/termios.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/termios.h new file mode 100644 index 0000000..f5f751f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/termios.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <sys/termios.h> to <termios.h> +#include <termios.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/time.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/time.h new file mode 100644 index 0000000..a9476c7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/time.h
@@ -0,0 +1,65 @@ +#ifndef SYSROOT_SYS_TIME_H_ +#define SYSROOT_SYS_TIME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <sys/select.h> + +int gettimeofday(struct timeval* __restrict, void* __restrict); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; + struct timeval it_value; +}; + +int getitimer(int, struct itimerval*); +int setitimer(int, const struct itimerval* __restrict, struct itimerval* __restrict); +int utimes(const char*, const struct timeval[2]); + +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; +int futimes(int, const struct timeval[2]); +int futimesat(int, const char*, const struct timeval[2]); +int lutimes(const char*, const struct timeval[2]); +int settimeofday(const struct timeval*, const struct timezone*); +int adjtime(const struct timeval*, struct timeval*); +#define timerisset(t) ((t)->tv_sec || (t)->tv_usec) +#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0) +#define timercmp(s, t, op) \ + ((s)->tv_sec == (t)->tv_sec ? (s)->tv_usec op(t)->tv_usec : (s)->tv_sec op(t)->tv_sec) +#define timeradd(s, t, a) \ + (void)((a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \ + ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \ + ((a)->tv_usec -= 1000000, (a)->tv_sec++)) +#define timersub(s, t, a) \ + (void)((a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \ + ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \ + ((a)->tv_usec += 1000000, (a)->tv_sec--)) +#endif + +#if defined(_GNU_SOURCE) +#define TIMEVAL_TO_TIMESPEC(tv, ts) \ + ((ts)->tv_sec = (tv)->tv_sec, (ts)->tv_nsec = (tv)->tv_usec * 1000, (void)0) +#define TIMESPEC_TO_TIMEVAL(tv, ts) \ + ((tv)->tv_sec = (ts)->tv_sec, (tv)->tv_usec = (ts)->tv_nsec / 1000, (void)0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIME_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timeb.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timeb.h new file mode 100644 index 0000000..bbb7e34 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timeb.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_SYS_TIMEB_H_ +#define SYSROOT_SYS_TIMEB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_time_t + +#include <bits/alltypes.h> + +struct timeb { + time_t time; + unsigned short millitm; + short timezone, dstflag; +}; + +int ftime(struct timeb*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMEB_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timerfd.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timerfd.h new file mode 100644 index 0000000..499a938 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timerfd.h
@@ -0,0 +1,26 @@ +#ifndef SYSROOT_SYS_TIMERFD_H_ +#define SYSROOT_SYS_TIMERFD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fcntl.h> +#include <time.h> + +#define TFD_NONBLOCK O_NONBLOCK +#define TFD_CLOEXEC O_CLOEXEC + +#define TFD_TIMER_ABSTIME 1 + +struct itimerspec; + +int timerfd_create(int, int); +int timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*); +int timerfd_gettime(int, struct itimerspec*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMERFD_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/times.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/times.h new file mode 100644 index 0000000..ec5d3d6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/times.h
@@ -0,0 +1,24 @@ +#ifndef SYSROOT_SYS_TIMES_H_ +#define SYSROOT_SYS_TIMES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_clock_t +#include <bits/alltypes.h> + +struct tms { + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; + +clock_t times(struct tms*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timex.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timex.h new file mode 100644 index 0000000..9981c93 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/timex.h
@@ -0,0 +1,99 @@ +#ifndef SYSROOT_SYS_TIMEX_H_ +#define SYSROOT_SYS_TIMEX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_clockid_t + +#include <sys/time.h> + +#include <bits/alltypes.h> + +struct ntptimeval { + struct timeval time; + long maxerror, esterror; +}; + +struct timex { + unsigned modes; + long offset, freq, maxerror, esterror; + int status; + long constant, precision, tolerance; + struct timeval time; + long tick, ppsfreq, jitter; + int shift; + long stabil, jitcnt, calcnt, errcnt, stbcnt; + int tai; + int __padding[11]; +}; + +#define ADJ_OFFSET 0x0001 +#define ADJ_FREQUENCY 0x0002 +#define ADJ_MAXERROR 0x0004 +#define ADJ_ESTERROR 0x0008 +#define ADJ_STATUS 0x0010 +#define ADJ_TIMECONST 0x0020 +#define ADJ_TAI 0x0080 +#define ADJ_SETOFFSET 0x0100 +#define ADJ_MICRO 0x1000 +#define ADJ_NANO 0x2000 +#define ADJ_TICK 0x4000 +#define ADJ_OFFSET_SINGLESHOT 0x8001 +#define ADJ_OFFSET_SS_READ 0xa001 + +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT +#define MOD_TAI ADJ_TAI +#define MOD_MICRO ADJ_MICRO +#define MOD_NANO ADJ_NANO + +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 + +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 + +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 + +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 + +#define STA_RONLY \ + (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR | STA_CLOCKERR | STA_NANO | \ + STA_MODE | STA_CLK) + +#define TIME_OK 0 +#define TIME_INS 1 +#define TIME_DEL 2 +#define TIME_OOP 3 +#define TIME_WAIT 4 +#define TIME_ERROR 5 +#define TIME_BAD TIME_ERROR + +#define MAXTC 6 + +int adjtimex(struct timex*); +int clock_adjtime(clockid_t, struct timex*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TIMEX_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ttydefaults.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ttydefaults.h new file mode 100644 index 0000000..e4994fe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ttydefaults.h
@@ -0,0 +1,39 @@ +#ifndef SYSROOT_SYS_TTYDEFAULTS_H_ +#define SYSROOT_SYS_TTYDEFAULTS_H_ + +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE | ECHOKE | ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) +#define TTYDEF_SPEED (B9600) +#define CTRL(x) (x & 037) +#define CEOF CTRL('d') + +#ifdef _POSIX_VDISABLE +#define CEOL _POSIX_VDISABLE +#define CSTATUS _POSIX_VDISABLE +#else +#define CEOL '\0' +#define CSTATUS '\0' +#endif + +#define CERASE 0177 +#define CINTR CTRL('c') +#define CKILL CTRL('u') +#define CMIN 1 +#define CQUIT 034 +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT CTRL('v') +#define CDISCARD CTRL('o') +#define CWERASE CTRL('w') +#define CREPRINT CTRL('r') +#define CEOT CEOF +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD + +#endif // SYSROOT_SYS_TTYDEFAULTS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/types.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/types.h new file mode 100644 index 0000000..ea195a0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/types.h
@@ -0,0 +1,76 @@ +#ifndef SYSROOT_SYS_TYPES_H_ +#define SYSROOT_SYS_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_ino_t +#define __NEED_dev_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_time_t +#define __NEED_timer_t +#define __NEED_clockid_t + +#define __NEED_blkcnt_t +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t + +#define __NEED_id_t +#define __NEED_key_t +#define __NEED_clock_t +#define __NEED_suseconds_t +#define __NEED_blksize_t + +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t +#define __NEED_useconds_t + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include <stdint.h> +#define __NEED_u_int64_t +#define __NEED_register_t +#endif + +#include <bits/alltypes.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned u_int32_t; +typedef char* caddr_t; +typedef unsigned char u_char; +typedef unsigned short u_short, ushort; +typedef unsigned u_int, uint; +typedef unsigned long u_long, ulong; +typedef long long quad_t; +typedef unsigned long long u_quad_t; +#include <endian.h> +#include <sys/select.h> +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ucontext.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ucontext.h new file mode 100644 index 0000000..5fdbd63 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/ucontext.h
@@ -0,0 +1 @@ +#include <ucontext.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/uio.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/uio.h new file mode 100644 index 0000000..4762083 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/uio.h
@@ -0,0 +1,34 @@ +#ifndef SYSROOT_SYS_UIO_H_ +#define SYSROOT_SYS_UIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_off_t +#endif + +#include <bits/alltypes.h> + +#define UIO_MAXIOV 1024 + +ssize_t readv(int, const struct iovec*, int); +ssize_t writev(int, const struct iovec*, int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +ssize_t preadv(int, const struct iovec*, int, off_t); +ssize_t pwritev(int, const struct iovec*, int, off_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_UIO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/un.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/un.h new file mode 100644 index 0000000..425c801 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/un.h
@@ -0,0 +1,31 @@ +#ifndef SYSROOT_SYS_UN_H_ +#define SYSROOT_SYS_UN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_sa_family_t +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#endif + +#include <bits/alltypes.h> + +struct sockaddr_un { + sa_family_t sun_family; + char sun_path[108]; +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +size_t strlen(const char*); +#define SUN_LEN(s) (2 + strlen((s)->sun_path)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_UN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/utsname.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/utsname.h new file mode 100644 index 0000000..5d5fee1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/utsname.h
@@ -0,0 +1,30 @@ +#ifndef SYSROOT_SYS_UTSNAME_H_ +#define SYSROOT_SYS_UTSNAME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <limits.h> + +struct utsname { + char sysname[65]; + char nodename[HOST_NAME_MAX + 1]; + char release[65]; + char version[65]; + char machine[65]; +#ifdef _GNU_SOURCE + char domainname[65]; +#else + char __domainname[65]; +#endif +}; + +int uname(struct utsname*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_UTSNAME_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/vfs.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/vfs.h new file mode 100644 index 0000000..a899db2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/vfs.h
@@ -0,0 +1 @@ +#include <sys/statfs.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/wait.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/wait.h new file mode 100644 index 0000000..3b33520 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sys/wait.h
@@ -0,0 +1,46 @@ +#ifndef SYSROOT_SYS_WAIT_H_ +#define SYSROOT_SYS_WAIT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_pid_t +#define __NEED_id_t +#include <bits/alltypes.h> + +typedef enum { P_ALL = 0, P_PID = 1, P_PGID = 2 } idtype_t; + +pid_t wait(int*); +pid_t waitpid(pid_t, int*, int); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include <signal.h> +int waitid(idtype_t, id_t, siginfo_t*, int); +#endif + +#define WNOHANG 1 +#define WUNTRACED 2 + +#define WSTOPPED 2 +#define WEXITED 4 +#define WCONTINUED 8 +#define WNOWAIT 0x1000000 + +#define WEXITSTATUS(s) (((s)&0xff00) >> 8) +#define WTERMSIG(s) ((s)&0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WCOREDUMP(s) ((s)&0x80) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) ((short)((((s)&0xffff) * 0x10001) >> 8) > 0x7f00) +#define WIFSIGNALED(s) (((s)&0xffff) - 1U < 0xffu) +#define WIFCONTINUED(s) ((s) == 0xffff) + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYS_WAIT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/sysexits.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sysexits.h new file mode 100644 index 0000000..ca2782d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/sysexits.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_SYSEXITS_H_ +#define SYSROOT_SYSEXITS_H_ + +#define EX_OK 0 +#define EX__BASE 64 +#define EX_USAGE 64 +#define EX_DATAERR 65 +#define EX_NOINPUT 66 +#define EX_NOUSER 67 +#define EX_NOHOST 68 +#define EX_UNAVAILABLE 69 +#define EX_SOFTWARE 70 +#define EX_OSERR 71 +#define EX_OSFILE 72 +#define EX_CANTCREAT 73 +#define EX_IOERR 74 +#define EX_TEMPFAIL 75 +#define EX_PROTOCOL 76 +#define EX_NOPERM 77 +#define EX_CONFIG 78 +#define EX__MAX 78 + +#endif // SYSROOT_SYSEXITS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/syslog.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/syslog.h new file mode 100644 index 0000000..dcb09e3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/syslog.h
@@ -0,0 +1,121 @@ +#ifndef SYSROOT_SYSLOG_H_ +#define SYSROOT_SYSLOG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 7 +#define LOG_PRI(p) ((p)&LOG_PRIMASK) +#define LOG_MAKEPRI(f, p) (((f) << 3) | (p)) + +#define LOG_MASK(p) (1 << (p)) +#define LOG_UPTO(p) ((1 << ((p) + 1)) - 1) + +#define LOG_KERN (0 << 3) +#define LOG_USER (1 << 3) +#define LOG_MAIL (2 << 3) +#define LOG_DAEMON (3 << 3) +#define LOG_AUTH (4 << 3) +#define LOG_SYSLOG (5 << 3) +#define LOG_LPR (6 << 3) +#define LOG_NEWS (7 << 3) +#define LOG_UUCP (8 << 3) +#define LOG_CRON (9 << 3) +#define LOG_AUTHPRIV (10 << 3) +#define LOG_FTP (11 << 3) + +#define LOG_LOCAL0 (16 << 3) +#define LOG_LOCAL1 (17 << 3) +#define LOG_LOCAL2 (18 << 3) +#define LOG_LOCAL3 (19 << 3) +#define LOG_LOCAL4 (20 << 3) +#define LOG_LOCAL5 (21 << 3) +#define LOG_LOCAL6 (22 << 3) +#define LOG_LOCAL7 (23 << 3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x3f8 +#define LOG_FAC(p) (((p)&LOG_FACMASK) >> 3) + +#define LOG_PID 0x01 +#define LOG_CONS 0x02 +#define LOG_ODELAY 0x04 +#define LOG_NDELAY 0x08 +#define LOG_NOWAIT 0x10 +#define LOG_PERROR 0x20 + +void closelog(void); +void openlog(const char*, int, int); +int setlogmask(int); +void syslog(int, const char*, ...); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define _PATH_LOG "/dev/log" +#define __NEED_va_list +#include <bits/alltypes.h> +void vsyslog(int, const char*, va_list); +#if defined(SYSLOG_NAMES) +#define INTERNAL_NOPRI 0x10 +#define INTERNAL_MARK (LOG_NFACILITIES << 3) +typedef struct { + char* c_name; + int c_val; +} CODE; +#define prioritynames \ + ((CODE*)(const CODE[]){{"alert", LOG_ALERT}, \ + {"crit", LOG_CRIT}, \ + {"debug", LOG_DEBUG}, \ + {"emerg", LOG_EMERG}, \ + {"err", LOG_ERR}, \ + {"error", LOG_ERR}, \ + {"info", LOG_INFO}, \ + {"none", INTERNAL_NOPRI}, \ + {"notice", LOG_NOTICE}, \ + {"panic", LOG_EMERG}, \ + {"warn", LOG_WARNING}, \ + {"warning", LOG_WARNING}, \ + {0, -1}}) +#define facilitynames \ + ((CODE*)(const CODE[]){{"auth", LOG_AUTH}, \ + {"authpriv", LOG_AUTHPRIV}, \ + {"cron", LOG_CRON}, \ + {"daemon", LOG_DAEMON}, \ + {"ftp", LOG_FTP}, \ + {"kern", LOG_KERN}, \ + {"lpr", LOG_LPR}, \ + {"mail", LOG_MAIL}, \ + {"mark", INTERNAL_MARK}, \ + {"news", LOG_NEWS}, \ + {"security", LOG_AUTH}, \ + {"syslog", LOG_SYSLOG}, \ + {"user", LOG_USER}, \ + {"uucp", LOG_UUCP}, \ + {"local0", LOG_LOCAL0}, \ + {"local1", LOG_LOCAL1}, \ + {"local2", LOG_LOCAL2}, \ + {"local3", LOG_LOCAL3}, \ + {"local4", LOG_LOCAL4}, \ + {"local5", LOG_LOCAL5}, \ + {"local6", LOG_LOCAL6}, \ + {"local7", LOG_LOCAL7}, \ + {0, -1}}) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_SYSLOG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/tar.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/tar.h new file mode 100644 index 0000000..2dcb983 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/tar.h
@@ -0,0 +1,33 @@ +#ifndef SYSROOT_TAR_H_ +#define SYSROOT_TAR_H_ + +#define TSUID 04000 +#define TSGID 02000 +#define TSVTX 01000 +#define TUREAD 00400 +#define TUWRITE 00200 +#define TUEXEC 00100 +#define TGREAD 00040 +#define TGWRITE 00020 +#define TGEXEC 00010 +#define TOREAD 00004 +#define TOWRITE 00002 +#define TOEXEC 00001 + +#define REGTYPE '0' +#define AREGTYPE '\0' +#define LNKTYPE '1' +#define SYMTYPE '2' +#define CHRTYPE '3' +#define BLKTYPE '4' +#define DIRTYPE '5' +#define FIFOTYPE '6' +#define CONTTYPE '7' + +#define TMAGIC "ustar" +#define TMAGLEN 6 + +#define TVERSION "00" +#define TVERSLEN 2 + +#endif // SYSROOT_TAR_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/termios.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/termios.h new file mode 100644 index 0000000..4ccfe13 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/termios.h
@@ -0,0 +1,46 @@ +#ifndef SYSROOT_TERMIOS_H_ +#define SYSROOT_TERMIOS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_pid_t + +#include <bits/alltypes.h> + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 + +#include <bits/termios.h> + +speed_t cfgetospeed(const struct termios*); +speed_t cfgetispeed(const struct termios*); +int cfsetospeed(struct termios*, speed_t); +int cfsetispeed(struct termios*, speed_t); + +int tcgetattr(int, struct termios*); +int tcsetattr(int, int, const struct termios*); + +int tcsendbreak(int, int); +int tcdrain(int); +int tcflush(int, int); +int tcflow(int, int); + +pid_t tcgetsid(int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void cfmakeraw(struct termios*); +int cfsetspeed(struct termios*, speed_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_TERMIOS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/threads.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/threads.h new file mode 100644 index 0000000..480a6f7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/threads.h
@@ -0,0 +1,108 @@ +#ifndef SYSROOT_THREADS_H_ +#define SYSROOT_THREADS_H_ + +#include <features.h> +#include <time.h> + +#ifdef __cplusplus +extern "C" { +typedef unsigned long thrd_t; +#else +typedef struct __pthread* thrd_t; +#define thread_local _Thread_local +#endif + +typedef unsigned tss_t; +typedef int (*thrd_start_t)(void*); +typedef void (*tss_dtor_t)(void*); + +#define __NEED_cnd_t +#define __NEED_mtx_t +#define __NEED_once_flag + +#include <bits/alltypes.h> + +#define TSS_DTOR_ITERATIONS 4 + +enum { + thrd_success = 0, + thrd_busy = 1, + thrd_error = 2, + thrd_nomem = 3, + thrd_timedout = 4, +}; + +// These are bitfield values; initialize with e.g. (mtx_plain|mtx_timed). +// mtx_recursive is not implemented. +enum { + mtx_plain = 0, + mtx_recursive = 1, + mtx_timed = 2, +}; + +#ifdef _ALL_SOURCE +#define MTX_INIT \ + {} +#define CND_INIT \ + {} +#endif + +#define ONCE_FLAG_INIT 0 + +int thrd_create(thrd_t*, thrd_start_t, void*); +#ifdef _ALL_SOURCE +// |name| is silently truncated to a maximum of ZX_MAX_NAME_LEN-1 characters. +int thrd_create_with_name(thrd_t*, thrd_start_t, void*, const char* name); +#endif +_Noreturn void thrd_exit(int); + +int thrd_detach(thrd_t); +int thrd_join(thrd_t, int*); + +int thrd_sleep(const struct timespec*, struct timespec*); +void thrd_yield(void); + +thrd_t thrd_current(void); +int thrd_equal(thrd_t, thrd_t); +#ifndef __cplusplus +#define thrd_equal(A, B) ((A) == (B)) +#endif + +void call_once(once_flag*, void (*)(void)); + +int mtx_init(mtx_t*, int); +void mtx_destroy(mtx_t*); + +int mtx_lock(mtx_t* __m) +#ifdef __clang__ + __attribute__((__acquire_capability__(__m))) +#endif + ; +int mtx_timedlock(mtx_t* __restrict, const struct timespec* __restrict); +int mtx_trylock(mtx_t*); +int mtx_unlock(mtx_t* __m) +#ifdef __clang__ + __attribute__((__release_capability__(__m))) +#endif + ; + +int cnd_init(cnd_t*); +void cnd_destroy(cnd_t*); + +int cnd_broadcast(cnd_t*); +int cnd_signal(cnd_t*); + +int cnd_timedwait(cnd_t* __restrict, mtx_t* __restrict, const struct timespec* __restrict); +int cnd_wait(cnd_t*, mtx_t*); + +int tss_create(tss_t*, tss_dtor_t); +void tss_delete(tss_t key); + +int tss_set(tss_t, void*); +void* tss_get(tss_t); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_THREADS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/time.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/time.h new file mode 100644 index 0000000..b81da45 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/time.h
@@ -0,0 +1,124 @@ +#ifndef SYSROOT_TIME_H_ +#define SYSROOT_TIME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_size_t +#define __NEED_time_t +#define __NEED_clock_t +#define __NEED_struct_timespec + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_clockid_t +#define __NEED_timer_t +#define __NEED_pid_t +#endif + +#include <bits/alltypes.h> + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define __tm_gmtoff tm_gmtoff +#define __tm_zone tm_zone +#endif + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + long __tm_gmtoff; + const char* __tm_zone; +}; + +clock_t clock(void); +time_t time(time_t*); +double difftime(time_t, time_t); +time_t mktime(struct tm*); +size_t strftime(char* __restrict, size_t, const char* __restrict, const struct tm* __restrict); +struct tm* gmtime(const time_t*); +struct tm* localtime(const time_t*); +char* asctime(const struct tm*); +char* ctime(const time_t*); +int timespec_get(struct timespec*, int); + +#define CLOCKS_PER_SEC 1000000L + +#define TIME_UTC 1 + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +struct tm* gmtime_r(const time_t* __restrict, struct tm* __restrict); +struct tm* localtime_r(const time_t* __restrict, struct tm* __restrict); +char* asctime_r(const struct tm* __restrict, char* __restrict); +char* ctime_r(const time_t*, char*); + +void tzset(void); + +struct itimerspec { + struct timespec it_interval; + struct timespec it_value; +}; + +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 1 +#define CLOCK_PROCESS_CPUTIME_ID 2 +#define CLOCK_THREAD_CPUTIME_ID 3 +#define CLOCK_MONOTONIC_RAW 4 +#define CLOCK_REALTIME_COARSE 5 +#define CLOCK_MONOTONIC_COARSE 6 +#define CLOCK_BOOTTIME 7 +#define CLOCK_REALTIME_ALARM 8 +#define CLOCK_BOOTTIME_ALARM 9 +#define CLOCK_SGI_CYCLE 10 +#define CLOCK_TAI 11 + +#define TIMER_ABSTIME 1 + +int nanosleep(const struct timespec*, struct timespec*); +int clock_getres(clockid_t, struct timespec*); +int clock_gettime(clockid_t, struct timespec*); +int clock_settime(clockid_t, const struct timespec*); +int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*); +int clock_getcpuclockid(pid_t, clockid_t*); + +struct sigevent; +int timer_create(clockid_t, struct sigevent* __restrict, timer_t* __restrict); +int timer_delete(timer_t); +int timer_settime(timer_t, int, const struct itimerspec* __restrict, struct itimerspec* __restrict); +int timer_gettime(timer_t, struct itimerspec*); +int timer_getoverrun(timer_t); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +char* strptime(const char* __restrict, const char* __restrict, struct tm* __restrict); +extern int daylight; +extern long timezone; +extern char* tzname[2]; +extern int getdate_err; +struct tm* getdate(const char*); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int stime(const time_t*); +time_t timegm(struct tm*); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_TIME_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/uchar.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/uchar.h new file mode 100644 index 0000000..79cda7c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/uchar.h
@@ -0,0 +1,28 @@ +#ifndef SYSROOT_UCHAR_H_ +#define SYSROOT_UCHAR_H_ + +#ifdef __cplusplus +extern "C" { +#else +typedef unsigned short char16_t; +typedef unsigned char32_t; +#endif + +#define __NEED_mbstate_t +#define __NEED_size_t + +#include <features.h> + +#include <bits/alltypes.h> + +size_t c16rtomb(char* __restrict, char16_t, mbstate_t* __restrict); +size_t mbrtoc16(char16_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict); + +size_t c32rtomb(char* __restrict, char32_t, mbstate_t* __restrict); +size_t mbrtoc32(char32_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UCHAR_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/ucontext.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ucontext.h new file mode 100644 index 0000000..ccd910f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/ucontext.h
@@ -0,0 +1,26 @@ +#ifndef SYSROOT_UCONTEXT_H_ +#define SYSROOT_UCONTEXT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> +#include <signal.h> + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NGREG (sizeof(gregset_t) / sizeof(greg_t)) +#endif + +struct __ucontext; + +int getcontext(struct __ucontext*); +void makecontext(struct __ucontext*, void (*)(void), int, ...); +int setcontext(const struct __ucontext*); +int swapcontext(struct __ucontext*, const struct __ucontext*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UCONTEXT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/unistd.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/unistd.h new file mode 100644 index 0000000..e400030 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/unistd.h
@@ -0,0 +1,436 @@ +#ifndef SYSROOT_UNISTD_H_ +#define SYSROOT_UNISTD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_intptr_t +#define __NEED_useconds_t + +#include <bits/alltypes.h> + +int pipe(int[2]); +int pipe2(int[2], int); +int close(int); +int posix_close(int, int); +int dup(int); +int dup2(int, int); +int dup3(int, int, int); +off_t lseek(int, off_t, int); +int fsync(int); +int fdatasync(int); + +ssize_t read(int, void*, size_t); +ssize_t write(int, const void*, size_t); +ssize_t pread(int, void*, size_t, off_t); +ssize_t pwrite(int, const void*, size_t, off_t); + +int chown(const char*, uid_t, gid_t); +int fchown(int, uid_t, gid_t); +int lchown(const char*, uid_t, gid_t); +int fchownat(int, const char*, uid_t, gid_t, int); + +int link(const char*, const char*); +int linkat(int, const char*, int, const char*, int); +int symlink(const char*, const char*); +int symlinkat(const char*, int, const char*); +ssize_t readlink(const char* __restrict, char* __restrict, size_t); +ssize_t readlinkat(int, const char* __restrict, char* __restrict, size_t); +int unlink(const char*); +int unlinkat(int, const char*, int); +int rmdir(const char*); +int truncate(const char*, off_t); +int ftruncate(int, off_t); + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 + +int access(const char*, int); +int faccessat(int, const char*, int, int); + +int chdir(const char*); +char* getcwd(char*, size_t); + +unsigned alarm(unsigned); +unsigned sleep(unsigned); +int pause(void); + +pid_t fork(void); +int execve(const char*, char* const[], char* const[]); +int execv(const char*, char* const[]); +int execle(const char*, const char*, ...); +int execl(const char*, const char*, ...); +int execvp(const char*, char* const[]); +int execlp(const char*, const char*, ...); +int fexecve(int, char* const[], char* const[]); +_Noreturn void _exit(int); + +pid_t getpid(void); +pid_t getppid(void); +pid_t getpgrp(void); +pid_t getpgid(pid_t); +int setpgid(pid_t, pid_t); +pid_t setsid(void); +pid_t getsid(pid_t); +char* ttyname(int); +int ttyname_r(int, char*, size_t); +int isatty(int); +pid_t tcgetpgrp(int); +int tcsetpgrp(int, pid_t); + +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); +int getgroups(int, gid_t[]); +int setuid(uid_t); +int setreuid(uid_t, uid_t); +int seteuid(uid_t); +int setgid(gid_t); +int setregid(gid_t, gid_t); +int setegid(gid_t); + +char* getlogin(void); +int getlogin_r(char*, size_t); +int gethostname(char*, size_t); +char* ctermid(char*); + +int getopt(int, char* const[], const char*); +extern char* optarg; +extern int optind, opterr, optopt; + +long pathconf(const char*, int); +long fpathconf(int, int); +long sysconf(int); +size_t confstr(int, char*, size_t); + +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int lockf(int, int, off_t); +long gethostid(void); +void sync(void); +int syncfs(int); +pid_t setpgrp(void); +void swab(const void* __restrict, void* __restrict, ssize_t); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || \ + (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE + 0 < 700) +int usleep(unsigned); +unsigned ualarm(unsigned, unsigned); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 +int vhangup(void); +int getpagesize(void); +int getdtablesize(void); +int sethostname(const char*, size_t); +int getdomainname(char*, size_t); +int setdomainname(const char*, size_t); +int setgroups(size_t, const gid_t*); +char* getpass(const char*); +int acct(const char*); +int execvpe(const char*, char* const[], char* const[]); +int issetugid(void); +#endif + +#ifdef _GNU_SOURCE +extern char** environ; +int setresuid(uid_t, uid_t, uid_t); +int setresgid(gid_t, gid_t, gid_t); +int getresuid(uid_t*, uid_t*, uid_t*); +int getresgid(gid_t*, gid_t*, gid_t*); +char* get_current_dir_name(void); +int euidaccess(const char*, int); +int eaccess(const char*, int); +#endif + +#define POSIX_CLOSE_RESTART 0 + +#define _XOPEN_VERSION 700 +#define _XOPEN_UNIX 1 +#define _XOPEN_ENH_I18N 1 + +#define _POSIX_VERSION 200809L +#define _POSIX2_VERSION _POSIX_VERSION + +#define _POSIX_ADVISORY_INFO _POSIX_VERSION +#define _POSIX_CHOWN_RESTRICTED 1 +#define _POSIX_IPV6 _POSIX_VERSION +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_MAPPED_FILES _POSIX_VERSION +#define _POSIX_MEMLOCK _POSIX_VERSION +#define _POSIX_MEMLOCK_RANGE _POSIX_VERSION +#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION +#define _POSIX_MESSAGE_PASSING _POSIX_VERSION +#define _POSIX_FSYNC _POSIX_VERSION +#define _POSIX_NO_TRUNC 1 +#define _POSIX_RAW_SOCKETS _POSIX_VERSION +#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION +#define _POSIX_REGEXP 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_SHELL 1 +#define _POSIX_SPAWN _POSIX_VERSION +#define _POSIX_VDISABLE 0 + +#define _POSIX_THREADS _POSIX_VERSION +#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION +#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION +#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION +#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION +/* #define _POSIX_THREAD_PRIORITY_SCHEDULING -1 */ +#define _POSIX_THREAD_CPUTIME _POSIX_VERSION +#define _POSIX_TIMERS _POSIX_VERSION +#define _POSIX_TIMEOUTS _POSIX_VERSION +#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION +#define _POSIX_CPUTIME _POSIX_VERSION +#define _POSIX_CLOCK_SELECTION _POSIX_VERSION +#define _POSIX_BARRIERS _POSIX_VERSION +#define _POSIX_SPIN_LOCKS _POSIX_VERSION +#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION +#define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION +#define _POSIX_SEMAPHORES _POSIX_VERSION +#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION + +#define _POSIX2_C_BIND _POSIX_VERSION + +#include <bits/posix.h> + +#define _PC_LINK_MAX 0 +#define _PC_MAX_CANON 1 +#define _PC_MAX_INPUT 2 +#define _PC_NAME_MAX 3 +#define _PC_PATH_MAX 4 +#define _PC_PIPE_BUF 5 +#define _PC_CHOWN_RESTRICTED 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 +#define _PC_SYNC_IO 9 +#define _PC_ASYNC_IO 10 +#define _PC_PRIO_IO 11 +#define _PC_SOCK_MAXBUF 12 +#define _PC_FILESIZEBITS 13 +#define _PC_REC_INCR_XFER_SIZE 14 +#define _PC_REC_MAX_XFER_SIZE 15 +#define _PC_REC_MIN_XFER_SIZE 16 +#define _PC_REC_XFER_ALIGN 17 +#define _PC_ALLOC_SIZE_MIN 18 +#define _PC_SYMLINK_MAX 19 +#define _PC_2_SYMLINKS 20 + +#define _SC_ARG_MAX 0 +#define _SC_CHILD_MAX 1 +#define _SC_CLK_TCK 2 +#define _SC_NGROUPS_MAX 3 +#define _SC_OPEN_MAX 4 +#define _SC_STREAM_MAX 5 +#define _SC_TZNAME_MAX 6 +#define _SC_JOB_CONTROL 7 +#define _SC_SAVED_IDS 8 +#define _SC_REALTIME_SIGNALS 9 +#define _SC_PRIORITY_SCHEDULING 10 +#define _SC_TIMERS 11 +#define _SC_ASYNCHRONOUS_IO 12 +#define _SC_PRIORITIZED_IO 13 +#define _SC_SYNCHRONIZED_IO 14 +#define _SC_FSYNC 15 +#define _SC_MAPPED_FILES 16 +#define _SC_MEMLOCK 17 +#define _SC_MEMLOCK_RANGE 18 +#define _SC_MEMORY_PROTECTION 19 +#define _SC_MESSAGE_PASSING 20 +#define _SC_SEMAPHORES 21 +#define _SC_SHARED_MEMORY_OBJECTS 22 +#define _SC_AIO_LISTIO_MAX 23 +#define _SC_AIO_MAX 24 +#define _SC_AIO_PRIO_DELTA_MAX 25 +#define _SC_DELAYTIMER_MAX 26 +#define _SC_MQ_OPEN_MAX 27 +#define _SC_MQ_PRIO_MAX 28 +#define _SC_VERSION 29 +#define _SC_PAGE_SIZE 30 +#define _SC_PAGESIZE 30 /* !! */ +#define _SC_RTSIG_MAX 31 +#define _SC_SEM_NSEMS_MAX 32 +#define _SC_SEM_VALUE_MAX 33 +#define _SC_SIGQUEUE_MAX 34 +#define _SC_TIMER_MAX 35 +#define _SC_BC_BASE_MAX 36 +#define _SC_BC_DIM_MAX 37 +#define _SC_BC_SCALE_MAX 38 +#define _SC_BC_STRING_MAX 39 +#define _SC_COLL_WEIGHTS_MAX 40 +#define _SC_EXPR_NEST_MAX 42 +#define _SC_LINE_MAX 43 +#define _SC_RE_DUP_MAX 44 +#define _SC_2_VERSION 46 +#define _SC_2_C_BIND 47 +#define _SC_2_C_DEV 48 +#define _SC_2_FORT_DEV 49 +#define _SC_2_FORT_RUN 50 +#define _SC_2_SW_DEV 51 +#define _SC_2_LOCALEDEF 52 +#define _SC_UIO_MAXIOV 60 /* !! */ +#define _SC_IOV_MAX 60 +#define _SC_THREADS 67 +#define _SC_THREAD_SAFE_FUNCTIONS 68 +#define _SC_GETGR_R_SIZE_MAX 69 +#define _SC_GETPW_R_SIZE_MAX 70 +#define _SC_LOGIN_NAME_MAX 71 +#define _SC_TTY_NAME_MAX 72 +#define _SC_THREAD_DESTRUCTOR_ITERATIONS 73 +#define _SC_THREAD_KEYS_MAX 74 +#define _SC_THREAD_STACK_MIN 75 +#define _SC_THREAD_THREADS_MAX 76 +#define _SC_THREAD_ATTR_STACKADDR 77 +#define _SC_THREAD_ATTR_STACKSIZE 78 +#define _SC_THREAD_PRIORITY_SCHEDULING 79 +#define _SC_THREAD_PRIO_INHERIT 80 +#define _SC_THREAD_PRIO_PROTECT 81 +#define _SC_THREAD_PROCESS_SHARED 82 +#define _SC_NPROCESSORS_CONF 83 +#define _SC_NPROCESSORS_ONLN 84 +#define _SC_PHYS_PAGES 85 +#define _SC_AVPHYS_PAGES 86 +#define _SC_ATEXIT_MAX 87 +#define _SC_PASS_MAX 88 +#define _SC_XOPEN_VERSION 89 +#define _SC_XOPEN_XCU_VERSION 90 +#define _SC_XOPEN_UNIX 91 +#define _SC_XOPEN_CRYPT 92 +#define _SC_XOPEN_ENH_I18N 93 +#define _SC_XOPEN_SHM 94 +#define _SC_2_CHAR_TERM 95 +#define _SC_2_UPE 97 +#define _SC_XOPEN_XPG2 98 +#define _SC_XOPEN_XPG3 99 +#define _SC_XOPEN_XPG4 100 +#define _SC_NZERO 109 +#define _SC_XBS5_ILP32_OFF32 125 +#define _SC_XBS5_ILP32_OFFBIG 126 +#define _SC_XBS5_LP64_OFF64 127 +#define _SC_XBS5_LPBIG_OFFBIG 128 +#define _SC_XOPEN_LEGACY 129 +#define _SC_XOPEN_REALTIME 130 +#define _SC_XOPEN_REALTIME_THREADS 131 +#define _SC_ADVISORY_INFO 132 +#define _SC_BARRIERS 133 +#define _SC_CLOCK_SELECTION 137 +#define _SC_CPUTIME 138 +#define _SC_THREAD_CPUTIME 139 +#define _SC_MONOTONIC_CLOCK 149 +#define _SC_READER_WRITER_LOCKS 153 +#define _SC_SPIN_LOCKS 154 +#define _SC_REGEXP 155 +#define _SC_SHELL 157 +#define _SC_SPAWN 159 +#define _SC_SPORADIC_SERVER 160 +#define _SC_THREAD_SPORADIC_SERVER 161 +#define _SC_TIMEOUTS 164 +#define _SC_TYPED_MEMORY_OBJECTS 165 +#define _SC_2_PBS 168 +#define _SC_2_PBS_ACCOUNTING 169 +#define _SC_2_PBS_LOCATE 170 +#define _SC_2_PBS_MESSAGE 171 +#define _SC_2_PBS_TRACK 172 +#define _SC_SYMLOOP_MAX 173 +#define _SC_STREAMS 174 +#define _SC_2_PBS_CHECKPOINT 175 +#define _SC_V6_ILP32_OFF32 176 +#define _SC_V6_ILP32_OFFBIG 177 +#define _SC_V6_LP64_OFF64 178 +#define _SC_V6_LPBIG_OFFBIG 179 +#define _SC_HOST_NAME_MAX 180 +#define _SC_TRACE 181 +#define _SC_TRACE_EVENT_FILTER 182 +#define _SC_TRACE_INHERIT 183 +#define _SC_TRACE_LOG 184 + +#define _SC_IPV6 235 +#define _SC_RAW_SOCKETS 236 +#define _SC_V7_ILP32_OFF32 237 +#define _SC_V7_ILP32_OFFBIG 238 +#define _SC_V7_LP64_OFF64 239 +#define _SC_V7_LPBIG_OFFBIG 240 +#define _SC_SS_REPL_MAX 241 +#define _SC_TRACE_EVENT_NAME_MAX 242 +#define _SC_TRACE_NAME_MAX 243 +#define _SC_TRACE_SYS_MAX 244 +#define _SC_TRACE_USER_EVENT_MAX 245 +#define _SC_XOPEN_STREAMS 246 +#define _SC_THREAD_ROBUST_PRIO_INHERIT 247 +#define _SC_THREAD_ROBUST_PRIO_PROTECT 248 + +#define _CS_PATH 0 +#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1 +#define _CS_GNU_LIBC_VERSION 2 +#define _CS_GNU_LIBPTHREAD_VERSION 3 +#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS 4 +#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 5 + +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 1116 +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 1117 +#define _CS_POSIX_V6_ILP32_OFF32_LIBS 1118 +#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS 1119 +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 1120 +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 1121 +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 1122 +#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS 1123 +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 1124 +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 1125 +#define _CS_POSIX_V6_LP64_OFF64_LIBS 1126 +#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS 1127 +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 1128 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 1129 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 1130 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS 1131 +#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1132 +#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 1133 +#define _CS_POSIX_V7_ILP32_OFF32_LIBS 1134 +#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS 1135 +#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 1136 +#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 1137 +#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 1138 +#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS 1139 +#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 1140 +#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 1141 +#define _CS_POSIX_V7_LP64_OFF64_LIBS 1142 +#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS 1143 +#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 1144 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 1145 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 1146 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147 + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UNISTD_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/utime.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/utime.h new file mode 100644 index 0000000..b4368aa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/utime.h
@@ -0,0 +1,23 @@ +#ifndef SYSROOT_UTIME_H_ +#define SYSROOT_UTIME_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_time_t + +#include <bits/alltypes.h> + +struct utimbuf { + time_t actime; + time_t modtime; +}; + +int utime(const char*, const struct utimbuf*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_UTIME_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/values.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/values.h new file mode 100644 index 0000000..0862584 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/values.h
@@ -0,0 +1,39 @@ +#ifndef SYSROOT_VALUES_H_ +#define SYSROOT_VALUES_H_ + +#include <limits.h> + +#define CHARBITS (sizeof(char) * 8) +#define SHORTBITS (sizeof(short) * 8) +#define INTBITS (sizeof(int) * 8) +#define LONGBITS (sizeof(long) * 8) +#define PTRBITS (sizeof(char*) * 8) +#define DOUBLEBITS (sizeof(double) * 8) +#define FLOATBITS (sizeof(float) * 8) + +#define MINSHORT SHRT_MIN +#define MININT INT_MIN +#define MINLONG LONG_MIN + +#define MAXSHORT SHRT_MAX +#define MAXINT INT_MAX +#define MAXLONG LONG_MAX + +#define HIBITS MINSHORT +#define HIBITL MINLONG + +#include <float.h> + +#define MAXDOUBLE DBL_MAX +#undef MAXFLOAT +#define MAXFLOAT FLT_MAX +#define MINDOUBLE DBL_MIN +#define MINFLOAT FLT_MIN +#define DMINEXP DBL_MIN_EXP +#define FMINEXP FLT_MIN_EXP +#define DMAXEXP DBL_MAX_EXP +#define FMAXEXP FLT_MAX_EXP + +#define BITSPERBYTE CHAR_BIT + +#endif // SYSROOT_VALUES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/wait.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wait.h new file mode 100644 index 0000000..98396e2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wait.h
@@ -0,0 +1,2 @@ +#warning redirecting incorrect #include <wait.h> to <sys/wait.h> +#include <sys/wait.h>
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/wchar.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wchar.h new file mode 100644 index 0000000..aaa7e9e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wchar.h
@@ -0,0 +1,185 @@ +#ifndef SYSROOT_WCHAR_H_ +#define SYSROOT_WCHAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#include <bits/null.h> + +#define __NEED_FILE +#define __NEED___isoc_va_list +#define __NEED_size_t +#define __NEED_wchar_t +#define __NEED_wint_t +#define __NEED_mbstate_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_va_list +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_wctype_t +#endif + +#include <bits/alltypes.h> + +#ifndef WCHAR_MAX +#define WCHAR_MAX __WCHAR_MAX__ +#endif + +#ifndef WCHAR_MIN +#if defined(__WCHAR_MIN__) +#define WCHAR_MIN __WCHAR_MIN__ +#else // defined(__WCHAR_MIN__) +#if defined(__WCHAR_UNSIGNED__) +#define WCHAR_MIN (L'\0' + 0) +#else +#define WCHAR_MIN (-WCHAR_MAX - 1) +#endif // defined (__WCHAR_UNSIGNED) +#endif // defined(__WCHAR_MIN__) +#endif + +#undef WEOF +#define WEOF 0xffffffffU + +wchar_t* wcscpy(wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcsncpy(wchar_t* __restrict, const wchar_t* __restrict, size_t); + +wchar_t* wcscat(wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcsncat(wchar_t* __restrict, const wchar_t* __restrict, size_t); + +int wcscmp(const wchar_t*, const wchar_t*); +int wcsncmp(const wchar_t*, const wchar_t*, size_t); + +int wcscoll(const wchar_t*, const wchar_t*); +size_t wcsxfrm(wchar_t* __restrict, const wchar_t* __restrict, size_t n); + +wchar_t* wcschr(const wchar_t*, wchar_t); +wchar_t* wcsrchr(const wchar_t*, wchar_t); + +size_t wcscspn(const wchar_t*, const wchar_t*); +size_t wcsspn(const wchar_t*, const wchar_t*); +wchar_t* wcspbrk(const wchar_t*, const wchar_t*); + +wchar_t* wcstok(wchar_t* __restrict, const wchar_t* __restrict, wchar_t** __restrict); + +size_t wcslen(const wchar_t*); + +wchar_t* wcsstr(const wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcswcs(const wchar_t*, const wchar_t*); + +wchar_t* wmemchr(const wchar_t*, wchar_t, size_t); +int wmemcmp(const wchar_t*, const wchar_t*, size_t); +wchar_t* wmemcpy(wchar_t* __restrict, const wchar_t* __restrict, size_t); +wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t); +wchar_t* wmemset(wchar_t*, wchar_t, size_t); + +wint_t btowc(int); +int wctob(wint_t); + +int mbsinit(const mbstate_t*); +size_t mbrtowc(wchar_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict); +size_t wcrtomb(char* __restrict, wchar_t, mbstate_t* __restrict); + +size_t mbrlen(const char* __restrict, size_t, mbstate_t* __restrict); + +size_t mbsrtowcs(wchar_t* __restrict, const char** __restrict, size_t, mbstate_t* __restrict); +size_t wcsrtombs(char* __restrict, const wchar_t** __restrict, size_t, mbstate_t* __restrict); + +float wcstof(const wchar_t* __restrict, wchar_t** __restrict); +double wcstod(const wchar_t* __restrict, wchar_t** __restrict); +long double wcstold(const wchar_t* __restrict, wchar_t** __restrict); + +long wcstol(const wchar_t* __restrict, wchar_t** __restrict, int); +unsigned long wcstoul(const wchar_t* __restrict, wchar_t** __restrict, int); + +long long wcstoll(const wchar_t* __restrict, wchar_t** __restrict, int); +unsigned long long wcstoull(const wchar_t* __restrict, wchar_t** __restrict, int); + +int fwide(FILE*, int); + +int wprintf(const wchar_t* __restrict, ...); +int fwprintf(FILE* __restrict, const wchar_t* __restrict, ...); +int swprintf(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...); + +int vwprintf(const wchar_t* __restrict, __isoc_va_list); +int vfwprintf(FILE* __restrict, const wchar_t* __restrict, __isoc_va_list); +int vswprintf(wchar_t* __restrict, size_t, const wchar_t* __restrict, __isoc_va_list); + +int wscanf(const wchar_t* __restrict, ...); +int fwscanf(FILE* __restrict, const wchar_t* __restrict, ...); +int swscanf(const wchar_t* __restrict, const wchar_t* __restrict, ...); + +int vwscanf(const wchar_t* __restrict, __isoc_va_list); +int vfwscanf(FILE* __restrict, const wchar_t* __restrict, __isoc_va_list); +int vswscanf(const wchar_t* __restrict, const wchar_t* __restrict, __isoc_va_list); + +wint_t fgetwc(FILE*); +wint_t getwc(FILE*); +wint_t getwchar(void); + +wint_t fputwc(wchar_t, FILE*); +wint_t putwc(wchar_t, FILE*); +wint_t putwchar(wchar_t); + +wchar_t* fgetws(wchar_t* __restrict, int, FILE* __restrict); +int fputws(const wchar_t* __restrict, FILE* __restrict); + +wint_t ungetwc(wint_t, FILE*); + +struct tm; +size_t wcsftime(wchar_t* __restrict, size_t, const wchar_t* __restrict, + const struct tm* __restrict); + +#undef iswdigit + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +FILE* open_wmemstream(wchar_t**, size_t*); +size_t mbsnrtowcs(wchar_t* __restrict, const char** __restrict, size_t, size_t, + mbstate_t* __restrict); +size_t wcsnrtombs(char* __restrict, const wchar_t** __restrict, size_t, size_t, + mbstate_t* __restrict); +wchar_t* wcsdup(const wchar_t*); +size_t wcsnlen(const wchar_t*, size_t); +wchar_t* wcpcpy(wchar_t* __restrict, const wchar_t* __restrict); +wchar_t* wcpncpy(wchar_t* __restrict, const wchar_t* __restrict, size_t); +int wcscasecmp(const wchar_t*, const wchar_t*); +int wcsncasecmp(const wchar_t*, const wchar_t*, size_t); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int wcwidth(wchar_t); +int wcswidth(const wchar_t*, size_t); +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctype_t wctype(const char*); + +#ifndef __cplusplus +#undef iswdigit +#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a) - '0') < 10) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_WCHAR_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/wctype.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wctype.h new file mode 100644 index 0000000..5a04bb8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wctype.h
@@ -0,0 +1,60 @@ +#ifndef SYSROOT_WCTYPE_H_ +#define SYSROOT_WCTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_wint_t +#define __NEED_wctype_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_locale_t +#endif + +#include <bits/alltypes.h> + +typedef const int* wctrans_t; + +#undef WEOF +#define WEOF 0xffffffffU + +#undef iswdigit + +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t towctrans(wint_t, wctrans_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctrans_t wctrans(const char*); +wctype_t wctype(const char*); + +#ifndef __cplusplus +#undef iswdigit +#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a) - '0') < 10) +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_WCTYPE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/wordexp.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wordexp.h new file mode 100644 index 0000000..dd6caa0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/wordexp.h
@@ -0,0 +1,41 @@ +#ifndef SYSROOT_WORDEXP_H_ +#define SYSROOT_WORDEXP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <features.h> + +#define __NEED_size_t + +#include <bits/alltypes.h> + +#define WRDE_DOOFFS 1 +#define WRDE_APPEND 2 +#define WRDE_NOCMD 4 +#define WRDE_REUSE 8 +#define WRDE_SHOWERR 16 +#define WRDE_UNDEF 32 + +typedef struct { + size_t we_wordc; + char** we_wordv; + size_t we_offs; +} wordexp_t; + +#define WRDE_NOSYS -1 +#define WRDE_NOSPACE 1 +#define WRDE_BADCHAR 2 +#define WRDE_BADVAL 3 +#define WRDE_CMDSUB 4 +#define WRDE_SYNTAX 5 + +int wordexp(const char* __restrict, wordexp_t* __restrict, int); +void wordfree(wordexp_t*); + +#ifdef __cplusplus +} +#endif + +#endif // SYSROOT_WORDEXP_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/assert.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/assert.h new file mode 100644 index 0000000..d53115d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/assert.h
@@ -0,0 +1,101 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_ASSERT_ +#define SYSROOT_ZIRCON_ASSERT_ + +// For a description of which asserts are enabled at which debug levels, see the documentation for +// GN build argument |assert_level|. + +#ifdef _KERNEL +#include <assert.h> +#define ZX_PANIC(args...) PANIC(args) +#define ZX_ASSERT(args...) ASSERT(args) +#define ZX_ASSERT_MSG(args...) ASSERT_MSG(args) +#define ZX_DEBUG_ASSERT(args...) DEBUG_ASSERT(args) +#define ZX_DEBUG_ASSERT_MSG(args...) DEBUG_ASSERT_MSG(args) +#define ZX_DEBUG_ASSERT_COND(args...) DEBUG_ASSERT_COND(args) +#define ZX_DEBUG_ASSERT_MSG_COND(args...) DEBUG_ASSERT_MSG_COND(args) +#define ZX_DEBUG_ASSERT_IMPLEMENTED DEBUG_ASSERT_IMPLEMENTED + +#else // #ifdef _KERNEL + +#include <zircon/compiler.h> + +__BEGIN_CDECLS +void __zx_panic(const char* format, ...) __NO_RETURN __PRINTFLIKE(1, 2); +__END_CDECLS + +#define ZX_PANIC(fmt, ...) __zx_panic((fmt), ##__VA_ARGS__) + +// Assert that |x| is true, else panic. +// +// ZX_ASSERT is always enabled and |x| will be evaluated regardless of any build arguments. +#define ZX_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + ZX_PANIC("ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); \ + } \ + } while (0) + +// Assert that |x| is true, else panic with the given message. +// +// ZX_ASSERT_MSG is always enabled and |x| will be evaluated regardless of any build arguments. +#define ZX_ASSERT_MSG(x, msg, msgargs...) \ + do { \ + if (unlikely(!(x))) { \ + ZX_PANIC("ASSERT FAILED at (%s:%d): %s\n" msg "\n", __FILE__, __LINE__, #x, ##msgargs); \ + } \ + } while (0) + +// Conditionally implement ZX_DEBUG_ASSERT based on ZX_ASSERT_LEVEL. +#ifdef ZX_ASSERT_LEVEL + +// ZX_DEBUG_ASSERT_IMPLEMENTED is intended to be used to conditionalize code that is logically part +// of a debug assert. It's useful for performing complex consistency checks that are difficult to +// work into a ZX_DEBUG_ASSERT statement. +#define ZX_DEBUG_ASSERT_IMPLEMENTED (ZX_ASSERT_LEVEL > 1) +#else +#define ZX_DEBUG_ASSERT_IMPLEMENTED 0 +#endif + +// Assert that |x| is true, else panic. +// +// Depending on build arguments, ZX_DEBUG_ASSERT may or may not be enabled. When disabled, |x| will +// not be evaluated. +#define ZX_DEBUG_ASSERT(x) \ + do { \ + if (ZX_DEBUG_ASSERT_IMPLEMENTED && unlikely(!(x))) { \ + ZX_PANIC("DEBUG ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); \ + } \ + } while (0) + +// Assert that |x| is true, else panic with the given message. +// +// Depending on build arguments, ZX_DEBUG_ASSERT_MSG may or may not be enabled. When disabled, |x| +// will not be evaluated. +#define ZX_DEBUG_ASSERT_MSG(x, msg, msgargs...) \ + do { \ + if (ZX_DEBUG_ASSERT_IMPLEMENTED && unlikely(!(x))) { \ + ZX_PANIC("DEBUG ASSERT FAILED at (%s:%d): %s\n" msg "\n", __FILE__, __LINE__, #x, \ + ##msgargs); \ + } \ + } while (0) + +// implement _COND versions of ZX_DEBUG_ASSERT which only emit the body if +// ZX_DEBUG_ASSERT_IMPLEMENTED is set +#if ZX_DEBUG_ASSERT_IMPLEMENTED +#define ZX_DEBUG_ASSERT_COND(x) ZX_DEBUG_ASSERT(x) +#define ZX_DEBUG_ASSERT_MSG_COND(x, msg, msgargs...) ZX_DEBUG_ASSERT_MSG(x, msg, msgargs) +#else +#define ZX_DEBUG_ASSERT_COND(x) \ + do { \ + } while (0) +#define ZX_DEBUG_ASSERT_MSG_COND(x, msg, msgargs...) \ + do { \ + } while (0) +#endif +#endif // #ifdef _KERNEL + +#endif // SYSROOT_ZIRCON_ASSERT_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/driver-config.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/driver-config.h new file mode 100644 index 0000000..8565ba6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/driver-config.h
@@ -0,0 +1,170 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_DRIVER_CONFIG_H_ +#define SYSROOT_ZIRCON_BOOT_DRIVER_CONFIG_H_ + +#include <stdint.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +// ZBI_TYPE_KERNEL_DRIVER item types (for zbi_header_t.extra) +#define KDRV_ARM_PSCI 0x49435350 // 'PSCI' +#define KDRV_ARM_GIC_V2 0x32434947 // 'GIC2' +#define KDRV_ARM_GIC_V3 0x33434947 // 'GIC3' +#define KDRV_ARM_GENERIC_TIMER 0x4D495441 // 'ATIM' +#define KDRV_PL011_UART 0x55304C50 // 'PL0U' +#define KDRV_AMLOGIC_UART 0x554C4D41 // 'AMLU' +#define KDRV_NXP_IMX_UART 0x55584D49 // 'IMXU' +#define KDRV_MT8167_UART 0x5538544D // 'MT8U' +#define KDRV_HISILICON_POWER 0x4F505348 // 'HSPO' +#define KDRV_AMLOGIC_HDCP 0x484C4D41 // 'AMLH' +#define KDRV_MSM_UART 0x554D534D // 'MSMU' +#define KDRV_MSM_POWER 1347244877 // 'MSMP' +#define KDRV_DW8250_UART 0x44573855 // 'DW8U' +#define KDRV_AS370_POWER 0x50303733 // '370P' +#define KDRV_AMLOGIC_RNG 0x484C4D52 // 'AMLR' +#define KDRV_GENERIC_32BIT_WATCHDOG 0x32334457 // 'WD32' +#define KDRV_I8250_PIO_UART 0x30353238 // '8250' +#define KDRV_I8250_MMIO_UART 0x4d353238 // '825M' + +// Kernel driver struct that can be used for simple drivers. +// Used by KDRV_PL011_UART, KDRV_AMLOGIC_UART, KDRV_NXP_IMX_UART, +// and KDRV_I8250_MMIO_UART. +typedef struct { + uint64_t mmio_phys; + uint32_t irq; +} dcfg_simple_t; + +// Used by KDRV_I8250_PIO_UART. +typedef struct { + uint16_t base; + uint32_t irq; +} dcfg_simple_pio_t; + +// for KDRV_MT8167_UART +typedef struct { + uint64_t soc_mmio_phys; + uint64_t uart_mmio_phys; + uint32_t irq; +} dcfg_soc_uart_t; + +// for KDRV_ARM_PSCI +typedef struct { + bool use_hvc; + uint64_t shutdown_args[3]; + uint64_t reboot_args[3]; + uint64_t reboot_bootloader_args[3]; + uint64_t reboot_recovery_args[3]; +} dcfg_arm_psci_driver_t; + +typedef struct { + uint64_t soc_imem_phys; + uint64_t soc_imem_offset; +} dcfg_msm_power_driver_t; + +// for KDRV_ARM_GIC_V2 +typedef struct { + uint64_t mmio_phys; + uint64_t msi_frame_phys; + uint64_t gicd_offset; + uint64_t gicc_offset; + uint64_t gich_offset; + uint64_t gicv_offset; + uint32_t ipi_base; + bool optional; + bool use_msi; +} dcfg_arm_gicv2_driver_t; + +// for KDRV_ARM_GIC_V3 +typedef struct { + uint64_t mmio_phys; + uint64_t gicd_offset; + uint64_t gicr_offset; + uint64_t gicr_stride; + uint64_t mx8_gpr_phys; + uint32_t ipi_base; + bool optional; +} dcfg_arm_gicv3_driver_t; + +// for KDRV_ARM_GENERIC_TIMER +typedef struct { + uint32_t irq_phys; + uint32_t irq_virt; + uint32_t irq_sphys; + uint32_t freq_override; +} dcfg_arm_generic_timer_driver_t; + +// for KDRV_HISILICON_POWER +typedef struct { + uint64_t sctrl_phys; + uint64_t pmu_phys; +} dcfg_hisilicon_power_driver_t; + +// for KDRV_AMLOGIC_HDCP +typedef struct { + uint64_t preset_phys; + uint64_t hiu_phys; + uint64_t hdmitx_phys; +} dcfg_amlogic_hdcp_driver_t; + +// for KDRV_AMLOGIC_RNG +typedef struct { + uint64_t rng_data_phys; + uint64_t rng_status_phys; + uint64_t rng_refresh_interval_usec; +} dcfg_amlogic_rng_driver_t; + +// Defines a register write action for a generic kernel watchdog driver. An +// action consists of the following steps. +// +// 1) Read from the register located a physical address |addr| +// 2) Clear all of the bits in the value which was read using the |clr_mask| +// 3) Set all of the bits in the value using the |set_mask| +// 4) Write this value back to the address located at addr. +// +typedef struct { + uint64_t addr; + uint32_t clr_mask; + uint32_t set_mask; +} dcfg_generic_32bit_watchdog_action_t; + +#define KDRV_GENERIC_32BIT_WATCHDOG_FLAG_ENABLED ((uint32_t)0x00000001) +#define KDRV_GENERIC_32BIT_WATCHDOG_MIN_PERIOD ZX_MSEC(1) + +// Definitions of actions which may be taken by a generic 32 bit watchdog timer +// kernel driver which may be passed by a bootloader. Field definitions are as +// follows. +// +// |pet_action| +// The address and masks needed to "pet" (aka, dismiss) a hardware watchdog timer. +// +// |enable_action| +// The address and masks needed to enable a hardware watchdog timer. If enable +// is an unsupported operation, the addr of the |enable_action| shall be zero. +// +// |disable_action| +// The address and masks needed to disable a hardware watchdog timer. If +// disable is an unsupported operation, the addr of the |disable_action| shall +// be zero. +// +// |watchdog_period_nsec| +// The period of the watchdog timer given in nanoseconds. When enabled, the +// watchdog timer driver must pet the watch dog at least this often. The value +// must be at least 1 mSec, typically much larger (on the order of a second or +// two) +// +// |flags| +// Storage for additional flags. Currently, only one flag is defined, +// "FLAG_ENABLED". When this flag is set, it indicates that the watchdog timer +// was left enabled by the bootloader at startup. +typedef struct { + dcfg_generic_32bit_watchdog_action_t pet_action; + dcfg_generic_32bit_watchdog_action_t enable_action; + dcfg_generic_32bit_watchdog_action_t disable_action; + zx_duration_t watchdog_period_nsec; + uint32_t flags; +} dcfg_generic_32bit_watchdog_t; + +#endif // SYSROOT_ZIRCON_BOOT_DRIVER_CONFIG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/e820.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/e820.h new file mode 100644 index 0000000..f0f98f0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/e820.h
@@ -0,0 +1,23 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_E820_H_ +#define SYSROOT_ZIRCON_BOOT_E820_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 +#define E820_NVS 4 +#define E820_UNUSABLE 5 + +typedef struct e820entry { + uint64_t addr; + uint64_t size; + uint32_t type; +} __PACKED e820entry_t; + +#endif // SYSROOT_ZIRCON_BOOT_E820_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/image.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/image.h new file mode 100644 index 0000000..1e23a25 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/image.h
@@ -0,0 +1,636 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_IMAGE_H_ +#define SYSROOT_ZIRCON_BOOT_IMAGE_H_ + +// This file contains assembly code that cannot be clang formatted. +// clang-format off + +#ifndef __ASSEMBLER__ +#include <stdint.h> +#endif + +// Zircon Boot Image format (ZBI). +// +// A Zircon Boot Image consists of a container header followed by boot +// items. Each boot item has a header (zbi_header_t) and then a payload of +// zbi_header_t.length bytes, which can be any size. The zbi_header_t.type +// field indicates how to interpret the payload. Many types specify an +// additional type-specific header that begins a variable-sized payload. +// zbi_header_t.length does not include the zbi_header_t itself, but does +// include any type-specific headers as part of the payload. All fields in +// all header formats are little-endian. +// +// Padding bytes appear after each item as needed to align the payload size +// up to a ZBI_ALIGNMENT (8-byte) boundary. This padding is not reflected +// in the zbi_header_t.length value. +// +// A "complete" ZBI can be booted by a Zircon-compatible boot loader. +// It contains one ZBI_TYPE_KERNEL_{ARCH} boot item that must come first, +// followed by any number of additional boot items, which must include +// exactly one ZBI_TYPE_STORAGE_BOOTFS item. +// +// A partial ZBI cannot be booted, and is only used during the build process. +// It contains one or more boot items and can be combined with other ZBIs to +// make a complete ZBI. + +// All items begin at an 8-byte aligned offset into the image. +#ifdef __ASSEMBLER__ +#define ZBI_ALIGNMENT (8) +#else +#define ZBI_ALIGNMENT (8u) +#endif + +// Round n up to the next 8 byte boundary +#ifndef __ASSEMBLER__ +#ifdef __cplusplus +constexpr +#endif +static inline uint32_t ZBI_ALIGN(uint32_t n) { + return ((n + ZBI_ALIGNMENT - 1) & -ZBI_ALIGNMENT); +} +#endif + +// LSW of sha256("bootdata") +#define ZBI_CONTAINER_MAGIC (0x868cf7e6) + +// LSW of sha256("bootitem") +#define ZBI_ITEM_MAGIC (0xb5781729) + +// This flag is always required. +#define ZBI_FLAG_VERSION (0x00010000) + +// ZBI items with the CRC32 flag must have a valid crc32. +// Otherwise their crc32 field must contain ZBI_ITEM_NO_CRC32 +#define ZBI_FLAG_CRC32 (0x00020000) + +// Value for zbi_header_t.crc32 when ZBI_FLAG_CRC32 is not set. +#define ZBI_ITEM_NO_CRC32 (0x4a87e8d6) + +#ifndef __ASSEMBLER__ +// Each header must be 8-byte aligned. The length field specifies the +// actual payload length and does not include the size of padding. +typedef struct { + // ZBI_TYPE_* constant, see below. + uint32_t type; + + // Size of the payload immediately following this header. This + // does not include the header itself nor any alignment padding + // after the payload. + uint32_t length; + + // Type-specific extra data. Each type specifies the use of this + // field; see below. When not explicitly specified, it should be zero. + uint32_t extra; + + // Flags for this item. This must always include ZBI_FLAG_VERSION. + // It should contain ZBI_FLAG_CRC32 for any item where it's feasible + // to compute the CRC32 at build time. Other flags are specific to + // each type; see below. + uint32_t flags; + + // For future expansion. Set to 0. + uint32_t reserved0; + uint32_t reserved1; + + // Must be ZBI_ITEM_MAGIC. + uint32_t magic; + + // Must be the CRC32 of payload if ZBI_FLAG_CRC32 is set, + // otherwise must be ZBI_ITEM_NO_CRC32. + uint32_t crc32; +} zbi_header_t; +#endif + +// Be sure to add new types to ZBI_ALL_TYPES. +#define ZBI_ALL_TYPES(macro) \ + macro(ZBI_TYPE_CONTAINER, "CONTAINER", ".bin") \ + macro(ZBI_TYPE_KERNEL_X64, "KERNEL_X64", ".bin") \ + macro(ZBI_TYPE_KERNEL_ARM64, "KERNEL_ARM64", ".bin") \ + macro(ZBI_TYPE_DISCARD, "DISCARD", ".bin") \ + macro(ZBI_TYPE_STORAGE_RAMDISK, "RAMDISK", ".bin") \ + macro(ZBI_TYPE_STORAGE_BOOTFS, "BOOTFS", ".bin") \ + macro(ZBI_TYPE_STORAGE_BOOTFS_FACTORY, "BOOTFS_FACTORY", ".bin") \ + macro(ZBI_TYPE_CMDLINE, "CMDLINE", ".txt") \ + macro(ZBI_TYPE_CRASHLOG, "CRASHLOG", ".bin") \ + macro(ZBI_TYPE_NVRAM, "NVRAM", ".bin") \ + macro(ZBI_TYPE_PLATFORM_ID, "PLATFORM_ID", ".bin") \ + macro(ZBI_TYPE_CPU_CONFIG, "CPU_CONFIG", ".bin") /* Deprecated */ \ + macro(ZBI_TYPE_CPU_TOPOLOGY, "CPU_TOPOLOGY", ".bin") \ + macro(ZBI_TYPE_MEM_CONFIG, "MEM_CONFIG", ".bin") \ + macro(ZBI_TYPE_KERNEL_DRIVER, "KERNEL_DRIVER", ".bin") \ + macro(ZBI_TYPE_ACPI_RSDP, "ACPI_RSDP", ".bin") \ + macro(ZBI_TYPE_SMBIOS, "SMBIOS", ".bin") \ + macro(ZBI_TYPE_EFI_MEMORY_MAP, "EFI_MEMORY_MAP", ".bin") \ + macro(ZBI_TYPE_EFI_SYSTEM_TABLE, "EFI_SYSTEM_TABLE", ".bin") \ + macro(ZBI_TYPE_E820_TABLE, "E820_TABLE", ".bin") \ + macro(ZBI_TYPE_FRAMEBUFFER, "FRAMEBUFFER", ".bin") \ + macro(ZBI_TYPE_DRV_MAC_ADDRESS, "DRV_MAC_ADDRESS", ".bin") \ + macro(ZBI_TYPE_DRV_PARTITION_MAP, "DRV_PARTITION_MAP", ".bin") \ + macro(ZBI_TYPE_DRV_BOARD_PRIVATE, "DRV_BOARD_PRIVATE", ".bin") \ + macro(ZBI_TYPE_DRV_BOARD_INFO, "DRV_BOARD_INFO", ".bin") \ + macro(ZBI_TYPE_IMAGE_ARGS, "IMAGE_ARGS", ".txt") \ + macro(ZBI_TYPE_BOOT_VERSION, "BOOT_VERSION", ".bin") \ + macro(ZBI_TYPE_HW_REBOOT_REASON, "HW_REBOOT_REASON", ".bin") + +// Each ZBI starts with a container header. +// length: Total size of the image after this header. +// This includes all item headers, payloads, and padding. +// It does not include the container header itself. +// Must be a multiple of ZBI_ALIGNMENT. +// extra: Must be ZBI_CONTAINER_MAGIC. +// flags: Must be ZBI_FLAG_VERSION and no other flags. +#define ZBI_TYPE_CONTAINER (0x544f4f42) // BOOT + +// Define a container header in assembly code. The symbol name is defined +// as a local label; use .global symbol to make it global. The length +// argument can use assembly label arithmetic like any immediate operand. +#ifdef __ASSEMBLER__ +#define ZBI_CONTAINER_HEADER(symbol, length) \ + .balign ZBI_ALIGNMENT; \ + symbol: \ + .int ZBI_TYPE_CONTAINER; \ + .int (length); \ + .int ZBI_CONTAINER_MAGIC; \ + .int ZBI_FLAG_VERSION; \ + .int 0; \ + .int 0; \ + .int ZBI_ITEM_MAGIC; \ + .int ZBI_ITEM_NO_CRC32; \ + .size symbol, . - symbol; \ + .type symbol, %object +#else +#define ZBI_CONTAINER_HEADER(length) { \ + ZBI_TYPE_CONTAINER, \ + (length), \ + ZBI_CONTAINER_MAGIC, \ + ZBI_FLAG_VERSION, \ + 0, \ + 0, \ + ZBI_ITEM_MAGIC, \ + ZBI_ITEM_NO_CRC32, \ +} +#endif + + +// The kernel image. In a complete ZBI this item must always be first, +// immediately after the ZBI_TYPE_CONTAINER header. The contiguous memory +// image of the kernel is formed from the ZBI_TYPE_CONTAINER header, the +// ZBI_TYPE_KERNEL_{ARCH} header, and the payload. +// +// The boot loader loads the whole image starting with the container header +// through to the end of the kernel item's payload into contiguous physical +// memory. It then constructs a partial ZBI elsewhere in memory, which has +// a ZBI_TYPE_CONTAINER header of its own followed by all the other items +// that were in the booted ZBI plus other items synthesized by the boot +// loader to describe the machine. This partial ZBI must be placed at an +// address (where the container header is found) that is aligned to the +// machine's page size. The precise protocol for transferring control to +// the kernel's entry point varies by machine. +// +// On all machines, the kernel requires some amount of scratch memory to be +// available immediately after the kernel image at boot. It needs this +// space for early setup work before it has a chance to read any memory-map +// information from the boot loader. The `reserve_memory_size` field tells +// the boot loader how much space after the kernel's load image it must +// leave available for the kernel's use. The boot loader must place its +// constructed ZBI or other reserved areas at least this many bytes after +// the kernel image. +// +// x86-64 +// +// The kernel assumes it was loaded at a fixed physical address of +// 0x100000 (1MB). zbi_kernel_t.entry is the absolute physical address +// of the PC location where the kernel will start. +// TODO(SEC-31): Perhaps this will change?? +// The processor is in 64-bit mode with direct virtual to physical +// mapping covering the physical memory where the kernel and +// bootloader-constructed ZBI were loaded. +// The %rsi register holds the physical address of the +// bootloader-constructed ZBI. +// All other registers are unspecified. +// +// ARM64 +// +// zbi_kernel_t.entry is an offset from the beginning of the image +// (i.e., the ZBI_TYPE_CONTAINER header before the ZBI_TYPE_KERNEL_ARM64 +// header) to the PC location in the image where the kernel will +// start. The processor is in physical address mode at EL1 or +// above. The kernel image and the bootloader-constructed ZBI each +// can be loaded anywhere in physical memory. The x0 register +// holds the physical address of the bootloader-constructed ZBI. +// All other registers are unspecified. +// +#define ZBI_TYPE_KERNEL_PREFIX (0x004e524b) // KRN\0 +#define ZBI_TYPE_KERNEL_MASK (0x00FFFFFF) +#define ZBI_TYPE_KERNEL_X64 (0x4c4e524b) // KRNL +#define ZBI_TYPE_KERNEL_ARM64 (0x384e524b) // KRN8 +#define ZBI_IS_KERNEL_BOOTITEM(x) (((x) & ZBI_TYPE_KERNEL_MASK) == \ + ZBI_TYPE_KERNEL_PREFIX) + +#ifndef __ASSEMBLER__ +typedef struct { + // Entry-point address. The interpretation of this differs by machine. + uint64_t entry; + // Minimum amount (in bytes) of scratch memory that the kernel requires + // immediately after its load image. + uint64_t reserve_memory_size; +} zbi_kernel_t; + +// The whole contiguous image loaded into memory by the boot loader. +typedef struct { + zbi_header_t hdr_file; + zbi_header_t hdr_kernel; + zbi_kernel_t data_kernel; + uint8_t contents[/*hdr_kernel.length - sizeof(zbi_kernel_t)*/]; + // data_kernel.reserve_memory_size bytes in memory are free after contents. +} zircon_kernel_t; +#endif + + +// A discarded item that should just be ignored. This is used for an +// item that was already processed and should be ignored by whatever +// stage is now looking at the ZBI. An earlier stage already "consumed" +// this information, but avoided copying data around to remove it from +// the ZBI item stream. +#define ZBI_TYPE_DISCARD (0x50494b53) // SKIP + + +// ZBI_TYPE_STORAGE_* types represent an image that might otherwise +// appear on some block storage device, i.e. a RAM disk of some sort. +// All zbi_header_t fields have the same meanings for all these types. +// The interpretation of the payload (after possible decompression) is +// indicated by the specific zbi_header_t.type value. +// +// **Note:** The ZBI_TYPE_STORAGE_* types are not a long-term stable ABI. +// - Items of these types are always packed for a specific version of the +// kernel and userland boot services, often in the same build that compiles +// the kernel. +// - These item types are **not** expected to be synthesized or +// examined by boot loaders. +// - New versions of the `zbi` tool will usually retain the ability to +// read old formats and non-default switches to write old formats, for +// diagnostic use. +// +// The zbi_header_t.extra field always gives the exact size of the +// original, uncompressed payload. That equals zbi_header_t.length when +// the payload is not compressed. If ZBI_FLAG_STORAGE_COMPRESSED is set in +// zbi_header_t.flags, then the payload is compressed. +// +// **Note:** Magic-number and header bytes at the start of the compressed +// payload indicate the compression algorithm and parameters. The set of +// compression formats is not a long-term stable ABI. +// - Zircon [userboot](../../../../docs/userboot.md) and core services +// do the decompression. A given kernel build's `userboot` will usually +// only support one particular compression format. +// - The `zbi` tool will usually retain the ability to compress and +// decompress for old formats, and can be used to convert between formats. +#define ZBI_FLAG_STORAGE_COMPRESSED (0x00000001) + +// A virtual disk image. This is meant to be treated as if it were a +// storage device. The payload (after decompression) is the contents of +// the storage device, in whatever format that might be. +#define ZBI_TYPE_STORAGE_RAMDISK (0x4b534452) // RDSK + +// The /boot filesystem in BOOTFS format, specified in <zircon/boot/bootfs.h>. +// A complete ZBI must have exactly one ZBI_TYPE_STORAGE_BOOTFS item. +// Zircon [userboot](../../../../docs/userboot.md) handles the contents +// of this filesystem. +#define ZBI_TYPE_STORAGE_BOOTFS (0x42534642) // BFSB + +// Device-specific factory data, stored in BOOTFS format, specified below. +#define ZBI_TYPE_STORAGE_BOOTFS_FACTORY (0x46534642) // BFSF + +// The remaining types are used to communicate information from the boot +// loader to the kernel. Usually these are synthesized in memory by the +// boot loader, but they can also be included in a ZBI along with the +// kernel and BOOTFS. Some boot loaders may set the zbi_header_t flags +// and crc32 fields to zero, though setting them to ZBI_FLAG_VERSION and +// ZBI_ITEM_NO_CRC32 is specified. The kernel doesn't check. + + +// A kernel command line fragment, a NUL-terminated UTF-8 string. +// Multiple ZBI_TYPE_CMDLINE items can appear. They are treated as if +// concatenated with ' ' between each item, in the order they appear: +// first items in the complete ZBI containing the kernel; then items in +// the ZBI synthesized by the boot loader. The kernel interprets the +// [whole command line](../../../../docs/kernel_cmdline.md). +#define ZBI_TYPE_CMDLINE (0x4c444d43) // CMDL + +// The crash log from the previous boot, a UTF-8 string. +#define ZBI_TYPE_CRASHLOG (0x4d4f4f42) // BOOM + +// Physical memory region that will persist across warm boots. +// zbi_nvram_t gives the physical base address and length in bytes. +#define ZBI_TYPE_NVRAM (0x4c4c564e) // NVLL +// This reflects a typo we need to support for a while. +#define ZBI_TYPE_NVRAM_DEPRECATED (0x4c4c5643) // CVLL +#ifndef __ASSEMBLER__ +typedef struct { + uint64_t base; + uint64_t length; +} zbi_nvram_t; +#endif + +#define ZBI_BOARD_NAME_LEN 32 + +// Platform ID Information. +#define ZBI_TYPE_PLATFORM_ID (0x44494C50) // PLID +#ifndef __ASSEMBLER__ +typedef struct { + uint32_t vid; + uint32_t pid; + char board_name[ZBI_BOARD_NAME_LEN]; +} zbi_platform_id_t; +#endif + +#define ZBI_TYPE_DRV_BOARD_INFO (0x4953426D) // mBSI +// Board-specific information. +#ifndef __ASSEMBLER__ +typedef struct { + uint32_t revision; +} zbi_board_info_t; +#endif + +// CPU configuration, a zbi_cpu_config_t header followed by one or more +// zbi_cpu_cluster_t entries. zbi_header_t.length must equal +// zbi_cpu_config_t.cluster_count * sizeof(zbi_cpu_cluster_t). +#define ZBI_TYPE_CPU_CONFIG (0x43555043) // CPUC +#ifndef __ASSEMBLER__ +typedef struct { + // Number of CPU cores in the cluster. + uint32_t cpu_count; + + // Reserved for future use. Set to 0. + uint32_t type; + uint32_t flags; + uint32_t reserved; +} zbi_cpu_cluster_t; + +typedef struct { + // Number of zbi_cpu_cluster_t entries following this header. + uint32_t cluster_count; + + // Reserved for future use. Set to 0. + uint32_t reserved[3]; + + // cluster_count entries follow. + zbi_cpu_cluster_t clusters[]; +} zbi_cpu_config_t; +#endif + +#define ZBI_TYPE_CPU_TOPOLOGY (0x544F504F) // TOPO + +#ifndef __ASSEMBLER__ + +#define ZBI_MAX_SMT 4 + +// These are Used in the flags field of zbi_topology_processor_t. + +// This is the processor that boots the system and the last to be shutdown. +#define ZBI_TOPOLOGY_PROCESSOR_PRIMARY 0b1 + +// This is the processor that handles all interrupts, some architectures will +// not have one. +#define ZBI_TOPOLOGY_PROCESSOR_INTERRUPT 0b10 + +#define ZBI_TOPOLOGY_NO_PARENT 0xFFFF + +typedef enum { + ZBI_TOPOLOGY_ARCH_UNDEFINED = 0, // Intended primarily for testing. + ZBI_TOPOLOGY_ARCH_X86 = 1, + ZBI_TOPOLOGY_ARCH_ARM = 2, +} zbi_topology_architecture_t; + +typedef struct { + // Cluster ids for each level, one being closest to the cpu. + // These map to aff1, aff2, and aff3 values in the ARM registers. + uint8_t cluster_1_id; + uint8_t cluster_2_id; + uint8_t cluster_3_id; + + // Id of the cpu inside of the bottom-most cluster, aff0 value. + uint8_t cpu_id; + + // The GIC interface number for this processor. + // In GIC v3+ this is not necessary as the processors are addressed by their + // affinity routing (all cluster ids followed by cpu_id). + uint8_t gic_id; +} zbi_topology_arm_info_t; + +typedef struct { + // Indexes here correspond to the logical_ids index for the thread. + uint32_t apic_ids[ZBI_MAX_SMT]; + uint32_t apic_id_count; +} zbi_topology_x86_info_t; + +typedef struct { + uint16_t logical_ids[ZBI_MAX_SMT]; + uint8_t logical_id_count; + + uint16_t flags; + + // Should be one of zbi_topology_arm_info_t. + // If UNDEFINED then nothing will be set in arch_info. + uint8_t architecture; + union { + zbi_topology_arm_info_t arm; + zbi_topology_x86_info_t x86; + } architecture_info; + +} zbi_topology_processor_t; + +typedef struct { + // Relative performance level of this processor in the system, with 0 + // representing the lowest performance. + // For example on a two cluster ARM big.LITTLE system 0 would be the little + // cores and 1 would represent the big cores. + uint8_t performance_class; +} zbi_topology_cluster_t; + +typedef struct { + // Starting and ending memory addresses of this numa region. + uint64_t start_address; + uint64_t end_address; +} zbi_topology_numa_region_t; + +typedef enum { + ZBI_TOPOLOGY_ENTITY_UNDEFINED = 0, // Unused default. + ZBI_TOPOLOGY_ENTITY_PROCESSOR = 1, + ZBI_TOPOLOGY_ENTITY_CLUSTER = 2, + ZBI_TOPOLOGY_ENTITY_CACHE = 3, + ZBI_TOPOLOGY_ENTITY_DIE = 4, + ZBI_TOPOLOGY_ENTITY_SOCKET = 5, + ZBI_TOPOLOGY_ENTITY_POWER_PLANE = 6, + ZBI_TOPOLOGY_ENTITY_NUMA_REGION = 7, +} zbi_topology_entity_type_t; + +typedef struct { + // Should be one of zbi_topology_entity_type_t. + uint8_t entity_type; + uint16_t parent_index; + union { + zbi_topology_processor_t processor; + zbi_topology_cluster_t cluster; + zbi_topology_numa_region_t numa_region; + } entity; +} zbi_topology_node_t; + +#endif + +// Memory configuration, one or more zbi_mem_range_t entries. +// zbi_header_t.length is sizeof(zbi_mem_range_t) times the number of entries. +#define ZBI_TYPE_MEM_CONFIG (0x434D454D) // MEMC +#ifndef __ASSEMBLER__ +typedef struct { + uint64_t paddr; + uint64_t length; + uint32_t type; + uint32_t reserved; +} zbi_mem_range_t; +#endif +#define ZBI_MEM_RANGE_RAM (1) +#define ZBI_MEM_RANGE_PERIPHERAL (2) +#define ZBI_MEM_RANGE_RESERVED (3) + +// Kernel driver configuration. The zbi_header_t.extra field gives a +// KDRV_* type that determines the payload format. +// See [driver-config.h](<zircon/boot/driver-config.h>) for details. +#define ZBI_TYPE_KERNEL_DRIVER (0x5652444B) // KDRV + +// ACPI Root Table Pointer, a uint64_t physical address. +#define ZBI_TYPE_ACPI_RSDP (0x50445352) // RSDP + +// SMBIOS entry point, a uint64_t physical address. +#define ZBI_TYPE_SMBIOS (0x49424d53) // SMBI + +// EFI memory map, a uint64_t entry size followed by a sequence of +// EFI memory descriptors aligned on that entry size. +#define ZBI_TYPE_EFI_MEMORY_MAP (0x4d494645) // EFIM + +// EFI system table, a uint64_t physical address. +#define ZBI_TYPE_EFI_SYSTEM_TABLE (0x53494645) // EFIS + +// E820 memory table, an array of e820entry_t. +#define ZBI_TYPE_E820_TABLE (0x30323845) // E820 + +/* EFI Variable for Crash Log */ +#define ZIRCON_VENDOR_GUID \ + {0x82305eb2, 0xd39e, 0x4575, {0xa0, 0xc8, 0x6c, 0x20, 0x72, 0xd0, 0x84, 0x4c}} +#define ZIRCON_CRASHLOG_EFIVAR \ + { 'c', 'r', 'a', 's', 'h', 'l', 'o', 'g', 0 } +#define ZIRCON_CRASHLOG_EFIATTR \ + (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) + +// Framebuffer parameters, a zbi_swfb_t entry. +#define ZBI_TYPE_FRAMEBUFFER (0x42465753) // SWFB + +// The image arguments, data is a trivial text format of one "key=value" per line +// with leading whitespace stripped and "#" comment lines and blank lines ignored. +// It is processed by bootsvc and parsed args are shared to others via Arguments service. +// TODO: the format can be streamlined after the /config/devmgr compat support is removed. +#define ZBI_TYPE_IMAGE_ARGS (0x47524149) // IARG + +// A copy of the boot version stored within the sysconfig +// partition +#define ZBI_TYPE_BOOT_VERSION (0x53525642) // BVRS + +#ifndef __ASSEMBLER__ +typedef struct { + // Physical memory address. + uint64_t base; + + // Pixel layout and format. + // See [../pixelformat.h](<zircon/pixelformat.h>). + uint32_t width; + uint32_t height; + uint32_t stride; + uint32_t format; +} zbi_swfb_t; +#endif + + +// ZBI_TYPE_DRV_* types (LSB is 'm') contain driver metadata. +#define ZBI_TYPE_DRV_METADATA(type) (((type) & 0xFF) == 0x6D) // 'm' + +// MAC address for Ethernet, Wifi, Bluetooth, etc. zbi_header_t.extra +// is a board-specific index to specify which device the MAC address +// applies to. zbi_header_t.length gives the size in bytes, which +// varies depending on the type of address appropriate for the device. +#define ZBI_TYPE_DRV_MAC_ADDRESS (0x43414D6D) // mMAC + +// A partition map for a storage device, a zbi_partition_map_t header +// followed by one or more zbi_partition_t entries. zbi_header_t.extra +// is a board-specific index to specify which device this applies to. +#define ZBI_TYPE_DRV_PARTITION_MAP (0x5452506D) // mPRT +#define ZBI_PARTITION_NAME_LEN (32) +#define ZBI_PARTITION_GUID_LEN (16) + +// Private information for the board driver. +#define ZBI_TYPE_DRV_BOARD_PRIVATE (0x524F426D) // mBOR + +#ifndef __ASSEMBLER__ +typedef struct { + // GUID specifying the format and use of data stored in the partition. + uint8_t type_guid[ZBI_PARTITION_GUID_LEN]; + + // GUID unique to this partition. + uint8_t uniq_guid[ZBI_PARTITION_GUID_LEN]; + + // First and last block occupied by this partition. + uint64_t first_block; + uint64_t last_block; + + // Reserved for future use. Set to 0. + uint64_t flags; + + char name[ZBI_PARTITION_NAME_LEN]; +} zbi_partition_t; + +typedef struct { + // Total blocks used on the device. + uint64_t block_count; + // Size of each block in bytes. + uint64_t block_size; + + // Number of partitions in the map. + uint32_t partition_count; + + // Reserved for future use. + uint32_t reserved; + + // Device GUID. + uint8_t guid[ZBI_PARTITION_GUID_LEN]; + + // partition_count partition entries follow. + zbi_partition_t partitions[]; +} zbi_partition_map_t; +#endif + + +#define ZBI_TYPE_HW_REBOOT_REASON (0x42525748) // HWRB + +#define ZBI_HW_REBOOT_UNDEFINED ((uint32_t)0) +#define ZBI_HW_REBOOT_COLD ((uint32_t)1) +#define ZBI_HW_REBOOT_WARM ((uint32_t)2) +#define ZBI_HW_REBOOT_BROWNOUT ((uint32_t)3) +#define ZBI_HW_REBOOT_WATCHDOG ((uint32_t)4) + +#ifndef __ASSEMBLER__ +#ifndef __cplusplus +typedef uint32_t zbi_hw_reboot_reason_t; +#else +enum class ZbiHwRebootReason : uint32_t { + Undefined = ZBI_HW_REBOOT_UNDEFINED, + Cold = ZBI_HW_REBOOT_COLD, + Warm = ZBI_HW_REBOOT_WARM, + Brownout = ZBI_HW_REBOOT_BROWNOUT, + Watchdog = ZBI_HW_REBOOT_WATCHDOG, +}; +using zbi_hw_reboot_reason_t = ZbiHwRebootReason; +#endif // __cplusplus +#endif // __ASSEMBLER__ + +#endif // SYSROOT_ZIRCON_BOOT_IMAGE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/multiboot.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/multiboot.h new file mode 100644 index 0000000..85cf0a6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/multiboot.h
@@ -0,0 +1,114 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright (c) 2009 Corey Tabaka + +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_MULTIBOOT_H_ +#define SYSROOT_ZIRCON_MULTIBOOT_H_ + +/* magic number for multiboot header */ +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 + +// Flags for multiboot header: +// 0x00000002: Boot loader should provide memory map. +// 0x00010000: *_addr fields in multiboot_header_t are used. +#define MULTIBOOT_HEADER_FLAGS 0x00010002 + +/* magic number passed by multiboot-compliant boot loaders */ +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 + +#ifndef __ASSEMBLER__ + +#include <stdint.h> + +/* multiboot header */ +typedef struct multiboot_header { + uint32_t magic; + uint32_t flags; + uint32_t checksum; + uint32_t header_addr; + uint32_t load_addr; + uint32_t load_end_addr; + uint32_t bss_end_addr; + uint32_t entry_addr; +} multiboot_header_t; + +/* symbol table for a.out */ +typedef struct aout_symbol_table { + uint32_t tabsize; + uint32_t strsize; + uint32_t addr; + uint32_t reserved; +} aout_symbol_table_t; + +/* section header table for ELF */ +typedef struct elf_section_header_table { + uint32_t num; + uint32_t size; + uint32_t addr; + uint32_t shndx; +} elf_section_header_table_t; + +/* multiboot info */ +typedef struct multiboot_info { + uint32_t flags; + uint32_t mem_lower; + uint32_t mem_upper; + uint32_t boot_device; + uint32_t cmdline; + uint32_t mods_count; + uint32_t mods_addr; + union { + aout_symbol_table_t aout_sym; + elf_section_header_table_t elf_sec; + } u; + uint32_t mmap_length; + uint32_t mmap_addr; + uint32_t drives_length; + uint32_t drives_addr; + uint32_t config_table; + uint32_t boot_loader_name; + uint32_t apm_table; +} multiboot_info_t; + +#define MB_INFO_MEM_SIZE 0x001 +#define MB_INFO_BOOT_DEV 0x002 +#define MB_INFO_CMD_LINE 0x004 +#define MB_INFO_MODS 0x008 +#define MB_INFO_SYMS 0x010 +#define MB_INFO_SHDR 0x020 +#define MB_INFO_MMAP 0x040 +#define MB_INFO_DRIVES 0x080 +#define MB_INFO_CONFIG 0x100 +#define MB_INFO_BOOT_LOADER 0x200 +#define MB_INFO_APM_TABLE 0x400 +#define MB_INFO_VBE 0x800 + +/* module structure */ +typedef struct module { + uint32_t mod_start; + uint32_t mod_end; + uint32_t string; + uint32_t reserved; +} module_t; + +/* memory map - be careful that the offset 0 is base_addr_low without size */ +typedef struct memory_map { + uint32_t size; + uint32_t base_addr_low; + uint32_t base_addr_high; + uint32_t length_low; + uint32_t length_high; + uint32_t type; +} memory_map_t; + +/* memory map entry types */ +#define MB_MMAP_TYPE_AVAILABLE 0x01 +#define MB_MMAP_TYPE_RESERVED 0x02 +#define MB_MMAP_TYPE_ACPI_RECLAIM 0x03 +#define MB_MMAP_TYPE_ACPI_NVS 0x04 + +#endif + +#endif // SYSROOT_ZIRCON_BOOT_MULTIBOOT_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/netboot.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/netboot.h new file mode 100644 index 0000000..edbfd53 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/netboot.h
@@ -0,0 +1,150 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_NETBOOT_H_ +#define SYSROOT_ZIRCON_BOOT_NETBOOT_H_ + +#include <stddef.h> +#include <stdint.h> +#include <zircon/types.h> + +// clang-format off + +#define BOOTLOADER_VERSION "0.7.22" + +#define NB_MAGIC 0xAA774217 +#define NB_DEBUGLOG_MAGIC 0xAEAE1123 + +#define NB_SERVER_PORT 33330 +#define NB_ADVERT_PORT 33331 +#define NB_CMD_PORT_START 33332 +#define NB_CMD_PORT_END 33339 +#define NB_TFTP_OUTGOING_PORT 33340 +#define NB_TFTP_INCOMING_PORT 33341 + + +#define NB_COMMAND 1 // arg=0, data=command +#define NB_SEND_FILE 2 // arg=size, data=filename +#define NB_DATA 3 // arg=offset, data=data +#define NB_BOOT 4 // arg=0 +#define NB_QUERY 5 // arg=0, data=hostname (or "*") +#define NB_SHELL_CMD 6 // arg=0, data=command string +#define NB_OPEN 7 // arg=O_RDONLY|O_WRONLY, data=filename +#define NB_READ 8 // arg=blocknum +#define NB_WRITE 9 // arg=blocknum, data=data +#define NB_CLOSE 10 // arg=0 +#define NB_LAST_DATA 11 // arg=offset, data=data +#define NB_REBOOT 12 // arg=0 +#define NB_GET_ADVERT 13 // arg=0 + +#define NB_ACK 0 // arg=0 or -err, NB_READ: data=data +#define NB_FILE_RECEIVED 0x70000001 // arg=size + +#define NB_ADVERTISE 0x77777777 + +#define NB_ERROR 0x80000000 +#define NB_ERROR_BAD_CMD 0x80000001 +#define NB_ERROR_BAD_PARAM 0x80000002 +#define NB_ERROR_TOO_LARGE 0x80000003 +#define NB_ERROR_BAD_FILE 0x80000004 + +#define NB_VERSION_1_0 0x0001000 +#define NB_VERSION_1_1 0x0001010 +#define NB_VERSION_1_2 0x0001020 +#define NB_VERSION_1_3 0x0001030 +#define NB_VERSION_CURRENT NB_VERSION_1_3 + +#define NB_FILENAME_PREFIX "<<netboot>>" +#define NB_KERNEL_FILENAME NB_FILENAME_PREFIX "kernel.bin" +#define NB_RAMDISK_FILENAME NB_FILENAME_PREFIX "ramdisk.bin" +#define NB_CMDLINE_FILENAME NB_FILENAME_PREFIX "cmdline" + +#define NB_IMAGE_PREFIX "<<image>>" +#define NB_FVM_HOST_FILENAME "sparse.fvm" +#define NB_FVM_FILENAME NB_IMAGE_PREFIX NB_FVM_HOST_FILENAME +#define NB_BOOTLOADER_HOST_FILENAME "bootloader.img" +#define NB_BOOTLOADER_FILENAME NB_IMAGE_PREFIX NB_BOOTLOADER_HOST_FILENAME +// Firmware images are slightly different, as they have an optional type suffix: +// firmware_ <- type = "" (the default) +// firmware_foo <- type = "foo" +#define NB_FIRMWARE_HOST_FILENAME_PREFIX "firmware_" +#define NB_FIRMWARE_FILENAME_PREFIX NB_IMAGE_PREFIX NB_FIRMWARE_HOST_FILENAME_PREFIX +#define NB_ZIRCONA_HOST_FILENAME "zircona.img" +#define NB_ZIRCONA_FILENAME NB_IMAGE_PREFIX NB_ZIRCONA_HOST_FILENAME +#define NB_ZIRCONB_HOST_FILENAME "zirconb.img" +#define NB_ZIRCONB_FILENAME NB_IMAGE_PREFIX NB_ZIRCONB_HOST_FILENAME +#define NB_ZIRCONR_HOST_FILENAME "zirconr.img" +#define NB_ZIRCONR_FILENAME NB_IMAGE_PREFIX NB_ZIRCONR_HOST_FILENAME +#define NB_VBMETAA_HOST_FILENAME "vbmetaa.img" +#define NB_VBMETAA_FILENAME NB_IMAGE_PREFIX NB_VBMETAA_HOST_FILENAME +#define NB_VBMETAB_HOST_FILENAME "vbmetab.img" +#define NB_VBMETAB_FILENAME NB_IMAGE_PREFIX NB_VBMETAB_HOST_FILENAME +#define NB_VBMETAR_HOST_FILENAME "vbmetar.img" +#define NB_VBMETAR_FILENAME NB_IMAGE_PREFIX NB_VBMETAR_HOST_FILENAME +#define NB_SSHAUTH_HOST_FILENAME "authorized_keys" +#define NB_SSHAUTH_FILENAME NB_IMAGE_PREFIX NB_SSHAUTH_HOST_FILENAME +#define NB_BOARD_NAME_HOST_FILENAME "board_name" +#define NB_BOARD_NAME_FILENAME NB_IMAGE_PREFIX NB_BOARD_NAME_HOST_FILENAME +#define NB_BOARD_REVISION_HOST_FILENAME "board_revision" +#define NB_BOARD_REVISION_FILENAME NB_IMAGE_PREFIX NB_BOARD_REVISION_HOST_FILENAME +#define NB_BOARD_INFO_HOST_FILENAME "board_info" +#define NB_BOARD_INFO_FILENAME NB_IMAGE_PREFIX NB_BOARD_INFO_HOST_FILENAME +#define NB_INIT_PARTITION_TABLES_HOST_FILENAME "init_partition_tables" +#define NB_INIT_PARTITION_TABLES_FILENAME NB_IMAGE_PREFIX NB_INIT_PARTITION_TABLES_HOST_FILENAME +#define NB_WIPE_PARTITION_TABLES_HOST_FILENAME "wipe_partition_tables" +#define NB_WIPE_PARTITION_TABLES_FILENAME NB_IMAGE_PREFIX NB_WIPE_PARTITION_TABLES_HOST_FILENAME + +// Should match paver FIDL definition. +// Length does not include the '\0' terminator, so when allocating a character +// buffer to hold the type use (NB_FIRMWARE_TYPE_MAX_LENGTH + 1). +#define NB_FIRMWARE_TYPE_MAX_LENGTH 256 + +typedef struct board_info { + char board_name[ZX_MAX_NAME_LEN]; + uint32_t board_revision; + uint8_t mac_address[8]; +} board_info_t; + +typedef struct modify_partition_table_info { + // Path of block device to initialize or wipe. + char block_device_path[ZX_MAX_NAME_LEN + 1]; +} modify_partition_table_info_t; + +typedef struct nbmsg_t { + uint32_t magic; + uint32_t cookie; + uint32_t cmd; + uint32_t arg; + uint8_t data[0]; +} nbmsg; + +typedef struct nbfile_t { + uint8_t* data; + size_t size; // max size of buffer + size_t offset; // write pointer +} nbfile; + +int netboot_init(const char* nodename); +const char* netboot_nodename(void); +int netboot_poll(void); +void netboot_close(void); + +// Ask for a buffer suitable to put the file /name/ in +// Return NULL to indicate /name/ is not wanted. +nbfile* netboot_get_buffer(const char* name, size_t size); + +#define DEBUGLOG_PORT 33337 +#define DEBUGLOG_ACK_PORT 33338 + +#define MAX_LOG_DATA 1216 +#define MAX_NODENAME_LENGTH 64 + +typedef struct logpacket { + uint32_t magic; + uint32_t seqno; + char nodename[MAX_NODENAME_LENGTH]; + char data[MAX_LOG_DATA]; +} logpacket_t; + +#endif // SYSROOT_ZIRCON_BOOT_NETBOOT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/sysconfig.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/sysconfig.h new file mode 100644 index 0000000..1f7d49b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/boot/sysconfig.h
@@ -0,0 +1,29 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_BOOT_SYSCONFIG_H_ +#define SYSROOT_ZIRCON_BOOT_SYSCONFIG_H_ + +// Zircon sysconfig partition format +// +// The sysconfig partition consists of four kvstore sections, each 32K in size. +// The sections are: +// +// version-a: System configuration used when booting from Zircon-A. +// +// version-b: System configuration used when booting from Zircon-B. +// +// boot-default: Default bootloader configuration. +// +// boot-oneshot: Bootloader configuration for one-time use. +// If present, this overrides boot-default, and the bootloader +// deletes this section after use. + +#define ZX_SYSCONFIG_KVSTORE_SIZE 32768 +#define ZX_SYSCONFIG_VERSION_A_OFFSET (0 * ZX_SYSCONFIG_KVSTORE_SIZE) +#define ZX_SYSCONFIG_VERSION_B_OFFSET (1 * ZX_SYSCONFIG_KVSTORE_SIZE) +#define ZX_SYSCONFIG_BOOT_DEFAULT_OFFSET (2 * ZX_SYSCONFIG_KVSTORE_SIZE) +#define ZX_SYSCONFIG_BOOT_ONESHOT_OFFSET (3 * ZX_SYSCONFIG_KVSTORE_SIZE) + +#endif // SYSROOT_ZIRCON_BOOT_SYSCONFIG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/compiler.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/compiler.h new file mode 100644 index 0000000..ce2bcea --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/compiler.h
@@ -0,0 +1,191 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_COMPILER_H_ +#define SYSROOT_ZIRCON_COMPILER_H_ + +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + +#ifndef __has_cpp_attribute +#define __has_cpp_attribute(x) 0 +#endif + +#ifndef __ASSEMBLER__ + +#if !defined(__GNUC__) && !defined(__clang__) +#error "Unrecognized compiler!" +#endif + +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#define __UNUSED __attribute__((__unused__)) +#define __USED __attribute__((__used__)) +#define __PACKED __attribute__((packed)) +#define __ALIGNED(x) __attribute__((aligned(x))) +#define __PRINTFLIKE(__fmt, __varargs) __attribute__((__format__(__printf__, __fmt, __varargs))) +#define __SCANFLIKE(__fmt, __varargs) __attribute__((__format__(__scanf__, __fmt, __varargs))) +#define __SECTION(x) __attribute__((__section__(x))) +#define __PURE __attribute__((__pure__)) +#define __CONST __attribute__((__const__)) +#define __NO_RETURN __attribute__((__noreturn__)) +#define __MALLOC __attribute__((__malloc__)) +#define __WEAK __attribute__((__weak__)) +#define __GNU_INLINE __attribute__((__gnu_inline__)) +#define __GET_CALLER(x) __builtin_return_address(0) +#define __GET_FRAME(x) __builtin_frame_address(0) +#define __NAKED __attribute__((__naked__)) +#define __ISCONSTANT(x) __builtin_constant_p(x) +#define __NO_INLINE __attribute__((__noinline__)) +#define __SRAM __NO_INLINE __SECTION(".sram.text") +#define __CONSTRUCTOR __attribute__((__constructor__)) +#define __DESTRUCTOR __attribute__((__destructor__)) +#define __RESTRICT __restrict + +#ifndef __clang__ +#define __LEAF_FN __attribute__((__leaf__)) +#define __OPTIMIZE(x) __attribute__((__optimize__(x))) +#define __EXTERNALLY_VISIBLE __attribute__((__externally_visible__)) +#define __NO_SAFESTACK +#define __THREAD_ANNOTATION(x) +#else +#define __LEAF_FN +#define __OPTIMIZE(x) +#define __EXTERNALLY_VISIBLE +// The thread safety annotations are frequently used with C++ standard library +// types in userspace, so only enable the annotations if we know that the C++ +// standard library types are annotated or if we're in kernel code. +#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) || defined(_KERNEL) +#define __THREAD_ANNOTATION(x) __attribute__((x)) +#else +#define __THREAD_ANNOTATION(x) +#endif // _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS +#define __NO_SAFESTACK __attribute__((__no_sanitize__("safe-stack", "shadow-call-stack"))) +#endif + +#define __ALWAYS_INLINE __attribute__((__always_inline__)) +#define __MAY_ALIAS __attribute__((__may_alias__)) +#define __NONNULL(x) __attribute__((__nonnull__ x)) +#define __WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) +#define __UNREACHABLE __builtin_unreachable() +#define __WEAK_ALIAS(x) __attribute__((__weak__, __alias__(x))) +#define __ALIAS(x) __attribute__((__alias__(x))) +#define __EXPORT __attribute__((__visibility__("default"))) +#define __LOCAL __attribute__((__visibility__("hidden"))) +#define __THREAD __thread +#define __offsetof(type, field) __builtin_offsetof(type, field) + +// Only define __NO_UNIQUE_ADDRESS for C++, since it doesn't make sense in C. +#ifdef __cplusplus +#if __has_cpp_attribute(no_unique_address) +#define __NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +#define __NO_UNIQUE_ADDRESS +#endif +#endif // ifdef __cplusplus + +#if defined(__cplusplus) && __cplusplus >= 201703L +#define __FALLTHROUGH [[fallthrough]] +#elif defined(__cplusplus) && defined(__clang__) +#define __FALLTHROUGH [[clang::fallthrough]] +// The GNU style attribute is supported by Clang for C code, but __GNUC__ for +// clang right now is 4. +#elif __GNUC__ >= 7 || (!defined(__cplusplus) && defined(__clang__)) +#define __FALLTHROUGH __attribute__((__fallthrough__)) +#else +#define __FALLTHROUGH \ + do { \ + } while (0) +#endif + +// C++17 onwards supports [[nodiscard]] on a constructor, warning if +// a temporary object is created without a name. Such objects would be +// immediately destroyed again, while the user's expectation might be +// that it would last the scope. +// +// We could ideally just use [[nodiscard]] (or __WARN_UNUSED_RESULT) +// directly, except GCC < 10.0 has a bug preventing it from being used +// on constructors. __WARN_UNUSED_CONSTRUCTOR allows us to tag +// constructors in supported compilers, and is simply ignored in older +// compilers. +#if defined(__cplusplus) +// Clang and GCC versions >= 10.0 support [[nodiscard]] on constructors. +#if __cplusplus >= 201703L && (defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 10))) +#define __WARN_UNUSED_CONSTRUCTOR [[nodiscard]] +#else +#define __WARN_UNUSED_CONSTRUCTOR +#endif +#endif + +// Publicly exposed thread annotation macros. These have a long and ugly name to +// minimize the chance of collision with consumers of Zircon's public headers. +#define __TA_CAPABILITY(x) __THREAD_ANNOTATION(__capability__(x)) +#define __TA_GUARDED(x) __THREAD_ANNOTATION(__guarded_by__(x)) +#define __TA_ACQUIRE(...) __THREAD_ANNOTATION(__acquire_capability__(__VA_ARGS__)) +#define __TA_ACQUIRE_SHARED(...) __THREAD_ANNOTATION(__acquire_shared_capability__(__VA_ARGS__)) +#define __TA_TRY_ACQUIRE(...) __THREAD_ANNOTATION(__try_acquire_capability__(__VA_ARGS__)) +#define __TA_ACQUIRED_BEFORE(...) __THREAD_ANNOTATION(__acquired_before__(__VA_ARGS__)) +#define __TA_ACQUIRED_AFTER(...) __THREAD_ANNOTATION(__acquired_after__(__VA_ARGS__)) +#define __TA_RELEASE(...) __THREAD_ANNOTATION(__release_capability__(__VA_ARGS__)) +#define __TA_RELEASE_SHARED(...) __THREAD_ANNOTATION(__release_shared_capability__(__VA_ARGS__)) +#define __TA_REQUIRES(...) __THREAD_ANNOTATION(__requires_capability__(__VA_ARGS__)) +#define __TA_REQUIRES_SHARED(...) __THREAD_ANNOTATION(__requires_shared_capability__(__VA_ARGS__)) +#define __TA_EXCLUDES(...) __THREAD_ANNOTATION(__locks_excluded__(__VA_ARGS__)) +#define __TA_ASSERT(...) __THREAD_ANNOTATION(__assert_capability__(__VA_ARGS__)) +#define __TA_ASSERT_SHARED(...) __THREAD_ANNOTATION(__assert_shared_capability__(__VA_ARGS__)) +#define __TA_RETURN_CAPABILITY(x) __THREAD_ANNOTATION(__lock_returned__(x)) +#define __TA_SCOPED_CAPABILITY __THREAD_ANNOTATION(__scoped_lockable__) +#define __TA_NO_THREAD_SAFETY_ANALYSIS __THREAD_ANNOTATION(__no_thread_safety_analysis__) + +#endif // ifndef __ASSEMBLER__ + +#if !defined(__DEPRECATE) +#define __DEPRECATE __attribute__((__deprecated__)) +#endif + +/* TODO: add type check */ +#if !defined(countof) +#define countof(a) (sizeof(a) / sizeof((a)[0])) +#endif + +/* CPP header guards */ +#ifdef __cplusplus +#define __BEGIN_CDECLS extern "C" { +#define __END_CDECLS } +#else +#define __BEGIN_CDECLS +#define __END_CDECLS +#endif + +// constexpr annotation for use in static inlines usable in both C and C++ +#ifdef __cplusplus +#define __CONSTEXPR constexpr +#else +#define __CONSTEXPR +#endif + +#define add_overflow(a, b, c) __builtin_add_overflow(a, b, c) +#define sub_overflow(a, b, c) __builtin_sub_overflow(a, b, c) +#define mul_overflow(a, b, c) __builtin_mul_overflow(a, b, c) + +// A workaround to help static analyzer identify assertion failures +#if defined(__clang__) +#define __ANALYZER_CREATE_SINK __attribute__((analyzer_noreturn)) +#else +#define __ANALYZER_CREATE_SINK // no-op +#endif + +// Lifetime analysis +#ifndef __OWNER +#ifdef __clang__ +#define __OWNER(x) [[gsl::Owner(x)]] +#define __POINTER(x) [[gsl::Pointer(x)]] +#else +#define __OWNER(x) +#define __POINTER(x) +#endif +#endif + +#endif // SYSROOT_ZIRCON_COMPILER_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/device/audio.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/device/audio.h new file mode 100644 index 0000000..47da2d2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/device/audio.h
@@ -0,0 +1,460 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_DEVICE_AUDIO_H_ +#define SYSROOT_ZIRCON_DEVICE_AUDIO_H_ + +#include <sys/types.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +#include <cassert> +#include <cstdio> + +// When communicating with an Audio driver using zx_channel_call, do not use +// the AUDIO_INVALID_TRANSACTION_ID as your message's transaction ID. It is +// reserved for async notifications sent from the driver to the application. +#define AUDIO_INVALID_TRANSACTION_ID ((zx_txid_t)0) + +__BEGIN_CDECLS + +typedef uint32_t audio_cmd_t; + +// Commands sent on the stream channel +#define AUDIO_STREAM_CMD_GET_FORMATS ((audio_cmd_t)0x1000) +#define AUDIO_STREAM_CMD_SET_FORMAT ((audio_cmd_t)0x1001) +#define AUDIO_STREAM_CMD_GET_GAIN ((audio_cmd_t)0x1002) +#define AUDIO_STREAM_CMD_SET_GAIN ((audio_cmd_t)0x1003) +#define AUDIO_STREAM_CMD_PLUG_DETECT ((audio_cmd_t)0x1004) +#define AUDIO_STREAM_CMD_GET_UNIQUE_ID ((audio_cmd_t)0x1005) +#define AUDIO_STREAM_CMD_GET_STRING ((audio_cmd_t)0x1006) +#define AUDIO_STREAM_CMD_GET_CLOCK_DOMAIN ((audio_cmd_t)0x1007) + +// Async notifications sent on the stream channel. +#define AUDIO_STREAM_PLUG_DETECT_NOTIFY ((audio_cmd_t)0x2000) + +// Commands sent on the ring buffer channel +#define AUDIO_RB_CMD_GET_FIFO_DEPTH ((audio_cmd_t)0x3000) +#define AUDIO_RB_CMD_GET_BUFFER ((audio_cmd_t)0x3001) +#define AUDIO_RB_CMD_START ((audio_cmd_t)0x3002) +#define AUDIO_RB_CMD_STOP ((audio_cmd_t)0x3003) + +// Async notifications sent on the ring buffer channel. +#define AUDIO_RB_POSITION_NOTIFY ((audio_cmd_t)0x4000) + +// Flags used to modify commands. +// The NO_ACK flag can be used with the SET_GAIN and PLUG_DETECT commands. +#define AUDIO_FLAG_NO_ACK ((audio_cmd_t)0x80000000) + +typedef struct audio_cmd_hdr { + zx_txid_t transaction_id; + audio_cmd_t cmd; +} audio_cmd_hdr_t; + +static_assert(sizeof(audio_cmd_hdr_t) == 8, + "audio_cmd_hdr_t should be 8 bytes! " + "If sizeof(zx_txid_t has changed from 4 to 8, " + "consider repacking the structs in audio.h"); + +// audio_sample_format_t +// +// Bitfield which describes audio sample format as they reside in memory. +// +typedef uint32_t audio_sample_format_t; +#define AUDIO_SAMPLE_FORMAT_BITSTREAM ((audio_sample_format_t)(1u << 0)) +#define AUDIO_SAMPLE_FORMAT_8BIT ((audio_sample_format_t)(1u << 1)) +#define AUDIO_SAMPLE_FORMAT_16BIT ((audio_sample_format_t)(1u << 2)) +#define AUDIO_SAMPLE_FORMAT_20BIT_PACKED ((audio_sample_format_t)(1u << 4)) +#define AUDIO_SAMPLE_FORMAT_24BIT_PACKED ((audio_sample_format_t)(1u << 5)) +#define AUDIO_SAMPLE_FORMAT_20BIT_IN32 ((audio_sample_format_t)(1u << 6)) +#define AUDIO_SAMPLE_FORMAT_24BIT_IN32 ((audio_sample_format_t)(1u << 7)) +#define AUDIO_SAMPLE_FORMAT_32BIT ((audio_sample_format_t)(1u << 8)) +#define AUDIO_SAMPLE_FORMAT_32BIT_FLOAT ((audio_sample_format_t)(1u << 9)) +#define AUDIO_SAMPLE_FORMAT_FLAG_UNSIGNED ((audio_sample_format_t)(1u << 30)) +#define AUDIO_SAMPLE_FORMAT_FLAG_INVERT_ENDIAN ((audio_sample_format_t)(1u << 31)) +#define AUDIO_SAMPLE_FORMAT_FLAG_MASK \ + ((audio_sample_format_t)(AUDIO_SAMPLE_FORMAT_FLAG_UNSIGNED | \ + AUDIO_SAMPLE_FORMAT_FLAG_INVERT_ENDIAN)) + +// audio_stream_format_range_t +// +// A structure used along with the AUDIO_STREAM_CMD_GET_FORMATS command in order +// to describe the formats supported by an audio stream. +#define ASF_RANGE_FLAG_FPS_CONTINUOUS ((uint16_t)(1u << 0)) +#define ASF_RANGE_FLAG_FPS_48000_FAMILY ((uint16_t)(1u << 1)) +#define ASF_RANGE_FLAG_FPS_44100_FAMILY ((uint16_t)(1u << 2)) +typedef struct audio_stream_format_range { + audio_sample_format_t sample_formats; + uint32_t min_frames_per_second; + uint32_t max_frames_per_second; + uint8_t min_channels; + uint8_t max_channels; + uint16_t flags; +} __PACKED audio_stream_format_range_t; + +static_assert(sizeof(audio_stream_format_range_t) == 16, + "audio_stream_format_range_t should be 16 bytes!"); + +// audio_set_gain_flags_t +// +// Flags used by the AUDIO_STREAM_CMD_SET_GAIN message. +// +typedef uint32_t audio_set_gain_flags_t; +#define AUDIO_SGF_MUTE_VALID \ + ((audio_set_gain_flags_t)0x1) // Whether or not the mute flag is valid. +#define AUDIO_SGF_AGC_VALID ((audio_set_gain_flags_t)0x2) // Whether or not the agc flag is valid. +#define AUDIO_SGF_GAIN_VALID \ + ((audio_set_gain_flags_t)0x4) // Whether or not the gain float is valid. +#define AUDIO_SGF_MUTE ((audio_set_gain_flags_t)0x40000000) // Whether or not to mute the stream. +#define AUDIO_SGF_AGC \ + ((audio_set_gain_flags_t)0x80000000) // Whether or not enable AGC for the stream. + +// audio_pd_flags_t +// +// Flags used by AUDIO_STREAM_CMD_PLUG_DETECT commands to enable or disable +// asynchronous plug detect notifications. +// +typedef uint32_t audio_pd_flags_t; +#define AUDIO_PDF_NONE ((audio_pd_flags_t)0) +#define AUDIO_PDF_ENABLE_NOTIFICATIONS ((audio_pd_flags_t)0x40000000) +#define AUDIO_PDF_DISABLE_NOTIFICATIONS ((audio_pd_flags_t)0x80000000) + +// audio_pd_notify_flags_t +// +// Flags used by responses to the AUDIO_STREAM_CMD_PLUG_DETECT +// message, and by AUDIO_STREAM_PLUG_DETECT_NOTIFY messages. +// +typedef uint32_t audio_pd_notify_flags_t; +#define AUDIO_PDNF_HARDWIRED \ + ((audio_pd_notify_flags_t)0x1) // Stream is hardwired (will always be plugged in) +#define AUDIO_PDNF_CAN_NOTIFY \ + ((audio_pd_notify_flags_t)0x2) // Stream is able to notify of plug state changes. +#define AUDIO_PDNF_PLUGGED ((audio_pd_notify_flags_t)0x80000000) // Stream is currently plugged in. + +// AUDIO_STREAM_CMD_GET_FORMATS +// +// Must not be used with the NO_ACK flag. +#define AUDIO_STREAM_CMD_GET_FORMATS_MAX_RANGES_PER_RESPONSE (15u) +typedef struct audio_stream_cmd_get_formats_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_formats_req_t; + +// TODO(johngro) : Figure out if zx_txid_t is ever going to go up to 8 bytes or +// not. If it is, just remove the _pad field below. If not, either keep it as +// a _pad field, or repurpose it for some flags of some form. Right now, we use +// it to make sure that format_ranges is aligned to a 16 byte boundary. +typedef struct audio_stream_cmd_get_formats_resp { + audio_cmd_hdr_t hdr; + uint32_t _pad; + uint16_t format_range_count; + uint16_t first_format_range_ndx; + audio_stream_format_range_t format_ranges[AUDIO_STREAM_CMD_GET_FORMATS_MAX_RANGES_PER_RESPONSE]; +} audio_stream_cmd_get_formats_resp_t; + +static_assert(sizeof(audio_stream_cmd_get_formats_resp_t) == 256, + "audio_stream_cmd_get_formats_resp_t must be 256 bytes"); + +// AUDIO_STREAM_CMD_SET_FORMAT +// +// Must not be used with the NO_ACK flag. +typedef struct audio_stream_cmd_set_format_req { + audio_cmd_hdr_t hdr; + uint32_t frames_per_second; + audio_sample_format_t sample_format; + uint16_t channels; +} audio_stream_cmd_set_format_req_t; + +typedef struct audio_stream_cmd_set_format_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + uint64_t external_delay_nsec; + + // Note: Upon success, a channel used to control the audio buffer will also + // be returned. +} audio_stream_cmd_set_format_resp_t; + +// AUDIO_STREAM_CMD_GET_GAIN +// +// Request that a gain notification be sent with the current details of the +// streams current gain settings as well as gain setting capabilities. +// +// Must not be used with the NO_ACK flag. +typedef struct audio_stream_cmd_get_gain_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_gain_req_t; + +typedef struct audio_stream_cmd_get_gain_resp { + // TODO(johngro) : Is there value in exposing the gain step to the level + // above the lowest level stream interface, or should we have all drivers + // behave as if they have continuous control at all times? + audio_cmd_hdr_t hdr; + + bool cur_mute; // True if the stream is currently muted. + bool cur_agc; // True if the stream has AGC currently enabled. + float cur_gain; // The current setting gain of the stream in dB + + bool can_mute; // True if the stream is capable of muting + bool can_agc; // True if the stream has support for AGC + float min_gain; // The minimum valid gain setting, in dB + float max_gain; // The maximum valid gain setting, in dB + float gain_step; // The smallest valid gain increment, counted from the minimum gain. +} audio_stream_cmd_get_gain_resp_t; + +// AUDIO_STREAM_CMD_SET_GAIN +// +// Request that a stream change its gain settings to most closely match those +// requested. Gain values for Valid requests will be rounded to the nearest +// gain step. For example, if a stream can control its gain on the range from +// -60.0 to 0.0 dB, a request to set the gain to -33.3 dB will result in a gain +// of -33.5 being applied. +// +// Gain change requests outside of the capabilities of the stream's +// amplifier will be rejected with a result of ZX_ERR_INVALID_ARGS. Using the +// previous example, requests for gains of -65.0 or +3dB would be rejected. +// Similarly, If an amplifier is capable of gain control but cannot mute, a +// request to mute will be rejected. +// +// TODO(johngro) : Is this the correct behavior? Should we just apply sensible +// limits instead? IOW - If the user requests a gain of -1000 dB, should we +// just set the gain to -60dB? Likewise, if they request mute but the amplifier +// has no hard mute feature, should we just set the gain to the minimum +// permitted gain? +// +// May be used with the NO_ACK flag. +typedef struct audio_stream_cmd_set_gain_req { + audio_cmd_hdr_t hdr; + audio_set_gain_flags_t flags; + float gain; +} audio_stream_cmd_set_gain_req_t; + +typedef struct audio_stream_cmd_set_gain_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + // The current gain settings observed immediately after processing the set + // gain request. + bool cur_mute; + bool cur_agc; + float cur_gain; +} audio_stream_cmd_set_gain_resp_t; + +// AUDIO_STREAM_CMD_PLUG_DETECT +// +// Trigger a plug detect operation and/or enable/disable asynchronous plug +// detect notifications. +// +// May be used with the NO_ACK flag. +typedef struct audio_stream_cmd_plug_detect_req { + audio_cmd_hdr_t hdr; + audio_pd_flags_t flags; // Options used to enable or disable notifications +} audio_stream_cmd_plug_detect_req_t; + +typedef struct audio_stream_cmd_plug_detect_resp { + audio_cmd_hdr_t hdr; + audio_pd_notify_flags_t flags; // The current plug state and capabilities + zx_time_t plug_state_time; // The time of the plug state last change. +} audio_stream_cmd_plug_detect_resp_t; + +// AUDIO_STREAM_PLUG_DETECT_NOTIFY +// +// Message asynchronously in response to a plug state change to clients who have +// registered for plug state notifications. +// +// Note: Solicited and unsolicited plug detect messages currently use the same +// structure and contain the same information. The difference between the two +// is that Solicited messages, use AUDIO_STREAM_CMD_PLUG_DETECT as the value of +// the `cmd` field of their header and the transaction ID of the request sent by +// the client. Unsolicited messages use AUDIO_STREAM_PLUG_DETECT_NOTIFY as the +// value value of the `cmd` field of their header, and +// AUDIO_INVALID_TRANSACTION_ID for their transaction ID. +typedef audio_stream_cmd_plug_detect_resp_t audio_stream_plug_detect_notify_t; + +// AUDIO_STREAM_CMD_GET_UNIQUE_ID +// +// Fetch a globally unique, but persistent ID for the stream. +// +// Drivers should make every effort to return as unique an identifier as +// possible for each stream that they publish. This ID must not change between +// boots. When available, using a globally unique device serial number is +// strongly encouraged. Other possible sources of unique-ness include a +// driver's physical connection path, driver binding information, manufacturer +// calibration data, and so on. +// +// Note: a small number of hardcoded unique ID has been provided for built-in +// devices. Platform drivers for systems with hardwired audio devices may use +// these unique IDs as appropriate to signal which audio streams represent the +// built-in devices for the system. Drivers for hot-pluggable audio devices +// should *never* use these identifiers. +// +// Even given this, higher level code should *not* depend on these identifiers +// being perfectly unique, and should be prepared to take steps to de-dupe +// identifiers when needed. +typedef struct audio_stream_cmd_get_unique_id_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_unique_id_req_t; + +typedef struct audio_stream_unique_id { + uint8_t data[16]; +} audio_stream_unique_id_t; + +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_SPEAKERS \ + { \ + .data = { 0x01, 0x00 } \ + } +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_HEADPHONE_JACK \ + { \ + .data = { 0x02, 0x00 } \ + } +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_MICROPHONE \ + { \ + .data = { 0x03, 0x00 } \ + } +#define AUDIO_STREAM_UNIQUE_ID_BUILTIN_HEADSET_JACK \ + { \ + .data = { 0x04, 0x00 } \ + } + +typedef struct audio_stream_cmd_get_unique_id_resp { + audio_cmd_hdr_t hdr; + audio_stream_unique_id_t unique_id; +} audio_stream_cmd_get_unique_id_resp_t; + +// AUDIO_STREAM_CMD_GET_STRING +// +// Fetch the specified string from a device's static string table. Strings +// returned by the device driver... +// +// ++ Must be encoded using UTF8 +// ++ May contain embedded NULLs +// ++ May not be NULL terminated +// +// Drivers are encouraged to NULL terminate all of their strings whenever +// possible, but are not required to do so if the response buffer is too small. +// +typedef uint32_t audio_stream_string_id_t; +#define AUDIO_STREAM_STR_ID_MANUFACTURER ((audio_stream_string_id_t)0x80000000) +#define AUDIO_STREAM_STR_ID_PRODUCT ((audio_stream_string_id_t)0x80000001) + +typedef struct audio_stream_cmd_get_string_req { + audio_cmd_hdr_t hdr; + audio_stream_string_id_t id; +} audio_stream_cmd_get_string_req_t; + +typedef struct audio_stream_cmd_get_string_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + audio_stream_string_id_t id; + uint32_t strlen; + uint8_t str[256 - sizeof(audio_cmd_hdr_t) - (3 * sizeof(uint32_t))]; +} audio_stream_cmd_get_string_resp_t; + +static_assert(sizeof(audio_stream_cmd_get_string_resp_t) == 256, + "audio_stream_cmd_get_string_resp_t must be exactly 256 bytes"); + +// AUDIO_STREAM_CMD_GET_CLOCK_DOMAIN +// +// Fetch the hardware clock domain for this device. +// On products containing audio devices that are not locked to the local system clock, the board +// driver will provide a clock tree entry to the audio driver at driver startup time. From that, +// the audio driver can extract the clock domain and provide it to the sender, upon receiving this +// command. This domain value is all that the sender needs, in order to locate controls for that +// clock domain in the clock tree and trim that clock domain's rate. +// On products containing audio devices that are locked to the local system monotonic clock, a clock +// domain value of 0 should be returned. +// +// Must not be used with the NO_ACK flag. +typedef struct audio_stream_cmd_get_clock_domain_req { + audio_cmd_hdr_t hdr; +} audio_stream_cmd_get_clock_domain_req_t; + +typedef struct audio_stream_cmd_get_clock_domain_resp { + audio_cmd_hdr_t hdr; + int32_t clock_domain; +} audio_stream_cmd_get_clock_domain_resp_t; + +// +// Ring-buffer commands +// + +// AUDIO_RB_CMD_GET_FIFO_DEPTH +// +// TODO(johngro) : Is calling this "FIFO" depth appropriate? Should it be some +// direction neutral form of something like "max-read-ahead-amount" or something +// instead? +// +// Must not be used with the NO_ACK flag. +typedef struct audio_rb_cmd_get_fifo_depth_req { + audio_cmd_hdr_t hdr; +} audio_rb_cmd_get_fifo_depth_req_t; + +typedef struct audio_rb_cmd_get_fifo_depth_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + + // A representation (in bytes) of how far ahead audio hardware may read + // into the stream (in the case of output) or may hold onto audio before + // writing it to memory (in the case of input). + uint32_t fifo_depth; +} audio_rb_cmd_get_fifo_depth_resp_t; + +// AUDIO_RB_CMD_GET_BUFFER +typedef struct audio_rb_cmd_get_buffer_req { + audio_cmd_hdr_t hdr; + + uint32_t min_ring_buffer_frames; + uint32_t notifications_per_ring; +} audio_rb_cmd_get_buffer_req_t; + +typedef struct audio_rb_cmd_get_buffer_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + uint32_t num_ring_buffer_frames; + + // NOTE: If result == ZX_OK, a VMO handle representing the ring buffer to + // be used will be returned as well. Clients may map this buffer with + // read-write permissions in the case of an output stream, or read-only + // permissions in the case of an input stream. The size of the VMO + // indicates where the wrap point of the ring (in bytes) is located in the + // VMO. This size *must* always be an integral number of audio frames. + // + // TODO(johngro) : Should we provide some indication of whether or not this + // memory is being used directly for HW DMA and may need explicit cache + // flushing/invalidation? +} audio_rb_cmd_get_buffer_resp_t; + +// AUDIO_RB_CMD_START +typedef struct audio_rb_cmd_start_req { + audio_cmd_hdr_t hdr; +} audio_rb_cmd_start_req_t; + +typedef struct audio_rb_cmd_start_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; + uint64_t start_time; +} audio_rb_cmd_start_resp_t; + +// AUDIO_RB_CMD_STOP +typedef struct audio_rb_cmd_stop_req { + audio_cmd_hdr_t hdr; +} audio_rb_cmd_stop_req_t; + +typedef struct audio_rb_cmd_stop_resp { + audio_cmd_hdr_t hdr; + zx_status_t result; +} audio_rb_cmd_stop_resp_t; + +// AUDIO_RB_POSITION_NOTIFY +typedef struct audio_rb_position_notify { + audio_cmd_hdr_t hdr; + + // The time, per system monotonic clock, of the below byte position. + zx_time_t monotonic_time; + + // The current position (in bytes) of the driver/hardware's read (output) or + // write (input) pointer in the ring buffer. + uint32_t ring_buffer_pos; +} audio_rb_position_notify_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_DEVICE_AUDIO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/dlfcn.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/dlfcn.h new file mode 100644 index 0000000..f37e9be --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/dlfcn.h
@@ -0,0 +1,35 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_DLFCN_H_ +#define SYSROOT_ZIRCON_DLFCN_H_ + +#include <dlfcn.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Loads a dynamic shared object stored in |vmo|. +// Acts identically to dlopen, but acts on a vmo +// instead of a file path. +// +// Does not take ownership of the input vmo. +void* dlopen_vmo(zx_handle_t vmo, int mode); + +// Replace the handle to the "loader service" used to map names +// to VM objects for dlopen et al. This takes ownership of the +// given handle, and gives the caller ownership of the old handle +// in the return value. +zx_handle_t dl_set_loader_service(zx_handle_t new_svc); + +// Ask the active "loader service" (if there is one), to return +// a new connection. Not all loader services need support this. +// On success, a channel handle to the new connection is returned +// via out. +zx_status_t dl_clone_loader_service(zx_handle_t* out); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_DLFCN_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/driver/binding.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/driver/binding.h new file mode 100644 index 0000000..82f513e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/driver/binding.h
@@ -0,0 +1,310 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_DRIVER_BINDING_H_ +#define SYSROOT_ZIRCON_DRIVER_BINDING_H_ + +#include <assert.h> +#include <stdalign.h> +#include <stddef.h> +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// COAABBBB VVVVVVVV Condition Opcode paramA paramB Value + +#define OP_ABORT 0x0 // if (cond) return no-match +#define OP_MATCH 0x1 // if (cond) return match +#define OP_GOTO 0x2 // if (cond) advance to next LABEL(paramA) +#define OP_LABEL 0x5 // no-op, labels line with paramA + +#define COND_AL 0x0 // true +#define COND_EQ 0x1 // bind(paramB) == Value +#define COND_NE 0x2 // bind(paramB) != Value +#define COND_GT 0x3 // bind(paramB) > Value +#define COND_LT 0x4 // bind(paramB) < Value +#define COND_GE 0x5 // bind(paramB) >= Value +#define COND_LE 0x6 // bind(paramB) <= Value + +// branches are forward-only +// branches always go to the first matching LABEL +// branches that cannot find a matching LABEL are treated as ABORTs +// there is an implied unconditional ABORT after the last instruction +// flags are initially zero, may be set/cleared with SET/CLEAR +// flags may be tested by comparison against BIND_FLAGS + +#define BINDINST(c, o, a, b, v) \ + { (((c)&0xF) << 28) | (((o)&0xF) << 24) | (((a)&0xFF) << 16) | ((b)&0xFFFF), (v), 0 /* debug */ } + +#define BINDINST_CC(n) ((n) >> 28) +#define BINDINST_OP(n) (((n) >> 24) & 0xF) +#define BINDINST_PA(n) (((n) >> 16) & 0xFF) +#define BINDINST_PB(n) ((n)&0xFFFF) + +#define BI_ABORT() BINDINST(COND_AL, OP_ABORT, 0, 0, 0) +#define BI_MATCH() BINDINST(COND_AL, OP_MATCH, 0, 0, 0) +#define BI_GOTO(n) BINDINST(COND_AL, OP_GOTO, n, 0, 0) +#define BI_LABEL(n) BINDINST(COND_AL, OP_LABEL, n, 0, 0) + +#define BI_ABORT_IF(c, b, v) BINDINST(COND_##c, OP_ABORT, 0, b, v) +#define BI_MATCH_IF(c, b, v) BINDINST(COND_##c, OP_MATCH, 0, b, v) +#define BI_GOTO_IF(c, b, v, n) BINDINST(COND_##c, OP_GOTO, n, b, v) + +// for drivers that only want to be bound on user request +#define BI_ABORT_IF_AUTOBIND BI_ABORT_IF(NE, BIND_AUTOBIND, 0) + +// global binding variables at 0x00XX +#define BIND_FLAGS 0x0000 // value of the flags register +#define BIND_PROTOCOL 0x0001 // primary protocol of the device +#define BIND_AUTOBIND 0x0002 // if this is an automated bind/load + +// pci binding variables at 0x01XX +#define BIND_PCI_VID 0x0100 +#define BIND_PCI_DID 0x0101 +#define BIND_PCI_CLASS 0x0102 +#define BIND_PCI_SUBCLASS 0x0103 +#define BIND_PCI_INTERFACE 0x0104 +#define BIND_PCI_REVISION 0x0105 + +// usb binding variables at 0x02XX +// these are used for both ZX_PROTOCOL_USB and ZX_PROTOCOL_USB_FUNCTION +#define BIND_USB_VID 0x0200 +#define BIND_USB_PID 0x0201 +#define BIND_USB_CLASS 0x0202 +#define BIND_USB_SUBCLASS 0x0203 +#define BIND_USB_PROTOCOL 0x0204 + +// Platform bus binding variables at 0x03XX +#define BIND_PLATFORM_DEV_VID 0x0300 +#define BIND_PLATFORM_DEV_PID 0x0301 +#define BIND_PLATFORM_DEV_DID 0x0302 +#define BIND_PLATFORM_PROTO 0x0303 + +// ACPI binding variables at 0x04XX +// The _HID is a 7- or 8-byte string. Because a bind property is 32-bit, use 2 +// properties to bind using the _HID. They are encoded in big endian order for +// human readability. In the case of 7-byte _HID's, the 8th-byte shall be 0. +#define BIND_ACPI_HID_0_3 0x0400 // char 0-3 +#define BIND_ACPI_HID_4_7 0x0401 // char 4-7 +// The _CID may be a valid HID value or a bus-specific string. The ACPI bus +// driver only publishes those that are valid HID values. +#define BIND_ACPI_CID_0_3 0x0402 // char 0-3 +#define BIND_ACPI_CID_4_7 0x0403 // char 4-7 + +// Intel HDA Codec binding variables at 0x05XX +#define BIND_IHDA_CODEC_VID 0x0500 +#define BIND_IHDA_CODEC_DID 0x0501 +#define BIND_IHDA_CODEC_MAJOR_REV 0x0502 +#define BIND_IHDA_CODEC_MINOR_REV 0x0503 +#define BIND_IHDA_CODEC_VENDOR_REV 0x0504 +#define BIND_IHDA_CODEC_VENDOR_STEP 0x0505 + +// Serial binding variables at 0x06XX +#define BIND_SERIAL_CLASS 0x0600 +#define BIND_SERIAL_VID 0x0601 +#define BIND_SERIAL_PID 0x0602 + +// NAND binding variables at 0x07XX +#define BIND_NAND_CLASS 0x0700 + +// Bluetooth binding variables at 0x08XX +#define BIND_BT_GATT_SVC_UUID16 0x0800 +// 128-bit UUID is split across 4 32-bit unsigned ints +#define BIND_BT_GATT_SVC_UUID128_1 0x0801 +#define BIND_BT_GATT_SVC_UUID128_2 0x0802 +#define BIND_BT_GATT_SVC_UUID128_3 0x0803 +#define BIND_BT_GATT_SVC_UUID128_4 0x0804 + +// SDIO binding variables at 0x09XX +#define BIND_SDIO_VID 0x0900 +#define BIND_SDIO_PID 0x0901 +#define BIND_SDIO_FUNCTION 0x0902 + +// I2C binding variables at 0x0A0X +#define BIND_I2C_CLASS 0x0A00 +#define BIND_I2C_BUS_ID 0x0A01 +#define BIND_I2C_ADDRESS 0x0A02 + +// GPIO binding variables at 0x0A1X +#define BIND_GPIO_PIN 0x0A10 + +// POWER binding variables at 0x0A2X +#define BIND_POWER_DOMAIN 0x0A20 +#define BIND_POWER_DOMAIN_COMPOSITE 0x0A21 + +// POWER binding variables at 0x0A3X +#define BIND_CLOCK_ID 0x0A30 + +// SPI binding variables at 0x0A4X +#define BIND_SPI_CLASS 0x0A40 +#define BIND_SPI_BUS_ID 0x0A41 +#define BIND_SPI_CHIP_SELECT 0x0A42 + +// PWM binding variables at 0x0A5X +#define BIND_PWM_ID 0x0A50 + +// Init Step binding variables at 0x0A6X +#define BIND_INIT_STEP 0x0A60 + +// Fuchsia-defined topological path properties are at 0x0B00 through 0x0B7F. +// Vendor-defined topological path properties are at 0x0B80 to 0x0BFF. +// For vendor properties, it is recommended that a vendor ID be included +// and checked via some other property. +#define BIND_TOPO_START 0x0B00 +#define BIND_TOPO_PCI 0x0B00 +#define BIND_TOPO_I2C 0x0B01 +#define BIND_TOPO_SPI 0x0B02 +#define BIND_TOPO_VENDOR_START 0x0B80 +#define BIND_TOPO_VENDOR_END 0x0BFF +#define BIND_TOPO_END 0x0BFF + +#define BIND_TOPO_PCI_PACK(bus, dev, func) (((bus) << 8) | (dev << 3) | (func)) +#define BIND_TOPO_PCI_UNPACK_BUS(topo) (((topo) >> 8) & 0xff) +#define BIND_TOPO_PCI_UNPACK_DEVICE(topo) (((topo) >> 3) & 0x1f) +#define BIND_TOPO_PCI_UNPACK_FUNCTION(topo) ((topo)&0x7) + +#define BIND_TOPO_I2C_PACK(addr) ((addr)) +#define BIND_TOPO_I2C_UNPACK(topo) ((topo)) + +#define BIND_TOPO_SPI_PACK(bus, chip_select) (((bus) << 8) | (chip_select)) +#define BIND_TOPO_SPI_UNPACK_BUS_ID(topo) (((topo) >> 8) && 0xff) +#define BIND_TOPO_SPI_UNPACK_CHIP_SELECT(topo) ((topo)&0xff) + +typedef struct zx_bind_inst { + uint32_t op; + uint32_t arg; + uint32_t debug; +} zx_bind_inst_t; + +typedef struct zx_device_prop { + uint16_t id; + uint16_t reserved; + uint32_t value; +} zx_device_prop_t; + +// simple example +#if 0 +zx_bind_inst_t i915_binding[] = { + BI_ABORT_IF(NE, BIND_PROTOCOL, ZX_PROTOCOL_PCI), + BI_ABORT_IF(NE, BIND_PCI_VID, 0x8086), + BI_MATCH_IF(EQ, BIND_PCI_DID, 0x1616), // broadwell + BI_MATCH_IF(EQ, BIND_PCI_DID, 0x1916), // skylake + BI_ABORT(), +}; +#endif + +#define ZIRCON_NOTE_NAME "Zircon" +#define ZIRCON_NOTE_DRIVER 0x31565244 // DRV1 + +typedef struct { + // Elf64_Nhdr fields: + uint32_t namesz; + uint32_t descsz; + uint32_t type; + // ELF note name. namesz is the exact size of the name (including '\0'), + // but the storage size is always rounded up to a multiple of 4 bytes. + char name[(sizeof(ZIRCON_NOTE_NAME) + 3) & -4]; +} zircon_driver_note_header_t; + +#define ZIRCON_DRIVER_NOTE_HEADER_INIT(object) \ + { \ + /* .namesz = */ sizeof(ZIRCON_NOTE_NAME), \ + /* .descsz = */ (sizeof(object) - sizeof(zircon_driver_note_header_t)), \ + /* .type = */ ZIRCON_NOTE_DRIVER, /* .name = */ ZIRCON_NOTE_NAME, \ + } + +typedef struct { + // See flag bits below. + uint32_t flags; + + // Driver Metadata + uint32_t bindcount; + uint32_t reserved0; + char name[32]; + char vendor[16]; + char version[16]; + + // Driver Bind Program follows +} zircon_driver_note_payload_t; + +// Flag bits in the driver note: + +// Driver is built with `-fsanitize=address` and can only be loaded into a +// devhost that supports the ASan runtime. +#define ZIRCON_DRIVER_NOTE_FLAG_ASAN (1u << 0) + +#define ZIRCON_DRIVER_NOTE_PAYLOAD_INIT(Driver, VendorName, Version, BindCount) \ + { \ + /* .flags = */ ZIRCON_DRIVER_NOTE_FLAGS, /* .bindcount = */ (BindCount), /* .reserved0 = */ 0, \ + /* .name = */ #Driver, /* .vendor = */ VendorName, /* .version = */ Version, \ + } + +#define ZIRCON_DRIVER_NOTE_FLAGS \ + (__has_feature(address_sanitizer) ? ZIRCON_DRIVER_NOTE_FLAG_ASAN : 0) + +typedef struct { + zircon_driver_note_header_t header; + zircon_driver_note_payload_t payload; +} zircon_driver_note_t; + +static_assert(offsetof(zircon_driver_note_t, payload) == sizeof(zircon_driver_note_header_t), + "alignment snafu?"); + +// Without this, ASan will add redzone padding after the object, which +// would make it invalid ELF note format. +#if __has_feature(address_sanitizer) +#define ZIRCON_DRIVER_NOTE_ASAN __attribute__((no_sanitize("address"))) +#else +#define ZIRCON_DRIVER_NOTE_ASAN +#endif + +// GCC has a quirk about how '__attribute__((visibility("default")))' +// (__EXPORT here) works for const variables in C++. The attribute has no +// effect when used on the definition of a const variable, and GCC gives a +// warning/error about that. The attribute must appear on the "extern" +// declaration of the variable instead. + +// We explicitly align the note to 4 bytes. That's its natural alignment +// anyway, but the compilers sometimes like to over-align as an +// optimization while other tools sometimes like to complain if SHT_NOTE +// sections are over-aligned (since this could result in padding being +// inserted that makes it violate the ELF note format). Standard C11 +// doesn't permit alignas(...) on a type but we could use __ALIGNED(4) on +// all the types (i.e. GNU __attribute__ syntax instead of C11 syntax). +// But the alignment of the types is not actually the issue: it's the +// compiler deciding to over-align the individual object regardless of its +// type's alignment, so we have to explicitly set the alignment of the +// object to defeat any compiler default over-alignment. + +#define ZIRCON_DRIVER_BEGIN(Driver, Ops, VendorName, Version, BindCount) \ + const zx_driver_ops_t* __zircon_driver_ops__ __EXPORT = &(Ops); \ + zx_driver_rec_t __zircon_driver_rec__ __EXPORT = { \ + /* .ops = */ &(Ops), /* .driver = */ NULL, \ + /* .log_flags = */ 7, /* DDK_LOG_ERROR | DDK_LOG_WARN | DDK_LOG_INFO */ \ + }; \ + extern const struct zircon_driver_note __zircon_driver_note__ __EXPORT; \ + alignas(4) __SECTION(".note.zircon.driver." #Driver) \ + ZIRCON_DRIVER_NOTE_ASAN const struct zircon_driver_note { \ + zircon_driver_note_t note; \ + zx_bind_inst_t binding[BindCount]; \ + } __zircon_driver_note__ = { \ + /* .note = */ { \ + ZIRCON_DRIVER_NOTE_HEADER_INIT(__zircon_driver_note__), \ + ZIRCON_DRIVER_NOTE_PAYLOAD_INIT(Driver, VendorName, Version, BindCount), \ + }, \ + /* .binding = */ { +#define ZIRCON_DRIVER_END(Driver) \ + } \ + } \ + ; + +// TODO: if we moved the Ops from the BEGIN() to END() macro we +// could add a zircon_driver_note_t* to the zx_driver_rec_t, +// define it in END(), and have only one symbol to dlsym() +// when loading drivers + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_DRIVER_BINDING_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/errors.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/errors.h new file mode 100644 index 0000000..4e0da7d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/errors.h
@@ -0,0 +1,233 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_ERRORS_H_ +#define SYSROOT_ZIRCON_ERRORS_H_ + +// Zircon statuses are signed 32 bit integers. The space of values is +// divided as follows: +// - The zero value is for the OK status. +// - Negative values are defined by the system, in this file. +// - Positive values are reserved for protocol-specific error values, +// and will never be defined by the system. + +#define ZX_OK (0) + +// ======= Internal failures ======= +// ZX_ERR_INTERNAL: The system encountered an otherwise unspecified error +// while performing the operation. +#define ZX_ERR_INTERNAL (-1) + +// ZX_ERR_NOT_SUPPORTED: The operation is not implemented, supported, +// or enabled. +#define ZX_ERR_NOT_SUPPORTED (-2) + +// ZX_ERR_NO_RESOURCES: The system was not able to allocate some resource +// needed for the operation. +#define ZX_ERR_NO_RESOURCES (-3) + +// ZX_ERR_NO_MEMORY: The system was not able to allocate memory needed +// for the operation. +#define ZX_ERR_NO_MEMORY (-4) + +// -5 used to be ZX_ERR_CALL_FAILED. + +// ZX_ERR_INTERNAL_INTR_RETRY: The system call was interrupted, but should be +// retried. This should not be seen outside of the VDSO. +#define ZX_ERR_INTERNAL_INTR_RETRY (-6) + +// ======= Parameter errors ======= +// ZX_ERR_INVALID_ARGS: an argument is invalid, ex. null pointer +#define ZX_ERR_INVALID_ARGS (-10) + +// ZX_ERR_BAD_HANDLE: A specified handle value does not refer to a handle. +#define ZX_ERR_BAD_HANDLE (-11) + +// ZX_ERR_WRONG_TYPE: The subject of the operation is the wrong type to +// perform the operation. +// Example: Attempting a message_read on a thread handle. +#define ZX_ERR_WRONG_TYPE (-12) + +// ZX_ERR_BAD_SYSCALL: The specified syscall number is invalid. +#define ZX_ERR_BAD_SYSCALL (-13) + +// ZX_ERR_OUT_OF_RANGE: An argument is outside the valid range for this +// operation. +#define ZX_ERR_OUT_OF_RANGE (-14) + +// ZX_ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for +// this operation. +#define ZX_ERR_BUFFER_TOO_SMALL (-15) + +// ======= Precondition or state errors ======= +// ZX_ERR_BAD_STATE: operation failed because the current state of the +// object does not allow it, or a precondition of the operation is +// not satisfied +#define ZX_ERR_BAD_STATE (-20) + +// ZX_ERR_TIMED_OUT: The time limit for the operation elapsed before +// the operation completed. +#define ZX_ERR_TIMED_OUT (-21) + +// ZX_ERR_SHOULD_WAIT: The operation cannot be performed currently but +// potentially could succeed if the caller waits for a prerequisite +// to be satisfied, for example waiting for a handle to be readable +// or writable. +// Example: Attempting to read from a channel that has no +// messages waiting but has an open remote will return ZX_ERR_SHOULD_WAIT. +// Attempting to read from a channel that has no messages waiting +// and has a closed remote end will return ZX_ERR_PEER_CLOSED. +#define ZX_ERR_SHOULD_WAIT (-22) + +// ZX_ERR_CANCELED: The in-progress operation (e.g. a wait) has been +// canceled. +#define ZX_ERR_CANCELED (-23) + +// ZX_ERR_PEER_CLOSED: The operation failed because the remote end of the +// subject of the operation was closed. +#define ZX_ERR_PEER_CLOSED (-24) + +// ZX_ERR_NOT_FOUND: The requested entity is not found. +#define ZX_ERR_NOT_FOUND (-25) + +// ZX_ERR_ALREADY_EXISTS: An object with the specified identifier +// already exists. +// Example: Attempting to create a file when a file already exists +// with that name. +#define ZX_ERR_ALREADY_EXISTS (-26) + +// ZX_ERR_ALREADY_BOUND: The operation failed because the named entity +// is already owned or controlled by another entity. The operation +// could succeed later if the current owner releases the entity. +#define ZX_ERR_ALREADY_BOUND (-27) + +// ZX_ERR_UNAVAILABLE: The subject of the operation is currently unable +// to perform the operation. +// Note: This is used when there's no direct way for the caller to +// observe when the subject will be able to perform the operation +// and should thus retry. +#define ZX_ERR_UNAVAILABLE (-28) + +// ======= Permission check errors ======= +// ZX_ERR_ACCESS_DENIED: The caller did not have permission to perform +// the specified operation. +#define ZX_ERR_ACCESS_DENIED (-30) + +// ======= Input-output errors ======= +// ZX_ERR_IO: Otherwise unspecified error occurred during I/O. +#define ZX_ERR_IO (-40) + +// ZX_ERR_REFUSED: The entity the I/O operation is being performed on +// rejected the operation. +// Example: an I2C device NAK'ing a transaction or a disk controller +// rejecting an invalid command, or a stalled USB endpoint. +#define ZX_ERR_IO_REFUSED (-41) + +// ZX_ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity +// check and is possibly corrupted. +// Example: CRC or Parity error. +#define ZX_ERR_IO_DATA_INTEGRITY (-42) + +// ZX_ERR_IO_DATA_LOSS: The data in the operation is currently unavailable +// and may be permanently lost. +// Example: A disk block is irrecoverably damaged. +#define ZX_ERR_IO_DATA_LOSS (-43) + +// ZX_ERR_IO_NOT_PRESENT: The device is no longer available (has been +// unplugged from the system, powered down, or the driver has been +// unloaded) +#define ZX_ERR_IO_NOT_PRESENT (-44) + +// ZX_ERR_IO_OVERRUN: More data was received from the device than expected. +// Example: a USB "babble" error due to a device sending more data than +// the host queued to receive. +#define ZX_ERR_IO_OVERRUN (-45) + +// ZX_ERR_IO_MISSED_DEADLINE: An operation did not complete within the required timeframe. +// Example: A USB isochronous transfer that failed to complete due to an overrun or underrun. +#define ZX_ERR_IO_MISSED_DEADLINE (-46) + +// ZX_ERR_IO_INVALID: The data in the operation is invalid parameter or is out of range. +// Example: A USB transfer that failed to complete with TRB Error +#define ZX_ERR_IO_INVALID (-47) + +// ======== Filesystem Errors ======== +// ZX_ERR_BAD_PATH: Path name is too long. +#define ZX_ERR_BAD_PATH (-50) + +// ZX_ERR_NOT_DIR: Object is not a directory or does not support +// directory operations. +// Example: Attempted to open a file as a directory or +// attempted to do directory operations on a file. +#define ZX_ERR_NOT_DIR (-51) + +// ZX_ERR_NOT_FILE: Object is not a regular file. +#define ZX_ERR_NOT_FILE (-52) + +// ZX_ERR_FILE_BIG: This operation would cause a file to exceed a +// filesystem-specific size limit +#define ZX_ERR_FILE_BIG (-53) + +// ZX_ERR_NO_SPACE: Filesystem or device space is exhausted. +#define ZX_ERR_NO_SPACE (-54) + +// ZX_ERR_NOT_EMPTY: Directory is not empty. +#define ZX_ERR_NOT_EMPTY (-55) + +// ======== Flow Control ======== +// These are not errors, as such, and will never be returned +// by a syscall or public API. They exist to allow callbacks +// to request changes in operation. +// +// ZX_ERR_STOP: Do not call again. +// Example: A notification callback will be called on every +// event until it returns something other than ZX_OK. +// This status allows differentiation between "stop due to +// an error" and "stop because the work is done." +#define ZX_ERR_STOP (-60) + +// ZX_ERR_NEXT: Advance to the next item. +// Example: A notification callback will use this response +// to indicate it did not "consume" an item passed to it, +// but by choice, not due to an error condition. +#define ZX_ERR_NEXT (-61) + +// ZX_ERR_ASYNC: Ownership of the item has moved to an asynchronous worker. +// +// Unlike ZX_ERR_STOP, which implies that iteration on an object +// should stop, and ZX_ERR_NEXT, which implies that iteration +// should continue to the next item, ZX_ERR_ASYNC implies +// that an asynchronous worker is responsible for continuing iteration. +// +// Example: A notification callback will be called on every +// event, but one event needs to handle some work asynchronously +// before it can continue. ZX_ERR_ASYNC implies the worker is +// responsible for resuming iteration once its work has completed. +#define ZX_ERR_ASYNC (-62) + +// ======== Network-related errors ======== + +// ZX_ERR_PROTOCOL_NOT_SUPPORTED: Specified protocol is not +// supported. +#define ZX_ERR_PROTOCOL_NOT_SUPPORTED (-70) + +// ZX_ERR_ADDRESS_UNREACHABLE: Host is unreachable. +#define ZX_ERR_ADDRESS_UNREACHABLE (-71) + +// ZX_ERR_ADDRESS_IN_USE: Address is being used by someone else. +#define ZX_ERR_ADDRESS_IN_USE (-72) + +// ZX_ERR_NOT_CONNECTED: Socket is not connected. +#define ZX_ERR_NOT_CONNECTED (-73) + +// ZX_ERR_CONNECTION_REFUSED: Remote peer rejected the connection. +#define ZX_ERR_CONNECTION_REFUSED (-74) + +// ZX_ERR_CONNECTION_RESET: Connection was reset. +#define ZX_ERR_CONNECTION_RESET (-75) + +// ZX_ERR_CONNECTION_ABORTED: Connection was aborted. +#define ZX_ERR_CONNECTION_ABORTED (-76) + +#endif // SYSROOT_ZIRCON_ERRORS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/exception.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/exception.h new file mode 100644 index 0000000..bf3843b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/exception.h
@@ -0,0 +1,19 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include <zircon/syscalls/exception.h> + +#ifdef __cplusplus +extern "C" { +#endif + +__EXPORT const char* _zx_exception_get_string(zx_excp_type_t exception); +__EXPORT const char* zx_exception_get_string(zx_excp_type_t exception); + +#ifdef __cplusplus +} +#endif +
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/features.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/features.h new file mode 100644 index 0000000..d60e724 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/features.h
@@ -0,0 +1,47 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_FEATURES_H_ +#define SYSROOT_ZIRCON_FEATURES_H_ + +// clang-format off + +// types of features that can be retrieved via |zx_system_get_features| +#define ZX_FEATURE_KIND_CPU ((uint32_t)0) +#define ZX_FEATURE_KIND_HW_BREAKPOINT_COUNT ((uint32_t)1) +#define ZX_FEATURE_KIND_HW_WATCHPOINT_COUNT ((uint32_t)2) + +// arch-independent CPU features +#define ZX_HAS_CPU_FEATURES ((uint32_t)(1u << 0)) + +#if defined(__x86_64__) + +// x86-64 CPU features +// None; use cpuid instead + +#elif defined(__aarch64__) + +// arm64 CPU features +#define ZX_ARM64_FEATURE_ISA_FP ((uint32_t)(1u << 1)) +#define ZX_ARM64_FEATURE_ISA_ASIMD ((uint32_t)(1u << 2)) +#define ZX_ARM64_FEATURE_ISA_AES ((uint32_t)(1u << 3)) +#define ZX_ARM64_FEATURE_ISA_PMULL ((uint32_t)(1u << 4)) +#define ZX_ARM64_FEATURE_ISA_SHA1 ((uint32_t)(1u << 5)) +#define ZX_ARM64_FEATURE_ISA_SHA2 ((uint32_t)(1u << 6)) +#define ZX_ARM64_FEATURE_ISA_CRC32 ((uint32_t)(1u << 7)) +#define ZX_ARM64_FEATURE_ISA_ATOMICS ((uint32_t)(1u << 8)) +#define ZX_ARM64_FEATURE_ISA_RDM ((uint32_t)(1u << 9)) +#define ZX_ARM64_FEATURE_ISA_SHA3 ((uint32_t)(1u << 10)) +#define ZX_ARM64_FEATURE_ISA_SM3 ((uint32_t)(1u << 11)) +#define ZX_ARM64_FEATURE_ISA_SM4 ((uint32_t)(1u << 12)) +#define ZX_ARM64_FEATURE_ISA_DP ((uint32_t)(1u << 13)) +#define ZX_ARM64_FEATURE_ISA_DPB ((uint32_t)(1u << 14)) + +#else + +#error what architecture? + +#endif + +#endif // SYSROOT_ZIRCON_FEATURES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/fidl.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/fidl.h new file mode 100644 index 0000000..152843a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/fidl.h
@@ -0,0 +1,452 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_FIDL_H_ +#define SYSROOT_ZIRCON_FIDL_H_ + +#include <assert.h> // NOLINT(modernize-deprecated-headers, foobar) +#include <stdalign.h> // NOLINT(modernize-deprecated-headers) +#include <stdint.h> // NOLINT(modernize-*) +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Fidl data types have a representation in a wire format. This wire +// format is shared by all language bindings, including C11 and C++. +// +// The C bindings also define a representation of fidl data types. For +// a given type, the size and alignment of all parts of the type agree +// with the wire format's representation. The C representation differs +// in the representation of pointers to out-of-line allocations. On +// the wire, allocations are encoded as either present or not. In C, +// they are actual pointers. The C representation also places any +// transferred handle types (including requests) inline. The wire +// format tracks handles separately, just like the underlying channel +// transport does. +// +// Turning the wire format into the C format is called decoding. +// +// Turning the C format into the wire format is called encoding. +// +// The formats are designed to allow for in-place coding, assuming all +// out-of-line allocations placed are in traversal order (defined +// below) with natural alignment. + +// Bounds. + +// Various fidl types, such as strings and vectors, may be bounded. If +// no explicit bound is given, then FIDL_MAX_SIZE is implied. + +#define FIDL_MAX_SIZE UINT32_MAX + +// Out of line allocations. + +// The fidl wire format represents potential out-of-line allocations +// (corresponding to actual pointer types in the C format) as +// uintptr_t. For allocations that are actually present and that will +// be patched up with pointers during decoding, the FIDL_ALLOC_PRESENT +// value is used. For non-present nullable allocations, the +// FIDL_ALLOC_ABSENT value is used. + +#define FIDL_ALLOC_PRESENT ((uintptr_t)UINTPTR_MAX) +#define FIDL_ALLOC_ABSENT ((uintptr_t)0) + +// Out of line allocations are all 8 byte aligned. +// TODO(fxb/42792): Remove either this FIDL_ALIGN macro or the FidlAlign function in +// fidl/internal.h. +#define FIDL_ALIGNMENT ((size_t)8) +#define FIDL_ALIGN(a) (((a) + 7u) & ~7u) +#define FIDL_ALIGNDECL alignas(FIDL_ALIGNMENT) + +// An opaque struct representing the encoding of a particular fidl +// type. +typedef struct fidl_type fidl_type_t; + +// Primitive types. + +// Both on the wire and once deserialized, primitive fidl types +// correspond directly to C types. There is no intermediate layer of +// typedefs. For instance, fidl's float64 is generated as double. + +// All primitive types are non-nullable. + +// All primitive types are naturally sized and aligned on the wire. + +// fidl C Meaning. +// --------------------------------------------- +// bool bool A boolean. +// int8 int8_t An 8 bit signed integer. +// int16 int16_t A 16 bit signed integer. +// int32 int32_t A 32 bit signed integer. +// int64 int64_t A 64 bit signed integer. +// uint8 uint8_t An 8 bit unsigned integer. +// uint16 uint16_t A 16 bit unsigned integer. +// uint32 uint32_t A 32 bit unsigned integer. +// uint64 uint64_t A 64 bit unsigned integer. +// float32 float A 32 bit IEEE-754 float. +// float64 double A 64 bit IEEE-754 float. + +// Enums. + +// Fidl enums have an undering integer type (one of int8, int16, +// int32, int64, uint8, uint16, uint32, or uint64). The wire format of +// an enum and the C format of an enum are the same as the +// corresponding primitive type. + +// String types. + +// Fidl strings are variable-length UTF-8 strings. Strings can be +// nullable (string?) or nonnullable (string); if nullable, the null +// string is distinct from the empty string. Strings can be bounded to +// a fixed byte length (e.g. string:40? is a nullable string of at +// most 40 bytes). + +// Strings are not guaranteed to be nul terminated. Strings can +// contain embedded nuls throughout their length. + +// The fidl wire format dictates that strings are valid UTF-8. It is +// up to clients to provide well-formed UTF-8 and servers to check for +// it. Message encoding and decoding can, but does not by default, +// perform this check. + +// All deserialized string types are represented by the fidl_string_t +// structure. This structure consists of a size (in bytes) and a +// pointer to an out-of-line allocation of uint8_t, guaranteed to be +// at least as long as the length. + +// The bound on a string type is not present in the serialized format, +// but is checked as part of validation. + +typedef struct fidl_string { + // Number of UTF-8 code units (bytes), must be 0 if |data| is null. + uint64_t size; + + // Pointer to UTF-8 code units (bytes) or null + char* data; +} fidl_string_t; + +// When encoded, an absent nullable string is represented as a +// fidl_string_t with size 0 and FIDL_ALLOC_ABSENT data, with no +// out-of-line allocation associated with it. A present string +// (nullable or not) is represented as a fidl_string_t with some size +// and with data equal to FIDL_ALLOC_PRESENT, which the decoding +// process replaces with an actual pointer to the next out-of-line +// allocation. + +// All string types: + +// fidl C Meaning +// ----------------------------------------------------------------- +// string fidl_string_t A string of arbitrary length. +// string? fidl_string_t An optional string of arbitrary length. +// string:N fidl_string_t A string up to N bytes long. +// string:N? fidl_string_t An optional string up to N bytes long. + +// Arrays. + +// On the wire, an array of N objects of type T (array<T, N>) is +// represented the same as N contiguous Ts. Equivalently, it is +// represented the same as a nonnullable struct containing N fields +// all of type T. + +// In C, this is just represented as a C array of the corresponding C +// type. + +// Vector types. + +// Fidl vectors are variable-length arrays of a given type T. Vectors +// can be nullable (vector<T>?) or nonnullable (vector<T>); if +// nullable, the null vector is distinct from the empty +// vector. Vectors can be bounded to a fixed element length +// (e.g. vector<T>:40? is a nullable vector of at most 40 Ts). + +// All deserialized vector types are represented by the fidl_vector_t +// structure. This structure consists of a count and a pointer to the +// bytes. + +// The bound on a vector type is not present in the serialized format, +// but is checked as part of validation. + +typedef struct fidl_vector { + // Number of elements, must be 0 if |data| is null. + uint64_t count; + + // Pointer to element data or null. + void* data; +} fidl_vector_t; + +// When encoded, an absent nullable vector is represented as a +// fidl_vector_t with size 0 and FIDL_ALLOC_ABSENT data, with no +// out-of-line allocation associated with it. A present vector +// (nullable or not) is represented as a fidl_vector_t with some size +// and with data equal to FIDL_ALLOC_PRESENT, which the decoding +// process replaces with an actual pointer to the next out-of-line +// allocation. + +// All vector types: + +// fidl C Meaning +// -------------------------------------------------------------------------- +// vector<T> fidl_vector_t A vector of T, of arbitrary length. +// vector<T>? fidl_vector_t An optional vector of T, of arbitrary length. +// vector<T>:N fidl_vector_t A vector of T, up to N elements. +// vector<T>:N? fidl_vector_t An optional vector of T, up to N elements. + +// Envelope. + +// An efficient way to encapsulate uninterpreted FIDL messages. +// - Stores a variable size uninterpreted payload out-of-line. +// - Payload may contain an arbitrary number of bytes and handles. +// - Allows for encapsulation of one FIDL message inside of another. +// - Building block for extensible structures such as tables & extensible +// unions. + +// When encoded for transfer, |data| indicates presence of content: +// - FIDL_ALLOC_ABSENT : envelope is null +// - FIDL_ALLOC_PRESENT : envelope is non-null, |data| is the next out-of-line object +// When decoded for consumption, |data| is a pointer to content. +// - nullptr : envelope is null +// - <valid pointer> : envelope is non-null, |data| is at indicated memory address + +typedef struct { + // The size of the entire envelope contents, including any additional + // out-of-line objects that the envelope may contain. For example, a + // vector<string>'s num_bytes for ["hello", "world"] would include the + // string contents in the size, not just the outer vector. Always a multiple + // of 8; must be zero if envelope is null. + uint32_t num_bytes; + + // The number of handles in the envelope, including any additional + // out-of-line objects that the envelope contains. Must be zero if envelope is null. + uint32_t num_handles; + + // A pointer to the out-of-line envelope data in decoded form, or + // FIDL_ALLOC_(ABSENT|PRESENT) in encoded form. + union { + void* data; + uintptr_t presence; + }; +} fidl_envelope_t; + +// Handle types. + +// Handle types are encoded directly. Just like primitive types, there +// is no fidl-specific handle type. Generated fidl structures simply +// mention zx_handle_t. + +// Handle types are either nullable (handle?), or not (handle); and +// either explicitly typed (e.g. handle<Channel> or handle<Job>), or +// not. + +// All fidl handle types, regardless of subtype, are represented as +// zx_handle_t. The encoding tables do know the handle subtypes, +// however, for clients which wish to perform explicit checking. + +// The following are the possible handle subtypes. + +// process +// thread +// vmo +// channel +// event +// port +// interrupt +// iomap +// pci +// log +// socket +// resource +// eventpair +// job +// vmar +// fifo +// hypervisor +// guest +// timer + +// All handle types are 4 byte sized and aligned on the wire. + +// When encoded, absent nullable handles are represented as +// FIDL_HANDLE_ABSENT. Present handles, whether nullable or not, are +// represented as FIDL_HANDLE_PRESENT, which the decoding process will +// overwrite with the next handle value in the channel message. + +#define FIDL_HANDLE_ABSENT ((zx_handle_t)ZX_HANDLE_INVALID) +#define FIDL_HANDLE_PRESENT ((zx_handle_t)UINT32_MAX) + +// fidl C Meaning +// ------------------------------------------------------------------ +// handle zx_handle_t Any valid handle. +// handle? zx_handle_t Any valid handle, or ZX_HANDLE_INVALID. +// handle<T> zx_handle_t Any valid T handle. +// handle<T>? zx_handle_t Any valid T handle, or ZX_HANDLE_INVALID. + +// Unions. + +// Fidl unions are a tagged sum type. The tag is a 4 bytes. For every +// union type, the fidl compiler generates an enum representing the +// different variants of the enum. This is followed, in C and on the +// wire, by large enough and aligned enough storage for all members of +// the union. + +// Unions may be nullable. Nullable unions are represented as a +// pointer to an out of line allocation of tag-and-member. As with +// other out-of-line allocations, ones present on the wire take the +// value FIDL_ALLOC_PRESENT and those that are not are represented by +// FIDL_ALLOC_NULL. Nonnullable unions are represented inline as a +// tag-and-member. + +// For each fidl union type, a corresponding C type is generated. They +// are all structs consisting of a fidl_union_tag_t discriminant, +// followed by an anonymous union of all the union members. + +typedef uint32_t fidl_union_tag_t; + +// fidl C Meaning +// -------------------------------------------------------------------- +// union foo {...} struct union_foo { An inline union. +// fidl_union_tag_t tag; +// union {...}; +// } +// +// union foo {...}? struct union_foo* A pointer to a +// union_foo, or else +// FIDL_ALLOC_ABSENT. + +// Tables. + +// Tables are 'flexible structs', where all members are optional, and new +// members can be added, or old members removed while preserving ABI +// compatibility. Each table member is referenced by ordinal, sequentially +// assigned from 1 onward, with no gaps. Each member content is stored +// out-of-line in an envelope, and a table is simply a vector of these envelopes +// with the requirement that the last envelope must be present in order +// to guarantee a canonical representation. + +typedef struct { + fidl_vector_t envelopes; +} fidl_table_t; + +// Extensible unions. + +// Extensible unions, or "xunions" (colloquially pronounced "zoo-nions") are +// similar to unions, except that storage for union members are out-of-line +// rather than inline. This enables union members to be added and removed while +// preserving ABI compatibility with the existing xunion definition. + +typedef uint64_t fidl_xunion_tag_t; + +enum { + kFidlXUnionEmptyTag = 0, // The tag representing an empty xunion. +}; + +typedef struct { + fidl_xunion_tag_t tag; + fidl_envelope_t envelope; +} fidl_xunion_t; + +// Messages. + +// All fidl messages share a common 16 byte header. + +enum { + kFidlWireFormatMagicNumberInitial = 1, +}; + +typedef struct fidl_message_header { + zx_txid_t txid; + uint8_t flags[3]; + // This value indicates the message's wire format. Two sides with different + // wire formats are incompatible with each other + uint8_t magic_number; + uint64_t ordinal; +} fidl_message_header_t; + +// Messages which do not have a response use zero as a special +// transaction id. + +#define FIDL_TXID_NO_RESPONSE 0ul + +// A FIDL message. +typedef struct fidl_msg { + // The bytes of the message. + // + // The bytes of the message might be in the encoded or decoded form. + // Functions that take a |fidl_msg_t| as an argument should document whether + // the expect encoded or decoded messages. + // + // See |num_bytes| for the number of bytes in the message. + void* bytes; + + // The handles of the message. + // + // See |num_bytes| for the number of bytes in the message. + zx_handle_t* handles; + + // The number of bytes in |bytes|. + uint32_t num_bytes; + + // The number of handles in |handles|. + uint32_t num_handles; +} fidl_msg_t; + +// An outstanding FIDL transaction. +typedef struct fidl_txn fidl_txn_t; +struct fidl_txn { + // Replies to the outstanding request and complete the FIDL transaction. + // + // Pass the |fidl_txn_t| object itself as the first parameter. The |msg| + // should already be encoded. This function always consumes any handles + // present in |msg|. + // + // Call |reply| only once for each |txn| object. After |reply| returns, the + // |txn| object is considered invalid and might have been freed or reused + // for another purpose. + zx_status_t (*reply)(fidl_txn_t* txn, const fidl_msg_t* msg); +}; + +// An epitaph is a message that a server sends just prior to closing the +// connection. It provides an indication of why the connection is being closed. +// Epitaphs are defined in the FIDL wire format specification. Once sent down +// the wire, the channel should be closed. +typedef struct fidl_epitaph { + FIDL_ALIGNDECL + + // The method ordinal for all epitaphs must be kFidlOrdinalEpitaph + fidl_message_header_t hdr; + + // The error associated with this epitaph is stored as a struct{int32} in + // the message payload. System errors must be constants of type zx_status_t, + // which are all negative. Positive numbers should be used for application + // errors. A value of ZX_OK indicates no error. + zx_status_t error; +} fidl_epitaph_t; + +// This ordinal value is reserved for Epitaphs. +enum { + kFidlOrdinalEpitaph = 0xFFFFFFFFFFFFFFFF, +}; + +// Assumptions. + +// Ensure that FIDL_ALIGNMENT is sufficient. +static_assert(alignof(bool) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int8_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int16_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int32_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(int64_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint8_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint16_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint32_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(uint64_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(float) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(double) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(void*) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(fidl_union_tag_t) <= FIDL_ALIGNMENT, ""); +static_assert(alignof(fidl_message_header_t) <= FIDL_ALIGNMENT, ""); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_FIDL_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/gpt.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/gpt.h new file mode 100644 index 0000000..005415c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/gpt.h
@@ -0,0 +1,300 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_GPT_H_ +#define SYSROOT_ZIRCON_HW_GPT_H_ + +#include <assert.h> +#include <stdbool.h> +#include <stdint.h> +#include <zircon/compiler.h> + +#define GPT_MAGIC (0x5452415020494645ull) // 'EFI PART' +#define GPT_HEADER_SIZE 0x5c +#define GPT_ENTRY_SIZE 0x80 +#define GPT_GUID_LEN 16 +#define GPT_GUID_STRLEN 37 +#define GPT_NAME_LEN 72 + +typedef struct gpt_header { + uint64_t magic; // Magic number. + uint32_t revision; // Revision. + uint32_t size; // Size of the header. + uint32_t crc32; // Checksum of this header. + uint32_t reserved0; // Reserved field. + uint64_t current; // Block where this table is stored. + uint64_t backup; // Block where other copy of partition table is stored. + uint64_t first; // First usable block. Block after primary partition table ends. + uint64_t last; // Last usable block. Block before backup partition table starts. + uint8_t guid[GPT_GUID_LEN]; // Disk GUID. + uint64_t entries; // Starting block where entries for this partition tables are found. + // Value equals 2 for primary copy. + uint32_t entries_count; // Total number of entries. + uint32_t entries_size; // Size of each entry. + uint32_t entries_crc; // Checksum of the entire entries array. +} __PACKED gpt_header_t; + +static_assert(GPT_HEADER_SIZE == sizeof(gpt_header_t), "Gpt header size invalid"); + +typedef struct gpt_entry { + uint8_t type[GPT_GUID_LEN]; + uint8_t guid[GPT_GUID_LEN]; + uint64_t first; + uint64_t last; + uint64_t flags; + uint8_t name[GPT_NAME_LEN]; // UTF-16 on disk +} gpt_entry_t; + +static_assert(GPT_ENTRY_SIZE == sizeof(gpt_entry_t), "Gpt entry size invalid"); + +// clang-format off +#define GUID_EMPTY_STRING "00000000-0000-0000-0000-000000000000" +#define GUID_EMPTY_VALUE { \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, \ + 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ +} +#define GUID_EMPTY_NAME "empty" + +#define GUID_EFI_STRING "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" +#define GUID_EFI_VALUE { \ + 0x28, 0x73, 0x2a, 0xc1, \ + 0x1f, 0xf8, \ + 0xd2, 0x11, \ + 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b \ +} +#define GUID_EFI_NAME "efi-system" + +// GUID for a system partition +#define GUID_SYSTEM_STRING "606B000B-B7C7-4653-A7D5-B737332C899D" +#define GUID_SYSTEM_VALUE { \ + 0x0b, 0x00, 0x6b, 0x60, \ + 0xc7, 0xb7, \ + 0x53, 0x46, \ + 0xa7, 0xd5, 0xb7, 0x37, 0x33, 0x2c, 0x89, 0x9d \ +} +#define GUID_SYSTEM_NAME "fuchsia-system" + +// GUID for a data partition +#define GUID_DATA_STRING "08185F0C-892D-428A-A789-DBEEC8F55E6A" +#define GUID_DATA_VALUE { \ + 0x0c, 0x5f, 0x18, 0x08, \ + 0x2d, 0x89, \ + 0x8a, 0x42, \ + 0xa7, 0x89, 0xdb, 0xee, 0xc8, 0xf5, 0x5e, 0x6a \ +} +#define GUID_DATA_NAME "fuchsia-data" + +// GUID for a installer partition +#define GUID_INSTALL_STRING "48435546-4953-2041-494E-5354414C4C52" +#define GUID_INSTALL_VALUE { \ + 0x46, 0x55, 0x43, 0x48, \ + 0x53, 0x49, \ + 0x41, 0x20, \ + 0x49, 0x4E, 0x53, 0x54, 0x41, 0x4C, 0x4C, 0x52 \ +} +#define GUID_INSTALL_NAME "fuchsia-install" + +#define GUID_BLOB_STRING "2967380E-134C-4CBB-B6DA-17E7CE1CA45D" +#define GUID_BLOB_VALUE { \ + 0x0e, 0x38, 0x67, 0x29, \ + 0x4c, 0x13, \ + 0xbb, 0x4c, \ + 0xb6, 0xda, 0x17, 0xe7, 0xce, 0x1c, 0xa4, 0x5d \ +} +#define GUID_BLOB_NAME "fuchsia-blob" + +#define GUID_FVM_STRING "41D0E340-57E3-954E-8C1E-17ECAC44CFF5" +#define GUID_FVM_VALUE { \ + 0x40, 0xe3, 0xd0, 0x41, \ + 0xe3, 0x57, \ + 0x4e, 0x95, \ + 0x8c, 0x1e, 0x17, 0xec, 0xac, 0x44, 0xcf, 0xf5 \ +} +#define GUID_FVM_NAME "fuchsia-fvm" + +#define GUID_ZIRCON_A_STRING "DE30CC86-1F4A-4A31-93C4-66F147D33E05" +#define GUID_ZIRCON_A_VALUE { \ + 0x86, 0xcc, 0x30, 0xde, \ + 0x4a, 0x1f, \ + 0x31, 0x4a, \ + 0x93, 0xc4, 0x66, 0xf1, 0x47, 0xd3, 0x3e, 0x05, \ +} +#define GUID_ZIRCON_A_NAME "zircon-a" + +#define GUID_ZIRCON_B_STRING "23CC04DF-C278-4CE7-8471-897D1A4BCDF7" +#define GUID_ZIRCON_B_VALUE { \ + 0xdf, 0x04, 0xcc, 0x23, \ + 0x78, 0xc2, \ + 0xe7, 0x4c, \ + 0x84, 0x71, 0x89, 0x7d, 0x1a, 0x4b, 0xcd, 0xf7 \ +} +#define GUID_ZIRCON_B_NAME "zircon-b" + +#define GUID_ZIRCON_R_STRING "A0E5CF57-2DEF-46BE-A80C-A2067C37CD49" +#define GUID_ZIRCON_R_VALUE { \ + 0x57, 0xcf, 0xe5, 0xa0, \ + 0xef, 0x2d, \ + 0xbe, 0x46, \ + 0xa8, 0x0c, 0xa2, 0x06, 0x7c, 0x37, 0xcd, 0x49 \ +} +#define GUID_ZIRCON_R_NAME "zircon-r" + +#define GUID_SYS_CONFIG_STRING "4E5E989E-4C86-11E8-A15B-480FCF35F8E6" +#define GUID_SYS_CONFIG_VALUE { \ + 0x9e, 0x98, 0x5e, 0x4e, \ + 0x86, 0x4c, \ + 0xe8, 0x11, \ + 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ +} +#define GUID_SYS_CONFIG_NAME "sys-config" + +#define GUID_FACTORY_CONFIG_STRING "5A3A90BE-4C86-11E8-A15B-480FCF35F8E6" +#define GUID_FACTORY_CONFIG_VALUE { \ + 0xbe, 0x90, 0x3a, 0x5a, \ + 0x86, 0x4c, \ + 0xe8, 0x11, \ + 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ +} +#define GUID_FACTORY_CONFIG_NAME "factory" + +#define GUID_BOOTLOADER_STRING "5ECE94FE-4C86-11E8-A15B-480FCF35F8E6" +#define GUID_BOOTLOADER_VALUE { \ + 0xfe, 0x94, 0xce, 0x5e, \ + 0x86, 0x4c, \ + 0xe8, 0x11, \ + 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ +} +#define GUID_BOOTLOADER_NAME "bootloader" + +#define GUID_TEST_STRING "8B94D043-30BE-4871-9DFA-D69556E8C1F3" +#define GUID_TEST_VALUE { \ + 0x43, 0xD0, 0x94, 0x8b, \ + 0xbe, 0x30, \ + 0x71, 0x48, \ + 0x9d, 0xfa, 0xd6, 0x95, 0x56, 0xe8, 0xc1, 0xf3 \ +} +#define GUID_TEST_NAME "guid-test" + +#define GUID_VBMETA_A_STRING "A13B4D9A-EC5F-11E8-97D8-6C3BE52705BF" +#define GUID_VBMETA_A_VALUE { \ + 0x9a, 0x4d, 0x3b, 0xa1, \ + 0x5f, 0xec, \ + 0xe8, 0x11, \ + 0x97, 0xd8, 0x6c, 0x3b, 0xe5, 0x27, 0x05, 0xbf \ +} +#define GUID_VBMETA_A_NAME "vbmeta_a" + +#define GUID_VBMETA_B_STRING "A288ABF2-EC5F-11E8-97D8-6C3BE52705BF" +#define GUID_VBMETA_B_VALUE { \ + 0xf2, 0xab, 0x88, 0xa2, \ + 0x5f, 0xec, \ + 0xe8, 0x11, \ + 0x97, 0xd8, 0x6c, 0x3b, 0xe5, 0x27, 0x05, 0xbf \ +} +#define GUID_VBMETA_B_NAME "vbmeta_b" + +#define GUID_VBMETA_R_STRING "6A2460C3-CD11-4E8B-80A8-12CCE268ED0A" +#define GUID_VBMETA_R_VALUE { \ + 0xc3, 0x60, 0x24, 0x6a, \ + 0x11, 0xcd, \ + 0x8b, 0x4e, \ + 0x80, 0xa8, 0x12, 0xcc, 0xe2, 0x68, 0xed, 0x0a \ +} +#define GUID_VBMETA_R_NAME "vbmeta_r" + +#define GUID_ABR_META_STRING "1D75395D-F2C6-476B-A8B7-45CC1C97B476" +#define GUID_ABR_META_VALUE { \ + 0x5d, 0x39, 0x75, 0x1d, \ + 0xc6, 0xf2, \ + 0x6b, 0x47, \ + 0xa8, 0xb7, 0x45, 0xcc, 0x1c, 0x97, 0xb4, 0x76 \ +} +#define GUID_ABR_META_NAME "misc" + +#define GUID_CROS_KERNEL_STRING "FE3A2A5D-4F32-41A7-B725-ACCC3285A309" +#define GUID_CROS_KERNEL_VALUE { \ + 0x5d, 0x2a, 0x3a, 0xfe, \ + 0x32, 0x4f, \ + 0xa7, 0x41, \ + 0xb7, 0x25, 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 \ +} +#define GUID_CROS_KERNEL_NAME "cros-kernel" + +#define GUID_CROS_ROOTFS_STRING "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC" +#define GUID_CROS_ROOTFS_VALUE { \ + 0x02, 0xe2, 0xb8, 0x3C, \ + 0x7e, 0x3b, \ + 0xdd, 0x47, \ + 0x8a, 0x3c, 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec \ +} +#define GUID_CROS_ROOTFS_NAME "cros-rootfs" + +#define GUID_CROS_RESERVED_STRING "2E0A753D-9E48-43B0-8337-B15192CB1B5E" +#define GUID_CROS_RESERVED_VALUE { \ + 0x3d, 0x75, 0x0a, 0x2e, \ + 0x48, 0x9e, \ + 0xb0, 0x43, \ + 0x83, 0x37, 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e \ +} +#define GUID_CROS_RESERVED_NAME "cros-reserved" + +#define GUID_CROS_FIRMWARE_STRING "CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3" +#define GUID_CROS_FIRMWARE_VALUE { \ + 0x8e, 0xe8, 0xb6, 0xca, \ + 0xf3, 0xab, \ + 0x02, 0x41, \ + 0xa0, 0x7a, 0xd4, 0xbb, 0x9b, 0xe3, 0xc1, 0xd3 \ +} +#define GUID_CROS_FIRMWARE_NAME "cros-firmware" + +#define GUID_CROS_DATA_STRING "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" +#define GUID_CROS_DATA_VALUE { \ + 0xa2, 0xa0, 0xd0, 0xeb, \ + 0xe5, 0xb9, \ + 0x33, 0x44, \ + 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 \ +} +#define GUID_CROS_DATA_NAME "cros-data" + +#define GUID_BIOS_STRING "21686148-6449-6E6F-744E-656564454649" +#define GUID_BIOS_VALUE { \ + 0x48, 0x61, 0x68, 0x21, \ + 0x49, 0x64, \ + 0x6f, 0x6e, \ + 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 \ +} +#define GUID_BIOS_NAME "bios" + +#define GUID_EMMC_BOOT1_STRING "900B0FC5-90CD-4D4F-84F9-9F8ED579DB88" +#define GUID_EMMC_BOOT1_VALUE { \ + 0xc5, 0x0f, 0x0b, 0x90, \ + 0xcd, 0x90, \ + 0x4f, 0x4d, \ + 0x84, 0xf9, 0x9f, 0x8e, 0xd5, 0x79, 0xdb, 0x88 \ +} +#define GUID_EMMC_BOOT1_NAME "emmc-boot1" + +#define GUID_EMMC_BOOT2_STRING "B2B2E8D1-7C10-4EBC-A2D0-4614568260AD" +#define GUID_EMMC_BOOT2_VALUE { \ + 0xd1, 0xe8, 0xb2, 0xb2, \ + 0x10, 0x7c, \ + 0xbc, 0x4e, \ + 0xa2, 0xd0, 0x46, 0x14, 0x56, 0x82, 0x60, 0xad \ +} +#define GUID_EMMC_BOOT2_NAME "emmc-boot2" + +#define GUID_LINUX_FILESYSTEM_DATA_STRING "0FC63DAF-8483-4772-8E79-3D69D8477DE4" +#define GUID_LINUX_FILESYSTEM_DATA_VALUE { \ + 0xaf, 0x3d, 0xc6, 0x0f, \ + 0x83, 0x84, \ + 0x72, 0x47, \ + 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4 \ +} +#define GUID_LINUX_FILESYSTEM_DATA_NAME "linux-filesystem" + +// clang-format on + +#endif // SYSROOT_ZIRCON_HW_GPT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/i2c.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/i2c.h new file mode 100644 index 0000000..e35b6f1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/i2c.h
@@ -0,0 +1,10 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_I2C_H_ +#define SYSROOT_ZIRCON_HW_I2C_H_ + +#define I2C_CLASS_HID 1 + +#endif // SYSROOT_ZIRCON_HW_I2C_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/pci.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/pci.h new file mode 100644 index 0000000..7de1bca --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/pci.h
@@ -0,0 +1,50 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_PCI_H_ +#define SYSROOT_ZIRCON_HW_PCI_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// Structure for passing around PCI address information +typedef struct pci_bdf { + uint8_t bus_id; + uint8_t device_id; + uint8_t function_id; +} pci_bdf_t; + +// TODO(cja): This header is used for the transition of these defines from +// kernel to userspace, but due to pci_bdf_t some of the kernel includes it. +// Make sure defines here don't clash with those in pci_common.h by having this +// guard, but remove it after the transition. +#ifndef WITH_KERNEL_PCIE + +#define PCI_MAX_BUSES (256u) +#define PCI_MAX_DEVICES_PER_BUS (32u) +#define PCI_MAX_FUNCTIONS_PER_DEVICE (8u) +#define PCI_MAX_FUNCTIONS_PER_BUS (PCI_MAX_DEVICES_PER_BUS * PCI_MAX_FUNCTIONS_PER_DEVICE) + +#define PCI_STANDARD_CONFIG_HDR_SIZE (64u) +#define PCI_BASE_CONFIG_SIZE (256u) +#define PCIE_EXTENDED_CONFIG_SIZE (4096u) +#define PCIE_ECAM_BYTES_PER_BUS (PCIE_EXTENDED_CONFIG_SIZE * PCI_MAX_FUNCTIONS_PER_BUS) + +#define PCI_BAR_REGS_PER_BRIDGE (2u) +#define PCI_BAR_REGS_PER_DEVICE (6u) +#define PCI_MAX_BAR_REGS (6u) + +#define PCI_MAX_LEGACY_IRQ_PINS (4u) +#define PCI_MAX_MSI_IRQS (32u) +#define PCIE_MAX_MSIX_IRQS (2048u) + +#define PCI_INVALID_VENDOR_ID (0xFFFF) + +#endif // WITH_KERNEL_PCIE + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_PCI_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb.h new file mode 100644 index 0000000..8256c2e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb.h
@@ -0,0 +1,281 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_H_ +#define SYSROOT_ZIRCON_HW_USB_H_ + +// clang-format off + +#include <endian.h> +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// maximum number of endpoints per device +#define USB_MAX_EPS 32 + +/* Request Types */ +#define USB_DIR_OUT (0 << 7) +#define USB_DIR_IN (1 << 7) +#define USB_DIR_MASK (1 << 7) +#define USB_TYPE_STANDARD (0 << 5) +#define USB_TYPE_CLASS (1 << 5) +#define USB_TYPE_VENDOR (2 << 5) +#define USB_TYPE_MASK (3 << 5) +#define USB_RECIP_DEVICE (0 << 0) +#define USB_RECIP_INTERFACE (1 << 0) +#define USB_RECIP_ENDPOINT (2 << 0) +#define USB_RECIP_OTHER (3 << 0) +#define USB_RECIP_MASK (0x1f << 0) + +/* 1.0 Request Values */ +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +#define USB_REQ_SET_FEATURE 0x03 +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIGURATION 0x08 +#define USB_REQ_SET_CONFIGURATION 0x09 +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C + +/* USB device/interface classes */ +#define USB_CLASS_AUDIO 0x01 +#define USB_CLASS_COMM 0x02 +#define USB_CLASS_HID 0x03 +#define USB_CLASS_PHYSICAL 0x05 +#define USB_CLASS_IMAGING 0x06 +#define USB_CLASS_PRINTER 0x07 +#define USB_CLASS_MSC 0x08 +#define USB_CLASS_HUB 0x09 +#define USB_CLASS_CDC 0x0a +#define USB_CLASS_CCID 0x0b +#define USB_CLASS_SECURITY 0x0d +#define USB_CLASS_VIDEO 0x0e +#define USB_CLASS_HEALTHCARE 0x0f +#define USB_CLASS_DIAGNOSTIC 0xdc +#define USB_CLASS_WIRELESS 0xe0 +#define USB_CLASS_MISC 0xef +#define USB_CLASS_APPLICATION_SPECIFIC 0xfe +#define USB_CLASS_VENDOR 0xFf + +#define USB_SUBCLASS_MSC_SCSI 0x06 +#define USB_PROTOCOL_MSC_BULK_ONLY 0x50 + +#define USB_SUBCLASS_DFU 0x01 +#define USB_PROTOCOL_DFU 0x02 + +#define USB_SUBCLASS_VENDOR 0xFF +#define USB_PROTOCOL_TEST_FTDI 0x01 +#define USB_PROTOCOL_TEST_HID_ONE_ENDPOINT 0x02 +#define USB_PROTOCOL_TEST_HID_TWO_ENDPOINT 0x03 + +/* Descriptor Types */ +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 +#define USB_DT_DEVICE_QUALIFIER 0x06 +#define USB_DT_OTHER_SPEED_CONFIG 0x07 +#define USB_DT_INTERFACE_POWER 0x08 +#define USB_DT_INTERFACE_ASSOCIATION 0x0b +#define USB_DT_HID 0x21 +#define USB_DT_HIDREPORT 0x22 +#define USB_DT_HIDPHYSICAL 0x23 +#define USB_DT_CS_INTERFACE 0x24 +#define USB_DT_CS_ENDPOINT 0x25 +#define USB_DT_SS_EP_COMPANION 0x30 +#define USB_DT_SS_ISOCH_EP_COMPANION 0x31 + +/* USB device feature selectors */ +#define USB_DEVICE_SELF_POWERED 0x00 +#define USB_DEVICE_REMOTE_WAKEUP 0x01 +#define USB_DEVICE_TEST_MODE 0x02 + +/* Configuration attributes (bmAttributes) */ +#define USB_CONFIGURATION_REMOTE_WAKEUP 0x20 +#define USB_CONFIGURATION_SELF_POWERED 0x40 +#define USB_CONFIGURATION_RESERVED_7 0x80 // This bit must be set + +/* Endpoint direction (bEndpointAddress) */ +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 +#define USB_ENDPOINT_DIR_MASK 0x80 +#define USB_ENDPOINT_NUM_MASK 0x1F + +/* Endpoint types (bmAttributes) */ +#define USB_ENDPOINT_CONTROL 0x00 +#define USB_ENDPOINT_ISOCHRONOUS 0x01 +#define USB_ENDPOINT_BULK 0x02 +#define USB_ENDPOINT_INTERRUPT 0x03 +#define USB_ENDPOINT_TYPE_MASK 0x03 + +/* Endpoint synchronization type (bmAttributes) */ +#define USB_ENDPOINT_NO_SYNCHRONIZATION 0x00 +#define USB_ENDPOINT_ASYNCHRONOUS 0x04 +#define USB_ENDPOINT_ADAPTIVE 0x08 +#define USB_ENDPOINT_SYNCHRONOUS 0x0C +#define USB_ENDPOINT_SYNCHRONIZATION_MASK 0x0C + +/* Endpoint usage type (bmAttributes) */ +#define USB_ENDPOINT_DATA 0x00 +#define USB_ENDPOINT_FEEDBACK 0x10 +#define USB_ENDPOINT_IMPLICIT_FEEDBACK 0x20 +#define USB_ENDPOINT_USAGE_MASK 0x30 + +#define USB_ENDPOINT_HALT 0x00 + +// Values in this set match those used in XHCI and other parts of the USB specification +#define USB_SPEED_UNDEFINED 0 +#define USB_SPEED_FULL 1 +#define USB_SPEED_LOW 2 +#define USB_SPEED_HIGH 3 +#define USB_SPEED_SUPER 4 +typedef uint32_t usb_speed_t; + +/* general USB defines */ +typedef struct { + uint8_t bmRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} __attribute__ ((packed)) usb_setup_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; +} __attribute__ ((packed)) usb_descriptor_header_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_DEVICE + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; +} __attribute__ ((packed)) usb_device_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CONFIG + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; +} __attribute__ ((packed)) usb_configuration_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_STRING + uint8_t bString[]; +} __attribute__ ((packed)) usb_string_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_INTERFACE + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; +} __attribute__ ((packed)) usb_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_ENDPOINT + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; +} __attribute__ ((packed)) usb_endpoint_descriptor_t; +#define usb_ep_num(ep) ((ep)->bEndpointAddress & USB_ENDPOINT_NUM_MASK) +// usb_ep_num2() useful with you have bEndpointAddress outside of a descriptor. +#define usb_ep_num2(addr) ((addr) & USB_ENDPOINT_NUM_MASK) +#define usb_ep_direction(ep) ((ep)->bEndpointAddress & USB_ENDPOINT_DIR_MASK) +#define usb_ep_type(ep) ((ep)->bmAttributes & USB_ENDPOINT_TYPE_MASK) +#define usb_ep_sync_type(ep) ((ep)->bmAttributes & USB_ENDPOINT_SYNCHRONIZATION_MASK) +// max packet size is in bits 10..0 +#define usb_ep_max_packet(ep) (le16toh((ep)->wMaxPacketSize) & 0x07FF) +// for high speed interrupt and isochronous endpoints, additional transactions per microframe +// are in bits 12..11 +#define usb_ep_add_mf_transactions(ep) ((le16toh((ep)->wMaxPacketSize) >> 11) & 3) + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_DEVICE_QUALIFIER + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint8_t bNumConfigurations; + uint8_t bReserved; +} __attribute__ ((packed)) usb_device_qualifier_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_SS_EP_COMPANION + uint8_t bMaxBurst; + uint8_t bmAttributes; + uint16_t wBytesPerInterval; +} __attribute__ ((packed)) usb_ss_ep_comp_descriptor_t; +#define usb_ss_ep_comp_isoc_mult(ep) ((ep)->bmAttributes & 0x3) +#define usb_ss_ep_comp_isoc_comp(ep) (!!((ep)->bmAttributes & 0x80)) + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_SS_ISOCH_EP_COMPANION + uint16_t wReserved; + uint32_t dwBytesPerInterval; +} __attribute__ ((packed)) usb_ss_isoch_ep_comp_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_INTERFACE_ASSOCIATION + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; +} __attribute__ ((packed)) usb_interface_assoc_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; +} __attribute__ ((packed)) usb_cs_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_STRING + uint16_t wLangIds[127]; +} __attribute__ ((packed)) usb_langid_desc_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_STRING + uint16_t code_points[127]; +} __attribute__ ((packed)) usb_string_desc_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/audio.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/audio.h new file mode 100644 index 0000000..4e68f87 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/audio.h
@@ -0,0 +1,527 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_AUDIO_H_ +#define SYSROOT_ZIRCON_HW_USB_AUDIO_H_ + +// clang-format off + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +//////////////////////////////////////////////////// +// +// General Audio interface constants +// +//////////////////////////////////////////////////// + +// audio interface subclasses +#define USB_SUBCLASS_AUDIO_CONTROL 0x01 +#define USB_SUBCLASS_AUDIO_STREAMING 0x02 +#define USB_SUBCLASS_MIDI_STREAMING 0x03 + +// audio class specific descriptor types +#define USB_AUDIO_CS_DEVICE 0x21 +#define USB_AUDIO_CS_CONFIGURATION 0x22 +#define USB_AUDIO_CS_STRING 0x23 +#define USB_AUDIO_CS_INTERFACE 0x24 +#define USB_AUDIO_CS_ENDPOINT 0x25 + +//////////////////////////////////////////////////// +// +// Audio Control interface constants +// +//////////////////////////////////////////////////// + +// audio class specific AC interface descriptor subtypes +#define USB_AUDIO_AC_HEADER 0x01 +#define USB_AUDIO_AC_INPUT_TERMINAL 0x02 +#define USB_AUDIO_AC_OUTPUT_TERMINAL 0x03 +#define USB_AUDIO_AC_MIXER_UNIT 0x04 +#define USB_AUDIO_AC_SELECTOR_UNIT 0x05 +#define USB_AUDIO_AC_FEATURE_UNIT 0x06 +#define USB_AUDIO_AC_PROCESSING_UNIT 0x07 +#define USB_AUDIO_AC_EXTENSION_UNIT 0x08 + +// processing unit process types +#define USB_AUDIO_UP_DOWN_MIX_PROCESS 0x01 +#define USB_AUDIO_DOLBY_PROLOGIC_PROCESS 0x02 +#define USB_AUDIO_3D_STEREO_EXTENDER_PROCESS 0x03 +#define USB_AUDIO_REVERBERATION_PROCESS 0x04 +#define USB_AUDIO_CHORUS_PROCESS 0x05 +#define USB_AUDIO_DYN_RANGE_COMP_PROCESS 0x06 + +// audio class specific endpoint descriptor subtypes +#define USB_AUDIO_EP_GENERAL 0x01 + +// audio class specific request codes +#define USB_AUDIO_SET_CUR 0x01 +#define USB_AUDIO_GET_CUR 0x81 +#define USB_AUDIO_SET_MIN 0x02 +#define USB_AUDIO_GET_MIN 0x82 +#define USB_AUDIO_SET_MAX 0x03 +#define USB_AUDIO_GET_MAX 0x83 +#define USB_AUDIO_SET_RES 0x04 +#define USB_AUDIO_GET_RES 0x84 +#define USB_AUDIO_SET_MEM 0x05 +#define USB_AUDIO_GET_MEM 0x85 +#define USB_AUDIO_GET_STAT 0xFF + +// terminal control selectors +#define USB_AUDIO_COPY_PROTECT_CONTROL 0x01 + +// feature unit control selectors +#define USB_AUDIO_MUTE_CONTROL 0x01 +#define USB_AUDIO_VOLUME_CONTROL 0x02 +#define USB_AUDIO_BASS_CONTROL 0x03 +#define USB_AUDIO_MID_CONTROL 0x04 +#define USB_AUDIO_TREBLE_CONTROL 0x05 +#define USB_AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06 +#define USB_AUDIO_AUTOMATIC_GAIN_CONTROL 0x07 +#define USB_AUDIO_DELAY_CONTROL 0x08 +#define USB_AUDIO_BASS_BOOST_CONTROL 0x09 +#define USB_AUDIO_LOUDNESS_CONTROL 0x0A + +// feature unit control support bitmasks +#define USB_AUDIO_FU_BMA_MUTE (1u << 0u) +#define USB_AUDIO_FU_BMA_VOLUME (1u << 1u) +#define USB_AUDIO_FU_BMA_BASS (1u << 2u) +#define USB_AUDIO_FU_BMA_MID (1u << 3u) +#define USB_AUDIO_FU_BMA_TREBLE (1u << 4u) +#define USB_AUDIO_FU_BMA_GRAPHIC_EQUALIZER (1u << 5u) +#define USB_AUDIO_FU_BMA_AUTOMATIC_GAIN (1u << 6u) +#define USB_AUDIO_FU_BMA_DELAY (1u << 7u) +#define USB_AUDIO_FU_BMA_BASS_BOOST (1u << 8u) +#define USB_AUDIO_FU_BMA_LOUDNESS (1u << 9u) + +// up/down mix processing unit control selectors +#define USB_AUDIO_UD_ENABLE_CONTROL 0x01 +#define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02 +#define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02 + +// Dolby Prologic processing unit control selectors +#define USB_AUDIO_DP_ENABLE_CONTROL 0x01 +#define USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02 + +// 3D stereo extender processing unit control selectors +#define USB_AUDIO_3D_ENABLE_CONTROL 0x01 +#define USB_AUDIO_SPACIOUSNESS_CONTROL 0x03 + +// reverberation processing unit control selectors +#define USB_AUDIO_RV_ENABLE_CONTROL 0x01 +#define USB_AUDIO_REVERB_LEVEL_CONTROL 0x02 +#define USB_AUDIO_REVERB_TIME_CONTROL 0x03 +#define USB_AUDIO_REVERB_FEEDBACK_CONTROL 0x04 + +// chorus processing unit control selectors +#define USB_AUDIO_CH_ENABLE_CONTROL 0x01 +#define USB_AUDIO_CHORUS_LEVEL_CONTROL 0x02 +#define USB_AUDIO_CHORUS_RATE_CONTROL 0x03 +#define USB_AUDIO_CHORUS_DEPTH_CONTROL 0x04 + +// dynamic range compressor processing unit control selectors +#define USB_AUDIO_DR_ENABLE_CONTROL 0x01 +#define USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02 +#define USB_AUDIO_MAXAMPL_CONTROL 0x03 +#define USB_AUDIO_THRESHOLD_CONTROL 0x04 +#define USB_AUDIO_ATTACK_TIME 0x05 +#define USB_AUDIO_RELEASE_TIME 0x06 + +// extension unit control selectors +#define USB_AUDIO_XU_ENABLE_CONTROL 0x01 + +// endpoint control selectors +#define USB_AUDIO_SAMPLING_FREQ_CONTROL 0x01 +#define USB_AUDIO_PITCH_CONTROL 0x02 + +// USB audio terminal types +#define USB_AUDIO_TERMINAL_USB_UNDEFINED 0x0100 +#define USB_AUDIO_TERMINAL_USB_STREAMING 0x0101 +#define USB_AUDIO_TERMINAL_USB_VENDOR 0x01FF +#define USB_AUDIO_TERMINAL_INPUT_UNDEFINED 0x0200 +#define USB_AUDIO_TERMINAL_MICROPHONE 0x0201 +#define USB_AUDIO_TERMINAL_DESKTOP_MICROPHONE 0x0202 +#define USB_AUDIO_TERMINAL_PERSONAL_MICROPHONE 0x0203 +#define USB_AUDIO_TERMINAL_OMNI_DIRECTIONAL_MICROPHONE 0x0204 +#define USB_AUDIO_TERMINAL_MICROPHONE_ARRAY 0x0205 +#define USB_AUDIO_TERMINAL_PROCESSING_MICROPHONE_ARRAY 0x0206 +#define USB_AUDIO_TERMINAL_OUTPUT_UNDEFINED 0x0300 +#define USB_AUDIO_TERMINAL_SPEAKER 0x0301 +#define USB_AUDIO_TERMINAL_HEADPHONES 0x0302 +#define USB_AUDIO_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x0303 +#define USB_AUDIO_TERMINAL_DESKTOP_SPEAKER 0x0304 +#define USB_AUDIO_TERMINAL_ROOM_SPEAKER 0x0305 +#define USB_AUDIO_TERMINAL_COMMUNICATION_SPEAKER 0x0306 +#define USB_AUDIO_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x0307 +#define USB_AUDIO_TERMINAL_BIDIRECTIONAL_UNDEFINED 0x0400 +#define USB_AUDIO_TERMINAL_HANDSET 0x0401 +#define USB_AUDIO_TERMINAL_HEADSET 0x0402 +#define USB_AUDIO_TERMINAL_SPEAKERPHONE 0x0403 +#define USB_AUDIO_TERMINAL_ECHO_SUPPRESSING_SPEAKERPHONE 0x0404 +#define USB_AUDIO_TERMINAL_ECHO_CANCELING_SPEAKERPHONE 0x0405 +#define USB_AUDIO_TERMINAL_TELEPHONY_UNDEFINED 0x0500 +#define USB_AUDIO_TERMINAL_PHONE_LINE 0x0501 +#define USB_AUDIO_TERMINAL_TELEPHONE 0x0502 +#define USB_AUDIO_TERMINAL_DOWN_LINE_PHONE 0x0503 +#define USB_AUDIO_TERMINAL_EXTERNAL_UNDEFINED 0x0600 +#define USB_AUDIO_TERMINAL_ANALOG_CONNECTOR 0x0601 +#define USB_AUDIO_TERMINAL_DIGITAL_AUDIO_INTERFACE 0x0602 +#define USB_AUDIO_TERMINAL_LINE_CONNECTOR 0x0603 +#define USB_AUDIO_TERMINAL_LEGACY_AUDIO_CONNECTOR 0x0604 +#define USB_AUDIO_TERMINAL_SPDIF_INTERFACE 0x0605 +#define USB_AUDIO_TERMINAL_1394_DA_STREAM 0x0606 +#define USB_AUDIO_TERMINAL_1394_DV_STREAM_SOUNDTRACK 0x0607 +#define USB_AUDIO_TERMINAL_EMBEDDED_UNDEFINED 0x0700 +#define USB_AUDIO_TERMINAL_LEVEL_CALIBRATION_NOISE_SOURCE 0x0701 +#define USB_AUDIO_TERMINAL_EQUALIZATION_NOISE 0x0702 +#define USB_AUDIO_TERMINAL_CD_PLAYER 0x0703 +#define USB_AUDIO_TERMINAL_DAT 0x0704 +#define USB_AUDIO_TERMINAL_DCC 0x0705 +#define USB_AUDIO_TERMINAL_MINI_DISK 0x0706 +#define USB_AUDIO_TERMINAL_ANALOG_TAPE 0x0707 +#define USB_AUDIO_TERMINAL_PHONOGRAPH 0x0708 +#define USB_AUDIO_TERMINAL_VCR_AUDIO 0x0709 +#define USB_AUDIO_TERMINAL_VIDEO_DISK_AUDIO 0x070A +#define USB_AUDIO_TERMINAL_DVD_AUDIO 0x070B +#define USB_AUDIO_TERMINAL_TV_TUNER_AUDIO 0x070C +#define USB_AUDIO_TERMINAL_SATELLITE_RECEIVER_AUDIO 0x070D +#define USB_AUDIO_TERMINAL_CABLE_TUNER_AUDIO 0x070E +#define USB_AUDIO_TERMINAL_DSS_AUDIO 0x070F +#define USB_AUDIO_TERMINAL_RADIO_RECEIVER 0x0710 +#define USB_AUDIO_TERMINAL_RADIO_TRANSMITTER 0x0711 +#define USB_AUDIO_TERMINAL_MULTI_TRACK_RECORDER 0x0712 +#define USB_AUDIO_TERMINAL_SYNTHESIZER 0x0713 + +//////////////////////////////////////////////////// +// +// Audio streaming interface constants +// +//////////////////////////////////////////////////// + +// Audio stream class-specific AS interface descriptor subtypes +#define USB_AUDIO_AS_GENERAL 0x01 +#define USB_AUDIO_AS_FORMAT_TYPE 0x02 +#define USB_AUDIO_AS_FORMAT_SPECIFIC 0x03 + +// wFormatTag values present in the class specific AS header +// Defined in Section A.1 of USB Device Class Definition for Audio Data Formats +#define USB_AUDIO_AS_FT_TYPE_I_UNDEFINED 0x0000 +#define USB_AUDIO_AS_FT_PCM 0x0001 +#define USB_AUDIO_AS_FT_PCM8 0x0002 +#define USB_AUDIO_AS_FT_IEEE_FLOAT 0x0003 +#define USB_AUDIO_AS_FT_ALAW 0x0004 +#define USB_AUDIO_AS_FT_MULAW 0x0005 +#define USB_AUDIO_AS_FT_TYPE_II_UNDEFINED 0x1000 +#define USB_AUDIO_AS_FT_MPEG 0x1001 +#define USB_AUDIO_AS_FT_AC3 0x1002 +#define USB_AUDIO_AS_FT_TYPE_III_UNDEFINED 0x2000 +#define USB_AUDIO_AS_FT_IEC1937_AC3 0x2001 +#define USB_AUDIO_AS_FT_IEC1937_MPEG1_L1 0x2002 +#define USB_AUDIO_AS_FT_IEC1937_MPEG1_L23 0x2003 +#define USB_AUDIO_AS_FT_IEC1937_MPEG2_EXT 0x2004 +#define USB_AUDIO_AS_FT_IEC1937_MPEG2_L1_LS 0x2005 +#define USB_AUDIO_AS_FT_IEC1937_MPEG2_L23_LS 0x2006 + +// Audio stream class-specific format-specific types +#define USB_AUDIO_FORMAT_TYPE_UNDEFINED 0x00 +#define USB_AUDIO_FORMAT_TYPE_I 0x01 +#define USB_AUDIO_FORMAT_TYPE_II 0x02 +#define USB_AUDIO_FORMAT_TYPE_III 0x03 + +//////////////////////////////////////////////////// +// +// MIDI streaming interface constants +// +//////////////////////////////////////////////////// + +// MIDI class specific MS interface descriptor subtypes +#define USB_MIDI_MS_HEADER 0x01 +#define USB_MIDI_IN_JACK 0x02 +#define USB_MIDI_OUT_JACK 0x03 +#define USB_MIDI_ELEMENT 0x04 + +// MIDI class specific MS endpoint descriptor subtypes +#define USB_MIDI_MS_GENERAL 0x01 + +// MIDI IN and OUT jack types +#define USB_MIDI_JACK_EMBEDDED 0x01 +#define USB_MIDI_JACK_INTERNAL 0x02 + +// MIDI endpoint control selectors +#define USB_MIDI_ASSOCIATION_CONTROL 0x01 + + +// Top level header structure shared by all USB audio descriptors. +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; +} __PACKED usb_audio_desc_header; + +// Audio Control Interface descriptor definitions +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_HEADER + uint16_t bcdADC; + uint16_t wTotalLength; + uint8_t bInCollection; + uint8_t baInterfaceNr[]; +} __PACKED usb_audio_ac_header_desc; + +// Common header structure shared by all unit and terminal descriptors found in +// an Audio Control interface descriptor. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_.*_(TERMINAL|UNIT) + uint8_t bID; +} __PACKED usb_audio_ac_ut_desc; + +// Common header structure shared by all terminal descriptors found in an Audio +// Control interface descriptor. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_(INPUT|OUTPUT)_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; +} __PACKED usb_audio_ac_terminal_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_INPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t iTerminal; +} __PACKED usb_audio_ac_input_terminal_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_OUTPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t bSourceID; + uint8_t iTerminal; +} __PACKED usb_audio_ac_output_terminal_desc; + +// Note: Mixer unit descriptors contain two inlined variable length arrays, each +// with descriptor data following them. They are therefor described using 3 +// structure definitions which are logically concatenated, but separated by the +// inline arrays. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_MIXER_UNIT + uint8_t bUnitID; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_mixer_unit_desc_0; + +typedef struct { + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t bmControls[]; +} __PACKED usb_audio_ac_mixer_unit_desc_1; + +typedef struct { + uint8_t iMixer; +} __PACKED usb_audio_ac_mixer_unit_desc_2; + +// Note: Selector unit descriptors contain an inlined variable length array with +// descriptor data following it. They are therefor described using 2 structure +// definitions which are logically concatenated, but separated by the inline +// array. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_SELECTOR_UNIT + uint8_t bUnitID; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_selector_unit_desc_0; + +typedef struct { + uint8_t iSelector; +} __PACKED usb_audio_ac_selector_unit_desc_1; + +// Note: Feature unit descriptors contain an inlined variable length array with +// descriptor data following it. They are therefor described using 2 structure +// definitions which are logically concatenated, but separated by the inline +// array. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_FEATURE_UNIT + uint8_t bUnitID; + uint8_t bSourceID; + uint8_t bControlSize; + uint8_t bmaControls[]; +} __PACKED usb_audio_ac_feature_unit_desc_0; + +typedef struct { + uint8_t iFeature; +} __PACKED usb_audio_ac_feature_unit_desc_1; + +// Note: Processing unit descriptors contain two inlined variable length arrays, +// each with descriptor data following them. They are therefor described using +// 3 structure definitions which are logically concatenated, but separated by +// the inline arrays. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_PROCESSING_UNIT + uint8_t bUnitID; + uint16_t wProcessType; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_processing_unit_desc_0; + +typedef struct { + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t bControlSize; + uint8_t bmControls[]; +} __PACKED usb_audio_ac_processing_unit_desc_1; + +typedef struct { + uint8_t iProcessing; + // Note: The Process-specific control structure follows this with the + // structure type determined by wProcessType + // TODO(johngro) : Define the process specific control structures. As of + // the 1.0 revision of the USB audio spec, the types to be defined are... + // + // ** Up/Down-mix + // ** Dolby Prologic + // ** 3D-Stereo Extender + // ** Reverberation + // ** Chorus + // ** Dynamic Range Compressor +} __PACKED usb_audio_ac_processing_unit_desc_2; + +// Note: Extension unit descriptors contain two inlined variable length arrays, +// each with descriptor data following them. They are therefor described using +// 3 structure definitions which are logically concatenated, but separated by +// the inline arrays. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AC_EXTENSION_UNIT + uint8_t bUnitID; + uint16_t wExtensionCode; + uint8_t bNrInPins; + uint8_t baSourceID[]; +} __PACKED usb_audio_ac_extension_unit_desc_0; + +typedef struct { + uint8_t bNrChannels; + uint16_t wChannelConfig; + uint8_t iChannelNames; + uint8_t bControlSize; + uint8_t bmControls[]; +} __PACKED usb_audio_ac_extension_unit_desc_1; + +typedef struct { + uint8_t iExtension; +} __PACKED usb_audio_ac_extension_unit_desc_2; + +// Audio Streaming Interface descriptor definitions +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AS_GENERAL + uint8_t bTerminalLink; + uint8_t bDelay; + uint16_t wFormatTag; +} __PACKED usb_audio_as_header_desc; + +typedef struct { + uint8_t freq[3]; // 24 bit unsigned integer, little-endian +} __PACKED usb_audio_as_samp_freq; + +// Common header used by all format type descriptors +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AS_FORMAT_TYPE + uint8_t bFormatType; +} __PACKED usb_audio_as_format_type_hdr; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_AUDIO_AS_FORMAT_TYPE + uint8_t bFormatType; // USB_AUDIO_FORMAT_TYPE_I + uint8_t bNrChannels; + uint8_t bSubFrameSize; + uint8_t bBitResolution; + uint8_t bSamFreqType; // number of sampling frequencies + usb_audio_as_samp_freq tSamFreq[]; // list of sampling frequencies (3 bytes each) +} __PACKED usb_audio_as_format_type_i_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_ENDPOINT + uint8_t bDescriptorSubtype; // USB_AUDIO_EP_GENERAL + uint8_t bmAttributes; + uint8_t bLockDelayUnits; + uint16_t wLockDelay; +} __PACKED usb_audio_as_isoch_ep_desc; + +// MIDI Streaming Interface descriptor definitions +// +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_MIDI_MS_HEADER + uint16_t bcdMSC; + uint16_t wTotalLength; +} __PACKED usb_midi_ms_header_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_MIDI_IN_JACK + uint8_t bJackType; + uint8_t bJackID; + uint8_t iJack; +} __PACKED usb_midi_ms_in_jack_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_MIDI_OUT_JACK + uint8_t bJackType; + uint8_t bJackID; + uint8_t bNrInputPins; + uint8_t baSourceID; + uint8_t baSourcePin; +} __PACKED usb_midi_ms_out_jack_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_AUDIO_CS_ENDPOINT + uint8_t bDescriptorSubtype; // USB_MIDI_MS_GENERAL + uint8_t bNumEmbMIDIJack; + uint8_t baAssocJackID[]; +} __PACKED usb_midi_ms_endpoint_desc; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_AUDIO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/cdc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/cdc.h new file mode 100644 index 0000000..67ac8c7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/cdc.h
@@ -0,0 +1,150 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_CDC_H_ +#define SYSROOT_ZIRCON_HW_USB_CDC_H_ + +#include <stdint.h> + +// clang-format off + +#include <zircon/compiler.h> + +/* CDC Subclasses for the Communications Interface Class */ +#define USB_CDC_SUBCLASS_DIRECT_LINE 0x01 +#define USB_CDC_SUBCLASS_ABSTRACT 0x02 +#define USB_CDC_SUBCLASS_TELEPHONE 0x03 +#define USB_CDC_SUBCLASS_MULTI_CHANNEL 0x04 +#define USB_CDC_SUBCLASS_CAPI 0x05 +#define USB_CDC_SUBCLASS_ETHERNET 0x06 +#define USB_CDC_SUBCLASS_ATM 0x07 +#define USB_CDC_SUBCLASS_WIRELESS_HANDSET 0x08 +#define USB_CDC_SUBCLASS_DEVICE_MGMT 0x09 +#define USB_CDC_SUBCLASS_MOBILE_DIRECT 0x0A +#define USB_CDC_SUBCLASS_OBEX 0x0B +#define USB_CDC_SUBCLASS_ETHERNET_EMU 0x0C +#define USB_CDC_SUBCLASS_NETWORK_CTRL 0x0D + +/* CDC Descriptor SubTypes */ +#define USB_CDC_DST_HEADER 0x00 +#define USB_CDC_DST_CALL_MGMT 0x01 +#define USB_CDC_DST_ABSTRACT_CTRL_MGMT 0x02 +#define USB_CDC_DST_DIRECT_LINE_MGMT 0x03 +#define USB_CDC_DST_TELEPHONE_RINGER 0x04 +#define USB_CDC_DST_TELEPHONE_CALL_REPORTING 0x05 +#define USB_CDC_DST_UNION 0x06 +#define USB_CDC_DST_COUNTRY_SELECTION 0x07 +#define USB_CDC_DST_TELEPHONE_OP_MODES 0x08 +#define USB_CDC_DST_USB_TERMINAL 0x09 +#define USB_CDC_DST_NETWORK_CHANNEL 0x0A +#define USB_CDC_DST_PROTOCOL_UNIT 0x0B +#define USB_CDC_DST_EXTENSION_UNIT 0x0C +#define USB_CDC_DST_MULTI_CHANNEL_MGMT 0x0D +#define USB_CDC_DST_CAPI_CTRL_MGMT 0x0E +#define USB_CDC_DST_ETHERNET 0x0F +#define USB_CDC_DST_ATM_NETWORKING 0x10 +#define USB_CDC_DST_WIRELESS_HANDSET_CTRL 0x11 +#define USB_CDC_DST_MOBILE_DIRECT_LINE 0x12 +#define USB_CDC_DST_MDLM_DETAIL 0x13 +#define USB_CDC_DST_DEVICE_MGMT 0x14 +#define USB_CDC_DST_OBEX 0x15 +#define USB_CDC_DST_COMMAND_SET 0x16 +#define USB_CDC_DST_COMMAND_SET_DETAIL 0x17 +#define USB_CDC_DST_TELEPHONE_CTRL 0x18 +#define USB_CDC_DST_OBEX_SERVICE_ID 0x19 +#define USB_CDC_DST_NCM 0x1A + +/* CDC Class-Specific Notification Codes */ +#define USB_CDC_NC_NETWORK_CONNECTION 0x00 +#define USB_CDC_NC_RESPONSE_AVAILABLE 0x01 +#define USB_CDC_NC_SERIAL_STATE 0x20 +#define USB_CDC_NC_CONNECTION_SPEED_CHANGE 0x2A + +/* CDC Ethernet Class-Specific Request Codes */ +#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 +#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 +#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 +#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 +#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 + +/* CDC Ethernet Packet Filter Modes Bits */ +#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) +#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) +#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) +#define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) +#define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) + +/* CDC Class-Specific Requests */ +#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 +#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 + +__BEGIN_CDECLS + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_HEADER + uint16_t bcdCDC; +} __attribute__ ((packed)) usb_cs_header_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_CALL_MGMT + uint8_t bmCapabilities; + uint8_t bDataInterface; +} __attribute__ ((packed)) usb_cs_call_mgmt_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_ABSTRACT_CTRL_MGMT + uint8_t bmCapabilities; +} __attribute__ ((packed)) usb_cs_abstract_ctrl_mgmt_interface_descriptor_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_UNION + uint8_t bControlInterface; + uint8_t bSubordinateInterface[]; +} __attribute__ ((packed)) usb_cs_union_interface_descriptor_t; + +// fixed size version of usb_cs_union_interface_descriptor_t +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_UNION + uint8_t bControlInterface; + uint8_t bSubordinateInterface; +} __attribute__ ((packed)) usb_cs_union_interface_descriptor_1_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DT_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_CDC_DST_ETHERNET + uint8_t iMACAddress; + uint32_t bmEthernetStatistics; + uint16_t wMaxSegmentSize; + uint16_t wNumberMCFilters; + uint8_t bNumberPowerFilters; +} __attribute__ ((packed)) usb_cs_ethernet_interface_descriptor_t; + +typedef struct { + uint8_t bmRequestType; + uint8_t bNotification; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} __attribute__ ((packed)) usb_cdc_notification_t; + +typedef struct { + usb_cdc_notification_t notification; + uint32_t downlink_br; + uint32_t uplink_br; + } __attribute__ ((packed)) usb_cdc_speed_change_notification_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_CDC_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/dfu.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/dfu.h new file mode 100644 index 0000000..7ca40f0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/dfu.h
@@ -0,0 +1,82 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_DFU_H_ +#define SYSROOT_ZIRCON_HW_USB_DFU_H_ + +// clang-format off + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// USB DFU Spec, Rev 1.1 + +// DFU Class-Specific Request Values +// Table 3.2 +#define USB_DFU_DETACH 0x00 +#define USB_DFU_DNLOAD 0x01 +#define USB_DFU_UPLOAD 0x02 +#define USB_DFU_GET_STATUS 0x03 +#define USB_DFU_CLR_STATUS 0x04 +#define USB_DFU_GET_STATE 0x05 +#define USB_DFU_ABORT 0x06 + +// DFU Class-Specific Descriptor Types +// Table 4.1.3 +#define USB_DFU_CS_FUNCTIONAL 0x21 + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_DFU_CS_FUNCTIONAL + uint8_t bmAttributes; + uint16_t wDetachTimeOut; + uint16_t wTransferSize; + uint16_t bcdDFUVersion; +} __PACKED usb_dfu_func_desc_t; + +// DFU_GET_STATUS Response +// Section 6.1.2 +typedef struct { + uint8_t bStatus; + uint8_t bwPollTimeout[3]; // 24 bit unsigned integer + uint8_t bState; + uint8_t bString; +} __PACKED usb_dfu_get_status_data_t; + +// DFU Device Status Values +#define USB_DFU_STATUS_OK 0x00 +#define USB_DFU_STATUS_ERR_TARGET 0x01 +#define USB_DFU_STATUS_ERR_FILE 0x02 +#define USB_DFU_STATUS_ERR_WRITE 0x03 +#define USB_DFU_STATUS_ERR_ERASE 0x04 +#define USB_DFU_STATUS_ERR_CHECK_ERASED 0x05 +#define USB_DFU_STATUS_ERR_PROG 0x06 +#define USB_DFU_STATUS_ERR_VERIFY 0x07 +#define USB_DFU_STATUS_ERR_ADDRESS 0x08 +#define USB_DFU_STATUS_ERR_NOT_DONE 0x09 +#define USB_DFU_STATUS_ERR_FIRMWARE 0x0A +#define USB_DFU_STATUS_ERR_VENDOR 0x0B +#define USB_DFU_STATUS_ERR_USER 0x0C +#define USB_DFU_STATUS_ERR_POR 0x0D +#define USB_DFU_STATUS_ERR_UNKNOWN 0x0E +#define USB_DFU_STATUS_ERR_STALLED_PKT 0x0F + +// DFU Device State Values +#define USB_DFU_STATE_APP_IDLE 0x00 +#define USB_DFU_STATE_APP_DETACH 0x01 +#define USB_DFU_STATE_DFU_IDLE 0x02 +#define USB_DFU_STATE_DFU_DNLOAD_SYNC 0x03 +#define USB_DFU_STATE_DFU_DNBUSY 0x04 +#define USB_DFU_STATE_DFU_DNLOAD_IDLE 0x05 +#define USB_DFU_STATE_DFU_MANIFEST_SYNC 0x06 +#define USB_DFU_STATE_DFU_MANIFEST 0x07 +#define USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET 0x08 +#define USB_DFU_STATE_DFU_UPLOAD_IDLE 0x09 +#define USB_DFU_STATE_DFU_ERROR 0x0A + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_DFU_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/hid.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/hid.h new file mode 100644 index 0000000..97dea4e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/hid.h
@@ -0,0 +1,46 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_HID_H_ +#define SYSROOT_ZIRCON_HW_USB_HID_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// clang-format off + +// HID Request Values. +#define USB_HID_GET_REPORT 0x01 +#define USB_HID_GET_IDLE 0x02 +#define USB_HID_GET_PROTOCOL 0x03 +#define USB_HID_SET_REPORT 0x09 +#define USB_HID_SET_IDLE 0x0A +#define USB_HID_SET_PROTOCOL 0x0B + +// HID USB protocols +#define USB_HID_PROTOCOL_KBD 0x01 +#define USB_HID_PROTOCOL_MOUSE 0x02 +#define USB_HID_SUBCLASS_BOOT 0x01 + +// clang-format on + +typedef struct { + uint8_t bDescriptorType; + uint16_t wDescriptorLength; +} __attribute__((packed)) usb_hid_descriptor_entry_t; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + usb_hid_descriptor_entry_t descriptors[]; +} __attribute__((packed)) usb_hid_descriptor_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_HID_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/hub.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/hub.h new file mode 100644 index 0000000..10ed110 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/hub.h
@@ -0,0 +1,120 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_HUB_H_ +#define SYSROOT_ZIRCON_HW_USB_HUB_H_ + +#include <zircon/compiler.h> +#include <zircon/types.h> + +// clang-format off + +__BEGIN_CDECLS + +// Hub request types +#define USB_RECIP_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) +#define USB_RECIP_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) + +// Hub requests +#define USB_HUB_SET_DEPTH 12 + +// Hub descriptor types +#define USB_HUB_DESC_TYPE 0x29 +#define USB_HUB_DESC_TYPE_SS 0x2A // for superspeed hubs + +// Hub Class Feature Selectors (USB 2.0 spec Table 11.17) +#define USB_FEATURE_C_HUB_LOCAL_POWER 0 +#define USB_FEATURE_C_HUB_OVER_CURRENT 1 +#define USB_FEATURE_PORT_CONNECTION 0 +#define USB_FEATURE_PORT_ENABLE 1 +#define USB_FEATURE_PORT_SUSPEND 2 +#define USB_FEATURE_PORT_OVER_CURRENT 3 +#define USB_FEATURE_PORT_RESET 4 +#define USB_FEATURE_PORT_LINK_STATE 5 +#define USB_FEATURE_PORT_POWER 8 +#define USB_FEATURE_PORT_LOW_SPEED 9 +#define USB_FEATURE_C_PORT_CONNECTION 16 +#define USB_FEATURE_C_PORT_ENABLE 17 +#define USB_FEATURE_C_PORT_SUSPEND 18 +#define USB_FEATURE_C_PORT_OVER_CURRENT 19 +#define USB_FEATURE_C_PORT_RESET 20 +#define USB_FEATURE_PORT_TEST 21 +#define USB_FEATURE_PORT_INDICATOR 22 +#define USB_FEATURE_PORT_INDICATOR 22 +#define USB_FEATURE_PORT_U1_TIMEOUT 23 +#define USB_FEATURE_PORT_U2_TIMEOUT 24 +#define USB_FEATURE_C_PORT_LINK_STATE 25 +#define USB_FEATURE_C_PORT_CONFIG_ERROR 26 +#define USB_FEATURE_PORT_REMOTE_WAKE_MASK 27 +#define USB_FEATURE_BH_PORT_RESET 28 +#define USB_FEATURE_C_BH_PORT_RESET 29 +#define USB_FEATURE_FORCE_LINKPM_ACCEPT 30 + +typedef struct { + uint8_t bDescLength; + uint8_t bDescriptorType; + uint8_t bNbrPorts; + uint16_t wHubCharacteristics; + uint8_t bPowerOn2PwrGood; + uint8_t bHubContrCurrent; + union { + // USB 2.0 + struct { + // variable length depending on number of ports + uint8_t DeviceRemovable[4]; + uint8_t PortPwrCtrlMask[4]; + } __attribute__ ((packed)) hs; + // USB 3.0 + struct { + uint8_t bHubHdrDecLat; + uint16_t wHubDelay; + uint16_t DeviceRemovable; + } __attribute__ ((packed)) ss; + } __attribute__ ((packed)); +} __attribute__ ((packed)) usb_hub_descriptor_t; + +typedef struct { + uint16_t wHubStatus; + uint16_t wHubChange; +} __attribute__ ((packed)) usb_hub_status_t; + +// wHubStatus bits +#define USB_HUB_LOCAL_POWER (1 << 0) +#define USB_HUB_OVER_CURRENT (1 << 1) + +typedef struct { + uint16_t wPortStatus; + uint16_t wPortChange; +} __attribute__ ((packed)) usb_port_status_t; + +// Port Status bits +#define USB_PORT_CONNECTION (1 << 0) +#define USB_PORT_ENABLE (1 << 1) +#define USB_PORT_SUSPEND (1 << 2) // USB 2.0 only +#define USB_PORT_OVER_CURRENT (1 << 3) +#define USB_PORT_RESET (1 << 4) +#define USB_PORT_POWER (1 << 8) // USB 2.0 only +#define USB_PORT_LOW_SPEED (1 << 9) // USB 2.0 only +#define USB_PORT_HIGH_SPEED (1 << 10) // USB 2.0 only +#define USB_PORT_TEST_MODE (1 << 11) // USB 2.0 only +#define USB_PORT_INDICATOR_CONTROL (1 << 12) // USB 2.0 only + +// Port Status Changed bits +#define USB_C_PORT_CONNECTION (1 << 0) +#define USB_C_PORT_ENABLE (1 << 1) // USB 2.0 only +#define USB_C_PORT_SUSPEND (1 << 2) // USB 2.0 only +#define USB_C_PORT_OVER_CURRENT (1 << 3) +#define USB_C_PORT_RESET (1 << 4) +#define USB_C_BH_PORT_RESET (1 << 5) // USB 3.0 only +#define USB_C_PORT_LINK_STATE (1 << 6) // USB 3.0 only +#define USB_C_PORT_CONFIG_ERROR (1 << 7) // USB 3.0 only +#define USB_C_PORT_POWER (1 << 8) // USB 2.0 only +#define USB_C_PORT_LOW_SPEED (1 << 9) // USB 2.0 only +#define USB_C_PORT_HIGH_SPEED (1 << 10) // USB 2.0 only +#define USB_C_PORT_TEST_MODE (1 << 11) // USB 2.0 only +#define USB_C_PORT_INDICATOR_CONTROL (1 << 12) // USB 2.0 only + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_HW_USB_HUB_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/ums.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/ums.h new file mode 100644 index 0000000..6640803 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/ums.h
@@ -0,0 +1,159 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_UMS_H_ +#define SYSROOT_ZIRCON_HW_USB_UMS_H_ + +// clang-format off + +// SCSI commands +#define UMS_TEST_UNIT_READY 0x00 +#define UMS_REQUEST_SENSE 0x03 +#define UMS_INQUIRY 0x12 +#define UMS_MODE_SELECT6 0x15 +#define UMS_MODE_SENSE6 0x1A +#define UMS_START_STOP_UNIT 0x1B +#define UMS_TOGGLE_REMOVABLE 0x1E +#define UMS_READ_FORMAT_CAPACITIES 0x23 +#define UMS_READ_CAPACITY10 0x25 +#define UMS_READ10 0x28 +#define UMS_WRITE10 0x2A +#define UMS_SYNCHRONIZE_CACHE 0x35 +#define UMS_MODE_SELECT10 0x55 +#define UMS_MODE_SENSE10 0x5A +#define UMS_READ16 0x88 +#define UMS_WRITE16 0x8A +#define UMS_READ_CAPACITY16 0x9E +#define UMS_READ12 0xA8 +#define UMS_WRITE12 0xAA + +// control request values +#define USB_REQ_RESET 0xFF +#define USB_REQ_GET_MAX_LUN 0xFE + +// error codes for CSW processing +typedef uint32_t csw_status_t; +#define CSW_SUCCESS ((csw_status_t)0) +#define CSW_FAILED ((csw_status_t)1) +#define CSW_PHASE_ERROR ((csw_status_t)2) +#define CSW_INVALID ((csw_status_t)3) +#define CSW_TAG_MISMATCH ((csw_status_t)4) + +// signatures in header and status +#define CBW_SIGNATURE 0x43425355 +#define CSW_SIGNATURE 0x53425355 + +// transfer lengths +#define UMS_INQUIRY_TRANSFER_LENGTH 0x24 +#define UMS_REQUEST_SENSE_TRANSFER_LENGTH 0x12 +#define UMS_READ_FORMAT_CAPACITIES_TRANSFER_LENGTH 0xFC + +// 6 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint16_t lba; // logical block address + uint8_t length; + uint8_t control; +} __PACKED scsi_command6_t; +static_assert(sizeof(scsi_command6_t) == 6, ""); + +// 10 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint32_t lba; // logical block address + uint8_t misc2; + uint8_t length_hi; // break length into two pieces to avoid odd alignment + uint8_t length_lo; + uint8_t control; +} __PACKED scsi_command10_t; +static_assert(sizeof(scsi_command10_t) == 10, ""); + +// 12 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint32_t lba; // logical block address + uint32_t length; + uint8_t misc2; + uint8_t control; +} __PACKED scsi_command12_t; +static_assert(sizeof(scsi_command12_t) == 12, ""); + +// 16 Byte SCSI command +// This is big endian +typedef struct { + uint8_t opcode; + uint8_t misc; + uint64_t lba; // logical block address + uint32_t length; + uint8_t misc2; + uint8_t control; +} __PACKED scsi_command16_t; +static_assert(sizeof(scsi_command16_t) == 16, ""); + +// SCSI Read Capacity 10 payload +// This is big endian +typedef struct { + uint32_t lba; + uint32_t block_length; +} __PACKED scsi_read_capacity_10_t; +static_assert(sizeof(scsi_read_capacity_10_t) == 8, ""); + +// SCSI Read Capacity 16 payload +// This is big endian +typedef struct { + uint64_t lba; + uint32_t block_length; + uint8_t ptype_prot_en; // bit 0: PROT_EN, bits 1-3: P_TYPE + uint8_t resesrved[19]; +} __PACKED scsi_read_capacity_16_t; +static_assert(sizeof(scsi_read_capacity_16_t) == 32, ""); + +// SCSI Mode Sense 6 command +typedef struct { + uint8_t opcode; // UMS_MODE_SENSE6 + uint8_t disable_block_desc; + uint8_t page; + uint8_t subpage; + uint8_t allocation_length; + uint8_t control; +} __PACKED scsi_mode_sense_6_command_t; +static_assert(sizeof(scsi_mode_sense_6_command_t) == 6, ""); + +// SCSI Mode Sense 6 data response +typedef struct { + uint8_t mode_data_length; + uint8_t medium_type; + uint8_t device_specific_param; + uint8_t block_desc_length; +} __PACKED scsi_mode_sense_6_data_t; +#define MODE_SENSE_DSP_RO 0x80 // bit 7 of device_specific_param: read-only + +// Command Block Wrapper +typedef struct { + uint32_t dCBWSignature; // CBW_SIGNATURE + uint32_t dCBWTag; + uint32_t dCBWDataTransferLength; + uint8_t bmCBWFlags; + uint8_t bCBWLUN; + uint8_t bCBWCBLength; + uint8_t CBWCB[16]; +} __PACKED ums_cbw_t; +static_assert(sizeof(ums_cbw_t) == 31, ""); + +// Command Status Wrapper +typedef struct { + uint32_t dCSWSignature; // CSW_SIGNATURE + uint32_t dCSWTag; + uint32_t dCSWDataResidue; + uint8_t bmCSWStatus; +} __PACKED ums_csw_t; +static_assert(sizeof(ums_csw_t) == 13, ""); + +#endif // SYSROOT_ZIRCON_HW_USB_UMS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/video.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/video.h new file mode 100644 index 0000000..925b5b6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/hw/usb/video.h
@@ -0,0 +1,308 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_HW_USB_VIDEO_H_ +#define SYSROOT_ZIRCON_HW_USB_VIDEO_H_ + +// clang-format off + +#include <zircon/compiler.h> +#include <stdint.h> + +__BEGIN_CDECLS; + +// video interface subclasses +#define USB_SUBCLASS_VIDEO_CONTROL 0x01 +#define USB_SUBCLASS_VIDEO_STREAMING 0x02 +#define USB_SUBCLASS_VIDEO_INTERFACE_COLLECTION 0x03 + +// video class specific descriptor types +#define USB_VIDEO_CS_DEVICE 0x21 +#define USB_VIDEO_CS_CONFIGURATION 0x22 +#define USB_VIDEO_CS_STRING 0x23 +#define USB_VIDEO_CS_INTERFACE 0x24 +#define USB_VIDEO_CS_ENDPOINT 0x25 + +// video class specific VC interface descriptor subtypes +#define USB_VIDEO_VC_HEADER 0x01 +#define USB_VIDEO_VC_INPUT_TERMINAL 0x02 +#define USB_VIDEO_VC_OUTPUT_TERMINAL 0x03 +#define USB_VIDEO_VC_SELECTOR_UNIT 0x04 +#define USB_VIDEO_VC_PROCESSING_UNIT 0x05 +#define USB_VIDEO_VC_EXTENSION_UNIT 0x06 +#define USB_VIDEO_VC_ENCODING_UNIT 0x07 + +// video class specific VS interface descriptor subtypes +#define USB_VIDEO_VS_INPUT_HEADER 0x01 +#define USB_VIDEO_VS_OUTPUT_HEADER 0x02 +#define USB_VIDEO_VS_STILL_IMAGE_FRAME 0x03 +#define USB_VIDEO_VS_FORMAT_UNCOMPRESSED 0x04 +#define USB_VIDEO_VS_FRAME_UNCOMPRESSED 0x05 +#define USB_VIDEO_VS_FORMAT_MJPEG 0x06 +#define USB_VIDEO_VS_FRAME_MJPEG 0x07 +#define USB_VIDEO_VS_FORMAT_MPEG2TS 0x0A +#define USB_VIDEO_VS_FORMAT_DV 0x0C +#define USB_VIDEO_VS_COLORFORMAT 0x0D +#define USB_VIDEO_VS_FORMAT_FRAME_BASED 0x10 +#define USB_VIDEO_VS_FRAME_FRAME_BASED 0x11 +#define USB_VIDEO_VS_FORMAT_STREAM_BASED 0x12 +#define USB_VIDEO_VS_FORMAT_H264 0x13 +#define USB_VIDEO_VS_FRAME_H264 0x14 +#define USB_VIDEO_VS_FORMAT_H264_SIMULCAST 0x15 +#define USB_VIDEO_VS_FORMAT_VP8 0x16 +#define USB_VIDEO_VS_FRAME_VP8 0x17 +#define USB_VIDEO_VS_FORMAT_VP8_SIMULCAST 0x18 + +// video class specific endpoint descriptor subtypes +#define USB_VIDEO_EP_GENERAL 0x01 +#define USB_VIDEO_EP_ENDPOINT 0x02 +#define USB_VIDEO_EP_INTERRUPT 0x03 + +// video class specific request codes +#define USB_VIDEO_SET_CUR 0x01 +#define USB_VIDEO_SET_CUR_ALL 0x11 +#define USB_VIDEO_GET_CUR 0x81 +#define USB_VIDEO_GET_MIN 0x82 +#define USB_VIDEO_GET_MAX 0x83 +#define USB_VIDEO_GET_RES 0x84 +#define USB_VIDEO_GET_LEN 0x85 +#define USB_VIDEO_GET_INFO 0x86 +#define USB_VIDEO_GET_DEF 0x87 +#define USB_VIDEO_GET_CUR_ALL 0x91 +#define USB_VIDEO_GET_MIN_ALL 0x92 +#define USB_VIDEO_GET_MAX_ALL 0x93 +#define USB_VIDEO_GET_RES_ALL 0x94 +#define USB_VIDEO_GET_DEF_ALL 0x97 + +// video streaming interface control selectors +#define USB_VIDEO_VS_PROBE_CONTROL 0x01 +#define USB_VIDEO_VS_COMMIT_CONTROL 0x02 +#define USB_VIDEO_VS_STILL_PROBE_CONTROL 0x03 +#define USB_VIDEO_VS_STILL_COMMIT_CONTROL 0x04 +#define USB_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 +#define USB_VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06 +#define USB_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07 +#define USB_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 +#define USB_VIDEO_VS_SYNCH_DELAY_CONTROL 0x09 + +// header for usb_video_vc_* below +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; +} __PACKED usb_video_vc_desc_header; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VC_HEADER + uint16_t bcdUVC; + uint16_t wTotalLength; + uint32_t dwClockFrequency; + uint8_t bInCollection; + uint8_t baInterfaceNr[]; +} __PACKED usb_video_vc_header_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VC_INPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t iTerminal; +} __PACKED usb_video_vc_input_terminal_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VC_OUTPUT_TERMINAL + uint8_t bTerminalID; + uint16_t wTerminalType; + uint8_t bAssocTerminal; + uint8_t bSourceID; + uint8_t iTerminal; +} __PACKED usb_video_vc_output_terminal_desc; + +// class specific VC interrupt endpoint descriptor +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_ENDPOINT + uint8_t bDescriptorSubtype; // USB_ENDPOINT_INTERRUPT + uint16_t wMaxTransferSize; +} __PACKED usb_video_vc_interrupt_endpoint_desc; + +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubtype; // USB_VIDEO_VS_HEADER + uint8_t bNumFormats; + uint16_t wTotalLength; + uint8_t bEndpointAddress; + uint8_t bmInfo; + uint8_t bTerminalLink; + uint8_t bStillCaptureMethod; + uint8_t bTriggerSupport; + uint8_t bTriggerUsage; + uint8_t bControlSize; + uint8_t bmaControls[]; +} __PACKED usb_video_vs_input_header_desc; + +#define GUID_LENGTH 16 + +// A GUID consists of a: +// - four-byte integer +// - two-byte integer +// - two-byte integer +// - eight-byte array +// +// The string representation uses big endian format, so to convert it +// to a byte array we need to reverse the byte order of the three integers. +// +// See USB Video Class revision 1.5, FAQ section 2.9 +// for GUID Data Structure Layout. + +#define USB_VIDEO_GUID_YUY2_STRING "32595559-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_YUY2_VALUE { \ + 0x59, 0x55, 0x59, 0x32, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +#define USB_VIDEO_GUID_NV12_STRING "3231564E-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_NV12_VALUE { \ + 0x4e, 0x56, 0x31, 0x32, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +#define USB_VIDEO_GUID_M420_STRING "3032344D-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_M420_VALUE { \ + 0x4d, 0x34, 0x32, 0x30, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +#define USB_VIDEO_GUID_I420_STRING "30323449-0000-0010-8000-00AA00389B71" +#define USB_VIDEO_GUID_I420_VALUE { \ + 0x49, 0x34, 0x32, 0x30, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \ +} + +// USB Video Payload Uncompressed +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_UNCOMPRESSED + uint8_t bFormatIndex; + uint8_t bNumFrameDescriptors; + uint8_t guidFormat[GUID_LENGTH]; + uint8_t bBitsPerPixel; + uint8_t bDefaultFrameIndex; + uint8_t bAspectRatioX; + uint8_t bAspectRatioY; + uint8_t bmInterfaceFlags; + uint8_t bCopyProtect; +} __PACKED usb_video_vs_uncompressed_format_desc; + +// USB Video Payload MJPEG +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_MJPEG + uint8_t bFormatIndex; + uint8_t bNumFrameDescriptors; + uint8_t bmFlags; + uint8_t bDefaultFrameIndex; + uint8_t bAspectRatioX; + uint8_t bAspectRatioY; + uint8_t bmInterfaceFlags; + uint8_t bCopyProtect; +} __PACKED usb_video_vs_mjpeg_format_desc; + +// Uncompressed and MJPEG formats have the same frame descriptor structure. +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE + uint8_t bDescriptorSubType; // USB_VIDEO_VS_FRAME_UNCOMPRESSED / USB_VIDEO_VS_FRAME_MJPEG + uint8_t bFrameIndex; + uint8_t bmCapabilities; + uint16_t wWidth; + uint16_t wHeight; + uint32_t dwMinBitRate; + uint32_t dwMaxBitRate; + uint32_t dwMaxVideoFrameBufferSize; + uint32_t dwDefaultFrameInterval; + uint8_t bFrameIntervalType; + uint32_t dwFrameInterval[]; +} __PACKED usb_video_vs_frame_desc; + +// Stream negotiation +#define USB_VIDEO_BM_HINT_FRAME_INTERVAL (1 << 0) +#define USB_VIDEO_BM_HINT_KEY_FRAME_RATE (1 << 1) +#define USB_VIDEO_BM_HINT_P_FRAME_RATE (1 << 2) +#define USB_VIDEO_BM_HINT_COMP_QUALITY (1 << 3) +#define USB_VIDEO_BM_HINT_COMP_WINDOW_SIZE (1 << 4) + +typedef struct { + uint16_t bmHint; + uint8_t bFormatIndex; + uint8_t bFrameIndex; + uint32_t dwFrameInterval; + uint16_t wKeyFrameRate; + uint16_t wPFrameRate; + uint16_t wCompQuality; + uint16_t wCompWindowSize; + uint16_t wDelay; + uint32_t dwMaxVideoFrameSize; + uint32_t dwMaxPayloadTransferSize; + // The following fields are optional. + uint32_t dwClockFrequency; + uint8_t bmFramingInfo; + uint8_t bPreferedVersion; + uint8_t bMinVersion; + uint8_t bMaxVersion; + uint8_t bUsage; + uint8_t bBitDepthLuma; + uint8_t bmSettings; + uint8_t bMaxNumberOfRefFramesPlus1; + uint16_t bmRateControlModes; + uint32_t bmLayoutPerStream; +} __PACKED usb_video_vc_probe_and_commit_controls; + +// For accessing payload bmHeaderInfo bitmap +#define USB_VIDEO_VS_PAYLOAD_HEADER_FID (1 << 0) +#define USB_VIDEO_VS_PAYLOAD_HEADER_EOF (1 << 1) +#define USB_VIDEO_VS_PAYLOAD_HEADER_PTS (1 << 2) +#define USB_VIDEO_VS_PAYLOAD_HEADER_SCR (1 << 3) +#define USB_VIDEO_VS_PAYLOAD_HEADER_RES (1 << 4) +#define USB_VIDEO_VS_PAYLOAD_HEADER_STI (1 << 5) +#define USB_VIDEO_VS_PAYLOAD_HEADER_ERR (1 << 6) +#define USB_VIDEO_VS_PAYLOAD_HEADER_EOH (1 << 7) + +// Common header for all payloads. +typedef struct { + uint8_t bHeaderLength; + uint8_t bmHeaderInfo; + +} __PACKED usb_video_vs_payload_header; + +typedef struct { + uint8_t bHeaderLength; + uint8_t bmHeaderInfo; + uint32_t dwPresentationTime; + uint32_t scrSourceTimeClock; + // Frame number when the source clock was sampled. + uint16_t scrSourceClockSOFCounter; +} __PACKED usb_video_vs_uncompressed_payload_header; + +__END_CDECLS; + + +#endif // SYSROOT_ZIRCON_HW_USB_VIDEO_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/limits.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/limits.h new file mode 100644 index 0000000..f062d5e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/limits.h
@@ -0,0 +1,14 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_LIMITS_H_ +#define SYSROOT_ZIRCON_LIMITS_H_ + +#include <stdint.h> + +#define ZX_PAGE_SHIFT ((uint32_t)12u) +#define ZX_PAGE_SIZE ((uintptr_t)(1u << ZX_PAGE_SHIFT)) +#define ZX_PAGE_MASK (ZX_PAGE_SIZE - 1u) + +#endif // SYSROOT_ZIRCON_LIMITS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/listnode.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/listnode.h new file mode 100644 index 0000000..fb64acf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/listnode.h
@@ -0,0 +1,300 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_LISTNODE_H_ +#define SYSROOT_ZIRCON_LISTNODE_H_ + +#include <stdbool.h> +#include <stddef.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +#define containerof(ptr, type, member) ((type*)((uintptr_t)(ptr)-offsetof(type, member))) + +typedef struct list_node list_node_t; + +struct list_node { + list_node_t* prev; + list_node_t* next; +}; + +#define LIST_INITIAL_VALUE(list) \ + { &(list), &(list) } +#define LIST_INITIAL_CLEARED_VALUE \ + { NULL, NULL } + +static inline void list_initialize(list_node_t* list) { list->prev = list->next = list; } + +static inline void list_clear_node(list_node_t* item) { item->prev = item->next = 0; } + +static inline bool list_in_list(const list_node_t* item) { + if (item->prev == 0 && item->next == 0) + return false; + else + return true; +} + +static inline void list_add_head(list_node_t* list, list_node_t* item) { + item->next = list->next; + item->prev = list; + list->next->prev = item; + list->next = item; +} + +#define list_add_after(entry, new_entry) list_add_head(entry, new_entry) + +static inline void list_add_tail(list_node_t* list, list_node_t* item) { + item->prev = list->prev; + item->next = list; + list->prev->next = item; + list->prev = item; +} + +#define list_add_before(entry, new_entry) list_add_tail(entry, new_entry) + +static inline void list_delete(list_node_t* item) { + item->next->prev = item->prev; + item->prev->next = item->next; + item->prev = item->next = 0; +} + +static inline void list_replace_node(list_node_t* old_node, list_node_t* new_node) { + // replace a spot in a list with a new node + // assumes old_node is part of a list and new_node is not + new_node->next = old_node->next; + new_node->prev = old_node->prev; + old_node->prev = old_node->next = 0; + + new_node->next->prev = new_node; + new_node->prev->next = new_node; +} + +static inline list_node_t* list_remove_head(list_node_t* list) { + if (list->next != list) { + list_node_t* item = list->next; + list_delete(item); + return item; + } else { + return NULL; + } +} + +#define list_remove_head_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_remove_head(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_remove_tail(list_node_t* list) { + if (list->prev != list) { + list_node_t* item = list->prev; + list_delete(item); + return item; + } else { + return NULL; + } +} + +#define list_remove_tail_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_remove_tail(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_peek_head(const list_node_t* list) { + if (list->next != list) { + return list->next; + } else { + return NULL; + } +} + +#define list_peek_head_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_peek_head(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_peek_tail(const list_node_t* list) { + if (list->prev != list) { + return list->prev; + } else { + return NULL; + } +} + +#define list_peek_tail_type(list, type, element) \ + ({ \ + list_node_t* __nod = list_peek_tail(list); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_prev(list_node_t* list, list_node_t* item) { + if (item->prev != list) + return item->prev; + else + return NULL; +} + +#define list_prev_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_prev(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_prev_wrap(list_node_t* list, list_node_t* item) { + if (item->prev != list) + return item->prev; + else if (item->prev->prev != list) + return item->prev->prev; + else + return NULL; +} + +#define list_prev_wrap_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_prev_wrap(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_next(list_node_t* list, list_node_t* item) { + if (item->next != list) + return item->next; + else + return NULL; +} + +#define list_next_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_next(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +static inline list_node_t* list_next_wrap(list_node_t* list, list_node_t* item) { + if (item->next != list) + return item->next; + else if (item->next->next != list) + return item->next->next; + else + return NULL; +} + +#define list_next_wrap_type(list, item, type, element) \ + ({ \ + list_node_t* __nod = list_next_wrap(list, item); \ + type* __t; \ + if (__nod) \ + __t = containerof(__nod, type, element); \ + else \ + __t = (type*)0; \ + __t; \ + }) + +// iterates over the list, node should be list_node_t* +#define list_for_every(list, node) for (node = (list)->next; node != (list); node = node->next) + +// iterates over the list in a safe way for deletion of current node +// node and temp_node should be list_node_t* +#define list_for_every_safe(list, node, temp_node) \ + for (node = (list)->next, temp_node = (node)->next; node != (list); \ + node = temp_node, temp_node = (node)->next) + +// iterates over the list, entry should be the container structure type * +#define list_for_every_entry(list, entry, type, member) \ + for ((entry) = containerof((list)->next, type, member); &(entry)->member != (list); \ + (entry) = containerof((entry)->member.next, type, member)) + +// iterates over the list in a safe way for deletion of current node +// entry and temp_entry should be the container structure type * +#define list_for_every_entry_safe(list, entry, temp_entry, type, member) \ + for (entry = containerof((list)->next, type, member), \ + temp_entry = containerof((entry)->member.next, type, member); \ + &(entry)->member != (list); \ + entry = temp_entry, temp_entry = containerof((temp_entry)->member.next, type, member)) + +static inline bool list_is_empty(const list_node_t* list) { + return (list->next == list) ? true : false; +} + +static inline size_t list_length(const list_node_t* list) { + size_t cnt = 0; + const list_node_t* node = list; + list_for_every(list, node) { cnt++; } + + return cnt; +} + +// Splice the contents of splice_from into the list immediately following pos. +static inline void list_splice_after(list_node_t* splice_from, list_node_t* pos) { + if (list_is_empty(splice_from)) { + return; + } + splice_from->next->prev = pos; + splice_from->prev->next = pos->next; + pos->next->prev = splice_from->prev; + pos->next = splice_from->next; + list_initialize(splice_from); +} + +// Split the contents of list after (but not including) pos, into split_to +// (which should be empty). +static inline void list_split_after(list_node_t* list, list_node_t* pos, list_node_t* split_to) { + if (pos->next == list) { + list_initialize(split_to); + return; + } + split_to->prev = list->prev; + split_to->prev->next = split_to; + split_to->next = pos->next; + split_to->next->prev = split_to; + pos->next = list; + list->prev = pos; +} + +// Moves all the contents of old_list (which may or may not be empty) +// to new_list (which should be empty). +static inline void list_move(list_node_t* old_list, list_node_t* new_list) { + list_initialize(new_list); + list_splice_after(old_list, new_list); +} + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_LISTNODE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/pixelformat.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/pixelformat.h new file mode 100644 index 0000000..f28f35f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/pixelformat.h
@@ -0,0 +1,28 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_PIXELFORMAT_H_ +#define SYSROOT_ZIRCON_PIXELFORMAT_H_ + +#include <stdint.h> + +typedef uint32_t zx_pixel_format_t; +// clang-format off + +#define ZX_PIXEL_FORMAT_NONE ((zx_pixel_format_t)0x00000000) + +#define ZX_PIXEL_FORMAT_RGB_565 ((zx_pixel_format_t)0x00020001) +#define ZX_PIXEL_FORMAT_RGB_332 ((zx_pixel_format_t)0x00010002) +#define ZX_PIXEL_FORMAT_RGB_2220 ((zx_pixel_format_t)0x00010003) +#define ZX_PIXEL_FORMAT_ARGB_8888 ((zx_pixel_format_t)0x00040004) +#define ZX_PIXEL_FORMAT_RGB_x888 ((zx_pixel_format_t)0x00040005) +#define ZX_PIXEL_FORMAT_MONO_8 ((zx_pixel_format_t)0x00010007) +#define ZX_PIXEL_FORMAT_GRAY_8 ((zx_pixel_format_t)0x00010007) +#define ZX_PIXEL_FORMAT_NV12 ((zx_pixel_format_t)0x00010008) +#define ZX_PIXEL_FORMAT_RGB_888 ((zx_pixel_format_t)0x00030009) +#define ZX_PIXEL_FORMAT_ABGR_8888 ((zx_pixel_format_t)0x0004000a) +#define ZX_PIXEL_FORMAT_BGR_888x ((zx_pixel_format_t)0x0004000b) +#define ZX_PIXEL_FORMAT_BYTES(pf) (((pf) >> 16) & 7) + +#endif // SYSROOT_ZIRCON_PIXELFORMAT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/process.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/process.h new file mode 100644 index 0000000..ef2bcb1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/process.h
@@ -0,0 +1,35 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_PROCESS_H_ +#define SYSROOT_ZIRCON_PROCESS_H_ + +#include <stdint.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Accessors for Zircon-specific state maintained by the language runtime + +// Examines the set of handles received at process startup for one matching +// |hnd_info|. If one is found, atomically returns it and removes it from the +// set available to future calls. +// |hnd_info| is a value returned by PA_HND(). +zx_handle_t zx_take_startup_handle(uint32_t hnd_info); + +zx_handle_t _zx_thread_self(void); +zx_handle_t zx_thread_self(void); + +zx_handle_t _zx_process_self(void); +zx_handle_t zx_process_self(void); + +zx_handle_t _zx_vmar_root_self(void); +zx_handle_t zx_vmar_root_self(void); + +zx_handle_t _zx_job_default(void); +zx_handle_t zx_job_default(void); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_PROCESS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/processargs.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/processargs.h new file mode 100644 index 0000000..fbad376 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/processargs.h
@@ -0,0 +1,170 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_PROCESSARGS_H_ +#define SYSROOT_ZIRCON_PROCESSARGS_H_ + +#include <stdint.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// This is a protocol for passing state to a new process +// via a message in a channel. + +#define ZX_PROCARGS_PROTOCOL ((uint32_t)0x4150585du) // MXPA +#define ZX_PROCARGS_VERSION ((uint32_t)0x0001000u) + +typedef struct zx_proc_args zx_proc_args_t; + +struct zx_proc_args { + // Protocol and version identifiers to allow for + // different process start message protocols and + // versioning of the same. + uint32_t protocol; + uint32_t version; + + // Offset from start of message to handle info + // array, which contains one uint32_t per handle + // passed along with the message. + uint32_t handle_info_off; + + // Offset from start of message to arguments and + // count of arguments. Arguments are provided as + // a set of null-terminated utf-8 strings, one + // after the other. + uint32_t args_off; + uint32_t args_num; + + // Offset from start of message to environment strings and count of + // them. Environment entries are provided as a set of null-terminated + // UTF-8 strings, one after the other. Canonically each string has + // the form "NAME=VALUE", but nothing enforces this. + uint32_t environ_off; + uint32_t environ_num; + + // Offset from start of message to name strings and count of them. + // These strings are packed similar to the argument strings, + // but are referenced by PA_NS_* handle table entries and used + // to set up namespaces. + // + // Specifically: In a handle table entry with PA_HND_TYPE(info) + // of PA_NS_*, PA_HND_ARG(info) is an index into this name table. + uint32_t names_off; + uint32_t names_num; +}; + +// Handle Info entries associate a type and optional +// argument with each handle included in the process +// arguments message. +#define PA_HND(type, arg) (((type)&0xFF) | (((arg)&0xFFFF) << 16)) +#define PA_HND_TYPE(n) ((n)&0xFF) +#define PA_HND_ARG(n) (((n) >> 16) & 0xFFFF) + +// --- Core Runtime Handles --- +// Used by libc init (or equivalent) and dynamic loader + +// Handle to our own process. +#define PA_PROC_SELF 0x01u + +// Handle to the initial thread of our own process. +#define PA_THREAD_SELF 0x02u + +// Handle to a job object which can be used to make child processes. +// +// The job can be the same as the one used to create this process or it can +// be different. +#define PA_JOB_DEFAULT 0x03u + +// Handle to the root of our address space +#define PA_VMAR_ROOT 0x04u + +// Handle to the VMAR used to load the initial program image. +#define PA_VMAR_LOADED 0x05u + +// --- Loader Service and VMO Handles --- +// Used by libc init (or equivalent) and dynamic loader + +// Service for loading shared libraries. +// +// See |fuchsia.ldsvc.Loader| for the interface definition. +#define PA_LDSVC_LOADER 0x10u + +// Handle to the VMO containing the ELF image of the system vDSO. This +// handle is duplicable, transferable, readable, and executable, but not +// writable. The contents of the VM object should be treated like any +// other general-purpose ELF file image of type ET_DYN. A process only +// needs this handle so that it can map the vDSO into new processes it +// might create or propagate it on to its children so they can do so. +// Each process's own vDSO was mapped in by its creator before the +// process started, its address passed as an argument to entry point. +#define PA_VMO_VDSO 0x11u + +// Handle to the VMO used to map the initial thread's stack. This +// handle usually has all rights. The protocol between process creator +// and new process is that this entire VM object has been mapped in +// before the process starts. The initial value for the SP register in +// the new process is the high edge of the mapping (assuming stacks grow +// downwards), adjusted down as required by the particular machine's C +// calling convention for function entry. Thus the new process can +// compute its exact stack bounds by subtracting the size reported by +// this VMO from the (adjusted back up) initial SP value. +#define PA_VMO_STACK 0x13u + +// VM object handle for the main executable file +#define PA_VMO_EXECUTABLE 0x14u + +// Used by kernel and userboot during startup +#define PA_VMO_BOOTDATA 0x1Au + +// Used by kernel and userboot during startup +#define PA_VMO_BOOTFS 0x1Bu + +// Used by the kernel to export debug information as a file in bootfs. When +// devmgr starts, it looks for handles of this type, and adds them as files in +// /boot/kernel/<vmo-name>. +#define PA_VMO_KERNEL_FILE 0x1Cu + +// --- Namespace Handles --- + +// A handle which will handle OPEN requests relative +// to a particular path which is specified by the +// nametable entry referred to by the "arg" field +#define PA_NS_DIR 0x20u + +// --- File Descriptor Handles --- + +// A handle which will be used as a file descriptor. +#define PA_FD 0x30u + +// -- Lifecyle handle -- +// +// A Handle to a channel on which the process may receive lifecycle events from +// the ELF runner by serving the |fuchsia.process.Lifecycle| protocol. +#define PA_LIFECYCLE 0x3Au + +// Server endpoint for handling connection to appmgr services. +#define PA_DIRECTORY_REQUEST 0x3Bu + +// Used by devmgr and devhosts +#define PA_RESOURCE 0x3Fu + +// --- Clock handles --- +// +// A clock which provides access to UTC. Used by runtimes which are expected to +// provide access to UTC via their standard libraries. +// +#define PA_CLOCK_UTC 0x40u + +// --- Various --- + +// Handle types for one-off use and prototyping +#define PA_USER0 0xF0u +#define PA_USER1 0xF1u +#define PA_USER2 0xF2u + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_PROCESSARGS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/rights.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/rights.h new file mode 100644 index 0000000..2ab61b9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/rights.h
@@ -0,0 +1,123 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_RIGHTS_H_ +#define SYSROOT_ZIRCON_RIGHTS_H_ + +#include <stdint.h> + +typedef uint32_t zx_rights_t; +#define ZX_RIGHT_NONE ((zx_rights_t)0u) +#define ZX_RIGHT_DUPLICATE ((zx_rights_t)1u << 0) +#define ZX_RIGHT_TRANSFER ((zx_rights_t)1u << 1) +#define ZX_RIGHT_READ ((zx_rights_t)1u << 2) +#define ZX_RIGHT_WRITE ((zx_rights_t)1u << 3) +#define ZX_RIGHT_EXECUTE ((zx_rights_t)1u << 4) +#define ZX_RIGHT_MAP ((zx_rights_t)1u << 5) +#define ZX_RIGHT_GET_PROPERTY ((zx_rights_t)1u << 6) +#define ZX_RIGHT_SET_PROPERTY ((zx_rights_t)1u << 7) +#define ZX_RIGHT_ENUMERATE ((zx_rights_t)1u << 8) +#define ZX_RIGHT_DESTROY ((zx_rights_t)1u << 9) +#define ZX_RIGHT_SET_POLICY ((zx_rights_t)1u << 10) +#define ZX_RIGHT_GET_POLICY ((zx_rights_t)1u << 11) +#define ZX_RIGHT_SIGNAL ((zx_rights_t)1u << 12) +#define ZX_RIGHT_SIGNAL_PEER ((zx_rights_t)1u << 13) +#define ZX_RIGHT_WAIT ((zx_rights_t)1u << 14) +#define ZX_RIGHT_INSPECT ((zx_rights_t)1u << 15) +#define ZX_RIGHT_MANAGE_JOB ((zx_rights_t)1u << 16) +#define ZX_RIGHT_MANAGE_PROCESS ((zx_rights_t)1u << 17) +#define ZX_RIGHT_MANAGE_THREAD ((zx_rights_t)1u << 18) +#define ZX_RIGHT_APPLY_PROFILE ((zx_rights_t)1u << 19) +#define ZX_RIGHT_SAME_RIGHTS ((zx_rights_t)1u << 31) + +// Convenient names for commonly grouped rights. +#define ZX_RIGHTS_BASIC (ZX_RIGHT_TRANSFER | ZX_RIGHT_DUPLICATE | ZX_RIGHT_WAIT | ZX_RIGHT_INSPECT) + +#define ZX_RIGHTS_IO (ZX_RIGHT_READ | ZX_RIGHT_WRITE) + +#define ZX_RIGHTS_PROPERTY (ZX_RIGHT_GET_PROPERTY | ZX_RIGHT_SET_PROPERTY) + +#define ZX_RIGHTS_POLICY (ZX_RIGHT_GET_POLICY | ZX_RIGHT_SET_POLICY) + +#define ZX_DEFAULT_CHANNEL_RIGHTS \ + ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_DUPLICATE)) | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL | \ + ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_EVENT_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_SYSTEM_EVENT_LOW_MEMORY_RIGHTS \ + (ZX_RIGHT_WAIT | ZX_RIGHT_DUPLICATE | ZX_RIGHT_TRANSFER) + +#define ZX_DEFAULT_EVENTPAIR_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_SIGNAL | ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_FIFO_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL | ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_GUEST_RIGHTS \ + (ZX_RIGHT_TRANSFER | ZX_RIGHT_DUPLICATE | ZX_RIGHT_WRITE | ZX_RIGHT_INSPECT | \ + ZX_RIGHT_MANAGE_PROCESS) + +#define ZX_DEFAULT_INTERRUPT_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_IO_MAPPING_RIGHTS (ZX_RIGHT_READ | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_JOB_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHTS_POLICY | ZX_RIGHT_ENUMERATE | \ + ZX_RIGHT_DESTROY | ZX_RIGHT_SIGNAL | ZX_RIGHT_MANAGE_JOB | ZX_RIGHT_MANAGE_PROCESS | \ + ZX_RIGHT_MANAGE_THREAD) + +#define ZX_DEFAULT_LOG_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_WRITE | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_MSI_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_PCI_DEVICE_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO) + +#define ZX_DEFAULT_PCI_INTERRUPT_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_PORT_RIGHTS ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) | ZX_RIGHTS_IO) + +#define ZX_DEFAULT_PROCESS_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHT_ENUMERATE | ZX_RIGHT_DESTROY | \ + ZX_RIGHT_SIGNAL | ZX_RIGHT_MANAGE_PROCESS | ZX_RIGHT_MANAGE_THREAD) + +#define ZX_DEFAULT_RESOURCE_RIGHTS \ + (ZX_RIGHT_TRANSFER | ZX_RIGHT_DUPLICATE | ZX_RIGHT_WRITE | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_SOCKET_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_GET_PROPERTY | ZX_RIGHT_SET_PROPERTY | \ + ZX_RIGHT_SIGNAL | ZX_RIGHT_SIGNAL_PEER) + +#define ZX_DEFAULT_STREAM_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_PROPERTY | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_THREAD_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHT_DESTROY | ZX_RIGHT_SIGNAL | \ + ZX_RIGHT_MANAGE_THREAD) + +#define ZX_DEFAULT_TIMER_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_WRITE | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_VCPU_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHT_EXECUTE | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_VMAR_RIGHTS (ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) + +#define ZX_DEFAULT_VMO_RIGHTS \ + (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO | ZX_RIGHTS_PROPERTY | ZX_RIGHT_MAP | ZX_RIGHT_SIGNAL) + +#define ZX_DEFAULT_IOMMU_RIGHTS (ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) + +#define ZX_DEFAULT_BTI_RIGHTS ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) | ZX_RIGHTS_IO | ZX_RIGHT_MAP) + +#define ZX_DEFAULT_PROFILE_RIGHTS ((ZX_RIGHTS_BASIC & (~ZX_RIGHT_WAIT)) | ZX_RIGHT_APPLY_PROFILE) + +#define ZX_DEFAULT_PMT_RIGHTS (ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_SUSPEND_TOKEN_RIGHTS (ZX_RIGHT_TRANSFER | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_PAGER_RIGHTS \ + (ZX_RIGHT_INSPECT | ZX_RIGHT_GET_PROPERTY | ZX_RIGHT_SET_PROPERTY | ZX_RIGHT_TRANSFER) + +#define ZX_DEFAULT_EXCEPTION_RIGHTS (ZX_RIGHT_TRANSFER | ZX_RIGHTS_PROPERTY | ZX_RIGHT_INSPECT) + +#define ZX_DEFAULT_CLOCK_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHTS_IO) + +#endif // SYSROOT_ZIRCON_RIGHTS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/sanitizer.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/sanitizer.h new file mode 100644 index 0000000..c2f2e8e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/sanitizer.h
@@ -0,0 +1,171 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SANITIZER_H_ +#define SYSROOT_ZIRCON_SANITIZER_H_ + +// Interfaces declared in this file are intended for the use of sanitizer +// runtime library implementation code. Each sanitizer runtime works only +// with the appropriately sanitized build of libc. These functions should +// never be called when using the unsanitized libc. But these names are +// always exported so that the libc ABI is uniform across sanitized and +// unsanitized builds (only unsanitized shared library binaries are used at +// link time, including linking the sanitizer runtime shared libraries). + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <threads.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// These are aliases for the functions defined in libc, which are always +// the unsanitized versions. The sanitizer runtimes can call them by these +// aliases when they are overriding libc's definitions of the unadorned +// symbols. +__typeof(memcpy) __unsanitized_memcpy; +__typeof(memmove) __unsanitized_memmove; +__typeof(memset) __unsanitized_memset; + +// The sanitized libc allocates the shadow memory in the appropriate ratio for +// the particular sanitizer (shadow_base == shadow_limit >> SHADOW_SCALE) +// early during startup, before any other address space allocations can occur. +// Shadow memory always starts at address zero: +// [memory_limit, UINTPTR_MAX) Address space reserved by the system. +// [shadow_limit, memory_limit) Address space available to the user. +// [shadow_base, shadow_limit) Shadow memory, preallocated. +// [0, shadow_base) Shadow gap, cannot be allocated. +typedef struct saniziter_shadow_bounds { + uintptr_t shadow_base; + uintptr_t shadow_limit; + uintptr_t memory_limit; +} sanitizer_shadow_bounds_t; + +// Returns the shadow bounds for the current process. +sanitizer_shadow_bounds_t __sanitizer_shadow_bounds(void); + +// Fill the shadow memory corresponding to [base, base+size) with |value|. The +// threshold is used as a hint to determine when to switch to a more efficient +// mechanism when zero-filling large shadow regions. This assumes that both +// |base| and |size| are aligned to the shadow multiple. +void __sanitizer_fill_shadow(uintptr_t base, size_t size, uint8_t value, size_t threshold); + +// Write logging information from the sanitizer runtime. The buffer +// is expected to be printable text with '\n' ending each line. +// Timestamps and globally unique identifiers of the calling process +// and thread (zx_koid_t) are attached to all messages, so there is no +// need to include those details in the text. The log of messages +// written with this call automatically includes address and ELF build +// ID details of the program and all shared libraries sufficient to +// translate raw address values into program symbols or source +// locations via a post-processor that has access to the original ELF +// files and their debugging information. The text can contain markup +// around address values that should be resolved symbolically; see +// TODO(mcgrathr) for the format and details of the post-processor. +void __sanitizer_log_write(const char* buffer, size_t len); + +// Runtimes that have binary data to publish (e.g. coverage) use this +// interface. The name describes the data sink that will receive this +// blob of data; the string is not used after this call returns. The +// caller creates a VMO (e.g. zx_vmo_create) and passes it in; the VMO +// handle is consumed by this call. Each particular data sink has its +// own conventions about both the format of the data in the VMO and the +// protocol for when data must be written there. For some sinks, the +// VMO's data is used immediately. For other sinks, the caller is +// expected to have the VMO mapped in and be writing more data there +// throughout the life of the process, to be analyzed only after the +// process terminates. Yet others might use an asynchronous shared +// memory protocol between producer and consumer. +void __sanitizer_publish_data(const char* sink_name, zx_handle_t vmo); + +// Runtimes that want to read configuration files use this interface. +// The name is a string from the user (something akin to a file name +// but not necessarily actually a file name); the string is not used +// after this call returns. On success, this yields a read-only VMO +// handle from which the contents associated with that name can be +// read; the caller is responsible for closing this handle. +zx_status_t __sanitizer_get_configuration(const char* config_name, zx_handle_t* out_vmo); + +// Changes protection of the code in the range of len bytes starting +// from addr. The writable argument specifies whether the code should +// be made writable or not. This function is only valid on ranges within +// the caller's own code segment. +// TODO(phosek) removes this when the proper debugging interface exists. +zx_status_t __sanitizer_change_code_protection(uintptr_t addr, size_t len, bool writable); + +// This stops all other threads in the process so memory should be quiescent. +// Then it makes callbacks for memory regions containing non-const global +// variables, thread stacks, thread registers, and thread-local storage +// regions (this includes thread_local variables as well as tss_set or +// pthread_setspecific values). Each callback is optional; no such callbacks +// are made if a null function pointer is given. The memory region passed to +// each callback can be accessed only during that single callback and might no +// longer be valid once the callback returns. Then it makes a final callback +// before allowing other threads to resume running normally. If there are +// problems stopping threads, no memory callbacks will be made and the +// argument to the final callback will get an error code rather than ZX_OK. +typedef void sanitizer_memory_snapshot_callback_t(void* mem, size_t len, void* arg); +void __sanitizer_memory_snapshot(sanitizer_memory_snapshot_callback_t* globals, + sanitizer_memory_snapshot_callback_t* stacks, + sanitizer_memory_snapshot_callback_t* regs, + sanitizer_memory_snapshot_callback_t* tls, + void (*done)(zx_status_t, void*), void* arg); + +// The "hook" interfaces are functions that the sanitizer runtime library +// can define and libc will call. There are default definitions in libc +// which do nothing, but any other definitions will override those. These +// declarations use __EXPORT (i.e. explicit STV_DEFAULT) to ensure any user +// definitions are seen by libc even if the user code is being compiled +// with -fvisibility=hidden or equivalent. + +// This is called at program startup, with the arguments that will be +// passed to main. This is called before any other application code, +// including both static constructors and initialization of things like +// fdio and zx_take_startup_handle. It's basically the first thing called +// after libc's most basic internal global initialization is complete and +// the initial thread has switched to its real thread stack. Since not +// even all of libc's own constructors have run yet, this should not call +// into libc or other library code. +__EXPORT void __sanitizer_startup_hook(int argc, char** argv, char** envp, void* stack_base, + size_t stack_size); + +// This is called when a new thread has been created but is not yet +// running. Its C11 thrd_t value has been determined and its stack has +// been allocated. All that remains is to actually start the thread +// running (which can fail only in catastrophic bug situations). Its +// return value will be passed to __sanitizer_thread_create_hook, below. +__EXPORT void* __sanitizer_before_thread_create_hook(thrd_t thread, bool detached, const char* name, + void* stack_base, size_t stack_size); + +// This is called after a new thread has been created or creation has +// failed at the final stage; __sanitizer_before_thread_create_hook has +// been called first, and its return value is the first argument here. +// The second argument is what the return value of C11 thrd_create would +// be for this creation attempt (which might have been instigated by +// either thrd_create or pthread_create). If it's thrd_success, then +// the new thread has now started running. Otherwise (it's a different +// <threads.h> thrd_* value), thread creation has failed and the thread +// details reported to __sanitizer_before_thread_create_hook will be +// freed without the thread ever starting. +__EXPORT void __sanitizer_thread_create_hook(void* hook, thrd_t thread, int error); + +// This is called in each new thread as it starts up. The argument is +// the same one returned by __sanitizer_before_thread_create_hook and +// previously passed to __sanitizer_thread_create_hook. +__EXPORT void __sanitizer_thread_start_hook(void* hook, thrd_t self); + +// This is called in each thread just before it dies. +// All thread-specific destructors have been run. +// The argument is the same one passed to __sanitizer_thread_start_hook. +__EXPORT void __sanitizer_thread_exit_hook(void* hook, thrd_t self); + +// This is called with the argument to _exit and its return value +// is the actual exit status for the process. +__EXPORT int __sanitizer_process_exit_hook(int status); + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SANITIZER_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/status.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/status.h new file mode 100644 index 0000000..798d2b0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/status.h
@@ -0,0 +1,23 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include <zircon/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Given one of the status codes defined in <zircon/errors.h> (ZX_ERR_* or +// ZX_OK), this function returns an identifier string for the status code. +// +// For example, zx_status_get_string(ZX_ERR_TIMED_OUT) returns the string +// "ZX_ERR_TIMED_OUT". +__EXPORT const char* _zx_status_get_string(zx_status_t status); +__EXPORT const char* zx_status_get_string(zx_status_t status); + +#ifdef __cplusplus +} +#endif
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/string_view.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/string_view.h new file mode 100644 index 0000000..f54ff2a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/string_view.h
@@ -0,0 +1,67 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include <stddef.h> +#if __cplusplus >= 201103L && __has_include(<type_traits>) +#include <type_traits> +#endif + +// This represents a UTF-8 string constant provided by the vDSO itself. +// This pointer remains valid and the string doesn't change for the +// life of the process (if not the system). +// +// This type exists to be the return value type for vDSO functions. +// In current machine ABIs, it's returned "for free" in two registers. +// To a C caller, these functions have ABIs indistinguishable from if +// they simply returned `const char*` so there is no overhead to +// supporting the explicit-length API as well as the traditional C +// string API, though it does require writing out `.c_str` in the +// source. C++ 17 callers can take advantage of direct coercion to +// the standard std::string_view and std::u8string_view types, which +// also allows e.g. direct construction of std::string. +typedef struct { + const char* c_str; // UTF-8, guaranteed to be '\0'-terminated. + size_t length; // Length, not including the '\0' terminator. + +#ifdef __cplusplus + // This is ABI-identical to the usual implementation of std::string_view, + // when applied to NUL-terminated C strings. But this API doesn't presume + // that std::string_view has a particular implementation or exists at all. + // For convenience of use without directly using the C++ standard library + // API, a templatized implicit coercion is defined to types that have the + // API of std::string_view or std::u8string_view. With the most common + // implementations, this coercion will be compiled away to nothing. + template < + typename _T +#if __cplusplus >= 201103L && __has_include(<type_traits>) + , + typename = typename std::enable_if<sizeof(typename _T::value_type) == sizeof(char)>::type +#endif + > + operator _T() { + // It's preferable to exclude incompatible types via SFINAE so that + // the user's diagnostic experience is exactly as if no coercion + // operator existed. SFINAE should exclude this definition when a + // C++11 <type_traits> is available to define std::enable_if. If + // no standard C++ library header is available, this will provide + // a specific diagnostic. + static_assert(sizeof(typename _T::value_type) == sizeof(char), + "zx_string_view_t can be coerced to C++ 17 std::string_view" + " or std::u8string_view or types with equivalent API"); + return {reinterpret_cast<typename _T::const_pointer>(c_str), length}; + } + + // Preferably zx_string_view_t values should just be coerced to + // std::string_view. But it provides the most minimal aspects of + // the equivalent API in case a return value expression is used + // directly as `zx_foo_string().data()`, for example. + using value_type = char; + using const_pointer = const char*; + using size_type = size_t; + const_pointer data() const { return c_str; } + size_type size() const { return length; } +#endif +} zx_string_view_t;
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls.h new file mode 100644 index 0000000..9e79e55 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls.h
@@ -0,0 +1,41 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_H_ +#define SYSROOT_ZIRCON_SYSCALLS_H_ + +#include <zircon/string_view.h> +#include <zircon/syscalls/object.h> +#include <zircon/syscalls/pci.h> +#include <zircon/syscalls/profile.h> +#include <zircon/syscalls/types.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +#define _ZX_SYSCALL_DECL(name, type, attrs, nargs, arglist, prototype) \ + extern attrs type zx_##name prototype; \ + extern attrs type _zx_##name prototype; + +#ifdef __clang__ +#define _ZX_SYSCALL_ANNO(attr) __attribute__((attr)) +#else +#define _ZX_SYSCALL_ANNO(attr) // Nothing for compilers without the support. +#endif + +#include <zircon/syscalls/internal/cdecls.inc> + +#undef _ZX_SYSCALL_ANNO +#undef _ZX_SYSCALL_DECL + +// Compatibility wrappers for deprecated syscalls also go here, when +// there are any. + +// This DEPRECATED interface is replaced by zx_system_get_version_string. +zx_status_t zx_system_get_version(char* version, size_t version_size) __LEAF_FN; +zx_status_t _zx_system_get_version(char* version, size_t version_size) __LEAF_FN; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/clock.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/clock.h new file mode 100644 index 0000000..eab1cd1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/clock.h
@@ -0,0 +1,90 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_CLOCK_H_ +#define SYSROOT_ZIRCON_SYSCALLS_CLOCK_H_ + +#include <zircon/time.h> + +// clang-format off + +// Argument version identifiers. +// +// All zx_clock_* syscalls which fetch or receive a structure's worth of +// arguments encode a version number in the options field of the syscall. This +// version field is in the same location and is the same size for each syscall, +// so a common set of macros may be used for encoding and decoding. +#define ZX_CLOCK_ARGS_VERSION_SHIFT ((uint64_t)58u) +#define ZX_CLOCK_ARGS_VERSION_BITS ((uint64_t)6u) +#define ZX_CLOCK_ARGS_VERSION_MASK \ + (((((uint64_t)1) << ZX_CLOCK_ARGS_VERSION_BITS) - 1) << ZX_CLOCK_ARGS_VERSION_SHIFT) +#define ZX_CLOCK_ARGS_VERSION(_N) \ + (((uint64_t)(_N) << ZX_CLOCK_ARGS_VERSION_SHIFT) & ZX_CLOCK_ARGS_VERSION_MASK) + +// Clock creation options. +#define ZX_CLOCK_OPT_MONOTONIC ((uint64_t)1u << 0) +#define ZX_CLOCK_OPT_CONTINUOUS ((uint64_t)1u << 1) +#define ZX_CLOCK_OPT_AUTO_START ((uint64_t)1u << 2) + +#define ZX_CLOCK_OPTS_ALL ( \ + ZX_CLOCK_OPT_MONOTONIC | \ + ZX_CLOCK_OPT_CONTINUOUS | \ + ZX_CLOCK_OPT_AUTO_START) + +// Clock update flags +#define ZX_CLOCK_UPDATE_OPTION_VALUE_VALID ((uint64_t)1u << 0) +#define ZX_CLOCK_UPDATE_OPTION_RATE_ADJUST_VALID ((uint64_t)1u << 1) +#define ZX_CLOCK_UPDATE_OPTION_ERROR_BOUND_VALID ((uint64_t)1u << 2) + +#define ZX_CLOCK_UPDATE_OPTIONS_ALL ( \ + ZX_CLOCK_UPDATE_OPTION_VALUE_VALID | \ + ZX_CLOCK_UPDATE_OPTION_RATE_ADJUST_VALID | \ + ZX_CLOCK_UPDATE_OPTION_ERROR_BOUND_VALID) + +// Clock rate adjustment limits +#define ZX_CLOCK_UPDATE_MIN_RATE_ADJUST ((int32_t)-1000) +#define ZX_CLOCK_UPDATE_MAX_RATE_ADJUST ((int32_t)1000) + +// Special clock error values +#define ZX_CLOCK_UNKNOWN_ERROR ((uint64_t)0xFFFFFFFFFFFFFFFF) + +// clang-format on + +typedef struct zx_clock_create_args_v1 { + zx_time_t backstop_time; +} zx_clock_create_args_v1_t; + +typedef struct zx_clock_rate { + uint32_t synthetic_ticks; + uint32_t reference_ticks; +} zx_clock_rate_t; + +typedef struct zx_clock_transformation { + int64_t reference_offset; + int64_t synthetic_offset; + zx_clock_rate_t rate; +} zx_clock_transformation_t; + +typedef struct zx_clock_details_v1 { + uint64_t options; + zx_time_t backstop_time; + zx_clock_transformation_t ticks_to_synthetic; + zx_clock_transformation_t mono_to_synthetic; + uint64_t error_bound; + zx_ticks_t query_ticks; + zx_ticks_t last_value_update_ticks; + zx_ticks_t last_rate_adjust_update_ticks; + zx_ticks_t last_error_bounds_update_ticks; + uint32_t generation_counter; + uint8_t padding1[4]; +} zx_clock_details_v1_t; + +typedef struct zx_clock_update_args_v1 { + int32_t rate_adjust; + uint8_t padding1[4]; + int64_t value; + uint64_t error_bound; +} zx_clock_update_args_v1_t; + +#endif // SYSROOT_ZIRCON_SYSCALLS_CLOCK_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/debug.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/debug.h new file mode 100644 index 0000000..373381f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/debug.h
@@ -0,0 +1,179 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_DEBUG_ +#define SYSROOT_ZIRCON_SYSCALLS_DEBUG_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +#if defined(__x86_64__) + +// Value for ZX_THREAD_STATE_GENERAL_REGS on x86-64 platforms. +typedef struct zx_thread_state_general_regs { + uint64_t rax; + uint64_t rbx; + uint64_t rcx; + uint64_t rdx; + uint64_t rsi; + uint64_t rdi; + uint64_t rbp; + uint64_t rsp; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rip; + uint64_t rflags; + uint64_t fs_base; + uint64_t gs_base; +} zx_thread_state_general_regs_t; + +// Value for ZX_THREAD_STATE_FP_REGS on x64. Holds x87 and MMX state. +typedef struct zx_thread_state_fp_regs { + uint16_t fcw; // Control word. + uint16_t fsw; // Status word. + uint8_t ftw; // Tag word. + uint8_t reserved; + uint16_t fop; // Opcode. + uint64_t fip; // Instruction pointer. + uint64_t fdp; // Data pointer. + + uint8_t padding1[8]; + + // The x87/MMX state. For x87 the each "st" entry has the low 80 bits used for the register + // contents. For MMX, the low 64 bits are used. The higher bits are unused. + __ALIGNED(16) + struct { + uint64_t low; + uint64_t high; + } st[8]; +} zx_thread_state_fp_regs_t; + +// Value for ZX_THREAD_STATE_VECTOR_REGS on x64. Holds SSE and AVX registers. +// +// Setting vector registers will only work for threads that have previously executed an +// instruction using the corresponding register class. +typedef struct zx_thread_state_vector_regs { + // When only 16 registers are supported (pre-AVX-512), zmm[16-31] will be 0. + // YMM registers (256 bits) are v[0-4], XMM registers (128 bits) are v[0-2]. + struct { + uint64_t v[8]; + } zmm[32]; + + // AVX-512 opmask registers. Will be 0 unless AVX-512 is supported. + uint64_t opmask[8]; + + // SIMD control and status register. + uint32_t mxcsr; + + uint8_t padding1[4]; +} zx_thread_state_vector_regs_t; + +// Value for ZX_THREAD_STATE_DEBUG_REGS on x64 platforms. +typedef struct zx_thread_state_debug_regs { + uint64_t dr[4]; + // DR4 and D5 are not used. + uint64_t dr6; // Status register. + uint64_t dr7; // Control register. +} zx_thread_state_debug_regs_t; + +#elif defined(__aarch64__) + +// Value for ZX_THREAD_STATE_GENERAL_REGS on ARM64 platforms. +typedef struct zx_thread_state_general_regs { + uint64_t r[30]; + uint64_t lr; + uint64_t sp; + uint64_t pc; + uint64_t cpsr; + uint64_t tpidr; +} zx_thread_state_general_regs_t; + +// Value for ZX_THREAD_STATE_FP_REGS on ARM64 platforms. +// This is unused because vector state is used for all floating point on ARM64. +typedef struct zx_thread_state_fp_regs { + // Avoids sizing differences for empty structs between C and C++. + uint32_t unused; +} zx_thread_state_fp_regs_t; + +// Value for ZX_THREAD_STATE_VECTOR_REGS on ARM64 platforms. +typedef struct zx_thread_state_vector_regs { + uint32_t fpcr; + uint32_t fpsr; + struct { + uint64_t low; + uint64_t high; + } v[32]; +} zx_thread_state_vector_regs_t; + +// ARMv8-A provides 2 to 16 hardware breakpoint registers. +// The number is obtained by the BRPs field in the EDDFR register. +#define AARCH64_MAX_HW_BREAKPOINTS 16 +// ARMv8-A provides 2 to 16 watchpoint breakpoint registers. +// The number is obtained by the WRPs field in the EDDFR register. +#define AARCH64_MAX_HW_WATCHPOINTS 16 + +// Value for XZ_THREAD_STATE_DEBUG_REGS for ARM64 platforms. +typedef struct zx_thread_state_debug_regs { + struct { + uint32_t dbgbcr; // HW Breakpoint Control register. + uint8_t padding1[4]; + uint64_t dbgbvr; // HW Breakpoint Value register. + } hw_bps[AARCH64_MAX_HW_BREAKPOINTS]; + // Number of HW Breakpoints in the platform. + // Will be set on read and ignored on write. + + struct { + uint32_t dbgwcr; // HW Watchpoint Control register. + uint8_t padding1[4]; + uint64_t dbgwvr; // HW Watchpoint Value register. + } hw_wps[AARCH64_MAX_HW_WATCHPOINTS]; + + // Faulting Virtual Address for watchpoint exceptions. + // Read-only, values are ignored on write. + uint64_t far; + + // The esr value since the last exception. + // Read-only, values are ignored on write. + uint32_t esr; + + // Number of HW Breakpoints/Watchpoints in the platform. + // Will be set on read and ignored on write. + uint8_t hw_bps_count; + uint8_t hw_wps_count; + + uint8_t padding1[2]; + +} zx_thread_state_debug_regs_t; + +#endif + +// Value for ZX_THREAD_STATE_SINGLE_STEP. The value can be 0 (not single-stepping), or 1 +// (single-stepping). Other values will give ZX_ERR_INVALID_ARGS. +typedef uint32_t zx_thread_state_single_step_t; + +// Values for ZX_THREAD_X86_REGISTER_FS and ZX_THREAD_X86_REGISTER_GS; +typedef uint64_t zx_thread_x86_register_fs_t; +typedef uint64_t zx_thread_x86_register_gs_t; + +// Possible values for "kind" in zx_thread_read_state and zx_thread_write_state. +typedef uint32_t zx_thread_state_topic_t; +#define ZX_THREAD_STATE_GENERAL_REGS ((uint32_t)0) // zx_thread_state_general_regs_t value. +#define ZX_THREAD_STATE_FP_REGS ((uint32_t)1) // zx_thread_state_fp_regs_t value. +#define ZX_THREAD_STATE_VECTOR_REGS ((uint32_t)2) // zx_thread_state_vector_regs_t value. +#define ZX_THREAD_STATE_DEBUG_REGS ((uint32_t)4) // zx_thread_state_debug_regs_t value. +#define ZX_THREAD_STATE_SINGLE_STEP ((uint32_t)5) // zx_thread_state_single_step_t value. +#define ZX_THREAD_X86_REGISTER_FS ((uint32_t)6) // zx_thread_x86_register_fs_t value. +#define ZX_THREAD_X86_REGISTER_GS ((uint32_t)7) // zx_thread_x86_register_gs_t value. + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_DEBUG_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/exception.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/exception.h new file mode 100644 index 0000000..6191e0f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/exception.h
@@ -0,0 +1,136 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_EXCEPTION_H_ +#define SYSROOT_ZIRCON_SYSCALLS_EXCEPTION_H_ + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +// The following exception values were chosen for historical reasons. + +// Architectural exceptions. +// +// Depending on the exception, further information can be found in +// |report.context.arch|. + +#define ZX_EXCP_GENERAL ((uint32_t) 0x008u) +#define ZX_EXCP_FATAL_PAGE_FAULT ((uint32_t) 0x108u) +#define ZX_EXCP_UNDEFINED_INSTRUCTION ((uint32_t) 0x208u) +#define ZX_EXCP_SW_BREAKPOINT ((uint32_t) 0x308u) +#define ZX_EXCP_HW_BREAKPOINT ((uint32_t) 0x408u) +#define ZX_EXCP_UNALIGNED_ACCESS ((uint32_t) 0x508u) + +// Synthetic exceptions. + +// These bits are set for synthetic exceptions to distinguish them from +// architectural exceptions. +#define ZX_EXCP_SYNTH ((uint32_t) 0x8000u) + +// A thread is starting. +// This exception is sent to debuggers only (ZX_EXCEPTION_CHANNEL_TYPE_DEBUGGER). +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_THREAD_STARTING ((uint32_t) 0x008u | ZX_EXCP_SYNTH) + +// A thread is exiting. +// This exception is sent to debuggers only (ZX_EXCEPTION_CHANNEL_TYPE_DEBUGGER). +// This exception is different from ZX_EXCP_GONE in that a debugger can +// still examine thread state. +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_THREAD_EXITING ((uint32_t) 0x108u | ZX_EXCP_SYNTH) + +// This exception is generated when a syscall fails with a job policy +// error (for example, an invalid handle argument is passed to the +// syscall when the ZX_POL_BAD_HANDLE policy is enabled) and +// ZX_POL_ACTION_EXCEPTION is set for the policy. +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_POLICY_ERROR ((uint32_t) 0x208u | ZX_EXCP_SYNTH) + +// A process is starting. +// This exception is sent to job debuggers only +// (ZX_EXCEPTION_CHANNEL_TYPE_JOB_DEBUGGER). +// The thread that generates this exception is paused until it the debugger +// handles the exception. +#define ZX_EXCP_PROCESS_STARTING ((uint32_t) 0x308u | ZX_EXCP_SYNTH) + +typedef uint32_t zx_excp_type_t; + +// Assuming |excp| is an exception type, the following returns true if the +// type is architectural. +#define ZX_EXCP_IS_ARCH(excp) (((excp) & ZX_EXCP_SYNTH) == 0) + +typedef struct zx_x86_64_exc_data { + uint64_t vector; + uint64_t err_code; + uint64_t cr2; +} zx_x86_64_exc_data_t; + +typedef struct zx_arm64_exc_data { + uint32_t esr; + uint8_t padding1[4]; + uint64_t far; +} zx_arm64_exc_data_t; + +// data associated with an exception (siginfo in linux parlance) +// Things available from regsets (e.g., pc) are not included here. +// For an example list of things one might add, see linux siginfo. +typedef struct zx_exception_context { + struct { + union { + zx_x86_64_exc_data_t x86_64; + struct { + zx_arm64_exc_data_t arm_64; + uint8_t padding1[8]; + }; + } u; + } arch; +} zx_exception_context_t; + +// The common header of all exception reports. +typedef struct zx_exception_header { + // The actual size, in bytes, of the report (including this field). + uint32_t size; + + zx_excp_type_t type; +} zx_exception_header_t; + +// Data reported to an exception handler for most exceptions. +typedef struct zx_exception_report { + zx_exception_header_t header; + // The remainder of the report is exception-specific. + zx_exception_context_t context; +} zx_exception_report_t; + +// Basic info sent along with the handle over an exception channel. +typedef struct zx_exception_info { + zx_koid_t pid; + zx_koid_t tid; + zx_excp_type_t type; + uint8_t padding1[4]; +} zx_exception_info_t; + +// Options for zx_create_exception_channel. +// When creating an exception channel, use the task's debug channel. +#define ZX_EXCEPTION_CHANNEL_DEBUGGER ((uint32_t)1) + +// The type of exception handler a thread may be waiting for a response from. +// These values are reported in zx_info_thread_t.wait_exception_channel_type. +#define ZX_EXCEPTION_CHANNEL_TYPE_NONE ((uint32_t)0u) +#define ZX_EXCEPTION_CHANNEL_TYPE_DEBUGGER ((uint32_t)1u) +#define ZX_EXCEPTION_CHANNEL_TYPE_THREAD ((uint32_t)2u) +#define ZX_EXCEPTION_CHANNEL_TYPE_PROCESS ((uint32_t)3u) +#define ZX_EXCEPTION_CHANNEL_TYPE_JOB ((uint32_t)4u) +#define ZX_EXCEPTION_CHANNEL_TYPE_JOB_DEBUGGER ((uint32_t)5u) + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_EXCEPTION_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/hypervisor.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/hypervisor.h new file mode 100644 index 0000000..f574d4e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/hypervisor.h
@@ -0,0 +1,78 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_HYPERVISOR_H_ +#define SYSROOT_ZIRCON_SYSCALLS_HYPERVISOR_H_ + +#include <assert.h> + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// clang-format off +typedef uint32_t zx_guest_trap_t; + +#define ZX_GUEST_TRAP_BELL ((zx_guest_trap_t) 0u) +#define ZX_GUEST_TRAP_MEM ((zx_guest_trap_t) 1u) +#define ZX_GUEST_TRAP_IO ((zx_guest_trap_t) 2u) + +typedef uint32_t zx_vcpu_t; + +#define ZX_VCPU_STATE ((zx_vcpu_t) 0u) +#define ZX_VCPU_IO ((zx_vcpu_t) 1u) +// clang-format on + +// Structure to read and write VCPU state. +typedef struct zx_vcpu_state { +#if __aarch64__ + uint64_t x[31]; + uint64_t sp; + // Contains only the user-controllable upper 4-bits (NZCV). + uint32_t cpsr; + uint8_t padding1[4]; +#elif __x86_64__ + uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t rbx; + uint64_t rsp; + uint64_t rbp; + uint64_t rsi; + uint64_t rdi; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + // Contains only the user-controllable lower 32-bits. + uint64_t rflags; +#endif +} zx_vcpu_state_t; + +// Structure to read and write VCPU state for IO ports. +typedef struct zx_vcpu_io { + uint8_t access_size; + uint8_t padding1[3]; + union { + struct { + uint8_t u8; + uint8_t padding2[3]; + }; + struct { + uint16_t u16; + uint8_t padding3[2]; + }; + uint32_t u32; + uint8_t data[4]; + }; +} zx_vcpu_io_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_HYPERVISOR_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/internal/cdecls.inc b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/internal/cdecls.inc new file mode 100644 index 0000000..1a14308 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/internal/cdecls.inc
@@ -0,0 +1,1057 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// WARNING: THIS FILE IS MACHINE GENERATED BY //tools/kazoo. DO NOT EDIT. + +#ifndef _ZX_SYSCALL_DECL +#error "<zircon/syscalls.h> is the public API header" +#endif + +_ZX_SYSCALL_DECL(bti_create, zx_status_t, /* no attributes */, 4, + (iommu, options, bti_id, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t iommu, + uint32_t options, + uint64_t bti_id, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(bti_pin, zx_status_t, /* no attributes */, 8, + (handle, options, vmo, offset, size, addrs, num_addrs, pmt), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + uint64_t offset, + uint64_t size, + zx_paddr_t* addrs, + size_t num_addrs, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* pmt)) + +_ZX_SYSCALL_DECL(bti_release_quarantine, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(cache_flush, zx_status_t, /* no attributes */, 3, + (addr, size, options), ( + const void* addr, + size_t size, + uint32_t options)) + +_ZX_SYSCALL_DECL(channel_create, zx_status_t, /* no attributes */, 3, + (options, out0, out1), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(channel_read, zx_status_t, /* no attributes */, 8, + (handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles), ( + _ZX_SYSCALL_ANNO(use_handle("FuchsiaUnchecked")) zx_handle_t handle, + uint32_t options, + void* bytes, + _ZX_SYSCALL_ANNO(acquire_handle("FuchsiaUnchecked")) zx_handle_t* handles, + uint32_t num_bytes, + uint32_t num_handles, + uint32_t* actual_bytes, + uint32_t* actual_handles)) + +_ZX_SYSCALL_DECL(channel_read_etc, zx_status_t, /* no attributes */, 8, + (handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + void* bytes, + zx_handle_info_t* handles, + uint32_t num_bytes, + uint32_t num_handles, + uint32_t* actual_bytes, + uint32_t* actual_handles)) + +_ZX_SYSCALL_DECL(channel_write, zx_status_t, /* no attributes */, 6, + (handle, options, bytes, num_bytes, handles, num_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* bytes, + uint32_t num_bytes, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) const zx_handle_t* handles, + uint32_t num_handles)) + +_ZX_SYSCALL_DECL(channel_write_etc, zx_status_t, /* no attributes */, 6, + (handle, options, bytes, num_bytes, handles, num_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* bytes, + uint32_t num_bytes, + zx_handle_disposition_t* handles, + uint32_t num_handles)) + +_ZX_SYSCALL_DECL(channel_call, zx_status_t, /* no attributes */, 6, + (handle, options, deadline, args, actual_bytes, actual_handles), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_time_t deadline, + const zx_channel_call_args_t* args, + uint32_t* actual_bytes, + uint32_t* actual_handles)) + +_ZX_SYSCALL_DECL(clock_get, zx_status_t, /* no attributes */, 2, + (clock_id, out), ( + zx_clock_t clock_id, + zx_time_t* out)) + +_ZX_SYSCALL_DECL(clock_get_monotonic, zx_time_t, /* no attributes */, 0, + (), (void)) + +_ZX_SYSCALL_DECL(clock_adjust, zx_status_t, /* no attributes */, 3, + (handle, clock_id, offset), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_clock_t clock_id, + int64_t offset)) + +_ZX_SYSCALL_DECL(clock_create, zx_status_t, /* no attributes */, 3, + (options, args, out), ( + uint64_t options, + const void* args, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(clock_read, zx_status_t, /* no attributes */, 2, + (handle, now), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t* now)) + +_ZX_SYSCALL_DECL(clock_get_details, zx_status_t, /* no attributes */, 3, + (handle, options, details), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t options, + void* details)) + +_ZX_SYSCALL_DECL(clock_update, zx_status_t, /* no attributes */, 3, + (handle, options, args), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t options, + const void* args)) + +_ZX_SYSCALL_DECL(cprng_draw, void, /* no attributes */, 2, + (buffer, buffer_size), ( + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(cprng_add_entropy, zx_status_t, /* no attributes */, 2, + (buffer, buffer_size), ( + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debug_read, zx_status_t, /* no attributes */, 4, + (handle, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + char* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(debug_write, zx_status_t, /* no attributes */, 2, + (buffer, buffer_size), ( + const char* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debug_send_command, zx_status_t, /* no attributes */, 3, + (resource, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + const char* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debuglog_create, zx_status_t, /* no attributes */, 3, + (resource, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(debuglog_write, zx_status_t, /* no attributes */, 4, + (handle, options, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(debuglog_read, zx_status_t, /* no attributes */, 4, + (handle, options, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(event_create, zx_status_t, /* no attributes */, 2, + (options, out), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(eventpair_create, zx_status_t, /* no attributes */, 3, + (options, out0, out1), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(exception_get_thread, zx_status_t, /* no attributes */, 2, + (handle, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(exception_get_process, zx_status_t, /* no attributes */, 2, + (handle, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(fifo_create, zx_status_t, /* no attributes */, 5, + (elem_count, elem_size, options, out0, out1), ( + size_t elem_count, + size_t elem_size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(fifo_read, zx_status_t, /* no attributes */, 5, + (handle, elem_size, data, data_size, actual_count), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + size_t elem_size, + void* data, + size_t data_size, + size_t* actual_count)) + +_ZX_SYSCALL_DECL(fifo_write, zx_status_t, /* no attributes */, 5, + (handle, elem_size, data, count, actual_count), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + size_t elem_size, + const void* data, + size_t count, + size_t* actual_count)) + +_ZX_SYSCALL_DECL(framebuffer_get_info, zx_status_t, /* no attributes */, 5, + (resource, format, width, height, stride), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t* format, + uint32_t* width, + uint32_t* height, + uint32_t* stride)) + +_ZX_SYSCALL_DECL(framebuffer_set_range, zx_status_t, /* no attributes */, 7, + (resource, vmo, len, format, width, height, stride), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + uint32_t len, + uint32_t format, + uint32_t width, + uint32_t height, + uint32_t stride)) + +_ZX_SYSCALL_DECL(futex_wait, zx_status_t, /* no attributes */, 4, + (value_ptr, current_value, new_futex_owner, deadline), ( + const zx_futex_t* value_ptr, + zx_futex_t current_value, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t new_futex_owner, + zx_time_t deadline)) + +_ZX_SYSCALL_DECL(futex_wake, zx_status_t, /* no attributes */, 2, + (value_ptr, wake_count), ( + const zx_futex_t* value_ptr, + uint32_t wake_count)) + +_ZX_SYSCALL_DECL(futex_requeue, zx_status_t, /* no attributes */, 6, + (value_ptr, wake_count, current_value, requeue_ptr, requeue_count, new_requeue_owner), ( + const zx_futex_t* value_ptr, + uint32_t wake_count, + zx_futex_t current_value, + const zx_futex_t* requeue_ptr, + uint32_t requeue_count, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t new_requeue_owner)) + +_ZX_SYSCALL_DECL(futex_wake_single_owner, zx_status_t, /* no attributes */, 1, + (value_ptr), ( + const zx_futex_t* value_ptr)) + +_ZX_SYSCALL_DECL(futex_requeue_single_owner, zx_status_t, /* no attributes */, 5, + (value_ptr, current_value, requeue_ptr, requeue_count, new_requeue_owner), ( + const zx_futex_t* value_ptr, + zx_futex_t current_value, + const zx_futex_t* requeue_ptr, + uint32_t requeue_count, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t new_requeue_owner)) + +_ZX_SYSCALL_DECL(futex_get_owner, zx_status_t, /* no attributes */, 2, + (value_ptr, koid), ( + const zx_futex_t* value_ptr, + zx_koid_t* koid)) + +_ZX_SYSCALL_DECL(guest_create, zx_status_t, /* no attributes */, 4, + (resource, options, guest_handle, vmar_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* guest_handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* vmar_handle)) + +_ZX_SYSCALL_DECL(guest_set_trap, zx_status_t, /* no attributes */, 6, + (handle, kind, addr, size, port_handle, key), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + zx_vaddr_t addr, + size_t size, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port_handle, + uint64_t key)) + +_ZX_SYSCALL_DECL(handle_close, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(handle_close_many, zx_status_t, /* no attributes */, 2, + (handles, num_handles), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) const zx_handle_t* handles, + size_t num_handles)) + +_ZX_SYSCALL_DECL(handle_duplicate, zx_status_t, /* no attributes */, 3, + (handle, rights, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_rights_t rights, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(handle_replace, zx_status_t, /* no attributes */, 3, + (handle, rights, out), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t handle, + zx_rights_t rights, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(interrupt_create, zx_status_t, /* no attributes */, 4, + (src_obj, src_num, options, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t src_obj, + uint32_t src_num, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(interrupt_bind, zx_status_t, /* no attributes */, 4, + (handle, port_handle, key, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port_handle, + uint64_t key, + uint32_t options)) + +_ZX_SYSCALL_DECL(interrupt_wait, zx_status_t, /* no attributes */, 2, + (handle, out_timestamp), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t* out_timestamp)) + +_ZX_SYSCALL_DECL(interrupt_destroy, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(interrupt_ack, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(interrupt_trigger, zx_status_t, /* no attributes */, 3, + (handle, options, timestamp), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_time_t timestamp)) + +_ZX_SYSCALL_DECL(interrupt_bind_vcpu, zx_status_t, /* no attributes */, 3, + (handle, vcpu, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vcpu, + uint32_t options)) + +_ZX_SYSCALL_DECL(iommu_create, zx_status_t, /* no attributes */, 5, + (resource, type, desc, desc_size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t type, + const void* desc, + size_t desc_size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(ioports_request, zx_status_t, /* no attributes */, 3, + (resource, io_addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint16_t io_addr, + uint32_t len)) + +_ZX_SYSCALL_DECL(ioports_release, zx_status_t, /* no attributes */, 3, + (resource, io_addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint16_t io_addr, + uint32_t len)) + +_ZX_SYSCALL_DECL(job_create, zx_status_t, /* no attributes */, 3, + (parent_job, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t parent_job, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(job_set_policy, zx_status_t, /* no attributes */, 5, + (handle, options, topic, policy, policy_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + uint32_t topic, + const void* policy, + uint32_t policy_size)) + +_ZX_SYSCALL_DECL(job_set_critical, zx_status_t, /* no attributes */, 3, + (job, options, process), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t job, + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t process)) + +_ZX_SYSCALL_DECL(ktrace_read, zx_status_t, /* no attributes */, 5, + (handle, data, offset, data_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + void* data, + uint32_t offset, + size_t data_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(ktrace_control, zx_status_t, /* no attributes */, 4, + (handle, action, options, ptr), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t action, + uint32_t options, + void* ptr)) + +_ZX_SYSCALL_DECL(ktrace_write, zx_status_t, /* no attributes */, 4, + (handle, id, arg0, arg1), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t id, + uint32_t arg0, + uint32_t arg1)) + +_ZX_SYSCALL_DECL(nanosleep, zx_status_t, /* no attributes */, 1, + (deadline), ( + zx_time_t deadline)) + +_ZX_SYSCALL_DECL(ticks_get, zx_ticks_t, /* no attributes */, 0, + (), (void)) + +_ZX_SYSCALL_DECL(ticks_per_second, zx_ticks_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(deadline_after, zx_time_t, /* no attributes */, 1, + (nanoseconds), ( + zx_duration_t nanoseconds)) + +_ZX_SYSCALL_DECL(vmar_unmap_handle_close_thread_exit, zx_status_t, /* no attributes */, 4, + (vmar_handle, addr, size, close_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmar_handle, + zx_vaddr_t addr, + size_t size, + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t close_handle)) + +_ZX_SYSCALL_DECL(futex_wake_handle_close_thread_exit, void, __NO_RETURN, 4, + (value_ptr, wake_count, new_value, close_handle), ( + const zx_futex_t* value_ptr, + uint32_t wake_count, + int32_t new_value, + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t close_handle)) + +_ZX_SYSCALL_DECL(mtrace_control, zx_status_t, /* no attributes */, 6, + (handle, kind, action, options, ptr, ptr_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + uint32_t action, + uint32_t options, + void* ptr, + size_t ptr_size)) + +_ZX_SYSCALL_DECL(object_wait_one, zx_status_t, /* no attributes */, 4, + (handle, signals, deadline, observed), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_signals_t signals, + zx_time_t deadline, + zx_signals_t* observed)) + +_ZX_SYSCALL_DECL(object_wait_many, zx_status_t, /* no attributes */, 3, + (items, num_items, deadline), ( + zx_wait_item_t* items, + size_t num_items, + zx_time_t deadline)) + +_ZX_SYSCALL_DECL(object_wait_async, zx_status_t, /* no attributes */, 5, + (handle, port, key, signals, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port, + uint64_t key, + zx_signals_t signals, + uint32_t options)) + +_ZX_SYSCALL_DECL(object_signal, zx_status_t, /* no attributes */, 3, + (handle, clear_mask, set_mask), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t clear_mask, + uint32_t set_mask)) + +_ZX_SYSCALL_DECL(object_signal_peer, zx_status_t, /* no attributes */, 3, + (handle, clear_mask, set_mask), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t clear_mask, + uint32_t set_mask)) + +_ZX_SYSCALL_DECL(object_get_property, zx_status_t, /* no attributes */, 4, + (handle, property, value, value_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t property, + void* value, + size_t value_size)) + +_ZX_SYSCALL_DECL(object_set_property, zx_status_t, /* no attributes */, 4, + (handle, property, value, value_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t property, + const void* value, + size_t value_size)) + +_ZX_SYSCALL_DECL(object_get_info, zx_status_t, /* no attributes */, 6, + (handle, topic, buffer, buffer_size, actual, avail), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t topic, + void* buffer, + size_t buffer_size, + size_t* actual, + size_t* avail)) + +_ZX_SYSCALL_DECL(object_get_child, zx_status_t, /* no attributes */, 4, + (handle, koid, rights, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t koid, + zx_rights_t rights, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(object_set_profile, zx_status_t, /* no attributes */, 3, + (handle, profile, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t profile, + uint32_t options)) + +_ZX_SYSCALL_DECL(pager_create, zx_status_t, /* no attributes */, 2, + (options, out), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(pager_create_vmo, zx_status_t, /* no attributes */, 6, + (pager, options, port, key, size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager, + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t port, + uint64_t key, + uint64_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(pager_detach_vmo, zx_status_t, /* no attributes */, 2, + (pager, vmo), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo)) + +_ZX_SYSCALL_DECL(pager_supply_pages, zx_status_t, /* no attributes */, 6, + (pager, pager_vmo, offset, length, aux_vmo, aux_offset), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t pager_vmo, + uint64_t offset, + uint64_t length, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t aux_vmo, + uint64_t aux_offset)) + +_ZX_SYSCALL_DECL(pc_firmware_tables, zx_status_t, /* no attributes */, 3, + (handle, acpi_rsdp, smbios), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_paddr_t* acpi_rsdp, + zx_paddr_t* smbios)) + +_ZX_SYSCALL_DECL(pci_get_nth_device, zx_status_t, /* no attributes */, 4, + (handle, index, out_info, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t index, + zx_pcie_device_info_t* out_info, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(pci_enable_bus_master, zx_status_t, /* no attributes */, 2, + (handle, enable), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + bool enable)) + +_ZX_SYSCALL_DECL(pci_reset_device, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(pci_config_read, zx_status_t, /* no attributes */, 4, + (handle, offset, width, out_val), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint16_t offset, + size_t width, + uint32_t* out_val)) + +_ZX_SYSCALL_DECL(pci_config_write, zx_status_t, /* no attributes */, 4, + (handle, offset, width, val), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint16_t offset, + size_t width, + uint32_t val)) + +_ZX_SYSCALL_DECL(pci_cfg_pio_rw, zx_status_t, /* no attributes */, 8, + (handle, bus, dev, func, offset, val, width, write), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint8_t bus, + uint8_t dev, + uint8_t func, + uint8_t offset, + uint32_t* val, + size_t width, + bool write)) + +_ZX_SYSCALL_DECL(pci_get_bar, zx_status_t, /* no attributes */, 4, + (handle, bar_num, out_bar, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t bar_num, + zx_pci_bar_t* out_bar, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(pci_map_interrupt, zx_status_t, /* no attributes */, 3, + (handle, which_irq, out_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + int32_t which_irq, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_handle)) + +_ZX_SYSCALL_DECL(pci_query_irq_mode, zx_status_t, /* no attributes */, 3, + (handle, mode, out_max_irqs), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t mode, + uint32_t* out_max_irqs)) + +_ZX_SYSCALL_DECL(pci_set_irq_mode, zx_status_t, /* no attributes */, 3, + (handle, mode, requested_irq_count), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t mode, + uint32_t requested_irq_count)) + +_ZX_SYSCALL_DECL(pci_init, zx_status_t, /* no attributes */, 3, + (handle, init_buf, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const zx_pci_init_arg_t* init_buf, + uint32_t len)) + +_ZX_SYSCALL_DECL(pci_add_subtract_io_range, zx_status_t, /* no attributes */, 5, + (handle, mmio, base, len, add), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + bool mmio, + uint64_t base, + uint64_t len, + bool add)) + +_ZX_SYSCALL_DECL(pmt_unpin, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(port_create, zx_status_t, /* no attributes */, 2, + (options, out), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(port_queue, zx_status_t, /* no attributes */, 2, + (handle, packet), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const zx_port_packet_t* packet)) + +_ZX_SYSCALL_DECL(port_wait, zx_status_t, /* no attributes */, 3, + (handle, deadline, packet), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t deadline, + zx_port_packet_t* packet)) + +_ZX_SYSCALL_DECL(port_cancel, zx_status_t, /* no attributes */, 3, + (handle, source, key), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t source, + uint64_t key)) + +_ZX_SYSCALL_DECL(process_exit, void, __NO_RETURN, 1, + (retcode), ( + int64_t retcode)) + +_ZX_SYSCALL_DECL(process_create, zx_status_t, /* no attributes */, 6, + (job, name, name_size, options, proc_handle, vmar_handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t job, + const char* name, + size_t name_size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* proc_handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* vmar_handle)) + +_ZX_SYSCALL_DECL(process_start, zx_status_t, /* no attributes */, 6, + (handle, thread, entry, stack, arg1, arg2), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t thread, + zx_vaddr_t entry, + zx_vaddr_t stack, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t arg1, + uintptr_t arg2)) + +_ZX_SYSCALL_DECL(process_read_memory, zx_status_t, /* no attributes */, 5, + (handle, vaddr, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t vaddr, + void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(process_write_memory, zx_status_t, /* no attributes */, 5, + (handle, vaddr, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t vaddr, + const void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(profile_create, zx_status_t, /* no attributes */, 4, + (root_job, options, profile, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t root_job, + uint32_t options, + const zx_profile_info_t* profile, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(resource_create, zx_status_t, /* no attributes */, 7, + (parent_rsrc, options, base, size, name, name_size, resource_out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t parent_rsrc, + uint32_t options, + uint64_t base, + size_t size, + const char* name, + size_t name_size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* resource_out)) + +_ZX_SYSCALL_DECL(smc_call, zx_status_t, /* no attributes */, 3, + (handle, parameters, out_smc_result), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const zx_smc_parameters_t* parameters, + zx_smc_result_t* out_smc_result)) + +_ZX_SYSCALL_DECL(socket_create, zx_status_t, /* no attributes */, 3, + (options, out0, out1), ( + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out0, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out1)) + +_ZX_SYSCALL_DECL(socket_write, zx_status_t, /* no attributes */, 5, + (handle, options, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(socket_read, zx_status_t, /* no attributes */, 5, + (handle, options, buffer, buffer_size, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + void* buffer, + size_t buffer_size, + size_t* actual)) + +_ZX_SYSCALL_DECL(socket_shutdown, zx_status_t, /* no attributes */, 2, + (handle, options), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options)) + +_ZX_SYSCALL_DECL(stream_create, zx_status_t, /* no attributes */, 4, + (options, vmo, seek, out_stream), ( + uint32_t options, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + zx_off_t seek, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out_stream)) + +_ZX_SYSCALL_DECL(stream_writev, zx_status_t, /* no attributes */, 5, + (handle, options, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + const zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_writev_at, zx_status_t, /* no attributes */, 6, + (handle, options, offset, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_off_t offset, + const zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_readv, zx_status_t, /* no attributes */, 5, + (handle, options, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_readv_at, zx_status_t, /* no attributes */, 6, + (handle, options, offset, vector, num_vector, actual), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + zx_off_t offset, + zx_iovec_t* vector, + size_t num_vector, + size_t* actual)) + +_ZX_SYSCALL_DECL(stream_seek, zx_status_t, /* no attributes */, 4, + (handle, whence, offset, out_seek), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_stream_seek_origin_t whence, + int64_t offset, + zx_off_t* out_seek)) + +_ZX_SYSCALL_DECL(system_get_dcache_line_size, uint32_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_num_cpus, uint32_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_version_string, zx_string_view_t, __CONST, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_physmem, uint64_t, /* no attributes */, 0, + (), (void)) + +_ZX_SYSCALL_DECL(system_get_features, zx_status_t, /* no attributes */, 2, + (kind, features), ( + uint32_t kind, + uint32_t* features)) + +_ZX_SYSCALL_DECL(system_get_event, zx_status_t, /* no attributes */, 3, + (root_job, kind, event), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t root_job, + uint32_t kind, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* event)) + +_ZX_SYSCALL_DECL(system_mexec, zx_status_t, /* no attributes */, 3, + (resource, kernel_vmo, bootimage_vmo), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t kernel_vmo, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t bootimage_vmo)) + +_ZX_SYSCALL_DECL(system_mexec_payload_get, zx_status_t, /* no attributes */, 3, + (resource, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(system_powerctl, zx_status_t, /* no attributes */, 3, + (resource, cmd, arg), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + uint32_t cmd, + const zx_system_powerctl_arg_t* arg)) + +_ZX_SYSCALL_DECL(task_suspend, zx_status_t, /* no attributes */, 2, + (handle, token), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* token)) + +_ZX_SYSCALL_DECL(task_suspend_token, zx_status_t, /* no attributes */, 2, + (handle, token), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* token)) + +_ZX_SYSCALL_DECL(task_create_exception_channel, zx_status_t, /* no attributes */, 3, + (handle, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(task_kill, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(thread_exit, void, __NO_RETURN, 0, + (), (void)) + +_ZX_SYSCALL_DECL(thread_create, zx_status_t, /* no attributes */, 5, + (process, name, name_size, options, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t process, + const char* name, + size_t name_size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(thread_start, zx_status_t, /* no attributes */, 5, + (handle, thread_entry, stack, arg1, arg2), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t thread_entry, + zx_vaddr_t stack, + uintptr_t arg1, + uintptr_t arg2)) + +_ZX_SYSCALL_DECL(thread_read_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(thread_write_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(timer_create, zx_status_t, /* no attributes */, 3, + (options, clock_id, out), ( + uint32_t options, + zx_clock_t clock_id, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(timer_set, zx_status_t, /* no attributes */, 3, + (handle, deadline, slack), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_time_t deadline, + zx_duration_t slack)) + +_ZX_SYSCALL_DECL(timer_cancel, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(vcpu_create, zx_status_t, /* no attributes */, 4, + (guest, options, entry, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t guest, + uint32_t options, + zx_vaddr_t entry, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vcpu_resume, zx_status_t, /* no attributes */, 2, + (handle, packet), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_port_packet_t* packet)) + +_ZX_SYSCALL_DECL(vcpu_interrupt, zx_status_t, /* no attributes */, 2, + (handle, vector), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t vector)) + +_ZX_SYSCALL_DECL(vcpu_read_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vcpu_write_state, zx_status_t, /* no attributes */, 4, + (handle, kind, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t kind, + const void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmar_allocate, zx_status_t, /* no attributes */, 6, + (parent_vmar, options, offset, size, child_vmar, child_addr), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t parent_vmar, + zx_vm_option_t options, + size_t offset, + size_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* child_vmar, + zx_vaddr_t* child_addr)) + +_ZX_SYSCALL_DECL(vmar_destroy, zx_status_t, /* no attributes */, 1, + (handle), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle)) + +_ZX_SYSCALL_DECL(vmar_map, zx_status_t, /* no attributes */, 7, + (handle, options, vmar_offset, vmo, vmo_offset, len, mapped_addr), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vm_option_t options, + size_t vmar_offset, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmo, + uint64_t vmo_offset, + size_t len, + zx_vaddr_t* mapped_addr)) + +_ZX_SYSCALL_DECL(vmar_unmap, zx_status_t, /* no attributes */, 3, + (handle, addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vaddr_t addr, + size_t len)) + +_ZX_SYSCALL_DECL(vmar_protect, zx_status_t, /* no attributes */, 4, + (handle, options, addr, len), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + zx_vm_option_t options, + zx_vaddr_t addr, + size_t len)) + +_ZX_SYSCALL_DECL(vmar_op_range, zx_status_t, /* no attributes */, 6, + (handle, op, address, size, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t op, + zx_vaddr_t address, + size_t size, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_create, zx_status_t, /* no attributes */, 3, + (size, options, out), ( + uint64_t size, + uint32_t options, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_read, zx_status_t, /* no attributes */, 4, + (handle, buffer, offset, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + void* buffer, + uint64_t offset, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_write, zx_status_t, /* no attributes */, 4, + (handle, buffer, offset, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + const void* buffer, + uint64_t offset, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_get_size, zx_status_t, /* no attributes */, 2, + (handle, size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t* size)) + +_ZX_SYSCALL_DECL(vmo_set_size, zx_status_t, /* no attributes */, 2, + (handle, size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint64_t size)) + +_ZX_SYSCALL_DECL(vmo_op_range, zx_status_t, /* no attributes */, 6, + (handle, op, offset, size, buffer, buffer_size), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t op, + uint64_t offset, + uint64_t size, + void* buffer, + size_t buffer_size)) + +_ZX_SYSCALL_DECL(vmo_create_child, zx_status_t, /* no attributes */, 5, + (handle, options, offset, size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t options, + uint64_t offset, + uint64_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_set_cache_policy, zx_status_t, /* no attributes */, 2, + (handle, cache_policy), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t handle, + uint32_t cache_policy)) + +_ZX_SYSCALL_DECL(vmo_replace_as_executable, zx_status_t, /* no attributes */, 3, + (handle, vmex, out), ( + _ZX_SYSCALL_ANNO(release_handle("Fuchsia")) zx_handle_t handle, + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t vmex, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_create_contiguous, zx_status_t, /* no attributes */, 4, + (bti, size, alignment_log2, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t bti, + size_t size, + uint32_t alignment_log2, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) + +_ZX_SYSCALL_DECL(vmo_create_physical, zx_status_t, /* no attributes */, 4, + (resource, paddr, size, out), ( + _ZX_SYSCALL_ANNO(use_handle("Fuchsia")) zx_handle_t resource, + zx_paddr_t paddr, + size_t size, + _ZX_SYSCALL_ANNO(acquire_handle("Fuchsia")) zx_handle_t* out)) +
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/iommu.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/iommu.h new file mode 100644 index 0000000..708b606 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/iommu.h
@@ -0,0 +1,97 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_IOMMU_H_ +#define SYSROOT_ZIRCON_SYSCALLS_IOMMU_H_ + +#include <assert.h> +#include <stdbool.h> +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +#define ZX_IOMMU_MAX_DESC_LEN 4096 + +// Values for the |type| argument of the zx_iommu_create() syscall. +#define ZX_IOMMU_TYPE_DUMMY 0 +#define ZX_IOMMU_TYPE_INTEL 1 + +// Data structures for creating a dummy IOMMU instance +typedef struct zx_iommu_desc_dummy { + uint8_t reserved; +} zx_iommu_desc_dummy_t; + +// Data structures for creating an Intel IOMMU instance + +// This scope represents a single PCI endpoint device +#define ZX_IOMMU_INTEL_SCOPE_ENDPOINT 0 +// This scope represents a PCI-PCI bridge. The bridge and all of its downstream +// devices will be included in this scope. +#define ZX_IOMMU_INTEL_SCOPE_BRIDGE 1 + +// TODO(teisenbe): Investigate FIDL for this. Multiple embedded lists seems +// right up its alley. +typedef struct zx_iommu_desc_intel_scope { + uint8_t type; + // The bus number of the first bus decoded by the host bridge this scope is attached to. + uint8_t start_bus; + // Number of bridges (including the host bridge) between host bridge and the + // device. + uint8_t num_hops; + // The device number and function numbers of the bridges along the way, + // ending with the device itself. + // |dev_func[0]| is the address on |start_bus| of the first bridge in the + // path (excluding the host bridge). |dev_func[num_hops-1]| is the address + // of the device itself. + uint8_t dev_func[5]; +} zx_iommu_desc_intel_scope_t; + +typedef struct zx_iommu_desc_intel_reserved_memory { + uint64_t base_addr; // Physical address of the base of reserved memory. + uint64_t len; // Number of bytes of reserved memory. + + // The number of bytes of zx_iommu_desc_intel_scope_t's that follow this descriptor. + uint8_t scope_bytes; + + uint8_t _reserved[7]; // Padding + + // This is a list of all devices that need access to this memory range. + // + // zx_iommu_desc_intel_scope_t scopes[num_scopes]; +} zx_iommu_desc_intel_reserved_memory_t; + +typedef struct zx_iommu_desc_intel { + uint64_t register_base; // Physical address of registers + uint16_t pci_segment; // The PCI segment associated with this IOMMU + + // If true, this IOMMU has all PCI devices in its segment under its scope. + // In this case, the list of scopes acts as a blacklist. + bool whole_segment; + + // The number of bytes of zx_iommu_desc_intel_scope_t's that follow this descriptor. + uint8_t scope_bytes; + + // The number of bytes of zx_iommu_desc_intel_reserved_memory_t's that follow the scope + // list. + uint16_t reserved_memory_bytes; + + uint8_t _reserved[2]; // Padding + + // If |whole_segment| is false, this is a list of all devices managed by + // this IOMMU. If |whole_segment| is true, this is a list of all devices on + // this segment *not* managed by this IOMMU. It has a total length in bytes of + // |scope_bytes|. + // + // zx_iommu_desc_intel_scope_t scopes[]; + + // A list of all BIOS-reserved memory regions this IOMMU needs to translate. + // It has a total length in bytes of |reserved_memory_bytes|. + // + // zx_iommu_desc_intel_reserved_memory_t reserved_mem[]; +} zx_iommu_desc_intel_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_IOMMU_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/log.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/log.h new file mode 100644 index 0000000..0ea4c04 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/log.h
@@ -0,0 +1,58 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_LOG_H_ +#define SYSROOT_ZIRCON_SYSCALLS_LOG_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Defines and structures for zx_log_*() +typedef struct zx_log_record { + uint32_t reserved; + uint16_t datalen; + uint16_t flags; + zx_time_t timestamp; + uint64_t pid; + uint64_t tid; + char data[]; +} zx_log_record_t; + +// ask clang format not to mess up the indentation: +// clang-format off + +#define ZX_LOG_RECORD_MAX 256 + +// Common Log Levels +#define ZX_LOG_ERROR (0x0001) +#define ZX_LOG_WARN (0x0002) +#define ZX_LOG_INFO (0x0004) + +// Verbose log levels +#define ZX_LOG_TRACE (0x0010) +#define ZX_LOG_SPEW (0x0020) + +// Custom Log Levels +#define ZX_LOG_DEBUG1 (0x0100) +#define ZX_LOG_DEBUG2 (0x0200) +#define ZX_LOG_DEBUG3 (0x0400) +#define ZX_LOG_DEBUG4 (0x0800) + +// Filter Flags + +// Do not forward this message via network +// (for logging in network core and drivers) +#define ZX_LOG_LOCAL (0x1000) + +#define ZX_LOG_LEVEL_MASK (0x0FFF) +#define ZX_LOG_FLAGS_MASK (0xFFFF) + +// Options + +#define ZX_LOG_FLAG_READABLE 0x40000000 + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_LOG_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/object.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/object.h new file mode 100644 index 0000000..7139ffe --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/object.h
@@ -0,0 +1,685 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_OBJECT_H_ +#define SYSROOT_ZIRCON_SYSCALLS_OBJECT_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +// Valid topics for zx_object_get_info. +typedef uint32_t zx_object_info_topic_t; +#define ZX_INFO_NONE ((zx_object_info_topic_t) 0u) +#define ZX_INFO_HANDLE_VALID ((zx_object_info_topic_t) 1u) +#define ZX_INFO_HANDLE_BASIC ((zx_object_info_topic_t) 2u) // zx_info_handle_basic_t[1] +#define ZX_INFO_PROCESS ((zx_object_info_topic_t) 3u) // zx_info_process_t[1] +#define ZX_INFO_PROCESS_THREADS ((zx_object_info_topic_t) 4u) // zx_koid_t[n] +#define ZX_INFO_VMAR ((zx_object_info_topic_t) 7u) // zx_info_vmar_t[1] +#define ZX_INFO_JOB_CHILDREN ((zx_object_info_topic_t) 8u) // zx_koid_t[n] +#define ZX_INFO_JOB_PROCESSES ((zx_object_info_topic_t) 9u) // zx_koid_t[n] +#define ZX_INFO_THREAD ((zx_object_info_topic_t) 10u) // zx_info_thread_t[1] +#define ZX_INFO_THREAD_EXCEPTION_REPORT ((zx_object_info_topic_t) 11u) // zx_exception_report_t[1] +#define ZX_INFO_TASK_STATS ((zx_object_info_topic_t) 12u) // zx_info_task_stats_t[1] +#define ZX_INFO_PROCESS_MAPS ((zx_object_info_topic_t) 13u) // zx_info_maps_t[n] +#define ZX_INFO_PROCESS_VMOS ((zx_object_info_topic_t) 14u) // zx_info_vmo_t[n] +#define ZX_INFO_THREAD_STATS ((zx_object_info_topic_t) 15u) // zx_info_thread_stats_t[1] +#define ZX_INFO_CPU_STATS ((zx_object_info_topic_t) 16u) // zx_info_cpu_stats_t[n] +#define ZX_INFO_KMEM_STATS ((zx_object_info_topic_t) 17u) // zx_info_kmem_stats_t[1] +#define ZX_INFO_RESOURCE ((zx_object_info_topic_t) 18u) // zx_info_resource_t[1] +#define ZX_INFO_HANDLE_COUNT ((zx_object_info_topic_t) 19u) // zx_info_handle_count_t[1] +#define ZX_INFO_BTI ((zx_object_info_topic_t) 20u) // zx_info_bti_t[1] +#define ZX_INFO_PROCESS_HANDLE_STATS ((zx_object_info_topic_t) 21u) // zx_info_process_handle_stats_t[1] +#define ZX_INFO_SOCKET ((zx_object_info_topic_t) 22u) // zx_info_socket_t[1] +#define ZX_INFO_VMO ((zx_object_info_topic_t) 23u) // zx_info_vmo_t[1] +#define ZX_INFO_JOB ((zx_object_info_topic_t) 24u) // zx_info_job_t[1] +#define ZX_INFO_TIMER ((zx_object_info_topic_t) 25u) // zx_info_timer_t[1] +#define ZX_INFO_STREAM ((zx_object_info_topic_t) 26u) // zx_info_stream_t[1] +#define ZX_INFO_HANDLE_TABLE ((zx_object_info_topic_t) 27u) // zx_info_handle_extended_t[n] +#define ZX_INFO_MSI ((zx_object_info_topic_t) 28u) // zx_info_msi_t[1] +#define ZX_INFO_GUEST_STATS ((zx_object_info_topic_t) 29u) // zx_info_guest_stats_t[1] + +typedef uint32_t zx_obj_props_t; +#define ZX_OBJ_PROP_NONE ((zx_obj_props_t) 0u) +#define ZX_OBJ_PROP_WAITABLE ((zx_obj_props_t) 1u) + +// Return codes set when a task is killed. +#define ZX_TASK_RETCODE_SYSCALL_KILL ((int64_t) -1024) // via zx_task_kill(). +#define ZX_TASK_RETCODE_OOM_KILL ((int64_t) -1025) // by the OOM killer. +#define ZX_TASK_RETCODE_POLICY_KILL ((int64_t) -1026) // by the Job policy. +#define ZX_TASK_RETCODE_VDSO_KILL ((int64_t) -1027) // by the VDSO. +#define ZX_TASK_RETCODE_EXCEPTION_KILL ((int64_t) -1028) // Exception not handled. +#define ZX_TASK_RETCODE_CRITICAL_PROCESS_KILL ((int64_t) -1029) // by a critical process. + +// Sentinel indicating an invalid or missing CPU. +#define ZX_INFO_INVALID_CPU ((uint32_t)0xFFFFFFFFu) + + +typedef struct zx_info_handle_basic { + // The unique id assigned by kernel to the object referenced by the + // handle. + zx_koid_t koid; + + // The immutable rights assigned to the handle. Two handles that + // have the same koid and the same rights are equivalent and + // interchangeable. + zx_rights_t rights; + + // The object type: channel, event, socket, etc. + zx_obj_type_t type; + + // If the object referenced by the handle is related to another (such + // as the other end of a channel, or the parent of a job) then + // |related_koid| is the koid of that object, otherwise it is zero. + // This relationship is immutable: an object's |related_koid| does + // not change even if the related object no longer exists. + zx_koid_t related_koid; + + // Set to ZX_OBJ_PROP_WAITABLE if the object referenced by the + // handle can be waited on; zero otherwise. + zx_obj_props_t props; + + uint8_t padding1[4]; +} zx_info_handle_basic_t; + +typedef struct zx_info_handle_extended { + // The object type: channel, event, socket, etc. + zx_obj_type_t type; + + // The handle value which is only valid for the process which + // was passed to ZX_INFO_HANDLE_TABLE. + zx_handle_t handle_value; + + // The immutable rights assigned to the handle. Two handles that + // have the same koid and the same rights are equivalent and + // interchangeable. + zx_rights_t rights; + + // Set to ZX_OBJ_PROP_WAITABLE if the object referenced by the + // handle can be waited on; zero otherwise. + zx_obj_props_t props; + + // The unique id assigned by kernel to the object referenced by the + // handle. + zx_koid_t koid; + + // If the object referenced by the handle is related to another (such + // as the other end of a channel, or the parent of a job) then + // |related_koid| is the koid of that object, otherwise it is zero. + // This relationship is immutable: an object's |related_koid| does + // not change even if the related object no longer exists. + zx_koid_t related_koid; + + // If the object referenced by the handle has a peer, like the + // other end of a channel, then this is the koid of the process + // which currently owns it. This value is not stable; the process + // can change the owner at any moment. + // + // This is currently unimplemented and contains 0. + zx_koid_t peer_owner_koid; +} zx_info_handle_extended_t; + +typedef struct zx_info_handle_count { + // The number of outstanding handles to a kernel object. + uint32_t handle_count; +} zx_info_handle_count_t; + +typedef struct zx_info_process_handle_stats { + // The number of outstanding handles to kernel objects of each type. + uint32_t handle_count[ZX_OBJ_TYPE_UPPER_BOUND]; +} zx_info_process_handle_stats_t; + +typedef struct zx_info_process { + // The process's return code; only valid if |exited| is true. + // If the process was killed, it will be one of the ZX_TASK_RETCODE values. + int64_t return_code; + + // True if the process has ever left the initial creation state, + // even if it has exited as well. + bool started; + + // If true, the process has exited and |return_code| is valid. + bool exited; + + // True if a debugger is attached to the process. + bool debugger_attached; + + uint8_t padding1[5]; +} zx_info_process_t; + +typedef struct zx_info_job { + // The job's return code; only valid if |exited| is true. + // If the process was killed, it will be one of the ZX_TASK_RETCODE values. + int64_t return_code; + + // If true, the job has exited and |return_code| is valid. + bool exited; + + // True if the ZX_PROP_JOB_KILL_ON_OOM was set. + bool kill_on_oom; + + // True if a debugger is attached to the job. + bool debugger_attached; + + uint8_t padding1[5]; +} zx_info_job_t; + +typedef struct zx_info_timer { + // The options passed to zx_timer_create(). + uint32_t options; + + uint8_t padding1[4]; + + // The deadline with respect to ZX_CLOCK_MONOTONIC at which the timer will + // fire next. + // + // This value will be zero if the timer is not set to fire. + zx_time_t deadline; + + // Specifies a range from deadline - slack to deadline + slack during which + // the timer is allowed to fire. The system uses this parameter as a hint to + // coalesce nearby timers. + // + // The precise coalescing behavior is controlled by the options parameter + // specified when the timer was created. + // + // This value will be zero if the timer is not set to fire. + zx_duration_t slack; +} zx_info_timer_t; + +typedef struct zx_info_stream { + // The options passed to zx_stream_create(). + uint32_t options; + + uint8_t padding1[4]; + + // The current seek offset. + // + // Used by zx_stream_readv and zx_stream_writev to determine where to read + // and write the stream. + zx_off_t seek; + + // The current size of the stream. + // + // The number of bytes in the stream that store data. The stream itself + // might have a larger capacity to avoid reallocating the underlying storage + // as the stream grows or shrinks. + uint64_t content_size; +} zx_info_stream_t; + +typedef uint32_t zx_thread_state_t; + +typedef struct zx_info_thread { + // One of ZX_THREAD_STATE_* values. + zx_thread_state_t state; + + // If |state| is ZX_THREAD_STATE_BLOCKED_EXCEPTION, the thread has gotten + // an exception and is waiting for the exception response from the specified + // handler. + + // The value is one of ZX_EXCEPTION_CHANNEL_TYPE_*. + uint32_t wait_exception_channel_type; + + // CPUs this thread may be scheduled on, as specified by + // a profile object applied to this thread. + // + // The kernel may not internally store invalid CPUs in the mask, so + // this may not exactly match the mask applied to the thread for + // CPUs beyond what the system is able to use. + zx_cpu_set_t cpu_affinity_mask; +} zx_info_thread_t; + +typedef struct zx_info_thread_stats { + // Total accumulated running time of the thread. + zx_duration_t total_runtime; + + // CPU number that this thread was last scheduled on, or ZX_INFO_INVALID_CPU + // if the thread has never been scheduled on a CPU. By the time this call + // returns, the thread may have been scheduled elsewhere, so this + // information should only be used as a hint or for statistics. + uint32_t last_scheduled_cpu; + + uint8_t padding1[4]; +} zx_info_thread_stats_t; + +// Statistics about resources (e.g., memory) used by a task. Can be relatively +// expensive to gather. +typedef struct zx_info_task_stats { + // The total size of mapped memory ranges in the task. + // Not all will be backed by physical memory. + size_t mem_mapped_bytes; + + // For the fields below, a byte is considered committed if it's backed by + // physical memory. Some of the memory may be double-mapped, and thus + // double-counted. + + // Committed memory that is only mapped into this task. + size_t mem_private_bytes; + + // Committed memory that is mapped into this and at least one other task. + size_t mem_shared_bytes; + + // A number that estimates the fraction of mem_shared_bytes that this + // task is responsible for keeping alive. + // + // An estimate of: + // For each shared, committed byte: + // mem_scaled_shared_bytes += 1 / (number of tasks mapping this byte) + // + // This number is strictly smaller than mem_shared_bytes. + size_t mem_scaled_shared_bytes; +} zx_info_task_stats_t; + +typedef struct zx_info_vmar { + // Base address of the region. + uintptr_t base; + + // Length of the region, in bytes. + size_t len; +} zx_info_vmar_t; + +typedef struct zx_info_bti { + // zx_bti_pin will always be able to return addresses that are contiguous for at + // least this many bytes. E.g. if this returns 1MB, then a call to + // zx_bti_pin() with a size of 2MB will return at most two physically-contiguous runs. + // If the size were 2.5MB, it will return at most three physically-contiguous runs. + uint64_t minimum_contiguity; + + // The number of bytes in the device's address space (UINT64_MAX if 2^64). + uint64_t aspace_size; + + // The count of the pinned memory object tokens. Requesting this count is + // racy, so this should only be used for informative reasons. + uint64_t pmo_count; + + // The count of the quarantined pinned memory object tokens. Requesting this count is + // racy, so this should only be used for informative reasons. + uint64_t quarantine_count; +} zx_info_bti_t; + +typedef struct zx_info_socket { + // The options passed to zx_socket_create(). + uint32_t options; + + uint8_t padding1[4]; + + // The maximum size of the receive buffer of a socket, in bytes. + // + // The receive buffer may become full at a capacity less than the maximum + // due to overhead. + size_t rx_buf_max; + + // The size of the receive buffer of a socket, in bytes. + size_t rx_buf_size; + + // The amount of data, in bytes, that is available for reading in a single + // zx_socket_read call. + // + // For stream sockets, this value will match |rx_buf_size|. For datagram + // sockets, this value will be the size of the next datagram in the receive + // buffer. + size_t rx_buf_available; + + // The maximum size of the transmit buffer of a socket, in bytes. + // + // The transmit buffer may become full at a capacity less than the maximum + // due to overhead. + // + // Will be zero if the peer endpoint is closed. + size_t tx_buf_max; + + // The size of the transmit buffer of a socket, in bytes. + // + // Will be zero if the peer endpoint is closed. + size_t tx_buf_size; +} zx_info_socket_t; + +// Types and values used by ZX_INFO_PROCESS_MAPS. + +// Describes a VM mapping. +typedef struct zx_info_maps_mapping { + // MMU flags for the mapping. + // Bitwise OR of ZX_VM_PERM_{READ,WRITE,EXECUTE} values. + zx_vm_option_t mmu_flags; + uint8_t padding1[4]; + // koid of the mapped VMO. + zx_koid_t vmo_koid; + // Offset into the above VMO. + uint64_t vmo_offset; + // The number of PAGE_SIZE pages in the mapped region of the VMO + // that are backed by physical memory. + size_t committed_pages; +} zx_info_maps_mapping_t; + +// Types of entries represented by zx_info_maps_t. +// Can't use zx_obj_type_t because not all of these are +// user-visible kernel object types. +typedef uint32_t zx_info_maps_type_t; +#define ZX_INFO_MAPS_TYPE_NONE ((zx_info_maps_type_t) 0u) +#define ZX_INFO_MAPS_TYPE_ASPACE ((zx_info_maps_type_t) 1u) +#define ZX_INFO_MAPS_TYPE_VMAR ((zx_info_maps_type_t) 2u) +#define ZX_INFO_MAPS_TYPE_MAPPING ((zx_info_maps_type_t) 3u) + +// Describes a node in the aspace/vmar/mapping hierarchy for a user process. +typedef struct zx_info_maps { + // Name if available; empty string otherwise. + char name[ZX_MAX_NAME_LEN]; + // Base address. + zx_vaddr_t base; + // Size in bytes. + size_t size; + + // The depth of this node in the tree. + // Can be used for indentation, or to rebuild the tree from an array + // of zx_info_maps_t entries, which will be in depth-first pre-order. + size_t depth; + // The type of this entry; indicates which union entry is valid. + zx_info_maps_type_t type; + uint8_t padding1[4]; + union { + zx_info_maps_mapping_t mapping; + // No additional fields for other types. + } u; +} zx_info_maps_t; + + +// Values and types used by ZX_INFO_PROCESS_VMOS. + +// The VMO is backed by RAM, consuming memory. +// Mutually exclusive with ZX_INFO_VMO_TYPE_PHYSICAL. +// See ZX_INFO_VMO_TYPE(flags) +#define ZX_INFO_VMO_TYPE_PAGED (1u<<0) + +// The VMO points to a physical address range, and does not consume memory. +// Typically used to access memory-mapped hardware. +// Mutually exclusive with ZX_INFO_VMO_TYPE_PAGED. +// See ZX_INFO_VMO_TYPE(flags) +#define ZX_INFO_VMO_TYPE_PHYSICAL (0u<<0) + +// Returns a VMO's type based on its flags, allowing for checks like +// if (ZX_INFO_VMO_TYPE(f) == ZX_INFO_VMO_TYPE_PAGED) +#define ZX_INFO_VMO_TYPE(flags) ((flags) & (1u<<0)) + +// The VMO is resizable. +#define ZX_INFO_VMO_RESIZABLE (1u<<1) + +// The VMO is a child, and is a copy-on-write clone. +#define ZX_INFO_VMO_IS_COW_CLONE (1u<<2) + +// When reading a list of VMOs pointed to by a process, indicates that the +// process has a handle to the VMO, which isn't necessarily mapped. +#define ZX_INFO_VMO_VIA_HANDLE (1u<<3) + +// When reading a list of VMOs pointed to by a process, indicates that the +// process maps the VMO into a VMAR, but doesn't necessarily have a handle to +// the VMO. +#define ZX_INFO_VMO_VIA_MAPPING (1u<<4) + +// The VMO is a pager owned VMO created by zx_pager_create_vmo or is +// a clone of a VMO with this flag set. Will only be set on VMOs with +// the ZX_INFO_VMO_TYPE_PAGED flag set. +#define ZX_INFO_VMO_PAGER_BACKED (1u<<5) + +// The VMO is contiguous +#define ZX_INFO_VMO_CONTIGUOUS (1u<<6) + +// Describes a VMO. For mapping information, see |zx_info_maps_t|. +typedef struct zx_info_vmo { + // The koid of this VMO. + zx_koid_t koid; + + // The name of this VMO. + char name[ZX_MAX_NAME_LEN]; + + // The size of this VMO; i.e., the amount of virtual address space it + // would consume if mapped. + uint64_t size_bytes; + + // If this VMO is a clone, the koid of its parent. Otherwise, zero. + // See |flags| for the type of clone. + zx_koid_t parent_koid; + + // The number of clones of this VMO, if any. + size_t num_children; + + // The number of times this VMO is currently mapped into VMARs. + // Note that the same process will often map the same VMO twice, + // and both mappings will be counted here. (I.e., this is not a count + // of the number of processes that map this VMO; see share_count.) + size_t num_mappings; + + // An estimate of the number of unique address spaces that + // this VMO is mapped into. Every process has its own address space, + // and so does the kernel. + size_t share_count; + + // Bitwise OR of ZX_INFO_VMO_* values. + uint32_t flags; + + uint8_t padding1[4]; + + // If |ZX_INFO_VMO_TYPE(flags) == ZX_INFO_VMO_TYPE_PAGED|, the amount of + // memory currently allocated to this VMO; i.e., the amount of physical + // memory it consumes. Undefined otherwise. + uint64_t committed_bytes; + + // If |flags & ZX_INFO_VMO_VIA_HANDLE|, the handle rights. + // Undefined otherwise. + zx_rights_t handle_rights; + + // VMO mapping cache policy. One of ZX_CACHE_POLICY_* + uint32_t cache_policy; +} zx_info_vmo_t; + +typedef struct zx_info_guest_stats { + uint32_t cpu_number; + uint32_t flags; + + uint64_t vm_entries; + uint64_t vm_exits; +#ifdef __aarch64__ + uint64_t wfi_wfe_instructions; + uint64_t instruction_aborts; + uint64_t data_aborts; + uint64_t system_instructions; + uint64_t smc_instructions; + uint64_t interrupts; +#else + uint64_t interrupts; + uint64_t interrupt_windows; + uint64_t cpuid_instructions; + uint64_t hlt_instructions; + uint64_t control_register_accesses; + uint64_t io_instructions; + uint64_t rdmsr_instructions; + uint64_t wrmsr_instructions; + uint64_t ept_violations; + uint64_t xsetbv_instructions; + uint64_t pause_instructions; + uint64_t vmcall_instructions; +#endif +} zx_info_guest_stats_t; + +// kernel statistics per cpu +// TODO(cpu), expose the deprecated stats via a new syscall. +typedef struct zx_info_cpu_stats { + uint32_t cpu_number; + uint32_t flags; + + zx_duration_t idle_time; + + // kernel scheduler counters + uint64_t reschedules; + uint64_t context_switches; + uint64_t irq_preempts; + uint64_t preempts; + uint64_t yields; + + // cpu level interrupts and exceptions + uint64_t ints; // hardware interrupts, minus timer interrupts or inter-processor interrupts + uint64_t timer_ints; // timer interrupts + uint64_t timers; // timer callbacks + uint64_t page_faults; // (deprecated, returns 0) page faults + uint64_t exceptions; // (deprecated, returns 0) exceptions such as undefined opcode + uint64_t syscalls; + + // inter-processor interrupts + uint64_t reschedule_ipis; + uint64_t generic_ipis; +} zx_info_cpu_stats_t; + +// Information about kernel memory usage. +// Can be expensive to gather. +typedef struct zx_info_kmem_stats { + // The total amount of physical memory available to the system. + uint64_t total_bytes; + + // The amount of unallocated memory. + uint64_t free_bytes; + + // The amount of memory reserved by and mapped into the kernel for reasons + // not covered by other fields in this struct. Typically for readonly data + // like the ram disk and kernel image, and for early-boot dynamic memory. + uint64_t wired_bytes; + + // The amount of memory allocated to the kernel heap. + uint64_t total_heap_bytes; + + // The portion of |total_heap_bytes| that is not in use. + uint64_t free_heap_bytes; + + // The amount of memory committed to VMOs, both kernel and user. + // A superset of all userspace memory. + // Does not include certain VMOs that fall under |wired_bytes|. + // + // TODO(dbort): Break this into at least two pieces: userspace VMOs that + // have koids, and kernel VMOs that don't. Or maybe look at VMOs + // mapped into the kernel aspace vs. everything else. + uint64_t vmo_bytes; + + // The amount of memory used for architecture-specific MMU metadata + // like page tables. + uint64_t mmu_overhead_bytes; + + // The amount of memory in use by IPC. + uint64_t ipc_bytes; + + // Non-free memory that isn't accounted for in any other field. + uint64_t other_bytes; +} zx_info_kmem_stats_t; + +typedef struct zx_info_resource { + // The resource kind; resource object kinds are detailed in the resource.md + uint32_t kind; + // Resource's creation flags + uint32_t flags; + // Resource's base value (inclusive) + uint64_t base; + // Resource's length value + size_t size; + char name[ZX_MAX_NAME_LEN]; +} zx_info_resource_t; + +typedef struct zx_info_msi { + // The target adress for write transactions. + uint64_t target_addr; + // The data that the device ill write when triggering an IRQ. + uint32_t target_data; + // The first IRQ in the allocated block. + uint32_t base_irq_id; + // The number of IRQs in the allocated block. + uint32_t num_irq; +} zx_info_msi_t; + + +#define ZX_INFO_CPU_STATS_FLAG_ONLINE (1u<<0) + +// Object properties. + +// Argument is a char[ZX_MAX_NAME_LEN]. +#define ZX_PROP_NAME ((uint32_t) 3u) + +#if __x86_64__ +// Argument is a uintptr_t. +#define ZX_PROP_REGISTER_GS ((uint32_t) 2u) +#define ZX_PROP_REGISTER_FS ((uint32_t) 4u) +#endif + +// Argument is the value of ld.so's _dl_debug_addr, a uintptr_t. If the +// property is set to the magic value of ZX_PROCESS_DEBUG_ADDR_BREAK_ON_SET +// on process startup, ld.so will trigger a debug breakpoint immediately after +// setting the property to the correct value. +#define ZX_PROP_PROCESS_DEBUG_ADDR ((uint32_t) 5u) +#define ZX_PROCESS_DEBUG_ADDR_BREAK_ON_SET ((uintptr_t) 1u) + +// Argument is the base address of the vDSO mapping (or zero), a uintptr_t. +#define ZX_PROP_PROCESS_VDSO_BASE_ADDRESS ((uint32_t) 6u) + +// Whether the dynamic loader should issue a debug trap when loading a shared library, +// either initially or when running (e.g. dlopen). +// +// See docs/reference/syscalls/object_get_property.md +// See third_party/ulib/musl/ldso/dynlink.c. +#define ZX_PROP_PROCESS_BREAK_ON_LOAD ((uint32_t) 7u) + +// The process's context id as recorded by h/w instruction tracing, a uintptr_t. +// On X86 this is the cr3 value. +// TODO(dje): Wasn't sure whether the gaps in property numbers are unusable +// due to being old dleeted values. For now I just picked something. +#define ZX_PROP_PROCESS_HW_TRACE_CONTEXT_ID ((uint32_t) 8u) + +// Argument is a size_t. +#define ZX_PROP_SOCKET_RX_THRESHOLD 12u +#define ZX_PROP_SOCKET_TX_THRESHOLD 13u + +// Terminate this job if the system is low on memory. +#define ZX_PROP_JOB_KILL_ON_OOM 15u + +// Exception close behavior. +#define ZX_PROP_EXCEPTION_STATE 16u + +// The size of the content in a VMO, in bytes. +// +// The content size of a VMO can be larger or smaller than the actual size of +// the VMO. +// +// Argument is a uint64_t. +#define ZX_PROP_VMO_CONTENT_SIZE 17u + +// Basic thread states, in zx_info_thread_t.state. +#define ZX_THREAD_STATE_NEW ((zx_thread_state_t) 0x0000u) +#define ZX_THREAD_STATE_RUNNING ((zx_thread_state_t) 0x0001u) +#define ZX_THREAD_STATE_SUSPENDED ((zx_thread_state_t) 0x0002u) +// ZX_THREAD_STATE_BLOCKED is never returned by itself. +// It is always returned with a more precise reason. +// See ZX_THREAD_STATE_BLOCKED_* below. +#define ZX_THREAD_STATE_BLOCKED ((zx_thread_state_t) 0x0003u) +#define ZX_THREAD_STATE_DYING ((zx_thread_state_t) 0x0004u) +#define ZX_THREAD_STATE_DEAD ((zx_thread_state_t) 0x0005u) + +// More precise thread states. +#define ZX_THREAD_STATE_BLOCKED_EXCEPTION ((zx_thread_state_t) 0x0103u) +#define ZX_THREAD_STATE_BLOCKED_SLEEPING ((zx_thread_state_t) 0x0203u) +#define ZX_THREAD_STATE_BLOCKED_FUTEX ((zx_thread_state_t) 0x0303u) +#define ZX_THREAD_STATE_BLOCKED_PORT ((zx_thread_state_t) 0x0403u) +#define ZX_THREAD_STATE_BLOCKED_CHANNEL ((zx_thread_state_t) 0x0503u) +#define ZX_THREAD_STATE_BLOCKED_WAIT_ONE ((zx_thread_state_t) 0x0603u) +#define ZX_THREAD_STATE_BLOCKED_WAIT_MANY ((zx_thread_state_t) 0x0703u) +#define ZX_THREAD_STATE_BLOCKED_INTERRUPT ((zx_thread_state_t) 0x0803u) +#define ZX_THREAD_STATE_BLOCKED_PAGER ((zx_thread_state_t) 0x0903u) + +// Reduce possibly-more-precise state to a basic state. +// Useful if, for example, you want to check for BLOCKED on anything. +#define ZX_THREAD_STATE_BASIC(n) ((n) & 0xff) + +// How a thread should behave when the current exception is closed. +#define ZX_EXCEPTION_STATE_TRY_NEXT 0u +#define ZX_EXCEPTION_STATE_HANDLED 1u + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_OBJECT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/pci.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/pci.h new file mode 100644 index 0000000..d1049c2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/pci.h
@@ -0,0 +1,134 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_PCI_H_ +#define SYSROOT_ZIRCON_SYSCALLS_PCI_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + + +// Base Address Registers are accessed in userspace via the get_bar protocol method. The +// Bar is represented via a pci_bar_t struct which contains a handle pointer to a VMO +// in the case of an MMIO bar, as well as a PIO addr/size pair for the memory region +// to access if a PIO bar. In the latter case, the protocol will acquire the appropriate +// permissions for the process to write to that PIO region on that architecture. +typedef uint32_t zx_pci_bar_types_t; +#define ZX_PCI_BAR_TYPE_UNUSED ((zx_pci_bar_types_t) 0u) +#define ZX_PCI_BAR_TYPE_MMIO ((zx_pci_bar_types_t) 1u) +#define ZX_PCI_BAR_TYPE_PIO ((zx_pci_bar_types_t) 2u) + +// TODO(cja): This makes some assumptions that anything in an arch's PIO region +// is going to be defined as a base address and size. This will need to be +// updated to a per-platform structure in the event that doesn't pan out +// in the future. +typedef struct zx_pci_bar { + uint32_t id; + uint32_t type; + size_t size; + union { + uintptr_t addr; + struct { + zx_handle_t handle; + uint8_t padding1[4]; + }; + }; +} zx_pci_bar_t; + +// Defines and structures related to zx_pci_*() +// Info returned to dev manager for PCIe devices when probing. +typedef struct zx_pcie_device_info { + uint16_t vendor_id; + uint16_t device_id; + + uint8_t base_class; + uint8_t sub_class; + uint8_t program_interface; + uint8_t revision_id; + + uint8_t bus_id; + uint8_t dev_id; + uint8_t func_id; + + uint8_t padding1; +} zx_pcie_device_info_t; + +#define ZX_PCI_MAX_BUSSES (256u) +#define ZX_PCI_MAX_DEVICES_PER_BUS (32u) +#define ZX_PCI_MAX_FUNCTIONS_PER_DEVICE (8u) +#define ZX_PCI_MAX_FUNCTIONS_PER_BUS (ZX_PCI_MAX_DEVICES_PER_BUS * ZX_PCI_MAX_FUNCTIONS_PER_DEVICE) + +#define ZX_PCI_MAX_LEGACY_IRQ_PINS (4u) +#define ZX_PCI_MAX_MSI_IRQS (32u) +#define ZX_PCI_MAX_MSIX_IRQS (2048u) + +#define ZX_PCI_STANDARD_CONFIG_HDR_SIZE (64u) +#define ZX_PCI_BASE_CONFIG_SIZE (256u) +#define ZX_PCI_EXTENDED_CONFIG_SIZE (4096u) +#define ZX_PCI_ECAM_BYTE_PER_BUS (ZX_PCI_EXTENDED_CONFIG_SIZE * ZX_PCI_MAX_FUNCTIONS_PER_BUS) + +#define ZX_PCI_BAR_REGS_PER_BRIDGE (2u) +#define ZX_PCI_BAR_REGS_PER_DEVICE (6u) +#define ZX_PCI_MAX_BAR_REGS (6u) + +#define ZX_PCI_NO_IRQ_MAPPING UINT32_MAX + +// Used for zx_pci_init_arg_t::addr_windows::cfg_space_type +#define PCI_CFG_SPACE_TYPE_PIO (0u) +#define PCI_CFG_SPACE_TYPE_MMIO (1u) +#define PCI_CFG_SPACE_TYPE_DW_ROOT (2u) // Designware Root Bridge ECAM +#define PCI_CFG_SPACE_TYPE_DW_DS (3u) // Designware Downstream ECAM + +// Dimensions: device id, function id, legacy pin number +// ZX_PCI_NO_IRQ_MAPPING if no mapping specified. +typedef uint32_t zx_pci_irq_swizzle_lut_t[ZX_PCI_MAX_DEVICES_PER_BUS] + [ZX_PCI_MAX_FUNCTIONS_PER_DEVICE] + [ZX_PCI_MAX_LEGACY_IRQ_PINS]; + +// We support up to 224 IRQs on a system, this is the maximum supported by +// LAPICs (today) so this should be a safe number. +#define ZX_PCI_MAX_IRQS 224 + +typedef struct zx_pci_init_arg { + zx_pci_irq_swizzle_lut_t dev_pin_to_global_irq; + + uint32_t num_irqs; + struct { + uint32_t global_irq; + bool level_triggered; + bool active_high; + uint8_t padding1[2]; + } irqs[ZX_PCI_MAX_IRQS]; + + uint32_t addr_window_count; + struct { + uint64_t base; + size_t size; + uint8_t bus_start; + uint8_t bus_end; + uint8_t cfg_space_type; + bool has_ecam; + uint8_t padding1[4]; + } addr_windows[]; +} zx_pci_init_arg_t; + +#define ZX_PCI_INIT_ARG_MAX_ECAM_WINDOWS 2 +#define ZX_PCI_INIT_ARG_MAX_SIZE (sizeof(((zx_pci_init_arg_t*)NULL)->addr_windows[0]) * \ + ZX_PCI_INIT_ARG_MAX_ECAM_WINDOWS + \ + sizeof(zx_pci_init_arg_t)) + +// Enum used to select PCIe IRQ modes +typedef uint32_t zx_pci_irq_mode_t; +#define ZX_PCIE_IRQ_MODE_DISABLED ((zx_pci_irq_mode_t) 0u) +#define ZX_PCIE_IRQ_MODE_LEGACY ((zx_pci_irq_mode_t) 1u) +#define ZX_PCIE_IRQ_MODE_MSI ((zx_pci_irq_mode_t) 2u) +#define ZX_PCIE_IRQ_MODE_MSI_X ((zx_pci_irq_mode_t) 3u) + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_PCI_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/policy.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/policy.h new file mode 100644 index 0000000..158c604 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/policy.h
@@ -0,0 +1,89 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_POLICY_H_ +#define SYSROOT_ZIRCON_SYSCALLS_POLICY_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +// Policy is applied for the conditions that are not +// specified by the parent job policy. +#define ZX_JOB_POL_RELATIVE 0u +// Policy is either applied as-is or the syscall fails. +#define ZX_JOB_POL_ABSOLUTE 1u + +// Basic policy topic. +#define ZX_JOB_POL_BASIC_V1 0u +#define ZX_JOB_POL_BASIC_V2 0x01000000u + +// Timer slack policy topic. +#define ZX_JOB_POL_TIMER_SLACK 1u + +// Input structure to use with ZX_JOB_POL_BASIC_V1. +typedef struct zx_policy_basic_v1 { + uint32_t condition; + uint32_t policy; +} zx_policy_basic_v1_t; + +// Input structure to use with ZX_JOB_POL_BASIC_V2. +typedef struct zx_policy_basic_v2 { + uint32_t condition; + uint32_t action; + uint32_t flags; +} zx_policy_basic_v2_t; + +#define ZX_JOB_POL_BASIC ZX_JOB_POL_BASIC_V1 +typedef struct zx_policy_basic_v1 zx_policy_basic; +typedef struct zx_policy_basic_v1 zx_policy_basic_t; + +// Conditions handled by job policy. +#define ZX_POL_BAD_HANDLE 0u +#define ZX_POL_WRONG_OBJECT 1u +#define ZX_POL_VMAR_WX 2u +#define ZX_POL_NEW_ANY 3u +#define ZX_POL_NEW_VMO 4u +#define ZX_POL_NEW_CHANNEL 5u +#define ZX_POL_NEW_EVENT 6u +#define ZX_POL_NEW_EVENTPAIR 7u +#define ZX_POL_NEW_PORT 8u +#define ZX_POL_NEW_SOCKET 9u +#define ZX_POL_NEW_FIFO 10u +#define ZX_POL_NEW_TIMER 11u +#define ZX_POL_NEW_PROCESS 12u +#define ZX_POL_NEW_PROFILE 13u +#define ZX_POL_AMBIENT_MARK_VMO_EXEC 14u +#ifdef _KERNEL +#define ZX_POL_MAX 15u +#endif + +// Policy actions. +#define ZX_POL_ACTION_ALLOW 0u +#define ZX_POL_ACTION_DENY 1u +#define ZX_POL_ACTION_ALLOW_EXCEPTION 2u +#define ZX_POL_ACTION_DENY_EXCEPTION 3u +#define ZX_POL_ACTION_KILL 4u +#ifdef _KERNEL +#define ZX_POL_ACTION_MAX 5u +#endif + +// Policy override. +#define ZX_POL_OVERRIDE_ALLOW 0u +#define ZX_POL_OVERRIDE_DENY 1u + + +// Input structure to use with ZX_JOB_POL_TIMER_SLACK. +typedef struct zx_policy_timer_slack { + zx_duration_t min_slack; + uint32_t default_mode; + uint8_t padding1[4]; +} zx_policy_timer_slack_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_POLICY_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/port.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/port.h new file mode 100644 index 0000000..9feb4dc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/port.h
@@ -0,0 +1,173 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_PORT_H_ +#define SYSROOT_ZIRCON_SYSCALLS_PORT_H_ + +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// clang-format off + +// zx_object_wait_async() options +#define ZX_WAIT_ASYNC_ONCE ((uint32_t)0u) +#define ZX_WAIT_ASYNC_TIMESTAMP ((uint32_t)1u) + +// packet types. zx_port_packet_t::type +#define ZX_PKT_TYPE_USER ((uint8_t)0x00u) +#define ZX_PKT_TYPE_SIGNAL_ONE ((uint8_t)0x01u) +// 0x02 was previously used for "ZX_PKT_TYPE_SIGNAL_REP". +#define ZX_PKT_TYPE_GUEST_BELL ((uint8_t)0x03u) +#define ZX_PKT_TYPE_GUEST_MEM ((uint8_t)0x04u) +#define ZX_PKT_TYPE_GUEST_IO ((uint8_t)0x05u) +#define ZX_PKT_TYPE_GUEST_VCPU ((uint8_t)0x06u) +#define ZX_PKT_TYPE_INTERRUPT ((uint8_t)0x07u) +#define ZX_PKT_TYPE_PAGE_REQUEST ((uint8_t)0x09u) + +// For options passed to port_create +#define ZX_PORT_BIND_TO_INTERRUPT ((uint32_t)(0x1u << 0)) + +#define ZX_PKT_TYPE_MASK ((uint32_t)0x000000FFu) + +#define ZX_PKT_IS_USER(type) ((type) == ZX_PKT_TYPE_USER) +#define ZX_PKT_IS_SIGNAL_ONE(type) ((type) == ZX_PKT_TYPE_SIGNAL_ONE) +#define ZX_PKT_IS_GUEST_BELL(type) ((type) == ZX_PKT_TYPE_GUEST_BELL) +#define ZX_PKT_IS_GUEST_MEM(type) ((type) == ZX_PKT_TYPE_GUEST_MEM) +#define ZX_PKT_IS_GUEST_IO(type) ((type) == ZX_PKT_TYPE_GUEST_IO) +#define ZX_PKT_IS_GUEST_VCPU(type) ((type) == ZX_PKT_TYPE_GUEST_VCPU) +#define ZX_PKT_IS_INTERRUPT(type) ((type) == ZX_PKT_TYPE_INTERRUPT) +#define ZX_PKT_IS_PAGE_REQUEST(type) ((type) == ZX_PKT_TYPE_PAGE_REQUEST) + +// zx_packet_guest_vcpu_t::type +#define ZX_PKT_GUEST_VCPU_INTERRUPT ((uint8_t)0) +#define ZX_PKT_GUEST_VCPU_STARTUP ((uint8_t)1) + +// zx_packet_page_request_t::command +#define ZX_PAGER_VMO_READ ((uint16_t) 0) +#define ZX_PAGER_VMO_COMPLETE ((uint16_t) 1) +// clang-format on + +// port_packet_t::type ZX_PKT_TYPE_USER. +typedef union zx_packet_user { + uint64_t u64[4]; + uint32_t u32[8]; + uint16_t u16[16]; + uint8_t c8[32]; +} zx_packet_user_t; + +// port_packet_t::type ZX_PKT_TYPE_SIGNAL_ONE. +typedef struct zx_packet_signal { + zx_signals_t trigger; + zx_signals_t observed; + uint64_t count; + uint64_t timestamp; + uint64_t reserved1; +} zx_packet_signal_t; + +typedef struct zx_packet_guest_bell { + zx_gpaddr_t addr; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; +} zx_packet_guest_bell_t; + +typedef struct zx_packet_guest_mem { + zx_gpaddr_t addr; +#if __aarch64__ + uint8_t access_size; + bool sign_extend; + uint8_t xt; + bool read; + uint8_t padding1[4]; + uint64_t data; + uint64_t reserved; +#elif __x86_64__ +// NOTE: x86 instructions are guaranteed to be 15 bytes or fewer. +#define X86_MAX_INST_LEN 15u + uint8_t inst_len; + uint8_t inst_buf[X86_MAX_INST_LEN]; + // This is the default operand size as determined by the CS and EFER register (Volume 3, + // Section 5.2.1). If operating in 64-bit mode then near branches and all instructions, except + // far branches, that implicitly reference the RSP will actually have a default operand size of + // 64-bits (Volume 2, Section 2.2.1.7), and not the 32-bits that will be given here. + uint8_t default_operand_size; + uint8_t reserved[7]; +#endif +} zx_packet_guest_mem_t; + +typedef struct zx_packet_guest_io { + uint16_t port; + uint8_t access_size; + bool input; + union { + struct { + uint8_t u8; + uint8_t padding1[3]; + }; + struct { + uint16_t u16; + uint8_t padding2[2]; + }; + uint32_t u32; + uint8_t data[4]; + }; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; +} zx_packet_guest_io_t; + +typedef struct zx_packet_guest_vcpu { + union { + struct { + uint64_t mask; + uint8_t vector; + uint8_t padding1[7]; + } interrupt; + struct { + uint64_t id; + zx_gpaddr_t entry; + } startup; + }; + uint8_t type; + uint8_t padding1[7]; + uint64_t reserved; +} zx_packet_guest_vcpu_t; + +typedef struct zx_packet_interrupt { + zx_time_t timestamp; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; +} zx_packet_interrupt_t; + +typedef struct zx_packet_page_request { + uint16_t command; + uint16_t flags; + uint32_t reserved0; + uint64_t offset; + uint64_t length; + uint64_t reserved1; +} zx_packet_page_request_t; + +typedef struct zx_port_packet { + uint64_t key; + uint32_t type; + zx_status_t status; + union { + zx_packet_user_t user; + zx_packet_signal_t signal; + zx_packet_guest_bell_t guest_bell; + zx_packet_guest_mem_t guest_mem; + zx_packet_guest_io_t guest_io; + zx_packet_guest_vcpu_t guest_vcpu; + zx_packet_interrupt_t interrupt; + zx_packet_page_request_t page_request; + }; +} zx_port_packet_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_PORT_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/profile.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/profile.h new file mode 100644 index 0000000..5abf561 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/profile.h
@@ -0,0 +1,49 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_PROFILE_H_ +#define SYSROOT_ZIRCON_SYSCALLS_PROFILE_H_ + +#include <zircon/syscalls/scheduler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +#define ZX_PRIORITY_LOWEST 0 +#define ZX_PRIORITY_LOW 8 +#define ZX_PRIORITY_DEFAULT 16 +#define ZX_PRIORITY_HIGH 24 +#define ZX_PRIORITY_HIGHEST 31 + +#define ZX_PROFILE_INFO_FLAG_PRIORITY (1 << 0) +#define ZX_PROFILE_INFO_FLAG_CPU_MASK (1 << 1) +#define ZX_PROFILE_INFO_FLAG_DEADLINE (1 << 2) + +typedef struct zx_profile_info { + // A bitmask of ZX_PROFILE_INFO_FLAG_* values. Specifies which fields + // below have been specified. Other fields are considered unset. + uint32_t flags; + + uint8_t padding1[4]; + + union { + struct { + // Scheduling priority. |flags| must have ZX_PROFILE_INFO_FLAG_PRIORITY set. + int32_t priority; + + uint8_t padding2[20]; + }; + + // Scheduling deadline. |flags| must have ZX_PROFILE_INFO_FLAG_DEADLINE set. + zx_sched_deadline_params_t deadline_params; + }; + + // CPUs that threads may be scheduled on. |flags| must have + // ZX_PROFILE_INFO_FLAG_CPU_MASK set. + zx_cpu_set_t cpu_affinity_mask; +} zx_profile_info_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_PROFILE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/resource.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/resource.h new file mode 100644 index 0000000..84b12a1 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/resource.h
@@ -0,0 +1,37 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_RESOURCE_H_ +#define SYSROOT_ZIRCON_SYSCALLS_RESOURCE_H_ + +#include <stdint.h> + +#include <zircon/compiler.h> + +// Resources that require a region allocator to handle exclusive reservations +// are defined in a contiguous block starting at 0 up to ZX_RSRC_KIND_COUNT-1. +// After that point, all resource 'kinds' are abstract and need no underlying +// bookkeeping. It's important that ZX_RSRC_KIND_COUNT is defined for each +// architecture to properly allocate only the bookkeeping necessary. +// +// TODO(ZX-2419): Don't expose ZX_RSRC_KIND_COUNT to userspace + +typedef uint32_t zx_rsrc_kind_t; +#define ZX_RSRC_KIND_MMIO ((zx_rsrc_kind_t)0u) +#define ZX_RSRC_KIND_IRQ ((zx_rsrc_kind_t)1u) +#define ZX_RSRC_KIND_IOPORT ((zx_rsrc_kind_t)2u) +#define ZX_RSRC_KIND_HYPERVISOR ((zx_rsrc_kind_t)3u) +#define ZX_RSRC_KIND_ROOT ((zx_rsrc_kind_t)4u) +#define ZX_RSRC_KIND_VMEX ((zx_rsrc_kind_t)5u) +#define ZX_RSRC_KIND_SMC ((zx_rsrc_kind_t)6u) +#define ZX_RSRC_KIND_COUNT ((zx_rsrc_kind_t)7u) + +typedef uint32_t zx_rsrc_flags_t; +#define ZX_RSRC_FLAG_EXCLUSIVE ((zx_rsrc_flags_t)0x00010000u) +#define ZX_RSRC_FLAGS_MASK ((zx_rsrc_flags_t)ZX_RSRC_FLAG_EXCLUSIVE) + +#define ZX_RSRC_EXTRACT_KIND(x) ((x)&0x0000FFFF) +#define ZX_RSRC_EXTRACT_FLAGS(x) ((x)&0xFFFF0000) + +#endif // SYSROOT_ZIRCON_SYSCALLS_RESOURCE_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/scheduler.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/scheduler.h new file mode 100644 index 0000000..c119562 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/scheduler.h
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_SCHEDULER_H_ +#define SYSROOT_ZIRCON_SYSCALLS_SCHEDULER_H_ + +#include <zircon/compiler.h> +#include <zircon/time.h> + +__BEGIN_CDECLS + +// Parameters for deadline scheduler profiles. +// +// At minimum, the following relation must hold: +// +// 0 < capacity <= relative_deadline <= period +// +// Additional restrictions on the range and granularity of the parameters may be +// enforced, which can vary from system to system. +// +typedef struct zx_sched_deadline_params { + // The worst case execution time of the deadline work per interarrival period. + zx_duration_t capacity; + + // The worst case finish time of the deadline work, relative to the beginning + // of the current interarrival period. + zx_duration_t relative_deadline; + + // The worst case interarrival period of the deadline work. + zx_duration_t period; +} zx_sched_deadline_params_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_SCHEDULER_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/smc.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/smc.h new file mode 100644 index 0000000..93f1761 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/smc.h
@@ -0,0 +1,47 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_SMC_H_ +#define SYSROOT_ZIRCON_SYSCALLS_SMC_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Silicon Partner. +#define ARM_SMC_SERVICE_CALL_NUM_SIP_SERVICE_BASE 0x02 +#define ARM_SMC_SERVICE_CALL_NUM_SIP_SERVICE_LENGTH 0x01 +#define ARM_SMC_SERVICE_CALL_NUM_TRUSTED_OS_BASE 0x32 +#define ARM_SMC_SERVICE_CALL_NUM_TRUSTED_OS_LENGTH 0xE +#define ARM_SMC_SERVICE_CALL_NUM_MAX 0x3F +#define ARM_SMC_SERVICE_CALL_NUM_MASK 0x3F +#define ARM_SMC_SERVICE_CALL_NUM_SHIFT 24 +#define ARM_SMC_GET_SERVICE_CALL_NUM_FROM_FUNC_ID(func_id) \ + (((func_id) >> ARM_SMC_SERVICE_CALL_NUM_SHIFT) & ARM_SMC_SERVICE_CALL_NUM_MASK) + +typedef struct zx_smc_parameters { + uint32_t func_id; + uint8_t padding1[4]; + uint64_t arg1; + uint64_t arg2; + uint64_t arg3; + uint64_t arg4; + uint64_t arg5; + uint64_t arg6; + uint16_t client_id; + uint16_t secure_os_id; + uint8_t padding2[4]; +} zx_smc_parameters_t; + +typedef struct zx_smc_result { + uint64_t arg0; + uint64_t arg1; + uint64_t arg2; + uint64_t arg3; + uint64_t arg6; // at least one implementation uses it as a way to return session_id. +} zx_smc_result_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_SMC_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/system.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/system.h new file mode 100644 index 0000000..b54d443 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/system.h
@@ -0,0 +1,44 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_SYSTEM_H_ +#define SYSROOT_ZIRCON_SYSCALLS_SYSTEM_H_ + +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Commands used by zx_system_powerctl() +#define ZX_SYSTEM_POWERCTL_ENABLE_ALL_CPUS 1u +#define ZX_SYSTEM_POWERCTL_DISABLE_ALL_CPUS_BUT_PRIMARY 2u +#define ZX_SYSTEM_POWERCTL_ACPI_TRANSITION_S_STATE 3u +#define ZX_SYSTEM_POWERCTL_X86_SET_PKG_PL1 4u +#define ZX_SYSTEM_POWERCTL_REBOOT 5u +#define ZX_SYSTEM_POWERCTL_REBOOT_BOOTLOADER 6u +#define ZX_SYSTEM_POWERCTL_REBOOT_RECOVERY 7u +#define ZX_SYSTEM_POWERCTL_SHUTDOWN 8u + +typedef struct zx_system_powerctl_arg { + union { + struct { + struct { + uint8_t target_s_state; // Value between 1 and 5 indicating which S-state + uint8_t sleep_type_a; // Value from ACPI VM (SLP_TYPa) + uint8_t sleep_type_b; // Value from ACPI VM (SLP_TYPb) + } acpi_transition_s_state; + uint8_t padding1[9]; + }; + struct { + uint32_t power_limit; // PL1 value in milliwatts + uint32_t time_window; // PL1 time window in microseconds + uint8_t clamp; // PL1 clamping enable + uint8_t enable; // PL1 enable + uint8_t padding2[2]; + } x86_power_limit; + }; +} zx_system_powerctl_arg_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_SYSTEM_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/types.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/types.h new file mode 100644 index 0000000..b7910f2 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/syscalls/types.h
@@ -0,0 +1,25 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_SYSCALLS_TYPES_H_ +#define SYSROOT_ZIRCON_SYSCALLS_TYPES_H_ + +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// forward declarations needed by syscalls.h +typedef struct zx_port_packet zx_port_packet_t; +typedef struct zx_pci_bar zx_pci_bar_t; +typedef struct zx_pcie_device_info zx_pcie_device_info_t; +typedef struct zx_pci_init_arg zx_pci_init_arg_t; +typedef union zx_rrec zx_rrec_t; +typedef struct zx_system_powerctl_arg zx_system_powerctl_arg_t; +typedef struct zx_profile_info zx_profile_info_t; +typedef struct zx_smc_parameters zx_smc_parameters_t; +typedef struct zx_smc_result zx_smc_result_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_SYSCALLS_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/testonly-syscalls.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/testonly-syscalls.h new file mode 100644 index 0000000..d994d86 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/testonly-syscalls.h
@@ -0,0 +1,30 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TESTONLY_SYSCALLS_H_ +#define SYSROOT_ZIRCON_TESTONLY_SYSCALLS_H_ + +#include <zircon/syscalls.h> + +__BEGIN_CDECLS + +// Make sure this matches <zircon/syscalls.h>. +#define _ZX_SYSCALL_DECL(name, type, attrs, nargs, arglist, prototype) \ + extern attrs type zx_##name prototype; \ + extern attrs type _zx_##name prototype; + +#ifdef __clang__ +#define _ZX_SYSCALL_ANNO(attr) __attribute__((attr)) +#else +#define _ZX_SYSCALL_ANNO(attr) // Nothing for compilers without the support. +#endif + +#include <zircon/syscalls/internal/testonly-cdecls.inc> + +#undef _ZX_SYSCALL_ANNO +#undef _ZX_SYSCALL_DECL + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_ONLY_SYSCALLS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/threads.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/threads.h new file mode 100644 index 0000000..5bfc4b0 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/threads.h
@@ -0,0 +1,40 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_THREADS_H_ +#define SYSROOT_ZIRCON_THREADS_H_ + +#include <threads.h> +#include <zircon/compiler.h> +#include <zircon/types.h> + +__BEGIN_CDECLS + +// Get the zx_handle_t corresponding to the thrd_t. This handle is +// still owned by the C11 thread, and will not persist after the +// thread exits and is joined or detached. Callers must duplicate the +// handle, therefore, if they wish the thread handle to outlive the +// execution of the C11 thread. +zx_handle_t thrd_get_zx_handle(thrd_t t); + +// Converts a threads.h-style status value to an |zx_status_t|. +static inline zx_status_t __PURE thrd_status_to_zx_status(int thrd_status) { + switch (thrd_status) { + case thrd_success: + return ZX_OK; + case thrd_nomem: + return ZX_ERR_NO_MEMORY; + case thrd_timedout: + return ZX_ERR_TIMED_OUT; + case thrd_busy: + return ZX_ERR_SHOULD_WAIT; + default: + case thrd_error: + return ZX_ERR_INTERNAL; + } +} + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_THREADS_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/time.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/time.h new file mode 100644 index 0000000..e6bd862 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/time.h
@@ -0,0 +1,153 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TIME_H_ +#define SYSROOT_ZIRCON_TIME_H_ + +#include <stdint.h> +#include <zircon/compiler.h> + +__BEGIN_CDECLS + +// absolute time in nanoseconds (generally with respect to the monotonic clock) +typedef int64_t zx_time_t; +// a duration in nanoseconds +typedef int64_t zx_duration_t; +// a duration in hardware ticks +typedef int64_t zx_ticks_t; + +#define ZX_TIME_INFINITE INT64_MAX +#define ZX_TIME_INFINITE_PAST INT64_MIN + +// These functions perform overflow-safe time arithmetic and unit conversion, clamping to +// ZX_TIME_INFINITE in case of overflow and ZX_TIME_INFINITE_PAST in case of underflow. +// +// C++ code should use zx::time and zx::duration instead. +// +// For arithmetic the naming scheme is: +// zx_<first argument>_<operation>_<second argument> +// +// For unit conversion the naming scheme is: +// zx_duration_from_<unit of argument> +// +// TODO(maniscalco): Consider expanding the set of operations to include division, modulo, and +// floating point math. + +__CONSTEXPR static inline zx_time_t zx_time_add_duration(zx_time_t time, zx_duration_t duration) { + zx_time_t x = 0; + if (unlikely(add_overflow(time, duration, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_time_t zx_time_sub_duration(zx_time_t time, zx_duration_t duration) { + zx_time_t x = 0; + if (unlikely(sub_overflow(time, duration, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_time_sub_time(zx_time_t time1, zx_time_t time2) { + zx_duration_t x = 0; + if (unlikely(sub_overflow(time1, time2, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_duration_add_duration(zx_duration_t dur1, + zx_duration_t dur2) { + zx_duration_t x = 0; + if (unlikely(add_overflow(dur1, dur2, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_duration_sub_duration(zx_duration_t dur1, + zx_duration_t dur2) { + zx_duration_t x = 0; + if (unlikely(sub_overflow(dur1, dur2, &x))) { + if (x >= 0) { + return ZX_TIME_INFINITE_PAST; + } else { + return ZX_TIME_INFINITE; + } + } + return x; +} + +__CONSTEXPR static inline zx_duration_t zx_duration_mul_int64(zx_duration_t duration, + int64_t multiplier) { + zx_duration_t x = 0; + if (unlikely(mul_overflow(duration, multiplier, &x))) { + if ((duration > 0 && multiplier > 0) || (duration < 0 && multiplier < 0)) { + return ZX_TIME_INFINITE; + } else { + return ZX_TIME_INFINITE_PAST; + } + } + return x; +} + +__CONSTEXPR static inline int64_t zx_nsec_from_duration(zx_duration_t n) { return n; } + +__CONSTEXPR static inline zx_duration_t zx_duration_from_nsec(int64_t n) { + return zx_duration_mul_int64(1, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_usec(int64_t n) { + return zx_duration_mul_int64(1000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_msec(int64_t n) { + return zx_duration_mul_int64(1000000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_sec(int64_t n) { + return zx_duration_mul_int64(1000000000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_min(int64_t n) { + return zx_duration_mul_int64(60000000000, n); +} + +__CONSTEXPR static inline zx_duration_t zx_duration_from_hour(int64_t n) { + return zx_duration_mul_int64(3600000000000, n); +} + +// Similar to the functions above, these macros perform overflow-safe unit conversion. Prefer to use +// the functions above instead of these macros. +#define ZX_NSEC(n) (__ISCONSTANT(n) ? ((zx_duration_t)(1LL * (n))) : (zx_duration_from_nsec(n))) +#define ZX_USEC(n) (__ISCONSTANT(n) ? ((zx_duration_t)(1000LL * (n))) : (zx_duration_from_usec(n))) +#define ZX_MSEC(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(1000000LL * (n))) : (zx_duration_from_msec(n))) +#define ZX_SEC(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(1000000000LL * (n))) : (zx_duration_from_sec(n))) +#define ZX_MIN(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(60LL * 1000000000LL * (n))) : (zx_duration_from_min(n))) +#define ZX_HOUR(n) \ + (__ISCONSTANT(n) ? ((zx_duration_t)(3600LL * 1000000000LL * (n))) : (zx_duration_from_hour(n))) + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_TIME_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/tls.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/tls.h new file mode 100644 index 0000000..dae9694 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/tls.h
@@ -0,0 +1,29 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TLS_ +#define SYSROOT_ZIRCON_TLS_ + +// These constants are part of the C/C++ ABI known to compilers for +// *-fuchsia targets. These are offsets from the thread pointer. + +// This file must be includable in assembly files. + +#if defined(__x86_64__) + +#define ZX_TLS_STACK_GUARD_OFFSET 0x10 +#define ZX_TLS_UNSAFE_SP_OFFSET 0x18 + +#elif defined(__aarch64__) + +#define ZX_TLS_STACK_GUARD_OFFSET (-0x10) +#define ZX_TLS_UNSAFE_SP_OFFSET (-0x8) + +#else + +#error what architecture? + +#endif + +#endif // SYSROOT_ZIRCON_TLS_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/types.h b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/types.h new file mode 100644 index 0000000..10faebb --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/include/zircon/types.h
@@ -0,0 +1,489 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYSROOT_ZIRCON_TYPES_H_ +#define SYSROOT_ZIRCON_TYPES_H_ + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <zircon/compiler.h> +#include <zircon/errors.h> +#include <zircon/limits.h> +#include <zircon/rights.h> +#include <zircon/time.h> + +#ifndef __cplusplus +#ifndef _KERNEL +// We don't want to include <stdatomic.h> from the kernel code because the +// kernel definitions of atomic operations are incompatible with those defined +// in <stdatomic.h>. +// +// A better solution would be to use <stdatomic.h> and C11 atomic operation +// even in the kernel, but that would require modifying all the code that uses +// the existing homegrown atomics. +#include <stdatomic.h> +#endif +#endif + +__BEGIN_CDECLS + +// ask clang format not to mess up the indentation: +// clang-format off + +typedef uint32_t zx_handle_t; + +#define ZX_HANDLE_INVALID ((zx_handle_t)0) +#define ZX_HANDLE_FIXED_BITS_MASK ((zx_handle_t)0x3) + +// See errors.h for the values zx_status_t can take. +typedef int32_t zx_status_t; + +// clock ids +typedef uint32_t zx_clock_t; +#define ZX_CLOCK_MONOTONIC ((zx_clock_t)0) +#define ZX_CLOCK_UTC ((zx_clock_t)1) +#define ZX_CLOCK_THREAD ((zx_clock_t)2) + +typedef uint32_t zx_signals_t; + +#define ZX_SIGNAL_NONE ((zx_signals_t)0u) +#define ZX_USER_SIGNAL_ALL ((zx_signals_t)0xff000000u) + +// Implementation details (__ZX_* not intended for public consumption) +// +// Signals that have a common meaning where used are named with that +// meaning. Signals that do not, or are not yet in use, are named +// generically. +#define __ZX_OBJECT_SIGNAL_ALL ((zx_signals_t)0x00ffffffu) +#define __ZX_OBJECT_READABLE ((zx_signals_t)1u << 0) +#define __ZX_OBJECT_WRITABLE ((zx_signals_t)1u << 1) +#define __ZX_OBJECT_PEER_CLOSED ((zx_signals_t)1u << 2) +#define __ZX_OBJECT_SIGNALED ((zx_signals_t)1u << 3) +#define __ZX_OBJECT_SIGNAL_4 ((zx_signals_t)1u << 4) +#define __ZX_OBJECT_SIGNAL_5 ((zx_signals_t)1u << 5) +#define __ZX_OBJECT_SIGNAL_6 ((zx_signals_t)1u << 6) +#define __ZX_OBJECT_SIGNAL_7 ((zx_signals_t)1u << 7) +#define __ZX_OBJECT_SIGNAL_8 ((zx_signals_t)1u << 8) +#define __ZX_OBJECT_SIGNAL_9 ((zx_signals_t)1u << 9) +#define __ZX_OBJECT_SIGNAL_10 ((zx_signals_t)1u << 10) +#define __ZX_OBJECT_SIGNAL_11 ((zx_signals_t)1u << 11) +#define __ZX_OBJECT_SIGNAL_12 ((zx_signals_t)1u << 12) +#define __ZX_OBJECT_SIGNAL_13 ((zx_signals_t)1u << 13) +#define __ZX_OBJECT_SIGNAL_14 ((zx_signals_t)1u << 14) +#define __ZX_OBJECT_SIGNAL_15 ((zx_signals_t)1u << 15) +#define __ZX_OBJECT_SIGNAL_16 ((zx_signals_t)1u << 16) +#define __ZX_OBJECT_SIGNAL_17 ((zx_signals_t)1u << 17) +#define __ZX_OBJECT_SIGNAL_18 ((zx_signals_t)1u << 18) +#define __ZX_OBJECT_SIGNAL_19 ((zx_signals_t)1u << 19) +#define __ZX_OBJECT_SIGNAL_20 ((zx_signals_t)1u << 20) +#define __ZX_OBJECT_SIGNAL_21 ((zx_signals_t)1u << 21) +#define __ZX_OBJECT_SIGNAL_22 ((zx_signals_t)1u << 22) +#define __ZX_OBJECT_HANDLE_CLOSED ((zx_signals_t)1u << 23) + + + +// User Signals (for zx_object_signal() and zx_object_signal_peer()) +#define ZX_USER_SIGNAL_0 ((zx_signals_t)1u << 24) +#define ZX_USER_SIGNAL_1 ((zx_signals_t)1u << 25) +#define ZX_USER_SIGNAL_2 ((zx_signals_t)1u << 26) +#define ZX_USER_SIGNAL_3 ((zx_signals_t)1u << 27) +#define ZX_USER_SIGNAL_4 ((zx_signals_t)1u << 28) +#define ZX_USER_SIGNAL_5 ((zx_signals_t)1u << 29) +#define ZX_USER_SIGNAL_6 ((zx_signals_t)1u << 30) +#define ZX_USER_SIGNAL_7 ((zx_signals_t)1u << 31) + +// Cancellation (handle was closed while waiting with it) +#define ZX_SIGNAL_HANDLE_CLOSED __ZX_OBJECT_HANDLE_CLOSED + +// Event +#define ZX_EVENT_SIGNALED __ZX_OBJECT_SIGNALED +#define ZX_EVENT_SIGNAL_MASK (ZX_USER_SIGNAL_ALL | __ZX_OBJECT_SIGNALED) + +// EventPair +#define ZX_EVENTPAIR_SIGNALED __ZX_OBJECT_SIGNALED +#define ZX_EVENTPAIR_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED +#define ZX_EVENTPAIR_SIGNAL_MASK (ZX_USER_SIGNAL_ALL | __ZX_OBJECT_SIGNALED | __ZX_OBJECT_PEER_CLOSED) + +// Channel +#define ZX_CHANNEL_READABLE __ZX_OBJECT_READABLE +#define ZX_CHANNEL_WRITABLE __ZX_OBJECT_WRITABLE +#define ZX_CHANNEL_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED + +// Clock +#define ZX_CLOCK_STARTED __ZX_OBJECT_SIGNAL_4 + +// Socket +#define ZX_SOCKET_READABLE __ZX_OBJECT_READABLE +#define ZX_SOCKET_WRITABLE __ZX_OBJECT_WRITABLE +#define ZX_SOCKET_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED +#define ZX_SOCKET_PEER_WRITE_DISABLED __ZX_OBJECT_SIGNAL_4 +#define ZX_SOCKET_WRITE_DISABLED __ZX_OBJECT_SIGNAL_5 +#define ZX_SOCKET_READ_THRESHOLD __ZX_OBJECT_SIGNAL_10 +#define ZX_SOCKET_WRITE_THRESHOLD __ZX_OBJECT_SIGNAL_11 + +// Fifo +#define ZX_FIFO_READABLE __ZX_OBJECT_READABLE +#define ZX_FIFO_WRITABLE __ZX_OBJECT_WRITABLE +#define ZX_FIFO_PEER_CLOSED __ZX_OBJECT_PEER_CLOSED + +// Task signals (process, thread, job) +#define ZX_TASK_TERMINATED __ZX_OBJECT_SIGNALED + +// Job +#define ZX_JOB_TERMINATED __ZX_OBJECT_SIGNALED +#define ZX_JOB_NO_JOBS __ZX_OBJECT_SIGNAL_4 +#define ZX_JOB_NO_PROCESSES __ZX_OBJECT_SIGNAL_5 + +// Process +#define ZX_PROCESS_TERMINATED __ZX_OBJECT_SIGNALED + +// Thread +#define ZX_THREAD_TERMINATED __ZX_OBJECT_SIGNALED +#define ZX_THREAD_RUNNING __ZX_OBJECT_SIGNAL_4 +#define ZX_THREAD_SUSPENDED __ZX_OBJECT_SIGNAL_5 + +// Log +#define ZX_LOG_READABLE __ZX_OBJECT_READABLE +#define ZX_LOG_WRITABLE __ZX_OBJECT_WRITABLE + +// Timer +#define ZX_TIMER_SIGNALED __ZX_OBJECT_SIGNALED + +// VMO +#define ZX_VMO_ZERO_CHILDREN __ZX_OBJECT_SIGNALED + +// global kernel object id. +// Note: kernel object ids use 63 bits, with the most significant bit being zero. +// The remaining values (msb==1) are for use by programs and tools that wish to +// create koids for artificial objects. +typedef uint64_t zx_koid_t; +#define ZX_KOID_INVALID ((uint64_t) 0) +#define ZX_KOID_KERNEL ((uint64_t) 1) +// The first non-reserved koid. The first 1024 are reserved. +#define ZX_KOID_FIRST ((uint64_t) 1024) + +// Maximum number of wait items allowed for zx_object_wait_many() +#define ZX_WAIT_MANY_MAX_ITEMS ((size_t)64) + +// Structure for zx_object_wait_many(): +typedef struct zx_wait_item { + zx_handle_t handle; + zx_signals_t waitfor; + zx_signals_t pending; +} zx_wait_item_t; + +// VM Object creation options +#define ZX_VMO_RESIZABLE ((uint32_t)1u << 1) + +// VM Object opcodes +#define ZX_VMO_OP_COMMIT ((uint32_t)1u) +#define ZX_VMO_OP_DECOMMIT ((uint32_t)2u) +#define ZX_VMO_OP_LOCK ((uint32_t)3u) +#define ZX_VMO_OP_UNLOCK ((uint32_t)4u) +// opcode 5 was ZX_VMO_OP_LOOKUP, but is now unused. +#define ZX_VMO_OP_CACHE_SYNC ((uint32_t)6u) +#define ZX_VMO_OP_CACHE_INVALIDATE ((uint32_t)7u) +#define ZX_VMO_OP_CACHE_CLEAN ((uint32_t)8u) +#define ZX_VMO_OP_CACHE_CLEAN_INVALIDATE ((uint32_t)9u) +#define ZX_VMO_OP_ZERO ((uint32_t)10u) + +// VM Object clone flags +#define ZX_VMO_CHILD_SNAPSHOT ((uint32_t)1u << 0) +#define ZX_VMO_CHILD_SNAPSHOT_AT_LEAST_ON_WRITE ((uint32_t)1u << 4) +#define ZX_VMO_CHILD_RESIZABLE ((uint32_t)1u << 2) +#define ZX_VMO_CHILD_SLICE ((uint32_t)1u << 3) +#define ZX_VMO_CHILD_NO_WRITE ((uint32_t)1u << 5) +// Old clone flags that are on the path to deprecation. +#define ZX_VMO_CLONE_COPY_ON_WRITE ((uint32_t)1u << 4) +#define ZX_VMO_CHILD_COPY_ON_WRITE ((uint32_t)1u << 4) +#define ZX_VMO_CHILD_PRIVATE_PAGER_COPY ((uint32_t)1u << 4) + +typedef uint32_t zx_vm_option_t; +// Mapping flags to vmar routines +#define ZX_VM_PERM_READ ((zx_vm_option_t)(1u << 0)) +#define ZX_VM_PERM_WRITE ((zx_vm_option_t)(1u << 1)) +#define ZX_VM_PERM_EXECUTE ((zx_vm_option_t)(1u << 2)) +#define ZX_VM_COMPACT ((zx_vm_option_t)(1u << 3)) +#define ZX_VM_SPECIFIC ((zx_vm_option_t)(1u << 4)) +#define ZX_VM_SPECIFIC_OVERWRITE ((zx_vm_option_t)(1u << 5)) +#define ZX_VM_CAN_MAP_SPECIFIC ((zx_vm_option_t)(1u << 6)) +#define ZX_VM_CAN_MAP_READ ((zx_vm_option_t)(1u << 7)) +#define ZX_VM_CAN_MAP_WRITE ((zx_vm_option_t)(1u << 8)) +#define ZX_VM_CAN_MAP_EXECUTE ((zx_vm_option_t)(1u << 9)) +#define ZX_VM_MAP_RANGE ((zx_vm_option_t)(1u << 10)) +#define ZX_VM_REQUIRE_NON_RESIZABLE ((zx_vm_option_t)(1u << 11)) +#define ZX_VM_ALLOW_FAULTS ((zx_vm_option_t)(1u << 12)) + +#define ZX_VM_ALIGN_BASE 24 +#define ZX_VM_ALIGN_1KB ((zx_vm_option_t)(10u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_2KB ((zx_vm_option_t)(11u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_4KB ((zx_vm_option_t)(12u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_8KB ((zx_vm_option_t)(13u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_16KB ((zx_vm_option_t)(14u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_32KB ((zx_vm_option_t)(15u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_64KB ((zx_vm_option_t)(16u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_128KB ((zx_vm_option_t)(17u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_256KB ((zx_vm_option_t)(18u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_512KB ((zx_vm_option_t)(19u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_1MB ((zx_vm_option_t)(20u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_2MB ((zx_vm_option_t)(21u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_4MB ((zx_vm_option_t)(22u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_8MB ((zx_vm_option_t)(23u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_16MB ((zx_vm_option_t)(24u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_32MB ((zx_vm_option_t)(25u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_64MB ((zx_vm_option_t)(26u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_128MB ((zx_vm_option_t)(27u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_256MB ((zx_vm_option_t)(28u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_512MB ((zx_vm_option_t)(29u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_1GB ((zx_vm_option_t)(30u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_2GB ((zx_vm_option_t)(31u << ZX_VM_ALIGN_BASE)) +#define ZX_VM_ALIGN_4GB ((zx_vm_option_t)(32u << ZX_VM_ALIGN_BASE)) + +// virtual address +typedef uintptr_t zx_vaddr_t; + +// physical address +typedef uintptr_t zx_paddr_t; +// low mem physical address +typedef uint32_t zx_paddr32_t; +// Hypervisor guest physical addresses. +typedef uintptr_t zx_gpaddr_t; + +// offset +typedef uint64_t zx_off_t; + +// vectorized I/O +typedef struct zx_iovec { + void* buffer; + size_t capacity; +} zx_iovec_t; + +// Maximum string length for kernel names (process name, thread name, etc) +#define ZX_MAX_NAME_LEN ((size_t)32u) + +// Buffer size limits on the cprng syscalls +#define ZX_CPRNG_DRAW_MAX_LEN ((size_t)256u) +#define ZX_CPRNG_ADD_ENTROPY_MAX_LEN ((size_t)256u) + +// interrupt_create flags +#define ZX_INTERRUPT_REMAP_IRQ ((uint32_t)0x1u) +#define ZX_INTERRUPT_MODE_DEFAULT ((uint32_t)0u << 1) +#define ZX_INTERRUPT_MODE_EDGE_LOW ((uint32_t)1u << 1) +#define ZX_INTERRUPT_MODE_EDGE_HIGH ((uint32_t)2u << 1) +#define ZX_INTERRUPT_MODE_LEVEL_LOW ((uint32_t)3u << 1) +#define ZX_INTERRUPT_MODE_LEVEL_HIGH ((uint32_t)4u << 1) +#define ZX_INTERRUPT_MODE_EDGE_BOTH ((uint32_t)5u << 1) +#define ZX_INTERRUPT_MODE_MASK ((uint32_t)0xe) +#define ZX_INTERRUPT_VIRTUAL ((uint32_t)0x10) + +// interrupt_bind flags +#define ZX_INTERRUPT_BIND ((uint32_t)0x0u) +#define ZX_INTERRUPT_UNBIND ((uint32_t)0x1u) + +// Preallocated virtual interrupt slot, typically used for signaling interrupt threads to exit. +#define ZX_INTERRUPT_SLOT_USER ((uint32_t)62u) +// interrupt wait slots must be in the range 0 - 62 inclusive +#define ZX_INTERRUPT_MAX_SLOTS ((uint32_t)62u) + +// PCI interrupt handles use interrupt slot 0 for the PCI hardware interrupt +#define ZX_PCI_INTERRUPT_SLOT ((uint32_t)0u) + +// Channel options and limits. +#define ZX_CHANNEL_READ_MAY_DISCARD ((uint32_t)1u) + +#define ZX_CHANNEL_MAX_MSG_BYTES ((uint32_t)65536u) +#define ZX_CHANNEL_MAX_MSG_HANDLES ((uint32_t)64u) + +// Fifo limits. +#define ZX_FIFO_MAX_SIZE_BYTES ZX_PAGE_SIZE + +// Socket options and limits. +// These options can be passed to zx_socket_shutdown(). +#define ZX_SOCKET_SHUTDOWN_WRITE ((uint32_t)1u << 0) +#define ZX_SOCKET_SHUTDOWN_READ ((uint32_t)1u << 1) +#define ZX_SOCKET_SHUTDOWN_MASK (ZX_SOCKET_SHUTDOWN_WRITE | ZX_SOCKET_SHUTDOWN_READ) + +// These can be passed to zx_socket_create(). +#define ZX_SOCKET_STREAM ((uint32_t)0u) +#define ZX_SOCKET_DATAGRAM ((uint32_t)1u << 0) +#define ZX_SOCKET_CREATE_MASK (ZX_SOCKET_DATAGRAM) + +// These can be passed to zx_socket_read(). +#define ZX_SOCKET_PEEK ((uint32_t)1u << 3) + +// These can be passed to zx_stream_create(). +#define ZX_STREAM_MODE_READ ((uint32_t)1u << 0) +#define ZX_STREAM_MODE_WRITE ((uint32_t)1u << 1) +#define ZX_STREAM_CREATE_MASK (ZX_STREAM_MODE_READ | ZX_STREAM_MODE_WRITE) + +// These can be passed to zx_stream_writev(). +#define ZX_STREAM_APPEND ((uint32_t)1u << 0) + +typedef uint32_t zx_stream_seek_origin_t; +#define ZX_STREAM_SEEK_ORIGIN_START ((zx_stream_seek_origin_t)0u) +#define ZX_STREAM_SEEK_ORIGIN_CURRENT ((zx_stream_seek_origin_t)1u) +#define ZX_STREAM_SEEK_ORIGIN_END ((zx_stream_seek_origin_t)2u) + +// Flags which can be used to to control cache policy for APIs which map memory. +#define ZX_CACHE_POLICY_CACHED ((uint32_t)0u) +#define ZX_CACHE_POLICY_UNCACHED ((uint32_t)1u) +#define ZX_CACHE_POLICY_UNCACHED_DEVICE ((uint32_t)2u) +#define ZX_CACHE_POLICY_WRITE_COMBINING ((uint32_t)3u) +#define ZX_CACHE_POLICY_MASK ((uint32_t)3u) + +// Flag bits for zx_cache_flush. +#define ZX_CACHE_FLUSH_INSN ((uint32_t)1u << 0) +#define ZX_CACHE_FLUSH_DATA ((uint32_t)1u << 1) +#define ZX_CACHE_FLUSH_INVALIDATE ((uint32_t)1u << 2) + +// Timer options. +#define ZX_TIMER_SLACK_CENTER ((uint32_t)0u) +#define ZX_TIMER_SLACK_EARLY ((uint32_t)1u) +#define ZX_TIMER_SLACK_LATE ((uint32_t)2u) + +// Bus Transaction Initiator options. +#define ZX_BTI_PERM_READ ((uint32_t)1u << 0) +#define ZX_BTI_PERM_WRITE ((uint32_t)1u << 1) +#define ZX_BTI_PERM_EXECUTE ((uint32_t)1u << 2) +#define ZX_BTI_COMPRESS ((uint32_t)1u << 3) +#define ZX_BTI_CONTIGUOUS ((uint32_t)1u << 4) + +// Job options. +// These options can be passed to zx_job_set_critical(). +#define ZX_JOB_CRITICAL_PROCESS_RETCODE_NONZERO ((uint32_t)1u << 0) + +typedef uint32_t zx_obj_type_t; + +#define ZX_OBJ_TYPE_NONE ((zx_obj_type_t)0u) +#define ZX_OBJ_TYPE_PROCESS ((zx_obj_type_t)1u) +#define ZX_OBJ_TYPE_THREAD ((zx_obj_type_t)2u) +#define ZX_OBJ_TYPE_VMO ((zx_obj_type_t)3u) +#define ZX_OBJ_TYPE_CHANNEL ((zx_obj_type_t)4u) +#define ZX_OBJ_TYPE_EVENT ((zx_obj_type_t)5u) +#define ZX_OBJ_TYPE_PORT ((zx_obj_type_t)6u) +#define ZX_OBJ_TYPE_INTERRUPT ((zx_obj_type_t)9u) +#define ZX_OBJ_TYPE_PCI_DEVICE ((zx_obj_type_t)11u) +#define ZX_OBJ_TYPE_LOG ((zx_obj_type_t)12u) +#define ZX_OBJ_TYPE_SOCKET ((zx_obj_type_t)14u) +#define ZX_OBJ_TYPE_RESOURCE ((zx_obj_type_t)15u) +#define ZX_OBJ_TYPE_EVENTPAIR ((zx_obj_type_t)16u) +#define ZX_OBJ_TYPE_JOB ((zx_obj_type_t)17u) +#define ZX_OBJ_TYPE_VMAR ((zx_obj_type_t)18u) +#define ZX_OBJ_TYPE_FIFO ((zx_obj_type_t)19u) +#define ZX_OBJ_TYPE_GUEST ((zx_obj_type_t)20u) +#define ZX_OBJ_TYPE_VCPU ((zx_obj_type_t)21u) +#define ZX_OBJ_TYPE_TIMER ((zx_obj_type_t)22u) +#define ZX_OBJ_TYPE_IOMMU ((zx_obj_type_t)23u) +#define ZX_OBJ_TYPE_BTI ((zx_obj_type_t)24u) +#define ZX_OBJ_TYPE_PROFILE ((zx_obj_type_t)25u) +#define ZX_OBJ_TYPE_PMT ((zx_obj_type_t)26u) +#define ZX_OBJ_TYPE_SUSPEND_TOKEN ((zx_obj_type_t)27u) +#define ZX_OBJ_TYPE_PAGER ((zx_obj_type_t)28u) +#define ZX_OBJ_TYPE_EXCEPTION ((zx_obj_type_t)29u) +#define ZX_OBJ_TYPE_CLOCK ((zx_obj_type_t)30u) +#define ZX_OBJ_TYPE_STREAM ((zx_obj_type_t)31u) +#define ZX_OBJ_TYPE_MSI_ALLOCATION ((zx_obj_type_t)32u) +#define ZX_OBJ_TYPE_MSI_INTERRUPT ((zx_obj_type_t)33u) + +// System ABI commits to having no more than 64 object types. +// +// See zx_info_process_handle_stats_t for an example of a binary interface that +// depends on having an upper bound for the number of object types. +#define ZX_OBJ_TYPE_UPPER_BOUND ((zx_obj_type_t)64u) + +typedef uint32_t zx_system_event_type_t; +#define ZX_SYSTEM_EVENT_OUT_OF_MEMORY ((zx_system_event_type_t)1u) +#define ZX_SYSTEM_EVENT_MEMORY_PRESSURE_CRITICAL ((zx_system_event_type_t)2u) +#define ZX_SYSTEM_EVENT_MEMORY_PRESSURE_WARNING ((zx_system_event_type_t)3u) +#define ZX_SYSTEM_EVENT_MEMORY_PRESSURE_NORMAL ((zx_system_event_type_t)4u) + +// Used in channel_read_etc. +typedef struct zx_handle_info { + zx_handle_t handle; + zx_obj_type_t type; + zx_rights_t rights; + uint32_t unused; +} zx_handle_info_t; + +typedef uint32_t zx_handle_op_t; + +#define ZX_HANDLE_OP_MOVE ((zx_handle_op_t)0u) +#define ZX_HANDLE_OP_DUPLICATE ((zx_handle_op_t)1u) + +// Used in channel_write_etc. +typedef struct zx_handle_disposition { + zx_handle_op_t operation; + zx_handle_t handle; + zx_obj_type_t type; + zx_rights_t rights; + zx_status_t result; +} zx_handle_disposition_t; + +// Transaction ID and argument types for zx_channel_call. +typedef uint32_t zx_txid_t; + +typedef struct zx_channel_call_args { + const void* wr_bytes; + const zx_handle_t* wr_handles; + void *rd_bytes; + zx_handle_t* rd_handles; + uint32_t wr_num_bytes; + uint32_t wr_num_handles; + uint32_t rd_num_bytes; + uint32_t rd_num_handles; +} zx_channel_call_args_t; + +// The ZX_VM_FLAG_* constants are to be deprecated in favor of the ZX_VM_* +// versions. +#define ZX_VM_FLAG_PERM_READ ((uint32_t)1u << 0) +#define ZX_VM_FLAG_PERM_WRITE ((uint32_t)1u << 1) +#define ZX_VM_FLAG_PERM_EXECUTE ((uint32_t)1u << 2) +#define ZX_VM_FLAG_COMPACT ((uint32_t)1u << 3) +#define ZX_VM_FLAG_SPECIFIC ((uint32_t)1u << 4) +#define ZX_VM_FLAG_SPECIFIC_OVERWRITE ((uint32_t)1u << 5) +#define ZX_VM_FLAG_CAN_MAP_SPECIFIC ((uint32_t)1u << 6) +#define ZX_VM_FLAG_CAN_MAP_READ ((uint32_t)1u << 7) +#define ZX_VM_FLAG_CAN_MAP_WRITE ((uint32_t)1u << 8) +#define ZX_VM_FLAG_CAN_MAP_EXECUTE ((uint32_t)1u << 9) +#define ZX_VM_FLAG_MAP_RANGE ((uint32_t)1u << 10) +#define ZX_VM_FLAG_REQUIRE_NON_RESIZABLE ((uint32_t)1u << 11) + +// CPU masks specifying sets of CPUs. +// +// We currently are limited to systems with 512 CPUs or less. +#define ZX_CPU_SET_MAX_CPUS 512 +#define ZX_CPU_SET_BITS_PER_WORD 64 + +typedef struct zx_cpu_set { + // The |N|'th CPU is considered in the CPU set if the bit: + // + // cpu_mask[N / ZX_CPU_SET_BITS_PER_WORD] + // & (1 << (N % ZX_CPU_SET_BITS_PER_WORD)) + // + // is set. + uint64_t mask[ZX_CPU_SET_MAX_CPUS / ZX_CPU_SET_BITS_PER_WORD]; +} zx_cpu_set_t; + +#ifdef __cplusplus +// We cannot use <stdatomic.h> with C++ code as _Atomic qualifier defined by +// C11 is not valid in C++11. There is not a single standard name that can +// be used in both C and C++. C++ <atomic> defines names which are equivalent +// to those in <stdatomic.h>, but these are contained in the std namespace. +// +// In kernel, the only operation done is a user_copy (of sizeof(int)) inside a +// lock; otherwise the futex address is treated as a key. +typedef int zx_futex_t; +#else +#ifdef _KERNEL +typedef int zx_futex_t; +#else +typedef atomic_int zx_futex_t; +#endif +#endif +typedef int zx_futex_storage_t; + +__END_CDECLS + +#endif // SYSROOT_ZIRCON_TYPES_H_
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/Scrt1.o b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/Scrt1.o new file mode 100644 index 0000000..d33aff5 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/Scrt1.o Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libc.so b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libc.so new file mode 100755 index 0000000..19cfb6b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libc.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libdl.so b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libdl.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libdl.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libm.so b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libm.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libm.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libpthread.so b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libpthread.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libpthread.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/librt.so b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/librt.so new file mode 100644 index 0000000..f2072c3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/librt.so
@@ -0,0 +1,5 @@ +/* + * The APIs traditionally found in -lm, -ldl, or -lpthread are all implemented + * in libc.so, so this file just redirects the linker to refer there instead. + */ +INPUT(AS_NEEDED(libc.so))
diff --git a/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libzircon.so b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libzircon.so new file mode 100755 index 0000000..394ba86 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/sysroot/lib/libzircon.so Binary files differ
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/alias_workarounds.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/alias_workarounds.fidl new file mode 100644 index 0000000..bdcfc5f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/alias_workarounds.fidl
@@ -0,0 +1,100 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// These are all aliases that will be subsumed by the future implementation of +// templating, constraints, etc. in fidlc. +// +// The right hand side is completely ignored by kazoo, that is, only the name of +// the alias is significant. Generally the right hand side is set so that if +// there were no handling of the alias (and the alias was "expanded" as is the +// default behaviour), it would result in something sensible. + +// TODO(fidlc): (mutable) char* +using charptr = uint64; + +// TODO(fidl) +using const_futexptr = int32; + +// TODO(fidlc): const void* +using const_voidptr = uint64; + +// TODO(fidlc): mutable<string> +using mutable_string = string; + +// TODO(fidlc): mutable<uint32> +using mutable_uint32 = uint32; + +// TODO(fidlc): mutable<usize> +using mutable_usize = usize; + +// TODO(fidlc): uint32 size +// TODO(fidlc): mutable<vector<HandleDisposition> +using mutable_vector_HandleDisposition_u32size = vector<HandleDisposition>; + +// TODO(fidlc): mutable<vector<WaitItem>> +using mutable_vector_WaitItem = vector<WaitItem>; + +// TODO(fidlc): uint32 size +// TODO(fidlc): mutable<vector<handle> +using mutable_vector_handle_u32size = vector<handle>; + +// TODO(fidlc): mutable<vector<void>> +using mutable_vector_void = vector<byte>; + +// TODO(fidlc): uint32 size +// TODO(fidlc): mutable<vector<void>> +using mutable_vector_void_u32size = vector<byte>; + +// TODO(fidlc): optional<PciBar> +using optional_PciBar = PciBar; + +// TODO(fidlc): optional<PortPacket> +using optional_PortPacket = PortPacket; + +// TODO(fidlc): optional<koid> +using optional_koid = koid; + +// TODO(fidlc): optional<signals> +using optional_signals = signals; + +// TODO(fidlc): optional<time> +using optional_time = time; + +// TODO(fidlc): optional<uint32> +using optional_uint32 = uint32; + +// TODO(fidlc): optional<usize> +using optional_usize = usize; + +// TODO(fidlc): optional<usize> +using optional_off = off; + +// TODO(fidlc): uint32 size +// TODO(fidlc): vector<HandleInfo> +using vector_HandleInfo_u32size = vector<HandleInfo>; + +// TODO(fidlc): vector<handle> uint32 size +using vector_handle_u32size = vector<handle>; + +// TODO(fidlc): vector<paddr>> +using vector_paddr = vector<paddr>; + +// TODO(fidlc): vector<void> +using vector_void = vector<byte>; + +// TODO(fidlc): vector<iovec> +using vector_iovec = vector<byte>; + +// TODO(fidlc): uint32 size +// TODO(fidlc): vector<void> +using vector_void_u32size = vector<byte>; + +// TODO(fidlc): (mutable) void* +using voidptr = uint64; + +// This is <zircon/string_view.h>'s zx_string_view_t in C/C++. +using string_view = uint64;
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/bti.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/bti.fidl new file mode 100644 index 0000000..8ec1c08 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/bti.fidl
@@ -0,0 +1,32 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol bti { + /// Create a new bus transaction initiator. + /// Rights: iommu must be of type ZX_OBJ_TYPE_IOMMU and have ZX_RIGHT_NONE. + // TODO(ZX-2967): This is an unusual rights spec. + bti_create(handle<iommu> iommu, uint32 options, uint64 bti_id) -> (status status, handle<bti> out); + + /// Pin pages and grant devices access to them. + /// Rights: handle must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_MAP. + /// Rights: vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_MAP. + /// Rights: If options & ZX_BTI_PERM_READ, vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: If options & ZX_BTI_PERM_WRITE, vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If options & ZX_BTI_PERM_EXECUTE, vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + // READ is intentional in the EXECUTE condition. + bti_pin(handle<bti> handle, + uint32 options, + handle<vmo> vmo, + uint64 offset, + uint64 size) + -> (status status, vector_paddr addrs, handle<pmt> pmt); + + /// Releases all quarantined PMTs. + /// Rights: handle must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_WRITE. + bti_release_quarantine(handle<bti> handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/cache.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/cache.fidl new file mode 100644 index 0000000..f1f8567 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/cache.fidl
@@ -0,0 +1,13 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol cache { + /// Flush CPU data and/or instruction caches. + [vdsocall] + cache_flush(const_voidptr addr, usize size, uint32 options) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/channel.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/channel.fidl new file mode 100644 index 0000000..25c8ca3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/channel.fidl
@@ -0,0 +1,107 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +using ObjType = uint32; + +// TODO(scottmg): ZX_OBJ_TYPE_xyz here. + +using HandleOp = uint32; + +// TODO(scottmg): ZX_HANDLE_OP_xyz here. + +struct HandleInfo { + handle handle; + ObjType type; + rights rights; + uint32 unused; +}; + +struct ChannelCallArgs { + vector<byte> wr_bytes; + vector<handle> wr_handles; + // TODO(scottmg): mutable_vector_void + vector<byte> rd_bytes; + // TODO(scottmg): mutable_vector_handle + vector<handle> rd_handles; +}; + +struct HandleDisposition { + HandleOp operation; + handle handle; + ObjType type; + rights rights; + status result; +}; + +[Transport = "Syscall"] +protocol channel { + /// Create a channel. + channel_create(uint32 options) -> (status status, handle out0, handle out1); + + /// Read a message from a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ. + [ArgReorder = "handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles", + HandleUnchecked] + channel_read(handle<channel> handle, + uint32 options) + -> (status status, + vector_void_u32size bytes, + vector_handle_u32size handles, + optional_uint32 actual_bytes, + optional_uint32 actual_handles); + + /// Read a message from a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ. + [ArgReorder = "handle, options, bytes, handles, num_bytes, num_handles, actual_bytes, actual_handles"] + channel_read_etc(handle<channel> handle, + uint32 options) + -> (status status, + vector_void_u32size bytes, + vector_HandleInfo_u32size handles, + optional_uint32 actual_bytes, + optional_uint32 actual_handles); + + /// Write a message to a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_WRITE. + /// Rights: Every entry of handles must have ZX_RIGHT_TRANSFER. + channel_write(handle<channel> handle, + uint32 options, + vector_void_u32size bytes, + vector_handle_u32size handles) + -> (status status); + + /// Write a message to a channel. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_WRITE. + /// Rights: Every entry of handles must have ZX_RIGHT_TRANSFER. + channel_write_etc(handle<channel> handle, + uint32 options, + vector_void_u32size bytes, + mutable_vector_HandleDisposition_u32size handles) + -> (status status); + + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + /// Rights: All wr_handles of args must have ZX_RIGHT_TRANSFER. + [internal] + channel_call_noretry(handle<channel> handle, + uint32 options, + time deadline, + ChannelCallArgs args) + -> (status status, uint32 actual_bytes, uint32 actual_handles); + + [internal] + channel_call_finish(time deadline, ChannelCallArgs args) + -> (status status, uint32 actual_bytes, uint32 actual_handles); + + /// Send a message to a channel and await a reply. + /// Rights: handle must be of type ZX_OBJ_TYPE_CHANNEL and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + /// Rights: All wr_handles of args must have ZX_RIGHT_TRANSFER. + [blocking, + vdsocall] + // TODO(scottmg): Express "All wr_handles of args must have ZX_RIGHT_TRANSFER." + channel_call(handle handle, uint32 options, time deadline, ChannelCallArgs args) + -> (status status, uint32 actual_bytes, uint32 actual_handles); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/clock.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/clock.fidl new file mode 100644 index 0000000..5aecb3b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/clock.fidl
@@ -0,0 +1,51 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +enum Clock : uint32 { + MONOTONIC = 0; + UTC = 1; + THREAD = 2; +}; + +[Transport = "Syscall"] +protocol clock { + /// Acquire the current time. + clock_get(Clock clock_id) -> (status status, time out); + + /// Acquire the current monotonic time. + [vdsocall] + clock_get_monotonic() -> (time time); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + clock_adjust(handle<resource> handle, Clock clock_id, int64 offset) -> (status status); + + // Read clock monotonic, but demand that the read be performed using a + // syscall, instead of a vdso call. + // + // See the notes for ticks_get_via_kernel; this is not a syscall meant + // to be used by application code. + [internal] + clock_get_monotonic_via_kernel() -> (time time); + + // TODO: handle<clock> for all of these. + + /// Create a new clock object. + /// Rights: None. + clock_create(uint64 options, const_voidptr args) -> (status status, handle out); + + /// Perform a basic read of the clock. + /// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_READ. + clock_read(handle handle) -> (status status, time now); + + /// Fetch all of the low level details of the clock's current status. + /// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_READ. + clock_get_details(handle handle, uint64 options) -> (status status, voidptr details); + + /// Make adjustments to a clock object. + /// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_WRITE. + clock_update(handle handle, uint64 options, const_voidptr args) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/cprng.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/cprng.fidl new file mode 100644 index 0000000..7431bde --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/cprng.fidl
@@ -0,0 +1,19 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol cprng { + [internal] + cprng_draw_once() -> (status status, vector_void buffer); + + /// Draw from the kernel's CPRNG. + [vdsocall] + cprng_draw() -> (vector_void buffer); + + /// Add entropy to the kernel CPRNG. + cprng_add_entropy(vector_void buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/debug.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/debug.fidl new file mode 100644 index 0000000..e629799 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/debug.fidl
@@ -0,0 +1,17 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol debug { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + debug_read(handle<resource> handle) -> (status status, string buffer, usize actual); + + debug_write(string buffer) -> (status status); + + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + debug_send_command(handle<resource> resource, string buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/debuglog.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/debuglog.fidl new file mode 100644 index 0000000..23e1faf --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/debuglog.fidl
@@ -0,0 +1,20 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol debuglog { + // TODO(ZX-2967): handle == ZX_HANDLE_INVALID accepted. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + debuglog_create(handle<resource> resource, uint32 options) + -> (status status, handle<debuglog> out); + + /// Rights: handle must be of type ZX_OBJ_TYPE_LOG and have ZX_RIGHT_WRITE. + debuglog_write(handle<debuglog> handle, uint32 options, vector_void buffer) -> (status status); + + /// Rights: handle must be of type ZX_OBJ_TYPE_LOG and have ZX_RIGHT_READ. + debuglog_read(handle<debuglog> handle, uint32 options) -> (status status, vector_void buffer); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/event.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/event.fidl new file mode 100644 index 0000000..4f12cd8 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/event.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol event { + /// Create an event. + event_create(uint32 options) -> (status status, handle<event> out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/eventpair.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/eventpair.fidl new file mode 100644 index 0000000..a7a3e38 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/eventpair.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol eventpair { + /// Create an event pair. + eventpair_create(uint32 options) -> (status status, handle<event> out0, handle<event> out1); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/exception.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/exception.fidl new file mode 100644 index 0000000..db3e45a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/exception.fidl
@@ -0,0 +1,17 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol exception { + /// Create a handle for the exception's thread. + /// Rights: handle must be of type ZX_OBJ_TYPE_EXCEPTION. + exception_get_thread(handle<exception> handle) -> (status status, handle<thread> out); + + /// Create a handle for the exception's process. + /// Rights: handle must be of type ZX_OBJ_TYPE_EXCEPTION. + exception_get_process(handle<exception> handle) -> (status status, handle<process> out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/fifo.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/fifo.fidl new file mode 100644 index 0000000..0e9ee21 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/fifo.fidl
@@ -0,0 +1,23 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol fifo { + /// Create a fifo. + fifo_create(usize elem_count, usize elem_size, uint32 options) + -> (status status, handle<fifo> out0, handle<fifo> out1); + + /// Read data from a fifo. + /// Rights: handle must be of type ZX_OBJ_TYPE_FIFO and have ZX_RIGHT_READ. + fifo_read(handle<fifo> handle, usize elem_size) + -> (status status, vector_void data, optional_usize actual_count); + + /// Write data to a fifo. + /// Rights: handle must be of type ZX_OBJ_TYPE_FIFO and have ZX_RIGHT_WRITE. + fifo_write(handle<fifo> handle, usize elem_size, const_voidptr data, usize count) + -> (status status, optional_usize actual_count); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/framebuffer.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/framebuffer.fidl new file mode 100644 index 0000000..2ab69c7 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/framebuffer.fidl
@@ -0,0 +1,24 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol framebuffer { + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + framebuffer_get_info(handle<resource> resource) + -> (status status, uint32 format, uint32 width, uint32 height, uint32 stride); + + // TODO(ZX-2967): vmo ZX_OBJ_TYPE_VMO; No rights required? + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + framebuffer_set_range(handle<resource> resource, + handle<vmo> vmo, + uint32 len, + uint32 format, + uint32 width, + uint32 height, + uint32 stride) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/futex.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/futex.fidl new file mode 100644 index 0000000..69ab6dc --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/futex.fidl
@@ -0,0 +1,58 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): This is approximately right, but will need to match the +// current definition of zx_futex_t (atomic_int in some #if branches). +using Futex = int32; + +// TODO(scottmg): The futex is unusual in that by virtue of being an int, +// sometimes it's passed by pointer, and sometimes by value. + +[Transport = "Syscall"] +protocol futex { + /// Wait on a futex. + /// Rights: None. + [blocking] + futex_wait(const_futexptr value_ptr, Futex current_value, handle new_futex_owner, time deadline) + -> (status status); + + /// Wake some number of threads waiting on a futex, and set the ownership of the futex to nothing. + /// Rights: None. + futex_wake(const_futexptr value_ptr, uint32 wake_count) -> (status status); + + /// Wake some number of threads waiting on a futex, and move more waiters to another wait queue. + /// Rights: None. + futex_requeue(const_futexptr value_ptr, + uint32 wake_count, + Futex current_value, + const_futexptr requeue_ptr, + uint32 requeue_count, + handle new_requeue_owner) + -> (status status); + + /// Wake one thread waiting on a futex. If a thread is woken, + /// ownership of the futex is transferred to that thread. If no + /// thread is woken (because none are waiting), ownership of the + /// futex is set to none. + /// Rights: None. + futex_wake_single_owner(const_futexptr value_ptr) -> (status status); + + /// Wake one thread waiting on a futex, and move more waiters to + /// another wait queue. Ownership is transferred to the woken thread, + /// or cancelled, as with |futex_wake_single_owner|. + /// Rights: None. + futex_requeue_single_owner(const_futexptr value_ptr, + Futex current_value, + const_futexptr requeue_ptr, + uint32 requeue_count, + handle new_requeue_owner) + -> (status status); + + /// Fetch the koid current owner of a futex, if any. + /// Rights: None. + futex_get_owner(const_futexptr value_ptr) -> (status status, optional_koid koid); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/guest.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/guest.fidl new file mode 100644 index 0000000..a75093e --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/guest.fidl
@@ -0,0 +1,25 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol guest { + /// Create a guest. + /// Rights: resource must have resource kind ZX_RSRC_KIND_HYPERVISOR. + guest_create(handle<resource> resource, uint32 options) + -> (status status, handle<guest> guest_handle, handle<vmar> vmar_handle); + + /// Sets a trap within a guest. + /// Rights: handle must be of type ZX_OBJ_TYPE_GUEST and have ZX_RIGHT_WRITE. + /// Rights: port_handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + guest_set_trap(handle<guest> handle, + uint32 kind, + vaddr addr, + usize size, + handle<port> port_handle, + uint64 key) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/handle.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/handle.fidl new file mode 100644 index 0000000..b29842b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/handle.fidl
@@ -0,0 +1,25 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol handle { + /// Close a handle. + /// Rights: None. + handle_close([Release] handle handle) -> (status status); + + /// Close a number of handles. + /// Rights: None. + handle_close_many([Release] vector<handle> handles) -> (status status); + + /// Duplicate a handle. + /// Rights: handle must have ZX_RIGHT_DUPLICATE. + handle_duplicate(handle handle, rights rights) -> (status status, handle out); + + /// Replace a handle. + /// Rights: None. + handle_replace([Release] handle handle, rights rights) -> (status status, handle out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/interrupt.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/interrupt.fidl new file mode 100644 index 0000000..506df65 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/interrupt.fidl
@@ -0,0 +1,43 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol interrupt { + /// Create an interrupt object. + /// Rights: src_obj must have resource kind ZX_RSRC_KIND_IRQ. + interrupt_create(handle<resource> src_obj, uint32 src_num, uint32 options) + -> (status status, handle<interrupt> out_handle); + + /// Bind an interrupt object to a port. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_READ. + /// Rights: port_handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + interrupt_bind(handle<interrupt> handle, handle<port> port_handle, uint64 key, uint32 options) + -> (status status); + + /// Wait for an interrupt. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_WAIT. + [blocking] + interrupt_wait(handle<interrupt> handle) -> (status status, optional_time out_timestamp); + + // TODO(ZX-2967): No DESTROY rights here. + /// Destroys an interrupt object. + interrupt_destroy(handle<interrupt> handle) -> (status status); + + /// Acknowledge an interrupt and re-arm it. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_WRITE. + interrupt_ack(handle<interrupt> handle) -> (status status); + + /// Triggers a virtual interrupt object. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_SIGNAL. + interrupt_trigger(handle<interrupt> handle, uint32 options, time timestamp) -> (status status); + + /// Bind an interrupt object to a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_INTERRUPT and have ZX_RIGHT_READ. + /// Rights: vcpu must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_WRITE. + interrupt_bind_vcpu(handle<interrupt> handle, handle<vcpu> vcpu, uint32 options) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/iommu.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/iommu.fidl new file mode 100644 index 0000000..84ac2a9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/iommu.fidl
@@ -0,0 +1,14 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol iommu { + /// Create a new IOMMU object in the kernel. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + iommu_create(handle<resource> resource, uint32 type, vector_void desc) + -> (status status, handle<iommu> out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/ioports.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/ioports.fidl new file mode 100644 index 0000000..72353d3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/ioports.fidl
@@ -0,0 +1,15 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol ioports { + /// Rights: resource must have resource kind ZX_RSRC_KIND_IOPORT. + ioports_request(handle<resource> resource, uint16 io_addr, uint32 len) -> (status status); + + /// Rights: resource must have resource kind ZX_RSRC_KIND_IOPORT. + ioports_release(handle<resource> resource, uint16 io_addr, uint32 len) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/job.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/job.fidl new file mode 100644 index 0000000..edbdd2c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/job.fidl
@@ -0,0 +1,24 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol job { + // TODO(ZX-2967): parent_job with ZX_RIGHT_WRITE is also accepted. + /// Create a new job. + /// Rights: parent_job must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_MANAGE_JOB. + job_create(handle<job> parent_job, uint32 options) -> (status status, handle<job> out); + + /// Set job security and resource policies. + /// Rights: handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_SET_POLICY. + job_set_policy(handle<job> handle, uint32 options, uint32 topic, vector_void_u32size policy) + -> (status status); + + /// Set a process as critical to a job. + /// Rights: job must have ZX_RIGHT_DESTROY. + /// Rights: process must have ZX_RIGHT_WAIT. + job_set_critical(handle<job> job, uint32 options, handle<process> process) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/ktrace.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/ktrace.fidl new file mode 100644 index 0000000..d3234e6 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/ktrace.fidl
@@ -0,0 +1,26 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol ktrace { + // TODO(scottmg): This is another one where it's: + // (handle, data, offset, data_size) + // rather than: + // (handle, data, data_size, offset). + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + [ArgReorder = "handle, data, offset, data_size, actual"] + ktrace_read(handle<resource> handle, uint32 offset) + -> (status status, vector_void data, usize actual); + + // TODO(scottmg): syscalls.banjo had the length of |ptr| being |action|? + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + ktrace_control(handle<resource> handle, uint32 action, uint32 options, voidptr ptr) + -> (status status); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + ktrace_write(handle<resource> handle, uint32 id, uint32 arg0, uint32 arg1) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/misc.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/misc.fidl new file mode 100644 index 0000000..6c0e4c4 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/misc.fidl
@@ -0,0 +1,57 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): These syscalls don't match the general naming convention of +// zx_something_name(), they're just zx_name(), so NoProtocolPrefix tells the +// generator to exclude putting "Misc" in the name. +[Transport = "Syscall", +NoProtocolPrefix] +protocol misc { + /// High resolution sleep. + /// Rights: None. + [blocking] + nanosleep(time deadline) -> (status status); + + /// Read the number of high-precision timer ticks since boot. + [vdsocall] + ticks_get() -> (ticks ticks); + + /// Read the number of high-precision timer ticks in a second. + [const, + vdsocall] + ticks_per_second() -> (ticks ticks); + + /// Convert a time relative to now to an absolute deadline. + [vdsocall] + deadline_after(duration nanoseconds) -> (time time); + + /// Unmap memory, close handle, exit. + [vdsocall] + vmar_unmap_handle_close_thread_exit(handle<vmar> vmar_handle, + vaddr addr, usize size, + [Release] handle close_handle) + -> (status status); + + /// Write to futex, wake futex, close handle, exit. + [noreturn, + vdsocall] + futex_wake_handle_close_thread_exit(const_futexptr value_ptr, + uint32 wake_count, + int32 new_value, + [Release] handle close_handle); + + // Read the number of high-precision timer ticks since boot, but demand + // that the read be performed using a syscall, instead of a vdso call. + // + // Note that this is an internal syscall, not meant to be used by + // application code. By default, the vdso version of this syscall will do + // the proper thing, either directly reading from the hardware register + // backing the tick counter, or by making a syscall if the register is not + // accessible from user mode code (for whatever reason). + [internal] + ticks_get_via_kernel() -> (ticks ticks); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/mtrace.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/mtrace.fidl new file mode 100644 index 0000000..f3c1f1c --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/mtrace.fidl
@@ -0,0 +1,17 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol mtrace { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + mtrace_control(handle<resource> handle, + uint32 kind, + uint32 action, + uint32 options, + mutable_vector_void ptr) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/object.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/object.fidl new file mode 100644 index 0000000..f510fec --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/object.fidl
@@ -0,0 +1,95 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): Apply rights spec from WaitMany on |items| to |handle| here, +// somehow. +struct WaitItem { + handle handle; + signals waitfor; + signals pending; +}; + +[Transport = "Syscall"] +protocol object { + /// Wait for signals on an object. + /// Rights: handle must have ZX_RIGHT_WAIT. + [blocking] + object_wait_one(handle handle, signals signals, time deadline) + -> (status status, optional_signals observed); + + /// Wait for signals on multiple objects. + /// Rights: Every entry of items must have a handle field with ZX_RIGHT_WAIT. + [blocking] + object_wait_many(mutable_vector_WaitItem items, time deadline) -> (status status); + + /// Subscribe for signals on an object. + /// Rights: handle must have ZX_RIGHT_WAIT. + /// Rights: port must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + object_wait_async(handle handle, handle<port> port, uint64 key, signals signals, uint32 options) + -> (status status); + + /// Signal an object. + /// Rights: handle must have ZX_RIGHT_SIGNAL. + object_signal(handle handle, uint32 clear_mask, uint32 set_mask) -> (status status); + + /// Signal an object's peer. + /// Rights: handle must have ZX_RIGHT_SIGNAL_PEER. + object_signal_peer(handle handle, uint32 clear_mask, uint32 set_mask) -> (status status); + + /// Ask for various properties of various kernel objects. + /// Rights: handle must have ZX_RIGHT_GET_PROPERTY. + /// Rights: If property is ZX_PROP_PROCESS_DEBUG_ADDR, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_PROCESS_BREAK_ON_LOAD, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_PROCESS_VDSO_BASE_ADDRESS, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_SOCKET_RX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + /// Rights: If property is ZX_PROP_SOCKET_TX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + object_get_property(handle handle, uint32 property) -> (status status, vector_void value); + + /// Set various properties of various kernel objects. + /// Rights: handle must have ZX_RIGHT_SET_PROPERTY. + /// Rights: If property is ZX_PROP_PROCESS_DEBUG_ADDR, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_PROCESS_BREAK_ON_LOAD, handle must be of type ZX_OBJ_TYPE_PROCESS. + /// Rights: If property is ZX_PROP_SOCKET_RX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + /// Rights: If property is ZX_PROP_SOCKET_TX_THRESHOLD, handle must be of type ZX_OBJ_TYPE_SOCKET. + /// Rights: If property is ZX_PROP_JOB_KILL_ON_OOM, handle must be of type ZX_OBJ_TYPE_JOB. + object_set_property(handle handle, uint32 property, vector_void value) -> (status status); + + /// Query information about an object. + /// Rights: If topic is ZX_INFO_PROCESS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_JOB, handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_THREADS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_ENUMERATE. + /// Rights: If topic is ZX_INFO_JOB_CHILDREN, handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_ENUMERATE. + /// Rights: If topic is ZX_INFO_JOB_PROCESSES, handle must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_ENUMERATE. + /// Rights: If topic is ZX_INFO_THREAD, handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_THREAD_EXCEPTION_REPORT, handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_THREAD_STATS, handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_TASK_STATS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_MAPS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_VMOS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_VMO, handle must be of type ZX_OBJ_TYPE_VMO. + /// TODO(ZX-2967), Should this require INSPECT? + /// Rights: If topic is ZX_INFO_VMAR, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_CPU_STATS, handle must have resource kind ZX_RSRC_KIND_ROOT. + /// Rights: If topic is ZX_INFO_KMEM_STATS, handle must have resource kind ZX_RSRC_KIND_ROOT. + /// Rights: If topic is ZX_INFO_RESOURCE, handle must be of type ZX_OBJ_TYPE_RESOURCE and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_HANDLE_COUNT, handle must have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_BTI, handle must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_PROCESS_HANDLE_STATS, handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_INSPECT. + /// Rights: If topic is ZX_INFO_SOCKET, handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_INSPECT. + object_get_info(handle handle, uint32 topic) + -> (status status, vector_void buffer, optional_usize actual, optional_usize avail); + + /// Given a kernel object with children objects, obtain a handle to the child specified by the provided kernel object id. + /// Rights: handle must have ZX_RIGHT_ENUMERATE. + object_get_child(handle handle, uint64 koid, rights rights) -> (status status, handle out); + + /// Apply a scheduling profile to a thread. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_MANAGE_THREAD. + /// Rights: profile must be of type ZX_OBJ_TYPE_PROFILE and have ZX_RIGHT_APPLY_PROFILE. + object_set_profile(handle<thread> handle, handle<profile> profile, uint32 options) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/pager.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/pager.fidl new file mode 100644 index 0000000..6c7c581 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/pager.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol pager { + /// Create a new pager object. + /// Rights: None. + pager_create(uint32 options) -> (status status, handle<pager> out); + + /// Create a pager owned vmo. + /// Rights: pager must be of type ZX_OBJ_TYPE_PAGER. + /// Rights: port must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + pager_create_vmo(handle<pager> pager, uint32 options, handle<port> port, uint64 key, uint64 size) + -> (status status, handle<vmo> out); + + /// Detaches a vmo from a pager. + /// Rights: pager must be of type ZX_OBJ_TYPE_PAGER. + /// Rights: vmo must be of type ZX_OBJ_TYPE_VMO. + pager_detach_vmo(handle<pager> pager, handle<vmo> vmo) -> (status status); + + /// Supply pages into a pager owned vmo. + /// Rights: pager must be of type ZX_OBJ_TYPE_PAGER. + /// Rights: pager_vmo must be of type ZX_OBJ_TYPE_VMO. + /// Rights: aux_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pager_supply_pages(handle<pager> pager, + handle<vmo> pager_vmo, + uint64 offset, + uint64 length, + handle<vmo> aux_vmo, + uint64 aux_offset) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/pc.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/pc.fidl new file mode 100644 index 0000000..cb10baa --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/pc.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol pc { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pc_firmware_tables(handle<resource> handle) -> (status status, paddr acpi_rsdp, paddr smbios); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/pci.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/pci.fidl new file mode 100644 index 0000000..d5c80db --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/pci.fidl
@@ -0,0 +1,127 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(cja): This makes some assumptions that anything in an arch's PIO region +// is going to be defined as a base address and size. This will need to be +// updated to a per-platform structure in the event that doesn't pan out +// in the future. +struct PciBar { + uint32 id; + uint32 type; + usize size; + // TODO(scottmg): Unnamed union. + //union { + // uintptr_t addr; + // zx_handle_t handle; + //}; +}; + +// Defines and structures related to zx_pci_*() +// Info returned to dev manager for PCIe devices when probing. +struct PcieDeviceInfo { + uint16 vendor_id; + uint16 device_id; + + uint8 base_class; + uint8 sub_class; + uint8 program_interface; + uint8 revision_id; + + uint8 bus_id; + uint8 dev_id; + uint8 func_id; +}; + +// TODO(scottmg): Lots of constants here. + +// TODO(scottmg): This one is hard. +struct PciInitArg { + // TODO(scottmg): [][][] array. + // zx_pci_irq_swizzle_lut_t dev_pin_to_global_irq; + + uint32 num_irqs; + //struct { + // uint32_t global_irq; + // bool level_triggered; + // bool active_high; + //} irqs[ZX_PCI_MAX_IRQS]; + + uint32 addr_window_count; + // TODO(scottmg): struct-hack sized. + //struct { + // uint64_t base; + // size_t size; + // uint8_t bus_start; + // uint8_t bus_end; + // uint8_t cfg_space_type; + // bool has_ecam; + //} addr_windows[]; +}; + +[Transport = "Syscall"] +protocol pci { + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_get_nth_device(handle<resource> handle, uint32 index) + -> (status status, PcieDeviceInfo out_info, handle out_handle); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_WRITE. + pci_enable_bus_master(handle<pcidevice> handle, bool enable) -> (status status); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_WRITE. + pci_reset_device(handle<pcidevice> handle) -> (status status); + + // TODO(scottmg): In banjo/abigen out_val wasn't optional, but was an input + // OUT, so didn't get the __NONNULL() tag, so we match by making it optional + // here. I think this is probably not the intention, and it should be + // non-optional. + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pci_config_read(handle<pcidevice> handle, uint16 offset, usize width) + -> (status status, optional_uint32 out_val); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pci_config_write(handle<pcidevice> handle, uint16 offset, usize width, uint32 val) + -> (status status); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_cfg_pio_rw(handle<resource> handle, + uint8 bus, + uint8 dev, + uint8 func, + uint8 offset, + mutable_uint32 val, + usize width, + bool write) + -> (status status); + + // TODO(scottmg): type of out_handle? + // TODO(scottmg): In banjo/abigen out_bar wasn't optional, but was an input + // OUT, so has no __NONNULL(). I think this is probably not the intention. + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + pci_get_bar(handle<pcidevice> handle, uint32 bar_num) + -> (status status, optional_PciBar out_bar, handle out_handle); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ. + pci_map_interrupt(handle<pcidevice> handle, int32 which_irq) + -> (status status, handle out_handle); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_READ. + pci_query_irq_mode(handle<pcidevice> handle, uint32 mode) + -> (status status, uint32 out_max_irqs); + + /// Rights: handle must be of type ZX_OBJ_TYPE_PCI_DEVICE and have ZX_RIGHT_WRITE. + pci_set_irq_mode(handle<pcidevice> handle, uint32 mode, uint32 requested_irq_count) + -> (status status); + + // Note that init_buf isn't a vector of PciInitArg, it's a variable sized + // structure starting with a zx_pci_init_arg_t. + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_init(handle<resource> handle, PciInitArg init_buf, uint32 len) -> (status status); + + /// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT. + pci_add_subtract_io_range(handle<resource> handle, bool mmio, uint64 base, uint64 len, bool add) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/pmt.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/pmt.fidl new file mode 100644 index 0000000..0e37311 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/pmt.fidl
@@ -0,0 +1,13 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol pmt { + // TODO(ZX-2967): handle ZX_OBJ_TYPE_PMT; No rights required? + /// Unpin pages and revoke device access to them. + pmt_unpin(handle<pmt> handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/port.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/port.fidl new file mode 100644 index 0000000..b07fb7b --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/port.fidl
@@ -0,0 +1,146 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// port_packet_t::type ZX_PKT_TYPE_USER. +union PacketUser { + 1: array<uint64>:4 u64; + 2: array<uint32>:8 u32; + 3: array<uint16>:16 u16; + 4: array<int8>:32 c8; +}; + +// port_packet_t::type ZX_PKT_TYPE_SIGNAL_ONE. +struct PacketSignal { + signals trigger; + signals observed; + uint64 count; + uint64 reserved0; + uint64 reserved1; +}; + +struct PacketException { + uint64 pid; + uint64 tid; + uint64 reserved0; + uint64 reserved1; +}; + +struct PacketGuestBell { + gpaddr addr; + uint64 reserved0; + uint64 reserved1; + uint64 reserved2; +}; + +// TODO(scottmg): Arch-specific definition. +struct PacketGuestMem { + gpaddr addr; + //#if __aarch64__ + //uint8_t access_size; + //bool sign_extend; + //uint8_t xt; + //bool read; + //uint64_t data; + //uint64_t reserved; + //#elif __x86_64__ + //// NOTE: x86 instructions are guaranteed to be 15 bytes or fewer. + //#define X86_MAX_INST_LEN 15u + //uint8_t inst_len; + //uint8_t inst_buf[X86_MAX_INST_LEN]; + //// This is the default operand size as determined by the CS and EFER register (Volume 3, + //// Section 5.2.1). If operating in 64-bit mode then near branches and all instructions, except + //// far branches, that implicitly reference the RSP will actually have a default operand size of + //// 64-bits (Volume 2, Section 2.2.1.7), and not the 32-bits that will be given here. + //uint8_t default_operand_size; + //uint8_t reserved[7]; + //#endif +}; + +struct PacketGuestIo { + uint16 port; + uint8 access_size; + bool input; + // TODO(scottmg): Unnamed union. + //union { + // uint8_t u8; + // uint16_t u16; + // uint32_t u32; + // uint8_t data[4]; + //}; + uint64 reserved0; + uint64 reserved1; + uint64 reserved2; +}; + +struct PacketGuestVcpu { + // TODO(scottmg): Unnamed union. + //union { + // struct { + // uint64_t mask; + // uint8_t vector; + // } interrupt; + // struct { + // uint64_t id; + // zx_gpaddr_t entry; + // } startup; + //}; + uint8 type; + uint64 reserved; +}; + +struct PacketInterrupt { + time timestamp; + uint64 reserved0; + uint64 reserved1; + uint64 reserved2; +}; + +struct PacketPageRequest { + uint16 command; + uint16 flags; + uint32 reserved0; + uint64 offset; + uint64 length; + uint64 reserved1; +}; + +struct PortPacket { + uint64 key; + uint32 type; + status status; + // TODO(scottmg): Unnamed union. + // union { + PacketUser user; + PacketSignal signal; + PacketException exception; + PacketGuestBell guest_bell; + PacketGuestMem guest_mem; + PacketGuestIo guest_io; + PacketGuestVcpu guest_vcpu; + PacketInterrupt interrupt; + PacketPageRequest page_request; + // }; +}; + +[Transport = "Syscall"] +protocol port { + /// Create an IO port. + port_create(uint32 options) -> (status status, handle<port> out); + + /// Queue a packet to a port. + /// Rights: handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + port_queue(handle<port> handle, PortPacket packet) -> (status status); + + /// Wait for a packet arrival in a port. + /// Rights: handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_READ. + [blocking] + port_wait(handle<port> handle, time deadline) -> (status status, optional_PortPacket packet); + + /// Cancels async port notifications on an object. + /// Rights: handle must be of type ZX_OBJ_TYPE_PORT and have ZX_RIGHT_WRITE. + port_cancel(handle<port> handle, handle source, uint64 key) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/process.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/process.fidl new file mode 100644 index 0000000..b9c3eb3 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/process.fidl
@@ -0,0 +1,38 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol process { + /// Exits the currently running process. + [noreturn] + process_exit(int64 retcode); + + // TODO(ZX-2967): job with ZX_RIGHT_WRITE is also accepted. + /// Create a new process. + /// Rights: job must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_MANAGE_PROCESS. + process_create(handle<job> job, string name, uint32 options) + -> (status status, handle<process> proc_handle, handle<vmar> vmar_handle); + + /// Start execution on a process. + /// Rights: handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + /// Rights: thread must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_WRITE. + /// Rights: arg1 must have ZX_RIGHT_TRANSFER. + process_start(handle<process> handle, handle<thread> thread, + vaddr entry, vaddr stack, + handle arg1, uintptr arg2) + -> (status status); + + /// Read from the given process's address space. + /// Rights: handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_READ and have ZX_RIGHT_WRITE. + process_read_memory(handle<process> handle, vaddr vaddr) + -> (status status, vector_void buffer, usize actual); + + /// Write into the given process's address space. + /// Rights: handle must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + process_write_memory(handle<process> handle, vaddr vaddr, vector_void buffer) + -> (status status, usize actual); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/profile.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/profile.fidl new file mode 100644 index 0000000..c808f4d --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/profile.fidl
@@ -0,0 +1,43 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +enum ProfileInfoType { + ZX_PROFILE_INFO_SCHEDULER = 1; +}; + +union ProfileScheduler { + 1: int32 priority; + 2: uint32 boost; + 3: uint32 deboost; + 4: uint32 quantum; +}; + +const int32 ZX_PRIORITY_LOWEST = 0; +const int32 ZX_PRIORITY_LOW = 8; +const int32 ZX_PRIORITY_DEFAULT = 16; +const int32 ZX_PRIORITY_HIGH = 24; +const int32 ZX_PRIORITY_HIGHEST = 31; + +union ProfileInfoData { + 1: ProfileScheduler scheduler; +}; + +struct ProfileInfo { + ProfileInfoType type; + // TODO(scottmg): This needs to be presented as an unnamed union in C, and + // ProfileInfoData doesn't really need a name. Not sure if the semantics of + // fidl unions make sense here. + ProfileInfoData unnamed; +}; + +[Transport = "Syscall"] +protocol profile { + /// Create a scheduler profile. + /// Rights: root_job must be of type ZX_OBJ_TYPE_JOB and have ZX_RIGHT_MANAGE_PROCESS. + profile_create(handle<job> root_job, uint32 options, ProfileInfo profile) + -> (status status, handle<profile> out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/resource.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/resource.fidl new file mode 100644 index 0000000..1854504 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/resource.fidl
@@ -0,0 +1,18 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol resource { + /// Create a resource object. + /// Rights: parent_rsrc must be of type ZX_OBJ_TYPE_RESOURCE and have ZX_RIGHT_WRITE. + resource_create(handle<resource> parent_rsrc, + uint32 options, + uint64 base, + usize size, + string name) + -> (status status, handle<resource> resource_out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/rights.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/rights.fidl new file mode 100644 index 0000000..69ba88f --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/rights.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): (1 << 4) notation or something else for bits would be nice. +bits rights : uint32 { + // TODO(scottmg): "bits members must be powers of two" + // NONE = 0x00000000; + DUPLICATE = 0x00000001; + TRANSFER = 0x00000002; + READ = 0x00000004; + WRITE = 0x00000008; + EXECUTE = 0x00000010; + MAP = 0x00000020; + GET_PROPERTY = 0x00000040; + SET_PROPERTY = 0x00000080; + ENUMERATE = 0x00000100; + DESTROY = 0x00000200; + SET_POLICY = 0x00000400; + GET_POLICY = 0x00000800; + SIGNAL = 0x00001000; + SIGNAL_PEER = 0x00002000; + WAIT = 0x00004000; + INSPECT = 0x00008000; + MANAGE_JOB = 0x00010000; + MANAGE_PROCESS = 0x00020000; + MANAGE_THREAD = 0x00040000; + APPLY_PROFILE = 0x00080000; + SAME_RIGHTS = 0x80000000; + + // TODO(scottmg): Derived settings using |, &, ~, e.g.: + // BASIC = (TRANSFER | DUPLICATE | WAIT | INSPECT); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/smc.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/smc.fidl new file mode 100644 index 0000000..b039311 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/smc.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +// TODO(scottmg): ARM_SMC_xyz. + +struct SmcParameters { + uint32 func_id; + uint64 arg1; + uint64 arg2; + uint64 arg3; + uint64 arg4; + uint64 arg5; + uint64 arg6; + uint16 client_id; + uint16 secure_os_id; +}; + +struct SmcResult { + uint64 arg0; + uint64 arg1; + uint64 arg2; + uint64 arg3; + uint64 arg6; // at least one implementation uses it as a way to return session_id. +}; + +[Transport = "Syscall"] +protocol smc { + // TODO(ZX-2967): handle No rights required? + // TODO(scottmg): No handle type? + /// Make Secure Monitor Call (SMC) from user space. + smc_call(handle handle, SmcParameters parameters) -> (status status, SmcResult out_smc_result); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/socket.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/socket.fidl new file mode 100644 index 0000000..00f7159 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/socket.fidl
@@ -0,0 +1,26 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol socket { + /// Create a socket. + socket_create(uint32 options) -> (status status, handle out0, handle out1); + + /// Write data to a socket. + /// Rights: handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_WRITE. + socket_write(handle<socket> handle, uint32 options, vector_void buffer) + -> (status status, optional_usize actual); + + /// Read data from a socket. + /// Rights: handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_READ. + socket_read(handle<socket> handle, uint32 options) + -> (status status, vector_void buffer, optional_usize actual); + + /// Prevent reading or writing. + /// Rights: handle must be of type ZX_OBJ_TYPE_SOCKET and have ZX_RIGHT_WRITE. + socket_shutdown(handle<socket> handle, uint32 options) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/stream.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/stream.fidl new file mode 100644 index 0000000..cf6cdbd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/stream.fidl
@@ -0,0 +1,44 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +enum stream_seek_origin : uint32 { + START = 0; + CURRENT = 1; + END = 2; +}; + +[Transport = "Syscall"] +protocol stream { + /// Create a stream from a VMO. + stream_create(uint32 options, handle<vmo> vmo, off seek) + -> (status status, handle<stream> out_stream); + + /// Write data to a stream at the current seek offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_WRITE. + stream_writev(handle<stream> handle, uint32 options, vector_iovec vector) + -> (status status, optional_usize actual); + + /// Write data to a stream at the given offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_WRITE. + stream_writev_at(handle<stream> handle, uint32 options, off offset, vector_iovec vector) + -> (status status, optional_usize actual); + + /// Read data from a stream at the current seek offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_READ. + stream_readv(handle<stream> handle, uint32 options) + -> (status status, vector_iovec vector, optional_usize actual); + + /// Read data from a stream at the given offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_READ. + stream_readv_at(handle<stream> handle, uint32 options, off offset) + -> (status status, vector_iovec vector, optional_usize actual); + + /// Modify the seek offset. + /// Rights: handle must be of type ZX_OBJ_TYPE_STREAM and have ZX_RIGHT_READ or have ZX_RIGHT_WRITE. + stream_seek(handle<stream> handle, stream_seek_origin whence, int64 offset) + -> (status status, optional_off out_seek); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/syscall.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/syscall.fidl new file mode 100644 index 0000000..06e5683 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/syscall.fidl
@@ -0,0 +1,46 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol syscall { + [testonly] + syscall_test_0() -> (status status); + + [testonly, + test_category1] + syscall_test_1(int32 a) -> (status status); + + [testonly, + test_category1] + syscall_test_2(int32 a, int32 b) -> (status status); + + [testonly, + test_category2] + syscall_test_3(int32 a, int32 b, int32 c) -> (status status); + + [testonly] + syscall_test_4(int32 a, int32 b, int32 c, int32 d) -> (status status); + + [testonly] + syscall_test_5(int32 a, int32 b, int32 c, int32 d, int32 e) -> (status status); + + [testonly] + syscall_test_6(int32 a, int32 b, int32 c, int32 d, int32 e, int32 f) -> (status status); + + [testonly] + syscall_test_7(int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 g) -> (status status); + + [testonly] + syscall_test_8(int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 g, int32 h) + -> (status status); + + [testonly] + syscall_test_wrapper(int32 a, int32 b, int32 c) -> (status status); + + [testonly] + syscall_test_handle_create(status return_value) -> (status status, handle<event> out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/system.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/system.fidl new file mode 100644 index 0000000..12ada66 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/system.fidl
@@ -0,0 +1,65 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +struct SystemPowerctlArg { + // TODO(scottmg): More unnamed unions. + //union { + // struct { + // uint8_t target_s_state; // Value between 1 and 5 indicating which S-state + // uint8_t sleep_type_a; // Value from ACPI VM (SLP_TYPa) + // uint8_t sleep_type_b; // Value from ACPI VM (SLP_TYPb) + // } acpi_transition_s_state; + // struct { + // uint32_t power_limit; // PL1 value in milliwatts + // uint32_t time_window; // PL1 time window in microseconds + // uint8_t clamp; // PL1 clamping enable + // uint8_t enable; // PL1 enable + // } x86_power_limit; + //}; +}; + +[Transport = "Syscall"] +protocol system { + [const, vdsocall] + system_get_dcache_line_size() -> (uint32 size); + + /// Get number of logical processors on the system. + [const, vdsocall] + system_get_num_cpus() -> (uint32 count); + + /// Get version string for system. + [const, vdsocall] + system_get_version_string() -> (string_view version); + + /// Get amount of physical memory on the system. + [vdsocall] + system_get_physmem() -> (uint64 physmem); + + // TODO(scottmg): "features" has a features attribute. I'm not sure if/how it's used. + /// Get supported hardware capabilities. + [vdsocall] + system_get_features(uint32 kind) -> (status status, uint32 features); + + /// Retrieve a handle to a system event. + /// Rights: None. + system_get_event(handle<job> root_job, uint32 kind) -> (status status, handle<event> event); + + /// Soft reboot the system with a new kernel and bootimage. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + /// Rights: kernel_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: bootimage_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + system_mexec(handle<resource> resource, handle<vmo> kernel_vmo, handle<vmo> bootimage_vmo) + -> (status status); + + /// Return a ZBI containing ZBI entries necessary to boot this system. + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + system_mexec_payload_get(handle<resource> resource) -> (status status, vector_void buffer); + + /// Rights: resource must have resource kind ZX_RSRC_KIND_ROOT. + system_powerctl(handle<resource> resource, uint32 cmd, SystemPowerctlArg arg) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/task.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/task.fidl new file mode 100644 index 0000000..56cc556 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/task.fidl
@@ -0,0 +1,29 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol task { + // TODO(scottmg): Need something like handle<task> in this file to mean {job, process, thread}. + // Or otherwise some way to express multiple options for constraints on inputs in this protocol. + + /// Suspend the given task. Currently only thread or process handles may be suspended. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD or ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + task_suspend(handle handle) -> (status status, handle token); + + /// Suspend the given task. Currently only thread or process handles may be suspended. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD or ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_WRITE. + task_suspend_token(handle handle) -> (status status, handle token); + + /// Create an exception channel for a given job, process, or thread. + /// Rights: handle must have ZX_RIGHT_INSPECT and have ZX_RIGHT_DUPLICATE and have ZX_RIGHT_TRANSFER and have ZX_RIGHT_MANAGE_THREAD. + /// Rights: If handle is of type ZX_OBJ_TYPE_JOB or ZX_OBJ_TYPE_PROCESS, it must have ZX_RIGHT_ENUMERATE. + task_create_exception_channel(handle handle, uint32 options) -> (status status, handle<channel> out); + + /// Kill the provided task (job, process, or thread). + /// Rights: handle must have ZX_RIGHT_DESTROY. + task_kill(handle handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/thread.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/thread.fidl new file mode 100644 index 0000000..9754d05 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/thread.fidl
@@ -0,0 +1,31 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol thread { + /// Terminate the current running thread. + [noreturn] + thread_exit(); + + /// Create a thread. + /// Rights: process must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_MANAGE_THREAD. + thread_create(handle<process> process, string name, uint32 options) + -> (status status, handle<thread> out); + + /// Start execution on a thread. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_MANAGE_THREAD. + thread_start(handle<thread> handle, vaddr thread_entry, vaddr stack, uintptr arg1, uintptr arg2) + -> (status status); + + /// Read one aspect of thread state. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_READ. + thread_read_state(handle<thread> handle, uint32 kind) -> (status status, vector_void buffer); + + /// Write one aspect of thread state. + /// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_WRITE. + thread_write_state(handle<thread> handle, uint32 kind, vector_void buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/timer.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/timer.fidl new file mode 100644 index 0000000..1eae5a9 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/timer.fidl
@@ -0,0 +1,20 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol timer { + /// Create a timer. + timer_create(uint32 options, Clock clock_id) -> (status status, handle<timer> out); + + /// Start a timer. + /// Rights: handle must be of type ZX_OBJ_TYPE_TIMER and have ZX_RIGHT_WRITE. + timer_set(handle<timer> handle, time deadline, duration slack) -> (status status); + + /// Cancel a timer. + /// Rights: handle must be of type ZX_OBJ_TYPE_TIMER and have ZX_RIGHT_WRITE. + timer_cancel(handle<timer> handle) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/vcpu.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/vcpu.fidl new file mode 100644 index 0000000..72cc954 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/vcpu.fidl
@@ -0,0 +1,31 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol vcpu { + /// Create a VCPU. + /// Rights: guest must be of type ZX_OBJ_TYPE_GUEST and have ZX_RIGHT_MANAGE_PROCESS. + vcpu_create(handle<guest> guest, uint32 options, vaddr entry) -> (status status, handle<vcpu> out); + + // See port.fidl for definition of PortPacket. + /// Resume execution of a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_EXECUTE. + [blocking] + vcpu_resume(handle<vcpu> handle) -> (status status, PortPacket packet); + + /// Raise an interrupt on a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_SIGNAL. + vcpu_interrupt(handle<vcpu> handle, uint32 vector) -> (status status); + + /// Read the state of a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_READ. + vcpu_read_state(handle<vcpu> handle, uint32 kind) -> (status status, vector_void buffer); + + /// Write the state of a VCPU. + /// Rights: handle must be of type ZX_OBJ_TYPE_VCPU and have ZX_RIGHT_WRITE. + vcpu_write_state(handle<vcpu> handle, uint32 kind, vector_void buffer) -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/vmar.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/vmar.fidl new file mode 100644 index 0000000..0256623 --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/vmar.fidl
@@ -0,0 +1,53 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +using VmOption = uint32; + +// TODO(scottmg): bits for ZX_VM_xyz flags, and const for ZX_VM_ALIGN_xyz. + +[Transport = "Syscall"] +protocol vmar { + /// Allocate a new subregion. + /// Rights: If options & ZX_VM_CAN_MAP_READ, parent_vmar must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_READ. + /// Rights: If options & ZX_VM_CAN_MAP_WRITE, parent_vmar must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_WRITE. + /// Rights: If options & ZX_VM_CAN_MAP_EXECUTE, parent_vmar must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_EXECUTE. + vmar_allocate(handle<vmar> parent_vmar, VmOption options, usize offset, usize size) + -> (status status, handle<vmar> child_vmar, vaddr child_addr); + + // TODO(ZX-2967): handle No rights required? + /// Destroy a virtual memory address region. + vmar_destroy(handle<vmar> handle) -> (status status); + + // TODO(ZX-2399): TODO handle and vmo and options must all match, and options can't specify them. + /// Add a memory mapping. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMAR. + /// Rights: vmo must be of type ZX_OBJ_TYPE_VMO. + vmar_map(handle<vmar> handle, VmOption options, usize vmar_offset, + handle<vmo> vmo, uint64 vmo_offset, + usize len) + -> (status status, vaddr mapped_addr); + + // TODO(ZX-2967): handle No rights required? + /// Unmap virtual memory pages. + vmar_unmap(handle<vmo> handle, vaddr addr, usize len) -> (status status); + + /// Set protection of virtual memory pages. + /// Rights: If options & ZX_VM_PERM_READ, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_READ. + /// Rights: If options & ZX_VM_PERM_WRITE, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_WRITE. + /// Rights: If options & ZX_VM_PERM_EXECUTE, handle must be of type ZX_OBJ_TYPE_VMAR and have ZX_RIGHT_EXECUTE. + vmar_protect(handle<vmo> handle, VmOption options, vaddr addr, usize len) -> (status status); + + /// Perform an operation on VMOs mapped into this VMAR. + /// Rights: If op is ZX_VMO_OP_DECOMMIT, affected mappings must be writable. + [Blocking] + vmar_op_range(handle<vmar> handle, + uint32 op, + vaddr address, + usize size, + mutable_vector_void buffer) + -> (status status); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/vmo.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/vmo.fidl new file mode 100644 index 0000000..060d4cd --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/vmo.fidl
@@ -0,0 +1,81 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(fxb/39732): This should be read as "library zx". +library zz; + +[Transport = "Syscall"] +protocol vmo { + /// Create a VM object. + vmo_create(uint64 size, uint32 options) -> (status status, handle<vmo> out); + + // TODO(scottmg): This syscall is very weird, it's currently: + // (handle, buffer, offset, buffer_size) + // rather than: + // (handle, buffer, buffer_size, offset) + // which means the vector<byte> buffer won't work. Unfortunately offset and + // buffer_size have the same underlying type, so moving them will be + // error-prone. + /// Read bytes from the VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + [blocking, + ArgReorder = "handle, buffer, offset, buffer_size"] + vmo_read(handle<vmo> handle, uint64 offset) -> (status status, vector_void buffer); + + // TODO(scottmg): Same problem as Read() above. + /// Write bytes to the VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + [blocking, + ArgReorder = "handle, buffer, offset, buffer_size"] + vmo_write(handle<vmo> handle, vector_void buffer, uint64 offset) -> (status status); + + // TODO(ZX-2967): No rights required? + /// Read the current size of a VMO object. + vmo_get_size(handle<vmo> handle) -> (status status, uint64 size); + + /// Resize a VMO object. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + vmo_set_size(handle<vmo> handle, uint64 size) -> (status status); + + /// Perform an operation on a range of a VMO. + /// Rights: If op is ZX_VMO_OP_COMMIT, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If op is ZX_VMO_OP_DECOMMIT, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If op is ZX_VMO_OP_CACHE_SYNC, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: If op is ZX_VMO_OP_CACHE_INVALIDATE, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE. + /// Rights: If op is ZX_VMO_OP_CACHE_CLEAN, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + /// Rights: If op is ZX_VMO_OP_CACHE_CLEAN_INVALIDATE, handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ. + [blocking] + vmo_op_range(handle<vmo> handle, + uint32 op, + uint64 offset, + uint64 size, + mutable_vector_void buffer) + -> (status status); + + /// Create a child of a VM Object. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_DUPLICATE and have ZX_RIGHT_READ. + vmo_create_child(handle<vmo> handle, uint32 options, uint64 offset, uint64 size) + -> (status status, handle<vmo> out); + + /// Set the caching policy for pages held by a VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_MAP. + vmo_set_cache_policy(handle<vmo> handle, uint32 cache_policy) -> (status status); + + // TODO(ZX-2967): handle: No rights required, ZX_RIGHT_EXECUTE added to dup out + // TODO(ZX-2967): vmex == ZX_HANDLE_INVALID also accepted. + /// Add execute rights to a VMO. + /// Rights: handle must be of type ZX_OBJ_TYPE_VMO. + /// Rights: vmex must have resource kind ZX_RSRC_KIND_VMEX. + vmo_replace_as_executable([Release] handle<vmo> handle, handle<resource> vmex) + -> (status status, handle<vmo> out); + + /// Rights: bti must be of type ZX_OBJ_TYPE_BTI and have ZX_RIGHT_MAP. + vmo_create_contiguous(handle<bti> bti, usize size, uint32 alignment_log2) + -> (status status, handle<vmo> out); + + /// Create a VM object referring to a specific contiguous range of physical memory. + /// Rights: resource must have resource kind ZX_RSRC_KIND_MMIO. + vmo_create_physical(handle<resource> resource, paddr paddr, usize size) + -> (status status, handle<vmo> out); +};
diff --git a/third_party/fuchsia-sdk/arch/x64/vdso/zx.fidl b/third_party/fuchsia-sdk/arch/x64/vdso/zx.fidl new file mode 100644 index 0000000..ac9903a --- /dev/null +++ b/third_party/fuchsia-sdk/arch/x64/vdso/zx.fidl
@@ -0,0 +1,41 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(scottmg): This library is temporarily "zz" instead of "zx" because a +// "zx" is force-injected by fidlc. Eventually, we'll stop that and use this one +// instead as "zx". fxb/39732. +library zz; + +using status = int32; + +using time = int64; +using duration = int64; +using ticks = uint64; + +using koid = uint64; + +using vaddr = uint64; +using paddr = uint64; +using paddr32 = uint32; +using gpaddr = uint64; +using off = uint64; + +// TODO(scottmg): Not sure what this is. +using procarg = uint32; + +const uint64 CHANNEL_MAX_MSG_BYTES = 65536; +const uint64 CHANNEL_MAX_MSG_HANDLES = 64; + +// TODO(scottmg): == size_t, not sure if this is a good idea. +using usize = uint64; + +// TODO(scottmg): == uintptr_t, not sure if this is a good idea. +using uintptr = uint64; + +// TODO(scottmg): Maybe a void for vector<void> (or vector<any>?) to distinguish +// polymorphic arguments that are passed as void* from buffers of bytes. + +using signals = uint32; +// TODO(scottmg): Lots of aliases/variations required here. Not sure if bits +// make sense.
diff --git a/third_party/fuchsia-sdk/bin/aemu.version b/third_party/fuchsia-sdk/bin/aemu.version new file mode 100644 index 0000000..a738521 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/aemu.version
@@ -0,0 +1 @@ +git_revision:8f06ec782485dccd8488906df414665ad5a5c9f6 \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/bin/devshell/emu b/third_party/fuchsia-sdk/bin/devshell/emu new file mode 100755 index 0000000..9eac155 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/devshell/emu
@@ -0,0 +1,425 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +#### CATEGORY=Run, inspect and debug +### start fuchsia in an emulator + +## usage: fx emu [-a <mode>] [-c <text>] [-N [-I <ifname>]] [-u <path>] [-g <port> [-r <fps>] [-t <cmd>]] [-x <port> [-X <directory>]] [-e <directory>] [-w <size>] [-s <cpus>] [-k <authorized_keys_file>] [-K <kernel_image>] [-z <zbi_image>] [-f <fvm_image>] [--audio] [--headless] [--software-gpu] [--debugger] +## -a <mode> acceleration mode (auto, off, kvm, hvf, hax), default is auto +## -c <text> add item to kernel command line +## -ds <size> extends the fvm image size to <size> bytes. Default is twice the original size +## -N run with emulated nic via tun/tap +## -I <ifname> uses the tun/tap interface named ifname +## -u <path> execute emu if-up script, default: linux: no script, macos: tap ifup script. +## -e <directory> location of emulator, defaults to looking in prebuilt/third_party/aemu/PLATFORM +## -g <port> enable gRPC service on port to control the emulator, default is 5556 when WebRTC service is enabled +## -r <fps> webrtc frame rate when using gRPC service, default is 30 +## -t <cmd> execute the given command to obtain turn configuration +## -x <port> enable WebRTC HTTP service on port +## -X <directory> location of grpcwebproxy, defaults to looking in prebuilt/third_party/grpcwebproxy +## -w <size> window size, default is 1280x800 +## -s <cpus> number of cpus, 1 for uniprocessor, default is 4 +## -k <authorized_keys_file> SSH authorized keys file, otherwise defaults to //.ssh/authorized_keys +## -K <kernel_image> path to image to use as kernel, defaults to kernel generated by the current build. +## -z <zbi_image> path to image to use as ZBI, defaults to zircon-a generated by the current build. +## -f <fvm_image> path to full FVM image, defaults to image generated by the current build. +## --audio run with audio hardware added to the virtual machine +## --headless run in headless mode +## --host-gpu run with host GPU acceleration +## --software-gpu run without host GPU acceleration +## --debugger pause on launch and wait for a debugger process to attach before resuming + +set -e + +DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +source "${DEVSHELL_DIR}"/lib/image_build_vars.sh || exit $? +source "${DEVSHELL_DIR}"/lib/fvm.sh || exit $? + +ACCEL="auto" +NET=0 +DEBUGGER=0 +IFNAME="" +AUDIO=0 +HEADLESS=0 +AEMU="emulator" +AEMU_DIR="" +UPSCRIPT= +WINDOW_SIZE="1280x800" +GRPC= +RTCFPS="30" +TURNCFG="" +GPU="auto" +VULKAN=1 +HTTP=0 +GRPCWEBPROXY_DIR="" +CMDLINE="" +SMP=4 +AUTHORIZED_KEYS="${FUCHSIA_DIR}/.ssh/authorized_keys" +IMAGE_SIZE= +EXPERIMENT_ARM64=false +KERNEL_IMAGE="${FUCHSIA_BUILD_DIR}/${IMAGE_QEMU_KERNEL_RAW}" +ZBI_IMAGE="${FUCHSIA_BUILD_DIR}/${IMAGE_ZIRCONA_ZBI}" +if [[ -n "${IMAGE_FVM_RAW}" ]]; then + FVM_IMAGE="${FUCHSIA_BUILD_DIR}/${IMAGE_FVM_RAW}" +else + FVM_IMAGE="" +fi + + +case $(uname -m) in +x86_64) + HOST_ARCH=x64 + ;; +aarch64) + HOST_ARCH=arm64 + ;; +*) + fx-error "Unsupported host architecture: $(uname -m)" + exit 1 +esac + +if [[ "$FUCHSIA_ARCH" != "$HOST_ARCH" ]]; then + ACCEL=off +fi + +# Propagate our TERM environment variable as a kernel command line +# argument. This is first so that an explicit -c TERM=foo argument +# goes into CMDLINE later and overrides this. +if [[ -n $TERM ]]; then + CMDLINE+="TERM=$TERM " +fi + +while [[ $# -ge 1 ]]; do + case "$1" in + -h|--help) + fx-command-help + exit 0 + ;; + -a) + shift + ACCEL="$1" + ;; + -c) + shift + CMDLINE+="$1 " + ;; + -ds) + shift + IMAGE_SIZE="$1" + ;; + -N) + NET=1 + ;; + -I) + shift + IFNAME="$1" + ;; + -u) + shift + UPSCRIPT="$1" + ;; + -e) + shift + AEMU_DIR="$1" + ;; + -x) + shift + HTTP="$1" + ;; + -X) + shift + GRPCWEBPROXY_DIR="$1" + ;; + -g) + shift + GRPC="$1" + ;; + -r) + shift + RTCFPS="$1" + ;; + -t) + shift + TURNCFG="$1" + ;; + -w) + shift + WINDOW_SIZE="$1" + ;; + -s) + shift + SMP="$1" + ;; + -k) + shift + AUTHORIZED_KEYS="$1" + ;; + -K) + shift + KERNEL_IMAGE="$1" + ;; + -z) + shift + ZBI_IMAGE="$1" + ;; + -f) + shift + FVM_IMAGE="$1" + ;; + --audio) + AUDIO=1 + ;; + --headless) + HEADLESS=1 + ;; + --debugger) + DEBUGGER=1 + ;; + --host-gpu) + GPU="host" + ;; + --software-gpu) + GPU="swiftshader_indirect" + ;; + --experiment-arm64) + EXPERIMENT_ARM64=true + ;; + *) + break + esac + shift +done + +if [[ -z "$AEMU_DIR" && -d "$PREBUILT_AEMU_DIR" ]]; then + AEMU_DIR="$PREBUILT_AEMU_DIR" +fi + +if [[ -z "$GRPCWEBPROXY_DIR" && -d "$PREBUILT_GRPCWEBPROXY_DIR" ]]; then + GRPCWEBPROXY_DIR="$PREBUILT_GRPCWEBPROXY_DIR" +fi + +# construct the args for aemu +ARGS=() +ARGS+=("-m" "2048") +ARGS+=("-serial" "stdio") +ARGS+=("-vga" "none") +ARGS+=("-device" "virtio-keyboard-pci") +ARGS+=("-device" "virtio_input_multi_touch_pci_1") + +if [[ $SMP != 1 ]]; then + ARGS+=("-smp" "${SMP},threads=2") +fi + +# TODO(raggi): do we want to use hda on arm64? +if (( AUDIO )); then + ARGS+=("-soundhw" "hda") +fi + +FEATURES="VirtioInput,RefCountPipe" + +if [[ "$ACCEL" == "auto" ]]; then + if [[ "$(uname -s)" == "Darwin" ]]; then + ACCEL="hvf" + else + ACCEL="kvm" + fi +fi + +case "$FUCHSIA_ARCH" in +x64) + ARGS+=("-machine" "q35") + ARGS+=("-device" "isa-debug-exit,iobase=0xf4,iosize=0x04") +;; +arm64) + ARGS+=("-machine" "virt") +;; +esac + +if [[ "$ACCEL" == "kvm" ]]; then + if [[ ! -w "/dev/kvm" ]]; then + echo "To use KVM acceleration, adjust permissions to /dev/kvm using:" + echo + echo "sudo chmod 666 /dev/kvm" + exit 1 + fi + ARGS+=("-enable-kvm" "-cpu" "host,migratable=no,+invtsc") + FEATURES+=",KVM,GLDirectMem" +elif [[ "$ACCEL" == "hvf" ]]; then + ARGS+=("-enable-hvf" "-cpu" "Haswell") + FEATURES+=",HVF,GLDirectMem" +elif [[ "$ACCEL" == "hax" ]]; then + ARGS+=("-enable-hax" "-cpu" "Haswell") + FEATURES+=",HAXM,GLDirectMem" +elif [[ "$ACCEL" == "off" ]]; then + case "$FUCHSIA_ARCH" in + x64) + ARGS+=("-cpu" "Haswell,+smap,-check,-fsgsbase") + ;; + arm64) + ARGS+=("-cpu" "cortex-a53") + ;; + esac + # disable vulkan as not useful without kvm,hvf,hax and support + # for coherent host visible memory. + VULKAN=0 + FEATURES+=",-GLDirectMem" +else + fx-error Unsupported acceleration mode + exit 1 +fi + +if (( VULKAN )); then + FEATURES+=",Vulkan" +else + FEATURES+=",-Vulkan" +fi + +OPTIONS=() +OPTIONS+=("-feature" "$FEATURES") +OPTIONS+=("-window-size" "$WINDOW_SIZE") +OPTIONS+=("-gpu" "$GPU") +if (( DEBUGGER )); then + OPTIONS+=("-wait-for-debugger") +fi + +if (( HEADLESS )); then + OPTIONS+=("-no-window") +fi + +if [[ "$FUCHSIA_ARCH" == "arm64" ]]; then + if ! "$EXPERIMENT_ARM64"; then + fx-error "arm64 support is still experimental, requires --experiment-arm64" + exit 1 + fi + OPTIONS+=("-avd-arch" "arm64") +fi + +# use port 5556 by default +if (( HTTP )); then + GRPC="${GRPC:-5556}" +fi + +if (( GRPC )); then + OPTIONS+=("-grpc" "$GRPC") + OPTIONS+=("-rtcfps" "$RTCFPS") + if [[ -n "$TURNCFG" ]]; then + OPTIONS+=("-turncfg" "$TURNCFG") + fi +fi + +if (( NET )); then + if [[ "$(uname -s)" == "Darwin" ]]; then + if [[ -z "$IFNAME" ]]; then + IFNAME="tap0" + fi + if [[ "$IFNAME" != "fakenetwork" && ! -c "/dev/$IFNAME" ]]; then + echo "To use emu with networking on macOS, install the tun/tap driver:" + echo "http://tuntaposx.sourceforge.net/download.xhtml" + exit 1 + fi + if [[ "$IFNAME" != "fakenetwork" && ! -w "/dev/$IFNAME" ]]; then + echo "For networking /dev/$IFNAME must be owned by $USER. Please run:" + echo " sudo chown $USER /dev/$IFNAME" + exit 1 + fi + if [[ -z "${UPSCRIPT}" ]]; then + echo "sudo follows to configure the tap interface:" + UPSCRIPT="${DEVSHELL_DIR}"/lib/emu-ifup-macos.sh + fi + else + if [[ -z "$IFNAME" ]]; then + IFNAME="qemu" + fi + TAP_IFS=$(ip tuntap show 2>/dev/null) + if [[ "$IFNAME" != "fakenetwork" && ! "$TAP_IFS" =~ ${IFNAME}: ]]; then + echo "To use emu with networking on Linux, configure tun/tap:" + echo + echo "sudo ip tuntap add dev $IFNAME mode tap user $USER && \\" + echo "sudo ip link set $IFNAME up" + exit 1 + fi + # Try to detect if a firewall is active. There are only few ways to do that + # without being root. Unfortunately, using systemd or systemctl does not work + # (at least on Debian), so use the following hack instead: + if (command -v ufw && grep -q "^ENABLED=yes" /etc/ufw/ufw.conf) >/dev/null 2>&1; then + fx-warn "Active firewall detected: If this emulator is unreachable, run: fx setup-ufw" + fi + if [[ -z "${UPSCRIPT}" ]]; then + UPSCRIPT=no + fi + fi + if [[ -n "${UPSCRIPT}" && "${UPSCRIPT}" != "no" && ! -x "${UPSCRIPT}" ]]; then + echo "The upscript ${UPSCRIPT} is not a valid executable" + exit 1 + fi + ARGS+=("-netdev" "type=tap,ifname=$IFNAME,id=net0${UPSCRIPT:+,script=${UPSCRIPT}}") + HASH=$(echo $IFNAME | shasum) + SUFFIX=$(for i in {0..2}; do echo -n ":${HASH:$(( 2 * i )):2}"; done) + MAC=",mac=52:54:00$SUFFIX" + ARGS+=("-device" "e1000,netdev=net0${MAC}") +else + ARGS+=("-net" "none") +fi + +# Check for X11 on Linux +if [[ "$(uname -s)" == "Linux" ]] && (( ! HEADLESS )); then + if [[ -z "$DISPLAY" ]]; then + echo "To use emulator on Linux, start X, or use a virtual framebuffer:" + echo + echo "xvfb-run fx emu" + exit 1 + else + if [[ "$DISPLAY" != "fakedisplay" ]] && ! xset q >/dev/null 2>&1; then + echo "clients must be allowed to connect to DISPLAY. Please run:" + echo + echo "DISPLAY=$DISPLAY XAUTHORITY=/var/run/lightdm/root/$DISPLAY sudo xhost +" + exit 1 + fi + fi +fi + +# Construction of a qcow image prevents aemu from writing back to the +# build-produced image file, which could cause timestamp issues with that file. +# Construction of the new ZBI adds //.ssh/authorized_keys for SSH access. +img_dir="$(mktemp -d)" +if [[ ! -d "${img_dir}" ]]; then + fx-error "Failed to create temporary directory" + exit 1 +fi +trap 'rm -Rf "${img_dir}" ; [[ "${GRPCWEBPROXY_PID}" ]] && kill "${GRPCWEBPROXY_PID}"; stty sane' EXIT + +KERNEL_ZBI="${img_dir}/fuchsia-ssh.zbi" +fx-zbi -o "${KERNEL_ZBI}" "${ZBI_IMAGE}" \ + --entry "data/ssh/authorized_keys=${AUTHORIZED_KEYS}" + +if [[ -n "$FVM_IMAGE" ]]; then + fvmimg="${img_dir}/fvm.blk" + fx-fvm-extend-image "${FVM_IMAGE}" "${fvmimg}" "${IMAGE_SIZE}" + ARGS+=("-drive" "file=${fvmimg},format=raw,if=none,id=vdisk") + ARGS+=("-device" "virtio-blk-pci,drive=vdisk") +fi + +# Start gRPC web proxy if HTTP port is set +if (( HTTP )); then + "${GRPCWEBPROXY_DIR}/grpcwebproxy" \ + --backend_addr localhost:"$GRPC" --server_http_debug_port "$HTTP" \ + --backend_tls=false --run_tls_server=false --allow_all_origins & + GRPCWEBPROXY_PID=$! +fi + +# construct the kernel cmd line for aemu +CMDLINE+="kernel.serial=legacy " + +# Add entropy to the kernel +CMDLINE+="kernel.entropy-mixin=$(head -c 32 /dev/urandom | shasum -a 256 | awk '{ print $1 }') " + +# Don't 'reboot' the emulator if the kernel crashes +CMDLINE+="kernel.halt-on-panic=true " + +# run aemu +set -x +"${AEMU_DIR}/${AEMU}" "${OPTIONS[@]}" -fuchsia \ + -kernel "${KERNEL_IMAGE}" \ + -initrd "$KERNEL_ZBI" "${ARGS[@]}" -append "$CMDLINE" "$@"
diff --git a/third_party/fuchsia-sdk/bin/devshell/lib/emu-ifup-macos.sh b/third_party/fuchsia-sdk/bin/devshell/lib/emu-ifup-macos.sh new file mode 100755 index 0000000..974e535 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/devshell/lib/emu-ifup-macos.sh
@@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# This script is required by fx emu to bring up the network +# interface on Mac OSX. Do not remove or edit this script +# without testing it against fx emu. + +sudo ifconfig tap0 inet6 fc00::/7 up
diff --git a/third_party/fuchsia-sdk/bin/devshell/lib/fvm.sh b/third_party/fuchsia-sdk/bin/devshell/lib/fvm.sh new file mode 100644 index 0000000..0892195 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/devshell/lib/fvm.sh
@@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Arguments: +# - raw image file +# - extended image file +# - (optional) size of extended image file, defaults to original*2 +function fx-fvm-extend-image { + fvmraw=$1 + fvmimg=$2 + + stat_flags=() + if [[ $(uname) == "Darwin" ]]; then + stat_flags+=("-x") + fi + stat_output=$(stat "${stat_flags[@]}" "${fvmraw}") + if [[ "$stat_output" =~ Size:\ ([0-9]+) ]]; then + size="${BASH_REMATCH[1]}" + recommended_size=$((size * 2)) + if [[ $# -gt 2 && -n "$3" ]]; then + newsize=$3 + if [[ "${newsize}" -le "${size}" ]]; then + fx-error "Image size has to be greater than ${size} bytes. Recommended value is ${recommended_size} bytes." + return 1 + fi + else + newsize="${recommended_size}" + fi + # We must take a copy of the build artifact, rather than re-use it, as we + # need to modify it in order to extend it. + echo -n "Creating disk image..." + cp "${fvmraw}" "${fvmimg}" + "${HOST_OUT_DIR}/fvm" "${fvmimg}" extend --length "${newsize}" + echo "done" + else + fx-error "Could not extend fvm, unable to stat fvm image" + return 1 + fi + return 0 +}
diff --git a/third_party/fuchsia-sdk/bin/devshell/lib/image_build_vars.sh b/third_party/fuchsia-sdk/bin/devshell/lib/image_build_vars.sh new file mode 100755 index 0000000..676393a --- /dev/null +++ b/third_party/fuchsia-sdk/bin/devshell/lib/image_build_vars.sh
@@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Script to provide necessary variables for fx emu to run out-of-tree +# This file must be located in `dirname emu`/lib so that emu can source it. +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )/../.." >/dev/null 2>&1 && pwd)" +source "${SCRIPT_SRC_DIR}"/fuchsia-common.sh || exit $? +source "${SCRIPT_SRC_DIR}"/fx-image-common.sh || exit $?
diff --git a/third_party/fuchsia-sdk/bin/devtools.version b/third_party/fuchsia-sdk/bin/devtools.version new file mode 100644 index 0000000..da7e64a --- /dev/null +++ b/third_party/fuchsia-sdk/bin/devtools.version
@@ -0,0 +1 @@ +m3hEivV_XBNLjgzoQz2382w_pOxlBWY11uu4w5Wv96sC
diff --git a/third_party/fuchsia-sdk/bin/fconfig-meta.json b/third_party/fuchsia-sdk/bin/fconfig-meta.json new file mode 100644 index 0000000..415b6e7 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fconfig-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fconfig.sh", + "bin/fuchsia-common.sh" + ], + "name": "fconfig", + "root": "bin", + "target_files": {}, + "type": "host_tool" +}
diff --git a/third_party/fuchsia-sdk/bin/fconfig.sh b/third_party/fuchsia-sdk/bin/fconfig.sh new file mode 100755 index 0000000..dbd7b22 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fconfig.sh
@@ -0,0 +1,105 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +#### CATEGORY=Device management +### Sets configuration properties persistently so +### they can be used as reasonable defaults for other commands. + +set -eu + +# Source common functions +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +function usage { + cat << EOF +usage: fconfig.sh [set|get|default|list] propname [value] + Sets or gets the property values used as defaults for commands. + + set: Sets the property to the given value. + get: Prints the value of the property or empty string if not found. + default: Restores the given property to the default value, or unsets. + list: Lists prop=value one per line. + + propname: One of the predefined properties: $(get-fuchsia-property-names)). + value: if using setting, the value to set to the property. Otherwise ignored. +EOF +} + +function _do_set { + if is-valid-fuchsia-property "$1"; then + set-fuchsia-property "$1" "$2" + else + fx-error "Invalid property name: $1" + return 1 + fi +} + +function _do_get { + if is-valid-fuchsia-property "$1"; then + get-fuchsia-property "$1" + else + fx-error "Invalid property name: $1" + return 1 + fi +} + +function _do_list { + for p in $(get-fuchsia-property-names); do + echo "${p}=$(get-fuchsia-property "$p")" + done +} + +CMD="" +PROPNAME="" +VALUE="" + +if (( "$#" >= 1 )); then + CMD="${1}" +else + usage + exit 1 +fi +shift + +if [[ "${CMD}" == "set" ]]; then + if (( "$#" >= 2 )); then + PROPNAME="${1}" + shift + VALUE="$*" + else + usage + exit 1 + fi + _do_set "${PROPNAME}" "${VALUE}" +elif [[ "${CMD}" == "get" ]]; then + if (( "$#" == 1 )); then + PROPNAME="${1}" + else + usage + exit 1 + fi + _do_get "${PROPNAME}" +elif [[ "${CMD}" == "default" ]]; then + if (( "$#" == 1 )); then + PROPNAME="${1}" + else + usage + exit 1 + fi + _do_set "${PROPNAME}" "" +elif [[ "${CMD}" == "list" ]]; then + if (( "$#" != 0 )); then + usage + exit 1 + fi + _do_list +else + usage + exit 1 +fi
diff --git a/third_party/fuchsia-sdk/bin/fcp-meta.json b/third_party/fuchsia-sdk/bin/fcp-meta.json new file mode 100644 index 0000000..afa6be9 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fcp-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fcp.sh", + "bin/fuchsia-common.sh" + ], + "name": "fcp", + "root": "bin", + "target_files": {}, + "type": "host_tool" +}
diff --git a/third_party/fuchsia-sdk/bin/fcp.sh b/third_party/fuchsia-sdk/bin/fcp.sh new file mode 100755 index 0000000..a2a69e8 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fcp.sh
@@ -0,0 +1,145 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +#### CATEGORY=Device management +### copy a file to/from a target device + +set -eu + +# Source common functions +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" + +DEVICE_NAME_FILTER="$(get-fuchsia-property device-name)" +DEFAULT_NAME_HELP="" +if [[ "${DEVICE_NAME_FILTER}" != "" ]]; then + DEFAULT_NAME_HELP="The default device name is ${DEVICE_NAME_FILTER}." +fi +DEVICE_IP="$(get-fuchsia-property device-ip)" +DEFAULT_IP_HELP="" +if [[ "${DEVICE_IP}" != "" ]]; then + DEFAULT_IP_HELP="The default IP address is ${DEVICE_IP}." +fi +function usage { + cat << EOF +usage: fcp.sh [(--device-name <device hostname> | --device-ip <device ip-addr>)] [--private-key <identity file>] [(--to-target|--to-host)] SRC... DST + Copies a file from the host to the target device, or vice versa. + + --device-name <device hostname> + Connects to a device by looking up the given device hostname. ${DEFAULT_NAME_HELP} + --device-ip <device ipaddr> + Connects to a device by using the provided IP address, cannot use with --device-name. + If neither --device-name nor --device-ip are given, the connection is attempted to the + first device detected. ${DEFAULT_IP_HELP} + --private-key <identity file> + Uses additional private key when using ssh to access the device. + --to-target + Copy file SRC from host to DST on the target. This is the default. + --to-host + Copy file SRC from target to DST on the host. +EOF +} + +PRIVATE_KEY_FILE="" +TO_TARGET=true + +# Process all the args except the last two. +while (( "$#" > 2 )); do + case "$1" in + --to-target) + TO_TARGET=true + ;; + --to-host) + TO_TARGET=false + ;; + --device-name) + shift + DEVICE_NAME_FILTER="${1}" + ;; + --device-ip) + shift + DEVICE_IP="${1}" + ;; + --private-key) + shift + PRIVATE_KEY_FILE="${1}" + ;; + --help) + usage + exit 1 + esac +shift +done + +readonly DEVICE_NAME_FILTER +readonly DEVICE_IP +readonly PRIVATE_KEY_FILE +readonly TO_TARGET + +args=( "$@" ) +nargs=${#args[@]} +dst=${args[$nargs-1]} +srcs=( "${args[@]:0:$nargs-1}" ) +target_addr="${DEVICE_IP}" + +if [[ $# -ne 2 ]]; then + usage + exit 1 +fi + +# Check for core SDK being present +if [[ ! -d "${FUCHSIA_SDK_PATH}" ]]; then + fx-error "Fuchsia Core SDK not found at ${FUCHSIA_SDK_PATH}." + exit 2 +fi + +# Get the device IP address if not specified. +if [[ "${target_addr}" == "" ]]; then + # explicitly pass the sdk here since the name filter arg must be $2. + target_addr=$(get-device-ip-by-name "${FUCHSIA_SDK_PATH}" "${DEVICE_NAME_FILTER}") + if [[ ! "$?" || -z "${target_addr}" ]]; then + fx-error "Error finding device" + exit 2 + fi +else + if [[ "${DEVICE_NAME_FILTER}" != "" ]]; then + fx-error "Cannot specify both --device-name and --device-ip" + exit 3 + fi +fi + +# Build the command line +sftp_cmd=( "sftp" "-F" "$(get-fuchsia-sshconfig-file)") +if [[ "${PRIVATE_KEY_FILE}" != "" ]]; then + sftp_cmd+=( "-i" "${PRIVATE_KEY_FILE}") +fi + +# Pass in commands in batch mode from stdin +sftp_cmd+=( "-b" "-" ) +# sftp needs the [] around the ipv6 address, which is different than ssh. +if [[ "${target_addr}" =~ : ]]; then + sftp_cmd+=( "[${target_addr}]" ) +else + sftp_cmd+=( "${target_addr}" ) +fi + +if [[ "${TO_TARGET}" = "true" ]]; then + ( + for src in "${srcs[@]}"; do + echo "put \"${src}\" \"${dst}\"" + done + ) | "${sftp_cmd[@]}" > /dev/null +else + ( + for src in "${srcs[@]}"; do + echo "get \"${src}\" \"${dst}\"" + done + ) | "${sftp_cmd[@]}" > /dev/null +fi
diff --git a/third_party/fuchsia-sdk/bin/fdevtools-meta.json b/third_party/fuchsia-sdk/bin/fdevtools-meta.json new file mode 100644 index 0000000..12dbf89 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fdevtools-meta.json
@@ -0,0 +1,11 @@ +{ + "files": [ + "bin/devtools.version", + "bin/fdevtools.sh", + "bin/fuchsia-common.sh" + ], + "name": "fdevtools", + "root": "bin", + "target_files": {}, + "type": "host_tool" +}
diff --git a/third_party/fuchsia-sdk/bin/fdevtools.sh b/third_party/fuchsia-sdk/bin/fdevtools.sh new file mode 100755 index 0000000..abd6f3e --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fdevtools.sh
@@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Enable error checking for all commands +err_print() { + echo "Error at $1" + stty sane +} +trap 'err_print $0:$LINENO' ERR +set -e + +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? +# Computed from instance id at https://chrome-infra-packages.appspot.com/p/fuchsia_internal/gui_tools/fuchsia_devtools/linux-amd64/+/dogfood-1-1 +VER_DEVTOOLS="$(cat "${SCRIPT_SRC_DIR}/devtools.version")" + +FUCHSIA_IMAGE_WORK_DIR="$(get-fuchsia-sdk-data-dir)" +export FUCHSIA_IMAGE_WORK_DIR + + +usage () { + echo "Usage: $0" + echo " [--work-dir <directory to store image assets>]" + echo " Defaults to ${FUCHSIA_IMAGE_WORK_DIR}" + echo " [--private-key <identity file>]" + echo " Uses additional private key when using ssh to access the device." + echo " [--version <version>" + echo " Specify the CIPD version of DevTools to download." + echo " Defaults to devtools.version file with ${VER_DEVTOOLS}" + echo " [--help] [-h]" + echo " Show command line options available" +} + +PRIVATE_KEY_FILE="" +FDT_ARGS=() + +# Parse command line +while (( "$#" )); do +case $1 in + --work-dir) + shift + FUCHSIA_IMAGE_WORK_DIR="${1:-.}" + ;; + --private-key) + shift + PRIVATE_KEY_FILE="${1}" + ;; + --version) + shift + VER_DEVTOOLS="${1}" + ;; + --help|-h) + usage + exit 0 + ;; + *) + # Unknown options are passed to Fuchsia DevTools + FDT_ARGS+=( "$1" ) + ;; +esac +shift +done + +readonly PRIVATE_KEY_FILE + +# Do not create directory names with : otherwise LD_PRELOAD or PATH usage will fail. +# Avoid / to prevent extra sub-directories being created. +LABEL_DEVTOOLS="$(echo "${VER_DEVTOOLS}" | tr ':/' '_')" + +# Can download Fuchsia DevTools from CIPD with either "latest" or a CIPD hash +echo "Downloading Fuchsia DevTools ${VER_DEVTOOLS} with CIPD" +TEMP_ENSURE=$(mktemp /tmp/fuchsia_devtools_cipd_XXXXXX.ensure) +cat << end > "${TEMP_ENSURE}" +\$ServiceURL https://chrome-infra-packages.appspot.com/ +fuchsia_internal/gui_tools/fuchsia_devtools/\${platform} $VER_DEVTOOLS +end + +FDT_DIR="${FUCHSIA_IMAGE_WORK_DIR}/fuchsia_devtools-${LABEL_DEVTOOLS}" +if ! run-cipd ensure -ensure-file "${TEMP_ENSURE}" -root "${FDT_DIR}"; then + rm "$TEMP_ENSURE" + echo "Failed to download Fuchsia DevTools ${VER_DEVTOOLS}." + exit 1 +fi +rm "${TEMP_ENSURE}" + +export FDT_TOOLCHAIN="GN" +FDT_GN_SSH="$(command -v ssh)" +export FDT_GN_SSH +FDT_SSH_CONFIG="$(get-fuchsia-sshconfig-file)" +export FDT_SSH_CONFIG +FDT_GN_DEVFIND="$(get-fuchsia-sdk-dir)/tools/device-finder" +export FDT_GN_DEVFIND +export FDT_DEBUG="true" +if [[ "${PRIVATE_KEY_FILE}" != "" ]]; then + FDT_SSH_KEY="${PRIVATE_KEY_FILE}" + export FDT_SSH_KEY +fi +echo "Starting system_monitor with FDT_ARGS=[${FDT_ARGS[*]}] and environment:" +env | grep FDT_ + +"${FDT_DIR}/system_monitor/linux/system_monitor" "${FDT_ARGS[@]}"
diff --git a/third_party/fuchsia-sdk/bin/femu-exec-wrapper.sh b/third_party/fuchsia-sdk/bin/femu-exec-wrapper.sh new file mode 100755 index 0000000..278ab6a --- /dev/null +++ b/third_party/fuchsia-sdk/bin/femu-exec-wrapper.sh
@@ -0,0 +1,200 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +function usage() { + echo "Usage: $0" + echo + echo " Starts up femu.sh, runs a script, captures the result, and terminates the emulator" + echo + echo " [--exec <script>]" + echo " Executes the specified script or command that can access the emulator" + echo " [--femu-log <file>]" + echo " Specify log file instead of mktemp, can also be /dev/null or /dev/stdout" + echo " [--headless]" + echo " Do not use any graphics support, do not open any new windows" + echo " [--interactive]" + echo " Opens up xterm window with femu serial console" + echo " [--image <name>]" + echo " System image to use with femu.sh, defaults to ${IMAGE_NAME}" + echo + echo " All other arguments are passed on, see femu.sh --help for more info" +} + +set -eu # Error checking +err_print() { + echo "Error at $1" +} +trap 'err_print $0:$LINENO' ERR + +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +function get_child_pids { + children=() + if is-mac; then + while IFS='' read -r v; do children+=("$v"); done < <(pgrep -P "$1") + else + while IFS='' read -r v; do children+=("$v"); done < <(ps -o pid= --ppid "$1") + fi + if (( ${#children[@]} )); then + for pid in "${children[@]}"; do + while IFS='' read -r v; do children+=("$v"); done < <(get_child_pids "$pid") + done + echo "${children[@]}" + fi +} + +# Called when there is an error and we need to dump the log +function dump_femu_log { + if [[ "${FEMU_LOG}" = /dev/* ]]; then + echo "Cannot dump log for device ${FEMU_LOG}" + else + echo "Dumping log file ${FEMU_LOG}" + cat -n "${FEMU_LOG}" + fi +} + +# This is only used after femu.sh has been started +function cleanup { + declare -a CHILD_PIDS=() + IFS=" " read -r -a CHILD_PIDS <<< "$(get_child_pids "${FEMU_PID}")" + msg="Cleaning up femu pid ${FEMU_PID}" + + if (( "${#CHILD_PIDS[@]}" )); then + echo "$msg qemu child processes ${CHILD_PIDS[*]} and package server for exit ..." + kill "${CHILD_PIDS[@]}" > /dev/null 2>&1 || true + elif [[ "${FEMU_PID}" != "" ]]; then + echo "${msg}" + kill "${FEMU_PID}" > /dev/null 2>&1 || true + fi + "${SCRIPT_SRC_DIR}/fserve.sh" --kill > /dev/null 2>&1 || true +} + +HEADLESS="" +INTERACTIVE="" +EXEC_SCRIPT="" +IMAGE_NAME="qemu-x64" +FEMU_LOG="" +FEMU_LOG_TEMP="" +EMU_ARGS=() + +# Check for some of the emu flags, but pass everything else on to femu.sh +while (( "$#" )); do + case $1 in + --help|-h) + usage + exit 0 + ;; + --headless) + HEADLESS="yes" + ;; + --interactive) + INTERACTIVE="yes" + ;; + --exec) + shift + EXEC_SCRIPT="${1}" + ;; + --femu-log) + shift + FEMU_LOG="${1}" + ;; + --image) + shift + IMAGE_NAME="${1}" + ;; + *) + # Everything else is passed on to the emulator + EMU_ARGS+=( "${1}" ) + ;; + esac + shift +done + +# This IPv6 address is always generated according to the hash of the qemu network interface in femu.sh +EMULATOR_ADDRESS="fe80::5054:ff:fe63:5e7a%qemu" + +# Set up log file if not specified +if [[ "${INTERACTIVE}" == "yes" && "${FEMU_LOG}" != "" && "${FEMU_LOG}" != "/dev/null" ]]; then + fx-error "--interactive does not write to --femu-log" + exit 1 +fi +if [[ "${FEMU_LOG}" == "" ]]; then + FEMU_LOG="$(mktemp)" + FEMU_LOG_TEMP="${FEMU_LOG_TEMP}" +fi + +# Always start femu with network access. +femu_command_args=("${SCRIPT_SRC_DIR}/femu.sh" --image "${IMAGE_NAME}" -N) + +echo "Starting emulator with logging to ${FEMU_LOG}" +if [[ "${INTERACTIVE}" == "yes" ]]; then + if (( ${#EMU_ARGS[@]} )); then + femu_command_args+=("${EMU_ARGS[@]}") + fi + # Start up the emulator in the background within a new window, useful for interactive debugging + xterm -T "femu" -e "${femu_command_args[@]}" & + FEMU_PID=$! +elif [[ "${HEADLESS}" == "yes" ]]; then + # When there is no graphics support, run femu in the background with no output visible, and use a software GPU + femu_command_args+=("--headless" "--software-gpu") + if (( ${#EMU_ARGS[@]} )); then + femu_command_args+=("${EMU_ARGS[@]}") + fi + "${femu_command_args[@]}" &> "${FEMU_LOG}" < /dev/null & + FEMU_PID=$! +else + # Allow femu to open up a window for the emulator and use hardware Vulkan support + if (( ${#EMU_ARGS[@]} )); then + femu_command_args+=("${EMU_ARGS[@]}") + fi + "${femu_command_args[@]}" &> "${FEMU_LOG}" < /dev/null & + FEMU_PID=$! +fi +trap cleanup EXIT + +# Wait for the emulator to start, and check if emu is still running in the background or this will never complete +echo "Waiting for emulator to start" +COUNT=0 +COUNT_TIMEOUT=120 +while [[ $COUNT -lt $COUNT_TIMEOUT ]] ; do + kill -0 ${FEMU_PID} &> /dev/null || ( echo "ERROR: Emulator pid $FEMU_PID has exited, cannot connect"; dump_femu_log; exit 1; ) + "${SCRIPT_SRC_DIR}/fssh.sh" --device-ip "${EMULATOR_ADDRESS}" "echo hello" &> /dev/null && break + echo "Waiting for emulator SSH server ${EMULATOR_ADDRESS} - attempt ${COUNT} ..." + COUNT=$((COUNT+1)) + sleep 1s +done +if (( COUNT == COUNT_TIMEOUT )); then + echo "ERROR: Timeout of ${COUNT_TIMEOUT} seconds reached waiting for emulator pid $FEMU_PID to start, cannot connect" + dump_femu_log + exit 1 +fi +echo "Emulator pid ${FEMU_PID} is running and accepting connections" + +# Start the package server after the emulator is ready, so we know it is configured when we run commands +echo "Starting package server" +"${SCRIPT_SRC_DIR}/fserve.sh" --image "${IMAGE_NAME}" + +# Execute the script specified on the command-line +EXEC_RESULT=0 +if [[ "${EXEC_SCRIPT}" == "" ]]; then + fx-warn "No --exec script specified, will now clean up" +else + eval "${EXEC_SCRIPT}" "${EMULATOR_ADDRESS}" || EXEC_RESULT=$? +fi + +if [[ "${EXEC_RESULT}" != "0" ]]; then + fx-error "ERROR: \"${EXEC_SCRIPT}\" returned ${EXEC_RESULT}" + dump_femu_log +else + # Clean up the temporary file on success + if [[ "${FEMU_LOG_TEMP}" != "" ]]; then + rm -f "${FEMU_LOG_TEMP}" + fi +fi + +# Exit with the result of the test script, and also run the cleanup function +exit $EXEC_RESULT
diff --git a/third_party/fuchsia-sdk/bin/femu-meta.json b/third_party/fuchsia-sdk/bin/femu-meta.json new file mode 100644 index 0000000..ffe6de9 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/femu-meta.json
@@ -0,0 +1,18 @@ +{ + "files": [ + "bin/aemu.version", + "bin/grpcwebproxy.version", + "bin/femu.sh", + "bin/femu-exec-wrapper.sh", + "bin/fuchsia-common.sh", + "bin/fx-image-common.sh", + "bin/devshell/emu", + "bin/devshell/lib/image_build_vars.sh", + "bin/devshell/lib/fvm.sh", + "bin/devshell/lib/emu-ifup-macos.sh" + ], + "name": "femu", + "root": "bin", + "target_files": {}, + "type": "host_tool" +}
diff --git a/third_party/fuchsia-sdk/bin/femu.sh b/third_party/fuchsia-sdk/bin/femu.sh new file mode 100755 index 0000000..9c2f779 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/femu.sh
@@ -0,0 +1,186 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Enable error checking for all commands +err_print() { + echo "Error at $1" + stty sane +} +trap 'err_print $0:$LINENO' ERR +set -eu + +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? +FUCHSIA_BUCKET="${DEFAULT_FUCHSIA_BUCKET}" +IMAGE_NAME="qemu-x64" +VER_AEMU="$(cat "${SCRIPT_SRC_DIR}/aemu.version")" +VER_GRPCWEBPROXY="$(cat "${SCRIPT_SRC_DIR}/grpcwebproxy.version")" +ENABLE_GRPCWEBPROXY=0 +PREBUILT_GRPCWEBPROXY_DIR="" + +# Export variables needed here but also in femu.sh +FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" +export FUCHSIA_SDK_PATH +FUCHSIA_IMAGE_WORK_DIR="$(get-fuchsia-sdk-data-dir)" +export FUCHSIA_IMAGE_WORK_DIR + +# Download a URL $1 from CIPD, extract into directory $2 +function download-extract-cipd { + CIPD_URL="${1}" + CIPD_DIR="${2}" + CIPD_FILE="${2}.zip" + + if [ ! -f "${CIPD_FILE}" ]; then + echo "Downloading from ${CIPD_URL} ..." + curl -L "${CIPD_URL}" -o "${CIPD_FILE}" -# + echo "Verifying download ${CIPD_FILE}" + # CIPD will return a file containing "no such ref" if the URL is invalid, so need to check the ZIP file + if ! unzip -qq -t "${CIPD_FILE}" &> /dev/null; then + rm -f "${CIPD_FILE}" + fx-error "Downloaded archive from ${CIPD_URL} failed with invalid data - the version is probably invalid" + exit 1 + fi + echo "Download complete." + fi + if [ ! -d "${CIPD_DIR}" ]; then + echo -e "Extracting archive to ${CIPD_DIR} ..." + rm -rf "${CIPD_DIR}" "${CIPD_DIR}-temp" + unzip -q "${CIPD_FILE}" -d "${CIPD_DIR}-temp" + mv "${CIPD_DIR}-temp" "${CIPD_DIR}" + echo "Extract complete." + else + echo "Using existing archive in ${CIPD_DIR}" + fi +} + +emu_help () { + # Extract command-line argument help from emu script, similar to fx-print-command-help + sed -n -e 's/^## //p' -e 's/^##$//p' "${SCRIPT_SRC_DIR}/devshell/emu" | grep -v "usage: fx emu" +} + +usage () { + echo "Usage: $0" + echo " [--work-dir <directory to store image assets>]" + echo " Defaults to ${FUCHSIA_IMAGE_WORK_DIR}" + echo " [--bucket <fuchsia gsutil bucket>]" + echo " Defaults to ${FUCHSIA_BUCKET}" + echo " [--image <image name>]" + echo " Defaults to ${IMAGE_NAME}" + echo " [--authorized-keys <file>]" + echo " The authorized public key file for securing the device. Defaults to " + echo " ${FUCHSIA_IMAGE_WORK_DIR}/.ssh/authorized_keys, which is generated if needed." + echo " [--version <version>" + echo " Specify the CIPD version of AEMU to download." + echo " Defaults to aemu.version file with ${VER_AEMU}" + echo " [--help] [-h]" + echo " Show command line options for femu.sh and emu subscript" + echo + echo "Remaining arguments are passed to emu wrapper and emulator:" + emu_help + echo + echo "Invalid argument names are not flagged as errors, and are passed on to emulator" +} +AUTH_KEYS_FILE="" +EMU_ARGS=() + +# Parse command line +while (( "$#" )); do +case $1 in + --work-dir) + shift + FUCHSIA_IMAGE_WORK_DIR="${1:-.}" + ;; + --bucket) + shift + FUCHSIA_BUCKET="${1}" + ;; + --image) + shift + IMAGE_NAME="${1}" + ;; + --authorized-keys) + shift + AUTH_KEYS_FILE="${1}" + ;; + --version) + shift + VER_AEMU="${1}" + ;; + --help|-h) + usage + exit 0 + ;; + -x) + shift + ENABLE_GRPCWEBPROXY=1 + EMU_ARGS+=( -x "$1" ) + ;; + -X) + shift + PREBUILT_GRPCWEBPROXY_DIR="$1" + ;; + *) + # Unknown options are passed to emu + EMU_ARGS+=( "$1" ) + ;; +esac +shift +done + +if [[ "${AUTH_KEYS_FILE}" != "" ]]; then + auth_keys_file="${AUTH_KEYS_FILE}" +else + auth_keys_file="$(get-fuchsia-auth-keys-file)" +fi + +# Download the system images and packages +echo "Checking for system images and packages" +"${SCRIPT_SRC_DIR}/fpave.sh" --prepare --image "${IMAGE_NAME}" --bucket "${FUCHSIA_BUCKET}" --work-dir "${FUCHSIA_IMAGE_WORK_DIR}" +"${SCRIPT_SRC_DIR}/fserve.sh" --prepare --image "${IMAGE_NAME}" --bucket "${FUCHSIA_BUCKET}" --work-dir "${FUCHSIA_IMAGE_WORK_DIR}" + +# Do not create directory names with : otherwise LD_PRELOAD usage in aemu will fail. +# Avoid / to prevent extra sub-directories being created. +LABEL_AEMU="$(echo "${VER_AEMU}" | tr ':/' '_')" +LABEL_GRPCWEBPROXY="$(echo "${VER_GRPCWEBPROXY}" | tr ':/' '_')" + +# Download CIPD prebuilt binaries if not already present +DOWNLOADS_DIR="${FUCHSIA_IMAGE_WORK_DIR}/emulator" +mkdir -p "${DOWNLOADS_DIR}" +if is-mac; then + ARCH="mac-amd64" +else + ARCH="linux-amd64" +fi + +# Export variables needed for fx emu and fx-image-common.sh +export FUCHSIA_BUILD_DIR="${FUCHSIA_IMAGE_WORK_DIR}/image" +export PREBUILT_AEMU_DIR="${DOWNLOADS_DIR}/aemu-${ARCH}-${LABEL_AEMU}" + +download-extract-cipd \ + "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/aemu/${ARCH}/+/${VER_AEMU}" \ + "${PREBUILT_AEMU_DIR}" + +if (( ENABLE_GRPCWEBPROXY )); then + if [[ -z "$PREBUILT_GRPCWEBPROXY_DIR" ]]; then + PREBUILT_GRPCWEBPROXY_DIR="${DOWNLOADS_DIR}/grpcwebproxy-${ARCH}-${LABEL_GRPCWEBPROXY}" + download-extract-cipd \ + "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/grpcwebproxy/${ARCH}/+/${VER_GRPCWEBPROXY}" \ + "${PREBUILT_GRPCWEBPROXY_DIR}" + fi + EMU_ARGS+=( "-X" "${PREBUILT_GRPCWEBPROXY_DIR}" ) +fi + +# Need to make the SDK storage-full.blk writable so that the copy is writable as well, otherwise fvm extend fails in lib/fvm.sh +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fx-image-common.sh" +echo "Setting writable permissions on $FUCHSIA_BUILD_DIR/$IMAGE_FVM_RAW" +chmod u+w "$FUCHSIA_BUILD_DIR/$IMAGE_FVM_RAW" + +if (( "${#EMU_ARGS[@]}" )); then + "${SCRIPT_SRC_DIR}/devshell/emu" -k "${auth_keys_file}" "${EMU_ARGS[@]}" +else + "${SCRIPT_SRC_DIR}/devshell/emu" -k "${auth_keys_file}" +fi
diff --git a/third_party/fuchsia-sdk/bin/fpave-meta.json b/third_party/fuchsia-sdk/bin/fpave-meta.json new file mode 100644 index 0000000..0e1c90f --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fpave-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fpave.sh", + "bin/fuchsia-common.sh" + ], + "name": "fpave", + "root": "bin", + "target_files": {}, + "type": "host_tool" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/bin/fpave.sh b/third_party/fuchsia-sdk/bin/fpave.sh new file mode 100755 index 0000000..9cbf517 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fpave.sh
@@ -0,0 +1,241 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Command to pave a Fuchsia device. + +# note: set -e is not used in order to have custom error handling. +set -u + +# Source common functions +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" +FUCHSIA_IMAGE_WORK_DIR="$(get-fuchsia-sdk-data-dir)" + +DEVICE_NAME_FILTER="$(get-fuchsia-property device-name)" + +FUCHSIA_BUCKET="$(get-fuchsia-property bucket)" +if [[ "${FUCHSIA_BUCKET}" == "" ]]; then + FUCHSIA_BUCKET="${DEFAULT_FUCHSIA_BUCKET}" +fi + +IMAGE_NAME="$(get-fuchsia-property image)" +if [[ "${IMAGE_NAME}" == "" ]]; then + IMAGE_NAME="generic-x64" +fi + +function usage { + echo "Usage: $0" + echo " [--image <image name>"] + echo " Defaults to ${IMAGE_NAME}. Use --image list to list all available images." + echo " [--work-dir <working directory to store image assets>]" + echo " Defaults to ${FUCHSIA_IMAGE_WORK_DIR}." + echo " [--bucket <fuchsia gsutil bucket>]" + echo " Defaults to ${FUCHSIA_BUCKET}." + echo " [--authorized-keys <file>]" + echo " The authorized public key file for securing the device. Defaults to " + echo " ${FUCHSIA_IMAGE_WORK_DIR}/.ssh/authorized_keys, which is generated if needed." + echo " [--private-key <identity file>]" + echo " Uses additional private key when using ssh to access the device." + echo " [--device-name <device hostname>]" + echo " Only paves a device with the given device hostname." + if [[ "${DEVICE_NAME_FILTER}" != "" ]]; then + echo " Defaults to ${DEVICE_NAME_FILTER}." + fi + echo " [--prepare]" + echo " Downloads any dependencies but does not pave to a device." + echo " [--zedboot]" + echo " Updates the Zedboot bootloader and exits." + echo " [-x] Enable debug." +} + +PRIVATE_KEY_FILE="" +PREPARE_ONLY="" +AUTH_KEYS_FILE="" +UPDATE_ZEDBOOT="" + + +# Parse command line +while (( "$#" )); do +case $1 in + --work-dir) + shift + FUCHSIA_IMAGE_WORK_DIR="${1:-.}" + ;; + --bucket) + shift + FUCHSIA_BUCKET="${1}" + ;; + --image) + shift + IMAGE_NAME="${1}" + ;; + --authorized-keys) + shift + AUTH_KEYS_FILE="${1}" + ;; + --private-key) + shift + PRIVATE_KEY_FILE="${1}" + ;; + --device-name) + DEVICE_NAME_FILTER="${1}" + shift + ;; + --prepare) + PREPARE_ONLY="yes" + ;; + --zedboot) + UPDATE_ZEDBOOT="yes" + ;; + -x) + set -x + ;; + *) + # unknown option + fx-error "Unknown option $1." + usage + exit 1 + ;; +esac +shift +done + + +if ! SDK_ID="$(get-sdk-version)"; then + fx-error "Could not get SDK version" + exit 1 +fi + +if [[ "${IMAGE_NAME}" == "list" ]]; then + if ! IMAGES="$(get-available-images "${SDK_ID}" "${FUCHSIA_BUCKET}")"; then + fx-error "Could not get list of available images for ${SDK_ID}" + exit 1 + fi + echo "Valid images for this SDK version are: ${IMAGES}." + exit 1 +fi + +FUCHSIA_TARGET_IMAGE="$(get-image-src-path "${SDK_ID}" "${IMAGE_NAME}")" +# The image tarball, we add the SDK ID to make it unique, and note the +# .tar.gz extension for packages vs .tgz extension for images. +IMAGE_FILENAME="${SDK_ID}_${IMAGE_NAME}.tgz" + +# Validate the image is found +if [[ ! -f "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}" ]] ; then + if ! run-gsutil ls "${FUCHSIA_TARGET_IMAGE}" >/dev/null 2>&1; then + echo "Image ${IMAGE_NAME} not found. Valid images for this SDK version are:" + if ! IMAGES="$(get-available-images "${SDK_ID}" "${FUCHSIA_BUCKET}")"; then + fx-error "Could not get list of available images for ${SDK_ID}" + exit 1 + fi + echo "${IMAGES}" + exit 2 + fi + + if ! run-gsutil cp "${FUCHSIA_TARGET_IMAGE}" "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}"; then + fx-error "Could not copy image from ${FUCHSIA_TARGET_IMAGE} to ${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}." + exit 2 + fi +else + echo "Skipping download, image exists." +fi + +# The checksum file contains the output from `md5`. This is used to detect content +# changes in the image file. +CHECKSUM_FILE="${FUCHSIA_IMAGE_WORK_DIR}/image/image.md5" + +# check that any existing contents of the image directory match the intended target device +if [[ -f "${CHECKSUM_FILE}" ]]; then + if [[ $(run-md5 "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}") != "$(< "${CHECKSUM_FILE}")" ]]; then + fx-warn "Removing old image files." + if ! rm -f "$(cut -d ' ' -f3 "${CHECKSUM_FILE}")"; then + fx-error "Could not clean up old image archive." + exit 2 + fi + if ! rm -rf "${FUCHSIA_IMAGE_WORK_DIR}/image"; then + fx-error "Could not clean up old image." + exit 2 + fi + fi +else + # if the checksum file does not exist, something is inconsistent. + # so delete the entire directory to make sure we're starting clean. + # This also happens on a clean run, where the image directory does not + # exist. + if ! rm -rf "${FUCHSIA_IMAGE_WORK_DIR}/image"; then + fx-error "Could not clean up old image." + exit 2 + fi +fi + +if ! mkdir -p "${FUCHSIA_IMAGE_WORK_DIR}/image"; then + fx-error "Could not create image directory." + exit 2 +fi + +# if the tarball is not untarred, do it. +if [[ ! -f "${FUCHSIA_IMAGE_WORK_DIR}/image/pave.sh" ]]; then + if ! tar xzf "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}" --directory "${FUCHSIA_IMAGE_WORK_DIR}/image"; then + fx-error "Could not extract image from ${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}." + exit 1 + fi + run-md5 "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}" > "${CHECKSUM_FILE}" +fi + +# Exit out if we only need to prepare the downloads +if [[ "${PREPARE_ONLY}" == "yes" ]]; then + exit 0 +fi + +SSH_ARGS=() + +if [[ "${PRIVATE_KEY_FILE}" != "" ]]; then + SSH_ARGS+=( "-i" "${PRIVATE_KEY_FILE}") +fi + +# Get the device IP address. If we can't find it, it could be at the zedboot +# page, so it is not fatal. +# Explicitly pass the sdk path to match the device_filter. +DEVICE_IP=$(get-device-ip-by-name "$FUCHSIA_SDK_PATH" "$DEVICE_NAME_FILTER") +if [[ "$?" && -n "$DEVICE_IP" ]]; then + SSH_ARGS+=( "${DEVICE_IP}" dm reboot-recovery ) + ssh-cmd "${SSH_ARGS[@]}" + fx-warn "Confirm device is rebooting into recovery mode. Paving may fail if device is not in Zedboot." +else + fx-warn "Device not detected. Make sure the device is connected and at the 'Zedboot' screen." +fi + +# The prebuilt images do not have a bootserver for mac, so overwrite the bootserver with the +# mac bootserver. See fxb/48346. +if is-mac; then + cp -f "${FUCHSIA_SDK_PATH}/tools/bootserver" "${FUCHSIA_IMAGE_WORK_DIR}/image/bootserver.exe.linux-x64" +fi + + +if [[ "${UPDATE_ZEDBOOT}" == "yes" ]]; then + PAVE_CMD=("${FUCHSIA_IMAGE_WORK_DIR}/image/pave-zedboot.sh") +else + PAVE_CMD=("${FUCHSIA_IMAGE_WORK_DIR}/image/pave.sh") +fi + +if [[ "${AUTH_KEYS_FILE}" != "" ]]; then + auth_keys_file="${AUTH_KEYS_FILE}" +else + auth_keys_file="$(get-fuchsia-auth-keys-file)" +fi + +PAVE_CMD+=("--authorized-keys" "${auth_keys_file}" "-1") +if ! "${PAVE_CMD[@]}"; then + # Currently there is a bug on the first attempt of paving, so retry. + sleep .33 + if ! "${PAVE_CMD[@]}"; then + exit 2 + fi +fi
diff --git a/third_party/fuchsia-sdk/bin/fpublish-meta.json b/third_party/fuchsia-sdk/bin/fpublish-meta.json new file mode 100644 index 0000000..2dcb339 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fpublish-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fpublish.sh", + "bin/fuchsia-common.sh" + ], + "name": "fpublish", + "root": "bin", + "target_files": {}, + "type": "host_tool" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/bin/fpublish.sh b/third_party/fuchsia-sdk/bin/fpublish.sh new file mode 100755 index 0000000..278c04e --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fpublish.sh
@@ -0,0 +1,52 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Command to publish a package to make is accessible to a Fuchsia device. + +# note: set -e is not used in order to have custom error handling. +set -u + +# Source common functions +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" +FUCHSIA_IMAGE_WORK_DIR="$(get-fuchsia-sdk-data-dir)" + +usage () { + echo "Usage: $0 <files.far>" + echo " [--work-dir <working directory to store image assets>]" + echo " Defaults to ${FUCHSIA_IMAGE_WORK_DIR}" +} + +POSITIONAL=() + +# Parse command line +while (( "$#" )); do +case $1 in + --work-dir) + shift + FUCHSIA_IMAGE_WORK_DIR="${1}" + ;; + -*) + if [[ "${#POSITIONAL[@]}" -eq 0 ]]; then + echo "Unknown option ${1}" + usage + exit 1 + else + POSITIONAL+=("${1}") + fi + ;; + *) + POSITIONAL+=("${1}") + ;; +esac +shift +done + +"${FUCHSIA_SDK_PATH}/tools/pm" publish -a -r "${FUCHSIA_IMAGE_WORK_DIR}/packages/amber-files" -f "${POSITIONAL[@]}";
diff --git a/third_party/fuchsia-sdk/bin/fserve-meta.json b/third_party/fuchsia-sdk/bin/fserve-meta.json new file mode 100644 index 0000000..95b850e --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fserve-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fserve.sh", + "bin/fuchsia-common.sh" + ], + "name": "fserve", + "root": "bin", + "target_files": {}, + "type": "host_tool" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/bin/fserve-remote-meta.json b/third_party/fuchsia-sdk/bin/fserve-remote-meta.json new file mode 100644 index 0000000..0e0b43f --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fserve-remote-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fserve-remote.sh", + "bin/fuchsia-common.sh" + ], + "name": "fserve-remote", + "root": "bin", + "target_files": {}, + "type": "host_tool" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/bin/fserve-remote.sh b/third_party/fuchsia-sdk/bin/fserve-remote.sh new file mode 100755 index 0000000..2ff78c1 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fserve-remote.sh
@@ -0,0 +1,158 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +set -eu + +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +usage() { + cat << EOF +usage: fserve-remote.sh [--no-serve] [--device-name <device hostname>] HOSTNAME REMOTE-PATH + Uses SSH port forwarding to connect to a remote server and forward package serving and other connections to a local device. + + --device-name <device hostname> + Connects to a device by looking up the given device hostname. + --image <image name> + Name of prebuilt image packages to serve. + --bucket <bucket name> + Name of GCS bucket containing the image archive. + --no-serve + Only tunnel, do not start a package server. + + HOSTNAME + The hostname of the workstation you want to serve from + REMOTE-PATH + The path to the Fuchsia GN SDK bin directory on "HOSTNAME" +EOF +} + +START_SERVE=1 +REMOTE_HOST="" +REMOTE_DIR="" +DEVICE_NAME="$(get-fuchsia-property device-name)" +FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" +BUCKET="$(get-fuchsia-property bucket)" +IMAGE="$(get-fuchsia-property image)" + +while [[ $# -ne 0 ]]; do + case "$1" in + --help|-h) + usage + exit 0 + ;; + --no-serve) + START_SERVE=0 + ;; + --device-name) + shift + DEVICE_NAME="${1}" + ;; + --bucket) + shift + BUCKET="${1}" + ;; + --image) + shift + IMAGE="${1}" + ;; + -*) + fx-error "Unknown flag: $1" + usage + exit 1 + ;; + *) + if [[ -z "${REMOTE_HOST}" ]]; then + REMOTE_HOST="$1" + elif [[ -z "${REMOTE_DIR}" ]]; then + REMOTE_DIR="$1" + else + fx-error "unexpected argument: '$1'" + usage + fi + ;; + esac + shift +done + +if [[ -z "${REMOTE_HOST}" ]]; then + fx-error "HOSTNAME must be specified" + usage + exit 1 +fi + +if ((START_SERVE)); then + if [[ -z "${REMOTE_DIR}" ]]; then + fx-error "REMOTE-DIR must be specified" + usage + exit 1 + fi +fi + +if [[ "${DEVICE_NAME}" == "" ]]; then + DEVICE_NAME="$(get-device-name)" +fi +# Determine the local device name/address to use. +if ! DEVICE_IP=$(get-device-ip-by-name "$FUCHSIA_SDK_PATH" "${DEVICE_NAME}"); then + fx-error "unable to discover device. Is the target up?" + exit 1 +fi + +if [[ -z "${DEVICE_IP}" ]]; then + fx-error "unable to discover device. Is the target up?" + exit 1 +fi + +echo "Using remote ${REMOTE_HOST}:${REMOTE_DIR}" +echo "Using target device ${DEVICE_NAME}" + +# First we need to check if we already have a control master for the +# host, if we do, we might already have the forwards and so we don't +# need to worry about tearing down: +if ! ssh -O check "${REMOTE_HOST}" > /dev/null 2>&1; then + # If we didn't have a control master, and the device already has 8022 + # bound, then there's a good chance there's a stale sshd instance + # running from another device or another session that will block the + # forward, so we'll check for that and speculatively attempt to clean + # it up. Unfortunately this means authing twice, but it's likely the + # best we can do for now. + if ssh "${REMOTE_HOST}" 'ss -ln | grep :8022' > /dev/null; then + ssh "${REMOTE_HOST}" "pkill -u \$USER sshd" + ssh "${REMOTE_HOST}" -O exit > /dev/null 2>&1 + fi +fi + +args=( + -6 # We want ipv6 binds for the port forwards + -L "\*:8083:localhost:8083" # requests to the package server address locally go to the workstation + -R "8022:[${DEVICE_IP}]:22" # requests from the workstation to ssh to localhost:8022 will make it to the target + -o "ExitOnForwardFailure=yes" + "${REMOTE_HOST}" +) + +# If the user requested serving, then we'll check to see if there's a +# server already running and kill it, this prevents most cases where +# signal propagation seems to sometimes not make it to "pm". +if ((START_SERVE)) && ssh "${args[@]}" 'ss -ln | grep :8083' > /dev/null; then + ssh "${args[@]}" "pkill -u \$USER pm" +fi + +if ((START_SERVE)); then + # Starts a package server + args+=(cd "${REMOTE_DIR}" "&&" ./bin/fconfig.sh set device-ip 127.0.0.1 "&&" ./bin/fserve.sh) + if [[ "${BUCKET}" != "" ]]; then + args+=(--bucket "${BUCKET}") + fi + if [[ "${IMAGE}" ]]; then + args+=(--image "${IMAGE}") + fi +else + # Starts nothing, just goes to sleep + args+=("-nNT") +fi + +ssh "${args[@]}"
diff --git a/third_party/fuchsia-sdk/bin/fserve.sh b/third_party/fuchsia-sdk/bin/fserve.sh new file mode 100755 index 0000000..f0bacb2 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fserve.sh
@@ -0,0 +1,257 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -eu + +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" +FUCHSIA_IMAGE_WORK_DIR="$(get-fuchsia-sdk-data-dir)" +FUCHSIA_BUCKET="$(get-fuchsia-property bucket)" +if [[ "${FUCHSIA_BUCKET}" == "" ]]; then + FUCHSIA_BUCKET="${DEFAULT_FUCHSIA_BUCKET}" +fi + +FUCHSIA_SERVER_PORT="8083" + +IMAGE_NAME="$(get-fuchsia-property image)" +if [[ "${IMAGE_NAME}" == "" ]]; then + IMAGE_NAME="generic-x64" +fi + +usage () { + echo "Usage: $0" + echo " [--work-dir <directory to store image assets>]" + echo " Defaults to ${FUCHSIA_IMAGE_WORK_DIR}" + echo " [--bucket <fuchsia gsutil bucket>]" + echo " Defaults to ${FUCHSIA_BUCKET}" + echo " [--image <image name>]" + echo " Defaults to ${IMAGE_NAME}. Use --image list to list all available images." + echo " [--private-key <identity file>]" + echo " Uses additional private key when using ssh to access the device." + echo " [--server-port <port>]" + echo " Port number to use when serving the packages. Defaults to ${FUCHSIA_SERVER_PORT}." + echo " [--device-name <device hostname>]" + echo " Only serves packages to a device with the given device hostname. Cannot be used with --device-ip." + echo " [--device-ip <device ip>]" + echo " Only serves packages to a device with the given device ip address. Cannot be used with --device-name." + echo " [--kill]" + echo " Kills any existing package manager server" + echo " [--prepare]" + echo " Downloads any dependencies but does not start the package server" + echo " [-x] Enable debug." +} + +PRIVATE_KEY_FILE="" +PREPARE_ONLY="" +DEVICE_NAME_FILTER="$(get-fuchsia-property device-name)" +DEVICE_IP_ADDR="$(get-fuchsia-property device-ip)" + +# Parse command line +while (( "$#" )); do +case $1 in + --work-dir) + shift + FUCHSIA_IMAGE_WORK_DIR="${1:-.}" + ;; + --bucket) + shift + FUCHSIA_BUCKET="${1}" + ;; + --image) + shift + IMAGE_NAME="${1}" + ;; + --private-key) + shift + PRIVATE_KEY_FILE="${1}" + ;; + --server-port) + shift + FUCHSIA_SERVER_PORT="${1}" + ;; + --device-name) + shift + DEVICE_NAME_FILTER="${1}" + ;; + --device-ip) + shift + DEVICE_IP_ADDR="${1}" + ;; + --kill) + kill-running-pm + exit 0 + ;; + --prepare) + PREPARE_ONLY="yes" + ;; + -x) + set -x + ;; + *) + # unknown option + usage + exit 1 + ;; +esac +shift +done + +if [[ "${DEVICE_IP_ADDR}" != "" && "${DEVICE_NAME_FILTER}" != "" ]]; then + fx-error "Cannot use both --device-name and --device-ip". + exit 1 +fi + +if ! SDK_ID="$(get-sdk-version)"; then + fx-error "Could not get SDK version" + exit 1 +fi + +if [[ "${IMAGE_NAME}" == "list" ]]; then + if ! IMAGES="$(get-available-images "${SDK_ID}" "${FUCHSIA_BUCKET}")"; then + fx-error "Could not get list of available images for ${SDK_ID}" + exit 1 + fi + echo "Valid images for this SDK version are: ${IMAGES}." + exit 1 +fi + +# The package tarball. We add the SDK ID to the filename to make them +# unique. +# +# Consider cleaning up old tarballs when getting a new one? +# + +FUCHSIA_TARGET_PACKAGES=$(get-package-src-path "${SDK_ID}" "${IMAGE_NAME}") +# The package tarball, we add the SDK ID to make it unique, and note the +# .tar.gz extension for packages vs .tgz extension for images. +IMAGE_FILENAME="${SDK_ID}_${IMAGE_NAME}.tar.gz" + +# Validate the image is found +if [[ ! -f "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}" ]] ; then + if ! run-gsutil ls "${FUCHSIA_TARGET_PACKAGES}" >/dev/null 2>&1; then + echo "Packages for ${IMAGE_NAME} not found. Valid images for this SDK version are:" + if ! IMAGES="$(get-available-images "${SDK_ID}" "${FUCHSIA_BUCKET}")"; then + fx-error "Could not get list of available images for ${SDK_ID}" + exit 1 + fi + echo "${IMAGES}" + exit 2 + fi + + if ! run-gsutil cp "${FUCHSIA_TARGET_PACKAGES}" "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}"; then + fx-error "Could not copy image from ${FUCHSIA_TARGET_PACKAGES} to ${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}." + exit 2 + fi +else + echo "Skipping download, packages tarball exists" +fi + +# The checksum file contains the output from `md5`. This is used to detect content +# changes in the packages file. +CHECKSUM_FILE="${FUCHSIA_IMAGE_WORK_DIR}/packages/packages.md5" + +# check that any existing contents of the image directory match the intended target device +if [[ -f "${CHECKSUM_FILE}" ]]; then + if [[ "$(run-md5 "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}")" != "$(cat "${CHECKSUM_FILE}")" ]]; then + fx-warn "Removing old package files." + if ! rm -f "$(cut -d ' ' -f3 "${CHECKSUM_FILE}")"; then + fx-error "Could not clean up old image archive." + exit 2 + fi + if ! rm -rf "${FUCHSIA_IMAGE_WORK_DIR}/packages"; then + fx-error "Could not clean up old image." + exit 2 + fi + fi +else + # if the checksum file does not exist, something is inconsistent. + # so delete the entire directory to make sure we're starting clean. + # This also happens on a clean run, where the packages directory does not + # exist. + if ! rm -rf "${FUCHSIA_IMAGE_WORK_DIR}/packages"; then + fx-error "Could not clean up old packages." + exit 2 + fi +fi + +if ! mkdir -p "${FUCHSIA_IMAGE_WORK_DIR}/packages"; then + fx-error "Could not create packages directory." + exit 2 +fi + +# if the tarball is not untarred, do it. +if [[ ! -d "${FUCHSIA_IMAGE_WORK_DIR}/packages/amber-files" ]]; then + if ! tar xzf "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}" --directory "${FUCHSIA_IMAGE_WORK_DIR}/packages"; then + fx-error "Could not extract image from ${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}." + exit 1 + fi + run-md5 "${FUCHSIA_IMAGE_WORK_DIR}/${IMAGE_FILENAME}" > "${CHECKSUM_FILE}" +fi + +# Exit out if we only need to prepare the downloads +if [[ "${PREPARE_ONLY}" == "yes" ]]; then + exit 0 +fi + +if [[ "${DEVICE_IP_ADDR}" != "" ]]; then + DEVICE_IP="${DEVICE_IP_ADDR}" +else + DEVICE_IP=$(get-device-ip-by-name "$FUCHSIA_SDK_PATH" "$DEVICE_NAME_FILTER") +fi + +if [[ ! "$?" || -z "$DEVICE_IP" ]]; then + fx-error "Could not get device IP address" + exit 2 +fi + +# get the host address as seen by the device. +ssh_args=("${DEVICE_IP}" echo "\$SSH_CONNECTION") +if ! connection_str="$(ssh-cmd "${ssh_args[@]}")"; then + fx-error "unable to determine host address as seen from the target. Is the target up?" + exit 1 +fi +HOST_IP="$(echo "$connection_str" | cut -d ' ' -f 1)" + +if [[ ! "$?" || -z "$HOST_IP" ]]; then + fx-error "Could not get Host IP address" + exit 2 +fi + +# A simple heuristic for "is an ipv6 address", URL encase escape +# the address. +if [[ "${HOST_IP}" =~ : ]]; then + HOST_IP="${HOST_IP//%/%25}" + HOST_IP="[${HOST_IP}]" +fi + +# kill existing pm if present +kill-running-pm + +# Start the package server +echo "** Starting package server in the background**" +# `:port` syntax is valid for Go programs that intend to serve on every +# interface on a given port. For example, if $FUCHSIA_SERVER_PORT is 54321, +# this is similar to serving on [::]:54321 or 0.0.0.0:54321. +"${FUCHSIA_SDK_PATH}/tools/pm" serve -repo "${FUCHSIA_IMAGE_WORK_DIR}/packages/amber-files" -l ":${FUCHSIA_SERVER_PORT}"& + +SSH_ARGS=() +if [[ "${PRIVATE_KEY_FILE}" != "" ]]; then + SSH_ARGS+=( "-i" "${PRIVATE_KEY_FILE}") +fi +SSH_ARGS+=( "${DEVICE_IP}" amber_ctl add_src -f "http://${HOST_IP}:${FUCHSIA_SERVER_PORT}/config.json" ) + +# Update the device to point to the server. +# Because the URL to config.json contains an IPv6 address, the address needs +# to be escaped in square brackets. This is not necessary for the ssh target, +# since that's just an address and not a full URL. +if ! ssh-cmd "${SSH_ARGS[@]}" ; then + fx-error "Error: could not update device" + exit 1 +fi
diff --git a/third_party/fuchsia-sdk/bin/fssh-meta.json b/third_party/fuchsia-sdk/bin/fssh-meta.json new file mode 100644 index 0000000..89eb29b --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fssh-meta.json
@@ -0,0 +1,10 @@ +{ + "files": [ + "bin/fssh.sh", + "bin/fuchsia-common.sh" + ], + "name": "fssh", + "root": "bin", + "target_files": {}, + "type": "host_tool" +}
diff --git a/third_party/fuchsia-sdk/bin/fssh.sh b/third_party/fuchsia-sdk/bin/fssh.sh new file mode 100755 index 0000000..27020c6 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fssh.sh
@@ -0,0 +1,98 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Command to SSH to a Fuchsia device. +set -eu + +# Source common functions +readonly MY_SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Fuchsia command common functions. +# shellcheck disable=SC1090 +source "${MY_SCRIPT_SRC_DIR}/fuchsia-common.sh" || exit $? + +readonly FUCHSIA_SDK_PATH="$(get-fuchsia-sdk-dir)" + +function usage { + echo "Usage: $0" + echo " [--device-name <device hostname>]" + echo " Connects to a device by looking up the given device hostname." + echo " [--device-ip <device ipaddr>]" + echo " Connects to a device by using the provided IP address, cannot use with --device-name" + echo " [--private-key <identity file>]" + echo " Uses additional private key when using ssh to access the device." +} + +PRIVATE_KEY_FILE="" +DEVICE_NAME_FILTER="$(get-fuchsia-property device-name)" +DEVICE_IP="$(get-fuchsia-property device-ip)" +POSITIONAL=() + + +# Parse command line +while (( "$#" )); do +case $1 in + --device-name) + shift + DEVICE_NAME_FILTER="${1}" + ;; + --device-ip) + shift + DEVICE_IP="${1}" + ;; + --private-key) + shift + PRIVATE_KEY_FILE="${1}" + ;; + -*) + if [[ "${#POSITIONAL[@]}" -eq 0 ]]; then + echo "Unknown option ${1}" + usage + exit 1 + else + POSITIONAL+=("${1}") + fi + ;; + *) + POSITIONAL+=("${1}") + ;; +esac +shift +done + +readonly PRIVATE_KEY_FILE +readonly DEVICE_NAME_FILTER +readonly DEVICE_IP +readonly POSITIONAL + +target_device_ip="${DEVICE_IP}" + +# Get the device IP address. +if [[ "${DEVICE_IP}" == "" ]]; then + # explicitly pass the sdk dir here. + target_device_ip=$(get-device-ip-by-name "$FUCHSIA_SDK_PATH" "$DEVICE_NAME_FILTER") + if [[ ! "$?" || -z "$target_device_ip" ]]; then + fx-error "Error finding device" + exit 2 + fi +else + if [[ "${DEVICE_NAME_FILTER}" != "" ]]; then + fx-error "Cannot specify both --device-name and --device-ip" + exit 3 + fi +fi + +ssh_args=() +# Build the command line +if [[ "${PRIVATE_KEY_FILE}" != "" ]]; then + ssh_args+=( "-i" "${PRIVATE_KEY_FILE}") +fi + +ssh_args+=( "${target_device_ip}" ) +if [[ "${#POSITIONAL[@]}" -ne 0 ]]; then + ssh_args+=( "${POSITIONAL[@]}" ) +fi + +ssh-cmd "${ssh_args[@]}"
diff --git a/third_party/fuchsia-sdk/bin/fuchsia-common.sh b/third_party/fuchsia-sdk/bin/fuchsia-common.sh new file mode 100755 index 0000000..275ddc5 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fuchsia-common.sh
@@ -0,0 +1,401 @@ +#!/bin/bash +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Helper functions, no environment specific functions should be included below +# this line. + +# Force all pipes to return any non-zero error code instead of just the last +set -e -o pipefail + +SCRIPT_SRC_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + + +DEFAULT_FUCHSIA_BUCKET="fuchsia" +SSH_BIN="$(command -v ssh)" +FUCHSIA_PROPERTY_NAMES=( + "bucket" # Used as the default for --bucket + "device-ip" # Used as the default for --device-ip + "device-name" # Used as the default for --device-name + "image" # Used as the default for image +) + +function is-mac { + [[ "$(uname -s)" == "Darwin" ]] && return 0 + return 1 +} + +# Add Mac specific support +if is-mac; then + # Fuchsia mac functions. + + realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" + } +fi +# Returns the fuchsia sdk root dir. Assuming this script is in ${FUCHSIA_SDK}/bin. +function get-fuchsia-sdk-dir { + dirname "${SCRIPT_SRC_DIR}" +} + +# Returns the data directory for the fuchsia sdk. +# This directory is expected to be per-developer, not checked into source code revision systems, +# and is used to store device images and packages and related data items. +# The default is $HOME/.fuchsia. This can be overridden by setting the environment variable +# FUCHSIA_SDK_DATA_DIR. +function get-fuchsia-sdk-data-dir { + local data_dir="${FUCHSIA_SDK_DATA_DIR:-}" + if [[ -z "${data_dir}" ]]; then + data_dir="${HOME}/.fuchsia" + if [[ ! -d "${data_dir}" ]]; then + mkdir -p "${data_dir}" + fi + fi + echo "${data_dir}" +} + +# fx-warn prints a line to stderr with a yellow WARNING: prefix. +function fx-warn { + if [[ -t 2 ]]; then + echo -e >&2 "\033[1;33mWARNING:\033[0m $*" + else + echo -e >&2 "WARNING: $*" + fi +} + +# fx-error prints a line to stderr with a red ERROR: prefix. +function fx-error { + if [[ -t 2 ]]; then + echo -e >&2 "\033[1;31mERROR:\033[0m $*" + else + echo -e >&2 "ERROR: $*" + fi +} + +function get-fuchsia-property-names { + echo "${FUCHSIA_PROPERTY_NAMES[@]}" +} + +function is-valid-fuchsia-property { + [[ "${FUCHSIA_PROPERTY_NAMES[*]}" =~ $1 ]] +} + +function set-fuchsia-property { + local prop_path + prop_path="$(get-fuchsia-sdk-data-dir)/.properties/$1.txt" + if ! mkdir -p "$(dirname "${prop_path}")"; then + fx-error "Cannot write property to $prop_path" + exit 1 + fi + echo "$2" > "${prop_path}" +} + +function get-fuchsia-property { + local prop_path + prop_path="$(get-fuchsia-sdk-data-dir)/.properties/$1.txt" + if [[ -e "${prop_path}" ]]; then + cat "${prop_path}" + else + echo "" + fi +} + +function ssh-cmd { + check-fuchsia-ssh-config + "${SSH_BIN}" -F "$(get-fuchsia-sshconfig-file)" "$@" +} + +function get-device-ip { + # $1 is the SDK_PATH (optional. defaults to get-fuchsia-sdk-dir) + # -ipv4 false: Disable IPv4. Fuchsia devices are IPv6-compatible, so + # forcing IPv6 allows for easier manipulation of the result. + local device_addr + device_addr="$(get-fuchsia-property device-addr)" + if [[ "${device_addr}" != "" ]]; then + echo "${device_addr}" + return 0 + else + "${1-$(get-fuchsia-sdk-dir)}/tools/device-finder" list -netboot -device-limit 1 -ipv4=false + fi +} + +function get-device-name { + # $1 is the SDK_PATH (optional. defaults to get-fuchsia-sdk-dir) + # Check for a device name being configured. + local device_name + if ! device_name="$(get-fuchsia-property device-name)"; then + return $? + fi + if [[ "${device_name}" != "" ]]; then + echo "${device_name}" + return 0 + else + if device_name="$("${1-$(get-fuchsia-sdk-dir)}/tools/device-finder" list -netboot -device-limit 1 -full)"; then + echo "${device_name}" | cut -d' ' -f2 + fi + fi +} + +function get-device-ip-by-name { + # Writes the IP address of the device with the given name. + # If no such device is found, this function returns with a non-zero status + # code. + + # $1 is the SDK_PATH, if specified else get-fuchsia-sdk-dir value is used. + # $2 is the hostname of the Fuchsia device. If $2 is empty, this function + # returns the IP address of an arbitrarily selected Fuchsia device. + + if [[ "${#}" -ge 2 && -n "$2" ]]; then + # There should typically only be one device that matches the nodename + # but we add a device-limit to speed up resolution by exiting when the first + # candidate is found. + "${1-$(get-fuchsia-sdk-dir)}/tools/device-finder" resolve -device-limit 1 -ipv4=false -netboot "${2}" + else + if [[ "${#}" -ge 1 && -n "$1" ]]; then + get-device-ip "$1" + else + get-device-ip + fi + fi +} + +function get-host-ip { + # $1 is the SDK_PATH, if specified else get-fuchsia-sdk-dir value is used. + # $2 is the hostname of the Fuchsia device. If $2 is empty, this function + # returns the IP address of an arbitrarily selected Fuchsia device. + local DEVICE_NAME + if [[ "${#}" -ge 2 && "${2}" != "" ]]; then + DEVICE_NAME="${2}" + else + DEVICE_NAME="$(get-device-name "${1-$(get-fuchsia-sdk-dir)}")" + fi + # -ipv4 false: Disable IPv4. Fuchsia devices are IPv6-compatible, so + # forcing IPv6 allows for easier manipulation of the result. + # cut: Remove the IPv6 scope, if present. For link-local addresses, the scope + # effectively describes which interface a device is connected on. Since + # this information is device-specific (i.e. the Fuchsia device refers to + # the development host with a different scope than vice versa), we can + # strip this from the IPv6 result. This is reliable as long as the Fuchsia + # device only needs link-local networking on one interface. + "${1-$(get-fuchsia-sdk-dir)}/tools/device-finder" resolve -local -ipv4=false "${DEVICE_NAME}" | head -1 | cut -d '%' -f1 +} + +function get-sdk-version { + # Get the Fuchsia SDK id + # $1 is the SDK_PATH, if specified else get-fuchsia-sdk-dir value is used. + local FUCHSIA_SDK_METADATA="${1-$(get-fuchsia-sdk-dir)}/meta/manifest.json" + if ! SDK_VERSION="$(grep \"id\": "${FUCHSIA_SDK_METADATA}" | cut -d\" -f4)"; then + return 1 + fi + echo "${SDK_VERSION}" +} + +function get-package-src-path { + # $1 is the SDK ID. See #get-sdk-version. + # $2 is the image name. + echo "gs://${FUCHSIA_BUCKET}/development/${1}/packages/${2}.tar.gz" +} + +function get-image-src-path { + # $1 is the SDK ID. See #get-sdk-version. + # $2 is the image name. + echo "gs://${FUCHSIA_BUCKET}/development/${1}/images/${2}.tgz" +} + +# Run gsutil from the directory of this script if it exists, otherwise +# use the path. +function run-gsutil { + GSUTIL_BIN="${SCRIPT_SRC_DIR}/gsutil" + if [[ ! -e "${GSUTIL_BIN}" ]]; then + GSUTIL_BIN="$(command -v gsutil)" + fi + if [[ ! -e "${GSUTIL_BIN}" ]]; then + GSUTIL_BIN="$(command -v gsutil.py)" + fi + + if [[ "${GSUTIL_BIN}" == "" ]]; then + fx-error "Cannot find gsutil." + exit 2 + fi + + # Prevent gsutil prompting for updates by making stdin not a TTY + "${GSUTIL_BIN}" "$@" < /dev/null +} + +# Run cipd from the directory of this script if it exists, otherwise +# use the path. +function run-cipd { + CIPD_BIN="${SCRIPT_SRC_DIR}/cipd" + if [[ ! -e "${CIPD_BIN}" ]]; then + CIPD_BIN="$(command -v cipd)" + fi + + if [[ "${CIPD_BIN}" == "" ]]; then + fx-error "Cannot find cipd." + exit 2 + fi + "${CIPD_BIN}" "$@" +} + +# Runs md5sum or equivalent on mac. +function run-md5 { + if is-mac; then + MD5_CMD=("/sbin/md5" "-r") + else + MD5_CMD=("md5sum") + fi + + MD5_CMD+=("$@") + + "${MD5_CMD[@]}" +} + +function get-available-images { + # $1 is the SDK ID. + # $2 is the bucket, or uses the default. + local IMAGES=() + local BUCKET="" + + BUCKET="${2:-${DEFAULT_FUCHSIA_BUCKET}}" + GSURL="gs://${BUCKET}/development/${1}/images" + if ! RESULTS=$(run-gsutil "ls" "${GSURL}" | cut -d/ -f7 | tr '\n' ' '); then + return 1 + fi + if [[ "${RESULTS}" == "" ]]; then + return 2 + fi + for f in ${RESULTS}; do + IMAGES+=("${f%.*}") + done + if [[ "${BUCKET}" != "${DEFAULT_FUCHSIA_BUCKET}" ]]; then + echo -n "${IMAGES[*]} " + get-available-images "${1}" "${DEFAULT_FUCHSIA_BUCKET}" + else + echo "${IMAGES[*]}" + fi +} + +function kill-running-pm { + local PM_PROCESS=() + IFS=" " read -r -a PM_PROCESS <<< "$(pgrep -ax pm)" + if [[ ${#PM_PROCESS[@]} -gt 0 && -n "${PM_PROCESS[*]}" ]]; then + # mac only provides the pid, not the name + if is-mac; then + fx-warn "Killing existing pm process" + kill "${PM_PROCESS[0]}" + return $? + elif [[ ${#PM_PROCESS[@]} -gt 1 && "${PM_PROCESS[1]}" == *"tools/pm" ]]; then + fx-warn "Killing existing pm process" + kill "${PM_PROCESS[0]}" + return $? + fi + else + fx-warn "existing pm process not found" + fi + return 0 +} + +function check-fuchsia-ssh-config { + # This function creates the ssh keys needed to + # work with devices running Fuchsia. There are two parts, the keys and the config. + # + # The keys are stored in the Fuchsia SDK data directory in a directory named .ssh. + # This is the same structure as used "in-tree" for Fuchsia development. You can copy the + # keys from the other directory to make the keys identical, allowing SSH access using both + # SDK commands and in-tree "fx" commands. + # + # The authorized key file used for paving is in .ssh/authorized_keys. + # The private key used when ssh'ing to the device is in .ssh/pkey. + # + # + # The second part of is the sshconfig file used by the SDK when using SSH. + # This is stored in the Fuchsia SDK data directory named sshconfig. + # This script checks for the private key file being referenced in the sshconfig and + # the matching version tag. If they are not present, the sshconfig file is regenerated. + # The ssh configuration should not be modified. + local SSHCONFIG_TAG="Fuchsia SDK config version 2 tag" + + local ssh_dir + ssh_dir="$(get-fuchsia-sdk-data-dir)/.ssh" + local authfile="${ssh_dir}/authorized_keys" + local keyfile="${ssh_dir}/pkey" + local sshconfig_file + sshconfig_file="$(get-fuchsia-sdk-data-dir)/sshconfig" + + if [[ -e "${authfile}" && -e "${keyfile}" ]]; then + if grep "${keyfile}" "${sshconfig_file}" > /dev/null 2>&1; then + if grep "${SSHCONFIG_TAG}" "${sshconfig_file}" > /dev/null 2>&1; then + return 0 + fi + fi + fi + + mkdir -p "${ssh_dir}" + if [[ ! -f "${authfile}" ]]; then + if [[ ! -f "${keyfile}" ]]; then + if ! result="$(ssh-keygen -P "" -t ed25519 -f "${keyfile}" -C "${USER}@$(hostname -f)" 2>&1)"; then + fx-error "${result}" + return 1 + fi + fi + if ! result="$(ssh-keygen -y -f "${keyfile}" > "${authfile}" 2>&1)"; then + fx-error "${result}" + return 1 + fi + fi + + cat >"${sshconfig_file}" <<EOF +# ${SSHCONFIG_TAG} +# Configure port 8022 for connecting to a device with the local address. +# This makes it possible to forward 8022 to a device connected remotely. +Host 127.0.0.1 + Port 8022 + +Host ::1 + Port 8022 + +Host * +# Turn off refusing to connect to hosts whose key has changed +StrictHostKeyChecking no +CheckHostIP no + +# Disable recording the known hosts +UserKnownHostsFile=/dev/null + +# Do not forward auth agent connection to remote, no X11 +ForwardAgent no +ForwardX11 no + +# Connection timeout in seconds +ConnectTimeout=10 + +# Check for server alive in seconds, max count before disconnecting +ServerAliveInterval 1 +ServerAliveCountMax 10 + +# Try to keep the master connection open to speed reconnecting. +ControlMaster auto +ControlPersist yes +ControlPath=/tmp/fuchsia--%r@%h:%p + +# Connect with user, use the identity specified. +User fuchsia +IdentitiesOnly yes +IdentityFile "${keyfile}" +GSSAPIDelegateCredentials no + +EOF + + return 0 +} + +function get-fuchsia-auth-keys-file { + check-fuchsia-ssh-config + echo "$(get-fuchsia-sdk-data-dir)/.ssh/authorized_keys" +} + +function get-fuchsia-sshconfig-file { + check-fuchsia-ssh-config + echo "$(get-fuchsia-sdk-data-dir)/sshconfig" +}
diff --git a/third_party/fuchsia-sdk/bin/fx-image-common.sh b/third_party/fuchsia-sdk/bin/fx-image-common.sh new file mode 100755 index 0000000..238670d --- /dev/null +++ b/third_party/fuchsia-sdk/bin/fx-image-common.sh
@@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Requires FUCHSIA_IMAGE_WORK_DIR and FUCHSIA_SDK_PATH to be defined + +# fx commands require environment variables to be defined +if [[ "${FUCHSIA_IMAGE_WORK_DIR}" == "" ]]; then + fx-error "FUCHSIA_IMAGE_WORK_DIR must be defined before sourcing this script" + exit 1 +fi +if [[ "${FUCHSIA_SDK_PATH}" == "" ]]; then + fx-error "FUCHSIA_SDK_PATH must be defined before sourcing this script" + exit 1 +fi + +# Variables expected by fx emu +ZIRCON_TOOLS_DIR="${FUCHSIA_SDK_PATH}/tools" +# shellcheck disable=SC2034 +FUCHSIA_DIR="${FUCHSIA_SDK_PATH}/bin" +# shellcheck disable=SC2034 +HOST_OUT_DIR="${FUCHSIA_SDK_PATH}/tools" +# shellcheck disable=SC2034 +IMAGE_ZIRCONA_ZBI="zircon-a.zbi" +# shellcheck disable=SC2034 +IMAGE_QEMU_KERNEL_RAW="qemu-kernel.kernel" +# shellcheck disable=SC2034 +IMAGE_FVM_RAW="storage-full.blk" +# TODO(fxb/43807): Replace FUCHSIA_ARCH with detecting the architecture, currently only tested with *-x64 images +# shellcheck disable=SC2034 +FUCHSIA_ARCH="x64" + +# Provide fx-zbi functionality using the SDK zbi tool +function fx-zbi { + "${ZIRCON_TOOLS_DIR}/zbi" "$@" +}
diff --git a/third_party/fuchsia-sdk/bin/grpcwebproxy.version b/third_party/fuchsia-sdk/bin/grpcwebproxy.version new file mode 100644 index 0000000..630d806 --- /dev/null +++ b/third_party/fuchsia-sdk/bin/grpcwebproxy.version
@@ -0,0 +1 @@ +git_revision:c71ae8fa744867b49f83d4c128a8facb96c9c848 \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/build/cmc.gni b/third_party/fuchsia-sdk/build/cmc.gni new file mode 100644 index 0000000..c5cc735 --- /dev/null +++ b/third_party/fuchsia-sdk/build/cmc.gni
@@ -0,0 +1,66 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("config/config.gni") + +# Compiles a Components Framework v2 manifest (.cml) file to .cm +# +# The compiled manifest will be pretty-printed if is_debug is true. +# +# Parameters +# +# manifest +# Required: The input Component Framework v2 manifest source (.cml) file. +# The file must have the extension ".cml". +# +# output_name: +# Optional: Name of the output file to generate. Defaults to $target_name. +# This should not include a file extension (.cm) +# +# deps +# public_deps +# testonly +# visibility +# Optional: Standard GN meaning. +template("cmc_compile") { + output_name = target_name + if (defined(invoker.output_name)) { + output_name = invoker.output_name + } + + action(target_name) { + forward_variables_from(invoker, + [ + "deps", + "manifest", + "public_deps", + "testonly", + "visibility", + ]) + assert(defined(manifest), "manifest file required") + + script = "${fuchsia_sdk}/build/gn_run_binary.py" + + inputs = [ + # Depend on the SDK hash, to ensure rebuild if the SDK tools change. + fuchsia_sdk_manifest_file, + manifest, + ] + + output_file = "$target_out_dir/$output_name.cm" + outputs = [ output_file ] + + args = [ + rebase_path("${fuchsia_sdk}/tools/cmc", root_build_dir), + "compile", + "--output", + rebase_path(output_file, root_build_dir), + rebase_path(manifest, root_build_dir), + ] + + if (is_debug) { + args += [ "--pretty" ] + } + } +}
diff --git a/third_party/fuchsia-sdk/build/component.gni b/third_party/fuchsia-sdk/build/component.gni new file mode 100644 index 0000000..30ccf33 --- /dev/null +++ b/third_party/fuchsia-sdk/build/component.gni
@@ -0,0 +1,157 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("cmc.gni") + +# Define a Fuchsia component() target. +# +# The target generates a json file defining the component contents. This +# component is used to assemble components into distributions, such as packages. +# +# Parameters +# +# deps +# Optional: Dependencies for this component. These dependencies are external +# to the component, such as other components that are used via FIDL. +# +# data_deps +# Required: Dependencies examined for metadata. These dependencies define +# the contents of the component. These are executables and libraries. +# +# manifest +# Required: The source manifest file for this component. This can be +# either a v1 (.cmx) or v2 (.cml) manifest. v2 manifests must have +# the file extension ".cml". +# +# manifest_output_name +# Optional: The name of the manifest file contained in the distribution +# that this component is included in. +# +# By default, for v1 (.cmx) manifests, the output name is the same as +# `manifest` with the extension ".cmx", and for v2 (.cml) manifests, +# with the extension ".cm". +# +# The output name should have no extension or prefixes. The resulting +# filename will have an extension that is determined by `manifest_version`. +# +# For example, if `manifest` is "foo.cmx" and `manifest_output_name` is +# "bar", the filename will be "bar.cmx". If `manifest` is "foo.cml" +# (a v2 manifest), the filename will be "bar.cm". +# +# manifest_version +# Optional: The version of the source `manifest` file. This can be either +# "v1" for .cmx manifests, or "v2" for .cml manifests. +# +# By default, the version is guessed from the `manifest` file extension. +# +# resources +# Optional: Non-executable resources to include in the component. +# +template("fuchsia_component") { + forward_variables_from(invoker, + [ + "manifest", + "manifest_output_name", + "manifest_version", + ]) + assert(defined(manifest), "manifest file required for this component") + + if (!defined(manifest_output_name)) { + manifest_output_name = get_path_info(manifest, "name") + } + + # Guess `manifest_version` from the `manifest` file extension. + if (!defined(manifest_version)) { + manifest_extension = get_path_info(manifest, "extension") + if (manifest_extension == "cmx") { + manifest_version = "v1" + } else if (manifest_extension == "cml") { + manifest_version = "v2" + } + } + + assert( + defined(manifest_version), + "manifest_version required and could not be determined from manifest file extension") + assert(manifest_version == "v1" || manifest_version == "v2", + "manifest_version must be one of: \"v1\", \"v2\"") + + if (manifest_version == "v1") { + manifest_source = rebase_path(manifest) + } else if (manifest_version == "v2") { + compiled_manifest = + "compiled_" + target_name + "_" + get_path_info(manifest, "file") + + cmc_compile(compiled_manifest) { + manifest = rebase_path(manifest) + } + + compiled_manifest_outputs = get_target_outputs(":$compiled_manifest") + manifest_source = rebase_path(compiled_manifest_outputs[0]) + } + + group(target_name) { + forward_variables_from(invoker, + [ + "deps", + "data_deps", + "friend", + "resources", + "testonly", + "visibility", + ]) + assert(defined(data_deps), + "data_deps required to define contents of this component") + + if (!defined(resources)) { + resources = [] + } + + if (!defined(deps)) { + deps = [] + } + + if (manifest_version == "v2") { + deps += [ ":$compiled_manifest" ] + } + + component_contents = [] + + foreach(dep, data_deps) { + component_contents += [ + { + type = "dep" + source = rebase_path(dep) + }, + ] + } + + foreach(resource, resources) { + component_contents += [ + { + type = "resource" + source = rebase_path(resource.path) + }, + ] + } + + # TODO(fxb/42370): add cmx validation + + component_contents += [ + { + type = "manifest" + source = manifest_source + output_name = manifest_output_name + manifest_version = manifest_version + }, + ] + + # The contents of the component are enumerated in the + # metadata. The metadata is processed by the package + # template, or the distribution rule. + metadata = { + contents = [ component_contents ] + } + } +}
diff --git a/third_party/fuchsia-sdk/build/config/BUILD.gn b/third_party/fuchsia-sdk/build/config/BUILD.gn new file mode 100644 index 0000000..da51a33 --- /dev/null +++ b/third_party/fuchsia-sdk/build/config/BUILD.gn
@@ -0,0 +1,84 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("config.gni") + +config("compiler") { + sdk_version = "${fuchsia_sdk_id}" + defines = [ + # To force full builds after SDK updates in case of ABI changes. + "FUCHSIA_SDK_VERSION=$sdk_version", + ] + cflags = [] + ldflags = [] + if (current_cpu == "arm64") { + cflags += [ "--target=aarch64-fuchsia" ] + } else if (current_cpu == "x64") { + cflags += [ "--target=x86_64-fuchsia" ] + } else { + assert(false, "Unsupported architecture") + } + + # Add libfdio by default. This may change in future versions + # in order to move away from POSIX applications and towards + # the Fuchsia programming model. + ldflags += [ + # We always want fdio or else e.g. stdio wouldn't be initialized if fdio + # happens to not be directly referenced. The common POSIX-y compiler setup + # uses -Wl,--as-needed which drops it if it's simply "-lfdio" from a libs + # setting. Disable --as-needed, add fdio, and then set back to --as-needed. + "-Wl,--no-as-needed", + "-lfdio", + "-Wl,--as-needed", + ] + + lib_dirs = [ "${fuchsia_sdk}/arch/${current_cpu}/lib" ] + + libs = [ "zircon" ] + + ldflags += cflags + asmflags = cflags +} + +# This should be applied to all targets. +config("runtime_library") { + asmflags = [] + cflags = [] + cflags_c = [] + cflags_cc = [] + cflags_objc = [] + cflags_objcc = [] + defines = [] + ldflags = [] + + sysroot = "${fuchsia_sdk}/arch/$current_cpu/sysroot" + + # Pass the sysroot to all C compiler variants, the assembler, and linker. + cflags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ] + ldflags = cflags + asmflags = cflags +} + +# Copy the loader to place it at the expected path in the final package. +copy("sysroot_dist_libs") { + sources = [ "${fuchsia_sdk}/arch/${target_cpu}/sysroot/dist/lib/ld.so.1" ] + outputs = [ "${root_out_dir}/lib/{{source_file_part}}" ] +} + +# This adds the runtime deps for //build/config/compiler:runtime_library +# as that is a config target and thus cannot include data_deps. +group("runtime_library_group") { + data_deps = [ + ":sysroot_dist_libs", + + # This is used directly from //build/config/fuchsia:compiler and thus + # also needs to be included by default. + "${fuchsia_sdk}/pkg/fdio", + ] +} + +config("sdk_lib_dirs_config") { + visibility = [ ":*" ] + lib_dirs = [ "arch/${target_cpu}/lib" ] +}
diff --git a/third_party/fuchsia-sdk/build/config/config.gni b/third_party/fuchsia-sdk/build/config/config.gni new file mode 100644 index 0000000..2bd1af4 --- /dev/null +++ b/third_party/fuchsia-sdk/build/config/config.gni
@@ -0,0 +1,29 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { + # Path to the fuchsia SDK. This is intended for use in other templates & rules + # to reference the contents of the fuchsia SDK. + fuchsia_sdk = get_path_info("../..", "abspath") + + # Build ID uniquely identifying the Fuchsia IDK. This is exposed as a property so + # it can be used to locate images and packages on GCS and as a marker to indicate the + # "version" of the IDK. If it is empty, then it is most likely that something is fatally wrong. + fuchsia_sdk_id = "" +} + +declare_args() { + # The SDK manifest file. This is useful to include as a dependency + # for some targets in order to cause a rebuild when the version of the + # SDK is changed. + fuchsia_sdk_manifest_file = "$fuchsia_sdk/meta/manifest.json" +} + +if (fuchsia_sdk_id == "") { + # Note: If we need to expose more than just the id in the future, + # we should consider exposing the entire json object for the metadata vs. + # adding a bunch of variables. + _meta = read_file(fuchsia_sdk_manifest_file, "json") + fuchsia_sdk_id = _meta.id +}
diff --git a/third_party/fuchsia-sdk/build/fidl_library.gni b/third_party/fuchsia-sdk/build/fidl_library.gni new file mode 100644 index 0000000..1a28c45 --- /dev/null +++ b/third_party/fuchsia-sdk/build/fidl_library.gni
@@ -0,0 +1,210 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("config/config.gni") + +# Define a Fuchsia FIDL library component() target. +# +# $namespace.$library_name must match the the library name specified in the FIDL +# files. +# +# Parameters +# +# sources +# Required: List of .fidl files. +# +# library_name +# Optional: Name of the library. target_name is used if name +# is not specified explicitly. +# +# namespace +# Optional: Namespace for the library. +# +# deps +# Optional: List of other fidl_library() targets that this +# FIDL library depends on. +# +template("fidl_library") { + forward_variables_from(invoker, [ "namespace" ]) + + _library_basename = target_name + if (defined(invoker.library_name)) { + _library_basename = invoker.library_name + } + + if (defined(namespace)) { + _library_name = "${namespace}.${_library_basename}" + _namespace_path = string_replace(namespace, ".", "/") + _library_path = "${_namespace_path}/${_library_basename}" + } else { + _library_name = _library_basename + _library_path = string_replace(_library_basename, ".", "/") + } + + _response_file = "$target_gen_dir/$target_name.rsp" + _json_representation = "$target_gen_dir/${_library_name}.fidl.json" + _output_gen_dir = "$target_gen_dir/fidl" + _output_base = "$_output_gen_dir/${_library_path}/cpp/fidl" + _tables_file = "$_output_gen_dir/${_library_name}.fidl-tables.c" + + action("${target_name}_response_file") { + script = "${fuchsia_sdk}/build/gen_fidl_response_file.py" + + forward_variables_from(invoker, + [ + "deps", + "public_deps", + "sources", + "testonly", + ]) + + _libraries_file = "$target_gen_dir/${invoker.target_name}.fidl_libraries" + + outputs = [ + _response_file, + _libraries_file, + ] + + args = [ + "--out-response-file", + rebase_path(_response_file, root_build_dir), + "--out-libraries", + rebase_path(_libraries_file, root_build_dir), + "--tables", + rebase_path(_tables_file, root_build_dir), + "--json", + rebase_path(_json_representation, root_build_dir), + "--name", + _library_name, + "--sources", + ] + rebase_path(sources, root_build_dir) + + if (defined(invoker.deps) || defined(invoker.public_deps)) { + merged_deps = [] + + if (defined(invoker.deps)) { + merged_deps += invoker.deps + } + + if (defined(invoker.public_deps)) { + merged_deps += invoker.public_deps + } + + dep_libraries = [] + deps = [] + + foreach(dep, merged_deps) { + gen_dir = get_label_info(dep, "target_gen_dir") + dep_toolchain = get_label_info(dep, "toolchain") + name = get_label_info(dep, "name") + dep_libraries += [ "$gen_dir/$name.fidl_libraries" ] + dep_dir = + get_label_info(get_label_info(dep, "label_no_toolchain"), "dir") + deps += [ "${dep_dir}:${name}_response_file($dep_toolchain)" ] + } + + inputs = dep_libraries + + args += [ "--dep-libraries" ] + rebase_path(dep_libraries, root_build_dir) + } + } + + action("${target_name}_compile") { + forward_variables_from(invoker, [ "testonly" ]) + + visibility = [ ":*" ] + + deps = [ ":${invoker.target_name}_response_file" ] + + script = "${fuchsia_sdk}/build/gn_run_binary.py" + + inputs = [ + # Depend on the SDK hash, to ensure rebuild if the SDK tools change. + fuchsia_sdk_manifest_file, + _response_file, + ] + + outputs = [ + _json_representation, + _tables_file, + ] + + rebased_response_file = rebase_path(_response_file, root_build_dir) + args = [ + rebase_path("${fuchsia_sdk}/tools/fidlc", root_build_dir), + "@$rebased_response_file", + ] + } + + action("${target_name}_cpp_gen") { + visibility = [ ":${invoker.target_name}" ] + forward_variables_from(invoker, [ "testonly" ]) + + deps = [ ":${invoker.target_name}_compile" ] + + inputs = [ + # Depend on the SDK hash, to ensure rebuild if the SDK tools change. + fuchsia_sdk_manifest_file, + _json_representation, + ] + + outputs = [ + "${_output_base}.h", + "${_output_base}.cc", + ] + + script = "${fuchsia_sdk}/build/gn_run_binary.py" + args = [ + rebase_path("${fuchsia_sdk}/tools/fidlgen", root_build_dir), + "-generators", + "cpp", + "-json", + rebase_path(_json_representation, root_build_dir), + "-include-base", + rebase_path(_output_gen_dir, root_build_dir), + "-output-base", + rebase_path("${_output_base}", root_build_dir), + ] + } + + config("${target_name}_config") { + visibility = [ ":${invoker.target_name}" ] + include_dirs = [ _output_gen_dir ] + } + + source_set(target_name) { + forward_variables_from(invoker, + [ + "deps", + "public_deps", + "testonly", + "visibility", + ]) + + sources = [ + "${_output_base}.cc", + "${_output_base}.h", + _tables_file, + ] + + # Metadata to allow us to query all FIDL IR files. + metadata = { + fidl_json = [ rebase_path(_json_representation, root_build_dir) ] + } + + if (!defined(deps)) { + deps = [] + } + deps += [ ":${invoker.target_name}_compile" ] + deps += [ ":${invoker.target_name}_cpp_gen" ] + + if (!defined(public_deps)) { + public_deps = [] + } + public_deps += [ "${fuchsia_sdk}/pkg/fidl" ] + public_deps += [ "${fuchsia_sdk}/pkg/fidl_cpp" ] + + public_configs = [ ":${invoker.target_name}_config" ] + } +}
diff --git a/third_party/fuchsia-sdk/build/fuchsia_sdk_pkg.gni b/third_party/fuchsia-sdk/build/fuchsia_sdk_pkg.gni new file mode 100644 index 0000000..b679760 --- /dev/null +++ b/third_party/fuchsia-sdk/build/fuchsia_sdk_pkg.gni
@@ -0,0 +1,89 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("config/config.gni") + +# Defines a Fuchsia SDK library target from source or prebuilt. +# +# If this target has header files, they are exposed via a config +# object specifying the include_dirs. +# +# Shared libraries are copied to ${root_out_dir/lib} for packaging. +# +# +# Parameters +# +# package_name +# Optional: Name of the library. Default is target_name. +# sources +# Required: List of source files. +# +# include_dirs +# Optional: include_dirs to add to the configuration for the +# target. +# library_name +# Optional: Name of the library. target_name is used if name +# is not specified explicitly. +# +# shared_libs +# Optional: List of shared libraries for this target. +# +# static_libs +# Optional: List of static libraries for this target. +# +# sdk_dist_dir +# Optional: Directory of libraries to distribute in the +# target. Defaults to ${fuchsia_sdk}/arch/${target_cpu}/dist. +# deps +# Optional: List of other targets that this library depends on. +# +# Declares a package containing uncompiled code and/or precompiled libraries. +# +# +template("fuchsia_sdk_pkg") { + config("${target_name}_config") { + forward_variables_from(invoker, [ "include_dirs" ]) + visibility = [ ":${invoker.target_name}" ] + } + + if (defined(invoker.shared_libs)) { + if (defined(invoker.sdk_dist_dir)) { + sdk_dist_dir = invoker.sdk_dist_dir + } else { + sdk_dist_dir = "${fuchsia_sdk}/arch/${target_cpu}/dist" + } + + copy("${target_name}_dist_libs") { + sources = [] + foreach(lib, invoker.shared_libs) { + sources += [ "${sdk_dist_dir}/lib${lib}.so" ] + } + + outputs = [ "${root_out_dir}/lib/{{source_file_part}}" ] + visibility = [ ":${target_name}" ] + } + } + + static_library(target_name) { + forward_variables_from(invoker, + [ + "data", + "deps", + "public_deps", + "sources", + "testonly", + "visibility", + ]) + + public_configs = [ ":${invoker.target_name}_config" ] + + if (defined(invoker.shared_libs)) { + configs += [ "${fuchsia_sdk}/build/config:sdk_lib_dirs_config" ] + libs = invoker.shared_libs + data_deps = [ ":${target_name}_dist_libs" ] + } else if (defined(invoker.static_libs)) { + libs = invoker.static_libs + } + } +}
diff --git a/third_party/fuchsia-sdk/build/gen_fidl_response_file.py b/third_party/fuchsia-sdk/build/gen_fidl_response_file.py new file mode 100755 index 0000000..a6c237d --- /dev/null +++ b/third_party/fuchsia-sdk/build/gen_fidl_response_file.py
@@ -0,0 +1,94 @@ +#!/usr/bin/env python2.7 +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# This file is a copy of +# https://fuchsia.googlesource.com/garnet/+/731fec4559ba459b0d2567a2e68363a5d0021259/public/lib/fidl/build/fidl/gen_response_file.py + +import argparse +import os +import string +import sys + + +def read_libraries(libraries_path): + with open(libraries_path) as f: + lines = f.readlines() + return [l.rstrip("\n") for l in lines] + + +def write_libraries(libraries_path, libraries): + directory = os.path.dirname(libraries_path) + if not os.path.exists(directory): + os.makedirs(directory) + with open(libraries_path, "w+") as f: + for library in libraries: + f.write(library) + f.write("\n") + + +def main(args_list=None): + parser = argparse.ArgumentParser( + description="Generate response file for FIDL frontend") + parser.add_argument( + "--out-response-file", + help="The path for for the response file to generate", + required=True) + parser.add_argument( + "--out-libraries", + help="The path for for the libraries file to generate", + required=True) + parser.add_argument( + "--json", help="The path for the JSON file to generate, if any") + parser.add_argument( + "--tables", help="The path for the tables file to generate, if any") + parser.add_argument( + "--c-header", + help="The path for the C headers file to generate, if any") + parser.add_argument( + "--name", help="The name for the generated FIDL library, if any") + parser.add_argument( + "--sources", help="List of FIDL source files", nargs="*") + parser.add_argument( + "--dep-libraries", help="List of dependent libraries", nargs="*") + if args_list: + args = parser.parse_args(args_list) + else: + args = parser.parse_args() + + target_libraries = [] + + for dep_libraries_path in args.dep_libraries or []: + dep_libraries = read_libraries(dep_libraries_path) + for library in dep_libraries: + if library in target_libraries: + continue + target_libraries.append(library) + target_libraries.append(" ".join(sorted(args.sources))) + write_libraries(args.out_libraries, target_libraries) + + response_file = [] + + if args.json: + response_file.append("--json %s" % args.json) + + if args.tables: + response_file.append("--tables %s" % args.tables) + + if args.c_header: + response_file.append("--c-header %s" % args.c_header) + + if args.name: + response_file.append("--name %s" % args.name) + + response_file.extend( + ["--files %s" % library for library in target_libraries]) + + with open(args.out_response_file, "w+") as f: + f.write(" ".join(response_file)) + f.write("\n") + + +if __name__ == "__main__": + sys.exit(main())
diff --git a/third_party/fuchsia-sdk/build/gn-build-files-meta.json b/third_party/fuchsia-sdk/build/gn-build-files-meta.json new file mode 100644 index 0000000..a262965 --- /dev/null +++ b/third_party/fuchsia-sdk/build/gn-build-files-meta.json
@@ -0,0 +1,143 @@ +{ + "docs": [ + "fidl/fuchsia.accessibility.semantics/BUILD.gn", + "fidl/fuchsia.auth.oldtokens/BUILD.gn", + "fidl/fuchsia.auth/BUILD.gn", + "fidl/fuchsia.bluetooth.a2dp/BUILD.gn", + "fidl/fuchsia.bluetooth.control/BUILD.gn", + "fidl/fuchsia.bluetooth.gatt/BUILD.gn", + "fidl/fuchsia.bluetooth.le/BUILD.gn", + "fidl/fuchsia.bluetooth.sys/BUILD.gn", + "fidl/fuchsia.bluetooth/BUILD.gn", + "fidl/fuchsia.camera/BUILD.gn", + "fidl/fuchsia.camera2.hal/BUILD.gn", + "fidl/fuchsia.camera2/BUILD.gn", + "fidl/fuchsia.camera3/BUILD.gn", + "fidl/fuchsia.castauth/BUILD.gn", + "fidl/fuchsia.castconfig/BUILD.gn", + "fidl/fuchsia.castremotecontrol/BUILD.gn", + "fidl/fuchsia.castsetup/BUILD.gn", + "fidl/fuchsia.castsysteminfo/BUILD.gn", + "fidl/fuchsia.castwindow/BUILD.gn", + "fidl/fuchsia.cobalt/BUILD.gn", + "fidl/fuchsia.component.runner/BUILD.gn", + "fidl/fuchsia.component/BUILD.gn", + "fidl/fuchsia.data/BUILD.gn", + "fidl/fuchsia.deprecatedtimezone/BUILD.gn", + "fidl/fuchsia.developer.tiles/BUILD.gn", + "fidl/fuchsia.diagnostics/BUILD.gn", + "fidl/fuchsia.factory/BUILD.gn", + "fidl/fuchsia.feedback/BUILD.gn", + "fidl/fuchsia.fonts/BUILD.gn", + "fidl/fuchsia.hardware.ethernet/BUILD.gn", + "fidl/fuchsia.hardware.goldfish/BUILD.gn", + "fidl/fuchsia.hardware.light/BUILD.gn", + "fidl/fuchsia.hardware.power.statecontrol/BUILD.gn", + "fidl/fuchsia.hwinfo/BUILD.gn", + "fidl/fuchsia.images/BUILD.gn", + "fidl/fuchsia.input/BUILD.gn", + "fidl/fuchsia.inspect/BUILD.gn", + "fidl/fuchsia.intl/BUILD.gn", + "fidl/fuchsia.io/BUILD.gn", + "fidl/fuchsia.ldsvc/BUILD.gn", + "fidl/fuchsia.legacymetrics/BUILD.gn", + "fidl/fuchsia.location.namedplace/BUILD.gn", + "fidl/fuchsia.logger/BUILD.gn", + "fidl/fuchsia.math/BUILD.gn", + "fidl/fuchsia.media.audio/BUILD.gn", + "fidl/fuchsia.media.drm/BUILD.gn", + "fidl/fuchsia.media.playback/BUILD.gn", + "fidl/fuchsia.media.sessions2/BUILD.gn", + "fidl/fuchsia.media.sounds/BUILD.gn", + "fidl/fuchsia.media.target/BUILD.gn", + "fidl/fuchsia.media/BUILD.gn", + "fidl/fuchsia.mediacodec/BUILD.gn", + "fidl/fuchsia.mem/BUILD.gn", + "fidl/fuchsia.memorypressure/BUILD.gn", + "fidl/fuchsia.migration/BUILD.gn", + "fidl/fuchsia.modular.auth/BUILD.gn", + "fidl/fuchsia.modular.session/BUILD.gn", + "fidl/fuchsia.modular.testing/BUILD.gn", + "fidl/fuchsia.modular/BUILD.gn", + "fidl/fuchsia.net.dhcp/BUILD.gn", + "fidl/fuchsia.net.http/BUILD.gn", + "fidl/fuchsia.net.mdns/BUILD.gn", + "fidl/fuchsia.net.oldhttp/BUILD.gn", + "fidl/fuchsia.net/BUILD.gn", + "fidl/fuchsia.netstack/BUILD.gn", + "fidl/fuchsia.posix.socket/BUILD.gn", + "fidl/fuchsia.process/BUILD.gn", + "fidl/fuchsia.recovery.ui/BUILD.gn", + "fidl/fuchsia.recovery/BUILD.gn", + "fidl/fuchsia.scenic.scheduling/BUILD.gn", + "fidl/fuchsia.settings/BUILD.gn", + "fidl/fuchsia.sys.test/BUILD.gn", + "fidl/fuchsia.sys/BUILD.gn", + "fidl/fuchsia.sysinfo/BUILD.gn", + "fidl/fuchsia.sysmem/BUILD.gn", + "fidl/fuchsia.tracing.provider/BUILD.gn", + "fidl/fuchsia.ui.activity.control/BUILD.gn", + "fidl/fuchsia.ui.activity/BUILD.gn", + "fidl/fuchsia.ui.app/BUILD.gn", + "fidl/fuchsia.ui.brightness/BUILD.gn", + "fidl/fuchsia.ui.gfx/BUILD.gn", + "fidl/fuchsia.ui.input/BUILD.gn", + "fidl/fuchsia.ui.input2/BUILD.gn", + "fidl/fuchsia.ui.input3/BUILD.gn", + "fidl/fuchsia.ui.lifecycle/BUILD.gn", + "fidl/fuchsia.ui.policy/BUILD.gn", + "fidl/fuchsia.ui.scenic/BUILD.gn", + "fidl/fuchsia.ui.types/BUILD.gn", + "fidl/fuchsia.ui.views/BUILD.gn", + "fidl/fuchsia.update.channel/BUILD.gn", + "fidl/fuchsia.update.channelcontrol/BUILD.gn", + "fidl/fuchsia.update/BUILD.gn", + "fidl/fuchsia.url/BUILD.gn", + "fidl/fuchsia.weave/BUILD.gn", + "fidl/fuchsia.web/BUILD.gn", + "fidl/fuchsia.wlan.common/BUILD.gn", + "fidl/fuchsia.wlan.policy/BUILD.gn", + "fidl/fuchsia.wlan.service/BUILD.gn", + "fidl/fuchsia.wlan.stats/BUILD.gn", + "pkg/async-cpp/BUILD.gn", + "pkg/async-default/BUILD.gn", + "pkg/async-loop-cpp/BUILD.gn", + "pkg/async-loop-default/BUILD.gn", + "pkg/async-loop/BUILD.gn", + "pkg/async-testing/BUILD.gn", + "pkg/async/BUILD.gn", + "pkg/fdio/BUILD.gn", + "pkg/fidl-async/BUILD.gn", + "pkg/fidl/BUILD.gn", + "pkg/fidl_base/BUILD.gn", + "pkg/fidl_cpp/BUILD.gn", + "pkg/fidl_cpp_base/BUILD.gn", + "pkg/fidl_cpp_sync/BUILD.gn", + "pkg/fit/BUILD.gn", + "pkg/images_cpp/BUILD.gn", + "pkg/inspect/BUILD.gn", + "pkg/inspect_service_cpp/BUILD.gn", + "pkg/media_cpp/BUILD.gn", + "pkg/media_cpp_no_converters/BUILD.gn", + "pkg/memfs/BUILD.gn", + "pkg/modular_cpp/BUILD.gn", + "pkg/modular_testing_cpp/BUILD.gn", + "pkg/scenic_cpp/BUILD.gn", + "pkg/svc/BUILD.gn", + "pkg/sync/BUILD.gn", + "pkg/sys_cpp/BUILD.gn", + "pkg/sys_cpp_testing/BUILD.gn", + "pkg/sys_inspect_cpp/BUILD.gn", + "pkg/sys_service_cpp/BUILD.gn", + "pkg/syslog/BUILD.gn", + "pkg/trace-engine/BUILD.gn", + "pkg/trace-provider-so/BUILD.gn", + "pkg/trace/BUILD.gn", + "pkg/vfs_cpp/BUILD.gn", + "pkg/vulkan/BUILD.gn", + "pkg/vulkan_layers/BUILD.gn", + "pkg/zx/BUILD.gn" + ], + "name": "gn-build-files", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/build/gn-rules-meta.json b/third_party/fuchsia-sdk/build/gn-rules-meta.json new file mode 100644 index 0000000..c3ce338 --- /dev/null +++ b/third_party/fuchsia-sdk/build/gn-rules-meta.json
@@ -0,0 +1,19 @@ +{ + "docs": [ + "build/cmc.gni", + "build/config/BUILD.gn", + "build/config/config.gni", + "build/fuchsia_sdk_pkg.gni", + "build/gn_run_binary.py", + "build/fidl_library.gni", + "build/gen_fidl_response_file.py", + "build/package.gni", + "build/component.gni", + "build/prepare_package_inputs.py", + "build/pm_tool.gni", + "build/test_targets.gni", + "build/test.gni" + ], + "name": "gn-rules", + "type": "documentation" +}
diff --git a/third_party/fuchsia-sdk/build/gn_run_binary.py b/third_party/fuchsia-sdk/build/gn_run_binary.py new file mode 100644 index 0000000..2377873 --- /dev/null +++ b/third_party/fuchsia-sdk/build/gn_run_binary.py
@@ -0,0 +1,25 @@ +#!/usr/bin/env python2.7 +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Helper script for GN to run an arbitrary binary. + +Run with: + python2.7 gn_run_binary.py <binary_name> [args ...] +""" + +import os +import subprocess +import sys + +# This script is designed to run binaries produced by the current build. We +# may prefix it with "./" to avoid picking up system versions that might +# also be on the path. +path = sys.argv[1] +if not os.path.isabs(path): + path = './' + path + +# The rest of the arguments are passed directly to the executable. +args = [path] + sys.argv[2:] + +sys.exit(subprocess.call(args))
diff --git a/third_party/fuchsia-sdk/build/package.gni b/third_party/fuchsia-sdk/build/package.gni new file mode 100644 index 0000000..080522b --- /dev/null +++ b/third_party/fuchsia-sdk/build/package.gni
@@ -0,0 +1,140 @@ +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("config/config.gni") +import("pm_tool.gni") + +# Define a Fuchsia component package target. +# +# Parameters +# +# package_name: +# Optional: Name of the package. Defaults to target_name +# +# excluded_files +# Optional: List of files to exclude from the package. +# +# deps +# Required: List of fuchsia_component() targets that this +# package contains. +# +template("fuchsia_package") { + if (!defined(invoker.package_name)) { + package_name = target_name + } else { + package_name = invoker.package_name + } + if (!defined(invoker.excluded_files)) { + excluded_files = [] + } else { + excluded_files = invoker.excluded_files + } + + _depfile = "${target_gen_dir}/${target_name}_stamp.d" + + # target names + _manifest_target = "${target_name}__archive-manifest" + _metadata_target = "${target_name}__archive-metadata" + + # output values + _pkg_out_dir = "${target_gen_dir}/${package_name}" + _runtime_deps_file = "$_pkg_out_dir/${package_name}.runtime_deps" + _archive_manifest = "$_pkg_out_dir/${package_name}.archive_manifest" + _build_ids_file = "$_pkg_out_dir/ids.txt" + _package_file = "$_pkg_out_dir/package" + + _packaged_components_metadata = + "${target_gen_dir}/${package_name}_packaged_components_metadata.json" + + _package_deps = [] + if (defined(invoker.deps)) { + _package_deps += invoker.deps + } + if (defined(invoker.data_deps)) { + _package_deps += invoker.data_deps + } + + # Generates a JSON file containing the contents of each of the + # components being included in this package. + generated_file("${package_name}_packaged_components_metadata") { + forward_variables_from(invoker, [ "testonly" ]) + outputs = [ _packaged_components_metadata ] + data_keys = [ "contents" ] + output_conversion = "json" + deps = _package_deps + } + + action(_manifest_target) { + forward_variables_from(invoker, + [ + "deps", + "testonly", + ]) + script = "${fuchsia_sdk}/build/prepare_package_inputs.py" + + inputs = [ _runtime_deps_file ] + + outputs = [ + _archive_manifest, + _build_ids_file, + _package_file, + ] + + if (!defined(deps)) { + deps = [] + } + data_deps = _package_deps + deps += _package_deps + + # Use a depfile to trigger package rebuilds if any of the files (static + # assets, shared libraries, etc.) included by the package have changed. + depfile = _depfile + + args = [ + "--root-dir", + rebase_path("//", root_build_dir), + "--out-dir", + rebase_path(root_out_dir, root_build_dir), + "--app-name", + package_name, + "--runtime-deps-file", + rebase_path(_runtime_deps_file, root_build_dir), + "--depfile-path", + rebase_path(_depfile, root_build_dir), + "--manifest-path", + rebase_path(_archive_manifest, root_build_dir), + "--build-ids-file", + rebase_path(_build_ids_file, root_build_dir), + "--json-file", + rebase_path(_packaged_components_metadata), + ] + + if (defined(excluded_files)) { + foreach(filename, excluded_files) { + args += [ + "--exclude-file", + filename, + ] + } + } + write_runtime_deps = _runtime_deps_file + } + + # Creates a Fuchsia metadata package. + fuchsia_pm_tool(_metadata_target) { + forward_variables_from(invoker, [ "testonly" ]) + package_name = package_name + command = "build" + archive_manifest = _archive_manifest + public_deps = [ ":$_manifest_target" ] + } + + fuchsia_pm_tool(target_name) { + forward_variables_from(invoker, [ "testonly" ]) + package_name = package_name + command = "archive" + archive_manifest = _archive_manifest + deps = [ ":$_metadata_target" ] + } +}
diff --git a/third_party/fuchsia-sdk/build/pm_tool.gni b/third_party/fuchsia-sdk/build/pm_tool.gni new file mode 100644 index 0000000..4a891f5 --- /dev/null +++ b/third_party/fuchsia-sdk/build/pm_tool.gni
@@ -0,0 +1,98 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("config/config.gni") + +# Template for running the pm tool for packaging fuchsia packages. +# +# Parameters +# package_name - defaults to target_name +# archive_manifest - required +# command - the packaging step to perform valid steps are build, archive +# +# Forwarded parameters +# testonly +# deps +# public_deps +# visibility +template("fuchsia_pm_tool") { + forward_variables_from(invoker, [ "*" ]) + action(target_name) { + forward_variables_from(invoker, + [ + "testonly", + "deps", + "public_deps", + "visibility" + ]) + _valid_commands = [ + "build", + "archive", + ] + assert(defined(invoker.archive_manifest), "archive_manifest is required.") + archive_manifest = invoker.archive_manifest + + assert(defined(invoker.command), "command is required") + assert(invoker.command == "build" || invoker.command == "archive", + "invalid command. valid commands are ${_valid_commands}") + command = invoker.command + + if (defined(invoker.package_name)) { + package_name = invoker.package_name + } else { + package_name = target_name + } + + # tool path + _pm_tool_path = "${fuchsia_sdk}/tools/pm" + script = "${fuchsia_sdk}/build/gn_run_binary.py" + + # output files + _pkg_out_dir = "${target_gen_dir}/${package_name}" + _meta_far_file = "${_pkg_out_dir}/meta.far" + + inputs = [ + # Depend on the SDK hash, to ensure rebuild if the SDK tools change. + fuchsia_sdk_manifest_file, + _pm_tool_path, + archive_manifest, + ] + + if (command == "build") { + _pkg_output_manifest = "${_pkg_out_dir}/package_manifest.json" + outputs = [ + _meta_far_file, + _pkg_output_manifest, + ] + depfile = "${_meta_far_file}.d" + } else { + inputs += [ _meta_far_file ] + + _final_far_file = "$_pkg_out_dir/${package_name}.far" + outputs = [ _final_far_file ] + } + + args = [ + rebase_path(_pm_tool_path, root_build_dir), + "-o", + rebase_path(_pkg_out_dir, root_build_dir), + "-m", + rebase_path(archive_manifest, root_build_dir), + ] + if (command == "build") { + args += [ + command, + "-depfile", + "-output-package-manifest", + rebase_path(_pkg_output_manifest, root_build_dir), + ] + } else if (command == "archive") { + args += [ + command, + "--output", + rebase_path("${_pkg_out_dir}/${package_name}"), + ] + } + } +}
diff --git a/third_party/fuchsia-sdk/build/prepare_package_inputs.py b/third_party/fuchsia-sdk/build/prepare_package_inputs.py new file mode 100644 index 0000000..1b3e6de --- /dev/null +++ b/third_party/fuchsia-sdk/build/prepare_package_inputs.py
@@ -0,0 +1,303 @@ +#!/usr/bin/env python2.7 +# Copyright 2019 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# Derivative work of https://chromium.googlesource.com/chromium/src/+/refs/heads/master/build/config/fuchsia/prepare_package_inputs.py +# +"""Creates a archive manifest used for Fuchsia package generation.""" + +import argparse +import json +import os +import re +import shutil +import subprocess +import sys +import tempfile + +# File extension of a component manifest for each Component Framework version +MANIFEST_VERSION_EXTENSIONS = {"v1": ".cmx", "v2": ".cm"} + + +def make_package_path(file_path, roots): + """Computes a path for |file_path| relative to one of the |roots|. + + Args: + file_path: The file path to relativize. + roots: A list of directory paths which may serve as a relative root for + |file_path|. + + For example: + * make_package_path('/foo/bar.txt', ['/foo/']) 'bar.txt' + * make_package_path('/foo/dir/bar.txt', ['/foo/']) 'dir/bar.txt' + * make_package_path('/foo/out/Debug/bar.exe', ['/foo/', '/foo/out/Debug/']) 'bar.exe' + """ + + # Prevents greedily matching against a shallow path when a deeper, better + # matching path exists. + roots.sort(key=len, reverse=True) + + for next_root in roots: + if not next_root.endswith(os.sep): + next_root += os.sep + + if file_path.startswith(next_root): + relative_path = file_path[len(next_root):] + return relative_path + + return file_path + + +def _get_stripped_path(bin_path): + """Finds the stripped version of |bin_path| in the build output directory. + + returns |bin_path| if no stripped path is found. + """ + stripped_path = bin_path.replace('lib.unstripped/', + 'lib/').replace('exe.unstripped/', '') + if os.path.exists(stripped_path): + return stripped_path + else: + return bin_path + + +def _is_binary(path): + """Checks if the file at |path| is an ELF executable. + + This is done by inspecting its FourCC header. + """ + + with open(path, 'rb') as f: + file_tag = f.read(4) + return file_tag == '\x7fELF' + + +def _write_build_ids_txt(binary_paths, ids_txt_path): + """Writes an index text file mapping build IDs to unstripped binaries.""" + + READELF_FILE_PREFIX = 'File: ' + READELF_BUILD_ID_PREFIX = 'Build ID: ' + + # List of binaries whose build IDs are awaiting processing by readelf. + # Entries are removed as readelf's output is parsed. + unprocessed_binary_paths = {os.path.basename(p): p for p in binary_paths} + + with open(ids_txt_path, 'w') as ids_file: + # Create a set to dedupe stripped binary paths in case both the stripped and + # unstripped versions of a binary are specified. + stripped_binary_paths = set(map(_get_stripped_path, binary_paths)) + readelf_stdout = subprocess.check_output( + ['readelf', '-n'] + list(stripped_binary_paths)) + + if len(binary_paths) == 1: + # Readelf won't report a binary's path if only one was provided to the + # tool. + binary_shortname = os.path.basename(binary_paths[0]) + else: + binary_shortname = None + + for line in readelf_stdout.split('\n'): + line = line.strip() + + if line.startswith(READELF_FILE_PREFIX): + binary_shortname = os.path.basename( + line[len(READELF_FILE_PREFIX):]) + assert binary_shortname in unprocessed_binary_paths + + elif line.startswith(READELF_BUILD_ID_PREFIX): + # Paths to the unstripped executables listed in "ids.txt" are specified + # as relative paths to that file. + unstripped_rel_path = os.path.relpath( + os.path.abspath(unprocessed_binary_paths[binary_shortname]), + os.path.dirname(os.path.abspath(ids_txt_path))) + + build_id = line[len(READELF_BUILD_ID_PREFIX):] + ids_file.write(build_id + ' ' + unstripped_rel_path + '\n') + del unprocessed_binary_paths[binary_shortname] + + # Did readelf forget anything? Make sure that all binaries are accounted for. + assert not unprocessed_binary_paths + + +def _parse_component(component_info_file): + component_info = json.load(open(component_info_file, 'r')) + return component_info + + +def _get_app_filename(component_info): + for c in component_info: + if c.get('type') == 'dep': + pos = c.get('source').find(':') + return c.get('source')[pos + 1:] + + +def _get_component_manifests(component_info): + return [c for c in component_info if c.get('type') == 'manifest'] + + +def _get_expanded_files(runtime_deps_file): + """ Process the runtime deps file for file paths, recursively walking + directories as needed. + + Returns a set of expanded files referenced by the runtime deps file. + """ + + # runtime_deps may contain duplicate paths, so use a set for + # de-duplication. + expanded_files = set() + for next_path in open(runtime_deps_file, 'r'): + next_path = next_path.strip() + if os.path.isdir(next_path): + for root, _, files in os.walk(next_path): + for current_file in files: + if current_file.startswith('.'): + continue + expanded_files.add( + os.path.normpath(os.path.join(root, current_file))) + else: + expanded_files.add(os.path.normpath(next_path)) + return expanded_files + + +def _write_gn_deps_file(depfile_path, manifest_path, out_dir, expanded_files): + with open(depfile_path, 'w') as depfile: + manifest_path = os.path.relpath(manifest_path, out_dir) + deps_list = [] + for f in expanded_files: + deps_list.append(os.path.relpath(f, out_dir)) + deps_string = ' '.join(deps_list) + depfile.write('%s: %s' % (manifest_path, deps_string)) + + +def _write_meta_package_manifest( + manifest, manifest_path, app_name, out_dir, package_version): + # Write meta/package manifest file and add to archive manifest. + meta_package = os.path.join(os.path.dirname(manifest_path), 'package') + with open(meta_package, 'w') as package_json: + json_payload = {'version': package_version, 'name': app_name} + json.dump(json_payload, package_json) + package_json_filepath = os.path.relpath(package_json.name, out_dir) + manifest.write('meta/package=%s\n' % package_json_filepath) + + +def _write_component_manifest(manifest, component_info, manifest_path, out_dir): + """Copy component manifest files and add to archive manifest. + + Raises an exception if a component uses a unknown manifest version. + """ + + for component_manifest in _get_component_manifests(component_info): + manifest_version = component_manifest.get('manifest_version') + + if manifest_version not in MANIFEST_VERSION_EXTENSIONS: + raise Exception( + 'Unknown manifest_version: {}'.format(manifest_version)) + + extension = MANIFEST_VERSION_EXTENSIONS.get(manifest_version) + + manifest_dest_file_path = os.path.join( + os.path.dirname(manifest_path), + component_manifest.get('output_name') + extension) + shutil.copy(component_manifest.get('source'), manifest_dest_file_path) + + manifest.write( + 'meta/%s=%s\n' % ( + os.path.basename(manifest_dest_file_path), + os.path.relpath(manifest_dest_file_path, out_dir))) + + +def _write_package_manifest( + manifest, expanded_files, out_dir, exclude_file, root_dir, + component_info, binaries): + """Writes the package manifest for a Fuchsia package + + Returns a list of binaries in the package. + + Raises an exception if the app filename does not match the package path. + Raises an exception if excluded files are not found.""" + app_filename = _get_app_filename(component_info) + gen_dir = os.path.normpath(os.path.join(out_dir, 'gen')) + app_found = False + excluded_files_set = set(exclude_file) + for current_file in expanded_files: + if _is_binary(current_file): + binaries.append(current_file) + current_file = _get_stripped_path(current_file) + # make_package_path() may relativize to either the source root or + # output directory. + in_package_path = make_package_path( + current_file, [gen_dir, root_dir, out_dir]) + if in_package_path == app_filename: + app_found = True + + if in_package_path in excluded_files_set: + excluded_files_set.remove(in_package_path) + continue + + manifest.write('%s=%s\n' % (in_package_path, current_file)) + + if len(excluded_files_set) > 0: + raise Exception( + 'Some files were excluded with --exclude-file, but ' + 'not found in the deps list: %s' % ', '.join(excluded_files_set)) + + if not app_found: + raise Exception('Could not locate executable inside runtime_deps.') + + +def _build_manifest(args): + expanded_files = _get_expanded_files(args.runtime_deps_file) + _write_gn_deps_file( + args.depfile_path, args.manifest_path, args.out_dir, expanded_files) + binaries = [] # keep track of binaries to write build IDs + with open(args.manifest_path, 'w') as manifest: + _write_meta_package_manifest( + manifest, args.manifest_path, args.app_name, args.out_dir, + args.package_version) + for component_info in _parse_component(args.json_file): + _write_package_manifest( + manifest, expanded_files, args.out_dir, args.exclude_file, + args.root_dir, component_info, binaries) + _write_component_manifest( + manifest, component_info, args.manifest_path, args.out_dir) + + _write_build_ids_txt(binaries, args.build_ids_file) + + return 0 + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + '--root-dir', required=True, help='Build root directory') + parser.add_argument( + '--out-dir', required=True, help='Build output directory') + parser.add_argument('--app-name', required=True, help='Package name') + parser.add_argument( + '--runtime-deps-file', + required=True, + help='File with the list of runtime dependencies.') + parser.add_argument( + '--depfile-path', required=True, help='Path to write GN deps file.') + parser.add_argument( + '--exclude-file', + action='append', + default=[], + help='Package-relative file path to exclude from the package.') + parser.add_argument( + '--manifest-path', required=True, help='Manifest output path.') + parser.add_argument( + '--build-ids-file', required=True, help='Debug symbol index path.') + parser.add_argument('--json-file', required=True) + parser.add_argument( + '--package-version', default='0', help='Version of the package') + + args = parser.parse_args() + + return _build_manifest(args) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/third_party/fuchsia-sdk/build/test.gni b/third_party/fuchsia-sdk/build/test.gni new file mode 100644 index 0000000..2c7fe18 --- /dev/null +++ b/third_party/fuchsia-sdk/build/test.gni
@@ -0,0 +1,92 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("component.gni") +import("config/config.gni") +import("package.gni") + +# Define a test executable, which is packaged in a Fuchsia package. +# Metadata is generated for the target to enable programmatic execution. +# +# Parameters +# +# deps +# Optional: Dependencies for this component. These dependencies are external +# to the component, such as other components that are used via FIDL. The deps +# are added to the executable as well as a the component. +# +# data_deps +# Required: Dependencies examined for metadata. These dependencies define +# the contents of the component. These are executables and libraries. The +# data_deps are added to the component. +# +# manifest +# Required: The manifest file for this component. The executable name +# must be of the form ${target_name}__exec +# +# resources +# Optional: Non-executable resources to include in the component. +# +template("fuchsia_test") { + _output_name = invoker.target_name + _component_target = "${_output_name}_component" + _pkg_target = "${_output_name}_package" + _exec_target = "${_output_name}__exec" + + # This is the executable for the test. + executable(_exec_target) { + visibility = [ ":*" ] + forward_variables_from(invoker, + [ + "testonly", + "sources", + "deps", + ]) + testonly = true + output_name = _exec_target + } + + # The component encapsulates the executable, + # and all the dependencies and resources needed. + fuchsia_component(_component_target) { + visibility = [ ":*" ] + testonly = true + forward_variables_from(invoker, + [ + "manifest", + "data_deps", + "deps", + "resources", + ]) + if (!defined(data_deps)) { + data_deps = [] + } + data_deps += [ ":$_exec_target" ] + } + + # Package the component. + fuchsia_package(_pkg_target) { + testonly = true + data_deps = [ ":$_component_target" ] + package_name = _output_name + } + + # Create metadata JSON which enables building the + # command line to execute the test. + group(target_name) { + testonly = true + metadata = { + test_metadata = [ + { + package_name = _output_name + manifest_name = get_path_info(invoker.manifest, "file") + archive_file = rebase_path( + "${target_gen_dir}/${_output_name}/${_output_name}.far") + }, + ] + } + + deps = [ ":${_pkg_target}" ] + } +}
diff --git a/third_party/fuchsia-sdk/build/test_targets.gni b/third_party/fuchsia-sdk/build/test_targets.gni new file mode 100644 index 0000000..b72b6ed --- /dev/null +++ b/third_party/fuchsia-sdk/build/test_targets.gni
@@ -0,0 +1,209 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +assert(current_os == "fuchsia") + +import("fuchsia_sdk_pkg.gni") + +# These template is used to create build targets +# that test the generated build targets. It does not +# have any practical use outside testing. + +# All vulkan targets +template("fuchsia_sdk_test_loadable_module_targets") { + not_needed(["invoker"]) + group(target_name){ + deps = [ + "${fuchsia_sdk}/pkg/vulkan_layers:all", + ] + } +} + +# All FIDL targets +template("fuchsia_sdk_test_fidl_targets") { + not_needed(["invoker"]) + group(target_name){ + deps = [ + "${fuchsia_sdk}/fidl/fuchsia.accessibility.semantics:all", + "${fuchsia_sdk}/fidl/fuchsia.auth:all", + "${fuchsia_sdk}/fidl/fuchsia.auth.oldtokens:all", + "${fuchsia_sdk}/fidl/fuchsia.bluetooth:all", + "${fuchsia_sdk}/fidl/fuchsia.bluetooth.a2dp:all", + "${fuchsia_sdk}/fidl/fuchsia.bluetooth.control:all", + "${fuchsia_sdk}/fidl/fuchsia.bluetooth.gatt:all", + "${fuchsia_sdk}/fidl/fuchsia.bluetooth.le:all", + "${fuchsia_sdk}/fidl/fuchsia.bluetooth.sys:all", + "${fuchsia_sdk}/fidl/fuchsia.camera:all", + "${fuchsia_sdk}/fidl/fuchsia.camera2:all", + "${fuchsia_sdk}/fidl/fuchsia.camera2.hal:all", + "${fuchsia_sdk}/fidl/fuchsia.camera3:all", + "${fuchsia_sdk}/fidl/fuchsia.castauth:all", + "${fuchsia_sdk}/fidl/fuchsia.castconfig:all", + "${fuchsia_sdk}/fidl/fuchsia.castremotecontrol:all", + "${fuchsia_sdk}/fidl/fuchsia.castsetup:all", + "${fuchsia_sdk}/fidl/fuchsia.castsysteminfo:all", + "${fuchsia_sdk}/fidl/fuchsia.castwindow:all", + "${fuchsia_sdk}/fidl/fuchsia.cobalt:all", + "${fuchsia_sdk}/fidl/fuchsia.component:all", + "${fuchsia_sdk}/fidl/fuchsia.component.runner:all", + "${fuchsia_sdk}/fidl/fuchsia.data:all", + "${fuchsia_sdk}/fidl/fuchsia.deprecatedtimezone:all", + "${fuchsia_sdk}/fidl/fuchsia.developer.tiles:all", + "${fuchsia_sdk}/fidl/fuchsia.diagnostics:all", + "${fuchsia_sdk}/fidl/fuchsia.factory:all", + "${fuchsia_sdk}/fidl/fuchsia.feedback:all", + "${fuchsia_sdk}/fidl/fuchsia.fonts:all", + "${fuchsia_sdk}/fidl/fuchsia.hardware.ethernet:all", + "${fuchsia_sdk}/fidl/fuchsia.hardware.goldfish:all", + "${fuchsia_sdk}/fidl/fuchsia.hardware.light:all", + "${fuchsia_sdk}/fidl/fuchsia.hardware.power.statecontrol:all", + "${fuchsia_sdk}/fidl/fuchsia.hwinfo:all", + "${fuchsia_sdk}/fidl/fuchsia.images:all", + "${fuchsia_sdk}/fidl/fuchsia.input:all", + "${fuchsia_sdk}/fidl/fuchsia.inspect:all", + "${fuchsia_sdk}/fidl/fuchsia.intl:all", + "${fuchsia_sdk}/fidl/fuchsia.io:all", + "${fuchsia_sdk}/fidl/fuchsia.ldsvc:all", + "${fuchsia_sdk}/fidl/fuchsia.legacymetrics:all", + "${fuchsia_sdk}/fidl/fuchsia.location.namedplace:all", + "${fuchsia_sdk}/fidl/fuchsia.logger:all", + "${fuchsia_sdk}/fidl/fuchsia.math:all", + "${fuchsia_sdk}/fidl/fuchsia.media:all", + "${fuchsia_sdk}/fidl/fuchsia.media.audio:all", + "${fuchsia_sdk}/fidl/fuchsia.media.drm:all", + "${fuchsia_sdk}/fidl/fuchsia.media.playback:all", + "${fuchsia_sdk}/fidl/fuchsia.media.sessions2:all", + "${fuchsia_sdk}/fidl/fuchsia.media.sounds:all", + "${fuchsia_sdk}/fidl/fuchsia.media.target:all", + "${fuchsia_sdk}/fidl/fuchsia.mediacodec:all", + "${fuchsia_sdk}/fidl/fuchsia.mem:all", + "${fuchsia_sdk}/fidl/fuchsia.memorypressure:all", + "${fuchsia_sdk}/fidl/fuchsia.migration:all", + "${fuchsia_sdk}/fidl/fuchsia.modular:all", + "${fuchsia_sdk}/fidl/fuchsia.modular.auth:all", + "${fuchsia_sdk}/fidl/fuchsia.modular.session:all", + "${fuchsia_sdk}/fidl/fuchsia.modular.testing:all", + "${fuchsia_sdk}/fidl/fuchsia.net:all", + "${fuchsia_sdk}/fidl/fuchsia.net.dhcp:all", + "${fuchsia_sdk}/fidl/fuchsia.net.http:all", + "${fuchsia_sdk}/fidl/fuchsia.net.mdns:all", + "${fuchsia_sdk}/fidl/fuchsia.net.oldhttp:all", + "${fuchsia_sdk}/fidl/fuchsia.netstack:all", + "${fuchsia_sdk}/fidl/fuchsia.posix.socket:all", + "${fuchsia_sdk}/fidl/fuchsia.process:all", + "${fuchsia_sdk}/fidl/fuchsia.recovery:all", + "${fuchsia_sdk}/fidl/fuchsia.recovery.ui:all", + "${fuchsia_sdk}/fidl/fuchsia.scenic.scheduling:all", + "${fuchsia_sdk}/fidl/fuchsia.settings:all", + "${fuchsia_sdk}/fidl/fuchsia.sys:all", + "${fuchsia_sdk}/fidl/fuchsia.sys.test:all", + "${fuchsia_sdk}/fidl/fuchsia.sysinfo:all", + "${fuchsia_sdk}/fidl/fuchsia.sysmem:all", + "${fuchsia_sdk}/fidl/fuchsia.tracing.provider:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.activity:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.activity.control:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.app:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.brightness:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.gfx:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.input:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.input2:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.input3:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.lifecycle:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.policy:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.scenic:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.types:all", + "${fuchsia_sdk}/fidl/fuchsia.ui.views:all", + "${fuchsia_sdk}/fidl/fuchsia.update:all", + "${fuchsia_sdk}/fidl/fuchsia.update.channel:all", + "${fuchsia_sdk}/fidl/fuchsia.update.channelcontrol:all", + "${fuchsia_sdk}/fidl/fuchsia.url:all", + "${fuchsia_sdk}/fidl/fuchsia.weave:all", + "${fuchsia_sdk}/fidl/fuchsia.web:all", + "${fuchsia_sdk}/fidl/fuchsia.wlan.common:all", + "${fuchsia_sdk}/fidl/fuchsia.wlan.policy:all", + "${fuchsia_sdk}/fidl/fuchsia.wlan.service:all", + "${fuchsia_sdk}/fidl/fuchsia.wlan.stats:all", + ] + } +} + +# All CC source targets +template("fuchsia_sdk_test_cc_source_targets") { + not_needed(["invoker"]) + group(target_name){ + deps = [ + "${fuchsia_sdk}/pkg/async:all", + "${fuchsia_sdk}/pkg/async-cpp:all", + "${fuchsia_sdk}/pkg/async-loop:all", + "${fuchsia_sdk}/pkg/async-loop-cpp:all", + "${fuchsia_sdk}/pkg/async-testing:all", + "${fuchsia_sdk}/pkg/fidl:all", + "${fuchsia_sdk}/pkg/fidl-async:all", + "${fuchsia_sdk}/pkg/fidl_base:all", + "${fuchsia_sdk}/pkg/fidl_cpp:all", + "${fuchsia_sdk}/pkg/fidl_cpp_base:all", + "${fuchsia_sdk}/pkg/fidl_cpp_sync:all", + "${fuchsia_sdk}/pkg/fit:all", + "${fuchsia_sdk}/pkg/images_cpp:all", + "${fuchsia_sdk}/pkg/inspect:all", + "${fuchsia_sdk}/pkg/inspect_service_cpp:all", + "${fuchsia_sdk}/pkg/media_cpp:all", + "${fuchsia_sdk}/pkg/media_cpp_no_converters:all", + "${fuchsia_sdk}/pkg/modular_cpp:all", + "${fuchsia_sdk}/pkg/modular_testing_cpp:all", + "${fuchsia_sdk}/pkg/scenic_cpp:all", + "${fuchsia_sdk}/pkg/sys_cpp:all", + "${fuchsia_sdk}/pkg/sys_cpp_testing:all", + "${fuchsia_sdk}/pkg/sys_inspect_cpp:all", + "${fuchsia_sdk}/pkg/sys_service_cpp:all", + "${fuchsia_sdk}/pkg/trace:all", + "${fuchsia_sdk}/pkg/vfs_cpp:all", + "${fuchsia_sdk}/pkg/zx:all", + ] + } +} + +# All CC prebuilt targets +template("fuchsia_sdk_test_cc_prebuilt_targets") { + not_needed(["invoker"]) + group(target_name){ + deps = [ + "${fuchsia_sdk}/pkg/async-default:all", + "${fuchsia_sdk}/pkg/async-loop-default:all", + "${fuchsia_sdk}/pkg/fdio:all", + "${fuchsia_sdk}/pkg/memfs:all", + "${fuchsia_sdk}/pkg/svc:all", + "${fuchsia_sdk}/pkg/sync:all", + "${fuchsia_sdk}/pkg/syslog:all", + "${fuchsia_sdk}/pkg/trace-engine:all", + "${fuchsia_sdk}/pkg/trace-provider-so:all", + "${fuchsia_sdk}/pkg/vulkan:all", + ] + } +} + +# All test targets +template("fuchsia_sdk_test_targets"){ + not_needed(["invoker"]) + fuchsia_sdk_test_loadable_module_targets("loadable_module_targets"){ + } + fuchsia_sdk_test_fidl_targets("fidl_targets"){ + } + fuchsia_sdk_test_cc_source_targets("cc_source_targets"){ + } + fuchsia_sdk_test_cc_prebuilt_targets("cc_prebuilt_targets"){ + } + group(target_name){ + deps = [ + ":loadable_module_targets", + ":fidl_targets", + ":cc_source_targets", + ":cc_prebuilt_targets", + ] + } +}
diff --git a/third_party/fuchsia-sdk/docs/README.md b/third_party/fuchsia-sdk/docs/README.md new file mode 100644 index 0000000..aa2e88c --- /dev/null +++ b/third_party/fuchsia-sdk/docs/README.md
@@ -0,0 +1,13 @@ +# Documentation + +## General + +For general information about this SDK, see the [root README](../README.md). + + +## Workflows + +- [Creating and deploying Fuchsia packages](packages.md) +- [Communicating with target devices](devices.md) +- [Creating and consuming logs](logging.md) +- [Debugging native code](debugger.md)
diff --git a/third_party/fuchsia-sdk/docs/bootserver.md b/third_party/fuchsia-sdk/docs/bootserver.md new file mode 100644 index 0000000..fa201dd --- /dev/null +++ b/third_party/fuchsia-sdk/docs/bootserver.md
@@ -0,0 +1,46 @@ +# Bootserver + +The `bootserver` host tool can be used to pave, netboot or boot Fuchsia on a +target device. This tool is very likely to go away in the short future with +a replacement being currently implemented. + +## x64 + +### Generic + +To pave and boot on a generic `x64` target, run: + +``` +bootserver \ + --boot "$IMAGES_PATH/fuchsia.zbi" \ + --bootloader "$IMAGES_PATH/fuchsia.esp.blk" \ + --fvm "$IMAGES_PATH/obj/build/images/fvm.sparse.blk" \ + --zircona "$IMAGES_PATH/fuchsia.zbi" \ + --zirconr "$IMAGES_PATH/zedboot.zbi" +``` + +### Chromebook + +To pave and boot on a `chromebook` target, run: + + +``` +bootserver \ + --boot "$IMAGES_PATH/fuchsia.zbi" \ + --fvm "$IMAGES_PATH/obj/build/images/fvm.sparse.blk" \ + --zircona "$IMAGES_PATH/fuchsia.zbi.vboot" \ + --zirconr "$IMAGES_PATH/zedboot.vboot" +``` + + +## arm64 + +To pave and boot on an `arm64` target, run: + +``` +bootserver \ + --boot "$IMAGES_PATH/fuchsia.zbi" \ + --fvm "$IMAGES_PATH/obj/build/images/fvm.sparse.blk" \ + --zircona "$IMAGES_PATH/fuchsia.zbi" \ + --zirconr "$IMAGES_PATH/zedboot.zbi" +```
diff --git a/third_party/fuchsia-sdk/docs/compilation.md b/third_party/fuchsia-sdk/docs/compilation.md new file mode 100644 index 0000000..dcf9c71 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/compilation.md
@@ -0,0 +1,41 @@ +# Compiling C/C++ code + +The present document compiles a list of guidelines, recommendations, and +expectations around the topic of compiling C and C++ code against the Core SDK. + + +## Sysroot + +The Fuchsia sysroot for a given target architecture is available under +`//arch/<architecture>/sysroot`. +That directory contains a complete sysroot and may be used with any tool that +accepts a `--sysroot` flag. + + +## Prebuilts + +All prebuilts have C linkage. + +### Debug symbols + +Debug symbols for all prebuilts are available under `//.build-id`, which follows +a [standard convention][build-id]. + + +## Compilation parameters + +- C++ sources are compatible with both C++14 and C++17. + +### Warning flags + +The following flags are guaranteed to not generate any warning: +- `-Wall` +- `-Wextra-semi` +- `-Wnewline-eof` +- `-Wshadow` + +The following flags may generate warnings: +- `-Wdeprecated-declarations` + + +[build-id]: https://fedoraproject.org/wiki/Releases/FeatureBuildId#Find_files_by_build_ID
diff --git a/third_party/fuchsia-sdk/docs/debugger.md b/third_party/fuchsia-sdk/docs/debugger.md new file mode 100644 index 0000000..d2c9aac --- /dev/null +++ b/third_party/fuchsia-sdk/docs/debugger.md
@@ -0,0 +1,67 @@ +# Debugger (zxdb) + +Zxdb is a console debugger for native code compiled with DWARF symbols (C, C++ +and Rust). The frontend runs on the host computer and connects to the on-device +`debug_agent`. This document describes how to set up these processes. + +## Running the agent + +The `debug_agent` is run on the target device along with the port number that +it should listen to for incoming client connections. Typically this command +will be run from a console after [ssh-ing](ssh.md) in to the system: + +``` +run fuchsia-pkg://fuchsia.com/debug_agent#meta/debug_agent.cmx --port=2345 +``` + +## Connecting the client + +The `zxdb` client program is run on the host computer. It can be connected to +the `debug_agent` via the interactive `connect` debugger command or it can +automatically connect based on a command-line flag. Both IPv4 and IPv6 +addresses are supported (see [device discovery](device_discovery.md) to find +the address). The port should match the port number passed to the agent. + +``` +zxdb -c "[f370::5051:ff:1e53:589a%qemu]:2345" +``` + +### Connecting via a script + +Scripts may want to automatically launch the agent and client automatically. +The script should wait for the port to be open on the target system before +launching the client. Automatic retry is not yet implemented in the client. + +To clean up the debug agent gracefully when the client exits, pass the +`--quit-agent-on-exit` command-line flag to the client. + +## Specifying symbol paths + +The debugger expects unstripped ELF files to be available on the local host +system. Symbols on the target are not used. The location where the local build +stores symbols must be passed to the `zxdb` client. + +Local symbols can be passed on the command line: + +``` +zxdb --symbol-path=/path-to-symbols +``` + +The path can be any of: + + * An individual symbolized ELF file. + * An ids.txt file mapping build IDs to local files. + * A directory name. If the directory is a GNU-style symbol repo (see below), + symbols will be taken from the .build-id folder beneath it, otherwise the + directory will be searched (non-recursively) for symbolized ELF files. + +GNU-style symbol repos are directories of any layout which contain a folder at +the root called .build-id. This folder contains the symbolized binaries +indexed by the binaries' build IDs. Often these are symlinks pointing to +various locations in the folder itself. +``` +Multiple `--symbol-path` parameters may be specified if there are symbols in +more than one location. All locations will be searched. + +Symbol locations can also be edited interactively in the client using the +global "symbol-paths" setting (see the interactive "get" and "set" commands).
diff --git a/third_party/fuchsia-sdk/docs/device_discovery.md b/third_party/fuchsia-sdk/docs/device_discovery.md new file mode 100644 index 0000000..39cc1f5 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/device_discovery.md
@@ -0,0 +1,57 @@ +# `device-finder` + +`device-finder` is the command line tool for device discovery. It uses mDNS to +find Fuchsia devices. + +Currently only Linux is supported. For Mac users see the "For Mac Users" +section. + +## For Linux Users + +### Finding all Devices + +The simplest way to get all the devices on the network by their address is to +run + +``` +$ ./device-finder list +192.168.42.156 +``` + +This will give you the addresses of all Fuchsia devices on the network. If you'd +like to get their hostnames as well as their addresses, you can include the +`-full` flag. + +### Finding devices by hostname + +If you'd like to find your device by its unique hostname (e.g. +`lunch-feta-stool-woozy`) you can use the `resolve` command: + +``` +$ ./device-finder resolve lunch-feta-stool-woozy +192.168.42.156 +``` + +### Finding the Interface Connected to the Device + +To find the interface connected to the device, include the `-local` flag to +either the `list` command or the `resolve` command, which will give you the +address that the Fuchsia device can use to connect to your host. + +## For Mac Users + +For those on Mac hosts, you can use the included `dns-sd` command to find your +device. Here's an example command along with the output you should see when a +device is on your network: + +``` +$ dns-sd -B _fuchsia._udp . +Browsing for _fuchsia._udp +DATE: ---Fri 14 Dec 2018--- +15:28:21.447 ...STARTING... +Timestamp A/R Flags if Domain Service Type Instance Name +15:28:21.448 Add 2 7 local. _fuchsia._udp. quake-agile-lurk-even +``` + +Mac does not support the equivalent of a `local` flag as described above in the +`device-finder` docs.
diff --git a/third_party/fuchsia-sdk/docs/devices.md b/third_party/fuchsia-sdk/docs/devices.md new file mode 100644 index 0000000..c28d982 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/devices.md
@@ -0,0 +1,29 @@ +# Working with target devices + +## Connecting to a device + +Fuchsia target devices must be connected to a host device via a network link. +SSH is the protocol for communications over that link, as described in +[this document](ssh.md). + +### Getting the device address + +Getting the Fuchsia device address can be done using mDNS. Methods for device +discovery are outlined in [this document](device_discovery.md) + +## Flashing a device + +In order to flash a device, start a [bootserver](bootserver.md) on the host and +restart the device into its bootloader. + +## Installing software onto a device + +The unit of installation on Fuchsia is a package. +For information on how to push packages to a Fuchsia device, see the +[this document](packages.md). + +## Getting logs from a device + +In order to retrieve logs from a device, open a shell on the device and run the +`log_listener` command, which provides various filtering knobs. See +[this page](logging.md) for more details.
diff --git a/third_party/fuchsia-sdk/docs/logging.md b/third_party/fuchsia-sdk/docs/logging.md new file mode 100644 index 0000000..660e448 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/logging.md
@@ -0,0 +1,27 @@ +# Logging + +The preferred way to publish logs is to use the `syslog` API, currently +available for C in `//pkg/syslog`. + +The library provides the ability to tag logs so that they can later be filtered +upon retrieval. + +In order to get logs from a device, open a shell on the device as described in +[this document](ssh.md) and run: +``` +$ log_listener +``` + +To view specifics logs, add a tag specification: +``` +$ log_listener --tag foobar +``` + +## Symbolization + +`//tools/symbolize` should be used to symbolize stack traces. It should be +pointed to the `.build-id` directory at the root of the SDK, where debug symbols +are hosted: +``` +tools/symbolize --build-id-dir .build-id +```
diff --git a/third_party/fuchsia-sdk/docs/low_level.json b/third_party/fuchsia-sdk/docs/low_level.json new file mode 100644 index 0000000..4f48575 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/low_level.json
@@ -0,0 +1,16 @@ +{ + "docs": [ + "README.md", + "docs/README.md", + "docs/bootserver.md", + "docs/compilation.md", + "docs/debugger.md", + "docs/device_discovery.md", + "docs/devices.md", + "docs/logging.md", + "docs/packages.md", + "docs/ssh.md" + ], + "name": "low_level", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/docs/metadata_schemas.json b/third_party/fuchsia-sdk/docs/metadata_schemas.json new file mode 100644 index 0000000..ce1f62e --- /dev/null +++ b/third_party/fuchsia-sdk/docs/metadata_schemas.json
@@ -0,0 +1,17 @@ +{ + "docs": [ + "meta/schemas/cc_prebuilt_library.json", + "meta/schemas/cc_source_library.json", + "meta/schemas/common.json", + "meta/schemas/dart_library.json", + "meta/schemas/device_profile.json", + "meta/schemas/documentation.json", + "meta/schemas/fidl_library.json", + "meta/schemas/host_tool.json", + "meta/schemas/loadable_module.json", + "meta/schemas/manifest.json", + "meta/schemas/sysroot.json" + ], + "name": "metadata_schemas", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/docs/modular/modular_config_schema.json b/third_party/fuchsia-sdk/docs/modular/modular_config_schema.json new file mode 100644 index 0000000..01e18fc --- /dev/null +++ b/third_party/fuchsia-sdk/docs/modular/modular_config_schema.json
@@ -0,0 +1,145 @@ +{ + "$schema": "http://json-schema.org/schema#", + "title": "Schema for modular framework configuration", + "definitions": { + "basemgr": { + "type": "object", + "properties": { + "enable_cobalt": { "type": "boolean", "default": true }, + "enable_presenter": { "type": "boolean", "default": false }, + "test": { "type": "boolean", "default": false }, + "use_minfs": { "type": "boolean", "default": true }, + "use_session_shell_for_story_shell_factory": { + "type": "boolean", + "default": false + }, + "base_shell": { "$ref": "#definitions/base_shell" }, + "session_shells": { + "type": "array", + "items": { "$ref": "#/definitions/session_shell" } + }, + "story_shell_url": { + "type": "string", + "pattern": "^fuchsia-pkg://([^/]+)/([^/#]+)(/([^/#]+))?(#(.+))?$", + "default": "fuchsia-pkg://fuchsia.com/mondrian#meta/mondrian.cmx" + } + }, + "additionalProperties": false, + "required": ["base_shell", "session_shells"] + }, + "base_shell": { + "type": "object", + "properties": { + "url": { + "type": "string", + "pattern": "^fuchsia-pkg://([^/]+)/([^/#]+)(/([^/#]+))?(#(.+))?$", + "default": "fuchsia-pkg://fuchsia.com/dev_base_shell#meta/dev_base_shell.cmx" + }, + "keep_alive_after_login": { "type": "boolean", "default": false }, + "args": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": ["url"] + }, + "session_shell": { + "type": "object", + "properties": { + "url": { + "type": "string", + "pattern": "^fuchsia-pkg://([^/]+)/([^/#]+)(/([^/#]+))?(#(.+))?$", + "default": "fuchsia-pkg://fuchsia.com/ermine_session_shell#meta/ermine_session_shell.cmx" + }, + "display_usage": { "type": "string" }, + "screen_height": { "type": "number" }, + "screen_width": { "type": "number" } + }, + "additionalProperties": false, + "required": ["url"] + }, + "sessionmgr": { + "type": "object", + "properties": { + "cloud_provider": { + "type": "string", + "enum": ["LET_LEDGER_DECIDE", "FROM_ENVIRONMENT", "NONE"], + "default": "LET_LEDGER_DECIDE" + }, + "enable_cobalt": { "type": "boolean", "default": true }, + "enable_story_shell_preload": { "type": "boolean", "default": true }, + "use_memfs_for_ledger": { "type": "boolean", "default": false }, + "startup_agents": { + "type": "array", + "items": { + "type": "string", + "pattern": "^fuchsia-pkg://([^/]+)/([^/#]+)(/([^/#]+))?(#(.+))?$" + }, + "uniqueItems": true + }, + "session_agents": { + "type": "array", + "items": { + "type": "string", + "pattern": "^fuchsia-pkg://([^/]+)/([^/#]+)(/([^/#]+))?(#(.+))?$" + }, + "uniqueItems": true + }, + "component_args": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/component_args" + } + }, + "agent_service_index": { + "type": "array", + "items": { "$ref": "#/definitions/agent_service_index_entry" }, + "uniqueItems": true + } + }, + "additionalProperties": false + }, + "component_args": { + "type": "object", + "properties": { + "uri": { + "type": "string", + "pattern": "^[a-z|-]+://.+" + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "required": ["uri", "args"] + } + }, + "agent_service_index_entry": { + "type": "object", + "properties": { + "service_name": { + "type": "string", + "pattern": "^[^.]+[.][^.]+([.][^.]+)*$" + }, + "agent_url": { + "type": "string", + "pattern": "^fuchsia-pkg://([^/]+)/([^/#]+)(/([^/#]+))?(#(.+))?$" + } + }, + "additionalProperties": false, + "required": ["service_name", "agent_url"] + } + }, + "type": "object", + "properties": { + "basemgr": { "$ref": "#/definitions/basemgr" }, + "sessionmgr": { "$ref": "#/definitions/sessionmgr" } + }, + "required": ["basemgr", "sessionmgr"], + "additionalProperties": false +}
diff --git a/third_party/fuchsia-sdk/docs/modular_config_schema.json b/third_party/fuchsia-sdk/docs/modular_config_schema.json new file mode 100644 index 0000000..39e11eb --- /dev/null +++ b/third_party/fuchsia-sdk/docs/modular_config_schema.json
@@ -0,0 +1,7 @@ +{ + "docs": [ + "docs/modular/modular_config_schema.json" + ], + "name": "modular_config_schema", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/docs/musl_license.json b/third_party/fuchsia-sdk/docs/musl_license.json new file mode 100644 index 0000000..e2121e9 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/musl_license.json
@@ -0,0 +1,7 @@ +{ + "docs": [ + "COPYRIGHT.musl" + ], + "name": "musl_license", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/docs/open_source.json b/third_party/fuchsia-sdk/docs/open_source.json new file mode 100644 index 0000000..376bda4 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/open_source.json
@@ -0,0 +1,9 @@ +{ + "docs": [ + "AUTHORS", + "LICENSE", + "PATENTS" + ], + "name": "open_source", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/docs/packages.md b/third_party/fuchsia-sdk/docs/packages.md new file mode 100644 index 0000000..b230a7f --- /dev/null +++ b/third_party/fuchsia-sdk/docs/packages.md
@@ -0,0 +1,161 @@ +# Packages + +A package is the unit of installation on a Fuchsia system. + +## Anatomy + +_To be added..._ + +## Working with packages + +The majority of these instructions rely on the `pm` tool which is available +in `//tools`. + +This document describes the various steps to build and install a package: + +* [Build a package](#build-package) +* [Publish a package](#publish-package) +* [Install a package](#install-package) +* [Run a component from an installed package](#run-component) + +For more details about each step, see `pm`'s help messages. + +### Build a package {#build-package} + +To build a package: + +1. Create the package ID file: + + Note: `$PACKAGE_DIR` is a staging directory where the package + is built. + + ``` + pm -o $PACKAGE_DIR -n $PACKAGE_NAME init + ``` + + This generates the package ID file implicitly as + `$PACKAGE_DIR/meta/package`. Set `$PACKAGE_ID_FILE` accordingly + for use in subsequent steps: + + ``` + export PACKAGE_ID_FILE=${PACKAGE_DIR}/meta/package + ``` + + `$PACKAGE_ID_FILE` will contain the following data: + + ``` + { + "name": "<package name>", + "version": "<package version>" + } + ``` + +2. Create the manifest file, `$MANIFEST_FILE`, that provides the path to + the package ID file. Each line of a manifest file maps a single file that + is contained in the package and is in the form of `destination=source` where: + + * `destination` is the path to the file in the final package + * `source` is the path to the file on the host machine + + The manifest file must include at least one line for the package ID file like + this: + + ``` + meta/package=<package ID file> + ``` + +3. Generate the package metadata archive: + + ``` + pm -o $PACKAGE_DIR -m $MANIFEST_FILE build + ``` + + This creates the metadata archive at `$PACKAGE_DIR/meta.far`. + +4. Create the package archive `$PACKAGE_ARCHIVE`: + + ``` + pm -o $PACKAGE_DIR -m $MANIFEST_FILE archive + ``` + + This command creates the package archive implicitly as + `$PACKAGE_DIR/$PACKAGE_NAME-0.far`. Set `$PACKAGE_ARCHIVE` accordingly + for use in subsequent steps: + + ``` + export PACKAGE_ARCHIVE=${PACKAGE_DIR}/${PACKAGE_NAME}-0.far + ``` + + If the contents of the package change, you need to re-run the + `pm -o $PACKAGE_DIR -m $MANIFEST_FILE archive` command. + +You have successfully built a package. You are now ready to publish the package. + +### Publish a package {#publish-package} + +To publish a package: + +1. Initialize a directory, `$REPO`, that serves as a packages repository: + + ``` + pm newrepo -repo $REPO + ``` + + This creates a directory structure named `$REPO` that is ready for + publishing packages. + +2. Publish packages to the repository `$REPO`: + + ``` + pm publish -a -r $REPO -f $PACKAGE_ARCHIVE + ``` + + `pm publish` parses `$PACKAGE_ARCHIVE` and publishes the package in the + provided `$REPO` directory. If you run this command multiple times with + different package archives, `pm publish` publishes the packages to the same + repository. New versions of a same package can be published using the same + command. + +You have successfully published a package. You are now ready to install a +package. + +### Install a package {#install-package} + +To install a package: + +1. Start the package server: + + ``` + pm serve -repo $REPO + ``` + + By default, this starts an amber server on the host machine at port `8083`. + +2. (On the target device) Add the new repository as an update source with + `amberctl`: + + ``` + amberctl add_repo_cfg -n $REPO -f http://$HOST_ADDRESS:8083/config.json + ``` + + If the component is not already on the system, `amberctl` installs the package. + If the package already exists, `amberctl` installs any package updates. + +You have successfully installed or updated the package. You are now ready to +run a component from the installed package. + +### Run a component from an installed package {#run-component} + +To run a component published in a package: + +1. (On the target device) Run: + + Note: `$COMPONENT_URI` is in this form + `fuchsia-pkg://${REPO}/${PACKAGE_NAME}#meta/<component name>.cmx`. + + ``` + run $COMPONENT_URI + ``` + +You have successfully run a component from the installed package. +
diff --git a/third_party/fuchsia-sdk/docs/ssh.md b/third_party/fuchsia-sdk/docs/ssh.md new file mode 100644 index 0000000..3426c5b --- /dev/null +++ b/third_party/fuchsia-sdk/docs/ssh.md
@@ -0,0 +1,59 @@ +# SSH + +SSH is the supported protocol for communication between a Fuchsia target device +and a host device. +This document describes how to properly set up an SSH connection between these +devices. + +## Prerequisites + +On the host side, a proper SSH distribution is required. + +A public/private keypair is also needed. +It may be generated via the `ssh-keygen` command, or extracted from the running +SSH agent via `ssh-add -L`. + +## Provisioning a device + +There are two options for installing the public key onto the target. + +### By installing it during paving (preferred) + +Follow the instruction for [paving](bootserver.md) the target device, and add an +extra argument to the `bootserver` call pointing to the public key: +``` +$ bootserver --authorized-keys $PUBLIC_KEY <other args> +``` + +### By modifying the Fuchsia image directly + +The `fuchsia.zbi` image may be modified to include the public key using the +`zbi` tool: +``` +$ zbi -o $FUCHSIA_DOT_ZBI -e data/ssh/authorized_keys=$PUBLIC_KEY +``` + +Note that this method is mainly designed for situations where paving is not +necessarily an efficient option (e.g. testing on an emulator). +Use with care. + +## Connecting to a device + +Provided that the address of the target device is known as `$TARGET_ADDRESS`, +open a shell on that device with: +``` +$ ssh -i $PRIVATE_KEY fuchsia@$TARGET_ADDRESS +``` + +Note that if you got the key from your SSH agent, or if the key is in a well +known location (`$SSH_HOME`) under a well known name (`id_*`), you may omit the +`-i` argument. + +Note also that the host keys for a Fuchsia target device are generated at first +boot, meaning that every time the device gets paved the keys are going to +change. +You may want to disable host key checking when connecting to a Fuchsia device to +avoid running into errors by adding the following flags: +``` +-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null +```
diff --git a/third_party/fuchsia-sdk/docs/vulkan_license.json b/third_party/fuchsia-sdk/docs/vulkan_license.json new file mode 100644 index 0000000..0ee5ef9 --- /dev/null +++ b/third_party/fuchsia-sdk/docs/vulkan_license.json
@@ -0,0 +1,7 @@ +{ + "docs": [ + "LICENSE.vulkan" + ], + "name": "vulkan_license", + "type": "documentation" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/BUILD.gn new file mode 100644 index 0000000..fb8ef57 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.accessibility.semantics") { + library_name = "semantics" + namespace = "fuchsia.accessibility" + public_deps = [ + "../fuchsia.math", + "../fuchsia.ui.gfx", + "../fuchsia.ui.views", + ] + sources = [ + "node.fidl", + "semantics_manager.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.accessibility.semantics", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/meta.json new file mode 100644 index 0000000..abcf651 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/meta.json
@@ -0,0 +1,14 @@ +{ + "deps": [ + "fuchsia.math", + "fuchsia.ui.gfx", + "fuchsia.ui.views" + ], + "name": "fuchsia.accessibility.semantics", + "root": "fidl/fuchsia.accessibility.semantics", + "sources": [ + "fidl/fuchsia.accessibility.semantics/node.fidl", + "fidl/fuchsia.accessibility.semantics/semantics_manager.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/node.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/node.fidl new file mode 100644 index 0000000..e17da74 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/node.fidl
@@ -0,0 +1,119 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.accessibility.semantics; + +using fuchsia.ui.gfx; + +/// Represents actions that can be applied to Nodes. +enum Action { + /// The default action associated with the element. + DEFAULT = 1; + /// The secondary action associated with the element. This may correspond to a long press + /// (touchscreens) or right click (mouse). + SECONDARY = 2; + /// Set (input/non-accessibility) focus on this element. + SET_FOCUS = 3; + /// Set the element's value. + SET_VALUE = 4; + /// Scroll node to make it visible. + SHOW_ON_SCREEN = 5; +}; + +/// Represents a role of an element on a UI. +enum Role { + /// Role used to represent elements which role is not currently supported. + UNKNOWN = 1; + /// Something on screen that can be clicked/activated, that has a single function. + BUTTON = 2; + /// Header text, e.g. something tagged <h1> in HTML. + HEADER = 3; + /// An image or graphic. + IMAGE = 4; + /// A field containing text that is not a header. + TEXT_FIELD = 5; +}; + +/// An attribute is an essential property to describe an element. Unlike states, attributes do not +/// change over the life of an element. +/// Example: A button with a label attribute 'ok' should never change to 'cancel', as this is not +/// the same element. +table Attributes { + /// The primary label for an element. If longer than MAX_LABEL_SIZE the client is responsible + /// for truncating the label. + 1: string:MAX_LABEL_SIZE label; + + /// The secondary label for an element. If longer than MAX_LABEL_SIZE the client is responsible + /// for truncating the label. + 2: string:MAX_LABEL_SIZE secondary_label; + + /// A description of what the secondary action on a node (equivalent to long press or right click) should do. + 3: string:MAX_LABEL_SIZE secondary_action_description; +}; + +/// Represents the state of a UI checkbox. +enum CheckedState { + /// Used when no data is entered or the element is not a check box. + NONE = 1; + /// Checked + CHECKED = 2; + /// Unchecked + UNCHECKED = 3; + /// Indeterminate state + MIXED = 4; +}; + +/// A state is a dynamic property of an element that may change in response to +/// user action or automated processes. Thus, they are different from attributes +/// in an important point, which is frequency of change. +table States { + /// DEPRECATED + 1: bool checked; + + /// State of a checkbox. + 2: CheckedState checked_state; + + /// Whether the element is currently selected. + 3: bool selected; + + /// Whether the element is currently hidden or marked invisible by the framework. + 4: bool hidden; + + /// The user-entered value of the element, if applicable. If longer than MAX_VALUE_SIZE the + /// client is responsible for truncating. + 5: string:MAX_VALUE_SIZE value; +}; + +/// The Node represents a semantic element on an interface. This may +/// be a button, a text field, a checkbox or any element that has a relevant +/// semantic meaning so that assistive technology can understand the current UI. +table Node { + /// Unique ID that represents a node in a particular UI. + /// Zero is assumed to be the root node and the only entry point to the tree. + /// No forest is allowed. + 1: uint32 node_id; + + /// Role of this element, e.g. button, checkbox, etc. + 2: Role role; + + /// A table of states of this object, e.g. checked, editable, etc. + 3: States states; + + /// A table of attributes of this node. + 4: Attributes attributes; + + /// A list of actions that can be performed on this node. + 5: vector<Action>:100 actions; + + /// The list of child IDs of this node, in traversal order. Runtimes supplying semantic tree + /// information are responsible for ensuring the tree does not contain cycles. Each node may + /// have only one parent. + 6: vector<uint32>:MAX_FAN_OUT child_ids; + + /// Local bounding box of this element. + 7: fuchsia.ui.gfx.BoundingBox location; + + /// Transform from parent coordinate space to local space. 4x4 for compatibility with scenic. + 8: fuchsia.ui.gfx.mat4 transform; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/semantics_manager.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/semantics_manager.fidl new file mode 100644 index 0000000..050b2ae --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.accessibility.semantics/semantics_manager.fidl
@@ -0,0 +1,97 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.accessibility.semantics; + +using fuchsia.math; +using fuchsia.ui.views; + +/// Maximum depth of the semantic tree. +const uint64 MAX_TREE_DEPTH = 256; + +/// Maximum number of children for a node in the semantic tree. +const uint64 MAX_FAN_OUT = 20000; + +/// Maximum number of semantic nodes that may be sent in a single update. +const uint64 MAX_NODES_PER_UPDATE = 2048; + +/// Maximum size of a label string, in bytes. +const uint64 MAX_LABEL_SIZE = 16384; + +/// Maximum size of a value string, in bytes. +const uint64 MAX_VALUE_SIZE = 16384; + +/// An interface to manage connections with views for the purposes of gathering semantic information +/// about their current UI state. +/// +/// The manager allows clients to register as a semantic provider for their view(s). In return the +/// semantics manager supplies an interface to update, commit and delete information from the +/// semantic tree for that view. If the semantic manager encounters an error, it will close the +/// channel, delete any associated data and rely on the client to re-register. +[Discoverable] +protocol SemanticsManager { + RegisterViewForSemantics(fuchsia.ui.views.ViewRef view_ref, + SemanticListener listener, + request<SemanticTree> semantic_tree_request); +}; + +/// Interface to update the semantic tree for a particular view. Nodes can be added, updated or +/// deleted. Because the size of an update may exceed FIDL transfer limits, clients are responsible +/// for breaking up changes into multiple update and delete calls that conform to these limits. The +/// commit function must always be called at the end of a full update push to signal the end of an +/// update. +/// +/// The client may make several calls to UpdateSemanticNodes(...) or DeleteSemanticNodes(...) +/// before calling CommitUpdates(), and must wait for the semantics manager to reply to the +/// CommitUpdates() method to know whether an update has been processed. This allows the client to +/// break up a set of changes (e.g. a re-computed semantic tree) to the semantic tree into +/// FIDL-compatible chunks, but commit them all at once. +/// +/// If the semantics manager ever receives inconsistent state from the client, such as an +/// invalid tree or unrecognized parent node id, the server will close the channel. The client is +/// responsible for reconnecting and re-sending its state from scratch. +protocol SemanticTree { + + /// Sends new/updated nodes to the root to add to the cache on the next commit. + UpdateSemanticNodes(vector<Node>:MAX_NODES_PER_UPDATE nodes); + + /// Tells the root to remove nodes with node_ids from the semantic tree on the next commit. + DeleteSemanticNodes(vector<uint32>:MAX_NODES_PER_UPDATE node_ids); + + /// Commits pending changes to node tree associated with the view using UpdateSemanticNodes and + /// DeleteSemanticNodes. Updates are processed in the order in which they are received. If the + /// committed updates result in an ill-formed tree (for example a missing root node or a cycle) + /// the semantic manager will close the channel. + CommitUpdates() -> (); +}; + +/// Results of hit testing on a view's semantic tree which is implemented by +/// Runtimes(like Flutter/Chrome) and sent to Accessibility. +table Hit { + /// Unique ID that represents a node in a particular UI. + /// Zero is assumed to be the root node and the only entry point to the tree. + /// node_id will not be filled when there is no hit. + 1: uint32 node_id; + + /// The ordered list of node ids which represent path from root node to the hit node. + 2: vector<uint32>:MAX_TREE_DEPTH path_from_root; +}; + +/// A semantic provider is the client-side interface that the manager can use to enable or disable +/// semantic updates, and to ask clients to perform accessibility actions. +protocol SemanticListener { + /// Asks the semantics provider to perform an accessibility action on the + /// node with node id in the front-end. + OnAccessibilityActionRequested(uint32 node_id, Action action) -> (bool handled); + + /// Asks the semantics provider to perform hit testing and return the result. + [Transitional] + HitTest(fuchsia.math.PointF local_point) -> (Hit result); + + /// Callback telling the client whether or not to send updates to the semantic tree. + /// The semantics manager will clear all state when this is called with updates_enabled = false. + /// When called with updates_enabled = true, the client should sent the full state of the + /// current semantic tree. + OnSemanticsModeChanged(bool updates_enabled) -> (); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/BUILD.gn new file mode 100644 index 0000000..3c42caf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.auth.oldtokens") { + library_name = "oldtokens" + namespace = "fuchsia.auth" + public_deps = [ + ] + sources = [ + "credentials_producer.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.auth.oldtokens", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/credentials_producer.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/credentials_producer.fidl new file mode 100644 index 0000000..30c33bf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/credentials_producer.fidl
@@ -0,0 +1,33 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.auth.oldtokens; + +/// The id of a user linked to this device, alongside the current access token +/// to make requests on the user's behalf. +table Credential { + /// Opaque id for the user with which this credential is associated. It is + /// stable across reconnections to the CredentialsProducer protocol. + 1: string user_id; + + /// OAuth2 access token for this user. + 2: string access_token; +}; + +/// Clients can connect to this protocol to subscribe to changes in the set of +/// users linked to this device, as well as the OAuth2 access token associated +/// with each. +/// +/// This protocol won't be supported on the majority of devices, and shouldn't +/// be used without permission from its maintainers. +[Discoverable] +protocol CredentialsProducer { + /// Get the set of users linked to this device, and their corresponding access + /// tokens. While the connection to the service remains uninterrumpted, the + /// method call hangs if it would return the same response as the previous + /// time it was called by this client. In other words, if the client already + /// has the most up-to-date credentials, the method acts as a hanging get and + /// only returns when there's an update to report. + GetUpdatedCredentials() -> (vector<Credential> credentials); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/meta.json new file mode 100644 index 0000000..2ddace2 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth.oldtokens/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.auth.oldtokens", + "root": "fidl/fuchsia.auth.oldtokens", + "sources": [ + "fidl/fuchsia.auth.oldtokens/credentials_producer.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.auth/BUILD.gn new file mode 100644 index 0000000..dc93166 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.auth") { + library_name = "auth" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.ui.views", + ] + sources = [ + "attestation_signer.fidl", + "auth_provider.fidl", + "common.fidl", + "token_manager.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.auth", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth/attestation_signer.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.auth/attestation_signer.fidl new file mode 100644 index 0000000..c630e9f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth/attestation_signer.fidl
@@ -0,0 +1,31 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.auth; + +/// This file contains an interface to cryptographically sign any plain text data +/// using any crypto key. This interface is useful for signing JWT's in device +/// attestation based authentication. +/// +/// Specifies the success/failure status from the attestation signer. +enum AttestationSignerStatus { + /// The command completed successfully + OK = 0; + /// The command referred to a missing, or an invalid argument. + INVALID_ARGUMENT = 1; + /// There was an error in generating crypto signatures for the given + /// plaintext. This usually indicates errors for misconfigured keys or + /// signature algorithms from the underlying crypto library. + SIGNING_ERROR = 2; +}; + +protocol AttestationSigner { + /// Cryptographically signs the `plaintext` data sent in request using a + /// crypto key configured at initialization. + /// + /// Returns the raw bytes of the `signature` string on success. Otherwise, + /// an error status is returned. + SignData(bytes plaintext) + -> (AttestationSignerStatus status, bytes? signature); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth/auth_provider.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.auth/auth_provider.fidl new file mode 100644 index 0000000..09f969e --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth/auth_provider.fidl
@@ -0,0 +1,45 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.auth; + +using fuchsia.ui.views; + +/// User attributes returned to callers on authorizing a new user at any auth +/// provider. These attributes are generated by calling the auth provider's +/// user profile apis. +struct UserProfileInfo { + /// User identifier returned by the backend identity provider server to + /// identify the user after successful authorization. Some identity providers + /// send verified email address as the identifier, and some send an opaque + /// string as the user identifier. + string id; + + /// The name that is displayed on the base shell while logging in. Display + /// name is fetched from user profile attributes as configured by the user at + /// the given identity provider. + string? display_name; + + /// User's profile url that is used by the base shell while logging in. + /// Profile url is fetched from user profile attributes as configured by the + /// user at the given identity provider. + string? url; + + /// User's profile image url that is used by the base shell while logging in. + /// Profile image url is fetched from user profile attributes as configured by + /// the user at the given identity provider. + string? image_url; +}; + +/// This interface is implemented by base shell. It is used to notify the +/// base shell that a view for login needs to be started / stopped. +protocol AuthenticationUIContext { + /// Requests base shell to display `view_holder_token` for authentication. + /// Another call to StartOverlay() will not be made until StopOverlay() + /// has been called. + StartOverlay(fuchsia.ui.views.ViewHolderToken view_holder_token); + + /// Requests base shell to stop displaying the auth view. + StopOverlay(); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth/common.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.auth/common.fidl new file mode 100644 index 0000000..2385757 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth/common.fidl
@@ -0,0 +1,22 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.auth; + +/// A unique identifier for an account with some service provider, comprised of +/// the identity of the service provider and an account identity supplied by that +/// service provider. +/// +// TODO(jsankey): Integrate other parts of the AuthProvider API with this +// domain-based identity. In general multiple auth_provider_types may exist for +// the same identity_provider_domain. +struct ServiceProviderAccount { + /// The primary domain of the identity provider, such as "www.google.com". + string identity_provider_domain; + + /// User identifier as supplied by the identity provider. Some identity + /// providers send verified email address as the identifier, some send an + /// opaque string. + string user_profile_id; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.auth/meta.json new file mode 100644 index 0000000..c2d641a --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth/meta.json
@@ -0,0 +1,14 @@ +{ + "deps": [ + "fuchsia.ui.views" + ], + "name": "fuchsia.auth", + "root": "fidl/fuchsia.auth", + "sources": [ + "fidl/fuchsia.auth/attestation_signer.fidl", + "fidl/fuchsia.auth/auth_provider.fidl", + "fidl/fuchsia.auth/common.fidl", + "fidl/fuchsia.auth/token_manager.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.auth/token_manager.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.auth/token_manager.fidl new file mode 100644 index 0000000..533a09b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.auth/token_manager.fidl
@@ -0,0 +1,210 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.auth; + +/// Specifies the success/failure status of TokenManager calls. +enum Status { + /// The command completed successfully + OK = 0; + /// The command referred to a missing, misconfigured, or failed auth provider. + /// Retrying is not recommended. + AUTH_PROVIDER_SERVICE_UNAVAILABLE = 1; + /// The auth server was reachable but responded with an error. These errors + /// are typically caused by a configuration problem or a revoked token and so + /// should not be retried. + AUTH_PROVIDER_SERVER_ERROR = 2; + /// An internal error occurred. This usually indicates a bug within the Token + /// Manager itself. Retry is optional. + INTERNAL_ERROR = 3; + /// An invalid or non-functional AuthContextProvider was provided. Retrying is + /// unlikely to correct this error. + INVALID_AUTH_CONTEXT = 4; + /// The request was malformed in some way, such as using an empty string for + /// the user_profile_id. The request should not be retried. + INVALID_REQUEST = 5; + /// The requested user profile could not be found in the database. The request + /// should not be retried. + USER_NOT_FOUND = 6; + /// A local error occurred such as disk I/O or memory allocation. Retry, after + /// a delay, is recommended. + IO_ERROR = 7; + /// Some other problem occurred that cannot be classified using one of the more + /// specific statuses. Retry is optional. + UNKNOWN_ERROR = 8; + /// The auth server requires that the user reauthenticate. The client should + /// call the Authorize method. + REAUTH_REQUIRED = 9; + /// The user cancelled the flow. User consent is required before any retry. + USER_CANCELLED = 10; + /// A network error occurred while communicating with the auth server. Retry, + /// after a delay, is recommended. + NETWORK_ERROR = 11; +}; + +/// Stores configuration parameters required to connect to available +/// `AuthProvider`s. It is used by TokenManager to instantiate all auth providers +/// during startup. +struct AuthProviderConfig { + /// Type of OAuth Identity provider. An identity provider authenticates and + /// authorizes users for accessing their services. They also provide unique + /// identifiers for users to interact with the system and may provide + /// information about the user that is known to the provider. + /// + /// Sample auth provider types include: + /// Dev : An identity provider that's used for development and testing. + /// Google: Uses Google as the identity provider. Authorization from Google + /// requires a working network connection and a web view. + /// Spotify: Uses Spotify as an identity provider. + string auth_provider_type; + + /// Url of the Fuchsia component implementing the AuthProvider. + string url; + + /// Optional parameters specified during AuthProvider startup. + vector<string>? params; +}; + +/// Stores OAuth configuration details for a given client application. These +/// details are used in the OAuth authorization step. +struct AppConfig { + /// An OAuth identity provider matching a configuration set in + /// AuthProviderConfig.auth_provider_type. + string auth_provider_type; + + /// OAuth client id. + string? client_id; + + /// OAuth client secret. + /// This field is optional and will only be used on calls to Authorize. + string? client_secret; + + /// OAuth application's redirect uri. + /// This field is optional and will only be used on calls to Authorize. + string? redirect_uri; +}; + +/// Implemented by a privileged system component with the ability to display UI +/// to the end user. +/// +/// This is provided during the initialization of TokenManager service and is +/// used for any subsequent authorize calls. The UI contexts created by this +/// interface are used to display OAuth login and permission screens to the end +/// user. +protocol AuthenticationContextProvider { + GetAuthenticationUIContext(request<AuthenticationUIContext> request); +}; + +/// This interface provides a discoverable mechanism to create TokenManager +/// instances for each user, and to supply auth provider configuration +/// information using the structs defined in `auth_provider.fidl`. +[Discoverable] +protocol TokenManagerFactory { + /// Creates an OAuth TokenManager instance scoped for the component specified + /// by `application_url`, the Fuchsia user specified by `user_id`, and the list + /// of auth providers specified in `auth_provider_configs`. + /// + /// `auth_context_provider` is used to generate AuthenticationUIContexts during + /// TokenManager methods that require UI, unless the caller of those methods + /// supplies an alternative AuthenticationUIContext. + GetTokenManager(string user_id, string application_url, + vector<AuthProviderConfig> auth_provider_configs, + AuthenticationContextProvider auth_context_provider, + request<TokenManager> token_manager); +}; + +/// This interface manages OAuth tokens at the Fuchsia system level for different +/// auth identity providers. +/// +/// If user authorization is required for minting tokens, TokenManager uses the +/// `auth_context_provider's` UI context for displaying OAuth UI to the end user. +/// +/// After initialization, TokenManager handles are typically handed out by +/// Framework to components like Ledger and Agents. These components fetch +/// OAuth tokens from any configured auth provider, and use the +/// `auth_context_provider` initialized above for new authorizations. +protocol TokenManager { + /// The first step of OAuth is to get authorization from the user. For Fuchsia + /// components, this is accomplished by displaying OAuth permissions in a view + /// provided by the caller. This view will use `auth_ui_context` if supplied, + /// or the `auth_context_provider` supplied at TokenManager creation if not. + /// The component's OAuth configuration is provided in `app_config` and + /// `app_scopes`. An optional `user_profile_id` that uniquely identifies an + /// account for a given auth provider may be provided to identify an existing + /// account during a re-auth flow. + /// + /// IoT ID authorization includes a mode where the user authorizes on a second + /// device and that device acquires an auth code from the auth provider. + /// In this mode, the auth code may be supplied in `auth_code` and no local + /// user interface will be displayed. + /// + /// After the user has successfully authorized, Token manager receives and + /// securely stores a persistent credential, such as an OAuth refresh token, + /// for the intended scopes. TokenManager later uses this credential for + /// minting short lived tokens. + /// + /// If the operation is successful, an OK status is returned along with user + /// profile information in `user_profile_info` such as the user's email, + /// image_url, profile_url, and first and last names as configured on the auth + /// provider backend system. + Authorize(AppConfig app_config, AuthenticationUIContext? auth_ui_context, + vector<string> app_scopes, string? user_profile_id, string? auth_code) + -> (Status status, UserProfileInfo? user_profile_info); + + /// Returns a downscoped access token from an auth provider for the given user + /// `user_profile_id` and `scopes` to a Fuchsia component. The component's + /// OAuth configuration is provided in `app_config` and the `user_profile_id` + /// is the unique user identifier returned by the Authorize() call. + /// + /// In the interests of performance, Token Manager does not place the supplied + /// scopes in a canonical order during caching. To benefit from caching of + /// tokens, clients must request the same scopes in the same order across + /// calls. + /// + /// The access token is returned from cache if possible, otherwise the auth + /// provider is used to exchange the persistent credential for a new access + /// token. + GetAccessToken(AppConfig app_config, string user_profile_id, + vector<string> app_scopes) -> (Status status, string? access_token); + + /// Returns a JWT identity token from an auth provider to a Fuchsia component + /// intended for the given `audience`. The component's OAuth configuration is + /// supplied in `app_config`, the intended recipient of the id_token is + /// supplied in `audience`, and `user_profile_id` is a unique account + /// identifier returned by the Authorize() or ListProfileIds() calls. + /// + /// `user_profile_id` is the unique user identifier returned by the + /// Authorize() call. + /// + /// The identity token is returned from cache if possible, otherwise the auth + /// provider is used to exchange the persistant credential for a new identity + /// token. + GetIdToken(AppConfig app_config, string user_profile_id, string? audience) + -> (Status status, string? id_token); + + /// Deletes and revokes all long lived and short lived tokens generated for + /// an account and on behalf of a Fuchsia component. The component's OAuth + /// configuration is provided in `app_config` and `user_profile_id` + /// is a unique account identifier returned by the Authorize() or + /// ListProfileIds() calls. + /// + /// Deletion of tokens involves three steps: + /// + /// 1. Revoking credentials remotely at the auth provider. + /// 2. Deleting short lived tokens from the in-memory cache. + /// 3. Deleting persistent credentials stored locally on disk. + /// + /// If `force` is false then a failure at step 1 will terminate the method, + /// ensuring client and server state remain consistent. If `force` is true + /// then steps 2&3 will be performed and the method will return OK even if + /// step 1 fails, ensuring the local credentials are wiped in all + /// circumstances. + DeleteAllTokens(AppConfig app_config, string user_profile_id, bool force) + -> (Status status); + + /// Returns a vector of all currently authorized user_profile_ids for a + /// component's OAuth configuration provided in `app_config`. + ListProfileIds(AppConfig app_config) + -> (Status status, vector<string> user_profile_ids); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/BUILD.gn new file mode 100644 index 0000000..0642034 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.bluetooth.a2dp") { + library_name = "a2dp" + namespace = "fuchsia.bluetooth" + public_deps = [ + ] + sources = [ + "audio_mode.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.bluetooth.a2dp", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/audio_mode.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/audio_mode.fidl new file mode 100644 index 0000000..7dba806 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/audio_mode.fidl
@@ -0,0 +1,31 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.a2dp; + +/// Enum corresponding to the A2DP SRC/SNK roles as defined in the +/// A2DP v1.3.2 profile specification, section 2.2. +enum Role { + /// Act as a source of digital audio streams, sending audio to peers. + SOURCE = 1; + /// Act as a sink of digital audio streams and play audio sent from peers. + SINK = 2; +}; + +/// A protocol for specifying which A2DP role this device should operate. +[Discoverable] +protocol AudioMode { + /// Switch the device to act as the specified A2DP Role. If the device is already + /// set to the requested role, calling this method is a no-op. + /// + /// When this method returns, a client can depend on the following: + /// 1. If the role was switched, the previous profile has requested removal + /// from the hosts' SDP databases, and all L2CAP channels associated with + /// the previous profile have initiated or completed the process of closing. + /// 2. The device is in the requested A2DP role. + /// + /// If the role cannot be set due to an internal error, the server will close + /// the channel. + SetRole(Role role) -> (); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/meta.json new file mode 100644 index 0000000..7a3400e --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.a2dp/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.bluetooth.a2dp", + "root": "fidl/fuchsia.bluetooth.a2dp", + "sources": [ + "fidl/fuchsia.bluetooth.a2dp/audio_mode.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/BUILD.gn new file mode 100644 index 0000000..cda52a3 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/BUILD.gn
@@ -0,0 +1,30 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.bluetooth.control") { + library_name = "control" + namespace = "fuchsia.bluetooth" + public_deps = [ + "../fuchsia.bluetooth", + ] + sources = [ + "bonding.fidl", + "control.fidl", + "pairing_delegate.fidl", + "pairing_options.fidl", + "remote_device.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.bluetooth.control", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/bonding.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/bonding.fidl new file mode 100644 index 0000000..ccc5f0c --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/bonding.fidl
@@ -0,0 +1,116 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.control; + +struct SecurityProperties { + bool authenticated; + bool secure_connections; + uint8 encryption_key_size; +}; + +// Represents a key that was received from a peer. +struct RemoteKey { + // The security properties of this link under which this key was received. + SecurityProperties security_properties; + + // 128 bit key + array<uint8>:16 value; +}; + +// Represents a locally assigned key that is reused across bonds. +struct LocalKey { + array<uint8>:16 value; +}; + +// Represents a LE Long-Term RemoteKey. The `ediv` and `rand` fields are zero if +// distributed using LE Secure Connections pairing. +struct LTK { + RemoteKey key; + uint8 key_size; + uint16 ediv; + uint64 rand; +}; + +// The preferred LE connection parameters of the peer. +struct LEConnectionParameters { + uint16 connection_interval; + uint16 connection_latency; + uint16 supervision_timeout; +}; + +enum AddressType : uint8 { + LE_PUBLIC = 0; + LE_RANDOM = 1; + BREDR = 2; +}; + +struct LEData { + // The identity address of the peer. If `resolvable` is true, then this is the + // resolved private address (and the `irk` is present). + string address; + AddressType address_type; + + // The peer’s preferred connection parameters, if known. + LEConnectionParameters? connection_parameters; + + // Known GATT service UUIDs. + vector<string:36> services; + + // The LE long-term key. Present if the link was encrypted. + LTK? ltk; + + // Identity Resolving RemoteKey used to generate and resolve random addresses. + RemoteKey? irk; + + // Connection Signature Resolving RemoteKey used for data signing without encryption. + RemoteKey? csrk; +}; + +struct BREDRData { + // The public device address of the peer. + string address; + + // True if the peer prefers to lead the piconet. This is determined by role + // switch procedures. Paging and connecting from a peer does not automatically + // set this flag. + bool piconet_leader; + + // Known SDP service UUIDs. + vector<string:36> services; + + // The semi-permanent BR/EDR key. Present if link was paired with Secure + // Simple Pairing or stronger. + LTK? link_key; +}; + +// Represents the bonding data for a single peer. +struct BondingData { + // The identifier that uniquely identifies this device. + string identifier; + + // The local Bluetooth identity address that this bond is associated with. + string local_address; + + // The name of the device, if any. + string? name; + + // Bonding data that is present when this device is paired on the LE transport. + LEData? le; + + // Bonding data that is present when this device is paired on the BR/EDR transport. + BREDRData? bredr; +}; + +/// Represents persistent local host data. +// TODO(BT-813): Consider using a table instead of struct. +struct HostData { + /// The local Identity Resolving Key used by a bt-host device to generate Resolvable Private + /// Addresses when privacy is enabled. + /// + /// NOTE: This key is distributed to LE peers during pairing procedures. The client must take + /// care to assign an IRK that consistent with the local bt-host identity. + // TODO(BT-815): Document behavior once there is a better privacy policy when `irk` is null. + LocalKey? irk; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/control.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/control.fidl new file mode 100644 index 0000000..02091fb --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/control.fidl
@@ -0,0 +1,142 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.control; + +using fuchsia.bluetooth; + +/// Bluetooth controller and its associated host-subsystem state that is present +/// on the current platform. +struct AdapterInfo { + /// UUID that uniquely identifies this adapter on the current system. + string identifier; + + /// The Bluetooth technologies that are supported by this adapter. + TechnologyType technology; + + /// Public Bluetooth device address which can be displayed to the user. + string address; + + /// The current adapter state. This field is only present when an AdapterInfo + /// is obtained via the Control and ControlDelegate interfaces. If present, + /// all optional members of `state` will also be present. + AdapterState? state; +}; + +/// Contains static global information about a local Bluetooth adapter, +/// including its current state. Each adapter instance represents a physical +struct AdapterState { + // The local name of the local adapter, visible to other devices when + // discoverable. + string? local_name; + + // Whether or not the local adapter is currently discoverable over BR/EDR and + // LE physical channels. + fuchsia.bluetooth.Bool? discoverable; + + // Whether or not device discovery is currently being performed. + fuchsia.bluetooth.Bool? discovering; + + // Service UUIDs of all local services that are published and available to + // other devices via this adapter. These services are usually registered + // using the GATT and the classic profile APIs. + vector<string>? local_service_uuids; +}; + +/// Device Class represents the Major and Minor Device Class and Service Class of an adapter +/// Values are defined in https://www.bluetooth.com/specifications/assigned-numbers/baseband +[MaxHandles = "0"] +struct DeviceClass { + uint32 value; +}; + +/// Primary Bluetooth control service to access bluetooth +[Discoverable] +protocol Control { + /// Returns whether or not Bluetooth is currently available on the system. + IsBluetoothAvailable() -> (bool available); + + /// Registers a delegate to handle pairing requests. + /// Indicate the capability type of the PairingDelegate using `in` and `out`. + /// If your input/output capability is variable, call this function when it + /// changes to update. + /// Setting a pairing delegate closes the previously assigned pairing Delegate. + /// + /// To disable pairing, set `delegate` to null. + SetPairingDelegate(PairingDelegate? delegate) -> (bool success); + + /// Returns information about all local adapters that are known to the system. + GetAdapters() -> (vector<AdapterInfo>? adapters); + + /// Sets the local adapter with the given `identifier` to act as the backing + /// adapter for all Bluetooth interfaces. + SetActiveAdapter(string identifier) -> (fuchsia.bluetooth.Status status); + + /// Returns information on the current active adapter, if it exists. + GetActiveAdapterInfo() -> (AdapterInfo? adapter); + + /// If `discovery` is true, active discovery is requested. + /// When requesting discovery, general discovery for BR/EDR and LE will be + /// active and newly discovered devices will be reported via + /// RemoteDeviceDelegate.OnDeviceUpdate(). + /// + /// Discovery may be active when not reqested. + /// If an error occurs when starting discovery, it is reflected in `status`. + RequestDiscovery(bool discovery) -> (fuchsia.bluetooth.Status status); + + /// Retrieve the set of known remote devices. + /// Note: These devices are not guaranteed to still be reachable. + GetKnownRemoteDevices() -> (vector<RemoteDevice> devices); + + /// Sets the public Bluetooth name for this device, or resets to the default + /// name if `name` is not present. + SetName(string? name) -> (fuchsia.bluetooth.Status status); + + /// Set the Device Class for the active Bluetooth adapter. + /// Values are defined in https://www.bluetooth.com/specifications/assigned-numbers/baseband + [Transitional] + SetDeviceClass(DeviceClass device_class) -> (fuchsia.bluetooth.Status status); + + /// Set the discoverability of this device. + SetDiscoverable(bool discoverable) -> (fuchsia.bluetooth.Status status); + + /// Attempt to connect to the remote `device_id`. + Connect(string device_id) -> (fuchsia.bluetooth.Status status); + + /// Disconnect a previously-connected device. + /// Note: This does not remove a device bond, see Control::Forget. + Disconnect(string device_id) -> (fuchsia.bluetooth.Status status); + + /// Initiate a pairing to the remote `id` with the given `options`. Returns an error + /// variant of fuchsia.bluetooth.Status if no connected peer with `id` is found or the pairing + /// procedure fails. If already paired, this will do nothing unless the pairing is over LE and + /// the PairingOptions.le_security_level is more secure than the current security level. + Pair(fuchsia.bluetooth.PeerId id, PairingOptions options) -> (fuchsia.bluetooth.Status status); + + /// Forget `device_id` completely, removing all bonding information. + /// This will disconnect a device if it is connected. + Forget(string device_id) -> (fuchsia.bluetooth.Status status); + + /// Set local IO Capabilities to use during pairing. + SetIOCapabilities(InputCapabilityType input, OutputCapabilityType output); + + // Events + + /// Sent when the active adapter has been updated. If `active_adapter` is + /// null, then no adapter is currently active. + -> OnActiveAdapterChanged(AdapterInfo? adapter); + + /// Sent when an adapter has been updated. + -> OnAdapterUpdated(AdapterInfo adapter); + + /// Sent when an adapter with the given `identifier` has been removed from + /// the system. + -> OnAdapterRemoved(string identifier); + + /// Sent when a peer is updated. + -> OnDeviceUpdated(RemoteDevice device); + + /// Sent when a peer is removed. + -> OnDeviceRemoved(string identifier); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/meta.json new file mode 100644 index 0000000..744a86f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/meta.json
@@ -0,0 +1,15 @@ +{ + "deps": [ + "fuchsia.bluetooth" + ], + "name": "fuchsia.bluetooth.control", + "root": "fidl/fuchsia.bluetooth.control", + "sources": [ + "fidl/fuchsia.bluetooth.control/bonding.fidl", + "fidl/fuchsia.bluetooth.control/control.fidl", + "fidl/fuchsia.bluetooth.control/pairing_delegate.fidl", + "fidl/fuchsia.bluetooth.control/pairing_options.fidl", + "fidl/fuchsia.bluetooth.control/remote_device.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/pairing_delegate.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/pairing_delegate.fidl new file mode 100644 index 0000000..69db6c3 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/pairing_delegate.fidl
@@ -0,0 +1,81 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.control; + +using fuchsia.bluetooth; + +/// Input and Output Capabilities for pairing exchanges. +/// See Volume 3, Part C, Table 5.3 and 5.4 +enum InputCapabilityType { + NONE = 0; + CONFIRMATION = 1; + KEYBOARD = 2; +}; + +enum OutputCapabilityType { + NONE = 0; + DISPLAY = 1; +}; + +/// Different types required by the Security Manager for pairing methods. +/// Bluetooth SIG has different requirements for different device capabilities. +enum PairingMethod { + /// The user is asked to accept or reject pairing. + CONSENT = 0; + + /// The user is shown a 6-digit numerical passkey which they must enter on the + /// peer device. + PASSKEY_DISPLAY = 1; + + /// The user is shown a 6-digit numerical passkey which will also shown on the + /// peer device. The user must compare the passkeys and accept the pairing if + /// the passkeys match. + PASSKEY_COMPARISON = 2; + + /// The user is asked to enter a 6-digit passkey. + PASSKEY_ENTRY = 3; +}; + +enum PairingKeypressType { + /// The user has entered a single digit. + DIGIT_ENTERED = 0; + + /// The user has erased a single digit. + DIGIT_ERASED = 1; + + /// The user has cleared the entire passkey. + PASSKEY_CLEARED = 2; + + /// The user has finished entering the passkey. + PASSKEY_ENTERED = 3; +}; + +protocol PairingDelegate { + /// Called for most pairing requests. The delegate must respond with “true” or “false” to + /// either accept or reject the pairing request. If the pairing method requires a passkey + /// this is returned as well. + /// + /// Any response from this method will be ignored if the OnPairingComplete + /// event has already been sent for `device`. + OnPairingRequest(RemoteDevice device, PairingMethod method, string? displayed_passkey) + -> (bool accept, string? entered_passkey); + + /// Called if the pairing procedure for the device with the given ID is completed. + /// This can be due to successful completion or an error (e.g. due to cancellation + /// by the peer, a timeout, or disconnection) which is indicated by `status`. + OnPairingComplete(string device_id, fuchsia.bluetooth.Status status); + + /// Called to notify keypresses from the peer device during pairing using + /// PairingMethod.PASSKEY_DISPLAY. + /// + /// This event is used to provide key press events to the delegate for a responsive user + /// experience as the user types the passkey on the peer device. This event will be called + /// once for each key-press. + OnRemoteKeypress(string device_id, PairingKeypressType keypress); + + /// The delegate can send this event to notify the peer of local keypresses + /// during pairing using PairingMethod.PASSKEY_ENTRY. + -> OnLocalKeypress(string device_id, PairingKeypressType keypress); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/pairing_options.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/pairing_options.fidl new file mode 100644 index 0000000..ba45032 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/pairing_options.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.control; + +/// The security level required for this pairing - corresponds to the security +/// levels defined in the Security Manager Protocol in Vol 3, Part H, Section 2.3.1 +enum PairingSecurityLevel { + /// Encrypted without MITM protection (unauthenticated) + ENCRYPTED = 1; + + /// Encrypted with MITM protection (authenticated), although this level of security does not + /// fully protect against passive eavesdroppers + AUTHENTICATED = 2; +}; + +/// Parameters that give a caller more fine-grained control over the pairing process. All of the +/// fields of this table are optional and pairing can still succeed if none of them are set. +table PairingOptions { + /// Only relevant for LE. If present, determines the Security Manager security level to pair + /// with. If not present, defaults to PairingSecurityLevel.AUTHENTICATED. + 1: PairingSecurityLevel le_security_level; + + /// If not present or false, the pairing will default to bondable mode. Otherwise, setting this + /// parameter to true will initiate a non-bondable pairing. + /// + /// TODO(fxb/42403): Only implemented for LE transport. Support this for BR/EDR. + 2: bool non_bondable; + + /// If transport is LOW_ENERGY or CLASSIC, pairing will be performed over the transport + /// corresponding to the specified technology, which must already be connected. If transport + /// is not present or DUAL_MODE, the pairing will be performed over whichever transport is + /// connected, and defaults to LE for dual-mode connections. + 3: TechnologyType transport; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/remote_device.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/remote_device.fidl new file mode 100644 index 0000000..34dbc36 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.control/remote_device.fidl
@@ -0,0 +1,113 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.control; + +using fuchsia.bluetooth; + +/// Possible values for the LE Appearance property which describes the external +/// appearance of a +/// device at a high level. +/// (See the Bluetooth assigned-numbers document: +/// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml) +enum Appearance : uint16 { + UNKNOWN = 0; + PHONE = 64; + COMPUTER = 128; + WATCH = 192; + WATCH_SPORTS = 193; + CLOCK = 256; + DISPLAY = 320; + REMOTE_CONTROL = 384; + EYE_GLASSES = 448; + TAG = 512; + KEYRING = 576; + MEDIA_PLAYER = 640; + BARCODE_SCANNER = 704; + THERMOMETER = 768; + THERMOMETER_EAR = 769; + HEART_RATE_SENSOR = 832; + HEART_RATE_SENSOR_BELT = 833; + BLOOD_PRESSURE = 896; + BLOOD_PRESSURE_ARM = 897; + BLOOD_PRESSURE_WRIST = 898; + HID = 960; + HID_KEYBOARD = 961; + HID_MOUSE = 962; + HID_JOYSTICK = 963; + HID_GAMEPAD = 964; + HID_DIGITIZER_TABLET = 965; + HID_CARD_READER = 966; + HID_DIGITAL_PEN = 967; + HID_BARCODE_SCANNER = 968; + GLUCOSE_METER = 1024; + RUNNING_WALKING_SENSOR = 1088; + RUNNING_WALKING_SENSOR_IN_SHOE = 1089; + RUNNING_WALKING_SENSOR_ON_SHOE = 1090; + RUNNING_WALKING_SENSOR_ON_HIP = 1091; + CYCLING = 1152; + CYCLING_COMPUTER = 1153; + CYCLING_SPEED_SENSOR = 1154; + CYCLING_CADENCE_SENSOR = 1155; + CYCLING_POWER_SENSOR = 1156; + CYCLING_SPEED_AND_CADENCE_SENSOR = 1157; + PULSE_OXIMETER = 3136; + PULSE_OXIMETER_FINGERTIP = 3137; + PULSE_OXIMETER_WRIST = 3138; + WEIGHT_SCALE = 3200; + PERSONAL_MOBILITY = 3264; + PERSONAL_MOBILITY_WHEELCHAIR = 3265; + PERSONAL_MOBILITY_SCOOTER = 3266; + GLUCOSE_MONITOR = 3328; + SPORTS_ACTIVITY = 5184; + SPORTS_ACTIVITY_LOCATION_DISPLAY = 5185; + SPORTS_ACTIVITY_LOCATION_AND_NAV_DISPLAY = 5186; + SPORTS_ACTIVITY_LOCATION_POD = 5187; + SPORTS_ACTIVITY_LOCATION_AND_NAV_POD = 5188; +}; + +enum TechnologyType { + LOW_ENERGY = 0; + CLASSIC = 1; + DUAL_MODE = 2; +}; + +/// Represents a remote BR/EDR, LE, or dual-mode BR/EDR/LE device. +struct RemoteDevice { + /// Uniquely identifies this device on the current system. + string identifier; + + /// Bluetooth device address that identifies this remote device. Clients + /// should display this field to the user when `name` is not available. + /// + /// NOTE: Clients should use the `identifier` field to distinguish between + /// remote devices instead of using their address. + string address; + + /// The Bluetooth technologies that are supported by this device. + TechnologyType technology; + + /// The name of the remote device if present or known. + string? name; + + /// The LE appearance property. Present if this is a LE device and the + /// appearance information was obtained over advertising and/or GATT. + Appearance appearance; + + /// The most recently obtained advertising signal strength for this device. + fuchsia.bluetooth.Int8? rssi; + + /// The most recently obtained transmission power for this device. + fuchsia.bluetooth.Int8? tx_power; + + /// Whether or not a BR/EDR and/or LE connection exists between the local + /// adapter and this device. + bool connected; + + /// Whether or not a bond exists between the local adapter and this device. + bool bonded; + + /// The list of service UUIDs known to be published on this remote device. + vector<string> service_uuids; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/BUILD.gn new file mode 100644 index 0000000..b8f6bd0 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.bluetooth.gatt") { + library_name = "gatt" + namespace = "fuchsia.bluetooth" + public_deps = [ + "../fuchsia.bluetooth", + ] + sources = [ + "client.fidl", + "constants.fidl", + "server.fidl", + "types.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.bluetooth.gatt", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/client.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/client.fidl new file mode 100644 index 0000000..28ba1c7 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/client.fidl
@@ -0,0 +1,146 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.gatt; + +using fuchsia.bluetooth; + +protocol RemoteService { + /// Returns the characteristics and characteristic descriptors that belong to + /// this service. + DiscoverCharacteristics() -> (fuchsia.bluetooth.Status status, vector<Characteristic> characteristics); + + /// Reads the value of the characteristic with `id` and returns it in the + /// reply. If `status` indicates an error `value` will be empty. + /// + /// If the characteristic has a long value (i.e. larger than the current MTU) + /// this method will return only the first (MTU - 1) bytes of the value. Use + /// ReadLongCharacteristic() to read larger values or starting at a non-zero + /// offset. + ReadCharacteristic(uint64 id) -> (fuchsia.bluetooth.Status status, bytes value); + + /// Reads the complete value of a characteristic with the given `id`. This + /// procedure should be used if the characteristic is known to have a value + /// that can not be read in a single request. + /// + /// Returns up to `max_bytes` octets of the characteristic value starting at + /// the given `offset`. + /// + /// This may return an error if: + /// a. `max_bytes` is 0; + /// b. The `offset` is invalid; + /// c. The characteristic does not have a long value; + /// d. The server does not support the long read procedure. + ReadLongCharacteristic(uint64 id, uint16 offset, uint16 max_bytes) -> (fuchsia.bluetooth.Status status, bytes:MAX_VALUE_LENGTH value); + + /// Writes `value` to the characteristic with `id`. This operation may return + /// an error if: + /// a. The size of `value` exceeds the current MTU. + /// b. The characteristic referred to by `id` does not have the 'write' + /// property. + WriteCharacteristic(uint64 id, bytes value) -> (fuchsia.bluetooth.Status status); + + /// Writes `value` to the characteristic with `id`, beginning at `offset` using + /// the provided `write_options`. + /// + /// This procedure should be used if the value to be written is too long to + /// fit in a single request or needs to be written at an offset. This may + /// return an error if: + /// a. The `offset` is invalid; + /// b. The server does not support the long write procedure. + /// + /// Long Writes require multiple messages to the remote service and take longer + /// to execute than Short Writes. It is not recommended to send a short write + /// while a long write is in process to the same id and data range. The order + /// of the responses from this function signify the order in which the remote + /// service received them, not necessarily the order in which it is called. + WriteLongCharacteristic(uint64 id, uint16 offset, bytes:MAX_VALUE_LENGTH value, WriteOptions write_options) + -> (fuchsia.bluetooth.Status status); + + /// Writes `value` to the characteristic with `id` without soliciting an + /// acknowledgement from the peer. This method has no response and its delivery + /// cannot be confirmed. + WriteCharacteristicWithoutResponse(uint64 id, bytes value); + + /// Reads the value of the characteristic descriptor with `id` and returns it + /// in the reply. If `status` indicates an error, `value` can be ignored. + /// + /// If the descriptor has a long value (i.e. larger than the current MTU) + /// this method will return only the first (MTU - 1) bytes of the value. Use + /// ReadLongDescriptor() to read larger values or starting at a non-zero + /// offset. + ReadDescriptor(uint64 id) -> (fuchsia.bluetooth.Status status, bytes value); + + /// Reads the complete value of a characteristic descriptor with the given `id`. + /// This procedure should be used if the descriptor is known to have a value + /// that can not be read in a single request. + /// + /// Returns up to `max_bytes` octets of the characteristic value starting at + /// the given `offset`. + /// + /// This may return an error if: + /// a. `max_bytes` is 0; + /// b. The `offset` is invalid; + /// c. The server does not support the long read procedure. + ReadLongDescriptor(uint64 id, uint16 offset, uint16 max_bytes) -> (fuchsia.bluetooth.Status status, bytes value); + + /// Writes `value` to the characteristic descriptor with `id`. This operation + /// may return an error if: + /// a. The size of `value` exceeds the current MTU. + /// b. `id` refers to an internally reserved descriptor type (e.g. the Client + /// Characteristic Configuration descriptor). + WriteDescriptor(uint64 id, bytes value) -> (fuchsia.bluetooth.Status status); + + /// Writes `value` to the characteristic descriptor with `id`, beginning at + /// `offset`. This procedure should be used if the value to be written is too + /// long to fit in a single request or needs to be written at an offset. This + /// may return an error if: + /// a. The `offset` is invalid; + /// b. The server does not support the long write procedure. + /// c. `id` refers to an internally reserved descriptor type (e.g. the Client + /// Characteristic Configuration descriptor). + /// + /// Long Writes require multiple messages to the remote service and take longer + /// to execute than Short Writes. It is not recommended to send a short write + /// while a long write is in process to the same id and data range. The order + /// of the responses from this function signify the order in which the remote + /// service received them, not necessarily the order in which it is called. + WriteLongDescriptor(uint64 id, uint16 offset, bytes:MAX_VALUE_LENGTH value) -> (fuchsia.bluetooth.Status status); + + /// Subscribe or unsubscribe to notifications/indications from the characteristic with + /// the given `id`. Notifications or indications will be enabled if `enable` is + /// true or disabled if `enable` is false and they have been enabled for this + /// client. + /// + /// Either notifications or indications will be enabled depending on + /// characteristic properties. Indications will be preferred if they are + /// supported. + /// + /// This operation fails if the characteristic does not have the "notify" or + /// "indicate" property or does not contain a Client Characteristic + /// Configuration descriptor. + /// + /// On success, the OnCharacteristicValueUpdated event will be sent whenever + /// the peer sends a notification or indication. The local host will + /// automically confirm indications. + NotifyCharacteristic(uint64 id, bool enable) -> (fuchsia.bluetooth.Status status); + + /// Events: + /// Called when a characteristic value notification or indication is received. + -> OnCharacteristicValueUpdated(uint64 id, bytes value); +}; + +protocol Client { + /// Enumerates services found on the peer that this Client represents. Results + /// can be restricted by specifying a list of UUIDs in `uuids`. The returned + /// ServiceInfo structures will contain only basic information about each + /// service and the `characteristics` and `includes` fields will be null. + /// + /// To further interact with services, clients must obtain a RemoteService + /// handle by calling ConnectToService(). + ListServices(vector<string>? uuids) -> (fuchsia.bluetooth.Status status, vector<ServiceInfo> services); + + /// Connects the RemoteService with the given identifier. + ConnectToService(uint64 id, request<RemoteService> service); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/constants.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/constants.fidl new file mode 100644 index 0000000..38af827 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/constants.fidl
@@ -0,0 +1,7 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.gatt; + +const uint16 MAX_VALUE_LENGTH = 512;
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/meta.json new file mode 100644 index 0000000..7b6f4c7 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/meta.json
@@ -0,0 +1,14 @@ +{ + "deps": [ + "fuchsia.bluetooth" + ], + "name": "fuchsia.bluetooth.gatt", + "root": "fidl/fuchsia.bluetooth.gatt", + "sources": [ + "fidl/fuchsia.bluetooth.gatt/client.fidl", + "fidl/fuchsia.bluetooth.gatt/constants.fidl", + "fidl/fuchsia.bluetooth.gatt/server.fidl", + "fidl/fuchsia.bluetooth.gatt/types.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/server.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/server.fidl new file mode 100644 index 0000000..4ea6794 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/server.fidl
@@ -0,0 +1,68 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.gatt; + +using fuchsia.bluetooth; + +/// Interface for responding to requests on a local service. +protocol LocalServiceDelegate { + /// Notifies the delegate when a remote device with `peer_id` enables or + /// disables notifications or indications on the characteristic with the given + /// `characteristic_id`. + OnCharacteristicConfiguration(uint64 characteristic_id, string peer_id, + bool notify, bool indicate); + + /// Called when a remote device issues a request to read the value of the + /// of the characteristic or descriptor with given identifier. The delegate + /// must respond to the request by returning the characteristic value. If the + /// read request resulted in an error it should be returned in `error_code`. + /// On success, `error_code` should be set to NO_ERROR and a `value` should be + /// provided. + OnReadValue(uint64 id, int32 offset) -> (bytes? value, ErrorCode status); + + /// Called when a remote device issues a request to write the value of the + /// characteristic or descriptor with the given identifier. + OnWriteValue(uint64 id, uint16 offset, bytes value) -> (ErrorCode status); + + /// Called when a remote device issues a request to write the value of the + /// characteristic with the given identifier. This can be called on a + /// characteristic with the WRITE_WITHOUT_RESPONSE property. + OnWriteWithoutResponse(uint64 id, uint16 offset, bytes value); +}; + +/// Interface for communicating with a published service. +protocol LocalService { + /// Removes the service that this interface instance corresponds to. Does + /// nothing if the service is already removed. + RemoveService(); + + /// Sends a notification carrying the `value` of the characteristic with the + /// given `characteristic_id` to the device with `peer_id`. + /// + /// If `confirm` is true, then this method sends an indication instead. If the + /// peer fails to confirm the indication, the link between the peer and the + /// local adapter will be closed. + /// + /// This method has no effect if the peer has not enabled notifications or + /// indications on the requested characteristic. + NotifyValue(uint64 characteristic_id, string peer_id, bytes value, bool confirm); +}; + +[Discoverable] +protocol Server { + /// Publishes the given service so that it is available to all remote peers. + /// A LocalServiceDelegate must be provided over which to receive service requests. + /// + /// The caller must assign distinct identifiers to the characteristics and + /// descriptors listed in `info`. These identifiers will be used in requests + /// sent to `delegate`. + /// + /// `service` can be used to interact with the pubished service. If this + /// service cannot be published then the handle for `service` will be closed. + /// + /// Returns the success or failure status of the call and a unique identifier + /// that can be used to unregister the service. + PublishService(ServiceInfo info, LocalServiceDelegate delegate, request<LocalService> service) -> (fuchsia.bluetooth.Status status); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/types.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/types.fidl new file mode 100644 index 0000000..54a6344 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.gatt/types.fidl
@@ -0,0 +1,152 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.gatt; + +/// Codes that can be returned in the `protocol_error_code` field of a +/// bluetooth.Error. +enum ErrorCode { + /// Indicates that the operation was successful. + NO_ERROR = 0; + + /// Indicates that the offset used in a read or write request exceeds the + /// bounds of the value. + INVALID_OFFSET = 1; + + /// Indicates that the value given in a write request would exceed the maximum + /// length allowed for the destionation characteristic or descriptor. + INVALID_VALUE_LENGTH = 2; + + /// Indicates that a read or write request is not permitted. + NOT_PERMITTED = 3; +}; + +/// Represents encryption, authentication, and authorization permissions that can +/// be assigned to a specific access permission. +struct SecurityRequirements { + /// If true, the physical link must be encrypted to access this attribute. + bool encryption_required; + + /// If true, the physical link must be authenticated to access this + /// attribute. + bool authentication_required; + + /// If true, the client needs to be authorized before accessing this + /// attribute. + bool authorization_required; +}; + +/// Specifies the access permissions for a specific attribute value. +struct AttributePermissions { + /// Specifies whether or not an attribute has the read permission. If null, + /// then the attribute value cannot be read. Otherwise, it can be read only if + /// the permissions specified in the Permissions struct are satisfied. + SecurityRequirements? read; + + /// Specifies whether or not an attribute has the write permission. If null, + /// then the attribute value cannot be written. Otherwise, it be written only + /// if the permissions specified in the Permissions struct are satisfied. + SecurityRequirements? write; + + /// Specifies the security requirements for a client to subscribe to + /// notifications or indications on a characteristic. A characteristic's + /// support for notifications or indiciations is specified using the NOTIFY and + /// INDICATE characteristic properties. If a local characteristic has one of + /// these properties then this field can not be null. Otherwise, this field + /// must be left as null. + /// + /// This field is ignored for Descriptors. + SecurityRequirements? update; +}; + +/// Possible values for the characteristic properties bitfield. These specify the +/// GATT procedures that are allowed for a particular characteristic. +const uint32 kPropertyBroadcast = 1; +const uint32 kPropertyRead = 2; +const uint32 kPropertyWriteWithoutResponse = 4; +const uint32 kPropertyWrite = 8; +const uint32 kPropertyNotify = 16; +const uint32 kPropertyIndicate = 32; +const uint32 kPropertyAuthenticatedSignedWrites = 64; +const uint32 kPropertyReliableWrite = 256; +const uint32 kPropertyWritableAuxiliaries = 512; + +/// Represents a local or remote GATT service. +struct ServiceInfo { + /// Uniquely identifies this GATT service. This value will be ignored for local + /// services. Remote services will always have an identifier. + uint64 id; + + /// Indicates whether this is a primary or secondary service. + bool primary; + + /// The 128-bit UUID that identifies the type of this service. This is a string + /// in the canonical 8-4-4-4-12 format. + string type; + + /// The characteristics of this service. + vector<Characteristic>? characteristics; + + /// Ids of other services that are included by this service. + vector<uint64>? includes; +}; + +/// Represents a local or remote GATT characteristic. +struct Characteristic { + /// Uniquely identifies this characteristic within a service. + uint64 id; + + /// The 128-bit UUID that identifies the type of this characteristic. This is a + /// string in the canonical 8-4-4-4-12 format. + string type; + + /// The characteristic properties bitfield. See kProperty* above for possible + /// values. + uint32 properties; + + /// The attribute permissions of this characteristic. For remote + /// characteristics, this value will be null until the permissions are + /// discovered via read and write requests. + /// + /// For local characteristics, this value is mandatory. + AttributePermissions? permissions; + + /// The descriptors of this characteristic. + vector<Descriptor>? descriptors; +}; + +/// Represents a local or remote GATT characteristic descriptor. +struct Descriptor { + /// Uniquely identifies this descriptor within the characteristic that it + /// belongs to. + uint64 id; + + /// The 128-bit UUID that identifies the type of this descriptor. This is a + /// string in the canonical 8-4-4-4-12 format. + string type; + + /// The attribute permissions of this descriptor. For remote + /// descriptors, this value will be null until the permissions are + /// discovered via read and write requests. + /// + /// For local descriptors, this value is mandatory. + AttributePermissions? permissions; +}; + +/// Represents the reliability mode during long and prepared write operations. +/// +/// If enabled, every value blob is verified against an echo response from the server. +/// The procedure is aborted if a value blob has not been reliably delivered to the peer. +enum ReliableMode { + DISABLED = 1; + ENABLED = 2; +}; + +/// Represents the supported options to write a characteristic value to a server. +table WriteOptions { + /// The reliable mode of the write operation. + /// + /// Defaults to [`fuchsia.bluetooth.gatt/ReliableMode.DISABLED`] if not present. + 1: ReliableMode reliable_mode; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/BUILD.gn new file mode 100644 index 0000000..e674001 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/BUILD.gn
@@ -0,0 +1,32 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.bluetooth.le") { + library_name = "le" + namespace = "fuchsia.bluetooth" + public_deps = [ + "../fuchsia.bluetooth", + "../fuchsia.bluetooth.gatt", + ] + sources = [ + "advertising_data.fidl", + "central.fidl", + "connection_options.fidl", + "peer.fidl", + "peripheral.fidl", + "types_deprecated.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.bluetooth.le", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/advertising_data.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/advertising_data.fidl new file mode 100644 index 0000000..52fc763 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/advertising_data.fidl
@@ -0,0 +1,49 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.le; + +using fuchsia.bluetooth as bt; + +/// Entry in the `service_data` field of a [`fuchsia.bluetooth.le/AdvertisingData`]. +struct ServiceData { + bt.Uuid uuid; + bytes data; +}; + +/// Entry in the `manufacturer_data` field of a [`fuchsia.bluetooth.le/AdvertisingData`]. +struct ManufacturerData { + uint16 company_id; + bytes data; +}; + +/// Represents advertising and scan response data that are transmitted by a LE peripheral or +/// broadcaster. +table AdvertisingData { + /// Long or short name of the device. + 1: string name; + + /// The appearance of the device. + 2: bt.Appearance appearance; + + /// The radio transmit power level reported by an advertising peer. This field is disallowed + /// when used with the Peripheral API. + 3: int8 tx_power_level; + + /// Service UUIDs. + 4: vector<bt.Uuid> service_uuids; + + /// Service data entries. + 5: vector<ServiceData> service_data; + + /// Manufacturer-specific data entries. + 6: vector<ManufacturerData> manufacturer_data; + + /// String representing a URI to be advertised, as defined in [IETF STD 66](https://tools.ietf.org/html/std66). + /// Each entry should be a UTF-8 string including the scheme. For more information, see: + /// - https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml for allowed schemes; + /// - https://www.bluetooth.com/specifications/assigned-numbers/uri-scheme-name-string-mapping + /// for code-points used by the system to compress the scheme to save space in the payload. + 7: vector<string> uris; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/central.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/central.fidl new file mode 100644 index 0000000..51c4bdf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/central.fidl
@@ -0,0 +1,61 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.le; + +using fuchsia.bluetooth; +using fuchsia.bluetooth.gatt; + +[Discoverable] +protocol Central { + /// Returns the list of peripherals that are known to the system from previous scan, connection, + /// and/or bonding procedures. The results can be filtered based on service UUIDs that are known to + /// be present on the peripheral. + /// + /// This method only returns peripherals (i.e. connectable devices). + GetPeripherals(vector<string>? service_uuids) -> (vector<RemoteDevice> peripherals); + + /// Returns information about a single peripheral that is known to the system from previous scan, + /// connection, and/or bonding procedures based on its unique identifier. Returns null if + /// `identifier` is not recognized. + GetPeripheral(string identifier) -> (RemoteDevice? peripheral); + + /// Initiates a scan session for nearby peripherals and broadcasters. Discovered devices will be + /// reported via CentralDelegate.OnDeviceDiscovered(). If a scan session is already in progress, + /// `filter` will replace the existing session's filter. + /// + /// If `filter` is null or empty (i.e. none of its fields has been populated) then the delegate + /// will be notified for all discoverable devices that are found. This is not recommended; clients + /// should generally filter results by at least one of `filter.service_uuids`, + /// `filter.service_data`, and/or `filter.manufacturer_identifier`. + StartScan(ScanFilter? filter) -> (fuchsia.bluetooth.Status status); + + /// Terminate a previously started scan session. + StopScan(); + + /// Creates a connection to the peripheral device with the given identifier. + /// Returns the status of the operation in `status`. + /// + /// On success, `gatt_client` will be bound and can be used for GATT client + /// role procedures. On failure, `gatt_client` will be closed and `status` will + /// indicate an error. + ConnectPeripheral(string identifier, ConnectionOptions options, + request<fuchsia.bluetooth.gatt.Client> gatt_client) + -> (fuchsia.bluetooth.Status status); + + /// Disconnects this Central's connection to the peripheral with the given identifier. + DisconnectPeripheral(string identifier) -> (fuchsia.bluetooth.Status status); + + /// Called when the scan state changes, e.g. when a scan session terminates due to a call to + /// Central.StopScan() or another unexpected condition. + -> OnScanStateChanged(bool scanning); + + /// Called for each peripheral/broadcaster that is discovered during a scan session. `rssi` + /// contains the received signal strength of the advertising packet that generated this event, if + /// available. + -> OnDeviceDiscovered(RemoteDevice device); + + /// Called when this Central's connection to a peripheral with the given identifier is terminated. + -> OnPeripheralDisconnected(string identifier); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/connection_options.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/connection_options.fidl new file mode 100644 index 0000000..51972ca --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/connection_options.fidl
@@ -0,0 +1,15 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.le; + +/// Represents parameters that are set on a per-connection basis by FIDL protocols that create +/// Low Energy connections. +table ConnectionOptions { + /// When true, the connection operates in bondable mode. This means pairing will form a bond, + /// or persist across disconnections, if the peer is also in bondable mode. When not present, + /// the connection defaults to bondable mode. When false, the connection operates in non- + /// bondable mode, which means the local device only allows pairing that does not form a bond. + 1: bool bondable_mode; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/meta.json new file mode 100644 index 0000000..ef6573f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/meta.json
@@ -0,0 +1,17 @@ +{ + "deps": [ + "fuchsia.bluetooth", + "fuchsia.bluetooth.gatt" + ], + "name": "fuchsia.bluetooth.le", + "root": "fidl/fuchsia.bluetooth.le", + "sources": [ + "fidl/fuchsia.bluetooth.le/advertising_data.fidl", + "fidl/fuchsia.bluetooth.le/central.fidl", + "fidl/fuchsia.bluetooth.le/connection_options.fidl", + "fidl/fuchsia.bluetooth.le/peer.fidl", + "fidl/fuchsia.bluetooth.le/peripheral.fidl", + "fidl/fuchsia.bluetooth.le/types_deprecated.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/peer.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/peer.fidl new file mode 100644 index 0000000..3d83107 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/peer.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.le; + +using fuchsia.bluetooth as bt; + +/// Represents a Bluetooth Low Energy peer that may act in the broadcaster, peripheral, or central +/// role. The peer's role depends on whether it is obtained from the Central or Peripheral protocol. +table Peer { + /// Uniquely identifies this peer on the current system. + /// + /// This field is always present. + 1: bt.PeerId id; + + /// Whether or not this peer is connectable. Non-connectable peers are typically in the LE + /// broadcaster role. + /// + /// This field is always present. + 2: bool connectable; + + /// The last observed RSSI of this peer. + 3: int8 rssi; + + /// Advertising and scan response data broadcast by this peer. Present in broadcasters and + /// peripherals. + 4: AdvertisingData advertising_data; +}; + +/// Protocol that represents the connection to a peer. This can be used to interact with GATT +/// services and establish L2CAP channels. +protocol Connection { + // TODO(armansito): Introduce function to obtain gatt.Client handle when transitioning the + // Central protocol. +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/peripheral.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/peripheral.fidl new file mode 100644 index 0000000..7879508 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/peripheral.fidl
@@ -0,0 +1,122 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.le; + +enum PeripheralError { + /// The operation or parameters requested are not supported on the current hardware. + NOT_SUPPORTED = 1; + + /// The provided advertising data exceeds the maximum allowed length when encoded. + ADVERTISING_DATA_TOO_LONG = 2; + + /// The provided scan response data exceeds the maximum allowed length when encoded. + SCAN_RESPONSE_DATA_TOO_LONG = 3; + + /// The requested parameters are invalid. + INVALID_PARAMETERS = 4; + + /// The request to start advertising was aborted, for example by issuing a new request with new + /// parameters. + ABORTED = 5; + + /// Advertising could not be initiated due to a hardware or system error. + FAILED = 6; +}; + +/// A client can indicate the transmission rate of advertising packets by specifying a mode. The +/// mode provides a hint to the system when configuring the controller with advertising interval and +/// window parameters. +/// +/// The mode affects how quickly a scanner or central is able to discover the peripheral; however it +/// can have an adverse effect on power consumption. While the system will try to honor a client's +/// request, it is not guaranteed to do so. +enum AdvertisingModeHint : uint8 { + /// Advertise with a very short interval and window for fast discovery at the cost of higher + /// power consumption. This corresponds to a 30-60ms interval on the 1M PHYs and 90-180ms on the + /// coded PHY. + VERY_FAST = 1; + + /// Advertise with a short interval and window that uses less power than `VERY_FAST`. + /// This corresponds to a 100-150ms interval on the 1M PHYs and 300-450ms on the coded PHY. + FAST = 2; + + /// Advertise with a moderate interval and window. This corresponds to 1-1.2s on the 1M PHYs and 3s + /// on the coded PHY. + SLOW = 3; +}; + +/// Represents the parameters for configuring advertisements. +table AdvertisingParameters { + /// The fields that will be encoded in the data section of advertising packets. + /// + /// This field is required. + 1: AdvertisingData data; + + /// The fields that are to be sent in a scan response packet. Clients may use this to send + /// additional data that does not fit inside an advertising packet on platforms that do not + /// support the advertising data length extensions. + /// + /// If present advertisements will be configured to be scannable. + 2: AdvertisingData scan_response; + + /// The desired advertising frequency. See [`fuchsia.bluetooth.le/AdvertisingModeHint`]. + /// Defaults to [`fuchsia.bluetooth.le/AdvertisingModeHint.SLOW`] if not present. + 3: AdvertisingModeHint mode_hint; + + /// [[DEPRECATED]]: Prefer to use the ConnectionOptions field for new code. + /// If present and true then the controller will broadcast connectable advertisements which + /// allows remote LE centrals to initiate a connection to the Peripheral. If false or otherwise + /// not present then the advertisements will be non-connectable. + 4: bool connectable; + + /// If present, the controller will broadcast connectable advertisements which allow remote LE + /// centrals to initiate connections to the Peripheral. The fields of ConnectionOptions will + /// configure any connections set up from advertising. + 5: ConnectionOptions connection_options; +}; + +/// Capability that is valid for the duration of advertising. The caller can close the handle to +/// stop advertising. If the system internally stops advertising for any reason, the handle will be +/// closed to communicate this to the client. +protocol AdvertisingHandle { +}; + +[Discoverable] +protocol Peripheral { + /// Start advertising as a LE peripheral. An empty response is sent to indicate when advertising + /// has successfully initiated. If advertising cannot be initiated, then the response will + /// contain a [`fuchsia.bluetooth.le/PeripheralError`]. + /// + /// This method can get called any number of times and successive calls can be made to + /// reconfigure the advertising parameters. However only the most recent + /// [`fuchsia.bluetooth.le/AdvertisingHandle`] will remain valid. + /// + /// An instance of [`fuchsia.bluetooth.le/Peripheral`] can only have one active advertisement at + /// a time. Clients must obtain multiple Peripheral instances for multiple simultaneous + /// advertisements. + /// + /// If the client closes its end of the [`fuchsia.bluetooth.le/AdvertisingHandle`] channel, + /// advertising will be stopped. If the handle is closed before the request is fulfilled, + /// advertising will be briefly enabled before it is terminated. + /// + /// + request `parameters` Parameters used while configuring the advertising instance. + /// + request `handle` Handle that remains valid for the duration of this advertising session. + /// * error Returns a [`fuchsia.bluetooth.le/PeripheralError`] if advertising cannot be + /// initiated. In this case the `handle` will be closed. + StartAdvertising(AdvertisingParameters parameters, request<AdvertisingHandle> handle) -> () error PeripheralError; + + /// Event delivered when a remote LE central initiates a connection to this Peripheral when + /// connectable advertising is enabled via + /// [`fuchsia.bluetooth.le/Peripheral.StartAdvertising`]. + /// + /// The returned [`fuchsia.bluetooth.le/Connection`] handle can be used to interact with the + /// peer. It also represents a peripheral's ownership over the connection: the client can drop + /// the handle to request a disconnection. Similarly, the handle is closed by the system to + /// indicate that the connection to the peer has been lost. + /// + /// + request `peer` Information about the central that initiated the connection. + /// + request `handle` Represents the connection. + -> OnPeerConnected(Peer peer, Connection connection); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/types_deprecated.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/types_deprecated.fidl new file mode 100644 index 0000000..6bc8fb9 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.le/types_deprecated.fidl
@@ -0,0 +1,100 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.le; + +using fuchsia.bluetooth; + +/// [[DEPRECATED]] +struct ServiceDataEntry { + string uuid; + bytes data; +}; + +/// [[DEPRECATED]] +struct ManufacturerSpecificDataEntry { + uint16 company_id; + bytes data; +}; + +/// Represents advertising and scan response data advertised by a broadcaster or peripheral. +/// [[DEPRECATED]] +struct AdvertisingDataDeprecated { + /// Name of the device. + string? name; + + /// The radio transmission power level reported in the advertisement. + fuchsia.bluetooth.Int8? tx_power_level; + + /// The appearance reported in the advertisemet. + fuchsia.bluetooth.UInt16? appearance; + + /// List of service UUIDs reported in the advertisement. + vector<string>? service_uuids; + + /// Service data included in the advertisement. + vector<ServiceDataEntry>? service_data; + + /// Manufacturer specific data entries. + vector<ManufacturerSpecificDataEntry>? manufacturer_specific_data; + + /// Service UUIDs that were solicited in the advertisement. Peripherals can invite centrals that + /// expose certain services to connect to them using service solicitation. + vector<string>? solicited_service_uuids; + + /// URIs included in the advertising packet. + /// These are full URIs (they are encoded/decoded automatically) + vector<string>? uris; +}; + +/// Represents a remote Bluetooth Low Energy device. A RemoteDevice can represent a central, +/// broadcaster, or peripheral based on the API from which it was received. +/// [[DEPRECATED]] +struct RemoteDevice { + /// Identifier that uniquely identifies this device on the current system. + string identifier; + + /// Whether or not this device is connectable. Non-connectable devices are typically acting in the + /// LE broadcaster role. + bool connectable; + + /// The last known RSSI of this device, if known. + fuchsia.bluetooth.Int8? rssi; + + /// Advertising data broadcast by this device if this device is a broadcaster or peripheral. + AdvertisingDataDeprecated? advertising_data; +}; + +/// Filter parameters for use during a scan. A discovered peripheral or broadcaster will be reported +/// to applications only if it satisfies all of the provided filter parameters. Null fields will be +/// ignored. +/// [[DEPRECATED]] +struct ScanFilter { + /// Filter based on advertised service UUIDs. A peripheral that advertises at least one of the + /// entries in `service_uuids` will satisfy this filter. + vector<string>? service_uuids; + + /// Filter based on service data containing one of the given UUIDs. + vector<string>? service_data_uuids; + + /// Filter based on a company identifier present in the manufacturer data. If this filter parameter + /// is set, then the advertising payload must contain manufacturer specific data with the provided + /// company identifier to satisfy this filter. + fuchsia.bluetooth.UInt16? manufacturer_identifier; + + /// Filter based on whether or not a device is connectable. For example, a client that is only + /// interested in peripherals that it can connect to can set this to true. Similarly a client can + /// scan only for braodcasters by setting this to false. + fuchsia.bluetooth.Bool? connectable; + + /// Filter results based on a portion of the advertised device name. + string? name_substring; + + /// Filter results based on the path loss of the radio wave. A device that matches this filter must + /// satisfy the following: + /// 1. Radio transmission power level and received signal strength must be available for the path + /// loss calculation; + /// 2. The calculated path loss value must be less than, or equal to, `max_path_loss`. + fuchsia.bluetooth.Int8? max_path_loss; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/BUILD.gn new file mode 100644 index 0000000..49ded32 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/BUILD.gn
@@ -0,0 +1,31 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.bluetooth.sys") { + library_name = "sys" + namespace = "fuchsia.bluetooth" + public_deps = [ + "../fuchsia.bluetooth", + ] + sources = [ + "access.fidl", + "bootstrap.fidl", + "host_watcher.fidl", + "identity.fidl", + "pairing_delegate.fidl", + "peer.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.bluetooth.sys", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/access.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/access.fidl new file mode 100644 index 0000000..e2f12cb --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/access.fidl
@@ -0,0 +1,124 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.sys; + +using fuchsia.bluetooth as bt; + +enum Error { + /// Operation could not be performed. + FAILED = 1; + + /// The peer designated for the operation was not found. + PEER_NOT_FOUND = 2; + + /// The time limit for the operation has expired. + TIMED_OUT = 3; + + /// The operation was canceled. + CANCELED = 4; + + /// Operation already in progress. + IN_PROGRESS = 5; + + /// Operation not supported. + NOT_SUPPORTED = 6; + + /// The operation was given an invalid set of arguments. + INVALID_ARGUMENTS = 7; +}; + +/// Represents an active procedure. The validity of a handle that supports this protocol is tied to +/// the activity of the procedure that it is attached to. To elaborate: +/// +/// 1. Closing a token handle ends the procedure that it is attached to. +/// 2. The system closes a token handle to communicate that a procedure was internally terminated. +protocol ProcedureToken { +}; + +/// Protocol that abstracts the operational modes and procedures defined in the Bluetooth Generic +/// Access Profile (see Core Specification v5.1, Vol 3, Part C). +/// +/// The procedures under this protocol apply to the system as a whole. The Bluetooth controller that +/// plays an active role in these procedures can be managed using the HostWatcher protocol. +/// +/// The procedures initiated by an Access protocol instance are terminated when the underlying +/// channel is closed. +[Discoverable] +protocol Access { + /// Assign a PairingDelegate to respond to drive pairing procedures. The delegate will be + /// configured to use the provided I/O capabilities to determine the pairing method. + /// + /// Only one PairingDelegate can be registered at a time. Closing a PairingDelegate aborts all + /// on-going pairing procedures associated with a delegate and closes the PairingDelegate + /// previously assigned for this Access instance. + /// + /// + request `input` Bluetooth input capability + /// + request `output` Bluetooth output capability + /// + request `delegate` The client end of a PairingDelegate channel. + SetPairingDelegate(InputCapability input, OutputCapability output, PairingDelegate delegate); + + /// Assign a local name for the Bluetooth system. This name will be visible to nearby peers + /// when the system is in discoverable mode and during name discovery procedures. + /// + /// + request `name` The complete local name to assign to the system. + SetLocalName(string name); + + /// Set the local device class that will be visible to nearby peers when the system is in + /// discoverable mode. + /// + /// + request `device_class` The device class to assign to the system. + SetDeviceClass(bt.DeviceClass device_class); + + /// Put the system into the "General Discoverable" mode on the BR/EDR transport. The active + /// host will respond to general inquiry (by regularly entering the inquiry scan mode). + /// + /// + request `token` [`fuchsia.bluetooth.sys/ProcedureToken`] that will remain valid while a + /// discoverable mode session is active. NOTE: The system may remain discoverable until all + /// [`fuchsia.bluetooth.sys/Access`] clients drop their tokens. + /// * error Reports Error.FAILED if inquiry mode cannot be entered. + MakeDiscoverable(request<ProcedureToken> token) -> () error Error; + + /// Start a general discovery procedure. All general discoverable BR/EDR, LE, + /// and BR/EDR/LE devices will appear in the peer list, which can be observed by calling + /// [`fuchsia.bluetooth.sys/Access.WatchPeers`]. + /// + /// + request `token` [`fuchsia.bluetooth.sys/ProcedureToken`] that will remain valid while + /// discovery is in progress. NOTE: The radio will continue performing discovery until all + /// [`fuchsia.bluetooth.sys/Access`] drop their tokens. + /// * error Reports Error.FAILED if discovery on either transport cannot be initiated. + StartDiscovery(request<ProcedureToken> token) -> () error Error; + + /// Returns a list of all peers (connectable Bluetooth devices) known to the system. The first + /// call results in a snapshot of all known peers to be sent immediately in the `updated` return + /// paremeter. Subsequent calls receive a response only when one or more entries have been + /// added, modified, or removed from the entries reported since the most recent call. + /// + /// - response `updated` Peers that were added or updated since the last call to WatchPeers(). + /// - response `removed` Ids of peers that were removed since the last call to WatchPeers(). + WatchPeers() -> (vector<Peer> updated, vector<bt.PeerId> removed); + + /// Initiate a connection to the peer with the given `id`. This method connects both BR/EDR and + /// LE transports depending on the technologies that the peer is known to support. + /// + /// + request `id` The id of the peer to connect. + /// * error Reports `Error.FAILED` if a connection to the peer cannot be initiated. + /// * error Reports `Error.PEER_NOT_FOUND` if `id` is not recognized. + Connect(bt.PeerId id) -> () error Error; + + /// Disconnect all logical links to the peer with the given `id`. This includes LE and + /// BR/EDR links that have been initiated using all Access and fuchsia.bluetooth.le protocol + /// instances. + /// + /// + request `id` The id of the peer to disconnect. + /// * error Reports `Error.PEER_NOT_FOUND` if `id` is not recognized. + Disconnect(bt.PeerId id) -> () error Error; + + /// Removes all bonding information and disconnects any existing links with the peer with the + /// given `id`. + /// + /// + request `id` The id of the peer to forget. + /// * error Reports `Error.PEER_NOT_FOUND` if `id` is not recognized. + Forget(bt.PeerId id) -> () error Error; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/bootstrap.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/bootstrap.fidl new file mode 100644 index 0000000..664eed1 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/bootstrap.fidl
@@ -0,0 +1,37 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.sys; + +enum BootstrapError : uint32 { + INVALID_HOST_IDENTITY = 1; + WRITE_FAILURE = 2; +}; + +/// Protocol used to initialize persistent core Bluetooth data. This protocol populates data that +/// determine the identity of this device as perceived by other Bluetooth devices. +/// +/// This protocol can be obtained only before the core Bluetooth host subsystem has generated its +/// own identity. Once initial data is committed, this capability becomes unavailable and remains +/// unavailable even if new Bluetooth adapters are attached. +/// +/// Due to the privacy and bonding secrets involved, as well as the capability to make this device +/// assume the Bluetooth identity of another device, this protocol should only be exposed to +/// privileged components that can vouchsafe the origin of the data. +[Discoverable] +protocol Bootstrap { + /// Adds identities to be added to the unpopulated Bluetooth stack. + /// + /// Repeated calls will append identities. + // TODO(BT-711): If necessary, paginate bonding data to allow an arbitrary number of bonds for + // each identity, e.g. AddBonds(adapter_id, bonds). + AddIdentities(vector<Identity> identities); + + /// Writes all added bootstrapping data to the Bluetooth core stack. The server will close the + /// channel regardless of success. Returns without error if successful and the stack will be + /// considered initialized even if no bootstrapping data was written. Returns + /// INVALID_HOST_IDENTITY if any host or bonded peer data is insufficient or inconsistent, with + /// no effect (the client may retry by obtaining another protocol handle). + Commit() -> () error BootstrapError; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/host_watcher.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/host_watcher.fidl new file mode 100644 index 0000000..dc3a0de --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/host_watcher.fidl
@@ -0,0 +1,56 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.sys; + +using fuchsia.bluetooth as bt; +using zx; + +/// Information about a Bluetooth controller and its associated host-subsystem state. +table HostInfo { + /// Uniquely identifies a host on the current system. + /// + /// This field is always present. + 1: bt.HostId id; + + /// The Bluetooth technologies that are supported by this adapter. + /// + /// This field is always present. + 2: TechnologyType technology; + + /// The identity address. + /// + /// This field is always present. + 3: bt.Address address; + + /// Indicates whether or not this is the active host. The system has one active host which + /// handles all Bluetooth procedures. + 4: bool active; + + /// The local name of this host. This is the name that is visible to other devices when this + /// host is in the discoverable mode. + 5: string local_name; + + /// Whether or not the local adapter is currently discoverable over BR/EDR and + /// LE physical channels. + 6: bool discoverable; + + /// Whether or not device discovery is currently being performed. + 7: bool discovering; +}; + +/// Protocol used to observe and manage the Bluetooth controllers on the system. +[Discoverable] +protocol HostWatcher { + /// Obtain a list of all available Bluetooth controllers and their state. A response is sent + /// only if this list has changed since the last time the client has sent this message. + Watch() -> (vector<HostInfo> hosts); + + /// Designates the host with the given `id` as active. All Bluetooth procedures will be routed + /// over this host. Any previously assigned active host will be disabled and all of its pending + /// procedures will be terminated. + /// + /// * error This can fail if a host with `id` was not found. + SetActive(bt.HostId id) -> () error zx.status; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/identity.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/identity.fidl new file mode 100644 index 0000000..54aadb7 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/identity.fidl
@@ -0,0 +1,130 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.sys; + +using fuchsia.bluetooth as bt; + +struct SecurityProperties { + bool authenticated; + bool secure_connections; + uint8 encryption_key_size; +}; + +/// Represents a 128-bit secret key. +struct Key { + array<uint8>:16 value; +}; + +/// Represents a key that was received from a peer. +struct PeerKey { + /// The security properties of this link under which this key was received. + SecurityProperties security; + + /// The contents of the key. + Key data; +}; + +/// Represents a locally generated key that is distributed across one or more bonds. +using LocalKey = Key; + +/// Represents a LE Long-Term peer key used for link encyrption. The `ediv` and `rand` +/// fields are zero if distributed using LE Secure Connections pairing. +struct Ltk { + PeerKey key; + uint16 ediv; + uint64 rand; +}; + +/// The preferred LE connection parameters of the peer. +struct LeConnectionParameters { + uint16 connection_interval; + uint16 connection_latency; + uint16 supervision_timeout; +}; + +table LeData { + /// The identity address of the peer. + 1: bt.Address address; + + /// The peer's preferred connection parameters, if known. + 2: LeConnectionParameters connection_parameters; + + /// Known GATT service UUIDs. + 3: vector<bt.Uuid> services; + + /// The LE long-term key. Present if the link was encrypted. + 4: Ltk ltk; + + /// Identity Resolving RemoteKey used to generate and resolve random addresses. + 5: PeerKey irk; + + /// Connection Signature Resolving RemoteKey used for data signing without encryption. + 6: PeerKey csrk; +}; + +table BredrData { + /// The public device address of the peer. + 1: bt.Address address; + + /// The peer's preferred piconet role. This is determined by role switch procedures. Paging and + /// connecting from a peer does not automatically set this flag. If absent, the peer has not + /// expressed a preference. + 2: bt.ConnectionRole role_preference; + + /// Known service UUIDs obtained from EIR data or SDP. + 3: vector<bt.Uuid> services; + + /// The semi-permanent BR/EDR key. Present if link was paired with Secure + /// Simple Pairing or stronger. + 4: PeerKey link_key; +}; + +/// Represents the bonding data for a single peer. +table BondingData { + /// The identifier that uniquely identifies this peer. + 1: bt.PeerId identifier; + + /// The local Bluetooth identity address that this bond is associated with. + 2: bt.Address local_address; + + /// The name of the peer, if known. + 3: string name; + + /// Bonding data that is present when this peer is paired on the LE transport. + 4: LeData le; + + /// Bonding data that is present when this peer is paired on the BR/EDR transport. + 5: BredrData bredr; +}; + +/// Represents persistent local host data. +table HostData { + /// The local Identity Resolving Key used by a bt-host device to generate Resolvable Private + /// Addresses when privacy is enabled. + /// + /// May be absent for hosts that do not use LE privacy, or that only use Non-Resolvable Private + /// Addresses. + /// + /// NOTE: This key is distributed to LE peers during pairing procedures. The client must take + /// care to assign an IRK that consistent with the local bt-host identity. + // TODO(BT-815): Document behavior once there is a better privacy policy when `irk` is null. + 1: LocalKey irk; +}; + +/// Represents the persistent configuration of a single host-subsystem instance. This is used for +/// identity presentation (inquiry, inquiry response, and advertisement) and for bonding secrets +/// recall (encrypting link data to peers associated with this identity). +/// +/// Each BR/EDR BD_ADDR and Low Energy public identity address used to bond should have its own +/// Identity instance containing corresponding peers. +/// +/// Each Identity instance that supports LE privacy should have an Identity Resolving Key (IRK) that +/// is consistent with that distributed to its bonded peers. +table Identity { + 1: HostData host; + + /// All bonds that use a public identity address must contain the same local address. + 2: vector<BondingData> bonds; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/meta.json new file mode 100644 index 0000000..e62a160 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/meta.json
@@ -0,0 +1,16 @@ +{ + "deps": [ + "fuchsia.bluetooth" + ], + "name": "fuchsia.bluetooth.sys", + "root": "fidl/fuchsia.bluetooth.sys", + "sources": [ + "fidl/fuchsia.bluetooth.sys/access.fidl", + "fidl/fuchsia.bluetooth.sys/bootstrap.fidl", + "fidl/fuchsia.bluetooth.sys/host_watcher.fidl", + "fidl/fuchsia.bluetooth.sys/identity.fidl", + "fidl/fuchsia.bluetooth.sys/pairing_delegate.fidl", + "fidl/fuchsia.bluetooth.sys/peer.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/pairing_delegate.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/pairing_delegate.fidl new file mode 100644 index 0000000..b5df787 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/pairing_delegate.fidl
@@ -0,0 +1,88 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.sys; + +using fuchsia.bluetooth as bt; + +/// Input and Output Capabilities for pairing exchanges. +/// See Volume 3, Part C, Table 5.3 and 5.4 +enum InputCapability { + NONE = 1; + CONFIRMATION = 2; + KEYBOARD = 3; +}; + +enum OutputCapability { + NONE = 1; + DISPLAY = 2; +}; + +/// Different types required by the Security Manager for pairing methods. +/// Bluetooth SIG has different requirements for different device capabilities. +enum PairingMethod { + /// The user is asked to accept or reject pairing. + CONSENT = 1; + + /// The user is shown a 6-digit numerical passkey which they must enter on the + /// peer device. + PASSKEY_DISPLAY = 2; + + /// The user is shown a 6-digit numerical passkey which will also shown on the + /// peer device. The user must compare the passkeys and accept the pairing if + /// the passkeys match. + PASSKEY_COMPARISON = 3; + + /// The user is asked to enter a 6-digit passkey. + PASSKEY_ENTRY = 4; +}; + +enum PairingKeypress { + /// The user has entered a single digit. + DIGIT_ENTERED = 1; + + /// The user has erased a single digit. + DIGIT_ERASED = 2; + + /// The user has cleared the entire passkey. + PASSKEY_CLEARED = 3; + + /// The user has finished entering the passkey. + PASSKEY_ENTERED = 4; +}; + +protocol PairingDelegate { + /// Called to initiate a pairing request. The delegate must respond with “true” or “false” to + /// either accept or reject the pairing request. If the pairing method requires a passkey + /// this is returned as well. + /// + /// Any response from this method will be ignored if the OnPairingComplete + /// event has already been sent for `peer`. + /// + /// The `displayed_passkey` parameter should be displayed to the user if `method` equals + /// `PairingMethod.PASSKEY_DISPLAY` or `PairingMethod.PASSKEY_COMPARISON`. Otherwise, this parameter + /// has no meaning and should be ignored. + /// + /// The `entered_passkey` parameter only has meaning if `method` equals + /// `PairingMethod.PASSKEY_ENTRY`. It will be ignored otherwise. + OnPairingRequest(Peer peer, PairingMethod method, uint32 displayed_passkey) + -> (bool accept, uint32 entered_passkey); + + /// Called if the pairing procedure for the device with the given ID is completed. + /// This can be due to successful completion or an error (e.g. due to cancellation + /// by the peer, a timeout, or disconnection) which is indicated by `success`. + OnPairingComplete(bt.PeerId id, bool success); + + /// Called to notify keypresses from the peer device during pairing using + /// `PairingMethod.PASSKEY_DISPLAY`. + /// + /// This event is used to provide key press events to the delegate for a responsive user + /// experience as the user types the passkey on the peer device. This event will be called + /// once for each key-press. + OnRemoteKeypress(bt.PeerId id, PairingKeypress keypress); + + /// The delegate can send this event to notify the peer of local keypresses + /// during pairing using `PairingMethod.PASSKEY_ENTRY`. + -> OnLocalKeypress(bt.PeerId id, PairingKeypress keypress); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/peer.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/peer.fidl new file mode 100644 index 0000000..33c889b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth.sys/peer.fidl
@@ -0,0 +1,64 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth.sys; + +using fuchsia.bluetooth as bt; + +enum TechnologyType { + LOW_ENERGY = 1; + CLASSIC = 2; + DUAL_MODE = 3; +}; + +/// Represents a remote BR/EDR, LE, or dual-mode BR/EDR/LE peer. +table Peer { + /// Uniquely identifies this peer on the current system. + /// + /// This field is always present. + 1: bt.PeerId id; + + /// Bluetooth device address that identifies this peer. Clients + /// should display this field to the user when `name` is not available. + /// + /// This field is always present. + /// + /// NOTE: Clients should use the `identifier` field to keep track of peers instead of their + /// address. + 2: bt.Address address; + + /// The Bluetooth technologies that are supported by this peer. + /// + /// This field is always present. + 3: TechnologyType technology; + + /// Whether or not a BR/EDR and/or LE connection exists to this peer. + /// + /// This field is always present. + 4: bool connected; + + /// Whether or not this peer is bonded. + /// + /// This field is always present. + 5: bool bonded; + + /// The name of the peer, if known. + 6: string name; + + /// The LE appearance property. Present if this peer supports LE and the + /// appearance information was obtained over advertising and/or GATT. + 7: bt.Appearance appearance; + + /// The class of device for this device, if known. + 8: bt.DeviceClass device_class; + + /// The most recently obtained advertising signal strength for this peer. Present if known. + 9: int8 rssi; + + /// The most recently obtained transmission power for this peer. Present if known. + 10: int8 tx_power; + + /// The list of service UUIDs known to be available on this peer. + 11: vector<bt.Uuid> services; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/BUILD.gn new file mode 100644 index 0000000..5aca079 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/BUILD.gn
@@ -0,0 +1,32 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.bluetooth") { + library_name = "bluetooth" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "address.fidl", + "appearance.fidl", + "connection_role.fidl", + "device_class.fidl", + "id.fidl", + "nullables.fidl", + "status.fidl", + "uuid.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.bluetooth", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/address.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/address.fidl new file mode 100644 index 0000000..65daf08 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/address.fidl
@@ -0,0 +1,22 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +enum AddressType : uint8 { + /// LE public device address or `BR/EDR` `BD_ADDR`. + PUBLIC = 1; + + /// LE private or static random device address. + RANDOM = 2; +}; + +/// Represents a 48-bit Bluetooth Device Address. +struct Address { + /// Type of the device address. + AddressType type; + + /// The device address bytes in little-endian order. + array<uint8>:6 bytes; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/appearance.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/appearance.fidl new file mode 100644 index 0000000..f6844e1 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/appearance.fidl
@@ -0,0 +1,65 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +/// Possible values for the LE Appearance property which describes the external +/// appearance of a peer at a high level. +/// (See the Bluetooth assigned-numbers document: +/// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml) +enum Appearance : uint16 { + UNKNOWN = 0; + PHONE = 64; + COMPUTER = 128; + WATCH = 192; + WATCH_SPORTS = 193; + CLOCK = 256; + DISPLAY = 320; + REMOTE_CONTROL = 384; + EYE_GLASSES = 448; + TAG = 512; + KEYRING = 576; + MEDIA_PLAYER = 640; + BARCODE_SCANNER = 704; + THERMOMETER = 768; + THERMOMETER_EAR = 769; + HEART_RATE_SENSOR = 832; + HEART_RATE_SENSOR_BELT = 833; + BLOOD_PRESSURE = 896; + BLOOD_PRESSURE_ARM = 897; + BLOOD_PRESSURE_WRIST = 898; + HID = 960; + HID_KEYBOARD = 961; + HID_MOUSE = 962; + HID_JOYSTICK = 963; + HID_GAMEPAD = 964; + HID_DIGITIZER_TABLET = 965; + HID_CARD_READER = 966; + HID_DIGITAL_PEN = 967; + HID_BARCODE_SCANNER = 968; + GLUCOSE_METER = 1024; + RUNNING_WALKING_SENSOR = 1088; + RUNNING_WALKING_SENSOR_IN_SHOE = 1089; + RUNNING_WALKING_SENSOR_ON_SHOE = 1090; + RUNNING_WALKING_SENSOR_ON_HIP = 1091; + CYCLING = 1152; + CYCLING_COMPUTER = 1153; + CYCLING_SPEED_SENSOR = 1154; + CYCLING_CADENCE_SENSOR = 1155; + CYCLING_POWER_SENSOR = 1156; + CYCLING_SPEED_AND_CADENCE_SENSOR = 1157; + PULSE_OXIMETER = 3136; + PULSE_OXIMETER_FINGERTIP = 3137; + PULSE_OXIMETER_WRIST = 3138; + WEIGHT_SCALE = 3200; + PERSONAL_MOBILITY = 3264; + PERSONAL_MOBILITY_WHEELCHAIR = 3265; + PERSONAL_MOBILITY_SCOOTER = 3266; + GLUCOSE_MONITOR = 3328; + SPORTS_ACTIVITY = 5184; + SPORTS_ACTIVITY_LOCATION_DISPLAY = 5185; + SPORTS_ACTIVITY_LOCATION_AND_NAV_DISPLAY = 5186; + SPORTS_ACTIVITY_LOCATION_POD = 5187; + SPORTS_ACTIVITY_LOCATION_AND_NAV_POD = 5188; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/connection_role.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/connection_role.fidl new file mode 100644 index 0000000..827f0ab --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/connection_role.fidl
@@ -0,0 +1,18 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +/// Refers to the role of a Bluetooth device (local or peer) in a physical channel piconet. See +/// [Bluetooth Vocabulary Guide](/src/connectivity/bluetooth/docs/vocabulary.md) for more +/// information. +enum ConnectionRole { + /// The role of the device that defines the piconet physical channel in BR/EDR or the + /// "initiating" device in LE. + LEADER = 1; + + /// The role of a device that synchronizes to the piconet physical channel in BR/EDR or the + /// "advertising" device in LE. + FOLLOWER = 2; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/device_class.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/device_class.fidl new file mode 100644 index 0000000..5071822 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/device_class.fidl
@@ -0,0 +1,31 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +/// The "Class of Device/Service" is a variable-format field that defines the category of a +/// Bluetooth device. The bitfield is divided into segments called "major service class", +/// "major device class", and "minor device class". +/// +/// No assumptions about the specific functionality or characteristics of any application should be +/// based solely on its inclusion within a Major or Minor device class. For more information, see +/// https://www.bluetooth.com/specifications/assigned-numbers/baseband. +struct DeviceClass { + uint32 value; +}; + +/// Constants for the major device class field. The major device class is defined by bits 12-8. +const uint32 MAJOR_DEVICE_CLASS_MASK = 0x1f00; + +const uint32 MAJOR_DEVICE_CLASS_MISCELLANEOUS = 0x0000; +const uint32 MAJOR_DEVICE_CLASS_COMPUTER = 0x0100; +const uint32 MAJOR_DEVICE_CLASS_PHONE = 0x0200; +const uint32 MAJOR_DEVICE_CLASS_LAN = 0x0300; +const uint32 MAJOR_DEVICE_CLASS_AUDIO_VIDEO = 0x0400; +const uint32 MAJOR_DEVICE_CLASS_PERIPHERAL = 0x0500; +const uint32 MAJOR_DEVICE_CLASS_IMAGING = 0x0600; +const uint32 MAJOR_DEVICE_CLASS_WEARABLE = 0x0700; +const uint32 MAJOR_DEVICE_CLASS_TOY = 0x0800; +const uint32 MAJOR_DEVICE_CLASS_HEALTH = 0x0900; +const uint32 MAJOR_DEVICE_CLASS_UNCATEGORIZED = 0x1f00;
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/id.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/id.fidl new file mode 100644 index 0000000..26255a0 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/id.fidl
@@ -0,0 +1,15 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +/// 64-bit unique value used by the system to identify host adapters. +struct HostId { + uint64 value; +}; + +/// 64-bit unique value used by the system to identify peer devices. +struct PeerId { + uint64 value; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/meta.json new file mode 100644 index 0000000..f34661e --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/meta.json
@@ -0,0 +1,16 @@ +{ + "deps": [], + "name": "fuchsia.bluetooth", + "root": "fidl/fuchsia.bluetooth", + "sources": [ + "fidl/fuchsia.bluetooth/address.fidl", + "fidl/fuchsia.bluetooth/appearance.fidl", + "fidl/fuchsia.bluetooth/connection_role.fidl", + "fidl/fuchsia.bluetooth/device_class.fidl", + "fidl/fuchsia.bluetooth/id.fidl", + "fidl/fuchsia.bluetooth/nullables.fidl", + "fidl/fuchsia.bluetooth/status.fidl", + "fidl/fuchsia.bluetooth/uuid.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/nullables.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/nullables.fidl new file mode 100644 index 0000000..08e7a5b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/nullables.fidl
@@ -0,0 +1,20 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +// DEPRECATED: Do not use these types in new code. Prefer tables to group optional primitive +// fields. + +struct Bool { + bool value; +}; + +struct Int8 { + int8 value; +}; + +struct UInt16 { + uint16 value; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/status.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/status.fidl new file mode 100644 index 0000000..6d923ad --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/status.fidl
@@ -0,0 +1,46 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +/// DEPRECATED. Do not use these types in new code. Prefer the "error" syntax, protocol-specific +/// enums and zx.status instead. + +enum ErrorCode { + UNKNOWN = 0; + FAILED = 1; + CANCELED = 2; + IN_PROGRESS = 3; + TIMED_OUT = 4; + NOT_FOUND = 5; + NOT_SUPPORTED = 6; + BLUETOOTH_NOT_AVAILABLE = 7; + BAD_STATE = 8; + INVALID_ARGUMENTS = 9; + ALREADY = 10; + PROTOCOL_ERROR = 11; +}; + +// Represents an error result returned from an asynchronous operation. +struct Error { + // Represents a high-level error code. If this is set to ErrorCode.PROTOCOL_ERROR, then + // `protocol_error_code` will represent a Bluetooth protocol error code. The specific + // protocol that caused the error will be context-specific, e.g. GATT interfaces will + // return ATT protocol error codes. + ErrorCode error_code; + + // Protocol error code. The value of this field is relevant only if `error_code` is set to + // ErrorCode.PROTOCOL_ERROR. + uint32 protocol_error_code; + + // Debug descriptioon of an error. This provides additional debugging information for an error + // and is not intended to be displayed in user interfaces. + string? description; +}; + +// Represents the result of an asynchronous operation. +struct Status { + // `error` will be null if this represents a "success" status, i.e. no error has occurred. + Error? error; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/uuid.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/uuid.fidl new file mode 100644 index 0000000..66b0bd6 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.bluetooth/uuid.fidl
@@ -0,0 +1,13 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.bluetooth; + +/// Represents a Bluetooth UUID in its 128-bit canonical form. While the Bluetooth standard supports +/// 16- and 32-bit short form UUIDs over the wire, the Fuchsia FIDL libraries require all UUIDs to +/// be represented in their canonical 128-bit form. +struct Uuid { + /// The UUID bytes in little-endian order. + array<uint8>:16 value; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.camera/BUILD.gn new file mode 100644 index 0000000..9570738 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.camera") { + library_name = "camera" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.sysmem", + ] + sources = [ + "camera.fidl", + "manager.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.camera", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera/camera.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera/camera.fidl new file mode 100644 index 0000000..a2c9796 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera/camera.fidl
@@ -0,0 +1,116 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is being deprecated - please do not rely on any of the structs or +// protocols here moving forward. + +library fuchsia.camera; + +using fuchsia.sysmem; +using zx; + +const uint32 MAX_FORMATS_PER_RESPONSE = 16; + +/// A coarse set of capabilities. This struct is used in the camera description +/// to help filter out cameras which will not have the needed capabilities. +/// This set of declarations would be the bitfield: CameraOutputCapabilities. +const uint32 CAMERA_OUTPUT_UNKNOWN = 0; +const uint32 CAMERA_OUTPUT_STILL_IMAGE = 0x01; +const uint32 CAMERA_OUTPUT_BURST = 0x02; +const uint32 CAMERA_OUTPUT_STREAM = 0x04; +const uint32 CAMERA_OUTPUT_HDR = 0x08; +const uint32 CAMERA_OUTPUT_DEPTH = 0x10; +const uint32 CAMERA_OUTPUT_STEREO = 0x20; + +/// Identifying information about the device. +struct DeviceInfo { + uint64 camera_id; // Currently populated by the camera manager + uint16 vendor_id; + string vendor_name; + uint16 product_id; + string product_name; + /// The maximum number of stream interfaces that the device can support + /// simultaneously. + uint16 max_stream_count; + uint32 output_capabilities; // CameraOutputCapabilities + // TODO(CAM-12): Add CameraPose, when we can actually use it. +}; + +/// Status to be set when a frame is signalled available. +enum FrameStatus { + OK = 0; + /// An error occurred during the production of a frame. + /// No data will be available in the data buffer corresponding to this + /// notification. + ERROR_FRAME = 1; + + /// No space was available in the data buffer, resulting in a dropped frame. + ERROR_BUFFER_FULL = 2; +}; + +struct Metadata { + int64 timestamp; +}; + +/// Sent by the driver to the client when a frame is available for processing, +/// or an error occurred. +struct FrameAvailableEvent { + /// Non zero if an error occurred. + FrameStatus frame_status; + + /// The index of the buffer in the buffer collection. + uint32 buffer_id; + + Metadata metadata; +}; + +struct FrameRate { + /// The frame rate is frames_per_sec_numerator / frames_per_sec_denominator. + uint32 frames_per_sec_numerator; + uint32 frames_per_sec_denominator; +}; + +struct VideoFormat { + fuchsia.sysmem.ImageFormat format; + FrameRate rate; +}; + +/// These are the original interfaces, which are being used for compatibility. +/// The names are preserved from the ones in camera.h for porting ease. +[Discoverable] +protocol Control { + /// Get the available format types for this device + /// NOTE: The formats are paginated to `MAX_FORMATS_PER_RESPONSE`, multiple + /// GetFormats need to be issued until total_format_count are received + GetFormats(uint32 index) + -> (vector<VideoFormat> formats, uint32 total_format_count, + zx.status status); + + /// Sent by the client to indicate desired stream characteristics. + /// If setting the format is successful, the stream request will be honored. + /// The stream token is used to provide additional control over the interface from the + /// Camera Manager. The driver provides the guarantee that: + /// 1) If the stream token receives the `PEER_CLOSED` event, the driver will close + /// the stream. + /// 2) If the Stream interface is closed, the driver will close the eventpair. + CreateStream(fuchsia.sysmem.BufferCollectionInfo buffer_collection, + FrameRate rate, request<Stream> stream, handle<eventpair> stream_token); + + GetDeviceInfo() -> (DeviceInfo device_info); +}; + +protocol Stream { + /// Starts the streaming of frames. + Start(); + + /// Stops the streaming of frames. + Stop(); + + /// Unlocks the specified frame, allowing the driver to reuse the memory. + ReleaseFrame(uint32 buffer_id); + + /// Sent by the driver to the client when a frame is available for processing, + /// or an error occurred. + -> OnFrameAvailable(FrameAvailableEvent frame); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera/manager.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera/manager.fidl new file mode 100644 index 0000000..9e72137 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera/manager.fidl
@@ -0,0 +1,73 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera; + +using fuchsia.sysmem; + +/// A stream that the camera manager can provide. Video streams reference a +/// a camera, but may have additional hardware and bandwidth restrictions +/// from and ISP or other processing units. +/// This is being deprecated - please use VideoStreamV2 (below). +struct VideoStream { + /// The camera_id corresponds to the camera_id that is given in the DeviceInfo + /// received from GetDevices. + uint64 camera_id; + /// The requested video format. Note that this is field is necessary to + /// set The frame rate, even when calling CreateStream. + /// When calling CreateStream, format.format should match buffer_info.format. + VideoFormat format; +}; + +/// Preferred version of stream. +/// A version of stream that relies on definition of VideoFormat coming out of +/// fuchsia.hardware.camera. Streams reference a camera, but may have additional +/// hardware and bandwidth restrictions from an ISP or other processing units. +/// New code should depend on this as the other version will be deprecated when +/// dependencies are removed. +struct VideoStreamV2 { + /// The camera_id corresponds to the camera_id that is given in DeviceInfo + /// received from GetDevices. + uint64 camera_id; + /// The requested video format. Note that this field is necessary to set the + /// frame rate, even when calling CreateStream. When calling CreateStream + /// format.format should match buffer_info.format. + VideoFormat format; +}; + +/// The Camera Manager grants access to individual or sets of cameras +/// 1) You request the list of cameras, which gives you camera descriptions +/// 2) You request the list of formats available for the camera to which you +/// wish to connect. +/// 3) You request a Stream interface using CreateStream. +[Discoverable] +protocol Manager { + /// Returns a list of all the video devices that are currently plugged in + /// and enumerated. The camera_id field of the DeviceInfo is used to specify + /// a device in GetFormats, GetStream and GetStreamAndBufferCollection. + GetDevices() -> (vector<DeviceInfo> descriptions); + + /// Get all the available formats for a camera. + /// `camera_id` is obtained from a DeviceInfo returned by GetDevices. + GetFormats(uint64 camera_id, uint32 index) + -> (vector<VideoFormat> formats, uint32 total_format_count); + + /// Create a Stream with the specified access rights. This may not succeed. + /// If it does succeed, the Stream will have the rights indicated. + /// `buffer_info` contains a set of buffers to be used with the Stream. + /// This is being deprecated - please use CreateStreamV2. + CreateStream(VideoStream request, + fuchsia.sysmem.BufferCollectionInfo buffer_info, + request<Stream> stream, handle<eventpair> client_token); + + /// Create a Stream with the specified access rights. This may not succeed. + /// If it does succeed, the Stream will have the rights indicated. + /// `buffer_info` contains a set of buffers to be used with the Stream. + [Transitional="This is meant to replace CreateStream"] + CreateStreamV2(VideoStreamV2 request, + fuchsia.sysmem.BufferCollectionInfo buffer_info, + request<Stream> stream, + handle<eventpair> client_token); + +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.camera/meta.json new file mode 100644 index 0000000..7e44edf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera/meta.json
@@ -0,0 +1,12 @@ +{ + "deps": [ + "fuchsia.sysmem" + ], + "name": "fuchsia.camera", + "root": "fidl/fuchsia.camera", + "sources": [ + "fidl/fuchsia.camera/camera.fidl", + "fidl/fuchsia.camera/manager.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/BUILD.gn new file mode 100644 index 0000000..751ea7c --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.camera2.hal") { + library_name = "hal" + namespace = "fuchsia.camera2" + public_deps = [ + "../fuchsia.camera2", + "../fuchsia.sysmem", + ] + sources = [ + "hal.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.camera2.hal", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/hal.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/hal.fidl new file mode 100644 index 0000000..5979760 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/hal.fidl
@@ -0,0 +1,77 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera2.hal; + +using fuchsia.camera2; +using fuchsia.sysmem; +using zx; + +/// Maximum number of configurations per device. +const uint64 MAX_CONFIGURATIONS = 256; + +/// Maximum number of streams per config. +const uint64 MAX_STREAMS = 64; + +/// Represents one stream within a particular configuration. +struct StreamConfig { + fuchsia.camera2.FrameRate frame_rate; + /// `constraints` should allow for all the image formats listed in image_formats. + fuchsia.sysmem.BufferCollectionConstraints constraints; + + /// Properties of the stream: + fuchsia.camera2.StreamProperties properties; + + /// We need to specify both the constraints & the image formats because + /// there are fixed set of resolutions supported by the Camera Controller + /// so a range within the `constraints` won't be sufficient. + /// Some streams support multiple resolutions for same configuration + /// We would need to change the resolution runtime, without stopping the + /// streaming. This provides a list of resolutions a stream would be providing. + /// At least one format must be provided. + vector<fuchsia.sysmem.ImageFormat_2>:fuchsia.camera2.MAX_IMAGE_FORMATS image_formats; +}; + +/// Represents one configuration +struct Config { + // One configuration could have multiple streams. + vector<StreamConfig>:MAX_STREAMS stream_configs; +}; + +/// This is the interface to the camera driver +/// which allows setting up a given configuration +/// and setting up a stream. +[Discoverable] +protocol Controller { + // TODO(48707): Change to GetConfig() which returns a single configuration instead + /// of a vector of Configs. + /// Get an available configurations which the camera driver supports. + /// Clients need to keep calling GetConfigs() to get all available configurations. + /// Returns |nullptr| if no new configurations are supported. + GetConfigs() -> (vector<Config>:MAX_CONFIGURATIONS? configs, zx.status status); + + /// Set a particular configuration and create the requested stream. + /// `config_index` : Configuration index from the vector which needs to be applied. + /// `stream_index` : Stream index from the vector of streams provided within a config. + /// `buffer_collection` : Buffer collections for the stream. + /// `stream` : Stream channel for the stream requested + /// `image_format_index` : Image format index which needs to be set up upon creation. + /// If there is already an active configuration which is different than the one + /// which is requested to be set, then the HAL will be closing all existing streams + /// and honor this new setup call. + /// If the new stream requested is already part of the existing running configuration + /// the HAL will just be creating this new stream while the other stream still exists as is. + CreateStream(uint32 config_index, + uint32 stream_index, + uint32 image_format_index, + fuchsia.sysmem.BufferCollectionInfo_2 buffer_collection, + request<fuchsia.camera2.Stream> stream); + + /// Enable/Disable Streaming + EnableStreaming(); + DisableStreaming(); + + // Get identifying information about the device: + GetDeviceInfo() -> (fuchsia.camera2.DeviceInfo info); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/meta.json new file mode 100644 index 0000000..9575c35 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2.hal/meta.json
@@ -0,0 +1,12 @@ +{ + "deps": [ + "fuchsia.camera2", + "fuchsia.sysmem" + ], + "name": "fuchsia.camera2.hal", + "root": "fidl/fuchsia.camera2.hal", + "sources": [ + "fidl/fuchsia.camera2.hal/hal.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/BUILD.gn new file mode 100644 index 0000000..f558a7b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.camera2") { + library_name = "camera2" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.sysmem", + ] + sources = [ + "manager.fidl", + "stream.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.camera2", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2/manager.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/manager.fidl new file mode 100644 index 0000000..43f3dfa --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/manager.fidl
@@ -0,0 +1,91 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera2; + +using fuchsia.sysmem; +using zx; + +[Discoverable] +protocol Manager { + /// Notifies the client when a camera becomes available. A number of these events will + /// be sent when a client first connects to this protocol. + /// `device_id` is used to identify the camera. The device_id should not change throughout + /// the lifetime of the camera. + /// `last_known_camera` is set to true when the Camera Manager has notified the client + /// of all the devices it currently knows about. + /// `description` describes the properties of the camera. + -> OnDeviceAvailable(int32 device_id, DeviceInfo description, bool last_known_camera); + + /// Notifies the client when a camera becomes unavailable. + -> OnDeviceUnavailable(int32 device_id); + + /// Notifies the client when a camera becomes muted or unmuted. + /// `device_id` refers to the device_id from the description of a previous OnDeviceAvailable + /// call. + -> OnDeviceMuteChanged(int32 device_id, bool currently_muted); + + /// AcknowledgeDeviceEvent must be called after any of the above events before more + /// events will be sent. + AcknowledgeDeviceEvent(); + + /// Connect to a camera stream: + /// `device_id` Refers to a specific device_id that has been advertised by OnDeviceAvailable. + /// `constraints` contains a set of constraints on the requested stream. The Camera + /// Manager will attempt to find a stream that meets the constraints. If multiple + /// streams match, one of the matching streams will be connected. + /// `token` refers to a Sysmem buffer allocation that will be used to pass images using + /// the Stream protocol. The Camera Manager will apply a BufferCollectionContraints + /// related to the image format(s), so the client does not need to apply any + /// ImageFormatConstraints. + /// Sync is assumed to have been called on `token` before it is passed to + /// ConnectToStream. + /// Since `constraints` may not dictate a specific format, the initial format of images + /// on the stream is indicated on the response. + /// The connection is considered to be successful once a response has been given, unless + /// `stream` is closed. + ConnectToStream(int32 device_id, StreamConstraints constraints, + fuchsia.sysmem.BufferCollectionToken token, + request<Stream> stream) -> (fuchsia.sysmem.ImageFormat_2 format); +}; + +[Discoverable] +protocol MuteControl { + /// Mutes a camera. This is independent from stopping or closing a stream. A muted + /// camera will not produce any more images until + /// unmute is called. You can still connect to streams from a muted camera, but they + /// will not produce frames until the camera is unmuted. + /// `device_id` refers to the device_id from a previous OnDeviceAvailable call. + Mute(int32 device_id) -> (zx.status status); + Unmute(int32 device_id) -> (zx.status status); +}; + +/// These constraints are given to the Camera Manager when requesting a stream. The +/// Camera Manager will use these constraints to match an appropriate stream. +table StreamConstraints { + /// A table that describes the properties of the stream. Any properties specified will + /// be considered requirements for matching streams. + 1: StreamProperties properties; + + /// If specified, the stream will be created using this index for the initial format index. + /// If unspecified, the first stream format will be used. + 2: uint32 format_index; +}; + +enum DeviceType { + BUILTIN = 1; + VIRTUAL = 2; +}; + +/// Identifying information about the device. +table DeviceInfo { + /// Information from physical device enumeration: + 1: uint16 vendor_id; + 2: string:255 vendor_name; + 3: uint16 product_id; + 4: string:255 product_name; + + /// Information about the type of device: + 5: DeviceType type; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/meta.json new file mode 100644 index 0000000..e343ca9 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/meta.json
@@ -0,0 +1,12 @@ +{ + "deps": [ + "fuchsia.sysmem" + ], + "name": "fuchsia.camera2", + "root": "fidl/fuchsia.camera2", + "sources": [ + "fidl/fuchsia.camera2/manager.fidl", + "fidl/fuchsia.camera2/stream.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera2/stream.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/stream.fidl new file mode 100644 index 0000000..1271fe0 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera2/stream.fidl
@@ -0,0 +1,114 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera2; + +using fuchsia.sysmem; +using zx; + +/// Maximum number of image formats per stream. +const uint64 MAX_IMAGE_FORMATS = 256; + +/// Status to be set when a frame is signalled available. +enum FrameStatus { + OK = 0; + /// An error occurred during the production of a frame. + /// No data will be available in the data buffer corresponding to this + /// notification. + ERROR_FRAME = 1; + + /// No space was available in the data buffer, resulting in a dropped frame. + ERROR_BUFFER_FULL = 2; +}; + +table FrameMetadata { + 1: int64 timestamp; + /// |image_format_index| references the index into the vector of available + /// formats supported by the stream. + 2: uint32 image_format_index; +}; + +/// Sent by the driver to the client when a frame is available for processing, +/// or an error occurred. +struct FrameAvailableInfo { + /// Non zero if an error occurred. + FrameStatus frame_status; + + /// The index of the buffer in the buffer collection. + uint32 buffer_id; + + FrameMetadata metadata; +}; + +struct FrameRate { + /// The frame rate is frames_per_sec_numerator / frames_per_sec_denominator. + uint32 frames_per_sec_numerator; + uint32 frames_per_sec_denominator; +}; + +/// Different Stream types provided by the camera stack. +bits CameraStreamType : uint32 { + /// ML request FR(Full Resolution) stream as well as + /// a DS(Down Scaled Resolution) stream for Security Use Case + /// which are of fixed resolutions + MACHINE_LEARNING = 0x01; + /// This is Security Video Stream which could support multiple + /// resolutions at runtime. + MONITORING = 0x02; + FULL_RESOLUTION = 0x04; + /// ML request a DS stream for Video Conferencing which is fixed resolution + DOWNSCALED_RESOLUTION = 0x08; + /// This is Video Conferencing Stream which could support + /// multiple resolutions at runtime. + VIDEO_CONFERENCE = 0x10; + /// Stream with extended field of view. + EXTENDED_FOV = 0x20; +}; + +table StreamProperties { + /// These could be one or more of the above mentioned Stream Types + 1: CameraStreamType stream_type; +}; + +protocol Stream { + /// Control Operations + /// Starts the streaming of frames. + Start(); + + /// Stops the streaming of frames. + Stop(); + + /// Unlocks the specified frame, allowing the driver to reuse the memory. + ReleaseFrame(uint32 buffer_id); + + /// Sent by the driver to the client when a frame is available for processing, + /// or an error occurred. The frame is considered read-locked by the client + /// after this message. The client must call ReleaseFrame to release the + /// read-lock for a non-error frame, or the consumer will eventually run out of buffers. + /// If a frame has an error, the client must call AcknowledgeFrameError before + /// another OnFrameAvailable will be called with an error frame. + -> OnFrameAvailable(FrameAvailableInfo frame); + + /// Provides flow control for receiving frame errors. See OnFrameAvailable comment. + AcknowledgeFrameError(); + + /// Data operations + /// This is used by clients to provide inputs for region of interest + /// selection. + /// Inputs are the x & y coordinates for the new bounding box. + /// For streams which do not support smart framing, this would + /// return an error. + SetRegionOfInterest(float32 x_min, + float32 y_min, + float32 x_max, + float32 y_max) -> (zx.status s); + + /// Change the image format of the stream. This is called when clients want + /// to dynamically change the resolution of the stream while the streaming is + /// is going on. + SetImageFormat(uint32 image_format_index) -> (zx.status s); + + /// Get the image formats that this stream supports. + GetImageFormats() -> (vector<fuchsia.sysmem.ImageFormat_2>:MAX_IMAGE_FORMATS image_formats); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera3/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/BUILD.gn new file mode 100644 index 0000000..5853ae2 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.camera3") { + library_name = "camera3" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.math", + "../fuchsia.sysmem", + ] + sources = [ + "device.fidl", + "device_watcher.fidl", + "stream.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.camera3", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera3/device.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/device.fidl new file mode 100644 index 0000000..78ba4ba --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/device.fidl
@@ -0,0 +1,60 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera3; + +const uint32 MAX_IDENTIFIER_LENGTH = 256; +const uint32 MAX_CONFIGURATIONS_PER_CAMERA = 256; +const uint32 MAX_STREAMS_PER_CONFIGURATION = 256; +const uint32 MAX_RESOLUTIONS_PER_STREAM = 1024; + +/// A Device represents a unique physical camera present in the system. Only one client may connect +/// to an unbound physical camera, however the "Rebind" method can be used to create multiple +/// connections to it to be used by a coordinated set of clients. +protocol Device { + /// Returns an identifier for the camera. If present, identical devices on different systems + /// will have the same identifier. Clients may use this to determine if additional semantics + /// known a priori for a given device apply to the current camera. + // TODO(fxb/43247): unify device identification + // go/unified-device-discovery will eliminate the need for this protocol + GetIdentifier() -> (string:MAX_IDENTIFIER_LENGTH? identifier); + + /// Returns a list of configurations supported by the camera. All cameras will have at least + /// one configuration. The values returned are immutable - they will not change for the + /// lifetime of the client's connection to the Camera. + GetConfigurations() -> (vector<Configuration>:MAX_CONFIGURATIONS_PER_CAMERA configurations); + + /// Returns the index of the current configuration when it has changed from a previously + /// returned configuration, or is called by a client for the first time. + WatchCurrentConfiguration() -> (uint32 index); + + /// Sets the configuration using the provided index. Calling this method disconnects any + /// existing Stream clients associated with this camera. + SetCurrentConfiguration(uint32 index); + + /// Returns the camera's current mute state when it has changed from a previously returned + /// state, or is called by a client for the first time. A camera may be muted using + /// SetSoftwareMuteState or by a physical switch. If either muted mode is active, stream + /// clients associated with this physical camera will stop receiving new frames. + WatchMuteState() -> (bool software_muted, bool hardware_muted); + + /// Sets the current camera's software mute state. When transitioning to the muted state, this + /// method returns when the camera has successfully ceased sending new frames to stream + /// clients. When transitioning to the unmuted state, this method returns immediately. + SetSoftwareMuteState(bool muted) -> (); + + /// Connects to the Stream at the provided index. If any clients already exist for this stream, + /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph. + ConnectToStream(uint32 index, request<Stream> request); + + /// Request another connection to this Device. This allows a client to delegate different + /// operations to different coordinated clients. + Rebind(request<Device> request); +}; + +/// Describes a distinct configuration for the camera. +struct Configuration { + /// Descriptions of streams that are concurrently available in the configuration. + vector<StreamProperties>:MAX_STREAMS_PER_CONFIGURATION streams; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera3/device_watcher.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/device_watcher.fidl new file mode 100644 index 0000000..18bf277 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/device_watcher.fidl
@@ -0,0 +1,41 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera3; + +const uint32 MAX_WATCH_DEVICES_EVENTS = 256; + +using DeviceId = uint64; + +/// The DeviceWatcher provides clients a mechanism to discover camera devices present on the +/// system. This is a temporary mechanism intended to be replaced by go/drivers-as-components, +/// which will allow multiple instances of the same protocol to exist side-by-side. Clients are +/// not required to maintain a connection to the Watcher in order to use established Camera +/// connections. +[Discoverable] +protocol DeviceWatcher { + /// Returns a list of available camera IDs when it has changed from the previously returned + /// list of IDs, or when it is called by a client for the first time. The returned list may be + /// empty, indicating no cameras are available. The IDs returned to the client will remain + /// consistent with respect to the physical devices they represent for the duration of the + /// client's connection. Events will be sorted first by event type - `existing`, `added`, + /// `removed`. Within each event type range, IDs will be provided in ascending order. Events + /// are coalesced by the server, so a given ID will only appear once in each list of events. + WatchDevices() -> (vector<WatchDevicesEvent>:MAX_WATCH_DEVICES_EVENTS events); + + /// Acquires a camera interface for the given ID. If any clients already exist for this camera, + /// the request is closed with the ZX_ERR_ALREADY_BOUND epitaph. + ConnectToDevice(DeviceId id, request<Device> request); +}; + +union WatchDevicesEvent { + /// Indicates an existing camera with the provided ID is still available. + 1: DeviceId existing; + + /// Indicates a new camera with the provided ID is now available. + 2: DeviceId added; + + /// Indicates an existing camera with the provided ID is no longer available. + 3: DeviceId removed; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera3/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/meta.json new file mode 100644 index 0000000..e2f3951 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/meta.json
@@ -0,0 +1,14 @@ +{ + "deps": [ + "fuchsia.math", + "fuchsia.sysmem" + ], + "name": "fuchsia.camera3", + "root": "fidl/fuchsia.camera3", + "sources": [ + "fidl/fuchsia.camera3/device.fidl", + "fidl/fuchsia.camera3/device_watcher.fidl", + "fidl/fuchsia.camera3/stream.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.camera3/stream.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/stream.fidl new file mode 100644 index 0000000..8f169ab --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.camera3/stream.fidl
@@ -0,0 +1,103 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.camera3; + +using fuchsia.math; +using fuchsia.sysmem; +using zx; + +/// A Stream represents timing, sequencing, and other camera-specific properties applied to a buffer +/// collection. +protocol Stream { + /// Sets the Stream's crop region to the provided region, with the top-left of the image + /// represented by (0,0) and the bottom-right of the image represented by (1,1). The resulting + /// content is subsequently scaled to fill the output buffer. If the implementation does not + /// precisely support the provided value, it will be expanded to the minimum region that covers + /// the provided region. If region is set to null, the crop region is unset, which is equivalent + /// to specifying a region covering the entire image. Upon initial connection, the region is + /// unset. If the stream does not support crop region, the connection is closed with the + /// ZX_ERR_NOT_SUPPORTED epitaph. + SetCropRegion(fuchsia.math.RectF? region); + + /// Returns the crop region if it has changed from a previously returned value, or is called by + /// a client for the first time. Frame callbacks received after receiving this callback reflect + /// the use of the new region. See SetCropRegion for a description of the region parameter. + WatchCropRegion() -> (fuchsia.math.RectF? region); + + /// Sets the resolution of the stream to the provided value. If the implementation does not + /// precisely support the provided value, it will be expanded to the minimum resolution that + /// exceeds the provided resolution. + SetResolution(fuchsia.math.Size coded_size); + + /// Returns the resolution if it has changed from a previously returned value, or is called by + /// a client for the first time. Frame callbacks received after receiving this callback reflect + /// the new resolution. + WatchResolution() -> (fuchsia.math.Size coded_size); + + /// If non-null, requests renegotiation of the buffer collection backing this stream, and + /// identifies this client as a participant in buffer negotiation. If null, identifies this + /// client as a non-participant in buffer negotiation. Upon initial connection, the client is a + /// non-participant. After registering as a participant, clients must always have an outstanding + /// call to WatchBufferCollection to receive tokens from the server so that they are able to + /// respond to current and future renegotiation requests. + SetBufferCollection(fuchsia.sysmem.BufferCollectionToken? token); + + /// Returns when the server or any buffer negotiation participant (including the current client) + /// requires buffer renegotiation, and the current client is registered as a participant. Frame + /// callbacks received after receiving this callback apply to the newly negotiated collection. + WatchBufferCollection() -> (fuchsia.sysmem.BufferCollectionToken token); + + /// Request the next available frame for this stream. Returns when the stream has completed + /// populating the buffer and may be read by the client, provided the number of unreleased + /// buffers held by the client is less than the count provided via the most recently negotiated + /// buffer collection token. If a buffer renegotiation is in progress, this call will return + /// only after the negotiation is complete and a new collection is available. + GetNextFrame() -> (FrameInfo info); + + /// Request another connection to this Stream. This allows a client to delegate different + /// operations to different coordinated clients. + Rebind(request<Stream> request); +}; + +/// Metadata concerning a given frame. +struct FrameInfo { + /// Identifies the buffer used for this frame as an index into the most recently negotiated + /// buffer collection. + uint32 buffer_index; + + /// A monotonically increasing counter indicating the number of frames written to this stream's + /// most recently negotiated buffer collection. Clients can use this to detect dropped frames + /// or generate nominal timestamps using the associated stream's framerate. + uint64 frame_counter; + + /// The value of the system monotonic clock, measured at the time the hardware completed + /// populating the buffer. + zx.time timestamp; + + /// The client must close this when it has completed reading from the buffer. + handle<eventpair> release_fence; +}; + +/// The frequency at which a Stream produces frames. The value is `numerator` / `denominator`, with +/// units of frames-per-second (Hz). The representation is not necessarily an irreducible fraction. +struct FrameRate { + /// Fraction numerator. + uint32 numerator; + + /// Fraction denominator. This value will not be zero. + uint32 denominator; +}; + +/// Describes the properties of a given stream. +struct StreamProperties { + /// Describes the native image format used by a stream. + fuchsia.sysmem.ImageFormat_2 image_format; + + /// Describes the framerate used by a stream. + FrameRate frame_rate; + + /// Indicates whether a stream supports the SetCropRegion method. + bool supports_crop_region; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castauth/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.castauth/BUILD.gn new file mode 100644 index 0000000..e5bd7c9 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castauth/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.castauth") { + library_name = "castauth" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "cast_auth.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.castauth", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castauth/cast_auth.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castauth/cast_auth.fidl new file mode 100644 index 0000000..81c659f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castauth/cast_auth.fidl
@@ -0,0 +1,40 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.castauth; + +/// Input hash to be signed by Cast key. +/// It must be ASN1-encoded SHA1 or SHA256 hash, with sizes 35 or 51 bytes. +union Asn1EncodedHash { + 1: array<byte>:35 sha1; + 2: array<byte>:51 sha256; +}; + +/// Error codes for CastKeySigner operations. +enum ErrorCode { + /// Key/cert not found in storage. + FILE_NOT_FOUND = 1; + /// Error occurred during signing operation. + CRYPTO_ERROR = 2; +}; + +/// This FIDL interface is used to sign with hardware Cast key. +/// It is intended for short-term use only and will not be supported on all +/// devices. It will eventually be replaced by an attestation service. +[Discoverable] +protocol CastKeySigner { + /// Use Cast key to sign a hash value. + /// + /// The input is hash value. + /// The return value is the error code or the signature if the operation + /// succeeds. The signature algorithm is RSA-2048-PKCS1. + SignHash(Asn1EncodedHash hash) -> (array<byte>:256 signature) error ErrorCode; + + /// Get the Cast certificate chain. + /// + /// The return value is the error code or the certificate chain if + /// the operation succeeds. The chain contains Cast key cert, + /// one or more intermediate CA certs and root CA cert. + GetCertificateChain() -> (vector<bytes:2048>:16 cert_chain) error ErrorCode; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castauth/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.castauth/meta.json new file mode 100644 index 0000000..63890cb --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castauth/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.castauth", + "root": "fidl/fuchsia.castauth", + "sources": [ + "fidl/fuchsia.castauth/cast_auth.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/BUILD.gn new file mode 100644 index 0000000..c0455bf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.castconfig") { + library_name = "castconfig" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.mem", + ] + sources = [ + "cast_config.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.castconfig", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/cast_config.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/cast_config.fidl new file mode 100644 index 0000000..fbdecee --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/cast_config.fidl
@@ -0,0 +1,33 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.castconfig; + +using fuchsia.mem; + +/// Error codes for the Watch operation. +enum ErrorCode { + /// Error when there is no cast config available. + NO_CAST_CONFIG = 1; + /// Generic error. + INTERNAL = 2; +}; + +/// Interface that provides cast config data. +[Discoverable] +protocol Provider { + /// Requests a buffer containing cast config data. + /// This call implements the Hanging Get protocol as detailed in + /// https://fuchsia.dev/fuchsia-src/development/api/fidl.md#delay-responses-using-hanging-gets + /// + /// All error cases are terminal, clients should not retry on error. + Watch() -> (fuchsia.mem.Buffer config) error ErrorCode; + + /// Notifies the config provider of the config status. + /// + /// `processed`: `true` if successfully recieved and processed + /// `retry`: If `processed` is `false` config provider determines if a retry + /// is appropriate. + Notify(bool processed) -> (bool retry); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/meta.json new file mode 100644 index 0000000..b5dcb6b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castconfig/meta.json
@@ -0,0 +1,11 @@ +{ + "deps": [ + "fuchsia.mem" + ], + "name": "fuchsia.castconfig", + "root": "fidl/fuchsia.castconfig", + "sources": [ + "fidl/fuchsia.castconfig/cast_config.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/BUILD.gn new file mode 100644 index 0000000..1a48c7b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.castremotecontrol") { + library_name = "castremotecontrol" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "remote_control.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.castremotecontrol", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/meta.json new file mode 100644 index 0000000..914f91f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.castremotecontrol", + "root": "fidl/fuchsia.castremotecontrol", + "sources": [ + "fidl/fuchsia.castremotecontrol/remote_control.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/remote_control.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/remote_control.fidl new file mode 100644 index 0000000..ce98c5f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castremotecontrol/remote_control.fidl
@@ -0,0 +1,22 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.castremotecontrol; + +// LaunchError enumerates the various ways in which launching a +// remote control app may fail. +enum LaunchError { + // The media session to control for the provided device could not be found. + NOT_FOUND = 1; + + // A non-recoverable internal error occurred. + INTERNAL = 2; +}; + +[Discoverable] +protocol Launcher { + /// Launches the Cast remote control application for the device + /// identified by |device_id|. + Launch(string:MAX device_id) -> () error LaunchError; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/BUILD.gn new file mode 100644 index 0000000..6d4c136 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.castsetup") { + library_name = "castsetup" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "cast_setup.fidl", + "server.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.castsetup", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/cast_setup.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/cast_setup.fidl new file mode 100644 index 0000000..6750d37 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/cast_setup.fidl
@@ -0,0 +1,28 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.castsetup; + +/// Interface that allows watching of changes to the cast setup state. +[Discoverable] +protocol StateWatcher { + /// Will immediately return on first call; subsequent calls will return on + /// change. + Watch() -> (State state); +}; + +/// Enum of different possible setup states +enum State { + /// State is not determined. + UNKNOWN = 0; + + /// Setup is not complete and is in progress. + IN_PROGRESS = 1; + + /// Configured once but disconnected for now. + OFFLINE = 2; + + /// Setup is complete and device is connected. + COMPLETE = 3; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/meta.json new file mode 100644 index 0000000..ce040a2 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/meta.json
@@ -0,0 +1,10 @@ +{ + "deps": [], + "name": "fuchsia.castsetup", + "root": "fidl/fuchsia.castsetup", + "sources": [ + "fidl/fuchsia.castsetup/cast_setup.fidl", + "fidl/fuchsia.castsetup/server.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/server.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/server.fidl new file mode 100644 index 0000000..25d059a --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsetup/server.fidl
@@ -0,0 +1,46 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/// For internal Google use only. +/// This API is not to be used within the Fuchsia tree. +library fuchsia.castsetup; + +/// Specifies the required security for a client of the API. +enum SecurityState : uint32 { + SECURITY_STATE_NONE = 0; + SECURITY_STATE_ENCRYPTED = 1; + SECURITY_STATE_TRUSTED = 2; +}; + +/// Registered API that handles an incoming request. +protocol ApiRequestHandler { + /// Called to handle a request to this setup API. The request `data` is JSON. + /// The response `data` must be JSON. + HandleRequest(string:MAX? data) -> (uint32 response_code, string:MAX? data); +}; + +/// API operation mode to specify during registration. +enum ApiMode : uint32 { + ACCEPTS_NO_DATA = 1; + ACCEPTS_DATA = 2; +}; + +/// Registry that hosts APIs on behalf of clients. +[Discoverable] +protocol ApiRegistry { + /// Registers an API that may accept incoming data. + /// + /// `path` identifies how to access the API. If multiple registrations occur with + /// the same path, then the last registration is bound, and the rest are unbound. + /// + /// `accepts_data` indicates whether this API should allow callers to provide + /// data in the form of a JSON string. + /// + /// `security_state` indicates what level of security the caller must + /// adhere to. + RegisterApi(string:1024 path, + ApiMode api_mode, + SecurityState security_state, + ApiRequestHandler api_handler); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/BUILD.gn new file mode 100644 index 0000000..facf37d --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.castsysteminfo") { + library_name = "castsysteminfo" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "cast_system_info.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.castsysteminfo", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/cast_system_info.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/cast_system_info.fidl new file mode 100644 index 0000000..0e57673 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/cast_system_info.fidl
@@ -0,0 +1,36 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.castsysteminfo; + +/// Error codes for the GetSystemInfo operation. +enum ErrorCode { + /// Error when there is no system info available. + ERR_NO_SYSTEM_INFO = 1; + /// Generic error. + ERR_INTERNAL = 2; +}; + +/// Cast-related device settings +/// +/// This table may be extended to include additional cast-specific information. +/// The values requested here are generated on first boot of the device and +/// don't change unless there is a factory reset. +table SystemInfo { + /// Local (CastV2) device ID. Identifies the device on a local network. + /// Used by the Home app as the device identifier and for MDNS record matching. + 1: string local_device_id; + /// The device will use this identifier to send/receive CloudCast commands. + /// Sending a CloudCast command to the receiver with this ID will ensure that + /// the command is accepted and consumed by the device. + 2: string cloud_device_id; +}; + +/// Exposes Cast system info, as modeled in the SystemInfo table. +[Discoverable] +protocol Provider { + /// Retrieves the SystemInfo fields that are generated at first boot and are + /// available at startup. + GetSystemInfo() -> (SystemInfo systemInfo) error ErrorCode; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/meta.json new file mode 100644 index 0000000..4f6c07a --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castsysteminfo/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.castsysteminfo", + "root": "fidl/fuchsia.castsysteminfo", + "sources": [ + "fidl/fuchsia.castsysteminfo/cast_system_info.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/BUILD.gn new file mode 100644 index 0000000..f7c9045 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.castwindow") { + library_name = "castwindow" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "window.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.castwindow", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/meta.json new file mode 100644 index 0000000..2f50edc --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.castwindow", + "root": "fidl/fuchsia.castwindow", + "sources": [ + "fidl/fuchsia.castwindow/window.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/window.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/window.fidl new file mode 100644 index 0000000..1fa5539 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.castwindow/window.fidl
@@ -0,0 +1,16 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.castwindow; + +enum Interaction : uint32 { + GO_BACK = 1; +}; + +/// Routes interaction requests to the application instance identified +/// by |session_id|. +[Discoverable] +protocol InteractionHandler { + SendInteraction(string:MAX session_id, Interaction interaction); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/BUILD.gn new file mode 100644 index 0000000..e00ac55 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.cobalt") { + library_name = "cobalt" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "cobalt.fidl", + "cobalt_controller.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.cobalt", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/cobalt.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/cobalt.fidl new file mode 100644 index 0000000..eb3d306 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/cobalt.fidl
@@ -0,0 +1,744 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/// Cobalt is the Fuchsia service used to log, collect and analyze metrics. +/// The two main pillars of Cobalt are protecting user privacy and providing +/// high-quality, aggregate metrics to serve system and component software +/// developers' needs. +/// +/// This file contains interfaces that allow clients to log Events to +/// Cobalt. +/// +/// To use Cobalt, you must have a Project and one or more Metrics registered +/// with the Cobalt registration system. You must also register one or more +/// Reports in order to see the results of your logging aggregated over +/// all Fuchsia devices. Registration of Projects, Metrics and Reports consists +/// of entries in the YAML files in this repo: +/// https:///cobalt-analytics.googlesource.com/config/. +/// In a Garnet checkout that is mapped to ///third_party/cobalt_config. +/// Each registered object has an integer ID and those IDs are used as +/// parameters in the methods in this file. +/// +/// While Cobalt's code and registration files are open source, the running +/// system being managed by the Cobalt team is currently intended to be used by +/// software engineers at Google in order to collect metrics in a way that +/// preserves our users' privacy. If you are a Google software engineer +/// please see our internal [user guide](go/fuchsia-cobalt-userguide) or +/// ask for assistance from the Cobalt [team](go/fuchsia-cobalt#comms). +/// +/// Usage: First use LoggerFactory to get a Logger for your +/// project. Then you log Events using the Log*() methods. +/// Events are accumulated by the cobalt FIDL service and periodically +/// Observations, derived from the logged Events, are sent to the Cobalt server, +/// where they are used to generate Reports. +library fuchsia.cobalt; + +/// The maximum size of a single Event is 100 KB. +const int64 MAX_BYTES_PER_EVENT = 102400; + +/// This is intended as a reasonable maximum number of histogram buckets per event. +const uint32 MAX_HISTOGRAM_BUCKETS = 500; + +/// Maximum number of Cobalt events that may be logged in a single +/// FIDL call. +const uint32 MAX_BATCHED_EVENTS = 500; + +/// Component strings should not be longer than this. +const uint32 MAX_COMPONENT_LENGTH = 64; + +/// Timer ids should not be longer than this. +const uint32 MAX_TIMER_ID_LENGTH = 64; + +/// String events should not be longer than this. +const uint32 MAX_STRING_EVENT_SIZE = 256; + +/// We only support up to 5 event_codes +const uint32 MAX_EVENT_CODE_COUNT = 5; + +/// In Cobalt 1.1 we support up to 10 event codes. +const uint32 MAX_METRIC_DIMENSIONS = 10; + +/// Channels should not be longer than this. +const uint32 MAX_CHANNEL_NAME_LENGTH = 256; + +/// Response codes for Logger operations. +enum Status : int32 { + OK = 0; + + /// For example the supplied metric id is invalid. + INVALID_ARGUMENTS = 1; + + /// An attempt was made to log an Event whose serialized size exceeds + /// MAX_BYTES_PER_EVENT. + EVENT_TOO_BIG = 2; + + /// Cobalt's local buffer is temporarily full and cannot handle any more + /// Events at this time. Try again later. This condition should be rare + BUFFER_FULL = 3; + + /// Catch-all for unexpected errors. + INTERNAL_ERROR = -1; +}; + +/// A specification of a Cobalt project. +/// +/// Note: This type is part of the Cobalt 1.1 interface which is still +/// in development. Do not use this yet. +table ProjectSpec { + /// The customer ID, as specified in Cobalt's metrics registry. + /// If omitted (i.e. set to 0) then it defaults to + /// the customer ID for the "fuchsia" customer. + 1: uint32 customer_id; + + /// The ID of the project, as specified in Cobalt's metrics registry. + 2: uint32 project_id; +}; + +/// Note: This protocol is part of the Cobalt 1.1 interface which is still +/// in development. Do not use this yet. +/// +[Discoverable] +protocol MetricEventLoggerFactory { + /// Create a MetricEventLogger for the project specified by `project_spec`. + CreateMetricEventLogger(ProjectSpec project_spec, + request<MetricEventLogger> logger) + -> (Status status); +}; + +/// LoggerFactory creates Loggers. +[Discoverable, Layout = "Simple"] +protocol LoggerFactory { + /// Creates a Logger for the project with the given ID, using the state of + /// the metrics registry that is bundled with Cobalt. The project must be in + /// the "fuchsia" customer. + /// + /// `project_id` The ID of the client's Cobalt project. + /// + /// `status` Returns OK on success or INVALID_ARGUMENTS if there is no + /// project with the given ID in the version of the metrics registry that + /// is bundled with Cobalt. + CreateLoggerFromProjectId(uint32 project_id, + request<Logger> logger) + -> (Status status); + + /// Creates a LoggerSimple for the project with the given ID, using the + /// state of the metrics registry that is bundled with Cobalt. The project + /// must be in the "fuchsia" customer. + /// + /// `project_id` The ID of the client's Cobalt project. + /// + /// `status` Returns OK on success or INVALID_ARGUMENTS if there is no + /// project with the given ID in the version of the metrics registry that + /// is bundled with Cobalt. + CreateLoggerSimpleFromProjectId(uint32 project_id, + request<LoggerSimple> logger) + -> (Status status); + + /// Creates a Logger for the project specified, using the state of the + /// metrics registry that is bundled with Cobalt. + /// + /// `customer_id` The ID of the client's Cobalt customer. + /// + /// `project_id` The ID of the client's Cobalt project. + /// + /// `status` Returns OK on success or INVALID_ARGUMENTS if there is no + /// project with the given IDs in the version of the metrics registry that + /// is bundled with Cobalt. + CreateLoggerFromProjectSpec(uint32 customer_id, uint32 project_id, + request<Logger> logger) + -> (Status status); +}; + +/// A vector of event codes. When used in one of the Log*() calls below, +/// there must be one event code for each dimension of the metric whose +/// metric_id is supplied, or else the call will return INVALID_ARGUMENTS. +/// Each event code is a key from the `event_codes` map of the corresponding +/// MetricDimension. +/// +/// This type is part of the Cobalt 1.1 interface which is still in development. +/// Do not use this yet. +using event_vector = vector<uint32>:MAX_METRIC_DIMENSIONS; + +/// A histogram that assigns a count to each of several integer ranges. +/// The order of the vector is immaterial. +using integer_histogram = vector<HistogramBucket>:MAX_HISTOGRAM_BUCKETS; + +/// Note: This protocol is part of the Cobalt 1.1 interface which is still +/// in development. Do not use this yet. +protocol MetricEventLogger { + /// Logs the fact that an event has occurred a number of times. + /// + /// `metric_id` ID of the metric being logged. It must be one of the metrics + /// declared in Cobalt's registry for the project associated with this + /// logger, and it must be of type OCCURRENCE. + /// + /// `count` The number of times the event has occurred. The value should + /// be positive as a value of 0 is ignored. + /// + /// `event_codes`. Enum parameters, one for each of the metric's + /// metric_dimensions. Cobalt aggregates occurrence counts based on this + /// parameter. + LogOccurrence(uint32 metric_id, uint64 count, event_vector event_codes) + -> (Status status); + + /// Logs an integer measurement. + /// + /// `metric_id` ID of the metric being logged. It must be one of the metrics + /// declared in Cobalt's registry for the project associated with this + /// logger, and it must be of type INTEGER. + /// + /// `value` The integer measurement. + /// + /// `event_codes`. Enum parameters, one for each of the metric's + /// metric_dimensions. Cobalt aggregates integer values that have + /// the same event_codes. + LogInteger(uint32 metric_id, int64 value, event_vector event_codes) + -> (Status status); + + /// Logs a histogram giving many approximate integer measurements. + /// + /// `metric_id` ID of the metric being logged. It must be one of the metrics + /// declared in Cobalt's registry for the project associated with this + /// logger, and it must be of type INTEGER_HISTOGRAM. + /// + /// `histogram` The collection of approximate integer measurements. + /// + /// `event_codes`. Enum parameters, one for each of the metric's + /// metric_dimensions. Cobalt aggregates histograms that have the same + /// event_codes. + LogIntegerHistogram(uint32 metric_id, integer_histogram histogram, + event_vector event_codes) + -> (Status status); + + /// Logs a string value that was observed. + /// + /// `metric_id` ID of the metric being logged. It must be one of the metrics + /// declared in Cobalt's registry for the project associated with this + /// logger, and it must be of type STRING. + /// + /// `string_value` The string to log. + /// + /// `event_codes`. Enum parameters, one for each of the metric's + /// metric_dimensions. Cobalt aggregates counts of logged strings separately + /// for each event_codes. + LogString(uint32 metric_id, string:MAX_STRING_EVENT_SIZE string_value, + event_vector event_codes) + -> (Status status); + + /// Bulk logging method, equivalent to making many of the above Log*() calls + /// at once. + LogMetricEvents(vector<MetricEvent>:MAX_BATCHED_EVENTS events) + -> (Status status); + + /// Logs a custom Event. + /// + /// `metric_id` ID of the metric being logged. It must be one of the metrics + /// declared in Cobalt's registry for the project associated with this + /// logger, and it must be of type CUSTOM. + /// + /// `event_values` The values for the custom Event. There must be one value + /// for each dimension of the Metric and the types of the values must + /// be consistent with the dimensions declared in the Metric definition. + LogCustomEvent(uint32 metric_id, vector<CustomEventValue>:MAX event_values) + -> (Status status); +}; + +/// A specification of an event that occurred to be passed to LogMetricEvents(). +/// +/// Note: This type is part of the Cobalt 1.1 interface which is still +/// in development. Do not use this yet. +struct MetricEvent { + /// ID of the metric being logged. It must be one of the metrics + /// declared in Cobalt's registry for the project associated with the + /// MetricEventLogger being used and its type must match the type of + /// `payload`. + uint32 metric_id; + + /// `event_codes`. Enum parameters corresponding to the metric's additional + /// dimensions. + event_vector event_codes; + + /// The metric-type-specific data for the event being logged. + MetricEventPayload payload; +}; + +/// The variadic part of a MetricEvent. +/// +/// Note: This type is part of the Cobalt 1.1 interface which is still +/// in development. Do not use this yet. +flexible union MetricEventPayload { + /// This should be used for metrics of type OCCURRENCE. See + /// MetricEventLogger::LogOcurrenceCount(). + 1: uint64 count; + + /// This should be used for metrics of type INTEGER. See + /// MetricEventLogger::LogInteger(). + 2: int64 integer_value; + + /// This payload type should be used for metrics of type + /// INTEGER_HISTOGRAM. See + /// MetricEventLogger::LogIntegerHistogram(). + 3: integer_histogram histogram; + + /// This payload type should be used for metrics of type STRING. + 4: string:MAX_STRING_EVENT_SIZE string_value; +}; + +///////////////////////////////////////////////////////////////////// + +// LoggerBase Interface +///////////////////////////////////////////////////////////////////// + +/// LoggerBase and its extensions are used to log Events to the Cobalt system. +/// The Cobalt FIDL service stores the Events locally for some period of time, +/// processes the Events to form Observations, and periodically uploads batches +/// of Observations to the Cobalt server. The Cobalt server processes the +/// Observations and generates Reports. See [TODO(rudominer)] for more +/// description of the Cobalt server and Reports. +/// +/// LoggerBase or one of its extensions is associated with a single Cobalt +/// project. +/// +/// This interface conforms to the Simple layout so that Simple bindings +/// may be generated for it. For the full interfaces, see Logger and LoggerSimple +/// below. +[Layout = "Simple"] +protocol LoggerBase { + /// Logs the fact that an event has occurred. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type EVENT_OCCURRED. + /// + /// `event_code` The index of the event that occurred. The indexed set of all + /// event codes and their labels is specified in the metric definition. + LogEvent(uint32 metric_id, uint32 event_code) + -> (Status status); + + /// Logs that an event has occurred a given number of times. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type EVENT_COUNT. + /// + /// `event_code` The index of the event that occurred. The indexed set of all + /// event codes and their labels is specified in the metric definition. + /// + /// `component` Optionally, a component associated with the event may also be + /// logged. Any notion of component that makes sense may be used or use the + /// empty string if there is no natural notion of component. + /// + /// `period_duration_micros` Optionally, the period of time over which the + /// `count` events occurred may be logged. If this is not relevant the value + /// may be set to 0. Otherwise specify the period duration as a number of + /// microseconds. + /// + /// `count` The number of times the event occurred. One may choose to always + /// set this value to 1 and always set + /// + /// `period_duration_micros` to 0 in order to achieve a semantics similar to + /// the LogEventOccurred() method, but with a `component`. + LogEventCount(uint32 metric_id, uint32 event_code, string:MAX_COMPONENT_LENGTH component, + int64 period_duration_micros, int64 count) + -> (Status status); + + /// Logs that an event lasted a given amount of time. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type ELAPSED_TIME. + /// + /// `event_code` The index of the event that occurred. The indexed set of all + /// event codes and their labels is specified in the metric definition. + /// + /// `component` Optionally, a component associated with the event may also be + /// logged. Any notion of component that makes sense may be used or use the + /// empty string if there is no natural notion of component. + /// + /// `elapsed_micros` The elapsed time of the event, specified as a number of + /// microseconds. + LogElapsedTime(uint32 metric_id, uint32 event_code, string:MAX_COMPONENT_LENGTH component, + int64 elapsed_micros) + -> (Status status); + + /// Logs a measured average frame rate. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type FRAME_RATE. + /// + /// `event_code` The index of the event that associated with the frame-rate + /// measurement. The indexed set of all event codes and their labels is + /// specified in the metric definition. + /// + /// `component` Optionally, a component associated with the frame-rate + /// measurement may also be logged. Any notion of component that makes sense + /// may be used or use the empty string if there is no natural notion of + /// component. + /// + /// `fps` The average-frame rate in frames-per-second. + LogFrameRate(uint32 metric_id, uint32 event_code, string:MAX_COMPONENT_LENGTH component, + float32 fps) + -> (Status status); + + /// Logs a measured memory usage. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type MEMORY_USAGE. + /// + /// `event_code` The index of the event type associated with the memory + /// usage. The indexed set of all event codes and their labels is specified + /// in the metric definition. + /// + /// `component` Optionally, a component associated with the memory usage may + /// also be logged. Any notion of component that makes sense may be used or + /// use the empty string if there is no natural notion of component. + /// + /// `bytes` The memory used, in bytes. + LogMemoryUsage(uint32 metric_id, uint32 event_code, string:MAX_COMPONENT_LENGTH component, + int64 bytes) + -> (Status status); + + /// This method is part of Cobalt's helper service for measuring the time + /// delta between two events that occur in different processes. This starts + /// the timer. A corresponding invocation of EndTimer() with the same + /// `timer_id` ends the timer. After both StartTimer() and EnvdTimer() have + /// been invoked, LogElapsedTime() will be invoked with the difference + /// between the end timestamp and the start timestamp as the value of + /// `duration_microseconds`. It is OK if Cobalt receives the EndTimer() + /// call before the StartTimer() call. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type ELAPSED_TIME. + /// + /// `event_code` The index of the event type to associate with the elapsed + /// time. This is passed to LogElapsedTime() + /// + /// `component` Optionally, a component associated with the event may also be + /// logged. See the description at LogElapsedTime(). + /// + /// `timer_id` The ID of the timer being started. This is an arbitrary + /// non-empty string provided by the caller and it is the caller's + /// responsibility to ensure that Cobalt receives a pair of StartTimer(), + /// EndTimer() calls with this id before the timeout and without any + /// intervening additional calls to StartTimer() or EndTimer() using the same + /// id. Once such a pair is received Cobalt will delete the timer with this + /// ID and after that the ID may be re-used. + /// + /// `timestamp` The timestamp to set as the start of the timer. The units + /// must be microseconds. The absolute value does not matter, only the + /// difference between the end and start timestamps will be used. + /// + /// `timeout_s` The number of seconds Cobalt should wait to receive the + /// corresponding EndTimer() call with the same `timer_id`. If Cobalt has + /// already received the corresponding EndTimer() call before receiving this + /// StartTimer() call then this value is ignored as the timeout has already + /// been set by the EndTimer() call. If Cobalt does not receive the + /// corresponding EndTimer() call before the timeout then the timer will be + /// deleted and this invocation of StartTimer() will be forgotten. Must be a + /// positive value less than 300. + /// + /// `status` Returns OK on success. There are two success cases: + /// (i) Cobalt does not currently have any timers with the given + /// timer_id. In that case this call creates a new timer with + /// the given ID and start timestamp. + /// (ii) Cobalt currently has a timer with the given timer_id for + /// which it has received exactly one EndTimer() call and no + /// StartTimer() calls. In this case Cobalt will delete the + /// timer and invoke LogElapsedTime() using the difference + /// between the end timestamp and the start timestamp as the + /// value of `duration_micros`. It is ok if this value is + /// negative. + /// Returns INVALID_ARGUMENTS if `timer_id` is empty, the timeout + /// is not positive and less than 5 minutes or Cobalt currently + /// has a timer with the given timer_ID and it already has a start + /// timestamp. In the last case Cobalt will delete the timer with + /// the given `timer_id` and this invocation of StartTimer() + /// will be forgotten. + /// Any error returned by LogElapsedTime() may also be returned by this + /// method. + StartTimer(uint32 metric_id, uint32 event_code, string:MAX_COMPONENT_LENGTH component, + string:MAX_TIMER_ID_LENGTH timer_id, uint64 timestamp, uint32 timeout_s) + -> (Status status); + + /// This method is part of Cobalt's helper service for measuring the time + /// delta between two events that occur in different processes. This ends + /// the timer. A corresponding invocation of StartTimer() with the same + /// `timer_id` starts the timer. After both StartTimer() and EndTimer() have + /// been invoked, LogElapsedTime() will be invoked with the difference + /// between the end timestamp and the start timestamp as the value of + /// `duration_microseconds`. It is OK if Cobalt receives the EndTimer() + /// call before the StartTimer() call. + /// + /// `timer_id` The ID of the timer being ended. This is an arbitrary + /// non-empty string provided by the caller and it is the caller's + /// responsibility to ensure that Cobalt receives a pair of StartTimer(), + /// EndTimer() calls with this id before the timeout and without any + /// intervening additional calls to StartTimer() or EndTimer() using the same + /// id. Once such a pair is received Cobalt will delete the timer with this + /// ID and after that the ID may be re-used. + /// + /// `timestamp` The timestamp to set as the end of the timer. The units must + /// be microseconds. The absolute value does not matter, only the difference + /// between the end and start timestamps will be used. + /// + /// `timeout_s` The number of seconds Cobalt should wait to receive the + /// corresponding EndTimer() call with the same `timer_id`. If Cobalt has + /// already received the corresponding EndTimer() call before receiving this + /// StartTimer() call then this value is ignored as the timeout has already + /// been set by the EndTimer() call. If Cobalt does not receive the + /// corresponding EndTimer() call before the timeout then the timer will be + /// deleted and this invocation of StartTimer() will be forgotten. Must be a + /// positive value less than 300. + /// + /// `status` Returns OK on success. There are two success cases: + /// (i) Cobalt does not currently have any timers with the given + /// timer_id. In that case this call creates a new timer with + /// the given ID and end timestamp. + /// (ii) Cobalt currently has a timer with the given timer_id for + /// which it has received exactly one StartTimer() call and no + /// EndTimer() calls. In this case Cobalt will delete the + /// timer and invoke LogElapsedTime() using the difference + /// between the end timestamp and the start timestamp as the + /// value of `duration_micros`. It is ok if this value is + /// negative. + /// Returns INVALID_ARGUMENTS if `timer_id` is empty, the timeout + /// is not positive and less than 5 minutes or Cobalt currently + /// has a timer with the given timer_ID and it already has an end + /// timestamp. In the last case Cobalt will delete the timer with + /// the given `timer_id` and this invocation of EndTimer() + /// will be forgotten. + /// Any error returned by LogElapsedTime() may also be returned by this + /// method. + EndTimer(string:MAX_TIMER_ID_LENGTH timer_id, uint64 timestamp, uint32 timeout_s) + -> (Status status); + + // Method ordinals >= 100 are reserved for sub-interfaces. +}; + +///////////////////////////////////////////////////////////////////// + +// Logger Interface +///////////////////////////////////////////////////////////////////// + +/// A value for a custom Event. This is used by the method LogCustomEvent(). +struct CustomEventValue { + /// The name of the Metric dimension this value is for. + string:MAX dimension_name; + + /// The value for that dimension. + Value value; +}; + +/// A value that may be a string, int, double, or index. +union Value { + 1: string:MAX string_value; + 2: int64 int_value; + 3: float64 double_value; + 4: uint32 index_value; +}; + +/// One bucket of histogram. This is used by the methods LogIntHistogram() from +/// Cobalt 1.0 and LogIntegerHistogram from Cobalt 1.1. +struct HistogramBucket { + /// The index of the bucket. The MetricDefinition includes a specification + /// of a sequence of N+1 integer-range buckets that are indexed from + /// 0, the underflow bucket, to N, the overflow bucket. + uint32 index; + + /// The number of values in that bucket. + uint64 count; +}; + +/// Used to log that an event has occurred a given number of times. Using this +/// struct with LogCobaltEvent() is equivalent to invoking LogEventCount(). +struct CountEvent { + /// The number of microseconds over which this count was observed. + int64 period_duration_micros; + + /// The number of times the event occurred + int64 count; +}; + +/// Used to log an event that has no extra fields. Using this struct with +/// LogCobaltEvent() is equivalent to invoking LogEvent(). +struct Event { +}; + +/// The variadic part of a CobaltEvent. +union EventPayload { + /// This maps to a call to LogEvent(). + 1: Event event; + + /// This maps to a call to LogEventCount(). + 2: CountEvent event_count; + + /// This maps to a call to LogElapsedTime(). + 3: int64 elapsed_micros; + + /// This maps to a call to LogFrameRate(). + 4: float32 fps; + + /// This maps to a call to LogMemoryUsage(). + 5: int64 memory_bytes_used; + + // Previously mapped to a call to LogString() (deprecated). + 6: reserved; + + /// This maps to a call to LogIntHistogram(). + 7: vector<HistogramBucket>:MAX_HISTOGRAM_BUCKETS int_histogram; +}; + +/// A specification of an event that occurred to be passed to LogCobaltEvent(). +/// This is part of an alternative API to cobalt that uses a single method with a +/// variadic parameter instead of the multiple methods above. This technique +/// allows multiple event codes to be passed whereas the methods above support +/// only a single event code. +struct CobaltEvent { + /// ID of the metric to use. It must be one of the Metrics from the + /// ProjectProfile used to obtain this Logger, and its type must match the + /// `payload` type. + uint32 metric_id; + + /// The event codes for the event that occurred. There must be one event code + /// given for each dimension specified in the metric definition. + vector<uint32>:MAX_EVENT_CODE_COUNT event_codes; + + /// Optionally, a component associated with the event that occurred may also + /// be logged also be logged. Any notion of component that makes sense may be + /// used or use the empty string if there is no natural notion of component. + string:MAX_COMPONENT_LENGTH? component; + + /// The event-specific information for the event to be logged. + EventPayload payload; +}; + +/// Logger is an extension of the LoggerBase interface that adds some additional +/// methods that do not naturally conform to the Simple layout. We opt for +/// a natural easy-to-understand interface at the cost of not being "Simple". +/// See the interface LoggerSimple below for versions of some of these methods +/// that do conform to the Simple layout. +protocol Logger { + compose LoggerBase; + + /// Logs a histogram over a set of integer buckets. The meaning of the + /// Metric and the buckets is specified in the Metric definition. + /// + /// This method is intended to be used in situations where the client + /// wishes to aggregate a large number of integer-valued measurements + /// *in-process*, prior to submitting the data to Cobalt. + /// One reason a client may wish to do this is that the measurements occur + /// with very high frequency and it is not practical to make a FIDL call + /// for each individual measurement. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type INT_HISTOGRAM. + /// + /// `event_code` The index of the event type associated with the + /// integer-valued measurement. The indexed set of all event codes and their + /// labels is specified in the metric definition. + /// + /// `component` Optionally, a component associated with integer-valued + /// measurements may also be logged. Any notion of component that makes sense + /// may be used or use the empty string if there is no natural notion of + /// component. + /// + /// `histogram` The histogram to log. Each HistogramBucket gives the count + /// for one bucket of the histogram. The definitions of the buckets is given + /// in the Metric definition. + LogIntHistogram(uint32 metric_id, uint32 event_code, + string:MAX_COMPONENT_LENGTH component, vector<HistogramBucket>:MAX_HISTOGRAM_BUCKETS histogram) + -> (Status status); + + /// Logs a custom Event. The semantics of the Metric are specified in the + /// Metric definition. + /// + /// `metric_id` ID of the metric to use. It must be one of the Metrics + /// from the ProjectProfile used to obtain this Logger, and it must be of + /// type CUSTOM. + /// + /// `event_values` The values for the custom Event. There is one value for + /// each dimension of the Metric. The number and types of the values must + /// be consistent with the dimensions declared in the Metric definition. + LogCustomEvent(uint32 metric_id, vector<CustomEventValue>:MAX event_values) + -> (Status status); + + /// Logs a CobaltEvent. This method offers an alternative API to Cobalt that + /// uses a single method with a variadic parameter instead of the multiple + /// methods defined above. The reason to use this method is that a + /// CobaltEvent allows multiple event codes to be specified whereas the + /// methods above allow only a single event code. + LogCobaltEvent(CobaltEvent event) -> (Status status); + + /// Logs a list of CobaltEvents. This method is equivalent to invoking + /// LogCobaltEvent() multiple times but is more efficient as it requires only + /// a single FIDL call. + LogCobaltEvents(vector<CobaltEvent>:MAX_BATCHED_EVENTS events) -> (Status status); +}; + +///////////////////////////////////////////////////////////////////// + +// LoggerSimple Interface +///////////////////////////////////////////////////////////////////// + +/// LoggerSimple is an extension of the LoggerBase interface that adds some +/// additional methods intended to be used by lower-levels of the Fuchsia system. +/// +/// This interface conforms to the Simple layout so that Simple bindings +/// may be generated for it. +[Layout = "Simple"] +protocol LoggerSimple { + compose LoggerBase; + + /// Logs a histogram over a set of integer buckets. The meaning of the + /// Metric and the buckets is specified in the Metric definition. + /// + /// See the method LogIntHistogram() in the Logger interface for more + /// information. This method is similar except that it adheres to the + /// requirements of Simple layout. Instead of a vector of HistogramBucekts + /// this version takes two parallel vectors of bucket indices and the + /// corresponding bucket counts. + LogIntHistogram(uint32 metric_id, uint32 event_code, + string:MAX_COMPONENT_LENGTH component, + vector<uint32>:MAX_HISTOGRAM_BUCKETS bucket_indices, + vector<uint64>:MAX_HISTOGRAM_BUCKETS bucket_counts) + -> (Status status); +}; + +///////////////////////////////////////////////////////////////////// + +// SystemProfileUpdater Interface +///////////////////////////////////////////////////////////////////// + +/// The state of a single experiment on a device or binary. +struct Experiment { + /// The id of the experiment as defined by the A/B Experiment framework. + uint64 experiment_id; + /// The id of the experiment arm as defined by the A/B Experiment framework. + uint32 arm_id; +}; + +/// The SystemDataUpdater interface allows callers to update the state of +/// the System Data in Cobalt. This includes the SystemProfile and experiment +/// state. The changes are global and affect all loggers running on the device. +[Discoverable] +protocol SystemDataUpdater { + /// Resets Cobalt's view of the system-wide experiment state and replaces it + /// with the given values. + /// + /// `experiments` All experiments the device has a notion of and the arms + /// the device belongs to for each of them. These are the only experiments + /// the device can collect data for. + SetExperimentState(vector<Experiment>:MAX experiments) + -> (Status status); + + /// Sets Cobalt's view of the system-wide channel replacing the existing values. + /// + /// `current_channel` The channel that the device last used as an update source. This value may + /// be empty to indicate that the device is not currently associated with any channel. + SetChannel(string:MAX_CHANNEL_NAME_LENGTH current_channel) -> (Status status); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/cobalt_controller.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/cobalt_controller.fidl new file mode 100644 index 0000000..f6bc40f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/cobalt_controller.fidl
@@ -0,0 +1,54 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.cobalt; + +/// The Controller is primarily useful for testing the Cobalt service. +/// Cobalt clients should use the Logger. +[Discoverable] +protocol Controller { + /// Requests that the collection of Observations that are currently cached + /// locally be sent to the Cobalt server soon. Cobalt will send the + /// Observations in one or more batches and will retry several times upon + /// failure. The response occurs only after that procedure is completed. A + /// return value of true indicates that all Observations were successfully + /// sent. A return value of false indicates otherwise. + RequestSendSoon() -> (bool success); + + /// The Cobalt FIDL service will block, not processing any further FIDL + /// requests or responses, on either this interface or the Logger interface, + /// until either `max_wait_seconds` have elapsed or the Cobalt service's + /// worker thread has successfully sent all previously added Observations to + /// the Shuffler. The response will be returned after the blocking period has + /// ended. Note that this method does not request an expedited send and so it + /// is possible that the worker thread is currently waiting for the next + /// scheduled send time and so the empty state will not be achieved prior + /// that time. + BlockUntilEmpty(uint32 max_wait_seconds) -> (); + + /// These diagnostic stats are mostly useful in a testing environment but + /// may possibly prove useful in production also. + GetNumSendAttempts() -> (uint32 num); + GetFailedSendAttempts() -> (uint32 num); + GetNumObservationsAdded() -> (uint64 num_obs); + GetNumEventAggregatorRuns() -> (uint64 num_runs); + + /// Triggers Cobalt to generate Observations based on locally aggregated + /// event data and write them to the local ObservationStore. In a non-test + /// environment this would normally be done periodically by a background + /// thread. In a test environment this method should be invoked against an + /// instance of the Cobalt FIDL service that was passed the flag + /// --start_event_aggregator_worker=false. + /// + /// `day_index` The index of the day for which locally aggregated + /// Observations should be generated. + /// + /// `report_ids` A vector of report IDs. + /// + /// Returns a vector whose k-th element is the number of observations + /// generated for the k-th element of `report_ids`. If `report_ids` + /// is the empty vector, then an empty vector is returned. + GenerateAggregatedObservations(uint32 day_index, vector<uint32>:MAX report_ids) + -> (vector<uint64>:MAX num_obs); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/meta.json new file mode 100644 index 0000000..8c57f6e --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.cobalt/meta.json
@@ -0,0 +1,10 @@ +{ + "deps": [], + "name": "fuchsia.cobalt", + "root": "fidl/fuchsia.cobalt", + "sources": [ + "fidl/fuchsia.cobalt/cobalt.fidl", + "fidl/fuchsia.cobalt/cobalt_controller.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/BUILD.gn new file mode 100644 index 0000000..bfef985 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.component.runner") { + library_name = "runner" + namespace = "fuchsia.component" + public_deps = [ + "../fuchsia.component", + "../fuchsia.data", + "../fuchsia.io", + "../fuchsia.url", + ] + sources = [ + "component_runner.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.component.runner", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/component_runner.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/component_runner.fidl new file mode 100644 index 0000000..4e37805 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/component_runner.fidl
@@ -0,0 +1,164 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.component.runner; + +using fuchsia.data; +using fuchsia.io; +using fuchsia.component; +using fuchsia.url; + +const uint32 MAX_NAMESPACE_COUNT = 32; + +/// A protocol used for running components. +/// +/// This protocol is implemented by components which provide a runtime +/// environment for other components. +/// +/// Note: The component manager is the only intended direct client of this +/// interface. +[Discoverable] +protocol ComponentRunner { + /// Start running a component instance described by `start_info`. + /// + /// Component manager binds and uses `controller` to control the + /// lifetime of the newly started component instance. + /// + /// Errors are delivered as epitaphs over the `ComponentController` + /// protocol. In the event of an error, the runner must ensure that + /// resources are cleaned up. + /// + /// Errors: + /// + Start(ComponentStartInfo start_info, + request<ComponentController> controller); +}; + +/// A single component namespace entry, which describes a namespace mount point +/// (`path`) and the directory backing it (`directory`). This type is usually +/// composed inside a vector. See `ComponentStartInfo.ns` for more details. +table ComponentNamespaceEntry { + /// The mount point for the directory, including a + /// leading slash. For example: "/pkg", "/svc", or "/config/data". + 1: string:fuchsia.component.MAX_PATH_LENGTH path; + + /// The directory mounted at the above `path`. + 2: fuchsia.io.Directory directory; +}; + +/// Parameters for starting a new component instance. +table ComponentStartInfo { + /// The resolved URL of the component. + /// + /// This is the canonical URL obtained by the component resolver after + /// following redirects and resolving relative paths. + 1: fuchsia.url.Url resolved_url; + + /// The component's program declaration. + /// This information originates from `ComponentDecl.program`. + 2: fuchsia.data.Dictionary program; + + /// The namespace to provide to the component instance. + /// + /// A namespace specifies the set of directories that a component instance + /// receives at start-up. Through the namespace directories, a component + /// may access capabilities available to it. The contents of the namespace + /// are mainly determined by the component's `use` declarations but may + /// also contain additional capabilities automatically provided by the + /// framework. + /// + /// By convention, a component's namespace typically contains some or all + /// of the following directories: + /// + /// - "/svc": A directory containing services that the component requested + /// to use via its "import" declarations. + /// - "/pkg": A directory containing the component's package, including its + /// binaries, libraries, and other assets. + /// + /// The mount points specified in each entry must be unique and + /// non-overlapping. For example, [{"/foo", ..}, {"/foo/bar", ..}] is + /// invalid. + 3: vector<ComponentNamespaceEntry>:MAX_NAMESPACE_COUNT ns; + + /// The directory this component serves. + 4: request<fuchsia.io.Directory> outgoing_dir; + + /// The directory served by the runner to present runtime information about + /// the component. + 5: request<fuchsia.io.Directory> runtime_dir; +}; + +/// A protocol for binding and controlling the lifetime of a component instance +/// started using `ComponentRunner.Start()`. The component manager is the +/// intended direct client of this protocol. +/// +/// When the controlled component instance terminates or becomes inaccessible +/// for any reason, the server closes the connection with an epitaph. +/// +/// LIFECYCLE +/// +/// A component may exist in one of two states: `Started`, or `Stopped`. The +/// component is `Started` from the time `ComponentRunner.Start()` is called +/// until the ComponentRunner closes the ComponentController handle. The +/// component then transitions to `Stopped`. +/// +/// Component manager uses ComponentController to terminate a component in two +/// steps: +/// 1) Component manager calls `Stop()` to indicate that the ComponentRunner +/// should stop a component's execution and close this connection with an +/// epitaph. +/// 2) If after some time the ComponentController is not closed, component +/// manager calls `Kill()` to indicate that the ComponentRunner must halt a +/// component's execution immediately, and then close this connection with +/// an epitaph. +/// +/// Component manager first waits for the ComponentController to close, and +/// then tears down the namespace it hosts for the stopped component. Component +/// manager may call `Kill()` without first having called `Stop()`. +/// +/// EPITAPH +/// +/// This protocol sends a FIDL epitaph to indicate that the component instance +/// has been terminated. The component runner is expected to clean up all +/// resources attributed to the component before closing the connection. +/// +/// The following epitaphs may be sent by the server on error: +/// - `INVALID_ARGUMENTS`: +/// * `start_info.resolved_url` is not supported by this +/// runner; +/// * `start_info` contains missing or invalid arguments. +/// - `INSTANCE_CANNOT_START`: The runner could not start the component. +/// For example, a critical part of the program could not be found or +/// loaded, or the referenced binary was invalid for this runner. +/// - `RESOURCE_UNAVAILABLE`: The component could not be launched due to +/// lack of resources. +/// - `INTERNAL`: An unexpected internal runner error was encountered. +/// - `INSTANCE_DIED`: The component instance was started but +/// subsequently terminated unexpectedly. +/// - `ZX_OK`: The component instance was successfully terminated without +/// error. +/// - Other status codes (e.g. `ZX_ERR_PEER_CLOSED`) may indicate a failure +/// of the component runner itself. The component manager may respond to such +/// failures by terminating the component runner's job to ensure system +/// stability. +protocol ComponentController { + /// Request to stop the component instance. + /// + /// After stopping the component instance, the server should close this + /// connection with an epitaph. After the connection + /// closes, component manager considers this component instance to be + /// Stopped and the component's namespace will be torn down. + Stop(); + + /// Stop this component instance immediately. + /// + /// The ComponentRunner must immediately kill the component instance, and + /// then close this connection with an epitaph. After the connection + /// closes, component manager considers this component instance to be + /// Stopped and the component's namespace will be torn down. + /// + /// In some cases Kill() may be issued before Stop(), but that is not + /// guaranteed. + Kill(); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/meta.json new file mode 100644 index 0000000..378ca8a --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component.runner/meta.json
@@ -0,0 +1,14 @@ +{ + "deps": [ + "fuchsia.component", + "fuchsia.data", + "fuchsia.url", + "fuchsia.io" + ], + "name": "fuchsia.component.runner", + "root": "fidl/fuchsia.component.runner", + "sources": [ + "fidl/fuchsia.component.runner/component_runner.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.component/BUILD.gn new file mode 100644 index 0000000..0a7f68b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.component") { + library_name = "component" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "constants.fidl", + "error.fidl", + "types.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.component", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component/constants.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.component/constants.fidl new file mode 100644 index 0000000..a84575d --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component/constants.fidl
@@ -0,0 +1,17 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.component; + +const uint32 MAX_FACET_NAME_LENGTH = 100; +const uint32 MAX_CHILD_NAME_LENGTH = 100; +const uint32 MAX_COLLECTION_NAME_LENGTH = 100; +const uint32 MAX_RESOLVER_NAME_LENGTH = 100; +const uint32 MAX_RUNNER_NAME_LENGTH = 100; +const uint32 MAX_STORAGE_NAME_LENGTH = 100; +const uint32 MAX_EVENT_NAME_LENGTH = 100; +const uint32 MAX_ENVIRONMENT_NAME_LENGTH = 100; +const uint32 MAX_PATH_LENGTH = 1024; +const uint32 MAX_MONIKER_LENGTH = 4096; +const uint32 MAX_URL_SCHEME_LENGTH = 100;
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component/error.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.component/error.fidl new file mode 100644 index 0000000..3a458f0 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component/error.fidl
@@ -0,0 +1,30 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.component; + +/// Standard error codes for component framework protocols. +enum Error { + /// Component manager encountered an otherwise unspecified error while + /// performing the operation. + INTERNAL = 1; + /// At least one argument had an invalid format. + INVALID_ARGUMENTS = 2; + /// The feature is not yet supported. + UNSUPPORTED = 3; + /// The component instance was not found. + INSTANCE_NOT_FOUND = 4; + /// The component instance already exists. + INSTANCE_ALREADY_EXISTS = 5; + /// The component instance could not be started. + INSTANCE_CANNOT_START = 6; + /// Failed to resolve the component's declaration. + INSTANCE_CANNOT_RESOLVE = 7; + /// The component collection was not found. + COLLECTION_NOT_FOUND = 8; + /// There was insufficient resources to perform the operation. + RESOURCE_UNAVAILABLE = 9; + /// The component instance died unexpectedly. + INSTANCE_DIED = 10; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.component/meta.json new file mode 100644 index 0000000..d3034b1 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component/meta.json
@@ -0,0 +1,11 @@ +{ + "deps": [], + "name": "fuchsia.component", + "root": "fidl/fuchsia.component", + "sources": [ + "fidl/fuchsia.component/constants.fidl", + "fidl/fuchsia.component/error.fidl", + "fidl/fuchsia.component/types.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.component/types.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.component/types.fidl new file mode 100644 index 0000000..2547c58 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.component/types.fidl
@@ -0,0 +1,13 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.component; + +using child_name = string:MAX_CHILD_NAME_LENGTH; +using collection_name = string:MAX_COLLECTION_NAME_LENGTH; +using environment_name = string:MAX_ENVIRONMENT_NAME_LENGTH; +using event_name = string:MAX_EVENT_NAME_LENGTH; +using resolver_name = string:MAX_RESOLVER_NAME_LENGTH; +using runner_name = string:MAX_RUNNER_NAME_LENGTH; +using url_scheme = string:MAX_URL_SCHEME_LENGTH;
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.data/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.data/BUILD.gn new file mode 100644 index 0000000..bddbf14 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.data/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.data") { + library_name = "data" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "data.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.data", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.data/data.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.data/data.fidl new file mode 100644 index 0000000..78c91d4 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.data/data.fidl
@@ -0,0 +1,35 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.data; + +// Maximum number of items in a dictionary's value. +const uint32 MAX_NUM_VALUE_ITEMS = 1024; +const uint32 MAX_NUM_ENTRIES = 1024; +const uint32 MAX_KEY_LENGTH = 1024; +const uint32 MAX_VALUE_LENGTH = 1024; + +/// A dictionary is a sequence of key/value pairs. +/// Keys must be unique and sorted in lexicographically increasing order. +table Dictionary { + // A list of dictionary entries, where each entry is a (key, value) pair. + // + // Required. + 1: vector<DictionaryEntry>:MAX_NUM_ENTRIES entries; +}; + +/// A key/value pair in a `Dictionary`. +struct DictionaryEntry { + // The key for a dictionary entry. + string:MAX_KEY_LENGTH key; + + // The value associated with the `key`. + DictionaryValue? value; +}; + +/// A dictionary's value is a string, or a list of strings. +union DictionaryValue { + 1: string:MAX_VALUE_LENGTH str; + 2: vector<string:MAX_VALUE_LENGTH>:MAX_NUM_VALUE_ITEMS str_vec; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.data/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.data/meta.json new file mode 100644 index 0000000..a025320 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.data/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.data", + "root": "fidl/fuchsia.data", + "sources": [ + "fidl/fuchsia.data/data.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/BUILD.gn new file mode 100644 index 0000000..19f6b60 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.deprecatedtimezone") { + library_name = "deprecatedtimezone" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "deprecated_time_service.fidl", + "deprecated_time_zone.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.deprecatedtimezone", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/deprecated_time_service.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/deprecated_time_service.fidl new file mode 100644 index 0000000..f1da6ea --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/deprecated_time_service.fidl
@@ -0,0 +1,14 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.deprecatedtimezone; + +/// Interface to allow manual updates of the system time. +[Discoverable] +protocol TimeService { + + /// Requests an immediate update of the time from network. + Update(uint8 num_retries) + -> (bool successful); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/deprecated_time_zone.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/deprecated_time_zone.fidl new file mode 100644 index 0000000..29d86bb --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/deprecated_time_zone.fidl
@@ -0,0 +1,38 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.deprecatedtimezone; + +// NOTE: this FIDL protocol is deprecated and slated for removal. Please do +// not add new uses that depend on it. Use instead the following functionality: +// +// - For `GetTimezoneOffsetMinutes` and `GetTimezoneId`, get the timezone name +// from `fuchsia.intl.ProfileProvider`, and use the ICU library to compute +// the offset. +// - For `SetTimezone` and `Watch`, please use `fuchsia.settings.Intl`. +// +// For more information on the ICU timezone ID format, see: +// http://userguide.icu-project.org/datetime +[Discoverable] +protocol Timezone { + /// Returns local timezone offset (in minutes from UTC. Can be negative) for + /// the supplied number of milliseconds since the Unix epoch. Returns a + /// non-zero DST offset when appropriate. + GetTimezoneOffsetMinutes(int64 milliseconds_since_epoch) + -> (int32 local_offset_minutes, int32 dst_offset_minutes); + + /// Sets the timezone for the machine based on an ICU ID. + SetTimezone(string timezone_id) -> (bool status); + + /// Gets the timezone ID string. + GetTimezoneId() -> (string timezone_id); + + /// Watches for updates to the timezone ID. + Watch(TimezoneWatcher watcher); +}; + +protocol TimezoneWatcher { + /// When the timezone changes, returns the new timezone ID. + OnTimezoneOffsetChange(string timezone_id); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/meta.json new file mode 100644 index 0000000..01d147b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.deprecatedtimezone/meta.json
@@ -0,0 +1,10 @@ +{ + "deps": [], + "name": "fuchsia.deprecatedtimezone", + "root": "fidl/fuchsia.deprecatedtimezone", + "sources": [ + "fidl/fuchsia.deprecatedtimezone/deprecated_time_service.fidl", + "fidl/fuchsia.deprecatedtimezone/deprecated_time_zone.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/BUILD.gn new file mode 100644 index 0000000..416183e --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.developer.tiles") { + library_name = "tiles" + namespace = "fuchsia.developer" + public_deps = [ + "../fuchsia.ui.app", + "../fuchsia.ui.gfx", + ] + sources = [ + "tiles.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.developer.tiles", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/meta.json new file mode 100644 index 0000000..27daf1d --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/meta.json
@@ -0,0 +1,12 @@ +{ + "deps": [ + "fuchsia.ui.app", + "fuchsia.ui.gfx" + ], + "name": "fuchsia.developer.tiles", + "root": "fidl/fuchsia.developer.tiles", + "sources": [ + "fidl/fuchsia.developer.tiles/tiles.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/tiles.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/tiles.fidl new file mode 100644 index 0000000..95b32f8 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.developer.tiles/tiles.fidl
@@ -0,0 +1,28 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.developer.tiles; + +using fuchsia.ui.app; +using fuchsia.ui.gfx; + +[Discoverable] +protocol Controller { + /// Instantiates a component by its URL and adds a tile backed by that component's ViewProvider. + /// Returns a key for the tile that can be used for resizing or removing the tile, or 0 on failure. + AddTileFromURL(string url, bool allow_focus, vector<string>? args) -> (uint32 key); + + /// Adds a tile backed by a view from the view provider. + /// Returns a key for the tile that can be used for resizing or removing the tile, or 0 on failure. + AddTileFromViewProvider(string url, fuchsia.ui.app.ViewProvider provider) -> (uint32 key); + + /// Removes the tile with the given key. + RemoveTile(uint32 key); + + /// Returns a list of tiles. + ListTiles() -> (vector<uint32> keys, vector<string> urls, vector<fuchsia.ui.gfx.vec3> sizes, vector<bool> focusabilities); + + /// Asks the tiles component to quit. + Quit(); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/BUILD.gn new file mode 100644 index 0000000..08ab7d8 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/BUILD.gn
@@ -0,0 +1,28 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.diagnostics") { + library_name = "diagnostics" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.mem", + ] + sources = [ + "format.fidl", + "reader.fidl", + "selector.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.diagnostics", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/format.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/format.fidl new file mode 100644 index 0000000..73ff1ca --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/format.fidl
@@ -0,0 +1,15 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.diagnostics; + +/// Enum used to specify the output format for +/// Reader results. +enum Format { + /// Dump read results per the Diagnostics Json + /// Schema specifications. + JSON = 1; + /// Dump read results per the Iquery text specifications. + TEXT = 2; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/meta.json new file mode 100644 index 0000000..5be730f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/meta.json
@@ -0,0 +1,13 @@ +{ + "deps": [ + "fuchsia.mem" + ], + "name": "fuchsia.diagnostics", + "root": "fidl/fuchsia.diagnostics", + "sources": [ + "fidl/fuchsia.diagnostics/format.fidl", + "fidl/fuchsia.diagnostics/reader.fidl", + "fidl/fuchsia.diagnostics/selector.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/reader.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/reader.fidl new file mode 100644 index 0000000..01c349b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/reader.fidl
@@ -0,0 +1,159 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.diagnostics; + +using fuchsia.mem; + +/// The size bound of 1024 is a reasonably low size restriction that meets most +/// canonical selectors we've ecountered. +const uint16 MAXIMUM_RAW_SELECTOR_LENGTH = 1024; + +/// The size 64 was chosen because entries in batches are handles to +/// VMOs and there is a limit of 64 handles per fidl message. +const uint16 MAXIMUM_ENTRIES_PER_BATCH = 64; + +/// Enum describing the potential failure states of the streaming protocol when serving results +/// to the client over the result iterator. +enum ReaderError { + // An IO error suggests that parsing of data hierarchy VMOs or writing of formatted data to + // sockets has failed. + IO = 1; +}; + +/// Argument used for Archive selectors, can be either the pre-parsed +/// fidl struct or string representation. +flexible union SelectorArgument { + /// A Selector defining a pattern-matcher which selects for components within a hierarchy + /// and properties in a data hierarchy namespaced by component. + 1: Selector structured_selector; + + /// A raw string representing a [fuchsia.diagnostics/Selector]. + /// The Selector defines a pattern-matcher which selects for components within a hierarchy + /// and properties in a data hierarchy namespaced by component. + /// NOTE: All StringSelectors parsed from the raw_selector will be interperetted in + /// string_pattern mode, giving significance to special characters. + /// TODO(4601): Link to in-tree documentation for raw selector strings. + 2: string:MAXIMUM_RAW_SELECTOR_LENGTH raw_selector; +}; + +/// A fidl union containing a complete hierarchy of structured diagnostics +/// data, such that the content can be parsed into a file by itself. +flexible union FormattedContent { + /// A diagnostics schema encoded as json. + /// The VMO will contain up to 1mb of diagnostics data. + 1: fuchsia.mem.Buffer json; + + /// A diagnostics schema encoded as text. + /// The VMO will contain up to 1mb of diagnostics data. + 2: fuchsia.mem.Buffer text; +}; + +/// Enum specifying the modes by which a user can connect to and stream diagnostics metrics. +enum StreamMode : uint8 { + /// The stream will serve a snapshot of the diagnostics data at the time of + /// connection, then end. + SNAPSHOT = 1; + /// The stream will serve a snapshot of the diagnostics data at the time of + /// connection, then subsequent calls to the stream will hang until + /// new diagnostics data is available. + SNAPSHOT_THEN_SUBSCRIBE = 2; + /// Calls to the stream will hang until new diagnostics data is available. Between calls to + /// the stream, newly arrived data is buffered. + SUBSCRIBE = 3; +}; + +// Enum specifying the data types available through the diagnostics platform. +enum DataType : uint8 { + /// Complete inspect hierarchies on the system. + INSPECT = 1; +}; + +flexible union ClientSelectorConfiguration { + /// A vector of [fuchsia.diagnostics/SelectorArgument] which + /// provide additional filters to scope data streams with. An empty vector is considered + /// a misconfiguration and will result in an epitaph signaling incorrect parameters. + 1: vector<SelectorArgument>:MAX selectors; + + /// select_all must be true if set, and specifies that the client wants to retrieve + /// all data that their connection is able to expose. + 2: bool select_all; +}; + +/// Parameters needed to configure a stream of diagnostics information. +table StreamParameters { + /// A [fuchsia.diagnostics/DataType] that specifies the diagnostics data type + /// to stream to the client. + /// NOTE: REQUIRED + 1: DataType data_type; + + /// A [fuchsia.diagnostics/StreamMode] that specifies how the + /// streaming server provides streamed results. + /// NOTE: REQUIRED + 2: StreamMode stream_mode; + + /// A [fuchsia.diagnostics/Format] that specifies how to format the returned + /// diagnostics data. + /// NOTE: REQUIRED + 3: Format format; + + /// Configuration specifying what results the client wants returned from their + /// connection. The client can request a specific subset of data using a vector + /// of provided selectors, or can specify that they want all available data. + /// NOTE: REQUIRED + 4: ClientSelectorConfiguration client_selector_configuration; +}; + +/// Outer protocol for interacting with the different diagnostics data sources. +[Discoverable] +protocol ArchiveAccessor { + /// Creates an iterator over diagnostics data on the system. + /// * The iterator may be finite by streaming in SNAPSHOT mode, serving only the + /// current state of diagnostics data on the system. + /// * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE + /// or SUBSCRIBE mode; the prior first provides iteration over the current state of + /// the sytem, and then both provide ongoing iteration over newly arriving diagnostics + /// data. + /// + /// + request `result stream` a [fuchsia.diagnostics/BatchIterator] that diagnostic + /// records are exposed to the client over. + /// * epitaphs: + /// - INVALID_ARGS: A required argument in the StreamParameters struct was missing. + /// - WRONG_TYPE: A selector provided by the StreamParameters struct was incorrectly + /// formatted. + /// + /// + request `stream_parameters` is a [fuchsia.diagnostics/StreamParameter] which + /// specifies how to configure the stream. + StreamDiagnostics(StreamParameters stream_parameters, request<BatchIterator> result_stream); +}; + +/// Conceptually, a directory iterator, where each element in the iterator is a single +/// complete file that can be concatenated with other results. +protocol BatchIterator { + /// Returns a vector of [fuchsia.diagnostics/FormattedContent] structs + /// with a format dictated by the format_settings argument provided to the Reader protocol + /// which spawned this BatchIterator. + /// + /// An empty vector implies that the data hierarchy has been fully iterated, and subsequent + /// GetNext calls will always return the empty vector. + /// + /// When the BatchIterator is serving results via subscription model, calls to GetNext will + /// hang until there is new data available, it will not return an empty vector. + /// + /// - returns a vector of FormattedContent structs. Clients connected to a + /// Batch are expected to call GetNext() until an empty vector + /// is returned, denoting that the entire data hierarchy has been read. + /// + /// * error a [fuchsia.diagnostics/ReaderError] + /// value indicating that there was an issue reading the underlying data hierarchies + /// or formatting those hierarchies to populate the `batch`. Note, these + /// issues do not include a single component's data hierarchy failing to be read. + /// The iterator is tolerant of individual component data sources failing to be read, + /// whether that failure is a timeout or a malformed binary file. + /// In the event that a GetNext call fails, that subset of the data hierarchy results is + /// dropped, but future calls to GetNext will provide new subsets of + /// FormattedDataHierarchies. + /// + GetNext() -> (vector<FormattedContent>:MAXIMUM_ENTRIES_PER_BATCH batch) error ReaderError; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/selector.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/selector.fidl new file mode 100644 index 0000000..882377d --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.diagnostics/selector.fidl
@@ -0,0 +1,139 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +library fuchsia.diagnostics; + +// The size bound of 100 is a reasonably low limit chosen based on observed +// strings used as identifiers. +const uint16 MAX_STRING_SELECTOR_LENGTH = 100; + +// The size bound of 25 is a reasonably low limit chosen based on observed +// component hierarchy depths, and awareness of maximum zircon message sizes. +const uint16 MAX_MONIKER_SEGMENTS = 25; + +// The size bound of 100 is a reasonably low limit chosen based on observed Inspect +// hierarchy use cases. +const uint16 MAX_DATA_HIERARCHY_DEPTH = 100; + +/// StringSelector is an union defining different ways to describe a pattern to match +/// strings against. +flexible union StringSelector { + /// This is a provided string that defines a pattern to + /// match against. The parser treats asterisks (*), colons (:) and backslashes + /// (\) as special characters. + /// + /// If you wish to match against literal asterisks (*), they must be escaped. + /// If you wish to match against literal backslashes (\), they must be escaped. + /// If you wish to match against literal colons (:), they must be escaped. + /// + /// eg: abc will match any string with the exact name "abc". + /// eg: a\* will match any string with the exact name "a*". + /// eg: a\\* will match any that starts with exactly "a\". + /// eg: a* will match any string that starts with "a". + /// eg: a*b will match any string that starts with a and ends with b. + /// eg: a*b*c will match any string that starts with a and ends with c, with `b` + /// in the middle. + 1: string:MAX_STRING_SELECTOR_LENGTH string_pattern; + + /// This is a provided string that defines an exact string to match against. No + /// characters are treated as special, or carry special syntax. + 2: string:MAX_STRING_SELECTOR_LENGTH exact_match; +}; + +/// Specifies a pattern of component relative monikers which +/// identify components being selected for. +/// +/// Component selectors support wildcarding, which will glob a single "level" of a +/// component moniker. eg: +/// hub/*/echo.cmx +/// will match all echo.cmx instances running only in realms directly under hub, but none +/// nested further. +table ComponentSelector { + /// Vector encoding the a pattern for monikers of components being selected for. + /// These monikers are child-monikers relative to a "root" hierarchy that the archivist + /// is aware of. + /// + /// There must be at least one StringSelector provided, which + /// specifies the component names that are matched by + /// the current selector. + 1: vector<StringSelector>:MAX_MONIKER_SEGMENTS moniker_segments; +}; + +/// A selector defining a set of nodes to match, for which the entire subtree including +/// those nodes are selected. +struct SubtreeSelector { + /// A vector of StringSelectors which serve as a pattern matcher + /// for paths through a hierarchy of named nodes. Each entry in the vector + /// is a selector for a single named node in a data hierarchy. The vector + /// of selectors for named nodes, then, defines a selector on paths through the + /// data hierarchy. + /// + /// Node paths support wildcarding, which will glob a single level of a + /// node hierarchy. eg: + /// root/a/b/*/d + /// will match all nodes named d which are below some child of node b. + /// root/a/b/c* + /// will match all nodes below b which start with the character "c". + vector<StringSelector>:MAX_DATA_HIERARCHY_DEPTH node_path; +}; + +/// A selector defining a set of nodes to match, and on those matched nodes a set of named +/// propperties to match. +struct PropertySelector { + /// A vector of StringSelectors which serve as a pattern matcher + /// for paths through a hierarchy of named nodes. Each entry in the vector + /// is a selector for a single named node in a data hierarchy. The vector + /// of selectors for named nodes, then, defines a selector on paths through the + /// data hierarchy. + /// + /// Node paths support wildcarding, which will glob a single level of a + /// node hierarchy. eg: + /// root/a/b/*/d + /// will match all nodes named d which are below some child of node b. + /// root/a/b/c* + /// will match all nodes below b which start with the character "c". + vector<StringSelector>:MAX_DATA_HIERARCHY_DEPTH node_path; + + /// A StringSelector which serves as a pattern matcher for + /// string-named properties on a node in a data hierarchy. + /// + /// target_properties supports wildcarding, which will match against all properties + /// on any node matched by node_path. + StringSelector target_properties; +}; + +/// TreeSelector represents a selection request on a hierarchy of named nodes, with +/// named properties on those nodes. +flexible union TreeSelector { + /// A selector defining a set of nodes to match, for which the entire subtree including + /// those nodes are selected. + 1: SubtreeSelector subtree_selector; + + /// A selector defining a set of nodes to match, and on those matched nodes a set of named + /// propperties to match. + 2: PropertySelector property_selector; +}; + +/// Structured selector containing all required information for pattern-matching onto +/// string-named properties owned by nodes in a data hierarchy, where data hierarchies belong +/// to specific components. +/// +/// These selectors are represented in text form as three segments, colon delimited, +/// specifying: +/// <component_moniker>:<node_selector>:<property_selector> +/// Examples: +/// Property selection: +/// realm1/realm2/echo.cmx:root/active_users:user_count +/// +/// Subtree selection: +/// realm1/realm2/echo.cmx:root/active_users +table Selector { + /// The selector defining a pattern of component monikers to match + /// against. + 1: ComponentSelector component_selector; + + /// The selector defining data hierarchy properties to match against + /// within the data hierarchies owned by components matched by + /// `component_selector`. + 2: TreeSelector tree_selector; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.factory/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.factory/BUILD.gn new file mode 100644 index 0000000..b6d494d --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.factory/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.factory") { + library_name = "factory" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.io", + ] + sources = [ + "factory.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.factory", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.factory/factory.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.factory/factory.fidl new file mode 100644 index 0000000..c6fd44a --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.factory/factory.fidl
@@ -0,0 +1,62 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.factory; +using fuchsia.io; + +// NOTE: This API will be completely removed when components v2 is implemented. +// TODO(mbrunson): Add link to factory scaffolding library when available to +// allow easier transition to components v2 for clients. + +/// This protocol is a base protocol for all providers of factory store +/// directories. It exposes a single method to allow clients to establish a +/// connection to a directory containing the relevant factory data. All files +/// surfaced by a component that implements FactoryStoreProvider (or any +/// protocol that depends on it) are expected to be validated for consistency +/// before being exposed to clients. +protocol FactoryStoreProvider { + GetFactoryStore(request<fuchsia.io.Directory> dir); +}; + +/// This protocol exposes a method to connect to a directory containing +/// Cast-specific factory data: public certificates and keys for +/// authentication with Cast servers. +[Discoverable] +protocol CastCredentialsFactoryStoreProvider { + compose FactoryStoreProvider; +}; + +/// This protocol exposes a method to connect to a directory containing +/// Widevine-specific factory data: public certificates and keys for +/// authentication with Widevine systems. +[Discoverable] +protocol WidevineFactoryStoreProvider { + compose FactoryStoreProvider; +}; + +/// This protocol exposes a method to connect to a directory containing +/// PlayReady-specific factory data: public certificates and keys for +/// authentication with PlayReady systems. +[Discoverable] +protocol PlayReadyFactoryStoreProvider { + compose FactoryStoreProvider; +}; + +/// This protocol exposes a method to connect to a directory containing +/// Weave-specific factory data: public certificates, signing keys, and +/// identity files for interoperation with a Weave-based home-area-network. +[Discoverable] +protocol WeaveFactoryStoreProvider { + compose FactoryStoreProvider; +}; + +/// This protocol exposes a method to connect to a directory containing +/// miscellaneous factory data such as tuning/calibration files, region-specific +/// audio files, factory process metadata files, and more. Any raw files not +/// covered by other FactoryStoreProviders or methods in fuchsia.hwinfo will +/// appear here. +[Discoverable] +protocol MiscFactoryStoreProvider { + compose FactoryStoreProvider; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.factory/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.factory/meta.json new file mode 100644 index 0000000..0cd0e7b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.factory/meta.json
@@ -0,0 +1,11 @@ +{ + "deps": [ + "fuchsia.io" + ], + "name": "fuchsia.factory", + "root": "fidl/fuchsia.factory", + "sources": [ + "fidl/fuchsia.factory/factory.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/BUILD.gn new file mode 100644 index 0000000..838dbbc --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/BUILD.gn
@@ -0,0 +1,32 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.feedback") { + library_name = "feedback" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.math", + "../fuchsia.mem", + ] + sources = [ + "annotation.fidl", + "attachment.fidl", + "crash_reporter.fidl", + "data_provider.fidl", + "data_register.fidl", + "device_id_provider.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.feedback", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/annotation.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/annotation.fidl new file mode 100644 index 0000000..00cd39c --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/annotation.fidl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.feedback; + +/// An annotation and its plain ASCII string key. +/// Annotations are short strings, e.g., the board name or the build version. +struct Annotation { + string:128 key; + string:1024 value; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/attachment.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/attachment.fidl new file mode 100644 index 0000000..d5d25fe --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/attachment.fidl
@@ -0,0 +1,14 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.feedback; + +using fuchsia.mem; + +/// An attachment and its plain ASCII string key. +/// Attachments are larger objects, e.g., log files. They may be binary or text data. +struct Attachment { + string:128 key; + fuchsia.mem.Buffer value; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/crash_reporter.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/crash_reporter.fidl new file mode 100644 index 0000000..9e517be --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/crash_reporter.fidl
@@ -0,0 +1,106 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.feedback; + +using fuchsia.mem; +using zx; + +/// Provides the ability to file crash reports. +[Discoverable] +protocol CrashReporter { + /// Files a crash `report`. + /// + /// This could mean generating a crash report in a local crash report database or uploading the + /// crash report to a remote crash server depending on the FIDL server's configuration. + File(CrashReport report) -> () error zx.status; +}; + +const uint32 MAX_PROGRAM_NAME_LENGTH = 1024; +const uint32 MAX_NUM_ANNOTATIONS_PER_CRASH_REPORT = 32; +const uint32 MAX_NUM_ATTACHMENTS_PER_CRASH_REPORT = 16; +const uint32 MAX_EVENT_ID_LENGTH = 128; + +/// Represents a crash report. +table CrashReport { + /// The name of the program that crashed, e.g., the process or component's name. + 1: string:MAX_PROGRAM_NAME_LENGTH program_name; + + /// How long the program was running before it crashed. + 6: zx.duration program_uptime; + + /// The specific report that depends on the type of crashes. + 2: SpecificCrashReport specific_report; + + /// A vector of key-value string pairs representing arbitrary data that should be attached to a + /// crash report. + /// + /// Keys should be unique as only the latest value for a given key in the vector will be + /// considered. + 3: vector<Annotation>:MAX_NUM_ANNOTATIONS_PER_CRASH_REPORT annotations; + + /// A vector of key-value string-to-VMO pairs representing arbitrary data that should be + /// attached to a crash report. + /// + /// Keys should be unique as only the latest value for a given key in the vector will be + /// considered. + 4: vector<Attachment>:MAX_NUM_ATTACHMENTS_PER_CRASH_REPORT attachments; + + /// A text ID that the crash server can use to group multiple crash reports related to the + /// same event. + /// + /// Unlike the crash signature, crash reports sharing the same ID correspond to different + /// crashes, but can be considered as belonging to the same event, e.g., a crash in a low-level + /// server causing a crash in a high-level UI widget. + 5: string:MAX_EVENT_ID_LENGTH event_id; +}; + +/// Represents a specific crash report. +/// +/// Add a new member when the server needs to special case how it handles certain annotations and +/// attachments for a given type of crashes, e.g., a `RuntimeCrashReport` for Javascript. +flexible union SpecificCrashReport { + /// Intended for arbitrary crashes, e.g., OOM, out-of-disk. + 1: GenericCrashReport generic; + + /// Intended for a native exception. + 2: NativeCrashReport native; + + /// Intended for a Dart exception. + 3: RuntimeCrashReport dart; +}; + +const uint32 MAX_CRASH_SIGNATURE_LENGTH = 128; + +/// Represents a generic crash report. +table GenericCrashReport { + /// A text signature that the crash server can use to track the same crash over time, e.g., + /// "kernel-panic" or "oom". + /// + /// Unlike the event ID, crash reports sharing the same signature correspond to the same crash, + /// but happening over multiple events, e.g., a null pointer exception in a server whenever + /// asked the same request. + 1: string:MAX_CRASH_SIGNATURE_LENGTH crash_signature; +}; + +/// Represents a crash report for a native exception out of which the client has built a minidump. +table NativeCrashReport { + /// The core dump in the Minidump format. + 1: fuchsia.mem.Buffer minidump; +}; + +const uint32 MAX_EXCEPTION_TYPE_LENGTH = 128; +const uint32 MAX_EXCEPTION_MESSAGE_LENGTH = 2048; + +/// Represents a crash report for a runtime exception, applicable to most languages. +table RuntimeCrashReport { + /// The exception type, e.g., "FileSystemException". + 1: string:MAX_EXCEPTION_TYPE_LENGTH exception_type; + + /// The exception message, e.g., "cannot open file". + 2: string:MAX_EXCEPTION_MESSAGE_LENGTH exception_message; + + /// The text representation of the exception stack trace. + 3: fuchsia.mem.Buffer exception_stack_trace; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/data_provider.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/data_provider.fidl new file mode 100644 index 0000000..d91a56f --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/data_provider.fidl
@@ -0,0 +1,64 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.feedback; + +using fuchsia.math; +using fuchsia.mem; +using zx; + +/// Provides data useful to attach in feedback reports (crash, user feedback or bug reports). +[Discoverable] +protocol DataProvider { + /// Returns all the feedback data except the screenshot, which is provided + /// separately. + GetData() -> (Data data) error zx.status; + + /// Returns an image of the current view encoded in the provided `encoding`. + /// + /// `screenshot` may be null if the encoding is not supported, the device + /// does not have a display, or there is not enough memory to allocate the + /// screenshot image. + /// + /// The screenshot is provided separately from the rest of the data as + /// callers might want to block on it before changing the view. + GetScreenshot(ImageEncoding encoding) -> (Screenshot? screenshot); +}; + +const uint32 MAX_NUM_ANNOTATIONS_PROVIDED = 64; + +/// Data to attach to feedback reports. +/// +/// Clients typically upload the data straight to servers without expecting some +/// particular fields. So the data comes in the form of arbitrary key-value pairs +/// that clients can directly forward to the servers. +table Data { + /// A vector of key-value string pairs. Keys are guaranteed to be unique. + 1: vector<Annotation>:MAX_NUM_ANNOTATIONS_PROVIDED annotations; + + /// A bundle of Attachments objects stored as an Attachment itself, e.g., it + /// could be a ZIP archive bundling a vector of Attachment objects. + 3: Attachment attachment_bundle; + + // Deprecated. + 2: reserved; +}; + +/// The encoding used for the image. +/// +/// Today, only PNG is supported, but in the future the screenshot could be +/// returned in other encodings if need arises. +enum ImageEncoding { + PNG = 0; +}; + +/// An encoded image of the screen. +struct Screenshot { + fuchsia.mem.Buffer image; + + // While all encoded images contain their dimensions in their headers, some + // clients still expect to receive the width and height separately, so we + // also provide it separately so clients don't need to decode `image`. + fuchsia.math.Size dimensions_in_px; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/data_register.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/data_register.fidl new file mode 100644 index 0000000..1944ebf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/data_register.fidl
@@ -0,0 +1,89 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.feedback; + +/// Registers data useful to attach in feedback reports (crash, user feedback or bug reports). +/// +/// This can be used by components to augment the data attached to all feedback reports. By default +/// the Feedback service attaches data exposed to the platform. This protocol is useful for data +/// known by certain components in certain products, but that is not exposed to the platform. +/// +/// The epitaph ZX_ERR_INVALID_ARGS indicates that the client is sending invalid requests. See +/// below for each request why they might be invalid. +/// +/// The epitaph ZX_ERR_NO_RESOURCES indicates that the server can no longer store additional +/// component data and will not service new connections. +[Discoverable] +protocol ComponentDataRegister { + /// Updates or inserts extra component data to be included in feedback reports. + /// + /// The namespace and each annotation key are used to decide whether to update or insert an + /// annotation. If an annotation is already present for a given key within the same namespace, + /// update the value, otherwise insert the annotation with that key under that namespace. + /// + /// For instance, assuming these are the data already held by the server (from previous calls + /// to Upsert()): + /// { + /// "bar": { # namespace + /// "channel": "stable", + /// }, + /// "foo": { # namespace + /// "version": "0.2", + /// }, + /// } + /// + /// then Upsert({ + /// "namespace": "bar", + /// "annotations": [ + /// "version": "1.2.3.45", + /// "channel": "beta", + /// ] + /// }) would result in the server now holding: + /// { + /// "bar": { # namespace + /// "channel": "beta", # updated + /// "version": "1.2.3.45" # inserted + /// }, + /// "foo": { # namespace + /// "version": "0.2", # untouched + /// }, + /// } + /// + /// Note that the server will only hold at most MAX_NUM_ANNOTATIONS_PER_NAMESPACE distinct + /// annotation keys per namespace, picking up the latest values. + Upsert(ComponentData data) -> (); +}; + +const uint32 MAX_NAMESPACE_LENGTH = 32; +const uint32 MAX_NUM_ANNOTATIONS_PER_NAMESPACE = 16; + +/// Data known to a component, but not exposed to the platform, to attach to feedback reports. +table ComponentData { + /// The top-level namespace associated with the data: + /// * Is intended to group related data together and reduce data key collisions across + /// namespaces. + /// * May be shared by multiple clients, e.g., there could be multiple clients within the same + /// component or across components that want to expose related data and they would all use + /// the same namespace. + /// * Will be prefixed to every data key passed within that namespace in all feedback reports, + /// e.g., the annotation "version" would appear as "foo.version" in all feedback reports if + /// the namespace is "foo". + /// * Must match [a-z\-]+, i.e. only lowercase letters and hyphens or this will result in a + /// ZX_ERR_INVALID_ARGS epitaph. + /// * Must not match a reserved namespace used internally for platform data, e.g., "build", or + /// this will result in a ZX_ERR_INVALID_ARGS epitaph. The list of reserved namespaces is + /// internal and subject to change for now. + 1: string:MAX_NAMESPACE_LENGTH namespace; + + /// A vector of key-value string pairs, e.g., `<"version", "1.2.3.45">`. + /// + /// Keys: + /// * Should be unique as only the latest value for a given key in the vector will be + /// considered. + /// * Must match [a-z\-\.]+, i.e. only lowercase letters, hyphens and periods. Use periods for + /// sub-namespacing, e.g., "build.label" and "build.type", so that related annotations are + /// grouped together (here related to "build") when sorted lexicographically. + 2: vector<Annotation>:MAX_NUM_ANNOTATIONS_PER_NAMESPACE annotations; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/device_id_provider.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/device_id_provider.fidl new file mode 100644 index 0000000..77c108e --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/device_id_provider.fidl
@@ -0,0 +1,22 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.feedback; + +/// Provides the device's feedback ID. +/// +/// The feedback ID is a persisted UUID used to group feedback reports. The ID +/// is not intended to be used for any reporting purposes other than feedback, +/// e.g., not intended to be used for telemetry. +[Discoverable] +protocol DeviceIdProvider { + /// Returns the device's feedback ID. + GetId() -> (string:64 feedback_id) error DeviceIdError; +}; + +/// The DeviceIdError values are returned in the following circumstances: +/// * NOT_FOUND - a valid feedback id was not found by the server. +enum DeviceIdError { + NOT_FOUND = 1; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.feedback/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/meta.json new file mode 100644 index 0000000..e9e8b63 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.feedback/meta.json
@@ -0,0 +1,17 @@ +{ + "deps": [ + "fuchsia.math", + "fuchsia.mem" + ], + "name": "fuchsia.feedback", + "root": "fidl/fuchsia.feedback", + "sources": [ + "fidl/fuchsia.feedback/annotation.fidl", + "fidl/fuchsia.feedback/attachment.fidl", + "fidl/fuchsia.feedback/crash_reporter.fidl", + "fidl/fuchsia.feedback/data_provider.fidl", + "fidl/fuchsia.feedback/data_register.fidl", + "fidl/fuchsia.feedback/device_id_provider.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.fonts/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/BUILD.gn new file mode 100644 index 0000000..6f19387 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/BUILD.gn
@@ -0,0 +1,30 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.fonts") { + library_name = "fonts" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.intl", + "../fuchsia.mem", + ] + sources = [ + "events.fidl", + "font_provider.fidl", + "provider.fidl", + "styles.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.fonts", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.fonts/events.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/events.fidl new file mode 100644 index 0000000..867540b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/events.fidl
@@ -0,0 +1,25 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.fonts; + +/// Protocol for listening to possible events that may occur in the `Provider`'s set of fonts. +/// +/// Register a listener using [`fuchsia.fonts/Provider.RegisterFontSetEventListener`]. +protocol FontSetEventListener { + /// The set of fonts available in the `Provider` has changed. See + /// [`fuchsia.fonts/FontSetUpdatedEvent`]. + OnFontSetUpdated(FontSetUpdatedEvent event) -> (); + + // A future addition might include an event that is triggered when the user changes the mapping + // for generic font families (e.g. configuring "monospace" to default to "Inconsolata" instead of + // "Roboto Mono"). +}; + +/// An event indicating that the set of fonts available in the `Provider` has changed. This is most +/// frequently caused by an ephemeral font being downloaded and cached. Clients should consider +/// re-requesting fonts and re-rendering any displayed text. +table FontSetUpdatedEvent { + // No fields at the moment. +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.fonts/font_provider.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/font_provider.fidl new file mode 100644 index 0000000..c16a832 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/font_provider.fidl
@@ -0,0 +1,142 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// NOTE: This file is deprecated and will soon be removed in favor of provider.fidl. + +library fuchsia.fonts; + +using fuchsia.mem; + +/// Deprecated. See `GenericFontFamily`. +[Transitional] +enum FallbackGroup { + NONE = 0; + SERIF = 1; + SANS_SERIF = 2; + MONOSPACE = 3; + CURSIVE = 4; + FANTASY = 5; +}; + +/// Deprecated. See `FaceRequestFlags`. +/// Disables font fallback. The service won't try to search fallback font set if +/// there is no requested font family or if it doesn't contain requested +/// character. +const uint32 REQUEST_FLAG_NO_FALLBACK = 1; + +/// Deprecated. See `FaceRequestFlags`. +/// Disables approximate style matching. The service will only return font that +/// matches the requested style exactly. +const uint32 REQUEST_FLAG_EXACT_MATCH = 2; + +/// Deprecated. See `FaceRequest`. +struct Request { + /// Desired font family name, e.g. "Roboto". Font family search is + /// case-insensitive. In case when there is no specified family or the + /// specified family doesn't have glyph for the requested `character` then + /// a font from another family may be returned. This behavior can be disabled + /// using `REQUEST_FLAG_NO_FALLBACK`. + string:MAX_FAMILY_NAME_LENGTH? family; + + /// For example, 400 is normal, 700 is bold. + uint32 weight = 400; + + /// Numeric values matching OS/2 & Windows Metrics usWidthClass table. + /// https://www.microsoft.com/typography/otspec/os2.htm + /// For example, 5 is normal. + uint32 width = 5; + + Slant slant = Slant.UPRIGHT; + + /// BCP47 language tags in order of preference. See + /// https://tools.ietf.org/html/bcp47 . + vector<string:35>:8? language; + + /// Codepoint for the character that must be present in the returned font or 0. + /// Caller that specify this field are expected to extract character set from + /// the result and cache it in order to avoid calling the API more than + /// necessary. + uint32 character = 0; + + /// Fallback group preference. Caller can leave this field set to NONE. In + /// that case the font provider will use fallback group of the specified font + /// family. + FallbackGroup fallback_group = FallbackGroup.NONE; + + uint32 flags = 0; +}; + +struct Response { + fuchsia.mem.Buffer buffer; + + /// Buffer identifier for the buffer. Responses with the same buffer_id are + /// guaranteed to contain the same data in the buffer. Clients may use this + /// value to detect if they already have the font cached in parsed form. + uint32 buffer_id; + + /// Font index within `buffer`. Used for font formats that may contain more + /// than one font per file, e.g. TTC (TrueType Collection). + uint32 font_index; +}; + +/// Deprecated. +/// See `Style2`. +struct Style { + uint32 weight; + uint32 width; + Slant slant; +}; + +/// Deprecated. See `FontFamilyInfo`. +/// +/// Information about font family that can be requested using GetFamilyInfo(). +struct FamilyInfo { + /// Canonical font family name. Note that this may be different from the + /// value passed to GetFamilyInfo() because GetFamilyInfo() also resolves + /// font aliases and ignores case. For example GetFamilyInfo("robotoslab") + /// will FamilyInfo.name = "Robot Slab". + string:MAX_FAMILY_NAME_LENGTH name; + + /// Unordered list of all available styles in the family. + vector<Style>:MAX_FAMILY_STYLES styles; +}; + +/// Provider of digital font files and metadata. +/// +/// TODO(I18N-12): Remove deprecated methods and move to provider.fidl. +[Discoverable] +protocol Provider { + + /// Deprecated. See `GetTypeface`. + /// + /// Returns font that matches specified `request`. + GetFont(Request request) -> (Response? response); + + /// Deprecated. See `GetFontFamilyInfo`. + /// + /// Returns information for the specified font family or null if there is + /// no family with the specified name. This function respects family name + /// aliases and ignores case, so request for "robotoSLAB" will return + /// FamilyInfo for "Roboto Slab". + GetFamilyInfo(string:MAX_FAMILY_NAME_LENGTH family) -> (FamilyInfo? family_info); + + /// Returns a typeface that matches the specified `request`, or an empty table if no matching + /// face is found. (The latter is more likely to happen if `TypefaceRequestFlags.EXACT_FAMILY` + /// is used to disable fallbacks.) + GetTypeface(TypefaceRequest request) -> (TypefaceResponse response); + + /// Returns information for the specified font family, or an empty table if there is no family + /// with the specified name. + /// + /// This function respects family name aliases and ignores case. For example, "RobotoSlab" is an + /// alias for the canonical name "Roboto Slab". A request for "robotoSLAB" would return the + /// `FontFamilyInfo` for "Roboto Slab" due to the case-insensitivity and alias resolution. + GetFontFamilyInfo(FamilyName family) -> (FontFamilyInfo family_info); + + /// Register a listener to be notified when the set of available fonts or mappings has changed. + /// A client can register as many listeners as it wishes. + /// + /// To unregister, close the channel. + RegisterFontSetEventListener(FontSetEventListener listener) -> (); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.fonts/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/meta.json new file mode 100644 index 0000000..96fb6a1 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/meta.json
@@ -0,0 +1,15 @@ +{ + "deps": [ + "fuchsia.intl", + "fuchsia.mem" + ], + "name": "fuchsia.fonts", + "root": "fidl/fuchsia.fonts", + "sources": [ + "fidl/fuchsia.fonts/events.fidl", + "fidl/fuchsia.fonts/font_provider.fidl", + "fidl/fuchsia.fonts/provider.fidl", + "fidl/fuchsia.fonts/styles.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.fonts/provider.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/provider.fidl new file mode 100644 index 0000000..339f280 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/provider.fidl
@@ -0,0 +1,154 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.fonts; + +using fuchsia.intl; +using fuchsia.mem; + +/// The maximum length of a font family name. +const uint32 MAX_FAMILY_NAME_LENGTH = 128; + +/// The maximum number of code points allowed in a typeface query. +const uint32 MAX_FACE_QUERY_CODE_POINTS = 128; + +/// The maximum number of preferred languages allowed in a typeface query. +const uint32 MAX_FACE_QUERY_LANGUAGES = 8; + +/// The maximum number of styles that will be returned for a font family. +const uint32 MAX_FAMILY_STYLES = 300; + +/// The name of a family of fonts. +/// +/// Examples: "Roboto", "Noto Serif". +struct FamilyName { + /// The characters that make up the name. + string:MAX_FAMILY_NAME_LENGTH name; +}; + +/// Boolean flags for `TypefaceRequest`. +bits TypefaceRequestFlags : uint32 { + /// Disables font family fallback. The service won't try to search the fallback font set if the + /// requested font family doesn't exist or if it doesn't contain the requested code point. + EXACT_FAMILY = 0x00000001; + + /// Disables approximate style matching. The service will only return a face that matches the + /// requested style exactly. For example, there will be no substitutions of "medium" for a + /// requested "semi-bold" weight, or "oblique" for a requested "italic" slant. + EXACT_STYLE = 0x00000002; +}; + +/// Options for what the font server should do if the client requests a typeface that is not yet +/// cached. +enum CacheMissPolicy { + /// The server will attempt to load the uncached typeface before providing a response. This is + /// the *default* behavior. + /// + /// This option is not recommended for synchronous clients that block rendering while waiting + /// for a font. + BLOCK_UNTIL_DOWNLOADED = 1; + + /// The server will tell the client that the uncached typeface is unavailable, by returning an + /// empty [`fuchsia.fonts/TypefaceResponse`]. The uncached typeface may be downloaded + /// asynchronously to be available for future requests. + /// + /// This is similar to `font-display: block` in CSS. + RETURN_EMPTY_RESPONSE = 2; + + /// The server will attempt to provide a cached fallback typeface (if allowed by the fallback + /// restrictions in [`fuchsia.fonts/TypefaceRequestFlags`]). The uncached typeface may be + /// downloaded asynchronously to be available for future requests. + /// + /// This is similar to `font-display: swap` in CSS. + RETURN_FALLBACK = 3; +}; + +/// Parameters for requesting a typeface. +table TypefaceRequest { + /// Parameters for looking up a typeface. + 1: TypefaceQuery query; + + /// Flags for how to process the request, such as which kinds of substitutions are permitted. + 2: TypefaceRequestFlags flags; + + /// Setting for what to do if the requested typeface exists but is not cached, and therefore + /// cannot be served immediately. + /// + /// If this field is empty, the default policy is + /// [`fuchsia.fonts/CacheMissPolicy.BLOCK_UNTIL_DOWNLOADED`]. + /// + /// If the client needs an immediate response, it can choose one of the non-blocking policies. + /// In this case, clients can also register to be notified when new fonts have been added to the + /// cache by calling [`fuchsia.fonts/Provider.RegisterFontSetEventListener`]. + 3: CacheMissPolicy cache_miss_policy; +}; + +/// Parameters for looking up a typeface. +table TypefaceQuery { + /// Desired font family name, e.g. "Roboto". Font family search is case-insensitive. + /// + /// Note: In cases where the specified family doesn't exist, or the specified family doesn't + /// have a glyph for the requested `code_point`, a face from another family may be returned. + /// This behavior can be disabled using `TypefaceRequestFlags.EXACT_FAMILY`. + 1: FamilyName family; + + /// Style properties of the desired typeface. + 2: Style2 style; + + /// Language tags in order of preference. This allows disambiguating code points that map + /// to different glyphs in different languages (e.g. CJK code points). + /// + /// See `fuchsia.intl.LocaleId`. + 3: vector<fuchsia.intl.LocaleId>:MAX_FACE_QUERY_LANGUAGES languages; + + /// Optional code points for which glyphs must be present in the returned face. + /// + /// Callers that specify this field are expected to extract the character set from the result + /// and cache it in order to avoid calling the API more than necessary. + 4: vector<uint32>:MAX_FACE_QUERY_CODE_POINTS code_points; + + /// A generic font family to fall back to if an exact match is unavailable or does not contain + /// the requested code point. + /// + /// Every font family belongs to a generic family (configured in the font manifest). If a + /// particular font family doesn't contain a requested code point, the provider can search for + /// the code point in other font families _in the same generic family_ as a fallback. + /// + /// Specifying `fallback_family` in a query allows the client to override the generic family + /// that would be used as a fallback. + 5: GenericFontFamily fallback_family; +}; + +/// Response to a TypefaceRequest. Contains the digital font file and metadata corresponding to a +/// returned typeface. Clients are expected to cache the results if they plan to reuse them. +/// +/// If a matching typeface cannot be found, the table will be empty. +table TypefaceResponse { + /// A memory buffer containing the bytes of a digital font file. + /// It is the client's responsibility to identify the type of file and to parse it (usually by + /// delegating to FreeType or a similar library). + 1: fuchsia.mem.Buffer buffer; + + /// Identifier for the buffer. Responses with the same `buffer_id` are guaranteed to contain the + /// same data in the buffer. Clients may use this value to detect if they already have the font + /// cached in parsed form. + 2: uint32 buffer_id; + + /// Index of the returned typeface within `buffer`. Used for digital font formats that may + /// contain more than one typeface per file, e.g. TTC (TrueType Collection). + 3: uint32 font_index; +}; + +/// Information about a font family that can be requested using `Provider.GetFontFamilyInfo()`. +/// +/// If a matching font family is not found, the table will be empty. +table FontFamilyInfo { + /// Canonical font family name. Note that this may be different from the value passed to + /// `GetFontFamilyInfo()` due to the resolution of font aliases, and/or differences in + /// whitespace and capitalization. + 1: FamilyName name; + + /// Unordered list of all available styles in the family. + 2: vector<Style2>:MAX_FAMILY_STYLES styles; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.fonts/styles.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/styles.fidl new file mode 100644 index 0000000..ab2b916 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.fonts/styles.fidl
@@ -0,0 +1,126 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.fonts; + +using Weight = uint16; + +// Commonly used constants for font weight. +const Weight WEIGHT_THIN = 100; +const Weight WEIGHT_EXTRA_LIGHT = 200; +const Weight WEIGHT_LIGHT = 300; +const Weight WEIGHT_NORMAL = 400; +const Weight WEIGHT_MEDIUM = 500; +const Weight WEIGHT_SEMI_BOLD = 600; +const Weight WEIGHT_BOLD = 700; +const Weight WEIGHT_EXTRA_BOLD = 800; +const Weight WEIGHT_BLACK = 900; + +/// The type of slant of a type face. +enum Slant { + /// The default; upright glyphs. + UPRIGHT = 1; + /// Specially designed, slanted and slightly calligraphic glyphs. + ITALIC = 2; + /// Skewed glyphs. Oblique usually means an geometric transformation of the upright variant, + /// rather than a custom-designed variant. + OBLIQUE = 3; +}; + +/// Horizontal width class of the glyphs. +/// +/// See https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswidthclass. +enum Width { + /// 50% of normal width + ULTRA_CONDENSED = 1; + /// 62.5% of normal width + EXTRA_CONDENSED = 2; + /// 75% of normal width + CONDENSED = 3; + /// 87.5% of normal width + SEMI_CONDENSED = 4; + /// Normal width + NORMAL = 5; + /// 112.5% of normal width + SEMI_EXPANDED = 6; + /// 125% of normal width + EXPANDED = 7; + /// 150% of normal width + EXTRA_EXPANDED = 8; + /// 200% of normal width + ULTRA_EXPANDED = 9; +}; + +/// Default weight of a typeface when none is specified. +const Weight DEFAULT_WEIGHT = WEIGHT_NORMAL; + +/// Default slant of a typeface when none is specified. +const Slant DEFAULT_SLANT = Slant.UPRIGHT; + +/// Default width of a typeface when none is specified. +const Width DEFAULT_WIDTH = Width.NORMAL; + +/// Style properties that can be used when requesting or describing a type face. +table Style2 { + /// See `Slant`. + 1: Slant slant; + /// Weight or thickness of the glyphs. Allowed values are integers in the range [1, 1000], but + /// most real-world font families only support some integer multiples of 100: + /// {100, 200, ..., 900}. Normal text (`WEIGHT_NORMAL`) is 400; `WEIGHT_BOLD` is 700. + /// + /// See: + /// https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#Common_weight_name_mapping + /// https://docs.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass + 2: Weight weight; + /// See `Width`. + 3: Width width; +}; + +/// Generic groups of font families that can serve as fallbacks for a specific family. +/// +/// Every font family belongs to some _generic_ font family (see examples below). +/// +/// If an exact requested family is unavailable but a fallback group is specified in the request, +/// the provider may return some other family that belongs to the fallback group. For example, if +/// the client requests the "Arial" family with a `SANS_SERIF` fallback, and "Arial" is unavailable, +/// the provider may return another available sans serif family, such as "Roboto Regular", instead. +/// +/// See also: +/// https://www.w3.org/TR/css-fonts-4/#generic-font-families +enum GenericFontFamily { + /// Glyphs have little "serifs", hooks, or notches at the ends of most strokes. + /// Examples: Georgia, Noto Serif, Times New Roman. + SERIF = 1; + /// Glyphs that have no serifs at the ends of most strokes. + /// Examples: Arial, Noto Sans, Roboto, Tahoma. + SANS_SERIF = 2; + /// Fixed-width fonts. + /// Examples: Consolas, Courier New, Inconsolata. + MONOSPACE = 3; + /// Handwritten or cursive fonts. + /// Examples: Brush Script, Comic Sans, Lucida Calligraphy. + CURSIVE = 4; + /// Decorative fonts. + /// Examples: Impact, Papyrus. + FANTASY = 5; + /// The default user interface font on the target platform. + /// This is included for completeness with the CSS specification; font manifests should not + /// declare that a font belongs to the `SYSTEM_UI` generic family, but instead should declare a + /// more specific option (e.g. `SERIF` for Roboto). + /// + /// Not commonly used. + SYSTEM_UI = 6; + /// Fonts that are used specifically for rendering emoji code points. + /// Examples: Noto Color Emoji. + EMOJI = 7; + /// Fonts that are used primarily for rendering mathematical expressions. + /// + /// Not commonly used. + MATH = 8; + /// A group of Chinese fonts between serif and cursive, often used for official Chinese + /// Government documents. + /// + /// Not commonly used. + FANGSONG = 9; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/BUILD.gn new file mode 100644 index 0000000..411b982 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.hardware.ethernet") { + library_name = "ethernet" + namespace = "fuchsia.hardware" + public_deps = [ + ] + sources = [ + "ethernet.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.hardware.ethernet", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/ethernet.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/ethernet.fidl new file mode 100644 index 0000000..8b038b7 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/ethernet.fidl
@@ -0,0 +1,113 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hardware.ethernet; + +using zx; + +struct MacAddress { + array<uint8>:6 octets; +}; + +// Info.features bits +const uint32 INFO_FEATURE_WLAN = 0x00000001; +const uint32 INFO_FEATURE_SYNTH = 0x00000002; +const uint32 INFO_FEATURE_LOOPBACK = 0x00000004; + +struct Info { + uint32 features; + uint32 mtu; + MacAddress mac; +}; + +struct Fifos { + // handles for the rx and tx fifo + handle<fifo> rx; + handle<fifo> tx; + + // maximum number of items in rx and tx fifo + uint32 rx_depth; + uint32 tx_depth; +}; + +/// Signal that is asserted on the RX fifo whenever the Device has a status +/// change. This is ZX_USER_SIGNAL_0. +// TODO(teisenbe/kulakowski): find a better way to represent this +const uint32 SIGNAL_STATUS = 0x01000000; + +// device_status bits +const uint32 DEVICE_STATUS_ONLINE = 0x00000001; + +/// Max client name length +const uint32 MAX_CLIENT_NAME_LEN = 15; + +/// For compatibility with a past revision, allow one extra byte for an optional +/// null-terminator. +const uint32 SET_CLIENT_NAME_MAX_LEN = 16; + +/// Operation +/// +/// Packets are transmitted by writing data into the IO buffer and writing +/// a FifoEntry referencing that data (offset + length) into the tx fifo. +/// When the driver is done accessing the data, a FifoEntry with the same +/// cookie value (opaque to the driver) will be readable from the tx fifo. +/// +/// Packets are received by writing a FifoEntry referencing an available +/// buffer (offset + length) in the IO buffer. When a packet is received, +/// a FifoEntry with the same cookie value (opaque to the driver) will be +/// readable from the rx fifo. The offset field will be the same as was +/// sent. The length field will reflect the actual size of the received +/// packet. The flags field will indicate success or a specific failure +/// condition. +/// +/// IMPORTANT: The driver *will not* buffer response messages. It is the +/// client's responsibility to ensure that there is space in the reply side +/// of each fifo for each outstanding tx or rx request. The fifo sizes +/// are returned along with the fifo handles from GetFifos(). +/// +/// See //zircon/system/public/zircon/device/ethernet.h for fifo entry layout +/// and request / response message bits. +[Layout = "Simple"] +protocol Device { + /// Obtain information about device + GetInfo() -> (Info info); + + /// Obtain a pair of fifos for queueing tx and rx operations + GetFifos() -> (zx.status status, Fifos? info); + + /// Set the IO Buffer that will provide the data buffers for tx and rx operations + SetIOBuffer(handle<vmo> h) -> (zx.status status); + + /// Start transferring packets + /// Start will not succeed (ZX_ERR_BAD_STATE) until the fifos have been + /// obtained and an io buffer vmo has been registered. + Start() -> (zx.status status); + + /// Stop transferring packets + Stop() -> (); + + /// Start listening to the packets that we're transmitting + /// as well as the packets we're receiving. + ListenStart() -> (zx.status status); + + /// Stop listening to the packets that we're transmitting. + ListenStop() -> (); + + SetClientName(string:SET_CLIENT_NAME_MAX_LEN name) -> (zx.status status); + + /// Obtain the device status bits + /// When these change, the signal SIGNAL_STATUS is asserted on the rx fifo. + /// When these are read, the signal is deasserted. + GetStatus() -> (uint32 device_status); + + SetPromiscuousMode(bool enabled) -> (zx.status status); + + ConfigMulticastAddMac(MacAddress addr) -> (zx.status status); + ConfigMulticastDeleteMac(MacAddress addr) -> (zx.status status); + ConfigMulticastSetPromiscuousMode(bool enabled) -> (zx.status status); + + // TODO(teisenbe): We should probably remove these? They are only used for testing. + ConfigMulticastTestFilter() -> (zx.status status); + DumpRegisters() -> (zx.status status); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/meta.json new file mode 100644 index 0000000..7736638 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.ethernet/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.hardware.ethernet", + "root": "fidl/fuchsia.hardware.ethernet", + "sources": [ + "fidl/fuchsia.hardware.ethernet/ethernet.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/BUILD.gn new file mode 100644 index 0000000..840c9d2 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.hardware.goldfish") { + library_name = "goldfish" + namespace = "fuchsia.hardware" + public_deps = [ + ] + sources = [ + "goldfish_address_space.fidl", + "goldfish_control.fidl", + "goldfish_pipe.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.hardware.goldfish", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_address_space.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_address_space.fidl new file mode 100644 index 0000000..3be17e7 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_address_space.fidl
@@ -0,0 +1,95 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hardware.goldfish; + +using zx; + +// Interface for the Goldfish address space driver. + +enum AddressSpaceChildDriverType : uint32 { + /// The DEFAULT child driver type is for graphics. + DEFAULT = 0; +}; + +// State +// The driver consists of three main pieces of state: + +// 1. A PCI BAR that clients can suballocate into. This is used for mapping +// coherent memory from the hardware, such as for Vulkan HOST_COHERENT +// memory, or for any other buffer owned by the hardware such as video +// codec buffers. This also includes a mapping where each connection of the +// driver is associated with one or more mappings. + +// The next two pieces of state are for child driver connections. + +// 2. A set of context handles, one per driver connection that the client +// establishes. This is used to support higher-level/VMM-defined (child) +// drivers. Each such driver is considered a "child" driver of goldfish address +// space. + +// 3. A set of command pages, one per connection. This is used as a shared +// device/host memory to support the "Ping" command. The "Ping" command is used +// to run the child driver logic, driven by the app. There is a protocol to +// permanently associate a particular goldfish address space driver connection +// with a particular type of child driver, discussed next. + +[Layout = "Simple"] +protocol AddressSpaceDevice { + OpenChildDriver(AddressSpaceChildDriverType type, request<AddressSpaceChildDriver> req); +}; + +// Child driver protocol + +// By default, creating connection to the driver does not associate any child +// driver with the connection. + +// The client opens a child driver via OpenChildDriver, giving the type of the +// driver as an argument along with a request for the connection. The type of +// the driver is a number and the number/drivertype mapping is +// determined/maintained in: +// https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emu/android/emulation/AddressSpaceService.h +// In Fuchsia, we currently only support the DEFAULT type, which is used for +// graphics. + +/// After opening the child driver, the client and hardware communicate via a +/// child driver-specific protocol, with notifications driven by +/// Ping(), each of which writes and reads messages to the hardware +/// that follow this AddressSpaceChildDriverPingMessage struct. +/// Each child driver type will have its own semantics for each field. +/// It's common for child drivers to refer to offset/size plus a metadata +/// field. We also provide extra data fields for other use cases in +/// particular child drivers. +struct AddressSpaceChildDriverPingMessage { + uint64 offset; + uint64 size; + uint64 metadata; + uint64 data0; + uint64 data1; + uint32 data2; + uint32 data3; +}; + +[Layout = "Simple"] +protocol AddressSpaceChildDriver { + // Allocates goldfish address space of given size. + AllocateBlock(uint64 size) -> (zx.status res, uint64 paddr, handle<vmo>? vmo); + // Free goldfish address space associated with given ID. + DeallocateBlock(uint64 paddr) -> (zx.status res); + + // Claim a region at [offset, offset + size) that is a subregion of a + // larger region managed by hardware. It is possible to share the same + // regions across different connections, but within a connection, we + // require the claimed regions to be disjoint. Otherwise, ZX_ERROR_INVALID_ARGS + // is returned. + ClaimSharedBlock(uint64 offset, uint64 size) -> (zx.status res, handle<vmo>? vmo); + + // Unclaim a hardware-shared region. This must correspond to an existing claimed + // region in the current connection. Otherwise, ZX_ERROR_INVALID_ARGS is returned. + UnclaimSharedBlock(uint64 offset) -> (zx.status res); + + // Ping (General notification for child drivers) + Ping(AddressSpaceChildDriverPingMessage ping) + -> (zx.status res, AddressSpaceChildDriverPingMessage ping); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_control.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_control.fidl new file mode 100644 index 0000000..2e7c39b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_control.fidl
@@ -0,0 +1,31 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hardware.goldfish; + +using zx; + +/// Color buffer formats. +enum ColorBufferFormatType : uint32 { + RGBA = 0x1908; + BGRA = 0x80E1; +}; + +/// Interface for the Goldfish control driver providing color buffers. +[Layout = "Simple"] +protocol ControlDevice { + /// Create shared color buffer. Color buffer is automatically freed when + /// all references to `vmo` have been closed. Fails if VMO is not + /// associated with goldfish heap memory. + /// Returns ZX_ERR_ALREADY_EXISTS if color buffer has already been created. + CreateColorBuffer(handle<vmo> vmo, + uint32 width, + uint32 height, + ColorBufferFormatType format) + -> (zx.status res); + + /// Get color buffer for VMO. Fails if VMO is not associated with a color + /// buffer. + GetColorBuffer(handle<vmo> vmo) -> (zx.status res, uint32 id); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_pipe.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_pipe.fidl new file mode 100644 index 0000000..62da439 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/goldfish_pipe.fidl
@@ -0,0 +1,60 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hardware.goldfish; + +using zx; + +/// Signal that will be active on event handle if the Read() method +/// will return data. +const uint32 SIGNAL_READABLE = 0x01000000; // ZX_USER_SIGNAL_0 + +/// Signal that will be active on event handle if the Write() method +/// will accept data. +const uint32 SIGNAL_WRITABLE = 0x02000000; // ZX_USER_SIGNAL_1 + +/// Signal that will be active on event handle if the device has been +/// disconnected. +const uint32 SIGNAL_HANGUP = 0x04000000; // ZX_USER_SIGNAL_2 + +/// Interface for the Goldfish pipe driver. +[Layout = "Simple"] +protocol PipeDevice { + /// Open pipe. A protocol request `pipe_request` provides an interface + /// to the pipe. Multiple pipes can be opened for a single device. + /// Closing the device connection will also close all pipe connections. + /// TODO(DX-1766): Unify `device` and `pipe`. + OpenPipe(request<Pipe> pipe_request); +}; + +[Layout = "Simple"] +protocol Pipe { + /// Request new IO buffer size. Can fail if out of memory. Discards + /// contents of existing buffer on success. Leaves existing buffer + /// intact on failure. + SetBufferSize(uint64 size) -> (zx.status res); + + /// Set event used to signal device state. Discards existing event + /// after having transferred device state to the new event. + SetEvent(handle<event> event); + + /// Acquire VMO for IO buffer. Can be called multiple times. Each call + /// returns a new handle to the VMO. + GetBuffer() -> (zx.status res, handle<vmo>? vmo); + + /// Attempt to read up to count bytes into IO buffer at specified offset. + /// Returns `ZX_ERR_SHOULD_WAIT` if pipe device is not readable. + Read(uint64 count, uint64 offset) -> (zx.status res, uint64 actual); + + /// Writes up to count bytes from the IO buffer at specified offset. + /// Returns `ZX_ERR_SHOULD_WAIT` if pipe device is not writable. + Write(uint64 count, uint64 offset) -> (zx.status res, uint64 actual); + + /// Writes count bytes from the IO buffer at specified write + /// offset. Blocks if pipe device is not writable. Subsequently reads + /// read_count bytes into the IO buffer at specified read offset. + /// Returns `ZX_ERR_SHOULD_WAIT` if pipe device is not readable. + Call(uint64 count, uint64 offset, uint64 read_count, uint64 read_offset) + -> (zx.status res, uint64 actual); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/meta.json new file mode 100644 index 0000000..c09a361 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.goldfish/meta.json
@@ -0,0 +1,11 @@ +{ + "deps": [], + "name": "fuchsia.hardware.goldfish", + "root": "fidl/fuchsia.hardware.goldfish", + "sources": [ + "fidl/fuchsia.hardware.goldfish/goldfish_address_space.fidl", + "fidl/fuchsia.hardware.goldfish/goldfish_control.fidl", + "fidl/fuchsia.hardware.goldfish/goldfish_pipe.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/BUILD.gn new file mode 100644 index 0000000..2130991 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.hardware.light") { + library_name = "light" + namespace = "fuchsia.hardware" + public_deps = [ + ] + sources = [ + "light.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.hardware.light", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/light.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/light.fidl new file mode 100644 index 0000000..e1dc7f9 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/light.fidl
@@ -0,0 +1,147 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hardware.light; + +const uint8 LIGHT_NAME_LEN = 32; + +enum Capability { + /// This capability indicates that the light supports setting brightness to a uint8_t value. + /// If this capability is not supported, the light only supports off and on state. + BRIGHTNESS = 1; + /// This capability indicates that the light supports setting an RGB value. + RGB = 2; + /// No capabilities + SIMPLE = 3; +}; + +struct Rgb { + uint8 red; + uint8 green; + uint8 blue; +}; + +struct Info { + string:LIGHT_NAME_LEN name; + Capability capability; +}; + +struct GroupInfo { + string:LIGHT_NAME_LEN name; + uint32 count; + Capability capability; +}; + +enum LightError { + OK = 0; + NOT_SUPPORTED = 1; + INVALID_INDEX = 2; + FAILED = 3; +}; + +[Discoverable] +protocol Light { + /// Returns the total number of physical lights. + /// This will typically be 1 for a simple LED light, but may be greater than one for an array of + /// lights or a more complicated lighting device. + /// The multiple lights are addressed using "index" parameter in the calls below. + GetNumLights() -> (uint32 count); + + /// Returns the total number of light groups (does not count single lights). + /// The light groups are addressed using "group_id" parameter in the calls below. + GetNumLightGroups() -> (uint32 count); + + /// Returns info for the single light. + /// index: Index of the light defined by board. Must be less than value returned by GetNumLights. + GetInfo(uint32 index) -> (Info info) error LightError; + + /// Returns the current value. If the light is ON, the value is True. If the light is OFF, + /// the value is False. + /// If the capability 'SIMPLE' is not supported by this light, returns NOT_SUPPORTED. + /// Use GetInfo to check if light supports this operation. + /// index: a number between 0 inclusive and the count received from GetNumLights. + GetCurrentSimpleValue(uint32 index) -> (bool value) error LightError; + + /// Sets the current value. Value should be set to 'TRUE' to turn on the light. Value should be + /// set to 'FALSE' to turn off the light. + /// If the capability 'SIMPLE' is not supported by this light, returns NOT_SUPPORTED. + /// Use GetInfo to check if light supports this operation. + /// index: a number between 0 inclusive and the count received from GetNumLights. + SetSimpleValue(uint32 index, bool value) -> () error LightError; + + /// Returns the current brightness value (0 - 255) of the light indicated by index. + /// If the capability 'BRIGHTNESS' is not supported by this light, returns NOT_SUPPORTED. + /// Use GetInfo to check if light supports this operation. + /// index: a number between 0 inclusive and the count received from GetNumLights. + GetCurrentBrightnessValue(uint32 index) -> (uint8 value) error LightError; + + /// Sets the current brightness value (0 - 255). + /// If the capability 'BRIGHTNESS' is not supported by this light, returns NOT_SUPPORTED. + /// Use GetInfo to check if light supports this operation. + /// index: a number between 0 inclusive and the count received from GetNumLights. + SetBrightnessValue(uint32 index, uint8 value) -> () error LightError; + + /// Returns the current RGB value for the single light. + /// If the capability 'RGB' is not supported by this light, returns NOT_SUPPORTED. + /// Use GetInfo to check if light supports this operation. + /// index: a number between 0 inclusive and the count received from GetNumLights. + GetCurrentRgbValue(uint32 index) -> (Rgb value) error LightError; + + /// Sets the current RGB value. + /// If the capability 'RGB' is not supported by this light, returns NOT_SUPPORTED. + /// Use GetInfo to check if light supports this operation. + /// index: a number between 0 inclusive and the count received from GetNumLights. + SetRgbValue(uint32 index, Rgb value) -> () error LightError; + + /// Returns group info for the light group. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + GetGroupInfo(uint32 group_id) -> (GroupInfo info) error LightError; + + /// Returns an array of the current values.If the light is ON, the value is True. If the light + /// is OFF, the value is False. + /// If group_id is invalid, INVALID_INDEX will be returned. + /// If the capability 'SIMPLE' is not supported by this group, returns NOT_SUPPORTED. + /// Use GetGroupInfo to check if group supports this operation. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + GetGroupCurrentSimpleValue(uint32 group_id) -> (vector<bool>:MAX? values) error LightError; + + /// Sets the current values through the values array. Value should be set to 'TRUE' to turn on + /// the light. Value should be set to 'FALSE' to turn off the light. + /// If group_id is invalid, INVALID_INDEX will be returned. + /// If the capability 'SIMPLE' is not supported by this group, returns NOT_SUPPORTED. + /// Use GetGroupInfo to check if group supports this operation. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + SetGroupSimpleValue(uint32 group_id, vector<bool>:MAX values) -> () error LightError; + + /// Returns an array of the current brightness values (0 - 255) for the light group. + /// If group_id is invalid, INVALID_INDEX will be returned. + /// If the capability 'BRIGHTNESS' is not supported by this group, returns NOT_SUPPORTED. + /// Use GetGroupInfo to check if group supports this operation. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + GetGroupCurrentBrightnessValue(uint32 group_id) -> (vector<uint8>:MAX? values) error LightError; + + /// Sets the current brightness values (0 - 255) for the light group through the values array. + /// If group_id is invalid, INVALID_INDEX will be returned. + /// If the capability 'BRIGHTNESS' is not supported by this group, returns NOT_SUPPORTED. + /// Use GetGroupInfo to check if group supports this operation. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + SetGroupBrightnessValue(uint32 group_id, vector<uint8>:MAX values) -> () error LightError; + + /// Returns an array of the current RGB values for the light group. + /// If group_id is invalid, INVALID_INDEX will be returned. + /// If the capability 'RGB' is not supported by this group, returns NOT_SUPPORTED. + /// Use GetGroupInfo to check if group supports this operation. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + GetGroupCurrentRgbValue(uint32 group_id) -> (vector<Rgb>:MAX? values) error LightError; + + /// Sets the current RGB value for the light group. + /// If group_id is invalid, INVALID_INDEX will be returned. + /// If the capability 'RGB' is not supported by this group, returns NOT_SUPPORTED. + /// Use GetGroupInfo to check if group supports this operation. + /// group_id: a number between 0 inclusive and the count received from GetNumLightGroups. + SetGroupRgbValue(uint32 group_id, vector<Rgb>:MAX values) -> () error LightError; + + // TODO: Ideas for future expansion + // - Hardware blinking configuration, for lights that have hardware or MCU support for blinking. +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/meta.json new file mode 100644 index 0000000..8a2fceb --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.light/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.hardware.light", + "root": "fidl/fuchsia.hardware.light", + "sources": [ + "fidl/fuchsia.hardware.light/light.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/BUILD.gn new file mode 100644 index 0000000..26d96cf --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.hardware.power.statecontrol") { + library_name = "statecontrol" + namespace = "fuchsia.hardware.power" + public_deps = [ + ] + sources = [ + "admin.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.hardware.power.statecontrol", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/admin.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/admin.fidl new file mode 100644 index 0000000..05f3ac8 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/admin.fidl
@@ -0,0 +1,40 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hardware.power.statecontrol; + +using zx; + +/// All available suspend flags. +// TODO(fxb/42257): When all clients start using the system power state +// these flags can be removed. +const uint32 SUSPEND_FLAG_REBOOT = 0xdcdc0100; +const uint32 SUSPEND_FLAG_REBOOT_BOOTLOADER = 0xdcdc0101; +const uint32 SUSPEND_FLAG_REBOOT_RECOVERY = 0xdcdc0102; +const uint32 SUSPEND_FLAG_POWEROFF = 0xdcdc0200; +const uint32 SUSPEND_FLAG_MEXEC = 0xdcdc0300; +const uint32 SUSPEND_FLAG_SUSPEND_RAM = 0xdcdc0400; + +// TODO(ravoorir): When the system power states are properly defined, +// remove the suspend flags. For now, treat each suspend flag as a system +// power state. +enum SystemPowerState : uint8 { + FULLY_ON = 1; + REBOOT = 2; + REBOOT_BOOTLOADER = 3; + REBOOT_RECOVERY = 4; + POWEROFF = 5; + MEXEC = 6; + SUSPEND_RAM = 7; +}; +const uint32 MAX_SYSTEM_POWER_STATES = 7; + +/// Provides administration services for the device manager service and the device tree it controls. +[Discoverable] +protocol Admin { + /// Ask all devices to enter into the system power state indicated by 'state'. + /// The devices will get into a low power state, that corresponds to the system + /// power state 'state'. + Suspend(SystemPowerState state) -> () error zx.status; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/meta.json new file mode 100644 index 0000000..7b32917 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hardware.power.statecontrol/meta.json
@@ -0,0 +1,9 @@ +{ + "deps": [], + "name": "fuchsia.hardware.power.statecontrol", + "root": "fidl/fuchsia.hardware.power.statecontrol", + "sources": [ + "fidl/fuchsia.hardware.power.statecontrol/admin.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/BUILD.gn new file mode 100644 index 0000000..d7609a7 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.hwinfo") { + library_name = "hwinfo" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.intl", + ] + sources = [ + "hwinfo.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.hwinfo", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/hwinfo.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/hwinfo.fidl new file mode 100644 index 0000000..ab23350 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/hwinfo.fidl
@@ -0,0 +1,59 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.hwinfo; +using fuchsia.intl; + +const uint8 MAX_VALUE_LENGTH = 255; + +/// Collection of properties that is unique per device. +table DeviceInfo { + 1: string serial_number; +}; + +/// Collection of properties that is shared with other devices within the same +/// product line. +table ProductInfo { + 1: string sku; + 2: string language; + 3: fuchsia.intl.RegulatoryDomain regulatory_domain; + 4: vector<fuchsia.intl.LocaleId> locale_list; + 5: string name; + 6: string model; + 7: string manufacturer; + 8: string build_date; + 9: string:MAX_VALUE_LENGTH build_name; + 10: string:MAX_VALUE_LENGTH colorway; + 11: string:MAX_VALUE_LENGTH display; + 12: string:MAX_VALUE_LENGTH memory; + 13: string:MAX_VALUE_LENGTH nand_storage; + 14: string:MAX_VALUE_LENGTH emmc_storage; + 15: string:MAX_VALUE_LENGTH microphone; + 16: string:MAX_VALUE_LENGTH audio_amplifier; +}; + +/// Collection of properties that are common among a set of devices based on +/// hardware type +table BoardInfo { + 1: string name; + 2: string revision; +}; + +/// Device provides an interface to retrieve device-specific properties. +[Discoverable] +protocol Device { + GetInfo() -> (DeviceInfo info); +}; + +/// Product provides an interface to retrieve product-specific properties. +[Discoverable] +protocol Product { + GetInfo() -> (ProductInfo info); +}; + +/// Board provides an interface to retrieve hardware-specific information. +[Discoverable] +protocol Board { + GetInfo() -> (BoardInfo info); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/meta.json new file mode 100644 index 0000000..ee88763 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.hwinfo/meta.json
@@ -0,0 +1,11 @@ +{ + "deps": [ + "fuchsia.intl" + ], + "name": "fuchsia.hwinfo", + "root": "fidl/fuchsia.hwinfo", + "sources": [ + "fidl/fuchsia.hwinfo/hwinfo.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.images/BUILD.gn new file mode 100644 index 0000000..345b605 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/BUILD.gn
@@ -0,0 +1,31 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.images") { + library_name = "images" + namespace = "fuchsia" + public_deps = [ + "../fuchsia.sysmem", + ] + sources = [ + "encoded_image.fidl", + "image_info.fidl", + "image_pipe.fidl", + "image_pipe2.fidl", + "memory_type.fidl", + "presentation_info.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.images", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/encoded_image.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.images/encoded_image.fidl new file mode 100644 index 0000000..d8cad1d --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/encoded_image.fidl
@@ -0,0 +1,12 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.images; + +struct EncodedImage { + /// The vmo. + handle<vmo> vmo; + /// The size of the image in the vmo in bytes. + uint64 size; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/image_info.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.images/image_info.fidl new file mode 100644 index 0000000..1a77e28 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/image_info.fidl
@@ -0,0 +1,139 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.images; + +/// Specifies how pixels are represented in the image buffer. +enum PixelFormat { + /// BGRA_8 + /// + /// A 32-bit four-component unsigned integer format. + /// Byte order: B, G, R, A (little-endian ARGB packed 32-bit word). + /// Equivalent to Skia `kBGRA_8888_SkColorType` color type. + /// Equivalent to Zircon `ARGB_8888` pixel format on little-endian arch. + BGRA_8 = 0; + + /// YUY2 + /// + /// 4:2:2 (2x down-sampled UV horizontally; full res UV vertically) + /// + /// A 32-bit component that contains information for 2 pixels: + /// Byte order: Y1, U, Y2, V + /// Unpacks to 2 RGB pixels, where RGB1 = func(Y1, U, V) + /// and RGB2 = func(Y2, U, V) + /// Equivalent to YUV422 + YUY2 = 1; + + /// NV12 + /// + /// 4:2:0 (2x down-sampled UV in both directions) + /// + /// Offset 0: + /// 8 bit per pixel Y plane with bytes YYY. + /// Offset height * stride: + /// 8 bit UV data interleaved bytes as UVUVUV. + /// + /// Y plane has line stride >= width. + /// + /// In this context, both width and height are required to be even. + /// + /// The UV data is separated into "lines", with each "line" having same byte + /// width as a line of Y data, and same "line" stride as Y data's line stride. + /// The UV data has height / 2 "lines". + /// + /// In converting to RGB, the UV data gets up-scaled by 2x in both directions + /// overall. This comment is intentionally silent on exactly how UV up-scaling + /// phase/filtering/signal processing works, as it's a complicated topic that + /// can vary by implementation, typically trading off speed and quality of the + /// up-scaling. See comments in relevant conversion code for approach taken + /// by any given convert path. The precise relative phase of the UV data is + /// not presently conveyed. + NV12 = 2; + + /// YV12 + /// + /// Like I420, except with V and U swapped. + /// + /// 4:2:0 (2x down-sampled UV in both directions) + /// + /// Offset 0: + /// 8 bit per pixel Y plane with bytes YYY. + /// Offset height * stride: + /// 8 bit V data with uv_stride = stride / 2 + /// Offset height * stride + uv_stride * height / 2: + /// 8 bit U data with uv_stride = stride / 2 + /// + /// Y plane has line stride >= width. + /// + /// Both width and height are required to be even. + YV12 = 3; +}; + +/// Specifies how pixel color information should be interpreted. +enum ColorSpace { + SRGB = 0; +}; + +/// Specifies how pixels are arranged in memory. +enum Tiling { + /// Pixels are packed linearly. + /// Equivalent to `VK_IMAGE_TILING_LINEAR`. + LINEAR = 0; + + /// Pixels are packed in a GPU-dependent optimal format. + /// Equivalent to `VK_IMAGE_TILING_OPTIMAL`. + GPU_OPTIMAL = 1; +}; + +/// Specifies how alpha information should be interpreted. +enum AlphaFormat { + /// Image is considered to be opaque. Alpha channel is ignored. + /// Blend function is: src.RGB + OPAQUE = 0; + /// Color channels have been premultiplied by alpha. + /// Blend function is: src.RGB + (dest.RGB * (1 - src.A)) + PREMULTIPLIED = 1; + /// Color channels have not been premultiplied by alpha. + /// Blend function is: (src.RGB * src.A) + (dest.RGB * (1 - src.A)) + NON_PREMULTIPLIED = 2; +}; + +enum Transform { + /// Pixels are displayed normally. + NORMAL = 0; + + /// Pixels are mirrored left-right. + FLIP_HORIZONTAL = 1; + + /// Pixels are flipped vertically. + FLIP_VERTICAL = 2; + + /// Pixels are flipped vertically and mirrored left-right. + FLIP_VERTICAL_AND_HORIZONTAL = 3; +}; + +/// Information about a graphical image (texture) including its format and size. +struct ImageInfo { + /// Specifies if the image should be mirrored before displaying. + Transform transform = Transform.NORMAL; + + /// The width and height of the image in pixels. + uint32 width; + uint32 height; + + /// The number of bytes per row in the image buffer. + uint32 stride; + + /// The pixel format of the image. + PixelFormat pixel_format = PixelFormat.BGRA_8; + + /// The pixel color space. + ColorSpace color_space = ColorSpace.SRGB; + + /// The pixel arrangement in memory. + Tiling tiling = Tiling.LINEAR; + + /// Specifies the interpretion of the alpha channel, if one exists. + AlphaFormat alpha_format = AlphaFormat.OPAQUE; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/image_pipe.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.images/image_pipe.fidl new file mode 100644 index 0000000..6c8695b --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/image_pipe.fidl
@@ -0,0 +1,121 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.images; + +/// ImagePipe is a mechanism for streaming shared images between a producer +/// and a consumer which may be running in different processes. +/// +/// Conceptually, the image pipe maintains a table of image resources supplied +/// by the producer into which graphical content may be stored as well as a +/// presentation queue containing a sequence of images which the producer has +/// asked the consumer to present. +/// +/// The presentation queue is initially empty. +/// +/// Each entry in the presentation queue consists of an image together with a +/// pair of optional synchronization fences: +/// - Acquire fence: signaled by the producer when the image is ready to be consumed +/// - Release fence: signaled by the consumer when the image is free to be freed or +/// modified by the producer +/// +/// The producer performs the following sequence of steps to present content: +/// - Allocate and add some number of images (often 2 or 3) to the image pipe +/// to establish a pool using `AddImage()`. +/// - Obtain the next available image from the pool. +/// - Ask the consumer to enqueue an image for presentation and provide fences +/// using `PresentImage()`. +/// - Start rendering the image. +/// - Signal the image's acquire fence when rendering is complete. +/// - Loop to present more image, listen for signals on release fences to recycle +/// images back into the pool. +/// +/// The consumer performs the following sequence of steps for each image which +/// is enqueued in the presentation queue: +/// - Await signals on the image's acquire fence. +/// - If the fence wait cannot be satisfied or if some other error is detected, +/// close the image pipe. +/// Otherwise, begin presenting the image's content. +/// - Retire the previously presented image (if any) from the presentation queue +/// and signal its release fence when no longer needed. +/// - Continue presenting the same image until the next one is ready. Loop. +/// +/// If the producer wants to close the image pipe, it should: +/// - Close its side of the connection. +/// - Wait on all release fences for buffers that it has submitted with +/// `PresentImage()`. +/// - Proceed with resource cleanup. +/// +/// When the consumer detects the image pipe has closed, it should: +/// - Stop using/presenting any images from the pipe. +/// - Unmap all VMOs associated with the images in the pipe. +/// - Close all handles to the VMOs. +/// - Signal all release fences for presented and queued buffers. +/// - Close all handles to fences. +/// - Close its side of the connection. +/// +/// When either party detects that a fence has been abandoned (remotely closed +/// without being signaled) it should assume that the associated image is in +/// an indeterminate state. This will typically happen when the other party +/// (or one of its delegates) has crashed. The safest course of action is to +/// close the image pipe, release all resources which were shared with the +/// other party, and re-establish the connection to recover. +protocol ImagePipe { + /// Adds an image resource to image pipe. + /// + /// The `memory` is the handle of a memory object which contains the image + /// data. It is valid to create multiple images backed by the same memory + /// object; they may even overlap. Consumers must detect this and handle + /// it accordingly. The `offset_bytes` indicates the offset within the + /// memory object at which the image data begins. The `size_bytes` + /// indicates the amount of memory from `memory` that should be utilized. + /// The type of memory stored in the VMO is `memory_type` (e.g. GPU memory, + /// host memory). + /// + /// The following errors will cause the connection to be closed: + /// - `image_id` is already registered + /// - `image_info` represents a format not supported by the consumer + /// - `memory` is not a handle for a readable VMO + /// - the image data expected at `offset_bytes` according to the `image_info` + /// exceeds the memory object's bounds + AddImage(uint32 image_id, ImageInfo image_info, + handle<vmo> memory, uint64 offset_bytes, uint64 size_bytes, MemoryType memory_type); + + /// Removes an image resource from the pipe. + /// + /// The `image_id` is detached from the image resource and is free to be + /// reused to add a new image resource. + /// + /// Removing an image from the image pipe does not affect the presentation + /// queue or the currently presented image. + /// + /// The producer must wait for all release fences associated with the image to + /// be signaled before freeing or modifying the underlying memory object since + /// the image may still be in use in the presentation queue. + /// + /// The following errors will cause the connection to be closed: + /// - `image_id` does not reference a currently registered image resource + RemoveImage(uint32 image_id); + + /// Enqueues the specified image for presentation by the consumer. + /// + /// The `acquire_fences` are a set of fences which must all be signaled by the + /// producer before the consumer presents the image. + /// The `release_fences` are set of fences which must all be signaled by the + /// consumer before it is safe for the producer to free or modify the image. + /// `presentation_time` specifies the time on or after which the + /// client would like the enqueued operations should take visible effect + /// (light up pixels on the screen), expressed in nanoseconds in the + /// `CLOCK_MONOTONIC` timebase. Desired presentation times must be + /// monotonically non-decreasing. + /// + /// `presentation_info` returns timing information about the submitted frame + /// and future frames (see presentation_info.fidl). + /// + /// The following errors will cause the connection to be closed: + /// - `image_id` does not reference a currently registered image resource + PresentImage(uint32 image_id, uint64 presentation_time, + vector<handle<event>> acquire_fences, vector<handle<event>> release_fences) + -> (PresentationInfo presentation_info); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/image_pipe2.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.images/image_pipe2.fidl new file mode 100644 index 0000000..f684f38 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/image_pipe2.fidl
@@ -0,0 +1,166 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.images; + +using fuchsia.sysmem; + +// A maximum of 16 fences is enough for the current usage of these APIs. +const int32 MAX_ACQUIRE_RELEASE_FENCE_COUNT = 16; + +/// ImagePipe is a mechanism for streaming shared images between a producer +/// and a consumer which may be running in different processes. +/// +/// Conceptually, the image pipe maintains a table of image resources supplied +/// by the producer into which graphical content may be stored as well as a +/// presentation queue containing a sequence of images which the producer has +/// asked the consumer to present. +/// +/// The presentation queue is initially empty. +/// +/// Each entry in the presentation queue consists of an image together with a +/// pair of optional synchronization fences: +/// - Acquire fence: signaled by the producer when the image is ready to be consumed +/// - Release fence: signaled by the consumer when the image is free to be freed or +/// modified by the producer +/// +/// The producer performs the following sequence of steps to present content: +/// - Allocate and add some number of BufferCollections to the image pipe to allow +/// consumer to set constraints. +/// - Allocate and add some number of images (often 2 or 3) to the image pipe +/// to establish a pool using `AddImage()`. +/// - Obtain the next available image from the pool. +/// - Ask the consumer to enqueue an image for presentation and provide fences +/// using `PresentImage()`. +/// - Start rendering the image. +/// - Signal the image's acquire fence when rendering is complete. +/// - Loop to present more image, listen for signals on release fences to recycle +/// images back into the pool. +/// +/// The consumer performs the following sequence of steps for each image which +/// is enqueued in the presentation queue: +/// - Await signals on the image's acquire fence. +/// - If the fence wait cannot be satisfied or if some other error is detected, +/// close the image pipe. +/// Otherwise, begin presenting the image's content. +/// - Retire the previously presented image (if any) from the presentation queue +/// and signal its release fence when no longer needed. +/// - Continue presenting the same image until the next one is ready. Loop. +/// +/// If the producer wants to close the image pipe, it should: +/// - Close its side of the connection. +/// - Wait on all release fences for buffers that it has submitted with +/// `PresentImage()`. +/// - Proceed with resource cleanup. +/// +/// When the consumer detects the image pipe has closed, it should: +/// - Stop using/presenting any images from the pipe. +/// - Unmap all memory objects associated with the images in the pipe. +/// - Close all BufferCollection resources. +/// - Signal all release fences for presented and queued buffers. +/// - Close all handles to fences. +/// - Close its side of the connection. +/// +/// When either party detects that a fence has been abandoned (remotely closed +/// without being signaled) it should assume that the associated image is in +/// an indeterminate state. This will typically happen when the other party +/// (or one of its delegates) has crashed. The safest course of action is to +/// close the image pipe, release all resources which were shared with the +/// other party, and re-establish the connection to recover. +protocol ImagePipe2 { + /// Adds a BufferCollection resource to the image pipe. + /// + /// The producer is expected to set constraints on this resource for images added + /// via `AddImage()`. The consumer can set its constraints on + /// `buffer_collection_token` before or after. Note that the buffers won’t be + /// allocated until all BufferCollectionToken instances are used to set + /// constraints, on both the producer and consumer side. See collection.fidl for + /// details. + /// + /// The following errors will cause the connection to be closed: + /// - `buffer_collection_id` is already registered + AddBufferCollection(uint32 buffer_collection_id, + fuchsia.sysmem.BufferCollectionToken buffer_collection_token); + + /// Adds an image resource to image pipe. + /// + /// `buffer_collection_id` refers to the BufferCollectionToken instance that is + /// registered via `AddBufferCollection()`. The underlying memory objects allocated + /// are used to address to the image data. `buffer_collection_id` refers to the + /// index of the memory object allocated in BufferCollection. + /// + /// `image_format` specifiies image properties. `coded_width` and `coded_height` are + /// used to set image dimensions. + /// + /// It is valid to create multiple images backed by the same memory object; they + /// may even overlap. Consumers must detect this and handle it accordingly. + /// + /// The following errors will cause the connection to be closed: + /// - `image_id` is already registered + /// - `buffer_collection_id` refers to an unregistered BufferCollection. + /// - `buffer_collection_index` points to a resource index out of the initialized + /// BufferCollection bounds + /// - No resource is allocated in the registered BufferCollection. + AddImage(uint32 image_id, uint32 buffer_collection_id, uint32 buffer_collection_index, + fuchsia.sysmem.ImageFormat_2 image_format); + + /// Removes a BufferCollection resource from the pipe. + /// + /// The `buffer_collection_id` resource is detached as well as all Images that are + /// associated with that BufferCollection. Leads to the same results as calling + /// `RemoveImage()` on all Images for `buffer_collection_id`. + /// + /// The producer must wait for all release fences associated with the Images to + /// be signaled before freeing or modifying the underlying memory object since + /// the image may still be in use in the presentation queue. + /// + /// The following errors will cause the connection to be closed: + /// - `buffer_collection_id` does not reference a currently registered BufferCollection + RemoveBufferCollection(uint32 buffer_collection_id); + + /// Removes an image resource from the pipe. + /// + /// The `image_id` is detached from the image resource and is free to be + /// reused to add a new image resource. + /// + /// Removing an image from the image pipe does not affect the presentation + /// queue or the currently presented image. + /// + /// The producer must wait for all release fences associated with the image to + /// be signaled before freeing or modifying the underlying memory object since + /// the image may still be in use in the presentation queue. + /// + /// The following errors will cause the connection to be closed: + /// - `image_id` does not reference a currently registered image resource + RemoveImage(uint32 image_id); + + /// Enqueues the specified image for presentation by the consumer. + /// + /// The `acquire_fences` are a set of fences which must all be signaled by the + /// producer before the consumer presents the image. + /// The `release_fences` are set of fences which must all be signaled by the + /// consumer before it is safe for the producer to free or modify the image. + /// `presentation_time` specifies the time on or after which the + /// client would like the enqueued operations should take visible effect + /// (light up pixels on the screen), expressed in nanoseconds in the + /// `CLOCK_MONOTONIC` timebase. Desired presentation times must be + /// monotonically non-decreasing. + /// + /// `presentation_info` returns timing information about the submitted frame + /// and future frames (see presentation_info.fidl). + /// + /// The producer may decide not to signal `acquire_fences` for an image. + /// In that case, if a later image is enqueued and later image’s + /// `presentation_time` is reached, the consumer presents the later image when + /// later image’s `acquire_fences` are signaled. The consumer also signals + /// earlier image’s `release_fences` and removes it from the presentation queue. + /// This sequence works as a cancellation mechanism. + /// + /// The following errors will cause the connection to be closed: + /// - `image_id` does not reference a currently registered image resource + PresentImage(uint32 image_id, uint64 presentation_time, + vector<handle<event>>:MAX_ACQUIRE_RELEASE_FENCE_COUNT acquire_fences, + vector<handle<event>>:MAX_ACQUIRE_RELEASE_FENCE_COUNT release_fences) + -> (PresentationInfo presentation_info); +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/memory_type.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.images/memory_type.fidl new file mode 100644 index 0000000..e8ba269 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/memory_type.fidl
@@ -0,0 +1,15 @@ +// Copyright 2018 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.images; + +/// Specifies the type of VMO's memory. +enum MemoryType { + /// VMO is regular host CPU memory. + HOST_MEMORY = 0; + + /// VMO can be imported as a VkDeviceMemory by calling VkAllocateMemory with a + /// VkImportMemoryFuchsiaHandleInfoKHR wrapped in a VkMemoryAllocateInfo. + VK_DEVICE_MEMORY = 1; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/meta.json b/third_party/fuchsia-sdk/fidl/fuchsia.images/meta.json new file mode 100644 index 0000000..aa85887 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/meta.json
@@ -0,0 +1,16 @@ +{ + "deps": [ + "fuchsia.sysmem" + ], + "name": "fuchsia.images", + "root": "fidl/fuchsia.images", + "sources": [ + "fidl/fuchsia.images/encoded_image.fidl", + "fidl/fuchsia.images/image_info.fidl", + "fidl/fuchsia.images/image_pipe.fidl", + "fidl/fuchsia.images/image_pipe2.fidl", + "fidl/fuchsia.images/memory_type.fidl", + "fidl/fuchsia.images/presentation_info.fidl" + ], + "type": "fidl_library" +} \ No newline at end of file
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.images/presentation_info.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.images/presentation_info.fidl new file mode 100644 index 0000000..23f8ebd --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.images/presentation_info.fidl
@@ -0,0 +1,27 @@ +// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.images; + +/// Information returned by methods such as `ImagePipe.PresentImage()` and +/// `Session.Present()`, when the consumer begins preparing the first frame +/// which includes the presented content. +struct PresentationInfo { + /// The actual time at which the enqueued operations are anticipated to take + /// visible effect, expressed in nanoseconds in the `CLOCK_MONOTONIC` + /// timebase. + /// + /// This value increases monotonically with each new frame, typically in + /// increments of the `presentation_interval`. + uint64 presentation_time; + + /// The nominal amount of time which is anticipated to elapse between + /// successively presented frames, expressed in nanoseconds. When rendering + /// to a display, the interval will typically be derived from the display + /// refresh rate. + /// + /// This value is non-zero. It may vary from time to time, such as when + /// changing display modes. + uint64 presentation_interval; +};
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.input/BUILD.gn b/third_party/fuchsia-sdk/fidl/fuchsia.input/BUILD.gn new file mode 100644 index 0000000..73f013a --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.input/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# DO NOT MANUALLY EDIT! +# Generated by //scripts/sdk/gn/generate.py. + + +import("../../build/fidl_library.gni") + +fidl_library("fuchsia.input") { + library_name = "input" + namespace = "fuchsia" + public_deps = [ + ] + sources = [ + "keys.fidl", + ] +} + +group("all"){ + deps = [ + ":fuchsia.input", + ] +}
diff --git a/third_party/fuchsia-sdk/fidl/fuchsia.input/keys.fidl b/third_party/fuchsia-sdk/fidl/fuchsia.input/keys.fidl new file mode 100644 index 0000000..f6aed45 --- /dev/null +++ b/third_party/fuchsia-sdk/fidl/fuchsia.input/keys.fidl
@@ -0,0 +1,347 @@ +// Copyright 2020 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +library fuchsia.input; + +/// A Fuchsia key represents a control that can be pressed or released such as a key or +/// a button on a keyboard or another input device. +/// +/// The ordinal index for enum elements is derived from the USB HID Usage Tables at the +/// time of definition. It is a 32 bit unsigned integer representing the USB HID Usage +/// where the low 16 bits are the USB HID Usage ID and the high 16 bits are the +/// USB HID Usage Page. +/// +/// The descriptions for each value in the enum assume a US English keyboard layout. +/// Actual behavior varies by layout. +enum Key : uint32 { + /// Keyboard a and A + A = 0x00070004; + + /// Keyboard b and B + B = 0x00070005; + + /// Keyboard c and C + C = 0x00070006; + + /// Keyboard d and D + D = 0x00070007; + + /// Keyboard e and E + E = 0x00070008; + + /// Keyboard f and F + F = 0x00070009; + + /// Keyboard g and G + G = 0x0007000a; + + /// Keyboard h and H + H = 0x0007000b; + + /// Keyboard i and I + I = 0x0007000c; + + /// Keyboard j and J + J = 0x0007000d; + + /// Keyboard k and K + K = 0x0007000e; + + /// Keyboard l and L + L = 0x0007000f; + + /// Keyboard m and M + M = 0x00070010; + + /// Keyboard n and N + N = 0x00070011; + + /// Keyboard o and O +