2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
63 * Author: Avadis Tevanian, Jr., Michael Wayne Young
66 * Virtual memory map module definitions.
75 #include <mach/mach_types.h>
76 #include <mach/kern_return.h>
77 #include <mach/boolean.h>
78 #include <mach/vm_types.h>
79 #include <mach/vm_prot.h>
80 #include <mach/vm_inherit.h>
81 #include <mach/vm_behavior.h>
82 #include <mach/vm_param.h>
87 #include <sys/cdefs.h>
91 extern void vm_map_reference(vm_map_t map
);
92 extern vm_map_t
current_map(void);
96 #ifdef MACH_KERNEL_PRIVATE
98 #include <task_swapper.h>
99 #include <mach_assert.h>
101 #include <vm/vm_object.h>
102 #include <vm/vm_page.h>
103 #include <kern/lock.h>
104 #include <kern/zalloc.h>
105 #include <kern/macro_help.h>
107 #include <kern/thread.h>
109 #define current_map_fast() (current_thread()->map)
110 #define current_map() (current_map_fast())
115 * vm_map_t the high-level address map data structure.
116 * vm_map_entry_t an entry in an address map.
117 * vm_map_version_t a timestamp of a map, for use with vm_map_lookup
118 * vm_map_copy_t represents memory copied from an address map,
119 * used for inter-map copy operations
121 typedef struct vm_map_entry
*vm_map_entry_t
;
122 #define VM_MAP_ENTRY_NULL ((vm_map_entry_t) 0)
126 * Type: vm_map_object_t [internal use only]
129 * The target of an address mapping, either a virtual
130 * memory object or a sub map (of the kernel map).
132 typedef union vm_map_object
{
133 vm_object_t vm_object
; /* object object */
134 vm_map_t sub_map
; /* belongs to another map */
137 #define named_entry_lock_init(object) mutex_init(&(object)->Lock, 0)
138 #define named_entry_lock(object) mutex_lock(&(object)->Lock)
139 #define named_entry_unlock(object) mutex_unlock(&(object)->Lock)
142 * Type: vm_named_entry_t [internal use only]
145 * Description of a mapping to a memory cache object.
148 * While the handle to this object is used as a means to map
149 * and pass around the right to map regions backed by pagers
150 * of all sorts, the named_entry itself is only manipulated
151 * by the kernel. Named entries hold information on the
152 * right to map a region of a cached object. Namely,
153 * the target cache object, the beginning and ending of the
154 * region to be mapped, and the permissions, (read, write)
155 * with which it can be mapped.
159 struct vm_named_entry
{
160 decl_mutex_data(, Lock
) /* Synchronization */
162 vm_object_t object
; /* object I point to */
163 memory_object_t pager
; /* amo pager port */
164 vm_map_t map
; /* map backing submap */
166 vm_object_offset_t offset
; /* offset into object */
167 vm_object_size_t size
; /* size of region */
168 vm_prot_t protection
; /* access permissions */
169 int ref_count
; /* Number of references */
170 unsigned int /* Is backing.xxx : */
171 /* boolean_t */ internal
:1, /* ... an internal object */
172 /* boolean_t */ is_sub_map
:1, /* ... a submap? */
173 /* boolean_t */ is_pager
:1; /* ... a pager port */
177 * Type: vm_map_entry_t [internal use only]
180 * A single mapping within an address map.
183 * Address map entries consist of start and end addresses,
184 * a VM object (or sub map) and offset into that object,
185 * and user-exported inheritance and protection information.
186 * Control information for virtual copy operations is also
187 * stored in the address map entry.
189 struct vm_map_links
{
190 struct vm_map_entry
*prev
; /* previous entry */
191 struct vm_map_entry
*next
; /* next entry */
192 vm_map_offset_t start
; /* start address */
193 vm_map_offset_t end
; /* end address */
196 struct vm_map_entry
{
197 struct vm_map_links links
; /* links to other entries */
198 #define vme_prev links.prev
199 #define vme_next links.next
200 #define vme_start links.start
201 #define vme_end links.end
202 union vm_map_object object
; /* object I point to */
203 vm_object_offset_t offset
; /* offset into object */
205 /* boolean_t */ is_shared
:1, /* region is shared */
206 /* boolean_t */ is_sub_map
:1, /* Is "object" a submap? */
207 /* boolean_t */ in_transition
:1, /* Entry being changed */
208 /* boolean_t */ needs_wakeup
:1, /* Waiters on in_transition */
209 /* vm_behavior_t */ behavior
:2, /* user paging behavior hint */
210 /* behavior is not defined for submap type */
211 /* boolean_t */ needs_copy
:1, /* object need to be copied? */
212 /* Only in task maps: */
213 /* vm_prot_t */ protection
:3, /* protection code */
214 /* vm_prot_t */ max_protection
:3,/* maximum protection */
215 /* vm_inherit_t */ inheritance
:2, /* inheritance */
216 /* boolean_t */ use_pmap
:1, /* nested pmaps */
217 /* unsigned char */ alias
:8, /* user alias */
218 /* unsigned char */ pad
:8; /* available bits */
219 unsigned short wired_count
; /* can be paged if = 0 */
220 unsigned short user_wired_count
; /* for vm_wire */
224 * wired_counts are unsigned short. This value is used to safeguard
225 * against any mishaps due to runaway user programs.
227 #define MAX_WIRE_COUNT 65535
232 * Type: struct vm_map_header
235 * Header for a vm_map and a vm_map_copy.
237 struct vm_map_header
{
238 struct vm_map_links links
; /* first, last, min, max */
239 int nentries
; /* Number of entries */
240 boolean_t entries_pageable
;
241 /* are map entries pageable? */
245 * Type: vm_map_t [exported; contents invisible]
248 * An address map -- a directory relating valid
249 * regions of a task's address space to the corresponding
250 * virtual memory objects.
253 * Maps are doubly-linked lists of map entries, sorted
254 * by address. One hint is used to start
255 * searches again from the last successful search,
256 * insertion, or removal. Another hint is used to
257 * quickly find free space.
260 lock_t lock
; /* uni- and smp-lock */
261 struct vm_map_header hdr
; /* Map entry header */
262 #define min_offset hdr.links.start /* start of range */
263 #define max_offset hdr.links.end /* end of range */
264 pmap_t pmap
; /* Physical map */
265 vm_map_size_t size
; /* virtual size */
266 int ref_count
; /* Reference count */
268 int res_count
; /* Residence count (swap) */
269 int sw_state
; /* Swap state */
270 #endif /* TASK_SWAPPER */
271 decl_mutex_data(, s_lock
) /* Lock ref, res, hint fields */
272 vm_map_entry_t hint
; /* hint for quick lookups */
273 vm_map_entry_t first_free
; /* First free space hint */
274 boolean_t wait_for_space
; /* Should callers wait
276 boolean_t wiring_required
;/* All memory wired? */
277 boolean_t no_zero_fill
; /* No zero fill absent pages */
278 boolean_t mapped
; /* has this map been mapped */
279 unsigned int timestamp
; /* Version number */
282 #define vm_map_to_entry(map) ((struct vm_map_entry *) &(map)->hdr.links)
283 #define vm_map_first_entry(map) ((map)->hdr.links.next)
284 #define vm_map_last_entry(map) ((map)->hdr.links.prev)
288 * VM map swap states. There are no transition states.
290 #define MAP_SW_IN 1 /* map is swapped in; residence count > 0 */
291 #define MAP_SW_OUT 2 /* map is out (res_count == 0 */
292 #endif /* TASK_SWAPPER */
295 * Type: vm_map_version_t [exported; contents invisible]
298 * Map versions may be used to quickly validate a previous
302 * Because they are bulky objects, map versions are usually
303 * passed by reference.
306 * Just a timestamp for the main map.
308 typedef struct vm_map_version
{
309 unsigned int main_timestamp
;
313 * Type: vm_map_copy_t [exported; contents invisible]
316 * A map copy object represents a region of virtual memory
317 * that has been copied from an address map but is still
320 * A map copy object may only be used by a single thread
324 * There are three formats for map copy objects.
325 * The first is very similar to the main
326 * address map in structure, and as a result, some
327 * of the internal maintenance functions/macros can
328 * be used with either address maps or map copy objects.
330 * The map copy object contains a header links
331 * entry onto which the other entries that represent
332 * the region are chained.
334 * The second format is a single vm object. This was used
335 * primarily in the pageout path - but is not currently used
336 * except for placeholder copy objects (see vm_map_copy_copy()).
338 * The third format is a kernel buffer copy object - for data
339 * small enough that physical copies were the most efficient
345 #define VM_MAP_COPY_ENTRY_LIST 1
346 #define VM_MAP_COPY_OBJECT 2
347 #define VM_MAP_COPY_KERNEL_BUFFER 3
348 vm_object_offset_t offset
;
351 struct vm_map_header hdr
; /* ENTRY_LIST */
352 vm_object_t object
; /* OBJECT */
354 void *kdata
; /* KERNEL_BUFFER */
355 vm_size_t kalloc_size
; /* size of this copy_t */
361 #define cpy_hdr c_u.hdr
363 #define cpy_object c_u.object
365 #define cpy_kdata c_u.c_k.kdata
366 #define cpy_kalloc_size c_u.c_k.kalloc_size
370 * Useful macros for entry list copy objects
373 #define vm_map_copy_to_entry(copy) \
374 ((struct vm_map_entry *) &(copy)->cpy_hdr.links)
375 #define vm_map_copy_first_entry(copy) \
376 ((copy)->cpy_hdr.links.next)
377 #define vm_map_copy_last_entry(copy) \
378 ((copy)->cpy_hdr.links.prev)
381 * Macros: vm_map_lock, etc. [internal use only]
383 * Perform locking on the data portion of a map.
384 * When multiple maps are to be locked, order by map address.
385 * (See vm_map.c::vm_remap())
388 #define vm_map_lock_init(map) \
389 ((map)->timestamp = 0 , \
390 lock_init(&(map)->lock, TRUE, 0, 0))
392 #define vm_map_lock(map) lock_write(&(map)->lock)
393 #define vm_map_unlock(map) \
394 ((map)->timestamp++ , lock_write_done(&(map)->lock))
395 #define vm_map_lock_read(map) lock_read(&(map)->lock)
396 #define vm_map_unlock_read(map) lock_read_done(&(map)->lock)
397 #define vm_map_lock_write_to_read(map) \
398 ((map)->timestamp++ , lock_write_to_read(&(map)->lock))
399 #define vm_map_lock_read_to_write(map) lock_read_to_write(&(map)->lock)
402 * Exported procedures that operate on vm_map_t.
405 /* Initialize the module */
406 extern void vm_map_init(void);
408 /* Allocate a range in the specified virtual address map and
409 * return the entry allocated for that range. */
410 extern kern_return_t
vm_map_find_space(
412 vm_map_address_t
*address
, /* OUT */
414 vm_map_offset_t mask
,
415 vm_map_entry_t
*o_entry
); /* OUT */
417 /* Lookup map entry containing or the specified address in the given map */
418 extern boolean_t
vm_map_lookup_entry(
420 vm_map_address_t address
,
421 vm_map_entry_t
*entry
); /* OUT */
423 /* Find the VM object, offset, and protection for a given virtual address
424 * in the specified map, assuming a page fault of the type specified. */
425 extern kern_return_t
vm_map_lookup_locked(
426 vm_map_t
*var_map
, /* IN/OUT */
427 vm_map_address_t vaddr
,
428 vm_prot_t fault_type
,
429 vm_map_version_t
*out_version
, /* OUT */
430 vm_object_t
*object
, /* OUT */
431 vm_object_offset_t
*offset
, /* OUT */
432 vm_prot_t
*out_prot
, /* OUT */
433 boolean_t
*wired
, /* OUT */
434 int *behavior
, /* OUT */
435 vm_map_offset_t
*lo_offset
, /* OUT */
436 vm_map_offset_t
*hi_offset
, /* OUT */
437 vm_map_t
*real_map
); /* OUT */
439 /* Verifies that the map has not changed since the given version. */
440 extern boolean_t
vm_map_verify(
442 vm_map_version_t
*version
); /* REF */
444 extern vm_map_entry_t
vm_map_entry_insert(
446 vm_map_entry_t insp_entry
,
447 vm_map_offset_t start
,
450 vm_object_offset_t offset
,
451 boolean_t needs_copy
,
453 boolean_t in_transition
,
454 vm_prot_t cur_protection
,
455 vm_prot_t max_protection
,
456 vm_behavior_t behavior
,
457 vm_inherit_t inheritance
,
458 unsigned wired_count
);
462 * Functions implemented as macros
464 #define vm_map_min(map) ((map)->min_offset)
465 /* Lowest valid address in
468 #define vm_map_max(map) ((map)->max_offset)
469 /* Highest valid address */
471 #define vm_map_pmap(map) ((map)->pmap)
472 /* Physical map associated
473 * with this address map */
475 #define vm_map_verify_done(map, version) vm_map_unlock_read(map)
476 /* Operation that required
477 * a verified lookup is
481 * Macros/functions for map residence counts and swapin/out of vm maps
486 /* Gain a reference to an existing map */
487 extern void vm_map_reference(
489 /* Lose a residence count */
490 extern void vm_map_res_deallocate(
492 /* Gain a residence count on a map */
493 extern void vm_map_res_reference(
495 /* Gain reference & residence counts to possibly swapped-out map */
496 extern void vm_map_reference_swap(
499 #else /* MACH_ASSERT */
501 #define vm_map_reference(map) \
503 vm_map_t Map = (map); \
505 mutex_lock(&Map->s_lock); \
508 mutex_unlock(&Map->s_lock); \
512 #define vm_map_res_reference(map) \
514 vm_map_t Lmap = (map); \
515 if (Lmap->res_count == 0) { \
516 mutex_unlock(&Lmap->s_lock);\
518 vm_map_swapin(Lmap); \
519 mutex_lock(&Lmap->s_lock); \
521 vm_map_unlock(Lmap); \
526 #define vm_map_res_deallocate(map) \
528 vm_map_t Map = (map); \
529 if (--Map->res_count == 0) { \
530 mutex_unlock(&Map->s_lock); \
532 vm_map_swapout(Map); \
533 vm_map_unlock(Map); \
534 mutex_lock(&Map->s_lock); \
538 #define vm_map_reference_swap(map) \
540 vm_map_t Map = (map); \
541 mutex_lock(&Map->s_lock); \
543 vm_map_res_reference(Map); \
544 mutex_unlock(&Map->s_lock); \
546 #endif /* MACH_ASSERT */
548 extern void vm_map_swapin(
551 extern void vm_map_swapout(
554 #else /* TASK_SWAPPER */
556 #define vm_map_reference(map) \
558 vm_map_t Map = (map); \
560 mutex_lock(&Map->s_lock); \
562 mutex_unlock(&Map->s_lock); \
566 #define vm_map_reference_swap(map) vm_map_reference(map)
567 #define vm_map_res_reference(map)
568 #define vm_map_res_deallocate(map)
570 #endif /* TASK_SWAPPER */
573 * Submap object. Must be used to create memory to be put
574 * in a submap by vm_map_submap.
576 extern vm_object_t vm_submap_object
;
579 * Wait and wakeup macros for in_transition map entries.
581 #define vm_map_entry_wait(map, interruptible) \
582 ((map)->timestamp++ , \
583 thread_sleep_lock_write((event_t)&(map)->hdr, \
584 &(map)->lock, interruptible))
587 #define vm_map_entry_wakeup(map) \
588 thread_wakeup((event_t)(&(map)->hdr))
591 #define vm_map_ref_fast(map) \
593 mutex_lock(&map->s_lock); \
595 vm_map_res_reference(map); \
596 mutex_unlock(&map->s_lock); \
599 #define vm_map_dealloc_fast(map) \
603 mutex_lock(&map->s_lock); \
604 c = --map->ref_count; \
606 vm_map_res_deallocate(map); \
607 mutex_unlock(&map->s_lock); \
609 vm_map_destroy(map); \
613 /* simplify map entries */
614 extern void vm_map_simplify_entry(
616 vm_map_entry_t this_entry
);
617 extern void vm_map_simplify(
619 vm_map_offset_t start
);
621 /* Move the information in a map copy object to a new map copy object */
622 extern vm_map_copy_t
vm_map_copy_copy(
625 /* Create a copy object from an object. */
626 extern kern_return_t
vm_map_copyin_object(
628 vm_object_offset_t offset
,
629 vm_object_size_t size
,
630 vm_map_copy_t
*copy_result
); /* OUT */
632 /* Enter a mapping */
633 extern kern_return_t
vm_map_enter(
635 vm_map_offset_t
*address
,
637 vm_map_offset_t mask
,
640 vm_object_offset_t offset
,
641 boolean_t needs_copy
,
642 vm_prot_t cur_protection
,
643 vm_prot_t max_protection
,
644 vm_inherit_t inheritance
);
646 /* XXX should go away - replaced with regular enter of contig object */
647 extern kern_return_t
vm_map_enter_cpm(
649 vm_map_address_t
*addr
,
653 extern kern_return_t
vm_map_remap(
655 vm_map_offset_t
*address
,
657 vm_map_offset_t mask
,
660 vm_map_offset_t memory_address
,
662 vm_prot_t
*cur_protection
,
663 vm_prot_t
*max_protection
,
664 vm_inherit_t inheritance
);
668 * Read and write from a kernel buffer to a specified map.
670 extern kern_return_t
vm_map_write_user(
673 vm_map_offset_t dst_addr
,
676 extern kern_return_t
vm_map_read_user(
678 vm_map_offset_t src_addr
,
682 /* Create a new task map using an existing task map as a template. */
683 extern vm_map_t
vm_map_fork(
686 /* Change inheritance */
687 extern kern_return_t
vm_map_inherit(
689 vm_map_offset_t start
,
691 vm_inherit_t new_inheritance
);
693 /* Add or remove machine-dependent attributes from map regions */
694 extern kern_return_t
vm_map_machine_attribute(
696 vm_map_offset_t start
,
698 vm_machine_attribute_t attribute
,
699 vm_machine_attribute_val_t
* value
); /* IN/OUT */
701 extern kern_return_t
vm_map_msync(
703 vm_map_address_t address
,
705 vm_sync_t sync_flags
);
707 /* Set paging behavior */
708 extern kern_return_t
vm_map_behavior_set(
710 vm_map_offset_t start
,
712 vm_behavior_t new_behavior
);
714 extern kern_return_t
vm_map_purgable_control(
716 vm_map_offset_t address
,
717 vm_purgable_t control
,
720 extern kern_return_t
vm_map_region(
722 vm_map_offset_t
*address
,
724 vm_region_flavor_t flavor
,
725 vm_region_info_t info
,
726 mach_msg_type_number_t
*count
,
727 mach_port_t
*object_name
);
729 extern kern_return_t
vm_map_region_recurse_64(
731 vm_map_offset_t
*address
,
733 natural_t
*nesting_depth
,
734 vm_region_submap_info_64_t info
,
735 mach_msg_type_number_t
*count
);
737 extern kern_return_t
vm_map_page_info(
739 vm_map_offset_t offset
,
743 extern kern_return_t
vm_map_submap(
745 vm_map_offset_t start
,
748 vm_map_offset_t offset
,
751 extern void vm_map_submap_pmap_clean(
753 vm_map_offset_t start
,
756 vm_map_offset_t offset
);
758 /* Convert from a map entry port to a map */
759 extern vm_map_t
convert_port_entry_to_map(
762 /* Convert from a port to a vm_object */
763 extern vm_object_t
convert_port_entry_to_object(
767 #endif /* MACH_KERNEL_PRIVATE */
771 /* Create an empty map */
772 extern vm_map_t
vm_map_create(
774 vm_map_offset_t min_off
,
775 vm_map_offset_t max_off
,
778 /* Get rid of a map */
779 extern void vm_map_destroy(
781 /* Lose a reference */
782 extern void vm_map_deallocate(
785 extern vm_map_t
vm_map_switch(
788 /* Change protection */
789 extern kern_return_t
vm_map_protect(
791 vm_map_offset_t start
,
796 /* Check protection */
797 extern boolean_t
vm_map_check_protection(
799 vm_map_offset_t start
,
801 vm_prot_t protection
);
803 /* wire down a region */
804 extern kern_return_t
vm_map_wire(
806 vm_map_offset_t start
,
808 vm_prot_t access_type
,
809 boolean_t user_wire
);
811 /* unwire a region */
812 extern kern_return_t
vm_map_unwire(
814 vm_map_offset_t start
,
816 boolean_t user_wire
);
818 /* Deallocate a region */
819 extern kern_return_t
vm_map_remove(
821 vm_map_offset_t start
,
825 /* Discard a copy without using it */
826 extern void vm_map_copy_discard(
829 /* Overwrite existing memory with a copy */
830 extern kern_return_t
vm_map_copy_overwrite(
832 vm_map_address_t dst_addr
,
836 /* Place a copy into a map */
837 extern kern_return_t
vm_map_copyout(
839 vm_map_address_t
*dst_addr
, /* OUT */
842 extern kern_return_t
vm_map_copyin_common(
844 vm_map_address_t src_addr
,
846 boolean_t src_destroy
,
847 boolean_t src_volatile
,
848 vm_map_copy_t
*copy_result
, /* OUT */
849 boolean_t use_maxprot
);
852 * Macros to invoke vm_map_copyin_common. vm_map_copyin is the
853 * usual form; it handles a copyin based on the current protection
854 * (current protection == VM_PROT_NONE) is a failure.
855 * vm_map_copyin_maxprot handles a copyin based on maximum possible
856 * access. The difference is that a region with no current access
857 * BUT possible maximum access is rejected by vm_map_copyin(), but
858 * returned by vm_map_copyin_maxprot.
860 #define vm_map_copyin(src_map, src_addr, len, src_destroy, copy_result) \
861 vm_map_copyin_common(src_map, src_addr, len, src_destroy, \
862 FALSE, copy_result, FALSE)
864 #define vm_map_copyin_maxprot(src_map, \
865 src_addr, len, src_destroy, copy_result) \
866 vm_map_copyin_common(src_map, src_addr, len, src_destroy, \
867 FALSE, copy_result, TRUE)
870 * Macros for rounding and truncation of vm_map offsets and sizes
872 #define vm_map_round_page(x) (((vm_map_offset_t)(x) + PAGE_MASK) & ~((signed)PAGE_MASK))
873 #define vm_map_trunc_page(x) ((vm_map_offset_t)(x) & ~((signed)PAGE_MASK))
876 * Flags for vm_map_remove() and vm_map_delete()
878 #define VM_MAP_NO_FLAGS 0x0
879 #define VM_MAP_REMOVE_KUNWIRE 0x1
880 #define VM_MAP_REMOVE_INTERRUPTIBLE 0x2
881 #define VM_MAP_REMOVE_WAIT_FOR_KWIRE 0x4
882 #define VM_MAP_REMOVE_SAVE_ENTRIES 0x8
884 /* Support for shared regions */
885 extern kern_return_t
vm_region_clone(
886 ipc_port_t src_region
,
887 ipc_port_t dst_region
);
889 extern kern_return_t
vm_map_region_replace(
891 ipc_port_t old_region
,
892 ipc_port_t new_region
,
893 vm_map_offset_t start
,
894 vm_map_offset_t end
);
896 /* Support for UPLs from vm_maps */
898 extern kern_return_t
vm_map_get_upl(
900 vm_map_offset_t map_offset
,
903 upl_page_info_array_t page_info
,
904 mach_msg_type_number_t
*page_infoCnt
,
906 integer_t force_data_sync
);
910 #endif /* KERNEL_PRIVATE */
912 #endif /* _VM_VM_MAP_H_ */