VirtualBox

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


Ignore:
Timestamp:
Mar 6, 2009 4:35:00 AM (16 years ago)
Author:
vboxsync
Message:

PGM: Some REM hacking for the ROM registration and some in-progress page sync hacking...

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

Legend:

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

    r17432 r17438  
    628628            else
    629629            {
    630                 /* When the guest accesses invalid physical memory (e.g. probing of RAM or accessing a remapped MMIO range), then we'll fall
     630                /*
     631                 * When the guest accesses invalid physical memory (e.g. probing
     632                 * of RAM or accessing a remapped MMIO range), then we'll fall
    631633                 * back to the recompiler to emulate the instruction.
    632634                 */
    633                 LogFlow(("pgmPhysGetPageEx %RGp failed with %Rrc\n", GCPhys, rc));
     635                LogFlow(("PGM #PF: pgmPhysGetPageEx(%RGp) failed with %Rrc\n", GCPhys, rc));
    634636                STAM_COUNTER_INC(&pVM->pgm.s.StatRZTrap0eHandlersInvalid);
    635637                STAM_PROFILE_STOP(&pVM->pgm.s.StatRZTrap0eTimeHandlers, b);
     
    641643#  ifdef PGM_OUT_OF_SYNC_IN_GC
    642644            /*
    643              * We are here only if page is present in Guest page tables and trap is not handled
    644              * by our handlers.
     645             * We are here only if page is present in Guest page tables and
     646             * trap is not handled by our handlers.
     647             *
    645648             * Check it for page out-of-sync situation.
    646649             */
     
    754757            else
    755758            {
     759#   ifdef VBOX_WITH_NEW_PHYS_CODE
     760                /*
     761                 * Need to deal with these buggers somewhere...
     762                 */
     763                if (    PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED
     764                    &&  (uErr & X86_TRAP_PF_RW))
     765                {
     766                    Log(("PGM #PF: %RGp %R[pgmpage] uErr=%#x\n", GCPhys, pPage, uErr));
     767                    AssertMsgFailed(("PGM #PF: %RGp %R[pgmpage] uErr=%#x\n", GCPhys, pPage, uErr));
     768                }
     769#   endif /* VBOX_WITH_NEW_PHYS_CODE */
     770
    756771                /*
    757772                 * A side effect of not flushing global PDEs are out of sync pages due
     
    14641479        if (RT_SUCCESS(rc))
    14651480        {
     1481#ifdef VBOX_WITH_NEW_PHYS_CODE
     1482            /* Try make the page writable if necessary. */
     1483            if (    PteSrc.n.u1Write
     1484                &&  PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED
     1485                &&  PGM_PAGE_GET_TYPE(pPage)  == PGMPAGETYPE_RAM)
     1486            {
     1487                rc = pgmPhysPageMakeWritableUnlocked(pVM, pPage, PteSrc.u & GST_PTE_PG_MASK);
     1488                AssertRC(rc);
     1489            }
     1490#endif
     1491
    14661492            /** @todo investiage PWT, PCD and PAT. */
    14671493            /*
     
    15371563            }
    15381564
     1565#ifdef VBOX_WITH_NEW_PHYS_CODE
     1566            /*
     1567             * Make sure only allocated pages are mapped writable.
     1568             */
     1569            if (    PteDst.n.u1Write
     1570                &&  PteDst.n.u1Present
     1571                &&  PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED)
     1572                PteDst.n.u1Write = 0;   /** @todo this isn't quite working yet. */
     1573#endif
     1574
    15391575#ifdef PGMPOOL_WITH_USER_TRACKING
    15401576            /*
     
    18221858                if (RT_SUCCESS(rc))
    18231859                {
     1860# ifdef VBOX_WITH_NEW_PHYS_CODE
     1861                    /* Try make the page writable if necessary. */
     1862                    if (    PdeSrc.n.u1Write
     1863                        &&  PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED
     1864                        &&  PGM_PAGE_GET_TYPE(pPage)  == PGMPAGETYPE_RAM)
     1865                    {
     1866                        rc = pgmPhysPageMakeWritableUnlocked(pVM, pPage, GCPhys);
     1867                        AssertRC(rc);
     1868                    }
     1869# endif
     1870
    18241871                    /*
    18251872                     * Make shadow PTE entry.
     
    18401887                        PGM_BTH_NAME(SyncPageWorkerTrackAddref)(pVM, pShwPage, PGM_PAGE_GET_TRACKING(pPage), pPage, iPTDst);
    18411888# endif
     1889# ifdef VBOX_WITH_NEW_PHYS_CODE
     1890                    /* Make sure only allocated pages are mapped writable. */
     1891                    if (    PteDst.n.u1Write
     1892                        &&  PteDst.n.u1Present
     1893                        &&  PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED)
     1894                        PteDst.n.u1Write = 0;   /** @todo this isn't quite working yet... */
     1895# endif
     1896
    18421897                    pPTDst->a[iPTDst] = PteDst;
    18431898
     
    26972752                        SHWPTE      PteDst;
    26982753
    2699 # ifndef VBOX_WITH_NEW_PHYS_CODE
     2754# ifdef VBOX_WITH_NEW_PHYS_CODE
     2755                        /* Try make the page writable if necessary. */
     2756                        if (    PteDstBase.n.u1Write
     2757                            &&  PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED
     2758                            &&  PGM_PAGE_GET_TYPE(pPage)  == PGMPAGETYPE_RAM)
     2759                        {
     2760                            rc = pgmPhysPageMakeWritableUnlocked(pVM, pPage, GCPhys);
     2761                            AssertRCReturn(rc, rc);
     2762                        }
     2763# else  /* !VBOX_WITH_NEW_PHYS_CODE */
    27002764                        /* Make sure the RAM has already been allocated. */
    27012765                        if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)  /** @todo PAGE FLAGS */
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r17435 r17438  
    462462            return pgmPhysAllocPage(pVM, pPage, GCPhys);
    463463    }
     464}
     465
     466
     467/**
     468 * Wrapper for pgmPhysPageMakeWritable which enters the critsect.
     469 *
     470 * @returns VBox status code.
     471 * @retval  VINF_SUCCESS on success.
     472 * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing.
     473 *
     474 * @param   pVM         The VM address.
     475 * @param   pPage       The physical page tracking structure.
     476 * @param   GCPhys      The address of the page.
     477 */
     478int pgmPhysPageMakeWritableUnlocked(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys)
     479{
     480    int rc = pgmLock(pVM);
     481    if (RT_SUCCESS(rc))
     482    {
     483        rc = pgmPhysPageMakeWritable(pVM, pPage, GCPhys);
     484        pgmUnlock(pVM);
     485    }
     486    return rc;
    464487}
    465488
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