VirtualBox

Changeset 23283 in vbox


Ignore:
Timestamp:
Sep 24, 2009 1:05:02 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52771
Message:

Use atomic operations to update page table entries.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r23254 r23283  
    22392239                if (pPdeDst->u & PGM_PDFLAGS_TRACK_DIRTY)
    22402240                {
     2241                    SHWPDE PdeDst = *pPdeDst;
     2242
    22412243                    STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyPageTrap));
    2242                     Assert(pPdeSrc->b.u1Write);
     2244                    Assert(PdeDst.b.u1Write);
    22432245
    22442246                    /* Note: No need to invalidate this entry on other VCPUs as a stale TLB entry will not harm; write access will simply
    22452247                     *       fault again and take this path to only invalidate the entry.
    22462248                     */
    2247                     pPdeDst->n.u1Write      = 1;
    2248                     pPdeDst->n.u1Accessed   = 1;
    2249                     pPdeDst->au32[0]       &= ~PGM_PDFLAGS_TRACK_DIRTY;
     2249                    PdeDst.n.u1Write      = 1;
     2250                    PdeDst.n.u1Accessed   = 1;
     2251                    PdeDst.au32[0]       &= ~PGM_PDFLAGS_TRACK_DIRTY;
     2252                    ASMAtomicWriteSize(pPdeDst, PdeDst.u);
    22502253                    PGM_INVL_BIG_PG(pVCpu, GCPtrPage);
    22512254                    STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a);
     
    23692372                        if (pPteDst->u & PGM_PTFLAGS_TRACK_DIRTY)
    23702373                        {
    2371                             PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, pPteSrc->u & GST_PTE_PG_MASK);
     2374                            PPGMPAGE pPage  = pgmPhysGetPage(&pVM->pgm.s, pPteSrc->u & GST_PTE_PG_MASK);
     2375                            SHWPTE   PteDst = *pPteDst;
    23722376
    23732377                            LogFlow(("DIRTY page trap addr=%RGv\n", GCPtrPage));
    23742378                            STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyPageTrap));
    23752379
    2376                             Assert(pPteSrc->n.u1Write);
     2380                            Assert(PteDst.n.u1Write);
    23772381
    23782382                            /* Note: No need to invalidate this entry on other VCPUs as a stale TLB entry will not harm; write access will simply
     
    23832387                            {
    23842388                                /* Assuming write handlers here as the PTE is present (otherwise we wouldn't be here). */
    2385                                 pPteDst->n.u1Write    = 0;
     2389                                PteDst.n.u1Write    = 0;
    23862390                            }
    23872391                            else
    2388                                 pPteDst->n.u1Write    = 1;
    2389 
    2390                             pPteDst->n.u1Dirty    = 1;
    2391                             pPteDst->n.u1Accessed = 1;
    2392                             pPteDst->au32[0]     &= ~PGM_PTFLAGS_TRACK_DIRTY;
     2392                                PteDst.n.u1Write    = 1;
     2393
     2394                            PteDst.n.u1Dirty    = 1;
     2395                            PteDst.n.u1Accessed = 1;
     2396                            PteDst.au32[0]     &= ~PGM_PTFLAGS_TRACK_DIRTY;
     2397                            ASMAtomicWriteSize(pPteDst, PteDst.u);
    23932398                            PGM_INVL_PG(pVCpu, GCPtrPage);
    23942399
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r23250 r23283  
    31953195                if ((pPT->a[i].u & (X86_PTE_PG_MASK | X86_PTE_P)) == u32)
    31963196                {
     3197                    X86PTE Pte;
     3198
    31973199                    Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pte=%RX32 cRefs=%#x\n", i, pPT->a[i], cRefs));
    3198                     pPT->a[i].u = (pPT->a[i].u & u32AndMask) | u32OrMask;
    3199                     if (pPT->a[i].u & PGM_PTFLAGS_TRACK_DIRTY)
    3200                         pPT->a[i].n.u1Write = 0;    /* need to disallow writes when dirty bit tracking is still active. */
    3201 
     3200                    Pte.u = (pPT->a[i].u & u32AndMask) | u32OrMask;
     3201                    if (Pte.u & PGM_PTFLAGS_TRACK_DIRTY)
     3202                        Pte.n.u1Write = 0;    /* need to disallow writes when dirty bit tracking is still active. */
     3203
     3204                    ASMAtomicWriteSize(&pPT->a[i].u, Pte.u);
    32023205                    cRefs--;
    32033206                    if (!cRefs)
     
    32583261                if ((pPT->a[i].u & (X86_PTE_PAE_PG_MASK | X86_PTE_P)) == u64)
    32593262                {
     3263                    X86PTEPAE Pte;
     3264
    32603265                    Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pte=%RX64 cRefs=%#x\n", i, pPT->a[i], cRefs));
    3261                     pPT->a[i].u = (pPT->a[i].u & u64AndMask) | u64OrMask;
    3262                     if (pPT->a[i].u & PGM_PTFLAGS_TRACK_DIRTY)
    3263                         pPT->a[i].n.u1Write = 0;    /* need to disallow writes when dirty bit tracking is still active. */
    3264 
     3266                    Pte.u = (pPT->a[i].u & u64AndMask) | u64OrMask;
     3267                    if (Pte.u & PGM_PTFLAGS_TRACK_DIRTY)
     3268                        Pte.n.u1Write = 0;    /* need to disallow writes when dirty bit tracking is still active. */
     3269
     3270                    ASMAtomicWriteSize(&pPT->a[i].u, Pte.u);
    32653271                    cRefs--;
    32663272                    if (!cRefs)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette