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 #define CONCAT(a,b) a ## b
75 #if !KERNEL && !LIBSYSCALL_INTERFACE
76 #define PREFIX(NAME) CONCAT(_kernelrpc_, NAME)
78 #define PREFIX(NAME) NAME
82 #define KERNEL_SERVER_SUFFIX(NAME) CONCAT(NAME, _external)
84 #define KERNEL_SERVER_SUFFIX(NAME) NAME
88 * Returns information about the contents of the virtual
89 * address space of the target task at the specified
90 * address. The returned protection, inheritance, sharing
91 * and memory object values apply to the entire range described
92 * by the address range returned; the memory object offset
93 * corresponds to the beginning of the address range.
94 * [If the specified address is not allocated, the next
95 * highest address range is described. If no addresses beyond
96 * the one specified are allocated, the call returns KERN_NO_SPACE.]
99 target_task : vm_map_t;
100 inout address : vm_address_t;
101 out size : vm_size_t;
102 flavor : vm_region_flavor_t;
103 out info : vm_region_info_t, CountInOut;
104 out object_name : memory_object_name_t =
105 MACH_MSG_TYPE_MOVE_SEND
109 * Allocate zero-filled memory in the address space
110 * of the target task, either at the specified address,
111 * or wherever space can be found (if anywhere is TRUE),
112 * of the specified size. The address at which the
113 * allocation actually took place is returned.
116 #if !KERNEL && !LIBSYSCALL_INTERFACE
119 routine PREFIX(KERNEL_SERVER_SUFFIX(vm_allocate))(
120 target_task : vm_task_entry_t;
121 inout address : vm_address_t;
128 * Deallocate the specified range from the virtual
129 * address space of the target task.
132 #if !KERNEL && !LIBSYSCALL_INTERFACE
135 routine PREFIX(vm_deallocate)(
136 target_task : vm_task_entry_t;
137 address : vm_address_t;
143 * Set the current or maximum protection attribute
144 * for the specified range of the virtual address
145 * space of the target task. The current protection
146 * limits the memory access rights of threads within
147 * the task; the maximum protection limits the accesses
148 * that may be given in the current protection.
149 * Protections are specified as a set of {read, write, execute}
153 #if !KERNEL && !LIBSYSCALL_INTERFACE
156 routine PREFIX(vm_protect)(
157 target_task : vm_task_entry_t;
158 address : vm_address_t;
160 set_maximum : boolean_t;
161 new_protection : vm_prot_t);
165 * Set the inheritance attribute for the specified range
166 * of the virtual address space of the target task.
167 * The inheritance value is one of {none, copy, share}, and
168 * specifies how the child address space should acquire
169 * this memory at the time of a task_create call.
172 target_task : vm_task_entry_t;
173 address : vm_address_t;
175 new_inheritance : vm_inherit_t);
178 * Returns the contents of the specified range of the
179 * virtual address space of the target task. [The
180 * range must be aligned on a virtual page boundary,
181 * and must be a multiple of pages in extent. The
182 * protection on the specified range must permit reading.]
184 routine PREFIX(vm_read) (
185 target_task : vm_map_t;
186 address : vm_address_t;
188 out data : pointer_t);
191 * List corrollary to vm_read, returns mapped contents of specified
192 * ranges within target address space.
194 routine vm_read_list(
195 target_task : vm_map_t;
196 inout data_list : vm_read_entry_t;
200 * Writes the contents of the specified range of the
201 * virtual address space of the target task. [The
202 * range must be aligned on a virtual page boundary,
203 * and must be a multiple of pages in extent. The
204 * protection on the specified range must permit writing.]
207 target_task : vm_map_t;
208 address : vm_address_t;
212 * Copy the contents of the source range of the virtual
213 * address space of the target task to the destination
214 * range in that same address space. [Both of the
215 * ranges must be aligned on a virtual page boundary,
216 * and must be multiples of pages in extent. The
217 * protection on the source range must permit reading,
218 * and the protection on the destination range must
222 target_task : vm_map_t;
223 source_address : vm_address_t;
225 dest_address : vm_address_t);
228 * Returns the contents of the specified range of the
229 * virtual address space of the target task. [There
230 * are no alignment restrictions, and the results will
231 * overwrite the area pointed to by data - which must
232 * already exist. The protection on the specified range
233 * must permit reading.]
235 routine vm_read_overwrite(
236 target_task : vm_map_t;
237 address : vm_address_t;
240 out outsize : vm_size_t);
244 target_task : vm_map_t;
245 address : vm_address_t;
247 sync_flags : vm_sync_t );
250 * Set the paging behavior attribute for the specified range
251 * of the virtual address space of the target task.
252 * The behavior value is one of {default, random, forward
253 * sequential, reverse sequential} and indicates the expected
254 * page reference pattern for the specified range.
256 routine vm_behavior_set(
257 target_task : vm_map_t;
258 address : vm_address_t;
260 new_behavior : vm_behavior_t);
264 * Map a user-defined memory object into the virtual address
265 * space of the target task. If desired (anywhere is TRUE),
266 * the kernel will find a suitable address range of the
267 * specified size; else, the specific address will be allocated.
269 * The beginning address of the range will be aligned on a virtual
270 * page boundary, be at or beyond the address specified, and
271 * meet the mask requirements (bits turned on in the mask must not
272 * be turned on in the result); the size of the range, in bytes,
273 * will be rounded up to an integral number of virtual pages.
275 * The memory in the resulting range will be associated with the
276 * specified memory object, with the beginning of the memory range
277 * referring to the specified offset into the memory object.
279 * The mapping will take the current and maximum protections and
280 * the inheritance attributes specified; see the vm_protect and
281 * vm_inherit calls for a description of these attributes.
283 * If desired (copy is TRUE), the memory range will be filled
284 * with a copy of the data from the memory object; this copy will
285 * be private to this mapping in this target task. Otherwise,
286 * the memory in this mapping will be shared with other mappings
287 * of the same memory object at the same offset (in this task or
288 * in other tasks). [The Mach kernel only enforces shared memory
289 * consistency among mappings on one host with similar page alignments.
290 * The user-defined memory manager for this object is responsible
291 * for further consistency.]
293 routine PREFIX(KERNEL_SERVER_SUFFIX(vm_map)) (
294 target_task : vm_task_entry_t;
295 inout address : vm_address_t;
299 object : mem_entry_name_port_t;
300 offset : vm_offset_t;
302 cur_protection : vm_prot_t;
303 max_protection : vm_prot_t;
304 inheritance : vm_inherit_t);
307 * Set/Get special properties of memory associated
308 * to some virtual address range, such as cachability,
309 * migrability, replicability. Machine-dependent.
311 routine vm_machine_attribute(
312 target_task : vm_map_t;
313 address : vm_address_t;
315 attribute : vm_machine_attribute_t;
316 inout value : vm_machine_attribute_val_t);
319 * Map portion of a task's address space.
321 routine PREFIX(KERNEL_SERVER_SUFFIX(vm_remap)) (
322 target_task : vm_map_t;
323 inout target_address : vm_address_t;
328 src_address : vm_address_t;
330 out cur_protection : vm_prot_t;
331 out max_protection : vm_prot_t;
332 inheritance : vm_inherit_t);
335 * Require that all future virtual memory allocation
336 * allocates wired memory. Setting must_wire to FALSE
337 * disables the wired future feature.
340 target_task : vm_map_t;
341 must_wire : boolean_t);
345 * Allow application level processes to create named entries which
346 * correspond to mapped portions of their address space. These named
347 * entries can then be manipulated, shared with other processes in
348 * other address spaces and ultimately mapped in ohter address spaces
351 routine mach_make_memory_entry(
352 target_task :vm_map_t;
353 inout size :vm_size_t;
355 permission :vm_prot_t;
356 out object_handle :mem_entry_name_port_move_send_t;
357 parent_entry :mem_entry_name_port_t);
360 * Give the caller information on the given location in a virtual
361 * address space. If a page is mapped return ref and dirty info.
363 routine vm_map_page_query(
364 target_map :vm_map_t;
366 out disposition :integer_t;
367 out ref_count :integer_t);
370 * Returns information about a region of memory.
371 * Includes info about the chain of objects rooted at that region.
372 * Only available in MACH_VM_DEBUG compiled kernels,
373 * otherwise returns KERN_FAILURE.
375 routine mach_vm_region_info(
377 address : vm_address_t;
378 out region : vm_info_region_t;
379 out objects : vm_info_object_array_t);
381 routine vm_mapped_pages_info(
383 out pages : page_address_array_t);
387 * Allow application level processes to create named entries which
388 * are backed by sub-maps which describe regions of address space.
389 * These regions of space can have objects mapped into them and
390 * in turn, can be mapped into target address spaces
393 routine vm_region_object_create(
394 target_task :vm_map_t;
396 out region_object :mach_port_move_send_t);
398 skip; /* was vm_region_object_create */
402 * A recursive form of vm_region which probes submaps withint the
405 routine vm_region_recurse(
406 target_task : vm_map_t;
407 inout address : vm_address_t;
408 out size : vm_size_t;
409 inout nesting_depth : natural_t;
410 out info : vm_region_recurse_info_t,CountInOut);
414 * The routines below are temporary, meant for transitional use
415 * as their counterparts are moved from 32 to 64 bit data path
419 routine vm_region_recurse_64(
420 target_task : vm_map_t;
421 inout address : vm_address_t;
422 out size : vm_size_t;
423 inout nesting_depth : natural_t;
424 out info : vm_region_recurse_info_t,CountInOut);
426 routine mach_vm_region_info_64(
428 address : vm_address_t;
429 out region : vm_info_region_64_t;
430 out objects : vm_info_object_array_t);
432 routine vm_region_64(
433 target_task : vm_map_t;
434 inout address : vm_address_t;
435 out size : vm_size_t;
436 flavor : vm_region_flavor_t;
437 out info : vm_region_info_t, CountInOut;
438 out object_name : memory_object_name_t =
439 MACH_MSG_TYPE_MOVE_SEND
442 routine mach_make_memory_entry_64(
443 target_task :vm_map_t;
444 inout size :memory_object_size_t;
445 offset :memory_object_offset_t;
446 permission :vm_prot_t;
447 out object_handle :mach_port_move_send_t;
448 parent_entry :mem_entry_name_port_t);
452 routine KERNEL_SERVER_SUFFIX(vm_map_64)(
453 target_task : vm_task_entry_t;
454 inout address : vm_address_t;
458 object : mem_entry_name_port_t;
459 offset : memory_object_offset_t;
461 cur_protection : vm_prot_t;
462 max_protection : vm_prot_t;
463 inheritance : vm_inherit_t);
467 * The UPL interfaces are not ready for user-level export.
469 routine vm_map_get_upl(
470 target_task : vm_map_t;
471 address : vm_map_offset_t;
472 inout size : vm_size_t;
474 out page_info : upl_page_info_array_t, CountInOut;
475 inout flags : integer_t;
476 force_data_sync : integer_t);
479 target_task : vm_map_t;
481 inout address : vm_address_t);
483 routine vm_upl_unmap(
484 target_task : vm_map_t;
487 skip; /* was vm_map_get_upl */
488 skip; /* was vm_upl_map */
489 skip; /* was vm_upl_unmap */
493 * Control behavior and investigate state of a "purgable" object in
494 * the virtual address space of the target task. A purgable object is
495 * created via a call to vm_allocate() with VM_FLAGS_PURGABLE
496 * specified. See the routine implementation for a complete
497 * definition of the routine.
499 routine PREFIX(vm_purgable_control) (
500 target_task : vm_map_t;
501 address : vm_address_t;
502 control : vm_purgable_t;
506 routine vm_map_exec_lockdown(
507 target_task : vm_map_t);
510 /* vim: set ft=c : */