diff options
author | Dmitry Torokhov <dtor@chromium.org> | 2018-02-27 15:53:12 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-02-27 22:26:14 -0800 |
commit | cd6a187de66ff56948312ae983ca12a12782e774 (patch) | |
tree | ce1fd4992ca2e3a1a359350b0d8d4b5ba765e98d /crosvm_plugin | |
parent | 59cdd83fda0245e310cae018b71a4a8ba4c3b280 (diff) | |
download | crosvm-cd6a187de66ff56948312ae983ca12a12782e774.tar crosvm-cd6a187de66ff56948312ae983ca12a12782e774.tar.gz crosvm-cd6a187de66ff56948312ae983ca12a12782e774.tar.bz2 crosvm-cd6a187de66ff56948312ae983ca12a12782e774.tar.lz crosvm-cd6a187de66ff56948312ae983ca12a12782e774.tar.xz crosvm-cd6a187de66ff56948312ae983ca12a12782e774.tar.zst crosvm-cd6a187de66ff56948312ae983ca12a12782e774.zip |
plugin_proto: add helpers to convert CPUID data between KVM and protobuf
We need to convert between protobuf and KVM format of cpuid data in several places, so let's add helpers to plugin_proto crate. TEST=cargo test --features plugin; cargo test -p kvm BUG=chromium:800626 Change-Id: Ida7b59825d2146b0d02711e441f477d90dd4263a Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/939660 Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'crosvm_plugin')
-rw-r--r-- | crosvm_plugin/src/lib.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/crosvm_plugin/src/lib.rs b/crosvm_plugin/src/lib.rs index 6f56341..250692a 100644 --- a/crosvm_plugin/src/lib.rs +++ b/crosvm_plugin/src/lib.rs @@ -43,8 +43,7 @@ use sys_util::Scm; use kvm::dirty_log_bitmap_size; -use kvm_sys::{kvm_regs, kvm_sregs, kvm_fpu, kvm_debugregs, kvm_msr_entry, kvm_cpuid_entry2, - KVM_CPUID_FLAG_SIGNIFCANT_INDEX}; +use kvm_sys::{kvm_regs, kvm_sregs, kvm_fpu, kvm_debugregs, kvm_msr_entry, kvm_cpuid_entry2}; use plugin_proto::*; @@ -753,15 +752,7 @@ impl crosvm_vcpu { { let set_cpuid_entries: &mut RepeatedField<CpuidEntry> = r.mut_set_cpuid().mut_entries(); for cpuid_entry in cpuid_entries.iter() { - let mut entry = CpuidEntry::new(); - entry.function = cpuid_entry.function; - entry.has_index = cpuid_entry.flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX != 0; - entry.index = cpuid_entry.index; - entry.eax = cpuid_entry.eax; - entry.ebx = cpuid_entry.ebx; - entry.ecx = cpuid_entry.ecx; - entry.edx = cpuid_entry.edx; - set_cpuid_entries.push(entry); + set_cpuid_entries.push(cpuid_kvm_to_proto(cpuid_entry)); } } self.vcpu_transaction(&r)?; |