<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Hypervisor",
  "identifier" : "/documentation/Hypervisor/hv_vm_map(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Hypervisor"
    ],
    "preciseIdentifier" : "c:@F@hv_vm_map"
  },
  "title" : "hv_vm_map(_:_:_:_:)"
}
-->

# hv_vm_map(_:_:_:_:)

Maps a region in the virtual address space of the current process into the guest physical address space of the VM.

```
func hv_vm_map(_ addr: UnsafeMutableRawPointer, _ ipa: hv_ipa_t, _ size: Int, _ flags: hv_memory_flags_t) -> hv_return_t
```

## Parameters

`addr`

The address in the current process. It must be page-aligned.

    Apple silicon only.

`ipa`

The address in the intermediate physical address space. It must be page-aligned.

    Apple silicon only.

`size`

The size of the mapped region in bytes. It must be a multiple of the page size.

`flags`

The permissions for the mapped region. For a list of valid options, see [`hv_memory_flags_t`](/documentation/Hypervisor/hv_memory_flags_t).

## Return Value

[`HV_SUCCESS`](/documentation/Hypervisor/HV_SUCCESS) if the operation was successful, otherwise an error code specified in [`hv_return_t`](/documentation/Hypervisor/hv_return_t).

## Discussion

The host memory must encompass a single VM region, typically allocated with `mmap` or <doc://com.apple.documentation/documentation/kernel/1402376-mach_vm_allocate> instead of `malloc`.

Intel-based Mac computers have different parameters:

- `uva`: The address in the current process. It must be page-aligned.
- `gpa`: The address in the guest physical address space. It must be page-aligned.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)