@@ -24,7 +24,7 @@ use super::VmxExitInfo;
24
24
use super :: as_axerr;
25
25
use super :: definitions:: VmxExitReason ;
26
26
use super :: read_vmcs_revision_id;
27
- use super :: structs:: { EPTP_LIST_SIZE , EPTPointer , EptpList , IOBitmap , MsrBitmap , VmxRegion } ;
27
+ use super :: structs:: { EptpList , IOBitmap , MsrBitmap , VmxRegion } ;
28
28
use super :: vmcs:: {
29
29
self , VmcsControl32 , VmcsControl64 , VmcsControlNW , VmcsGuest16 , VmcsGuest32 , VmcsGuest64 ,
30
30
VmcsGuestNW , VmcsHost16 , VmcsHost32 , VmcsHost64 , VmcsHostNW , interrupt_exit_info,
@@ -755,11 +755,6 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
755
755
// Bit 0: EPTP switching
756
756
VmcsControl64 :: VM_FUNCTION_CONTROLS . write ( 0b1 ) ?;
757
757
758
- assert ! (
759
- self . eptp_list. entry_is_set( 0 ) ,
760
- "The First EPTP list entry must be set as initial EPTP."
761
- ) ;
762
-
763
758
VmcsControl64 :: EPTP_LIST_ADDR . write ( self . eptp_list . phys_addr ( ) . as_usize ( ) as _ ) ?;
764
759
765
760
// Pass-through exceptions (except #UD(6)), don't use I/O bitmap, set MSR bitmaps.
@@ -1369,7 +1364,6 @@ impl<H: AxVCpuHal> AxArchVCpu for VmxVcpu<H> {
1369
1364
1370
1365
fn set_ept_root ( & mut self , ept_root : HostPhysAddr ) -> AxResult {
1371
1366
self . ept_root = Some ( ept_root) ;
1372
- self . append_eptp_list ( 0 , ept_root) ?;
1373
1367
Ok ( ( ) )
1374
1368
}
1375
1369
@@ -1383,10 +1377,6 @@ impl<H: AxVCpuHal> AxArchVCpu for VmxVcpu<H> {
1383
1377
}
1384
1378
1385
1379
fn run ( & mut self ) -> AxResult < AxVCpuExitReason > {
1386
- if self . id == 3 {
1387
- warn ! ( "Instance vcpu run {:#x?}" , self ) ;
1388
- }
1389
-
1390
1380
match self . inner_run ( ) {
1391
1381
Some ( exit_info) => Ok ( if exit_info. entry_failure {
1392
1382
match exit_info. exit_reason {
@@ -1399,6 +1389,7 @@ impl<H: AxVCpuHal> AxArchVCpu for VmxVcpu<H> {
1399
1389
} ;
1400
1390
1401
1391
warn ! ( "VMX entry failure: {:#x?}" , exit_info) ;
1392
+ warn ! ( "VCpu {:#x?}" , self ) ;
1402
1393
1403
1394
AxVCpuExitReason :: FailEntry {
1404
1395
// Todo: get `hardware_entry_failure_reason` somehow.
@@ -1576,44 +1567,11 @@ impl<H: AxVCpuHal> AxVcpuAccessGuestState for VmxVcpu<H> {
1576
1567
self . guest_page_table_query ( gva) . ok ( )
1577
1568
}
1578
1569
1579
- fn append_eptp_list ( & mut self , idx : usize , eptp : HostPhysAddr ) -> AxResult {
1580
- if idx >= EPTP_LIST_SIZE {
1581
- return ax_err ! ( InvalidInput ) ;
1582
- }
1583
-
1584
- if self . eptp_list . entry_is_set ( idx) {
1585
- return ax_err ! ( InvalidInput ) ;
1586
- }
1587
-
1588
- self . eptp_list
1589
- . set_entry ( idx, EPTPointer :: from_table_phys ( eptp) ) ;
1590
- Ok ( ( ) )
1570
+ fn current_ept_root ( & self ) -> HostPhysAddr {
1571
+ vmcs:: get_ept_pointer ( )
1591
1572
}
1592
1573
1593
- fn remove_eptp_list_entry ( & mut self , idx : usize ) -> AxResult {
1594
- if idx >= EPTP_LIST_SIZE {
1595
- return ax_err ! ( InvalidInput ) ;
1596
- }
1597
- if !self . eptp_list . entry_is_set ( idx) {
1598
- return ax_err ! ( InvalidInput ) ;
1599
- }
1600
-
1601
- self . eptp_list . remove_entry ( idx) ;
1602
-
1603
- Ok ( ( ) )
1604
- }
1605
-
1606
- fn get_eptp_list_entry ( & self , idx : usize ) -> AxResult < HostPhysAddr > {
1607
- if idx >= EPTP_LIST_SIZE {
1608
- return ax_err ! ( InvalidInput ) ;
1609
- }
1610
- if !self . eptp_list . entry_is_set ( idx) {
1611
- return ax_err ! ( InvalidInput ) ;
1612
- }
1613
- let entry = self . eptp_list . get_entry ( idx) ;
1614
-
1615
- Ok ( HostPhysAddr :: from_usize ( memory_addr:: align_down_4k (
1616
- entry. bits ( ) as _ ,
1617
- ) ) )
1574
+ fn eptp_list_region ( & self ) -> HostPhysAddr {
1575
+ self . eptp_list . phys_addr ( )
1618
1576
}
1619
1577
}
0 commit comments