Merge QP1A.190107.001

Change-Id: I0b2c0efe9a2c3c68a09666c8149011e31e2c80c8
diff --git a/Android.bp.UNUSED b/Android.bp.UNUSED
new file mode 100644
index 0000000..9c321eb
--- /dev/null
+++ b/Android.bp.UNUSED
@@ -0,0 +1,872 @@
+// DO NOT EDIT! This file was generated by
+// ../../fuchsia/scripts/gen_sdk_bp.py.
+// Any changes made to this file will be discarded.
+
+cc_defaults {
+    name: "fuchsia_cc_defaults",
+    c_std: "c11",
+    cflags: ["-Wno-unused-parameter"],
+    relative_install_path: "fuchsia",
+
+    // Only enable on fuchsia.
+    enabled: false,
+    target: {
+      fuchsia: {
+        enabled: true,
+      }
+    },
+}
+
+cc_library {
+  name: "libfuchsia.bluetooth.gatt",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.bluetooth.gatt"],
+  fidl_hdrs: ["fuchsia.bluetooth.gatt"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.bluetooth"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.bluetooth"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.bluetooth.gatt",
+  srcs: ["fidl/fuchsia.bluetooth.gatt/client.fidl","fidl/fuchsia.bluetooth.gatt/server.fidl","fidl/fuchsia.bluetooth.gatt/types.fidl"],
+  deps: ["fuchsia.bluetooth"],
+}
+
+cc_library {
+  name: "libfuchsia.bluetooth.le",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.bluetooth.le"],
+  fidl_hdrs: ["fuchsia.bluetooth.le"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.bluetooth.gatt","libfuchsia.bluetooth"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.bluetooth.gatt","libfuchsia.bluetooth"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.bluetooth.le",
+  srcs: ["fidl/fuchsia.bluetooth.le/central.fidl","fidl/fuchsia.bluetooth.le/peripheral.fidl","fidl/fuchsia.bluetooth.le/types.fidl"],
+  deps: ["fuchsia.bluetooth.gatt","fuchsia.bluetooth"],
+}
+
+cc_library {
+  name: "libfuchsia.bluetooth",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.bluetooth"],
+  fidl_hdrs: ["fuchsia.bluetooth"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.bluetooth",
+  srcs: ["fidl/fuchsia.bluetooth/status.fidl","fidl/fuchsia.bluetooth/nullables.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.developer.tiles",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.developer.tiles"],
+  fidl_hdrs: ["fuchsia.developer.tiles"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ui.app","libfuchsia.sys","libfuchsia.mem","libfuchsia.math"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ui.app","libfuchsia.sys","libfuchsia.mem","libfuchsia.math"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.developer.tiles",
+  srcs: ["fidl/fuchsia.developer.tiles/tiles.fidl"],
+  deps: ["fuchsia.ui.app","fuchsia.sys","fuchsia.mem","fuchsia.math"],
+}
+
+cc_library {
+  name: "libfuchsia.fonts",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.fonts"],
+  fidl_hdrs: ["fuchsia.fonts"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.fonts",
+  srcs: ["fidl/fuchsia.fonts/font_provider.fidl"],
+  deps: ["fuchsia.mem"],
+}
+
+cc_library {
+  name: "libfuchsia.images",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.images"],
+  fidl_hdrs: ["fuchsia.images"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.images",
+  srcs: ["fidl/fuchsia.images/encoded_image.fidl","fidl/fuchsia.images/image_info.fidl","fidl/fuchsia.images/image_pipe.fidl","fidl/fuchsia.images/memory_type.fidl","fidl/fuchsia.images/presentation_info.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.io",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.io"],
+  fidl_hdrs: ["fuchsia.io"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.io",
+  srcs: ["fidl/fuchsia.io/io.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.ldsvc",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ldsvc"],
+  fidl_hdrs: ["fuchsia.ldsvc"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ldsvc",
+  srcs: ["fidl/fuchsia.ldsvc/ldsvc.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.logger",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.logger"],
+  fidl_hdrs: ["fuchsia.logger"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.logger",
+  srcs: ["fidl/fuchsia.logger/logger.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.math",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.math"],
+  fidl_hdrs: ["fuchsia.math"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.math",
+  srcs: ["fidl/fuchsia.math/math.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.media",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.media"],
+  fidl_hdrs: ["fuchsia.media"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.media",
+  srcs: ["fidl/fuchsia.media/audio.fidl","fidl/fuchsia.media/audio_capturer.fidl","fidl/fuchsia.media/audio_device_enumerator.fidl","fidl/fuchsia.media/audio_renderer.fidl","fidl/fuchsia.media/gain_control.fidl","fidl/fuchsia.media/stream.fidl","fidl/fuchsia.media/stream_type.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.mediacodec",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.mediacodec"],
+  fidl_hdrs: ["fuchsia.mediacodec"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.mediacodec",
+  srcs: ["fidl/fuchsia.mediacodec/codec_common.fidl","fidl/fuchsia.mediacodec/codec_factory.fidl","fidl/fuchsia.mediacodec/codec.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.mem",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.mem"],
+  fidl_hdrs: ["fuchsia.mem"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.mem",
+  srcs: ["fidl/fuchsia.mem/buffer.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.net.http",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.net.http"],
+  fidl_hdrs: ["fuchsia.net.http"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.net.http",
+  srcs: ["fidl/fuchsia.net.http/client.fidl"],
+  deps: ["fuchsia.mem"],
+}
+
+cc_library {
+  name: "libfuchsia.net.oldhttp",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.net.oldhttp"],
+  fidl_hdrs: ["fuchsia.net.oldhttp"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.netstack","libzircon.ethernet","libfuchsia.net","libfuchsia.mem"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.netstack","libzircon.ethernet","libfuchsia.net","libfuchsia.mem"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.net.oldhttp",
+  srcs: ["fidl/fuchsia.net.oldhttp/http_error.fidl","fidl/fuchsia.net.oldhttp/http_header.fidl","fidl/fuchsia.net.oldhttp/http_service.fidl","fidl/fuchsia.net.oldhttp/url_body.fidl","fidl/fuchsia.net.oldhttp/url_loader.fidl","fidl/fuchsia.net.oldhttp/url_request.fidl","fidl/fuchsia.net.oldhttp/url_response.fidl"],
+  deps: ["fuchsia.netstack","zircon.ethernet","fuchsia.net","fuchsia.mem"],
+}
+
+cc_library {
+  name: "libfuchsia.net",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.net"],
+  fidl_hdrs: ["fuchsia.net"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.net",
+  srcs: ["fidl/fuchsia.net/connectivity.fidl","fidl/fuchsia.net/net.fidl","fidl/fuchsia.net/socket.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.netstack",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.netstack"],
+  fidl_hdrs: ["fuchsia.netstack"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libzircon.ethernet","libfuchsia.net"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libzircon.ethernet","libfuchsia.net"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.netstack",
+  srcs: ["fidl/fuchsia.netstack/netstack.fidl"],
+  deps: ["zircon.ethernet","fuchsia.net"],
+}
+
+cc_library {
+  name: "libfuchsia.process",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.process"],
+  fidl_hdrs: ["fuchsia.process"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ldsvc","libfuchsia.io"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ldsvc","libfuchsia.io"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.process",
+  srcs: ["fidl/fuchsia.process/launcher.fidl","fidl/fuchsia.process/resolver.fidl"],
+  deps: ["fuchsia.ldsvc","fuchsia.io"],
+}
+
+cc_library {
+  name: "libfuchsia.simplecamera",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.simplecamera"],
+  fidl_hdrs: ["fuchsia.simplecamera"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.images"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.images"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.simplecamera",
+  srcs: ["fidl/fuchsia.simplecamera/simple_camera.fidl"],
+  deps: ["fuchsia.images"],
+}
+
+cc_library {
+  name: "libfuchsia.sys",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.sys"],
+  fidl_hdrs: ["fuchsia.sys"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.sys",
+  srcs: ["fidl/fuchsia.sys/component_controller.fidl","fidl/fuchsia.sys/environment.fidl","fidl/fuchsia.sys/environment_controller.fidl","fidl/fuchsia.sys/flat_namespace.fidl","fidl/fuchsia.sys/job_provider.fidl","fidl/fuchsia.sys/launcher.fidl","fidl/fuchsia.sys/loader.fidl","fidl/fuchsia.sys/runner.fidl","fidl/fuchsia.sys/service_provider.fidl"],
+  deps: ["fuchsia.mem"],
+}
+
+cc_library {
+  name: "libfuchsia.sysinfo",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.sysinfo"],
+  fidl_hdrs: ["fuchsia.sysinfo"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.sysinfo",
+  srcs: ["fidl/fuchsia.sysinfo/sysinfo.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.ui.app",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.app"],
+  fidl_hdrs: ["fuchsia.ui.app"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.sys","libfuchsia.mem"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.sys","libfuchsia.mem"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.app",
+  srcs: ["fidl/fuchsia.ui.app/view_provider.fidl"],
+  deps: ["fuchsia.sys","fuchsia.mem"],
+}
+
+cc_library {
+  name: "libfuchsia.ui.gfx",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.gfx"],
+  fidl_hdrs: ["fuchsia.ui.gfx"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem","libfuchsia.math","libfuchsia.images"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem","libfuchsia.math","libfuchsia.images"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.gfx",
+  srcs: ["fidl/fuchsia.ui.gfx/commands.fidl","fidl/fuchsia.ui.gfx/display_info.fidl","fidl/fuchsia.ui.gfx/events.fidl","fidl/fuchsia.ui.gfx/hit.fidl","fidl/fuchsia.ui.gfx/nodes.fidl","fidl/fuchsia.ui.gfx/pose_buffer_provider.fidl","fidl/fuchsia.ui.gfx/renderer.fidl","fidl/fuchsia.ui.gfx/resources.fidl","fidl/fuchsia.ui.gfx/shapes.fidl","fidl/fuchsia.ui.gfx/types.fidl"],
+  deps: ["fuchsia.mem","fuchsia.math","fuchsia.images"],
+}
+
+cc_library {
+  name: "libfuchsia.ui.input",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.input"],
+  fidl_hdrs: ["fuchsia.ui.input"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.input",
+  srcs: ["fidl/fuchsia.ui.input/commands.fidl","fidl/fuchsia.ui.input/ime_service.fidl","fidl/fuchsia.ui.input/input_connection.fidl","fidl/fuchsia.ui.input/input_device_registry.fidl","fidl/fuchsia.ui.input/input_dispatcher.fidl","fidl/fuchsia.ui.input/input_event_constants.fidl","fidl/fuchsia.ui.input/input_events.fidl","fidl/fuchsia.ui.input/input_reports.fidl","fidl/fuchsia.ui.input/text_editing.fidl","fidl/fuchsia.ui.input/text_input.fidl","fidl/fuchsia.ui.input/usages.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.ui.policy",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.policy"],
+  fidl_hdrs: ["fuchsia.ui.policy"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ui.viewsv1token","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.mem","libfuchsia.math","libfuchsia.images"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ui.viewsv1token","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.mem","libfuchsia.math","libfuchsia.images"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.policy",
+  srcs: ["fidl/fuchsia.ui.policy/display_usage.fidl","fidl/fuchsia.ui.policy/presentation.fidl","fidl/fuchsia.ui.policy/presenter.fidl"],
+  deps: ["fuchsia.ui.viewsv1token","fuchsia.ui.input","fuchsia.ui.gfx","fuchsia.mem","fuchsia.math","fuchsia.images"],
+}
+
+cc_library {
+  name: "libfuchsia.ui.scenic",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.scenic"],
+  fidl_hdrs: ["fuchsia.ui.scenic"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem","libfuchsia.ui.views","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.math","libfuchsia.images","libfuchsia.sys","libfuchsia.ui.vectorial"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem","libfuchsia.ui.views","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.math","libfuchsia.images","libfuchsia.sys","libfuchsia.ui.vectorial"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.scenic",
+  srcs: ["fidl/fuchsia.ui.scenic/commands.fidl","fidl/fuchsia.ui.scenic/events.fidl","fidl/fuchsia.ui.scenic/scenic.fidl","fidl/fuchsia.ui.scenic/session.fidl"],
+  deps: ["fuchsia.mem","fuchsia.ui.views","fuchsia.ui.input","fuchsia.ui.gfx","fuchsia.math","fuchsia.images","fuchsia.sys","fuchsia.ui.vectorial"],
+}
+
+cc_library {
+  name: "libfuchsia.ui.vectorial",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.vectorial"],
+  fidl_hdrs: ["fuchsia.ui.vectorial"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.vectorial",
+  srcs: ["fidl/fuchsia.ui.vectorial/commands.fidl","fidl/fuchsia.ui.vectorial/events.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.ui.views",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.views"],
+  fidl_hdrs: ["fuchsia.ui.views"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.mem","libfuchsia.math","libfuchsia.images","libfuchsia.sys"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.mem","libfuchsia.math","libfuchsia.images","libfuchsia.sys"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.views",
+  srcs: ["fidl/fuchsia.ui.views/commands.fidl","fidl/fuchsia.ui.views/events.fidl"],
+  deps: ["fuchsia.ui.input","fuchsia.ui.gfx","fuchsia.mem","fuchsia.math","fuchsia.images","fuchsia.sys"],
+}
+
+cc_library {
+  name: "libfuchsia.ui.viewsv1",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.viewsv1"],
+  fidl_hdrs: ["fuchsia.ui.viewsv1"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem","libfuchsia.ui.viewsv1token","libfuchsia.ui.scenic","libfuchsia.ui.views","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.math","libfuchsia.images","libfuchsia.sys","libfuchsia.ui.vectorial"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.mem","libfuchsia.ui.viewsv1token","libfuchsia.ui.scenic","libfuchsia.ui.views","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.math","libfuchsia.images","libfuchsia.sys","libfuchsia.ui.vectorial"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.viewsv1",
+  srcs: ["fidl/fuchsia.ui.viewsv1/accessibility_view_inspector.fidl","fidl/fuchsia.ui.viewsv1/view_containers.fidl","fidl/fuchsia.ui.viewsv1/view_manager.fidl","fidl/fuchsia.ui.viewsv1/view_properties.fidl","fidl/fuchsia.ui.viewsv1/view_provider.fidl","fidl/fuchsia.ui.viewsv1/view_snapshot.fidl","fidl/fuchsia.ui.viewsv1/view_tree_token.fidl","fidl/fuchsia.ui.viewsv1/view_trees.fidl","fidl/fuchsia.ui.viewsv1/views.fidl"],
+  deps: ["fuchsia.mem","fuchsia.ui.viewsv1token","fuchsia.ui.scenic","fuchsia.ui.views","fuchsia.ui.input","fuchsia.ui.gfx","fuchsia.math","fuchsia.images","fuchsia.sys","fuchsia.ui.vectorial"],
+}
+
+cc_library {
+  name: "libfuchsia.ui.viewsv1token",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.ui.viewsv1token"],
+  fidl_hdrs: ["fuchsia.ui.viewsv1token"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.ui.viewsv1token",
+  srcs: ["fidl/fuchsia.ui.viewsv1token/view_token.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.wlan.minstrel",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.wlan.minstrel"],
+  fidl_hdrs: ["fuchsia.wlan.minstrel"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.wlan.minstrel",
+  srcs: ["fidl/fuchsia.wlan.minstrel/wlan_minstrel.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libfuchsia.wlan.mlme",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.wlan.mlme"],
+  fidl_hdrs: ["fuchsia.wlan.mlme"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.wlan.minstrel","libfuchsia.wlan.stats"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.wlan.minstrel","libfuchsia.wlan.stats"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.wlan.mlme",
+  srcs: ["fidl/fuchsia.wlan.mlme/wlan_mlme.fidl","fidl/fuchsia.wlan.mlme/wlan_mlme_ext.fidl"],
+  deps: ["fuchsia.wlan.minstrel","fuchsia.wlan.stats"],
+}
+
+cc_library {
+  name: "libfuchsia.wlan.service",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.wlan.service"],
+  fidl_hdrs: ["fuchsia.wlan.service"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.wlan.stats","libfuchsia.wlan.mlme","libfuchsia.wlan.minstrel"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default","libfuchsia.wlan.stats","libfuchsia.wlan.mlme","libfuchsia.wlan.minstrel"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.wlan.service",
+  srcs: ["fidl/fuchsia.wlan.service/wlan_service.fidl"],
+  deps: ["fuchsia.wlan.stats","fuchsia.wlan.mlme","fuchsia.wlan.minstrel"],
+}
+
+cc_library {
+  name: "libfuchsia.wlan.stats",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["fuchsia.wlan.stats"],
+  fidl_hdrs: ["fuchsia.wlan.stats"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "fuchsia.wlan.stats",
+  srcs: ["fidl/fuchsia.wlan.stats/wlan_stats.fidl"],
+  deps: [],
+}
+
+cc_library {
+  name: "libzircon.ethernet",
+  defaults: ["fuchsia_cc_defaults"],
+  fidl_srcs: ["zircon.ethernet"],
+  fidl_hdrs: ["zircon.ethernet"],
+  shared_libs: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+  export_shared_lib_headers: ["libfidl","libfidl_cpp_sync","libzx","libfit","libfidl-async","libasync","libfidl_cpp_base","libfidl_cpp","libasync-default"],
+}
+
+fidl_gen_cc {
+  name: "zircon.ethernet",
+  srcs: ["fidl/zircon.ethernet/ethernet.fidl"],
+  deps: [],
+}
+
+cc_prebuilt_library_shared {
+  name: "libasync-default",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libasync-default.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libasync-default.so"],
+    },
+  },
+  export_include_dirs: ["pkg/async-default/include"]
+}
+
+cc_library {
+  name: "libasync-loop-cpp",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/async-loop-cpp/loop_wrapper.cpp"],
+  local_include_dirs: ["pkg/async-loop-cpp/include"],
+  export_include_dirs: ["pkg/async-loop-cpp/include"],
+  shared_libs: ["libzx","libasync-loop","libasync-default","libasync"],
+  export_shared_lib_headers: ["libzx","libasync-loop","libasync-default","libasync"],
+}
+
+cc_library {
+  name: "libasync-loop",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/async-loop/loop.c"],
+  local_include_dirs: ["pkg/async-loop/include"],
+  export_include_dirs: ["pkg/async-loop/include"],
+  shared_libs: ["libasync-default","libasync"],
+  export_shared_lib_headers: ["libasync-default","libasync"],
+}
+
+cc_library {
+  name: "libasync",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/async/ops.c"],
+  local_include_dirs: ["pkg/async/include"],
+  export_include_dirs: ["pkg/async/include"],
+  shared_libs: [],
+  export_shared_lib_headers: [],
+}
+
+cc_prebuilt_library_shared {
+  name: "libfdio",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libfdio.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libfdio.so"],
+    },
+  },
+  export_include_dirs: ["pkg/fdio/include"]
+}
+
+cc_library {
+  name: "libfidl-async",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/fidl-async/bind.c"],
+  local_include_dirs: ["pkg/fidl-async/include"],
+  export_include_dirs: ["pkg/fidl-async/include"],
+  shared_libs: ["libfidl","libasync"],
+  export_shared_lib_headers: ["libfidl","libasync"],
+}
+
+cc_library {
+  name: "libfidl",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/fidl/builder.cpp","pkg/fidl/decoding.cpp","pkg/fidl/encoding.cpp","pkg/fidl/epitaph.c","pkg/fidl/formatting.cpp","pkg/fidl/handle_closing.cpp","pkg/fidl/message.cpp","pkg/fidl/message_buffer.cpp","pkg/fidl/message_builder.cpp","pkg/fidl/transport.cpp","pkg/fidl/validating.cpp"],
+  local_include_dirs: ["pkg/fidl/include"],
+  export_include_dirs: ["pkg/fidl/include"],
+  shared_libs: [],
+  export_shared_lib_headers: [],
+}
+
+cc_library {
+  name: "libfidl_cpp",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/fidl_cpp/internal/message_handler.cc","pkg/fidl_cpp/internal/message_reader.cc","pkg/fidl_cpp/internal/pending_response.cc","pkg/fidl_cpp/internal/proxy.cc","pkg/fidl_cpp/internal/proxy_controller.cc","pkg/fidl_cpp/internal/stub.cc","pkg/fidl_cpp/internal/stub_controller.cc","pkg/fidl_cpp/internal/weak_stub_controller.cc"],
+  local_include_dirs: ["pkg/fidl_cpp/include"],
+  export_include_dirs: ["pkg/fidl_cpp/include"],
+  shared_libs: ["libzx","libfit","libfidl-async","libfidl","libasync","libasync-default","libfidl_cpp_sync","libfidl_cpp_base"],
+  export_shared_lib_headers: ["libzx","libfit","libfidl-async","libfidl","libasync","libasync-default","libfidl_cpp_sync","libfidl_cpp_base"],
+}
+
+cc_library {
+  name: "libfidl_cpp_base",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/fidl_cpp_base/clone.cc","pkg/fidl_cpp_base/coding_traits.cc","pkg/fidl_cpp_base/decoder.cc","pkg/fidl_cpp_base/encoder.cc","pkg/fidl_cpp_base/internal/logging.cc","pkg/fidl_cpp_base/string.cc"],
+  local_include_dirs: ["pkg/fidl_cpp_base/include"],
+  export_include_dirs: ["pkg/fidl_cpp_base/include"],
+  shared_libs: ["libzx","libfidl-async","libfidl","libasync","libfit"],
+  export_shared_lib_headers: ["libzx","libfidl-async","libfidl","libasync","libfit"],
+}
+
+cc_library {
+  name: "libfidl_cpp_sync",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/fidl_cpp_sync/internal/synchronous_proxy.cc"],
+  local_include_dirs: ["pkg/fidl_cpp_sync/include"],
+  export_include_dirs: ["pkg/fidl_cpp_sync/include"],
+  shared_libs: ["libzx","libfit","libfidl-async","libfidl","libasync","libfidl_cpp_base"],
+  export_shared_lib_headers: ["libzx","libfit","libfidl-async","libfidl","libasync","libfidl_cpp_base"],
+}
+
+cc_library {
+  name: "libfit",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/fit/promise.cpp","pkg/fit/scheduler.cpp","pkg/fit/sequencer.cpp","pkg/fit/single_threaded_executor.cpp"],
+  local_include_dirs: ["pkg/fit/include"],
+  export_include_dirs: ["pkg/fit/include"],
+  shared_libs: [],
+  export_shared_lib_headers: [],
+}
+
+cc_library {
+  name: "libimages_cpp",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/images_cpp/images.cc"],
+  local_include_dirs: ["pkg/images_cpp/include"],
+  export_include_dirs: ["pkg/images_cpp/include"],
+  shared_libs: ["libfuchsia.images"],
+  export_shared_lib_headers: [],
+}
+
+cc_prebuilt_library_shared {
+  name: "libmemfs",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libmemfs.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libmemfs.so"],
+    },
+  },
+  export_include_dirs: ["pkg/memfs/include"]
+}
+
+cc_library {
+  name: "libscenic_cpp",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/scenic_cpp/commands.cc","pkg/scenic_cpp/host_image_cycler.cc","pkg/scenic_cpp/host_memory.cc","pkg/scenic_cpp/resources.cc","pkg/scenic_cpp/session.cc"],
+  local_include_dirs: ["pkg/scenic_cpp/include"],
+  export_include_dirs: ["pkg/scenic_cpp/include"],
+  shared_libs: ["libfuchsia.ui.scenic","libfuchsia.mem","libfuchsia.ui.views","libfuchsia.ui.input","libfuchsia.ui.gfx","libfuchsia.math","libfuchsia.images","libfuchsia.sys","libfuchsia.ui.vectorial","libzx","libfit","libimages_cpp","libfidl_cpp","libfidl-async","libfidl","libasync","libasync-default","libfidl_cpp_sync","libfidl_cpp_base"],
+  export_shared_lib_headers: ["libzx","libfit","libimages_cpp","libfuchsia.images","libfidl_cpp","libfidl-async","libfidl","libasync","libasync-default","libfidl_cpp_sync","libfidl_cpp_base"],
+}
+
+cc_prebuilt_library_shared {
+  name: "libsvc",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libsvc.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libsvc.so"],
+    },
+  },
+  export_include_dirs: ["pkg/svc/include"]
+}
+
+cc_prebuilt_library_static {
+  name: "libsync_fuchsia",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/lib/libsync.a"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/lib/libsync.a"],
+    },
+  },
+  export_include_dirs: ["pkg/sync/include"]
+}
+
+cc_prebuilt_library_shared {
+  name: "libsyslog",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libsyslog.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libsyslog.so"],
+    },
+  },
+  export_include_dirs: ["pkg/syslog/include"]
+}
+
+cc_prebuilt_library_shared {
+  name: "libtrace-engine",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libtrace-engine.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libtrace-engine.so"],
+    },
+  },
+  export_include_dirs: []
+}
+
+cc_prebuilt_library_shared {
+  name: "libvulkan_fuchsia",
+  defaults: ["fuchsia_cc_defaults"],
+  arch: {
+    x86_64: {
+      srcs: ["arch/x64/dist/libvulkan.so"],
+    },
+    arm64: {
+      srcs: ["arch/arm64/dist/libvulkan.so"],
+    },
+  },
+  export_include_dirs: []
+}
+
+cc_library {
+  name: "libzx",
+  defaults: ["fuchsia_cc_defaults"],
+  srcs: ["pkg/zx/bti.cpp","pkg/zx/channel.cpp","pkg/zx/debuglog.cpp","pkg/zx/event.cpp","pkg/zx/eventpair.cpp","pkg/zx/fifo.cpp","pkg/zx/guest.cpp","pkg/zx/interrupt.cpp","pkg/zx/iommu.cpp","pkg/zx/job.cpp","pkg/zx/log.cpp","pkg/zx/port.cpp","pkg/zx/process.cpp","pkg/zx/profile.cpp","pkg/zx/resource.cpp","pkg/zx/socket.cpp","pkg/zx/thread.cpp","pkg/zx/timer.cpp","pkg/zx/vcpu.cpp","pkg/zx/vmar.cpp","pkg/zx/vmo.cpp"],
+  local_include_dirs: ["pkg/zx/include"],
+  export_include_dirs: ["pkg/zx/include"],
+  shared_libs: [],
+  export_shared_lib_headers: [],
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_bootserver",
+  srcs: ["tools/bootserver"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_far",
+  srcs: ["tools/far"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_fidl-format",
+  srcs: ["tools/fidl-format"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_fidlc",
+  srcs: ["tools/fidlc"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_fidlgen",
+  srcs: ["tools/fidlgen"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_fvm",
+  srcs: ["tools/fvm"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_loglistener",
+  srcs: ["tools/loglistener"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_merkleroot",
+  srcs: ["tools/merkleroot"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_minfs",
+  srcs: ["tools/minfs"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_netaddr",
+  srcs: ["tools/netaddr"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_netcp",
+  srcs: ["tools/netcp"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_netls",
+  srcs: ["tools/netls"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_netruncmd",
+  srcs: ["tools/netruncmd"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_pm",
+  srcs: ["tools/pm"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_zbi",
+  srcs: ["tools/zbi"],
+  host_supported: true,
+}
+
+cc_prebuilt_binary {
+  name: "fuchsia_zxdb",
+  srcs: ["tools/zxdb"],
+  host_supported: true,
+}
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b63aee1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+Fuchsia SDK without the following packages that were removed to save space:
+- zxdb
+- images
diff --git a/arch/arm64/dist/libVkLayer_core_validation.so b/arch/arm64/dist/libVkLayer_core_validation.so
new file mode 100755
index 0000000..5369287
--- /dev/null
+++ b/arch/arm64/dist/libVkLayer_core_validation.so
Binary files differ
diff --git a/arch/arm64/dist/libVkLayer_image_pipe_swapchain.so b/arch/arm64/dist/libVkLayer_image_pipe_swapchain.so
new file mode 100755
index 0000000..bdd188d
--- /dev/null
+++ b/arch/arm64/dist/libVkLayer_image_pipe_swapchain.so
Binary files differ
diff --git a/arch/arm64/dist/libVkLayer_object_tracker.so b/arch/arm64/dist/libVkLayer_object_tracker.so
new file mode 100755
index 0000000..59ff73b
--- /dev/null
+++ b/arch/arm64/dist/libVkLayer_object_tracker.so
Binary files differ
diff --git a/arch/arm64/dist/libVkLayer_parameter_validation.so b/arch/arm64/dist/libVkLayer_parameter_validation.so
new file mode 100755
index 0000000..82c7711
--- /dev/null
+++ b/arch/arm64/dist/libVkLayer_parameter_validation.so
Binary files differ
diff --git a/arch/arm64/dist/libVkLayer_threading.so b/arch/arm64/dist/libVkLayer_threading.so
new file mode 100755
index 0000000..b763406
--- /dev/null
+++ b/arch/arm64/dist/libVkLayer_threading.so
Binary files differ
diff --git a/arch/arm64/dist/libVkLayer_unique_objects.so b/arch/arm64/dist/libVkLayer_unique_objects.so
new file mode 100755
index 0000000..263c719
--- /dev/null
+++ b/arch/arm64/dist/libVkLayer_unique_objects.so
Binary files differ
diff --git a/arch/arm64/dist/libasync-default.so b/arch/arm64/dist/libasync-default.so
new file mode 100755
index 0000000..c85b195
--- /dev/null
+++ b/arch/arm64/dist/libasync-default.so
Binary files differ
diff --git a/arch/arm64/dist/libfdio.so b/arch/arm64/dist/libfdio.so
new file mode 100755
index 0000000..1b2841f
--- /dev/null
+++ b/arch/arm64/dist/libfdio.so
Binary files differ
diff --git a/arch/arm64/dist/libmemfs.so b/arch/arm64/dist/libmemfs.so
new file mode 100755
index 0000000..3b1aa06
--- /dev/null
+++ b/arch/arm64/dist/libmemfs.so
Binary files differ
diff --git a/arch/arm64/dist/libsvc.so b/arch/arm64/dist/libsvc.so
new file mode 100755
index 0000000..3cb0539
--- /dev/null
+++ b/arch/arm64/dist/libsvc.so
Binary files differ
diff --git a/arch/arm64/dist/libsyslog.so b/arch/arm64/dist/libsyslog.so
new file mode 100755
index 0000000..495e797
--- /dev/null
+++ b/arch/arm64/dist/libsyslog.so
Binary files differ
diff --git a/arch/arm64/dist/libtrace-engine.so b/arch/arm64/dist/libtrace-engine.so
new file mode 100755
index 0000000..8ebaf73
--- /dev/null
+++ b/arch/arm64/dist/libtrace-engine.so
Binary files differ
diff --git a/arch/arm64/dist/libvulkan.so b/arch/arm64/dist/libvulkan.so
new file mode 100755
index 0000000..edd5b26
--- /dev/null
+++ b/arch/arm64/dist/libvulkan.so
Binary files differ
diff --git a/arch/arm64/lib/libasync-default.so b/arch/arm64/lib/libasync-default.so
new file mode 100755
index 0000000..48caaf4
--- /dev/null
+++ b/arch/arm64/lib/libasync-default.so
Binary files differ
diff --git a/arch/arm64/lib/libfdio.so b/arch/arm64/lib/libfdio.so
new file mode 100755
index 0000000..7d0bf9f
--- /dev/null
+++ b/arch/arm64/lib/libfdio.so
Binary files differ
diff --git a/arch/arm64/lib/libmemfs.so b/arch/arm64/lib/libmemfs.so
new file mode 100755
index 0000000..170585e
--- /dev/null
+++ b/arch/arm64/lib/libmemfs.so
Binary files differ
diff --git a/arch/arm64/lib/libsvc.so b/arch/arm64/lib/libsvc.so
new file mode 100755
index 0000000..3cb0539
--- /dev/null
+++ b/arch/arm64/lib/libsvc.so
Binary files differ
diff --git a/arch/arm64/lib/libsync.a b/arch/arm64/lib/libsync.a
new file mode 100644
index 0000000..caaf384
--- /dev/null
+++ b/arch/arm64/lib/libsync.a
Binary files differ
diff --git a/arch/arm64/lib/libsyslog.so b/arch/arm64/lib/libsyslog.so
new file mode 100755
index 0000000..1c2f5c8
--- /dev/null
+++ b/arch/arm64/lib/libsyslog.so
Binary files differ
diff --git a/arch/arm64/lib/libtrace-engine.so b/arch/arm64/lib/libtrace-engine.so
new file mode 100755
index 0000000..f661692
--- /dev/null
+++ b/arch/arm64/lib/libtrace-engine.so
Binary files differ
diff --git a/arch/arm64/lib/libvulkan.so b/arch/arm64/lib/libvulkan.so
new file mode 100755
index 0000000..edd5b26
--- /dev/null
+++ b/arch/arm64/lib/libvulkan.so
Binary files differ
diff --git a/arch/arm64/sysroot/debug/libc.so b/arch/arm64/sysroot/debug/libc.so
new file mode 100755
index 0000000..0bcdcd2
--- /dev/null
+++ b/arch/arm64/sysroot/debug/libc.so
Binary files differ
diff --git a/arch/arm64/sysroot/debug/libzircon.so b/arch/arm64/sysroot/debug/libzircon.so
new file mode 100755
index 0000000..5f4f11a
--- /dev/null
+++ b/arch/arm64/sysroot/debug/libzircon.so
Binary files differ
diff --git a/arch/arm64/sysroot/dist/lib/ld.so.1 b/arch/arm64/sysroot/dist/lib/ld.so.1
new file mode 100755
index 0000000..c414eff
--- /dev/null
+++ b/arch/arm64/sysroot/dist/lib/ld.so.1
Binary files differ
diff --git a/arch/arm64/sysroot/include/alloca.h b/arch/arm64/sysroot/include/alloca.h
new file mode 100644
index 0000000..c1679dd
--- /dev/null
+++ b/arch/arm64/sysroot/include/alloca.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/ar.h b/arch/arm64/sysroot/include/ar.h
new file mode 100644
index 0000000..d20348b
--- /dev/null
+++ b/arch/arm64/sysroot/include/ar.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/arpa/ftp.h b/arch/arm64/sysroot/include/arpa/ftp.h
new file mode 100644
index 0000000..e1b66d3
--- /dev/null
+++ b/arch/arm64/sysroot/include/arpa/ftp.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/arpa/inet.h b/arch/arm64/sysroot/include/arpa/inet.h
new file mode 100644
index 0000000..cfb02ea
--- /dev/null
+++ b/arch/arm64/sysroot/include/arpa/inet.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/arpa/nameser.h b/arch/arm64/sysroot/include/arpa/nameser.h
new file mode 100644
index 0000000..9218a58
--- /dev/null
+++ b/arch/arm64/sysroot/include/arpa/nameser.h
@@ -0,0 +1,448 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/arpa/nameser_compat.h b/arch/arm64/sysroot/include/arpa/nameser_compat.h
new file mode 100644
index 0000000..ee3b1a9
--- /dev/null
+++ b/arch/arm64/sysroot/include/arpa/nameser_compat.h
@@ -0,0 +1 @@
+#include <arpa/nameser.h>
diff --git a/arch/arm64/sysroot/include/arpa/telnet.h b/arch/arm64/sysroot/include/arpa/telnet.h
new file mode 100644
index 0000000..d6880cf
--- /dev/null
+++ b/arch/arm64/sysroot/include/arpa/telnet.h
@@ -0,0 +1,274 @@
+#pragma once
+
+#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]
diff --git a/arch/arm64/sysroot/include/arpa/tftp.h b/arch/arm64/sysroot/include/arpa/tftp.h
new file mode 100644
index 0000000..3a76d2f
--- /dev/null
+++ b/arch/arm64/sysroot/include/arpa/tftp.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/assert.h b/arch/arm64/sysroot/include/assert.h
new file mode 100644
index 0000000..02e96dc
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/aarch64/endian.h b/arch/arm64/sysroot/include/bits/aarch64/endian.h
new file mode 100644
index 0000000..7a74d2f
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/aarch64/fenv.h b/arch/arm64/sysroot/include/bits/aarch64/fenv.h
new file mode 100644
index 0000000..6bb1f56
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/aarch64/float.h b/arch/arm64/sysroot/include/bits/aarch64/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/aarch64/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/arch/arm64/sysroot/include/bits/aarch64/io.h b/arch/arm64/sysroot/include/bits/aarch64/io.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/aarch64/io.h
diff --git a/arch/arm64/sysroot/include/bits/aarch64/ioctl.h b/arch/arm64/sysroot/include/bits/aarch64/ioctl.h
new file mode 100644
index 0000000..f963024
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/aarch64/ipc.h b/arch/arm64/sysroot/include/bits/aarch64/ipc.h
new file mode 100644
index 0000000..df2ed2b
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/aarch64/reg.h b/arch/arm64/sysroot/include/bits/aarch64/reg.h
new file mode 100644
index 0000000..2633f39
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/aarch64/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/arch/arm64/sysroot/include/bits/aarch64/setjmp.h b/arch/arm64/sysroot/include/bits/aarch64/setjmp.h
new file mode 100644
index 0000000..e3db976
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/aarch64/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long int __jmp_buf[22];
diff --git a/arch/arm64/sysroot/include/bits/aarch64/signal.h b/arch/arm64/sysroot/include/bits/aarch64/signal.h
new file mode 100644
index 0000000..766d3f9
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/aarch64/signal.h
@@ -0,0 +1,105 @@
+#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/arch/arm64/sysroot/include/bits/aarch64/stat.h b/arch/arm64/sysroot/include/bits/aarch64/stat.h
new file mode 100644
index 0000000..0fe7e69
--- /dev/null
+++ b/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 __unused[2];
+};
diff --git a/arch/arm64/sysroot/include/bits/alltypes.h b/arch/arm64/sysroot/include/bits/alltypes.h
new file mode 100644
index 0000000..21fcb7f
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/alltypes.h
@@ -0,0 +1,521 @@
+#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 {
+    int _m_type;
+    __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/arch/arm64/sysroot/include/bits/endian.h b/arch/arm64/sysroot/include/bits/endian.h
new file mode 100644
index 0000000..ed44e80
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/errno.h b/arch/arm64/sysroot/include/bits/errno.h
new file mode 100644
index 0000000..b9ebc31
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/fcntl.h b/arch/arm64/sysroot/include/bits/fcntl.h
new file mode 100644
index 0000000..c96e45f
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/fenv.h b/arch/arm64/sysroot/include/bits/fenv.h
new file mode 100644
index 0000000..99ca0ba
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/float.h b/arch/arm64/sysroot/include/bits/float.h
new file mode 100644
index 0000000..45354da
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/float.h
@@ -0,0 +1,7 @@
+#if defined(__x86_64__)
+#include "x86_64/float.h"
+#elif defined(__aarch64__)
+#include "aarch64/float.h"
+#else
+#error Unsupported architecture!
+#endif
diff --git a/arch/arm64/sysroot/include/bits/io.h b/arch/arm64/sysroot/include/bits/io.h
new file mode 100644
index 0000000..480bbaf
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/ioctl.h b/arch/arm64/sysroot/include/bits/ioctl.h
new file mode 100644
index 0000000..d8bcfa3
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/ipc.h b/arch/arm64/sysroot/include/bits/ipc.h
new file mode 100644
index 0000000..a81d510
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/limits.h b/arch/arm64/sysroot/include/bits/limits.h
new file mode 100644
index 0000000..8d1910b
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/msg.h b/arch/arm64/sysroot/include/bits/msg.h
new file mode 100644
index 0000000..9b3f7e5
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/null.h b/arch/arm64/sysroot/include/bits/null.h
new file mode 100644
index 0000000..1788e0c
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/null.h
@@ -0,0 +1,12 @@
+// 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
+
+#pragma once
+
+// The compiler's <stddef.h> defines NULL without defining anything
+// else if __need_NULL is defined first.
+#define __need_NULL
+#include <stddef.h>
diff --git a/arch/arm64/sysroot/include/bits/poll.h b/arch/arm64/sysroot/include/bits/poll.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/poll.h
diff --git a/arch/arm64/sysroot/include/bits/posix.h b/arch/arm64/sysroot/include/bits/posix.h
new file mode 100644
index 0000000..8068ce9
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/reg.h b/arch/arm64/sysroot/include/bits/reg.h
new file mode 100644
index 0000000..ad220cc
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/resource.h b/arch/arm64/sysroot/include/bits/resource.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/resource.h
diff --git a/arch/arm64/sysroot/include/bits/sem.h b/arch/arm64/sysroot/include/bits/sem.h
new file mode 100644
index 0000000..d7aa74b
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/setjmp.h b/arch/arm64/sysroot/include/bits/setjmp.h
new file mode 100644
index 0000000..d42af58
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/shm.h b/arch/arm64/sysroot/include/bits/shm.h
new file mode 100644
index 0000000..8bb1c74
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/signal.h b/arch/arm64/sysroot/include/bits/signal.h
new file mode 100644
index 0000000..021a17f
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/socket.h b/arch/arm64/sysroot/include/bits/socket.h
new file mode 100644
index 0000000..aad18bf
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/stat.h b/arch/arm64/sysroot/include/bits/stat.h
new file mode 100644
index 0000000..308b256
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/statfs.h b/arch/arm64/sysroot/include/bits/statfs.h
new file mode 100644
index 0000000..656aa8d
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/termios.h b/arch/arm64/sysroot/include/bits/termios.h
new file mode 100644
index 0000000..1a06f76
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/x86_64/endian.h b/arch/arm64/sysroot/include/bits/x86_64/endian.h
new file mode 100644
index 0000000..172c338
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/x86_64/endian.h
@@ -0,0 +1 @@
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/arch/arm64/sysroot/include/bits/x86_64/fenv.h b/arch/arm64/sysroot/include/bits/x86_64/fenv.h
new file mode 100644
index 0000000..5cea203
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/x86_64/float.h b/arch/arm64/sysroot/include/bits/x86_64/float.h
new file mode 100644
index 0000000..f935e34
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/x86_64/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 0
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN 3.3621031431120935063e-4932L
+#define LDBL_MAX 1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/arch/arm64/sysroot/include/bits/x86_64/io.h b/arch/arm64/sysroot/include/bits/x86_64/io.h
new file mode 100644
index 0000000..bbfb2e6
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/x86_64/io.h
@@ -0,0 +1,77 @@
+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/arch/arm64/sysroot/include/bits/x86_64/ioctl.h b/arch/arm64/sysroot/include/bits/x86_64/ioctl.h
new file mode 100644
index 0000000..66525bf
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/x86_64/ipc.h b/arch/arm64/sysroot/include/bits/x86_64/ipc.h
new file mode 100644
index 0000000..b563143
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/x86_64/reg.h b/arch/arm64/sysroot/include/bits/x86_64/reg.h
new file mode 100644
index 0000000..12d43c5
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/bits/x86_64/setjmp.h b/arch/arm64/sysroot/include/bits/x86_64/setjmp.h
new file mode 100644
index 0000000..29336e4
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/x86_64/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long int __jmp_buf[9];
diff --git a/arch/arm64/sysroot/include/bits/x86_64/signal.h b/arch/arm64/sysroot/include/bits/x86_64/signal.h
new file mode 100644
index 0000000..529bbc4
--- /dev/null
+++ b/arch/arm64/sysroot/include/bits/x86_64/signal.h
@@ -0,0 +1,127 @@
+#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/arch/arm64/sysroot/include/bits/x86_64/stat.h b/arch/arm64/sysroot/include/bits/x86_64/stat.h
new file mode 100644
index 0000000..d3b3447
--- /dev/null
+++ b/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 __unused[3];
+};
diff --git a/arch/arm64/sysroot/include/byteswap.h b/arch/arm64/sysroot/include/byteswap.h
new file mode 100644
index 0000000..6350775
--- /dev/null
+++ b/arch/arm64/sysroot/include/byteswap.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x) {
+    return __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(__x)) << 32 | __bswap_32(__x >> 32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
diff --git a/arch/arm64/sysroot/include/complex.h b/arch/arm64/sysroot/include/complex.h
new file mode 100644
index 0000000..9761553
--- /dev/null
+++ b/arch/arm64/sysroot/include/complex.h
@@ -0,0 +1,135 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/cpio.h b/arch/arm64/sysroot/include/cpio.h
new file mode 100644
index 0000000..f921413
--- /dev/null
+++ b/arch/arm64/sysroot/include/cpio.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/crypt.h b/arch/arm64/sysroot/include/crypt.h
new file mode 100644
index 0000000..029698c
--- /dev/null
+++ b/arch/arm64/sysroot/include/crypt.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct crypt_data {
+    int initialized;
+    char __buf[256];
+};
+
+char* crypt(const char*, const char*);
+char* crypt_r(const char*, const char*, struct crypt_data*);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/ctype.h b/arch/arm64/sysroot/include/ctype.h
new file mode 100644
index 0000000..f4cd85b
--- /dev/null
+++ b/arch/arm64/sysroot/include/ctype.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/dirent.h b/arch/arm64/sysroot/include/dirent.h
new file mode 100644
index 0000000..0c463c4
--- /dev/null
+++ b/arch/arm64/sysroot/include/dirent.h
@@ -0,0 +1,64 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/dlfcn.h b/arch/arm64/sysroot/include/dlfcn.h
new file mode 100644
index 0000000..04cc834
--- /dev/null
+++ b/arch/arm64/sysroot/include/dlfcn.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/elf.h b/arch/arm64/sysroot/include/elf.h
new file mode 100644
index 0000000..a5efbda
--- /dev/null
+++ b/arch/arm64/sysroot/include/elf.h
@@ -0,0 +1,2582 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/endian.h b/arch/arm64/sysroot/include/endian.h
new file mode 100644
index 0000000..499f985
--- /dev/null
+++ b/arch/arm64/sysroot/include/endian.h
@@ -0,0 +1,76 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/err.h b/arch/arm64/sysroot/include/err.h
new file mode 100644
index 0000000..3ed5f7f
--- /dev/null
+++ b/arch/arm64/sysroot/include/err.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/errno.h b/arch/arm64/sysroot/include/errno.h
new file mode 100644
index 0000000..4d3b968
--- /dev/null
+++ b/arch/arm64/sysroot/include/errno.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/fcntl.h b/arch/arm64/sysroot/include/fcntl.h
new file mode 100644
index 0000000..f045529
--- /dev/null
+++ b/arch/arm64/sysroot/include/fcntl.h
@@ -0,0 +1,222 @@
+#pragma once
+
+#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
+#define O_PIPELINE  0x80000000
+#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
diff --git a/arch/arm64/sysroot/include/features.h b/arch/arm64/sysroot/include/features.h
new file mode 100644
index 0000000..7bd75ad
--- /dev/null
+++ b/arch/arm64/sysroot/include/features.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/fenv.h b/arch/arm64/sysroot/include/fenv.h
new file mode 100644
index 0000000..42508ac
--- /dev/null
+++ b/arch/arm64/sysroot/include/fenv.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/float.h b/arch/arm64/sysroot/include/float.h
new file mode 100644
index 0000000..691c4fc
--- /dev/null
+++ b/arch/arm64/sysroot/include/float.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __flt_rounds(void);
+#define FLT_ROUNDS (__flt_rounds())
+
+#define FLT_RADIX 2
+
+#define FLT_TRUE_MIN 1.40129846432481707092e-45F
+#define FLT_MIN 1.17549435082228750797e-38F
+#define FLT_MAX 3.40282346638528859812e+38F
+#define FLT_EPSILON 1.1920928955078125e-07F
+
+#define FLT_MANT_DIG 24
+#define FLT_MIN_EXP (-125)
+#define FLT_MAX_EXP 128
+#define FLT_HAS_SUBNORM 1
+
+#define FLT_DIG 6
+#define FLT_DECIMAL_DIG 9
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_10_EXP 38
+
+#define DBL_TRUE_MIN 4.94065645841246544177e-324
+#define DBL_MIN 2.22507385850720138309e-308
+#define DBL_MAX 1.79769313486231570815e+308
+#define DBL_EPSILON 2.22044604925031308085e-16
+
+#define DBL_MANT_DIG 53
+#define DBL_MIN_EXP (-1021)
+#define DBL_MAX_EXP 1024
+#define DBL_HAS_SUBNORM 1
+
+#define DBL_DIG 15
+#define DBL_DECIMAL_DIG 17
+#define DBL_MIN_10_EXP (-307)
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_HAS_SUBNORM 1
+#define LDBL_DECIMAL_DIG DECIMAL_DIG
+
+#include <bits/float.h>
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/fmtmsg.h b/arch/arm64/sysroot/include/fmtmsg.h
new file mode 100644
index 0000000..e6b0923
--- /dev/null
+++ b/arch/arm64/sysroot/include/fmtmsg.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/fnmatch.h b/arch/arm64/sysroot/include/fnmatch.h
new file mode 100644
index 0000000..ea277a4
--- /dev/null
+++ b/arch/arm64/sysroot/include/fnmatch.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/ftw.h b/arch/arm64/sysroot/include/ftw.h
new file mode 100644
index 0000000..1c282aa
--- /dev/null
+++ b/arch/arm64/sysroot/include/ftw.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/stat.h>
+
+#define FTW_F 1
+#define FTW_D 2
+#define FTW_DNR 3
+#define FTW_NS 4
+#define FTW_SL 5
+#define FTW_DP 6
+#define FTW_SLN 7
+
+#define FTW_PHYS 1
+#define FTW_MOUNT 2
+#define FTW_CHDIR 4
+#define FTW_DEPTH 8
+
+struct FTW {
+    int base;
+    int level;
+};
+
+int ftw(const char*, int (*)(const char*, const struct stat*, int), int);
+int nftw(const char*, int (*)(const char*, const struct stat*, int, struct FTW*), int, int);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/getopt.h b/arch/arm64/sysroot/include/getopt.h
new file mode 100644
index 0000000..8019e90
--- /dev/null
+++ b/arch/arm64/sysroot/include/getopt.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/glob.h b/arch/arm64/sysroot/include/glob.h
new file mode 100644
index 0000000..580ffe1
--- /dev/null
+++ b/arch/arm64/sysroot/include/glob.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/grp.h b/arch/arm64/sysroot/include/grp.h
new file mode 100644
index 0000000..5e0dd0a
--- /dev/null
+++ b/arch/arm64/sysroot/include/grp.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/iconv.h b/arch/arm64/sysroot/include/iconv.h
new file mode 100644
index 0000000..4fee288
--- /dev/null
+++ b/arch/arm64/sysroot/include/iconv.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/ifaddrs.h b/arch/arm64/sysroot/include/ifaddrs.h
new file mode 100644
index 0000000..912a2b6
--- /dev/null
+++ b/arch/arm64/sysroot/include/ifaddrs.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/inttypes.h b/arch/arm64/sysroot/include/inttypes.h
new file mode 100644
index 0000000..db1b4d3
--- /dev/null
+++ b/arch/arm64/sysroot/include/inttypes.h
@@ -0,0 +1,352 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/iso646.h b/arch/arm64/sysroot/include/iso646.h
new file mode 100644
index 0000000..59e7e16
--- /dev/null
+++ b/arch/arm64/sysroot/include/iso646.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/langinfo.h b/arch/arm64/sysroot/include/langinfo.h
new file mode 100644
index 0000000..0ee81bb
--- /dev/null
+++ b/arch/arm64/sysroot/include/langinfo.h
@@ -0,0 +1,89 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/libgen.h b/arch/arm64/sysroot/include/libgen.h
new file mode 100644
index 0000000..546dce0
--- /dev/null
+++ b/arch/arm64/sysroot/include/libgen.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char* dirname(char*);
+char* basename(char*);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/limits.h b/arch/arm64/sysroot/include/limits.h
new file mode 100644
index 0000000..290ef73
--- /dev/null
+++ b/arch/arm64/sysroot/include/limits.h
@@ -0,0 +1,151 @@
+#pragma once
+
+#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 ARG_MAX 131072
+#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
diff --git a/arch/arm64/sysroot/include/link.h b/arch/arm64/sysroot/include/link.h
new file mode 100644
index 0000000..657e9a0
--- /dev/null
+++ b/arch/arm64/sysroot/include/link.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#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;
+    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
diff --git a/arch/arm64/sysroot/include/locale.h b/arch/arm64/sysroot/include/locale.h
new file mode 100644
index 0000000..44f8d0b
--- /dev/null
+++ b/arch/arm64/sysroot/include/locale.h
@@ -0,0 +1,75 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/malloc.h b/arch/arm64/sysroot/include/malloc.h
new file mode 100644
index 0000000..d057b89
--- /dev/null
+++ b/arch/arm64/sysroot/include/malloc.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/math.h b/arch/arm64/sysroot/include/math.h
new file mode 100644
index 0000000..a32ec07
--- /dev/null
+++ b/arch/arm64/sysroot/include/math.h
@@ -0,0 +1,431 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/memory.h b/arch/arm64/sysroot/include/memory.h
new file mode 100644
index 0000000..3b2f590
--- /dev/null
+++ b/arch/arm64/sysroot/include/memory.h
@@ -0,0 +1 @@
+#include <string.h>
diff --git a/arch/arm64/sysroot/include/monetary.h b/arch/arm64/sysroot/include/monetary.h
new file mode 100644
index 0000000..b6081b9
--- /dev/null
+++ b/arch/arm64/sysroot/include/monetary.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/net/ethernet.h b/arch/arm64/sysroot/include/net/ethernet.h
new file mode 100644
index 0000000..41dab8b
--- /dev/null
+++ b/arch/arm64/sysroot/include/net/ethernet.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/net/if.h b/arch/arm64/sysroot/include/net/if.h
new file mode 100644
index 0000000..687175b
--- /dev/null
+++ b/arch/arm64/sysroot/include/net/if.h
@@ -0,0 +1,129 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/net/if_arp.h b/arch/arm64/sysroot/include/net/if_arp.h
new file mode 100644
index 0000000..6da9341
--- /dev/null
+++ b/arch/arm64/sysroot/include/net/if_arp.h
@@ -0,0 +1,136 @@
+/* Nonstandard header */
+
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/net/route.h b/arch/arm64/sysroot/include/net/route.h
new file mode 100644
index 0000000..5d2d3d0
--- /dev/null
+++ b/arch/arm64/sysroot/include/net/route.h
@@ -0,0 +1,116 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netdb.h b/arch/arm64/sysroot/include/netdb.h
new file mode 100644
index 0000000..5b8ab72
--- /dev/null
+++ b/arch/arm64/sysroot/include/netdb.h
@@ -0,0 +1,152 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/ether.h b/arch/arm64/sysroot/include/netinet/ether.h
new file mode 100644
index 0000000..0a65077
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/ether.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/icmp6.h b/arch/arm64/sysroot/include/netinet/icmp6.h
new file mode 100644
index 0000000..9a50bcd
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/icmp6.h
@@ -0,0 +1,300 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/if_ether.h b/arch/arm64/sysroot/include/netinet/if_ether.h
new file mode 100644
index 0000000..ee7d38e
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/if_ether.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#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)
diff --git a/arch/arm64/sysroot/include/netinet/igmp.h b/arch/arm64/sysroot/include/netinet/igmp.h
new file mode 100644
index 0000000..a59a1cc
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/igmp.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/in.h b/arch/arm64/sysroot/include/netinet/in.h
new file mode 100644
index 0000000..e626a93
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/in.h
@@ -0,0 +1,394 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/in_systm.h b/arch/arm64/sysroot/include/netinet/in_systm.h
new file mode 100644
index 0000000..ea7ed91
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/in_systm.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef uint16_t n_short;
+typedef uint32_t n_long, n_time;
diff --git a/arch/arm64/sysroot/include/netinet/ip.h b/arch/arm64/sysroot/include/netinet/ip.h
new file mode 100644
index 0000000..1c0978a
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/ip.h
@@ -0,0 +1,195 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/ip6.h b/arch/arm64/sysroot/include/netinet/ip6.h
new file mode 100644
index 0000000..e809200
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/ip6.h
@@ -0,0 +1,139 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/ip_icmp.h b/arch/arm64/sysroot/include/netinet/ip_icmp.h
new file mode 100644
index 0000000..4c1c322
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/ip_icmp.h
@@ -0,0 +1,186 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/tcp.h b/arch/arm64/sysroot/include/netinet/tcp.h
new file mode 100644
index 0000000..9274ba5
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/tcp.h
@@ -0,0 +1,199 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netinet/udp.h b/arch/arm64/sysroot/include/netinet/udp.h
new file mode 100644
index 0000000..ddde1c7
--- /dev/null
+++ b/arch/arm64/sysroot/include/netinet/udp.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/netpacket/packet.h b/arch/arm64/sysroot/include/netpacket/packet.h
new file mode 100644
index 0000000..3e35676
--- /dev/null
+++ b/arch/arm64/sysroot/include/netpacket/packet.h
@@ -0,0 +1,58 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/nl_types.h b/arch/arm64/sysroot/include/nl_types.h
new file mode 100644
index 0000000..570224d
--- /dev/null
+++ b/arch/arm64/sysroot/include/nl_types.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/paths.h b/arch/arm64/sysroot/include/paths.h
new file mode 100644
index 0000000..36b6127
--- /dev/null
+++ b/arch/arm64/sysroot/include/paths.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#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/"
diff --git a/arch/arm64/sysroot/include/poll.h b/arch/arm64/sysroot/include/poll.h
new file mode 100644
index 0000000..d8b3726
--- /dev/null
+++ b/arch/arm64/sysroot/include/poll.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/pthread.h b/arch/arm64/sysroot/include/pthread.h
new file mode 100644
index 0000000..07576e5
--- /dev/null
+++ b/arch/arm64/sysroot/include/pthread.h
@@ -0,0 +1,196 @@
+#pragma once
+
+#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 <bits/alltypes.h>
+
+#include <sched.h>
+#include <time.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
diff --git a/arch/arm64/sysroot/include/pty.h b/arch/arm64/sysroot/include/pty.h
new file mode 100644
index 0000000..943a6a8
--- /dev/null
+++ b/arch/arm64/sysroot/include/pty.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ioctl.h>
+#include <termios.h>
+
+int openpty(int*, int*, char*, const struct termios*, const struct winsize*);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/pwd.h b/arch/arm64/sysroot/include/pwd.h
new file mode 100644
index 0000000..1d63e72
--- /dev/null
+++ b/arch/arm64/sysroot/include/pwd.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/regex.h b/arch/arm64/sysroot/include/regex.h
new file mode 100644
index 0000000..70c4613
--- /dev/null
+++ b/arch/arm64/sysroot/include/regex.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/resolv.h b/arch/arm64/sysroot/include/resolv.h
new file mode 100644
index 0000000..7efcd49
--- /dev/null
+++ b/arch/arm64/sysroot/include/resolv.h
@@ -0,0 +1,140 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sched.h b/arch/arm64/sysroot/include/sched.h
new file mode 100644
index 0000000..f77dff7
--- /dev/null
+++ b/arch/arm64/sysroot/include/sched.h
@@ -0,0 +1,105 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/search.h b/arch/arm64/sysroot/include/search.h
new file mode 100644
index 0000000..eb50439
--- /dev/null
+++ b/arch/arm64/sysroot/include/search.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/semaphore.h b/arch/arm64/sysroot/include/semaphore.h
new file mode 100644
index 0000000..e4bf7a8
--- /dev/null
+++ b/arch/arm64/sysroot/include/semaphore.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_sem_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+#include <fcntl.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
diff --git a/arch/arm64/sysroot/include/setjmp.h b/arch/arm64/sysroot/include/setjmp.h
new file mode 100644
index 0000000..eaceeca
--- /dev/null
+++ b/arch/arm64/sysroot/include/setjmp.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/signal.h b/arch/arm64/sysroot/include/signal.h
new file mode 100644
index 0000000..b26c9b0
--- /dev/null
+++ b/arch/arm64/sysroot/include/signal.h
@@ -0,0 +1,260 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/spawn.h b/arch/arm64/sysroot/include/spawn.h
new file mode 100644
index 0000000..74710cb
--- /dev/null
+++ b/arch/arm64/sysroot/include/spawn.h
@@ -0,0 +1,76 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/stdio.h b/arch/arm64/sysroot/include/stdio.h
new file mode 100644
index 0000000..fde69be
--- /dev/null
+++ b/arch/arm64/sysroot/include/stdio.h
@@ -0,0 +1,182 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/stdlib.h b/arch/arm64/sysroot/include/stdlib.h
new file mode 100644
index 0000000..0c29b16
--- /dev/null
+++ b/arch/arm64/sysroot/include/stdlib.h
@@ -0,0 +1,148 @@
+#pragma once
+
+#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);
+char* l64a(long);
+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
diff --git a/arch/arm64/sysroot/include/stdnoreturn.h b/arch/arm64/sysroot/include/stdnoreturn.h
new file mode 100644
index 0000000..574bcca
--- /dev/null
+++ b/arch/arm64/sysroot/include/stdnoreturn.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#ifndef __cplusplus
+#include <features.h>
+#define noreturn _Noreturn
+#endif
diff --git a/arch/arm64/sysroot/include/string.h b/arch/arm64/sysroot/include/string.h
new file mode 100644
index 0000000..d7ea6bb
--- /dev/null
+++ b/arch/arm64/sysroot/include/string.h
@@ -0,0 +1,86 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/strings.h b/arch/arm64/sysroot/include/strings.h
new file mode 100644
index 0000000..343f31a
--- /dev/null
+++ b/arch/arm64/sysroot/include/strings.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/stropts.h b/arch/arm64/sysroot/include/stropts.h
new file mode 100644
index 0000000..c2e6b7f
--- /dev/null
+++ b/arch/arm64/sysroot/include/stropts.h
@@ -0,0 +1,136 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/acct.h b/arch/arm64/sysroot/include/sys/acct.h
new file mode 100644
index 0000000..be32528
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/acct.h
@@ -0,0 +1,69 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/auxv.h b/arch/arm64/sysroot/include/sys/auxv.h
new file mode 100644
index 0000000..72d5de9
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/auxv.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+
+unsigned long getauxval(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/sys/dir.h b/arch/arm64/sysroot/include/sys/dir.h
new file mode 100644
index 0000000..9ba1c79
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/dir.h
@@ -0,0 +1,2 @@
+#include <dirent.h>
+#define direct dirent
diff --git a/arch/arm64/sysroot/include/sys/errno.h b/arch/arm64/sysroot/include/sys/errno.h
new file mode 100644
index 0000000..35a3e5a
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/sys/eventfd.h b/arch/arm64/sysroot/include/sys/eventfd.h
new file mode 100644
index 0000000..c22369e
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/eventfd.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/fcntl.h b/arch/arm64/sysroot/include/sys/fcntl.h
new file mode 100644
index 0000000..3dd928e
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/sys/file.h b/arch/arm64/sysroot/include/sys/file.h
new file mode 100644
index 0000000..c32fcb8
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/file.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/fsuid.h b/arch/arm64/sysroot/include/sys/fsuid.h
new file mode 100644
index 0000000..29ea02b
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/fsuid.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/io.h b/arch/arm64/sysroot/include/sys/io.h
new file mode 100644
index 0000000..f5013a2
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/io.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/ioctl.h b/arch/arm64/sysroot/include/sys/ioctl.h
new file mode 100644
index 0000000..c782d2e
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/ioctl.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/ioctl.h>
+
+int ioctl(int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/sys/ipc.h b/arch/arm64/sysroot/include/sys/ipc.h
new file mode 100644
index 0000000..a3a380c
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/ipc.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/klog.h b/arch/arm64/sysroot/include/sys/klog.h
new file mode 100644
index 0000000..ccde5e8
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/klog.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl(int, char*, int);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/sys/mman.h b/arch/arm64/sysroot/include/sys/mman.h
new file mode 100644
index 0000000..c5ff3bf
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/mman.h
@@ -0,0 +1,98 @@
+#pragma once
+
+#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_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
diff --git a/arch/arm64/sysroot/include/sys/mount.h b/arch/arm64/sysroot/include/sys/mount.h
new file mode 100644
index 0000000..9d3394b
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/mount.h
@@ -0,0 +1,70 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/msg.h b/arch/arm64/sysroot/include/sys/msg.h
new file mode 100644
index 0000000..6d08dad
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/msg.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/mtio.h b/arch/arm64/sysroot/include/sys/mtio.h
new file mode 100644
index 0000000..2f4cf9a
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/mtio.h
@@ -0,0 +1,182 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/param.h b/arch/arm64/sysroot/include/sys/param.h
new file mode 100644
index 0000000..64989a4
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/param.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#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>
diff --git a/arch/arm64/sysroot/include/sys/personality.h b/arch/arm64/sysroot/include/sys/personality.h
new file mode 100644
index 0000000..3da0e20
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/personality.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/poll.h b/arch/arm64/sysroot/include/sys/poll.h
new file mode 100644
index 0000000..9917040
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/sys/quota.h b/arch/arm64/sysroot/include/sys/quota.h
new file mode 100644
index 0000000..ae2e194
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/quota.h
@@ -0,0 +1,99 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/random.h b/arch/arm64/sysroot/include/sys/random.h
new file mode 100644
index 0000000..080c3b4
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/random.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getentropy(void* buffer, size_t length) __attribute__((__warn_unused_result__));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/sys/reboot.h b/arch/arm64/sysroot/include/sys/reboot.h
new file mode 100644
index 0000000..f28375d
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/reboot.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/reg.h b/arch/arm64/sysroot/include/sys/reg.h
new file mode 100644
index 0000000..22a9caa
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/reg.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
diff --git a/arch/arm64/sysroot/include/sys/select.h b/arch/arm64/sysroot/include/sys/select.h
new file mode 100644
index 0000000..25197d8
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/select.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/sem.h b/arch/arm64/sysroot/include/sys/sem.h
new file mode 100644
index 0000000..864161f
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/sem.h
@@ -0,0 +1,66 @@
+#pragma once
+
+#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 <bits/alltypes.h>
+
+#include <sys/ipc.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
diff --git a/arch/arm64/sysroot/include/sys/sendfile.h b/arch/arm64/sysroot/include/sys/sendfile.h
new file mode 100644
index 0000000..1c94a6b
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/sendfile.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <unistd.h>
+
+ssize_t sendfile(int, int, off_t*, size_t);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/sys/shm.h b/arch/arm64/sysroot/include/sys/shm.h
new file mode 100644
index 0000000..b4780d6
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/shm.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.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
diff --git a/arch/arm64/sysroot/include/sys/signal.h b/arch/arm64/sysroot/include/sys/signal.h
new file mode 100644
index 0000000..45bdcc6
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/sys/signalfd.h b/arch/arm64/sysroot/include/sys/signalfd.h
new file mode 100644
index 0000000..832cc78
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/signalfd.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/socket.h b/arch/arm64/sysroot/include/sys/socket.h
new file mode 100644
index 0000000..10167be
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/socket.h
@@ -0,0 +1,321 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/stat.h b/arch/arm64/sysroot/include/sys/stat.h
new file mode 100644
index 0000000..2be2ff5
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/stat.h
@@ -0,0 +1,100 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/statfs.h b/arch/arm64/sysroot/include/sys/statfs.h
new file mode 100644
index 0000000..c2a3d41
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/statfs.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/statvfs.h b/arch/arm64/sysroot/include/sys/statvfs.h
new file mode 100644
index 0000000..6031e66
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/statvfs.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+#include <endian.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
diff --git a/arch/arm64/sysroot/include/sys/stropts.h b/arch/arm64/sysroot/include/sys/stropts.h
new file mode 100644
index 0000000..5b5bc02
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/stropts.h
@@ -0,0 +1 @@
+#include <stropts.h>
diff --git a/arch/arm64/sysroot/include/sys/swap.h b/arch/arm64/sysroot/include/sys/swap.h
new file mode 100644
index 0000000..e9d516d
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/swap.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/syslog.h b/arch/arm64/sysroot/include/sys/syslog.h
new file mode 100644
index 0000000..7761ece
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/syslog.h
@@ -0,0 +1 @@
+#include <syslog.h>
diff --git a/arch/arm64/sysroot/include/sys/termios.h b/arch/arm64/sysroot/include/sys/termios.h
new file mode 100644
index 0000000..f5f751f
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/sys/time.h b/arch/arm64/sysroot/include/sys/time.h
new file mode 100644
index 0000000..81c410a
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/time.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/timeb.h b/arch/arm64/sysroot/include/sys/timeb.h
new file mode 100644
index 0000000..560158b
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/timeb.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/timerfd.h b/arch/arm64/sysroot/include/sys/timerfd.h
new file mode 100644
index 0000000..c6b52b3
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/timerfd.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/times.h b/arch/arm64/sysroot/include/sys/times.h
new file mode 100644
index 0000000..d573297
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/times.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/timex.h b/arch/arm64/sysroot/include/sys/timex.h
new file mode 100644
index 0000000..8aa166e
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/timex.h
@@ -0,0 +1,96 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.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
diff --git a/arch/arm64/sysroot/include/sys/ttydefaults.h b/arch/arm64/sysroot/include/sys/ttydefaults.h
new file mode 100644
index 0000000..742e3a9
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/ttydefaults.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/types.h b/arch/arm64/sysroot/include/sys/types.h
new file mode 100644
index 0000000..b1c2a27
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/types.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/ucontext.h b/arch/arm64/sysroot/include/sys/ucontext.h
new file mode 100644
index 0000000..5fdbd63
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/ucontext.h
@@ -0,0 +1 @@
+#include <ucontext.h>
diff --git a/arch/arm64/sysroot/include/sys/uio.h b/arch/arm64/sysroot/include/sys/uio.h
new file mode 100644
index 0000000..e9f7b5d
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/uio.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/un.h b/arch/arm64/sysroot/include/sys/un.h
new file mode 100644
index 0000000..52bebd4
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/un.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sys/utsname.h b/arch/arm64/sysroot/include/sys/utsname.h
new file mode 100644
index 0000000..0333c82
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/utsname.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+struct utsname {
+    char sysname[65];
+    char nodename[65];
+    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
diff --git a/arch/arm64/sysroot/include/sys/vfs.h b/arch/arm64/sysroot/include/sys/vfs.h
new file mode 100644
index 0000000..a899db2
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/vfs.h
@@ -0,0 +1 @@
+#include <sys/statfs.h>
diff --git a/arch/arm64/sysroot/include/sys/wait.h b/arch/arm64/sysroot/include/sys/wait.h
new file mode 100644
index 0000000..f31bb8e
--- /dev/null
+++ b/arch/arm64/sysroot/include/sys/wait.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/sysexits.h b/arch/arm64/sysroot/include/sysexits.h
new file mode 100644
index 0000000..82f672a
--- /dev/null
+++ b/arch/arm64/sysroot/include/sysexits.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/syslog.h b/arch/arm64/sysroot/include/syslog.h
new file mode 100644
index 0000000..76fdce7
--- /dev/null
+++ b/arch/arm64/sysroot/include/syslog.h
@@ -0,0 +1,118 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/tar.h b/arch/arm64/sysroot/include/tar.h
new file mode 100644
index 0000000..7703c2b
--- /dev/null
+++ b/arch/arm64/sysroot/include/tar.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/termios.h b/arch/arm64/sysroot/include/termios.h
new file mode 100644
index 0000000..65c9d66
--- /dev/null
+++ b/arch/arm64/sysroot/include/termios.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/threads.h b/arch/arm64/sysroot/include/threads.h
new file mode 100644
index 0000000..8711302
--- /dev/null
+++ b/arch/arm64/sysroot/include/threads.h
@@ -0,0 +1,105 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/time.h b/arch/arm64/sysroot/include/time.h
new file mode 100644
index 0000000..c20b7db
--- /dev/null
+++ b/arch/arm64/sysroot/include/time.h
@@ -0,0 +1,120 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/uchar.h b/arch/arm64/sysroot/include/uchar.h
new file mode 100644
index 0000000..73e5e5a
--- /dev/null
+++ b/arch/arm64/sysroot/include/uchar.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#else
+typedef unsigned short char16_t;
+typedef unsigned char32_t;
+#endif
+
+#define __NEED_mbstate_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+#include <features.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
diff --git a/arch/arm64/sysroot/include/ucontext.h b/arch/arm64/sysroot/include/ucontext.h
new file mode 100644
index 0000000..930bb71
--- /dev/null
+++ b/arch/arm64/sysroot/include/ucontext.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/unistd.h b/arch/arm64/sysroot/include/unistd.h
new file mode 100644
index 0000000..4f91876
--- /dev/null
+++ b/arch/arm64/sysroot/include/unistd.h
@@ -0,0 +1,434 @@
+#pragma once
+
+#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);
+char* crypt(const char*, const char*);
+void encrypt(char*, int);
+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
diff --git a/arch/arm64/sysroot/include/utime.h b/arch/arm64/sysroot/include/utime.h
new file mode 100644
index 0000000..25e0ff7
--- /dev/null
+++ b/arch/arm64/sysroot/include/utime.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/values.h b/arch/arm64/sysroot/include/values.h
new file mode 100644
index 0000000..a139dca
--- /dev/null
+++ b/arch/arm64/sysroot/include/values.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/wait.h b/arch/arm64/sysroot/include/wait.h
new file mode 100644
index 0000000..98396e2
--- /dev/null
+++ b/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/arch/arm64/sysroot/include/wchar.h b/arch/arm64/sysroot/include/wchar.h
new file mode 100644
index 0000000..5578085
--- /dev/null
+++ b/arch/arm64/sysroot/include/wchar.h
@@ -0,0 +1,181 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/wctype.h b/arch/arm64/sysroot/include/wctype.h
new file mode 100644
index 0000000..8c86840
--- /dev/null
+++ b/arch/arm64/sysroot/include/wctype.h
@@ -0,0 +1,57 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/wordexp.h b/arch/arm64/sysroot/include/wordexp.h
new file mode 100644
index 0000000..26f8646
--- /dev/null
+++ b/arch/arm64/sysroot/include/wordexp.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/zircon/assert.h b/arch/arm64/sysroot/include/zircon/assert.h
new file mode 100644
index 0000000..6175321
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/assert.h
@@ -0,0 +1,86 @@
+// 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 ZIRCON_ASSERT_
+#define ZIRCON_ASSERT_
+
+#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
+
+#ifdef ZX_DEBUGLEVEL
+#undef ZX_DEBUGLEVEL
+#endif
+#define ZX_DEBUGLEVEL LK_DEBUGLEVEL
+
+#else // #ifdef _KERNEL
+
+#include <stdio.h>  // for printf
+#include <stdlib.h> // for abort
+
+#include <zircon/compiler.h>
+
+#define ZX_PANIC(fmt, ...)          \
+    do {                            \
+        printf(fmt, ##__VA_ARGS__); \
+        abort();                    \
+    } while (0)
+
+#define ZX_ASSERT(x)                                                            \
+    do {                                                                        \
+        if (unlikely(!(x))) {                                                   \
+            ZX_PANIC("ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); \
+        }                                                                       \
+    } while (0)
+
+#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 DEBUG_ASSERT based on ZX_DEBUGLEVEL in kernel space
+// user space does not currently implement DEBUG_ASSERT
+#ifdef ZX_DEBUGLEVEL
+#define ZX_DEBUG_ASSERT_IMPLEMENTED (ZX_DEBUGLEVEL > 1)
+#else
+#define ZX_DEBUG_ASSERT_IMPLEMENTED 0
+#endif
+
+#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)
+
+#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 // ZIRCON_ASSERT_
diff --git a/arch/arm64/sysroot/include/zircon/boot/bootdata.h b/arch/arm64/sysroot/include/zircon/boot/bootdata.h
new file mode 100644
index 0000000..d49b9b1
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/bootdata.h
@@ -0,0 +1,317 @@
+// 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
+
+#ifndef __ASSEMBLER__
+#include <zircon/compiler.h>
+#include <stdbool.h>
+#include <stdint.h>
+#endif
+
+// lsw of sha256("bootdata")
+#define BOOTDATA_MAGIC (0x868cf7e6)
+
+// lsw of sha256("bootitem")
+#define BOOTITEM_MAGIC (0xb5781729)
+
+// Round n up to the next 8 byte boundary
+#define BOOTDATA_ALIGN(n) (((n) + 7) & (~7))
+
+#define BOOTITEM_NO_CRC32 (0x4a87e8d6)
+
+// This flag is required.
+#define BOOTDATA_FLAG_V2         (0x00010000)
+
+// Bootdata items with the CRC32 flag must have a valid crc32.
+// Otherwise their crc32 field must contain BOOTITEM_NO_CRC32
+#define BOOTDATA_FLAG_CRC32      (0x00020000)
+
+// Bootdata types that have least significant byte set to 'm'
+// are reserved for driver metadata
+#define BOOTDATA_KIND_METADATA   (0x0000006D)
+#define BOOTDATA_KIND_MASK       (0x000000FF)
+
+// Containers are used to wrap a set of bootdata items
+// written to a file or partition.  The "length" is the
+// length of the set of following bootdata items.  The
+// "extra" is the value BOOTDATA_MAGIC and "flags" is
+// set to 0.
+#define BOOTDATA_CONTAINER        (0x544f4f42) // BOOT
+
+// BOOTFS images.  The "extra" field is the decompressed
+// size of the image, if compressed, otherwise the same
+// as the "length" field.
+#define BOOTDATA_BOOTFS_BOOT      (0x42534642) // BFSB
+#define BOOTDATA_BOOTFS_SYSTEM    (0x53534642) // BFSS
+#define BOOTDATA_BOOTFS_DISCARD   (0x58534642) // BFSX
+
+#define BOOTDATA_BOOTFS_MASK      (0x00FFFFFF)
+#define BOOTDATA_BOOTFS_TYPE      (0x00534642) // BFS\0
+
+// Virtual disk images.  The header fields and compression protocol
+// are the same as for the BOOTFS types, but the payload before
+// compression is a raw disk image rather than BOOTFS format.
+#define BOOTDATA_RAMDISK          (0x4b534452) // RDSK
+
+// A Zircon Kernel Image
+// Content: bootdata_kernel_t
+#define BOOTDATA_KERNEL           (0x4c4e524b) // KRNL
+
+// A Zircon Partition Map
+// Content: bootdata_partition_map_t
+// The bootdata_t.extra field is used as a board specific index
+// to specify which device the partition map applies to.
+#define BOOTDATA_PARTITION_MAP    (0x5452506D) // mPRT
+
+// MAC Address for Ethernet, Wifi, Bluetooth, etc.
+// Content: uint8_t[] (variable length based on type of MAC address)
+// The bootdata_t.extra field is used as a board specific index
+// to specify which device the MAC address applies to.
+#define BOOTDATA_MAC_ADDRESS      (0x43414D6D) // mMAC
+
+// Flag indicating that the bootfs is compressed.
+#define BOOTDATA_BOOTFS_FLAG_COMPRESSED  (1 << 0)
+
+
+// These items are for passing from bootloader to kernel
+
+// Kernel Command Line String
+// Content: uint8_t[]
+#define BOOTDATA_CMDLINE          (0x4c444d43) // CMDL
+
+// ACPI Root Table Pointer
+// Content: uint64_t phys addr
+#define BOOTDATA_ACPI_RSDP        (0x50445352) // RSDP
+
+// SMBIOS entry point pointer
+// Content: uint64_t phys addr
+#define BOOTDATA_SMBIOS           (0x49424d53) // SMBI
+
+// Framebuffer Parameters
+// Content: bootdata_swfb_t
+#define BOOTDATA_FRAMEBUFFER      (0x42465753) // SWFB
+
+// Debug Serial Port
+// Content: bootdata_uart_t
+#define BOOTDATA_DEBUG_UART       (0x54524155) // UART
+
+// Platform ID Information
+// Content: bootdata_platform_id_t
+#define BOOTDATA_PLATFORM_ID      (0x44494C50) // PLID
+
+// Memory which will persist across warm boots
+// Content bootdata_lastlog_nvram_t
+#define BOOTDATA_LASTLOG_NVRAM    (0x4c4c564e) // NVLL
+
+// This reflects a typo we need to support for a while
+#define BOOTDATA_LASTLOG_NVRAM2   (0x4c4c5643) // CVLL
+
+// E820 Memory Table
+// Content: e820entry[]
+#define BOOTDATA_E820_TABLE       (0x30323845) // E820
+
+// EFI Memory Map
+// Content: a uint64_t entrysz followed by a set of
+// efi_memory_descriptor aligned on entrysz
+#define BOOTDATA_EFI_MEMORY_MAP   (0x4d494645) // EFIM
+
+// EFI System Table
+// Content: a uint64_t physical address of the table
+#define BOOTDATA_EFI_SYSTEM_TABLE (0x53494645) // EFIS
+
+// Last crashlog
+// Content: ascii/utf8 log data from previous boot
+#define BOOTDATA_LAST_CRASHLOG    (0x4d4f4f42) // BOOM
+
+// CPU configuration
+// Content: bootdata_cpu_config_t
+#define BOOTDATA_CPU_CONFIG       (0x43555043) // CPUC
+
+// Memory configuration
+// Content: one or more of bootdata_mem_range_t (count determined by bootdata_t length)
+#define BOOTDATA_MEM_CONFIG       (0x434D454D) // MEMC
+
+// Kernel driver configuration
+// Content: driver specific struct, with type determined by bootdata "extra" field
+#define BOOTDATA_KERNEL_DRIVER    (0x5652444B) // KDRV
+
+#define BOOTDATA_IGNORE           (0x50494b53) // SKIP
+
+#ifndef __ASSEMBLER__
+__BEGIN_CDECLS;
+
+// BootData header, describing the type and size of data
+// used to initialize the system. All fields are little-endian.
+//
+// BootData headers in a stream must be 8-byte-aligned.
+//
+// The length field specifies the actual payload length
+// and does not include the size of padding.
+typedef struct {
+    // Boot data type
+    uint32_t type;
+
+    // Size of the payload following this header
+    uint32_t length;
+
+    // type-specific extra data
+    // For CONTAINER this is MAGIC.
+    // For BOOTFS this is the decompressed size.
+    uint32_t extra;
+
+    // Flags for the boot data. See flag descriptions for each type.
+    uint32_t flags;
+
+    // For future expansion.  Set to 0.
+    uint32_t reserved0;
+    uint32_t reserved1;
+
+    // Must be BOOTITEM_MAGIC
+    uint32_t magic;
+
+    // Must be the CRC32 of payload if FLAG_CRC32 is set,
+    // otherwise must be BOOTITEM_NO_CRC32
+    uint32_t crc32;
+} bootdata_t;
+
+typedef struct {
+    uint64_t base; // physical base addr
+    uint32_t width;
+    uint32_t height;
+    uint32_t stride;
+    uint32_t format;
+} bootdata_swfb_t;
+
+typedef struct {
+    uint64_t entry64;
+    uint64_t reserved;
+} bootdata_kernel_t;
+
+#define BOOTDATA_PART_NAME_LEN 32
+#define BOOTDATA_PART_GUID_LEN 16
+
+typedef struct {
+    uint8_t type_guid[BOOTDATA_PART_GUID_LEN];
+    uint8_t uniq_guid[BOOTDATA_PART_GUID_LEN];
+    uint64_t first_block;
+    uint64_t last_block;
+    uint64_t flags;
+    char name[BOOTDATA_PART_NAME_LEN];
+} bootdata_partition_t;
+
+typedef struct {
+    uint64_t block_count;
+    uint64_t block_size;
+    uint32_t partition_count;
+    uint32_t reserved;
+    char guid[BOOTDATA_PART_GUID_LEN];
+    bootdata_partition_t partitions[];
+} bootdata_partition_map_t;
+
+typedef struct {
+    uint64_t base;
+    uint64_t length;
+} bootdata_nvram_t;
+
+#define BOOTDATA_UART_NONE 0
+#define BOOTDATA_UART_PC_PORT 1
+#define BOOTDATA_UART_PC_MMIO 2
+typedef struct {
+    uint64_t base;
+    uint32_t type;
+    uint32_t irq;
+} bootdata_uart_t;
+
+typedef struct {
+    uint32_t vid;
+    uint32_t pid;
+    char board_name[32];
+} bootdata_platform_id_t;
+
+typedef struct {
+    uint32_t cpu_count;     // number of CPU cores in the cluster
+    uint32_t type;          // for future use
+    uint32_t flags;         // for future use
+    uint32_t reserved;
+} bootdata_cpu_cluster_t;
+
+typedef struct {
+    uint32_t cluster_count;
+    uint32_t reserved[3];
+    bootdata_cpu_cluster_t clusters[];
+} bootdata_cpu_config_t;
+
+#define BOOTDATA_MEM_RANGE_RAM          1
+#define BOOTDATA_MEM_RANGE_PERIPHERAL   2
+#define BOOTDATA_MEM_RANGE_RESERVED     3
+typedef struct {
+    uint64_t    paddr;
+    uint64_t    length;
+    uint32_t    type;
+    uint32_t    reserved;
+} bootdata_mem_range_t;
+
+/* 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)
+
+__END_CDECLS;
+
+
+// BOOTFS is a trivial "filesystem" format
+//
+// It consists of a bootfs_header_t
+//
+// Followed by a series of bootfs_entry_t's of:
+//   name length (32bit le)
+//   data size   (32bit le)
+//   data offset (32bit le)
+//   namedata   (namelength bytes, includes \0)
+//
+// - data offsets must be page aligned (multiple of 4096)
+// - entries start on uint32 boundaries
+
+//lsw of sha256("bootfs")
+#define BOOTFS_MAGIC (0xa56d3ff9)
+
+#define BOOTFS_PAGE_SIZE (4096)
+#define BOOTFS_PAGE_ALIGN(size) \
+    (((size) + BOOTFS_PAGE_SIZE - 1) & -BOOTFS_PAGE_SIZE)
+
+#define BOOTFS_MAX_NAME_LEN 256
+
+typedef struct bootfs_header {
+    // magic value BOOTFS_MAGIC
+    uint32_t magic;
+
+    // total size of all bootfs_entry_t's
+    // does not include the size of the bootfs_header_t
+    uint32_t dirsize;
+
+    // 0, 0
+    uint32_t reserved0;
+    uint32_t reserved1;
+} bootfs_header_t;
+
+typedef struct bootfs_entry {
+    uint32_t name_len;
+    uint32_t data_len;
+    uint32_t data_off;
+    char name[];
+} bootfs_entry_t;
+
+#define BOOTFS_ALIGN(nlen) (((nlen) + 3) & (~3))
+#define BOOTFS_RECSIZE(entry) \
+    (sizeof(bootfs_entry_t) + BOOTFS_ALIGN(entry->name_len))
+
+static inline bool bootdata_is_metadata(uint32_t type) {
+    return ((type & BOOTDATA_KIND_MASK) == BOOTDATA_KIND_METADATA);
+}
+
+#endif
diff --git a/arch/arm64/sysroot/include/zircon/boot/driver-config.h b/arch/arm64/sysroot/include/zircon/boot/driver-config.h
new file mode 100644
index 0000000..4913ae1
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/driver-config.h
@@ -0,0 +1,88 @@
+// 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.
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <stdint.h>
+
+// BOOTDATA_KERNEL_DRIVER bootdata types
+#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'
+
+// kernel driver struct that can be used for simple drivers
+// used by KDRV_PL011_UART, KDRV_AMLOGIC_UART and KDRV_NXP_IMX_UART
+typedef struct {
+    uint64_t mmio_phys;
+    uint32_t irq;
+} dcfg_simple_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;
+
+// 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;
diff --git a/arch/arm64/sysroot/include/zircon/boot/e820.h b/arch/arm64/sysroot/include/zircon/boot/e820.h
new file mode 100644
index 0000000..fb8c340
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/e820.h
@@ -0,0 +1,20 @@
+// 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.
+
+#pragma once
+
+#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;
diff --git a/arch/arm64/sysroot/include/zircon/boot/image.h b/arch/arm64/sysroot/include/zircon/boot/image.h
new file mode 100644
index 0000000..de2411e
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/image.h
@@ -0,0 +1,641 @@
+// 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.
+
+#pragma once
+
+#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_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_DEBUG_UART, "DEBUG_UART", ".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_BOOT_CONFIG, "BOOT_CONFIG", ".bin") \
+    macro(ZBI_TYPE_BOOT_VERSION, "BOOT_VERSION", ".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, which must be below 4GB.
+//     The %rsi register (or %esi, since the high 32 bits must be zero)
+//     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.
+//
+// If ZBI_FLAG_STORAGE_COMPRESSED is set in zbi_header_t.flags, then the
+// payload is compressed with LZ4 and zbi_header_t.extra gives the exact
+// size of the decompressed payload.  If ZBI_FLAG_STORAGE_COMPRESSED is
+// not set, then zbi_header_t.extra matches zbi_header_t.length.
+//
+// TODO(mcgrathr): Document or point to the details of the LZ4 header format.
+#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 below.
+// 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
+
+// The payload (after decompression) of an item in BOOTFS format consists
+// of separate "file" images that are each aligned to ZBI_BOOTFS_PAGE_SIZE
+// bytes from the beginning of the item payload.  The first "file" consists
+// of a zbi_bootfs_header_t followed by directory entries.
+#define ZBI_BOOTFS_PAGE_SIZE            (4096u)
+
+#define ZBI_BOOTFS_PAGE_ALIGN(size) \
+    (((size) + ZBI_BOOTFS_PAGE_SIZE - 1) & -ZBI_BOOTFS_PAGE_SIZE)
+
+#ifndef __ASSEMBLER__
+typedef struct {
+    // Must be ZBI_BOOTFS_MAGIC.
+    uint32_t magic;
+
+    // Size in bytes of all the directory entries.
+    // Does not include the size of the zbi_bootfs_header_t.
+    uint32_t dirsize;
+
+    // Reserved for future use.  Set to 0.
+    uint32_t reserved0;
+    uint32_t reserved1;
+} zbi_bootfs_header_t;
+#endif
+
+// LSW of sha256("bootfs")
+#define ZBI_BOOTFS_MAGIC                (0xa56d3ff9)
+
+// Each directory entry holds a pathname and gives the offset and size
+// of the contents of the file by that name.
+#ifndef __ASSEMBLER__
+typedef struct {
+    // Length of the name[] field at the end.  This length includes the
+    // NUL terminator, which must be present, but does not include any
+    // alignment padding required before the next directory entry.
+    uint32_t name_len;
+
+    // Length of the file in bytes.  This is an exact size that is not
+    // rounded, though the file is always padded with zeros up to a
+    // multiple of ZBI_BOOTFS_PAGE_SIZE.
+    uint32_t data_len;
+
+    // Offset from the beginning of the payload (zbi_bootfs_header_t) to
+    // the file's data.  This must be a multiple of ZBI_BOOTFS_PAGE_SIZE.
+    uint32_t data_off;
+
+    // Pathname of the file, a UTF-8 string.  This must include a NUL
+    // terminator at the end.  It must not begin with a '/', but it may
+    // contain '/' separators for subdirectories.
+    char name[];
+} zbi_bootfs_dirent_t;
+#endif
+
+// Each directory entry has a variable size of [16,268] bytes that
+// must be a multiple of 4 bytes.
+#define ZBI_BOOTFS_DIRENT_SIZE(name_len) \
+    ((sizeof(zbi_bootfs_dirent_t) + (name_len) + 3) & -(size_t)4)
+
+// zbi_bootfs_dirent_t.name_len must be > 1 and <= ZBI_BOOTFS_MAX_NAME_LEN.
+#define ZBI_BOOTFS_MAX_NAME_LEN         (256)
+
+
+// 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
+
+// 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 {
+    uint32_t apic_id;
+}  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)
+
+// Debug serial port, a zbi_uart_t entry.
+#define ZBI_TYPE_DEBUG_UART             (0x54524155) // UART
+#ifndef __ASSEMBLER__
+typedef struct {
+    uint64_t base;
+    uint32_t type;
+    uint32_t irq;
+} zbi_uart_t;
+#endif
+#define ZBI_UART_NONE                   (0)
+#define ZBI_UART_PC_PORT                (1)
+#define ZBI_UART_PC_MMIO                (2)
+
+// Framebuffer parameters, a zbi_swfb_t entry.
+#define ZBI_TYPE_FRAMEBUFFER            (0x42465753) // SWFB
+
+// A copy of the boot configuration stored as a kvstore
+// within the sysconfig partition.
+#define ZBI_TYPE_BOOT_CONFIG        (0x47464342) // BCFG
+
+// 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)
+#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
diff --git a/arch/arm64/sysroot/include/zircon/boot/multiboot.h b/arch/arm64/sysroot/include/zircon/boot/multiboot.h
new file mode 100644
index 0000000..0076832
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/multiboot.h
@@ -0,0 +1,115 @@
+// Copyright 2016 The Fuchsia Authors
+// Copyright (c) 2009 Corey Tabaka
+//
+// 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 __PLATFORM_MULTIBOOT_H
+#define __PLATFORM_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
diff --git a/arch/arm64/sysroot/include/zircon/boot/netboot.h b/arch/arm64/sysroot/include/zircon/boot/netboot.h
new file mode 100644
index 0000000..25973c6
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/netboot.h
@@ -0,0 +1,116 @@
+// 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 <stddef.h>
+#include <stdint.h>
+
+// clang-format off
+
+#define BOOTLOADER_VERSION "0.7.13"
+
+#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_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
+#define NB_EFI_HOST_FILENAME "efi.img"
+#define NB_EFI_FILENAME NB_IMAGE_PREFIX NB_EFI_HOST_FILENAME
+#define NB_KERNC_HOST_FILENAME "kernc.img"
+#define NB_KERNC_FILENAME NB_IMAGE_PREFIX NB_KERNC_HOST_FILENAME
+#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_SSHAUTH_HOST_FILENAME "authorized_keys"
+#define NB_SSHAUTH_FILENAME NB_IMAGE_PREFIX NB_SSHAUTH_HOST_FILENAME
+
+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;
diff --git a/arch/arm64/sysroot/include/zircon/boot/sysconfig.h b/arch/arm64/sysroot/include/zircon/boot/sysconfig.h
new file mode 100644
index 0000000..fe59efa
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/boot/sysconfig.h
@@ -0,0 +1,26 @@
+// 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.
+
+#pragma once
+
+// 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)
diff --git a/arch/arm64/sysroot/include/zircon/compiler.h b/arch/arm64/sysroot/include/zircon/compiler.h
new file mode 100644
index 0000000..fb3bb42
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/compiler.h
@@ -0,0 +1,122 @@
+// 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
+
+#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 __THREAD_ANNOTATION(x)
+#define __NO_SAFESTACK
+#else
+#define __LEAF_FN
+#define __OPTIMIZE(x)
+#define __EXTERNALLY_VISIBLE
+#define __THREAD_ANNOTATION(x) __attribute__((x))
+#define __NO_SAFESTACK __attribute__((__no_sanitize__("safe-stack")))
+#endif
+
+#ifndef __has_feature
+#define __has_feature(x) 0
+#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)
+
+#if defined(__cplusplus) && __cplusplus >= 201703L
+#define __FALLTHROUGH [[fallthrough]]
+#elif defined(__cplusplus) && defined(__clang__)
+#define __FALLTHROUGH [[clang::fallthrough]]
+#elif __GNUC__ >= 7
+#define __FALLTHROUGH __attribute__((__fallthrough__))
+#else
+#define __FALLTHROUGH do {} while (0)
+#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_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_REQUIRES(...) __THREAD_ANNOTATION(__requires_capability__(__VA_ARGS__))
+#define __TA_EXCLUDES(...) __THREAD_ANNOTATION(__locks_excluded__(__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)
diff --git a/arch/arm64/sysroot/include/zircon/device/ioctl-wrapper.h b/arch/arm64/sysroot/include/zircon/device/ioctl-wrapper.h
new file mode 100644
index 0000000..81a1286
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/device/ioctl-wrapper.h
@@ -0,0 +1,61 @@
+// 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/compiler.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+__BEGIN_CDECLS
+
+extern ssize_t fdio_ioctl(int fd, int op, const void* in_buf, size_t in_len, void* out_buf, size_t out_len);
+
+#define IOCTL_WRAPPER(name, op) \
+static inline ssize_t name(int fd) {             \
+    return fdio_ioctl(fd, op, NULL, 0, NULL, 0); \
+}
+
+#define IOCTL_WRAPPER_IN(name, op, type) \
+static inline ssize_t name(int fd, const type* in) {     \
+    return fdio_ioctl(fd, op, in, in ? sizeof(*in) : 0, NULL, 0); \
+}
+
+#define IOCTL_WRAPPER_VARIN(name, op, type) \
+static inline ssize_t name(int fd, const type* in, size_t in_len) { \
+    return fdio_ioctl(fd, op, in, in_len, NULL, 0);                  \
+}
+
+#define IOCTL_WRAPPER_OUT(name, op, type) \
+static inline ssize_t name(int fd, type* out) {            \
+    return fdio_ioctl(fd, op, NULL, 0, out, out ? sizeof(*out) : 0); \
+}
+
+#define IOCTL_WRAPPER_VAROUT(name, op, type) \
+static inline ssize_t name(int fd, type* out, size_t out_len) { \
+    return fdio_ioctl(fd, op, NULL, 0, out, out_len);           \
+}
+
+#define IOCTL_WRAPPER_INOUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, outtype* out) { \
+    return fdio_ioctl(fd, op, in, in ? sizeof(*in) : 0, out, out ? sizeof(*out) : 0);   \
+}
+
+#define IOCTL_WRAPPER_VARIN_OUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, size_t in_len, outtype* out) { \
+    return fdio_ioctl(fd, op, in, in_len, out, out ? sizeof(*out) : 0);                       \
+}
+
+#define IOCTL_WRAPPER_IN_VAROUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, outtype* out, size_t out_len) { \
+    return fdio_ioctl(fd, op, in, in ? sizeof(*in) : 0, out, out_len);                        \
+}
+
+#define IOCTL_WRAPPER_VARIN_VAROUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, size_t in_len, outtype* out, size_t out_len) { \
+    return fdio_ioctl(fd, op, in, in_len, out, out_len);                                            \
+}
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/device/ioctl.h b/arch/arm64/sysroot/include/zircon/device/ioctl.h
new file mode 100644
index 0000000..7df5529
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/device/ioctl.h
@@ -0,0 +1,94 @@
+// 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
+
+// clang-format off
+
+// DEFAULT ioctls accept and received byte[] data
+// the particular ioctl may define more specific structures
+#define IOCTL_KIND_DEFAULT          0x0
+
+// GET_HANDLE ioctls accept plain data and return
+// a single handle, optionally followed by plain data
+#define IOCTL_KIND_GET_HANDLE       0x1
+
+// GET_TWO_HANDLES ioctls accept plain data and return
+// two handles, optionally followed by plain data
+#define IOCTL_KIND_GET_TWO_HANDLES  0x2
+
+// GET_THREE_HANDLES ioctls accept plain data and return
+// three handles, optionally followed by plain data
+#define IOCTL_KIND_GET_THREE_HANDLES 0x4
+
+// SET_HANDLE ioctls accept a handle, and optionally
+// plain data afterwards.
+#define IOCTL_KIND_SET_HANDLE       0x3
+
+// SET_TWO_HANDLES ioctls accepts two handles, and
+// optionally plain data afterwards.
+#define IOCTL_KIND_SET_TWO_HANDLES  0x5
+
+// core device/vfs ioctl families
+#define IOCTL_FAMILY_RESERVED       0x00
+#define IOCTL_FAMILY_DEVICE         0x01
+#define IOCTL_FAMILY_VFS            0x02
+#define IOCTL_FAMILY_DMCTL          0x03
+#define IOCTL_FAMILY_TEST           0x04
+
+// device protocol families
+#define IOCTL_FAMILY_CONSOLE        0x10
+#define IOCTL_FAMILY_INPUT          0x11
+// 0x12 unused
+#define IOCTL_FAMILY_BLOCK          0x13
+#define IOCTL_FAMILY_I2C            0x14
+#define IOCTL_FAMILY_USB_DEVICE     0x16
+#define IOCTL_FAMILY_HID            0x17
+// 0x18 unused
+#define IOCTL_FAMILY_AUDIO          0x19
+#define IOCTL_FAMILY_MIDI           0x1A
+#define IOCTL_FAMILY_KTRACE         0x1B
+#define IOCTL_FAMILY_BT_HCI         0x1C
+#define IOCTL_FAMILY_SYSINFO        0x1D
+// 0x1E unused
+#define IOCTL_FAMILY_RTC            0x1F  // ioctls for RTC
+#define IOCTL_FAMILY_ETH            0x20
+#define IOCTL_FAMILY_INSNTRACE      0x21  // ioctls for instruction tracing
+#define IOCTL_FAMILY_RAMDISK        0x22
+#define IOCTL_FAMILY_SDMMC          0x23
+#define IOCTL_FAMILY_WLAN           0x24
+#define IOCTL_FAMILY_PTY            0x25
+#define IOCTL_FAMILY_NETCONFIG      0x26
+#define IOCTL_FAMILY_ETHERTAP       0x27
+#define IOCTL_FAMILY_USB_PERIPHERAL 0x28
+#define IOCTL_FAMILY_USB_VIRT_BUS   0x29
+#define IOCTL_FAMILY_CPUPERF        0x2A
+#define IOCTL_FAMILY_POWER          0x30
+#define IOCTL_FAMILY_THERMAL        0x31
+#define IOCTL_FAMILY_CAMERA         0x32
+#define IOCTL_FAMILY_BT_HOST        0x33
+#define IOCTL_FAMILY_WLANPHY        0x34
+#define IOCTL_FAMILY_SERIAL         0x35
+#define IOCTL_FAMILY_WLANTAP        0x36
+#define IOCTL_FAMILY_DISPLAY_CONTROLLER 0x37
+#define IOCTL_FAMILY_DEBUG          0x38
+#define IOCTL_FAMILY_AUDIO_CODEC    0x39
+#define IOCTL_FAMILY_BACKLIGHT      0x3A
+#define IOCTL_FAMILY_NAND_TEST      0x3B
+#define IOCTL_FAMILY_TEE            0x3C
+#define IOCTL_FAMILY_SKIP_BLOCK     0x3D
+#define IOCTL_FAMILY_USB_TEST       0x3E
+#define IOCTL_FAMILY_CLK            0x3F
+// 0x40 unused.
+#define IOCTL_FAMILY_QMI            0x41
+
+// IOCTL constructor
+// --K-FFNN
+#define IOCTL(kind, family, number) \
+    ((((kind) & 0xF) << 20) | (((family) & 0xFF) << 8) | ((number) & 0xFF))
+
+// IOCTL accessors
+#define IOCTL_KIND(n) (((n) >> 20) & 0xF)
+#define IOCTL_FAMILY(n) (((n) >> 8) & 0xFF)
+#define IOCTL_NUMBER(n) ((n) & 0xFF)
diff --git a/arch/arm64/sysroot/include/zircon/device/ramdisk.h b/arch/arm64/sysroot/include/zircon/device/ramdisk.h
new file mode 100644
index 0000000..dac72b9
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/device/ramdisk.h
@@ -0,0 +1,83 @@
+// 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.
+
+#pragma once
+
+#include <limits.h>
+#include <zircon/boot/image.h>
+#include <zircon/device/ioctl.h>
+#include <zircon/device/ioctl-wrapper.h>
+#include <zircon/types.h>
+
+#define IOCTL_RAMDISK_CONFIG \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 1)
+#define IOCTL_RAMDISK_CONFIG_VMO \
+    IOCTL(IOCTL_KIND_SET_HANDLE, IOCTL_FAMILY_RAMDISK, 4)
+#define IOCTL_RAMDISK_UNLINK \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 2)
+#define IOCTL_RAMDISK_SET_FLAGS \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 3)
+#define IOCTL_RAMDISK_WAKE_UP \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 4)
+#define IOCTL_RAMDISK_SLEEP_AFTER \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 5)
+#define IOCTL_RAMDISK_GET_BLK_COUNTS \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 6)
+
+// Ramdisk-specific flags
+#define RAMDISK_FLAG_RESUME_ON_WAKE 0xFF000001
+
+typedef struct ramdisk_ioctl_config {
+    uint64_t blk_size;
+    uint64_t blk_count;
+    uint8_t type_guid[ZBI_PARTITION_GUID_LEN];
+} ramdisk_ioctl_config_t;
+
+typedef struct ramdisk_ioctl_config_response {
+    char name[NAME_MAX + 1];
+} ramdisk_ioctl_config_response_t;
+
+typedef struct ramdisk_blk_counts {
+    uint64_t received;
+    uint64_t successful;
+    uint64_t failed;
+} ramdisk_blk_counts_t;
+
+// ssize_t ioctl_ramdisk_config(int fd, const ramdisk_ioctl_config_t* in,
+//                              ramdisk_ioctl_config_response_t* out);
+IOCTL_WRAPPER_INOUT(ioctl_ramdisk_config, IOCTL_RAMDISK_CONFIG, ramdisk_ioctl_config_t,
+                    ramdisk_ioctl_config_response_t);
+
+// ssize_t ioctl_ramdisk_config_vmo(int fd, const zx_handle_t* in,
+//                                  ramdisk_ioctl_config_response_t* out);
+IOCTL_WRAPPER_INOUT(ioctl_ramdisk_config_vmo, IOCTL_RAMDISK_CONFIG_VMO,
+                    zx_handle_t, ramdisk_ioctl_config_response_t);
+
+// ssize_t ioctl_ramdisk_unlink(int fd);
+IOCTL_WRAPPER(ioctl_ramdisk_unlink, IOCTL_RAMDISK_UNLINK);
+
+// ssize_t ioctl_ramdisk_set_flags(int fd, uint32_t* in);
+// The flags to set match block_info_t.flags. This is intended to simulate the behavior
+// of other block devices, so it should be used only for tests.
+IOCTL_WRAPPER_IN(ioctl_ramdisk_set_flags, IOCTL_RAMDISK_SET_FLAGS, uint32_t);
+
+// ssize_t ioctl_ramdisk_wake_up(int fd);
+// "Wakes" the ramdisk, if it was sleeping.
+// Transactions are no longer expected to fail after this point, and the ramdisk will not sleep
+// again until the next call to SLEEP_AFTER.
+// This will reset the current transaction count.
+IOCTL_WRAPPER(ioctl_ramdisk_wake_up, IOCTL_RAMDISK_WAKE_UP);
+
+// ssize_t ioctl_ramdisk_sleep_after(int fd, uint64_t* in);
+// Tell the ramdisk to "sleep" after |in| blocks have been written successfully.
+// After this point, all incoming transactions will fail.
+// This will reset the current block count.
+// NOTE! Use caution with RAMDISK_FLAG_RESUME_ON_WAKE set; sleeping with this flags will cause I/O
+// to block indefinitely until another call invokes |ioctl_ramdisk_wake_up|.
+IOCTL_WRAPPER_IN(ioctl_ramdisk_sleep_after, IOCTL_RAMDISK_SLEEP_AFTER, uint64_t);
+
+// ssize_t ioctl_ramdisk_get_blk_counts(int fd, ramdisk_blk_counts_t* out);
+// Retrieve the number of received, successful, and failed block writes since the last call to
+// sleep/wake.
+IOCTL_WRAPPER_OUT(ioctl_ramdisk_get_blk_counts, IOCTL_RAMDISK_GET_BLK_COUNTS, ramdisk_blk_counts_t);
diff --git a/arch/arm64/sysroot/include/zircon/dlfcn.h b/arch/arm64/sysroot/include/zircon/dlfcn.h
new file mode 100644
index 0000000..af4a62b
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/dlfcn.h
@@ -0,0 +1,32 @@
+// 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.
+
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/zircon/driver/binding.h b/arch/arm64/sysroot/include/zircon/driver/binding.h
new file mode 100644
index 0000000..7c05026
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/driver/binding.h
@@ -0,0 +1,286 @@
+// 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 <assert.h>
+#include <zircon/compiler.h>
+#include <stdalign.h>
+#include <stddef.h>
+#include <stdint.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_SET    0x3 // if (cond) flags |= paramA
+#define OP_CLEAR  0x4 // if (cond) flags &= (~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
+#define COND_MASK 0x7 // (bind(paramB) & Value) != 0
+#define COND_BITS 0x8 // (bind(paramB) & Value) == 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) }
+
+#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_SET(f)             BINDINST(COND_AL,OP_SET,f,0,0)
+#define BI_CLEAR(f)           BINDINST(COND_AL,OP_CLEAR,f,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)
+#define BI_SET_IF(c,b,v,f)    BINDINST(COND_##c,OP_SET,f,b,v)
+#define BI_CLEAR_IF(c,b,v,f)  BINDINST(COND_##c,OP_CLEAR,f,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 protcol 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
+#define BIND_PCI_BDF_ADDR     0x0106
+
+// pci binding variable utils
+#define BIND_PCI_BDF_PACK(bus, dev, func) \
+    ((((uint32_t)(bus)  & 0xFF) << 8) |   \
+     (((uint32_t)(dev)  & 0x1F) << 3) |   \
+      ((uint32_t)(func) & 0x07))
+
+#define BIND_PCI_BDF_UNPACK_BUS(bdf) (((uint32_t)(bdf) >> 8) & 0xFF)
+#define BIND_PCI_BDF_UNPACK_DEV(bdf) (((uint32_t)(bdf) >> 3) & 0x1F)
+#define BIND_PCI_BDF_UNPACK_FUNC(bdf) ((uint32_t)(bdf) & 0x07)
+
+// 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
+
+// I2C binding variables at 0x0AXX
+#define BIND_I2C_CLASS            0x0A00
+
+// TEMPORARY binding variables at 0xfXX
+// I2C_ADDR is a temporary way to bind the i2c touchscreen on the Acer12. This
+// binding will eventually be made via some sort of ACPI device enumeration.
+#define BIND_I2C_ADDR         0x0f00
+
+typedef struct zx_bind_inst {
+    uint32_t op;
+    uint32_t arg;
+} 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) \
+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;
diff --git a/arch/arm64/sysroot/include/zircon/errors.h b/arch/arm64/sysroot/include/zircon/errors.h
new file mode 100644
index 0000000..1c1ed80
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/errors.h
@@ -0,0 +1,231 @@
+// 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
+
+// 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)
diff --git a/arch/arm64/sysroot/include/zircon/features.h b/arch/arm64/sysroot/include/zircon/features.h
new file mode 100644
index 0000000..a560007
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/features.h
@@ -0,0 +1,45 @@
+// 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 ZIRCON_FEATURES_H_
+#define 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)
+
+// 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 // ZIRCON_FEATURES_H_
diff --git a/arch/arm64/sysroot/include/zircon/fidl.h b/arch/arm64/sysroot/include/zircon/fidl.h
new file mode 100644
index 0000000..e971472
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/fidl.h
@@ -0,0 +1,377 @@
+// 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 ZIRCON_FIDL_H_
+#define ZIRCON_FIDL_H_
+
+#include <assert.h>
+#include <stdalign.h>
+#include <stdint.h>
+
+#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++14.
+//
+// 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.
+#define FIDL_ALIGNMENT ((size_t)8)
+#define FIDL_ALIGN(a) (((a) + 7) & ~7)
+#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.
+
+// 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.
+
+// Messages.
+
+// All fidl messages share a common 16 byte header.
+
+typedef struct fidl_message_header {
+    zx_txid_t txid;
+    // This reserved word is used by Epitaphs to represent an error value.
+    uint32_t reserved0;
+    uint32_t flags;
+    uint32_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
+
+// The system reserves the high half of the ordinal space.
+
+#define FIDL_ORD_SYSTEM_MASK 0x80000000ul
+
+// 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 error associated with this epitaph is stored in the reserved word of
+    // the message header.  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.
+    fidl_message_header_t hdr;
+} fidl_epitaph_t;
+
+// This ordinal value is reserved for Epitaphs.
+#define FIDL_EPITAPH_ORDINAL 0xFFFFFFFF
+
+// 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 // ZIRCON_FIDL_H_
diff --git a/arch/arm64/sysroot/include/zircon/hw/gpt.h b/arch/arm64/sysroot/include/zircon/hw/gpt.h
new file mode 100644
index 0000000..c3112f5
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/gpt.h
@@ -0,0 +1,172 @@
+// 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.
+
+#pragma once
+
+#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;
+    uint32_t revision;
+    uint32_t size;
+    uint32_t crc32;
+    uint32_t reserved0;
+    uint64_t current;
+    uint64_t backup;
+    uint64_t first;
+    uint64_t last;
+    uint8_t guid[GPT_GUID_LEN];
+    uint64_t entries;
+    uint32_t entries_count;
+    uint32_t entries_size;
+    uint32_t entries_crc;
+} __PACKED gpt_header_t;
+
+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
+} __PACKED gpt_entry_t;
+
+#define GUID_EMPTY_VALUE {                         \
+    0x00, 0x00, 0x00, 0x00,                        \
+    0x00, 0x00,                                    \
+    0x00, 0x00,                                    \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \
+}
+
+#define GUID_EFI_VALUE {                           \
+    0x28, 0x73, 0x2a, 0xc1,                        \
+    0x1f, 0xf8,                                    \
+    0xd2, 0x11,                                    \
+    0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b \
+}
+
+// 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 \
+}
+
+// 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 \
+}
+
+// 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_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_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_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_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_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_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_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_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_TEST_STRING "8B94D043-30BE-4871-9DFA-D69556E8C1F3"
+#define GUID_TEST_VALUE { \
+    0x43, 0xD0, 0x94, 0x8b,                        \
+    0xbe, 0x30,                                    \
+    0x71, 0x38,                                    \
+    0x9d, 0xfa, 0xd6, 0x95, 0x56, 0xe8, 0xc1, 0xf3 \
+}
+
+#define GUID_VBMETA_A_STRING "A13B4D9A-EC5F-11E8-97D8-6C3BE52705BF"
+#define GUID_VBMETA_A_VALUE { \
+    0x9a, 0x4d, 0x3b, 0xa1,                        \
+    0x5f, 0xec,                                    \
+    0xd8, 0x97,                                    \
+    0x6c, 0x3b, 0x6c, 0x3b, 0xe2, 0x27, 0x05, 0xbf \
+}
+
+#define GUID_VBMETA_B_STRING "A288ABF2-EC5F-11E8-97D8-6C3BE52705BF"
+#define GUID_VBMETA_B_VALUE { \
+    0xf2, 0xab, 0x88, 0xa2,                        \
+    0x5f, 0xec,                                    \
+    0xd8, 0x97,                                    \
+    0x6c, 0x3b, 0x6c, 0x3b, 0xe2, 0x27, 0x05, 0xbf \
+}
diff --git a/arch/arm64/sysroot/include/zircon/hw/i2c.h b/arch/arm64/sysroot/include/zircon/hw/i2c.h
new file mode 100644
index 0000000..a8f0f4b
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/i2c.h
@@ -0,0 +1,7 @@
+// 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
+
+#define I2C_CLASS_HID 1
diff --git a/arch/arm64/sysroot/include/zircon/hw/pci.h b/arch/arm64/sysroot/include/zircon/hw/pci.h
new file mode 100644
index 0000000..06c7023
--- /dev/null
+++ b/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 ZIRCON_HW_PCI_H_
+#define 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 // ZIRCON_HW_PCI_H_
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb-audio.h b/arch/arm64/sysroot/include/zircon/hw/usb-audio.h
new file mode 100644
index 0000000..7af2994
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb-audio.h
@@ -0,0 +1,524 @@
+// 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
+
+// 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 concatinated, 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;
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb-cdc.h b/arch/arm64/sysroot/include/zircon/hw/usb-cdc.h
new file mode 100644
index 0000000..f64a422
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb-cdc.h
@@ -0,0 +1,138 @@
+// 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.
+
+#pragma once
+
+// 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 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;
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb-hid.h b/arch/arm64/sysroot/include/zircon/hw/usb-hid.h
new file mode 100644
index 0000000..d8be878
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb-hid.h
@@ -0,0 +1,33 @@
+// 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
+
+// clang-format off
+
+__BEGIN_CDECLS;
+
+/* 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
+
+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;
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb-hub.h b/arch/arm64/sysroot/include/zircon/hw/usb-hub.h
new file mode 100644
index 0000000..2a8b395
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb-hub.h
@@ -0,0 +1,114 @@
+// 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
+
+// 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;
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb-mass-storage.h b/arch/arm64/sysroot/include/zircon/hw/usb-mass-storage.h
new file mode 100644
index 0000000..f2d1d80
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb-mass-storage.h
@@ -0,0 +1,156 @@
+// 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
+
+// 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, "");
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb-video.h b/arch/arm64/sysroot/include/zircon/hw/usb-video.h
new file mode 100644
index 0000000..1ff6e22
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb-video.h
@@ -0,0 +1,304 @@
+// 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.
+
+#pragma once
+
+// clang-format off
+
+#include <zircon/compiler.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;
+
diff --git a/arch/arm64/sysroot/include/zircon/hw/usb.h b/arch/arm64/sysroot/include/zircon/hw/usb.h
new file mode 100644
index 0000000..697f7f0
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/hw/usb.h
@@ -0,0 +1,242 @@
+// 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
+
+// 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_VENDOR                    0xFf
+
+#define USB_SUBCLASS_MSC_SCSI               0x06
+#define USB_PROTOCOL_MSC_BULK_ONLY          0x50
+
+/* 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_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_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;
+
+__END_CDECLS;
diff --git a/arch/arm64/sysroot/include/zircon/limits.h b/arch/arm64/sysroot/include/zircon/limits.h
new file mode 100644
index 0000000..4c691a3
--- /dev/null
+++ b/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 ZIRCON_LIMITS_H_
+#define ZIRCON_LIMITS_H_
+
+#include <stdint.h>
+
+#define ZX_PAGE_SHIFT ((uint32_t)12u)
+#define ZX_PAGE_SIZE ((uint32_t)(1u << ZX_PAGE_SHIFT))
+#define ZX_PAGE_MASK (ZX_PAGE_SIZE - 1u)
+
+#endif // ZIRCON_LIMITS_H_
diff --git a/arch/arm64/sysroot/include/zircon/listnode.h b/arch/arm64/sysroot/include/zircon/listnode.h
new file mode 100644
index 0000000..b987bdf
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/listnode.h
@@ -0,0 +1,304 @@
+// 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/compiler.h>
+#include <stdbool.h>
+#include <stddef.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(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(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;
diff --git a/arch/arm64/sysroot/include/zircon/pixelformat.h b/arch/arm64/sysroot/include/zircon/pixelformat.h
new file mode 100644
index 0000000..8d15c0c
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/pixelformat.h
@@ -0,0 +1,26 @@
+// 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 ZIRCON_PIXELFORMAT_H_
+#define 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_BYTES(pf)  (((pf) >> 16) & 7)
+
+#endif // ZIRCON_PIXELFORMAT_H_
diff --git a/arch/arm64/sysroot/include/zircon/process.h b/arch/arm64/sysroot/include/zircon/process.h
new file mode 100644
index 0000000..bec8a79
--- /dev/null
+++ b/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 ZIRCON_PROCESS_H_
+#define ZIRCON_PROCESS_H_
+
+#include <zircon/types.h>
+#include <stdint.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 // ZIRCON_PROCESS_H_
diff --git a/arch/arm64/sysroot/include/zircon/processargs.h b/arch/arm64/sysroot/include/zircon/processargs.h
new file mode 100644
index 0000000..dfc771f
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/processargs.h
@@ -0,0 +1,163 @@
+// 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 ZIRCON_PROCESSARGS_H_
+#define ZIRCON_PROCESSARGS_H_
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+#include <stdint.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_SUBTYPE(n)          (((n) >> 8) & 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
+
+
+// --- FDIO Handles ---
+// Used by libfdio for passing fdtable, fsroot, etc
+
+// Handle types the fdio library uses
+#define PA_FDIO_REMOTE           0x32u
+#define PA_FDIO_LOGGER           0x35u
+#define PA_FDIO_SOCKET           0x36u
+
+// Server endpoint for handling connection to appmgr services.
+#define PA_DIRECTORY_REQUEST     0x3Bu
+
+// Used by devmgr and devhosts
+#define PA_RESOURCE              0x3Fu
+
+
+// --- Various ---
+
+// Handle types for one-off use and prototyping
+#define PA_USER0                 0xF0u
+#define PA_USER1                 0xF1u
+#define PA_USER2                 0xF2u
+
+__END_CDECLS
+
+#endif // ZIRCON_PROCESSARGS_H_
diff --git a/arch/arm64/sysroot/include/zircon/rights.h b/arch/arm64/sysroot/include/zircon/rights.h
new file mode 100644
index 0000000..8c9f021
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/rights.h
@@ -0,0 +1,127 @@
+// 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 ZIRCON_RIGHTS_H_
+#define 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_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)
+
+#define ZX_DEFAULT_LOG_RIGHTS \
+    (ZX_RIGHTS_BASIC | ZX_RIGHT_WRITE | ZX_RIGHT_SIGNAL)
+
+#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_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_EXECUTE | 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_ENUMERATE | ZX_RIGHT_GET_PROPERTY |\
+     ZX_RIGHT_SET_PROPERTY | ZX_RIGHT_TRANSFER)
+
+#endif // ZIRCON_RIGHTS_H_
diff --git a/arch/arm64/sysroot/include/zircon/sanitizer.h b/arch/arm64/sysroot/include/zircon/sanitizer.h
new file mode 100644
index 0000000..0b0b7a3
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/sanitizer.h
@@ -0,0 +1,144 @@
+// 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.
+
+#pragma once
+
+// 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);
+
+// 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);
+
+// 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);
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/status.h b/arch/arm64/sysroot/include/zircon/status.h
new file mode 100644
index 0000000..5d83c72
--- /dev/null
+++ b/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".
+const char* _zx_status_get_string(zx_status_t status);
+const char* zx_status_get_string(zx_status_t status);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/arm64/sysroot/include/zircon/syscalls.h b/arch/arm64/sysroot/include/zircon/syscalls.h
new file mode 100644
index 0000000..b5c0057
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls.h
@@ -0,0 +1,30 @@
+// 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 ZIRCON_SYSCALLS_H_
+#define ZIRCON_SYSCALLS_H_
+
+#include <zircon/types.h>
+#include <zircon/syscalls/types.h>
+
+#include <zircon/syscalls/pci.h>
+#include <zircon/syscalls/object.h>
+#include <zircon/syscalls/profile.h>
+
+__BEGIN_CDECLS
+
+#if defined(__clang__)
+#define ZX_SYSCALL_PARAM_ATTR(x)   __attribute__((annotate("zx_" #x)))
+#else
+#define ZX_SYSCALL_PARAM_ATTR(x)   // no-op
+#endif
+
+#include <zircon/syscalls/definitions.h>
+
+// Compatibility wrappers for deprecated syscalls also go here, when
+// there are any.
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_H_
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/debug.h b/arch/arm64/sysroot/include/zircon/syscalls/debug.h
new file mode 100644
index 0000000..82ea309
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/debug.h
@@ -0,0 +1,162 @@
+// 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 ZIRCON_SYSCALLS_DEBUG_
+#define 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;
+} 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.
+
+    // 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;
+} 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.
+  // TODO(donosoc): These values are deprecated but are still used by zxdb. We debine both values
+  //                in order to do a soft transition. Delete these values once zxdb has made the
+  //                update.
+  uint64_t dr6_status;  // Status register.
+  uint64_t dr7_control; // 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;
+} 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 {
+    uint64_t dbgbvr;      //  HW Breakpoint Value register.
+    uint32_t dbgbcr;      //  HW Breakpoint Control register.
+  } hw_bps[AARCH64_MAX_HW_BREAKPOINTS];
+  // Number of HW Breakpoints in the platform.
+  // Will be set on read and ignored on write.
+  uint8_t hw_bps_count;
+  struct {
+    uint64_t dbgwvr;      // HW Watchpoint Value register.
+    uint32_t dbgwcr;      // HW Watchpoint Control register.
+  } hw_wps[AARCH64_MAX_HW_WATCHPOINTS];
+  // Number of HW Watchpoints in the platform.
+  // Will be set on read and ignored on write.
+  uint8_t hw_wps_count;
+} 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 // ZIRCON_SYSCALLS_DEBUG_
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/definitions.h b/arch/arm64/sysroot/include/zircon/syscalls/definitions.h
new file mode 100644
index 0000000..70da713
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/definitions.h
@@ -0,0 +1,1839 @@
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
+// This is a GENERATED file, see //zircon/system/host/abigen.
+// The license governing this file can be found in the LICENSE file.
+
+extern zx_time_t zx_clock_get(
+    zx_clock_t clock_id) __LEAF_FN;
+
+extern zx_time_t _zx_clock_get(
+    zx_clock_t clock_id) __LEAF_FN;
+
+extern zx_status_t zx_clock_get_new(
+    zx_clock_t clock_id,
+    zx_time_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_clock_get_new(
+    zx_clock_t clock_id,
+    zx_time_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_time_t zx_clock_get_monotonic(
+    void) __LEAF_FN;
+
+extern zx_time_t _zx_clock_get_monotonic(
+    void) __LEAF_FN;
+
+extern zx_status_t zx_nanosleep(
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_nanosleep(
+    zx_time_t deadline) __LEAF_FN;
+
+extern uint64_t zx_ticks_get(
+    void) __LEAF_FN;
+
+extern uint64_t _zx_ticks_get(
+    void) __LEAF_FN;
+
+extern uint64_t zx_ticks_per_second(
+    void) __LEAF_FN __CONST;
+
+extern uint64_t _zx_ticks_per_second(
+    void) __LEAF_FN __CONST;
+
+extern zx_time_t zx_deadline_after(
+    zx_duration_t nanoseconds) __LEAF_FN;
+
+extern zx_time_t _zx_deadline_after(
+    zx_duration_t nanoseconds) __LEAF_FN;
+
+extern zx_status_t zx_clock_adjust(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_clock_t clock_id,
+    int64_t offset) __LEAF_FN;
+
+extern zx_status_t _zx_clock_adjust(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_clock_t clock_id,
+    int64_t offset) __LEAF_FN;
+
+extern uint32_t zx_system_get_dcache_line_size(
+    void) __LEAF_FN __CONST;
+
+extern uint32_t _zx_system_get_dcache_line_size(
+    void) __LEAF_FN __CONST;
+
+extern uint32_t zx_system_get_num_cpus(
+    void) __LEAF_FN __CONST;
+
+extern uint32_t _zx_system_get_num_cpus(
+    void) __LEAF_FN __CONST;
+
+extern zx_status_t zx_system_get_version(
+    char* version,
+    size_t version_size) __LEAF_FN;
+
+extern zx_status_t _zx_system_get_version(
+    char* version,
+    size_t version_size) __LEAF_FN;
+
+extern uint64_t zx_system_get_physmem(
+    void) __LEAF_FN;
+
+extern uint64_t _zx_system_get_physmem(
+    void) __LEAF_FN;
+
+extern zx_status_t zx_system_get_features(
+    uint32_t kind,
+    ZX_SYSCALL_PARAM_ATTR(features) uint32_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_system_get_features(
+    uint32_t kind,
+    ZX_SYSCALL_PARAM_ATTR(features) uint32_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_cache_flush(
+    const void* addr,
+    size_t size,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_cache_flush(
+    const void* addr,
+    size_t size,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_handle_close(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_handle_close(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_handle_close_many(
+    const zx_handle_t* handles,
+    size_t num_handles) __LEAF_FN;
+
+extern zx_status_t _zx_handle_close_many(
+    const zx_handle_t* handles,
+    size_t num_handles) __LEAF_FN;
+
+extern zx_status_t zx_handle_duplicate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_handle_duplicate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_handle_replace(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_handle_replace(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_object_wait_one(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_signals_t signals,
+    zx_time_t deadline,
+    zx_signals_t* observed) __LEAF_FN;
+
+extern zx_status_t _zx_object_wait_one(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_signals_t signals,
+    zx_time_t deadline,
+    zx_signals_t* observed) __LEAF_FN;
+
+extern zx_status_t zx_object_wait_many(
+    zx_wait_item_t* items,
+    size_t count,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_object_wait_many(
+    zx_wait_item_t* items,
+    size_t count,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t zx_object_wait_async(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    zx_signals_t signals,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_object_wait_async(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    zx_signals_t signals,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_object_signal(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t _zx_object_signal(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t zx_object_signal_peer(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t _zx_object_signal_peer(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t zx_object_get_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t zx_object_set_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    const void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t _zx_object_set_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    const void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t zx_object_set_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t cookie) __LEAF_FN;
+
+extern zx_status_t _zx_object_set_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t cookie) __LEAF_FN;
+
+extern zx_status_t zx_object_get_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t* cookie) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t* cookie) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_object_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t topic,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual_count,
+    size_t* avail_count) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t topic,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual_count,
+    size_t* avail_count) __LEAF_FN;
+
+extern zx_status_t zx_object_get_child(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t koid,
+    zx_rights_t rights,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_child(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t koid,
+    zx_rights_t rights,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_object_set_profile(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t profile,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_object_set_profile(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t profile,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_channel_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_channel_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_channel_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* bytes,
+    zx_handle_t* handles,
+    uint32_t num_bytes,
+    uint32_t num_handles,
+    uint32_t* actual_bytes,
+    uint32_t* actual_handles) __LEAF_FN;
+
+extern zx_status_t _zx_channel_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* bytes,
+    zx_handle_t* handles,
+    uint32_t num_bytes,
+    uint32_t num_handles,
+    uint32_t* actual_bytes,
+    uint32_t* actual_handles) __LEAF_FN;
+
+extern zx_status_t zx_channel_read_etc(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __LEAF_FN;
+
+extern zx_status_t _zx_channel_read_etc(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __LEAF_FN;
+
+extern zx_status_t zx_channel_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* bytes,
+    uint32_t num_bytes,
+    const zx_handle_t* handles,
+    uint32_t num_handles) __LEAF_FN;
+
+extern zx_status_t _zx_channel_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* bytes,
+    uint32_t num_bytes,
+    const zx_handle_t* handles,
+    uint32_t num_handles) __LEAF_FN;
+
+extern zx_status_t zx_channel_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_channel_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_socket_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_socket_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_socket_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t _zx_socket_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t zx_socket_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t _zx_socket_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t zx_socket_share(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t socket_to_share) __LEAF_FN;
+
+extern zx_status_t _zx_socket_share(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t socket_to_share) __LEAF_FN;
+
+extern zx_status_t zx_socket_accept(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_socket) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_socket_accept(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_socket) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_socket_shutdown(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_socket_shutdown(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options) __LEAF_FN;
+
+extern void zx_thread_exit(
+    void) __LEAF_FN __NO_RETURN;
+
+extern void _zx_thread_exit(
+    void) __LEAF_FN __NO_RETURN;
+
+extern zx_status_t zx_thread_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t process,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_thread_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t process,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_thread_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t thread_entry,
+    zx_vaddr_t stack,
+    uintptr_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t _zx_thread_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t thread_entry,
+    zx_vaddr_t stack,
+    uintptr_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t zx_thread_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_thread_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_thread_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_thread_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_thread_set_priority(
+    int32_t prio) __LEAF_FN;
+
+extern zx_status_t _zx_thread_set_priority(
+    int32_t prio) __LEAF_FN;
+
+extern void zx_process_exit(
+    int64_t retcode) __LEAF_FN __NO_RETURN;
+
+extern void _zx_process_exit(
+    int64_t retcode) __LEAF_FN __NO_RETURN;
+
+extern zx_status_t zx_process_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* proc_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_process_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* proc_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_process_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t thread,
+    zx_vaddr_t entry,
+    zx_vaddr_t stack,
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t _zx_process_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t thread,
+    zx_vaddr_t entry,
+    zx_vaddr_t stack,
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t zx_process_read_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_process_read_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_process_write_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_process_write_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_job_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_job,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_job_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_job,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_job_set_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    uint32_t options,
+    uint32_t topic,
+    const void* policy,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t _zx_job_set_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    uint32_t options,
+    uint32_t topic,
+    const void* policy,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t zx_task_bind_exception_port(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_task_bind_exception_port(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_task_suspend(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_task_suspend(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_task_suspend_token(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_task_suspend_token(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_task_resume_from_exception(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_task_resume_from_exception(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_task_kill(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_task_kill(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_event_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_event_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_eventpair_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_eventpair_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_futex_wait(
+    const zx_futex_t* value_ptr,
+    zx_futex_t current_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_futex_owner,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wait(
+    const zx_futex_t* value_ptr,
+    zx_futex_t current_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_futex_owner,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t zx_futex_wake(
+    const zx_futex_t* value_ptr,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wake(
+    const zx_futex_t* value_ptr,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t zx_futex_requeue(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t _zx_futex_requeue(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t zx_futex_wake_single_owner(
+    const zx_futex_t* value_ptr) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wake_single_owner(
+    const zx_futex_t* value_ptr) __LEAF_FN;
+
+extern zx_status_t zx_futex_requeue_single_owner(
+    const zx_futex_t* wake_ptr,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t _zx_futex_requeue_single_owner(
+    const zx_futex_t* wake_ptr,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t zx_futex_get_owner(
+    const zx_futex_t* value_ptr,
+    zx_koid_t* koid) __LEAF_FN;
+
+extern zx_status_t _zx_futex_get_owner(
+    const zx_futex_t* value_ptr,
+    zx_koid_t* koid) __LEAF_FN;
+
+extern zx_status_t zx_futex_wait_deprecated(
+    const zx_futex_t* value_ptr,
+    int32_t current_value,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wait_deprecated(
+    const zx_futex_t* value_ptr,
+    int32_t current_value,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t zx_futex_requeue_deprecated(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    int32_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count) __LEAF_FN;
+
+extern zx_status_t _zx_futex_requeue_deprecated(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    int32_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count) __LEAF_FN;
+
+extern zx_status_t zx_port_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_port_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_port_queue(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t _zx_port_queue(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t zx_port_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t _zx_port_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t zx_port_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t source,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t _zx_port_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t source,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t zx_timer_create(
+    uint32_t options,
+    zx_clock_t clock_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_timer_create(
+    uint32_t options,
+    zx_clock_t clock_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_timer_set(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_duration_t slack) __LEAF_FN;
+
+extern zx_status_t _zx_timer_set(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_duration_t slack) __LEAF_FN;
+
+extern zx_status_t zx_timer_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_timer_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_vmo_create(
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_create(
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_get_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t* size) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_get_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t* size) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_set_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_set_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_op_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t op,
+    uint64_t offset,
+    uint64_t size,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_op_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t op,
+    uint64_t offset,
+    uint64_t size,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_clone(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_clone(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_set_cache_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t cache_policy) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_set_cache_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t cache_policy) __LEAF_FN;
+
+extern zx_status_t zx_vmo_replace_as_executable(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmex,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_replace_as_executable(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmex,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_allocate_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    uint64_t offset,
+    uint64_t size,
+    uint32_t map_flags,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_allocate_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    uint64_t offset,
+    uint64_t size,
+    uint32_t map_flags,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_map_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    uint32_t map_flags,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_map_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    uint32_t map_flags,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_protect_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len,
+    uint32_t prot_flags) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_protect_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len,
+    uint32_t prot_flags) __LEAF_FN;
+
+extern zx_status_t zx_vmar_allocate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    zx_vm_option_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_allocate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    zx_vm_option_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_vmar_map(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_map(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_unmap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_unmap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern zx_status_t zx_vmar_protect(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_protect(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern void zx_cprng_draw(
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern void _zx_cprng_draw(
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_cprng_add_entropy(
+    const void* buffer,
+    size_t len) __LEAF_FN;
+
+extern zx_status_t _zx_cprng_add_entropy(
+    const void* buffer,
+    size_t len) __LEAF_FN;
+
+extern zx_status_t zx_fifo_create(
+    size_t elem_count,
+    size_t elem_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((4, 5)) __LEAF_FN;
+
+extern zx_status_t _zx_fifo_create(
+    size_t elem_count,
+    size_t elem_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((4, 5)) __LEAF_FN;
+
+extern zx_status_t zx_fifo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t _zx_fifo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t zx_fifo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    const void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t _zx_fifo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    const void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t zx_profile_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const zx_profile_info_t* profile,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_profile_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const zx_profile_info_t* profile,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_unmap_handle_close_thread_exit(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmar_handle,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_unmap_handle_close_thread_exit(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmar_handle,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN;
+
+extern void zx_futex_wake_handle_close_thread_exit(
+    const zx_futex_t* value_ptr,
+    uint32_t count,
+    int32_t new_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN __NO_RETURN;
+
+extern void _zx_futex_wake_handle_close_thread_exit(
+    const zx_futex_t* value_ptr,
+    uint32_t count,
+    int32_t new_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN __NO_RETURN;
+
+extern zx_status_t zx_log_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    const void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_log_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    const void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_log_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_log_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_debuglog_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_debuglog_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_debuglog_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debuglog_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_debuglog_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debuglog_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_ktrace_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* data,
+    uint32_t offset,
+    size_t data_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_ktrace_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* data,
+    uint32_t offset,
+    size_t data_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_ktrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t action,
+    uint32_t options,
+    void* ptr) __LEAF_FN;
+
+extern zx_status_t _zx_ktrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t action,
+    uint32_t options,
+    void* ptr) __LEAF_FN;
+
+extern zx_status_t zx_ktrace_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t id,
+    uint32_t arg0,
+    uint32_t arg1) __LEAF_FN;
+
+extern zx_status_t _zx_ktrace_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t id,
+    uint32_t arg0,
+    uint32_t arg1) __LEAF_FN;
+
+extern zx_status_t zx_mtrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    uint32_t action,
+    uint32_t options,
+    void* ptr,
+    size_t ptr_size) __LEAF_FN;
+
+extern zx_status_t _zx_mtrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    uint32_t action,
+    uint32_t options,
+    void* ptr,
+    size_t ptr_size) __LEAF_FN;
+
+extern zx_status_t zx_debug_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    char* buffer,
+    size_t* buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debug_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    char* buffer,
+    size_t* buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_debug_write(
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debug_write(
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_debug_send_command(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debug_send_command(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t src_obj,
+    uint32_t src_num,
+    uint32_t options,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t src_obj,
+    uint32_t src_num,
+    uint32_t options,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_bind(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_bind(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t* out_timestamp) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t* out_timestamp) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_ack(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_ack(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_trigger(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    zx_time_t timestamp) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_trigger(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    zx_time_t timestamp) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_bind_vcpu(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vcpu,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_bind_vcpu(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vcpu,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_ioports_request(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint16_t io_addr,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t _zx_ioports_request(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint16_t io_addr,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t zx_vmo_create_contiguous(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bti,
+    size_t size,
+    uint32_t alignment_log2,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_create_contiguous(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bti,
+    size_t size,
+    uint32_t alignment_log2,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_create_physical(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    zx_paddr_t paddr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_create_physical(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    zx_paddr_t paddr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_iommu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t type,
+    const void* desc,
+    size_t desc_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_iommu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t type,
+    const void* desc,
+    size_t desc_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_bti_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t iommu,
+    uint32_t options,
+    uint64_t bti_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_bti_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t iommu,
+    uint32_t options,
+    uint64_t bti_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_bti_pin(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t offset,
+    uint64_t size,
+    zx_paddr_t* addrs,
+    size_t addrs_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((8)) __LEAF_FN;
+
+extern zx_status_t _zx_bti_pin(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t offset,
+    uint64_t size,
+    zx_paddr_t* addrs,
+    size_t addrs_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((8)) __LEAF_FN;
+
+extern zx_status_t zx_bti_release_quarantine(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_bti_release_quarantine(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_pmt_unpin(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_pmt_unpin(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_framebuffer_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t* format,
+    uint32_t* width,
+    uint32_t* height,
+    uint32_t* stride) __NONNULL((2, 3, 4, 5)) __LEAF_FN;
+
+extern zx_status_t _zx_framebuffer_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t* format,
+    uint32_t* width,
+    uint32_t* height,
+    uint32_t* stride) __NONNULL((2, 3, 4, 5)) __LEAF_FN;
+
+extern zx_status_t zx_framebuffer_set_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint32_t len,
+    uint32_t format,
+    uint32_t width,
+    uint32_t height,
+    uint32_t stride) __LEAF_FN;
+
+extern zx_status_t _zx_framebuffer_set_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint32_t len,
+    uint32_t format,
+    uint32_t width,
+    uint32_t height,
+    uint32_t stride) __LEAF_FN;
+
+extern zx_status_t zx_pci_get_nth_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t index,
+    zx_pcie_device_info_t* out_info,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_get_nth_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t index,
+    zx_pcie_device_info_t* out_info,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t zx_pci_enable_bus_master(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool enable) __LEAF_FN;
+
+extern zx_status_t _zx_pci_enable_bus_master(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool enable) __LEAF_FN;
+
+extern zx_status_t zx_pci_reset_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_pci_reset_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_pci_config_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t* out_val) __LEAF_FN;
+
+extern zx_status_t _zx_pci_config_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t* out_val) __LEAF_FN;
+
+extern zx_status_t zx_pci_config_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t val) __LEAF_FN;
+
+extern zx_status_t _zx_pci_config_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t val) __LEAF_FN;
+
+extern zx_status_t zx_pci_cfg_pio_rw(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint8_t bus,
+    uint8_t dev,
+    uint8_t func,
+    uint8_t offset,
+    uint32_t* val,
+    size_t width,
+    bool write) __LEAF_FN;
+
+extern zx_status_t _zx_pci_cfg_pio_rw(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint8_t bus,
+    uint8_t dev,
+    uint8_t func,
+    uint8_t offset,
+    uint32_t* val,
+    size_t width,
+    bool write) __LEAF_FN;
+
+extern zx_status_t zx_pci_get_bar(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t bar_num,
+    zx_pci_bar_t* out_bar,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_get_bar(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t bar_num,
+    zx_pci_bar_t* out_bar,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_pci_map_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    int32_t which_irq,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_map_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    int32_t which_irq,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_pci_query_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t* out_max_irqs) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_query_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t* out_max_irqs) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_pci_set_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t requested_irq_count) __LEAF_FN;
+
+extern zx_status_t _zx_pci_set_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t requested_irq_count) __LEAF_FN;
+
+extern zx_status_t zx_pci_init(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_pci_init_arg_t* init_buf,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t _zx_pci_init(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_pci_init_arg_t* init_buf,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t zx_pci_add_subtract_io_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool mmio,
+    uint64_t base,
+    uint64_t len,
+    bool add) __LEAF_FN;
+
+extern zx_status_t _zx_pci_add_subtract_io_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool mmio,
+    uint64_t base,
+    uint64_t len,
+    bool add) __LEAF_FN;
+
+extern zx_status_t zx_pc_firmware_tables(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_paddr_t* acpi_rsdp,
+    zx_paddr_t* smbios) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_pc_firmware_tables(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_paddr_t* acpi_rsdp,
+    zx_paddr_t* smbios) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_smc_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_smc_parameters_t* parameters,
+    zx_smc_result_t* out_smc_result) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_smc_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_smc_parameters_t* parameters,
+    zx_smc_result_t* out_smc_result) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_resource_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_rsrc,
+    uint32_t options,
+    uint64_t base,
+    size_t size,
+    const char* name,
+    size_t name_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* resource_out) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t _zx_resource_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_rsrc,
+    uint32_t options,
+    uint64_t base,
+    size_t size,
+    const char* name,
+    size_t name_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* resource_out) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t zx_guest_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* guest_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t _zx_guest_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* guest_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t zx_guest_set_trap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t _zx_guest_set_trap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t guest,
+    uint32_t options,
+    zx_vaddr_t entry,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t guest,
+    uint32_t options,
+    zx_vaddr_t entry,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_resume(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_port_packet_t* packet) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_resume(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_port_packet_t* packet) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t vector) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t vector) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_system_mexec(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t kernel,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bootimage) __LEAF_FN;
+
+extern zx_status_t _zx_system_mexec(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t kernel,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bootimage) __LEAF_FN;
+
+extern zx_status_t zx_system_mexec_payload_get(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_system_mexec_payload_get(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_system_powerctl(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t cmd,
+    const zx_system_powerctl_arg_t* arg) __LEAF_FN;
+
+extern zx_status_t _zx_system_powerctl(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t cmd,
+    const zx_system_powerctl_arg_t* arg) __LEAF_FN;
+
+extern zx_status_t zx_pager_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(pager) zx_handle_t* out_pager) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_pager_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(pager) zx_handle_t* out_pager) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_pager_create_vmo(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t pager,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(out_pager_vmo) zx_handle_t* out_pager_vmo) __NONNULL((6)) __LEAF_FN;
+
+extern zx_status_t _zx_pager_create_vmo(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t pager,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(out_pager_vmo) zx_handle_t* out_pager_vmo) __NONNULL((6)) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_0(
+    void) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_0(
+    void) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_1(
+    int a) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_1(
+    int a) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_2(
+    int a,
+    int b) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_2(
+    int a,
+    int b) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_3(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_3(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_4(
+    int a,
+    int b,
+    int c,
+    int d) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_4(
+    int a,
+    int b,
+    int c,
+    int d) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_5(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_5(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_6(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_6(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_7(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_7(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_8(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g,
+    int h) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_8(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g,
+    int h) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_wrapper(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_wrapper(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/exception.h b/arch/arm64/sysroot/include/zircon/syscalls/exception.h
new file mode 100644
index 0000000..4ddf2fb
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/exception.h
@@ -0,0 +1,135 @@
+// 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 ZIRCON_SYSCALLS_EXCEPTION_H_
+#define ZIRCON_SYSCALLS_EXCEPTION_H_
+
+#include <zircon/compiler.h>
+#include <zircon/syscalls/port.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// ask clang format not to mess up the indentation:
+// clang-format off
+
+// This bit is set for synthetic exceptions to distinguish them from
+// architectural exceptions.
+// Note: Port packet types provide 8 bits to distinguish the exception type.
+// See zircon/port.h.
+#define ZX_EXCP_SYNTH ((uint8_t)0x80)
+
+// The kind of an exception.
+// Exception types are a subset of port packet types. See zircon/port.h.
+
+// These are architectural exceptions.
+// Depending on the exception, further information can be found in
+// |report.context.arch|.
+
+// General exception not covered by another value.
+#define ZX_EXCP_GENERAL ZX_PKT_TYPE_EXCEPTION(0)
+#define ZX_EXCP_FATAL_PAGE_FAULT ZX_PKT_TYPE_EXCEPTION(1)
+#define ZX_EXCP_UNDEFINED_INSTRUCTION ZX_PKT_TYPE_EXCEPTION(2)
+#define ZX_EXCP_SW_BREAKPOINT ZX_PKT_TYPE_EXCEPTION(3)
+#define ZX_EXCP_HW_BREAKPOINT ZX_PKT_TYPE_EXCEPTION(4)
+#define ZX_EXCP_UNALIGNED_ACCESS ZX_PKT_TYPE_EXCEPTION(5)
+
+// Synthetic exceptions.
+
+// A thread is starting.
+// This exception is sent to debuggers only (ZX_EXCEPTION_PORT_TYPE_DEBUGGER).
+// The thread is paused until it is resumed by the debugger
+// with zx_task_resume_from_exception.
+#define ZX_EXCP_THREAD_STARTING ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 0)
+
+// A thread is exiting.
+// This exception is sent to debuggers only (ZX_EXCEPTION_PORT_TYPE_DEBUGGER).
+// This exception is different from ZX_EXCP_GONE in that a debugger can
+// still examine thread state.
+// The thread is paused until it is resumed by the debugger
+// with zx_task_resume_from_exception.
+#define ZX_EXCP_THREAD_EXITING ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 1)
+
+// 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
+// invoked the syscall may be resumed with zx_task_resume_from_exception.
+#define ZX_EXCP_POLICY_ERROR ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 2)
+
+// A process is starting.
+// This exception is sent to job debuggers only
+// (ZX_EXCEPTION_PORT_TYPE_JOB_DEBUGGER).
+// The initial thread is paused until it is resumed by the debugger with
+// zx_task_resume_from_exception.
+#define ZX_EXCP_PROCESS_STARTING ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 3)
+
+typedef uint32_t zx_excp_type_t;
+
+// Assuming |excp| is an exception type, return non-zero if it is an
+// architectural exception.
+#define ZX_EXCP_IS_ARCH(excp) \
+  (((excp) & (ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH) & ~ZX_PKT_TYPE_MASK)) == 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;
+    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;
+            zx_arm64_exc_data_t  arm_64;
+        } 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;
+
+// Options for zx_task_resume_from_exception()
+#define ZX_RESUME_TRY_NEXT ((uint32_t)2)
+// Indicates that instead of resuming from the faulting instruction we instead
+// let the next exception handler in the search order, if any, process the
+// exception. If there are no more then the entire process is killed.
+
+// Options for zx_task_bind_exception_port.
+#define ZX_EXCEPTION_PORT_DEBUGGER ((uint32_t)1)
+// When binding an exception port to a process, set the process's debugger
+// exception port.
+
+// The type of exception port a thread may be waiting for a response from.
+// These values are reported in zx_info_thread_t.wait_exception_port_type.
+#define ZX_EXCEPTION_PORT_TYPE_NONE         ((uint32_t)0u)
+#define ZX_EXCEPTION_PORT_TYPE_DEBUGGER     ((uint32_t)1u)
+#define ZX_EXCEPTION_PORT_TYPE_THREAD       ((uint32_t)2u)
+#define ZX_EXCEPTION_PORT_TYPE_PROCESS      ((uint32_t)3u)
+#define ZX_EXCEPTION_PORT_TYPE_JOB          ((uint32_t)4u)
+#define ZX_EXCEPTION_PORT_TYPE_JOB_DEBUGGER ((uint32_t)5u)
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_EXCEPTION_H_
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h b/arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h
new file mode 100644
index 0000000..a62de92
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h
@@ -0,0 +1,67 @@
+// 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.
+
+#pragma once
+
+#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;
+#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;
+    union {
+        uint8_t u8;
+        uint16_t u16;
+        uint32_t u32;
+        uint8_t data[4];
+    };
+} zx_vcpu_io_t;
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/iommu.h b/arch/arm64/sysroot/include/zircon/syscalls/iommu.h
new file mode 100644
index 0000000..e567175
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/iommu.h
@@ -0,0 +1,95 @@
+// 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.
+
+#pragma once
+
+#include <assert.h>
+#include <zircon/compiler.h>
+#include <stdbool.h>
+#include <stdint.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 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
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/log.h b/arch/arm64/sysroot/include/zircon/syscalls/log.h
new file mode 100644
index 0000000..e89d9c5
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/log.h
@@ -0,0 +1,55 @@
+// 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>
+
+__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
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/object.h b/arch/arm64/sysroot/include/zircon/syscalls/object.h
new file mode 100644
index 0000000..33e2e90
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/object.h
@@ -0,0 +1,459 @@
+// 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 ZIRCON_SYSCALLS_OBJECT_H_
+#define 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]
+
+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)
+
+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;
+} zx_info_handle_basic_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[64];
+} zx_info_process_handle_stats_t;
+
+typedef struct zx_info_process {
+    // The process's return code; only valid if |exited| is true.
+    // Guaranteed to be non-zero if the process was killed by |zx_task_kill|.
+    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;
+} zx_info_process_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 to be handled by the
+    // specified port.
+    // The value is one of ZX_EXCEPTION_PORT_TYPE_*.
+    uint32_t wait_exception_port_type;
+} zx_info_thread_t;
+
+typedef struct zx_info_thread_stats {
+    // Total accumulated running time of the thread.
+    zx_duration_t total_runtime;
+} 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;
+} zx_info_bti_t;
+
+typedef struct zx_info_socket {
+    // The options passed to zx_socket_create().
+    uint32_t options;
+
+    // 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;
+    // 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;
+    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 a clone, 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)
+
+// 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;
+
+    // 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 creation options. This is a bitmask of
+    // kResizable    = (1u << 0);
+    // kContiguous   = (1u << 1);
+    uint32_t create_options;
+
+    // VMO mapping cache policy. One of ZX_CACHE_POLICY_*
+    uint32_t cache_policy;
+} zx_info_vmo_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;
+
+#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)
+
+// 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
+
+// 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)
+
+// 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)
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_OBJECT_H_
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/pci.h b/arch/arm64/sysroot/include/zircon/syscalls/pci.h
new file mode 100644
index 0000000..b97f1c3
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/pci.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.
+
+#pragma once
+
+#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;
+        zx_handle_t handle;
+    };
+} 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;
+} 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];
+
+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;
+    } irqs[64];
+
+    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;
+    } 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
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/policy.h b/arch/arm64/sysroot/include/zircon/syscalls/policy.h
new file mode 100644
index 0000000..f7061ce
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/policy.h
@@ -0,0 +1,55 @@
+// 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.
+
+#pragma once
+
+#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                    0u
+
+// Input structure to use with ZX_JOB_POL_BASIC.
+typedef struct zx_policy_basic {
+    uint32_t condition;
+    uint32_t policy;
+} 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
+#ifdef _KERNEL
+#define ZX_POL_MAX                          13u
+#endif
+
+// Policy actions.
+// ZX_POL_ACTION_ALLOW and ZX_POL_ACTION_DENY can be ORed with ZX_POL_ACTION_EXCEPTION.
+// ZX_POL_ACTION_KILL implies ZX_POL_ACTION_DENY.
+#define ZX_POL_ACTION_ALLOW                 0u
+#define ZX_POL_ACTION_DENY                  1u
+#define ZX_POL_ACTION_EXCEPTION             2u
+#define ZX_POL_ACTION_KILL                  5u
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/port.h b/arch/arm64/sysroot/include/zircon/syscalls/port.h
new file mode 100644
index 0000000..10bc39b
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/port.h
@@ -0,0 +1,152 @@
+// 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 ZIRCON_SYSCALLS_PORT_H_
+#define 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_REPEATING     ((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)
+#define ZX_PKT_TYPE_SIGNAL_REP      ((uint8_t)0x02u)
+#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_EXCEPTION(n)    ((uint32_t)(0x08u | (((n) & 0xFFu) << 8)))
+
+// 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_SIGNAL_REP(type)  ((type) == ZX_PKT_TYPE_SIGNAL_REP)
+#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_EXCEPTION(type)   (((type) & ZX_PKT_TYPE_MASK) == ZX_PKT_TYPE_EXCEPTION(0))
+
+// zx_packet_guest_vcpu_t::type
+#define ZX_PKT_GUEST_VCPU_INTERRUPT  ((uint8_t)0)
+#define ZX_PKT_GUEST_VCPU_STARTUP    ((uint8_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 and ZX_PKT_TYPE_SIGNAL_REP.
+typedef struct zx_packet_signal {
+    zx_signals_t trigger;
+    zx_signals_t observed;
+    uint64_t count;
+    uint64_t reserved0;
+    uint64_t reserved1;
+} zx_packet_signal_t;
+
+typedef struct zx_packet_exception {
+    uint64_t pid;
+    uint64_t tid;
+    uint64_t reserved0;
+    uint64_t reserved1;
+} zx_packet_exception_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;
+    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];
+    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 {
+        uint8_t u8;
+        uint16_t u16;
+        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;
+        } interrupt;
+        struct {
+            uint64_t id;
+            zx_gpaddr_t entry;
+        } startup;
+    };
+    uint8_t type;
+    uint64_t reserved;
+} zx_packet_guest_vcpu_t;
+
+typedef struct zx_packet_interrupt {
+    zx_time_t timestamp;
+} zx_packet_interrupt_t;
+
+typedef struct zx_port_packet {
+    uint64_t key;
+    uint32_t type;
+    int32_t status;
+    union {
+        zx_packet_user_t user;
+        zx_packet_signal_t signal;
+        zx_packet_exception_t exception;
+        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_port_packet_t;
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_PORT_H_
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/profile.h b/arch/arm64/sysroot/include/zircon/syscalls/profile.h
new file mode 100644
index 0000000..10ed499
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/profile.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.
+
+#pragma once
+
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// ask clang format not to mess up the indentation:
+// clang-format off
+
+#define ZX_PROFILE_INFO_SCHEDULER   1
+
+typedef struct zx_profile_scheduler {
+    int32_t priority;
+    uint32_t boost;
+    uint32_t deboost;
+    uint32_t quantum;
+} zx_profile_scheduler_t;
+
+#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
+
+typedef struct zx_profile_info {
+    uint32_t type;                  // one of ZX_PROFILE_INFO_
+    union {
+        zx_profile_scheduler_t scheduler;
+    };
+} zx_profile_info_t;
+
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/resource.h b/arch/arm64/sysroot/include/zircon/syscalls/resource.h
new file mode 100644
index 0000000..6defbda
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/resource.h
@@ -0,0 +1,34 @@
+// 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 <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)
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/smc.h b/arch/arm64/sysroot/include/zircon/syscalls/smc.h
new file mode 100644
index 0000000..5c8f9ba
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/smc.h
@@ -0,0 +1,38 @@
+// 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.
+
+#pragma once
+
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+#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;
+    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;
+} zx_smc_parameters_t;
+
+typedef struct zx_smc_result {
+    uint64_t arg0;
+    uint64_t arg1;
+    uint64_t arg2;
+    uint64_t arg3;
+} zx_smc_result_t;
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/system.h b/arch/arm64/sysroot/include/zircon/syscalls/system.h
new file mode 100644
index 0000000..c58de1d
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/system.h
@@ -0,0 +1,37 @@
+// 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.
+
+#pragma once
+
+#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 {
+            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;
+    };
+} zx_system_powerctl_arg_t;
+
+__END_CDECLS
diff --git a/arch/arm64/sysroot/include/zircon/syscalls/types.h b/arch/arm64/sysroot/include/zircon/syscalls/types.h
new file mode 100644
index 0000000..a5a69c8
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/syscalls/types.h
@@ -0,0 +1,22 @@
+// 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/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
diff --git a/arch/arm64/sysroot/include/zircon/threads.h b/arch/arm64/sysroot/include/zircon/threads.h
new file mode 100644
index 0000000..937a9f9
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/threads.h
@@ -0,0 +1,37 @@
+// 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.
+
+#pragma once
+
+#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
diff --git a/arch/arm64/sysroot/include/zircon/time.h b/arch/arm64/sysroot/include/zircon/time.h
new file mode 100644
index 0000000..a075d89
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/time.h
@@ -0,0 +1,96 @@
+// Copyright 2018 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
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+// These functions perform overflow-safe time arithmetic, 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.
+//
+// The naming scheme is zx_<first argument>_<operation>_<second argument>.
+//
+// TODO(maniscalco): Consider expanding the set of operations to include division, modulo, unit
+// conversion, 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;
+}
diff --git a/arch/arm64/sysroot/include/zircon/tls.h b/arch/arm64/sysroot/include/zircon/tls.h
new file mode 100644
index 0000000..acacef1
--- /dev/null
+++ b/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 ZIRCON_TLS_
+#define 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 // ZIRCON_TLS_
diff --git a/arch/arm64/sysroot/include/zircon/types.h b/arch/arm64/sysroot/include/zircon/types.h
new file mode 100644
index 0000000..6f93626
--- /dev/null
+++ b/arch/arm64/sysroot/include/zircon/types.h
@@ -0,0 +1,395 @@
+// 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 ZIRCON_TYPES_H_
+#define 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>
+
+#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)
+
+// See errors.h for the values zx_status_t can take.
+typedef int32_t zx_status_t;
+
+// 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 uint64_t zx_ticks_t;
+#define ZX_TIME_INFINITE INT64_MAX
+#define ZX_TIME_INFINITE_PAST INT64_MIN
+#define ZX_NSEC(n) ((zx_duration_t)(1LL * (n)))
+#define ZX_USEC(n) ((zx_duration_t)(1000LL * (n)))
+#define ZX_MSEC(n) ((zx_duration_t)(1000000LL * (n)))
+#define ZX_SEC(n)  ((zx_duration_t)(1000000000LL * (n)))
+#define ZX_MIN(n)  (ZX_SEC(n) * 60LL)
+#define ZX_HOUR(n) (ZX_MIN(n) * 60LL)
+
+// 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)
+
+// Cancelation (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
+
+// 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_CONTROL_READABLE    __ZX_OBJECT_SIGNAL_6
+#define ZX_SOCKET_CONTROL_WRITABLE    __ZX_OBJECT_SIGNAL_7
+#define ZX_SOCKET_ACCEPT              __ZX_OBJECT_SIGNAL_8
+#define ZX_SOCKET_SHARE               __ZX_OBJECT_SIGNAL_9
+#define ZX_SOCKET_READ_THRESHOLD      __ZX_OBJECT_SIGNAL_10
+#define ZX_SOCKET_WRITE_THRESHOLD     __ZX_OBJECT_SIGNAL_11
+
+// Deprecated
+#define ZX_SOCKET_READ_DISABLED       ZX_SOCKET_PEER_WRITE_DISABLED
+
+// 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_NO_PROCESSES         __ZX_OBJECT_SIGNALED
+#define ZX_JOB_NO_JOBS              __ZX_OBJECT_SIGNAL_4
+
+// 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 objets.
+typedef uint64_t zx_koid_t;
+#define ZX_KOID_INVALID ((uint64_t) 0)
+#define ZX_KOID_KERNEL  ((uint64_t) 1)
+
+// 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;
+
+// Maximum number of wait items allowed for zx_object_wait_many()
+// TODO(ZX-1349) Re-lower this.
+#define ZX_WAIT_MANY_MAX_ITEMS ((size_t)16)
+
+// 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_NON_RESIZABLE             ((uint32_t)1u)
+
+// 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)
+
+// VM Object clone flags
+#define ZX_VMO_CLONE_COPY_ON_WRITE        ((uint32_t)1u << 0)
+#define ZX_VMO_CLONE_NON_RESIZEABLE       ((uint32_t)1u << 1)
+
+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))
+
+
+// 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;
+
+// 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 bind 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)
+
+// 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)
+
+// 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_HAS_CONTROL               ((uint32_t)1u << 1)
+#define ZX_SOCKET_HAS_ACCEPT                ((uint32_t)1u << 2)
+#define ZX_SOCKET_CREATE_MASK               (ZX_SOCKET_DATAGRAM | ZX_SOCKET_HAS_CONTROL | ZX_SOCKET_HAS_ACCEPT)
+
+// These can be passed to zx_socket_read() and zx_socket_write().
+#define ZX_SOCKET_CONTROL                   ((uint32_t)1u << 2)
+
+// 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)
+
+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_LAST            ((zx_obj_type_t)29u)
+
+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;
+
+// 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)
+
+#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
+
+__END_CDECLS
+
+#endif // ZIRCON_TYPES_H_
diff --git a/arch/arm64/sysroot/lib/Scrt1.o b/arch/arm64/sysroot/lib/Scrt1.o
new file mode 100644
index 0000000..ceef414
--- /dev/null
+++ b/arch/arm64/sysroot/lib/Scrt1.o
Binary files differ
diff --git a/arch/arm64/sysroot/lib/libc.so b/arch/arm64/sysroot/lib/libc.so
new file mode 100755
index 0000000..aef212b
--- /dev/null
+++ b/arch/arm64/sysroot/lib/libc.so
Binary files differ
diff --git a/arch/arm64/sysroot/lib/libdl.so b/arch/arm64/sysroot/lib/libdl.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/arm64/sysroot/lib/libm.so b/arch/arm64/sysroot/lib/libm.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/arm64/sysroot/lib/libpthread.so b/arch/arm64/sysroot/lib/libpthread.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/arm64/sysroot/lib/librt.so b/arch/arm64/sysroot/lib/librt.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/arm64/sysroot/lib/libzircon.so b/arch/arm64/sysroot/lib/libzircon.so
new file mode 100755
index 0000000..9985d58
--- /dev/null
+++ b/arch/arm64/sysroot/lib/libzircon.so
Binary files differ
diff --git a/arch/x64/dist/libVkLayer_core_validation.so b/arch/x64/dist/libVkLayer_core_validation.so
new file mode 100755
index 0000000..d11db74
--- /dev/null
+++ b/arch/x64/dist/libVkLayer_core_validation.so
Binary files differ
diff --git a/arch/x64/dist/libVkLayer_image_pipe_swapchain.so b/arch/x64/dist/libVkLayer_image_pipe_swapchain.so
new file mode 100755
index 0000000..d94a22e
--- /dev/null
+++ b/arch/x64/dist/libVkLayer_image_pipe_swapchain.so
Binary files differ
diff --git a/arch/x64/dist/libVkLayer_object_tracker.so b/arch/x64/dist/libVkLayer_object_tracker.so
new file mode 100755
index 0000000..c30fdd4
--- /dev/null
+++ b/arch/x64/dist/libVkLayer_object_tracker.so
Binary files differ
diff --git a/arch/x64/dist/libVkLayer_parameter_validation.so b/arch/x64/dist/libVkLayer_parameter_validation.so
new file mode 100755
index 0000000..5661ecb
--- /dev/null
+++ b/arch/x64/dist/libVkLayer_parameter_validation.so
Binary files differ
diff --git a/arch/x64/dist/libVkLayer_threading.so b/arch/x64/dist/libVkLayer_threading.so
new file mode 100755
index 0000000..4664719
--- /dev/null
+++ b/arch/x64/dist/libVkLayer_threading.so
Binary files differ
diff --git a/arch/x64/dist/libVkLayer_unique_objects.so b/arch/x64/dist/libVkLayer_unique_objects.so
new file mode 100755
index 0000000..bcb6c68
--- /dev/null
+++ b/arch/x64/dist/libVkLayer_unique_objects.so
Binary files differ
diff --git a/arch/x64/dist/libasync-default.so b/arch/x64/dist/libasync-default.so
new file mode 100755
index 0000000..e57cac5
--- /dev/null
+++ b/arch/x64/dist/libasync-default.so
Binary files differ
diff --git a/arch/x64/dist/libfdio.so b/arch/x64/dist/libfdio.so
new file mode 100755
index 0000000..e27ae92
--- /dev/null
+++ b/arch/x64/dist/libfdio.so
Binary files differ
diff --git a/arch/x64/dist/libmemfs.so b/arch/x64/dist/libmemfs.so
new file mode 100755
index 0000000..829662b
--- /dev/null
+++ b/arch/x64/dist/libmemfs.so
Binary files differ
diff --git a/arch/x64/dist/libsvc.so b/arch/x64/dist/libsvc.so
new file mode 100755
index 0000000..b1736b0
--- /dev/null
+++ b/arch/x64/dist/libsvc.so
Binary files differ
diff --git a/arch/x64/dist/libsyslog.so b/arch/x64/dist/libsyslog.so
new file mode 100755
index 0000000..990253a
--- /dev/null
+++ b/arch/x64/dist/libsyslog.so
Binary files differ
diff --git a/arch/x64/dist/libtrace-engine.so b/arch/x64/dist/libtrace-engine.so
new file mode 100755
index 0000000..99eddbe
--- /dev/null
+++ b/arch/x64/dist/libtrace-engine.so
Binary files differ
diff --git a/arch/x64/dist/libvulkan.so b/arch/x64/dist/libvulkan.so
new file mode 100755
index 0000000..001f83a
--- /dev/null
+++ b/arch/x64/dist/libvulkan.so
Binary files differ
diff --git a/arch/x64/lib/libasync-default.so b/arch/x64/lib/libasync-default.so
new file mode 100755
index 0000000..b5e0808
--- /dev/null
+++ b/arch/x64/lib/libasync-default.so
Binary files differ
diff --git a/arch/x64/lib/libfdio.so b/arch/x64/lib/libfdio.so
new file mode 100755
index 0000000..c504a0b
--- /dev/null
+++ b/arch/x64/lib/libfdio.so
Binary files differ
diff --git a/arch/x64/lib/libmemfs.so b/arch/x64/lib/libmemfs.so
new file mode 100755
index 0000000..1e58f43
--- /dev/null
+++ b/arch/x64/lib/libmemfs.so
Binary files differ
diff --git a/arch/x64/lib/libsvc.so b/arch/x64/lib/libsvc.so
new file mode 100755
index 0000000..b1736b0
--- /dev/null
+++ b/arch/x64/lib/libsvc.so
Binary files differ
diff --git a/arch/x64/lib/libsync.a b/arch/x64/lib/libsync.a
new file mode 100644
index 0000000..c656320
--- /dev/null
+++ b/arch/x64/lib/libsync.a
Binary files differ
diff --git a/arch/x64/lib/libsyslog.so b/arch/x64/lib/libsyslog.so
new file mode 100755
index 0000000..5eab748
--- /dev/null
+++ b/arch/x64/lib/libsyslog.so
Binary files differ
diff --git a/arch/x64/lib/libtrace-engine.so b/arch/x64/lib/libtrace-engine.so
new file mode 100755
index 0000000..2938916
--- /dev/null
+++ b/arch/x64/lib/libtrace-engine.so
Binary files differ
diff --git a/arch/x64/lib/libvulkan.so b/arch/x64/lib/libvulkan.so
new file mode 100755
index 0000000..001f83a
--- /dev/null
+++ b/arch/x64/lib/libvulkan.so
Binary files differ
diff --git a/arch/x64/sysroot/debug/libc.so b/arch/x64/sysroot/debug/libc.so
new file mode 100755
index 0000000..fa4fc80
--- /dev/null
+++ b/arch/x64/sysroot/debug/libc.so
Binary files differ
diff --git a/arch/x64/sysroot/debug/libzircon.so b/arch/x64/sysroot/debug/libzircon.so
new file mode 100755
index 0000000..9043c37
--- /dev/null
+++ b/arch/x64/sysroot/debug/libzircon.so
Binary files differ
diff --git a/arch/x64/sysroot/dist/lib/ld.so.1 b/arch/x64/sysroot/dist/lib/ld.so.1
new file mode 100755
index 0000000..375c845
--- /dev/null
+++ b/arch/x64/sysroot/dist/lib/ld.so.1
Binary files differ
diff --git a/arch/x64/sysroot/include/alloca.h b/arch/x64/sysroot/include/alloca.h
new file mode 100644
index 0000000..c1679dd
--- /dev/null
+++ b/arch/x64/sysroot/include/alloca.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/ar.h b/arch/x64/sysroot/include/ar.h
new file mode 100644
index 0000000..d20348b
--- /dev/null
+++ b/arch/x64/sysroot/include/ar.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/arpa/ftp.h b/arch/x64/sysroot/include/arpa/ftp.h
new file mode 100644
index 0000000..e1b66d3
--- /dev/null
+++ b/arch/x64/sysroot/include/arpa/ftp.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/arpa/inet.h b/arch/x64/sysroot/include/arpa/inet.h
new file mode 100644
index 0000000..cfb02ea
--- /dev/null
+++ b/arch/x64/sysroot/include/arpa/inet.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/arpa/nameser.h b/arch/x64/sysroot/include/arpa/nameser.h
new file mode 100644
index 0000000..9218a58
--- /dev/null
+++ b/arch/x64/sysroot/include/arpa/nameser.h
@@ -0,0 +1,448 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/arpa/nameser_compat.h b/arch/x64/sysroot/include/arpa/nameser_compat.h
new file mode 100644
index 0000000..ee3b1a9
--- /dev/null
+++ b/arch/x64/sysroot/include/arpa/nameser_compat.h
@@ -0,0 +1 @@
+#include <arpa/nameser.h>
diff --git a/arch/x64/sysroot/include/arpa/telnet.h b/arch/x64/sysroot/include/arpa/telnet.h
new file mode 100644
index 0000000..d6880cf
--- /dev/null
+++ b/arch/x64/sysroot/include/arpa/telnet.h
@@ -0,0 +1,274 @@
+#pragma once
+
+#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]
diff --git a/arch/x64/sysroot/include/arpa/tftp.h b/arch/x64/sysroot/include/arpa/tftp.h
new file mode 100644
index 0000000..3a76d2f
--- /dev/null
+++ b/arch/x64/sysroot/include/arpa/tftp.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/assert.h b/arch/x64/sysroot/include/assert.h
new file mode 100644
index 0000000..02e96dc
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/aarch64/endian.h b/arch/x64/sysroot/include/bits/aarch64/endian.h
new file mode 100644
index 0000000..7a74d2f
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/aarch64/fenv.h b/arch/x64/sysroot/include/bits/aarch64/fenv.h
new file mode 100644
index 0000000..6bb1f56
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/aarch64/float.h b/arch/x64/sysroot/include/bits/aarch64/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/aarch64/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/arch/x64/sysroot/include/bits/aarch64/io.h b/arch/x64/sysroot/include/bits/aarch64/io.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/aarch64/io.h
diff --git a/arch/x64/sysroot/include/bits/aarch64/ioctl.h b/arch/x64/sysroot/include/bits/aarch64/ioctl.h
new file mode 100644
index 0000000..f963024
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/aarch64/ipc.h b/arch/x64/sysroot/include/bits/aarch64/ipc.h
new file mode 100644
index 0000000..df2ed2b
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/aarch64/reg.h b/arch/x64/sysroot/include/bits/aarch64/reg.h
new file mode 100644
index 0000000..2633f39
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/aarch64/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/arch/x64/sysroot/include/bits/aarch64/setjmp.h b/arch/x64/sysroot/include/bits/aarch64/setjmp.h
new file mode 100644
index 0000000..e3db976
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/aarch64/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long int __jmp_buf[22];
diff --git a/arch/x64/sysroot/include/bits/aarch64/signal.h b/arch/x64/sysroot/include/bits/aarch64/signal.h
new file mode 100644
index 0000000..766d3f9
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/aarch64/signal.h
@@ -0,0 +1,105 @@
+#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/arch/x64/sysroot/include/bits/aarch64/stat.h b/arch/x64/sysroot/include/bits/aarch64/stat.h
new file mode 100644
index 0000000..0fe7e69
--- /dev/null
+++ b/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 __unused[2];
+};
diff --git a/arch/x64/sysroot/include/bits/alltypes.h b/arch/x64/sysroot/include/bits/alltypes.h
new file mode 100644
index 0000000..21fcb7f
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/alltypes.h
@@ -0,0 +1,521 @@
+#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 {
+    int _m_type;
+    __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/arch/x64/sysroot/include/bits/endian.h b/arch/x64/sysroot/include/bits/endian.h
new file mode 100644
index 0000000..ed44e80
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/errno.h b/arch/x64/sysroot/include/bits/errno.h
new file mode 100644
index 0000000..b9ebc31
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/fcntl.h b/arch/x64/sysroot/include/bits/fcntl.h
new file mode 100644
index 0000000..c96e45f
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/fenv.h b/arch/x64/sysroot/include/bits/fenv.h
new file mode 100644
index 0000000..99ca0ba
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/float.h b/arch/x64/sysroot/include/bits/float.h
new file mode 100644
index 0000000..45354da
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/float.h
@@ -0,0 +1,7 @@
+#if defined(__x86_64__)
+#include "x86_64/float.h"
+#elif defined(__aarch64__)
+#include "aarch64/float.h"
+#else
+#error Unsupported architecture!
+#endif
diff --git a/arch/x64/sysroot/include/bits/io.h b/arch/x64/sysroot/include/bits/io.h
new file mode 100644
index 0000000..480bbaf
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/ioctl.h b/arch/x64/sysroot/include/bits/ioctl.h
new file mode 100644
index 0000000..d8bcfa3
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/ipc.h b/arch/x64/sysroot/include/bits/ipc.h
new file mode 100644
index 0000000..a81d510
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/limits.h b/arch/x64/sysroot/include/bits/limits.h
new file mode 100644
index 0000000..8d1910b
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/msg.h b/arch/x64/sysroot/include/bits/msg.h
new file mode 100644
index 0000000..9b3f7e5
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/null.h b/arch/x64/sysroot/include/bits/null.h
new file mode 100644
index 0000000..1788e0c
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/null.h
@@ -0,0 +1,12 @@
+// 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
+
+#pragma once
+
+// The compiler's <stddef.h> defines NULL without defining anything
+// else if __need_NULL is defined first.
+#define __need_NULL
+#include <stddef.h>
diff --git a/arch/x64/sysroot/include/bits/poll.h b/arch/x64/sysroot/include/bits/poll.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/poll.h
diff --git a/arch/x64/sysroot/include/bits/posix.h b/arch/x64/sysroot/include/bits/posix.h
new file mode 100644
index 0000000..8068ce9
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/reg.h b/arch/x64/sysroot/include/bits/reg.h
new file mode 100644
index 0000000..ad220cc
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/resource.h b/arch/x64/sysroot/include/bits/resource.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/resource.h
diff --git a/arch/x64/sysroot/include/bits/sem.h b/arch/x64/sysroot/include/bits/sem.h
new file mode 100644
index 0000000..d7aa74b
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/setjmp.h b/arch/x64/sysroot/include/bits/setjmp.h
new file mode 100644
index 0000000..d42af58
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/shm.h b/arch/x64/sysroot/include/bits/shm.h
new file mode 100644
index 0000000..8bb1c74
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/signal.h b/arch/x64/sysroot/include/bits/signal.h
new file mode 100644
index 0000000..021a17f
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/socket.h b/arch/x64/sysroot/include/bits/socket.h
new file mode 100644
index 0000000..aad18bf
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/stat.h b/arch/x64/sysroot/include/bits/stat.h
new file mode 100644
index 0000000..308b256
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/statfs.h b/arch/x64/sysroot/include/bits/statfs.h
new file mode 100644
index 0000000..656aa8d
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/termios.h b/arch/x64/sysroot/include/bits/termios.h
new file mode 100644
index 0000000..1a06f76
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/x86_64/endian.h b/arch/x64/sysroot/include/bits/x86_64/endian.h
new file mode 100644
index 0000000..172c338
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/x86_64/endian.h
@@ -0,0 +1 @@
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/arch/x64/sysroot/include/bits/x86_64/fenv.h b/arch/x64/sysroot/include/bits/x86_64/fenv.h
new file mode 100644
index 0000000..5cea203
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/x86_64/float.h b/arch/x64/sysroot/include/bits/x86_64/float.h
new file mode 100644
index 0000000..f935e34
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/x86_64/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 0
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN 3.3621031431120935063e-4932L
+#define LDBL_MAX 1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/arch/x64/sysroot/include/bits/x86_64/io.h b/arch/x64/sysroot/include/bits/x86_64/io.h
new file mode 100644
index 0000000..bbfb2e6
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/x86_64/io.h
@@ -0,0 +1,77 @@
+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/arch/x64/sysroot/include/bits/x86_64/ioctl.h b/arch/x64/sysroot/include/bits/x86_64/ioctl.h
new file mode 100644
index 0000000..66525bf
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/x86_64/ipc.h b/arch/x64/sysroot/include/bits/x86_64/ipc.h
new file mode 100644
index 0000000..b563143
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/x86_64/reg.h b/arch/x64/sysroot/include/bits/x86_64/reg.h
new file mode 100644
index 0000000..12d43c5
--- /dev/null
+++ b/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/arch/x64/sysroot/include/bits/x86_64/setjmp.h b/arch/x64/sysroot/include/bits/x86_64/setjmp.h
new file mode 100644
index 0000000..29336e4
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/x86_64/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long int __jmp_buf[9];
diff --git a/arch/x64/sysroot/include/bits/x86_64/signal.h b/arch/x64/sysroot/include/bits/x86_64/signal.h
new file mode 100644
index 0000000..529bbc4
--- /dev/null
+++ b/arch/x64/sysroot/include/bits/x86_64/signal.h
@@ -0,0 +1,127 @@
+#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/arch/x64/sysroot/include/bits/x86_64/stat.h b/arch/x64/sysroot/include/bits/x86_64/stat.h
new file mode 100644
index 0000000..d3b3447
--- /dev/null
+++ b/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 __unused[3];
+};
diff --git a/arch/x64/sysroot/include/byteswap.h b/arch/x64/sysroot/include/byteswap.h
new file mode 100644
index 0000000..6350775
--- /dev/null
+++ b/arch/x64/sysroot/include/byteswap.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x) {
+    return __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(__x)) << 32 | __bswap_32(__x >> 32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
diff --git a/arch/x64/sysroot/include/complex.h b/arch/x64/sysroot/include/complex.h
new file mode 100644
index 0000000..9761553
--- /dev/null
+++ b/arch/x64/sysroot/include/complex.h
@@ -0,0 +1,135 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/cpio.h b/arch/x64/sysroot/include/cpio.h
new file mode 100644
index 0000000..f921413
--- /dev/null
+++ b/arch/x64/sysroot/include/cpio.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/crypt.h b/arch/x64/sysroot/include/crypt.h
new file mode 100644
index 0000000..029698c
--- /dev/null
+++ b/arch/x64/sysroot/include/crypt.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct crypt_data {
+    int initialized;
+    char __buf[256];
+};
+
+char* crypt(const char*, const char*);
+char* crypt_r(const char*, const char*, struct crypt_data*);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/ctype.h b/arch/x64/sysroot/include/ctype.h
new file mode 100644
index 0000000..f4cd85b
--- /dev/null
+++ b/arch/x64/sysroot/include/ctype.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/dirent.h b/arch/x64/sysroot/include/dirent.h
new file mode 100644
index 0000000..0c463c4
--- /dev/null
+++ b/arch/x64/sysroot/include/dirent.h
@@ -0,0 +1,64 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/dlfcn.h b/arch/x64/sysroot/include/dlfcn.h
new file mode 100644
index 0000000..04cc834
--- /dev/null
+++ b/arch/x64/sysroot/include/dlfcn.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/elf.h b/arch/x64/sysroot/include/elf.h
new file mode 100644
index 0000000..a5efbda
--- /dev/null
+++ b/arch/x64/sysroot/include/elf.h
@@ -0,0 +1,2582 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/endian.h b/arch/x64/sysroot/include/endian.h
new file mode 100644
index 0000000..499f985
--- /dev/null
+++ b/arch/x64/sysroot/include/endian.h
@@ -0,0 +1,76 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/err.h b/arch/x64/sysroot/include/err.h
new file mode 100644
index 0000000..3ed5f7f
--- /dev/null
+++ b/arch/x64/sysroot/include/err.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/errno.h b/arch/x64/sysroot/include/errno.h
new file mode 100644
index 0000000..4d3b968
--- /dev/null
+++ b/arch/x64/sysroot/include/errno.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/fcntl.h b/arch/x64/sysroot/include/fcntl.h
new file mode 100644
index 0000000..f045529
--- /dev/null
+++ b/arch/x64/sysroot/include/fcntl.h
@@ -0,0 +1,222 @@
+#pragma once
+
+#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
+#define O_PIPELINE  0x80000000
+#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
diff --git a/arch/x64/sysroot/include/features.h b/arch/x64/sysroot/include/features.h
new file mode 100644
index 0000000..7bd75ad
--- /dev/null
+++ b/arch/x64/sysroot/include/features.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/fenv.h b/arch/x64/sysroot/include/fenv.h
new file mode 100644
index 0000000..42508ac
--- /dev/null
+++ b/arch/x64/sysroot/include/fenv.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/float.h b/arch/x64/sysroot/include/float.h
new file mode 100644
index 0000000..691c4fc
--- /dev/null
+++ b/arch/x64/sysroot/include/float.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __flt_rounds(void);
+#define FLT_ROUNDS (__flt_rounds())
+
+#define FLT_RADIX 2
+
+#define FLT_TRUE_MIN 1.40129846432481707092e-45F
+#define FLT_MIN 1.17549435082228750797e-38F
+#define FLT_MAX 3.40282346638528859812e+38F
+#define FLT_EPSILON 1.1920928955078125e-07F
+
+#define FLT_MANT_DIG 24
+#define FLT_MIN_EXP (-125)
+#define FLT_MAX_EXP 128
+#define FLT_HAS_SUBNORM 1
+
+#define FLT_DIG 6
+#define FLT_DECIMAL_DIG 9
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_10_EXP 38
+
+#define DBL_TRUE_MIN 4.94065645841246544177e-324
+#define DBL_MIN 2.22507385850720138309e-308
+#define DBL_MAX 1.79769313486231570815e+308
+#define DBL_EPSILON 2.22044604925031308085e-16
+
+#define DBL_MANT_DIG 53
+#define DBL_MIN_EXP (-1021)
+#define DBL_MAX_EXP 1024
+#define DBL_HAS_SUBNORM 1
+
+#define DBL_DIG 15
+#define DBL_DECIMAL_DIG 17
+#define DBL_MIN_10_EXP (-307)
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_HAS_SUBNORM 1
+#define LDBL_DECIMAL_DIG DECIMAL_DIG
+
+#include <bits/float.h>
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/fmtmsg.h b/arch/x64/sysroot/include/fmtmsg.h
new file mode 100644
index 0000000..e6b0923
--- /dev/null
+++ b/arch/x64/sysroot/include/fmtmsg.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/fnmatch.h b/arch/x64/sysroot/include/fnmatch.h
new file mode 100644
index 0000000..ea277a4
--- /dev/null
+++ b/arch/x64/sysroot/include/fnmatch.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/ftw.h b/arch/x64/sysroot/include/ftw.h
new file mode 100644
index 0000000..1c282aa
--- /dev/null
+++ b/arch/x64/sysroot/include/ftw.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/stat.h>
+
+#define FTW_F 1
+#define FTW_D 2
+#define FTW_DNR 3
+#define FTW_NS 4
+#define FTW_SL 5
+#define FTW_DP 6
+#define FTW_SLN 7
+
+#define FTW_PHYS 1
+#define FTW_MOUNT 2
+#define FTW_CHDIR 4
+#define FTW_DEPTH 8
+
+struct FTW {
+    int base;
+    int level;
+};
+
+int ftw(const char*, int (*)(const char*, const struct stat*, int), int);
+int nftw(const char*, int (*)(const char*, const struct stat*, int, struct FTW*), int, int);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/getopt.h b/arch/x64/sysroot/include/getopt.h
new file mode 100644
index 0000000..8019e90
--- /dev/null
+++ b/arch/x64/sysroot/include/getopt.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/glob.h b/arch/x64/sysroot/include/glob.h
new file mode 100644
index 0000000..580ffe1
--- /dev/null
+++ b/arch/x64/sysroot/include/glob.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/grp.h b/arch/x64/sysroot/include/grp.h
new file mode 100644
index 0000000..5e0dd0a
--- /dev/null
+++ b/arch/x64/sysroot/include/grp.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/iconv.h b/arch/x64/sysroot/include/iconv.h
new file mode 100644
index 0000000..4fee288
--- /dev/null
+++ b/arch/x64/sysroot/include/iconv.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/ifaddrs.h b/arch/x64/sysroot/include/ifaddrs.h
new file mode 100644
index 0000000..912a2b6
--- /dev/null
+++ b/arch/x64/sysroot/include/ifaddrs.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/inttypes.h b/arch/x64/sysroot/include/inttypes.h
new file mode 100644
index 0000000..db1b4d3
--- /dev/null
+++ b/arch/x64/sysroot/include/inttypes.h
@@ -0,0 +1,352 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/iso646.h b/arch/x64/sysroot/include/iso646.h
new file mode 100644
index 0000000..59e7e16
--- /dev/null
+++ b/arch/x64/sysroot/include/iso646.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/langinfo.h b/arch/x64/sysroot/include/langinfo.h
new file mode 100644
index 0000000..0ee81bb
--- /dev/null
+++ b/arch/x64/sysroot/include/langinfo.h
@@ -0,0 +1,89 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/libgen.h b/arch/x64/sysroot/include/libgen.h
new file mode 100644
index 0000000..546dce0
--- /dev/null
+++ b/arch/x64/sysroot/include/libgen.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char* dirname(char*);
+char* basename(char*);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/limits.h b/arch/x64/sysroot/include/limits.h
new file mode 100644
index 0000000..290ef73
--- /dev/null
+++ b/arch/x64/sysroot/include/limits.h
@@ -0,0 +1,151 @@
+#pragma once
+
+#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 ARG_MAX 131072
+#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
diff --git a/arch/x64/sysroot/include/link.h b/arch/x64/sysroot/include/link.h
new file mode 100644
index 0000000..657e9a0
--- /dev/null
+++ b/arch/x64/sysroot/include/link.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#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;
+    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
diff --git a/arch/x64/sysroot/include/locale.h b/arch/x64/sysroot/include/locale.h
new file mode 100644
index 0000000..44f8d0b
--- /dev/null
+++ b/arch/x64/sysroot/include/locale.h
@@ -0,0 +1,75 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/malloc.h b/arch/x64/sysroot/include/malloc.h
new file mode 100644
index 0000000..d057b89
--- /dev/null
+++ b/arch/x64/sysroot/include/malloc.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/math.h b/arch/x64/sysroot/include/math.h
new file mode 100644
index 0000000..a32ec07
--- /dev/null
+++ b/arch/x64/sysroot/include/math.h
@@ -0,0 +1,431 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/memory.h b/arch/x64/sysroot/include/memory.h
new file mode 100644
index 0000000..3b2f590
--- /dev/null
+++ b/arch/x64/sysroot/include/memory.h
@@ -0,0 +1 @@
+#include <string.h>
diff --git a/arch/x64/sysroot/include/monetary.h b/arch/x64/sysroot/include/monetary.h
new file mode 100644
index 0000000..b6081b9
--- /dev/null
+++ b/arch/x64/sysroot/include/monetary.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/net/ethernet.h b/arch/x64/sysroot/include/net/ethernet.h
new file mode 100644
index 0000000..41dab8b
--- /dev/null
+++ b/arch/x64/sysroot/include/net/ethernet.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/net/if.h b/arch/x64/sysroot/include/net/if.h
new file mode 100644
index 0000000..687175b
--- /dev/null
+++ b/arch/x64/sysroot/include/net/if.h
@@ -0,0 +1,129 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/net/if_arp.h b/arch/x64/sysroot/include/net/if_arp.h
new file mode 100644
index 0000000..6da9341
--- /dev/null
+++ b/arch/x64/sysroot/include/net/if_arp.h
@@ -0,0 +1,136 @@
+/* Nonstandard header */
+
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/net/route.h b/arch/x64/sysroot/include/net/route.h
new file mode 100644
index 0000000..5d2d3d0
--- /dev/null
+++ b/arch/x64/sysroot/include/net/route.h
@@ -0,0 +1,116 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netdb.h b/arch/x64/sysroot/include/netdb.h
new file mode 100644
index 0000000..5b8ab72
--- /dev/null
+++ b/arch/x64/sysroot/include/netdb.h
@@ -0,0 +1,152 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/ether.h b/arch/x64/sysroot/include/netinet/ether.h
new file mode 100644
index 0000000..0a65077
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/ether.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/icmp6.h b/arch/x64/sysroot/include/netinet/icmp6.h
new file mode 100644
index 0000000..9a50bcd
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/icmp6.h
@@ -0,0 +1,300 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/if_ether.h b/arch/x64/sysroot/include/netinet/if_ether.h
new file mode 100644
index 0000000..ee7d38e
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/if_ether.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#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)
diff --git a/arch/x64/sysroot/include/netinet/igmp.h b/arch/x64/sysroot/include/netinet/igmp.h
new file mode 100644
index 0000000..a59a1cc
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/igmp.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/in.h b/arch/x64/sysroot/include/netinet/in.h
new file mode 100644
index 0000000..e626a93
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/in.h
@@ -0,0 +1,394 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/in_systm.h b/arch/x64/sysroot/include/netinet/in_systm.h
new file mode 100644
index 0000000..ea7ed91
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/in_systm.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef uint16_t n_short;
+typedef uint32_t n_long, n_time;
diff --git a/arch/x64/sysroot/include/netinet/ip.h b/arch/x64/sysroot/include/netinet/ip.h
new file mode 100644
index 0000000..1c0978a
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/ip.h
@@ -0,0 +1,195 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/ip6.h b/arch/x64/sysroot/include/netinet/ip6.h
new file mode 100644
index 0000000..e809200
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/ip6.h
@@ -0,0 +1,139 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/ip_icmp.h b/arch/x64/sysroot/include/netinet/ip_icmp.h
new file mode 100644
index 0000000..4c1c322
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/ip_icmp.h
@@ -0,0 +1,186 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/tcp.h b/arch/x64/sysroot/include/netinet/tcp.h
new file mode 100644
index 0000000..9274ba5
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/tcp.h
@@ -0,0 +1,199 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netinet/udp.h b/arch/x64/sysroot/include/netinet/udp.h
new file mode 100644
index 0000000..ddde1c7
--- /dev/null
+++ b/arch/x64/sysroot/include/netinet/udp.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/netpacket/packet.h b/arch/x64/sysroot/include/netpacket/packet.h
new file mode 100644
index 0000000..3e35676
--- /dev/null
+++ b/arch/x64/sysroot/include/netpacket/packet.h
@@ -0,0 +1,58 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/nl_types.h b/arch/x64/sysroot/include/nl_types.h
new file mode 100644
index 0000000..570224d
--- /dev/null
+++ b/arch/x64/sysroot/include/nl_types.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/paths.h b/arch/x64/sysroot/include/paths.h
new file mode 100644
index 0000000..36b6127
--- /dev/null
+++ b/arch/x64/sysroot/include/paths.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#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/"
diff --git a/arch/x64/sysroot/include/poll.h b/arch/x64/sysroot/include/poll.h
new file mode 100644
index 0000000..d8b3726
--- /dev/null
+++ b/arch/x64/sysroot/include/poll.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/pthread.h b/arch/x64/sysroot/include/pthread.h
new file mode 100644
index 0000000..07576e5
--- /dev/null
+++ b/arch/x64/sysroot/include/pthread.h
@@ -0,0 +1,196 @@
+#pragma once
+
+#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 <bits/alltypes.h>
+
+#include <sched.h>
+#include <time.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
diff --git a/arch/x64/sysroot/include/pty.h b/arch/x64/sysroot/include/pty.h
new file mode 100644
index 0000000..943a6a8
--- /dev/null
+++ b/arch/x64/sysroot/include/pty.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ioctl.h>
+#include <termios.h>
+
+int openpty(int*, int*, char*, const struct termios*, const struct winsize*);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/pwd.h b/arch/x64/sysroot/include/pwd.h
new file mode 100644
index 0000000..1d63e72
--- /dev/null
+++ b/arch/x64/sysroot/include/pwd.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/regex.h b/arch/x64/sysroot/include/regex.h
new file mode 100644
index 0000000..70c4613
--- /dev/null
+++ b/arch/x64/sysroot/include/regex.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/resolv.h b/arch/x64/sysroot/include/resolv.h
new file mode 100644
index 0000000..7efcd49
--- /dev/null
+++ b/arch/x64/sysroot/include/resolv.h
@@ -0,0 +1,140 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sched.h b/arch/x64/sysroot/include/sched.h
new file mode 100644
index 0000000..f77dff7
--- /dev/null
+++ b/arch/x64/sysroot/include/sched.h
@@ -0,0 +1,105 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/search.h b/arch/x64/sysroot/include/search.h
new file mode 100644
index 0000000..eb50439
--- /dev/null
+++ b/arch/x64/sysroot/include/search.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/semaphore.h b/arch/x64/sysroot/include/semaphore.h
new file mode 100644
index 0000000..e4bf7a8
--- /dev/null
+++ b/arch/x64/sysroot/include/semaphore.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_sem_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+#include <fcntl.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
diff --git a/arch/x64/sysroot/include/setjmp.h b/arch/x64/sysroot/include/setjmp.h
new file mode 100644
index 0000000..eaceeca
--- /dev/null
+++ b/arch/x64/sysroot/include/setjmp.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/signal.h b/arch/x64/sysroot/include/signal.h
new file mode 100644
index 0000000..b26c9b0
--- /dev/null
+++ b/arch/x64/sysroot/include/signal.h
@@ -0,0 +1,260 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/spawn.h b/arch/x64/sysroot/include/spawn.h
new file mode 100644
index 0000000..74710cb
--- /dev/null
+++ b/arch/x64/sysroot/include/spawn.h
@@ -0,0 +1,76 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/stdio.h b/arch/x64/sysroot/include/stdio.h
new file mode 100644
index 0000000..fde69be
--- /dev/null
+++ b/arch/x64/sysroot/include/stdio.h
@@ -0,0 +1,182 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/stdlib.h b/arch/x64/sysroot/include/stdlib.h
new file mode 100644
index 0000000..0c29b16
--- /dev/null
+++ b/arch/x64/sysroot/include/stdlib.h
@@ -0,0 +1,148 @@
+#pragma once
+
+#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);
+char* l64a(long);
+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
diff --git a/arch/x64/sysroot/include/stdnoreturn.h b/arch/x64/sysroot/include/stdnoreturn.h
new file mode 100644
index 0000000..574bcca
--- /dev/null
+++ b/arch/x64/sysroot/include/stdnoreturn.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#ifndef __cplusplus
+#include <features.h>
+#define noreturn _Noreturn
+#endif
diff --git a/arch/x64/sysroot/include/string.h b/arch/x64/sysroot/include/string.h
new file mode 100644
index 0000000..d7ea6bb
--- /dev/null
+++ b/arch/x64/sysroot/include/string.h
@@ -0,0 +1,86 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/strings.h b/arch/x64/sysroot/include/strings.h
new file mode 100644
index 0000000..343f31a
--- /dev/null
+++ b/arch/x64/sysroot/include/strings.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/stropts.h b/arch/x64/sysroot/include/stropts.h
new file mode 100644
index 0000000..c2e6b7f
--- /dev/null
+++ b/arch/x64/sysroot/include/stropts.h
@@ -0,0 +1,136 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/acct.h b/arch/x64/sysroot/include/sys/acct.h
new file mode 100644
index 0000000..be32528
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/acct.h
@@ -0,0 +1,69 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/auxv.h b/arch/x64/sysroot/include/sys/auxv.h
new file mode 100644
index 0000000..72d5de9
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/auxv.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+
+unsigned long getauxval(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/sys/dir.h b/arch/x64/sysroot/include/sys/dir.h
new file mode 100644
index 0000000..9ba1c79
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/dir.h
@@ -0,0 +1,2 @@
+#include <dirent.h>
+#define direct dirent
diff --git a/arch/x64/sysroot/include/sys/errno.h b/arch/x64/sysroot/include/sys/errno.h
new file mode 100644
index 0000000..35a3e5a
--- /dev/null
+++ b/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/arch/x64/sysroot/include/sys/eventfd.h b/arch/x64/sysroot/include/sys/eventfd.h
new file mode 100644
index 0000000..c22369e
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/eventfd.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/fcntl.h b/arch/x64/sysroot/include/sys/fcntl.h
new file mode 100644
index 0000000..3dd928e
--- /dev/null
+++ b/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/arch/x64/sysroot/include/sys/file.h b/arch/x64/sysroot/include/sys/file.h
new file mode 100644
index 0000000..c32fcb8
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/file.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/fsuid.h b/arch/x64/sysroot/include/sys/fsuid.h
new file mode 100644
index 0000000..29ea02b
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/fsuid.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/io.h b/arch/x64/sysroot/include/sys/io.h
new file mode 100644
index 0000000..f5013a2
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/io.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/ioctl.h b/arch/x64/sysroot/include/sys/ioctl.h
new file mode 100644
index 0000000..c782d2e
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/ioctl.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/ioctl.h>
+
+int ioctl(int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/sys/ipc.h b/arch/x64/sysroot/include/sys/ipc.h
new file mode 100644
index 0000000..a3a380c
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/ipc.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/klog.h b/arch/x64/sysroot/include/sys/klog.h
new file mode 100644
index 0000000..ccde5e8
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/klog.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl(int, char*, int);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/sys/mman.h b/arch/x64/sysroot/include/sys/mman.h
new file mode 100644
index 0000000..c5ff3bf
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/mman.h
@@ -0,0 +1,98 @@
+#pragma once
+
+#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_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
diff --git a/arch/x64/sysroot/include/sys/mount.h b/arch/x64/sysroot/include/sys/mount.h
new file mode 100644
index 0000000..9d3394b
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/mount.h
@@ -0,0 +1,70 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/msg.h b/arch/x64/sysroot/include/sys/msg.h
new file mode 100644
index 0000000..6d08dad
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/msg.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/mtio.h b/arch/x64/sysroot/include/sys/mtio.h
new file mode 100644
index 0000000..2f4cf9a
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/mtio.h
@@ -0,0 +1,182 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/param.h b/arch/x64/sysroot/include/sys/param.h
new file mode 100644
index 0000000..64989a4
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/param.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#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>
diff --git a/arch/x64/sysroot/include/sys/personality.h b/arch/x64/sysroot/include/sys/personality.h
new file mode 100644
index 0000000..3da0e20
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/personality.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/poll.h b/arch/x64/sysroot/include/sys/poll.h
new file mode 100644
index 0000000..9917040
--- /dev/null
+++ b/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/arch/x64/sysroot/include/sys/quota.h b/arch/x64/sysroot/include/sys/quota.h
new file mode 100644
index 0000000..ae2e194
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/quota.h
@@ -0,0 +1,99 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/random.h b/arch/x64/sysroot/include/sys/random.h
new file mode 100644
index 0000000..080c3b4
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/random.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getentropy(void* buffer, size_t length) __attribute__((__warn_unused_result__));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/sys/reboot.h b/arch/x64/sysroot/include/sys/reboot.h
new file mode 100644
index 0000000..f28375d
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/reboot.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/reg.h b/arch/x64/sysroot/include/sys/reg.h
new file mode 100644
index 0000000..22a9caa
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/reg.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
diff --git a/arch/x64/sysroot/include/sys/select.h b/arch/x64/sysroot/include/sys/select.h
new file mode 100644
index 0000000..25197d8
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/select.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/sem.h b/arch/x64/sysroot/include/sys/sem.h
new file mode 100644
index 0000000..864161f
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/sem.h
@@ -0,0 +1,66 @@
+#pragma once
+
+#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 <bits/alltypes.h>
+
+#include <sys/ipc.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
diff --git a/arch/x64/sysroot/include/sys/sendfile.h b/arch/x64/sysroot/include/sys/sendfile.h
new file mode 100644
index 0000000..1c94a6b
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/sendfile.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <unistd.h>
+
+ssize_t sendfile(int, int, off_t*, size_t);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/sys/shm.h b/arch/x64/sysroot/include/sys/shm.h
new file mode 100644
index 0000000..b4780d6
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/shm.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.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
diff --git a/arch/x64/sysroot/include/sys/signal.h b/arch/x64/sysroot/include/sys/signal.h
new file mode 100644
index 0000000..45bdcc6
--- /dev/null
+++ b/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/arch/x64/sysroot/include/sys/signalfd.h b/arch/x64/sysroot/include/sys/signalfd.h
new file mode 100644
index 0000000..832cc78
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/signalfd.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/socket.h b/arch/x64/sysroot/include/sys/socket.h
new file mode 100644
index 0000000..10167be
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/socket.h
@@ -0,0 +1,321 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/stat.h b/arch/x64/sysroot/include/sys/stat.h
new file mode 100644
index 0000000..2be2ff5
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/stat.h
@@ -0,0 +1,100 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/statfs.h b/arch/x64/sysroot/include/sys/statfs.h
new file mode 100644
index 0000000..c2a3d41
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/statfs.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/statvfs.h b/arch/x64/sysroot/include/sys/statvfs.h
new file mode 100644
index 0000000..6031e66
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/statvfs.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+#include <endian.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
diff --git a/arch/x64/sysroot/include/sys/stropts.h b/arch/x64/sysroot/include/sys/stropts.h
new file mode 100644
index 0000000..5b5bc02
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/stropts.h
@@ -0,0 +1 @@
+#include <stropts.h>
diff --git a/arch/x64/sysroot/include/sys/swap.h b/arch/x64/sysroot/include/sys/swap.h
new file mode 100644
index 0000000..e9d516d
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/swap.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/syslog.h b/arch/x64/sysroot/include/sys/syslog.h
new file mode 100644
index 0000000..7761ece
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/syslog.h
@@ -0,0 +1 @@
+#include <syslog.h>
diff --git a/arch/x64/sysroot/include/sys/termios.h b/arch/x64/sysroot/include/sys/termios.h
new file mode 100644
index 0000000..f5f751f
--- /dev/null
+++ b/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/arch/x64/sysroot/include/sys/time.h b/arch/x64/sysroot/include/sys/time.h
new file mode 100644
index 0000000..81c410a
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/time.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/timeb.h b/arch/x64/sysroot/include/sys/timeb.h
new file mode 100644
index 0000000..560158b
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/timeb.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/timerfd.h b/arch/x64/sysroot/include/sys/timerfd.h
new file mode 100644
index 0000000..c6b52b3
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/timerfd.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/times.h b/arch/x64/sysroot/include/sys/times.h
new file mode 100644
index 0000000..d573297
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/times.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/timex.h b/arch/x64/sysroot/include/sys/timex.h
new file mode 100644
index 0000000..8aa166e
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/timex.h
@@ -0,0 +1,96 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.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
diff --git a/arch/x64/sysroot/include/sys/ttydefaults.h b/arch/x64/sysroot/include/sys/ttydefaults.h
new file mode 100644
index 0000000..742e3a9
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/ttydefaults.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/types.h b/arch/x64/sysroot/include/sys/types.h
new file mode 100644
index 0000000..b1c2a27
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/types.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/ucontext.h b/arch/x64/sysroot/include/sys/ucontext.h
new file mode 100644
index 0000000..5fdbd63
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/ucontext.h
@@ -0,0 +1 @@
+#include <ucontext.h>
diff --git a/arch/x64/sysroot/include/sys/uio.h b/arch/x64/sysroot/include/sys/uio.h
new file mode 100644
index 0000000..e9f7b5d
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/uio.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/un.h b/arch/x64/sysroot/include/sys/un.h
new file mode 100644
index 0000000..52bebd4
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/un.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sys/utsname.h b/arch/x64/sysroot/include/sys/utsname.h
new file mode 100644
index 0000000..0333c82
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/utsname.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+struct utsname {
+    char sysname[65];
+    char nodename[65];
+    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
diff --git a/arch/x64/sysroot/include/sys/vfs.h b/arch/x64/sysroot/include/sys/vfs.h
new file mode 100644
index 0000000..a899db2
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/vfs.h
@@ -0,0 +1 @@
+#include <sys/statfs.h>
diff --git a/arch/x64/sysroot/include/sys/wait.h b/arch/x64/sysroot/include/sys/wait.h
new file mode 100644
index 0000000..f31bb8e
--- /dev/null
+++ b/arch/x64/sysroot/include/sys/wait.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/sysexits.h b/arch/x64/sysroot/include/sysexits.h
new file mode 100644
index 0000000..82f672a
--- /dev/null
+++ b/arch/x64/sysroot/include/sysexits.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/syslog.h b/arch/x64/sysroot/include/syslog.h
new file mode 100644
index 0000000..76fdce7
--- /dev/null
+++ b/arch/x64/sysroot/include/syslog.h
@@ -0,0 +1,118 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/tar.h b/arch/x64/sysroot/include/tar.h
new file mode 100644
index 0000000..7703c2b
--- /dev/null
+++ b/arch/x64/sysroot/include/tar.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/termios.h b/arch/x64/sysroot/include/termios.h
new file mode 100644
index 0000000..65c9d66
--- /dev/null
+++ b/arch/x64/sysroot/include/termios.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/threads.h b/arch/x64/sysroot/include/threads.h
new file mode 100644
index 0000000..8711302
--- /dev/null
+++ b/arch/x64/sysroot/include/threads.h
@@ -0,0 +1,105 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/time.h b/arch/x64/sysroot/include/time.h
new file mode 100644
index 0000000..c20b7db
--- /dev/null
+++ b/arch/x64/sysroot/include/time.h
@@ -0,0 +1,120 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/uchar.h b/arch/x64/sysroot/include/uchar.h
new file mode 100644
index 0000000..73e5e5a
--- /dev/null
+++ b/arch/x64/sysroot/include/uchar.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#else
+typedef unsigned short char16_t;
+typedef unsigned char32_t;
+#endif
+
+#define __NEED_mbstate_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+#include <features.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
diff --git a/arch/x64/sysroot/include/ucontext.h b/arch/x64/sysroot/include/ucontext.h
new file mode 100644
index 0000000..930bb71
--- /dev/null
+++ b/arch/x64/sysroot/include/ucontext.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/unistd.h b/arch/x64/sysroot/include/unistd.h
new file mode 100644
index 0000000..4f91876
--- /dev/null
+++ b/arch/x64/sysroot/include/unistd.h
@@ -0,0 +1,434 @@
+#pragma once
+
+#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);
+char* crypt(const char*, const char*);
+void encrypt(char*, int);
+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
diff --git a/arch/x64/sysroot/include/utime.h b/arch/x64/sysroot/include/utime.h
new file mode 100644
index 0000000..25e0ff7
--- /dev/null
+++ b/arch/x64/sysroot/include/utime.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/values.h b/arch/x64/sysroot/include/values.h
new file mode 100644
index 0000000..a139dca
--- /dev/null
+++ b/arch/x64/sysroot/include/values.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/wait.h b/arch/x64/sysroot/include/wait.h
new file mode 100644
index 0000000..98396e2
--- /dev/null
+++ b/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/arch/x64/sysroot/include/wchar.h b/arch/x64/sysroot/include/wchar.h
new file mode 100644
index 0000000..5578085
--- /dev/null
+++ b/arch/x64/sysroot/include/wchar.h
@@ -0,0 +1,181 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/wctype.h b/arch/x64/sysroot/include/wctype.h
new file mode 100644
index 0000000..8c86840
--- /dev/null
+++ b/arch/x64/sysroot/include/wctype.h
@@ -0,0 +1,57 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/wordexp.h b/arch/x64/sysroot/include/wordexp.h
new file mode 100644
index 0000000..26f8646
--- /dev/null
+++ b/arch/x64/sysroot/include/wordexp.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/zircon/assert.h b/arch/x64/sysroot/include/zircon/assert.h
new file mode 100644
index 0000000..6175321
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/assert.h
@@ -0,0 +1,86 @@
+// 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 ZIRCON_ASSERT_
+#define ZIRCON_ASSERT_
+
+#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
+
+#ifdef ZX_DEBUGLEVEL
+#undef ZX_DEBUGLEVEL
+#endif
+#define ZX_DEBUGLEVEL LK_DEBUGLEVEL
+
+#else // #ifdef _KERNEL
+
+#include <stdio.h>  // for printf
+#include <stdlib.h> // for abort
+
+#include <zircon/compiler.h>
+
+#define ZX_PANIC(fmt, ...)          \
+    do {                            \
+        printf(fmt, ##__VA_ARGS__); \
+        abort();                    \
+    } while (0)
+
+#define ZX_ASSERT(x)                                                            \
+    do {                                                                        \
+        if (unlikely(!(x))) {                                                   \
+            ZX_PANIC("ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); \
+        }                                                                       \
+    } while (0)
+
+#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 DEBUG_ASSERT based on ZX_DEBUGLEVEL in kernel space
+// user space does not currently implement DEBUG_ASSERT
+#ifdef ZX_DEBUGLEVEL
+#define ZX_DEBUG_ASSERT_IMPLEMENTED (ZX_DEBUGLEVEL > 1)
+#else
+#define ZX_DEBUG_ASSERT_IMPLEMENTED 0
+#endif
+
+#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)
+
+#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 // ZIRCON_ASSERT_
diff --git a/arch/x64/sysroot/include/zircon/boot/bootdata.h b/arch/x64/sysroot/include/zircon/boot/bootdata.h
new file mode 100644
index 0000000..d49b9b1
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/bootdata.h
@@ -0,0 +1,317 @@
+// 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
+
+#ifndef __ASSEMBLER__
+#include <zircon/compiler.h>
+#include <stdbool.h>
+#include <stdint.h>
+#endif
+
+// lsw of sha256("bootdata")
+#define BOOTDATA_MAGIC (0x868cf7e6)
+
+// lsw of sha256("bootitem")
+#define BOOTITEM_MAGIC (0xb5781729)
+
+// Round n up to the next 8 byte boundary
+#define BOOTDATA_ALIGN(n) (((n) + 7) & (~7))
+
+#define BOOTITEM_NO_CRC32 (0x4a87e8d6)
+
+// This flag is required.
+#define BOOTDATA_FLAG_V2         (0x00010000)
+
+// Bootdata items with the CRC32 flag must have a valid crc32.
+// Otherwise their crc32 field must contain BOOTITEM_NO_CRC32
+#define BOOTDATA_FLAG_CRC32      (0x00020000)
+
+// Bootdata types that have least significant byte set to 'm'
+// are reserved for driver metadata
+#define BOOTDATA_KIND_METADATA   (0x0000006D)
+#define BOOTDATA_KIND_MASK       (0x000000FF)
+
+// Containers are used to wrap a set of bootdata items
+// written to a file or partition.  The "length" is the
+// length of the set of following bootdata items.  The
+// "extra" is the value BOOTDATA_MAGIC and "flags" is
+// set to 0.
+#define BOOTDATA_CONTAINER        (0x544f4f42) // BOOT
+
+// BOOTFS images.  The "extra" field is the decompressed
+// size of the image, if compressed, otherwise the same
+// as the "length" field.
+#define BOOTDATA_BOOTFS_BOOT      (0x42534642) // BFSB
+#define BOOTDATA_BOOTFS_SYSTEM    (0x53534642) // BFSS
+#define BOOTDATA_BOOTFS_DISCARD   (0x58534642) // BFSX
+
+#define BOOTDATA_BOOTFS_MASK      (0x00FFFFFF)
+#define BOOTDATA_BOOTFS_TYPE      (0x00534642) // BFS\0
+
+// Virtual disk images.  The header fields and compression protocol
+// are the same as for the BOOTFS types, but the payload before
+// compression is a raw disk image rather than BOOTFS format.
+#define BOOTDATA_RAMDISK          (0x4b534452) // RDSK
+
+// A Zircon Kernel Image
+// Content: bootdata_kernel_t
+#define BOOTDATA_KERNEL           (0x4c4e524b) // KRNL
+
+// A Zircon Partition Map
+// Content: bootdata_partition_map_t
+// The bootdata_t.extra field is used as a board specific index
+// to specify which device the partition map applies to.
+#define BOOTDATA_PARTITION_MAP    (0x5452506D) // mPRT
+
+// MAC Address for Ethernet, Wifi, Bluetooth, etc.
+// Content: uint8_t[] (variable length based on type of MAC address)
+// The bootdata_t.extra field is used as a board specific index
+// to specify which device the MAC address applies to.
+#define BOOTDATA_MAC_ADDRESS      (0x43414D6D) // mMAC
+
+// Flag indicating that the bootfs is compressed.
+#define BOOTDATA_BOOTFS_FLAG_COMPRESSED  (1 << 0)
+
+
+// These items are for passing from bootloader to kernel
+
+// Kernel Command Line String
+// Content: uint8_t[]
+#define BOOTDATA_CMDLINE          (0x4c444d43) // CMDL
+
+// ACPI Root Table Pointer
+// Content: uint64_t phys addr
+#define BOOTDATA_ACPI_RSDP        (0x50445352) // RSDP
+
+// SMBIOS entry point pointer
+// Content: uint64_t phys addr
+#define BOOTDATA_SMBIOS           (0x49424d53) // SMBI
+
+// Framebuffer Parameters
+// Content: bootdata_swfb_t
+#define BOOTDATA_FRAMEBUFFER      (0x42465753) // SWFB
+
+// Debug Serial Port
+// Content: bootdata_uart_t
+#define BOOTDATA_DEBUG_UART       (0x54524155) // UART
+
+// Platform ID Information
+// Content: bootdata_platform_id_t
+#define BOOTDATA_PLATFORM_ID      (0x44494C50) // PLID
+
+// Memory which will persist across warm boots
+// Content bootdata_lastlog_nvram_t
+#define BOOTDATA_LASTLOG_NVRAM    (0x4c4c564e) // NVLL
+
+// This reflects a typo we need to support for a while
+#define BOOTDATA_LASTLOG_NVRAM2   (0x4c4c5643) // CVLL
+
+// E820 Memory Table
+// Content: e820entry[]
+#define BOOTDATA_E820_TABLE       (0x30323845) // E820
+
+// EFI Memory Map
+// Content: a uint64_t entrysz followed by a set of
+// efi_memory_descriptor aligned on entrysz
+#define BOOTDATA_EFI_MEMORY_MAP   (0x4d494645) // EFIM
+
+// EFI System Table
+// Content: a uint64_t physical address of the table
+#define BOOTDATA_EFI_SYSTEM_TABLE (0x53494645) // EFIS
+
+// Last crashlog
+// Content: ascii/utf8 log data from previous boot
+#define BOOTDATA_LAST_CRASHLOG    (0x4d4f4f42) // BOOM
+
+// CPU configuration
+// Content: bootdata_cpu_config_t
+#define BOOTDATA_CPU_CONFIG       (0x43555043) // CPUC
+
+// Memory configuration
+// Content: one or more of bootdata_mem_range_t (count determined by bootdata_t length)
+#define BOOTDATA_MEM_CONFIG       (0x434D454D) // MEMC
+
+// Kernel driver configuration
+// Content: driver specific struct, with type determined by bootdata "extra" field
+#define BOOTDATA_KERNEL_DRIVER    (0x5652444B) // KDRV
+
+#define BOOTDATA_IGNORE           (0x50494b53) // SKIP
+
+#ifndef __ASSEMBLER__
+__BEGIN_CDECLS;
+
+// BootData header, describing the type and size of data
+// used to initialize the system. All fields are little-endian.
+//
+// BootData headers in a stream must be 8-byte-aligned.
+//
+// The length field specifies the actual payload length
+// and does not include the size of padding.
+typedef struct {
+    // Boot data type
+    uint32_t type;
+
+    // Size of the payload following this header
+    uint32_t length;
+
+    // type-specific extra data
+    // For CONTAINER this is MAGIC.
+    // For BOOTFS this is the decompressed size.
+    uint32_t extra;
+
+    // Flags for the boot data. See flag descriptions for each type.
+    uint32_t flags;
+
+    // For future expansion.  Set to 0.
+    uint32_t reserved0;
+    uint32_t reserved1;
+
+    // Must be BOOTITEM_MAGIC
+    uint32_t magic;
+
+    // Must be the CRC32 of payload if FLAG_CRC32 is set,
+    // otherwise must be BOOTITEM_NO_CRC32
+    uint32_t crc32;
+} bootdata_t;
+
+typedef struct {
+    uint64_t base; // physical base addr
+    uint32_t width;
+    uint32_t height;
+    uint32_t stride;
+    uint32_t format;
+} bootdata_swfb_t;
+
+typedef struct {
+    uint64_t entry64;
+    uint64_t reserved;
+} bootdata_kernel_t;
+
+#define BOOTDATA_PART_NAME_LEN 32
+#define BOOTDATA_PART_GUID_LEN 16
+
+typedef struct {
+    uint8_t type_guid[BOOTDATA_PART_GUID_LEN];
+    uint8_t uniq_guid[BOOTDATA_PART_GUID_LEN];
+    uint64_t first_block;
+    uint64_t last_block;
+    uint64_t flags;
+    char name[BOOTDATA_PART_NAME_LEN];
+} bootdata_partition_t;
+
+typedef struct {
+    uint64_t block_count;
+    uint64_t block_size;
+    uint32_t partition_count;
+    uint32_t reserved;
+    char guid[BOOTDATA_PART_GUID_LEN];
+    bootdata_partition_t partitions[];
+} bootdata_partition_map_t;
+
+typedef struct {
+    uint64_t base;
+    uint64_t length;
+} bootdata_nvram_t;
+
+#define BOOTDATA_UART_NONE 0
+#define BOOTDATA_UART_PC_PORT 1
+#define BOOTDATA_UART_PC_MMIO 2
+typedef struct {
+    uint64_t base;
+    uint32_t type;
+    uint32_t irq;
+} bootdata_uart_t;
+
+typedef struct {
+    uint32_t vid;
+    uint32_t pid;
+    char board_name[32];
+} bootdata_platform_id_t;
+
+typedef struct {
+    uint32_t cpu_count;     // number of CPU cores in the cluster
+    uint32_t type;          // for future use
+    uint32_t flags;         // for future use
+    uint32_t reserved;
+} bootdata_cpu_cluster_t;
+
+typedef struct {
+    uint32_t cluster_count;
+    uint32_t reserved[3];
+    bootdata_cpu_cluster_t clusters[];
+} bootdata_cpu_config_t;
+
+#define BOOTDATA_MEM_RANGE_RAM          1
+#define BOOTDATA_MEM_RANGE_PERIPHERAL   2
+#define BOOTDATA_MEM_RANGE_RESERVED     3
+typedef struct {
+    uint64_t    paddr;
+    uint64_t    length;
+    uint32_t    type;
+    uint32_t    reserved;
+} bootdata_mem_range_t;
+
+/* 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)
+
+__END_CDECLS;
+
+
+// BOOTFS is a trivial "filesystem" format
+//
+// It consists of a bootfs_header_t
+//
+// Followed by a series of bootfs_entry_t's of:
+//   name length (32bit le)
+//   data size   (32bit le)
+//   data offset (32bit le)
+//   namedata   (namelength bytes, includes \0)
+//
+// - data offsets must be page aligned (multiple of 4096)
+// - entries start on uint32 boundaries
+
+//lsw of sha256("bootfs")
+#define BOOTFS_MAGIC (0xa56d3ff9)
+
+#define BOOTFS_PAGE_SIZE (4096)
+#define BOOTFS_PAGE_ALIGN(size) \
+    (((size) + BOOTFS_PAGE_SIZE - 1) & -BOOTFS_PAGE_SIZE)
+
+#define BOOTFS_MAX_NAME_LEN 256
+
+typedef struct bootfs_header {
+    // magic value BOOTFS_MAGIC
+    uint32_t magic;
+
+    // total size of all bootfs_entry_t's
+    // does not include the size of the bootfs_header_t
+    uint32_t dirsize;
+
+    // 0, 0
+    uint32_t reserved0;
+    uint32_t reserved1;
+} bootfs_header_t;
+
+typedef struct bootfs_entry {
+    uint32_t name_len;
+    uint32_t data_len;
+    uint32_t data_off;
+    char name[];
+} bootfs_entry_t;
+
+#define BOOTFS_ALIGN(nlen) (((nlen) + 3) & (~3))
+#define BOOTFS_RECSIZE(entry) \
+    (sizeof(bootfs_entry_t) + BOOTFS_ALIGN(entry->name_len))
+
+static inline bool bootdata_is_metadata(uint32_t type) {
+    return ((type & BOOTDATA_KIND_MASK) == BOOTDATA_KIND_METADATA);
+}
+
+#endif
diff --git a/arch/x64/sysroot/include/zircon/boot/driver-config.h b/arch/x64/sysroot/include/zircon/boot/driver-config.h
new file mode 100644
index 0000000..4913ae1
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/driver-config.h
@@ -0,0 +1,88 @@
+// 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.
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <stdint.h>
+
+// BOOTDATA_KERNEL_DRIVER bootdata types
+#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'
+
+// kernel driver struct that can be used for simple drivers
+// used by KDRV_PL011_UART, KDRV_AMLOGIC_UART and KDRV_NXP_IMX_UART
+typedef struct {
+    uint64_t mmio_phys;
+    uint32_t irq;
+} dcfg_simple_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;
+
+// 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;
diff --git a/arch/x64/sysroot/include/zircon/boot/e820.h b/arch/x64/sysroot/include/zircon/boot/e820.h
new file mode 100644
index 0000000..fb8c340
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/e820.h
@@ -0,0 +1,20 @@
+// 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.
+
+#pragma once
+
+#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;
diff --git a/arch/x64/sysroot/include/zircon/boot/image.h b/arch/x64/sysroot/include/zircon/boot/image.h
new file mode 100644
index 0000000..de2411e
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/image.h
@@ -0,0 +1,641 @@
+// 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.
+
+#pragma once
+
+#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_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_DEBUG_UART, "DEBUG_UART", ".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_BOOT_CONFIG, "BOOT_CONFIG", ".bin") \
+    macro(ZBI_TYPE_BOOT_VERSION, "BOOT_VERSION", ".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, which must be below 4GB.
+//     The %rsi register (or %esi, since the high 32 bits must be zero)
+//     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.
+//
+// If ZBI_FLAG_STORAGE_COMPRESSED is set in zbi_header_t.flags, then the
+// payload is compressed with LZ4 and zbi_header_t.extra gives the exact
+// size of the decompressed payload.  If ZBI_FLAG_STORAGE_COMPRESSED is
+// not set, then zbi_header_t.extra matches zbi_header_t.length.
+//
+// TODO(mcgrathr): Document or point to the details of the LZ4 header format.
+#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 below.
+// 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
+
+// The payload (after decompression) of an item in BOOTFS format consists
+// of separate "file" images that are each aligned to ZBI_BOOTFS_PAGE_SIZE
+// bytes from the beginning of the item payload.  The first "file" consists
+// of a zbi_bootfs_header_t followed by directory entries.
+#define ZBI_BOOTFS_PAGE_SIZE            (4096u)
+
+#define ZBI_BOOTFS_PAGE_ALIGN(size) \
+    (((size) + ZBI_BOOTFS_PAGE_SIZE - 1) & -ZBI_BOOTFS_PAGE_SIZE)
+
+#ifndef __ASSEMBLER__
+typedef struct {
+    // Must be ZBI_BOOTFS_MAGIC.
+    uint32_t magic;
+
+    // Size in bytes of all the directory entries.
+    // Does not include the size of the zbi_bootfs_header_t.
+    uint32_t dirsize;
+
+    // Reserved for future use.  Set to 0.
+    uint32_t reserved0;
+    uint32_t reserved1;
+} zbi_bootfs_header_t;
+#endif
+
+// LSW of sha256("bootfs")
+#define ZBI_BOOTFS_MAGIC                (0xa56d3ff9)
+
+// Each directory entry holds a pathname and gives the offset and size
+// of the contents of the file by that name.
+#ifndef __ASSEMBLER__
+typedef struct {
+    // Length of the name[] field at the end.  This length includes the
+    // NUL terminator, which must be present, but does not include any
+    // alignment padding required before the next directory entry.
+    uint32_t name_len;
+
+    // Length of the file in bytes.  This is an exact size that is not
+    // rounded, though the file is always padded with zeros up to a
+    // multiple of ZBI_BOOTFS_PAGE_SIZE.
+    uint32_t data_len;
+
+    // Offset from the beginning of the payload (zbi_bootfs_header_t) to
+    // the file's data.  This must be a multiple of ZBI_BOOTFS_PAGE_SIZE.
+    uint32_t data_off;
+
+    // Pathname of the file, a UTF-8 string.  This must include a NUL
+    // terminator at the end.  It must not begin with a '/', but it may
+    // contain '/' separators for subdirectories.
+    char name[];
+} zbi_bootfs_dirent_t;
+#endif
+
+// Each directory entry has a variable size of [16,268] bytes that
+// must be a multiple of 4 bytes.
+#define ZBI_BOOTFS_DIRENT_SIZE(name_len) \
+    ((sizeof(zbi_bootfs_dirent_t) + (name_len) + 3) & -(size_t)4)
+
+// zbi_bootfs_dirent_t.name_len must be > 1 and <= ZBI_BOOTFS_MAX_NAME_LEN.
+#define ZBI_BOOTFS_MAX_NAME_LEN         (256)
+
+
+// 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
+
+// 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 {
+    uint32_t apic_id;
+}  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)
+
+// Debug serial port, a zbi_uart_t entry.
+#define ZBI_TYPE_DEBUG_UART             (0x54524155) // UART
+#ifndef __ASSEMBLER__
+typedef struct {
+    uint64_t base;
+    uint32_t type;
+    uint32_t irq;
+} zbi_uart_t;
+#endif
+#define ZBI_UART_NONE                   (0)
+#define ZBI_UART_PC_PORT                (1)
+#define ZBI_UART_PC_MMIO                (2)
+
+// Framebuffer parameters, a zbi_swfb_t entry.
+#define ZBI_TYPE_FRAMEBUFFER            (0x42465753) // SWFB
+
+// A copy of the boot configuration stored as a kvstore
+// within the sysconfig partition.
+#define ZBI_TYPE_BOOT_CONFIG        (0x47464342) // BCFG
+
+// 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)
+#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
diff --git a/arch/x64/sysroot/include/zircon/boot/multiboot.h b/arch/x64/sysroot/include/zircon/boot/multiboot.h
new file mode 100644
index 0000000..0076832
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/multiboot.h
@@ -0,0 +1,115 @@
+// Copyright 2016 The Fuchsia Authors
+// Copyright (c) 2009 Corey Tabaka
+//
+// 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 __PLATFORM_MULTIBOOT_H
+#define __PLATFORM_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
diff --git a/arch/x64/sysroot/include/zircon/boot/netboot.h b/arch/x64/sysroot/include/zircon/boot/netboot.h
new file mode 100644
index 0000000..25973c6
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/netboot.h
@@ -0,0 +1,116 @@
+// 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 <stddef.h>
+#include <stdint.h>
+
+// clang-format off
+
+#define BOOTLOADER_VERSION "0.7.13"
+
+#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_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
+#define NB_EFI_HOST_FILENAME "efi.img"
+#define NB_EFI_FILENAME NB_IMAGE_PREFIX NB_EFI_HOST_FILENAME
+#define NB_KERNC_HOST_FILENAME "kernc.img"
+#define NB_KERNC_FILENAME NB_IMAGE_PREFIX NB_KERNC_HOST_FILENAME
+#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_SSHAUTH_HOST_FILENAME "authorized_keys"
+#define NB_SSHAUTH_FILENAME NB_IMAGE_PREFIX NB_SSHAUTH_HOST_FILENAME
+
+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;
diff --git a/arch/x64/sysroot/include/zircon/boot/sysconfig.h b/arch/x64/sysroot/include/zircon/boot/sysconfig.h
new file mode 100644
index 0000000..fe59efa
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/boot/sysconfig.h
@@ -0,0 +1,26 @@
+// 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.
+
+#pragma once
+
+// 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)
diff --git a/arch/x64/sysroot/include/zircon/compiler.h b/arch/x64/sysroot/include/zircon/compiler.h
new file mode 100644
index 0000000..fb3bb42
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/compiler.h
@@ -0,0 +1,122 @@
+// 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
+
+#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 __THREAD_ANNOTATION(x)
+#define __NO_SAFESTACK
+#else
+#define __LEAF_FN
+#define __OPTIMIZE(x)
+#define __EXTERNALLY_VISIBLE
+#define __THREAD_ANNOTATION(x) __attribute__((x))
+#define __NO_SAFESTACK __attribute__((__no_sanitize__("safe-stack")))
+#endif
+
+#ifndef __has_feature
+#define __has_feature(x) 0
+#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)
+
+#if defined(__cplusplus) && __cplusplus >= 201703L
+#define __FALLTHROUGH [[fallthrough]]
+#elif defined(__cplusplus) && defined(__clang__)
+#define __FALLTHROUGH [[clang::fallthrough]]
+#elif __GNUC__ >= 7
+#define __FALLTHROUGH __attribute__((__fallthrough__))
+#else
+#define __FALLTHROUGH do {} while (0)
+#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_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_REQUIRES(...) __THREAD_ANNOTATION(__requires_capability__(__VA_ARGS__))
+#define __TA_EXCLUDES(...) __THREAD_ANNOTATION(__locks_excluded__(__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)
diff --git a/arch/x64/sysroot/include/zircon/device/ioctl-wrapper.h b/arch/x64/sysroot/include/zircon/device/ioctl-wrapper.h
new file mode 100644
index 0000000..81a1286
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/device/ioctl-wrapper.h
@@ -0,0 +1,61 @@
+// 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/compiler.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+__BEGIN_CDECLS
+
+extern ssize_t fdio_ioctl(int fd, int op, const void* in_buf, size_t in_len, void* out_buf, size_t out_len);
+
+#define IOCTL_WRAPPER(name, op) \
+static inline ssize_t name(int fd) {             \
+    return fdio_ioctl(fd, op, NULL, 0, NULL, 0); \
+}
+
+#define IOCTL_WRAPPER_IN(name, op, type) \
+static inline ssize_t name(int fd, const type* in) {     \
+    return fdio_ioctl(fd, op, in, in ? sizeof(*in) : 0, NULL, 0); \
+}
+
+#define IOCTL_WRAPPER_VARIN(name, op, type) \
+static inline ssize_t name(int fd, const type* in, size_t in_len) { \
+    return fdio_ioctl(fd, op, in, in_len, NULL, 0);                  \
+}
+
+#define IOCTL_WRAPPER_OUT(name, op, type) \
+static inline ssize_t name(int fd, type* out) {            \
+    return fdio_ioctl(fd, op, NULL, 0, out, out ? sizeof(*out) : 0); \
+}
+
+#define IOCTL_WRAPPER_VAROUT(name, op, type) \
+static inline ssize_t name(int fd, type* out, size_t out_len) { \
+    return fdio_ioctl(fd, op, NULL, 0, out, out_len);           \
+}
+
+#define IOCTL_WRAPPER_INOUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, outtype* out) { \
+    return fdio_ioctl(fd, op, in, in ? sizeof(*in) : 0, out, out ? sizeof(*out) : 0);   \
+}
+
+#define IOCTL_WRAPPER_VARIN_OUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, size_t in_len, outtype* out) { \
+    return fdio_ioctl(fd, op, in, in_len, out, out ? sizeof(*out) : 0);                       \
+}
+
+#define IOCTL_WRAPPER_IN_VAROUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, outtype* out, size_t out_len) { \
+    return fdio_ioctl(fd, op, in, in ? sizeof(*in) : 0, out, out_len);                        \
+}
+
+#define IOCTL_WRAPPER_VARIN_VAROUT(name, op, intype, outtype) \
+static inline ssize_t name(int fd, const intype* in, size_t in_len, outtype* out, size_t out_len) { \
+    return fdio_ioctl(fd, op, in, in_len, out, out_len);                                            \
+}
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/device/ioctl.h b/arch/x64/sysroot/include/zircon/device/ioctl.h
new file mode 100644
index 0000000..7df5529
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/device/ioctl.h
@@ -0,0 +1,94 @@
+// 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
+
+// clang-format off
+
+// DEFAULT ioctls accept and received byte[] data
+// the particular ioctl may define more specific structures
+#define IOCTL_KIND_DEFAULT          0x0
+
+// GET_HANDLE ioctls accept plain data and return
+// a single handle, optionally followed by plain data
+#define IOCTL_KIND_GET_HANDLE       0x1
+
+// GET_TWO_HANDLES ioctls accept plain data and return
+// two handles, optionally followed by plain data
+#define IOCTL_KIND_GET_TWO_HANDLES  0x2
+
+// GET_THREE_HANDLES ioctls accept plain data and return
+// three handles, optionally followed by plain data
+#define IOCTL_KIND_GET_THREE_HANDLES 0x4
+
+// SET_HANDLE ioctls accept a handle, and optionally
+// plain data afterwards.
+#define IOCTL_KIND_SET_HANDLE       0x3
+
+// SET_TWO_HANDLES ioctls accepts two handles, and
+// optionally plain data afterwards.
+#define IOCTL_KIND_SET_TWO_HANDLES  0x5
+
+// core device/vfs ioctl families
+#define IOCTL_FAMILY_RESERVED       0x00
+#define IOCTL_FAMILY_DEVICE         0x01
+#define IOCTL_FAMILY_VFS            0x02
+#define IOCTL_FAMILY_DMCTL          0x03
+#define IOCTL_FAMILY_TEST           0x04
+
+// device protocol families
+#define IOCTL_FAMILY_CONSOLE        0x10
+#define IOCTL_FAMILY_INPUT          0x11
+// 0x12 unused
+#define IOCTL_FAMILY_BLOCK          0x13
+#define IOCTL_FAMILY_I2C            0x14
+#define IOCTL_FAMILY_USB_DEVICE     0x16
+#define IOCTL_FAMILY_HID            0x17
+// 0x18 unused
+#define IOCTL_FAMILY_AUDIO          0x19
+#define IOCTL_FAMILY_MIDI           0x1A
+#define IOCTL_FAMILY_KTRACE         0x1B
+#define IOCTL_FAMILY_BT_HCI         0x1C
+#define IOCTL_FAMILY_SYSINFO        0x1D
+// 0x1E unused
+#define IOCTL_FAMILY_RTC            0x1F  // ioctls for RTC
+#define IOCTL_FAMILY_ETH            0x20
+#define IOCTL_FAMILY_INSNTRACE      0x21  // ioctls for instruction tracing
+#define IOCTL_FAMILY_RAMDISK        0x22
+#define IOCTL_FAMILY_SDMMC          0x23
+#define IOCTL_FAMILY_WLAN           0x24
+#define IOCTL_FAMILY_PTY            0x25
+#define IOCTL_FAMILY_NETCONFIG      0x26
+#define IOCTL_FAMILY_ETHERTAP       0x27
+#define IOCTL_FAMILY_USB_PERIPHERAL 0x28
+#define IOCTL_FAMILY_USB_VIRT_BUS   0x29
+#define IOCTL_FAMILY_CPUPERF        0x2A
+#define IOCTL_FAMILY_POWER          0x30
+#define IOCTL_FAMILY_THERMAL        0x31
+#define IOCTL_FAMILY_CAMERA         0x32
+#define IOCTL_FAMILY_BT_HOST        0x33
+#define IOCTL_FAMILY_WLANPHY        0x34
+#define IOCTL_FAMILY_SERIAL         0x35
+#define IOCTL_FAMILY_WLANTAP        0x36
+#define IOCTL_FAMILY_DISPLAY_CONTROLLER 0x37
+#define IOCTL_FAMILY_DEBUG          0x38
+#define IOCTL_FAMILY_AUDIO_CODEC    0x39
+#define IOCTL_FAMILY_BACKLIGHT      0x3A
+#define IOCTL_FAMILY_NAND_TEST      0x3B
+#define IOCTL_FAMILY_TEE            0x3C
+#define IOCTL_FAMILY_SKIP_BLOCK     0x3D
+#define IOCTL_FAMILY_USB_TEST       0x3E
+#define IOCTL_FAMILY_CLK            0x3F
+// 0x40 unused.
+#define IOCTL_FAMILY_QMI            0x41
+
+// IOCTL constructor
+// --K-FFNN
+#define IOCTL(kind, family, number) \
+    ((((kind) & 0xF) << 20) | (((family) & 0xFF) << 8) | ((number) & 0xFF))
+
+// IOCTL accessors
+#define IOCTL_KIND(n) (((n) >> 20) & 0xF)
+#define IOCTL_FAMILY(n) (((n) >> 8) & 0xFF)
+#define IOCTL_NUMBER(n) ((n) & 0xFF)
diff --git a/arch/x64/sysroot/include/zircon/device/ramdisk.h b/arch/x64/sysroot/include/zircon/device/ramdisk.h
new file mode 100644
index 0000000..dac72b9
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/device/ramdisk.h
@@ -0,0 +1,83 @@
+// 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.
+
+#pragma once
+
+#include <limits.h>
+#include <zircon/boot/image.h>
+#include <zircon/device/ioctl.h>
+#include <zircon/device/ioctl-wrapper.h>
+#include <zircon/types.h>
+
+#define IOCTL_RAMDISK_CONFIG \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 1)
+#define IOCTL_RAMDISK_CONFIG_VMO \
+    IOCTL(IOCTL_KIND_SET_HANDLE, IOCTL_FAMILY_RAMDISK, 4)
+#define IOCTL_RAMDISK_UNLINK \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 2)
+#define IOCTL_RAMDISK_SET_FLAGS \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 3)
+#define IOCTL_RAMDISK_WAKE_UP \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 4)
+#define IOCTL_RAMDISK_SLEEP_AFTER \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 5)
+#define IOCTL_RAMDISK_GET_BLK_COUNTS \
+    IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_RAMDISK, 6)
+
+// Ramdisk-specific flags
+#define RAMDISK_FLAG_RESUME_ON_WAKE 0xFF000001
+
+typedef struct ramdisk_ioctl_config {
+    uint64_t blk_size;
+    uint64_t blk_count;
+    uint8_t type_guid[ZBI_PARTITION_GUID_LEN];
+} ramdisk_ioctl_config_t;
+
+typedef struct ramdisk_ioctl_config_response {
+    char name[NAME_MAX + 1];
+} ramdisk_ioctl_config_response_t;
+
+typedef struct ramdisk_blk_counts {
+    uint64_t received;
+    uint64_t successful;
+    uint64_t failed;
+} ramdisk_blk_counts_t;
+
+// ssize_t ioctl_ramdisk_config(int fd, const ramdisk_ioctl_config_t* in,
+//                              ramdisk_ioctl_config_response_t* out);
+IOCTL_WRAPPER_INOUT(ioctl_ramdisk_config, IOCTL_RAMDISK_CONFIG, ramdisk_ioctl_config_t,
+                    ramdisk_ioctl_config_response_t);
+
+// ssize_t ioctl_ramdisk_config_vmo(int fd, const zx_handle_t* in,
+//                                  ramdisk_ioctl_config_response_t* out);
+IOCTL_WRAPPER_INOUT(ioctl_ramdisk_config_vmo, IOCTL_RAMDISK_CONFIG_VMO,
+                    zx_handle_t, ramdisk_ioctl_config_response_t);
+
+// ssize_t ioctl_ramdisk_unlink(int fd);
+IOCTL_WRAPPER(ioctl_ramdisk_unlink, IOCTL_RAMDISK_UNLINK);
+
+// ssize_t ioctl_ramdisk_set_flags(int fd, uint32_t* in);
+// The flags to set match block_info_t.flags. This is intended to simulate the behavior
+// of other block devices, so it should be used only for tests.
+IOCTL_WRAPPER_IN(ioctl_ramdisk_set_flags, IOCTL_RAMDISK_SET_FLAGS, uint32_t);
+
+// ssize_t ioctl_ramdisk_wake_up(int fd);
+// "Wakes" the ramdisk, if it was sleeping.
+// Transactions are no longer expected to fail after this point, and the ramdisk will not sleep
+// again until the next call to SLEEP_AFTER.
+// This will reset the current transaction count.
+IOCTL_WRAPPER(ioctl_ramdisk_wake_up, IOCTL_RAMDISK_WAKE_UP);
+
+// ssize_t ioctl_ramdisk_sleep_after(int fd, uint64_t* in);
+// Tell the ramdisk to "sleep" after |in| blocks have been written successfully.
+// After this point, all incoming transactions will fail.
+// This will reset the current block count.
+// NOTE! Use caution with RAMDISK_FLAG_RESUME_ON_WAKE set; sleeping with this flags will cause I/O
+// to block indefinitely until another call invokes |ioctl_ramdisk_wake_up|.
+IOCTL_WRAPPER_IN(ioctl_ramdisk_sleep_after, IOCTL_RAMDISK_SLEEP_AFTER, uint64_t);
+
+// ssize_t ioctl_ramdisk_get_blk_counts(int fd, ramdisk_blk_counts_t* out);
+// Retrieve the number of received, successful, and failed block writes since the last call to
+// sleep/wake.
+IOCTL_WRAPPER_OUT(ioctl_ramdisk_get_blk_counts, IOCTL_RAMDISK_GET_BLK_COUNTS, ramdisk_blk_counts_t);
diff --git a/arch/x64/sysroot/include/zircon/dlfcn.h b/arch/x64/sysroot/include/zircon/dlfcn.h
new file mode 100644
index 0000000..af4a62b
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/dlfcn.h
@@ -0,0 +1,32 @@
+// 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.
+
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/zircon/driver/binding.h b/arch/x64/sysroot/include/zircon/driver/binding.h
new file mode 100644
index 0000000..7c05026
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/driver/binding.h
@@ -0,0 +1,286 @@
+// 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 <assert.h>
+#include <zircon/compiler.h>
+#include <stdalign.h>
+#include <stddef.h>
+#include <stdint.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_SET    0x3 // if (cond) flags |= paramA
+#define OP_CLEAR  0x4 // if (cond) flags &= (~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
+#define COND_MASK 0x7 // (bind(paramB) & Value) != 0
+#define COND_BITS 0x8 // (bind(paramB) & Value) == 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) }
+
+#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_SET(f)             BINDINST(COND_AL,OP_SET,f,0,0)
+#define BI_CLEAR(f)           BINDINST(COND_AL,OP_CLEAR,f,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)
+#define BI_SET_IF(c,b,v,f)    BINDINST(COND_##c,OP_SET,f,b,v)
+#define BI_CLEAR_IF(c,b,v,f)  BINDINST(COND_##c,OP_CLEAR,f,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 protcol 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
+#define BIND_PCI_BDF_ADDR     0x0106
+
+// pci binding variable utils
+#define BIND_PCI_BDF_PACK(bus, dev, func) \
+    ((((uint32_t)(bus)  & 0xFF) << 8) |   \
+     (((uint32_t)(dev)  & 0x1F) << 3) |   \
+      ((uint32_t)(func) & 0x07))
+
+#define BIND_PCI_BDF_UNPACK_BUS(bdf) (((uint32_t)(bdf) >> 8) & 0xFF)
+#define BIND_PCI_BDF_UNPACK_DEV(bdf) (((uint32_t)(bdf) >> 3) & 0x1F)
+#define BIND_PCI_BDF_UNPACK_FUNC(bdf) ((uint32_t)(bdf) & 0x07)
+
+// 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
+
+// I2C binding variables at 0x0AXX
+#define BIND_I2C_CLASS            0x0A00
+
+// TEMPORARY binding variables at 0xfXX
+// I2C_ADDR is a temporary way to bind the i2c touchscreen on the Acer12. This
+// binding will eventually be made via some sort of ACPI device enumeration.
+#define BIND_I2C_ADDR         0x0f00
+
+typedef struct zx_bind_inst {
+    uint32_t op;
+    uint32_t arg;
+} 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) \
+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;
diff --git a/arch/x64/sysroot/include/zircon/errors.h b/arch/x64/sysroot/include/zircon/errors.h
new file mode 100644
index 0000000..1c1ed80
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/errors.h
@@ -0,0 +1,231 @@
+// 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
+
+// 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)
diff --git a/arch/x64/sysroot/include/zircon/features.h b/arch/x64/sysroot/include/zircon/features.h
new file mode 100644
index 0000000..a560007
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/features.h
@@ -0,0 +1,45 @@
+// 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 ZIRCON_FEATURES_H_
+#define 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)
+
+// 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 // ZIRCON_FEATURES_H_
diff --git a/arch/x64/sysroot/include/zircon/fidl.h b/arch/x64/sysroot/include/zircon/fidl.h
new file mode 100644
index 0000000..e971472
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/fidl.h
@@ -0,0 +1,377 @@
+// 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 ZIRCON_FIDL_H_
+#define ZIRCON_FIDL_H_
+
+#include <assert.h>
+#include <stdalign.h>
+#include <stdint.h>
+
+#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++14.
+//
+// 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.
+#define FIDL_ALIGNMENT ((size_t)8)
+#define FIDL_ALIGN(a) (((a) + 7) & ~7)
+#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.
+
+// 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.
+
+// Messages.
+
+// All fidl messages share a common 16 byte header.
+
+typedef struct fidl_message_header {
+    zx_txid_t txid;
+    // This reserved word is used by Epitaphs to represent an error value.
+    uint32_t reserved0;
+    uint32_t flags;
+    uint32_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
+
+// The system reserves the high half of the ordinal space.
+
+#define FIDL_ORD_SYSTEM_MASK 0x80000000ul
+
+// 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 error associated with this epitaph is stored in the reserved word of
+    // the message header.  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.
+    fidl_message_header_t hdr;
+} fidl_epitaph_t;
+
+// This ordinal value is reserved for Epitaphs.
+#define FIDL_EPITAPH_ORDINAL 0xFFFFFFFF
+
+// 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 // ZIRCON_FIDL_H_
diff --git a/arch/x64/sysroot/include/zircon/hw/gpt.h b/arch/x64/sysroot/include/zircon/hw/gpt.h
new file mode 100644
index 0000000..c3112f5
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/gpt.h
@@ -0,0 +1,172 @@
+// 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.
+
+#pragma once
+
+#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;
+    uint32_t revision;
+    uint32_t size;
+    uint32_t crc32;
+    uint32_t reserved0;
+    uint64_t current;
+    uint64_t backup;
+    uint64_t first;
+    uint64_t last;
+    uint8_t guid[GPT_GUID_LEN];
+    uint64_t entries;
+    uint32_t entries_count;
+    uint32_t entries_size;
+    uint32_t entries_crc;
+} __PACKED gpt_header_t;
+
+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
+} __PACKED gpt_entry_t;
+
+#define GUID_EMPTY_VALUE {                         \
+    0x00, 0x00, 0x00, 0x00,                        \
+    0x00, 0x00,                                    \
+    0x00, 0x00,                                    \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \
+}
+
+#define GUID_EFI_VALUE {                           \
+    0x28, 0x73, 0x2a, 0xc1,                        \
+    0x1f, 0xf8,                                    \
+    0xd2, 0x11,                                    \
+    0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b \
+}
+
+// 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 \
+}
+
+// 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 \
+}
+
+// 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_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_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_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_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_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_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_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_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_TEST_STRING "8B94D043-30BE-4871-9DFA-D69556E8C1F3"
+#define GUID_TEST_VALUE { \
+    0x43, 0xD0, 0x94, 0x8b,                        \
+    0xbe, 0x30,                                    \
+    0x71, 0x38,                                    \
+    0x9d, 0xfa, 0xd6, 0x95, 0x56, 0xe8, 0xc1, 0xf3 \
+}
+
+#define GUID_VBMETA_A_STRING "A13B4D9A-EC5F-11E8-97D8-6C3BE52705BF"
+#define GUID_VBMETA_A_VALUE { \
+    0x9a, 0x4d, 0x3b, 0xa1,                        \
+    0x5f, 0xec,                                    \
+    0xd8, 0x97,                                    \
+    0x6c, 0x3b, 0x6c, 0x3b, 0xe2, 0x27, 0x05, 0xbf \
+}
+
+#define GUID_VBMETA_B_STRING "A288ABF2-EC5F-11E8-97D8-6C3BE52705BF"
+#define GUID_VBMETA_B_VALUE { \
+    0xf2, 0xab, 0x88, 0xa2,                        \
+    0x5f, 0xec,                                    \
+    0xd8, 0x97,                                    \
+    0x6c, 0x3b, 0x6c, 0x3b, 0xe2, 0x27, 0x05, 0xbf \
+}
diff --git a/arch/x64/sysroot/include/zircon/hw/i2c.h b/arch/x64/sysroot/include/zircon/hw/i2c.h
new file mode 100644
index 0000000..a8f0f4b
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/i2c.h
@@ -0,0 +1,7 @@
+// 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
+
+#define I2C_CLASS_HID 1
diff --git a/arch/x64/sysroot/include/zircon/hw/pci.h b/arch/x64/sysroot/include/zircon/hw/pci.h
new file mode 100644
index 0000000..06c7023
--- /dev/null
+++ b/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 ZIRCON_HW_PCI_H_
+#define 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 // ZIRCON_HW_PCI_H_
diff --git a/arch/x64/sysroot/include/zircon/hw/usb-audio.h b/arch/x64/sysroot/include/zircon/hw/usb-audio.h
new file mode 100644
index 0000000..7af2994
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb-audio.h
@@ -0,0 +1,524 @@
+// 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
+
+// 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 concatinated, 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;
diff --git a/arch/x64/sysroot/include/zircon/hw/usb-cdc.h b/arch/x64/sysroot/include/zircon/hw/usb-cdc.h
new file mode 100644
index 0000000..f64a422
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb-cdc.h
@@ -0,0 +1,138 @@
+// 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.
+
+#pragma once
+
+// 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 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;
diff --git a/arch/x64/sysroot/include/zircon/hw/usb-hid.h b/arch/x64/sysroot/include/zircon/hw/usb-hid.h
new file mode 100644
index 0000000..d8be878
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb-hid.h
@@ -0,0 +1,33 @@
+// 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
+
+// clang-format off
+
+__BEGIN_CDECLS;
+
+/* 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
+
+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;
diff --git a/arch/x64/sysroot/include/zircon/hw/usb-hub.h b/arch/x64/sysroot/include/zircon/hw/usb-hub.h
new file mode 100644
index 0000000..2a8b395
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb-hub.h
@@ -0,0 +1,114 @@
+// 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
+
+// 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;
diff --git a/arch/x64/sysroot/include/zircon/hw/usb-mass-storage.h b/arch/x64/sysroot/include/zircon/hw/usb-mass-storage.h
new file mode 100644
index 0000000..f2d1d80
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb-mass-storage.h
@@ -0,0 +1,156 @@
+// 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
+
+// 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, "");
diff --git a/arch/x64/sysroot/include/zircon/hw/usb-video.h b/arch/x64/sysroot/include/zircon/hw/usb-video.h
new file mode 100644
index 0000000..1ff6e22
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb-video.h
@@ -0,0 +1,304 @@
+// 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.
+
+#pragma once
+
+// clang-format off
+
+#include <zircon/compiler.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;
+
diff --git a/arch/x64/sysroot/include/zircon/hw/usb.h b/arch/x64/sysroot/include/zircon/hw/usb.h
new file mode 100644
index 0000000..697f7f0
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/hw/usb.h
@@ -0,0 +1,242 @@
+// 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
+
+// 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_VENDOR                    0xFf
+
+#define USB_SUBCLASS_MSC_SCSI               0x06
+#define USB_PROTOCOL_MSC_BULK_ONLY          0x50
+
+/* 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_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_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;
+
+__END_CDECLS;
diff --git a/arch/x64/sysroot/include/zircon/limits.h b/arch/x64/sysroot/include/zircon/limits.h
new file mode 100644
index 0000000..4c691a3
--- /dev/null
+++ b/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 ZIRCON_LIMITS_H_
+#define ZIRCON_LIMITS_H_
+
+#include <stdint.h>
+
+#define ZX_PAGE_SHIFT ((uint32_t)12u)
+#define ZX_PAGE_SIZE ((uint32_t)(1u << ZX_PAGE_SHIFT))
+#define ZX_PAGE_MASK (ZX_PAGE_SIZE - 1u)
+
+#endif // ZIRCON_LIMITS_H_
diff --git a/arch/x64/sysroot/include/zircon/listnode.h b/arch/x64/sysroot/include/zircon/listnode.h
new file mode 100644
index 0000000..b987bdf
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/listnode.h
@@ -0,0 +1,304 @@
+// 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/compiler.h>
+#include <stdbool.h>
+#include <stddef.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(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(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;
diff --git a/arch/x64/sysroot/include/zircon/pixelformat.h b/arch/x64/sysroot/include/zircon/pixelformat.h
new file mode 100644
index 0000000..8d15c0c
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/pixelformat.h
@@ -0,0 +1,26 @@
+// 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 ZIRCON_PIXELFORMAT_H_
+#define 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_BYTES(pf)  (((pf) >> 16) & 7)
+
+#endif // ZIRCON_PIXELFORMAT_H_
diff --git a/arch/x64/sysroot/include/zircon/process.h b/arch/x64/sysroot/include/zircon/process.h
new file mode 100644
index 0000000..bec8a79
--- /dev/null
+++ b/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 ZIRCON_PROCESS_H_
+#define ZIRCON_PROCESS_H_
+
+#include <zircon/types.h>
+#include <stdint.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 // ZIRCON_PROCESS_H_
diff --git a/arch/x64/sysroot/include/zircon/processargs.h b/arch/x64/sysroot/include/zircon/processargs.h
new file mode 100644
index 0000000..dfc771f
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/processargs.h
@@ -0,0 +1,163 @@
+// 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 ZIRCON_PROCESSARGS_H_
+#define ZIRCON_PROCESSARGS_H_
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+#include <stdint.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_SUBTYPE(n)          (((n) >> 8) & 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
+
+
+// --- FDIO Handles ---
+// Used by libfdio for passing fdtable, fsroot, etc
+
+// Handle types the fdio library uses
+#define PA_FDIO_REMOTE           0x32u
+#define PA_FDIO_LOGGER           0x35u
+#define PA_FDIO_SOCKET           0x36u
+
+// Server endpoint for handling connection to appmgr services.
+#define PA_DIRECTORY_REQUEST     0x3Bu
+
+// Used by devmgr and devhosts
+#define PA_RESOURCE              0x3Fu
+
+
+// --- Various ---
+
+// Handle types for one-off use and prototyping
+#define PA_USER0                 0xF0u
+#define PA_USER1                 0xF1u
+#define PA_USER2                 0xF2u
+
+__END_CDECLS
+
+#endif // ZIRCON_PROCESSARGS_H_
diff --git a/arch/x64/sysroot/include/zircon/rights.h b/arch/x64/sysroot/include/zircon/rights.h
new file mode 100644
index 0000000..8c9f021
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/rights.h
@@ -0,0 +1,127 @@
+// 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 ZIRCON_RIGHTS_H_
+#define 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_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)
+
+#define ZX_DEFAULT_LOG_RIGHTS \
+    (ZX_RIGHTS_BASIC | ZX_RIGHT_WRITE | ZX_RIGHT_SIGNAL)
+
+#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_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_EXECUTE | 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_ENUMERATE | ZX_RIGHT_GET_PROPERTY |\
+     ZX_RIGHT_SET_PROPERTY | ZX_RIGHT_TRANSFER)
+
+#endif // ZIRCON_RIGHTS_H_
diff --git a/arch/x64/sysroot/include/zircon/sanitizer.h b/arch/x64/sysroot/include/zircon/sanitizer.h
new file mode 100644
index 0000000..0b0b7a3
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/sanitizer.h
@@ -0,0 +1,144 @@
+// 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.
+
+#pragma once
+
+// 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);
+
+// 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);
+
+// 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);
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/status.h b/arch/x64/sysroot/include/zircon/status.h
new file mode 100644
index 0000000..5d83c72
--- /dev/null
+++ b/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".
+const char* _zx_status_get_string(zx_status_t status);
+const char* zx_status_get_string(zx_status_t status);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/arch/x64/sysroot/include/zircon/syscalls.h b/arch/x64/sysroot/include/zircon/syscalls.h
new file mode 100644
index 0000000..b5c0057
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls.h
@@ -0,0 +1,30 @@
+// 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 ZIRCON_SYSCALLS_H_
+#define ZIRCON_SYSCALLS_H_
+
+#include <zircon/types.h>
+#include <zircon/syscalls/types.h>
+
+#include <zircon/syscalls/pci.h>
+#include <zircon/syscalls/object.h>
+#include <zircon/syscalls/profile.h>
+
+__BEGIN_CDECLS
+
+#if defined(__clang__)
+#define ZX_SYSCALL_PARAM_ATTR(x)   __attribute__((annotate("zx_" #x)))
+#else
+#define ZX_SYSCALL_PARAM_ATTR(x)   // no-op
+#endif
+
+#include <zircon/syscalls/definitions.h>
+
+// Compatibility wrappers for deprecated syscalls also go here, when
+// there are any.
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_H_
diff --git a/arch/x64/sysroot/include/zircon/syscalls/debug.h b/arch/x64/sysroot/include/zircon/syscalls/debug.h
new file mode 100644
index 0000000..82ea309
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/debug.h
@@ -0,0 +1,162 @@
+// 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 ZIRCON_SYSCALLS_DEBUG_
+#define 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;
+} 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.
+
+    // 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;
+} 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.
+  // TODO(donosoc): These values are deprecated but are still used by zxdb. We debine both values
+  //                in order to do a soft transition. Delete these values once zxdb has made the
+  //                update.
+  uint64_t dr6_status;  // Status register.
+  uint64_t dr7_control; // 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;
+} 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 {
+    uint64_t dbgbvr;      //  HW Breakpoint Value register.
+    uint32_t dbgbcr;      //  HW Breakpoint Control register.
+  } hw_bps[AARCH64_MAX_HW_BREAKPOINTS];
+  // Number of HW Breakpoints in the platform.
+  // Will be set on read and ignored on write.
+  uint8_t hw_bps_count;
+  struct {
+    uint64_t dbgwvr;      // HW Watchpoint Value register.
+    uint32_t dbgwcr;      // HW Watchpoint Control register.
+  } hw_wps[AARCH64_MAX_HW_WATCHPOINTS];
+  // Number of HW Watchpoints in the platform.
+  // Will be set on read and ignored on write.
+  uint8_t hw_wps_count;
+} 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 // ZIRCON_SYSCALLS_DEBUG_
diff --git a/arch/x64/sysroot/include/zircon/syscalls/definitions.h b/arch/x64/sysroot/include/zircon/syscalls/definitions.h
new file mode 100644
index 0000000..70da713
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/definitions.h
@@ -0,0 +1,1839 @@
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
+// This is a GENERATED file, see //zircon/system/host/abigen.
+// The license governing this file can be found in the LICENSE file.
+
+extern zx_time_t zx_clock_get(
+    zx_clock_t clock_id) __LEAF_FN;
+
+extern zx_time_t _zx_clock_get(
+    zx_clock_t clock_id) __LEAF_FN;
+
+extern zx_status_t zx_clock_get_new(
+    zx_clock_t clock_id,
+    zx_time_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_clock_get_new(
+    zx_clock_t clock_id,
+    zx_time_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_time_t zx_clock_get_monotonic(
+    void) __LEAF_FN;
+
+extern zx_time_t _zx_clock_get_monotonic(
+    void) __LEAF_FN;
+
+extern zx_status_t zx_nanosleep(
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_nanosleep(
+    zx_time_t deadline) __LEAF_FN;
+
+extern uint64_t zx_ticks_get(
+    void) __LEAF_FN;
+
+extern uint64_t _zx_ticks_get(
+    void) __LEAF_FN;
+
+extern uint64_t zx_ticks_per_second(
+    void) __LEAF_FN __CONST;
+
+extern uint64_t _zx_ticks_per_second(
+    void) __LEAF_FN __CONST;
+
+extern zx_time_t zx_deadline_after(
+    zx_duration_t nanoseconds) __LEAF_FN;
+
+extern zx_time_t _zx_deadline_after(
+    zx_duration_t nanoseconds) __LEAF_FN;
+
+extern zx_status_t zx_clock_adjust(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_clock_t clock_id,
+    int64_t offset) __LEAF_FN;
+
+extern zx_status_t _zx_clock_adjust(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_clock_t clock_id,
+    int64_t offset) __LEAF_FN;
+
+extern uint32_t zx_system_get_dcache_line_size(
+    void) __LEAF_FN __CONST;
+
+extern uint32_t _zx_system_get_dcache_line_size(
+    void) __LEAF_FN __CONST;
+
+extern uint32_t zx_system_get_num_cpus(
+    void) __LEAF_FN __CONST;
+
+extern uint32_t _zx_system_get_num_cpus(
+    void) __LEAF_FN __CONST;
+
+extern zx_status_t zx_system_get_version(
+    char* version,
+    size_t version_size) __LEAF_FN;
+
+extern zx_status_t _zx_system_get_version(
+    char* version,
+    size_t version_size) __LEAF_FN;
+
+extern uint64_t zx_system_get_physmem(
+    void) __LEAF_FN;
+
+extern uint64_t _zx_system_get_physmem(
+    void) __LEAF_FN;
+
+extern zx_status_t zx_system_get_features(
+    uint32_t kind,
+    ZX_SYSCALL_PARAM_ATTR(features) uint32_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_system_get_features(
+    uint32_t kind,
+    ZX_SYSCALL_PARAM_ATTR(features) uint32_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_cache_flush(
+    const void* addr,
+    size_t size,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_cache_flush(
+    const void* addr,
+    size_t size,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_handle_close(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_handle_close(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_handle_close_many(
+    const zx_handle_t* handles,
+    size_t num_handles) __LEAF_FN;
+
+extern zx_status_t _zx_handle_close_many(
+    const zx_handle_t* handles,
+    size_t num_handles) __LEAF_FN;
+
+extern zx_status_t zx_handle_duplicate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_handle_duplicate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_handle_replace(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_handle_replace(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    zx_rights_t rights,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_object_wait_one(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_signals_t signals,
+    zx_time_t deadline,
+    zx_signals_t* observed) __LEAF_FN;
+
+extern zx_status_t _zx_object_wait_one(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_signals_t signals,
+    zx_time_t deadline,
+    zx_signals_t* observed) __LEAF_FN;
+
+extern zx_status_t zx_object_wait_many(
+    zx_wait_item_t* items,
+    size_t count,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_object_wait_many(
+    zx_wait_item_t* items,
+    size_t count,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t zx_object_wait_async(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    zx_signals_t signals,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_object_wait_async(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    zx_signals_t signals,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_object_signal(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t _zx_object_signal(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t zx_object_signal_peer(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t _zx_object_signal_peer(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t clear_mask,
+    uint32_t set_mask) __LEAF_FN;
+
+extern zx_status_t zx_object_get_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t zx_object_set_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    const void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t _zx_object_set_property(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t property,
+    const void* value,
+    size_t value_size) __LEAF_FN;
+
+extern zx_status_t zx_object_set_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t cookie) __LEAF_FN;
+
+extern zx_status_t _zx_object_set_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t cookie) __LEAF_FN;
+
+extern zx_status_t zx_object_get_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t* cookie) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_cookie(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t scope,
+    uint64_t* cookie) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_object_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t topic,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual_count,
+    size_t* avail_count) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t topic,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual_count,
+    size_t* avail_count) __LEAF_FN;
+
+extern zx_status_t zx_object_get_child(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t koid,
+    zx_rights_t rights,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_object_get_child(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t koid,
+    zx_rights_t rights,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_object_set_profile(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t profile,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_object_set_profile(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t profile,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_channel_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_channel_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_channel_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* bytes,
+    zx_handle_t* handles,
+    uint32_t num_bytes,
+    uint32_t num_handles,
+    uint32_t* actual_bytes,
+    uint32_t* actual_handles) __LEAF_FN;
+
+extern zx_status_t _zx_channel_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* bytes,
+    zx_handle_t* handles,
+    uint32_t num_bytes,
+    uint32_t num_handles,
+    uint32_t* actual_bytes,
+    uint32_t* actual_handles) __LEAF_FN;
+
+extern zx_status_t zx_channel_read_etc(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __LEAF_FN;
+
+extern zx_status_t _zx_channel_read_etc(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __LEAF_FN;
+
+extern zx_status_t zx_channel_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* bytes,
+    uint32_t num_bytes,
+    const zx_handle_t* handles,
+    uint32_t num_handles) __LEAF_FN;
+
+extern zx_status_t _zx_channel_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* bytes,
+    uint32_t num_bytes,
+    const zx_handle_t* handles,
+    uint32_t num_handles) __LEAF_FN;
+
+extern zx_status_t zx_channel_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_channel_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) 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) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_socket_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_socket_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_socket_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t _zx_socket_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t zx_socket_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t _zx_socket_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __LEAF_FN;
+
+extern zx_status_t zx_socket_share(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t socket_to_share) __LEAF_FN;
+
+extern zx_status_t _zx_socket_share(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t socket_to_share) __LEAF_FN;
+
+extern zx_status_t zx_socket_accept(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_socket) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_socket_accept(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_socket) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_socket_shutdown(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_socket_shutdown(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options) __LEAF_FN;
+
+extern void zx_thread_exit(
+    void) __LEAF_FN __NO_RETURN;
+
+extern void _zx_thread_exit(
+    void) __LEAF_FN __NO_RETURN;
+
+extern zx_status_t zx_thread_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t process,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_thread_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t process,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_thread_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t thread_entry,
+    zx_vaddr_t stack,
+    uintptr_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t _zx_thread_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t thread_entry,
+    zx_vaddr_t stack,
+    uintptr_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t zx_thread_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_thread_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_thread_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_thread_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_thread_set_priority(
+    int32_t prio) __LEAF_FN;
+
+extern zx_status_t _zx_thread_set_priority(
+    int32_t prio) __LEAF_FN;
+
+extern void zx_process_exit(
+    int64_t retcode) __LEAF_FN __NO_RETURN;
+
+extern void _zx_process_exit(
+    int64_t retcode) __LEAF_FN __NO_RETURN;
+
+extern zx_status_t zx_process_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* proc_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_process_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    const char* name,
+    size_t name_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* proc_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_process_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t thread,
+    zx_vaddr_t entry,
+    zx_vaddr_t stack,
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t _zx_process_start(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t thread,
+    zx_vaddr_t entry,
+    zx_vaddr_t stack,
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t arg1,
+    uintptr_t arg2) __LEAF_FN;
+
+extern zx_status_t zx_process_read_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_process_read_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_process_write_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_process_write_memory(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t proc,
+    zx_vaddr_t vaddr,
+    const void* buffer,
+    size_t buffer_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_job_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_job,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_job_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_job,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_job_set_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    uint32_t options,
+    uint32_t topic,
+    const void* policy,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t _zx_job_set_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t job,
+    uint32_t options,
+    uint32_t topic,
+    const void* policy,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t zx_task_bind_exception_port(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_task_bind_exception_port(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_task_suspend(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_task_suspend(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_task_suspend_token(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_task_suspend_token(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* token) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_task_resume_from_exception(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_task_resume_from_exception(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_task_kill(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_task_kill(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_event_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_event_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_eventpair_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_eventpair_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_futex_wait(
+    const zx_futex_t* value_ptr,
+    zx_futex_t current_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_futex_owner,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wait(
+    const zx_futex_t* value_ptr,
+    zx_futex_t current_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_futex_owner,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t zx_futex_wake(
+    const zx_futex_t* value_ptr,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wake(
+    const zx_futex_t* value_ptr,
+    uint32_t count) __LEAF_FN;
+
+extern zx_status_t zx_futex_requeue(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t _zx_futex_requeue(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t zx_futex_wake_single_owner(
+    const zx_futex_t* value_ptr) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wake_single_owner(
+    const zx_futex_t* value_ptr) __LEAF_FN;
+
+extern zx_status_t zx_futex_requeue_single_owner(
+    const zx_futex_t* wake_ptr,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t _zx_futex_requeue_single_owner(
+    const zx_futex_t* wake_ptr,
+    zx_futex_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t new_requeue_owner) __LEAF_FN;
+
+extern zx_status_t zx_futex_get_owner(
+    const zx_futex_t* value_ptr,
+    zx_koid_t* koid) __LEAF_FN;
+
+extern zx_status_t _zx_futex_get_owner(
+    const zx_futex_t* value_ptr,
+    zx_koid_t* koid) __LEAF_FN;
+
+extern zx_status_t zx_futex_wait_deprecated(
+    const zx_futex_t* value_ptr,
+    int32_t current_value,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t _zx_futex_wait_deprecated(
+    const zx_futex_t* value_ptr,
+    int32_t current_value,
+    zx_time_t deadline) __LEAF_FN;
+
+extern zx_status_t zx_futex_requeue_deprecated(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    int32_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count) __LEAF_FN;
+
+extern zx_status_t _zx_futex_requeue_deprecated(
+    const zx_futex_t* wake_ptr,
+    uint32_t wake_count,
+    int32_t current_value,
+    const zx_futex_t* requeue_ptr,
+    uint32_t requeue_count) __LEAF_FN;
+
+extern zx_status_t zx_port_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_port_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_port_queue(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t _zx_port_queue(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t zx_port_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t _zx_port_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_port_packet_t* packet) __LEAF_FN;
+
+extern zx_status_t zx_port_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t source,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t _zx_port_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t source,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t zx_timer_create(
+    uint32_t options,
+    zx_clock_t clock_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_timer_create(
+    uint32_t options,
+    zx_clock_t clock_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_timer_set(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_duration_t slack) __LEAF_FN;
+
+extern zx_status_t _zx_timer_set(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t deadline,
+    zx_duration_t slack) __LEAF_FN;
+
+extern zx_status_t zx_timer_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_timer_cancel(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_vmo_create(
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_create(
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const void* buffer,
+    uint64_t offset,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_get_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t* size) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_get_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t* size) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_set_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_set_size(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_op_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t op,
+    uint64_t offset,
+    uint64_t size,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_op_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t op,
+    uint64_t offset,
+    uint64_t size,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vmo_clone(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_clone(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_set_cache_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t cache_policy) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_set_cache_policy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t cache_policy) __LEAF_FN;
+
+extern zx_status_t zx_vmo_replace_as_executable(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmex,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_replace_as_executable(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmex,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_allocate_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    uint64_t offset,
+    uint64_t size,
+    uint32_t map_flags,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_allocate_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    uint64_t offset,
+    uint64_t size,
+    uint32_t map_flags,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_map_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    uint32_t map_flags,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_map_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    uint32_t map_flags,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_protect_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len,
+    uint32_t prot_flags) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_protect_old(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len,
+    uint32_t prot_flags) __LEAF_FN;
+
+extern zx_status_t zx_vmar_allocate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    zx_vm_option_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_allocate(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_vmar,
+    zx_vm_option_t options,
+    uint64_t offset,
+    uint64_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* child_vmar,
+    zx_vaddr_t* child_addr) __NONNULL((5, 6)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_vmar_map(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_map(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    uint64_t vmar_offset,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t vmo_offset,
+    uint64_t len,
+    zx_vaddr_t* mapped_addr) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_unmap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_unmap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern zx_status_t zx_vmar_protect(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_protect(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_vm_option_t options,
+    zx_vaddr_t addr,
+    uint64_t len) __LEAF_FN;
+
+extern void zx_cprng_draw(
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern void _zx_cprng_draw(
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_cprng_add_entropy(
+    const void* buffer,
+    size_t len) __LEAF_FN;
+
+extern zx_status_t _zx_cprng_add_entropy(
+    const void* buffer,
+    size_t len) __LEAF_FN;
+
+extern zx_status_t zx_fifo_create(
+    size_t elem_count,
+    size_t elem_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((4, 5)) __LEAF_FN;
+
+extern zx_status_t _zx_fifo_create(
+    size_t elem_count,
+    size_t elem_size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out0,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out1) __NONNULL((4, 5)) __LEAF_FN;
+
+extern zx_status_t zx_fifo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t _zx_fifo_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t zx_fifo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    const void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t _zx_fifo_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    size_t elem_size,
+    const void* data,
+    size_t count,
+    size_t* actual_count) __LEAF_FN;
+
+extern zx_status_t zx_profile_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const zx_profile_info_t* profile,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_profile_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const zx_profile_info_t* profile,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_vmar_unmap_handle_close_thread_exit(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmar_handle,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_vmar_unmap_handle_close_thread_exit(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmar_handle,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN;
+
+extern void zx_futex_wake_handle_close_thread_exit(
+    const zx_futex_t* value_ptr,
+    uint32_t count,
+    int32_t new_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN __NO_RETURN;
+
+extern void _zx_futex_wake_handle_close_thread_exit(
+    const zx_futex_t* value_ptr,
+    uint32_t count,
+    int32_t new_value,
+    ZX_SYSCALL_PARAM_ATTR(handle_release) zx_handle_t handle) __LEAF_FN __NO_RETURN;
+
+extern zx_status_t zx_log_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    const void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_log_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    const void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_log_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_log_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t len,
+    void* buffer,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_debuglog_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_debuglog_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_debuglog_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debuglog_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_debuglog_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debuglog_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_ktrace_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* data,
+    uint32_t offset,
+    size_t data_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_ktrace_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    void* data,
+    uint32_t offset,
+    size_t data_size,
+    size_t* actual) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_ktrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t action,
+    uint32_t options,
+    void* ptr) __LEAF_FN;
+
+extern zx_status_t _zx_ktrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t action,
+    uint32_t options,
+    void* ptr) __LEAF_FN;
+
+extern zx_status_t zx_ktrace_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t id,
+    uint32_t arg0,
+    uint32_t arg1) __LEAF_FN;
+
+extern zx_status_t _zx_ktrace_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t id,
+    uint32_t arg0,
+    uint32_t arg1) __LEAF_FN;
+
+extern zx_status_t zx_mtrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    uint32_t action,
+    uint32_t options,
+    void* ptr,
+    size_t ptr_size) __LEAF_FN;
+
+extern zx_status_t _zx_mtrace_control(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    uint32_t action,
+    uint32_t options,
+    void* ptr,
+    size_t ptr_size) __LEAF_FN;
+
+extern zx_status_t zx_debug_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    char* buffer,
+    size_t* buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debug_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    char* buffer,
+    size_t* buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_debug_write(
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debug_write(
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_debug_send_command(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_debug_send_command(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    const char* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t src_obj,
+    uint32_t src_num,
+    uint32_t options,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t src_obj,
+    uint32_t src_num,
+    uint32_t options,
+    zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_bind(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_bind(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t* out_timestamp) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_wait(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_time_t* out_timestamp) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_destroy(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_ack(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_ack(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_trigger(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    zx_time_t timestamp) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_trigger(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    zx_time_t timestamp) __LEAF_FN;
+
+extern zx_status_t zx_interrupt_bind_vcpu(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vcpu,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t _zx_interrupt_bind_vcpu(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vcpu,
+    uint32_t options) __LEAF_FN;
+
+extern zx_status_t zx_ioports_request(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint16_t io_addr,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t _zx_ioports_request(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint16_t io_addr,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t zx_vmo_create_contiguous(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bti,
+    size_t size,
+    uint32_t alignment_log2,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_create_contiguous(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bti,
+    size_t size,
+    uint32_t alignment_log2,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_vmo_create_physical(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    zx_paddr_t paddr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_vmo_create_physical(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    zx_paddr_t paddr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_iommu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t type,
+    const void* desc,
+    size_t desc_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t _zx_iommu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t type,
+    const void* desc,
+    size_t desc_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((5)) __LEAF_FN;
+
+extern zx_status_t zx_bti_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t iommu,
+    uint32_t options,
+    uint64_t bti_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_bti_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t iommu,
+    uint32_t options,
+    uint64_t bti_id,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_bti_pin(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t offset,
+    uint64_t size,
+    zx_paddr_t* addrs,
+    size_t addrs_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((8)) __LEAF_FN;
+
+extern zx_status_t _zx_bti_pin(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint64_t offset,
+    uint64_t size,
+    zx_paddr_t* addrs,
+    size_t addrs_count,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((8)) __LEAF_FN;
+
+extern zx_status_t zx_bti_release_quarantine(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_bti_release_quarantine(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_pmt_unpin(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_pmt_unpin(
+    ZX_SYSCALL_PARAM_ATTR(handle_release_always) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_framebuffer_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t* format,
+    uint32_t* width,
+    uint32_t* height,
+    uint32_t* stride) __NONNULL((2, 3, 4, 5)) __LEAF_FN;
+
+extern zx_status_t _zx_framebuffer_get_info(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t* format,
+    uint32_t* width,
+    uint32_t* height,
+    uint32_t* stride) __NONNULL((2, 3, 4, 5)) __LEAF_FN;
+
+extern zx_status_t zx_framebuffer_set_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint32_t len,
+    uint32_t format,
+    uint32_t width,
+    uint32_t height,
+    uint32_t stride) __LEAF_FN;
+
+extern zx_status_t _zx_framebuffer_set_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t vmo,
+    uint32_t len,
+    uint32_t format,
+    uint32_t width,
+    uint32_t height,
+    uint32_t stride) __LEAF_FN;
+
+extern zx_status_t zx_pci_get_nth_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t index,
+    zx_pcie_device_info_t* out_info,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_get_nth_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t index,
+    zx_pcie_device_info_t* out_info,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t zx_pci_enable_bus_master(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool enable) __LEAF_FN;
+
+extern zx_status_t _zx_pci_enable_bus_master(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool enable) __LEAF_FN;
+
+extern zx_status_t zx_pci_reset_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t _zx_pci_reset_device(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle) __LEAF_FN;
+
+extern zx_status_t zx_pci_config_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t* out_val) __LEAF_FN;
+
+extern zx_status_t _zx_pci_config_read(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t* out_val) __LEAF_FN;
+
+extern zx_status_t zx_pci_config_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t val) __LEAF_FN;
+
+extern zx_status_t _zx_pci_config_write(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint16_t offset,
+    size_t width,
+    uint32_t val) __LEAF_FN;
+
+extern zx_status_t zx_pci_cfg_pio_rw(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint8_t bus,
+    uint8_t dev,
+    uint8_t func,
+    uint8_t offset,
+    uint32_t* val,
+    size_t width,
+    bool write) __LEAF_FN;
+
+extern zx_status_t _zx_pci_cfg_pio_rw(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint8_t bus,
+    uint8_t dev,
+    uint8_t func,
+    uint8_t offset,
+    uint32_t* val,
+    size_t width,
+    bool write) __LEAF_FN;
+
+extern zx_status_t zx_pci_get_bar(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t bar_num,
+    zx_pci_bar_t* out_bar,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_get_bar(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t bar_num,
+    zx_pci_bar_t* out_bar,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_pci_map_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    int32_t which_irq,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_map_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    int32_t which_irq,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out_handle) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_pci_query_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t* out_max_irqs) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_pci_query_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t* out_max_irqs) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_pci_set_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t requested_irq_count) __LEAF_FN;
+
+extern zx_status_t _zx_pci_set_irq_mode(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t mode,
+    uint32_t requested_irq_count) __LEAF_FN;
+
+extern zx_status_t zx_pci_init(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_pci_init_arg_t* init_buf,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t _zx_pci_init(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_pci_init_arg_t* init_buf,
+    uint32_t len) __LEAF_FN;
+
+extern zx_status_t zx_pci_add_subtract_io_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool mmio,
+    uint64_t base,
+    uint64_t len,
+    bool add) __LEAF_FN;
+
+extern zx_status_t _zx_pci_add_subtract_io_range(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    bool mmio,
+    uint64_t base,
+    uint64_t len,
+    bool add) __LEAF_FN;
+
+extern zx_status_t zx_pc_firmware_tables(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_paddr_t* acpi_rsdp,
+    zx_paddr_t* smbios) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t _zx_pc_firmware_tables(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_paddr_t* acpi_rsdp,
+    zx_paddr_t* smbios) __NONNULL((2, 3)) __LEAF_FN;
+
+extern zx_status_t zx_smc_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_smc_parameters_t* parameters,
+    zx_smc_result_t* out_smc_result) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t _zx_smc_call(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    const zx_smc_parameters_t* parameters,
+    zx_smc_result_t* out_smc_result) __NONNULL((3)) __LEAF_FN;
+
+extern zx_status_t zx_resource_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_rsrc,
+    uint32_t options,
+    uint64_t base,
+    size_t size,
+    const char* name,
+    size_t name_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* resource_out) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t _zx_resource_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t parent_rsrc,
+    uint32_t options,
+    uint64_t base,
+    size_t size,
+    const char* name,
+    size_t name_size,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* resource_out) __NONNULL((7)) __LEAF_FN;
+
+extern zx_status_t zx_guest_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* guest_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t _zx_guest_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* guest_handle,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* vmar_handle) __NONNULL((3, 4)) __LEAF_FN;
+
+extern zx_status_t zx_guest_set_trap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t _zx_guest_set_trap(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    zx_vaddr_t addr,
+    size_t size,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t guest,
+    uint32_t options,
+    zx_vaddr_t entry,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_create(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t guest,
+    uint32_t options,
+    zx_vaddr_t entry,
+    ZX_SYSCALL_PARAM_ATTR(handle_acquire) zx_handle_t* out) __NONNULL((4)) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_resume(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_port_packet_t* packet) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_resume(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    zx_port_packet_t* packet) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t vector) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_interrupt(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t vector) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_read_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_vcpu_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_vcpu_write_state(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t handle,
+    uint32_t kind,
+    const void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_system_mexec(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t kernel,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bootimage) __LEAF_FN;
+
+extern zx_status_t _zx_system_mexec(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t kernel,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t bootimage) __LEAF_FN;
+
+extern zx_status_t zx_system_mexec_payload_get(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t _zx_system_mexec_payload_get(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    void* buffer,
+    size_t buffer_size) __LEAF_FN;
+
+extern zx_status_t zx_system_powerctl(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t cmd,
+    const zx_system_powerctl_arg_t* arg) __LEAF_FN;
+
+extern zx_status_t _zx_system_powerctl(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t resource,
+    uint32_t cmd,
+    const zx_system_powerctl_arg_t* arg) __LEAF_FN;
+
+extern zx_status_t zx_pager_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(pager) zx_handle_t* out_pager) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t _zx_pager_create(
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(pager) zx_handle_t* out_pager) __NONNULL((2)) __LEAF_FN;
+
+extern zx_status_t zx_pager_create_vmo(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t pager,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(out_pager_vmo) zx_handle_t* out_pager_vmo) __NONNULL((6)) __LEAF_FN;
+
+extern zx_status_t _zx_pager_create_vmo(
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t pager,
+    ZX_SYSCALL_PARAM_ATTR(handle_use) zx_handle_t port,
+    uint64_t key,
+    uint64_t size,
+    uint32_t options,
+    ZX_SYSCALL_PARAM_ATTR(out_pager_vmo) zx_handle_t* out_pager_vmo) __NONNULL((6)) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_0(
+    void) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_0(
+    void) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_1(
+    int a) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_1(
+    int a) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_2(
+    int a,
+    int b) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_2(
+    int a,
+    int b) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_3(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_3(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_4(
+    int a,
+    int b,
+    int c,
+    int d) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_4(
+    int a,
+    int b,
+    int c,
+    int d) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_5(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_5(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_6(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_6(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_7(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_7(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_8(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g,
+    int h) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_8(
+    int a,
+    int b,
+    int c,
+    int d,
+    int e,
+    int f,
+    int g,
+    int h) __LEAF_FN;
+
+extern zx_status_t zx_syscall_test_wrapper(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+extern zx_status_t _zx_syscall_test_wrapper(
+    int a,
+    int b,
+    int c) __LEAF_FN;
+
+
diff --git a/arch/x64/sysroot/include/zircon/syscalls/exception.h b/arch/x64/sysroot/include/zircon/syscalls/exception.h
new file mode 100644
index 0000000..4ddf2fb
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/exception.h
@@ -0,0 +1,135 @@
+// 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 ZIRCON_SYSCALLS_EXCEPTION_H_
+#define ZIRCON_SYSCALLS_EXCEPTION_H_
+
+#include <zircon/compiler.h>
+#include <zircon/syscalls/port.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// ask clang format not to mess up the indentation:
+// clang-format off
+
+// This bit is set for synthetic exceptions to distinguish them from
+// architectural exceptions.
+// Note: Port packet types provide 8 bits to distinguish the exception type.
+// See zircon/port.h.
+#define ZX_EXCP_SYNTH ((uint8_t)0x80)
+
+// The kind of an exception.
+// Exception types are a subset of port packet types. See zircon/port.h.
+
+// These are architectural exceptions.
+// Depending on the exception, further information can be found in
+// |report.context.arch|.
+
+// General exception not covered by another value.
+#define ZX_EXCP_GENERAL ZX_PKT_TYPE_EXCEPTION(0)
+#define ZX_EXCP_FATAL_PAGE_FAULT ZX_PKT_TYPE_EXCEPTION(1)
+#define ZX_EXCP_UNDEFINED_INSTRUCTION ZX_PKT_TYPE_EXCEPTION(2)
+#define ZX_EXCP_SW_BREAKPOINT ZX_PKT_TYPE_EXCEPTION(3)
+#define ZX_EXCP_HW_BREAKPOINT ZX_PKT_TYPE_EXCEPTION(4)
+#define ZX_EXCP_UNALIGNED_ACCESS ZX_PKT_TYPE_EXCEPTION(5)
+
+// Synthetic exceptions.
+
+// A thread is starting.
+// This exception is sent to debuggers only (ZX_EXCEPTION_PORT_TYPE_DEBUGGER).
+// The thread is paused until it is resumed by the debugger
+// with zx_task_resume_from_exception.
+#define ZX_EXCP_THREAD_STARTING ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 0)
+
+// A thread is exiting.
+// This exception is sent to debuggers only (ZX_EXCEPTION_PORT_TYPE_DEBUGGER).
+// This exception is different from ZX_EXCP_GONE in that a debugger can
+// still examine thread state.
+// The thread is paused until it is resumed by the debugger
+// with zx_task_resume_from_exception.
+#define ZX_EXCP_THREAD_EXITING ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 1)
+
+// 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
+// invoked the syscall may be resumed with zx_task_resume_from_exception.
+#define ZX_EXCP_POLICY_ERROR ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 2)
+
+// A process is starting.
+// This exception is sent to job debuggers only
+// (ZX_EXCEPTION_PORT_TYPE_JOB_DEBUGGER).
+// The initial thread is paused until it is resumed by the debugger with
+// zx_task_resume_from_exception.
+#define ZX_EXCP_PROCESS_STARTING ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH | 3)
+
+typedef uint32_t zx_excp_type_t;
+
+// Assuming |excp| is an exception type, return non-zero if it is an
+// architectural exception.
+#define ZX_EXCP_IS_ARCH(excp) \
+  (((excp) & (ZX_PKT_TYPE_EXCEPTION(ZX_EXCP_SYNTH) & ~ZX_PKT_TYPE_MASK)) == 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;
+    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;
+            zx_arm64_exc_data_t  arm_64;
+        } 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;
+
+// Options for zx_task_resume_from_exception()
+#define ZX_RESUME_TRY_NEXT ((uint32_t)2)
+// Indicates that instead of resuming from the faulting instruction we instead
+// let the next exception handler in the search order, if any, process the
+// exception. If there are no more then the entire process is killed.
+
+// Options for zx_task_bind_exception_port.
+#define ZX_EXCEPTION_PORT_DEBUGGER ((uint32_t)1)
+// When binding an exception port to a process, set the process's debugger
+// exception port.
+
+// The type of exception port a thread may be waiting for a response from.
+// These values are reported in zx_info_thread_t.wait_exception_port_type.
+#define ZX_EXCEPTION_PORT_TYPE_NONE         ((uint32_t)0u)
+#define ZX_EXCEPTION_PORT_TYPE_DEBUGGER     ((uint32_t)1u)
+#define ZX_EXCEPTION_PORT_TYPE_THREAD       ((uint32_t)2u)
+#define ZX_EXCEPTION_PORT_TYPE_PROCESS      ((uint32_t)3u)
+#define ZX_EXCEPTION_PORT_TYPE_JOB          ((uint32_t)4u)
+#define ZX_EXCEPTION_PORT_TYPE_JOB_DEBUGGER ((uint32_t)5u)
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_EXCEPTION_H_
diff --git a/arch/x64/sysroot/include/zircon/syscalls/hypervisor.h b/arch/x64/sysroot/include/zircon/syscalls/hypervisor.h
new file mode 100644
index 0000000..a62de92
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/hypervisor.h
@@ -0,0 +1,67 @@
+// 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.
+
+#pragma once
+
+#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;
+#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;
+    union {
+        uint8_t u8;
+        uint16_t u16;
+        uint32_t u32;
+        uint8_t data[4];
+    };
+} zx_vcpu_io_t;
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/syscalls/iommu.h b/arch/x64/sysroot/include/zircon/syscalls/iommu.h
new file mode 100644
index 0000000..e567175
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/iommu.h
@@ -0,0 +1,95 @@
+// 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.
+
+#pragma once
+
+#include <assert.h>
+#include <zircon/compiler.h>
+#include <stdbool.h>
+#include <stdint.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 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
diff --git a/arch/x64/sysroot/include/zircon/syscalls/log.h b/arch/x64/sysroot/include/zircon/syscalls/log.h
new file mode 100644
index 0000000..e89d9c5
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/log.h
@@ -0,0 +1,55 @@
+// 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>
+
+__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
diff --git a/arch/x64/sysroot/include/zircon/syscalls/object.h b/arch/x64/sysroot/include/zircon/syscalls/object.h
new file mode 100644
index 0000000..33e2e90
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/object.h
@@ -0,0 +1,459 @@
+// 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 ZIRCON_SYSCALLS_OBJECT_H_
+#define 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]
+
+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)
+
+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;
+} zx_info_handle_basic_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[64];
+} zx_info_process_handle_stats_t;
+
+typedef struct zx_info_process {
+    // The process's return code; only valid if |exited| is true.
+    // Guaranteed to be non-zero if the process was killed by |zx_task_kill|.
+    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;
+} zx_info_process_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 to be handled by the
+    // specified port.
+    // The value is one of ZX_EXCEPTION_PORT_TYPE_*.
+    uint32_t wait_exception_port_type;
+} zx_info_thread_t;
+
+typedef struct zx_info_thread_stats {
+    // Total accumulated running time of the thread.
+    zx_duration_t total_runtime;
+} 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;
+} zx_info_bti_t;
+
+typedef struct zx_info_socket {
+    // The options passed to zx_socket_create().
+    uint32_t options;
+
+    // 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;
+    // 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;
+    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 a clone, 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)
+
+// 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;
+
+    // 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 creation options. This is a bitmask of
+    // kResizable    = (1u << 0);
+    // kContiguous   = (1u << 1);
+    uint32_t create_options;
+
+    // VMO mapping cache policy. One of ZX_CACHE_POLICY_*
+    uint32_t cache_policy;
+} zx_info_vmo_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;
+
+#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)
+
+// 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
+
+// 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)
+
+// 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)
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_OBJECT_H_
diff --git a/arch/x64/sysroot/include/zircon/syscalls/pci.h b/arch/x64/sysroot/include/zircon/syscalls/pci.h
new file mode 100644
index 0000000..b97f1c3
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/pci.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.
+
+#pragma once
+
+#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;
+        zx_handle_t handle;
+    };
+} 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;
+} 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];
+
+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;
+    } irqs[64];
+
+    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;
+    } 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
diff --git a/arch/x64/sysroot/include/zircon/syscalls/policy.h b/arch/x64/sysroot/include/zircon/syscalls/policy.h
new file mode 100644
index 0000000..f7061ce
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/policy.h
@@ -0,0 +1,55 @@
+// 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.
+
+#pragma once
+
+#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                    0u
+
+// Input structure to use with ZX_JOB_POL_BASIC.
+typedef struct zx_policy_basic {
+    uint32_t condition;
+    uint32_t policy;
+} 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
+#ifdef _KERNEL
+#define ZX_POL_MAX                          13u
+#endif
+
+// Policy actions.
+// ZX_POL_ACTION_ALLOW and ZX_POL_ACTION_DENY can be ORed with ZX_POL_ACTION_EXCEPTION.
+// ZX_POL_ACTION_KILL implies ZX_POL_ACTION_DENY.
+#define ZX_POL_ACTION_ALLOW                 0u
+#define ZX_POL_ACTION_DENY                  1u
+#define ZX_POL_ACTION_EXCEPTION             2u
+#define ZX_POL_ACTION_KILL                  5u
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/syscalls/port.h b/arch/x64/sysroot/include/zircon/syscalls/port.h
new file mode 100644
index 0000000..10bc39b
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/port.h
@@ -0,0 +1,152 @@
+// 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 ZIRCON_SYSCALLS_PORT_H_
+#define 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_REPEATING     ((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)
+#define ZX_PKT_TYPE_SIGNAL_REP      ((uint8_t)0x02u)
+#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_EXCEPTION(n)    ((uint32_t)(0x08u | (((n) & 0xFFu) << 8)))
+
+// 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_SIGNAL_REP(type)  ((type) == ZX_PKT_TYPE_SIGNAL_REP)
+#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_EXCEPTION(type)   (((type) & ZX_PKT_TYPE_MASK) == ZX_PKT_TYPE_EXCEPTION(0))
+
+// zx_packet_guest_vcpu_t::type
+#define ZX_PKT_GUEST_VCPU_INTERRUPT  ((uint8_t)0)
+#define ZX_PKT_GUEST_VCPU_STARTUP    ((uint8_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 and ZX_PKT_TYPE_SIGNAL_REP.
+typedef struct zx_packet_signal {
+    zx_signals_t trigger;
+    zx_signals_t observed;
+    uint64_t count;
+    uint64_t reserved0;
+    uint64_t reserved1;
+} zx_packet_signal_t;
+
+typedef struct zx_packet_exception {
+    uint64_t pid;
+    uint64_t tid;
+    uint64_t reserved0;
+    uint64_t reserved1;
+} zx_packet_exception_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;
+    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];
+    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 {
+        uint8_t u8;
+        uint16_t u16;
+        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;
+        } interrupt;
+        struct {
+            uint64_t id;
+            zx_gpaddr_t entry;
+        } startup;
+    };
+    uint8_t type;
+    uint64_t reserved;
+} zx_packet_guest_vcpu_t;
+
+typedef struct zx_packet_interrupt {
+    zx_time_t timestamp;
+} zx_packet_interrupt_t;
+
+typedef struct zx_port_packet {
+    uint64_t key;
+    uint32_t type;
+    int32_t status;
+    union {
+        zx_packet_user_t user;
+        zx_packet_signal_t signal;
+        zx_packet_exception_t exception;
+        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_port_packet_t;
+
+__END_CDECLS
+
+#endif // ZIRCON_SYSCALLS_PORT_H_
diff --git a/arch/x64/sysroot/include/zircon/syscalls/profile.h b/arch/x64/sysroot/include/zircon/syscalls/profile.h
new file mode 100644
index 0000000..10ed499
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/profile.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.
+
+#pragma once
+
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// ask clang format not to mess up the indentation:
+// clang-format off
+
+#define ZX_PROFILE_INFO_SCHEDULER   1
+
+typedef struct zx_profile_scheduler {
+    int32_t priority;
+    uint32_t boost;
+    uint32_t deboost;
+    uint32_t quantum;
+} zx_profile_scheduler_t;
+
+#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
+
+typedef struct zx_profile_info {
+    uint32_t type;                  // one of ZX_PROFILE_INFO_
+    union {
+        zx_profile_scheduler_t scheduler;
+    };
+} zx_profile_info_t;
+
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/syscalls/resource.h b/arch/x64/sysroot/include/zircon/syscalls/resource.h
new file mode 100644
index 0000000..6defbda
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/resource.h
@@ -0,0 +1,34 @@
+// 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 <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)
diff --git a/arch/x64/sysroot/include/zircon/syscalls/smc.h b/arch/x64/sysroot/include/zircon/syscalls/smc.h
new file mode 100644
index 0000000..5c8f9ba
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/smc.h
@@ -0,0 +1,38 @@
+// 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.
+
+#pragma once
+
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+#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;
+    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;
+} zx_smc_parameters_t;
+
+typedef struct zx_smc_result {
+    uint64_t arg0;
+    uint64_t arg1;
+    uint64_t arg2;
+    uint64_t arg3;
+} zx_smc_result_t;
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/syscalls/system.h b/arch/x64/sysroot/include/zircon/syscalls/system.h
new file mode 100644
index 0000000..c58de1d
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/system.h
@@ -0,0 +1,37 @@
+// 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.
+
+#pragma once
+
+#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 {
+            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;
+    };
+} zx_system_powerctl_arg_t;
+
+__END_CDECLS
diff --git a/arch/x64/sysroot/include/zircon/syscalls/types.h b/arch/x64/sysroot/include/zircon/syscalls/types.h
new file mode 100644
index 0000000..a5a69c8
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/syscalls/types.h
@@ -0,0 +1,22 @@
+// 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/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
diff --git a/arch/x64/sysroot/include/zircon/threads.h b/arch/x64/sysroot/include/zircon/threads.h
new file mode 100644
index 0000000..937a9f9
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/threads.h
@@ -0,0 +1,37 @@
+// 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.
+
+#pragma once
+
+#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
diff --git a/arch/x64/sysroot/include/zircon/time.h b/arch/x64/sysroot/include/zircon/time.h
new file mode 100644
index 0000000..a075d89
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/time.h
@@ -0,0 +1,96 @@
+// Copyright 2018 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
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+// These functions perform overflow-safe time arithmetic, 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.
+//
+// The naming scheme is zx_<first argument>_<operation>_<second argument>.
+//
+// TODO(maniscalco): Consider expanding the set of operations to include division, modulo, unit
+// conversion, 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;
+}
diff --git a/arch/x64/sysroot/include/zircon/tls.h b/arch/x64/sysroot/include/zircon/tls.h
new file mode 100644
index 0000000..acacef1
--- /dev/null
+++ b/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 ZIRCON_TLS_
+#define 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 // ZIRCON_TLS_
diff --git a/arch/x64/sysroot/include/zircon/types.h b/arch/x64/sysroot/include/zircon/types.h
new file mode 100644
index 0000000..6f93626
--- /dev/null
+++ b/arch/x64/sysroot/include/zircon/types.h
@@ -0,0 +1,395 @@
+// 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 ZIRCON_TYPES_H_
+#define 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>
+
+#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)
+
+// See errors.h for the values zx_status_t can take.
+typedef int32_t zx_status_t;
+
+// 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 uint64_t zx_ticks_t;
+#define ZX_TIME_INFINITE INT64_MAX
+#define ZX_TIME_INFINITE_PAST INT64_MIN
+#define ZX_NSEC(n) ((zx_duration_t)(1LL * (n)))
+#define ZX_USEC(n) ((zx_duration_t)(1000LL * (n)))
+#define ZX_MSEC(n) ((zx_duration_t)(1000000LL * (n)))
+#define ZX_SEC(n)  ((zx_duration_t)(1000000000LL * (n)))
+#define ZX_MIN(n)  (ZX_SEC(n) * 60LL)
+#define ZX_HOUR(n) (ZX_MIN(n) * 60LL)
+
+// 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)
+
+// Cancelation (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
+
+// 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_CONTROL_READABLE    __ZX_OBJECT_SIGNAL_6
+#define ZX_SOCKET_CONTROL_WRITABLE    __ZX_OBJECT_SIGNAL_7
+#define ZX_SOCKET_ACCEPT              __ZX_OBJECT_SIGNAL_8
+#define ZX_SOCKET_SHARE               __ZX_OBJECT_SIGNAL_9
+#define ZX_SOCKET_READ_THRESHOLD      __ZX_OBJECT_SIGNAL_10
+#define ZX_SOCKET_WRITE_THRESHOLD     __ZX_OBJECT_SIGNAL_11
+
+// Deprecated
+#define ZX_SOCKET_READ_DISABLED       ZX_SOCKET_PEER_WRITE_DISABLED
+
+// 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_NO_PROCESSES         __ZX_OBJECT_SIGNALED
+#define ZX_JOB_NO_JOBS              __ZX_OBJECT_SIGNAL_4
+
+// 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 objets.
+typedef uint64_t zx_koid_t;
+#define ZX_KOID_INVALID ((uint64_t) 0)
+#define ZX_KOID_KERNEL  ((uint64_t) 1)
+
+// 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;
+
+// Maximum number of wait items allowed for zx_object_wait_many()
+// TODO(ZX-1349) Re-lower this.
+#define ZX_WAIT_MANY_MAX_ITEMS ((size_t)16)
+
+// 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_NON_RESIZABLE             ((uint32_t)1u)
+
+// 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)
+
+// VM Object clone flags
+#define ZX_VMO_CLONE_COPY_ON_WRITE        ((uint32_t)1u << 0)
+#define ZX_VMO_CLONE_NON_RESIZEABLE       ((uint32_t)1u << 1)
+
+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))
+
+
+// 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;
+
+// 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 bind 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)
+
+// 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)
+
+// 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_HAS_CONTROL               ((uint32_t)1u << 1)
+#define ZX_SOCKET_HAS_ACCEPT                ((uint32_t)1u << 2)
+#define ZX_SOCKET_CREATE_MASK               (ZX_SOCKET_DATAGRAM | ZX_SOCKET_HAS_CONTROL | ZX_SOCKET_HAS_ACCEPT)
+
+// These can be passed to zx_socket_read() and zx_socket_write().
+#define ZX_SOCKET_CONTROL                   ((uint32_t)1u << 2)
+
+// 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)
+
+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_LAST            ((zx_obj_type_t)29u)
+
+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;
+
+// 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)
+
+#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
+
+__END_CDECLS
+
+#endif // ZIRCON_TYPES_H_
diff --git a/arch/x64/sysroot/lib/Scrt1.o b/arch/x64/sysroot/lib/Scrt1.o
new file mode 100644
index 0000000..ca35323
--- /dev/null
+++ b/arch/x64/sysroot/lib/Scrt1.o
Binary files differ
diff --git a/arch/x64/sysroot/lib/libc.so b/arch/x64/sysroot/lib/libc.so
new file mode 100755
index 0000000..4989bef
--- /dev/null
+++ b/arch/x64/sysroot/lib/libc.so
Binary files differ
diff --git a/arch/x64/sysroot/lib/libdl.so b/arch/x64/sysroot/lib/libdl.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/x64/sysroot/lib/libm.so b/arch/x64/sysroot/lib/libm.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/x64/sysroot/lib/libpthread.so b/arch/x64/sysroot/lib/libpthread.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/x64/sysroot/lib/librt.so b/arch/x64/sysroot/lib/librt.so
new file mode 100644
index 0000000..f2072c3
--- /dev/null
+++ b/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/arch/x64/sysroot/lib/libzircon.so b/arch/x64/sysroot/lib/libzircon.so
new file mode 100755
index 0000000..49b147a
--- /dev/null
+++ b/arch/x64/sysroot/lib/libzircon.so
Binary files differ
diff --git a/docs/bootserver.md b/docs/bootserver.md
new file mode 100644
index 0000000..a61d09b
--- /dev/null
+++ b/docs/bootserver.md
@@ -0,0 +1,22 @@
+# 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
+
+To pave and boot on an `x64` target, run:
+
+```
+bootserver --efi "<IMAGE_PATH>/local.esp.blk" --fvm "<IMAGE_PATH>/fvm.sparse.blk" --kernc "<IMAGE_PATH>/zircon.vboot" --zircona "<IMAGE_PATH>/fuchsia.zbi" "<IMAGE_PATH>/fuchsia.zbi" -1
+```
+
+## arm64
+
+To pave and boot on an `arm64` target, run:
+
+```
+bootserver --fvm "<IMAGE_PATH>/obj/build/images/fvm.sparse.blk" --zircona "<IMAGE_PATH>/fuchsia.zbi" --zirconb "<IMAGE_PATH>/fuchsia.zbi" -1
+```
diff --git a/docs/low_level.json b/docs/low_level.json
new file mode 100644
index 0000000..55793d6
--- /dev/null
+++ b/docs/low_level.json
@@ -0,0 +1,10 @@
+{
+  "docs": [
+    "docs/ssh.md", 
+    "docs/bootserver.md", 
+    "docs/packages.md"
+  ], 
+  "name": "low_level", 
+  "root": "docs", 
+  "type": "documentation"
+}
\ No newline at end of file
diff --git a/docs/metadata_schemas.json b/docs/metadata_schemas.json
new file mode 100644
index 0000000..7eaf414
--- /dev/null
+++ b/docs/metadata_schemas.json
@@ -0,0 +1,18 @@
+{
+  "docs": [
+    "meta/schemas/cc_prebuilt_library.json", 
+    "meta/schemas/cc_source_library.json", 
+    "meta/schemas/common.json", 
+    "meta/schemas/dart_library.json", 
+    "meta/schemas/documentation.json", 
+    "meta/schemas/fidl_library.json", 
+    "meta/schemas/host_tool.json", 
+    "meta/schemas/image.json", 
+    "meta/schemas/loadable_module.json", 
+    "meta/schemas/manifest.json", 
+    "meta/schemas/sysroot.json"
+  ], 
+  "name": "metadata_schemas", 
+  "root": "docs", 
+  "type": "documentation"
+}
\ No newline at end of file
diff --git a/docs/packages.md b/docs/packages.md
new file mode 100644
index 0000000..eece00a
--- /dev/null
+++ b/docs/packages.md
@@ -0,0 +1,65 @@
+# Packages
+
+A package is the unit of installation on a Fuchsia system.
+
+## Anatomy
+
+_To be added..._
+
+## Building a package
+
+The majority of this process relies on a tool called `pm` which is available
+under `//tools`.
+This document describes the various steps to generate a package. For more
+details about each step, see `pm`'s help messages.
+
+The initial step is to create a manifest file `$MANIFEST_FILE` describing the
+contents of the package.
+The manifest is a mere list of lines of the form `destination=source`, where
+`source` is the path to the file on the host machine and `destination` the
+location of that file in the final package.
+
+The manifest must include at least one line for the package identity file:
+```
+meta/package=path/to/generated/package.json
+```
+This identity file should contain the following data:
+```
+{
+  "name": "<package name",
+  "version": "<package version>"
+}
+```
+That file can be created using the `pm init` command.
+
+From this point on, we are going to use `$PACKAGE_DIR` to denote a staging dir
+where the package is going to be built.
+
+First, we need to initialize the package with:
+```
+pm -o $PACKAGE_DIR -n $PACKAGE_NAME init
+```
+
+In order to create the package, a signing key is required. You may provide your
+own key or generate one at `$SIGNING_KEY` with:
+```
+pm -o $PACKAGE_DIR -k $SIGNING_KEY genkey
+```
+_TODO: add more details about signing keys, possibly in pm's help_
+
+The next step is to generate an archive with the package's metadata:
+```
+pm -o $PACKAGE_DIR -k $SIGNING_KEY -m $MANIFEST_FILE build
+```
+This will create the metadata archive at `$PACKAGE_DIR/meta.far`.
+
+Finally, we put it all together to generate the package itself:
+```
+pm -o $PACKAGE_DIR -k $SIGNING_KEY -m $MANIFEST_FILE archive
+```
+This will create the package archive at `$PACKAGE_DIR/$PACKAGE_NAME-0.far`.
+Note that this step needs to be re-run if the contents of the package change.
+
+## Deploying a package
+
+_To be added..._
diff --git a/docs/ssh.md b/docs/ssh.md
new file mode 100644
index 0000000..b884d2a
--- /dev/null
+++ b/docs/ssh.md
@@ -0,0 +1,3 @@
+# SSH
+
+_Content to be added soon!_
diff --git a/fidl/fuchsia.bluetooth.gatt/client.fidl b/fidl/fuchsia.bluetooth.gatt/client.fidl
new file mode 100644
index 0000000..fad056b
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.gatt/client.fidl
@@ -0,0 +1,120 @@
+// 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 RemoteService {
+  // Returns the characteristics and characteristic descriptors that belong to
+  // this service.
+  1: 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.
+  2: ReadCharacteristic(uint64 id) -> (fuchsia.bluetooth.Status status, vector<uint8> 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.
+  3: ReadLongCharacteristic(uint64 id, uint16 offset, uint16 max_bytes) -> (fuchsia.bluetooth.Status status, vector<uint8> value);
+
+  // Writes |value| to the characteristic with |id|. The ATT protocol method is
+  // selected based on the input parameters and properties of the
+  // characteristic:
+  //
+  //   a. If |value| fits within a single ATT request (based on the current MTU)
+  //      and |offset| is 0, the "Write Characteristic Value" procedure will be
+  //      used.
+  //   b. If |value| is value cannot fit within a single ATT request or a
+  //      non-zero |offset| is requested, the "Write Long Characteristic Value"
+  //      procedure will be used.
+  //   c. If the characteristic does not claim to support the selected
+  //      procedure, the request will fail with ErrorCode.NotSupported.
+  4: WriteCharacteristic(uint64 id, uint16 offset, vector<uint8> value) -> (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.
+  5: WriteCharacteristicWithoutResponse(uint64 id, vector<uint8> 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.
+  6: ReadDescriptor(uint64 id) -> (fuchsia.bluetooth.Status status, vector<uint8> 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.
+  7: ReadLongDescriptor(uint64 id, uint16 offset, uint16 max_bytes) -> (fuchsia.bluetooth.Status status, vector<uint8> 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).
+  8: WriteDescriptor(uint64 id, vector<uint8> 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.
+  9: NotifyCharacteristic(uint64 id, bool enable) -> (fuchsia.bluetooth.Status status);
+
+  // Events:
+  // Called when a characteristic value notification or indication is received.
+  1001: -> OnCharacteristicValueUpdated(uint64 id, vector<uint8> value);
+};
+
+interface 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().
+  1: ListServices(vector<string>? uuids) -> (fuchsia.bluetooth.Status status, vector<ServiceInfo> services);
+
+  // Connects the RemoteService with the given identifier.
+  2: ConnectToService(uint64 id, request<RemoteService> service);
+};
diff --git a/fidl/fuchsia.bluetooth.gatt/meta.json b/fidl/fuchsia.bluetooth.gatt/meta.json
new file mode 100644
index 0000000..03eebd2
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.gatt/meta.json
@@ -0,0 +1,18 @@
+{
+  "deps": [
+    "fuchsia.bluetooth"
+  ], 
+  "files": [
+    "fidl/fuchsia.bluetooth.gatt/client.fidl", 
+    "fidl/fuchsia.bluetooth.gatt/server.fidl", 
+    "fidl/fuchsia.bluetooth.gatt/types.fidl"
+  ], 
+  "name": "fuchsia.bluetooth.gatt", 
+  "root": "fidl/fuchsia.bluetooth.gatt", 
+  "sources": [
+    "fidl/fuchsia.bluetooth.gatt/client.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/fidl/fuchsia.bluetooth.gatt/server.fidl b/fidl/fuchsia.bluetooth.gatt/server.fidl
new file mode 100644
index 0000000..db0599e
--- /dev/null
+++ b/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.
+interface 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|.
+  1: 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.
+  2: OnReadValue(uint64 id, int32 offset) -> (vector<uint8>? value, ErrorCode status);
+
+  // Called when a remote device issues a request to write the value of the
+  // characteristic or descriptor with the given identifier.
+  3: OnWriteValue(uint64 id, uint16 offset, vector<uint8> 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.
+  4: OnWriteWithoutResponse(uint64 id, uint16 offset, vector<uint8> value);
+};
+
+// Interface for communicating with a published service.
+interface LocalService {
+  // Removes the service that this interface instance corresponds to. Does
+  // nothing if the service is already removed.
+  1: 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.
+  2: NotifyValue(uint64 characteristic_id, string peer_id, vector<uint8> value, bool confirm);
+};
+
+[Discoverable]
+interface 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.
+  1: PublishService(ServiceInfo info, LocalServiceDelegate delegate, request<LocalService> service) -> (fuchsia.bluetooth.Status status);
+};
diff --git a/fidl/fuchsia.bluetooth.gatt/types.fidl b/fidl/fuchsia.bluetooth.gatt/types.fidl
new file mode 100644
index 0000000..894e956
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.gatt/types.fidl
@@ -0,0 +1,135 @@
+// 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;
+};
diff --git a/fidl/fuchsia.bluetooth.le/central.fidl b/fidl/fuchsia.bluetooth.le/central.fidl
new file mode 100644
index 0000000..e0756ea
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.le/central.fidl
@@ -0,0 +1,59 @@
+// 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]
+interface 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).
+  1: 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.
+  2: 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|.
+  3: StartScan(ScanFilter? filter) -> (fuchsia.bluetooth.Status status);
+
+  // Terminate a previously started scan session.
+  4: 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.
+  5: ConnectPeripheral(string identifier, request<fuchsia.bluetooth.gatt.Client> gatt_client) -> (fuchsia.bluetooth.Status status);
+
+  // Disconnects this Central's connection to the peripheral with the given identifier.
+  6: 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.
+  101: -> 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.
+  102: -> OnDeviceDiscovered(RemoteDevice device);
+
+  // Called when this Central's connection to a peripheral with the given identifier is terminated.
+  103: -> OnPeripheralDisconnected(string identifier);
+};
diff --git a/fidl/fuchsia.bluetooth.le/meta.json b/fidl/fuchsia.bluetooth.le/meta.json
new file mode 100644
index 0000000..db45f8e
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.le/meta.json
@@ -0,0 +1,19 @@
+{
+  "deps": [
+    "fuchsia.bluetooth", 
+    "fuchsia.bluetooth.gatt"
+  ], 
+  "files": [
+    "fidl/fuchsia.bluetooth.le/central.fidl", 
+    "fidl/fuchsia.bluetooth.le/peripheral.fidl", 
+    "fidl/fuchsia.bluetooth.le/types.fidl"
+  ], 
+  "name": "fuchsia.bluetooth.le", 
+  "root": "fidl/fuchsia.bluetooth.le", 
+  "sources": [
+    "fidl/fuchsia.bluetooth.le/central.fidl", 
+    "fidl/fuchsia.bluetooth.le/peripheral.fidl", 
+    "fidl/fuchsia.bluetooth.le/types.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.bluetooth.le/peripheral.fidl b/fidl/fuchsia.bluetooth.le/peripheral.fidl
new file mode 100644
index 0000000..0653825
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.le/peripheral.fidl
@@ -0,0 +1,56 @@
+// 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;
+
+[Discoverable]
+interface Peripheral {
+    // Starts sending advertisements based on the given parameters.
+    //   - |advertising_data|: The advertising data that should be included in the payload.
+    //   - |scan_result|: The scan result that will be returned when the advertisement is
+    //                    scanned.  Setting this will mark the advertisement set as scannable.
+    //   - |connectable|: when true, this advertisement will be marked as connectable.
+    //                 NOTE: connections can be made to a GATT server even if this is not set.
+    //   - |interval_ms|: The requested interval to advertise this set at in milliseconds.
+    //                    minimum 20, maximum 10,000,000 (almost 3 hours). A reasonable
+    //                    default is 1 second (1000).
+    //   - |anonymous|: if true, the address of this device will not be included
+    //
+    // If the |tx_power_level| is set in either AdvertisingData, it will be replaced with
+    // the actual TX Power level reported by the adapter, or included in the extended header
+    // of the Advertising PDU to save advertising space.
+    //
+    // If |scan_result| and |advertising_data| are both set, legacy advertising will be used,
+    // which limits the size of the advertising data.
+    //
+    // This request will fail if:
+    //   - The |service_uuids| field of |advertising_data| contains a UUID that does not match
+    //     a GATT service that was previously registered by this application;
+    //   - If the provided advertising data cannot fit within the advertising payload MTU that
+    //     is supported on the current platform and parameters.
+    //   - If |anonymous| advertising is requested but the controller cannot support it.
+    1: StartAdvertising(AdvertisingData advertising_data, AdvertisingData? scan_result,
+                        bool connectable, uint32 interval_ms, bool anonymous)
+           -> (fuchsia.bluetooth.Status status, string? advertisement_id);
+
+    // Stop a an advertising session that was previously started by this application.
+    2: StopAdvertising(string advertisement_id) -> (fuchsia.bluetooth.Status status);
+
+    // Called when a remote central device has connected to a connectable advertisement.
+    // Provides a GATT client handle which can be used to interact with GATT service
+    // on the central device.
+    //
+    // When this is called, the Advertisement will have stopped, and StartAdvertising
+    // should be called again to re-start advertising when the peripheral can accept
+    // another connection.
+    //
+    // Note: Centrals can connect to the local device and interact with the GATT server
+    // from an application without Peripheral.StartAdvertising() being called.
+    101: -> OnCentralConnected(string advertisement_id, RemoteDevice central);
+
+    // Called when a remote central previously connected to this application is disconnected.
+    102: -> OnCentralDisconnected(string device_id);
+};
diff --git a/fidl/fuchsia.bluetooth.le/types.fidl b/fidl/fuchsia.bluetooth.le/types.fidl
new file mode 100644
index 0000000..88f1dd1
--- /dev/null
+++ b/fidl/fuchsia.bluetooth.le/types.fidl
@@ -0,0 +1,96 @@
+// 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;
+using fuchsia.bluetooth.gatt;
+
+struct ServiceDataEntry {
+  string uuid;
+  vector<uint8> data;
+};
+
+struct ManufacturerSpecificDataEntry {
+  uint16 company_id;
+  vector<uint8> data;
+};
+
+// Represents advertising and scan response data advertised by a broadcaster or peripheral.
+struct AdvertisingData {
+  // 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.
+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.
+  AdvertisingData? 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.
+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/fidl/fuchsia.bluetooth/meta.json b/fidl/fuchsia.bluetooth/meta.json
new file mode 100644
index 0000000..359eef6
--- /dev/null
+++ b/fidl/fuchsia.bluetooth/meta.json
@@ -0,0 +1,14 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.bluetooth/status.fidl", 
+    "fidl/fuchsia.bluetooth/nullables.fidl"
+  ], 
+  "name": "fuchsia.bluetooth", 
+  "root": "fidl/fuchsia.bluetooth", 
+  "sources": [
+    "fidl/fuchsia.bluetooth/status.fidl", 
+    "fidl/fuchsia.bluetooth/nullables.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.bluetooth/nullables.fidl b/fidl/fuchsia.bluetooth/nullables.fidl
new file mode 100644
index 0000000..f5bcb42
--- /dev/null
+++ b/fidl/fuchsia.bluetooth/nullables.fidl
@@ -0,0 +1,19 @@
+// 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;
+
+// Nullable primitive types:
+
+struct Bool {
+  bool value;
+};
+
+struct Int8 {
+  int8 value;
+};
+
+struct UInt16 {
+  uint16 value;
+};
diff --git a/fidl/fuchsia.bluetooth/status.fidl b/fidl/fuchsia.bluetooth/status.fidl
new file mode 100644
index 0000000..8a49c31
--- /dev/null
+++ b/fidl/fuchsia.bluetooth/status.fidl
@@ -0,0 +1,42 @@
+// 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;
+
+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;
+
+  // Human-readable description of the error.
+  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/fidl/fuchsia.developer.tiles/meta.json b/fidl/fuchsia.developer.tiles/meta.json
new file mode 100644
index 0000000..fec0444
--- /dev/null
+++ b/fidl/fuchsia.developer.tiles/meta.json
@@ -0,0 +1,15 @@
+{
+  "deps": [
+    "fuchsia.math", 
+    "fuchsia.ui.app"
+  ], 
+  "files": [
+    "fidl/fuchsia.developer.tiles/tiles.fidl"
+  ], 
+  "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/fidl/fuchsia.developer.tiles/tiles.fidl b/fidl/fuchsia.developer.tiles/tiles.fidl
new file mode 100644
index 0000000..f38b474
--- /dev/null
+++ b/fidl/fuchsia.developer.tiles/tiles.fidl
@@ -0,0 +1,25 @@
+// 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.math;
+using fuchsia.ui.app;
+
+[Discoverable]
+interface 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.
+    1: 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.
+    2: AddTileFromViewProvider(string url, fuchsia.ui.app.ViewProvider provider) -> (uint32 key);
+
+    // Removes the tile with the given key.
+    3: RemoveTile(uint32 key);
+
+    // Returns a list of tiles.
+    5: ListTiles() -> (vector<uint32> keys, vector<string> urls, vector<fuchsia.math.SizeF> sizes, vector<bool> focusabilities);
+};
diff --git a/fidl/fuchsia.fonts/font_provider.fidl b/fidl/fuchsia.fonts/font_provider.fidl
new file mode 100644
index 0000000..4b08fca
--- /dev/null
+++ b/fidl/fuchsia.fonts/font_provider.fidl
@@ -0,0 +1,110 @@
+// 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.fonts;
+
+using fuchsia.mem;
+
+enum Slant {
+    UPRIGHT = 1;
+    ITALIC = 2;
+    OBLIQUE = 3;
+};
+
+enum FallbackGroup {
+    NONE = 0;
+    SERIF = 1;
+    SANS_SERIF = 2;
+    MONOSPACE = 3;
+    CURSIVE = 4;
+    FANTASY = 5;
+};
+
+// 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;
+
+// Disables approximate style matching. The service will only return font that
+// matches the requested style exactly.
+const uint32 REQUEST_FLAG_EXACT_MATCH = 2;
+
+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:128? 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 = 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 = 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;
+};
+
+struct Style {
+    uint32 weight;
+    uint32 width;
+    Slant slant;
+};
+
+// 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:128 name;
+
+    // Unordered list of all available styles in the family.
+    vector<Style>:300 styles;
+};
+
+[Discoverable]
+interface Provider {
+    // Returns font that matches specified |request|.
+    1: GetFont(Request request) -> (Response? response);
+
+    // 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".
+    2: GetFamilyInfo(string:128 family) -> (FamilyInfo? family_info);
+};
diff --git a/fidl/fuchsia.fonts/meta.json b/fidl/fuchsia.fonts/meta.json
new file mode 100644
index 0000000..f67297b
--- /dev/null
+++ b/fidl/fuchsia.fonts/meta.json
@@ -0,0 +1,14 @@
+{
+  "deps": [
+    "fuchsia.mem"
+  ], 
+  "files": [
+    "fidl/fuchsia.fonts/font_provider.fidl"
+  ], 
+  "name": "fuchsia.fonts", 
+  "root": "fidl/fuchsia.fonts", 
+  "sources": [
+    "fidl/fuchsia.fonts/font_provider.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.images/encoded_image.fidl b/fidl/fuchsia.images/encoded_image.fidl
new file mode 100644
index 0000000..18384a6
--- /dev/null
+++ b/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/fidl/fuchsia.images/image_info.fidl b/fidl/fuchsia.images/image_info.fidl
new file mode 100644
index 0000000..865e43e
--- /dev/null
+++ b/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 = 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 = BGRA_8;
+
+  // The pixel color space.
+  ColorSpace color_space = SRGB;
+
+  // The pixel arrangement in memory.
+  Tiling tiling = LINEAR;
+
+  // Specifies the interpretion of the alpha channel, if one exists.
+  AlphaFormat alpha_format = OPAQUE;
+};
diff --git a/fidl/fuchsia.images/image_pipe.fidl b/fidl/fuchsia.images/image_pipe.fidl
new file mode 100644
index 0000000..440be61
--- /dev/null
+++ b/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.
+interface 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
+    1: 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
+    2: 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
+    3: PresentImage(uint32 image_id, uint64 presentation_time,
+                    vector<handle<event>> acquire_fences, vector<handle<event>> release_fences)
+           -> (PresentationInfo presentation_info);
+};
diff --git a/fidl/fuchsia.images/memory_type.fidl b/fidl/fuchsia.images/memory_type.fidl
new file mode 100644
index 0000000..889271c
--- /dev/null
+++ b/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/fidl/fuchsia.images/meta.json b/fidl/fuchsia.images/meta.json
new file mode 100644
index 0000000..2f3af13
--- /dev/null
+++ b/fidl/fuchsia.images/meta.json
@@ -0,0 +1,20 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.images/encoded_image.fidl", 
+    "fidl/fuchsia.images/image_info.fidl", 
+    "fidl/fuchsia.images/image_pipe.fidl", 
+    "fidl/fuchsia.images/memory_type.fidl", 
+    "fidl/fuchsia.images/presentation_info.fidl"
+  ], 
+  "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/memory_type.fidl", 
+    "fidl/fuchsia.images/presentation_info.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.images/presentation_info.fidl b/fidl/fuchsia.images/presentation_info.fidl
new file mode 100644
index 0000000..8b2f464
--- /dev/null
+++ b/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/fidl/fuchsia.io/io.fidl b/fidl/fuchsia.io/io.fidl
new file mode 100644
index 0000000..7b3b5ba
--- /dev/null
+++ b/fidl/fuchsia.io/io.fidl
@@ -0,0 +1,401 @@
+// 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.io;
+
+using zx;
+
+// Interfaces which may be returned by NodeInfo, an object
+// returned when calling Open or Describe:
+
+// The default protocol, interface information must be acquired some
+// other way.
+struct Service {
+    uint8 reserved;
+};
+
+// The object may be cast to interface 'File'.
+struct FileObject {
+    handle<event>? event;
+};
+
+// The object may be cast to interface 'Directory'.
+struct DirectoryObject {
+    uint8 reserved;
+};
+
+// The object is accompanied by a pipe.
+struct Pipe {
+    handle<socket> socket;
+};
+
+// The object is accompanied by a VMO.
+struct Vmofile {
+    handle<vmo> vmo;
+    uint64 offset;
+    uint64 length;
+};
+
+// The object may be cast to interface 'Device'.
+struct Device {
+    handle<event>? event;
+};
+
+// Describes how the connection to the Object should be handled, as well as
+// how to interpret the optional handle.
+union NodeInfo {
+    Service service;
+    FileObject file;
+    DirectoryObject directory;
+    Pipe pipe;
+    Vmofile vmofile;
+    Device device;
+};
+
+// Can read from target object.
+const uint32 OPEN_RIGHT_READABLE = 0x00000001;
+// Can write to target object.
+const uint32 OPEN_RIGHT_WRITABLE = 0x00000002;
+// Connection can mount/umount filesystem.
+const uint32 OPEN_RIGHT_ADMIN = 0x00000004;
+
+// Create the object if it doesn't exist.
+const uint32 OPEN_FLAG_CREATE = 0x00010000;
+// (with Create) Fail if the object already exists.
+const uint32 OPEN_FLAG_CREATE_IF_ABSENT = 0x00020000;
+// Truncate the object before usage.
+const uint32 OPEN_FLAG_TRUNCATE = 0x00040000;
+// Return an error if the target object is not a directory.
+const uint32 OPEN_FLAG_DIRECTORY = 0x00080000;
+// Seek to the end of the object before all writes.
+const uint32 OPEN_FLAG_APPEND = 0x00100000;
+// If the object is a mount point, open the local directory.
+const uint32 OPEN_FLAG_NO_REMOTE = 0x00200000;
+// Open a reference to the object, not the object itself.
+const uint32 OPEN_FLAG_NODE_REFERENCE = 0x00400000;
+// Requests that an "OnOpen" event is sent, with
+// a non-null NodeInfo (if the open is successful).
+// Implies "OPEN_FLAG_STATUS".
+const uint32 OPEN_FLAG_DESCRIBE = 0x00800000;
+// Requests that an "OnOpen" event is sent.
+const uint32 OPEN_FLAG_STATUS = 0x01000000;
+
+// Node defines the minimal interface for entities which can be accessed in a filesystem.
+[Layout="Simple", FragileBase]
+interface Node {
+    // Create another connection to the same remote object.
+    Clone(uint32 flags, request<Node> object);
+
+    // Terminates connection with object.
+    Close() -> (zx.status s);
+
+    // Returns extra information about the type of the object.
+    // If the |Describe| operation fails, the connection is closed.
+    Describe() -> (NodeInfo info);
+
+    // An event produced eagerly by a fidl server if requested
+    // by open flags.
+    // Indicates the success or failure of the open operation,
+    // and optionally describes the object.
+    // If the status is |ZX_OK| and |OPEN_FLAG_DESCRIBE| was passed
+    // to open, |info| contains descriptive information about
+    // the object (the same as would be returned by |Describe|),
+    // otherwise it is null.
+    -> OnOpen(zx.status s, NodeInfo? info);
+
+    // Synchronizes updates to the node to the underlying media, if it exists.
+    Sync() -> (zx.status s);
+
+    // Acquire information about the node.
+    GetAttr() -> (zx.status s, NodeAttributes attributes);
+
+    // Update information about the node.
+    SetAttr(uint32 flags, NodeAttributes attributes) -> (zx.status s);
+
+    // Deprecated. Only for use with compatibility with devhost.
+    Ioctl(uint32 opcode, uint64 max_out, vector<handle>:MAX_IOCTL_HANDLES handles, vector<uint8>:MAX_BUF in)
+        -> (zx.status s, vector<handle>:MAX_IOCTL_HANDLES handles, vector<uint8>:MAX_BUF out);
+};
+
+// Bits reserved for posix protections. Native fuchsia filesystems
+// are not required to set bits contained within MODE_PROTECTION_MASK,
+// but filesystems that wish to do so may refer to sys/stat.h for their
+// definitions.
+const uint32 MODE_PROTECTION_MASK = 0x00FFF;
+// Bits indicating node type. The canonical mechanism to check
+// for a node type is to take 'mode', bitwise and it with the
+// MODE_TYPE_MASK, and check exact equality against a mode type.
+const uint32 MODE_TYPE_MASK = 0xFF000;
+const uint32 MODE_TYPE_DIRECTORY = 0x04000;
+const uint32 MODE_TYPE_BLOCK_DEVICE = 0x06000;
+const uint32 MODE_TYPE_FILE = 0x08000;
+const uint32 MODE_TYPE_SOCKET = 0x0C000;
+const uint32 MODE_TYPE_SERVICE = 0x10000;
+
+// NodeAttributes defines generic information about a filesystem node.
+struct NodeAttributes {
+    // Protection bits and node type information describe in 'mode'.
+    uint32 mode;
+    // A filesystem-unique ID.
+    uint64 id;
+    // Node size, in bytes.
+    uint64 content_size;
+    // Space needed to store node (possibly larger than size), in bytes.
+    uint64 storage_size;
+    // Hard link count.
+    uint64 link_count;
+    // Time of creation (may be updated manually after creation) in ns since Unix epoch, UTC.
+    uint64 creation_time;
+    // Time of last modification in ns since Unix epoch, UTC.
+    uint64 modification_time;
+};
+
+const uint64 MAX_IOCTL_HANDLES = 2;
+const uint64 MAX_BUF = 8192;
+const uint64 MAX_PATH = 4096;
+const uint64 MAX_FILENAME = 255;
+
+// The fields of 'attributes' which are used to update the Node are indicated
+// by the 'flags' argument.
+const uint32 NODE_ATTRIBUTE_FLAG_CREATION_TIME = 0x00000001;
+const uint32 NODE_ATTRIBUTE_FLAG_MODIFICATION_TIME = 0x00000002;
+
+// Update the Seek offset.
+enum SeekOrigin : uint32 {
+    // Seek from the start of the file.
+    START = 0;
+    // Seek from the current position in the file.
+    CURRENT = 1;
+    // Seek from the end of the file.
+    END = 2;
+};
+
+// VMO access rights.
+const uint32 VMO_FLAG_READ = 0x00000001;
+const uint32 VMO_FLAG_WRITE = 0x00000002;
+const uint32 VMO_FLAG_EXEC = 0x00000004;
+
+// Require a copy-on-write clone of the underlying VMO.
+// The request should fail if the VMO is not cloned.
+// May not be supplied with fuchsia_io_VMO_FLAG_EXACT.
+const uint32 VMO_FLAG_PRIVATE = 0x00010000;
+
+// Require an exact (non-cloned) handle to the underlying VMO.
+// The request should fail if a handle to the exact VMO
+// is not returned.
+// May not be supplied with VMO_FLAG_PRIVATE.
+const uint32 VMO_FLAG_EXACT = 0x00020000;
+
+// File defines the interface of a node which contains a flat layout of data.
+[Layout = "Simple"]
+interface File : Node {
+    // Read 'count' bytes at the seek offset.
+    // The seek offset is moved forward by the number of bytes read.
+    Read(uint64 count) -> (zx.status s, vector<uint8>:MAX_BUF data);
+
+    // Read 'count' bytes at the provided offset.
+    // Does not affect the seek offset.
+    ReadAt(uint64 count, uint64 offset) -> (zx.status s, vector<uint8>:MAX_BUF data);
+
+    // Write data at the seek offset.
+    // The seek offset is moved forward by the number of bytes written.
+    Write(vector<uint8>:MAX_BUF data) -> (zx.status s, uint64 actual);
+
+    // Write data to the provided offset.
+    // Does not affect the seek offset.
+    WriteAt(vector<uint8>:MAX_BUF data, uint64 offset) -> (zx.status s, uint64 actual);
+
+    Seek(int64 offset, SeekOrigin start) -> (zx.status s, uint64 offset);
+
+    // Shrink the file size to 'length' bytes.
+    Truncate(uint64 length) -> (zx.status s);
+
+    // Acquire the Directory::Open rights and flags used to access this file.
+    GetFlags() -> (zx.status s, uint32 flags);
+
+    // Change the Directory::Open flags used to access the file.
+    // Supported flags which can be turned on / off:
+    // - OPEN_FLAG_APPEND
+    SetFlags(uint32 flags) -> (zx.status s);
+
+    // Acquire a VMO representing this file, if there is one, with the
+    // requested access rights.
+    GetVmo(uint32 flags) -> (zx.status s, handle<vmo>? vmo);
+};
+
+// Dirent type information associated with the results of ReadDirents.
+const uint8 DIRENT_TYPE_UNKNOWN = 0;
+const uint8 DIRENT_TYPE_DIRECTORY = 4;
+const uint8 DIRENT_TYPE_BLOCK_DEVICE = 6;
+const uint8 DIRENT_TYPE_FILE = 8;
+const uint8 DIRENT_TYPE_SOCKET = 12;
+const uint8 DIRENT_TYPE_SERVICE = 16;
+
+// Nodes which do not have ino values should return this value
+// from Readdir and GetAttr.
+const uint64 INO_UNKNOWN = 0xFFFFFFFFFFFFFFFF;
+
+// Indicates the directory being watched has been deleted.
+const uint8 WATCH_EVENT_DELETED = 0;
+// Indicates a node has been created (either new or moved) into a directory.
+const uint8 WATCH_EVENT_ADDED = 1;
+// Identifies a node has been removed (either deleted or moved) from the directory.
+const uint8 WATCH_EVENT_REMOVED = 2;
+// Identifies a node already existed in the directory when watching started.
+const uint8 WATCH_EVENT_EXISTING = 3;
+// Identifies that no more WATCH_EVENT_EXISTING events will be sent.
+const uint8 WATCH_EVENT_IDLE = 4;
+
+// The following are bitmasks corresponding to the "watch events".
+// They may be used as arguments to the Directory Watch method, to
+// specify which events should receive notifications.
+const uint32 WATCH_MASK_DELETED = 0x00000001;
+const uint32 WATCH_MASK_ADDED = 0x00000002;
+const uint32 WATCH_MASK_REMOVED = 0x00000004;
+const uint32 WATCH_MASK_EXISTING = 0x00000008;
+const uint32 WATCH_MASK_IDLE = 0x00000010;
+const uint32 WATCH_MASK_ALL = 0x0000001F;
+
+// WARNING(ZX-2645): Unused.
+//
+// WatchedEvent describes events returned from a DirectoryWatcher.
+struct WatchedEvent {
+    uint8 event;
+    uint8 len;
+    vector<uint8>:MAX_FILENAME name;
+};
+
+// WARNING(ZX-2645): Unused.
+//
+// DirectoryWatcher transmits messages from a filesystem server
+// about events happening in the filesystem. Clients can register
+// new watchers using the Directory "Watch" method, where they can
+// filter which events they want to receive notifications for.
+[Layout = "Simple"]
+interface DirectoryWatcher {
+    // TODO(smklein): Convert this to a vector of WatchedEvents, when possible.
+    OnEvent(vector<uint8>:MAX_BUF events);
+};
+
+// Directory defines a node which is capable of containing other Objects.
+[Layout = "Simple", FragileBase]
+interface Directory : Node {
+    // Open a new object relative to this directory object.
+    Open(uint32 flags, uint32 mode, string:MAX_PATH path, request<Node> object);
+
+    // Remove an object relative to this directory object.
+    Unlink(string:MAX_PATH path) -> (zx.status s);
+
+    // Reads a collection of variably sized dirents into a buffer.
+    // The number of dirents in a directory may be very large: akin to
+    // calling read multiple times on a file, directories have a seek
+    // offset which is updated on subsequent calls to ReadDirents.
+    //
+    // These dirents are of the form:
+    // struct dirent {
+    //   // Describes the inode of the entry.
+    //   uint64 ino;
+    //   // Describes the length of the dirent name.
+    //   uint8 size;
+    //   // Describes the type of the entry. Aligned with the
+    //   // POSIX d_type values. Use DIRENT_TYPE_* constants.
+    //   uint8 type;
+    //   // Unterminated name of entry.
+    //   char name[0];
+    // }
+    ReadDirents(uint64 max_bytes) -> (zx.status s, vector<uint8>:MAX_BUF dirents);
+
+    // Reset the directory seek offset.
+    Rewind() -> (zx.status s);
+
+    // Acquire a token to a Directory which can be used to identify
+    // access to it at a later point in time.
+    GetToken() -> (zx.status s, handle? token);
+
+    // Within the directory, rename an object named src to the name dst, in
+    // a directory represented by token.
+    Rename(string:MAX_PATH src, handle dst_parent_token, string:MAX_PATH dst) -> (zx.status s);
+
+    // Within the directory, create a link to an object named src by the name
+    // dst, within a directory represented by token.
+    Link(string:MAX_PATH src, handle dst_parent_token, string:MAX_PATH dst) -> (zx.status s);
+
+    // Watches a directory, receiving events of added messages on the
+    // watcher request channel.
+    //
+    // The "watcher" handle will send messages of the form:
+    // struct {
+    //   uint8 event;
+    //   uint8 len;
+    //   char name[];
+    // };
+    // Where names are NOT null-terminated.
+    //
+    // This API is unstable; in the future, watcher will be a "DirectoryWatcher" client.
+    //
+    // Mask specifies a bitmask of events to observe.
+    // Options must be zero; it is reserved.
+    Watch(uint32 mask, uint32 options, handle<channel> watcher) -> (zx.status s);
+};
+
+const uint32 MOUNT_CREATE_FLAG_REPLACE = 0x00000001;
+
+const uint64 MAX_FS_NAME_BUFFER = 32;
+
+struct FilesystemInfo {
+    // The number of data bytes which may be stored in a filesystem.
+    uint64 total_bytes;
+    // The number of data bytes which are in use by the filesystem.
+    uint64 used_bytes;
+    // The number of nodes which may be stored in the filesystem.
+    uint64 total_nodes;
+    // The number of nodes used by the filesystem.
+    uint64 used_nodes;
+    // The amount of space which may be allocated from the underlying
+    // volume manager. If unsupported, this will be zero.
+    uint64 free_shared_pool_bytes;
+    // A unique identifier for this filesystem instance. Will not be preserved
+    // across reboots.
+    uint64 fs_id;
+    // The size of a single filesystem block.
+    uint32 block_size;
+    // The maximum length of a filesystem name.
+    uint32 max_filename_size;
+    // A unique identifier for the type of the underlying filesystem.
+    uint32 fs_type;
+    uint32 padding;
+    // TODO(smklein): Replace this field with a string when supported
+    // by the "Simple" interface. At the moment, name is a fixed-size,
+    // null-terminated buffer.
+    array<int8>:MAX_FS_NAME_BUFFER name;
+};
+
+// DirectoryAdmin defines a directory which is capable of handling
+// administrator tasks within the filesystem.
+[Layout = "Simple"]
+interface DirectoryAdmin : Directory {
+    // Mount a channel representing a remote filesystem onto this directory.
+    // All future requests to this node will be forwarded to the remote filesytem.
+    // To re-open a node without forwarding to the remote target, the node
+    // should be opened with OPEN_FLAG_NO_RMOTE.
+    Mount(Directory remote) -> (zx.status s);
+
+    // Atomically create a directory with a provided path, and mount the
+    // remote handle to the newly created directory.
+    MountAndCreate(Directory remote, string:MAX_FILENAME name, uint32 flags) -> (zx.status s);
+
+    // Unmount this filesystem. After this function returns successfully,
+    // all connections to the filesystem will be terminated.
+    Unmount() -> (zx.status s);
+
+    // Detach a node which was previously attached to this directory
+    // with Mount.
+    UnmountNode() -> (zx.status s, Directory? remote);
+
+    // Query the filesystem for filesystem-specific information.
+    QueryFilesystem() -> (zx.status s, FilesystemInfo? info);
+
+    // Acquire the path to the device backing this filesystem, if there is one.
+    GetDevicePath() -> (zx.status s, string:MAX_PATH? path);
+};
diff --git a/fidl/fuchsia.io/meta.json b/fidl/fuchsia.io/meta.json
new file mode 100644
index 0000000..d1eddc4
--- /dev/null
+++ b/fidl/fuchsia.io/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.io/io.fidl"
+  ], 
+  "name": "fuchsia.io", 
+  "root": "fidl/fuchsia.io", 
+  "sources": [
+    "fidl/fuchsia.io/io.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ldsvc/ldsvc.fidl b/fidl/fuchsia.ldsvc/ldsvc.fidl
new file mode 100644
index 0000000..d0dbc34
--- /dev/null
+++ b/fidl/fuchsia.ldsvc/ldsvc.fidl
@@ -0,0 +1,63 @@
+// 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.ldsvc;
+
+using zx;
+
+// See //zircon/docs/program_loading.md for a more complete
+// description of this and related process bootstrapping protocols, and
+// for specifics about the default global loader service's
+// interpretation of names, paths, and configurations.
+
+// WARNING: This interface is manually implemented in libldmsg.a. Please
+// update that implementation if you change this protocol.
+
+[Layout = "Simple"]
+interface Loader {
+    // Cleanly shutdown the connection to the Loader service.
+    1: Done();
+
+    // The dynamic linker sends |object_name| and gets back a VMO
+    // handle containing the file.
+    2: LoadObject(string:1024 object_name) -> (zx.status rv, handle<vmo>? object);
+
+    // The program loader sends the script |interpreter_name| from
+    // hashbang and gets back a VMO to execute in place of the script.
+    3: LoadScriptInterpreter(string:1024 interpreter_name) -> (zx.status rv, handle<vmo>? object);
+
+    // The dynamic linker sends a |config| identifying its load
+    // configuration.  This is intended to affect how later
+    // |LoadObject| requests decide what particular implementation
+    // file to supply for a given name.
+    4: Config(string:1024 config) -> (zx.status rv);
+
+    // Obtain a new loader service connection.
+    5: Clone(request<Loader> loader) -> (zx.status rv);
+
+    // The program runtime sends a string naming a |data_sink| and
+    // transfers the sole handle to a VMO containing the |data| it
+    // wants published there.  The |data_sink| string identifies a
+    // type of data, and the VMO's object name can specifically
+    // identify the data set in this VMO.  The client must transfer
+    // the only handle to the VMO (which prevents the VMO being
+    // resized without the receiver's knowledge), but it might still
+    // have the VMO mapped in and continue to write data to it.  Code
+    // instrumentation runtimes use this to deliver large binary trace
+    // results.
+    //
+    // This is intended to be a developer-oriented feature and might
+    // not ordinarily be available in production runs.
+    7: DebugPublishDataSink(string:1024 data_sink, handle<vmo> data) -> (zx.status rv);
+
+    // The program runtime names a |config_name| referring to a debug
+    // configuration of some kind and gets back a VMO to read
+    // configuration data from.  The sanitizer runtimes use this to
+    // allow large options text to be stored in a file rather than
+    // passed directly in environment strings.
+    //
+    // This is intended to be a developer-oriented feature and might
+    // not ordinarily be available in production runs.
+    8: DebugLoadConfig(string:1024 config_name) -> (zx.status rv, handle<vmo>? config);
+};
diff --git a/fidl/fuchsia.ldsvc/meta.json b/fidl/fuchsia.ldsvc/meta.json
new file mode 100644
index 0000000..5d0a840
--- /dev/null
+++ b/fidl/fuchsia.ldsvc/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.ldsvc/ldsvc.fidl"
+  ], 
+  "name": "fuchsia.ldsvc", 
+  "root": "fidl/fuchsia.ldsvc", 
+  "sources": [
+    "fidl/fuchsia.ldsvc/ldsvc.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.logger/logger.fidl b/fidl/fuchsia.logger/logger.fidl
new file mode 100644
index 0000000..28744c9
--- /dev/null
+++ b/fidl/fuchsia.logger/logger.fidl
@@ -0,0 +1,96 @@
+// 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.logger;
+
+using zx;
+
+enum LogLevelFilter : int8 {
+    NONE = -1;
+    INFO = 0;
+    WARN = 1;
+    ERROR = 2;
+    FATAL = 3;
+};
+
+// Max tags that can be passed to filter by listener.
+const uint8 MAX_TAGS = 5;
+
+// Max tag length that can be passed to filter by listener.
+const uint8 MAX_TAG_LEN_BYTES = 63;
+
+struct LogFilterOptions {
+    bool filter_by_pid;
+    uint64 pid;
+
+    bool filter_by_tid;
+    uint64 tid;
+
+    // If more than zero, logs would be filtered based on verbosity and
+    // |min_severity| would be ignored.
+    uint8 verbosity;
+
+    LogLevelFilter min_severity;
+
+    // If non-empty, return all messages which contain at least one specified
+    // tag.  If empty, messages will not be filtered by tag.
+    // Passed tags should not be more than |MAX_TAG_LEN_BYTES| bytes in length
+    // and max tags can be |MAX_TAGS|.
+    // Listener would be discarded if the limit is not followed.
+    vector<string>:MAX_TAGS tags;
+};
+
+// Max tags that will be attached to a LogMessage.
+const uint8 MAX_TAGS_PER_LOG_MESSAGE = 5;
+
+struct LogMessage {
+    uint64 pid;
+    uint64 tid;
+    // Nanoseconds since the system was powered on, aka ZX_CLOCK_MONOTONIC.
+    // https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/clock_get.md#supported-clock-ids
+    zx.time time;
+    int32 severity;
+
+    // See //zircon/system/ulib/syslog/include/syslog/wire_format.h. As messages
+    // can be served out of order, this should only be logged if more than last
+    // count.
+    uint32 dropped_logs;
+    vector<string>:MAX_TAGS_PER_LOG_MESSAGE tags;
+    string msg;
+};
+
+// Interface for LogListener to register to listen to logs.
+[Discoverable]
+interface Log {
+    // Listens to new log entries by calling Log() on |log_listener|.
+    // A null |options| indicates no filtering is requested.
+    1: Listen(LogListener log_listener, LogFilterOptions? options);
+
+    // Dumps all cached logs by calling LogMany() followed by Done() on
+    // |log_listener|.
+    // A null |options| indicates no filtering is requested.
+    2: DumpLogs(LogListener log_listener, LogFilterOptions? options);
+};
+
+// Interface to get and listen to socket from syslogger
+[Discoverable]
+interface LogSink {
+    // Client connects to send logs over socket
+    1: Connect(handle<socket> socket);
+};
+
+const uint64 MAX_LOG_MANY_SIZE_BYTES = 16384;
+
+interface LogListener {
+    // Called for single messages.
+    1: Log(LogMessage log);
+
+    // Called when |Log| service is serving cached logs.
+    // Max logs size per call is |MAX_LOG_MANY_SIZE_BYTES| bytes.
+    2: LogMany(vector<LogMessage> log);
+
+    // Called in the case |DumpLogs()| function of |Log| service was called and
+    // all cached logs have been dispatched to this listener.
+    3: Done();
+};
diff --git a/fidl/fuchsia.logger/meta.json b/fidl/fuchsia.logger/meta.json
new file mode 100644
index 0000000..3f4a950
--- /dev/null
+++ b/fidl/fuchsia.logger/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.logger/logger.fidl"
+  ], 
+  "name": "fuchsia.logger", 
+  "root": "fidl/fuchsia.logger", 
+  "sources": [
+    "fidl/fuchsia.logger/logger.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.math/math.fidl b/fidl/fuchsia.math/math.fidl
new file mode 100644
index 0000000..b0e7838
--- /dev/null
+++ b/fidl/fuchsia.math/math.fidl
@@ -0,0 +1,79 @@
+// 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.math;
+
+struct Point {
+    int32 x;
+    int32 y;
+};
+
+struct PointF {
+    float32 x;
+    float32 y;
+};
+
+struct Point3F {
+    float32 x;
+    float32 y;
+    float32 z;
+};
+
+struct Size {
+    int32 width;
+    int32 height;
+};
+
+struct SizeF {
+    float32 width;
+    float32 height;
+};
+
+struct Rect {
+    int32 x;
+    int32 y;
+    int32 width;
+    int32 height;
+};
+
+struct RectF {
+    float32 x;
+    float32 y;
+    float32 width;
+    float32 height;
+};
+
+struct RRectF {
+    float32 x;
+    float32 y;
+    float32 width;
+    float32 height;
+    float32 top_left_radius_x;
+    float32 top_left_radius_y;
+    float32 top_right_radius_x;
+    float32 top_right_radius_y;
+    float32 bottom_left_radius_x;
+    float32 bottom_left_radius_y;
+    float32 bottom_right_radius_x;
+    float32 bottom_right_radius_y;
+};
+
+struct Transform {
+    // Row major order.
+    array<float32>:16 matrix;
+};
+
+struct Inset {
+    int32 top;
+    int32 right;
+    int32 bottom;
+    int32 left;
+};
+
+struct InsetF {
+    float32 top;
+    float32 right;
+    float32 bottom;
+    float32 left;
+};
diff --git a/fidl/fuchsia.math/meta.json b/fidl/fuchsia.math/meta.json
new file mode 100644
index 0000000..277f3a2
--- /dev/null
+++ b/fidl/fuchsia.math/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.math/math.fidl"
+  ], 
+  "name": "fuchsia.math", 
+  "root": "fidl/fuchsia.math", 
+  "sources": [
+    "fidl/fuchsia.math/math.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.media/audio.fidl b/fidl/fuchsia.media/audio.fidl
new file mode 100644
index 0000000..46386f9
--- /dev/null
+++ b/fidl/fuchsia.media/audio.fidl
@@ -0,0 +1,95 @@
+// 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.media;
+
+// Ordinal range: 0x0700-0x7ff
+[Discoverable]
+interface Audio {
+    0x0701: CreateAudioRenderer(request<AudioRenderer> audio_renderer_request);
+
+    // Create an AudioCapturer which either captures from the current default
+    // audio input device, or loops-back from the current default audio output
+    // device based on value passed for the the loopback flag.
+    //
+    // TODO(mpuryear): Get rid of the loopback flag ASAP. Routing decisions (and
+    // security surrounding routing decisions) should be much more sophisticated
+    // than this. This is just a placeholder until we have a design in place.
+    // Eventually, I suspect that all of this will move up into the audio policy
+    // manager and application clients will obtain AudioCapturers from and control
+    // through the policy manager.
+    0x0702: CreateAudioCapturer(request<AudioCapturer> audio_capturer_request,
+                                bool loopback);
+
+    // System Gain and Mute
+    // TODO(mpuryear): remove this systemwide setting once device-centric settings
+    // are plumbed into the system UI. Also, device-centric (and certainly
+    // systemwide settings) should be moved out of the accessible-to-all public
+    // audio interface and relocated to a more restrictive interface that is only
+    // accessible by clients with the appropriate privileges (such as system
+    // configuration API, or the governor of audio policy).
+    //
+    // Mirroring device-centric gain and mute stages, Fuchsia's systemwide Gain
+    // and Mute settings are fully independent. Changing the value of one does not
+    // change the value of the other. Both have the ability to silence a system
+    // (or a device, in the case of device Gain/Mute). If Mute is true, or if Gain
+    // is kMutedGain, the system is silenced regardless of the other. Similarly,
+    // one's value does not restrict the other's possible values in any way.
+    //
+    // Sets the system-wide gain in decibels. |db| values are clamped to the range
+    // -160db to 0db, inclusive. This setting is applied to all audio output
+    // devices. Audio input devices are unaffected. System Gain changes do not
+    // affect the System Mute state.
+    0x0703: SetSystemGain(float32 gain_db);
+
+    // Sets/clears the systemwide 'Mute' state for audio output devices. Audio
+    // input devices are unaffected. Changes to the System Mute state do not
+    // affect the value of System Gain.
+    0x0704: SetSystemMute(bool muted);
+
+    // Provides current values for the systemwide Gain and Mute.
+    // When a client connects to Audio, the system enqueues an action (to be
+    // executed once the system regains control) to send this newly-connected
+    // client a callback with the current systemwide Gain|Mute settings. Further,
+    // upon any change to the systemwide Gain|Mute values, the system will trigger
+    // all registered callbacks, notifying clients of the new values.
+    //
+    // Calls to SetSystemMute or SetSystemGain that do NOT result in a change to
+    // these values (e.g. calling SetSystemMute(false) when Mute is already false)
+    // will not cause the callbacks to be triggered.
+    //
+    // During and immediately following connecting to Audio, it is essential that
+    // clients keep in mind the fundamental single-threaded nature of FIDL.
+    // Specifically, if a newly-connected client registers a SystemGainMuteChanged
+    // callback before returning, that client will (once the system has subsequent
+    // opportunity) be notified via callback of the Gain|Mute settings at the time
+    // the connection was established. If however a newly-connected client returns
+    // from a FIDL message dispatch (returning control to the FIDL dispatcher),
+    // then that client subsequently registers this callback, the client has no
+    // way to learn the current Gain|Mute settings until they actually change.
+    0x0705: -> SystemGainMuteChanged(float32 gain_db, bool muted);
+
+    0x0706: SetRoutingPolicy(AudioOutputRoutingPolicy policy);
+};
+
+// A placeholder for various types of simple routing policies. This should be
+// replaced when routing policy moves to a more centralized policy manager.
+enum AudioOutputRoutingPolicy {
+    // AudioRenderers are always connected to all audio outputs which currently
+    // in the plugged state (eg; have a connector attached to them)
+    ALL_PLUGGED_OUTPUTS = 0;
+
+    // AudioRenderers are only connected to the output stream which most
+    // recently entered the plugged state. AudioRenderers move around from output to
+    // output as streams are published/unpublished and become plugged/unplugged.
+    //
+    // This is the initial setting for audio output routing.
+    LAST_PLUGGED_OUTPUT = 1;
+};
+
+// Permitted ranges for AudioRenderer and AudioCapturer
+const uint32 MIN_PCM_CHANNEL_COUNT = 1;
+const uint32 MAX_PCM_CHANNEL_COUNT = 8;
+const uint32 MIN_PCM_FRAMES_PER_SECOND = 1000;
+const uint32 MAX_PCM_FRAMES_PER_SECOND = 192000;
diff --git a/fidl/fuchsia.media/audio_capturer.fidl b/fidl/fuchsia.media/audio_capturer.fidl
new file mode 100644
index 0000000..84890e2
--- /dev/null
+++ b/fidl/fuchsia.media/audio_capturer.fidl
@@ -0,0 +1,307 @@
+// 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.media;
+
+// AudioCapturer
+//
+// An AudioCapturer is an interface returned from an fuchsia.media.Audio's
+// CreateAudioCapturer method, which may be used by clients to capture audio from
+// either the current default audio input device, or the current default audio
+// output device depending on the flags passed during creation.
+//
+// TODO(mpuryear): Routing policy needs to become more capable than this.
+// Clients will need to be able to request sets of inputs/outputs/renderers,
+// make changes to theses sets, have their requests vetted by policy (do they
+// have the permission to capture this private stream, do they have the
+// permission to capture at this frame rate, etc...).  Eventually, this
+// functionality will need to be expressed at the AudioPolicy level, not here.
+//
+// ** Format support **
+//
+// See (Get|Set)StreamType below.  By default, the captured stream type will be
+// initially determined by the currently configured stream type of the source
+// that the AudioCapturer was bound to at creation time.  Users may either fetch this
+// type using GetStreamType, or they may choose to have the media
+// resampled/converted to a type of their choosing by calling SetStreamType.
+// Note: the stream type may only be set while the system is not running,
+// meaning that there are no pending capture regions (specified using CaptureAt)
+// and that the system is not currently running in 'async' capture mode.
+//
+// ** Buffers and memory management **
+//
+// Audio data is captured into a shared memory buffer (a VMO) supplied by the
+// user to the AudioCapturer during the AddPayloadBuffer call.  Please note the
+// following requirements related to the management of the payload buffer.
+//
+// ++ The payload buffer must be supplied before any capture operation may
+//    start.  Any attempt to start capture (via either CaptureAt or
+//    StartAsyncCapture) before a payload buffer has been established is an
+//    error.
+// ++ The payload buffer may not be changed while there are any capture
+//    operations pending.
+// ++ The stream type may not be changed after the payload buffer has been set.
+// ++ The payload buffer must be an integral number of audio frame sizes (in
+//    bytes)
+// ++ When running in 'async' mode (see below), the payload buffer must be at
+//    least as large as twice the frames_per_packet size specified during
+//    StartAsyncCapture.
+// ++ The handle to the payload buffer supplied by the user must be readable,
+//    writable, and mappable.
+// ++ Users should always treat the payload buffer as read-only.
+//
+// ** Synchronous vs. Asynchronous capture mode **
+//
+// The AudioCapturer interface can be used in one of two mutually exclusive
+// modes: Synchronous and Asynchronous.  A description of each mode and their
+// tradeoffs is given below.
+//
+// (TODO(mpuryear): can we come up with better names than these?  Both are
+// really async modes under the hood).
+//
+// ** Synchronous mode **
+//
+// By default, AudioCapturer instances are running in 'sync' mode.  They will
+// only capture data when a user supplies at least one region to capture into
+// using the CaptureAt method.  Regions supplied in this way will be filled in
+// the order that they are received and returned to the client as StreamPackets
+// via the return value of the CaptureAt method.  If an AudioCapturer instance
+// has data to capture, but no place to put it (because there are no more
+// pending regions to fill), the next payload generated will indicate that their
+// has been an overflow by setting the Discontinuity flag on the next produced
+// StreamPacket.  Synchronous mode may not be used in conjunction with
+// Asynchronous mode.  It is an error to attempt to call StartAsyncCapture while
+// the system still regions supplied by CaptureAt waiting to be filled.
+//
+// If a user has supplied regions to be filled by the AudioCapturer instance in
+// the past, but wishes to reclaim those regions, they may do so using the
+// DiscardAllPackets method.  Calling the DiscardAllPackets method will cause
+// all pending regions to be returned, but with NO_TIMESTAMP as their
+// StreamPacket's PTS.  See "Timing and Overflows", below, for a discussion of
+// timestamps and discontinuity flags. After a DiscardAllPackets operation,
+// an OnEndOfStream event will be produced.  While an AudioCapturer will never
+// overwrite any region of the payload buffer after a completed region is
+// returned, it may overwrite the unfilled portions of a partially filled
+// buffer which has been returned as a result of a flDiscardAllPacketsush
+// operation.
+//
+// ** Asynchronous mode **
+//
+// While running in 'async' mode, clients do not need to explicitly supply
+// regions of the shared buffer to be filled by the AudioCapturer instance.
+// Instead, a client enters into 'async' mode by calling StartAsyncCapture and
+// supplying a callback interface, and a number of frames to capture
+// per-callback.  Once running in async mode, the AudioCapturer instance will
+// choose regions of the payload buffer to capture into, capture the specified
+// number of frames, then deliver those frames as StreamPackets using the
+// OnPacketCapture FIDL event.  Users may stop capturing are return the
+// AudioCapturer instance to 'sync' mode using the StopAsyncCapture method.
+//
+// It is considered an error to attempt any of the following operations.
+//
+// ++ To attempt to enter 'async' capture mode when no payload buffer has been
+//    established.
+// ++ To specify a number of frames to capture per payload which does not permit
+//    at least two contiguous capture payloads to exist in the established
+//    shared payload buffer simultaneously.
+// ++ To send a region to capture into using the CaptureAt method while the
+//    AudioCapturer instance is running in 'async' mode.
+// ++ To attempt to call DiscardAllPackets while the AudioCapturer instance is running
+//    in 'async' mode.
+// ++ To attempt to re-start 'async' mode capturing without having first
+//    stopped.
+// ++ To attempt any operation except for SetGain while in the process of
+//    stopping.
+//
+// ** Synchronizing with a StopAsyncCapture operation **
+//
+// Stopping asynchronous capture mode and returning to synchronous capture mode
+// is an operation which takes time.  Aside from SetGain, users may not call any
+// other methods on the AudioCapturer interface after calling StopAsyncCapture
+// (including calling StopAsyncCapture again) until after the stop operation has
+// completed.  Because of this, it is important for users to be able to
+// synchronize with the stop operation.  Two mechanisms are provided for doing
+// so.
+//
+// The first is to use the StopAsyncCaptureWithCallback method.  When the user's
+// callback has been called, they can be certain that stop operation is complete
+// and that the AudioCapturer instance has returned to synchronous operation
+// mode.
+//
+// TODO(mpuryear): Fix obsolete docs.
+// The second way to determine that a stop operation has completed is to use the
+// flags on the packets which get delivered via the user-supplied
+// AudioCapturerCallback interface after calling StopAsyncCapture.  When
+// asked to stop, any partially filled packet will be returned to the user, and
+// the final packet returned will always have the end-of-stream flag (kFlagsEos)
+// set on it to indicate that this is the final frame in the sequence.  If
+// there is no partially filled packet to return, the AudioCapturer will
+// synthesize an empty packet with no timestamp, and offset/length set to zero,
+// in order to deliver a packet with the end-of-stream flag set on it.  Once
+// users have seen the end-of-stream flag after calling stop, the AudioCapturer
+// has finished the stop operation and returned to synchronous operating mode.
+//
+// ** Timing and Overflows **
+//
+// All media packets produced by an AudioCapturer instance will have their PTS
+// field filled out with the capture time of the audio expressed as a timestamp
+// given by the CLOCK_MONOTONIC timeline.  Note: this timestamp is actually a
+// capture timestamp, not a presentation timestamp (it is more of a CTS than a
+// PTS) and is meant to represent the underlying system's best estimate of the
+// capture time of the first frame of audio, including all outboard and hardware
+// introduced buffering delay.  As a result, all timestamps produced by an
+// AudioCapturer should be expected to be in the past relative to 'now' on the
+// CLOCK_MONOTONIC timeline.
+//
+// TODO(mpuryear): Specify the way in which timestamps relative to a different
+// clock (such as an audio domain clock) may be delivered to a client.
+//
+// The one exception to the "everything has an explicit timestamp" rule is when
+// discarding submitted regions while operating in synchronous mode. Discarded
+// packets have no data in them, but FIDL demands that all pending
+// method-return-value callbacks be executed.  Because of this, the regions will
+// be returned to the user, but their timestamps will be set to
+// kNoTimestamp, and their payload sizes will be set to zero.  Any
+// partially filled payload will have a valid timestamp, but a payload size
+// smaller than originally requested.  The final discarded payload (if there
+// were any to discard) will be followed by an OnEndOfStream event.
+//
+// Two StreamPackets delivered by an AudioCapturer instance are 'continuous' if
+// the first frame of audio contained in the second packet was capture exactly
+// one nominal frame time after the final frame of audio in the first packet.
+// If this relationship does not hold, the second StreamPacket will have the
+// 'kFlagDiscontinuous' flag set in it's flags field.
+//
+// Even though explicit timestamps are provided on every StreamPacket produced,
+// users who have very precise timing requirements are encouraged to always
+// reason about time by counting frames delivered since the last discontinuity
+// instead of simply using the raw capture timestamps.  This is because the
+// explicit timestamps written on continuous packets may have a small amount of
+// rounding error based on whether or not the units of the capture timeline
+// (CLOCK_MONOTONIC) are divisible by the chosen audio frame rate.
+//
+// Users should always expect the first StreamPacket produced by an AudioCapturer
+// to have the discontinuous flag set on it (as there is no previous packet to
+// be continuous with).  Similarly, the first StreamPacket after a
+// DiscardAllPackets or a Stop/Start cycle will always be discontinuous.  After
+// that, there are only two reasons that a StreamPacket will ever be
+// discontinuous.
+//
+// 1) The user is operating an synchronous mode and does not supply regions to
+//    be filled quickly enough.  If the next continuous frame of data has not
+//    been captured by the time it needs to be purged from the source buffers,
+//    an overflow has occurred and the AudioCapturer will flag the next captured
+//    region as discontinuous.
+// 2) The user is operating in asynchronous mode and some internal error
+//    prevents the AudioCapturer instance from capturing the next frame of audio
+//    in a continuous fashion.  This might be high system load or a hardware
+//    error, but in general it is something which should never normally happen.
+//    In practice, however, if it does, the next produced packet will be flagged
+//    as being discontinuous.
+//
+// ** Synchronous vs. Asynchronous Trade-offs **
+//
+// The choice of operating in synchronous vs. asynchronous mode is up to the
+// user, and depending on the user's requirements, there are some advantages and
+// disadvantages to each choice.
+//
+// Synchronous mode requires only a single Zircon channel under the hood and can
+// achieve some small savings because of this.  In addition, the user has
+// complete control over the buffer management.  Users specify exactly where
+// audio will be captured to and in what order.  Because of this, if users do
+// not need to always be capturing, it is simple to stop and restart the capture
+// later (just by ceasing to supply packets, then resuming later on).  Payloads
+// do not need to be uniform in size either, clients may specify payloads of
+// whatever granularity is appropriate.
+//
+// The primary downside of operating in synchronous mode is that two messages
+// will need to be sent for every packet to be captured.  One to inform the
+// AudioCapturer of the instance to capture into, and one to inform the user
+// that the packet has been captured.  This may end up increasing overhead and
+// potentially complicating client designs.
+//
+// Asynchronous mode has the advantage requiring only 1/2 of the messages,
+// however, when operating in 'async' mode, AudioCapturer instances have no way
+// of knowing if a user is processing the StreamPackets being sent in a timely
+// fashion, and no way of automatically detecting an overflow condition.  Users
+// of 'async' mode should be careful to use a buffer large enough to ensure that
+// they will be able to process their data before an AudioCapturer will be
+// forced to overwrite it.
+//
+// ** Future Directions (aka TODOs) **
+//
+// ++ Consider adding a 'zero message' capture mode where the AudioCapturer
+//    simply supplies a linear transformation and some buffer parameters (max
+//    audio hold time) each time that it is started in 'async' mode, or each
+//    time an internal overflow occurs in 'async' mode.  Based on this
+//    information, client should know where the capture write pointer is at all
+//    times as a function of the transformation removing the need to send any
+//    buffer position messages.  This would reduce the operational overhead just
+//    about as low as it could go, and could allow for the lowest possible
+//    latency for capture clients.  OTOH - it might be better to achieve this
+//    simply by allowing clients to be granted direct, exclusive access to the
+//    driver level of capture if no resampling, reformatting, or sharing is
+//    needed.
+// ++ Consider providing some mechanism by which users may specify the exact
+//    time at which they want to capture data.
+// ++ Allow for more complex routing/mixing/AEC scenarios and place this under
+//    the control of the policy manager.
+// ++ Define and enforce access permissions and downsampling requirements for
+//    sensitive content.  Enforce using the policy manager.
+// ++ Consider allowing the mixer to produce compressed audio.
+//
+// Ordinal range: 0x0500-0x5ff
+[FragileBase]
+interface AudioCapturer : StreamBufferSet, StreamSource {
+    // Sets the stream type of the stream to be delivered.  Causes the source
+    // material to be reformatted/resampled if needed in order to produce the
+    // requested stream type.  Note that the stream type may not be changed after
+    // the payload buffer has been established.
+    0x0501: SetPcmStreamType(AudioStreamType stream_type);
+
+    // Explicitly specify a region of the shared payload buffer for the audio
+    // input to capture into.
+    0x0502: CaptureAt(uint32 payload_buffer_id, uint32 payload_offset,
+                      uint32 frames) -> (StreamPacket captured_packet);
+
+    // Place the AudioCapturer into 'async' capture mode and begin to produce packets
+    // of exactly 'frames_per_packet' number of frames each. The
+    // OnPacketProduced event (of StreamSink) will be used to inform the client of
+    // produced packets.
+    0x0503: StartAsyncCapture(uint32 frames_per_packet);
+
+    // Stop capturing in 'async' capture mode and (optionally) deliver a
+    // callback that may be used by the client if explicit synchronization
+    // is needed.
+    0x0504: StopAsyncCapture() -> ();
+    0x0505: StopAsyncCaptureNoReply();
+
+    // Binds to the gain control for this AudioCapturer.
+    0x0506: BindGainControl(request<GainControl> gain_control_request);
+
+    /////////////////////////////////////////////////////////////////////////////
+    // StreamBufferSet methods
+    // See stream.fidl.
+
+    /////////////////////////////////////////////////////////////////////////////
+    // StreamSource methods
+    // See stream.fidl.
+
+    /////////////////////////////////////////////////////////////////////////////
+    // Methods to be deprecated
+    // These methods will go away.
+
+    // Gets the currently configured stream type. Note: for an AudioCapturer which was
+    // just created and has not yet had its stream type explicitly set, this will
+    // retrieve the stream type -- at the time the AudioCapturer was created -- of the
+    // source (input or looped-back output) to which the AudioCapturer is bound.
+    //
+    // TODO(mpuryear): Get rid of this. Eventually, AudioCapturers will be bindable to
+    // a set of inputs/outputs/renderers, so the concept of a "native" stream type
+    // will go away. Mechanisms will need to be put in place to allow users to
+    // enumerate the configuration of these bind-able endpoints (and perhaps to
+    // exercise control over them), but it will be the user of the AudioCapturer's job
+    // to specify the format they want.
+    0xffff: GetStreamType() -> (StreamType stream_type);
+};
diff --git a/fidl/fuchsia.media/audio_device_enumerator.fidl b/fidl/fuchsia.media/audio_device_enumerator.fidl
new file mode 100644
index 0000000..807b5c6
--- /dev/null
+++ b/fidl/fuchsia.media/audio_device_enumerator.fidl
@@ -0,0 +1,103 @@
+// 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.media;
+
+const uint32 AudioGainInfoFlag_Mute = 0x01;
+const uint32 AudioGainInfoFlag_AgcSupported = 0x02;
+const uint32 AudioGainInfoFlag_AgcEnabled = 0x04;
+
+struct AudioGainInfo {
+    float32 gain_db;
+    uint32 flags;
+};
+
+struct AudioDeviceInfo {
+    string name;
+    string unique_id;
+    uint64 token_id;
+    bool is_input;
+
+    // TODO(mpuryear): Verify whether or not we want to leave this stuff in place
+    // or not. Technically it is not needed (all of these things could be
+    // queried), but it seems like useful information to send during device
+    // enumeration as it saves a user a round trip to the server and eliminates
+    // any need to have extra states in a user's state machine when trying to
+    // figure out the current state of a device during initial enumeration.
+    AudioGainInfo gain_info;
+    bool is_default;
+};
+
+const uint32 SetAudioGainFlag_GainValid = 0x01;
+const uint32 SetAudioGainFlag_MuteValid = 0x02;
+const uint32 SetAudioGainFlag_AgcValid = 0x04;
+
+[Discoverable]
+interface AudioDeviceEnumerator {
+    // Obtain the list of currently active audio devices.
+    100: GetDevices() -> (vector<AudioDeviceInfo> devices);
+
+    // Events sent when devices are added or removed, or when properties of a
+    // device change.
+    //
+    // TODO(mpuryear): Should we have a set of filters which control which of these
+    // events a user receives?
+    //
+    // Pro: Having filters like this removes the need for the server to send
+    // messages to clients who don't care. In particular, it seems likely that a
+    // client who just called SetDeviceGain will not care about the
+    // OnDeviceGainChanged event being fired.
+    //
+    // Con: Having filters like this means that the server needs to maintain a bit
+    // more per-client state.
+    110: -> OnDeviceAdded(AudioDeviceInfo device);
+    111: -> OnDeviceRemoved(uint64 device_token);
+    112: -> OnDeviceGainChanged(uint64 device_token, AudioGainInfo gain_info);
+    113: -> OnDefaultDeviceChanged(uint64 old_default_token,
+                                   uint64 new_default_token);
+
+    // Gain/Mute/AGC control
+    //
+    // Note that each of these operations requires a device_token in order to
+    // target the proper input/output.
+    //
+    // The Get command returns the device_token
+    // of the device whose gain is being reported, or ZX_KOID_INVALID in the case
+    // that the requested device_token was invalid or the device had been removed
+    // from the system before the Get command could be processed.
+    //
+    // Set commands which are given an invalid device token are ignored and have
+    // no effect on the system. In addition, users do not need to control all of
+    // the gain settings for an audio device with each call. Only the settings
+    // with a corresponding flag set in the set_flags parameter will be affected.
+    // For example, passing SetAudioGainFlag_MuteValid will cause a SetDeviceGain
+    // call to care only about the mute setting in the gain_info structure, while
+    // passing (SetAudioGainFlag_GainValid | SetAudioGainFlag_MuteValid) will
+    // cause both the mute and the gain status to be changed simultaneously.
+    200: GetDeviceGain(uint64 device_token)
+             -> (uint64 device_token, AudioGainInfo gain_info);
+    201: SetDeviceGain(uint64 device_token,
+                       AudioGainInfo gain_info,
+                       uint32 set_flags);
+
+    // Default Device
+    //
+    // Fetch the device ID of the current default input or output device, or
+    // ZX_KOID_INVALID if no such device exists.
+    //
+    // TODO(mpuryear): solidify the concept of "default" device. Right now, it
+    // basically means the device which would be chosen as the destination of an
+    // AudioRenderer stream (or the source for an AudioCapturer stream), in the
+    // absence of...
+    //
+    // 1) Any manual routing configuration imposed by the user.
+    // 2) Any property based routing decision made by the audio service.
+    //
+    // Currently, this translates to "the default inputs/output will be the last
+    // plugged input/output". As the human level logic which drives the audio
+    // routing policy evolves and becomes more complicated, this will probably
+    // change.
+    300: GetDefaultInputDevice() -> (uint64 device_token);
+    301: GetDefaultOutputDevice() -> (uint64 device_token);
+};
diff --git a/fidl/fuchsia.media/audio_renderer.fidl b/fidl/fuchsia.media/audio_renderer.fidl
new file mode 100644
index 0000000..525eee1
--- /dev/null
+++ b/fidl/fuchsia.media/audio_renderer.fidl
@@ -0,0 +1,287 @@
+// 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.media;
+
+//
+// AudioRenderers can be in one of two states at any point in time, either
+// the configurable state or the operational state. A renderer is considered
+// to be operational any time it has packets queued and waiting to be
+// rendered; otherwise it is considered to be in the configurable state. When an
+// AudioRenderer has entered the operational state of its life, any attempt to
+// call a config method in the interface is considered to be illegal and will
+// result in termination of the interface's connection to the audio service.
+//
+// If an AudioRenderer must be reconfigured, it is best practice to always call
+// `DiscardAllPackets` on the AudioRenderer, before starting to reconfigure it.
+//
+
+// Ordinal range: 0x0600-0x6ff
+[FragileBase]
+interface AudioRenderer : StreamBufferSet, StreamSink {
+    // Sets the type of the stream to be delivered by the client. Using this
+    // method implies that the stream encoding is AUDIO_ENCODING_LPCM.
+    0x0601: SetPcmStreamType(AudioStreamType type);
+
+    // Sets the stream type to be delivered by the client. This method is used for
+    // compressed pass-through. The media_specific field must be of type audio.
+    // NOTE: Not currently implemented.
+    0x0602: SetStreamType(StreamType type);
+
+    // Sets the units used by the presentation (media) timeline. By default, PTS
+    // units are nanoseconds (as if this were called with values of 1e9 and 1).
+    0x0603: SetPtsUnits(uint32 tick_per_second_numerator,
+                        uint32 tick_per_second_denominator);
+
+    // Sets the maximum threshold (in frames) between an explicit PTS (user-
+    // provided) and an expected PTS (determined using interpolation). Beyond this
+    // threshold, a stream is no longer considered 'continuous' by the renderer.
+    //
+    // Defaults to RoundUp((AudioFPS/PTSTicksPerSec) / 2.0) / AudioFPS
+    // Most users should not need to change this value from its default.
+    //
+    // Example:
+    // A user is playing back 48KHz audio from a container, which also contains
+    // video and needs to be synchronized with the audio. The timestamps are
+    // provided explicitly per packet by the container, and expressed in mSec
+    // units. This means that a single tick of the media timeline (1 mSec)
+    // represents exactly 48 frames of audio. The application in this scenario
+    // delivers packets of audio to the AudioRenderer, each with exactly 470
+    // frames of audio, and each with an explicit timestamp set to the best
+    // possible representation of the presentation time (given this media clock's
+    // resolution). So, starting from zero, the timestamps would be..
+    //
+    // [ 0, 10, 20, 29, 39, 49, 59, 69, 78, 88, ... ]
+    //
+    // In this example, attempting to use the presentation time to compute the
+    // starting frame number of the audio in the packet would be wrong the
+    // majority of the time. The first timestamp is correct (by definition), but
+    // it will be 24 packets before the timestamps and frame numbers come back
+    // into alignment (the 24th packet would start with the 11280th audio frame
+    // and have a PTS of exactly 235).
+    //
+    // One way to fix this situation is to set the PTS continuity threshold
+    // (henceforth, CT) for the stream to be equal to 1/2 of the time taken by the
+    // number of frames contained within a single tick of the media clock, rounded
+    // up. In this scenario, that would be 24.0 frames of audio, or 500 uSec.
+    // Any packets whose expected PTS was within +/-CT frames of the explicitly
+    // provided PTS would be considered to be a continuation of the previous frame
+    // of audio.
+    //
+    // Other possible uses:
+    // Users who are scheduling audio explicitly, relative to a clock which has
+    // not been configured as the reference clock, can use this value to control
+    // the maximum acceptable synchronization error before a discontinuity is
+    // introduced. E.g., if a user is scheduling audio based on a recovered common
+    // media clock, and has not published that clock as the reference clock, and
+    // they set the CT to 20mSec, then up to 20mSec of drift error can accumulate
+    // before the AudioRenderer deliberately inserts a presentation discontinuity
+    // to account for the error.
+    //
+    // Users whose need to deal with a container where their timestamps may be
+    // even less correct than +/- 1/2 of a PTS tick may set this value to
+    // something larger. This should be the maximum level of inaccuracy present
+    // in the container timestamps, if known. Failing that, it could be set to
+    // the maximum tolerable level of drift error before absolute timestamps are
+    // explicitly obeyed. Finally, a user could set this number to a very large
+    // value (86400.0 seconds, for example) to effectively cause *all* timestamps
+    // to be ignored after the first, thus treating all audio as continuous with
+    // previously delivered packets. Conversely, users who wish to *always*
+    // explicitly schedule their audio packets exactly may specify a CT of 0.
+    //
+    0x0604: SetPtsContinuityThreshold(float32 threshold_seconds);
+
+    // Set the reference clock used to control playback rate.
+    //
+    // TODO(mpuryear): refine this type when we solidly define what a clock handle
+    // is/looks like. Also should we allow users to lock their rates to CLOCK_MONO
+    // instead of following the default (perhaps dynamic) system rate?
+    0x0605: SetReferenceClock(handle reference_clock);
+
+    // Immediately put the AudioRenderer into a playing state. Start the advance
+    // of the media timeline, using specific values provided by the caller (or
+    // default values if not specified). In an optional callback, return the
+    // timestamp values ultimately used -- these set the ongoing relationship
+    // between the media and reference timelines (i.e., how to translate between
+    // the domain of presentation timestamps, and the realm of local system time).
+    //
+    // Local system time is specified in units of nanoseconds; media_time is
+    // specified in the units defined by the user in the `SetPtsUnits` function,
+    // or nanoseconds if `SetPtsUnits` is not called.
+    //
+    // The act of placing an AudioRenderer into the playback state establishes a
+    // relationship between 1) the user-defined media (or presentation) timeline
+    // for this particular AudioRenderer, and 2) the real-world system reference
+    // timeline. To communicate how to translate between timelines, the Play()
+    // callback provides an equivalent timestamp in each time domain. The first
+    // value ('reference_time') is given in terms of the local system clock; the
+    // second value ('media_time') is what media instant exactly corresponds to
+    // that local time. Restated, the frame at 'media_time' in the audio stream
+    // should be presented at system local time 'reference_time'.
+    //
+    // Note: on calling this API, media_time immediately starts advancing. It is
+    // possible, although uncommon, for a caller to specify a system time that is
+    // far in the past, or far into the future. This, along with the specified
+    // media time, is simply used to determine what media time corresponds to
+    // 'now', and THAT media time is then intersected with presentation
+    // timestamps of packets already submitted, to determine which media frames
+    // should be presented next.
+    //
+    // With the corresponding reference_time and media_time values, a user can
+    // translate arbitrary time values from one timeline into the other. After
+    // calling `SetPtsUnits(pts_per_sec_numerator, pts_per_sec_denominator)` and
+    // given the 'ref_start' and 'media_start' values from `Play()`, then for any
+    // 'ref_time':
+    //
+    // media_time = ( (ref_time - ref_start) / 1e9
+    //                * (pts_per_sec_numerator / pts_per_sec_denominator) )
+    //              + media_start
+    //
+    // Conversely, for any presentation timestamp 'media_time':
+    //
+    // ref_time = ( (media_time - media_start)
+    //              * (pts_per_sec_denominator / pts_per_sec_numerator)
+    //              * 1e9 )
+    //            + ref_start
+    //
+    // Users, depending on their use case, may optionally choose not to specify
+    // one or both of these timestamps. A timestamp may be omitted by supplying
+    // the special value 'kNoTimestamp'. The AudioRenderer automatically deduces
+    // any omitted timestamp value using the following rules:
+    //
+    // Reference Time
+    // If 'reference_time' is omitted, the AudioRenderer will select a "safe"
+    // reference time to begin presentation, based on the minimum lead times for
+    // the output devices that are currently bound to this AudioRenderer. For
+    // example, if an AudioRenderer is bound to an internal audio output
+    // requiring at least 3 mSec of lead time, and an HDMI output requiring at
+    // least 75 mSec of lead time, the AudioRenderer might (if 'reference_time'
+    // is omitted) select a reference time 80 mSec from now.
+    //
+    // Media Time
+    // If media_time is omitted, the AudioRenderer will select one of two values.
+    // - If the AudioRenderer is resuming from the paused state, and packets have
+    // not been discarded since being paused, then the AudioRenderer will use a
+    // media_time corresponding to the instant at which the presentation became
+    // paused.
+    // - If the AudioRenderer is being placed into a playing state for the first
+    // time following startup or a 'discard packets' operation, the initial
+    // media_time will be set to the PTS of the first payload in the pending
+    // packet queue. If the pending queue is empty, initial media_time will be
+    // set to zero.
+    //
+    // Return Value
+    // When requested, the AudioRenderer will return the 'reference_time' and
+    // 'media_time' which were selected and used (whether they were explicitly
+    // specified or not) in the return value of the play call.
+    //
+    // Examples
+    // 1. A user has queued some audio using `SendPacket` and simply wishes them
+    // to start playing as soon as possible. The user may call Play without
+    // providing explicit timestamps -- `Play(kNoTimestamp, kNoTimestamp)`.
+    //
+    // 2. A user has queued some audio using `SendPacket`, and wishes to start
+    // playback at a specified 'reference_time', in sync with some other media
+    // stream, either initially or after discarding packets. The user would call
+    // `Play(reference_time, kNoTimestamp)`.
+    //
+    // 3. A user has queued some audio using `SendPacket`. The first of these
+    // packets has a PTS of zero, and the user wishes playback to begin as soon as
+    // possible, but wishes to skip all of the audio content between PTS 0 and PTS
+    // 'media_time'. The user would call `Play(kNoTimestamp, media_time)`.
+    //
+    // 4. A user has queued some audio using `SendPacket` and want to present this
+    // media in synch with another player in a different device. The coordinator
+    // of the group of distributed players sends an explicit message to each
+    // player telling them to begin presentation of audio at PTS 'media_time', at
+    // the time (based on the group's shared reference clock) 'reference_time'.
+    // Here the user would call `Play(reference_time, media_time)`.
+    //
+    // TODO(mpuryear): Define behavior in the case that a user calls `Play` while
+    // the system is already playing. We should probably do nothing but return a
+    // valid correspondence pair in response -- unless both reference and media
+    // times are provided (and do not equate to the current timeline
+    // relationship), in which case we should introduce a discontinuity.
+    //
+    // TODO(mpuryear): Collapse these if we ever have optional retvals in FIDL
+    0x0606: Play(int64 reference_time, int64 media_time)
+                -> (int64 reference_time, int64 media_time);
+    0x0607: PlayNoReply(int64 reference_time, int64 media_time);
+
+    // Immediately put the AudioRenderer into the paused state and then report the
+    // relationship between the media and reference timelines which was
+    // established (if requested).
+    //
+    // TODO(mpuryear): Define behavior in the case that a user calls `Pause` while
+    // the system is already in the paused state. We should probably do nothing
+    // but provide a valid correspondence pair in response.
+    //
+    // TODO(mpuryear): Collapse these if we ever have optional retvals in FIDL
+    0x0608: Pause() -> (int64 reference_time, int64 media_time);
+    0x0609: PauseNoReply();
+
+    // Enable or disable notifications about changes to the minimum clock lead
+    // time (in nanoseconds) for this AudioRenderer. Calling this method with
+    // 'enabled' set to true will trigger an immediate `OnMinLeadTimeChanged`
+    // event with the current minimum lead time for the AudioRenderer. If the
+    // value changes, an `OnMinLeadTimeChanged` event will be raised with the new
+    // value. This behavior will continue until the user calls
+    // `EnableMinLeadTimeEvents(false)`.
+    //
+    // The minimum clock lead time is the amount of time ahead of the reference
+    // clock's understanding of "now" that packets needs to arrive (relative to
+    // the playback clock transformation) in order for the mixer to be able to mix
+    // packet. For example...
+    //
+    // ++ Let the PTS of packet X be P(X)
+    // ++ Let the function which transforms PTS -> RefClock be R(p) (this function
+    //    is determined by the call to Play(...)
+    // ++ Let the minimum lead time be MLT
+    //
+    // If R(P(X)) < RefClock.Now() + MLT
+    // Then the packet is late, and some (or all) of the packet's payload will
+    // need to be skipped in order to present the packet at the scheduled time.
+    //
+    // TODO(mpuryear): What should the units be here?  Options include...
+    //
+    // 1) Normalized to nanoseconds (this is the current API)
+    // 2) Reference clock units (what happens if the reference clock changes?)
+    // 3) PTS units (what happens when the user changes the PTS units?)
+    //
+    // TODO(mpuryear): Should `EnableMinLeadTimeEvents` have an optional -> ()
+    // return value for synchronization purposes?  Probably not; users should be
+    // able to send a disable request and clear their event handler if they no
+    // longer want notifications. Their in-process dispatcher framework can handle
+    // draining and dropping any lead time changed events that were already in
+    // flight when the disable message was sent.
+    //
+    0x060a: EnableMinLeadTimeEvents(bool enabled);
+    0x060b: -> OnMinLeadTimeChanged(int64 min_lead_time_nsec);
+
+    // TODO(mpuryear): Eliminate this method when possible. Right now, it is used
+    // by code requiring synchronous FIDL interfaces to talk to AudioRenderers.
+    0x060c: GetMinLeadTime() -> (int64 min_lead_time_nsec);
+
+    // Binds to the gain control for this AudioRenderer.
+    0x060d: BindGainControl(request<GainControl> gain_control_request);
+
+    /////////////////////////////////////////////////////////////////////////////
+    // StreamBufferSet methods
+    // See stream.fidl.
+
+    /////////////////////////////////////////////////////////////////////////////
+    // StreamSink methods
+    // See stream.fidl.
+
+    // TODO(mpuryear): Spec methods/events which can be used for unintentional
+    // discontinuity/underflow detection.
+    //
+    // TODO(mpuryear): Spec methods/events which can be used to report routing
+    // changes. (Presuming that they belong at this level at all; they may belong
+    // on some sort of policy object).
+    //
+    // TODO(mpuryear): Spec methods/events which can be used to report policy
+    // induced gain/ducking changes. (Presuming that they belong at this level at
+    // all; they may belong on some sort of policy object).
+};
diff --git a/fidl/fuchsia.media/gain_control.fidl b/fidl/fuchsia.media/gain_control.fidl
new file mode 100644
index 0000000..a9f2b6d
--- /dev/null
+++ b/fidl/fuchsia.media/gain_control.fidl
@@ -0,0 +1,72 @@
+// 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.media;
+
+enum AudioRamp : uint16 {
+    // Amplitude scale changes evenly ("straight-line") across the ramp duration.
+    SCALE_LINEAR = 1;
+
+    // Additional ramp shapes (easings) may be added in the future, perhaps
+    // including logarithmic (i.e. linear wrt dB), cubic (in/out/inout) or others.
+};
+
+// Ordinal range: 0x0100-0x1ff
+interface GainControl {
+    // Sets the gain in decibels.
+    0x0101: SetGain(float32 gain_db);
+
+    // Smoothly change gain from its current value to specified value, over the
+    // specified duration (in milliseconds). If 'duration_ns' is 0, gain changes
+    // immediately. Otherwise, the gain changes only while the stream is running.
+    //
+    // Any active or pending ramp is cancelled by subsequent call to SetGain.
+    //
+    // There can be at most 1 active ramp at any time. Any active or pending ramp
+    // is replaced by a later call to SetGainWithRamp (even if duration is 0). In
+    // this case gain would ramps directly from its most recent (mid-ramp) value
+    // to the newly-specified one, over the new duration, using the new easing.
+    //
+    // Usage example (using time in seconds):
+    //  Time 0
+    //      SetGainWithRamp(MUTED_GAIN_DB, 0, SCALE_LINEAR)         // Ramp 1
+    //      SetGainWithRamp(0.0f, ZX_SEC(4), SCALE_LINEAR)          // Ramp 2
+    //  Time 3
+    //      PlayNoReply(kNoTimestamp, any_media_time)
+    //  Time 4
+    //      PauseNoReply()
+    //  Time 7
+    //      PlayNoReply(kNoTimestamp, any_media_time)
+    //  Time 8
+    //      SetGainWithRamp(MUTED_GAIN_DB, ZX_SEC(1), SCALE_LINEAR) // Ramp 3
+    //
+    //
+    // Time 0: Ramp 1 completes immediately, changing the gain to MUTED_GAIN_DB.
+    //         Ramp 2 is pending, since we are not in playback.
+    // Time 3, Ramp 2 begins ramping from MUTED_GAIN_DB to 0 dB (scale 0.0=>1.0).
+    // Time 4: Ramp 2 pauses (3s remain). Per SCALE_LINEAR, scale is approx 0.25.
+    // Time 7: Ramp 2 resumes from most recent value toward the target.
+    // Time 8: Ramp 3 replaces Ramp 2 and starts from current scale (approx 0.5).
+    // Time 9: Ramp 3 completes; current scale value is now 0.0 (MUTED_GAIN_DB).
+    //
+    0x0102: SetGainWithRamp(float32 gain_db,
+                            int64 duration_ns,
+                            AudioRamp rampType);
+
+    // Sets the mute value. Ramping and Mute are fully independent, although of
+    // course they both affect the scalingthat is applied to the audio stream(s).
+    0x0103: SetMute(bool muted);
+
+    // Provides current gain/mute values to those who register for notification.
+    //
+    // TODO(mpuryear): provide ramp-related values in this event, as well.
+    //
+    // TODO(mpuryear): notify upon ramp milestones (not just SetGain/Mute) --
+    // upon the start/pause/restart/completion of an active ramp?
+    0x0104: -> OnGainMuteChanged(float32 gain_db, bool muted);
+};
+
+const float32 MUTED_GAIN_DB = -160.0;
+
+const float32 MAX_GAIN_DB = 24.0;
diff --git a/fidl/fuchsia.media/meta.json b/fidl/fuchsia.media/meta.json
new file mode 100644
index 0000000..6619b07
--- /dev/null
+++ b/fidl/fuchsia.media/meta.json
@@ -0,0 +1,24 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.media/audio.fidl", 
+    "fidl/fuchsia.media/audio_capturer.fidl", 
+    "fidl/fuchsia.media/audio_device_enumerator.fidl", 
+    "fidl/fuchsia.media/audio_renderer.fidl", 
+    "fidl/fuchsia.media/gain_control.fidl", 
+    "fidl/fuchsia.media/stream.fidl", 
+    "fidl/fuchsia.media/stream_type.fidl"
+  ], 
+  "name": "fuchsia.media", 
+  "root": "fidl/fuchsia.media", 
+  "sources": [
+    "fidl/fuchsia.media/audio.fidl", 
+    "fidl/fuchsia.media/audio_capturer.fidl", 
+    "fidl/fuchsia.media/audio_device_enumerator.fidl", 
+    "fidl/fuchsia.media/audio_renderer.fidl", 
+    "fidl/fuchsia.media/gain_control.fidl", 
+    "fidl/fuchsia.media/stream.fidl", 
+    "fidl/fuchsia.media/stream_type.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.media/stream.fidl b/fidl/fuchsia.media/stream.fidl
new file mode 100644
index 0000000..a8b871b
--- /dev/null
+++ b/fidl/fuchsia.media/stream.fidl
@@ -0,0 +1,105 @@
+// 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.media;
+
+// Manages a set of payload buffers for a stream.
+// Ordinal range: 0x0200-0x2ff
+[FragileBase]
+interface StreamBufferSet {
+    // Adds a payload buffer for stream packets. StreamPacket structs reference
+    // a payload buffer by ID using the StreamPacket.payload_buffer_id field.
+    0x0201: AddPayloadBuffer(uint32 id, handle<vmo> payload_buffer);
+
+    // Removes a payload buffer.
+    0x0202: RemovePayloadBuffer(uint32 id);
+};
+
+// Consumes a stream of packets.
+// Ordinal range: 0x0300-03ff
+[FragileBase]
+interface StreamSink {
+    // Sends a packet to this object. The response is sent when this object is
+    // done with the associated payload memory.
+    0x0301: SendPacket(StreamPacket packet) -> ();
+
+    // Sends a packet to this object. This interface doesn't define how the client
+    // knows when the sink is done with the associated payload memory. The
+    // inheriting interface must define that.
+    0x0302: SendPacketNoReply(StreamPacket packet);
+
+    // Indicates the stream has ended.
+    0x0303: EndOfStream();
+
+    // Discards packets previously sent via SendPacket or SendPacketNoReply.
+    0x0304: DiscardAllPackets() -> ();
+    0x0305: DiscardAllPacketsNoReply();
+};
+
+// Produces a stream of packets.
+// Ordinal range: 0x0400-04ff
+[FragileBase]
+interface StreamSource {
+    // Delivers a packet produced by this object. Each packet delivered via this
+    // event must be released with a call to ReleasePacket.
+    0x0401: -> OnPacketProduced(StreamPacket packet);
+
+    // Indicates that the stream has ended.
+    0x0402: -> OnEndOfStream();
+
+    // Releases a packet delivered via OnPacketProduced.
+    0x0403: ReleasePacket(StreamPacket packet);
+
+    // Discards queued packets.
+    0x0404: DiscardAllPackets() -> ();
+    0x0405: DiscardAllPacketsNoReply();
+};
+
+// A StreamSink that uses StreamBufferSet for buffer management.
+interface SimpleStreamSink : StreamSink, StreamBufferSet {
+    ////////////////////////////////////////////////////////////////////////////
+    // StreamBufferSet methods
+
+    ////////////////////////////////////////////////////////////////////////////
+    // StreamSink methods
+};
+
+// Describes a packet consumed by StreamSink or produced by StreamSource.
+struct StreamPacket {
+    // Time at which the packet is to be presented, according to the presentation
+    // clock.
+    int64 pts = NO_TIMESTAMP;
+
+    // ID of the payload buffer used for this packet. When this struct is used
+    // with StreamBufferSet, this field is the ID of a payload buffer provided
+    // via StreamBufferSet.AddPayloadBuffer. Other interfaces may define other
+    // semantics for this field.
+    uint32 payload_buffer_id;
+
+    // Offset of the packet payload in the payload buffer.
+    uint64 payload_offset;
+
+    // Size in bytes of the payload.
+    uint64 payload_size;
+
+    // A collection of flags (see constants below) describing properties of this
+    // packet.
+    uint32 flags = 0;
+
+    // The buffer configuration associated with this packet. The semantics of
+    // this field depend on the the interface with which this struct is used.
+    // In many contexts, this field is not used.
+    uint64 buffer_config = 0;
+
+    // The stream associated with this packet. The semantics of this field
+    // depend on the the interface with which this struct is used. In many
+    // contexts, this field is not used.
+    uint64 stream_id = 0;
+};
+
+const uint32 STREAM_PACKET_FLAG_KEY_FRAME = 0x01;
+const uint32 STREAM_PACKET_FLAG_DROPPABLE = 0x02;
+const uint32 STREAM_PACKET_FLAG_DISCONTINUITY = 0x04;
+
+const int64 NO_TIMESTAMP = 0x7fffffffffffffff;
diff --git a/fidl/fuchsia.media/stream_type.fidl b/fidl/fuchsia.media/stream_type.fidl
new file mode 100644
index 0000000..e37e010
--- /dev/null
+++ b/fidl/fuchsia.media/stream_type.fidl
@@ -0,0 +1,158 @@
+// 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.media;
+
+// Describes the type of an elementary stream.
+struct StreamType {
+    // Medium-specific type information.
+    MediumSpecificStreamType medium_specific;
+
+    // Encoding (see constants below).
+    string encoding;
+
+    // Encoding-specific parameters.
+    vector<uint8>? encoding_parameters;
+};
+
+// A union of all medium-specific stream type structs.
+union MediumSpecificStreamType {
+    AudioStreamType audio;
+    VideoStreamType video;
+    TextStreamType text;
+    SubpictureStreamType subpicture;
+};
+
+const string MEDIA_ENCODING_UNSUPPORTED = "fuchsia.media.unsupported";
+
+const string AUDIO_ENCODING_AAC = "fuchsia.media.aac";
+const string AUDIO_ENCODING_AMRNB = "fuchsia.media.amrnb";
+const string AUDIO_ENCODING_AMRWB = "fuchsia.media.amrwb";
+const string AUDIO_ENCODING_APTX = "fuchsia.media.aptx";
+const string AUDIO_ENCODING_FLAC = "fuchsia.media.flac";
+const string AUDIO_ENCODING_GSMMS = "fuchsia.media.gsmms";
+const string AUDIO_ENCODING_LPCM = "fuchsia.media.lpcm";
+const string AUDIO_ENCODING_MP3 = "fuchsia.media.mp3";
+const string AUDIO_ENCODING_PCMALAW = "fuchsia.media.pcmalaw";
+const string AUDIO_ENCODING_PCMMULAW = "fuchsia.media.pcmmulaw";
+const string AUDIO_ENCODING_SBC = "fuchsia.media.sbc";
+const string AUDIO_ENCODING_VORBIS = "fuchsia.media.vorbis";
+
+const string VIDEO_ENCODING_H263 = "fuchsia.media.h263";
+const string VIDEO_ENCODING_H264 = "fuchsia.media.h264";
+const string VIDEO_ENCODING_MPEG4 = "fuchsia.media.mpeg4";
+const string VIDEO_ENCODING_THEORA = "fuchsia.media.theora";
+const string VIDEO_ENCODING_UNCOMPRESSED = "fuchsia.media.uncompressed_video";
+const string VIDEO_ENCODING_VP3 = "fuchsia.media.vp3";
+const string VIDEO_ENCODING_VP8 = "fuchsia.media.vp8";
+const string VIDEO_ENCODING_VP9 = "fuchsia.media.vp9";
+
+///////////////////////////////////////////////////////////////////////////////
+// Audio
+
+// Describes the type of an audio elementary stream.
+struct AudioStreamType {
+    AudioSampleFormat sample_format;
+    uint32 channels;
+    uint32 frames_per_second;
+    // TODO(mpuryear): Add channel config.
+};
+
+enum AudioSampleFormat {
+    // 8-bit unsigned samples, sample size 1 byte.
+    UNSIGNED_8 = 1;
+
+    // 16-bit signed samples, host-endian, sample size 2 bytes.
+    SIGNED_16 = 2;
+
+    // 24-bit signed samples in 32 bits, host-endian, sample size 4 bytes.
+    SIGNED_24_IN_32 = 3;
+
+    // 32-bit floating-point samples, sample size 4 bytes.
+    FLOAT = 4;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Video
+
+// Describes the type of a video elementary stream.
+struct VideoStreamType {
+    VideoProfile profile;
+    // TODO(dalesat): Use fuchsia.images.PixelFormat.
+    PixelFormat pixel_format;
+    // TODO(dalesat): Use fuchsia.images.ColorSpace.
+    ColorSpace color_space;
+    uint32 width;
+    uint32 height;
+    uint32 coded_width;
+    uint32 coded_height;
+    uint32 pixel_aspect_ratio_width;
+    uint32 pixel_aspect_ratio_height;
+    // TODO(dalesat): Change to single line_stride value for all planes.
+    vector<uint32> line_stride;
+    // TODO(dalesat): Remove.
+    vector<uint32> plane_offset;
+};
+
+// TODO(dalesat): Blindly copied from Chromium, revisit.
+enum VideoProfile {
+    UNKNOWN = 0;
+    NOT_APPLICABLE = 1;
+    H264_BASELINE = 2;
+    H264_MAIN = 3;
+    H264_EXTENDED = 4;
+    H264_HIGH = 5;
+    H264_HIGH10 = 6;
+    H264_HIGH422 = 7;
+    H264_HIGH444_PREDICTIVE = 8;
+    H264_SCALABLE_BASELINE = 9;
+    H264_SCALABLE_HIGH = 10;
+    H264_STEREO_HIGH = 11;
+    H264_MULTIVIEW_HIGH = 12;
+};
+
+// TODO(dalesat): Replace with fuchsia.images.PixelFormat.
+enum PixelFormat {
+    UNKNOWN = 0;
+    I420 = 1; // 12bpp YUV planar 1x1 Y, 2x2 UV samples, a.k.a. YU12.
+    YV12 = 2; // 12bpp YVU planar 1x1 Y, 2x2 VU samples.
+    YV16 = 3; // 16bpp YVU planar 1x1 Y, 2x1 VU samples.
+    YV12A = 4; // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples.
+    YV24 = 5; // 24bpp YUV planar, no subsampling.
+    NV12 = 6; // 12bpp with Y plane followed by a 2x2 interleaved UV plane.
+    NV21 = 7; // 12bpp with Y plane followed by a 2x2 interleaved VU plane.
+    UYVY = 8; // 16bpp interleaved 2x1 U, 1x1 Y, 2x1 V, 1x1 Y samples.
+    YUY2 = 9; // 16bpp interleaved 1x1 Y, 2x1 U, 1x1 Y, 2x1 V samples.
+    ARGB = 10; // 32bpp ARGB, 1 plane.
+    XRGB = 11; // 24bpp XRGB, 1 plane.
+    RGB24 = 12; // 24bpp BGR, 1 plane.
+    RGB32 = 13; // 32bpp BGRA, 1 plane.
+    MJPEG = 14; // MJPEG compressed.
+    MT21 = 15;
+};
+
+// TODO(dalesat): Replace with fuchsia.images.ColorSpace.
+enum ColorSpace {
+    UNKNOWN = 0;
+    NOT_APPLICABLE = 1;
+    JPEG = 2;
+    HD_REC709 = 3;
+    SD_REC601 = 4;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Text
+
+struct TextStreamType {
+    // TODO(dalesat): Define.
+    uint8 dummy;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Subpicture
+
+struct SubpictureStreamType {
+    // TODO(dalesat): Define.
+    uint8 dummy;
+};
diff --git a/fidl/fuchsia.mediacodec/codec.fidl b/fidl/fuchsia.mediacodec/codec.fidl
new file mode 100644
index 0000000..e5f2bcc
--- /dev/null
+++ b/fidl/fuchsia.mediacodec/codec.fidl
@@ -0,0 +1,1315 @@
+// 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.mediacodec;
+
+// See codec.md for detailed interface documentation.  The comments here are a
+// summary only.  Client implementers should see codec.md for more detail on any
+// message that doesn't seem sufficiently-described here.  Codec server
+// implementers should probably read codec.md before implementing.
+
+// Overview of operation:
+//
+// 1. Create
+//   * create via CodecFactory - see CodecFactory
+// 2. Get input constraints
+//   * OnInputConstraints() - sent unsolicited by codec shortly after codec
+//     creation.
+// 3. Provide input buffers
+//   * SetInputBufferSettings() / AddInputBuffer()
+// 4. Deliver input data
+//   * QueueInputPacket() + OnFreeInputPacket(), for as long as it takes,
+//     possibly working through all input packets repeatedly before...
+// 5. Get output constraints and format
+//   * OnOutputConfig() - may be delivered as early as before
+//     OnInputConstraints() by some codecs, but a client must tolerate as late
+//     as after substantial input data has been delivered including lots of
+//     input packet recycling via OnFreeInputPacket().
+//   * This message can arrive more than once before the first output data.
+// 6. Provide output buffers
+//   * SetOutputBufferSettings() / AddOutputBuffer()
+// 7. Data flows, with optional EndOfStream
+//   * OnOutputPacket() / RecycleOutputPacket() / QueueInputPacket() /
+//     OnFreeInputPacket() / QueueInputEndOfStream() / OnOutputEndOfStream()
+//
+// It's possible to re-use a Codec instance for another stream, and doing so
+// can sometimes skip over re-allocation of buffers.  This can be a useful thing
+// to do for cases like seeking to a new location - at the Codec interface that
+// can look like switching to a new stream.
+
+// CodecBufferConstraints
+//
+// This struct helps ensure that packet count and buffer space are sufficient
+// to avoid major problems.  For example, a video decoder needs sufficient
+// video frame buffers to hold all potential reference frames concurrently +
+// one more video buffer to decode into.  Else, the whole video decode pipe can
+// easily deadlock.
+//
+// The secondary purpose of this struct is to help ensure that packet count and
+// buffer space are sufficient to achieve reasonably performant operation.
+//
+// There are separate instances of this struct for codec input and codec output.
+struct CodecBufferConstraints {
+    // This is a version number the server sets on the constraints to allow the
+    // server to determine when the client has caught up with the latest
+    // constraints sent by the server.  The server won't emit output data until
+    // the client has configured output settings and buffers with a
+    // buffer_constraints_version_ordinal >= the latest
+    // buffer_constraints_version_ordinal that had
+    // buffer_constraints_action_required true.  See
+    // buffer_constraints_action_required comments for more.
+    //
+    // A buffer_constraints_version_ordinal of 0 is not permitted, to simplify
+    // initial state handling.  Other than 0, both odd and even version ordinals
+    // are allowed (in constrast to the stream_lifetime_ordinal, neither the
+    // client nor server ever has a reason to consider the latest version to be
+    // stale, so there would be no benefit to disallowing even values).
+    uint64 buffer_constraints_version_ordinal;
+
+    // default_settings
+    //
+    // These settings are "default" settings, not "recommended" settings.
+    //
+    // These "default" settings can be passed to SetInputBufferSettings() /
+    // SetOutputBufferSettings() as-is without modification, but a client doing
+    // that must still obey the semantics of packet_count_for_client, despite the
+    // codec server not having any way to really know the proper setting for
+    // that field.
+    //
+    // For CodecBufferConstraints fields whose names end in "recommended", the
+    // default_settings will have the corresponding setting field set to that
+    // recommended value.
+    //
+    // The codec promises that these default settings as-is (except for
+    // buffer_lifetime_ordinal) are guaranteed to
+    // satisfy the constraints indicated by the other fields of
+    // CodecBufferConstraints.  While client-side checking that these
+    // settings are within the constraints is likely unnecessary in the client,
+    // the client should still check that these values are within client-side
+    // reasonable-ness bounds before using these values, to avoid letting a codec
+    // server cause problems for the client.
+    //
+    // This structure will always have single_buffer_mode false.  See
+    // single_buffer_mode_allowed for whether single_buffer_mode true is allowed.
+    //
+    // The client must set the buffer_lifetime_ordinal field to a proper value
+    // before sending back to the server.  The 0 initially in this field will be
+    // rejected by the server if sent back as-is.  See comments on
+    // CodecPortBufferSettings.buffer_lifetime_ordinal.
+    CodecPortBufferSettings default_settings;
+
+    // For uncompresesd video, separate and complete frames, each in its own
+    // separate buffer (buffer-per-packet mode), is always a requirement.
+
+    // per_packet_buffer_bytes.*:
+    //
+    // These per-packet buffer bytes constraints apply to both buffer-per-packet
+    // mode and single-buffer mode (see single_buffer_mode).  If
+    // buffer-per-packet mode, the constraints apply to each buffer separately.
+    // If single-buffer mode, the constraints need to be multiplied by the number
+    // of packets to determine the constraints on the single buffer.
+
+    // per_packet_buffer_bytes_min:
+    //
+    // If a client is using buffer per packet mode, each buffer must be at least
+    // this large.  If a client is using single-buffer mode, the one buffer must
+    // be at least per_packet_buffer_bytes_min * packet_count_for_codec_min in
+    // size.
+    uint32 per_packet_buffer_bytes_min;
+    // Must be >= per_packet_buffer_bytes_min.  Delivering more than
+    // this per input packet might not perform any better, and in fact might
+    // perform worse.
+    uint32 per_packet_buffer_bytes_recommended;
+    // Must be >= per_packet_buffer_bytes_recommended.  Can be 0xFFFFFFFF if there
+    // is no explicitly-enforced limit.
+    uint32 per_packet_buffer_bytes_max;
+
+    // Minimum number of packet_count_for_codec.
+    //
+    // Re. input and output:
+    //
+    // This is a strict min for packet_count_for_codec, but a client can use more
+    // packets overall if the client wants to, by using a larger value for
+    // packet_count_for_codec and/or using a non-zero packets_for_client.  A good
+    // reason to do the former would be if the client might tend to deliver a few
+    // not-very-full buffers occasionally - or to have a few extra packets within
+    // which to satisfy codec_input_bytes_min.  A good reason to do the latter
+    // would be if a client needs to hold onto some packets for any "extra"
+    // duration.
+    //
+    // If a client specifies a larger packet_count_for_codec value than
+    // packet_count_for_codec_min, a server is permitted (but not encouraged) to
+    // not make progress until packet_count_for_codec are with the server,
+    // not merely packet_count_for_codec_min.
+    //
+    // For decoder input and audio encoder input: The packet_count_for_codec_min
+    // may or may not contain enough data to allow the codec to make progress
+    // without copying into an internal side buffer.  If there isn't enough data
+    // delivered in packet_count_for_codec_min packets to permit progress, the
+    // codec must copy into its own side buffer internally to make progress.
+    //
+    // If a client intends to use extra packets for client-side purposes, the
+    // client should specify the extra packets in packets_for_client instead of
+    // packet_count_for_codec, but packet_count_for_codec must still be >=
+    // packet_count_for_codec_min.
+    //
+    // See codec.md for more on packet_count_for_codec_min.
+    uint32 packet_count_for_codec_min;
+
+    // This must be at least packet_count_for_codec_min and at most
+    // packet_count_for_codec_recommended_max.
+    //
+    // This value is likely to be used as-is by most clients, so if having one
+    // additional packet is a big performance win in a large percentage of
+    // scenarios, it can be good for the server to include that additional packet
+    // in this value.
+    uint32 packet_count_for_codec_recommended;
+
+    // This can be the same as packet_count_for_codec_max or can be lower.
+    // Values above this value and <= packet_count_for_codec_max are not
+    // recommended by the codec, but should still work given sufficient resoures
+    // available to both the client and the codec.
+    uint32 packet_count_for_codec_recommended_max;
+
+    // This can be 0xFFFFFFFF if there's no codec-enforced max, but codecs are
+    // encouraged to set a large but still plausibly-workable max, and clients
+    // are encouraged to request a number of packets that isn't excessively large
+    // for the client's scenario.
+    uint32 packet_count_for_codec_max;
+
+    // Normally this would be an implicit 0, but for now we have a min so we can
+    // force the total number of packets to be a specific number that we know
+    // works for the moment.
+    uint32 packet_count_for_client_min;
+
+    // packet_count_for_client_max
+    //
+    // The client must set packet_count_for_client to be <=
+    // packet_count_for_client_max.
+    //
+    // This value must be at least 1.  This can be 0xFFFFFFFF if there's no
+    // codec-enforced max.  Clients are encouraged to request a number of
+    // packets that isn't excessively large for the client's scenario.
+    uint32 packet_count_for_client_max;
+
+    // single_buffer_mode_allowed false allows a codec that's not required to
+    // support single-buffer mode for a given input or output the ability to
+    // decline to support single-buffer mode on that input/output.
+    //
+    // All encoder output, regardless of audio or video: server support for
+    // single-buffer mode is optional.  Please see codec.md for all the rules
+    // regarding single-buffer mode on output before using single-buffer mode on
+    // an output.
+    //
+    // Audio decoder output: server support for single-buffer mode is required.
+    //
+    // Video decoder output: There is little reason for a video decoder to
+    // support single-buffer mode on output.  Nearly all video decoders will set
+    // this to false for their output.
+    //
+    // All decoder inputs: Servers must support single-buffer mode on input.  The
+    // client is responsible for managing the input buffer space such that
+    // filling an input packet doesn't over-write any portion of an input packet
+    // already in flight to the codec.
+    //
+    // Encoder inputs: Server support for single-buffer mode on encoder input is
+    // optional.  This is more often useful for audio than for video.
+    //
+    // Support for buffer-per-packet mode is always required on both input and
+    // output, regardless of codec type.
+    bool single_buffer_mode_allowed;
+
+    // If true, the buffers need to be physically contiguous pages, such as can be
+    // allocated using zx_vmo_create_contiguous().
+    bool is_physically_contiguous_required;
+    // VERY TEMPORARY HACK / KLUDGE - we want the BufferAllocator (or one of the
+    // participant drivers that needs physically contiguous buffers) to call
+    // zx_vmo_create_contiguous(), definitely not the Codec client, but until the
+    // BufferAllocator can be reached from a driver, this is to grant the client
+    // special powers it really shouldn't have, very temporarily until
+    // BufferAllocator is hooked up properly at which point this can be removed.
+    // Strictly speaking we could reverse which end allocates buffers in the Codec
+    // interface to avoid this hack even before BufferAllocator, but the overall
+    // path seems shorter if we jump directly from this to using BufferAllocator.
+    handle? very_temp_kludge_bti_handle;
+};
+
+// CodecOutputConfig
+//
+// The codec-controlled output configuration, including both
+// CodecBufferConstraints for the output and CodecFormatDetails for the output.
+//
+// TODO(dustingreen): Need a better name for this struct, but still short
+// hopefully.  It's stuff the codec gets to control, not the client.  It's
+// different than output buffer settings, which the client does get to control
+// to some extent.  It's different than any configurable output settings the
+// client might specifiy for output of an encoder.
+struct CodecOutputConfig {
+    // A client which always immediately re-configures output buffers on reciept
+    // of OnOutputConfig() with buffer_constraints_action_required true can safely
+    // ignore this field.
+    //
+    // A client is permitted to ignore an OnOutputConfig() message even with
+    // buffer_constraints_action_required true if the client knows the server has
+    // already been told to discard the remainder of the stream with the same
+    // stream_lifetime_ordinal or if this stream_lifetime_ordinal field is set to
+    // 0.  The server is required to re-send needed output config via
+    // OnOutputConfig() with new stream_lifetime_ordinal and
+    // buffer_constraints_action_required true, if the the most recent completed
+    // server-side output config isn't what the server wants/needs yet for the
+    // new stream.
+    uint64 stream_lifetime_ordinal;
+
+    // buffer_constraints_action_required
+    //
+    // When the buffer constraints are delivered, they indicate whether action is
+    // required.  A false value here permits delivery of constraints which are
+    // fresher without forcing a buffer reconfiguration.  If this is false, a
+    // client cannot assume that it's safe to immediately re-configure output
+    // buffers.  If this is true, the client can assume it's safe to immediately
+    // configure output buffers once.
+    //
+    // A client is permitted to ignore buffer constraint versions which have
+    // buffer_constraints_action_required false.  The server is not permitted to
+    // change buffer_constraints_action_required from false to true for the same
+    // buffer_constraints_version_ordinal.
+    //
+    // For each configuration, a client must use new buffers, never buffers that
+    // were prevoiusly used for anything else, and never buffers previously used
+    // for any other Codec purposes.  This rule exists for multiple good reasons,
+    // relevant to both mid-stream changes, and changes on stream boundaries.
+    // A client should just use new buffers each time.
+    //
+    // When this is true, the server has already de-refed as many low-level
+    // output buffers as the server can while still performing efficient
+    // transition to the new buffers and will de-ref the rest asap.  A Sync() is
+    // not necessary to achieve non-overlap of resource usage to the extent
+    // efficiently permitted by the formats involved.
+    //
+    // If buffer_constraints_action_required is true, the server _must_ not
+    // deliver more output data until after output buffers have been configured
+    // (or re-configured) by the client.
+    //
+    // See codec.md for more on buffer_constraints_action_required.
+    bool buffer_constraints_action_required;
+    CodecBufferConstraints buffer_constraints;
+
+    // format_details
+    //
+    // It's up to the client to determine if a change in
+    // format_details.format_details_version_ordinal implies any client action is
+    // required, based on particular fields in format_details vs. any old value.
+    // The server guarantees that if the format has changed, then
+    // format_details.format_details_version_ordinal will change, but a change to
+    // format_details.format_details_version_ordinal does not guarantee that the
+    // format details actually changed.  Servers are strongly encouraged to not
+    // change format_details.format_details_version_ordinal other than before the
+    // first output data of a stream unless there is a real mid-stream format
+    // change in the stream.  Unnecessary mid-stream format changes can cause
+    // simpler clients that have no need to handle mid-stream format changes to
+    // just close the channel.  Format changes before the first output data of a
+    // stream are not "mid-stream" in this context - those can be useful for
+    // stream format detection / setup reasons.
+    //
+    // Note that in case output buffers don't really need to be re-configured
+    // despite a format change, a server is encouraged, but not required, to
+    // set buffer_constraints_action_required false on the message that conveys
+    // the new format details.  Simpler servers may just treat the whole output
+    // situation as one big thing and demand output buffer reconfiguration on any
+    // change in the output situation.
+    //
+    // A client may or may not actually handle a new buffer_constraints with
+    // buffer_constraints_action_required false, but the client should always
+    // track the latest format_details.
+    //
+    // An updated format_details is ordered with respect to emitted output
+    // packets, and applies to all subsequent packets until the next
+    // format_details with larger version_ordinal.  A simple client that does not
+    // intend to handle mid-stream format changes should still keep track of the
+    // most recently received format_details until the first output packet
+    // arrives, then lock down the format details, handle those format details,
+    // and verify that any format_details.format_details_version_ordinal received
+    // from the server is the same as the locked-down format_details, until the
+    // client is done with the stream.  Even such a simple client must tolerate
+    // format_details.format_details_version_ordinal changing multiple times
+    // before the start of data output from a stream (any stream - the first
+    // stream or a subsequent stream).  This allows a codec to request that
+    // output buffers and output format be configured speculatively, and for the
+    // output config to be optionally adjusted by the server before the first
+    // data output from a stream after the server knows everything it needs to
+    // know to fully establish the initial output format details.  This
+    // simplifies codec server implementation, and allows a clever codec server
+    // to guess it's output config for lower latency before any input data, while
+    // still being able to fix the output config (including format details) if
+    // the guess turns out to be wrong.
+    //
+    // Whether the format_details.format_details_version_ordinal will actually
+    // change mid-stream is a per-codec and per-stream detail that is not
+    // specified in comments here, and in most cases also depends on whether the
+    // format changes on the input to the codec.  Probably it'll be fairly common
+    // for a client to use a format which technically supports mid-stream format
+    // change, but the client happens to know that none of the streams the client
+    // intends to process will ever have a mid-stream format change.
+    CodecFormatDetails format_details;
+};
+
+// Default values for input and output
+// CodecBufferConstraints.default_settings.packet_count_for_codec.
+//
+// These are defined as "const" in FIDL to avoid all server implementations
+// needing to separately define their own values, and these should be
+// reasonable as default values, but strictly speaking this is not intended to
+// promise that this value won't change from build to build.  If a client cares
+// about a specific number, the client should separately define what that
+// number is and ensure that CodecPortBufferSettings.packet_count_for_client is
+// at least large enough.
+//
+// In contrast to packet_count_for_client, the packet_count_for_codec is much
+// more codec-specific, so this file has no numbers for that - each codec will
+// set those as appropriate for the specific codec.
+//
+// These are not "recommended" values, only "default" values, in the sense that
+// the codec doesn't really know what the correct setting for these values is
+// for a given client, and if the default is not appropriate for a client,
+// large problems could result such as deadlock.  See the comments on
+// packet_count_for_client.
+//
+// Despite these defaults, every client should ideally care about the
+// packet_count_for_client setting and should ensure that the setting is at
+// least large enough to cover the number of packets the client might ever need
+// to camp on for any non-transient duration concurrently.  The defaults are
+// only intended to be plausible for some clients, not all clients.
+//
+// One for the client to be filling and one in transit.
+const uint32 kDefaultInputPacketCountForClient = 2;
+// One for the client to be rendering, and one in transit.
+const uint32 kDefaultOutputPacketCountForClient = 2;
+
+// For input, this is the default on a fairly arbitrary basis.
+//
+// TODO(dustingreen): Do we want the default for audio encoding to be
+// single_buffer_mode true instead?  If so, we may split this up by audio/video
+// encoder/decoder.
+const bool kDefaultInputIsSingleBufferMode = false;
+const bool kDefaultOutputIsSingleBufferMode = false;
+
+// CodecPortBufferSettings
+//
+// See relevant corresponding constraints in CodecBufferConstraints.  The
+// settings must satisfy the constraints.
+//
+// The client informs the codec of these settings and then separately informs
+// the codec of each buffer.
+//
+// TODO(dustingreen): Rename from CodecPortBufferSettings to CodecBufferSettings
+// in a separate CL (after some other stuff is out of the way first).
+struct CodecPortBufferSettings {
+    // buffer_lifetime_ordinal
+    //
+    // The containing message starts a new buffer_lifetime_ordinal.
+    //
+    // There is a separate buffer_lifetime_ordinal for input vs. output.
+    //
+    // Re-use of the same value is not allowed.  Values must be odd.  Values must
+    // only increase (increasing by more than 2 is permitted).
+    //
+    // A buffer_lifetime_ordinal lifetime starts at SetInputBufferSettings() or
+    // SetOutputBufferSettings(), and ends at the the earlier of
+    // CloseCurrentStream() with release_input_buffers/release_output_buffers set
+    // or SetOutputBufferSettings() with new buffer_lifetime_ordinal in the case
+    // of mid-stream output config change.
+    //
+    // See codec.md for more on buffer_lifetime_ordinal.
+    uint64 buffer_lifetime_ordinal;
+
+    // buffer_constraints_version_ordinal
+    //
+    // This value indicates which version of constraints the client is/was aware
+    // of so far.
+    //
+    // For input, this must always be 0 because constraints don't change for
+    // input (settings can change, but there's no settings vs current constraints
+    // synchronization issue on input).
+    //
+    // For output, this allows the server to know when the client is sufficiently
+    // caught up before the server will generate any more output.
+    //
+    // When there is no active stream, a client is permitted to re-configure
+    // buffers again using the same buffer_constraints_version_ordinal.
+    //
+    // See codec.md for more on buffer_constraints_version_ordinal.
+    uint64 buffer_constraints_version_ordinal;
+
+    // The total packet count is split into two pieces to disambiguate how many
+    // packets are allocated for the client to hold onto for whatever reason, vs.
+    // how many packets are allocated for the server to hold onto for whatever
+    // reason.
+    //
+    // Extra packets to provide slack for peformance reasons can be in either
+    // category, but typically packet_count_for_codec_recommended will already
+    // include any performance-relevant slack for the server's benefit.
+
+    // packet_count_for_codec
+    //
+    // How many packets the client is allocating for the codec server's use.
+    // This must be >= CodecBufferConstraints.packet_count_for_codec_min.  If
+    // constraints change such that this would no longer be true, the server will
+    // send an OnOutputConfig() event.
+    //
+    // The codec server is allowed to demand that all of packet_count_for_codec
+    // become free before making further progress, even if
+    // packet_count_for_codec is > packet_count_for_codec_min.
+    //
+    // A reasonable value for this is
+    // CodecBufferConstraints.packet_count_for_codec_recommended.
+    //
+    // See codec.md for more on packet_count_for_codec.
+    uint32 packet_count_for_codec;
+
+    // packet_count_for_client
+    //
+    // This must be at least 1.  The server will close the channel if this is 0.
+    //
+    // How many packets the client is allocating for the client's use.  The
+    // client may hold onto this many packets for arbitrarily-long duration
+    // without handing these packets to the codec, and despite doing so, the
+    // codec will continue to make progress and function normally without getting
+    // stuck.  The client holding onto additional packets transiently is ok, but
+    // the client needs to hand those additional packets back to the codec
+    // eventually if the client wants the codec to make further progress.
+    //
+    // In addition to this value needing to include at least as many packets as
+    // the client ever intends to concurrently camp on indefinitely, any extra
+    // slack to benefit client-side performance should also be included here.
+    //
+    // A typical value for this could be at least 2, but it depends strongly on
+    // client implementation and overall client buffering goals.  It is up to the
+    // client to determine how many packets are needed in this category by any
+    // parts of the overall system that will be holding onto packets for any
+    // reason.  Those parts of the system should have a documented and possibly
+    // queryable defined value to help determine this number.  Setting this value
+    // lower than it actaully needs to be can result in the codec not making
+    // progress as it sits waiting for packets, with the client unable to recycle
+    // any more packets to the codec.  That situation can be difficult to
+    // diagnose, while excessively-large values here are wasteful, so care is
+    // warranted to set this value properly.
+    uint32 packet_count_for_client;
+
+    // per_packet_buffer_bytes
+    //
+    // In buffer-per-packet mode, we require that each buffer have usable bytes
+    // equal to per_packet_buffer_bytes.  Use of differently-sized low-level
+    // buffers is possible, but the size of the portion used via the Codec
+    // interface per CodecBuffer must be the same for all the buffers.
+    //
+    // In single-buffer mode, we require the portion of the low-level buffer used
+    // via the Codec interface to be size (packet_count_for_codec +
+    // packet_count_for_client) * per_packet_buffer_bytes.
+    //
+    // TODO(dustingreen): determine if we need to relax these restrictions a bit
+    // for convenience when using gralloc video buffers.
+    uint32 per_packet_buffer_bytes;
+
+    // If true, there is only one buffer with index 0 which all packets
+    // implicitly refer to.  If false, the packet_index and buffer_index are 1:1,
+    // and each packet refers to its corresponding buffer.
+    //
+    // While it's possible to set up single_buffer_mode false with each buffer
+    // referring to the same underlying VMO, single_buffer_mode true is more
+    // efficient for that case since only one mapping is created.
+    bool single_buffer_mode;
+};
+
+// CodecBuffer
+//
+// The CodecBuffer struct represents a pre-configured buffer.
+//
+// Both input and output uses CodecBuffer(s), but the two sets of buffers are
+// separate.
+//
+// The client uses SetInputBufferSettings() + AddInputBuffer() * N to inform
+// the codec about all the input buffers.
+//
+// The client uses SetOutputBufferSettings() + AddOutputBuffer() * N to inform
+// the codec about all the output buffers.
+//
+// When single_buffer_mode is true, there is only buffer_index 0 shared by all
+// CodecPacket(s) of the relevant input or output.  When single_buffer_mode is
+// false, the buffer_index equals the packet_index.
+struct CodecBuffer {
+    // When using AddOutputBuffer()/AddInputBuffer(), this must match the
+    // buffer_lifetime_ordinal of the most recent
+    // SetOutputBufferSettings()/SetInputBufferSettings().
+    uint64 buffer_lifetime_ordinal;
+
+    // Buffers must be added via AddOutputBuffer() / AddInputBuffer() in order by
+    // buffer_index, and the buffer_index is always equal to 0 or equal to the
+    // packet_index (depending on single_buffer_mode true or false), but it's
+    // still nice to have CodecBuffer include the buffer_index if only for easier
+    // debugging.
+    uint32 buffer_index;
+
+    // For each new buffer_lifetime_ordinal, a client must use new low-level
+    // buffers.  This rule exists for multiple very good reasons, and is relevant
+    // to mid-stream changes, changes on stream boundaries, and both input and
+    // output buffers.  A new buffer_lifetime_ordinal needs new low-level
+    // buffers, not just new CodecBuffer(s).  If you find yourself copying
+    // compressed input data into new low-level input buffers solely due to this
+    // rule, consider asking the source of the data for the ability to directly
+    // fill new VMOs.  The rule exists for good reasons, even for input buffers.
+    //
+    // The previous paragraph does not prohibit carving up VMOs into sub-pieces
+    // and using different sub-pieces as different CodecBuffer(s), with some VMOs
+    // used for more than one CodecBuffer and possibly others used for only one
+    // CodecBuffer.  While this is permitted and enables some optimizations, it's
+    // not expected to be particularly common.
+    //
+    // See codec.md for more on CodecBufferData, and more on why we never re-use
+    // the same low-level buffers for different buffer_lifetime_ordinal(s).
+    CodecBufferData data;
+};
+
+// CodecBufferData
+//
+// For the moment, a VMO per buffer is the only type of buffer.
+//
+// This is extremely likely to change significantly when adding gralloc stuff,
+// but the idea with this union is to have a struct per logical way of storing
+// the data.  Any multi-domain storage within a gralloc buffer will likely be
+// only indirectly represented here.
+union CodecBufferData {
+    CodecBufferDataVmo vmo;
+
+    // TODO(dustingreen): add the gralloc way
+};
+
+// CodecBufferDataVmo
+//
+// Details for a buffer backed by a VMO.
+struct CodecBufferDataVmo {
+    // The same VMO can be used by more than one CodecBuffer (only of the same
+    // buffer_lifetime_ordinal), but each vmo_handle must be a separate handle.
+    handle<vmo> vmo_handle;
+
+    // Offset within the VMO of the first usable byte.  Must be < the VMO's size
+    // in bytes.
+    uint64 vmo_usable_start;
+
+    // VMO-relative offset that's one past the last usable byte.  This can point
+    // one byte beyond the end of the VMO if desired.  In other words, this can
+    // be equal to the VMO's size, to indicate that the last byte of the VMO is
+    // usable (and possibly many byte before that, depending on
+    // vmo_usable_start).
+    uint64 vmo_usable_size;
+};
+
+// CodecPacketHeader
+//
+// When referring to a free packet, we use CodecPacketHeader alone instead of
+// CodecPacket, since while a packet is free it doesn't really have meaningful
+// offset or length etc.
+//
+// A populated CodecPacket also has a CodecPacketHeader.
+struct CodecPacketHeader {
+    // This is which buffer configuration lifetime this header is referring to.
+    //
+    // A packet_index is only really meaningful with respect to a particular
+    // buffer_lifetime_ordinal.
+    //
+    // See CodecPortBufferSettings.buffer_lifetime_ordinal.
+    //
+    // For QueueInputPacket(), a server receiving a buffer_lifetime_ordinal that
+    // isn't the current input buffer_lifetime_ordinal will close the channel.
+    //
+    // For OnFreeInputPacket() and RecycleOutputPacket(), the reciever (client or
+    // server) must ignore a message with stale buffer_lifetime_ordinal.
+    uint64 buffer_lifetime_ordinal;
+
+    // The overall set of packet_index values is densely packed from 0..count-1
+    // for input and output separately.  They can be queued in any order.
+    //
+    // Both the client and server should validate the packet_index against the
+    // known bound and disconnect if it's out of bounds.
+    //
+    // When running in buffer-per-packet mode, the packet_index is also the
+    // buffer index.  When running in single-buffer mode, the buffer index is
+    // always 0 referring to the single buffer.
+    //
+    // The packet_index values don't imply anything about order of use of
+    // packets. The client should not expect the ordering to remain the same over
+    // time - the codec is free to hold on to an input or output packet for a
+    // while during which other packet_index values may be used multiple times.
+    //
+    // For a given properly-functioning Codec instance, packet_index values will
+    // be unique among concurrently-outstanding packets.  Servers should validate
+    // that a client isn't double-using a packet and clients should validate as
+    // necessary to avoid undefined or unexpected client behavior.
+    uint32 packet_index;
+};
+
+// CodecPacket
+//
+// A CodecPacket represents a chunk of input or output data to or from a codec.
+//
+// codec output:
+// While the CodecPacket is outstanding with the client via OnOutputPacket(),
+// the codec will avoid modifying the referenced output data.  After the client
+// calls RecycleOutputPacket(packet_index), the codec is notified that the
+// client is again ok with the referenced data changing.
+//
+// codec input:
+// The client initially has all packet_index(es) available to fill, and later
+// gets packet_index(s) that are again ready to fill via OnFreeInputPacket().
+// The client must not modify the referenced data in between QueueInputPacket()
+// and OnFreeInputPacket().
+struct CodecPacket {
+    CodecPacketHeader header;
+
+    // Which buffer this packet refers to.  For single-buffer mode this will
+    // always be 0, but for multi-buffer mode, a given in-flight interval of a
+    // packet can refer to any buffer.  The packet has an associated buffer only
+    // while the packet is in-flight, not while the packet is free.
+    //
+    // The default value makes accidental inappropriate use of index 0 less
+    // likely (will tend to complain in an obvious way if not filled out instead
+    // of a non-obvious data corruption when decoding buffer 0 repeatedly instead
+    // of the correct buffers).
+    uint32 buffer_index = 0x80000000;
+
+    // stream_lifetime_ordinal
+    //
+    // The value 1 is the lowest permitted value after codec creation.  Values
+    // sent by the client must be odd.  Values must only increase.
+    //
+    // A stream_lifetime_ordinal represents the lifetime of a stream.  All
+    // messages that are specific to a stream have the stream_lifetime_ordinal
+    // value and the value is the same for all messages relating to a given
+    // stream.
+    //
+    // See codec.md for more on stream_lifetime_ordinal.
+    uint64 stream_lifetime_ordinal;
+
+    // start_offset and valid_length_bytes
+    //
+    // Which part of the relevant buffer is this packet using.  These are valid
+    // for input data that's in-flight to the codec, and are valid for output data
+    // from the codec.
+    //
+    // For compressed formats and uncompressed audio, the data in
+    // [start_offset, start_offset + valid_length_bytes) is the contiguously valid
+    // data refered to by this packet.
+    //
+    // For uncompressed video frames, CodecFormatDetails is the primary means of
+    // determining which bytes are relevant.  The offsets in CodecFormatDetails
+    // are relative to the start_offset here.  The valid_length_bytes must be
+    // large enough to include the full last line of pixel data, including the
+    // full line stride of the last line (not just the width in pixels of the
+    // last line).
+    //
+    // Despite these being filled out, some uncompressed video buffers are of
+    // types that are not readable by the CPU.  These fields being here don't
+    // imply there's any way for the CPU to read an uncompressed frame.
+    //
+    // TODO(dustingreen): Do we have any reason to require that these be filled
+    // out for opaque uncompressed video frames that the CPU can't read?  In that
+    // case do we want to require them just so they can be potentially passed on
+    // to a HW renderer in case the HW renderer has any use for them?  Or more
+    // likely, it may just be that these tend to refer to the whole size of an
+    // uncompressed buffer, with format_details taking care of specifying which
+    // bytes are actually relevant.
+    uint32 start_offset;
+
+    // valid_length_bytes
+    //
+    // This must be > 0.
+    //
+    // The semantics for valid data per packet vary depending on data type as
+    // follows.
+    //
+    // uncompressed video - A video frame can't be split across packets.  Each
+    // packet is one video frame.
+    //
+    // uncompressed audio - Regardless of float or int, linear or uLaw, or number
+    // of channels, a packet must contain an non-negative number of complete
+    // audio frames, where a single audio frame consists of data for all the
+    // channels for the same single point in time.  Any codec-specific internal
+    // details re. lower rate sampling for LFE channel or the like should be
+    // hidden by the Codec server implementation.
+    //
+    // compressed data input - A packet must contain at least one byte of data.
+    // See also codec_input_bytes_min.  Splitting AUs at arbitrary byte
+    // boundaries is permitted, including at boundaries that are in AU headers.
+    //
+    // compressed data output - The codec is not required to fully fill each
+    // output packet's buffer.
+    uint32 valid_length_bytes;
+
+    // This value is not strictly speaking a timestamp.  It is an arbitrary
+    // unsigned 64-bit number that, under some circumstances, will be passed by a
+    // codec unmodified from an input packet to the exactly-corresponding output
+    // packet.
+    //
+    // For timestamp_ish values to be propagated from input to output the
+    // following conditions must be true:
+    //  * promise_separate_access_units_on_input must be true
+    //  * has_timestamp_ish must be true for a given input packet, to have that
+    //    timestamp_ish value (potentially) propagate through to an output
+    //  * the Codec instance itself decides (async) that the input packet
+    //    generates an output packet - if a given input never generates an output
+    //    packet then the timestamp_ish value on the input will never show up on
+    //    any output packet - depending on the characteristics of the input and
+    //    output formats, and whether a decoder is willing to join mid-stream, etc
+    //    this can be more or less likely to occur, but clients should be written
+    //    to accomodate timestamp_ish values that are fed on input but never show
+    //    up on output, at least to a reasonable degree (not crashing, not
+    //    treating as an error).
+    //
+    // See codec.md for more on timestamp_ish.
+    bool has_timestamp_ish;
+    uint64 timestamp_ish;
+
+    // start_access_unit
+    //
+    // If promise_separate_access_units_on_input (TODO(dustingreen): or any
+    // similar mode for output) is true, this bool must be set appropriately
+    // depending on whether byte 0 _is_ or _is not_ the start of an access unit.
+    // The client is required to know, and required to set this boolean properly.
+    // The server is allowed to infer that when this boolean is false, byte 0 is
+    // the first byte of a continuation of a previously-started AU.  (The byte at
+    // start_offset is "byte 0".)
+    //
+    // If promise_separate_access_units_on_input is false, this boolean is
+    // ignored.
+    bool start_access_unit;
+
+    // known_end_access_unit
+    //
+    // A client is never required to set this boolean to true.
+    //
+    // If promise_separate_access_units_on_input is true, for input data, this
+    // boolean must be false if the last byte of this packet is not the last byte
+    // of an AU, and this boolean _may_ be true if the last byte of this packet
+    // is the last byte of an AU.  A client delivering one AU at a time that's
+    // interested in the lowest possible latency via the decoder should set this
+    // boolean to true when it can be set to true.
+    //
+    // If promise_separate_access_units_on_input is false, this boolean is
+    // ignored.
+    bool known_end_access_unit;
+};
+
+// Codec
+//
+// The Codec interface exists to anchor the configuration of input and output
+// buffers, and depending on Codec server hosting strategy, the Codec inteface
+// can, in some configurations, be 1:1 with a codec isolate (process),
+// especially when using SW codecs.  The Codec can be used to process up to one
+// stream at a time.
+//
+// Descriptions of actions taken by methods of this interface and the states of
+// things are given as if the methods are synchronously executed by the codec
+// server, but in reality, as is typical of FIDL interfaces, the message
+// processing is async.  The states described are to be read as the state from
+// the client's point of view unless otherwise stated.  Events coming back from
+// the server are of course delivered async, and a client that processes more
+// than one stream per Codec instance needs to care whether a given event is
+// from the current stream vs. some older soon-to-be-gone stream.
+//
+// The Sync() method's main purpose is to enable the client to robustly prevent
+// having both old and new buffers allocated in the system at the same time,
+// since media buffers can be significantly large, depending. The Sync() method
+// achieves this by only delivering it's response when all previous calls to
+// the Codec interface have actually taken effect in the StreamControl ordering
+// domain. Sync() can also be used to wait for the codec server to catch up if
+// there's a possibility that a client might otherwise get too far ahead of the
+// Codec server, by for example requesting creation of a large number of
+// streams in a row.  It can also be used during debugging to ensure that a
+// codec server hasn't gotten stuck.  Calling Sync() is entirely optional and
+// never required for correctness - only potentially required to de-overlap
+// resource usage.
+//
+// Semi-trusted Codec server - SW decoders run in an isolate (with very few
+// capabilities) just in case the decoding SW has a vulnerability which could
+// be used to take over the Codec server.  Clients of the codec interface using
+// decoders and processing streams of separate security contexts, to a greater
+// extent than some other interfaces, need to protect themselves against
+// invalid server behavior, such as double-free of a packet_index and any other
+// invalid server behavior.  Having fed in compressed data of one security
+// context, don't place too much trust in a single Codec instance to not mix
+// data among any buffers that Codec server has ever been told about.  Instead,
+// create separate Codec instances for use by security-separate client-side
+// contexts. While the picture for HW-based decoders looks somewhat different
+// and is out of scope of this paragraph, the client should always use separate
+// Codec instances for security-separate client-side contexts.
+interface Codec {
+    // EnableOnStreamFailed()
+    //
+    // Permit the server to use OnStreamFailed() instead of the server just
+    // closing the whole Codec channel on stream failure.
+    //
+    // If the server hasn't seen this message by the time a stream fails, the
+    // server will close the Codec channel instead of sending OnStreamFailed().
+    1: EnableOnStreamFailed();
+
+    // OnStreamFailed()
+    //
+    // The stream has failed, but the Codec instance is still usable for a new
+    // stream.
+    //
+    // This message is only ever sent by the server if the client previously sent
+    // EnableOnStreamFailed().  If the client didn't send EnableOnStreamFailed()
+    // then the server closes the Codec channel instead.
+    //
+    // Codec server implementations are encouraged to handle stream errors (and
+    // ideally to also report them via error_ bools of OnOutputPacket() and
+    // OnOutputEndOfStream()) without failing the whole stream, but if a codec
+    // server is unable to do that, but still can cleanly contain the failure to
+    // the stream, the codec server can (assuming EnableOnStreamFailed() was
+    // called) use OnStreamFailed() to indicate the stream failure to the client
+    // without closing the Codec channel.
+    //
+    // An ideal Codec server handles problems with input data without sending
+    // this message, but sending this message is preferred vs. closing the server
+    // end of the Codec channel if the Codec server can 100% reliably contain the
+    // stream failure to the stream, without any adverse impact to any later
+    // stream.
+    //
+    // No further messages will arrive from the server regarding the failed
+    // stream.  This includes any OnOutputEndOfStream() that the client would
+    // have otherwise expected.
+    //
+    // TODO(dustingreen): Add at least an error_message string and _maybe_ a
+    // zx_status_t, though that might tend to encourage mis-use of zx_status_t so
+    // maybe just error_message for quicker debugging on the client side.  Also
+    // plumb from CodecAdapterH264 and similar.
+    2: -> OnStreamFailed(uint64 stream_lifetime_ordinal);
+
+    // OnInputConstraints()
+    //
+    // The server sends this shortly after Codec creation to indicate input
+    // buffer constraints.  The "min" and "max" input constraints don't change
+    // for the life of the Codec.
+    //
+    // The "max" values for buffer size and count are large enough to support the
+    // most demanding format the server supports on input.  The "recommended"
+    // values should be workable for use with the input CodecFormatDetails
+    // conveyed during Codec creation.  The "recommended" values are not
+    // necessarily suitable if the client uses QueueInputFormatDetails() to
+    // change the input format.  In that case it's up to the client to determine
+    // suitable values, either by creating a new Codec instance instead, or
+    // knowing suitable values outside the scope of this protocol.
+    //
+    // See comments on CodecBufferConstraints.
+    //
+    // This message is guaranteed to be sent unsolicited to the Codec client
+    // during or shortly after Codec creation.  Clients should not depend on this
+    // being the very first message to arrive at the client.  OnOutputConfig()
+    // may be sent first by some codecs that already know their initial output
+    // config without any input data, to encourage (but not stictly require) the
+    // client to configure output buffers before feeding the first input, to
+    // avoid a wasteful OnOutputConfig() being generated for that first stream if
+    // the client has started configuring output but isn't done configuring
+    // output before the client sends the first input data for the first stream.
+    // A client is free to ignore OnOutputConfig() with a stale
+    // stream_lifetime_ordinal, but handling OnOutputConfig() with
+    // stream_lifetime_ordinal 0 (if any are sent) can help reduce latency to
+    // first output.  See OnOutputConfig() for more details.
+    //
+    // The "min" and "max" input constraints are guaranteed not to change for a
+    // given Codec instance.  The "recommended" values may effectively change
+    // when the server processes QueueInputFormatDetails().  There is not any way
+    // in the protocol short of creating a new Codec instance for the client to
+    // get those new "recommended" values.
+    //
+    // TODO(dustingreen): Maybe provide a way for the client to get updated
+    // "recommended" values for input, maybe only on request rather than via this
+    // event, to keep things simpler for simpler clients.  Maybe separate the
+    // recommendations from the constraints.
+    3: -> OnInputConstraints(CodecBufferConstraints input_constraints);
+
+    // SetInputBufferSettings() and AddInputBuffer()
+    //
+    // Configuring input buffers consists of calling SetInputBufferSettings()
+    // followed by a number of calls to AddInputBuffer() equal to the number of
+    // buffers set via SetInputBufferSettings().  In buffer-per-packet mode, this
+    // is the same as the number of packets.  In single-buffer mode, this is 1.
+    //
+    // After OnInputConstraints(), the client uses these two methods to set up
+    // input buffers and packets.
+    //
+    // Configuring input buffers is required before QueueInputPacket().
+    //
+    // The client can also re-set-up input buffers any time there is no current
+    // stream.  The client need not wait until all previously-set-up input
+    // buffers are with the client via OnFreeInputPacket().  The old
+    // buffer_lifetime_ordinal just ends.  See codec.md for more info on "buffer
+    // lifetime".
+    //
+    // The recommended way to de-overlap resource usage (when/if the client wants
+    // to) is to send CloseCurrentStream() with release_input_buffers true then
+    // send Sync() and wait for its response before allocating any new buffers.
+    // How to cause other parts of the system to release their references on
+    // low-level buffers is outside the scope of this interface.
+    //
+    // This call ends any previous buffer_lifetime_ordinal, and starts a new one.
+    4: SetInputBufferSettings(CodecPortBufferSettings input_settings);
+
+    // The client is required to add all the input buffers before sending any
+    // message that starts a new stream else the codec will close the Codec
+    // channel.
+    //
+    // When the last buffer is added with this message, all the input packets
+    // effectively jump from non-existent to free with the client.  The Codec
+    // will not generate an OnFreeInputPacket() for each new input packet.  The
+    // client can immediately start sending QueueInputPacket() after sending the
+    // last AddInputBuffer().
+    5: AddInputBuffer(CodecBuffer buffer);
+
+    // OnOutputConfig()
+    //
+    // This event informs the client of new output config.  The server will send
+    // at least one of these messages before the first output packet of a stream,
+    // but that message might not have buffer_constraints_action_required true.
+    //
+    // If buffer_constraints_action_required is true and the
+    // stream_lifetime_ordinal matches the current stream, the client must react
+    // by configuring or re-configuring output buffers.
+    //
+    // Some clients may prefer not to support mid-stream output config changes,
+    // but even those clients are required to process OnOutputConfig() messages
+    // up to the first output packet of each stream, as OnOutputConfig() is used
+    // for stream format detection as well as for potential mid-stream output
+    // config changes.
+    //
+    // For more on OnOutputConfig(), see cocec.md.
+    6: -> OnOutputConfig(CodecOutputConfig output_config);
+
+    // SetOutputBufferSettings() and AddOutputBuffer()
+    //
+    // These are not permitted until after the first OnOutputConfig().
+    //
+    // Roughly speaking, these messages are sent in response to OnOutputConfig()
+    // with buffer_constraints_action_required true.
+    //
+    // Configuring output buffers consists of calling SetOutputBufferSettings()
+    // followed by a number of calls to AddOutputBuffer() equal to the number of
+    // buffers set via SetOutputBufferSettings().  In buffer-per-packet mode, this
+    // is the same as the number of packets.  In single-buffer mode, this is 1.
+    //
+    // Configuring output buffers is _required_ after OnOutputConfig() is
+    // received by the client with buffer_constraints_action_required true and
+    // stream_lifetime_ordinal equal to the client's current
+    // stream_lifetime_ordinal (even if there is an active stream), and is
+    // _permitted_ any time there is no current stream.
+    //
+    // For more on SetOutputBufferSettings() and AddOutputBuffer(), see codec.md.
+    7: SetOutputBufferSettings(CodecPortBufferSettings output_settings);
+    8: AddOutputBuffer(CodecBuffer buffer);
+
+    // FlushEndOfStreamAndCloseStream()
+    //
+    // This message is optional.
+    //
+    // This message is only valid after QueueInputEndOfStream() for this stream.
+    // The stream_lifetime_ordinal input parameter must match the
+    // stream_lifetime_ordinal of the QueueInputEndOfStream(), else the server
+    // will close the channel.
+    //
+    // A client can use this message to flush through (not discard) the last
+    // input data of a stream so that the codec server generates corresponding
+    // output data for all the input data before the server moves on to the next
+    // stream, without forcing the client to wait for OnOutputEndOfStream()
+    // before queueing data of another stream.
+    //
+    // The difference between QueueInputEndOfStream() and
+    // FlushEndOfStreamAndCloseStream():  QueueInputEndOfStream() is a promise
+    // from the client that there will not be any more input data for the stream
+    // (and this info is needed by some codecs for the codec to ever emit the very
+    // last output data).  The QueueInputEndOfStream() having been sent doesn't
+    // prevent the client from later completely discarding the rest of the
+    // current stream by closing the current stream (with or without a stream
+    // switch).  In contrast, FlushEndOfStreamAndCloseStream() is a request from
+    // the client that all the previously-queued input data be processed
+    // including the logical "EndOfStream" showing up as OnOutputEndOfStream()
+    // (in success case) before moving on to any newer stream - this essentially
+    // changes the close-stream handling from discard to flush-through for this
+    // stream only.
+    //
+    // A client using this message can start providing input data for a new
+    // stream without that causing discard of old stream data.  That's the purpose
+    // of this message - to allow a client to flush through (not discard) the old
+    // stream's last data (instead of the default when closing or switching
+    // streams which is discard).
+    //
+    // Because the old stream is not done processing yet and the old stream's
+    // data is not being discarded, the client must be prepared to continue to
+    // process OnOutputConfig() messages until the stream_lifetime_ordinal is
+    // done.  The client will know the stream_lifetime_ordinal is done when
+    // OnOutputEndOfStream(), OnStreamFailed(), or the Codec channel closes.
+    //
+    // For more on FlushEndOfStreamAndCloseStream(), see codec.md.
+    9: FlushEndOfStreamAndCloseStream(uint64 stream_lifetime_ordinal);
+
+    // CloseCurrentStream()
+    //
+    // This "closes" the current stream, leaving no current stream.  In addition,
+    // this message can optionally release input buffers or output buffers.
+    //
+    // If there has never been any active stream, the stream_lifetime_ordinal must
+    // be zero or the server will close the channel.  If there has been an active
+    // stream, the stream_lifetime_ordinal must be the most recent active stream
+    // whether that stream is still active or not.  Else the server will close the
+    // channel.
+    //
+    // Multiple of this message without any new active stream in between is not
+    // to be considered an error, which allows a client to use this message to
+    // close the current stream to stop wasting processing power on a stream the
+    // user no longer cares about, then later decide that buffers should be
+    // released and send this message again with release_input_buffers and/or
+    // release_output_buffers true to get the buffers released, if the client is
+    // interested in trying to avoid overlap in resource usage between old
+    // buffers and new buffers (not all clients are).
+    //
+    // See also Sync().
+    //
+    // For more on CloseCurrentStream(), see codec.md.
+    10: CloseCurrentStream(
+            uint64 stream_lifetime_ordinal,
+            bool release_input_buffers,
+            bool release_output_buffers);
+
+    // Sync() -> ()
+    //
+    // On completion, all previous Codec calls have done what they're going to do
+    // server-side, _except_ for processing of data queued using
+    // QueueInputPacket().
+    //
+    // The main purpose of this call is to enable the client to wait until
+    // CloseCurrentStream() with release_input_buffers and/or
+    // release_output_buffers set to true to take effect, before the client
+    // allocates new buffers and re-sets-up input and/or output buffers.  This
+    // de-overlapping of resource usage can be worthwhile for media buffers which
+    // can consume resource types whose overall pools aren't necessarily vast in
+    // comparsion to resources consumed.  Especially if a client is reconfiguring
+    // buffers multiple times.
+    //
+    // Note that Sync() prior to allocating new media buffers is not alone
+    // sufficient to achieve non-overlap of media buffer resource usage system
+    // wide, but it can be a useful part of achieving that.
+    //
+    // The Sync() transits the Output ordering domain and the StreamControl
+    // ordering domain, but not the InputData ordering domain.  For more on
+    // ordering domains see codec.md.
+    //
+    // This request can be used to avoid hitting kMaxInFlightStreams which is
+    // presently 10.  A client that stays <= 8 in-flight streams will comfortably
+    // stay under the limit of 10.  While the protocol permits repeated
+    // SetInputBufferSettings() and the like, a client that spams the channel
+    // can expect that the channel will just close if the server or the channel
+    // itself gets too far behind.
+    11: Sync() -> ();
+
+    // OnOutputPacket()
+    //
+    // This is how the codec emits an output packet to the codec client.
+    //
+    // Order is significant.
+    //
+    // The client should eventually call RecycleOutputPacket() (possibly after
+    // switching streams multiple times), unless the buffer_lifetime_ordinal has
+    // moved on.  A stream change doesn't change which packets are busy with
+    // the client vs. free with the server.  See "packet lifetime" in codec.md for
+    // more.
+    //
+    // The relevant buffer is buffer 0 if running in single-buffer mode, or the
+    // buffer index is the same as packet_index if running in buffer-per-packet
+    // mode.
+    //
+    // For low-level buffer types that support it, a Codec is free to emit an
+    // output packet before the low-level buffer actually has any usable data in
+    // the buffer, with the mechanism for signalling the presence of data
+    // separate from the OnOutputPacket() message.  For such low-level buffer
+    // types, downstream consumers of data from the emitted packet must
+    // participate in the low-level buffer signalling mechanism to know when it's
+    // safe to consume the data.  This is most likely to be relevant when using a
+    // video decoder and gralloc-style buffers.
+    //
+    // The error_ bool(s) allow (but do not require) a Codec server to report
+    // errors that happen during an AU or between AUs.
+    //
+    // The scope of error_detected_before starts at the end of the last delivered
+    // output packet on this stream, or the start of stream if there were no
+    // previous output packets on this stream.  The scope ends at the start of
+    // the output_packet.
+    //
+    // The error_detected_before bool is separate so that discontinuities can be
+    // indicated separately from whether the current packet is damaged.
+    //
+    // The scope of error_detected_during is from the start to the end of this
+    // output_packet.
+    12: -> OnOutputPacket(
+            CodecPacket output_packet,
+            bool error_detected_before,
+            bool error_detected_during);
+
+    // RecycleOutputPacket()
+    //
+    // After the client is done with an output packet, the client needs to tell
+    // the codec that the output packet can be re-used for more output, via this
+    // method.
+    //
+    // It's not permitted to recycle an output packet that's already free with the
+    // codec server.  It's permitted but discouraged for a client to recycle an
+    // output packet that has been deallocated by an explicit or implicit output
+    // buffer de-configuration().  See buffer_lifetime_ordinal for more on that.
+    // A server must ignore any such stale RecycleOutputPacket() calls.
+    //
+    // For more on RecycleOutputPacket(), see codec.md.
+    13: RecycleOutputPacket(CodecPacketHeader available_output_packet);
+
+    // OnOutputEndOfStream()
+    //
+    // After QueueInputEndOfStream() is sent by the Codec client, within a
+    // reasonable duration the corresponding OnOutputEndOfStream() will be sent by
+    // the Codec server.  Similar to QueueInputEndOfStream(),
+    // OnOutputEndOfStream() is sent a maximum of once per stream.
+    //
+    // No more stream data for this stream will be sent after this message.  All
+    // input data for this stream was processed.
+    //
+    // While a Codec client is not required to QueueInputEndOfStream() (unless
+    // the client wants to use FlushEndOfStreamAndCloseStream()), if a Codec
+    // server receives QueueInputEndOfStream(), and the client hasn't closed the
+    // stream, the Codec server must generate a corresponding
+    // OnOutputEndOfStream() if nothing went wrong, or must send
+    // OnStreamFailed(), or must close the server end of the Codec channel.  An
+    // ideal Codec server would handle and report stream errors via the error_
+    // flags and complete stream processing without sending OnStreamFailed(), but
+    // in any case, the above-listed options are the only ways that an
+    // OnOutputEndOfStream() won't happen after QueueInputEndOfStream().
+    //
+    // There will be no more OnOutputPacket() or OnOutputConfig() messages for
+    // this stream_lifetime_ordinal after this message - if a server doesn't
+    // follow this rule, a client should close the Codec channel.
+    //
+    // The error_detected_before bool has the same semantics as the
+    // error_detected_before bool in OnOutputPacket().
+    14: -> OnOutputEndOfStream(
+            uint64 stream_lifetime_ordinal,
+            bool error_detected_before);
+
+    //
+    // Stream specific messages:
+    //
+
+    // QueueInputFormatDetails()
+    //
+    // If the input format details are still the same as specified during Codec
+    // creation, this message is unnecessary and does not need to be sent.
+    //
+    // If the stream doesn't exist yet, this message creates the stream.
+    //
+    // All servers must permit QueueInputFormatDetails() at the start of a stream
+    // without failing, as long as the new format is supported by the Codec
+    // instance.  Technically this allows for a server to only support the exact
+    // input format set during Codec creation, and that is by design.  A client
+    // that tries to switch formats and gets a Codec channel failure should try
+    // again one more time with a fresh Codec instance created with CodecFactory
+    // using the new input format during creation, before giving up.
+    //
+    // These format details override the format details
+    // specified during codec creation for this stream only.  The next stream will
+    // default back to the format details set during codec creation.
+    //
+    // For now, QueueInputFormatDetails() sent mid-stream will fail the Codec
+    // channel.  Clients shouldn't do this for now.
+    //
+    // This message is permitted at the start of the first stream (just like at
+    // the start of any stream).  The format specified need not match what was
+    // specified during codec creation, but if it doesn't match, the Codec channel
+    // might close as described above.
+    15: QueueInputFormatDetails(
+            uint64 stream_lifetime_ordinal, CodecFormatDetails format_details);
+
+    // QueueInputPacket()
+    //
+    // This message queues input data to the codec for processing.
+    //
+    // If the stream doesn't exist yet, this message creates the new stream.
+    //
+    // The client is required to be willing to send QueueInputPacket() prior to
+    // the server's first OnOutputConfig(), and is permitted to start a new stream
+    // without output buffers configured yet.
+    //
+    // The client must continue to deliver input data via this message even if the
+    // codec has not yet generated the first OnOutputConfig(), and even if the
+    // Codec is generating OnFreeInputPacket() for previously-queued input
+    // packets.  The input data must continue as long as there are free packets
+    // to be assured that the server will ever generate the first
+    // OnOutputConfig().
+    //
+    // For more on QueueInputPacket(), see codec.md.
+    16: QueueInputPacket(CodecPacket packet);
+
+    // OnFreeInputPacket()
+    //
+    // The server sends this message when the codec is done consuming this packet
+    // and the packet can be re-filled by the client.
+    //
+    // This is not sent for all packets when a new buffer_lifetime_ordinal starts
+    // as in that case all the packets are initially free with the client.
+    //
+    // See comments on QueueInputBuffer() and "packet lifetime" in codec.md for
+    // for description of buffer lifetime and packet lifetime.
+    //
+    // After receiving the available input buffer via this event, the codec
+    // client can call later call QueueInputBuffer with appropriate offset and
+    // length set.
+    //
+    // TODO(dustingreen): At the moment, there is no guarantee re. the order of
+    // these messages with respect to the order of QueueInputPacket(), but at
+    // least for decoders, it might be worthwhile to require that servers preserve
+    // the order vs. QueueInputPacket(), to make it easier to feed input from a
+    // ring buffer or similar.  For audio encoders it might still make sense.  For
+    // video encoders probably not.
+    17: -> OnFreeInputPacket(CodecPacketHeader free_input_packet);
+
+    // Inform the server that all QueueInputPacket() messages for this stream
+    // have been sent.
+    //
+    // If the stream isn't closed first (by the client, or by OnStreamFailed(), or
+    // Codec channel closing), there will later be a corresponding
+    // OnOutputEndOfStream().
+    //
+    // The corresponding OnOutputEndOfStream() message will be generated only if
+    // the server finishes processing the stream before the server sees the
+    // client close the stream (such as by starting a new stream).  A way to
+    // force the server to finish the stream before closing is to use
+    // FlushEndOfStreamAndCloseStream() after QueueInputEndOfStream() before any
+    // new stream.  Another way to force the server to finish the stream before
+    // closing is to wait for the OnOutputEndOfStream() before taking any action
+    // that closes the stream.
+    //
+    // In addition to serving as an "EndOfStream" marker to make it obvious
+    // client-side when all input data has been processed, if a client never
+    // sends QueueInputEndOfStream(), no amount of waiting will necessarily
+    // result in all input data getting processed through to the output.  Some
+    // codecs have some internally-delayed data which only gets pushed through by
+    // additional input data _or_ by this EndOfStream marker.  In that sense,
+    // this message can be viewed as a flush-through at InputData domain level,
+    // but the flush-through only takes effect if the codec even gets that far
+    // before the stream is just closed at StreamControl domain level.  This
+    // message is not alone sufficient to act as an overall flush-through at
+    // StreamControl level. For that, send this message first and then send
+    // FlushEndOfStreamAndCloseStream() (at which point it becomes possible to
+    // queue input data for a new stream without causing discard of this older
+    // stream's data), or wait for the OnOutputEndOfStream() before closing the
+    // current stream.
+    //
+    // If a client sends QueueInputPacket(), QueueInputFormatDetails(),
+    // QueueInputEndOfStream() for this stream after the first
+    // QueueInputEndOfStream() for this stream, a server should close the Codec
+    // channel.
+    18: QueueInputEndOfStream(uint64 stream_lifetime_ordinal);
+};
diff --git a/fidl/fuchsia.mediacodec/codec_common.fidl b/fidl/fuchsia.mediacodec/codec_common.fidl
new file mode 100644
index 0000000..d1e7a7c
--- /dev/null
+++ b/fidl/fuchsia.mediacodec/codec_common.fidl
@@ -0,0 +1,511 @@
+// 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.mediacodec;
+
+// Value
+//
+// Generic "value" for use within generic "Parameter" struct.
+union Value {
+  bool bool_value;
+  uint64 uint64_value;
+  int64 int64_value;
+  string string_value;
+  // Prefer using codec_oob_bytes instead.
+  vector<uint8> bytes_value;
+};
+
+// Parameter
+//
+// Generic parameter.
+//
+// We want to minimize use of this generic "Parameter" structure by natively
+// defining as many codec-specific parameter semantics as we can.
+//
+// TODO: When possible, describe the very limited scenarios in which it would
+// still be reasonable to use a generic Parameter.
+struct Parameter {
+  // Some indication of the scope of applicability of this Parameter.
+  string scope;
+  // Specific name of this parameter, without the scope prefix.
+  string name;
+  // The particular value of this parameter.
+  Value value;
+};
+
+// CodecFormatDetails
+//
+// The purpose of CodecFormatDetails is to fill in additional details not
+// conveyed via other means.
+//
+// TODO(dustingreen): Where at all possible, definitions for the concepts
+// within CodecFormatDetails should go in media_types.fidl or another location
+// that's widely shared.  Maybe some encoder settings could remain
+// codec-specific.
+//
+// For decoders input, the format details tend to be fairly sparse, since most
+// compressed formats tend to be mostly self-describing.
+//
+// For decoder output and encoder input, the format details need to include all
+// the out-of-band information regarding the uncompressed data, which tends not
+// to be self-describing.
+//
+// For encoder output, we also include in CodecFormatDetails some additional
+// encoding parameters which are needed to configure the encoder. These are not
+// really needed by any downstream decoder under most circumstances, but these
+// encoder config settings are legitimate optional format details, so we use
+// the same overall structure, but name them "Encoder" to make it more obvious
+// that these are mostly relevant to the encoder.  A downstream consumer could
+// potentially benefit from knowing these settings, but most won't look at them.
+//
+// Settings that are completely redundant with the data in the format itself
+// should not be in a required field here.  Some encoder parameters may also be
+// represented in codec_oob_bytes on the output of an encoder - a downstream
+// consumer can assume the codec_oob_bytes are correct and not check for whether
+// encoder settings are present or consistent.
+//
+// With some exceptions made for encoder settings on output of an encoder, this
+// stuff should be limited to things we need to know to properly process the
+// data which we can't already determine from the data itself, and which isn't
+// already covered by a format's defined OOB binary config blob, which is
+// conveyed in codec_oob_bytes.
+//
+// TODO(dustingreen): Consider whether to split encoder settings into a
+// separate struct - the main counter-argument would be if a consumer
+// immediately downstream of an encoder may have good reason to know encoder
+// settings to help process the data.  For example, the nominal bit-rate.
+
+// Compressed formats tend to be much more self-describing than uncompressed
+// formats.  (The "self" in "self-describing" includes the codec_oob_bytes.)
+//
+// Most decoders can have CodecFormatDetails.domain null.
+
+// AudioCompressedFormat
+//
+// Format details relevant to compressed audio, mostly for encoder settings.
+//
+// Unless otherwise specified in a comment on a field in this structure,
+// CodecFormatDetails.domain is null for a decoder.  A sub-structure whose name
+// ends in "Encoder" is for encoder output settings.
+//
+// TODO(dustingreen): Consider whether splitting encoder settings out separately
+// would be better.
+union AudioCompressedFormat {
+  // For an aac encoder, this field has settings the encoder needs which are
+  // specific to AAC encoding.
+  AudioCompressedFormatAacEncoder aac;
+};
+
+enum AudioBitrateMode {
+  // Used mainly when a client is configuring an encoder's output format.  May
+  // also be present in an OnOutputConfig() message from an encoder, but should
+  // not be relied upon to be present by any consumer downstream of an encoder.
+  UNSPECIFIED = 0;
+  CBR = 1;
+  VBR = 2;
+};
+
+// AudioCompressedFormatAacEncoder
+//
+// Encoder settings for an AAC encoder.
+struct AudioCompressedFormatAacEncoder {
+  // In SetOutputConfig():
+  //
+  // If zero, an encoder should generate 256 kbps, and a consumer should not
+  // assume any particular bitrate.
+  //
+  // If not zero, the encoder should not exceed this bitrate.  In CBR the
+  // encoder should use the highest available bitrate that doesn't exceed this
+  // value, or if there is no such bitrate, the lowest available bitrate.  In
+  // VBR, the encoder should stay at or below this bitrate.
+  //
+  // In VBR it's left up to the encoder to choose a reasonable ratio between
+  // max bits per second and min bits per second, with the aim in VBR being
+  // constant perceived quality.
+  //
+  // In OnOutputConfig():
+  //
+  // In CBR, the nominal bits per second.  In VBR, the nominal max bits per
+  // second.
+  uint32 bits_per_second;
+
+  // In SetOutputConfig():
+  //
+  // If UNSPECIFIED, up to the encoder.  If CBR or VBR, a hint to the encoder
+  // to use that mode.
+  //
+  // In OnOutputConfig():
+  //
+  // Actual mode being used.  UNSPECIFIED means the source is not specifying
+  // which mode.
+  AudioBitrateMode bitrate_mode;
+
+  // TODO(dustingreen): AAC profile settings.
+};
+
+// AudioPcmMode
+//
+// TODO(dustingreen): Keep or discard any non-linear formats for purposes of the
+// Codec interface?
+enum AudioPcmMode {
+  // 16 bit signed int linear or 32 bit float linear, for now
+  // 1-N channels ok, with "A.B" channels designated as A+B channel_count - the
+  // channel map is separately specified.  So 5.1 becomes channel_count 6.
+  LINEAR = 0;
+  // G.711 8 bit format-defined waveform semantics
+  // 1 channel
+  ALAW = 1;
+  // G.711 8 bit format-defined waveform semantics
+  // 1 channel
+  MULAW = 2;
+};
+
+// AudioChannelId
+//
+// Used in specifying which audio channel is for which speaker location / type.
+//
+// TODO(dustingreen): Do we need more channel IDs than this?
+//
+// TODO(dustingreen): Check with mpuryear@ re. naming consistency for "S" vs.
+// "R" as we move these to a common definition.  Also the ordering of LS/RS vs.
+// LR/RR - probably LR/RR being first would make more sense re. how channels
+// get added incrementally, but changing the order would no longer match
+// Android's ordering.
+enum AudioChannelId {
+  SKIP = 0; // unused channel
+  LF = 1;   // left front
+  RF = 2;   // right front
+  CF = 3;   // center front
+  LS = 4;   // left surround
+  RS = 5;   // right surround
+  LFE = 6;  // low frequency effects
+  CS = 7;   // back surround
+  LR = 8;   // left rear
+  RR = 9;   // right rear
+  // This is the last explicitly-defined value + 1.  This name will be
+  // re-defined in future if we add more defined channel IDs above.
+  END_DEFINED = 10;
+  // This is where format-specific (or ad-hoc) channel ID values should go, to
+  // avoid colliding with any additional values allocated above.  The values
+  // here are not guaranteed to avoid collision across different formats.
+  EXTENDED_CHANNEL_ID_BASE = 0x6f000000;
+  // Extended channel IDs should be <= Max.
+  MAX = 0x7fffffff;
+};
+
+// PcmFormat
+//
+// PCM audio format details.
+//
+// TODO(dustingreen): Discuss with mpuryear@ re. where definitions for these
+// details go and make sure the common details can specify at least this much.
+struct PcmFormat {
+  // Implicit details:
+  //   * For bits_per_sample > 8, host-endian is implied.
+  //   * At least for now, for channel_count >= 2, interleaved layout is
+  //     implied.
+
+  AudioPcmMode pcm_mode;
+
+  // bits_per_sample
+  //
+  // A "sample" is for a single channel.
+  //
+  // For example, CD quality is 16.  See PcmMode comments, as the mode
+  // constrains this value.
+  uint32 bits_per_sample;
+
+  // frames_per_second
+  //
+  // A "frame" is one datapoint (one "sample") for each channel.  Each channel
+  // is sampled this many times per second.  For example, CD quality is 44100.
+  uint32 frames_per_second;
+
+  // channel_map
+  //
+  // channel_map.size() is the channel count.  See PcmMode comments, as some
+  // modes constrain the channel count to 1.
+  //
+  // Values from AudioChannelId should be used if they are suitable.
+  //
+  // If a channel has no suitable AudioChannelId, an ad-hoc value can be used in
+  // a range starting from AudioChannel_ExtendedChannelIdBase.
+  vector<AudioChannelId>:16 channel_map;
+
+  // TODO(dustingreen): Add unsigned 8 bit, float 32 bit, maybe others. FWIW,
+  // AOSP appears to support signed 16 bit, unsigned 8 bit, and float 32 bit
+  // under "Pcm", AFAICT based on OMX_NUMERICALDATATYPE and ACodec.cpp code.
+};
+
+// AudioUncompressedFormat
+//
+// Uncompressed audio format details.
+union AudioUncompressedFormat {
+  PcmFormat pcm;
+};
+
+// AudioFormat
+//
+// Audio format details.
+union AudioFormat {
+  AudioCompressedFormat compressed;
+  AudioUncompressedFormat uncompressed;
+};
+
+// VideoCompressedFormat
+//
+// Compressed video format details.
+//
+// Mostly encoder settings will go under here.
+//
+// If a compressed video format is missing any fields here other than encoder
+// settings, it's because it's a good format and is already self-describing
+// given the mime_type + format-defined codec_oob_bytes as appropriate +
+// in-band data.
+union VideoCompressedFormat {
+  // TODO(dustingreen): Any compressed video formats that aren't sufficiently
+  // self-describing to select and create a Codec instance to decode it?
+
+  // TODO(dustingreen): temp field to make the compiler happy until we have at
+  // least one real field.
+  uint32 temp_field_todo_remove;
+};
+
+// VideoUncompressedFormatSpecificDetails
+//
+// Extended format-specific uncompressed video format details.
+//
+// TODO(dustingreen): Switch to FIDL table instead.
+union VideoUncompressedFormatSpecificDetails {
+  // TODO(dustingreen): Which formats that we care about really require special
+  // format-specific details here?
+
+  // TODO(dustingreen): temp field to make the compiler happy until we have at
+  // least one real field.
+  uint32 temp_field_todo_remove;
+};
+
+enum VideoColorSpace {
+  // TODO(dustingreen): add to this list
+  INVALID = 0;
+};
+
+// VideoUncompressedFormat
+//
+// Uncompressed video format details.
+//
+// TODO(dustingreen): Integrate with a system-wide structure for this purpose.
+struct VideoUncompressedFormat {
+  // fourcc
+  //
+  // A human-readable fourcc like RGBA should be 0x41424752 in the fourcc field
+  // (regardless of host endian-ness). Note that the R (first character) of the
+  // fourcc is in the low-order byte of this fourcc field.
+  //
+  // There are some fourcc codes that don't format nicely as a string.  While I
+  // don't foresee any use of any of the purely numeric fourcc codes (not
+  // corresponding to packed ascii character values), those would be stored
+  // such that their numeric value has it's low-order byte in the low-order
+  // byte of this fourcc value.  So a fourcc with "hex value" 0x00000001 would
+  // have the numeric value 1 in this field.
+  //
+  // The endian-ness of fourcc values stored in files or in network packets is
+  // outside the scope of these comments, other than to state that regardless
+  // of the source of the fourcc code and the order that storage / transmission
+  // format stores these bytes, a human-readable fourcc should have its
+  // human-read first ascii character value in the low order byte of this
+  // field.
+  uint32 fourcc;
+
+  // For formats with different planes having different resolution, this is the
+  // resolution of the highest-resolution plane(s).  Else it's the resolution
+  // of all the planes.
+  uint32 primary_width_pixels;
+  uint32 primary_height_pixels;
+
+  // For formats where the seconary planes are the same resolution, these fields
+  // will be the same as primary_width_pixels and primary_height_pixels.  For
+  // formats with smaller secondary resolutions, these indicate that resolution.
+  uint32 secondary_width_pixels;
+  uint32 secondary_height_pixels;
+
+  // Planar means the various planes are separately stored in their own chunks
+  // of memory.
+  bool planar;
+
+  // If a format is swizzled, the swizzling parameters are not directly here.
+  bool swizzled;
+
+  uint32 primary_line_stride_bytes;
+  // Formats with the same stride for all planes will have this field equal to
+  // primary_line_stride_bytes.
+  uint32 secondary_line_stride_bytes;
+
+  // R or Y
+  uint32 primary_start_offset;
+  // G or U
+  uint32 secondary_start_offset;
+  // B or V
+  uint32 tertiary_start_offset;
+
+  uint32 primary_pixel_stride;
+  // For formats with the same pixel stride for all planes, this field will be
+  // equal to primary_pixel_stride.
+  uint32 secondary_pixel_stride;
+
+  // These override the primary_width_pixels and primary_height_pixels for
+  // purposes of display (but not for purposes of determining the pixel layout
+  // in memory).  These can crop on the right and bottom.  These must be <= the
+  // corresponding coded dimension.
+  //
+  // This value must be <= primary_width_pixels.
+  uint32 primary_display_width_pixels;
+  // This value must be <= primary_height_pixels.
+  uint32 primary_display_height_pixels;
+
+  // The pixel_aspect_ratio_width : pixel_aspect_ratio_height is the pixel
+  // aspect ratio (AKA sample aspect ratio aka SAR) for the luma (AKA Y)
+  // samples. A pixel_aspect_ratio of 1:1 mean square pixels. A
+  // pixel_aspect_ratio of 2:1 would mean pixels that are displayed twice as
+  // wide as they are tall. Codec implementation should ensure these two values
+  // are relatively prime by reducing the fraction (dividing both by GCF) if
+  // necessary.
+  //
+  // When has_pixel_aspect_ratio == false, pixel_aspect_ratio_width and
+  // pixel_aspect_ratio_height will both be 1, but in that case the
+  // pixel_aspect_ratio_width : pixel_aspect_ratio_height of 1:1 is just a very
+  // weak suggestion re. reasonable-ish handling, not in any way authoritative.
+  // In this case (or in any case really) the receiver of this message may have
+  // other OOB means to determine the actual pixel_aspect_ratio.
+  bool has_pixel_aspect_ratio = false;
+  uint32 pixel_aspect_ratio_width = 1;
+  uint32 pixel_aspect_ratio_height = 1;
+
+  // TODO(dustingreen): Currently this assumes 8 bits per channel, but we'll
+  // need fields to indicate more bits per pixel such as 10 or 12 bits per
+  // pixel.  Also, potentially a way to indicate different number of bits per
+  // channel for 565 16 bit RGB + packing details.  Also, potentially
+  // endian-ness.
+  //
+  // TODO(dustingreen): Also, an easy way to get a template
+  // VideoUncompressedFormat that's pre-populated with reasonably-plausible
+  // values, based on a fourcc or enum value + maybe primary resolution.
+
+  VideoUncompressedFormatSpecificDetails special_formats;
+};
+
+// VideoFormat
+//
+// Video (compress or uncompressed) format details.
+union VideoFormat {
+  VideoCompressedFormat compressed;
+  VideoUncompressedFormat uncompressed;
+};
+
+// DomainFormat
+//
+// Domain-specific format details (audio or video, compressed or uncompressed).
+union DomainFormat {
+  AudioFormat audio;
+  VideoFormat video;
+};
+
+const uint64 kMaxCodecOobBytesSize = 8192;
+
+// CodecFormatDetails
+//
+// This describes/details the format on input or output of a codec (separate
+// instances for input vs. output).
+struct CodecFormatDetails {
+  // Particular instances of CodecFormatDetails will set this field to make it
+  // easier for a receiver to determine if any part of the format has changed
+  // vs. the last CodecFormatDetails received for the same context.
+  uint64 format_details_version_ordinal;
+
+  // "mime_type" strings used by particular decoders / encoders so far:
+  //
+  // SW AAC decoder:
+  //   * input:
+  //     * "audio/aac-adts" - ATDS AAC; self-contained format, but
+  //       implementation for now requires codec_oob_bytes to contain
+  //       AudioSpecificConfig() reconstructed from ADTS header data - see also
+  //       make_AudioSpecificConfig_from_ADTS_header() for now.
+  //   * output:
+  //     * "audio/raw" - stereo linear 16 bit integer PCM
+  //
+  // TODO(dustingreen): avoid requiring codec_oob_bytes when using SoftAAC2.cpp
+  // for AAC ADTS.
+  //
+  // TODO(dustingreen): Add non-ADTS AAC support (which naturally needs
+  // codec_oob_bytes).
+  //
+  // TODO(dustingreen): Consider "pseudo_mime_type", or an enum, + "domain"
+  // details as needed instead, since calling this "mime_type" could lead to
+  // confusion.
+  string mime_type;
+
+  // Some codecs have their own binary codec configuration structure.  For those
+  // codecs we allow that binary structure to be directly conveyed to the codec
+  // here.
+  //
+  // audio/aac - this is an AudioSpecificConfig().
+  // audio/aac-adts - this is not set.
+  // TODO(dustingreen): make the audio/aac-adts statement true soon.  At the
+  // moment we set this with make_AudioSpecificConfig_from_ADTS_header(), but
+  // that should not be the client's job for ADTS.
+  //
+  // For some formats whose "ES" data format is self-contained, or for which
+  // there is no format-defined binary OOB config, this is null.
+  //
+  // A server can close the channel if the count of bytes is >
+  // kMaxCodecOobBytesSize or is larger than makes any sense for the codec.  If
+  // any codec actually needs more than kMaxCodecOobBytesSize bytes here, we
+  // could potentially increase this restriction some, but this interface isn't
+  // designed to support codec OOB config blobs that approach
+  // ZX_CHANNEL_MAX_MSG_BYTES.
+  vector<uint8>? codec_oob_bytes;
+
+  // Decoder input format:
+  //
+  // If a format is not self-describing given the mime_type and a
+  // format-spec-defined codec_oob_bytes, this domain field can be set to
+  // provide the additional compressed-format-specific details.  This is
+  // expected to be fairly rare, so most compressed input formats will have
+  // only the mime_type and possibly codec_oob_bytes set, with domain typically
+  // null.  If an encoder is upstream however, domain may be set to convey the
+  // encoder settings that were used, but a decoder consumer doesn't need to
+  // look at those.
+  //
+  // Encoder output format:
+  //
+  // The encoder's compressed data output typically needs some configuration
+  // (provided in this field) that's convenient to provide in a form that's not
+  // codec_oob_bytes, and the codec can convert that config to codec_oob_bytes
+  // on encoder output via OnOutputConfig().  We retain these encoder settings
+  // in the output CodecFormatDetails to allow for cases where a downstream
+  // consumer knowing the encoder settings could be useful.
+  //
+  // TODO(dustingreen): Decide if we want to retain this, or if we'd prefer to
+  // split out config settings and maybe only represent a few encoder settings
+  // as best-effort optional aux data, like bitrate.
+  //
+  // Encoder input format / decoder output format:
+  //
+  // This field contains fairly detailed information re. uncompressed data
+  // format details, which tends to _not_ be self-describing in-band.
+  DomainFormat? domain;
+
+  // See comments above on Parameter.  At the time we lock relevant FIDL
+  // interfaces, there should be zero use of this field outside tests, but this
+  // is here in case we need to allow a codec client to convey additional config
+  // parameters to/from a codec which we didn't anticipate before locking.
+  //
+  // If there are any known "official" exceptions to the previous paragraph,
+  // we'll list them here by corresponding mime_type (none so far):
+  //   * "<mime_type>" - <usage_description>
+  //
+  // For codecs that define their own codec-specific config/OOB data, put that
+  // in codec_oob_bytes above instead of this field.
+  vector<Parameter>? pass_through_parameters;
+};
diff --git a/fidl/fuchsia.mediacodec/codec_factory.fidl b/fidl/fuchsia.mediacodec/codec_factory.fidl
new file mode 100644
index 0000000..6fad411
--- /dev/null
+++ b/fidl/fuchsia.mediacodec/codec_factory.fidl
@@ -0,0 +1,249 @@
+// 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.mediacodec;
+
+// CreateDecoder_Params
+//
+// Input parameters for creating a decoder (audio or video).
+//
+// TODO(dustingreen): Switch this to a FIDL table instead when possible.
+struct CreateDecoder_Params {
+  // Input mime type for a decoder.
+  //
+  // The recognized mime types for now:
+  // audio/aac
+  //   input_details.codec_oob_bytes must be an AudioSpecificConfig() as defined
+  //   by AAC spec.
+  // audio/aac-adts
+  //   On a temporary basis, input_details.codec_oob_bytes must be an
+  //   AudioSpecificConfig() extracted from the ADTS stream data by the client.
+  //   This is temporary.  Later, codec_oob_bytes will be ignored and allowed to
+  //   be null.  On a temporary basis, see
+  //   make_AudioSpecificConfig_from_ADTS_header() for some self-contained
+  //   conversion code.
+  //   TODO(dustingreen): fix this up server side and make most of this
+  //   paragraph go away, possibly by also parsing ADTS before it hits OMX
+  //   since the parsing code there doesn't tolerate split ADTS headers.
+  CodecFormatDetails input_details;
+
+  // The settings below nail down more details.
+
+  // This must be true in order for the client to be permitted to put a
+  // timestamp on an input packet, which is in turn required to get any
+  // timestamps on any output packets.
+  //
+  // It is always legal to provide separate Access Units (henceforth AUs) to a
+  // decoder, but this boolean must be true for a decoder to accept and
+  // propagate timestamp values.
+  //
+  // This must be true when creating a video encoder, or the CodecFactory
+  // channel will close.
+  bool promise_separate_access_units_on_input = false;
+
+  // "require" fields:
+  //
+  // Specifying any of these "require" fields can result in failure to get a
+  // Codec if there's no suitable codec.  None of these correspond to any
+  // required features of a codec server.
+  //
+  // TODO(dustingreen): implement filtering codecs based on these fields.
+
+  // Require that the selected codec be capable of accepting input where
+  // AUs are not separated into separate packets.
+  //
+  // This does not imply that the decoder can find the start of the first AU;
+  // for that see require_can_find_start.  This does not imply that the decoder
+  // can re-sync on its own if the stream data is damaged; for that see
+  // require_can_re_sync.
+  //
+  // If both promise_separate_access_units_on_input and
+  // require_can_stream_bytes_input are true, the CodecFactory channel will
+  // close.
+  //
+  // If this is false, the client must feed separate AUs on the fuchsia.ui.input.  This
+  // must be false for a video encoder, and if true the CodecFactory channel
+  // will close.
+  //
+  // Unless a client demands a decoder capable of taking concatenated AUs
+  // (require_can_stream_bytes_input true), the client must feed a decoder
+  // separate AUs.  This means the client cannot have parts of two separate AUs
+  // in the same packet, unless require_can_stream_bytes_input is true.
+  bool require_can_stream_bytes_input = false;
+
+  // A decoder is allowed to be capable of streaming bytes but not capable of
+  // searching for the start of the first usable AU.  To require both, set both
+  // require_can_stream_bytes_input and require_can_find_start.  Setting
+  // require_can_find_start without require_can_stream_bytes_input is invalid.
+  //
+  // With require_can_stream_bytes_input true but require_can_find_start false,
+  // the client must start the first packet with the start of an AU, but can
+  // send a stream of bytes after that.
+  bool require_can_find_start = false;
+
+  // On problematic input data, all decoders are expected to at least be able to
+  // close the channel rather than getting stuck in a failed and/or broken
+  // state.
+  //
+  // A decoder returned from a request with require_can_re_sync is potentially
+  // able to handle damaged input without closing the Codec channel.  Such a
+  // Codec is encouraged, but not required, to also satisfy requirements of
+  // require_report_all_detected_errors.
+  bool require_can_re_sync = false;
+
+  // Sometimes a client would rather fail an overall use of a decoder than fail
+  // to notice data corruption.  For such scenarios, the client can specify
+  // require_report_all_detected_errors.  For any codec returned from a
+  // request with require_report_all_detected_errors set, on detection of
+  // any input data corruption the codec will report in one or more of these
+  // ways:
+  //   * closing the Codec channel
+  //   * OnStreamFailed()
+  //   * error_detected_before
+  //   * error_detected_during
+  //
+  // If false, a codec may silently skip past corrupted input data.
+  //
+  // No decoder can detect all corruption, because some corruption can look like
+  // valid stream data.  This requirement is only to request a codec that
+  // is written to attempt to detect _and report_ input stream corruption.
+  //
+  // This flag is not intended to be 100% bulletproof.  If a client needs robust
+  // assurance that _all_ detectable stream corruption is _always_ detected,
+  // this flag is not enough of a guarantee to achieve that.  Since some stream
+  // corruption is inherently non-detectable in any case, such a client should
+  // consider using stronger techniques upstream to ensure that corruption can
+  // be detected with the needed probability very close to 1.
+  //
+  // This flag being true doesn't imply anything about whether the codec will
+  // discard damaged data vs. producing corresponding damaged output.  Only that
+  // the codec will set error_detected_* bools to true when appropriate.
+  //
+  // Regardless of this setting, not all timstamp_ish values provided on input
+  // are guaranteed to show up on ouput.
+  bool require_report_all_detected_errors = false;
+
+  // If true, require that the returned codec is HW-accelerated.
+  bool require_hw = false;
+
+  // permit_lack_of_split_header_handling
+  //
+  // This field is a temporary field that will be going away.
+  //
+  // TODO(dustingreen): Remove this field once we're down to zero codecs with
+  // problems handling split headers.
+  //
+  // By default, a Codec instance is required to handle "split headers", meaning
+  // that a client is allowed to deliver parts of an AU one byte at a time,
+  // including parts near the beginning of the AU, and the codec is required to
+  // tolerate and handle that properly.  However, unfortunately not all codecs
+  // properly support split headers.  If a client is willing to permit such a
+  // codec to be used, the client can set this to true.  Clients are not
+  // encouraged to set this, but setting it may be necessary to find a codec for
+  // some formats _for now_.  If a client sets this to true, the client should
+  // deliver data of each AU with many contiguous non-split bytes from the start
+  // of each AU.  The client is not strictly required to deliver one AU at a
+  // time, only to ensure that either all the AU bytes are in a single packet or
+  // that many bytes at the start of each AU are in a single packet.
+  //
+  // The specification for how a client should use this and how a client should
+  // behave if setting this to true is intentionally vague, because lack of
+  // support for header splitting is not ideal, and is expected to be
+  // temporary, and all codecs should handle split headers in the long run.
+  // The main intent of this field is to avoid giving an innocent client using
+  // default value of false here a codec that can't properly handle split
+  // headers.  This is not an attempt at a mechanism to fully work around a
+  // codec that doesn't handle split headers.
+  //
+  // TODO(dustingreen): In the near term, wire this up so that SoftAAC2.cpp
+  // used for ADTS is not selected when this field is false, even if there is
+  // no other suitable codec.  In the long term, fix or work around the header
+  // handling behavior of SoftAAC2 when used in ADTS mode (and any other
+  // similar issues in other codecs) and remove this field.
+  bool permit_lack_of_split_header_handling = false;
+};
+
+enum CodecType {
+  DECODER = 0;
+  ENCODER = 1;
+};
+
+struct CodecDescription {
+  // Decoder or encoder.
+  CodecType codec_type;
+  // The mime type of the compressed format.  For decoders this is the mime
+  // type of the input.  For encoders, this is the mime type of the output.
+  string mime_type;
+
+  // TODO(dustingreen): All these fields should be optional.
+  //
+  // TODO(dustingreen): Re-evaluate this for encoders.
+  //
+  // For each of these fields, the default is the most-capable setting, but if a
+  // codec doesn't support the most-capable behavior, then the codec must
+  // override the default.
+  bool can_stream_bytes_input = true;
+  bool can_find_start = true;
+  bool can_re_sync = true;
+  bool will_report_all_detected_errors = true;
+  bool is_hw = true;
+  bool split_header_handling = true;
+};
+
+// CodecFactory
+//
+// The purpose of the media::CodecFactory interface is to create media::Codec
+// instances.
+//
+// The interface methods don't attempt to homogenize all codec types, preferring
+// to have a separate dedicated message for decoders.  TBD whether calls for
+// creating encoders will split up audio vs. video encoders, or be combined.
+//
+// Each create request is self-contained, in the sense that the interface is not
+// stateful between create requests.
+[Discoverable]
+interface CodecFactory {
+  // Driver-based local CodecFactory(s) will send this once shortly after the
+  // main CodecFactory connects to the driver-local CodecFactory.
+  //
+  // For now, the main CodecFactory will not send this.
+  //
+  // A SW-based local CodecFactory(s) will not send this event.
+  //
+  // Each codec in the list must be separately-described, for clean aggregation.
+  1: -> OnCodecList(vector<CodecDescription> codecs);
+
+  // Rough sequence to create a decoder:
+  //
+  // factory = ConnectToEnvironmentService(CodecFactory);
+  // CreateDecoder_Params params;
+  // [fill out params]
+  // CreateDecoder(params, decoder_request);
+  //
+  // See use_media_decoder code for more detail.
+  //
+  // TODO(dustingreen): More detail in this comment block.
+
+  // Requests:
+
+  // CreateDecoder:
+  //
+  // decoder_params - See CreateDecoder_Params comments for required
+  // and optional parameters for creating a decoder.
+  //
+  // decoder - a Codec.NewRequest() which will hopefully be connected to
+  // a Codec server, or the Codec channel will get closed if no suitable codec
+  // can be found.  We don't return any additional Codec-specific status here
+  // because finding the Codec is allowed to be fully async, so we don't
+  // necessarily yet know on return from this method which Codec will be
+  // selected, if any.
+  2: CreateDecoder(
+    CreateDecoder_Params decoder_params,
+    request<Codec> decoder);
+
+  // TODO(dustingreen):
+  // CreateAudioEncoder
+  // CreateVideoEncoder
+  // (or combined)
+};
diff --git a/fidl/fuchsia.mediacodec/meta.json b/fidl/fuchsia.mediacodec/meta.json
new file mode 100644
index 0000000..9f9f144
--- /dev/null
+++ b/fidl/fuchsia.mediacodec/meta.json
@@ -0,0 +1,16 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.mediacodec/codec_common.fidl", 
+    "fidl/fuchsia.mediacodec/codec_factory.fidl", 
+    "fidl/fuchsia.mediacodec/codec.fidl"
+  ], 
+  "name": "fuchsia.mediacodec", 
+  "root": "fidl/fuchsia.mediacodec", 
+  "sources": [
+    "fidl/fuchsia.mediacodec/codec_common.fidl", 
+    "fidl/fuchsia.mediacodec/codec_factory.fidl", 
+    "fidl/fuchsia.mediacodec/codec.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.mem/buffer.fidl b/fidl/fuchsia.mem/buffer.fidl
new file mode 100644
index 0000000..ff281cc
--- /dev/null
+++ b/fidl/fuchsia.mem/buffer.fidl
@@ -0,0 +1,14 @@
+// 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.mem;
+
+struct Buffer {
+    // The vmo.
+    handle<vmo> vmo;
+
+    // The size of the data in the vmo. This size must be smaller than the
+    // physical size of the vmo.
+    uint64 size;
+};
diff --git a/fidl/fuchsia.mem/meta.json b/fidl/fuchsia.mem/meta.json
new file mode 100644
index 0000000..f12f499
--- /dev/null
+++ b/fidl/fuchsia.mem/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.mem/buffer.fidl"
+  ], 
+  "name": "fuchsia.mem", 
+  "root": "fidl/fuchsia.mem", 
+  "sources": [
+    "fidl/fuchsia.mem/buffer.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.net.http/client.fidl b/fidl/fuchsia.net.http/client.fidl
new file mode 100644
index 0000000..945a453
--- /dev/null
+++ b/fidl/fuchsia.net.http/client.fidl
@@ -0,0 +1,184 @@
+// 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.net.http;
+
+using fuchsia.mem;
+
+// An error occurred during the HTTP transaction.
+struct Error {
+    // The numerical error code.
+    //
+    // These error codes coorespond to
+    // <https://fuchsia.googlesource.com/garnet/+/master/bin/network/net_error_list.h>
+    int32 code;
+
+    // A textual description of the error in en-US.
+    string? description;
+};
+
+// An HTTP header field.
+struct Header {
+    // The name of the header field.
+    vector<uint8> name;
+
+    // The value of the header field.
+    vector<uint8> value;
+};
+
+// The body of either an HTTP request or an HTTP response.
+union Body {
+    // A buffer that will contain the complete request or response body.
+    fuchsia.mem.Buffer buffer;
+
+    // A socket that will contain the streaming request or response body.
+    handle<socket> stream;
+};
+
+// Specify the cache behavior of the request.
+enum CacheMode {
+    // Default behavior.
+    DEFAULT = 0;
+
+    // The HTTP request will bypass the local cache and will have a
+    // 'Cache-Control: nocache' header added in that causes any proxy servers
+    // to also not satisfy the request from their cache.  This has the effect
+    // of forcing a full end-to-end fetch.
+    BYPASS_CACHE = 1;
+
+    // The HTTP request will fail if it cannot serve the requested resource
+    // from the cache (or some equivalent local store).
+    ONLY_FROM_CACHE = 2;
+};
+
+// Specify the mechanism used to return the response body.
+//
+// Streaming the response can be more efficient if the response body is large
+// and can be processed incrementally (e.g., by an image decoder).
+//
+// Buffering the response can be more efficient if the response body is in cache
+// and the cache entry can be directly mapped into the resulting buffer.
+enum ResponseBodyMode {
+    // The complete response body should be returned in the |buffer| field of
+    // the response body.
+    //
+    // The loader MAY abort the transation if the buffer size exceeds an
+    // implementation-defined limit.
+    BUFFER = 0;
+
+    // The response body should be streamed through the |stream| field of the
+    // response body.
+    STREAM = 1;
+};
+
+// An HTTP request.
+struct Request {
+    // The HTTP method if applicable.
+    string method = "GET";
+
+    // The URL to load.
+    vector<uint8> url;
+
+    // Additional HTTP request headers.
+    vector<Header>? headers;
+
+    // The payload for the request body. For HTTP requests, the method must be set
+    // to "POST" or "PUT". If a buffer is used for the body, a Content-Length
+    // header will automatically be added.
+    Body? body;
+
+    // The loader will cancel the request if the peer for this event is closed.
+    //
+    // When this happens, the loader will send a Response with the appropriate
+    // error code.
+    handle<eventpair>? event;
+
+    // The cache behavior for the request.
+    CacheMode cache_mode = DEFAULT;
+
+    // The response body mode.
+    ResponseBodyMode response_body_mode = BUFFER;
+};
+
+// A description of the redirect the server requested.
+//
+// The semantics of an HTTP redirect vary according to the status code use to
+// generate the redirect. This structure ensures that the loader and its client
+// agree on the interpretation of the redirect response from the server.
+struct RedirectTarget {
+    // The HTTP method the server suggested for the redirect.
+    string method;
+
+    // The URL the server suggested for the redirect.
+    vector<uint8> url;
+
+    // The referrer the server suggested for the redirect.
+    vector<uint8> referrer;
+};
+
+// A response to an HTTP request.
+struct Response {
+    // If the response resulted in a network level error, this field will be set.
+    Error? error;
+
+    // The response body.
+    Body? body;
+
+    // The final URL of the response, after redirects have been followed.
+    vector<uint8>? url;
+
+    // The HTTP status code.
+    //
+    // 0 if not applicable.
+    uint32 status_code;
+
+    // The HTTP status line.
+    string? status_line;
+
+    // The HTTP response headers.
+    vector<Header>? headers;
+
+    // The MIME type of the response body.
+    string? mime_type;
+
+    // The character set of the response body.
+    string? charset;
+};
+
+// An HTTP loader.
+//
+// The loader can service many HTTP requests concurrently. The loader tracks all
+// the outstanding requests and will cancel them all if the client closes the
+// loader interface.
+[Discoverable]
+interface Loader {
+    // Initiate the given HTTP request, follow redirects, and return the final
+    // response.
+    //
+    // The loader will follow redirects (up to an implementation-defined limit)
+    // and return the final response as a reply to this message. To cancel the
+    // request, either close the loader interface or close the peer to the |event|
+    // included in the |request|.
+    1: Fetch(Request request) -> (Response response);
+
+    // Initiate the given HTTP request and return all intermediate responses to
+    // the given client.
+    //
+    // Unlike |Fetch|, |Start| does not automatically follow all redirects.
+    // Instead, each individual response along the redirect chain is delivered to
+    // the |LoaderClient|.
+    2: Start(Request request, LoaderClient client);
+};
+
+// A client interface used with |Loader.Start|.
+//
+// Closing the underlying channel will cancel the associated HTTP transaction.
+interface LoaderClient {
+    // Called by the loader when the loader receives an HTTP response.
+    //
+    // If the server has requested a redirect, then |redirect| will be non-null
+    // and describe the target the server requested. To follow the redirect, reply
+    // to this message. To not follow the redirect, close the underlying channel.
+    1: OnResponse(Response response, RedirectTarget? redirect) -> ();
+};
diff --git a/fidl/fuchsia.net.http/meta.json b/fidl/fuchsia.net.http/meta.json
new file mode 100644
index 0000000..024fdfe
--- /dev/null
+++ b/fidl/fuchsia.net.http/meta.json
@@ -0,0 +1,14 @@
+{
+  "deps": [
+    "fuchsia.mem"
+  ], 
+  "files": [
+    "fidl/fuchsia.net.http/client.fidl"
+  ], 
+  "name": "fuchsia.net.http", 
+  "root": "fidl/fuchsia.net.http", 
+  "sources": [
+    "fidl/fuchsia.net.http/client.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.net.oldhttp/http_error.fidl b/fidl/fuchsia.net.oldhttp/http_error.fidl
new file mode 100644
index 0000000..db39ed6
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/http_error.fidl
@@ -0,0 +1,10 @@
+// Copyright 2015 The Chromium 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.net.oldhttp;
+
+struct HttpError {
+  int32 code;
+  string? description;
+};
diff --git a/fidl/fuchsia.net.oldhttp/http_header.fidl b/fidl/fuchsia.net.oldhttp/http_header.fidl
new file mode 100644
index 0000000..5e5f48f
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/http_header.fidl
@@ -0,0 +1,10 @@
+// Copyright 2015 The Chromium 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.net.oldhttp;
+
+struct HttpHeader {
+  string name;
+  string value;
+};
diff --git a/fidl/fuchsia.net.oldhttp/http_service.fidl b/fidl/fuchsia.net.oldhttp/http_service.fidl
new file mode 100644
index 0000000..8e960a7
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/http_service.fidl
@@ -0,0 +1,10 @@
+// Copyright 2015 The Chromium 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.net.oldhttp;
+
+[Discoverable]
+interface HttpService {
+  1: CreateURLLoader(request<URLLoader> loader);
+};
diff --git a/fidl/fuchsia.net.oldhttp/meta.json b/fidl/fuchsia.net.oldhttp/meta.json
new file mode 100644
index 0000000..1078f70
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/meta.json
@@ -0,0 +1,27 @@
+{
+  "deps": [
+    "fuchsia.mem", 
+    "fuchsia.netstack"
+  ], 
+  "files": [
+    "fidl/fuchsia.net.oldhttp/http_error.fidl", 
+    "fidl/fuchsia.net.oldhttp/http_header.fidl", 
+    "fidl/fuchsia.net.oldhttp/http_service.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_body.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_loader.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_request.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_response.fidl"
+  ], 
+  "name": "fuchsia.net.oldhttp", 
+  "root": "fidl/fuchsia.net.oldhttp", 
+  "sources": [
+    "fidl/fuchsia.net.oldhttp/http_error.fidl", 
+    "fidl/fuchsia.net.oldhttp/http_header.fidl", 
+    "fidl/fuchsia.net.oldhttp/http_service.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_body.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_loader.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_request.fidl", 
+    "fidl/fuchsia.net.oldhttp/url_response.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.net.oldhttp/url_body.fidl b/fidl/fuchsia.net.oldhttp/url_body.fidl
new file mode 100644
index 0000000..d0bb9b2
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/url_body.fidl
@@ -0,0 +1,14 @@
+// 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.net.oldhttp;
+
+using fuchsia.mem;
+
+union URLBody {
+  // A socket that will contain the streaming request or response body.
+  handle<socket> stream;
+  // A shared buffer that will contain the complete request or response body.
+  fuchsia.mem.Buffer buffer;
+};
diff --git a/fidl/fuchsia.net.oldhttp/url_loader.fidl b/fidl/fuchsia.net.oldhttp/url_loader.fidl
new file mode 100644
index 0000000..4f44c0c
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/url_loader.fidl
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium 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.net.oldhttp;
+
+struct URLLoaderStatus {
+  // If the loader has failed due to a network level error, this field will be
+  // set.
+  HttpError? error;
+
+  // Set to true if the URLLoader is still working. Set to false once an error
+  // is encountered or the response body is completely copied to the response
+  // body stream.
+  bool is_loading;
+
+  // TODO(darin): Add further details about the stages of loading (e.g.,
+  // "resolving host") that happen prior to receiving bytes.
+};
+
+interface URLLoader {
+  // Loads the given |request|, asynchronously producing |response|. Consult
+  // |response| to determine if the request resulted in an error, was
+  // redirected, or has a response body to be consumed.
+  1: Start(URLRequest request) -> (URLResponse response);
+
+  // If the request passed to |Start| had |auto_follow_redirects| set to false,
+  // then upon receiving an URLResponse with a non-NULL |redirect_url| field,
+  // |FollowRedirect| may be called to load the URL indicated by the redirect.
+  2: FollowRedirect() -> (URLResponse response);
+
+  // Query status about the URLLoader.
+  3: QueryStatus() -> (URLLoaderStatus status);
+};
diff --git a/fidl/fuchsia.net.oldhttp/url_request.fidl b/fidl/fuchsia.net.oldhttp/url_request.fidl
new file mode 100644
index 0000000..999675e
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/url_request.fidl
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium 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.net.oldhttp;
+
+// Specify the cache behavior of the request.
+enum CacheMode {
+  // Default behavior.
+  DEFAULT = 0;
+
+  // The HTTP request will bypass the local cache and will have a
+  // 'Cache-Control: nocache' header added in that causes any proxy servers
+  // to also not satisfy the request from their cache.  This has the effect
+  // of forcing a full end-to-end fetch.
+  BYPASS_CACHE = 1;
+
+  // The HTTP request will fail if it cannot serve the requested resource
+  // from the cache (or some equivalent local store).
+  ONLY_FROM_CACHE = 2;
+};
+
+// Specify the mechanism used to return the response body.
+enum ResponseBodyMode {
+  // The complete response body should be returned in the |buffer| field of
+  // the response body.
+  BUFFER = 0;
+  // The response body should be streamed through the |stream| field of the
+  // response body.
+  STREAM = 1;
+  // The response body may be returned as a buffer or stream.
+  BUFFER_OR_STREAM = 2;
+};
+
+struct URLRequest {
+  // The URL to load.
+  string url;
+
+  // The HTTP method if applicable.
+  string method = "GET";
+
+  // Additional HTTP request headers.
+  vector<HttpHeader>? headers;
+
+  // The payload for the request body. For HTTP requests, the method must be set
+  // to "POST" or "PUT". If a buffer is used for the body, a Content-Length
+  // header will automatically be added.
+  URLBody? body;
+
+  // The buffer size of the socket returned in URLResponse's |body| member.
+  // A value of 0 indicates that the default buffer size should be used.  This
+  // value is just a suggestion. The URLLoader may choose to ignore this value.
+  uint32 response_body_buffer_size = 0;
+
+  // If set to true, then redirects will be automatically followed. Otherwise,
+  // when a redirect is encounterd, FollowRedirect must be called to proceed.
+  bool auto_follow_redirects = false;
+
+  // The cache behavior for the request.
+  CacheMode cache_mode = DEFAULT;
+
+  // The response body mode.
+  ResponseBodyMode response_body_mode = STREAM;
+};
diff --git a/fidl/fuchsia.net.oldhttp/url_response.fidl b/fidl/fuchsia.net.oldhttp/url_response.fidl
new file mode 100644
index 0000000..e8667ca
--- /dev/null
+++ b/fidl/fuchsia.net.oldhttp/url_response.fidl
@@ -0,0 +1,38 @@
+// Copyright 2015 The Chromium 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.net.oldhttp;
+
+struct URLResponse {
+  // If the response resulted in a network level error, this field will be set.
+  HttpError? error;
+
+  // The response body.
+  URLBody? body;
+
+  // The final URL of the response, after redirects have been followed.
+  string? url;
+
+  // The HTTP status code. 0 if not applicable.
+  uint32 status_code;
+
+  // The HTTP status line.
+  string? status_line;
+
+  // The HTTP response headers.
+  vector<HttpHeader>? headers;
+
+  // The MIME type of the response body.
+  string? mime_type;
+
+  // The character set of the response body.
+  string? charset;
+
+  // These fields are set to non-NULL if this response corresponds to a
+  // redirect.  Call the |FollowRedirect| method on the URLLoader instance to
+  // follow this redirect.
+  string? redirect_method;
+  string? redirect_url;
+  string? redirect_referrer;
+};
diff --git a/fidl/fuchsia.net/connectivity.fidl b/fidl/fuchsia.net/connectivity.fidl
new file mode 100644
index 0000000..671cb9d
--- /dev/null
+++ b/fidl/fuchsia.net/connectivity.fidl
@@ -0,0 +1,10 @@
+// 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.net;
+
+[Discoverable]
+interface Connectivity {
+    1: -> OnNetworkReachable(bool reachable);
+};
diff --git a/fidl/fuchsia.net/meta.json b/fidl/fuchsia.net/meta.json
new file mode 100644
index 0000000..4c6f872
--- /dev/null
+++ b/fidl/fuchsia.net/meta.json
@@ -0,0 +1,16 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.net/connectivity.fidl", 
+    "fidl/fuchsia.net/net.fidl", 
+    "fidl/fuchsia.net/socket.fidl"
+  ], 
+  "name": "fuchsia.net", 
+  "root": "fidl/fuchsia.net", 
+  "sources": [
+    "fidl/fuchsia.net/connectivity.fidl", 
+    "fidl/fuchsia.net/net.fidl", 
+    "fidl/fuchsia.net/socket.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.net/net.fidl b/fidl/fuchsia.net/net.fidl
new file mode 100644
index 0000000..b881862
--- /dev/null
+++ b/fidl/fuchsia.net/net.fidl
@@ -0,0 +1,34 @@
+// 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.net;
+
+// IPv4Address is expressed in network byte order, so the most significant byte
+// ("127" in the address "127.0.0.1") will be at index 0.
+struct IPv4Address {
+    array<uint8>:4 addr;
+};
+
+// IPv6Address is expressed in network byte order, so the most significant byte
+// ("ff" in the address "ff02::1") will be at index 0.
+struct IPv6Address {
+    array<uint8>:16 addr;
+};
+
+union IpAddress {
+    IPv4Address ipv4;
+    IPv6Address ipv6;
+};
+
+struct Subnet {
+    // The IPv4 or IPv6 address. Only the |prefix_len| most significant bits may be set in |addr|;
+    // all bits in the host portion of the address must be zero.
+    IpAddress addr;
+
+    // The prefix length of the netmask. E.g. for 192.168.1.0/24, the prefix
+    // length is 24, corresponding to a netmask of 255.255.255.0.
+    // For IPv4, prefix_len must be in the range [0, 32].
+    // For IPv6, prefix_len must be in the range [0, 128].
+    uint8 prefix_len;
+};
diff --git a/fidl/fuchsia.net/socket.fidl b/fidl/fuchsia.net/socket.fidl
new file mode 100644
index 0000000..34b8f23
--- /dev/null
+++ b/fidl/fuchsia.net/socket.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.net;
+
+// Legacy interface to create a socket
+enum SocketDomain {
+    inet = 2;
+    inet6 = 10;
+};
+
+enum SocketType {
+    stream = 1;
+    dgram = 2;
+};
+
+enum SocketProtocol {
+    ip = 0;
+    icmp = 1;
+    tcp = 6;
+    udp = 17;
+    ipv6 = 41;
+    icmpv6 = 58;
+};
+
+enum AddrInfoStatus {
+    ok = 0;
+    // invalid flags
+    bad_flags = 1;
+    // missing node name or service name
+    no_name = 2;
+    // temporary failure
+    again = 3;
+    // non-recoverable failure
+    fail = 4;
+    // no address found for node name
+    no_data = 5;
+    // argument buffer overflow
+    buffer_overflow = 6;
+    // system error
+    system_error = 7;
+};
+
+struct AddrInfoHints {
+    int32 flags;
+    int32 family;
+    int32 sock_type;
+    int32 protocol;
+};
+
+struct AddrStorage {
+    array<uint8>:16 val;
+    uint32 len;
+};
+
+struct AddrInfo {
+    int32 flags;
+    int32 family;
+    int32 sock_type;
+    int32 protocol;
+    AddrStorage addr; // TODO(tamird): use vector<uint8>:16 addr when we can?
+    uint16 port;
+};
+
+[Discoverable, Layout = "Simple"]
+interface LegacySocketProvider {
+    1: OpenSocket(SocketDomain domain, SocketType type, SocketProtocol protocol)
+           -> (handle<socket>? s, int32 status);
+    2: GetAddrInfo(string:256? node, string:256? service, AddrInfoHints? hints)
+           -> (AddrInfoStatus status, uint32 nres, array<AddrInfo>:4 res);
+    // TODO(tamird): change (nres, res) to a vector once we can.
+};
diff --git a/fidl/fuchsia.netstack/meta.json b/fidl/fuchsia.netstack/meta.json
new file mode 100644
index 0000000..90d68f4
--- /dev/null
+++ b/fidl/fuchsia.netstack/meta.json
@@ -0,0 +1,15 @@
+{
+  "deps": [
+    "fuchsia.net", 
+    "zircon.ethernet"
+  ], 
+  "files": [
+    "fidl/fuchsia.netstack/netstack.fidl"
+  ], 
+  "name": "fuchsia.netstack", 
+  "root": "fidl/fuchsia.netstack", 
+  "sources": [
+    "fidl/fuchsia.netstack/netstack.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.netstack/netstack.fidl b/fidl/fuchsia.netstack/netstack.fidl
new file mode 100644
index 0000000..1b582f4
--- /dev/null
+++ b/fidl/fuchsia.netstack/netstack.fidl
@@ -0,0 +1,197 @@
+// Copyright 2013 The Chromium 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.netstack;
+
+using fuchsia.net;
+using zircon.ethernet;
+using zx;
+
+enum Protocol {
+    UNSPECIFIED = 0;
+    UDP = 1;
+    TCP = 2;
+};
+
+enum Status {
+    OK = 0;
+    UNKNOWN_ERROR = 1;
+    DNS_ERROR = 2;
+    PARSE_ERROR = 3;
+    IPV4_ONLY = 4;
+    UNKNOWN_INTERFACE = 5;
+};
+
+struct NetErr {
+    Status status;
+    string message;
+};
+
+struct NetTrafficStats {
+    // See network interface stats in Linux for future ideas:
+    // https://chromium.googlesource.com/native_client/linux-headers-for-nacl/+/2dc04f8190a54defc0d59e693fa6cff3e8a916a9/include/linux/if_link.h#7
+
+    uint64 pkts_total;
+    uint64 pkts_echo_req; // request
+    uint64 pkts_echo_rep; // reply
+    uint64 pkts_echo_req_v6; // request
+    uint64 pkts_echo_rep_v6; // reply
+
+    uint64 bytes_total;
+};
+
+struct NetInterfaceStats {
+    // Placeholder for all statistics regarding the network interface,
+    // including, but not limited to traffic itself.
+
+    int64 up_since; // Unix epoch.
+
+    NetTrafficStats rx;
+    NetTrafficStats tx;
+};
+
+struct IpStats {
+    uint64 packets_received;
+    uint64 invalid_addresses_received;
+    uint64 packets_delivered;
+    uint64 packets_sent;
+    uint64 outgoing_packet_errors;
+};
+
+struct TcpStats {
+    uint64 active_connection_openings;
+    uint64 passive_connection_openings;
+    uint64 failed_connection_attempts;
+    uint64 valid_segments_received;
+    uint64 invalid_segments_received;
+    uint64 segments_sent;
+    uint64 resets_sent;
+};
+
+struct UdpStats {
+    uint64 packets_received;
+    uint64 unknown_port_errors;
+    uint64 receive_buffer_errors;
+    uint64 malformed_packets_received;
+    uint64 packets_sent;
+};
+
+// Mirrors tcpip.Stats in third_party/netstack/tcpip/tcpip.go.
+struct AggregateStats {
+    uint64 unknown_protocol_received_packets;
+    uint64 malformed_received_packets;
+    uint64 dropped_packets;
+    IpStats ip_stats;
+    TcpStats tcp_stats;
+    UdpStats udp_stats;
+};
+
+struct InterfaceConfig {
+    string name;
+    IpAddressConfig ip_address_config;
+};
+
+union IpAddressConfig {
+    fuchsia.net.Subnet static_ip;
+    bool dhcp;
+};
+
+// https://linux.die.net/man/7/netdevice
+struct NetInterface {
+    uint32 id;
+    uint32 flags;
+    uint32 features;
+    uint32 configuration;
+    string name;
+    fuchsia.net.IpAddress addr;
+    fuchsia.net.IpAddress netmask;
+    fuchsia.net.IpAddress broadaddr;
+    vector<fuchsia.net.Subnet> ipv6addrs;
+    vector<uint8> hwaddr;
+};
+
+// Flags for NetInterface.flags.
+const uint32 NetInterfaceFlagUp = 0x01; // Set if the interface is up.
+const uint32 NetInterfaceFlagDhcp = 0x02; // Set if DHCP is enabled.
+
+struct RouteTableEntry {
+    fuchsia.net.IpAddress destination;
+    fuchsia.net.IpAddress netmask;
+    fuchsia.net.IpAddress gateway;
+    uint32 nicid;
+};
+
+struct SocketAddress {
+    fuchsia.net.IpAddress addr;
+    uint16 port;
+};
+
+[Discoverable]
+interface Netstack {
+    // Finds the port number from a given service name and protocol. [service] can be a
+    // number like "42", or a service name like "http". If [protocol] is UNSPECIFIED,
+    // the service is checked for TCP first, then UDP.
+    2: GetPortForService(string service, Protocol protocol) -> (uint16 port);
+
+    // Finds the IP address for a given host name and port. This may issue network
+    // requests via DNS to look up domain names. E.g.
+    // GetAddress("example.com", 80) -> [{142.42.42.1}]
+    3: GetAddress(string address, uint16 port) -> (vector<SocketAddress> addresses, NetErr err);
+
+    // Returns the list of registered network interfaces.
+    4: GetInterfaces() -> (vector<NetInterface> interfaces);
+
+    // DEPRECATED: see devicesettings.fidl
+    // Returns the netstack's node name.
+    // 5: GetNodeName() -> (string node_name);
+
+    // Don't use this for read-modify-write.  Use StartRouteTableTransaction instead.
+    5: GetRouteTable() -> (vector<RouteTableEntry> rt);
+
+    // TODO (porce): Separate interfaces.
+    6: GetStats(uint32 nicid) -> (NetInterfaceStats stats);
+
+    // Get stats for all NICs on the stack.
+    7: GetAggregateStats() -> (AggregateStats stats);
+
+    // Sets the status (up or down) for the interface with the given nicid.
+    8: SetInterfaceStatus(uint32 nicid, bool enabled);
+
+    // DEPRECATED: Use StartRouteTableTransaction and SetRouteTable from there.
+    // 9: SetRouteTable(vector<RouteTableEntry> rt);
+
+    // Sets the address for the interface with the given nicid.
+    // Masks off addr.PrefixLen bits from addr.Addr to set the subnet.
+    10: SetInterfaceAddress(uint32 nicid, fuchsia.net.IpAddress addr, uint8 prefixLen) -> (NetErr result);
+
+    // Removes the address for the interface with the given nicid.
+    // Masks off addr.PrefixLen bits from addr.Addr to set the subnet.
+    15: RemoveInterfaceAddress(uint32 nicid, fuchsia.net.IpAddress addr, uint8 prefixLen) -> (NetErr result);
+
+    11: SetDhcpClientStatus(uint32 nicid, bool enabled) -> (NetErr result);
+
+    12: BridgeInterfaces(vector<uint32> nicids) -> (NetErr result);
+
+    // TODO(NET-1263): remove once we can use the ResolverAdmin interface
+    16: SetNameServers(vector<fuchsia.net.IpAddress> servers);
+
+    17: AddEthernetDevice(string topological_path, InterfaceConfig interfaceConfig, zircon.ethernet.Device device);
+
+    // Begin a route transaction for atomically getting and setting the route
+    // table.  Returns true if a transaction can be started.
+    18: StartRouteTableTransaction(request<RouteTableTransaction> routeTableTransaction) -> (zx.status status);
+
+    0x1000: -> OnInterfacesChanged(vector<NetInterface> interfaces);
+};
+
+// When Commit is called, the most recent SetRouteTable will be
+// committed to the route tables.  Commit may be called multiple times.
+[Discoverable]
+interface RouteTableTransaction {
+    1: GetRouteTable() -> (vector<RouteTableEntry> rt);
+
+    2: SetRouteTable(vector<RouteTableEntry> rt);
+
+    3: Commit() -> (zx.status status);
+};
diff --git a/fidl/fuchsia.process/launcher.fidl b/fidl/fuchsia.process/launcher.fidl
new file mode 100644
index 0000000..5415894
--- /dev/null
+++ b/fidl/fuchsia.process/launcher.fidl
@@ -0,0 +1,148 @@
+// 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.process;
+
+using fuchsia.io;
+using zx;
+
+struct HandleInfo {
+    // The handle to use for this argument.
+    handle handle;
+
+    // Process argument identifier, from <zircon/processargs.h>.
+    uint32 id;
+};
+
+struct NameInfo {
+    // Path at which to install the associated directory.
+    //
+    // Must be an absolute path (i.e., start with '/').
+    string path;
+
+    // The associated directory.
+    fuchsia.io.Directory directory;
+};
+
+struct LaunchInfo {
+    // The executable to run in the process.
+    handle<vmo> executable;
+
+    // The job in which to create the process.
+    handle<job> job;
+
+    // The name to assign to the created process.
+    string name;
+};
+
+struct LaunchResult {
+    // A status code describing the result of the launch.
+    zx.status status;
+
+    // A string describing the failure.
+    //
+    // Non-null when |status| is an error.
+    string? error_message;
+
+    // The process that was launched.
+    //
+    // Present when |status| is ZX_OK.
+    handle<process>? process;
+};
+
+struct ProcessStartData {
+    // The process that was created.
+    handle<process> process;
+
+    // The vmar object that was created when the process was created.
+    //
+    // See <https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/process_create.md>.
+    handle<vmar> root_vmar;
+
+    // The initial thread for the process.
+    //
+    // Should be passed to |zx_process_start| when starting the process.
+    handle<thread> thread;
+
+    // The address of the initial entry point in the process.
+    //
+    // Should be passed to |zx_process_start| when starting the process.
+    uint64 entry;
+
+    // The stack pointer value for the initial thread of the process.
+    //
+    // Should be passed to |zx_process_start| when starting the process.
+    uint64 sp;
+
+    // The bootstrap channel to pass to the process on startup.
+    //
+    // Should be passed to |zx_process_start| when starting the process.
+    handle<channel> bootstrap;
+
+    // The base address of the vDSO to pass to the process on startup.
+    //
+    // Should be passed to |zx_process_start| when starting the process.
+    uint64 vdso_base;
+
+    // The base load address of the ELF file loaded.
+    //
+    // Most often used by debuggers or other tools that inspect the process.
+    uint64 base;
+};
+
+struct CreateWithoutStartingResult {
+    // A status code describing the result of the launch.
+    zx.status status;
+
+    // A string describing the failure.
+    //
+    // Non-null when |status| is an error.
+    string? error_message;
+
+    // Data describing the process that was created.
+    //
+    // Non-null when |status| is ZX_OK.
+    ProcessStartData? data;
+};
+
+[Discoverable]
+interface Launcher {
+    // Creates and starts the process described by |info|.
+    //
+    // After processing this message, the |Launcher| is reset to its initial
+    // state and is ready to launch another process.
+    1: Launch(LaunchInfo info) -> (LaunchResult result);
+
+    // Creates the process described by |info| but does not start it.
+    //
+    // After processing this message, the |Launcher| is reset to its initial
+    // state and is ready to launch another process.
+    //
+    // The caller is responsible for calling |zx_process_start| using the data
+    // in |ProcessStartData| to actually start the process.
+    2: CreateWithoutStarting(LaunchInfo info) -> (CreateWithoutStartingResult result);
+
+    // Adds the given arguments to the command-line for the process.
+    //
+    // Calling this method multiple times concatenattes the arguments.
+    10: AddArgs(vector<string> args);
+
+    // Adds the given variables to the environment variables for the process.
+    //
+    // Calling this method multiple times concatenates the variables.
+    11: AddEnvirons(vector<string> environ);
+
+    // Adds the given names to the namespace for the process.
+    //
+    // The paths in the namespace must be non-overlapping. See
+    // <https://fuchsia.googlesource.com/docs/+/master/the-book/namespaces.md> for details.
+    //
+    // Calling this method multiple times concatenates the names.
+    12: AddNames(vector<NameInfo> names);
+
+    // Adds the given handles to the startup handles for the process.
+    //
+    // Calling this method multiple times concatenates the handles.
+    13: AddHandles(vector<HandleInfo> handles);
+};
diff --git a/fidl/fuchsia.process/meta.json b/fidl/fuchsia.process/meta.json
new file mode 100644
index 0000000..5f06c40
--- /dev/null
+++ b/fidl/fuchsia.process/meta.json
@@ -0,0 +1,17 @@
+{
+  "deps": [
+    "fuchsia.io", 
+    "fuchsia.ldsvc"
+  ], 
+  "files": [
+    "fidl/fuchsia.process/launcher.fidl", 
+    "fidl/fuchsia.process/resolver.fidl"
+  ], 
+  "name": "fuchsia.process", 
+  "root": "fidl/fuchsia.process", 
+  "sources": [
+    "fidl/fuchsia.process/launcher.fidl", 
+    "fidl/fuchsia.process/resolver.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.process/resolver.fidl b/fidl/fuchsia.process/resolver.fidl
new file mode 100644
index 0000000..780f8f9
--- /dev/null
+++ b/fidl/fuchsia.process/resolver.fidl
@@ -0,0 +1,26 @@
+// 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.process;
+
+using fuchsia.ldsvc;
+using zx;
+
+const uint32 MAX_RESOLVE_NAME = 2048;
+
+[Discoverable, Layout = "Simple"]
+interface Resolver {
+    // Resolves the given |name| to an |executable| and an shared library loader.
+    //
+    // If present, the |executable| is suitable for use as the |executable|
+    // property of |LaunchInfo|. If present, the |ldsvc| is suitable for use as
+    // the PA_LDSVC_LOADER handle when launching the process.
+    //
+    // For example, the resolver might locate the given |name| inside a package
+    // and return the executable binary from the package as well as a shared
+    // library loader scoped to that package.
+    1: Resolve(string:MAX_RESOLVE_NAME name) -> (zx.status status,
+                                                 handle<vmo>? executable,
+                                                 fuchsia.ldsvc.Loader? ldsvc);
+};
diff --git a/fidl/fuchsia.simplecamera/meta.json b/fidl/fuchsia.simplecamera/meta.json
new file mode 100644
index 0000000..8370c5b
--- /dev/null
+++ b/fidl/fuchsia.simplecamera/meta.json
@@ -0,0 +1,14 @@
+{
+  "deps": [
+    "fuchsia.images"
+  ], 
+  "files": [
+    "fidl/fuchsia.simplecamera/simple_camera.fidl"
+  ], 
+  "name": "fuchsia.simplecamera", 
+  "root": "fidl/fuchsia.simplecamera", 
+  "sources": [
+    "fidl/fuchsia.simplecamera/simple_camera.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.simplecamera/simple_camera.fidl b/fidl/fuchsia.simplecamera/simple_camera.fidl
new file mode 100644
index 0000000..f551fde
--- /dev/null
+++ b/fidl/fuchsia.simplecamera/simple_camera.fidl
@@ -0,0 +1,16 @@
+// 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.simplecamera;
+
+using fuchsia.images;
+
+// Simple camera interface.  This will be deprecated when
+// CameraManager replaces it.
+[Discoverable]
+interface SimpleCamera {
+  // Connect to a camera using the first enumerated format.
+  // The device opened will be /dev/class/camera/camera_id
+  1: ConnectToCamera(uint32 camera_id, fuchsia.images.ImagePipe image_pipe);
+};
diff --git a/fidl/fuchsia.sys/component_controller.fidl b/fidl/fuchsia.sys/component_controller.fidl
new file mode 100644
index 0000000..42e20ec
--- /dev/null
+++ b/fidl/fuchsia.sys/component_controller.fidl
@@ -0,0 +1,65 @@
+// Copyright 2016 The Chromium 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.sys;
+
+enum TerminationReason {
+  // The channel closed without giving a termination reason.
+  UNKNOWN = 0;
+  // Component ran and exited with a given return_code.
+  EXITED = 1;
+  // The given URL given to launch was invalid.
+  URL_INVALID = 2;
+  // The requested package could not be found.
+  PACKAGE_NOT_FOUND = 3;
+  // An internal error happened during the launch process.
+  INTERNAL_ERROR = 4;
+  // Process creation failed.
+  PROCESS_CREATION_ERROR = 5;
+  // A Runner failed to start.
+  RUNNER_FAILED = 6;
+  // A Runner terminated while attempting to run a component.
+  RUNNER_TERMINATED = 7;
+  // Attempted to use an unsupported feature.
+  UNSUPPORTED = 8;
+};
+
+// An interface for controlling components.
+//
+// Closing this interface implicitly kills the controlled component unless
+// the |Detach| method has been called.
+//
+// If the component exits, this interface will be closed.
+//
+// Typically obtained via |Launcher.CreateComponent|.
+interface ComponentController {
+  // Terminates the component.
+  //
+  // This ComponentController connection is closed when the component has
+  // terminated.
+  1: Kill();
+
+  // Decouples the lifetime of the component from this controller.
+  //
+  // After calling |Detach|, the component will not be implicitly killed when
+  // this interface is closed.
+  2: Detach();
+
+  // DEPRECATED: Use OnTerminated instead of Wait().
+  // 3: Wait()
+
+  // Event that is triggered when the component is terminated.
+  //
+  // This event provides the return code of the process and reason for
+  // its termination. The return_code is only valid if the termination
+  // reason is EXITED. If the termination reason is not EXITED, the
+  // return code is guaranteed not to be 0.
+  4: -> OnTerminated(int64 return_code, TerminationReason termination_reason);
+
+  // Event that is triggered when the component's output directory is mounted.
+  //
+  // This event will not be triggered for every component, only those that
+  // serve a directory over their PA_DIRECTORY_REQUEST handle.
+  5: -> OnDirectoryReady();
+};
diff --git a/fidl/fuchsia.sys/environment.fidl b/fidl/fuchsia.sys/environment.fidl
new file mode 100644
index 0000000..2bbf1b3
--- /dev/null
+++ b/fidl/fuchsia.sys/environment.fidl
@@ -0,0 +1,71 @@
+// Copyright 2016 The Chromium 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.sys;
+
+// Maximum length for an environment label.
+const uint32 kLabelMaxLength = 32;
+
+struct EnvironmentOptions {
+  // True if this environment should inherit services provided by the
+  // parent environment.
+  bool inherit_parent_services;
+  // True if components in this environment can share a runner provided
+  // by the parent environment. If false, a new runner will be started
+  // in this environment for components.
+  bool allow_parent_runners;
+  // True if this environment should be killed first in out of memory
+  // situations by setting the ZX_PROP_JOB_KILL_ON_OOM property on this
+  // environment's job.
+  bool kill_on_oom;
+};
+
+// An interface for managing a set of applications.
+//
+// Applications run inside environments, which provide ambient services and
+// support for their lifecycle.
+[Discoverable] interface Environment {
+  // Creates a new environment nested inside this environment.
+  //
+  // When applications are created inside the nested environment using the
+  // environment's |Launcher|, the environment requests the
+  // environment services from |host_directory| before passing those services to
+  // the newly created application in its |StartupInfo|.
+  //
+  // The |controller| can be used to control the lifecycle of the created
+  // environment. If an |EnvironmentController|'s interface is
+  // request, the environment will be killed when the interface is closed.
+  //
+  // The |label| is an optional name to associate with the environment for
+  // diagnostic purposes.  The label will be truncated if it is longer
+  // than |kLabelMaxLength|.
+  //
+  // |additional_services|, which may be empty, contains a list of services
+  // that the environment provides, which are hosted by
+  // |additional_services.host_directory|. If |options.inherit_parent_services|
+  // is false, |host_directory| must provide a |Loader| service if it wishes to
+  // allow new components to be loaded in the new environment.
+  //
+  // |options| provides additional options, see |EnvironmentOptions| for
+  // details.
+  1: CreateNestedEnvironment(request<Environment> environment,
+                             request<EnvironmentController>? controller,
+                             string? label,
+                             ServiceList? additional_services,
+                             EnvironmentOptions options);
+
+  // Gets the Launcher associated with this environment.
+  //
+  // Applications created using this application launcher will be given the
+  // environment services provided by this environment's |host_directory|.
+  2: GetLauncher(request<Launcher> launcher);
+
+  // Gets a superset of services provided by this environment's
+  // |host_directory|.
+  3: GetServices(request<ServiceProvider> services);
+
+  // Gets a superset of services provided by this environment's
+  // |host_directory|.
+  4: GetDirectory(handle<channel> directory_request);
+};
diff --git a/fidl/fuchsia.sys/environment_controller.fidl b/fidl/fuchsia.sys/environment_controller.fidl
new file mode 100644
index 0000000..c886c6b
--- /dev/null
+++ b/fidl/fuchsia.sys/environment_controller.fidl
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium 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.sys;
+
+// An interface for controlling an environment.
+//
+// Closing this interface implicitly kills the controlled environment unless
+// the |Detach| method has been called.
+//
+// If the environment is destroyed, this interface will be closed.
+//
+// Typically obtained via |Environment.CreateNestedEnvironment|.
+interface EnvironmentController {
+  // Terminates the environment.
+  //
+  // When an |Environment| is terminated, all applications launched
+  // in the environment (and in all transitively nested environments) are also
+  // killed.
+  1: Kill() -> ();
+
+  // Decouples the lifetime of the environment from this controller.
+  //
+  // After calling |Detach|, the environment will not be implicitly killed when
+  // this interface is closed.
+  2: Detach();
+
+  // Event that is triggered when the environment is created.
+  3: -> OnCreated();
+};
diff --git a/fidl/fuchsia.sys/flat_namespace.fidl b/fidl/fuchsia.sys/flat_namespace.fidl
new file mode 100644
index 0000000..fe8bdb9
--- /dev/null
+++ b/fidl/fuchsia.sys/flat_namespace.fidl
@@ -0,0 +1,15 @@
+// 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.sys;
+
+struct FlatNamespace {
+  // The mount point for each of the directories below.
+  //
+  // For example, ["/pkg", "/svc"].
+  vector<string> paths;
+
+  // The directories mounted at each path in the namespace.
+  vector<handle<channel>> directories;
+};
diff --git a/fidl/fuchsia.sys/job_provider.fidl b/fidl/fuchsia.sys/job_provider.fidl
new file mode 100644
index 0000000..dbdbe7d
--- /dev/null
+++ b/fidl/fuchsia.sys/job_provider.fidl
@@ -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.
+
+library fuchsia.sys;
+
+// An interface for providing a job handle. Instances of this interface are
+// created in the context of an already-identified realm, so there is no need
+// to explicitly identify the realm below.
+[Discoverable]
+interface JobProvider {
+  // Gets the root job associated with the realm.
+  1: GetJob() -> (handle<job> job);
+};
diff --git a/fidl/fuchsia.sys/launcher.fidl b/fidl/fuchsia.sys/launcher.fidl
new file mode 100644
index 0000000..0df4415
--- /dev/null
+++ b/fidl/fuchsia.sys/launcher.fidl
@@ -0,0 +1,91 @@
+// Copyright 2016 The Chromium 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.sys;
+
+// An FDIO file descriptor.
+// TODO(abarth): Use the real FDIO declaration once FDIO converts to FIDL2.
+struct FileDescriptor {
+  // The FDIO types of the handle (e.g., FA_FDIO_REMOTE).
+  int32 type0;
+  int32 type1;
+  int32 type2;
+
+  // The handles for the file descriptor (e.g., a channel).
+  handle? handle0;
+  handle? handle1;
+  handle? handle2;
+};
+
+// Information used to create an instance of a component and obtain
+// services from it.
+struct LaunchInfo {
+  // The location from which to retrieve this component.
+  //
+  // This field will probably be replaced with a stronger notion of identity,
+  // such as an unforgeable token. This field is included in this iteration to
+  // ease the transition from the previous component interfaces.
+  string url;
+
+  // The arguments to be provided to the component.
+  vector<string>? arguments;
+
+  // The file descriptor to use for stdout.
+  //
+  // If null, the component will use the default stdout for the environment.
+  FileDescriptor? out;
+
+  // The file descriptor to use for stderr.
+  //
+  // If null, the component will use the default stderr for the environment.
+  FileDescriptor? err;
+
+  // The interface request for a Directory that is passed through to the
+  // component and arrives in the component as its |directory_request|
+  // interface request.
+  handle<channel>? directory_request;
+
+  // A custom namespace that can be appended to the namespace generated by
+  // appmgr and provided to this component.
+  // Adding a mount point at standard paths like 'pkg' or 'svc' will be ignored.
+  // HACK(alhaad): Adding mount points for deprecated default directories like
+  // '/data' will override the default.
+  FlatNamespace? flat_namespace;
+
+  // A list of services to be added to this component's svc namespace. These
+  // services are in addition to those coming from Environment.
+  ServiceList? additional_services;
+};
+
+struct ServiceList {
+  // A list of services that can be requested from |provider|.
+  vector<string> names;
+
+  // A service provider to get the services listed in |names| from.
+  ServiceProvider? provider;
+
+  // A channel to the directory hosting the services in |names|.
+  // TODO(CP-124): Support |host_directory| for CreateComponent and deprecate
+  // |provider|.
+  handle<channel>? host_directory;
+};
+
+// An interface for creating component instances.
+//
+// Typically obtained via |Environment.GetLauncher|.
+[Discoverable]
+interface Launcher {
+  // Creates a new instance of the component described by |launch_info|.
+  //
+  // The component instance is created in the |Environment|
+  // associated with this |Launcher|. When creating the component,
+  // the environment requests the environment services for this component from
+  // its |EnvironmentHost|.
+  //
+  // The |controller| can be used to control the lifecycle of the created
+  // component instance. If an |ComponentController|'s interface is
+  // requested, the component instance is killed when the interface is closed.
+  1: CreateComponent(LaunchInfo launch_info,
+                     request<ComponentController>? controller);
+};
diff --git a/fidl/fuchsia.sys/loader.fidl b/fidl/fuchsia.sys/loader.fidl
new file mode 100644
index 0000000..c8ed6ab
--- /dev/null
+++ b/fidl/fuchsia.sys/loader.fidl
@@ -0,0 +1,12 @@
+// Copyright 2016 The Chromium 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.sys;
+
+// An interface for loading from pacakges.
+[Discoverable]
+interface Loader {
+    // LoadUrl a package by url.
+    1: LoadUrl(string url) -> (Package? package);
+};
diff --git a/fidl/fuchsia.sys/meta.json b/fidl/fuchsia.sys/meta.json
new file mode 100644
index 0000000..35dee7e
--- /dev/null
+++ b/fidl/fuchsia.sys/meta.json
@@ -0,0 +1,30 @@
+{
+  "deps": [
+    "fuchsia.mem"
+  ], 
+  "files": [
+    "fidl/fuchsia.sys/component_controller.fidl", 
+    "fidl/fuchsia.sys/environment.fidl", 
+    "fidl/fuchsia.sys/environment_controller.fidl", 
+    "fidl/fuchsia.sys/flat_namespace.fidl", 
+    "fidl/fuchsia.sys/job_provider.fidl", 
+    "fidl/fuchsia.sys/launcher.fidl", 
+    "fidl/fuchsia.sys/loader.fidl", 
+    "fidl/fuchsia.sys/runner.fidl", 
+    "fidl/fuchsia.sys/service_provider.fidl"
+  ], 
+  "name": "fuchsia.sys", 
+  "root": "fidl/fuchsia.sys", 
+  "sources": [
+    "fidl/fuchsia.sys/component_controller.fidl", 
+    "fidl/fuchsia.sys/environment.fidl", 
+    "fidl/fuchsia.sys/environment_controller.fidl", 
+    "fidl/fuchsia.sys/flat_namespace.fidl", 
+    "fidl/fuchsia.sys/job_provider.fidl", 
+    "fidl/fuchsia.sys/launcher.fidl", 
+    "fidl/fuchsia.sys/loader.fidl", 
+    "fidl/fuchsia.sys/runner.fidl", 
+    "fidl/fuchsia.sys/service_provider.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.sys/runner.fidl b/fidl/fuchsia.sys/runner.fidl
new file mode 100644
index 0000000..dfa10e4
--- /dev/null
+++ b/fidl/fuchsia.sys/runner.fidl
@@ -0,0 +1,78 @@
+// Copyright 2016 The Chromium 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.sys;
+
+using fuchsia.mem;
+
+// Information given to components at startup.
+//
+// For ELF binaries, this information is provided in the initialization message
+// given to libc by fuchsia.process.Launcher.
+struct StartupInfo {
+  // The launch info for the to start.
+  LaunchInfo launch_info;
+
+  // The namespace in which to run the component.
+  FlatNamespace flat_namespace;
+
+  // Key string value string map of the component's program metadata, obtained
+  // from its component manifest.
+  vector<ProgramMetadata>? program_metadata;
+
+  // TODO(abarth): Add more fields to this struct relating to component and
+  // environment identity.
+};
+
+// Program information about a component.
+struct ProgramMetadata {
+  // Key for program metadata pair. E.g. "binary" for an ELF binary component,
+  // or "data" for a flutter/dart component.
+  string key;
+
+  // Value for program metadata pair. E.g. "bin/app" for a "binary" key, or
+  // "data/foo" for a flutter/dart component.
+  string value;
+};
+
+// A binary representation of a component.
+//
+// Typically provided to |Runner.StartComponent| when starting a
+// component.
+struct Package {
+  // A read-only binary representation of the component. For example, if the
+  // component is intended to run in the Dart virtual machine, this data might
+  // contain a dartx package.
+  fuchsia.mem.Buffer? data;
+
+  // A directory containing the contents of the package. For example, if the
+  // component is stored in pkgfs, this directory will be the pkgfs directory
+  // containing the package.
+  handle<channel>? directory;
+
+  // Resolved URL of the component. This is the url specified in startup_info
+  // after following redirects and resolving relative paths.
+  string resolved_url;
+};
+
+// An interface for running components.
+//
+// Typically exposed by components that provide execution environments for
+// particular classes of programs. For example, the Dart virtual machine exposes
+// this interface to run Dart programs.
+[Discoverable]
+interface Runner {
+  // Execute the given component.
+  //
+  // Upon startup, the component is to be given the information in
+  // |startup_info|, but the mechanism by which the component receives that
+  // information is up to the component runner.
+  //
+  // The |controller| interface request typically originates from the
+  // |Launcher.CreateComponent| message that caused this
+  // component to be started.
+  1: StartComponent(Package package,
+                    StartupInfo startup_info,
+                    request<ComponentController>? controller);
+};
diff --git a/fidl/fuchsia.sys/service_provider.fidl b/fidl/fuchsia.sys/service_provider.fidl
new file mode 100644
index 0000000..be2ef12
--- /dev/null
+++ b/fidl/fuchsia.sys/service_provider.fidl
@@ -0,0 +1,20 @@
+// Copyright 2014 The Chromium 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.sys;
+
+// An interface through which a client may request services from a host.
+// Instances of this interface are created within the context of an
+// already-identified client and host pair, so there is no need to explicitly
+// identify the client or host in the methods below.
+//
+// This interface is deprecated.  Services should be published as directory
+// entries instead, just like files.
+// TODO(ZX-1358): Point to the FIDL interface for file I/O once RIO is migrated.
+interface ServiceProvider {
+  // Asks the host to provide the service identified by |service_name| through
+  // the |channel| endpoint supplied by the caller. If the host is not willing
+  // or able to provide the requested service, it should close the |channel|.
+  1: ConnectToService(string service_name, handle<channel> channel);
+};
diff --git a/fidl/fuchsia.sysinfo/meta.json b/fidl/fuchsia.sysinfo/meta.json
new file mode 100644
index 0000000..98fb975
--- /dev/null
+++ b/fidl/fuchsia.sysinfo/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.sysinfo/sysinfo.fidl"
+  ], 
+  "name": "fuchsia.sysinfo", 
+  "root": "fidl/fuchsia.sysinfo", 
+  "sources": [
+    "fidl/fuchsia.sysinfo/sysinfo.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.sysinfo/sysinfo.fidl b/fidl/fuchsia.sysinfo/sysinfo.fidl
new file mode 100644
index 0000000..4cfd790
--- /dev/null
+++ b/fidl/fuchsia.sysinfo/sysinfo.fidl
@@ -0,0 +1,38 @@
+// 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.sysinfo;
+
+using zx;
+
+const uint8 SYSINFO_BOARD_NAME_LEN = 32;
+
+enum InterruptControllerType {
+    UNKNOWN = 0;
+    APIC = 1;
+    GIC_V2 = 2;
+    GIC_V3 = 3;
+};
+
+struct InterruptControllerInfo {
+    InterruptControllerType type;
+};
+
+[Layout = "Simple"]
+interface Device {
+    // Return the root job handle.
+    1: GetRootJob() -> (zx.status status, handle<job>? job);
+
+    // Return the root resource (with only ZX_RIGHT_ENUMERATE and ZX_RIGHT_TRANSFER).
+    2: GetRootResource() -> (zx.status status, handle<resource>? resource);
+
+    // Return the hypervisor resource (with only ZX_RIGHT_TRANSFER).
+    3: GetHypervisorResource() -> (zx.status status, handle<resource>? resource);
+
+    // Return the board name for the platform we are running on.
+    4: GetBoardName() -> (zx.status status, string:SYSINFO_BOARD_NAME_LEN? name);
+
+    // Return interrupt controller information.
+    5: GetInterruptControllerInfo() -> (zx.status status, InterruptControllerInfo? info);
+};
diff --git a/fidl/fuchsia.ui.app/meta.json b/fidl/fuchsia.ui.app/meta.json
new file mode 100644
index 0000000..1b67046
--- /dev/null
+++ b/fidl/fuchsia.ui.app/meta.json
@@ -0,0 +1,14 @@
+{
+  "deps": [
+    "fuchsia.sys"
+  ], 
+  "files": [
+    "fidl/fuchsia.ui.app/view_provider.fidl"
+  ], 
+  "name": "fuchsia.ui.app", 
+  "root": "fidl/fuchsia.ui.app", 
+  "sources": [
+    "fidl/fuchsia.ui.app/view_provider.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.app/view_provider.fidl b/fidl/fuchsia.ui.app/view_provider.fidl
new file mode 100644
index 0000000..0e1dbda
--- /dev/null
+++ b/fidl/fuchsia.ui.app/view_provider.fidl
@@ -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.
+
+library fuchsia.ui.app;
+
+using fuchsia.sys;
+
+// NOTE: This is likely not the ViewProvider you are looking for!  This is
+// the new ViewProvider interface that will be deprecating the old one soon.
+// The old ViewProvider is in fuchsia.ui.viewsv1.ViewProvider.
+// TODO(SCN-589): Remove this when old ViewProvider is deleted.
+//
+// ViewProvider is the standard mechanism for two modules to each obtain half
+// of a shared eventpair token.  The shared token is a capability allowing the
+// modules to ask Scenic to create a ViewHolder/View pair.  The resulting
+// View and ViewHolder are linked together until either one is destroyed.
+//
+// Modules are free to use any other mechanism to agree upon the shared
+// eventpair token, and use this to create the linked ViewHolder/View.
+// ViewProvider is given for the convenience of clients that don't require
+// a more complex implementation.
+[Discoverable]
+interface ViewProvider {
+    // Creates a new View under the control of the ViewProvider.
+    //
+    // |token| is one half of the shared eventpair which will bind the new View
+    // to its associated ViewHolder.  The ViewProvider will use |token| to
+    // create its internal View representation.  The caller is expected to use
+    // its half to create corresponding ViewHolder object.
+    //
+    // |incoming_services| allows clients to request services from the
+    // ViewProvider implementation.  |outgoing_services| allows clients to
+    // provide services of their own to the ViewProvider implementation.
+    //
+    // Clients can embed a ViewHolder (and by proxy the paired View) into their
+    // scene graph by using |Node.AddChild()|.  The ViewHolder cannot itself
+    // have any children. A ViewProvider implementation can nest scene objects
+    // within its View by using |View.AddChild()|.  The View itself
+    // cannot be a child of anything.
+    //
+    // Modules can use these mechanisms to establish a distributed,
+    // inter-process scene graph.
+    1: CreateView(handle<eventpair> token,
+                  request<fuchsia.sys.ServiceProvider>? incoming_services,
+                  fuchsia.sys.ServiceProvider? outgoing_services);
+};
diff --git a/fidl/fuchsia.ui.gfx/commands.fidl b/fidl/fuchsia.ui.gfx/commands.fidl
new file mode 100644
index 0000000..a780347
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/commands.fidl
@@ -0,0 +1,724 @@
+// 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.ui.gfx;
+
+using fuchsia.mem;
+
+// Commands that are used to modify the state of a |Session|.
+// TODO(SCN-237): reorder Command definitions to match the order in this union.
+union Command {
+  CreateResourceCmd create_resource;
+  ReleaseResourceCmd release_resource;
+  ExportResourceCmd export_resource;
+  ImportResourceCmd import_resource;
+
+  // Tagging commands.
+  SetTagCmd set_tag;
+
+  // Grouping commands.
+  DetachCmd detach;
+
+  // Spatial commands.
+  SetTranslationCmd set_translation;
+  SetScaleCmd set_scale;
+  SetRotationCmd set_rotation;
+  SetAnchorCmd set_anchor;
+  SetSizeCmd set_size;
+  SetOpacityCmd set_opacity;
+
+  SendSizeChangeHintCmdHACK send_size_change_hint_hack;
+
+  // Node-specific commands.
+  AddChildCmd add_child;  // TODO: Should we require a DetachCmd before
+                              // re-parenting?
+  AddPartCmd add_part;
+  DetachChildrenCmd detach_children;
+  SetShapeCmd set_shape;
+  SetMaterialCmd set_material;
+  SetClipCmd set_clip;
+  SetHitTestBehaviorCmd set_hit_test_behavior;
+  SetViewPropertiesCmd set_view_properties;
+  TakeSnapshotCmdHACK take_snapshot_cmd;
+
+  // Camera and lighting commands.
+  SetCameraCmd set_camera;
+  SetCameraTransformCmd set_camera_transform;
+  SetCameraProjectionCmd set_camera_projection;
+  SetStereoCameraProjectionCmd set_stereo_camera_projection;
+  SetCameraPoseBufferCmd set_camera_pose_buffer;
+  SetLightColorCmd set_light_color;
+  SetLightDirectionCmd set_light_direction;
+  AddLightCmd add_light;
+  DetachLightCmd detach_light;
+  DetachLightsCmd detach_lights;
+
+  SetTextureCmd set_texture;
+  SetColorCmd set_color;
+
+  // Mesh commands.
+  BindMeshBuffersCmd bind_mesh_buffers;
+
+  // Layer and renderer commands.
+  AddLayerCmd add_layer;
+  RemoveLayerCmd remove_layer;
+  RemoveAllLayersCmd remove_all_layers;
+  SetLayerStackCmd set_layer_stack;
+  SetRendererCmd set_renderer;
+  SetRendererParamCmd set_renderer_param;
+
+  // Events.
+  SetEventMaskCmd set_event_mask;
+
+  // Diagnostic commands.
+  SetLabelCmd set_label;
+
+  // Debugging commands.
+  SetDisableClippingCmd set_disable_clipping;
+
+  // TODO(SCN-1026): Remove this.
+  SetImportFocusCmd set_import_focus;
+};
+
+// Instructs the compositor to create the specified |Resource|, and to register
+// it in a table so that it can be referenced by subsequent commands.
+struct CreateResourceCmd {
+  // An ID that is currently not used within the session.
+  uint32 id;
+  ResourceArgs resource;
+};
+
+// Releases the client's reference to the resource; it is then illegal to use
+// the ID in subsequent Commands.  Other references to the resource may exist,
+// so releasing the resource does not result in its immediate destruction; it is
+// only destroyed once the last reference is released.  For example, the
+// resource may be required to render an in-progress frame, or it may be
+// referred to by another resource).  However, the ID will be immediately
+// unregistered, and may be reused to create a new resource.
+struct ReleaseResourceCmd {
+  // ID of the resource to be dereferenced.
+  uint32 id;
+};
+
+// Create an external reference to the specified resource, which can then be
+// imported into another Session by passing a handle to |token|'s peer to
+// ImportResourceCmd; see that comment for more details.
+//
+// The importing client is typically in a different process than the exporter.
+// No specific mechanism is provided for transferring a token from an exporter
+// to an importer; collaborators may choose any out-of-band API they wish to do
+// so.
+struct ExportResourceCmd {
+  uint32 id;
+  handle<eventpair> token;
+};
+
+// Import a resource that was exported via ExportResourceCmd().  |token| is
+// a handle to the eventpair peer that was used to export the resource, and
+// |spec| describes the type of the imported resource, and the commands which
+// can legally be applied to it.  Afterward, |id| can be used to refer to the
+// resource in an Command, similarly (but not identically: see below) to a
+// resource that was created in the session.  For example, you can add children
+// to an imported EntityNode via AddChildCmd.
+//
+// However, note that the importer does not gain full access to the imported
+// resource, but rather to an attenuated subset of its capabilities.  For
+// example, you cannot use a DetachCmd to detach an imported EntityNode from
+// its parent.
+//
+// Unlike ExportResourceCmd, there is no configurable timeout.  There is an
+// expectation that the exported resource will become available in a short
+// amount of time.  TODO: this needs elaboration... e.g. we might notify via the
+// SessionListener when we know that the link will never be made (e.g. if the
+// peer of the import token is destroyed).
+//
+// TODO: describe how the imported resource behaves if the exported resource
+// isn't yet available, or becomes unavailable (e.g. an imported Material might
+// act as a plain white texture).
+struct ImportResourceCmd {
+  uint32 id;
+  handle<eventpair> token;
+  ImportSpec spec;
+};
+
+// Maximum length for a resource label.
+const uint32 kLabelMaxLength = 32;
+
+// Sets/clears a label to help developers identify the purpose of the resource
+// when using diagnostic tools.
+//
+// The label serves no functional purpose in the scene graph.  It exists only
+// to help developers understand its structure.  The scene manager may truncate
+// or discard labels at will.
+//
+// Constraints:
+// - The label's maximum length is |kLabelMaxLength| characters.
+// - Setting the label to an empty string clears it.
+struct SetLabelCmd {
+  uint32 id;
+  string label;
+};
+
+// Add a node as a child to another node.
+//
+// Constraints:
+// - |id| refs a Node with the has_children characteristic.
+// - |child_id| refs any Node.
+//
+// Discussion:
+// The child node is first removed from its existing parent, as if DetachCmd
+// was applied first.
+struct AddChildCmd {
+  uint32 node_id;
+  uint32 child_id;
+};
+
+// Add a node as a part of another node.  The implications of being a part
+// rather than a child differ based on the type of the part.  However, one
+// implication is constant: removing all of a node's children (e.g. via
+// DetachChildrenCmd) does not affect its parts.  This is similar to the
+// "shadow DOM" in a web browser: the controls of a <video> element are
+// implemented as using the shadow DOM, and do no show up amongst the children
+// of that element.
+//
+// Constraints:
+// - |id| refs a Node with the has_parts characteristic.
+// - |part_id| refs any Node.
+//
+// Discussion:
+// The part node is first removed from its existing parent, as if DetachCmd
+// was applied first.
+struct AddPartCmd {
+  uint32 node_id;
+  uint32 part_id;
+};
+
+interface SnapshotCallbackHACK {
+  1: OnData(fuchsia.mem.Buffer data);
+};
+
+struct TakeSnapshotCmdHACK {
+  uint32 node_id;
+  SnapshotCallbackHACK callback;
+};
+
+// Detaches a parentable object from its parent (e.g. a node from a parent node,
+// or a layer from a layer stack).  It is illegal to apply this command to a
+// non-parentable object.  No-op if the target object currently has no parent.
+//
+// Constraints:
+// - |id| refs a parentable object
+//
+// Discussion:
+// For nodes, this command will detach a node from its parent, regardless of
+// whether it is a part or a child of its parent.
+struct DetachCmd {
+  uint32 id;
+};
+
+// Detaches all of a node's children (but not its parts).
+struct DetachChildrenCmd {
+  uint32 node_id;
+};
+
+// Sets/clears a node's tag value.
+//
+// A session can apply a tag value to any node to which it has access, including
+// imported nodes.  These tags are private to the session and cannot be read
+// or modified by other sessions.  When multiple sessions import the same node,
+// each session will only observe its own tag values.
+//
+// Hit test results for a session only include nodes which the session has
+// tagged with a non-zero value.  Therefore a session can use tag values to
+// associate nodes with their functional purpose when picked.
+//
+// Constraints:
+// - |node_id| refs a |Node|.
+// - |tag_value| is the tag value to assign, or 0 to remove the tag.
+struct SetTagCmd {
+  uint32 node_id;
+  uint32 tag_value;
+};
+
+// Sets a Resource's (typically a Node's) translation.
+//
+// Constraints:
+// - |id| refs a Resource with the has_transform characteristic.
+struct SetTranslationCmd {
+  uint32 id;
+  Vector3Value value;
+};
+
+// Sets a Resource's (typically a Node's) scale.
+//
+// Constraints:
+// - |id| refs a Resource with the has_transform characteristic.
+struct SetScaleCmd {
+  uint32 id;
+  Vector3Value value;
+};
+
+// Sets a Resource's (typically a Node's) rotation.
+//
+// Constraints:
+// - |id| refs a Resource with the has_transform characteristic.
+struct SetRotationCmd {
+  uint32 id;
+  QuaternionValue value;
+};
+
+// Sets a Resource's (typically a Node's) anchor point.
+//
+// Constraints:
+// - |id| refs a Resource with the has_transform characteristic.
+struct SetAnchorCmd {
+  uint32 id;
+  Vector3Value value;
+};
+
+// Sets an object's size.
+//
+// Constraints:
+// - |id| refs a resizeable object.
+// - some objects that support this command may have additional constraints
+//   (e.g. in some cases |depth| must be zero).
+struct SetSizeCmd {
+  uint32 id;
+  Vector2Value value;
+};
+
+// Sends a hint about a pending size change to the given node and all nodes
+// below. This is generally sent before an animation.
+//
+// |width_change_factor| and |height_change_factor| is how much bigger or smaller
+// the item is expected to be in the near future. This one number encapsulate
+// both changes in scale, as well as changes to layout width and height.
+struct SendSizeChangeHintCmdHACK {
+  uint32 node_id;
+  float32 width_change_factor;
+  float32 height_change_factor;
+};
+
+// Sets a node's opacity.
+//
+// Constraints:
+// - |node_id| refs a |Node| with the has_opacity characteristic.
+// - |opacity| is in the range [0, 1].
+struct SetOpacityCmd {
+  uint32 node_id;
+  float32 opacity;
+};
+
+// Sets/clears a node's shape.
+//
+// Constraints:
+// - |node_id| refs a |Node| with the has_shape characteristic.
+// - |shape_id| refs a |Shape|, or nothing.
+// - if this command causes the target to have both a |Shape| and a |Material|,
+//   then these must be compatible with each other (see README.md regarding
+//   "Shape/Material Compatibility").
+// TODO: add "Shape/Material Compatibility section"
+//
+// Discussion:
+// In order to be painted, a node requires both a |Shape| and a |Material|.
+// Without a material, a node can still participate in hit-testing and clipping.
+// Without a shape, a node cannot do any of the above.
+struct SetShapeCmd {
+  uint32 node_id;
+  uint32 shape_id;
+};
+
+// Sets/clears a node's material.
+//
+// Constraints:
+// - |node_id| refs a |Node| with the has_material characteristic.
+// - |material_id| refs a |Material|, or nothing.
+// - if this command causes the target to have both a |Shape| and a |Material|,
+//   then these must be compatible with each other (see README.md regarding
+//   "Shape/Material Compatibility").
+// TODO: add "Shape/Material Compatibility section"
+//
+// Discussion:
+// In order to be painted, a node requires both a |Shape| and a |Material|.
+// Without a material, a node can still participate in hit-testing and clipping.
+// Without a shape, a node cannot do any of the above.
+struct SetMaterialCmd {
+  uint32 node_id;
+  uint32 material_id;
+};
+
+// Sets/clears a node's clip.
+//
+// Constraints:
+// - |node_id| refs a |Node| with the has_clip characteristic.
+// - |clip_id| a |Node| with the is_clip characteristic, or nothing.  If the
+//   referenced node is not rooted, then it will have no effect (since its
+//   full world-transform cannot be determined).
+// - |clip_to_self| If false, children are only clipped to the region specified
+//   by |clip_id|.  If true, children are additionally clipped to the node's
+//   shape (as determined by its ShapeNode parts).
+//
+// Discussion:
+// If a node has a clip, it will be applied to both the parts and the children
+// of the node.  Under some circumstances (TBD), a clip will not be applicable
+// to a node; in such cases it will be as though no clip has been specified for
+// the node.
+// TODO: elaborate on the circumstances under which a clip is inapplicable.
+// For example, consider a 3D space that looks through a portal into a 2D space
+// that uses a clip for a circular reveal.  It would not be meaningful to clip
+// objects on the outside (i.e. in the 3D space).
+struct SetClipCmd {
+  uint32 node_id;
+  uint32 clip_id;
+  bool clip_to_self;
+};
+
+// Sets a node's hit test behavior.
+//
+// Discussion:
+// By default, hit testing is performed on the node's content, its parts,
+// and its children.
+struct SetHitTestBehaviorCmd {
+  uint32 node_id;
+  HitTestBehavior hit_test_behavior;
+};
+
+// Sets the properties for a ViewHolder's attached View.
+//
+// Constraints:
+// - |view_holder_id| refs a |ViewHolder|.
+struct SetViewPropertiesCmd {
+  uint32 view_holder_id;
+  ViewProperties properties;
+};
+
+// Sets a renderer's camera.
+//
+// Constraints:
+// - |renderer_id| refs a |Renderer|.
+// - |camera_id| refs a |Camera|, or stops rendering by passing zero.
+// - |matrix| is a value or variable of type kMatrix4x4.
+struct SetCameraCmd {
+  uint32 renderer_id;
+  uint32 camera_id;
+};
+
+// Sets a camera's view matrix.
+// This operation can be applied to both Cameras and StereoCameras.
+//
+// Constraints:
+// - |camera_id| refs a |Camera|.
+// - |eye_position| is the position of the eye.
+// - |eye_look_at| is the point is the scene the that eye is pointed at.
+// - |eye_up| defines the camera's "up" vector.
+struct SetCameraTransformCmd {
+  uint32 camera_id;
+  Vector3Value eye_position;
+  Vector3Value eye_look_at;
+  Vector3Value eye_up;
+};
+
+// Sets a camera's projection matrix.
+// This operation cannot be applied to a StereoCamera.
+//
+// Constraints:
+// - |camera_id| refs a |Camera| that is not a |StereoCamera|.
+// - |fovy| is the Y-axis field of view, in radians.
+//
+// NOTE: A default orthographic projection is specified by setting |fovy| to
+// zero.  In this case, the camera transform is ignored.
+struct SetCameraProjectionCmd {
+  uint32 camera_id;
+  FloatValue fovy;  // Y-axis field of view, in radians.
+};
+
+// Sets a StereoCamera's projection matrices.
+// This operation can only be applied to a StereoCamera.
+//
+// Constraints:
+// - |camera_id| refs a |StereoCamera|.
+// - |left_projection| is the projection matrix for the left eye.
+// - |right_projection| is the projection matrix for the right eye.
+//
+// These projection matrices may also contain a transform in camera space for
+// their eye if needed.
+struct SetStereoCameraProjectionCmd {
+  uint32 camera_id;
+  Matrix4Value left_projection;
+  Matrix4Value right_projection;
+};
+
+// Sets the "pose buffer" for the camera identified by |camera_id|.
+// This operation can be applied to both Cameras and StereoCameras.
+//
+// This will override any position and rotation set for the camera and will
+// make it take its position and rotation from the pose buffer each frame
+// based on the presentation time for that frame.
+//
+// A pose buffer represents a ring buffer of poses for a fixed number of time
+// points in the future. Each entry in the buffer identified by |buffer_id| is
+// a quaternion and a position layed out as follows:
+//
+// struct Pose {
+//   // Quaternion
+//   float32 a;
+//   float32 b;
+//   float32 c;
+//   float32 d;
+//
+//   // Position
+//   float32 x;
+//   float32 y;
+//   float32 z;
+//
+//   // Reserved/Padding
+//   byte[4] reserved;
+// }
+//
+// The buffer can be thought of as a packed array of |num_entries| Pose structs
+// and is required to be at least num_entries * sizeof(Pose) bytes.
+//
+// The quaternions and positions are specified in the space of the camera's
+// parent node.
+//
+// |base_time| is a base time point expressed in nanoseconds in the
+// |CLOCK_MONOTONIC| timebase and |time_interval| is the time in nanoseconds
+// between entries in the buffer. |base_time| must be in the past.
+//
+// For a given point in time |t| expressed in nanoseconds in the
+// |CLOCK_MONOTONIC| timebase the index of the corresponding pose in
+// the pose buffer can be computed as follows:
+//
+// index(t) = ((t - base_time) / time_interval) % num_entries
+//
+// poses[index(t)] is valid for t over the time interval (t - time_interval, t]
+// and should be expected to updated continuously without synchronization
+// for the duration of that interval. If a single pose value is needed for
+// multiple non-atomic operations a value should be latched and stored outside
+// the pose buffer.
+//
+// Because the poses are not protected by any synchronization primitives it is
+// possible that when a pose is latched it will be only partially updated, and
+// the pose being read will contain some components from the pose before it is
+// updated and some components from the updated pose. The safety of using these
+// "torn" poses relies on two things:
+//
+// 1) Sequential poses written to poses[index(t)] are very similar to each
+// other numerically, so that if some components are taken from the first and
+// some are taken from another the result is numerically similar to both
+//
+// 2) The space of positions and quaternions is locally flat at the scale of
+// changes between sequential updates, which guarantees that two poses which
+// are numerically similar also represent semantically similar poses (i.e.
+// there are no discontinuities which will cause a small numerical change in
+// the position or quaterninon to cause a large change in the encoded pose)
+// For positions this is guaranteed because Scenic uses a Euclidean 3-space
+// which is globally flat and for quaternions this is guaranteed because
+// quaternions encode rotation as points on a unit 4-sphere, and spheres are
+// locally flat. For more details on the encoding of rotations in quaterions
+// see https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
+//
+// This commanderation is intended for late latching camera pose to support
+// low-latency motion-tracked rendering.
+struct SetCameraPoseBufferCmd {
+  uint32 camera_id;
+  uint32 buffer_id;
+  uint32 num_entries;
+  int64 base_time;
+  uint64 time_interval;
+};
+
+// Sets the color of the Light identified by |light_id|.
+struct SetLightColorCmd {
+  uint32 light_id;
+  ColorRgbValue color;
+};
+
+// Sets the direction of the DirectionalLight identified by |light_id|.
+struct SetLightDirectionCmd {
+  uint32 light_id;
+  Vector3Value direction;
+};
+
+// Adds the light specified by |light_id| specified by |light_id| to the scene
+// identified by |scene_id|.
+struct AddLightCmd {
+  uint32 scene_id;
+  uint32 light_id;
+};
+
+// Detach the light specified by |light_id| from the scene that it is attached
+// to, if any.
+struct DetachLightCmd {
+  uint32 light_id;
+};
+
+// Detach all lights from the scene specified by |scene_id|.
+struct DetachLightsCmd {
+  uint32 scene_id;
+};
+
+// Sets/clears a material's texture.
+//
+// Constraints:
+// - |material_id| refs a |Material|.
+// - |texture_id| refs a |Image|, |ImagePipe|, or nothing.
+//
+// If no texture is provided (i.e. |texture_id| is zero), a solid color is used.
+// If a texture is provided, then the value sampled from the texture is
+// multiplied by the color.
+struct SetTextureCmd {
+  uint32 material_id;
+  uint32 texture_id;  // Refers to an Image resource.  May be zero (no texture).
+};
+
+// Sets a material's color.
+//
+// Constraints:
+// - |material_id| refs a |Material|.
+//
+// If a texture is set on the material, then the value sampled from the texture
+// is multiplied by the color.
+struct SetColorCmd {
+  uint32 material_id;
+  ColorRgbaValue color;
+};
+
+// Set a mesh's indices and vertices.
+//
+// |mesh_id| refs the Mesh to be updated.
+// |index_buffer_id| refs a Buffer that contains the mesh indices.
+// |index_format| defines how the index buffer data is to be interpreted.
+// |index_offset| number of bytes from the start of the index Buffer.
+// |index_count| number of indices.
+// |vertex_buffer_id| refs a Buffer that contains the mesh vertices.
+// |vertex_format| defines how the vertex buffer data is to be interpreted.
+// |vertex_offset| number of bytes from the start of the vertex Buffer.
+// |vertex_count| number of vertices.
+// |bounding_box| must contain all vertices within the specified range.
+//
+// The MeshVertexFormat defines which per-vertex attributes are provided by the
+// mesh, and the size of each attribute (and therefore the size of each vertex).
+// The attributes are ordered within the vertex in the same order that they
+// appear within the MeshVertexFormat struct.  For example, if the values are
+// kVector3, kNone and kVector2, then:
+//   - each vertex has a position and UV-coordinates, but no surface normal.
+//   - the 3D position occupies bytes 0-11 (3 dimensions * 4 bytes per float32).
+//   - the UV coords occupy bytes 12-19, since no surface normal is provided.
+enum MeshIndexFormat {
+  // TODO(SCN-275): only kUint32 is currently supported.
+  kUint16 = 1;
+  kUint32 = 2;
+};
+
+struct MeshVertexFormat {
+  // kVector2 or kVector3.
+  ValueType position_type;
+  // kVector2 or kVector3 (must match position_type), or kNone.
+  ValueType normal_type;
+  // kVector2 or kNone.
+  ValueType tex_coord_type;
+};
+
+struct BindMeshBuffersCmd {
+  uint32 mesh_id;
+  uint32 index_buffer_id;
+  MeshIndexFormat index_format;
+  uint64 index_offset;
+  uint32 index_count;
+  uint32 vertex_buffer_id;
+  MeshVertexFormat vertex_format;
+  uint64 vertex_offset;
+  uint32 vertex_count;
+  BoundingBox bounding_box;
+};
+
+// Add a layer to a layer stack.
+// Constraints:
+// - |layer_stack_id| refs a |LayerStack|.
+// - |layer_id| refs a |Layer|.
+// - The layer must not already belong to a different stack; it must first be
+//   detached.
+struct AddLayerCmd {
+  uint32 layer_stack_id;
+  uint32 layer_id;
+};
+
+// Remove a layer from a layer stack.
+// Constraints:
+// - |layer_stack_id| refs a |LayerStack|.
+// - |layer_id| refs a |Layer|.
+// - The layer must belong to this stack.
+struct RemoveLayerCmd {
+  uint32 layer_stack_id;
+  uint32 layer_id;
+};
+
+// Remove all layers from a layer stack.
+// Constraints
+// - |layer_stack_id| refs a |LayerStack|.
+struct RemoveAllLayersCmd {
+  uint32 layer_stack_id;
+};
+
+// Set a compositor's layer stack, replacing the current stack (if any).
+// Constraints:
+// - |compositor_id| refs a |DisplayCompositor| or |ImagePipeCompositor|.
+// - |layer_stack_id| refs a |LayerStack|.
+struct SetLayerStackCmd {
+  uint32 compositor_id;
+  uint32 layer_stack_id;
+};
+
+// Set a layer's renderer, replacing the current renderer (if any).
+// Constraints:
+// - |layer_id| refs a |Layer|.
+// - |renderer_id| refs a |Renderer|.
+struct SetRendererCmd {
+  uint32 layer_id;
+  uint32 renderer_id;
+};
+
+// Sets a parameter that affects how a renderer renders a scene.
+//
+// |renderer_id| refs the Renderer that is being modified.
+// |param| describes the parameter that should be set, and to what.
+struct SetRendererParamCmd {
+  uint32 renderer_id;
+  RendererParam param;
+};
+
+// Sets which events a resource should deliver to the session listener.
+// This command replaces any prior event mask for the resource.
+//
+// The initial event mask for a resource is zero, meaning no events are
+// reported.
+//
+// Constraints:
+// - |resource_id| is a valid resource id
+// - |event_mask| is zero or a combination of |k*EventMask| bits OR'ed together.
+struct SetEventMaskCmd {
+  uint32 id;
+  uint32 event_mask;
+};
+
+// Set whether clipping should be disabled for the specified renderer.  For a
+// newly-created renderer, clipping will NOT be disabled (i.e. it will be
+// enabled).
+//
+// NOTE: this disables visual clipping only; objects are still clipped for the
+// purposes of hit-testing.
+//
+// |renderer_id| refs the target renderer.
+// |disable_clipping| specifies whether the clipping should be disabled.
+struct SetDisableClippingCmd {
+  uint32 renderer_id;
+  bool disable_clipping;
+};
+
+// TODO(SCN-1026): Remove this.
+struct SetImportFocusCmd {
+  uint32 id;
+  bool focusable;
+};
diff --git a/fidl/fuchsia.ui.gfx/display_info.fidl b/fidl/fuchsia.ui.gfx/display_info.fidl
new file mode 100644
index 0000000..1fb1cc2
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/display_info.fidl
@@ -0,0 +1,12 @@
+// 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.ui.gfx;
+
+// Provides information about a display.
+struct DisplayInfo {
+  // The size of the display, in physical pixels.
+  uint32 width_in_px;
+  uint32 height_in_px;
+};
diff --git a/fidl/fuchsia.ui.gfx/events.fidl b/fidl/fuchsia.ui.gfx/events.fidl
new file mode 100644
index 0000000..98a2495
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/events.fidl
@@ -0,0 +1,127 @@
+// 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.ui.gfx;
+
+// Reports metrics information.
+// This event type is only reported for node resources.
+const uint32 kMetricsEventMask = 1;
+const uint32 kSizeChangeHintEventMask = 2;
+
+// These are all of the types of events which can be reported by a |Session|.
+// Use |SetEventMaskCmd| to enable event delivery for a resource.
+union Event {
+  // Events which are controlled by a mask.
+  MetricsEvent metrics;
+
+  SizeChangeHintEvent size_change_hint;
+
+  // Events which are always delivered, regardless of mask.
+  ImportUnboundEvent import_unbound;
+  ViewConnectedEvent view_connected;
+  ViewDisconnectedEvent view_disconnected;
+  ViewHolderDisconnectedEvent view_holder_disconnected;
+  ViewAttachedToSceneEvent view_attached_to_scene;
+  ViewDetachedFromSceneEvent view_detached_from_scene;
+  ViewPropertiesChangedEvent view_properties_changed;
+  ViewStateChangedEvent view_state_changed;
+};
+
+// Provides rendering target metrics information about the specified node.
+//
+// This event is delivered when the following conditions are true:
+// - The node is a descendant of a |Scene|.
+// - The node has |kMetricsEventMask| set to an enabled state.
+// - The node's metrics have changed since they were last delivered, or since
+//   |kMetricsEventMask| transitioned from a disabled state to an enabled state.
+//
+// Subscribe to this event to receive information about the scale factors you
+// should apply when generating textures for your nodes.
+struct MetricsEvent {
+  uint32 node_id;
+  Metrics metrics;
+};
+
+// Delivered in response to a size change hint from a parent node
+// (SendSizeChangeHintCmd).
+//
+// This event is delivered when the following conditions are true:
+// - The node has |kSizeChangeEventMask| set to an enabled state.
+// - A parent node has sent a SendSizeChangeHintCmd.
+//
+// Subscribe to this event to receive information about how large textures you
+// will need in the near future for your nodes. The canonical use case is to
+// pre-allocate memory to avoid repeated re-allocations.
+struct SizeChangeHintEvent {
+  uint32 node_id;
+  float32 width_change_factor;
+  float32 height_change_factor;
+};
+
+// Delivered when the imported resource with the given ID is no longer bound to
+// its host resource, or if the imported resource can not be bound because
+// the host resource is not available.
+struct ImportUnboundEvent {
+  uint32 resource_id;
+};
+
+// Delivered to a ViewHolder's Session when its peer View is connected.
+struct ViewConnectedEvent {
+  uint32 view_holder_id;
+};
+
+// Delivered to a ViewHolder's Session when its peer View is disconnected or
+// destroyed.
+//
+// If the View is destroyed before the connection is established, then this
+// event will be delivered immediately when the ViewHolder attempts to connect.
+struct ViewDisconnectedEvent {
+  uint32 view_holder_id;
+};
+
+// Delivered to a View's Session when its peer ViewHolder is disconnected or
+// destroyed.
+//
+// If the ViewHolder is destroyed before the connection is established, then
+// this event will be delivered immediately when the View attempts to connect.
+struct ViewHolderDisconnectedEvent {
+  uint32 view_id;
+};
+
+// Delivered to a View's Session when the parent ViewHolder for the given View
+// becomes a part of a Scene.
+//
+// A ViewHolder is considered to be part of a Scene if there is an unbroken
+// chain of parent-child relationships between the Scene node and the
+// ViewHolder node.
+struct ViewAttachedToSceneEvent {
+  uint32 view_id;
+  ViewProperties properties;
+};
+
+// Delivered to a View's Session when the parent ViewHolder for the given View
+// is no longer part of a scene.
+//
+// This can happen if the ViewHolder is detached directly from the scene, or
+// if one of its parent nodes is.
+//
+// A ViewHolder is considered to be part of a Scene if there is an unbroken
+// chain of parent-child relationships between the Scene node and the
+// ViewHolder node.
+struct ViewDetachedFromSceneEvent {
+  uint32 view_id;
+};
+
+// Delivered when the parent ViewHolder for the given View makes a change to
+// the View's properties.
+struct ViewPropertiesChangedEvent {
+  uint32 view_id;
+  ViewProperties properties;
+};
+
+// Delivered to a ViewHolder's Session when its peer View's state has changed.
+struct ViewStateChangedEvent {
+  uint32 view_holder_id;
+  ViewState state;
+};
diff --git a/fidl/fuchsia.ui.gfx/hit.fidl b/fidl/fuchsia.ui.gfx/hit.fidl
new file mode 100644
index 0000000..d96a44c
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/hit.fidl
@@ -0,0 +1,36 @@
+// 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.ui.gfx;
+
+// Describes where a hit occurred within the content of a node tagged
+// by this session.
+//
+// To compute the point of intersection within the node's local coordinate
+// system, perform the following calculation using the ray which was
+// originally passed to |Session.HitTest()|.
+//
+//   hit_point = ray.origin + (hit.distance * ray.direction)
+//   local_point = hit.inverse_transform * hit_point
+struct Hit {
+  // The node's tag value.
+  uint32 tag_value;
+
+  // The origin of the ray that was used for the hit test, in the hit
+  // node's coordinate system.
+  vec4 ray_origin;
+
+  // The direction of the ray that was used for the hit test, in the hit
+  // node's coordinate system.
+  vec4 ray_direction;
+
+  // The inverse transformation matrix which maps the coordinate system of
+  // the node at which the hit test was initiated into the local coordinate
+  // system of the node which was hit.
+  mat4 inverse_transform;
+
+  // The distance from the ray's origin to the closest point of intersection
+  // in multiples of the ray's direction vector.
+  float32 distance;
+};
diff --git a/fidl/fuchsia.ui.gfx/meta.json b/fidl/fuchsia.ui.gfx/meta.json
new file mode 100644
index 0000000..cc5b23e
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/meta.json
@@ -0,0 +1,34 @@
+{
+  "deps": [
+    "fuchsia.images", 
+    "fuchsia.math", 
+    "fuchsia.mem"
+  ], 
+  "files": [
+    "fidl/fuchsia.ui.gfx/commands.fidl", 
+    "fidl/fuchsia.ui.gfx/display_info.fidl", 
+    "fidl/fuchsia.ui.gfx/events.fidl", 
+    "fidl/fuchsia.ui.gfx/hit.fidl", 
+    "fidl/fuchsia.ui.gfx/nodes.fidl", 
+    "fidl/fuchsia.ui.gfx/pose_buffer_provider.fidl", 
+    "fidl/fuchsia.ui.gfx/renderer.fidl", 
+    "fidl/fuchsia.ui.gfx/resources.fidl", 
+    "fidl/fuchsia.ui.gfx/shapes.fidl", 
+    "fidl/fuchsia.ui.gfx/types.fidl"
+  ], 
+  "name": "fuchsia.ui.gfx", 
+  "root": "fidl/fuchsia.ui.gfx", 
+  "sources": [
+    "fidl/fuchsia.ui.gfx/commands.fidl", 
+    "fidl/fuchsia.ui.gfx/display_info.fidl", 
+    "fidl/fuchsia.ui.gfx/events.fidl", 
+    "fidl/fuchsia.ui.gfx/hit.fidl", 
+    "fidl/fuchsia.ui.gfx/nodes.fidl", 
+    "fidl/fuchsia.ui.gfx/pose_buffer_provider.fidl", 
+    "fidl/fuchsia.ui.gfx/renderer.fidl", 
+    "fidl/fuchsia.ui.gfx/resources.fidl", 
+    "fidl/fuchsia.ui.gfx/shapes.fidl", 
+    "fidl/fuchsia.ui.gfx/types.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.gfx/nodes.fidl b/fidl/fuchsia.ui.gfx/nodes.fidl
new file mode 100644
index 0000000..33e46c7
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/nodes.fidl
@@ -0,0 +1,65 @@
+// 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.ui.gfx;
+
+// These are the types of nodes that can be created within a Mozart |Session|.
+//
+// All nodes have an associated transform, which distinguishes them from mere
+// resources.  Nodes may also have one or more node Characteristics:
+//
+// These are characteristics that each type of |Node| either has or doesn't.
+// These constrain operations that reference nodes; violations will cause the
+// |Session| connection to be closed.  For example, |NodeAddChildOp| must target
+// a node with the "has_children" characteristic.  These characteristics are not
+// explicitly reflected in the Session API; instead, they must be enforced by
+// implementations of the API.
+// - has_children: The node can contain other nodes as children.
+// - has_parent: The node can be a child of another node.  If this is false,
+//   the node can only be a direct descendant of its containing scene.
+// - has_parts:  The node can contain other nodes as parts.  All parts must be
+//   from the same session as their parent.
+// - has_clip:  The node can contain a clip node as a child.
+// - is_clip:  The node can clip other nodes.
+// - has_shape: The node can contain ShapeNodes as children.
+// - has_material:  The node can have a Material resource applied to it.
+
+// Characteristics:
+// - has_parent
+// - has_shape
+// - has_material
+struct ShapeNodeArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 unused = 0;
+};
+
+// Characteristics:
+// - has_parent
+// - is_clip
+// - has_parts
+struct ClipNodeArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 unused = 0;
+};
+
+// Characteristics:
+// - has_transform
+// - has_parent
+// - has_children
+// - has_parts
+// - has_opacity
+struct OpacityNodeArgs {
+    uint32 unused = 0;
+};
+
+// Characteristics:
+// - has_transform
+// - has_children
+// - has_parent
+// - has_parts
+// - has_clip
+struct EntityNodeArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 unused = 0;
+};
diff --git a/fidl/fuchsia.ui.gfx/pose_buffer_provider.fidl b/fidl/fuchsia.ui.gfx/pose_buffer_provider.fidl
new file mode 100644
index 0000000..8fcadc1
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/pose_buffer_provider.fidl
@@ -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.
+
+library fuchsia.ui.gfx;
+
+[Discoverable]
+// A minimal fidl interface to allow sourcing the contents of a PoseBuffer from another service.
+interface PoseBufferProvider {
+  // Sets the PoseBuffer and the parameters PoseBufferProvider will use to fill that PoseBuffer.
+  // Setting this when it is already set will replace the previously set parameters with the new
+  // parameters, which will release the provider's reference to the buffer.
+  1: SetPoseBuffer(handle<vmo> buffer, uint32 num_entries, int64 base_time, uint64 time_interval);
+};
diff --git a/fidl/fuchsia.ui.gfx/renderer.fidl b/fidl/fuchsia.ui.gfx/renderer.fidl
new file mode 100644
index 0000000..6bcbd22
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/renderer.fidl
@@ -0,0 +1,33 @@
+// 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.ui.gfx;
+
+// These are all of the types of parameters that can be set to configure a
+// |Renderer|.
+union RendererParam {
+  ShadowTechnique shadow_technique;
+  RenderFrequency render_frequency;
+};
+
+// Represents the shadow algorithm that the |Renderer| should use when lighting
+// the scene.
+enum ShadowTechnique {
+  // No shadows.
+  UNSHADOWED = 0;
+  // Default.  Screen-space, depth-buffer based shadows; SSDO-ish.
+  SCREEN_SPACE = 1;
+  // Basic shadow map.
+  SHADOW_MAP = 2;
+  // Moment shadow map (see http://momentsingraphics.de).
+  MOMENT_SHADOW_MAP = 3;
+};
+
+enum RenderFrequency {
+  // Render only on when requested (i.e. when something triggers it).
+  // Default behavior.
+  WHEN_REQUESTED = 0;
+  // Render one frame after another regardless of it it's needed.
+  CONTINUOUSLY = 1;
+};
diff --git a/fidl/fuchsia.ui.gfx/resources.fidl b/fidl/fuchsia.ui.gfx/resources.fidl
new file mode 100644
index 0000000..095eb69
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/resources.fidl
@@ -0,0 +1,260 @@
+// 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.ui.gfx;
+
+using fuchsia.images;
+
+// These are all of the types of resources that can be created within a
+// |Session|.
+union ResourceArgs {
+  // Memory resources.
+  MemoryArgs memory;
+  ImageArgs image;
+  ImagePipeArgs image_pipe;
+  BufferArgs buffer;
+
+  // Views.
+  ViewArgs view;
+  ViewHolderArgs view_holder;
+
+  // Shapes (see shapes.fidl).
+  RectangleArgs rectangle;
+  RoundedRectangleArgs rounded_rectangle;
+  CircleArgs circle;
+  MeshArgs mesh;
+
+  // Nodes (see nodes.fidl).
+  ShapeNodeArgs shape_node;
+  ClipNodeArgs clip_node;
+  EntityNodeArgs entity_node;
+  OpacityNodeArgs opacity_node;
+
+  // Materials.
+  MaterialArgs material;
+
+  // Layers.
+  CompositorArgs compositor;
+  DisplayCompositorArgs display_compositor;
+  ImagePipeCompositorArgs image_pipe_compositor;
+  LayerStackArgs layer_stack;
+  LayerArgs layer;
+
+  // Scene representation and display.
+  SceneArgs scene;
+  CameraArgs camera;
+  StereoCameraArgs stereo_camera;
+  RendererArgs renderer;
+
+  // Lighting.
+  AmbientLightArgs ambient_light;
+  DirectionalLightArgs directional_light;
+
+  // A value that can be used in place of a constant value.
+  VariableArgs variable;
+};
+
+struct ImagePipeArgs {
+  request<fuchsia.images.ImagePipe> image_pipe_request;
+};
+
+// |Memory| is a |Resource| that wraps a client-provided Zircon vmo to register
+// it with Scenic.
+// TODO: specify resizing behavior.  Who can resize?  Client/Scenic/both/none?
+struct MemoryArgs {
+  // The VMO which backs this memory.
+  handle<vmo> vmo;
+
+  // The amount of memory from |vmo| that should be utilized.
+  uint64 allocation_size;
+
+  // The type of memory stored in the VMO, namely whether it's GPU memory or
+  // host memory.
+  fuchsia.images.MemoryType memory_type;
+};
+
+// An image mapped to a range of a |Memory| resource.
+// TODO: more precise and extensive docs.
+struct ImageArgs {
+  fuchsia.images.ImageInfo info;
+
+  uint32 memory_id;      // id of a |Memory| resource
+  uint32 memory_offset;  // byte offset of image within |Memory| resource
+};
+
+// A buffer mapped to a range of |Memory|.
+struct BufferArgs {
+  uint32 memory_id;      // id of a |Memory| resource
+  uint32 memory_offset;  // byte offset of buffer within |Memory| resource
+  uint32 num_bytes;
+};
+
+// Represents a transform space which serves as a container for Nodes.  The
+// Nodes will have the Views' coordinate transform applied to their own, in
+// addition to being clipped to the Views' bounding box.
+// See |ViewProperties|.
+//
+// Each View is linked to a paired ViewHolder via a shared token.
+//
+// Usually the View and its associated ViewHolder exist in separate processes,
+// allowing a distributed scene graph to be constructed.
+struct ViewArgs {
+  handle<eventpair> token;
+  string? debug_name;
+};
+
+// Represents a proxy for a View which can be added to a scene graph in order
+// to embed the View within it.
+//
+// Each ViewHolder is linked to a paired View via a shared token.
+//
+// Usually the ViewHolder and its associated View exist in separate processes,
+// allowing a distributed scene graph to be constructed.
+struct ViewHolderArgs {
+  handle<eventpair> token;
+  string? debug_name;
+};
+
+// A Compositor draws its |LayerStack| into a framebuffer provided by its
+// attached |Display|, if any.  If no display is attached, nothing is rendered.
+// TODO(SCN-452): there is currently no way to create/attach a display.
+struct CompositorArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// A DisplayCompositor draws its attached |LayerStack| into an image that is
+// presented on a display.
+struct DisplayCompositorArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// An ImagePipeCompositor draws its attached |LayerStack| into an image that is
+// presented on an image-pipe.
+struct ImagePipeCompositorArgs {
+  fuchsia.images.ImagePipe target;
+};
+
+// A LayerStack is a stack of layers that are attached to a Compositor, which
+// draws them in order of increasing Z-order (or rather, presents the illusion
+// of drawing them in that order: it may apply any optimizations that don't
+// affect the output).
+//
+// Supported commands:
+// - AddLayer
+struct LayerStackArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// Supported commands:
+// - Detach
+// - SetCamera
+// - SetColor
+// - SetTexture
+// - SetSize (depth must be zero)
+// - SetSize
+// - SetTranslation (z component determines the relative Z-ordering of layers)
+// - SetRotation (must rotate around Z-axis)
+// - SetScale
+//
+// A layer is not drawn unless it has a camera, texture, or color.
+struct LayerArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// A Scene is the root of a scene-graph, and defines the rendering environment
+// (lighting, etc.) for the tree of nodes beneath it.  The following commands
+// may be  applied to a Scene (public/fidl/fuchsia.ui.gfx/commands.fidl):
+//   - Add/RemoveLight
+//   - AddChild
+struct SceneArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// A Camera is used to render a Scene from a particular viewpoint.  This is
+// achieved by setting a Renderer to use the camera.  The following operations
+// may be applied to a Camera (see ops.fidl):
+//   - SetCameraTransform
+//   - SetCameraProjection
+//   - SetCameraPoseBuffer
+struct CameraArgs {
+  // The scene that the camera is viewing.
+  uint32 scene_id;
+};
+
+// A StereoCamera is a Camera that renders the scene in side-by-side stereo.
+// The following operations may be applied to a StereoCamera but not a Camera:
+//   - SetStereoCameraProjection
+// Additionally, any operation which can be applied to a Camera can also be
+// applied to a StereoCamera.
+struct StereoCameraArgs {
+  // The scene that the camera is viewing.
+  uint32 scene_id;
+};
+
+// A Renderer renders a Scene via a Camera.  The following operations may be
+// applied to a Renderer (see ops.fidl):
+//   - SetCamera
+//   - SetRendererParam
+struct RendererArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// An AmbientLight is a Light that is is assumed to be everywhere in the scene,
+// in all directions.
+//
+// The following commands may be applied to an AmbientLight
+// (public/fidl/fuchsia.ui.gfx/commands.fidl):
+//   - SetLightColor
+struct AmbientLightArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// A DirectionalLight is a Light that is emitted from a point at infinity.
+//
+// Although the light is directional, the light has some amount of angular
+// dispersion (i.e., the light is not fully columnated). For simplicity, we
+// assume the dispersion of the light source is symmetric about the light's
+// primary direction.
+//
+// The following commands may be applied to a DirectionalLight
+// (public/fidl/fuchsia.ui.gfx/commands.fidl):
+//   - SetLightColor
+//   - SetDirection
+struct DirectionalLightArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+// Simple texture-mapped material.
+//
+// Commands that can be performed later:
+// SetTextureCmd will set the texture, or it can be left as zero (no
+// texture).
+//   The texture can be an Image or ImagePipe.
+// SetColorCmd will set the color.
+struct MaterialArgs {
+  // TODO(SCN-694): Clean up dummy args.
+  uint32 dummy = 0;
+};
+
+struct VariableArgs {
+  ValueType type;
+  Value initial_value;  // Must match type.  Must not be a variable_id.
+};
+
+// Describes an exported resource that is to be imported by an
+// ImportResourceCmd.
+//
+// NOTE: Currently just an enum of importable resource types, but may later be
+// expanded to express concepts like "meshes with a particular vertex format".
+enum ImportSpec {
+  NODE = 0;
+};
diff --git a/fidl/fuchsia.ui.gfx/shapes.fidl b/fidl/fuchsia.ui.gfx/shapes.fidl
new file mode 100644
index 0000000..5734af1
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/shapes.fidl
@@ -0,0 +1,40 @@
+// 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.ui.gfx;
+
+// The shapes defined in this file can be used to define the rendered shape of
+// an |ObjectNode|, and to define the clip region of a |ClipNode|.
+
+// Rectangle centered at (0,0).
+struct RectangleArgs {
+  Value width;  // float32
+  Value height; // float32
+};
+
+// RoundedRectangle centered at (0,0).  Legal parameter values must satisfy the
+// constraint that the flat sides of the rectangle have non-negative length.
+// In other words, the following constraints must hold:
+//   - top_left_radius + top_right_radius <= width
+//   - bottom_left_radius + bottom_right_radius <= width
+//   - top_left_radius + bottom_left_radius <= height
+//   - top_right_radius + bottom_right_radius <= height
+struct RoundedRectangleArgs {
+  Value width;                // float32
+  Value height;               // float32
+  Value top_left_radius;      // float32
+  Value top_right_radius;     // float32
+  Value bottom_right_radius;  // float32
+  Value bottom_left_radius;   // float32
+};
+
+struct CircleArgs {
+  Value radius;  // float32
+};
+
+// A Mesh cannot be rendered until it has been bound to vertex/index buffers;
+// see BindMeshBuffersCmd.
+struct MeshArgs {
+    uint8 dummy;
+};
diff --git a/fidl/fuchsia.ui.gfx/types.fidl b/fidl/fuchsia.ui.gfx/types.fidl
new file mode 100644
index 0000000..d470e5b
--- /dev/null
+++ b/fidl/fuchsia.ui.gfx/types.fidl
@@ -0,0 +1,236 @@
+// 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.ui.gfx;
+
+struct vec2 {
+  float32 x;
+  float32 y;
+};
+
+struct vec3 {
+  float32 x;
+  float32 y;
+  float32 z;
+};
+
+struct vec4 {
+  float32 x;
+  float32 y;
+  float32 z;
+  float32 w;
+};
+
+struct mat4 {
+  // Column major order.
+  array<float32>:16 matrix;
+};
+
+// TODO(MZ-238): use float32s instead of uint8.
+struct ColorRgba {
+  uint8 red;
+  uint8 green;
+  uint8 blue;
+  uint8 alpha;
+};
+
+struct ColorRgb {
+  float32 red;
+  float32 green;
+  float32 blue;
+};
+
+struct Quaternion {
+  float32 x;
+  float32 y;
+  float32 z;
+  float32 w;
+};
+
+struct FactoredTransform {
+  vec3 translation;
+  vec3 scale;
+  // Point around which rotation and scaling occur.
+  vec3 anchor;
+  Quaternion rotation;
+};
+
+union Value {
+  float32 vector1;
+  vec2 vector2;
+  vec3 vector3;
+  vec4 vector4;
+  mat4 matrix4x4;
+  ColorRgba color_rgba;
+  ColorRgb color_rgb;
+  // Degrees of counter-clockwise rotation in the XY plane.
+  float32 degrees;
+  Quaternion quaternion;
+  FactoredTransform transform;
+  // ID of a value-producing resource (an animation or an expression).
+  // The type of this value matches the type produced by the named resource.
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a float32, and |value| is ignored.
+struct FloatValue {
+  float32 value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a vec2, and |value| is ignored.
+struct Vector2Value {
+  vec2 value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a vec3, and |value| is ignored.
+struct Vector3Value {
+  vec3 value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a vec4, and |value| is ignored.
+struct Vector4Value {
+  vec4 value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a vec4, and |value| is ignored.
+struct Matrix4Value {
+  mat4 value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a ColorRgb, and |value| is ignored.
+struct ColorRgbValue {
+  ColorRgb value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a ColorRgba, and |value| is ignored.
+struct ColorRgbaValue {
+  ColorRgba value;
+  uint32 variable_id;
+};
+
+// A value that is specified explicitly by |value| if |variable_id| is zero,
+// or is the value produced by the resource identified by |variable_id|, e.g.
+// an animation or expression.  In the latter case, the value produced by the
+// resource must be a Quaternion, and |value| is ignored.
+struct QuaternionValue {
+  Quaternion value;
+  uint32 variable_id;
+};
+
+enum ValueType {
+  kNone = 0;
+  kVector1 = 1;
+  kVector2 = 2;
+  kVector3 = 3;
+  kVector4 = 4;
+  kMatrix4 = 5;
+  kColorRgb = 6;
+  kColorRgba = 7;
+  kQuaternion = 8;
+  kFactoredTransform = 9;
+};
+
+// Describes how nodes interact with hit testings.
+enum HitTestBehavior {
+  // Apply hit testing to the node's content, its parts, and its children.
+  kDefault = 0;
+
+  // Suppress hit testing of the node and everything it contains.
+  kSuppress = 1;
+};
+
+// Rendering target metrics associated with a node.
+// See also |MetricsEvent|.
+struct Metrics {
+  // The ratio between the size of one logical pixel within the node's local
+  // coordinate system and the size of one physical pixel of the rendering
+  // target.
+  //
+  // This scale factors change in relation to the resolution of the rendering
+  // target and the scale transformations applied by containing nodes.
+  // They are always strictly positive and non-zero.
+  //
+  // For example, suppose the rendering target is a high resolution display
+  // with a device pixel ratio of 2.0 meaning that each logical pixel
+  // within the model corresponds to two physical pixels of the display.
+  // Assuming no scale transformations affect the node, then its metrics event
+  // will report a scale factor of 2.0.
+  //
+  // Building on this example, if instead the node's parent applies a
+  // scale transformation of 0.25 to the node, then the node's metrics event
+  // will report a scale factor of 0.5 indicating that the node should render
+  // its content at a reduced resolution and level of detail since a smaller
+  // area of physical pixels (half the size in each dimension) will be rendered.
+  float32 scale_x;
+  float32 scale_y;
+  float32 scale_z;
+};
+
+// Represents an axis-aligned bounding box.  If any of the dimensions has a
+// negative extent (e.g. max.x < min.x) then the bounding box is treated as
+// empty.
+struct BoundingBox {
+  vec3 min;
+  vec3 max;
+};
+
+// Represents the properties for a View.
+struct ViewProperties {
+  // The View's bounding box extents can be defined as:
+  //    { bounding_box.min - inset_from_min, bounding_box.max + inset_from_max }
+  // Content contained within the View is clipped to this bounding box.
+  //
+  // TODO(SCN-819): should we just have a vec3 extent instead of a bounding box
+  // with a potentially non-zero min?
+  BoundingBox bounding_box;
+
+  // |insets_from_min| and |insets_from_max| specify the distances between the
+  // view's bounding box and that of its parent.
+  vec3 inset_from_min;
+  vec3 inset_from_max;
+
+  // Whether the View can receive a focus event; default is true.  When
+  // false, and this View is eligible to receive a focus event, no
+  // focus/unfocus event is actually sent to any View.
+  bool focus_change = true;
+
+  // Whether the View allows geometrically underlying Views to receive input;
+  // default is true. When false, Scenic does not send input events to
+  // underlying Views.
+  bool downward_input = true;
+};
+
+// Represents the state of a View in Scenic.
+struct ViewState {
+  // Whether the View is rendering. Default is false. Delivered to the View's
+  // corresponding ViewHolder after the View's first frame render request.
+  bool is_rendering;
+};
diff --git a/fidl/fuchsia.ui.input/commands.fidl b/fidl/fuchsia.ui.input/commands.fidl
new file mode 100644
index 0000000..098ccb0
--- /dev/null
+++ b/fidl/fuchsia.ui.input/commands.fidl
@@ -0,0 +1,48 @@
+// 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.ui.input;
+
+union Command {
+  // Commands for conveying input events to a |Session|.
+  // Structs defined in input_events.fidl.
+  SendKeyboardInputCmd send_keyboard_input;
+  SendPointerInputCmd send_pointer_input;
+
+  // Command to enable/disable delivery of hard keyboard events.
+  SetHardKeyboardDeliveryCmd set_hard_keyboard_delivery;
+
+  // Command to enable/disable parallel delivery of input events.
+  SetParallelDispatchCmd set_parallel_dispatch;
+};
+
+struct SendKeyboardInputCmd {
+  uint32 compositor_id;
+  KeyboardEvent keyboard_event;  // Defined in input_events.fidl
+};
+
+struct SendPointerInputCmd {
+  uint32 compositor_id;
+  PointerEvent pointer_event;  // Defined in input_events.fidl
+};
+
+// Typically, clients should receive text inputs from an IME.
+//
+// For cases where no IME mediation is desired (such as a game application),
+// this command requests Scenic to deliver hard keyboard events to the client.
+//
+// By default, Scenic will *not* deliver hard keyboard events to a client.
+struct SetHardKeyboardDeliveryCmd {
+  bool delivery_request;
+};
+
+// Typically, clients that participate in the hit test should receive input
+// events in parallel. This behavior is required for gesture disambiguation.
+//
+// This command, typically set by the root presenter, allows disabling parallel
+// dispatch; it is part of the input v2 transition work.
+// TODO(SCN-1047): Remove after gesture disambiguation is implemented.
+struct SetParallelDispatchCmd {
+  bool parallel_dispatch;
+};
diff --git a/fidl/fuchsia.ui.input/ime_service.fidl b/fidl/fuchsia.ui.input/ime_service.fidl
new file mode 100644
index 0000000..3ee5b58
--- /dev/null
+++ b/fidl/fuchsia.ui.input/ime_service.fidl
@@ -0,0 +1,25 @@
+// 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.ui.input;
+
+// The service provided by an IME
+[Discoverable]
+interface ImeService {
+  1: GetInputMethodEditor(KeyboardType keyboard_type,
+                         InputMethodAction action,
+                         TextInputState initial_state,
+                         InputMethodEditorClient client,
+                         request<InputMethodEditor> editor);
+  2: ShowKeyboard();
+  3: HideKeyboard();
+  4: InjectInput(InputEvent event);
+};
+
+// Onscreen keyboard containers connect to this to know when a keyboard
+// should be shown or hidden.
+[Discoverable]
+interface ImeVisibilityService {
+  1: -> OnKeyboardVisibilityChanged(bool visible);
+};
diff --git a/fidl/fuchsia.ui.input/input_connection.fidl b/fidl/fuchsia.ui.input/input_connection.fidl
new file mode 100644
index 0000000..497fff1
--- /dev/null
+++ b/fidl/fuchsia.ui.input/input_connection.fidl
@@ -0,0 +1,44 @@
+// Copyright 2015 The Fuchsia 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.ui.input;
+
+// TODO(jeffbrown): Redesign input event representation later.
+
+// The input connection service allows a view to receive input events
+// such as key presses and pointer movements.
+
+// This service can be retrieved from the |View| service provider.
+//
+// TODO(jeffbrown): Elaborate this.  Particularly need to think about
+// how to handle focus and gestures.
+[Discoverable]
+interface InputConnection {
+  // Sets the listener for receiving input events.
+  //
+  // If |listener| is null, then the previously set listener is removed.
+  1: SetEventListener(InputListener? listener);
+
+  // Retrieves an |InputMethodEditor| to handle text editing.
+  2: GetInputMethodEditor(KeyboardType keyboard_type,
+                         InputMethodAction action,
+                         TextInputState initial_state,
+                         InputMethodEditorClient client,
+                         request<InputMethodEditor> editor);
+  3: ShowKeyboard();
+  4: HideKeyboard();
+};
+
+// An interface applications may implement to receive events from an
+// input connection.
+// TODO(MZ-33): This should include hit testing and an input arena.
+[Discoverable]
+interface InputListener {
+  // Called to deliver an input event.
+  //
+  // The |consumed| result should indicate whether the input event was
+  // consumed by the connection.  If |consumed| is false, the system may
+  // apply default behavior of its own in response to the event.
+  1: OnEvent(InputEvent event) -> (bool consumed);
+};
diff --git a/fidl/fuchsia.ui.input/input_device_registry.fidl b/fidl/fuchsia.ui.input/input_device_registry.fidl
new file mode 100644
index 0000000..84fca87
--- /dev/null
+++ b/fidl/fuchsia.ui.input/input_device_registry.fidl
@@ -0,0 +1,20 @@
+// 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.ui.input;
+
+// Service to receive input events.
+//
+// Input devices can describe their capabilities using |DeviceDescriptor|
+// and register themselves with the |InputDeviceRegistry|.
+[Discoverable]
+interface InputDeviceRegistry {
+    // Register a device with the capabilities described by |DeviceDescriptor|
+    1: RegisterDevice(DeviceDescriptor descriptor, request<InputDevice> input_device);
+};
+
+interface InputDevice {
+    // Dispatch an |InputReport| from the device |token|
+    1: DispatchReport(InputReport report);
+};
diff --git a/fidl/fuchsia.ui.input/input_dispatcher.fidl b/fidl/fuchsia.ui.input/input_dispatcher.fidl
new file mode 100644
index 0000000..744bf1b
--- /dev/null
+++ b/fidl/fuchsia.ui.input/input_dispatcher.fidl
@@ -0,0 +1,38 @@
+// Copyright 2015 The Fuchsia 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.ui.input;
+
+// TODO(jeffbrown): Redesign input event representation later.
+
+// The input dispatcher service allows the component which owns and controls
+// a view tree to dispatch input events to the views that it contains.
+//
+// This service can be retrieved from the |ViewTree| service provider.
+//
+// TODO(jeffbrown): Elaborate how input devices are registered with the
+// dispatcher so that applications can query their capabilities and distinguish
+// input coming from multiple sources concurrently.
+[Discoverable]
+interface InputDispatcher {
+  // Dispatches an event through the view tree.  The dispatcher will deliver
+  // the event to the appropriate views based on the current state of the
+  // tree, such as focus and the structure of the scene graph.
+  //
+  // The dispatcher expects the stream of events that it receives to be
+  // internally consistent.  For example, each pointer down must be matched
+  // by a corresponding pointer up.
+  //
+  // It is an error to supply an inconsistent stream events to the dispatcher;
+  // the connection will be closed.
+  //
+  // TODO(jeffbrown): Is this the right policy?  It would certainly help
+  // diagnose faults earlier.
+  // TODO(jeffbrown): Decide whether there should be a way to track the
+  // progress of input events.  For testing purposes it is often desirable
+  // to block the test until a sequence of events have been delivered and
+  // handled.  However these same mechanisms have proven to be brittle in
+  // the past so it might be better to solve the problem some other way.
+  1: DispatchEvent(InputEvent event);
+};
diff --git a/fidl/fuchsia.ui.input/input_event_constants.fidl b/fidl/fuchsia.ui.input/input_event_constants.fidl
new file mode 100644
index 0000000..3131664
--- /dev/null
+++ b/fidl/fuchsia.ui.input/input_event_constants.fidl
@@ -0,0 +1,31 @@
+// Copyright 2014 The Fuchsia 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.ui.input;
+
+// Keyboard modifiers
+const uint32 kModifierCapsLock     = 1;
+const uint32 kModifierLeftShift    = 2;
+const uint32 kModifierRightShift   = 4;
+const uint32 kModifierShift        = 6; // (kModifierLeftShift | kModifierRightShift);
+const uint32 kModifierLeftControl  = 8;
+const uint32 kModifierRightControl = 16;
+const uint32 kModifierControl      = 24; // (kModifierLeftControl | kModifierRightControl);
+const uint32 kModifierLeftAlt      = 32;
+const uint32 kModifierRightAlt     = 64;
+const uint32 kModifierAlt          = 96; // (kModifierLeftAlt | kModifierRightAlt);
+const uint32 kModifierLeftSuper    = 128;
+const uint32 kModifierRightSuper   = 256;
+const uint32 kModifierSuper        = 384; // (kModifierLeftSuper | kModifierRightSuper);
+
+// Mouse buttons
+const uint32 kMousePrimaryButton   = 1;
+const uint32 kMouseSecondaryButton = 2;
+const uint32 kMouseTertiaryButton  = 4;
+
+// Stylus buttons
+const uint32 kStylusPrimaryButton   = 1;
+const uint32 kStylusSecondaryButton = 2;
+
+// end-no-format
diff --git a/fidl/fuchsia.ui.input/input_events.fidl b/fidl/fuchsia.ui.input/input_events.fidl
new file mode 100644
index 0000000..fb3c386
--- /dev/null
+++ b/fidl/fuchsia.ui.input/input_events.fidl
@@ -0,0 +1,158 @@
+// Copyright 2014 The Fuchsia 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.ui.input;
+
+enum KeyboardEventPhase {
+  // When key is pressed down.
+  PRESSED = 0;
+  // When key is released.
+  RELEASED = 1;
+  // This key |PRESSED| is not directed to this input client anymore.
+  CANCELLED = 2;
+  // Whether this is an automatically generated key repeat
+  REPEAT = 3;
+};
+
+// |KeyboardEvent| represents event generated by a user's interaction with a
+// keyboard.
+//
+// Those events are triggered by distinct pressed state changes of the keys.
+//
+// The state transitions should be as follows:
+// PRESSED -> (REPEAT ->) RELEASED
+// or
+// PRESSED -> (REPEAT ->) CANCELLED
+//
+// The input system will repeat those events automatically when a code_point is
+// available.
+struct KeyboardEvent {
+  // Time the event was delivered. The time is in nanoseconds and corresponds
+  // to the uptime of the machine.
+  uint64 event_time;
+
+  uint32 device_id;
+
+  KeyboardEventPhase phase;
+
+  // Keyboard HID Usage
+  // See https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
+  uint32 hid_usage;
+
+  // The unicode code point represented by this key event, if any.
+  // Dead keys are represented as Unicode combining characters.
+  //
+  // If there is no unicode code point, this value is zero.
+  uint32 code_point;
+
+  // Key modifiers as defined by the different kModifier constants such as
+  // |kModifierCapsLock| currently pressed
+  uint32 modifiers;
+};
+
+enum PointerEventType {
+  // A touch-based pointer device.
+  TOUCH = 0;
+
+  // A pointer device with a stylus.
+  STYLUS = 1;
+
+  // A pointer device with a stylus that has been inverted.
+  INVERTED_STYLUS = 2;
+
+  // A pointer device without a stylus.
+  MOUSE = 3;
+};
+
+enum PointerEventPhase {
+  // The device has started tracking the pointer.
+  //
+  // For example, the pointer might be hovering above the device, having not yet
+  // made contact with the surface of the device.
+  ADD = 0;
+
+  // The pointer has moved with respect to the device while not in contact with
+  // the device.
+  HOVER = 1;
+
+  // The pointer has made contact with the device.
+  //
+  // For |MOUSE| devices, this is triggered when the primary button is pressed
+  // down to emulate a touch on the screen.
+  DOWN = 2;
+
+  // The pointer has moved with respect to the device while in contact with the
+  // device.
+  MOVE = 3;
+
+  // The pointer has stopped making contact with the device.
+  //
+  // For |MOUSE| devices, this is triggered when the primary button is
+  // released.
+  UP = 4;
+
+  // The device is no longer tracking the pointer.
+  //
+  // For example, the pointer might have drifted out of the device's hover
+  // detection range or might have been disconnected from the system entirely.
+  REMOVE = 5;
+
+  // The input from the pointer is no longer directed towards this receiver.
+  CANCEL = 6;
+
+  // TODO: add phases to indicate button press / release
+};
+
+// Pointers represent raw data about the user's interaction with the screen.
+//
+// The state transitions should be as follows:
+// ADD (-> HOVER) -> DOWN -> MOVE -> UP (-> HOVER) -> REMOVE
+//
+// At any point after the initial ADD, a transition to CANCEL is also possible.
+struct PointerEvent {
+  // Time the event was delivered. The time is in nanoseconds and corresponds
+  // to the uptime of the machine.
+  uint64 event_time;
+
+  uint32 device_id;
+
+  uint32 pointer_id;
+
+  PointerEventType type;
+
+  PointerEventPhase phase;
+
+  // |x| and |y| are in the coordinate system of the View.
+  float32 x;
+  float32 y;
+
+  // TODO(jpoichet) float32 vx;
+  // TODO(jpoichet) float32 vy;
+
+  float32 radius_major;
+  float32 radius_minor;
+  // TODO(jpoichet) float32 orientation;
+  // TODO(jpoichet) float32 tilt;
+  // TODO(jpoichet) float32 altitude;
+  // TODO(jpichet) float32 amplitude;
+
+  // Currently pressed buttons as defined the kButton constants such as
+  // |kMousePrimaryButton|
+  uint32 buttons;
+};
+
+struct FocusEvent {
+  // Time the event was delivered. The time is in nanoseconds and corresponds
+  // to the uptime of the machine.
+  uint64 event_time;
+
+  // Whether the view has gained input focused or not.
+  bool focused;
+};
+
+union InputEvent {
+  PointerEvent pointer;
+  KeyboardEvent keyboard;
+  FocusEvent focus;
+};
diff --git a/fidl/fuchsia.ui.input/input_reports.fidl b/fidl/fuchsia.ui.input/input_reports.fidl
new file mode 100644
index 0000000..0cff1e2
--- /dev/null
+++ b/fidl/fuchsia.ui.input/input_reports.fidl
@@ -0,0 +1,259 @@
+// 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.ui.input;
+
+// Descriptors are used to describe the capabilities of an input device.
+//
+// Devices can have multiple descriptors of multiple kinds, for example:
+// |KeyboardDescriptor|, |MouseDescriptor|, |StylusDescriptor|,
+// |TouchscreenDescriptor| and |SensorDescriptor|
+//
+// An input device will generate |InputReport| corresponding to the
+// capabilities of that device listed in its descriptor.
+// For instance a input device with a |KeyboardDescriptor| will generate
+// |KeyboardReport| when a key is pressed on the keyboard.
+
+// Describe a |Range| of values
+struct Range {
+  int32 min;
+  int32 max;
+};
+
+struct RangeF {
+  float32 min;
+  float32 max;
+};
+
+enum AxisScale {
+  LINEAR = 0;
+  LOGARITHMIC = 1;
+};
+
+// An |Axis| is defined as a |range| and |resolution|.
+struct Axis {
+  Range range;
+  int32 resolution = 1;
+  AxisScale scale = LINEAR;
+};
+
+struct AxisF {
+  RangeF range;
+  float32 resolution = 1.0;
+  AxisScale scale = LINEAR;
+};
+
+// |ButtonsDescriptor| describes the buttons.
+struct ButtonsDescriptor {
+  // The list of buttons available.
+  uint32 buttons;
+};
+
+// Keyboards
+
+// |KeyboardDescriptor| describes the capabilities of a keyboard.
+struct KeyboardDescriptor {
+  // The list of HID keyboard usages that this keyboard can generate.
+  vector<uint32> keys;
+};
+
+// |KeyboardReport| lists the keys currently pressed down.
+struct KeyboardReport {
+  // |pressed_keys| is the list of HID usage that are currently pressed down on
+  // the keyboard.
+  vector<uint32> pressed_keys;
+};
+
+// Mouse
+
+// |MouseDescriptor| describes the capabilities of a mouse.
+struct MouseDescriptor {
+  // The range of relative X and Y movement which can be described by a mouse
+  // report.
+  Axis rel_x;
+  Axis rel_y;
+
+  // The range of relative vertical and horizontal scroll which can be
+  // described by a mouse report.
+  Axis? vscroll;
+  Axis? hscroll;
+
+  // The list of HID mouse usages that this mouse can generate.
+  uint32 buttons;
+};
+
+// |MouseReport| gives the relative mouvement of the mouse and currently
+// pressed buttons.
+struct MouseReport {
+  // Relative X and Y positional displacement.
+  int32 rel_x;
+  int32 rel_y;
+
+  // Relative horizontal and vertical scrolling displacement.
+  int32 rel_hscroll;
+  int32 rel_vscroll;
+
+  // buttons currently down
+  uint32 pressed_buttons;
+};
+
+// Stylus
+
+// |Stylus| describes the capabilities of a stylus.
+struct StylusDescriptor {
+  // Ranges for the |x| and |y| axis of the stylus.
+  Axis x;
+  Axis y;
+
+  // Range for the pressure of the tip
+  Axis? pressure;
+
+  bool is_invertible = false;
+
+  // The list of HID button usages that this stylus can generate.
+  uint32 buttons;
+};
+
+// |StylusReport| describes the current state of the stylus.
+struct StylusReport {
+  // Current position of the stylus within the range described in
+  // |StylusDescriptor|
+  int32 x;
+  int32 y;
+
+  // Pressure applied on the stylus tip
+  uint32 pressure;
+
+  // Whether the stylus has made contact with the surface.
+  bool is_in_contact;
+
+  // Whether the stylus is within range. If |is_in_contact| is false, then the stylus
+  // is hovering.
+  bool in_range;
+
+  // Whether the stylus is thought to be inverted.
+  bool is_inverted;
+
+  // List of buttons currently pressed down.
+  uint32 pressed_buttons;
+};
+
+// Touchscreen
+
+// |TouchscreenDescriptor| describes the capabilities of a touchscreen.
+struct TouchscreenDescriptor {
+  // Ranges of the |x| and |y| axis.
+  Axis x;
+  Axis y;
+  uint32 max_finger_id;
+};
+
+// |Touch| describes one touch on a touchscreen, which should correspond to
+// one finger.
+struct Touch {
+  // Identifier for a finger that is down.
+  // Note: |finger_id| might not be sequential and will range from 0 to
+  // |max_finger_id|
+  uint32 finger_id;
+
+  // Location within the axis defined in |TouchscreenDescriptor|
+  int32 x;
+  int32 y;
+
+  // Area pressed.
+  uint32 width;
+  uint32 height;
+};
+
+// |TouchscreenReport| describes the current touches recorded by the touchscreen
+// and holds a |Touch| per finger down.
+struct TouchscreenReport {
+  vector<Touch> touches;
+};
+
+// Motion Sensors
+
+// Descriptive categories for sensor devices.
+// We assume that each (SensorType,SensorLocation) pair is unique to the system.
+
+enum SensorType {
+  ACCELEROMETER = 0;
+  GYROSCOPE = 1;
+  MAGNETOMETER = 2;
+  LIGHTMETER = 3;
+};
+
+enum SensorLocation {
+  UNKNOWN = 0;
+  BASE = 1;
+  LID = 2;
+};
+
+// |SensorDescriptor| describes the capabilities of a sensor device.  It does
+// not capture properties that can be changed after initialization, such as the
+// current sampling frequency.
+struct SensorDescriptor {
+  SensorType type;
+  SensorLocation loc;
+
+  // Min and max sampling frequencies for a sensor.
+  uint32 min_sampling_freq;
+  uint32 max_sampling_freq;
+  // Max number of sensor events that could be in hardware FIFO.
+  uint32 fifo_max_event_count;
+
+  // Physical range of a specific sensor.
+  // Accelerometer ranges are given in Gs.
+  // Gyroscope ranges are given in deg/s.
+  // Magnetometer ranges are given in multiples of 1/16 uT.
+  // Light meter ranges can be given in Lux or units not specified.
+  int32 phys_min;
+  int32 phys_max;
+};
+
+// |SensorReport| describes the sensor event delivered from the event stream.
+union SensorReport {
+  array<int16>:3 vector;
+  uint16 scalar;
+};
+
+// |ButtonsReport| describes the buttons event delivered from the event stream.
+union ButtonsReport {
+  // Volume changes +1/-1 for volume up/down, this is a relative value.
+  int8 volume;
+  bool mic_mute;
+};
+
+// Device and Report
+
+struct DeviceInfo {
+  uint32 vendor_id;
+  uint32 product_id;
+  uint32 version;
+  string name;
+};
+
+// |DeviceDescriptor| describes one input device.
+struct DeviceDescriptor {
+  DeviceInfo? device_info;
+  KeyboardDescriptor? keyboard;
+  ButtonsDescriptor? buttons;
+  MouseDescriptor? mouse;
+  StylusDescriptor? stylus;
+  TouchscreenDescriptor? touchscreen;
+  SensorDescriptor? sensor;
+};
+
+// |InputReport| is an input |report| triggered by an input device.
+struct InputReport {
+  // |event_time| is in nanoseconds when the event was recorded.
+  uint64 event_time;
+
+  KeyboardReport? keyboard;
+  ButtonsReport? buttons;
+  MouseReport? mouse;
+  StylusReport? stylus;
+  TouchscreenReport? touchscreen;
+  SensorReport? sensor;
+};
diff --git a/fidl/fuchsia.ui.input/meta.json b/fidl/fuchsia.ui.input/meta.json
new file mode 100644
index 0000000..7054d90
--- /dev/null
+++ b/fidl/fuchsia.ui.input/meta.json
@@ -0,0 +1,32 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.ui.input/commands.fidl", 
+    "fidl/fuchsia.ui.input/ime_service.fidl", 
+    "fidl/fuchsia.ui.input/input_connection.fidl", 
+    "fidl/fuchsia.ui.input/input_device_registry.fidl", 
+    "fidl/fuchsia.ui.input/input_dispatcher.fidl", 
+    "fidl/fuchsia.ui.input/input_event_constants.fidl", 
+    "fidl/fuchsia.ui.input/input_events.fidl", 
+    "fidl/fuchsia.ui.input/input_reports.fidl", 
+    "fidl/fuchsia.ui.input/text_editing.fidl", 
+    "fidl/fuchsia.ui.input/text_input.fidl", 
+    "fidl/fuchsia.ui.input/usages.fidl"
+  ], 
+  "name": "fuchsia.ui.input", 
+  "root": "fidl/fuchsia.ui.input", 
+  "sources": [
+    "fidl/fuchsia.ui.input/commands.fidl", 
+    "fidl/fuchsia.ui.input/ime_service.fidl", 
+    "fidl/fuchsia.ui.input/input_connection.fidl", 
+    "fidl/fuchsia.ui.input/input_device_registry.fidl", 
+    "fidl/fuchsia.ui.input/input_dispatcher.fidl", 
+    "fidl/fuchsia.ui.input/input_event_constants.fidl", 
+    "fidl/fuchsia.ui.input/input_events.fidl", 
+    "fidl/fuchsia.ui.input/input_reports.fidl", 
+    "fidl/fuchsia.ui.input/text_editing.fidl", 
+    "fidl/fuchsia.ui.input/text_input.fidl", 
+    "fidl/fuchsia.ui.input/usages.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.input/text_editing.fidl b/fidl/fuchsia.ui.input/text_editing.fidl
new file mode 100644
index 0000000..73759a1
--- /dev/null
+++ b/fidl/fuchsia.ui.input/text_editing.fidl
@@ -0,0 +1,64 @@
+// 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.ui.input;
+
+// Whether a TextPosition is visually upstream or downstream of its offset.
+//
+// For example, when a text position exists at a line break, a single offset has
+// two visual positions, one prior to the line break (at the end of the first
+// line) and one after the line break (at the start of the second line). A text
+// affinity disambiguates between those cases. (Something similar happens with
+// between runs of bidirectional text.)
+enum TextAffinity {
+  // The position has affinity for the upstream side of the text position.
+  //
+  // For example, if the offset of the text position is a line break, the
+  // position represents the end of the first line.
+  UPSTREAM = 0;
+
+  // The position has affinity for the downstream side of the text position.
+  //
+  // For example, if the offset of the text position is a line break, the
+  // position represents the start of the second line.
+  DOWNSTREAM = 1;
+};
+
+// A range of characters in a string of text.
+struct TextRange {
+  // The index of the first UTF-16 character in the range.
+  //
+  // If |start| and |end| are both -1, the text range is empty.
+  int64 start = -1;
+
+  // The next index after the UTF-16 characters in this range.
+  //
+  // If |start| and |end| are both -1, the text range is empty.
+  int64 end = -1;
+};
+
+// A range of text that represents a selection.
+//
+// Text selection is always directional. Direction should be determined by
+// comparing base and extent.
+struct TextSelection {
+  // The offset at which the selection originates.
+  //
+  // Might be larger than, smaller than, or equal to extent.
+  int64 base;
+
+  // The offset at which the selection terminates.
+  //
+  // When the user uses the arrow keys to adjust the selection, this is the
+  // value that changes. Similarly, if the current theme paints a caret on one
+  // side of the selection, this is the location at which to paint the caret.
+  //
+  // Might be larger than, smaller than, or equal to base.
+  int64 extent;
+
+  // If the the text range is collapsed and has more than one visual location
+  // (e.g., occurs at a line break), which of the two locations to use when
+  // painting the caret.
+  TextAffinity affinity;
+};
diff --git a/fidl/fuchsia.ui.input/text_input.fidl b/fidl/fuchsia.ui.input/text_input.fidl
new file mode 100644
index 0000000..6d38423
--- /dev/null
+++ b/fidl/fuchsia.ui.input/text_input.fidl
@@ -0,0 +1,56 @@
+// 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.ui.input;
+
+enum KeyboardType {
+  TEXT = 0;
+  NUMBER = 1;
+  PHONE = 2;
+  DATETIME = 3;
+};
+
+enum InputMethodAction {
+  UNSPECIFIED = 0;
+  NONE = 1;
+  GO = 2;
+  SEARCH = 3;
+  SEND = 4;
+  NEXT = 5;
+  DONE = 6;
+  PREVIOUS = 7;
+};
+
+// The current text, selection, and composing state for editing a run of text.
+struct TextInputState {
+  // Current state revision to avoid race conditions.
+  uint32 revision;
+
+  // The current text being edited.
+  string text;
+
+  // The range of text that is currently selected.
+  TextSelection selection;
+
+  // The range of text that is still being composed.
+  TextRange composing;
+};
+
+// A interface for interacting with a text input control.
+interface InputMethodEditor {
+  1: SetKeyboardType(KeyboardType keyboard_type);
+  2: SetState(TextInputState state);
+  3: InjectInput(InputEvent event);
+
+  // TODO(TEXT-19): remove these in a later change, after PlatformView has been
+  // switched over to open/close on the input_connection_ instead.
+  4: Show();
+  5: Hide();
+};
+
+// An interface to receive information from |TextInputService|.
+interface InputMethodEditorClient {
+  1: DidUpdateState(TextInputState state, InputEvent? event);
+  2: OnAction(InputMethodAction action);
+};
diff --git a/fidl/fuchsia.ui.input/usages.fidl b/fidl/fuchsia.ui.input/usages.fidl
new file mode 100644
index 0000000..2fd70e1
--- /dev/null
+++ b/fidl/fuchsia.ui.input/usages.fidl
@@ -0,0 +1,18 @@
+// 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.ui.input;
+
+// Common mouse buttons report constants
+const uint32  kMouseButtonPrimary   = 1;
+const uint32  kMouseButtonSecondary = 2;
+const uint32  kMouseButtonTertiary  = 4;
+
+// Common stylus buttons report constants
+const uint32  kStylusBarrel = 1;
+
+// Used as mask bits (2^N) against ButtonDescriptor.buttons.
+const uint32  kVolumeUp             = 1;
+const uint32  kVolumeDown           = 2;
+const uint32  kMicMute              = 4;
diff --git a/fidl/fuchsia.ui.policy/display_usage.fidl b/fidl/fuchsia.ui.policy/display_usage.fidl
new file mode 100644
index 0000000..79f820f
--- /dev/null
+++ b/fidl/fuchsia.ui.policy/display_usage.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.ui.policy;
+
+// Describes the intended usage of the display.
+enum DisplayUsage {
+  kUnknown = 0;
+  // Display is held in one or both hands.
+  kHandheld = 1;
+  // Display is used well within arm's reach.
+  kClose = 2;
+  // Display is used at arm's reach.
+  kNear = 3;
+  // Display is used beyond arm's reach.
+  kMidrange = 4;
+  // Display is used well beyond arm's reach.
+  kFar = 5;
+};
diff --git a/fidl/fuchsia.ui.policy/meta.json b/fidl/fuchsia.ui.policy/meta.json
new file mode 100644
index 0000000..424455e
--- /dev/null
+++ b/fidl/fuchsia.ui.policy/meta.json
@@ -0,0 +1,20 @@
+{
+  "deps": [
+    "fuchsia.ui.gfx", 
+    "fuchsia.ui.input", 
+    "fuchsia.ui.viewsv1token"
+  ], 
+  "files": [
+    "fidl/fuchsia.ui.policy/display_usage.fidl", 
+    "fidl/fuchsia.ui.policy/presentation.fidl", 
+    "fidl/fuchsia.ui.policy/presenter.fidl"
+  ], 
+  "name": "fuchsia.ui.policy", 
+  "root": "fidl/fuchsia.ui.policy", 
+  "sources": [
+    "fidl/fuchsia.ui.policy/display_usage.fidl", 
+    "fidl/fuchsia.ui.policy/presentation.fidl", 
+    "fidl/fuchsia.ui.policy/presenter.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.policy/presentation.fidl b/fidl/fuchsia.ui.policy/presentation.fidl
new file mode 100644
index 0000000..c6d3dcc
--- /dev/null
+++ b/fidl/fuchsia.ui.policy/presentation.fidl
@@ -0,0 +1,84 @@
+// 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.ui.policy;
+
+using fuchsia.ui.gfx;
+using fuchsia.ui.input;
+
+// |Presentation.CaptureKeyboardEvent| will consume this listener interface and
+// call |OnEvent| when the registered keyboard event occurs.
+interface KeyboardCaptureListenerHACK {
+  1: OnEvent(fuchsia.ui.input.KeyboardEvent event);
+};
+
+// |Presentation.CapturePointerEvent| will consume this listener interface and
+// call |OnEvent| when a pointer event occurs.
+interface PointerCaptureListenerHACK {
+  1: OnPointerEvent(fuchsia.ui.input.PointerEvent event);
+};
+
+// Allows clients of Presenter.Present() to control a presentation.
+// Experimental.
+[Discoverable]
+interface Presentation {
+  // Enable or disable clipping for the Scenic renderer associated with the
+  // presentation.
+  1: EnableClipping(bool enabled);
+
+  2: UseOrthographicView();
+  3: UsePerspectiveView();
+
+  // Set parameters such as the shadow algorithm used to render the scene.
+  // NOTE: a single param would be better than an array; see TO-529.
+  4: SetRendererParams(vector<fuchsia.ui.gfx.RendererParam> params);
+
+  // Override the intended usage of the display.
+  5: SetDisplayUsage(DisplayUsage usage);
+
+  // Rotates the display.
+  11: SetDisplayRotation(float32 display_rotation_degrees, bool animate);
+
+  // Override the dimensions of the display. Values must be less than the actual
+  // size of the display. If either of the values are 0, then they are ignored
+  // and the actual size of the display is used.
+  7: SetDisplaySizeInMm(float32 width_in_mm, float32 height_in_mm);
+
+  // This call exists so that base shell can capture hotkeys and do special
+  // things with it (e.g., switch a session shell). Phase and modifiers are always
+  // matched, and valid (non-zero) code points are matched. If there is no
+  // valid code point, the filter will match against the hid usage value.
+  // The full KeyboardEvent is supplied to |listener|'s OnEvent.
+  // TODO: Figure out the feasibility of this feature and the best place to put
+  // it.
+  6: CaptureKeyboardEventHACK(fuchsia.ui.input.KeyboardEvent event_to_capture,
+                              KeyboardCaptureListenerHACK listener);
+
+  // This call exists so that base shell can capture pointer events.
+  // TODO: Figure out the feasibility of this feature and the best place to put
+  // it. This call will be replaced by gesture disambiguation system in future.
+  10: CapturePointerEventsHACK(PointerCaptureListenerHACK listener);
+
+  // TODO(SCN-650): Determine better place for PresentationMode API.
+  8: GetPresentationMode() -> (PresentationMode mode);
+  9: SetPresentationModeListener(PresentationModeListener listener);
+};
+
+// Screen modes that can be detected via sensor data.
+// N.B. We use accelerometers to measure gravity when at rest, so detection is
+// limited to earth-relative orientations.
+enum PresentationMode {
+  CLOSED = 0;
+  LAPTOP = 1;
+  TABLET = 2;
+  TENT = 3;
+};
+
+// Tell client that the screen mode has changed, according to sensors.
+// N.B. There can be a race where the actual mode continues to change, after
+// the listener has been notified. The client must call GetPresentationMode(),
+// which will return the latest detected mode.
+interface PresentationModeListener {
+  1: OnModeChanged();
+};
diff --git a/fidl/fuchsia.ui.policy/presenter.fidl b/fidl/fuchsia.ui.policy/presenter.fidl
new file mode 100644
index 0000000..f712643
--- /dev/null
+++ b/fidl/fuchsia.ui.policy/presenter.fidl
@@ -0,0 +1,45 @@
+// 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.ui.policy;
+
+using fuchsia.ui.gfx;
+using fuchsia.ui.viewsv1token;
+
+// The Presenter service provides a way for applications to ask that a
+// specified view be added to a view tree, leaving any window management
+// concerns up to the discretion of the presenter implementation.
+//
+// TODO(SCN-599): this will be replaced by Presenter2
+[Discoverable]
+interface Presenter {
+    1: Present2(handle<eventpair> view_owner_token, request<Presentation>? presentation_request);
+
+    // Sets new default renderer params and forces them on for the duration of the
+    // presenter's lifetime. Only applies to any subsequent calls to Present().
+    // Used for testing.
+    2: HACK_SetRendererParams(bool enable_clipping, vector<fuchsia.ui.gfx.RendererParam> params);
+
+    // Set the input path. Root presenter will send to ViewManager (legacy) or Scenic.
+    3: HACK_SetInputPath(bool use_legacy);
+
+    // Query the input path. Return true if ViewManager receives input.
+    4: HACK_QueryInputPath() -> (bool use_legacy);
+};
+
+// The Presenter service provides a way for applications to ask that a
+// specified view be added to a view tree, leaving any window management
+// concerns up to the discretion of the presenter implementation.
+//
+// TODO(SCN-595): this is the new presenter interface, which will be renamed
+// to Presenter after the original is deleted.
+[Discoverable]
+interface Presenter2 {
+    // Usage: the client creates a pair of eventpairs and uses one to create a
+    // View in their Scenic session.  The other eventpair is passed to this
+    // method as |view_holder_token|; the Presenter2 service will use this to
+    // create a ViewHolder which is embedded within an appropriate Scenic scene,
+    // such that the client View it will receive input events, etc.
+    1: PresentView(handle<eventpair> view_holder_token, request<Presentation>? presentation_request);
+};
diff --git a/fidl/fuchsia.ui.scenic/commands.fidl b/fidl/fuchsia.ui.scenic/commands.fidl
new file mode 100644
index 0000000..46c54f3
--- /dev/null
+++ b/fidl/fuchsia.ui.scenic/commands.fidl
@@ -0,0 +1,17 @@
+// 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.ui.scenic;
+
+using fuchsia.ui.gfx;
+using fuchsia.ui.input;
+using fuchsia.ui.vectorial;
+using fuchsia.ui.views;
+
+union Command {
+  fuchsia.ui.gfx.Command gfx;
+  fuchsia.ui.vectorial.Command vectorial;
+  fuchsia.ui.views.Command views;
+  fuchsia.ui.input.Command input;
+};
diff --git a/fidl/fuchsia.ui.scenic/events.fidl b/fidl/fuchsia.ui.scenic/events.fidl
new file mode 100644
index 0000000..f296622
--- /dev/null
+++ b/fidl/fuchsia.ui.scenic/events.fidl
@@ -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.
+
+library fuchsia.ui.scenic;
+
+using fuchsia.ui.input;
+using fuchsia.ui.gfx;
+
+union Event {
+  fuchsia.ui.gfx.Event gfx;
+  fuchsia.ui.input.InputEvent input;
+  Command unhandled;
+};
diff --git a/fidl/fuchsia.ui.scenic/meta.json b/fidl/fuchsia.ui.scenic/meta.json
new file mode 100644
index 0000000..26d9f49
--- /dev/null
+++ b/fidl/fuchsia.ui.scenic/meta.json
@@ -0,0 +1,25 @@
+{
+  "deps": [
+    "fuchsia.images", 
+    "fuchsia.ui.gfx", 
+    "fuchsia.ui.input", 
+    "fuchsia.ui.vectorial", 
+    "fuchsia.ui.views", 
+    "fuchsia.mem"
+  ], 
+  "files": [
+    "fidl/fuchsia.ui.scenic/commands.fidl", 
+    "fidl/fuchsia.ui.scenic/events.fidl", 
+    "fidl/fuchsia.ui.scenic/scenic.fidl", 
+    "fidl/fuchsia.ui.scenic/session.fidl"
+  ], 
+  "name": "fuchsia.ui.scenic", 
+  "root": "fidl/fuchsia.ui.scenic", 
+  "sources": [
+    "fidl/fuchsia.ui.scenic/commands.fidl", 
+    "fidl/fuchsia.ui.scenic/events.fidl", 
+    "fidl/fuchsia.ui.scenic/scenic.fidl", 
+    "fidl/fuchsia.ui.scenic/session.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.scenic/scenic.fidl b/fidl/fuchsia.ui.scenic/scenic.fidl
new file mode 100644
index 0000000..74a88cc
--- /dev/null
+++ b/fidl/fuchsia.ui.scenic/scenic.fidl
@@ -0,0 +1,38 @@
+// 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.ui.scenic;
+
+using fuchsia.images;
+using fuchsia.mem;
+using fuchsia.ui.gfx;
+
+// Scenic.TakeScreenshot() returns a raw BGRA formatted image in this struct.
+struct ScreenshotData {
+  fuchsia.images.ImageInfo info;
+  fuchsia.mem.Buffer data;
+};
+
+[Discoverable]
+interface Scenic {
+  // Create a new Session, which is the primary way to interact with Mozart.
+  1: CreateSession(request<Session> session, SessionListener? listener);
+
+  // Get information about the SceneManager's primary display.
+  // TODO(MZ-453): in the future there will probably be a DisplayManager, and
+  // info about which displays to use will be provided to the SceneManager.
+  2: GetDisplayInfo() -> (fuchsia.ui.gfx.DisplayInfo info);
+  // Gets an event signaled with displayOwnedSignal or displayNotOwnedSignal
+  // when display ownership changes.
+  3: GetDisplayOwnershipEvent() -> (handle<event> ownership_event);
+
+  // Take a screenshot and return the data in |img_data|. |img_data| will
+  // not contain BGRA data if |success| is false.
+  // TODO(SCN-678): The permissions here are too wide (anyone can take a
+  // screenshot), we should narrow them.
+  4: TakeScreenshot() -> (ScreenshotData img_data, bool success);
+};
+
+const uint32 displayOwnedSignal = 0x02000000;
+const uint32 displayNotOwnedSignal = 0x01000000;
diff --git a/fidl/fuchsia.ui.scenic/session.fidl b/fidl/fuchsia.ui.scenic/session.fidl
new file mode 100644
index 0000000..a1dcdbf
--- /dev/null
+++ b/fidl/fuchsia.ui.scenic/session.fidl
@@ -0,0 +1,150 @@
+// 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.ui.scenic;
+
+using fuchsia.images;
+using fuchsia.ui.gfx;
+
+// Client use Sessions to interact with a Mozart instance by enqueuing commands
+// that create or modify resources.
+interface Session {
+    1: Enqueue(vector<Command> cmds);
+
+    // Present all previously enqueued operations.  In order to pipeline the
+    // preparation of the resources required to render the scene, two lists of
+    // fences (implemented as events) are passed.
+    //
+    // SCHEDULING PRESENTATION
+    //
+    // |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.
+    //
+    // Using a desired presentation time in the present or past (such as 0)
+    // schedules enqueued operations to take visible effect as soon as possible
+    // (during the next frame to be prepared).
+    //
+    // Using a desired presentation time in the future schedules the enqueued
+    // operations to take visible effect as closely as possible to or after
+    // the stated time (but no earlier).
+    //
+    // Each rendered frame has a target presentation time.  Before rendering
+    // a frame, the scene manager applies all enqueued operations associated
+    // with all prior calls to |Present()| whose desired presentation time
+    // is on or before the frame's target presentation time.
+    //
+    // The |Present()| method does not return until the scene manager begins
+    // preparing the first frame which includes its presented content.
+    // Upon return, the |PresentationInfo| provides timing information for the
+    // frame which includes the presented content.
+    //
+    // To present new content on each successive frame, wait for |Present()|
+    // to return before calling |Present()| again with content for the next
+    // frame.
+    //
+    // It is also possible to enqueue and present successive frames of content
+    // all at once with increasing desired presentation times, incrementing by
+    // |PresentationInfo.presentation_interval| for each one.
+    //
+    // Animation updates are also coordinated in terms of presentation time.
+    //
+    // TODO(jeffbrown): Defining presentation time in terms of |CLOCK_MONOTONIC|
+    // simplifies synchronization across subsystems but it might be too simple.
+    // We should consider using a synthetic timebase and describing its relation
+    // to other clocks separately.  That would make it possible to present
+    // content (animations, media, and UI) in "slow mode" simply by varying the
+    // timing relation, assuming clients play along.
+    //
+    // SYNCHRONIZATION
+    //
+    // |acquire_fences| are used by Mozart to wait until all of the session's
+    // resources are ready to render (or to allow downstream components, such as
+    // the Vulkan driver, to wait for these resources).
+    //
+    // For example, Fuchsia's Vulkan driver allows an zx::event to be obtained
+    // from a VkSemaphore.  This allows a Mozart client to submit a Vulkan command
+    // buffer to generate images/meshes/etc., and instructing Vulkan to signal a
+    // VkSemaphore when it is done.  By inserting the zx::event corresponding to
+    // this semaphore into |acquire_fences|, the client allows Mozart to submit work
+    // to the Vulkan driver without waiting on the CPU for the event to be
+    // signalled.
+    //
+    // |release_fences| is a list of events that will be signalled by Mozart when
+    // the updated session state has been fully committed: future frames will be
+    // rendered using this state, and all frames generated using previous session
+    // states have been fully-rendered and presented to the display.
+    //
+    // Together, |acquire_fences| and |release_fences| are intended to allow clients
+    // to implement strategies such as double-buffering.  For example, a client
+    // might do the following in the Scenic subsystem:
+    //   1) create two Image with resource IDs #1 and #2.
+    //   2) create two Materials with resource IDs #3 and #4, which respectively
+    //      use Images #1 and #2 as their texture.
+    //   3) create a tree of Nodes and attach them to the scene.
+    //   4) set one of the nodes above, say #5, to use Material #3.
+    //   5) submit a Vulkan command-buffer which renders into Image #1, and
+    //      will signal a VkSemaphore.
+    //   6) call Present() with one acquire-fence (obtained from the VkSemaphore
+    //      above) and one newly-created release-fence.
+    //
+    // After the steps above, Mozart will use the committed session state to render
+    // frames whenever necessary.  When the client wants to display something
+    // different than Image #1, it would do something similar to steps 4) to 6):
+    //   7) set Node #5 to use Material #4.
+    //   8) submit a Vulkan command-buffer which renders into Image #1, and
+    //      will signal a VkSemaphore.
+    //   9) call Present() with one acquire-fence (obtained from the VkSemaphore
+    //      above) and one newly-created release-fence.
+    //
+    // Finally, to continually draw new content, the client could repeat steps
+    // 4) to 9), with one important difference: step 5) must wait on the event
+    // signalled by step 9).  Otherwise, it might render into Image #1 while that
+    // image is still being used by Mozart to render a frame.  Similarly, step 8)
+    // must wait on the event signalled by step 6).
+    //
+    // The scenario described above uses one acquire-fence and one release-fence,
+    // but it is easy to imagine cases that require more.  For example, in addition
+    // to using Vulkan to render into Images #1 and #2, the client might also
+    // upload other resources to Vulkan on a different VkQueue, which would
+    // would signal a separate semaphore, and therefore require an additional
+    // acquire-fence.
+    //
+    // Note: |acquire_fences| and |release_fences| are only necessary to synchronize
+    // access to memory (and other external resources).  Any modification to
+    // resources made via the Session API are automatically synchronized.
+    //
+    // TODO(MZ-400): document invariants that apply to |presentation_info|.  Is it
+    // strong enough to guarantee that receiving the response means that all
+    // previously-enqueued Commands have been applied?  Or does it need to be stronger,
+    // e.g. that all frames based on previous presentations are completely done,
+    // and subsequent frames will be rendered based on the most recent presented
+    // content?
+    2: Present(uint64 presentation_time,
+               vector<handle<event>> acquire_fences, vector<handle<event>> release_fences)
+           -> (fuchsia.images.PresentationInfo presentation_info);
+
+    // TODO(MZ-422) Remove these methods from the FIDL; they should just be
+    // exposed to View Manager directly using a C++ interface.
+    3: HitTest(uint32 node_id, fuchsia.ui.gfx.vec3 ray_origin, fuchsia.ui.gfx.vec3 ray_direction)
+           -> (vector<fuchsia.ui.gfx.Hit>? hits);
+    4: HitTestDeviceRay(fuchsia.ui.gfx.vec3 ray_origin, fuchsia.ui.gfx.vec3 ray_direction)
+           -> (vector<fuchsia.ui.gfx.Hit>? hits);
+
+    // Set an optional debug name for the session.  The debug name will be
+    // output in things such as logging and trace events.
+    5: SetDebugName(string debug_name);
+};
+
+// Listens for events which occur within the session.
+interface SessionListener {
+    // Called when an error has occurred and the session will be torn down.
+    1: OnScenicError(string error);
+
+    // Called to deliver a batch of one or more events to the listener.
+    // Use |SetEventMaskCmd| to enable event delivery for a resource.
+    2: OnScenicEvent(vector<Event> events);
+};
diff --git a/fidl/fuchsia.ui.vectorial/commands.fidl b/fidl/fuchsia.ui.vectorial/commands.fidl
new file mode 100644
index 0000000..7067240
--- /dev/null
+++ b/fidl/fuchsia.ui.vectorial/commands.fidl
@@ -0,0 +1,9 @@
+// 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.ui.vectorial;
+
+union Command {
+  bool placeHolder;
+};
diff --git a/fidl/fuchsia.ui.vectorial/events.fidl b/fidl/fuchsia.ui.vectorial/events.fidl
new file mode 100644
index 0000000..14fddb0
--- /dev/null
+++ b/fidl/fuchsia.ui.vectorial/events.fidl
@@ -0,0 +1,9 @@
+// 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.ui.vectorial;
+
+union Event {
+  bool placeHolder;
+};
diff --git a/fidl/fuchsia.ui.vectorial/meta.json b/fidl/fuchsia.ui.vectorial/meta.json
new file mode 100644
index 0000000..4bd6fc0
--- /dev/null
+++ b/fidl/fuchsia.ui.vectorial/meta.json
@@ -0,0 +1,14 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.ui.vectorial/commands.fidl", 
+    "fidl/fuchsia.ui.vectorial/events.fidl"
+  ], 
+  "name": "fuchsia.ui.vectorial", 
+  "root": "fidl/fuchsia.ui.vectorial", 
+  "sources": [
+    "fidl/fuchsia.ui.vectorial/commands.fidl", 
+    "fidl/fuchsia.ui.vectorial/events.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.views/commands.fidl b/fidl/fuchsia.ui.views/commands.fidl
new file mode 100644
index 0000000..f138081
--- /dev/null
+++ b/fidl/fuchsia.ui.views/commands.fidl
@@ -0,0 +1,33 @@
+// 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.ui.views;
+
+union Command {
+  CreateViewCmd create_view;
+  CreateViewHolderCmd create_view_holder;
+
+  AddChildViewCmd add_child_view;
+  RemoveChildViewCmd remove_child_view;
+};
+
+struct CreateViewCmd {
+  uint32 id;
+  handle<eventpair> token;
+};
+
+struct CreateViewHolderCmd {
+  uint32 id;
+  handle<eventpair> token;
+};
+
+struct AddChildViewCmd {
+  uint32 view_id;
+  uint32 view_holder_id;
+};
+
+struct RemoveChildViewCmd {
+  uint32 view_id;
+  uint32 view_holder_id;
+};
diff --git a/fidl/fuchsia.ui.views/events.fidl b/fidl/fuchsia.ui.views/events.fidl
new file mode 100644
index 0000000..f737e57
--- /dev/null
+++ b/fidl/fuchsia.ui.views/events.fidl
@@ -0,0 +1,32 @@
+// 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.ui.views;
+
+using fuchsia.ui.gfx;
+
+union Event {
+  ChildViewAttachedEvent child_view_attached;
+  ChildViewUnavailableEvent child_view_unavailable;
+};
+
+// Called when a child view is attached.
+struct ChildViewAttachedEvent {
+  uint32 view_holder_id;
+};
+
+// Called when a child view has become unavailable.
+//
+// A child may become unavailable for many reasons such being unregistered
+// by its application, abnormal termination of its application, or
+// cycles being introduced in the view tree.
+//
+// To complete removal of an unavailable child, this view component must
+// call RemoveChild() on its view with |child_key|.
+//
+// The implementation should invoke the callback once the event has
+// been handled.
+struct ChildViewUnavailableEvent {
+  uint32 view_holder_id;
+};
diff --git a/fidl/fuchsia.ui.views/meta.json b/fidl/fuchsia.ui.views/meta.json
new file mode 100644
index 0000000..2408d9a
--- /dev/null
+++ b/fidl/fuchsia.ui.views/meta.json
@@ -0,0 +1,19 @@
+{
+  "deps": [
+    "fuchsia.sys", 
+    "fuchsia.math", 
+    "fuchsia.ui.gfx", 
+    "fuchsia.ui.input"
+  ], 
+  "files": [
+    "fidl/fuchsia.ui.views/commands.fidl", 
+    "fidl/fuchsia.ui.views/events.fidl"
+  ], 
+  "name": "fuchsia.ui.views", 
+  "root": "fidl/fuchsia.ui.views", 
+  "sources": [
+    "fidl/fuchsia.ui.views/commands.fidl", 
+    "fidl/fuchsia.ui.views/events.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.viewsv1/accessibility_view_inspector.fidl b/fidl/fuchsia.ui.viewsv1/accessibility_view_inspector.fidl
new file mode 100644
index 0000000..6dc7c77
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/accessibility_view_inspector.fidl
@@ -0,0 +1,22 @@
+// Copyright 2015 The Fuchsia 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.ui.viewsv1;
+
+using fuchsia.ui.gfx;
+using fuchsia.ui.scenic;
+using fuchsia.math;
+
+// This is a temporary solution to expose hit testing to the accessibility manager before the
+// scenic refactor.
+// TODO(SCN-845) A new hit test API will be exposed after the refactor.
+//
+// DO NOT USE!
+
+[Discoverable]
+interface AccessibilityViewInspector {
+  // Provides a FIDL interface to expose the hit test mechanism from view manager.
+  1: PerformHitTest(ViewTreeToken token, fuchsia.math.Point3F origin,
+                    fuchsia.math.Point3F direction) -> (vector<fuchsia.ui.gfx.Hit> hits);
+};
diff --git a/fidl/fuchsia.ui.viewsv1/meta.json b/fidl/fuchsia.ui.viewsv1/meta.json
new file mode 100644
index 0000000..8726e16
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/meta.json
@@ -0,0 +1,35 @@
+{
+  "deps": [
+    "fuchsia.math", 
+    "fuchsia.sys", 
+    "fuchsia.ui.gfx", 
+    "fuchsia.ui.scenic", 
+    "fuchsia.ui.viewsv1token", 
+    "fuchsia.mem"
+  ], 
+  "files": [
+    "fidl/fuchsia.ui.viewsv1/accessibility_view_inspector.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_containers.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_manager.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_properties.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_provider.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_snapshot.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_tree_token.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_trees.fidl", 
+    "fidl/fuchsia.ui.viewsv1/views.fidl"
+  ], 
+  "name": "fuchsia.ui.viewsv1", 
+  "root": "fidl/fuchsia.ui.viewsv1", 
+  "sources": [
+    "fidl/fuchsia.ui.viewsv1/accessibility_view_inspector.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_containers.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_manager.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_properties.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_provider.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_snapshot.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_tree_token.fidl", 
+    "fidl/fuchsia.ui.viewsv1/view_trees.fidl", 
+    "fidl/fuchsia.ui.viewsv1/views.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.viewsv1/view_containers.fidl b/fidl/fuchsia.ui.viewsv1/view_containers.fidl
new file mode 100644
index 0000000..9c44d8c
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_containers.fidl
@@ -0,0 +1,202 @@
+// 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.ui.viewsv1;
+
+using fuchsia.mem;
+
+using fuchsia.ui.viewsv1token;
+
+// A view container is an interface exposed by |View| and |ViewTree| to
+// manage their child views.  Although |View| may have any number of children,
+// a |ViewTree| can have at most one (its root view).
+//
+// EMBEDDING
+//
+// The following steps are required to embed another view as a child:
+//
+// 1. Obtain the |ViewOwner| belonging to the view you would like to embed.
+//    The means for doing this is not specified by the view system.
+//    You might create another view of your own to embed or connect to
+//    another application using a mechanism such as |ViewProvider| (or
+//    any suitable agreed-upon protocol) to create the view to embed.
+//
+// 2. Call |AddChild()| to add the view you would like to embed and assign
+//    it a unique key.
+//
+// 3. Call |SetChildProperties()| to provide layout parameters and other
+//    properties for the new child using the same key that was provided
+//    to |AddChild()|.
+//
+// 4. Watch for the child becoming unavailable, as reported by
+//    |OnChildUnavailable()|, which indicates that the child is no longer
+//    in a usable state (perhaps the application which provided it has
+//    stopped).  When this happens, you are still responsible for calling
+//    |RemoveChild()| to remove the child and discard any state that your
+//    view has associated with it.
+//
+// VIEW PROPERTIES AND LAYOUT
+//
+// The container controls the presentation of its children by setting
+// |ViewProperties| for each of them.  View properties include layout
+// information and other parameters the child needs to know to participate
+// in the view hierarchy.
+//
+// The container must set properties for each of its children after adding
+// them, as otherwise the children cannot be rendered (since they lack enough
+// context to know what to draw).
+interface ViewContainer {
+  // Sets the view container listener, or null to remove.
+  1: SetListener(ViewContainerListener? listener);
+
+  // Adds the view referenced by |child_view_owner| as a child and assigns
+  // it the provided |child_key| to identify it among its children.
+  // The container may remove the child later by passing the same |child_key|
+  // to |RemoveChild()|.
+  //
+  // This method takes ownership of the view.
+  //
+  // It is important for the container to choose locally unique values for
+  // |child_key| to ensure that each child can be distinguished even as
+  // more children are added or removed.  We recommend using a simple
+  // counter which is incremented on each (re-)addition.
+  //
+  // If the child becomes unavailable at any time prior to being removed
+  // then an |OnChildUnavailable()| message will be sent.
+  //
+  // If |child_view_owner| refers to a view which is already unavailable or
+  // if adding the view would create a cycle in the view tree then the
+  // call proceeds as if it succeeded but an |OnChildUnavailable()| message
+  // will be sent.
+  //
+  // If |child_view_owner| refers to a view which already has a container or is
+  // the root of a view tree then an |OnChildUnavailable()| message will
+  // be sent to its old container or root and the the view will be
+  // (re-)added to its new container as usual.  This special case also
+  // applies when the specified view is already a child of this view, in which
+  // case the behavior is similar to the view having been transferred to
+  // some other container and then back again.
+  //
+  // Note that an unavailable child will remain in its container's list of
+  // children until its container explicitly calls |RemoveChild()| to remove
+  // it.
+  //
+  // |host_import_token| is an import token which the view manager will
+  // use to import the node to which the child view's content should
+  // be attached.
+  //
+  // To establish the graphical embedding relation, the container view
+  // must create an event pair, bind one endpoint to an |ExportResourceOp|
+  // associated with the node to which the child's content nodes will be
+  // attached as descendants, and pass the other endpoint to this method as
+  // |host_import_token|.
+  //
+  // It is an error to add a view whose |child_key| already appears
+  // in the view's list of children; the connection will be closed.
+  //
+  // It is an error to add more than one child to a |ViewTree|'s container;
+  // it can only have at most one child (its root).
+  //
+  // This method is deprecated in favor of the eventpair-based one below.
+  // TODO(SCN-1018): Remove this.
+  2: AddChild(uint32 child_key,
+      fuchsia.ui.viewsv1token.ViewOwner child_view_owner,
+      handle<eventpair> host_import_token);
+
+  3: AddChild2(uint32 child_key,
+      handle<eventpair> view_holder_token,
+      handle<eventpair> host_import_token);
+
+  // Removes the view referenced by |child_key| from the view's
+  // list of children.
+  //
+  // If |transferred_view_owner| is not null, associates it with the
+  // previously added child to allow it to be transferred elsewhere or
+  // closes the |transferred_view_owner| channel if there was none.
+  //
+  // It is an error to remove a view whose |child_key| does not appear
+  // in the container's list of children; the connection will be closed.
+  //
+  // This method is deprecated in favor of the eventpair-based one below.
+  // TODO(SCN-1018): Remove this.
+  4: RemoveChild(uint32 child_key,
+      request<fuchsia.ui.viewsv1token.ViewOwner>? transferred_view_owner);
+
+  5: RemoveChild2(uint32 child_key,
+      handle<eventpair>? transferred_view_holder_token);
+
+  // Sets view properties for the child, such as layout constraints.
+  //
+  // This method must be called at least once after a child is added to
+  // set the view's properties before it can be rendered.  Rendering for
+  // children without properties is blocked until properties are set.
+  //
+  // The |child_view_properties| specifies the properties for the child, or
+  // null to remove the properties from the child which will cause rendering
+  // of the child's scene to be blocked until new properties are set.
+  //
+  // It is an error to specify a |child_key| that does not appear in
+  // the container's list of children; the connection will be closed.
+  //
+  // It is an error to specify malformed |child_view_properties| such
+  // as invalid layout properties; the connection will be closed.
+  6: SetChildProperties(uint32 child_key, ViewProperties? child_view_properties);
+
+  // WIP API
+  // Sends a hint about a pending size change to the given node and all nodes
+  // below. This is generally sent before an animation.
+  //
+  // |width_change_factor| and |height_change_factor| is how much bigger or smaller
+  // the item is expected to be in the near future. This one number encapsulate
+  // both changes in scale, as well as changes to layout width and height.
+  //
+  // It is an error to specify a |child_key| that does not appear in
+  // the container's list of children; the connection will be closed.
+  //
+  7: SendSizeChangeHintHACK(uint32 child_key, float32 width_change_factor,
+                            float32 height_change_factor);
+
+  // Request the child view to get input focus for key events.
+  8: RequestFocus(uint32 child_key);
+
+  // Request the snapshot of the child view.
+  9: RequestSnapshotHACK(uint32 child_key)-> (fuchsia.mem.Buffer data);
+};
+
+// An interface clients may implement to receive events from a view container.
+interface ViewContainerListener {
+  // Called when a child view is attached along with embedding information.
+  //
+  // This method will be called at most once after the child is added.
+  //
+  // The implementation should invoke the callback once the event has
+  // been handled.
+  1: OnChildAttached(uint32 child_key, ViewInfo child_view_info) -> ();
+
+  // Called when a child view has become unavailable.
+  //
+  // A child may become unavailable for many reasons such being unregistered
+  // by its application, abnormal termination of its application, or
+  // cycles being introduced in the view tree.
+  //
+  // To complete removal of an unavailable child, this view component must
+  // call RemoveChild() on its view with |child_key|.
+  //
+  // The implementation should invoke the callback once the event has
+  // been handled.
+  2: OnChildUnavailable(uint32 child_key) -> ();
+
+  // TODO(jeffbrown): Once we figure out measurement, add a |OnChildResized|
+  // event or similar to allow the container to get the size along with the
+  // scene version.
+};
+
+// Provides embedding information about a view for use by its container.
+//
+// This information is valid until the container removes the view.
+struct ViewInfo {
+  // There is currently no information here but we have preserved the
+  // plumbing for now.  May remove later.
+  uint8 dummy;
+};
diff --git a/fidl/fuchsia.ui.viewsv1/view_manager.fidl b/fidl/fuchsia.ui.viewsv1/view_manager.fidl
new file mode 100644
index 0000000..5013d8b
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_manager.fidl
@@ -0,0 +1,92 @@
+// Copyright 2015 The Fuchsia 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.ui.viewsv1;
+
+using fuchsia.ui.scenic;
+using fuchsia.ui.viewsv1token;
+
+// Maximum length for a view or view tree label.
+const uint32 kLabelMaxLength = 32;
+
+// The view manager manages trees of views which represent user interface
+// components.
+//
+// Applications create views to describe user interface components
+// to present content to the user and support user interaction.
+//
+// The system creates a view tree to hold the root of a view hierarchy
+// containing views from various applications.
+//
+// Refer to |View| and |ViewTree| for more information about these objects.
+[Discoverable]
+interface ViewManager {
+
+  // Gets the scenic instance associated with this view manager.
+  // All graphical content for this view manager's views and view trees
+  // must come from sessions created by this |scenic| instance.
+  1: GetScenic(request<fuchsia.ui.scenic.Scenic> scenic);
+
+  // Creates a view.
+  //
+  // The |view| is used to configure the view and interact with its
+  // local environment.
+  //
+  // The |view_owner| is used as a transferable reference which can
+  // be passed to the view's intended container as part of a request to
+  // add the view as a child.  The view manager itself does not describe
+  // how this interaction should take place, only that ownership should
+  // eventually be passed back through the container's view interface
+  // as an argument to |View.AddChild()|.
+  //
+  // The |view_listener| is used to receive events from the view.
+  //
+  // The |label| is an optional name to associate with the view for
+  // diagnostic purposes.  The label will be truncated if it is longer
+  // than |kLabelMaxLength|.
+  //
+  // |parent_export_token| is an export token which the view manager
+  // will use to export the node to which the view's content should be
+  // attached.
+  //
+  // To present graphical content, the view must obtain a |Session| from
+  // |Mozart|, create an event pair, bind one endpoint to an
+  // |ImportResourceOp| using |ImportSpec.NODE|, attach its content nodes as
+  // descendants of the imported node, and pass the other endpoint of the
+  // event pair to this method as |parent_export_token|.
+  //
+  // To destroy the view and cause it to be removed from the view tree,
+  // simply close the |view|, |view_listener|, or |view_owner| channels.
+  //
+  // This method is deprecated in favor of the eventpair-based one below.
+  // TODO(SCN-1018): Remove this.
+  2: CreateView(request<View> view,
+               request<fuchsia.ui.viewsv1token.ViewOwner> view_owner,
+               ViewListener view_listener,
+               handle<eventpair> parent_export_token,
+               string? label);
+
+  3: CreateView2(request<View> view,
+                handle<eventpair> view_token,
+                ViewListener view_listener,
+                handle<eventpair> parent_export_token,
+                string? label);
+
+  // Creates a view tree.
+  //
+  // The |view_tree| is used to configure the view tree and interact
+  // with the views it contains.
+  //
+  // The |view_tree_listener| is used to receive events from the view tree.
+  //
+  // The |label| is an optional name to associate with the view tree for
+  // diagnostic purposes.  The label will be truncated if it is longer
+  // than |kLabelMaxLength|.
+  //
+  // To destroy the view tree simply close the |view_tree| or
+  // |view_tree_listener| channels.
+  4: CreateViewTree(request<ViewTree> view_tree,
+                   ViewTreeListener view_tree_listener,
+                   string? label);
+};
diff --git a/fidl/fuchsia.ui.viewsv1/view_properties.fidl b/fidl/fuchsia.ui.viewsv1/view_properties.fidl
new file mode 100644
index 0000000..3d106a1
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_properties.fidl
@@ -0,0 +1,35 @@
+// 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.ui.viewsv1;
+
+using fuchsia.math;
+
+// Parameters and contextual information for a view provided by its container.
+//
+// When a container sets properties for its children, any properties which
+// are set to null are inherited from the container's own ancestors.
+struct ViewProperties {
+  ViewLayout? view_layout;
+  CustomFocusBehavior? custom_focus_behavior;
+};
+
+struct CustomFocusBehavior {
+  bool allow_focus = true;
+};
+
+// Provides layout constraints for a view.
+//
+// TODO(jeffbrown): Decide how measurement should be performed.  Perhaps
+// bring back |BoxConstraints| or introduce some other protocol just for
+// measurement.
+struct ViewLayout {
+  // The size of the view in logical pixels.
+  // Must be non-negative.
+  fuchsia.math.SizeF size;
+
+  // The inset of the view in logical pixels.
+  // Must be non-negative.
+  fuchsia.math.InsetF inset;
+};
diff --git a/fidl/fuchsia.ui.viewsv1/view_provider.fidl b/fidl/fuchsia.ui.viewsv1/view_provider.fidl
new file mode 100644
index 0000000..0545653
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_provider.fidl
@@ -0,0 +1,28 @@
+// Copyright 2015 The Fuchsia 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.ui.viewsv1;
+
+using fuchsia.sys;
+using fuchsia.ui.viewsv1token;
+
+// Provides a View upon request.
+//
+// Applications should implement and expose this service so that they can
+// expose views to be embedded into other applications.
+[Discoverable]
+interface ViewProvider {
+  // Creates and registers a view with the view manager and returns its
+  // view owner which may subsequently be passed to |View.AddChild()|
+  // to attach the view to a view hierarchy.
+  //
+  // Implementors of this interface are responsible for creating the view
+  // and forwarding the |view_owner| interface request to
+  // |ViewManager.CreateView()|.
+  //
+  // The caller may request services from the created view via the |services|
+  // service provider.
+  1: CreateView(request<fuchsia.ui.viewsv1token.ViewOwner> view_owner,
+               request<fuchsia.sys.ServiceProvider>? services);
+};
diff --git a/fidl/fuchsia.ui.viewsv1/view_snapshot.fidl b/fidl/fuchsia.ui.viewsv1/view_snapshot.fidl
new file mode 100644
index 0000000..a5100d4
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_snapshot.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.ui.viewsv1;
+
+using fuchsia.ui.viewsv1token;
+using fuchsia.mem;
+
+// Defines an interface to take view snapshots.
+[Discoverable]
+interface ViewSnapshot {
+  // TODO(SCN-1019): Use zx::eventpair instead of koid.
+  // Takes a snapshot of a view and returns it in a callback.
+  //
+  // The |view_koid| identifies the view whose snapshot needs to be taken.
+  //
+  // The callback is invoked with the VMO buffer containing the snapshot.
+  // If successful, the buffer size is non-zero, otherwise it is 0.
+  1: TakeSnapshot(uint64 view_koid) ->
+                  (fuchsia.mem.Buffer snapshot);
+};
diff --git a/fidl/fuchsia.ui.viewsv1/view_tree_token.fidl b/fidl/fuchsia.ui.viewsv1/view_tree_token.fidl
new file mode 100644
index 0000000..3fb8a7a
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_tree_token.fidl
@@ -0,0 +1,20 @@
+// 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.ui.viewsv1;
+
+// A view tree token is an opaque transferable reference to a view tree.
+//
+// The ViewManager provides each view tree with a unique view tree token when
+// it is registered.  The token can subsequently be passed to other
+// applications and used as a way to refer to the tree.
+//
+// View tree tokens should be kept secret and should only be shared with
+// trusted services.
+//
+// TODO(jeffbrown): This implementation is a temporary placeholder until
+// we provide a way to create tokens which cannot be forged.
+struct ViewTreeToken {
+  uint32 value;
+};
diff --git a/fidl/fuchsia.ui.viewsv1/view_trees.fidl b/fidl/fuchsia.ui.viewsv1/view_trees.fidl
new file mode 100644
index 0000000..7a159bf
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/view_trees.fidl
@@ -0,0 +1,68 @@
+// Copyright 2015 The Fuchsia 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.ui.viewsv1;
+
+using fuchsia.sys;
+
+// A view tree is a top-level container for a hierarchy of views.
+// Each view is intended to operate independently from others and will
+// generally correspond to discrete interactive spaces such as separate
+// displays or isolated environments in a multi-user system.
+//
+// Within a view tree, certain global invariants may be enforced such as
+// ensuring that only one view has focus at a time.
+//
+// View trees will typically be created by system components responsible
+// for managing the overall user interface rather than end-user applications.
+//
+// LIFECYCLE
+//
+// Use |ViewManager.CreateViewTree()| to create a view tree.  The client
+// uses the |ViewTree| interface to manage the view tree's content
+// and implements the |ViewTreeListener| interface to handle events.
+//
+// To destroy a view tree, simply close the |ViewTree| channel.
+//
+// SETTING A ROOT VIEW
+//
+// Use |GetContainer()| to obtain an interface for manipulating the root view.
+//
+// See |ViewContainer| for more information.
+//
+// GETTING SERVICES
+//
+// The view tree's |fuchsia::sys::ServiceProvider| offers access to many services
+// which are not directly expressed by the |ViewTree| interface itself, such
+// as input, accessiblity, and editing capabilities.
+//
+// For example, perform the following actions to dispatch input events:
+//
+// 1. Call |GetServiceProvider()| to obtain the view's service provider.
+//
+// 2. Ask the service provider for its |InputDispatcher|.
+//
+// 3. Send input events to the dispatcher for delivery to views.
+interface ViewTree {
+  // Gets the view tree's token.
+  1: GetToken() -> (ViewTreeToken token);
+
+  // Gets a service provider to access services which are associated with
+  // the view tree such as input, accessibility and editing capabilities.
+  // The view tree service provider is private to the view tree and should
+  // not be shared with anyone else.
+  //
+  // See |InputDispatcher|.
+  2: GetServiceProvider(request<fuchsia.sys.ServiceProvider> service_provider);
+
+  // Gets an interface for managing the view tree's root.
+  3: GetContainer(request<ViewContainer> container);
+};
+
+// An interface clients may implement to receive events from a view tree.
+interface ViewTreeListener {
+  // There are currently no events defined but we have preserved the
+  // plumbing for the future when ViewContainer will merge into ViewTree
+  // along with its listener.
+};
diff --git a/fidl/fuchsia.ui.viewsv1/views.fidl b/fidl/fuchsia.ui.viewsv1/views.fidl
new file mode 100644
index 0000000..09cc345
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1/views.fidl
@@ -0,0 +1,80 @@
+// Copyright 2015 The Fuchsia 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.ui.viewsv1;
+
+using fuchsia.sys;
+using fuchsia.ui.viewsv1token;
+
+// A view is a graphical user interface component which is responsible
+// for drawing and supporting user interactions in the area of the screen
+// that it occupies.
+//
+// A view may also act as a container for other views (known as the
+// view's children) which it may freely layout and position anywhere
+// within its bounds to form a composite user interface.  The hierarchy
+// of views thus formed is called a view tree.
+//
+// LIFECYCLE
+//
+// Use |ViewManager.CreateView()| to create a view.  The application
+// uses the |View| interface to manage the view's content and implements
+// the |ViewListener| interface to handle events.
+//
+// To destroy a view, simply close the |View| channel.
+//
+// ADDING CHILD VIEWS
+//
+// Use |GetContainer()| to obtain an interface for manipulating child views.
+//
+// See |ViewContainer| for more information.
+//
+// GETTING SERVICES
+//
+// The view's |fuchsia::sys::ServiceProvider| offers access to many services which
+// are not directly expressed by the |View| interface itself, such
+// as input, accessiblity, and editing capabilities.
+//
+// For example, perform the following actions to receive input events:
+//
+// 1. Call |GetServiceProvider()| to obtain the view's service provider.
+//
+// 2. Ask the service provider for its |InputConnection|.
+//
+// 3. Set listeners on the input connection to receive events.
+interface View {
+  // Gets a service provider to access services which are associated with
+  // the view such as input, accessibility and editing capabilities.
+  // The view service provider is private to the view and should not be
+  // shared with anyone else.
+  //
+  // See |InputConnection|.
+  1: GetServiceProvider(request<fuchsia.sys.ServiceProvider> service_provider);
+
+  // This is a way for an app to offer services that are associated with a
+  // particular view. Used to expose services to the compositor
+  //
+  // In particular this should be used to let know which view is implementing
+  // the ability to show an IME
+  //
+  // |service_names| should contain a list of service names as defined with the
+  // FIDL syntax [Discoverable]
+  //
+  // The list of services will be used by the compositor to filter service
+  // providers when looking for a particular service.
+  2: OfferServiceProvider(fuchsia.sys.ServiceProvider service_provider,
+                         vector<string> service_names);
+
+  // Gets an interface for managing the view's children.
+  3: GetContainer(request<ViewContainer> container);
+};
+
+// An interface clients may implement to receive events from a view.
+interface ViewListener {
+  // Called when the view receives new properties from its ancestors.
+  // Initially the view has no properties so this method will be called
+  // as soon as properties first become available and whenever they change
+  // thereafter.
+  1: OnPropertiesChanged(ViewProperties properties) -> ();
+};
diff --git a/fidl/fuchsia.ui.viewsv1token/meta.json b/fidl/fuchsia.ui.viewsv1token/meta.json
new file mode 100644
index 0000000..37151df
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1token/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.ui.viewsv1token/view_token.fidl"
+  ], 
+  "name": "fuchsia.ui.viewsv1token", 
+  "root": "fidl/fuchsia.ui.viewsv1token", 
+  "sources": [
+    "fidl/fuchsia.ui.viewsv1token/view_token.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.ui.viewsv1token/view_token.fidl b/fidl/fuchsia.ui.viewsv1token/view_token.fidl
new file mode 100644
index 0000000..005b36b
--- /dev/null
+++ b/fidl/fuchsia.ui.viewsv1token/view_token.fidl
@@ -0,0 +1,11 @@
+// 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.ui.viewsv1token;
+
+// A view owner allows linking its associated view into a view hierarchy.
+//
+// This interface is only intended to be used as a token, analogous to how
+// Scenic View/ViewHolder resources use eventpairs as tokens.
+interface ViewOwner {};
diff --git a/fidl/fuchsia.wlan.minstrel/meta.json b/fidl/fuchsia.wlan.minstrel/meta.json
new file mode 100644
index 0000000..544ee40
--- /dev/null
+++ b/fidl/fuchsia.wlan.minstrel/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.wlan.minstrel/wlan_minstrel.fidl"
+  ], 
+  "name": "fuchsia.wlan.minstrel", 
+  "root": "fidl/fuchsia.wlan.minstrel", 
+  "sources": [
+    "fidl/fuchsia.wlan.minstrel/wlan_minstrel.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.wlan.minstrel/wlan_minstrel.fidl b/fidl/fuchsia.wlan.minstrel/wlan_minstrel.fidl
new file mode 100644
index 0000000..7e1cbd1
--- /dev/null
+++ b/fidl/fuchsia.wlan.minstrel/wlan_minstrel.fidl
@@ -0,0 +1,33 @@
+// 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.wlan.minstrel;
+
+struct Peers {
+    vector<array<uint8>:6> peers;
+};
+
+// LINT.IfChange
+struct StatsEntry {
+    uint16 tx_vector_idx;
+    string tx_vec_desc;
+    uint64 success_cur;
+    uint64 attempts_cur;
+    float32 probability;
+    float32 cur_tp;
+    uint64 success_total;
+    uint64 attempts_total;
+    uint64 probes_total;
+};
+
+struct Peer {
+    array<uint8>:6 mac_addr;
+    uint16 max_tp;
+    uint16 max_probability;
+    uint16 basic_highest;
+    uint16 basic_max_probability;
+    uint64 probes;
+    vector<StatsEntry> entries;
+};
+// LINT.ThenChange(//garnet/drivers/wlan/wlan/minstrel.h)
diff --git a/fidl/fuchsia.wlan.mlme/meta.json b/fidl/fuchsia.wlan.mlme/meta.json
new file mode 100644
index 0000000..58c5962
--- /dev/null
+++ b/fidl/fuchsia.wlan.mlme/meta.json
@@ -0,0 +1,17 @@
+{
+  "deps": [
+    "fuchsia.wlan.stats", 
+    "fuchsia.wlan.minstrel"
+  ], 
+  "files": [
+    "fidl/fuchsia.wlan.mlme/wlan_mlme.fidl", 
+    "fidl/fuchsia.wlan.mlme/wlan_mlme_ext.fidl"
+  ], 
+  "name": "fuchsia.wlan.mlme", 
+  "root": "fidl/fuchsia.wlan.mlme", 
+  "sources": [
+    "fidl/fuchsia.wlan.mlme/wlan_mlme.fidl", 
+    "fidl/fuchsia.wlan.mlme/wlan_mlme_ext.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.wlan.mlme/wlan_mlme.fidl b/fidl/fuchsia.wlan.mlme/wlan_mlme.fidl
new file mode 100644
index 0000000..0f731c0
--- /dev/null
+++ b/fidl/fuchsia.wlan.mlme/wlan_mlme.fidl
@@ -0,0 +1,934 @@
+// 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.wlan.mlme;
+
+// Stub types for communicating between the wlan service and the MLME drivers. Based on the 802.11
+// MLME SAP interface (IEEE Std 802.11-2016 section 6.3).
+
+// TODO(NET-631): restore the commented out enum aliases
+
+// MLME-SCAN.request (IEEE Std 802.11-2016 6.3.3.2)
+
+enum BSSTypes {
+    INFRASTRUCTURE = 1;
+    PERSONAL = 2;
+    INDEPENDENT = 3;
+    MESH = 4;
+    ANY_BSS = 5;
+    //LAST = ANY_BSS;
+};
+
+enum ScanTypes {
+    ACTIVE = 1;
+    PASSIVE = 2;
+    //LAST = PASSIVE;
+};
+
+// LINT analyzer keyword intended for humans:
+// LINT.IfChange
+
+enum PHY {
+    HR = 1;   // IEEE 802.11b, used for DSSS, HR/DSSS, ERP-DSSS/CCK
+    ERP = 2;  // IEEE 802.11a/g, used for ERP-OFDM
+    HT = 3;   // IEEE 802.11n
+    VHT = 4;  // IEEE 802.11ac
+    HEW = 5;  // IEEE 802.11ax
+};
+
+enum CBW {	// Channel Bandwidth
+    CBW20 = 0;
+    CBW40 = 1;
+    //CBW40ABOVE = CBW40;
+    CBW40BELOW = 2;
+    CBW80 = 3;
+    CBW160 = 4;
+    CBW80P80 = 5;
+
+    CBW_COUNT = 6;
+};
+
+struct WlanChan {
+    uint8 primary;
+    CBW cbw;
+    uint8 secondary80;
+};
+
+enum Band : uint8 {
+    WLAN_BAND_2GHZ = 0;
+    WLAN_BAND_5GHZ = 1;
+    WLAN_BAND_COUNT = 2;
+};
+
+// LINT.ThenChange(//garnet/lib/wlan/protocol/include/wlan/protocol/info.h)
+
+struct ScanRequest {
+    uint64 txn_id;
+    BSSTypes bss_type;
+    array<uint8>:6 bssid;
+    vector<uint8>:32 ssid;
+    ScanTypes scan_type;
+    uint32 probe_delay;  // in TimeUnits
+    vector<uint8>? channel_list;
+    uint32 min_channel_time;  // in TimeUnits
+    uint32 max_channel_time;  // in TimeUnits
+    // RequestInformation
+    vector<vector<uint8>:32>? ssid_list;
+    // ChannelUsage
+    // AccessNetworkType
+    // HESSID
+    // Mesh ID
+    // DiscoveryMode
+    // VendorSpecificInfo
+};
+
+
+// MLME-SCAN.confirm (IEEE Std 802.11-2016 6.3.3.3)
+
+// IEEE Std 802.11-2016, 9.4.1.4
+struct CapabilityInfo {
+    bool ess;
+    bool ibss;
+    bool cf_pollable;
+    bool cf_poll_req;
+    bool privacy;
+    bool short_preamble;
+    bool spectrum_mgmt;
+    bool qos;
+    bool short_slot_time;
+    bool apsd;
+    bool radio_msmt;
+    bool delayed_block_ack;
+    bool immediate_block_ack;
+};
+
+// IEEE Std 802.11-2016, 9.4.2.56
+
+enum ChanWidthSet : uint8 {
+    TWENTY_ONLY = 0;
+    TWENTY_FORTY = 1;
+};
+
+enum SmPowerSave : uint8 {
+    STATIC = 0;
+    DYNAMIC = 1;
+    RESERVED = 2;
+    DISABLED = 3;
+};
+
+enum MaxAmsduLen : uint8 {
+    OCTETS_3839 = 0;
+    OCTETS_7935 = 1;
+};
+
+struct HtCapabilityInfo {
+    bool ldpc_coding_cap;
+    uint8 chan_width_set; // see enum ChanWidthSet
+    uint8 sm_power_save; // see enum SmPowerSave
+    bool greenfield;
+    bool short_gi_20;
+    bool short_gi_40;
+    bool tx_stbc;
+    uint8 rx_stbc;
+    bool delayed_block_ack;
+    uint8 max_amsdu_len; // see enum MaxAmsduLen
+    bool dsss_in_40;
+    bool intolerant_40;
+    bool lsig_txop_protect;
+};
+
+enum MinMpduStartSpacing : uint8 {
+    NO_RESTRICT = 0;
+    QUARTER_USEC = 1;
+    HALF_USEC = 2;
+    ONE_USEC = 3;
+    TWO_USEC = 4;
+    FOUR_USEC = 5;
+    EIGHT_USEC = 6;
+    SIXTEEN_USEC = 7;
+};
+
+struct AmpduParams {
+    uint8 exponent;
+    uint8 min_start_spacing; // see enum MinMpduStartSpacing
+};
+
+// SupportedMcsSet
+// IEEE Std 802.11-2016, 9.4.2.56.4 Table 9-164
+struct SupportedMcsSet {
+    // Names are deviated from //garnet/lib/wlan/common/include/wlan/common/element.h's class SupportedMcsSet
+    uint64 rx_mcs_set; // bitmask indicating MCS 0-63 support
+    // MCS 64-76 not supported
+    uint16 rx_highest_rate; // Mbps
+    bool tx_mcs_set_defined;
+    bool tx_rx_diff;
+    uint8 tx_max_ss; // Actual count, different from IEEE spec
+    bool tx_ueqm; // Transmit Unequal Modulation
+};
+
+// HtExtCapabilities
+// IEEE Std 802.11-2016, 9.4.2.56.5 Table 9-165
+enum PcoTransitionTime : uint8 {
+    PCO_RESERVED = 0;  // Often translated as "No transition".
+    PCO_400_USEC = 1;
+    PCO_1500_USEC = 2;
+    PCO_5000_USEC = 3;
+};
+
+enum McsFeedback : uint8 {
+    MCS_NOFEEDBACK = 0;
+    MCS_RESERVED = 1;
+    MCS_UNSOLICIED = 2;
+    MCS_BOTH = 3;
+};
+
+struct HtExtCapabilities {
+    bool pco;
+    uint8 pco_transition; // see enum PcoTransitionTime
+    uint8 mcs_feedback; // see enum McsFeedback
+    bool htc_ht_support;
+    bool rd_responder;
+};
+
+// TxBfCapability
+// IEEE Std 802.11-2016, 9.4.2.56.6 Table 9-166
+enum Calibration : uint8 {
+    CALIBRATION_NONE = 0;
+    CALIBRATION_RESPOND_NOINITIATE = 1;
+    CALIBRATION_RESERVED = 2;
+    CALIBRATION_RESPOND_INITIATE = 3;
+};
+
+enum Feedback : uint8 {
+    // Shared for csi_feedback, noncomp_feedback, comp_feedback
+    FEEDBACK_NONE = 0;
+    FEEDBACK_DELAYED = 1;
+    FEEDBACK_IMMEDIATE = 2;
+    FEEDBACK_DELAYED_IMMEDIATE = 3;
+};
+
+enum MinGroup : uint8 {
+    MIN_GROUP_ONE = 0;  // Meaning no grouping
+    MIN_GROUP_ONE_TWO = 1;
+    MIN_GROUP_ONE_FOUR = 2;
+    MIN_GROUP_ONE_TWO_FOUR = 3;
+};
+
+struct TxBfCapability {
+    bool implicit_rx;
+    bool rx_stag_sounding;
+    bool tx_stag_sounding;
+    bool rx_ndp;
+    bool tx_ndp;
+    bool implicit;
+    uint8 calibration; // see enum Calibration
+    bool csi; // Explicit CsI Transmit Beamforming
+    bool noncomp_steering; // Explicit Noncompressed Steering
+    bool comp_steering; // Explicit Compressed Steering
+    uint8 csi_feedback; // see enum Feedback
+    uint8 noncomp_feedback; // see enum Feedback
+    uint8 comp_feedback; // see enum Feedback
+    uint8 min_grouping; // see enum MinGroup
+    uint8 csi_antennas;          // Actual count, different from IEEE spec
+    uint8 noncomp_steering_ants; // Actual count, different from IEEE spec
+    uint8 comp_steering_ants;    // Actual count, different from IEEE spec
+    uint8 csi_rows;              // Actual count, different from IEEE spec
+    uint8 chan_estimation;       // Actual count, different from IEEE spec
+};
+
+// IEEE Std 802.11-2016, 9.4.2.56.7 Table 9-167
+struct AselCapability {
+    bool asel;
+    bool csi_feedback_tx_asel; // Explicit CSI Feedback Based Transmit ASEL
+    bool ant_idx_feedback_tx_asel;
+    bool explicit_csi_feedback;
+    bool antenna_idx_feedback;
+    bool rx_asel;
+    bool tx_sounding_ppdu;
+};
+
+struct HtCapabilities {
+    // Note, a minimum granuality of adding fields selectively is
+    // a group of BitField structure, as defined in element.h
+    HtCapabilityInfo ht_cap_info;
+    AmpduParams ampdu_params;
+    SupportedMcsSet mcs_set;
+    HtExtCapabilities ht_ext_cap;
+    TxBfCapability txbf_cap;
+    AselCapability asel_cap;
+};
+
+// HT Operation Element
+// IEEE Std 802.11-2016 9.4.2.57 Table 9-168
+
+// HTOperationInfo
+enum SecChanOffset : uint8 {
+    SECONDARY_NONE = 0;   // No secondary channel
+    SECONDARY_ABOVE = 1;  // Secondary channel is above the primary channel
+    RESERVED = 2;
+    SECONDARY_BELOW = 3;  // Secondary channel is below the primary channel
+};
+
+enum StaChanWidth : uint8 {
+    TWENTY = 0;  // 20 MHz
+    ANY = 1;     // Any in the Supported Channel Width set
+};
+
+enum HtProtect : uint8 {
+    NONE = 0;
+    NONMEMBER = 1;
+    TWENTY_MHZ = 2;
+    NON_HT_MIXED = 3;
+};
+
+struct HTOperationInfo {
+    uint8 secondary_chan_offset; // see enum SecChanOffset
+    uint8 sta_chan_width; // see enum StaChanWidth
+    bool rifs_mode;
+    uint8 ht_protect; // see enum HtProtect
+    bool nongreenfield_present; // Nongreenfield HT STAs present
+    bool obss_non_ht;           // OBSS Non-HT STAs present
+    uint8 center_freq_seg2;    // VHT
+    bool dual_beacon;
+    bool dual_cts_protect;
+    bool stbc_beacon;
+    bool lsig_txop_protect;
+    bool pco_active;
+    bool pco_phase;
+};
+
+struct HtOperation {
+    uint8 primary_chan;                 // Primary 20 MHz channel.
+    HTOperationInfo ht_op_info;
+    SupportedMcsSet basic_mcs_set;
+};
+
+enum MaxMpduLen : uint8 {
+    OCTETS_3895 = 0;
+    OCTETS_7991 = 1;
+    OCTETS_11454 = 2;
+};
+
+enum VhtLinkAdaptation : uint8 {
+    NO_FEEDBACK = 0;
+    // 1 reserved
+    UNSOLICITED = 2;
+    BOTH = 3;
+};
+
+// IEEE Std 802.11-2016, 9.4.2.158.2
+struct VhtCapabilitiesInfo {
+    uint8 max_mpdu_len; // see enum MaxMpduLen
+    uint8 supported_cbw_set;
+    bool rx_ldpc;
+    bool sgi_cbw80;
+    bool sgi_cbw160;
+    bool tx_stbc;
+    uint8 rx_stbc; // number of spatial streams supported. [0, 4] are valid. [5, 7] are reserved.
+    bool su_bfer;
+    bool su_bfee;
+    uint8 bfee_sts; // Maximum number of STS - 1, if su_bfee is true. Reserved otherwise.
+    uint8 num_sounding;
+    bool mu_bfer;
+    bool mu_bfee;
+    bool txop_ps;
+    bool htc_vht;
+    uint8 max_ampdu_exp;
+    uint8 link_adapt; // see enum VhtLinkAdaptation
+    bool rx_ant_pattern;
+    bool tx_ant_pattern;
+    uint8 ext_nss_bw;
+};
+
+enum VhtMcs : uint8 {
+    SET_0_TO_7 = 0;
+    SET_0_TO_8 = 1;
+    SET_0_TO_9 = 2;
+    SET_NONE = 3;
+};
+
+// IEEE Std 802.11-2016 9.4.2.158.3
+struct VhtMcsNss {
+    array<uint8>:8 rx_max_mcs;  // idx 0 for ss1, .. idx 7 for ss8. See enum VhtMcs
+    uint16 rx_max_data_rate;     // Mbps
+    uint8 max_nsts;
+
+    array<uint8>:8 tx_max_mcs; // idx 0 for ss1, .. idx 7 for ss8. See enum VhtMcs
+    uint16 tx_max_data_rate;    // Mbps
+    bool ext_nss_bw;
+};
+
+// IEEE Std 802.11-2016, Figure 9-562
+struct BasicVhtMcsNss {
+    array<uint8>:8 max_mcs; // idx 0 for ss1, .. idx 7 for ss8. See enum VhtMcs
+};
+
+// IEEE Std 802.11-2016 9.5.2.158
+struct VhtCapabilities {
+    VhtCapabilitiesInfo vht_cap_info;
+    VhtMcsNss vht_mcs_nss;
+};
+
+// IEEE Std 802.11-2016 deprecates the use of CBW_160, CBW_80P80
+enum VhtCbw : uint8 {
+    CBW_20_40 = 0;
+    CBW_80_160_80P80 = 1;
+    CBW_160 = 2;
+    CBW_80P80 = 3;
+};
+
+// IEEE Std 802.11-2016 9.5.2.159
+struct VhtOperation {
+    uint8 vht_cbw; // see enum VhtCbw
+    uint8 center_freq_seg0;  // channel number
+    uint8 center_freq_seg1;  // channel number
+    BasicVhtMcsNss basic_mcs;
+};
+
+// IEEE Std 802.11-2016 6.3.3.3.2
+struct BSSDescription {
+    array<uint8>:6 bssid;
+
+    vector<uint8>:32 ssid;
+
+    BSSTypes bss_type;
+    uint16 beacon_period;  // in TU
+    uint8 dtim_period;
+    uint64 timestamp;
+    uint64 local_time;
+
+    CapabilityInfo cap;
+    vector<uint8> basic_rate_set;  // in 0.5 Mbps, valid value: 1-127. See Table 9-78 for 126, 127.
+    vector<uint8> op_rate_set;     // in 0.5 Mbps, valid value: 1-127. See Table 9-78 for 126, 127.
+    vector<uint8>? country;
+
+    // TODO(hahnr): This field represents an IE and should thus be named RSNE.
+    vector<uint8>? rsn;
+
+    int16 rcpi_dbmh; // 0.5 step dBm. Do not use encoding from IEEE Std 802.11-2016 9.4.2.38.
+    int16 rsni_dbh;  // 0.5 step dB.  Do not use encoding from IEEE Std 802.11-2016 9.4.2.41.
+
+    HtCapabilities? ht_cap;
+    HtOperation? ht_op;
+
+    VhtCapabilities? vht_cap;
+    VhtOperation? vht_op;
+
+    // List up non-standard, Fuchsia only parameters
+    WlanChan chan;
+    int8 rssi_dbm;   // dBm
+};
+
+enum ScanResultCodes {
+    SUCCESS = 0;
+    NOT_SUPPORTED = 1;
+    INVALID_ARGS = 2;
+    INTERNAL_ERROR = 3;
+};
+
+struct ScanResult {
+    uint64 txn_id;
+    BSSDescription bss;
+};
+
+struct ScanEnd {
+    uint64 txn_id;
+    ScanResultCodes code;
+};
+
+// MLME-JOIN.request (IEEE Std 802.11-2016, 6.3.4.2)
+
+struct JoinRequest {
+    BSSDescription selected_bss;
+    uint32 join_failure_timeout;
+    uint32 nav_sync_delay;
+    vector<uint16> op_rate_set;
+
+    // Combined with what MLME knows about the device capabilities,
+    // following parameters determine what to be advertised to the peer
+    // (in AssociationRequest). Effectively this way replaces the following
+    // fields originally defined in MLME-JOIN.request
+    // - Capability Information
+    // - HT Capabilities
+    // - VHT Capabilities
+    // - Extended Capabilities
+    PHY phy;
+    CBW cbw;
+};
+
+// MLME-JOIN.confirm (IEEE Std 802.11-2016, 6.3.4.3)
+
+enum JoinResultCodes {
+    SUCCESS = 0;
+    JOIN_FAILURE_TIMEOUT = 1;
+    //LAST = JOIN_FAILURE_TIMEOUT;
+};
+
+struct JoinConfirm {
+    JoinResultCodes result_code;
+};
+
+// MLME-AUTHENTICATE.request (IEEE Std 802.11-2016, 6.3.5.2)
+
+enum AuthenticationTypes {
+    OPEN_SYSTEM = 1;
+    SHARED_KEY = 2;
+    FAST_BSS_TRANSITION = 3;
+    SAE = 4;
+    //LAST = SAE;
+};
+
+struct AuthenticateRequest {
+    array<uint8>:6 peer_sta_address;
+    AuthenticationTypes auth_type;
+    uint32 auth_failure_timeout;
+
+    // etc
+};
+
+// MLME-AUTHENTICATE.confirm (IEEE Std 802.11-2016, 6.3.5.3)
+
+enum AuthenticateResultCodes {
+    SUCCESS = 0;
+    REFUSED = 1;
+    ANTI_CLOGGING_TOKEN_REQUIRED = 2;
+    FINITE_CYCLIC_GROUP_NOT_SUPPORTED = 3;
+    AUTHENTICATION_REJECTED = 4;
+    AUTH_FAILURE_TIMEOUT = 5;
+    //LAST = AUTH_FAILURE_TIMEOUT;
+};
+
+struct AuthenticateConfirm {
+    array<uint8>:6 peer_sta_address;
+    AuthenticationTypes auth_type;
+    AuthenticateResultCodes result_code;
+
+    // etc
+};
+
+// MLME-AUTHENTICATE.indication (IEEE Std 802.11-2016, 6.3.5.4)
+
+struct AuthenticateIndication {
+  array<uint8>:6 peer_sta_address;
+  AuthenticationTypes auth_type;
+
+  // etc
+};
+
+// MLME-AUTHENTICATE.response (IEEE Std 802.11-2016, 6.3.5.5)
+
+struct AuthenticateResponse {
+  array<uint8>:6 peer_sta_address;
+  AuthenticateResultCodes result_code;
+
+  // etc
+};
+
+// MLME-DEAUTHENTICATE.request (IEEE Std 802.11-2016, 6.3.6.2)
+
+// IEEE Std 802.11-2016, 9.4.1.7, Table 9-45
+enum ReasonCode : uint16 {
+    // 0 Reserved
+    UNSPECIFIED_REASON = 1;
+    INVALID_AUTHENTICATION = 2;
+    LEAVING_NETWORK_DEAUTH = 3;
+    REASON_INACTIVITY = 4;
+    NO_MORE_STAS = 5;
+    INVALID_CLASS2_FRAME = 6;
+    INVALID_CLASS3_FRAME = 7;
+    LEAVING_NETWORK_DISASSOC = 8;
+    NOT_AUTHENTICATED = 9;
+    UNACCEPTABLE_POWER_CA = 10;
+    UNACCEPTABLE_SUPPORTED_CHANNELS = 11;
+    BSS_TRANSITION_DISASSOC = 12;
+    REASON_INVALID_ELEMENT = 13;
+    MIC_FAILURE = 14;
+    FOURWAY_HANDSHAKE_TIMEOUT = 15;
+    GK_HANDSHAKE_TIMEOUT = 16;
+    HANDSHAKE_ELEMENT_MISMATCH = 17;
+    REASON_INVALID_GROUP_CIPHER = 18;
+    REASON_INVALID_PAIRWISE_CIPHER = 19;
+    REASON_INVALID_AKMP = 20;
+    UNSUPPORTED_RSNE_VERSION = 21;
+    INVALID_RSNE_CAPABILITIES = 22;
+    IEEE802_1_X_AUTH_FAILED = 23;
+    REASON_CIPHER_OUT_OF_POLICY = 24;
+    TDLS_PEER_UNREACHABLE = 25;
+    TDLS_UNSPECIFIED_REASON = 26;
+    SSP_REQUESTED_DISASSOC = 27;
+    NO_SSP_ROAMING_AGREEMENT = 28;
+    BAD_CIPHER_OR_AKM = 29;
+    NOT_AUTHORIZED_THIS_LOCATION = 30;
+    SERVICE_CHANGE_PRECLUDES_TS = 31;
+    UNSPECIFIED_QOS_REASON = 32;
+    NOT_ENOUGH_BANDWIDTH = 33;
+    MISSING_ACKS = 34;
+    EXCEEDED_TXOP = 35;
+    STA_LEAVING = 36;
+    // Values 37 and 38 are overloaded but should be clear from context.
+    END_TS_BA_DLS = 37;
+    UNKNOWN_TS_BA = 38;
+    TIMEOUT = 39;
+    // 40-44 Reserved
+    PEERKEY_MISMATCH = 45;
+    PEER_INITIATED = 46;
+    AP_INITIATED = 47;
+    REASON_INVALID_FT_ACTION_FRAME_COUNT = 48;
+    REASON_INVALID_PMKID = 49;
+    REASON_INVALID_MDE = 50;
+    REASON_INVALID_FTE = 51;
+    MESH_PEERING_CANCELED = 52;
+    MESH_MAX_PEERS = 53;
+    MESH_CONFIGURATION_POLICY_VIOLATION = 54;
+    MESH_CLOSE_RCVD = 55;
+    MESH_MAX_RETRIES = 56;
+    MESH_CONFIRM_TIMEOUT = 57;
+    MESH_INVALID_GTK = 58;
+    MESH_INCONSISTENT_PARAMETERS = 59;
+    MESH_INVALID_SECURITY_CAPABILITY = 60;
+    MESH_PATH_ERROR_NO_PROXY_INFORMATION = 61;
+    MESH_PATH_ERROR_NO_FORWARDING_INFORMATION = 62;
+    MESH_PATH_ERROR_DESTINATION_UNREACHABLE = 63;
+    MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64;
+    MESH_CHANNEL_SWITCH_REGULATORY_REQUIREMENTS = 65;
+    MESH_CHANNEL_SWITCH_UNSPECIFIED = 66;
+    // 67 - 65535 Reserved
+};
+
+struct DeauthenticateRequest {
+    array <uint8>:6 peer_sta_address;
+    // TODO(tkilbourn): define a ReasonCode enum for FIDL
+    ReasonCode reason_code;
+    // VendorSpecificInfo
+};
+
+// MLME-DEAUTHENTICATE.confirm (IEEE Std 802.11-2016, 6.3.6.3)
+
+struct DeauthenticateConfirm {
+    array <uint8>:6 peer_sta_address;
+};
+
+// MLME-DEAUTHENTICATE.indication (IEEE Std 802.11-2016, 6.3.6.4)
+
+struct DeauthenticateIndication {
+    array<uint8>:6 peer_sta_address;
+    // TODO(tkilbourn): define a ReasonCode enum for FIDL
+    ReasonCode reason_code;
+    // VendorSpecificInfo
+};
+
+// MLME-ASSOCIATE.request (IEEE Std 802.11-2016, 6.3.7.2)
+
+struct AssociateRequest {
+    array<uint8>:6 peer_sta_address;
+    // TODO(hahnr): This field represents an IE and should thus be named RSNE.
+    vector<uint8>? rsn;
+
+    // etc
+};
+
+// MLME-ASSOCIATE.confrm (IEEE Std 802.11-2016, 6.3.7.3)
+
+enum AssociateResultCodes {
+    SUCCESS = 0;
+    REFUSED_REASON_UNSPECIFIED = 1;
+    REFUSED_NOT_AUTHENTICATED = 2;
+    REFUSED_CAPABILITIES_MISMATCH = 3;
+    REFUSED_EXTERNAL_REASON = 4;
+    REFUSED_AP_OUT_OF_MEMORY = 5;
+    REFUSED_BASIC_RATES_MISMATCH = 6;
+    REJECTED_EMERGENCY_SERVICES_NOT_SUPPORTED = 7;
+    REFUSED_TEMPORARILY = 8;
+};
+
+struct AssociateConfirm {
+    AssociateResultCodes result_code;
+    // CapabilityInformation
+    uint16 association_id;
+
+    // etc
+};
+
+// MLME-ASSOCIATE.indication (IEEE Std 802.11-2016, 6.3.7.4)
+
+struct AssociateIndication {
+  array<uint8>:6 peer_sta_address;
+  // CapabilityInformation
+  uint16 listen_interval;
+  vector<uint8>? ssid;
+  // OperationalRateSet
+  // BSSMembershipSelectorSet
+  vector<uint8>? rsn;
+
+  // etc
+};
+
+// MLME-ASSOCIATE.response (IEEE Std 802.11-2016, 6.3.7.5)
+
+struct AssociateResponse {
+  array<uint8>:6 peer_sta_address;
+  AssociateResultCodes result_code;
+  uint16 association_id;
+
+  // etc
+};
+
+// MLME-DISASSOCIATE.request (IEEE Std 802.11-2016, 6.3.9.1)
+
+struct DisassociateRequest {
+    array<uint8>:6 peer_sta_address;
+    // TODO(tkilbourn): define a ReasonCode enum for FIDL
+    uint16 reason_code;
+    // VendorSpecificInfo
+};
+
+// MLME-DISASSOCIATE.confirm (IEEE Std 802.11-2016, 6.3.9.2)
+
+struct DisassociateConfirm {
+    int32 status;
+};
+
+// MLME-DISASSOCIATE.indication (IEEE Std 802.11-2016, 6.3.9.3)
+
+struct DisassociateIndication {
+    array<uint8>:6 peer_sta_address;
+    // TODO(tkilbourn): define a ReasonCode enum for FIDL
+    uint16 reason_code;
+    // VendorSpecificInfo
+};
+
+// MLME-RESET.request (IEEE Std 802.11-2016, 6.3.10.2)
+
+struct ResetRequest {
+    array<uint8>:6 sta_address;
+    bool set_default_mib;
+};
+
+// MLME-START.request (IEEE Std 802.11-2016, 6.3.11.2)
+
+struct StartRequest {
+    vector<uint8>:32 ssid;
+    BSSTypes bss_type;
+    uint16 beacon_period;  // in TU
+    uint8 dtim_period;
+
+    // Temporary field to support AP channel selection until
+    // MLME-CHANNELSWITCH.request is supported.
+    uint8 channel;
+
+    vector<uint8>:32 mesh_id;
+
+    // TODO(hahnr): Add additional elements.
+
+    // Although MLME-START.request is used to start a BSS, IEEE does not include an RSNE in this
+    // primitive. However, IEEE doesn't define any other primitive to configure the RSN after its
+    // BSS was started. The RSNE must be available when the BSS is started, and thus, this is the
+    // right place to transfer the RSNE to the MLME.
+    vector<uint8>? rsne;
+};
+
+// MLME-START.confirm (IEEE Std 802.11-2016, 6.3.11.3)
+
+enum StartResultCodes {
+    SUCCESS = 0;
+    BSS_ALREADY_STARTED_OR_JOINED = 1;
+    RESET_REQUIRED_BEFORE_START = 2;
+    NOT_SUPPORTED = 3;
+    INTERNAL_ERROR = 4;
+};
+
+struct StartConfirm {
+    StartResultCodes result_code;
+};
+
+// MLME-STOP.request (IEEE Std 802.11-2016, 6.3.12.2)
+
+struct StopRequest {
+    vector<uint8>:32 ssid;
+};
+
+// MLME-SETKEYS.request (IEEE Std 802.11-2016 6.3.19.1)
+
+
+enum KeyType {
+    GROUP = 1;
+    PAIRWISE = 2;
+    PEER_KEY = 3;
+    IGTK = 4;
+};
+
+struct SetKeyDescriptor {
+    // Specs specify a bit string, we use byte array.
+    vector<uint8> key;
+    uint16 key_id;
+    KeyType key_type;
+    array<uint8>:6 address;
+    array<uint8>:8 rsc;
+    array<uint8>:3 cipher_suite_oui;
+    uint8 cipher_suite_type;
+};
+
+struct SetKeysRequest {
+    vector<SetKeyDescriptor> keylist;
+};
+
+// MLME-DELETEKEYS.request (IEEE Std 802.11-2016 6.3.20.1)
+
+struct DeleteKeyDescriptor {
+  uint16 key_id;
+  KeyType key_type;
+  array<uint8>:6 address;
+};
+
+struct DeleteKeysRequest {
+  vector<DeleteKeyDescriptor> keylist;
+};
+
+// MLME-EAPOL.request (IEEE Std 802.11-2016 6.3.22.1)
+
+struct EapolRequest {
+    array<uint8>:6 src_addr;
+    array<uint8>:6 dst_addr;
+    vector<uint8> data;
+};
+
+// MLME-EAPOL.confirm (IEEE Std 802.11-2016 6.3.22.2)
+
+enum EapolResultCodes {
+    SUCCESS = 0;
+    TRANSMISSION_FAILURE = 1;
+    //LAST = TRANSMISSION_FAILURE;
+};
+
+struct EapolConfirm {
+    EapolResultCodes result_code;
+};
+
+// IEEE Std 802.11-2016, 9.4.2.98
+struct MeshConfiguration {
+    uint8 active_path_sel_proto_id;
+    uint8 active_path_sel_metric_id;
+    uint8 congest_ctrl_method_id;
+    uint8 sync_method_id;
+    uint8 auth_proto_id;
+    uint8 mesh_formation_info;
+    uint8 mesh_capability;
+};
+
+// Fields that are common between the MPM Open and Confirm actions
+struct MeshPeeringCommon {
+    array<uint8>:6 peer_sta_address;
+    uint16 protocol_id;
+    uint16 local_link_id;
+    vector<uint8>:32 mesh_id;
+    vector<uint8> rates;
+    MeshConfiguration mesh_config;
+    HtCapabilities? ht_cap;
+    HtOperation? ht_op;
+    VhtCapabilities? vht_cap;
+    VhtOperation? vht_op;
+};
+
+// IEEE Std 802.11-2016, 9.6.16.2.2
+struct MeshPeeringOpenAction {
+    MeshPeeringCommon common;
+};
+
+// IEEE Std 802.11-2016, 9.6.16.3.2
+struct MeshPeeringConfirmAction {
+    MeshPeeringCommon common;
+    uint16 aid;
+    uint16 peer_link_id;
+};
+
+// Because these methods rely on an external entity to provide a response, events are used instead
+// of return values.
+interface MLME {
+    // ==== 01xxxx: scanning ====
+    // We deviate from the spec here in order to support incremental scan
+    // results easily. We could stay closer to 802.11ai, but the protocol
+    // that is described there is more difficult to implement correctly.
+
+    // Initiate a scan transaction. The caller is responsible for filling
+    // the `txn_id` field in `req` with a unique number that will be used
+    // to identify the transaction.
+    //
+    // Zero or more `OnScanResult` events with a matching `txn_id` will be sent
+    // in response.
+    //
+    // At the end on the transaction, whether it is successful or not,
+    // a `OnScanEnd` event with a matching `txn_id` is guaranteed to be sent
+    // in response (unless the channel is closed first).
+    //
+    // After `OnScanEnd`, no further events with the same `txn_id` shall be sent.
+    010000: StartScan(ScanRequest req);
+
+    // An incremental scan result containing information about a single BSS.
+    // Only one event per unique BSSID per transaction will be sent.
+    010100: -> OnScanResult(ScanResult result);
+
+    // An event that signals the end of a scan transaction.
+    010200: -> OnScanEnd(ScanEnd end);
+
+    // ====
+
+    3: JoinReq(JoinRequest req);
+    4: -> JoinConf(JoinConfirm resp);
+
+    5: AuthenticateReq(AuthenticateRequest req);
+    6: -> AuthenticateConf(AuthenticateConfirm resp);
+
+    7: -> AuthenticateInd(AuthenticateIndication ind);
+    8: AuthenticateResp(AuthenticateResponse resp);
+
+    9: DeauthenticateReq(DeauthenticateRequest req);
+    10: -> DeauthenticateConf(DeauthenticateConfirm resp);
+
+    11: -> DeauthenticateInd(DeauthenticateIndication ind);
+
+    12: AssociateReq(AssociateRequest req);
+    13: -> AssociateConf(AssociateConfirm resp);
+
+    14: -> AssociateInd(AssociateIndication ind);
+    15: AssociateResp(AssociateResponse resp);
+
+    16: DisassociateReq(DisassociateRequest req);
+    17: -> DisassociateConf(DisassociateConfirm resp);
+
+    18: -> DisassociateInd(DisassociateIndication ind);
+
+    19: ResetReq(ResetRequest req);
+
+    20: StartReq(StartRequest req);
+    21: -> StartConf(StartConfirm resp);
+
+    22: StopReq(StopRequest req);
+    23: -> StopConf();
+
+    24: SetKeysReq(SetKeysRequest req);
+
+    25: DeleteKeysReq(DeleteKeysRequest req);
+
+    26: EapolReq(EapolRequest req);
+    27: -> EapolConf(EapolConfirm resp);
+
+    // ==== 90xxxx: Mesh ===
+    900000: -> IncomingMpOpenAction(MeshPeeringOpenAction action);
+    900100: SendMpOpenAction(MeshPeeringOpenAction action);
+    900300: SendMpConfirmAction(MeshPeeringConfirmAction action);
+
+    // The following are extensions to the 802.11 MLME SAP interface.
+
+    0x1001: -> SignalReport(SignalReportIndication ind);
+
+    0x1002: -> EapolInd(EapolIndication ind);
+
+    0x1003: QueryDeviceInfo() -> (DeviceInfo info);
+
+    0x1005: StatsQueryReq();
+    0x1006: -> StatsQueryResp(StatsQueryResponse resp);
+
+    0x1007: ListMinstrelPeers() -> (MinstrelListResponse resp);
+    0x1008 : GetMinstrelStats(MinstrelStatsRequest req) ->(MinstrelStatsResponse resp);
+};
diff --git a/fidl/fuchsia.wlan.mlme/wlan_mlme_ext.fidl b/fidl/fuchsia.wlan.mlme/wlan_mlme_ext.fidl
new file mode 100644
index 0000000..9dd04dc
--- /dev/null
+++ b/fidl/fuchsia.wlan.mlme/wlan_mlme_ext.fidl
@@ -0,0 +1,73 @@
+// 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.wlan.mlme;
+using fuchsia.wlan.stats;
+using fuchsia.wlan.minstrel;
+
+// Custom primitives for communicating between the wlan service and the MLME drivers.
+// The primitives defined here are not part of the official 802.11 MLME SAP interface specification,
+// but follow the same principle for the sake of consistency.
+
+
+// SIGNAL_REPORT.indication
+
+struct SignalReportIndication {
+    int8 rssi_dbm;
+};
+
+// EAPOL.indication
+
+struct EapolIndication {
+    array<uint8>:6 src_addr;
+    array<uint8>:6 dst_addr;
+    vector<uint8> data;
+};
+
+enum MacRole {
+    CLIENT = 1;
+    AP = 2;
+    MESH = 3;
+};
+
+
+// BandInfo groups capabilities defined per band.
+// This grouping is the industry's de factor standard.
+struct BandCapabilities {
+    Band band_id;
+    vector<uint16> basic_rates;
+    uint16 base_frequency;
+    vector<uint8> channels;
+
+    CapabilityInfo cap;
+    HtCapabilities? ht_cap;
+    VhtCapabilities? vht_cap;
+};
+
+struct DeviceInfo {
+    array<uint8>:6 mac_addr;
+    MacRole role;
+    vector<BandCapabilities> bands;
+};
+
+// STATS_QUERY.response
+
+struct StatsQueryResponse {
+    fuchsia.wlan.stats.IfaceStats stats;
+};
+
+struct MinstrelListResponse {
+    fuchsia.wlan.minstrel.Peers peers;
+};
+
+struct MinstrelStatsRequest {
+    array<uint8>:6 mac_addr;
+};
+
+struct MinstrelStatsResponse {
+    fuchsia.wlan.minstrel.Peer? peer;
+};
+
+// Method ordinals are defined in wlan_mlme.fidl to prevent error prone overlaps with official
+// MLME primitives.
diff --git a/fidl/fuchsia.wlan.service/meta.json b/fidl/fuchsia.wlan.service/meta.json
new file mode 100644
index 0000000..ead12c3
--- /dev/null
+++ b/fidl/fuchsia.wlan.service/meta.json
@@ -0,0 +1,15 @@
+{
+  "deps": [
+    "fuchsia.wlan.mlme", 
+    "fuchsia.wlan.stats"
+  ], 
+  "files": [
+    "fidl/fuchsia.wlan.service/wlan_service.fidl"
+  ], 
+  "name": "fuchsia.wlan.service", 
+  "root": "fidl/fuchsia.wlan.service", 
+  "sources": [
+    "fidl/fuchsia.wlan.service/wlan_service.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.wlan.service/wlan_service.fidl b/fidl/fuchsia.wlan.service/wlan_service.fidl
new file mode 100644
index 0000000..ef2de3b
--- /dev/null
+++ b/fidl/fuchsia.wlan.service/wlan_service.fidl
@@ -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.
+
+library fuchsia.wlan.service;
+
+using fuchsia.wlan.mlme;
+using fuchsia.wlan.stats;
+
+enum ErrCode {
+  OK = 0;
+  INTERNAL = 1;
+  NOT_FOUND = 2;
+  NOT_SUPPORTED = 3;
+  INVALID_ARGS = 4;
+};
+
+struct Error {
+  ErrCode code;
+  string description;
+};
+
+struct AP {
+  vector<uint8> bssid;
+  string       ssid; // TODO(NET-698, NET-1474): Make this as vector<uint8:32>
+  int8         rssi_dbm;
+  bool         is_secure;
+  bool         is_compatible; // with respect to Fuchsia
+  fuchsia.wlan.mlme.WlanChan chan;
+};
+
+struct ScanRequest {
+  uint8 timeout; // seconds
+  // TODO: more parameters here
+};
+
+struct ScanResult {
+  Error error;
+  vector<AP>? aps;
+};
+
+struct ConnectConfig {
+  string ssid;
+  string passPhrase;
+  uint8  scanInterval; // seconds
+  string bssid;
+};
+
+enum State {
+  UNKNOWN = 0;
+  BSS = 1;
+  QUERYING = 2;
+  SCANNING = 3;
+  JOINING = 4;
+  AUTHENTICATING = 5;
+  ASSOCIATING = 6;
+  ASSOCIATED = 7;
+};
+
+struct WlanStatus {
+  Error error;
+  State state;
+  AP? current_ap;
+};
+
+struct BssConfig {
+  string ssid;
+  int32 beaconPeriod;
+  int32 dtimPeriod;
+  uint8 channel;
+};
+
+struct WlanStats {
+  Error error;
+  fuchsia.wlan.stats.IfaceStats stats;
+};
+
+// Stub interface; eventually to be replaced by something based on the 802.11
+// SME / MSGCF.
+[Discoverable]
+interface Wlan {
+  1: Scan(ScanRequest req) -> (ScanResult result);
+  2: Connect(ConnectConfig req) -> (Error error);
+  3: Disconnect() -> (Error error);
+  4: Status() -> (WlanStatus status);
+  5: StartBss(BssConfig cfg) -> (Error error);
+  6: StopBss() -> (Error error);
+  7: Stats() -> (WlanStats stats);
+};
diff --git a/fidl/fuchsia.wlan.stats/meta.json b/fidl/fuchsia.wlan.stats/meta.json
new file mode 100644
index 0000000..26a02ed
--- /dev/null
+++ b/fidl/fuchsia.wlan.stats/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/fuchsia.wlan.stats/wlan_stats.fidl"
+  ], 
+  "name": "fuchsia.wlan.stats", 
+  "root": "fidl/fuchsia.wlan.stats", 
+  "sources": [
+    "fidl/fuchsia.wlan.stats/wlan_stats.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/fidl/fuchsia.wlan.stats/wlan_stats.fidl b/fidl/fuchsia.wlan.stats/wlan_stats.fidl
new file mode 100644
index 0000000..0f35b83
--- /dev/null
+++ b/fidl/fuchsia.wlan.stats/wlan_stats.fidl
@@ -0,0 +1,63 @@
+// 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.wlan.stats;
+
+struct Counter {
+  uint64 count;
+  string name;
+};
+
+struct PacketCounter {
+  Counter in;
+  Counter out;
+  Counter drop;
+  Counter in_bytes;
+  Counter out_bytes;
+  Counter drop_bytes;
+};
+
+// LINT.IfChange
+struct DispatcherStats {
+  PacketCounter any_packet;
+  PacketCounter mgmt_frame;
+  PacketCounter ctrl_frame;
+  PacketCounter data_frame;
+};
+
+const uint8 RSSI_BINS = 129;
+
+// RssiStats count the occurrence of the RSSIs.
+// RSSI value r's occurrence is counted in the bin[-r],
+// where r is defined in [-128, 0] in dBm.
+struct RssiStats {
+  // TODO(alexandrew): Change this to array.
+  vector<uint64>:RSSI_BINS hist;
+};
+
+struct ClientMlmeStats {
+  PacketCounter svc_msg;
+  PacketCounter data_frame;
+  PacketCounter mgmt_frame;
+  PacketCounter tx_frame;
+  PacketCounter rx_frame;
+  RssiStats assoc_data_rssi;
+  RssiStats beacon_rssi;
+};
+
+struct ApMlmeStats {
+  PacketCounter not_used;
+};
+
+// LINT.ThenChange(//garnet/lib/wlan/common/include/wlan/common/stats.h)
+
+union MlmeStats {
+  ClientMlmeStats client_mlme_stats;
+  ApMlmeStats ap_mlme_stats;
+};
+
+struct IfaceStats {
+    DispatcherStats dispatcher_stats;
+    MlmeStats? mlme_stats;
+};
diff --git a/fidl/zircon.ethernet/ethernet.fidl b/fidl/zircon.ethernet/ethernet.fidl
new file mode 100644
index 0000000..79945e3
--- /dev/null
+++ b/fidl/zircon.ethernet/ethernet.fidl
@@ -0,0 +1,141 @@
+// 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 zircon.ethernet;
+
+using zx;
+
+struct MacAddress {
+    array<uint8>:6 octets;
+};
+
+const uint32 DEFAULT_BUFFER_SIZE = 2048; // bytes
+/// When writing payload to a tx buffer, clients of a Device must skip this many bytes
+/// so that lower-layer drivers can fill in additional headers in that space.
+const uint32 MAC_HDR_MAX_SIZE    = 64;   // bytes, the closest power of 2 larger than 44, which is
+                                         // DataFrameHeader::max_size(36) + LlcHeader::max_size(8)
+
+// 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;
+
+// zircon/device/ethernet.h
+[Layout = "Simple"]
+interface Device {
+    // Obtain information about device
+    1: GetInfo() -> (Info info);
+
+    // Obtain a pair of fifos for queueing tx and rx operations
+    2: GetFifos() -> (zx.status status, Fifos? info);
+
+    // Set the IO Buffer that will provide the data buffers for tx and rx operations
+    3: 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.
+    4: Start() -> (zx.status status);
+
+    // Stop transferring packets
+    5: Stop() -> ();
+
+    // Start listening to the packets that we're transmitting
+    // as well as the packets we're receiving.
+    6: ListenStart() -> (zx.status status);
+
+    // Stop listening to the packets that we're transmitting.
+    7: ListenStop() -> ();
+
+    8: 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.
+    9: GetStatus() -> (uint32 device_status);
+
+    10: SetPromiscuousMode(bool enabled) -> (zx.status status);
+
+    11: ConfigMulticastAddMac(MacAddress addr) -> (zx.status status);
+    12: ConfigMulticastDeleteMac(MacAddress addr) -> (zx.status status);
+    13: ConfigMulticastSetPromiscuousMode(bool enabled) -> (zx.status status);
+
+    // TODO(teisenbe): We should probably remove these?  They are only used for testing.
+    14: ConfigMulticastTestFilter() -> (zx.status status);
+    15: DumpRegisters() -> (zx.status status);
+};
+
+// Operation
+//
+// Packets are transmitted by writing data into the io_vmo and writing
+// an 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 vmo.  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().
+
+// flags values for request messages
+// - none -
+
+// flags values for response messages
+const uint16 FIFO_RX_OK   = 0x00000001; // packet received okay
+const uint16 FIFO_TX_OK   = 0x00000001; // packet transmitted okay
+const uint16 FIFO_INVALID = 0x00000002; // offset+length not within io_vmo bounds
+const uint16 FIFO_RX_TX   = 0x00000004; // received our own tx packet (when Listen enabled)
+
+struct FifoEntry {
+    // offset from start of io vmo to packet data
+    uint32 offset;
+
+    // length of packet data to tx or rx
+    uint16 length;
+
+    // FIFO_* flags as above
+    uint16 flags;
+
+    // opaque cookie
+    uint64 cookie;
+};
diff --git a/fidl/zircon.ethernet/meta.json b/fidl/zircon.ethernet/meta.json
new file mode 100644
index 0000000..fe257e4
--- /dev/null
+++ b/fidl/zircon.ethernet/meta.json
@@ -0,0 +1,12 @@
+{
+  "deps": [], 
+  "files": [
+    "fidl/zircon.ethernet/ethernet.fidl"
+  ], 
+  "name": "zircon.ethernet", 
+  "root": "fidl/zircon.ethernet", 
+  "sources": [
+    "fidl/zircon.ethernet/ethernet.fidl"
+  ], 
+  "type": "fidl_library"
+}
\ No newline at end of file
diff --git a/hash b/hash
new file mode 100644
index 0000000..2cc223f
--- /dev/null
+++ b/hash
@@ -0,0 +1 @@
+0e1216b2c3a4a5b141036ebb1800fc9c1202c1ab
\ No newline at end of file
diff --git a/images/fuchsia.zbi-meta.json b/images/fuchsia.zbi-meta.json
new file mode 100644
index 0000000..28465a1
--- /dev/null
+++ b/images/fuchsia.zbi-meta.json
@@ -0,0 +1,9 @@
+{
+  "file": {
+    "arm64": "target/arm64/fuchsia.zbi", 
+    "x64": "target/x64/fuchsia.zbi"
+  }, 
+  "name": "fuchsia.zbi", 
+  "root": "images", 
+  "type": "image"
+}
\ No newline at end of file
diff --git a/images/fvm.blk-meta.json b/images/fvm.blk-meta.json
new file mode 100644
index 0000000..fe7dacc
--- /dev/null
+++ b/images/fvm.blk-meta.json
@@ -0,0 +1,9 @@
+{
+  "file": {
+    "arm64": "target/arm64/fvm.blk", 
+    "x64": "target/x64/fvm.blk"
+  }, 
+  "name": "fvm.blk", 
+  "root": "images", 
+  "type": "image"
+}
\ No newline at end of file
diff --git a/images/fvm.sparse.blk-meta.json b/images/fvm.sparse.blk-meta.json
new file mode 100644
index 0000000..077397c
--- /dev/null
+++ b/images/fvm.sparse.blk-meta.json
@@ -0,0 +1,9 @@
+{
+  "file": {
+    "arm64": "target/arm64/fvm.sparse.blk", 
+    "x64": "target/x64/fvm.sparse.blk"
+  }, 
+  "name": "fvm.sparse.blk", 
+  "root": "images", 
+  "type": "image"
+}
\ No newline at end of file
diff --git a/images/local.esp.blk-meta.json b/images/local.esp.blk-meta.json
new file mode 100644
index 0000000..b7644c1
--- /dev/null
+++ b/images/local.esp.blk-meta.json
@@ -0,0 +1,8 @@
+{
+  "file": {
+    "x64": "target/x64/local.esp.blk"
+  },
+  "name": "local.esp.blk",
+  "root": "images",
+  "type": "image"
+}
\ No newline at end of file
diff --git a/images/qemu-kernel.bin-meta.json b/images/qemu-kernel.bin-meta.json
new file mode 100644
index 0000000..a67b5c2
--- /dev/null
+++ b/images/qemu-kernel.bin-meta.json
@@ -0,0 +1,9 @@
+{
+  "file": {
+    "arm64": "target/arm64/qemu-kernel.bin", 
+    "x64": "target/x64/qemu-kernel.bin"
+  }, 
+  "name": "qemu-kernel.bin", 
+  "root": "images", 
+  "type": "image"
+}
\ No newline at end of file
diff --git a/images/zircon.vboot-meta.json b/images/zircon.vboot-meta.json
new file mode 100644
index 0000000..bfdf16c
--- /dev/null
+++ b/images/zircon.vboot-meta.json
@@ -0,0 +1,9 @@
+{
+  "file": {
+    "arm64": "target/arm64/zircon.vboot", 
+    "x64": "target/x64/zircon.vboot"
+  }, 
+  "name": "zircon.vboot", 
+  "root": "images", 
+  "type": "image"
+}
\ No newline at end of file
diff --git a/meta/manifest.json b/meta/manifest.json
new file mode 100644
index 0000000..c65aeeb
--- /dev/null
+++ b/meta/manifest.json
@@ -0,0 +1,92 @@
+{
+  "arch": {
+    "host": "x86_64-linux-gnu", 
+    "target": [
+      "arm64", 
+      "x64"
+    ]
+  }, 
+  "parts": [
+    "docs/low_level.json", 
+    "docs/metadata_schemas.json", 
+    "fidl/fuchsia.bluetooth.gatt/meta.json", 
+    "fidl/fuchsia.bluetooth.le/meta.json", 
+    "fidl/fuchsia.bluetooth/meta.json", 
+    "fidl/fuchsia.developer.tiles/meta.json", 
+    "fidl/fuchsia.fonts/meta.json", 
+    "fidl/fuchsia.images/meta.json", 
+    "fidl/fuchsia.io/meta.json", 
+    "fidl/fuchsia.ldsvc/meta.json", 
+    "fidl/fuchsia.logger/meta.json", 
+    "fidl/fuchsia.math/meta.json", 
+    "fidl/fuchsia.media/meta.json", 
+    "fidl/fuchsia.mediacodec/meta.json", 
+    "fidl/fuchsia.mem/meta.json", 
+    "fidl/fuchsia.net.http/meta.json", 
+    "fidl/fuchsia.net.oldhttp/meta.json", 
+    "fidl/fuchsia.net/meta.json", 
+    "fidl/fuchsia.netstack/meta.json", 
+    "fidl/fuchsia.process/meta.json", 
+    "fidl/fuchsia.simplecamera/meta.json", 
+    "fidl/fuchsia.sys/meta.json", 
+    "fidl/fuchsia.sysinfo/meta.json", 
+    "fidl/fuchsia.ui.app/meta.json", 
+    "fidl/fuchsia.ui.gfx/meta.json", 
+    "fidl/fuchsia.ui.input/meta.json", 
+    "fidl/fuchsia.ui.policy/meta.json", 
+    "fidl/fuchsia.ui.scenic/meta.json", 
+    "fidl/fuchsia.ui.vectorial/meta.json", 
+    "fidl/fuchsia.ui.views/meta.json", 
+    "fidl/fuchsia.ui.viewsv1/meta.json", 
+    "fidl/fuchsia.ui.viewsv1token/meta.json", 
+    "fidl/fuchsia.wlan.minstrel/meta.json", 
+    "fidl/fuchsia.wlan.mlme/meta.json", 
+    "fidl/fuchsia.wlan.service/meta.json", 
+    "fidl/fuchsia.wlan.stats/meta.json", 
+    "fidl/zircon.ethernet/meta.json", 
+    "images/fuchsia.zbi-meta.json", 
+    "images/fvm.blk-meta.json", 
+    "images/fvm.sparse.blk-meta.json", 
+    "images/local.esp.blk-meta.json", 
+    "images/qemu-kernel.bin-meta.json", 
+    "images/zircon.vboot-meta.json", 
+    "pkg/async-default/meta.json", 
+    "pkg/async-loop-cpp/meta.json", 
+    "pkg/async-loop/meta.json", 
+    "pkg/async/meta.json", 
+    "pkg/fdio/meta.json", 
+    "pkg/fidl-async/meta.json", 
+    "pkg/fidl/meta.json", 
+    "pkg/fidl_cpp/meta.json", 
+    "pkg/fidl_cpp_base/meta.json", 
+    "pkg/fidl_cpp_sync/meta.json", 
+    "pkg/fit/meta.json", 
+    "pkg/images_cpp/meta.json", 
+    "pkg/memfs/meta.json", 
+    "pkg/scenic_cpp/meta.json", 
+    "pkg/svc/meta.json", 
+    "pkg/sync/meta.json", 
+    "pkg/syslog/meta.json", 
+    "pkg/sysroot/meta.json", 
+    "pkg/trace-engine/meta.json", 
+    "pkg/vulkan/meta.json", 
+    "pkg/vulkan_layers/meta.json", 
+    "pkg/zx/meta.json", 
+    "tools/bootserver-meta.json", 
+    "tools/far-meta.json", 
+    "tools/fidl-format-meta.json", 
+    "tools/fidlc-meta.json", 
+    "tools/fidlgen-meta.json", 
+    "tools/fvm-meta.json", 
+    "tools/loglistener-meta.json", 
+    "tools/merkleroot-meta.json", 
+    "tools/minfs-meta.json", 
+    "tools/netaddr-meta.json", 
+    "tools/netcp-meta.json", 
+    "tools/netls-meta.json", 
+    "tools/netruncmd-meta.json", 
+    "tools/pm-meta.json", 
+    "tools/zbi-meta.json", 
+    "tools/zxdb-meta.json"
+  ]
+}
\ No newline at end of file
diff --git a/meta/schemas/cc_prebuilt_library.json b/meta/schemas/cc_prebuilt_library.json
new file mode 100644
index 0000000..0a9c83b
--- /dev/null
+++ b/meta/schemas/cc_prebuilt_library.json
@@ -0,0 +1,98 @@
+{
+  "description": "A prebuilt C/C++ library",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "cc_prebuilt_library"
+          ]
+        },
+        "name": {
+          "description": "Name of the library",
+          "$ref": "common.json#/definitions/cc_library_name"
+        },
+        "format": {
+          "description": "The distribution format of the binaries",
+          "type": "string",
+          "enum": [
+            "shared",
+            "static"
+          ]
+        },
+        "headers": {
+          "description": "List of public headers",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "include_dir": {
+          "description": "Path to the base directory for includes",
+          "$ref": "common.json#/definitions/file"
+        },
+        "deps": {
+          "description": "List of C/C++ libraries this library depends on",
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/package_name"
+          }
+        },
+        "binaries": {
+          "description": "The binary files for the library, per architecture",
+          "type": "object",
+          "properties": {
+            "x64": {
+              "description": "Binaries for the x64 architecture",
+              "$ref": "#/definitions/binaryGroup"
+            },
+            "arm64": {
+              "description": "Binaries for the arm64 architecture",
+              "$ref": "#/definitions/binaryGroup"
+            }
+          },
+          "additionalProperties": false,
+          "minProperties": 1,
+          "maxProperties": 2
+        }
+      },
+      "required": [
+        "binaries",
+        "deps",
+        "format",
+        "headers",
+        "name",
+        "type"
+      ]
+    }
+  ],
+  "definitions": {
+    "binaryGroup": {
+      "description": "A set of binary files compiled for a given architecture",
+      "type": "object",
+      "properties": {
+        "link": {
+          "description": "The link-time version of the library",
+          "$ref": "common.json#/definitions/file"
+        },
+        "dist": {
+          "description": "The version of the library to add to Fuchsia packages",
+          "$ref": "common.json#/definitions/file"
+        },
+        "debug": {
+          "description": "The unstripped version of the library",
+          "$ref": "common.json#/definitions/file"
+        }
+      },
+      "required": [
+        "link"
+      ]
+    }
+  }
+}
diff --git a/meta/schemas/cc_source_library.json b/meta/schemas/cc_source_library.json
new file mode 100644
index 0000000..34733d3
--- /dev/null
+++ b/meta/schemas/cc_source_library.json
@@ -0,0 +1,65 @@
+{
+  "description": "A set of C/C++ sources",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "cc_source_library"
+          ]
+        },
+        "name": {
+          "description": "Name of the library",
+          "$ref": "common.json#/definitions/cc_library_name"
+        },
+        "sources": {
+          "description": "List of library sources",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "headers": {
+          "description": "List of public headers",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "include_dir": {
+          "description": "Path to the base directory for includes",
+          "$ref": "common.json#/definitions/file"
+        },
+        "deps": {
+          "description": "List of C/C++ libraries this library depends on",
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/package_name"
+          }
+        },
+        "fidl_deps": {
+          "description": "List of FIDL libraries this library depends on",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/fidl_library_name"
+          }
+        }
+      },
+      "required": [
+        "deps",
+        "fidl_deps",
+        "headers",
+        "include_dir",
+        "name",
+        "sources",
+        "type"
+      ]
+    }
+  ]
+}
diff --git a/meta/schemas/common.json b/meta/schemas/common.json
new file mode 100644
index 0000000..a17c6a5
--- /dev/null
+++ b/meta/schemas/common.json
@@ -0,0 +1,58 @@
+{
+  "definitions": {
+    "file": {
+      "description": "Path to a file from the root of the SDK",
+      "type": "string"
+    },
+    "sdk_element": {
+      "description": "Base type for SDK elements",
+      "type": "object",
+      "properties": {
+        "type": {
+          "description": "The type of the element",
+          "type": "string"
+        },
+        "name": {
+          "description": "The name of the element",
+          "type": "string"
+        },
+        "root": {
+          "description": "The root of the element in the SDK",
+          "type": "string"
+        },
+        "files": {
+          "description": "The list of files pertaining to the element",
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/file"
+          }
+        }
+      },
+      "required": [
+        "name",
+        "root",
+        "type"
+      ]
+    },
+    "banjo_library_name": {
+      "description": "Name of a BANJO library",
+      "type": "string"
+    },
+    "fidl_library_name": {
+      "description": "Name of a FIDL library",
+      "type": "string"
+    },
+    "cc_library_name": {
+      "description": "Name of a C/C++ library",
+      "type": "string"
+    },
+    "target_arch": {
+      "description": "Target architecture",
+      "type": "string",
+      "enum": [
+        "arm64",
+        "x64"
+      ]
+    }
+  }
+}
diff --git a/meta/schemas/dart_library.json b/meta/schemas/dart_library.json
new file mode 100644
index 0000000..3d90f91
--- /dev/null
+++ b/meta/schemas/dart_library.json
@@ -0,0 +1,84 @@
+{
+  "description": "A Dart library",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "dart_library"
+          ]
+        },
+        "name": {
+          "description": "Name of the library",
+          "$ref": "#/definitions/package_name"
+        },
+        "sources": {
+          "description": "List of library sources",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "deps": {
+          "description": "List of Dart libraries this library depends on",
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/package_name"
+          }
+        },
+        "third_party_deps": {
+          "description": "List of third-party dependencies",
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/third_party_library"
+          }
+        },
+        "fidl_deps": {
+          "description": "List of FIDL libraries this library depends on",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/fidl_library_name"
+          }
+        }
+      },
+      "required": [
+        "deps",
+        "fidl_deps",
+        "name",
+        "sources",
+        "third_party_deps",
+        "type"
+      ]
+    }
+  ],
+  "definitions": {
+    "package_name": {
+      "description": "A Dart package name",
+      "type": "string"
+    },
+    "third_party_library": {
+      "description": "A third-party Dart package",
+      "type": "object",
+      "properties": {
+        "name": {
+          "description": "Name of the package",
+          "$ref": "#/definitions/package_name"
+        },
+        "version": {
+          "description": "Version number of the package",
+          "type": "string"
+        }
+      },
+      "required": [
+        "name",
+        "version"
+      ]
+    }
+  }
+}
diff --git a/meta/schemas/documentation.json b/meta/schemas/documentation.json
new file mode 100644
index 0000000..3362acf
--- /dev/null
+++ b/meta/schemas/documentation.json
@@ -0,0 +1,31 @@
+{
+  "description": "A set of documents",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "documentation"
+          ]
+        },
+        "docs": {
+          "description": "The list of documents pertaining to the set",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        }
+      },
+      "required": [
+        "type",
+        "docs"
+      ]
+    }
+  ]
+}
diff --git a/meta/schemas/fidl_library.json b/meta/schemas/fidl_library.json
new file mode 100644
index 0000000..abc8291
--- /dev/null
+++ b/meta/schemas/fidl_library.json
@@ -0,0 +1,36 @@
+{
+  "description": "A FIDL library",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "fidl_library"
+          ]
+        },
+        "name": {
+          "description": "Name of the library",
+          "$ref": "common.json#/definitions/fidl_library_name"
+        },
+        "sources": {
+          "description": "List of library sources",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        }
+      },
+      "required": [
+        "name",
+        "sources",
+        "type"
+      ]
+    }
+  ]
+}
diff --git a/meta/schemas/host_tool.json b/meta/schemas/host_tool.json
new file mode 100644
index 0000000..a6d11fe
--- /dev/null
+++ b/meta/schemas/host_tool.json
@@ -0,0 +1,31 @@
+{
+  "description": "A host tool",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "host_tool"
+          ]
+        },
+        "files": {
+          "description": "The list of files pertaining to the element",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        }
+      },
+      "required": [
+        "type",
+        "files"
+      ]
+    }
+  ]
+}
diff --git a/meta/schemas/image.json b/meta/schemas/image.json
new file mode 100644
index 0000000..f9fd1b0
--- /dev/null
+++ b/meta/schemas/image.json
@@ -0,0 +1,41 @@
+{
+  "description": "A target image",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "image"
+          ]
+        },
+        "file": {
+          "description": "The image, per architecture",
+          "type": "object",
+          "properties": {
+            "x64": {
+              "description": "File for the x64 architecture",
+              "$ref": "common.json#/definitions/file"
+            },
+            "arm64": {
+              "description": "File for the arm64 architecture",
+              "$ref": "common.json#/definitions/file"
+            }
+          },
+          "additionalProperties": false,
+          "minProperties": 1,
+          "maxProperties": 2
+        }
+      },
+      "required": [
+        "type",
+        "file"
+      ]
+    }
+  ]
+}
diff --git a/meta/schemas/loadable_module.json b/meta/schemas/loadable_module.json
new file mode 100644
index 0000000..ae7361d
--- /dev/null
+++ b/meta/schemas/loadable_module.json
@@ -0,0 +1,63 @@
+{
+  "description": "A collection of object files that can be loaded at runtime",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "loadable_module"
+          ]
+        },
+        "name": {
+          "description": "Name of the module",
+          "type": "string"
+        },
+        "resources": {
+          "description": "Resource files associated with the module",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "binaries": {
+          "description": "The binary files for the module, per architecture",
+          "type": "object",
+          "properties": {
+            "x64": {
+              "description": "Binaries for the x64 architecture",
+              "$ref": "#/definitions/binaryGroup"
+            },
+            "arm64": {
+              "description": "Binaries for the arm64 architecture",
+              "$ref": "#/definitions/binaryGroup"
+            }
+          },
+          "additionalProperties": false,
+          "minProperties": 1,
+          "maxProperties": 2
+        }
+      },
+      "required": [
+        "binaries",
+        "name",
+        "resources",
+        "type"
+      ]
+    }
+  ],
+  "definitions": {
+    "binaryGroup": {
+      "description": "A set of binary files compiled for a given architecture",
+      "type": "array",
+      "items": {
+        "$ref": "common.json#/definitions/file"
+      }
+    }
+  }
+}
diff --git a/meta/schemas/manifest.json b/meta/schemas/manifest.json
new file mode 100644
index 0000000..bac0c4a
--- /dev/null
+++ b/meta/schemas/manifest.json
@@ -0,0 +1,40 @@
+{
+  "description": "A target image",
+  "type": "object",
+  "properties": {
+    "arch": {
+      "description": "The various architectures encountered in the SDK",
+      "type": "object",
+      "properties": {
+        "host": {
+          "description": "The host architecture",
+          "type": "string"
+        },
+        "target": {
+          "description": "The target architectures",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/target_arch"
+          }
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "host",
+        "target"
+      ]
+    },
+    "parts": {
+      "description": "The metadata files for elements in the SDK",
+      "type": "array",
+      "items": {
+        "$ref": "common.json#/definitions/file"
+      }
+    }
+  },
+  "additionalProperties": false,
+  "required": [
+    "arch",
+    "parts"
+  ]
+}
diff --git a/meta/schemas/sysroot.json b/meta/schemas/sysroot.json
new file mode 100644
index 0000000..e7e2bc6
--- /dev/null
+++ b/meta/schemas/sysroot.json
@@ -0,0 +1,101 @@
+{
+  "description": "The sysroot",
+  "type": "object",
+  "allOf": [
+    {
+      "$ref": "common.json#/definitions/sdk_element"
+    },
+    {
+      "properties": {
+        "type": {
+          "description": "Marker for this type of element",
+          "type": "string",
+          "enum": [
+            "sysroot"
+          ]
+        },
+        "name": {
+          "description": "Always 'sysroot'",
+          "type": "string",
+          "enum": [
+            "sysroot"
+          ]
+        },
+        "versions": {
+          "description": "The various versions of the sysroot, per architecture",
+          "type": "object",
+          "properties": {
+            "x64": {
+              "description": "x64 version",
+              "$ref": "#/definitions/version"
+            },
+            "arm64": {
+              "description": "arm64 version",
+              "$ref": "#/definitions/version"
+            }
+          },
+          "additionalProperties": false,
+          "minProperties": 1,
+          "maxProperties": 2
+        }
+      },
+      "required": [
+        "name",
+        "type",
+        "versions"
+      ]
+    }
+  ],
+  "definitions": {
+    "version": {
+      "description": "Sysroot files for a given architecture",
+      "type": "object",
+      "properties": {
+        "root": {
+          "description": "Path to the root of the sysroot",
+          "$ref": "common.json#/definitions/file"
+        },
+        "headers": {
+          "description": "List of public headers",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "include_dir": {
+          "description": "Path to the base directory for includes",
+          "$ref": "common.json#/definitions/file"
+        },
+        "link_libs": {
+          "description": "List of link-time libraries",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "dist_libs": {
+          "description": "List of libraries for inclusion in packages",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        },
+        "debug_libs": {
+          "description": "List of libraries for debugging",
+          "type": "array",
+          "items": {
+            "$ref": "common.json#/definitions/file"
+          }
+        }
+      },
+      "required": [
+        "root",
+        "headers",
+        "include_dir",
+        "link_libs",
+        "dist_libs",
+        "debug_libs"
+      ]
+    }
+  }
+}
diff --git a/pkg/async-default/include/lib/async/default.h b/pkg/async-default/include/lib/async/default.h
new file mode 100644
index 0000000..b171058
--- /dev/null
+++ b/pkg/async-default/include/lib/async/default.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 LIB_ASYNC_DEFAULT_H_
+#define LIB_ASYNC_DEFAULT_H_
+
+#include <lib/async/dispatcher.h>
+#include <zircon/compiler.h>
+
+__BEGIN_CDECLS
+
+// Gets the current thread's default asynchronous dispatcher interface.
+// Returns |NULL| if none.
+__EXPORT async_dispatcher_t* async_get_default_dispatcher(void);
+
+// Sets the current thread's default asynchronous dispatcher interface.
+// May be set to |NULL| if this thread doesn't have a default dispatcher.
+__EXPORT void async_set_default_dispatcher(async_dispatcher_t* dispatcher);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_DEFAULT_H_
diff --git a/pkg/async-default/meta.json b/pkg/async-default/meta.json
new file mode 100644
index 0000000..2394825
--- /dev/null
+++ b/pkg/async-default/meta.json
@@ -0,0 +1,23 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/48/624ebaefd10ab212943f16760a00f469ec307e.debug", 
+      "dist": "arch/arm64/dist/libasync-default.so", 
+      "link": "arch/arm64/lib/libasync-default.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/5e/3c55aea09e8943ae76d3603cc8c0b1ba27bfb7.debug", 
+      "dist": "arch/x64/dist/libasync-default.so", 
+      "link": "arch/x64/lib/libasync-default.so"
+    }
+  }, 
+  "deps": [], 
+  "format": "shared", 
+  "headers": [
+    "pkg/async-default/include/lib/async/default.h"
+  ], 
+  "include_dir": "pkg/async-default/include", 
+  "name": "async-default", 
+  "root": "pkg/async-default", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/async-loop-cpp/include/lib/async-loop/cpp/loop.h b/pkg/async-loop-cpp/include/lib/async-loop/cpp/loop.h
new file mode 100644
index 0000000..6168aba
--- /dev/null
+++ b/pkg/async-loop-cpp/include/lib/async-loop/cpp/loop.h
@@ -0,0 +1,121 @@
+// 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.
+
+#pragma once
+
+#include <lib/async-loop/loop.h>
+#include <lib/async/default.h>
+#include <lib/zx/time.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <threads.h>
+#include <zircon/compiler.h>
+
+namespace async {
+
+// C++ wrapper for an asynchronous dispatch loop.
+//
+// This class is thread-safe.
+class Loop {
+public:
+    // Creates a message loop.
+    // All operations on the message loop are thread-safe (except destroy).
+    //
+    // Note that it's ok to run the loop on a different thread from the one
+    // upon which it was created.
+    //
+    // |config| provides configuration for the message loop.  Must not be null.
+    //
+    // See also |kAsyncLoopConfigAttachToThread| and |kAsyncLoopConfigNoAttachToThread|.
+    explicit Loop(const async_loop_config_t* config);
+
+    Loop(const Loop&) = delete;
+    Loop(Loop&&) = delete;
+    Loop& operator=(const Loop&) = delete;
+    Loop& operator=(Loop&&) = delete;
+
+    // Destroys the message loop.
+    // Implicitly calls |Shutdown()|.
+    ~Loop();
+
+    // Gets the underlying message loop structure.
+    async_loop_t* loop() const { return loop_; }
+
+    // Gets the loop's asynchronous dispatch interface.
+    async_dispatcher_t* dispatcher() const { return async_loop_get_dispatcher(loop_); }
+
+    // Shuts down the message loop, notifies handlers which asked to handle shutdown.
+    // The message loop must not currently be running on any threads other than
+    // those started by |StartThread()| which this function will join.
+    //
+    // Does nothing if already shutting down.
+    void Shutdown();
+
+    // Runs the message loop on the current thread.
+    // This function can be called on multiple threads to setup a multi-threaded
+    // dispatcher.
+    //
+    // Dispatches events until the |deadline| expires or the loop is quitted.
+    // Use |ZX_TIME_INFINITE| to dispatch events indefinitely.
+    //
+    // If |once| is true, performs a single unit of work then returns.
+    //
+    // Returns |ZX_OK| if the dispatcher returns after one cycle.
+    // Returns |ZX_ERR_TIMED_OUT| if the deadline expired.
+    // Returns |ZX_ERR_CANCELED| if the loop quitted.
+    // Returns |ZX_ERR_BAD_STATE| if the loop was shut down with |Shutdown()|.
+    zx_status_t Run(zx::time deadline = zx::time::infinite(), bool once = false);
+
+    // Dispatches events until there are none remaining, and then returns
+    // without waiting. This is useful for unit testing, because the behavior
+    // doesn't depend on time.
+    //
+    // Returns |ZX_OK| if the dispatcher reaches an idle state.
+    // Returns |ZX_ERR_CANCELED| if the loop quitted.
+    // Returns |ZX_ERR_BAD_STATE| if the loop was shut down with |Shutdown()|.
+    zx_status_t RunUntilIdle();
+
+    // Quits the message loop.
+    // Active invocations of |Run()| and threads started using |StartThread()|
+    // will eventually terminate upon completion of their current unit of work.
+    //
+    // Subsequent calls to |Run()| or |StartThread()| will return immediately
+    // until |ResetQuit()| is called.
+    void Quit();
+
+    // Resets the quit state of the message loop so that it can be restarted
+    // using |Run()| or |StartThread()|.
+    //
+    // This function must only be called when the message loop is not running.
+    // The caller must ensure all active invocations of |Run()| and threads
+    // started using |StartThread()| have terminated before resetting the quit state.
+    //
+    // Returns |ZX_OK| if the loop's state was |ASYNC_LOOP_RUNNABLE| or |ASYNC_LOOP_QUIT|.
+    // Returns |ZX_ERR_BAD_STATE| if the loop's state was |ASYNC_LOOP_SHUTDOWN| or if
+    // the message loop is currently active on one or more threads.
+    zx_status_t ResetQuit();
+
+    // Returns the current state of the message loop.
+    async_loop_state_t GetState() const;
+
+    // Starts a message loop running on a new thread.
+    // The thread will run until the loop quits.
+    //
+    // |name| is the desired name for the new thread, may be NULL.
+    // If |out_thread| is not NULL, it is set to the new thread identifier.
+    //
+    // Returns |ZX_OK| on success.
+    // Returns |ZX_ERR_BAD_STATE| if the loop was shut down with |async_loop_shutdown()|.
+    // Returns |ZX_ERR_NO_MEMORY| if allocation or thread creation failed.
+    zx_status_t StartThread(const char* name = nullptr, thrd_t* out_thread = nullptr);
+
+    // Blocks until all dispatch threads started with |StartThread()|
+    // have terminated.
+    void JoinThreads();
+
+private:
+    async_loop_t* loop_;
+};
+
+} // namespace async
diff --git a/pkg/async-loop-cpp/loop_wrapper.cpp b/pkg/async-loop-cpp/loop_wrapper.cpp
new file mode 100644
index 0000000..cc866ec
--- /dev/null
+++ b/pkg/async-loop-cpp/loop_wrapper.cpp
@@ -0,0 +1,52 @@
+// 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.
+
+#include <lib/async-loop/cpp/loop.h>
+
+#include <zircon/assert.h>
+
+namespace async {
+
+Loop::Loop(const async_loop_config_t* config) {
+    zx_status_t status = async_loop_create(config, &loop_);
+    ZX_ASSERT_MSG(status == ZX_OK, "status=%d", status);
+}
+
+Loop::~Loop() {
+    async_loop_destroy(loop_);
+}
+
+void Loop::Shutdown() {
+    async_loop_shutdown(loop_);
+}
+
+zx_status_t Loop::Run(zx::time deadline, bool once) {
+    return async_loop_run(loop_, deadline.get(), once);
+}
+
+zx_status_t Loop::RunUntilIdle() {
+    return async_loop_run_until_idle(loop_);
+}
+
+void Loop::Quit() {
+    async_loop_quit(loop_);
+}
+
+zx_status_t Loop::ResetQuit() {
+    return async_loop_reset_quit(loop_);
+}
+
+async_loop_state_t Loop::GetState() const {
+    return async_loop_get_state(loop_);
+}
+
+zx_status_t Loop::StartThread(const char* name, thrd_t* out_thread) {
+    return async_loop_start_thread(loop_, name, out_thread);
+}
+
+void Loop::JoinThreads() {
+    async_loop_join_threads(loop_);
+}
+
+} // namespace async
diff --git a/pkg/async-loop-cpp/meta.json b/pkg/async-loop-cpp/meta.json
new file mode 100644
index 0000000..950712f
--- /dev/null
+++ b/pkg/async-loop-cpp/meta.json
@@ -0,0 +1,24 @@
+{
+  "banjo_deps": [], 
+  "deps": [
+    "async", 
+    "async-default", 
+    "async-loop", 
+    "zx"
+  ], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/async-loop-cpp/loop_wrapper.cpp", 
+    "pkg/async-loop-cpp/include/lib/async-loop/cpp/loop.h"
+  ], 
+  "headers": [
+    "pkg/async-loop-cpp/include/lib/async-loop/cpp/loop.h"
+  ], 
+  "include_dir": "pkg/async-loop-cpp/include", 
+  "name": "async-loop-cpp", 
+  "root": "pkg/async-loop-cpp", 
+  "sources": [
+    "pkg/async-loop-cpp/loop_wrapper.cpp"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/async-loop/include/lib/async-loop/loop.h b/pkg/async-loop/include/lib/async-loop/loop.h
new file mode 100644
index 0000000..1335cdb
--- /dev/null
+++ b/pkg/async-loop/include/lib/async-loop/loop.h
@@ -0,0 +1,177 @@
+// 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.
+
+//
+// Provides an implementation of a simple thread-safe asynchronous
+// dispatcher based on a Zircon completion port.  The implementation
+// is designed to avoid most dynamic memory allocation except for that
+// which is required to create the loop in the first place or to manage
+// the list of running threads.
+//
+// See README.md for example usage.
+//
+
+#ifndef LIB_ASYNC_LOOP_LOOP_H_
+#define LIB_ASYNC_LOOP_LOOP_H_
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <threads.h>
+
+#include <zircon/compiler.h>
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Pointer to a message loop created using |async_loop_create()|.
+typedef struct async_loop async_loop_t;
+
+// Message loop configuration structure.
+typedef void(async_loop_callback_t)(async_loop_t* loop, void* data);
+typedef struct async_loop_config {
+    // If true, the loop will automatically register itself as the default
+    // dispatcher for the thread upon which it was created and will
+    // automatically unregister itself when destroyed (which must occur on
+    // the same thread).
+    //
+    // If false, the loop will not do this.  The loop's creator is then
+    // resposible for retrieving the loop's dispatcher using |async_loop_get_dispatcher()|
+    // and passing it around explicitly or calling |async_set_default_dispatcher()| as needed.
+    //
+    // Note that the loop can be used even without setting it as the current
+    // thread's default.
+    bool make_default_for_current_thread;
+
+    // A function to call before the dispatcher invokes each handler, or NULL if none.
+    async_loop_callback_t* prologue;
+
+    // A function to call after the dispatcher invokes each handler, or NULL if none.
+    async_loop_callback_t* epilogue;
+
+    // Data to pass to the callback functions.
+    void* data;
+} async_loop_config_t;
+
+// Simple config that when passed to async_loop_create will create a loop
+// that will automatically register itself as the default
+// dispatcher for the thread upon which it was created and will
+// automatically unregister itself when destroyed (which must occur on
+// the same thread).
+extern const async_loop_config_t kAsyncLoopConfigAttachToThread;
+
+// Simple config that when passed to async_loop_create will create a loop
+// that is not registered to the current thread.
+extern const async_loop_config_t kAsyncLoopConfigNoAttachToThread;
+
+// Creates a message loop and returns a pointer to it in |out_loop|.
+// All operations on the message loop are thread-safe (except destroy).
+//
+// Note that it's ok to run the loop on a different thread from the one
+// upon which it was created.
+//
+// |config| provides configuration for the message loop. Must not be null.
+//
+// Returns |ZX_OK| on success.
+// Returns |ZX_ERR_NO_MEMORY| if allocation failed.
+// May return other errors if the necessary internal handles could not be created.
+//
+// See also |kAsyncLoopConfigAttachToThread| and |kAsyncLoopConfigNoAttachToThread|.
+zx_status_t async_loop_create(const async_loop_config_t* config,
+                              async_loop_t** out_loop);
+
+// Gets the the message loop's asynchronous dispatch interface.
+async_dispatcher_t* async_loop_get_dispatcher(async_loop_t* loop);
+
+// Gets the message loop associated with the specified asynchronous dispatch interface
+//
+// This function assumes the dispatcher is backed by an |async_loop_t| which was created
+// using |async_loop_create()|.  Its behavior is undefined if used with other dispatcher
+// implementations.
+async_loop_t* async_loop_from_dispatcher(async_dispatcher_t* dispatcher);
+
+// Shuts down the message loop, notifies handlers which asked to handle shutdown.
+// The message loop must not currently be running on any threads other than
+// those started by |async_loop_start_thread()| which this function will join.
+//
+// Does nothing if already shutting down.
+void async_loop_shutdown(async_loop_t* loop);
+
+// Destroys the message loop.
+// Implicitly calls |async_loop_shutdown()| and joins all threads started
+// using |async_loop_start_thread()| before destroying the loop itself.
+void async_loop_destroy(async_loop_t* loop);
+
+// Runs the message loop on the current thread.
+// This function can be called on multiple threads to setup a multi-threaded
+// dispatcher.
+//
+// Dispatches events until the |deadline| expires or the loop is quitted.
+// Use |ZX_TIME_INFINITE| to dispatch events indefinitely.
+//
+// If |once| is true, performs a single unit of work then returns.
+//
+// Returns |ZX_OK| if the dispatcher returns after one cycle.
+// Returns |ZX_ERR_TIMED_OUT| if the deadline expired.
+// Returns |ZX_ERR_CANCELED| if the loop quitted.
+// Returns |ZX_ERR_BAD_STATE| if the loop was shut down with |async_loop_shutdown()|.
+zx_status_t async_loop_run(async_loop_t* loop, zx_time_t deadline, bool once);
+
+// Dispatches events until there are none remaining, and then returns without
+// waiting. This is useful for unit testing, because the behavior doesn't depend
+// on time.
+//
+// Returns |ZX_OK| if the dispatcher reaches an idle state.
+// Returns |ZX_ERR_CANCELED| if the loop quitted.
+// Returns |ZX_ERR_BAD_STATE| if the loop was shut down with |async_loop_shutdown()|.
+zx_status_t async_loop_run_until_idle(async_loop_t* loop);
+
+// Quits the message loop.
+// Active invocations of |async_loop_run()| and threads started using
+// |async_loop_start_thread()| will eventually terminate upon completion of their
+// current unit of work.
+//
+// Subsequent calls to |async_loop_run()| or |async_loop_start_thread()|
+// will return immediately until |async_loop_reset_quit()| is called.
+void async_loop_quit(async_loop_t* loop);
+
+// Resets the quit state of the message loop so that it can be restarted
+// using |async_loop_run()| or |async_loop_start_thread()|.
+//
+// This function must only be called when the message loop is not running.
+// The caller must ensure all active invocations of |async_loop_run()| and
+// threads started using |async_loop_start_thread()| have terminated before
+// resetting the quit state.
+//
+// Returns |ZX_OK| if the loop's state was |ASYNC_LOOP_RUNNABLE| or |ASYNC_LOOP_QUIT|.
+// Returns |ZX_ERR_BAD_STATE| if the loop's state was |ASYNC_LOOP_SHUTDOWN| or if
+// the message loop is currently active on one or more threads.
+zx_status_t async_loop_reset_quit(async_loop_t* loop);
+
+// Returns the current state of the message loop.
+typedef uint32_t async_loop_state_t;
+#define ASYNC_LOOP_RUNNABLE ((async_loop_state_t) 0)
+#define ASYNC_LOOP_QUIT ((async_loop_state_t) 1)
+#define ASYNC_LOOP_SHUTDOWN ((async_loop_state_t) 2)
+async_loop_state_t async_loop_get_state(async_loop_t* loop);
+
+// Starts a message loop running on a new thread.
+// The thread will run until the loop quits.
+//
+// |name| is the desired name for the new thread, may be NULL.
+// If |out_thread| is not NULL, it is set to the new thread identifier.
+//
+// Returns |ZX_OK| on success.
+// Returns |ZX_ERR_BAD_STATE| if the loop was shut down with |async_loop_shutdown()|.
+// Returns |ZX_ERR_NO_MEMORY| if allocation or thread creation failed.
+zx_status_t async_loop_start_thread(async_loop_t* loop, const char* name,
+                                    thrd_t* out_thread);
+
+// Blocks until all dispatch threads started with |async_loop_start_thread()|
+// have terminated.
+void async_loop_join_threads(async_loop_t* loop);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_LOOP_LOOP_H_
\ No newline at end of file
diff --git a/pkg/async-loop/loop.c b/pkg/async-loop/loop.c
new file mode 100644
index 0000000..e70627a
--- /dev/null
+++ b/pkg/async-loop/loop.c
@@ -0,0 +1,797 @@
+// 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 _ALL_SOURCE
+#define _ALL_SOURCE // Enables thrd_create_with_name in <threads.h>.
+#endif
+#include <lib/async-loop/loop.h>
+
+#include <assert.h>
+#include <stdatomic.h>
+#include <stdlib.h>
+
+#include <zircon/assert.h>
+#include <zircon/listnode.h>
+#include <zircon/syscalls.h>
+#include <zircon/syscalls/hypervisor.h>
+
+#include <lib/async/default.h>
+#include <lib/async/exception.h>
+#include <lib/async/receiver.h>
+#include <lib/async/task.h>
+#include <lib/async/trap.h>
+#include <lib/async/wait.h>
+
+// The port wait key associated with the dispatcher's control messages.
+#define KEY_CONTROL (0u)
+
+static zx_time_t async_loop_now(async_dispatcher_t* dispatcher);
+static zx_status_t async_loop_begin_wait(async_dispatcher_t* dispatcher, async_wait_t* wait);
+static zx_status_t async_loop_cancel_wait(async_dispatcher_t* dispatcher, async_wait_t* wait);
+static zx_status_t async_loop_post_task(async_dispatcher_t* dispatcher, async_task_t* task);
+static zx_status_t async_loop_cancel_task(async_dispatcher_t* dispatcher, async_task_t* task);
+static zx_status_t async_loop_queue_packet(async_dispatcher_t* dispatcher, async_receiver_t* receiver,
+                                           const zx_packet_user_t* data);
+static zx_status_t async_loop_set_guest_bell_trap(
+    async_dispatcher_t* dispatcher, async_guest_bell_trap_t* trap,
+    zx_handle_t guest, zx_vaddr_t addr, size_t length);
+static zx_status_t async_loop_bind_exception_port(async_dispatcher_t* async,
+                                                  async_exception_t* exception);
+static zx_status_t async_loop_unbind_exception_port(async_dispatcher_t* async,
+                                                    async_exception_t* exception);
+static zx_status_t async_loop_resume_from_exception(async_dispatcher_t* async,
+                                                    async_exception_t* exception,
+                                                    zx_handle_t task,
+                                                    uint32_t options);
+
+static const async_ops_t async_loop_ops = {
+    .version = ASYNC_OPS_V2,
+    .reserved = 0,
+    .v1 = {
+        .now = async_loop_now,
+        .begin_wait = async_loop_begin_wait,
+        .cancel_wait = async_loop_cancel_wait,
+        .post_task = async_loop_post_task,
+        .cancel_task = async_loop_cancel_task,
+        .queue_packet = async_loop_queue_packet,
+        .set_guest_bell_trap = async_loop_set_guest_bell_trap,
+    },
+    .v2 = {
+        .bind_exception_port = async_loop_bind_exception_port,
+        .unbind_exception_port = async_loop_unbind_exception_port,
+        .resume_from_exception = async_loop_resume_from_exception,
+    },
+};
+
+typedef struct thread_record {
+    list_node_t node;
+    thrd_t thread;
+} thread_record_t;
+
+const async_loop_config_t kAsyncLoopConfigAttachToThread = {
+    .make_default_for_current_thread = true};
+const async_loop_config_t kAsyncLoopConfigNoAttachToThread = {
+    .make_default_for_current_thread = false};
+
+typedef struct async_loop {
+    async_dispatcher_t dispatcher; // must be first (the loop inherits from async_dispatcher_t)
+    async_loop_config_t config; // immutable
+    zx_handle_t port; // immutable
+    zx_handle_t timer; // immutable
+
+    _Atomic async_loop_state_t state;
+    atomic_uint active_threads; // number of active dispatch threads
+
+    mtx_t lock; // guards the lists and the dispatching tasks flag
+    bool dispatching_tasks; // true while the loop is busy dispatching tasks
+    list_node_t wait_list; // most recently added first
+    list_node_t task_list; // pending tasks, earliest deadline first
+    list_node_t due_list; // due tasks, earliest deadline first
+    list_node_t thread_list; // earliest created thread first
+    list_node_t exception_list; // most recently added first
+} async_loop_t;
+
+static zx_status_t async_loop_run_once(async_loop_t* loop, zx_time_t deadline);
+static zx_status_t async_loop_dispatch_wait(async_loop_t* loop, async_wait_t* wait,
+                                            zx_status_t status, const zx_packet_signal_t* signal);
+static zx_status_t async_loop_dispatch_tasks(async_loop_t* loop);
+static void async_loop_dispatch_task(async_loop_t* loop, async_task_t* task,
+                                     zx_status_t status);
+static zx_status_t async_loop_dispatch_packet(async_loop_t* loop, async_receiver_t* receiver,
+                                              zx_status_t status, const zx_packet_user_t* data);
+static zx_status_t async_loop_dispatch_guest_bell_trap(async_loop_t* loop,
+                                                       async_guest_bell_trap_t* trap,
+                                                       zx_status_t status,
+                                                       const zx_packet_guest_bell_t* bell);
+static zx_status_t async_loop_dispatch_exception(async_loop_t* loop,
+                                                 async_exception_t* exception,
+                                                 zx_status_t status,
+                                                 const zx_port_packet_t* report);
+static void async_loop_wake_threads(async_loop_t* loop);
+static void async_loop_insert_task_locked(async_loop_t* loop, async_task_t* task);
+static void async_loop_restart_timer_locked(async_loop_t* loop);
+static void async_loop_invoke_prologue(async_loop_t* loop);
+static void async_loop_invoke_epilogue(async_loop_t* loop);
+
+static_assert(sizeof(list_node_t) <= sizeof(async_state_t),
+              "async_state_t too small");
+
+#define TO_NODE(type, ptr) ((list_node_t*)&ptr->state)
+#define FROM_NODE(type, ptr) ((type*)((char*)(ptr)-offsetof(type, state)))
+
+static inline list_node_t* wait_to_node(async_wait_t* wait) {
+    return TO_NODE(async_wait_t, wait);
+}
+
+static inline async_wait_t* node_to_wait(list_node_t* node) {
+    return FROM_NODE(async_wait_t, node);
+}
+
+static inline list_node_t* task_to_node(async_task_t* task) {
+    return TO_NODE(async_task_t, task);
+}
+
+static inline async_task_t* node_to_task(list_node_t* node) {
+    return FROM_NODE(async_task_t, node);
+}
+
+static inline list_node_t* exception_to_node(async_exception_t* exception) {
+    return TO_NODE(async_exception_t, exception);
+}
+
+static inline async_exception_t* node_to_exception(list_node_t* node) {
+    return FROM_NODE(async_exception_t, node);
+}
+
+zx_status_t async_loop_create(const async_loop_config_t* config, async_loop_t** out_loop) {
+    ZX_DEBUG_ASSERT(out_loop);
+    ZX_DEBUG_ASSERT(config != NULL);
+
+    async_loop_t* loop = calloc(1u, sizeof(async_loop_t));
+    if (!loop)
+        return ZX_ERR_NO_MEMORY;
+    atomic_init(&loop->state, ASYNC_LOOP_RUNNABLE);
+    atomic_init(&loop->active_threads, 0u);
+
+    loop->dispatcher.ops = &async_loop_ops;
+    loop->config = *config;
+    mtx_init(&loop->lock, mtx_plain);
+    list_initialize(&loop->wait_list);
+    list_initialize(&loop->task_list);
+    list_initialize(&loop->due_list);
+    list_initialize(&loop->thread_list);
+    list_initialize(&loop->exception_list);
+
+    zx_status_t status = zx_port_create(0u, &loop->port);
+    if (status == ZX_OK)
+        status = zx_timer_create(0u, ZX_CLOCK_MONOTONIC, &loop->timer);
+    if (status == ZX_OK) {
+        status = zx_object_wait_async(loop->timer, loop->port, KEY_CONTROL,
+                                      ZX_TIMER_SIGNALED,
+                                      ZX_WAIT_ASYNC_REPEATING);
+    }
+    if (status == ZX_OK) {
+        *out_loop = loop;
+        if (loop->config.make_default_for_current_thread) {
+            ZX_DEBUG_ASSERT(async_get_default_dispatcher() == NULL);
+            async_set_default_dispatcher(&loop->dispatcher);
+        }
+    } else {
+        loop->config.make_default_for_current_thread = false;
+        async_loop_destroy(loop);
+    }
+    return status;
+}
+
+void async_loop_destroy(async_loop_t* loop) {
+    ZX_DEBUG_ASSERT(loop);
+
+    async_loop_shutdown(loop);
+
+    zx_handle_close(loop->port);
+    zx_handle_close(loop->timer);
+    mtx_destroy(&loop->lock);
+    free(loop);
+}
+
+void async_loop_shutdown(async_loop_t* loop) {
+    ZX_DEBUG_ASSERT(loop);
+
+    async_loop_state_t prior_state =
+        atomic_exchange_explicit(&loop->state, ASYNC_LOOP_SHUTDOWN,
+                                 memory_order_acq_rel);
+    if (prior_state == ASYNC_LOOP_SHUTDOWN)
+        return;
+
+    async_loop_wake_threads(loop);
+    async_loop_join_threads(loop);
+
+    list_node_t* node;
+    while ((node = list_remove_head(&loop->wait_list))) {
+        async_wait_t* wait = node_to_wait(node);
+        async_loop_dispatch_wait(loop, wait, ZX_ERR_CANCELED, NULL);
+    }
+    while ((node = list_remove_head(&loop->due_list))) {
+        async_task_t* task = node_to_task(node);
+        async_loop_dispatch_task(loop, task, ZX_ERR_CANCELED);
+    }
+    while ((node = list_remove_head(&loop->task_list))) {
+        async_task_t* task = node_to_task(node);
+        async_loop_dispatch_task(loop, task, ZX_ERR_CANCELED);
+    }
+    while ((node = list_remove_head(&loop->exception_list))) {
+        async_exception_t* exception = node_to_exception(node);
+        async_loop_dispatch_exception(loop, exception, ZX_ERR_CANCELED, NULL);
+    }
+
+    if (loop->config.make_default_for_current_thread) {
+        ZX_DEBUG_ASSERT(async_get_default_dispatcher() == &loop->dispatcher);
+        async_set_default_dispatcher(NULL);
+    }
+}
+
+zx_status_t async_loop_run(async_loop_t* loop, zx_time_t deadline, bool once) {
+    ZX_DEBUG_ASSERT(loop);
+
+    zx_status_t status;
+    atomic_fetch_add_explicit(&loop->active_threads, 1u, memory_order_acq_rel);
+    do {
+        status = async_loop_run_once(loop, deadline);
+    } while (status == ZX_OK && !once);
+    atomic_fetch_sub_explicit(&loop->active_threads, 1u, memory_order_acq_rel);
+    return status;
+}
+
+zx_status_t async_loop_run_until_idle(async_loop_t* loop) {
+    zx_status_t status = async_loop_run(loop, 0, false);
+    if (status == ZX_ERR_TIMED_OUT) {
+        status = ZX_OK;
+    }
+    return status;
+}
+
+static zx_status_t async_loop_run_once(async_loop_t* loop, zx_time_t deadline) {
+    async_loop_state_t state = atomic_load_explicit(&loop->state, memory_order_acquire);
+    if (state == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+    if (state != ASYNC_LOOP_RUNNABLE)
+        return ZX_ERR_CANCELED;
+
+    zx_port_packet_t packet;
+    zx_status_t status = zx_port_wait(loop->port, deadline, &packet);
+    if (status != ZX_OK)
+        return status;
+
+    if (packet.key == KEY_CONTROL) {
+        // Handle wake-up packets.
+        if (packet.type == ZX_PKT_TYPE_USER)
+            return ZX_OK;
+
+        // Handle task timer expirations.
+        if (packet.type == ZX_PKT_TYPE_SIGNAL_REP &&
+            packet.signal.observed & ZX_TIMER_SIGNALED) {
+            return async_loop_dispatch_tasks(loop);
+        }
+    } else {
+        // Handle wait completion packets.
+        if (packet.type == ZX_PKT_TYPE_SIGNAL_ONE) {
+            async_wait_t* wait = (void*)(uintptr_t)packet.key;
+            mtx_lock(&loop->lock);
+            list_delete(wait_to_node(wait));
+            mtx_unlock(&loop->lock);
+            return async_loop_dispatch_wait(loop, wait, packet.status, &packet.signal);
+        }
+
+        // Handle queued user packets.
+        if (packet.type == ZX_PKT_TYPE_USER) {
+            async_receiver_t* receiver = (void*)(uintptr_t)packet.key;
+            return async_loop_dispatch_packet(loop, receiver, packet.status, &packet.user);
+        }
+
+        // Handle guest bell trap packets.
+        if (packet.type == ZX_PKT_TYPE_GUEST_BELL) {
+            async_guest_bell_trap_t* trap = (void*)(uintptr_t)packet.key;
+            return async_loop_dispatch_guest_bell_trap(
+                loop, trap, packet.status, &packet.guest_bell);
+        }
+
+        // Handle exception packets.
+        if (ZX_PKT_IS_EXCEPTION(packet.type)) {
+            async_exception_t* exception = (void*)(uintptr_t)packet.key;
+            return async_loop_dispatch_exception(loop, exception, packet.status,
+                                                 &packet);
+        }
+    }
+
+    ZX_DEBUG_ASSERT(false);
+    return ZX_ERR_INTERNAL;
+}
+
+async_dispatcher_t* async_loop_get_dispatcher(async_loop_t* loop) {
+    // Note: The loop's implementation inherits from async_t so we can upcast to it.
+    return (async_dispatcher_t*)loop;
+}
+
+async_loop_t* async_loop_from_dispatcher(async_dispatcher_t* async) {
+    return (async_loop_t*)async;
+}
+
+static zx_status_t async_loop_dispatch_guest_bell_trap(async_loop_t* loop,
+                                                       async_guest_bell_trap_t* trap,
+                                                       zx_status_t status,
+                                                       const zx_packet_guest_bell_t* bell) {
+    async_loop_invoke_prologue(loop);
+    trap->handler((async_dispatcher_t*)loop, trap, status, bell);
+    async_loop_invoke_epilogue(loop);
+    return ZX_OK;
+}
+
+static zx_status_t async_loop_dispatch_wait(async_loop_t* loop, async_wait_t* wait,
+                                            zx_status_t status, const zx_packet_signal_t* signal) {
+    async_loop_invoke_prologue(loop);
+    wait->handler((async_dispatcher_t*)loop, wait, status, signal);
+    async_loop_invoke_epilogue(loop);
+    return ZX_OK;
+}
+
+static zx_status_t async_loop_dispatch_tasks(async_loop_t* loop) {
+    // Dequeue and dispatch one task at a time in case an earlier task wants
+    // to cancel a later task which has also come due.  At most one thread
+    // can dispatch tasks at any given moment (to preserve serial ordering).
+    // Timer restarts are suppressed until we run out of tasks to dispatch.
+    mtx_lock(&loop->lock);
+    if (!loop->dispatching_tasks) {
+        loop->dispatching_tasks = true;
+
+        // Extract all of the tasks that are due into |due_list| for dispatch
+        // unless we already have some waiting from a previous iteration which
+        // we would like to process in order.
+        list_node_t* node;
+        if (list_is_empty(&loop->due_list)) {
+            zx_time_t due_time = async_loop_now((async_dispatcher_t*)loop);
+            list_node_t* tail = NULL;
+            list_for_every(&loop->task_list, node) {
+                if (node_to_task(node)->deadline > due_time)
+                    break;
+                tail = node;
+            }
+            if (tail) {
+                list_node_t* head = loop->task_list.next;
+                loop->task_list.next = tail->next;
+                tail->next->prev = &loop->task_list;
+                loop->due_list.next = head;
+                head->prev = &loop->due_list;
+                loop->due_list.prev = tail;
+                tail->next = &loop->due_list;
+            }
+        }
+
+        // Dispatch all due tasks.  Note that they might be canceled concurrently
+        // so we need to grab the lock during each iteration to fetch the next
+        // item from the list.
+        while ((node = list_remove_head(&loop->due_list))) {
+            mtx_unlock(&loop->lock);
+
+            // Invoke the handler.  Note that it might destroy itself.
+            async_task_t* task = node_to_task(node);
+            async_loop_dispatch_task(loop, task, ZX_OK);
+
+            mtx_lock(&loop->lock);
+            async_loop_state_t state = atomic_load_explicit(&loop->state, memory_order_acquire);
+            if (state != ASYNC_LOOP_RUNNABLE)
+                break;
+        }
+
+        loop->dispatching_tasks = false;
+        async_loop_restart_timer_locked(loop);
+    }
+    mtx_unlock(&loop->lock);
+    return ZX_OK;
+}
+
+static void async_loop_dispatch_task(async_loop_t* loop,
+                                     async_task_t* task,
+                                     zx_status_t status) {
+    // Invoke the handler.  Note that it might destroy itself.
+    async_loop_invoke_prologue(loop);
+    task->handler((async_dispatcher_t*)loop, task, status);
+    async_loop_invoke_epilogue(loop);
+}
+
+static zx_status_t async_loop_dispatch_packet(async_loop_t* loop, async_receiver_t* receiver,
+                                              zx_status_t status, const zx_packet_user_t* data) {
+    // Invoke the handler.  Note that it might destroy itself.
+    async_loop_invoke_prologue(loop);
+    receiver->handler((async_dispatcher_t*)loop, receiver, status, data);
+    async_loop_invoke_epilogue(loop);
+    return ZX_OK;
+}
+
+static zx_status_t async_loop_dispatch_exception(async_loop_t* loop,
+                                                 async_exception_t* exception,
+                                                 zx_status_t status,
+                                                 const zx_port_packet_t* report) {
+    // Invoke the handler.  Note that it might destroy itself.
+    async_loop_invoke_prologue(loop);
+    exception->handler((async_dispatcher_t*)loop, exception, status, report);
+    async_loop_invoke_epilogue(loop);
+    return ZX_OK;
+}
+
+void async_loop_quit(async_loop_t* loop) {
+    ZX_DEBUG_ASSERT(loop);
+
+    async_loop_state_t expected_state = ASYNC_LOOP_RUNNABLE;
+    if (!atomic_compare_exchange_strong_explicit(&loop->state, &expected_state,
+                                                 ASYNC_LOOP_QUIT,
+                                                 memory_order_acq_rel, memory_order_acquire))
+        return;
+
+    async_loop_wake_threads(loop);
+}
+
+static void async_loop_wake_threads(async_loop_t* loop) {
+    // Queue enough packets to awaken all active threads.
+    // This is safe because any new threads which join the pool first increment the
+    // active thread count then check the loop state, so the count we observe here
+    // cannot be less than the number of threads which might be blocked in |port_wait|.
+    // Issuing too many packets is also harmless.
+    uint32_t n = atomic_load_explicit(&loop->active_threads, memory_order_acquire);
+    for (uint32_t i = 0u; i < n; i++) {
+        zx_port_packet_t packet = {
+            .key = KEY_CONTROL,
+            .type = ZX_PKT_TYPE_USER,
+            .status = ZX_OK};
+        zx_status_t status = zx_port_queue(loop->port, &packet);
+        ZX_ASSERT_MSG(status == ZX_OK, "zx_port_queue: status=%d", status);
+    }
+}
+
+zx_status_t async_loop_reset_quit(async_loop_t* loop) {
+    ZX_DEBUG_ASSERT(loop);
+
+    // Ensure that there are no active threads before resetting the quit state.
+    // This check is inherently racy but not dangerously so.  It's mainly a
+    // sanity check for client code so we can make a stronger statement about
+    // how |async_loop_reset_quit()| is supposed to be used.
+    uint32_t n = atomic_load_explicit(&loop->active_threads, memory_order_acquire);
+    if (n != 0)
+        return ZX_ERR_BAD_STATE;
+
+    async_loop_state_t expected_state = ASYNC_LOOP_QUIT;
+    if (atomic_compare_exchange_strong_explicit(&loop->state, &expected_state,
+                                                ASYNC_LOOP_RUNNABLE,
+                                                memory_order_acq_rel, memory_order_acquire)) {
+        return ZX_OK;
+    }
+
+    async_loop_state_t state = atomic_load_explicit(&loop->state, memory_order_acquire);
+    if (state == ASYNC_LOOP_RUNNABLE)
+        return ZX_OK;
+    return ZX_ERR_BAD_STATE;
+}
+
+async_loop_state_t async_loop_get_state(async_loop_t* loop) {
+    ZX_DEBUG_ASSERT(loop);
+
+    return atomic_load_explicit(&loop->state, memory_order_acquire);
+}
+
+zx_time_t async_loop_now(async_dispatcher_t* dispatcher) {
+    return zx_clock_get_monotonic();
+}
+
+static zx_status_t async_loop_begin_wait(async_dispatcher_t* async, async_wait_t* wait) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(wait);
+
+    if (atomic_load_explicit(&loop->state, memory_order_acquire) == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    mtx_lock(&loop->lock);
+
+    zx_status_t status = zx_object_wait_async(
+        wait->object, loop->port, (uintptr_t)wait, wait->trigger, ZX_WAIT_ASYNC_ONCE);
+    if (status == ZX_OK) {
+        list_add_head(&loop->wait_list, wait_to_node(wait));
+    } else {
+        ZX_ASSERT_MSG(status == ZX_ERR_ACCESS_DENIED,
+                      "zx_object_wait_async: status=%d", status);
+    }
+
+    mtx_unlock(&loop->lock);
+    return status;
+}
+
+static zx_status_t async_loop_cancel_wait(async_dispatcher_t* async, async_wait_t* wait) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(wait);
+
+    // Note: We need to process cancelations even while the loop is being
+    // destroyed in case the client is counting on the handler not being
+    // invoked again past this point.
+
+    mtx_lock(&loop->lock);
+
+    // First, confirm that the wait is actually pending.
+    list_node_t* node = wait_to_node(wait);
+    if (!list_in_list(node)) {
+        mtx_unlock(&loop->lock);
+        return ZX_ERR_NOT_FOUND;
+    }
+
+    // Next, cancel the wait.  This may be racing with another thread that
+    // has read the wait's packet but not yet dispatched it.  So if we fail
+    // to cancel then we assume we lost the race.
+    zx_status_t status = zx_port_cancel(loop->port, wait->object,
+                                        (uintptr_t)wait);
+    if (status == ZX_OK) {
+        list_delete(node);
+    } else {
+        ZX_ASSERT_MSG(status == ZX_ERR_NOT_FOUND,
+                      "zx_port_cancel: status=%d", status);
+    }
+
+    mtx_unlock(&loop->lock);
+    return status;
+}
+
+static zx_status_t async_loop_post_task(async_dispatcher_t* async, async_task_t* task) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(task);
+
+    if (atomic_load_explicit(&loop->state, memory_order_acquire) == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    mtx_lock(&loop->lock);
+
+    async_loop_insert_task_locked(loop, task);
+    if (!loop->dispatching_tasks &&
+        task_to_node(task)->prev == &loop->task_list) {
+        // Task inserted at head.  Earliest deadline changed.
+        async_loop_restart_timer_locked(loop);
+    }
+
+    mtx_unlock(&loop->lock);
+    return ZX_OK;
+}
+
+static zx_status_t async_loop_cancel_task(async_dispatcher_t* async, async_task_t* task) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(task);
+
+    // Note: We need to process cancelations even while the loop is being
+    // destroyed in case the client is counting on the handler not being
+    // invoked again past this point.  Also, the task we're removing here
+    // might be present in the dispatcher's |due_list| if it is pending
+    // dispatch instead of in the loop's |task_list| as usual.  The same
+    // logic works in both cases.
+
+    mtx_lock(&loop->lock);
+    list_node_t* node = task_to_node(task);
+    if (!list_in_list(node)) {
+        mtx_unlock(&loop->lock);
+        return ZX_ERR_NOT_FOUND;
+    }
+
+    // Determine whether the head task was canceled and following task has
+    // a later deadline.  If so, we will bump the timer along to that deadline.
+    bool must_restart = !loop->dispatching_tasks &&
+                        node->prev == &loop->task_list &&
+                        node->next != &loop->task_list &&
+                        node_to_task(node->next)->deadline > task->deadline;
+    list_delete(node);
+    if (must_restart)
+        async_loop_restart_timer_locked(loop);
+
+    mtx_unlock(&loop->lock);
+    return ZX_OK;
+}
+
+static zx_status_t async_loop_queue_packet(async_dispatcher_t* async, async_receiver_t* receiver,
+                                           const zx_packet_user_t* data) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(receiver);
+
+    if (atomic_load_explicit(&loop->state, memory_order_acquire) == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    zx_port_packet_t packet = {
+        .key = (uintptr_t)receiver,
+        .type = ZX_PKT_TYPE_USER,
+        .status = ZX_OK};
+    if (data)
+        packet.user = *data;
+    return zx_port_queue(loop->port, &packet);
+}
+
+static zx_status_t async_loop_set_guest_bell_trap(
+    async_dispatcher_t* async, async_guest_bell_trap_t* trap,
+    zx_handle_t guest, zx_vaddr_t addr, size_t length) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(trap);
+
+    if (atomic_load_explicit(&loop->state, memory_order_acquire) == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    zx_status_t status = zx_guest_set_trap(guest, ZX_GUEST_TRAP_BELL, addr,
+                                           length, loop->port, (uintptr_t)trap);
+    if (status != ZX_OK) {
+        ZX_ASSERT_MSG(status == ZX_ERR_ACCESS_DENIED ||
+                          status == ZX_ERR_ALREADY_EXISTS ||
+                          status == ZX_ERR_INVALID_ARGS ||
+                          status == ZX_ERR_OUT_OF_RANGE ||
+                          status == ZX_ERR_WRONG_TYPE,
+                      "zx_guest_set_trap: status=%d", status);
+    }
+    return status;
+}
+
+static zx_status_t async_loop_bind_exception_port(async_dispatcher_t* async,
+                                                  async_exception_t* exception) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(exception);
+
+    if (atomic_load_explicit(&loop->state, memory_order_acquire) == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    mtx_lock(&loop->lock);
+
+    uint64_t key = (uintptr_t)(void*) exception;
+    zx_status_t status = zx_task_bind_exception_port(exception->task, loop->port,
+                                                     key, exception->options);
+    if (status == ZX_OK) {
+        list_add_head(&loop->exception_list, exception_to_node(exception));
+    }
+
+    mtx_unlock(&loop->lock);
+    return status;
+}
+
+static zx_status_t async_loop_unbind_exception_port(async_dispatcher_t* async,
+                                                    async_exception_t* exception) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(exception);
+
+    // Note: We need to process unbindings even while the loop is being
+    // destroyed in case the client is counting on the handler not being
+    // invoked again past this point.
+
+    mtx_lock(&loop->lock);
+
+    // First, confirm that the port is actually bound.
+    list_node_t* node = exception_to_node(exception);
+    if (!list_in_list(node)) {
+        mtx_unlock(&loop->lock);
+        return ZX_ERR_NOT_FOUND;
+    }
+
+    uint64_t key = (uintptr_t)(void*) exception;
+    zx_status_t status = zx_task_bind_exception_port(exception->task,
+                                                     ZX_HANDLE_INVALID, key, 0);
+
+    if (status == ZX_OK) {
+        list_delete(node);
+    }
+
+    mtx_unlock(&loop->lock);
+    return status;
+}
+
+static zx_status_t async_loop_resume_from_exception(async_dispatcher_t* async,
+                                                    async_exception_t* exception,
+                                                    zx_handle_t task,
+                                                    uint32_t options) {
+    async_loop_t* loop = (async_loop_t*)async;
+    ZX_DEBUG_ASSERT(loop);
+    ZX_DEBUG_ASSERT(exception);
+
+    if (atomic_load_explicit(&loop->state, memory_order_acquire) == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    return zx_task_resume_from_exception(task, loop->port, options);
+}
+
+static void async_loop_insert_task_locked(async_loop_t* loop, async_task_t* task) {
+    // TODO(ZX-976): We assume that tasks are inserted in quasi-monotonic order and
+    // that insertion into the task queue will typically take no more than a few steps.
+    // If this assumption proves false and the cost of insertion becomes a problem, we
+    // should consider using a more efficient representation for maintaining order.
+    list_node_t* node;
+    for (node = loop->task_list.prev; node != &loop->task_list; node = node->prev) {
+        if (task->deadline >= node_to_task(node)->deadline)
+            break;
+    }
+    list_add_after(node, task_to_node(task));
+}
+
+static void async_loop_restart_timer_locked(async_loop_t* loop) {
+    zx_time_t deadline;
+    if (list_is_empty(&loop->due_list)) {
+        list_node_t* head = list_peek_head(&loop->task_list);
+        if (!head)
+            return;
+        async_task_t* task = node_to_task(head);
+        deadline = task->deadline;
+        if (deadline == ZX_TIME_INFINITE)
+            return;
+    } else {
+        // Fire now.
+        deadline = 0ULL;
+    }
+
+    zx_status_t status = zx_timer_set(loop->timer, deadline, 0);
+    ZX_ASSERT_MSG(status == ZX_OK, "zx_timer_set: status=%d", status);
+}
+
+static void async_loop_invoke_prologue(async_loop_t* loop) {
+    if (loop->config.prologue)
+        loop->config.prologue(loop, loop->config.data);
+}
+
+static void async_loop_invoke_epilogue(async_loop_t* loop) {
+    if (loop->config.epilogue)
+        loop->config.epilogue(loop, loop->config.data);
+}
+
+static int async_loop_run_thread(void* data) {
+    async_loop_t* loop = (async_loop_t*)data;
+    async_set_default_dispatcher(&loop->dispatcher);
+    async_loop_run(loop, ZX_TIME_INFINITE, false);
+    return 0;
+}
+
+zx_status_t async_loop_start_thread(async_loop_t* loop, const char* name, thrd_t* out_thread) {
+    ZX_DEBUG_ASSERT(loop);
+
+    // This check is inherently racy.  The client should not be racing shutdown
+    // with attemps to start new threads.  This is mainly a sanity check.
+    async_loop_state_t state = atomic_load_explicit(&loop->state, memory_order_acquire);
+    if (state == ASYNC_LOOP_SHUTDOWN)
+        return ZX_ERR_BAD_STATE;
+
+    thread_record_t* rec = calloc(1u, sizeof(thread_record_t));
+    if (!rec)
+        return ZX_ERR_NO_MEMORY;
+
+    if (thrd_create_with_name(&rec->thread, async_loop_run_thread, loop, name) != thrd_success) {
+        free(rec);
+        return ZX_ERR_NO_MEMORY;
+    }
+
+    mtx_lock(&loop->lock);
+    list_add_tail(&loop->thread_list, &rec->node);
+    mtx_unlock(&loop->lock);
+
+    if (out_thread)
+        *out_thread = rec->thread;
+    return ZX_OK;
+}
+
+void async_loop_join_threads(async_loop_t* loop) {
+    ZX_DEBUG_ASSERT(loop);
+
+    mtx_lock(&loop->lock);
+    for (;;) {
+        thread_record_t* rec = (thread_record_t*)list_remove_head(&loop->thread_list);
+        if (!rec)
+            break;
+
+        mtx_unlock(&loop->lock);
+        thrd_t thread = rec->thread;
+        free(rec);
+        int result = thrd_join(thread, NULL);
+        ZX_DEBUG_ASSERT(result == thrd_success);
+        mtx_lock(&loop->lock);
+    }
+    mtx_unlock(&loop->lock);
+}
diff --git a/pkg/async-loop/meta.json b/pkg/async-loop/meta.json
new file mode 100644
index 0000000..8a1eef7
--- /dev/null
+++ b/pkg/async-loop/meta.json
@@ -0,0 +1,22 @@
+{
+  "banjo_deps": [], 
+  "deps": [
+    "async", 
+    "async-default"
+  ], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/async-loop/loop.c", 
+    "pkg/async-loop/include/lib/async-loop/loop.h"
+  ], 
+  "headers": [
+    "pkg/async-loop/include/lib/async-loop/loop.h"
+  ], 
+  "include_dir": "pkg/async-loop/include", 
+  "name": "async-loop", 
+  "root": "pkg/async-loop", 
+  "sources": [
+    "pkg/async-loop/loop.c"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/async/include/lib/async/dispatcher.h b/pkg/async/include/lib/async/dispatcher.h
new file mode 100644
index 0000000..ff9b760
--- /dev/null
+++ b/pkg/async/include/lib/async/dispatcher.h
@@ -0,0 +1,125 @@
+// 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 LIB_ASYNC_DISPATCHER_H_
+#define LIB_ASYNC_DISPATCHER_H_
+
+#include <zircon/compiler.h>
+#include <zircon/syscalls/port.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// Dispatcher interface for performing asynchronous operations.
+// There may be multiple implementations of this interface.
+typedef struct async_dispatcher async_dispatcher_t;
+
+// Forward declarations for asynchronous operation structures.
+typedef struct async_guest_bell_trap async_guest_bell_trap_t;
+typedef struct async_wait async_wait_t;
+typedef struct async_task async_task_t;
+typedef struct async_receiver async_receiver_t;
+typedef struct async_exception async_exception_t;
+
+// Private state owned by the asynchronous dispatcher.
+// This allows the dispatcher to associate a small amount of state with pending
+// asynchronous operations without having to allocate additional heap storage of
+// its own.
+//
+// Clients must initialize the contents of this structure to zero using
+// |ASYNC_STATE_INIT| or with calloc, memset, or a similar means.
+typedef struct {
+    uintptr_t reserved[2];
+} async_state_t;
+
+#define ASYNC_STATE_INIT \
+    { 0u, 0u }
+
+// Asynchronous dispatcher interface.
+//
+// Clients should not call into this interface directly: use the wrapper functions
+// declared in other header files, such as |async_begin_wait()| in <lib/async/wait.h>.
+// See the documentation of those functions for details about each method's purpose
+// and behavior.
+//
+// This interface consists of several groups of methods:
+//
+// - Timing: |now|
+// - Waiting for signals: |begin_wait|, |cancel_wait|
+// - Posting tasks: |post_task|, |cancel_task|
+// - Queuing packets: |queue_packet|
+// - Virtual machine operations: |set_guest_bell_trap|
+// - Exception handling: |bind_exception_port|, |unbind_exception_port|
+//
+// To preserve binary compatibility, each successive version of this interface
+// is guaranteed to be backwards-compatible with clients of earlier versions.
+// New methods must only be added by extending the structure at the end and
+// declaring a new version number.  Do not reorder the declarations or modify
+// existing versions.
+//
+// Implementations of this interface must provide valid (non-null) function pointers
+// for every method declared in the interface version they support.  Unsupported
+// methods must return |ZX_ERR_NOT_SUPPORTED| and have no other side-effects.
+// Furthermore, if an implementation supports one method of a group, such as |begin_wait|,
+// then it must also support the other methods of the group, such as |cancel_wait|.
+//
+// Many clients assume that the dispatcher interface is fully implemented and may
+// fail to work with dispatchers that do not support the methods they need.
+// Therefore general-purpose dispatcher implementations are encouraged to support
+// the whole interface to ensure broad compatibility.
+typedef uint32_t async_ops_version_t;
+
+#define ASYNC_OPS_V1 ((async_ops_version_t) 1)
+#define ASYNC_OPS_V2 ((async_ops_version_t) 2)
+
+typedef struct async_ops {
+    // The interface version number, e.g. |ASYNC_OPS_V2|.
+    async_ops_version_t version;
+
+    // Reserved for future expansion, set to zero.
+    uint32_t reserved;
+
+    // Operations supported by |ASYNC_OPS_V1|.
+    struct v1 {
+        // See |async_now()| for details.
+        zx_time_t (*now)(async_dispatcher_t* dispatcher);
+        // See |async_begin_wait()| for details.
+        zx_status_t (*begin_wait)(async_dispatcher_t* dispatcher, async_wait_t* wait);
+        // See |async_cancel_wait()| for details.
+        zx_status_t (*cancel_wait)(async_dispatcher_t* dispatcher, async_wait_t* wait);
+        // See |async_post_task()| for details.
+        zx_status_t (*post_task)(async_dispatcher_t* dispatcher, async_task_t* task);
+        // See |async_cancel_task()| for details.
+        zx_status_t (*cancel_task)(async_dispatcher_t* dispatcher, async_task_t* task);
+        // See |async_queue_packet()| for details.
+        zx_status_t (*queue_packet)(async_dispatcher_t* dispatcher, async_receiver_t* receiver,
+                                    const zx_packet_user_t* data);
+        // See |async_set_guest_bell_trap()| for details.
+        zx_status_t (*set_guest_bell_trap)(async_dispatcher_t* dispatcher, async_guest_bell_trap_t* trap,
+                                           zx_handle_t guest, zx_vaddr_t addr, size_t length);
+    } v1;
+
+    // Operations supported by |ASYNC_OPS_V2|, in addition to those in V1.
+    struct v2 {
+        // See |async_bind_exception_port()| for details.
+        zx_status_t (*bind_exception_port)(async_dispatcher_t* dispatcher,
+                                           async_exception_t* exception);
+        // See |async_unbind_exception_port()| for details.
+        zx_status_t (*unbind_exception_port)(async_dispatcher_t* dispatcher,
+                                             async_exception_t* exception);
+        // See |async_resume_from_exception()| for details.
+        zx_status_t (*resume_from_exception)(async_dispatcher_t* dispatcher,
+                                             async_exception_t* exception,
+                                             zx_handle_t task,
+                                             uint32_t options);
+    } v2;
+} async_ops_t;
+
+struct async_dispatcher {
+    const async_ops_t* ops;
+};
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_DISPATCHER_H_
diff --git a/pkg/async/include/lib/async/exception.h b/pkg/async/include/lib/async/exception.h
new file mode 100644
index 0000000..654a294
--- /dev/null
+++ b/pkg/async/include/lib/async/exception.h
@@ -0,0 +1,84 @@
+// 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 LIB_ASYNC_EXCEPTION_H_
+#define LIB_ASYNC_EXCEPTION_H_
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Handles receipt of packets containing exception reports.
+//
+// The |status| is |ZX_OK| if the packet was successfully delivered and |data|
+// contains the information from the packet, otherwise |data| is null.
+// The |status| is |ZX_ERR_CANCELED| if the dispatcher was shut down.
+typedef void(async_exception_handler_t)(async_dispatcher_t* dispatcher,
+                                        async_exception_t* exception,
+                                        zx_status_t status,
+                                        const zx_port_packet_t* report);
+
+// Holds content for an exception packet receiver and its handler.
+//
+// The client is responsible for retaining the structure in memory
+// (and unmodified) until all packets have been received by the handler or the
+// dispatcher shuts down.
+//
+// Multiple packets may be delivered to the same receiver concurrently.
+struct async_exception {
+    // Private state owned by the dispatcher, initialize to zero with |ASYNC_STATE_INIT|.
+    async_state_t state;
+
+    // The handler to invoke when a packet is received.
+    async_exception_handler_t* handler;
+
+    // The task we're watching.
+    zx_handle_t task;
+
+    // The options to pass to zx_task_bind_exception_port().
+    uint32_t options;
+};
+
+// Bind the async port to the task's exception port.
+//
+// Returns |ZX_OK| if task's exception port was successfully bound to.
+// Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+// Other error values are possible. See the documentation for
+// |zx_task_bind_exception_port()|.
+//
+// This operation is thread-safe.
+zx_status_t async_bind_exception_port(async_dispatcher_t* dispatcher,
+                                      async_exception_t* exception);
+
+// Unbind the async port from |task|'s exception port.
+//
+// Returns |ZX_OK| if the task's exception port was successfully unbound.
+// Returns |ZX_ERR_NOT_FOUND| if the port is not bound.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+// Other error values are possible. See the documentation for
+// |zx_task_bind_exception_port()|.
+//
+// This operation is thread-safe.
+zx_status_t async_unbind_exception_port(async_dispatcher_t* dispatcher,
+                                        async_exception_t* exception);
+
+// Resume |task| after having processed an exception for it.
+// |options| is passed to |zx_task_resume_from_exception()|.
+//
+// Returns |ZX_OK| if the task was resumed.
+// Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+// Other error values are possible. See the documentation for
+// |zx_task_resume_from_exception()|.
+//
+// This operation is thread-safe.
+zx_status_t async_resume_from_exception(async_dispatcher_t* dispatcher,
+                                        async_exception_t* exception,
+                                        zx_handle_t task,
+                                        uint32_t options);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_EXCEPTION_H_
diff --git a/pkg/async/include/lib/async/receiver.h b/pkg/async/include/lib/async/receiver.h
new file mode 100644
index 0000000..453df71
--- /dev/null
+++ b/pkg/async/include/lib/async/receiver.h
@@ -0,0 +1,52 @@
+// 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 LIB_ASYNC_RECEIVER_H_
+#define LIB_ASYNC_RECEIVER_H_
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Handles receipt of packets containing user supplied data.
+//
+// The |status| is |ZX_OK| if the packet was successfully delivered and |data|
+// contains the information from the packet, otherwise |data| is null.
+typedef void(async_receiver_handler_t)(async_dispatcher_t* dispatcher,
+                                       async_receiver_t* receiver,
+                                       zx_status_t status,
+                                       const zx_packet_user_t* data);
+
+// Holds content for a packet receiver and its handler.
+//
+// After successfully queuing packets to the receiver, the client is responsible
+// for retaining the structure in memory (and unmodified) until all packets have
+// been received by the handler or the dispatcher shuts down.  There is no way
+// to cancel a packet which has been queued.
+//
+// Multiple packets may be delivered to the same receiver concurrently.
+struct async_receiver {
+    // Private state owned by the dispatcher, initialize to zero with |ASYNC_STATE_INIT|.
+    async_state_t state;
+
+    // The handler to invoke when a packet is received.
+    async_receiver_handler_t* handler;
+};
+
+// Enqueues a packet of data for delivery to a receiver.
+//
+// The |data| will be copied into the packet.  May be NULL to create a
+// zero-initialized packet payload.
+//
+// Returns |ZX_OK| if the packet was successfully enqueued.
+// Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+//
+// This operation is thread-safe.
+zx_status_t async_queue_packet(async_dispatcher_t* dispatcher, async_receiver_t* receiver,
+                               const zx_packet_user_t* data);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_RECEIVER_H_
\ No newline at end of file
diff --git a/pkg/async/include/lib/async/task.h b/pkg/async/include/lib/async/task.h
new file mode 100644
index 0000000..ee0b295
--- /dev/null
+++ b/pkg/async/include/lib/async/task.h
@@ -0,0 +1,70 @@
+// 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 LIB_ASYNC_TASK_H_
+#define LIB_ASYNC_TASK_H_
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Handles execution of a posted task.
+//
+// The |status| is |ZX_OK| if the task's deadline elapsed and the task should run.
+// The |status| is |ZX_ERR_CANCELED| if the dispatcher was shut down before
+// the task's handler ran or the task was canceled.
+typedef void(async_task_handler_t)(async_dispatcher_t* dispatcher,
+                                   async_task_t* task,
+                                   zx_status_t status);
+
+// Holds context for a task and its handler.
+//
+// After successfully posting the task, the client is responsible for retaining
+// the structure in memory (and unmodified) until the task's handler runs, the task
+// is successfully canceled, or the dispatcher shuts down.  Thereafter, the task
+// may be posted again or destroyed.
+struct async_task {
+    // Private state owned by the dispatcher, initialize to zero with |ASYNC_STATE_INIT|.
+    async_state_t state;
+
+    // The task's handler function.
+    async_task_handler_t* handler;
+
+    // The task's deadline must be expressed in the time base used by the asynchronous
+    // dispatcher (usually |ZX_CLOCK_MONOTONIC| except in unit tests).
+    // See |async_now()| for details.
+    zx_time_t deadline;
+};
+
+// Posts a task to run on or after its deadline following all posted
+// tasks with lesser or equal deadlines.
+//
+// The task's handler will be invoked exactly once unless the task is canceled.
+// When the dispatcher is shutting down (being destroyed), the handlers of
+// all remaining tasks will be invoked with a status of |ZX_ERR_CANCELED|.
+//
+// Returns |ZX_OK| if the task was successfully posted.
+// Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+//
+// This operation is thread-safe.
+zx_status_t async_post_task(async_dispatcher_t* dispatcher, async_task_t* task);
+
+// Cancels the task associated with |task|.
+//
+// If successful, the task's handler will not run.
+//
+// Returns |ZX_OK| if the task was pending and it has been successfully
+// canceled; its handler will not run again and can be released immediately.
+// Returns |ZX_ERR_NOT_FOUND| if there was no pending task either because it
+// already ran, had not been posted, or has been dequeued and is pending
+// execution (perhaps on another thread).
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+//
+// This operation is thread-safe.
+zx_status_t async_cancel_task(async_dispatcher_t* dispatcher, async_task_t* task);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_TASK_H_
\ No newline at end of file
diff --git a/pkg/async/include/lib/async/time.h b/pkg/async/include/lib/async/time.h
new file mode 100644
index 0000000..fe62cd5
--- /dev/null
+++ b/pkg/async/include/lib/async/time.h
@@ -0,0 +1,19 @@
+// 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 LIB_ASYNC_TIME_H_
+#define LIB_ASYNC_TIME_H_
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Returns the current time in the dispatcher's timebase.
+// For most loops, this is generally obtained from |ZX_CLOCK_MONOTONIC|
+// but certain loops may use a different tiembase, notably for testing.
+zx_time_t async_now(async_dispatcher_t* dispatcher);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_TIME_H_
\ No newline at end of file
diff --git a/pkg/async/include/lib/async/trap.h b/pkg/async/include/lib/async/trap.h
new file mode 100644
index 0000000..814d9ef
--- /dev/null
+++ b/pkg/async/include/lib/async/trap.h
@@ -0,0 +1,56 @@
+// 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 LIB_ASYNC_TRAP_H_
+#define LIB_ASYNC_TRAP_H_
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Handles an asynchronous trap access.
+//
+// The |status| is |ZX_OK| if the bell was received and |bell| contains the
+// information from the packet, otherwise |bell| is null.
+typedef void(async_guest_bell_trap_handler_t)(async_dispatcher_t* dispatcher,
+                                              async_guest_bell_trap_t* trap,
+                                              zx_status_t status,
+                                              const zx_packet_guest_bell_t* bell);
+
+// Holds context for a bell trap and its handler.
+//
+// After successfully posting setting the trap, the client is responsible for retaining
+// the structure in memory (and unmodified) until the guest has been destroyed or the
+// dispatcher shuts down.  There is no way to cancel a trap which has been set.
+struct async_guest_bell_trap {
+    // Private state owned by the dispatcher, initialize to zero with |ASYNC_STATE_INIT|.
+    async_state_t state;
+
+    // The handler to invoke to handle the trap access.
+    async_guest_bell_trap_handler_t* handler;
+};
+
+// Sets a bell trap in the guest to be handled asynchronously via a handler.
+//
+// |guest| is the handle of the guest the trap will be set on.
+// |addr| is the base address for the trap in the guest's physical address space.
+// |length| is the size of the trap in the guest's physical address space.
+//
+// Returns |ZX_OK| if the trap was successfully set.
+// Returns |ZX_ERR_ACCESS_DENIED| if the guest does not have |ZX_RIGHT_WRITE|.
+// Returns |ZX_ERR_ALREADY_EXISTS| if a bell trap with the same |addr| exists.
+// Returns |ZX_ERR_INVALID_ARGS| if |addr| or |length| are invalid.
+// Returns |ZX_ERR_OUT_OF_RANGE| if |addr| or |length| are out of range of the
+// address space.
+// Returns |ZX_ERR_WRONG_TYPE| if |guest| is not a handle to a guest.
+// Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+//
+// This operation is thread-safe.
+zx_status_t async_set_guest_bell_trap(async_dispatcher_t* dispatcher, async_guest_bell_trap_t* trap,
+                                      zx_handle_t guest, zx_vaddr_t addr, size_t length);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_TRAP_H_
\ No newline at end of file
diff --git a/pkg/async/include/lib/async/wait.h b/pkg/async/include/lib/async/wait.h
new file mode 100644
index 0000000..d359979
--- /dev/null
+++ b/pkg/async/include/lib/async/wait.h
@@ -0,0 +1,74 @@
+// 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 LIB_ASYNC_WAIT_H_
+#define LIB_ASYNC_WAIT_H_
+
+#include <lib/async/dispatcher.h>
+
+__BEGIN_CDECLS
+
+// Handles completion of asynchronous wait operations.
+//
+// The |status| is |ZX_OK| if the wait was satisfied and |signal| is non-null.
+// The |status| is |ZX_ERR_CANCELED| if the dispatcher was shut down before
+// the task's handler ran or the task was canceled.
+typedef void(async_wait_handler_t)(async_dispatcher_t* dispatcher,
+                                   async_wait_t* wait,
+                                   zx_status_t status,
+                                   const zx_packet_signal_t* signal);
+
+// Holds context for an asynchronous wait operation and its handler.
+//
+// After successfully beginning the wait, the client is responsible for retaining
+// the structure in memory (and unmodified) until the wait's handler runs, the wait
+// is successfully canceled, or the dispatcher shuts down.  Thereafter, the wait
+// may be started begun or destroyed.
+struct async_wait {
+    // Private state owned by the dispatcher, initialize to zero with |ASYNC_STATE_INIT|.
+    async_state_t state;
+
+    // The wait's handler function.
+    async_wait_handler_t* handler;
+
+    // The object to wait for signals on.
+    zx_handle_t object;
+
+    // The set of signals to wait for.
+    zx_signals_t trigger;
+};
+
+// Begins asynchronously waiting for an object to receive one or more signals
+// specified in |wait|.  Invokes the handler when the wait completes.
+//
+// The wait's handler will be invoked exactly once unless the wait is canceled.
+// When the dispatcher is shutting down (being destroyed), the handlers of
+// all remaining waits will be invoked with a status of |ZX_ERR_CANCELED|.
+//
+// Returns |ZX_OK| if the wait was successfully begun.
+// Returns |ZX_ERR_ACCESS_DENIED| if the object does not have |ZX_RIGHT_WAIT|.
+// Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+//
+// This operation is thread-safe.
+zx_status_t async_begin_wait(async_dispatcher_t* dispatcher, async_wait_t* wait);
+
+// Cancels the wait associated with |wait|.
+//
+// If successful, the wait's handler will not run.
+//
+// Returns |ZX_OK| if the wait was pending and it has been successfully
+// canceled; its handler will not run again and can be released immediately.
+// Returns |ZX_ERR_NOT_FOUND| if there was no pending wait either because it
+// already completed, had not been started, or its completion packet has been
+// dequeued from the port and is pending delivery to its handler (perhaps on
+// another thread).
+// Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.
+//
+// This operation is thread-safe.
+zx_status_t async_cancel_wait(async_dispatcher_t* dispatcher, async_wait_t* wait);
+
+__END_CDECLS
+
+#endif  // LIB_ASYNC_WAIT_H_
\ No newline at end of file
diff --git a/pkg/async/meta.json b/pkg/async/meta.json
new file mode 100644
index 0000000..31913e9
--- /dev/null
+++ b/pkg/async/meta.json
@@ -0,0 +1,31 @@
+{
+  "banjo_deps": [], 
+  "deps": [], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/async/ops.c", 
+    "pkg/async/include/lib/async/dispatcher.h", 
+    "pkg/async/include/lib/async/exception.h", 
+    "pkg/async/include/lib/async/receiver.h", 
+    "pkg/async/include/lib/async/task.h", 
+    "pkg/async/include/lib/async/time.h", 
+    "pkg/async/include/lib/async/trap.h", 
+    "pkg/async/include/lib/async/wait.h"
+  ], 
+  "headers": [
+    "pkg/async/include/lib/async/dispatcher.h", 
+    "pkg/async/include/lib/async/exception.h", 
+    "pkg/async/include/lib/async/receiver.h", 
+    "pkg/async/include/lib/async/task.h", 
+    "pkg/async/include/lib/async/time.h", 
+    "pkg/async/include/lib/async/trap.h", 
+    "pkg/async/include/lib/async/wait.h"
+  ], 
+  "include_dir": "pkg/async/include", 
+  "name": "async", 
+  "root": "pkg/async", 
+  "sources": [
+    "pkg/async/ops.c"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/async/ops.c b/pkg/async/ops.c
new file mode 100644
index 0000000..e3b1d6d
--- /dev/null
+++ b/pkg/async/ops.c
@@ -0,0 +1,62 @@
+// 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.
+
+#include <lib/async/receiver.h>
+#include <lib/async/task.h>
+#include <lib/async/time.h>
+#include <lib/async/trap.h>
+#include <lib/async/wait.h>
+
+zx_time_t async_now(async_dispatcher_t* dispatcher) {
+    return dispatcher->ops->v1.now(dispatcher);
+}
+
+zx_status_t async_begin_wait(async_dispatcher_t* dispatcher, async_wait_t* wait) {
+    return dispatcher->ops->v1.begin_wait(dispatcher, wait);
+}
+
+zx_status_t async_cancel_wait(async_dispatcher_t* dispatcher, async_wait_t* wait) {
+    return dispatcher->ops->v1.cancel_wait(dispatcher, wait);
+}
+
+zx_status_t async_post_task(async_dispatcher_t* dispatcher, async_task_t* task) {
+    return dispatcher->ops->v1.post_task(dispatcher, task);
+}
+
+zx_status_t async_cancel_task(async_dispatcher_t* dispatcher, async_task_t* task) {
+    return dispatcher->ops->v1.cancel_task(dispatcher, task);
+}
+
+zx_status_t async_queue_packet(async_dispatcher_t* dispatcher, async_receiver_t* receiver,
+                               const zx_packet_user_t* data) {
+    return dispatcher->ops->v1.queue_packet(dispatcher, receiver, data);
+}
+
+zx_status_t async_set_guest_bell_trap(async_dispatcher_t* dispatcher, async_guest_bell_trap_t* trap,
+                                      zx_handle_t guest, zx_vaddr_t addr, size_t length) {
+    return dispatcher->ops->v1.set_guest_bell_trap(dispatcher, trap, guest, addr, length);
+}
+
+zx_status_t async_bind_exception_port(async_dispatcher_t* dispatcher,
+                                      async_exception_t* exception) {
+    if (dispatcher->ops->version < ASYNC_OPS_V2)
+        return ZX_ERR_NOT_SUPPORTED;
+    return dispatcher->ops->v2.bind_exception_port(dispatcher, exception);
+}
+
+zx_status_t async_unbind_exception_port(async_dispatcher_t* dispatcher,
+                                        async_exception_t* exception) {
+    if (dispatcher->ops->version < ASYNC_OPS_V2)
+        return ZX_ERR_NOT_SUPPORTED;
+    return dispatcher->ops->v2.unbind_exception_port(dispatcher, exception);
+}
+
+zx_status_t async_resume_from_exception(async_dispatcher_t* dispatcher,
+                                        async_exception_t* exception,
+                                        zx_handle_t task,
+                                        uint32_t options) {
+    if (dispatcher->ops->version < ASYNC_OPS_V2)
+        return ZX_ERR_NOT_SUPPORTED;
+    return dispatcher->ops->v2.resume_from_exception(dispatcher, exception, task, options);
+}
diff --git a/pkg/fdio/include/lib/fdio/debug.h b/pkg/fdio/include/lib/fdio/debug.h
new file mode 100644
index 0000000..22acfb6
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/debug.h
@@ -0,0 +1,20 @@
+// 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 <stdio.h>
+#include <zircon/compiler.h>
+
+__BEGIN_CDECLS
+
+// per-file chatty debug macro
+#define xprintf(fmt, args...)                                                                      \
+    do {                                                                                           \
+        if (ZXDEBUG) {                                                                             \
+            printf("%s:%d: " fmt, __FILE__, __LINE__, ##args);                                     \
+        }                                                                                          \
+    } while (0)
+
+__END_CDECLS
diff --git a/pkg/fdio/include/lib/fdio/io.h b/pkg/fdio/include/lib/fdio/io.h
new file mode 100644
index 0000000..b567cf4
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/io.h
@@ -0,0 +1,62 @@
+// 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 <limits.h>
+#include <poll.h>
+#include <stdbool.h>
+#include <unistd.h> // for ssize_t
+
+#include <zircon/types.h>
+#include <zircon/compiler.h>
+
+#include <lib/fdio/limits.h>
+
+// flag on handle args in processargs
+// instructing that this fd should be dup'd to 0/1/2
+// and be used for all of stdio
+#define FDIO_FLAG_USE_FOR_STDIO 0x8000
+
+// events for fdio_wait_fd()
+#define FDIO_EVT_READABLE POLLIN
+#define FDIO_EVT_WRITABLE POLLOUT
+#define FDIO_EVT_ERROR POLLERR
+#define FDIO_EVT_PEER_CLOSED POLLRDHUP
+#define FDIO_EVT_ALL (POLLIN | POLLOUT | POLLERR | POLLRDHUP)
+
+__BEGIN_CDECLS
+
+// wait until one or more events are pending
+zx_status_t fdio_wait_fd(int fd, uint32_t events, uint32_t* pending, zx_time_t deadline);
+
+// create a fd that works with wait APIs (epoll, select, etc.) from a handle
+// and expected signals (signals_in/signals_out correspond to POLLIN/POLLOUT
+// events respectively). the handle will be closed when the fd is closed, unless
+// shared_handle is true.
+int fdio_handle_fd(zx_handle_t h, zx_signals_t signals_in, zx_signals_t signals_out, bool shared_handle);
+
+// invoke a raw fdio ioctl
+ssize_t fdio_ioctl(int fd, int op, const void* in_buf, size_t in_len, void* out_buf, size_t out_len);
+
+// create a pipe, installing one half in a fd, returning the other
+// for transport to another process
+zx_status_t fdio_pipe_half(zx_handle_t* handle, uint32_t* type);
+
+// Get a read-only VMO containing the whole contents of the file.
+// This function creates a clone of the underlying VMO when possible, falling
+// back to eagerly reading the contents into a freshly-created VMO.
+zx_status_t fdio_get_vmo_copy(int fd, zx_handle_t* out_vmo);
+
+// Gets a read-only VMO containing a clone of the underlying VMO.
+// This function will fail rather than copying the contents if it cannot clone.
+zx_status_t fdio_get_vmo_clone(int fd, zx_handle_t* out_vmo);
+
+// Get a read-only handle to the exact VMO used by the file system server to
+// represent the file. This function fails if the server does not have an exact
+// VMO representation of the file (e.g., if fdio_get_vmo would need to copy
+// or clone data into a new VMO).
+zx_status_t fdio_get_vmo_exact(int fd, zx_handle_t* out_vmo);
+
+__END_CDECLS
diff --git a/pkg/fdio/include/lib/fdio/limits.h b/pkg/fdio/include/lib/fdio/limits.h
new file mode 100644
index 0000000..d6c5b68
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/limits.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.
+
+#pragma once
+
+#include <limits.h>
+
+// Maximum number of fds per process.
+#define FDIO_MAX_FD 256
+
+// Maximum handles used in open/clone/create.
+#define FDIO_MAX_HANDLES 3
+
+// fdio_ops_t's read/write are able to do io of
+// at least this size.
+#define FDIO_CHUNK_SIZE 8192
+
+// Maximum size for an ioctl input.
+#define FDIO_IOCTL_MAX_INPUT 1024
+
+// Maximum length of a filename.
+#define FDIO_MAX_FILENAME NAME_MAX
diff --git a/pkg/fdio/include/lib/fdio/namespace.h b/pkg/fdio/include/lib/fdio/namespace.h
new file mode 100644
index 0000000..dcd7043
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/namespace.h
@@ -0,0 +1,95 @@
+// 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.
+
+#pragma once
+
+#include <stdint.h>
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS;
+
+typedef struct fdio_namespace fdio_ns_t;
+
+
+// Create a new, empty namespace
+zx_status_t fdio_ns_create(fdio_ns_t** out);
+
+// Destroy and deallocate a namespace
+// Will fail (ZX_ERR_BAD_STATE) if the namespace is in use.
+zx_status_t fdio_ns_destroy(fdio_ns_t* ns);
+
+// Create a new directory within a namespace, bound to the
+// directory-protocol-compatible handle h
+// The path must be an absolute path, like "/x/y/z", containing
+// no "." nor ".." entries.  It is relative to the root of the
+// namespace.
+//
+// The handle is not closed on failure.
+//
+// Will fail with ZX_ERR_BAD_STATE if the namespace is in use.
+zx_status_t fdio_ns_bind(fdio_ns_t* ns, const char* path, zx_handle_t h);
+
+// Create a new directory within a namespace, bound to the
+// directory referenced by the file descriptor fd.
+// The path must be an absolute path, like "/x/y/z", containing
+// no "." nor ".." entries.  It is relative to the root of the
+// namespace.
+//
+// The fd is not closed on success or failure.
+// Closing the fd after success does not affect namespace.
+//
+// Failures:
+// ZX_ERR_BAD_STATE: Namespace is already in use and immutable.
+// ZX_ERR_ALREADY_EXISTS: There is already a mounted directory there.
+// ZX_ERR_NOT_SUPPORTED: This path would shadow a mounted directory.
+zx_status_t fdio_ns_bind_fd(fdio_ns_t* ns, const char* path, int fd);
+
+// Open the root directory of the namespace as a file descriptor
+int fdio_ns_opendir(fdio_ns_t* ns);
+
+// chdir to / in the provided namespace
+zx_status_t fdio_ns_chdir(fdio_ns_t* ns);
+
+// Replace the fdio "global" namespace with the provided namespace
+zx_status_t fdio_ns_install(fdio_ns_t* ns);
+
+// Retrieve the fdio "global" namespace (if any).
+zx_status_t fdio_ns_get_installed(fdio_ns_t** ns);
+
+typedef struct fdio_flat_namespace {
+    size_t count;
+    zx_handle_t* handle;
+    uint32_t* type;
+    const char* const* path;
+} fdio_flat_namespace_t;
+
+// On success the caller takes ownership of a fdio_flat_namespace_t
+// containing a flat representation of the exported namespace (the
+// one provided in 'ns' or the active root namespace, respectively.)
+// The handles are CLONEs of the handles in the namespace and also
+// belong to the caller.
+// The whole data structure can be released with free(), keeping in
+// mind that the handles should be used or closed first.
+zx_status_t fdio_ns_export(fdio_ns_t* ns, fdio_flat_namespace_t** out);
+zx_status_t fdio_ns_export_root(fdio_flat_namespace_t** out);
+
+// Attempt to connect to a service through the namespace.
+// The handle is always consumed.  It will be closed on error
+// or passed to the remote service on success.
+// The path must be an absolute path starting with / and containing
+// no ".." or "." or empty segments.
+zx_status_t fdio_ns_connect(fdio_ns_t* ns, const char* path,
+                            uint32_t zxflags, zx_handle_t h);
+
+// Attempt a pipelined open through a namespace.
+// Success only indicates that the open was sent.
+// If the remote fails, the returned handle's peer will be closed.
+// The path must be an absolute path starting with / and containing
+// no ".." or "." or empty segments.
+zx_status_t fdio_ns_open(fdio_ns_t* ns, const char* path,
+                         uint32_t zxflags, zx_handle_t* out);
+
+__END_CDECLS;
diff --git a/pkg/fdio/include/lib/fdio/private.h b/pkg/fdio/include/lib/fdio/private.h
new file mode 100644
index 0000000..2ceee14
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/private.h
@@ -0,0 +1,22 @@
+// 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.
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+#include <stdint.h>
+
+__BEGIN_CDECLS;
+
+// WARNING: These APIs are subject to change
+
+// __fdio_cleanpath cleans an input path, placing the output
+// in out, which is a buffer of at least "PATH_MAX" bytes.
+//
+// 'outlen' returns the length of the path placed in out, and 'is_dir'
+// is set to true if the returned path must be a directory.
+zx_status_t __fdio_cleanpath(const char* in, char* out, size_t* outlen, bool* is_dir);
+
+__END_CDECLS;
diff --git a/pkg/fdio/include/lib/fdio/spawn.h b/pkg/fdio/include/lib/fdio/spawn.h
new file mode 100644
index 0000000..94a656d
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/spawn.h
@@ -0,0 +1,217 @@
+// 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.
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+__BEGIN_CDECLS
+
+// The |fdio_spawn| and |fdio_spawn_etc| functions allow some or all of the
+// environment of the running process to be shared with the process being
+// spawned.
+
+// Provides the spawned process with the job in which the process was created.
+//
+// The spawned process receives the job using the |PA_JOB_DEFAULT| process
+// argument.
+#define FDIO_SPAWN_CLONE_JOB ((uint32_t)0x0001u)
+
+// Provides the spawned process with the shared library loader resolved via
+// fuchsia.process.Resolver (if resolved), or that which is used by this
+// process.
+//
+// The shared library loader is passed as |PA_LDSVC_LOADER|.
+#define FDIO_SPAWN_DEFAULT_LDSVC ((uint32_t)0x0002u)
+// FDIO_SPAWN_CLONE_LDSVC is the same as FDIO_SPAWN_DEFAULT_LDSVC.
+// TODO(ZX-3031): this name is deprecated.
+#define FDIO_SPAWN_CLONE_LDSVC ((uint32_t)0x0002u)
+
+// Clones the filesystem namespace into the spawned process.
+#define FDIO_SPAWN_CLONE_NAMESPACE ((uint32_t)0x0004u)
+
+// Clones file descriptors 0, 1, and 2 into the spawned process.
+//
+// Skips any of these file descriptors that are closed without generating an
+// error.
+#define FDIO_SPAWN_CLONE_STDIO ((uint32_t)0x0008u)
+
+// Clones the environment into the spawned process.
+#define FDIO_SPAWN_CLONE_ENVIRON ((uint32_t)0x0010u)
+
+// Clones all of the above into the spawned process.
+#define FDIO_SPAWN_CLONE_ALL ((uint32_t)0xFFFFu)
+
+// Spawn a process in the given job.
+//
+// The program for the process is loaded from the given |path| and passed |argv|.
+// The aspects of this process' environment indicated by |flags| are shared with
+// the process. If the target program begins with |#!resolve | then the binary is
+// resolved by url via |fuchsia.process.Resolver|.
+//
+// The |argv| array must be terminated with a null pointer.
+//
+// If |job| is |ZX_HANDLE_INVALID|, then the process is spawned in
+// |zx_job_default()|. Does not take ownership of |job|.
+//
+// Upon success, |process_out| will be a handle to the process.
+zx_status_t fdio_spawn(zx_handle_t job,
+                       uint32_t flags,
+                       const char* path,
+                       const char* const* argv,
+                       zx_handle_t* process_out);
+
+// The |fdio_spawn_etc| function allows the running process to control the file
+// descriptor table in the process being spawned.
+
+// Duplicate a descriptor |local_fd| into |target_fd| in the spawned process.
+//
+// Uses the |fd| entry in the |fdio_spawn_action_t| union.
+#define FDIO_SPAWN_ACTION_CLONE_FD ((uint32_t)0x0001u)
+
+// Transfer local descriptor |local_fd| into |target_fd| in the spawned process.
+//
+// This action will fail if |local_fd| is not a valid |local_fd|, if |local_fd|
+// has been duplicated, if |local_fd| is being used in an io operation, or if
+// |local_fd| does not support this operation.
+//
+// From the point of view of the calling process, the |local_fd| will appear to
+// have been closed, regardless of whether the |fdio_spawn_etc| call succeeds.
+//
+// Uses the |fd| entry in the |fdio_spawn_action_t| union.
+#define FDIO_SPAWN_ACTION_TRANSFER_FD ((uint32_t)0x0002u)
+
+// Add the given entry to the namespace of the spawned process.
+//
+// If |FDIO_SPAWN_CLONE_NAMESPACE| is specified via |flags|, the namespace entry
+// is added to the cloned namespace from the calling process.
+//
+// The given handle will be closed regardless of whether the |fdio_spawn_etc|
+// call succeeds.
+//
+// Uses the |ns| entry in the |fdio_spawn_action_t| union.
+#define FDIO_SPAWN_ACTION_ADD_NS_ENTRY ((uint32_t)0x0003u)
+
+// Add the given handle to the process arguments of the spawned process.
+//
+// The given handle will be closed regardless of whether the |fdio_spawn_etc|
+// call succeeds.
+//
+// Uses the |h| entry in the |fdio_spawn_action_t| union.
+#define FDIO_SPAWN_ACTION_ADD_HANDLE ((uint32_t)0x0004u)
+
+// Sets the name of the spawned process to the given name.
+//
+// Overrides the default of use the first argument to name the process.
+//
+// Uses the |name| entry in the |fdio_spawn_action_t| union.
+#define FDIO_SPAWN_ACTION_SET_NAME ((uint32_t)0x0005u)
+
+// Instructs |fdio_spawn_etc| which actions to take.
+typedef struct fdio_spawn_action fdio_spawn_action_t;
+struct fdio_spawn_action {
+    // The action to take.
+    //
+    // See |FDIO_SPAWN_ACTION_*| above. If |action| is invalid, the action will
+    // be ignored (rather than generate an error).
+    uint32_t action;
+    union {
+        struct {
+            // The file descriptor in this process to clone or transfer.
+            int local_fd;
+
+            // The file descriptor in the spawned process that will receive the
+            // clone or transfer.
+            int target_fd;
+        } fd;
+        struct {
+            // The prefix in which to install the given handle in the namespace
+            // of the spawned process.
+            const char* prefix;
+
+            // The handle to install with the given prefix in the namespace of
+            // the spawned process.
+            zx_handle_t handle;
+        } ns;
+        struct {
+            // The process argument identifier of the handle to pass to the
+            // spawned process.
+            uint32_t id;
+
+            // The handle to pass to the process on startup.
+            zx_handle_t handle;
+        } h;
+        struct {
+            // The name to assign to the spawned process.
+            const char* data;
+        } name;
+    };
+};
+
+// The maximum size for error messages from |fdio_spawn_etc|.
+//
+// Including the null terminator.
+#define FDIO_SPAWN_ERR_MSG_MAX_LENGTH ((size_t)1024u)
+
+// Spawn a process in the given job.
+//
+// The binary for the process is loaded from the given |path| and passed |argv|.
+// The aspects of this process' environment indicated by |clone| are shared with
+// the process.
+//
+// The spawned process is also given |environ| as its environment and the given
+// |actions| are applied when creating the process.
+//
+// The |argv| array must be terminated with a null pointer.
+//
+// If non-null, the |environ| array must be terminated with a null pointer.
+//
+// If non-null, the |err_msg_out| buffer must have space for
+// |FDIO_SPAWN_ERR_MSG_MAX_LENGTH| bytes.
+//
+// If both |FDIO_SPAWN_CLONE_ENVIRON| and |environ| are specified, then the
+// spawned process is given |environ| as its environment. If both
+// |FDIO_SPAWN_CLONE_STDIO| and |actions| that target any of fds 0, 1, and 2 are
+// specified, then the actions that target those fds will control their
+// semantics in the spawned process.
+//
+// If |job| is |ZX_HANDLE_INVALID|, then the process is spawned in
+// |zx_job_default()|. Does not take ownership of |job|.
+//
+// Upon success, |process_out| will be a handle to the process. Upon failure, if
+// |err_msg_out| is not null, an error message will be we written to
+// |err_msg_out|, including a null terminator.
+zx_status_t fdio_spawn_etc(zx_handle_t job,
+                           uint32_t flags,
+                           const char* path,
+                           const char* const* argv,
+                           const char* const* environ,
+                           size_t action_count,
+                           const fdio_spawn_action_t* actions,
+                           zx_handle_t* process_out,
+                           char err_msg_out[FDIO_SPAWN_ERR_MSG_MAX_LENGTH]);
+
+// Spawn a process using the given executable in the given job.
+//
+// See |fdio_spawn_etc| for details. Rather than loading the binary for the
+// process from a path, this function receives the binary as the contents of a
+// vmo.
+//
+// Always consumes |executable_vmo|.
+zx_status_t fdio_spawn_vmo(zx_handle_t job,
+                           uint32_t flags,
+                           zx_handle_t executable_vmo,
+                           const char* const* argv,
+                           const char* const* environ,
+                           size_t action_count,
+                           const fdio_spawn_action_t* actions,
+                           zx_handle_t* process_out,
+                           char err_msg_out[FDIO_SPAWN_ERR_MSG_MAX_LENGTH]);
+
+__END_CDECLS
diff --git a/pkg/fdio/include/lib/fdio/unsafe.h b/pkg/fdio/include/lib/fdio/unsafe.h
new file mode 100644
index 0000000..c0f7e41
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/unsafe.h
@@ -0,0 +1,65 @@
+// 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.
+
+#pragma once
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+#include <stdint.h>
+
+__BEGIN_CDECLS;
+
+// WARNING: These interfaces exist to allow integration of fdio file
+// descriptors with handle-centric message loops.  If used incorrectly
+// they can seriously mess up the state of fdio, fds, etc.
+
+typedef struct fdio fdio_t;
+
+// This looks up a file descriptor, and if it exists,
+// upreferences the fdio_t under it and returns that.
+// fdio_unsafe_release() must be called later to release
+// the reference.
+//
+// If the fd does not exist, it returns NULL
+fdio_t* fdio_unsafe_fd_to_io(int fd);
+
+// Returns the handle corresponding to the underlying fdio,
+// if there is one. Returns ZX_HANDLE_INVALID otherwise.
+//
+// Since this handle is borrowed from the underlying fdio_t, it
+// is unsafe to close it or use it after fdio_unsafe_release is called.
+zx_handle_t fdio_unsafe_borrow_channel(fdio_t* io);
+
+// Releases a reference on a fdio_t.  Used to "return"
+// a fdio_t obtained from fdio_unsafe_fd_to_io() when you're
+// done with it.
+void fdio_unsafe_release(fdio_t* io);
+
+// This given a fdio_t, and a bitmask of posix-style events
+// (EPOLLIN, EPOLLOUT, EPOLLERR), this returns a handle that
+// may be waited upon and a  bitmask of which signals to
+// wait on for the desired events.
+//
+// The handle belongs to the fdio_t, is not duplicated,
+// and may be closed() by the fdio library but MUST NOT
+// be closed by the caller.
+//
+// If waiting is not supported by this fdio_t, the returned
+// handle is ZX_HANDLE_INVALID.
+//
+// This function is only safe to call on a fdio_t you
+// hold a reference to.  It is not required that fdio_unsafe_wait_end() be
+// called after this.
+void fdio_unsafe_wait_begin(fdio_t* io, uint32_t events,
+                            zx_handle_t* handle_out, zx_signals_t* signals_out);
+
+// This given a set of signals observed on a handle obtained
+// from fdio_unsafe_wait_begin() returns a set of posix-style events
+// that are indicated.
+//
+// This function is only safe to call on a fdio_t you
+// hold a reference to.
+void fdio_unsafe_wait_end(fdio_t* io, zx_signals_t signals, uint32_t* events_out);
+
+__END_CDECLS;
diff --git a/pkg/fdio/include/lib/fdio/util.h b/pkg/fdio/include/lib/fdio/util.h
new file mode 100644
index 0000000..fd30748
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/util.h
@@ -0,0 +1,115 @@
+// 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>
+#include <zircon/compiler.h>
+#include <stdint.h>
+#include <unistd.h>
+
+__BEGIN_CDECLS
+
+// These routines are "internal" to fdio but used by some companion
+// code like userboot and devmgr
+
+typedef struct fdio fdio_t;
+
+// Utilities to help assemble handles for a new process
+// may return up to FDIO_MAX_HANDLES
+zx_status_t fdio_clone_cwd(zx_handle_t* handles, uint32_t* types);
+zx_status_t fdio_clone_fd(int fd, int newfd, zx_handle_t* handles, uint32_t* types);
+zx_status_t fdio_transfer_fd(int fd, int newfd, zx_handle_t* handles, uint32_t* types);
+
+// Attempt to create an fdio fd from some handles and their associated types,
+// as returned from fdio_transfer_fd.
+//
+// Can only create fds around:
+// - Remote IO objects
+// - Pipes
+// - Connected sockets
+//
+// This function transfers ownership of handles to the fd on success, and
+// closes them on failure.
+zx_status_t fdio_create_fd(zx_handle_t* handles, uint32_t* types, size_t hcount, int* fd_out);
+
+// attempt to install a fdio in the unistd fd table
+// if fd >= 0, request a specific fd, and starting_fd is ignored
+// if fd < 0, request the first available fd >= starting_fd
+// returns fd on success
+// the fdio must have been upref'd on behalf of the fdtab first
+int fdio_bind_to_fd(fdio_t* io, int fd, int starting_fd);
+
+// attempt to detach an fdio_t from the fd table
+// returns ZX_ERR_INVALID_ARGS if fd is out of range or doesn't exist
+// returns ZX_ERR_UNAVAILABLE if the fd is busy or has been dup'd
+// returns fdio_t via io_out with refcount 1 on success
+zx_status_t fdio_unbind_from_fd(int fd, fdio_t** io_out);
+
+// If this fd represents a "service" (an rpc channel speaking
+// an unknown fidl protocol or a fuchsia.io.* protocol),
+// this call will return ZX_OK and return the underlying handle.
+// On both success and failure, the fd is effectively closed.
+//
+// ZX_ERR_NOT_SUPPORTED is returned if this fd does not represent
+// a FIDL transport
+//
+// ZX_ERR_UNAVAILABLE is returned if this fd has been dup()'d and
+// duplicates are sharing the FIDL transport
+zx_status_t fdio_get_service_handle(int fd, zx_handle_t* out);
+
+// creates a do-nothing fdio_t
+fdio_t* fdio_null_create(void);
+
+// Wraps a channel with an fdio_t using remote io.
+// Takes ownership of h and e.
+fdio_t* fdio_remote_create(zx_handle_t h, zx_handle_t event);
+
+// creates a fdio that wraps a log object
+// this will allocate a per-thread buffer (on demand) to assemble
+// entire log-lines and flush them on newline or buffer full.
+fdio_t* fdio_logger_create(zx_handle_t);
+
+typedef struct zxio_storage zxio_storage_t;
+
+// Creates an |fdio_t| that is backed by a |zxio_t|.
+//
+// The |zxio_t| is initialized with a null ops table. The |zxio_storage_t| for
+// the |zxio_t| is returned via |out_storage|. The client can re-initialize the
+// |zxio_storage_t| to customize the behavior of the |zxio_t|.
+//
+// To bind the |fdio_t| to a file descriptor, use |fdio_bind_to_fd|.
+//
+// Upon failure, returns NULL.
+fdio_t* fdio_zxio_create(zxio_storage_t** out_storage);
+
+// Attempt to connect a channel to a named service.
+// On success the channel is connected.  On failure
+// an error is returned and the handle is closed.
+zx_status_t fdio_service_connect(const char* svcpath, zx_handle_t h);
+
+// Attempt to connect a channel to a named service relative to dir.
+// On success the channel is connected.  On failure
+// an error is returned and the handle is closed.
+zx_status_t fdio_service_connect_at(zx_handle_t dir, const char* path, zx_handle_t h);
+
+// Same as |fdio_service_connect|, but allows the passing of flags.
+zx_status_t fdio_open(const char* path, uint32_t zxflags, zx_handle_t h);
+
+// Same as |fdio_service_connect_at, but allows the passing of flags.
+zx_status_t fdio_open_at(zx_handle_t dir, const char* path, uint32_t zxflags, zx_handle_t h);
+
+// Attempt to clone a service handle by doing a pipelined
+// CLONE operation, returning the new channel endpoint,
+// or ZX_HANDLE_INVALID.
+zx_handle_t fdio_service_clone(zx_handle_t h);
+
+// Attempt to clone a service handle by doing a pipelined
+// CLONE operation, using the provided serving channel.
+// On success srv is bound to a clone of h.  On failure
+// an error is returned and srv is closed.
+// Takes ownership of srv.
+zx_status_t fdio_service_clone_to(zx_handle_t h, zx_handle_t srv);
+
+__END_CDECLS
diff --git a/pkg/fdio/include/lib/fdio/vfs.h b/pkg/fdio/include/lib/fdio/vfs.h
new file mode 100644
index 0000000..f32ccb1
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/vfs.h
@@ -0,0 +1,82 @@
+// 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>
+#include <zircon/listnode.h>
+#include <zircon/compiler.h>
+
+#include <stdio.h>
+#include <unistd.h>  // ssize_t
+
+__BEGIN_CDECLS
+
+// On Fuchsia, the Block Device is transmitted by file descriptor, rather than
+// by path. This can prevent some racy behavior relating to FS start-up.
+#ifdef __Fuchsia__
+#define FS_FD_BLOCKDEVICE 200
+#endif
+
+// POSIX defines st_blocks to be the number of 512 byte blocks allocated
+// to the file. The "blkcnt" field of vnattr attempts to accomplish
+// this same goal, but by indirecting through VNATTR_BLKSIZE, we
+// reserve the right to change this "block size unit" (which is distinct from
+// "blksize", because POSIX) whenever we want.
+#define VNATTR_BLKSIZE 512
+
+typedef struct vnattr {
+    uint32_t valid;        // mask of which bits to set for setattr
+    uint32_t mode;
+    uint64_t inode;
+    uint64_t size;
+    uint64_t blksize;      // Block size for filesystem I/O
+    uint64_t blkcount;     // Number of VNATTR_BLKSIZE byte blocks allocated
+    uint64_t nlink;
+    uint64_t create_time;  // posix time (seconds since epoch)
+    uint64_t modify_time;  // posix time
+} vnattr_t;
+
+// mask that identifies what fields to set in setattr
+#define ATTR_CTIME  0000001
+#define ATTR_MTIME  0000002
+#define ATTR_ATIME  0000004  // not yet implemented
+
+// bits compatible with POSIX stat
+#define V_TYPE_MASK 0170000
+#define V_TYPE_SOCK 0140000
+#define V_TYPE_LINK 0120000
+#define V_TYPE_FILE 0100000
+#define V_TYPE_BDEV 0060000
+#define V_TYPE_DIR  0040000
+#define V_TYPE_CDEV 0020000
+#define V_TYPE_PIPE 0010000
+
+#define V_ISUID 0004000
+#define V_ISGID 0002000
+#define V_ISVTX 0001000
+#define V_IRWXU 0000700
+#define V_IRUSR 0000400
+#define V_IWUSR 0000200
+#define V_IXUSR 0000100
+#define V_IRWXG 0000070
+#define V_IRGRP 0000040
+#define V_IWGRP 0000020
+#define V_IXGRP 0000010
+#define V_IRWXO 0000007
+#define V_IROTH 0000004
+#define V_IWOTH 0000002
+#define V_IXOTH 0000001
+
+#define VTYPE_TO_DTYPE(mode) (((mode)&V_TYPE_MASK) >> 12)
+#define DTYPE_TO_VTYPE(type) (((type)&15) << 12)
+
+typedef struct vdirent {
+    uint64_t ino;
+    uint8_t size;
+    uint8_t type;
+    char name[0];
+} __PACKED vdirent_t;
+
+__END_CDECLS
diff --git a/pkg/fdio/include/lib/fdio/watcher.h b/pkg/fdio/include/lib/fdio/watcher.h
new file mode 100644
index 0000000..441edcf
--- /dev/null
+++ b/pkg/fdio/include/lib/fdio/watcher.h
@@ -0,0 +1,43 @@
+// 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/compiler.h>
+#include <lib/fdio/io.h>
+
+__BEGIN_CDECLS
+
+typedef zx_status_t (*watchdir_func_t)(int dirfd, int event, const char* fn, void* cookie);
+
+// This event occurs when a file is added or removed, including
+// (for fdio_watch_directory()) files that already exist.
+#define WATCH_EVENT_ADD_FILE 1
+#define WATCH_EVENT_REMOVE_FILE 2
+
+// This event occurs, once, when fdio_watch_directory() runs
+// out of existing files and has to start waiting for new
+// files to be added.
+#define WATCH_EVENT_IDLE 3
+
+// Call the provided callback (cb) for each file in directory
+// and each time a new file is added to the directory.
+//
+// If the callback returns a status other than ZX_OK, watching
+// stops and the callback's status is returned to the caller
+// of fdio_watch_directory.
+//
+// If the deadline expires, ZX_ERR_TIMED_OUT is returned to the
+// caller.  A deadline of ZX_TIME_INFINITE will never expire.
+//
+// The callback may use ZX_ERR_STOP as a way to signal to the
+// caller that it wants to stop because it found what it was
+// looking for, etc -- since this error code is not returned
+// by syscalls or public APIs, the callback does not need to
+// worry about it turning up normally.
+
+zx_status_t fdio_watch_directory(int dirfd, watchdir_func_t cb, zx_time_t deadline, void* cookie);
+
+
+__END_CDECLS
diff --git a/pkg/fdio/meta.json b/pkg/fdio/meta.json
new file mode 100644
index 0000000..51babcb
--- /dev/null
+++ b/pkg/fdio/meta.json
@@ -0,0 +1,32 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/eb/9ed8b78bc5865718b59bd2a3a47e3e28650f8f.debug", 
+      "dist": "arch/arm64/dist/libfdio.so", 
+      "link": "arch/arm64/lib/libfdio.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/fb/6715ba574ce88bcfca5045ee90fef94163808f.debug", 
+      "dist": "arch/x64/dist/libfdio.so", 
+      "link": "arch/x64/lib/libfdio.so"
+    }
+  }, 
+  "deps": [], 
+  "format": "shared", 
+  "headers": [
+    "pkg/fdio/include/lib/fdio/debug.h", 
+    "pkg/fdio/include/lib/fdio/io.h", 
+    "pkg/fdio/include/lib/fdio/limits.h", 
+    "pkg/fdio/include/lib/fdio/namespace.h", 
+    "pkg/fdio/include/lib/fdio/private.h", 
+    "pkg/fdio/include/lib/fdio/spawn.h", 
+    "pkg/fdio/include/lib/fdio/unsafe.h", 
+    "pkg/fdio/include/lib/fdio/util.h", 
+    "pkg/fdio/include/lib/fdio/vfs.h", 
+    "pkg/fdio/include/lib/fdio/watcher.h"
+  ], 
+  "include_dir": "pkg/fdio/include", 
+  "name": "fdio", 
+  "root": "pkg/fdio", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/fidl-async/bind.c b/pkg/fidl-async/bind.c
new file mode 100644
index 0000000..fad7132
--- /dev/null
+++ b/pkg/fidl-async/bind.c
@@ -0,0 +1,147 @@
+// 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.
+
+#include <lib/async/wait.h>
+#include <lib/fidl-async/bind.h>
+#include <stdlib.h>
+#include <string.h>
+#include <zircon/syscalls.h>
+
+typedef struct fidl_binding {
+    async_wait_t wait;
+    fidl_dispatch_t* dispatch;
+    async_dispatcher_t* dispatcher;
+    void* ctx;
+    const void* ops;
+} fidl_binding_t;
+
+typedef struct fidl_connection {
+    fidl_txn_t txn;
+    zx_handle_t channel;
+    zx_txid_t txid;
+    fidl_binding_t* binding;
+} fidl_connection_t;
+
+static zx_status_t fidl_reply(fidl_txn_t* txn, const fidl_msg_t* msg) {
+    fidl_connection_t* conn = (fidl_connection_t*)txn;
+    if (conn->txid == 0u)
+        return ZX_ERR_BAD_STATE;
+    if (msg->num_bytes < sizeof(fidl_message_header_t))
+        return ZX_ERR_INVALID_ARGS;
+    fidl_message_header_t* hdr = (fidl_message_header_t*)msg->bytes;
+    hdr->txid = conn->txid;
+    conn->txid = 0u;
+    return zx_channel_write(conn->channel, 0, msg->bytes, msg->num_bytes,
+                            msg->handles, msg->num_handles);
+}
+
+static void fidl_binding_destroy(fidl_binding_t* binding) {
+    zx_handle_close(binding->wait.object);
+    free(binding);
+}
+
+static void fidl_message_handler(async_dispatcher_t* dispatcher,
+                                 async_wait_t* wait,
+                                 zx_status_t status,
+                                 const zx_packet_signal_t* signal) {
+    fidl_binding_t* binding = (fidl_binding_t*)wait;
+    if (status != ZX_OK) {
+        goto shutdown;
+    }
+
+    if (signal->observed & ZX_CHANNEL_READABLE) {
+        char bytes[ZX_CHANNEL_MAX_MSG_BYTES];
+        zx_handle_t handles[ZX_CHANNEL_MAX_MSG_HANDLES];
+        for (uint64_t i = 0; i < signal->count; i++) {
+            fidl_msg_t msg = {
+                .bytes = bytes,
+                .handles = handles,
+                .num_bytes = 0u,
+                .num_handles = 0u,
+            };
+            status = zx_channel_read(wait->object, 0, bytes, handles,
+                                     ZX_CHANNEL_MAX_MSG_BYTES,
+                                     ZX_CHANNEL_MAX_MSG_HANDLES,
+                                     &msg.num_bytes, &msg.num_handles);
+            if (status == ZX_ERR_SHOULD_WAIT) {
+                break;
+            }
+            if (status != ZX_OK || msg.num_bytes < sizeof(fidl_message_header_t)) {
+                goto shutdown;
+            }
+            fidl_message_header_t* hdr = (fidl_message_header_t*)msg.bytes;
+            fidl_connection_t conn = {
+                .txn.reply = fidl_reply,
+                .channel = wait->object,
+                .txid = hdr->txid,
+                .binding = binding,
+            };
+            status = binding->dispatch(binding->ctx, &conn.txn, &msg, binding->ops);
+            switch (status) {
+            case ZX_OK:
+                status = async_begin_wait(dispatcher, wait);
+                if (status != ZX_OK) {
+                    goto shutdown;
+                }
+                return;
+            case ZX_ERR_ASYNC:
+                return;
+            default:
+                goto shutdown;
+            }
+        }
+    }
+
+shutdown:
+    fidl_binding_destroy(binding);
+}
+
+zx_status_t fidl_bind(async_dispatcher_t* dispatcher, zx_handle_t channel,
+                      fidl_dispatch_t* dispatch, void* ctx, const void* ops) {
+    fidl_binding_t* binding = calloc(1, sizeof(fidl_binding_t));
+    binding->wait.handler = fidl_message_handler;
+    binding->wait.object = channel;
+    binding->wait.trigger = ZX_CHANNEL_READABLE | ZX_CHANNEL_PEER_CLOSED;
+    binding->dispatch = dispatch;
+    binding->dispatcher = dispatcher;
+    binding->ctx = ctx;
+    binding->ops = ops;
+    zx_status_t status = async_begin_wait(dispatcher, &binding->wait);
+    if (status != ZX_OK) {
+        fidl_binding_destroy(binding);
+    }
+    return status;
+}
+
+typedef struct fidl_async_txn {
+    fidl_connection_t connection;
+} fidl_async_txn_t;
+
+fidl_async_txn_t* fidl_async_txn_create(fidl_txn_t* txn) {
+    fidl_connection_t* connection = (fidl_connection_t*) txn;
+
+    fidl_async_txn_t* async_txn = calloc(1, sizeof(fidl_async_txn_t));
+    memcpy(&async_txn->connection, connection, sizeof(*connection));
+
+    return async_txn;
+}
+
+fidl_txn_t* fidl_async_txn_borrow(fidl_async_txn_t* async_txn) {
+    return &async_txn->connection.txn;
+}
+
+zx_status_t fidl_async_txn_complete(fidl_async_txn_t* async_txn, bool rebind) {
+    zx_status_t status = ZX_OK;
+    if (rebind) {
+        status = async_begin_wait(async_txn->connection.binding->dispatcher,
+                                  &async_txn->connection.binding->wait);
+        if (status == ZX_OK) {
+            return ZX_OK;
+        }
+    }
+
+    fidl_binding_destroy(async_txn->connection.binding);
+    free(async_txn);
+    return status;
+}
diff --git a/pkg/fidl-async/include/lib/fidl-async/bind.h b/pkg/fidl-async/include/lib/fidl-async/bind.h
new file mode 100644
index 0000000..5fc6f8b
--- /dev/null
+++ b/pkg/fidl-async/include/lib/fidl-async/bind.h
@@ -0,0 +1,92 @@
+// 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 LIB_FIDL_BIND_H_
+#define LIB_FIDL_BIND_H_
+
+#include <lib/async/dispatcher.h>
+#include <zircon/fidl.h>
+
+__BEGIN_CDECLS
+
+// A generic FIDL dispatch function.
+//
+// For FIDL interfaces with [Layout="Simple"], the C backend generates a
+// dispatch function that decodes the |msg| and calls through an |ops| table.
+//
+// This function signature matches the structure of these generated functions
+// but with the type of the |ops| table erased.
+//
+// Example:
+//
+//  fidl_bind(dispacher, channel, (fidl_dispatch_t*)spaceship_SpaceShip_dispatch, ctx, &kOps);
+//
+typedef zx_status_t(fidl_dispatch_t)(void* ctx, fidl_txn_t* txn,
+                                     fidl_msg_t* msg, const void* ops);
+
+// Binds a |dispatch| function to channel| using |dispatcher|.
+//
+// This function adds an |async_wait_t| to the given |dispatcher| that waits
+// asynchronously for new messages to arrive on |channel|. When a message
+// arrives, the |dispatch| function is called on one of the threads associated
+// with the |dispatcher| with the |fidl_msg_t| as well as the given |ctx| and
+// |ops|.
+//
+// Typically, the |dispatch| function is generated by the C backend for FIDL
+// interfaces with with [Layout="Simple"] (see |fidl_dispatch_t|). These
+// dispatch functions decode the |fidl_msg_t| and call through the |ops| table
+// implementations of the interface's methods, passing along the |ctx| and a
+// |fidl_txn_t| (if the method has a reply message).
+//
+// The |fidl_txn_t| passed to |dispatch| is valid only until |dispatch| returns.
+// If the method has a reply message, the |reply| function on the |fidl_txn_t|
+// object must be called synchronously within the |dispatch| call.
+//
+// If a client wishes to reply to the message asynchronously, |fidl_async_txn_create|
+// must be invoked on |fidl_txn_t|, and ZX_ERR_ASYNC must be returned.
+//
+// Returns whether |fidl_bind| was able to begin waiting on the given |channel|.
+// Upon any error, |channel| is closed and the binding is terminated. Shutting down
+// the |dispatcher| also results in |channel| being closed.
+//
+// It is safe to shutdown the dispatcher at any time.
+//
+// It is unsafe to destroy the dispatcher from within a dispatch function.
+// It is unsafe to destroy the dispatcher while any |fidl_async_txn_t| objects
+// are alive.
+zx_status_t fidl_bind(async_dispatcher_t* dispatcher, zx_handle_t channel,
+                      fidl_dispatch_t* dispatch, void* ctx, const void* ops);
+
+// An asynchronous FIDL txn.
+//
+// This is an opaque wrapper around |fidl_txn_t| which can extend the lifetime
+// of the object beyond the dispatched function.
+typedef struct fidl_async_txn fidl_async_txn_t;
+
+// Takes ownership of |txn| and allows usage of the txn beyond the currently
+// dispatched function.
+//
+// If this function is invoked within a dispatched function, that function
+// must return ZX_ERR_ASYNC.
+//
+// The result must be destroyed with a call to |fidl_async_txn_complete|.
+fidl_async_txn_t* fidl_async_txn_create(fidl_txn_t* txn);
+
+// Acquire a reference to the |fidl_txn_t| backing this txn object.
+//
+// It is unsafe to use this |fidl_txn_t| after |async_txn| is completed.
+fidl_txn_t* fidl_async_txn_borrow(fidl_async_txn_t* async_txn);
+
+// Destroys an asynchronous transaction created with |fidl_async_txn_create|.
+//
+// If requested, rebinds the underlying txn against the binding.
+// Returns an error if |rebind| is true and the transaction could not be
+// re-bound.
+//
+// In all cases, the |async_txn| object is consumed.
+zx_status_t fidl_async_txn_complete(fidl_async_txn_t* async_txn, bool rebind);
+
+__END_CDECLS
+
+#endif // LIB_FIDL_BIND_H_
diff --git a/pkg/fidl-async/meta.json b/pkg/fidl-async/meta.json
new file mode 100644
index 0000000..f5dfdbb
--- /dev/null
+++ b/pkg/fidl-async/meta.json
@@ -0,0 +1,22 @@
+{
+  "banjo_deps": [], 
+  "deps": [
+    "async", 
+    "fidl"
+  ], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/fidl-async/bind.c", 
+    "pkg/fidl-async/include/lib/fidl-async/bind.h"
+  ], 
+  "headers": [
+    "pkg/fidl-async/include/lib/fidl-async/bind.h"
+  ], 
+  "include_dir": "pkg/fidl-async/include", 
+  "name": "fidl-async", 
+  "root": "pkg/fidl-async", 
+  "sources": [
+    "pkg/fidl-async/bind.c"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/fidl/buffer_walker.h b/pkg/fidl/buffer_walker.h
new file mode 100644
index 0000000..92cb2e1
--- /dev/null
+++ b/pkg/fidl/buffer_walker.h
@@ -0,0 +1,809 @@
+// 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.
+
+#pragma once
+
+namespace fidl {
+namespace internal {
+
+// Some assumptions about data type layout.
+static_assert(offsetof(fidl_string_t, size) == 0u, "");
+static_assert(offsetof(fidl_string_t, data) == 8u, "");
+
+static_assert(offsetof(fidl_vector_t, count) == 0u, "");
+static_assert(offsetof(fidl_vector_t, data) == 8u, "");
+
+static_assert(ZX_HANDLE_INVALID == FIDL_HANDLE_ABSENT, "");
+
+template <bool kConst, class U>
+struct SetPtrConst;
+
+template <class U>
+struct SetPtrConst<false, U> {
+    typedef U* type;
+};
+
+template <class U>
+struct SetPtrConst<true, U> {
+    typedef const U* type;
+};
+
+// Walks over a FIDL buffer and validates/encodes/decodes it per-Derived.
+//
+// kMutating controls whether this deals with mutable bytes or immutable bytes
+// (validation wants immutable, encode/decode wants mutable)
+//
+// kContinueAfterErrors controls whether parsing is continued upon failure (encode needs this to
+// see all available handles).
+//
+// Derived should offer the following methods:
+//
+//   const? uint8_t* bytes() - returns the start of the buffer of bytes
+//   uint32_t num_bytes() - returns the number of bytes in said buffer
+//   uint32_t num_handles() - returns the number of handles that are claimable
+//   bool ValidateOutOfLineStorageClaim(const void* a, const void* b)
+//      - returns true if a legally points to b
+//   void UnclaimedHandle(zx_handle_t*) - notes that a handle was skipped
+//   void ClaimedHandle(zx_handle_t*, uint32_t idx) - notes that a handle was claimed
+//   PointerState GetPointerState(const void* ptr) - returns whether a pointer is present or not
+//   HandleState GetHandleState(zx_handle_t) - returns if a handle is present or not
+//   void UpdatePointer(T**p, T*v) - mutates a pointer representation for a present pointer
+//   void SetError(const char* error_msg) - flags that an error occurred
+template <class Derived, bool kMutating, bool kContinueAfterErrors>
+class BufferWalker {
+public:
+    explicit BufferWalker(const fidl_type* type)
+        : type_(type) {}
+
+    void Walk() {
+        // The first decode is special. It must be a struct or a table.
+        // We need to know the size of the first element to compute the start of
+        // the out-of-line allocations.
+
+        if (type_ == nullptr) {
+            SetError("Cannot decode a null fidl type");
+            return;
+        }
+
+        if (bytes() == nullptr) {
+            SetError("Cannot decode null bytes");
+            return;
+        }
+
+        switch (type_->type_tag) {
+        case fidl::kFidlTypeStruct:
+            if (num_bytes() < type_->coded_struct.size) {
+                SetError("Message size is smaller than expected");
+                return;
+            }
+            out_of_line_offset_ = static_cast<uint32_t>(fidl::FidlAlign(type_->coded_struct.size));
+            break;
+        case fidl::kFidlTypeTable:
+            if (num_bytes() < sizeof(fidl_vector_t)) {
+                SetError("Message size is smaller than expected");
+                return;
+            }
+            out_of_line_offset_ = static_cast<uint32_t>(fidl::FidlAlign(sizeof(fidl_vector_t)));
+            break;
+        default:
+            SetError("Message must be a struct or a table");
+            return;
+        }
+
+        Push(Frame::DoneSentinel());
+        Push(Frame(type_, 0u));
+
+// Macro to insert the relevant goop required to support two control flows here:
+// one where we keep reading after error, and another where we return immediately.
+// No runtime overhead thanks to if constexpr magic.
+#define FIDL_POP_AND_CONTINUE_OR_RETURN \
+    if (kContinueAfterErrors) {         \
+        Pop();                          \
+        continue;                       \
+    } else {                            \
+        return;                         \
+    }
+
+        for (;;) {
+            Frame* frame = Peek();
+
+            switch (frame->state) {
+            case Frame::kStateStruct: {
+                const uint32_t field_index = frame->NextStructField();
+                if (field_index == frame->struct_state.field_count) {
+                    Pop();
+                    continue;
+                }
+                const fidl::FidlField& field = frame->struct_state.fields[field_index];
+                const fidl_type_t* field_type = field.type;
+                const uint32_t field_offset = frame->offset + field.offset;
+                if (!Push(Frame(field_type, field_offset))) {
+                    SetError("recursion depth exceeded processing struct");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                continue;
+            }
+            case Frame::kStateStructPointer: {
+                switch (GetPointerState(TypedAt<void>(frame->offset))) {
+                case PointerState::PRESENT:
+                    break;
+                case PointerState::ABSENT:
+                    Pop();
+                    continue;
+                default:
+                    SetError("Tried to decode a bad struct pointer");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                auto struct_ptr_ptr = TypedAt<void*>(frame->offset);
+                if (!ClaimOutOfLineStorage(frame->struct_pointer_state.struct_type->size,
+                                           *struct_ptr_ptr, &frame->offset)) {
+                    SetError("message wanted to store too large of a nullable struct");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                UpdatePointer(struct_ptr_ptr, TypedAt<void>(frame->offset));
+                const fidl::FidlCodedStruct* coded_struct = frame->struct_pointer_state.struct_type;
+                *frame = Frame(coded_struct, frame->offset);
+                continue;
+            }
+            case Frame::kStateTable: {
+                if (frame->field == 0u) {
+                    auto envelope_vector_ptr = TypedAt<fidl_vector_t>(frame->offset);
+                    switch (GetPointerState(&envelope_vector_ptr->data)) {
+                    case PointerState::PRESENT:
+                        break;
+                    case PointerState::ABSENT:
+                        SetError("Table data cannot be absent");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    default:
+                        SetError("message tried to decode a non-present vector");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    uint32_t size;
+                    if (mul_overflow(envelope_vector_ptr->count, 2 * sizeof(uint64_t), &size)) {
+                        SetError("integer overflow calculating table size");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    if (!ClaimOutOfLineStorage(size, envelope_vector_ptr->data, &frame->offset)) {
+                        SetError("message wanted to store too large of a table");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    UpdatePointer(&envelope_vector_ptr->data, TypedAt<void>(frame->offset));
+                    frame->field = 1;
+                    frame->table_state.known_index = 0;
+                    frame->table_state.present_count = static_cast<uint32_t>(envelope_vector_ptr->count);
+                    frame->table_state.end_offset = out_of_line_offset_;
+                    frame->table_state.end_handle = handle_idx_;
+                    continue;
+                }
+                if (frame->table_state.end_offset != out_of_line_offset_) {
+                    SetError("Table field was mis-sized");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                if (frame->table_state.end_handle != handle_idx_) {
+                    SetError("Table handles were mis-sized");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                if (frame->field > frame->table_state.present_count) {
+                    Pop();
+                    continue;
+                }
+                const fidl::FidlTableField* known_field = nullptr;
+                if (frame->table_state.known_index < frame->table_state.field_count) {
+                    const fidl::FidlTableField* field =
+                        &frame->table_state.fields[frame->table_state.known_index];
+                    if (field->ordinal == frame->field) {
+                        known_field = field;
+                        frame->table_state.known_index++;
+                    }
+                }
+                const uint32_t tag_offset = static_cast<uint32_t>(
+                    frame->offset + (frame->field - 1) * 2 * sizeof(uint64_t));
+                const uint32_t data_offset = static_cast<uint32_t>(
+                    tag_offset + sizeof(uint64_t));
+                const uint64_t packed_sizes = *TypedAt<uint64_t>(tag_offset);
+                frame->field++;
+                switch (GetPointerState(TypedAt<void>(data_offset))) {
+                case PointerState::PRESENT:
+                    if (packed_sizes != 0)
+                        break; // expected
+
+                    SetError("Table envelope has present data pointer, but no data, and no handles");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                case PointerState::ABSENT:
+                    if (packed_sizes == 0)
+                        continue; // skip
+
+                    SetError("Table envelope has absent data pointer, yet has data and/or handles");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                default:
+                    SetError("Table envelope has bad data pointer");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                uint32_t offset;
+                uint32_t handles;
+                const uint32_t table_bytes = static_cast<uint32_t>(packed_sizes & 0xffffffffu);
+                const uint32_t table_handles = static_cast<uint32_t>(packed_sizes >> 32);
+                if (add_overflow(out_of_line_offset_, table_bytes, &offset) || offset > num_bytes()) {
+                    SetError("integer overflow decoding table field");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                if (add_overflow(handle_idx_, table_handles, &handles) ||
+                    handles > num_handles()) {
+                    SetError("integer overflow decoding table handles");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                frame->table_state.end_offset = offset;
+                frame->table_state.end_handle = handles;
+                if (known_field != nullptr) {
+                    const fidl_type_t* field_type = known_field->type;
+                    uint32_t field_offset;
+                    if (!ClaimOutOfLineStorage(TypeSize(field_type), TypedAt<void*>(data_offset), &field_offset)) {
+                        SetError("table wanted too many bytes in field");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    UpdatePointer(TypedAt<void*>(data_offset), TypedAt<void>(field_offset));
+                    if (!Push(Frame(field_type, field_offset))) {
+                        SetError("recursion depth exceeded decoding table");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                } else {
+                    // Table data will not be processed: discard it.
+                    uint32_t field_offset;
+                    if (!ClaimOutOfLineStorage(table_bytes, TypedAt<void*>(data_offset), &field_offset)) {
+                        SetError("table wanted too many bytes in field");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    UpdatePointer(TypedAt<void*>(data_offset), TypedAt<void>(field_offset));
+                    for (uint32_t i = 0; i < table_handles; i++) {
+                        if (!ClaimHandle(nullptr)) {
+                            SetError("expected handle not present");
+                            FIDL_POP_AND_CONTINUE_OR_RETURN;
+                        }
+                    }
+                }
+                continue;
+            }
+            case Frame::kStateTablePointer: {
+                switch (GetPointerState(TypedAt<void>(frame->offset))) {
+                case PointerState::PRESENT:
+                    break;
+                case PointerState::ABSENT:
+                    Pop();
+                    continue;
+                default:
+                    SetError("Tried to decode a bad table pointer");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                auto table_ptr_ptr = TypedAt<void*>(frame->offset);
+                if (!ClaimOutOfLineStorage(sizeof(fidl_vector_t), *table_ptr_ptr, &frame->offset)) {
+                    SetError("message wanted to store too large of a nullable table");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                UpdatePointer(table_ptr_ptr, TypedAt<void>(frame->offset));
+                const fidl::FidlCodedTable* coded_table = frame->table_pointer_state.table_type;
+                *frame = Frame(coded_table, frame->offset);
+                continue;
+            }
+            case Frame::kStateUnion: {
+                fidl_union_tag_t union_tag = *TypedAt<fidl_union_tag_t>(frame->offset);
+                if (union_tag >= frame->union_state.type_count) {
+                    SetError("Tried to decode a bad union discriminant");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                const fidl_type_t* member = frame->union_state.types[union_tag];
+                if (!member) {
+                    Pop();
+                    continue;
+                }
+                frame->offset += frame->union_state.data_offset;
+                *frame = Frame(member, frame->offset);
+                continue;
+            }
+            case Frame::kStateUnionPointer: {
+                auto union_ptr_ptr = TypedAt<fidl_union_tag_t*>(frame->offset);
+                switch (GetPointerState(TypedAt<void>(frame->offset))) {
+                case PointerState::PRESENT:
+                    break;
+                case PointerState::ABSENT:
+                    Pop();
+                    continue;
+                default:
+                    SetError("Tried to decode a bad union pointer");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                if (!ClaimOutOfLineStorage(frame->union_pointer_state.union_type->size, *union_ptr_ptr,
+                                           &frame->offset)) {
+                    SetError("message wanted to store too large of a nullable union");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                UpdatePointer(union_ptr_ptr, TypedAt<fidl_union_tag_t>(frame->offset));
+                const fidl::FidlCodedUnion* coded_union = frame->union_pointer_state.union_type;
+                *frame = Frame(coded_union, frame->offset);
+                continue;
+            }
+            case Frame::kStateArray: {
+                const uint32_t element_offset = frame->NextArrayOffset();
+                if (element_offset == frame->array_state.array_size) {
+                    Pop();
+                    continue;
+                }
+                const fidl_type_t* element_type = frame->array_state.element;
+                const uint32_t offset = frame->offset + element_offset;
+                if (!Push(Frame(element_type, offset))) {
+                    SetError("recursion depth exceeded decoding array");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                continue;
+            }
+            case Frame::kStateString: {
+                auto string_ptr = TypedAt<fidl_string_t>(frame->offset);
+                // The string storage may be Absent for nullable strings and must
+                // otherwise be Present. No other values are allowed.
+                switch (GetPointerState(&string_ptr->data)) {
+                case PointerState::PRESENT:
+                    break;
+                case PointerState::ABSENT:
+                    if (!frame->string_state.nullable) {
+                        SetError("message tried to decode an absent non-nullable string");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    if (string_ptr->size != 0u) {
+                        SetError("message tried to decode an absent string of non-zero length");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    Pop();
+                    continue;
+                default:
+                    SetError(
+                        "message tried to decode a string that is neither present nor absent");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                uint64_t bound = frame->string_state.max_size;
+                uint64_t size = string_ptr->size;
+                if (size > bound) {
+                    SetError("message tried to decode too large of a bounded string");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                uint32_t string_data_offset = 0u;
+                if (!ClaimOutOfLineStorage(static_cast<uint32_t>(size), string_ptr->data, &string_data_offset)) {
+                    SetError("decoding a string overflowed buffer");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                UpdatePointer(&string_ptr->data, TypedAt<char>(string_data_offset));
+                Pop();
+                continue;
+            }
+            case Frame::kStateHandle: {
+                auto handle_ptr = TypedAt<zx_handle_t>(frame->offset);
+                // The handle storage may be Absent for nullable handles and must
+                // otherwise be Present. No other values are allowed.
+                switch (GetHandleState(*handle_ptr)) {
+                case HandleState::ABSENT:
+                    if (frame->handle_state.nullable) {
+                        Pop();
+                        continue;
+                    }
+                    SetError("message tried to decode a non-present handle");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                case HandleState::PRESENT:
+                    if (!ClaimHandle(handle_ptr)) {
+                        SetError("message decoded too many handles");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    Pop();
+                    continue;
+                default:
+                    // The value at the handle was garbage.
+                    SetError("message tried to decode a garbage handle");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+            }
+            case Frame::kStateVector: {
+                auto vector_ptr = TypedAt<fidl_vector_t>(frame->offset);
+                // The vector storage may be Absent for nullable vectors and must
+                // otherwise be Present. No other values are allowed.
+                switch (GetPointerState(&vector_ptr->data)) {
+                case PointerState::PRESENT:
+                    break;
+                case PointerState::ABSENT:
+                    if (!frame->vector_state.nullable) {
+                        SetError("message tried to decode an absent non-nullable vector");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    if (vector_ptr->count != 0u) {
+                        SetError("message tried to decode an absent vector of non-zero elements");
+                        FIDL_POP_AND_CONTINUE_OR_RETURN;
+                    }
+                    Pop();
+                    continue;
+                default:
+                    SetError("message tried to decode a non-present vector");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                if (vector_ptr->count > frame->vector_state.max_count) {
+                    SetError("message tried to decode too large of a bounded vector");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                uint32_t size;
+                if (mul_overflow(vector_ptr->count, frame->vector_state.element_size, &size)) {
+                    SetError("integer overflow calculating vector size");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                if (!ClaimOutOfLineStorage(size, vector_ptr->data, &frame->offset)) {
+                    SetError("message wanted to store too large of a vector");
+                    FIDL_POP_AND_CONTINUE_OR_RETURN;
+                }
+                UpdatePointer(&vector_ptr->data, TypedAt<void>(frame->offset));
+                if (frame->vector_state.element) {
+                    // Continue by decoding the vector elements as an array.
+                    *frame = Frame(frame->vector_state.element, size,
+                                   frame->vector_state.element_size, frame->offset);
+                } else {
+                    // If there is no element type pointer, there is
+                    // nothing to decode in the vector secondary
+                    // payload. So just continue.
+                    Pop();
+                }
+                continue;
+            }
+            case Frame::kStateDone: {
+                if (out_of_line_offset_ != num_bytes()) {
+                    SetError("message did not decode all provided bytes");
+                }
+                return;
+            }
+            }
+        }
+
+#undef FIDL_POP_AND_CONTINUE_OR_RETURN
+    }
+
+protected:
+    void SetError(const char* error_msg) {
+        derived()->SetError(error_msg);
+    }
+
+    template <typename T>
+    typename SetPtrConst<!kMutating, T>::type TypedAt(uint32_t offset) const {
+        return reinterpret_cast<typename SetPtrConst<!kMutating, T>::type>(bytes() + offset);
+    }
+
+    enum class PointerState : uintptr_t {
+        PRESENT = FIDL_ALLOC_PRESENT,
+        ABSENT = FIDL_ALLOC_ABSENT,
+        INVALID = 1 // *OR* *ANY* non PRESENT/ABSENT value.
+    };
+
+    enum class HandleState : zx_handle_t {
+        PRESENT = FIDL_HANDLE_PRESENT,
+        ABSENT = FIDL_HANDLE_ABSENT,
+        INVALID = 1 // *OR* *ANY* non PRESENT/ABSENT value.
+    };
+
+    uint32_t handle_idx() const { return handle_idx_; }
+
+private:
+    Derived* derived() {
+        return static_cast<Derived*>(this);
+    }
+
+    const Derived* derived() const {
+        return static_cast<const Derived*>(this);
+    }
+
+    // Returns a pointer to the bytes in the message.
+    auto bytes() const {
+        return derived()->bytes();
+    }
+
+    // Returns the number of bytes in the message.
+    auto num_bytes() const {
+        return derived()->num_bytes();
+    }
+
+    // Returns the number of handles in the message (encoding: the max number of handles in the message).
+    auto num_handles() const {
+        return derived()->num_handles();
+    }
+
+    // Returns PRESENT/ABSENT/INVALID for a given pointer value.
+    PointerState GetPointerState(const void* ptr) const {
+        return derived()->GetPointerState(ptr);
+    }
+
+    // Returns PRESENT/ABSENT/INVALID for a given handle value.
+    HandleState GetHandleState(zx_handle_t p) const {
+        return derived()->GetHandleState(p);
+    }
+
+    // If required: mutate a pointer to the dual representation.
+    template <class T2, class T1>
+    void UpdatePointer(T2 p, T1 v) {
+        derived()->UpdatePointer(p, v);
+    }
+
+    // Returns true when a handle was claimed, and false when the
+    // handles are exhausted.
+    template <class ZxHandleTPointer>
+    bool ClaimHandle(ZxHandleTPointer out_handle) {
+        if (handle_idx_ == num_handles()) {
+            derived()->UnclaimedHandle(out_handle);
+            return false;
+        }
+        derived()->ClaimedHandle(out_handle, handle_idx_);
+        ++handle_idx_;
+        return true;
+    }
+
+    // Returns true when the buffer space is claimed, and false when
+    // the requested claim is too large for bytes_.
+    bool ClaimOutOfLineStorage(uint32_t size, const void* storage, uint32_t* out_offset) {
+        if (!derived()->ValidateOutOfLineStorageClaim(storage, &bytes()[out_of_line_offset_])) {
+            return false;
+        }
+
+        // We have to manually maintain alignment here. For example, a pointer
+        // to a struct that is 4 bytes still needs to advance the next
+        // out-of-line offset by 8 to maintain the aligned-to-FIDL_ALIGNMENT
+        // property.
+        static constexpr uint32_t mask = FIDL_ALIGNMENT - 1;
+        uint32_t offset = out_of_line_offset_;
+        if (add_overflow(offset, size, &offset) ||
+            add_overflow(offset, mask, &offset)) {
+            return false;
+        }
+        offset &= ~mask;
+
+        if (offset > num_bytes()) {
+            return false;
+        }
+        *out_offset = out_of_line_offset_;
+        out_of_line_offset_ = offset;
+        return true;
+    }
+
+    uint32_t TypeSize(const fidl_type_t* type) {
+        switch (type->type_tag) {
+        case fidl::kFidlTypeStructPointer:
+        case fidl::kFidlTypeTablePointer:
+        case fidl::kFidlTypeUnionPointer:
+            return sizeof(uint64_t);
+        case fidl::kFidlTypeHandle:
+            return sizeof(zx_handle_t);
+        case fidl::kFidlTypeStruct:
+            return type->coded_struct.size;
+        case fidl::kFidlTypeTable:
+            return sizeof(fidl_vector_t);
+        case fidl::kFidlTypeUnion:
+            return type->coded_union.size;
+        case fidl::kFidlTypeString:
+            return sizeof(fidl_string_t);
+        case fidl::kFidlTypeArray:
+            return type->coded_array.array_size;
+        case fidl::kFidlTypeVector:
+            return sizeof(fidl_vector_t);
+        }
+        abort();
+        return 0;
+    }
+
+    // Functions that manipulate the decoding stack frames.
+    struct Frame {
+        Frame(const fidl_type_t* fidl_type, uint32_t offset)
+            : offset(offset) {
+            switch (fidl_type->type_tag) {
+            case fidl::kFidlTypeStruct:
+                state = kStateStruct;
+                struct_state.fields = fidl_type->coded_struct.fields;
+                struct_state.field_count = fidl_type->coded_struct.field_count;
+                break;
+            case fidl::kFidlTypeStructPointer:
+                state = kStateStructPointer;
+                struct_pointer_state.struct_type = fidl_type->coded_struct_pointer.struct_type;
+                break;
+            case fidl::kFidlTypeTable:
+                state = kStateTable;
+                table_state.fields = fidl_type->coded_table.fields;
+                table_state.field_count = fidl_type->coded_table.field_count;
+                table_state.present_count = 0;
+                break;
+            case fidl::kFidlTypeTablePointer:
+                state = kStateTablePointer;
+                table_pointer_state.table_type = fidl_type->coded_table_pointer.table_type;
+                break;
+            case fidl::kFidlTypeUnion:
+                state = kStateUnion;
+                union_state.types = fidl_type->coded_union.types;
+                union_state.type_count = fidl_type->coded_union.type_count;
+                union_state.data_offset = fidl_type->coded_union.data_offset;
+                break;
+            case fidl::kFidlTypeUnionPointer:
+                state = kStateUnionPointer;
+                union_pointer_state.union_type = fidl_type->coded_union_pointer.union_type;
+                break;
+            case fidl::kFidlTypeArray:
+                state = kStateArray;
+                array_state.element = fidl_type->coded_array.element;
+                array_state.array_size = fidl_type->coded_array.array_size;
+                array_state.element_size = fidl_type->coded_array.element_size;
+                break;
+            case fidl::kFidlTypeString:
+                state = kStateString;
+                string_state.max_size = fidl_type->coded_string.max_size;
+                string_state.nullable = fidl_type->coded_string.nullable;
+                break;
+            case fidl::kFidlTypeHandle:
+                state = kStateHandle;
+                handle_state.nullable = fidl_type->coded_handle.nullable;
+                break;
+            case fidl::kFidlTypeVector:
+                state = kStateVector;
+                vector_state.element = fidl_type->coded_vector.element;
+                vector_state.max_count = fidl_type->coded_vector.max_count;
+                vector_state.element_size = fidl_type->coded_vector.element_size;
+                vector_state.nullable = fidl_type->coded_vector.nullable;
+                break;
+            }
+        }
+
+        Frame(const fidl::FidlCodedStruct* coded_struct, uint32_t offset)
+            : offset(offset) {
+            state = kStateStruct;
+            struct_state.fields = coded_struct->fields;
+            struct_state.field_count = coded_struct->field_count;
+        }
+
+        Frame(const fidl::FidlCodedTable* coded_table, uint32_t offset)
+            : offset(offset) {
+            state = kStateStruct;
+            table_state.fields = coded_table->fields;
+            table_state.field_count = coded_table->field_count;
+        }
+
+        Frame(const fidl::FidlCodedUnion* coded_union, uint32_t offset)
+            : offset(offset) {
+            state = kStateUnion;
+            union_state.types = coded_union->types;
+            union_state.type_count = coded_union->type_count;
+            union_state.data_offset = coded_union->data_offset;
+        }
+
+        Frame(const fidl_type_t* element, uint32_t array_size, uint32_t element_size,
+              uint32_t offset)
+            : offset(offset) {
+            state = kStateArray;
+            array_state.element = element;
+            array_state.array_size = array_size;
+            array_state.element_size = element_size;
+        }
+
+        // The default constructor does nothing when initializing the stack of frames.
+        Frame() {}
+
+        static Frame DoneSentinel() {
+            Frame frame;
+            frame.state = kStateDone;
+            return frame;
+        }
+
+        uint32_t NextStructField() {
+            ZX_DEBUG_ASSERT(state == kStateStruct);
+
+            uint32_t current = field;
+            field += 1;
+            return current;
+        }
+
+        uint32_t NextArrayOffset() {
+            ZX_DEBUG_ASSERT(state == kStateArray);
+
+            uint32_t current = field;
+            field += array_state.element_size;
+            return current;
+        }
+
+        enum : int {
+            kStateStruct,
+            kStateStructPointer,
+            kStateTable,
+            kStateTablePointer,
+            kStateUnion,
+            kStateUnionPointer,
+            kStateArray,
+            kStateString,
+            kStateHandle,
+            kStateVector,
+
+            kStateDone,
+        } state;
+        // A byte offset into bytes_;
+        uint32_t offset;
+
+        // This is a subset of the information recorded in the
+        // fidl_type structures needed for decoding state. For
+        // example, struct sizes do not need to be present here.
+        union {
+            struct {
+                const fidl::FidlField* fields;
+                uint32_t field_count;
+            } struct_state;
+            struct {
+                const fidl::FidlCodedStruct* struct_type;
+            } struct_pointer_state;
+            struct {
+                const fidl::FidlTableField* fields;
+                uint32_t known_index;
+                uint32_t field_count;
+                uint32_t present_count;
+                uint32_t end_offset;
+                uint32_t end_handle;
+            } table_state;
+            struct {
+                const fidl::FidlCodedTable* table_type;
+            } table_pointer_state;
+            struct {
+                const fidl_type_t* const* types;
+                uint32_t type_count;
+                uint32_t data_offset;
+            } union_state;
+            struct {
+                const fidl::FidlCodedUnion* union_type;
+            } union_pointer_state;
+            struct {
+                const fidl_type_t* element;
+                uint32_t array_size;
+                uint32_t element_size;
+            } array_state;
+            struct {
+                uint32_t max_size;
+                bool nullable;
+            } string_state;
+            struct {
+                bool nullable;
+            } handle_state;
+            struct {
+                const fidl_type* element;
+                uint32_t max_count;
+                uint32_t element_size;
+                bool nullable;
+            } vector_state;
+        };
+
+        uint32_t field = 0u;
+    };
+
+    // Returns true on success and false on recursion overflow.
+    bool Push(Frame frame) {
+        if (depth_ == FIDL_RECURSION_DEPTH) {
+            return false;
+        }
+        decoding_frames_[depth_] = frame;
+        ++depth_;
+        return true;
+    }
+
+    void Pop() {
+        ZX_DEBUG_ASSERT(depth_ != 0u);
+        --depth_;
+    }
+
+    Frame* Peek() {
+        ZX_DEBUG_ASSERT(depth_ != 0u);
+        return &decoding_frames_[depth_ - 1];
+    }
+
+    // Message state passed in to the constructor.
+    const fidl_type_t* const type_;
+
+    // Internal state.
+    uint32_t handle_idx_ = 0u;
+    uint32_t out_of_line_offset_ = 0u;
+
+    // Decoding stack state.
+    uint32_t depth_ = 0u;
+    Frame decoding_frames_[FIDL_RECURSION_DEPTH];
+};
+
+} // namespace internal
+} // namespace fidl
diff --git a/pkg/fidl/builder.cpp b/pkg/fidl/builder.cpp
new file mode 100644
index 0000000..476b7ee
--- /dev/null
+++ b/pkg/fidl/builder.cpp
@@ -0,0 +1,62 @@
+// 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.
+
+#include <lib/fidl/cpp/builder.h>
+
+#include <string.h>
+
+#include <lib/fidl/internal.h>
+
+namespace fidl {
+
+Builder::Builder()
+    : capacity_(0u), at_(0u), buffer_(nullptr) {}
+
+Builder::Builder(void* buffer, uint32_t capacity)
+    : capacity_(capacity), at_(0u), buffer_(static_cast<uint8_t*>(buffer)) {
+}
+
+Builder::~Builder() = default;
+
+Builder::Builder(Builder&& other)
+    : capacity_(other.capacity_),
+      at_(other.at_),
+      buffer_(other.buffer_) {
+    other.Reset(nullptr, 0);
+}
+
+Builder& Builder::operator=(Builder&& other) {
+    if (this != &other) {
+        capacity_ = other.capacity_;
+        at_ = other.at_;
+        buffer_ = other.buffer_;
+        other.Reset(nullptr, 0);
+    }
+    return *this;
+}
+
+void* Builder::Allocate(uint32_t size) {
+    uint64_t limit = FidlAlign(at_ + size);
+    if (limit > capacity_)
+        return nullptr;
+    uint8_t* result = &buffer_[at_];
+    memset(buffer_ + at_, 0, limit - at_);
+    at_ = static_cast<uint32_t>(limit);
+    return result;
+}
+
+BytePart Builder::Finalize() {
+    BytePart bytes(buffer_, capacity_, at_);
+    capacity_ = 0u;
+    at_ = 0u;
+    return bytes;
+}
+
+void Builder::Reset(void* buffer, uint32_t capacity) {
+    buffer_ = static_cast<uint8_t*>(buffer);
+    capacity_ = capacity;
+    at_ = 0u;
+}
+
+} // namespace fidl
diff --git a/pkg/fidl/decoding.cpp b/pkg/fidl/decoding.cpp
new file mode 100644
index 0000000..3066778
--- /dev/null
+++ b/pkg/fidl/decoding.cpp
@@ -0,0 +1,115 @@
+// 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.
+
+#include <lib/fidl/coding.h>
+
+#include <stdalign.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <lib/fidl/internal.h>
+#include <zircon/assert.h>
+#include <zircon/compiler.h>
+
+#ifdef __Fuchsia__
+#include <zircon/syscalls.h>
+#endif
+
+#include "buffer_walker.h"
+
+// TODO(kulakowski) Design zx_status_t error values.
+
+namespace {
+
+class FidlDecoder final : public fidl::internal::BufferWalker<FidlDecoder, true, false> {
+    typedef fidl::internal::BufferWalker<FidlDecoder, true, false> Super;
+
+public:
+    FidlDecoder(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                const zx_handle_t* handles, uint32_t num_handles, const char** out_error_msg)
+        : Super(type), bytes_(static_cast<uint8_t*>(bytes)), num_bytes_(num_bytes),
+          handles_(handles), num_handles_(num_handles), out_error_msg_(out_error_msg) {}
+
+    void Walk() {
+        if (handles_ == nullptr && num_handles_ != 0u) {
+            SetError("Cannot provide non-zero handle count and null handle pointer");
+            return;
+        }
+        Super::Walk();
+        if (status_ == ZX_OK && handle_idx() != num_handles()) {
+            SetError("message did not contain the specified number of handles");
+        }
+    }
+
+    uint8_t* bytes() const { return bytes_; }
+    uint32_t num_bytes() const { return num_bytes_; }
+    uint32_t num_handles() const { return num_handles_; }
+
+    bool ValidateOutOfLineStorageClaim(const void* a, const void* b) {
+        return true;
+    }
+
+    void UnclaimedHandle(zx_handle_t* out_handle) {}
+    void ClaimedHandle(zx_handle_t* out_handle, uint32_t idx) {
+        if (out_handle != nullptr) {
+            *out_handle = handles_[idx];
+#ifdef __Fuchsia__
+        } else {
+            // Return value intentionally ignored: this is best-effort cleanup.
+            zx_handle_close(handles_[idx]);
+#endif
+        }
+    }
+
+    PointerState GetPointerState(const void* ptr) const {
+        return static_cast<PointerState>(*static_cast<const uintptr_t*>(ptr));
+    }
+    HandleState GetHandleState(zx_handle_t p) const {
+        return static_cast<HandleState>(p);
+    }
+
+    template <class T>
+    void UpdatePointer(T* p, T v) {
+        *p = v;
+    }
+
+    void SetError(const char* error_msg) {
+        status_ = ZX_ERR_INVALID_ARGS;
+        if (out_error_msg_ != nullptr) {
+            *out_error_msg_ = error_msg;
+        }
+#ifdef __Fuchsia__
+        if (handles_) {
+            // Return value intentionally ignored: this is best-effort cleanup.
+            zx_handle_close_many(handles_, num_handles());
+        }
+#endif
+    }
+
+    zx_status_t status() const { return status_; }
+
+private:
+    uint8_t* const bytes_;
+    const uint32_t num_bytes_;
+    const zx_handle_t* const handles_;
+    const uint32_t num_handles_;
+    const char** const out_error_msg_;
+    zx_status_t status_ = ZX_OK;
+};
+
+} // namespace
+
+zx_status_t fidl_decode(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                        const zx_handle_t* handles, uint32_t num_handles,
+                        const char** out_error_msg) {
+    FidlDecoder decoder(type, bytes, num_bytes, handles, num_handles, out_error_msg);
+    decoder.Walk();
+    return decoder.status();
+}
+
+zx_status_t fidl_decode_msg(const fidl_type_t* type, fidl_msg_t* msg,
+                            const char** out_error_msg) {
+    return fidl_decode(type, msg->bytes, msg->num_bytes, msg->handles,
+                       msg->num_handles, out_error_msg);
+}
diff --git a/pkg/fidl/encoding.cpp b/pkg/fidl/encoding.cpp
new file mode 100644
index 0000000..f4d4f49
--- /dev/null
+++ b/pkg/fidl/encoding.cpp
@@ -0,0 +1,134 @@
+// 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.
+
+#include <lib/fidl/coding.h>
+
+#include <stdalign.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <lib/fidl/internal.h>
+#include <zircon/assert.h>
+#include <zircon/compiler.h>
+
+#ifdef __Fuchsia__
+#include <zircon/syscalls.h>
+#endif
+
+#include "buffer_walker.h"
+
+#include <stdio.h>
+
+// TODO(kulakowski) Design zx_status_t error values.
+
+namespace {
+
+class FidlEncoder final : public fidl::internal::BufferWalker<FidlEncoder, true, true> {
+    typedef fidl::internal::BufferWalker<FidlEncoder, true, true> Super;
+
+public:
+    FidlEncoder(const fidl_type_t* type, void* bytes, uint32_t num_bytes, zx_handle_t* handles,
+                uint32_t num_handles, uint32_t* out_actual_handles, const char** out_error_msg)
+        : Super(type), bytes_(static_cast<uint8_t*>(bytes)), num_bytes_(num_bytes),
+          handles_(handles), num_handles_(num_handles), out_actual_handles_(out_actual_handles),
+          out_error_msg_(out_error_msg) {}
+
+    void Walk() {
+        if (handles_ == nullptr && num_handles_ != 0u) {
+            SetError("Cannot provide non-zero handle count and null handle pointer");
+            return;
+        }
+        if (out_actual_handles_ == nullptr) {
+            SetError("Cannot encode with null out_actual_handles");
+            return;
+        }
+        Super::Walk();
+        if (status_ == ZX_OK) {
+            *out_actual_handles_ = handle_idx();
+        }
+    }
+
+    uint8_t* bytes() const { return bytes_; }
+    uint32_t num_bytes() const { return num_bytes_; }
+    uint32_t num_handles() const { return num_handles_; }
+
+    bool ValidateOutOfLineStorageClaim(const void* a, const void* b) {
+        return a == b;
+    }
+
+    void UnclaimedHandle(zx_handle_t* out_handle) {
+#ifdef __Fuchsia__
+        // Return value intentionally ignored: this is best-effort cleanup.
+        zx_handle_close(*out_handle);
+#endif
+    }
+    void ClaimedHandle(zx_handle_t* out_handle, uint32_t idx) {
+        assert(out_handle != nullptr);
+        handles_[idx] = *out_handle;
+        *out_handle = FIDL_HANDLE_PRESENT;
+    }
+
+    PointerState GetPointerState(const void* ptr) const {
+        return *static_cast<const uintptr_t*>(ptr) == 0
+                   ? PointerState::ABSENT
+                   : PointerState::PRESENT;
+    }
+    HandleState GetHandleState(zx_handle_t p) const {
+        return p == ZX_HANDLE_INVALID
+                   ? HandleState::ABSENT
+                   : HandleState::PRESENT;
+    }
+
+    template <class T>
+    void UpdatePointer(T** p, T* v) {
+        assert(*p == v);
+        assert(v != nullptr);
+        *p = reinterpret_cast<T*>(FIDL_ALLOC_PRESENT);
+    }
+
+    void SetError(const char* error_msg) {
+        if (status_ != ZX_OK) {
+            return;
+        }
+        status_ = ZX_ERR_INVALID_ARGS;
+        if (out_error_msg_ != nullptr) {
+            *out_error_msg_ = error_msg;
+        }
+#ifdef __Fuchsia__
+        if (handles_) {
+            // Return value intentionally ignored: this is best-effort cleanup.
+            zx_handle_close_many(handles_, num_handles());
+        }
+#endif
+    }
+
+    zx_status_t status() const { return status_; }
+
+private:
+    // Message state passed in to the constructor.
+    uint8_t* const bytes_;
+    const uint32_t num_bytes_;
+    zx_handle_t* const handles_;
+    const uint32_t num_handles_;
+    uint32_t* const out_actual_handles_;
+    const char** const out_error_msg_;
+    zx_status_t status_ = ZX_OK;
+};
+
+} // namespace
+
+zx_status_t fidl_encode(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                        zx_handle_t* handles, uint32_t max_handles, uint32_t* out_actual_handles,
+                        const char** out_error_msg) {
+    FidlEncoder encoder(type, bytes, num_bytes, handles, max_handles, out_actual_handles,
+                        out_error_msg);
+    encoder.Walk();
+    return encoder.status();
+}
+
+zx_status_t fidl_encode_msg(const fidl_type_t* type, fidl_msg_t* msg,
+                            uint32_t* out_actual_handles, const char** out_error_msg) {
+    return fidl_encode(type, msg->bytes, msg->num_bytes, msg->handles, msg->num_handles,
+                       out_actual_handles, out_error_msg);
+}
diff --git a/pkg/fidl/epitaph.c b/pkg/fidl/epitaph.c
new file mode 100644
index 0000000..d1a14e1
--- /dev/null
+++ b/pkg/fidl/epitaph.c
@@ -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.
+
+#ifdef __Fuchsia__
+
+#include <string.h>
+
+#include <lib/fidl/epitaph.h>
+#include <zircon/fidl.h>
+#include <zircon/syscalls.h>
+
+zx_status_t fidl_epitaph_write(zx_handle_t channel, zx_status_t error) {
+    fidl_epitaph_t epitaph;
+    memset(&epitaph, 0, sizeof(epitaph));
+    epitaph.hdr.ordinal = FIDL_EPITAPH_ORDINAL;
+    epitaph.hdr.reserved0 = error;
+
+    return zx_channel_write(channel, 0, &epitaph, sizeof(epitaph), NULL, 0);
+}
+
+#endif // __Fuchsia__
diff --git a/pkg/fidl/formatting.cpp b/pkg/fidl/formatting.cpp
new file mode 100644
index 0000000..ffe6f39
--- /dev/null
+++ b/pkg/fidl/formatting.cpp
@@ -0,0 +1,218 @@
+// 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.
+
+#include <lib/fidl/coding.h>
+
+#include <inttypes.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include <lib/fidl/internal.h>
+#include <zircon/assert.h>
+#include <zircon/compiler.h>
+
+namespace {
+
+class StringBuilder {
+public:
+    StringBuilder(char* buffer, size_t capacity)
+        : buffer_(buffer), capacity_(capacity) {}
+
+    size_t length() const { return length_; }
+
+    void Append(const char* data, size_t length) {
+        size_t remaining = capacity_ - length_;
+        if (length > remaining) {
+            length = remaining;
+        }
+        memcpy(buffer_ + length_, data, length);
+        length_ += length;
+    }
+
+    void Append(const char* data) {
+        Append(data, strlen(data));
+    }
+
+    void AppendPrintf(const char* format, ...) __PRINTFLIKE(2, 3) {
+        va_list ap;
+        va_start(ap, format);
+        AppendVPrintf(format, ap);
+        va_end(ap);
+    }
+
+    void AppendVPrintf(const char* format, va_list ap) {
+        size_t remaining = capacity_ - length_;
+        if (remaining == 0u) {
+            return;
+        }
+        int count = vsnprintf(buffer_ + length_, remaining, format, ap);
+        if (count <= 0) {
+            return;
+        }
+        size_t length = static_cast<size_t>(count);
+        length_ += (length >= remaining ? remaining : length);
+    }
+
+private:
+    char* buffer_;
+    size_t capacity_;
+    size_t length_ = 0u;
+};
+
+void FormatNullability(StringBuilder* str, fidl::FidlNullability nullable) {
+    if (nullable == fidl::kNullable) {
+        str->Append("?");
+    }
+}
+
+void FormatStructName(StringBuilder* str, const fidl::FidlCodedStruct* coded_struct) {
+    if (coded_struct->name) {
+        str->Append(coded_struct->name);
+    } else {
+        str->Append("struct");
+    }
+}
+
+void FormatUnionName(StringBuilder* str, const fidl::FidlCodedUnion* coded_union) {
+    if (coded_union->name) {
+        str->Append(coded_union->name);
+    } else {
+        str->Append("union");
+    }
+}
+
+void FormatTypeName(StringBuilder* str, const fidl_type_t* type);
+void FormatElementName(StringBuilder* str, const fidl_type_t* type) {
+    if (type) {
+        FormatTypeName(str, type);
+    } else {
+        // TODO(jeffbrown): Print the actual primitive type name, assuming we
+        // start recording that information in the tables.
+        str->Append("primitive");
+    }
+}
+
+void FormatTypeName(StringBuilder* str, const fidl_type_t* type) {
+    switch (type->type_tag) {
+    case fidl::kFidlTypeStruct:
+        FormatStructName(str, &type->coded_struct);
+        break;
+    case fidl::kFidlTypeStructPointer:
+        FormatStructName(str, type->coded_struct_pointer.struct_type);
+        str->Append("?");
+        break;
+    case fidl::kFidlTypeUnion:
+        FormatUnionName(str, &type->coded_union);
+        break;
+    case fidl::kFidlTypeUnionPointer:
+        FormatUnionName(str, type->coded_union_pointer.union_type);
+        str->Append("?");
+        break;
+    case fidl::kFidlTypeArray:
+        str->Append("array<");
+        FormatElementName(str, type->coded_array.element);
+        str->Append(">");
+        str->AppendPrintf(":%" PRIu32, type->coded_array.array_size /
+                                           type->coded_array.element_size);
+        break;
+    case fidl::kFidlTypeString:
+        str->Append("string");
+        if (type->coded_string.max_size != FIDL_MAX_SIZE) {
+            str->AppendPrintf(":%" PRIu32, type->coded_string.max_size);
+        }
+        FormatNullability(str, type->coded_string.nullable);
+        break;
+    case fidl::kFidlTypeHandle:
+        str->Append("handle");
+        if (type->coded_handle.handle_subtype) {
+            str->Append("<");
+            switch (type->coded_handle.handle_subtype) {
+            case fidl::kFidlHandleSubtypeHandle:
+                str->Append("handle");
+                break;
+            case fidl::kFidlHandleSubtypeProcess:
+                str->Append("process");
+                break;
+            case fidl::kFidlHandleSubtypeThread:
+                str->Append("thread");
+                break;
+            case fidl::kFidlHandleSubtypeVmo:
+                str->Append("vmo");
+                break;
+            case fidl::kFidlHandleSubtypeChannel:
+                str->Append("channel");
+                break;
+            case fidl::kFidlHandleSubtypeEvent:
+                str->Append("event");
+                break;
+            case fidl::kFidlHandleSubtypePort:
+                str->Append("port");
+                break;
+            case fidl::kFidlHandleSubtypeInterrupt:
+                str->Append("interrupt");
+                break;
+            case fidl::kFidlHandleSubtypeLog:
+                str->Append("log");
+                break;
+            case fidl::kFidlHandleSubtypeSocket:
+                str->Append("socket");
+                break;
+            case fidl::kFidlHandleSubtypeResource:
+                str->Append("resource");
+                break;
+            case fidl::kFidlHandleSubtypeEventpair:
+                str->Append("eventpair");
+                break;
+            case fidl::kFidlHandleSubtypeJob:
+                str->Append("job");
+                break;
+            case fidl::kFidlHandleSubtypeVmar:
+                str->Append("vmar");
+                break;
+            case fidl::kFidlHandleSubtypeFifo:
+                str->Append("fifo");
+                break;
+            case fidl::kFidlHandleSubtypeGuest:
+                str->Append("guest");
+                break;
+            case fidl::kFidlHandleSubtypeTimer:
+                str->Append("timer");
+                break;
+            // TODO(pascallouis): Add support for iomap, pci, and hypervisor
+            // when they are supported in FIDL.
+            default:
+                str->AppendPrintf("%" PRIu32, type->coded_handle.handle_subtype);
+                break;
+            }
+            str->Append(">");
+        }
+        FormatNullability(str, type->coded_handle.nullable);
+        break;
+    case fidl::kFidlTypeVector:
+        str->Append("vector<");
+        FormatElementName(str, type->coded_vector.element);
+        str->Append(">");
+        if (type->coded_vector.max_count != FIDL_MAX_SIZE) {
+            str->AppendPrintf(":%" PRIu32, type->coded_vector.max_count);
+        }
+        FormatNullability(str, type->coded_vector.nullable);
+        break;
+    default:
+        ZX_PANIC("unrecognized tag");
+        break;
+    }
+}
+
+} // namespace
+
+size_t fidl_format_type_name(const fidl_type_t* type,
+                             char* buffer, size_t capacity) {
+    if (!type || !buffer || !capacity) {
+        return 0u;
+    }
+
+    StringBuilder str(buffer, capacity);
+    FormatTypeName(&str, type);
+    return str.length();
+}
diff --git a/pkg/fidl/handle_closing.cpp b/pkg/fidl/handle_closing.cpp
new file mode 100644
index 0000000..5350993
--- /dev/null
+++ b/pkg/fidl/handle_closing.cpp
@@ -0,0 +1,108 @@
+// 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.
+
+
+#include <limits>
+#include <stdalign.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <lib/fidl/coding.h>
+
+#ifdef __Fuchsia__
+
+#include <lib/fidl/internal.h>
+#include <zircon/assert.h>
+#include <zircon/compiler.h>
+#include <zircon/syscalls.h>
+
+#include "buffer_walker.h"
+
+namespace {
+
+class FidlHandleCloser final : public fidl::internal::BufferWalker<FidlHandleCloser, true, true> {
+    typedef fidl::internal::BufferWalker<FidlHandleCloser, true, true> Super;
+
+public:
+    FidlHandleCloser(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                     const char** out_error_msg)
+        : Super(type), bytes_(static_cast<uint8_t*>(bytes)), num_bytes_(num_bytes),
+          out_error_msg_(out_error_msg) {}
+
+    void Walk() {
+        Super::Walk();
+    }
+
+    uint8_t* bytes() const { return bytes_; }
+    uint32_t num_bytes() const { return num_bytes_; }
+    uint32_t num_handles() const { return std::numeric_limits<uint32_t>::max(); }
+
+    bool ValidateOutOfLineStorageClaim(const void* a, void* b) {
+        return true;
+    }
+
+    void UnclaimedHandle(zx_handle_t* out_handle) {
+        // This will never happen since we are returning numeric_limits::max() in num_handles.
+        // We want to claim (close) all the handles.
+        ZX_DEBUG_ASSERT(false);
+    }
+
+    void ClaimedHandle(zx_handle_t* out_handle, uint32_t idx) {
+        if (*out_handle != ZX_HANDLE_INVALID) {
+            zx_handle_close(*out_handle);
+        }
+        *out_handle = ZX_HANDLE_INVALID;
+    }
+
+    template <class T>
+    void UpdatePointer(T* const* p, T* v) {}
+
+    PointerState GetPointerState(const void* ptr) const {
+        return *static_cast<const uintptr_t*>(ptr) == 0
+               ? PointerState::ABSENT
+               : PointerState::PRESENT;
+    }
+
+    HandleState GetHandleState(zx_handle_t p) const {
+        // Treat all handles as present to keep the buffer walker going.
+        return HandleState::PRESENT;
+    }
+
+    void SetError(const char* error_msg) {
+        status_ = ZX_ERR_INVALID_ARGS;
+        if (out_error_msg_ != nullptr) {
+            *out_error_msg_ = error_msg;
+        }
+    }
+
+    zx_status_t status() const { return status_; }
+
+private:
+    // Message state passed in to the constructor.
+    uint8_t* const bytes_;
+    const uint32_t num_bytes_;
+    const char** const out_error_msg_;
+    zx_status_t status_ = ZX_OK;
+};
+
+} // namespace
+
+#endif  // __Fuchsia__
+
+zx_status_t fidl_close_handles(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                               const char** out_error_msg) {
+#if __Fuchsia__
+    FidlHandleCloser handle_closer(type, bytes, num_bytes, out_error_msg);
+    handle_closer.Walk();
+    return handle_closer.status();
+#else
+    return ZX_OK;  // there can't be any handles on the host
+#endif
+}
+
+zx_status_t fidl_close_handles_msg(const fidl_type_t* type, const fidl_msg_t* msg,
+                                   const char** out_error_msg) {
+    return fidl_close_handles(type, msg->bytes, msg->num_bytes, out_error_msg);
+}
+
diff --git a/pkg/fidl/include/lib/fidl/coding.h b/pkg/fidl/include/lib/fidl/coding.h
new file mode 100644
index 0000000..f30fe94
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/coding.h
@@ -0,0 +1,60 @@
+// 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 LIB_FIDL_CODING_H_
+#define LIB_FIDL_CODING_H_
+
+#include <zircon/compiler.h>
+#include <zircon/fidl.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// The maximum recursion depth the fidl encoder or decoder will
+// perform. Each nested aggregate type (structs, unions, arrays, or
+// vectors) counts as one step in the recursion depth.
+#define FIDL_RECURSION_DEPTH 32
+
+// See https://fuchsia.googlesource.com/docs/+/master/development/languages/fidl/languages/c.md#fidl_encode-fidl_encode_msg
+zx_status_t fidl_encode(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                        zx_handle_t* handles, uint32_t max_handles,
+                        uint32_t* out_actual_handles, const char** out_error_msg);
+zx_status_t fidl_encode_msg(const fidl_type_t* type, fidl_msg_t* msg,
+                            uint32_t* out_actual_handles, const char** out_error_msg);
+
+// See https://fuchsia.googlesource.com/docs/+/master/development/languages/fidl/languages/c.md#fidl_decode-fidl_decode_msg
+zx_status_t fidl_decode(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                        const zx_handle_t* handles, uint32_t num_handles,
+                        const char** error_msg_out);
+zx_status_t fidl_decode_msg(const fidl_type_t* type, fidl_msg_t* msg,
+                            const char** out_error_msg);
+
+// Validates an encoded message against the given |type|.
+//
+// The |bytes| are not modified.
+zx_status_t fidl_validate(const fidl_type_t* type, const void* bytes, uint32_t num_bytes,
+                          uint32_t num_handles, const char** error_msg_out);
+zx_status_t fidl_validate_msg(const fidl_type_t* type, const fidl_msg_t* msg,
+                              const char** out_error_msg);
+
+// Traverses a linearized FIDL message, closing all handles within it.
+// This function is a no-op on host side.
+//
+// Handle values in |bytes| are replaced with ZX_HANDLE_INVALID.
+zx_status_t fidl_close_handles(const fidl_type_t* type, void* bytes, uint32_t num_bytes,
+                               const char** out_error_msg);
+zx_status_t fidl_close_handles_msg(const fidl_type_t* type, const fidl_msg_t* msg,
+                                   const char** out_error_msg);
+
+// Stores the name of a fidl type into the provided buffer.
+// Truncates the name if it is too long to fit into the buffer.
+// Returns the number of characters written into the buffer.
+//
+// Note: This function does not write a trailing NUL.
+size_t fidl_format_type_name(const fidl_type_t* type,
+                             char* buffer, size_t capacity);
+
+__END_CDECLS
+
+#endif // LIB_FIDL_CODING_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/builder.h b/pkg/fidl/include/lib/fidl/cpp/builder.h
new file mode 100644
index 0000000..bc394c5
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/builder.h
@@ -0,0 +1,104 @@
+// 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 LIB_FIDL_CPP_BUILDER_H_
+#define LIB_FIDL_CPP_BUILDER_H_
+
+#include <new>  // For placement new.
+#include <stdalign.h>
+#include <stdint.h>
+
+#include <lib/fidl/cpp/message_part.h>
+#include <zircon/compiler.h>
+#include <zircon/fidl.h>
+#include <zircon/types.h>
+
+namespace fidl {
+
+// Builder helps FIDL clients store decoded objects in a buffer.
+//
+// Objects are allocated sequentually in the buffer with appropriate alignment
+// for in-place encoding. The client is responsible for ordering the objects in
+// the buffer appropriately.
+class Builder {
+public:
+    // Creates a buffer without any storage.
+    Builder();
+
+    // Creates a buffer that stores objects in the given memory.
+    //
+    // The constructed |Builder| object does not take ownership of the given
+    // storage.
+    Builder(void* buffer, uint32_t capacity);
+    ~Builder();
+
+    Builder(const Builder& other) = delete;
+    Builder& operator=(const Builder& other) = delete;
+
+    Builder(Builder&& other);
+    Builder& operator=(Builder&& other);
+
+    // Allocates storage in the buffer of sufficient size to store an object of
+    // type |T|. The object must have alignment constraints that are compatible
+    // with FIDL messages.
+    //
+    // If there is insufficient storage in the builder's buffer, this method
+    // returns nullptr.
+    template <typename T>
+    T* New() {
+        static_assert(alignof(T) <= FIDL_ALIGNMENT, "");
+        static_assert(sizeof(T) <= ZX_CHANNEL_MAX_MSG_BYTES, "");
+        if (void* ptr = Allocate(sizeof(T)))
+            return new (ptr) T;
+        return nullptr;
+    }
+
+    // Allocates storage in the buffer of sufficient size to store |count|
+    // objects of type |T|. The object must have alignment constraints that are
+    // compatible with FIDL messages.
+    //
+    // If there is insufficient storage in the builder's buffer, this method
+    // returns nullptr.
+    template <typename T>
+    T* NewArray(uint32_t count) {
+        static_assert(alignof(T) <= FIDL_ALIGNMENT, "");
+        static_assert(sizeof(T) <= ZX_CHANNEL_MAX_MSG_BYTES, "");
+        if (sizeof(T) * static_cast<uint64_t>(count) > UINT32_MAX)
+            return nullptr;
+        if (void* ptr = Allocate(static_cast<uint32_t>(sizeof(T) * count)))
+            return new (ptr) T[count];
+        return nullptr;
+    }
+
+    // Completes the building and returns a |MesssagePart| containing the
+    // allocated objects.
+    //
+    // The allocated objects are placed in the returned buffer in the order in
+    // which they were allocated, with appropriate alignment for a FIDL message.
+    // The returned buffer's capacity cooresponds to the capacity originally
+    // provided to this builder in its constructor.
+    BytePart Finalize();
+
+    // Attaches the given storage to the |Builder|.
+    //
+    // The |Builder| object does not take ownership of the given storage. The
+    // next object will be allocated at the start of the buffer.
+    void Reset(void* buffer, uint32_t capacity);
+
+protected:
+    uint8_t* buffer() const { return buffer_; }
+    uint32_t capacity() const { return capacity_; }
+
+private:
+    // Returns |size| bytes of zeroed memory aligned to at least FIDL_ALIGNMENT
+    void* Allocate(uint32_t size);
+
+    uint32_t capacity_;
+    uint32_t at_;
+    uint8_t* buffer_;
+};
+
+} // namespace fidl
+
+#endif //  LIB_FIDL_CPP_BUILDER_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/message.h b/pkg/fidl/include/lib/fidl/cpp/message.h
new file mode 100644
index 0000000..d93e7c9
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/message.h
@@ -0,0 +1,172 @@
+// 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 LIB_FIDL_CPP_MESSAGE_H_
+#define LIB_FIDL_CPP_MESSAGE_H_
+
+#include <lib/fidl/coding.h>
+#include <lib/fidl/cpp/message_part.h>
+#include <zircon/fidl.h>
+
+namespace fidl {
+
+// A FIDL message.
+//
+// A FIDL message has two parts: the bytes and the handles. The bytes are
+// divided into a header (of type fidl_message_header_t) and a payload, which
+// follows the header.
+//
+// A Message object does not own the storage for the message parts.
+class Message {
+public:
+    // Creates a message without any storage.
+    Message();
+
+    // Creates a message whose storage is backed by |bytes| and |handles|.
+    //
+    // The constructed |Message| object does not take ownership of the given
+    // storage, although does take ownership of zircon handles contained withing
+    // handles.
+    Message(BytePart bytes, HandlePart handles);
+
+    ~Message();
+
+    Message(const Message& other) = delete;
+    Message& operator=(const Message& other) = delete;
+
+    Message(Message&& other);
+    Message& operator=(Message&& other);
+
+    // Whether the message has enough bytes to contain a fidl_message_header_t.
+    bool has_header() const {
+        return bytes_.actual() >= sizeof(fidl_message_header_t);
+    }
+
+    // The header at the start of the message.
+    //
+    // Valid only if has_header().
+    const fidl_message_header_t& header() const {
+        return *reinterpret_cast<fidl_message_header_t*>(bytes_.data());
+    }
+    fidl_message_header_t& header() {
+        return *reinterpret_cast<fidl_message_header_t*>(bytes_.data());
+    }
+
+    // The transaction ID in the message header.
+    //
+    // Valid only if has_header().
+    zx_txid_t txid() const { return header().txid; }
+    void set_txid(zx_txid_t txid) { header().txid = txid; }
+
+    // The flags in the message header.
+    //
+    // Valid only if has_header().
+    uint32_t flags() const { return header().flags; }
+
+    // The flags in the message header.
+    //
+    // Valid only if has_header().
+    uint32_t ordinal() const { return header().ordinal; }
+
+    // The message payload that follows the header.
+    //
+    // Valid only if has_header().
+    BytePart payload() const {
+        constexpr uint32_t n = sizeof(fidl_message_header_t);
+        return BytePart(bytes_.data() + n, bytes_.capacity() - n, bytes_.actual() - n);
+    }
+
+    // The message bytes interpreted as the given type.
+    template <typename T>
+    T* GetBytesAs() const {
+        return reinterpret_cast<T*>(bytes_.data());
+    }
+
+    // The message payload that follows the header interpreted as the given type.
+    //
+    // Valid only if has_header().
+    template <typename T>
+    T* GetPayloadAs() const {
+        return reinterpret_cast<T*>(bytes_.data() + sizeof(fidl_message_header_t));
+    }
+
+    // The storage for the bytes of the message.
+    BytePart& bytes() { return bytes_; }
+    const BytePart& bytes() const { return bytes_; }
+    void set_bytes(BytePart bytes) { bytes_ = static_cast<BytePart&&>(bytes); }
+
+    // The storage for the handles of the message.
+    //
+    // When the message is encoded, the handle values are stored in this part of
+    // the message. When the message is decoded, this part of the message is
+    // empty and the handle values are stored in the bytes().
+    HandlePart& handles() { return handles_; }
+    const HandlePart& handles() const { return handles_; }
+
+    // Encodes the message in-place.
+    //
+    // The message must previously have been in a decoded state, for example,
+    // either by being built in a decoded state using a |Builder| or having been
+    // decoded using the |Decode| method.
+    zx_status_t Encode(const fidl_type_t* type, const char** error_msg_out);
+
+    // Decodes the message in-place.
+    //
+    // The message must previously have been in an encoded state, for example,
+    // either by being read from a zx_channel_t or having been encoded using the
+    // |Encode| method.
+    zx_status_t Decode(const fidl_type_t* type, const char** error_msg_out);
+
+    // Validates the message in-place.
+    //
+    // The message must already be in an encoded state, for example, either by
+    // being read from a zx_channel_t or having been created in that state.
+    //
+    // Does not modify the message.
+    zx_status_t Validate(const fidl_type_t* type, const char** error_msg_out) const;
+
+    // Read a message from the given channel.
+    //
+    // The bytes read from the channel are stored in bytes() and the handles
+    // read from the channel are stored in handles(). Existing data in these
+    // buffers is overwritten.
+    zx_status_t Read(zx_handle_t channel, uint32_t flags);
+
+    // Writes a message to the given channel.
+    //
+    // The bytes stored in bytes() are written to the channel and the handles
+    // stored in handles() are written to the channel.
+    //
+    // If this method returns ZX_OK, handles() will be empty because they were
+    // consumed by this operation.
+    zx_status_t Write(zx_handle_t channel, uint32_t flags);
+
+    // Issues a synchronous send and receive transaction on the given channel.
+    //
+    // The bytes stored in bytes() are written to the channel and the handles
+    // stored in handles() are written to the channel. The bytes read from the
+    // channel are stored in response->bytes() and the handles read from the
+    // channel are stored in response->handles().
+    //
+    // If this method returns ZX_OK, handles() will be empty because they were
+    // consumed by this operation.
+    zx_status_t Call(zx_handle_t channel, uint32_t flags, zx_time_t deadline,
+                     Message* response);
+
+    // Stop tracking the handles in stored in handles(), without closing them.
+    //
+    // Typically, these handles will be extracted during decode or the
+    // message's destructor, so this function will be unnecessary. However,
+    // for clients of ulib/fidl which decode message manually, this function
+    // is necessary to prevent extracted handles from being closed.
+    void ClearHandlesUnsafe();
+
+private:
+    BytePart bytes_;
+    HandlePart handles_;
+};
+
+} // namespace fidl
+
+#endif // LIB_FIDL_CPP_MESSAGE_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/message_buffer.h b/pkg/fidl/include/lib/fidl/cpp/message_buffer.h
new file mode 100644
index 0000000..8e85823
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/message_buffer.h
@@ -0,0 +1,58 @@
+// 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 LIB_FIDL_CPP_MESSAGE_BUFFER_H_
+#define LIB_FIDL_CPP_MESSAGE_BUFFER_H_
+
+#include <stdint.h>
+
+#include <lib/fidl/cpp/builder.h>
+#include <lib/fidl/cpp/message.h>
+#include <zircon/fidl.h>
+#include <zircon/types.h>
+
+namespace fidl {
+
+class MessageBuffer {
+public:
+    // Creates a |MessageBuffer| that allocates buffers for message of the
+    // given capacities.
+    //
+    // The buffers are freed when the |MessageBuffer| is destructed.
+    explicit MessageBuffer(
+        uint32_t bytes_capacity = ZX_CHANNEL_MAX_MSG_BYTES,
+        uint32_t handles_capacity = ZX_CHANNEL_MAX_MSG_HANDLES);
+
+    // The memory that backs the message is freed by this destructor.
+    ~MessageBuffer();
+
+    // The memory in which bytes can be stored in this buffer.
+    uint8_t* bytes() const { return buffer_; }
+
+    // The total number of bytes that can be stored in this buffer.
+    uint32_t bytes_capacity() const { return bytes_capacity_; }
+
+    // The memory in which handles can be stored in this buffer.
+    zx_handle_t* handles() const;
+
+    // The total number of handles that can be stored in this buffer.
+    uint32_t handles_capacity() const { return handles_capacity_; }
+
+    // Creates a |Message| that is backed by the memory in this buffer.
+    //
+    // The returned |Message| contains no bytes or handles.
+    Message CreateEmptyMessage();
+
+    // Creates a |Builder| that is backed by the memory in this buffer.
+    Builder CreateBuilder();
+
+private:
+    uint8_t* const buffer_;
+    const uint32_t bytes_capacity_;
+    const uint32_t handles_capacity_;
+};
+
+} // namespace fidl
+
+#endif // LIB_FIDL_CPP_MESSAGE_BUFFER_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/message_builder.h b/pkg/fidl/include/lib/fidl/cpp/message_builder.h
new file mode 100644
index 0000000..b571f3b
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/message_builder.h
@@ -0,0 +1,76 @@
+// 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 LIB_FIDL_CPP_MESSAGE_BUILDER_H_
+#define LIB_FIDL_CPP_MESSAGE_BUILDER_H_
+
+#include <stdint.h>
+
+#include <lib/fidl/cpp/builder.h>
+#include <lib/fidl/cpp/message_buffer.h>
+#include <lib/fidl/cpp/message.h>
+#include <zircon/fidl.h>
+#include <zircon/types.h>
+
+namespace fidl {
+
+// A builder for FIDL messages that owns the memory for the message.
+//
+// A |MessageBuilder| is a |Builder| that uses the heap to back the memory for
+// the message. If you wish to manage the memory yourself, you can use |Builder|
+// and |Message| directly.
+//
+// Upon creation, the |MessageBuilder| creates a FIDL message header, which you
+// can modify using |header()|.
+class MessageBuilder : public Builder {
+public:
+    // Creates a |MessageBuilder| for the given |type| that allocates buffers
+    // for message of the given capacities.
+    //
+    // The bytes buffer is initialied by adding a |fidl_message_header_t|
+    // header.
+    //
+    // The buffers are freed when the |MessageBuilder| is destructed.
+    explicit MessageBuilder(
+        const fidl_type_t* type,
+        uint32_t bytes_capacity = ZX_CHANNEL_MAX_MSG_BYTES,
+        uint32_t handles_capacity = ZX_CHANNEL_MAX_MSG_HANDLES);
+
+    // The memory that backs the message is freed by this destructor.
+    ~MessageBuilder();
+
+    // The type of the message payload this object is building.
+    const fidl_type_t* type() const { return type_; }
+
+    // The header for the message.
+    //
+    // The message header is allocated by the |MessageBuilder| itself.
+    fidl_message_header_t* header() const {
+        return reinterpret_cast<fidl_message_header_t*>(buffer());
+    }
+
+    // Encodes a message of the given |type|.
+    //
+    // The memory that backs the message returned by this function is owned by
+    // the |MessageBuilder|, which means the |MessageBuilder| must remain alive
+    // as long as the |Message| object is in use.
+    //
+    // The |message| parameter might be modified even if this method returns an
+    // error.
+    zx_status_t Encode(Message* message_out, const char** error_msg_out);
+
+    // Resets all the data in the |MessageBuffer|.
+    //
+    // The underlying buffer is retained and reused. The next object will be
+    // allocated at the start of the buffer.
+    void Reset();
+
+private:
+    const fidl_type_t* type_;
+    MessageBuffer buffer_;
+};
+
+} // namespace fidl
+
+#endif // LIB_FIDL_CPP_MESSAGE_BUILDER_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/message_part.h b/pkg/fidl/include/lib/fidl/cpp/message_part.h
new file mode 100644
index 0000000..1dd7f7b
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/message_part.h
@@ -0,0 +1,102 @@
+// 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 LIB_FIDL_CPP_MESSAGE_PART_H_
+#define LIB_FIDL_CPP_MESSAGE_PART_H_
+
+#include <stdint.h>
+#include <string.h>
+
+#include <zircon/types.h>
+
+namespace fidl {
+
+// Part of a FIDL message.
+//
+// A FIDL message has two parts: the bytes and the handles. This class is used
+// to represent both kinds of parts.
+//
+// Each part of the message has a data buffer, which contains the actual data
+// for that part of the message, a capacity for that buffer, and the actual
+// amount of data stored in the buffer, which might be less that the capacity if
+// the buffer is not completely full.
+template<typename T>
+class MessagePart {
+public:
+    using value_type = T;
+    using const_iterator = const T*;
+
+    // A message part with no storage.
+    MessagePart() : data_(nullptr), capacity_(0u), actual_(0u) {}
+
+    // A message part that uses the given storage.
+    //
+    // The constructed |MessagePart| object does not take ownership of the given
+    // storage.
+    MessagePart(T* data, uint32_t capacity, uint32_t actual = 0u)
+        : data_(data), capacity_(capacity), actual_(actual) {}
+
+    MessagePart(const MessagePart& other) = delete;
+    MessagePart& operator=(const MessagePart& other) = delete;
+
+    MessagePart(MessagePart&& other)
+        : data_(other.data_),
+          capacity_(other.capacity_),
+          actual_(other.actual_) {
+        other.data_ = nullptr;
+        other.capacity_ = 0u;
+        other.actual_ = 0u;
+    }
+
+    MessagePart& operator=(MessagePart&& other) {
+        if (this == &other)
+            return *this;
+        data_ = other.data_;
+        capacity_ = other.capacity_;
+        actual_ = other.actual_;
+        other.data_ = nullptr;
+        other.capacity_ = 0u;
+        other.actual_ = 0u;
+        return *this;
+    }
+
+    // The data stored in this part of the message.
+    T* data() const { return data_; }
+
+    // The total amount of storage available for this part of the message.
+    //
+    // This part of the message might not actually use all of this storage. To
+    // determine how much storage is actually being used, see |actual()|.
+    uint32_t capacity() const { return capacity_; }
+
+    // The amount of storage that is actually being used for this part of the
+    // message.
+    //
+    // There might be more storage available than is actually being used. To
+    // determine how much storage is available, see |capacity()|.
+    uint32_t actual() const { return actual_; }
+    void set_actual(uint32_t actual) { actual_ = actual; }
+
+    T* begin() { return data_; }
+    const T* begin() const { return data_; }
+    const T* cbegin() const { return data_; }
+
+    T* end() { return data_ + actual_; }
+    const T* end() const { return data_ + actual_; }
+    const T* cend() const { return data_ + actual_; }
+
+    size_t size() const { return actual_; }
+
+private:
+    T* data_;
+    uint32_t capacity_;
+    uint32_t actual_;
+};
+
+using BytePart = MessagePart<uint8_t>;
+using HandlePart = MessagePart<zx_handle_t>;
+
+} // namespace fidl
+
+#endif // LIB_FIDL_CPP_MESSAGE_PART_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/string_view.h b/pkg/fidl/include/lib/fidl/cpp/string_view.h
new file mode 100644
index 0000000..88eec42
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/string_view.h
@@ -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.
+
+#ifndef LIB_FIDL_CPP_STRING_VIEW_H_
+#define LIB_FIDL_CPP_STRING_VIEW_H_
+
+#include <zircon/fidl.h>
+
+namespace fidl {
+
+class StringView : public fidl_string_t {
+public:
+    StringView() : fidl_string_t{} {}
+
+    uint64_t size() const { return fidl_string_t::size; }
+    void set_size(uint64_t size) { fidl_string_t::size = size; }
+
+    const char* data() const { return fidl_string_t::data; }
+    void set_data(char* data) { fidl_string_t::data = data; }
+
+    char* mutable_data() const { return fidl_string_t::data; }
+
+    bool is_null() const { return fidl_string_t::data == nullptr; }
+    bool empty() const { return fidl_string_t::size == 0; }
+
+    const char& at(size_t offset) const { return data()[offset]; }
+    char& at(size_t offset) { return mutable_data()[offset]; }
+
+    const char& operator[](size_t offset) const { return at(offset); }
+    char& operator[](size_t offset) { return at(offset); }
+
+    char* begin() { return mutable_data(); }
+    const char* begin() const { return data(); }
+    const char* cbegin() const { return data(); }
+
+    char* end() { return mutable_data() + size(); }
+    const char* end() const { return data() + size(); }
+    const char* cend() const { return data() + size(); }
+
+    fidl_string_t* impl() { return this; }
+};
+
+} // namespace fidl
+
+#endif // LIB_FIDL_CPP_STRING_VIEW_H_
diff --git a/pkg/fidl/include/lib/fidl/cpp/vector_view.h b/pkg/fidl/include/lib/fidl/cpp/vector_view.h
new file mode 100644
index 0000000..df4cedf
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/cpp/vector_view.h
@@ -0,0 +1,47 @@
+// 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 LIB_FIDL_CPP_VECTOR_VIEW_H_
+#define LIB_FIDL_CPP_VECTOR_VIEW_H_
+
+#include <zircon/fidl.h>
+
+namespace fidl {
+
+template<typename T>
+class VectorView : public fidl_vector_t {
+public:
+    VectorView() : fidl_vector_t{} {}
+
+    uint64_t count() const { return fidl_vector_t::count; }
+    void set_count(uint64_t count) { fidl_vector_t::count = count; }
+
+    const T* data() const { return static_cast<T*>(fidl_vector_t::data); }
+    void set_data(T* data) { fidl_vector_t::data = data; }
+
+    T* mutable_data() const { return static_cast<T*>(fidl_vector_t::data); }
+
+    bool is_null() const { return fidl_vector_t::data == nullptr; }
+    bool empty() const { return fidl_vector_t::count == 0; }
+
+    const T& at(size_t offset) const { return data()[offset]; }
+    T& at(size_t offset) { return mutable_data()[offset]; }
+
+    const T& operator[](size_t offset) const { return at(offset); }
+    T& operator[](size_t offset) { return at(offset); }
+
+    T* begin() { return mutable_data(); }
+    const T* begin() const { return data(); }
+    const T* cbegin() const { return data(); }
+
+    T* end() { return mutable_data() + count(); }
+    const T* end() const { return data() + count(); }
+    const T* cend() const { return data() + count(); }
+
+    fidl_vector_t* impl() { return this; }
+};
+
+} // namespace fidl
+
+#endif // LIB_FIDL_CPP_VECTOR_VIEW_H_
diff --git a/pkg/fidl/include/lib/fidl/epitaph.h b/pkg/fidl/include/lib/fidl/epitaph.h
new file mode 100644
index 0000000..55653a7
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/epitaph.h
@@ -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.
+
+#ifndef LIB_FIDL_EPITAPH_H_
+#define LIB_FIDL_EPITAPH_H_
+
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+#ifdef __Fuchsia__
+
+// Sends an epitaph with the given values down the channel.
+// See https://fuchsia.googlesource.com/docs/+/master/development/languages/fidl/languages/c.md#fidl_epitaph_write
+zx_status_t fidl_epitaph_write(zx_handle_t channel, zx_status_t error);
+
+#endif // __Fuchsia__
+
+__END_CDECLS
+
+#endif // LIB_FIDL_EPITAPH_H_
diff --git a/pkg/fidl/include/lib/fidl/internal.h b/pkg/fidl/include/lib/fidl/internal.h
new file mode 100644
index 0000000..efef16e
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/internal.h
@@ -0,0 +1,242 @@
+// 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 LIB_FIDL_INTERNAL_H_
+#define LIB_FIDL_INTERNAL_H_
+
+#include <assert.h>
+#include <stdint.h>
+
+#include <lib/fidl/coding.h>
+#include <zircon/syscalls/object.h>
+#include <zircon/types.h>
+
+// All sizes here are given as uint32_t. Fidl message sizes are bounded to well below UINT32_MAX.
+// This also applies to arrays and vectors. For arrays, element_count * element_size will always fit
+// with 32 bits. For vectors, max_count * element_size will always fit within 32 bits.
+
+// Pointers to other type tables within a type are always nonnull, with the exception of vectors.
+// In that case, a null pointer indicates that the element type of the vector has no interesting
+// information to be decoded (i.e. no pointers or handles). The vector type still needs to be
+// emitted as it contains the information about the size of its secondary object. Contrast this with
+// arrays: being inline, ones with no interesting coding information can be elided, just like a
+// uint32 field in a struct is elided.
+
+namespace fidl {
+
+enum FidlNullability : uint32_t {
+    kNonnullable = 0u,
+    kNullable = 1u,
+};
+
+inline uint64_t FidlAlign(uint32_t offset) {
+    constexpr uint64_t alignment_mask = FIDL_ALIGNMENT - 1;
+    return (offset + alignment_mask) & ~alignment_mask;
+}
+
+struct FidlField {
+    const fidl_type* type;
+    uint32_t offset;
+
+    constexpr FidlField(const fidl_type* type, uint32_t offset)
+        : type(type), offset(offset) {}
+};
+
+struct FidlTableField {
+    const fidl_type* type;
+    uint32_t ordinal;
+
+    constexpr FidlTableField(const fidl_type* type, uint32_t ordinal)
+        : type(type), ordinal(ordinal) {}
+};
+
+enum FidlTypeTag : uint32_t {
+    kFidlTypeStruct = 0u,
+    kFidlTypeStructPointer = 1u,
+    kFidlTypeTable = 8u,
+    kFidlTypeTablePointer = 9u,
+    kFidlTypeUnion = 2u,
+    kFidlTypeUnionPointer = 3u,
+    kFidlTypeArray = 4u,
+    kFidlTypeString = 5u,
+    kFidlTypeHandle = 6u,
+    kFidlTypeVector = 7u,
+};
+
+// Though the |size| is implied by the fields, computing that information is not the purview of this
+// library. It's easier for the compiler to stash it.
+struct FidlCodedStruct {
+    const FidlField* const fields;
+    const uint32_t field_count;
+    const uint32_t size;
+    const char* name; // may be nullptr if omitted at compile time
+
+    constexpr FidlCodedStruct(const FidlField* fields, uint32_t field_count, uint32_t size,
+                              const char* name)
+        : fields(fields), field_count(field_count), size(size), name(name) {}
+};
+
+struct FidlCodedStructPointer {
+    const FidlCodedStruct* const struct_type;
+
+    constexpr explicit FidlCodedStructPointer(const FidlCodedStruct* struct_type)
+        : struct_type(struct_type) {}
+};
+
+struct FidlCodedTable {
+    const FidlTableField* const fields;
+    const uint32_t field_count;
+    const char* name; // may be nullptr if omitted at compile time
+
+    constexpr FidlCodedTable(const FidlTableField* fields, uint32_t field_count,
+                             const char* name)
+        : fields(fields), field_count(field_count), name(name) {}
+};
+
+struct FidlCodedTablePointer {
+    const FidlCodedTable* const table_type;
+
+    constexpr explicit FidlCodedTablePointer(const FidlCodedTable* table_type)
+        : table_type(table_type) {}
+};
+
+// Unlike structs, union members do not have different offsets, so this points to an array of
+// |fidl_type*| rather than |FidlField|.
+//
+// On-the-wire unions begin with a tag which is an index into |types|.
+// |data_offset| is the offset of the data in the wire format (tag + padding).
+struct FidlCodedUnion {
+    const fidl_type* const* types;
+    const uint32_t type_count;
+    const uint32_t data_offset;
+    const uint32_t size;
+    const char* name; // may be nullptr if omitted at compile time
+
+    constexpr FidlCodedUnion(const fidl_type* const* types, uint32_t type_count,
+                             uint32_t data_offset, uint32_t size, const char* name)
+        : types(types), type_count(type_count), data_offset(data_offset), size(size), name(name) {}
+};
+
+struct FidlCodedUnionPointer {
+    const FidlCodedUnion* const union_type;
+
+    constexpr explicit FidlCodedUnionPointer(const FidlCodedUnion* union_type)
+        : union_type(union_type) {}
+};
+
+// An array is essentially a struct with |array_size / element_size| of the same field, named at
+// |element|.
+struct FidlCodedArray {
+    const fidl_type* const element;
+    const uint32_t array_size;
+    const uint32_t element_size;
+
+    constexpr FidlCodedArray(const fidl_type* element, uint32_t array_size, uint32_t element_size)
+        : element(element), array_size(array_size), element_size(element_size) {}
+};
+
+// Note: must keep in sync with fidlc types.h HandleSubtype.
+enum FidlHandleSubtype : zx_obj_type_t {
+    // special case to indicate subtype is not specified.
+    kFidlHandleSubtypeHandle = ZX_OBJ_TYPE_NONE,
+
+    kFidlHandleSubtypeProcess = ZX_OBJ_TYPE_PROCESS,
+    kFidlHandleSubtypeThread = ZX_OBJ_TYPE_THREAD,
+    kFidlHandleSubtypeVmo = ZX_OBJ_TYPE_VMO,
+    kFidlHandleSubtypeChannel = ZX_OBJ_TYPE_CHANNEL,
+    kFidlHandleSubtypeEvent = ZX_OBJ_TYPE_EVENT,
+    kFidlHandleSubtypePort = ZX_OBJ_TYPE_PORT,
+    kFidlHandleSubtypeInterrupt = ZX_OBJ_TYPE_INTERRUPT,
+    kFidlHandleSubtypeLog = ZX_OBJ_TYPE_LOG,
+    kFidlHandleSubtypeSocket = ZX_OBJ_TYPE_SOCKET,
+    kFidlHandleSubtypeResource = ZX_OBJ_TYPE_RESOURCE,
+    kFidlHandleSubtypeEventpair = ZX_OBJ_TYPE_EVENTPAIR,
+    kFidlHandleSubtypeJob = ZX_OBJ_TYPE_JOB,
+    kFidlHandleSubtypeVmar = ZX_OBJ_TYPE_VMAR,
+    kFidlHandleSubtypeFifo = ZX_OBJ_TYPE_FIFO,
+    kFidlHandleSubtypeGuest = ZX_OBJ_TYPE_GUEST,
+    kFidlHandleSubtypeTimer = ZX_OBJ_TYPE_TIMER,
+};
+
+struct FidlCodedHandle {
+    const zx_obj_type_t handle_subtype;
+    const FidlNullability nullable;
+
+    constexpr FidlCodedHandle(uint32_t handle_subtype, FidlNullability nullable)
+        : handle_subtype(handle_subtype), nullable(nullable) {}
+
+    static_assert(ZX_OBJ_TYPE_LAST <= UINT32_MAX, "");
+};
+
+struct FidlCodedString {
+    const uint32_t max_size;
+    const FidlNullability nullable;
+
+    constexpr FidlCodedString(uint32_t max_size, FidlNullability nullable)
+        : max_size(max_size), nullable(nullable) {}
+};
+
+// Note that |max_count * element_size| is guaranteed to fit into a uint32_t. Unlike other types,
+// the |element| pointer may be null. This occurs when the element type contains no interesting bits
+// (i.e. pointers or handles).
+struct FidlCodedVector {
+    const fidl_type* const element;
+    const uint32_t max_count;
+    const uint32_t element_size;
+    const FidlNullability nullable;
+
+    constexpr FidlCodedVector(const fidl_type* element, uint32_t max_count, uint32_t element_size,
+                              FidlNullability nullable)
+        : element(element), max_count(max_count), element_size(element_size), nullable(nullable) {}
+};
+
+} // namespace fidl
+
+struct fidl_type {
+    const fidl::FidlTypeTag type_tag;
+    const union {
+        const fidl::FidlCodedStruct coded_struct;
+        const fidl::FidlCodedStructPointer coded_struct_pointer;
+        const fidl::FidlCodedTable coded_table;
+        const fidl::FidlCodedTablePointer coded_table_pointer;
+        const fidl::FidlCodedUnion coded_union;
+        const fidl::FidlCodedUnionPointer coded_union_pointer;
+        const fidl::FidlCodedHandle coded_handle;
+        const fidl::FidlCodedString coded_string;
+        const fidl::FidlCodedArray coded_array;
+        const fidl::FidlCodedVector coded_vector;
+    };
+
+    constexpr fidl_type(fidl::FidlCodedStruct coded_struct)
+        : type_tag(fidl::kFidlTypeStruct), coded_struct(coded_struct) {}
+
+    constexpr fidl_type(fidl::FidlCodedStructPointer coded_struct_pointer)
+        : type_tag(fidl::kFidlTypeStructPointer), coded_struct_pointer(coded_struct_pointer) {}
+
+    constexpr fidl_type(fidl::FidlCodedTable coded_table)
+        : type_tag(fidl::kFidlTypeTable), coded_table(coded_table) {}
+
+    constexpr fidl_type(fidl::FidlCodedTablePointer coded_table_pointer)
+        : type_tag(fidl::kFidlTypeTablePointer), coded_table_pointer(coded_table_pointer) {}
+
+    constexpr fidl_type(fidl::FidlCodedUnion coded_union)
+        : type_tag(fidl::kFidlTypeUnion), coded_union(coded_union) {}
+
+    constexpr fidl_type(fidl::FidlCodedUnionPointer coded_union_pointer)
+        : type_tag(fidl::kFidlTypeUnionPointer), coded_union_pointer(coded_union_pointer) {}
+
+    constexpr fidl_type(fidl::FidlCodedHandle coded_handle)
+        : type_tag(fidl::kFidlTypeHandle), coded_handle(coded_handle) {}
+
+    constexpr fidl_type(fidl::FidlCodedString coded_string)
+        : type_tag(fidl::kFidlTypeString), coded_string(coded_string) {}
+
+    constexpr fidl_type(fidl::FidlCodedArray coded_array)
+        : type_tag(fidl::kFidlTypeArray), coded_array(coded_array) {}
+
+    constexpr fidl_type(fidl::FidlCodedVector coded_vector)
+        : type_tag(fidl::kFidlTypeVector), coded_vector(coded_vector) {}
+};
+
+#endif // LIB_FIDL_INTERNAL_H_
diff --git a/pkg/fidl/include/lib/fidl/llcpp/decoded_message.h b/pkg/fidl/include/lib/fidl/llcpp/decoded_message.h
new file mode 100644
index 0000000..52d0ec5
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/llcpp/decoded_message.h
@@ -0,0 +1,119 @@
+// 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 LIB_FIDL_LLCPP_DECODED_MESSAGE_H_
+#define LIB_FIDL_LLCPP_DECODED_MESSAGE_H_
+
+#include <lib/fidl/coding.h>
+#include <lib/fidl/llcpp/encoded_message.h>
+#include <lib/fidl/llcpp/traits.h>
+#include <type_traits>
+#include <zircon/fidl.h>
+
+namespace fidl {
+
+// `DecodedMessage` manages a linearized FIDL message in decoded form.
+// It takes care of releasing all handles which were not consumed
+// (std::moved from the decoded FIDL struct) when it goes out of scope.
+template <typename FidlType>
+class DecodedMessage final {
+    static_assert(IsFidlType<FidlType>::value, "Only FIDL types allowed here");
+    static_assert(FidlType::MaxSize > 0, "Positive message size");
+
+public:
+    // Instantiates an empty message.
+    // To populate this message, decode from an EncodedMessage object.
+    DecodedMessage() = default;
+
+    // Instantiates a DecodedMessage which points to a buffer region with caller-managed memory.
+    // The buffer region is assumed to contain a linearized FIDL message with valid pointers.
+    // This does not take ownership of that buffer region.
+    // But it does take ownership of the handles within the buffer.
+    DecodedMessage(BytePart bytes) :
+        bytes_(std::move(bytes)) { }
+
+    DecodedMessage(DecodedMessage&& other) = default;
+
+    DecodedMessage& operator=(DecodedMessage&& other) = default;
+
+    DecodedMessage(const DecodedMessage& other) = delete;
+
+    DecodedMessage& operator=(const DecodedMessage& other) = delete;
+
+    ~DecodedMessage() {
+        CloseHandles();
+    }
+
+    // Keeps track of a new buffer region with caller-managed memory.
+    // The buffer region is assumed to contain a linearized FIDL message with valid pointers.
+    // This does not take ownership of that buffer region.
+    // But it does take ownership of the handles within the buffer.
+    void Reset(BytePart bytes) {
+        CloseHandles();
+        bytes_ = std::move(bytes);
+    }
+
+    // Consumes an encoded message object containing FIDL encoded bytes and handles.
+    // The current buffer region in DecodedMessage is always released.
+    // Uses the FIDL encoding tables to deserialize the message in-place.
+    // If the message is invalid, discards the buffer and returns an error.
+    zx_status_t DecodeFrom(EncodedMessage<FidlType>* msg, const char** out_error_msg) {
+        // Clear any existing message.
+        CloseHandles();
+        bytes_ = BytePart();
+        zx_status_t status = fidl_decode(FidlType::type,
+                                         msg->bytes().data(), msg->bytes().actual(),
+                                         msg->handles().data(), msg->handles().actual(),
+                                         out_error_msg);
+        // Clear out |msg| independent of success or failure
+        BytePart bytes = msg->ReleaseBytesAndHandles();
+        if (status == ZX_OK) {
+            Reset(std::move(bytes));
+        } else {
+            Reset(BytePart());
+        }
+        return status;
+    }
+
+    // Serializes the content of the message in-place and stores the result
+    // in |out_msg|. The message's contents are always consumed by this
+    // operation, even in case of an error.
+    zx_status_t EncodeTo(EncodedMessage<FidlType>* out_msg, const char** out_error_msg) {
+        return out_msg->Initialize([this, &out_error_msg] (BytePart& msg_bytes,
+                                                           HandlePart& msg_handles) {
+            msg_bytes = std::move(bytes_);
+            uint32_t actual_handles = 0;
+            zx_status_t status = fidl_encode(FidlType::type,
+                                             msg_bytes.data(), msg_bytes.actual(),
+                                             msg_handles.data(), msg_handles.capacity(),
+                                             &actual_handles, out_error_msg);
+            msg_handles.set_actual(actual_handles);
+            return status;
+        });
+    }
+
+    // Accesses the FIDL message by reinterpreting the buffer pointer.
+    // Returns nullptr if there is no message.
+    FidlType* message() const {
+        return reinterpret_cast<FidlType*>(bytes_.data());
+    }
+
+private:
+    // Use the FIDL encoding tables for |FidlType| to walk the message and
+    // destroy the handles it contains.
+    void CloseHandles() {
+#ifdef __Fuchsia__
+        if (bytes_.data()) {
+            fidl_close_handles(FidlType::type, bytes_.data(), bytes_.actual(), nullptr);
+        }
+#endif
+    }
+
+    // The contents of the decoded message.
+    BytePart bytes_;
+};
+
+}  // namespace fidl
+
+#endif // LIB_FIDL_LLCPP_DECODED_MESSAGE_H_
diff --git a/pkg/fidl/include/lib/fidl/llcpp/encoded_message.h b/pkg/fidl/include/lib/fidl/llcpp/encoded_message.h
new file mode 100644
index 0000000..8fd1a06
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/llcpp/encoded_message.h
@@ -0,0 +1,136 @@
+// 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 LIB_FIDL_LLCPP_ENCODED_MESSAGE_H_
+#define LIB_FIDL_LLCPP_ENCODED_MESSAGE_H_
+
+#include <algorithm>
+#include <cstdint>
+#include <iterator>
+#include <lib/fidl/cpp/message_part.h>
+#include <lib/fidl/llcpp/traits.h>
+#include <lib/fit/traits.h>
+#include <type_traits>
+#include <utility>
+#include <zircon/fidl.h>
+
+#ifdef __Fuchsia__
+#include <zircon/syscalls.h>
+#endif
+
+namespace fidl {
+
+// Holds an encoded FIDL message, that is, a byte array plus a handle table.
+//
+// The bytes part points to an external caller-managed buffer, while the handles part
+// is owned by this class. Any handles will be closed upon destruction.
+// This class is aware of the upper bound on the number of handles
+// in a message, such that its size can be adjusted to fit the demands
+// of a specific FIDL type.
+//
+// Because this class does not own the underlying message buffer, the caller
+// must make sure the lifetime of this class does not extend over that of the buffer.
+template <typename FidlType>
+class EncodedMessage final {
+    static_assert(IsFidlType<FidlType>::value, "Only FIDL types allowed here");
+    static_assert(FidlType::MaxSize > 0, "Positive message size");
+
+public:
+    // Instantiates an empty buffer with no bytes or handles.
+    EncodedMessage() = default;
+
+    EncodedMessage(EncodedMessage&& other) noexcept {
+        if (this != &other) {
+            MoveImpl(std::move(other));
+        }
+    }
+
+    EncodedMessage& operator=(EncodedMessage&& other) noexcept {
+        if (this != &other) {
+            MoveImpl(std::move(other));
+        }
+        return *this;
+    }
+
+    EncodedMessage(const EncodedMessage& other) = delete;
+
+    EncodedMessage& operator=(const EncodedMessage& other) = delete;
+
+    // Instantiates an EncodedMessage which points to a buffer region with caller-managed memory.
+    // It does not take ownership of that buffer region.
+    // Also initializes an empty handles part.
+    EncodedMessage(BytePart bytes) :
+        bytes_(std::move(bytes)) { }
+
+    ~EncodedMessage() {
+        CloseHandles();
+    }
+
+    // Takes ownership of the contents of the message.
+    // The bytes and handle parts will become empty, while the existing bytes part is returned.
+    // The caller is responsible for having transferred the handles elsewhere
+    // before calling this method.
+    BytePart ReleaseBytesAndHandles() {
+        handles_.set_actual(0);
+        BytePart return_bytes = std::move(bytes_);
+        return return_bytes;
+    }
+
+    const BytePart& bytes() const { return bytes_; }
+
+    const HandlePart& handles() const { return handles_; }
+
+    // Clears the contents of the EncodedMessage then invokes Callback
+    // to initialize the EncodedMessage in-place then returns the callback's
+    // result.
+    //
+    // |callback| is a callable object whose arguments are (BytePart&, HandlePart&).
+    template <typename Callback>
+    decltype(auto) Initialize(Callback callback) {
+        static_assert(
+            fit::callable_traits<Callback>::args::size == 2 &&
+            std::is_same<
+                BytePart&,
+                typename fit::template callable_traits<Callback>::args::template at<0>>::value &&
+            std::is_same<
+                HandlePart&,
+                typename fit::template callable_traits<Callback>::args::template at<1>>::value,
+            "Callback signature must be: T(BytePart&, HandlePart&).");
+        bytes_ = BytePart();
+        CloseHandles();
+        return callback(bytes_, handles_);
+    }
+
+private:
+    void CloseHandles() {
+        if (handles_.actual() > 0) {
+#ifdef __Fuchsia__
+            zx_handle_close_many(handles_.data(), handles_.actual());
+#else
+            // How did we have handles if not on Fuchsia? Something bad happened...
+            assert(false);
+#endif
+            handles_.set_actual(0);
+        }
+    }
+
+    void MoveImpl(EncodedMessage&& other) noexcept {
+        CloseHandles();
+        bytes_ = std::move(other.bytes_);
+        // copy handles from |other|
+        memcpy(handle_storage_, other.handle_storage_,
+            other.handles_.actual() * sizeof(zx_handle_t));
+        // release handles in |other|
+        handles_.set_actual(other.handles().actual());
+        other.handles_.set_actual(0);
+    }
+
+    BytePart bytes_;
+    zx_handle_t handle_storage_[FidlType::MaxNumHandles];
+    HandlePart handles_{handle_storage_, FidlType::MaxNumHandles};
+};
+
+}
+
+#endif  // LIB_FIDL_LLCPP_ENCODED_MESSAGE_H_
diff --git a/pkg/fidl/include/lib/fidl/llcpp/traits.h b/pkg/fidl/include/lib/fidl/llcpp/traits.h
new file mode 100644
index 0000000..80fadd7
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/llcpp/traits.h
@@ -0,0 +1,67 @@
+// 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 LIB_FIDL_LLCPP_TRAITS_H_
+#define LIB_FIDL_LLCPP_TRAITS_H_
+
+#include <lib/zx/object.h>
+#include <stdint.h>
+#include <type_traits>
+#include <zircon/fidl.h>
+
+// Defines type traits used in the low-level C++ binding.
+//
+// The contracts of a FIDL type |T| are as follows:
+//
+// |IsFidlType<T>| resolves to std::true_type.
+// |IsFidlMessage<T>| resolves to std::true_type iff |T| is a transactional message.
+// |T::MaxNumHandles| is an uint32_t specifying the upper bound on the number of contained handles.
+// |T::MaxSize| is an uint32_t specifying the upper bound on the message byte size.
+//              It is std::numeric_limits<uint32_t>::max() if |T| is unbounded.
+// |T::type| is a fidl_type_t* pointing to the corresponding encoding table, if any.
+//
+
+namespace fidl {
+
+// A type trait that indicates whether the given type is a request/response type
+// i.e. has a FIDL message header.
+template <typename T> struct IsFidlMessage : public std::false_type {};
+
+// Code-gen will explicitly conform the generated FIDL transactional messages to IsFidlMessage.
+
+// A type trait that indicates whether the given type is allowed to appear in
+// generated binding APIs and can be encoded/decoded.
+// As a start, all handle types are supported.
+template <typename T> struct IsFidlType :
+    public std::is_base_of<zx::object_base, T> {};
+
+// clang-format off
+// Specialize for primitives
+template <> struct IsFidlType<bool> : public std::true_type {};
+template <> struct IsFidlType<uint8_t> : public std::true_type {};
+template <> struct IsFidlType<uint16_t> : public std::true_type {};
+template <> struct IsFidlType<uint32_t> : public std::true_type {};
+template <> struct IsFidlType<uint64_t> : public std::true_type {};
+template <> struct IsFidlType<int8_t> : public std::true_type {};
+template <> struct IsFidlType<int16_t> : public std::true_type {};
+template <> struct IsFidlType<int32_t> : public std::true_type {};
+template <> struct IsFidlType<int64_t> : public std::true_type {};
+template <> struct IsFidlType<float> : public std::true_type {};
+template <> struct IsFidlType<double> : public std::true_type {};
+// clang-format on
+
+// String
+class StringView;
+template <> struct IsFidlType<StringView> : public std::true_type {};
+
+// Vector (conditional on element)
+template <typename E> class VectorView;
+template <typename E>
+struct IsFidlType<VectorView<E>> : public IsFidlType<E> {};
+
+// Code-gen will explicitly conform the generated FIDL structures to IsFidlType.
+
+}  // namespace fidl
+
+#endif // LIB_FIDL_LLCPP_TRAITS_H_
diff --git a/pkg/fidl/include/lib/fidl/transport.h b/pkg/fidl/include/lib/fidl/transport.h
new file mode 100644
index 0000000..2da0d9c
--- /dev/null
+++ b/pkg/fidl/include/lib/fidl/transport.h
@@ -0,0 +1,46 @@
+// 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 LIB_FIDL_TRANSPORT_H_
+#define LIB_FIDL_TRANSPORT_H_
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// Writes |capacity| bytes from |buffer| to the control channel of |socket|.
+//
+// Blocks until |socket| is able to accept a control plane message.
+zx_status_t fidl_socket_write_control(zx_handle_t socket, const void* buffer,
+                                      size_t capacity);
+
+// Reads |capacity| bytes from the control channel of |socket| to |buffer|.
+//
+// Blocks until a control plane message is able to be read from |socket|.
+//
+// The actual number of bytes reads from the control plan is returned in
+// |out_actual|.
+zx_status_t fidl_socket_read_control(zx_handle_t socket, void* buffer,
+                                     size_t capacity, size_t* out_actual);
+
+// Issues a transaction on the control channel of |socket|.
+//
+// First, writes |capacity| bytes from |buffer| to the control channel of
+// |socket|. Second, reads |out_capacity| bytes from the control channel of
+// |socket| to |out_buffer|.
+//
+// Blocks until the transaction is complete.
+//
+// |buffer| and |out_buffer| may be aliased.
+//
+// The actual number of bytes reads from the control plan is returned in
+// |out_actual|.
+zx_status_t fidl_socket_call_control(zx_handle_t socket, const void* buffer,
+                                     size_t capacity, void* out_buffer,
+                                     size_t out_capacity, size_t* out_actual);
+
+__END_CDECLS
+
+#endif // LIB_FIDL_TRANSPORT_H_
diff --git a/pkg/fidl/message.cpp b/pkg/fidl/message.cpp
new file mode 100644
index 0000000..6857459
--- /dev/null
+++ b/pkg/fidl/message.cpp
@@ -0,0 +1,117 @@
+// 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.
+
+#include <lib/fidl/cpp/message.h>
+
+#include <string.h>
+
+#include <lib/fidl/coding.h>
+#include <lib/fidl/cpp/builder.h>
+
+#ifdef __Fuchsia__
+#include <zircon/syscalls.h>
+#endif
+
+namespace fidl {
+
+Message::Message() = default;
+
+Message::Message(BytePart bytes, HandlePart handles)
+    : bytes_(static_cast<BytePart&&>(bytes)),
+      handles_(static_cast<HandlePart&&>(handles)) {}
+
+Message::~Message() {
+#ifdef __Fuchsia__
+    zx_handle_close_many(handles_.data(), handles_.actual());
+#endif
+    ClearHandlesUnsafe();
+}
+
+Message::Message(Message&& other)
+    : bytes_(static_cast<BytePart&&>(other.bytes_)),
+      handles_(static_cast<HandlePart&&>(other.handles_)) {}
+
+Message& Message::operator=(Message&& other) {
+    bytes_ = static_cast<BytePart&&>(other.bytes_);
+    handles_ = static_cast<HandlePart&&>(other.handles_);
+    return *this;
+}
+
+zx_status_t Message::Encode(const fidl_type_t* type,
+                            const char** error_msg_out) {
+    uint32_t actual_handles = 0u;
+    zx_status_t status = fidl_encode(type, bytes_.data(), bytes_.actual(),
+                                     handles_.data(), handles_.capacity(),
+                                     &actual_handles, error_msg_out);
+    if (status == ZX_OK)
+        handles_.set_actual(actual_handles);
+    return status;
+}
+
+zx_status_t Message::Decode(const fidl_type_t* type,
+                            const char** error_msg_out) {
+    zx_status_t status = fidl_decode(type, bytes_.data(), bytes_.actual(),
+                                     handles_.data(), handles_.actual(),
+                                     error_msg_out);
+    ClearHandlesUnsafe();
+    return status;
+}
+
+zx_status_t Message::Validate(const fidl_type_t* type,
+                              const char** error_msg_out) const {
+    return fidl_validate(type, bytes_.data(), bytes_.actual(),
+                         handles_.actual(), error_msg_out);
+}
+
+#ifdef __Fuchsia__
+zx_status_t Message::Read(zx_handle_t channel, uint32_t flags) {
+    uint32_t actual_bytes = 0u;
+    uint32_t actual_handles = 0u;
+    zx_status_t status = zx_channel_read(
+        channel, flags, bytes_.data(), handles_.data(), bytes_.capacity(),
+        handles_.capacity(), &actual_bytes, &actual_handles);
+    if (status == ZX_OK) {
+        bytes_.set_actual(actual_bytes);
+        handles_.set_actual(actual_handles);
+    }
+    return status;
+}
+
+zx_status_t Message::Write(zx_handle_t channel, uint32_t flags) {
+    zx_status_t status = zx_channel_write(channel, flags, bytes_.data(),
+                                          bytes_.actual(), handles_.data(),
+                                          handles_.actual());
+    ClearHandlesUnsafe();
+    return status;
+}
+
+zx_status_t Message::Call(zx_handle_t channel, uint32_t flags,
+                          zx_time_t deadline, Message* response) {
+    zx_channel_call_args_t args;
+    args.wr_bytes = bytes_.data();
+    args.wr_handles = handles_.data();
+    args.rd_bytes = response->bytes_.data();
+    args.rd_handles = response->handles_.data();
+    args.wr_num_bytes = bytes_.actual();
+    args.wr_num_handles = handles_.actual();
+    args.rd_num_bytes = response->bytes_.capacity();
+    args.rd_num_handles = response->handles_.capacity();
+    uint32_t actual_bytes = 0u;
+    uint32_t actual_handles = 0u;
+    zx_status_t status = zx_channel_call(channel, flags, deadline, &args,
+                                         &actual_bytes, &actual_handles);
+    ClearHandlesUnsafe();
+    if (status == ZX_OK) {
+        response->bytes_.set_actual(actual_bytes);
+        response->handles_.set_actual(actual_handles);
+    }
+    return status;
+}
+#endif
+
+void Message::ClearHandlesUnsafe() {
+    handles_.set_actual(0u);
+}
+
+} // namespace fidl
diff --git a/pkg/fidl/message_buffer.cpp b/pkg/fidl/message_buffer.cpp
new file mode 100644
index 0000000..54e2346
--- /dev/null
+++ b/pkg/fidl/message_buffer.cpp
@@ -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.
+
+#include <lib/fidl/cpp/message_buffer.h>
+#include <zircon/assert.h>
+
+#include <stdlib.h>
+
+namespace fidl {
+namespace {
+
+uint64_t AddPadding(uint32_t offset) {
+    constexpr uint32_t kMask = alignof(zx_handle_t) - 1;
+    // Cast before addition to avoid overflow.
+    return static_cast<uint64_t>(offset) + static_cast<uint64_t>(offset & kMask);
+}
+
+size_t GetAllocSize(uint32_t bytes_capacity, uint32_t handles_capacity) {
+    return AddPadding(bytes_capacity) + sizeof(zx_handle_t) * handles_capacity;
+}
+
+} // namespace
+
+MessageBuffer::MessageBuffer(uint32_t bytes_capacity,
+                             uint32_t handles_capacity)
+    : buffer_(static_cast<uint8_t*>(malloc(GetAllocSize(bytes_capacity, handles_capacity)))),
+      bytes_capacity_(bytes_capacity),
+      handles_capacity_(handles_capacity) {
+    ZX_ASSERT_MSG(buffer_, "malloc returned NULL in MessageBuffer::MessageBuffer()");
+}
+
+MessageBuffer::~MessageBuffer() {
+    free(buffer_);
+}
+
+zx_handle_t* MessageBuffer::handles() const {
+    return reinterpret_cast<zx_handle_t*>(buffer_ + AddPadding(bytes_capacity_));
+}
+
+Message MessageBuffer::CreateEmptyMessage() {
+    return Message(BytePart(bytes(), bytes_capacity()),
+                   HandlePart(handles(), handles_capacity()));
+}
+
+Builder MessageBuffer::CreateBuilder() {
+    return Builder(bytes(), bytes_capacity());
+}
+
+} // namespace fidl
diff --git a/pkg/fidl/message_builder.cpp b/pkg/fidl/message_builder.cpp
new file mode 100644
index 0000000..c178690
--- /dev/null
+++ b/pkg/fidl/message_builder.cpp
@@ -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.
+
+#include <lib/fidl/cpp/message_builder.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+namespace fidl {
+
+MessageBuilder::MessageBuilder(const fidl_type_t* type,
+                               uint32_t bytes_capacity,
+                               uint32_t handles_capacity)
+    : type_(type),
+      buffer_(bytes_capacity, handles_capacity) {
+    Reset();
+}
+
+MessageBuilder::~MessageBuilder() = default;
+
+zx_status_t MessageBuilder::Encode(Message* message_out,
+                                   const char** error_msg_out) {
+    *message_out = Message(Finalize(),
+                           HandlePart(buffer_.handles(),
+                                      buffer_.handles_capacity()));
+    return message_out->Encode(type_, error_msg_out);
+}
+
+void MessageBuilder::Reset() {
+    Builder::Reset(buffer_.bytes(), buffer_.bytes_capacity());
+    New<fidl_message_header_t>();
+}
+
+} // namespace fidl
diff --git a/pkg/fidl/meta.json b/pkg/fidl/meta.json
new file mode 100644
index 0000000..be54c7d
--- /dev/null
+++ b/pkg/fidl/meta.json
@@ -0,0 +1,67 @@
+{
+  "banjo_deps": [], 
+  "deps": [], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/fidl/buffer_walker.h", 
+    "pkg/fidl/builder.cpp", 
+    "pkg/fidl/decoding.cpp", 
+    "pkg/fidl/encoding.cpp", 
+    "pkg/fidl/epitaph.c", 
+    "pkg/fidl/formatting.cpp", 
+    "pkg/fidl/handle_closing.cpp", 
+    "pkg/fidl/message.cpp", 
+    "pkg/fidl/message_buffer.cpp", 
+    "pkg/fidl/message_builder.cpp", 
+    "pkg/fidl/transport.cpp", 
+    "pkg/fidl/validating.cpp", 
+    "pkg/fidl/include/lib/fidl/coding.h", 
+    "pkg/fidl/include/lib/fidl/cpp/builder.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message_buffer.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message_builder.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message_part.h", 
+    "pkg/fidl/include/lib/fidl/cpp/string_view.h", 
+    "pkg/fidl/include/lib/fidl/cpp/vector_view.h", 
+    "pkg/fidl/include/lib/fidl/epitaph.h", 
+    "pkg/fidl/include/lib/fidl/internal.h", 
+    "pkg/fidl/include/lib/fidl/llcpp/decoded_message.h", 
+    "pkg/fidl/include/lib/fidl/llcpp/encoded_message.h", 
+    "pkg/fidl/include/lib/fidl/llcpp/traits.h", 
+    "pkg/fidl/include/lib/fidl/transport.h"
+  ], 
+  "headers": [
+    "pkg/fidl/include/lib/fidl/coding.h", 
+    "pkg/fidl/include/lib/fidl/cpp/builder.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message_buffer.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message_builder.h", 
+    "pkg/fidl/include/lib/fidl/cpp/message_part.h", 
+    "pkg/fidl/include/lib/fidl/cpp/string_view.h", 
+    "pkg/fidl/include/lib/fidl/cpp/vector_view.h", 
+    "pkg/fidl/include/lib/fidl/epitaph.h", 
+    "pkg/fidl/include/lib/fidl/internal.h", 
+    "pkg/fidl/include/lib/fidl/llcpp/decoded_message.h", 
+    "pkg/fidl/include/lib/fidl/llcpp/encoded_message.h", 
+    "pkg/fidl/include/lib/fidl/llcpp/traits.h", 
+    "pkg/fidl/include/lib/fidl/transport.h"
+  ], 
+  "include_dir": "pkg/fidl/include", 
+  "name": "fidl", 
+  "root": "pkg/fidl", 
+  "sources": [
+    "pkg/fidl/buffer_walker.h", 
+    "pkg/fidl/builder.cpp", 
+    "pkg/fidl/decoding.cpp", 
+    "pkg/fidl/encoding.cpp", 
+    "pkg/fidl/epitaph.c", 
+    "pkg/fidl/formatting.cpp", 
+    "pkg/fidl/handle_closing.cpp", 
+    "pkg/fidl/message.cpp", 
+    "pkg/fidl/message_buffer.cpp", 
+    "pkg/fidl/message_builder.cpp", 
+    "pkg/fidl/transport.cpp", 
+    "pkg/fidl/validating.cpp"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/fidl/transport.cpp b/pkg/fidl/transport.cpp
new file mode 100644
index 0000000..253b5ec
--- /dev/null
+++ b/pkg/fidl/transport.cpp
@@ -0,0 +1,70 @@
+// 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.
+
+#ifdef __Fuchsia__
+
+#include <lib/fidl/transport.h>
+#include <zircon/assert.h>
+#include <zircon/syscalls.h>
+
+zx_status_t fidl_socket_write_control(zx_handle_t socket, const void* buffer,
+                                      size_t capacity) {
+    for (;;) {
+        zx_status_t status = zx_socket_write(socket, ZX_SOCKET_CONTROL, buffer,
+                                             capacity, nullptr);
+        if (status != ZX_ERR_SHOULD_WAIT) {
+            return status;
+        }
+
+        zx_signals_t observed = ZX_SIGNAL_NONE;
+        status = zx_object_wait_one(socket, ZX_SOCKET_CONTROL_WRITABLE | ZX_SOCKET_PEER_CLOSED,
+                                    ZX_TIME_INFINITE, &observed);
+        if (status != ZX_OK) {
+            return status;
+        }
+
+        if (observed & ZX_SOCKET_PEER_CLOSED) {
+            return ZX_ERR_PEER_CLOSED;
+        }
+
+        ZX_ASSERT(observed & ZX_SOCKET_CONTROL_WRITABLE);
+    }
+}
+
+zx_status_t fidl_socket_read_control(zx_handle_t socket, void* buffer,
+                                     size_t capacity, size_t* out_actual) {
+    for (;;) {
+        zx_status_t status = zx_socket_read(socket, ZX_SOCKET_CONTROL, buffer,
+                                            capacity, out_actual);
+        if (status != ZX_ERR_SHOULD_WAIT) {
+            return status;
+        }
+
+        zx_signals_t observed = ZX_SIGNAL_NONE;
+        status = zx_object_wait_one(socket, ZX_SOCKET_CONTROL_READABLE | ZX_SOCKET_PEER_CLOSED,
+                                    ZX_TIME_INFINITE, &observed);
+        if (status != ZX_OK) {
+            return status;
+        }
+
+        if (observed & ZX_SOCKET_CONTROL_READABLE) {
+            continue;
+        }
+
+        ZX_ASSERT(observed & ZX_SOCKET_PEER_CLOSED);
+        return ZX_ERR_PEER_CLOSED;
+    }
+}
+
+zx_status_t fidl_socket_call_control(zx_handle_t socket, const void* buffer,
+                                     size_t capacity, void* out_buffer,
+                                     size_t out_capacity, size_t* out_actual) {
+    zx_status_t status = fidl_socket_write_control(socket, buffer, capacity);
+    if (status != ZX_OK) {
+        return status;
+    }
+    return fidl_socket_read_control(socket, out_buffer, out_capacity, out_actual);
+}
+
+#endif
diff --git a/pkg/fidl/validating.cpp b/pkg/fidl/validating.cpp
new file mode 100644
index 0000000..342face
--- /dev/null
+++ b/pkg/fidl/validating.cpp
@@ -0,0 +1,90 @@
+// 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.
+
+#include <lib/fidl/coding.h>
+
+#include <stdalign.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <lib/fidl/internal.h>
+#include <zircon/assert.h>
+#include <zircon/compiler.h>
+
+#include "buffer_walker.h"
+
+// TODO(kulakowski) Design zx_status_t error values.
+
+namespace {
+
+class FidlValidator final : public fidl::internal::BufferWalker<FidlValidator, false, false> {
+    typedef fidl::internal::BufferWalker<FidlValidator, false, false> Super;
+
+public:
+    FidlValidator(const fidl_type_t* type, const void* bytes, uint32_t num_bytes,
+                  uint32_t num_handles, const char** out_error_msg)
+        : Super(type), bytes_(static_cast<const uint8_t*>(bytes)), num_bytes_(num_bytes),
+          num_handles_(num_handles), out_error_msg_(out_error_msg) {}
+
+    void Walk() {
+        Super::Walk();
+        if (status_ == ZX_OK && handle_idx() != num_handles()) {
+            SetError("message did not contain the specified number of handles");
+            return;
+        }
+    }
+
+    const uint8_t* bytes() const { return bytes_; }
+    uint32_t num_bytes() const { return num_bytes_; }
+    uint32_t num_handles() const { return num_handles_; }
+
+    bool ValidateOutOfLineStorageClaim(const void* a, const void* b) {
+        return true;
+    }
+
+    void UnclaimedHandle(const zx_handle_t* out_handle) {}
+    void ClaimedHandle(const zx_handle_t* out_handle, uint32_t idx) {}
+
+    template <class T>
+    void UpdatePointer(const T* const* p, const T* v) {}
+
+    PointerState GetPointerState(const void* ptr) const {
+        return static_cast<PointerState>(*static_cast<const uintptr_t*>(ptr));
+    }
+    HandleState GetHandleState(zx_handle_t p) const {
+        return static_cast<HandleState>(p);
+    }
+
+    void SetError(const char* error_msg) {
+        status_ = ZX_ERR_INVALID_ARGS;
+        if (out_error_msg_ != nullptr) {
+            *out_error_msg_ = error_msg;
+        }
+    }
+
+    zx_status_t status() const { return status_; }
+
+private:
+    // Message state passed in to the constructor.
+    const uint8_t* const bytes_;
+    const uint32_t num_bytes_;
+    const uint32_t num_handles_;
+    const char** const out_error_msg_;
+    zx_status_t status_ = ZX_OK;
+};
+
+} // namespace
+
+zx_status_t fidl_validate(const fidl_type_t* type, const void* bytes, uint32_t num_bytes,
+                          uint32_t num_handles, const char** out_error_msg) {
+    FidlValidator validator(type, bytes, num_bytes, num_handles, out_error_msg);
+    validator.Walk();
+    return validator.status();
+}
+
+zx_status_t fidl_validate_msg(const fidl_type_t* type, const fidl_msg_t* msg,
+                              const char** out_error_msg) {
+    return fidl_validate(type, msg->bytes, msg->num_bytes, msg->num_handles,
+                         out_error_msg);
+}
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/binding.h b/pkg/fidl_cpp/include/lib/fidl/cpp/binding.h
new file mode 100644
index 0000000..05c0637
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/binding.h
@@ -0,0 +1,239 @@
+// 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 LIB_FIDL_CPP_BINDING_H_
+#define LIB_FIDL_CPP_BINDING_H_
+
+#include <lib/async/dispatcher.h>
+#include <lib/fit/function.h>
+#include <lib/zx/channel.h>
+#include <zircon/assert.h>
+
+#include <memory>
+#include <utility>
+
+#include "lib/fidl/cpp/interface_handle.h"
+#include "lib/fidl/cpp/interface_ptr.h"
+#include "lib/fidl/cpp/interface_request.h"
+#include "lib/fidl/cpp/internal/stub_controller.h"
+
+namespace fidl {
+
+// Binds the implementation of |Interface| to a channel.
+//
+// The |Binding| listens for incoming messages on the channel, decodes them, and
+// calls the appropriate method on the bound implementation. If the message
+// expects a reply, the |Binding| creates callbacks that encode and send
+// reply messages when called.
+//
+// When the |Binding| object is destroyed, the binding between the channel
+// and the interface is torn down and the channel is closed, leaving the
+// |Binding| in an unbound state.
+//
+// The implementation pointer type of the binding is also parameterized,
+// allowing the use of smart pointer types such as |std::unique_ptr| to
+// reference the implementation.
+//
+// Example:
+//
+//   #include "foo.fidl.h"
+//
+//   class FooImpl : public Foo {
+//    public:
+//     explicit FooImpl(InterfaceRequest<Foo> request)
+//         : binding_(this, std::move(request)) {}
+//
+//     // Foo implementation here.
+//
+//    private:
+//     Binding<Foo> binding_;
+//   };
+//
+// After the |Binding| has been bound to an implementation, the implementation
+// will receive methods calls from the remote endpoint of the channel on the
+// async_t on which the |InterfaceRequest| was bound. By default this is the
+// thread on which the binding occurred.
+//
+// See also:
+//
+//  * |InterfacePtr|, which is the client analog of a |Binding|.
+template <typename Interface, typename ImplPtr = Interface*>
+class Binding {
+ public:
+  // Constructs an incomplete binding that will use the implementation |impl|.
+  //
+  // The binding may be completed with a subsequent call to the |Bind| method.
+  // Does not take ownership of |impl|, which must outlive the binding.
+  explicit Binding(ImplPtr impl)
+      : impl_(std::forward<ImplPtr>(impl)), stub_(&*this->impl()) {
+    controller_.set_stub(&stub_);
+    stub_.set_controller(&controller_);
+  }
+
+  // Constructs a completed binding of |channel| to implementation |impl|.
+  //
+  // Does not take ownership of |impl|, which must outlive the binding.
+  //
+  // If the |Binding| cannot be bound to the given |channel| (e.g., because
+  // the |channel| lacks |ZX_RIGHT_WAIT|), the |Binding| will be constructed
+  // in an unbound state.
+  //
+  // Uses the given async_dispatcher_t (e.g., a message loop) in order to read
+  // messages from the channel and to monitor the channel for
+  // |ZX_CHANNEL_PEER_CLOSED|.  If |dispatcher| is null, the current thread must
+  // have a default async_dispatcher_t.
+  Binding(ImplPtr impl, zx::channel channel,
+          async_dispatcher_t* dispatcher = nullptr)
+      : Binding(std::forward<ImplPtr>(impl)) {
+    Bind(std::move(channel), dispatcher);
+  }
+
+  // Constructs a completed binding of |impl| to the channel in |request|.
+  //
+  // Does not take ownership of |impl|, which must outlive the binding.
+  //
+  // If the |Binding| cannot be bound to the given |channel| (e.g., because
+  // the |channel| lacks |ZX_RIGHT_WAIT|), the |Binding| will be constructed
+  // in an unbound state.
+  //
+  // Uses the given async_dispatcher_t (e.g., a message loop) in order to read
+  // messages from the channel and to monitor the channel for
+  // |ZX_CHANNEL_PEER_CLOSED|.  If |dispatcher| is null, the current thread must
+  // have a default async_dispatcher_t.
+  Binding(ImplPtr impl, InterfaceRequest<Interface> request,
+          async_dispatcher_t* dispatcher = nullptr)
+      : Binding(std::forward<ImplPtr>(impl)) {
+    Bind(request.TakeChannel(), dispatcher);
+  }
+
+  Binding(const Binding&) = delete;
+  Binding& operator=(const Binding&) = delete;
+
+  // Completes a binding by creating a new channel, binding one endpoint to
+  // the previously specified implementation and returning the other endpoint.
+  //
+  // If |NewBinding| fails to create the underlying channel, the returned
+  // |InterfaceHandle| will return false from |is_valid()|.
+  //
+  // Uses the given async_dispatcher_t (e.g., a message loop) in order to read
+  // messages from the channel and to monitor the channel for
+  // |ZX_CHANNEL_PEER_CLOSED|.  If |dispatcher| is null, the current thread must
+  // have a default async_dispatcher_t.
+  InterfaceHandle<Interface> NewBinding(
+      async_dispatcher_t* dispatcher = nullptr) {
+    InterfaceHandle<Interface> client;
+    Bind(client.NewRequest().TakeChannel(), dispatcher);
+    return client;
+  }
+
+  // Binds the previously specified implementation to the given |channel|.
+  //
+  // If the |Binding| was prevously bound to another channel, that channel is
+  // closed.
+  //
+  // Uses the given async_dispatcher_t (e.g., a message loop) in order to read
+  // messages from the channel and to monitor the channel for
+  // |ZX_CHANNEL_PEER_CLOSED|.  If |dispatcher| is null, the current thread must
+  // have a default async_dispatcher_t.
+  //
+  // Returns an error if the binding was not able to be created (e.g., because
+  // the |channel| lacks |ZX_RIGHT_WAIT|).
+  zx_status_t Bind(zx::channel channel,
+                   async_dispatcher_t* dispatcher = nullptr) {
+    return controller_.reader().Bind(std::move(channel), dispatcher);
+  }
+
+  // Binds the previously specified implementation to the given
+  // |InterfaceRequest|.
+  //
+  // If the |Binding| was prevously bound to another channel, that channel is
+  // closed.
+  //
+  // Uses the given async_dispatcher_t (e.g., a message loop) in order to read
+  // messages from the channel and to monitor the channel for
+  // |ZX_CHANNEL_PEER_CLOSED|.  If |dispatcher| is null, the current thread must
+  // have a default async_dispatcher_t.
+  //
+  // Returns an error if the binding was not able to be created (e.g., because
+  // the |channel| lacks |ZX_RIGHT_WAIT|).
+  zx_status_t Bind(InterfaceRequest<Interface> request,
+                   async_dispatcher_t* dispatcher = nullptr) {
+    return Bind(request.TakeChannel(), dispatcher);
+  }
+
+  // Unbinds the underlying channel from this binding and returns it so it can
+  // be used in another context, such as on another thread or with a different
+  // implementation.
+  //
+  // After this function returns, the |Binding| is ready to be bound to another
+  // channel.
+  InterfaceRequest<Interface> Unbind() {
+    return InterfaceRequest<Interface>(controller_.reader().Unbind());
+  }
+
+  // Sends an Epitaph over the bound channel corresponding to the error passed
+  // as a parameter, closes the channel, and unbinds it.  An Epitaph is the last
+  // message sent over a channel before a close operation; for the purposes of
+  // this function, it can be thought of as a return code.  See the FIDL
+  // language spec for more information about Epitaphs.
+  //
+  // The return value can be any of the return values of zx_channel_write.
+  zx_status_t Close(zx_status_t epitaph_value) {
+    return controller_.reader().Close(epitaph_value);
+  }
+
+  // Blocks the calling thread until either a message arrives on the previously
+  // bound channel or an error occurs.
+  //
+  // Returns an error if waiting for the message, reading the message, or
+  // processing the message fails. If the error results in the channel being
+  // closed, the error handler will be called synchronously before this
+  // method returns.
+  //
+  // This method can be called only if this |Binding| is currently bound to a
+  // channel.
+  zx_status_t WaitForMessage() {
+    return controller_.reader().WaitAndDispatchOneMessageUntil(
+        zx::time::infinite());
+  }
+
+  // Sets an error handler that will be called if an error causes the underlying
+  // channel to be closed.
+  //
+  // If the error is being reported because an error occurred on the local side
+  // of the channel, the zx_status_t of that error will be passed as the
+  // parameter to the handler.
+  //
+  // If an Epitaph was present on the channel, its error value will be passed as
+  // the parameter.  See the FIDL language specification for more detail on
+  // Epitaphs.
+  //
+  // For example, the error handler will be called if the remote side of the
+  // channel sends an invalid message. When the error handler is called, the
+  // |Binding| will no longer be bound to the channel.
+  void set_error_handler(fit::function<void(zx_status_t)> error_handler) {
+    controller_.reader().set_error_handler(std::move(error_handler));
+  }
+
+  // The implementation used by this |Binding| to process incoming messages.
+  const ImplPtr& impl() const { return impl_; }
+
+  // The interface for sending events back to the client.
+  typename Interface::EventSender_& events() { return stub_; }
+
+  // Whether this |Binding| is currently listening to a channel.
+  bool is_bound() const { return controller_.reader().is_bound(); }
+
+  // The underlying channel.
+  const zx::channel& channel() const { return controller_.reader().channel(); }
+
+ private:
+  const ImplPtr impl_;
+  typename Interface::Stub_ stub_;
+  internal::StubController controller_;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_BINDING_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/binding_set.h b/pkg/fidl_cpp/include/lib/fidl/cpp/binding_set.h
new file mode 100644
index 0000000..c505344
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/binding_set.h
@@ -0,0 +1,156 @@
+// 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 LIB_FIDL_CPP_BINDING_SET_H_
+#define LIB_FIDL_CPP_BINDING_SET_H_
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <lib/fit/function.h>
+
+#include "lib/fidl/cpp/binding.h"
+
+namespace fidl {
+
+// Manages a set of bindings to implementations owned by the bound channels.
+//
+// The implementation pointer type of the binding is also parameterized,
+// allowing the use of smart pointer types such as |std::unique_ptr<>| to
+// reference the implementation.
+//
+// See also:
+//
+//  * |InterfacePtrSet|, which is the client analog of |BindingSet|.
+template <typename Interface, typename ImplPtr = Interface*>
+class BindingSet {
+ public:
+  using Binding = ::fidl::Binding<Interface, ImplPtr>;
+  using StorageType = std::vector<std::unique_ptr<Binding>>;
+
+  using iterator = typename StorageType::iterator;
+
+  BindingSet() = default;
+
+  BindingSet(const BindingSet&) = delete;
+  BindingSet& operator=(const BindingSet&) = delete;
+
+  // Adds a binding to the set.
+  //
+  // The given |ImplPtr| is bound to the channel underlying the
+  // |InterfaceRequest|. The binding is removed (and the |~ImplPtr| called)
+  // when the created binding has an error (e.g., if the remote endpoint of
+  // the channel sends an invalid message).
+  //
+  // Whether this method takes ownership of |impl| depends on |ImplPtr|. If
+  // |ImplPtr| is a raw pointer, then this method does not take ownership of
+  // |impl|. If |ImplPtr| is a |unique_ptr|, then running |~ImplPtr| when the
+  // binding generates an error will delete |impl| because |~ImplPtr| is
+  // |~unique_ptr|, which deletes |impl|.
+  void AddBinding(ImplPtr impl, InterfaceRequest<Interface> request,
+                  async_dispatcher_t* dispatcher = nullptr) {
+    bindings_.push_back(std::make_unique<Binding>(
+        std::forward<ImplPtr>(impl), std::move(request), dispatcher));
+    auto* binding = bindings_.back().get();
+    // Set the connection error handler for the newly added Binding to be a
+    // function that will erase it from the vector.
+    binding->set_error_handler([binding, this](zx_status_t status) {
+      this->RemoveOnError(binding);
+    });
+  }
+
+  // Adds a binding to the set for the given implementation.
+  //
+  // Creates a channel for the binding and returns the client endpoint of
+  // the channel as an |InterfaceHandle|. If |AddBinding| fails to create the
+  // underlying channel, the returned |InterfaceHandle| will return false from
+  // |is_valid()|.
+  //
+  // The given |ImplPtr| is bound to the newly created channel. The binding is
+  // removed (and the |~ImplPtr| called) when the created binding has an error
+  // (e.g., if the remote endpoint of the channel sends an invalid message).
+  //
+  // Whether this method takes ownership of |impl| depends on |ImplPtr|. If
+  // |ImplPtr| is a raw pointer, then this method does not take ownership of
+  // |impl|. If |ImplPtr| is a |unique_ptr|, then running |~ImplPtr| when the
+  // binding generates an error will delete |impl| because |~ImplPtr| is
+  // |~unique_ptr|, which deletes |impl|.
+  InterfaceHandle<Interface> AddBinding(
+      ImplPtr impl, async_dispatcher_t* dispatcher = nullptr) {
+    InterfaceHandle<Interface> handle;
+    InterfaceRequest<Interface> request = handle.NewRequest();
+    if (!request)
+      return nullptr;
+    AddBinding(std::forward<ImplPtr>(impl), std::move(request), dispatcher);
+    return handle;
+  }
+
+  // Returns an InterfaceRequestHandler that binds the incoming
+  // InterfaceRequests this object.
+  InterfaceRequestHandler<Interface> GetHandler(
+      ImplPtr impl, async_dispatcher_t* dispatcher = nullptr) {
+    return [this, impl, dispatcher](InterfaceRequest<Interface> request) {
+      AddBinding(impl, std::move(request), dispatcher);
+    };
+  }
+
+  // Removes all the bindings from the set.
+  //
+  // Closes all the channels associated with this |BindingSet|.
+  // Bindings are destroyed AFTER it is removed from the bindings set. An
+  // example of when this is useful is if an error handler on a binding has
+  // some behavior where it needs to read from the binding set; the set would
+  // then properly reflect that the binding is not present in the set.
+  void CloseAll() {
+    auto bindings_local = std::move(bindings_);
+    bindings_.clear();
+  }
+
+  // The number of bindings in this |BindingSet|.
+  size_t size() const { return bindings_.size(); }
+
+  // Called when the last binding has been removed from this |BindingSet|.
+  //
+  // This function is not called by |CloseAll| or by |~BindingSet|.
+  void set_empty_set_handler(fit::closure empty_set_handler) {
+    empty_set_handler_ = std::move(empty_set_handler);
+  }
+
+  // The bindings stored in this set.
+  //
+  // This collection of bindings can be invalidated when a |Binding| in the
+  // set encounters a connection error because connection errors causes the
+  // |BindingSet| to remove the |Binding| from the set.
+  const StorageType& bindings() const { return bindings_; }
+
+ private:
+  // Called when a binding has an error to remove the binding from the set.
+  void RemoveOnError(Binding* binding) {
+    auto it = std::find_if(bindings_.begin(), bindings_.end(),
+                           [binding](const std::unique_ptr<Binding>& b) {
+                             return b.get() == binding;
+                           });
+    ZX_DEBUG_ASSERT(it != bindings_.end());
+
+    {
+      // Move ownership of binding out of storage, such that the binding is
+      // destroyed AFTER it is removed from the bindings.
+      auto binding_local = std::move(*it);
+      binding_local->set_error_handler(nullptr);
+      bindings_.erase(it);
+    }
+
+    if (bindings_.empty() && empty_set_handler_)
+      empty_set_handler_();
+  }
+
+  StorageType bindings_;
+  fit::closure empty_set_handler_;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_BINDING_SET_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/enum.h b/pkg/fidl_cpp/include/lib/fidl/cpp/enum.h
new file mode 100644
index 0000000..19ec1eb
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/enum.h
@@ -0,0 +1,21 @@
+// 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 LIB_FIDL_CPP_ENUM_H_
+#define LIB_FIDL_CPP_ENUM_H_
+
+#include <type_traits>
+
+namespace fidl {
+
+// Converts an enum value to its underlying type.
+template <typename TEnum>
+constexpr auto ToUnderlying(TEnum value) ->
+    typename std::underlying_type<TEnum>::type {
+  return static_cast<typename std::underlying_type<TEnum>::type>(value);
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_ENUM_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr.h b/pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr.h
new file mode 100644
index 0000000..e1af79a
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr.h
@@ -0,0 +1,305 @@
+// 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 LIB_FIDL_CPP_INTERFACE_PTR_H_
+#define LIB_FIDL_CPP_INTERFACE_PTR_H_
+
+#include <algorithm>
+#include <cstddef>
+#include <utility>
+
+#include <lib/fit/function.h>
+#include <lib/zx/channel.h>
+#include <zircon/assert.h>
+
+#include "lib/fidl/cpp/interface_handle.h"
+#include "lib/fidl/cpp/interface_request.h"
+#include "lib/fidl/cpp/internal/proxy_controller.h"
+
+namespace fidl {
+
+// A client interface to a remote implementation of |Interface|.
+//
+// An |InterfacePtr| implements |Interface| by proxying calls through a
+// |channel| to a remote implementation of |Interface|. Method calls on the
+// |Interface| proxy are encoded and sent through the bound channel to the
+// remote endpoint, which processes them. If the remote endpoint has not yet
+// been bound to an implementation, messages sent on the channel are buffered
+// by the channel, allowing for *pipelined* operation.
+//
+// The |InterfacePtr| also keeps state about the connection and about
+// outstanding request transactions that are expecting replies. When a the
+// |InterfacePtr| receives a reply to an outstanding transaction, the
+// |InterfacePtr| decodes the reply and calls the appropriate callback on the
+// thread on which the |InterfacePtr| was bound.
+//
+// You need to bind the |InterfacePtr| before calling any |Interface| methods.
+// There are a number of ways to bind the |InterfacePtr|.  See |NewRequest|,
+// |Bind|, and the |Bind| method on |InterfaceHandle|.
+//
+// If the underlying channel experiences an error, the |InterfacePtr| will
+// unbind from the channel and call its error handler.
+//
+// This class is thread-hostile, as is the local proxy it manages. All calls to
+// this class or the proxy should be from the thread on which the
+// |InterfacePtr| was bound. If you need to move the proxy to a different
+// thread, extract the |InterfaceHandle| by calling |Unbind|, and pass the
+// |InterfaceHandle| to a different thread, which the |InterfaceHandle| can be
+// bound to an |InterfacePtr| again. This operation destroys the state about
+// outstanding request transactions that are expecting replies.
+//
+// See also:
+//
+//  * |Binding|, which is the server analog of an |InterfacePtr|.
+//  * |SynchronousInterfacePtr|, which is a synchronous client interface to a
+//    remote implementation.
+template <typename Interface>
+class InterfacePtr {
+ public:
+  using Proxy = typename Interface::Proxy_;
+
+  // Creates an unbound |InterfacePtr|.
+  InterfacePtr() : impl_(new Impl) {}
+  InterfacePtr(std::nullptr_t) : InterfacePtr() {}
+
+  InterfacePtr(const InterfacePtr& other) = delete;
+  InterfacePtr& operator=(const InterfacePtr& other) = delete;
+
+  InterfacePtr(InterfacePtr&& other) : impl_(std::move(other.impl_)) {
+    other.impl_.reset(new Impl);
+  }
+
+  InterfacePtr& operator=(InterfacePtr&& other) {
+    if (this != &other) {
+      impl_ = std::move(other.impl_);
+      other.impl_.reset(new Impl);
+    }
+    return *this;
+  }
+
+  // Bind the |InterfacePtr| to one endpoint of a newly created channel and
+  // return the other endpoint as an |InterfaceRequest|.
+  //
+  // Typically, the returned |InterfaceRequest| will be sent to a remote process
+  // to be bound to an implementation of |Interface| using a |Binding| object.
+  //
+  // After calling this method, clients can start calling methods on this
+  // |InterfacePtr|. The methods will write messages into the underlying
+  // channel created by |NewRequest|, where they will be buffered by the
+  // underlying channel until the |InterfaceRequest| is bound to an
+  // implementation of |Interface|, potentially in a remote process.
+  //
+  // Uses the given async_t (e.g., a message loop) in order to read messages
+  // from the channel and to monitor the channel for |ZX_CHANNEL_PEER_CLOSED|.
+  // If |dispatcher| is null, the current thread must have a default async_t.
+  //
+  // # Example
+  //
+  // Given the following interface:
+  //
+  //   interface Database {
+  //     OpenTable(request<Table> table);
+  //   };
+  //
+  // The client can use the |NewRequest| method to create the |InterfaceRequest|
+  // object needed by the |OpenTable| method:
+  //
+  //   DatabasePtr database = ...;  // Connect to database.
+  //   TablePtr table;
+  //   database->OpenTable(table.NewRequest());
+  //
+  // The client can call methods on |table| immediately.
+  InterfaceRequest<Interface> NewRequest(
+      async_dispatcher_t* dispatcher = nullptr) {
+    zx::channel h1;
+    zx::channel h2;
+    if (zx::channel::create(0, &h1, &h2) != ZX_OK ||
+        Bind(std::move(h1), dispatcher) != ZX_OK)
+      return nullptr;
+    return InterfaceRequest<Interface>(std::move(h2));
+  }
+
+  // Binds the |InterfacePtr| to the given |channel|.
+  //
+  // The |InterfacePtr| expects the remote end of the |channel| to speak the
+  // protocol defined by |Interface|. Unlike the |Bind| overload that takes a
+  // |InterfaceHandle| parameter, this |Bind| overload lacks type safety.
+  //
+  // If the |InterfacePtr| was prevously bound to another channel, that channel
+  // is closed. If the |channel| is invalid, then this method will effectively
+  // unbind the |InterfacePtr|. A more direct way to have that effect is to call
+  // |Unbind|.
+  //
+  // Uses the given async_t (e.g., a message loop) in order to read messages
+  // from the channel and to monitor the channel for |ZX_CHANNEL_PEER_CLOSED|.
+  // If |dispatcher| is null, the current thread must have a default async_t.
+  //
+  // Returns an error if the binding was not able to be created (e.g., because
+  // the |channel| lacks |ZX_RIGHT_WAIT|).
+  zx_status_t Bind(zx::channel channel,
+                   async_dispatcher_t* dispatcher = nullptr) {
+    return impl_->controller.reader().Bind(std::move(channel), dispatcher);
+  }
+
+  // Binds the |InterfacePtr| to the given |InterfaceHandle|.
+  //
+  // The |InterfacePtr| expects the remote end of the |channel| to speak the
+  // protocol defined by |Interface|. Unlike the |Bind| overload that takes a
+  // |channel| parameter, this |Bind| overload provides type safety.
+  //
+  // If the |InterfacePtr| was prevously bound to another channel, that channel
+  // is closed. If the |InterfaceHandle| is invalid, then this method will
+  // effectively unbind the |InterfacePtr|. A more direct way to have that
+  // effect is to call |Unbind|.
+  //
+  // Uses the given async_t (e.g., a message loop) in order to read messages
+  // from the channel and to monitor the channel for |ZX_CHANNEL_PEER_CLOSED|.
+  // If |dispatcher| is null, the current thread must have a default async_t.
+  //
+  // Returns an error if the binding was not able to be created (e.g., because
+  // the |channel| lacks |ZX_RIGHT_WAIT|).
+  zx_status_t Bind(InterfaceHandle<Interface> handle,
+                   async_dispatcher_t* dispatcher = nullptr) {
+    return Bind(handle.TakeChannel(), dispatcher);
+  }
+
+  // Unbinds the underlying channel from the |InterfacePtr|.
+  //
+  // The underlying channel is returned as an |InterfaceHandle|, which is safe
+  // to transport to another thread or process. Any callbacks waiting for
+  // replies from the remote endpoint are discarded and any outstanding
+  // transaction state is erased.
+  //
+  // After this method returns, a subsequent call to |Bind| is required before
+  // calling any additional |Interface| methods.
+  InterfaceHandle<Interface> Unbind() {
+    return InterfaceHandle<Interface>(impl_->controller.reader().Unbind());
+  }
+
+  // Whether this |InterfacePtr| is currently bound to a channel.
+  //
+  // If the |InterfacePtr| is bound to a channel, the |InterfacePtr| has
+  // affinity for the thread on which it was bound and calls to |Interface|
+  // methods are proxied to the remote endpoint of the channel.
+  //
+  // See also:
+  //
+  //  * |Bind|, which binds a channel to this |InterfacePtr|.
+  //  * |Unbind|, which unbinds a channel from this |InterfacePtr|.
+  bool is_bound() const { return impl_->controller.reader().is_bound(); }
+
+  // Whether this |InterfacePtr| is currently bound to a channel.
+  //
+  // See |is_bound| for details.
+  explicit operator bool() const { return is_bound(); }
+
+  // The |Interface| proxy associated with this |InterfacePtr|.
+  //
+  // When this |InterfacePtr| is bound, method calls on this |Interface| will
+  // be proxied to the remote endpoint of the connection. Methods that expect
+  // replies will retain the supplied callbacks until the |InterfacePtr| either
+  // receives a reply to that transaction or the |InterfacePtr| is unbound from
+  // the channel.
+  //
+  // When this |InterfacePtr| is not bound, it is an error to call methods on
+  // the returned |Interface|.
+  //
+  // The returned |Interface| is thread-hostile and can be used only on the
+  // thread on which the |InterfacePtr| was bound.
+  Interface* get() const { return &impl_->proxy; }
+  Interface* operator->() const { return get(); }
+  Interface& operator*() const { return *get(); }
+
+  // An object on which to register for FIDL events.
+  //
+  // Arriving events are dispatched to the callbacks stored on this object.
+  // Events for unbound callbacks are ignored.
+  Proxy& events() const { return impl_->proxy; }
+
+#ifdef FIDL_ENABLE_LEGACY_WAIT_FOR_RESPONSE
+
+  // DEPRECATED: Using InterfaceSyncPtr instead. If used in a test, consider
+  // spinning the async::Loop instead.
+  //
+  // Blocks the calling thread until either a message arrives on the previously
+  // bound channel or an error occurs.
+  //
+  // Returns an error if waiting for the message, reading the message, or
+  // processing the message fails. If the error results in the channel being
+  // closed, the error handler will be called synchronously before this
+  // method returns.
+  //
+  // This method can be called only if this |InterfacePtr| is currently bound to
+  // a channel.
+  zx_status_t WaitForResponse() {
+    return WaitForResponseUntil(zx::time::infinite());
+  }
+
+  // DEPRECATED: Using InterfaceSyncPtr instead. If used in a test, consider
+  // spinning the async::Loop instead.
+  //
+  // Blocks the calling thread until either a message arrives on the previously
+  // bound channel, an error occurs, or the |deadline| is exceeded.
+  //
+  // Returns ZX_ERR_TIMED_OUT if the deadline is exceeded.
+  //
+  // Returns an error if waiting for the message, reading the message, or
+  // processing the message fails. If the error results in the channel being
+  // closed, the error handler will be called synchronously before this
+  // method returns.
+  //
+  // This method can be called only if this |InterfacePtr| is currently bound to
+  // a channel.
+  zx_status_t WaitForResponseUntil(zx::time deadline) {
+    return impl_->controller.reader().WaitAndDispatchOneMessageUntil(deadline);
+  }
+#endif
+
+  // Sets an error handler that will be called if an error causes the underlying
+  // channel to be closed.
+  //
+  // If the error is being reported because an error occurred on the local side
+  // of the channel, the zx_status_t of that error will be passed as the
+  // parameter to the handler.
+  //
+  // If an Epitaph was present on the channel, its error value will be passed as
+  // the parameter.  See the FIDL language specification for more detail on
+  // Epitaphs.
+  //
+  // For example, the error handler will be called if the remote side of the
+  // channel sends an invalid message. When the error handler is called, the
+  // |Binding| will no longer be bound to the channel.
+  void set_error_handler(fit::function<void(zx_status_t)> error_handler) {
+    impl_->controller.reader().set_error_handler(std::move(error_handler));
+  }
+
+  // The underlying channel.
+  const zx::channel& channel() const {
+    return impl_->controller.reader().channel();
+  }
+
+  // Closes the channel and sends an Epitaph with the given error.  See the FIDL
+  // language spec for information about Epitaphs.
+  //
+  // The return value can be any of the return values of zx_channel_write.
+  zx_status_t Close(zx_status_t epitaph_value) {
+    return impl_->controller.reader().Close(epitaph_value);
+  }
+
+ private:
+  struct Impl;
+
+  std::unique_ptr<Impl> impl_;
+};
+
+template <typename T>
+struct InterfacePtr<T>::Impl {
+  Impl() : proxy(&controller) { controller.set_proxy(&proxy); }
+  internal::ProxyController controller;
+  mutable Proxy proxy;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERFACE_PTR_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr_set.h b/pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr_set.h
new file mode 100644
index 0000000..8d54420
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr_set.h
@@ -0,0 +1,95 @@
+// 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 LIB_FIDL_CPP_INTERFACE_PTR_SET_H_
+#define LIB_FIDL_CPP_INTERFACE_PTR_SET_H_
+
+#include <zircon/assert.h>
+#include <vector>
+
+#include "lib/fidl/cpp/interface_ptr.h"
+
+namespace fidl {
+
+// Contains a set of |InterfacePtr| objects, each with their own channels.
+//
+// An |InterfacePtr| is removed from the set and destroyed when its underlying
+// channel experiences an error. When the set is destroyed, all the underlying
+// channels are closed.
+//
+// An |InterfacePtrSet| is useful for broadcasting messages to a set of clients,
+// each with their own implementation of |Interface|.
+//
+// See also:
+//
+//  * |BindingSet|, which is the server analog of an |InterfacePtrSet|.
+template <typename Interface>
+class InterfacePtrSet {
+ public:
+  using StorageType = std::vector<std::unique_ptr<InterfacePtr<Interface>>>;
+  using Ptr = InterfacePtr<Interface>;
+
+  // Creates an empty |InterfacePtrSet|.
+  InterfacePtrSet() = default;
+
+  InterfacePtrSet(const InterfacePtrSet& other) = delete;
+  InterfacePtrSet& operator=(const InterfacePtrSet& other) = delete;
+
+  // Adds the given |InterfacePtr| to the set.
+  //
+  // The |InterfacePtr| must already be bound to a channel. The |InterfacePtr|
+  // will be removed from the set when its underlying channel experiences an
+  // error.
+  void AddInterfacePtr(InterfacePtr<Interface> ptr) {
+    ZX_DEBUG_ASSERT(ptr.is_bound());
+    // Allocated a new |InterfacePtr| so that we can have a unique value to use
+    // as a key for removing the InterfacePtr. Otherwise, we'll lose track of
+    // the InterfacePtr when the vector resizes.
+    ptrs_.push_back(std::make_unique<Ptr>(std::move(ptr)));
+    auto* pointer = ptrs_.back().get();
+    pointer->set_error_handler(
+        [pointer, this](zx_status_t status) { this->RemoveOnError(pointer); });
+  }
+
+  // The |InterfacePtr| objects stored in this set.
+  //
+  // This collection of bindings can be invalidated when an |InterfacePtr| in
+  // the set encounters a connection error because connection errors causes the
+  // |InterfacePtrSet| to remove the |InterfacePtr| from the set.
+  const StorageType& ptrs() const { return ptrs_; }
+
+  // Closes all channels associated with |InterfacePtr| objects in the set.
+  //
+  // After this method returns, the set is empty.
+  void CloseAll() { ptrs_.clear(); }
+
+  // The number of |InterfacePtr| objects in the set.
+  //
+  // This number might be smaller than the number of |InterfacePtr| objects
+  // added to the set if some of the underlying channels have experienced an
+  // error.
+  size_t size() const { return ptrs_.size(); }
+
+ private:
+  // Removes the given |pointer| from the set.
+  //
+  // Called from the error handler callback for |pointer|.
+  void RemoveOnError(Ptr* pointer) {
+    auto it = std::find_if(ptrs_.begin(), ptrs_.end(),
+                           [pointer](const std::unique_ptr<Ptr>& p) {
+                             return p.get() == pointer;
+                           });
+    ZX_DEBUG_ASSERT(it != ptrs_.end());
+    ptrs_.erase(it);
+  }
+
+  // We use |unique_ptr| rather than just |InterfacePtr| so that we can keep
+  // track of the |InterfacePtr| objects after the |vector| resizes and moves
+  // its contents to its new buffer.
+  StorageType ptrs_;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERFACE_PTR_SET_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/header.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/header.h
new file mode 100644
index 0000000..60ec272
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/header.h
@@ -0,0 +1,62 @@
+// 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 LIB_FIDL_CPP_INTERNAL_HEADER_H_
+#define LIB_FIDL_CPP_INTERNAL_HEADER_H_
+
+#include <functional>
+#include <ostream>
+
+#include <lib/fidl/cpp/array.h>
+#include <lib/fit/function.h>
+
+#ifdef __Fuchsia__
+#include <lib/zx/bti.h>
+#include <lib/zx/channel.h>
+#include <lib/zx/debuglog.h>
+#include <lib/zx/event.h>
+#include <lib/zx/eventpair.h>
+#include <lib/zx/fifo.h>
+#include <lib/zx/guest.h>
+#include <lib/zx/handle.h>
+#include <lib/zx/interrupt.h>
+#include <lib/zx/job.h>
+#include <lib/zx/log.h>
+#include <lib/zx/object.h>
+#include <lib/zx/pmt.h>
+#include <lib/zx/port.h>
+#include <lib/zx/process.h>
+#include <lib/zx/profile.h>
+#include <lib/zx/resource.h>
+#include <lib/zx/socket.h>
+#include <lib/zx/suspend_token.h>
+#include <lib/zx/task.h>
+#include <lib/zx/thread.h>
+#include <lib/zx/time.h>
+#include <lib/zx/timer.h>
+#include <lib/zx/vcpu.h>
+#include <lib/zx/vmar.h>
+#include <lib/zx/vmo.h>
+#endif
+
+#include "lib/fidl/cpp/coding_traits.h"
+#include "lib/fidl/cpp/enum.h"
+
+#ifdef __Fuchsia__
+#include "lib/fidl/cpp/interface_ptr.h"
+#include "lib/fidl/cpp/internal/proxy_controller.h"
+#include "lib/fidl/cpp/internal/stub_controller.h"
+#include "lib/fidl/cpp/internal/synchronous_proxy.h"
+#include "lib/fidl/cpp/synchronous_interface_ptr.h"
+#endif
+
+#include "lib/fidl/cpp/string.h"
+#include "lib/fidl/cpp/vector.h"
+
+// clone.h must be imported before any of the generated Clone methods are
+// defined, so that calls to Clone in clone.h are referencing the ADL
+// implementation and are not ambiguous.
+#include "lib/fidl/cpp/clone.h"
+
+#endif  // LIB_FIDL_CPP_INTERNAL_HEADER_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/implementation.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/implementation.h
new file mode 100644
index 0000000..37a3bec
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/implementation.h
@@ -0,0 +1,21 @@
+// 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 LIB_FIDL_CPP_INTERNAL_IMPLEMENTATION_H_
+#define LIB_FIDL_CPP_INTERNAL_IMPLEMENTATION_H_
+
+#include <lib/fidl/internal.h>
+#include <stdint.h>
+#include <zircon/assert.h>
+
+#include <limits>
+#include <memory>
+
+#include "lib/fidl/cpp/clone.h"
+#include "lib/fidl/cpp/comparison.h"
+#include "lib/fidl/cpp/encoder.h"
+#include "lib/fidl/cpp/internal/logging.h"
+#include "lib/fidl/cpp/traits.h"
+
+#endif  // LIB_FIDL_CPP_INTERNAL_IMPLEMENTATION_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_handler.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_handler.h
new file mode 100644
index 0000000..13660ad
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_handler.h
@@ -0,0 +1,39 @@
+// 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 LIB_FIDL_CPP_INTERNAL_MESSAGE_HANDLER_H_
+#define LIB_FIDL_CPP_INTERNAL_MESSAGE_HANDLER_H_
+
+#include <lib/fidl/cpp/message.h>
+#include <zircon/types.h>
+
+namespace fidl {
+namespace internal {
+
+// An interface for receiving FIDL messages.
+//
+// Used by |MessageReader| to call back into its client whenever it reads a
+// message from the channel.
+class MessageHandler {
+ public:
+  virtual ~MessageHandler();
+
+  // A new message has arrived.
+  //
+  // The memory backing the message will remain valid until this method returns,
+  // at which point the memory might or might not be deallocated.
+  virtual zx_status_t OnMessage(Message message) = 0;
+
+  // The channel from which the messages were being read is gone.
+  //
+  // The channel's peer might have been closed or the |MessageReader| might have
+  // unbound from the channel. In either case, implementations that keep
+  // per-channel state should reset their state when this method is called.
+  virtual void OnChannelGone();
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_MESSAGE_HANDLER_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_reader.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_reader.h
new file mode 100644
index 0000000..5272231
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_reader.h
@@ -0,0 +1,147 @@
+// 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 LIB_FIDL_CPP_INTERNAL_MESSAGE_READER_H_
+#define LIB_FIDL_CPP_INTERNAL_MESSAGE_READER_H_
+
+#include <lib/async/wait.h>
+#include <lib/fidl/cpp/message.h>
+#include <lib/fidl/cpp/message_buffer.h>
+#include <lib/fit/function.h>
+#include <lib/zx/channel.h>
+
+#include <functional>
+#include <memory>
+#include <utility>
+
+#include "lib/fidl/cpp/internal/message_handler.h"
+
+namespace fidl {
+namespace internal {
+
+class MessageReader {
+ public:
+  explicit MessageReader(MessageHandler* message_handler = nullptr);
+  ~MessageReader();
+
+  MessageReader(const MessageReader&) = delete;
+  MessageReader& operator=(const MessageReader&) = delete;
+
+  // Binds the given channel to this |MessageReader|.
+  //
+  // The |MessageReader| will wait asynchronously for messages on this channel
+  // and dispatch them to the message handler using |dispatcher|. After this
+  // method returns, the |MessageReader| will be waiting for incomming messages.
+  //
+  // If the |MessageReader| is already bound, the |MessageReader| will first
+  // be unbound.
+  //
+  // If |dispatcher| is null, the current thread must have a default async_t.
+  zx_status_t Bind(zx::channel channel,
+                   async_dispatcher_t* dispatcher = nullptr);
+
+  // Unbinds the channel from this |MessageReader|.
+  //
+  // The |MessageReader| will stop waiting for the messages on this channel.
+  //
+  // Returns the channel to which this |MessageReader| was previously bound, if
+  // any.
+  zx::channel Unbind();
+
+  // Unbinds the channel from this |MessageReader| and clears the error handler.
+  void Reset();
+
+  // Unbinds the channel from |other| and bindings it to this |MessageReader|.
+  //
+  // Also moves the error handler from |other| to this |MessageReader|.
+  //
+  // Useful for implementing move semantics for objects that have a
+  // |MessageReader|.
+  zx_status_t TakeChannelAndErrorHandlerFrom(MessageReader* other);
+
+  // Sends an epitaph with the given value, unbinds, and then closes the channel
+  // associated with this |MessageReader|.
+  //
+  // The |MessageReader| will send an Epitaph with the given error, unbind
+  // the channel, and then close it.
+  //
+  // The return value can be any of the return values of zx_channel_write.
+  zx_status_t Close(zx_status_t epitaph_value);
+
+  // Whether the |MessageReader| is currently bound.
+  //
+  // See |Bind()| and |Unbind()|.
+  bool is_bound() const { return channel_.is_valid(); }
+
+  // The channel to which this |MessageReader| is bound, if any.
+  const zx::channel& channel() const { return channel_; }
+
+  // Synchronously waits on |channel()| until either a message is available or
+  // the peer closes. If the channel is readable, reads a single message from
+  // the channel and dispatches it to the message handler.
+  //
+  // Returns |ZX_ERR_BAD_STATE| if this |MessageReader| is not bound, or if it
+  // receives a malformed Epitaph.
+  zx_status_t WaitAndDispatchOneMessageUntil(zx::time deadline);
+
+  // The given message handler is called whenever the |MessageReader| reads a
+  // message from the channel.
+  //
+  // The |Message| given to the message handler will be valid until the message
+  // handler returns.
+  //
+  // The handler should return ZX_OK if the message was handled and an error
+  // otherwise. If the handler returns ZX_OK, the |MessageReader| will continue
+  // to wait for messages.
+  //
+  // The handler can destroy the |MessageReader|, in which case the
+  // handler MUST return |ZX_ERR_STOP|. If the handler returns
+  // |ZX_ERR_SHOULD_WAIT|, the |MessageReader| will continue waiting. Other
+  // errors cause the |MessageReader| to unbind from the channel and call the
+  // error handler.
+  void set_message_handler(MessageHandler* message_handler) {
+    message_handler_ = message_handler;
+  }
+
+  // The given error handler is called whenever the |MessageReader| encounters
+  // an error on the channel.
+  //
+  // If the error is being reported because an error occurred on the local side
+  // of the channel, the zx_status_t of that error will be passed as the
+  // parameter to the handler.
+  //
+  // If an Epitaph was present on the channel, its error value will be passed as
+  // the parameter.  See the FIDL language specification for more detail on
+  // Epitaphs.
+  //
+  // For example, the error handler will be called if the remote side of the
+  // channel sends an invalid message. When the error handler is called, the
+  // |Binding| will no longer be bound to the channel.
+  //
+  // The handler can destroy the |MessageReader|.
+  void set_error_handler(fit::function<void(zx_status_t)> error_handler) {
+    error_handler_ = std::move(error_handler);
+  }
+
+ private:
+  static void CallHandler(async_dispatcher_t* dispatcher, async_wait_t* wait,
+                          zx_status_t status, const zx_packet_signal_t* signal);
+  void OnHandleReady(async_dispatcher_t* dispatcher, zx_status_t status,
+                     const zx_packet_signal_t* signal);
+  zx_status_t ReadAndDispatchMessage(MessageBuffer* buffer);
+  void NotifyError(zx_status_t epitaph_value);
+  void Stop();
+
+  async_wait_t wait_;  // Must be first.
+  zx::channel channel_;
+  async_dispatcher_t* dispatcher_;
+  bool* should_stop_;  // See |Canary| in message_reader.cc.
+  MessageHandler* message_handler_;
+  fit::function<void(zx_status_t)> error_handler_;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_MESSAGE_READER_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/pending_response.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/pending_response.h
new file mode 100644
index 0000000..125a7d8
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/pending_response.h
@@ -0,0 +1,89 @@
+// 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 LIB_FIDL_CPP_INTERNAL_PENDING_RESPONSE_H_
+#define LIB_FIDL_CPP_INTERNAL_PENDING_RESPONSE_H_
+
+#include <lib/fidl/cpp/message_builder.h>
+#include <zircon/types.h>
+
+namespace fidl {
+namespace internal {
+class WeakStubController;
+
+// A response to a FIDL message.
+//
+// When a server receives a message that expects a response, the stub receives a
+// |PendingResponse| object that the implementation can use to reply to the
+// message. A given |PendingResponse| object can be used to send a reply at
+// most once.
+//
+// If the |StubController| that processed the original message is destroyed or
+// unbound from the underlying channel (e.g., due to an error), the stub can
+// still safely call |Send|, but the response will not actually be sent to the
+// client.
+class PendingResponse {
+ public:
+  // Creates a |PendingResponse| that does not need a response.
+  //
+  // The |needs_response()| method will return false.
+  PendingResponse();
+
+  // Creates a |PendingResponse| for a message with the given transaction ID.
+  //
+  // The |PendingResponse| object will take a reference to |weak_controller|,
+  // which it releases in its destructor.
+  PendingResponse(zx_txid_t txid, WeakStubController* weak_controller);
+
+  ~PendingResponse();
+
+  // |PendingResponse| objects are copiable.
+  //
+  // Each copy refers to the same logical reponse, which means |Send| should be
+  // called at most once among all the copies.
+  //
+  // The reason |PendingResponse| objects are copiable is so that they can be
+  // held by an std::function, which is also copyable. Typically, a
+  // |PendingResponse| object is held as a member of another object that
+  // implements operator(), which can be wrapped by std::function.
+  PendingResponse(const PendingResponse& other);
+  PendingResponse& operator=(const PendingResponse& other);
+
+  // |PendingResponse| objects are movable.
+  //
+  // Moving a |PendingResponse| object is more efficient that copying it because
+  // moving avoid churning the reference count of the associated
+  // |WeakStubController|.
+  PendingResponse(PendingResponse&& other);
+  PendingResponse& operator=(PendingResponse&& other);
+
+  // Whether the message that caused this |PendingResponse| object to be created
+  // expects a response.
+  //
+  // This method does not indiciate whether a response has or has not already
+  // been sent. That state is difficult to track because |PendingResponse| is
+  // copiable.
+  bool needs_response() const { return txid_; }
+
+  // Send a response.
+  //
+  // This function should be called at most once among all the copies of a given
+  // |PendingResponse| object.
+  //
+  // If the associated |WeakStubController| is no longer available (e.g., if it
+  // has been destroyed), this function will return |ZX_ERR_BAD_STATE|.
+  zx_status_t Send(const fidl_type_t* type, Message message);
+
+ private:
+  // This class should be small enough to fit into the inline storage for an
+  // std::function to avoid allocating additional storage when processing
+  // messages. Currently, std::function has space for three pointers.
+  zx_txid_t txid_;
+  WeakStubController* weak_controller_;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_PENDING_RESPONSE_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy.h
new file mode 100644
index 0000000..cc72783
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy.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 LIB_FIDL_CPP_INTERNAL_PROXY_H_
+#define LIB_FIDL_CPP_INTERNAL_PROXY_H_
+
+#include <lib/fidl/cpp/message.h>
+#include <zircon/types.h>
+
+namespace fidl {
+namespace internal {
+
+// An interface for sending FIDL messages to a remote implementation.
+class Proxy {
+ public:
+  virtual ~Proxy();
+
+  // A new message has arrived.
+  //
+  // The memory backing the message will remain valid until this method returns,
+  // at which point the memory might or might not be deallocated.
+  virtual zx_status_t Dispatch_(Message message) = 0;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_PROXY_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy_controller.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy_controller.h
new file mode 100644
index 0000000..070613f
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy_controller.h
@@ -0,0 +1,96 @@
+// 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 LIB_FIDL_CPP_INTERNAL_PROXY_CONTROLLER_H_
+#define LIB_FIDL_CPP_INTERNAL_PROXY_CONTROLLER_H_
+
+#include <lib/fidl/cpp/message.h>
+#include <lib/fidl/cpp/message_builder.h>
+
+#include <map>
+#include <memory>
+
+#include "lib/fidl/cpp/internal/message_handler.h"
+#include "lib/fidl/cpp/internal/message_reader.h"
+#include "lib/fidl/cpp/internal/proxy.h"
+
+namespace fidl {
+namespace internal {
+
+// Controls the client endpoint of a FIDL channel.
+//
+// A |ProxyController| controls the protocol-specific "proxy" object. Proxy
+// objects are used on the client endpoint of a FIDL channel to encode messages
+// into the channel and send them to the server endpoint, whose "stub" object
+// decodes them and dispatches them to an implementation of the protocol.
+class ProxyController : public MessageHandler {
+ public:
+  ProxyController();
+  ~ProxyController();
+
+  ProxyController(const ProxyController&) = delete;
+  ProxyController& operator=(const ProxyController&) = delete;
+
+  ProxyController(ProxyController&&);
+  ProxyController& operator=(ProxyController&&);
+
+  // The |MessageReader| that is listening for responses to messages sent by
+  // this object.
+  MessageReader& reader() { return reader_; }
+  const MessageReader& reader() const { return reader_; }
+
+  // The protocol-specific object that decodes messages and dispatches them to
+  // an implementation of the protocol.
+  //
+  // The proxy must be set to a non-null value before messages are read from the
+  // underlying channel. Typically, the caller will set a non-null proxy before
+  // binding a channel to the |MessageReader|.
+  Proxy* proxy() const { return proxy_; }
+  void set_proxy(Proxy* proxy) { proxy_ = proxy; }
+
+  // Send a message over the channel.
+  //
+  // If |response_handler| is non-null, the message will be assigned a
+  // transaction identifier before being encoded and sent over the channel. The
+  // |response_handler| will be retained by the |ProxyController| until the
+  // |ProxyController| recieves a response to the message, at which time the
+  // |ProxyController| will call the |OnMessage| method of the
+  // |response_handler|.
+  //
+  // Returns an error if the message fails to encode properly or if the message
+  // cannot be written to the channel.
+  zx_status_t Send(const fidl_type_t* type, Message message,
+                   std::unique_ptr<MessageHandler> response_handler);
+
+  // Clears all the state associated with this |ProxyController|.
+  //
+  // After this method returns, the |ProxyController| is in the same state it
+  // would have been in if freshly constructed.
+  void Reset();
+
+ private:
+  // Called by the |MessageReader| when a message arrives on the channel from
+  // the server.
+  //
+  // The message might be a response to a previously sent message or an
+  // unsolicited event.
+  zx_status_t OnMessage(Message message) final;
+
+  // Causes the |ProxyController| to |ClearPendingHandlers()|.
+  void OnChannelGone() final;
+
+  // Causes the |ProxyController| to destroy all pending response handlers and
+  // reset its transition identifiers.
+  void ClearPendingHandlers();
+
+  MessageReader reader_;
+  Proxy* proxy_ = nullptr;
+  std::map<zx_txid_t, std::unique_ptr<MessageHandler>> handlers_;
+  zx_txid_t next_txid_;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_PROXY_CONTROLLER_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub.h
new file mode 100644
index 0000000..448f995
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub.h
@@ -0,0 +1,51 @@
+// 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 LIB_FIDL_CPP_INTERNAL_STUB_H_
+#define LIB_FIDL_CPP_INTERNAL_STUB_H_
+
+#include <lib/fidl/cpp/message.h>
+#include <zircon/types.h>
+
+#include "lib/fidl/cpp/internal/pending_response.h"
+
+namespace fidl {
+namespace internal {
+class StubController;
+
+// An interface for dispatching FIDL messages to a protocol implementation.
+//
+// Used by |StubController| to supply both a |Message| and a |PendingResponse|
+// object to protocol implementations.
+class Stub {
+ public:
+  virtual ~Stub();
+
+  // A new message has arrived.
+  //
+  // If the message expects a response, the |PendingResponse| object's
+  // |needs_response()| method will return true.
+  //
+  // The memory backing the message will remain valid until this method returns,
+  // at which point the memory might or might not be deallocated.
+  //
+  // The |PendingResponse| object has affinity for the current thread and is not
+  // safe to transport to another thread.
+  virtual zx_status_t Dispatch_(Message message, PendingResponse response) = 0;
+
+  // The protocol-agnostic object that listens for incoming messages.
+  //
+  // The controller must be set to a non-null value before sending events
+  // through this stub.
+  StubController* controller() const { return controller_; }
+  void set_controller(StubController* controller) { controller_ = controller; }
+
+ private:
+  StubController* controller_ = nullptr;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_STUB_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub_controller.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub_controller.h
new file mode 100644
index 0000000..d89729e
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub_controller.h
@@ -0,0 +1,80 @@
+// 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 LIB_FIDL_CPP_INTERNAL_STUB_CONTROLLER_H_
+#define LIB_FIDL_CPP_INTERNAL_STUB_CONTROLLER_H_
+
+#include <memory>
+
+#include <lib/fidl/cpp/message.h>
+#include <lib/zx/channel.h>
+
+#include "lib/fidl/cpp/internal/message_handler.h"
+#include "lib/fidl/cpp/internal/message_reader.h"
+#include "lib/fidl/cpp/internal/stub.h"
+
+namespace fidl {
+namespace internal {
+class WeakStubController;
+
+// Controls the server endpoint of a FIDL channel.
+//
+// A |StubController| controls the protocol-specific "stub" object. Stub
+// objects are used on the server endpoint of a FIDL channel to decode messages
+// received over the channel and dispatch them to an implementation of the
+// protocol.
+class StubController : public MessageHandler {
+ public:
+  StubController();
+  ~StubController();
+
+  StubController(const StubController&) = delete;
+  StubController& operator=(const StubController&) = delete;
+
+  // The |MessageReader| that is listening for messages sent by the client.
+  MessageReader& reader() { return reader_; }
+  const MessageReader& reader() const { return reader_; }
+
+  // The protocol-specific object that decodes messages and dispatches them to
+  // an implementation of the protocol.
+  //
+  // The stub must be set to a non-null value before messages are read from the
+  // underlying channel. Typically, the caller will set a non-null stub before
+  // binding a channel to the |MessageReader|.
+  Stub* stub() const { return stub_; }
+  void set_stub(Stub* stub) { stub_ = stub; }
+
+  // Send a message over the channel.
+  //
+  // Returns an error if the message fails to encode properly or if the message
+  // cannot be written to the channel.
+  zx_status_t Send(const fidl_type_t* type, Message message);
+
+ private:
+  // Called by the |MessageReader| when a message arrives on the channel from
+  // the client.
+  //
+  // The message will be dispatched using the |stub()|. If the message expects a
+  // response, the |stub()| will also be given a |PendingResponse| object that
+  // can be used to send a reply to the message.
+  zx_status_t OnMessage(Message message) final;
+
+  // Causes the |StubController| to invalidate all outstanding weak pointers,
+  // preventing outstanding |PendingResponse| objects from sending messages on
+  // the channel that has gone away.
+  void OnChannelGone() final;
+
+  // Invalidate all outstanding weak pointers, preventing outstanding
+  // |PendingResponse| objects from sending messages.
+  void InvalidateWeakIfNeeded();
+
+  WeakStubController* weak_;
+  MessageReader reader_;
+  Stub* stub_;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_STUB_CONTROLLER_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/internal/weak_stub_controller.h b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/weak_stub_controller.h
new file mode 100644
index 0000000..cdfbb1d
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/internal/weak_stub_controller.h
@@ -0,0 +1,59 @@
+// 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 LIB_FIDL_CPP_INTERNAL_WEAK_STUB_CONTROLLER_H_
+#define LIB_FIDL_CPP_INTERNAL_WEAK_STUB_CONTROLLER_H_
+
+#include <stdint.h>
+
+namespace fidl {
+namespace internal {
+class StubController;
+
+// A weak reference to a |StubController|.
+//
+// Used to link a |PendingResponse| object with a |StubController|. When the
+// |StubController| is destroyed (or unbound from the underling channel), the
+// weak reference is invalidated, preventing outstanding |PendingResponse|
+// objects from referencing the |StubController|.
+class WeakStubController {
+ public:
+  // Creates a weak reference to a |StubController|.
+  //
+  // The created |WeakStubController| has a reference count of one, which means
+  // the creator is responsible for calling |Release| exactly once.
+  explicit WeakStubController(StubController* controller);
+
+  // Increment the refernence count for this object.
+  //
+  // Each call to this method imposes a requirement to eventually call |Release|
+  // exactly once.
+  void AddRef();
+
+  // Decrements the reference count for this object.
+  //
+  // When the reference count reaches zero, the object is destroyed.
+  void Release();
+
+  // Break the connection between this object and the |StubController|.
+  //
+  // After calling this method, |controller()| will return nullptr.
+  void Invalidate();
+
+  // The |StubController| to which this weak reference refers.
+  //
+  // After the weak reference has been invalidated, this method returns nullptr.
+  StubController* controller() const { return controller_; }
+
+ private:
+  ~WeakStubController();
+
+  uint32_t ref_count_;  // starts at one
+  StubController* controller_;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_WEAK_STUB_CONTROLLER_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/optional.h b/pkg/fidl_cpp/include/lib/fidl/cpp/optional.h
new file mode 100644
index 0000000..4dc6219
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/optional.h
@@ -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.
+
+#ifndef LIB_FIDL_CPP_OPTIONAL_H_
+#define LIB_FIDL_CPP_OPTIONAL_H_
+
+#include <memory>
+#include <utility>
+
+namespace fidl {
+
+template <typename T>
+std::unique_ptr<T> MakeOptional(T value) {
+  return std::make_unique<T>(std::move(value));
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_OPTIONAL_H_
diff --git a/pkg/fidl_cpp/include/lib/fidl/cpp/thread_safe_binding_set.h b/pkg/fidl_cpp/include/lib/fidl/cpp/thread_safe_binding_set.h
new file mode 100644
index 0000000..a3b572c
--- /dev/null
+++ b/pkg/fidl_cpp/include/lib/fidl/cpp/thread_safe_binding_set.h
@@ -0,0 +1,127 @@
+// 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 LIB_FIDL_CPP_THREAD_SAFE_BINDING_SET_H_
+#define LIB_FIDL_CPP_THREAD_SAFE_BINDING_SET_H_
+
+#include <algorithm>
+#include <memory>
+#include <mutex>
+#include <utility>
+#include <vector>
+
+#include <lib/async/dispatcher.h>
+#include <zircon/compiler.h>
+
+#include "lib/fidl/cpp/binding.h"
+
+namespace fidl {
+
+// Manages a set of bindings to implemenations owned by the bound channels.
+//
+// The implementation pointer type of the binding is also parameterized,
+// allowing the use of smart pointer types such as |std::unique_ptr<>| to
+// reference the implementation.
+//
+// This class is thread-safe; bindings may be added or cleared from any thread.
+//
+// See also:
+//
+//  * |BindingSet|, which is the thread-hostile analog that offers more
+//    functionality.
+//  * |InterfacePtrSet|, which is the client analog of |BindingSet|.
+template <typename Interface, typename ImplPtr = Interface*>
+class ThreadSafeBindingSet {
+ public:
+  using Binding = ::fidl::Binding<Interface, ImplPtr>;
+  using StorageType = std::vector<std::unique_ptr<Binding>>;
+
+  ThreadSafeBindingSet() = default;
+
+  ThreadSafeBindingSet(const ThreadSafeBindingSet&) = delete;
+  ThreadSafeBindingSet& operator=(const ThreadSafeBindingSet&) = delete;
+
+  // Adds a binding to the set.
+  //
+  // The given |ImplPtr| is bound to the channel underlying the
+  // |InterfaceRequest|. The binding is removed (and the |~ImplPtr| called)
+  // when the created binding has an error (e.g., if the remote endpoint of
+  // the channel sends an invalid message).
+  //
+  // Whether this method takes ownership of |impl| depends on |ImplPtr|. If
+  // |ImplPtr| is a raw pointer, then this method does not take ownership of
+  // |impl|. If |ImplPtr| is a |unique_ptr|, then running |~ImplPtr| when the
+  // binding generates an error will delete |impl| because |~ImplPtr| is
+  // |~unique_ptr|, which deletes |impl|.
+  //
+  // The impl will use the given async_t (e.g., a message loop) in order to read
+  // messages from the channel and to monitor the channel for
+  // |ZX_CHANNEL_PEER_CLOSED|. It is not necessary to use the same async_t for
+  // each binding added.
+  void AddBinding(ImplPtr impl, InterfaceRequest<Interface> request,
+                  async_dispatcher_t* dispatcher) {
+    std::lock_guard<std::mutex> guard(lock_);
+    bindings_.push_back(std::make_unique<Binding>(
+        std::forward<ImplPtr>(impl), std::move(request), dispatcher));
+    auto* binding = bindings_.back().get();
+    // Set the connection error handler for the newly added Binding to be a
+    // function that will erase it from the vector.
+    binding->set_error_handler(
+        [binding, this](zx_status_t status) { this->RemoveOnError(binding); });
+  }
+
+  // Adds a binding to the set for the given implementation.
+  //
+  // Creates a channel for the binding and returns the client endpoint of
+  // the channel as an |InterfaceHandle|. If |AddBinding| fails to create the
+  // underlying channel, the returned |InterfaceHandle| will return false from
+  // |is_valid()|.
+  //
+  // The given |ImplPtr| is bound to the newly created channel. The binding is
+  // removed (and the |~ImplPtr| called) when the created binding has an error
+  // (e.g., if the remote endpoint of the channel sends an invalid message).
+  //
+  // Whether this method takes ownership of |impl| depends on |ImplPtr|. If
+  // |ImplPtr| is a raw pointer, then this method does not take ownership of
+  // |impl|. If |ImplPtr| is a |unique_ptr|, then running |~ImplPtr| when the
+  // binding generates an error will delete |impl| because |~ImplPtr| is
+  // |~unique_ptr|, which deletes |impl|.
+  InterfaceHandle<Interface> AddBinding(ImplPtr impl,
+                                        async_dispatcher_t* dispatcher) {
+    InterfaceHandle<Interface> handle;
+    InterfaceRequest<Interface> request = handle.NewRequest();
+    if (!request)
+      return nullptr;
+    AddBinding(std::forward<ImplPtr>(impl), std::move(request), dispatcher);
+    return handle;
+  }
+
+  // Removes all the bindings from the set.
+  //
+  // Closes all the channels associated with this |BindingSet|.
+  void CloseAll() {
+    std::lock_guard<std::mutex> guard(lock_);
+    bindings_.clear();
+  }
+
+ private:
+  // Called when a binding has an error to remove the binding from the set.
+  void RemoveOnError(Binding* binding) {
+    std::lock_guard<std::mutex> guard(lock_);
+    auto it = std::find_if(bindings_.begin(), bindings_.end(),
+                           [binding](const std::unique_ptr<Binding>& b) {
+                             return b.get() == binding;
+                           });
+    ZX_DEBUG_ASSERT(it != bindings_.end());
+    (*it)->set_error_handler(nullptr);
+    bindings_.erase(it);
+  }
+
+  std::mutex lock_;
+  StorageType bindings_ __TA_GUARDED(lock_);
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_THREAD_SAFE_BINDING_SET_H_
diff --git a/pkg/fidl_cpp/internal/message_handler.cc b/pkg/fidl_cpp/internal/message_handler.cc
new file mode 100644
index 0000000..fbcaa5a
--- /dev/null
+++ b/pkg/fidl_cpp/internal/message_handler.cc
@@ -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.
+
+#include "lib/fidl/cpp/internal/message_handler.h"
+
+namespace fidl {
+namespace internal {
+
+MessageHandler::~MessageHandler() = default;
+
+void MessageHandler::OnChannelGone() {}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/message_reader.cc b/pkg/fidl_cpp/internal/message_reader.cc
new file mode 100644
index 0000000..e4331f7
--- /dev/null
+++ b/pkg/fidl_cpp/internal/message_reader.cc
@@ -0,0 +1,268 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/message_reader.h"
+
+#include <lib/async/default.h>
+#include <lib/fidl/cpp/message_buffer.h>
+#include <lib/fidl/epitaph.h>
+#include <zircon/assert.h>
+
+namespace fidl {
+namespace internal {
+namespace {
+
+constexpr zx_signals_t kSignals = ZX_CHANNEL_READABLE | ZX_CHANNEL_PEER_CLOSED;
+
+// |Canary| is a stack-allocated object that observes when a |MessageReader| is
+// destroyed or unbound from the current channel.
+//
+// Because |WaitAndDispatchOneMessageUntil| can be called re-entrantly, we can
+// be in a state where there are N nested calls to |ReadAndDispatchMessage| on
+// the stack. While dispatching any of those messages, the client can destroy
+// the |MessageReader| or unbind it from the current channel. When that happens
+// we need to stop reading messages from the channel and unwind the stack
+// safely.
+//
+// The |Canary| works by storing a pointer to its |should_stop_| field in the
+// |MessageReader|.  Upon destruction or unbinding, the |MessageReader| writes
+// |true| into |should_stop_|. When we unwind the stack, the |Canary| forwards
+// that value to the next |Canary| on the stack.
+class Canary {
+ public:
+  explicit Canary(bool** should_stop_slot)
+      : should_stop_slot_(should_stop_slot),
+        previous_should_stop_(*should_stop_slot_),
+        should_stop_(false) {
+    *should_stop_slot_ = &should_stop_;
+  }
+
+  ~Canary() {
+    if (should_stop_) {
+      // If we should stop, we need to propagate that information to the
+      // |Canary| higher up the stack, if any. We also cannot touch
+      // |*should_stop_slot_| because the |MessageReader| might have been
+      // destroyed (or bound to another channel).
+      if (previous_should_stop_)
+        *previous_should_stop_ = should_stop_;
+    } else {
+      // Otherwise, the |MessageReader| was not destroyed and is still bound to
+      // the same channel. We need to restore the previous |should_stop_|
+      // pointer so that a |Canary| further up the stack can still be informed
+      // about whether to stop.
+      *should_stop_slot_ = previous_should_stop_;
+    }
+  }
+
+  // Whether the |ReadAndDispatchMessage| that created the |Canary| should stop
+  // after dispatching the current message.
+  bool should_stop() const { return should_stop_; }
+
+ private:
+  bool** should_stop_slot_;
+  bool* previous_should_stop_;
+  bool should_stop_;
+};
+
+}  // namespace
+
+static_assert(std::is_standard_layout<MessageReader>::value,
+              "We need offsetof to work");
+
+MessageReader::MessageReader(MessageHandler* message_handler)
+    : wait_{{ASYNC_STATE_INIT},
+            &MessageReader::CallHandler,
+            ZX_HANDLE_INVALID,
+            kSignals},
+      dispatcher_(nullptr),
+      should_stop_(nullptr),
+      message_handler_(message_handler),
+      error_handler_(nullptr) {}
+
+MessageReader::~MessageReader() {
+  Stop();
+  if (dispatcher_)
+    async_cancel_wait(dispatcher_, &wait_);
+}
+
+zx_status_t MessageReader::Bind(zx::channel channel,
+                                async_dispatcher_t* dispatcher) {
+  if (is_bound())
+    Unbind();
+  if (!channel)
+    return ZX_OK;
+  channel_ = std::move(channel);
+  if (dispatcher) {
+    dispatcher_ = dispatcher;
+  } else {
+    dispatcher_ = async_get_default_dispatcher();
+  }
+  ZX_ASSERT_MSG(dispatcher_ != nullptr,
+                "either |dispatcher| must be non-null, or "
+                "|async_get_default_dispatcher| must "
+                "be configured to return a non-null value");
+  wait_.object = channel_.get();
+  zx_status_t status = async_begin_wait(dispatcher_, &wait_);
+  if (status != ZX_OK)
+    Unbind();
+  return status;
+}
+
+zx::channel MessageReader::Unbind() {
+  if (!is_bound())
+    return zx::channel();
+  Stop();
+  async_cancel_wait(dispatcher_, &wait_);
+  wait_.object = ZX_HANDLE_INVALID;
+  dispatcher_ = nullptr;
+  zx::channel channel = std::move(channel_);
+  if (message_handler_)
+    message_handler_->OnChannelGone();
+  return channel;
+}
+
+void MessageReader::Reset() {
+  Unbind();
+  error_handler_ = nullptr;
+}
+
+zx_status_t MessageReader::TakeChannelAndErrorHandlerFrom(
+    MessageReader* other) {
+  zx_status_t status = Bind(other->Unbind(), other->dispatcher_);
+  if (status != ZX_OK)
+    return status;
+  error_handler_ = std::move(other->error_handler_);
+  return ZX_OK;
+}
+
+zx_status_t MessageReader::WaitAndDispatchOneMessageUntil(zx::time deadline) {
+  if (!is_bound())
+    return ZX_ERR_BAD_STATE;
+  zx_signals_t pending = ZX_SIGNAL_NONE;
+  zx_status_t status = channel_.wait_one(kSignals, deadline, &pending);
+  if (status == ZX_ERR_TIMED_OUT)
+    return status;
+  if (status != ZX_OK) {
+    NotifyError(status);
+    return status;
+  }
+
+  if (pending & ZX_CHANNEL_READABLE) {
+    MessageBuffer buffer;
+    return ReadAndDispatchMessage(&buffer);
+  }
+
+  ZX_DEBUG_ASSERT(pending & ZX_CHANNEL_PEER_CLOSED);
+  NotifyError(ZX_ERR_PEER_CLOSED);
+  return ZX_ERR_PEER_CLOSED;
+}
+
+void MessageReader::CallHandler(async_dispatcher_t* dispatcher,
+                                async_wait_t* wait, zx_status_t status,
+                                const zx_packet_signal_t* signal) {
+  static_assert(offsetof(MessageReader, wait_) == 0,
+                "The wait must be the first member for this cast to be valid.");
+  reinterpret_cast<MessageReader*>(wait)->OnHandleReady(dispatcher, status,
+                                                        signal);
+}
+
+void MessageReader::OnHandleReady(async_dispatcher_t* dispatcher,
+                                  zx_status_t status,
+                                  const zx_packet_signal_t* signal) {
+  if (status != ZX_OK) {
+    NotifyError(status);
+    return;
+  }
+
+  if (signal->observed & ZX_CHANNEL_READABLE) {
+    MessageBuffer buffer;
+    for (uint64_t i = 0; i < signal->count; i++) {
+      status = ReadAndDispatchMessage(&buffer);
+      // If ReadAndDispatchMessage returns ZX_ERR_STOP, that means the message
+      // handler has destroyed this object and we need to unwind without
+      // touching |this|.
+      if (status == ZX_ERR_SHOULD_WAIT)
+        break;
+      if (status != ZX_OK)
+        return;
+    }
+    status = async_begin_wait(dispatcher, &wait_);
+    if (status != ZX_OK) {
+      NotifyError(status);
+    }
+    return;
+  }
+
+  ZX_DEBUG_ASSERT(signal->observed & ZX_CHANNEL_PEER_CLOSED);
+  // Notice that we don't notify an error until we've drained all the messages
+  // out of the channel.
+  NotifyError(ZX_ERR_PEER_CLOSED);
+}
+
+zx_status_t MessageReader::ReadAndDispatchMessage(MessageBuffer* buffer) {
+  Message message = buffer->CreateEmptyMessage();
+  zx_status_t status = message.Read(channel_.get(), 0);
+  if (status == ZX_ERR_SHOULD_WAIT)
+    return status;
+  if (status != ZX_OK) {
+    NotifyError(status);
+    return status;
+  }
+
+  if (message.has_header() && message.ordinal() == FIDL_EPITAPH_ORDINAL) {
+    // This indicates the message is an epitaph, and that any epitaph-friendly
+    // error handlers should be invoked.  Note the epitaph error is stored in
+    // the header's reserved word.
+
+    // TODO(FIDL-322): Use a different error code to distinguish remote encoding
+    // errors from local ones.
+    if (message.bytes().actual() != sizeof(fidl_epitaph_t)) {
+      NotifyError(ZX_ERR_INVALID_ARGS);
+      return ZX_ERR_INVALID_ARGS;
+    }
+    fidl_epitaph_t* epitaph = message.GetBytesAs<fidl_epitaph_t>();
+    NotifyError(epitaph->hdr.reserved0);
+    return ZX_ERR_PEER_CLOSED;
+  }
+
+  if (!message_handler_)
+    return ZX_OK;
+  Canary canary(&should_stop_);
+  status = message_handler_->OnMessage(std::move(message));
+  if (canary.should_stop())
+    return ZX_ERR_STOP;
+  if (status != ZX_OK)
+    NotifyError(status);
+  return status;
+}
+
+zx_status_t MessageReader::Close(zx_status_t epitaph_value) {
+  if (!is_bound()) {
+    return ZX_ERR_BAD_STATE;
+  }
+
+  zx_status_t status = fidl_epitaph_write(channel_.get(), epitaph_value);
+  if (status != ZX_OK) {
+    return status;
+  }
+  Unbind();
+  return ZX_OK;
+}
+
+void MessageReader::NotifyError(zx_status_t epitaph_value) {
+  Unbind();
+  if (error_handler_) {
+    error_handler_(epitaph_value);
+  }
+}
+
+void MessageReader::Stop() {
+  if (should_stop_) {
+    *should_stop_ = true;
+    should_stop_ = nullptr;
+  }
+}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/pending_response.cc b/pkg/fidl_cpp/internal/pending_response.cc
new file mode 100644
index 0000000..3ac41ae
--- /dev/null
+++ b/pkg/fidl_cpp/internal/pending_response.cc
@@ -0,0 +1,77 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/pending_response.h"
+
+#include "lib/fidl/cpp/internal/logging.h"
+#include "lib/fidl/cpp/internal/stub_controller.h"
+#include "lib/fidl/cpp/internal/weak_stub_controller.h"
+
+namespace fidl {
+namespace internal {
+
+PendingResponse::PendingResponse() : txid_(0), weak_controller_(nullptr) {}
+
+PendingResponse::PendingResponse(zx_txid_t txid,
+                                 WeakStubController* weak_controller)
+    : txid_(txid), weak_controller_(weak_controller) {
+  if (weak_controller_)
+    weak_controller_->AddRef();
+}
+
+PendingResponse::~PendingResponse() {
+  if (weak_controller_)
+    weak_controller_->Release();
+}
+
+PendingResponse::PendingResponse(const PendingResponse& other)
+    : PendingResponse(other.txid_, other.weak_controller_) {}
+
+PendingResponse& PendingResponse::operator=(const PendingResponse& other) {
+  if (this == &other)
+    return *this;
+  txid_ = other.txid_;
+  if (weak_controller_)
+    weak_controller_->Release();
+  weak_controller_ = other.weak_controller_;
+  if (weak_controller_)
+    weak_controller_->AddRef();
+  return *this;
+}
+
+PendingResponse::PendingResponse(PendingResponse&& other)
+    : txid_(other.txid_), weak_controller_(other.weak_controller_) {
+  other.weak_controller_ = nullptr;
+}
+
+PendingResponse& PendingResponse::operator=(PendingResponse&& other) {
+  if (this == &other)
+    return *this;
+  txid_ = other.txid_;
+  if (weak_controller_)
+    weak_controller_->Release();
+  weak_controller_ = other.weak_controller_;
+  other.weak_controller_ = nullptr;
+  return *this;
+}
+
+zx_status_t PendingResponse::Send(const fidl_type_t* type, Message message) {
+  if (!weak_controller_)
+    return ZX_ERR_BAD_STATE;
+  StubController* controller = weak_controller_->controller();
+  if (!controller)
+    return ZX_ERR_BAD_STATE;
+  message.set_txid(txid_);
+  const char* error_msg = nullptr;
+  zx_status_t status = message.Validate(type, &error_msg);
+  if (status != ZX_OK) {
+    FIDL_REPORT_ENCODING_ERROR(message, type, error_msg);
+    return status;
+  }
+  zx_handle_t channel = controller->reader().channel().get();
+  return message.Write(channel, 0);
+}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/proxy.cc b/pkg/fidl_cpp/internal/proxy.cc
new file mode 100644
index 0000000..412aff7
--- /dev/null
+++ b/pkg/fidl_cpp/internal/proxy.cc
@@ -0,0 +1,13 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/proxy.h"
+
+namespace fidl {
+namespace internal {
+
+Proxy::~Proxy() = default;
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/proxy_controller.cc b/pkg/fidl_cpp/internal/proxy_controller.cc
new file mode 100644
index 0000000..bec764c
--- /dev/null
+++ b/pkg/fidl_cpp/internal/proxy_controller.cc
@@ -0,0 +1,97 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/proxy_controller.h"
+
+#include <utility>
+
+#include "lib/fidl/cpp/internal/logging.h"
+
+namespace fidl {
+namespace internal {
+namespace {
+
+constexpr uint32_t kUserspaceTxidMask = 0x7FFFFFFF;
+
+}  // namespace
+
+ProxyController::ProxyController() : reader_(this), next_txid_(1) {}
+
+ProxyController::~ProxyController() = default;
+
+ProxyController::ProxyController(ProxyController&& other)
+    : reader_(this),
+      handlers_(std::move(other.handlers_)),
+      next_txid_(other.next_txid_) {
+  reader_.TakeChannelAndErrorHandlerFrom(&other.reader());
+  other.Reset();
+}
+
+ProxyController& ProxyController::operator=(ProxyController&& other) {
+  if (this != &other) {
+    reader_.TakeChannelAndErrorHandlerFrom(&other.reader());
+    handlers_ = std::move(other.handlers_);
+    next_txid_ = other.next_txid_;
+    other.Reset();
+  }
+  return *this;
+}
+
+zx_status_t ProxyController::Send(
+    const fidl_type_t* type, Message message,
+    std::unique_ptr<MessageHandler> response_handler) {
+  zx_txid_t txid = 0;
+  if (response_handler) {
+    txid = next_txid_++ & kUserspaceTxidMask;
+    while (!txid || handlers_.find(txid) != handlers_.end())
+      txid = next_txid_++ & kUserspaceTxidMask;
+    message.set_txid(txid);
+  }
+  const char* error_msg = nullptr;
+  zx_status_t status = message.Validate(type, &error_msg);
+  if (status != ZX_OK) {
+    FIDL_REPORT_ENCODING_ERROR(message, type, error_msg);
+    return status;
+  }
+  status = message.Write(reader_.channel().get(), 0);
+  if (status != ZX_OK) {
+    FIDL_REPORT_CHANNEL_WRITING_ERROR(message, type, status);
+    return status;
+  }
+  if (response_handler)
+    handlers_.emplace(txid, std::move(response_handler));
+  return ZX_OK;
+}
+
+void ProxyController::Reset() {
+  reader_.Reset();
+  ClearPendingHandlers();
+}
+
+zx_status_t ProxyController::OnMessage(Message message) {
+  if (!message.has_header())
+    return ZX_ERR_INVALID_ARGS;
+  zx_txid_t txid = message.txid();
+  if (!txid) {
+    if (!proxy_)
+      return ZX_ERR_NOT_SUPPORTED;
+    return proxy_->Dispatch_(std::move(message));
+  }
+  auto it = handlers_.find(txid);
+  if (it == handlers_.end())
+    return ZX_ERR_NOT_FOUND;
+  std::unique_ptr<MessageHandler> handler = std::move(it->second);
+  handlers_.erase(it);
+  return handler->OnMessage(std::move(message));
+}
+
+void ProxyController::OnChannelGone() { ClearPendingHandlers(); }
+
+void ProxyController::ClearPendingHandlers() {
+  handlers_.clear();
+  next_txid_ = 1;
+}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/stub.cc b/pkg/fidl_cpp/internal/stub.cc
new file mode 100644
index 0000000..0ddec10
--- /dev/null
+++ b/pkg/fidl_cpp/internal/stub.cc
@@ -0,0 +1,13 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/stub.h"
+
+namespace fidl {
+namespace internal {
+
+Stub::~Stub() = default;
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/stub_controller.cc b/pkg/fidl_cpp/internal/stub_controller.cc
new file mode 100644
index 0000000..2244229
--- /dev/null
+++ b/pkg/fidl_cpp/internal/stub_controller.cc
@@ -0,0 +1,52 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/stub_controller.h"
+
+#include "lib/fidl/cpp/internal/logging.h"
+#include "lib/fidl/cpp/internal/pending_response.h"
+#include "lib/fidl/cpp/internal/weak_stub_controller.h"
+
+namespace fidl {
+namespace internal {
+
+StubController::StubController() : weak_(nullptr), reader_(this) {}
+
+StubController::~StubController() { InvalidateWeakIfNeeded(); }
+
+zx_status_t StubController::Send(const fidl_type_t* type, Message message) {
+  const char* error_msg = nullptr;
+  zx_status_t status = message.Validate(type, &error_msg);
+  if (status != ZX_OK) {
+    FIDL_REPORT_ENCODING_ERROR(message, type, error_msg);
+    return status;
+  }
+  return message.Write(reader_.channel().get(), 0);
+}
+
+zx_status_t StubController::OnMessage(Message message) {
+  if (!message.has_header())
+    return ZX_ERR_INVALID_ARGS;
+  zx_txid_t txid = message.txid();
+  WeakStubController* weak = nullptr;
+  if (txid) {
+    if (!weak_)
+      weak_ = new WeakStubController(this);
+    weak = weak_;
+  }
+  return stub_->Dispatch_(std::move(message), PendingResponse(txid, weak));
+}
+
+void StubController::OnChannelGone() { InvalidateWeakIfNeeded(); }
+
+void StubController::InvalidateWeakIfNeeded() {
+  if (!weak_)
+    return;
+  weak_->Invalidate();
+  weak_->Release();
+  weak_ = nullptr;
+}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/internal/weak_stub_controller.cc b/pkg/fidl_cpp/internal/weak_stub_controller.cc
new file mode 100644
index 0000000..7693ef7
--- /dev/null
+++ b/pkg/fidl_cpp/internal/weak_stub_controller.cc
@@ -0,0 +1,25 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/weak_stub_controller.h"
+
+namespace fidl {
+namespace internal {
+
+WeakStubController::WeakStubController(StubController* controller)
+    : ref_count_(1u), controller_(controller) {}
+
+WeakStubController::~WeakStubController() = default;
+
+void WeakStubController::AddRef() { ++ref_count_; }
+
+void WeakStubController::Release() {
+  if (--ref_count_ == 0)
+    delete this;
+}
+
+void WeakStubController::Invalidate() { controller_ = nullptr; }
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp/meta.json b/pkg/fidl_cpp/meta.json
new file mode 100644
index 0000000..37f840f
--- /dev/null
+++ b/pkg/fidl_cpp/meta.json
@@ -0,0 +1,45 @@
+{
+  "deps": [
+    "fidl_cpp_sync", 
+    "async", 
+    "async-default", 
+    "fidl", 
+    "fidl-async", 
+    "fit", 
+    "zx"
+  ], 
+  "fidl_deps": [], 
+  "headers": [
+    "pkg/fidl_cpp/include/lib/fidl/cpp/binding.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/binding_set.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/enum.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/interface_ptr_set.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/header.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/implementation.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_handler.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/message_reader.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/pending_response.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/proxy_controller.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/stub_controller.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/internal/weak_stub_controller.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/optional.h", 
+    "pkg/fidl_cpp/include/lib/fidl/cpp/thread_safe_binding_set.h"
+  ], 
+  "include_dir": "pkg/fidl_cpp/include", 
+  "name": "fidl_cpp", 
+  "root": "pkg/fidl_cpp", 
+  "sources": [
+    "pkg/fidl_cpp/internal/message_handler.cc", 
+    "pkg/fidl_cpp/internal/message_reader.cc", 
+    "pkg/fidl_cpp/internal/pending_response.cc", 
+    "pkg/fidl_cpp/internal/proxy.cc", 
+    "pkg/fidl_cpp/internal/proxy_controller.cc", 
+    "pkg/fidl_cpp/internal/stub.cc", 
+    "pkg/fidl_cpp/internal/stub_controller.cc", 
+    "pkg/fidl_cpp/internal/weak_stub_controller.cc"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/fidl_cpp_base/clone.cc b/pkg/fidl_cpp_base/clone.cc
new file mode 100644
index 0000000..9b4e80a
--- /dev/null
+++ b/pkg/fidl_cpp_base/clone.cc
@@ -0,0 +1,18 @@
+// 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.
+
+#include "lib/fidl/cpp/clone.h"
+
+namespace fidl {
+
+zx_status_t Clone(const StringPtr& value, StringPtr* result) {
+  if (!value) {
+    *result = StringPtr();
+  } else {
+    result->reset(*value);
+  }
+  return ZX_OK;
+}
+
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_base/coding_traits.cc b/pkg/fidl_cpp_base/coding_traits.cc
new file mode 100644
index 0000000..e66d8bd
--- /dev/null
+++ b/pkg/fidl_cpp_base/coding_traits.cc
@@ -0,0 +1,21 @@
+// 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.
+
+#include "lib/fidl/cpp/coding_traits.h"
+
+namespace fidl {
+
+void EncodeNullVector(Encoder* encoder, size_t offset) {
+  fidl_vector_t* vector = encoder->GetPtr<fidl_vector_t>(offset);
+  vector->count = 0u;
+  vector->data = reinterpret_cast<void*>(FIDL_ALLOC_ABSENT);
+}
+
+void EncodeVectorPointer(Encoder* encoder, size_t count, size_t offset) {
+  fidl_vector_t* vector = encoder->GetPtr<fidl_vector_t>(offset);
+  vector->count = count;
+  vector->data = reinterpret_cast<void*>(FIDL_ALLOC_PRESENT);
+}
+
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_base/decoder.cc b/pkg/fidl_cpp_base/decoder.cc
new file mode 100644
index 0000000..bec4ee0
--- /dev/null
+++ b/pkg/fidl_cpp_base/decoder.cc
@@ -0,0 +1,38 @@
+// 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.
+
+#include "lib/fidl/cpp/decoder.h"
+
+#include <utility>
+
+namespace fidl {
+
+Decoder::Decoder(Message message) : message_(std::move(message)) {}
+
+Decoder::~Decoder() = default;
+
+size_t Decoder::GetOffset(void* ptr) {
+  return GetOffset(reinterpret_cast<uintptr_t>(ptr));
+}
+
+size_t Decoder::GetOffset(uintptr_t ptr) {
+  // The |ptr| value comes from the message buffer, which we've already
+  // validated. That means it should coorespond to a valid offset within the
+  // message.
+  return ptr - reinterpret_cast<uintptr_t>(message_.bytes().data());
+}
+
+#ifdef __Fuchsia__
+void Decoder::DecodeHandle(zx::object_base* value, size_t offset) {
+  zx_handle_t* handle = GetPtr<zx_handle_t>(offset);
+  value->reset(*handle);
+  *handle = ZX_HANDLE_INVALID;
+}
+#endif
+
+uint8_t* Decoder::InternalGetPtr(size_t offset) {
+  return message_.bytes().data() + offset;
+}
+
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_base/encoder.cc b/pkg/fidl_cpp_base/encoder.cc
new file mode 100644
index 0000000..01ffb44
--- /dev/null
+++ b/pkg/fidl_cpp_base/encoder.cc
@@ -0,0 +1,60 @@
+// 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.
+
+#include "lib/fidl/cpp/encoder.h"
+
+#include <zircon/assert.h>
+#include <zircon/fidl.h>
+
+namespace fidl {
+namespace {
+
+size_t Align(size_t size) {
+  constexpr size_t alignment_mask = FIDL_ALIGNMENT - 1;
+  return (size + alignment_mask) & ~alignment_mask;
+}
+
+}  // namespace
+
+Encoder::Encoder(uint32_t ordinal) { EncodeMessageHeader(ordinal); }
+
+Encoder::~Encoder() = default;
+
+size_t Encoder::Alloc(size_t size) {
+  size_t offset = bytes_.size();
+  size_t new_size = bytes_.size() + Align(size);
+  ZX_ASSERT(new_size >= offset);
+  bytes_.resize(new_size);
+  return offset;
+}
+
+#ifdef __Fuchsia__
+void Encoder::EncodeHandle(zx::object_base* value, size_t offset) {
+  if (value->is_valid()) {
+    *GetPtr<zx_handle_t>(offset) = FIDL_HANDLE_PRESENT;
+    handles_.push_back(value->release());
+  } else {
+    *GetPtr<zx_handle_t>(offset) = FIDL_HANDLE_ABSENT;
+  }
+}
+#endif
+
+Message Encoder::GetMessage() {
+  return Message(BytePart(bytes_.data(), bytes_.size(), bytes_.size()),
+                 HandlePart(handles_.data(), handles_.size(), handles_.size()));
+}
+
+void Encoder::Reset(uint32_t ordinal) {
+  bytes_.clear();
+  handles_.clear();
+  EncodeMessageHeader(ordinal);
+}
+
+void Encoder::EncodeMessageHeader(uint32_t ordinal) {
+  size_t offset = Alloc(sizeof(fidl_message_header_t));
+  fidl_message_header_t* header = GetPtr<fidl_message_header_t>(offset);
+  header->ordinal = ordinal;
+}
+
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/array.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/array.h
new file mode 100644
index 0000000..aeb35e6
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/array.h
@@ -0,0 +1,98 @@
+// 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 LIB_FIDL_CPP_ARRAY_H_
+#define LIB_FIDL_CPP_ARRAY_H_
+
+#include <stddef.h>
+#include <string.h>
+
+#include <lib/fidl/cpp/comparison.h>
+
+namespace fidl {
+
+template <typename T, size_t N>
+class Array {
+ public:
+  Array() { memset(data_, 0, sizeof(data_)); }
+
+  constexpr size_t size() const { return N; }
+
+  // TODO(FIDL-245) Remove this overload.
+  constexpr size_t count() const { return N; }
+
+  const T* data() const { return data_; }
+  T* data() { return data_; }
+
+  // TODO(FIDL-245) Remove this overload.
+  T* mutable_data() { return data_; }
+
+  const T& at(size_t offset) const { return data()[offset]; }
+  T& at(size_t offset) { return mutable_data()[offset]; }
+
+  const T& operator[](size_t offset) const { return at(offset); }
+  T& operator[](size_t offset) { return at(offset); }
+
+  T* begin() { return mutable_data(); }
+  const T* begin() const { return data(); }
+  const T* cbegin() const { return data(); }
+
+  T* end() { return mutable_data() + count(); }
+  const T* end() const { return data() + count(); }
+  const T* cend() const { return data() + count(); }
+
+ private:
+  static_assert(N > 0, "fid::Array cannot have zero elements.");
+
+  T data_[N];
+};
+
+template <typename T, size_t N>
+bool operator==(const Array<T, N>& lhs, const Array<T, N>& rhs) {
+  for (size_t i = 0; i < N; ++i) {
+    if (!Equals(lhs[i], rhs[i])) {
+      return false;
+    }
+  }
+  return true;
+}
+
+template <typename T, size_t N>
+bool operator!=(const Array<T, N>& lhs, const Array<T, N>& rhs) {
+  return !(lhs == rhs);
+}
+
+template <typename T, size_t N>
+bool operator<(const Array<T, N>& lhs, const Array<T, N>& rhs) {
+  for (size_t i = 0; i < N; i++) {
+    if (lhs[i] != rhs[i]) {
+      return lhs[i] < rhs[i];
+    }
+  }
+  return false;
+}
+
+template <typename T, size_t N>
+bool operator>(const Array<T, N>& lhs, const Array<T, N>& rhs) {
+  for (size_t i = 0; i < N; i++) {
+    if (lhs[i] != rhs[i]) {
+      return lhs[i] > rhs[i];
+    }
+  }
+  return false;
+}
+
+template <typename T, size_t N>
+bool operator<=(const Array<T, N>& lhs, const Array<T, N>& rhs) {
+  return !(lhs > rhs);
+}
+
+template <typename T, size_t N>
+bool operator>=(const Array<T, N>& lhs, const Array<T, N>& rhs) {
+  return !(lhs < rhs);
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_ARRAY_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/clone.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/clone.h
new file mode 100644
index 0000000..8c1c108
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/clone.h
@@ -0,0 +1,141 @@
+// 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 LIB_FIDL_CPP_CLONE_H_
+#define LIB_FIDL_CPP_CLONE_H_
+
+#include <lib/fidl/cpp/array.h>
+#include <zircon/assert.h>
+#include <memory>
+#include "lib/fidl/cpp/string.h"
+#include "lib/fidl/cpp/traits.h"
+#include "lib/fidl/cpp/vector.h"
+
+namespace fidl {
+
+#ifdef __Fuchsia__
+namespace internal {
+
+template <typename T>
+inline typename std::enable_if<zx::object_traits<T>::supports_duplication,
+                               zx_status_t>::type
+CloneKernelObject(const zx::object<T>& object, zx::object<T>* result) {
+  return object.duplicate(ZX_RIGHT_SAME_RIGHTS, result);
+}
+
+template <typename T>
+inline typename std::enable_if<!zx::object_traits<T>::supports_duplication,
+                               zx_status_t>::type
+CloneKernelObject(const zx::object<T>& object, zx::object<T>* result) {
+  return ZX_ERR_ACCESS_DENIED;
+}
+
+}  // namespace internal
+#endif  // __Fuchsia__
+
+// Deep copies the contents of |value| into |result|.
+// This operation also attempts to duplicate any handles the value contains.
+//
+// Returns an error if the value could not be cloned, perhaps because a
+// handle was not duplicable.
+//
+// There are many overloads of this function with the following signature:
+//   zx_status_t Clone(const T& value, T* result);
+template <typename T>
+inline typename std::enable_if<IsPrimitive<T>::value, zx_status_t>::type Clone(
+    const T& value, T* result) {
+  *result = value;
+  return ZX_OK;
+}
+
+template <typename T>
+inline
+#ifdef __Fuchsia__
+    typename std::enable_if<!IsPrimitive<T>::value &&
+                                !std::is_base_of<zx::object_base, T>::value,
+                            zx_status_t>::type
+#else   // __Fuchsia__
+    typename std::enable_if<!IsPrimitive<T>::value, zx_status_t>::type
+#endif  // __Fuchsia__
+    Clone(const T& value, T* result) {
+  return value.Clone(result);
+}
+
+#ifdef __Fuchsia__
+template <typename T>
+zx_status_t Clone(const zx::object<T>& value, zx::object<T>* result) {
+  if (!value) {
+    result->reset();
+    return ZX_OK;
+  }
+  return internal::CloneKernelObject(value, result);
+}
+#endif  // __Fuchsia__
+
+template <typename T>
+inline zx_status_t Clone(const std::unique_ptr<T>& value,
+                         std::unique_ptr<T>* result) {
+  if (!value) {
+    result->reset();
+    return ZX_OK;
+  }
+  *result = std::make_unique<T>();
+  return Clone(*value, result->get());
+}
+
+template <typename T>
+inline typename std::enable_if<!IsPrimitive<T>::value, zx_status_t>::type Clone(
+    const VectorPtr<T>& value, VectorPtr<T>* result) {
+  if (!value) {
+    *result = VectorPtr<T>();
+    return ZX_OK;
+  }
+  result->resize(value->size());
+  for (size_t i = 0; i < value->size(); ++i) {
+    zx_status_t status = Clone(value->at(i), &(*result)->at(i));
+    if (status != ZX_OK)
+      return status;
+  }
+  return ZX_OK;
+}
+
+template <typename T>
+inline typename std::enable_if<IsPrimitive<T>::value, zx_status_t>::type Clone(
+    const VectorPtr<T>& value, VectorPtr<T>* result) {
+  if (!value) {
+    *result = VectorPtr<T>();
+    return ZX_OK;
+  }
+  result->reset(*value);
+  return ZX_OK;
+}
+
+template <typename T, size_t N>
+inline zx_status_t Clone(const Array<T, N>& value, Array<T, N>* result) {
+  for (size_t i = 0; i < N; ++i) {
+    zx_status_t status = Clone(value[i], &result->at(i));
+    if (status != ZX_OK)
+      return status;
+  }
+  return ZX_OK;
+}
+
+zx_status_t Clone(const StringPtr& value, StringPtr* result);
+
+// Returns a deep copy of |value|.
+// This operation also attempts to duplicate any handles the value contains.
+//
+// Crashes the program if the value could not be cloned, perhaps because a
+// handle was not duplicable.
+template <typename T>
+inline T Clone(const T& value) {
+  T clone;
+  zx_status_t status = Clone(value, &clone);
+  ZX_ASSERT(status == ZX_OK);
+  return clone;
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_CODING_TRAITS_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/coding_traits.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/coding_traits.h
new file mode 100644
index 0000000..0a51f5a
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/coding_traits.h
@@ -0,0 +1,165 @@
+// 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 LIB_FIDL_CPP_CODING_TRAITS_H_
+#define LIB_FIDL_CPP_CODING_TRAITS_H_
+
+#include <lib/fidl/cpp/array.h>
+
+#include <memory>
+
+#include "lib/fidl/cpp/decoder.h"
+#include "lib/fidl/cpp/encoder.h"
+#include "lib/fidl/cpp/traits.h"
+#include "lib/fidl/cpp/vector.h"
+
+namespace fidl {
+
+template <typename T, class Enable = void>
+struct CodingTraits;
+
+template <typename T>
+struct CodingTraits<T, typename std::enable_if<IsPrimitive<T>::value>::type> {
+  static constexpr size_t encoded_size = sizeof(T);
+  inline static void Encode(Encoder* encoder, T* value, size_t offset) {
+    *encoder->GetPtr<T>(offset) = *value;
+  }
+  inline static void Decode(Decoder* decoder, T* value, size_t offset) {
+    *value = *decoder->GetPtr<T>(offset);
+  }
+};
+
+template <>
+struct CodingTraits<bool> {
+  static constexpr size_t encoded_size = sizeof(bool);
+  inline static void Encode(Encoder* encoder, bool* value, size_t offset) {
+    *encoder->GetPtr<bool>(offset) = *value;
+  }
+  inline static void Encode(Encoder* encoder, std::vector<bool>::iterator value,
+                            size_t offset) {
+    *encoder->GetPtr<bool>(offset) = *value;
+  }
+  inline static void Decode(Decoder* decoder, bool* value, size_t offset) {
+    *value = *decoder->GetPtr<bool>(offset);
+  }
+  inline static void Decode(Decoder* decoder, std::vector<bool>::iterator value,
+                            size_t offset) {
+    *value = *decoder->GetPtr<bool>(offset);
+  }
+};
+
+#ifdef __Fuchsia__
+template <typename T>
+struct CodingTraits<T, typename std::enable_if<
+                           std::is_base_of<zx::object_base, T>::value>::type> {
+  static constexpr size_t encoded_size = sizeof(zx_handle_t);
+  static void Encode(Encoder* encoder, zx::object_base* value, size_t offset) {
+    encoder->EncodeHandle(value, offset);
+  }
+  static void Decode(Decoder* decoder, zx::object_base* value, size_t offset) {
+    decoder->DecodeHandle(value, offset);
+  }
+};
+#endif
+
+template <typename T>
+struct CodingTraits<std::unique_ptr<T>> {
+  static constexpr size_t encoded_size = sizeof(uintptr_t);
+  static void Encode(Encoder* encoder, std::unique_ptr<T>* value,
+                     size_t offset) {
+    if (value->get()) {
+      *encoder->GetPtr<uintptr_t>(offset) = FIDL_ALLOC_PRESENT;
+      size_t size = CodingTraits<T>::encoded_size;
+      CodingTraits<T>::Encode(encoder, value->get(), encoder->Alloc(size));
+    } else {
+      *encoder->GetPtr<uintptr_t>(offset) = FIDL_ALLOC_ABSENT;
+    }
+  }
+  static void Decode(Decoder* decoder, std::unique_ptr<T>* value,
+                     size_t offset) {
+    uintptr_t ptr = *decoder->GetPtr<uintptr_t>(offset);
+    if (!ptr)
+      return value->reset();
+    *value = std::make_unique<T>();
+    CodingTraits<T>::Decode(decoder, value->get(), decoder->GetOffset(ptr));
+  }
+};
+
+void EncodeNullVector(Encoder* encoder, size_t offset);
+void EncodeVectorPointer(Encoder* encoder, size_t count, size_t offset);
+
+template <typename T>
+struct CodingTraits<VectorPtr<T>> {
+  static constexpr size_t encoded_size = sizeof(fidl_vector_t);
+  static void Encode(Encoder* encoder, VectorPtr<T>* value, size_t offset) {
+    if (value->is_null())
+      return EncodeNullVector(encoder, offset);
+    size_t count = (*value)->size();
+    EncodeVectorPointer(encoder, count, offset);
+    size_t stride = CodingTraits<T>::encoded_size;
+    size_t base = encoder->Alloc(count * stride);
+    for (size_t i = 0; i < count; ++i)
+      CodingTraits<T>::Encode(encoder, &(*value)->at(i), base + i * stride);
+  }
+  static void Decode(Decoder* decoder, VectorPtr<T>* value, size_t offset) {
+    fidl_vector_t* encoded = decoder->GetPtr<fidl_vector_t>(offset);
+    if (!encoded->data) {
+      *value = VectorPtr<T>();
+      return;
+    }
+    value->resize(encoded->count);
+    size_t stride = CodingTraits<T>::encoded_size;
+    size_t base = decoder->GetOffset(encoded->data);
+    size_t count = encoded->count;
+    for (size_t i = 0; i < count; ++i)
+      CodingTraits<T>::Decode(decoder, &(*value)->at(i), base + i * stride);
+  }
+};
+
+template <typename T, size_t N>
+struct CodingTraits<Array<T, N>> {
+  static constexpr size_t encoded_size = CodingTraits<T>::encoded_size * N;
+  static void Encode(Encoder* encoder, Array<T, N>* value, size_t offset) {
+    size_t stride = CodingTraits<T>::encoded_size;
+    for (size_t i = 0; i < N; ++i)
+      CodingTraits<T>::Encode(encoder, &value->at(i), offset + i * stride);
+  }
+  static void Decode(Decoder* decoder, Array<T, N>* value, size_t offset) {
+    size_t stride = CodingTraits<T>::encoded_size;
+    for (size_t i = 0; i < N; ++i)
+      CodingTraits<T>::Decode(decoder, &value->at(i), offset + i * stride);
+  }
+};
+
+template <typename T, size_t EncodedSize>
+struct EncodableCodingTraits {
+  static constexpr size_t encoded_size = EncodedSize;
+  static void Encode(Encoder* encoder, T* value, size_t offset) {
+    value->Encode(encoder, offset);
+  }
+  static void Decode(Decoder* decoder, T* value, size_t offset) {
+    T::Decode(decoder, value, offset);
+  }
+};
+
+template <typename T>
+void Encode(Encoder* encoder, T* value, size_t offset) {
+  CodingTraits<T>::Encode(encoder, value, offset);
+}
+
+template <typename T>
+void Decode(Decoder* decoder, T* value, size_t offset) {
+  CodingTraits<T>::Decode(decoder, value, offset);
+}
+
+template <typename T>
+T DecodeAs(Decoder* decoder, size_t offset) {
+  T value;
+  Decode(decoder, &value, offset);
+  return value;
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_CODING_TRAITS_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/comparison.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/comparison.h
new file mode 100644
index 0000000..f89f352
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/comparison.h
@@ -0,0 +1,30 @@
+// 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 GARNET_PUBLIC_LIB_FIDL_CPP_COMPARISON_H_
+#define GARNET_PUBLIC_LIB_FIDL_CPP_COMPARISON_H_
+
+#include <memory>
+
+// Comparisons that uses structure equality on on std::unique_ptr instead of
+// pointer equality.
+namespace fidl {
+
+template <class T>
+inline bool Equals(const T& lhs, const T& rhs) {
+  return lhs == rhs;
+}
+
+template <class T>
+inline bool Equals(const std::unique_ptr<T>& lhs,
+                   const std::unique_ptr<T>& rhs) {
+  if (lhs == nullptr || rhs == nullptr) {
+    return rhs == lhs;
+  }
+  return Equals<T>(*lhs, *rhs);
+}
+
+}  // namespace fidl
+
+#endif  // GARNET_PUBLIC_LIB_FIDL_CPP_COMPARISON_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/decoder.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/decoder.h
new file mode 100644
index 0000000..119dcd0
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/decoder.h
@@ -0,0 +1,42 @@
+// 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 LIB_FIDL_CPP_DECODER_H_
+#define LIB_FIDL_CPP_DECODER_H_
+
+#include <lib/fidl/cpp/message.h>
+#include <zircon/fidl.h>
+
+#ifdef __Fuchsia__
+#include <lib/zx/object.h>
+#endif
+
+namespace fidl {
+
+class Decoder {
+ public:
+  explicit Decoder(Message message);
+  ~Decoder();
+
+  template <typename T>
+  T* GetPtr(size_t offset) {
+    return reinterpret_cast<T*>(InternalGetPtr(offset));
+  }
+
+  size_t GetOffset(void* ptr);
+  size_t GetOffset(uintptr_t ptr);
+
+#ifdef __Fuchsia__
+  void DecodeHandle(zx::object_base* value, size_t offset);
+#endif
+
+ private:
+  uint8_t* InternalGetPtr(size_t offset);
+
+  Message message_;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_DECODER_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/encoder.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/encoder.h
new file mode 100644
index 0000000..00f543e
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/encoder.h
@@ -0,0 +1,58 @@
+// 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 LIB_FIDL_CPP_ENCODER_H_
+#define LIB_FIDL_CPP_ENCODER_H_
+
+#include <lib/fidl/cpp/message.h>
+
+#ifdef __Fuchsia__
+#include <lib/zx/object.h>
+#endif
+
+#include <zircon/fidl.h>
+
+#include <vector>
+
+namespace fidl {
+
+class Encoder {
+ public:
+  enum NoHeader { NO_HEADER };
+
+  explicit Encoder(uint32_t ordinal);
+  explicit Encoder(NoHeader) {}
+  ~Encoder();
+
+  size_t Alloc(size_t size);
+
+  template <typename T>
+  T* GetPtr(size_t offset) {
+    return reinterpret_cast<T*>(bytes_.data() + offset);
+  }
+
+#ifdef __Fuchsia__
+  void EncodeHandle(zx::object_base* value, size_t offset);
+#endif
+
+  Message GetMessage();
+
+  void Reset(uint32_t ordinal);
+
+  size_t CurrentLength() const { return bytes_.size(); }
+
+  size_t CurrentHandleCount() const { return handles_.size(); }
+
+  std::vector<uint8_t> TakeBytes() { return std::move(bytes_); }
+
+ private:
+  void EncodeMessageHeader(uint32_t ordinal);
+
+  std::vector<uint8_t> bytes_;
+  std::vector<zx_handle_t> handles_;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_ENCODER_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/internal/logging.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/internal/logging.h
new file mode 100644
index 0000000..4ed4132
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/internal/logging.h
@@ -0,0 +1,37 @@
+// 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 LIB_FIDL_CPP_INTERNAL_LOGGING_H_
+#define LIB_FIDL_CPP_INTERNAL_LOGGING_H_
+
+#include <lib/fidl/cpp/message.h>
+
+namespace fidl {
+namespace internal {
+
+void ReportEncodingError(const Message& message, const fidl_type_t* type,
+                         const char* error_msg, const char* file, int line);
+
+void ReportDecodingError(const Message& message, const fidl_type_t* type,
+                         const char* error_msg, const char* file, int line);
+
+void ReportChannelWritingError(const Message& message, const fidl_type_t* type,
+                               zx_status_t status, const char* file, int line);
+
+#define FIDL_REPORT_ENCODING_ERROR(message, type, error_msg)            \
+  ::fidl::internal::ReportEncodingError((message), (type), (error_msg), \
+                                        __FILE__, __LINE__)
+
+#define FIDL_REPORT_DECODING_ERROR(message, type, error_msg)            \
+  ::fidl::internal::ReportDecodingError((message), (type), (error_msg), \
+                                        __FILE__, __LINE__)
+
+#define FIDL_REPORT_CHANNEL_WRITING_ERROR(message, type, status)           \
+  ::fidl::internal::ReportChannelWritingError((message), (type), (status), \
+                                              __FILE__, __LINE__)
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_LOGGING_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/object_coding.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/object_coding.h
new file mode 100644
index 0000000..202b266
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/object_coding.h
@@ -0,0 +1,45 @@
+// 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.
+
+#include "coding_traits.h"
+#include "encoder.h"
+
+namespace fidl {
+
+template <class T>
+zx_status_t EncodeObject(T* object, std::vector<uint8_t>* output,
+                         const char** error_msg_out) {
+  Encoder encoder(Encoder::NO_HEADER);
+  object->Encode(&encoder, encoder.Alloc(CodingTraits<T>::encoded_size));
+  if (encoder.CurrentHandleCount() != 0) {
+    if (error_msg_out != nullptr) {
+      *error_msg_out = "Cannot encode handles with object encoding";
+    }
+    return ZX_ERR_INVALID_ARGS;
+  }
+  *output = encoder.TakeBytes();
+  return ZX_OK;
+}
+
+template <class T>
+zx_status_t DecodeObject(uint8_t* bytes, size_t bytes_length, T* object,
+                         const char** error_msg_out) {
+  Message msg(BytePart(bytes, bytes_length, bytes_length), HandlePart());
+  zx_status_t status = msg.Decode(T::FidlType, error_msg_out);
+  if (status != ZX_OK) {
+    return status;
+  }
+  Decoder decoder(std::move(msg));
+  T::Decode(&decoder, object, 0);
+  return ZX_OK;
+}
+
+template <class T>
+zx_status_t ValidateObject(uint8_t* bytes, size_t bytes_length, T* object,
+                           const char** error_msg_out) {
+  return Message(BytePart(bytes, bytes_length, bytes_length), HandlePart())
+      .Validate(T::FidlType, error_msg_out);
+}
+
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/string.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/string.h
new file mode 100644
index 0000000..3318bb7
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/string.h
@@ -0,0 +1,186 @@
+// 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 LIB_FIDL_CPP_STRING_H_
+#define LIB_FIDL_CPP_STRING_H_
+
+#include <lib/fidl/cpp/builder.h>
+#include <lib/fidl/cpp/string_view.h>
+
+#include <iosfwd>
+#include <string>
+#include <utility>
+
+#include <zircon/assert.h>
+
+#include "lib/fidl/cpp/coding_traits.h"
+#include "lib/fidl/cpp/traits.h"
+
+namespace fidl {
+
+// A representation of a FIDL string that owns the memory for the string.
+//
+// A StringPtr has three states: (1) null, (2) empty, (3) contains a string. In
+// the second state, operations that return an std::string return the empty
+// std::string. The null and empty states can be distinguished using the
+// |is_null| and |operator bool| methods.
+class StringPtr {
+ public:
+  StringPtr();
+  StringPtr(const StringPtr& other);
+  StringPtr(StringPtr&& other);
+  StringPtr(std::string str);
+  StringPtr(const char* str);
+  StringPtr(const char* str, size_t length);
+  ~StringPtr();
+
+  StringPtr& operator=(const StringPtr&);
+  StringPtr& operator=(StringPtr&& other);
+
+  // Accesses the underlying std::string object.
+  const std::string& get() const { return str_; }
+
+  // Stores the given std::string in this StringPtr.
+  //
+  // After this method returns, the StringPtr is non-null.
+  void reset(std::string str) {
+    str_ = std::move(str);
+    is_null_ = false;
+  }
+
+  // Causes this StringPtr to become null.
+  void reset() {
+    str_.clear();
+    is_null_ = true;
+  }
+
+  void swap(StringPtr& other) {
+    using std::swap;
+    swap(str_, other.str_);
+    swap(is_null_, other.is_null_);
+  }
+
+  // Whether this StringPtr is null.
+  //
+  // The null state is separate from the empty state.
+  bool is_null() const { return is_null_ && str_.empty(); }
+
+  // Tests as true if non-null, false if null.
+  explicit operator bool() const { return !is_null_; }
+
+  // Provides access to the underlying std::string.
+  std::string* operator->() { return &str_; }
+  const std::string* operator->() const { return &str_; }
+
+  // Provides access to the underlying std::string.
+  const std::string& operator*() const { return str_; }
+
+  operator const std::string&() const { return str_; }
+
+  void Encode(Encoder* encoder, size_t offset);
+  static void Decode(Decoder* decoder, StringPtr* value, size_t offset);
+
+ private:
+  std::string str_;
+  bool is_null_;
+};
+
+inline bool operator==(const StringPtr& a, const StringPtr& b) {
+  if (a.is_null()) {
+    return b.is_null();
+  }
+  return !b.is_null() && a.get() == b.get();
+}
+
+inline bool operator==(const char* a, const StringPtr& b) {
+  if (a == nullptr) {
+    return b.is_null();
+  }
+  return !b.is_null() && a == b.get();
+}
+
+inline bool operator==(const StringPtr& a, const char* b) {
+  if (a.is_null()) {
+    return b == nullptr;
+  }
+  return b != nullptr && a.get() == b;
+}
+
+inline bool operator!=(const StringPtr& a, const StringPtr& b) {
+  return !(a == b);
+}
+
+inline bool operator!=(const char* a, const StringPtr& b) { return !(a == b); }
+
+inline bool operator!=(const StringPtr& a, const char* b) { return !(a == b); }
+
+inline bool operator<(const StringPtr& a, const StringPtr& b) {
+  if (a.is_null() || b.is_null()) {
+    return !b.is_null();
+  }
+  return *a < *b;
+}
+
+inline bool operator<(const char* a, const StringPtr& b) {
+  if (a == nullptr || b.is_null()) {
+    return !b.is_null();
+  }
+  return a < *b;
+}
+
+inline bool operator<(const StringPtr& a, const char* b) {
+  if (a.is_null() || b == nullptr) {
+    return b != nullptr;
+  }
+  return *a < b;
+}
+
+inline bool operator>(const StringPtr& a, const StringPtr& b) {
+  if (a.is_null() || b.is_null()) {
+    return !a.is_null();
+  }
+  return *a > *b;
+}
+
+inline bool operator>(const char* a, const StringPtr& b) {
+  if (a == nullptr || b.is_null()) {
+    return a != nullptr;
+  }
+  return a > *b;
+}
+
+inline bool operator>(const StringPtr& a, const char* b) {
+  if (a.is_null() || b == nullptr) {
+    return a != nullptr;
+  }
+  return *a > b;
+}
+
+inline bool operator<=(const StringPtr& a, const StringPtr& b) {
+  return !(a > b);
+}
+
+inline bool operator<=(const char* a, const StringPtr& b) { return !(a > b); }
+
+inline bool operator<=(const StringPtr& a, const char* b) { return !(a > b); }
+
+inline bool operator>=(const StringPtr& a, const StringPtr& b) {
+  return !(a < b);
+}
+
+inline bool operator>=(const char* a, const StringPtr& b) { return !(a < b); }
+
+inline bool operator>=(const StringPtr& a, const char* b) { return !(a < b); }
+
+inline std::ostream& operator<<(std::ostream& out, const StringPtr& str) {
+  return out << str.get();
+}
+
+template <>
+struct CodingTraits<StringPtr>
+    : public EncodableCodingTraits<StringPtr, sizeof(fidl_string_t)> {};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_STRING_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/traits.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/traits.h
new file mode 100644
index 0000000..9ce7b3a
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/traits.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 LIB_FIDL_CPP_TRAITS_H_
+#define LIB_FIDL_CPP_TRAITS_H_
+
+#include <stdint.h>
+
+#include <type_traits>
+
+namespace fidl {
+
+// A type trait that indiciates whether the given type is a primitive FIDL
+// type.
+template <typename T>
+struct IsPrimitive : public std::false_type {};
+
+// clang-format off
+template <> struct IsPrimitive<bool> : public std::true_type {};
+template <> struct IsPrimitive<uint8_t> : public std::true_type {};
+template <> struct IsPrimitive<uint16_t> : public std::true_type {};
+template <> struct IsPrimitive<uint32_t> : public std::true_type {};
+template <> struct IsPrimitive<uint64_t> : public std::true_type {};
+template <> struct IsPrimitive<int8_t> : public std::true_type {};
+template <> struct IsPrimitive<int16_t> : public std::true_type {};
+template <> struct IsPrimitive<int32_t> : public std::true_type {};
+template <> struct IsPrimitive<int64_t> : public std::true_type {};
+template <> struct IsPrimitive<float> : public std::true_type {};
+template <> struct IsPrimitive<double> : public std::true_type {};
+// clang-format on
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_TRAITS_H_
diff --git a/pkg/fidl_cpp_base/include/lib/fidl/cpp/vector.h b/pkg/fidl_cpp_base/include/lib/fidl/cpp/vector.h
new file mode 100644
index 0000000..02d718c
--- /dev/null
+++ b/pkg/fidl_cpp_base/include/lib/fidl/cpp/vector.h
@@ -0,0 +1,183 @@
+// 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 LIB_FIDL_CPP_VECTOR_H_
+#define LIB_FIDL_CPP_VECTOR_H_
+
+#include <lib/fidl/cpp/builder.h>
+#include <lib/fidl/cpp/comparison.h>
+#include <lib/fidl/cpp/vector_view.h>
+
+#include <utility>
+#include <vector>
+
+#include <zircon/assert.h>
+
+#include "lib/fidl/cpp/traits.h"
+
+namespace fidl {
+
+// A representation of a FIDL vector that owns the memory for the vector.
+//
+// A VectorPtr has three states: (1) null, (2) empty, (3) contains data.  You
+// can check for the null state using the |is_null| method.
+template <typename T>
+class VectorPtr {
+ public:
+  VectorPtr() : is_null_if_empty_(true) {}
+  ~VectorPtr() = default;
+  VectorPtr(std::nullptr_t) : is_null_if_empty_(true) {}
+  explicit VectorPtr(size_t size)
+      : vec_(std::vector<T>(size)), is_null_if_empty_(false) {}
+  explicit VectorPtr(std::vector<T> vec)
+      : vec_(std::move(vec)), is_null_if_empty_(false) {}
+
+  VectorPtr(const VectorPtr&) = delete;
+  VectorPtr& operator=(const VectorPtr&) = delete;
+
+  VectorPtr(VectorPtr&& other) = default;
+  VectorPtr& operator=(VectorPtr&& other) = default;
+
+  // Creates a VectorPtr of the given size.
+  //
+  // Equivalent to using the |VectorPtr(size_t)| constructor.
+  static VectorPtr New(size_t size) { return VectorPtr(size); }
+
+  // Accesses the underlying std::vector object.
+  const std::vector<T>& get() const { return vec_; }
+
+  // Takes the std::vector from the VectorPtr.
+  //
+  // After this method returns, the VectorPtr is null.
+  std::vector<T> take() {
+    is_null_if_empty_ = true;
+    return std::move(vec_);
+  }
+
+  // Stores the given std::vector in this VectorPtr.
+  //
+  // After this method returns, the VectorPtr is non-null.
+  void reset(std::vector<T> vec) {
+    vec_ = std::move(vec);
+    is_null_if_empty_ = false;
+  }
+
+  void reset() {
+    vec_.clear();
+    is_null_if_empty_ = true;
+  }
+
+  // Resizes the underlying std::vector in this VectorPtr to the given size.
+  //
+  // After this method returns, the VectorPtr is non-null.
+  void resize(size_t size) {
+    vec_.resize(size);
+    is_null_if_empty_ = false;
+  }
+
+  // Pushes |value| onto the back of this VectorPtr.
+  //
+  // If this vector was null, it will become non-null with a size of 1.
+  void push_back(const T& value) {
+    vec_.push_back(value);
+    is_null_if_empty_ = false;
+  }
+
+  // Pushes |value| onto the back of this VectorPtr.
+  //
+  // If this vector was null, it will become non-null with a size of 1.
+  void push_back(T&& value) {
+    vec_.push_back(std::forward<T>(value));
+    is_null_if_empty_ = false;
+  }
+
+  void swap(VectorPtr& other) {
+    using std::swap;
+    swap(vec_, other.vec_);
+    swap(is_null_if_empty_, other.is_null_if_empty_);
+  }
+
+  // Returns a copy of this VectorPtr.
+  //
+  // Unlike fidl::Clone, this function can never fail. However, this function
+  // works only if T is copiable.
+  VectorPtr Clone() const {
+    if (is_null())
+      return VectorPtr();
+    return VectorPtr(vec_);
+  }
+
+  // Whether this VectorPtr is null.
+  //
+  // The null state is separate from the empty state.
+  bool is_null() const { return is_null_if_empty_ && vec_.empty(); }
+
+  // Tests as true if non-null, false if null.
+  explicit operator bool() const { return !is_null(); }
+
+  // Provides access to the underlying std::vector.
+  std::vector<T>* operator->() { return &vec_; }
+  const std::vector<T>* operator->() const { return &vec_; }
+
+  // Provides access to the underlying std::vector.
+  std::vector<T>& operator*() { return vec_; }
+  const std::vector<T>& operator*() const { return vec_; }
+
+  operator const std::vector<T>&() const { return vec_; }
+
+ private:
+  std::vector<T> vec_;
+  bool is_null_if_empty_;
+};
+
+template <class T>
+inline bool operator==(const VectorPtr<T>& lhs, const VectorPtr<T>& rhs) {
+  if (lhs.is_null() || rhs.is_null()) {
+    return lhs.is_null() == rhs.is_null();
+  }
+  if (lhs->size() != rhs->size()) {
+    return false;
+  }
+  for (size_t i = 0; i < lhs->size(); ++i) {
+    if (!Equals(lhs->at(i), rhs->at(i))) {
+      return false;
+    }
+  }
+  return true;
+}
+
+template <class T>
+inline bool operator!=(const VectorPtr<T>& lhs, const VectorPtr<T>& rhs) {
+  return !(lhs == rhs);
+}
+
+template <class T>
+inline bool operator<(const VectorPtr<T>& lhs, const VectorPtr<T>& rhs) {
+  if (lhs.is_null() || rhs.is_null()) {
+    return !rhs.is_null();
+  }
+  return *lhs < *rhs;
+}
+
+template <class T>
+inline bool operator>(const VectorPtr<T>& lhs, const VectorPtr<T>& rhs) {
+  if (lhs.is_null() || rhs.is_null()) {
+    return !lhs.is_null();
+  }
+  return *lhs > *rhs;
+}
+
+template <class T>
+inline bool operator<=(const VectorPtr<T>& lhs, const VectorPtr<T>& rhs) {
+  return !(lhs > rhs);
+}
+
+template <class T>
+inline bool operator>=(const VectorPtr<T>& lhs, const VectorPtr<T>& rhs) {
+  return !(lhs < rhs);
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_VECTOR_H_
diff --git a/pkg/fidl_cpp_base/internal/logging.cc b/pkg/fidl_cpp_base/internal/logging.cc
new file mode 100644
index 0000000..c9fd77d
--- /dev/null
+++ b/pkg/fidl_cpp_base/internal/logging.cc
@@ -0,0 +1,51 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/logging.h"
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+namespace fidl {
+namespace internal {
+
+void ReportEncodingError(const Message& message, const fidl_type_t* type,
+                         const char* error_msg, const char* file, int line) {
+  char type_name[1024];
+  size_t type_name_length =
+      fidl_format_type_name(type, type_name, sizeof(type_name));
+  fprintf(stderr,
+          "fidl encoding error at %s:%d: %s, "
+          "type %.*s, %" PRIu32 " bytes, %" PRIu32 " handles\n",
+          file, line, error_msg, static_cast<int>(type_name_length), type_name,
+          message.bytes().actual(), message.handles().actual());
+}
+
+void ReportDecodingError(const Message& message, const fidl_type_t* type,
+                         const char* error_msg, const char* file, int line) {
+  char type_name[1024];
+  size_t type_name_length =
+      fidl_format_type_name(type, type_name, sizeof(type_name));
+  fprintf(stderr,
+          "fidl decoding error at %s:%d: %s, "
+          "type %.*s, %" PRIu32 " bytes, %" PRIu32 " handles\n",
+          file, line, error_msg, static_cast<int>(type_name_length), type_name,
+          message.bytes().actual(), message.handles().actual());
+}
+
+void ReportChannelWritingError(const Message& message, const fidl_type_t* type,
+                               zx_status_t status, const char* file, int line) {
+  char type_name[1024];
+  size_t type_name_length =
+      fidl_format_type_name(type, type_name, sizeof(type_name));
+  fprintf(stderr,
+          "fidl channel writing error at %s:%d: zx_status_t %d, "
+          "type %.*s, %" PRIu32 " bytes, %" PRIu32 " handles\n",
+          file, line, status, static_cast<int>(type_name_length), type_name,
+          message.bytes().actual(), message.handles().actual());
+}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_base/meta.json b/pkg/fidl_cpp_base/meta.json
new file mode 100644
index 0000000..29eb264
--- /dev/null
+++ b/pkg/fidl_cpp_base/meta.json
@@ -0,0 +1,34 @@
+{
+  "deps": [
+    "fit", 
+    "fidl", 
+    "fidl-async", 
+    "zx"
+  ], 
+  "fidl_deps": [], 
+  "headers": [
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/array.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/clone.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/coding_traits.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/comparison.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/decoder.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/encoder.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/internal/logging.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/object_coding.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/string.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/traits.h", 
+    "pkg/fidl_cpp_base/include/lib/fidl/cpp/vector.h"
+  ], 
+  "include_dir": "pkg/fidl_cpp_base/include", 
+  "name": "fidl_cpp_base", 
+  "root": "pkg/fidl_cpp_base", 
+  "sources": [
+    "pkg/fidl_cpp_base/clone.cc", 
+    "pkg/fidl_cpp_base/coding_traits.cc", 
+    "pkg/fidl_cpp_base/decoder.cc", 
+    "pkg/fidl_cpp_base/encoder.cc", 
+    "pkg/fidl_cpp_base/internal/logging.cc", 
+    "pkg/fidl_cpp_base/string.cc"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/fidl_cpp_base/string.cc b/pkg/fidl_cpp_base/string.cc
new file mode 100644
index 0000000..35b8f46
--- /dev/null
+++ b/pkg/fidl_cpp_base/string.cc
@@ -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.
+
+#include "lib/fidl/cpp/string.h"
+
+#include <string.h>
+
+#include "lib/fidl/cpp/encoder.h"
+
+namespace fidl {
+
+StringPtr::StringPtr() : is_null_(true) {}
+
+StringPtr::StringPtr(const StringPtr& other) = default;
+
+StringPtr::StringPtr(std::string str) : str_(std::move(str)), is_null_(false) {}
+
+StringPtr::StringPtr(const char* str)
+    : str_(str ? std::string(str) : std::string()), is_null_(!str) {}
+
+StringPtr::StringPtr(const char* str, size_t length)
+    : str_(str ? std::string(str, length) : std::string()), is_null_(!str) {}
+
+StringPtr::~StringPtr() = default;
+
+StringPtr::StringPtr(StringPtr&& other)
+    : str_(std::move(other.str_)), is_null_(other.is_null_) {}
+
+StringPtr& StringPtr::operator=(const StringPtr& other) = default;
+
+StringPtr& StringPtr::operator=(StringPtr&& other) {
+  str_ = std::move(other.str_);
+  is_null_ = other.is_null_;
+  return *this;
+}
+
+void StringPtr::Encode(Encoder* encoder, size_t offset) {
+  fidl_string_t* string = encoder->GetPtr<fidl_string_t>(offset);
+  if (is_null()) {
+    string->size = 0u;
+    string->data = reinterpret_cast<char*>(FIDL_ALLOC_ABSENT);
+  } else {
+    string->size = str_.size();
+    string->data = reinterpret_cast<char*>(FIDL_ALLOC_PRESENT);
+    size_t base = encoder->Alloc(str_.size());
+    char* payload = encoder->GetPtr<char>(base);
+    memcpy(payload, str_.data(), str_.size());
+  }
+}
+
+void StringPtr::Decode(Decoder* decoder, StringPtr* value, size_t offset) {
+  fidl_string_t* string = decoder->GetPtr<fidl_string_t>(offset);
+  if (string->data) {
+    value->reset(std::string(string->data, string->size));
+  } else {
+    *value = StringPtr();
+  }
+}
+
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_handle.h b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_handle.h
new file mode 100644
index 0000000..2257a00
--- /dev/null
+++ b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_handle.h
@@ -0,0 +1,186 @@
+// 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 LIB_FIDL_CPP_INTERFACE_HANDLE_H_
+#define LIB_FIDL_CPP_INTERFACE_HANDLE_H_
+
+#include <lib/zx/channel.h>
+#include <zircon/assert.h>
+
+#include <cstddef>
+#include <utility>
+
+#include "lib/fidl/cpp/clone.h"
+#include "lib/fidl/cpp/coding_traits.h"
+#include "lib/fidl/cpp/interface_request.h"
+
+namespace fidl {
+class Builder;
+template <typename Interface>
+class InterfacePtr;
+template <typename Interface>
+class SynchronousInterfacePtr;
+
+// The client endpoint of a FIDL channel.
+//
+// The remote end of the channel expects this end of the channel to speak the
+// protocol associated with |Interface|. This type is the dual of
+// |InterfaceRequest|.
+//
+// Unlike an |InterfacePtr|, an |InterfaceHandle| does not have thread affinity
+// and can therefore be transferred to another thread or another process. To
+// create an |InterfacePtr| to send messages on this channel, call the |Bind()|
+// method, either on the |InterfaceHandle| or the |InterfacePtr| object.
+//
+// See also:
+//
+//  * |InterfaceRequest|, which is the server analog of an |InterfaceHandle|.
+template <typename Interface>
+class InterfaceHandle {
+ public:
+  // Creates an |InterfaceHandle| whose underlying channel is invalid.
+  InterfaceHandle() = default;
+
+  // Creates an |InterfaceHandle| that wraps the given |channel|.
+  explicit InterfaceHandle(zx::channel channel)
+      : channel_(std::move(channel)) {}
+
+  InterfaceHandle(const InterfaceHandle& other) = delete;
+  InterfaceHandle& operator=(const InterfaceHandle& other) = delete;
+
+  InterfaceHandle(InterfaceHandle&& other)
+      : channel_(std::move(other.channel_)) {}
+
+  InterfaceHandle& operator=(InterfaceHandle&& other) {
+    channel_ = std::move(other.channel_);
+    return *this;
+  }
+
+  // Implicit conversion from nullptr to an |InterfaceHandle| without a valid
+  // |channel|.
+  InterfaceHandle(std::nullptr_t) {}
+
+  // Implicit conversion from |InterfacePtr| unbinds the channel from the
+  // |InterfacePtr|.
+  //
+  // Making this constructor templated ensures that it is not type-instantiated
+  // unless it is used, making the InterfacePtr<->InterfaceHandle codependency
+  // less fragile.
+  template <typename InterfacePtr = InterfacePtr<Interface>>
+  InterfaceHandle(InterfacePtr&& ptr) {
+    *this = ptr.Unbind();
+  }
+
+  // Creates a new channel, retains one endpoint in this |InterfaceHandle| and
+  // returns the other as an |InterfaceRequest|.
+  //
+  // Typically, the returned |InterfaceRequest| is passed to another process,
+  // which will implement the server endpoint for the |Interface| protocol.
+  //
+  // If |NewRequest| fails to create the underlying channel, the returned
+  // |InterfaceRequest| will return false from |is_valid()|.
+  InterfaceRequest<Interface> NewRequest() {
+    zx::channel h1, h2;
+    if (zx::channel::create(0, &h1, &h2) != ZX_OK)
+      return nullptr;
+    channel_ = std::move(h1);
+    return InterfaceRequest<Interface>(std::move(h2));
+  }
+
+  // Creates an |InterfacePtr| bound to the channel in this |InterfaceHandle|.
+  //
+  // This function transfers ownership of the underlying channel to the
+  // returned |InterfacePtr|, which means the |is_valid()| method will return
+  // false after this method returns.
+  //
+  // Requires the current thread to have a default async_t (e.g., a message
+  // loop) in order to read messages from the channel and to monitor the
+  // channel for |ZX_CHANNEL_PEER_CLOSED|.
+  //
+  // Making this method templated ensures that it is not type-instantiated
+  // unless it is used, making the InterfacePtr<->InterfaceHandle codependency
+  // less fragile.
+  template <typename InterfacePtr = InterfacePtr<Interface>>
+  inline InterfacePtr Bind() {
+    InterfacePtr ptr;
+    ptr.Bind(std::move(channel_));
+    return ptr;
+  }
+
+  template <typename SyncInterfacePtr = SynchronousInterfacePtr<Interface>>
+  inline SyncInterfacePtr BindSync() {
+    SyncInterfacePtr ptr;
+    ptr.Bind(std::move(channel_));
+    return ptr;
+  }
+
+  // Whether the underlying channel is valid.
+  bool is_valid() const { return !!channel_; }
+  explicit operator bool() const { return is_valid(); }
+
+  // Transfers ownership of the underlying channel to the caller.
+  zx::channel TakeChannel() { return std::move(channel_); }
+
+  // The underlying channel.
+  const zx::channel& channel() const { return channel_; }
+  void set_channel(zx::channel channel) { channel_ = std::move(channel); }
+
+  void Encode(Encoder* encoder, size_t offset) {
+    encoder->EncodeHandle(&channel_, offset);
+  }
+
+  static void Decode(Decoder* decoder, InterfaceHandle<Interface>* value,
+                     size_t offset) {
+    decoder->DecodeHandle(&value->channel_, offset);
+  }
+
+ private:
+  zx::channel channel_;
+};
+
+// Equality.
+template <typename T>
+bool operator==(const InterfaceHandle<T>& lhs, const InterfaceHandle<T>& rhs) {
+  return lhs.channel() == rhs.channel();
+}
+template <typename T>
+bool operator!=(const InterfaceHandle<T>& lhs, const InterfaceHandle<T>& rhs) {
+  return !(lhs == rhs);
+}
+
+// Comparisons.
+template <typename T>
+bool operator<(const InterfaceHandle<T>& lhs, const InterfaceHandle<T>& rhs) {
+  return lhs.channel() < rhs.channel();
+}
+template <typename T>
+bool operator>(const InterfaceHandle<T>& lhs, const InterfaceHandle<T>& rhs) {
+  return lhs.channel() > rhs.channel();
+}
+template <typename T>
+bool operator<=(const InterfaceHandle<T>& lhs, const InterfaceHandle<T>& rhs) {
+  return !(lhs > rhs);
+}
+template <typename T>
+bool operator>=(const InterfaceHandle<T>& lhs, const InterfaceHandle<T>& rhs) {
+  return !(lhs < rhs);
+}
+
+template <typename T>
+struct CodingTraits<InterfaceHandle<T>>
+    : public EncodableCodingTraits<InterfaceHandle<T>, sizeof(zx_handle_t)> {};
+
+template <typename T>
+inline zx_status_t Clone(const InterfaceHandle<T>& value,
+                         InterfaceHandle<T>* result) {
+  if (!value) {
+    *result = InterfaceHandle<T>();
+    return ZX_OK;
+  }
+  return ZX_ERR_ACCESS_DENIED;
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERFACE_HANDLE_H_
diff --git a/pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_request.h b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_request.h
new file mode 100644
index 0000000..45af19c
--- /dev/null
+++ b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_request.h
@@ -0,0 +1,171 @@
+// 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 LIB_FIDL_CPP_INTERFACE_REQUEST_H_
+#define LIB_FIDL_CPP_INTERFACE_REQUEST_H_
+
+#include <lib/fit/function.h>
+#include <lib/zx/channel.h>
+
+#include <cstddef>
+#include <utility>
+
+#include "lib/fidl/cpp/clone.h"
+#include "lib/fidl/cpp/coding_traits.h"
+
+namespace fidl {
+class Builder;
+
+// The server endpoint of a FIDL channel.
+//
+// The remote end of the channel expects this end of the channel to speak the
+// protocol associated with |Interface|. This type is the dual of
+// |InterfaceHandle|.
+//
+// An |InterfaceRequest| does not have thread affinity and can therefore be
+// transferred to another thread or another process. To bind an implementation
+// of |Interface| to this |InterfaceRequest|, use a |Binding| object.
+//
+// Typically, |InterfaceRequest| objects are created by a prospective client of
+// |Interface|, which then sends the |InterfaceRequest| to another process to
+// request that the remote process implement the |Interface|. This pattern
+// enables *pipelined* operation, in which the client can start calling methods
+// on an associated |InterfacePtr| immediately, before the |InterfaceRequest|
+// has reached the remote process and been bound to an implementation. These
+// method calls are buffered by the underlying channel until they are read by
+// the remote process.
+//
+// Example:
+//
+//   #include "foo.fidl.h"
+//
+//   class FooImpl : public Foo {
+//    public:
+//     explicit FooImpl(InterfaceRequest<Foo> request)
+//         : binding_(this, std::move(request)) {}
+//
+//     // Foo implementation here.
+//
+//    private:
+//     Binding<Foo> binding_;
+//   };
+//
+// After the |InterfaceRequest| has been bound to an implementation, the
+// implementation will receive method calls from the remote endpoint of the
+// channel on the thread on which the |InterfaceRequest| was bound.
+//
+// See also:
+//
+//  * |InterfaceHandle|, which is the client analog of an |InterfaceRequest|.
+template <typename Interface>
+class InterfaceRequest {
+ public:
+  // Creates an |InterfaceHandle| whose underlying channel is invalid.
+  //
+  // Some protocols contain messages that permit such |InterfaceRequest|
+  // objects, which indicate that the client is not interested in the server
+  // providing an implementation of |Interface|.
+  InterfaceRequest() = default;
+
+  // Creates an |InterfaceHandle| that wraps the given |channel|.
+  explicit InterfaceRequest(zx::channel channel)
+      : channel_(std::move(channel)) {}
+
+  InterfaceRequest(const InterfaceRequest& other) = delete;
+  InterfaceRequest& operator=(const InterfaceRequest& other) = delete;
+
+  InterfaceRequest(InterfaceRequest&& other)
+      : channel_(std::move(other.channel_)) {}
+
+  InterfaceRequest& operator=(InterfaceRequest&& other) {
+    channel_ = std::move(other.channel_);
+    return *this;
+  }
+
+  // Implicit conversion from nullptr to an |InterfaceRequest| without an
+  // invalid |channel|.
+  InterfaceRequest(std::nullptr_t) {}
+
+  // Whether the underlying channel is valid.
+  bool is_valid() const { return !!channel_; }
+  explicit operator bool() const { return is_valid(); }
+
+  // Transfers ownership of the underlying channel to the caller.
+  zx::channel TakeChannel() { return std::move(channel_); }
+
+  // The underlying channel.
+  const zx::channel& channel() const { return channel_; }
+  void set_channel(zx::channel channel) { channel_ = std::move(channel); }
+
+  void Encode(Encoder* encoder, size_t offset) {
+    encoder->EncodeHandle(&channel_, offset);
+  }
+
+  static void Decode(Decoder* decoder, InterfaceRequest<Interface>* value,
+                     size_t offset) {
+    decoder->DecodeHandle(&value->channel_, offset);
+  }
+
+ private:
+  zx::channel channel_;
+};
+
+// A |InterfaceRequestHandler<Interface>| is simply a function that
+// handles an interface request for |Interface|. If it determines that the
+// request should be "accepted", then it should "connect" ("take ownership
+// of") request. Otherwise, it can simply drop |request| (as implied by the
+// interface).
+template <typename Interface>
+using InterfaceRequestHandler =
+    fit::function<void(fidl::InterfaceRequest<Interface> request)>;
+
+// Equality.
+template <typename T>
+bool operator==(const InterfaceRequest<T>& lhs,
+                const InterfaceRequest<T>& rhs) {
+  return lhs.channel() == rhs.channel();
+}
+template <typename T>
+bool operator!=(const InterfaceRequest<T>& lhs,
+                const InterfaceRequest<T>& rhs) {
+  return !(lhs == rhs);
+}
+
+// Comparaisons.
+template <typename T>
+bool operator<(const InterfaceRequest<T>& lhs, const InterfaceRequest<T>& rhs) {
+  return lhs.channel() < rhs.channel();
+}
+template <typename T>
+bool operator>(const InterfaceRequest<T>& lhs, const InterfaceRequest<T>& rhs) {
+  return lhs.channel() > rhs.channel();
+}
+template <typename T>
+bool operator<=(const InterfaceRequest<T>& lhs,
+                const InterfaceRequest<T>& rhs) {
+  return !(lhs > rhs);
+}
+template <typename T>
+bool operator>=(const InterfaceRequest<T>& lhs,
+                const InterfaceRequest<T>& rhs) {
+  return !(lhs < rhs);
+}
+
+template <typename T>
+struct CodingTraits<InterfaceRequest<T>>
+    : public EncodableCodingTraits<InterfaceRequest<T>, sizeof(zx_handle_t)> {};
+
+template <typename T>
+inline zx_status_t Clone(const InterfaceRequest<T>& value,
+                         InterfaceRequest<T>* result) {
+  if (!value) {
+    *result = InterfaceRequest<T>();
+    return ZX_OK;
+  }
+  return ZX_ERR_ACCESS_DENIED;
+}
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERFACE_REQUEST_H_
diff --git a/pkg/fidl_cpp_sync/include/lib/fidl/cpp/internal/synchronous_proxy.h b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/internal/synchronous_proxy.h
new file mode 100644
index 0000000..ee77c99
--- /dev/null
+++ b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/internal/synchronous_proxy.h
@@ -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.
+
+#ifndef LIB_FIDL_CPP_INTERNAL_SYNCHRONOUS_PROXY_H_
+#define LIB_FIDL_CPP_INTERNAL_SYNCHRONOUS_PROXY_H_
+
+#include <lib/fidl/cpp/message.h>
+#include <lib/zx/channel.h>
+#include <zircon/fidl.h>
+
+namespace fidl {
+namespace internal {
+
+// Manages the client state for a synchronous interface.
+//
+// A |SynchronousProxy| manages the client state for a sychronous interface.
+// This object validates messages before sending them to the remote endpoint,
+// and (optionally) blocks until it receives a reply.
+//
+// This object is thread-safe.
+class SynchronousProxy {
+ public:
+  // Creates a |SynchronousProxy| that wraps the given channel.
+  explicit SynchronousProxy(zx::channel channel);
+  ~SynchronousProxy();
+
+  // Returns the underlying channel from this object.
+  //
+  // The |SynchronousProxy| does not attempt to synchronize this operation with
+  // |Send| or |Call|.
+  zx::channel TakeChannel();
+
+  // Validates that |message| matches the given |type| and sends the message
+  // through the underlying channel.
+  //
+  // Does not block.
+  //
+  // Returns an error if validation or writing fails.
+  zx_status_t Send(const fidl_type_t* type, Message message);
+
+  // Validate that |request| matches the given |request_type| and sends
+  // |request| through the underlying channel. Blocks until it receives a
+  // response, which is then decoded according to |response_type| and returned
+  // in |response_type|.
+  //
+  // Blocks until the remote endpoint replied.
+  //
+  // Returns an error if validation, writing, reading, or decoding fails.
+  zx_status_t Call(const fidl_type_t* request_type,
+                   const fidl_type_t* response_type, Message request,
+                   Message* response);
+
+ private:
+  zx::channel channel_;
+};
+
+}  // namespace internal
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_INTERNAL_SYNCHRONOUS_PROXY_H_
diff --git a/pkg/fidl_cpp_sync/include/lib/fidl/cpp/synchronous_interface_ptr.h b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/synchronous_interface_ptr.h
new file mode 100644
index 0000000..7f9ff6c
--- /dev/null
+++ b/pkg/fidl_cpp_sync/include/lib/fidl/cpp/synchronous_interface_ptr.h
@@ -0,0 +1,185 @@
+// 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 LIB_FIDL_CPP_SYNCHRONOUS_INTERFACE_PTR_H_
+#define LIB_FIDL_CPP_SYNCHRONOUS_INTERFACE_PTR_H_
+
+#include <stddef.h>
+
+#include <memory>
+#include <utility>
+
+#include "lib/fidl/cpp/interface_handle.h"
+
+namespace fidl {
+
+// A synchronous client interface to a remote implementation of |Interface|.
+//
+// An |SynchronousInterfacePtr| implements |Interface| by proxying calls through
+// a |channel| to a remote implementation of |Interface|. Method calls on the
+// |Interface| proxy are encoded and sent through the bound channel to the
+// remote endpoint, which processes them. If the method has a reply (including
+// any empty reply), the client blocks and waits for the remote endpoint to
+// reply.
+//
+// You need to bind the |SynchronousInterfacePtr| before calling any |Interface|
+// methods. There are a number of ways to bind the |SynchronousInterfacePtr|.
+// See |NewRequest|, |Bind|, and the |BindSync| method on |InterfaceHandle|.
+//
+// This class is thread-compatible. Once bound, the |SynchronousInterfacePtr|
+// can be used from multiple threads simultaneously. However, the
+// |SynchronousInterfacePtr| does not attempt to synchronize mutating operatios,
+// such as |Bind| or |Unbind|.
+//
+// |SynchronousInterfacePtr| does not require a |async_t| implementation and
+// does not bind to the default |async_dispatcher_t*| for the current thread,
+// unlike |InterfacePtr|.
+//
+// See also:
+//
+//  * |Binding|, which is the server analog of an |SynchronousInterfacePtr|.
+//  * |InterfacePtr|, which is an asynchronous interface to a remote
+//    implementation.
+template <typename Interface>
+class SynchronousInterfacePtr {
+ public:
+  using InterfaceSync = typename Interface::Sync_;
+
+  // Creates an unbound |SynchronousInterfacePtr|.
+  SynchronousInterfacePtr() {}
+  SynchronousInterfacePtr(std::nullptr_t) {}
+
+  SynchronousInterfacePtr(const SynchronousInterfacePtr& other) = delete;
+  SynchronousInterfacePtr& operator=(const SynchronousInterfacePtr& other) =
+      delete;
+
+  SynchronousInterfacePtr(SynchronousInterfacePtr&& other) = default;
+  SynchronousInterfacePtr& operator=(SynchronousInterfacePtr&& other) = default;
+
+  // Bind the |SynchronousInterfacePtr| to one endpoint of a newly created
+  // channel and return the other endpoint as an |InterfaceRequest|.
+  //
+  // Typically, the returned |InterfaceRequest| will be sent to a remote process
+  // to be bound to an implementation of |Interface| using a |Binding| object.
+  //
+  // After calling this method, clients can start calling methods on this
+  // |SynchronousInterfacePtr|. However, methods that have replies will block
+  // until the remote implementation binds the |InterfaceRequest| and replies.
+  //
+  // # Example
+  //
+  // Given the following interface:
+  //
+  //   interface Database {
+  //     OpenTable(request<Table> table);
+  //   };
+  //
+  // The client can use the |NewRequest| method to create the |InterfaceRequest|
+  // object needed by the |OpenTable| method:
+  //
+  //   DatabasePtr database = ...;  // Connect to database.
+  //   TableSyncPtr table;
+  //   database->OpenTable(table.NewRequest());
+  //
+  // The client can call methods on |table| immediately. Messages that have
+  // replies will block until the Database implementation binds a Table
+  // implementation and replies.
+  InterfaceRequest<Interface> NewRequest() {
+    zx::channel h1;
+    zx::channel h2;
+    if (zx::channel::create(0, &h1, &h2) != ZX_OK)
+      return nullptr;
+    Bind(std::move(h1));
+    return InterfaceRequest<Interface>(std::move(h2));
+  }
+
+  // Binds the |SynchronousInterfacePtr| to the given |channel|.
+  //
+  // The |SynchronousInterfacePtr| expects the remote end of the |channel| to
+  // speak the protocol defined by |Interface|. Unlike the |Bind| overload that
+  // takes a |InterfaceHandle| parameter, this |Bind| overload lacks type
+  // safety.
+  //
+  // If the |SynchronousInterfacePtr| was prevously bound to another channel,
+  // that channel is closed. If the |channel| is invalid, then this method will
+  // effectively unbind the |SynchronousInterfacePtr|. A more direct way to have
+  // that effect is to call |Unbind|.
+  //
+  // Does not require the current thread to have a default async_t.
+  void Bind(zx::channel channel) {
+    if (!channel) {
+      proxy_.reset();
+      return;
+    }
+    proxy_.reset(new typename InterfaceSync::Proxy_(std::move(channel)));
+  }
+
+  // Binds the |SynchronousInterfacePtr| to the given |InterfaceHandle|.
+  //
+  // The |SynchronousInterfacePtr| expects the remote end of the |channel| to
+  // speak the protocol defined by |Interface|. Unlike the |Bind| overload that
+  // takes a |channel| parameter, this |Bind| overload provides type safety.
+  //
+  // If the |SynchronousInterfacePtr| was prevously bound to another channel,
+  // that channel is closed. If the |InterfaceHandle| is invalid, then this
+  // method will effectively unbind the |SynchronousInterfacePtr|. A more direct
+  // way to have that effect is to call |Unbind|.
+  //
+  // Does not require the current thread to have a default async_t.
+  void Bind(InterfaceHandle<Interface> handle) {
+    return Bind(handle.TakeChannel());
+  }
+
+  // Unbinds the underlying channel from the |SynchronousInterfacePtr|.
+  //
+  // The underlying channel is returned as an |InterfaceHandle|, which is safe
+  // to transport to another thread or process.
+  //
+  // After this method returns, a subsequent call to |Bind| is required before
+  // calling any additional |Interface| methods.
+  InterfaceHandle<Interface> Unbind() {
+    InterfaceHandle<Interface> handle(proxy_->proxy().TakeChannel());
+    proxy_.reset();
+    return handle;
+  }
+
+  // Whether this |SynchronousInterfacePtr| is currently bound to a channel.
+  //
+  // If the |SynchronousInterfacePtr| is bound to a channel, calls to
+  // |Interface| methods are proxied to the remote endpoint of the channel.
+  //
+  // See also:
+  //
+  //  * |Bind|, which binds a channel to this |SynchronousInterfacePtr|.
+  //  * |Unbind|, which unbinds a channel from this |SynchronousInterfacePtr|.
+  bool is_bound() const { return static_cast<bool>(proxy_); }
+
+  // Whether this |SynchronousInterfacePtr| is currently bound to a channel.
+  //
+  // See |is_bound| for details.
+  explicit operator bool() const { return is_bound(); }
+
+  // The |Interface| proxy associated with this |SynchronousInterfacePtr|.
+  //
+  // When this |SynchronousInterfacePtr| is bound, method calls on this
+  // |Interface| will be proxied to the remote endpoint of the connection.
+  // Methods that expect replies will block until the
+  // |SynchronousInterfacePtr| either receives a reply to that transaction.
+  //
+  // When this |SynchronousInterfacePtr| is not bound, this method returns
+  // nullptr.
+  //
+  // The returned |Interface| is thread-compatible and can be used from any
+  // thread.
+  InterfaceSync* get() const { return proxy_.get(); }
+  InterfaceSync* operator->() const { return get(); }
+  InterfaceSync& operator*() const { return *get(); }
+
+ private:
+  std::unique_ptr<typename InterfaceSync::Proxy_> proxy_;
+};
+
+}  // namespace fidl
+
+#endif  // LIB_FIDL_CPP_SYNCHRONOUS_INTERFACE_PTR_H_
diff --git a/pkg/fidl_cpp_sync/internal/synchronous_proxy.cc b/pkg/fidl_cpp_sync/internal/synchronous_proxy.cc
new file mode 100644
index 0000000..0e42e56
--- /dev/null
+++ b/pkg/fidl_cpp_sync/internal/synchronous_proxy.cc
@@ -0,0 +1,53 @@
+// 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.
+
+#include "lib/fidl/cpp/internal/synchronous_proxy.h"
+
+#include <memory>
+#include <utility>
+
+#include "lib/fidl/cpp/internal/logging.h"
+
+namespace fidl {
+namespace internal {
+
+SynchronousProxy::SynchronousProxy(zx::channel channel)
+    : channel_(std::move(channel)) {}
+
+SynchronousProxy::~SynchronousProxy() = default;
+
+zx::channel SynchronousProxy::TakeChannel() { return std::move(channel_); }
+
+zx_status_t SynchronousProxy::Send(const fidl_type_t* type, Message message) {
+  const char* error_msg = nullptr;
+  zx_status_t status = message.Validate(type, &error_msg);
+  if (status != ZX_OK) {
+    FIDL_REPORT_ENCODING_ERROR(message, type, error_msg);
+    return status;
+  }
+  return message.Write(channel_.get(), 0);
+}
+
+zx_status_t SynchronousProxy::Call(const fidl_type_t* request_type,
+                                   const fidl_type_t* response_type,
+                                   Message request, Message* response) {
+  const char* error_msg = nullptr;
+  zx_status_t status = request.Validate(request_type, &error_msg);
+  if (status != ZX_OK) {
+    FIDL_REPORT_ENCODING_ERROR(request, request_type, error_msg);
+    return status;
+  }
+  status = request.Call(channel_.get(), 0, ZX_TIME_INFINITE, response);
+  if (status != ZX_OK)
+    return status;
+  status = response->Decode(response_type, &error_msg);
+  if (status != ZX_OK) {
+    FIDL_REPORT_DECODING_ERROR(*response, response_type, error_msg);
+    return status;
+  }
+  return ZX_OK;
+}
+
+}  // namespace internal
+}  // namespace fidl
diff --git a/pkg/fidl_cpp_sync/meta.json b/pkg/fidl_cpp_sync/meta.json
new file mode 100644
index 0000000..c74ae9d
--- /dev/null
+++ b/pkg/fidl_cpp_sync/meta.json
@@ -0,0 +1,23 @@
+{
+  "deps": [
+    "fidl_cpp_base", 
+    "fidl", 
+    "fidl-async", 
+    "fit", 
+    "zx"
+  ], 
+  "fidl_deps": [], 
+  "headers": [
+    "pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_handle.h", 
+    "pkg/fidl_cpp_sync/include/lib/fidl/cpp/interface_request.h", 
+    "pkg/fidl_cpp_sync/include/lib/fidl/cpp/internal/synchronous_proxy.h", 
+    "pkg/fidl_cpp_sync/include/lib/fidl/cpp/synchronous_interface_ptr.h"
+  ], 
+  "include_dir": "pkg/fidl_cpp_sync/include", 
+  "name": "fidl_cpp_sync", 
+  "root": "pkg/fidl_cpp_sync", 
+  "sources": [
+    "pkg/fidl_cpp_sync/internal/synchronous_proxy.cc"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/fit/include/lib/fit/bridge.h b/pkg/fit/include/lib/fit/bridge.h
new file mode 100644
index 0000000..3fed908
--- /dev/null
+++ b/pkg/fit/include/lib/fit/bridge.h
@@ -0,0 +1,488 @@
+// 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 LIB_FIT_BRIDGE_H_
+#define LIB_FIT_BRIDGE_H_
+
+#include "bridge_internal.h"
+
+namespace fit {
+
+// A bridge is a building block for asynchronous control flow that is formed
+// by the association of two distinct participants: a completer and a consumer.
+//
+// - The completer is responsible for reporting completion of an asynchronous
+//   task and providing its result.  See |completer()| and |fit::completer|.
+// - The consumer is responsible for consuming the result of the asynchronous
+//   task.  See |consumer()| and |fit::consumer|.
+//
+// This class is often used for binding a |fit::promise| to a callback,
+// facilitating interoperation of promises with functions that asynchronously
+// report their result via a callback function.  It can also be used more
+// generally anytime it is necessary to decouple completion of an asynchronous
+// task from consumption of its result (possibly on different threads).
+//
+// The completer and consumer each possesses a unique capability that can
+// be exercised at most once during their association: the asynchronous
+// task represented by a bridge can be completed at most once and its
+// result can be consumed at most once.  This property is enforced by
+// a single-ownership model for completers and consumers.
+//
+// The completion capability has a single owner represented by |fit::completer|.
+// Its owner may exercise the capability to complete the task (provide its result),
+// it may transfer the capability by moving it to another completer instance,
+// or it may cause the asynchronous task to be "abandoned" by discarding the
+// capability, implying that the task can never produce a result.  When this
+// occurs, the associated consumer's |fit::consumer::was_abandoned()| method
+// will return true and the consumer will not obtain any result from the task.
+// See |fit::consumer::promise()| and |fit::consumer::promise_or()| for
+// details on how abandonment of the task can be handled by the consumer.
+//
+// The consumption capability has a single owner represented by |fit::consumer|.
+// Its owner may exercise the capability to consume the task's result (as a
+/// promise), it may transfer the capability by moving it to another consumer
+// instance, or it may cause the asynchronous task to be "canceled" by
+// discarding the capability, implying that the task's result can never be
+// consumed.  When this occurs, the associated completer's
+// |fit::completer::was_canceled()| method will return true and the task's
+// eventual result (if any) will be silently discarded.
+//
+// DECOUPLING
+//
+// See |fit::schedule_for_consumer()| for a helper which uses a bridge to
+// decouple completion and consumption of a task's result so they can be
+// performed on different executors.
+//
+// SYNOPSIS
+//
+// |V| is the type of value produced when the task completes successfully.
+// Use |std::tuple<Args...>| if the task produces multiple values, such as
+// when you intend to bind the task's completer to a callback with multiple
+// arguments using |fit::completer::bind_tuple()|.
+// Defaults to |void|.
+//
+// |E| is the type of error produced when the task completes with an error.
+// Defaults to |void|.
+//
+// EXAMPLE
+//
+// Imagine a File I/O library offers a callback-based asynchronous reading
+// function.  We suppose that the read handling code will invoke the
+// callback upon completion.  The library's API might look a bit like this:
+//
+//     using read_callback = fit::function<void(size_t bytes_read)>;
+//     void read_async(size_t num_bytes, uint8_t* buffer, read_callback cb);
+//
+// Here's how we can adapt the library's "read_async" function to a
+// |fit::promise| by binding its callback to a bridge:
+//
+//     fit::promise<size_t> promise_read(uint8_t* buffer, size_t num_bytes) {
+//         fit::bridge<size_t> bridge;
+//         read_async(num_bytes, buffer, bridge.completer().bind());
+//         return bridge.consumer().promise_or(::fit::error());
+//     }
+//
+// Finally we can chain additional asynchronous tasks to be performed upon
+// completion of the promised read:
+//
+//     uint8_t buffer[4096];
+//     void my_program(fit::executor* executor) {
+//         auto promise = promise_read(buffer, sizeof(buffer))
+//             .and_then([] (size_t bytes_read) {
+//                 // consume contents of buffer
+//             })
+//             .or_else() {
+//                 // handle error case
+//             });
+//         executor->schedule_task(std::move(promise));
+//     }
+//
+// Similarly, suppose the File I/O library offers a callback-based asynchronous
+// writing function that can return a variety of errors encoded as negative
+// sizes.  Here's how we might decode those errors uniformly into |fit::result|
+// allowing them to be handled using combinators such as |or_else|.
+//
+//     using write_callback = fit::function<void(size_t bytes_written, int error)>;
+//     void write_async(size_t num_bytes, uint8_t* buffer, write_callback cb);
+//
+//     fit::promise<size_t, int> promise_write(uint8_t* buffer, size_t num_bytes) {
+//         fit::bridge<size_t, int> bridge;
+//         write_async(num_bytes, buffer,
+//             [completer = std::move(bridge.completer())](size_t bytes_written, int error) {
+//             if (bytes_written == 0) {
+//                 completer.complete_error(error);
+//                 return;
+//             }
+//             completer.complete_ok(bytes_written);
+//         });
+//         return bridge.consumer().promise_or(::fit::error(ERR_ABANDONED));
+//     }
+//
+//     uint8_t buffer[4096];
+//     void my_program(fit::executor* executor) {
+//         auto promise = promise_write(buffer, sizeof(buffer))
+//             .and_then([] (size_t bytes_written) {
+//                 // consume contents of buffer
+//             })
+//             .or_else(int error) {
+//                 // handle error case
+//             });
+//         executor->schedule_task(std::move(promise));
+//     }
+//
+// See documentation of |fit::promise| for more information.
+template <typename V, typename E>
+class bridge final {
+    using bridge_state = ::fit::internal::bridge_state<V, E>;
+
+public:
+    using value_type = V;
+    using error_type = E;
+    using result_type = result<value_type, error_type>;
+    using completer_type = ::fit::completer<V, E>;
+    using consumer_type = ::fit::consumer<V, E>;
+
+    // Creates a bridge representing a new asynchronous task formed by the
+    // association of a completer and consumer.
+    bridge() {
+        bridge_state::create(&completer_.completion_ref_,
+                             &consumer_.consumption_ref_);
+    }
+    bridge(bridge&& other) = default;
+    ~bridge() = default;
+
+    bridge& operator=(bridge&& other) = default;
+
+    // Gets a reference to the bridge's completer capability.
+    // The completer can be moved out of the bridge, if desired.
+    completer_type& completer() { return completer_; }
+    const completer_type& completer() const { return completer_; }
+
+    // Gets a reference to the bridge's consumer capability.
+    // The consumer can be moved out of the bridge, if desired.
+    consumer_type& consumer() { return consumer_; }
+    const consumer_type& consumer() const { return consumer_; }
+
+    bridge(const bridge& other) = delete;
+    bridge& operator=(const bridge& other) = delete;
+
+private:
+    completer_type completer_;
+    consumer_type consumer_;
+};
+
+// Provides a result upon completion of an asynchronous task.
+//
+// Instances of this class have single-ownership of a unique capability for
+// completing the task.  This capability can be exercised at most once.
+// Ownership of the capability is implicitly transferred away when the
+// completer is abandoned, completed, or bound to a callback.
+//
+// See also |fit::bridge|.
+// See documentation of |fit::promise| for more information.
+//
+// SYNOPSIS
+//
+// |V| is the type of value produced when the task completes successfully.
+// Use |std::tuple<Args...>| if the task produces multiple values, such as
+// when you intend to bind the task's completer to a callback with multiple
+// arguments using |fit::completer::bind_tuple()|.
+// Defaults to |void|.
+//
+// |E| is the type of error produced when the task completes with an error.
+// Defaults to |void|.
+template <typename V, typename E>
+class completer final {
+    using bridge_state = ::fit::internal::bridge_state<V, E>;
+    using completion_ref = typename bridge_state::completion_ref;
+
+public:
+    using value_type = V;
+    using error_type = E;
+    using result_type = ::fit::result<V, E>;
+
+    completer() = default;
+    completer(completer&& other) = default;
+    ~completer() = default;
+
+    completer& operator=(completer&& other) = default;
+
+    // Returns true if this instance currently owns the unique capability for
+    // reporting completion of the task.
+    explicit operator bool() const { return !!completion_ref_; }
+
+    // Returns true if the associated |consumer| has canceled the task.
+    // This method returns a snapshot of the current cancelation state.
+    // Note that the task may be canceled concurrently at any time.
+    bool was_canceled() const {
+        assert(completion_ref_);
+        return completion_ref_.get()->was_canceled();
+    }
+
+    // Explicitly abandons the task, meaning that it will never be completed.
+    // See |fit::bridge| for details about abandonment.
+    void abandon() {
+        assert(completion_ref_);
+        completion_ref_ = completion_ref();
+    }
+
+    // Reports that the task has completed successfully.
+    // This method takes no arguments if |value_type| is void, otherwise it
+    // takes one argument which must be assignable to |value_type|.
+    template <typename VV = value_type,
+              typename = std::enable_if_t<std::is_void<VV>::value>>
+    void complete_ok() {
+        assert(completion_ref_);
+        bridge_state* state = completion_ref_.get();
+        state->complete_or_abandon(std::move(completion_ref_),
+                                   ::fit::ok());
+    }
+    template <typename VV = value_type,
+              typename = std::enable_if_t<!std::is_void<VV>::value>>
+    void complete_ok(VV value) {
+        assert(completion_ref_);
+        bridge_state* state = completion_ref_.get();
+        state->complete_or_abandon(std::move(completion_ref_),
+                                   ::fit::ok<value_type>(std::forward<VV>(value)));
+    }
+
+    // Reports that the task has completed with an error.
+    // This method takes no arguments if |error_type| is void, otherwise it
+    // takes one argument which must be assignable to |error_type|.
+    template <typename EE = error_type,
+              typename = std::enable_if_t<std::is_void<EE>::value>>
+    void complete_error() {
+        assert(completion_ref_);
+        bridge_state* state = completion_ref_.get();
+        state->complete_or_abandon(std::move(completion_ref_),
+                                   ::fit::error());
+    }
+    template <typename EE = error_type,
+              typename = std::enable_if_t<!std::is_void<EE>::value>>
+    void complete_error(EE error) {
+        assert(completion_ref_);
+        bridge_state* state = completion_ref_.get();
+        state->complete_or_abandon(std::move(completion_ref_),
+                                   ::fit::error<error_type>(std::forward<EE>(error)));
+    }
+
+    // Reports that the task has completed or been abandoned.
+    // See |fit::bridge| for details about abandonment.
+    //
+    // The result state determines the task's final disposition.
+    // - |fit::result_state::ok|: The task completed successfully.
+    // - |fit::result_state::error|: The task completed with an error.
+    // - |fit::result_state::pending|: The task was abandoned.
+    void complete_or_abandon(result_type result) {
+        assert(completion_ref_);
+        bridge_state* state = completion_ref_.get();
+        state->complete_or_abandon(std::move(completion_ref_),
+                                   std::move(result));
+    }
+
+    // Returns a callback that reports completion of the asynchronous task along
+    // with its result when invoked.  This method is typically used to bind
+    // completion of a task to a callback that has zero or one argument.
+    //
+    // If |value_type| is void, the returned callback's signature is: void(void)
+    // Otherwise, the returned callback's signature is: void(value_type).
+    //
+    // The returned callback is thread-safe and move-only.
+    ::fit::internal::bridge_bind_callback<V, E> bind() {
+        assert(completion_ref_);
+        return ::fit::internal::bridge_bind_callback<V, E>(
+            std::move(completion_ref_));
+    }
+
+    // A variant of |bind()| that can be used to bind a completion of a task
+    // to a callback that has zero or more arguments by wrapping the callback's
+    // arguments into a tuple when producing the task's result.
+    //
+    // The |value_type| must be a tuple type.
+    // Given a |value_type| of std::tuple<Args...>, the returned callback's
+    // signature is: void(Args...).  Note that the tuple's fields are
+    // unpacked as individual arguments of the callback.
+    //
+    // The returned callback is thread-safe and move-only.
+    ::fit::internal::bridge_bind_tuple_callback<V, E> bind_tuple() {
+        assert(completion_ref_);
+        return ::fit::internal::bridge_bind_tuple_callback<V, E>(
+            std::move(completion_ref_));
+    }
+
+    completer(const completer& other) = delete;
+    completer& operator=(const completer& other) = delete;
+
+private:
+    friend class bridge<V, E>;
+
+    completion_ref completion_ref_;
+};
+
+// Consumes the result of an asynchronous task.
+//
+// Instances of this class have single-ownership of a unique capability for
+// consuming the task's result.  This capability can be exercised at most once.
+// Ownership of the capability is implicitly transferred away when the
+// task is canceled or converted to a promise.
+//
+// See also |fit::bridge|.
+// See documentation of |fit::promise| for more information.
+//
+// SYNOPSIS
+//
+// |V| is the type of value produced when the task completes successfully.
+// Use |std::tuple<Args...>| if the task produces multiple values, such as
+// when you intend to bind the task's completer to a callback with multiple
+// arguments using |fit::completer::bind_tuple()|.
+// Defaults to |void|.
+//
+// |E| is the type of error produced when the task completes with an error.
+// Defaults to |void|.
+template <typename V, typename E>
+class consumer final {
+    using bridge_state = ::fit::internal::bridge_state<V, E>;
+    using consumption_ref = typename bridge_state::consumption_ref;
+
+public:
+    using value_type = V;
+    using error_type = E;
+    using result_type = ::fit::result<V, E>;
+
+    consumer() = default;
+    consumer(consumer&& other) = default;
+    ~consumer() = default;
+
+    consumer& operator=(consumer&& other) = default;
+
+    // Returns true if this instance currently owns the unique capability for
+    // consuming the result of the task upon its completion.
+    explicit operator bool() const { return !!consumption_ref_; }
+
+    // Explicitly cancels the task, meaning that its result will never be consumed.
+    // See |fit::bridge| for details about cancelation.
+    void cancel() {
+        assert(consumption_ref_);
+        consumption_ref_ = consumption_ref();
+    }
+
+    // Returns true if the associated |completer| has abandoned the task.
+    // This method returns a snapshot of the current abandonment state.
+    // Note that the task may be abandoned concurrently at any time.
+    bool was_abandoned() const {
+        assert(consumption_ref_);
+        return consumption_ref_.get()->was_abandoned();
+    }
+
+    // Returns an unboxed promise which resumes execution once this task has
+    // completed.  If the task is abandoned by its completer, the promise
+    // will not produce a result, thereby causing subsequent tasks associated
+    // with the promise to also be abandoned and eventually destroyed if
+    // they cannot make progress without the promised result.
+    promise_impl<typename bridge_state::promise_continuation>
+    promise() {
+        assert(consumption_ref_);
+        return make_promise_with_continuation(
+            typename bridge_state::promise_continuation(
+                std::move(consumption_ref_)));
+    }
+
+    // A variant of |promise()| that allows a default result to be provided when
+    // the task is abandoned by its completer.  Typically this is used to cause
+    // the promise to return an error when the task is abandoned instead of
+    // causing subsequent tasks associated with the promise to also be abandoned.
+    //
+    // The state of |result_if_abandoned| determines the promise's behavior
+    // in case of abandonment.
+    //
+    // - |fit::result_state::ok|: Reports a successful result.
+    // - |fit::result_state::error|: Reports a failure result.
+    // - |fit::result_state::pending|: Does not report a result, thereby
+    //   causing subsequent tasks associated with the promise to also be
+    //   abandoned and eventually destroyed if they cannot make progress
+    //   without the promised result.
+    promise_impl<typename bridge_state::promise_continuation>
+    promise_or(result_type result_if_abandoned) {
+        assert(consumption_ref_);
+        return make_promise_with_continuation(
+            typename bridge_state::promise_continuation(
+                std::move(consumption_ref_), std::move(result_if_abandoned)));
+    }
+
+    consumer(const consumer& other) = delete;
+    consumer& operator=(const consumer& other) = delete;
+
+private:
+    friend class bridge<V, E>;
+
+    consumption_ref consumption_ref_;
+};
+
+// Schedules |promise| to run on |executor| and returns a |consumer| which
+// receives the result of the promise upon its completion.
+//
+// This method has the effect of decoupling the evaluation of a promise from
+// the consumption of its result such that they can be performed on different
+// executors (possibly on different threads).
+//
+// |executor| must be non-null.
+// |promise| must be non-empty.
+//
+// EXAMPLE
+//
+// This example shows an object that encapsulates its own executor which it
+// manages independently from that of its clients.  This enables the object
+// to obtain certain assurances such as a guarantee of single-threaded
+// execution for its internal operations even if its clients happen to be
+// multi-threaded (or vice-versa as desired).
+//
+//     // This model has specialized internal threading requirements so it
+//     // manages its own executor.
+//     class model {
+//     public:
+//         fit::consumer<int> perform_calculation(int parameter) {
+//             return fit::schedule_for_consumer(&executor_,
+//                 fit::make_promise([parameter] {
+//                     // In reality, this would likely be a much more
+//                     // complex expression.
+//                     return fit::ok(parameter * parameter);
+//                 });
+//         }
+//
+//     private:
+//         // The model is responsible for initializing and running its own
+//         // executor (perhaps on its own thread).
+//         fit::single_threaded_executor executor_;
+//     };
+//
+//     // Asks the model to perform a calculation, awaits a result on the
+//     // provided executor (which is different from the one internally used
+//     // by the model), then prints the result.
+//     void print_output(fit::executor* executor, model* m) {
+//         executor->schedule_task(
+//             m->perform_calculation(16)
+//                 .promise_or(fit::error())
+//                 .and_then([] (int result) { printf("done: %d\n", result); })
+//                 .or_else([] { puts("failed or abandoned"); }));
+//     }
+//
+template <typename Promise>
+inline consumer<typename Promise::value_type, typename Promise::error_type>
+schedule_for_consumer(fit::executor* executor, Promise promise) {
+    assert(executor);
+    assert(promise);
+    fit::bridge<typename Promise::value_type,
+                typename Promise::error_type>
+        bridge;
+    executor->schedule_task(
+        promise.then([completer = std::move(bridge.completer())](
+                         typename Promise::result_type& result) mutable {
+            completer.complete_or_abandon(std::move(result));
+        }));
+    return std::move(bridge.consumer());
+}
+
+} // namespace fit
+
+#endif // LIB_FIT_BRIDGE_H_
diff --git a/pkg/fit/include/lib/fit/bridge_internal.h b/pkg/fit/include/lib/fit/bridge_internal.h
new file mode 100644
index 0000000..8f805ee
--- /dev/null
+++ b/pkg/fit/include/lib/fit/bridge_internal.h
@@ -0,0 +1,401 @@
+// 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 LIB_FIT_BRIDGE_INTERNAL_H_
+#define LIB_FIT_BRIDGE_INTERNAL_H_
+
+#include <atomic>
+#include <mutex>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "promise.h"
+#include "result.h"
+#include "thread_safety.h"
+
+namespace fit {
+namespace internal {
+
+// State shared between one completer and one consumer.
+// This object is somewhat unusual in that it has dual-ownership represented
+// by a pair of single-ownership references: a |completion_ref| and a
+// |consumption_ref|.
+//
+// The bridge's state evolves as follows:
+// - Initially the bridge's disposition is "pending".
+// - When the completer produces a result, the bridge's disposition
+//   becomes "completed".
+// - When the completer drops its ref without producing a result,
+//   the bridge's disposition becomes "abandoned".
+// - When the consumer drops its ref without consuming the result,
+//   the bridge's disposition becomes "canceled".
+// - When a full rendezvous between completer and consumer takes place,
+//   the bridge's disposition becomes "returned".
+// - When both refs are dropped, the bridge state is destroyed.
+template <typename V, typename E>
+class bridge_state final {
+public:
+    class completion_ref;
+    class consumption_ref;
+    class promise_continuation;
+
+    using result_type = result<V, E>;
+
+    ~bridge_state() = default;
+
+    static void create(completion_ref* out_completion_ref,
+                       consumption_ref* out_consumption_ref);
+
+    bool was_canceled() const;
+    bool was_abandoned() const;
+    void complete_or_abandon(completion_ref ref, result_type result);
+
+    bridge_state(const bridge_state&) = delete;
+    bridge_state(bridge_state&&) = delete;
+    bridge_state& operator=(const bridge_state&) = delete;
+    bridge_state& operator=(bridge_state&&) = delete;
+
+private:
+    enum class disposition {
+        pending,
+        abandoned,
+        completed,
+        canceled,
+        returned
+    };
+
+    bridge_state() = default;
+
+    void drop_completion_ref(bool was_completed);
+    void drop_consumption_ref(bool was_consumed);
+    void drop_ref_and_maybe_delete_self();
+    void set_result_if_abandoned(result_type result_if_abandoned);
+    result_type await_result(consumption_ref* ref, ::fit::context& context);
+    void deliver_result() FIT_REQUIRES(mutex_);
+
+    mutable std::mutex mutex_;
+
+    // Ref-count for completion and consumption.
+    // There can only be one of each ref type so the initial count is 2.
+    std::atomic<uint32_t> ref_count_{2};
+
+    // The disposition of the bridge.
+    disposition disposition_ FIT_GUARDED(mutex_) = {disposition::pending};
+
+    // The suspended task.
+    // Invariant: Only valid when disposition is |pending|.
+    suspended_task task_ FIT_GUARDED(mutex_);
+
+    // The result in flight.
+    // Invariant: Only valid when disposition is |pending|, |completed|,
+    // or |abandoned|.
+    result_type result_ FIT_GUARDED(mutex_);
+};
+
+// The unique capability held by a bridge's completer.
+template <typename V, typename E>
+class bridge_state<V, E>::completion_ref final {
+public:
+    completion_ref()
+        : state_(nullptr) {}
+
+    explicit completion_ref(bridge_state* state)
+        : state_(state) {} // adopts existing reference
+
+    completion_ref(completion_ref&& other)
+        : state_(other.state_) {
+        other.state_ = nullptr;
+    }
+
+    ~completion_ref() {
+        if (state_)
+            state_->drop_completion_ref(false /*was_completed*/);
+    }
+
+    completion_ref& operator=(completion_ref&& other) {
+        if (&other == this)
+            return *this;
+        if (state_)
+            state_->drop_completion_ref(false /*was_completed*/);
+        state_ = other.state_;
+        other.state_ = nullptr;
+        return *this;
+    }
+
+    explicit operator bool() const { return !!state_; }
+
+    bridge_state* get() const { return state_; }
+
+    void drop_after_completion() {
+        state_->drop_completion_ref(true /*was_completed*/);
+        state_ = nullptr;
+    }
+
+    completion_ref(const completion_ref& other) = delete;
+    completion_ref& operator=(const completion_ref& other) = delete;
+
+private:
+    bridge_state* state_;
+};
+
+// The unique capability held by a bridge's consumer.
+template <typename V, typename E>
+class bridge_state<V, E>::consumption_ref final {
+public:
+    consumption_ref()
+        : state_(nullptr) {}
+
+    explicit consumption_ref(bridge_state* state)
+        : state_(state) {} // adopts existing reference
+
+    consumption_ref(consumption_ref&& other)
+        : state_(other.state_) {
+        other.state_ = nullptr;
+    }
+
+    ~consumption_ref() {
+        if (state_)
+            state_->drop_consumption_ref(false /*was_consumed*/);
+    }
+
+    consumption_ref& operator=(consumption_ref&& other) {
+        if (&other == this)
+            return *this;
+        if (state_)
+            state_->drop_consumption_ref(false /*was_consumed*/);
+        state_ = other.state_;
+        other.state_ = nullptr;
+        return *this;
+    }
+
+    explicit operator bool() const { return !!state_; }
+
+    bridge_state* get() const { return state_; }
+
+    void drop_after_consumption() {
+        state_->drop_consumption_ref(true /*was_consumed*/);
+        state_ = nullptr;
+    }
+
+    consumption_ref(const consumption_ref& other) = delete;
+    consumption_ref& operator=(const consumption_ref& other) = delete;
+
+private:
+    bridge_state* state_;
+};
+
+// The continuation produced by |consumer::promise()| and company.
+template <typename V, typename E>
+class bridge_state<V, E>::promise_continuation final {
+public:
+    explicit promise_continuation(consumption_ref ref)
+        : ref_(std::move(ref)) {}
+
+    promise_continuation(consumption_ref ref,
+                         result_type result_if_abandoned)
+        : ref_(std::move(ref)) {
+        ref_.get()->set_result_if_abandoned(std::move(result_if_abandoned));
+    }
+
+    result_type operator()(::fit::context& context) {
+        return ref_.get()->await_result(&ref_, context);
+    }
+
+private:
+    consumption_ref ref_;
+};
+
+// The callback produced by |completer::bind()|.
+template <typename V, typename E>
+class bridge_bind_callback final {
+    using bridge_state = bridge_state<V, E>;
+
+public:
+    explicit bridge_bind_callback(typename bridge_state::completion_ref ref)
+        : ref_(std::move(ref)) {}
+
+    template <typename VV = V,
+              typename = std::enable_if_t<std::is_void<VV>::value>>
+    void operator()() {
+        bridge_state* state = ref_.get();
+        state->complete_or_abandon(std::move(ref_), ::fit::ok());
+    }
+
+    template <typename VV = V,
+              typename = std::enable_if_t<!std::is_void<VV>::value>>
+    void operator()(VV value) {
+        bridge_state* state = ref_.get();
+        state->complete_or_abandon(std::move(ref_),
+                                   ::fit::ok<V>(std::forward<VV>(value)));
+    }
+
+private:
+    typename bridge_state::completion_ref ref_;
+};
+
+// The callback produced by |completer::bind_tuple()|.
+template <typename V, typename E>
+class bridge_bind_tuple_callback;
+template <typename... Args, typename E>
+class bridge_bind_tuple_callback<std::tuple<Args...>, E> final {
+    using bridge_state = bridge_state<std::tuple<Args...>, E>;
+
+public:
+    explicit bridge_bind_tuple_callback(typename bridge_state::completion_ref ref)
+        : ref_(std::move(ref)) {}
+
+    void operator()(Args... args) {
+        bridge_state* state = ref_.get();
+        state->complete_or_abandon(
+            std::move(ref_),
+            ::fit::ok(std::make_tuple<Args...>(std::forward<Args>(args)...)));
+    }
+
+private:
+    typename bridge_state::completion_ref ref_;
+};
+
+template <typename V, typename E>
+void bridge_state<V, E>::create(completion_ref* out_completion_ref,
+                                consumption_ref* out_consumption_ref) {
+    bridge_state* state = new bridge_state();
+    *out_completion_ref = completion_ref(state);
+    *out_consumption_ref = consumption_ref(state);
+}
+
+template <typename V, typename E>
+bool bridge_state<V, E>::was_canceled() const {
+    std::lock_guard<std::mutex> lock(mutex_);
+    return disposition_ == disposition::canceled;
+}
+
+template <typename V, typename E>
+bool bridge_state<V, E>::was_abandoned() const {
+    std::lock_guard<std::mutex> lock(mutex_);
+    return disposition_ == disposition::abandoned;
+}
+
+template <typename V, typename E>
+void bridge_state<V, E>::drop_completion_ref(bool was_completed) {
+    if (!was_completed) {
+        // The task was abandoned.
+        std::lock_guard<std::mutex> lock(mutex_);
+        assert(disposition_ == disposition::pending ||
+               disposition_ == disposition::canceled);
+        if (disposition_ == disposition::pending) {
+            disposition_ = disposition::abandoned;
+            deliver_result();
+        }
+    }
+    drop_ref_and_maybe_delete_self();
+}
+
+template <typename V, typename E>
+void bridge_state<V, E>::drop_consumption_ref(bool was_consumed) {
+    if (!was_consumed) {
+        // The task was canceled.
+        std::lock_guard<std::mutex> lock(mutex_);
+        assert(disposition_ == disposition::pending ||
+               disposition_ == disposition::completed ||
+               disposition_ == disposition::abandoned);
+        if (disposition_ == disposition::pending) {
+            disposition_ = disposition::canceled;
+            result_ = ::fit::pending();
+            task_.reset(); // there is no task to wake up anymore
+        }
+    }
+    drop_ref_and_maybe_delete_self();
+}
+
+template <typename V, typename E>
+void bridge_state<V, E>::drop_ref_and_maybe_delete_self() {
+    uint32_t count = ref_count_.fetch_sub(1u, std::memory_order_release) - 1u;
+    assert(count >= 0);
+    if (count == 0) {
+        std::atomic_thread_fence(std::memory_order_acquire);
+        delete this;
+    }
+}
+
+template <typename V, typename E>
+void bridge_state<V, E>::complete_or_abandon(completion_ref ref,
+                                             result_type result) {
+    assert(ref.get() == this);
+    if (result.is_pending())
+        return; // let the ref go out of scope to abandon the task
+
+    {
+        std::lock_guard<std::mutex> lock(mutex_);
+        assert(disposition_ == disposition::pending ||
+               disposition_ == disposition::canceled);
+        if (disposition_ == disposition::pending) {
+            disposition_ = disposition::completed;
+            result_ = std::move(result);
+            deliver_result();
+        }
+    }
+    // drop the reference ouside of the lock
+    ref.drop_after_completion();
+}
+
+template <typename V, typename E>
+void bridge_state<V, E>::set_result_if_abandoned(
+    result_type result_if_abandoned) {
+    if (result_if_abandoned.is_pending())
+        return; // nothing to do
+
+    std::lock_guard<std::mutex> lock(mutex_);
+    assert(disposition_ == disposition::pending ||
+           disposition_ == disposition::completed ||
+           disposition_ == disposition::abandoned);
+    if (disposition_ == disposition::pending ||
+        disposition_ == disposition::abandoned) {
+        result_ = std::move(result_if_abandoned);
+    }
+}
+
+template <typename V, typename E>
+typename bridge_state<V, E>::result_type bridge_state<V, E>::await_result(
+    consumption_ref* ref, ::fit::context& context) {
+    assert(ref->get() == this);
+    result_type result;
+    {
+        std::lock_guard<std::mutex> lock(mutex_);
+        assert(disposition_ == disposition::pending ||
+               disposition_ == disposition::completed ||
+               disposition_ == disposition::abandoned);
+        if (disposition_ == disposition::pending) {
+            task_ = context.suspend_task();
+            return ::fit::pending();
+        }
+        disposition_ = disposition::returned;
+        result = std::move(result_);
+    }
+    // drop the reference ouside of the lock
+    ref->drop_after_consumption();
+    return result;
+}
+
+template <typename V, typename E>
+void bridge_state<V, E>::deliver_result() {
+    if (result_.is_pending()) {
+        task_.reset(); // the task has been canceled
+    } else {
+        task_.resume_task(); // we have a result so wake up the task
+    }
+}
+
+} // namespace internal
+
+template <typename V = void, typename E = void>
+class bridge;
+template <typename V = void, typename E = void>
+class completer;
+template <typename V = void, typename E = void>
+class consumer;
+
+} // namespace fit
+
+#endif // LIB_FIT_BRIDGE_INTERNAL_H_
diff --git a/pkg/fit/include/lib/fit/defer.h b/pkg/fit/include/lib/fit/defer.h
new file mode 100644
index 0000000..7d85048
--- /dev/null
+++ b/pkg/fit/include/lib/fit/defer.h
@@ -0,0 +1,138 @@
+// 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 LIB_FIT_DEFER_H_
+#define LIB_FIT_DEFER_H_
+
+#include <utility>
+
+#include "nullable.h"
+
+namespace fit {
+
+// A move-only deferred action wrapper with RAII semantics.
+// This class is not thread safe.
+//
+// The wrapper holds a function-like callable target with no arguments
+// which it invokes when it goes out of scope unless canceled, called, or
+// moved to a wrapper in a different scope.
+//
+// See |fit::defer()| for idiomatic usage.
+template <typename T>
+class deferred_action final {
+public:
+    // Creates a deferred action without a pending target.
+    deferred_action() = default;
+    explicit deferred_action(decltype(nullptr)) {}
+
+    // Creates a deferred action with a pending target.
+    explicit deferred_action(T target)
+        : target_(std::move(target)) {}
+
+    // Creates a deferred action with a pending target moved from another
+    // deferred action, leaving the other one without a pending target.
+    deferred_action(deferred_action&& other) = default;
+
+    // Invokes and releases the deferred action's pending target (if any).
+    ~deferred_action() {
+        call();
+    }
+
+    // Returns true if the deferred action has a pending target.
+    explicit operator bool() const {
+        return !!target_;
+    }
+
+    // Invokes and releases the deferred action's pending target (if any),
+    // then move-assigns it from another deferred action, leaving the latter
+    // one without a pending target.
+    deferred_action& operator=(deferred_action&& other) {
+        if (&other == this)
+            return *this;
+        call();
+        target_ = std::move(other.target_);
+        return *this;
+    }
+
+    // Invokes and releases the deferred action's pending target (if any).
+    void call() {
+        if (target_) {
+            // Move to a local to guard against re-entrance.
+            T local_target = std::move(*target_);
+            target_.reset();
+            local_target();
+        }
+    }
+
+    // Releases the deferred action's pending target (if any) without
+    // invoking it.
+    void cancel() {
+        target_.reset();
+    }
+    deferred_action& operator=(decltype(nullptr)) {
+        cancel();
+        return *this;
+    }
+
+    // Assigns a new target to the deferred action.
+    deferred_action& operator=(T target) {
+        target_ = std::move(target);
+        return *this;
+    }
+
+    deferred_action(const deferred_action& other) = delete;
+    deferred_action& operator=(const deferred_action& other) = delete;
+
+private:
+    nullable<T> target_;
+};
+
+template <typename T>
+bool operator==(const deferred_action<T>& action, decltype(nullptr)) {
+    return !action;
+}
+template <typename T>
+bool operator==(decltype(nullptr), const deferred_action<T>& action) {
+    return !action;
+}
+template <typename T>
+bool operator!=(const deferred_action<T>& action, decltype(nullptr)) {
+    return !!action;
+}
+template <typename T>
+bool operator!=(decltype(nullptr), const deferred_action<T>& action) {
+    return !!action;
+}
+
+// Defers execution of a function-like callable target with no arguments
+// until the value returned by this function goes out of scope unless canceled,
+// called, or moved to a wrapper in a different scope.
+//
+// // This example prints "Hello..." then "Goodbye!".
+// void test() {
+//     auto d = fit::defer([]{ puts("Goodbye!"); });
+//     puts("Hello...");
+// }
+//
+// // This example prints nothing because the deferred action is canceled.
+// void do_nothing() {
+//     auto d = fit::defer([]{ puts("I'm not here."); });
+//     d.cancel();
+// }
+//
+// // This example shows how the deferred action can be reassigned assuming
+// // the new target has the same type and the old one, in this case by
+// // representing the target as a |fit::closure|.
+// void reassign() {
+//     auto d = fit::defer<fit::closure>([] { puts("This runs first."); });
+//     d = fit::defer<fit::closure>([] { puts("This runs afterwards."); });
+// }
+template <typename T>
+inline deferred_action<T> defer(T target) {
+    return deferred_action<T>(std::move(target));
+}
+
+} // namespace fit
+
+#endif // LIB_FIT_DEFER_H_
diff --git a/pkg/fit/include/lib/fit/function.h b/pkg/fit/include/lib/fit/function.h
new file mode 100644
index 0000000..5aaecca
--- /dev/null
+++ b/pkg/fit/include/lib/fit/function.h
@@ -0,0 +1,315 @@
+// 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 LIB_FIT_FUNCTION_H_
+#define LIB_FIT_FUNCTION_H_
+
+#include <memory>
+#include <type_traits>
+
+#include "function_internal.h"
+#include "nullable.h"
+
+namespace fit {
+
+template <size_t inline_target_size, bool require_inline,
+          typename Result, typename... Args>
+class function_impl;
+
+// The default size allowance for storing a target inline within a function
+// object, in bytes.  This default allows for inline storage of targets
+// as big as two pointers, such as an object pointer and a pointer to a member
+// function.
+constexpr size_t default_inline_target_size = sizeof(void*) * 2;
+
+// A |fit::function| is a move-only polymorphic function wrapper.
+//
+// |fit::function<T>| behaves like |std::function<T>| except that it is move-only
+// instead of copyable so it can hold targets which cannot be copied, such as
+// mutable lambdas.
+//
+// Targets of up to |inline_target_size| bytes in size (rounded up for memory
+// alignment) are stored inline within the function object without incurring
+// any heap allocation.  Larger callable objects will be moved to the heap as
+// required.
+//
+// See also |fit::inline_function<T, size>| for more control over allocation
+// behavior.
+//
+// SYNOPSIS
+//
+// |T| is the function's signature.  e.g. void(int, std::string).
+//
+// |inline_target_size| is the minimum size of target that is guaranteed to
+// fit within a function without requiring heap allocation.
+// Defaults to |default_inline_target_size|.
+//
+// Class members are documented in |fit::function_impl|.
+//
+// EXAMPLES
+//
+// - https://fuchsia.googlesource.com/zircon/+/master/system/utest/fit/examples/function_example1.cpp
+// - https://fuchsia.googlesource.com/zircon/+/master/system/utest/fit/examples/function_example2.cpp
+//
+template <typename T, size_t inline_target_size = default_inline_target_size>
+using function = function_impl<inline_target_size, false, T>;
+
+// A move-only callable object wrapper which forces callables to be stored inline
+// and never performs heap allocation.
+//
+// Behaves just like |fit::function<T, inline_target_size>| except that attempting
+// to store a target larger than |inline_target_size| will fail to compile.
+template <typename T, size_t inline_target_size = default_inline_target_size>
+using inline_function = function_impl<inline_target_size, true, T>;
+
+// Synonym for a function which takes no arguments and produces no result.
+using closure = function<void()>;
+
+// Function implementation details.
+// See |fit::function| documentation for more information.
+template <size_t inline_target_size, bool require_inline,
+          typename Result, typename... Args>
+class function_impl<inline_target_size, require_inline, Result(Args...)> final {
+    using ops_type = const ::fit::internal::target_ops<Result, Args...>*;
+    using storage_type = typename std::aligned_storage<
+        (inline_target_size >= sizeof(void*)
+             ? inline_target_size
+             : sizeof(void*))>::type; // avoid including <algorithm> just for max
+    template <typename Callable>
+    using target_type = ::fit::internal::target<
+        Callable,
+        (sizeof(Callable) <= sizeof(storage_type)),
+        Result, Args...>;
+    using null_target_type = target_type<decltype(nullptr)>;
+
+public:
+    // The function's result type.
+    using result_type = Result;
+
+    // // Creates a function with an empty target.
+    function_impl() {
+        initialize_null_target();
+    }
+
+    // Creates a function with an empty target.
+    function_impl(decltype(nullptr)) {
+        initialize_null_target();
+    }
+
+    // Creates a function bound to the specified function pointer.
+    // If target == nullptr, assigns an empty target.
+    function_impl(Result (*target)(Args...)) {
+        initialize_target(target);
+    }
+
+    // Creates a function bound to the specified callable object.
+    // If target == nullptr, assigns an empty target.
+    //
+    // For functors, we need to capture the raw type but also restrict on the existence of an
+    // appropriate operator () to resolve overloads and implicit casts properly.
+    template <typename Callable,
+              typename = std::enable_if_t<
+                  std::is_convertible<
+                      decltype(std::declval<Callable&>()(
+                          std::declval<Args>()...)),
+                      result_type>::value>>
+    function_impl(Callable target) {
+        initialize_target(std::move(target));
+    }
+
+    // Creates a function with a target moved from another function,
+    // leaving the other function with an empty target.
+    function_impl(function_impl&& other) {
+        move_target_from(std::move(other));
+    }
+
+    // Destroys the function, releasing its target.
+    ~function_impl() {
+        destroy_target();
+    }
+
+    // Returns true if the function has a non-empty target.
+    explicit operator bool() const {
+        return ops_ != &null_target_type::ops;
+    };
+
+    // Invokes the function's target.
+    // Aborts if the function's target is empty.
+    Result operator()(Args... args) const {
+        return ops_->invoke(&bits_, std::forward<Args>(args)...);
+    }
+
+    // Assigns an empty target.
+    function_impl& operator=(decltype(nullptr)) {
+        destroy_target();
+        initialize_null_target();
+        return *this;
+    }
+
+    // Assigns the function's target.
+    // If target == nullptr, assigns an empty target.
+    template <typename Callable,
+              typename = std::enable_if_t<
+                  std::is_convertible<
+                      decltype(std::declval<Callable&>()(
+                          std::declval<Args>()...)),
+                      result_type>::value>>
+    function_impl& operator=(Callable target) {
+        destroy_target();
+        initialize_target(std::move(target));
+        return *this;
+    }
+
+    // Assigns the function with a target moved from another function,
+    // leaving the other function with an empty target.
+    function_impl& operator=(function_impl&& other) {
+        if (&other == this)
+            return *this;
+        destroy_target();
+        move_target_from(std::move(other));
+        return *this;
+    }
+
+    // Swaps the functions' targets.
+    void swap(function_impl& other) {
+        if (&other == this)
+            return;
+        ops_type temp_ops = ops_;
+        storage_type temp_bits;
+        ops_->move(&bits_, &temp_bits);
+
+        ops_ = other.ops_;
+        other.ops_->move(&other.bits_, &bits_);
+
+        other.ops_ = temp_ops;
+        temp_ops->move(&temp_bits, &other.bits_);
+    }
+
+    // Returns a pointer to the function's target.
+    template <typename Callable>
+    Callable* target() {
+        check_target_type<Callable>();
+        return static_cast<Callable*>(ops_->get(&bits_));
+    }
+
+    // Returns a pointer to the function's target.
+    template <typename Callable>
+    const Callable* target() const {
+        check_target_type<Callable>();
+        return static_cast<Callable*>(ops_->get(&bits_));
+    }
+
+    // Returns a new function object which invokes the same target.
+    // The target itself is not copied; it is moved to the heap and its
+    // lifetime is extended until all references have been released.
+    //
+    // Note: This method is not supported on |fit::inline_function<>|
+    //       because it may incur a heap allocation which is contrary to
+    //       the stated purpose of |fit::inline_function<>|.
+    function_impl share() {
+        static_assert(!require_inline, "Inline functions cannot be shared.");
+        // TODO(jeffbrown): Replace shared_ptr with a better ref-count mechanism.
+        // TODO(jeffbrown): This definition breaks the client's ability to use
+        // |target()| because the target's type has changed.  We could fix this
+        // by defining a new target type (and vtable) for shared targets
+        // although it would be nice to avoid memory overhead and code expansion
+        // when sharing is not used.
+        struct ref {
+            std::shared_ptr<function_impl> target;
+            Result operator()(Args... args) {
+                return (*target)(std::forward<Args>(args)...);
+            }
+        };
+        if (ops_ != &target_type<ref>::ops) {
+            if (ops_ == &null_target_type::ops) {
+                return nullptr;
+            }
+            auto target = ref{std::make_shared<function_impl>(std::move(*this))};
+            *this = std::move(target);
+        }
+        return function_impl(*static_cast<ref*>(ops_->get(&bits_)));
+    }
+
+    function_impl(const function_impl& other) = delete;
+    function_impl& operator=(const function_impl& other) = delete;
+
+private:
+    // assumes target is uninitialized
+    void initialize_null_target() {
+        ops_ = &null_target_type::ops;
+    }
+
+    // assumes target is uninitialized
+    template <typename Callable>
+    void initialize_target(Callable target) {
+        static_assert(!require_inline || sizeof(Callable) <= inline_target_size,
+                      "Callable too large to store inline as requested.");
+        if (is_null(target)) {
+            initialize_null_target();
+        } else {
+            ops_ = &target_type<Callable>::ops;
+            target_type<Callable>::initialize(&bits_, std::move(target));
+        }
+    }
+
+    // leaves target uninitialized
+    void destroy_target() {
+        ops_->destroy(&bits_);
+    }
+
+    // leaves other target initialized to null
+    void move_target_from(function_impl&& other) {
+        ops_ = other.ops_;
+        other.ops_->move(&other.bits_, &bits_);
+        other.initialize_null_target();
+    }
+
+    template <typename Callable>
+    void check_target_type() const {
+        if (ops_ != &target_type<Callable>::ops)
+            abort();
+    }
+
+    ops_type ops_;
+    mutable storage_type bits_;
+}; // namespace fit
+
+template <size_t inline_target_size, bool require_inline, typename Result, typename... Args>
+void swap(function_impl<inline_target_size, require_inline, Result, Args...>& a,
+          function_impl<inline_target_size, require_inline, Result, Args...>& b) {
+    a.swap(b);
+}
+
+template <size_t inline_target_size, bool require_inline, typename Result, typename... Args>
+bool operator==(const function_impl<inline_target_size, require_inline, Result, Args...>& f,
+                decltype(nullptr)) {
+    return !f;
+}
+template <size_t inline_target_size, bool require_inline, typename Result, typename... Args>
+bool operator==(decltype(nullptr),
+                const function_impl<inline_target_size, require_inline, Result, Args...>& f) {
+    return !f;
+}
+template <size_t inline_target_size, bool require_inline, typename Result, typename... Args>
+bool operator!=(const function_impl<inline_target_size, require_inline, Result, Args...>& f,
+                decltype(nullptr)) {
+    return !!f;
+}
+template <size_t inline_target_size, bool require_inline, typename Result, typename... Args>
+bool operator!=(decltype(nullptr),
+                const function_impl<inline_target_size, require_inline, Result, Args...>& f) {
+    return !!f;
+}
+
+// Returns a Callable object which invokes a member function of an object.
+template <typename R, typename T, typename... Args>
+auto bind_member(T* instance, R (T::*fn)(Args...)) {
+    return [instance, fn](Args... args) {
+        return (instance->*fn)(std::forward<Args>(args)...);
+    };
+}
+
+} // namespace fit
+
+#endif // LIB_FIT_FUNCTION_H_
diff --git a/pkg/fit/include/lib/fit/function_internal.h b/pkg/fit/include/lib/fit/function_internal.h
new file mode 100644
index 0000000..ddcefef
--- /dev/null
+++ b/pkg/fit/include/lib/fit/function_internal.h
@@ -0,0 +1,121 @@
+// 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 LIB_FIT_FUNCTION_INTERNAL_H_
+#define LIB_FIT_FUNCTION_INTERNAL_H_
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <new>
+#include <type_traits>
+#include <utility>
+
+namespace fit {
+namespace internal {
+
+template <typename Result, typename... Args>
+struct target_ops final {
+    void* (*get)(void* bits);
+    Result (*invoke)(void* bits, Args... args);
+    void (*move)(void* from_bits, void* to_bits);
+    void (*destroy)(void* bits);
+};
+
+template <typename Callable, bool is_inline, typename Result, typename... Args>
+struct target;
+
+template <typename Result, typename... Args>
+struct target<decltype(nullptr), true, Result, Args...> final {
+    static Result invoke(void* bits, Args... args) {
+        abort();
+    }
+
+    static const target_ops<Result, Args...> ops;
+};
+
+inline void* null_target_get(void* bits) {
+    return nullptr;
+}
+inline void null_target_move(void* from_bits, void* to_bits) {}
+inline void null_target_destroy(void* bits) {}
+
+template <typename Result, typename... Args>
+constexpr target_ops<Result, Args...> target<decltype(nullptr), true, Result, Args...>::ops = {
+    &null_target_get,
+    &target::invoke,
+    &null_target_move,
+    &null_target_destroy};
+
+template <typename Callable, typename Result, typename... Args>
+struct target<Callable, true, Result, Args...> final {
+    static void initialize(void* bits, Callable&& target) {
+        new (bits) Callable(std::move(target));
+    }
+    static Result invoke(void* bits, Args... args) {
+        auto& target = *static_cast<Callable*>(bits);
+        return target(std::forward<Args>(args)...);
+    }
+    static void move(void* from_bits, void* to_bits) {
+        auto& from_target = *static_cast<Callable*>(from_bits);
+        new (to_bits) Callable(std::move(from_target));
+        from_target.~Callable();
+    }
+    static void destroy(void* bits) {
+        auto& target = *static_cast<Callable*>(bits);
+        target.~Callable();
+    }
+
+    static const target_ops<Result, Args...> ops;
+};
+
+inline void* inline_target_get(void* bits) {
+    return bits;
+}
+
+template <typename Callable, typename Result, typename... Args>
+constexpr target_ops<Result, Args...> target<Callable, true, Result, Args...>::ops = {
+    &inline_target_get,
+    &target::invoke,
+    &target::move,
+    &target::destroy};
+
+template <typename Callable, typename Result, typename... Args>
+struct target<Callable, false, Result, Args...> final {
+    static void initialize(void* bits, Callable&& target) {
+        auto ptr = static_cast<Callable**>(bits);
+        *ptr = new Callable(std::move(target));
+    }
+    static Result invoke(void* bits, Args... args) {
+        auto& target = **static_cast<Callable**>(bits);
+        return target(std::forward<Args>(args)...);
+    }
+    static void move(void* from_bits, void* to_bits) {
+        auto from_ptr = static_cast<Callable**>(from_bits);
+        auto to_ptr = static_cast<Callable**>(to_bits);
+        *to_ptr = *from_ptr;
+    }
+    static void destroy(void* bits) {
+        auto ptr = static_cast<Callable**>(bits);
+        delete *ptr;
+    }
+
+    static const target_ops<Result, Args...> ops;
+};
+
+inline void* heap_target_get(void* bits) {
+    return *static_cast<void**>(bits);
+}
+
+template <typename Callable, typename Result, typename... Args>
+constexpr target_ops<Result, Args...> target<Callable, false, Result, Args...>::ops = {
+    &heap_target_get,
+    &target::invoke,
+    &target::move,
+    &target::destroy};
+
+} // namespace internal
+} // namespace fit
+
+#endif // LIB_FIT_FUNCTION_INTERNAL_H_
diff --git a/pkg/fit/include/lib/fit/function_traits.h b/pkg/fit/include/lib/fit/function_traits.h
new file mode 100644
index 0000000..3e0c2a3
--- /dev/null
+++ b/pkg/fit/include/lib/fit/function_traits.h
@@ -0,0 +1,18 @@
+// 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 LIB_FIT_FUNCTION_TRAITS_H_
+#define LIB_FIT_FUNCTION_TRAITS_H_
+
+#include "traits.h"
+
+namespace fit {
+
+// function_traits is deprecated, please use callable_traits
+template <typename T>
+using function_traits = callable_traits<T>;
+
+} // namespace fit
+
+#endif // LIB_FIT_FUNCTION_TRAITS_H_
diff --git a/pkg/fit/include/lib/fit/nullable.h b/pkg/fit/include/lib/fit/nullable.h
new file mode 100644
index 0000000..a6050af
--- /dev/null
+++ b/pkg/fit/include/lib/fit/nullable.h
@@ -0,0 +1,245 @@
+// 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 LIB_FIT_NULLABLE_H_
+#define LIB_FIT_NULLABLE_H_
+
+#include <assert.h>
+
+#include <type_traits>
+#include <utility>
+
+#include "optional.h"
+
+namespace fit {
+
+// Determines whether a type can be compared with nullptr.
+template <typename T, typename Comparable = bool>
+struct is_comparable_with_null : public std::false_type {};
+template <typename T>
+struct is_comparable_with_null<T, decltype(std::declval<const T&>() == nullptr)>
+    : public std::true_type {};
+
+// Returns true if a value equals nullptr.
+template <typename T, typename Comparable = bool>
+struct is_null_predicate {
+    constexpr bool operator()(const T& value) { return false; }
+};
+template <typename T>
+struct is_null_predicate<T, decltype(std::declval<const T&>() == nullptr)> {
+    constexpr bool operator()(const T& value) { return value == nullptr; }
+};
+template <typename T>
+constexpr inline bool is_null(const T& value) {
+    return is_null_predicate<T>()(value);
+}
+
+// Determines whether a type can be initialized, assigned, and compared
+// with nullptr.
+template <typename T>
+struct is_nullable
+    : public std::integral_constant<
+          bool,
+          std::is_constructible<T, decltype(nullptr)>::value &&
+              std::is_assignable<T&, decltype(nullptr)>::value &&
+              is_comparable_with_null<T>::value> {};
+template <>
+struct is_nullable<void> : public std::false_type {};
+
+// Holds a value or nullptr.
+//
+// This class is similar to |std::optional<T>| except that it uses less
+// storage when the value type can be initialized, assigned, and compared
+// with nullptr.
+//
+// For example:
+// - sizeof(fit::nullable<void*>) == sizeof(void*)
+// - sizeof(std::optional<void*>) == sizeof(struct { bool; void*; })
+// - sizeof(fit::nullable<int>) == sizeof(struct { bool; int; })
+// - sizeof(std::optional<int>) == sizeof(struct { bool; int; })
+template <typename T, bool = (is_nullable<T>::value &&
+                              std::is_constructible<T, T&&>::value &&
+                              std::is_assignable<T&, T&&>::value)>
+class nullable final {
+public:
+    using value_type = T;
+
+    constexpr nullable() = default;
+    explicit constexpr nullable(decltype(nullptr)) {}
+    explicit constexpr nullable(T value)
+        : opt_(std::move(value)) {}
+    nullable(const nullable& other) = default;
+    nullable(nullable&& other) = default;
+    ~nullable() = default;
+
+    constexpr T& value() & { return opt_.value(); }
+    constexpr const T& value() const& { return opt_.value(); }
+    constexpr T&& value() && { return std::move(opt_.value()); }
+    constexpr const T&& value() const&& { return std::move(opt_.value()); }
+
+    template <typename U = T>
+    constexpr T value_or(U&& default_value) const {
+        return opt_.value_or(std::forward<U>(default_value));
+    }
+
+    constexpr T* operator->() { return &*opt_; }
+    constexpr const T* operator->() const { return &*opt_; }
+    constexpr T& operator*() { return *opt_; }
+    constexpr const T& operator*() const { return *opt_; }
+
+    constexpr bool has_value() const { return opt_.has_value(); }
+    explicit constexpr operator bool() const { return has_value(); }
+
+    nullable& operator=(const nullable& other) = default;
+    nullable& operator=(nullable&& other) = default;
+
+    nullable& operator=(decltype(nullptr)) {
+        reset();
+        return *this;
+    }
+
+    nullable& operator=(T value) {
+        opt_ = std::move(value);
+        return *this;
+    }
+
+    void reset() { opt_.reset(); }
+
+    void swap(nullable& other) { opt_.swap(other.opt_); }
+
+private:
+    optional<T> opt_;
+};
+
+template <typename T>
+class nullable<T, true> final {
+public:
+    using value_type = T;
+
+    constexpr nullable()
+        : value_(nullptr) {}
+    explicit constexpr nullable(decltype(nullptr))
+        : value_(nullptr) {}
+    explicit constexpr nullable(T value)
+        : value_(std::move(value)) {}
+    nullable(const nullable& other) = default;
+    nullable(nullable&& other)
+        : value_(std::move(other.value_)) {
+        other.value_ = nullptr;
+    }
+    ~nullable() = default;
+
+    constexpr T& value() & {
+        assert(has_value());
+        return value_;
+    }
+    constexpr const T& value() const& {
+        assert(has_value());
+        return value_;
+    }
+    constexpr T&& value() && {
+        assert(has_value());
+        return std::move(value_);
+    }
+    constexpr const T&& value() const&& {
+        assert(has_value());
+        return std::move(value_);
+    }
+
+    template <typename U = T>
+    constexpr T value_or(U&& default_value) const {
+        return has_value() ? value_ : static_cast<T>(std::forward<U>(default_value));
+    }
+
+    constexpr T* operator->() { return &value_; }
+    constexpr const T* operator->() const { return &value_; }
+    constexpr T& operator*() { return value_; }
+    constexpr const T& operator*() const { return value_; }
+
+    constexpr bool has_value() const { return !(value_ == nullptr); }
+    explicit constexpr operator bool() const { return has_value(); }
+
+    nullable& operator=(const nullable& other) = default;
+    nullable& operator=(nullable&& other) {
+        if (&other == this)
+            return *this;
+        value_ = std::move(other.value_);
+        other.value_ = nullptr;
+        return *this;
+    }
+
+    nullable& operator=(decltype(nullptr)) {
+        reset();
+        return *this;
+    }
+
+    nullable& operator=(T value) {
+        value_ = std::move(value);
+        return *this;
+    }
+
+    void reset() { value_ = nullptr; }
+
+    void swap(nullable& other) {
+        using std::swap;
+        swap(value_, other.value_);
+    }
+
+private:
+    T value_;
+};
+
+template <typename T>
+void swap(nullable<T>& a, nullable<T>& b) {
+    a.swap(b);
+}
+
+template <typename T>
+constexpr bool operator==(const nullable<T>& lhs, decltype(nullptr)) {
+    return !lhs.has_value();
+}
+template <typename T>
+constexpr bool operator!=(const nullable<T>& lhs, decltype(nullptr)) {
+    return lhs.has_value();
+}
+
+template <typename T>
+constexpr bool operator==(decltype(nullptr), const nullable<T>& rhs) {
+    return !rhs.has_value();
+}
+template <typename T>
+constexpr bool operator!=(decltype(nullptr), const nullable<T>& rhs) {
+    return rhs.has_value();
+}
+
+template <typename T, typename U>
+constexpr bool operator==(const nullable<T>& lhs, const nullable<U>& rhs) {
+    return (lhs.has_value() == rhs.has_value()) && (!lhs.has_value() || *lhs == *rhs);
+}
+template <typename T, typename U>
+constexpr bool operator!=(const nullable<T>& lhs, const nullable<U>& rhs) {
+    return (lhs.has_value() != rhs.has_value()) || (lhs.has_value() && *lhs != *rhs);
+}
+
+template <typename T, typename U>
+constexpr bool operator==(const nullable<T>& lhs, const U& rhs) {
+    return (lhs.has_value() != is_null(rhs)) && (!lhs.has_value() || *lhs == rhs);
+}
+template <typename T, typename U>
+constexpr bool operator!=(const nullable<T>& lhs, const U& rhs) {
+    return (lhs.has_value() == is_null(rhs)) || (lhs.has_value() && *lhs != rhs);
+}
+
+template <typename T, typename U>
+constexpr bool operator==(const T& lhs, const nullable<U>& rhs) {
+    return (is_null(lhs) != rhs.has_value()) && (!rhs.has_value() || lhs == *rhs);
+}
+template <typename T, typename U>
+constexpr bool operator!=(const T& lhs, const nullable<U>& rhs) {
+    return (is_null(lhs) == rhs.has_value()) || (rhs.has_value() && lhs != *rhs);
+}
+
+} // namespace fit
+
+#endif // LIB_FIT_NULLABLE_H_
diff --git a/pkg/fit/include/lib/fit/optional.h b/pkg/fit/include/lib/fit/optional.h
new file mode 100644
index 0000000..929f05b
--- /dev/null
+++ b/pkg/fit/include/lib/fit/optional.h
@@ -0,0 +1,298 @@
+// 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 LIB_FIT_OPTIONAL_H_
+#define LIB_FIT_OPTIONAL_H_
+
+#include <assert.h>
+
+#include <new>
+#include <type_traits>
+#include <utility>
+
+namespace fit {
+namespace internal {
+
+template <typename T, bool = std::is_assignable<T&, const T&>::value>
+struct copy_assign_or_reconstruct final {
+    static void assign(T* dest, const T& source) {
+        dest->~T();
+        new (dest) T(source);
+    }
+};
+
+template <typename T>
+struct copy_assign_or_reconstruct<T, true> final {
+    static void assign(T* dest, const T& source) {
+        *dest = source;
+    }
+};
+
+template <typename T, bool = std::is_assignable<T&, T&&>::value>
+struct move_assign_or_reconstruct final {
+    static void assign(T* dest, T&& source) {
+        dest->~T();
+        new (dest) T(std::move(source));
+    }
+
+    static void swap(T& a, T& b) {
+        T temp(std::move(a));
+        a.~T();
+        new (&a) T(std::move(b));
+        b.~T();
+        new (&b) T(std::move(temp));
+    }
+};
+
+template <typename T>
+struct move_assign_or_reconstruct<T, true> final {
+    static void assign(T* dest, T&& source) {
+        *dest = std::move(source);
+    }
+
+    static void swap(T& a, T& b) {
+        using std::swap;
+        swap(a, b);
+    }
+};
+
+} // namespace internal
+
+// A sentinel value for |fit::optional<T>| indicating that it contains
+// no value.
+struct nullopt_t {
+    explicit constexpr nullopt_t(int) {}
+};
+static constexpr nullopt_t nullopt(0);
+
+// A minimal implementation of an |std::optional<T>| work-alike for C++ 14.
+//
+// See also |fit::nullable<T>| which may be more efficient in certain
+// circumstances if T can be initialized, assigned, and compared with
+// nullptr.
+//
+// TODO(US-90): The initial implementation only covers a minimal subset of the
+// std::optional API.  Flesh this out more fully then define fit::optional
+// to be an alias for std::optional when compiling with C++ 17.
+template <typename T>
+class optional final {
+public:
+    using value_type = T;
+
+    constexpr optional()
+        : has_value_(false) {}
+    constexpr optional(nullopt_t)
+        : has_value_(false) {}
+
+    explicit constexpr optional(T value)
+        : has_value_(true), value_(std::move(value)) {}
+
+    optional(const optional& other)
+        : has_value_(other.has_value_) {
+        if (has_value_) {
+            new (&value_) T(other.value_);
+        }
+    }
+
+    optional(optional&& other)
+        : has_value_(other.has_value_) {
+        if (has_value_) {
+            new (&value_) T(std::move(other.value_));
+            other.value_.~T();
+            other.has_value_ = false;
+        }
+    }
+
+    // TODO(US-90): Presence of this destructor makes the type non-literal.
+    // We should specialize this type to handle the case where T is literal
+    // explicitly so that expressions these types can be constexpr.
+    ~optional() {
+        if (has_value_) {
+            value_.~T();
+        }
+    }
+
+    constexpr T& value() & {
+        assert(has_value_);
+        return value_;
+    }
+
+    constexpr const T& value() const& {
+        assert(has_value_);
+        return value_;
+    }
+
+    constexpr T&& value() && {
+        assert(has_value_);
+        return std::move(value_);
+    }
+
+    constexpr const T&& value() const&& {
+        assert(has_value_);
+        return std::move(value_);
+    }
+
+    template <typename U = T>
+    constexpr T value_or(U&& default_value) const {
+        return has_value_ ? value_ : static_cast<T>(std::forward<U>(default_value));
+    }
+
+    constexpr T* operator->() { return &value_; }
+    constexpr const T* operator->() const { return &value_; }
+    constexpr T& operator*() { return value_; }
+    constexpr const T& operator*() const { return value_; }
+
+    bool has_value() const { return has_value_; }
+    explicit operator bool() const { return has_value(); }
+
+    optional& operator=(const optional& other) {
+        if (&other == this)
+            return *this;
+        if (has_value_) {
+            if (other.has_value_) {
+                ::fit::internal::copy_assign_or_reconstruct<T>::assign(
+                    &value_, other.value_);
+            } else {
+                reset();
+            }
+        } else if (other.has_value_) {
+            new (&value_) T(other.value_);
+            has_value_ = true;
+        }
+        return *this;
+    }
+
+    optional& operator=(optional&& other) {
+        if (&other == this)
+            return *this;
+        if (has_value_) {
+            if (other.has_value_) {
+                ::fit::internal::move_assign_or_reconstruct<T>::assign(
+                    &value_, std::move(other.value_));
+                other.value_.~T();
+                other.has_value_ = false;
+            } else {
+                reset();
+            }
+        } else if (other.has_value_) {
+            new (&value_) T(std::move(other.value_));
+            has_value_ = true;
+            other.value_.~T();
+            other.has_value_ = false;
+        }
+        return *this;
+    }
+
+    optional& operator=(nullopt_t) {
+        reset();
+        return *this;
+    }
+
+    optional& operator=(T value) {
+        if (has_value_) {
+            ::fit::internal::move_assign_or_reconstruct<T>::assign(
+                &value_, std::move(value));
+        } else {
+            new (&value_) T(std::move(value));
+            has_value_ = true;
+        }
+        return *this;
+    }
+
+    void reset() {
+        if (has_value_) {
+            value_.~T();
+            has_value_ = false;
+        }
+    }
+
+    void swap(optional& other) {
+        if (&other == this)
+            return;
+        if (has_value_) {
+            if (other.has_value_) {
+                ::fit::internal::move_assign_or_reconstruct<T>::swap(
+                    value_, other.value_);
+            } else {
+                new (&other.value_) T(std::move(value_));
+                other.has_value_ = true;
+                value_.~T();
+                has_value_ = false;
+            }
+        } else if (other.has_value_) {
+            new (&value_) T(std::move(other.value_));
+            has_value_ = true;
+            other.value_.~T();
+            other.has_value_ = false;
+        }
+    }
+
+    template <typename... Args>
+    T& emplace(Args&&... args) {
+        reset();
+        new (&value_) T(std::forward<Args...>(args)...);
+        has_value_ = true;
+        return value_;
+    }
+
+private:
+    bool has_value_;
+    union {
+        T value_;
+    };
+};
+
+template <typename T>
+void swap(optional<T>& a, optional<T>& b) {
+    a.swap(b);
+}
+
+template <typename T>
+constexpr bool operator==(const optional<T>& lhs, nullopt_t) {
+    return !lhs.has_value();
+}
+template <typename T>
+constexpr bool operator!=(const optional<T>& lhs, nullopt_t) {
+    return lhs.has_value();
+}
+
+template <typename T>
+constexpr bool operator==(nullopt_t, const optional<T>& rhs) {
+    return !rhs.has_value();
+}
+template <typename T>
+constexpr bool operator!=(nullopt_t, const optional<T>& rhs) {
+    return rhs.has_value();
+}
+
+template <typename T, typename U>
+constexpr bool operator==(const optional<T>& lhs, const optional<U>& rhs) {
+    return (lhs.has_value() == rhs.has_value()) && (!lhs.has_value() || *lhs == *rhs);
+}
+template <typename T, typename U>
+constexpr bool operator!=(const optional<T>& lhs, const optional<U>& rhs) {
+    return (lhs.has_value() != rhs.has_value()) || (lhs.has_value() && *lhs != *rhs);
+}
+
+template <typename T, typename U>
+constexpr bool operator==(const optional<T>& lhs, const U& rhs) {
+    return lhs.has_value() && *lhs == rhs;
+}
+template <typename T, typename U>
+constexpr bool operator!=(const optional<T>& lhs, const U& rhs) {
+    return !lhs.has_value() || *lhs != rhs;
+}
+
+template <typename T, typename U>
+constexpr bool operator==(const T& lhs, const optional<U>& rhs) {
+    return rhs.has_value() && lhs == *rhs;
+}
+template <typename T, typename U>
+constexpr bool operator!=(const T& lhs, const optional<U>& rhs) {
+    return !rhs.has_value() || lhs != *rhs;
+}
+
+} // namespace fit
+
+#endif // LIB_FIT_OPTIONAL_H_
diff --git a/pkg/fit/include/lib/fit/promise.h b/pkg/fit/include/lib/fit/promise.h
new file mode 100644
index 0000000..ece9e75
--- /dev/null
+++ b/pkg/fit/include/lib/fit/promise.h
@@ -0,0 +1,1520 @@
+// 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 LIB_FIT_PROMISE_H_
+#define LIB_FIT_PROMISE_H_
+
+#include <assert.h>
+
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "function.h"
+#include "promise_internal.h"
+#include "result.h"
+#include "variant.h"
+
+namespace fit {
+
+// A |fit::promise| is a building block for asynchronous control flow that
+// wraps an asynchronous task in the form of a "continuation" that is
+// repeatedly invoked by an executor until it produces a result.
+//
+// Additional asynchronous tasks can be chained onto the promise using
+// a variety of combinators such as |then()|.
+//
+// Use |fit::make_promise()| to create a promise.
+// Use |fit::future| to more conveniently hold a promise or its result.
+// Use |fit::pending_task| to wrap a promise as a pending task for execution.
+// Use |fit::executor| to execute a pending task.
+// See examples below.
+//
+// Always look to the future; never look back.
+//
+// SYNOPSIS
+//
+// |V| is the type of value produced when the completes successfully.
+// Defaults to |void|.
+//
+// |E| is the type of error produced when the completes with an error.
+// Defaults to |void|.
+//
+// Class members are documented in |fit::promise_impl|.
+//
+// CHAINING PROMISES USING COMBINATORS
+//
+// Promises can be chained together using combinators such as |then()|
+// which consume the original promise(s) and return a new combined promise.
+//
+// For example, the |then()| combinator returns a promise that has the effect
+// of asynchronously awaiting completion of the prior promise (the instance
+// upon which |then()| was called) then delivering its result to a handler
+// function.
+//
+// Available combinators defined in this library:
+//
+//    |then()|: run a handler when prior promise completes
+//    |and_then()|: run a handler when prior promise completes successfully
+//    |or_else()|: run a handler when prior promise completes with an error
+//    |inspect()|: examine result of prior promise
+//    |discard_result()|: discard result and unconditionally return
+//                        fit::result<> when prior promise completes
+//    |wrap_with()|: applies a wrapper to the promise
+//    |box()|: wraps the promise's continuation into a |fit::function|
+//    |fit::join_promises()|: await multiple promises, once they all complete
+//                            return a tuple of their results
+//
+// You can also create your own custom combinators by crafting new
+// types of continuations.
+//
+// CONTINUATIONS AND HANDLERS
+//
+// Internally, |fit::promise| wraps a continuation (a kind of callable
+// object) that holds the state of the asynchronous task and provides a
+// means for making progress through repeated invocation.
+//
+// A promise's continuation is generated through the use of factories
+// such as |make_promise()| and combinators such as |then()|.  Most of
+// these functions accept a client-supplied "handler" (another kind
+// of callable object, often a lambda expression) which performs the actual
+// computations.
+//
+// Continuations have a very regular interface: they always accept a
+// |fit::context&| argument and return a |fit::result|.  Conversely, handlers
+// have a very flexible interface: clients can provide them in many forms
+// all of which are documented by the individual functions which consume them.
+// It's pretty easy to use: the library takes care of wrapping client-supplied
+// handlers of all supported forms into the continuations it uses internally.
+//
+// THEORY OF OPERATION
+//
+// On its own, a promise is "inert"; it only makes progress in response to
+// actions taken by its owner.  The state of the promise never changes
+// spontaneously or concurrently.
+//
+// Typically, a promise is executed by wrapping it into a |fit::pending_task|
+// and scheduling it for execution using |fit::executor::schedule_task()|.
+// A promise's |operator(fit::context&)| can also be invoked directly by its owner
+// from within the scope of another task (this is used to implement combinators
+// and futures) though the principle is the same.
+//
+// |fit::executor| is an abstract class that encapsulates a strategy for
+// executing tasks.  The executor is responsible for invoking each tasks's
+// continuation until the task returns a non-pending result, indicating that
+// the task has been completed.
+//
+// The method of execution and scheduling of each continuation call is left
+// to the discretion of each executor implementation.  Typical executor
+// implementations may dispatch tasks on an event-driven message loop or on
+// a thread pool.  Developers are responsible for selecting appropriate
+// executor implementations for their programs.
+//
+// During each invocation, the executor passes the continuation an execution
+// context object represented by a subclass of |fit::context|.  The continuation
+// attempts to make progress then returns a value of type |fit::result| to
+// indicate whether it completed successfully (signaled by |fit::ok()|),
+// failed with an error (signaled by |fit::error()|, or was unable to complete
+// the task during that invocation (signaled by |fit::pending()|).
+// For example, a continuation may be unable to complete the task if it must
+// asynchronously await completion of an I/O or IPC operation before it
+// can proceed any further.
+//
+// If the continuation was unable to complete the task during its invocation,
+// it may to call |fit::context::suspend_task()| to acquire a
+// |fit::suspended_task| object.  The continuation then arranges for the
+// task to be resumed asynchronously (with |fit::suspended_task::resume_task()|)
+// once it becomes possible for the promise to make forward progress again.
+// Finally, the continuation returns returns |fit::pending()| to indicate to
+// the executor that it was unable to complete the task during that invocation.
+//
+// When the executor receives a pending result from a task's continuation,
+// it moves the task into a table of suspended tasks.  A suspended task
+// is considered abandoned if has not been resume and all remaining
+// |fit::suspended_task| handles representing it have been dropped.
+// When a task is abandoned, the executor removes it from its table of
+// suspended tasks and destroys the task because it is not possible for the task
+// to be resumed or to make progress from that state.
+//
+// See also |fit::single_threaded_executor| for a simple executor implementation.
+//
+// BOXED AND UNBOXED PROMISES
+//
+// To make combination and execution as efficient as possible, the promises
+// returned by |fit::make_promise| and by combinators are parameterized by
+// complicated continuation types that are hard to describe, often consisting of
+// nested templates and lambdas.  These are referred to as "unboxed"
+// promises.  In contrast, "boxed" promises are parameterized by a
+// a |fit::function| that hides (or "erases") the type of the continuation
+// thereby yielding type that is easier to describe.
+//
+// You can recognize boxed and unboxed promises by their types.
+// Here are two examples:
+//
+// - A boxed promise type: `fit::promise<void, void>` which is an alias for
+//  `fit::promise_impl<void, void, std::function<fit::result<void, void>>`.
+// - An unboxed promise type: `fit::promise_impl<void, void,
+//   fit::internal::then_continuation<...something unintelligible...>>`
+//
+// Although boxed promises are easier to manipulate, they may cause the
+// continuation to be allocated on the heap.  Chaining boxed promises can
+// result in multiple allocations being produced.
+//
+// Conversely, unboxed promises have full type information.  Not only does
+// this defer heap allocation but it also makes it easier for the C++
+// compiler to fuse a chains of unboxed promises together into a single
+// object that is easier to optimize.
+//
+// Unboxed promises can be boxed by assigning them to a boxed promise
+// type (such as |fit::promise<>|) or using the |box()| combinator.
+//
+// As a rule of thumb, always defer boxing of promises until it is necessary
+// to transport them using a simpler type.
+//
+// Do this: (chaining as a single expression performs at most one heap allocation)
+//
+//     fit::promise<> f = fit::make_promise([] { ... });
+//         .then([](fit::result<> result) { ... });
+//         .and_then([] { ... });
+//
+// Or this: (still only performs at most one heap allocation)
+//
+//     auto f = fit::make_promise([] { ... });
+//     auto g = f.then([](fit::result<> result) { ... });
+//     auto h = g.and_then([] { ... });
+//     fit::promise<> boxed_h = h;
+//
+// But don't do this: (incurs up to three heap allocations due to eager boxing)
+//
+//     fit::promise<> f = fit::make_promise([] { ... });
+//     fit::promise<> g = f.then([](fit::result<> result) { ... });
+//     fit::promise<> h = g.and_then([] { ... });
+//
+// SINGLE OWNERSHIP MODEL
+//
+// Promises have single-ownership semantics.  This means that there
+// can only be at most one reference to the task represented by its
+// continuation along with any state held by that continuation.
+//
+// When a combinator is applied to a promise, ownership of its continuation
+// is transferred to the combined promise, leaving the original promise
+// in an "empty" state without a continuation.  Note that it is an error
+// to attempt to invoke an empty promise (will assert at runtime).
+//
+// This model greatly simplifies reasoning about object lifetime.
+// If a promise goes out of scope without completing its task, the task
+// is considered "abandoned", causing all associated state to be destroyed.
+//
+// Note that a promise may capture references to other objects whose lifetime
+// differs from that of the promise.  It is the responsibility of the promise
+// to ensure reachability of the objects whose reference it captures such
+// as by using reference counted pointers, weak pointers, or other appropriate
+// mechanisms to ensure memory safety.
+//
+// THREADING MODEL
+//
+// Promise objects are not thread-safe themselves.  You cannot call their
+// methods concurrently (or re-entrantly).  However, promises can safely
+// be moved to other threads and executed there (unless their continuation
+// requires thread affinity for some reason but that's beyond the scope
+// of this document).
+//
+// This property of being thread-independent, combined with the single
+// ownership model, greatly simplifies the implementation of thread pool
+// based executors.
+//
+// RESULT RETENTION AND FIT::FUTURES
+//
+// A promise's continuation can only be executed to completion once.
+// After it completes, it cannot be run again.
+//
+// This method of execution is very efficient; the promise's result is returned
+// directly to its invoker; it is not copied or retained within the promise
+// object itself.  It is entirely the caller's responsibility to decide how to
+// consume or retain the result if need be.
+//
+// For example, the caller can move the promise into a |fit::future| to
+// more conveniently hold either the promise or its result upon completion.
+//
+// CLARIFICATION OF NOMENCLATURE
+//
+// In this library, the words "promise" and "future" have the following
+// definitions:
+//
+// - A *promise* holds the function that performs an asynchronous task.
+//   It is the means to produce a value.
+// - A *future* holds the value produced by an asynchronous task or a
+//   promise to produce that value if the task has not yet completed.
+//   It is a proxy for a value that is to be computed.
+//
+// Be aware that other libraries may use these terms slightly differently.
+//
+// For more information about the theory of futures and promises, see
+// https://en.wikipedia.org/wiki/Futures_and_promises.
+//
+// COMPARISON WITH STD::FUTURE
+//
+// |std::future| provides a mechanism for running asynchronous tasks
+// and awaiting their results on other threads.  Waiting can be performed
+// either by blocking the waiting thread or by polling the future.
+// The manner in which tasks are scheduled and executed is entirely
+// controlled by the C++ standard library and offers limited control
+// to developers.
+//
+// |fit::promise| and |fit::future| provide a mechanism for running asynchronous
+// tasks, chaining additional tasks using combinators, and awaiting their
+// results.  An executor is responsible for suspending tasks awaiting
+// results of other tasks and is at liberty to run other tasks on the
+// same thread rather than blocking.  In addition, developers can create custom
+// executors to implement their own policies for running tasks.
+//
+// Decoupling awaiting from blocking makes |fit::promise| quite versatile.
+// |fit::promise| can also interoperate with other task dispatching mechanisms
+// (including |std::future|) using adapters such as |fit::bridge|.
+//
+// EXAMPLE
+//
+// - https://fuchsia.googlesource.com/zircon/+/master/system/utest/fit/examples/promise_example1.cpp
+// - https://fuchsia.googlesource.com/zircon/+/master/system/utest/fit/examples/promise_example2.cpp
+//
+template <typename V = void, typename E = void>
+using promise = promise_impl<function<result<V, E>(fit::context&)>>;
+
+// Promise implementation details.
+// See |fit::promise| documentation for more information.
+template <typename Continuation>
+class promise_impl final {
+    static_assert(
+        ::fit::internal::is_continuation<Continuation>::value,
+        "Continuation type is invalid.  A continuation is a callable object "
+        "with this signature: fit::result<V, E>(fit::context&).");
+
+    using state_type = nullable<Continuation>;
+
+public:
+    // The type of callable object held by the promise.
+    // Its signature is: result_type(fit::context&).
+    using continuation_type = Continuation;
+
+    // The promise's result type.
+    // Equivalent to fit::result<value_type, error_type>.
+    using result_type = typename ::fit::internal::continuation_traits<
+        Continuation>::result_type;
+
+    // The type of value produced when the promise completes successfully.
+    // May be void.
+    using value_type = typename result_type::value_type;
+
+    // The type of value produced when the promise completes with an error.
+    // May be void.
+    using error_type = typename result_type::error_type;
+
+    // Creates an empty promise without a continuation.
+    // A continuation must be assigned before the promise can be used.
+    promise_impl() = default;
+    explicit promise_impl(decltype(nullptr)) {}
+
+    // Creates a promise with a continuation.
+    // If |continuation| equals nullptr then the promise is empty.
+    explicit promise_impl(continuation_type continuation)
+        : state_(std::move(continuation)) {}
+
+    // Converts from a promise holding a continuation that is assignable to
+    // to this promise's continuation type.
+    //
+    // This is typically used to create a promise with a boxed continuation
+    // type (such as |fit::function|) from an unboxed promise produced by
+    // |fit::make_promise| or by combinators.
+    //
+    // EXAMPLE
+    //
+    //     // f is a promise_impl with a complicated unboxed type
+    //     auto f = fit::make_promise([] { ... });
+    //
+    //     // g wraps f's continuation
+    //     fit::promise<> g = std::move(f);
+    //
+    template <typename OtherContinuation,
+              typename = std::enable_if_t<
+                  std::is_constructible<continuation_type,
+                                        OtherContinuation&&>::value>>
+    promise_impl(promise_impl<OtherContinuation> other)
+        : state_(other.state_.has_value()
+                     ? state_type(continuation_type(std::move(*other.state_)))
+                     : state_type()) {}
+
+    // Creates a promise by taking the continuation from another promise,
+    // leaving the other promise empty.
+    promise_impl(promise_impl&& other) = default;
+
+    // Destroys the promise, releasing its continuation.
+    ~promise_impl() = default;
+
+    // Returns true if the promise is non-empty (has a valid continuation).
+    explicit operator bool() const { return state_.has_value(); }
+
+    // Invokes the promise's continuation.
+    //
+    // This method should be called by an executor to evaluate the promise.
+    // If the result's state is |result_state::pending| then the executor
+    // is responsible for arranging to invoke the promise's continuation
+    // again once it determines that it is possible to make progress
+    // towards completion of the promise encapsulated within the promise.
+    //
+    // Once the continuation returns a result with status |result_state::ok|
+    // or |result_state::error|, the promise is assigned an empty continuation.
+    //
+    // Asserts that the promise is non-empty.
+    result_type operator()(context& context) {
+        assert(state_.has_value());
+        result_type result = (*state_)(context);
+        if (!result.is_pending())
+            state_.reset();
+        return result;
+    }
+
+    // Takes the promise's continuation, leaving it in an empty state.
+    // Asserts that the promise is non-empty.
+    continuation_type take_continuation() {
+        assert(state_.has_value());
+        auto continuation = std::move(state_.value());
+        state_.reset();
+        return continuation;
+    }
+
+    // Assigns the promise by taking the continuation from another promise,
+    // leaving the other promise empty.
+    promise_impl& operator=(promise_impl&& other) = default;
+
+    // Discards the promise's continuation, leaving it empty.
+    promise_impl& operator=(decltype(nullptr)) {
+        state_.reset();
+        return *this;
+    }
+
+    // Assigns the promise's continuation.
+    promise_impl& operator=(continuation_type continuation) {
+        state_ = std::move(continuation);
+        return *this;
+    }
+
+    // Swaps the promises' continuations.
+    void swap(promise_impl& other) {
+        using std::swap;
+        swap(state_, other.state_);
+    }
+
+    // Returns an unboxed promise which invokes the specified handler
+    // function after this promise completes (successfully or unsuccessfully),
+    // passing its result.
+    //
+    // The received result's state is guaranteed to be either
+    // |fit::result_state::ok| or |fit::result_state::error|, never
+    // |fit::result_state::pending|.
+    //
+    // |handler| is a callable object (such as a lambda) which consumes the
+    // result of this promise and returns a new result with any value type
+    // and error type.  Must not be null.
+    //
+    // The handler must return one of the following types:
+    // - void
+    // - fit::result<new_value_type, new_error_type>
+    // - fit::ok<new_value_type>
+    // - fit::error<new_error_type>
+    // - fit::pending
+    // - fit::promise<new_value_type, new_error_type>
+    // - any callable or unboxed promise with the following signature:
+    //   fit::result<new_value_type, new_error_type>(fit::context&)
+    //
+    // The handler must accept one of the following argument lists:
+    // - (result_type)
+    // - (result_type&)
+    // - (const result_type&)
+    // - (fit::context&, result_type)
+    // - (fit::context&, result_type&)
+    // - (fit::context&, const result_type&)
+    //
+    // Asserts that the promise is non-empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    //     auto f = fit::make_promise(...)
+    //         .then([] (fit::result<int, std::string> result)
+    //                   -> fit::result<std::string, void> {
+    //             if (result.is_ok()) {
+    //                 printf("received value: %d\n", result.value());
+    //                 if (result.value() % 15 == 0)
+    //                     return ::fit::ok("fizzbuzz");
+    //                 if (result.value() % 3 == 0)
+    //                     return ::fit::ok("fizz");
+    //                 if (result.value() % 5 == 0)
+    //                     return ::fit::ok("buzz");
+    //                 return ::fit::ok(std::to_string(result.value()));
+    //             } else {
+    //                 printf("received error: %s\n", result.error().c_str());
+    //                 return ::fit::error();
+    //             }
+    //         })
+    //         .then(...);
+    //
+    template <typename ResultHandler>
+    promise_impl<::fit::internal::then_continuation<promise_impl, ResultHandler>>
+    then(ResultHandler handler) {
+        static_assert(is_callable<ResultHandler>::value,
+                      "ResultHandler must be a callable object.");
+
+        assert(!is_null(handler));
+        assert(state_.has_value());
+        return make_promise_with_continuation(
+            ::fit::internal::then_continuation<promise_impl, ResultHandler>(
+                std::move(*this), std::move(handler)));
+    }
+
+    // Returns an unboxed promise which invokes the specified handler
+    // function after this promise completes successfully, passing its
+    // resulting value.
+    //
+    // |handler| is a callable object (such as a lambda) which consumes the
+    // result of this promise and returns a new result with any value type
+    // but the same error type.  Must not be null.
+    //
+    // The handler must return one of the following types:
+    // - void
+    // - fit::result<new_value_type, error_type>
+    // - fit::ok<new_value_type>
+    // - fit::error<error_type>
+    // - fit::pending
+    // - fit::promise<new_value_type, error_type>
+    // - any callable or unboxed promise with the following signature:
+    //   fit::result<new_value_type, error_type>(fit::context&)
+    //
+    // The handler must accept one of the following argument lists:
+    // - (value_type)
+    // - (value_type&)
+    // - (const value_type&)
+    // - (fit::context&, value_type)
+    // - (fit::context&, value_type&)
+    // - (fit::context&, const value_type&)
+    //
+    // Asserts that the promise is non-empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    //     auto f = fit::make_promise(...)
+    //         .and_then([] (int value) {
+    //             printf("received value: %d\n", value);
+    //             if (value % 15 == 0)
+    //                 return ::fit::ok("fizzbuzz");
+    //             if (value % 3 == 0)
+    //                 return ::fit::ok("fizz");
+    //             if (value % 5 == 0)
+    //                 return ::fit::ok("buzz");
+    //             return ::fit::ok(std::to_string(value));
+    //         })
+    //         .then(...);
+    //
+    template <typename ValueHandler>
+    promise_impl<::fit::internal::and_then_continuation<promise_impl, ValueHandler>>
+    and_then(ValueHandler handler) {
+        static_assert(is_callable<ValueHandler>::value,
+                      "ValueHandler must be a callable object.");
+
+        assert(!is_null(handler));
+        assert(state_.has_value());
+        return make_promise_with_continuation(
+            ::fit::internal::and_then_continuation<promise_impl, ValueHandler>(
+                std::move(*this), std::move(handler)));
+    }
+
+    // Returns an unboxed promise which invokes the specified handler
+    // function after this promise completes with an error, passing its
+    // resulting error.
+    //
+    // |handler| is a callable object (such as a lambda) which consumes the
+    // result of this promise and returns a new result with any error type
+    // but the same value type.  Must not be null.
+    //
+    // The handler must return one of the following types:
+    // - void
+    // - fit::result<value_type, new_error_type>
+    // - fit::ok<value_type>
+    // - fit::error<new_error_type>
+    // - fit::pending
+    // - fit::promise<value_type, new_error_type>
+    // - any callable or unboxed promise with the following signature:
+    //   fit::result<value_type, new_error_type>(fit::context&)
+    //
+    // The handler must accept one of the following argument lists:
+    // - (error_type)
+    // - (error_type&)
+    // - (const error_type&)
+    // - (fit::context&, error_type)
+    // - (fit::context&, error_type&)
+    // - (fit::context&, const error_type&)
+    //
+    // Asserts that the promise is non-empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    //     auto f = fit::make_promise(...)
+    //         .or_else([] (std::string error) {
+    //             printf("received error: %s\n", error.c_str());
+    //             return ::fit::error();
+    //         })
+    //         .then(...);
+    //
+    template <typename ErrorHandler>
+    promise_impl<::fit::internal::or_else_continuation<promise_impl, ErrorHandler>>
+    or_else(ErrorHandler handler) {
+        static_assert(is_callable<ErrorHandler>::value,
+                      "ErrorHandler must be a callable object.");
+
+        assert(!is_null(handler));
+        assert(state_.has_value());
+        return make_promise_with_continuation(
+            ::fit::internal::or_else_continuation<promise_impl, ErrorHandler>(
+                std::move(*this), std::move(handler)));
+    }
+
+    // Returns an unboxed promise which invokes the specified handler
+    // function after this promise completes (successfully or unsuccessfully),
+    // passing it the promise's result then delivering the result onwards
+    // to the next promise once the handler returns.
+    //
+    // The handler receive a copy, const reference, or non-const reference
+    // depending on the signature of the handler's last argument.
+    //
+    // - Copies and const references are especially useful for inspecting a
+    //   result mid-stream without modification, such as printing it for
+    //   debugging.
+    // - Non-const references are especially useful for synchronously
+    //   modifying a result mid-stream, such as clamping its bounds or
+    //   injecting a default value.
+    //
+    // |handler| is a callable object (such as a lambda) which can examine
+    // or modify the incoming result.  Unlike |then()|, the handler does
+    // not need to propagate the result onwards.  Must not be null.
+    //
+    // The handler must return one of the following types:
+    // - void
+    //
+    // The handler must accept one of the following argument lists:
+    // - (result_type)
+    // - (result_type&)
+    // - (const result_type&)
+    // - (fit::context&, result_type)
+    // - (fit::context&, result_type&)
+    // - (fit::context&, const result_type&)
+    //
+    // Asserts that the promise is non-empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    //     auto f = fit::make_promise(...)
+    //         .inspect([] (const fit::result<int, std::string>& result) {
+    //             if (result.is_ok())
+    //                 printf("received value: %d\n", result.value());
+    //             else
+    //                 printf("received error: %s\n", result.error().c_str());
+    //         })
+    //         .then(...);
+    //
+    template <typename InspectHandler>
+    promise_impl<::fit::internal::inspect_continuation<promise_impl, InspectHandler>>
+    inspect(InspectHandler handler) {
+        static_assert(is_callable<InspectHandler>::value,
+                      "InspectHandler must be a callable object.");
+        static_assert(std::is_void<typename callable_traits<
+                          InspectHandler>::return_type>::value,
+                      "InspectHandler must return void.");
+
+        assert(!is_null(handler));
+        assert(state_.has_value());
+        return make_promise_with_continuation(
+            ::fit::internal::inspect_continuation<promise_impl, InspectHandler>(
+                std::move(*this), std::move(handler)));
+    }
+
+    // Returns an unboxed promise which discards the result of this promise
+    // once it completes, thereby always producing a successful result of
+    // type fit::result<void, void> regardless of whether this promise
+    // succeeded or failed.
+    //
+    // Asserts that the promise is non-empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    //     auto f = fit::make_promise(...)
+    //         .discard_result()
+    //         .then(...);
+    //
+    promise_impl<::fit::internal::discard_result_continuation<promise_impl>>
+    discard_result() {
+        assert(state_.has_value());
+        return make_promise_with_continuation(
+            ::fit::internal::discard_result_continuation<promise_impl>(
+                std::move(*this)));
+    }
+
+    // Applies a |wrapper| to the promise.  Invokes the wrapper's |wrap()|
+    // method, passes the promise to the wrapper by value followed by any
+    // additional |args| passed to |wrap_with()|, then returns the wrapper's
+    // result.
+    //
+    // |Wrapper| is a type that implements a method called |wrap()| which
+    // accepts a promise as its argument and produces a wrapped result of
+    // any type, such as another promise.
+    //
+    // Asserts that the promise is non-empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    // In this example, |fit::sequencer| is a wrapper type that imposes
+    // FIFO execution order onto a sequence of wrapped promises.
+    //
+    //     // This wrapper type is intended to be applied to
+    //     // a sequence of promises so we store it in a variable.
+    //     fit::sequencer seq;
+    //
+    //     // This task consists of some amount of work that must be
+    //     // completed sequentially followed by other work that can
+    //     // happen in any order.  We use |wrap_with()| to wrap the
+    //     // sequential work with the sequencer.
+    //     fit::promise<> perform_complex_task() {
+    //         return fit::make_promise([] { /* do sequential work */ })
+    //             .then([] (fit::result<> result) { /* this will also be wrapped */ })
+    //             .wrap_with(seq)
+    //             .then([] (fit::result<> result) { /* do more work */ });
+    //     }
+    //
+    // This example can also be written without using |wrap_with()|.
+    // The behavior is equivalent but the syntax may seem more awkward.
+    //
+    //     fit::sequencer seq;
+    //
+    //     promise<> perform_complex_task() {
+    //         return seq.wrap(
+    //                 fit::make_promise([] { /* sequential work */ })
+    //             ).then([] (fit::result<> result) { /* more work */ });
+    //     }
+    //
+    template <typename Wrapper, typename... Args>
+    decltype(auto) wrap_with(Wrapper& wrapper, Args... args) {
+        assert(state_.has_value());
+        return wrapper.wrap(std::move(*this),
+                            std::forward<Args>(args)...);
+    }
+
+    // Wraps the promise's continuation into a |fit::function|.
+    //
+    // A boxed promise is easier to store and pass around than the unboxed
+    // promises produced by |fit::make_promise()| and combinators, though boxing
+    // may incur a heap allocation.
+    //
+    // It is a good idea to defer boxing the promise until after all
+    // desired combinators have been applied to prevent unnecessary heap
+    // allocation during intermediate states of the promise's construction.
+    //
+    // Returns an empty promise if this promise is empty.
+    // This method consumes the promise's continuation, leaving it empty.
+    //
+    // EXAMPLE
+    //
+    //     // f's is a fit::promise_impl<> whose continuation contains an
+    //     // anonymous type (the lambda)
+    //     auto f = fit::make_promise([] {});
+    //
+    //     // g's type will be fit::promise<> due to boxing
+    //     auto boxed_f = f.box();
+    //
+    //     // alternately, we can get exactly the same effect by assigning
+    //     // the unboxed promise to a variable of a named type instead of
+    //     // calling box()
+    //     fit::promise<> boxed_f = std::move(f);
+    //
+    promise_impl<function<result_type(context&)>> box() {
+        return std::move(*this);
+    }
+
+    promise_impl(const promise_impl&) = delete;
+    promise_impl& operator=(const promise_impl&) = delete;
+
+private:
+    template <typename>
+    friend class promise_impl;
+
+    state_type state_;
+};
+
+template <typename Continuation>
+void swap(promise_impl<Continuation>& a,
+          promise_impl<Continuation>& b) {
+    a.swap(b);
+}
+
+template <typename Continuation>
+bool operator==(const promise_impl<Continuation>& f,
+                decltype(nullptr)) {
+    return !f;
+}
+template <typename Continuation>
+bool operator==(decltype(nullptr),
+                const promise_impl<Continuation>& f) {
+    return !f;
+}
+template <typename Continuation>
+bool operator!=(const promise_impl<Continuation>& f,
+                decltype(nullptr)) {
+    return !!f;
+}
+template <typename Continuation>
+bool operator!=(decltype(nullptr),
+                const promise_impl<Continuation>& f) {
+    return !!f;
+}
+
+// Makes a promise containing the specified continuation.
+//
+// This function is used for making a promises given a callable object
+// that represents a valid continuation type.  In contrast,
+// |fit::make_promise()| supports a wider range of types and should be
+// preferred in most situations.
+//
+// |Continuation| is a callable object with the signature
+// fit::result<V, E>(fit::context&).
+template <typename Continuation>
+inline promise_impl<Continuation> make_promise_with_continuation(
+    Continuation continuation) {
+    return promise_impl<Continuation>(std::move(continuation));
+}
+
+// Returns an unboxed promise that wraps the specified handler.
+// The type of the promise's result is inferred from the handler's result.
+//
+// |handler| is a callable object (such as a lambda.  Must not be null.
+//
+// The handler must return one of the following types:
+// - void
+// - fit::result<value_type, error_type>
+// - fit::ok<value_type>
+// - fit::error<error_type>
+// - fit::pending
+// - fit::promise<value_type, error_type>
+// - any callable or unboxed promise with the following signature:
+//   fit::result<value_type, error_type>(fit::context&)
+//
+// The handler must accept one of the following argument lists:
+// - ()
+// - (fit::context&)
+//
+// See documentation of |fit::promise| for more information.
+//
+// SYNOPSIS
+//
+// |Handler| is the handler function type.  It is typically inferred by the
+// compiler from the |handler| argument.
+//
+// EXAMPLE
+//
+//     enum class weather_type { sunny, glorious, cloudy, eerie, ... };
+//
+//     weather_type look_outside() { ... }
+//     void wait_for_tomorrow(fit::suspended_task task) {
+//         ... arrange to call task.resume_task() tomorrow ...
+//     }
+//
+//     fit::promise<weather_type, std::string> wait_for_good_weather(int max_days) {
+//         return fit::make_promise([days_left = max_days] (fit::context context&) mutable
+//                             -> fit::result<int, std::string> {
+//             weather_type weather = look_outside();
+//             if (weather == weather_type::sunny || weather == weather_type::glorious)
+//                 return fit::ok(weather);
+//             if (days_left > 0) {
+//                 wait_for_tomorrow(context.suspend_task());
+//                 return fit::pending();
+//             }
+//             days_left--;
+//             return fit::error("nothing but grey skies");
+//         });
+//     }
+//
+//     auto f = wait_for_good_weather(7)
+//         .and_then([] (weather_type weather) { ... })
+//         .or_else([] (std::string error) { ... });
+//
+template <typename PromiseHandler>
+inline promise_impl<::fit::internal::context_handler_invoker<PromiseHandler>>
+make_promise(PromiseHandler handler) {
+    static_assert(is_callable<PromiseHandler>::value,
+                  "PromiseHandler must be a callable object.");
+
+    assert(!is_null(handler));
+    return make_promise_with_continuation(
+        ::fit::internal::promise_continuation<PromiseHandler>(
+            std::move(handler)));
+}
+
+// Jointly evaluates zero or more promises.
+// Returns a promise that produces a std::tuple<> containing the result
+// of each promise once they all complete.
+//
+// EXAMPLE
+//
+//     auto get_random_number() {
+//         return fit::make_promise([] { return rand() % 10 });
+//     }
+//
+//     auto get_random_product() {
+//         auto f = get_random_number();
+//         auto g = get_random_number();
+//         return fit::join_promises(std::move(f), std::move(g))
+//             .and_then([] (std::tuple<fit::result<int>, fit::result<int>> results) {
+//                 return fit::ok(results.get<0>.value() + results.get<1>.value());
+//             });
+//     }
+//
+template <typename... Promises>
+inline promise_impl<::fit::internal::join_continuation<Promises...>>
+join_promises(Promises... promises) {
+    return make_promise_with_continuation(
+        ::fit::internal::join_continuation<Promises...>(std::move(promises)...));
+}
+
+// Describes the status of a future.
+enum class future_state {
+    // The future neither holds a result nor a promise that could produce a result.
+    // An empty future cannot make progress until a promise or result is assigned to it.
+    empty,
+    // The future holds a promise that may eventually produce a result but
+    // it currently doesn't have a result.  The future's promise must be
+    // invoked in order to make progress from this state.
+    pending,
+    // The future holds a successful result.
+    ok,
+    // The future holds an error result.
+    error
+};
+
+// A |fit::future| holds onto a |fit::promise| until it has completed then
+// provides access to its |fit::result|.
+//
+// SYNOPSIS
+//
+// |V| is the type of value produced when the completes successfully.
+// Defaults to |void|.
+//
+// |E| is the type of error produced when the completes with an error.
+// Defaults to |void|.
+//
+// THEORY OF OPERATION
+//
+// A future has a single owner who is responsible for setting its promise
+// or result and driving its execution.  Unlike |fit::promise|, a future retains
+// the result produced by completion of its asynchronous task.  Result retention
+// eases the implementation of combined tasks that need to await the results
+// of other tasks before proceeding.
+//
+// See the example for details.
+//
+// A future can be in one of four states, depending on whether it holds...
+// - a successful result: |fit::future_state::ok|
+// - an error result: |fit::future_state::error|
+// - a promise that may eventually produce a result: |fit::future_state::pending|
+// - neither: |fit::future_state_empty|
+//
+// On its own, a future is "inert"; it only makes progress in response to
+// actions taken by its owner.  The state of the future never changes
+// spontaneously or concurrently.
+//
+// When the future's state is |fit::future_state::empty|, its owner is
+// responsible for setting the future's promise or result thereby moving the
+// future into the pending or ready state.
+//
+// When the future's state is |fit::future_state::pending|, its owner is
+// responsible for calling the future's |operator()| to invoke the promise.
+// If the promise completes and returns a result, the future will transition
+// to the ok or error state according to the result.  The promise itself will
+// then be destroyed since it has fulfilled its purpose.
+//
+// When the future's state is |fit::future_state::ok|, its owner is responsible
+// for consuming the stored value using |value()|, |take_value()|,
+// |result()|, |take_result()|, or |take_ok_result()|.
+//
+// When the future's state is |fit::future_state::error|, its owner is
+// responsible for consuming the stored error using |error()|, |take_error()|,
+// |result()|, |take_result()|, or |take_error_result()|.
+//
+// See also |fit::promise| for more information about promises and their
+// execution.
+//
+// EXAMPLE
+//
+// - https://fuchsia.googlesource.com/zircon/+/master/system/utest/fit/examples/promise_example2.cpp
+template <typename V = void, typename E = void>
+using future = future_impl<promise<V, E>>;
+
+// Future implementation details.
+// See |fit::future| documentation for more information.
+template <typename Promise>
+class future_impl final {
+public:
+    // The type of promise held by the future.
+    using promise_type = Promise;
+
+    // The promise's result type.
+    // Equivalent to fit::result<value_type, error_type>.
+    using result_type = typename Promise::result_type;
+
+    // The type of value produced when the promise completes successfully.
+    // May be void.
+    using value_type = typename Promise::value_type;
+
+    // The type of value produced when the promise completes with an error.
+    // May be void.
+    using error_type = typename Promise::error_type;
+
+    // Creates a future in the empty state.
+    future_impl() = default;
+    future_impl(decltype(nullptr)) {}
+
+    // Creates a future and assigns a promise to compute its result.
+    // If the promise is empty, the future enters the empty state.
+    // Otherwise the future enters the pending state.
+    explicit future_impl(promise_type promise) {
+        if (promise) {
+            state_.template emplace<1>(std::move(promise));
+        }
+    }
+
+    // Creates a future and assigns its result.
+    // If the result is pending, the future enters the empty state.
+    // Otherwise the future enters the ok or error state.
+    explicit future_impl(result_type result) {
+        if (result) {
+            state_.template emplace<2>(std::move(result));
+        }
+    }
+
+    // Moves from another future, leaving the other one in an empty state.
+    future_impl(future_impl&& other)
+        : state_(std::move(other.state_)) {
+        other.state_.template emplace<0>();
+    }
+
+    // Destroys the promise, releasing its promise and result (if any).
+    ~future_impl() = default;
+
+    // Returns the state of the future: empty, pending, ok, or error.
+    future_state state() const {
+        switch (state_.index()) {
+        case 0:
+            return future_state::empty;
+        case 1:
+            return future_state::pending;
+        case 2:
+            return state_.template get<2>().is_ok()
+                       ? future_state::ok
+                       : future_state::error;
+        }
+        __builtin_unreachable();
+    }
+
+    // Returns true if the future's state is not |fit::future_state::empty|:
+    // it either holds a result or holds a promise that can be invoked to make
+    // progress towards obtaining a result.
+    explicit operator bool() const { return !is_empty(); }
+
+    // Returns true if the future's state is |fit::future_state::empty|:
+    // it does not hold a result or a promise so it cannot make progress.
+    bool is_empty() const { return state() == fit::future_state::empty; }
+
+    // Returns true if the future's state is |fit::future_state::pending|:
+    // it does not hold a result yet but it does hold a promise that can be invoked
+    // to make progress towards obtaining a result.
+    bool is_pending() const { return state() == fit::future_state::pending; }
+
+    // Returns true if the future's state is |fit::future_state::ok|:
+    // it holds a value that can be retrieved using |value()|, |take_value()|,
+    // |result()|, |take_result()|, or |take_ok_result()|.
+    bool is_ok() const { return state() == fit::future_state::ok; }
+
+    // Returns true if the future's state is |fit::future_state::error|:
+    // it holds an error that can be retrieved using |error()|, |take_error()|,
+    // |result()|, |take_result()|, or |take_error_result()|.
+    bool is_error() const { return state() == fit::future_state::error; }
+
+    // Returns true if the future's state is either |fit::future_state::ok| or
+    // |fit::future_state::error|.
+    bool is_ready() const { return state_.index() == 2; }
+
+    // Evaluates the future and returns true if its result is ready.
+    // Asserts that the future is not empty.
+    //
+    // If the promise completes and returns a result, the future will transition
+    // to the ok or error state according to the result.  The promise itself will
+    // then be destroyed since it has fulfilled its purpose.
+    bool operator()(fit::context& context) {
+        switch (state_.index()) {
+        case 0:
+            return false;
+        case 1: {
+            result_type result = state_.template get<1>()(context);
+            if (!result)
+                return false;
+            state_.template emplace<2>(std::move(result));
+            return true;
+        }
+        case 2:
+            return true;
+        }
+        __builtin_unreachable();
+    }
+
+    // Gets a reference to the future's promise.
+    // Asserts that the future's state is |fit::future_state::pending|.
+    const promise_type& promise() const {
+        assert(is_pending());
+        return state_.template get<1>();
+    }
+
+    // Takes the future's promise, leaving it in an empty state.
+    // Asserts that the future's state is |fit::future_state::pending|.
+    promise_type take_promise() {
+        assert(is_pending());
+        auto promise = std::move(state_.template get<1>());
+        state_.template emplace<0>();
+        return promise;
+    }
+
+    // Gets a reference to the future's result.
+    // Asserts that the future's state is |fit::future_state::ok| or
+    // |fit::future_state::error|.
+    result_type& result() {
+        assert(is_ready());
+        return state_.template get<2>();
+    }
+    const result_type& result() const {
+        assert(is_ready());
+        return state_.template get<2>();
+    }
+
+    // Takes the future's result, leaving it in an empty state.
+    // Asserts that the future's state is |fit::future_state::ok| or
+    // |fit::future_state::error|.
+    result_type take_result() {
+        assert(is_ready());
+        auto result = std::move(state_.template get<2>());
+        state_.template emplace<0>();
+        return result;
+    }
+
+    // Gets a reference to the future's value.
+    // Asserts that the future's state is |fit::future_state::ok|.
+    template <typename R = value_type,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    R& value() {
+        assert(is_ok());
+        return state_.template get<2>().value();
+    }
+    template <typename R = value_type,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    const R& value() const {
+        assert(is_ok());
+        return state_.template get<2>().value();
+    }
+
+    // Takes the future's value, leaving it in an empty state.
+    // Asserts that the future's state is |fit::future_state::ok|.
+    template <typename R = value_type,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    R take_value() {
+        assert(is_ok());
+        auto value = state_.template get<2>().take_value();
+        state_.template emplace<0>();
+        return value;
+    }
+    ok_result<value_type> take_ok_result() {
+        assert(is_ok());
+        auto result = state_.template get<2>().take_ok_result();
+        state_.template emplace<0>();
+        return result;
+    }
+
+    // Gets a reference to the future's error.
+    // Asserts that the future's state is |fit::future_state::error|.
+    template <typename R = error_type,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    R& error() {
+        assert(is_error());
+        return state_.template get<2>().error();
+    }
+    template <typename R = error_type,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    const R& error() const {
+        assert(is_error());
+        return state_.template get<2>().error();
+    }
+
+    // Takes the future's error, leaving it in an empty state.
+    // Asserts that the future's state is |fit::future_state::error|.
+    template <typename R = error_type,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    R take_error() {
+        assert(is_error());
+        auto error = state_.template get<2>().take_error();
+        state_.template emplace<0>();
+        return error;
+    }
+    error_result<error_type> take_error_result() {
+        assert(is_error());
+        auto result = state_.template get<2>().take_error_result();
+        state_.template emplace<0>();
+        return result;
+    }
+
+    // Move assigns from another future, leaving the other one in an empty state.
+    future_impl& operator=(future_impl&& other) = default;
+
+    // Discards the future's promise and result, leaving it empty.
+    future_impl& operator=(decltype(nullptr)) {
+        state_.template emplace<0>();
+        return *this;
+    }
+
+    // Assigns a promise to compute the future's result.
+    // If the promise is empty, the future enters the empty state.
+    // Otherwise the future enters the pending state.
+    future_impl& operator=(promise_type promise) {
+        if (promise) {
+            state_.template emplace<1>(std::move(promise));
+        } else {
+            state_.template emplace<0>();
+        }
+        return *this;
+    }
+
+    // Assigns the future's result.
+    // If the result is pending, the future enters the empty state.
+    // Otherwise the future enters the ok or error state.
+    future_impl& operator=(result_type result) {
+        if (result) {
+            state_.template emplace<2>(std::move(result));
+        } else {
+            state_.template emplace<0>();
+        }
+        return *this;
+    }
+
+    // Swaps the futures' contents.
+    void swap(future_impl& other) {
+        using std::swap;
+        swap(state_, other.state_);
+    }
+
+    future_impl(const future_impl&) = delete;
+    future_impl& operator=(const future_impl&) = delete;
+
+private:
+    ::fit::internal::variant<::fit::internal::monostate,
+                             promise_type, result_type>
+        state_;
+};
+
+template <typename Promise>
+void swap(future_impl<Promise>& a, future_impl<Promise>& b) {
+    a.swap(b);
+}
+
+template <typename Promise>
+bool operator==(const future_impl<Promise>& f, decltype(nullptr)) {
+    return !f;
+}
+template <typename Promise>
+bool operator==(decltype(nullptr), const future_impl<Promise>& f) {
+    return !f;
+}
+template <typename Promise>
+bool operator!=(const future_impl<Promise>& f, decltype(nullptr)) {
+    return !!f;
+}
+template <typename Promise>
+bool operator!=(decltype(nullptr), const future_impl<Promise>& f) {
+    return !!f;
+}
+
+// Makes a future containing the specified promise.
+template <typename Promise>
+future_impl<Promise> make_future(Promise promise) {
+    return future_impl<Promise>(std::move(promise));
+}
+
+// A pending task holds a |fit::promise| that can be scheduled to run on
+// a |fit::executor| using |fit::executor::schedule_task()|.
+//
+// An executor repeatedly invokes a pending task until it returns true,
+// indicating completion.  Note that the promise's resulting value or error
+// is discarded since it is not meaningful to the executor.  If you need
+// to consume the result, use a combinator such as |fit::pending::then()|
+// to capture it prior to wrapping the promise into a pending task.
+//
+// See documentation of |fit::promise| for more information.
+class pending_task final {
+public:
+    // The type of promise held by this task.
+    using promise_type = promise<void, void>;
+
+    // Creates an empty pending task without a promise.
+    pending_task() = default;
+
+    // Creates a pending task that wraps an already boxed promise that returns
+    // |fit::result<void, void>|.
+    pending_task(promise_type promise)
+        : promise_(std::move(promise)) {}
+
+    // Creates a pending task that wraps any kind of promise, boxed or unboxed,
+    // regardless of its result type and with any context that is assignable
+    // from this task's context type.
+    template <typename Continuation>
+    pending_task(promise_impl<Continuation> promise)
+        : promise_(promise ? promise.discard_result().box() : promise_type()) {}
+
+    pending_task(pending_task&&) = default;
+    pending_task& operator=(pending_task&&) = default;
+
+    // Destroys the pending task, releasing its promise.
+    ~pending_task() = default;
+
+    // Returns true if the pending task is non-empty (has a valid promise).
+    explicit operator bool() const { return !!promise_; }
+
+    // Evaluates the pending task.
+    // If the task completes (returns a non-pending result), the task reverts
+    // to an empty state (because the promise it holds has reverted to an empty
+    // state) and returns true.
+    // It is an error to invoke this method if the pending task is empty.
+    bool operator()(fit::context& context) {
+        return !promise_(context).is_pending();
+    }
+
+    // Extracts the pending task's promise.
+    promise_type take_promise() {
+        return std::move(promise_);
+    }
+
+    pending_task(const pending_task&) = delete;
+    pending_task& operator=(const pending_task&) = delete;
+
+private:
+    promise_type promise_;
+};
+
+// Execution context for an asynchronous task, such as a |fit::promise|,
+// |fit::future|, or |fit::pending_task|.
+//
+// When a |fit::executor| executes a task, it provides the task with an
+// execution context which enables the task to communicate with the
+// executor and manage its own lifecycle.  Specialized executors may subclass
+// |fit::context| and offer additional methods beyond those which are
+// defined here, such as to provide access to platform-specific features
+// supported by the executor.
+//
+// The context provided to a task is only valid within the scope of a single
+// invocation; the task must not retain a reference to the context across
+// invocations.
+//
+// See documentation of |fit::promise| for more information.
+class context {
+public:
+    // Gets the executor that is running the task, never null.
+    virtual class executor* executor() const = 0;
+
+    // Obtains a handle that can be used to resume the task after it has been
+    // suspended.
+    //
+    // Clients should call this method before returning |fit::pending()| from
+    // the task.  See documentation on |fit::executor|.
+    virtual suspended_task suspend_task() = 0;
+
+    // Converts this context to a derived context type.
+    template <typename Context,
+              typename = std::enable_if_t<std::is_base_of<context, Context>::value>>
+    Context& as() & {
+        // TODO(CP-163): We should perform a run-time type check here rather
+        // than blindly casting.  That's why this method exists.
+        return static_cast<Context&>(*this);
+    }
+
+protected:
+    virtual ~context() = default;
+};
+
+// An abstract interface for executing asynchronous tasks, such as promises,
+// represented by |fit::pending_task|.
+//
+// EXECUTING TASKS
+//
+// An executor evaluates its tasks incrementally.  During each iteration
+// of the executor's main loop, it invokes the next task from its ready queue.
+//
+// If the task returns true, then the task is deemed to have completed.
+// The executor removes the tasks from its queue and destroys it since there
+// it nothing left to do.
+//
+// If the task returns false, then the task is deemed to have voluntarily
+// suspended itself pending some event that it is awaiting.  Prior to
+// returning, the task should acquire at least one |fit::suspended_task|
+// handle from its execution context using |fit::context::suspend_task()|
+// to provide a means for the task to be resumed once it can make forward
+// progress again.
+//
+// Once the suspended task is resumed with |fit::suspended_task::resume()|, it
+// is moved back to the ready queue and it will be invoked again during a later
+// iteration of the executor's loop.
+//
+// If all |fit::suspended_task| handles for a given task are destroyed without
+// the task ever being resumed then the task is also destroyed since there
+// would be no way for the task to be resumed from suspension.  We say that
+// such a task has been "abandoned".
+//
+// The executor retains single-ownership of all active and suspended tasks.
+// When the executor is destroyed, all of its remaining tasks are also
+// destroyed.
+//
+// Please read |fit::promise| for a more detailed explanation of the
+// responsibilities of tasks and executors.
+//
+// NOTES FOR IMPLEMENTORS
+//
+// This interface is designed to support a variety of different executor
+// implementations.  For example, one implementation might run its tasks on
+// a single thread whereas another might dispatch them on an event-driven
+// message loop or use a thread pool.
+//
+// See also |fit::single_threaded_executor| for a concrete implementation.
+class executor {
+public:
+    // Destroys the executor along with all of its remaining scheduled tasks
+    // that have yet to complete.
+    virtual ~executor() = default;
+
+    // Schedules a task for eventual execution by the executor.
+    //
+    // This method is thread-safe.
+    virtual void schedule_task(pending_task task) = 0;
+};
+
+// Represents a task that is awaiting resumption.
+//
+// This object has RAII semantics.  If the task is not resumed by at least
+// one holder of its |suspended_task| handles, then it will be destroyed
+// by the executor since it is no longer possible for the task to make
+// progress.  The task is said have been "abandoned".
+//
+// See documentation of |fit::executor| for more information.
+class suspended_task final {
+public:
+    // A handle that grants the capability to resume a suspended task.
+    // Each issued ticket must be individually resolved.
+    using ticket = uint64_t;
+
+    // The resolver mechanism implements a lightweight form of reference
+    // counting for tasks that have been suspended.
+    //
+    // When a suspended task is created in a non-empty state, it receives
+    // a pointer to a resolver interface and a ticket.  The ticket is
+    // a one-time-use handle that represents the task that was suspended
+    // and provides a means to resume it.  The |suspended_task| class ensures
+    // that every ticket is precisely accounted for.
+    //
+    // When |suspended_task::resume_task()| is called on an instance with
+    // a valid ticket, the resolver's |resolve_ticket()| method is invoked
+    // passing the ticket's value along with *true* to resume the task.  This
+    // operation consumes the ticket so the |suspended_task| transitions to
+    // an empty state.  The ticket and resolver cannot be used again by
+    // this |suspended_task| instance.
+    //
+    // Similarly, when |suspended_task::reset()| is called on an instance with
+    // a valid ticket or when the task goes out of scope on such an instance,
+    // the resolver's |resolve_ticket()| method is invoked but this time passes
+    // *false* to not resume the task.  As before, the ticket is consumed.
+    //
+    // Finally, when the |suspended_task| is copied, its ticket is duplicated
+    // using |duplicate_ticket()| resulting in two tickets, both of which
+    // must be individually resolved.
+    //
+    // Resuming a task that has already been resumed has no effect.
+    // Conversely, a task is considered "abandoned" if all of its tickets
+    // have been resolved without it ever being resumed.  See documentation
+    // of |fit::promise| for more information.
+    //
+    // The methods of this class are safe to call from any thread, including
+    // threads that may not be managed by the task's executor.
+    class resolver {
+    public:
+        // Duplicates the provided ticket, returning a new ticket.
+        // Note: The new ticket may have the same numeric value as the
+        //       original ticket but should be considered a distinct instance
+        //       that must be separately resolved.
+        virtual ticket duplicate_ticket(ticket ticket) = 0;
+
+        // Consumes the provided ticket, optionally resuming its associated task.
+        // The provided ticket must not be used again.
+        virtual void resolve_ticket(ticket ticket, bool resume_task) = 0;
+
+    protected:
+        virtual ~resolver() = default;
+    };
+
+    suspended_task()
+        : resolver_(nullptr), ticket_(0) {}
+
+    suspended_task(resolver* resolver, ticket ticket)
+        : resolver_(resolver), ticket_(ticket) {}
+
+    suspended_task(const suspended_task& other);
+    suspended_task(suspended_task&& other);
+
+    // Releases the task without resumption.
+    //
+    // Does nothing if this object does not hold a ticket.
+    ~suspended_task();
+
+    // Returns true if this object holds a ticket for a suspended task.
+    explicit operator bool() const { return resolver_ != nullptr; }
+
+    // Asks the task's executor to resume execution of the suspended task
+    // if it has not already been resumed or completed.  Also releases
+    // the task's ticket as a side-effect.
+    //
+    // Clients should call this method when it is possible for the task to
+    // make progress; for example, because some event the task was
+    // awaiting has occurred.  See documentation on |fit::executor|.
+    //
+    // Does nothing if this object does not hold a ticket.
+    void resume_task() { resolve(true); }
+
+    // Releases the suspended task without resumption.
+    //
+    // Does nothing if this object does not hold a ticket.
+    void reset() { resolve(false); }
+
+    suspended_task& operator=(const suspended_task& other);
+    suspended_task& operator=(suspended_task&& other);
+
+private:
+    void resolve(bool resume_task);
+
+    resolver* resolver_;
+    ticket ticket_;
+};
+
+} // namespace fit
+
+#endif // LIB_FIT_PROMISE_H_
diff --git a/pkg/fit/include/lib/fit/promise_internal.h b/pkg/fit/include/lib/fit/promise_internal.h
new file mode 100644
index 0000000..30e7085
--- /dev/null
+++ b/pkg/fit/include/lib/fit/promise_internal.h
@@ -0,0 +1,600 @@
+// 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 LIB_FIT_PROMISE_INTERNAL_H_
+#define LIB_FIT_PROMISE_INTERNAL_H_
+
+#include <assert.h>
+
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "function.h"
+#include "nullable.h"
+#include "result.h"
+#include "traits.h"
+
+namespace fit {
+
+template <typename Continuation>
+class promise_impl;
+
+template <typename Promise>
+class future_impl;
+
+class context;
+class executor;
+class suspended_task;
+
+namespace internal {
+
+// Determines whether a type is a kind of fit::result.
+template <typename Result>
+struct is_result : std::false_type {};
+template <typename V, typename E>
+struct is_result<::fit::result<V, E>> : std::true_type {};
+
+// Deduces a continuation's result.
+// Also ensures that the continuation has a compatible signature.
+template <typename Continuation,
+          typename = std::enable_if_t<is_result<
+              decltype(std::declval<Continuation&>()(
+                  std::declval<::fit::context&>()))>::value>>
+struct continuation_traits {
+    using type = Continuation;
+    using result_type = decltype(std::declval<Continuation&>()(std::declval<::fit::context&>()));
+};
+template <typename Continuation, typename = fit::void_t<>>
+struct is_continuation : std::false_type {};
+template <typename Continuation>
+struct is_continuation<
+    Continuation,
+    fit::void_t<typename continuation_traits<Continuation>::type>>
+    : std::true_type {};
+
+// Wraps a handler function and adapts its return type to a fit::result
+// via its specializations.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          typename ReturnType = typename callable_traits<Handler>::return_type,
+          bool callable_result = ::fit::is_callable<ReturnType>::value>
+class result_adapter final {
+    // This expression always evaluates to false but depends on the template
+    // type parameters so that it only gets evaluated when the template is
+    // expanded.  If we simply wrote "false", the compiler would raise the
+    // static assertion failure as soon as it encountered the statement.
+    template <typename T>
+    struct check_result { static constexpr bool value = false; };
+    static_assert(
+        check_result<ReturnType>::value,
+        "The provided handler's result type was expected to be "
+        "fit::result<V, E>, fit::ok_result<V>, fit::error_result<E>, "
+        "fit::pending_result, void, or a continuation with the signature "
+        "fit::result<V, E>(fit::context&).  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+};
+
+// Supports handlers that return void.
+template <typename Handler, typename DefaultV, typename DefaultE>
+class result_adapter<Handler, DefaultV, DefaultE, void, false> final {
+public:
+    using result_type = ::fit::result<DefaultV, DefaultE>;
+
+    explicit result_adapter(Handler handler)
+        : handler_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        handler_(std::forward<Args>(args)...);
+        return ::fit::ok();
+    }
+
+private:
+    Handler handler_;
+};
+
+// Supports handlers that return pending_result.
+template <typename Handler, typename DefaultV, typename DefaultE>
+class result_adapter<Handler, DefaultV, DefaultE, ::fit::pending_result, false> final {
+public:
+    using result_type = ::fit::result<DefaultV, DefaultE>;
+
+    explicit result_adapter(Handler handler)
+        : handler_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        return handler_(std::forward<Args>(args)...);
+    }
+
+private:
+    Handler handler_;
+};
+
+// Supports handlers that return ok_result<V>.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          typename V>
+class result_adapter<Handler, DefaultV, DefaultE, ::fit::ok_result<V>, false> final {
+public:
+    using result_type = ::fit::result<V, DefaultE>;
+
+    explicit result_adapter(Handler handler)
+        : handler_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        return handler_(std::forward<Args>(args)...);
+    }
+
+private:
+    Handler handler_;
+};
+
+// Supports handlers that return error_result<E>.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          typename E>
+class result_adapter<Handler, DefaultV, DefaultE, ::fit::error_result<E>, false> final {
+public:
+    using result_type = ::fit::result<DefaultV, E>;
+
+    explicit result_adapter(Handler handler)
+        : handler_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        return handler_(std::forward<Args>(args)...);
+    }
+
+private:
+    Handler handler_;
+};
+
+// Supports handlers that return result<V, E>.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          typename V, typename E>
+class result_adapter<Handler, DefaultV, DefaultE, ::fit::result<V, E>, false> final {
+public:
+    using result_type = ::fit::result<V, E>;
+
+    explicit result_adapter(Handler handler)
+        : handler_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        return handler_(std::forward<Args>(args)...);
+    }
+
+private:
+    Handler handler_;
+};
+
+// Supports handlers that return continuations or promises.
+// This works for any callable whose signature is:
+//     fit::result<...>(fit::context&)
+template <typename Handler, typename DefaultV, typename DefaultE,
+          typename ReturnType>
+class result_adapter<Handler, DefaultV, DefaultE, ReturnType, true> final {
+    // If the handler doesn't actually return a continuation then the
+    // compilation will fail here which is slightly easier to diagnose
+    // than if we dropped the result_adapter specialization entirely.
+    using continuation_traits = continuation_traits<ReturnType>;
+    using continuation_type = typename continuation_traits::type;
+
+public:
+    using result_type = typename continuation_traits::result_type;
+
+    explicit result_adapter(Handler handler)
+        : handler_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        if (handler_) {
+            continuation_ = (*handler_)(std::forward<Args>(args)...);
+            handler_.reset();
+        }
+        if (!continuation_) {
+            return ::fit::pending();
+        }
+        return (*continuation_)(context);
+    }
+
+private:
+    ::fit::nullable<Handler> handler_;
+    ::fit::nullable<continuation_type> continuation_;
+};
+
+// Wraps a handler that may or may not have a fit::context& as first argument.
+// This is determined by checking the argument count.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          size_t num_args = 0,
+          int excess_args =
+              (static_cast<int>(
+                   ::fit::callable_traits<Handler>::args::size) -
+               static_cast<int>(num_args))>
+class context_adapter final {
+    static_assert(
+        excess_args >= 0,
+        "The provided handler has too few arguments.  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+    static_assert(
+        excess_args <= 1,
+        "The provided handler has too many arguments.  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+};
+
+// Supports handlers without a context argument.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          size_t num_args>
+class context_adapter<Handler, DefaultV, DefaultE, num_args, 0> final {
+    using base_type = result_adapter<Handler, DefaultV, DefaultE>;
+
+public:
+    using result_type = typename base_type::result_type;
+    static constexpr size_t next_arg_index = 0;
+
+    explicit context_adapter(Handler handler)
+        : base_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        return base_.template call<Args...>(context, std::forward<Args>(args)...);
+    }
+
+private:
+    base_type base_;
+};
+
+// Supports handlers with a context argument.
+template <typename Handler, typename DefaultV, typename DefaultE,
+          size_t num_args>
+class context_adapter<Handler, DefaultV, DefaultE, num_args, 1> final {
+    using base_type = result_adapter<Handler, DefaultV, DefaultE>;
+    using context_arg_type =
+        typename ::fit::callable_traits<Handler>::args::template at<0>;
+    static_assert(
+        std::is_same<context_arg_type, ::fit::context&>::value,
+        "The provided handler's first argument was expected to be of type "
+        "fit::context& based on the number of arguments it has.  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+
+public:
+    using result_type = typename base_type::result_type;
+    static constexpr size_t next_arg_index = 1;
+
+    explicit context_adapter(Handler handler)
+        : base_(std::move(handler)) {}
+
+    template <typename... Args>
+    result_type call(::fit::context& context, Args... args) {
+        return base_.template call<::fit::context&, Args...>(
+            context, context, std::forward<Args>(args)...);
+    }
+
+private:
+    base_type base_;
+};
+
+// Wraps a handler that may accept a context argument.
+template <typename Handler>
+class context_handler_invoker final {
+    using base_type = context_adapter<Handler, void, void, 0>;
+
+public:
+    using result_type = typename base_type::result_type;
+
+    explicit context_handler_invoker(Handler handler)
+        : base_(std::move(handler)) {}
+
+    result_type operator()(::fit::context& context) {
+        return base_.template call<>(context);
+    }
+
+private:
+    base_type base_;
+};
+
+// Wraps a handler that may accept a context and result argument.
+template <typename Handler, typename PriorResult>
+class result_handler_invoker final {
+    using base_type = context_adapter<Handler, void, void, 1>;
+    using result_arg_type =
+        typename ::fit::callable_traits<Handler>::args::template at<
+            base_type::next_arg_index>;
+    static_assert(
+        (std::is_same<result_arg_type, PriorResult>::value &&
+         std::is_copy_constructible<result_arg_type>::value) ||
+            std::is_same<result_arg_type, PriorResult&>::value ||
+            std::is_same<result_arg_type, const PriorResult&>::value,
+        "The provided handler's last argument was expected to be of type "
+        "fit::result<V, E>&, const fit::result<V, E>&, or fit::result<V, E> "
+        "(if the result is copy-constructible).  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+
+public:
+    using result_type = typename base_type::result_type;
+
+    explicit result_handler_invoker(Handler handler)
+        : base_(std::move(handler)) {}
+
+    result_type operator()(::fit::context& context, PriorResult& result) {
+        return base_.template call<PriorResult&>(context, result);
+    }
+
+private:
+    base_type base_;
+};
+
+// Wraps a handler that may accept a context and value argument.
+template <typename Handler, typename PriorResult,
+          typename V = typename PriorResult::value_type>
+class value_handler_invoker final {
+    using base_type = context_adapter<Handler,
+                                      void, typename PriorResult::error_type, 1>;
+    using value_arg_type =
+        typename ::fit::callable_traits<Handler>::args::template at<
+            base_type::next_arg_index>;
+    static_assert(
+        (std::is_same<value_arg_type, V>::value &&
+         std::is_copy_constructible<value_arg_type>::value) ||
+            std::is_same<value_arg_type, V&>::value ||
+            std::is_same<value_arg_type, const V&>::value,
+        "The provided handler's last argument was expected to be of type "
+        "V&, const V&, or V (if the value is copy-constructible).  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+
+public:
+    using result_type = typename base_type::result_type;
+
+    explicit value_handler_invoker(Handler handler)
+        : base_(std::move(handler)) {}
+
+    result_type operator()(::fit::context& context, PriorResult& result) {
+        return base_.template call<V&>(context, result.value());
+    }
+
+private:
+    base_type base_;
+};
+
+// Specialization for void value.
+template <typename Handler, typename PriorResult>
+class value_handler_invoker<Handler, PriorResult, void> final {
+    using base_type = context_adapter<Handler,
+                                      void, typename PriorResult::error_type, 0>;
+
+public:
+    using result_type = typename base_type::result_type;
+
+    explicit value_handler_invoker(Handler handler)
+        : base_(std::move(handler)) {}
+
+    result_type operator()(::fit::context& context, PriorResult& result) {
+        return base_.template call<>(context);
+    }
+
+private:
+    base_type base_;
+};
+
+// Wraps a handler that may accept a context and error argument.
+template <typename Handler, typename PriorResult,
+          typename E = typename PriorResult::error_type>
+class error_handler_invoker final {
+    using base_type = context_adapter<Handler,
+                                      typename PriorResult::value_type, void, 1>;
+    using error_arg_type =
+        typename ::fit::callable_traits<Handler>::args::template at<
+            base_type::next_arg_index>;
+    static_assert(
+        (std::is_same<error_arg_type, E>::value &&
+         std::is_copy_constructible<error_arg_type>::value) ||
+            std::is_same<error_arg_type, E&>::value ||
+            std::is_same<error_arg_type, const E&>::value,
+        "The provided handler's last argument was expected to be of type "
+        "E&, const E&, or E (if the error is copy-constructible).  "
+        "Please refer to the combinator's documentation for a list of "
+        "supported handler function signatures.");
+
+public:
+    using result_type = typename base_type::result_type;
+
+    explicit error_handler_invoker(Handler handler)
+        : base_(std::move(handler)) {}
+
+    result_type operator()(::fit::context& context, PriorResult& result) {
+        return base_.template call<E&>(context, result.error());
+    }
+
+private:
+    base_type base_;
+};
+
+// Specialization for void error.
+template <typename Handler, typename PriorResult>
+class error_handler_invoker<Handler, PriorResult, void> final {
+    using base_type = context_adapter<Handler,
+                                      typename PriorResult::value_type, void, 0>;
+
+public:
+    using result_type = typename base_type::result_type;
+
+    explicit error_handler_invoker(Handler handler)
+        : base_(std::move(handler)) {}
+
+    result_type operator()(::fit::context& context, PriorResult& result) {
+        return base_.template call<>(context);
+    }
+
+private:
+    base_type base_;
+};
+
+// The continuation produced by |fit::promise::then()|.
+template <typename PriorPromise, typename ResultHandler>
+class then_continuation final {
+    using invoker_type = ::fit::internal::result_handler_invoker<
+        ResultHandler, typename PriorPromise::result_type>;
+
+public:
+    then_continuation(PriorPromise prior_promise, ResultHandler handler)
+        : prior_(std::move(prior_promise)),
+          invoker_(std::move(handler)) {}
+
+    typename invoker_type::result_type operator()(::fit::context& context) {
+        if (!prior_(context))
+            return ::fit::pending();
+        return invoker_(context, prior_.result());
+    }
+
+private:
+    future_impl<PriorPromise> prior_;
+    invoker_type invoker_;
+};
+
+// The continuation produced by |fit::promise::and_then()|.
+template <typename PriorPromise, typename ValueHandler>
+class and_then_continuation final {
+    using invoker_type = ::fit::internal::value_handler_invoker<
+        ValueHandler, typename PriorPromise::result_type>;
+
+public:
+    and_then_continuation(PriorPromise prior_promise, ValueHandler handler)
+        : prior_(std::move(prior_promise)),
+          invoker_(std::move(handler)) {}
+
+    typename invoker_type::result_type operator()(::fit::context& context) {
+        if (!prior_(context))
+            return ::fit::pending();
+        if (prior_.is_error())
+            return prior_.take_error_result();
+        return invoker_(context, prior_.result());
+    }
+
+private:
+    future_impl<PriorPromise> prior_;
+    invoker_type invoker_;
+};
+
+// The continuation produced by |fit::promise::or_else()|.
+template <typename PriorPromise, typename ErrorHandler>
+class or_else_continuation final {
+    using invoker_type = ::fit::internal::error_handler_invoker<
+        ErrorHandler, typename PriorPromise::result_type>;
+
+public:
+    or_else_continuation(PriorPromise prior_promise, ErrorHandler handler)
+        : prior_(std::move(prior_promise)),
+          invoker_(std::move(handler)) {}
+
+    typename invoker_type::result_type operator()(::fit::context& context) {
+        if (!prior_(context))
+            return ::fit::pending();
+        if (prior_.is_ok())
+            return prior_.take_ok_result();
+        return invoker_(context, prior_.result());
+    }
+
+private:
+    future_impl<PriorPromise> prior_;
+    invoker_type invoker_;
+};
+
+// The continuation produced by |fit::promise::inspect()|.
+template <typename PriorPromise, typename InspectHandler>
+class inspect_continuation final {
+    using invoker_type = ::fit::internal::result_handler_invoker<
+        InspectHandler, typename PriorPromise::result_type>;
+
+public:
+    inspect_continuation(PriorPromise prior_promise, InspectHandler handler)
+        : prior_(std::move(prior_promise)),
+          invoker_(std::move(handler)) {}
+
+    typename PriorPromise::result_type operator()(::fit::context& context) {
+        typename PriorPromise::result_type result = prior_(context);
+        if (result)
+            invoker_(context, result);
+        return result;
+    }
+
+private:
+    PriorPromise prior_;
+    invoker_type invoker_;
+};
+
+// The continuation produced by |fit::promise::discard_result()|.
+template <typename PriorPromise>
+class discard_result_continuation final {
+public:
+    explicit discard_result_continuation(PriorPromise prior_promise)
+        : prior_(std::move(prior_promise)) {}
+
+    fit::result<> operator()(::fit::context& context) {
+        if (!prior_(context))
+            return ::fit::pending();
+        return ::fit::ok();
+    }
+
+private:
+    PriorPromise prior_;
+};
+
+// The continuation produced by |make_promise()|.
+// This turns out to be equivalent to a context handler invoker.
+template <typename PromiseHandler>
+using promise_continuation = context_handler_invoker<PromiseHandler>;
+
+// Returns true if all arguments are true or if there are none.
+inline bool all_true() {
+    return true;
+}
+template <typename... Ts>
+inline bool all_true(bool value, Ts... values) {
+    return value & all_true(values...);
+}
+
+// The continuation produced by |join_promises()|.
+template <typename... Promises>
+class join_continuation final {
+public:
+    explicit join_continuation(Promises... promises)
+        : promises_(std::make_tuple(std::move(promises)...)) {}
+
+    ::fit::result<std::tuple<typename Promises::result_type...>> operator()(
+        ::fit::context& context) {
+        return evaluate(context, std::index_sequence_for<Promises...>{});
+    }
+
+private:
+    template <size_t... i>
+    ::fit::result<std::tuple<typename Promises::result_type...>> evaluate(
+        ::fit::context& context, std::index_sequence<i...>) {
+        bool done = all_true(std::get<i>(promises_)(context)...);
+        if (!done)
+            return ::fit::pending();
+        return ::fit::ok(std::make_tuple(std::get<i>(promises_).take_result()...));
+    }
+
+    std::tuple<future_impl<Promises>...> promises_;
+};
+
+} // namespace internal
+
+template <typename PromiseHandler>
+inline promise_impl<::fit::internal::promise_continuation<PromiseHandler>>
+make_promise(PromiseHandler handler);
+
+template <typename Continuation>
+inline promise_impl<Continuation> make_promise_with_continuation(
+    Continuation continuation);
+
+} // namespace fit
+
+#endif // LIB_FIT_PROMISE_INTERNAL_H_
diff --git a/pkg/fit/include/lib/fit/result.h b/pkg/fit/include/lib/fit/result.h
new file mode 100644
index 0000000..eb89baf
--- /dev/null
+++ b/pkg/fit/include/lib/fit/result.h
@@ -0,0 +1,270 @@
+// 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 LIB_FIT_RESULT_H_
+#define LIB_FIT_RESULT_H_
+
+#include <assert.h>
+
+#include <new>
+#include <type_traits>
+#include <utility>
+
+#include "traits.h"
+#include "variant.h"
+
+namespace fit {
+
+// Represents the intermediate state of a result that has not yet completed.
+struct pending_result final {};
+
+// Returns an value that represents a pending result.
+constexpr inline pending_result pending() {
+    return pending_result{};
+}
+
+// Represents the result of a successful task.
+template <typename V = void>
+struct ok_result final {
+    using value_type = V;
+
+    explicit constexpr ok_result(V value)
+        : value(std::move(value)) {}
+
+    V value;
+};
+template <>
+struct ok_result<void> {
+    using value_type = void;
+};
+
+// Wraps the result of a successful task as an |ok_result<T>|.
+template <typename V>
+constexpr inline ok_result<V> ok(V value) {
+    return ok_result<V>(std::move(value));
+}
+constexpr inline ok_result<> ok() {
+    return ok_result<>{};
+}
+
+// Represents the result of a failed task.
+template <typename E = void>
+struct error_result final {
+    using error_type = E;
+
+    explicit constexpr error_result(E error)
+        : error(std::move(error)) {}
+
+    E error;
+};
+template <>
+struct error_result<void> {
+    using error_type = void;
+};
+
+// Wraps the result of a failed task as an |error_result<T>|.
+template <typename E>
+constexpr inline error_result<E> error(E error) {
+    return error_result<E>(std::move(error));
+}
+constexpr inline error_result<> error() {
+    return error_result<>{};
+}
+
+// Describes the status of a task's result.
+enum class result_state {
+    // The task is still in progress.
+    pending,
+    // The task completed successfully.
+    ok,
+    // The task failed.
+    error
+};
+
+// Represents the result of a task which may have succeeded, failed,
+// or still be in progress.
+//
+// Use |fit::pending()|, |fit::ok<T>()|, or |fit::error<T>| to initialize
+// the result.
+//
+// |V| is the type of value produced when the completes successfully.
+// Defaults to |void|.
+//
+// |E| is the type of error produced when the completes with an error.
+// Defaults to |void|.
+//
+// EXAMPLE:
+//
+// fit::result<int, std::string> divide(int dividend, int divisor) {
+//     if (divisor == 0)
+//         return fit::error<std::string>("divide by zero");
+//     return fit::ok(dividend / divisor);
+// }
+//
+// int try_divide(int dividend, int divisor) {
+//     auto result = divide(dividend, divisor);
+//     if (result.is_ok()) {
+//         printf("%d / %d = %d\n", dividend, divisor, result.value());
+//         return result.value();
+//     }
+//     printf("%d / %d: ERROR %s\n", dividend, divisor, result.error().c_str());
+//     return -999;
+// }
+//
+// EXAMPLE WITH VOID RESULT VALUE AND ERROR:
+//
+// fit::result<> open(std::string secret) {
+//     printf("guessing \"%s\"\n", secret.c_str());
+//     if (secret == "sesame") {
+//         return fit::ok();
+//         puts("yes!");
+//     }
+//     puts("no.");
+//     return fit::error();
+// }
+//
+// bool guess_combination() {
+//     return open("friend") || open("sesame") || open("I give up");
+// }
+template <typename V = void, typename E = void>
+class result final {
+public:
+    using value_type = V;
+    using error_type = E;
+
+    // Creates a pending result.
+    constexpr result() = default;
+    constexpr result(pending_result) {}
+
+    // Creates an ok result.
+    constexpr result(ok_result<V> result)
+        : state_(::fit::internal::in_place_index<1>, std::move(result)) {}
+    template <typename OtherV,
+              typename = std::enable_if_t<std::is_constructible<V, OtherV>::value>>
+    constexpr result(ok_result<OtherV> other)
+        : state_(::fit::internal::in_place_index<1>,
+                 fit::ok<V>(std::move(other.value))) {}
+
+    // Creates an error result.
+    constexpr result(error_result<E> result)
+        : state_(::fit::internal::in_place_index<2>, std::move(result)) {}
+    template <typename OtherE,
+              typename = std::enable_if_t<std::is_constructible<E, OtherE>::value>>
+    constexpr result(error_result<OtherE> other)
+        : state_(::fit::internal::in_place_index<2>,
+                 fit::error<E>(std::move(other.error))) {}
+
+    // Copies another result (if copyable).
+    result(const result& other) = default;
+
+    // Moves from another result, leaving the other one in a pending state.
+    result(result&& other)
+        : state_(std::move(other.state_)) {
+        other.reset();
+    }
+
+    ~result() = default;
+
+    // Returns the state of the task's result: pending, ok, or error.
+    constexpr result_state state() const {
+        return static_cast<result_state>(state_.index());
+    }
+
+    // Returns true if the result is not pending.
+    constexpr explicit operator bool() const {
+        return !is_pending();
+    }
+
+    // Returns true if the task is still in progress.
+    constexpr bool is_pending() const {
+        return state() == result_state::pending;
+    }
+
+    // Returns true if the task succeeded.
+    constexpr bool is_ok() const {
+        return state() == result_state::ok;
+    }
+
+    // Returns true if the task failed.
+    constexpr bool is_error() const {
+        return state() == result_state::error;
+    }
+
+    // Gets the result's value.
+    // Asserts that the result's state is |fit::result_state::ok|.
+    template <typename R = V,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    constexpr R& value() {
+        return state_.template get<1>().value;
+    }
+    template <typename R = V,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    constexpr const R& value() const {
+        return state_.template get<1>().value;
+    }
+
+    // Takes the result's value, leaving it in a pending state.
+    // Asserts that the result's state is |fit::result_state::ok|.
+    template <typename R = V,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    R take_value() {
+        auto value = std::move(state_.template get<1>().value);
+        reset();
+        return value;
+    }
+    ok_result<V> take_ok_result() {
+        auto result = std::move(state_.template get<1>());
+        reset();
+        return result;
+    }
+
+    // Gets a reference to the result's error.
+    // Asserts that the result's state is |fit::result_state::error|.
+    template <typename R = E,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    constexpr R& error() {
+        return state_.template get<2>().error;
+    }
+    template <typename R = E,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    constexpr const R& error() const {
+        return state_.template get<2>().error;
+    }
+
+    // Takes the result's error, leaving it in a pending state.
+    // Asserts that the result's state is |fit::result_state::error|.
+    template <typename R = E,
+              typename = std::enable_if_t<!std::is_void<R>::value>>
+    R take_error() {
+        auto error = std::move(state_.template get<2>().error);
+        reset();
+        return error;
+    }
+    error_result<E> take_error_result() {
+        auto result = std::move(state_.template get<2>());
+        reset();
+        return result;
+    }
+
+    // Assigns from another result (if copyable).
+    result& operator=(const result& other) = default;
+
+    // Moves from another result, leaving the other one in a pending state.
+    result& operator=(result&& other) {
+        state_ = std::move(other.state_);
+        other.reset();
+        return *this;
+    }
+
+private:
+    void reset() { state_.template emplace<0>(); }
+
+    ::fit::internal::variant<
+        ::fit::internal::monostate, ok_result<V>, error_result<E>>
+        state_;
+};
+
+} // namespace fit
+
+#endif // LIB_FIT_RESULT_H_
diff --git a/pkg/fit/include/lib/fit/scheduler.h b/pkg/fit/include/lib/fit/scheduler.h
new file mode 100644
index 0000000..d4e16ba
--- /dev/null
+++ b/pkg/fit/include/lib/fit/scheduler.h
@@ -0,0 +1,154 @@
+// 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 LIB_FIT_SCHEDULER_H_
+#define LIB_FIT_SCHEDULER_H_
+
+#include <map>
+#include <queue>
+#include <utility>
+
+#include "promise.h"
+
+namespace fit {
+namespace subtle {
+
+// Keeps track of runnable and suspended tasks.
+// This is a low-level building block for implementing executors.
+// For a concrete implementation, see |fit::single_threaded_executor|.
+//
+// Instances of this object are not thread-safe.  Its client is responsible
+// for providing all necessary synchronization.
+class scheduler final {
+public:
+    using task_queue = std::queue<pending_task>;
+    using ref_count = uint32_t;
+
+    scheduler();
+    ~scheduler();
+
+    // Adds a task to the runnable queue.
+    //
+    // Preconditions:
+    // - |task| must be non-empty
+    void schedule_task(pending_task task);
+
+    // Obtains a new ticket with a ref-count of |initial_refs|.
+    // The executor must eventually call |finalize_ticket()| to update the
+    // state of the ticket.
+    //
+    // Preconditions:
+    // - |initial_refs| must be at least 1
+    suspended_task::ticket obtain_ticket(ref_count initial_refs = 1);
+
+    // Updates a ticket after one run of a task's continuation according
+    // to the state of the task after its run.  The executor must call this
+    // method after calling |obtain_ticket()| to indicate the disposition of
+    // the task for which the ticket was obtained.
+    //
+    // Passing an empty |task| indicates that the task has completed so it
+    // does not need to be resumed.
+    //
+    // Passing a non-empty |task| indicates that the task returned a pending
+    // result and may need to be suspended depending on the current state
+    // of the ticket.
+    // - If the ticket has already been resumed, moves |task| into the
+    //   runnable queue.
+    // - Otherwise, if the ticket still has a non-zero ref-count, moves |task|
+    //   into the suspended task table.
+    // - Otherwise, considers the task abandoned and the caller retains
+    //   ownership of |task|.
+    //
+    // Preconditions:
+    // - |task| must be non-null (may be empty)
+    // - the ticket must not have already been finalized
+    void finalize_ticket(suspended_task::ticket ticket, pending_task* task);
+
+    // Increments the ticket's ref-count.
+    //
+    // Preconditions:
+    // - the ticket's ref-count must be non-zero (positive)
+    void duplicate_ticket(suspended_task::ticket ticket);
+
+    // Decrements the ticket's ref-count.
+    //
+    // If the task's ref-count reaches 0 and has an associated task that
+    // has not already been resumed, returns the associated task back
+    // to the caller.
+    // Otherwise, returns an empty task.
+    //
+    // Preconditions:
+    // - the ticket's ref-count must be non-zero (positive)
+    pending_task release_ticket(suspended_task::ticket ticket);
+
+    // Resumes a task and decrements the ticket's ref-count.
+    //
+    // If the ticket has an associated task that has not already been resumed,
+    // moves its associated task to the runnable queue and returns true.
+    // Otherwise, returns false.
+    //
+    // Preconditions:
+    // - the ticket's ref-count must be non-zero (positive)
+    bool resume_task_with_ticket(suspended_task::ticket ticket);
+
+    // Takes all tasks in the runnable queue.
+    //
+    // Preconditions:
+    // - |tasks| must be non-null and empty
+    void take_runnable_tasks(task_queue* tasks);
+
+    // Takes all remaining tasks, regardless of whether they are runnable
+    // or suspended.
+    //
+    // This operation is useful when shutting down an executor.
+    //
+    // Preconditions:
+    // - |tasks| must be non-null and empty
+    void take_all_tasks(task_queue* tasks);
+
+    // Returns true if there are any runnable tasks.
+    bool has_runnable_tasks() const { return !runnable_tasks_.empty(); }
+
+    // Returns true if there are any suspended tasks that have yet to
+    // be resumed.
+    bool has_suspended_tasks() const { return suspended_task_count_ > 0; }
+
+    // Returns true if there are any tickets that have yet to be finalized,
+    // released, or resumed.
+    bool has_outstanding_tickets() const { return !tickets_.empty(); }
+
+    scheduler(const scheduler&) = delete;
+    scheduler(scheduler&&) = delete;
+    scheduler& operator=(const scheduler&) = delete;
+    scheduler& operator=(scheduler&&) = delete;
+
+private:
+    struct ticket_record {
+        ticket_record(ref_count initial_refs)
+            : ref_count(initial_refs), was_resumed(false) {}
+
+        // The current reference count.
+        ref_count ref_count;
+
+        // True if the task has been resumed using |resume_task_with_ticket()|.
+        bool was_resumed;
+
+        // The task is initially empty when the ticket is obtained.
+        // It is later set to non-empty if the task needs to be suspended when
+        // the ticket is finalized.  It becomes empty again when the task
+        // is moved into the runnable queue, released, or taken.
+        pending_task task;
+    };
+    using ticket_map = std::map<suspended_task::ticket, ticket_record>;
+
+    task_queue runnable_tasks_;
+    ticket_map tickets_;
+    uint64_t suspended_task_count_ = 0;
+    suspended_task::ticket next_ticket_ = 1;
+};
+
+} // namespace subtle
+} // namespace fit
+
+#endif // LIB_FIT_SCHEDULER_H_
diff --git a/pkg/fit/include/lib/fit/sequencer.h b/pkg/fit/include/lib/fit/sequencer.h
new file mode 100644
index 0000000..509cd8e
--- /dev/null
+++ b/pkg/fit/include/lib/fit/sequencer.h
@@ -0,0 +1,85 @@
+// 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 LIB_FIT_SEQUENCER_H_
+#define LIB_FIT_SEQUENCER_H_
+
+#include <assert.h>
+
+#include <mutex>
+
+#include "bridge.h"
+#include "thread_safety.h"
+
+namespace fit {
+
+// A sequencer imposes a first-in-first-out sequential execution order onto a
+// sequence of promises.  Each successively enqueued promise remains suspended
+// until all previously enqueued promises complete or are abandoned.
+//
+// |fit::sequencer| is designed to be used either on its own or chained
+// onto a promise using |fit::promise::wrap_with()|.
+//
+// EXAMPLE
+//
+//     // This wrapper type is intended to be applied to
+//     // a sequence of promises so we store it in a variable.
+//     fit::sequencer seq;
+//
+//     // This task consists of some amount of work that must be
+//     // completed sequentially followed by other work that can
+//     // happen in any order.  We use |wrap_with()| to wrap the
+//     // sequential work with the sequencer.
+//     fit::promise<> perform_complex_task() {
+//         return fit::make_promise([] { /* do sequential work */ })
+//             .then([] (fit::result<> result) { /* this will also be wrapped */ })
+//             .wrap_with(seq)
+//             .then([] (fit::result<> result) { /* do more work */ });
+//     }
+//
+class sequencer final {
+public:
+    sequencer();
+    ~sequencer();
+
+    // Returns a new promise which will invoke |promise| after all previously
+    // enqueued promises on this sequencer have completed or been abandoned.
+    //
+    // This method is thread-safe.
+    template <typename Promise>
+    decltype(auto) wrap(Promise promise) {
+        assert(promise);
+
+        fit::bridge<> bridge;
+        fit::consumer<> prior = swap_prior(std::move(bridge.consumer()));
+        return prior.promise_or(fit::ok())
+            .then([promise = std::move(promise),
+                   completer = std::move(bridge.completer())](
+                      fit::context& context, fit::result<>) mutable {
+                // This handler will run once the completer associated
+                // with the |prior| promise is abandoned.  Once the promise
+                // has finished, both the promise and completer will be
+                // destroyed thereby causing the next promise chained onto
+                // the |bridge|'s associated consumer to become runnable.
+                return promise(context);
+            });
+    }
+
+    sequencer(const sequencer&) = delete;
+    sequencer(sequencer&&) = delete;
+    sequencer& operator=(const sequencer&) = delete;
+    sequencer& operator=(sequencer&&) = delete;
+
+private:
+    fit::consumer<> swap_prior(fit::consumer<> new_prior);
+
+    std::mutex mutex_;
+
+    // Holds the consumption capability of the most recently wrapped promise.
+    fit::consumer<> prior_ FIT_GUARDED(mutex_);
+};
+
+} // namespace fit
+
+#endif // LIB_FIT_SEQUENCER_H_
diff --git a/pkg/fit/include/lib/fit/single_threaded_executor.h b/pkg/fit/include/lib/fit/single_threaded_executor.h
new file mode 100644
index 0000000..7ec4875
--- /dev/null
+++ b/pkg/fit/include/lib/fit/single_threaded_executor.h
@@ -0,0 +1,85 @@
+// 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 LIB_FIT_SINGLE_THREADED_EXECUTOR_H_
+#define LIB_FIT_SINGLE_THREADED_EXECUTOR_H_
+
+#include <utility>
+
+#include "promise.h"
+#include "scheduler.h"
+
+namespace fit {
+
+// A simple platform-independent single-threaded asynchronous task executor.
+//
+// This implementation is designed for use when writing simple single-threaded
+// platform-independent applications.  It may be less efficient or provide
+// fewer features than more specialized or platform-dependent executors.
+//
+// See documentation of |fit::promise| for more information.
+class single_threaded_executor final : public executor {
+public:
+    single_threaded_executor();
+
+    // Destroys the executor along with all of its remaining scheduled tasks
+    // that have yet to complete.
+    ~single_threaded_executor() override;
+
+    // Schedules a task for eventual execution by the executor.
+    //
+    // This method is thread-safe.
+    void schedule_task(pending_task task) override;
+
+    // Runs all scheduled tasks (including additional tasks scheduled while
+    // they run) until none remain.
+    //
+    // This method is thread-safe but must only be called on at most one
+    // thread at a time.
+    void run();
+
+    single_threaded_executor(const single_threaded_executor&) = delete;
+    single_threaded_executor(single_threaded_executor&&) = delete;
+    single_threaded_executor& operator=(const single_threaded_executor&) = delete;
+    single_threaded_executor& operator=(single_threaded_executor&&) = delete;
+
+private:
+    class dispatcher_impl;
+
+    // The task context for tasks run by the executor.
+    class context_impl final : public context {
+    public:
+        explicit context_impl(single_threaded_executor* executor);
+        ~context_impl() override;
+
+        single_threaded_executor* executor() const override;
+        suspended_task suspend_task() override;
+
+    private:
+        single_threaded_executor* const executor_;
+    };
+
+    context_impl context_;
+    dispatcher_impl* const dispatcher_;
+};
+
+// Creates a new |fit::single_threaded_executor|, schedules a promise as a task,
+// runs all of the executor's scheduled tasks until none remain, then returns
+// the promise's result.
+template <typename Continuation>
+static typename promise_impl<Continuation>::result_type
+run_single_threaded(promise_impl<Continuation> promise) {
+    using result_type = typename promise_impl<Continuation>::result_type;
+    single_threaded_executor exec;
+    result_type saved_result;
+    exec.schedule_task(promise.then([&saved_result](result_type result) {
+        saved_result = std::move(result);
+    }));
+    exec.run();
+    return saved_result;
+}
+
+} // namespace fit
+
+#endif // LIB_FIT_SINGLE_THREADED_EXECUTOR_H_
diff --git a/pkg/fit/include/lib/fit/thread_safety.h b/pkg/fit/include/lib/fit/thread_safety.h
new file mode 100644
index 0000000..8ffc5ad
--- /dev/null
+++ b/pkg/fit/include/lib/fit/thread_safety.h
@@ -0,0 +1,30 @@
+// 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 LIB_FIT_THREAD_SAFETY_H_
+#define LIB_FIT_THREAD_SAFETY_H_
+
+// Thread-safety annotations.
+// Currently these are only supported on Clang.
+#if defined(__clang__) &&                                \
+    defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && \
+    __has_attribute(acquire_capability)
+#define FIT_THREAD_ANNOTATION(x) __attribute__((x))
+#else
+#define FIT_THREAD_ANNOTATION(x)
+#endif
+#define FIT_CAPABILITY(x) FIT_THREAD_ANNOTATION(__capability__(x))
+#define FIT_GUARDED(x) FIT_THREAD_ANNOTATION(__guarded_by__(x))
+#define FIT_ACQUIRE(...) FIT_THREAD_ANNOTATION(__acquire_capability__(__VA_ARGS__))
+#define FIT_TRY_ACQUIRE(...) FIT_THREAD_ANNOTATION(__try_acquire_capability__(__VA_ARGS__))
+#define FIT_ACQUIRED_BEFORE(...) FIT_THREAD_ANNOTATION(__acquired_before__(__VA_ARGS__))
+#define FIT_ACQUIRED_AFTER(...) FIT_THREAD_ANNOTATION(__acquired_after__(__VA_ARGS__))
+#define FIT_RELEASE(...) FIT_THREAD_ANNOTATION(__release_capability__(__VA_ARGS__))
+#define FIT_REQUIRES(...) FIT_THREAD_ANNOTATION(__requires_capability__(__VA_ARGS__))
+#define FIT_EXCLUDES(...) FIT_THREAD_ANNOTATION(__locks_excluded__(__VA_ARGS__))
+#define FIT_RETURN_CAPABILITY(x) FIT_THREAD_ANNOTATION(__lock_returned__(x))
+#define FIT_SCOPED_CAPABILITY FIT_THREAD_ANNOTATION(__scoped_lockable__)
+#define FIT_NO_THREAD_SAFETY_ANALYSIS FIT_THREAD_ANNOTATION(__no_thread_safety_analysis__)
+
+#endif // LIB_FIT_THREAD_SAFETY_H_
diff --git a/pkg/fit/include/lib/fit/traits.h b/pkg/fit/include/lib/fit/traits.h
new file mode 100644
index 0000000..933005e
--- /dev/null
+++ b/pkg/fit/include/lib/fit/traits.h
@@ -0,0 +1,110 @@
+// 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 LIB_FIT_TRAITS_H_
+#define LIB_FIT_TRAITS_H_
+
+#include <tuple>
+#include <type_traits>
+
+namespace fit {
+
+// C++ 14 compatible implementation of std::void_t.
+#if defined(__cplusplus) && __cplusplus >= 201703L
+template <typename... T>
+using void_t = std::void_t<T...>;
+#else
+template <typename... T>
+struct make_void { typedef void type; };
+template <typename... T>
+using void_t = typename make_void<T...>::type;
+#endif
+
+// Encapsulates capture of a parameter pack. Typical use is to use instances of this empty struct
+// for type dispatch in function template deduction/overload resolution.
+//
+// Example:
+//  template <typename Callable, typename... Args>
+//  auto inspect_args(Callable c, parameter_pack<Args...>) {
+//      // do something with Args...
+//  }
+//
+//  template <typename Callable>
+//  auto inspect_args(Callable c) {
+//      return inspect_args(std::move(c), typename callable_traits<Callable>::args{});
+//  }
+template <typename... T>
+struct parameter_pack {
+    static constexpr size_t size = sizeof...(T);
+
+    template <size_t i>
+    using at = typename std::tuple_element_t<i, std::tuple<T...>>;
+};
+
+// |callable_traits| captures elements of interest from function-like types (functions, function
+// pointers, and functors, including lambdas). Due to common usage patterns, const and non-const
+// functors are treated identically.
+//
+// Member types:
+//  |args|        - a |parameter_pack| that captures the parameter types of the function. See
+//                  |parameter_pack| for usage and details.
+//  |return_type| - the return type of the function.
+//  |type|        - the underlying functor or function pointer type. This member is absent if
+//                  |callable_traits| are requested for a raw function signature (as opposed to a
+//                  function pointer or functor; e.g. |callable_traits<void()>|).
+//  |signature|   - the type of the equivalent function.
+
+template <typename T>
+struct callable_traits : public callable_traits<decltype(&T::operator())> {};
+
+// Treat mutable call operators the same as const call operators.
+//
+// It would be equivalent to erase the const instead, but the common case is lambdas, which are
+// const, so prefer to nest less deeply for the common const case.
+template <typename FunctorType, typename ReturnType, typename... ArgTypes>
+struct callable_traits<ReturnType (FunctorType::*)(ArgTypes...)>
+    : public callable_traits<ReturnType (FunctorType::*)(ArgTypes...) const> {};
+
+// Common functor specialization.
+template <typename FunctorType, typename ReturnType, typename... ArgTypes>
+struct callable_traits<ReturnType (FunctorType::*)(ArgTypes...) const>
+    : public callable_traits<ReturnType (*)(ArgTypes...)> {
+
+    using type = FunctorType;
+};
+
+// Function pointer specialization.
+template <typename ReturnType, typename... ArgTypes>
+struct callable_traits<ReturnType (*)(ArgTypes...)>
+    : public callable_traits<ReturnType(ArgTypes...)> {
+
+    using type = ReturnType (*)(ArgTypes...);
+};
+
+// Base specialization.
+template <typename ReturnType, typename... ArgTypes>
+struct callable_traits<ReturnType(ArgTypes...)> {
+    using signature = ReturnType(ArgTypes...);
+    using return_type = ReturnType;
+    using args = parameter_pack<ArgTypes...>;
+
+    callable_traits() = delete;
+};
+
+// Determines whether a type has an operator() that can be invoked.
+template <typename T, typename = void_t<>>
+struct is_callable : public std::false_type {};
+template <typename ReturnType, typename... ArgTypes>
+struct is_callable<ReturnType (*)(ArgTypes...)>
+    : public std::true_type {};
+template <typename FunctorType, typename ReturnType, typename... ArgTypes>
+struct is_callable<ReturnType (FunctorType::*)(ArgTypes...)>
+    : public std::true_type {};
+template <typename T>
+struct is_callable<T, void_t<decltype(&T::operator())>>
+    : public std::true_type {};
+
+} // namespace fit
+
+#endif // LIB_FIT_TRAITS_H_
diff --git a/pkg/fit/include/lib/fit/variant.h b/pkg/fit/include/lib/fit/variant.h
new file mode 100644
index 0000000..f91a4a2
--- /dev/null
+++ b/pkg/fit/include/lib/fit/variant.h
@@ -0,0 +1,404 @@
+// 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 LIB_FIT_VARIANT_H_
+#define LIB_FIT_VARIANT_H_
+
+#include <assert.h>
+
+#include <new>
+#include <type_traits>
+#include <utility>
+
+namespace fit {
+namespace internal {
+
+// This is a very basic partial implementation of |std::variant| which
+// is compatible with C++ 14.  In its current state, it only implements
+// enough of the API for internal usage.  Transforming this into a more
+// complete and precise implementation of |std::variant| is left as an
+// exercise for the reader.  ;)
+//
+// Some key differences:
+// - always requires first type to be monostate
+// - always default constructible
+// - no relational operators
+// - no visitors
+// - no find by type, only find by index
+// - no exception support
+// - simplified get/set methods
+
+// Unit type.
+struct monostate final {
+    constexpr bool operator==(const monostate& other) const { return true; }
+    constexpr bool operator!=(const monostate& other) const { return false; }
+};
+
+// Tag for requesting in-place initialization of a variant alternative by index.
+template <size_t index>
+struct in_place_index_t final {};
+
+#ifdef __cpp_inline_variables
+
+// Inline variables are only available on C++ 17 and beyond.
+template <size_t index>
+inline constexpr in_place_index_t<index> in_place_index{};
+
+#else
+
+// On C++ 14 we need to provide storage for the variable so we define
+// |in_place_index| as a reference instead.
+template <size_t index>
+struct in_place_index_holder {
+    static constexpr in_place_index_t<index> instance{};
+};
+
+template <size_t index>
+constexpr in_place_index_t<index> in_place_index_holder<index>::instance;
+
+template <size_t index>
+static constexpr const in_place_index_t<index>& in_place_index =
+    in_place_index_holder<index>::instance;
+
+#endif // __cpp_inline_variables
+
+// Stores the contents of the variant as a recursively nested union
+// of alternatives.  Conceptually it might be simpler to use
+// std::in_place_storage<> but we would lose the ability to treat the
+// storage as a literal type.
+template <typename... Ts>
+union variant_storage final {
+    static constexpr bool copy_construct_supported = true;
+    static constexpr bool move_construct_supported = true;
+
+    void copy_construct_from(size_t index, const variant_storage& other) {}
+    void move_construct_from(size_t index, variant_storage&& other) {}
+    void destroy(size_t index) {}
+    void swap(size_t index, variant_storage& other) {}
+};
+
+template <typename T0, typename... Ts>
+union variant_storage<T0, Ts...> final {
+    static constexpr bool copy_construct_supported =
+        std::is_copy_constructible<T0>::value &&
+        variant_storage<Ts...>::copy_construct_supported;
+    static constexpr bool move_construct_supported =
+        std::is_move_constructible<T0>::value &&
+        variant_storage<Ts...>::move_construct_supported;
+
+    constexpr variant_storage() = default;
+
+    template <typename... Args>
+    explicit constexpr variant_storage(in_place_index_t<0>, Args&&... args)
+        : alt(std::forward<Args>(args)...) {}
+
+    template <size_t index, typename... Args>
+    explicit constexpr variant_storage(in_place_index_t<index>, Args&&... args)
+        : rest(in_place_index<index - 1>, std::forward<Args>(args)...) {}
+
+    constexpr T0& get(in_place_index_t<0>) { return alt; }
+
+    constexpr const T0& get(in_place_index_t<0>) const { return alt; }
+
+    template <size_t index>
+    constexpr auto& get(in_place_index_t<index>) {
+        return rest.get(in_place_index<index - 1>);
+    }
+
+    template <size_t index>
+    constexpr const auto& get(in_place_index_t<index>) const {
+        return rest.get(in_place_index<index - 1>);
+    }
+
+    template <typename... Args>
+    auto& emplace(in_place_index_t<0>, Args&&... args) {
+        new (&alt) T0(std::forward<Args>(args)...);
+        return alt;
+    }
+
+    template <size_t index, typename... Args>
+    auto& emplace(in_place_index_t<index>, Args&&... args) {
+        return rest.emplace(in_place_index<index - 1>,
+                            std::forward<Args>(args)...);
+    }
+
+    void copy_construct_from(size_t index, const variant_storage& other) {
+        if (index == 0) {
+            new (&alt) T0(other.alt);
+        } else {
+            rest.copy_construct_from(index - 1, other.rest);
+        }
+    }
+
+    void move_construct_from(size_t index, variant_storage&& other) {
+        if (index == 0) {
+            new (&alt) T0(std::move(other.alt));
+        } else {
+            rest.move_construct_from(index - 1, std::move(other.rest));
+        }
+    }
+
+    void destroy(size_t index) {
+        if (index == 0) {
+            alt.~T0();
+        } else {
+            rest.destroy(index - 1);
+        }
+    }
+
+    void swap(size_t index, variant_storage& other) {
+        using std::swap;
+        if (index == 0) {
+            swap(alt, other.alt);
+        } else {
+            rest.swap(index - 1, other.rest);
+        }
+    }
+
+    T0 alt;
+    variant_storage<Ts...> rest;
+};
+
+// Holds the index and storage for a variant with a trivial destructor.
+template <typename... Ts>
+class variant_base_impl_trivial;
+template <typename... Ts>
+class variant_base_impl_trivial<monostate, Ts...> {
+public:
+    constexpr variant_base_impl_trivial()
+        : index_(0),
+          storage_(in_place_index<0>, monostate{}) {}
+
+    template <size_t index, typename... Args>
+    explicit constexpr variant_base_impl_trivial(
+        in_place_index_t<index>, Args&&... args)
+        : index_(index),
+          storage_(in_place_index<index>, std::forward<Args>(args)...) {}
+
+    // Used by emplace.
+    void destroy() {}
+
+protected:
+    size_t index_;
+    variant_storage<monostate, Ts...> storage_;
+};
+
+// Holds the index and storage for a variant with a non-trivial destructor.
+template <typename... Ts>
+class variant_base_impl_non_trivial;
+template <typename... Ts>
+class variant_base_impl_non_trivial<monostate, Ts...> {
+public:
+    constexpr variant_base_impl_non_trivial()
+        : index_(0),
+          storage_(in_place_index<0>, monostate{}) {}
+
+    template <size_t index, typename... Args>
+    explicit constexpr variant_base_impl_non_trivial(
+        in_place_index_t<index>, Args&&... args)
+        : index_(index),
+          storage_(in_place_index<index>, std::forward<Args>(args)...) {}
+
+    ~variant_base_impl_non_trivial() {
+        destroy();
+    }
+
+    // Used by emplace and by the destructor.
+    void destroy() {
+        storage_.destroy(index_);
+    }
+
+protected:
+    size_t index_;
+    union {
+        variant_storage<monostate, Ts...> storage_;
+    };
+};
+
+// Selects an appropriate variant base class depending on whether
+// its destructor is trivial or non-trivial.
+template <typename... Ts>
+using variant_base_impl =
+    std::conditional_t<
+        std::is_destructible<
+            variant_base_impl_trivial<Ts...>>::value,
+        variant_base_impl_trivial<Ts...>,
+        variant_base_impl_non_trivial<Ts...>>;
+
+// Implements non-trivial move-construction and move-assignment.
+template <typename... Ts>
+class variant_move_impl_non_trivial : protected variant_base_impl<Ts...> {
+    using base = variant_base_impl<Ts...>;
+
+public:
+    using base::base;
+
+    variant_move_impl_non_trivial(
+        const variant_move_impl_non_trivial& other) = default;
+
+    variant_move_impl_non_trivial(
+        variant_move_impl_non_trivial&& other) {
+        index_ = other.index_;
+        storage_.move_construct_from(index_, std::move(other.storage_));
+    }
+
+    variant_move_impl_non_trivial& operator=(
+        const variant_move_impl_non_trivial& other) = default;
+
+    variant_move_impl_non_trivial& operator=(
+        variant_move_impl_non_trivial&& other) {
+        if (&other == this)
+            return *this;
+        storage_.destroy(index_);
+        index_ = other.index_;
+        storage_.move_construct_from(index_, std::move(other.storage_));
+        return *this;
+    }
+
+protected:
+    using base::index_;
+    using base::storage_;
+};
+
+// Selects an appropriate variant base class for moving.
+template <typename... Ts>
+using variant_move_impl =
+    std::conditional_t<
+        (std::is_move_constructible<variant_base_impl<Ts...>>::value &&
+         std::is_move_assignable<variant_base_impl<Ts...>>::value) ||
+            !variant_storage<Ts...>::move_construct_supported,
+        variant_base_impl<Ts...>,
+        variant_move_impl_non_trivial<Ts...>>;
+
+// Implements non-trivial copy-construction and copy-assignment.
+template <typename... Ts>
+class variant_copy_impl_non_trivial : protected variant_move_impl<Ts...> {
+    using base = variant_move_impl<Ts...>;
+
+public:
+    using base::base;
+
+    variant_copy_impl_non_trivial(
+        const variant_copy_impl_non_trivial& other) {
+        index_ = other.index_;
+        storage_.copy_construct_from(index_, other.storage_);
+    }
+
+    variant_copy_impl_non_trivial(
+        variant_copy_impl_non_trivial&&) = default;
+
+    variant_copy_impl_non_trivial& operator=(
+        const variant_copy_impl_non_trivial& other) {
+        if (&other == this)
+            return *this;
+        storage_.destroy(index_);
+        index_ = other.index_;
+        storage_.copy_construct_from(index_, other.storage_);
+        return *this;
+    }
+
+    variant_copy_impl_non_trivial& operator=(
+        variant_copy_impl_non_trivial&&) = default;
+
+protected:
+    using base::index_;
+    using base::storage_;
+};
+
+// Selects an appropriate variant base class for copying.
+// Use the base impl if the type is trivially
+template <typename... Ts>
+using variant_copy_impl =
+    std::conditional_t<
+        (std::is_copy_constructible<variant_move_impl<Ts...>>::value &&
+         std::is_copy_assignable<variant_move_impl<Ts...>>::value) ||
+            !variant_storage<Ts...>::copy_construct_supported,
+        variant_move_impl<Ts...>,
+        variant_copy_impl_non_trivial<Ts...>>;
+
+// Actual variant type.
+template <typename... Ts>
+class variant : private variant_copy_impl<Ts...> {
+    using base = variant_copy_impl<Ts...>;
+
+public:
+    constexpr variant() = default;
+
+    template <size_t index, typename... Args>
+    explicit constexpr variant(in_place_index_t<index> i, Args&&... args)
+        : base(i, std::forward<Args>(args)...) {}
+
+    variant(const variant&) = default;
+    variant(variant&&) = default;
+    ~variant() = default;
+
+    variant& operator=(const variant&) = default;
+    variant& operator=(variant&&) = default;
+
+    constexpr size_t index() const { return index_; }
+
+    template <size_t index>
+    constexpr auto& get() {
+        assert(index_ == index);
+        return storage_.get(in_place_index<index>);
+    }
+
+    template <size_t index>
+    constexpr const auto& get() const {
+        assert(index_ == index);
+        return storage_.get(in_place_index<index>);
+    }
+
+    template <size_t index, typename... Args>
+    auto& emplace(Args&&... args) {
+        this->destroy();
+        index_ = index;
+        return storage_.emplace(in_place_index<index>,
+                                std::forward<Args>(args)...);
+    }
+
+    void swap(variant& other) {
+        using std::swap;
+        if (&other == this)
+            return;
+        if (index_ == other.index_) {
+            storage_.swap(index_, other.storage_);
+        } else {
+            variant temp(std::move(*this));
+            *this = std::move(other);
+            other = std::move(temp);
+        }
+    }
+
+private:
+    using base::index_;
+    using base::storage_;
+};
+
+// Swaps variants.
+template <typename... Ts>
+void swap(variant<Ts...>& a, variant<Ts...>& b) {
+    a.swap(b);
+}
+
+// Gets the type of a variant alternative with the given index.
+template <size_t index, typename Variant>
+struct variant_alternative;
+
+template <size_t index, typename T0, typename... Ts>
+struct variant_alternative<index, variant<T0, Ts...>>
+    : variant_alternative<index - 1, variant<Ts...>> {};
+
+template <typename T0, typename... Ts>
+struct variant_alternative<0, variant<T0, Ts...>> {
+    using type = T0;
+};
+
+template <size_t index, typename Variant>
+using variant_alternative_t = typename variant_alternative<index, Variant>::type;
+
+} // namespace internal
+} // namespace fit
+
+#endif // LIB_FIT_VARIANT_H_
diff --git a/pkg/fit/meta.json b/pkg/fit/meta.json
new file mode 100644
index 0000000..db86eb9
--- /dev/null
+++ b/pkg/fit/meta.json
@@ -0,0 +1,57 @@
+{
+  "banjo_deps": [], 
+  "deps": [], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/fit/promise.cpp", 
+    "pkg/fit/scheduler.cpp", 
+    "pkg/fit/sequencer.cpp", 
+    "pkg/fit/single_threaded_executor.cpp", 
+    "pkg/fit/include/lib/fit/bridge.h", 
+    "pkg/fit/include/lib/fit/bridge_internal.h", 
+    "pkg/fit/include/lib/fit/defer.h", 
+    "pkg/fit/include/lib/fit/function.h", 
+    "pkg/fit/include/lib/fit/function_internal.h", 
+    "pkg/fit/include/lib/fit/function_traits.h", 
+    "pkg/fit/include/lib/fit/nullable.h", 
+    "pkg/fit/include/lib/fit/optional.h", 
+    "pkg/fit/include/lib/fit/promise.h", 
+    "pkg/fit/include/lib/fit/promise_internal.h", 
+    "pkg/fit/include/lib/fit/result.h", 
+    "pkg/fit/include/lib/fit/scheduler.h", 
+    "pkg/fit/include/lib/fit/sequencer.h", 
+    "pkg/fit/include/lib/fit/single_threaded_executor.h", 
+    "pkg/fit/include/lib/fit/thread_safety.h", 
+    "pkg/fit/include/lib/fit/traits.h", 
+    "pkg/fit/include/lib/fit/variant.h"
+  ], 
+  "headers": [
+    "pkg/fit/include/lib/fit/bridge.h", 
+    "pkg/fit/include/lib/fit/bridge_internal.h", 
+    "pkg/fit/include/lib/fit/defer.h", 
+    "pkg/fit/include/lib/fit/function.h", 
+    "pkg/fit/include/lib/fit/function_internal.h", 
+    "pkg/fit/include/lib/fit/function_traits.h", 
+    "pkg/fit/include/lib/fit/nullable.h", 
+    "pkg/fit/include/lib/fit/optional.h", 
+    "pkg/fit/include/lib/fit/promise.h", 
+    "pkg/fit/include/lib/fit/promise_internal.h", 
+    "pkg/fit/include/lib/fit/result.h", 
+    "pkg/fit/include/lib/fit/scheduler.h", 
+    "pkg/fit/include/lib/fit/sequencer.h", 
+    "pkg/fit/include/lib/fit/single_threaded_executor.h", 
+    "pkg/fit/include/lib/fit/thread_safety.h", 
+    "pkg/fit/include/lib/fit/traits.h", 
+    "pkg/fit/include/lib/fit/variant.h"
+  ], 
+  "include_dir": "pkg/fit/include", 
+  "name": "fit", 
+  "root": "pkg/fit", 
+  "sources": [
+    "pkg/fit/promise.cpp", 
+    "pkg/fit/scheduler.cpp", 
+    "pkg/fit/sequencer.cpp", 
+    "pkg/fit/single_threaded_executor.cpp"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/fit/promise.cpp b/pkg/fit/promise.cpp
new file mode 100644
index 0000000..8309f00
--- /dev/null
+++ b/pkg/fit/promise.cpp
@@ -0,0 +1,57 @@
+// 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.
+
+// Can't compile this for Zircon userspace yet since libstdc++ isn't available.
+#ifndef FIT_NO_STD_FOR_ZIRCON_USERSPACE
+
+#include <lib/fit/promise.h>
+
+namespace fit {
+
+suspended_task::suspended_task(const suspended_task& other)
+    : resolver_(other.resolver_),
+      ticket_(resolver_ ? resolver_->duplicate_ticket(other.ticket_) : 0) {}
+
+suspended_task::suspended_task(suspended_task&& other)
+    : resolver_(other.resolver_), ticket_(other.ticket_) {
+    other.resolver_ = nullptr;
+}
+
+suspended_task::~suspended_task() {
+    reset();
+}
+
+void suspended_task::resolve(bool resume_task) {
+    if (resolver_) {
+        // Move the ticket to the stack to guard against possible re-entrance
+        // occurring as a side-effect of the task's own destructor running.
+        resolver* cached_resolver = resolver_;
+        ticket cached_ticket = ticket_;
+        resolver_ = nullptr;
+        cached_resolver->resolve_ticket(cached_ticket, resume_task);
+    }
+}
+
+suspended_task& suspended_task::operator=(const suspended_task& other) {
+    if (this != &other) {
+        reset();
+        resolver_ = other.resolver_;
+        ticket_ = resolver_ ? resolver_->duplicate_ticket(other.ticket_) : 0;
+    }
+    return *this;
+}
+
+suspended_task& suspended_task::operator=(suspended_task&& other) {
+    if (this != &other) {
+        reset();
+        resolver_ = other.resolver_;
+        ticket_ = other.ticket_;
+        other.resolver_ = nullptr;
+    }
+    return *this;
+}
+
+} // namespace fit
+
+#endif // FIT_NO_STD_FOR_ZIRCON_USERSPACE
diff --git a/pkg/fit/scheduler.cpp b/pkg/fit/scheduler.cpp
new file mode 100644
index 0000000..69acc03
--- /dev/null
+++ b/pkg/fit/scheduler.cpp
@@ -0,0 +1,128 @@
+// 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.
+
+// Can't compile this for Zircon userspace yet since libstdc++ isn't available.
+#ifndef FIT_NO_STD_FOR_ZIRCON_USERSPACE
+
+#include <lib/fit/scheduler.h>
+
+#include <map>
+#include <queue>
+#include <utility>
+
+namespace fit {
+namespace subtle {
+
+scheduler::scheduler() = default;
+
+scheduler::~scheduler() = default;
+
+void scheduler::schedule_task(pending_task task) {
+    assert(task);
+    runnable_tasks_.push(std::move(task));
+}
+
+suspended_task::ticket scheduler::obtain_ticket(uint32_t initial_refs) {
+    suspended_task::ticket ticket = next_ticket_++;
+    tickets_.emplace(ticket, ticket_record(initial_refs));
+    return ticket;
+}
+
+void scheduler::finalize_ticket(suspended_task::ticket ticket,
+                                pending_task* task) {
+    auto it = tickets_.find(ticket);
+    assert(it != tickets_.end());
+    assert(!it->second.task);
+    assert(it->second.ref_count > 0);
+    assert(task);
+
+    it->second.ref_count--;
+    if (!*task) {
+        // task already finished
+    } else if (it->second.was_resumed) {
+        // task immediately became runnable
+        runnable_tasks_.push(std::move(*task));
+    } else if (it->second.ref_count > 0) {
+        // task remains suspended
+        it->second.task = std::move(*task);
+        suspended_task_count_++;
+    } // else, task was abandoned and caller retains ownership of it
+    if (it->second.ref_count == 0) {
+        tickets_.erase(it);
+    }
+}
+
+void scheduler::duplicate_ticket(suspended_task::ticket ticket) {
+    auto it = tickets_.find(ticket);
+    assert(it != tickets_.end());
+    assert(it->second.ref_count > 0);
+
+    it->second.ref_count++;
+    assert(it->second.ref_count != 0); // did we really make 4 billion refs?!
+}
+
+pending_task scheduler::release_ticket(suspended_task::ticket ticket) {
+    auto it = tickets_.find(ticket);
+    assert(it != tickets_.end());
+    assert(it->second.ref_count > 0);
+
+    it->second.ref_count--;
+    if (it->second.ref_count == 0) {
+        pending_task task = std::move(it->second.task);
+        if (task) {
+            assert(suspended_task_count_ > 0);
+            suspended_task_count_--;
+        }
+        tickets_.erase(it);
+        return task;
+    }
+    return pending_task();
+}
+
+bool scheduler::resume_task_with_ticket(suspended_task::ticket ticket) {
+    auto it = tickets_.find(ticket);
+    assert(it != tickets_.end());
+    assert(it->second.ref_count > 0);
+
+    bool did_resume = false;
+    it->second.ref_count--;
+    if (!it->second.was_resumed) {
+        it->second.was_resumed = true;
+        if (it->second.task) {
+            did_resume = true;
+            assert(suspended_task_count_ > 0);
+            suspended_task_count_--;
+            runnable_tasks_.push(std::move(it->second.task));
+        }
+    }
+    if (it->second.ref_count == 0) {
+        tickets_.erase(it);
+    }
+    return did_resume;
+}
+
+void scheduler::take_runnable_tasks(task_queue* tasks) {
+    assert(tasks && tasks->empty());
+    runnable_tasks_.swap(*tasks);
+}
+
+void scheduler::take_all_tasks(task_queue* tasks) {
+    assert(tasks && tasks->empty());
+
+    runnable_tasks_.swap(*tasks);
+    if (suspended_task_count_ > 0) {
+        for (auto& item : tickets_) {
+            if (item.second.task) {
+                assert(suspended_task_count_ > 0);
+                suspended_task_count_--;
+                tasks->push(std::move(item.second.task));
+            }
+        }
+    }
+}
+
+} // namespace subtle
+} // namespace fit
+
+#endif // FIT_NO_STD_FOR_ZIRCON_USERSPACE
diff --git a/pkg/fit/sequencer.cpp b/pkg/fit/sequencer.cpp
new file mode 100644
index 0000000..687db67
--- /dev/null
+++ b/pkg/fit/sequencer.cpp
@@ -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.
+
+// Can't compile this for Zircon userspace yet since libstdc++ isn't available.
+#ifndef FIT_NO_STD_FOR_ZIRCON_USERSPACE
+
+#include <lib/fit/sequencer.h>
+
+namespace fit {
+
+sequencer::sequencer() {
+    // Capture a new consumer and intentionally abandon its associated
+    // completer so that a promise chained onto the consumer using
+    // |promise_or()| will become immediately runnable.
+    fit::bridge<> bridge;
+    prior_ = std::move(bridge.consumer());
+}
+
+sequencer::~sequencer() = default;
+
+fit::consumer<> sequencer::swap_prior(fit::consumer<> new_prior) {
+    std::lock_guard<std::mutex> lock(mutex_);
+    fit::consumer<> old_prior = std::move(prior_);
+    prior_ = std::move(new_prior);
+    return old_prior;
+}
+
+} // namespace fit
+
+#endif // FIT_NO_STD_FOR_ZIRCON_USERSPACE
diff --git a/pkg/fit/single_threaded_executor.cpp b/pkg/fit/single_threaded_executor.cpp
new file mode 100644
index 0000000..ba738d0
--- /dev/null
+++ b/pkg/fit/single_threaded_executor.cpp
@@ -0,0 +1,240 @@
+// 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.
+
+// Can't compile this for Zircon userspace yet since libstdc++ isn't available.
+#ifndef FIT_NO_STD_FOR_ZIRCON_USERSPACE
+
+#include <condition_variable>
+#include <mutex>
+
+#include <lib/fit/single_threaded_executor.h>
+#include <lib/fit/thread_safety.h>
+
+namespace fit {
+
+// The dispatcher runs tasks and provides the suspended task resolver.
+//
+// The lifetime of this object is somewhat complex since there are pointers
+// to it from multiple sources which are released in different ways.
+//
+// - |single_threaded_executor| holds a pointer in |dispatcher_| which it releases
+//   after calling |shutdown()| to inform the dispatcher of its own demise
+// - |suspended_task| holds a pointer to the dispatcher's resolver
+//   interface and the number of outstanding pointers corresponds to the
+//   number of outstanding suspended task tickets tracked by |scheduler_|.
+//
+// The dispatcher deletes itself once all pointers have been released.
+class single_threaded_executor::dispatcher_impl final
+    : public suspended_task::resolver {
+public:
+    dispatcher_impl();
+
+    void shutdown();
+    void schedule_task(pending_task task);
+    void run(context_impl& context);
+    suspended_task suspend_current_task();
+
+    suspended_task::ticket duplicate_ticket(
+        suspended_task::ticket ticket) override;
+    void resolve_ticket(
+        suspended_task::ticket ticket, bool resume_task) override;
+
+private:
+    ~dispatcher_impl() override;
+
+    void wait_for_runnable_tasks(
+        fit::subtle::scheduler::task_queue* out_tasks);
+    void run_task(pending_task* task, context& context);
+
+    suspended_task::ticket current_task_ticket_ = 0;
+    std::condition_variable wake_;
+
+    // A bunch of state that is guarded by a mutex.
+    struct {
+        std::mutex mutex_;
+        bool was_shutdown_ FIT_GUARDED(mutex_) = false;
+        bool need_wake_ FIT_GUARDED(mutex_) = false;
+        fit::subtle::scheduler scheduler_ FIT_GUARDED(mutex_);
+    } guarded_;
+};
+
+single_threaded_executor::single_threaded_executor()
+    : context_(this), dispatcher_(new dispatcher_impl()) {}
+
+single_threaded_executor::~single_threaded_executor() {
+    dispatcher_->shutdown();
+}
+
+void single_threaded_executor::schedule_task(pending_task task) {
+    assert(task);
+    dispatcher_->schedule_task(std::move(task));
+}
+
+void single_threaded_executor::run() {
+    dispatcher_->run(context_);
+}
+
+single_threaded_executor::context_impl::context_impl(single_threaded_executor* executor)
+    : executor_(executor) {}
+
+single_threaded_executor::context_impl::~context_impl() = default;
+
+single_threaded_executor* single_threaded_executor::context_impl::executor() const {
+    return executor_;
+}
+
+suspended_task single_threaded_executor::context_impl::suspend_task() {
+    return executor_->dispatcher_->suspend_current_task();
+}
+
+single_threaded_executor::dispatcher_impl::dispatcher_impl() = default;
+
+single_threaded_executor::dispatcher_impl::~dispatcher_impl() {
+    std::lock_guard<std::mutex> lock(guarded_.mutex_);
+    assert(guarded_.was_shutdown_);
+    assert(!guarded_.scheduler_.has_runnable_tasks());
+    assert(!guarded_.scheduler_.has_suspended_tasks());
+    assert(!guarded_.scheduler_.has_outstanding_tickets());
+}
+
+void single_threaded_executor::dispatcher_impl::shutdown() {
+    fit::subtle::scheduler::task_queue tasks; // drop outside of the lock
+    {
+        std::lock_guard<std::mutex> lock(guarded_.mutex_);
+        assert(!guarded_.was_shutdown_);
+        guarded_.was_shutdown_ = true;
+        guarded_.scheduler_.take_all_tasks(&tasks);
+        if (guarded_.scheduler_.has_outstanding_tickets()) {
+            return; // can't delete self yet
+        }
+    }
+
+    // Must destroy self outside of the lock.
+    delete this;
+}
+
+void single_threaded_executor::dispatcher_impl::schedule_task(pending_task task) {
+    {
+        std::lock_guard<std::mutex> lock(guarded_.mutex_);
+        assert(!guarded_.was_shutdown_);
+        guarded_.scheduler_.schedule_task(std::move(task));
+        if (!guarded_.need_wake_) {
+            return; // don't need to wake
+        }
+        guarded_.need_wake_ = false;
+    }
+
+    // It is more efficient to notify outside the lock.
+    wake_.notify_one();
+}
+
+void single_threaded_executor::dispatcher_impl::run(context_impl& context) {
+    fit::subtle::scheduler::task_queue tasks;
+    for (;;) {
+        wait_for_runnable_tasks(&tasks);
+        if (tasks.empty()) {
+            return; // all done!
+        }
+
+        do {
+            run_task(&tasks.front(), context);
+            tasks.pop(); // the task may be destroyed here if it was not suspended
+        } while (!tasks.empty());
+    }
+}
+
+// Must only be called while |run_task()| is running a task.
+// This happens when the task's continuation calls |context::suspend_task()|
+// upon the context it received as an argument.
+suspended_task single_threaded_executor::dispatcher_impl::suspend_current_task() {
+    std::lock_guard<std::mutex> lock(guarded_.mutex_);
+    assert(!guarded_.was_shutdown_);
+    if (current_task_ticket_ == 0) {
+        current_task_ticket_ = guarded_.scheduler_.obtain_ticket(
+            2 /*initial_refs*/);
+    } else {
+        guarded_.scheduler_.duplicate_ticket(current_task_ticket_);
+    }
+    return suspended_task(this, current_task_ticket_);
+}
+
+// Unfortunately std::unique_lock does not support thread-safety annotations
+void single_threaded_executor::dispatcher_impl::wait_for_runnable_tasks(
+    fit::subtle::scheduler::task_queue* out_tasks) FIT_NO_THREAD_SAFETY_ANALYSIS {
+    std::unique_lock<std::mutex> lock(guarded_.mutex_);
+    for (;;) {
+        assert(!guarded_.was_shutdown_);
+        guarded_.scheduler_.take_runnable_tasks(out_tasks);
+        if (!out_tasks->empty()) {
+            return; // got some tasks
+        }
+        if (!guarded_.scheduler_.has_suspended_tasks()) {
+            return; // all done!
+        }
+        guarded_.need_wake_ = true;
+        wake_.wait(lock);
+        guarded_.need_wake_ = false;
+    }
+}
+
+void single_threaded_executor::dispatcher_impl::run_task(pending_task* task,
+                                                         context& context) {
+    assert(current_task_ticket_ == 0);
+    const bool finished = (*task)(context);
+    assert(!*task == finished);
+    (void)finished;
+    if (current_task_ticket_ == 0) {
+        return; // task was not suspended, no ticket was produced
+    }
+
+    std::lock_guard<std::mutex> lock(guarded_.mutex_);
+    assert(!guarded_.was_shutdown_);
+    guarded_.scheduler_.finalize_ticket(current_task_ticket_, task);
+    current_task_ticket_ = 0;
+}
+
+suspended_task::ticket single_threaded_executor::dispatcher_impl::duplicate_ticket(
+    suspended_task::ticket ticket) {
+    std::lock_guard<std::mutex> lock(guarded_.mutex_);
+    guarded_.scheduler_.duplicate_ticket(ticket);
+    return ticket;
+}
+
+void single_threaded_executor::dispatcher_impl::resolve_ticket(
+    suspended_task::ticket ticket, bool resume_task) {
+    pending_task abandoned_task; // drop outside of the lock
+    bool do_wake = false;
+    {
+        std::lock_guard<std::mutex> lock(guarded_.mutex_);
+        if (resume_task) {
+            guarded_.scheduler_.resume_task_with_ticket(ticket);
+        } else {
+            abandoned_task = guarded_.scheduler_.release_ticket(ticket);
+        }
+        if (guarded_.was_shutdown_) {
+            assert(!guarded_.need_wake_);
+            if (guarded_.scheduler_.has_outstanding_tickets()) {
+                return; // can't shutdown yet
+            }
+        } else if (guarded_.need_wake_ &&
+                   (guarded_.scheduler_.has_runnable_tasks() ||
+                    !guarded_.scheduler_.has_suspended_tasks())) {
+            guarded_.need_wake_ = false;
+            do_wake = true;
+        } else {
+            return; // nothing else to do
+        }
+    }
+
+    // Must do this outside of the lock.
+    if (do_wake) {
+        wake_.notify_one();
+    } else {
+        delete this;
+    }
+}
+
+} // namespace fit
+
+#endif // FIT_NO_STD_FOR_ZIRCON_USERSPACE
diff --git a/pkg/images_cpp/images.cc b/pkg/images_cpp/images.cc
new file mode 100644
index 0000000..17803c6
--- /dev/null
+++ b/pkg/images_cpp/images.cc
@@ -0,0 +1,84 @@
+// 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.
+
+#include "lib/images/cpp/images.h"
+
+#include <zircon/assert.h>
+
+namespace images {
+
+// Overall bits per pixel, across all pixel data in the whole image.
+size_t BitsPerPixel(const fuchsia::images::PixelFormat& pixel_format) {
+  switch (pixel_format) {
+    case fuchsia::images::PixelFormat::BGRA_8:
+      return 4u * 8u;
+    case fuchsia::images::PixelFormat::YUY2:
+      return 2u * 8u;
+    case fuchsia::images::PixelFormat::NV12:
+      return 12;
+    case fuchsia::images::PixelFormat::YV12:
+      return 12;
+  }
+  ZX_PANIC("Unknown Pixel Format: %d", static_cast<int>(pixel_format));
+  return 0;
+}
+
+size_t StrideBytesPerWidthPixel(
+    const fuchsia::images::PixelFormat& pixel_format) {
+  switch (pixel_format) {
+    case fuchsia::images::PixelFormat::BGRA_8:
+      return 4u;
+    case fuchsia::images::PixelFormat::YUY2:
+      return 2u;
+    case fuchsia::images::PixelFormat::NV12:
+      return 1u;
+    case fuchsia::images::PixelFormat::YV12:
+      return 1u;
+  }
+  ZX_PANIC("Unknown Pixel Format: %d", static_cast<int>(pixel_format));
+  return 0;
+}
+
+size_t MaxSampleAlignment(const fuchsia::images::PixelFormat& pixel_format) {
+  switch (pixel_format) {
+    case fuchsia::images::PixelFormat::BGRA_8:
+      return 4u;
+    case fuchsia::images::PixelFormat::YUY2:
+      return 2u;
+    case fuchsia::images::PixelFormat::NV12:
+      // In the sense that line stride "must preserve pixel alignment", which is
+      // what MaxSampleAlignment() is used for, NV12 ~~has (very roughly
+      // speaking) a pixel alignment of 2, ~~because the width of the Y plane in
+      // this implementation must be even, and ~because the interleaved UV data
+      // after the planar Y data is 2 bytes per sample, so we may as well
+      // require UV samples to remain aligned UV line to UV line.
+      return 2u;
+    case fuchsia::images::PixelFormat::YV12:
+      // In the sense that line stride "must preserve pixel alignment", which is
+      // what MaxSampleAlignment() is used for, YV12 ~~has (very roughly
+      // speaking) a pixel alignment of 2, ~~because the width of the Y plane in
+      // this implementation must be even.
+      return 2u;
+  }
+  ZX_PANIC("Unknown Pixel Format: %d", static_cast<int>(pixel_format));
+  return 0;
+}
+
+size_t ImageSize(const fuchsia::images::ImageInfo& image_info) {
+  ZX_DEBUG_ASSERT(image_info.tiling == fuchsia::images::Tiling::LINEAR);
+  switch (image_info.pixel_format) {
+    case fuchsia::images::PixelFormat::BGRA_8:
+    case fuchsia::images::PixelFormat::YUY2:
+      return image_info.height * image_info.stride;
+    case fuchsia::images::PixelFormat::NV12:
+      return image_info.height * image_info.stride * 3 / 2;
+    case fuchsia::images::PixelFormat::YV12:
+      return image_info.height * image_info.stride * 3 / 2;
+  }
+  ZX_PANIC("Unknown Pixel Format: %d",
+           static_cast<int>(image_info.pixel_format));
+  return 0;
+}
+
+}  // namespace images
diff --git a/pkg/images_cpp/include/lib/images/cpp/images.h b/pkg/images_cpp/include/lib/images/cpp/images.h
new file mode 100644
index 0000000..48d75e6
--- /dev/null
+++ b/pkg/images_cpp/include/lib/images/cpp/images.h
@@ -0,0 +1,41 @@
+// 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 LIB_IMAGES_CPP_IMAGES_H_
+#define LIB_IMAGES_CPP_IMAGES_H_
+
+#include <fuchsia/images/cpp/fidl.h>
+
+#include <stdint.h>
+
+namespace images {
+
+// Returns the number of bits per pixel for the given format.  This is the bits
+// per pixel in the overall image across all bytes that contain pixel data.  For
+// example, NV12 is 12 bits per pixel.
+size_t BitsPerPixel(const fuchsia::images::PixelFormat& pixel_format);
+
+// This is the number of stride bytes per pixel of width.  For formats such as
+// NV12 that separate Y and UV data, this is the number of stride bytes of the Y
+// plane.  NV12 has the same stride for the UV data.  formats with a different
+// stride for UV data vs Y data are not handled yet.
+size_t StrideBytesPerWidthPixel(
+    const fuchsia::images::PixelFormat& pixel_format);
+
+// Returns the pixel alignment for the given format.
+//
+// This is technically something closer to "max sample alignment" for the given
+// format.  For example, NV12 returns 2 here because its UV interleaved data has
+// 2 bytes per sample, despite its Y plane having 1 byte per sample.
+//
+// The stride is required to be divisible by this alignment.
+size_t MaxSampleAlignment(const fuchsia::images::PixelFormat& pixel_format);
+
+// This would be height * stride, if it weren't for formats like NV12, where it
+// isn't.  The output is bytes.
+size_t ImageSize(const fuchsia::images::ImageInfo& image_info);
+
+}  // namespace images
+
+#endif  // LIB_IMAGES_CPP_IMAGES_H_
diff --git a/pkg/images_cpp/meta.json b/pkg/images_cpp/meta.json
new file mode 100644
index 0000000..61fdef4
--- /dev/null
+++ b/pkg/images_cpp/meta.json
@@ -0,0 +1,16 @@
+{
+  "deps": [], 
+  "fidl_deps": [
+    "fuchsia.images"
+  ], 
+  "headers": [
+    "pkg/images_cpp/include/lib/images/cpp/images.h"
+  ], 
+  "include_dir": "pkg/images_cpp/include", 
+  "name": "images_cpp", 
+  "root": "pkg/images_cpp", 
+  "sources": [
+    "pkg/images_cpp/images.cc"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/memfs/include/lib/memfs/memfs.h b/pkg/memfs/include/lib/memfs/memfs.h
new file mode 100644
index 0000000..7f49a96
--- /dev/null
+++ b/pkg/memfs/include/lib/memfs/memfs.h
@@ -0,0 +1,64 @@
+// 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 LIB_MEMFS_INCLUDE_LIB_MEMFS_MEMFS_H_
+#define LIB_MEMFS_INCLUDE_LIB_MEMFS_MEMFS_H_
+
+#include <lib/async/dispatcher.h>
+#include <lib/sync/completion.h>
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+typedef struct memfs_filesystem memfs_filesystem_t;
+
+// Given an async dispatcher, create an in-memory filesystem.
+//
+// Returns the MemFS filesystem object in |out_fs|. This object
+// must be freed by memfs_free_filesystem.
+//
+// Returns a handle to the root directory in |out_root|.
+__EXPORT zx_status_t memfs_create_filesystem(async_dispatcher_t* dispatcher,
+                                             memfs_filesystem_t** out_fs,
+                                             zx_handle_t* out_root);
+
+// Same as memfs_create_filesystem, but with an extra |max_num_pages| option.
+//
+// Specify the maximum number of pages available to the fs via |max_num_pages|.
+// This puts a bound on memory consumption.
+__EXPORT zx_status_t memfs_create_filesystem_with_page_limit(async_dispatcher_t* dispatcher,
+                                                             size_t max_num_pages,
+                                                             memfs_filesystem_t** out_fs,
+                                                             zx_handle_t* out_root);
+
+// Frees a MemFS filesystem, unmounting any sub-filesystems that
+// may exist.
+//
+// Requires that the async handler dispatcher provided to
+// |memfs_create_filesystem| still be running.
+//
+// Signals the optional argument |unmounted| when memfs has torn down.
+__EXPORT void memfs_free_filesystem(memfs_filesystem_t* fs, sync_completion_t* unmounted);
+
+// Creates an in-memory filesystem and installs it into the local namespace at
+// the given path.
+//
+// Operations on the filesystem are serviced by the given async dispatcher.
+//
+// Returns |ZX_ERR_ALREADY_EXISTS| if |path| already exists in the namespace for
+// this process.
+__EXPORT zx_status_t memfs_install_at(async_dispatcher_t* dispatcher, const char* path);
+
+// Same as memfs_install_at, but with an extra |max_num_pages| option.
+//
+// Specify the maximum number of pages available to the fs via |max_num_pages|.
+// This puts a bound on memory consumption.
+__EXPORT zx_status_t memfs_install_at_with_page_limit(async_dispatcher_t* dispatcher,
+                                                      size_t max_num_pages,
+                                                      const char* path);
+
+__END_CDECLS
+
+#endif // LIB_MEMFS_INCLUDE_LIB_MEMFS_MEMFS_H_
diff --git a/pkg/memfs/meta.json b/pkg/memfs/meta.json
new file mode 100644
index 0000000..1492c3e
--- /dev/null
+++ b/pkg/memfs/meta.json
@@ -0,0 +1,26 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/bf/c0f8386f84cd2c91ccae603bc6910bdbaf7f29.debug", 
+      "dist": "arch/arm64/dist/libmemfs.so", 
+      "link": "arch/arm64/lib/libmemfs.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/7b/1c4f16beffe8102284ef4860a2a92696ed5045.debug", 
+      "dist": "arch/x64/dist/libmemfs.so", 
+      "link": "arch/x64/lib/libmemfs.so"
+    }
+  }, 
+  "deps": [
+    "fdio", 
+    "trace-engine"
+  ], 
+  "format": "shared", 
+  "headers": [
+    "pkg/memfs/include/lib/memfs/memfs.h"
+  ], 
+  "include_dir": "pkg/memfs/include", 
+  "name": "memfs", 
+  "root": "pkg/memfs", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/scenic_cpp/commands.cc b/pkg/scenic_cpp/commands.cc
new file mode 100644
index 0000000..4991905
--- /dev/null
+++ b/pkg/scenic_cpp/commands.cc
@@ -0,0 +1,1300 @@
+// 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.
+
+#include "lib/ui/scenic/cpp/commands.h"
+
+#include <array>
+
+#include <zircon/assert.h>
+
+namespace scenic {
+
+fuchsia::ui::scenic::Command NewCommand(fuchsia::ui::gfx::Command command) {
+  fuchsia::ui::scenic::Command scenic_command;
+  scenic_command.set_gfx(std::move(command));
+  return scenic_command;
+}
+
+fuchsia::ui::scenic::Command NewCommand(fuchsia::ui::input::Command command) {
+  fuchsia::ui::scenic::Command scenic_command;
+  scenic_command.set_input(std::move(command));
+  return scenic_command;
+}
+
+// Helper function for all resource creation functions.
+fuchsia::ui::gfx::Command NewCreateResourceCmd(
+    uint32_t id, fuchsia::ui::gfx::ResourceArgs resource) {
+  fuchsia::ui::gfx::CreateResourceCmd create_resource;
+  create_resource.id = id;
+  create_resource.resource = std::move(resource);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_create_resource(std::move(create_resource));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewCreateMemoryCmd(
+    uint32_t id, zx::vmo vmo, uint64_t allocation_size,
+    fuchsia::images::MemoryType memory_type) {
+  fuchsia::ui::gfx::MemoryArgs memory;
+  memory.vmo = std::move(vmo);
+  memory.allocation_size = allocation_size;
+  memory.memory_type = memory_type;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_memory(std::move(memory));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateImageCmd(uint32_t id, uint32_t memory_id,
+                                            uint32_t memory_offset,
+                                            fuchsia::images::ImageInfo info) {
+  fuchsia::ui::gfx::ImageArgs image;
+  image.memory_id = memory_id;
+  image.memory_offset = memory_offset;
+  image.info = std::move(info);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_image(std::move(image));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateImagePipeCmd(
+    uint32_t id, ::fidl::InterfaceRequest<fuchsia::images::ImagePipe> request) {
+  fuchsia::ui::gfx::ImagePipeArgs image_pipe;
+  image_pipe.image_pipe_request = std::move(request);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_image_pipe(std::move(image_pipe));
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateImageCmd(
+    uint32_t id, uint32_t memory_id, uint32_t memory_offset,
+    fuchsia::images::PixelFormat format,
+    fuchsia::images::ColorSpace color_space, fuchsia::images::Tiling tiling,
+    uint32_t width, uint32_t height, uint32_t stride) {
+  fuchsia::images::ImageInfo info;
+  info.pixel_format = format;
+  info.color_space = color_space;
+  info.tiling = tiling;
+  info.width = width;
+  info.height = height;
+  info.stride = stride;
+  return NewCreateImageCmd(id, memory_id, memory_offset, std::move(info));
+}
+
+fuchsia::ui::gfx::Command NewCreateBufferCmd(uint32_t id, uint32_t memory_id,
+                                             uint32_t memory_offset,
+                                             uint32_t num_bytes) {
+  fuchsia::ui::gfx::BufferArgs buffer;
+  buffer.memory_id = memory_id;
+  buffer.memory_offset = memory_offset;
+  buffer.num_bytes = num_bytes;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_buffer(std::move(buffer));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateCompositorCmd(uint32_t id) {
+  fuchsia::ui::gfx::CompositorArgs compositor;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_compositor(std::move(compositor));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateDisplayCompositorCmd(uint32_t id) {
+  fuchsia::ui::gfx::DisplayCompositorArgs display_compositor;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_display_compositor(std::move(display_compositor));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateLayerStackCmd(uint32_t id) {
+  fuchsia::ui::gfx::LayerStackArgs layer_stack;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_layer_stack(std::move(layer_stack));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateLayerCmd(uint32_t id) {
+  fuchsia::ui::gfx::LayerArgs layer;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_layer(std::move(layer));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateSceneCmd(uint32_t id) {
+  fuchsia::ui::gfx::SceneArgs scene;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_scene(std::move(scene));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateCameraCmd(uint32_t id, uint32_t scene_id) {
+  fuchsia::ui::gfx::CameraArgs camera;
+  camera.scene_id = scene_id;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_camera(std::move(camera));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateStereoCameraCmd(uint32_t id,
+                                                   uint32_t scene_id) {
+  fuchsia::ui::gfx::StereoCameraArgs stereo_camera;
+  stereo_camera.scene_id = scene_id;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_stereo_camera(std::move(stereo_camera));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateRendererCmd(uint32_t id) {
+  fuchsia::ui::gfx::RendererArgs renderer;
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_renderer(std::move(renderer));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateAmbientLightCmd(uint32_t id) {
+  fuchsia::ui::gfx::AmbientLightArgs ambient_light;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_ambient_light(std::move(ambient_light));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateDirectionalLightCmd(uint32_t id) {
+  fuchsia::ui::gfx::DirectionalLightArgs directional_light;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_directional_light(std::move(directional_light));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateCircleCmd(uint32_t id, float radius) {
+  fuchsia::ui::gfx::Value radius_value;
+  radius_value.set_vector1(radius);
+
+  fuchsia::ui::gfx::CircleArgs circle;
+  circle.radius = std::move(radius_value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_circle(std::move(circle));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateRectangleCmd(uint32_t id, float width,
+                                                float height) {
+  fuchsia::ui::gfx::Value width_value;
+  width_value.set_vector1(width);
+
+  fuchsia::ui::gfx::Value height_value;
+  height_value.set_vector1(height);
+
+  fuchsia::ui::gfx::RectangleArgs rectangle;
+  rectangle.width = std::move(width_value);
+  rectangle.height = std::move(height_value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_rectangle(std::move(rectangle));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateRoundedRectangleCmd(
+    uint32_t id, float width, float height, float top_left_radius,
+    float top_right_radius, float bottom_right_radius,
+    float bottom_left_radius) {
+  fuchsia::ui::gfx::Value width_value;
+  width_value.set_vector1(width);
+
+  fuchsia::ui::gfx::Value height_value;
+  height_value.set_vector1(height);
+
+  fuchsia::ui::gfx::Value top_left_radius_value;
+  top_left_radius_value.set_vector1(top_left_radius);
+
+  fuchsia::ui::gfx::Value top_right_radius_value;
+  top_right_radius_value.set_vector1(top_right_radius);
+
+  fuchsia::ui::gfx::Value bottom_right_radius_value;
+  bottom_right_radius_value.set_vector1(bottom_right_radius);
+
+  fuchsia::ui::gfx::Value bottom_left_radius_value;
+  bottom_left_radius_value.set_vector1(bottom_left_radius);
+
+  fuchsia::ui::gfx::RoundedRectangleArgs rectangle;
+  rectangle.width = std::move(width_value);
+  rectangle.height = std::move(height_value);
+  rectangle.top_left_radius = std::move(top_left_radius_value);
+  rectangle.top_right_radius = std::move(top_right_radius_value);
+  rectangle.bottom_right_radius = std::move(bottom_right_radius_value);
+  rectangle.bottom_left_radius = std::move(bottom_left_radius_value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_rounded_rectangle(std::move(rectangle));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateVarCircleCmd(uint32_t id,
+                                                uint32_t radius_var_id,
+                                                uint32_t height_var_id) {
+  fuchsia::ui::gfx::Value radius_value;
+  radius_value.set_variable_id(radius_var_id);
+
+  fuchsia::ui::gfx::CircleArgs circle;
+  circle.radius = std::move(radius_value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_circle(std::move(circle));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateVarRectangleCmd(uint32_t id,
+                                                   uint32_t width_var_id,
+                                                   uint32_t height_var_id) {
+  fuchsia::ui::gfx::Value width_value;
+  width_value.set_variable_id(width_var_id);
+
+  fuchsia::ui::gfx::Value height_value;
+  height_value.set_variable_id(height_var_id);
+
+  fuchsia::ui::gfx::RectangleArgs rectangle;
+  rectangle.width = std::move(width_value);
+  rectangle.height = std::move(height_value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_rectangle(std::move(rectangle));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateVarRoundedRectangleCmd(
+    uint32_t id, uint32_t width_var_id, uint32_t height_var_id,
+    uint32_t top_left_radius_var_id, uint32_t top_right_radius_var_id,
+    uint32_t bottom_left_radius_var_id, uint32_t bottom_right_radius_var_id) {
+  fuchsia::ui::gfx::Value width_value;
+  width_value.set_variable_id(width_var_id);
+
+  fuchsia::ui::gfx::Value height_value;
+  height_value.set_variable_id(height_var_id);
+
+  fuchsia::ui::gfx::Value top_left_radius_value;
+  top_left_radius_value.set_variable_id(top_left_radius_var_id);
+
+  fuchsia::ui::gfx::Value top_right_radius_value;
+  top_right_radius_value.set_variable_id(top_right_radius_var_id);
+
+  fuchsia::ui::gfx::Value bottom_left_radius_value;
+  bottom_left_radius_value.set_variable_id(bottom_left_radius_var_id);
+
+  fuchsia::ui::gfx::Value bottom_right_radius_value;
+  bottom_right_radius_value.set_variable_id(bottom_right_radius_var_id);
+
+  fuchsia::ui::gfx::RoundedRectangleArgs rectangle;
+  rectangle.width = std::move(width_value);
+  rectangle.height = std::move(height_value);
+  rectangle.top_left_radius = std::move(top_left_radius_value);
+  rectangle.top_right_radius = std::move(top_right_radius_value);
+  rectangle.bottom_left_radius = std::move(bottom_left_radius_value);
+  rectangle.bottom_right_radius = std::move(bottom_right_radius_value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_rounded_rectangle(std::move(rectangle));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateMeshCmd(uint32_t id) {
+  fuchsia::ui::gfx::MeshArgs mesh;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_mesh(std::move(mesh));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateMaterialCmd(uint32_t id) {
+  fuchsia::ui::gfx::MaterialArgs material;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_material(std::move(material));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateClipNodeCmd(uint32_t id) {
+  fuchsia::ui::gfx::ClipNodeArgs node;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_clip_node(std::move(node));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateEntityNodeCmd(uint32_t id) {
+  fuchsia::ui::gfx::EntityNodeArgs node;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_entity_node(std::move(node));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateOpacityNodeCmd(uint32_t id) {
+  fuchsia::ui::gfx::OpacityNodeArgs node;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_opacity_node(std::move(node));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateShapeNodeCmd(uint32_t id) {
+  fuchsia::ui::gfx::ShapeNodeArgs node;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_shape_node(std::move(node));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateViewCmd(uint32_t id, zx::eventpair token,
+                                           const std::string& debug_name) {
+  ZX_DEBUG_ASSERT(token);
+  fuchsia::ui::gfx::ViewArgs view;
+  view.token = std::move(token);
+  view.debug_name = debug_name;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_view(std::move(view));
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateViewHolderCmd(
+    uint32_t id, zx::eventpair token, const std::string& debug_name) {
+  ZX_DEBUG_ASSERT(token);
+  fuchsia::ui::gfx::ViewHolderArgs view_holder;
+  view_holder.token = std::move(token);
+  view_holder.debug_name = debug_name;
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_view_holder(std::move(view_holder));
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewCreateVariableCmd(uint32_t id,
+                                               fuchsia::ui::gfx::Value value) {
+  fuchsia::ui::gfx::VariableArgs variable;
+  switch (value.Which()) {
+    case ::fuchsia::ui::gfx::Value::Tag::kVector1:
+      variable.type = fuchsia::ui::gfx::ValueType::kVector1;
+      break;
+    case ::fuchsia::ui::gfx::Value::Tag::kVector2:
+      variable.type = fuchsia::ui::gfx::ValueType::kVector2;
+      break;
+    case ::fuchsia::ui::gfx::Value::Tag::kVector3:
+      variable.type = fuchsia::ui::gfx::ValueType::kVector3;
+      break;
+    case ::fuchsia::ui::gfx::Value::Tag::kVector4:
+      variable.type = fuchsia::ui::gfx::ValueType::kVector4;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kMatrix4x4:
+      variable.type = fuchsia::ui::gfx::ValueType::kMatrix4;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kColorRgba:
+      variable.type = fuchsia::ui::gfx::ValueType::kColorRgba;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kColorRgb:
+      variable.type = fuchsia::ui::gfx::ValueType::kColorRgb;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kDegrees:
+      variable.type = fuchsia::ui::gfx::ValueType::kVector1;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kTransform:
+      variable.type = fuchsia::ui::gfx::ValueType::kFactoredTransform;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kQuaternion:
+      variable.type = fuchsia::ui::gfx::ValueType::kQuaternion;
+      break;
+    case fuchsia::ui::gfx::Value::Tag::kVariableId:
+      // A variable's initial value cannot be another variable.
+      return fuchsia::ui::gfx::Command();
+    case fuchsia::ui::gfx::Value::Tag::Invalid:
+      return fuchsia::ui::gfx::Command();
+  }
+  variable.initial_value = std::move(value);
+
+  fuchsia::ui::gfx::ResourceArgs resource;
+  resource.set_variable(std::move(variable));
+
+  return NewCreateResourceCmd(id, std::move(resource));
+}
+
+fuchsia::ui::gfx::Command NewReleaseResourceCmd(uint32_t id) {
+  fuchsia::ui::gfx::ReleaseResourceCmd release_resource;
+  release_resource.id = id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_release_resource(std::move(release_resource));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewExportResourceCmd(uint32_t resource_id,
+                                               zx::eventpair export_token) {
+  ZX_DEBUG_ASSERT(export_token);
+
+  fuchsia::ui::gfx::ExportResourceCmd export_resource;
+  export_resource.id = resource_id;
+  export_resource.token = std::move(export_token);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_export_resource(std::move(export_resource));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewImportResourceCmd(
+    uint32_t resource_id, fuchsia::ui::gfx::ImportSpec spec,
+    zx::eventpair import_token) {
+  ZX_DEBUG_ASSERT(import_token);
+
+  fuchsia::ui::gfx::ImportResourceCmd import_resource;
+  import_resource.id = resource_id;
+  import_resource.token = std::move(import_token);
+  import_resource.spec = spec;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_import_resource(std::move(import_resource));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewExportResourceCmdAsRequest(
+    uint32_t resource_id, zx::eventpair* out_import_token) {
+  ZX_DEBUG_ASSERT(out_import_token);
+  ZX_DEBUG_ASSERT(!*out_import_token);
+
+  zx::eventpair export_token;
+  zx_status_t status =
+      zx::eventpair::create(0u, &export_token, out_import_token);
+  ZX_DEBUG_ASSERT_MSG(status == ZX_OK, "event pair create failed: status=%d",
+                      status);
+  return NewExportResourceCmd(resource_id, std::move(export_token));
+}
+
+fuchsia::ui::gfx::Command NewImportResourceCmdAsRequest(
+    uint32_t resource_id, fuchsia::ui::gfx::ImportSpec import_spec,
+    zx::eventpair* out_export_token) {
+  ZX_DEBUG_ASSERT(out_export_token);
+  ZX_DEBUG_ASSERT(!*out_export_token);
+
+  zx::eventpair import_token;
+  zx_status_t status =
+      zx::eventpair::create(0u, &import_token, out_export_token);
+  ZX_DEBUG_ASSERT_MSG(status == ZX_OK, "event pair create failed: status=%d",
+                      status);
+  return NewImportResourceCmd(resource_id, import_spec,
+                              std::move(import_token));
+}
+
+fuchsia::ui::gfx::Command NewSetViewPropertiesCmd(
+    uint32_t view_holder_id, const float bounding_box_min[3],
+    const float bounding_box_max[3], const float inset_from_min[3],
+    const float inset_from_max[3]) {
+  fuchsia::ui::gfx::SetViewPropertiesCmd set_view_properties;
+  set_view_properties.view_holder_id = view_holder_id;
+  auto& props = set_view_properties.properties;
+  props.bounding_box.min = NewVector3(bounding_box_min);
+  props.bounding_box.max = NewVector3(bounding_box_max);
+  props.inset_from_min = NewVector3(inset_from_min);
+  props.inset_from_max = NewVector3(inset_from_max);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_view_properties(std::move(set_view_properties));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetViewPropertiesCmd(
+    uint32_t view_holder_id, const fuchsia::ui::gfx::ViewProperties& props) {
+  fuchsia::ui::gfx::SetViewPropertiesCmd set_view_properties;
+  set_view_properties.view_holder_id = view_holder_id;
+  set_view_properties.properties = props;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_view_properties(std::move(set_view_properties));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewAddChildCmd(uint32_t node_id, uint32_t child_id) {
+  fuchsia::ui::gfx::AddChildCmd add_child;
+  add_child.node_id = node_id;
+  add_child.child_id = child_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_add_child(std::move(add_child));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewAddPartCmd(uint32_t node_id, uint32_t part_id) {
+  fuchsia::ui::gfx::AddPartCmd add_part;
+  add_part.node_id = node_id;
+  add_part.part_id = part_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_add_part(std::move(add_part));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewDetachCmd(uint32_t id) {
+  fuchsia::ui::gfx::DetachCmd detach;
+  detach.id = id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_detach(std::move(detach));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewDetachChildrenCmd(uint32_t node_id) {
+  fuchsia::ui::gfx::DetachChildrenCmd detach_children;
+  detach_children.node_id = node_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_detach_children(std::move(detach_children));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetTranslationCmd(uint32_t node_id,
+                                               const float translation[3]) {
+  fuchsia::ui::gfx::SetTranslationCmd set_translation;
+  set_translation.id = node_id;
+  set_translation.value = NewVector3Value(translation);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_translation(std::move(set_translation));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetTranslationCmd(uint32_t node_id,
+                                               uint32_t variable_id) {
+  fuchsia::ui::gfx::SetTranslationCmd set_translation;
+  set_translation.id = node_id;
+  set_translation.value = NewVector3Value(variable_id);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_translation(std::move(set_translation));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetScaleCmd(uint32_t node_id,
+                                         const float scale[3]) {
+  fuchsia::ui::gfx::SetScaleCmd set_scale;
+  set_scale.id = node_id;
+  set_scale.value = NewVector3Value(scale);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_scale(std::move(set_scale));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetScaleCmd(uint32_t node_id,
+                                         uint32_t variable_id) {
+  fuchsia::ui::gfx::SetScaleCmd set_scale;
+  set_scale.id = node_id;
+  set_scale.value = NewVector3Value(variable_id);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_scale(std::move(set_scale));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetRotationCmd(uint32_t node_id,
+                                            const float quaternion[4]) {
+  fuchsia::ui::gfx::SetRotationCmd set_rotation;
+  set_rotation.id = node_id;
+  set_rotation.value = NewQuaternionValue(quaternion);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_rotation(std::move(set_rotation));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetRotationCmd(uint32_t node_id,
+                                            uint32_t variable_id) {
+  fuchsia::ui::gfx::SetRotationCmd set_rotation;
+  set_rotation.id = node_id;
+  set_rotation.value = NewQuaternionValue(variable_id);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_rotation(std::move(set_rotation));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetAnchorCmd(uint32_t node_id,
+                                          const float anchor[3]) {
+  fuchsia::ui::gfx::SetAnchorCmd set_anchor;
+  set_anchor.id = node_id;
+  set_anchor.value = NewVector3Value(anchor);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_anchor(std::move(set_anchor));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetAnchorCmd(uint32_t node_id,
+                                          uint32_t variable_id) {
+  fuchsia::ui::gfx::SetAnchorCmd set_anchor;
+  set_anchor.id = node_id;
+  set_anchor.value = NewVector3Value(variable_id);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_anchor(std::move(set_anchor));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetOpacityCmd(uint32_t node_id, float opacity) {
+  fuchsia::ui::gfx::SetOpacityCmd set_opacity;
+  set_opacity.node_id = node_id;
+  set_opacity.opacity = opacity;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_opacity(std::move(set_opacity));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSendSizeChangeHintCmdHACK(
+    uint32_t node_id, float width_change_factor, float height_change_factor) {
+  fuchsia::ui::gfx::SendSizeChangeHintCmdHACK send_size_change_hint;
+  send_size_change_hint.node_id = node_id;
+  send_size_change_hint.width_change_factor = width_change_factor;
+  send_size_change_hint.height_change_factor = height_change_factor;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_send_size_change_hint_hack(std::move(send_size_change_hint));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetShapeCmd(uint32_t node_id, uint32_t shape_id) {
+  fuchsia::ui::gfx::SetShapeCmd set_shape;
+  set_shape.node_id = node_id;
+  set_shape.shape_id = shape_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_shape(std::move(set_shape));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetMaterialCmd(uint32_t node_id,
+                                            uint32_t material_id) {
+  fuchsia::ui::gfx::SetMaterialCmd set_material;
+  set_material.node_id = node_id;
+  set_material.material_id = material_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_material(std::move(set_material));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetClipCmd(uint32_t node_id, uint32_t clip_id,
+                                        bool clip_to_self) {
+  fuchsia::ui::gfx::SetClipCmd set_clip;
+  set_clip.node_id = node_id;
+  set_clip.clip_id = clip_id;
+  set_clip.clip_to_self = clip_to_self;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_clip(std::move(set_clip));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetTagCmd(uint32_t node_id, uint32_t tag_value) {
+  fuchsia::ui::gfx::SetTagCmd set_tag;
+  set_tag.node_id = node_id;
+  set_tag.tag_value = tag_value;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_tag(std::move(set_tag));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewTakeSnapshotCmdHACK(
+    uint32_t node_id, fuchsia::ui::gfx::SnapshotCallbackHACKPtr callback) {
+  fuchsia::ui::gfx::TakeSnapshotCmdHACK snapshot_cmd;
+  snapshot_cmd.node_id = node_id;
+  snapshot_cmd.callback = std::move(callback);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_take_snapshot_cmd(std::move(snapshot_cmd));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetHitTestBehaviorCmd(
+    uint32_t node_id, fuchsia::ui::gfx::HitTestBehavior hit_test_behavior) {
+  fuchsia::ui::gfx::SetHitTestBehaviorCmd set_hit_test_behavior;
+  set_hit_test_behavior.node_id = node_id;
+  set_hit_test_behavior.hit_test_behavior = hit_test_behavior;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_hit_test_behavior(std::move(set_hit_test_behavior));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetCameraCmd(uint32_t renderer_id,
+                                          uint32_t camera_id) {
+  fuchsia::ui::gfx::SetCameraCmd set_camera;
+  set_camera.renderer_id = renderer_id;
+  set_camera.camera_id = camera_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_camera(std::move(set_camera));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetTextureCmd(uint32_t material_id,
+                                           uint32_t texture_id) {
+  fuchsia::ui::gfx::SetTextureCmd set_texture;
+  set_texture.material_id = material_id;
+  set_texture.texture_id = texture_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_texture(std::move(set_texture));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetColorCmd(uint32_t material_id, uint8_t red,
+                                         uint8_t green, uint8_t blue,
+                                         uint8_t alpha) {
+  fuchsia::ui::gfx::ColorRgbaValue color;
+  color.value.red = red;
+  color.value.green = green;
+  color.value.blue = blue;
+  color.value.alpha = alpha;
+  color.variable_id = 0;
+  fuchsia::ui::gfx::SetColorCmd set_color;
+  set_color.material_id = material_id;
+  set_color.color = std::move(color);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_color(std::move(set_color));
+
+  return command;
+}
+
+fuchsia::ui::gfx::MeshVertexFormat NewMeshVertexFormat(
+    fuchsia::ui::gfx::ValueType position_type,
+    fuchsia::ui::gfx::ValueType normal_type,
+    fuchsia::ui::gfx::ValueType tex_coord_type) {
+  fuchsia::ui::gfx::MeshVertexFormat vertex_format;
+  vertex_format.position_type = position_type;
+  vertex_format.normal_type = normal_type;
+  vertex_format.tex_coord_type = tex_coord_type;
+  return vertex_format;
+}
+
+fuchsia::ui::gfx::Command NewBindMeshBuffersCmd(
+    uint32_t mesh_id, uint32_t index_buffer_id,
+    fuchsia::ui::gfx::MeshIndexFormat index_format, uint64_t index_offset,
+    uint32_t index_count, uint32_t vertex_buffer_id,
+    fuchsia::ui::gfx::MeshVertexFormat vertex_format, uint64_t vertex_offset,
+    uint32_t vertex_count, const float bounding_box_min[3],
+    const float bounding_box_max[3]) {
+  fuchsia::ui::gfx::BindMeshBuffersCmd bind_mesh_buffers;
+  bind_mesh_buffers.mesh_id = mesh_id;
+  bind_mesh_buffers.index_buffer_id = index_buffer_id;
+  bind_mesh_buffers.index_format = index_format;
+  bind_mesh_buffers.index_offset = index_offset;
+  bind_mesh_buffers.index_count = index_count;
+  bind_mesh_buffers.vertex_buffer_id = vertex_buffer_id;
+  bind_mesh_buffers.vertex_format = std::move(vertex_format);
+  bind_mesh_buffers.vertex_offset = vertex_offset;
+  bind_mesh_buffers.vertex_count = vertex_count;
+  auto& bbox = bind_mesh_buffers.bounding_box;
+  bbox.min.x = bounding_box_min[0];
+  bbox.min.y = bounding_box_min[1];
+  bbox.min.z = bounding_box_min[2];
+  bbox.max.x = bounding_box_max[0];
+  bbox.max.y = bounding_box_max[1];
+  bbox.max.z = bounding_box_max[2];
+
+  fuchsia::ui::gfx::Command command;
+  command.set_bind_mesh_buffers(std::move(bind_mesh_buffers));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewAddLayerCmd(uint32_t layer_stack_id,
+                                         uint32_t layer_id) {
+  fuchsia::ui::gfx::AddLayerCmd add_layer;
+  add_layer.layer_stack_id = layer_stack_id;
+  add_layer.layer_id = layer_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_add_layer(std::move(add_layer));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewRemoveLayerCmd(uint32_t layer_stack_id,
+                                            uint32_t layer_id) {
+  fuchsia::ui::gfx::RemoveLayerCmd remove_layer;
+  remove_layer.layer_stack_id = layer_stack_id;
+  remove_layer.layer_id = layer_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_remove_layer(std::move(remove_layer));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewRemoveAllLayersCmd(uint32_t layer_stack_id) {
+  fuchsia::ui::gfx::RemoveAllLayersCmd remove_all_layers;
+  remove_all_layers.layer_stack_id = layer_stack_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_remove_all_layers(std::move(remove_all_layers));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetLayerStackCmd(uint32_t compositor_id,
+                                              uint32_t layer_stack_id) {
+  fuchsia::ui::gfx::SetLayerStackCmd set_layer_stack;
+  set_layer_stack.compositor_id = compositor_id;
+  set_layer_stack.layer_stack_id = layer_stack_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_layer_stack(std::move(set_layer_stack));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetRendererCmd(uint32_t layer_id,
+                                            uint32_t renderer_id) {
+  fuchsia::ui::gfx::SetRendererCmd set_renderer;
+  set_renderer.layer_id = layer_id;
+  set_renderer.renderer_id = renderer_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_renderer(std::move(set_renderer));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetRendererParamCmd(
+    uint32_t renderer_id, fuchsia::ui::gfx::RendererParam param) {
+  fuchsia::ui::gfx::SetRendererParamCmd param_command;
+  param_command.renderer_id = renderer_id;
+  param_command.param = std::move(param);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_renderer_param(std::move(param_command));
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetSizeCmd(uint32_t node_id, const float size[2]) {
+  fuchsia::ui::gfx::SetSizeCmd set_size;
+  set_size.id = node_id;
+  auto& value = set_size.value.value;
+  value.x = size[0];
+  value.y = size[1];
+  set_size.value.variable_id = 0;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_size(std::move(set_size));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetCameraTransformCmd(uint32_t camera_id,
+                                                   const float eye_position[3],
+                                                   const float eye_look_at[3],
+                                                   const float eye_up[3]) {
+  fuchsia::ui::gfx::SetCameraTransformCmd set_command;
+  set_command.camera_id = camera_id;
+  set_command.eye_position = NewVector3Value(eye_position);
+  set_command.eye_look_at = NewVector3Value(eye_look_at);
+  set_command.eye_up = NewVector3Value(eye_up);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_camera_transform(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetCameraProjectionCmd(uint32_t camera_id,
+                                                    const float fovy) {
+  fuchsia::ui::gfx::SetCameraProjectionCmd set_command;
+  set_command.camera_id = camera_id;
+  set_command.fovy = NewFloatValue(fovy);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_camera_projection(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetStereoCameraProjectionCmd(
+    uint32_t camera_id, const float left_projection[16],
+    const float right_projection[16]) {
+  fuchsia::ui::gfx::SetStereoCameraProjectionCmd set_command;
+  set_command.camera_id = camera_id;
+  set_command.left_projection = NewMatrix4Value(left_projection);
+  set_command.right_projection = NewMatrix4Value(right_projection);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_stereo_camera_projection(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetCameraPoseBufferCmd(uint32_t camera_id,
+                                                    uint32_t buffer_id,
+                                                    uint32_t num_entries,
+                                                    int64_t base_time,
+                                                    uint64_t time_interval) {
+  fuchsia::ui::gfx::SetCameraPoseBufferCmd set_command;
+  set_command.camera_id = camera_id;
+  set_command.buffer_id = buffer_id;
+  set_command.num_entries = num_entries;
+  set_command.base_time = base_time;
+  set_command.time_interval = time_interval;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_camera_pose_buffer(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetLightColorCmd(uint32_t light_id,
+                                              const float rgb[3]) {
+  fuchsia::ui::gfx::SetLightColorCmd set_command;
+  set_command.light_id = light_id;
+  set_command.color = NewColorRgbValue(rgb[0], rgb[1], rgb[2]);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_light_color(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetLightColorCmd(uint32_t light_id,
+                                              uint32_t variable_id) {
+  fuchsia::ui::gfx::SetLightColorCmd set_command;
+  set_command.light_id = light_id;
+  set_command.color = NewColorRgbValue(variable_id);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_light_color(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetLightDirectionCmd(uint32_t light_id,
+                                                  const float dir[3]) {
+  fuchsia::ui::gfx::SetLightDirectionCmd set_command;
+  set_command.light_id = light_id;
+  set_command.direction = NewVector3Value(dir);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_light_direction(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetLightDirectionCmd(uint32_t light_id,
+                                                  uint32_t variable_id) {
+  fuchsia::ui::gfx::SetLightDirectionCmd set_command;
+  set_command.light_id = light_id;
+  set_command.direction = NewVector3Value(variable_id);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_light_direction(std::move(set_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewAddLightCmd(uint32_t scene_id, uint32_t light_id) {
+  fuchsia::ui::gfx::AddLightCmd add_light_command;
+  add_light_command.scene_id = scene_id;
+  add_light_command.light_id = light_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_add_light(std::move(add_light_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewDetachLightCmd(uint32_t light_id) {
+  fuchsia::ui::gfx::DetachLightCmd detach_light_command;
+  detach_light_command.light_id = light_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_detach_light(std::move(detach_light_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewDetachLightsCmd(uint32_t scene_id) {
+  fuchsia::ui::gfx::DetachLightsCmd detach_lights_command;
+  detach_lights_command.scene_id = scene_id;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_detach_lights(std::move(detach_lights_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetEventMaskCmd(uint32_t resource_id,
+                                             uint32_t event_mask) {
+  fuchsia::ui::gfx::SetEventMaskCmd set_event_mask_command;
+  set_event_mask_command.id = resource_id;
+  set_event_mask_command.event_mask = event_mask;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_event_mask(std::move(set_event_mask_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetLabelCmd(uint32_t resource_id,
+                                         const std::string& label) {
+  fuchsia::ui::gfx::SetLabelCmd set_label_command;
+  set_label_command.id = resource_id;
+  set_label_command.label = label.substr(0, fuchsia::ui::gfx::kLabelMaxLength);
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_label(std::move(set_label_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::Command NewSetDisableClippingCmd(uint32_t renderer_id,
+                                                   bool disable_clipping) {
+  fuchsia::ui::gfx::SetDisableClippingCmd set_disable_clipping_command;
+  set_disable_clipping_command.renderer_id = renderer_id;
+  set_disable_clipping_command.disable_clipping = disable_clipping;
+
+  fuchsia::ui::gfx::Command command;
+  command.set_set_disable_clipping(std::move(set_disable_clipping_command));
+
+  return command;
+}
+
+fuchsia::ui::gfx::FloatValue NewFloatValue(float value) {
+  fuchsia::ui::gfx::FloatValue val;
+  val.variable_id = 0;
+  val.value = value;
+  return val;
+}
+
+fuchsia::ui::gfx::vec2 NewVector2(const float value[2]) {
+  fuchsia::ui::gfx::vec2 val;
+  val.x = value[0];
+  val.y = value[1];
+  return val;
+}
+
+fuchsia::ui::gfx::Vector2Value NewVector2Value(const float value[2]) {
+  fuchsia::ui::gfx::Vector2Value val;
+  val.variable_id = 0;
+  val.value = NewVector2(value);
+  return val;
+}
+
+fuchsia::ui::gfx::Vector2Value NewVector2Value(uint32_t variable_id) {
+  fuchsia::ui::gfx::Vector2Value val;
+  val.variable_id = variable_id;
+  return val;
+}
+
+fuchsia::ui::gfx::vec3 NewVector3(const float value[3]) {
+  fuchsia::ui::gfx::vec3 val;
+  val.x = value[0];
+  val.y = value[1];
+  val.z = value[2];
+  return val;
+}
+
+fuchsia::ui::gfx::Vector3Value NewVector3Value(const float value[3]) {
+  fuchsia::ui::gfx::Vector3Value val;
+  val.variable_id = 0;
+  val.value = NewVector3(value);
+  return val;
+}
+
+fuchsia::ui::gfx::Vector3Value NewVector3Value(uint32_t variable_id) {
+  fuchsia::ui::gfx::Vector3Value val;
+  val.variable_id = variable_id;
+  return val;
+}
+
+fuchsia::ui::gfx::vec4 NewVector4(const float value[4]) {
+  fuchsia::ui::gfx::vec4 val;
+  val.x = value[0];
+  val.y = value[1];
+  val.z = value[2];
+  val.w = value[3];
+  return val;
+}
+
+fuchsia::ui::gfx::Vector4Value NewVector4Value(const float value[4]) {
+  fuchsia::ui::gfx::Vector4Value val;
+  val.variable_id = 0;
+  val.value = NewVector4(value);
+  return val;
+}
+
+fuchsia::ui::gfx::Vector4Value NewVector4Value(uint32_t variable_id) {
+  fuchsia::ui::gfx::Vector4Value val;
+  val.variable_id = variable_id;
+  return val;
+}
+
+fuchsia::ui::gfx::Quaternion NewQuaternion(const float value[4]) {
+  fuchsia::ui::gfx::Quaternion val;
+  val.x = value[0];
+  val.y = value[1];
+  val.z = value[2];
+  val.w = value[3];
+  return val;
+}
+
+fuchsia::ui::gfx::QuaternionValue NewQuaternionValue(const float value[4]) {
+  fuchsia::ui::gfx::QuaternionValue val;
+  val.variable_id = 0;
+  val.value = NewQuaternion(value);
+  return val;
+}
+
+fuchsia::ui::gfx::QuaternionValue NewQuaternionValue(uint32_t variable_id) {
+  fuchsia::ui::gfx::QuaternionValue val;
+  val.variable_id = variable_id;
+  return val;
+}
+
+fuchsia::ui::gfx::mat4 NewMatrix4(const float matrix[16]) {
+  fuchsia::ui::gfx::mat4 val;
+  val.matrix[0] = matrix[0];
+  val.matrix[1] = matrix[1];
+  val.matrix[2] = matrix[2];
+  val.matrix[3] = matrix[3];
+  val.matrix[4] = matrix[4];
+  val.matrix[5] = matrix[5];
+  val.matrix[6] = matrix[6];
+  val.matrix[7] = matrix[7];
+  val.matrix[8] = matrix[8];
+  val.matrix[9] = matrix[9];
+  val.matrix[10] = matrix[10];
+  val.matrix[11] = matrix[11];
+  val.matrix[12] = matrix[12];
+  val.matrix[13] = matrix[13];
+  val.matrix[14] = matrix[14];
+  val.matrix[15] = matrix[15];
+  return val;
+}
+
+fuchsia::ui::gfx::Matrix4Value NewMatrix4Value(const float matrix[16]) {
+  fuchsia::ui::gfx::Matrix4Value val;
+  val.variable_id = 0;
+  val.value = NewMatrix4(matrix);
+  return val;
+}
+
+fuchsia::ui::gfx::Matrix4Value NewMatrix4Value(uint32_t variable_id) {
+  fuchsia::ui::gfx::Matrix4Value val;
+  val.variable_id = variable_id;
+  return val;
+}
+
+fuchsia::ui::gfx::ColorRgbValue NewColorRgbValue(float red, float green,
+                                                 float blue) {
+  fuchsia::ui::gfx::ColorRgbValue val;
+  val.variable_id = 0;
+  auto& color = val.value;
+  color.red = red;
+  color.green = green;
+  color.blue = blue;
+
+  return val;
+}
+
+fuchsia::ui::gfx::ColorRgbValue NewColorRgbValue(uint32_t variable_id) {
+  fuchsia::ui::gfx::ColorRgbValue val;
+  val.variable_id = variable_id;
+
+  return val;
+}
+
+fuchsia::ui::gfx::ColorRgbaValue NewColorRgbaValue(const uint8_t value[4]) {
+  fuchsia::ui::gfx::ColorRgbaValue val;
+  val.variable_id = 0;
+  auto& color = val.value;
+  color.red = value[0];
+  color.green = value[1];
+  color.blue = value[2];
+  color.alpha = value[3];
+
+  return val;
+}
+
+fuchsia::ui::gfx::ColorRgbaValue NewColorRgbaValue(uint32_t variable_id) {
+  fuchsia::ui::gfx::ColorRgbaValue val;
+  val.variable_id = variable_id;
+
+  return val;
+}
+
+// TODO(mikejurka): this should be in an images util file
+bool ImageInfoEquals(const fuchsia::images::ImageInfo& a,
+                     const fuchsia::images::ImageInfo& b) {
+  return a.transform == b.transform && a.width == b.width &&
+         a.height == b.height && a.stride == b.stride &&
+         a.pixel_format == b.pixel_format && a.color_space == b.color_space &&
+         a.tiling == b.tiling && a.alpha_format == b.alpha_format;
+}
+
+}  // namespace scenic
diff --git a/pkg/scenic_cpp/host_image_cycler.cc b/pkg/scenic_cpp/host_image_cycler.cc
new file mode 100644
index 0000000..70b45d6
--- /dev/null
+++ b/pkg/scenic_cpp/host_image_cycler.cc
@@ -0,0 +1,65 @@
+// 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.
+
+#include "lib/ui/scenic/cpp/host_image_cycler.h"
+
+#include <zircon/assert.h>
+
+namespace scenic {
+
+HostImageCycler::HostImageCycler(Session* session)
+    : EntityNode(session),
+      content_node_(session),
+      content_material_(session),
+      image_pool_(session, kNumBuffers) {
+  content_node_.SetMaterial(content_material_);
+  AddChild(content_node_);
+}
+
+HostImageCycler::~HostImageCycler() = default;
+
+const HostImage* HostImageCycler::AcquireImage(
+    uint32_t width, uint32_t height, uint32_t stride,
+    fuchsia::images::PixelFormat pixel_format,
+    fuchsia::images::ColorSpace color_space) {
+  ZX_DEBUG_ASSERT(!acquired_image_);
+
+  // Update the image pool and content shape.
+  fuchsia::images::ImageInfo image_info;
+  image_info.width = width;
+  image_info.height = height;
+  image_info.stride = stride;
+  image_info.pixel_format = pixel_format;
+  image_info.color_space = color_space;
+  image_info.tiling = fuchsia::images::Tiling::LINEAR;
+  reconfigured_ = image_pool_.Configure(&image_info);
+
+  const HostImage* image = image_pool_.GetImage(image_index_);
+  ZX_DEBUG_ASSERT(image);
+  acquired_image_ = true;
+  return image;
+}
+
+void HostImageCycler::ReleaseAndSwapImage() {
+  ZX_DEBUG_ASSERT(acquired_image_);
+  acquired_image_ = false;
+
+  const HostImage* image = image_pool_.GetImage(image_index_);
+  ZX_DEBUG_ASSERT(image);
+  content_material_.SetTexture(*image);
+
+  if (reconfigured_) {
+    Rectangle content_rect(content_node_.session(),
+                           image_pool_.image_info()->width,
+                           image_pool_.image_info()->height);
+    content_node_.SetShape(content_rect);
+    reconfigured_ = false;
+  }
+
+  // TODO(MZ-145): Define an |InvalidateCmd| on |Image| instead.
+  image_pool_.DiscardImage(image_index_);
+  image_index_ = (image_index_ + 1) % kNumBuffers;
+}
+
+}  // namespace scenic
diff --git a/pkg/scenic_cpp/host_memory.cc b/pkg/scenic_cpp/host_memory.cc
new file mode 100644
index 0000000..d01e665
--- /dev/null
+++ b/pkg/scenic_cpp/host_memory.cc
@@ -0,0 +1,151 @@
+// 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.
+
+#include "lib/ui/scenic/cpp/host_memory.h"
+
+#include <lib/zx/vmar.h>
+#include <lib/zx/vmo.h>
+#include <zircon/assert.h>
+#include <memory>
+
+#include "lib/ui/scenic/cpp/commands.h"
+
+namespace scenic {
+namespace {
+
+// Returns true if a memory object is of an appropriate size to recycle.
+bool CanReuseMemory(const HostMemory& memory, size_t desired_size) {
+  return memory.data_size() >= desired_size &&
+         memory.data_size() <= desired_size * 2;
+}
+
+std::pair<zx::vmo, std::shared_ptr<HostData>> AllocateMemory(size_t size) {
+  // Create the vmo and map it into this process.
+  zx::vmo local_vmo;
+  zx_status_t status = zx::vmo::create(size, 0u, &local_vmo);
+  ZX_ASSERT_MSG(status == ZX_OK, "vmo create failed: status=%d", status);
+  auto data = std::make_shared<HostData>(local_vmo, 0u, size);
+
+  // Drop rights before we transfer the VMO to the session manager.
+  // TODO(MA-492): Now that host-local memory may be concurrently used as
+  // device-local memory on UMA platforms, we need to keep all permissions on
+  // the duplicated vmo handle, until Vulkan can import read-only memory.
+  zx::vmo remote_vmo;
+  status = local_vmo.replace(ZX_RIGHT_SAME_RIGHTS, &remote_vmo);
+  ZX_ASSERT_MSG(status == ZX_OK, "replace rights failed: status=%d", status);
+  return std::make_pair(std::move(remote_vmo), std::move(data));
+}
+
+}  // namespace
+
+HostData::HostData(const zx::vmo& vmo, off_t offset, size_t size)
+    : size_(size) {
+  static const uint32_t flags =
+      ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE | ZX_VM_FLAG_MAP_RANGE;
+  uintptr_t ptr;
+  zx_status_t status =
+      zx::vmar::root_self()->map(0, vmo, offset, size, flags, &ptr);
+  ZX_ASSERT_MSG(status == ZX_OK, "map failed: status=%d", status);
+  ptr_ = reinterpret_cast<void*>(ptr);
+}
+
+HostData::~HostData() {
+  zx_status_t status =
+      zx::vmar::root_self()->unmap(reinterpret_cast<uintptr_t>(ptr_), size_);
+  ZX_ASSERT_MSG(status == ZX_OK, "unmap failed: status=%d", status);
+}
+
+HostMemory::HostMemory(Session* session, size_t size)
+    : HostMemory(session, AllocateMemory(size)) {}
+
+HostMemory::HostMemory(Session* session,
+                       std::pair<zx::vmo, std::shared_ptr<HostData>> init)
+    : Memory(session, std::move(init.first), init.second->size(),
+             fuchsia::images::MemoryType::HOST_MEMORY),
+      data_(std::move(init.second)) {}
+
+HostMemory::HostMemory(HostMemory&& moved)
+    : Memory(std::move(moved)), data_(std::move(moved.data_)) {}
+
+HostMemory::~HostMemory() = default;
+
+HostImage::HostImage(const HostMemory& memory, off_t memory_offset,
+                     fuchsia::images::ImageInfo info)
+    : HostImage(memory.session(), memory.id(), memory_offset, memory.data(),
+                std::move(info)) {}
+
+HostImage::HostImage(Session* session, uint32_t memory_id, off_t memory_offset,
+                     std::shared_ptr<HostData> data,
+                     fuchsia::images::ImageInfo info)
+    : Image(session, memory_id, memory_offset, std::move(info)),
+      data_(std::move(data)) {}
+
+HostImage::HostImage(HostImage&& moved)
+    : Image(std::move(moved)), data_(std::move(moved.data_)) {}
+
+HostImage::~HostImage() = default;
+
+HostImagePool::HostImagePool(Session* session, uint32_t num_images)
+    : session_(session), image_ptrs_(num_images), memory_ptrs_(num_images) {}
+
+HostImagePool::~HostImagePool() = default;
+
+// TODO(mikejurka): Double-check these changes
+bool HostImagePool::Configure(const fuchsia::images::ImageInfo* image_info) {
+  if (image_info) {
+    if (configured_ && ImageInfoEquals(*image_info, image_info_)) {
+      return false;  // no change
+    }
+    configured_ = true;
+    image_info_ = *image_info;
+  } else {
+    if (!configured_) {
+      return false;  // no change
+    }
+    configured_ = false;
+  }
+
+  for (uint32_t i = 0; i < num_images(); i++)
+    image_ptrs_[i].reset();
+
+  if (configured_) {
+    ZX_DEBUG_ASSERT(image_info_.width > 0);
+    ZX_DEBUG_ASSERT(image_info_.height > 0);
+    ZX_DEBUG_ASSERT(image_info_.stride > 0);
+
+    size_t desired_size = Image::ComputeSize(image_info_);
+    for (uint32_t i = 0; i < num_images(); i++) {
+      if (memory_ptrs_[i] && !CanReuseMemory(*memory_ptrs_[i], desired_size))
+        memory_ptrs_[i].reset();
+    }
+  }
+  return true;
+}
+
+const HostImage* HostImagePool::GetImage(uint32_t index) {
+  ZX_DEBUG_ASSERT(index < num_images());
+
+  if (image_ptrs_[index])
+    return image_ptrs_[index].get();
+
+  if (!configured_)
+    return nullptr;
+
+  if (!memory_ptrs_[index]) {
+    memory_ptrs_[index] =
+        std::make_unique<HostMemory>(session_, Image::ComputeSize(image_info_));
+  }
+
+  image_ptrs_[index] =
+      std::make_unique<HostImage>(*memory_ptrs_[index], 0u, image_info_);
+  return image_ptrs_[index].get();
+}
+
+void HostImagePool::DiscardImage(uint32_t index) {
+  ZX_DEBUG_ASSERT(index < num_images());
+
+  image_ptrs_[index].reset();
+}
+
+}  // namespace scenic
diff --git a/pkg/scenic_cpp/include/lib/ui/scenic/cpp/commands.h b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/commands.h
new file mode 100644
index 0000000..2c44a2f
--- /dev/null
+++ b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/commands.h
@@ -0,0 +1,268 @@
+// 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 LIB_UI_SCENIC_CPP_COMMANDS_H_
+#define LIB_UI_SCENIC_CPP_COMMANDS_H_
+
+#include <string>
+
+#include <fuchsia/images/cpp/fidl.h>
+#include <fuchsia/ui/gfx/cpp/fidl.h>
+#include <fuchsia/ui/scenic/cpp/fidl.h>
+
+namespace scenic {
+
+constexpr float kZeroesFloat3[3] = {0.f, 0.f, 0.f};
+constexpr float kOnesFloat3[3] = {1.f, 1.f, 1.f};
+// A quaterion that has no rotation.
+constexpr float kQuaternionDefault[4] = {0.f, 0.f, 0.f, 1.f};
+
+// Helper function for wrapping a GFX command as a Scenic command.
+fuchsia::ui::scenic::Command NewCommand(fuchsia::ui::gfx::Command command);
+
+// Helper function for wrapping an input command as a Scenic command.
+fuchsia::ui::scenic::Command NewCommand(fuchsia::ui::input::Command command);
+
+// Resource creation.
+fuchsia::ui::gfx::Command NewCreateMemoryCmd(
+    uint32_t id, zx::vmo vmo, uint64_t allocation_size,
+    fuchsia::images::MemoryType memory_type);
+fuchsia::ui::gfx::Command NewCreateImageCmd(uint32_t id, uint32_t memory_id,
+                                            uint32_t memory_offset,
+                                            fuchsia::images::ImageInfo info);
+fuchsia::ui::gfx::Command NewCreateImageCmd(
+    uint32_t id, uint32_t memory_id, uint32_t memory_offset,
+    fuchsia::images::PixelFormat format,
+    fuchsia::images::ColorSpace color_space, fuchsia::images::Tiling tiling,
+    uint32_t width, uint32_t height, uint32_t stride);
+fuchsia::ui::gfx::Command NewCreateImagePipeCmd(
+    uint32_t id, ::fidl::InterfaceRequest<fuchsia::images::ImagePipe> request);
+fuchsia::ui::gfx::Command NewCreateBufferCmd(uint32_t id, uint32_t memory_id,
+                                             uint32_t memory_offset,
+                                             uint32_t num_bytes);
+
+fuchsia::ui::gfx::Command NewCreateCompositorCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateDisplayCompositorCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateLayerStackCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateLayerCmd(uint32_t id);
+
+fuchsia::ui::gfx::Command NewCreateSceneCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateCameraCmd(uint32_t id, uint32_t scene_id);
+fuchsia::ui::gfx::Command NewCreateStereoCameraCmd(uint32_t id,
+                                                   uint32_t scene_id);
+fuchsia::ui::gfx::Command NewCreateRendererCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateAmbientLightCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateDirectionalLightCmd(uint32_t id);
+
+fuchsia::ui::gfx::Command NewCreateCircleCmd(uint32_t id, float radius);
+fuchsia::ui::gfx::Command NewCreateRectangleCmd(uint32_t id, float width,
+                                                float height);
+fuchsia::ui::gfx::Command NewCreateRoundedRectangleCmd(
+    uint32_t id, float width, float height, float top_left_radius,
+    float top_right_radius, float bottom_right_radius,
+    float bottom_left_radius);
+
+// Variant of NewCreateCircleCmd that uses a variable radius instead of a
+// constant one set at construction time.
+fuchsia::ui::gfx::Command NewCreateVarCircleCmd(uint32_t id,
+                                                uint32_t radius_var_id);
+// Variant of NewCreateRectangleCmd that uses a variable width/height
+// instead of constant ones set at construction time.
+fuchsia::ui::gfx::Command NewCreateVarRectangleCmd(uint32_t id,
+                                                   uint32_t width_var_id,
+                                                   uint32_t height_var_id);
+// Variant of NewCreateRoundedRectangleCmd that uses a variable
+// width/height/etc. instead of constant ones set at construction time.
+fuchsia::ui::gfx::Command NewCreateVarRoundedRectangleCmd(
+    uint32_t id, uint32_t width_var_id, uint32_t height_var_id,
+    uint32_t top_left_radius_var_id, uint32_t top_right_radius_var_id,
+    uint32_t bottom_left_radius_var_id, uint32_t bottom_right_radius_var_id);
+
+fuchsia::ui::gfx::Command NewCreateMeshCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateMaterialCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateClipNodeCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateEntityNodeCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateOpacityNodeCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateShapeNodeCmd(uint32_t id);
+fuchsia::ui::gfx::Command NewCreateViewCmd(uint32_t id, zx::eventpair token,
+                                           const std::string& debug_name);
+fuchsia::ui::gfx::Command NewCreateViewHolderCmd(uint32_t id,
+                                                 zx::eventpair token,
+                                                 const std::string& debug_name);
+fuchsia::ui::gfx::Command NewCreateVariableCmd(uint32_t id,
+                                               fuchsia::ui::gfx::Value value);
+
+fuchsia::ui::gfx::Command NewReleaseResourceCmd(uint32_t id);
+
+// Export & Import operations.
+fuchsia::ui::gfx::Command NewExportResourceCmd(uint32_t resource_id,
+                                               zx::eventpair export_token);
+fuchsia::ui::gfx::Command NewImportResourceCmd(
+    uint32_t resource_id, fuchsia::ui::gfx::ImportSpec spec,
+    zx::eventpair import_token);
+
+// Exports the resource and returns an import token in |out_import_token|
+// which allows it to be imported into other sessions.
+fuchsia::ui::gfx::Command NewExportResourceCmdAsRequest(
+    uint32_t resource_id, zx::eventpair* out_import_token);
+
+// Imports the resource and returns an export token in |out_export_token|
+// by which another session can export a resource to associate with this import.
+fuchsia::ui::gfx::Command NewImportResourceCmdAsRequest(
+    uint32_t resource_id, fuchsia::ui::gfx::ImportSpec import_spec,
+    zx::eventpair* out_export_token);
+
+// View/ViewHolder commands.
+fuchsia::ui::gfx::Command NewSetViewPropertiesCmd(
+    uint32_t view_holder_id, const float bounding_box_min[3],
+    const float bounding_box_max[3], const float inset_from_min[3],
+    const float inset_from_max[3]);
+fuchsia::ui::gfx::Command NewSetViewPropertiesCmd(
+    uint32_t view_holder_id, const fuchsia::ui::gfx::ViewProperties& props);
+
+// Node operations.
+fuchsia::ui::gfx::Command NewAddChildCmd(uint32_t node_id, uint32_t child_id);
+fuchsia::ui::gfx::Command NewAddPartCmd(uint32_t node_id, uint32_t part_id);
+fuchsia::ui::gfx::Command NewDetachCmd(uint32_t node_id);
+fuchsia::ui::gfx::Command NewDetachChildrenCmd(uint32_t node_id);
+fuchsia::ui::gfx::Command NewSetTranslationCmd(uint32_t node_id,
+                                               const float translation[3]);
+fuchsia::ui::gfx::Command NewSetTranslationCmd(uint32_t node_id,
+                                               uint32_t variable_id);
+fuchsia::ui::gfx::Command NewSetScaleCmd(uint32_t node_id,
+                                         const float scale[3]);
+fuchsia::ui::gfx::Command NewSetScaleCmd(uint32_t node_id,
+                                         uint32_t variable_id);
+fuchsia::ui::gfx::Command NewSetRotationCmd(uint32_t node_id,
+                                            const float quaternion[4]);
+fuchsia::ui::gfx::Command NewSetRotationCmd(uint32_t node_id,
+                                            uint32_t variable_id);
+fuchsia::ui::gfx::Command NewSetAnchorCmd(uint32_t node_id,
+                                          const float anchor[3]);
+fuchsia::ui::gfx::Command NewSetAnchorCmd(uint32_t node_id,
+                                          uint32_t variable_id);
+
+fuchsia::ui::gfx::Command NewSetOpacityCmd(uint32_t node_id, float opacity);
+fuchsia::ui::gfx::Command NewSendSizeChangeHintCmdHACK(
+    uint32_t node_id, float width_change_factor, float height_change_factor);
+fuchsia::ui::gfx::Command NewSetShapeCmd(uint32_t node_id, uint32_t shape_id);
+fuchsia::ui::gfx::Command NewSetMaterialCmd(uint32_t node_id,
+                                            uint32_t material_id);
+fuchsia::ui::gfx::Command NewSetClipCmd(uint32_t node_id, uint32_t clip_id,
+                                        bool clip_to_self);
+fuchsia::ui::gfx::Command NewSetTagCmd(uint32_t node_id, uint32_t tag_value);
+fuchsia::ui::gfx::Command NewSetHitTestBehaviorCmd(
+    uint32_t node_id, fuchsia::ui::gfx::HitTestBehavior hit_test_behavior);
+fuchsia::ui::gfx::Command NewTakeSnapshotCmdHACK(
+    uint32_t id, fuchsia::ui::gfx::SnapshotCallbackHACKPtr callback);
+
+// Camera and lighting operations.
+
+fuchsia::ui::gfx::Command NewSetCameraCmd(uint32_t renderer_id,
+                                          uint32_t camera_id);
+fuchsia::ui::gfx::Command NewSetCameraTransformCmd(uint32_t camera_id,
+                                                   const float eye_position[3],
+                                                   const float eye_look_at[3],
+                                                   const float eye_up[3]);
+fuchsia::ui::gfx::Command NewSetCameraProjectionCmd(uint32_t camera_id,
+                                                    const float fovy);
+
+fuchsia::ui::gfx::Command NewSetCameraPoseBufferCmd(uint32_t camera_id,
+                                                    uint32_t buffer_id,
+                                                    uint32_t num_entries,
+                                                    int64_t base_time,
+                                                    uint64_t time_interval);
+
+fuchsia::ui::gfx::Command NewSetStereoCameraProjectionCmd(
+    uint32_t camera_id, const float left_projection[16],
+    const float right_projection[16]);
+
+fuchsia::ui::gfx::Command NewSetLightColorCmd(uint32_t light_id,
+                                              const float rgb[3]);
+fuchsia::ui::gfx::Command NewSetLightColorCmd(uint32_t light_id,
+                                              uint32_t variable_id);
+fuchsia::ui::gfx::Command NewSetLightDirectionCmd(uint32_t light_id,
+                                                  const float direction[3]);
+fuchsia::ui::gfx::Command NewSetLightDirectionCmd(uint32_t light_id,
+                                                  uint32_t variable_id);
+fuchsia::ui::gfx::Command NewAddLightCmd(uint32_t scene_id, uint32_t light_id);
+fuchsia::ui::gfx::Command NewDetachLightCmd(uint32_t light_id);
+fuchsia::ui::gfx::Command NewDetachLightsCmd(uint32_t scene_id);
+
+// Material operations.
+fuchsia::ui::gfx::Command NewSetTextureCmd(uint32_t node_id, uint32_t image_id);
+fuchsia::ui::gfx::Command NewSetColorCmd(uint32_t node_id, uint8_t red,
+                                         uint8_t green, uint8_t blue,
+                                         uint8_t alpha);
+
+// Mesh operations.
+fuchsia::ui::gfx::MeshVertexFormat NewMeshVertexFormat(
+    fuchsia::ui::gfx::ValueType position_type,
+    fuchsia::ui::gfx::ValueType normal_type,
+    fuchsia::ui::gfx::ValueType tex_coord_type);
+// These arguments are documented in commands.fidl; see BindMeshBuffersCmd.
+fuchsia::ui::gfx::Command NewBindMeshBuffersCmd(
+    uint32_t mesh_id, uint32_t index_buffer_id,
+    fuchsia::ui::gfx::MeshIndexFormat index_format, uint64_t index_offset,
+    uint32_t index_count, uint32_t vertex_buffer_id,
+    fuchsia::ui::gfx::MeshVertexFormat vertex_format, uint64_t vertex_offset,
+    uint32_t vertex_count, const float bounding_box_min[3],
+    const float bounding_box_max[3]);
+
+// Layer / LayerStack / Compositor operations.
+fuchsia::ui::gfx::Command NewAddLayerCmd(uint32_t layer_stack_id,
+                                         uint32_t layer_id);
+fuchsia::ui::gfx::Command NewRemoveLayerCmd(uint32_t layer_stack_id,
+                                            uint32_t layer_id);
+fuchsia::ui::gfx::Command NewRemoveAllLayersCmd(uint32_t layer_stack_id);
+fuchsia::ui::gfx::Command NewSetLayerStackCmd(uint32_t compositor_id,
+                                              uint32_t layer_stack_id);
+fuchsia::ui::gfx::Command NewSetRendererCmd(uint32_t layer_id,
+                                            uint32_t renderer_id);
+fuchsia::ui::gfx::Command NewSetRendererParamCmd(
+    uint32_t renderer_id, fuchsia::ui::gfx::RendererParam param);
+fuchsia::ui::gfx::Command NewSetSizeCmd(uint32_t node_id, const float size[2]);
+
+// Event operations.
+fuchsia::ui::gfx::Command NewSetEventMaskCmd(uint32_t resource_id,
+                                             uint32_t event_mask);
+
+// Diagnostic operations.
+fuchsia::ui::gfx::Command NewSetLabelCmd(uint32_t resource_id,
+                                         const std::string& label);
+
+// Debugging operations.
+fuchsia::ui::gfx::Command NewSetDisableClippingCmd(uint32_t resource_id,
+                                                   bool disable_clipping);
+
+// Basic types.
+fuchsia::ui::gfx::FloatValue NewFloatValue(float value);
+fuchsia::ui::gfx::Vector2Value NewVector2Value(const float value[2]);
+fuchsia::ui::gfx::Vector2Value NewVector2Value(uint32_t variable_id);
+fuchsia::ui::gfx::Vector3Value NewVector3Value(const float value[3]);
+fuchsia::ui::gfx::Vector3Value NewVector3Value(uint32_t variable_id);
+fuchsia::ui::gfx::Vector4Value NewVector4Value(const float value[4]);
+fuchsia::ui::gfx::Vector4Value NewVector4Value(uint32_t variable_id);
+fuchsia::ui::gfx::QuaternionValue NewQuaternionValue(const float value[4]);
+fuchsia::ui::gfx::QuaternionValue NewQuaternionValue(uint32_t variable_id);
+fuchsia::ui::gfx::Matrix4Value NewMatrix4Value(const float value[16]);
+fuchsia::ui::gfx::Matrix4Value NewMatrix4Value(uint32_t variable_id);
+fuchsia::ui::gfx::ColorRgbValue NewColorRgbValue(float red, float green,
+                                                 float blue);
+fuchsia::ui::gfx::ColorRgbValue NewColorRgbValue(uint32_t variable_id);
+fuchsia::ui::gfx::ColorRgbaValue NewColorRgbaValue(const uint8_t value[4]);
+fuchsia::ui::gfx::ColorRgbaValue NewColorRgbaValue(uint32_t variable_id);
+fuchsia::ui::gfx::QuaternionValue NewQuaternionValue(const float value[4]);
+fuchsia::ui::gfx::vec2 NewVector2(const float value[2]);
+fuchsia::ui::gfx::vec3 NewVector3(const float value[3]);
+fuchsia::ui::gfx::vec4 NewVector4(const float value[4]);
+
+// Utilities.
+
+bool ImageInfoEquals(const fuchsia::images::ImageInfo& a,
+                     const fuchsia::images::ImageInfo& b);
+
+}  // namespace scenic
+
+#endif  // LIB_UI_SCENIC_CPP_COMMANDS_H_
diff --git a/pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_image_cycler.h b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_image_cycler.h
new file mode 100644
index 0000000..0e89ce4
--- /dev/null
+++ b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_image_cycler.h
@@ -0,0 +1,50 @@
+// 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 LIB_UI_SCENIC_CPP_HOST_IMAGE_CYCLER_H_
+#define LIB_UI_SCENIC_CPP_HOST_IMAGE_CYCLER_H_
+
+#include "lib/ui/scenic/cpp/host_memory.h"
+
+namespace scenic {
+
+// Creates a node which presents double-buffered content drawn to an image
+// in host memory.
+class HostImageCycler : public scenic::EntityNode {
+ public:
+  explicit HostImageCycler(scenic::Session* session);
+  ~HostImageCycler();
+
+  HostImageCycler(const HostImageCycler&) = delete;
+  HostImageCycler& operator=(const HostImageCycler&) = delete;
+
+  // Acquires an image for rendering.
+  // At most one image can be acquired at a time.
+  // The client is responsible for clearing the image.
+  const HostImage* AcquireImage(uint32_t width, uint32_t height,
+                                uint32_t stride,
+                                fuchsia::images::PixelFormat pixel_format =
+                                    fuchsia::images::PixelFormat::BGRA_8,
+                                fuchsia::images::ColorSpace color_space =
+                                    fuchsia::images::ColorSpace::SRGB);
+
+  // Releases the image most recently acquired using |AcquireImage()|.
+  // Sets the content node's texture to be backed by the image.
+  void ReleaseAndSwapImage();
+
+ private:
+  static constexpr uint32_t kNumBuffers = 2u;
+
+  scenic::ShapeNode content_node_;
+  scenic::Material content_material_;
+  scenic::HostImagePool image_pool_;
+
+  bool acquired_image_ = false;
+  bool reconfigured_ = false;
+  uint32_t image_index_ = 0u;
+};
+
+}  // namespace scenic
+
+#endif  // LIB_UI_SCENIC_CPP_HOST_IMAGE_CYCLER_H_
diff --git a/pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_memory.h b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_memory.h
new file mode 100644
index 0000000..6209422
--- /dev/null
+++ b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_memory.h
@@ -0,0 +1,149 @@
+// 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 LIB_UI_SCENIC_CPP_HOST_MEMORY_H_
+#define LIB_UI_SCENIC_CPP_HOST_MEMORY_H_
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <lib/zx/vmo.h>
+
+#include "lib/ui/scenic/cpp/resources.h"
+
+namespace scenic {
+
+// Provides access to data stored in a host-accessible shared memory region.
+// The memory is unmapped once all references to this object have been released.
+class HostData : public std::enable_shared_from_this<HostData> {
+ public:
+  // Maps a range of an existing VMO into memory.
+  HostData(const zx::vmo& vmo, off_t offset, size_t size);
+  ~HostData();
+
+  HostData(const HostData&) = delete;
+  HostData& operator=(const HostData&) = delete;
+
+  // Gets the size of the data in bytes.
+  size_t size() const { return size_; }
+
+  // Gets a pointer to the data.
+  void* ptr() const { return ptr_; }
+
+ private:
+  size_t const size_;
+  void* ptr_;
+};
+
+// Represents a host-accessible shared memory backed memory resource in a
+// session.  The memory is mapped read/write into this process and transferred
+// read-only to the scene manager.  The shared memory region is retained until
+// this object is destroyed.
+// TODO(MZ-268): Don't inherit from Memory, so that Memory can have a public
+// move constructor.
+// TODO(MA-492): The memory is currently not transferred read-only, as we may
+// choose to map it as device-local memory on UMA platforms, and Vulkan requires
+// a read/write vmo in order to successfully import the memory.
+class HostMemory final : public Memory {
+ public:
+  HostMemory(Session* session, size_t size);
+  HostMemory(HostMemory&& moved);
+  ~HostMemory();
+
+  HostMemory(const HostMemory&) = delete;
+  HostMemory& operator=(const HostMemory&) = delete;
+
+  // Gets a reference to the underlying shared memory region.
+  const std::shared_ptr<HostData>& data() const { return data_; }
+
+  // Gets the size of the data in bytes.
+  size_t data_size() const { return data_->size(); }
+
+  // Gets a pointer to the data.
+  void* data_ptr() const { return data_->ptr(); }
+
+ private:
+  explicit HostMemory(Session* session,
+                      std::pair<zx::vmo, std::shared_ptr<HostData>> init);
+
+  std::shared_ptr<HostData> data_;
+};
+
+// Represents an image resource backed by host-accessible shared memory bound to
+// a session.  The shared memory region is retained until this object is
+// destroyed.
+// TODO(MZ-268): Don't inherit from Image, so that Image can have a public move
+// constructor.
+class HostImage final : public Image {
+ public:
+  HostImage(const HostMemory& memory, off_t memory_offset,
+            fuchsia::images::ImageInfo info);
+  HostImage(Session* session, uint32_t memory_id, off_t memory_offset,
+            std::shared_ptr<HostData> data, fuchsia::images::ImageInfo info);
+  HostImage(HostImage&& moved);
+  ~HostImage();
+
+  HostImage(const HostImage&) = delete;
+  HostImage& operator=(const HostImage&) = delete;
+
+  // Gets a reference to the underlying shared memory region.
+  const std::shared_ptr<HostData>& data() const { return data_; }
+
+  // Gets a pointer to the image data.
+  void* image_ptr() const {
+    return static_cast<uint8_t*>(data_->ptr()) + memory_offset();
+  }
+
+ private:
+  std::shared_ptr<HostData> data_;
+};
+
+// Represents a pool of image resources backed by host-accessible shared memory
+// bound to a session.  All images in the pool must have the same layout.
+class HostImagePool {
+ public:
+  // Creates a pool which can supply up to |num_images| images on demand.
+  explicit HostImagePool(Session* session, uint32_t num_images);
+  ~HostImagePool();
+
+  HostImagePool(const HostImagePool&) = delete;
+  HostImagePool& operator=(const HostImagePool&) = delete;
+
+  // The number of images which this pool can manage.
+  uint32_t num_images() const { return image_ptrs_.size(); }
+
+  // Gets information about the images in the pool, or nullptr if the
+  // pool is not configured.
+  const fuchsia::images::ImageInfo* image_info() const { return &image_info_; }
+
+  // Sets the image information for images in the pool.
+  // Previously created images are released but their memory may be reused.
+  // If |image_info| is nullptr, the pool reverts to an non-configured state;
+  // all images are released but the memory is retained for recycling.
+  // Returns true if the configuration changed.
+  bool Configure(const fuchsia::images::ImageInfo* image_info);
+
+  // Gets the image with the specified index.
+  // The |index| must be between 0 and |num_images() - 1|.
+  // The returned pointer is valid until the image is discarded or the
+  // pool is reconfigured.  Returns nullptr if the pool is not configured.
+  const HostImage* GetImage(uint32_t index);
+
+  // Discards the image with the specified index but recycles its memory.
+  // The |index| must be between 0 and |num_images() - 1|.
+  void DiscardImage(uint32_t index);
+
+ private:
+  Session* const session_;
+
+  bool configured_ = false;
+  fuchsia::images::ImageInfo image_info_;
+  std::vector<std::unique_ptr<HostImage>> image_ptrs_;
+  std::vector<std::unique_ptr<HostMemory>> memory_ptrs_;
+};
+
+}  // namespace scenic
+
+#endif  // LIB_UI_SCENIC_CPP_HOST_MEMORY_H_
diff --git a/pkg/scenic_cpp/include/lib/ui/scenic/cpp/id.h b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/id.h
new file mode 100644
index 0000000..a500046
--- /dev/null
+++ b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/id.h
@@ -0,0 +1,17 @@
+// 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 LIB_UI_SCENIC_CPP_ID_H_
+#define LIB_UI_SCENIC_CPP_ID_H_
+
+#include <cstdint>
+
+namespace scenic {
+
+using SessionId = uint64_t;
+using ResourceId = uint32_t;
+
+}  // namespace scenic
+
+#endif  // LIB_UI_SCENIC_CPP_ID_H_
diff --git a/pkg/scenic_cpp/include/lib/ui/scenic/cpp/resources.h b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/resources.h
new file mode 100644
index 0000000..40d6b0c
--- /dev/null
+++ b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/resources.h
@@ -0,0 +1,593 @@
+// 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 LIB_UI_SCENIC_CPP_RESOURCES_H_
+#define LIB_UI_SCENIC_CPP_RESOURCES_H_
+
+#include "lib/ui/scenic/cpp/session.h"
+
+#include <zircon/assert.h>
+
+namespace scenic {
+
+// Represents a resource in a session with a dynamically allocated id.
+// The resource is released from the session when this object is destroyed
+// but it may still be in use within the session if other resources reference
+// it.
+// This type cannot be instantiated, please see subclasses.
+class Resource {
+ public:
+  // Gets the session which owns this resource.
+  Session* session() const {
+    ZX_DEBUG_ASSERT(session_);
+    return session_;
+  }
+
+  // Gets the resource's id.
+  uint32_t id() const { return id_; }
+
+  // Exports the resource and associates it with |export_token|.
+  void Export(zx::eventpair export_token);
+
+  // Exports the resource and returns an import token in |out_import_token|
+  // which allows it to be imported into other sessions.
+  void ExportAsRequest(zx::eventpair* out_import_token);
+
+  // Sets which events a resource should deliver to the session listener.
+  void SetEventMask(uint32_t event_mask);
+
+  // Sets a label to help developers identify the purpose of the resource
+  // when using diagnostic tools.
+  void SetLabel(const std::string& label);
+
+ protected:
+  explicit Resource(Session* session);
+  Resource(Resource&& moved);
+
+  Resource(const Resource&) = delete;
+  Resource& operator=(const Resource&) = delete;
+
+  virtual ~Resource();
+
+ private:
+  Session* const session_;
+  uint32_t const id_;
+};
+
+// Represents a memory resource in a session.
+// TODO(MZ-268): Make this class final, and add public move constructor.
+class Memory : public Resource {
+ public:
+  Memory(Session* session, zx::vmo vmo, uint64_t allocation_size,
+         fuchsia::images::MemoryType memory_type);
+  ~Memory();
+
+  // Gets the underlying VMO's memory type, indicating whether it represents
+  // host or GPU memory.
+  fuchsia::images::MemoryType memory_type() const { return memory_type_; }
+
+ protected:
+  Memory(Memory&& moved);
+
+ private:
+  fuchsia::images::MemoryType const memory_type_;
+};
+
+// Represents an abstract shape resource in a session.
+// This type cannot be instantiated, please see subclasses.
+class Shape : public Resource {
+ protected:
+  explicit Shape(Session* session);
+  Shape(Shape&& moved);
+  ~Shape();
+};
+
+// Represents a circle shape resource in a session.
+class Circle final : public Shape {
+ public:
+  Circle(Session* session, float radius);
+  Circle(Circle&& moved);
+  ~Circle();
+};
+
+// Represents a rectangle shape resource in a session.
+class Rectangle final : public Shape {
+ public:
+  Rectangle(Session* session, float width, float height);
+  Rectangle(Rectangle&& moved);
+  ~Rectangle();
+};
+
+// Represents a rounded rectangle shape resource in a session.
+class RoundedRectangle final : public Shape {
+ public:
+  RoundedRectangle(Session* session, float width, float height,
+                   float top_left_radius, float top_right_radius,
+                   float bottom_right_radius, float bottom_left_radius);
+  RoundedRectangle(RoundedRectangle&& moved);
+  ~RoundedRectangle();
+};
+
+// Represents an image resource in a session.
+// TODO(MZ-268): Make this class final, and add public move constructor.
+class Image : public Resource {
+ public:
+  // Creates an image resource bound to a session.
+  Image(const Memory& memory, off_t memory_offset,
+        fuchsia::images::ImageInfo info);
+  Image(Session* session, uint32_t memory_id, off_t memory_offset,
+        fuchsia::images::ImageInfo info);
+  ~Image();
+
+  // Returns the number of bytes needed to represent an image.
+  static size_t ComputeSize(const fuchsia::images::ImageInfo& image_info);
+
+  // Gets the byte offset of the image within its memory resource.
+  off_t memory_offset() const { return memory_offset_; }
+
+  // Gets information about the image's layout.
+  const fuchsia::images::ImageInfo& info() const { return info_; }
+
+ protected:
+  Image(Image&& moved);
+
+ private:
+  off_t const memory_offset_;
+  fuchsia::images::ImageInfo const info_;
+};
+
+// Represents a buffer that is immutably bound to a range of a memory resource.
+class Buffer final : public Resource {
+ public:
+  Buffer(const Memory& memory, off_t memory_offset, size_t buffer_size);
+  Buffer(Session* session, uint32_t memory_id, off_t memory_offset,
+         size_t buffer_size);
+  Buffer(Buffer&& moved);
+  ~Buffer();
+};
+
+// Represents a mesh resource in a session.  Before it can be rendered, it
+// must be bound to index and vertex arrays by calling the BindBuffers() method.
+class Mesh final : public Shape {
+ public:
+  Mesh(Session* session);
+  Mesh(Mesh&& moved);
+  ~Mesh();
+
+  // These arguments are documented in commands.fidl; see
+  // BindMeshBuffersCmd.
+  void BindBuffers(const Buffer& index_buffer,
+                   fuchsia::ui::gfx::MeshIndexFormat index_format,
+                   uint64_t index_offset, uint32_t index_count,
+                   const Buffer& vertex_buffer,
+                   fuchsia::ui::gfx::MeshVertexFormat vertex_format,
+                   uint64_t vertex_offset, uint32_t vertex_count,
+                   const float bounding_box_min[3],
+                   const float bounding_box_max[3]);
+};
+
+// Represents a material resource in a session.
+class Material final : public Resource {
+ public:
+  explicit Material(Session* session);
+  Material(Material&& moved);
+  ~Material();
+
+  // Sets the material's texture.
+  void SetTexture(const Image& image) {
+    ZX_DEBUG_ASSERT(session() == image.session());
+    SetTexture(image.id());
+  }
+  void SetTexture(uint32_t image_id);
+
+  // Sets the material's color.
+  void SetColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
+};
+
+// Represents an abstract node resource in a session.
+// This type cannot be instantiated, please see subclasses.
+class Node : public Resource {
+ public:
+  // Sets the node's transform properties.
+  void SetTranslation(float tx, float ty, float tz) {
+    SetTranslation((float[3]){tx, ty, tz});
+  }
+  void SetTranslation(const float translation[3]);
+  void SetTranslation(uint32_t variable_id);
+  void SetScale(float sx, float sy, float sz) {
+    SetScale((float[3]){sx, sy, sz});
+  }
+  void SetScale(const float scale[3]);
+  void SetScale(uint32_t variable_id);
+  void SetRotation(float qi, float qj, float qk, float qw) {
+    SetRotation((float[4]){qi, qj, qk, qw});
+  }
+  void SetRotation(const float quaternion[4]);
+  void SetRotation(uint32_t variable_id);
+  void SetAnchor(float ax, float ay, float az) {
+    SetAnchor((float[3]){ax, ay, az});
+  }
+  void SetAnchor(const float anchor[3]);
+  void SetAnchor(uint32_t variable_id);
+
+  void SendSizeChangeHint(float width_change_factor,
+                          float height_change_factor);
+
+  // Sets the node's tag value.
+  void SetTag(uint32_t tag_value);
+
+  // Sets the node's hit test behavior.
+  void SetHitTestBehavior(fuchsia::ui::gfx::HitTestBehavior hit_test_behavior);
+
+  // Detaches the node from its parent.
+  void Detach();
+
+ protected:
+  explicit Node(Session* session);
+  Node(Node&& moved);
+  ~Node();
+};
+
+// Represents an shape node resource in a session.
+class ShapeNode final : public Node {
+ public:
+  explicit ShapeNode(Session* session);
+  ShapeNode(ShapeNode&& moved);
+  ~ShapeNode();
+
+  // Sets the shape that the shape node should draw.
+  void SetShape(const Shape& shape) {
+    ZX_DEBUG_ASSERT(session() == shape.session());
+    SetShape(shape.id());
+  }
+  void SetShape(uint32_t shape_id);
+
+  // Sets the material with which to draw the shape.
+  void SetMaterial(const Material& material) {
+    ZX_DEBUG_ASSERT(session() == material.session());
+    SetMaterial(material.id());
+  }
+  void SetMaterial(uint32_t material_id);
+};
+
+// Abstract base class for nodes which can have child nodes.
+// This type cannot be instantiated, please see subclasses.
+class ContainerNode : public Node {
+ public:
+  // Adds a child to the node.
+  void AddChild(const Node& child) {
+    ZX_DEBUG_ASSERT(session() == child.session());
+    AddChild(child.id());
+  }
+  void AddChild(uint32_t child_node_id);
+
+  void AddPart(const Node& part) {
+    ZX_DEBUG_ASSERT(session() == part.session());
+    AddPart(part.id());
+  }
+  void AddPart(uint32_t part_node_id);
+
+  // Detaches all children from the node.
+  void DetachChildren();
+
+ protected:
+  explicit ContainerNode(Session* session);
+  ContainerNode(ContainerNode&& moved);
+  ~ContainerNode();
+};
+
+// Required by EntityNode::Attach().
+class ViewHolder;
+
+// Represents an entity node resource in a session.
+// TODO(MZ-268): Make this class final, and add public move constructor.
+class EntityNode : public ContainerNode {
+ public:
+  explicit EntityNode(Session* session);
+  ~EntityNode();
+
+  void SetClip(uint32_t clip_id, bool clip_to_self);
+
+  void Attach(const ViewHolder& view_holder);
+
+  void Snapshot(fuchsia::ui::gfx::SnapshotCallbackHACKPtr callback);
+};
+
+// Represents an imported node resource in a session.
+// The imported node is initially created in an unbound state and must
+// be bound immediately after creation, prior to use.
+class ImportNode final : public ContainerNode {
+ public:
+  explicit ImportNode(Session* session);
+  ImportNode(ImportNode&& moved);
+  ~ImportNode();
+
+  // Imports the node associated with |import_token|.
+  void Bind(zx::eventpair import_token);
+
+  // Imports the node and returns an export token in |out_export_token|
+  // by which another session can export a node to associate with this import.
+  void BindAsRequest(zx::eventpair* out_export_token);
+
+  // Returns true if the import has been bound.
+  bool is_bound() const { return is_bound_; }
+
+ private:
+  bool is_bound_ = false;
+};
+
+// Represents a proxy for a View which can be added to a scene graph in order
+// to embed the View within it.
+//
+// Each ViewHolder is linked to a paired View via a shared token.
+//
+// Usually the ViewHolder and its associated View exist in separate processes,
+// allowing a distributed scene graph to be constructed.
+class ViewHolder final : public Resource {
+ public:
+  ViewHolder(Session* session, zx::eventpair token,
+             const std::string& debug_name);
+  ~ViewHolder();
+
+  // Set properties of the attached view.
+
+  void SetViewProperties(float min_x, float min_y, float min_z, float max_x,
+                         float max_y, float max_z, float in_min_x,
+                         float in_min_y, float in_min_z, float in_max_x,
+                         float in_max_y, float in_max_z) {
+    SetViewProperties((float[3]){min_x, min_y, min_z},
+                      (float[3]){max_x, max_y, max_z},
+                      (float[3]){in_min_x, in_min_y, in_min_z},
+                      (float[3]){in_max_x, in_max_y, in_max_z});
+  }
+  void SetViewProperties(const float bounding_box_min[3],
+                         const float bounding_box_max[3],
+                         const float inset_from_min[3],
+                         const float inset_from_max[3]);
+  void SetViewProperties(const fuchsia::ui::gfx::ViewProperties& props);
+};
+
+// Represents a transform space which serves as a container for Nodes.  The
+// Nodes will have the Views' coordinate transform applied to their own, in
+// addition to being clipped to the Views' bounding box.
+class View final : public Resource {
+ public:
+  View(Session* session, zx::eventpair token, const std::string& debug_name);
+  ~View();
+
+  void AddChild(const Node& child) const;
+  void DetachChild(const Node& child) const;
+};
+
+// Creates a node that clips the contents of its hierarchy to the specified clip
+// shape.
+class ClipNode final : public ContainerNode {
+ public:
+  explicit ClipNode(Session* session);
+  ClipNode(ClipNode&& moved);
+  ~ClipNode();
+};
+
+// Creates a node that renders its hierarchy with the specified opacity.
+class OpacityNode final : public ContainerNode {
+ public:
+  explicit OpacityNode(Session* session);
+  OpacityNode(OpacityNode&& moved);
+  ~OpacityNode();
+
+  // The opacity with which to render the contents of the hierarchy rooted at
+  // this node. The opacity values are clamped 0.0 to 1.0.
+  void SetOpacity(float opacity);
+};
+
+// A value that can be used in place of a constant value.
+class Variable final : public Resource {
+ public:
+  explicit Variable(Session* session, fuchsia::ui::gfx::Value initial_value);
+  Variable(Variable&& moved);
+  ~Variable();
+};
+
+// Represents an abstract light resource in a session.
+// This type cannot be instantiated, please see subclasses.
+class Light : public Resource {
+ public:
+  // Sets the light's color.
+  void SetColor(float red, float green, float blue) {
+    SetColor((float[3]){red, green, blue});
+  }
+  void SetColor(const float rgb[3]);
+  void SetColor(uint32_t variable_id);
+
+  // Detach light from the scene it is attached to, if any.
+  void Detach();
+
+ protected:
+  explicit Light(Session* session);
+  Light(Light&& moved);
+  ~Light();
+};
+
+// Represents a directional light resource in a session.
+class AmbientLight final : public Light {
+ public:
+  explicit AmbientLight(Session* session);
+  AmbientLight(AmbientLight&& moved);
+  ~AmbientLight();
+};
+
+// Represents a directional light resource in a session.
+class DirectionalLight final : public Light {
+ public:
+  explicit DirectionalLight(Session* session);
+  DirectionalLight(DirectionalLight&& moved);
+  ~DirectionalLight();
+
+  // Sets the light's direction.
+  void SetDirection(float dx, float dy, float dz) {
+    SetDirection((float[3]){dx, dy, dz});
+  }
+  void SetDirection(const float direction[3]);
+  void SetDirection(uint32_t variable_id);
+};
+
+// Represents a scene resource in a session.
+class Scene final : public ContainerNode {
+ public:
+  explicit Scene(Session* session);
+  Scene(Scene&& moved);
+  ~Scene();
+
+  void AddLight(const Light& light) {
+    ZX_DEBUG_ASSERT(session() == light.session());
+    AddLight(light.id());
+  }
+  void AddLight(uint32_t light_id);
+  void DetachLights();
+
+ private:
+  void Detach() = delete;
+};
+
+class CameraBase : public Resource {
+ public:
+  CameraBase(Session* session) : Resource(session) {}
+  CameraBase(CameraBase&& moved) : Resource(std::move(moved)) {}
+  ~CameraBase() {}
+  // Sets the camera's view parameters.
+  void SetTransform(const float eye_position[3], const float eye_look_at[3],
+                    const float eye_up[3]);
+  // Sets the camera pose buffer
+  void SetPoseBuffer(const Buffer& buffer, uint32_t num_entries,
+                     int64_t base_time, uint64_t time_interval);
+};
+
+// Represents a camera resource in a session.
+class Camera : public CameraBase {
+ public:
+  explicit Camera(const Scene& scene);
+  Camera(Session* session, uint32_t scene_id);
+  Camera(Camera&& moved);
+  ~Camera();
+
+  // Sets the camera's projection parameters.
+  void SetProjection(const float fovy);
+};
+
+// Represents a StereoCamera resource in a session.
+class StereoCamera final : public CameraBase {
+ public:
+  explicit StereoCamera(const Scene& scene);
+  StereoCamera(Session* session, uint32_t scene_id);
+  StereoCamera(StereoCamera&& moved);
+  ~StereoCamera();
+
+  // Sets the camera's projection parameters.
+  void SetStereoProjection(const float left_projection[16],
+                           const float right_projection[16]);
+};
+
+// Represents a renderer resource in a session.
+class Renderer final : public Resource {
+ public:
+  explicit Renderer(Session* session);
+  Renderer(Renderer&& moved);
+  ~Renderer();
+
+  // Sets the camera whose view will be rendered.
+  void SetCamera(const Camera& camera) {
+    ZX_DEBUG_ASSERT(session() == camera.session());
+    SetCamera(camera.id());
+  }
+  void SetCamera(uint32_t camera_id);
+
+  void SetParam(fuchsia::ui::gfx::RendererParam param);
+
+  // Convenient wrapper for SetParam().
+  void SetShadowTechnique(fuchsia::ui::gfx::ShadowTechnique technique);
+
+  // Set whether clipping is disabled for this renderer.
+  // NOTE: disabling clipping only has a visual effect; hit-testing is not
+  // affected.
+  void SetDisableClipping(bool disable_clipping);
+};
+
+// Represents a layer resource in a session.
+class Layer final : public Resource {
+ public:
+  explicit Layer(Session* session);
+  Layer(Layer&& moved);
+  ~Layer();
+
+  // Sets the layer's XY translation and Z-order.
+  void SetTranslation(float tx, float ty, float tz) {
+    SetTranslation((float[3]){tx, ty, tz});
+  }
+  void SetTranslation(const float translation[3]);
+
+  void SetSize(float width, float height) {
+    SetSize((float[2]){width, height});
+  }
+  void SetSize(const float size[2]);
+
+  void SetRenderer(const Renderer& renderer) {
+    ZX_DEBUG_ASSERT(session() == renderer.session());
+    SetRenderer(renderer.id());
+  }
+  void SetRenderer(uint32_t renderer_id);
+};
+
+// Represents a layer-stack resource in a session.
+class LayerStack final : public Resource {
+ public:
+  explicit LayerStack(Session* session);
+  LayerStack(LayerStack&& moved);
+  ~LayerStack();
+
+  void AddLayer(const Layer& layer) {
+    ZX_DEBUG_ASSERT(session() == layer.session());
+    AddLayer(layer.id());
+  }
+  void AddLayer(uint32_t layer_id);
+  void RemoveLayer(const Layer& layer) {
+    ZX_DEBUG_ASSERT(session() == layer.session());
+    RemoveLayer(layer.id());
+  }
+  void RemoveLayer(uint32_t layer_id);
+  void RemoveAllLayers();
+};
+
+// Represents a display-compositor resource in a session.
+class DisplayCompositor final : public Resource {
+ public:
+  explicit DisplayCompositor(Session* session);
+  DisplayCompositor(DisplayCompositor&& moved);
+  ~DisplayCompositor();
+
+  // Sets the layer-stack that is to be composited.
+  void SetLayerStack(const LayerStack& layer_stack) {
+    ZX_DEBUG_ASSERT(session() == layer_stack.session());
+    SetLayerStack(layer_stack.id());
+  }
+  void SetLayerStack(uint32_t layer_stack_id);
+};
+
+// Represents a display-less compositor resource in a session.
+class Compositor final : public Resource {
+ public:
+  explicit Compositor(Session* session);
+  Compositor(Compositor&& moved);
+  ~Compositor();
+
+  // Sets the layer-stack that is to be composited.
+  void SetLayerStack(const LayerStack& layer_stack) {
+    ZX_DEBUG_ASSERT(session() == layer_stack.session());
+    SetLayerStack(layer_stack.id());
+  }
+  void SetLayerStack(uint32_t layer_stack_id);
+};
+
+}  // namespace scenic
+
+#endif  // LIB_UI_SCENIC_CPP_RESOURCES_H_
diff --git a/pkg/scenic_cpp/include/lib/ui/scenic/cpp/session.h b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/session.h
new file mode 100644
index 0000000..3455d15
--- /dev/null
+++ b/pkg/scenic_cpp/include/lib/ui/scenic/cpp/session.h
@@ -0,0 +1,148 @@
+// 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 LIB_UI_SCENIC_CPP_SESSION_H_
+#define LIB_UI_SCENIC_CPP_SESSION_H_
+
+#include <fuchsia/images/cpp/fidl.h>
+#include <fuchsia/ui/gfx/cpp/fidl.h>
+#include <fuchsia/ui/input/cpp/fidl.h>
+#include <fuchsia/ui/scenic/cpp/fidl.h>
+#include <lib/fit/function.h>
+#include <lib/zx/event.h>
+
+#include <utility>
+
+#include "lib/fidl/cpp/binding.h"
+
+namespace scenic {
+
+// Connect to Scenic and establish a new Session, as well as an InterfaceRequest
+// for a SessionListener that can be hooked up as desired.
+using SessionPtrAndListenerRequest =
+    std::pair<fuchsia::ui::scenic::SessionPtr,
+              fidl::InterfaceRequest<fuchsia::ui::scenic::SessionListener>>;
+SessionPtrAndListenerRequest CreateScenicSessionPtrAndListenerRequest(
+    fuchsia::ui::scenic::Scenic* scenic);
+
+// Wraps a Scenic session.
+// Maintains a queue of pending operations and assists with allocation of
+// resource ids.
+class Session : private fuchsia::ui::scenic::SessionListener {
+ public:
+  // Provides timing information about a presentation request which has
+  // been applied by the scene manager.
+  using PresentCallback =
+      fit::function<void(fuchsia::images::PresentationInfo info)>;
+
+  // Provide information about hits.
+  using HitTestCallback =
+      fit::function<void(fidl::VectorPtr<fuchsia::ui::gfx::Hit> hits)>;
+
+  // Called when session events are received.
+  using EventHandler =
+      fit::function<void(fidl::VectorPtr<fuchsia::ui::scenic::Event>)>;
+
+  // Wraps the provided session and session listener.
+  // The listener is optional.
+  explicit Session(fuchsia::ui::scenic::SessionPtr session,
+                   fidl::InterfaceRequest<fuchsia::ui::scenic::SessionListener>
+                       session_listener = nullptr);
+
+  // Creates a new session using the provided Scenic and binds the listener to
+  // this object. The Scenic itself is not retained after construction.
+  explicit Session(fuchsia::ui::scenic::Scenic* scenic);
+
+  explicit Session(SessionPtrAndListenerRequest session_and_listener);
+
+  Session(const Session&) = delete;
+  Session& operator=(const Session&) = delete;
+
+  // Destroys the session.
+  // All resources must be released prior to destruction.
+  ~Session();
+
+  void set_error_handler(fit::function<void(zx_status_t)> closure) {
+    session_.set_error_handler(std::move(closure));
+  }
+
+  // Sets a callback which is invoked when events are received.
+  void set_event_handler(EventHandler event_handler) {
+    event_handler_ = std::move(event_handler);
+  }
+
+  // Gets a pointer to the underlying session interface.
+  fuchsia::ui::scenic::Session* session() { return session_.get(); }
+
+  // Allocates a new unique resource id.
+  uint32_t AllocResourceId();
+
+  // Enqueues an operation to release a resource.
+  void ReleaseResource(uint32_t resource_id);
+
+  // Enqueues an operation.
+  // The session will queue operations locally to batch submission of operations
+  // until |Flush()| or |Present()| is called.
+  void Enqueue(fuchsia::ui::scenic::Command command);
+  void Enqueue(fuchsia::ui::gfx::Command command);
+  void Enqueue(fuchsia::ui::input::Command command);
+
+  // Registers an acquire fence to be submitted during the subsequent call to
+  // |Present()|.
+  void EnqueueAcquireFence(zx::event fence);
+
+  // Registers a release fence to be submitted during the subsequent call to
+  // |Present()|.
+  void EnqueueReleaseFence(zx::event fence);
+
+  // Flushes queued operations to the session.
+  void Flush();
+
+  // Presents all previously enqueued operations.
+  // Implicitly flushes all queued operations to the session.
+  // Invokes the callback when the scene manager applies the presentation.
+  void Present(uint64_t presentation_time, PresentCallback callback);
+
+  // Performs a hit test along the specified ray.
+  void HitTest(uint32_t node_id, const float ray_origin[3],
+               const float ray_direction[3], HitTestCallback callback);
+
+  // Performs a hit test along the specified ray into the engine's first
+  // compositor.
+  void HitTestDeviceRay(
+      const float ray_origin[3], const float ray_direction[3],
+      fuchsia::ui::scenic::Session::HitTestDeviceRayCallback callback);
+
+  // Unbinds the internal SessionPtr; this allows moving this across threads.
+  void Unbind();
+
+  // Rebinds the Session interface internally; this must be called after a call
+  // to Unbind().
+  void Rebind();
+
+  void SetDebugName(const std::string& debug_name);
+
+ private:
+  // |fuchsia::ui::scenic::SessionListener|
+  void OnScenicError(fidl::StringPtr error) override;
+  void OnScenicEvent(
+      fidl::VectorPtr<fuchsia::ui::scenic::Event> events) override;
+
+  fuchsia::ui::scenic::SessionPtr session_;
+  // |session_handle_| is stored only when |session_| is unbound/invalid.
+  fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session_handle_;
+  uint32_t next_resource_id_ = 1u;
+  uint32_t resource_count_ = 0u;
+
+  fidl::VectorPtr<fuchsia::ui::scenic::Command> commands_;
+  fidl::VectorPtr<zx::event> acquire_fences_;
+  fidl::VectorPtr<zx::event> release_fences_;
+
+  EventHandler event_handler_;
+  fidl::Binding<fuchsia::ui::scenic::SessionListener> session_listener_binding_;
+};
+
+}  // namespace scenic
+
+#endif  // LIB_UI_SCENIC_CPP_SESSION_H_
diff --git a/pkg/scenic_cpp/meta.json b/pkg/scenic_cpp/meta.json
new file mode 100644
index 0000000..3c966c8
--- /dev/null
+++ b/pkg/scenic_cpp/meta.json
@@ -0,0 +1,31 @@
+{
+  "deps": [
+    "fidl_cpp", 
+    "images_cpp", 
+    "fit", 
+    "zx"
+  ], 
+  "fidl_deps": [
+    "fuchsia.ui.gfx", 
+    "fuchsia.ui.scenic"
+  ], 
+  "headers": [
+    "pkg/scenic_cpp/include/lib/ui/scenic/cpp/commands.h", 
+    "pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_image_cycler.h", 
+    "pkg/scenic_cpp/include/lib/ui/scenic/cpp/host_memory.h", 
+    "pkg/scenic_cpp/include/lib/ui/scenic/cpp/id.h", 
+    "pkg/scenic_cpp/include/lib/ui/scenic/cpp/resources.h", 
+    "pkg/scenic_cpp/include/lib/ui/scenic/cpp/session.h"
+  ], 
+  "include_dir": "pkg/scenic_cpp/include", 
+  "name": "scenic_cpp", 
+  "root": "pkg/scenic_cpp", 
+  "sources": [
+    "pkg/scenic_cpp/commands.cc", 
+    "pkg/scenic_cpp/host_image_cycler.cc", 
+    "pkg/scenic_cpp/host_memory.cc", 
+    "pkg/scenic_cpp/resources.cc", 
+    "pkg/scenic_cpp/session.cc"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/scenic_cpp/resources.cc b/pkg/scenic_cpp/resources.cc
new file mode 100644
index 0000000..58ab0d5
--- /dev/null
+++ b/pkg/scenic_cpp/resources.cc
@@ -0,0 +1,570 @@
+// 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.
+
+#include "lib/ui/scenic/cpp/resources.h"
+
+#include <algorithm>
+
+#include "lib/images/cpp/images.h"
+#include "lib/ui/scenic/cpp/commands.h"
+
+namespace scenic {
+namespace {
+
+template <class T>
+constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
+  return (v < lo) ? lo : (hi < v) ? hi : v;
+}
+
+}  // namespace
+
+Resource::Resource(Session* session)
+    : session_(session), id_(session->AllocResourceId()) {}
+
+Resource::Resource(Resource&& moved)
+    : session_(moved.session_), id_(moved.id_) {
+  auto& moved_session = *const_cast<Session**>(&moved.session_);
+  auto& moved_id = *const_cast<uint32_t*>(&moved.id_);
+  moved_session = nullptr;
+  moved_id = 0;
+}
+
+Resource::~Resource() {
+  // If this resource was moved, it is not responsible for releasing the ID.
+  if (session_)
+    session_->ReleaseResource(id_);
+}
+
+void Resource::Export(zx::eventpair export_token) {
+  session_->Enqueue(NewExportResourceCmd(id(), std::move(export_token)));
+}
+
+void Resource::ExportAsRequest(zx::eventpair* out_import_token) {
+  session_->Enqueue(NewExportResourceCmdAsRequest(id(), out_import_token));
+}
+
+void Resource::SetEventMask(uint32_t event_mask) {
+  session_->Enqueue(NewSetEventMaskCmd(id(), event_mask));
+}
+
+void Resource::SetLabel(const std::string& label) {
+  session_->Enqueue(NewSetLabelCmd(id(), label));
+}
+
+Shape::Shape(Session* session) : Resource(session) {}
+
+Shape::Shape(Shape&& moved) : Resource(std::move(moved)) {}
+
+Shape::~Shape() = default;
+
+Circle::Circle(Session* session, float radius) : Shape(session) {
+  session->Enqueue(NewCreateCircleCmd(id(), radius));
+}
+
+Circle::Circle(Circle&& moved) : Shape(std::move(moved)) {}
+
+Circle::~Circle() = default;
+
+Rectangle::Rectangle(Session* session, float width, float height)
+    : Shape(session) {
+  session->Enqueue(NewCreateRectangleCmd(id(), width, height));
+}
+
+Rectangle::Rectangle(Rectangle&& moved) : Shape(std::move(moved)) {}
+
+Rectangle::~Rectangle() = default;
+
+RoundedRectangle::RoundedRectangle(Session* session, float width, float height,
+                                   float top_left_radius,
+                                   float top_right_radius,
+                                   float bottom_right_radius,
+                                   float bottom_left_radius)
+    : Shape(session) {
+  session->Enqueue(NewCreateRoundedRectangleCmd(
+      id(), width, height, top_left_radius, top_right_radius,
+      bottom_right_radius, bottom_left_radius));
+}
+
+RoundedRectangle::RoundedRectangle(RoundedRectangle&& moved)
+    : Shape(std::move(moved)) {}
+
+RoundedRectangle::~RoundedRectangle() = default;
+
+Image::Image(const Memory& memory, off_t memory_offset,
+             fuchsia::images::ImageInfo info)
+    : Image(memory.session(), memory.id(), memory_offset, std::move(info)) {}
+
+Image::Image(Session* session, uint32_t memory_id, off_t memory_offset,
+             fuchsia::images::ImageInfo info)
+    : Resource(session), memory_offset_(memory_offset), info_(info) {
+  session->Enqueue(
+      NewCreateImageCmd(id(), memory_id, memory_offset_, std::move(info)));
+}
+
+Image::Image(Image&& moved)
+    : Resource(std::move(moved)),
+      memory_offset_(moved.memory_offset_),
+      info_(moved.info_) {}
+
+Image::~Image() = default;
+
+size_t Image::ComputeSize(const fuchsia::images::ImageInfo& image_info) {
+  return images::ImageSize(image_info);
+}
+
+Buffer::Buffer(const Memory& memory, off_t memory_offset, size_t num_bytes)
+    : Buffer(memory.session(), memory.id(), memory_offset, num_bytes) {}
+
+Buffer::Buffer(Session* session, uint32_t memory_id, off_t memory_offset,
+               size_t num_bytes)
+    : Resource(session) {
+  session->Enqueue(
+      NewCreateBufferCmd(id(), memory_id, memory_offset, num_bytes));
+}
+
+Buffer::Buffer(Buffer&& moved) : Resource(std::move(moved)) {}
+
+Buffer::~Buffer() = default;
+
+Memory::Memory(Session* session, zx::vmo vmo, uint64_t allocation_size,
+               fuchsia::images::MemoryType memory_type)
+    : Resource(session), memory_type_(memory_type) {
+  session->Enqueue(
+      NewCreateMemoryCmd(id(), std::move(vmo), allocation_size, memory_type));
+}
+
+Memory::Memory(Memory&& moved)
+    : Resource(std::move(moved)), memory_type_(moved.memory_type_) {}
+
+Memory::~Memory() = default;
+
+Mesh::Mesh(Session* session) : Shape(session) {
+  session->Enqueue(NewCreateMeshCmd(id()));
+}
+
+Mesh::Mesh(Mesh&& moved) : Shape(std::move(moved)) {}
+
+Mesh::~Mesh() = default;
+
+void Mesh::BindBuffers(const Buffer& index_buffer,
+                       fuchsia::ui::gfx::MeshIndexFormat index_format,
+                       uint64_t index_offset, uint32_t index_count,
+                       const Buffer& vertex_buffer,
+                       fuchsia::ui::gfx::MeshVertexFormat vertex_format,
+                       uint64_t vertex_offset, uint32_t vertex_count,
+                       const float bounding_box_min[3],
+                       const float bounding_box_max[3]) {
+  ZX_DEBUG_ASSERT(session() == index_buffer.session() &&
+                  session() == vertex_buffer.session());
+  session()->Enqueue(NewBindMeshBuffersCmd(
+      id(), index_buffer.id(), index_format, index_offset, index_count,
+      vertex_buffer.id(), std::move(vertex_format), vertex_offset, vertex_count,
+      bounding_box_min, bounding_box_max));
+}
+
+Material::Material(Session* session) : Resource(session) {
+  session->Enqueue(NewCreateMaterialCmd(id()));
+}
+
+Material::Material(Material&& moved) : Resource(std::move(moved)) {}
+
+Material::~Material() = default;
+
+void Material::SetTexture(uint32_t image_id) {
+  session()->Enqueue(NewSetTextureCmd(id(), image_id));
+}
+
+void Material::SetColor(uint8_t red, uint8_t green, uint8_t blue,
+                        uint8_t alpha) {
+  session()->Enqueue(NewSetColorCmd(id(), red, green, blue, alpha));
+}
+
+Node::Node(Session* session) : Resource(session) {}
+
+Node::Node(Node&& moved) : Resource(std::move(moved)) {}
+
+Node::~Node() = default;
+
+void Node::SetTranslation(const float translation[3]) {
+  session()->Enqueue(NewSetTranslationCmd(id(), translation));
+}
+
+void Node::SetTranslation(uint32_t variable_id) {
+  session()->Enqueue(NewSetTranslationCmd(id(), variable_id));
+}
+
+void Node::SetScale(const float scale[3]) {
+  session()->Enqueue(NewSetScaleCmd(id(), scale));
+}
+
+void Node::SetScale(uint32_t variable_id) {
+  session()->Enqueue(NewSetScaleCmd(id(), variable_id));
+}
+
+void Node::SetRotation(const float quaternion[4]) {
+  session()->Enqueue(NewSetRotationCmd(id(), quaternion));
+}
+
+void Node::SetRotation(uint32_t variable_id) {
+  session()->Enqueue(NewSetRotationCmd(id(), variable_id));
+}
+
+void Node::SetAnchor(const float anchor[3]) {
+  session()->Enqueue(NewSetAnchorCmd(id(), anchor));
+}
+
+void Node::SetAnchor(uint32_t variable_id) {
+  session()->Enqueue(NewSetAnchorCmd(id(), variable_id));
+}
+
+void Node::SendSizeChangeHint(float width_change_factor,
+                              float height_change_factor) {
+  session()->Enqueue(NewSendSizeChangeHintCmdHACK(id(), width_change_factor,
+                                                  height_change_factor));
+}
+
+void Node::SetTag(uint32_t tag_value) {
+  session()->Enqueue(NewSetTagCmd(id(), tag_value));
+}
+
+void Node::SetHitTestBehavior(
+    fuchsia::ui::gfx::HitTestBehavior hit_test_behavior) {
+  session()->Enqueue(NewSetHitTestBehaviorCmd(id(), hit_test_behavior));
+}
+
+void Node::Detach() { session()->Enqueue(NewDetachCmd(id())); }
+
+ShapeNode::ShapeNode(Session* session) : Node(session) {
+  session->Enqueue(NewCreateShapeNodeCmd(id()));
+}
+
+ShapeNode::ShapeNode(ShapeNode&& moved) : Node(std::move(moved)) {}
+
+ShapeNode::~ShapeNode() = default;
+
+void ShapeNode::SetShape(uint32_t shape_id) {
+  session()->Enqueue(NewSetShapeCmd(id(), shape_id));
+}
+
+void ShapeNode::SetMaterial(uint32_t material_id) {
+  session()->Enqueue(NewSetMaterialCmd(id(), material_id));
+}
+
+ContainerNode::ContainerNode(Session* session) : Node(session) {}
+
+ContainerNode::ContainerNode(ContainerNode&& moved) : Node(std::move(moved)) {}
+
+ContainerNode::~ContainerNode() = default;
+
+void ContainerNode::AddChild(uint32_t child_node_id) {
+  session()->Enqueue(NewAddChildCmd(id(), child_node_id));
+}
+
+void ContainerNode::AddPart(uint32_t part_node_id) {
+  session()->Enqueue(NewAddPartCmd(id(), part_node_id));
+}
+
+void ContainerNode::DetachChildren() {
+  session()->Enqueue(NewDetachChildrenCmd(id()));
+}
+
+EntityNode::EntityNode(Session* session) : ContainerNode(session) {
+  session->Enqueue(NewCreateEntityNodeCmd(id()));
+}
+
+void EntityNode::Attach(const ViewHolder& view_holder) {
+  session()->Enqueue(NewAddChildCmd(id(), view_holder.id()));
+}
+
+void EntityNode::Snapshot(fuchsia::ui::gfx::SnapshotCallbackHACKPtr callback) {
+  session()->Enqueue(NewTakeSnapshotCmdHACK(id(), std::move(callback)));
+}
+
+EntityNode::~EntityNode() = default;
+
+void EntityNode::SetClip(uint32_t clip_id, bool clip_to_self) {
+  session()->Enqueue(NewSetClipCmd(id(), clip_id, clip_to_self));
+}
+
+ImportNode::ImportNode(Session* session) : ContainerNode(session) {}
+
+ImportNode::ImportNode(ImportNode&& moved) : ContainerNode(std::move(moved)) {}
+
+ImportNode::~ImportNode() {
+  ZX_DEBUG_ASSERT_MSG(is_bound_, "Import was never bound.");
+}
+
+void ImportNode::Bind(zx::eventpair import_token) {
+  ZX_DEBUG_ASSERT(!is_bound_);
+  session()->Enqueue(NewImportResourceCmd(
+      id(), fuchsia::ui::gfx::ImportSpec::NODE, std::move(import_token)));
+  is_bound_ = true;
+}
+
+void ImportNode::BindAsRequest(zx::eventpair* out_export_token) {
+  ZX_DEBUG_ASSERT(!is_bound_);
+  session()->Enqueue(NewImportResourceCmdAsRequest(
+      id(), fuchsia::ui::gfx::ImportSpec::NODE, out_export_token));
+  is_bound_ = true;
+}
+
+ViewHolder::ViewHolder(Session* session, zx::eventpair token,
+                       const std::string& debug_name)
+    : Resource(session) {
+  session->Enqueue(NewCreateViewHolderCmd(id(), std::move(token), debug_name));
+}
+
+ViewHolder::~ViewHolder() = default;
+
+void ViewHolder::SetViewProperties(const float bounding_box_min[3],
+                                   const float bounding_box_max[3],
+                                   const float inset_from_min[3],
+                                   const float inset_from_max[3]) {
+  session()->Enqueue(NewSetViewPropertiesCmd(id(), bounding_box_min,
+                                             bounding_box_max, inset_from_min,
+                                             inset_from_max));
+}
+
+void ViewHolder::SetViewProperties(
+    const fuchsia::ui::gfx::ViewProperties& props) {
+  session()->Enqueue(NewSetViewPropertiesCmd(id(), props));
+}
+
+View::View(Session* session, zx::eventpair token, const std::string& debug_name)
+    : Resource(session) {
+  session->Enqueue(NewCreateViewCmd(id(), std::move(token), debug_name));
+}
+
+View::~View() = default;
+
+void View::AddChild(const Node& child) const {
+  ZX_DEBUG_ASSERT(session() == child.session());
+  session()->Enqueue(NewAddChildCmd(id(), child.id()));
+}
+
+void View::DetachChild(const Node& child) const {
+  ZX_DEBUG_ASSERT(session() == child.session());
+  session()->Enqueue(NewDetachCmd(child.id()));
+}
+
+ClipNode::ClipNode(Session* session) : ContainerNode(session) {
+  session->Enqueue(NewCreateClipNodeCmd(id()));
+}
+
+ClipNode::ClipNode(ClipNode&& moved) : ContainerNode(std::move(moved)) {}
+
+ClipNode::~ClipNode() = default;
+
+OpacityNode::OpacityNode(Session* session) : ContainerNode(session) {
+  session->Enqueue(NewCreateOpacityNodeCmd(id()));
+}
+
+OpacityNode::OpacityNode(OpacityNode&& moved)
+    : ContainerNode(std::move(moved)) {}
+
+OpacityNode::~OpacityNode() = default;
+
+void OpacityNode::SetOpacity(float opacity) {
+  opacity = clamp(opacity, 0.f, 1.f);
+  session()->Enqueue(NewSetOpacityCmd(id(), opacity));
+}
+
+Variable::Variable(Session* session, fuchsia::ui::gfx::Value initial_value)
+    : Resource(session) {
+  session->Enqueue(NewCreateVariableCmd(id(), std::move(initial_value)));
+}
+
+Variable::Variable(Variable&& moved) : Resource(std::move(moved)) {}
+
+Variable::~Variable() = default;
+
+Scene::Scene(Session* session) : ContainerNode(session) {
+  session->Enqueue(NewCreateSceneCmd(id()));
+}
+
+Scene::Scene(Scene&& moved) : ContainerNode(std::move(moved)) {}
+
+Scene::~Scene() = default;
+
+void Scene::AddLight(uint32_t light_id) {
+  session()->Enqueue(NewAddLightCmd(id(), light_id));
+}
+
+void Scene::DetachLights() { session()->Enqueue(NewDetachLightsCmd(id())); }
+
+void CameraBase::SetTransform(const float eye_position[3],
+                              const float eye_look_at[3],
+                              const float eye_up[3]) {
+  session()->Enqueue(
+      NewSetCameraTransformCmd(id(), eye_position, eye_look_at, eye_up));
+}
+
+void CameraBase::SetPoseBuffer(const Buffer& buffer, uint32_t num_entries,
+                               int64_t base_time, uint64_t time_interval) {
+  session()->Enqueue(NewSetCameraPoseBufferCmd(id(), buffer.id(), num_entries,
+                                               base_time, time_interval));
+}
+
+Camera::Camera(const Scene& scene) : Camera(scene.session(), scene.id()) {}
+
+Camera::Camera(Session* session, uint32_t scene_id) : CameraBase(session) {
+  session->Enqueue(NewCreateCameraCmd(id(), scene_id));
+}
+
+Camera::Camera(Camera&& moved) : CameraBase(std::move(moved)) {}
+
+Camera::~Camera() = default;
+
+void Camera::SetProjection(const float fovy) {
+  session()->Enqueue(NewSetCameraProjectionCmd(id(), fovy));
+}
+
+StereoCamera::StereoCamera(const Scene& scene)
+    : StereoCamera(scene.session(), scene.id()) {}
+
+StereoCamera::StereoCamera(Session* session, uint32_t scene_id)
+    : CameraBase(session) {
+  session->Enqueue(NewCreateStereoCameraCmd(id(), scene_id));
+}
+
+StereoCamera::StereoCamera(StereoCamera&& moved)
+    : CameraBase(std::move(moved)) {}
+
+StereoCamera::~StereoCamera() = default;
+
+void StereoCamera::SetStereoProjection(const float left_projection[16],
+                                       const float right_projection[16]) {
+  session()->Enqueue(
+      NewSetStereoCameraProjectionCmd(id(), left_projection, right_projection));
+}
+
+Renderer::Renderer(Session* session) : Resource(session) {
+  session->Enqueue(NewCreateRendererCmd(id()));
+}
+
+Renderer::Renderer(Renderer&& moved) : Resource(std::move(moved)) {}
+
+Renderer::~Renderer() = default;
+
+void Renderer::SetCamera(uint32_t camera_id) {
+  session()->Enqueue(NewSetCameraCmd(id(), camera_id));
+}
+
+void Renderer::SetParam(fuchsia::ui::gfx::RendererParam param) {
+  session()->Enqueue(NewSetRendererParamCmd(id(), std::move(param)));
+}
+
+void Renderer::SetShadowTechnique(fuchsia::ui::gfx::ShadowTechnique technique) {
+  auto param = fuchsia::ui::gfx::RendererParam();
+  param.set_shadow_technique(technique);
+  SetParam(std::move(param));
+}
+
+void Renderer::SetDisableClipping(bool disable_clipping) {
+  session()->Enqueue(NewSetDisableClippingCmd(id(), disable_clipping));
+}
+
+Layer::Layer(Session* session) : Resource(session) {
+  session->Enqueue(NewCreateLayerCmd(id()));
+}
+
+Layer::Layer(Layer&& moved) : Resource(std::move(moved)) {}
+
+Layer::~Layer() = default;
+
+void Layer::SetRenderer(uint32_t renderer_id) {
+  session()->Enqueue(NewSetRendererCmd(id(), renderer_id));
+}
+
+void Layer::SetSize(const float size[2]) {
+  session()->Enqueue(NewSetSizeCmd(id(), size));
+}
+
+LayerStack::LayerStack(Session* session) : Resource(session) {
+  session->Enqueue(NewCreateLayerStackCmd(id()));
+}
+
+LayerStack::LayerStack(LayerStack&& moved) : Resource(std::move(moved)) {}
+
+LayerStack::~LayerStack() = default;
+
+void LayerStack::AddLayer(uint32_t layer_id) {
+  session()->Enqueue(NewAddLayerCmd(id(), layer_id));
+}
+
+void LayerStack::RemoveLayer(uint32_t layer_id) {
+  session()->Enqueue(NewRemoveLayerCmd(id(), layer_id));
+}
+
+void LayerStack::RemoveAllLayers() {
+  session()->Enqueue(NewRemoveAllLayersCmd(id()));
+}
+
+DisplayCompositor::DisplayCompositor(Session* session) : Resource(session) {
+  session->Enqueue(NewCreateDisplayCompositorCmd(id()));
+}
+
+DisplayCompositor::DisplayCompositor(DisplayCompositor&& moved)
+    : Resource(std::move(moved)) {}
+
+DisplayCompositor::~DisplayCompositor() = default;
+
+void DisplayCompositor::SetLayerStack(uint32_t layer_stack_id) {
+  session()->Enqueue(NewSetLayerStackCmd(id(), layer_stack_id));
+}
+
+Compositor::Compositor(Session* session) : Resource(session) {
+  session->Enqueue(NewCreateCompositorCmd(id()));
+}
+
+Compositor::Compositor(Compositor&& moved) : Resource(std::move(moved)) {}
+
+Compositor::~Compositor() = default;
+
+void Compositor::SetLayerStack(uint32_t layer_stack_id) {
+  session()->Enqueue(NewSetLayerStackCmd(id(), layer_stack_id));
+}
+
+Light::Light(Session* session) : Resource(session) {}
+
+Light::Light(Light&& moved) : Resource(std::move(moved)) {}
+
+Light::~Light() = default;
+
+void Light::SetColor(const float rgb[3]) {
+  session()->Enqueue(NewSetLightColorCmd(id(), rgb));
+}
+
+void Light::SetColor(uint32_t variable_id) {
+  session()->Enqueue(NewSetLightColorCmd(id(), variable_id));
+}
+
+void Light::Detach() { session()->Enqueue(NewDetachLightCmd(id())); }
+
+AmbientLight::AmbientLight(Session* session) : Light(session) {
+  session->Enqueue(NewCreateAmbientLightCmd(id()));
+}
+
+AmbientLight::AmbientLight(AmbientLight&& moved) : Light(std::move(moved)) {}
+
+AmbientLight::~AmbientLight() = default;
+
+DirectionalLight::DirectionalLight(Session* session) : Light(session) {
+  session->Enqueue(NewCreateDirectionalLightCmd(id()));
+}
+
+DirectionalLight::DirectionalLight(DirectionalLight&& moved)
+    : Light(std::move(moved)) {}
+
+DirectionalLight::~DirectionalLight() = default;
+
+void DirectionalLight::SetDirection(const float direction[3]) {
+  session()->Enqueue(NewSetLightDirectionCmd(id(), direction));
+}
+
+void DirectionalLight::SetDirection(uint32_t variable_id) {
+  session()->Enqueue(NewSetLightDirectionCmd(id(), variable_id));
+}
+
+}  // namespace scenic
diff --git a/pkg/scenic_cpp/session.cc b/pkg/scenic_cpp/session.cc
new file mode 100644
index 0000000..7f48da9
--- /dev/null
+++ b/pkg/scenic_cpp/session.cc
@@ -0,0 +1,184 @@
+// 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.
+
+#include "lib/ui/scenic/cpp/session.h"
+
+#include <stdio.h>
+#include <zircon/assert.h>
+
+#include "lib/ui/scenic/cpp/commands.h"
+
+namespace scenic {
+
+constexpr size_t kCommandsPerMessage =
+    (ZX_CHANNEL_MAX_MSG_BYTES - sizeof(fidl_message_header_t) -
+     sizeof(fidl_vector_t)) /
+    sizeof(fuchsia::ui::scenic::Command);
+
+SessionPtrAndListenerRequest CreateScenicSessionPtrAndListenerRequest(
+    fuchsia::ui::scenic::Scenic* scenic) {
+  fuchsia::ui::scenic::SessionPtr session;
+  fidl::InterfaceHandle<fuchsia::ui::scenic::SessionListener> listener_handle;
+  auto listener_request = listener_handle.NewRequest();
+
+  scenic->CreateSession(session.NewRequest(), listener_handle.Bind());
+
+  return {std::move(session), std::move(listener_request)};
+}
+
+Session::Session(fuchsia::ui::scenic::SessionPtr session,
+                 fidl::InterfaceRequest<fuchsia::ui::scenic::SessionListener>
+                     session_listener)
+    : session_(std::move(session)), session_listener_binding_(this) {
+  ZX_DEBUG_ASSERT(session_);
+  if (session_listener.is_valid())
+    session_listener_binding_.Bind(std::move(session_listener));
+}
+
+Session::Session(fuchsia::ui::scenic::Scenic* scenic)
+    : session_listener_binding_(this) {
+  ZX_DEBUG_ASSERT(scenic);
+  scenic->CreateSession(session_.NewRequest(),
+                        session_listener_binding_.NewBinding());
+}
+
+Session::Session(SessionPtrAndListenerRequest session_and_listener)
+    : Session(std::move(session_and_listener.first),
+              std::move(session_and_listener.second)) {}
+
+Session::~Session() {
+  ZX_DEBUG_ASSERT_MSG(resource_count_ == 0,
+                      "Some resources outlived the session: %u",
+                      resource_count_);
+}
+
+uint32_t Session::AllocResourceId() {
+  uint32_t resource_id = next_resource_id_++;
+  ZX_DEBUG_ASSERT(resource_id);
+  resource_count_++;
+  return resource_id;
+}
+
+void Session::ReleaseResource(uint32_t resource_id) {
+  resource_count_--;
+  Enqueue(NewReleaseResourceCmd(resource_id));
+}
+
+void Session::Enqueue(fuchsia::ui::gfx::Command command) {
+  Enqueue(NewCommand(std::move(command)));
+}
+
+void Session::Enqueue(fuchsia::ui::input::Command command) {
+  Enqueue(NewCommand(std::move(command)));
+}
+
+void Session::Enqueue(fuchsia::ui::scenic::Command command) {
+  commands_.push_back(std::move(command));
+  if (commands_->size() >= kCommandsPerMessage ||
+      command.Which() == fuchsia::ui::scenic::Command::Tag::kInput) {
+    Flush();
+  }
+}
+
+void Session::EnqueueAcquireFence(zx::event fence) {
+  ZX_DEBUG_ASSERT(fence);
+  acquire_fences_.push_back(std::move(fence));
+}
+
+void Session::EnqueueReleaseFence(zx::event fence) {
+  ZX_DEBUG_ASSERT(fence);
+  release_fences_.push_back(std::move(fence));
+}
+
+void Session::Flush() {
+  ZX_DEBUG_ASSERT(session_);
+  if (!commands_->empty()) {
+    ZX_DEBUG_ASSERT(static_cast<bool>(commands_));
+    session_->Enqueue(std::move(commands_));
+
+    // After being moved, |commands_| is in a "valid but unspecified state";
+    // see http://en.cppreference.com/w/cpp/utility/move.  Calling reset() makes
+    // it safe to continue using.
+    commands_.reset();
+  }
+}
+
+void Session::Present(uint64_t presentation_time, PresentCallback callback) {
+  ZX_DEBUG_ASSERT(session_);
+  Flush();
+
+  if (acquire_fences_.is_null())
+    acquire_fences_.resize(0u);
+  if (release_fences_.is_null())
+    release_fences_.resize(0u);
+  session_->Present(presentation_time, std::move(acquire_fences_),
+                    std::move(release_fences_), std::move(callback));
+}
+
+void Session::HitTest(uint32_t node_id, const float ray_origin[3],
+                      const float ray_direction[3], HitTestCallback callback) {
+  ZX_DEBUG_ASSERT(session_);
+  fuchsia::ui::gfx::vec3 ray_origin_vec;
+  ray_origin_vec.x = ray_origin[0];
+  ray_origin_vec.y = ray_origin[1];
+  ray_origin_vec.z = ray_origin[2];
+
+  fuchsia::ui::gfx::vec3 ray_direction_vec;
+  ray_direction_vec.x = ray_direction[0];
+  ray_direction_vec.y = ray_direction[1];
+  ray_direction_vec.z = ray_direction[2];
+
+  session_->HitTest(node_id, std::move(ray_origin_vec),
+                    std::move(ray_direction_vec), std::move(callback));
+}
+
+void Session::HitTestDeviceRay(
+    const float ray_origin[3], const float ray_direction[3],
+    fuchsia::ui::scenic::Session::HitTestDeviceRayCallback callback) {
+  ZX_DEBUG_ASSERT(session_);
+  fuchsia::ui::gfx::vec3 ray_origin_vec;
+  ray_origin_vec.x = ray_origin[0];
+  ray_origin_vec.y = ray_origin[1];
+  ray_origin_vec.z = ray_origin[2];
+
+  fuchsia::ui::gfx::vec3 ray_direction_vec;
+  ray_direction_vec.x = ray_direction[0];
+  ray_direction_vec.y = ray_direction[1];
+  ray_direction_vec.z = ray_direction[2];
+
+  session_->HitTestDeviceRay(std::move(ray_origin_vec),
+                             std::move(ray_direction_vec), std::move(callback));
+}
+
+void Session::Unbind() {
+  ZX_DEBUG_ASSERT(session_);
+  ZX_DEBUG_ASSERT(!session_handle_);
+  session_handle_ = session_.Unbind();
+  session_ = nullptr;
+}
+
+void Session::Rebind() {
+  ZX_DEBUG_ASSERT(!session_);
+  ZX_DEBUG_ASSERT(session_handle_);
+  session_ = fuchsia::ui::scenic::SessionPtr(session_handle_.Bind());
+  session_handle_ = nullptr;
+}
+
+void Session::OnScenicError(fidl::StringPtr error) {
+  // TODO(SCN-903): replace fprintf with SDK-approved logging mechanism.  Also
+  // remove "#include <stdio.h>".
+  fprintf(stderr, "Session error: %s", error->c_str());
+}
+
+void Session::OnScenicEvent(
+    fidl::VectorPtr<fuchsia::ui::scenic::Event> events) {
+  if (event_handler_)
+    event_handler_(std::move(events));
+}
+
+void Session::SetDebugName(const std::string& debug_name) {
+  session_->SetDebugName(debug_name);
+}
+
+}  // namespace scenic
diff --git a/pkg/svc/include/lib/svc/dir.h b/pkg/svc/include/lib/svc/dir.h
new file mode 100644
index 0000000..8e16c97
--- /dev/null
+++ b/pkg/svc/include/lib/svc/dir.h
@@ -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.
+
+#ifndef LIB_SVC_SVC_H_
+#define LIB_SVC_SVC_H_
+
+#include <lib/async/dispatcher.h>
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+typedef void(svc_connector_t)(void* context, const char* service_name,
+                              zx_handle_t service_request);
+
+typedef struct svc_dir svc_dir_t;
+
+__EXPORT zx_status_t svc_dir_create(async_dispatcher_t* dispatcher,
+                                    zx_handle_t directory_request,
+                                    svc_dir_t** out_result);
+
+// Adds a service named |service_name| to the given |dir|.
+//
+// If |type| is non-NULL, the service will be published in a directory whose
+// name matches the |type|. If |type| is NULL, the service will be published in
+// the root directory.
+//
+// The most commonly used values for |type| are "public", "debug", and "ctrl".
+// Services published under "public" are made available to clients via
+// |fuchsia.sys.Lancher#CreateComponent|. The "debug" serivices are exposed via
+// the hub. The "ctrl" services are used by the core platform to communicate
+// with your program.
+//
+// When a client requests the service, |handler| will be called on the async_t
+// passed to |svc_dir_create|. The |context| will be passed to |handler| as its
+// first argument.
+//
+// This may fail in two ways. If an entry with the given
+// |service_name| already exists, this returns
+// ZX_ERR_ALREADY_EXISTS. If the provided |service_name| is invalid,
+// ZX_ERR_INVALID_ARGS is returned. Otherwise, this returns ZX_OK.
+__EXPORT zx_status_t svc_dir_add_service(svc_dir_t* dir, const char* type,
+                                         const char* service_name,
+                                         void* context,
+                                         svc_connector_t* handler);
+
+// Removes the service named |service_name| of type |type| from the
+// given |dir|. This reports a failure if the entry does not exist, by
+// returning ZX_ERR_NOT_FOUND. Otherwise, the service entry is
+// removed, and ZX_OK is returned.
+__EXPORT zx_status_t svc_dir_remove_service(svc_dir_t* dir, const char* type,
+                                            const char* service_name);
+
+// Destroy the provided directory. This currently cannot fail, and
+// returns ZX_OK.
+__EXPORT zx_status_t svc_dir_destroy(svc_dir_t* dir);
+
+__END_CDECLS
+
+#endif  // LIB_SVC_SVC_H_
diff --git a/pkg/svc/meta.json b/pkg/svc/meta.json
new file mode 100644
index 0000000..2a183d5
--- /dev/null
+++ b/pkg/svc/meta.json
@@ -0,0 +1,27 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/28/16547647b2a89d.debug", 
+      "dist": "arch/arm64/dist/libsvc.so", 
+      "link": "arch/arm64/lib/libsvc.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/31/f3907157249ab0.debug", 
+      "dist": "arch/x64/dist/libsvc.so", 
+      "link": "arch/x64/lib/libsvc.so"
+    }
+  }, 
+  "deps": [
+    "async", 
+    "fdio", 
+    "trace-engine"
+  ], 
+  "format": "shared", 
+  "headers": [
+    "pkg/svc/include/lib/svc/dir.h"
+  ], 
+  "include_dir": "pkg/svc/include", 
+  "name": "svc", 
+  "root": "pkg/svc", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/sync/include/lib/sync/completion.h b/pkg/sync/include/lib/sync/completion.h
new file mode 100644
index 0000000..515a563
--- /dev/null
+++ b/pkg/sync/include/lib/sync/completion.h
@@ -0,0 +1,55 @@
+// 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 LIB_SYNC_COMPLETION_H_
+#define LIB_SYNC_COMPLETION_H_
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+typedef struct sync_completion {
+    zx_futex_t futex;
+
+#ifdef __cplusplus
+    sync_completion()
+        : futex(0) {}
+#endif
+} sync_completion_t;
+
+#if !defined(__cplusplus)
+#define SYNC_COMPLETION_INIT ((sync_completion_t){0})
+#endif
+
+// Returns ZX_ERR_TIMED_OUT if timeout elapses, and ZX_OK if woken by
+// a call to sync_completion_signal or if the completion has already been
+// signaled.
+zx_status_t sync_completion_wait(sync_completion_t* completion, zx_duration_t timeout);
+
+// Returns ZX_ERR_TIMED_OUT if deadline elapses, and ZX_OK if woken by
+// a call to sync_completion_signal or if the completion has already been
+// signaled.
+zx_status_t sync_completion_wait_deadline(sync_completion_t* completion, zx_time_t deadline);
+
+// Awakens all waiters on the completion, and marks it as
+// signaled. Waits after this call but before a reset of the
+// completion will also see the signal and immediately return.
+void sync_completion_signal(sync_completion_t* completion);
+
+// Marks the completion as signaled, but doesn't awaken all waiters
+// right away. Instead, all waiters are requeued to the |futex|.
+// Waits after this call but before a reset of the
+// completion will also see the signal and immediately return.
+//
+// Intended to be used by libsync internally, e.g. the condition variable
+// implementation.
+void sync_completion_signal_requeue(sync_completion_t* completion, zx_futex_t* futex);
+
+// Resets the completion's signaled state to unsignaled.
+void sync_completion_reset(sync_completion_t* completion);
+
+__END_CDECLS
+
+#endif // LIB_SYNC_COMPLETION_H_
diff --git a/pkg/sync/include/lib/sync/condition.h b/pkg/sync/include/lib/sync/condition.h
new file mode 100644
index 0000000..6f6eb58
--- /dev/null
+++ b/pkg/sync/include/lib/sync/condition.h
@@ -0,0 +1,95 @@
+// 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 LIB_SYNC_CONDITION_H_
+#define LIB_SYNC_CONDITION_H_
+
+#include <lib/sync/mutex.h>
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// A condition variable that works with a sync_mutex_t
+typedef struct sync_condition {
+    int lock;
+    void* head;
+    void* tail;
+
+#ifdef __cplusplus
+    sync_condition()
+        : lock(0), head(nullptr), tail(nullptr) {}
+#endif
+} sync_condition_t;
+
+#if !defined(__cplusplus)
+#define SYNC_CONDITION_INIT ((sync_condition_t){0})
+#endif
+
+// Block until |condition| is signaled by sync_condition_signal()/sync_condition_broadcast(), or a spurious
+// wake up occurs.
+//
+// |mutex| must be in a locked state, and will be atomically unlocked for the duration of the wait,
+// then locked again before the function returns.
+void sync_condition_wait(sync_condition_t* condition, sync_mutex_t* mutex);
+
+// Block until |condition| is signaled by sync_condition_signal()/sync_condition_broadcast(), or a spurious
+// wake up or a timeout occurs.
+//
+// |mutex| must be in a locked state, and will be atomically unlocked for the duration of the wait,
+// then locked again before the function returns.
+//
+// ZX_TIME_INFINITE can be used for |deadline| to wait for an unlimited amount of time.
+//
+// Return value:
+//      ZX_OK if |condition| was signaled or a spurious wake up occurred.
+//      ZX_ERR_TIMED_OUT if the wait timed out.
+zx_status_t sync_condition_timedwait(sync_condition_t* condition, sync_mutex_t* mutex, zx_time_t deadline);
+
+// Wake up one thread waiting for |condition|.
+//
+// If the woken thread was waiting on sync_condition_timedwait(), then it is guaranteed
+// to receive a ZX_OK return value even if a race with a timeout occurs. As an example
+// where this makes a difference, consider the following implementation of a multi-producer,
+// multi-consumer queue:
+//
+// Message* MessageQueue::DequeueTimeout(zx_time_t deadline) {
+//    sync_mutex_lock(&mutex_);
+//    for (;;) {
+//        if (!list_.empty()) {
+//            Message* msg = list_.front();
+//            list_.pop_front();
+//            sync_mutex_unlock(&mutex_);
+//            return msg;
+//        }
+//        zx_status_t status = sync_condition_timedwait(&condition_, &mutex_, deadline);
+//        if (status == ZX_ERR_TIMED_OUT) {
+//            // Without the above guarantee, this would be a bug: a race between
+//            // a timeout and a signal() would result in a missed wakeup.
+//            // To fix that, we would need to recheck list_.empty() here, which
+//            // is not obvious and would make the code more complex.
+//            sync_mutex_unlock(&mutex_);
+//            return nullptr;
+//        }
+//    }
+// }
+//
+// void MessageQueue::Enqueue(Message* msg) {
+//     sync_mutex_lock(&mutex_);
+//     list_.push_back(msg);
+//     // Signal just one waiter. Assumes that any possible waiter will dequeue the message.
+//     sync_condition_signal(&condvar_);
+//     sync_mutex_unlock(&mutex_);
+// }
+//
+// Note that pthread does not seem to require this property, and in fact the current upstream
+// implementation of pthread_cond_timedwait() in MUSL does not have it.
+void sync_condition_signal(sync_condition_t* condition);
+
+// Wake up all threads that are currently waiting for |condition|.
+void sync_condition_broadcast(sync_condition_t* condition);
+
+__END_CDECLS
+
+#endif // LIB_SYNC_CONDITION_H_
diff --git a/pkg/sync/include/lib/sync/internal/condition-template.h b/pkg/sync/include/lib/sync/internal/condition-template.h
new file mode 100644
index 0000000..7bd4f2d
--- /dev/null
+++ b/pkg/sync/include/lib/sync/internal/condition-template.h
@@ -0,0 +1,296 @@
+// 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 LIB_SYNC_INTERNAL_CONDITION_TEMPLATE_H_
+#define LIB_SYNC_INTERNAL_CONDITION_TEMPLATE_H_
+
+#include <zircon/syscalls.h>
+#include <lib/sync/completion.h>
+#include <lib/sync/mutex.h>
+
+namespace condition_impl_internal {
+
+// A template implementation of a condition variable.
+// The algorithm is borrowed from MUSL.
+//
+// The 'Condition' struct must contain the following fields:
+//      int lock;
+//      void* head;
+//      void* tail;
+//
+// The following struct template must be specialized for the mutex type 'Mutex'
+// in order to instantiate the template:
+template <typename Mutex>
+struct MutexOps {
+    // Return a pointer to the futex that backs the |mutex|
+    static zx_futex_t* get_futex(Mutex* mutex);
+
+    // Lock the |mutex|. If an error occurs while locking the mutex,
+    // ZX_ERR_BAD_STATE must be returned. An implementation-defined
+    // error code can be returned via |mutex_lock_err| if it's not null.
+    static zx_status_t lock(Mutex* mutex, int* mutex_lock_err);
+
+    // Similar to lock(), but also update the waiter information in the mutex.
+    // If the mutex implements waiter counting, then the count must be adjusted
+    // by |waiters_delta|. Otherwise, the mutex must be marked as potentially
+    // having waiters.
+    static zx_status_t lock_with_waiters(
+        Mutex* mutex, int waiters_delta, int* mutex_lock_err);
+
+    // Unlock the mutex
+    static void unlock(Mutex* mutex);
+};
+
+// Note that this library is used by libc, and as such needs to use
+// '_zx_' function names for syscalls and not the regular 'zx_' names.
+
+static inline void spin() {
+#if defined(__x86_64__)
+    __asm__ __volatile__("pause"
+                         :
+                         :
+                         : "memory");
+#elif defined(__aarch64__)
+    __atomic_thread_fence(__ATOMIC_SEQ_CST);
+#else
+#error Please define spin() for your architecture
+#endif
+}
+
+static inline bool cas(int* ptr, int* expected, int desired) {
+    return __atomic_compare_exchange_n(ptr, expected, desired, false,
+                                       __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+}
+
+static inline void wait(int* futex, int current_value) {
+    int spins = 100;
+    while (spins--) {
+        if (__atomic_load_n(futex, __ATOMIC_SEQ_CST) == current_value) {
+            spin();
+        } else {
+            return;
+        }
+    }
+    while (__atomic_load_n(futex, __ATOMIC_SEQ_CST) == current_value) {
+        _zx_futex_wait(futex, current_value, ZX_HANDLE_INVALID, ZX_TIME_INFINITE);
+    }
+}
+
+enum {
+    WAITING,
+    SIGNALED,
+    LEAVING,
+};
+
+struct Waiter {
+    Waiter* prev = nullptr;
+    Waiter* next = nullptr;
+    int state = WAITING;
+    sync_completion_t ready;
+    int* notify = nullptr;
+};
+
+// Return value:
+//      - ZX_OK if the condition variable was signaled;
+//      - ZX_ERR_TIMED_OUT if deadline was reached;
+//      - ZX_ERR_BAD_STATE if there was an error locking the mutex.
+//        In this case, |mutex_lock_err|, if not null, will be populated with an error code
+//        provided by the mutex implementation.
+template <typename Condition, typename Mutex>
+static inline zx_status_t timedwait(Condition* c, Mutex* mutex, zx_time_t deadline,
+                                    int* mutex_lock_err)
+    __TA_NO_THREAD_SAFETY_ANALYSIS {
+    sync_mutex_lock(reinterpret_cast<sync_mutex_t*>(&c->lock));
+
+    Waiter node;
+
+    // Add our waiter node onto the condition's list.  We add the node to the
+    // head of the list, but this is logically the end of the queue.
+    node.next = static_cast<Waiter*>(c->head);
+    c->head = &node;
+    if (!c->tail) {
+        c->tail = &node;
+    } else {
+        node.next->prev = &node;
+    }
+
+    sync_mutex_unlock(reinterpret_cast<sync_mutex_t*>(&c->lock));
+
+    MutexOps<Mutex>::unlock(mutex);
+
+    // Wait to be signaled.  There are multiple ways this wait could finish:
+    //  1) After being woken by signal().
+    //  2) After being woken by a mutex unlock, after we were
+    //     requeued from the condition's futex to the mutex's futex (by
+    //     timedwait() in another thread).
+    //  3) After a timeout.
+    // In the original Linux version of this algorithm, this could also exit
+    // when interrupted by an asynchronous signal, but that does not apply on Zircon.
+    sync_completion_wait_deadline(&node.ready, deadline);
+
+    int oldstate = WAITING;
+    if (cas(&node.state, &oldstate, LEAVING)) {
+        // The wait timed out.  So far, this thread was not signaled by
+        // signal() -- this thread was able to move state.node out of the
+        // WAITING state before any signal() call could do that.
+        //
+        // This thread must therefore remove the waiter node from the
+        // list itself.
+
+        // Access to cv object is valid because this waiter was not
+        // yet signaled and a new signal/broadcast cannot return
+        // after seeing a LEAVING waiter without getting notified
+        // via the futex notify below.
+
+        sync_mutex_lock(reinterpret_cast<sync_mutex_t*>(&c->lock));
+
+        // Remove our waiter node from the list.
+        if (c->head == &node) {
+            c->head = node.next;
+        } else if (node.prev) {
+            node.prev->next = node.next;
+        }
+
+        if (c->tail == &node) {
+            c->tail = node.prev;
+        } else if (node.next) {
+            node.next->prev = node.prev;
+        }
+
+        sync_mutex_unlock(reinterpret_cast<sync_mutex_t*>(&c->lock));
+
+        // It is possible that signal() saw our waiter node after we set
+        // node.state to LEAVING but before we removed the node from the
+        // list.  If so, it will have set node.notify and will be waiting
+        // on it, and we need to wake it up.
+        //
+        // This is rather complex.  An alternative would be to eliminate
+        // the |node.state| field and always claim |lock| if we could have
+        // got a timeout.  However, that presumably has higher overhead
+        // (since it contends |lock| and involves more atomic ops).
+        if (node.notify) {
+            if (__atomic_fetch_add(node.notify, -1, __ATOMIC_SEQ_CST) == 1) {
+                _zx_futex_wake(node.notify, 1);
+            }
+        }
+
+        // We don't need lock_with_waiters() here: we haven't been signaled, and will
+        // never be since we managed to claim the state as LEAVING. This means that
+        // we could not have been woken up by unlock_requeue() + mutex unlock().
+        if (MutexOps<Mutex>::lock(mutex, mutex_lock_err) != ZX_OK) {
+            return ZX_ERR_BAD_STATE;
+        }
+        return ZX_ERR_TIMED_OUT;
+    }
+
+    // Since the CAS above failed, we have been signaled.
+    // It could still be the case that sync_completion_wait_deadline() above timed out,
+    // so we need to make sure to wait for the completion to control the wake order.
+    // If the completion has already been signaled, this will return immediately.
+    sync_completion_wait_deadline(&node.ready, ZX_TIME_INFINITE);
+
+    // By this point, our part of the waiter list cannot change further.
+    // It has been unlinked from the condition by signal().
+    // Any timed out waiters would have removed themselves from the list
+    // before signal() signaled the first node.ready in our list.
+    //
+    // It is therefore safe now to read node.next and node.prev without
+    // holding c->lock.
+
+    // As an optimization, we only update waiter count at the beginning and
+    // end of the signaled list.
+    int waiters_delta = 0;
+    if (!node.prev) {
+        waiters_delta++;
+    }
+    if (!node.next) {
+        waiters_delta--;
+    }
+
+    // We must leave the mutex in the "locked with waiters" state here
+    // (or adjust its waiter count, depending on the implementation).
+    // There are two reasons for that:
+    //  1) If we do the unlock_requeue() below, a condition waiter will be
+    //     requeued to the mutex's futex.  We need to ensure that it will
+    //     be signaled by mutex unlock() in future.
+    //  2) If the current thread was woken via an unlock_requeue() +
+    //     mutex unlock, there *might* be another thread waiting for
+    //     the mutex after us in the queue.  We need to ensure that it
+    //     will be signaled by zxr_mutex_unlock() in future.
+    zx_status_t status = MutexOps<Mutex>::lock_with_waiters(mutex, waiters_delta, mutex_lock_err);
+
+    if (node.prev) {
+        // Signal the completion that's holding back the next waiter, and
+        // requeue it to the mutex so that it will be woken when the
+        // mutex is unlocked.
+        sync_completion_signal_requeue(&node.prev->ready, MutexOps<Mutex>::get_futex(mutex));
+    }
+
+    // Even if the first call to sync_completion_wait_deadline() timed out,
+    // we still have been signaled. Thus we still return ZX_OK rather than
+    // ZX_ERR_TIMED_OUT. This provides the following guarantee: if multiple
+    // threads are waiting when signal() is called, at least one waiting
+    // thread will be woken *and* get a ZX_OK from timedwait() (unless there
+    // is an error locking the mutex). This property does not appear to be
+    // required by pthread condvars, although an analogous property is
+    // required for futex wake-ups. We also require this property for
+    // sync_condition_t.
+    return status;
+}
+
+// This will wake up to |n| threads that are waiting on the condition,
+// or all waiting threads if |n| is set to -1
+template <typename Condition>
+static inline void signal(Condition* c, int n) {
+    Waiter* p;
+    Waiter* first = nullptr;
+    int ref = 0;
+    int cur;
+
+    sync_mutex_lock(reinterpret_cast<sync_mutex_t*>(&c->lock));
+    for (p = static_cast<Waiter*>(c->tail); n && p; p = p->prev) {
+        int oldstate = WAITING;
+        if (!cas(&p->state, &oldstate, SIGNALED)) {
+            // This waiter timed out, and it marked itself as in the
+            // LEAVING state.  However, it hasn't yet claimed |lock|
+            // (since we claimed the lock first) and so it hasn't yet
+            // removed itself from the list.  We will wait for the waiter
+            // to remove itself from the list and to notify us of that.
+            __atomic_fetch_add(&ref, 1, __ATOMIC_SEQ_CST);
+            p->notify = &ref;
+        } else {
+            n--;
+            if (!first) {
+                first = p;
+            }
+        }
+    }
+    // Split the list, leaving any remainder on the cv.
+    if (p) {
+        if (p->next) {
+            p->next->prev = 0;
+        }
+        p->next = 0;
+    } else {
+        c->head = 0;
+    }
+    c->tail = p;
+    sync_mutex_unlock(reinterpret_cast<sync_mutex_t*>(&c->lock));
+
+    // Wait for any waiters in the LEAVING state to remove
+    // themselves from the list before returning or allowing
+    // signaled threads to proceed.
+    while ((cur = __atomic_load_n(&ref, __ATOMIC_SEQ_CST))) {
+        wait(&ref, cur);
+    }
+
+    // Allow first signaled waiter, if any, to proceed.
+    if (first) {
+        sync_completion_signal(&first->ready);
+    }
+}
+
+} // namespace condition_impl_internal
+
+#endif // LIB_SYNC_INTERNAL_CONDITION_TEMPLATE_H_
diff --git a/pkg/sync/include/lib/sync/mutex.h b/pkg/sync/include/lib/sync/mutex.h
new file mode 100644
index 0000000..37a5cd3
--- /dev/null
+++ b/pkg/sync/include/lib/sync/mutex.h
@@ -0,0 +1,72 @@
+// 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 LIB_SYNC_MUTEX_H_
+#define LIB_SYNC_MUTEX_H_
+
+#include <zircon/compiler.h>
+#include <zircon/types.h>
+
+__BEGIN_CDECLS
+
+// An optimal, non-recursive mutex on Fuchsia.
+//
+// The |mutex_t| mutex in the standard library has several quirks in its design
+// that prevent it from being optimal. For example, the |mutex_t| interface
+// supports recursion, which adds a branch to |mutex_init| to check that the
+// client has not asked for recusion, and |mutex_timedlock| operates in
+// |struct timespec| rather than |zx_time_t|.
+//
+// |sync_mutex| resolves these issues.
+typedef struct __TA_CAPABILITY("mutex") sync_mutex {
+    zx_futex_t futex;
+
+#ifdef __cplusplus
+    sync_mutex()
+        : futex(0) {}
+#endif
+} sync_mutex_t;
+
+#if !defined(__cplusplus)
+#define SYNC_MUTEX_INIT ((sync_mutex_t){0})
+#endif
+
+// Locks the mutex.
+//
+// The current thread will block until the mutex is acquired. The mutex is
+// non-recursive, which means attempting to lock a mutex that is already held by
+// this thread will deadlock.
+void sync_mutex_lock(sync_mutex_t* mutex) __TA_ACQUIRE(mutex);
+
+// Locks the mutex and mark the mutex as having a waiter.
+//
+// Similar to |sync_mutex_lock| but markes the mutex as having a waiter. Intended
+// to be used by the condition variable implementation.
+void sync_mutex_lock_with_waiter(sync_mutex_t* mutex) __TA_ACQUIRE(mutex);
+
+// Attempt to lock the mutex until |deadline|.
+//
+// The current thread will block until either the mutex is acquired or
+// |deadline| passes.
+//
+// |deadline| is expressed as an absolute time in the ZX_CLOCK_MONOTONIC
+// timebase.
+//
+// Returns |ZX_OK| if the lock is acquired, and |ZX_ERR_TIMED_OUT| if the
+// deadline passes.
+zx_status_t sync_mutex_timedlock(sync_mutex_t* mutex, zx_time_t deadline);
+
+// Attempts to lock the mutex without blocking.
+//
+// Returns |ZX_OK| if the lock is obtained, and |ZX_ERR_BAD_STATE| if not.
+zx_status_t sync_mutex_trylock(sync_mutex_t* mutex);
+
+// Unlocks the mutex.
+//
+// Does nothing if the mutex is already unlocked.
+void sync_mutex_unlock(sync_mutex_t* mutex) __TA_RELEASE(mutex);
+
+__END_CDECLS
+
+#endif // LIB_SYNC_MUTEX_H_
diff --git a/pkg/sync/meta.json b/pkg/sync/meta.json
new file mode 100644
index 0000000..4908432
--- /dev/null
+++ b/pkg/sync/meta.json
@@ -0,0 +1,22 @@
+{
+  "binaries": {
+    "arm64": {
+      "link": "arch/arm64/lib/libsync.a"
+    }, 
+    "x64": {
+      "link": "arch/x64/lib/libsync.a"
+    }
+  }, 
+  "deps": [], 
+  "format": "static", 
+  "headers": [
+    "pkg/sync/include/lib/sync/completion.h", 
+    "pkg/sync/include/lib/sync/condition.h", 
+    "pkg/sync/include/lib/sync/internal/condition-template.h", 
+    "pkg/sync/include/lib/sync/mutex.h"
+  ], 
+  "include_dir": "pkg/sync/include", 
+  "name": "sync", 
+  "root": "pkg/sync", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/syslog/include/lib/syslog/global.h b/pkg/syslog/include/lib/syslog/global.h
new file mode 100644
index 0000000..9c9cc89
--- /dev/null
+++ b/pkg/syslog/include/lib/syslog/global.h
@@ -0,0 +1,132 @@
+// 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.
+
+//
+// Entry points used by clients.
+
+#ifndef LIB_SYSLOG_GLOBAL_H_
+#define LIB_SYSLOG_GLOBAL_H_
+
+#include <lib/syslog/logger.h>
+
+__BEGIN_CDECLS
+
+// Gets the global logger for the process to which log messages emitted
+// using the FX_LOG macros will be written.  Returns NULL if logging is
+// not configured.
+fx_logger_t* fx_log_get_logger(void);
+
+// Returns true if writing messages with the given severity is enabled in the
+// global logger.
+static inline bool fx_log_is_enabled(fx_log_severity_t severity) {
+    fx_logger_t* logger = fx_log_get_logger();
+    return logger && severity >= fx_logger_get_min_severity(logger);
+}
+
+// Initializes the logging infrastructure with the specified configuration.
+// Returns |ZX_ERR_BAD_STATE| if logging has already been initialized.
+// If |console_fd| and |log_service_channel| are invalid in |config|,
+// this function chooses a default destination for the log.
+// |config| can be safely deallocated after this function returns.
+//
+// global logger would be deallocated once program ends.
+zx_status_t fx_log_init_with_config(const fx_logger_config_t* config);
+
+// Initializes the logging infrastructure for this process using default
+// parameters. Returns |ZX_ERR_BAD_STATE| if logging has already been
+// initialized.
+//
+// global logger would be deallocated once program ends.
+zx_status_t fx_log_init(void);
+
+// Returns true if writing messages with the given severity is enabled in the
+// global logger. |severity| is one of DEBUG, INFO, WARNING, ERROR, or FATAL.
+#define FX_LOG_IS_ENABLED(severity) (fx_log_is_enabled(FX_LOG_##severity))
+
+// Returns true if writing messages with the given verbosity is enabled in the
+// global logger. |verbosity| is positive number.
+#define FX_VLOG_IS_ENABLED(verbosity) (fx_log_is_enabled(-(verbosity)))
+
+#define _FX_LOG_SET_SEVERITY(severity)                      \
+    do {                                                    \
+        fx_logger_t* logger = fx_log_get_logger();          \
+        if (logger) {                                       \
+            fx_logger_set_min_severity(logger, (severity)); \
+        }                                                   \
+    } while (0)
+
+// Sets severity for global logger.
+// |severity| is one of DEBUG, INFO, WARNING, ERROR, or FATAL.
+#define FX_LOG_SET_SEVERITY(severity) _FX_LOG_SET_SEVERITY(FX_LOG_##severity)
+
+// Sets verbosity for global logger.
+// |verbosity| is positive number. Logger severity is set to -verbosity
+#define FX_LOG_SET_VERBOSITY(verbosity) _FX_LOG_SET_SEVERITY(-(verbosity))
+
+#define _FX_LOG(severity, tag, message)                                   \
+    do {                                                                  \
+        fx_logger_t* logger = fx_log_get_logger();                        \
+        if (logger && fx_logger_get_min_severity(logger) <= (severity)) { \
+            fx_logger_log(logger, (severity), (tag), (message));          \
+        }                                                                 \
+    } while (0)
+
+#define _FX_LOGF(severity, tag, message, ...)                             \
+    do {                                                                  \
+        fx_logger_t* logger = fx_log_get_logger();                        \
+        if (logger && fx_logger_get_min_severity(logger) <= (severity)) { \
+            fx_logger_logf(logger, (severity), (tag), (message),          \
+                           __VA_ARGS__);                                  \
+        }                                                                 \
+    } while (0)
+
+#define _FX_LOGVF(severity, tag, message, args)                            \
+    do {                                                                   \
+        fx_logger_t* logger = fx_log_get_logger();                         \
+        if (logger && fx_logger_get_min_severity(logger) <= (severity)) {  \
+            fx_logger_logvf(logger, (severity), (tag), (message), (args)); \
+        }                                                                  \
+    } while (0)
+
+// Writes a message to the global logger.
+// |severity| is one of DEBUG, INFO, WARNING, ERROR, FATAL
+// |tag| is a tag to associated with the message, or NULL if none.
+// |message| is the message to write, or NULL if none.
+#define FX_LOG(severity, tag, message) _FX_LOG((FX_LOG_##severity), tag, message)
+
+// Writes formatted message to the global logger.
+// |severity| is one of DEBUG, INFO, WARNING, ERROR, FATAL
+// |tag| is a tag to associated with the message, or NULL if none.
+// |message| is the message to write, or NULL if none.
+#define FX_LOGF(severity, tag, message, ...) _FX_LOGF((FX_LOG_##severity), tag, message, __VA_ARGS__)
+
+// Writes formatted message to the global logger using vaargs
+// |severity| is one of DEBUG, INFO, WARNING, ERROR, FATAL
+// |tag| is a tag to associated with the message, or NULL if none.
+// |message| is the message to write, or NULL if none.
+// |args| are the arguments to |message|.
+#define FX_LOGVF(severity, tag, message, args) _FX_LOGVF((FX_LOG_##severity), tag, message, args)
+
+// Writes verbose message to the global logger.
+// |verbosity| is positive integer.
+// |tag| is a tag to associated with the message, or NULL if none.
+// |message| is the message to write, or NULL if none.
+#define FX_VLOG(verbosity, tag, message) _FX_LOG(-(verbosity), tag, message)
+
+// Writes formatted verbose message to the global logger.
+// |verbosity| is positive integer.
+// |tag| is a tag to associated with the message, or NULL if none.
+// |message| is the message to write, or NULL if none.
+#define FX_VLOGF(verbosity, tag, message, ...) _FX_LOGF(-(verbosity), tag, message, __VA_ARGS__)
+
+// Writes formatted verbose message to the global logger using vaargs
+// |verbosity| is positive integer.
+// |tag| is a tag to associated with the message, or NULL if none.
+// |message| is the message to write, or NULL if none.
+// |args| are the arguments to |message|.
+#define FX_VLOGVF(verbosity, tag, message, args) _FX_LOGVF(-(verbosity), tag, message, args)
+
+__END_CDECLS
+
+#endif // LIB_SYSLOG_GLOBAL_H_
diff --git a/pkg/syslog/include/lib/syslog/logger.h b/pkg/syslog/include/lib/syslog/logger.h
new file mode 100644
index 0000000..26e001a
--- /dev/null
+++ b/pkg/syslog/include/lib/syslog/logger.h
@@ -0,0 +1,126 @@
+// 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 header contains definition for the logger object and protocol.
+
+#ifndef LIB_SYSLOG_LOGGER_H_
+#define LIB_SYSLOG_LOGGER_H_
+
+#include <stdarg.h>
+#include <unistd.h>
+
+#include <zircon/types.h>
+
+// Max no of tags associated with a logger.
+#define FX_LOG_MAX_TAGS (4)
+
+// Max individual tag length including terminating character.
+#define FX_LOG_MAX_TAG_LEN (64)
+
+// Log entry severity.
+// Used for coarse filtering of log messages
+typedef int fx_log_severity_t;
+#define FX_LOG_INFO (0)
+#define FX_LOG_WARNING (1)
+#define FX_LOG_ERROR (2)
+#define FX_LOG_FATAL (3)
+
+__BEGIN_CDECLS
+
+// Configuration for a logger object.
+// Specifies the destination to which log messages should be written.
+// Multiple destinations may be used concurrently.
+typedef struct fx_logger_config {
+    // The minimum log severity.
+    // Log messages with lower severity will be discarded.
+    fx_log_severity_t min_severity;
+
+    // The file descriptor to which formatted log messages should be written,
+    // or -1 if log messages should not be written to the console.
+    // logger takes ownership of this fd.
+    int console_fd;
+
+    // The FIDL log service channel to which the logger should connect, or
+    // |ZX_HANDLE_INVALID| if the logger should not connect to the log service.
+    // logger takes ownership of this handle.
+    zx_handle_t log_service_channel;
+
+    // An array of tag strings to associate with all messages written
+    // by this logger.  Tags will be truncated if they are (individually) longer
+    // than |FX_LOG_MAX_TAG_LEN|.
+    const char** tags;
+
+    // Number of tag strings.  Must be no more than |FX_LOG_MAX_TAGS|.
+    size_t num_tags;
+} fx_logger_config_t;
+
+// Opaque type representing a logger object.
+typedef struct fx_logger fx_logger_t;
+
+// Creates a logger object from the specified configuration.
+//
+// This will return ZX_ERR_INVALID_ARGS if |num_tags| is more than
+// |FX_LOG_MAX_TAGS| and return |ZX_ERR_INTERNAL} if dup fails.
+// |config| can be safely deleted after this function returns.
+zx_status_t fx_logger_create(const fx_logger_config_t* config,
+                             fx_logger_t** out_logger);
+
+// Destroys a logger object.
+//
+// This closes |console_fd| or |log_service_channel| which were passed in
+// |fx_logger_config_t|.
+void fx_logger_destroy(fx_logger_t* logger);
+
+// Gets the logger's minimum log severity.
+fx_log_severity_t fx_logger_get_min_severity(fx_logger_t* logger);
+
+// Sets logger severity
+void fx_logger_set_min_severity(fx_logger_t* logger,
+                                fx_log_severity_t severity);
+
+// Activates fallback mode and logger starts writing to |fallback_fd|.
+// There is no way to revert this action.
+//
+// This function does not take ownership of |fallback_fd| and it should not be
+// closed till this logger object is no longer in use. Logger will log to
+// stderr if -1 is provided.
+//
+// This function is thread unsafe.
+void fx_logger_activate_fallback(fx_logger_t* logger,
+                                 int fallback_fd);
+
+// Writes formatted message to a logger.
+// The message will be discarded if |severity| is less than the logger's
+// minimum log severity.
+// The |tag| may be NULL, in which case no additional tags are added to the
+// log message.
+// The |tag| will be truncated if it is longer than |FX_LOG_MAX_TAG_LEN|.
+// No message is written if |message| is NULL.
+zx_status_t fx_logger_logf(fx_logger_t* logger, fx_log_severity_t severity,
+                           const char* tag, const char* msg, ...);
+
+// Writes formatted message to a logger using varargs.
+// The message will be discarded if |severity| is less than the logger's
+// minimum log severity.
+// The |tag| may be NULL, in which case no additional tags are added to the
+// log message.
+// The |tag| will be truncated if it is longer than |FX_LOG_MAX_TAG_LEN|.
+// No message is written if |message| is NULL.
+zx_status_t fx_logger_logvf(fx_logger_t* logger, fx_log_severity_t severity,
+                            const char* tag, const char* msg, va_list args);
+
+// Writes a message to a logger.
+// The message will be discarded if |severity| is less than the logger's
+// minimum log severity.
+// The |tag| may be NULL, in which case no additional tags are added to the
+// log message.
+// The |tag| will be truncated if it is longer than |FX_LOG_MAX_TAG_LEN|.
+// No message is written if |message| is NULL.
+zx_status_t fx_logger_log(fx_logger_t* logger, fx_log_severity_t severity,
+                          const char* tag, const char* msg);
+
+__END_CDECLS
+
+#endif // LIB_SYSLOG_LOGGER_H_
diff --git a/pkg/syslog/include/lib/syslog/wire_format.h b/pkg/syslog/include/lib/syslog/wire_format.h
new file mode 100644
index 0000000..33dbff0
--- /dev/null
+++ b/pkg/syslog/include/lib/syslog/wire_format.h
@@ -0,0 +1,38 @@
+// 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 header file defines wire format to transfer logs to listening service.
+
+#ifndef LIB_SYSLOG_WIRE_FORMAT_H_
+#define LIB_SYSLOG_WIRE_FORMAT_H_
+
+#include <lib/syslog/logger.h>
+#include <zircon/types.h>
+
+// Defines max length for storing log_metadata, tags and msgbuffer.
+// TODO(anmittal): Increase it when zircon sockets are able to support a higher
+// buffer.
+#define FX_LOG_MAX_DATAGRAM_LEN (2032)
+
+typedef struct fx_log_metadata {
+    zx_koid_t pid;
+    zx_koid_t tid;
+    zx_time_t time;
+    fx_log_severity_t severity;
+
+    // Increment this field whenever there is a socket write error and client
+    // drops the log and send it with next log msg.
+    uint32_t dropped_logs;
+} fx_log_metadata_t;
+
+// Packet to transfer over socket.
+typedef struct fx_log_packet {
+    fx_log_metadata_t metadata;
+
+    // Contains concatenated tags and message and a null terminating character at
+    // the end.
+    char data[FX_LOG_MAX_DATAGRAM_LEN - sizeof(fx_log_metadata_t)];
+} fx_log_packet_t;
+
+#endif // LIB_SYSLOG_WIRE_FORMAT_H_
diff --git a/pkg/syslog/meta.json b/pkg/syslog/meta.json
new file mode 100644
index 0000000..e427a70
--- /dev/null
+++ b/pkg/syslog/meta.json
@@ -0,0 +1,27 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/ab/d169689a6ad6a1155ae97b4155fa92810bfdce.debug", 
+      "dist": "arch/arm64/dist/libsyslog.so", 
+      "link": "arch/arm64/lib/libsyslog.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/6c/dab7364d696b10a4fdeb1f6c64eac9c8f707f5.debug", 
+      "dist": "arch/x64/dist/libsyslog.so", 
+      "link": "arch/x64/lib/libsyslog.so"
+    }
+  }, 
+  "deps": [
+    "fdio"
+  ], 
+  "format": "shared", 
+  "headers": [
+    "pkg/syslog/include/lib/syslog/global.h", 
+    "pkg/syslog/include/lib/syslog/logger.h", 
+    "pkg/syslog/include/lib/syslog/wire_format.h"
+  ], 
+  "include_dir": "pkg/syslog/include", 
+  "name": "syslog", 
+  "root": "pkg/syslog", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/sysroot/meta.json b/pkg/sysroot/meta.json
new file mode 100644
index 0000000..3219922
--- /dev/null
+++ b/pkg/sysroot/meta.json
@@ -0,0 +1,539 @@
+{
+  "name": "sysroot", 
+  "root": "pkg/sysroot", 
+  "type": "sysroot", 
+  "versions": {
+    "arm64": {
+      "debug_libs": [
+        "arch/arm64/sysroot/debug/libc.so", 
+        "arch/arm64/sysroot/debug/libzircon.so"
+      ], 
+      "dist_libs": [
+        "arch/arm64/sysroot/dist/lib/ld.so.1"
+      ], 
+      "headers": [
+        "arch/arm64/sysroot/include/alloca.h", 
+        "arch/arm64/sysroot/include/ar.h", 
+        "arch/arm64/sysroot/include/arpa/ftp.h", 
+        "arch/arm64/sysroot/include/arpa/inet.h", 
+        "arch/arm64/sysroot/include/arpa/nameser.h", 
+        "arch/arm64/sysroot/include/arpa/nameser_compat.h", 
+        "arch/arm64/sysroot/include/arpa/telnet.h", 
+        "arch/arm64/sysroot/include/arpa/tftp.h", 
+        "arch/arm64/sysroot/include/assert.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/endian.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/fenv.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/float.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/io.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/ioctl.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/ipc.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/reg.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/setjmp.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/signal.h", 
+        "arch/arm64/sysroot/include/bits/aarch64/stat.h", 
+        "arch/arm64/sysroot/include/bits/alltypes.h", 
+        "arch/arm64/sysroot/include/bits/endian.h", 
+        "arch/arm64/sysroot/include/bits/errno.h", 
+        "arch/arm64/sysroot/include/bits/fcntl.h", 
+        "arch/arm64/sysroot/include/bits/fenv.h", 
+        "arch/arm64/sysroot/include/bits/float.h", 
+        "arch/arm64/sysroot/include/bits/io.h", 
+        "arch/arm64/sysroot/include/bits/ioctl.h", 
+        "arch/arm64/sysroot/include/bits/ipc.h", 
+        "arch/arm64/sysroot/include/bits/limits.h", 
+        "arch/arm64/sysroot/include/bits/msg.h", 
+        "arch/arm64/sysroot/include/bits/null.h", 
+        "arch/arm64/sysroot/include/bits/poll.h", 
+        "arch/arm64/sysroot/include/bits/posix.h", 
+        "arch/arm64/sysroot/include/bits/reg.h", 
+        "arch/arm64/sysroot/include/bits/resource.h", 
+        "arch/arm64/sysroot/include/bits/sem.h", 
+        "arch/arm64/sysroot/include/bits/setjmp.h", 
+        "arch/arm64/sysroot/include/bits/shm.h", 
+        "arch/arm64/sysroot/include/bits/signal.h", 
+        "arch/arm64/sysroot/include/bits/socket.h", 
+        "arch/arm64/sysroot/include/bits/stat.h", 
+        "arch/arm64/sysroot/include/bits/statfs.h", 
+        "arch/arm64/sysroot/include/bits/termios.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/endian.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/fenv.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/float.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/io.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/ioctl.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/ipc.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/reg.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/setjmp.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/signal.h", 
+        "arch/arm64/sysroot/include/bits/x86_64/stat.h", 
+        "arch/arm64/sysroot/include/byteswap.h", 
+        "arch/arm64/sysroot/include/complex.h", 
+        "arch/arm64/sysroot/include/cpio.h", 
+        "arch/arm64/sysroot/include/crypt.h", 
+        "arch/arm64/sysroot/include/ctype.h", 
+        "arch/arm64/sysroot/include/dirent.h", 
+        "arch/arm64/sysroot/include/dlfcn.h", 
+        "arch/arm64/sysroot/include/elf.h", 
+        "arch/arm64/sysroot/include/endian.h", 
+        "arch/arm64/sysroot/include/err.h", 
+        "arch/arm64/sysroot/include/errno.h", 
+        "arch/arm64/sysroot/include/fcntl.h", 
+        "arch/arm64/sysroot/include/features.h", 
+        "arch/arm64/sysroot/include/fenv.h", 
+        "arch/arm64/sysroot/include/float.h", 
+        "arch/arm64/sysroot/include/fmtmsg.h", 
+        "arch/arm64/sysroot/include/fnmatch.h", 
+        "arch/arm64/sysroot/include/ftw.h", 
+        "arch/arm64/sysroot/include/getopt.h", 
+        "arch/arm64/sysroot/include/glob.h", 
+        "arch/arm64/sysroot/include/grp.h", 
+        "arch/arm64/sysroot/include/iconv.h", 
+        "arch/arm64/sysroot/include/ifaddrs.h", 
+        "arch/arm64/sysroot/include/inttypes.h", 
+        "arch/arm64/sysroot/include/iso646.h", 
+        "arch/arm64/sysroot/include/langinfo.h", 
+        "arch/arm64/sysroot/include/libgen.h", 
+        "arch/arm64/sysroot/include/limits.h", 
+        "arch/arm64/sysroot/include/link.h", 
+        "arch/arm64/sysroot/include/locale.h", 
+        "arch/arm64/sysroot/include/malloc.h", 
+        "arch/arm64/sysroot/include/math.h", 
+        "arch/arm64/sysroot/include/memory.h", 
+        "arch/arm64/sysroot/include/monetary.h", 
+        "arch/arm64/sysroot/include/net/ethernet.h", 
+        "arch/arm64/sysroot/include/net/if.h", 
+        "arch/arm64/sysroot/include/net/if_arp.h", 
+        "arch/arm64/sysroot/include/net/route.h", 
+        "arch/arm64/sysroot/include/netdb.h", 
+        "arch/arm64/sysroot/include/netinet/ether.h", 
+        "arch/arm64/sysroot/include/netinet/icmp6.h", 
+        "arch/arm64/sysroot/include/netinet/if_ether.h", 
+        "arch/arm64/sysroot/include/netinet/igmp.h", 
+        "arch/arm64/sysroot/include/netinet/in.h", 
+        "arch/arm64/sysroot/include/netinet/in_systm.h", 
+        "arch/arm64/sysroot/include/netinet/ip.h", 
+        "arch/arm64/sysroot/include/netinet/ip6.h", 
+        "arch/arm64/sysroot/include/netinet/ip_icmp.h", 
+        "arch/arm64/sysroot/include/netinet/tcp.h", 
+        "arch/arm64/sysroot/include/netinet/udp.h", 
+        "arch/arm64/sysroot/include/netpacket/packet.h", 
+        "arch/arm64/sysroot/include/nl_types.h", 
+        "arch/arm64/sysroot/include/paths.h", 
+        "arch/arm64/sysroot/include/poll.h", 
+        "arch/arm64/sysroot/include/pthread.h", 
+        "arch/arm64/sysroot/include/pty.h", 
+        "arch/arm64/sysroot/include/pwd.h", 
+        "arch/arm64/sysroot/include/regex.h", 
+        "arch/arm64/sysroot/include/resolv.h", 
+        "arch/arm64/sysroot/include/sched.h", 
+        "arch/arm64/sysroot/include/search.h", 
+        "arch/arm64/sysroot/include/semaphore.h", 
+        "arch/arm64/sysroot/include/setjmp.h", 
+        "arch/arm64/sysroot/include/signal.h", 
+        "arch/arm64/sysroot/include/spawn.h", 
+        "arch/arm64/sysroot/include/stdio.h", 
+        "arch/arm64/sysroot/include/stdlib.h", 
+        "arch/arm64/sysroot/include/stdnoreturn.h", 
+        "arch/arm64/sysroot/include/string.h", 
+        "arch/arm64/sysroot/include/strings.h", 
+        "arch/arm64/sysroot/include/stropts.h", 
+        "arch/arm64/sysroot/include/sys/acct.h", 
+        "arch/arm64/sysroot/include/sys/auxv.h", 
+        "arch/arm64/sysroot/include/sys/dir.h", 
+        "arch/arm64/sysroot/include/sys/errno.h", 
+        "arch/arm64/sysroot/include/sys/eventfd.h", 
+        "arch/arm64/sysroot/include/sys/fcntl.h", 
+        "arch/arm64/sysroot/include/sys/file.h", 
+        "arch/arm64/sysroot/include/sys/fsuid.h", 
+        "arch/arm64/sysroot/include/sys/io.h", 
+        "arch/arm64/sysroot/include/sys/ioctl.h", 
+        "arch/arm64/sysroot/include/sys/ipc.h", 
+        "arch/arm64/sysroot/include/sys/klog.h", 
+        "arch/arm64/sysroot/include/sys/mman.h", 
+        "arch/arm64/sysroot/include/sys/mount.h", 
+        "arch/arm64/sysroot/include/sys/msg.h", 
+        "arch/arm64/sysroot/include/sys/mtio.h", 
+        "arch/arm64/sysroot/include/sys/param.h", 
+        "arch/arm64/sysroot/include/sys/personality.h", 
+        "arch/arm64/sysroot/include/sys/poll.h", 
+        "arch/arm64/sysroot/include/sys/quota.h", 
+        "arch/arm64/sysroot/include/sys/random.h", 
+        "arch/arm64/sysroot/include/sys/reboot.h", 
+        "arch/arm64/sysroot/include/sys/reg.h", 
+        "arch/arm64/sysroot/include/sys/select.h", 
+        "arch/arm64/sysroot/include/sys/sem.h", 
+        "arch/arm64/sysroot/include/sys/sendfile.h", 
+        "arch/arm64/sysroot/include/sys/shm.h", 
+        "arch/arm64/sysroot/include/sys/signal.h", 
+        "arch/arm64/sysroot/include/sys/signalfd.h", 
+        "arch/arm64/sysroot/include/sys/socket.h", 
+        "arch/arm64/sysroot/include/sys/stat.h", 
+        "arch/arm64/sysroot/include/sys/statfs.h", 
+        "arch/arm64/sysroot/include/sys/statvfs.h", 
+        "arch/arm64/sysroot/include/sys/stropts.h", 
+        "arch/arm64/sysroot/include/sys/swap.h", 
+        "arch/arm64/sysroot/include/sys/syslog.h", 
+        "arch/arm64/sysroot/include/sys/termios.h", 
+        "arch/arm64/sysroot/include/sys/time.h", 
+        "arch/arm64/sysroot/include/sys/timeb.h", 
+        "arch/arm64/sysroot/include/sys/timerfd.h", 
+        "arch/arm64/sysroot/include/sys/times.h", 
+        "arch/arm64/sysroot/include/sys/timex.h", 
+        "arch/arm64/sysroot/include/sys/ttydefaults.h", 
+        "arch/arm64/sysroot/include/sys/types.h", 
+        "arch/arm64/sysroot/include/sys/ucontext.h", 
+        "arch/arm64/sysroot/include/sys/uio.h", 
+        "arch/arm64/sysroot/include/sys/un.h", 
+        "arch/arm64/sysroot/include/sys/utsname.h", 
+        "arch/arm64/sysroot/include/sys/vfs.h", 
+        "arch/arm64/sysroot/include/sys/wait.h", 
+        "arch/arm64/sysroot/include/sysexits.h", 
+        "arch/arm64/sysroot/include/syslog.h", 
+        "arch/arm64/sysroot/include/tar.h", 
+        "arch/arm64/sysroot/include/termios.h", 
+        "arch/arm64/sysroot/include/threads.h", 
+        "arch/arm64/sysroot/include/time.h", 
+        "arch/arm64/sysroot/include/uchar.h", 
+        "arch/arm64/sysroot/include/ucontext.h", 
+        "arch/arm64/sysroot/include/unistd.h", 
+        "arch/arm64/sysroot/include/utime.h", 
+        "arch/arm64/sysroot/include/values.h", 
+        "arch/arm64/sysroot/include/wait.h", 
+        "arch/arm64/sysroot/include/wchar.h", 
+        "arch/arm64/sysroot/include/wctype.h", 
+        "arch/arm64/sysroot/include/wordexp.h", 
+        "arch/arm64/sysroot/include/zircon/assert.h", 
+        "arch/arm64/sysroot/include/zircon/boot/bootdata.h", 
+        "arch/arm64/sysroot/include/zircon/boot/driver-config.h", 
+        "arch/arm64/sysroot/include/zircon/boot/e820.h", 
+        "arch/arm64/sysroot/include/zircon/boot/image.h", 
+        "arch/arm64/sysroot/include/zircon/boot/multiboot.h", 
+        "arch/arm64/sysroot/include/zircon/boot/netboot.h", 
+        "arch/arm64/sysroot/include/zircon/boot/sysconfig.h", 
+        "arch/arm64/sysroot/include/zircon/compiler.h", 
+        "arch/arm64/sysroot/include/zircon/device/ioctl-wrapper.h", 
+        "arch/arm64/sysroot/include/zircon/device/ioctl.h", 
+        "arch/arm64/sysroot/include/zircon/device/ramdisk.h", 
+        "arch/arm64/sysroot/include/zircon/dlfcn.h", 
+        "arch/arm64/sysroot/include/zircon/driver/binding.h", 
+        "arch/arm64/sysroot/include/zircon/errors.h", 
+        "arch/arm64/sysroot/include/zircon/features.h", 
+        "arch/arm64/sysroot/include/zircon/fidl.h", 
+        "arch/arm64/sysroot/include/zircon/hw/gpt.h", 
+        "arch/arm64/sysroot/include/zircon/hw/i2c.h", 
+        "arch/arm64/sysroot/include/zircon/hw/pci.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb-audio.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb-cdc.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb-hid.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb-hub.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb-mass-storage.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb-video.h", 
+        "arch/arm64/sysroot/include/zircon/hw/usb.h", 
+        "arch/arm64/sysroot/include/zircon/limits.h", 
+        "arch/arm64/sysroot/include/zircon/listnode.h", 
+        "arch/arm64/sysroot/include/zircon/pixelformat.h", 
+        "arch/arm64/sysroot/include/zircon/process.h", 
+        "arch/arm64/sysroot/include/zircon/processargs.h", 
+        "arch/arm64/sysroot/include/zircon/rights.h", 
+        "arch/arm64/sysroot/include/zircon/sanitizer.h", 
+        "arch/arm64/sysroot/include/zircon/status.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/debug.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/definitions.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/exception.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/hypervisor.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/iommu.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/log.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/object.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/pci.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/policy.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/port.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/profile.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/resource.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/smc.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/system.h", 
+        "arch/arm64/sysroot/include/zircon/syscalls/types.h", 
+        "arch/arm64/sysroot/include/zircon/threads.h", 
+        "arch/arm64/sysroot/include/zircon/time.h", 
+        "arch/arm64/sysroot/include/zircon/tls.h", 
+        "arch/arm64/sysroot/include/zircon/types.h"
+      ], 
+      "include_dir": "arch/arm64/sysroot/include", 
+      "link_libs": [
+        "arch/arm64/sysroot/lib/Scrt1.o", 
+        "arch/arm64/sysroot/lib/libc.so", 
+        "arch/arm64/sysroot/lib/libdl.so", 
+        "arch/arm64/sysroot/lib/libm.so", 
+        "arch/arm64/sysroot/lib/libpthread.so", 
+        "arch/arm64/sysroot/lib/librt.so", 
+        "arch/arm64/sysroot/lib/libzircon.so"
+      ], 
+      "root": "arch/arm64/sysroot"
+    }, 
+    "x64": {
+      "debug_libs": [
+        "arch/x64/sysroot/debug/libc.so", 
+        "arch/x64/sysroot/debug/libzircon.so"
+      ], 
+      "dist_libs": [
+        "arch/x64/sysroot/dist/lib/ld.so.1"
+      ], 
+      "headers": [
+        "arch/x64/sysroot/include/alloca.h", 
+        "arch/x64/sysroot/include/ar.h", 
+        "arch/x64/sysroot/include/arpa/ftp.h", 
+        "arch/x64/sysroot/include/arpa/inet.h", 
+        "arch/x64/sysroot/include/arpa/nameser.h", 
+        "arch/x64/sysroot/include/arpa/nameser_compat.h", 
+        "arch/x64/sysroot/include/arpa/telnet.h", 
+        "arch/x64/sysroot/include/arpa/tftp.h", 
+        "arch/x64/sysroot/include/assert.h", 
+        "arch/x64/sysroot/include/bits/aarch64/endian.h", 
+        "arch/x64/sysroot/include/bits/aarch64/fenv.h", 
+        "arch/x64/sysroot/include/bits/aarch64/float.h", 
+        "arch/x64/sysroot/include/bits/aarch64/io.h", 
+        "arch/x64/sysroot/include/bits/aarch64/ioctl.h", 
+        "arch/x64/sysroot/include/bits/aarch64/ipc.h", 
+        "arch/x64/sysroot/include/bits/aarch64/reg.h", 
+        "arch/x64/sysroot/include/bits/aarch64/setjmp.h", 
+        "arch/x64/sysroot/include/bits/aarch64/signal.h", 
+        "arch/x64/sysroot/include/bits/aarch64/stat.h", 
+        "arch/x64/sysroot/include/bits/alltypes.h", 
+        "arch/x64/sysroot/include/bits/endian.h", 
+        "arch/x64/sysroot/include/bits/errno.h", 
+        "arch/x64/sysroot/include/bits/fcntl.h", 
+        "arch/x64/sysroot/include/bits/fenv.h", 
+        "arch/x64/sysroot/include/bits/float.h", 
+        "arch/x64/sysroot/include/bits/io.h", 
+        "arch/x64/sysroot/include/bits/ioctl.h", 
+        "arch/x64/sysroot/include/bits/ipc.h", 
+        "arch/x64/sysroot/include/bits/limits.h", 
+        "arch/x64/sysroot/include/bits/msg.h", 
+        "arch/x64/sysroot/include/bits/null.h", 
+        "arch/x64/sysroot/include/bits/poll.h", 
+        "arch/x64/sysroot/include/bits/posix.h", 
+        "arch/x64/sysroot/include/bits/reg.h", 
+        "arch/x64/sysroot/include/bits/resource.h", 
+        "arch/x64/sysroot/include/bits/sem.h", 
+        "arch/x64/sysroot/include/bits/setjmp.h", 
+        "arch/x64/sysroot/include/bits/shm.h", 
+        "arch/x64/sysroot/include/bits/signal.h", 
+        "arch/x64/sysroot/include/bits/socket.h", 
+        "arch/x64/sysroot/include/bits/stat.h", 
+        "arch/x64/sysroot/include/bits/statfs.h", 
+        "arch/x64/sysroot/include/bits/termios.h", 
+        "arch/x64/sysroot/include/bits/x86_64/endian.h", 
+        "arch/x64/sysroot/include/bits/x86_64/fenv.h", 
+        "arch/x64/sysroot/include/bits/x86_64/float.h", 
+        "arch/x64/sysroot/include/bits/x86_64/io.h", 
+        "arch/x64/sysroot/include/bits/x86_64/ioctl.h", 
+        "arch/x64/sysroot/include/bits/x86_64/ipc.h", 
+        "arch/x64/sysroot/include/bits/x86_64/reg.h", 
+        "arch/x64/sysroot/include/bits/x86_64/setjmp.h", 
+        "arch/x64/sysroot/include/bits/x86_64/signal.h", 
+        "arch/x64/sysroot/include/bits/x86_64/stat.h", 
+        "arch/x64/sysroot/include/byteswap.h", 
+        "arch/x64/sysroot/include/complex.h", 
+        "arch/x64/sysroot/include/cpio.h", 
+        "arch/x64/sysroot/include/crypt.h", 
+        "arch/x64/sysroot/include/ctype.h", 
+        "arch/x64/sysroot/include/dirent.h", 
+        "arch/x64/sysroot/include/dlfcn.h", 
+        "arch/x64/sysroot/include/elf.h", 
+        "arch/x64/sysroot/include/endian.h", 
+        "arch/x64/sysroot/include/err.h", 
+        "arch/x64/sysroot/include/errno.h", 
+        "arch/x64/sysroot/include/fcntl.h", 
+        "arch/x64/sysroot/include/features.h", 
+        "arch/x64/sysroot/include/fenv.h", 
+        "arch/x64/sysroot/include/float.h", 
+        "arch/x64/sysroot/include/fmtmsg.h", 
+        "arch/x64/sysroot/include/fnmatch.h", 
+        "arch/x64/sysroot/include/ftw.h", 
+        "arch/x64/sysroot/include/getopt.h", 
+        "arch/x64/sysroot/include/glob.h", 
+        "arch/x64/sysroot/include/grp.h", 
+        "arch/x64/sysroot/include/iconv.h", 
+        "arch/x64/sysroot/include/ifaddrs.h", 
+        "arch/x64/sysroot/include/inttypes.h", 
+        "arch/x64/sysroot/include/iso646.h", 
+        "arch/x64/sysroot/include/langinfo.h", 
+        "arch/x64/sysroot/include/libgen.h", 
+        "arch/x64/sysroot/include/limits.h", 
+        "arch/x64/sysroot/include/link.h", 
+        "arch/x64/sysroot/include/locale.h", 
+        "arch/x64/sysroot/include/malloc.h", 
+        "arch/x64/sysroot/include/math.h", 
+        "arch/x64/sysroot/include/memory.h", 
+        "arch/x64/sysroot/include/monetary.h", 
+        "arch/x64/sysroot/include/net/ethernet.h", 
+        "arch/x64/sysroot/include/net/if.h", 
+        "arch/x64/sysroot/include/net/if_arp.h", 
+        "arch/x64/sysroot/include/net/route.h", 
+        "arch/x64/sysroot/include/netdb.h", 
+        "arch/x64/sysroot/include/netinet/ether.h", 
+        "arch/x64/sysroot/include/netinet/icmp6.h", 
+        "arch/x64/sysroot/include/netinet/if_ether.h", 
+        "arch/x64/sysroot/include/netinet/igmp.h", 
+        "arch/x64/sysroot/include/netinet/in.h", 
+        "arch/x64/sysroot/include/netinet/in_systm.h", 
+        "arch/x64/sysroot/include/netinet/ip.h", 
+        "arch/x64/sysroot/include/netinet/ip6.h", 
+        "arch/x64/sysroot/include/netinet/ip_icmp.h", 
+        "arch/x64/sysroot/include/netinet/tcp.h", 
+        "arch/x64/sysroot/include/netinet/udp.h", 
+        "arch/x64/sysroot/include/netpacket/packet.h", 
+        "arch/x64/sysroot/include/nl_types.h", 
+        "arch/x64/sysroot/include/paths.h", 
+        "arch/x64/sysroot/include/poll.h", 
+        "arch/x64/sysroot/include/pthread.h", 
+        "arch/x64/sysroot/include/pty.h", 
+        "arch/x64/sysroot/include/pwd.h", 
+        "arch/x64/sysroot/include/regex.h", 
+        "arch/x64/sysroot/include/resolv.h", 
+        "arch/x64/sysroot/include/sched.h", 
+        "arch/x64/sysroot/include/search.h", 
+        "arch/x64/sysroot/include/semaphore.h", 
+        "arch/x64/sysroot/include/setjmp.h", 
+        "arch/x64/sysroot/include/signal.h", 
+        "arch/x64/sysroot/include/spawn.h", 
+        "arch/x64/sysroot/include/stdio.h", 
+        "arch/x64/sysroot/include/stdlib.h", 
+        "arch/x64/sysroot/include/stdnoreturn.h", 
+        "arch/x64/sysroot/include/string.h", 
+        "arch/x64/sysroot/include/strings.h", 
+        "arch/x64/sysroot/include/stropts.h", 
+        "arch/x64/sysroot/include/sys/acct.h", 
+        "arch/x64/sysroot/include/sys/auxv.h", 
+        "arch/x64/sysroot/include/sys/dir.h", 
+        "arch/x64/sysroot/include/sys/errno.h", 
+        "arch/x64/sysroot/include/sys/eventfd.h", 
+        "arch/x64/sysroot/include/sys/fcntl.h", 
+        "arch/x64/sysroot/include/sys/file.h", 
+        "arch/x64/sysroot/include/sys/fsuid.h", 
+        "arch/x64/sysroot/include/sys/io.h", 
+        "arch/x64/sysroot/include/sys/ioctl.h", 
+        "arch/x64/sysroot/include/sys/ipc.h", 
+        "arch/x64/sysroot/include/sys/klog.h", 
+        "arch/x64/sysroot/include/sys/mman.h", 
+        "arch/x64/sysroot/include/sys/mount.h", 
+        "arch/x64/sysroot/include/sys/msg.h", 
+        "arch/x64/sysroot/include/sys/mtio.h", 
+        "arch/x64/sysroot/include/sys/param.h", 
+        "arch/x64/sysroot/include/sys/personality.h", 
+        "arch/x64/sysroot/include/sys/poll.h", 
+        "arch/x64/sysroot/include/sys/quota.h", 
+        "arch/x64/sysroot/include/sys/random.h", 
+        "arch/x64/sysroot/include/sys/reboot.h", 
+        "arch/x64/sysroot/include/sys/reg.h", 
+        "arch/x64/sysroot/include/sys/select.h", 
+        "arch/x64/sysroot/include/sys/sem.h", 
+        "arch/x64/sysroot/include/sys/sendfile.h", 
+        "arch/x64/sysroot/include/sys/shm.h", 
+        "arch/x64/sysroot/include/sys/signal.h", 
+        "arch/x64/sysroot/include/sys/signalfd.h", 
+        "arch/x64/sysroot/include/sys/socket.h", 
+        "arch/x64/sysroot/include/sys/stat.h", 
+        "arch/x64/sysroot/include/sys/statfs.h", 
+        "arch/x64/sysroot/include/sys/statvfs.h", 
+        "arch/x64/sysroot/include/sys/stropts.h", 
+        "arch/x64/sysroot/include/sys/swap.h", 
+        "arch/x64/sysroot/include/sys/syslog.h", 
+        "arch/x64/sysroot/include/sys/termios.h", 
+        "arch/x64/sysroot/include/sys/time.h", 
+        "arch/x64/sysroot/include/sys/timeb.h", 
+        "arch/x64/sysroot/include/sys/timerfd.h", 
+        "arch/x64/sysroot/include/sys/times.h", 
+        "arch/x64/sysroot/include/sys/timex.h", 
+        "arch/x64/sysroot/include/sys/ttydefaults.h", 
+        "arch/x64/sysroot/include/sys/types.h", 
+        "arch/x64/sysroot/include/sys/ucontext.h", 
+        "arch/x64/sysroot/include/sys/uio.h", 
+        "arch/x64/sysroot/include/sys/un.h", 
+        "arch/x64/sysroot/include/sys/utsname.h", 
+        "arch/x64/sysroot/include/sys/vfs.h", 
+        "arch/x64/sysroot/include/sys/wait.h", 
+        "arch/x64/sysroot/include/sysexits.h", 
+        "arch/x64/sysroot/include/syslog.h", 
+        "arch/x64/sysroot/include/tar.h", 
+        "arch/x64/sysroot/include/termios.h", 
+        "arch/x64/sysroot/include/threads.h", 
+        "arch/x64/sysroot/include/time.h", 
+        "arch/x64/sysroot/include/uchar.h", 
+        "arch/x64/sysroot/include/ucontext.h", 
+        "arch/x64/sysroot/include/unistd.h", 
+        "arch/x64/sysroot/include/utime.h", 
+        "arch/x64/sysroot/include/values.h", 
+        "arch/x64/sysroot/include/wait.h", 
+        "arch/x64/sysroot/include/wchar.h", 
+        "arch/x64/sysroot/include/wctype.h", 
+        "arch/x64/sysroot/include/wordexp.h", 
+        "arch/x64/sysroot/include/zircon/assert.h", 
+        "arch/x64/sysroot/include/zircon/boot/bootdata.h", 
+        "arch/x64/sysroot/include/zircon/boot/driver-config.h", 
+        "arch/x64/sysroot/include/zircon/boot/e820.h", 
+        "arch/x64/sysroot/include/zircon/boot/image.h", 
+        "arch/x64/sysroot/include/zircon/boot/multiboot.h", 
+        "arch/x64/sysroot/include/zircon/boot/netboot.h", 
+        "arch/x64/sysroot/include/zircon/boot/sysconfig.h", 
+        "arch/x64/sysroot/include/zircon/compiler.h", 
+        "arch/x64/sysroot/include/zircon/device/ioctl-wrapper.h", 
+        "arch/x64/sysroot/include/zircon/device/ioctl.h", 
+        "arch/x64/sysroot/include/zircon/device/ramdisk.h", 
+        "arch/x64/sysroot/include/zircon/dlfcn.h", 
+        "arch/x64/sysroot/include/zircon/driver/binding.h", 
+        "arch/x64/sysroot/include/zircon/errors.h", 
+        "arch/x64/sysroot/include/zircon/features.h", 
+        "arch/x64/sysroot/include/zircon/fidl.h", 
+        "arch/x64/sysroot/include/zircon/hw/gpt.h", 
+        "arch/x64/sysroot/include/zircon/hw/i2c.h", 
+        "arch/x64/sysroot/include/zircon/hw/pci.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb-audio.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb-cdc.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb-hid.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb-hub.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb-mass-storage.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb-video.h", 
+        "arch/x64/sysroot/include/zircon/hw/usb.h", 
+        "arch/x64/sysroot/include/zircon/limits.h", 
+        "arch/x64/sysroot/include/zircon/listnode.h", 
+        "arch/x64/sysroot/include/zircon/pixelformat.h", 
+        "arch/x64/sysroot/include/zircon/process.h", 
+        "arch/x64/sysroot/include/zircon/processargs.h", 
+        "arch/x64/sysroot/include/zircon/rights.h", 
+        "arch/x64/sysroot/include/zircon/sanitizer.h", 
+        "arch/x64/sysroot/include/zircon/status.h", 
+        "arch/x64/sysroot/include/zircon/syscalls.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/debug.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/definitions.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/exception.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/hypervisor.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/iommu.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/log.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/object.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/pci.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/policy.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/port.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/profile.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/resource.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/smc.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/system.h", 
+        "arch/x64/sysroot/include/zircon/syscalls/types.h", 
+        "arch/x64/sysroot/include/zircon/threads.h", 
+        "arch/x64/sysroot/include/zircon/time.h", 
+        "arch/x64/sysroot/include/zircon/tls.h", 
+        "arch/x64/sysroot/include/zircon/types.h"
+      ], 
+      "include_dir": "arch/x64/sysroot/include", 
+      "link_libs": [
+        "arch/x64/sysroot/lib/Scrt1.o", 
+        "arch/x64/sysroot/lib/libc.so", 
+        "arch/x64/sysroot/lib/libdl.so", 
+        "arch/x64/sysroot/lib/libm.so", 
+        "arch/x64/sysroot/lib/libpthread.so", 
+        "arch/x64/sysroot/lib/librt.so", 
+        "arch/x64/sysroot/lib/libzircon.so"
+      ], 
+      "root": "arch/x64/sysroot"
+    }
+  }
+}
\ No newline at end of file
diff --git a/pkg/trace-engine/meta.json b/pkg/trace-engine/meta.json
new file mode 100644
index 0000000..8856e4e
--- /dev/null
+++ b/pkg/trace-engine/meta.json
@@ -0,0 +1,21 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/e7/2a14a0b645f41576a9d25e89239df92cd488d0.debug", 
+      "dist": "arch/arm64/dist/libtrace-engine.so", 
+      "link": "arch/arm64/lib/libtrace-engine.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/db/dab49d734285639cadc0b2eb151b302ecb2edf.debug", 
+      "dist": "arch/x64/dist/libtrace-engine.so", 
+      "link": "arch/x64/lib/libtrace-engine.so"
+    }
+  }, 
+  "deps": [], 
+  "format": "shared", 
+  "headers": [], 
+  "include_dir": "pkg/trace-engine/include", 
+  "name": "trace-engine", 
+  "root": "pkg/trace-engine", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/vulkan/meta.json b/pkg/vulkan/meta.json
new file mode 100644
index 0000000..440ecf0
--- /dev/null
+++ b/pkg/vulkan/meta.json
@@ -0,0 +1,24 @@
+{
+  "binaries": {
+    "arm64": {
+      "debug": ".build-id/13/1673e529cae5f1.debug", 
+      "dist": "arch/arm64/dist/libvulkan.so", 
+      "link": "arch/arm64/lib/libvulkan.so"
+    }, 
+    "x64": {
+      "debug": ".build-id/72/f8518d550ec0aa.debug", 
+      "dist": "arch/x64/dist/libvulkan.so", 
+      "link": "arch/x64/lib/libvulkan.so"
+    }
+  }, 
+  "deps": [
+    "fdio", 
+    "trace-engine"
+  ], 
+  "format": "shared", 
+  "headers": [], 
+  "include_dir": "pkg/vulkan/include", 
+  "name": "vulkan", 
+  "root": "pkg/vulkan", 
+  "type": "cc_prebuilt_library"
+}
\ No newline at end of file
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_core_validation.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_core_validation.json
new file mode 100644
index 0000000..94887e6
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_core_validation.json
@@ -0,0 +1,43 @@
+{
+    "file_format_version" : "1.1.0",
+    "layer" : {
+        "name": "VK_LAYER_LUNARG_core_validation",
+        "type": "GLOBAL",
+        "library_path": "libVkLayer_core_validation.so",
+        "api_version": "1.0.68",
+        "implementation_version": "1",
+        "description": "LunarG Validation Layer",
+        "instance_extensions": [
+             {
+                 "name": "VK_EXT_debug_report",
+                 "spec_version": "6"
+             }
+         ],
+        "device_extensions": [
+             {
+                 "name": "VK_EXT_debug_marker",
+                 "spec_version": "4",
+                 "entrypoints": ["vkDebugMarkerSetObjectTagEXT",
+                        "vkDebugMarkerSetObjectNameEXT",
+                        "vkCmdDebugMarkerBeginEXT",
+                        "vkCmdDebugMarkerEndEXT",
+                        "vkCmdDebugMarkerInsertEXT"
+                       ]
+             },
+             {
+                 "name": "VK_EXT_validation_cache",
+                 "spec_version": "1",
+                 "entrypoints": ["vkCreateValidationCacheEXT",
+                         "vkDestroyValidationCacheEXT",
+                         "vkGetValidationCacheDataEXT",
+                         "vkMergeValidationCachesEXT"
+                        ]
+             }
+         ]
+    }
+}
+
+
+
+
+
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_image_pipe_swapchain.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_image_pipe_swapchain.json
new file mode 100644
index 0000000..7c6ebe6
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_image_pipe_swapchain.json
@@ -0,0 +1,21 @@
+{
+    "file_format_version" : "1.0.0",
+    "layer" : {
+        "name": "VK_LAYER_GOOGLE_image_pipe_swapchain",
+        "type": "GLOBAL",
+        "library_path": "libVkLayer_image_pipe_swapchain.so",
+        "api_version": "1.0.38",
+        "implementation_version": "1",
+        "description": "Image Pipe Swapchain",
+        "disable_environment": {
+            "DISABLE_IMAGEPIPE_SWAPCHAIN_LAYER": "1"
+        },
+        "instance_extensions": [
+            { "name": "VK_KHR_surface", "spec_version": "25" },
+            { "name": "VK_KHR_magma_surface", "spec_version": "1" }
+        ],
+        "device_extensions": [
+            { "name": "VK_KHR_swapchain", "spec_version": "68" }
+        ]
+    }
+}
\ No newline at end of file
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_object_tracker.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_object_tracker.json
new file mode 100644
index 0000000..3da8c58
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_object_tracker.json
@@ -0,0 +1,29 @@
+{
+    "file_format_version" : "1.1.0",
+    "layer" : {
+        "name": "VK_LAYER_LUNARG_object_tracker",
+        "type": "GLOBAL",
+        "library_path": "libVkLayer_object_tracker.so",
+        "api_version": "1.0.68",
+        "implementation_version": "1",
+        "description": "LunarG Validation Layer",
+        "instance_extensions": [
+             {
+                 "name": "VK_EXT_debug_report",
+                 "spec_version": "6"
+             }
+         ],
+        "device_extensions": [
+             {
+                 "name": "VK_EXT_debug_marker",
+                 "spec_version": "4",
+                 "entrypoints": ["vkDebugMarkerSetObjectTagEXT",
+                        "vkDebugMarkerSetObjectNameEXT",
+                        "vkCmdDebugMarkerBeginEXT",
+                        "vkCmdDebugMarkerEndEXT",
+                        "vkCmdDebugMarkerInsertEXT"
+                       ]
+             }
+         ]
+    }
+}
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_parameter_validation.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_parameter_validation.json
new file mode 100644
index 0000000..83018ed
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_parameter_validation.json
@@ -0,0 +1,29 @@
+{
+    "file_format_version" : "1.1.0",
+    "layer" : {
+        "name": "VK_LAYER_LUNARG_parameter_validation",
+        "type": "GLOBAL",
+        "library_path": "libVkLayer_parameter_validation.so",
+        "api_version": "1.0.68",
+        "implementation_version": "1",
+        "description": "LunarG Validation Layer",
+        "instance_extensions": [
+             {
+                 "name": "VK_EXT_debug_report",
+                 "spec_version": "6"
+             }
+         ],
+        "device_extensions": [
+             {
+                 "name": "VK_EXT_debug_marker",
+                 "spec_version": "4",
+                 "entrypoints": ["vkDebugMarkerSetObjectTagEXT",
+                        "vkDebugMarkerSetObjectNameEXT",
+                        "vkCmdDebugMarkerBeginEXT",
+                        "vkCmdDebugMarkerEndEXT",
+                        "vkCmdDebugMarkerInsertEXT"
+                       ]
+             }
+         ]
+    }
+}
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_standard_validation.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_standard_validation.json
new file mode 100644
index 0000000..ccf4189
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_standard_validation.json
@@ -0,0 +1,17 @@
+{
+    "file_format_version": "1.1.1",
+    "layer": {
+        "name": "VK_LAYER_LUNARG_standard_validation",
+        "type": "GLOBAL",
+        "api_version": "1.0.68",
+        "implementation_version": "1",
+        "description": "LunarG Standard Validation",
+        "component_layers": [
+            "VK_LAYER_GOOGLE_threading",
+            "VK_LAYER_LUNARG_parameter_validation",
+            "VK_LAYER_LUNARG_object_tracker",
+            "VK_LAYER_LUNARG_core_validation",
+            "VK_LAYER_GOOGLE_unique_objects"
+        ]
+    }
+}
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_threading.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_threading.json
new file mode 100644
index 0000000..2e162b2
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_threading.json
@@ -0,0 +1,17 @@
+{
+    "file_format_version" : "1.1.0",
+    "layer" : {
+        "name": "VK_LAYER_GOOGLE_threading",
+        "type": "GLOBAL",
+        "library_path": "libVkLayer_threading.so",
+        "api_version": "1.0.68",
+        "implementation_version": "1",
+        "description": "Google Validation Layer",
+        "instance_extensions": [
+             {
+                 "name": "VK_EXT_debug_report",
+                 "spec_version": "6"
+             }
+         ]
+    }
+}
diff --git a/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_unique_objects.json b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_unique_objects.json
new file mode 100644
index 0000000..82ad4e7
--- /dev/null
+++ b/pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_unique_objects.json
@@ -0,0 +1,11 @@
+{
+    "file_format_version" : "1.1.0",
+    "layer" : {
+        "name": "VK_LAYER_GOOGLE_unique_objects",
+        "type": "GLOBAL",
+        "library_path": "libVkLayer_unique_objects.so",
+        "api_version": "1.0.68",
+        "implementation_version": "1",
+        "description": "Google Validation Layer"
+    }
+}
diff --git a/pkg/vulkan_layers/meta.json b/pkg/vulkan_layers/meta.json
new file mode 100644
index 0000000..f5355b7
--- /dev/null
+++ b/pkg/vulkan_layers/meta.json
@@ -0,0 +1,32 @@
+{
+  "binaries": {
+    "arm64": [
+      "arch/arm64/dist/libVkLayer_core_validation.so", 
+      "arch/arm64/dist/libVkLayer_threading.so", 
+      "arch/arm64/dist/libVkLayer_unique_objects.so", 
+      "arch/arm64/dist/libVkLayer_parameter_validation.so", 
+      "arch/arm64/dist/libVkLayer_object_tracker.so", 
+      "arch/arm64/dist/libVkLayer_image_pipe_swapchain.so"
+    ], 
+    "x64": [
+      "arch/x64/dist/libVkLayer_core_validation.so", 
+      "arch/x64/dist/libVkLayer_threading.so", 
+      "arch/x64/dist/libVkLayer_unique_objects.so", 
+      "arch/x64/dist/libVkLayer_parameter_validation.so", 
+      "arch/x64/dist/libVkLayer_object_tracker.so", 
+      "arch/x64/dist/libVkLayer_image_pipe_swapchain.so"
+    ]
+  }, 
+  "name": "vulkan_layers", 
+  "resources": [
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_core_validation.json", 
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_parameter_validation.json", 
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_threading.json", 
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_unique_objects.json", 
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_object_tracker.json", 
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_standard_validation.json", 
+    "pkg/vulkan_layers/data/vulkan/explicit_layer.d/VkLayer_image_pipe_swapchain.json"
+  ], 
+  "root": "pkg/vulkan_layers", 
+  "type": "loadable_module"
+}
\ No newline at end of file
diff --git a/pkg/zx/bti.cpp b/pkg/zx/bti.cpp
new file mode 100644
index 0000000..436177d
--- /dev/null
+++ b/pkg/zx/bti.cpp
@@ -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.
+
+#include <lib/zx/bti.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t bti::create(const iommu& iommu, uint32_t options, uint64_t bti_id, bti* result) {
+    return zx_bti_create(iommu.get(), options, bti_id, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/channel.cpp b/pkg/zx/channel.cpp
new file mode 100644
index 0000000..bbf84bb
--- /dev/null
+++ b/pkg/zx/channel.cpp
@@ -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.
+
+#include <lib/zx/channel.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t channel::create(uint32_t flags, channel* endpoint0,
+                            channel* endpoint1) {
+    // Ensure aliasing of both out parameters to the same container
+    // has a well-defined result, and does not leak.
+    channel h0;
+    channel h1;
+    zx_status_t status = zx_channel_create(flags,
+                                           h0.reset_and_get_address(),
+                                           h1.reset_and_get_address());
+    endpoint0->reset(h0.release());
+    endpoint1->reset(h1.release());
+    return status;
+}
+
+} // namespace zx
diff --git a/pkg/zx/debuglog.cpp b/pkg/zx/debuglog.cpp
new file mode 100644
index 0000000..05ee86d
--- /dev/null
+++ b/pkg/zx/debuglog.cpp
@@ -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.
+
+#include <lib/zx/debuglog.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t debuglog::create(const resource& resource, uint32_t options, debuglog* result) {
+    return zx_debuglog_create(resource.get(), options, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/event.cpp b/pkg/zx/event.cpp
new file mode 100644
index 0000000..4539a68
--- /dev/null
+++ b/pkg/zx/event.cpp
@@ -0,0 +1,15 @@
+// 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.
+
+#include <lib/zx/event.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t event::create(uint32_t options, event* result) {
+    return zx_event_create(options, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/eventpair.cpp b/pkg/zx/eventpair.cpp
new file mode 100644
index 0000000..f561e14
--- /dev/null
+++ b/pkg/zx/eventpair.cpp
@@ -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.
+
+#include <lib/zx/eventpair.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t eventpair::create(uint32_t flags, eventpair* endpoint0,
+                              eventpair* endpoint1) {
+    // Ensure aliasing of both out parameters to the same container
+    // has a well-defined result, and does not leak.
+    eventpair h0;
+    eventpair h1;
+    zx_status_t status = zx_eventpair_create(
+        flags, h0.reset_and_get_address(),
+        h1.reset_and_get_address());
+    endpoint0->reset(h0.release());
+    endpoint1->reset(h1.release());
+    return status;
+}
+
+} // namespace zx
diff --git a/pkg/zx/fifo.cpp b/pkg/zx/fifo.cpp
new file mode 100644
index 0000000..27f965f
--- /dev/null
+++ b/pkg/zx/fifo.cpp
@@ -0,0 +1,25 @@
+// 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.
+
+#include <lib/zx/fifo.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t fifo::create(uint32_t elem_count, uint32_t elem_size,
+                         uint32_t options, fifo* out0, fifo* out1) {
+    // Ensure aliasing of both out parameters to the same container
+    // has a well-defined result, and does not leak.
+    fifo h0;
+    fifo h1;
+    zx_status_t status = zx_fifo_create(
+        elem_count, elem_size, options, h0.reset_and_get_address(),
+        h1.reset_and_get_address());
+    out0->reset(h0.release());
+    out1->reset(h1.release());
+    return status;
+}
+
+} // namespace zx
diff --git a/pkg/zx/guest.cpp b/pkg/zx/guest.cpp
new file mode 100644
index 0000000..f3d6029
--- /dev/null
+++ b/pkg/zx/guest.cpp
@@ -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.
+
+#include <lib/zx/guest.h>
+
+#include <zircon/syscalls.h>
+
+#include <lib/zx/vmar.h>
+
+namespace zx {
+
+zx_status_t guest::create(const resource& resource, uint32_t options,
+                          guest* guest, vmar* vmar) {
+    // Assume |resource|, |guest| and |vmar| must refer to different containers,
+    // due to strict aliasing.
+    return zx_guest_create(
+        resource.get(), options, guest->reset_and_get_address(),
+        vmar->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/include/lib/zx/bti.h b/pkg/zx/include/lib/zx/bti.h
new file mode 100644
index 0000000..0a66716
--- /dev/null
+++ b/pkg/zx/include/lib/zx/bti.h
@@ -0,0 +1,48 @@
+// 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 LIB_ZX_BTI_H_
+#define LIB_ZX_BTI_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/iommu.h>
+#include <lib/zx/object.h>
+#include <lib/zx/pmt.h>
+#include <lib/zx/vmo.h>
+
+namespace zx {
+
+class bti : public object<bti> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_BTI;
+
+    constexpr bti() = default;
+
+    explicit bti(zx_handle_t value) : object(value) {}
+
+    explicit bti(handle&& h) : object(h.release()) {}
+
+    bti(bti&& other) : object(other.release()) {}
+
+    bti& operator=(bti&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const iommu& iommu, uint32_t options, uint64_t bti_id, bti* result);
+
+    zx_status_t pin(uint32_t options, const vmo& vmo, uint64_t offset, uint64_t size,
+                    zx_paddr_t* addrs, size_t addrs_count, pmt* pmt) const {
+        return zx_bti_pin(get(), options, vmo.get(), offset, size, addrs, addrs_count,
+                          pmt->reset_and_get_address());
+    }
+
+    zx_status_t release_quarantine() const { return zx_bti_release_quarantine(get()); }
+};
+
+using unowned_bti = unowned<bti>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_BTI_H_
diff --git a/pkg/zx/include/lib/zx/channel.h b/pkg/zx/include/lib/zx/channel.h
new file mode 100644
index 0000000..bd28ca1
--- /dev/null
+++ b/pkg/zx/include/lib/zx/channel.h
@@ -0,0 +1,66 @@
+// 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 LIB_ZX_CHANNEL_H_
+#define LIB_ZX_CHANNEL_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/time.h>
+
+namespace zx {
+
+class channel : public object<channel> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_CHANNEL;
+
+    constexpr channel() = default;
+
+    explicit channel(zx_handle_t value) : object(value) {}
+
+    explicit channel(handle&& h) : object(h.release()) {}
+
+    channel(channel&& other) : object(other.release()) {}
+
+    channel& operator=(channel&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t flags, channel* endpoint0,
+                              channel* endpoint1);
+
+    zx_status_t read(uint32_t flags, void* bytes, uint32_t num_bytes,
+                     uint32_t* actual_bytes, zx_handle_t* handles,
+                     uint32_t num_handles, uint32_t* actual_handles) const {
+        return zx_channel_read(get(), flags, bytes, handles, num_bytes,
+                               num_handles, actual_bytes, actual_handles);
+    }
+
+    zx_status_t read_etc(uint32_t flags, void* bytes, uint32_t num_bytes,
+                         uint32_t* actual_bytes, zx_handle_info_t* handles,
+                         uint32_t num_handles, uint32_t* actual_handles) const {
+        return zx_channel_read_etc(get(), flags, bytes, handles, num_bytes,
+                                   num_handles, actual_bytes, actual_handles);
+    }
+
+    zx_status_t write(uint32_t flags, const void* bytes, uint32_t num_bytes,
+                      const zx_handle_t* handles, uint32_t num_handles) const {
+        return zx_channel_write(get(), flags, bytes, num_bytes, handles,
+                                num_handles);
+    }
+
+    zx_status_t call(uint32_t flags, zx::time deadline,
+                     const zx_channel_call_args_t* args,
+                     uint32_t* actual_bytes, uint32_t* actual_handles) const {
+        return zx_channel_call(get(), flags, deadline.get(), args, actual_bytes,
+                               actual_handles);
+    }
+};
+
+using unowned_channel = unowned<channel>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_CHANNEL_H_
diff --git a/pkg/zx/include/lib/zx/debuglog.h b/pkg/zx/include/lib/zx/debuglog.h
new file mode 100644
index 0000000..1b00042
--- /dev/null
+++ b/pkg/zx/include/lib/zx/debuglog.h
@@ -0,0 +1,46 @@
+// 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 LIB_ZX_DEBUGLOG_H_
+#define LIB_ZX_DEBUGLOG_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/resource.h>
+
+namespace zx {
+
+class debuglog : public object<debuglog> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_LOG;
+
+    constexpr debuglog() = default;
+
+    explicit debuglog(zx_handle_t value) : object(value) {}
+
+    explicit debuglog(handle&& h) : object(h.release()) {}
+
+    debuglog(debuglog&& other) : object(other.release()) {}
+
+    debuglog& operator=(debuglog&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const resource& resource, uint32_t options, debuglog* result);
+
+    zx_status_t write(uint32_t options, const void* buffer, size_t buffer_size) const {
+        return zx_debuglog_write(get(), options, buffer, buffer_size);
+    }
+
+    zx_status_t read(uint32_t options, void* buffer, size_t buffer_size) const {
+        return zx_debuglog_read(get(), options, buffer, buffer_size);
+    }
+};
+
+using unowned_debuglog = unowned<debuglog>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_DEBUGLOG_H_
diff --git a/pkg/zx/include/lib/zx/event.h b/pkg/zx/include/lib/zx/event.h
new file mode 100644
index 0000000..590c4c1
--- /dev/null
+++ b/pkg/zx/include/lib/zx/event.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 LIB_ZX_EVENT_H_
+#define LIB_ZX_EVENT_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class event : public object<event> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_EVENT;
+
+    constexpr event() = default;
+
+    explicit event(zx_handle_t value) : object(value) {}
+
+    explicit event(handle&& h) : object(h.release()) {}
+
+    event(event&& other) : object(other.release()) {}
+
+    event& operator=(event&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t options, event* result);
+};
+
+using unowned_event = unowned<event>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_EVENT_H_
diff --git a/pkg/zx/include/lib/zx/eventpair.h b/pkg/zx/include/lib/zx/eventpair.h
new file mode 100644
index 0000000..56d094a
--- /dev/null
+++ b/pkg/zx/include/lib/zx/eventpair.h
@@ -0,0 +1,38 @@
+// 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 LIB_ZX_EVENTPAIR_H_
+#define LIB_ZX_EVENTPAIR_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class eventpair : public object<eventpair> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_EVENTPAIR;
+
+    constexpr eventpair() = default;
+
+    explicit eventpair(zx_handle_t value) : object(value) {}
+
+    explicit eventpair(handle&& h) : object(h.release()) {}
+
+    eventpair(eventpair&& other) : object(other.release()) {}
+
+    eventpair& operator=(eventpair&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t options, eventpair* endpoint0,
+                              eventpair* endpoint1);
+};
+
+using unowned_eventpair = unowned<eventpair>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_EVENTPAIR_H_
diff --git a/pkg/zx/include/lib/zx/fifo.h b/pkg/zx/include/lib/zx/fifo.h
new file mode 100644
index 0000000..aeab229
--- /dev/null
+++ b/pkg/zx/include/lib/zx/fifo.h
@@ -0,0 +1,47 @@
+// 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 LIB_ZX_FIFO_H_
+#define LIB_ZX_FIFO_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class fifo : public object<fifo> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_FIFO;
+
+    constexpr fifo() = default;
+
+    explicit fifo(zx_handle_t value) : object(value) {}
+
+    explicit fifo(handle&& h) : object(h.release()) {}
+
+    fifo(fifo&& other) : object(other.release()) {}
+
+    fifo& operator=(fifo&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t elem_count, uint32_t elem_size,
+                              uint32_t options, fifo* out0, fifo* out1);
+
+    zx_status_t write(size_t elem_size, const void* buffer, size_t count, size_t* actual_count) const {
+        return zx_fifo_write(get(), elem_size, buffer, count, actual_count);
+    }
+
+    zx_status_t read(size_t elem_size, void* buffer, size_t count, size_t* actual_count) const {
+        return zx_fifo_read(get(), elem_size, buffer, count, actual_count);
+    }
+
+};
+
+using unowned_fifo = unowned<fifo>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_FIFO_H_
diff --git a/pkg/zx/include/lib/zx/guest.h b/pkg/zx/include/lib/zx/guest.h
new file mode 100644
index 0000000..037bc6d
--- /dev/null
+++ b/pkg/zx/include/lib/zx/guest.h
@@ -0,0 +1,46 @@
+// 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 LIB_ZX_GUEST_H_
+#define LIB_ZX_GUEST_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/port.h>
+#include <lib/zx/resource.h>
+#include <lib/zx/vmo.h>
+
+namespace zx {
+
+class guest : public object<guest> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_GUEST;
+
+    constexpr guest() = default;
+
+    explicit guest(zx_handle_t value) : object(value) {}
+
+    explicit guest(handle&& h) : object(h.release()) {}
+
+    guest(guest&& other) : object(other.release()) {}
+
+    guest& operator=(guest&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const resource& resource, uint32_t options,
+                              guest* guest, vmar* vmar);
+
+    zx_status_t set_trap(uint32_t kind, zx_gpaddr_t addr, size_t len,
+                         const port& port, uint64_t key) {
+        return zx_guest_set_trap(get(), kind, addr, len, port.get(), key);
+    }
+};
+
+using unowned_guest = unowned<guest>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_GUEST_H_
diff --git a/pkg/zx/include/lib/zx/handle.h b/pkg/zx/include/lib/zx/handle.h
new file mode 100644
index 0000000..3daca00
--- /dev/null
+++ b/pkg/zx/include/lib/zx/handle.h
@@ -0,0 +1,17 @@
+// 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 LIB_ZX_HANDLE_H_
+#define LIB_ZX_HANDLE_H_
+
+#include <lib/zx/object.h>
+
+namespace zx {
+
+using handle = object<void>;
+using unowned_handle = unowned<handle>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_HANDLE_H_
diff --git a/pkg/zx/include/lib/zx/interrupt.h b/pkg/zx/include/lib/zx/interrupt.h
new file mode 100644
index 0000000..b3d3eb7
--- /dev/null
+++ b/pkg/zx/include/lib/zx/interrupt.h
@@ -0,0 +1,60 @@
+// 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 LIB_ZX_INTERRUPT_H_
+#define LIB_ZX_INTERRUPT_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/resource.h>
+#include <lib/zx/time.h>
+
+namespace zx {
+
+class interrupt : public object<interrupt> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_INTERRUPT;
+
+    constexpr interrupt() = default;
+
+    explicit interrupt(zx_handle_t value) : object(value) {}
+
+    explicit interrupt(handle&& h) : object(h.release()) {}
+
+    interrupt(interrupt&& other) : object(other.release()) {}
+
+    interrupt& operator=(interrupt&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const resource& resource, uint32_t vector,
+                        uint32_t options, interrupt* result);
+
+    zx_status_t wait(zx::time* timestamp) {
+        return zx_interrupt_wait(get(), timestamp->get_address());
+    }
+
+    zx_status_t destroy() {
+        return zx_interrupt_destroy(get());
+    }
+
+    zx_status_t trigger(uint32_t options, zx::time timestamp) {
+        return zx_interrupt_trigger(get(), options, timestamp.get());
+    }
+
+    zx_status_t bind(zx_handle_t porth, uint64_t key, uint32_t options) {
+        return zx_interrupt_bind(get(), porth, key, options);
+    }
+
+    zx_status_t ack() {
+        return zx_interrupt_ack(get());
+    }
+};
+
+using unowned_interrupt = unowned<interrupt>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_INTERRUPT_H_
diff --git a/pkg/zx/include/lib/zx/iommu.h b/pkg/zx/include/lib/zx/iommu.h
new file mode 100644
index 0000000..95dc427
--- /dev/null
+++ b/pkg/zx/include/lib/zx/iommu.h
@@ -0,0 +1,38 @@
+// 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 LIB_ZX_IOMMU_H_
+#define LIB_ZX_IOMMU_H_
+
+#include <lib/zx/object.h>
+#include <lib/zx/resource.h>
+
+namespace zx {
+
+class iommu : public object<iommu> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_IOMMU;
+
+    constexpr iommu() = default;
+
+    explicit iommu(zx_handle_t value) : object(value) {}
+
+    explicit iommu(handle&& h) : object(h.release()) {}
+
+    iommu(iommu&& other) : object(other.release()) {}
+
+    iommu& operator=(iommu&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const resource& resource, uint32_t type, const void* desc,
+                              size_t desc_size, iommu* result);
+};
+
+using unowned_iommu = unowned<iommu>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_IOMMU_H_
diff --git a/pkg/zx/include/lib/zx/job.h b/pkg/zx/include/lib/zx/job.h
new file mode 100644
index 0000000..3bd7125
--- /dev/null
+++ b/pkg/zx/include/lib/zx/job.h
@@ -0,0 +1,63 @@
+// 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 LIB_ZX_JOB_H_
+#define LIB_ZX_JOB_H_
+
+#include <lib/zx/task.h>
+#include <zircon/process.h>
+
+namespace zx {
+
+class process;
+
+class job : public task<job> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_JOB;
+
+    constexpr job() = default;
+
+    explicit job(zx_handle_t value) : task(value) {}
+
+    explicit job(handle&& h) : task(h.release()) {}
+
+    job(job&& other) : task(other.release()) {}
+
+    job& operator=(job&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const zx::job& parent, uint32_t options, job* result);
+
+    // Provide strongly-typed overloads, in addition to get_child(handle*).
+    using task<job>::get_child;
+    zx_status_t get_child(uint64_t koid, zx_rights_t rights,
+                          job* result) const {
+        // Allow for |result| and |this| aliasing the same container.
+        job h;
+        zx_status_t status = zx_object_get_child(
+            value_, koid, rights, h.reset_and_get_address());
+        result->reset(h.release());
+        return status;
+    }
+    zx_status_t get_child(uint64_t koid, zx_rights_t rights,
+                          process* result) const;
+
+    zx_status_t set_policy(uint32_t options, uint32_t topic, const void* policy, uint32_t count) const {
+      return zx_job_set_policy(get(), options, topic, policy, count);
+    }
+
+    // Ideally this would be called zx::job::default(), but default is a
+    // C++ keyword and cannot be used as a function name.
+    static inline unowned<job> default_job() {
+        return unowned<job>(zx_job_default());
+    }
+};
+
+using unowned_job = unowned<job>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_JOB_H_
diff --git a/pkg/zx/include/lib/zx/log.h b/pkg/zx/include/lib/zx/log.h
new file mode 100644
index 0000000..36b6e22
--- /dev/null
+++ b/pkg/zx/include/lib/zx/log.h
@@ -0,0 +1,45 @@
+// 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 LIB_ZX_LOG_H_
+#define LIB_ZX_LOG_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class log : public object<log> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_LOG;
+
+    constexpr log() = default;
+
+    explicit log(zx_handle_t value) : object(value) {}
+
+    explicit log(handle&& h) : object(h.release()) {}
+
+    log(log&& other) : object(other.release()) {}
+
+    log& operator=(log&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t flags, log* result);
+
+    zx_status_t write(uint32_t len, const void* buffer, uint32_t flags) const {
+        return zx_log_write(get(), len, buffer, flags);
+    }
+
+    zx_status_t read(uint32_t len, void* buffer, uint32_t flags) const {
+        return zx_log_read(get(), len, buffer, flags);
+    }
+};
+
+using unowned_log = unowned<log>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_LOG_H_
diff --git a/pkg/zx/include/lib/zx/object.h b/pkg/zx/include/lib/zx/object.h
new file mode 100644
index 0000000..57c023c
--- /dev/null
+++ b/pkg/zx/include/lib/zx/object.h
@@ -0,0 +1,319 @@
+// 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 LIB_ZX_OBJECT_H_
+#define LIB_ZX_OBJECT_H_
+
+#include <zircon/syscalls.h>
+#include <zircon/types.h>
+#include <lib/zx/object_traits.h>
+#include <lib/zx/time.h>
+
+namespace zx {
+
+class port;
+class profile;
+
+// Wraps and takes ownership of a handle to an object.
+//
+// Used for code that wants to operate generically on the zx_handle_t value
+// inside a |zx::object| and doesn't otherwise need a template parameter.
+//
+// The handle is automatically closed when the wrapper is destroyed.
+class object_base {
+public:
+    void reset(zx_handle_t value = ZX_HANDLE_INVALID) {
+        close();
+        value_ = value;
+    }
+
+    bool is_valid() const { return value_ != ZX_HANDLE_INVALID; }
+    explicit operator bool() const { return is_valid(); }
+
+    zx_handle_t get() const { return value_; }
+
+    // Reset the underlying handle, and then get the address of the
+    // underlying internal handle storage.
+    //
+    // Note: The intended purpose is to facilitate interactions with C
+    // APIs which expect to be provided a pointer to a handle used as
+    // an out parameter.
+    zx_handle_t* reset_and_get_address() {
+        reset();
+        return &value_;
+    }
+
+    __attribute__((warn_unused_result)) zx_handle_t release() {
+        zx_handle_t result = value_;
+        value_ = ZX_HANDLE_INVALID;
+        return result;
+    }
+
+protected:
+    constexpr object_base() : value_(ZX_HANDLE_INVALID) {}
+
+    explicit object_base(zx_handle_t value) : value_(value) {}
+
+    ~object_base() { close(); }
+
+    object_base(const object_base&) = delete;
+
+    void operator=(const object_base&) = delete;
+
+    void close() {
+        if (value_ != ZX_HANDLE_INVALID) {
+            zx_handle_close(value_);
+            value_ = ZX_HANDLE_INVALID;
+        }
+    }
+
+    zx_handle_t value_;
+};
+
+// Provides type-safe access to operations on a handle.
+template <typename T> class object : public object_base {
+public:
+    constexpr object() = default;
+
+    explicit object(zx_handle_t value) : object_base(value) {}
+
+    template <typename U> object(object<U>&& other) : object_base(other.release()) {
+        static_assert(is_same<T, void>::value, "Receiver must be compatible.");
+    }
+
+    template <typename U> object<T>& operator=(object<U>&& other) {
+        static_assert(is_same<T, void>::value, "Receiver must be compatible.");
+        reset(other.release());
+        return *this;
+    }
+
+    void swap(object<T>& other) {
+        zx_handle_t tmp = value_;
+        value_ = other.value_;
+        other.value_ = tmp;
+    }
+
+    zx_status_t duplicate(zx_rights_t rights, object<T>* result) const {
+        static_assert(object_traits<T>::supports_duplication,
+                      "Object must support duplication.");
+        zx_handle_t h = ZX_HANDLE_INVALID;
+        zx_status_t status = zx_handle_duplicate(value_, rights, &h);
+        result->reset(h);
+        return status;
+    }
+
+    zx_status_t replace(zx_rights_t rights, object<T>* result) {
+        zx_handle_t h = ZX_HANDLE_INVALID;
+        zx_status_t status = zx_handle_replace(value_, rights, &h);
+        // We store ZX_HANDLE_INVALID to value_ before calling reset on result
+        // in case result == this.
+        value_ = ZX_HANDLE_INVALID;
+        result->reset(h);
+        return status;
+    }
+
+    zx_status_t wait_one(zx_signals_t signals, zx::time deadline,
+                         zx_signals_t* pending) const {
+        static_assert(object_traits<T>::supports_wait, "Object is not waitable.");
+        return zx_object_wait_one(value_, signals, deadline.get(), pending);
+    }
+
+    zx_status_t wait_async(const object<port>& port, uint64_t key,
+                           zx_signals_t signals, uint32_t options) const {
+        static_assert(object_traits<T>::supports_wait, "Object is not waitable.");
+        return zx_object_wait_async(value_, port.get(), key, signals, options);
+    }
+
+    static zx_status_t wait_many(zx_wait_item_t* wait_items, uint32_t count, zx::time deadline) {
+        static_assert(object_traits<T>::supports_wait, "Object is not waitable.");
+        return zx_object_wait_many(wait_items, count, deadline.get());
+    }
+
+    zx_status_t signal(uint32_t clear_mask, uint32_t set_mask) const {
+        static_assert(object_traits<T>::supports_user_signal,
+                      "Object must support user signals.");
+        return zx_object_signal(get(), clear_mask, set_mask);
+    }
+
+    zx_status_t signal_peer(uint32_t clear_mask, uint32_t set_mask) const {
+        static_assert(object_traits<T>::supports_user_signal,
+                      "Object must support user signals.");
+        static_assert(object_traits<T>::has_peer_handle,
+                      "Object must have peer object.");
+        return zx_object_signal_peer(get(), clear_mask, set_mask);
+    }
+
+    zx_status_t get_info(uint32_t topic, void* buffer,
+                         size_t buffer_size,
+                         size_t* actual_count, size_t* avail_count) const {
+        return zx_object_get_info(get(), topic, buffer, buffer_size, actual_count, avail_count);
+    }
+
+    zx_status_t get_child(uint64_t koid, zx_rights_t rights,
+                          object<void>* result) const {
+        // Allow for |result| and |this| being the same container, though that
+        // can only happen for |T=void|, due to strict aliasing.
+        object<void> h;
+        zx_status_t status = zx_object_get_child(
+            value_, koid, rights, h.reset_and_get_address());
+        result->reset(h.release());
+        return status;
+    }
+
+    zx_status_t get_property(uint32_t property, void* value,
+                             size_t size) const {
+        return zx_object_get_property(get(), property, value, size);
+    }
+
+    zx_status_t set_property(uint32_t property, const void* value,
+                             size_t size) const {
+        return zx_object_set_property(get(), property, value, size);
+    }
+
+    zx_status_t get_cookie(const object_base& scope, uint64_t *cookie) const {
+        return zx_object_get_cookie(get(), scope.get(), cookie);
+    }
+
+    zx_status_t set_cookie(const object_base& scope, uint64_t cookie) const {
+        return zx_object_set_cookie(get(), scope.get(), cookie);
+    }
+
+    zx_status_t set_profile(const object<profile>& profile, uint32_t options) const {
+        return zx_object_set_profile(get(), profile.get(), options);
+    }
+
+private:
+    template <typename A, typename B> struct is_same {
+        static const bool value = false;
+    };
+
+    template <typename A> struct is_same<A, A> {
+        static const bool value = true;
+    };
+};
+
+template <typename T> bool operator==(const object<T>& a, const object<T>& b) {
+    return a.get() == b.get();
+}
+
+template <typename T> bool operator!=(const object<T>& a, const object<T>& b) {
+    return !(a == b);
+}
+
+template <typename T> bool operator<(const object<T>& a, const object<T>& b) {
+    return a.get() < b.get();
+}
+
+template <typename T> bool operator>(const object<T>& a, const object<T>& b) {
+    return a.get() > b.get();
+}
+
+template <typename T> bool operator<=(const object<T>& a, const object<T>& b) {
+    return !(a.get() > b.get());
+}
+
+template <typename T> bool operator>=(const object<T>& a, const object<T>& b) {
+    return !(a.get() < b.get());
+}
+
+template <typename T> bool operator==(zx_handle_t a, const object<T>& b) {
+    return a == b.get();
+}
+
+template <typename T> bool operator!=(zx_handle_t a, const object<T>& b) {
+    return !(a == b);
+}
+
+template <typename T> bool operator<(zx_handle_t a, const object<T>& b) {
+    return a < b.get();
+}
+
+template <typename T> bool operator>(zx_handle_t a, const object<T>& b) {
+    return a > b.get();
+}
+
+template <typename T> bool operator<=(zx_handle_t a, const object<T>& b) {
+    return !(a > b.get());
+}
+
+template <typename T> bool operator>=(zx_handle_t a, const object<T>& b) {
+    return !(a < b.get());
+}
+
+template <typename T> bool operator==(const object<T>& a, zx_handle_t b) {
+    return a.get() == b;
+}
+
+template <typename T> bool operator!=(const object<T>& a, zx_handle_t b) {
+    return !(a == b);
+}
+
+template <typename T> bool operator<(const object<T>& a, zx_handle_t b) {
+    return a.get() < b;
+}
+
+template <typename T> bool operator>(const object<T>& a, zx_handle_t b) {
+    return a.get() > b;
+}
+
+template <typename T> bool operator<=(const object<T>& a, zx_handle_t b) {
+    return !(a.get() > b);
+}
+
+template <typename T> bool operator>=(const object<T>& a, zx_handle_t b) {
+    return !(a.get() < b);
+}
+
+// Wraps a handle to an object to provide type-safe access to its operations
+// but does not take ownership of it.  The handle is not closed when the
+// wrapper is destroyed.
+//
+// All use of unowned<object<T>> as an object<T> is via a dereference operator,
+// as illustrated below:
+//
+// void do_something(const zx::event& event);
+//
+// void example(zx_handle_t event_handle) {
+//     do_something(*zx::unowned<event>(event_handle));
+// }
+//
+// Convenience aliases are provided for all object types, for example:
+//
+// zx::unowned_event(handle)->signal(..)
+template <typename T>
+class unowned final {
+public:
+    explicit unowned(zx_handle_t h) : value_(h) {}
+    explicit unowned(const T& owner) : unowned(owner.get()) {}
+    explicit unowned(unowned& other) : unowned(*other) {}
+    constexpr unowned() = default;
+    unowned(unowned&& other) = default;
+
+    ~unowned() { release_value(); }
+
+    unowned& operator=(unowned& other) {
+        *this = unowned(other);
+        return *this;
+    }
+    unowned& operator=(unowned&& other) {
+        release_value();
+        value_ = static_cast<T&&>(other.value_);
+        return *this;
+    }
+
+    const T& operator*() const { return value_; }
+    const T* operator->() const { return &value_; }
+
+private:
+    void release_value() {
+        zx_handle_t h = value_.release();
+        static_cast<void>(h);
+    }
+
+    T value_;
+};
+
+} // namespace zx
+
+#endif  // LIB_ZX_OBJECT_H_
diff --git a/pkg/zx/include/lib/zx/object_traits.h b/pkg/zx/include/lib/zx/object_traits.h
new file mode 100644
index 0000000..f5a62c6
--- /dev/null
+++ b/pkg/zx/include/lib/zx/object_traits.h
@@ -0,0 +1,111 @@
+// 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 LIB_ZX_OBJECT_TRAITS_H_
+#define LIB_ZX_OBJECT_TRAITS_H_
+
+namespace zx {
+
+class channel;
+class eventpair;
+class log;
+class socket;
+class vmo;
+class vmar;
+class port;
+class guest;
+class fifo;
+class interrupt;
+class pmt;
+
+// The default traits supports:
+// - event
+// - thread
+// - process
+// - job
+// - vmo
+// - bti
+// - resource
+// - timer
+// - iommu
+template <typename T> struct object_traits {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = true;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = false;
+};
+
+template <> struct object_traits<channel> {
+    static constexpr bool supports_duplication = false;
+    static constexpr bool supports_user_signal = true;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = true;
+};
+
+template <> struct object_traits<eventpair> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = true;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = true;
+};
+
+template <> struct object_traits<fifo> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = true;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = true;
+};
+
+template <> struct object_traits<log> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = true;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = false;
+};
+
+template <> struct object_traits<pmt> {
+    static constexpr bool supports_duplication = false;
+    static constexpr bool supports_user_signal = false;
+    static constexpr bool supports_wait = false;
+    static constexpr bool has_peer_handle = false;
+};
+
+template <> struct object_traits<socket> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = true;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = true;
+};
+
+template <> struct object_traits<port> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = false;
+    static constexpr bool supports_wait = false;
+    static constexpr bool has_peer_handle = false;
+};
+
+template <> struct object_traits<vmar> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = false;
+    static constexpr bool supports_wait = false;
+    static constexpr bool has_peer_handle = false;
+};
+
+template <> struct object_traits<interrupt> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = false;
+    static constexpr bool supports_wait = true;
+    static constexpr bool has_peer_handle = false;
+};
+
+template <> struct object_traits<guest> {
+    static constexpr bool supports_duplication = true;
+    static constexpr bool supports_user_signal = false;
+    static constexpr bool supports_wait = false;
+    static constexpr bool has_peer_handle = false;
+};
+
+} // namespace zx
+
+#endif  // LIB_ZX_OBJECT_TRAITS_H_
diff --git a/pkg/zx/include/lib/zx/pmt.h b/pkg/zx/include/lib/zx/pmt.h
new file mode 100644
index 0000000..404235a
--- /dev/null
+++ b/pkg/zx/include/lib/zx/pmt.h
@@ -0,0 +1,37 @@
+// 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 LIB_ZX_PMT_H_
+#define LIB_ZX_PMT_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class pmt : public object<pmt> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_PMT;
+
+    constexpr pmt() = default;
+
+    explicit pmt(zx_handle_t value) : object(value) {}
+
+    explicit pmt(handle&& h) : object(h.release()) {}
+
+    pmt(pmt&& other) : object(other.release()) {}
+
+    pmt& operator=(pmt&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    zx_status_t unpin() { return zx_pmt_unpin(release()); }
+};
+
+using unowned_pmt = unowned<pmt>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_PMT_H_
diff --git a/pkg/zx/include/lib/zx/port.h b/pkg/zx/include/lib/zx/port.h
new file mode 100644
index 0000000..ef607ec
--- /dev/null
+++ b/pkg/zx/include/lib/zx/port.h
@@ -0,0 +1,50 @@
+// 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 LIB_ZX_PORT_H_
+#define LIB_ZX_PORT_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/time.h>
+
+namespace zx {
+
+class port : public object<port> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_PORT;
+
+    constexpr port() = default;
+
+    explicit port(zx_handle_t value) : object(value) {}
+
+    explicit port(handle&& h) : object(h.release()) {}
+
+    port(port&& other) : object(other.release()) {}
+
+    port& operator=(port&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t options, port* result);
+
+    zx_status_t queue(const zx_port_packet_t* packet) const {
+        return zx_port_queue(get(), packet);
+    }
+
+    zx_status_t wait(zx::time deadline, zx_port_packet_t* packet) const {
+        return zx_port_wait(get(), deadline.get(), packet);
+    }
+
+    zx_status_t cancel(const object_base& source, uint64_t key) const {
+        return zx_port_cancel(get(), source.get(), key);
+    }
+};
+
+using unowned_port = unowned<port>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_PORT_H_
diff --git a/pkg/zx/include/lib/zx/process.h b/pkg/zx/include/lib/zx/process.h
new file mode 100644
index 0000000..c3fe348
--- /dev/null
+++ b/pkg/zx/include/lib/zx/process.h
@@ -0,0 +1,67 @@
+// 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 LIB_ZX_PROCESS_H_
+#define LIB_ZX_PROCESS_H_
+
+#include <lib/zx/object.h>
+#include <lib/zx/task.h>
+#include <lib/zx/vmar.h>
+#include <lib/zx/vmo.h>
+#include <zircon/process.h>
+
+namespace zx {
+class job;
+class thread;
+
+class process : public task<process> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_PROCESS;
+
+    constexpr process() = default;
+
+    explicit process(zx_handle_t value) : task(value) {}
+
+    explicit process(handle&& h) : task(h.release()) {}
+
+    process(process&& other) : task(other.release()) {}
+
+    process& operator=(process&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    // Rather than creating a process directly with this syscall,
+    // consider using the launchpad library, which properly sets up
+    // the many details of creating a process beyond simply creating
+    // the kernel structure.
+    static zx_status_t create(const job& job, const char* name, uint32_t name_len,
+                              uint32_t flags, process* proc, vmar* root_vmar);
+
+    zx_status_t start(const thread& thread_handle, uintptr_t entry,
+                      uintptr_t stack, handle arg_handle, uintptr_t arg2) const;
+
+    zx_status_t read_memory(uintptr_t vaddr, void* buffer, size_t len, size_t* actual) const {
+        return zx_process_read_memory(get(), vaddr, buffer, len, actual);
+    }
+
+    zx_status_t write_memory(uintptr_t vaddr, const void* buffer, size_t len, size_t* actual) {
+        return zx_process_write_memory(get(), vaddr, buffer, len, actual);
+    }
+
+    // Provide strongly-typed overload, in addition to get_child(handle*).
+    using task<process>::get_child;
+    zx_status_t get_child(uint64_t koid, zx_rights_t rights,
+                          thread* result) const;
+
+    static inline unowned<process> self() {
+        return unowned<process>(zx_process_self());
+    }
+};
+
+using unowned_process = unowned<process>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_PROCESS_H_
diff --git a/pkg/zx/include/lib/zx/profile.h b/pkg/zx/include/lib/zx/profile.h
new file mode 100644
index 0000000..ddc3fe3
--- /dev/null
+++ b/pkg/zx/include/lib/zx/profile.h
@@ -0,0 +1,38 @@
+// 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 LIB_ZX_PROFILE_H_
+#define LIB_ZX_PROFILE_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/resource.h>
+
+namespace zx {
+
+class profile : public object<profile> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_LOG;
+
+    constexpr profile() = default;
+
+    explicit profile(zx_handle_t value) : object(value) {}
+
+    explicit profile(handle&& h) : object(h.release()) {}
+
+    profile(profile&& other) : object(other.release()) {}
+
+    profile& operator=(profile&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const resource& resource, const zx_profile_info_t* info, profile* result);
+};
+
+using unowned_profile = unowned<profile>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_PROFILE_H_
diff --git a/pkg/zx/include/lib/zx/resource.h b/pkg/zx/include/lib/zx/resource.h
new file mode 100644
index 0000000..4909868
--- /dev/null
+++ b/pkg/zx/include/lib/zx/resource.h
@@ -0,0 +1,43 @@
+// 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 LIB_ZX_RESOURCE_H_
+#define LIB_ZX_RESOURCE_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class resource : public object<resource> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_RESOURCE;
+
+    constexpr resource() = default;
+
+    explicit resource(zx_handle_t value) : object(value) {}
+
+    explicit resource(handle&& h) : object(h.release()) {}
+
+    resource(resource&& other) : object(other.release()) {}
+
+    resource& operator=(resource&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const resource& parent,
+                              uint32_t options,
+                              uint64_t base,
+                              size_t len,
+                              const char* name,
+                              size_t namelen,
+                              resource* result);
+};
+
+using unowned_resource = unowned<resource>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_RESOURCE_H_
diff --git a/pkg/zx/include/lib/zx/socket.h b/pkg/zx/include/lib/zx/socket.h
new file mode 100644
index 0000000..180e1fa
--- /dev/null
+++ b/pkg/zx/include/lib/zx/socket.h
@@ -0,0 +1,65 @@
+// 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 LIB_ZX_SOCKET_H_
+#define LIB_ZX_SOCKET_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+class socket : public object<socket> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_SOCKET;
+
+    constexpr socket() = default;
+
+    explicit socket(zx_handle_t value) : object(value) {}
+
+    explicit socket(handle&& h) : object(h.release()) {}
+
+    socket(socket&& other) : object(other.release()) {}
+
+    socket& operator=(socket&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t options, socket* endpoint0,
+                              socket* endpoint1);
+
+    zx_status_t write(uint32_t options, const void* buffer, size_t len,
+                      size_t* actual) const {
+        return zx_socket_write(get(), options, buffer, len, actual);
+    }
+
+    zx_status_t read(uint32_t options, void* buffer, size_t len,
+                     size_t* actual) const {
+        return zx_socket_read(get(), options, buffer, len, actual);
+    }
+
+    zx_status_t share(socket socket_to_share) const {
+        return zx_socket_share(get(), socket_to_share.release());
+    }
+
+    zx_status_t accept(socket* out_socket) const {
+        // We use a temporary to handle the case where |this| and |out_socket|
+        // are aliased.
+        socket result;
+        zx_status_t status = zx_socket_accept(get(), result.reset_and_get_address());
+        out_socket->reset(result.release());
+        return status;
+    }
+
+    zx_status_t shutdown(uint32_t options) const {
+        return zx_socket_shutdown(get(), options);
+    }
+};
+
+using unowned_socket = unowned<socket>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_SOCKET_H_
diff --git a/pkg/zx/include/lib/zx/suspend_token.h b/pkg/zx/include/lib/zx/suspend_token.h
new file mode 100644
index 0000000..8eba2df
--- /dev/null
+++ b/pkg/zx/include/lib/zx/suspend_token.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 LIB_ZX_SUSPEND_TOKEN_H_
+#define LIB_ZX_SUSPEND_TOKEN_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+namespace zx {
+
+// The only thing you can do with a suspend token is close it (which will
+// resume the thread).
+class suspend_token : public object<suspend_token> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_SUSPEND_TOKEN;
+
+    constexpr suspend_token() = default;
+
+    explicit suspend_token(zx_handle_t value) : object<suspend_token>(value) {}
+
+    explicit suspend_token(handle&& h) : object<suspend_token>(h.release()) {}
+
+    suspend_token(suspend_token&& other) : object<suspend_token>(other.release()) {}
+
+    suspend_token& operator=(suspend_token&& other) {
+        reset(other.release());
+        return *this;
+    }
+};
+
+} // namespace zx
+
+#endif  // LIB_ZX_SUSPEND_TOKEN_H_
diff --git a/pkg/zx/include/lib/zx/task.h b/pkg/zx/include/lib/zx/task.h
new file mode 100644
index 0000000..a3bc20d
--- /dev/null
+++ b/pkg/zx/include/lib/zx/task.h
@@ -0,0 +1,51 @@
+// 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 LIB_ZX_TASK_H_
+#define LIB_ZX_TASK_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/suspend_token.h>
+
+namespace zx {
+
+class port;
+class suspend_token;
+
+template <typename T = void> class task : public object<T> {
+public:
+    constexpr task() = default;
+
+    explicit task(zx_handle_t value) : object<T>(value) {}
+
+    explicit task(handle&& h) : object<T>(h.release()) {}
+
+    task(task&& other) : object<T>(other.release()) {}
+
+    zx_status_t bind_exception_port(
+            const object<port>& port, uint64_t key, uint32_t options) const {
+        return zx_task_bind_exception_port(object<T>::get(), port.get(), key, options);
+    }
+
+    zx_status_t kill() const { return zx_task_kill(object<T>::get()); }
+
+    // Deprecated: Use the variant that takes a suspend_token.
+    zx_status_t suspend() const { return zx_task_suspend(object<T>::get()); }
+
+    zx_status_t suspend(suspend_token* result) const {
+        // Assume |result| must refer to a different container than |this|, due
+        // to strict aliasing.
+        return zx_task_suspend_token(
+            object<T>::get(), result->reset_and_get_address());
+    }
+
+    zx_status_t resume_from_exception(const object<port>& port, uint32_t options) const {
+        return zx_task_resume_from_exception(object<T>::get(), port.get(), options);
+    }
+};
+
+} // namespace zx
+
+#endif  // LIB_ZX_TASK_H_
diff --git a/pkg/zx/include/lib/zx/thread.h b/pkg/zx/include/lib/zx/thread.h
new file mode 100644
index 0000000..eabf3ed
--- /dev/null
+++ b/pkg/zx/include/lib/zx/thread.h
@@ -0,0 +1,72 @@
+// 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 LIB_ZX_THREAD_H_
+#define LIB_ZX_THREAD_H_
+
+#include <lib/zx/object.h>
+#include <lib/zx/task.h>
+#include <zircon/process.h>
+
+namespace zx {
+class process;
+
+class thread : public task<thread> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_THREAD;
+
+    constexpr thread() = default;
+
+    explicit thread(zx_handle_t value)
+        : task(value) {}
+
+    explicit thread(handle&& h)
+        : task(h.release()) {}
+
+    thread(thread&& other)
+        : task(other.release()) {}
+
+    thread& operator=(thread&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    // Rather than creating a thread directly with this syscall, consider using
+    // std::thread or thrd_create, which properly integrates with the
+    // thread-local data structures in libc.
+    static zx_status_t create(const process& process, const char* name,
+                              uint32_t name_len, uint32_t flags,
+                              thread* result);
+
+    // The first variant maps exactly to the syscall and can be used for
+    // launching threads in remote processes. The second variant is for
+    // conveniently launching threads in the current process.
+    zx_status_t start(uintptr_t thread_entry, uintptr_t stack, uintptr_t arg1,
+                      uintptr_t arg2) const {
+        return zx_thread_start(get(), thread_entry, stack, arg1, arg2);
+    }
+    zx_status_t start(void (*thread_entry)(uintptr_t arg1, uintptr_t arg2),
+                      void* stack, uintptr_t arg1, uintptr_t arg2) {
+        return zx_thread_start(get(),
+                               reinterpret_cast<uintptr_t>(thread_entry),
+                               reinterpret_cast<uintptr_t>(stack), arg1, arg2);
+    }
+
+    zx_status_t read_state(uint32_t kind, void* buffer, size_t len) const {
+        return zx_thread_read_state(get(), kind, buffer, len);
+    }
+    zx_status_t write_state(uint32_t kind, const void* buffer, size_t len) {
+        return zx_thread_write_state(get(), kind, buffer, len);
+    }
+
+    static inline unowned<thread> self() {
+        return unowned<thread>(zx_thread_self());
+    }
+};
+
+using unowned_thread = unowned<thread>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_THREAD_H_
diff --git a/pkg/zx/include/lib/zx/time.h b/pkg/zx/include/lib/zx/time.h
new file mode 100644
index 0000000..101e057
--- /dev/null
+++ b/pkg/zx/include/lib/zx/time.h
@@ -0,0 +1,253 @@
+// 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 LIB_ZX_TIME_H_
+#define LIB_ZX_TIME_H_
+
+#include <stdint.h>
+#include <zircon/compiler.h>
+#include <zircon/syscalls.h>
+#include <zircon/time.h>
+
+namespace zx {
+
+class duration {
+public:
+    constexpr duration() = default;
+
+    explicit constexpr duration(zx_duration_t value)
+        : value_(value) {}
+
+    static constexpr duration infinite() { return duration(ZX_TIME_INFINITE); }
+
+    static constexpr duration infinite_past() { return duration(ZX_TIME_INFINITE_PAST); }
+
+    constexpr zx_duration_t get() const { return value_; }
+
+    constexpr duration operator+(duration other) const {
+        return duration(zx_duration_add_duration(value_, other.value_));
+    }
+
+    constexpr duration operator-(duration other) const {
+        return duration(zx_duration_sub_duration(value_, other.value_));
+    }
+
+    constexpr duration operator*(int64_t multiplier) const {
+        return duration(zx_duration_mul_int64(value_, multiplier));
+    }
+
+    constexpr duration operator/(int64_t divisor) const {
+        return duration(value_ / divisor);
+    }
+
+    constexpr duration operator%(duration divisor) const {
+        return duration(value_ % divisor.value_);
+    }
+
+    constexpr int64_t operator/(duration other) const {
+        return value_ / other.value_;
+    }
+
+    constexpr duration& operator+=(duration other) {
+        value_ = zx_duration_add_duration(value_, other.value_);
+        return *this;
+    }
+
+    constexpr duration& operator-=(duration other) {
+        value_ = zx_duration_sub_duration(value_, other.value_);
+        return *this;
+    }
+
+    constexpr duration& operator*=(int64_t multiplier) {
+        value_ = zx_duration_mul_int64(value_, multiplier);
+        return *this;
+    }
+
+    constexpr duration& operator/=(int64_t divisor) {
+        value_ /= divisor;
+        return *this;
+    }
+
+    constexpr bool operator==(duration other) const { return value_ == other.value_; }
+    constexpr bool operator!=(duration other) const { return value_ != other.value_; }
+    constexpr bool operator<(duration other) const { return value_ < other.value_; }
+    constexpr bool operator<=(duration other) const { return value_ <= other.value_; }
+    constexpr bool operator>(duration other) const { return value_ > other.value_; }
+    constexpr bool operator>=(duration other) const { return value_ >= other.value_; }
+
+    constexpr int64_t to_nsecs() const { return value_; }
+
+    constexpr int64_t to_usecs() const { return value_ / ZX_USEC(1); }
+
+    constexpr int64_t to_msecs() const { return value_ / ZX_MSEC(1); }
+
+    constexpr int64_t to_secs() const { return value_ / ZX_SEC(1); }
+
+    constexpr int64_t to_mins() const { return value_ / ZX_MIN(1); }
+
+    constexpr int64_t to_hours() const { return value_ / ZX_HOUR(1); }
+
+private:
+    zx_duration_t value_ = 0;
+};
+
+class ticks {
+public:
+    constexpr ticks() = default;
+
+    explicit constexpr ticks(zx_ticks_t value) : value_(value) {}
+
+    // Constructs a tick object for the current tick counter in the system.
+    static ticks now() { return ticks(zx_ticks_get()); }
+
+    // Returns the number of ticks contained within one second.
+    static ticks per_second() { return ticks(zx_ticks_per_second()); }
+
+    // Acquires the number of ticks contained within this object.
+    constexpr zx_ticks_t get() const { return value_; }
+
+    constexpr ticks operator+(ticks other) const {
+        return ticks(value_ + other.value_);
+    }
+
+    constexpr ticks operator-(ticks other) const {
+        return ticks(value_ - other.value_);
+    }
+
+    constexpr ticks operator*(uint64_t multiplier) const {
+        return ticks(value_ * multiplier);
+    }
+
+    constexpr ticks operator/(uint64_t divisor) const {
+        return ticks(value_ / divisor);
+    }
+
+    constexpr uint64_t operator/(ticks other) const {
+        return value_ / other.value_;
+    }
+
+    constexpr ticks& operator+=(ticks other) {
+        value_ += other.value_;
+        return *this;
+    }
+
+    constexpr ticks& operator-=(ticks other) {
+        value_ -= other.value_;
+        return *this;
+    }
+
+    constexpr ticks& operator*=(uint64_t multiplier) {
+        value_ *= multiplier;
+        return *this;
+    }
+
+    constexpr ticks& operator/=(uint64_t divisor) {
+        value_ /= divisor;
+        return *this;
+    }
+
+    constexpr bool operator==(ticks other) const { return value_ == other.value_; }
+    constexpr bool operator!=(ticks other) const { return value_ != other.value_; }
+    constexpr bool operator<(ticks other) const { return value_ < other.value_; }
+    constexpr bool operator<=(ticks other) const { return value_ <= other.value_; }
+    constexpr bool operator>(ticks other) const { return value_ > other.value_; }
+    constexpr bool operator>=(ticks other) const { return value_ >= other.value_; }
+
+private:
+    zx_ticks_t value_ = 0;
+};
+
+template <zx_clock_t kClockId>
+class basic_time {
+public:
+    constexpr basic_time() = default;
+
+    explicit constexpr basic_time(zx_time_t value) : value_(value) {}
+
+    static constexpr basic_time<kClockId> infinite() {
+        return basic_time<kClockId>(ZX_TIME_INFINITE);
+    }
+
+    static constexpr basic_time<kClockId> infinite_past() {
+        return basic_time<kClockId>(ZX_TIME_INFINITE_PAST);
+    }
+
+    constexpr zx_time_t get() const { return value_; }
+
+    zx_time_t* get_address() { return &value_; }
+
+    constexpr duration operator-(basic_time<kClockId> other) const {
+        return duration(zx_time_sub_time(value_, other.value_));
+    }
+
+    constexpr basic_time<kClockId> operator+(duration delta) const {
+        return basic_time<kClockId>(zx_time_add_duration(value_, delta.get()));
+    }
+
+    constexpr basic_time<kClockId> operator-(duration delta) const {
+        return basic_time<kClockId>(zx_time_sub_duration(value_, delta.get()));
+    }
+
+    constexpr basic_time<kClockId>& operator+=(duration delta) {
+      value_ = zx_time_add_duration(value_, delta.get());
+      return *this;
+    }
+
+    constexpr basic_time<kClockId>& operator-=(duration delta) {
+      value_ = zx_time_sub_duration(value_, delta.get());
+      return *this;
+    }
+
+    constexpr bool operator==(basic_time<kClockId> other) const { return value_ == other.value_; }
+    constexpr bool operator!=(basic_time<kClockId> other) const { return value_ != other.value_; }
+    constexpr bool operator<(basic_time<kClockId> other) const { return value_ < other.value_; }
+    constexpr bool operator<=(basic_time<kClockId> other) const { return value_ <= other.value_; }
+    constexpr bool operator>(basic_time<kClockId> other) const { return value_ > other.value_; }
+    constexpr bool operator>=(basic_time<kClockId> other) const { return value_ >= other.value_; }
+
+private:
+    zx_time_t value_ = 0;
+};
+
+using time = basic_time<ZX_CLOCK_MONOTONIC>;
+using time_utc = basic_time<ZX_CLOCK_UTC>;
+using time_thread = basic_time<ZX_CLOCK_THREAD>;
+
+class clock {
+public:
+    clock() = delete;
+
+    template <zx_clock_t kClockId>
+    static zx_status_t get(basic_time<kClockId>* result) {
+        return zx_clock_get_new(kClockId, result->get_address());
+    }
+
+    static time get_monotonic() {
+      return time(zx_clock_get_monotonic());
+    }
+};
+
+constexpr inline duration nsec(int64_t n) { return duration(ZX_NSEC(n)); }
+
+constexpr inline duration usec(int64_t n) { return duration(ZX_USEC(n)); }
+
+constexpr inline duration msec(int64_t n) { return duration(ZX_MSEC(n)); }
+
+constexpr inline duration sec(int64_t n) { return duration(ZX_SEC(n)); }
+
+constexpr inline duration min(int64_t n) { return duration(ZX_MIN(n)); }
+
+constexpr inline duration hour(int64_t n) { return duration(ZX_HOUR(n)); }
+
+inline zx_status_t nanosleep(zx::time deadline) {
+    return zx_nanosleep(deadline.get());
+}
+
+inline time deadline_after(zx::duration nanoseconds) {
+    return time(zx_deadline_after(nanoseconds.get()));
+}
+
+} // namespace zx
+
+#endif  // LIB_ZX_TIME_H_
diff --git a/pkg/zx/include/lib/zx/timer.h b/pkg/zx/include/lib/zx/timer.h
new file mode 100644
index 0000000..d7990ac
--- /dev/null
+++ b/pkg/zx/include/lib/zx/timer.h
@@ -0,0 +1,47 @@
+// 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 LIB_ZX_TIMER_H_
+#define LIB_ZX_TIMER_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+
+#include <zircon/types.h>
+
+namespace zx {
+
+class timer : public object<timer> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_TIMER;
+
+    constexpr timer() = default;
+
+    explicit timer(zx_handle_t value) : object(value) {}
+
+    explicit timer(handle&& h) : object(h.release()) {}
+
+    timer(timer&& other) : object(other.release()) {}
+
+    timer& operator=(timer&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint32_t options, zx_clock_t clock_id, timer* result);
+
+    zx_status_t set(zx::time deadline, zx::duration slack) const {
+        return zx_timer_set(get(), deadline.get(), slack.get());
+    }
+
+    zx_status_t cancel() const {
+        return zx_timer_cancel(get());
+    }
+};
+
+using unowned_timer = unowned<timer>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_TIMER_H_
diff --git a/pkg/zx/include/lib/zx/vcpu.h b/pkg/zx/include/lib/zx/vcpu.h
new file mode 100644
index 0000000..dac3f3a
--- /dev/null
+++ b/pkg/zx/include/lib/zx/vcpu.h
@@ -0,0 +1,56 @@
+// 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 LIB_ZX_VCPU_H_
+#define LIB_ZX_VCPU_H_
+
+#include <lib/zx/guest.h>
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <zircon/syscalls/port.h>
+
+namespace zx {
+
+class vcpu : public object<vcpu> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_VCPU;
+
+    constexpr vcpu() = default;
+
+    explicit vcpu(zx_handle_t value) : object(value) {}
+
+    explicit vcpu(handle&& h) : object(h.release()) {}
+
+    vcpu(vcpu&& other) : object(other.release()) {}
+
+    vcpu& operator=(vcpu&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(const guest& guest, uint32_t options,
+                              zx_gpaddr_t entry, vcpu* result);
+
+    zx_status_t resume(zx_port_packet_t* packet) {
+        return zx_vcpu_resume(get(), packet);
+    }
+
+    zx_status_t interrupt(uint32_t interrupt) {
+        return zx_vcpu_interrupt(get(), interrupt);
+    }
+
+    zx_status_t read_state(uint32_t kind, void* buf, size_t len) const {
+        return zx_vcpu_read_state(get(), kind, buf, len);
+    }
+
+    zx_status_t write_state(uint32_t kind, const void* buf, size_t len) {
+        return zx_vcpu_write_state(get(), kind, buf, len);
+    }
+};
+
+using unowned_vcpu = unowned<vcpu>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_VCPU_H_
diff --git a/pkg/zx/include/lib/zx/vmar.h b/pkg/zx/include/lib/zx/vmar.h
new file mode 100644
index 0000000..1553110
--- /dev/null
+++ b/pkg/zx/include/lib/zx/vmar.h
@@ -0,0 +1,62 @@
+// 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 LIB_ZX_VMAR_H_
+#define LIB_ZX_VMAR_H_
+
+#include <lib/zx/object.h>
+#include <lib/zx/vmo.h>
+#include <zircon/process.h>
+
+namespace zx {
+
+// A wrapper for handles to VMARs.  Note that vmar::~vmar() does not execute
+// vmar::destroy(), it just closes the handle.
+class vmar : public object<vmar> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_VMAR;
+
+    constexpr vmar() = default;
+
+    explicit vmar(zx_handle_t value) : object(value) {}
+
+    explicit vmar(handle&& h) : object(h.release()) {}
+
+    vmar(vmar&& other) : vmar(other.release()) {}
+
+    vmar& operator=(vmar&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    zx_status_t map(size_t vmar_offset, const vmo& vmo_handle, uint64_t vmo_offset,
+                    size_t len, zx_vm_option_t options, uintptr_t* ptr) const {
+        return zx_vmar_map(get(), options, vmar_offset, vmo_handle.get(), vmo_offset, len, ptr);
+    }
+
+    zx_status_t unmap(uintptr_t address, size_t len) const {
+        return zx_vmar_unmap(get(), address, len);
+    }
+
+    zx_status_t protect(uintptr_t address, size_t len, zx_vm_option_t prot) const {
+        return zx_vmar_protect(get(), prot, address, len);
+    }
+
+    zx_status_t destroy() const {
+        return zx_vmar_destroy(get());
+    }
+
+    zx_status_t allocate(size_t offset, size_t size, uint32_t flags,
+                         vmar* child, uintptr_t* child_addr) const;
+
+    static inline unowned<vmar> root_self() {
+        return unowned<vmar>(zx_vmar_root_self());
+    }
+};
+
+using unowned_vmar = unowned<vmar>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_VMAR_H_
diff --git a/pkg/zx/include/lib/zx/vmo.h b/pkg/zx/include/lib/zx/vmo.h
new file mode 100644
index 0000000..82e2cab
--- /dev/null
+++ b/pkg/zx/include/lib/zx/vmo.h
@@ -0,0 +1,89 @@
+// 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 LIB_ZX_VMO_H_
+#define LIB_ZX_VMO_H_
+
+#include <lib/zx/handle.h>
+#include <lib/zx/object.h>
+#include <lib/zx/resource.h>
+
+namespace zx {
+
+class bti;
+
+class vmo : public object<vmo> {
+public:
+    static constexpr zx_obj_type_t TYPE = ZX_OBJ_TYPE_VMO;
+
+    constexpr vmo() = default;
+
+    explicit vmo(zx_handle_t value) : object(value) {}
+
+    explicit vmo(handle&& h) : object(h.release()) {}
+
+    vmo(vmo&& other) : object(other.release()) {}
+
+    vmo& operator=(vmo&& other) {
+        reset(other.release());
+        return *this;
+    }
+
+    static zx_status_t create(uint64_t size, uint32_t options, vmo* result);
+    static zx_status_t create_contiguous(
+        const bti& bti, size_t size, uint32_t alignment_log2, vmo* result);
+    static zx_status_t create_physical(
+        const resource& resource, zx_paddr_t paddr, size_t size, vmo* result);
+
+    zx_status_t read(void* data, uint64_t offset, size_t len) const {
+        return zx_vmo_read(get(), data, offset, len);
+    }
+
+    zx_status_t write(const void* data, uint64_t offset, size_t len) const {
+        return zx_vmo_write(get(), data, offset, len);
+    }
+
+    zx_status_t get_size(uint64_t* size) const {
+        return zx_vmo_get_size(get(), size);
+    }
+
+    zx_status_t set_size(uint64_t size) const {
+        return zx_vmo_set_size(get(), size);
+    }
+
+    zx_status_t clone(uint32_t options, uint64_t offset, uint64_t size,
+                      vmo* result) const {
+        // Allow for the caller aliasing |result| to |this|.
+        vmo h;
+        zx_status_t status = zx_vmo_clone(
+            get(), options, offset, size, h.reset_and_get_address());
+        result->reset(h.release());
+        return status;
+    }
+
+    zx_status_t op_range(uint32_t op, uint64_t offset, uint64_t size,
+                         void* buffer, size_t buffer_size) const {
+        return zx_vmo_op_range(get(), op, offset, size, buffer, buffer_size);
+    }
+
+    zx_status_t set_cache_policy(uint32_t cache_policy) {
+        return zx_vmo_set_cache_policy(get(), cache_policy);
+    }
+
+    zx_status_t replace_as_executable(const handle& vmex, vmo* result) {
+        zx_handle_t h = ZX_HANDLE_INVALID;
+        zx_status_t status = zx_vmo_replace_as_executable(value_, vmex.get(), &h);
+        // We store ZX_HANDLE_INVALID to value_ before calling reset on result
+        // in case result == this.
+        value_ = ZX_HANDLE_INVALID;
+        result->reset(h);
+        return status;
+    }
+};
+
+using unowned_vmo = unowned<vmo>;
+
+} // namespace zx
+
+#endif  // LIB_ZX_VMO_H_
diff --git a/pkg/zx/interrupt.cpp b/pkg/zx/interrupt.cpp
new file mode 100644
index 0000000..609406d
--- /dev/null
+++ b/pkg/zx/interrupt.cpp
@@ -0,0 +1,19 @@
+// 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.
+
+#include <lib/zx/interrupt.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t interrupt::create(const resource& resource, uint32_t vector,
+                              uint32_t options, interrupt* result) {
+    // Assume |result| uses a distinct container from |resource|, due to
+    // strict aliasing.
+    return zx_interrupt_create(
+        resource.get(), vector, options, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/iommu.cpp b/pkg/zx/iommu.cpp
new file mode 100644
index 0000000..ad3c078
--- /dev/null
+++ b/pkg/zx/iommu.cpp
@@ -0,0 +1,16 @@
+// 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.
+
+#include <lib/zx/iommu.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t iommu::create(const resource& resource, uint32_t type, const void* desc,
+                          size_t desc_size, iommu* result) {
+    return zx_iommu_create(resource.get(), type, desc, desc_size, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/job.cpp b/pkg/zx/job.cpp
new file mode 100644
index 0000000..6989589
--- /dev/null
+++ b/pkg/zx/job.cpp
@@ -0,0 +1,29 @@
+// 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.
+
+#include <lib/zx/job.h>
+
+#include <lib/zx/process.h>
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t job::create(const job& parent, uint32_t flags, job* result) {
+    // Allow for aliasing of the same container to |result| and |parent|.
+    job h;
+    zx_status_t status =
+        zx_job_create(parent.get(), flags, h.reset_and_get_address());
+    result->reset(h.release());
+    return status;
+}
+
+zx_status_t job::get_child(uint64_t koid, zx_rights_t rights,
+                           process* result) const {
+    // Assume |result| and |this| are distinct containers, due to strict
+    // aliasing.
+    return zx_object_get_child(
+        value_, koid, rights, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/log.cpp b/pkg/zx/log.cpp
new file mode 100644
index 0000000..4c06b36
--- /dev/null
+++ b/pkg/zx/log.cpp
@@ -0,0 +1,15 @@
+// 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.
+
+#include <lib/zx/log.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t log::create(uint32_t flags, log* result) {
+    return zx_debuglog_create(ZX_HANDLE_INVALID, flags, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/meta.json b/pkg/zx/meta.json
new file mode 100644
index 0000000..27622e6
--- /dev/null
+++ b/pkg/zx/meta.json
@@ -0,0 +1,113 @@
+{
+  "banjo_deps": [], 
+  "deps": [], 
+  "fidl_deps": [], 
+  "files": [
+    "pkg/zx/bti.cpp", 
+    "pkg/zx/channel.cpp", 
+    "pkg/zx/debuglog.cpp", 
+    "pkg/zx/event.cpp", 
+    "pkg/zx/eventpair.cpp", 
+    "pkg/zx/fifo.cpp", 
+    "pkg/zx/guest.cpp", 
+    "pkg/zx/interrupt.cpp", 
+    "pkg/zx/iommu.cpp", 
+    "pkg/zx/job.cpp", 
+    "pkg/zx/log.cpp", 
+    "pkg/zx/port.cpp", 
+    "pkg/zx/process.cpp", 
+    "pkg/zx/profile.cpp", 
+    "pkg/zx/resource.cpp", 
+    "pkg/zx/socket.cpp", 
+    "pkg/zx/thread.cpp", 
+    "pkg/zx/timer.cpp", 
+    "pkg/zx/vcpu.cpp", 
+    "pkg/zx/vmar.cpp", 
+    "pkg/zx/vmo.cpp", 
+    "pkg/zx/include/lib/zx/bti.h", 
+    "pkg/zx/include/lib/zx/channel.h", 
+    "pkg/zx/include/lib/zx/debuglog.h", 
+    "pkg/zx/include/lib/zx/event.h", 
+    "pkg/zx/include/lib/zx/eventpair.h", 
+    "pkg/zx/include/lib/zx/fifo.h", 
+    "pkg/zx/include/lib/zx/guest.h", 
+    "pkg/zx/include/lib/zx/handle.h", 
+    "pkg/zx/include/lib/zx/interrupt.h", 
+    "pkg/zx/include/lib/zx/iommu.h", 
+    "pkg/zx/include/lib/zx/job.h", 
+    "pkg/zx/include/lib/zx/log.h", 
+    "pkg/zx/include/lib/zx/object.h", 
+    "pkg/zx/include/lib/zx/object_traits.h", 
+    "pkg/zx/include/lib/zx/pmt.h", 
+    "pkg/zx/include/lib/zx/port.h", 
+    "pkg/zx/include/lib/zx/process.h", 
+    "pkg/zx/include/lib/zx/profile.h", 
+    "pkg/zx/include/lib/zx/resource.h", 
+    "pkg/zx/include/lib/zx/socket.h", 
+    "pkg/zx/include/lib/zx/suspend_token.h", 
+    "pkg/zx/include/lib/zx/task.h", 
+    "pkg/zx/include/lib/zx/thread.h", 
+    "pkg/zx/include/lib/zx/time.h", 
+    "pkg/zx/include/lib/zx/timer.h", 
+    "pkg/zx/include/lib/zx/vcpu.h", 
+    "pkg/zx/include/lib/zx/vmar.h", 
+    "pkg/zx/include/lib/zx/vmo.h"
+  ], 
+  "headers": [
+    "pkg/zx/include/lib/zx/bti.h", 
+    "pkg/zx/include/lib/zx/channel.h", 
+    "pkg/zx/include/lib/zx/debuglog.h", 
+    "pkg/zx/include/lib/zx/event.h", 
+    "pkg/zx/include/lib/zx/eventpair.h", 
+    "pkg/zx/include/lib/zx/fifo.h", 
+    "pkg/zx/include/lib/zx/guest.h", 
+    "pkg/zx/include/lib/zx/handle.h", 
+    "pkg/zx/include/lib/zx/interrupt.h", 
+    "pkg/zx/include/lib/zx/iommu.h", 
+    "pkg/zx/include/lib/zx/job.h", 
+    "pkg/zx/include/lib/zx/log.h", 
+    "pkg/zx/include/lib/zx/object.h", 
+    "pkg/zx/include/lib/zx/object_traits.h", 
+    "pkg/zx/include/lib/zx/pmt.h", 
+    "pkg/zx/include/lib/zx/port.h", 
+    "pkg/zx/include/lib/zx/process.h", 
+    "pkg/zx/include/lib/zx/profile.h", 
+    "pkg/zx/include/lib/zx/resource.h", 
+    "pkg/zx/include/lib/zx/socket.h", 
+    "pkg/zx/include/lib/zx/suspend_token.h", 
+    "pkg/zx/include/lib/zx/task.h", 
+    "pkg/zx/include/lib/zx/thread.h", 
+    "pkg/zx/include/lib/zx/time.h", 
+    "pkg/zx/include/lib/zx/timer.h", 
+    "pkg/zx/include/lib/zx/vcpu.h", 
+    "pkg/zx/include/lib/zx/vmar.h", 
+    "pkg/zx/include/lib/zx/vmo.h"
+  ], 
+  "include_dir": "pkg/zx/include", 
+  "name": "zx", 
+  "root": "pkg/zx", 
+  "sources": [
+    "pkg/zx/bti.cpp", 
+    "pkg/zx/channel.cpp", 
+    "pkg/zx/debuglog.cpp", 
+    "pkg/zx/event.cpp", 
+    "pkg/zx/eventpair.cpp", 
+    "pkg/zx/fifo.cpp", 
+    "pkg/zx/guest.cpp", 
+    "pkg/zx/interrupt.cpp", 
+    "pkg/zx/iommu.cpp", 
+    "pkg/zx/job.cpp", 
+    "pkg/zx/log.cpp", 
+    "pkg/zx/port.cpp", 
+    "pkg/zx/process.cpp", 
+    "pkg/zx/profile.cpp", 
+    "pkg/zx/resource.cpp", 
+    "pkg/zx/socket.cpp", 
+    "pkg/zx/thread.cpp", 
+    "pkg/zx/timer.cpp", 
+    "pkg/zx/vcpu.cpp", 
+    "pkg/zx/vmar.cpp", 
+    "pkg/zx/vmo.cpp"
+  ], 
+  "type": "cc_source_library"
+}
\ No newline at end of file
diff --git a/pkg/zx/port.cpp b/pkg/zx/port.cpp
new file mode 100644
index 0000000..f6ca294
--- /dev/null
+++ b/pkg/zx/port.cpp
@@ -0,0 +1,15 @@
+// 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.
+
+#include <lib/zx/port.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t port::create(uint32_t options, port* result) {
+    return zx_port_create(options, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/process.cpp b/pkg/zx/process.cpp
new file mode 100644
index 0000000..c47fa79
--- /dev/null
+++ b/pkg/zx/process.cpp
@@ -0,0 +1,38 @@
+// 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.
+
+#include <lib/zx/process.h>
+
+#include <zircon/syscalls.h>
+
+#include <lib/zx/job.h>
+#include <lib/zx/thread.h>
+#include <lib/zx/vmar.h>
+
+namespace zx {
+
+zx_status_t process::create(const job& job, const char* name, uint32_t name_len,
+                            uint32_t flags, process* proc, vmar* vmar) {
+    // Assume |proc|, |vmar| and |job| must refer to different containers, due
+    // to strict aliasing.
+    return zx_process_create(
+        job.get(), name, name_len, flags, proc->reset_and_get_address(),
+        vmar->reset_and_get_address());
+}
+
+zx_status_t process::start(const thread& thread_handle, uintptr_t entry,
+                           uintptr_t stack, handle arg_handle,
+                           uintptr_t arg2) const {
+    return zx_process_start(get(), thread_handle.get(), entry, stack, arg_handle.release(), arg2);
+}
+
+zx_status_t process::get_child(uint64_t koid, zx_rights_t rights,
+                               thread* result) const {
+    // Assume |result| and |this| are distinct containers, due to strict
+    // aliasing.
+    return zx_object_get_child(
+        value_, koid, rights, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/profile.cpp b/pkg/zx/profile.cpp
new file mode 100644
index 0000000..9e67647
--- /dev/null
+++ b/pkg/zx/profile.cpp
@@ -0,0 +1,16 @@
+// 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.
+
+#include <lib/zx/profile.h>
+
+#include <zircon/syscalls.h>
+#include <zircon/syscalls/profile.h>
+
+namespace zx {
+
+zx_status_t profile::create(const resource& resource, const zx_profile_info_t* info, profile* result) {
+    return zx_profile_create(resource.get(), info, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/resource.cpp b/pkg/zx/resource.cpp
new file mode 100644
index 0000000..8f29841
--- /dev/null
+++ b/pkg/zx/resource.cpp
@@ -0,0 +1,25 @@
+// 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.
+
+#include <lib/zx/resource.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t resource::create(const resource& parent,
+                             uint32_t options,
+                             uint64_t base,
+                             size_t len,
+                             const char* name,
+                             size_t namelen,
+                             resource* result) {
+    resource h;
+    zx_status_t status = zx_resource_create(parent.get(), options, base, len, name, namelen,
+                                            h.reset_and_get_address());
+    result->reset(h.release());
+    return status;
+}
+
+} // namespace zx
diff --git a/pkg/zx/socket.cpp b/pkg/zx/socket.cpp
new file mode 100644
index 0000000..76f5071
--- /dev/null
+++ b/pkg/zx/socket.cpp
@@ -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.
+
+#include <lib/zx/socket.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t socket::create(uint32_t flags, socket* endpoint0,
+                           socket* endpoint1) {
+    // Ensure aliasing of both out parameters to the same container
+    // has a well-defined result, and does not leak.
+    socket h0;
+    socket h1;
+    zx_status_t status = zx_socket_create(
+        flags, h0.reset_and_get_address(),
+        h1.reset_and_get_address());
+    endpoint0->reset(h0.release());
+    endpoint1->reset(h1.release());
+    return status;
+}
+
+} // namespace zx
diff --git a/pkg/zx/thread.cpp b/pkg/zx/thread.cpp
new file mode 100644
index 0000000..4b9ab4c
--- /dev/null
+++ b/pkg/zx/thread.cpp
@@ -0,0 +1,21 @@
+// 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.
+
+#include <lib/zx/thread.h>
+
+#include <zircon/syscalls.h>
+
+#include <lib/zx/process.h>
+
+namespace zx {
+
+zx_status_t thread::create(const process& process, const char* name,
+                           uint32_t name_len, uint32_t flags, thread* result) {
+    // Assume |result| and |process| must refer to different containers, due
+    // to strict aliasing.
+    return zx_thread_create(
+        process.get(), name, name_len, flags, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/timer.cpp b/pkg/zx/timer.cpp
new file mode 100644
index 0000000..f67ddc3
--- /dev/null
+++ b/pkg/zx/timer.cpp
@@ -0,0 +1,15 @@
+// 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.
+
+#include <lib/zx/timer.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t timer::create(uint32_t options, zx_clock_t clock_id, timer* result) {
+    return zx_timer_create(options, clock_id, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/vcpu.cpp b/pkg/zx/vcpu.cpp
new file mode 100644
index 0000000..5584a5e
--- /dev/null
+++ b/pkg/zx/vcpu.cpp
@@ -0,0 +1,19 @@
+// 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.
+
+#include <lib/zx/vcpu.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t vcpu::create(const guest& guest, uint32_t options,
+                         zx_gpaddr_t entry, vcpu* vcpu) {
+    // Assume |guest| and |vcpu| must refer to different containers, due to
+    // strict aliasing.
+    return zx_vcpu_create(guest.get(), options, entry,
+                          vcpu->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/pkg/zx/vmar.cpp b/pkg/zx/vmar.cpp
new file mode 100644
index 0000000..60148f2
--- /dev/null
+++ b/pkg/zx/vmar.cpp
@@ -0,0 +1,21 @@
+// 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.
+
+#include <lib/zx/vmar.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t vmar::allocate(size_t offset, size_t size, zx_vm_option_t options,
+                           vmar* child, uintptr_t* child_addr) const {
+    // Allow for aliasing of |child| to the same container as |this|.
+    vmar h;
+    zx_status_t status = zx_vmar_allocate(
+        get(), options, offset, size, h.reset_and_get_address(), child_addr);
+    child->reset(h.release());
+    return status;
+}
+
+} // namespace zx
diff --git a/pkg/zx/vmo.cpp b/pkg/zx/vmo.cpp
new file mode 100644
index 0000000..130c71f
--- /dev/null
+++ b/pkg/zx/vmo.cpp
@@ -0,0 +1,27 @@
+// 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.
+
+#include <lib/zx/vmo.h>
+#include <lib/zx/bti.h>
+
+#include <zircon/syscalls.h>
+
+namespace zx {
+
+zx_status_t vmo::create(uint64_t size, uint32_t options, vmo* result) {
+    return zx_vmo_create(size, options, result->reset_and_get_address());
+}
+
+zx_status_t vmo::create_contiguous(
+    const bti& bti, size_t size, uint32_t alignment_log2, vmo* result) {
+    return zx_vmo_create_contiguous(bti.get(), size, alignment_log2,
+                                    result->reset_and_get_address());
+}
+
+zx_status_t vmo::create_physical(
+    const resource& resource, zx_paddr_t paddr, size_t size, vmo* result) {
+    return zx_vmo_create_physical(resource.get(), paddr, size, result->reset_and_get_address());
+}
+
+} // namespace zx
diff --git a/tools/bootserver b/tools/bootserver
new file mode 100755
index 0000000..3683705
--- /dev/null
+++ b/tools/bootserver
Binary files differ
diff --git a/tools/bootserver-meta.json b/tools/bootserver-meta.json
new file mode 100644
index 0000000..56c74dc
--- /dev/null
+++ b/tools/bootserver-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/bootserver"
+  ], 
+  "name": "bootserver", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/far b/tools/far
new file mode 100755
index 0000000..2474697
--- /dev/null
+++ b/tools/far
Binary files differ
diff --git a/tools/far-meta.json b/tools/far-meta.json
new file mode 100644
index 0000000..6d75f3b
--- /dev/null
+++ b/tools/far-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/far"
+  ], 
+  "name": "far", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/fidl-format b/tools/fidl-format
new file mode 100755
index 0000000..86609ea
--- /dev/null
+++ b/tools/fidl-format
Binary files differ
diff --git a/tools/fidl-format-meta.json b/tools/fidl-format-meta.json
new file mode 100644
index 0000000..9cf524d
--- /dev/null
+++ b/tools/fidl-format-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/fidl-format"
+  ], 
+  "name": "fidl-format", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/fidlc b/tools/fidlc
new file mode 100755
index 0000000..a0e50cd
--- /dev/null
+++ b/tools/fidlc
Binary files differ
diff --git a/tools/fidlc-meta.json b/tools/fidlc-meta.json
new file mode 100644
index 0000000..53c3a51
--- /dev/null
+++ b/tools/fidlc-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/fidlc"
+  ], 
+  "name": "fidlc", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/fidlgen b/tools/fidlgen
new file mode 100755
index 0000000..cde2208
--- /dev/null
+++ b/tools/fidlgen
Binary files differ
diff --git a/tools/fidlgen-meta.json b/tools/fidlgen-meta.json
new file mode 100644
index 0000000..9fe21f8
--- /dev/null
+++ b/tools/fidlgen-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/fidlgen"
+  ], 
+  "name": "fidlgen", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/fvm b/tools/fvm
new file mode 100755
index 0000000..677d53c
--- /dev/null
+++ b/tools/fvm
Binary files differ
diff --git a/tools/fvm-meta.json b/tools/fvm-meta.json
new file mode 100644
index 0000000..34f476a
--- /dev/null
+++ b/tools/fvm-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/fvm"
+  ], 
+  "name": "fvm", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/loglistener b/tools/loglistener
new file mode 100755
index 0000000..1811b12
--- /dev/null
+++ b/tools/loglistener
Binary files differ
diff --git a/tools/loglistener-meta.json b/tools/loglistener-meta.json
new file mode 100644
index 0000000..e9adaf4
--- /dev/null
+++ b/tools/loglistener-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/loglistener"
+  ], 
+  "name": "loglistener", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/merkleroot b/tools/merkleroot
new file mode 100755
index 0000000..243eb0a
--- /dev/null
+++ b/tools/merkleroot
Binary files differ
diff --git a/tools/merkleroot-meta.json b/tools/merkleroot-meta.json
new file mode 100644
index 0000000..5f68196
--- /dev/null
+++ b/tools/merkleroot-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/merkleroot"
+  ], 
+  "name": "merkleroot", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/minfs b/tools/minfs
new file mode 100755
index 0000000..af3b27b
--- /dev/null
+++ b/tools/minfs
Binary files differ
diff --git a/tools/minfs-meta.json b/tools/minfs-meta.json
new file mode 100644
index 0000000..552d645
--- /dev/null
+++ b/tools/minfs-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/minfs"
+  ], 
+  "name": "minfs", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/netaddr b/tools/netaddr
new file mode 100755
index 0000000..096d8b4
--- /dev/null
+++ b/tools/netaddr
Binary files differ
diff --git a/tools/netaddr-meta.json b/tools/netaddr-meta.json
new file mode 100644
index 0000000..601e966
--- /dev/null
+++ b/tools/netaddr-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/netaddr"
+  ], 
+  "name": "netaddr", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/netcp b/tools/netcp
new file mode 100755
index 0000000..81088e6
--- /dev/null
+++ b/tools/netcp
Binary files differ
diff --git a/tools/netcp-meta.json b/tools/netcp-meta.json
new file mode 100644
index 0000000..37fbb78
--- /dev/null
+++ b/tools/netcp-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/netcp"
+  ], 
+  "name": "netcp", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/netls b/tools/netls
new file mode 100755
index 0000000..77e8612
--- /dev/null
+++ b/tools/netls
Binary files differ
diff --git a/tools/netls-meta.json b/tools/netls-meta.json
new file mode 100644
index 0000000..7c98bca
--- /dev/null
+++ b/tools/netls-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/netls"
+  ], 
+  "name": "netls", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/netruncmd b/tools/netruncmd
new file mode 100755
index 0000000..e26f473
--- /dev/null
+++ b/tools/netruncmd
Binary files differ
diff --git a/tools/netruncmd-meta.json b/tools/netruncmd-meta.json
new file mode 100644
index 0000000..043580b
--- /dev/null
+++ b/tools/netruncmd-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/netruncmd"
+  ], 
+  "name": "netruncmd", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/pm b/tools/pm
new file mode 100755
index 0000000..c7b39e9
--- /dev/null
+++ b/tools/pm
Binary files differ
diff --git a/tools/pm-meta.json b/tools/pm-meta.json
new file mode 100644
index 0000000..65d04fb
--- /dev/null
+++ b/tools/pm-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/pm"
+  ], 
+  "name": "pm", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file
diff --git a/tools/zbi b/tools/zbi
new file mode 100755
index 0000000..e06c212
--- /dev/null
+++ b/tools/zbi
Binary files differ
diff --git a/tools/zbi-meta.json b/tools/zbi-meta.json
new file mode 100644
index 0000000..ce2df6c
--- /dev/null
+++ b/tools/zbi-meta.json
@@ -0,0 +1,8 @@
+{
+  "files": [
+    "tools/zbi"
+  ], 
+  "name": "zbi", 
+  "root": "tools", 
+  "type": "host_tool"
+}
\ No newline at end of file