XXNU Source Handbook Download offline version from here
Part 09 · Chapter 09.50

Mach messages: vm32_map

Message catalog and dispatch · All subsystem ranges · Kernel entry map

osfmk/mach/vm32_map.defs. Listed in the kernel kobject subsystem table, subject to the registration guards and per-slot skips. The destination's typed capability still controls admission. Registration evidence: mig_e.

Reading these entries

IDs are computed from the explicit preprocessing profiles in the catalog guide, counting both routines and skip slots. They are not discovered from a running kernel. Each entry retains all observed names/declaration locations; the displayed fields come from the first non-skipped profile. Alternative declarations can have different fields. simpleroutine is one-way at the MIG interface level.

An interface contract block quotes the adjacent local .defs comment with whitespace normalized. Mechanism paragraphs explain selected implementation decisions. Local body links and call names identify implementation evidence; syntactic call lists are reading aids, not a proof that every listed call executes on every path. Short complete implementation bodies are included where especially useful.

Complete routine and reserved-slot catalog

3800: vm32_vm_region

Interface contract:

See vm_map.defs for more information

Mechanism: This form widens input address/size, calls vm_map_region with the original information flavor, narrows outputs, and then rejects a successful result whose untruncated end exceeds VM32_MAX_ADDRESS. The result-field assignments precede the final error decision. This explicit end check distinguishes it from vm32_vm_region_64; do not assume identical overflow behavior based on similar names. Wrapper and end check.

