1use linux_io::fd::ioctl::{
2 ioctl_const_arg, ioctl_read, ioctl_write, ioctl_writeread, IoctlReqConstArg, IoctlReqRead,
3 IoctlReqWrite, IoctlReqWriteRead, _IO, _IOR, _IOW,
4};
5use linux_unsafe::int;
6
7use super::system::KVMIO;
8
9#[derive(Debug)]
11pub struct KvmVcpu;
12
13impl linux_io::fd::ioctl::IoDevice for KvmVcpu {}
14
15pub const KVM_RUN: IoctlReqConstArg<KvmVcpu, int, 0> = unsafe { ioctl_const_arg(_IO(KVMIO, 0x80)) };
16
17pub const KVM_GET_REGS: IoctlReqRead<KvmVcpu, crate::raw::kvm_regs> = unsafe {
18 ioctl_read(_IOR(
19 KVMIO,
20 0x81,
21 core::mem::size_of::<crate::raw::kvm_regs>() as linux_unsafe::ulong,
22 ))
23};
24
25pub const KVM_SET_REGS: IoctlReqWrite<KvmVcpu, crate::raw::kvm_regs> = unsafe {
26 ioctl_write(_IOW(
27 KVMIO,
28 0x82,
29 core::mem::size_of::<crate::raw::kvm_regs>() as linux_unsafe::ulong,
30 ))
31};
32
33pub const KVM_GET_ONE_REG: IoctlReqWriteRead<KvmVcpu, crate::raw::kvm_one_reg> = unsafe {
34 ioctl_writeread(_IOR(
35 KVMIO,
36 0xab,
37 core::mem::size_of::<crate::raw::kvm_one_reg>() as linux_unsafe::ulong,
38 ))
39};
40
41pub const KVM_SET_ONE_REG: IoctlReqWrite<KvmVcpu, crate::raw::kvm_one_reg> = unsafe {
42 ioctl_write(_IOW(
43 KVMIO,
44 0xac,
45 core::mem::size_of::<crate::raw::kvm_one_reg>() as linux_unsafe::ulong,
46 ))
47};