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