- Timestamp:
- Oct 7, 2020 8:09:22 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/hm_vmx.h
r86457 r86464 445 445 /** @} */ 446 446 447 /** @name VMX EPT paging structures 448 * @{ 449 */ 450 451 /** @name Common bits 447 /** @name VMX Extended Page Tables (EPT) Common Bits 452 448 * @{ */ 453 449 /** Bit 0 - Readable (we often think of it as present). */ … … 484 480 /** Bits 3-5 - Memory type: WB. */ 485 481 #define EPT_E_TYPE_WB (UINT64_C(6) << EPT_E_TYPE_SHIFT) 482 /** Bits 3-5 - Memory type: Invalid (7). */ 483 #define EPT_E_TYPE_INVALID_7 (UINT64_C(7) << EPT_E_TYPE_SHIFT) 486 484 487 485 /** Bit 6 - Ignore page attribute table (leaf, MBZ). */ … … 526 524 /** @} */ 527 525 526 527 /** @name VMX Extended Page Tables (EPT) Structures 528 * @{ 529 */ 530 528 531 /** 529 532 * Number of page table entries in the EPT. (PDPTE/PDE/PTE) … … 570 573 typedef union EPTPML4E 571 574 { 575 #ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS 572 576 /** Normal view. */ 573 577 EPTPML4EBITS n; 578 #endif 574 579 /** Unsigned integer view. */ 575 580 X86PGPAEUINT u; … … 635 640 typedef union EPTPDPTE 636 641 { 642 #ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS 637 643 /** Normal view. */ 638 644 EPTPDPTEBITS n; 645 #endif 639 646 /** Unsigned integer view. */ 640 647 X86PGPAEUINT u; … … 734 741 typedef union EPTPDE 735 742 { 743 #ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS 736 744 /** Normal view. */ 737 745 EPTPDEBITS n; 738 746 /** 2MB view (big). */ 739 747 EPTPDE2MBITS b; 748 #endif 740 749 /** Unsigned integer view. */ 741 750 X86PGPAEUINT u; … … 808 817 typedef union EPTPTE 809 818 { 819 #ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS 810 820 /** Normal view. */ 811 821 EPTPTEBITS n; 822 #endif 812 823 /** Unsigned integer view. */ 813 824 X86PGPAEUINT u; -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r86455 r86464 21 21 *********************************************************************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_PGM 23 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 23 24 #include <VBox/vmm/pgm.h> 24 25 #include <VBox/vmm/cpum.h> -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r86462 r86464 632 632 # endif 633 633 if ( !(uErr & X86_TRAP_PF_P) /* not set means page not present instead of page protection violation */ 634 && ! pPDDst->a[iPDDst].n.u1Present)634 && !SHW_PDE_IS_P(pPDDst->a[iPDDst])) 635 635 { 636 636 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2SyncPT; }); … … 1467 1467 LogFlow(("SyncHandlerPte: monitored page (%R[pgmpage]) -> mark read-only\n", pPage)); 1468 1468 # if PGM_SHW_TYPE == PGM_TYPE_EPT 1469 pPteDst->u = PGM_PAGE_GET_HCPHYS(pPage); 1470 pPteDst->n.u1Present = 1; 1471 pPteDst->n.u1Execute = 1; 1472 pPteDst->n.u1IgnorePAT = 1; 1473 pPteDst->n.u3EMT = VMX_EPT_MEMTYPE_WB; 1474 /* PteDst.n.u1Write = 0 && PteDst.n.u1Size = 0 */ 1469 pPteDst->u = PGM_PAGE_GET_HCPHYS(pPage) | EPT_E_READ | EPT_E_EXECUTE | EPT_E_TYPE_WB | EPT_E_IGNORE_PAT; 1475 1470 # else 1476 1471 if (fPteSrc & X86_PTE_A) … … 1496 1491 # if PGM_SHW_TYPE == PGM_TYPE_EPT 1497 1492 /* 25.2.3.1: Reserved physical address bit -> EPT Misconfiguration (exit 49) */ 1498 pPteDst->u = pVM->pgm.s.HCPhysInvMmioPg ;1493 pPteDst->u = pVM->pgm.s.HCPhysInvMmioPg 1499 1494 /* 25.2.3.1: bits 2:0 = 010b -> EPT Misconfiguration (exit 49) */ 1500 pPteDst->n.u1Present = 0; 1501 pPteDst->n.u1Write = 1; 1502 pPteDst->n.u1Execute = 0; 1495 | EPT_E_WRITE 1503 1496 /* 25.2.3.1: leaf && 2:0 != 0 && u3Emt in {2, 3, 7} -> EPT Misconfiguration */ 1504 pPteDst->n.u3EMT = 7;1497 | EPT_E_TYPE_INVALID_3; 1505 1498 # else 1506 1499 /* Set high page frame bits that MBZ (bankers on PAE, CPU dependent on AMD64). */ … … 1658 1651 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,DirtyPageSkipped)); 1659 1652 # if PGM_SHW_TYPE == PGM_TYPE_EPT 1660 PteDst.u = PGM_PAGE_GET_HCPHYS(pPage); 1661 PteDst.n.u1Present = 1; 1662 PteDst.n.u1Write = 1; 1663 PteDst.n.u1Execute = 1; 1664 PteDst.n.u1IgnorePAT = 1; 1665 PteDst.n.u3EMT = VMX_EPT_MEMTYPE_WB; 1666 /* PteDst.n.u1Size = 0 */ 1653 PteDst.u = PGM_PAGE_GET_HCPHYS(pPage) 1654 | EPT_E_READ | EPT_E_WRITE | EPT_E_EXECUTE | EPT_E_TYPE_WB | EPT_E_IGNORE_PAT; 1667 1655 # else 1668 1656 SHW_PTE_SET(PteDst, fGstShwPteFlags | PGM_PAGE_GET_HCPHYS(pPage)); … … 2128 2116 # endif 2129 2117 /* In the guest SMP case we could have blocked while another VCPU reused this page table. */ 2130 if (! PdeDst.n.u1Present)2118 if (!SHW_PDE_IS_P(PdeDst)) 2131 2119 { 2132 2120 AssertMsg(pVM->cCpus > 1, ("Unexpected missing PDE %RX64\n", (uint64_t)PdeDst.u)); … … 2136 2124 2137 2125 /* Can happen in the guest SMP case; other VCPU activated this PDE while we were blocking to handle the page fault. */ 2138 if ( PdeDst.n.u1Size)2126 if (SHW_PDE_IS_BIG(PdeDst)) 2139 2127 { 2140 2128 Assert(pVM->pgm.s.fNestedPaging); … … 2993 2981 Assert(!(PdeDst.u & PGM_PDFLAGS_MAPPING)); 2994 2982 # endif 2995 Assert(! PdeDst.n.u1Present); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/2983 Assert(!SHW_PDE_IS_P(PdeDst)); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/ 2996 2984 2997 2985 # if defined(PGM_WITH_LARGE_PAGES) && PGM_SHW_TYPE != PGM_TYPE_32BIT && PGM_SHW_TYPE != PGM_TYPE_PAE -
trunk/src/VBox/VMM/VMMAll/PGMAllShw.h
r86463 r86464 33 33 #undef SHW_PDE_ATOMIC_SET 34 34 #undef SHW_PDE_ATOMIC_SET2 35 #undef SHW_PDE_IS_P 35 36 #undef SHW_PDE_IS_BIG 36 37 #undef SHW_PTE_PG_MASK … … 70 71 # define SHW_PD_MASK X86_PD_MASK 71 72 # define SHW_TOTAL_PD_ENTRIES X86_PG_ENTRIES 73 # define SHW_PDE_IS_P(Pde) ( (Pde).n.u1Present ) 72 74 # define SHW_PDE_IS_BIG(Pde) ( (Pde).b.u1Size ) 73 75 # define SHW_PDE_ATOMIC_SET(Pde, uNew) do { ASMAtomicWriteU32(&(Pde).u, (uNew)); } while (0) … … 104 106 # define SHW_PD_SHIFT EPT_PD_SHIFT 105 107 # define SHW_PD_MASK EPT_PD_MASK 108 # define SHW_PDE_IS_P(Pde) ( (Pde).u & EPT_E_READ /* always set*/ ) 106 109 # define SHW_PDE_IS_BIG(Pde) ( (Pde).u & EPT_E_LEAF ) 107 110 # define SHW_PDE_ATOMIC_SET(Pde, uNew) do { ASMAtomicWriteU64(&(Pde).u, (uNew)); } while (0) … … 142 145 # define SHW_PD_SHIFT X86_PD_PAE_SHIFT 143 146 # define SHW_PD_MASK X86_PD_PAE_MASK 147 # define SHW_PDE_IS_P(Pde) ( (Pde).u & X86_PDE_P ) 144 148 # define SHW_PDE_IS_BIG(Pde) ( (Pde).u & X86_PDE_PS ) 145 149 # define SHW_PDE_ATOMIC_SET(Pde, uNew) do { ASMAtomicWriteU64(&(Pde).u, (uNew)); } while (0) … … 368 372 # error "Misconfigured PGM_SHW_TYPE or something..." 369 373 # endif 370 if (! Pde.n.u1Present)374 if (!SHW_PDE_IS_P(Pde)) 371 375 return VERR_PAGE_TABLE_NOT_PRESENT; 372 376 … … 545 549 X86PDE Pde = pgmShwGet32BitPDE(pVCpu, GCPtr); 546 550 # endif 547 if (! Pde.n.u1Present)551 if (!SHW_PDE_IS_P(Pde)) 548 552 return VERR_PAGE_TABLE_NOT_PRESENT; 549 553
Note:
See TracChangeset
for help on using the changeset viewer.