1 /* 2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 /* 29 * @OSF_COPYRIGHT@ 30 */ 31 /* 32 * Mach Operating System 33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University 34 * All Rights Reserved. 35 * 36 * Permission to use, copy, modify and distribute this software and its 37 * documentation is hereby granted, provided that both the copyright 38 * notice and this permission notice appear in all copies of the 39 * software, derivative works or modified versions, and any portions 40 * thereof, and that both notices appear in supporting documentation. 41 * 42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 45 * 46 * Carnegie Mellon requests users of this software to return to 47 * 48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 49 * School of Computer Science 50 * Carnegie Mellon University 51 * Pittsburgh PA 15213-3890 52 * 53 * any improvements or extensions that they make and grant Carnegie Mellon 54 * the rights to redistribute these changes. 55 */ 56 /* 57 */ 58 /* 59 * Mach kernel debugging interface type declarations 60 */ 61 62 #ifndef _MACH_DEBUG_MACH_DEBUG_TYPES_H_ 63 #define _MACH_DEBUG_MACH_DEBUG_TYPES_H_ 64 65 #include <mach_debug/ipc_info.h> 66 #include <mach_debug/vm_info.h> 67 #include <mach_debug/zone_info.h> 68 #include <mach_debug/page_info.h> 69 #include <mach_debug/hash_info.h> 70 #include <mach_debug/lockgroup_info.h> 71 72 #define MACH_CORE_FILEHEADER_SIGNATURE 0x0063614d20646152ULL 73 #define MACH_CORE_FILEHEADER_V2_SIGNATURE 0x63614d2073736f42ULL 74 #define MACH_CORE_FILEHEADER_MAXFILES 16 75 #define MACH_CORE_FILEHEADER_NAMELEN 16 76 77 /* The following are defined for mach_core_fileheader_v2 */ 78 #define MACH_CORE_FILEHEADER_V2_FLAG_LOG_ENCRYPTED_AEA (1ULL << 0) /* The log is encrypted using AEA */ 79 #define MACH_CORE_FILEHEADER_V2_FLAG_EXISTING_COREFILE_KEY_FORMAT_NIST_P256 (1ULL << 8) /* The public key is an NIST-P256 ECC key */ 80 #define MACH_CORE_FILEHEADER_V2_FLAG_NEXT_COREFILE_KEY_FORMAT_NIST_P256 (1ULL << 16) /* The next public key is an NIST-P256 ECC key */ 81 82 #define MACH_CORE_FILEHEADER_V2_FLAGS_EXISTING_COREFILE_KEY_FORMAT_MASK (0x1ULL << 8) /* A bit-mask for all supported key formats */ 83 #define MACH_CORE_FILEHEADER_V2_FLAGS_NEXT_COREFILE_KEY_FORMAT_MASK (0x1ULL << 16) /* A bit-mask for all supported next key formats */ 84 85 #define MACH_CORE_FILEHEADER_V2_FLAGS_NEXT_KEY_FORMAT_TO_KEY_FORMAT(x) (((x) >> 8) & MACH_CORE_FILEHEADER_V2_FLAGS_EXISTING_COREFILE_KEY_FORMAT_MASK) 86 87 /* The following are defined for mach_core_details_v2 */ 88 #define MACH_CORE_DETAILS_V2_FLAG_ENCRYPTED_AEA (1ULL << 0) /* This core is encrypted using AEA */ 89 #define MACH_CORE_DETAILS_V2_FLAG_COMPRESSED_ZLIB (1ULL << 8) /* This core is compressed using ZLib */ 90 91 typedef char symtab_name_t[32]; 92 93 /* 94 *********************** 95 * 96 * Mach corefile layout 97 * 98 *********************** 99 * 100 * uint64_t signature 101 * uint64_t log_offset >---+ 102 * uint64_t log_length | 103 * mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES] | 104 * |--> uint64_t gzip_offset >---+ | 105 * | uint64_t gzip_length | | 106 * | char core_name[] | | 107 * |--> uint64_t gzip_offset >---+ | | 108 * | uint64_t gzip_length | | | 109 * | char core_name[] | | | 110 * |--> [...] | | | 111 * [log data. Plain-text] | | <---+ 112 * [core #1 data. Zlib compressed] | <---+ 113 * [core #2 data. Zlib compressed] <---+ 114 * [core #x data...] 115 */ 116 117 struct mach_core_details { 118 uint64_t gzip_offset; 119 uint64_t gzip_length; 120 char core_name[MACH_CORE_FILEHEADER_NAMELEN]; 121 }; 122 123 struct mach_core_fileheader { 124 uint64_t signature; /* MACH_CORE_FILEHEADER_SIGNATURE */ 125 uint64_t log_offset; 126 uint64_t log_length; 127 uint64_t num_files; 128 struct mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES]; 129 }; 130 131 /* 132 * Mach corefile V2 headers are denoted with MACH_CORE_FILEHEADER_V2_SIGNATURE. 133 * Note that the V2 headers contain a version field that further indicates the version of the 134 * header's contents. For example, if a V2 header's 'version' field indicates version 5, then 135 * the header follows the format of the 'mach_core_fileheader_v5' structure. 136 * 137 * Further note that 'mach_core_details_' structures are not bound to the same versioning scheme 138 * as the header itself. This means that it's perfectly acceptable for a 'mach_core_fileheader_v5' header 139 * to make use of 'mach_core_details_v2' 140 * 141 ************************** 142 * 143 * Mach corefile layout V2 (using a version 2 header struct as an example) 144 * 145 ************************** 146 * 147 * uint64_t signature 148 * uint32_t version 149 * uint64_t flags 150 * uint64_t pub_key_offset >---+ 151 * uint16_t pub_key_length | 152 * uint64_t log_offset >---+ | 153 * uint64_t log_length | | 154 * uint64_t num_files | | 155 * mach_core_details_v2 files[] | | 156 * |--> uint64_t flags | | 157 * | uint64_t offset >---+ | | 158 * | uint64_t length | | | 159 * | char core_name[] | | | 160 * |--> uint64_t flags | | | 161 * | uint64_t offset >---+ | | | 162 * | uint64_t length | | | | 163 * | char core_name[] | | | | 164 * |--> [...] | | | | 165 * [public key data] | | | <---+ 166 * [log data. Plain-text or an AEA container] | | <---+ 167 * [core #1 data. Zlib compressed. Possibly in an AEA container] | <---+ 168 * [core #2 data. Zlib compressed. Possibly in an AEA container] <---+ 169 * [core #x data...] 170 */ 171 172 struct mach_core_details_v2 { 173 uint64_t flags; /* See the MACH_CORE_DETAILS_V2_FLAG_* definitions */ 174 uint64_t offset; 175 uint64_t length; 176 char core_name[MACH_CORE_FILEHEADER_NAMELEN]; 177 }; 178 179 struct mach_core_fileheader_base { 180 uint64_t signature; /* MACH_CORE_FILEHEADER_V2_SIGNATURE */ 181 uint32_t version; 182 }; 183 184 struct mach_core_fileheader_v2 { 185 uint64_t signature; /* MACH_CORE_FILEHEADER_V2_SIGNATURE */ 186 uint32_t version; /* 2 */ 187 uint64_t flags; /* See the MACH_CORE_FILEHEADER_V2_FLAG_* definitions */ 188 uint64_t pub_key_offset; /* Offset of the public key */ 189 uint16_t pub_key_length; /* Length of the public key */ 190 uint64_t log_offset; 191 uint64_t log_length; 192 uint64_t num_files; 193 struct mach_core_details_v2 files[]; 194 }; 195 196 #define KOBJECT_DESCRIPTION_LENGTH 512 197 typedef char kobject_description_t[KOBJECT_DESCRIPTION_LENGTH]; 198 199 #endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */