VirtualBox

Changeset 6829 in vbox


Ignore:
Timestamp:
Feb 6, 2008 2:06:30 PM (17 years ago)
Author:
vboxsync
Message:

Addressed the R0/R3 issues with the PGMRAMRANGE structure.

Location:
trunk/src/VBox/VMM
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGM.cpp

    r6764 r6829  
    15481548     * Ram ranges.
    15491549     */
    1550     if (pVM->pgm.s.pRamRangesHC)
    1551     {
    1552         pVM->pgm.s.pRamRangesGC = MMHyperHC2GC(pVM, pVM->pgm.s.pRamRangesHC);
    1553         for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesHC; pCur->pNextHC; pCur = pCur->pNextHC)
     1550    if (pVM->pgm.s.pRamRangesR3)
     1551    {
     1552        pVM->pgm.s.pRamRangesGC = MMHyperHC2GC(pVM, pVM->pgm.s.pRamRangesR3);
     1553        for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesR3; pCur->pNextR3; pCur = pCur->pNextR3)
     1554#ifdef VBOX_WITH_NEW_PHYS_CODE
     1555            pCur->pNextGC = MMHyperR3ToGC(pVM, pCur->pNextR3);
     1556#else
    15541557        {
    1555             pCur->pNextGC = MMHyperHC2GC(pVM, pCur->pNextHC);
     1558            pCur->pNextGC = MMHyperR3ToGC(pVM, pCur->pNextR3);
    15561559            if (pCur->pavHCChunkGC)
    15571560                pCur->pavHCChunkGC = MMHyperHC2GC(pVM, pCur->pavHCChunkHC);
    15581561        }
     1562#endif
    15591563    }
    15601564
     
    16861690     * Zero memory.
    16871691     */
    1688     for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesHC; pRam; pRam = pRam->pNextHC)
     1692    for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesR3; pRam; pRam = pRam->pNextR3)
    16891693    {
    16901694        unsigned iPage = pRam->cb >> PAGE_SHIFT;
     
    17911795     */
    17921796    i = 0;
    1793     for (PPGMRAMRANGE pRam = pPGM->pRamRangesHC; pRam; pRam = pRam->pNextHC, i++)
     1797    for (PPGMRAMRANGE pRam = pPGM->pRamRangesR3; pRam; pRam = pRam->pNextR3, i++)
    17941798    {
    17951799        /** @todo MMIO ranges may move (PCI reconfig), we currently assume they don't. */
     
    19581962     */
    19591963    i = 0;
    1960     for (PPGMRAMRANGE pRam = pPGM->pRamRangesHC; pRam; pRam = pRam->pNextHC, i++)
     1964    for (PPGMRAMRANGE pRam = pPGM->pRamRangesR3; pRam; pRam = pRam->pNextR3, i++)
    19611965    {
    19621966        /** @todo MMIO ranges may move (PCI reconfig), we currently assume they don't. */
     
    21572161                    sizeof(RTHCPTR) * 2,      "pvHC            ");
    21582162
    2159     for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesHC; pCur; pCur = pCur->pNextHC)
     2163    for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesR3; pCur; pCur = pCur->pNextR3)
    21602164        pHlp->pfnPrintf(pHlp,
    2161                         "%VGp-%VGp %VHv\n",
     2165                        "%RGp-%RGp %RHv %s\n",
    21622166                        pCur->GCPhys,
    21632167                        pCur->GCPhysLast,
    2164                         pCur->pvHC);
     2168                        pCur->pvHC,
     2169                        pCur->pszDesc);
    21652170}
    21662171
     
    35433548    int rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "From     - To (incl) pvHC\n");
    35443549    PPGMRAMRANGE pRam;
    3545     for (pRam = pVM->pgm.s.pRamRangesHC; pRam; pRam = pRam->pNextHC)
     3550    for (pRam = pVM->pgm.s.pRamRangesR3; pRam; pRam = pRam->pNextR3)
    35463551    {
    35473552        rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
  • trunk/src/VBox/VMM/PGMDbg.cpp

    r6528 r6829  
    5656
    5757#else
    58     for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     58    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    5959         pRam;
    60          pRam = CTXSUFF(pRam->pNext))
     60         pRam = CTXALLSUFF(pRam->pNext))
    6161    {
    6262        if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)
     
    109109
    110110#else
    111     for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     111    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    112112         pRam;
    113          pRam = CTXSUFF(pRam->pNext))
     113         pRam = CTXALLSUFF(pRam->pNext))
    114114    {
    115115        if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)
     
    176176        return VERR_INVALID_POINTER;
    177177
    178     for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     178    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    179179         pRam;
    180          pRam = CTXSUFF(pRam->pNext))
     180         pRam = CTXALLSUFF(pRam->pNext))
    181181    {
    182182        uint32_t iPage = pRam->cb >> PAGE_SHIFT;
     
    342342     * bother to match across ranges.
    343343     */
    344     for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     344    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    345345         pRam;
    346          pRam = CTXSUFF(pRam->pNext))
     346         pRam = CTXALLSUFF(pRam->pNext))
    347347    {
    348348        /*
  • trunk/src/VBox/VMM/PGMInternal.h

    r6820 r6829  
    647647typedef struct PGMRAMRANGE
    648648{
    649     /** Pointer to the next RAM range - for HC. */
    650     R3R0PTRTYPE(struct PGMRAMRANGE *)   pNextHC;
     649    /** Pointer to the next RAM range - for R3. */
     650    R3PTRTYPE(struct PGMRAMRANGE *)     pNextR3;
     651    /** Pointer to the next RAM range - for R0. */
     652    R0PTRTYPE(struct PGMRAMRANGE *)     pNextR0;
    651653    /** Pointer to the next RAM range - for GC. */
    652654    GCPTRTYPE(struct PGMRAMRANGE *)     pNextGC;
     
    659661    /** MM_RAM_* flags */
    660662    uint32_t                            fFlags;
    661 
     663#ifdef VBOX_WITH_NEW_PHYS_CODE
     664    uint32_t                            u32Alignment; /**< alignment. */
     665#else
    662666    /** HC virtual lookup ranges for chunks. Currently only used with MM_RAM_FLAGS_DYNAMIC_ALLOC ranges. */
    663667    GCPTRTYPE(PRTHCPTR)                 pavHCChunkGC;
    664668    /** HC virtual lookup ranges for chunks. Currently only used with MM_RAM_FLAGS_DYNAMIC_ALLOC ranges. */
    665669    R3R0PTRTYPE(PRTHCPTR)               pavHCChunkHC;
    666 
     670#endif
    667671    /** Start of the HC mapping of the range.
    668672     * For pure MMIO and dynamically allocated ranges this is NULL, while for all ranges this is a valid pointer. */
     
    671675    R3PTRTYPE(const char *)             pszDesc;
    672676
     677#ifdef VBOX_WITH_NEW_PHYS_CODE
    673678    /** Padding to make aPage aligned on sizeof(PGMPAGE). */
    674     RTR3PTR                             apvReserved[HC_ARCH_BITS == 32 ? 2 : 1];
     679    uint32_t                            au32Reserved[2];
     680#else
     681# if HC_ARCH_BITS == 32
     682    /** Padding to make aPage aligned on sizeof(PGMPAGE). */
     683    uint32_t                            u32Reserved;
     684# endif
     685#endif
    675686
    676687    /** Array of physical guest page tracking structures. */
     
    17021713
    17031714
    1704     /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for HC.
     1715    /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for R3.
    17051716     * This is sorted by physical address and contains no overlaps.
    17061717     * The memory locks and other conversions are managed by MM at the moment.
    17071718     */
    1708     R3R0PTRTYPE(PPGMRAMRANGE)       pRamRangesHC;
    1709     /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for GC.
    1710      * This is sorted by physical address and contains no overlaps.
    1711      * The memory locks and other conversions are managed by MM at the moment.
    1712      */
     1719    R3PTRTYPE(PPGMRAMRANGE)         pRamRangesR3;
     1720    /** R0 pointer corresponding to PGM::pRamRangesR3. */
     1721    R0PTRTYPE(PPGMRAMRANGE)         pRamRangesR0;
     1722    /** GC pointer corresponding to PGM::pRamRangesR3. */
    17131723    GCPTRTYPE(PPGMRAMRANGE)         pRamRangesGC;
    17141724    /** The configured RAM size. */
     
    22552265     * Optimize for the first range.
    22562266     */
    2257     PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
     2267    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
    22582268    RTGCPHYS off = GCPhys - pRam->GCPhys;
    22592269    if (RT_UNLIKELY(off >= pRam->cb))
     
    22612271        do
    22622272        {
    2263             pRam = CTXSUFF(pRam->pNext);
     2273            pRam = CTXALLSUFF(pRam->pNext);
    22642274            if (RT_UNLIKELY(!pRam))
    22652275                return NULL;
     
    22892299     * Optimize for the first range.
    22902300     */
    2291     PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
     2301    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
    22922302    RTGCPHYS off = GCPhys - pRam->GCPhys;
    22932303    if (RT_UNLIKELY(off >= pRam->cb))
     
    22952305        do
    22962306        {
    2297             pRam = CTXSUFF(pRam->pNext);
     2307            pRam = CTXALLSUFF(pRam->pNext);
    22982308            if (RT_UNLIKELY(!pRam))
    22992309            {
     
    23542364        ||  RT_UNLIKELY((off = GCPhys - pRam->GCPhys) >= pRam->cb))
    23552365    {
    2356         pRam = CTXSUFF(pPGM->pRamRanges);
     2366        pRam = CTXALLSUFF(pPGM->pRamRanges);
    23572367        off = GCPhys - pRam->GCPhys;
    23582368        if (RT_UNLIKELY(off >= pRam->cb))
     
    23602370            do
    23612371            {
    2362                 pRam = CTXSUFF(pRam->pNext);
     2372                pRam = CTXALLSUFF(pRam->pNext);
    23632373                if (RT_UNLIKELY(!pRam))
    23642374                {
     
    24122422     * Optimize for the first range.
    24132423     */
    2414     PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
     2424    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
    24152425    RTGCPHYS off = GCPhys - pRam->GCPhys;
    24162426    if (RT_UNLIKELY(off >= pRam->cb))
     
    24182428        do
    24192429        {
    2420             pRam = CTXSUFF(pRam->pNext);
     2430            pRam = CTXALLSUFF(pRam->pNext);
    24212431            if (RT_UNLIKELY(!pRam))
    24222432                return NULL;
     
    24472457     * Optimize for the first range.
    24482458     */
    2449     PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
     2459    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
    24502460    RTGCPHYS off = GCPhys - pRam->GCPhys;
    24512461    if (RT_UNLIKELY(off >= pRam->cb))
     
    24532463        do
    24542464        {
    2455             pRam = CTXSUFF(pRam->pNext);
     2465            pRam = CTXALLSUFF(pRam->pNext);
    24562466            if (RT_UNLIKELY(!pRam))
    24572467            {
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r6820 r6829  
    101101     */
    102102    PPGMRAMRANGE    pPrev = NULL;
    103     PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesHC;
     103    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesR3;
    104104    while (pCur && GCPhysLast >= pCur->GCPhys)
    105105    {
     
    113113        /* next */
    114114        pPrev = pCur;
    115         pCur = pCur->pNextHC;
     115        pCur = pCur->pNextR3;
    116116    }
    117117
     
    161161     */
    162162    pgmLock(pVM);
    163     pNew->pNextHC = pCur;
    164     //pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : NIL_RTR0PTR;
     163    pNew->pNextR3 = pCur;
     164    pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : NIL_RTR0PTR;
    165165    pNew->pNextGC = pCur ? MMHyperCCToGC(pVM, pCur) : NIL_RTGCPTR;
    166166    if (pPrev)
    167167    {
    168         pPrev->pNextHC = pNew;
    169         //pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
     168        pPrev->pNextR3 = pNew;
     169        pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
    170170        pPrev->pNextGC = MMHyperCCToGC(pVM, pNew);
    171171    }
    172172    else
    173173    {
    174         pVM->pgm.s.pRamRangesHC = pNew;
    175         //pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
     174        pVM->pgm.s.pRamRangesR3 = pNew;
     175        pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
    176176        pVM->pgm.s.pRamRangesGC = MMHyperCCToGC(pVM, pNew);
    177177    }
     
    229229     */
    230230    PPGMRAMRANGE    pPrev = NULL;
    231     PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesHC;
     231    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesR3;
    232232    while (pCur)
    233233    {
     
    242242        /* next */
    243243        pPrev = pCur;
    244         pCur = pCur->pNextHC;
     244        pCur = pCur->pNextR3;
    245245    }
    246246
     
    349349         */
    350350        pgmLock(pVM);
    351         pNew->pNextHC = pCur;
    352         pNew->pNextGC = pCur ? MMHyperHC2GC(pVM, pCur) : 0;
     351        pNew->pNextR3 = pCur;
     352        pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : NIL_RTR0PTR;
     353        pNew->pNextGC = pCur ? MMHyperCCToGC(pVM, pCur) : NIL_RTGCPTR;
    353354        if (pPrev)
    354355        {
    355             pPrev->pNextHC = pNew;
     356            pPrev->pNextR3 = pNew;
     357            pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
    356358            pPrev->pNextGC = GCPtrNew;
    357359        }
    358360        else
    359361        {
    360             pVM->pgm.s.pRamRangesHC = pNew;
     362            pVM->pgm.s.pRamRangesR3 = pNew;
     363            pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
    361364            pVM->pgm.s.pRamRangesGC = GCPtrNew;
    362365        }
     
    415418     * Find existing range location.
    416419     */
    417     PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     420    PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    418421    while (pRam)
    419422    {
     
    423426            break;
    424427
    425         pRam = CTXSUFF(pRam->pNext);
     428        pRam = CTXALLSUFF(pRam->pNext);
    426429    }
    427430    AssertReturn(pRam, VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS);
     
    458461    pgmLock(pVM);
    459462
    460     PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     463    PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    461464    while (pRam)
    462465    {
     
    478481        }
    479482
    480         pRam = CTXSUFF(pRam->pNext);
     483        pRam = CTXALLSUFF(pRam->pNext);
    481484    }
    482485    pgmUnlock(pVM);
     
    605608    pgmLock(pVM);
    606609    PPGMRAMRANGE    pPrev = NULL;
    607     PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesHC;
     610    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesR3;
    608611    while (pCur)
    609612    {
     
    613616        /* next */
    614617        pPrev = pCur;
    615         pCur = pCur->pNextHC;
     618        pCur = pCur->pNextR3;
    616619    }
    617620    if (pPrev)
    618621    {
    619         pPrev->pNextHC = pCur->pNextHC;
     622        pPrev->pNextR3 = pCur->pNextR3;
     623        pPrev->pNextR0 = pCur->pNextR0;
    620624        pPrev->pNextGC = pCur->pNextGC;
    621625    }
    622626    else
    623627    {
    624         pVM->pgm.s.pRamRangesHC = pCur->pNextHC;
     628        pVM->pgm.s.pRamRangesR3 = pCur->pNextR3;
     629        pVM->pgm.s.pRamRangesR0 = pCur->pNextR0;
    625630        pVM->pgm.s.pRamRangesGC = pCur->pNextGC;
    626631    }
     
    637642     */
    638643    pPrev = NULL;
    639     pCur = pVM->pgm.s.pRamRangesHC;
     644    pCur = pVM->pgm.s.pRamRangesR3;
    640645    while (pCur)
    641646    {
     
    651656        /* next */
    652657        pPrev = pCur;
    653         pCur = pCur->pNextHC;
     658        pCur = pCur->pNextR3;
    654659    }
    655660
     
    657662     * Reinsert the RAM range.
    658663     */
    659     pNew->pNextHC = pCur;
    660     pNew->pNextGC = pCur ? MMHyperHC2GC(pVM, pCur) : 0;
     664    pNew->pNextR3 = pCur;
     665    pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : 0;
     666    pNew->pNextGC = pCur ? MMHyperCCToGC(pVM, pCur) : 0;
    661667    if (pPrev)
    662668    {
    663         pPrev->pNextHC = pNew;
    664         pPrev->pNextGC = MMHyperHC2GC(pVM, pNew);
     669        pPrev->pNextR3 = pNew;
     670        pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
     671        pPrev->pNextGC = MMHyperCCToGC(pVM, pNew);
    665672    }
    666673    else
    667674    {
    668         pVM->pgm.s.pRamRangesHC = pNew;
    669         pVM->pgm.s.pRamRangesGC = MMHyperHC2GC(pVM, pNew);
     675        pVM->pgm.s.pRamRangesR3 = pNew;
     676        pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
     677        pVM->pgm.s.pRamRangesGC = MMHyperCCToGC(pVM, pNew);
    670678    }
    671679
     
    703711     * Lookup the range.
    704712     */
    705     PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     713    PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    706714    while (pRam && GCPhys > pRam->GCPhysLast)
    707         pRam = CTXSUFF(pRam->pNext);
     715        pRam = CTXALLSUFF(pRam->pNext);
    708716    if (    !pRam
    709717        ||  GCPhys > pRam->GCPhysLast
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r5999 r6829  
    15711571     * Check the RAM flags against the handlers.
    15721572     */
    1573     for (PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges); pRam; pRam = CTXSUFF(pRam->pNext))
     1573    for (PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges); pRam; pRam = CTXALLSUFF(pRam->pNext))
    15741574    {
    15751575        const unsigned cPages = pRam->cb >> PAGE_SHIFT;
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r5999 r6829  
    10911091     * Find the guest address.
    10921092     */
    1093     for (PPGMRAMRANGE pRam = pVM->pgm.s.CTXSUFF(pRamRanges);
     1093    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    10941094         pRam;
    1095          pRam = pRam->CTXSUFF(pNext))
     1095         pRam = CTXALLSUFF(pRam->pNext))
    10961096    {
    10971097        unsigned iPage = pRam->cb >> PAGE_SHIFT;
     
    21632163                  GCPtrPage, PdeSrc.b.u1Present, PdeSrc.b.u1Write, PdeSrc.b.u1User, (uint64_t)PdeSrc.u, GCPtr,
    21642164                  GCPhys, PdeDst.u & PGM_PDFLAGS_TRACK_DIRTY ? " Track-Dirty" : ""));
    2165             PPGMRAMRANGE        pRam   = CTXSUFF(pVM->pgm.s.pRamRanges);
     2165            PPGMRAMRANGE        pRam   = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    21662166            unsigned            iPTDst = 0;
    21672167            while (iPTDst < ELEMENTS(pPTDst->a))
     
    21692169                /* Advance ram range list. */
    21702170                while (pRam && GCPhys > pRam->GCPhysLast)
    2171                     pRam = CTXSUFF(pRam->pNext);
     2171                    pRam = CTXALLSUFF(pRam->pNext);
    21722172                if (pRam && GCPhys >= pRam->GCPhys)
    21732173                {
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r5999 r6829  
    115115     * There is no apparent need to support ranges which cover more than one ram range.
    116116     */
    117     PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     117    PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    118118    while (pRam && GCPhys > pRam->GCPhysLast)
    119         pRam = CTXSUFF(pRam->pNext);
     119        pRam = CTXALLSUFF(pRam->pNext);
    120120    if (    !pRam
    121121        ||  GCPhysLast < pRam->GCPhys
     
    138138
    139139            /* search again. */
    140             pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     140            pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    141141            while (pRam && GCPhys > pRam->GCPhysLast)
    142                 pRam = CTXSUFF(pRam->pNext);
     142                pRam = CTXALLSUFF(pRam->pNext);
    143143        }
    144144
     
    505505             * There is no apparent need to support ranges which cover more than one ram range.
    506506             */
    507             PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     507            PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    508508            while (pRam && GCPhys > pRam->GCPhysLast)
    509                 pRam = CTXSUFF(pRam->pNext);
     509                pRam = CTXALLSUFF(pRam->pNext);
    510510            if (    pRam
    511511                &&  GCPhys <= pRam->GCPhysLast
     
    797797                 */
    798798                STAM_COUNTER_INC(&pVM->pgm.s.StatHandlePhysicalReset);
    799                 PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     799                PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    800800                while (pRam && GCPhys > pRam->GCPhysLast)
    801                     pRam = CTXSUFF(pRam->pNext);
     801                    pRam = CTXALLSUFF(pRam->pNext);
    802802                int rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pCur, pRam);
    803803                if (rc == VINF_PGM_GCPHYS_ALIASED)
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r6532 r6829  
    476476     * 99.8% of requests are expected to be in the first range.
    477477     */
    478     PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
     478    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
    479479    RTGCPHYS off = GCPhys - pRam->GCPhys;
    480480    if (RT_UNLIKELY(off >= pRam->cb))
     
    482482        do
    483483        {
    484             pRam = CTXSUFF(pRam->pNext);
     484            pRam = CTXALLSUFF(pRam->pNext);
    485485            if (!pRam)
    486486                return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;
     
    10281028     * Copy loop on ram ranges.
    10291029     */
    1030     PPGMRAMRANGE    pCur = CTXSUFF(pVM->pgm.s.pRamRanges);
     1030    PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    10311031    for (;;)
    10321032    {
    10331033        /* Find range. */
    1034         while (pCur && GCPhys > pCur->GCPhysLast)
    1035             pCur = CTXSUFF(pCur->pNext);
     1034        while (pRam && GCPhys > pRam->GCPhysLast)
     1035            pRam = CTXALLSUFF(pRam->pNext);
    10361036        /* Inside range or not? */
    1037         if (pCur && GCPhys >= pCur->GCPhys)
     1037        if (pRam && GCPhys >= pRam->GCPhys)
    10381038        {
    10391039            /*
    10401040             * Must work our way thru this page by page.
    10411041             */
    1042             RTGCPHYS off = GCPhys - pCur->GCPhys;
    1043             while (off < pCur->cb)
     1042            RTGCPHYS off = GCPhys - pRam->GCPhys;
     1043            while (off < pRam->cb)
    10441044            {
    10451045                unsigned iPage = off >> PAGE_SHIFT;
    1046                 PPGMPAGE pPage = &pCur->aPages[iPage];
     1046                PPGMPAGE pPage = &pRam->aPages[iPage];
    10471047                size_t   cb;
    10481048
     
    10791079                            pvSrc = (char *)pvSrc + (off & PAGE_OFFSET_MASK);
    10801080#else
    1081                             void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
     1081                            void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    10821082#endif
    10831083                            cb = PAGE_SIZE - (off & PAGE_OFFSET_MASK);
     
    11281128                                    cb = cbRead;
    11291129
    1130                                 void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
     1130                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    11311131
    11321132                                /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     
    11411141                                pvSrc = (char *)pvSrc + (off & PAGE_OFFSET_MASK);
    11421142#else
    1143                                 void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
     1143                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    11441144#endif
    11451145
     
    11751175                                                  + (iPage << PAGE_SHIFT) + (off & PAGE_OFFSET_MASK);
    11761176
    1177                                 void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
     1177                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    11781178
    11791179                                /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     
    11881188                                pvSrc = (char *)pvSrc + (off & PAGE_OFFSET_MASK);
    11891189#else
    1190                                 void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
     1190                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    11911191#endif
    11921192                                if (cb >= cbRead)
     
    12251225            }
    12261226
    1227             GCPhys = pCur->GCPhysLast + 1;
     1227            GCPhys = pRam->GCPhysLast + 1;
    12281228        }
    12291229        else
     
    12351235             */
    12361236            size_t cb;
    1237             if (    !pCur
    1238                 ||  (cb = pCur->GCPhys - GCPhys) >= cbRead)
     1237            if (    !pRam
     1238                ||  (cb = pRam->GCPhys - GCPhys) >= cbRead)
    12391239            {
    12401240                memset(pvBuf, 0, cbRead);
     
    12901290     * Copy loop on ram ranges.
    12911291     */
    1292     PPGMRAMRANGE    pCur = CTXSUFF(pVM->pgm.s.pRamRanges);
     1292    PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    12931293    for (;;)
    12941294    {
    12951295        /* Find range. */
    1296         while (pCur && GCPhys > pCur->GCPhysLast)
    1297             pCur = CTXSUFF(pCur->pNext);
     1296        while (pRam && GCPhys > pRam->GCPhysLast)
     1297            pRam = CTXALLSUFF(pRam->pNext);
    12981298        /* Inside range or not? */
    1299         if (pCur && GCPhys >= pCur->GCPhys)
     1299        if (pRam && GCPhys >= pRam->GCPhys)
    13001300        {
    13011301            /*
    13021302             * Must work our way thru this page by page.
    13031303             */
    1304             unsigned off = GCPhys - pCur->GCPhys;
    1305             while (off < pCur->cb)
     1304            unsigned off = GCPhys - pRam->GCPhys;
     1305            while (off < pRam->cb)
    13061306            {
    13071307                unsigned iPage = off >> PAGE_SHIFT;
    1308                 PPGMPAGE pPage = &pCur->aPages[iPage];
     1308                PPGMPAGE pPage = &pRam->aPages[iPage];
    13091309
    13101310                /* Physical chunk in dynamically allocated range not present? */
     
    13181318                        rc = pgmr3PhysGrowRange(pVM, GCPhys);
    13191319                        if (rc == VINF_SUCCESS)
    1320                             PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite); /* try again; can't assume pCur is still valid (paranoia) */
     1320                            PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite); /* try again; can't assume pRam is still valid (paranoia) */
    13211321                        return;
    13221322                    }
     
    13451345                        pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
    13461346#else
    1347                         void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1347                        void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    13481348#endif
    13491349                        cb = PAGE_SIZE - (off & PAGE_OFFSET_MASK);
     
    13921392                                cb = cbWrite;
    13931393
    1394                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1394                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    13951395
    13961396                            /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     
    14051405                            pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
    14061406#else
    1407                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1407                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    14081408#endif
    14091409                            if (cb >= cbWrite)
     
    14401440                                              + (iPage << PAGE_SHIFT) + (off & PAGE_OFFSET_MASK);
    14411441
    1442                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1442                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    14431443
    14441444                            /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     
    14531453                            pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
    14541454#else
    1455                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1455                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    14561456#endif
    14571457                            if (cb >= cbWrite)
     
    14891489                                cb = cbWrite;
    14901490
    1491                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1491                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    14921492
    14931493                            /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     
    15091509                                              + (iPage << PAGE_SHIFT) + (off & PAGE_OFFSET_MASK);
    15101510
    1511                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1511                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    15121512
    15131513                            /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     
    15271527                            pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
    15281528#else
    1529                             void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
     1529                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
    15301530#endif
    15311531                            if (cb >= cbWrite)
     
    15661566            }
    15671567
    1568             GCPhys = pCur->GCPhysLast + 1;
     1568            GCPhys = pRam->GCPhysLast + 1;
    15691569        }
    15701570        else
     
    15741574             */
    15751575            size_t cb;
    1576             if (    !pCur
    1577                 ||  (cb = pCur->GCPhys - GCPhys) >= cbWrite)
     1576            if (    !pRam
     1577                ||  (cb = pRam->GCPhys - GCPhys) >= cbWrite)
    15781578                goto end;
    15791579
     
    16141614     * Loop ram ranges.
    16151615     */
    1616     for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     1616    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    16171617         pRam;
    1618          pRam = pRam->CTXSUFF(pNext))
     1618         pRam = CTXALLSUFF(pRam->pNext))
    16191619    {
    16201620        RTGCPHYS off = GCPhysSrc - pRam->GCPhys;
     
    16981698     * Loop ram ranges.
    16991699     */
    1700     for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
     1700    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
    17011701         pRam;
    1702          pRam = pRam->CTXSUFF(pNext))
     1702         pRam = CTXALLSUFF(pRam->pNext))
    17031703    {
    17041704        RTGCPHYS off = GCPhysDst - pRam->GCPhys;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r5999 r6829  
    754754     * Not worth it, so flush it.
    755755     *
    756      * If we considered it to be reused, don't to back to ring-3 
    757      * to emulate failed instructions since we usually cannot 
     756     * If we considered it to be reused, don't to back to ring-3
     757     * to emulate failed instructions since we usually cannot
    758758     * interpret then. This may be a bit risky, in which case
    759759     * the reuse detection must be fixed.
     
    16311631     * Clear all the GCPhys links and rebuild the phys ext free list.
    16321632     */
    1633     for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
     1633    for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
    16341634         pRam;
    1635          pRam = pRam->CTXSUFF(pNext))
     1635         pRam = CTXALLSUFF(pRam->pNext))
    16361636    {
    16371637        unsigned iPage = pRam->cb >> PAGE_SHIFT;
     
    26252625     * Walk range list.
    26262626     */
    2627     PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
     2627    PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
    26282628    while (pRam)
    26292629    {
     
    26412641            break;
    26422642        }
    2643         pRam = CTXSUFF(pRam->pNext);
     2643        pRam = CTXALLSUFF(pRam->pNext);
    26442644    }
    26452645    AssertFatalMsgFailed(("HCPhys=%VHp GCPhys=%VGp\n", HCPhys, GCPhys));
     
    26602660     * Walk range list.
    26612661     */
    2662     PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
     2662    PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
    26632663    while (pRam)
    26642664    {
     
    26762676            break;
    26772677        }
    2678         pRam = CTXSUFF(pRam->pNext);
     2678        pRam = CTXALLSUFF(pRam->pNext);
    26792679    }
    26802680
     
    26832683     */
    26842684    STAM_COUNTER_INC(&pPool->StatTrackLinearRamSearches);
    2685     pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
     2685    pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
    26862686    while (pRam)
    26872687    {
     
    26972697            }
    26982698        }
    2699         pRam = CTXSUFF(pRam->pNext);
     2699        pRam = CTXALLSUFF(pRam->pNext);
    27002700    }
    27012701
     
    30973097     * Clear all the GCPhys links and rebuild the phys ext free list.
    30983098     */
    3099     for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
     3099    for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
    31003100         pRam;
    3101          pRam = pRam->CTXSUFF(pNext))
     3101         pRam = CTXALLSUFF(pRam->pNext))
    31023102    {
    31033103        unsigned iPage = pRam->cb >> PAGE_SHIFT;
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r6820 r6829  
    420420    GEN_CHECK_OFF(PGM, pfnGCBthVerifyAccessSyncPage);
    421421    GEN_CHECK_OFF(PGM, pfnGCBthAssertCR3);
    422     GEN_CHECK_OFF(PGM, pRamRangesHC);
     422    GEN_CHECK_OFF(PGM, pRamRangesR3);
     423    GEN_CHECK_OFF(PGM, pRamRangesR0);
    423424    GEN_CHECK_OFF(PGM, pRamRangesGC);
    424425    GEN_CHECK_OFF(PGM, cbRamSize);
     
    531532    GEN_CHECK_OFF(PGMPAGE, HCPhys);
    532533    GEN_CHECK_SIZE(PGMRAMRANGE);
    533     GEN_CHECK_OFF(PGMRAMRANGE, pNextHC);
     534    GEN_CHECK_OFF(PGMRAMRANGE, pNextR3);
     535    GEN_CHECK_OFF(PGMRAMRANGE, pNextR0);
    534536    GEN_CHECK_OFF(PGMRAMRANGE, pNextGC);
    535537    GEN_CHECK_OFF(PGMRAMRANGE, GCPhys);
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