1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use linux_io::fd::ioctl::{
ioctl_write, ioctl_write_val, IoctlReqWrite, IoctlReqWriteVal, _IO, _IOW,
};
use linux_unsafe::{int, ulong};
use super::system::KVMIO;
use linux_io::File;
#[derive(Debug)]
pub struct KvmVm;
impl linux_io::fd::ioctl::IoDevice for KvmVm {}
pub const KVM_CHECK_EXTENSION: IoctlReqWrite<KvmVm, int, int> =
unsafe { ioctl_write(_IOW(KVMIO, 0x03, core::mem::size_of::<int>() as ulong)) };
pub const KVM_CREATE_VCPU: IoctlReqWriteVal<KvmVm, int, File<super::vcpu::KvmVcpu>> =
unsafe { ioctl_write_val(_IO(KVMIO, 0x41)) };
pub const KVM_SET_USER_MEMORY_REGION: IoctlReqWrite<
KvmVm,
crate::raw::kvm_userspace_memory_region,
int,
> = unsafe {
ioctl_write(_IOW(
KVMIO,
0x46,
core::mem::size_of::<crate::raw::kvm_userspace_memory_region>() as ulong,
))
};
pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1 << 0;
pub const KVM_MEM_READONLY: u32 = 1 << 1;