---
title: "hv_vm_map_space(_:_:_:_:_:)"
framework: Hypervisor
role: symbol
role_heading: Function
platforms: [macOS 10.15+]
path: "hypervisor/hv_vm_map_space(_:_:_:_:_:)"
---

# hv_vm_map_space(_:_:_:_:_:)

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

## Declaration

```swift
func hv_vm_map_space(_ asid: hv_vm_space_t, _ uva: hv_uvaddr_t, _ gpa: hv_gpaddr_t, _ size: Int, _ flags: hv_memory_flags_t) -> hv_return_t
```

## Parameters

- `asid`: The Address space ID.
- `uva`: The page-aligned virtual address in the current task.
- `gpa`: The page-aligned address in the guest physical address space.
- `size`: The size in bytes of the region to map.
- `flags`: One of either READ, WRITE or EXECUTE permissions of the region.

## Return Value

Return Value HV_SUCCESS if the operation was successful, otherwise an error code specified in hv_return_t.

## See Also

### Functions

- [hv_sme_config_get_max_svl_bytes(_:)](hypervisor/hv_sme_config_get_max_svl_bytes(_:).md)
- [hv_vcpu_apic_ctrl(_:_:)](hypervisor/hv_vcpu_apic_ctrl(_:_:).md)
- [hv_vcpu_apic_get_state(_:_:)](hypervisor/hv_vcpu_apic_get_state(_:_:).md)
- [hv_vcpu_apic_lsc_enter_imm32(_:_:_:_:_:_:_:)](hypervisor/hv_vcpu_apic_lsc_enter_imm32(_:_:_:_:_:_:_:).md)
- [hv_vcpu_apic_lsc_enter_r32(_:_:_:_:_:_:_:_:)](hypervisor/hv_vcpu_apic_lsc_enter_r32(_:_:_:_:_:_:_:_:).md)
- [hv_vcpu_apic_lsc_invalidate(_:)](hypervisor/hv_vcpu_apic_lsc_invalidate(_:).md)
- [hv_vcpu_apic_put_state(_:_:)](hypervisor/hv_vcpu_apic_put_state(_:_:).md)
- [hv_vcpu_apic_read(_:_:_:)](hypervisor/hv_vcpu_apic_read(_:_:_:).md)
- [hv_vcpu_apic_trigger_lvt(_:_:)](hypervisor/hv_vcpu_apic_trigger_lvt(_:_:).md)
- [hv_vcpu_apic_write(_:_:_:_:)](hypervisor/hv_vcpu_apic_write(_:_:_:_:).md)
- [hv_vcpu_exit_apic_access_read(_:_:)](hypervisor/hv_vcpu_exit_apic_access_read(_:_:).md)
- [hv_vcpu_exit_info(_:_:)](hypervisor/hv_vcpu_exit_info(_:_:).md)
- [hv_vcpu_exit_init_ap(_:_:_:)](hypervisor/hv_vcpu_exit_init_ap(_:_:_:).md)
- [hv_vcpu_exit_inject_excp(_:_:_:_:_:)](hypervisor/hv_vcpu_exit_inject_excp(_:_:_:_:_:).md)
- [hv_vcpu_exit_ioapic_eoi(_:_:)](hypervisor/hv_vcpu_exit_ioapic_eoi(_:_:).md)
