#include <mach/vm_map.h> also included by <mach/mach.h>

mach/vm_map.h

30 functions · 3 macros

macro_vm_map_user_

#define _vm_map_user_ 

macrovm_map_MSG_COUNT

#define vm_map_MSG_COUNT 34

functionvm_region

extern kern_return_t vm_region(
	vm_map_read_t target_task,
	vm_address_t *address, /* inout */
	vm_size_t *size, /* out */
	vm_region_flavor_t flavor,
	vm_region_info_t info, /* out */
	mach_msg_type_number_t *infoCnt,
	mach_port_t *object_name /* out */
)
If building for Sandbox, keep NAME unchanged Returns information about the contents of the virtual address space of the target task at the specified address. The returned protection, inheritance, sharing and memory object values apply to the entire range described by the address range returned; the memory object offset corresponds to the beginning of the address range. [If the specified address is not allocated, the next highest address range is described. If no addresses beyond the one specified are allocated, the call returns KERN_NO_SPACE.]
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return description of a virtual memory region.
The vm_region function returns information on a region within the specified task's address space. The function begins looking at address and continues until it finds an allocated region. If the input address is within a region, the function uses the start of that region. The starting address for the located region is returned in address.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThere is no region at or beyond the specified starting address.

functionvm_allocate

extern kern_return_t vm_allocate(
	vm_map_t target_task,
	vm_address_t *address,
	vm_size_t size,
	int flags
)
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Allocate a region of virtual memory.
The vm_allocate function allocates a region of virtual memory in the specified task's address space. A new region is always zero filled. If anywhere is TRUE, the returned address will be at a page boundary; otherwise, the region starts at the beginning of the virtual page containing address. size is always rounded up to an integral number of pages. Because of this rounding to virtual page boundaries, the amount of memory allocated may be greater than size. Use host_page_size to find the current virtual page size. Initially, there are no access restrictions on any of the pages of the newly allocated region. Child tasks inherit the new region as a copy.
Notes. To establish different protections or inheritance for the new region, use the vm_protect and vm_inherit functions. A task's address space can contain both explicitly allocated memory and automatically allocated memory. The vm_allocate function explicitly allocates memory. The kernel automatically allocates memory to hold out-of-line data passed in a message (and received with mach_msg). The kernel allocates memory for the passed data as an integral number of pages. This interface is machine word length dependent because of the virtual address parameter.
KERN_INVALID_ADDRESSThe specified address is illegal or reserved.
KERN_NO_SPACEThere is not enough space in the task's address space to allocate the new region.

functionvm_deallocate

extern kern_return_t vm_deallocate(
	vm_map_t target_task,
	vm_address_t address,
	vm_size_t size
)
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Deallocate a region of virtual memory.
The vm_deallocate function deallocates a region of virtual memory in the specified task's address space. The region starts at the beginning of the virtual page containing address and ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory deallocated may be greater than size. Use host_page_size to find the current virtual page size. vm_deallocate affects only target_task. Other tasks that have access to the deallocated memory can continue to reference it.
Notes. vm_deallocate can be used to deallocate memory passed as out-of-line data in a message. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionvm_protect

extern kern_return_t vm_protect(
	vm_map_t target_task,
	vm_address_t address,
	vm_size_t size,
	boolean_t set_maximum,
	vm_prot_t new_protection
)
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Set access privilege attribute for a region of virtual memory.
The vm_protect function sets access privileges for a region within the specified task's address space. The new_protection parameter specifies a combination of read, write, and execute accesses that are allowed (rather than prohibited). The region starts at the beginning of the virtual page containing address; it ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory protected may be greater than size. Use host_page_size to find the current virtual page size. The enforcement of virtual memory protection is machine-dependent. Nominally read access requires VM_PROT_READ permission, write access requires VM_PROT_WRITE permission, and execute access requires VM_PROT_EXECUTE permission. However, some combinations of access rights may not be supported. In particular, the kernel interface allows write access to require VM_PROT_READ and VM_PROT_WRITE permission and execute access to require VM_PROT_READ permission.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_PROTECTION_FAILUREThe new protection increased the current or maximum protection beyond the existing maximum protection.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionvm_inherit

