1/* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*- 2 * 3 * Copyright (c) 2006-2009 Apple Inc. All rights reserved. 4 * 5 * @APPLE_LICENSE_HEADER_START@ 6 * 7 * This file contains Original Code and/or Modifications of Original Code 8 * as defined in and that are subject to the Apple Public Source License 9 * Version 2.0 (the 'License'). You may not use this file except in 10 * compliance with the License. Please obtain a copy of the License at 11 * http://www.opensource.apple.com/apsl/ and read it before using this 12 * file. 13 * 14 * The Original Code and all software distributed under the License are 15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 * Please see the License for the specific language governing rights and 20 * limitations under the License. 21 * 22 * @APPLE_LICENSE_HEADER_END@ 23 */ 24#ifndef __DYLD_CACHE_FORMAT__ 25#define __DYLD_CACHE_FORMAT__ 26 27#include <sys/types.h> 28#include <stdint.h> 29#include <mach/shared_region.h> 30 31 32struct dyld_cache_header 33{ 34 char magic[16]; // e.g. "dyld_v0 i386" 35 uint32_t mappingOffset; // file offset to first dyld_cache_mapping_info 36 uint32_t mappingCount; // number of dyld_cache_mapping_info entries 37 uint32_t imagesOffset; // file offset to first dyld_cache_image_info 38 uint32_t imagesCount; // number of dyld_cache_image_info entries 39 uint64_t dyldBaseAddress; // base address of dyld when cache was built 40 uint64_t codeSignatureOffset; // file offset of code signature blob 41 uint64_t codeSignatureSize; // size of code signature blob (zero means to end of file) 42 uint64_t slideInfoOffset; // file offset of kernel slid info 43 uint64_t slideInfoSize; // size of kernel slid info 44 uint64_t localSymbolsOffset; // file offset of where local symbols are stored 45 uint64_t localSymbolsSize; // size of local symbols information 46 uint8_t uuid[16]; // unique value for each shared cache file 47}; 48 49struct dyld_cache_mapping_info { 50 uint64_t address; 51 uint64_t size; 52 uint64_t fileOffset; 53 uint32_t maxProt; 54 uint32_t initProt; 55}; 56 57struct dyld_cache_image_info 58{ 59 uint64_t address; 60 uint64_t modTime; 61 uint64_t inode; 62 uint32_t pathFileOffset; 63 uint32_t pad; 64}; 65 66struct dyld_cache_slide_info 67{ 68 uint32_t version; // currently 1 69 uint32_t toc_offset; 70 uint32_t toc_count; 71 uint32_t entries_offset; 72 uint32_t entries_count; 73 uint32_t entries_size; // currently 128 74 // uint16_t toc[toc_count]; 75 // entrybitmap entries[entries_count]; 76}; 77 78 79struct dyld_cache_local_symbols_info 80{ 81 uint32_t nlistOffset; // offset into this chunk of nlist entries 82 uint32_t nlistCount; // count of nlist entries 83 uint32_t stringsOffset; // offset into this chunk of string pool 84 uint32_t stringsSize; // byte count of string pool 85 uint32_t entriesOffset; // offset into this chunk of array of dyld_cache_local_symbols_entry 86 uint32_t entriesCount; // number of elements in dyld_cache_local_symbols_entry array 87}; 88 89struct dyld_cache_local_symbols_entry 90{ 91 uint32_t dylibOffset; // offset in cache file of start of dylib 92 uint32_t nlistStartIndex; // start index of locals for this dylib 93 uint32_t nlistCount; // number of local symbols for this dylib 94}; 95 96 97 98#define MACOSX_DYLD_SHARED_CACHE_DIR "/var/db/dyld/" 99#define IPHONE_DYLD_SHARED_CACHE_DIR "/System/Library/Caches/com.apple.dyld/" 100#define DYLD_SHARED_CACHE_BASE_NAME "dyld_shared_cache_" 101 102 103 104#endif // __DYLD_CACHE_FORMAT__ 105 106 107