Skip to content

Commit 2692982

Browse files
committed
Started on changing trait
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent bec5af9 commit 2692982

File tree

8 files changed

+956
-523
lines changed

8 files changed

+956
-523
lines changed

src/hyperlight_host/src/hypervisor/hyperlight_vm.rs

Lines changed: 709 additions & 0 deletions
Large diffs are not rendered by default.

src/hyperlight_host/src/hypervisor/hyperv_linux.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use super::gdb::{DebugCommChannel, DebugMsg, DebugResponse, GuestDebug, MshvDebu
5656
use super::handlers::DbgMemAccessHandlerWrapper;
5757
use super::handlers::{MemAccessHandlerWrapper, OutBHandlerWrapper};
5858
use super::{
59-
Hypervisor, VirtualCPU, CR0_AM, CR0_ET, CR0_MP, CR0_NE, CR0_PE, CR0_PG, CR0_WP, CR4_OSFXSR,
59+
HyperlightVm, CR0_AM, CR0_ET, CR0_MP, CR0_NE, CR0_PE, CR0_PG, CR0_WP, CR4_OSFXSR,
6060
CR4_OSXMMEXCPT, CR4_PAE, EFER_LMA, EFER_LME, EFER_NX, EFER_SCE,
6161
};
6262
use crate::hypervisor::hypervisor_handler::HypervisorHandler;
@@ -448,7 +448,7 @@ impl Debug for HypervLinuxDriver {
448448
}
449449
}
450450

451-
impl Hypervisor for HypervLinuxDriver {
451+
impl HyperlightVm for HypervLinuxDriver {
452452
#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
453453
fn initialise(
454454
&mut self,
@@ -653,8 +653,8 @@ impl Hypervisor for HypervLinuxDriver {
653653
}
654654

655655
#[instrument(skip_all, parent = Span::current(), level = "Trace")]
656-
fn as_mut_hypervisor(&mut self) -> &mut dyn Hypervisor {
657-
self as &mut dyn Hypervisor
656+
fn as_mut_hypervisor(&mut self) -> &mut dyn HyperlightVm {
657+
self as &mut dyn HyperlightVm
658658
}
659659

660660
#[cfg(crashdump)]

src/hyperlight_host/src/hypervisor/hypervisor_handler.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ use windows::Win32::System::Hypervisor::{WHvCancelRunVirtualProcessor, WHV_PARTI
3737

3838
#[cfg(gdb)]
3939
use super::gdb::create_gdb_thread;
40+
use super::hyperlight_vm::HyperlightSandbox;
4041
#[cfg(gdb)]
4142
use crate::hypervisor::handlers::DbgMemAccessHandlerWrapper;
4243
use crate::hypervisor::handlers::{MemAccessHandlerWrapper, OutBHandlerWrapper};
4344
#[cfg(target_os = "windows")]
4445
use crate::hypervisor::wrappers::HandleWrapper;
45-
use crate::hypervisor::Hypervisor;
46+
use crate::hypervisor::HyperlightVm;
4647
use crate::mem::layout::SandboxMemoryLayout;
4748
use crate::mem::mgr::SandboxMemoryManager;
4849
use crate::mem::ptr::{GuestPtr, RawPtr};
@@ -294,7 +295,7 @@ impl HypervisorHandler {
294295
thread::Builder::new()
295296
.name("Hypervisor Handler".to_string())
296297
.spawn(move || -> Result<()> {
297-
let mut hv: Option<Box<dyn Hypervisor>> = None;
298+
let mut hv: Option<Box<dyn HyperlightVm>> = None;
298299
for action in to_handler_rx {
299300
match action {
300301
HypervisorHandlerAction::Initialise => {
@@ -835,7 +836,7 @@ fn set_up_hypervisor_partition(
835836
#[allow(unused_variables)] // parameter only used for in-process mode
836837
outb_handler: OutBHandlerWrapper,
837838
#[cfg(gdb)] debug_info: &Option<DebugInfo>,
838-
) -> Result<Box<dyn Hypervisor>> {
839+
) -> Result<Box<dyn HyperlightVm>> {
839840
let mem_size = u64::try_from(mgr.shared_mem.mem_size())?;
840841
let mut regions = mgr.layout.get_memory_regions(&mgr.shared_mem)?;
841842
let rsp_ptr = {
@@ -930,7 +931,7 @@ fn set_up_hypervisor_partition(
930931

931932
#[cfg(kvm)]
932933
Some(HypervisorType::Kvm) => {
933-
let hv = crate::hypervisor::kvm::KVMDriver::new(
934+
let hv = HyperlightSandbox::new(
934935
regions,
935936
pml4_ptr.absolute()?,
936937
entrypoint_ptr.absolute()?,

0 commit comments

Comments
 (0)