Skip to content

Commit 4c61fc4

Browse files
Copilotsimongdavies
andcommitted
Remove dyn OutBHandlerCaller trait entirely
Co-authored-by: simongdavies <[email protected]>
1 parent 132d0f4 commit 4c61fc4

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/hyperlight_host/src/hypervisor/handlers.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ use tracing::{instrument, Span};
2020

2121
use crate::{new_error, Result};
2222

23-
/// The trait representing custom logic to handle the case when
24-
/// a Hypervisor's virtual CPU (vCPU) informs Hyperlight the guest
25-
/// has initiated an outb operation.
26-
pub trait OutBHandlerCaller: Sync + Send {
27-
/// Function that gets called when an outb operation has occurred.
28-
fn call(&mut self, port: u16, payload: u32) -> Result<()>;
29-
}
30-
3123
pub(crate) type OutBHandlerFunction = Box<dyn FnMut(u16, u32) -> Result<()> + Send>;
3224

3325
/// A `OutBHandler` implementation using a `OutBHandlerFunction`
@@ -42,9 +34,10 @@ impl From<OutBHandlerFunction> for OutBHandler {
4234
}
4335
}
4436

45-
impl OutBHandlerCaller for OutBHandler {
37+
impl OutBHandler {
38+
/// Function that gets called when an outb operation has occurred.
4639
#[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")]
47-
fn call(&mut self, port: u16, payload: u32) -> Result<()> {
40+
pub fn call(&mut self, port: u16, payload: u32) -> Result<()> {
4841
let mut func = self
4942
.0
5043
.try_lock()

src/hyperlight_host/src/hypervisor/hyperv_linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use super::fpu::{FP_CONTROL_WORD_DEFAULT, FP_TAG_WORD_DEFAULT, MXCSR_DEFAULT};
5555
use super::gdb::{DebugCommChannel, DebugMsg, DebugResponse, GuestDebug, MshvDebug};
5656
#[cfg(gdb)]
5757
use super::handlers::DbgMemAccessHandlerWrapper;
58-
use super::handlers::{MemAccessHandlerWrapper, OutBHandler, OutBHandlerCaller};
58+
use super::handlers::{MemAccessHandlerWrapper, OutBHandler};
5959
use super::{
6060
Hypervisor, VirtualCPU, CR0_AM, CR0_ET, CR0_MP, CR0_NE, CR0_PE, CR0_PG, CR0_WP, CR4_OSFXSR,
6161
CR4_OSXMMEXCPT, CR4_PAE, EFER_LMA, EFER_LME, EFER_NX, EFER_SCE,

src/hyperlight_host/src/hypervisor/hyperv_windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use windows::Win32::System::Hypervisor::{
3232
use super::fpu::{FP_TAG_WORD_DEFAULT, MXCSR_DEFAULT};
3333
#[cfg(gdb)]
3434
use super::handlers::DbgMemAccessHandlerWrapper;
35-
use super::handlers::{MemAccessHandlerWrapper, OutBHandler, OutBHandlerCaller};
35+
use super::handlers::{MemAccessHandlerWrapper, OutBHandler};
3636
use super::surrogate_process::SurrogateProcess;
3737
use super::surrogate_process_manager::*;
3838
use super::windows_hypervisor_platform::{VMPartition, VMProcessor};

src/hyperlight_host/src/hypervisor/kvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use super::fpu::{FP_CONTROL_WORD_DEFAULT, FP_TAG_WORD_DEFAULT, MXCSR_DEFAULT};
2929
use super::gdb::{DebugCommChannel, DebugMsg, DebugResponse, GuestDebug, KvmDebug, VcpuStopReason};
3030
#[cfg(gdb)]
3131
use super::handlers::DbgMemAccessHandlerWrapper;
32-
use super::handlers::{MemAccessHandlerWrapper, OutBHandler, OutBHandlerCaller};
32+
use super::handlers::{MemAccessHandlerWrapper, OutBHandler};
3333
use super::{
3434
HyperlightExit, Hypervisor, VirtualCPU, CR0_AM, CR0_ET, CR0_MP, CR0_NE, CR0_PE, CR0_PG, CR0_WP,
3535
CR4_OSFXSR, CR4_OSXMMEXCPT, CR4_PAE, EFER_LMA, EFER_LME, EFER_NX, EFER_SCE,

0 commit comments

Comments
 (0)