mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-26 13:10:56 +00:00
kvm: add KVM_GET_FPU ioctl
BUG=None TEST=./build_test Change-Id: I38ee166d9c7a0340d58fb3fd7f51895ca158f8b3 Reviewed-on: https://chromium-review.googlesource.com/848016 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
ce4611cde2
commit
d60bb1616c
1 changed files with 13 additions and 0 deletions
|
@ -581,6 +581,19 @@ impl Vcpu {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Gets the VCPU FPU registers.
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub fn get_fpu(&self) -> Result<kvm_fpu> {
|
||||
// Safe because we know that our file is a VCPU fd, we know the kernel will only write the
|
||||
// correct amount of memory to our pointer, and we verify the return result.
|
||||
let mut regs = unsafe { std::mem::zeroed() };
|
||||
let ret = unsafe { ioctl_with_mut_ref(self, KVM_GET_FPU(), &mut regs) };
|
||||
if ret != 0 {
|
||||
return errno_result();
|
||||
}
|
||||
Ok(regs)
|
||||
}
|
||||
|
||||
/// X86 specific call to setup the FPU
|
||||
///
|
||||
/// See the documentation for KVM_SET_FPU.
|
||||
|
|
Loading…
Reference in a new issue