1 /* 2 * Copyright (c) 2007 Apple Inc. All rights reserved. 3 * 4 * @APPLE_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. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 /* 24 * 25 * File: vm/vm_shared_region.h 26 * 27 * protos and struct definitions for shared region 28 */ 29 30 #ifndef _VM_SHARED_REGION_H_ 31 #define _VM_SHARED_REGION_H_ 32 33 #ifdef KERNEL_PRIVATE 34 35 #include <mach/vm_prot.h> 36 #include <mach/mach_types.h> 37 #include <mach/shared_region.h> 38 39 #include <kern/kern_types.h> 40 #include <kern/macro_help.h> 41 42 #include <vm/vm_map.h> 43 44 extern int shared_region_version; 45 extern int shared_region_persistence; 46 47 #if DEBUG 48 extern int shared_region_debug; 49 #define SHARED_REGION_DEBUG(args) \ 50 MACRO_BEGIN \ 51 if (shared_region_debug) { \ 52 kprintf args; \ 53 } \ 54 MACRO_END 55 #else /* DEBUG */ 56 #define SHARED_REGION_DEBUG(args) 57 #endif /* DEBUG */ 58 59 extern int shared_region_trace_level; 60 61 extern struct vm_shared_region *primary_system_shared_region; 62 63 #define SHARED_REGION_TRACE_NONE_LVL 0 /* no trace */ 64 #define SHARED_REGION_TRACE_ERROR_LVL 1 /* trace abnormal events */ 65 #define SHARED_REGION_TRACE_INFO_LVL 2 /* trace all events */ 66 #define SHARED_REGION_TRACE_DEBUG_LVL 3 /* extra traces for debug */ 67 #define SHARED_REGION_TRACE(level, args) \ 68 MACRO_BEGIN \ 69 if (shared_region_trace_level >= level) { \ 70 printf args; \ 71 } \ 72 MACRO_END 73 #define SHARED_REGION_TRACE_NONE(args) 74 #define SHARED_REGION_TRACE_ERROR(args) \ 75 MACRO_BEGIN \ 76 SHARED_REGION_TRACE(SHARED_REGION_TRACE_ERROR_LVL, \ 77 args); \ 78 MACRO_END 79 #define SHARED_REGION_TRACE_INFO(args) \ 80 MACRO_BEGIN \ 81 SHARED_REGION_TRACE(SHARED_REGION_TRACE_INFO_LVL, \ 82 args); \ 83 MACRO_END 84 #define SHARED_REGION_TRACE_DEBUG(args) \ 85 MACRO_BEGIN \ 86 SHARED_REGION_TRACE(SHARED_REGION_TRACE_DEBUG_LVL, \ 87 args); \ 88 MACRO_END 89 90 typedef struct vm_shared_region *vm_shared_region_t; 91 92 #ifndef MACH_KERNEL_PRIVATE 93 struct vm_shared_region; 94 struct vm_shared_region_slide_info; 95 struct vm_shared_region_slide_info_entry; 96 struct slide_info_entry_toc; 97 #endif /* MACH_KERNEL_PRIVATE */ 98 99 struct _sr_file_mappings { 100 int fd; 101 uint32_t mappings_count; 102 struct shared_file_mapping_slide_np *mappings; 103 uint32_t slide; 104 struct fileproc *fp; 105 struct vnode *vp; 106 memory_object_size_t file_size; 107 memory_object_control_t file_control; 108 }; 109 110 111 #endif /* KERNEL_PRIVATE */ 112 113 #endif /* _VM_SHARED_REGION_H_ */ 114