VirtualBox

Changeset 13150 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Oct 9, 2008 11:09:47 PM (16 years ago)
Author:
vboxsync
Message:

#1865: Enabled the new PGMPhysSimpleDirtyWriteGCPtr code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r13149 r13150  
    21682168VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVM pVM, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb)
    21692169{
    2170 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) || defined(VBOX_WITH_NEW_PHYS_CODE)
    21712170    /*
    21722171     * Treat the first page as a special case.
     
    22292228    }
    22302229    /* won't ever get here. */
    2231 
    2232 # else  /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE */
    2233 
    2234     /*
    2235      * Anything to do?
    2236      */
    2237     if (!cb)
    2238         return VINF_SUCCESS;
    2239 
    2240     /*
    2241      * Optimize writes within a single page.
    2242      */
    2243     if (((RTGCUINTPTR)GCPtrDst & PAGE_OFFSET_MASK) + cb <= PAGE_SIZE)
    2244     {
    2245         void *pvDst;
    2246         int rc = PGMPhysGCPtr2HCPtr(pVM, GCPtrDst, &pvDst);
    2247         if (VBOX_FAILURE(rc))
    2248             return rc;
    2249         memcpy(pvDst, pvSrc, cb);
    2250         rc = PGMGstModifyPage(pVM, GCPtrDst, cb, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D));
    2251         AssertRC(rc);
    2252         return VINF_SUCCESS;
    2253     }
    2254 
    2255     /*
    2256      * Page by page.
    2257      */
    2258     for (;;)
    2259     {
    2260         /* convert */
    2261         void *pvDst;
    2262         int rc = PGMPhysGCPtr2HCPtr(pVM, GCPtrDst, &pvDst);
    2263         if (VBOX_FAILURE(rc))
    2264             return rc;
    2265 
    2266         /* mark the guest page as accessed and dirty. */
    2267         rc = PGMGstModifyPage(pVM, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D));
    2268         AssertRC(rc);
    2269 
    2270         /* copy */
    2271         size_t  cbWrite = PAGE_SIZE - ((RTGCUINTPTR)GCPtrDst & PAGE_OFFSET_MASK);
    2272         if (cbWrite >= cb)
    2273         {
    2274             memcpy(pvDst, pvSrc, cb);
    2275             return VINF_SUCCESS;
    2276         }
    2277         memcpy(pvDst, pvSrc, cbWrite);
    2278 
    2279         /* next */
    2280         cb         -= cbWrite;
    2281         GCPtrDst   += cbWrite;
    2282         pvSrc       = (char *)pvSrc + cbWrite;
    2283     }
    2284 # endif /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE */
    22852230}
    22862231
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