VirtualBox

Changeset 14517 in vbox


Ignore:
Timestamp:
Nov 24, 2008 1:41:39 PM (16 years ago)
Author:
vboxsync
Message:

PGMR0DynMap: fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp

    r14504 r14517  
    215215VMMR0DECL(int) PGMR0DynMapInit(void)
    216216{
    217 #ifndef DEBUG_bird
    218     return VINF_SUCCESS;
    219 #else
    220217    Assert(!g_pPGMR0DynMap);
    221218
     
    264261    RTMemFree(pThis);
    265262    return rc;
    266 #endif
    267263}
    268264
     
    273269VMMR0DECL(void) PGMR0DynMapTerm(void)
    274270{
    275 #ifdef DEBUG_bird
    276271    /*
    277272     * Destroy the cache.
     
    302297        RTMemFree(pThis);
    303298    }
    304 #endif
    305299}
    306300
     
    453447    /* cCpus * PGMR0DYNMAP_PAGES_PER_CPU (/2). */
    454448    RTCPUID     cCpus     = RTMpGetCount();
     449    AssertReturn(cCpus > 0 && cCpus <= RTCPUSET_MAX_CPUS, 0);
    455450    uint32_t    cPages    = cCpus * PGMR0DYNMAP_PAGES_PER_CPU;
    456451    uint32_t    cMinPages = cCpus * (PGMR0DYNMAP_PAGES_PER_CPU / 2);
     
    461456        pThis->cMaxLoad = 0;
    462457
    463     while (pThis->cMaxLoad < PGMR0DYNMAP_CALC_OVERLOAD(cPages))
     458    while (pThis->cMaxLoad > PGMR0DYNMAP_CALC_OVERLOAD(cPages))
    464459        cPages += PGMR0DYNMAP_PAGES_PER_CPU;
    465460
     
    478473        cMinPages = PGMR0DYNMAP_MAX_PAGES;
    479474
     475    Assert(cMinPages);
    480476    *pcMinPages = cMinPages;
    481477    return cPages;
     
    627623            if (RT_SUCCESS(rc))
    628624            {
    629                 rc = RTR0MemObjMapKernel(&pPgLvl->a[i].hMapObj, pPgLvl->a[i].hMemObj, &pPgLvl->a[i].u.pv, 0 /* cbAlignment */,
     625                rc = RTR0MemObjMapKernel(&pPgLvl->a[i].hMapObj, pPgLvl->a[i].hMemObj,
     626                                         (void *)-1 /* pvFixed */, 0 /* cbAlignment */,
    630627                                         RTMEM_PROT_WRITE | RTMEM_PROT_READ);
    631628                if (RT_SUCCESS(rc))
    632629                {
     630                    pPgLvl->a[i].u.pv   = RTR0MemObjAddress(pPgLvl->a[i].hMapObj);
     631                    AssertMsg(((uintptr_t)pPgLvl->a[i].u.pv & ~(uintptr_t)PAGE_OFFSET_MASK), ("%p\n", pPgLvl->a[i].u.pv));
    633632                    pPgLvl->a[i].HCPhys = HCPhys;
    634633                    if (i + 1 == pPgLvl->cLevels)
     
    855854    uint32_t cMinPages;
    856855    uint32_t cPages = pgmR0DynMapCalcNewSize(pThis, &cMinPages);
     856    AssertReturn(cPages, VERR_INTERNAL_ERROR);
    857857    if (pThis->cPages >= cPages)
    858858        return VINF_SUCCESS;
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