mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-26 13:10:56 +00:00
kvm: add KVM_SET_IDENTITY_MAP_ADDR ioctl
BUG=None TEST=./build_test Change-Id: Ic5b479487f45949fd0888af6d670293931a6a0a7 Reviewed-on: https://chromium-review.googlesource.com/848017 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
parent
d60bb1616c
commit
df59500364
1 changed files with 16 additions and 0 deletions
|
@ -272,6 +272,22 @@ impl Vm {
|
|||
}
|
||||
}
|
||||
|
||||
/// Sets the address of a one-page region in the VM's address space.
|
||||
///
|
||||
/// See the documentation on the KVM_SET_IDENTITY_MAP_ADDR ioctl.
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub fn set_identity_map_addr(&self, addr: GuestAddress) -> Result<()> {
|
||||
// Safe because we know that our file is a VM fd and we verify the return result.
|
||||
let ret = unsafe {
|
||||
ioctl_with_val(self, KVM_SET_IDENTITY_MAP_ADDR(), addr.offset() as u64)
|
||||
};
|
||||
if ret == 0 {
|
||||
Ok(())
|
||||
} else {
|
||||
errno_result()
|
||||
}
|
||||
}
|
||||
|
||||
/// Crates an in kernel interrupt controller.
|
||||
///
|
||||
/// See the documentation on the KVM_CREATE_IRQCHIP ioctl.
|
||||
|
|
Loading…
Reference in a new issue