@@ -30,13 +30,6 @@ use std::collections::HashMap;
3030use std:: fmt:: Debug ;
3131use std:: sync:: LazyLock ;
3232
33- #[ cfg( gdb) ]
34- use super :: handlers:: DbgMemAccessHandlerCaller ;
35- use super :: regs:: { CommonFpu , CommonRegisters , CommonSpecialRegisters } ;
36- use super :: vm:: Vm ;
37- use super :: HyperlightExit ;
38- use crate :: mem:: memory_region:: { MemoryRegion , MemoryRegionFlags } ;
39- use crate :: { log_then_return, new_error, Result } ;
4033#[ cfg( mshv2) ]
4134use mshv_bindings:: hv_message;
4235#[ cfg( gdb) ]
@@ -45,17 +38,25 @@ use mshv_bindings::hv_message_type_HVMSG_X64_EXCEPTION_INTERCEPT;
4538use mshv_bindings:: DebugRegisters ;
4639use mshv_bindings:: {
4740 hv_message_type, hv_message_type_HVMSG_GPA_INTERCEPT, hv_message_type_HVMSG_UNMAPPED_GPA,
48- hv_message_type_HVMSG_X64_HALT, hv_message_type_HVMSG_X64_IO_PORT_INTERCEPT,
41+ hv_message_type_HVMSG_X64_HALT, hv_message_type_HVMSG_X64_IO_PORT_INTERCEPT, hv_register_assoc,
42+ hv_register_name_HV_X64_REGISTER_RIP, hv_register_value,
4943} ;
5044#[ cfg( mshv3) ]
5145use mshv_bindings:: {
5246 hv_partition_property_code_HV_PARTITION_PROPERTY_SYNTHETIC_PROC_FEATURES,
5347 hv_partition_synthetic_processor_features,
5448} ;
55- use mshv_bindings:: { hv_register_assoc, hv_register_name_HV_X64_REGISTER_RIP, hv_register_value} ;
5649use mshv_ioctls:: { Mshv , VcpuFd , VmFd } ;
5750use tracing:: { instrument, Span } ;
5851
52+ #[ cfg( gdb) ]
53+ use super :: handlers:: DbgMemAccessHandlerCaller ;
54+ use super :: regs:: { CommonFpu , CommonRegisters , CommonSpecialRegisters } ;
55+ use super :: vm:: Vm ;
56+ use super :: HyperlightExit ;
57+ use crate :: mem:: memory_region:: { MemoryRegion , MemoryRegionFlags } ;
58+ use crate :: { log_then_return, new_error, Result } ;
59+
5960/// Determine whether the HyperV for Linux hypervisor API is present
6061/// and functional.
6162#[ instrument( skip_all, parent = Span :: current( ) , level = "Trace" ) ]
@@ -263,9 +264,10 @@ impl Vm for MshvVm {
263264
264265 #[ cfg( gdb) ]
265266 fn translate_gva ( & self , gva : u64 ) -> Result < u64 > {
266- use crate :: HyperlightError ;
267267 use mshv_bindings:: { HV_TRANSLATE_GVA_VALIDATE_READ , HV_TRANSLATE_GVA_VALIDATE_WRITE } ;
268268
269+ use crate :: HyperlightError ;
270+
269271 let flags = ( HV_TRANSLATE_GVA_VALIDATE_READ | HV_TRANSLATE_GVA_VALIDATE_WRITE ) as u64 ;
270272 let ( addr, _) = self
271273 . vcpu_fd
@@ -386,9 +388,8 @@ impl Vm for MshvVm {
386388 addr : u64 ,
387389 dbg_mem_access_fn : std:: sync:: Arc < std:: sync:: Mutex < dyn DbgMemAccessHandlerCaller > > ,
388390 ) -> Result < ( ) > {
389- use crate :: hypervisor:: gdb:: arch:: SW_BP ;
390-
391391 use super :: gdb:: arch:: SW_BP_SIZE ;
392+ use crate :: hypervisor:: gdb:: arch:: SW_BP ;
392393
393394 let mut save_data = [ 0 ; SW_BP_SIZE ] ;
394395 let mut mem = dbg_mem_access_fn. lock ( ) . unwrap ( ) ;
0 commit comments