Declarations: vm32_vm_region (server64, server32, local64); vm_region (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_region(
                target_task : vm_map_read_t;
 inout address : vm32_address_t;
        out size : vm32_size_t;
  flavor : vm_region_flavor_t;
 out info : vm_region_info_t, CountInOut;
        out object_name : memory_object_name_t =
                                        MACH_MSG_TYPE_MOVE_SEND
                                        ctype: mach_port_t);

Local body: vm32_vm_region. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, vm_map_region, vm_sanitize_trunc_addr_to_32, vm_sanitize_trunc_size_to_32, vm32_region_get_kern_return.

3801: vm32_vm_allocate

Interface contract:

Allocate zero-filled memory in the address space of the target task, either at the specified address, or wherever space can be found (controlled by flags), of the specified size. The address at which the allocation actually took place is returned.

Mechanism: The vm32 receiver expands the 32-bit hint and size into sanitized 64-bit wrapper types, invokes mach_vm_allocate_external, and truncates the address result back to the vm32 ABI before returning the status. Placement and allocation failures remain decisions of the wide allocator; this adapter does not independently reserve a low-address arena or prove the returned address fits by a separate test. Adapter. The receiver rejects flags outside VM_FLAGS_USER_ALLOCATE, then delegates to mach_vm_allocate_kernel. That helper validates the map and address/size, selects the placement range, and calls vm_map_enter with no backing object, default current protections, maximum VM_PROT_ALL, and default inheritance. This creates an anonymous mapping; physical pages can be supplied later by faults. Sanitization has a successful zero-size case that returns address zero; other failures leave allocation to the documented error path. Receiver, allocation helper.

Declarations: vm32_vm_allocate (server64, server32, local64); vm_allocate (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_allocate(
  target_task : vm_task_entry_t;
 inout address : vm32_address_t;
  size : vm32_size_t;
  flags : int);

Local body: vm32_vm_allocate. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_allocate_external, vm_sanitize_trunc_addr_to_32.

Implementation excerpt:

vm32_vm_allocate(
	vm_map_t                map,
	vm32_address_ut        *addr32,
	vm32_size_ut            size32,
	int                     flags)
{
	mach_vm_address_ut      addr;
	mach_vm_size_ut         size;
	kern_return_t           kr;

	addr    = vm_sanitize_expand_addr_to_64(*addr32);
	size    = vm_sanitize_expand_size_to_64(size32);
	kr      = mach_vm_allocate_external(map, &addr, size, flags);
	*addr32 = vm_sanitize_trunc_addr_to_32(addr);

	return kr;
}

3802: vm32_vm_deallocate

Interface contract:

Deallocate the specified range from the virtual address space of the target virtual memory map.

Mechanism: This vm32 adapter checks addition overflow in the original 32-bit start/size representation before widening them. Overflow returns KERN_INVALID_ARGUMENT; the wide mach_vm_deallocate_external implementation performs the remaining range and operation-specific checks. This prevents a wrapped 32-bit end from becoming an apparently valid wider interval. Adapter. This removes mappings rather than directly freeing a userspace-supplied physical page. mach_vm_deallocate_kernel rejects a null map, sanitizes the address/size into a range, and invokes vm_map_remove_guard with no special removal flags and no kernel allocation guard. Removal must perform entry/object/pmap lifetime work; a VM object shared by another mapping can survive. The receiver itself does not implement a separate removal algorithm or translate failure into success. Entry, validated removal.

Declarations: vm32_vm_deallocate (server64, server32, local64); vm_deallocate (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_deallocate(
  target_task : vm_task_entry_t;
  address : vm32_address_t;
  size : vm32_size_t);

Local body: vm32_vm_deallocate. Calls visible in this body include vm_sanitize_add_overflow, vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_deallocate_external.

Implementation excerpt:

vm32_vm_deallocate(
	vm_map_t                map,
	vm32_offset_ut          start32,
	vm32_size_ut            size32)
{
	mach_vm_offset_ut start;
	mach_vm_size_ut   size;
	vm32_address_ut   discard;

	if (vm_sanitize_add_overflow(start32, size32, &discard)) {
		return KERN_INVALID_ARGUMENT;
	}

	start = vm_sanitize_expand_addr_to_64(start32);
	size = vm_sanitize_expand_size_to_64(size32);

	return mach_vm_deallocate_external(map, start, size);
}

3803: vm32_vm_protect

Interface contract:

Set the current or maximum protection attribute for the specified range of the virtual address space of the target virtual memory map. The current protection limits the memory access rights of threads within the map; the maximum protection limits the accesses that may be given in the current protection. Protections are specified as a set of {read, write, execute} permissions.

Mechanism: This vm32 adapter checks addition overflow in the original 32-bit start/size representation before widening them. Overflow returns KERN_INVALID_ARGUMENT; the wide mach_vm_protect implementation performs the remaining range and operation-specific checks. This prevents a wrapped 32-bit end from becoming an apparently valid wider interval. Adapter. After rejecting a null map, the receiver treats zero size as success and passes a computed end plus the requested current/maximum mode to vm_map_protect. The lower layer sanitizes protections and ranges, applies map/entry policy, and coordinates protection changes with mapped translations. VM_PROT_COPY has a special copy-on-write remap path rather than being an ordinary hardware permission bit; execute/write policy can reject it with KERN_PROTECTION_FAILURE. Successful protection changes do not imply that pages were made resident. Receiver, validation and COPY path.

Declarations: vm32_vm_protect (server64, server32, local64); vm_protect (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_protect(
  target_task : vm_task_entry_t;
  address : vm32_address_t;
  size : vm32_size_t;
  set_maximum : boolean_t;
  new_protection : vm_prot_t);

Local body: vm32_vm_protect. Calls visible in this body include vm_sanitize_add_overflow, vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_protect.

3804: vm32_vm_inherit

Interface contract:

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.

Mechanism: This vm32 adapter checks addition overflow in the original 32-bit start/size representation before widening them. Overflow returns KERN_INVALID_ARGUMENT; the wide mach_vm_inherit implementation performs the remaining range and operation-specific checks. This prevents a wrapped 32-bit end from becoming an apparently valid wider interval. Adapter. The receiver validates the map, accepts a zero-size request, and calls vm_map_inherit with a computed range end. The helper sanitizes the inheritance value/range, clamps to map bounds, and installs entry-specific preflight checks before taking a streaming exclusive range lock. It updates inheritance on the entries it visits; an entirely unmapped range is explicitly normalized to success. The operation changes future fork inheritance policy, not an immediate copy of pages into a child task. Receiver, entry walk.

Declarations: vm32_vm_inherit (server64, server32, local64); vm_inherit (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_inherit(
  target_task : vm_task_entry_t;
  address : vm32_address_t;
  size : vm32_size_t;
  new_inheritance : vm_inherit_t);

Local body: vm32_vm_inherit. Calls visible in this body include vm_sanitize_add_overflow, vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_inherit.

3805: vm32_vm_read

Interface contract:

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.]

Mechanism: This receiver expands the vm32 address/size fields used by the operation and calls mach_vm_read. It does not supply the explicit start-plus-size overflow branch present in several other vm32 wrappers; the wide VM operation remains responsible for its range validation. Adapter. The receiver rejects a null map and sizes that cannot fit mach_msg_type_number_t, then calls vm_map_copyin without destroying the source. On success it returns a vm_map_copy_t and byte count to the MIG transport, not an already chosen destination address in the caller. Reply delivery performs the out-of-line copyout; a direct kernel caller must manage the copy representation itself. Range/protection/copy-on-write work belongs to VM copyin, so this is not a blind memcpy from another task. Body and transport contract.

Declarations: vm32_vm_read (server64, server32, local64); vm_read (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_read(
  target_task : vm_map_read_t;
  address : vm32_address_t;
  size : vm32_size_t;
 out data : pointer_t);

Local body: vm32_vm_read. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_read.

Implementation excerpt:

vm32_vm_read(
	vm_map_t                map,
	vm32_address_ut         addr32,
	vm32_size_ut            size32,
	pointer_ut             *data,
	mach_msg_type_number_t *data_size)
{
	mach_vm_offset_ut addr;
	mach_vm_size_ut   size;

	addr = vm_sanitize_expand_addr_to_64(addr32);
	size = vm_sanitize_expand_size_to_64(size32);

	return mach_vm_read(map, addr, size, data, data_size);
}

3806: vm32_vm_read_list

Interface contract:

List corrollary to vm_read, returns mapped contents of specified ranges within target address space.

Mechanism: The adapter copies every element of the fixed VM_MAP_ENTRY_MAX array into a wide temporary, calls mach_vm_read_list with the supplied count, then casts every result element back to vm32 address/size. The wide routine validates count and processes requested entries independently; successful items stay mapped even when another item fails. This wrapper's result conversion runs before returning the wide status and is not proof that all items succeeded. Adapter, per-item semantics.

Declarations: vm32_vm_read_list (server64, server32, local64); vm_read_list (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_read_list(
  target_task : vm_map_read_t;
 inout data_list : vm32_read_entry_t;
  count : natural_t);

Local body: vm32_vm_read_list. Calls visible in this body include mach_vm_read_list, CAST_DOWN_EXPLICIT.

3807: vm32_vm_write

Interface contract:

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.]

Mechanism: This receiver expands the vm32 address/size fields used by the operation and calls mach_vm_write. It does not supply the explicit start-plus-size overflow branch present in several other vm32 wrappers; the wide VM operation remains responsible for its range validation. Adapter. The incoming data parameter is a VM-copy object constructed by the kernel MIG server from the sender's userspace buffer. After checking the destination map, the body unwraps that transport-created value and passes it to vm_map_copy_overwrite with the supplied byte count. It does not dereference the wire pointer as a raw kernel buffer or itself make a second source copy. MTE builds explicitly pass sec_override=TRUE; other protection/range decisions belong to the overwrite implementation and transport cleanup contract. Body.

Declarations: vm32_vm_write (server64, server32, local64); vm_write (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_write(
  target_task : vm_map_t;
  address : vm32_address_t;
  data : pointer_t);

Local body: vm32_vm_write. Calls visible in this body include vm_sanitize_expand_addr_to_64, mach_vm_write.

Implementation excerpt:

vm32_vm_write(
	vm_map_t                map,
	vm32_address_ut         addr32,
	pointer_ut              data,
	mach_msg_type_number_t  size)
{
	mach_vm_offset_ut addr;

	addr = vm_sanitize_expand_addr_to_64(addr32);
	return mach_vm_write(map, addr, data, size);
}

3808: vm32_vm_copy

Interface contract:

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.]

Mechanism: This receiver expands the vm32 address/size fields used by the operation and calls mach_vm_copy. It does not supply the explicit start-plus-size overflow branch present in several other vm32 wrappers; the wide VM operation remains responsible for its range validation. Adapter. Both ranges belong to the specified map. The implementation first captures the source with nondestructive vm_map_copyin, checks the copy size when present, and then calls vm_map_copy_overwrite for the destination. A failed overwrite discards the retained copy; success consumes it through the overwrite path. Thus overlap and backing-object behavior are VM-copy operations rather than a driver or physical-address copy. A null map is rejected before either stage. Two-stage operation and failure cleanup.

Declarations: vm32_vm_copy (server64, server32, local64); vm_copy (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_copy(
  target_task : vm_map_t;
  source_address : vm32_address_t;
  size : vm32_size_t;
  dest_address : vm32_address_t);

Local body: vm32_vm_copy. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_copy.

Implementation excerpt:

vm32_vm_copy(
	vm_map_t                map,
	vm32_address_ut         src_addr32,
	vm32_size_ut            size32,
	vm32_address_ut         dst_addr32)
{
	mach_vm_offset_ut src_addr, dst_addr;
	mach_vm_size_ut   size;

	src_addr = vm_sanitize_expand_addr_to_64(src_addr32);
	size     = vm_sanitize_expand_size_to_64(size32);
	dst_addr = vm_sanitize_expand_addr_to_64(dst_addr32);

	return mach_vm_copy(map, src_addr, size, dst_addr);
}

3809: vm32_vm_read_overwrite

Interface contract:

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.]

Mechanism: Source address, size, destination and initial output-size temporary are widened, then the adapter calls mach_vm_read_overwrite and truncates its size result back. The source copy is applied to the caller's current map, not the source task's map. Only the wide helper's success publishes a completed byte count; errors preserve its copy-discard contract and are returned unchanged by this adapter. Adapter, copy/overwrite cleanup.

Declarations: vm32_vm_read_overwrite (server64, server32, local64); vm_read_overwrite (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_read_overwrite(
  target_task : vm_map_read_t;
  address : vm32_address_t;
  size : vm32_size_t;
  data : vm32_address_t;
 out outsize : vm32_size_t);

Local body: vm32_vm_read_overwrite. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_read_overwrite, vm_sanitize_trunc_size_to_32.

3810: vm32_vm_msync

Request synchronization of the specified mapped range through vm_map_msync.

Mechanism: This receiver expands the vm32 address/size fields used by the operation and calls mach_vm_msync. It does not supply the explicit start-plus-size overflow branch present in several other vm32 wrappers; the wide VM operation remains responsible for its range validation. Adapter. A null map returns KERN_INVALID_TASK; zero size succeeds. The map implementation rejects simultaneous synchronous/asynchronous flags, sanitizes the range, and uses a streaming range lock whose hole handling depends on CONTIGUOUS/KILLPAGES. Kill/deactivate requests operate on object pages. Ordinary sync skips absent, internal, private or pagerless objects; for an eligible external object it takes a reference, drops the streamed entry lock, calls vm_object_sync, and releases the reference. Success is not a universal storage-device durability guarantee. Entry, walk.

Declarations: vm32_vm_msync (server64, server32, local64); vm_msync (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_msync(
  target_task : vm_map_t;
  address : vm32_address_t;
  size : vm32_size_t;
  sync_flags : vm_sync_t);

Local body: vm32_vm_msync. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_msync.

Implementation excerpt:

vm32_vm_msync(
	vm_map_t                map,
	vm32_address_ut         addr32,
	vm32_size_ut            size32,
	vm_sync_t               sync_flags)
{
	mach_vm_offset_ut addr;
	mach_vm_size_ut   size;

	addr = vm_sanitize_expand_addr_to_64(addr32);
	size = vm_sanitize_expand_size_to_64(size32);
	return mach_vm_msync(map, addr, size, sync_flags);
}

3811: vm32_vm_behavior_set

Interface contract:

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.

Mechanism: This vm32 adapter checks addition overflow in the original 32-bit start/size representation before widening them. Overflow returns KERN_INVALID_ARGUMENT; the wide mach_vm_behavior_set implementation performs the remaining range and operation-specific checks. This prevents a wrapped 32-bit end from becoming an apparently valid wider interval. Adapter. The receiver sanitizes the range and behavior before dispatching. Persistent DEFAULT/RANDOM/SEQUENTIAL/REVERSE-SEQUENTIAL behaviors are recorded under an atomic exclusive range lock that excludes holes. ZERO_WIRED_PAGES additionally preflights write permission and disallows JIT/TPRO entries where configured. Other values initiate work immediately: WILLNEED requests paging, DONTNEED/FREE invoke msync deactivate/kill behavior, and REUSABLE/REUSE use their own page-accounting helpers. Consequently, this interface is not uniformly a harmless hint or a simple field assignment. Receiver, behavior dispatch.

Declarations: vm32_vm_behavior_set (server64, server32, local64); vm_behavior_set (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_behavior_set(
  target_task : vm_map_t;
  address : vm32_address_t;
  size : vm32_size_t;
  new_behavior : vm_behavior_t);

Local body: vm32_vm_behavior_set. Calls visible in this body include vm_sanitize_add_overflow, vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_behavior_set.

Implementation excerpt:

vm32_vm_behavior_set(
	vm_map_t                map,
	vm32_offset_ut           start32,
	vm32_size_ut             size32,
	vm_behavior_ut           new_behavior)
{
	vm_address_ut     start;
	vm_size_ut        size;
	vm32_address_ut   discard;

	if (vm_sanitize_add_overflow(start32, size32, &discard)) {
		return KERN_INVALID_ARGUMENT;
	}

	start = vm_sanitize_expand_addr_to_64(start32);
	size = vm_sanitize_expand_size_to_64(size32);

	return mach_vm_behavior_set(map, start, size, new_behavior);
}

3812: vm32_vm_map

Interface contract:

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.]

Mechanism: The older vm32 map form additionally expands its 32-bit backing offset and delegates to vm32_vm_map_64, which widens destination fields, invokes the wide external mapping implementation and truncates the returned address. This is an ABI conversion chain, not a separate memory-object or page-table implementation. Failure status is returned from the underlying map operation after the adapter's output assignment. Adapters.

Declarations: vm32_vm_map (server64, server32, local64); vm_map (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_map(
  target_task : vm_task_entry_t;
 inout address : vm32_address_t;
  size : vm32_size_t;
  mask : vm32_address_t;
  flags : int;
  object : mem_entry_name_port_t;
  offset : vm32_offset_t;
  copy : boolean_t;
  cur_protection : vm_prot_t;
  max_protection : vm_prot_t;
  inheritance : vm_inherit_t);

Local body: vm32_vm_map. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm32_vm_map_64.

3813: vm32_vm_machine_attribute

Request an architecture-specific mapping/cache attribute operation, subject to the local supported-result behavior.

Mechanism: This vm32 adapter checks addition overflow in the original 32-bit start/size representation before widening them. Overflow returns KERN_INVALID_ARGUMENT; the wide mach_vm_machine_attribute implementation performs the remaining range and operation-specific checks. This prevents a wrapped 32-bit end from becoming an apparently valid wider interval. Adapter. A null map is invalid and zero size succeeds. The helper sanitizes the range, checks map bounds, and accepts only MATTR_CACHE; unsupported attributes deliberately return KERN_INVALID_ADDRESS for compatibility. It takes an atomic exclusive range lock to serialize pmap access, descends into constant submaps, and calls the per-entry machine-attribute operation only when an object exists. The loop continues even after an entry operation fails, so its final status is not transactional rollback across the range. Receiver, helper.

Declarations: vm32_vm_machine_attribute (server64, server32, local64); vm_machine_attribute (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_machine_attribute(
  target_task : vm_map_t;
  address : vm32_address_t;
  size : vm32_size_t;
  attribute : vm_machine_attribute_t;
 inout value : vm_machine_attribute_val_t);

Local body: vm32_vm_machine_attribute. Calls visible in this body include vm_sanitize_add_overflow, vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_machine_attribute.

3814: vm32_vm_remap

Interface contract:

Map portion of a task's address space.

Mechanism: The adapter widens source/destination addresses, size and alignment mask, then calls legacy mach_vm_remap_external and truncates the destination output. The parameter named anywhere is passed in the wide receiver's flags position; the wide path applies its user-remap mask and initializes protection outputs. It does not use remap_new's input protection or read-capability rules. Adapter, legacy wide body.

Declarations: vm32_vm_remap (server64, server32, local64); vm_remap (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_remap(
  target_task : vm_map_t;
 inout target_address : vm32_address_t;
  size : vm32_size_t;
  mask : vm32_address_t;
  anywhere : boolean_t;
  src_task : vm_map_t;
  src_address : vm32_address_t;
  copy : boolean_t;
 out cur_protection : vm_prot_t;
 out max_protection : vm_prot_t;
  inheritance : vm_inherit_t);

Local body: vm32_vm_remap. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_remap_external, vm_sanitize_trunc_addr_to_32.

3815: vm32_task_wire

Historical task-wide wiring control.

Mechanism: The vm32 task-wide wiring body is an obsolete stub: null map returns KERN_INVALID_ARGUMENT, otherwise it returns KERN_NOT_SUPPORTED. It neither delegates to a range-wiring implementation nor inspects the requested wire/unwire boolean. Complete body.

Declarations: vm32_task_wire (server64, server32, local64); task_wire (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_task_wire(
  target_task : vm_map_t;
  must_wire : boolean_t);

Local body: vm32_task_wire.

Implementation excerpt:

vm32_task_wire(
	vm_map_t        map,
	boolean_t       must_wire __unused)
{
	if (map == VM_MAP_NULL) {
		return KERN_INVALID_ARGUMENT;
	}

	return KERN_NOT_SUPPORTED;
}

3816: vm32_mach_make_memory_entry

Interface contract:

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

Mechanism: The legacy vm32 named-entry form widens size and offset, calls _mach_make_memory_entry, and truncates the adjusted output size. Its common implementation can return a page/data-offset-adjusted extent and named-entry capability; it does not copy bytes directly into the caller's address space. Check the returned status before using either the handle or adjusted size. Adapter, common dispatch.

Declarations: vm32_mach_make_memory_entry (server64, server32, local64); mach_make_memory_entry (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_mach_make_memory_entry(
  target_task :vm_map_t;
 inout size :vm32_size_t;
  offset :vm32_offset_t;
  permission :vm_prot_t;
 out object_handle :mem_entry_name_port_move_send_t;
  parent_entry :mem_entry_name_port_t);

Local body: vm32_mach_make_memory_entry. Calls visible in this body include vm_sanitize_expand_size_to_64, vm_sanitize_expand_addr_to_64, _mach_make_memory_entry, vm_sanitize_trunc_size_to_32.

Implementation excerpt:

vm32_mach_make_memory_entry(
	vm_map_t                target_map,
	vm32_size_ut           *size,
	vm32_offset_ut          offset,
	vm_prot_ut              permission,
	ipc_port_t              *object_handle,
	ipc_port_t              parent_entry)
{
	memory_object_size_ut   mo_size = vm_sanitize_expand_size_to_64(*size);
	memory_object_offset_ut mo_offset = vm_sanitize_expand_addr_to_64(offset);
	kern_return_t           kr;

	kr = _mach_make_memory_entry(target_map, &mo_size,
	    mo_offset, permission, object_handle, parent_entry);
	*size = vm_sanitize_trunc_size_to_32(mo_size);
	return kr;
}

3817: vm32_vm_map_page_query

Interface contract:

Give the caller information on the given location in a virtual address space. If a page is mapped return ref and dirty info.

Mechanism: This receiver expands the vm32 address/size fields used by the operation and calls mach_vm_page_query. It does not supply the explicit start-plus-size overflow branch present in several other vm32 wrappers; the wide VM operation remains responsible for its range validation. Adapter. The wrapper requests VM_PAGE_INFO_BASIC from vm_map_page_info and extracts only disposition and reference count. It sets both scalar outputs to zero if the helper fails, then returns that failure; zero outputs therefore do not establish that a page is valid and empty. The helper queries a one-byte interval expanded to the effective page boundary, rather than allocating/faulting a page for the caller. This is a state observation, not a retained page or mapping reference. Wrapper, query delegation.

Declarations: vm32_vm_map_page_query (server64, server32, local64); vm_map_page_query (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_map_page_query(
                target_map :vm_map_read_t;
                offset :vm32_offset_t;
        out disposition :integer_t;
        out ref_count :integer_t);

Local body: vm32_vm_map_page_query. Calls visible in this body include vm_sanitize_expand_addr_to_64, mach_vm_page_query.

Implementation excerpt:

vm32_vm_map_page_query(
	vm_map_t                map,
	vm32_offset_t           offset32,
	int                     *disposition,
	int                     *ref_count)
{
	vm_offset_ut offset = vm_sanitize_expand_addr_to_64(offset32);

	return mach_vm_page_query(map, offset, disposition, ref_count);
}

3818: vm32_mach_vm_region_info

Historical VM region/object debugging-information query.

Mechanism: The locally resolved vm32 debug-region implementation unconditionally returns KERN_FAILURE after its VM lock-policy instrumentation. Historical declaration comments about returning object arrays do not describe a working receiver here. Unprefixed profile names refer to the compatibility declaration and do not establish a separate active wide implementation. Actual stub.

Declarations: vm32_mach_vm_region_info (server64, server32, local64); mach_vm_region_info (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_mach_vm_region_info(
  task : vm_map_read_t;
  address : vm32_address_t;
 out region : vm_info_region_t;
 out objects : vm_info_object_array_t);

Local body: vm32_mach_vm_region_info. Calls visible in this body include vmlp_api_start, vmlp_api_end.

Implementation excerpt:

vm32_mach_vm_region_info(
	__DEBUG_ONLY vm_map_t                   map,
	__DEBUG_ONLY vm32_offset_ut             address_u,
	__DEBUG_ONLY vm_info_region_t           *regionp,
	__DEBUG_ONLY vm_info_object_array_t     *objectsp,
	__DEBUG_ONLY mach_msg_type_number_t     *objectsCntp)
{
	vmlp_api_start(VM32_REGION_INFO);

	vmlp_api_end(VM32_REGION_INFO, KERN_FAILURE);
	return KERN_FAILURE;
}

3819: vm32_vm_mapped_pages_info

Historical query of mapped physical-page information.

Mechanism: The local vm32 mapped-pages-info body immediately returns KERN_FAILURE. It does not allocate or return a page-address array, despite the interface's historical description. The unprefixed client/profile alias does not supply a missing local implementation. Complete stub.

Declarations: vm32_vm_mapped_pages_info (server64, server32, local64); vm_mapped_pages_info (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_mapped_pages_info(
  task : vm_map_read_t;
 out pages : page_address_array_t);

Local body: vm32_vm_mapped_pages_info.

Implementation excerpt:

vm32_vm_mapped_pages_info(
	__DEBUG_ONLY vm_map_t                   map,
	__DEBUG_ONLY page_address_array_t       *pages,
	__DEBUG_ONLY mach_msg_type_number_t     *pages_count)
{
	return KERN_FAILURE;
}

3820: reserved

skip in all listed profiles. Source slot.

3821: vm32_vm_region_recurse

Interface contract:

was vm_region_object_create

Mechanism: This old-layout adapter validates map/count, widens address/size, requests a 64-bit submap record, and copies fields back into the vm32 record, including an explicit 32-bit object-offset truncation. It restores the legacy count, narrows address/size, and checks the untruncated successful extent against VM32_MAX_ADDRESS. Field assignment is not gated on helper success, so outputs must not be treated as valid when the result reports an error. Complete translation.

Declarations: vm32_vm_region_recurse (server64, server32, local64); vm_region_recurse (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_region_recurse(
                target_task : vm_map_read_t;
 inout address : vm32_address_t;
        out size : vm32_size_t;
 inout nesting_depth : natural_t;
 out info : vm_region_recurse_info_t,CountInOut);

Local body: vm32_vm_region_recurse. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_region_recurse, vm_sanitize_trunc_addr_to_32, vm_sanitize_trunc_size_to_32, vm32_region_get_kern_return.

3822: vm32_vm_region_recurse_64

Interface contract:

The routines below are temporary, meant for transitional use as their counterparts are moved from 32 to 64 bit data path

Mechanism: The vm32 address and size are widened while the recursive information buffer uses the wide layout. The helper traverses according to the caller's depth/count, after which address/size are truncated and the helper status is returned. This body has no additional vm32_region_get_kern_return check, unlike the old-layout recurse adapter. The returned record remains an observation rather than ownership of the encountered submap or objects. Adapter.

Declarations: vm32_vm_region_recurse_64 (server64, server32, local64); vm_region_recurse_64 (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_region_recurse_64(
                target_task : vm_map_read_t;
 inout address : vm32_address_t;
        out size : vm32_size_t;
 inout nesting_depth : natural_t;
 out info : vm_region_recurse_info_t,CountInOut);

Local body: vm32_vm_region_recurse_64. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_region_recurse, vm_sanitize_trunc_addr_to_32, vm_sanitize_trunc_size_to_32.

3823: vm32_mach_vm_region_info_64

Historical wide VM region/object debugging-information query.

Mechanism: This retained debug-region-info variant also unconditionally returns KERN_FAILURE; its wider record type does not make object-array enumeration functional. Treat the declaration as compatibility surface and inspect the stub rather than interpreting the older contract comment as implementation. Actual stub.

Declarations: vm32_mach_vm_region_info_64 (server64, server32, local64); mach_vm_region_info_64 (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_mach_vm_region_info_64(
  task : vm_map_read_t;
  address : vm32_address_t;
 out region : vm_info_region_64_t;
 out objects : vm_info_object_array_t);

Local body: vm32_mach_vm_region_info_64. Calls visible in this body include vmlp_api_start, vmlp_api_end.

Implementation excerpt:

vm32_mach_vm_region_info_64(
	__DEBUG_ONLY vm_map_t                   map,
	__DEBUG_ONLY vm32_offset_ut             address_u,
	__DEBUG_ONLY vm_info_region_64_t        *regionp,
	__DEBUG_ONLY vm_info_object_array_t     *objectsp,
	__DEBUG_ONLY mach_msg_type_number_t     *objectsCntp)
{
	vmlp_api_start(VM32_REGION_INFO_64);

	vmlp_api_end(VM32_REGION_INFO_64, KERN_FAILURE);
	return KERN_FAILURE;
}

3824: vm32_vm_region_64

Query VM region information using the compatibility VM address/flavor interface.

Mechanism: The wrapper widens address/size, calls mach_vm_region (including BASIC flavor conversion), and truncates outputs to vm32 before returning its status. Unlike vm32_vm_region, this body does not call vm32_region_get_kern_return to validate the returned extent against VM32_MAX_ADDRESS. Its _64 information/offset form therefore should not be documented by copying the older wrapper's extra end check. Exact body, wide flavor selection.

Declarations: vm32_vm_region_64 (server64, server32, local64); vm_region_64 (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_region_64(
                target_task : vm_map_read_t;
 inout address : vm32_address_t;
        out size : vm32_size_t;
  flavor : vm_region_flavor_t;
 out info : vm_region_info_t, CountInOut;
        out object_name : memory_object_name_t =
                                        MACH_MSG_TYPE_MOVE_SEND
                                        ctype: mach_port_t);

Local body: vm32_vm_region_64. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_region, vm_sanitize_trunc_addr_to_32, vm_sanitize_trunc_size_to_32.

3825: vm32_mach_make_memory_entry_64

Create a memory-entry capability for a map range with a wide offset/size representation.

Mechanism: The vm32 message variant with wide size/offset simply delegates to _mach_make_memory_entry; it introduces no address narrowing of those fields. Permission-driven object/share/copy/parent selection and output capability creation remain in the common named-entry implementation. A vm32 client declaration does not mean the underlying VM object is limited to a 32-bit offset. Adapter, common dispatch.

Declarations: vm32_mach_make_memory_entry_64 (server64, server32, local64); mach_make_memory_entry_64 (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_mach_make_memory_entry_64(
  target_task :vm_map_t;
 inout size :memory_object_size_t;
  offset :memory_object_offset_t;
  permission :vm_prot_t;
 out object_handle :mach_port_move_send_t;
  parent_entry :mem_entry_name_port_t);

Local body: vm32_mach_make_memory_entry_64. Calls visible in this body include _mach_make_memory_entry.

Implementation excerpt:

vm32_mach_make_memory_entry_64(
	vm_map_t                target_map,
	memory_object_size_ut  *size,
	memory_object_offset_ut offset,
	vm_prot_ut              permission,
	ipc_port_t              *object_handle,
	ipc_port_t              parent_handle)
{
	// use the existing entrypoint
	return _mach_make_memory_entry(target_map, size, offset, permission, object_handle, parent_handle);
}

3826: vm32_vm_map_64

Map a memory-entry/object range using a wide object offset through the compatibility VM interface.

Mechanism: This compatibility form widens the vm32 destination address/size/alignment mask but preserves the already-wide backing-object offset. It invokes mach_vm_map_external with the object/copy/protection/inheritance fields intact, then narrows the returned destination address. The 64 suffix refers to the object offset contract, not a wholly 64-bit virtual-address ABI. Flag and mapping policy validation occurs in the shared external map implementation. Adapter, shared receiver.

Declarations: vm32_vm_map_64 (server64, server32, local64); vm_map_64 (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_map_64(
  target_task : vm_task_entry_t;
 inout address : vm32_address_t;
  size : vm32_size_t;
  mask : vm32_address_t;
  flags : int;
  object : mem_entry_name_port_t;
  offset : memory_object_offset_t;
  copy : boolean_t;
  cur_protection : vm_prot_t;
  max_protection : vm_prot_t;
  inheritance : vm_inherit_t);

Local body: vm32_vm_map_64. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_map_external, vm_sanitize_trunc_addr_to_32.

3827: reserved

skip in all listed profiles. Source slot.

3828: reserved

skip in all listed profiles. Source slot.

3829: reserved

skip in all listed profiles. Source slot.

3830: vm32_vm_purgable_control

Interface contract:

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.

Mechanism: This vm32 receiver already receives a converted map. It expands only the address and calls the local mach_vm_purgable_control, whose control allowlist excludes the kernel-only setter. Unlike the modern external port-taking wrapper, this body itself does not choose read-versus-control port conversion based on GET_STATE; that distinction cannot be inferred from an address-width adapter. Adapter, local control validation.

Declarations: vm32_vm_purgable_control (server64, server32, local64); vm_purgable_control (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_purgable_control(
  target_task : vm_map_t;
  address : vm32_address_t;
  control : vm_purgable_t;
 inout state : int);

Local body: vm32_vm_purgable_control. Calls visible in this body include vm_sanitize_expand_addr_to_64, mach_vm_purgable_control.

Implementation excerpt:

vm32_vm_purgable_control(
	vm_map_t                map,
	vm32_offset_ut          addr32,
	vm_purgable_t           control,
	int                    *state)
{
	mach_vm_offset_ut addr;

	addr = vm_sanitize_expand_addr_to_64(addr32);
	return mach_vm_purgable_control(map, addr, control, state);
}

3831: vm32_vm_map_exec_lockdown

Establish the map's executable-mapping lockdown policy under its interlock.

Mechanism: The vm32 version performs the same state change directly: reject a null map, acquire its interlock, set map_disallow_new_exec, unlock and return success. There are no virtual-address arguments to widen and no scan revoking already executable mappings. This operation installs future execution-map policy rather than returning a new region or modifying data pages. Complete body.

Declarations: vm32_vm_map_exec_lockdown (server64, server32, local64); vm_map_exec_lockdown (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_map_exec_lockdown(
  target_task : vm_map_t);

Local body: vm32_vm_map_exec_lockdown. Calls visible in this body include vmlp_api_start, vmlp_range_event_none, vmlp_api_end, vm_map_ilk_lock, vm_map_ilk_unlock.

Implementation excerpt:

vm32_vm_map_exec_lockdown(
	vm_map_t        map)
{
	vmlp_api_start(VM32__MAP_EXEC_LOCKDOWN);
	vmlp_range_event_none(map);

	if (map == VM_MAP_NULL) {
		vmlp_api_end(VM32__MAP_EXEC_LOCKDOWN, KERN_INVALID_ARGUMENT);
		return KERN_INVALID_ARGUMENT;
	}

	vm_map_ilk_lock(map);
	map->map_disallow_new_exec = TRUE;
	vm_map_ilk_unlock(map);

	vmlp_api_end(VM32__MAP_EXEC_LOCKDOWN, KERN_SUCCESS);
	return KERN_SUCCESS;
}

3832: reserved

skip in all listed profiles. Source slot.

3833: vm32_vm_reallocate

Interface contract:

!defined(MACH_VM_PUBLISH_AS_LOCAL)

Mechanism: The adapter expands source address/size, destination address/size and alignment mask, delegates to mach_vm_reallocate, and truncates its destination result before returning status. The shared sanitizer/relocation implementation rejects shrinking and unsupported map/entry configurations; the vm32 wrapper does not add a separate relocation implementation or recovery transaction. A failure-cleared wide destination therefore becomes zero in this output too. Adapter, shared validation.

Declarations: vm32_vm_reallocate (server64, server32, local64); vm_reallocate (client64, client32, libsyscall64, sender64).

Fields after preprocessing (server64):

routine vm32_vm_reallocate (
   target_task : vm_map_t;
   src : vm32_address_t;
   src_size : vm32_size_t;
 inout dst : vm32_address_t;
     dst_size : vm32_size_t;
   align_mask : vm32_offset_t;
   options : int;
   flags : int);

Local body: vm32_vm_reallocate. Calls visible in this body include vm_sanitize_expand_addr_to_64, vm_sanitize_expand_size_to_64, mach_vm_reallocate, vm_sanitize_trunc_addr_to_32.

Search the handbook

Search every chapter, interface and code excerpt.

    Diagram

    Source preview

    Open full file