summary refs log tree commit diff
path: root/hypervisor/src/types/x86.rs
diff options
context:
space:
mode:
authorUdam Saini <udam@google.com>2020-04-30 13:46:40 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-03 22:01:30 +0000
commit6fe08fa36338ee6339dd4748173865763bfc7b31 (patch)
tree0e5290eefc71e7129db56bf8369b72f54275a0f3 /hypervisor/src/types/x86.rs
parentf990be36d06bd2826482184f6b2b8c9b3fc4c49b (diff)
downloadcrosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.tar
crosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.tar.gz
crosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.tar.bz2
crosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.tar.lz
crosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.tar.xz
crosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.tar.zst
crosvm-6fe08fa36338ee6339dd4748173865763bfc7b31.zip
Adding hypervisor crate to abstract out Kvm implementation
This is a separate hypervisor crate for interacting with Kvm in an
abstract manner. The intention is to not leak the internals of kvm
with its specific calls in various places in the codebase. Currently,
this just creates an initial structure for adding various
implementations over time.

In addition, a SafeDescriptor class is added, that wraps a raw file
descriptor safely, without needing to wrap it in the rust file class.
The intention is to use this for non file raw descriptors.

BUG=chromium:1077058
TEST=added a basic kvm test that creates a Kvm struct

Change-Id: I4229203902e480b52435cde12bf0d25a322c71be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2174756
Commit-Queue: Udam Saini <udam@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'hypervisor/src/types/x86.rs')
-rw-r--r--hypervisor/src/types/x86.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/hypervisor/src/types/x86.rs b/hypervisor/src/types/x86.rs
new file mode 100644
index 0000000..cd5236a
--- /dev/null
+++ b/hypervisor/src/types/x86.rs
@@ -0,0 +1,10 @@
+// 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 kvm_sys::kvm_cpuid_entry2;
+
+pub type CpuIdEntry = kvm_cpuid_entry2;
+pub struct CpuId {
+    _cpu_id_entries: Vec<CpuIdEntry>,
+}