]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/vm_region.h
xnu-123.5.tar.gz
[apple/xnu.git] / osfmk / mach / vm_region.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * HISTORY
27 *
28 * Revision 1.1.1.1 1998/09/22 21:05:31 wsanchez
29 * Import of Mac OS X kernel (~semeria)
30 *
31 * Revision 1.1.1.1 1998/03/07 02:25:46 wsanchez
32 * Import of OSF Mach kernel (~mburg)
33 *
34 * Revision 1.1.5.1 1995/01/16 17:22:27 bolinger
35 * Import files unchanged from osc1.3b11 into cnmk_shared.
36 * [1995/01/16 17:20:37 bolinger]
37 *
38 * Revision 1.1.3.2 1993/10/05 22:23:22 watkins
39 * Merge forward.
40 * [1993/10/05 22:05:05 watkins]
41 *
42 * Revision 1.1.1.2 1993/09/28 19:42:50 watkins
43 * Created to comply with spec.
44 *
45 * $EndLog$
46 */
47 /*
48 * File: mach/vm_region.h
49 *
50 * Define the attributes of a task's memory region
51 *
52 */
53
54 #ifndef _MACH_VM_REGION_H_
55 #define _MACH_VM_REGION_H_
56
57 #include <mach/boolean.h>
58 #include <mach/vm_prot.h>
59 #include <mach/vm_inherit.h>
60 #include <mach/vm_behavior.h>
61
62 /*
63 * Types defined:
64 *
65 * vm_region_info_t memory region attributes
66 */
67
68 #define VM_REGION_INFO_MAX (1024)
69 typedef int *vm_region_info_t;
70 typedef int *vm_region_info_64_t;
71 typedef int *vm_region_recurse_info_t;
72 typedef int *vm_region_recurse_info_64_t;
73 typedef int vm_region_flavor_t;
74 typedef int vm_region_info_data_t[VM_REGION_INFO_MAX];
75
76 #define VM_REGION_BASIC_INFO 10
77
78 struct vm_region_basic_info_64 {
79 vm_prot_t protection;
80 vm_prot_t max_protection;
81 vm_inherit_t inheritance;
82 boolean_t shared;
83 boolean_t reserved;
84 vm_object_offset_t offset;
85 vm_behavior_t behavior;
86 unsigned short user_wired_count;
87 };
88
89 typedef struct vm_region_basic_info_64 *vm_region_basic_info_64_t;
90 typedef struct vm_region_basic_info_64 vm_region_basic_info_data_64_t;
91
92 #define VM_REGION_BASIC_INFO_COUNT_64 \
93 (sizeof(vm_region_basic_info_data_64_t)/sizeof(int))
94
95
96 struct vm_region_basic_info {
97 vm_prot_t protection;
98 vm_prot_t max_protection;
99 vm_inherit_t inheritance;
100 boolean_t shared;
101 boolean_t reserved;
102 #ifdef soon
103 vm_object_offset_t offset;
104 #else
105 vm_offset_t offset;
106 #endif
107 vm_behavior_t behavior;
108 unsigned short user_wired_count;
109 };
110
111 typedef struct vm_region_basic_info *vm_region_basic_info_t;
112 typedef struct vm_region_basic_info vm_region_basic_info_data_t;
113
114 #define VM_REGION_BASIC_INFO_COUNT \
115 (sizeof(vm_region_basic_info_data_t)/sizeof(int))
116
117
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
137
138 struct vm_region_extended_info {
139 vm_prot_t protection;
140 unsigned int user_tag;
141 unsigned int pages_resident;
142 unsigned int pages_shared_now_private;
143 unsigned int pages_swapped_out;
144 unsigned int pages_referenced;
145 unsigned int ref_count;
146 unsigned short shadow_depth;
147 unsigned char external_pager;
148 unsigned char share_mode;
149 };
150
151 typedef struct vm_region_extended_info *vm_region_extended_info_t;
152 typedef struct vm_region_extended_info vm_region_extended_info_data_t;
153
154 #define VM_REGION_EXTENDED_INFO_COUNT \
155 (sizeof(vm_region_extended_info_data_t)/sizeof(int))
156
157
158 #define VM_REGION_TOP_INFO 12
159
160 struct vm_region_top_info {
161 unsigned int obj_id;
162 unsigned int ref_count;
163 unsigned int private_pages_resident;
164 unsigned int shared_pages_resident;
165 unsigned char share_mode;
166 };
167
168 typedef struct vm_region_top_info *vm_region_top_info_t;
169 typedef struct vm_region_top_info vm_region_top_info_data_t;
170
171 #define VM_REGION_TOP_INFO_COUNT \
172 (sizeof(vm_region_top_info_data_t)/sizeof(int))
173
174
175
176 /*
177 * vm_region_submap_info will return information on a submap or object.
178 * The user supplies a nesting level on the call. When a walk of the
179 * user's map is done and a submap is encountered, the nesting count is
180 * checked. If the nesting count is greater than 1 the submap is entered and
181 * the offset relative to the address in the base map is examined. If the
182 * nesting count is zero, the information on the submap is returned.
183 * The caller may thus learn about a submap and its contents by judicious
184 * choice of the base map address and nesting count. The nesting count
185 * allows penetration of recursively mapped submaps. If a submap is
186 * encountered as a mapped entry of another submap, the caller may bump
187 * the nesting count and call vm_region_recurse again on the target address
188 * range. The "is_submap" field tells the caller whether or not a submap
189 * has been encountered.
190 *
191 * Object only fields are filled in through a walking of the object shadow
192 * chain (where one is present), and a walking of the resident page queue.
193 *
194 */
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 */
199 #ifdef soon
200 vm_object_offset_t offset; /* offset into object/map */
201 #else
202 vm_offset_t offset; /* offset into object/map */
203 #endif
204 unsigned int user_tag; /* user tag on map entry */
205 unsigned int pages_resident; /* only valid for objects */
206 unsigned int pages_shared_now_private; /* only for objects */
207 unsigned int pages_swapped_out; /* only for objects */
208 unsigned int pages_referenced; /* only for objects */
209 unsigned int ref_count; /* obj/map mappers, etc */
210 unsigned short shadow_depth; /* only for obj */
211 unsigned char external_pager; /* only for obj */
212 unsigned char share_mode; /* see enumeration */
213 boolean_t is_submap; /* submap vs obj */
214 vm_behavior_t behavior; /* access behavior hint */
215 vm_offset_t object_id; /* obj/map name, not a handle */
216 unsigned short user_wired_count;
217 };
218
219 typedef struct vm_region_submap_info *vm_region_submap_info_t;
220 typedef struct vm_region_submap_info vm_region_submap_info_data_t;
221
222 #define VM_REGION_SUBMAP_INFO_COUNT \
223 (sizeof(vm_region_submap_info_data_t)/sizeof(int))
224
225
226
227 struct vm_region_submap_info_64 {
228 vm_prot_t protection; /* present access protection */
229 vm_prot_t max_protection; /* max avail through vm_prot */
230 vm_inherit_t inheritance;/* behavior of map/obj on fork */
231 vm_object_offset_t offset; /* offset into object/map */
232 unsigned int user_tag; /* user tag on map entry */
233 unsigned int pages_resident; /* only valid for objects */
234 unsigned int pages_shared_now_private; /* only for objects */
235 unsigned int pages_swapped_out; /* only for objects */
236 unsigned int pages_referenced; /* only for objects */
237 unsigned int ref_count; /* obj/map mappers, etc */
238 unsigned short shadow_depth; /* only for obj */
239 unsigned char external_pager; /* only for obj */
240 unsigned char share_mode; /* see enumeration */
241 boolean_t is_submap; /* submap vs obj */
242 vm_behavior_t behavior; /* access behavior hint */
243 vm_offset_t object_id; /* obj/map name, not a handle */
244 unsigned short user_wired_count;
245 };
246
247 typedef struct vm_region_submap_info_64 *vm_region_submap_info_64_t;
248 typedef struct vm_region_submap_info_64 vm_region_submap_info_data_64_t;
249
250 #define VM_REGION_SUBMAP_INFO_COUNT_64 \
251 (sizeof(vm_region_submap_info_data_64_t)/sizeof(int))
252
253
254 struct vm_read_entry {
255 vm_address_t address;
256 vm_size_t size;
257 };
258
259 #define VM_MAP_ENTRY_MAX (256)
260
261 typedef struct vm_read_entry vm_read_entry_t[VM_MAP_ENTRY_MAX];
262
263 #endif /*_MACH_VM_REGION_H_*/