VirtualBox

Changeset 14141 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 12, 2008 7:12:30 PM (16 years ago)
Author:
vboxsync
Message:

PGM: More union returns.

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

Legend:

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

    r14138 r14141  
    32973297 * @param   GCPtr       The address.
    32983298 */
    3299 DECLINLINE(X86PGUINT) pgmGstGet32bitPDE(PPGM pPGM, RTGCPTR GCPtr)
     3299DECLINLINE(X86PDE) pgmGstGet32bitPDE(PPGM pPGM, RTGCPTR GCPtr)
    33003300{
    33013301#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    33023302    PCX86PD pGuestPD = 0;
    33033303    int rc = PGMDynMapGCPage(PGM2VM(pPGM), pPGM->GCPhysCR3, (void **)pGuestPD);
    3304     AssertRCReturn(rc, 0);
    3305     return pGuestPD->a[GCPtr >> X86_PD_SHIFT].u;
    3306 #else
    3307     return pPGM->CTX_SUFF(pGuestPD)->a[GCPtr >> X86_PD_SHIFT].u;
     3304    if (RT_FAILURE(rc))
     3305    {
     3306        X86PDE ZeroPde = {0};
     3307        AssertMsgFailedReturn(("%Rrc\n", rc), ZeroPde);
     3308    }
     3309    return pGuestPD->a[GCPtr >> X86_PD_SHIFT];
     3310#else
     3311    return pPGM->CTX_SUFF(pGuestPD)->a[GCPtr >> X86_PD_SHIFT];
    33083312#endif
    33093313}
     
    36063610 * @param   iPml4       The index.
    36073611 */
    3608 DECLINLINE(X86PGPAEUINT) pgmGstGetLongModePML4E(PPGM pPGM, unsigned int iPml4)
     3612DECLINLINE(X86PML4E) pgmGstGetLongModePML4E(PPGM pPGM, unsigned int iPml4)
    36093613{
    36103614#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    36113615    PX86PML4 pGuestPml4;
    36123616    int rc = PGMDynMapGCPage(PGM2VM(pPGM), pPGM->GCPhysCR3, (void **)pGuestPml4);
    3613     AssertRCReturn(rc, 0);
    3614     return pGuestPml4->a[iPml4].u;
     3617    if (RT_FAILURE(rc))
     3618    {
     3619        X86PML4E ZeroPml4e = {0};
     3620        AssertMsgFailedReturn(("%Rrc\n", rc), ZeroPml4e);
     3621    }
     3622    return pGuestPml4->a[iPml4];
    36153623#else
    36163624    Assert(pPGM->CTX_SUFF(pGstAmd64PML4));
    3617     return pPGM->CTX_SUFF(pGstAmd64PML4)->a[iPml4].u;
     3625    return pPGM->CTX_SUFF(pGstAmd64PML4)->a[iPml4];
    36183626#endif
    36193627}
     
    38483856    if (RT_FAILURE(rc))
    38493857    {
    3850         X86PDEPAE ZeroPDE = {0};
    3851         return ZeroPDE;
     3858        X86PDEPAE ZeroPde = {0};
     3859        AssertMsgFailedReturn(("%Rrc\n", rc), ZeroPde);
    38523860    }
    38533861    return pPD->a[iPd];
     
    39103918 * @param   GCPtr       The address.
    39113919 */
    3912 DECLINLINE(X86PGPAEUINT) pgmShwGetLongModePML4E(PPGM pPGM, RTGCPTR GCPtr)
     3920DECLINLINE(X86PML4E) pgmShwGetLongModePML4E(PPGM pPGM, RTGCPTR GCPtr)
    39133921{
    39143922    const unsigned  iPml4 = ((RTGCUINTPTR64)GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK;
     
    39173925    Assert(pPGM->HCPhysPaePML4 != 0 && pPGM->HCPhysPaePML4 != NIL_RTHCPHYS);
    39183926    int rc = PGM_HCPHYS_2_PTR(PGM2VM(pPGM), pPGM->HCPhysPaePML4, &pShwPml4);
    3919     AssertRCReturn(rc, 0);
    3920     return pShwPml4->a[iPml4].u;
     3927    if (RT_FAILURE(rc))
     3928    {
     3929        X86PML4E ZeroPml4e = {0};
     3930        AssertMsgFailedReturn(("%Rrc\n", rc), ZeroPml4e);
     3931    }
     3932    return pShwPml4->a[iPml4];
    39213933# else
    39223934    Assert(pPGM->CTX_SUFF(pShwPaePml4));
    3923     return pPGM->CTX_SUFF(pShwPaePml4)->a[iPml4].u;
     3935    return pPGM->CTX_SUFF(pShwPaePml4)->a[iPml4];
    39243936# endif
    39253937}
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r14114 r14141  
    932932             *        are fine.) */
    933933            Assert(pVM->pgm.s.CTX_SUFF(pShwAmd64CR3));
    934             Pml4eGst.u = pgmGstGetLongModePML4E(&pVM->pgm.s, iPml4);
     934            Pml4eGst = pgmGstGetLongModePML4E(&pVM->pgm.s, iPml4);
    935935
    936936            rc = pgmPoolAlloc(pVM, Pml4eGst.u & X86_PML4E_PG_MASK,
     
    971971            /** @todo why are we looking up the guest PDPTE here?  Isn't pGstPdpe
    972972             *        trustworthy? */
    973             Pml4eGst.u = pgmGstGetLongModePML4E(&pVM->pgm.s, iPml4);
     973            Pml4eGst = pgmGstGetLongModePML4E(&pVM->pgm.s, iPml4);
    974974            PX86PDPT pPdptGst;
    975975            rc = PGM_GCPHYS_2_PTR(pVM, Pml4eGst.u & X86_PML4E_PG_MASK, &pPdptGst);
  • trunk/src/VBox/VMM/VMMAll/PGMAllGst.h

    r14010 r14141  
    179179     */
    180180# if PGM_GST_TYPE == PGM_TYPE_32BIT
    181     X86PDE Pde;
    182     Pde.u = pgmGstGet32bitPDE(&pVM->pgm.s, GCPtr);
     181    X86PDE      Pde = pgmGstGet32bitPDE(&pVM->pgm.s, GCPtr);
    183182
    184183#elif PGM_GST_TYPE == PGM_TYPE_PAE
    185     X86PDEPAE    Pde;
    186     bool         fNoExecuteBitValid = !!(CPUMGetGuestEFER(pVM) & MSR_K6_EFER_NXE);
     184    X86PDEPAE   Pde;
     185    bool        fNoExecuteBitValid = !!(CPUMGetGuestEFER(pVM) & MSR_K6_EFER_NXE);
    187186
    188187    /* pgmGstGetPaePDE will return 0 if the PDPTE is marked as not present
     
    192191
    193192#elif PGM_GST_TYPE == PGM_TYPE_AMD64
    194     PX86PML4E    pPml4e;
    195     X86PDPE      Pdpe;
    196     X86PDEPAE    Pde;
    197     bool         fNoExecuteBitValid = !!(CPUMGetGuestEFER(pVM) & MSR_K6_EFER_NXE);
     193    PX86PML4E   pPml4e;
     194    X86PDPE     Pdpe;
     195    X86PDEPAE   Pde;
     196    bool        fNoExecuteBitValid = !!(CPUMGetGuestEFER(pVM) & MSR_K6_EFER_NXE);
    198197
    199198    Pde.u = pgmGstGetLongModePDE(&pVM->pgm.s, GCPtr, &pPml4e, &Pdpe);
     
    401400
    402401# if PGM_GST_TYPE == PGM_TYPE_32BIT
    403     X86PDE    Pde;
    404     Pde.u = pgmGstGet32bitPDE(&pVM->pgm.s, GCPtr);
     402    X86PDE    Pde = pgmGstGet32bitPDE(&pVM->pgm.s, GCPtr);
    405403# elif PGM_GST_TYPE == PGM_TYPE_PAE
    406404    X86PDEPAE Pde;
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r14138 r14141  
    149149
    150150    /* PML4 */
    151     X86PML4E        Pml4e;
    152     Pml4e.u = pgmShwGetLongModePML4E(&pVM->pgm.s, GCPtr);
     151    X86PML4E        Pml4e = pgmShwGetLongModePML4E(&pVM->pgm.s, GCPtr);
    153152    if (!Pml4e.n.u1Present)
    154153        return VERR_PAGE_TABLE_NOT_PRESENT;
     
    294293        X86PDEPAE       Pde;
    295294        /* PML4 */
    296         X86PML4E        Pml4e;
    297         Pml4e.u = pgmShwGetLongModePML4E(&pVM->pgm.s, GCPtr);
     295        X86PML4E        Pml4e = pgmShwGetLongModePML4E(&pVM->pgm.s, GCPtr);
    298296        if (!Pml4e.n.u1Present)
    299297            return VERR_PAGE_TABLE_NOT_PRESENT;
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