---
title: "hv_vm_protect(_:_:_:)"
framework: hypervisor
role: symbol
role_heading: Function
path: "hypervisor/hv_vm_protect(_:_:_:)"
---

# hv_vm_protect(_:_:_:)

Modifies the permissions of a region in the guest physical address space of the VM.

## Declaration

```swift
func hv_vm_protect(_ ipa: hv_ipa_t, _ size: Int, _ flags: hv_memory_flags_t) -> hv_return_t
```

## Parameters

- `ipa`: The address in the intermediate physical address space. It must be page-aligned. Apple silicon only.
- `size`: The size in bytes of the region to protect, in bytes. It must be a multiple of the page size.
- `flags`: The permissions for the protected region. For a list of valid options, see doc://com.apple.hypervisor/documentation/Hypervisor/hv_memory_flags_t.

## Return Value

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

## Discussion

Discussion Intel-based Mac computers have different parameters:

## See Also

### Intermediate physical memory

- [hv_vm_map(_:_:_:_:)](hypervisor/hv_vm_map(_:_:_:_:).md)
- [hv_vm_unmap(_:_:)](hypervisor/hv_vm_unmap(_:_:).md)
- [hv_ipa_t](hypervisor/hv_ipa_t.md)