extern kern_return_t vm_inherit(
	vm_map_t target_task,
	vm_address_t address,
	vm_size_t size,
	vm_inherit_t new_inheritance
)
Set the inheritance attribute for the specified range of the virtual address space of the target task. The inheritance value is one of {none, copy, share}, and specifies how the child address space should acquire this memory at the time of a task_create call.
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Set a VM region's inheritance attribute.
The vm_inherit function sets the inheritance attribute for a region within the specified task's address space. The inheritance attribute determines the type of access established for child tasks at task creation. Because inheritance applies to virtual pages, the specified address and size are rounded to page boundaries, as follows: the region starts at the beginning of the virtual page containing address; it ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory affected may be greater than size. Use host_page_size to find the current virtual page size. A parent and a child task can share the same physical memory only if the inheritance for the memory is set to VM_INHERIT_SHARE before the child task is created. Other than through the use of an external memory manager (see vm_map), this is the only way that two tasks can share memory. Note that all the threads within a task share the task's memory.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionvm_read

extern kern_return_t vm_read(
	vm_map_read_t target_task,
	vm_address_t address,
	vm_size_t size,
	vm_offset_t *data, /* out */
	mach_msg_type_number_t *dataCnt
)
Returns the contents of the specified range of the virtual address space of the target task. [The range must be aligned on a virtual page boundary, and must be a multiple of pages in extent. The protection on the specified range must permit reading.]
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Read the specified range of target task's address space.
The vm_read and vm_read_overwrite functions read a portion of a task's virtual memory (they enable tasks to read other tasks' memory). The vm_read function returns the data in a dynamically allocated array of bytes; the vm_read_overwrite function places the data into a caller-specified buffer (the data_in parameter).
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_PROTECTION_FAILURESpecified memory is valid, but does not permit reading.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region, or there are less than size bytes of data following the address, or the region specified by the data_in parameter cannot be written to.

functionvm_read_list

extern kern_return_t vm_read_list(
	vm_map_read_t target_task,
	vm_read_entry_t data_list, /* inout */
	natural_t count
)
List corrollary to vm_read, returns mapped contents of specified ranges within target address space.
MIG routine from mach/vm_map.defs

functionvm_write

extern kern_return_t vm_write(
	vm_map_t target_task,
	vm_address_t address,
	vm_offset_t data,
	mach_msg_type_number_t dataCnt
)
Writes the contents of the specified range of the virtual address space of the target task. [The range must be aligned on a virtual page boundary, and must be a multiple of pages in extent. The protection on the specified range must permit writing.]
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Write data to the specified address in the target task's address space.
The vm_write function writes an array of data to a task's virtual memory. It allows one task to write to another task's memory. The result of vm_write is as if target_task had directly written into the set of pages. Hence, target_task must have write permission to the pages.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_PROTECTION_FAILURESpecified memory is valid, but does not permit writing.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionvm_copy

extern kern_return_t vm_copy(
	vm_map_t target_task,
	vm_address_t source_address,
	vm_size_t size,
	vm_address_t dest_address
)
Copy the contents of the source range of the virtual address space of the target task to the destination range in that same address space. [Both of the ranges must be aligned on a virtual page boundary, and must be multiples of pages in extent. The protection on the source range must permit reading, and the protection on the destination range must permit writing.]
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Copy a region of virtual memory.
The vm_copy function copies a source region to a destination region within the same task's virtual memory. It is semantically equivalent to vm_read followed by vm_write. The destination region can overlap the source region. The destination region must already be allocated. The source region must be readable, and the destination region must be writable.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_PROTECTION_FAILUREThe source region is protected against reading, or the destination region is protected against writing.
KERN_INVALID_ADDRESSAn address is illegal or specifies a non-allocated region, or there is not enough memory following one of the addresses.

functionvm_read_overwrite

extern kern_return_t vm_read_overwrite(
	vm_map_read_t target_task,
	vm_address_t address,
	vm_size_t size,
	vm_address_t data,
	vm_size_t *outsize /* out */
)
Returns the contents of the specified range of the virtual address space of the target task. [There are no alignment restrictions, and the results will overwrite the area pointed to by data - which must already exist. The protection on the specified range must permit reading.]
MIG routine from mach/vm_map.defs

functionvm_msync

extern kern_return_t vm_msync(
	vm_map_t target_task,
	vm_address_t address,
	vm_size_t size,
	vm_sync_t sync_flags
)
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Synchronize the specified region of virtual memory.
The vm_msync function synchronizes the contents of a memory range with its backing store image by flushing or cleaning the contents of the specified range to the range's memory manager, engaging in a synchronization protocol with the manager (memory_object_synchronize). The client does not return from this call until the memory manager responds (to the kernel) with memory_object_synchronize_completed.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionvm_behavior_set

