2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:31 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:25:46 wsanchez
32 * Import of OSF Mach kernel (~mburg)
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]
38 * Revision 1.1.3.2 1993/10/05 22:23:22 watkins
40 * [1993/10/05 22:05:05 watkins]
42 * Revision 1.1.1.2 1993/09/28 19:42:50 watkins
43 * Created to comply with spec.
48 * File: mach/vm_region.h
50 * Define the attributes of a task's memory region
54 #ifndef _MACH_VM_REGION_H_
55 #define _MACH_VM_REGION_H_
57 #include <mach/boolean.h>
58 #include <mach/vm_prot.h>
59 #include <mach/vm_inherit.h>
60 #include <mach/vm_behavior.h>
65 * vm_region_info_t memory region attributes
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
];
76 #define VM_REGION_BASIC_INFO 10
78 struct vm_region_basic_info_64
{
80 vm_prot_t max_protection
;
81 vm_inherit_t inheritance
;
84 vm_object_offset_t offset
;
85 vm_behavior_t behavior
;
86 unsigned short user_wired_count
;
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
;
92 #define VM_REGION_BASIC_INFO_COUNT_64 \
93 (sizeof(vm_region_basic_info_data_64_t)/sizeof(int))
96 struct vm_region_basic_info
{
98 vm_prot_t max_protection
;
99 vm_inherit_t inheritance
;
103 vm_object_offset_t offset
;
107 vm_behavior_t behavior
;
108 unsigned short user_wired_count
;
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
;
114 #define VM_REGION_BASIC_INFO_COUNT \
115 (sizeof(vm_region_basic_info_data_t)/sizeof(int))
119 #define VM_REGION_EXTENDED_INFO 11
125 #define SM_TRUESHARED 5
126 #define SM_PRIVATE_ALIASED 6
127 #define SM_SHARED_ALIASED 7
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
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_dirtied
;
145 unsigned int ref_count
;
146 unsigned short shadow_depth
;
147 unsigned char external_pager
;
148 unsigned char share_mode
;
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
;
154 #define VM_REGION_EXTENDED_INFO_COUNT \
155 (sizeof(vm_region_extended_info_data_t)/sizeof(int))
158 #define VM_REGION_TOP_INFO 12
160 struct vm_region_top_info
{
162 unsigned int ref_count
;
163 unsigned int private_pages_resident
;
164 unsigned int shared_pages_resident
;
165 unsigned char share_mode
;
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
;
171 #define VM_REGION_TOP_INFO_COUNT \
172 (sizeof(vm_region_top_info_data_t)/sizeof(int))
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.
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.
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 */
200 vm_object_offset_t offset
; /* offset into object/map */
202 vm_offset_t offset
; /* offset into object/map */
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_dirtied
; /* 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
;
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
;
222 #define VM_REGION_SUBMAP_INFO_COUNT \
223 (sizeof(vm_region_submap_info_data_t)/sizeof(int))
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_dirtied
; /* 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
;
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
;
250 #define VM_REGION_SUBMAP_INFO_COUNT_64 \
251 (sizeof(vm_region_submap_info_data_64_t)/sizeof(int))
254 struct vm_read_entry
{
255 vm_address_t address
;
259 #define VM_MAP_ENTRY_MAX (256)
261 typedef struct vm_read_entry vm_read_entry_t
[VM_MAP_ENTRY_MAX
];
263 #endif /*_MACH_VM_REGION_H_*/