VirtualBox

Changeset 18125 in vbox


Ignore:
Timestamp:
Mar 22, 2009 4:52:36 PM (16 years ago)
Author:
vboxsync
Message:

PGM: MapCR3 anywhere again (new phys code).

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

Legend:

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

    r18046 r18125  
    31233123     * Get page directory addresses.
    31243124     */
    3125     PX86PD     pPDSrc = pVM->pgm.s.pGst32BitPdR3;
     3125    PX86PD     pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s);
    31263126    Assert(pPDSrc);
    31273127    Assert(PGMPhysGCPhys2R3PtrAssert(pVM, (RTGCPHYS)(CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK), sizeof(*pPDSrc)) == pPDSrc);
  • trunk/src/VBox/VMM/PGMInternal.h

    r18046 r18125  
    29302930void            pgmMapClearShadowPDEs(PVM pVM, PPGMPOOLPAGE pShwPageCR3, PPGMMAPPING pMap, unsigned iOldPDE);
    29312931void            pgmMapSetShadowPDEs(PVM pVM, PPGMMAPPING pMap, unsigned iNewPDE);
    2932 int             pgmShwSyncPaePDPtr(PVM pVM, RTGCPTR GCPtr, PX86PDPE pGstPdpe, PX86PDPAE *ppPD);
    29332932int             pgmMapDeactivateCR3(PVM pVM, PPGMPOOLPAGE pShwPageCR3);
    29342933int             pgmMapActivateCR3(PVM pVM, PPGMPOOLPAGE pShwPageCR3);
    29352934
     2935int             pgmShwSyncPaePDPtr(PVM pVM, RTGCPTR GCPtr, PX86PDPE pGstPdpe, PX86PDPAE *ppPD);
    29362936#ifndef IN_RC
    29372937int             pgmShwSyncLongModePDPtr(PVM pVM, RTGCPTR64 GCPtr, PX86PML4E pGstPml4e, PX86PDPE pGstPdpe, PX86PDPAE *ppPD);
    29382938#endif
    29392939int             pgmShwGetEPTPDPtr(PVM pVM, RTGCPTR64 GCPtr, PEPTPDPT *ppPdpt, PEPTPD *ppPD);
     2940
     2941PX86PD          pgmGstLazyMap32BitPD(PPGM pPGM);
     2942PX86PDPT        pgmGstLazyMapPaePDPT(PPGM pPGM);
     2943PX86PDPAE       pgmGstLazyMapPaePD(PPGM pPGM, uint32_t iPdpt);
     2944PX86PML4        pgmGstLazyMapPml4(PPGM pPGM);
    29402945
    29412946__END_DECLS
     
    35223527{
    35233528#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3524     PCX86PD pGuestPD = 0;
     3529    PCX86PD pGuestPD = NULL;
    35253530    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPD);
    35263531    if (RT_FAILURE(rc))
     
    35293534        AssertMsgFailedReturn(("%Rrc\n", rc), ZeroPde);
    35303535    }
     3536#else
     3537    PX86PD pGuestPD = pPGM->CTX_SUFF(pGst32BitPd);
     3538# ifdef VBOX_WITH_NEW_PHYS_CODE
     3539# ifdef IN_RING3
     3540    if (!pGuestPD)
     3541        pGuestPD = pgmGstLazyMap32BitPD(pPGM);
     3542# endif
     3543# endif
     3544#endif
    35313545    return pGuestPD->a[GCPtr >> X86_PD_SHIFT];
    3532 #else
    3533     return pPGM->CTX_SUFF(pGst32BitPd)->a[GCPtr >> X86_PD_SHIFT];
    3534 #endif
    35353546}
    35363547
     
    35463557{
    35473558#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3548     PX86PD pGuestPD = 0;
     3559    PX86PD pGuestPD = NULL;
    35493560    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPD);
    3550     AssertRCReturn(rc, 0);
     3561    AssertRCReturn(rc, NULL);
     3562#else
     3563    PX86PD pGuestPD = pPGM->CTX_SUFF(pGst32BitPd);
     3564# ifdef VBOX_WITH_NEW_PHYS_CODE
     3565# ifdef IN_RING3
     3566    if (!pGuestPD)
     3567        pGuestPD = pgmGstLazyMap32BitPD(pPGM);
     3568# endif
     3569# endif
     3570#endif
    35513571    return &pGuestPD->a[GCPtr >> X86_PD_SHIFT];
    3552 #else
    3553     return &pPGM->CTX_SUFF(pGst32BitPd)->a[GCPtr >> X86_PD_SHIFT];
    3554 #endif
    35553572}
    35563573
     
    35653582{
    35663583#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3567     PX86PD pGuestPD = 0;
     3584    PX86PD pGuestPD = NULL;
    35683585    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPD);
    3569     AssertRCReturn(rc, 0);
     3586    AssertRCReturn(rc, NULL);
     3587#else
     3588    PX86PD pGuestPD = pPGM->CTX_SUFF(pGst32BitPd);
     3589# ifdef VBOX_WITH_NEW_PHYS_CODE
     3590# ifdef IN_RING3
     3591    if (!pGuestPD)
     3592        pGuestPD = pgmGstLazyMap32BitPD(pPGM);
     3593# endif
     3594# endif
     3595#endif
    35703596    return pGuestPD;
    3571 #else
    3572     return pPGM->CTX_SUFF(pGst32BitPd);
    3573 #endif
    35743597}
    35753598
     
    35843607DECLINLINE(PX86PDPT) pgmGstGetPaePDPTPtr(PPGM pPGM)
    35853608{
     3609#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
     3610    PX86PDPT pGuestPDPT = NULL;
     3611    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPDPT);
     3612    AssertRCReturn(rc, NULL);
     3613#else
     3614    PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePdpt);
     3615# ifdef VBOX_WITH_NEW_PHYS_CODE
     3616# ifdef IN_RING3
     3617    if (!pGuestPDPT)
     3618        pGuestPDPT = pgmGstLazyMapPaePDPT(pPGM);
     3619# endif
     3620# endif
     3621#endif
     3622    return pGuestPDPT;
     3623}
     3624
     3625
     3626/**
     3627 * Gets the guest page directory pointer table entry for the specified address.
     3628 *
     3629 * @returns Pointer to the page directory in question.
     3630 * @returns NULL if the page directory is not present or on an invalid page.
     3631 * @param   pPGM        Pointer to the PGM instance data.
     3632 * @param   GCPtr       The address.
     3633 */
     3634DECLINLINE(PX86PDPE) pgmGstGetPaePDPEPtr(PPGM pPGM, RTGCPTR GCPtr)
     3635{
     3636    AssertGCPtr32(GCPtr);
     3637
    35863638#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    35873639    PX86PDPT pGuestPDPT = 0;
    35883640    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPDPT);
    35893641    AssertRCReturn(rc, 0);
    3590     return pGuestPDPT;
    35913642#else
    3592     return pPGM->CTX_SUFF(pGstPaePdpt);
    3593 #endif
    3594 }
    3595 
    3596 
    3597 /**
    3598  * Gets the guest page directory pointer table entry for the specified address.
     3643    PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePdpt);
     3644# ifdef VBOX_WITH_NEW_PHYS_CODE
     3645# ifdef IN_RING3
     3646    if (!pGuestPDPT)
     3647        pGuestPDPT = pgmGstLazyMapPaePDPT(pPGM);
     3648# endif
     3649# endif
     3650#endif
     3651    return &pGuestPDPT->a[(GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE];
     3652}
     3653
     3654
     3655/**
     3656 * Gets the page directory for the specified address.
    35993657 *
    36003658 * @returns Pointer to the page directory in question.
     
    36033661 * @param   GCPtr       The address.
    36043662 */
    3605 DECLINLINE(PX86PDPE) pgmGstGetPaePDPEPtr(PPGM pPGM, RTGCPTR GCPtr)
     3663DECLINLINE(PX86PDPAE) pgmGstGetPaePD(PPGM pPGM, RTGCPTR GCPtr)
    36063664{
    36073665    AssertGCPtr32(GCPtr);
    36083666
     3667    PX86PDPT        pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
     3668    AssertReturn(pGuestPDPT, NULL);
     3669    const unsigned  iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
     3670    if (pGuestPDPT->a[iPdpt].n.u1Present)
     3671    {
     3672#ifdef VBOX_WITH_NEW_PHYS_CODE
    36093673#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3610     PX86PDPT pGuestPDPT = 0;
    3611     int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPDPT);
    3612     AssertRCReturn(rc, 0);
    3613     return &pGuestPDPT->a[(GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE];
     3674        PX86PDPAE   pGuestPD = NULL;
     3675        int rc = pgmR0DynMapGCPageInlined(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, (void **)&pGuestPD);
     3676        AssertRCReturn(rc, NULL);
    36143677#else
    3615     return &pPGM->CTX_SUFF(pGstPaePdpt)->a[(GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE];
    3616 #endif
    3617 }
    3618 
    3619 
    3620 /**
    3621  * Gets the page directory for the specified address.
    3622  *
    3623  * @returns Pointer to the page directory in question.
    3624  * @returns NULL if the page directory is not present or on an invalid page.
    3625  * @param   pPGM        Pointer to the PGM instance data.
    3626  * @param   GCPtr       The address.
    3627  */
    3628 DECLINLINE(PX86PDPAE) pgmGstGetPaePD(PPGM pPGM, RTGCPTR GCPtr)
    3629 {
    3630     AssertGCPtr32(GCPtr);
    3631 
    3632 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3633     PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
    3634     AssertReturn(pGuestPDPT, 0);
    3635 #else
    3636     PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePdpt);
    3637 #endif
    3638     const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    3639     if (pGuestPDPT->a[iPdPt].n.u1Present)
    3640     {
     3678        PX86PDPAE   pGuestPD = pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
     3679        if (    !pGuestPD
     3680            ||  (pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) != pPGM->aGCPhysGstPaePDs[iPdpt])
     3681            pGuestPD = pgmGstLazyMapPaePD(pPGM, iPdpt);
     3682#endif
     3683        return pGuestPD;
     3684#else  /* !VBOX_WITH_NEW_PHYS_CODE */
    36413685#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3642         if ((pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPt])
    3643             return pPGM->CTX_SUFF(apGstPaePDs)[iPdPt];
     3686        if ((pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdpt])
     3687            return pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
    36443688#endif
    36453689
    36463690        /* cache is out-of-sync. */
    36473691        PX86PDPAE pPD;
    3648         int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     3692        int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    36493693        if (RT_SUCCESS(rc))
    36503694            return pPD;
    3651         AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, pGuestPDPT->a[iPdPt].u));
     3695        AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, pGuestPDPT->a[iPdpt].u));
     3696#endif /* !VBOX_WITH_NEW_PHYS_CODE */
    36523697        /* returning NULL is ok if we assume it's just an invalid page of some kind emulated as all 0s. (not quite true) */
    36533698    }
     
    36683713    AssertGCPtr32(GCPtr);
    36693714
    3670 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3671     PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
    3672     AssertReturn(pGuestPDPT, 0);
    3673 #else
    3674     PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePdpt);
    3675 #endif
    3676     const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    3677     if (pGuestPDPT->a[iPdPt].n.u1Present)
     3715    PX86PDPT        pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
     3716    AssertReturn(pGuestPDPT, NULL);
     3717    const unsigned  iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
     3718    if (pGuestPDPT->a[iPdpt].n.u1Present)
    36783719    {
    36793720        const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
     3721#ifdef VBOX_WITH_NEW_PHYS_CODE
     3722#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
     3723        PX86PDPAE   pGuestPD = NULL;
     3724        int rc = pgmR0DynMapGCPageInlined(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, (void **)&pGuestPD);
     3725        AssertRCReturn(rc, NULL);
     3726#else
     3727        PX86PDPAE   pGuestPD = pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
     3728        if (    !pGuestPD
     3729            ||  (pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) != pPGM->aGCPhysGstPaePDs[iPdpt])
     3730            pGuestPD = pgmGstLazyMapPaePD(pPGM, iPdpt);
     3731#endif
     3732        return &pGuestPD->a[iPD];
     3733#else  /* !VBOX_WITH_NEW_PHYS_CODE */
    36803734#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3681         if ((pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPt])
    3682             return &pPGM->CTX_SUFF(apGstPaePDs)[iPdPt]->a[iPD];
     3735        if ((pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdpt])
     3736            return &pPGM->CTX_SUFF(apGstPaePDs)[iPdpt]->a[iPD];
    36833737#endif
    36843738
    36853739        /* The cache is out-of-sync. */
    36863740        PX86PDPAE pPD;
    3687         int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     3741        int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    36883742        if (RT_SUCCESS(rc))
    36893743            return &pPD->a[iPD];
    3690         AssertMsgFailed(("Impossible! rc=%Rrc PDPE=%RX64\n", rc, pGuestPDPT->a[iPdPt].u));
     3744        AssertMsgFailed(("Impossible! rc=%Rrc PDPE=%RX64\n", rc, pGuestPDPT->a[iPdpt].u));
     3745#endif /* !VBOX_WITH_NEW_PHYS_CODE */
    36913746        /* returning NIL_RTGCPHYS is ok if we assume it's just an invalid page or something which we'll emulate as all 0s. (not quite true) */
    36923747    }
     
    37063761{
    37073762    AssertGCPtr32(GCPtr);
    3708 
    3709 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3710     PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
     3763    X86PDEPAE   ZeroPde = {0};
     3764    PX86PDPT    pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
    37113765    if (RT_LIKELY(pGuestPDPT))
    3712 #else
    3713     PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePdpt);
    3714 #endif
    37153766    {
    3716         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    3717         if (pGuestPDPT->a[iPdPt].n.u1Present)
     3767        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
     3768        if (pGuestPDPT->a[iPdpt].n.u1Present)
    37183769        {
    37193770            const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
     3771#ifdef VBOX_WITH_NEW_PHYS_CODE
     3772#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
     3773            PX86PDPAE   pGuestPD = NULL;
     3774            int rc = pgmR0DynMapGCPageInlined(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, (void **)&pGuestPD);
     3775            AssertRCReturn(rc, ZeroPde);
     3776#else
     3777            PX86PDPAE   pGuestPD = pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
     3778            if (    !pGuestPD
     3779                ||  (pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) != pPGM->aGCPhysGstPaePDs[iPdpt])
     3780                pGuestPD = pgmGstLazyMapPaePD(pPGM, iPdpt);
     3781#endif
     3782            return pGuestPD->a[iPD];
     3783#else  /* !VBOX_WITH_NEW_PHYS_CODE */
    37203784#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3721             if ((pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPt])
    3722                 return pPGM->CTX_SUFF(apGstPaePDs)[iPdPt]->a[iPD];
     3785            if ((pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdpt])
     3786                return pPGM->CTX_SUFF(apGstPaePDs)[iPdpt]->a[iPD];
    37233787#endif
    37243788
    37253789            /* cache is out-of-sync. */
    37263790            PX86PDPAE pPD;
    3727             int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     3791            int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    37283792            if (RT_SUCCESS(rc))
    37293793                return pPD->a[iPD];
    3730             AssertMsgFailed(("Impossible! rc=%d PDPE=%RX64\n", rc, pGuestPDPT->a[iPdPt].u));
     3794            AssertMsgFailed(("Impossible! rc=%d PDPE=%RX64\n", rc, pGuestPDPT->a[iPdpt].u));
     3795#endif /* !VBOX_WITH_NEW_PHYS_CODE */
    37313796        }
    37323797    }
    3733     X86PDEPAE ZeroPde = {0};
    37343798    return ZeroPde;
    37353799}
     
    37513815    AssertGCPtr32(GCPtr);
    37523816
    3753 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3754     PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
    3755     AssertReturn(pGuestPDPT, 0);
    3756 #else
    3757     PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePdpt);
    3758 #endif
    3759     const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
     3817    PX86PDPT        pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
     3818    AssertReturn(pGuestPDPT, NULL);
     3819    const unsigned  iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    37603820    if (pPdpe)
    3761         *pPdpe = pGuestPDPT->a[iPdPt];
    3762     if (pGuestPDPT->a[iPdPt].n.u1Present)
     3821        *pPdpe = pGuestPDPT->a[iPdpt];
     3822    if (pGuestPDPT->a[iPdpt].n.u1Present)
    37633823    {
    37643824        const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
     3825#ifdef VBOX_WITH_NEW_PHYS_CODE
     3826#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
     3827        PX86PDPAE   pGuestPD = NULL;
     3828        int rc = pgmR0DynMapGCPageInlined(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, (void **)&pGuestPD);
     3829        AssertRCReturn(rc, NULL);
     3830#else
     3831        PX86PDPAE   pGuestPD = pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
     3832        if (    !pGuestPD
     3833            ||  (pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) != pPGM->aGCPhysGstPaePDs[iPdpt])
     3834            pGuestPD = pgmGstLazyMapPaePD(pPGM, iPdpt);
     3835#endif
     3836        *piPD = iPD;
     3837        return pGuestPD;
     3838#else  /* !VBOX_WITH_NEW_PHYS_CODE */
    37653839#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3766         if ((pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPt])
     3840        if ((pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdpt])
    37673841        {
    37683842            *piPD = iPD;
    3769             return pPGM->CTX_SUFF(apGstPaePDs)[iPdPt];
     3843            return pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
    37703844        }
    37713845#endif
     
    37733847        /* cache is out-of-sync. */
    37743848        PX86PDPAE pPD;
    3775         int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     3849        int rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    37763850        if (RT_SUCCESS(rc))
    37773851        {
     
    37793853            return pPD;
    37803854        }
    3781         AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, pGuestPDPT->a[iPdPt].u));
     3855        AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, pGuestPDPT->a[iPdpt].u));
     3856#endif /* !VBOX_WITH_NEW_PHYS_CODE */
    37823857        /* returning NIL_RTGCPHYS is ok if we assume it's just an invalid page of some kind emulated as all 0s. */
    37833858    }
     
    37993874    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPml4);
    38003875    AssertRCReturn(rc, NULL);
     3876#else
     3877    PX86PML4 pGuestPml4 = pPGM->CTX_SUFF(pGstAmd64Pml4);
     3878# ifdef VBOX_WITH_NEW_PHYS_CODE
     3879# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3
     3880    if (!pGuestPml4)
     3881        pGuestPml4 = pgmGstLazyMapPml4(pPGM);
     3882# endif
     3883# endif
     3884    Assert(pGuestPml4);
     3885#endif
    38013886    return pGuestPml4;
    3802 #else
    3803     Assert(pPGM->CTX_SUFF(pGstAmd64Pml4));
    3804     return pPGM->CTX_SUFF(pGstAmd64Pml4);
    3805 #endif
    38063887}
    38073888
     
    38203901    int rc = pgmR0DynMapGCPageInlined(pPGM, pPGM->GCPhysCR3, (void **)&pGuestPml4);
    38213902    AssertRCReturn(rc, NULL);
     3903#else
     3904    PX86PML4 pGuestPml4 = pPGM->CTX_SUFF(pGstAmd64Pml4);
     3905# ifdef VBOX_WITH_NEW_PHYS_CODE
     3906# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3
     3907    if (!pGuestPml4)
     3908        pGuestPml4 = pgmGstLazyMapPml4(pPGM);
     3909# endif
     3910# endif
     3911    Assert(pGuestPml4);
     3912#endif
    38223913    return &pGuestPml4->a[iPml4];
    3823 #else
    3824     Assert(pPGM->CTX_SUFF(pGstAmd64Pml4));
    3825     return &pPGM->CTX_SUFF(pGstAmd64Pml4)->a[iPml4];
    3826 #endif
    38273914}
    38283915
     
    38453932        AssertMsgFailedReturn(("%Rrc\n", rc), ZeroPml4e);
    38463933    }
     3934#else
     3935    PX86PML4 pGuestPml4 = pPGM->CTX_SUFF(pGstAmd64Pml4);
     3936# ifdef VBOX_WITH_NEW_PHYS_CODE
     3937# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3
     3938    if (!pGuestPml4)
     3939        pGuestPml4 = pgmGstLazyMapPml4(pPGM);
     3940# endif
     3941# endif
     3942    Assert(pGuestPml4);
     3943#endif
    38473944    return pGuestPml4->a[iPml4];
    3848 #else
    3849     Assert(pPGM->CTX_SUFF(pGstAmd64Pml4));
    3850     return pPGM->CTX_SUFF(pGstAmd64Pml4)->a[iPml4];
    3851 #endif
    38523945}
    38533946
     
    38733966        AssertRCReturn(rc, NULL);
    38743967
    3875         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    3876         return &pPdpt->a[iPdPt];
     3968        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     3969        return &pPdpt->a[iPdpt];
    38773970    }
    38783971    return NULL;
     
    39023995        AssertRCReturn(rc, ZeroPde);
    39033996
    3904         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    3905         *pPdpe = pPdptTemp->a[iPdPt];
    3906         if (pPdptTemp->a[iPdPt].n.u1Present)
     3997        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     3998        *pPdpe = pPdptTemp->a[iPdpt];
     3999        if (pPdptTemp->a[iPdpt].n.u1Present)
    39074000        {
    39084001            PCX86PDPAE pPD;
    3909             rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     4002            rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    39104003            AssertRCReturn(rc, ZeroPde);
    39114004
     
    39384031        AssertRCReturn(rc, ZeroPde);
    39394032
    3940         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    3941         if (pPdptTemp->a[iPdPt].n.u1Present)
     4033        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     4034        if (pPdptTemp->a[iPdpt].n.u1Present)
    39424035        {
    39434036            PCX86PDPAE pPD;
    3944             rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     4037            rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    39454038            AssertRCReturn(rc, ZeroPde);
    39464039
     
    39714064        AssertRCReturn(rc, NULL);
    39724065
    3973         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    3974         if (pPdptTemp->a[iPdPt].n.u1Present)
     4066        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     4067        if (pPdptTemp->a[iPdpt].n.u1Present)
    39754068        {
    39764069            PX86PDPAE pPD;
    3977             rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     4070            rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    39784071            AssertRCReturn(rc, NULL);
    39794072
     
    40084101        AssertRCReturn(rc, NULL);
    40094102
    4010         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    4011         *pPdpe = pPdptTemp->a[iPdPt];
    4012         if (pPdptTemp->a[iPdPt].n.u1Present)
     4103        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     4104        *pPdpe = pPdptTemp->a[iPdpt];
     4105        if (pPdptTemp->a[iPdpt].n.u1Present)
    40134106        {
    40144107            PX86PDPAE pPD;
    4015             rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     4108            rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    40164109            AssertRCReturn(rc, NULL);
    40174110
     
    42404333        AssertRCReturn(rc, NULL);
    42414334
    4242         const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    4243         if (pPdptTemp->a[iPdPt].n.u1Present)
     4335        const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     4336        if (pPdptTemp->a[iPdpt].n.u1Present)
    42444337        {
    42454338            PX86PDPAE pPD;
    4246             rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     4339            rc = PGM_GCPHYS_2_PTR_BY_PGM(pPGM, pPdptTemp->a[iPdpt].u & X86_PDPE_PG_MASK, &pPD);
    42474340            AssertRCReturn(rc, NULL);
    42484341
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r17667 r18125  
    13101310}
    13111311
     1312#ifdef VBOX_WITH_NEW_PHYS_CODE
     1313#ifdef IN_RING3
     1314
     1315/**
     1316 * Performs the lazy mapping of the 32-bit guest PD.
     1317 * 
     1318 * @returns Pointer to the mapping.
     1319 * @param   pPGM        The PGM instance data.
     1320 */
     1321PX86PD pgmGstLazyMap32BitPD(PPGM pPGM)
     1322{
     1323    Assert(!pPGM->CTX_SUFF(pGst32BitPd));
     1324    PVM pVM = PGM2VM(pPGM);
     1325    pgmLock(pVM);
     1326
     1327    PPGMPAGE    pPage = pgmPhysGetPage(pPGM, pPGM->GCPhysCR3);
     1328    AssertReturn(pPage, NULL);
     1329
     1330    RTHCPTR     HCPtrGuestCR3;
     1331    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3);
     1332    AssertRCReturn(rc, NULL);
     1333
     1334    pPGM->pGst32BitPdR3 = (R3PTRTYPE(PX86PD))HCPtrGuestCR3;
     1335# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     1336    pPGM->pGst32BitPdR0 = (R0PTRTYPE(PX86PD))HCPtrGuestCR3;
     1337# endif
     1338
     1339    pgmUnlock(pVM);
     1340    return pPGM->CTX_SUFF(pGst32BitPd);
     1341}
     1342
     1343
     1344/**
     1345 * Performs the lazy mapping of the PAE guest PDPT.
     1346 * 
     1347 * @returns Pointer to the mapping.
     1348 * @param   pPGM        The PGM instance data.
     1349 */
     1350PX86PDPT pgmGstLazyMapPaePDPT(PPGM pPGM)
     1351{
     1352    Assert(!pPGM->CTX_SUFF(pGstPaePdpt));
     1353    PVM pVM = PGM2VM(pPGM);
     1354    pgmLock(pVM);
     1355
     1356    PPGMPAGE    pPage = pgmPhysGetPage(pPGM, pPGM->GCPhysCR3);
     1357    AssertReturn(pPage, NULL);
     1358
     1359    RTHCPTR     HCPtrGuestCR3;
     1360    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_PAE_PAGE_MASK, (void **)&HCPtrGuestCR3);
     1361    AssertRCReturn(rc, NULL);
     1362
     1363    pPGM->pGstPaePdptR3 = (R3PTRTYPE(PX86PDPT))HCPtrGuestCR3;
     1364# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     1365    pPGM->pGstPaePdptR0 = (R0PTRTYPE(PX86PDPT))HCPtrGuestCR3;
     1366# endif
     1367
     1368    pgmUnlock(pVM);
     1369    return pPGM->CTX_SUFF(pGstPaePdpt);
     1370}
     1371
     1372#endif /* IN_RING3  */
     1373
     1374/**
     1375 * Performs the lazy mapping / updating of a PAE guest PD.
     1376 * 
     1377 * @returns Pointer to the mapping.
     1378 * @param   pPGM        The PGM instance data.
     1379 * @param   iPdpt       Which PD entry to map (0..3).
     1380 */
     1381PX86PDPAE pgmGstLazyMapPaePD(PPGM pPGM, uint32_t iPdpt)
     1382{
     1383    PVM             pVM         = PGM2VM(pPGM);
     1384    pgmLock(pVM);
     1385
     1386    PX86PDPT        pGuestPDPT  = pPGM->CTX_SUFF(pGstPaePdpt);
     1387    Assert(pGuestPDPT);
     1388    Assert(pGuestPDPT->a[iPdpt].n.u1Present);
     1389    RTGCPHYS        GCPhys      = pGuestPDPT->a[iPdpt].u & X86_PDPE_PG_MASK;
     1390    bool const      fChanged    = pPGM->aGCPhysGstPaePDs[iPdpt] != GCPhys;
     1391
     1392    PPGMPAGE        pPage       = pgmPhysGetPage(pPGM, GCPhys);
     1393    if (RT_LIKELY(pPage))
     1394    {
     1395        int         rc          = VINF_SUCCESS;
     1396        RTRCPTR     RCPtr       = NIL_RTRCPTR;
     1397        RTHCPTR     HCPtr       = NIL_RTHCPTR;
     1398#if !defined(IN_RC) && !defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     1399        rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, &HCPtr);
     1400        AssertRC(rc);
     1401#endif
     1402        if (RT_SUCCESS(rc) && fChanged)
     1403        {
     1404            RCPtr = (RTRCPTR)(RTRCUINTPTR)(pPGM->GCPtrCR3Mapping + (1 + iPdpt) * PAGE_SIZE);
     1405            rc = PGMMap(pVM, (RTRCUINTPTR)RCPtr, PGM_PAGE_GET_HCPHYS(pPage), PAGE_SIZE, 0);
     1406        }
     1407        if (RT_SUCCESS(rc))
     1408        {
     1409            pPGM->apGstPaePDsR3[iPdpt]          = (R3PTRTYPE(PX86PDPAE))HCPtr;
     1410# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     1411            pPGM->apGstPaePDsR0[iPdpt]          = (R0PTRTYPE(PX86PDPAE))HCPtr;
     1412# endif
     1413            if (fChanged)
     1414            {   
     1415                pPGM->aGCPhysGstPaePDs[iPdpt]   = GCPhys;
     1416                pPGM->apGstPaePDsRC[iPdpt]      = (RCPTRTYPE(PX86PDPAE))RCPtr;
     1417            }
     1418
     1419            pgmUnlock(pVM);
     1420            return pPGM->CTX_SUFF(apGstPaePDs)[iPdpt];
     1421        }
     1422    }
     1423
     1424    /* Invalid page or some failure, invalidate the entry. */
     1425    pPGM->aGCPhysGstPaePDs[iPdpt]   = NIL_RTGCPHYS;
     1426    pPGM->apGstPaePDsR3[iPdpt]      = 0;
     1427# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     1428    pPGM->apGstPaePDsR0[iPdpt]      = 0;
     1429# endif
     1430    pPGM->apGstPaePDsRC[iPdpt]      = 0;
     1431
     1432    pgmUnlock(pVM);
     1433    return NULL;
     1434}
     1435
     1436
     1437#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3
     1438/**
     1439 * Performs the lazy mapping of the 32-bit guest PD.
     1440 * 
     1441 * @returns Pointer to the mapping.
     1442 * @param   pPGM        The PGM instance data.
     1443 */
     1444PX86PML4 pgmGstLazyMapPml4(PPGM pPGM)
     1445{
     1446    Assert(!pPGM->CTX_SUFF(pGstAmd64Pml4));
     1447    PVM pVM = PGM2VM(pPGM);
     1448    pgmLock(pVM);
     1449
     1450    PPGMPAGE    pPage = pgmPhysGetPage(pPGM, pPGM->GCPhysCR3);
     1451    AssertReturn(pPage, NULL);
     1452
     1453    RTHCPTR     HCPtrGuestCR3;
     1454    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_AMD64_PAGE_MASK, (void **)&HCPtrGuestCR3);
     1455    AssertRCReturn(rc, NULL);
     1456
     1457    pPGM->pGstAmd64Pml4R3 = (R3PTRTYPE(PX86PML4))HCPtrGuestCR3;
     1458# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     1459    pPGM->pGstAmd64Pml4R0 = (R0PTRTYPE(PX86PML4))HCPtrGuestCR3;
     1460# endif
     1461
     1462    pgmUnlock(pVM);
     1463    return pPGM->CTX_SUFF(pGstAmd64Pml4);
     1464}
     1465#endif /* VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3 */
     1466
     1467#endif /* VBOX_WITH_NEW_PHYS_CODE */
    13121468
    13131469/**
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r18093 r18125  
    34163416    AssertMsgReturn(HCPhys == HCPhysShw, ("HCPhys=%RHp HCPhyswShw=%RHp (cr3)\n", HCPhys, HCPhysShw), false);
    34173417#  if PGM_GST_TYPE == PGM_TYPE_32BIT && defined(IN_RING3)
     3418    pgmGstGet32bitPDPtr(pPGM);
    34183419    RTGCPHYS GCPhys;
    34193420    rc = PGMR3DbgR3Ptr2GCPhys(pVM, pPGM->pGst32BitPdR3, &GCPhys);
     
    41394140    RTHCPHYS    HCPhysGuestCR3;
    41404141# ifdef VBOX_WITH_NEW_PHYS_CODE
    4141     /** @todo this needs some reworking. current code is just a big hack. */
     4142    pgmLock(pVM);
     4143    PPGMPAGE    pPage = pgmPhysGetPage(&pVM->pgm.s, GCPhysCR3);
     4144    AssertReturn(pPage, VERR_INTERNAL_ERROR);
     4145    HCPhysGuestCR3 = PGM_PAGE_GET_HCPHYS(pPage);
     4146    /** @todo this needs some reworking wrt. locking.  */
    41424147#  if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
    4143 #   if 1 /* temp hack */
    4144     VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
    4145     return VINF_PGM_SYNC_CR3;
    4146 #   else
    4147     AssertFailedReturn(VERR_INTERNAL_ERROR);
    4148 #   endif
    4149     int rc = VERR_INTERNAL_ERROR;
     4148    HCPtrGuestCR3 = NIL_RTHCPTR;
     4149    int rc = VINF_SUCCESS;
    41504150#  else
    4151     pgmLock(pVM);
    4152     PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, GCPhysCR3);
    4153     AssertReturn(pPage, VERR_INTERNAL_ERROR);
    41544151    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhysCR3 & GST_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3);
    4155     HCPhysGuestCR3 = PGM_PAGE_GET_HCPHYS(pPage);
     4152#  endif
    41564153    pgmUnlock(pVM);
    4157 #  endif
    41584154# else  /* !VBOX_WITH_NEW_PHYS_CODE */
    41594155    int rc = pgmRamGCPhys2HCPtrAndHCPhys(&pVM->pgm.s, GCPhysCR3 & GST_CR3_PAGE_MASK, &HCPtrGuestCR3, &HCPhysGuestCR3);
     
    41874183             */
    41884184            PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(&pVM->pgm.s);
    4189             RTGCPTR GCPtr = pVM->pgm.s.GCPtrCR3Mapping + PAGE_SIZE;
     4185            RTGCPTR  GCPtr      = pVM->pgm.s.GCPtrCR3Mapping + PAGE_SIZE;
    41904186            for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++, GCPtr += PAGE_SIZE)
    41914187            {
     
    41964192                    RTGCPHYS    GCPhys = pGuestPDPT->a[i].u & X86_PDPE_PG_MASK;
    41974193#  ifdef VBOX_WITH_NEW_PHYS_CODE
     4194                    pgmLock(pVM);
     4195                    PPGMPAGE    pPage  = pgmPhysGetPage(&pVM->pgm.s, GCPhys);
     4196                    AssertReturn(pPage, VERR_INTERNAL_ERROR);
     4197                    HCPhys = PGM_PAGE_GET_HCPHYS(pPage);
    41984198#   if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
    4199                     AssertFailedReturn(VERR_INTERNAL_ERROR);
    4200                     int rc2 = VERR_INTERNAL_ERROR;
     4199                    HCPtr = NIL_RTHCPTR;
     4200                    int rc2 = VINF_SUCCESS;
    42014201#   else
    4202                     pgmLock(pVM);
    4203                     PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, GCPhys);
    4204                     AssertReturn(pPage, VERR_INTERNAL_ERROR);
    42054202                    int rc2 = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, (void **)&HCPtr);
    4206                     HCPhys = PGM_PAGE_GET_HCPHYS(pPage);
     4203#   endif
    42074204                    pgmUnlock(pVM);
    4208 #   endif
    42094205#  else  /* !VBOX_WITH_NEW_PHYS_CODE */
    42104206                    int rc2 = pgmRamGCPhys2HCPtrAndHCPhys(&pVM->pgm.s, GCPhys, &HCPtr, &HCPhys);
     
    42994295
    43004296#  ifndef PGM_WITHOUT_MAPPINGS
    4301     /* Apply all hypervisor mappings to the new CR3.
     4297    /*
     4298     * Apply all hypervisor mappings to the new CR3.
    43024299     * Note that SyncCR3 will be executed in case CR3 is changed in a guest paging mode; this will
    43034300     * make sure we check for conflicts in the new CR3 root.
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r18101 r18125  
    10071007             */
    10081008            PPGMPAGEMAP pMap = pTlbe->pMap;
    1009             pMap->cRefs++;
     1009            if (pMap)
     1010                pMap->cRefs++;
    10101011#if 0 /** @todo implement locking properly */
    10111012            if (RT_LIKELY(pPage->cLocks != PGM_PAGE_MAX_LOCKS))
     
    10131014                {
    10141015                    AssertMsgFailed(("%RGp is entering permanent locked state!\n", GCPhys));
    1015                     pMap->cRefs++; /* Extra ref to prevent it from going away. */
     1016                    if (pMap)
     1017                        pMap->cRefs++; /* Extra ref to prevent it from going away. */
    10161018                }
    10171019#endif
     
    11131115             */
    11141116            PPGMPAGEMAP pMap = pTlbe->pMap;
    1115             pMap->cRefs++;
     1117            if (pMap)
     1118                pMap->cRefs++;
    11161119#if 0 /** @todo implement locking properly */
    11171120            if (RT_LIKELY(pPage->cLocks != PGM_PAGE_MAX_LOCKS))
     
    11191122                {
    11201123                    AssertMsgFailed(("%RGp is entering permanent locked state!\n", GCPhys));
    1121                     pMap->cRefs++; /* Extra ref to prevent it from going away. */
     1124                    if (pMap)
     1125                        pMap->cRefs++; /* Extra ref to prevent it from going away. */
    11221126                }
    11231127#endif
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