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

# hv_vmx_vcpu_get_cap_write_vmcs(_:_:_:_:)

Returns the allowed_0 and allowed_1 masks for a VMCS field of a vCPU.

```
func hv_vmx_vcpu_get_cap_write_vmcs(_ vcpu: hv_vcpuid_t, _ field: UInt32, _ allowed_0: UnsafeMutablePointer<UInt64>, _ allowed_1: UnsafeMutablePointer<UInt64>) -> hv_return_t
```

## Parameters

`vcpu`

The vCPU ID.

`field`

The ID of the VMCS field for which to return capabilities.

`allowed_0`

The pointer to the VMCS allowed_0 mask (written on success).

`allowed_1`

The pointer to the VMCS allowed_1 mask (written on success).

## 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

Returns the constraints imposed by the Hypervisor framework on the given VMCS field, in the form of `allowed_0` and `allowed_1` masks, that indicate what bit values may be set when writing the given VMCS field.

When writing to a VMCS field, the caller is allowed to set bits that are 0 in its `allowed_0` mask to 0, and bits that are 1 in its `allowed_1` mask to 1. This means:

- If allowed_0 = 0, allowed_1 = 0 -> must be `NOT SET`.
- If allowed_0 = 0, allowed_1 = 1 -> can be either `SET` or `NOT SET.`
- If allowed_0 = 1, allowed_1 = 0 -> undefined (shouldn’t happen).
- If allowed_0 = 1, allowed_1 = 1 -> must be `SET`.

> Important:
> This function must be called by the owning thread.

---

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)