extern kern_return_t vm_behavior_set(
	vm_map_t target_task,
	vm_address_t address,
	vm_size_t size,
	vm_behavior_t new_behavior
)
Set the paging behavior attribute for the specified range of the virtual address space of the target task. The behavior value is one of {default, random, forward sequential, reverse sequential} and indicates the expected page reference pattern for the specified range.
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Specify expected access patterns for the target VM region.
The vm_behavior_set function informs the kernel of the expected access pattern for a region of memory. The kernel uses this information to bias its prefetch and page replacement algorithms. The region starts at the beginning of the virtual page containing address; it ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory affected may be greater than size. Use host_page_size to find the current virtual page size.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThe specified address is illegal or reserved.

functionvm_map

extern kern_return_t vm_map(
	vm_map_t target_task,
	vm_address_t *address, /* inout */
	vm_size_t size,
	vm_address_t mask,
	int flags,
	mem_entry_name_port_t object,
	vm_offset_t offset,
	boolean_t copy,
	vm_prot_t cur_protection,
	vm_prot_t max_protection,
	vm_inherit_t inheritance
)
Map a user-defined memory object into the virtual address space of the target task. If desired (anywhere is TRUE), the kernel will find a suitable address range of the specified size; else, the specific address will be allocated. The beginning address of the range will be aligned on a virtual page boundary, be at or beyond the address specified, and meet the mask requirements (bits turned on in the mask must not be turned on in the result); the size of the range, in bytes, will be rounded up to an integral number of virtual pages. The memory in the resulting range will be associated with the specified memory object, with the beginning of the memory range referring to the specified offset into the memory object. The mapping will take the current and maximum protections and the inheritance attributes specified; see the vm_protect and vm_inherit calls for a description of these attributes. If desired (copy is TRUE), the memory range will be filled with a copy of the data from the memory object; this copy will be private to this mapping in this target task. Otherwise, the memory in this mapping will be shared with other mappings of the same memory object at the same offset (in this task or in other tasks). [The Mach kernel only enforces shared memory consistency among mappings on one host with similar page alignments. The user-defined memory manager for this object is responsible for further consistency.]
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Map the specified memory object to a region of virtual memory.
The vm_map function maps a portion of the specified memory object into the virtual address space belonging to target_task. The target task can be the calling task or another task, identified by its task kernel port. The portion of the memory object mapped is determined by offset and size. The kernel maps address to the offset, so that an access to the memory starts at the offset in the object. The mask parameter specifies additional alignment restrictions on the kernel's selection of the starting address. Uses for this mask include: Forcing the memory address alignment for a mapping to be the same as the alignment within the memory object. Quickly finding the beginning of an allocated region by performing bit arithmetic on an address known to be in the region. Emulating a larger virtual page size. The cur_protection, max_protection, and inheritance parameters set the protection and inheritance attributes for the mapped object. As a rule, at least the maximum protection should be specified so that a server can make a restricted (for example, read-only) mapping in a client atomically. The current protection and inheritance parameters are provided for convenience so that the caller does not have to call vm_inherit and vm_protect separately. The same memory object can be mapped more than once and by more than one task. If an object is mapped by multiple tasks, the kernel maintains consistency for all the mappings if they use the same page alignment for offset and are on the same host. In this case, the virtual memory to which the object is mapped is shared by all the tasks. Changes made by one task in its address space are visible to all the other tasks. The call will not return until the memory object is ready for use.
Notes. vm_map allocates a region in a task's address space and maps the specified memory object to this region. vm_allocate allocates a zero-filled temporary region in a task's address space. Before a memory object can be mapped, a port naming it must be acquired from the memory manager serving it. This interface is machine word length specific because of the virtual address parameter.
Cautions. Do not attempt to map a memory object unless it has been provided by a memory manager that implements the memory object interface. If another type of port is specified, a thread that accesses the mapped virtual memory may become permanently hung or may receive a memory exception.
KERN_NO_SPACEThere is not enough space in the task's address space to allocate the new region for the memory object.
KERN_PROTECTION_FAILUREmax_protection or cur_protection exceeds that permitted by memory_object.
KERN_INVALID_OBJECTThe memory manager failed to map the memory object.

functionvm_machine_attribute

