VirtualBox

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


Ignore:
Timestamp:
Jun 22, 2009 12:15:30 PM (16 years ago)
Author:
vboxsync
Message:

Unsafe physical hander usage.

File:
1 edited

Legend:

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

    r20674 r20768  
    14251425        rc = pPhys->CTX_SUFF(pfnHandler)(pVM, GCPhys, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, pPhys->CTX_SUFF(pvUser));
    14261426        pgmLock(pVM);
    1427         STAM_PROFILE_STOP(&pPhys->Stat, h);
     1427# ifdef VBOX_WITH_STATISTICS
     1428        pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1429        if (pPhys)
     1430            STAM_PROFILE_STOP(&pPhys->Stat, h);
     1431# else
     1432        pPhys = NULL; /* might not be valid anymore. */
     1433# endif
    14281434        AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp\n", rc, GCPhys));
    14291435#else
     
    14521458        {
    14531459            if (!pPhys)
    1454                 Log5(("pgmPhysWriteHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] virt %s\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc) ));
     1460                Log5(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] virt %s\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc) ));
    14551461            else
    1456                 Log(("pgmPhysWriteHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] phys/virt %s/%s\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc), R3STRING(pPhys->pszDesc) ));
     1462                Log(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] phys/virt %s/%s\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc), R3STRING(pPhys->pszDesc) ));
    14571463            RTGCUINTPTR GCPtr = ((RTGCUINTPTR)pVirt->Core.Key & PAGE_BASE_GC_MASK)
    14581464                              + (iPage << PAGE_SHIFT)
     
    14671473        }
    14681474        else
    1469             Log5(("pgmPhysWriteHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] virt %s [no handler]\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc) ));
     1475            Log5(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] virt %s [no handler]\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc) ));
    14701476#else
    14711477        /* In R0 and RC the callbacks cannot handle this context, so we'll fail. */
     
    16581664                rc = pCur->CTX_SUFF(pfnHandler)(pVM, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, pCur->CTX_SUFF(pvUser));
    16591665                pgmLock(pVM);
    1660                 STAM_PROFILE_STOP(&pCur->Stat, h);
     1666# ifdef VBOX_WITH_STATISTICS
     1667                pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1668                if (pCur)
     1669                    STAM_PROFILE_STOP(&pCur->Stat, h);
     1670# else
     1671                pCur = NULL; /* might not be valid anymore. */
     1672# endif
    16611673                if (rc == VINF_PGM_HANDLER_DO_DEFAULT)
    16621674                    memcpy(pvDst, pvBuf, cbRange);
    16631675                else
    1664                     AssertLogRelMsg(rc == VINF_SUCCESS, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, pCur->pszDesc));
     1676                    AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, (pCur) ? pCur->pszDesc : ""));
    16651677            }
    16661678            else
     
    18611873            rc = pPhys->CTX_SUFF(pfnHandler)(pVM, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, pPhys->CTX_SUFF(pvUser));
    18621874            pgmLock(pVM);
    1863             STAM_PROFILE_STOP(&pPhys->Stat, h);
    1864             AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, pPhys->pszDesc));
    1865             pPhys = NULL;
     1875# ifdef VBOX_WITH_STATISTICS
     1876            pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1877            if (pPhys)
     1878                STAM_PROFILE_STOP(&pPhys->Stat, h);
     1879# else
     1880            pPhys = NULL; /* might not be valid anymore. */
     1881# endif
     1882            AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, (pPhys) ? pPhys->pszDesc : ""));
    18661883#else
    18671884            /* In R0 and RC the callbacks cannot handle this context, so we'll fail. */
     
    19221939            rc = pPhys->CTX_SUFF(pfnHandler)(pVM, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, pPhys->CTX_SUFF(pvUser));
    19231940            pgmLock(pVM);
    1924             STAM_PROFILE_STOP(&pPhys->Stat, h);
    1925             AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, pPhys->pszDesc));
     1941# ifdef VBOX_WITH_STATISTICS
     1942            pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1943            if (pPhys)
     1944                STAM_PROFILE_STOP(&pPhys->Stat, h);
     1945# else
     1946            pPhys = NULL; /* might not be valid anymore. */
     1947# endif
     1948            AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, (pPhys) ? pPhys->pszDesc : ""));
    19261949            if (pVirt->pfnHandlerR3)
    19271950            {
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