2 * Copyright (c) 2002,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@
26 * File: mach/vm_region.h
28 * Define the attributes of a task's memory region
32 #ifndef _MACH_VM_REGION_H_
33 #define _MACH_VM_REGION_H_
35 #include <mach/boolean.h>
36 #include <mach/vm_prot.h>
37 #include <mach/vm_inherit.h>
38 #include <mach/vm_behavior.h>
43 * vm_region_info_t memory region attributes
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
];
54 #define VM_REGION_BASIC_INFO 10
56 struct vm_region_basic_info_64
{
58 vm_prot_t max_protection
;
59 vm_inherit_t inheritance
;
62 vm_object_offset_t offset
;
63 vm_behavior_t behavior
;
64 unsigned short user_wired_count
;
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
;
70 #define VM_REGION_BASIC_INFO_COUNT_64 \
71 (sizeof(vm_region_basic_info_data_64_t)/sizeof(int))
74 struct vm_region_basic_info
{
76 vm_prot_t max_protection
;
77 vm_inherit_t inheritance
;
81 vm_object_offset_t offset
;
85 vm_behavior_t behavior
;
86 unsigned short user_wired_count
;
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
;
92 #define VM_REGION_BASIC_INFO_COUNT \
93 (sizeof(vm_region_basic_info_data_t)/sizeof(int))
97 #define VM_REGION_EXTENDED_INFO 11
103 #define SM_TRUESHARED 5
104 #define SM_PRIVATE_ALIASED 6
105 #define SM_SHARED_ALIASED 7
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
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
;
122 unsigned int pages_dirtied
;
123 unsigned int ref_count
;
124 unsigned short shadow_depth
;
125 unsigned char external_pager
;
126 unsigned char share_mode
;
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
;
132 #define VM_REGION_EXTENDED_INFO_COUNT \
133 (sizeof(vm_region_extended_info_data_t)/sizeof(int))
136 #define VM_REGION_TOP_INFO 12
138 struct vm_region_top_info
{
140 unsigned int ref_count
;
141 unsigned int private_pages_resident
;
142 unsigned int shared_pages_resident
;
143 unsigned char share_mode
;
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
;
149 #define VM_REGION_TOP_INFO_COUNT \
150 (sizeof(vm_region_top_info_data_t)/sizeof(int))
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.
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.
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 */
178 vm_object_offset_t offset
; /* offset into object/map */
180 vm_offset_t offset
; /* offset into object/map */
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 */
186 unsigned int pages_dirtied
; /* only for objects */
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
;
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
;
200 #define VM_REGION_SUBMAP_INFO_COUNT \
201 (sizeof(vm_region_submap_info_data_t)/sizeof(int))
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 */
214 unsigned int pages_dirtied
; /* only for objects */
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
;
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
;
228 #define VM_REGION_SUBMAP_INFO_COUNT_64 \
229 (sizeof(vm_region_submap_info_data_64_t)/sizeof(int))
232 struct vm_read_entry
{
233 vm_address_t address
;
237 #define VM_MAP_ENTRY_MAX (256)
239 typedef struct vm_read_entry vm_read_entry_t
[VM_MAP_ENTRY_MAX
];
241 #endif /*_MACH_VM_REGION_H_*/