diff options
author | Steven Richman <srichman@google.com> | 2020-05-01 17:30:24 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-09 06:23:33 +0000 |
commit | e1f8d9187d3f16e31d0c1304030ad412cf43b2bf (patch) | |
tree | 45b8606c4d9fb31a4d4d335d8e0ea3bb31a6d9c2 /hypervisor/src/kvm/x86_64.rs | |
parent | a7469062a2b25541cfe887f55441284553659ea0 (diff) | |
download | crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.gz crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.bz2 crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.lz crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.xz crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.tar.zst crosvm-e1f8d9187d3f16e31d0c1304030ad412cf43b2bf.zip |
hypervisor: add Vm/Vcpu traits and Kvm impls
Add arch-agnostic traits Vm and Vcpu. Add arch-specific traits HypervisorXXX, VmXXX, VcpuXXX, with impls for KVM. BUG=chromium:1077058 TEST=added test for functions and structs interacting with the traits Change-Id: I809f42f32a558c7835831c90e24fca82ce7744ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2176562 Reviewed-by: Udam Saini <udam@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Steven Richman <srichman@google.com>
Diffstat (limited to 'hypervisor/src/kvm/x86_64.rs')
-rw-r--r-- | hypervisor/src/kvm/x86_64.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hypervisor/src/kvm/x86_64.rs b/hypervisor/src/kvm/x86_64.rs new file mode 100644 index 0000000..56681f9 --- /dev/null +++ b/hypervisor/src/kvm/x86_64.rs @@ -0,0 +1,32 @@ +// Copyright 2020 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use sys_util::Result; + +use super::{Kvm, KvmVcpu, KvmVm}; +use crate::{CpuId, HypervisorX86_64, Regs, VcpuX86_64, VmX86_64}; + +impl HypervisorX86_64 for Kvm { + fn get_supported_cpuid(&self) -> Result<CpuId> { + unimplemented!("get_supported_cpuid for Kvm is not yet implemented"); + } + + fn get_emulated_cpuid(&self) -> Result<CpuId> { + unimplemented!("get_emulated_cpuid for Kvm is not yet implemented"); + } +} + +impl VmX86_64 for KvmVm { + type Vcpu = KvmVcpu; + + fn create_vcpu(&self, id: usize) -> Result<Self::Vcpu> { + self.create_kvm_vcpu(id) + } +} + +impl VcpuX86_64 for KvmVcpu { + fn get_regs(&self) -> Result<Regs> { + Ok(Regs {}) + } +} |