---
title: vCPU Management
framework: Hypervisor
role: collectionGroup
role_heading: API Collection
path: hypervisor/vcpu-management
---

# vCPU Management

Create and run virtual CPUs, and manage CPU-specific registers and features.

## Overview

Overview Hypervisor creates Virtual CPUs with hv_vcpu_create(_:_:_:). Call functions that operate on the vCPU from the same thread with the exception of hv_vcpus_exit(_:_:). Enter the vCPU by using hv_vcpu_run(_:). The function runs until the guest traps or an other thread calls hv_vcpus_exit(_:_:). On exit, hv_vcpu_run(_:) populates the hv_vcpu_exit_t with the exit reason. warning: Don’t use vCPUs on dispatch queues, because work from a single queue can run on different threads.

## Topics

### Configuration

- [hv_vcpu_config_create()](hypervisor/hv_vcpu_config_create().md)
- [hv_vcpu_config_get_feature_reg(_:_:_:)](hypervisor/hv_vcpu_config_get_feature_reg(_:_:_:).md)
- [hv_vcpu_config_get_ccsidr_el1_sys_reg_values(_:_:_:)](hypervisor/hv_vcpu_config_get_ccsidr_el1_sys_reg_values(_:_:_:).md)
- [hv_vcpu_config_t](hypervisor/hv_vcpu_config_t.md)
- [OS_hv_vcpu_config](hypervisor/os_hv_vcpu_config.md)
- [hv_feature_reg_t](hypervisor/hv_feature_reg_t.md)

### Creation and destruction

- [hv_vm_get_max_vcpu_count(_:)](hypervisor/hv_vm_get_max_vcpu_count(_:).md)
- [hv_vcpu_create(_:_:_:)](hypervisor/hv_vcpu_create(_:_:_:).md)
- [hv_vcpu_destroy(_:)](hypervisor/hv_vcpu_destroy(_:).md)
- [hv_vcpu_t](hypervisor/hv_vcpu_t.md)

### Runtime

- [hv_vcpu_run(_:)](hypervisor/hv_vcpu_run(_:).md)
- [hv_vcpus_exit(_:_:)](hypervisor/hv_vcpus_exit(_:_:).md)
- [hv_vcpu_get_pending_interrupt(_:_:_:)](hypervisor/hv_vcpu_get_pending_interrupt(_:_:_:).md)
- [hv_vcpu_set_pending_interrupt(_:_:_:)](hypervisor/hv_vcpu_set_pending_interrupt(_:_:_:).md)
- [hv_vcpu_get_exec_time(_:_:)](hypervisor/hv_vcpu_get_exec_time(_:_:).md)
- [hv_interrupt_type_t](hypervisor/hv_interrupt_type_t.md)
- [Exits](hypervisor/exits.md)

### General registers

- [hv_vcpu_get_reg(_:_:_:)](hypervisor/hv_vcpu_get_reg(_:_:_:).md)
- [hv_vcpu_set_reg(_:_:_:)](hypervisor/hv_vcpu_set_reg(_:_:_:).md)
- [hv_reg_t](hypervisor/hv_reg_t.md)

### SIMD & Floating-point registers

- [hv_vcpu_get_simd_fp_reg(_:_:_:)](hypervisor/hv_vcpu_get_simd_fp_reg(_:_:_:).md)
- [hv_vcpu_set_simd_fp_reg(_:_:_:)](hypervisor/hv_vcpu_set_simd_fp_reg(_:_:_:).md)
- [hv_simd_fp_uchar16_t](hypervisor/hv_simd_fp_uchar16_t.md)
- [hv_simd_fp_reg_t](hypervisor/hv_simd_fp_reg_t.md)

### System registers

- [hv_vcpu_get_sys_reg(_:_:_:)](hypervisor/hv_vcpu_get_sys_reg(_:_:_:).md)
- [hv_vcpu_set_sys_reg(_:_:_:)](hypervisor/hv_vcpu_set_sys_reg(_:_:_:).md)
- [hv_sys_reg_t](hypervisor/hv_sys_reg_t.md)

### Trap configuration

- [hv_vcpu_get_trap_debug_exceptions(_:_:)](hypervisor/hv_vcpu_get_trap_debug_exceptions(_:_:).md)
- [hv_vcpu_set_trap_debug_exceptions(_:_:)](hypervisor/hv_vcpu_set_trap_debug_exceptions(_:_:).md)
- [hv_vcpu_get_trap_debug_reg_accesses(_:_:)](hypervisor/hv_vcpu_get_trap_debug_reg_accesses(_:_:).md)
- [hv_vcpu_set_trap_debug_reg_accesses(_:_:)](hypervisor/hv_vcpu_set_trap_debug_reg_accesses(_:_:).md)

## See Also

### Resource management

- [Memory management](hypervisor/memory-management.md)
