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

# hv_vcpu_create(_:_:_:)

Creates a vCPU instance for the current thread.

```
func hv_vcpu_create(_ vcpu: UnsafeMutablePointer<hv_vcpu_t>, _ exit: UnsafeMutablePointer<UnsafeMutablePointer<hv_vcpu_exit_t>?>, _ config: hv_vcpu_config_t?) -> hv_return_t
```

## Parameters

`vcpu`

An argument that the hypervisor populates with the instance of a vCPU on a successful return.

`exit`

The pointer to the vCPU exit information. The function [`hv_vcpu_run(_:)`](/documentation/Hypervisor/hv_vcpu_run(_:)) updates this structure on return.

    Apple silicon only.

`config`

The configuration of the vCPU or `nil` for a default configuration.

    Apple silicon only.

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

Intel-based Mac computers have different parameters:

- `flags`: The vCPU creation flag. The available flags are [`HV_VCPU_ACCEL_RDPMC`](/documentation/Hypervisor/HV_VCPU_ACCEL_RDPMC), [`HV_VCPU_TSC_RELATIVE`](/documentation/Hypervisor/HV_VCPU_TSC_RELATIVE), and [`HV_VCPU_DEFAULT`](/documentation/Hypervisor/HV_VCPU_DEFAULT). The default is [`HV_VCPU_DEFAULT`](/documentation/Hypervisor/HV_VCPU_DEFAULT).

> Note:
> Using the ``doc://com.apple.hypervisor/documentation/Hypervisor/HV_VCPU_TSC_RELATIVE`` flag enables use of the Time-Stamp Counter (TSC) relative offset capabilities, but disables the default TSC for vCPUs that you create with this flag.

---

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)