2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * @OSF_FREE_COPYRIGHT@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
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.
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.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
59 * File: mach/vm_map.defs
61 * Exported (native-sized) kernel VM calls.
67 #endif /* KERNEL_SERVER */
70 #include <mach/std_types.defs>
71 #include <mach/mach_types.defs>
72 #include <mach_debug/mach_debug_types.defs>
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.]
86 target_task : vm_map_t;
87 inout address : vm_address_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
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.
103 target_task : vm_task_entry_t;
104 inout address : vm_address_t;
109 * Deallocate the specified range from the virtual
110 * address space of the target task.
112 routine vm_deallocate(
113 target_task : vm_task_entry_t;
114 address : vm_address_t;
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}
128 target_task : vm_task_entry_t;
129 address : vm_address_t;
131 set_maximum : boolean_t;
132 new_protection : vm_prot_t);
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.
142 target_task : vm_task_entry_t;
143 address : vm_address_t;
145 new_inheritance : vm_inherit_t);
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.]
155 target_task : vm_map_t;
156 address : vm_address_t;
158 out data : pointer_t);
161 * List corrollary to vm_read, returns mapped contents of specified
162 * ranges within target address space.
164 routine vm_read_list(
165 target_task : vm_map_t;
166 inout data_list : vm_read_entry_t;
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.]
177 target_task : vm_map_t;
178 address : vm_address_t;
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
192 target_task : vm_map_t;
193 source_address : vm_address_t;
195 dest_address : vm_address_t);
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.]
205 routine vm_read_overwrite(
206 target_task : vm_map_t;
207 address : vm_address_t;
210 out outsize : vm_size_t);
214 target_task : vm_map_t;
215 address : vm_address_t;
217 sync_flags : vm_sync_t );
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.
226 routine vm_behavior_set(
227 target_task : vm_map_t;
228 address : vm_address_t;
230 new_behavior : vm_behavior_t);
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.
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.
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.
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.
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.]
264 target_task : vm_task_entry_t;
265 inout address : vm_address_t;
269 object : mem_entry_name_port_t;
270 offset : vm_offset_t;
272 cur_protection : vm_prot_t;
273 max_protection : vm_prot_t;
274 inheritance : vm_inherit_t);
277 * Set/Get special properties of memory associated
278 * to some virtual address range, such as cachability,
279 * migrability, replicability. Machine-dependent.
281 routine vm_machine_attribute(
282 target_task : vm_map_t;
283 address : vm_address_t;
285 attribute : vm_machine_attribute_t;
286 inout value : vm_machine_attribute_val_t);
289 * Map portion of a task's address space.
292 target_task : vm_map_t;
293 inout target_address : vm_address_t;
296 anywhere : boolean_t;
298 src_address : vm_address_t;
300 out cur_protection : vm_prot_t;
301 out max_protection : vm_prot_t;
302 inheritance : vm_inherit_t);
305 * Require that all future virtual memory allocation
306 * allocates wired memory. Setting must_wire to FALSE
307 * disables the wired future feature.
310 target_task : vm_map_t;
311 must_wire : boolean_t);
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
321 routine mach_make_memory_entry(
322 target_task :vm_map_t;
323 inout size :vm_size_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);
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.
333 routine vm_map_page_query(
334 target_map :vm_map_t;
336 out disposition :integer_t;
337 out ref_count :integer_t);
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.
345 routine mach_vm_region_info(
347 address : vm_address_t;
348 out region : vm_info_region_t;
349 out objects : vm_info_object_array_t);
351 routine vm_mapped_pages_info(
353 out pages : page_address_array_t);
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
363 routine vm_region_object_create(
364 target_task :vm_map_t;
366 out region_object :mach_port_move_send_t);
368 skip; /* was vm_region_object_create */
372 * A recursive form of vm_region which probes submaps withint the
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);
384 * The routines below are temporary, meant for transitional use
385 * as their counterparts are moved from 32 to 64 bit data path
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);
396 routine mach_vm_region_info_64(
398 address : vm_address_t;
399 out region : vm_info_region_64_t;
400 out objects : vm_info_object_array_t);
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
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);
423 target_task : vm_task_entry_t;
424 inout address : vm_address_t;
428 object : mem_entry_name_port_t;
429 offset : memory_object_offset_t;
431 cur_protection : vm_prot_t;
432 max_protection : vm_prot_t;
433 inheritance : vm_inherit_t);
437 * The UPL interfaces are not ready for user-level export.
439 routine vm_map_get_upl(
440 target_task : vm_map_t;
441 address : vm_map_offset_t;
442 inout size : vm_size_t;
444 out page_info : upl_page_info_array_t, CountInOut;
445 inout flags : integer_t;
446 force_data_sync : integer_t);
449 target_task : vm_map_t;
451 inout address : vm_address_t);
453 routine vm_upl_unmap(
454 target_task : vm_map_t;
457 skip; /* was vm_map_get_upl */
458 skip; /* was vm_upl_map */
459 skip; /* was vm_upl_unmap */
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.
469 routine vm_purgable_control(
470 target_task : vm_map_t;
471 address : vm_address_t;
472 control : vm_purgable_t;
475 /* vim: set ft=c : */