1# zx_vcpu_write_state 2 3## NAME 4 5vcpu_write_state - write the state of a VCPU 6 7## SYNOPSIS 8 9``` 10#include <zircon/syscalls.h> 11#include <zircon/syscalls/hypervisor.h> 12 13zx_status_t zx_vcpu_write_state(zx_handle_t vcpu, uint32_t kind, 14 const void* buffer, size_t buffer_size); 15``` 16 17## DESCRIPTION 18 19**vcpu_write_state**() writes the state of *vcpu* as specified by *kind* from 20*buffer*. It is only valid to write the state of *vcpu* when execution has been 21paused. 22 23*kind* may be *ZX_VCPU_STATE* or *ZX_VCPU_IO*. 24 25## RIGHTS 26 27TODO(ZX-2399) 28 29## RETURN VALUE 30 31**vcpu_write_state**() returns ZX_OK on success. On failure, an error value is 32returned. 33 34## ERRORS 35 36**ZX_ERR_ACCESS_DENIED** *vcpu* does not have the *ZX_RIGHT_WRITE* right. 37 38**ZX_ERR_BAD_HANDLE** *vcpu* is an invalid handle. 39 40**ZX_ERR_BAD_STATE** *vcpu* is in a bad state, and state can not be written. 41 42**ZX_ERR_INVALID_ARGS** *kind* does not name a known VCPU state, *buffer* is an 43invalid pointer, or *buffer_size* does not match the expected size of *kind*. 44 45**ZX_ERR_WRONG_TYPE** *vcpu* is not a handle to a VCPU. 46 47## SEE ALSO 48 49[guest_create](guest_create.md), 50[guest_set_trap](guest_set_trap.md), 51[vcpu_create](vcpu_create.md), 52[vcpu_resume](vcpu_resume.md), 53[vcpu_interrupt](vcpu_interrupt.md), 54[vcpu_read_state](vcpu_read_state.md). 55