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

# hv_vcpu_get_sys_reg(_:_:_:)

Gets the current value of a vCPU system register.

## Declaration

```swift
func hv_vcpu_get_sys_reg(_ vcpu: hv_vcpu_t, _ reg: hv_sys_reg_t, _ value: UnsafeMutablePointer<UInt64>) -> hv_return_t
```

## Parameters

- `vcpu`: The instance of the vCPU.
- `reg`: The ID of the system register.
- `value`: The value of the register reg on output.

## Return Value

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

## Discussion

Discussion important: This function must be called by the owning thread.

## See Also

### System registers

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