VirtualBox

Changeset 20795 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 22, 2009 6:40:42 PM (16 years ago)
Author:
vboxsync
Message:

VMM: Fixed guest PAE issues on the mac.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMInternal.h

    r20764 r20795  
    33113311
    33123312    STAM_PROFILE_START(&pPGMCPU->StatR0DynMapGCPageInl, a);
    3313     Assert(!(GCPhys & PAGE_OFFSET_MASK));
     3313    AssertMsg(!(GCPhys & PAGE_OFFSET_MASK), ("%RGp\n", GCPhys));
    33143314
    33153315    /*
     
    33483348        STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlMisses);
    33493349        pgmR0DynMapHCPageCommon(pVM, pSet, HCPhys, ppv);
     3350    }
     3351
     3352    STAM_PROFILE_STOP(&pPGMCPU->StatR0DynMapGCPageInl, a);
     3353    return VINF_SUCCESS;
     3354}
     3355
     3356
     3357/**
     3358 * Inlined version of the ring-0 version of PGMDynMapGCPageOff that optimizes
     3359 * access to pages already in the set.
     3360 *
     3361 * @returns See PGMDynMapGCPage.
     3362 * @param   pPGM        Pointer to the PVM instance data.
     3363 * @param   HCPhys      The physical address of the page.
     3364 * @param   ppv         Where to store the mapping address.
     3365 */
     3366DECLINLINE(int) pgmR0DynMapGCPageOffInlined(PPGM pPGM, RTGCPHYS GCPhys, void **ppv)
     3367{
     3368    PVM     pVM     = PGM2VM(pPGM);
     3369    PPGMCPU pPGMCPU = (PPGMCPU)((uint8_t *)VMMGetCpu(pVM) + pPGM->offVCpuPGM); /* very pretty ;-) */
     3370
     3371    STAM_PROFILE_START(&pPGMCPU->StatR0DynMapGCPageInl, a);
     3372
     3373    /*
     3374     * Get the ram range.
     3375     */
     3376    PPGMRAMRANGE    pRam = pPGM->CTX_SUFF(pRamRanges);
     3377    RTGCPHYS        off = GCPhys - pRam->GCPhys;
     3378    if (RT_UNLIKELY(off >= pRam->cb
     3379        /** @todo   || page state stuff */))
     3380    {
     3381        /* This case is not counted into StatR0DynMapGCPageInl. */
     3382        STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlRamMisses);
     3383        return PGMDynMapGCPageOff(pVM, GCPhys, ppv);
     3384    }
     3385
     3386    RTHCPHYS HCPhys = PGM_PAGE_GET_HCPHYS(&pRam->aPages[off >> PAGE_SHIFT]);
     3387    STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlRamHits);
     3388
     3389    /*
     3390     * pgmR0DynMapHCPageInlined with out stats.
     3391     */
     3392    PPGMMAPSET pSet = &pPGMCPU->AutoSet;
     3393    Assert(!(HCPhys & PAGE_OFFSET_MASK));
     3394    Assert(pSet->cEntries <= RT_ELEMENTS(pSet->aEntries));
     3395
     3396    unsigned    iHash   = PGMMAPSET_HASH(HCPhys);
     3397    unsigned    iEntry  = pSet->aiHashTable[iHash];
     3398    if (    iEntry < pSet->cEntries
     3399        &&  pSet->aEntries[iEntry].HCPhys == HCPhys)
     3400    {
     3401        *ppv = (void *)((uintptr_t)pSet->aEntries[iEntry].pvPage | (PAGE_OFFSET_MASK & (uintptr_t)GCPhys));
     3402        STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlHits);
     3403    }
     3404    else
     3405    {
     3406        STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlMisses);
     3407        pgmR0DynMapHCPageCommon(pVM, pSet, HCPhys, ppv);
     3408        *ppv = (void *)((uintptr_t)*ppv | (PAGE_OFFSET_MASK & (uintptr_t)GCPhys));
    33503409    }
    33513410
     
    35683627#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    35693628    PX86PDPT pGuestPDPT = NULL;
    3570     int rc = pgmR0DynMapGCPageInlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT);
     3629    int rc = pgmR0DynMapGCPageOffInlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT);
    35713630    AssertRCReturn(rc, NULL);
    35723631#else
     
    35953654#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    35963655    PX86PDPT pGuestPDPT = 0;
    3597     int rc = pgmR0DynMapGCPageInlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT);
     3656    int rc = pgmR0DynMapGCPageOffInlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT);
    35983657    AssertRCReturn(rc, 0);
    35993658#else
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r20767 r20795  
    13681368
    13691369    RTHCPTR     HCPtrGuestCR3;
    1370     int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_PAE_PAGE_MASK, (void **)&HCPtrGuestCR3);
     1370    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_PAE_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysR3 masking isn't necessary. */
    13711371    AssertRCReturn(rc, NULL);
    13721372
     
    14641464
    14651465    RTHCPTR     HCPtrGuestCR3;
    1466     int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_AMD64_PAGE_MASK, (void **)&HCPtrGuestCR3);
     1466    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_AMD64_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysCR3 masking isn't necessary. */
    14671467    AssertRCReturn(rc, NULL);
    14681468
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r20783 r20795  
    453453                                pCur = NULL;    /* might be invalid by now. */
    454454#  endif
    455                                
     455
    456456                            }
    457457                            else
     
    42424242    int rc = VINF_SUCCESS;
    42434243# else
    4244     int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhysCR3 & GST_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3);
     4244    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhysCR3 & GST_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysCR3 masking isn't necessary. */
    42454245# endif
    42464246    pgmUnlock(pVM);
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