]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/vm_map.defs
xnu-1486.2.11.tar.gz
[apple/xnu.git] / osfmk / mach / vm_map.defs
1 /*
2 * Copyright (c) 2000-2004 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_FREE_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 */
58 /*
59 * File: mach/vm_map.defs
60 *
61 * Exported (native-sized) kernel VM calls.
62 */
63
64 subsystem
65 #if KERNEL_SERVER
66 KernelServer
67 #endif /* KERNEL_SERVER */
68 vm_map 3800;
69
70 #include <mach/std_types.defs>
71 #include <mach/mach_types.defs>
72 #include <mach_debug/mach_debug_types.defs>
73
74 /*
75 * Returns information about the contents of the virtual
76 * address space of the target task at the specified
77 * address. The returned protection, inheritance, sharing
78 * and memory object values apply to the entire range described
79 * by the address range returned; the memory object offset
80 * corresponds to the beginning of the address range.
81 * [If the specified address is not allocated, the next
82 * highest address range is described. If no addresses beyond
83 * the one specified are allocated, the call returns KERN_NO_SPACE.]
84 */
85 routine vm_region(
86 target_task : vm_map_t;
87 inout address : vm_address_t;
88 out size : vm_size_t;
89 flavor : vm_region_flavor_t;
90 out info : vm_region_info_t, CountInOut;
91 out object_name : memory_object_name_t =
92 MACH_MSG_TYPE_MOVE_SEND
93 ctype: mach_port_t);
94
95 /*
96 * Allocate zero-filled memory in the address space
97 * of the target task, either at the specified address,
98 * or wherever space can be found (if anywhere is TRUE),
99 * of the specified size. The address at which the
100 * allocation actually took place is returned.
101 */
102 routine vm_allocate(
103 target_task : vm_task_entry_t;
104 inout address : vm_address_t;
105 size : vm_size_t;
106 flags : int);
107
108 /*
109 * Deallocate the specified range from the virtual
110 * address space of the target task.
111 */
112 routine vm_deallocate(
113 target_task : vm_task_entry_t;
114 address : vm_address_t;
115 size : vm_size_t);
116
117 /*
118 * Set the current or maximum protection attribute
119 * for the specified range of the virtual address
120 * space of the target task. The current protection
121 * limits the memory access rights of threads within
122 * the task; the maximum protection limits the accesses
123 * that may be given in the current protection.
124 * Protections are specified as a set of {read, write, execute}
125 * *permissions*.
126 */
127 routine vm_protect(
128 target_task : vm_task_entry_t;
129 address : vm_address_t;
130 size : vm_size_t;
131 set_maximum : boolean_t;
132 new_protection : vm_prot_t);
133
134 /*
135 * Set the inheritance attribute for the specified range
136 * of the virtual address space of the target task.
137 * The inheritance value is one of {none, copy, share}, and
138 * specifies how the child address space should acquire
139 * this memory at the time of a task_create call.
140 */
141 routine vm_inherit(
142 target_task : vm_task_entry_t;
143 address : vm_address_t;
144 size : vm_size_t;
145 new_inheritance : vm_inherit_t);
146
147 /*
148 * Returns the contents of the specified range of the
149 * virtual address space of the target task. [The
150 * range must be aligned on a virtual page boundary,
151 * and must be a multiple of pages in extent. The
152 * protection on the specified range must permit reading.]
153 */
154 routine vm_read(
155 target_task : vm_map_t;
156 address : vm_address_t;
157 size : vm_size_t;
158 out data : pointer_t);
159
160 /*
161 * List corrollary to vm_read, returns mapped contents of specified
162 * ranges within target address space.
163 */
164 routine vm_read_list(
165 target_task : vm_map_t;
166 inout data_list : vm_read_entry_t;
167 count : natural_t);
168
169 /*
170 * Writes the contents of the specified range of the
171 * virtual address space of the target task. [The
172 * range must be aligned on a virtual page boundary,
173 * and must be a multiple of pages in extent. The
174 * protection on the specified range must permit writing.]
175 */
176 routine vm_write(
177 target_task : vm_map_t;
178 address : vm_address_t;
179 data : pointer_t);
180
181 /*
182 * Copy the contents of the source range of the virtual
183 * address space of the target task to the destination
184 * range in that same address space. [Both of the
185 * ranges must be aligned on a virtual page boundary,
186 * and must be multiples of pages in extent. The
187 * protection on the source range must permit reading,
188 * and the protection on the destination range must
189 * permit writing.]
190 */
191 routine vm_copy(
192 target_task : vm_map_t;
193 source_address : vm_address_t;
194 size : vm_size_t;
195 dest_address : vm_address_t);
196
197 /*
198 * Returns the contents of the specified range of the
199 * virtual address space of the target task. [There
200 * are no alignment restrictions, and the results will
201 * overwrite the area pointed to by data - which must
202 * already exist. The protection on the specified range
203 * must permit reading.]
204 */
205 routine vm_read_overwrite(
206 target_task : vm_map_t;
207 address : vm_address_t;
208 size : vm_size_t;
209 data : vm_address_t;
210 out outsize : vm_size_t);
211
212
213 routine vm_msync(
214 target_task : vm_map_t;
215 address : vm_address_t;
216 size : vm_size_t;
217 sync_flags : vm_sync_t );
218
219 /*
220 * Set the paging behavior attribute for the specified range
221 * of the virtual address space of the target task.
222 * The behavior value is one of {default, random, forward
223 * sequential, reverse sequential} and indicates the expected
224 * page reference pattern for the specified range.
225 */
226 routine vm_behavior_set(
227 target_task : vm_map_t;
228 address : vm_address_t;
229 size : vm_size_t;
230 new_behavior : vm_behavior_t);
231
232
233 /*
234 * Map a user-defined memory object into the virtual address
235 * space of the target task. If desired (anywhere is TRUE),
236 * the kernel will find a suitable address range of the
237 * specified size; else, the specific address will be allocated.
238 *
239 * The beginning address of the range will be aligned on a virtual
240 * page boundary, be at or beyond the address specified, and
241 * meet the mask requirements (bits turned on in the mask must not
242 * be turned on in the result); the size of the range, in bytes,
243 * will be rounded up to an integral number of virtual pages.
244 *
245 * The memory in the resulting range will be associated with the
246 * specified memory object, with the beginning of the memory range
247 * referring to the specified offset into the memory object.
248 *
249 * The mapping will take the current and maximum protections and
250 * the inheritance attributes specified; see the vm_protect and
251 * vm_inherit calls for a description of these attributes.
252 *
253 * If desired (copy is TRUE), the memory range will be filled
254 * with a copy of the data from the memory object; this copy will
255 * be private to this mapping in this target task. Otherwise,
256 * the memory in this mapping will be shared with other mappings
257 * of the same memory object at the same offset (in this task or
258 * in other tasks). [The Mach kernel only enforces shared memory
259 * consistency among mappings on one host with similar page alignments.
260 * The user-defined memory manager for this object is responsible
261 * for further consistency.]
262 */
263 routine vm_map(
264 target_task : vm_task_entry_t;
265 inout address : vm_address_t;
266 size : vm_size_t;
267 mask : vm_address_t;
268 flags : int;
269 object : mem_entry_name_port_t;
270 offset : vm_offset_t;
271 copy : boolean_t;
272 cur_protection : vm_prot_t;
273 max_protection : vm_prot_t;
274 inheritance : vm_inherit_t);
275
276 /*
277 * Set/Get special properties of memory associated
278 * to some virtual address range, such as cachability,
279 * migrability, replicability. Machine-dependent.
280 */
281 routine vm_machine_attribute(
282 target_task : vm_map_t;
283 address : vm_address_t;
284 size : vm_size_t;
285 attribute : vm_machine_attribute_t;
286 inout value : vm_machine_attribute_val_t);
287
288 /*
289 * Map portion of a task's address space.
290 */
291 routine vm_remap(
292 target_task : vm_map_t;
293 inout target_address : vm_address_t;
294 size : vm_size_t;
295 mask : vm_address_t;
296 anywhere : boolean_t;
297 src_task : vm_map_t;
298 src_address : vm_address_t;
299 copy : boolean_t;
300 out cur_protection : vm_prot_t;
301 out max_protection : vm_prot_t;
302 inheritance : vm_inherit_t);
303
304 /*
305 * Require that all future virtual memory allocation
306 * allocates wired memory. Setting must_wire to FALSE
307 * disables the wired future feature.
308 */
309 routine task_wire(
310 target_task : vm_map_t;
311 must_wire : boolean_t);
312
313
314 /*
315 * Allow application level processes to create named entries which
316 * correspond to mapped portions of their address space. These named
317 * entries can then be manipulated, shared with other processes in
318 * other address spaces and ultimately mapped in ohter address spaces
319 */
320
321 routine mach_make_memory_entry(
322 target_task :vm_map_t;
323 inout size :vm_size_t;
324 offset :vm_offset_t;
325 permission :vm_prot_t;
326 out object_handle :mem_entry_name_port_move_send_t;
327 parent_entry :mem_entry_name_port_t);
328
329 /*
330 * Give the caller information on the given location in a virtual
331 * address space. If a page is mapped return ref and dirty info.
332 */
333 routine vm_map_page_query(
334 target_map :vm_map_t;
335 offset :vm_offset_t;
336 out disposition :integer_t;
337 out ref_count :integer_t);
338
339 /*
340 * Returns information about a region of memory.
341 * Includes info about the chain of objects rooted at that region.
342 * Only available in MACH_VM_DEBUG compiled kernels,
343 * otherwise returns KERN_FAILURE.
344 */
345 routine mach_vm_region_info(
346 task : vm_map_t;
347 address : vm_address_t;
348 out region : vm_info_region_t;
349 out objects : vm_info_object_array_t);
350
351 routine vm_mapped_pages_info(
352 task : vm_map_t;
353 out pages : page_address_array_t);
354
355 #if 0
356 /*
357 * Allow application level processes to create named entries which
358 * are backed by sub-maps which describe regions of address space.
359 * These regions of space can have objects mapped into them and
360 * in turn, can be mapped into target address spaces
361 */
362
363 routine vm_region_object_create(
364 target_task :vm_map_t;
365 in size :vm_size_t;
366 out region_object :mach_port_move_send_t);
367 #else
368 skip; /* was vm_region_object_create */
369 #endif
370
371 /*
372 * A recursive form of vm_region which probes submaps withint the
373 * address space.
374 */
375 routine vm_region_recurse(
376 target_task : vm_map_t;
377 inout address : vm_address_t;
378 out size : vm_size_t;
379 inout nesting_depth : natural_t;
380 out info : vm_region_recurse_info_t,CountInOut);
381
382
383 /*
384 * The routines below are temporary, meant for transitional use
385 * as their counterparts are moved from 32 to 64 bit data path
386 */
387
388
389 routine vm_region_recurse_64(
390 target_task : vm_map_t;
391 inout address : vm_address_t;
392 out size : vm_size_t;
393 inout nesting_depth : natural_t;
394 out info : vm_region_recurse_info_t,CountInOut);
395
396 routine mach_vm_region_info_64(
397 task : vm_map_t;
398 address : vm_address_t;
399 out region : vm_info_region_64_t;
400 out objects : vm_info_object_array_t);
401
402 routine vm_region_64(
403 target_task : vm_map_t;
404 inout address : vm_address_t;
405 out size : vm_size_t;
406 flavor : vm_region_flavor_t;
407 out info : vm_region_info_t, CountInOut;
408 out object_name : memory_object_name_t =
409 MACH_MSG_TYPE_MOVE_SEND
410 ctype: mach_port_t);
411
412 routine mach_make_memory_entry_64(
413 target_task :vm_map_t;
414 inout size :memory_object_size_t;
415 offset :memory_object_offset_t;
416 permission :vm_prot_t;
417 out object_handle :mach_port_move_send_t;
418 parent_entry :mem_entry_name_port_t);
419
420
421
422 routine vm_map_64(
423 target_task : vm_task_entry_t;
424 inout address : vm_address_t;
425 size : vm_size_t;
426 mask : vm_address_t;
427 flags : int;
428 object : mem_entry_name_port_t;
429 offset : memory_object_offset_t;
430 copy : boolean_t;
431 cur_protection : vm_prot_t;
432 max_protection : vm_prot_t;
433 inheritance : vm_inherit_t);
434
435 #if 0
436 /*
437 * The UPL interfaces are not ready for user-level export.
438 */
439 routine vm_map_get_upl(
440 target_task : vm_map_t;
441 address : vm_map_offset_t;
442 inout size : vm_size_t;
443 out upl : upl_t;
444 out page_info : upl_page_info_array_t, CountInOut;
445 inout flags : integer_t;
446 force_data_sync : integer_t);
447
448 routine vm_upl_map(
449 target_task : vm_map_t;
450 upl : upl_t;
451 inout address : vm_address_t);
452
453 routine vm_upl_unmap(
454 target_task : vm_map_t;
455 upl : upl_t);
456 #else
457 skip; /* was vm_map_get_upl */
458 skip; /* was vm_upl_map */
459 skip; /* was vm_upl_unmap */
460 #endif
461
462 /*
463 * Control behavior and investigate state of a "purgable" object in
464 * the virtual address space of the target task. A purgable object is
465 * created via a call to vm_allocate() with VM_FLAGS_PURGABLE
466 * specified. See the routine implementation for a complete
467 * definition of the routine.
468 */
469 routine vm_purgable_control(
470 target_task : vm_map_t;
471 address : vm_address_t;
472 control : vm_purgable_t;
473 inout state : int);
474
475 /* vim: set ft=c : */