@@ -45,8 +45,8 @@ use super::surrogate_process_manager::*;
4545use super :: windows_hypervisor_platform:: { VMPartition , VMProcessor } ;
4646use super :: wrappers:: HandleWrapper ;
4747use super :: { HyperlightExit , Hypervisor , InterruptHandle , VirtualCPU } ;
48- use crate :: hypervisor:: get_memory_access_violation;
4948use crate :: hypervisor:: regs:: { CommonFpu , CommonRegisters } ;
49+ use crate :: hypervisor:: { InterruptHandleInternal , get_memory_access_violation} ;
5050use crate :: mem:: memory_region:: { MemoryRegion , MemoryRegionFlags } ;
5151use crate :: mem:: mgr:: SandboxMemoryManager ;
5252use crate :: mem:: ptr:: { GuestPtr , RawPtr } ;
@@ -550,8 +550,12 @@ impl Hypervisor for HypervWindowsDriver {
550550 & mut self ,
551551 #[ cfg( feature = "trace_guest" ) ] tc : & mut crate :: sandbox:: trace:: TraceContext ,
552552 ) -> Result < super :: HyperlightExit > {
553+ // Cast to internal trait for access to internal methods
554+ let interrupt_handle_internal =
555+ self . interrupt_handle . as_ref ( ) as & dyn super :: InterruptHandleInternal ;
556+
553557 // Get current generation and set running bit
554- let generation = self . interrupt_handle . set_running_bit ( ) ;
558+ let generation = interrupt_handle_internal . set_running_bit ( ) ;
555559
556560 #[ cfg( not( gdb) ) ]
557561 let debug_interrupt = false ;
@@ -562,8 +566,7 @@ impl Hypervisor for HypervWindowsDriver {
562566 . load ( Ordering :: Relaxed ) ;
563567
564568 // Check if cancellation was requested for THIS generation
565- let exit_context = if self
566- . interrupt_handle
569+ let exit_context = if interrupt_handle_internal
567570 . is_cancel_requested_for_generation ( generation)
568571 || debug_interrupt
569572 {
@@ -581,18 +584,17 @@ impl Hypervisor for HypervWindowsDriver {
581584 } ;
582585
583586 // Clear running bit
584- self . interrupt_handle . clear_running_bit ( ) ;
587+ interrupt_handle_internal . clear_running_bit ( ) ;
585588
586589 let is_canceled = exit_context. ExitReason == WHV_RUN_VP_EXIT_REASON ( 8193i32 ) ; // WHvRunVpExitReasonCanceled
587590
588591 // Check if this was a manual cancellation (vs internal Windows cancellation)
589- let cancel_was_requested_manually = self
590- . interrupt_handle
591- . is_cancel_requested_for_generation ( generation) ;
592+ let cancel_was_requested_manually =
593+ interrupt_handle_internal. is_cancel_requested_for_generation ( generation) ;
592594
593595 // Only clear cancel_requested if we're actually processing a cancellation for this generation
594596 if is_canceled && cancel_was_requested_manually {
595- self . interrupt_handle . clear_cancel_requested ( ) ;
597+ interrupt_handle_internal . clear_cancel_requested ( ) ;
596598 }
597599
598600 #[ cfg( gdb) ]
@@ -752,7 +754,7 @@ impl Hypervisor for HypervWindowsDriver {
752754 self . processor . set_sregs ( sregs)
753755 }
754756
755- fn interrupt_handle ( & self ) -> Arc < dyn InterruptHandle > {
757+ fn interrupt_handle ( & self ) -> Arc < dyn super :: InterruptHandleInternal > {
756758 self . interrupt_handle . clone ( )
757759 }
758760
@@ -1045,19 +1047,22 @@ impl InterruptHandle for WindowsInterruptHandle {
10451047 // Only call WHvCancelRunVirtualProcessor if VCPU is actually running in guest mode
10461048 running && unsafe { WHvCancelRunVirtualProcessor ( self . partition_handle , 0 , 0 ) . is_ok ( ) }
10471049 }
1050+
10481051 #[ cfg( gdb) ]
10491052 fn kill_from_debugger ( & self ) -> bool {
10501053 self . debug_interrupt . store ( true , Ordering :: Relaxed ) ;
10511054 let ( running, _) = self . get_running_and_generation ( ) ;
10521055 running && unsafe { WHvCancelRunVirtualProcessor ( self . partition_handle , 0 , 0 ) . is_ok ( ) }
10531056 }
10541057
1055- fn get_call_active ( & self ) -> & AtomicBool {
1056- & self . call_active
1058+ fn dropped ( & self ) -> bool {
1059+ self . dropped . load ( Ordering :: Relaxed )
10571060 }
1061+ }
10581062
1059- fn get_dropped ( & self ) -> & AtomicBool {
1060- & self . dropped
1063+ impl InterruptHandleInternal for WindowsInterruptHandle {
1064+ fn get_call_active ( & self ) -> & AtomicBool {
1065+ & self . call_active
10611066 }
10621067
10631068 fn get_running ( & self ) -> & AtomicU64 {
0 commit comments