extern kern_return_t vm_machine_attribute(
	vm_map_t target_task,
	vm_address_t address,
	vm_size_t size,
	vm_machine_attribute_t attribute,
	vm_machine_attribute_val_t *value /* inout */
)
Set/Get special properties of memory associated to some virtual address range, such as cachability, migrability, replicability. Machine-dependent.
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Get/set the target memory region's special attributes.
The vm_machine_attribute function gets and sets special attributes of the memory region implemented by the underlying pmap module. These attributes are properties such as cachability, migratability and replicability. The behavior of this function is machine dependent.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionvm_remap

extern kern_return_t vm_remap(
	vm_map_t target_task,
	vm_address_t *target_address, /* inout */
	vm_size_t size,
	vm_address_t mask,
	int flags,
	vm_map_t src_task,
	vm_address_t src_address,
	boolean_t copy,
	vm_prot_t *cur_protection, /* out */
	vm_prot_t *max_protection, /* out */
	vm_inherit_t inheritance
)
Map portion of a task's address space.
MIG routine from mach/vm_map.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Map memory objects in one task's address space to that of another task's.
The vm_remap function maps the memory objects underlying a portion of the specified source_task 's virtual address space into the address space belonging to target_task. The target task can be the calling task or another task, identified by its task kernel port. The effect is as if the target task performed a vm_map call given the same memory object, maximum protection, current protection, and inheritance as the source task. However, the two tasks must reside on the same host. The kernel maps the memory objects starting at target_address, so that access to target_address is as if the source task accessed its source_address. The mask parameter specifies additional alignment restrictions on the kernel's selection of the starting address. Uses for this mask include: Forcing the memory address alignment for a mapping to be the same as the alignment within the source task. Quickly finding the beginning of an allocated region by performing bit arithmetic on an address known to be in the region. Emulating a larger virtual page size. The cur_protection and max_protection parameters return the protection attributes for the mapped memory. If all memory within the range had the same attributes, these attributes are returned; otherwise the call returns the most restrictive values for any memory in the region.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_NO_SPACEThere is not enough space in the task's address space to allocate the new region for the memory object.
KERN_PROTECTION_FAILURESpecified memory is valid, but the backing memory manager is not permitted by the requesting task.

functiontask_wire

extern __TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_wire(
	vm_map_t target_task,
	boolean_t must_wire
)
Require that all future virtual memory allocation allocates wired memory. Setting must_wire to FALSE disables the wired future feature.
MIG routine from mach/vm_map.defs

functionmach_make_memory_entry

extern kern_return_t mach_make_memory_entry(
	vm_map_t target_task,
	vm_size_t *size, /* inout */
	vm_offset_t offset,
	vm_prot_t permission,
	mem_entry_name_port_t *object_handle, /* out */
	mem_entry_name_port_t parent_entry
)
Allow application level processes to create named entries which correspond to mapped portions of their address space. These named entries can then be manipulated, shared with other processes in other address spaces and ultimately mapped in ohter address spaces
MIG routine from mach/vm_map.defs

functionvm_map_page_query

extern kern_return_t vm_map_page_query(
	vm_map_read_t target_map,
	vm_offset_t offset,
	integer_t *disposition, /* out */
	integer_t *ref_count /* out */
)
Give the caller information on the given location in a virtual address space. If a page is mapped return ref and dirty info.
MIG routine from mach/vm_map.defs

functionmach_vm_region_info

extern kern_return_t mach_vm_region_info(
	vm_map_read_t task,
	vm_address_t address,
	vm_info_region_t *region, /* out */
	vm_info_object_array_t *objects, /* out */
	mach_msg_type_number_t *objectsCnt
)
Returns information about a region of memory. Includes info about the chain of objects rooted at that region. Only available in MACH_VM_DEBUG compiled kernels, otherwise returns KERN_FAILURE.
MIG routine from mach/vm_map.defs

functionvm_mapped_pages_info

extern kern_return_t vm_mapped_pages_info(
	/* OBSOLETE */
	vm_map_read_t task,
	page_address_array_t *pages, /* out */
	mach_msg_type_number_t *pagesCnt
)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_debug.c, osfmk/mach/vm_map.defs
Obsolete debugging call (marked OBSOLETE in vm_map.defs). Formerly returned the array of virtual page addresses resident in the target task, gathered from its pmap. Only ever functional on kernels built with MACH_VM_DEBUG, and the implementation is now disabled even there (pmap resident-page listing was removed), so the call returns KERN_FAILURE.

