2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 * File: mach/vm_region.h
31 * Define the attributes of a task's memory region
35 #ifndef _MACH_VM_REGION_H_
36 #define _MACH_VM_REGION_H_
38 #include <mach/boolean.h>
39 #include <mach/vm_prot.h>
40 #include <mach/vm_inherit.h>
41 #include <mach/vm_behavior.h>
46 * vm_region_info_t memory region attributes
49 #define VM_REGION_INFO_MAX (1024)
50 typedef int *vm_region_info_t
;
51 typedef int *vm_region_info_64_t
;
52 typedef int *vm_region_recurse_info_t
;
53 typedef int *vm_region_recurse_info_64_t
;
54 typedef int vm_region_flavor_t
;
55 typedef int vm_region_info_data_t
[VM_REGION_INFO_MAX
];
57 #define VM_REGION_BASIC_INFO 10
59 struct vm_region_basic_info_64
{
61 vm_prot_t max_protection
;
62 vm_inherit_t inheritance
;
65 vm_object_offset_t offset
;
66 vm_behavior_t behavior
;
67 unsigned short user_wired_count
;
70 typedef struct vm_region_basic_info_64
*vm_region_basic_info_64_t
;
71 typedef struct vm_region_basic_info_64 vm_region_basic_info_data_64_t
;
73 #define VM_REGION_BASIC_INFO_COUNT_64 \
74 (sizeof(vm_region_basic_info_data_64_t)/sizeof(int))
77 struct vm_region_basic_info
{
79 vm_prot_t max_protection
;
80 vm_inherit_t inheritance
;
84 vm_object_offset_t offset
;
88 vm_behavior_t behavior
;
89 unsigned short user_wired_count
;
92 typedef struct vm_region_basic_info
*vm_region_basic_info_t
;
93 typedef struct vm_region_basic_info vm_region_basic_info_data_t
;
95 #define VM_REGION_BASIC_INFO_COUNT \
96 (sizeof(vm_region_basic_info_data_t)/sizeof(int))
100 #define VM_REGION_EXTENDED_INFO 11
106 #define SM_TRUESHARED 5
107 #define SM_PRIVATE_ALIASED 6
108 #define SM_SHARED_ALIASED 7
111 * For submap info, the SM flags above are overlayed when a submap
112 * is encountered. The field denotes whether or not machine level mapping
113 * information is being shared. PTE's etc. When such sharing is taking
114 * place the value returned is SM_TRUESHARED otherwise SM_PRIVATE is passed
119 struct vm_region_extended_info
{
120 vm_prot_t protection
;
121 unsigned int user_tag
;
122 unsigned int pages_resident
;
123 unsigned int pages_shared_now_private
;
124 unsigned int pages_swapped_out
;
125 unsigned int pages_dirtied
;
126 unsigned int ref_count
;
127 unsigned short shadow_depth
;
128 unsigned char external_pager
;
129 unsigned char share_mode
;
132 typedef struct vm_region_extended_info
*vm_region_extended_info_t
;
133 typedef struct vm_region_extended_info vm_region_extended_info_data_t
;
135 #define VM_REGION_EXTENDED_INFO_COUNT \
136 (sizeof(vm_region_extended_info_data_t)/sizeof(int))
139 #define VM_REGION_TOP_INFO 12
141 struct vm_region_top_info
{
143 unsigned int ref_count
;
144 unsigned int private_pages_resident
;
145 unsigned int shared_pages_resident
;
146 unsigned char share_mode
;
149 typedef struct vm_region_top_info
*vm_region_top_info_t
;
150 typedef struct vm_region_top_info vm_region_top_info_data_t
;
152 #define VM_REGION_TOP_INFO_COUNT \
153 (sizeof(vm_region_top_info_data_t)/sizeof(int))
158 * vm_region_submap_info will return information on a submap or object.
159 * The user supplies a nesting level on the call. When a walk of the
160 * user's map is done and a submap is encountered, the nesting count is
161 * checked. If the nesting count is greater than 1 the submap is entered and
162 * the offset relative to the address in the base map is examined. If the
163 * nesting count is zero, the information on the submap is returned.
164 * The caller may thus learn about a submap and its contents by judicious
165 * choice of the base map address and nesting count. The nesting count
166 * allows penetration of recursively mapped submaps. If a submap is
167 * encountered as a mapped entry of another submap, the caller may bump
168 * the nesting count and call vm_region_recurse again on the target address
169 * range. The "is_submap" field tells the caller whether or not a submap
170 * has been encountered.
172 * Object only fields are filled in through a walking of the object shadow
173 * chain (where one is present), and a walking of the resident page queue.
176 struct vm_region_submap_info
{
177 vm_prot_t protection
; /* present access protection */
178 vm_prot_t max_protection
; /* max avail through vm_prot */
179 vm_inherit_t inheritance
;/* behavior of map/obj on fork */
181 vm_object_offset_t offset
; /* offset into object/map */
183 vm_offset_t offset
; /* offset into object/map */
185 unsigned int user_tag
; /* user tag on map entry */
186 unsigned int pages_resident
; /* only valid for objects */
187 unsigned int pages_shared_now_private
; /* only for objects */
188 unsigned int pages_swapped_out
; /* only for objects */
189 unsigned int pages_dirtied
; /* only for objects */
190 unsigned int ref_count
; /* obj/map mappers, etc */
191 unsigned short shadow_depth
; /* only for obj */
192 unsigned char external_pager
; /* only for obj */
193 unsigned char share_mode
; /* see enumeration */
194 boolean_t is_submap
; /* submap vs obj */
195 vm_behavior_t behavior
; /* access behavior hint */
196 vm_offset_t object_id
; /* obj/map name, not a handle */
197 unsigned short user_wired_count
;
200 typedef struct vm_region_submap_info
*vm_region_submap_info_t
;
201 typedef struct vm_region_submap_info vm_region_submap_info_data_t
;
203 #define VM_REGION_SUBMAP_INFO_COUNT \
204 (sizeof(vm_region_submap_info_data_t)/sizeof(int))
208 struct vm_region_submap_info_64
{
209 vm_prot_t protection
; /* present access protection */
210 vm_prot_t max_protection
; /* max avail through vm_prot */
211 vm_inherit_t inheritance
;/* behavior of map/obj on fork */
212 vm_object_offset_t offset
; /* offset into object/map */
213 unsigned int user_tag
; /* user tag on map entry */
214 unsigned int pages_resident
; /* only valid for objects */
215 unsigned int pages_shared_now_private
; /* only for objects */
216 unsigned int pages_swapped_out
; /* only for objects */
217 unsigned int pages_dirtied
; /* only for objects */
218 unsigned int ref_count
; /* obj/map mappers, etc */
219 unsigned short shadow_depth
; /* only for obj */
220 unsigned char external_pager
; /* only for obj */
221 unsigned char share_mode
; /* see enumeration */
222 boolean_t is_submap
; /* submap vs obj */
223 vm_behavior_t behavior
; /* access behavior hint */
224 vm_offset_t object_id
; /* obj/map name, not a handle */
225 unsigned short user_wired_count
;
228 typedef struct vm_region_submap_info_64
*vm_region_submap_info_64_t
;
229 typedef struct vm_region_submap_info_64 vm_region_submap_info_data_64_t
;
231 #define VM_REGION_SUBMAP_INFO_COUNT_64 \
232 (sizeof(vm_region_submap_info_data_64_t)/sizeof(int))
235 struct vm_read_entry
{
236 vm_address_t address
;
240 #define VM_MAP_ENTRY_MAX (256)
242 typedef struct vm_read_entry vm_read_entry_t
[VM_MAP_ENTRY_MAX
];
244 #endif /*_MACH_VM_REGION_H_*/