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>
74 #if !KERNEL && !LIBSYSCALL_INTERFACE
75 #define PREFIX(NAME) _kernelrpc_ ## NAME
77 #define PREFIX(NAME) NAME
81 * Returns information about the contents of the virtual
82 * address space of the target task at the specified
83 * address. The returned protection, inheritance, sharing
84 * and memory object values apply to the entire range described
85 * by the address range returned; the memory object offset
86 * corresponds to the beginning of the address range.
87 * [If the specified address is not allocated, the next
88 * highest address range is described. If no addresses beyond
89 * the one specified are allocated, the call returns KERN_NO_SPACE.]
92 target_task : vm_map_t;
93 inout address : vm_address_t;
95 flavor : vm_region_flavor_t;
96 out info : vm_region_info_t, CountInOut;
97 out object_name : memory_object_name_t =
98 MACH_MSG_TYPE_MOVE_SEND
102 * Allocate zero-filled memory in the address space
103 * of the target task, either at the specified address,
104 * or wherever space can be found (if anywhere is TRUE),
105 * of the specified size. The address at which the
106 * allocation actually took place is returned.
109 #if !KERNEL && !LIBSYSCALL_INTERFACE
112 routine PREFIX(vm_allocate)(
113 target_task : vm_task_entry_t;
114 inout address : vm_address_t;
121 * Deallocate the specified range from the virtual
122 * address space of the target task.
125 #if !KERNEL && !LIBSYSCALL_INTERFACE
128 routine PREFIX(vm_deallocate)(
129 target_task : vm_task_entry_t;
130 address : vm_address_t;
136 * Set the current or maximum protection attribute
137 * for the specified range of the virtual address
138 * space of the target task. The current protection
139 * limits the memory access rights of threads within
140 * the task; the maximum protection limits the accesses
141 * that may be given in the current protection.
142 * Protections are specified as a set of {read, write, execute}
146 #if !KERNEL && !LIBSYSCALL_INTERFACE
149 routine PREFIX(vm_protect)(
150 target_task : vm_task_entry_t;
151 address : vm_address_t;
153 set_maximum : boolean_t;
154 new_protection : vm_prot_t);
158 * Set the inheritance attribute for the specified range
159 * of the virtual address space of the target task.
160 * The inheritance value is one of {none, copy, share}, and
161 * specifies how the child address space should acquire
162 * this memory at the time of a task_create call.
165 target_task : vm_task_entry_t;
166 address : vm_address_t;
168 new_inheritance : vm_inherit_t);
171 * Returns the contents of the specified range of the
172 * virtual address space of the target task. [The
173 * range must be aligned on a virtual page boundary,
174 * and must be a multiple of pages in extent. The
175 * protection on the specified range must permit reading.]
177 routine PREFIX(vm_read) (
178 target_task : vm_map_t;
179 address : vm_address_t;
181 out data : pointer_t);
184 * List corrollary to vm_read, returns mapped contents of specified
185 * ranges within target address space.
187 routine vm_read_list(
188 target_task : vm_map_t;
189 inout data_list : vm_read_entry_t;
193 * Writes the contents of the specified range of the
194 * virtual address space of the target task. [The
195 * range must be aligned on a virtual page boundary,
196 * and must be a multiple of pages in extent. The
197 * protection on the specified range must permit writing.]
200 target_task : vm_map_t;
201 address : vm_address_t;
205 * Copy the contents of the source range of the virtual
206 * address space of the target task to the destination
207 * range in that same address space. [Both of the
208 * ranges must be aligned on a virtual page boundary,
209 * and must be multiples of pages in extent. The
210 * protection on the source range must permit reading,
211 * and the protection on the destination range must
215 target_task : vm_map_t;
216 source_address : vm_address_t;
218 dest_address : vm_address_t);
221 * Returns the contents of the specified range of the
222 * virtual address space of the target task. [There
223 * are no alignment restrictions, and the results will
224 * overwrite the area pointed to by data - which must
225 * already exist. The protection on the specified range
226 * must permit reading.]
228 routine vm_read_overwrite(
229 target_task : vm_map_t;
230 address : vm_address_t;
233 out outsize : vm_size_t);
237 target_task : vm_map_t;
238 address : vm_address_t;
240 sync_flags : vm_sync_t );
243 * Set the paging behavior attribute for the specified range
244 * of the virtual address space of the target task.
245 * The behavior value is one of {default, random, forward
246 * sequential, reverse sequential} and indicates the expected
247 * page reference pattern for the specified range.
249 routine vm_behavior_set(
250 target_task : vm_map_t;
251 address : vm_address_t;
253 new_behavior : vm_behavior_t);
257 * Map a user-defined memory object into the virtual address
258 * space of the target task. If desired (anywhere is TRUE),
259 * the kernel will find a suitable address range of the
260 * specified size; else, the specific address will be allocated.
262 * The beginning address of the range will be aligned on a virtual
263 * page boundary, be at or beyond the address specified, and
264 * meet the mask requirements (bits turned on in the mask must not
265 * be turned on in the result); the size of the range, in bytes,
266 * will be rounded up to an integral number of virtual pages.
268 * The memory in the resulting range will be associated with the
269 * specified memory object, with the beginning of the memory range
270 * referring to the specified offset into the memory object.
272 * The mapping will take the current and maximum protections and
273 * the inheritance attributes specified; see the vm_protect and
274 * vm_inherit calls for a description of these attributes.
276 * If desired (copy is TRUE), the memory range will be filled
277 * with a copy of the data from the memory object; this copy will
278 * be private to this mapping in this target task. Otherwise,
279 * the memory in this mapping will be shared with other mappings
280 * of the same memory object at the same offset (in this task or
281 * in other tasks). [The Mach kernel only enforces shared memory
282 * consistency among mappings on one host with similar page alignments.
283 * The user-defined memory manager for this object is responsible
284 * for further consistency.]
286 routine PREFIX(vm_map) (
287 target_task : vm_task_entry_t;
288 inout address : vm_address_t;
292 object : mem_entry_name_port_t;
293 offset : vm_offset_t;
295 cur_protection : vm_prot_t;
296 max_protection : vm_prot_t;
297 inheritance : vm_inherit_t);
300 * Set/Get special properties of memory associated
301 * to some virtual address range, such as cachability,
302 * migrability, replicability. Machine-dependent.
304 routine vm_machine_attribute(
305 target_task : vm_map_t;
306 address : vm_address_t;
308 attribute : vm_machine_attribute_t;
309 inout value : vm_machine_attribute_val_t);
312 * Map portion of a task's address space.
314 routine PREFIX(vm_remap) (
315 target_task : vm_map_t;
316 inout target_address : vm_address_t;
321 src_address : vm_address_t;
323 out cur_protection : vm_prot_t;
324 out max_protection : vm_prot_t;
325 inheritance : vm_inherit_t);
328 * Require that all future virtual memory allocation
329 * allocates wired memory. Setting must_wire to FALSE
330 * disables the wired future feature.
333 target_task : vm_map_t;
334 must_wire : boolean_t);
338 * Allow application level processes to create named entries which
339 * correspond to mapped portions of their address space. These named
340 * entries can then be manipulated, shared with other processes in
341 * other address spaces and ultimately mapped in ohter address spaces
344 routine mach_make_memory_entry(
345 target_task :vm_map_t;
346 inout size :vm_size_t;
348 permission :vm_prot_t;
349 out object_handle :mem_entry_name_port_move_send_t;
350 parent_entry :mem_entry_name_port_t);
353 * Give the caller information on the given location in a virtual
354 * address space. If a page is mapped return ref and dirty info.
356 routine vm_map_page_query(
357 target_map :vm_map_t;
359 out disposition :integer_t;
360 out ref_count :integer_t);
363 * Returns information about a region of memory.
364 * Includes info about the chain of objects rooted at that region.
365 * Only available in MACH_VM_DEBUG compiled kernels,
366 * otherwise returns KERN_FAILURE.
368 routine mach_vm_region_info(
370 address : vm_address_t;
371 out region : vm_info_region_t;
372 out objects : vm_info_object_array_t);
374 routine vm_mapped_pages_info(
376 out pages : page_address_array_t);
380 * Allow application level processes to create named entries which
381 * are backed by sub-maps which describe regions of address space.
382 * These regions of space can have objects mapped into them and
383 * in turn, can be mapped into target address spaces
386 routine vm_region_object_create(
387 target_task :vm_map_t;
389 out region_object :mach_port_move_send_t);
391 skip; /* was vm_region_object_create */
395 * A recursive form of vm_region which probes submaps withint the
398 routine vm_region_recurse(
399 target_task : vm_map_t;
400 inout address : vm_address_t;
401 out size : vm_size_t;
402 inout nesting_depth : natural_t;
403 out info : vm_region_recurse_info_t,CountInOut);
407 * The routines below are temporary, meant for transitional use
408 * as their counterparts are moved from 32 to 64 bit data path
412 routine vm_region_recurse_64(
413 target_task : vm_map_t;
414 inout address : vm_address_t;
415 out size : vm_size_t;
416 inout nesting_depth : natural_t;
417 out info : vm_region_recurse_info_t,CountInOut);
419 routine mach_vm_region_info_64(
421 address : vm_address_t;
422 out region : vm_info_region_64_t;
423 out objects : vm_info_object_array_t);
425 routine vm_region_64(
426 target_task : vm_map_t;
427 inout address : vm_address_t;
428 out size : vm_size_t;
429 flavor : vm_region_flavor_t;
430 out info : vm_region_info_t, CountInOut;
431 out object_name : memory_object_name_t =
432 MACH_MSG_TYPE_MOVE_SEND
435 routine mach_make_memory_entry_64(
436 target_task :vm_map_t;
437 inout size :memory_object_size_t;
438 offset :memory_object_offset_t;
439 permission :vm_prot_t;
440 out object_handle :mach_port_move_send_t;
441 parent_entry :mem_entry_name_port_t);
446 target_task : vm_task_entry_t;
447 inout address : vm_address_t;
451 object : mem_entry_name_port_t;
452 offset : memory_object_offset_t;
454 cur_protection : vm_prot_t;
455 max_protection : vm_prot_t;
456 inheritance : vm_inherit_t);
460 * The UPL interfaces are not ready for user-level export.
462 routine vm_map_get_upl(
463 target_task : vm_map_t;
464 address : vm_map_offset_t;
465 inout size : vm_size_t;
467 out page_info : upl_page_info_array_t, CountInOut;
468 inout flags : integer_t;
469 force_data_sync : integer_t);
472 target_task : vm_map_t;
474 inout address : vm_address_t);
476 routine vm_upl_unmap(
477 target_task : vm_map_t;
480 skip; /* was vm_map_get_upl */
481 skip; /* was vm_upl_map */
482 skip; /* was vm_upl_unmap */
486 * Control behavior and investigate state of a "purgable" object in
487 * the virtual address space of the target task. A purgable object is
488 * created via a call to vm_allocate() with VM_FLAGS_PURGABLE
489 * specified. See the routine implementation for a complete
490 * definition of the routine.
492 routine PREFIX(vm_purgable_control) (
493 target_task : vm_map_t;
494 address : vm_address_t;
495 control : vm_purgable_t;
498 /* vim: set ft=c : */