Changeset 86453 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 5, 2020 5:42:00 PM (4 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r82968 r86453 1756 1756 pgmPoolCacheUsed(pPool, pShwPage); 1757 1757 } 1758 1758 1759 /* The PDPT was cached or created; hook it up now and fill with the default value. */ 1760 /** @todo r=bird: This is sub-optimal, gcc 10 generates a qword move of the address followed by 1761 * a byte write of the 0x7 flag value. These two writes should be combined, but for that 1762 * we need to add/find the EPT flag defines. */ 1763 /** @todo r=bird: use atomic writes here and maybe only update if really needed? */ 1759 1764 pPml4e->u = pShwPage->Core.Key; 1760 1765 pPml4e->n.u1Present = 1; -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r82968 r86453 1249 1249 GCPtrPage, (uint64_t)PdeSrc.u, (uint64_t)PdeDst.u, pShwPage->GCPhys, iPDDst)); 1250 1250 pgmPoolFree(pVM, PdeDst.u & SHW_PDE_PG_MASK, pShwPde->idx, iPDDst); 1251 ASMAtomicWriteSize(pPdeDst, 0);1251 SHW_PDE_ATOMIC_SET(*pPdeDst, 0); 1252 1252 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InvalidatePagePDOutOfSync)); 1253 1253 PGM_INVL_VCPU_TLBS(pVCpu); … … 1292 1292 GCPtrPage, (uint64_t)PdeSrc.u, (uint64_t)PdeDst.u)); 1293 1293 pgmPoolFree(pVM, PdeDst.u & SHW_PDE_PG_MASK, pShwPde->idx, iPDDst); 1294 ASMAtomicWriteSize(pPdeDst, 0);1294 SHW_PDE_ATOMIC_SET(*pPdeDst, 0); 1295 1295 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InvalidatePage4MBPages)); 1296 1296 PGM_INVL_BIG_PG(pVCpu, GCPtrPage); … … 1305 1305 { 1306 1306 pgmPoolFree(pVM, PdeDst.u & SHW_PDE_PG_MASK, pShwPde->idx, iPDDst); 1307 ASMAtomicWriteSize(pPdeDst, 0);1307 SHW_PDE_ATOMIC_SET(*pPdeDst, 0); 1308 1308 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InvalidatePagePDNPs)); 1309 1309 PGM_INVL_PG(pVCpu, GCPtrPage); … … 2038 2038 PdeDst.n.u1Write = PdeSrc.n.u1Write; 2039 2039 } 2040 ASMAtomicWriteSize(pPdeDst, PdeDst.u);2040 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 2041 2041 Log2(("SyncPage: BIG %RGv PdeSrc:{P=%d RW=%d U=%d raw=%08llx} GCPhys=%RGp%s\n", 2042 2042 GCPtrPage, PdeSrc.n.u1Present, PdeSrc.n.u1Write, PdeSrc.n.u1User, (uint64_t)PdeSrc.u, GCPhys, … … 2074 2074 */ 2075 2075 pgmPoolFreeByPage(pPool, pShwPage, pShwPde->idx, iPDDst); 2076 ASMAtomicWriteSize(pPdeDst, 0);2076 SHW_PDE_ATOMIC_SET(*pPdeDst, 0); 2077 2077 2078 2078 PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdeDst); … … 2316 2316 PdeDst.n.u1Accessed = 1; 2317 2317 PdeDst.au32[0] &= ~PGM_PDFLAGS_TRACK_DIRTY; 2318 ASMAtomicWriteSize(pPdeDst, PdeDst.u);2318 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 2319 2319 PGM_INVL_BIG_PG(pVCpu, GCPtrPage); 2320 2320 return VINF_PGM_HANDLED_DIRTY_BIT_FAULT; /* restarts the instruction. */ … … 2648 2648 } 2649 2649 } 2650 ASMAtomicWriteSize(pPdeDst, PdeDst.u);2650 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 2651 2651 PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdeDst); 2652 2652 return VINF_SUCCESS; … … 2690 2690 PdeDst.u = (PdeDst.u & (SHW_PDE_PG_MASK | X86_PDE_AVL_MASK)) 2691 2691 | GST_GET_PDE_SHW_FLAGS(pVCpu, PdeSrc); 2692 ASMAtomicWriteSize(pPdeDst, PdeDst.u);2692 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 2693 2693 PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdeDst); 2694 2694 … … 2786 2786 PdeDst.b.u1Write = 0; 2787 2787 } 2788 ASMAtomicWriteSize(pPdeDst, PdeDst.u);2788 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 2789 2789 PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdeDst); 2790 2790 … … 2978 2978 2979 2979 /* Fetch the pgm pool shadow descriptor. */ 2980 /** @todo r=bird: didn't pgmShwGetEPTPDPtr just do this lookup already? */ 2980 2981 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & EPT_PDPTE_PG_MASK); 2981 2982 Assert(pShwPde); … … 3039 3040 { 3040 3041 PdeDst.u &= X86_PDE_AVL_MASK; 3041 PdeDst.u |= HCPhys;3042 3042 PdeDst.n.u1Present = 1; 3043 3043 PdeDst.n.u1Write = 1; … … 3050 3050 PdeDst.n.u1User = 1; 3051 3051 # endif 3052 ASMAtomicWriteSize(pPdeDst, PdeDst.u); 3052 PdeDst.u |= HCPhys; /* Note! Must be done last of gcc v10.2.1 20200723 (Red Hat 10.2.1-1) may drop the top 32 bits. */ 3053 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 3053 3054 3054 3055 Log(("SyncPT: Use large page at %RGp PDE=%RX64\n", GCPtrPage, PdeDst.u)); … … 3112 3113 /* Save the new PDE. */ 3113 3114 PdeDst.u &= X86_PDE_AVL_MASK; 3114 PdeDst.u |= pShwPage->Core.Key;3115 3115 PdeDst.n.u1Present = 1; 3116 3116 PdeDst.n.u1Write = 1; … … 3121 3121 PdeDst.n.u1Accessed = 1; 3122 3122 # endif 3123 ASMAtomicWriteSize(pPdeDst, PdeDst.u); 3123 PdeDst.u |= pShwPage->Core.Key; /* Note! Must be done last of gcc v10.2.1 20200723 (Red Hat 10.2.1-1) drops the top 32 bits. */ 3124 /** @todo r=bird: Stop using bitfields. But we need to defined/find the EPT flags then. */ 3125 SHW_PDE_ATOMIC_SET2(*pPdeDst, PdeDst); 3124 3126 3125 3127 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,SyncPT), a); -
trunk/src/VBox/VMM/VMMAll/PGMAllShw.h
r82968 r86453 31 31 #undef SHW_PD_SHIFT 32 32 #undef SHW_PD_MASK 33 #undef SHW_PDE_ATOMIC_SET 34 #undef SHW_PDE_ATOMIC_SET2 33 35 #undef SHW_PTE_PG_MASK 34 36 #undef SHW_PTE_IS_P … … 67 69 # define SHW_PD_MASK X86_PD_MASK 68 70 # define SHW_TOTAL_PD_ENTRIES X86_PG_ENTRIES 71 # define SHW_PDE_ATOMIC_SET(Pde, uNew) do { ASMAtomicWriteU32(&(Pde).u, (uNew)); } while (0) 72 # define SHW_PDE_ATOMIC_SET2(Pde, Pde2) do { ASMAtomicWriteU32(&(Pde).u, (Pde2).u); } while (0) 69 73 # define SHW_PTE_PG_MASK X86_PTE_PG_MASK 70 74 # define SHW_PTE_IS_P(Pte) ( (Pte).n.u1Present ) … … 98 102 # define SHW_PD_SHIFT EPT_PD_SHIFT 99 103 # define SHW_PD_MASK EPT_PD_MASK 104 # define SHW_PDE_ATOMIC_SET(Pde, uNew) do { ASMAtomicWriteU64(&(Pde).u, (uNew)); } while (0) 105 # define SHW_PDE_ATOMIC_SET2(Pde, Pde2) do { ASMAtomicWriteU64(&(Pde).u, (Pde2).u); } while (0) 100 106 # define SHW_PTE_PG_MASK EPT_PTE_PG_MASK 101 107 # define SHW_PTE_IS_P(Pte) ( (Pte).n.u1Present ) /* Approximation, works for us. */ … … 133 139 # define SHW_PD_SHIFT X86_PD_PAE_SHIFT 134 140 # define SHW_PD_MASK X86_PD_PAE_MASK 141 # define SHW_PDE_ATOMIC_SET(Pde, uNew) do { ASMAtomicWriteU64(&(Pde).u, (uNew)); } while (0) 142 # define SHW_PDE_ATOMIC_SET2(Pde, Pde2) do { ASMAtomicWriteU64(&(Pde).u, (Pde2).u); } while (0) 135 143 # define SHW_PTE_PG_MASK X86_PTE_PAE_PG_MASK 136 144 # define SHW_PTE_IS_P(Pte) PGMSHWPTEPAE_IS_P(Pte)
Note:
See TracChangeset
for help on using the changeset viewer.