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

# hv_gic_set_state(_:_:)

Sets the state of a generic interrupt controller (GIC) device.

## Declaration

```swift
func hv_gic_set_state(_ gic_state_data: UnsafeRawPointer, _ gic_state_size: Int) -> hv_return_t
```

## Parameters

- `gic_state_data`: A pointer to the state buffer to use to set the GIC.
- `gic_state_size`: Size of GIC state buffer, in bytes.

## Return Value

Return Value HV_SUCCESS on success; otherwise, an error code.

## Discussion

Discussion Use this method to restore the state of a GIC. You can only restore a GIC’s state after creating a GIC device and vCPUs and before the vCPUs are running. Restore the rest of the virtual machine including GIC CPU registers with values that are compatible with the hv_gic_state_t. In some cases this method can fail if a software update has changed the host in a way that would be incompatible with the previous format.

## See Also

### Getting and setting the GIC’s state

- [hv_gic_state_create()](hypervisor/hv_gic_state_create().md)
- [hv_gic_state_get_size(_:_:)](hypervisor/hv_gic_state_get_size(_:_:).md)
- [hv_gic_state_get_data(_:_:)](hypervisor/hv_gic_state_get_data(_:_:).md)
- [hv_gic_state_t](hypervisor/hv_gic_state_t.md)
- [OS_hv_gic_state](hypervisor/os_hv_gic_state.md)