functionvm_region_recurse

extern kern_return_t vm_region_recurse(
	vm_map_read_t target_task,
	vm_address_t *address, /* inout */
	vm_size_t *size, /* out */
	natural_t *nesting_depth, /* inout */
	vm_region_recurse_info_t info, /* out */
	mach_msg_type_number_t *infoCnt
)
was vm_region_object_create A recursive form of vm_region which probes submaps withint the address space.
MIG routine from mach/vm_map.defs

functionvm_region_recurse_64

extern kern_return_t vm_region_recurse_64(
	vm_map_read_t target_task,
	vm_address_t *address, /* inout */
	vm_size_t *size, /* out */
	natural_t *nesting_depth, /* inout */
	vm_region_recurse_info_t info, /* out */
	mach_msg_type_number_t *infoCnt
)
The routines below are temporary, meant for transitional use as their counterparts are moved from 32 to 64 bit data path
MIG routine from mach/vm_map.defs

functionmach_vm_region_info_64

extern kern_return_t mach_vm_region_info_64(
	/* OBSOLETE */
	vm_map_read_t task,
	vm_address_t address,
	vm_info_region_64_t *region, /* out */
	vm_info_object_array_t *objects, /* out */
	mach_msg_type_number_t *objectsCnt
)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_debug.c, osfmk/mach/vm_map.defs
Obsolete debugging call (marked OBSOLETE in vm_map.defs); the 64-bit-offset variant of mach_vm_region_info. Retrieves a vm_info_region_64_t describing the region at or above the given address in the target task, plus an out-of-line array of vm_info_object_t describing the region's VM object shadow chain. Functional only on kernels built with MACH_VM_DEBUG; release kernels return KERN_FAILURE. Other returns: KERN_INVALID_TASK (null map), KERN_NO_SPACE (no entry at or after address), KERN_RESOURCE_SHORTAGE.

functionvm_region_64

extern kern_return_t vm_region_64(
	vm_map_read_t target_task,
	vm_address_t *address, /* inout */
	vm_size_t *size, /* out */
	vm_region_flavor_t flavor,
	vm_region_info_t info, /* out */
	mach_msg_type_number_t *infoCnt,
	mach_port_t *object_name /* out */
)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_user.c
Returns information about the region containing (or next above) the given address in the target task. The same as mach_vm_region, but the address and size are the natural-width vm_address_t/vm_size_t types; a region found above VM_MAX_ADDRESS yields KERN_INVALID_ADDRESS. On return *address and *size give the region's bounds. flavor selects the info structure (e.g. VM_REGION_BASIC_INFO_64 with a vm_region_basic_info_64_t and *infoCnt of VM_REGION_BASIC_INFO_COUNT_64). object_name is unused and returned as MACH_PORT_NULL. Unlike the legacy vm_region, the offset reported in the basic info is a full 64-bit memory_object_offset_t.

functionmach_make_memory_entry_64

extern kern_return_t mach_make_memory_entry_64(
	vm_map_t target_task,
	memory_object_size_t *size, /* inout */
	memory_object_offset_t offset,
	vm_prot_t permission,
	mach_port_t *object_handle, /* out */
	mem_entry_name_port_t parent_entry
)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_memory_entry.c
Creates a named memory entry: a send right representing a range of the target task's memory, which can later be mapped into this or another task with vm_map or mach_vm_map. The entry covers *size bytes at offset; both are rounded to page boundaries and *size returns the actual length. permission gives the maximum access permitted through the handle and may carry MAP_MEM_* flags (e.g. MAP_MEM_NAMED_CREATE to back the entry with fresh memory, MAP_MEM_VM_COPY to snapshot the range). If parent_entry names an existing entry, the new entry is carved out of it. Unlike the legacy mach_make_memory_entry, size and offset are full 64-bit types; think of the entry as the first half of a two-stage vm_remap.

functionvm_map_64

