@@ -562,9 +562,9 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
562562 VmcsGuestNW :: RIP . write ( linux. rip as _ ) ?;
563563 VmcsGuestNW :: RFLAGS . write ( 0x2 ) ?;
564564
565- VmcsGuest32 :: IA32_SYSENTER_CS . write ( Msr :: IA32_SYSENTER_CS . read ( ) as _ ) ?;
566- VmcsGuestNW :: IA32_SYSENTER_ESP . write ( Msr :: IA32_SYSENTER_ESP . read ( ) as _ ) ?;
567- VmcsGuestNW :: IA32_SYSENTER_EIP . write ( Msr :: IA32_SYSENTER_EIP . read ( ) as _ ) ?;
565+ VmcsGuest32 :: IA32_SYSENTER_CS . write ( linux . ia32_sysenter_cs as _ ) ?;
566+ VmcsGuestNW :: IA32_SYSENTER_ESP . write ( linux . ia32_sysenter_esp as _ ) ?;
567+ VmcsGuestNW :: IA32_SYSENTER_EIP . write ( linux . ia32_sysenter_eip as _ ) ?;
568568
569569 VmcsGuestNW :: DR7 . write ( 0x400 ) ?;
570570 VmcsGuest64 :: IA32_DEBUGCTL . write ( 0 ) ?;
@@ -787,13 +787,11 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
787787 linux. idt . base = VirtAddr :: new ( VmcsGuestNW :: IDTR_BASE . read ( ) . unwrap ( ) as _ ) ;
788788 linux. idt . limit = VmcsGuest32 :: IDTR_LIMIT . read ( ) . unwrap ( ) as _ ;
789789
790- linux. load_guest_regs ( self . regs ( ) ) ;
790+ linux. ia32_sysenter_cs = VmcsGuest32 :: IA32_SYSENTER_CS . read ( ) . unwrap ( ) as _ ; // 0x174
791+ linux. ia32_sysenter_esp = VmcsGuestNW :: IA32_SYSENTER_ESP . read ( ) . unwrap ( ) as _ ; // 0x178
792+ linux. ia32_sysenter_eip = VmcsGuestNW :: IA32_SYSENTER_EIP . read ( ) . unwrap ( ) as _ ; // 0x17a
791793
792- // unsafe {
793- // Msr::IA32_SYSENTER_CS.write(VmcsGuest32::IA32_SYSENTER_CS.read().unwrap() as _);
794- // Msr::IA32_SYSENTER_ESP.write(VmcsGuestNW::IA32_SYSENTER_ESP.read().unwrap() as _);
795- // Msr::IA32_SYSENTER_EIP.write(VmcsGuestNW::IA32_SYSENTER_EIP.read().unwrap() as _);
796- // }
794+ linux. load_guest_regs ( self . regs ( ) ) ;
797795 }
798796
799797 fn get_paging_level ( & self ) -> usize {
@@ -1296,10 +1294,9 @@ impl<H: AxVCpuHal> AxArchVCpu for VmxVcpu<H> {
12961294 Self :: new ( Some ( config) )
12971295 }
12981296
1299- fn load_host ( & self ) -> AxResult < Self :: HostConfig > {
1300- let mut linux = LinuxContext :: default ( ) ;
1301- self . load_vmcs_guest ( & mut linux) ;
1302- Ok ( linux)
1297+ fn load_host ( & self , config : & mut Self :: HostConfig ) -> AxResult {
1298+ self . load_vmcs_guest ( config) ;
1299+ Ok ( ( ) )
13031300 }
13041301
13051302 fn set_entry ( & mut self , entry : GuestPhysAddr ) -> AxResult {
0 commit comments