Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/Chameleon/i386/include/mach/vm_region.h

Source at commit 296 created 12 years 10 months ago.
By ifabio, add i386 folder
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 *File:mach/vm_region.h
33 *
34 *Define the attributes of a task's memory region
35 *
36 */
37
38#ifndef_MACH_VM_REGION_H_
39#define _MACH_VM_REGION_H_
40
41#include <mach/boolean.h>
42#include <mach/vm_prot.h>
43#include <mach/vm_inherit.h>
44#include <mach/vm_behavior.h>
45#include <mach/vm_types.h>
46#include <mach/message.h>
47#include <mach/machine/vm_param.h>
48#include <mach/machine/vm_types.h>
49#include <mach/memory_object_types.h>
50
51#include <sys/cdefs.h>
52
53#pragma pack(4)
54
55// LP64todo: all the current tools are 32bit, obviously never worked for 64b
56// so probably should be a real 32b ID vs. ptr.
57// Current users just check for equality
58typedef uint32_t vm32_object_id_t;
59
60/*
61 *Types defined:
62 *
63 *vm_region_info_tmemory region attributes
64 */
65
66#define VM_REGION_INFO_MAX (1024)
67typedef int*vm_region_info_t;
68typedef int*vm_region_info_64_t;
69typedef int*vm_region_recurse_info_t;
70typedef int*vm_region_recurse_info_64_t;
71typedef int vm_region_flavor_t;
72typedef int vm_region_info_data_t[VM_REGION_INFO_MAX];
73
74#define VM_REGION_BASIC_INFO_649
75struct vm_region_basic_info_64 {
76vm_prot_tprotection;
77vm_prot_tmax_protection;
78vm_inherit_tinheritance;
79boolean_tshared;
80boolean_treserved;
81memory_object_offset_toffset;
82vm_behavior_tbehavior;
83unsigned shortuser_wired_count;
84};
85typedef struct vm_region_basic_info_64*vm_region_basic_info_64_t;
86typedef struct vm_region_basic_info_64 vm_region_basic_info_data_64_t;
87
88#define VM_REGION_BASIC_INFO_COUNT_64((mach_msg_type_number_t) \
89(sizeof(vm_region_basic_info_data_64_t)/sizeof(int)))
90
91/*
92 * Passing VM_REGION_BASIC_INFO to vm_region_64
93 * automatically converts it to a VM_REGION_BASIC_INFO_64.
94 * Please use that explicitly instead.
95 */
96#define VM_REGION_BASIC_INFO10
97
98/*
99 * This is the legacy basic info structure. It is
100 * deprecated because it passes only a 32-bit memory object
101 * offset back - too small for many larger objects (e.g. files).
102 */
103struct vm_region_basic_info {
104vm_prot_tprotection;
105vm_prot_tmax_protection;
106vm_inherit_tinheritance;
107boolean_tshared;
108boolean_treserved;
109uint32_toffset; /* too small for a real offset */
110vm_behavior_tbehavior;
111unsigned shortuser_wired_count;
112};
113
114typedef struct vm_region_basic_info*vm_region_basic_info_t;
115typedef struct vm_region_basic_info vm_region_basic_info_data_t;
116
117#define VM_REGION_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
118(sizeof(vm_region_basic_info_data_t)/sizeof(int)))
119
120#define VM_REGION_EXTENDED_INFO11
121
122#define SM_COW 1
123#define SM_PRIVATE 2
124#define SM_EMPTY 3
125#define SM_SHARED 4
126#define SM_TRUESHARED 5
127#define SM_PRIVATE_ALIASED 6
128#define SM_SHARED_ALIASED 7
129
130/*
131 * For submap info, the SM flags above are overlayed when a submap
132 * is encountered. The field denotes whether or not machine level mapping
133 * information is being shared. PTE's etc. When such sharing is taking
134 * place the value returned is SM_TRUESHARED otherwise SM_PRIVATE is passed
135 * back.
136 */
137
138struct vm_region_extended_info {
139vm_prot_tprotection;
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;
149};
150
151typedef struct vm_region_extended_info*vm_region_extended_info_t;
152typedef struct vm_region_extended_info vm_region_extended_info_data_t;
153
154#define VM_REGION_EXTENDED_INFO_COUNT((mach_msg_type_number_t) \
155(sizeof(vm_region_extended_info_data_t)/sizeof(int)))
156
157
158#define VM_REGION_TOP_INFO12
159
160struct 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
168typedef struct vm_region_top_info*vm_region_top_info_t;
169typedef struct vm_region_top_info vm_region_top_info_data_t;
170
171#define VM_REGION_TOP_INFO_COUNT ((mach_msg_type_number_t) \
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
196struct vm_region_submap_info {
197vm_prot_tprotection; /* present access protection */
198vm_prot_tmax_protection; /* max avail through vm_prot */
199vm_inherit_tinheritance;/* behavior of map/obj on fork */
200uint32_toffset;/* offset into object/map */
201 unsigned int user_tag;/* user tag on map entry */
202 unsigned int pages_resident;/* only valid for objects */
203 unsigned int pages_shared_now_private; /* only for objects */
204 unsigned int pages_swapped_out; /* only for objects */
205 unsigned int pages_dirtied; /* only for objects */
206 unsigned int ref_count; /* obj/map mappers, etc */
207 unsigned short shadow_depth; /* only for obj */
208 unsigned char external_pager; /* only for obj */
209 unsigned char share_mode;/* see enumeration */
210boolean_tis_submap;/* submap vs obj */
211vm_behavior_tbehavior;/* access behavior hint */
212vm32_object_id_tobject_id;/* obj/map name, not a handle */
213unsigned shortuser_wired_count;
214};
215
216typedef struct vm_region_submap_info*vm_region_submap_info_t;
217typedef struct vm_region_submap_info vm_region_submap_info_data_t;
218
219#define VM_REGION_SUBMAP_INFO_COUNT ((mach_msg_type_number_t) \
220(sizeof(vm_region_submap_info_data_t)/sizeof(int)))
221
222struct vm_region_submap_info_64 {
223vm_prot_tprotection; /* present access protection */
224vm_prot_tmax_protection; /* max avail through vm_prot */
225vm_inherit_tinheritance;/* behavior of map/obj on fork */
226memory_object_offset_toffset;/* offset into object/map */
227 unsigned int user_tag;/* user tag on map entry */
228 unsigned int pages_resident;/* only valid for objects */
229 unsigned int pages_shared_now_private; /* only for objects */
230 unsigned int pages_swapped_out; /* only for objects */
231 unsigned int pages_dirtied; /* only for objects */
232 unsigned int ref_count; /* obj/map mappers, etc */
233 unsigned short shadow_depth; /* only for obj */
234 unsigned char external_pager; /* only for obj */
235 unsigned char share_mode;/* see enumeration */
236boolean_tis_submap;/* submap vs obj */
237vm_behavior_tbehavior;/* access behavior hint */
238vm32_object_id_tobject_id;/* obj/map name, not a handle */
239unsigned shortuser_wired_count;
240};
241
242typedef struct vm_region_submap_info_64*vm_region_submap_info_64_t;
243typedef struct vm_region_submap_info_64 vm_region_submap_info_data_64_t;
244
245#define VM_REGION_SUBMAP_INFO_COUNT_64((mach_msg_type_number_t) \
246(sizeof(vm_region_submap_info_data_64_t)/sizeof(int)))
247
248struct vm_region_submap_short_info_64 {
249vm_prot_tprotection; /* present access protection */
250vm_prot_tmax_protection; /* max avail through vm_prot */
251vm_inherit_tinheritance;/* behavior of map/obj on fork */
252memory_object_offset_toffset;/* offset into object/map */
253 unsigned int user_tag;/* user tag on map entry */
254 unsigned int ref_count; /* obj/map mappers, etc */
255 unsigned short shadow_depth; /* only for obj */
256 unsigned char external_pager; /* only for obj */
257 unsigned char share_mode;/* see enumeration */
258boolean_tis_submap;/* submap vs obj */
259vm_behavior_tbehavior;/* access behavior hint */
260vm32_object_id_tobject_id;/* obj/map name, not a handle */
261unsigned shortuser_wired_count;
262};
263
264typedef struct vm_region_submap_short_info_64*vm_region_submap_short_info_64_t;
265typedef struct vm_region_submap_short_info_64 vm_region_submap_short_info_data_64_t;
266
267#define VM_REGION_SUBMAP_SHORT_INFO_COUNT_64((mach_msg_type_number_t) \
268(sizeof(vm_region_submap_short_info_data_64_t)/sizeof(int)))
269
270
271struct mach_vm_read_entry {
272mach_vm_address_t address;
273mach_vm_size_t size;
274};
275
276struct vm_read_entry {
277vm_address_taddress;
278vm_size_tsize;
279};
280
281#if VM32_SUPPORT
282struct vm32_read_entry {
283vm32_address_taddress;
284vm32_size_tsize;
285};
286#endif
287
288
289#define VM_MAP_ENTRY_MAX (256)
290
291typedef struct mach_vm_read_entrymach_vm_read_entry_t[VM_MAP_ENTRY_MAX];
292typedef struct vm_read_entryvm_read_entry_t[VM_MAP_ENTRY_MAX];
293#if VM32_SUPPORT
294typedef struct vm32_read_entryvm32_read_entry_t[VM_MAP_ENTRY_MAX];
295#endif
296
297#pragma pack()
298
299
300#define VM_PAGE_INFO_MAX
301typedef int *vm_page_info_t;
302typedef int vm_page_info_data_t[VM_PAGE_INFO_MAX];
303typedef int vm_page_info_flavor_t;
304
305#define VM_PAGE_INFO_BASIC1
306struct vm_page_info_basic {
307intdisposition;
308intref_count;
309vm_object_id_tobject_id;
310memory_object_offset_toffset;
311intdepth;
312};
313typedef struct vm_page_info_basic*vm_page_info_basic_t;
314typedef struct vm_page_info_basicvm_page_info_basic_data_t;
315
316#define VM_PAGE_INFO_BASIC_COUNT((mach_msg_type_number_t) \
317(sizeof(vm_page_info_basic_data_t)/sizeof(int)))
318
319
320#endif/*_MACH_VM_REGION_H_*/
321

Archive Download this file

Revision: 296