extern kern_return_t vm_map_64(
	vm_map_t target_task,
	vm_address_t *address, /* inout */
	vm_size_t size,
	vm_address_t mask,
	int flags,
	mem_entry_name_port_t object,
	memory_object_offset_t offset,
	boolean_t copy,
	vm_prot_t cur_protection,
	vm_prot_t max_protection,
	vm_inherit_t inheritance
)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_user.c
Maps a VM object into the target task's address space. The same as mach_vm_map, but the address, size, and mask are the natural-width vm_address_t/vm_size_t types (the object offset remains 64 bit, which is what distinguishes it from the older vm_map). object may be MACH_PORT_NULL for anonymous zero-filled memory (as vm_allocate), or a named entry from mach_make_memory_entry_64. With copy == TRUE the mapping is a copy of the object's contents; otherwise it is backed by the object itself. *address, mask, and VM_FLAGS_ANYWHERE/VM_FLAGS_FIXED in flags place the mapping; cur_protection, max_protection, and inheritance set its initial attributes. Kernel-only flag bits cause KERN_INVALID_ARGUMENT.

functionvm_purgable_control

extern kern_return_t vm_purgable_control(
	vm_map_t target_task,
	vm_address_t address,
	vm_purgable_t control,
	int *state /* inout */
)
was vm_upl_unmap Control behavior and investigate state of a "purgable" object in the virtual address space of the target task. A purgable object is created via a call to vm_allocate() with VM_FLAGS_PURGABLE specified. See the routine implementation for a complete definition of the routine.
MIG routine from mach/vm_map.defs

functionvm_map_exec_lockdown

extern kern_return_t vm_map_exec_lockdown(vm_map_t target_task)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_user.c
Locks down the target task's address map against new executable mappings: sets the map's map_disallow_new_exec flag, after which attempts to create a mapping with, or change a mapping to, VM_PROT_EXECUTE fail. There is no way to clear the flag. Returns KERN_INVALID_ARGUMENT for a null map, otherwise KERN_SUCCESS.

functionvm_remap_new

extern kern_return_t vm_remap_new(
	vm_map_t target_task,
	vm_address_t *target_address, /* inout */
	vm_size_t size,
	vm_address_t mask,
	int flags,
	vm_map_read_t src_task,
	vm_address_t src_address,
	boolean_t copy,
	vm_prot_t *cur_protection, /* inout */
	vm_prot_t *max_protection, /* inout */
	vm_inherit_t inheritance
)
MIG routine from mach/vm_map.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_user.c
Maps a range of src_task's address space into target_task, sharing the underlying memory when copy == FALSE and copying it when copy == TRUE. The same as mach_vm_remap_new, but addresses and sizes are the natural-width vm_address_t/vm_size_t types. Behaves like vm_remap except that VM_FLAGS_RETURN_DATA_ADDR is always set and cur_protection/max_protection are inout: on entry they give the protections wanted for the new mapping, on return those granted. src_task may be a read-only task port when copy is TRUE or the requested max protection is at most VM_PROT_READ. Requesting a max protection that is both writable and executable fails with KERN_PROTECTION_FAILURE.

functionvm_reallocate

extern kern_return_t vm_reallocate(
	vm_map_t target_task,
	vm_address_t src,
	vm_size_t src_size,
	vm_address_t *dst, /* inout */
	vm_size_t dst_size,
	vm_offset_t align_mask,
	int options,
	int flags
)
Relocate the pages of the source range of the specified map to a new range of the given size in bytes within the same map.
MIG routine from mach/vm_map.defs

macrosubsystem_to_name_map_vm_map

#define subsystem_to_name_map_vm_map { "vm_region", 3800 },
    { "vm_allocate", 3801 },
    { "vm_deallocate", 3802 },
    { "vm_protect", 3803 },
    { "vm_inherit", 3804 },
    { "vm_read", 3805 },
    { "vm_read_list", 3806 },
    { "vm_write", 3807 },
    { "vm_copy", 3808 },
    { "vm_read_overwrite", 3809 },
    { "vm_msync", 3810 },
    { "vm_behavior_set", 3811 },
    { "vm_map", 3812 },
    { "vm_machine_attribute", 3813 },
    { "vm_remap", 3814 },
    { "task_wire", 3815 },
    { "mach_make_memory_entry", 3816 },
    { "vm_map_page_query", 3817 },
    { "mach_vm_region_info", 3818 },
    { "vm_mapped_pages_info", 3819 },
    { "vm_region_recurse", 3821 },
    { "vm_region_recurse_64", 3822 },
    { "mach_vm_region_info_64", 3823 },
    { "vm_region_64", 3824 },
    { "mach_make_memory_entry_64", 3825 },
    { "vm_map_64", 3826 },
    { "vm_purgable_control", 3830 },
    { "vm_map_exec_lockdown", 3831 },
    { "vm_remap_new", 3832 },
    { "vm_reallocate", 3833 }