VirtualBox

Changeset 760 in vbox


Ignore:
Timestamp:
Feb 7, 2007 6:29:33 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18421
Message:

Enhanced detection of changed pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PATM/CSAM.cpp

    r758 r760  
    7272
    7373bool                csamIsCodeScanned(PVM pVM, RTGCPTR pInstr, PCSAMPAGE *pPage);
    74 int                 csamR3FlushPageRecord(PVM pVM, PCSAMPAGE pPage);
    7574int                 csamR3CheckPageRecord(PVM pVM, RTGCPTR pInstr);
    7675static PCSAMPAGE    csamCreatePageRecord(PVM pVM, RTGCPTR GCPtr, CSAMTAG enmTag, bool fCode32, bool fMonitorInvalidation = false);
     
    13881387
    13891388/**
    1390  * Flush a page record
    1391  *
    1392  * @returns VBox status code. (trap handled or not)
    1393  * @param   pVM         The VM to operate on.
    1394  * @param   pPage       Page record ptr
    1395  */
    1396 int csamR3FlushPageRecord(PVM pVM, PCSAMPAGE pPage)
    1397 {
    1398     RTGCPHYS oldPhys = pPage->GCPhys;
    1399     Log(("csamR3FlushPageRecord: page %VGv has changed -> FLUSH\n", pPage->pPageGC));
    1400 
    1401     int rc = PGMGstGetPage(pVM, pPage->pPageGC, &pPage->fFlags, &pPage->GCPhys);
    1402     AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("rc = %Vrc\n", rc));
    1403 
    1404     Log(("Old GCPhys %VGp new %VGp\n", oldPhys, pPage->GCPhys));
    1405     if (pPage->pBitmap == NULL)
    1406     {
    1407         pPage->pBitmap = (uint8_t *)MMR3HeapAllocZ(pVM, MM_TAG_CSAM_PATCH, CSAM_PAGE_BITMAP_SIZE);
    1408         Assert(pPage->pBitmap);
    1409         if (pPage->pBitmap == NULL)
    1410         {
    1411             return VERR_NO_MEMORY;
    1412         }
    1413     }
    1414     else
    1415     {
    1416         memset(pPage->pBitmap, 0, CSAM_PAGE_BITMAP_SIZE);
    1417     }
    1418     pPage->u64Hash  = csamR3CalcPageHash(pVM, pPage->pPageGC);
    1419 
    1420     return VINF_SUCCESS;
    1421 }
    1422 
    1423 /**
    14241389 * Notify CSAM of a page flush
    14251390 *
     
    15011466            if (rc == VINF_SUCCESS)
    15021467                pPageRec->page.u64Hash = csamR3CalcPageHash(pVM, addr);
     1468
     1469            if (pPageRec->page.pBitmap == NULL)
     1470            {
     1471                pPageRec->page.pBitmap = (uint8_t *)MMR3HeapAllocZ(pVM, MM_TAG_CSAM_PATCH, CSAM_PAGE_BITMAP_SIZE);
     1472                Assert(pPageRec->page.pBitmap);
     1473                if (pPageRec->page.pBitmap == NULL)
     1474                    return VERR_NO_MEMORY;
     1475            }
     1476            else
     1477                memset(pPageRec->page.pBitmap, 0, CSAM_PAGE_BITMAP_SIZE);
    15031478        }
    15041479
     
    15501525        u64hash = csamR3CalcPageHash(pVM, pInstrGC);
    15511526        if (u64hash != pPageRec->page.u64Hash)
    1552         {
    1553             csamR3FlushPageRecord(pVM, &pPageRec->page);
    1554         }
     1527            csamFlushPage(pVM, pInstrGC, false /* don't remove page record */);
    15551528    }
    15561529    else
    1557     {
    15581530        return VWRN_CSAM_PAGE_NOT_FOUND;
    1559     }
     1531
    15601532    return VINF_SUCCESS;
    15611533}
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