├── .gitignore ├── README.md ├── install-firehose.sh ├── libdispatch-1008.220.2 ├── firehose │ ├── chunk_private.h │ ├── firehose_types_private.h │ ├── ioctl_private.h │ ├── private.h │ └── tracepoint_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-703.1.4 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-703.20.1 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-703.30.5 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-703.50.37 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-913.1.6 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-913.20.5 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-913.30.4 ├── firehose_buffer_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a ├── libdispatch-913.50.12 ├── firehose │ ├── chunk_private.h │ ├── firehose_types_private.h │ ├── ioctl_private.h │ ├── private.h │ └── tracepoint_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a └── libdispatch-913.60.2 ├── firehose ├── chunk_private.h ├── firehose_types_private.h ├── ioctl_private.h ├── private.h └── tracepoint_private.h ├── libfirehose_kernel.a ├── libfirehose_kernel_debug.a └── libfirehose_kernel_profile.a /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | *~.nib 4 | build/ 5 | Build/ 6 | *.pbxuser 7 | *.perspective 8 | *.perspectivev3 9 | *.mode1v3 10 | *.mode2v3 11 | xcuserdata 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # install firehose library 2 | install firehose(x86_64, arm64) for building xnu-4903.221.2 3 | 4 | check out the code, and run install.sh: 5 | 6 | ``` 7 | ./install-firehose.sh 8 | ``` 9 | 10 | then build xnu-4903.221.2 with Xcode-v10.1. 11 | -------------------------------------------------------------------------------- /install-firehose.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | pushd `dirname $0` > /dev/null 5 | CURRENT_DIR=`pwd` 6 | popd > /dev/null 7 | # ================================================================ # 8 | 9 | # SDK_ROOT=`xcodebuild -version -sdk macosx Path` 10 | SDK_ROOT=`xcodebuild -version -sdk iphoneos Path` 11 | echo "Target SDK Path: ${SDK_ROOT}" 12 | # ================================================================ # 13 | 14 | # LIBDISPATCH_DIR_NAME="libdispatch-703.1.4" 15 | # LIBDISPATCH_DIR_NAME="libdispatch-703.20.1" 16 | # LIBDISPATCH_DIR_NAME="libdispatch-703.30.5" 17 | # LIBDISPATCH_DIR_NAME="libdispatch-703.50.37" 18 | # LIBDISPATCH_DIR_NAME="libdispatch-913.1.6" 19 | # LIBDISPATCH_DIR_NAME="libdispatch-913.20.5" 20 | # LIBDISPATCH_DIR_NAME="libdispatch-913.30.4" 21 | # LIBDISPATCH_DIR_NAME="libdispatch-913.50.12" 22 | # LIBDISPATCH_DIR_NAME="libdispatch-913.60.2" 23 | LIBDISPATCH_DIR_NAME="libdispatch-1008.220.2" 24 | 25 | echo "Install: ${LIBDISPATCH_DIR_NAME}" 26 | # ================================================================ # 27 | 28 | TARGET_HEADER_DIR="${SDK_ROOT}/usr/local/include/firehose" 29 | TARGET_LIB_DIR="${SDK_ROOT}/usr/local/lib/kernel" 30 | 31 | echo "Dest Header Dir: ${TARGET_HEADER_DIR}" 32 | echo "Dest Library Dir: ${TARGET_LIB_DIR}" 33 | # ================================================================ # 34 | 35 | mkdir -p "${TARGET_HEADER_DIR}" 36 | mkdir -p "${TARGET_LIB_DIR}" 37 | # ================================================================ # 38 | 39 | ditto "${CURRENT_DIR}/${LIBDISPATCH_DIR_NAME}/firehose" "${TARGET_HEADER_DIR}" 40 | cp -rf "${CURRENT_DIR}/${LIBDISPATCH_DIR_NAME}"/libfirehose_kernel*.a "${TARGET_LIB_DIR}/" 41 | # ================================================================ # 42 | 43 | echo "======== Done ========" 44 | # ================================================================ # 45 | -------------------------------------------------------------------------------- /libdispatch-1008.220.2/firehose/chunk_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_CHUNK_PRIVATE__ 22 | #define __FIREHOSE_CHUNK_PRIVATE__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "firehose_types_private.h" 28 | #include "tracepoint_private.h" 29 | 30 | __BEGIN_DECLS 31 | 32 | #define FIREHOSE_CHUNK_SIZE 4096ul 33 | 34 | #define FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC (1ULL << 0) 35 | #define FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC (1ULL << 16) 36 | #define FIREHOSE_CHUNK_POS_REFCNT_INC (1ULL << 32) 37 | #define FIREHOSE_CHUNK_POS_FULL_BIT (1ULL << 56) 38 | #define FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(pos, stream) \ 39 | ((((pos).fcp_pos >> 48) & 0x1ff) == (uint16_t)stream) 40 | 41 | typedef union { 42 | _Atomic(uint64_t) fcp_atomic_pos; 43 | uint64_t fcp_pos; 44 | struct { 45 | uint16_t fcp_next_entry_offs; 46 | uint16_t fcp_private_offs; 47 | uint8_t fcp_refcnt; 48 | uint8_t fcp_qos; 49 | uint8_t fcp_stream; 50 | uint8_t fcp_flag_full : 1; 51 | uint8_t fcp_flag_io : 1; 52 | uint8_t fcp_quarantined : 1; 53 | uint8_t _fcp_flag_unused : 5; 54 | }; 55 | } firehose_chunk_pos_u; 56 | 57 | typedef struct firehose_chunk_s { 58 | uint8_t fc_start[0]; 59 | firehose_chunk_pos_u fc_pos; 60 | uint64_t fc_timestamp; 61 | uint8_t fc_data[FIREHOSE_CHUNK_SIZE - 8 - 8]; 62 | } *firehose_chunk_t; 63 | 64 | typedef struct firehose_chunk_range_s { 65 | uint16_t fcr_offset; // offset from the start of the chunk 66 | uint16_t fcr_length; 67 | } *firehose_chunk_range_t; 68 | 69 | #if defined(KERNEL) || defined(OS_FIREHOSE_SPI) 70 | 71 | OS_ALWAYS_INLINE 72 | static inline bool 73 | firehose_chunk_pos_fits(firehose_chunk_pos_u pos, uint16_t size) 74 | { 75 | return pos.fcp_next_entry_offs + size <= pos.fcp_private_offs; 76 | } 77 | 78 | #define FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE (-1) 79 | #define FIREHOSE_CHUNK_TRY_RESERVE_FAIL ( 0) 80 | 81 | OS_ALWAYS_INLINE 82 | static inline long 83 | firehose_chunk_tracepoint_try_reserve(firehose_chunk_t fc, uint64_t stamp, 84 | firehose_stream_t stream, uint8_t qos, uint16_t pubsize, 85 | uint16_t privsize, uint8_t **privptr) 86 | { 87 | const uint16_t ft_size = offsetof(struct firehose_tracepoint_s, ft_data); 88 | firehose_chunk_pos_u orig, pos; 89 | bool reservation_failed, stamp_delta_fits; 90 | 91 | stamp_delta_fits = ((stamp - fc->fc_timestamp) >> 48) == 0; 92 | 93 | // no acquire barrier because the returned space is written to only 94 | os_atomic_rmw_loop(&fc->fc_pos.fcp_atomic_pos, 95 | orig.fcp_pos, pos.fcp_pos, relaxed, { 96 | if (orig.fcp_pos == 0) { 97 | // we acquired a really really old reference, and we probably 98 | // just faulted in a new page 99 | os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL); 100 | } 101 | if (!FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(orig, stream)) { 102 | // nothing to do if the chunk is full, or the stream doesn't match, 103 | // in which case the thread probably: 104 | // - loaded the chunk ref 105 | // - been suspended a long while 106 | // - read the chunk to find a very old thing 107 | os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL); 108 | } 109 | pos = orig; 110 | if (!firehose_chunk_pos_fits(orig, 111 | ft_size + pubsize + privsize) || !stamp_delta_fits) { 112 | pos.fcp_flag_full = true; 113 | reservation_failed = true; 114 | } else { 115 | if (qos > pos.fcp_qos) pos.fcp_qos = qos; 116 | // using these *_INC macros is so that the compiler generates better 117 | // assembly: using the struct individual fields forces the compiler 118 | // to handle carry propagations, and we know it won't happen 119 | pos.fcp_pos += roundup(ft_size + pubsize, 8) * 120 | FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC; 121 | pos.fcp_pos -= privsize * FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC; 122 | pos.fcp_pos += FIREHOSE_CHUNK_POS_REFCNT_INC; 123 | const uint16_t minimum_payload_size = 16; 124 | if (!firehose_chunk_pos_fits(pos, 125 | roundup(ft_size + minimum_payload_size , 8))) { 126 | // if we can't even have minimum_payload_size bytes of payload 127 | // for the next tracepoint, just flush right away 128 | pos.fcp_flag_full = true; 129 | } 130 | reservation_failed = false; 131 | } 132 | }); 133 | 134 | if (reservation_failed) { 135 | if (pos.fcp_refcnt) { 136 | // nothing to do, there is a thread writing that will pick up 137 | // the "FULL" flag on flush and push as a consequence 138 | return FIREHOSE_CHUNK_TRY_RESERVE_FAIL; 139 | } 140 | // caller must enqueue chunk 141 | return FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE; 142 | } 143 | if (privptr) { 144 | *privptr = fc->fc_start + pos.fcp_private_offs; 145 | } 146 | return orig.fcp_next_entry_offs; 147 | } 148 | 149 | OS_ALWAYS_INLINE 150 | static inline firehose_tracepoint_t 151 | firehose_chunk_tracepoint_begin(firehose_chunk_t fc, uint64_t stamp, 152 | uint16_t pubsize, uint64_t thread_id, long offset) 153 | { 154 | firehose_tracepoint_t ft = (firehose_tracepoint_t) 155 | __builtin_assume_aligned(fc->fc_start + offset, 8); 156 | stamp -= fc->fc_timestamp; 157 | stamp |= (uint64_t)pubsize << 48; 158 | // The compiler barrier is needed for userland process death handling, see 159 | // (tracepoint-begin) in libdispatch's firehose_buffer_stream_chunk_install. 160 | atomic_store_explicit(&ft->ft_atomic_stamp_and_length, stamp, 161 | memory_order_relaxed); 162 | __asm__ __volatile__("" ::: "memory"); 163 | ft->ft_thread = thread_id; 164 | return ft; 165 | } 166 | 167 | OS_ALWAYS_INLINE 168 | static inline bool 169 | firehose_chunk_tracepoint_end(firehose_chunk_t fc, 170 | firehose_tracepoint_t ft, firehose_tracepoint_id_u ftid) 171 | { 172 | firehose_chunk_pos_u pos; 173 | 174 | atomic_store_explicit(&ft->ft_id.ftid_atomic_value, 175 | ftid.ftid_value, memory_order_release); 176 | pos.fcp_pos = atomic_fetch_sub_explicit(&fc->fc_pos.fcp_atomic_pos, 177 | FIREHOSE_CHUNK_POS_REFCNT_INC, memory_order_relaxed); 178 | return pos.fcp_refcnt == 1 && pos.fcp_flag_full; 179 | } 180 | 181 | #endif // defined(KERNEL) || defined(OS_FIREHOSE_SPI) 182 | 183 | __END_DECLS 184 | 185 | #endif // __FIREHOSE_CHUNK_PRIVATE__ 186 | -------------------------------------------------------------------------------- /libdispatch-1008.220.2/firehose/firehose_types_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_TYPES_PRIVATE__ 22 | #define __FIREHOSE_TYPES_PRIVATE__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | OS_ASSUME_NONNULL_BEGIN 29 | 30 | __BEGIN_DECLS 31 | 32 | /*! 33 | * @enum firehose_activity_flags_t 34 | * 35 | * @discussion 36 | * The lower 8 bits are or-ed in the upper 8 bits of Activity ID and propagated 37 | * to children activities 38 | */ 39 | OS_ENUM(firehose_activity_flags, unsigned long, 40 | firehose_activity_flags_default = 0x0000, 41 | 42 | firehose_activity_flags_info_mode = 0x0001, 43 | firehose_activity_flags_debug_mode = 0x0002, 44 | firehose_activity_flags_stream_live_mode = 0x0004, 45 | 46 | firehose_activity_flags_precise_timestamp = 0x0080, 47 | ); 48 | 49 | /*! 50 | * @typedef firehose_activity_id_t 51 | * 52 | * @abstract 53 | * Opaque activity identifier. 54 | * 55 | * @discussion 56 | * Scalar value type, not reference counted. 57 | */ 58 | typedef uint64_t firehose_activity_id_t; 59 | #define FIREHOSE_ACTIVITY_ID_NULL ((firehose_activity_id_t)0) 60 | #define FIREHOSE_ACTIVITY_ID_INVALID ((firehose_activity_id_t)~0ULL) 61 | #define FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT 56 62 | #define FIREHOSE_ACTIVITY_ID_FLAGS(aid) \ 63 | ((firehose_activity_flags_t)((aid) >> FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT)) 64 | #define FIREHOSE_ACTIVITY_ID_MERGE_FLAGS(aid, flags) (\ 65 | ((firehose_activity_id_t)(aid)) | \ 66 | ((firehose_activity_id_t)(flags) << FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT)) 67 | 68 | /*! 69 | * @enum firehose_stream_t 70 | */ 71 | OS_ENUM(firehose_stream, uint8_t, 72 | firehose_stream_persist = 0, 73 | firehose_stream_special = 1, 74 | firehose_stream_memory = 2, 75 | firehose_stream_metadata = 3, 76 | firehose_stream_signpost = 4, 77 | firehose_stream_memory_wifi = 5, 78 | firehose_stream_memory_baseband = 6, 79 | 80 | _firehose_stream_max, 81 | ); 82 | 83 | /*! 84 | * @enum firehose_tracepoint_namespace_t 85 | * 86 | * @abstract 87 | * Namespaces of tracepoints. 88 | */ 89 | OS_ENUM(firehose_tracepoint_namespace, uint8_t, 90 | firehose_tracepoint_namespace_activity = 0x02, 91 | firehose_tracepoint_namespace_trace = 0x03, 92 | firehose_tracepoint_namespace_log = 0x04, 93 | firehose_tracepoint_namespace_metadata = 0x05, 94 | firehose_tracepoint_namespace_signpost = 0x06, 95 | firehose_tracepoint_namespace_loss = 0x07, 96 | ); 97 | 98 | /*! 99 | * @enum firehose_tracepoint_code_t 100 | * 101 | * @abstract 102 | * Codes of tracepoints. 103 | */ 104 | OS_ENUM(firehose_tracepoint_code, uint32_t, 105 | firehose_tracepoint_code_load = 0x01, 106 | firehose_tracepoint_code_unload = 0x02, 107 | ); 108 | 109 | /*! 110 | * @typedef firehose_tracepoint_type_t 111 | * 112 | * @abstract 113 | * Type of tracepoints. 114 | */ 115 | typedef uint8_t firehose_tracepoint_type_t; 116 | 117 | /*! 118 | * @typedef firehose_tracepoint_flags_t 119 | * 120 | * @abstract 121 | * Flags for tracepoints. 122 | */ 123 | OS_ENUM(firehose_tracepoint_flags, uint16_t, 124 | _firehose_tracepoint_flags_base_has_current_aid = 0x0001, 125 | #define _firehose_tracepoint_flags_pc_style_mask (0x0007 << 1) 126 | _firehose_tracepoint_flags_pc_style_none = 0x0000 << 1, 127 | _firehose_tracepoint_flags_pc_style_main_exe = 0x0001 << 1, 128 | _firehose_tracepoint_flags_pc_style_shared_cache = 0x0002 << 1, 129 | _firehose_tracepoint_flags_pc_style_main_plugin = 0x0003 << 1, 130 | _firehose_tracepoint_flags_pc_style_absolute = 0x0004 << 1, 131 | _firehose_tracepoint_flags_pc_style_uuid_relative = 0x0005 << 1, 132 | _firehose_tracepoint_flags_pc_style__unused6 = 0x0006 << 1, 133 | _firehose_tracepoint_flags_pc_style__unused7 = 0x0007 << 1, 134 | _firehose_tracepoint_flags_base_has_unique_pid = 0x0010, 135 | ); 136 | 137 | /*! 138 | * @typedef firehose_tracepoint_id_t 139 | * 140 | * @abstract 141 | * Opaque tracepoint identifier. 142 | */ 143 | typedef uint64_t firehose_tracepoint_id_t; 144 | 145 | /*! 146 | * @enum _firehose_tracepoint_type_activity_t 147 | * 148 | * @abstract 149 | * Types of Activity tracepoints (namespace activity). 150 | */ 151 | OS_ENUM(_firehose_tracepoint_type_activity, firehose_tracepoint_type_t, 152 | _firehose_tracepoint_type_activity_create = 0x01, 153 | _firehose_tracepoint_type_activity_swap = 0x02, 154 | _firehose_tracepoint_type_activity_useraction = 0x03, 155 | ); 156 | 157 | /*! 158 | * @enum firehose_tracepoint_flags_activity_t 159 | * 160 | * @abstract 161 | * Flags for Activity tracepoints (namespace activity). 162 | */ 163 | OS_ENUM(_firehose_tracepoint_flags_activity, uint16_t, 164 | _firehose_tracepoint_flags_activity_user_interface = 0x0100, 165 | _firehose_tracepoint_flags_activity_has_other_aid = 0x0200, 166 | ); 167 | 168 | /*! 169 | * @enum firehose_tracepoint_type_trace_t 170 | * 171 | * @abstract 172 | * Types of trace tracepoints (namespace trace). 173 | */ 174 | OS_ENUM(_firehose_tracepoint_type_trace, firehose_tracepoint_type_t, 175 | _firehose_tracepoint_type_trace_default = 0x00, 176 | _firehose_tracepoint_type_trace_info = 0x01, 177 | _firehose_tracepoint_type_trace_debug = 0x02, 178 | _firehose_tracepoint_type_trace_error = 0x10, 179 | _firehose_tracepoint_type_trace_fault = 0x11, 180 | ); 181 | 182 | /*! 183 | * @enum firehose_tracepoint_type_log_t 184 | * 185 | * @abstract 186 | * Types of Log tracepoints (namespace log). 187 | */ 188 | OS_ENUM(_firehose_tracepoint_type_log, firehose_tracepoint_type_t, 189 | _firehose_tracepoint_type_log_default = 0x00, 190 | _firehose_tracepoint_type_log_info = 0x01, 191 | _firehose_tracepoint_type_log_debug = 0x02, 192 | _firehose_tracepoint_type_log_error = 0x10, 193 | _firehose_tracepoint_type_log_fault = 0x11, 194 | ); 195 | 196 | /*! 197 | * @enum firehose_tracepoint_flags_log_t 198 | * 199 | * @abstract 200 | * Flags for Log tracepoints (namespace log). 201 | */ 202 | OS_ENUM(_firehose_tracepoint_flags_log, uint16_t, 203 | _firehose_tracepoint_flags_log_has_private_data = 0x0100, 204 | _firehose_tracepoint_flags_log_has_subsystem = 0x0200, 205 | _firehose_tracepoint_flags_log_has_rules = 0x0400, 206 | _firehose_tracepoint_flags_log_has_oversize = 0x0800, 207 | _firehose_tracepoint_flags_log_has_context_data = 0x1000, 208 | ); 209 | 210 | /*! 211 | * @enum _firehose_tracepoint_type_metadata_t 212 | * 213 | * @abstract 214 | * Types for metadata tracepoints (namespace metadata). 215 | */ 216 | OS_ENUM(_firehose_tracepoint_type_metadata, firehose_tracepoint_type_t, 217 | _firehose_tracepoint_type_metadata_dyld = 0x01, 218 | _firehose_tracepoint_type_metadata_subsystem = 0x02, 219 | _firehose_tracepoint_type_metadata_kext = 0x03, 220 | ); 221 | 222 | /*! 223 | * @enum firehose_tracepoint_type_signpost_t 224 | * 225 | * @abstract 226 | * Types of Log tracepoints (namespace signpost). 227 | */ 228 | OS_ENUM(_firehose_tracepoint_type_signpost, firehose_tracepoint_type_t, 229 | _firehose_tracepoint_type_signpost_event = 0x00, 230 | _firehose_tracepoint_type_signpost_interval_begin = 0x01, 231 | _firehose_tracepoint_type_signpost_interval_end = 0x02, 232 | 233 | _firehose_tracepoint_type_signpost_scope_mask = 0xc0, 234 | _firehose_tracepoint_type_signpost_scope_thread = 0x40, 235 | _firehose_tracepoint_type_signpost_scope_process = 0x80, 236 | _firehose_tracepoint_type_signpost_scope_system = 0xc0, 237 | ); 238 | 239 | /*! 240 | * @enum firehose_tracepoint_flags_signpost_t 241 | * 242 | * @abstract 243 | * Flags for Log tracepoints (namespace signpost). 244 | * 245 | * When flags are shared with the log type, they should have the same values. 246 | */ 247 | OS_ENUM(_firehose_tracepoint_flags_signpost, uint16_t, 248 | _firehose_tracepoint_flags_signpost_has_private_data = 0x0100, 249 | _firehose_tracepoint_flags_signpost_has_subsystem = 0x0200, 250 | _firehose_tracepoint_flags_signpost_has_rules = 0x0400, 251 | _firehose_tracepoint_flags_signpost_has_oversize = 0x0800, 252 | _firehose_tracepoint_flags_signpost_has_context_data = 0x1000, 253 | ); 254 | 255 | /* MIG firehose push reply structure */ 256 | typedef struct firehose_push_reply_s { 257 | uint64_t fpr_mem_flushed_pos; 258 | uint64_t fpr_io_flushed_pos; 259 | } firehose_push_reply_t; 260 | 261 | typedef struct firehose_buffer_map_info_s { 262 | mach_vm_address_t fbmi_addr; 263 | mach_vm_size_t fbmi_size; 264 | } firehose_buffer_map_info_t; 265 | 266 | #define FIREHOSE_PUSH_REPLY_CORRUPTED ((firehose_push_reply_t){ ~0ULL, ~0ULL }) 267 | 268 | typedef union firehose_buffer_u *firehose_buffer_t; 269 | 270 | __END_DECLS 271 | 272 | OS_ASSUME_NONNULL_END 273 | 274 | #endif // __FIREHOSE_TYPES_PRIVATE__ 275 | -------------------------------------------------------------------------------- /libdispatch-1008.220.2/firehose/ioctl_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_IOCTL_PRIVATE__ 22 | #define __FIREHOSE_IOCTL_PRIVATE__ 23 | 24 | #include 25 | #include "firehose_types_private.h" 26 | 27 | // Ioctls implemented by the oslog dev node 28 | 29 | /* Flushed the log data. Return the updated pointers */ 30 | #ifndef LOGFLUSHED 31 | #define LOGFLUSHED _IOW('t', 81, firehose_push_reply_t) 32 | #endif 33 | 34 | /* Map the kernel log buffers to logd's address space */ 35 | #ifndef LOGREGISTER 36 | #define LOGREGISTER _IOR('t', 80, int) 37 | #endif 38 | 39 | /* Map the kernel log buffers to logd's address space */ 40 | #ifndef LOGBUFFERMAP 41 | #define LOGBUFFERMAP _IOR('t', 79, firehose_buffer_map_info_t) 42 | #endif 43 | 44 | #endif // __FIREHOSE_IOCTL_PRIVATE__ 45 | -------------------------------------------------------------------------------- /libdispatch-1008.220.2/firehose/private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_FIREHOSE_PRIVATE__ 22 | #define __FIREHOSE_FIREHOSE_PRIVATE__ 23 | 24 | #define FIREHOSE_SPI_VERSION 20180416 25 | 26 | #include "firehose_types_private.h" 27 | #include "tracepoint_private.h" 28 | #include "ioctl_private.h" 29 | #include "chunk_private.h" 30 | 31 | #endif // __FIREHOSE_FIREHOSE_PRIVATE__ 32 | -------------------------------------------------------------------------------- /libdispatch-1008.220.2/firehose/tracepoint_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_ACTIVITY__ 22 | #define __FIREHOSE_ACTIVITY__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "firehose_types_private.h" 28 | 29 | OS_ASSUME_NONNULL_BEGIN 30 | 31 | /*! 32 | * @typedef firehose_tracepoint_id_u 33 | * 34 | * @abstract 35 | * Broken down tracepoint identifier. 36 | */ 37 | typedef union { 38 | struct { 39 | firehose_tracepoint_namespace_t _namespace; 40 | firehose_tracepoint_type_t _type; 41 | firehose_tracepoint_flags_t _flags; 42 | uint32_t _code; 43 | } ftid; 44 | firehose_tracepoint_id_t ftid_value; 45 | _Atomic(firehose_tracepoint_id_t) ftid_atomic_value; 46 | } firehose_tracepoint_id_u; 47 | 48 | #define FIREHOSE_STAMP_SLOP (1ULL << 36) // ~1minute 49 | 50 | /*! 51 | * @typedef firehose_trace_uuid_info_t 52 | * 53 | * @abstract 54 | * Info needed by logd when kexts are loaded or unloaded 55 | * 56 | */ 57 | typedef struct firehose_trace_uuid_info_s { 58 | uuid_t ftui_uuid; /* uuid of binary */ 59 | uint64_t ftui_address; /* load address */ 60 | uint64_t ftui_size; /* load size */ 61 | char ftui_path[]; /* full path of binary - Unused in the kernel*/ 62 | } *firehose_trace_uuid_info_t; 63 | 64 | /*! 65 | * @typedef firehose_tracepoint_t 66 | */ 67 | typedef struct firehose_tracepoint_s { 68 | firehose_tracepoint_id_u ft_id; 69 | uint64_t ft_thread; 70 | union { 71 | struct { 72 | uint64_t ft_timestamp_delta : 48; 73 | uint64_t ft_length : 16; 74 | }; 75 | uint64_t ft_stamp_and_length; 76 | _Atomic(uint64_t) ft_atomic_stamp_and_length; 77 | }; 78 | uint8_t ft_data[]; 79 | } *firehose_tracepoint_t; 80 | 81 | #define FIREHOSE_TRACE_ID_MAKE(ns, type, flags, code) \ 82 | (((firehose_tracepoint_id_u){ .ftid = { \ 83 | ._namespace = ns, \ 84 | ._type = type, \ 85 | ._flags = flags, \ 86 | ._code = code, \ 87 | } }).ftid_value) 88 | 89 | #define FIREHOSE_TRACE_ID_SET_NS(tid, ns) \ 90 | ((tid).ftid._namespace = firehose_tracepoint_namespace_##ns) 91 | 92 | #define FIREHOSE_TRACE_ID_SET_TYPE(tid, ns, type) \ 93 | ((tid).ftid._type = _firehose_tracepoint_type_##ns##_##type) 94 | 95 | #define FIREHOSE_TRACE_ID_PC_STYLE(tid) \ 96 | ((tid).ftid._flags & _firehose_tracepoint_flags_pc_style_mask) 97 | 98 | #define FIREHOSE_TRACE_ID_SET_PC_STYLE(tid, flag) ({ \ 99 | firehose_tracepoint_id_u _tmp_tid = (tid); \ 100 | _tmp_tid.ftid._flags &= ~_firehose_tracepoint_flags_pc_style_mask; \ 101 | _tmp_tid.ftid._flags |= _firehose_tracepoint_flags_pc_style_##flag; \ 102 | }) 103 | 104 | #define FIREHOSE_TRACE_ID_HAS_FLAG(tid, ns, flag) \ 105 | ((tid).ftid._flags & _firehose_tracepoint_flags_##ns##_##flag) 106 | #define FIREHOSE_TRACE_ID_SET_FLAG(tid, ns, flag) \ 107 | ((void)((tid).ftid._flags |= _firehose_tracepoint_flags_##ns##_##flag)) 108 | #define FIREHOSE_TRACE_ID_CLEAR_FLAG(tid, ns, flag) \ 109 | ((void)((tid).ftid._flags &= ~_firehose_tracepoint_flags_##ns##_##flag)) 110 | 111 | #define FIREHOSE_TRACE_ID_SET_CODE(tid, code) \ 112 | ((tid).ftid._code = code) 113 | 114 | /*! 115 | * @typedef firehose_loss_payload_s 116 | * 117 | * @abstract 118 | * The payload for tracepoints in the loss namespace, generated by the firehose 119 | * itself when unreliable tracepoints are lost. 120 | */ 121 | typedef struct firehose_loss_payload_s { 122 | uint64_t start_stamp; /* may (rarely!) disagree with the tracepoint stamp */ 123 | uint64_t end_stamp; 124 | #define FIREHOSE_LOSS_COUNT_WIDTH 6 /* as many bits as can be spared */ 125 | #define FIREHOSE_LOSS_COUNT_MAX ((1u << FIREHOSE_LOSS_COUNT_WIDTH) - 1) 126 | uint32_t count; 127 | } firehose_loss_payload_s, *firehose_loss_payload_t; 128 | 129 | __BEGIN_DECLS 130 | 131 | #if __has_feature(address_sanitizer) 132 | __attribute__((no_sanitize("address"))) 133 | #endif 134 | __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) 135 | __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) 136 | OS_ALWAYS_INLINE 137 | static inline bool 138 | firehose_precise_timestamps_enabled(void) 139 | { 140 | return (*((volatile uint32_t *)_COMM_PAGE_ATM_DIAGNOSTIC_CONFIG) & 0x80) == 0; 141 | } 142 | 143 | #if __has_feature(address_sanitizer) 144 | __attribute__((no_sanitize("address"))) 145 | #endif 146 | __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) 147 | __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) 148 | OS_ALWAYS_INLINE 149 | static inline uint64_t 150 | firehose_tracepoint_time(firehose_activity_flags_t flags) 151 | { 152 | if (firehose_precise_timestamps_enabled() || 153 | (flags & firehose_activity_flags_precise_timestamp)) { 154 | return mach_continuous_time(); 155 | } else { 156 | return mach_continuous_approximate_time(); 157 | } 158 | } 159 | 160 | __END_DECLS 161 | 162 | OS_ASSUME_NONNULL_END 163 | 164 | #endif // __FIREHOSE_FIREHOSE__ 165 | -------------------------------------------------------------------------------- /libdispatch-1008.220.2/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-1008.220.2/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-1008.220.2/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-1008.220.2/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-1008.220.2/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-1008.220.2/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-703.1.4/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20160318 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_CHUNK_SIZE 4096ul 35 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 36 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 37 | 38 | typedef union { 39 | uint64_t fbc_atomic_pos; 40 | #define FIREHOSE_BUFFER_POS_ENTRY_OFFS_INC (1ULL << 0) 41 | #define FIREHOSE_BUFFER_POS_PRIVATE_OFFS_INC (1ULL << 16) 42 | #define FIREHOSE_BUFFER_POS_REFCNT_INC (1ULL << 32) 43 | #define FIREHOSE_BUFFER_POS_FULL_BIT (1ULL << 56) 44 | #define FIREHOSE_BUFFER_POS_USABLE_FOR_STREAM(pos, stream) \ 45 | ((((pos).fbc_atomic_pos >> 48) & 0x1ff) == (uint16_t)stream) 46 | struct { 47 | uint16_t fbc_next_entry_offs; 48 | uint16_t fbc_private_offs; 49 | uint8_t fbc_refcnt; 50 | uint8_t fbc_qos_bits; 51 | uint8_t fbc_stream; 52 | uint8_t fbc_flag_full : 1; 53 | uint8_t fbc_flag_io : 1; 54 | uint8_t _fbc_flag_unused : 6; 55 | }; 56 | } firehose_buffer_pos_u; 57 | 58 | typedef struct firehose_buffer_chunk_s { 59 | uint8_t fbc_start[0]; 60 | firehose_buffer_pos_u volatile fbc_pos; 61 | uint64_t fbc_timestamp; 62 | uint8_t fbc_data[FIREHOSE_BUFFER_CHUNK_SIZE 63 | - sizeof(firehose_buffer_pos_u) 64 | - sizeof(uint64_t)]; 65 | } __attribute__((aligned(8))) *firehose_buffer_chunk_t; 66 | 67 | typedef struct firehose_buffer_range_s { 68 | uint16_t fbr_offset; // offset from the start of the buffer 69 | uint16_t fbr_length; 70 | } *firehose_buffer_range_t; 71 | 72 | 73 | // implemented by the kernel 74 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 75 | extern void __firehose_critical_region_enter(void); 76 | extern void __firehose_critical_region_leave(void); 77 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 78 | 79 | // exported for the kernel 80 | firehose_tracepoint_t 81 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 82 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 83 | 84 | firehose_tracepoint_t 85 | __firehose_buffer_tracepoint_reserve_with_chunk(firehose_buffer_chunk_t fbc, 86 | uint64_t stamp, firehose_stream_t stream, 87 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 88 | 89 | void 90 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 91 | firehose_tracepoint_id_u vatid); 92 | 93 | void 94 | __firehose_buffer_tracepoint_flush_chunk(firehose_buffer_chunk_t fbc, 95 | firehose_tracepoint_t vat, firehose_tracepoint_id_u vatid); 96 | 97 | firehose_buffer_t 98 | __firehose_buffer_create(size_t *size); 99 | 100 | void 101 | __firehose_merge_updates(firehose_push_reply_t update); 102 | 103 | 104 | 105 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 106 | -------------------------------------------------------------------------------- /libdispatch-703.1.4/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.1.4/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-703.1.4/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.1.4/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-703.1.4/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.1.4/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-703.20.1/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20160318 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_CHUNK_SIZE 4096ul 35 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 36 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 37 | 38 | typedef union { 39 | uint64_t fbc_atomic_pos; 40 | #define FIREHOSE_BUFFER_POS_ENTRY_OFFS_INC (1ULL << 0) 41 | #define FIREHOSE_BUFFER_POS_PRIVATE_OFFS_INC (1ULL << 16) 42 | #define FIREHOSE_BUFFER_POS_REFCNT_INC (1ULL << 32) 43 | #define FIREHOSE_BUFFER_POS_FULL_BIT (1ULL << 56) 44 | #define FIREHOSE_BUFFER_POS_USABLE_FOR_STREAM(pos, stream) \ 45 | ((((pos).fbc_atomic_pos >> 48) & 0x1ff) == (uint16_t)stream) 46 | struct { 47 | uint16_t fbc_next_entry_offs; 48 | uint16_t fbc_private_offs; 49 | uint8_t fbc_refcnt; 50 | uint8_t fbc_qos_bits; 51 | uint8_t fbc_stream; 52 | uint8_t fbc_flag_full : 1; 53 | uint8_t fbc_flag_io : 1; 54 | uint8_t _fbc_flag_unused : 6; 55 | }; 56 | } firehose_buffer_pos_u; 57 | 58 | typedef struct firehose_buffer_chunk_s { 59 | uint8_t fbc_start[0]; 60 | firehose_buffer_pos_u volatile fbc_pos; 61 | uint64_t fbc_timestamp; 62 | uint8_t fbc_data[FIREHOSE_BUFFER_CHUNK_SIZE 63 | - sizeof(firehose_buffer_pos_u) 64 | - sizeof(uint64_t)]; 65 | } __attribute__((aligned(8))) *firehose_buffer_chunk_t; 66 | 67 | typedef struct firehose_buffer_range_s { 68 | uint16_t fbr_offset; // offset from the start of the buffer 69 | uint16_t fbr_length; 70 | } *firehose_buffer_range_t; 71 | 72 | 73 | // implemented by the kernel 74 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 75 | extern void __firehose_critical_region_enter(void); 76 | extern void __firehose_critical_region_leave(void); 77 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 78 | 79 | // exported for the kernel 80 | firehose_tracepoint_t 81 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 82 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 83 | 84 | firehose_tracepoint_t 85 | __firehose_buffer_tracepoint_reserve_with_chunk(firehose_buffer_chunk_t fbc, 86 | uint64_t stamp, firehose_stream_t stream, 87 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 88 | 89 | void 90 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 91 | firehose_tracepoint_id_u vatid); 92 | 93 | void 94 | __firehose_buffer_tracepoint_flush_chunk(firehose_buffer_chunk_t fbc, 95 | firehose_tracepoint_t vat, firehose_tracepoint_id_u vatid); 96 | 97 | firehose_buffer_t 98 | __firehose_buffer_create(size_t *size); 99 | 100 | void 101 | __firehose_merge_updates(firehose_push_reply_t update); 102 | 103 | 104 | 105 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 106 | -------------------------------------------------------------------------------- /libdispatch-703.20.1/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.20.1/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-703.20.1/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.20.1/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-703.20.1/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.20.1/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-703.30.5/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20160318 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_CHUNK_SIZE 4096ul 35 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 36 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 37 | 38 | typedef union { 39 | uint64_t fbc_atomic_pos; 40 | #define FIREHOSE_BUFFER_POS_ENTRY_OFFS_INC (1ULL << 0) 41 | #define FIREHOSE_BUFFER_POS_PRIVATE_OFFS_INC (1ULL << 16) 42 | #define FIREHOSE_BUFFER_POS_REFCNT_INC (1ULL << 32) 43 | #define FIREHOSE_BUFFER_POS_FULL_BIT (1ULL << 56) 44 | #define FIREHOSE_BUFFER_POS_USABLE_FOR_STREAM(pos, stream) \ 45 | ((((pos).fbc_atomic_pos >> 48) & 0x1ff) == (uint16_t)stream) 46 | struct { 47 | uint16_t fbc_next_entry_offs; 48 | uint16_t fbc_private_offs; 49 | uint8_t fbc_refcnt; 50 | uint8_t fbc_qos_bits; 51 | uint8_t fbc_stream; 52 | uint8_t fbc_flag_full : 1; 53 | uint8_t fbc_flag_io : 1; 54 | uint8_t _fbc_flag_unused : 6; 55 | }; 56 | } firehose_buffer_pos_u; 57 | 58 | typedef struct firehose_buffer_chunk_s { 59 | uint8_t fbc_start[0]; 60 | firehose_buffer_pos_u volatile fbc_pos; 61 | uint64_t fbc_timestamp; 62 | uint8_t fbc_data[FIREHOSE_BUFFER_CHUNK_SIZE 63 | - sizeof(firehose_buffer_pos_u) 64 | - sizeof(uint64_t)]; 65 | } __attribute__((aligned(8))) *firehose_buffer_chunk_t; 66 | 67 | typedef struct firehose_buffer_range_s { 68 | uint16_t fbr_offset; // offset from the start of the buffer 69 | uint16_t fbr_length; 70 | } *firehose_buffer_range_t; 71 | 72 | 73 | // implemented by the kernel 74 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 75 | extern void __firehose_critical_region_enter(void); 76 | extern void __firehose_critical_region_leave(void); 77 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 78 | 79 | // exported for the kernel 80 | firehose_tracepoint_t 81 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 82 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 83 | 84 | firehose_tracepoint_t 85 | __firehose_buffer_tracepoint_reserve_with_chunk(firehose_buffer_chunk_t fbc, 86 | uint64_t stamp, firehose_stream_t stream, 87 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 88 | 89 | void 90 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 91 | firehose_tracepoint_id_u vatid); 92 | 93 | void 94 | __firehose_buffer_tracepoint_flush_chunk(firehose_buffer_chunk_t fbc, 95 | firehose_tracepoint_t vat, firehose_tracepoint_id_u vatid); 96 | 97 | firehose_buffer_t 98 | __firehose_buffer_create(size_t *size); 99 | 100 | void 101 | __firehose_merge_updates(firehose_push_reply_t update); 102 | 103 | 104 | 105 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 106 | -------------------------------------------------------------------------------- /libdispatch-703.30.5/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.30.5/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-703.30.5/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.30.5/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-703.30.5/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.30.5/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-703.50.37/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20160318 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 35 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 36 | 37 | typedef struct firehose_buffer_range_s { 38 | uint16_t fbr_offset; // offset from the start of the buffer 39 | uint16_t fbr_length; 40 | } *firehose_buffer_range_t; 41 | 42 | 43 | typedef struct firehose_chunk_s *firehose_chunk_t; 44 | 45 | // implemented by the kernel 46 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 47 | extern void __firehose_critical_region_enter(void); 48 | extern void __firehose_critical_region_leave(void); 49 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 50 | 51 | // exported for the kernel 52 | firehose_tracepoint_t 53 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 54 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 55 | 56 | void 57 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 58 | firehose_tracepoint_id_u vatid); 59 | 60 | firehose_buffer_t 61 | __firehose_buffer_create(size_t *size); 62 | 63 | void 64 | __firehose_merge_updates(firehose_push_reply_t update); 65 | 66 | 67 | 68 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 69 | -------------------------------------------------------------------------------- /libdispatch-703.50.37/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.50.37/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-703.50.37/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.50.37/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-703.50.37/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-703.50.37/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-913.1.6/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20170222 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 35 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 36 | 37 | typedef struct firehose_buffer_range_s { 38 | uint16_t fbr_offset; // offset from the start of the buffer 39 | uint16_t fbr_length; 40 | } *firehose_buffer_range_t; 41 | 42 | 43 | typedef struct firehose_chunk_s *firehose_chunk_t; 44 | 45 | // implemented by the kernel 46 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 47 | extern void __firehose_critical_region_enter(void); 48 | extern void __firehose_critical_region_leave(void); 49 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 50 | 51 | // exported for the kernel 52 | firehose_tracepoint_t 53 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 54 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 55 | 56 | void 57 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 58 | firehose_tracepoint_id_u vatid); 59 | 60 | firehose_buffer_t 61 | __firehose_buffer_create(size_t *size); 62 | 63 | void 64 | __firehose_merge_updates(firehose_push_reply_t update); 65 | 66 | 67 | 68 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 69 | -------------------------------------------------------------------------------- /libdispatch-913.1.6/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.1.6/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-913.1.6/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.1.6/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-913.1.6/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.1.6/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-913.20.5/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20170222 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 35 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 36 | 37 | typedef struct firehose_buffer_range_s { 38 | uint16_t fbr_offset; // offset from the start of the buffer 39 | uint16_t fbr_length; 40 | } *firehose_buffer_range_t; 41 | 42 | 43 | typedef struct firehose_chunk_s *firehose_chunk_t; 44 | 45 | // implemented by the kernel 46 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 47 | extern void __firehose_critical_region_enter(void); 48 | extern void __firehose_critical_region_leave(void); 49 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 50 | 51 | // exported for the kernel 52 | firehose_tracepoint_t 53 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 54 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 55 | 56 | void 57 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 58 | firehose_tracepoint_id_u vatid); 59 | 60 | firehose_buffer_t 61 | __firehose_buffer_create(size_t *size); 62 | 63 | void 64 | __firehose_merge_updates(firehose_push_reply_t update); 65 | 66 | 67 | 68 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 69 | -------------------------------------------------------------------------------- /libdispatch-913.20.5/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.20.5/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-913.20.5/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.20.5/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-913.20.5/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.20.5/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-913.30.4/firehose_buffer_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_BUFFER_PRIVATE__ 22 | #define __FIREHOSE_BUFFER_PRIVATE__ 23 | 24 | #include 25 | 26 | #define OS_FIREHOSE_SPI_VERSION 20170222 27 | 28 | /*! 29 | * @group Firehose SPI 30 | * SPI intended for logd only 31 | * Layout of structs is subject to change without notice 32 | */ 33 | 34 | #define FIREHOSE_BUFFER_LIBTRACE_HEADER_SIZE 2048ul 35 | #define FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT 16 36 | 37 | typedef struct firehose_buffer_range_s { 38 | uint16_t fbr_offset; // offset from the start of the buffer 39 | uint16_t fbr_length; 40 | } *firehose_buffer_range_t; 41 | 42 | 43 | typedef struct firehose_chunk_s *firehose_chunk_t; 44 | 45 | // implemented by the kernel 46 | extern void __firehose_buffer_push_to_logd(firehose_buffer_t fb, bool for_io); 47 | extern void __firehose_critical_region_enter(void); 48 | extern void __firehose_critical_region_leave(void); 49 | extern void __firehose_allocate(vm_offset_t *addr, vm_size_t size); 50 | 51 | // exported for the kernel 52 | firehose_tracepoint_t 53 | __firehose_buffer_tracepoint_reserve(uint64_t stamp, firehose_stream_t stream, 54 | uint16_t pubsize, uint16_t privsize, uint8_t **privptr); 55 | 56 | void 57 | __firehose_buffer_tracepoint_flush(firehose_tracepoint_t vat, 58 | firehose_tracepoint_id_u vatid); 59 | 60 | firehose_buffer_t 61 | __firehose_buffer_create(size_t *size); 62 | 63 | void 64 | __firehose_merge_updates(firehose_push_reply_t update); 65 | 66 | 67 | 68 | #endif // __FIREHOSE_BUFFER_PRIVATE__ 69 | -------------------------------------------------------------------------------- /libdispatch-913.30.4/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.30.4/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-913.30.4/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.30.4/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-913.30.4/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.30.4/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-913.50.12/firehose/chunk_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_CHUNK_PRIVATE__ 22 | #define __FIREHOSE_CHUNK_PRIVATE__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "firehose_types_private.h" 28 | #include "tracepoint_private.h" 29 | 30 | __BEGIN_DECLS 31 | 32 | #define FIREHOSE_CHUNK_SIZE 4096ul 33 | 34 | #define FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC (1ULL << 0) 35 | #define FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC (1ULL << 16) 36 | #define FIREHOSE_CHUNK_POS_REFCNT_INC (1ULL << 32) 37 | #define FIREHOSE_CHUNK_POS_FULL_BIT (1ULL << 56) 38 | #define FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(pos, stream) \ 39 | ((((pos).fcp_pos >> 48) & 0x1ff) == (uint16_t)stream) 40 | 41 | typedef union { 42 | _Atomic(uint64_t) fcp_atomic_pos; 43 | uint64_t fcp_pos; 44 | struct { 45 | uint16_t fcp_next_entry_offs; 46 | uint16_t fcp_private_offs; 47 | uint8_t fcp_refcnt; 48 | uint8_t fcp_qos; 49 | uint8_t fcp_stream; 50 | uint8_t fcp_flag_full : 1; 51 | uint8_t fcp_flag_io : 1; 52 | uint8_t fcp_quarantined : 1; 53 | uint8_t _fcp_flag_unused : 5; 54 | }; 55 | } firehose_chunk_pos_u; 56 | 57 | typedef struct firehose_chunk_s { 58 | uint8_t fc_start[0]; 59 | firehose_chunk_pos_u fc_pos; 60 | uint64_t fc_timestamp; 61 | uint8_t fc_data[FIREHOSE_CHUNK_SIZE - 8 - 8]; 62 | } *firehose_chunk_t; 63 | 64 | typedef struct firehose_chunk_range_s { 65 | uint16_t fcr_offset; // offset from the start of the chunk 66 | uint16_t fcr_length; 67 | } *firehose_chunk_range_t; 68 | 69 | #if defined(KERNEL) || defined(OS_FIREHOSE_SPI) 70 | 71 | OS_ALWAYS_INLINE 72 | static inline bool 73 | firehose_chunk_pos_fits(firehose_chunk_pos_u pos, uint16_t size) 74 | { 75 | return pos.fcp_next_entry_offs + size <= pos.fcp_private_offs; 76 | } 77 | 78 | #define FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE (-1) 79 | #define FIREHOSE_CHUNK_TRY_RESERVE_FAIL ( 0) 80 | 81 | OS_ALWAYS_INLINE 82 | static inline long 83 | firehose_chunk_tracepoint_try_reserve(firehose_chunk_t fc, uint64_t stamp, 84 | firehose_stream_t stream, uint8_t qos, uint16_t pubsize, 85 | uint16_t privsize, uint8_t **privptr) 86 | { 87 | const uint16_t ft_size = offsetof(struct firehose_tracepoint_s, ft_data); 88 | firehose_chunk_pos_u orig, pos; 89 | bool reservation_failed, stamp_delta_fits; 90 | 91 | stamp_delta_fits = ((stamp - fc->fc_timestamp) >> 48) == 0; 92 | 93 | // no acquire barrier because the returned space is written to only 94 | os_atomic_rmw_loop(&fc->fc_pos.fcp_atomic_pos, 95 | orig.fcp_pos, pos.fcp_pos, relaxed, { 96 | if (orig.fcp_pos == 0) { 97 | // we acquired a really really old reference, and we probably 98 | // just faulted in a new page 99 | os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL); 100 | } 101 | if (!FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(orig, stream)) { 102 | // nothing to do if the chunk is full, or the stream doesn't match, 103 | // in which case the thread probably: 104 | // - loaded the chunk ref 105 | // - been suspended a long while 106 | // - read the chunk to find a very old thing 107 | os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL); 108 | } 109 | pos = orig; 110 | if (!firehose_chunk_pos_fits(orig, 111 | ft_size + pubsize + privsize) || !stamp_delta_fits) { 112 | pos.fcp_flag_full = true; 113 | reservation_failed = true; 114 | } else { 115 | if (qos > pos.fcp_qos) pos.fcp_qos = qos; 116 | // using these *_INC macros is so that the compiler generates better 117 | // assembly: using the struct individual fields forces the compiler 118 | // to handle carry propagations, and we know it won't happen 119 | pos.fcp_pos += roundup(ft_size + pubsize, 8) * 120 | FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC; 121 | pos.fcp_pos -= privsize * FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC; 122 | pos.fcp_pos += FIREHOSE_CHUNK_POS_REFCNT_INC; 123 | const uint16_t minimum_payload_size = 16; 124 | if (!firehose_chunk_pos_fits(pos, 125 | roundup(ft_size + minimum_payload_size , 8))) { 126 | // if we can't even have minimum_payload_size bytes of payload 127 | // for the next tracepoint, just flush right away 128 | pos.fcp_flag_full = true; 129 | } 130 | reservation_failed = false; 131 | } 132 | }); 133 | 134 | if (reservation_failed) { 135 | if (pos.fcp_refcnt) { 136 | // nothing to do, there is a thread writing that will pick up 137 | // the "FULL" flag on flush and push as a consequence 138 | return FIREHOSE_CHUNK_TRY_RESERVE_FAIL; 139 | } 140 | // caller must enqueue chunk 141 | return FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE; 142 | } 143 | if (privptr) { 144 | *privptr = fc->fc_start + pos.fcp_private_offs; 145 | } 146 | return orig.fcp_next_entry_offs; 147 | } 148 | 149 | OS_ALWAYS_INLINE 150 | static inline firehose_tracepoint_t 151 | firehose_chunk_tracepoint_begin(firehose_chunk_t fc, uint64_t stamp, 152 | uint16_t pubsize, uint64_t thread_id, long offset) 153 | { 154 | firehose_tracepoint_t ft = (firehose_tracepoint_t) 155 | __builtin_assume_aligned(fc->fc_start + offset, 8); 156 | stamp -= fc->fc_timestamp; 157 | stamp |= (uint64_t)pubsize << 48; 158 | // The compiler barrier is needed for userland process death handling, see 159 | // (tracepoint-begin) in libdispatch's firehose_buffer_stream_chunk_install. 160 | atomic_store_explicit(&ft->ft_atomic_stamp_and_length, stamp, 161 | memory_order_relaxed); 162 | __asm__ __volatile__("" ::: "memory"); 163 | ft->ft_thread = thread_id; 164 | return ft; 165 | } 166 | 167 | OS_ALWAYS_INLINE 168 | static inline bool 169 | firehose_chunk_tracepoint_end(firehose_chunk_t fc, 170 | firehose_tracepoint_t ft, firehose_tracepoint_id_u ftid) 171 | { 172 | firehose_chunk_pos_u pos; 173 | 174 | atomic_store_explicit(&ft->ft_id.ftid_atomic_value, 175 | ftid.ftid_value, memory_order_release); 176 | pos.fcp_pos = atomic_fetch_sub_explicit(&fc->fc_pos.fcp_atomic_pos, 177 | FIREHOSE_CHUNK_POS_REFCNT_INC, memory_order_relaxed); 178 | return pos.fcp_refcnt == 1 && pos.fcp_flag_full; 179 | } 180 | 181 | #endif // defined(KERNEL) || defined(OS_FIREHOSE_SPI) 182 | 183 | __END_DECLS 184 | 185 | #endif // __FIREHOSE_CHUNK_PRIVATE__ 186 | -------------------------------------------------------------------------------- /libdispatch-913.50.12/firehose/firehose_types_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_TYPES_PRIVATE__ 22 | #define __FIREHOSE_TYPES_PRIVATE__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | OS_ASSUME_NONNULL_BEGIN 29 | 30 | __BEGIN_DECLS 31 | 32 | /*! 33 | * @enum firehose_activity_flags_t 34 | * 35 | * @discussion 36 | * The lower 8 bits are or-ed in the upper 8 bits of Activity ID and propagated 37 | * to children activities 38 | */ 39 | OS_ENUM(firehose_activity_flags, unsigned long, 40 | firehose_activity_flags_default = 0x0000, 41 | 42 | firehose_activity_flags_info_mode = 0x0001, 43 | firehose_activity_flags_debug_mode = 0x0002, 44 | firehose_activity_flags_stream_live_mode = 0x0004, 45 | 46 | firehose_activity_flags_precise_timestamp = 0x0080, 47 | ); 48 | 49 | /*! 50 | * @typedef firehose_activity_id_t 51 | * 52 | * @abstract 53 | * Opaque activity identifier. 54 | * 55 | * @discussion 56 | * Scalar value type, not reference counted. 57 | */ 58 | typedef uint64_t firehose_activity_id_t; 59 | #define FIREHOSE_ACTIVITY_ID_NULL ((firehose_activity_id_t)0) 60 | #define FIREHOSE_ACTIVITY_ID_INVALID ((firehose_activity_id_t)~0ULL) 61 | #define FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT 56 62 | #define FIREHOSE_ACTIVITY_ID_FLAGS(aid) \ 63 | ((firehose_activity_flags_t)((aid) >> FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT)) 64 | #define FIREHOSE_ACTIVITY_ID_MERGE_FLAGS(aid, flags) (\ 65 | ((firehose_activity_id_t)(aid)) | \ 66 | ((firehose_activity_id_t)(flags) << FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT)) 67 | 68 | /*! 69 | * @enum firehose_stream_t 70 | */ 71 | OS_ENUM(firehose_stream, uint8_t, 72 | firehose_stream_persist = 0, 73 | firehose_stream_special = 1, 74 | firehose_stream_memory = 2, 75 | firehose_stream_metadata = 3, 76 | firehose_stream_memory_high_traffic = 4, 77 | firehose_stream_memory_wifi = 5, 78 | firehose_stream_memory_baseband = 6, 79 | 80 | _firehose_stream_max, 81 | ); 82 | 83 | /*! 84 | * @enum firehose_tracepoint_namespace_t 85 | * 86 | * @abstract 87 | * Namespaces of tracepoints. 88 | */ 89 | OS_ENUM(firehose_tracepoint_namespace, uint8_t, 90 | firehose_tracepoint_namespace_activity = 0x02, 91 | firehose_tracepoint_namespace_trace = 0x03, 92 | firehose_tracepoint_namespace_log = 0x04, 93 | firehose_tracepoint_namespace_metadata = 0x05, 94 | firehose_tracepoint_namespace_signpost = 0x06, 95 | ); 96 | 97 | /*! 98 | * @enum firehose_tracepoint_code_t 99 | * 100 | * @abstract 101 | * Codes of tracepoints. 102 | */ 103 | OS_ENUM(firehose_tracepoint_code, uint32_t, 104 | firehose_tracepoint_code_load = 0x01, 105 | firehose_tracepoint_code_unload = 0x02, 106 | ); 107 | 108 | /*! 109 | * @typedef firehose_tracepoint_type_t 110 | * 111 | * @abstract 112 | * Type of tracepoints. 113 | */ 114 | typedef uint8_t firehose_tracepoint_type_t; 115 | 116 | /*! 117 | * @typedef firehose_tracepoint_flags_t 118 | * 119 | * @abstract 120 | * Flags for tracepoints. 121 | */ 122 | OS_ENUM(firehose_tracepoint_flags, uint16_t, 123 | _firehose_tracepoint_flags_base_has_current_aid = 0x0001, 124 | #define _firehose_tracepoint_flags_pc_style_mask (0x0007 << 1) 125 | _firehose_tracepoint_flags_pc_style_none = 0x0000 << 1, 126 | _firehose_tracepoint_flags_pc_style_main_exe = 0x0001 << 1, 127 | _firehose_tracepoint_flags_pc_style_shared_cache = 0x0002 << 1, 128 | _firehose_tracepoint_flags_pc_style_main_plugin = 0x0003 << 1, 129 | _firehose_tracepoint_flags_pc_style_absolute = 0x0004 << 1, 130 | _firehose_tracepoint_flags_pc_style_uuid_relative = 0x0005 << 1, 131 | _firehose_tracepoint_flags_pc_style__unused6 = 0x0006 << 1, 132 | _firehose_tracepoint_flags_pc_style__unused7 = 0x0007 << 1, 133 | _firehose_tracepoint_flags_base_has_unique_pid = 0x0010, 134 | ); 135 | 136 | /*! 137 | * @typedef firehose_tracepoint_id_t 138 | * 139 | * @abstract 140 | * Opaque tracepoint identifier. 141 | */ 142 | typedef uint64_t firehose_tracepoint_id_t; 143 | 144 | /*! 145 | * @enum _firehose_tracepoint_type_activity_t 146 | * 147 | * @abstract 148 | * Types of Activity tracepoints (namespace activity). 149 | */ 150 | OS_ENUM(_firehose_tracepoint_type_activity, firehose_tracepoint_type_t, 151 | _firehose_tracepoint_type_activity_create = 0x01, 152 | _firehose_tracepoint_type_activity_swap = 0x02, 153 | _firehose_tracepoint_type_activity_useraction = 0x03, 154 | ); 155 | 156 | /*! 157 | * @enum firehose_tracepoint_flags_activity_t 158 | * 159 | * @abstract 160 | * Flags for Activity tracepoints (namespace activity). 161 | */ 162 | OS_ENUM(_firehose_tracepoint_flags_activity, uint16_t, 163 | _firehose_tracepoint_flags_activity_user_interface = 0x0100, 164 | _firehose_tracepoint_flags_activity_has_other_aid = 0x0200, 165 | ); 166 | 167 | /*! 168 | * @enum firehose_tracepoint_type_trace_t 169 | * 170 | * @abstract 171 | * Types of trace tracepoints (namespace trace). 172 | */ 173 | OS_ENUM(_firehose_tracepoint_type_trace, firehose_tracepoint_type_t, 174 | _firehose_tracepoint_type_trace_default = 0x00, 175 | _firehose_tracepoint_type_trace_info = 0x01, 176 | _firehose_tracepoint_type_trace_debug = 0x02, 177 | _firehose_tracepoint_type_trace_error = 0x10, 178 | _firehose_tracepoint_type_trace_fault = 0x11, 179 | ); 180 | 181 | /*! 182 | * @enum firehose_tracepoint_type_log_t 183 | * 184 | * @abstract 185 | * Types of Log tracepoints (namespace log). 186 | */ 187 | OS_ENUM(_firehose_tracepoint_type_log, firehose_tracepoint_type_t, 188 | _firehose_tracepoint_type_log_default = 0x00, 189 | _firehose_tracepoint_type_log_info = 0x01, 190 | _firehose_tracepoint_type_log_debug = 0x02, 191 | _firehose_tracepoint_type_log_error = 0x10, 192 | _firehose_tracepoint_type_log_fault = 0x11, 193 | ); 194 | 195 | /*! 196 | * @enum firehose_tracepoint_flags_log_t 197 | * 198 | * @abstract 199 | * Flags for Log tracepoints (namespace log). 200 | */ 201 | OS_ENUM(_firehose_tracepoint_flags_log, uint16_t, 202 | _firehose_tracepoint_flags_log_has_private_data = 0x0100, 203 | _firehose_tracepoint_flags_log_has_subsystem = 0x0200, 204 | _firehose_tracepoint_flags_log_has_rules = 0x0400, 205 | _firehose_tracepoint_flags_log_has_oversize = 0x0800, 206 | ); 207 | 208 | /*! 209 | * @enum _firehose_tracepoint_type_metadata_t 210 | * 211 | * @abstract 212 | * Types for metadata tracepoints (namespace metadata). 213 | */ 214 | OS_ENUM(_firehose_tracepoint_type_metadata, firehose_tracepoint_type_t, 215 | _firehose_tracepoint_type_metadata_dyld = 0x01, 216 | _firehose_tracepoint_type_metadata_subsystem = 0x02, 217 | _firehose_tracepoint_type_metadata_kext = 0x03, 218 | ); 219 | 220 | /*! 221 | * @enum firehose_tracepoint_type_signpost_t 222 | * 223 | * @abstract 224 | * Types of Log tracepoints (namespace signpost). 225 | */ 226 | OS_ENUM(_firehose_tracepoint_type_signpost, firehose_tracepoint_type_t, 227 | _firehose_tracepoint_type_signpost_event = 0x00, 228 | _firehose_tracepoint_type_signpost_interval_begin = 0x01, 229 | _firehose_tracepoint_type_signpost_interval_end = 0x02, 230 | 231 | _firehose_tracepoint_type_signpost_scope_mask = 0xc0, 232 | _firehose_tracepoint_type_signpost_scope_thread = 0x40, 233 | _firehose_tracepoint_type_signpost_scope_process = 0x80, 234 | _firehose_tracepoint_type_signpost_scope_system = 0xc0, 235 | ); 236 | 237 | /*! 238 | * @enum firehose_tracepoint_flags_signpost_t 239 | * 240 | * @abstract 241 | * Flags for Log tracepoints (namespace signpost). 242 | */ 243 | OS_ENUM(_firehose_tracepoint_flags_signpost, uint16_t, 244 | _firehose_tracepoint_flags_signpost_has_private_data = 0x0100, 245 | _firehose_tracepoint_flags_signpost_has_subsystem = 0x0200, 246 | _firehose_tracepoint_flags_signpost_has_rules = 0x0400, 247 | _firehose_tracepoint_flags_signpost_has_oversize = 0x0800, 248 | ); 249 | 250 | /* MIG firehose push reply structure */ 251 | typedef struct firehose_push_reply_s { 252 | uint64_t fpr_mem_flushed_pos; 253 | uint64_t fpr_io_flushed_pos; 254 | } firehose_push_reply_t; 255 | 256 | typedef struct firehose_buffer_map_info_s { 257 | mach_vm_address_t fbmi_addr; 258 | mach_vm_size_t fbmi_size; 259 | } firehose_buffer_map_info_t; 260 | 261 | #define FIREHOSE_PUSH_REPLY_CORRUPTED ((firehose_push_reply_t){ ~0ULL, ~0ULL }) 262 | 263 | typedef union firehose_buffer_u *firehose_buffer_t; 264 | 265 | __END_DECLS 266 | 267 | OS_ASSUME_NONNULL_END 268 | 269 | #endif // __FIREHOSE_TYPES_PRIVATE__ 270 | -------------------------------------------------------------------------------- /libdispatch-913.50.12/firehose/ioctl_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_IOCTL_PRIVATE__ 22 | #define __FIREHOSE_IOCTL_PRIVATE__ 23 | 24 | #include 25 | #include "firehose_types_private.h" 26 | 27 | // Ioctls implemented by the oslog dev node 28 | 29 | /* Flushed the log data. Return the updated pointers */ 30 | #ifndef LOGFLUSHED 31 | #define LOGFLUSHED _IOW('t', 81, firehose_push_reply_t) 32 | #endif 33 | 34 | /* Map the kernel log buffers to logd's address space */ 35 | #ifndef LOGREGISTER 36 | #define LOGREGISTER _IOR('t', 80, int) 37 | #endif 38 | 39 | /* Map the kernel log buffers to logd's address space */ 40 | #ifndef LOGBUFFERMAP 41 | #define LOGBUFFERMAP _IOR('t', 79, firehose_buffer_map_info_t) 42 | #endif 43 | 44 | #endif // __FIREHOSE_IOCTL_PRIVATE__ 45 | -------------------------------------------------------------------------------- /libdispatch-913.50.12/firehose/private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_FIREHOSE_PRIVATE__ 22 | #define __FIREHOSE_FIREHOSE_PRIVATE__ 23 | 24 | #define FIREHOSE_SPI_VERSION 20170907 25 | 26 | #include "firehose_types_private.h" 27 | #include "tracepoint_private.h" 28 | #include "ioctl_private.h" 29 | #include "chunk_private.h" 30 | 31 | #endif // __FIREHOSE_FIREHOSE_PRIVATE__ 32 | -------------------------------------------------------------------------------- /libdispatch-913.50.12/firehose/tracepoint_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_ACTIVITY__ 22 | #define __FIREHOSE_ACTIVITY__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "firehose_types_private.h" 28 | 29 | OS_ASSUME_NONNULL_BEGIN 30 | 31 | /*! 32 | * @typedef firehose_tracepoint_id_u 33 | * 34 | * @abstract 35 | * Broken down tracepoint identifier. 36 | */ 37 | typedef union { 38 | struct { 39 | firehose_tracepoint_namespace_t _namespace; 40 | firehose_tracepoint_type_t _type; 41 | firehose_tracepoint_flags_t _flags; 42 | uint32_t _code; 43 | } ftid; 44 | firehose_tracepoint_id_t ftid_value; 45 | _Atomic(firehose_tracepoint_id_t) ftid_atomic_value; 46 | } firehose_tracepoint_id_u; 47 | 48 | #define FIREHOSE_STAMP_SLOP (1ULL << 36) // ~1minute 49 | 50 | /*! 51 | * @typedef firehose_trace_uuid_info_t 52 | * 53 | * @abstract 54 | * Info needed by logd when kexts are loaded or unloaded 55 | * 56 | */ 57 | typedef struct firehose_trace_uuid_info_s { 58 | uuid_t ftui_uuid; /* uuid of binary */ 59 | uint64_t ftui_address; /* load address */ 60 | uint64_t ftui_size; /* load size */ 61 | char ftui_path[]; /* full path of binary - Unused in the kernel*/ 62 | } *firehose_trace_uuid_info_t; 63 | 64 | /*! 65 | * @typedef firehose_tracepoint_t 66 | */ 67 | typedef struct firehose_tracepoint_s { 68 | firehose_tracepoint_id_u ft_id; 69 | uint64_t ft_thread; 70 | union { 71 | struct { 72 | uint64_t ft_timestamp_delta : 48; 73 | uint64_t ft_length : 16; 74 | }; 75 | uint64_t ft_stamp_and_length; 76 | _Atomic(uint64_t) ft_atomic_stamp_and_length; 77 | }; 78 | uint8_t ft_data[]; 79 | } *firehose_tracepoint_t; 80 | 81 | #define FIREHOSE_TRACE_ID_MAKE(ns, type, flags, code) \ 82 | (((firehose_tracepoint_id_u){ .ftid = { \ 83 | ._namespace = ns, \ 84 | ._type = type, \ 85 | ._flags = flags, \ 86 | ._code = code, \ 87 | } }).ftid_value) 88 | 89 | #define FIREHOSE_TRACE_ID_SET_NS(tid, ns) \ 90 | ((tid).ftid._namespace = firehose_tracepoint_namespace_##ns) 91 | 92 | #define FIREHOSE_TRACE_ID_SET_TYPE(tid, ns, type) \ 93 | ((tid).ftid._type = _firehose_tracepoint_type_##ns##_##type) 94 | 95 | #define FIREHOSE_TRACE_ID_PC_STYLE(tid) \ 96 | ((tid).ftid._flags & _firehose_tracepoint_flags_pc_style_mask) 97 | 98 | #define FIREHOSE_TRACE_ID_SET_PC_STYLE(tid, flag) ({ \ 99 | firehose_tracepoint_id_u _tmp_tid = (tid); \ 100 | _tmp_tid.ftid._flags &= ~_firehose_tracepoint_flags_pc_style_mask; \ 101 | _tmp_tid.ftid._flags |= _firehose_tracepoint_flags_pc_style_##flag; \ 102 | }) 103 | 104 | #define FIREHOSE_TRACE_ID_HAS_FLAG(tid, ns, flag) \ 105 | ((tid).ftid._flags & _firehose_tracepoint_flags_##ns##_##flag) 106 | #define FIREHOSE_TRACE_ID_SET_FLAG(tid, ns, flag) \ 107 | ((void)((tid).ftid._flags |= _firehose_tracepoint_flags_##ns##_##flag)) 108 | #define FIREHOSE_TRACE_ID_CLEAR_FLAG(tid, ns, flag) \ 109 | ((void)((tid).ftid._flags &= ~_firehose_tracepoint_flags_##ns##_##flag)) 110 | 111 | #define FIREHOSE_TRACE_ID_SET_CODE(tid, code) \ 112 | ((tid).ftid._code = code) 113 | 114 | __BEGIN_DECLS 115 | 116 | #if __has_feature(address_sanitizer) 117 | __attribute__((no_sanitize("address"))) 118 | #endif 119 | __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) 120 | __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) 121 | OS_ALWAYS_INLINE 122 | static inline bool 123 | firehose_precise_timestamps_enabled(void) 124 | { 125 | return (*((volatile uint32_t *)_COMM_PAGE_ATM_DIAGNOSTIC_CONFIG) & 0x80) == 0; 126 | } 127 | 128 | #if __has_feature(address_sanitizer) 129 | __attribute__((no_sanitize("address"))) 130 | #endif 131 | __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) 132 | __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) 133 | OS_ALWAYS_INLINE 134 | static inline uint64_t 135 | firehose_tracepoint_time(firehose_activity_flags_t flags) 136 | { 137 | if (firehose_precise_timestamps_enabled() || 138 | (flags & firehose_activity_flags_precise_timestamp)) { 139 | return mach_continuous_time(); 140 | } else { 141 | return mach_continuous_approximate_time(); 142 | } 143 | } 144 | 145 | __END_DECLS 146 | 147 | OS_ASSUME_NONNULL_END 148 | 149 | #endif // __FIREHOSE_FIREHOSE__ 150 | -------------------------------------------------------------------------------- /libdispatch-913.50.12/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.50.12/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-913.50.12/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.50.12/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-913.50.12/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.50.12/libfirehose_kernel_profile.a -------------------------------------------------------------------------------- /libdispatch-913.60.2/firehose/chunk_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_CHUNK_PRIVATE__ 22 | #define __FIREHOSE_CHUNK_PRIVATE__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "firehose_types_private.h" 28 | #include "tracepoint_private.h" 29 | 30 | __BEGIN_DECLS 31 | 32 | #define FIREHOSE_CHUNK_SIZE 4096ul 33 | 34 | #define FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC (1ULL << 0) 35 | #define FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC (1ULL << 16) 36 | #define FIREHOSE_CHUNK_POS_REFCNT_INC (1ULL << 32) 37 | #define FIREHOSE_CHUNK_POS_FULL_BIT (1ULL << 56) 38 | #define FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(pos, stream) \ 39 | ((((pos).fcp_pos >> 48) & 0x1ff) == (uint16_t)stream) 40 | 41 | typedef union { 42 | _Atomic(uint64_t) fcp_atomic_pos; 43 | uint64_t fcp_pos; 44 | struct { 45 | uint16_t fcp_next_entry_offs; 46 | uint16_t fcp_private_offs; 47 | uint8_t fcp_refcnt; 48 | uint8_t fcp_qos; 49 | uint8_t fcp_stream; 50 | uint8_t fcp_flag_full : 1; 51 | uint8_t fcp_flag_io : 1; 52 | uint8_t fcp_quarantined : 1; 53 | uint8_t _fcp_flag_unused : 5; 54 | }; 55 | } firehose_chunk_pos_u; 56 | 57 | typedef struct firehose_chunk_s { 58 | uint8_t fc_start[0]; 59 | firehose_chunk_pos_u fc_pos; 60 | uint64_t fc_timestamp; 61 | uint8_t fc_data[FIREHOSE_CHUNK_SIZE - 8 - 8]; 62 | } *firehose_chunk_t; 63 | 64 | typedef struct firehose_chunk_range_s { 65 | uint16_t fcr_offset; // offset from the start of the chunk 66 | uint16_t fcr_length; 67 | } *firehose_chunk_range_t; 68 | 69 | #if defined(KERNEL) || defined(OS_FIREHOSE_SPI) 70 | 71 | OS_ALWAYS_INLINE 72 | static inline bool 73 | firehose_chunk_pos_fits(firehose_chunk_pos_u pos, uint16_t size) 74 | { 75 | return pos.fcp_next_entry_offs + size <= pos.fcp_private_offs; 76 | } 77 | 78 | #define FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE (-1) 79 | #define FIREHOSE_CHUNK_TRY_RESERVE_FAIL ( 0) 80 | 81 | OS_ALWAYS_INLINE 82 | static inline long 83 | firehose_chunk_tracepoint_try_reserve(firehose_chunk_t fc, uint64_t stamp, 84 | firehose_stream_t stream, uint8_t qos, uint16_t pubsize, 85 | uint16_t privsize, uint8_t **privptr) 86 | { 87 | const uint16_t ft_size = offsetof(struct firehose_tracepoint_s, ft_data); 88 | firehose_chunk_pos_u orig, pos; 89 | bool reservation_failed, stamp_delta_fits; 90 | 91 | stamp_delta_fits = ((stamp - fc->fc_timestamp) >> 48) == 0; 92 | 93 | // no acquire barrier because the returned space is written to only 94 | os_atomic_rmw_loop(&fc->fc_pos.fcp_atomic_pos, 95 | orig.fcp_pos, pos.fcp_pos, relaxed, { 96 | if (orig.fcp_pos == 0) { 97 | // we acquired a really really old reference, and we probably 98 | // just faulted in a new page 99 | os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL); 100 | } 101 | if (!FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(orig, stream)) { 102 | // nothing to do if the chunk is full, or the stream doesn't match, 103 | // in which case the thread probably: 104 | // - loaded the chunk ref 105 | // - been suspended a long while 106 | // - read the chunk to find a very old thing 107 | os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL); 108 | } 109 | pos = orig; 110 | if (!firehose_chunk_pos_fits(orig, 111 | ft_size + pubsize + privsize) || !stamp_delta_fits) { 112 | pos.fcp_flag_full = true; 113 | reservation_failed = true; 114 | } else { 115 | if (qos > pos.fcp_qos) pos.fcp_qos = qos; 116 | // using these *_INC macros is so that the compiler generates better 117 | // assembly: using the struct individual fields forces the compiler 118 | // to handle carry propagations, and we know it won't happen 119 | pos.fcp_pos += roundup(ft_size + pubsize, 8) * 120 | FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC; 121 | pos.fcp_pos -= privsize * FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC; 122 | pos.fcp_pos += FIREHOSE_CHUNK_POS_REFCNT_INC; 123 | const uint16_t minimum_payload_size = 16; 124 | if (!firehose_chunk_pos_fits(pos, 125 | roundup(ft_size + minimum_payload_size , 8))) { 126 | // if we can't even have minimum_payload_size bytes of payload 127 | // for the next tracepoint, just flush right away 128 | pos.fcp_flag_full = true; 129 | } 130 | reservation_failed = false; 131 | } 132 | }); 133 | 134 | if (reservation_failed) { 135 | if (pos.fcp_refcnt) { 136 | // nothing to do, there is a thread writing that will pick up 137 | // the "FULL" flag on flush and push as a consequence 138 | return FIREHOSE_CHUNK_TRY_RESERVE_FAIL; 139 | } 140 | // caller must enqueue chunk 141 | return FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE; 142 | } 143 | if (privptr) { 144 | *privptr = fc->fc_start + pos.fcp_private_offs; 145 | } 146 | return orig.fcp_next_entry_offs; 147 | } 148 | 149 | OS_ALWAYS_INLINE 150 | static inline firehose_tracepoint_t 151 | firehose_chunk_tracepoint_begin(firehose_chunk_t fc, uint64_t stamp, 152 | uint16_t pubsize, uint64_t thread_id, long offset) 153 | { 154 | firehose_tracepoint_t ft = (firehose_tracepoint_t) 155 | __builtin_assume_aligned(fc->fc_start + offset, 8); 156 | stamp -= fc->fc_timestamp; 157 | stamp |= (uint64_t)pubsize << 48; 158 | // The compiler barrier is needed for userland process death handling, see 159 | // (tracepoint-begin) in libdispatch's firehose_buffer_stream_chunk_install. 160 | atomic_store_explicit(&ft->ft_atomic_stamp_and_length, stamp, 161 | memory_order_relaxed); 162 | __asm__ __volatile__("" ::: "memory"); 163 | ft->ft_thread = thread_id; 164 | return ft; 165 | } 166 | 167 | OS_ALWAYS_INLINE 168 | static inline bool 169 | firehose_chunk_tracepoint_end(firehose_chunk_t fc, 170 | firehose_tracepoint_t ft, firehose_tracepoint_id_u ftid) 171 | { 172 | firehose_chunk_pos_u pos; 173 | 174 | atomic_store_explicit(&ft->ft_id.ftid_atomic_value, 175 | ftid.ftid_value, memory_order_release); 176 | pos.fcp_pos = atomic_fetch_sub_explicit(&fc->fc_pos.fcp_atomic_pos, 177 | FIREHOSE_CHUNK_POS_REFCNT_INC, memory_order_relaxed); 178 | return pos.fcp_refcnt == 1 && pos.fcp_flag_full; 179 | } 180 | 181 | #endif // defined(KERNEL) || defined(OS_FIREHOSE_SPI) 182 | 183 | __END_DECLS 184 | 185 | #endif // __FIREHOSE_CHUNK_PRIVATE__ 186 | -------------------------------------------------------------------------------- /libdispatch-913.60.2/firehose/firehose_types_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_TYPES_PRIVATE__ 22 | #define __FIREHOSE_TYPES_PRIVATE__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | OS_ASSUME_NONNULL_BEGIN 29 | 30 | __BEGIN_DECLS 31 | 32 | /*! 33 | * @enum firehose_activity_flags_t 34 | * 35 | * @discussion 36 | * The lower 8 bits are or-ed in the upper 8 bits of Activity ID and propagated 37 | * to children activities 38 | */ 39 | OS_ENUM(firehose_activity_flags, unsigned long, 40 | firehose_activity_flags_default = 0x0000, 41 | 42 | firehose_activity_flags_info_mode = 0x0001, 43 | firehose_activity_flags_debug_mode = 0x0002, 44 | firehose_activity_flags_stream_live_mode = 0x0004, 45 | 46 | firehose_activity_flags_precise_timestamp = 0x0080, 47 | ); 48 | 49 | /*! 50 | * @typedef firehose_activity_id_t 51 | * 52 | * @abstract 53 | * Opaque activity identifier. 54 | * 55 | * @discussion 56 | * Scalar value type, not reference counted. 57 | */ 58 | typedef uint64_t firehose_activity_id_t; 59 | #define FIREHOSE_ACTIVITY_ID_NULL ((firehose_activity_id_t)0) 60 | #define FIREHOSE_ACTIVITY_ID_INVALID ((firehose_activity_id_t)~0ULL) 61 | #define FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT 56 62 | #define FIREHOSE_ACTIVITY_ID_FLAGS(aid) \ 63 | ((firehose_activity_flags_t)((aid) >> FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT)) 64 | #define FIREHOSE_ACTIVITY_ID_MERGE_FLAGS(aid, flags) (\ 65 | ((firehose_activity_id_t)(aid)) | \ 66 | ((firehose_activity_id_t)(flags) << FIREHOSE_ACTIVITY_ID_FLAGS_SHIFT)) 67 | 68 | /*! 69 | * @enum firehose_stream_t 70 | */ 71 | OS_ENUM(firehose_stream, uint8_t, 72 | firehose_stream_persist = 0, 73 | firehose_stream_special = 1, 74 | firehose_stream_memory = 2, 75 | firehose_stream_metadata = 3, 76 | firehose_stream_memory_high_traffic = 4, 77 | firehose_stream_memory_wifi = 5, 78 | firehose_stream_memory_baseband = 6, 79 | 80 | _firehose_stream_max, 81 | ); 82 | 83 | /*! 84 | * @enum firehose_tracepoint_namespace_t 85 | * 86 | * @abstract 87 | * Namespaces of tracepoints. 88 | */ 89 | OS_ENUM(firehose_tracepoint_namespace, uint8_t, 90 | firehose_tracepoint_namespace_activity = 0x02, 91 | firehose_tracepoint_namespace_trace = 0x03, 92 | firehose_tracepoint_namespace_log = 0x04, 93 | firehose_tracepoint_namespace_metadata = 0x05, 94 | firehose_tracepoint_namespace_signpost = 0x06, 95 | ); 96 | 97 | /*! 98 | * @enum firehose_tracepoint_code_t 99 | * 100 | * @abstract 101 | * Codes of tracepoints. 102 | */ 103 | OS_ENUM(firehose_tracepoint_code, uint32_t, 104 | firehose_tracepoint_code_load = 0x01, 105 | firehose_tracepoint_code_unload = 0x02, 106 | ); 107 | 108 | /*! 109 | * @typedef firehose_tracepoint_type_t 110 | * 111 | * @abstract 112 | * Type of tracepoints. 113 | */ 114 | typedef uint8_t firehose_tracepoint_type_t; 115 | 116 | /*! 117 | * @typedef firehose_tracepoint_flags_t 118 | * 119 | * @abstract 120 | * Flags for tracepoints. 121 | */ 122 | OS_ENUM(firehose_tracepoint_flags, uint16_t, 123 | _firehose_tracepoint_flags_base_has_current_aid = 0x0001, 124 | #define _firehose_tracepoint_flags_pc_style_mask (0x0007 << 1) 125 | _firehose_tracepoint_flags_pc_style_none = 0x0000 << 1, 126 | _firehose_tracepoint_flags_pc_style_main_exe = 0x0001 << 1, 127 | _firehose_tracepoint_flags_pc_style_shared_cache = 0x0002 << 1, 128 | _firehose_tracepoint_flags_pc_style_main_plugin = 0x0003 << 1, 129 | _firehose_tracepoint_flags_pc_style_absolute = 0x0004 << 1, 130 | _firehose_tracepoint_flags_pc_style_uuid_relative = 0x0005 << 1, 131 | _firehose_tracepoint_flags_pc_style__unused6 = 0x0006 << 1, 132 | _firehose_tracepoint_flags_pc_style__unused7 = 0x0007 << 1, 133 | _firehose_tracepoint_flags_base_has_unique_pid = 0x0010, 134 | ); 135 | 136 | /*! 137 | * @typedef firehose_tracepoint_id_t 138 | * 139 | * @abstract 140 | * Opaque tracepoint identifier. 141 | */ 142 | typedef uint64_t firehose_tracepoint_id_t; 143 | 144 | /*! 145 | * @enum _firehose_tracepoint_type_activity_t 146 | * 147 | * @abstract 148 | * Types of Activity tracepoints (namespace activity). 149 | */ 150 | OS_ENUM(_firehose_tracepoint_type_activity, firehose_tracepoint_type_t, 151 | _firehose_tracepoint_type_activity_create = 0x01, 152 | _firehose_tracepoint_type_activity_swap = 0x02, 153 | _firehose_tracepoint_type_activity_useraction = 0x03, 154 | ); 155 | 156 | /*! 157 | * @enum firehose_tracepoint_flags_activity_t 158 | * 159 | * @abstract 160 | * Flags for Activity tracepoints (namespace activity). 161 | */ 162 | OS_ENUM(_firehose_tracepoint_flags_activity, uint16_t, 163 | _firehose_tracepoint_flags_activity_user_interface = 0x0100, 164 | _firehose_tracepoint_flags_activity_has_other_aid = 0x0200, 165 | ); 166 | 167 | /*! 168 | * @enum firehose_tracepoint_type_trace_t 169 | * 170 | * @abstract 171 | * Types of trace tracepoints (namespace trace). 172 | */ 173 | OS_ENUM(_firehose_tracepoint_type_trace, firehose_tracepoint_type_t, 174 | _firehose_tracepoint_type_trace_default = 0x00, 175 | _firehose_tracepoint_type_trace_info = 0x01, 176 | _firehose_tracepoint_type_trace_debug = 0x02, 177 | _firehose_tracepoint_type_trace_error = 0x10, 178 | _firehose_tracepoint_type_trace_fault = 0x11, 179 | ); 180 | 181 | /*! 182 | * @enum firehose_tracepoint_type_log_t 183 | * 184 | * @abstract 185 | * Types of Log tracepoints (namespace log). 186 | */ 187 | OS_ENUM(_firehose_tracepoint_type_log, firehose_tracepoint_type_t, 188 | _firehose_tracepoint_type_log_default = 0x00, 189 | _firehose_tracepoint_type_log_info = 0x01, 190 | _firehose_tracepoint_type_log_debug = 0x02, 191 | _firehose_tracepoint_type_log_error = 0x10, 192 | _firehose_tracepoint_type_log_fault = 0x11, 193 | ); 194 | 195 | /*! 196 | * @enum firehose_tracepoint_flags_log_t 197 | * 198 | * @abstract 199 | * Flags for Log tracepoints (namespace log). 200 | */ 201 | OS_ENUM(_firehose_tracepoint_flags_log, uint16_t, 202 | _firehose_tracepoint_flags_log_has_private_data = 0x0100, 203 | _firehose_tracepoint_flags_log_has_subsystem = 0x0200, 204 | _firehose_tracepoint_flags_log_has_rules = 0x0400, 205 | _firehose_tracepoint_flags_log_has_oversize = 0x0800, 206 | ); 207 | 208 | /*! 209 | * @enum _firehose_tracepoint_type_metadata_t 210 | * 211 | * @abstract 212 | * Types for metadata tracepoints (namespace metadata). 213 | */ 214 | OS_ENUM(_firehose_tracepoint_type_metadata, firehose_tracepoint_type_t, 215 | _firehose_tracepoint_type_metadata_dyld = 0x01, 216 | _firehose_tracepoint_type_metadata_subsystem = 0x02, 217 | _firehose_tracepoint_type_metadata_kext = 0x03, 218 | ); 219 | 220 | /*! 221 | * @enum firehose_tracepoint_type_signpost_t 222 | * 223 | * @abstract 224 | * Types of Log tracepoints (namespace signpost). 225 | */ 226 | OS_ENUM(_firehose_tracepoint_type_signpost, firehose_tracepoint_type_t, 227 | _firehose_tracepoint_type_signpost_event = 0x00, 228 | _firehose_tracepoint_type_signpost_interval_begin = 0x01, 229 | _firehose_tracepoint_type_signpost_interval_end = 0x02, 230 | 231 | _firehose_tracepoint_type_signpost_scope_mask = 0xc0, 232 | _firehose_tracepoint_type_signpost_scope_thread = 0x40, 233 | _firehose_tracepoint_type_signpost_scope_process = 0x80, 234 | _firehose_tracepoint_type_signpost_scope_system = 0xc0, 235 | ); 236 | 237 | /*! 238 | * @enum firehose_tracepoint_flags_signpost_t 239 | * 240 | * @abstract 241 | * Flags for Log tracepoints (namespace signpost). 242 | */ 243 | OS_ENUM(_firehose_tracepoint_flags_signpost, uint16_t, 244 | _firehose_tracepoint_flags_signpost_has_private_data = 0x0100, 245 | _firehose_tracepoint_flags_signpost_has_subsystem = 0x0200, 246 | _firehose_tracepoint_flags_signpost_has_rules = 0x0400, 247 | _firehose_tracepoint_flags_signpost_has_oversize = 0x0800, 248 | ); 249 | 250 | /* MIG firehose push reply structure */ 251 | typedef struct firehose_push_reply_s { 252 | uint64_t fpr_mem_flushed_pos; 253 | uint64_t fpr_io_flushed_pos; 254 | } firehose_push_reply_t; 255 | 256 | typedef struct firehose_buffer_map_info_s { 257 | mach_vm_address_t fbmi_addr; 258 | mach_vm_size_t fbmi_size; 259 | } firehose_buffer_map_info_t; 260 | 261 | #define FIREHOSE_PUSH_REPLY_CORRUPTED ((firehose_push_reply_t){ ~0ULL, ~0ULL }) 262 | 263 | typedef union firehose_buffer_u *firehose_buffer_t; 264 | 265 | __END_DECLS 266 | 267 | OS_ASSUME_NONNULL_END 268 | 269 | #endif // __FIREHOSE_TYPES_PRIVATE__ 270 | -------------------------------------------------------------------------------- /libdispatch-913.60.2/firehose/ioctl_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_IOCTL_PRIVATE__ 22 | #define __FIREHOSE_IOCTL_PRIVATE__ 23 | 24 | #include 25 | #include "firehose_types_private.h" 26 | 27 | // Ioctls implemented by the oslog dev node 28 | 29 | /* Flushed the log data. Return the updated pointers */ 30 | #ifndef LOGFLUSHED 31 | #define LOGFLUSHED _IOW('t', 81, firehose_push_reply_t) 32 | #endif 33 | 34 | /* Map the kernel log buffers to logd's address space */ 35 | #ifndef LOGREGISTER 36 | #define LOGREGISTER _IOR('t', 80, int) 37 | #endif 38 | 39 | /* Map the kernel log buffers to logd's address space */ 40 | #ifndef LOGBUFFERMAP 41 | #define LOGBUFFERMAP _IOR('t', 79, firehose_buffer_map_info_t) 42 | #endif 43 | 44 | #endif // __FIREHOSE_IOCTL_PRIVATE__ 45 | -------------------------------------------------------------------------------- /libdispatch-913.60.2/firehose/private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_FIREHOSE_PRIVATE__ 22 | #define __FIREHOSE_FIREHOSE_PRIVATE__ 23 | 24 | #define FIREHOSE_SPI_VERSION 20170907 25 | 26 | #include "firehose_types_private.h" 27 | #include "tracepoint_private.h" 28 | #include "ioctl_private.h" 29 | #include "chunk_private.h" 30 | 31 | #endif // __FIREHOSE_FIREHOSE_PRIVATE__ 32 | -------------------------------------------------------------------------------- /libdispatch-913.60.2/firehose/tracepoint_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __FIREHOSE_ACTIVITY__ 22 | #define __FIREHOSE_ACTIVITY__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "firehose_types_private.h" 28 | 29 | OS_ASSUME_NONNULL_BEGIN 30 | 31 | /*! 32 | * @typedef firehose_tracepoint_id_u 33 | * 34 | * @abstract 35 | * Broken down tracepoint identifier. 36 | */ 37 | typedef union { 38 | struct { 39 | firehose_tracepoint_namespace_t _namespace; 40 | firehose_tracepoint_type_t _type; 41 | firehose_tracepoint_flags_t _flags; 42 | uint32_t _code; 43 | } ftid; 44 | firehose_tracepoint_id_t ftid_value; 45 | _Atomic(firehose_tracepoint_id_t) ftid_atomic_value; 46 | } firehose_tracepoint_id_u; 47 | 48 | #define FIREHOSE_STAMP_SLOP (1ULL << 36) // ~1minute 49 | 50 | /*! 51 | * @typedef firehose_trace_uuid_info_t 52 | * 53 | * @abstract 54 | * Info needed by logd when kexts are loaded or unloaded 55 | * 56 | */ 57 | typedef struct firehose_trace_uuid_info_s { 58 | uuid_t ftui_uuid; /* uuid of binary */ 59 | uint64_t ftui_address; /* load address */ 60 | uint64_t ftui_size; /* load size */ 61 | char ftui_path[]; /* full path of binary - Unused in the kernel*/ 62 | } *firehose_trace_uuid_info_t; 63 | 64 | /*! 65 | * @typedef firehose_tracepoint_t 66 | */ 67 | typedef struct firehose_tracepoint_s { 68 | firehose_tracepoint_id_u ft_id; 69 | uint64_t ft_thread; 70 | union { 71 | struct { 72 | uint64_t ft_timestamp_delta : 48; 73 | uint64_t ft_length : 16; 74 | }; 75 | uint64_t ft_stamp_and_length; 76 | _Atomic(uint64_t) ft_atomic_stamp_and_length; 77 | }; 78 | uint8_t ft_data[]; 79 | } *firehose_tracepoint_t; 80 | 81 | #define FIREHOSE_TRACE_ID_MAKE(ns, type, flags, code) \ 82 | (((firehose_tracepoint_id_u){ .ftid = { \ 83 | ._namespace = ns, \ 84 | ._type = type, \ 85 | ._flags = flags, \ 86 | ._code = code, \ 87 | } }).ftid_value) 88 | 89 | #define FIREHOSE_TRACE_ID_SET_NS(tid, ns) \ 90 | ((tid).ftid._namespace = firehose_tracepoint_namespace_##ns) 91 | 92 | #define FIREHOSE_TRACE_ID_SET_TYPE(tid, ns, type) \ 93 | ((tid).ftid._type = _firehose_tracepoint_type_##ns##_##type) 94 | 95 | #define FIREHOSE_TRACE_ID_PC_STYLE(tid) \ 96 | ((tid).ftid._flags & _firehose_tracepoint_flags_pc_style_mask) 97 | 98 | #define FIREHOSE_TRACE_ID_SET_PC_STYLE(tid, flag) ({ \ 99 | firehose_tracepoint_id_u _tmp_tid = (tid); \ 100 | _tmp_tid.ftid._flags &= ~_firehose_tracepoint_flags_pc_style_mask; \ 101 | _tmp_tid.ftid._flags |= _firehose_tracepoint_flags_pc_style_##flag; \ 102 | }) 103 | 104 | #define FIREHOSE_TRACE_ID_HAS_FLAG(tid, ns, flag) \ 105 | ((tid).ftid._flags & _firehose_tracepoint_flags_##ns##_##flag) 106 | #define FIREHOSE_TRACE_ID_SET_FLAG(tid, ns, flag) \ 107 | ((void)((tid).ftid._flags |= _firehose_tracepoint_flags_##ns##_##flag)) 108 | #define FIREHOSE_TRACE_ID_CLEAR_FLAG(tid, ns, flag) \ 109 | ((void)((tid).ftid._flags &= ~_firehose_tracepoint_flags_##ns##_##flag)) 110 | 111 | #define FIREHOSE_TRACE_ID_SET_CODE(tid, code) \ 112 | ((tid).ftid._code = code) 113 | 114 | __BEGIN_DECLS 115 | 116 | #if __has_feature(address_sanitizer) 117 | __attribute__((no_sanitize("address"))) 118 | #endif 119 | __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) 120 | __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) 121 | OS_ALWAYS_INLINE 122 | static inline bool 123 | firehose_precise_timestamps_enabled(void) 124 | { 125 | return (*((volatile uint32_t *)_COMM_PAGE_ATM_DIAGNOSTIC_CONFIG) & 0x80) == 0; 126 | } 127 | 128 | #if __has_feature(address_sanitizer) 129 | __attribute__((no_sanitize("address"))) 130 | #endif 131 | __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) 132 | __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) 133 | OS_ALWAYS_INLINE 134 | static inline uint64_t 135 | firehose_tracepoint_time(firehose_activity_flags_t flags) 136 | { 137 | if (firehose_precise_timestamps_enabled() || 138 | (flags & firehose_activity_flags_precise_timestamp)) { 139 | return mach_continuous_time(); 140 | } else { 141 | return mach_continuous_approximate_time(); 142 | } 143 | } 144 | 145 | __END_DECLS 146 | 147 | OS_ASSUME_NONNULL_END 148 | 149 | #endif // __FIREHOSE_FIREHOSE__ 150 | -------------------------------------------------------------------------------- /libdispatch-913.60.2/libfirehose_kernel.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.60.2/libfirehose_kernel.a -------------------------------------------------------------------------------- /libdispatch-913.60.2/libfirehose_kernel_debug.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.60.2/libfirehose_kernel_debug.a -------------------------------------------------------------------------------- /libdispatch-913.60.2/libfirehose_kernel_profile.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Proteas/install_firehose_lib/a7255fee711c19b5fe323c5510fd1dcd31bfca62/libdispatch-913.60.2/libfirehose_kernel_profile.a --------------------------------------------------------------------------------