]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb A |
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 | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* | |
31 | * @OSF_COPYRIGHT@ | |
32 | */ | |
1c79356b A |
33 | /* |
34 | * File: mach/vm_region.h | |
35 | * | |
36 | * Define the attributes of a task's memory region | |
37 | * | |
38 | */ | |
39 | ||
40 | #ifndef _MACH_VM_REGION_H_ | |
41 | #define _MACH_VM_REGION_H_ | |
42 | ||
43 | #include <mach/boolean.h> | |
44 | #include <mach/vm_prot.h> | |
45 | #include <mach/vm_inherit.h> | |
46 | #include <mach/vm_behavior.h> | |
91447636 A |
47 | #include <mach/vm_types.h> |
48 | #include <mach/message.h> | |
49 | #include <mach/machine/vm_param.h> | |
50 | #include <mach/machine/vm_types.h> | |
51 | #include <mach/memory_object_types.h> | |
52 | ||
53 | #include <sys/cdefs.h> | |
54 | ||
8ad349bb A |
55 | #if __DARWIN_ALIGN_POWER |
56 | #pragma options align=power | |
57 | #endif | |
1c79356b A |
58 | |
59 | /* | |
60 | * Types defined: | |
61 | * | |
62 | * vm_region_info_t memory region attributes | |
63 | */ | |
64 | ||
65 | #define VM_REGION_INFO_MAX (1024) | |
66 | typedef int *vm_region_info_t; | |
67 | typedef int *vm_region_info_64_t; | |
68 | typedef int *vm_region_recurse_info_t; | |
69 | typedef int *vm_region_recurse_info_64_t; | |
70 | typedef int vm_region_flavor_t; | |
71 | typedef int vm_region_info_data_t[VM_REGION_INFO_MAX]; | |
72 | ||
91447636 | 73 | #define VM_REGION_BASIC_INFO_64 9 |
1c79356b A |
74 | struct vm_region_basic_info_64 { |
75 | vm_prot_t protection; | |
76 | vm_prot_t max_protection; | |
77 | vm_inherit_t inheritance; | |
78 | boolean_t shared; | |
79 | boolean_t reserved; | |
91447636 | 80 | memory_object_offset_t offset; |
1c79356b A |
81 | vm_behavior_t behavior; |
82 | unsigned short user_wired_count; | |
83 | }; | |
1c79356b A |
84 | typedef struct vm_region_basic_info_64 *vm_region_basic_info_64_t; |
85 | typedef struct vm_region_basic_info_64 vm_region_basic_info_data_64_t; | |
86 | ||
91447636 A |
87 | #define VM_REGION_BASIC_INFO_COUNT_64 ((mach_msg_type_number_t) \ |
88 | (sizeof(vm_region_basic_info_data_64_t)/sizeof(int))) | |
1c79356b | 89 | |
91447636 A |
90 | /* |
91 | * Passing VM_REGION_BASIC_INFO to vm_region_64 | |
92 | * automatically converts it to a VM_REGION_BASIC_INFO_64. | |
93 | * Please use that explicitly instead. | |
94 | */ | |
95 | #define VM_REGION_BASIC_INFO 10 | |
1c79356b | 96 | |
91447636 A |
97 | /* |
98 | * This is the legacy basic info structure. It is | |
99 | * deprecated because it passes only a 32-bit memory object | |
100 | * offset back - too small for many larger objects (e.g. files). | |
101 | */ | |
1c79356b A |
102 | struct vm_region_basic_info { |
103 | vm_prot_t protection; | |
104 | vm_prot_t max_protection; | |
105 | vm_inherit_t inheritance; | |
106 | boolean_t shared; | |
107 | boolean_t reserved; | |
91447636 | 108 | uint32_t offset; /* too small for a real offset */ |
1c79356b A |
109 | vm_behavior_t behavior; |
110 | unsigned short user_wired_count; | |
111 | }; | |
112 | ||
113 | typedef struct vm_region_basic_info *vm_region_basic_info_t; | |
114 | typedef struct vm_region_basic_info vm_region_basic_info_data_t; | |
115 | ||
91447636 A |
116 | #define VM_REGION_BASIC_INFO_COUNT ((mach_msg_type_number_t) \ |
117 | (sizeof(vm_region_basic_info_data_t)/sizeof(int))) | |
1c79356b A |
118 | |
119 | #define VM_REGION_EXTENDED_INFO 11 | |
120 | ||
121 | #define SM_COW 1 | |
122 | #define SM_PRIVATE 2 | |
123 | #define SM_EMPTY 3 | |
124 | #define SM_SHARED 4 | |
125 | #define SM_TRUESHARED 5 | |
126 | #define SM_PRIVATE_ALIASED 6 | |
127 | #define SM_SHARED_ALIASED 7 | |
128 | ||
129 | /* | |
130 | * For submap info, the SM flags above are overlayed when a submap | |
131 | * is encountered. The field denotes whether or not machine level mapping | |
132 | * information is being shared. PTE's etc. When such sharing is taking | |
133 | * place the value returned is SM_TRUESHARED otherwise SM_PRIVATE is passed | |
134 | * back. | |
135 | */ | |
136 | ||
1c79356b A |
137 | struct vm_region_extended_info { |
138 | vm_prot_t protection; | |
139 | unsigned int user_tag; | |
140 | unsigned int pages_resident; | |
141 | unsigned int pages_shared_now_private; | |
142 | unsigned int pages_swapped_out; | |
0b4e3aa0 | 143 | unsigned int pages_dirtied; |
1c79356b A |
144 | unsigned int ref_count; |
145 | unsigned short shadow_depth; | |
146 | unsigned char external_pager; | |
147 | unsigned char share_mode; | |
148 | }; | |
149 | ||
150 | typedef struct vm_region_extended_info *vm_region_extended_info_t; | |
151 | typedef struct vm_region_extended_info vm_region_extended_info_data_t; | |
152 | ||
91447636 A |
153 | #define VM_REGION_EXTENDED_INFO_COUNT ((mach_msg_type_number_t) \ |
154 | (sizeof(vm_region_extended_info_data_t)/sizeof(int))) | |
1c79356b A |
155 | |
156 | ||
157 | #define VM_REGION_TOP_INFO 12 | |
158 | ||
159 | struct vm_region_top_info { | |
160 | unsigned int obj_id; | |
161 | unsigned int ref_count; | |
162 | unsigned int private_pages_resident; | |
163 | unsigned int shared_pages_resident; | |
164 | unsigned char share_mode; | |
165 | }; | |
166 | ||
167 | typedef struct vm_region_top_info *vm_region_top_info_t; | |
168 | typedef struct vm_region_top_info vm_region_top_info_data_t; | |
169 | ||
91447636 A |
170 | #define VM_REGION_TOP_INFO_COUNT ((mach_msg_type_number_t) \ |
171 | (sizeof(vm_region_top_info_data_t)/sizeof(int))) | |
1c79356b A |
172 | |
173 | ||
174 | ||
175 | /* | |
176 | * vm_region_submap_info will return information on a submap or object. | |
177 | * The user supplies a nesting level on the call. When a walk of the | |
178 | * user's map is done and a submap is encountered, the nesting count is | |
179 | * checked. If the nesting count is greater than 1 the submap is entered and | |
180 | * the offset relative to the address in the base map is examined. If the | |
181 | * nesting count is zero, the information on the submap is returned. | |
182 | * The caller may thus learn about a submap and its contents by judicious | |
183 | * choice of the base map address and nesting count. The nesting count | |
184 | * allows penetration of recursively mapped submaps. If a submap is | |
185 | * encountered as a mapped entry of another submap, the caller may bump | |
186 | * the nesting count and call vm_region_recurse again on the target address | |
187 | * range. The "is_submap" field tells the caller whether or not a submap | |
188 | * has been encountered. | |
189 | * | |
190 | * Object only fields are filled in through a walking of the object shadow | |
191 | * chain (where one is present), and a walking of the resident page queue. | |
192 | * | |
193 | */ | |
91447636 | 194 | |
1c79356b A |
195 | struct vm_region_submap_info { |
196 | vm_prot_t protection; /* present access protection */ | |
197 | vm_prot_t max_protection; /* max avail through vm_prot */ | |
198 | vm_inherit_t inheritance;/* behavior of map/obj on fork */ | |
91447636 | 199 | uint32_t offset; /* offset into object/map */ |
1c79356b A |
200 | unsigned int user_tag; /* user tag on map entry */ |
201 | unsigned int pages_resident; /* only valid for objects */ | |
202 | unsigned int pages_shared_now_private; /* only for objects */ | |
203 | unsigned int pages_swapped_out; /* only for objects */ | |
0b4e3aa0 | 204 | unsigned int pages_dirtied; /* only for objects */ |
1c79356b A |
205 | unsigned int ref_count; /* obj/map mappers, etc */ |
206 | unsigned short shadow_depth; /* only for obj */ | |
207 | unsigned char external_pager; /* only for obj */ | |
208 | unsigned char share_mode; /* see enumeration */ | |
209 | boolean_t is_submap; /* submap vs obj */ | |
210 | vm_behavior_t behavior; /* access behavior hint */ | |
211 | vm_offset_t object_id; /* obj/map name, not a handle */ | |
212 | unsigned short user_wired_count; | |
213 | }; | |
214 | ||
215 | typedef struct vm_region_submap_info *vm_region_submap_info_t; | |
216 | typedef struct vm_region_submap_info vm_region_submap_info_data_t; | |
217 | ||
91447636 A |
218 | #define VM_REGION_SUBMAP_INFO_COUNT ((mach_msg_type_number_t) \ |
219 | (sizeof(vm_region_submap_info_data_t)/sizeof(int))) | |
1c79356b A |
220 | |
221 | struct vm_region_submap_info_64 { | |
222 | vm_prot_t protection; /* present access protection */ | |
223 | vm_prot_t max_protection; /* max avail through vm_prot */ | |
224 | vm_inherit_t inheritance;/* behavior of map/obj on fork */ | |
91447636 | 225 | memory_object_offset_t offset; /* offset into object/map */ |
1c79356b A |
226 | unsigned int user_tag; /* user tag on map entry */ |
227 | unsigned int pages_resident; /* only valid for objects */ | |
228 | unsigned int pages_shared_now_private; /* only for objects */ | |
229 | unsigned int pages_swapped_out; /* only for objects */ | |
0b4e3aa0 | 230 | unsigned int pages_dirtied; /* only for objects */ |
1c79356b A |
231 | unsigned int ref_count; /* obj/map mappers, etc */ |
232 | unsigned short shadow_depth; /* only for obj */ | |
233 | unsigned char external_pager; /* only for obj */ | |
234 | unsigned char share_mode; /* see enumeration */ | |
235 | boolean_t is_submap; /* submap vs obj */ | |
236 | vm_behavior_t behavior; /* access behavior hint */ | |
237 | vm_offset_t object_id; /* obj/map name, not a handle */ | |
238 | unsigned short user_wired_count; | |
239 | }; | |
240 | ||
241 | typedef struct vm_region_submap_info_64 *vm_region_submap_info_64_t; | |
242 | typedef struct vm_region_submap_info_64 vm_region_submap_info_data_64_t; | |
243 | ||
91447636 A |
244 | #define VM_REGION_SUBMAP_INFO_COUNT_64 ((mach_msg_type_number_t) \ |
245 | (sizeof(vm_region_submap_info_data_64_t)/sizeof(int))) | |
1c79356b | 246 | |
91447636 A |
247 | struct mach_vm_read_entry { |
248 | mach_vm_address_t address; | |
249 | mach_vm_size_t size; | |
e5568f75 A |
250 | }; |
251 | ||
1c79356b A |
252 | struct vm_read_entry { |
253 | vm_address_t address; | |
254 | vm_size_t size; | |
255 | }; | |
256 | ||
257 | #define VM_MAP_ENTRY_MAX (256) | |
258 | ||
91447636 A |
259 | typedef struct mach_vm_read_entry mach_vm_read_entry_t[VM_MAP_ENTRY_MAX]; |
260 | typedef struct vm_read_entry vm_read_entry_t[VM_MAP_ENTRY_MAX]; | |
261 | ||
8ad349bb A |
262 | #if __DARWIN_ALIGN_POWER |
263 | #pragma options align=reset | |
264 | #endif | |
1c79356b A |
265 | |
266 | #endif /*_MACH_VM_REGION_H_*/ |