1# zx_vcpu_write_state 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7vcpu_write_state - write the state of a VCPU 8 9## SYNOPSIS 10 11<!-- Updated by update-docs-from-abigen, do not edit. --> 12 13``` 14#include <zircon/syscalls.h> 15 16zx_status_t zx_vcpu_write_state(zx_handle_t handle, 17 uint32_t kind, 18 const void* buffer, 19 size_t buffer_size); 20``` 21 22## DESCRIPTION 23 24`zx_vcpu_write_state()` writes the state of *handle* as specified by *kind* from 25*buffer*. It is only valid to write the state of *handle* when execution has been 26paused. 27 28*kind* may be **ZX_VCPU_STATE** or **ZX_VCPU_IO**. 29 30## RIGHTS 31 32<!-- Updated by update-docs-from-abigen, do not edit. --> 33 34*handle* must be of type **ZX_OBJ_TYPE_VCPU** and have **ZX_RIGHT_WRITE**. 35 36## RETURN VALUE 37 38`zx_vcpu_write_state()` returns **ZX_OK** on success. On failure, an error value is 39returned. 40 41## ERRORS 42 43**ZX_ERR_ACCESS_DENIED** *handle* does not have the **ZX_RIGHT_WRITE** right. 44 45**ZX_ERR_BAD_HANDLE** *handle* is an invalid handle. 46 47**ZX_ERR_BAD_STATE** *handle* is in a bad state, and state can not be written. 48 49**ZX_ERR_INVALID_ARGS** *kind* does not name a known VCPU state, *buffer* is an 50invalid pointer, or *buffer_size* does not match the expected size of *kind*. 51 52**ZX_ERR_WRONG_TYPE** *handle* is not a handle to a VCPU. 53 54## SEE ALSO 55 56 - [`zx_guest_create()`] 57 - [`zx_guest_set_trap()`] 58 - [`zx_vcpu_create()`] 59 - [`zx_vcpu_interrupt()`] 60 - [`zx_vcpu_read_state()`] 61 - [`zx_vcpu_resume()`] 62 63<!-- References updated by update-docs-from-abigen, do not edit. --> 64 65[`zx_guest_create()`]: guest_create.md 66[`zx_guest_set_trap()`]: guest_set_trap.md 67[`zx_vcpu_create()`]: vcpu_create.md 68[`zx_vcpu_interrupt()`]: vcpu_interrupt.md 69[`zx_vcpu_read_state()`]: vcpu_read_state.md 70[`zx_vcpu_resume()`]: vcpu_resume.md 71