VirtualBox

Changeset 14145 in vbox for trunk/src/VBox/VMM/PGMInternal.h


Ignore:
Timestamp:
Nov 12, 2008 9:59:25 PM (16 years ago)
Author:
vboxsync
Message:

PGM: Some more uint64_t -> X86union return. (btw. doing this because it saves space and permits const locals).

File:
1 edited

Legend:

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

    r14141 r14145  
    34813481 * @param   GCPtr       The address.
    34823482 */
    3483 DECLINLINE(uint64_t) pgmGstGetPaePDE(PPGM pPGM, RTGCPTR GCPtr)
     3483DECLINLINE(X86PDEPAE) pgmGstGetPaePDE(PPGM pPGM, RTGCPTR GCPtr)
    34843484{
    34853485    AssertGCPtr32(GCPtr);
     
    34873487#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    34883488    PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(pPGM);
    3489     AssertReturn(pGuestPDPT, 0);
     3489    if (LIKELY(pGuestPDPT))
    34903490#else
    34913491    PX86PDPT pGuestPDPT = pPGM->CTX_SUFF(pGstPaePDPT);
    34923492#endif
    3493     const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    3494     if (pGuestPDPT->a[iPdPt].n.u1Present)
    34953493    {
    3496         const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
     3494        const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
     3495        if (pGuestPDPT->a[iPdPt].n.u1Present)
     3496        {
     3497            const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
    34973498#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    3498         if ((pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPt])
    3499             return pPGM->CTX_SUFF(apGstPaePDs)[iPdPt]->a[iPD].u;
    3500 #endif
    3501 
    3502         /* cache is out-of-sync. */
    3503         PX86PDPAE pPD;
    3504         int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
    3505         if (RT_SUCCESS(rc))
    3506             return pPD->a[iPD].u;
    3507         AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, pGuestPDPT->a[iPdPt].u));
     3499            if ((pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK) == pPGM->aGCPhysGstPaePDs[iPdPt])
     3500                return pPGM->CTX_SUFF(apGstPaePDs)[iPdPt]->a[iPD];
     3501#endif
     3502
     3503            /* cache is out-of-sync. */
     3504            PX86PDPAE pPD;
     3505            int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), pGuestPDPT->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
     3506            if (RT_SUCCESS(rc))
     3507                return pPD->a[iPD];
     3508            AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, pGuestPDPT->a[iPdPt]));
     3509        }
    35083510    }
    3509     return 0;
     3511    X86PDEPAE ZeroPde = {0};
     3512    return ZeroPde;
    35103513}
    35113514
     
    36653668 * @param   pPdpe       Page directory pointer table entry (out)
    36663669 */
    3667 DECLINLINE(uint64_t) pgmGstGetLongModePDE(PPGM pPGM, RTGCPTR64 GCPtr, PX86PML4E *ppPml4e, PX86PDPE pPdpe)
    3668 {
     3670DECLINLINE(X86PDEPAE) pgmGstGetLongModePDEEx(PPGM pPGM, RTGCPTR64 GCPtr, PX86PML4E *ppPml4e, PX86PDPE pPdpe)
     3671{
     3672    X86PDEPAE       ZeroPde = {0};
    36693673    PX86PML4        pGuestPml4 = pgmGstGetLongModePML4Ptr(pPGM);
    36703674    const unsigned  iPml4  = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK;
     
    36743678        PCX86PDPT   pPdptTemp;
    36753679        int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), pPml4e->u & X86_PML4E_PG_MASK, &pPdptTemp);
    3676         AssertRCReturn(rc, 0);
     3680        AssertRCReturn(rc, ZeroPde);
    36773681
    36783682        const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     
    36823686            PCX86PDPAE pPD;
    36833687            rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
    3684             AssertRCReturn(rc, 0);
     3688            AssertRCReturn(rc, ZeroPde);
    36853689
    36863690            const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
    3687             return pPD->a[iPD].u;
     3691            return pPD->a[iPD];
    36883692        }
    36893693    }
    3690     return 0;
     3694
     3695    return ZeroPde;
    36913696}
    36923697
     
    37003705 * @param   GCPtr       The address.
    37013706 */
    3702 DECLINLINE(uint64_t) pgmGstGetLongModePDE(PPGM pPGM, RTGCPTR64 GCPtr)
    3703 {
     3707DECLINLINE(X86PDEPAE) pgmGstGetLongModePDE(PPGM pPGM, RTGCPTR64 GCPtr)
     3708{
     3709    X86PDEPAE       ZeroPde = {0};
    37043710    PCX86PML4       pGuestPml4 = pgmGstGetLongModePML4Ptr(pPGM);
    37053711    const unsigned  iPml4 = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK;
     
    37083714        PCX86PDPT   pPdptTemp;
    37093715        int rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), pGuestPml4->a[iPml4].u & X86_PML4E_PG_MASK, &pPdptTemp);
    3710         AssertRCReturn(rc, 0);
     3716        AssertRCReturn(rc, ZeroPde);
    37113717
    37123718        const unsigned iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     
    37153721            PCX86PDPAE pPD;
    37163722            rc = PGM_GCPHYS_2_PTR(PGM2VM(pPGM), pPdptTemp->a[iPdPt].u & X86_PDPE_PG_MASK, &pPD);
    3717             AssertRCReturn(rc, 0);
     3723            AssertRCReturn(rc, ZeroPde);
    37183724
    37193725            const unsigned iPD = (GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK;
    3720             return pPD->a[iPD].u;
     3726            return pPD->a[iPD];
    37213727        }
    37223728    }
    3723     return 0;
     3729    return ZeroPde;
    37243730}
    37253731
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