VirtualBox

Changeset 31167 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Jul 28, 2010 2:38:43 PM (15 years ago)
Author:
vboxsync
Message:

PGM: Pass pVCpu instead of pPGM (PPGMCPU) and eliminate PGMPOOL_PAGE_2_PTR_BY_PGM and PGMPOOL_PAGE_2_PTR_BY_PGMCPU.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r31123 r31167  
    6969*******************************************************************************/
    7070DECLINLINE(int) pgmShwGetLongModePDPtr(PVMCPU pVCpu, RTGCPTR64 GCPtr, PX86PML4E *ppPml4e, PX86PDPT *ppPdpt, PX86PDPAE *ppPD);
    71 DECLINLINE(int) pgmShwGetPaePoolPagePD(PPGMCPU pPGM, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde);
     71DECLINLINE(int) pgmShwGetPaePoolPagePD(PVMCPU pVCpu, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde);
    7272#ifndef IN_RC
    7373static int pgmShwSyncLongModePDPtr(PVMCPU pVCpu, RTGCPTR64 GCPtr, X86PGPAEUINT uGstPml4e, X86PGPAEUINT uGstPdpe, PX86PDPAE *ppPD);
     
    920920{
    921921    const unsigned iPdPt    = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    922     PX86PDPT       pPdpt    = pgmShwGetPaePDPTPtr(&pVCpu->pgm.s);
     922    PX86PDPT       pPdpt    = pgmShwGetPaePDPTPtr(pVCpu);
    923923    PX86PDPE       pPdpe    = &pPdpt->a[iPdPt];
    924924    PVM            pVM      = pVCpu->CTX_SUFF(pVM);
     
    10101010 *
    10111011 * @returns Pointer to the PDE.
    1012  * @param   pPGM        Pointer to the PGMCPU instance data.
     1012 * @param   pVCpu       The current CPU.
    10131013 * @param   GCPtr       The address.
    10141014 * @param   ppShwPde    Receives the address of the pgm pool page for the shadow page directory
    10151015 */
    1016 DECLINLINE(int) pgmShwGetPaePoolPagePD(PPGMCPU pPGM, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde)
     1016DECLINLINE(int) pgmShwGetPaePoolPagePD(PVMCPU pVCpu, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde)
    10171017{
    10181018    const unsigned  iPdPt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE;
    1019     PX86PDPT        pPdpt = pgmShwGetPaePDPTPtr(pPGM);
    1020 
    1021     Assert(PGMIsLockOwner(PGMCPU2VM(pPGM)));
     1019    PX86PDPT        pPdpt = pgmShwGetPaePDPTPtr(pVCpu);
     1020    PVM             pVM   = pVCpu->CTX_SUFF(pVM);
     1021
     1022    Assert(PGMIsLockOwner(pVM));
    10221023
    10231024    AssertReturn(pPdpt, VERR_PAGE_DIRECTORY_PTR_NOT_PRESENT);    /* can't happen */
     
    10301031
    10311032    /* Fetch the pgm pool shadow descriptor. */
    1032     PPGMPOOLPAGE pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);
     1033    PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pVM->pgm.s.CTX_SUFF(pPool), pPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);
    10331034    AssertReturn(pShwPde, VERR_INTERNAL_ERROR);
    10341035
     
    10601061    PPGMPOOL       pPool         = pVM->pgm.s.CTX_SUFF(pPool);
    10611062    const unsigned iPml4         = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK;
    1062     PX86PML4E      pPml4e        = pgmShwGetLongModePML4EPtr(pPGM, iPml4);
     1063    PX86PML4E      pPml4e        = pgmShwGetLongModePML4EPtr(pVCpu, iPml4);
    10631064    bool           fNestedPagingOrNoGstPaging = pVM->pgm.s.fNestedPaging || !CPUMIsGuestPagingEnabled(pVCpu);
    10641065    PPGMPOOLPAGE   pShwPage;
     
    11591160    PPGMCPU         pPGM = &pVCpu->pgm.s;
    11601161    const unsigned  iPml4 = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK;
    1161     PCX86PML4E      pPml4e = pgmShwGetLongModePML4EPtr(pPGM, iPml4);
     1162    PCX86PML4E      pPml4e = pgmShwGetLongModePML4EPtr(pVCpu, iPml4);
    11621163
    11631164    Assert(PGMIsLockOwner(PGMCPU2VM(pPGM)));
     
    12021203static int pgmShwGetEPTPDPtr(PVMCPU pVCpu, RTGCPTR64 GCPtr, PEPTPDPT *ppPdpt, PEPTPD *ppPD)
    12031204{
    1204     PPGMCPU        pPGM  = &pVCpu->pgm.s;
    12051205    PVM            pVM   = pVCpu->CTX_SUFF(pVM);
    12061206    const unsigned iPml4 = (GCPtr >> EPT_PML4_SHIFT) & EPT_PML4_MASK;
     
    12141214    Assert(PGMIsLockOwner(pVM));
    12151215
    1216     pPml4 = (PEPTPML4)PGMPOOL_PAGE_2_PTR_BY_PGMCPU(pPGM, pPGM->CTX_SUFF(pShwPageCR3));
     1216    pPml4 = (PEPTPML4)PGMPOOL_PAGE_2_PTR(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
    12171217    Assert(pPml4);
    12181218
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r31141 r31167  
    511511#  if PGM_SHW_TYPE == PGM_TYPE_32BIT
    512512    const unsigned  iPDDst = pvFault >> SHW_PD_SHIFT;
    513     PX86PD          pPDDst = pgmShwGet32BitPDPtr(&pVCpu->pgm.s);
     513    PX86PD          pPDDst = pgmShwGet32BitPDPtr(pVCpu);
    514514
    515515#  elif PGM_SHW_TYPE == PGM_TYPE_PAE
     
    10681068# if PGM_SHW_TYPE == PGM_TYPE_32BIT
    10691069    const unsigned  iPDDst    = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK;
    1070     PX86PDE         pPdeDst   = pgmShwGet32BitPDEPtr(&pVCpu->pgm.s, GCPtrPage);
     1070    PX86PDE         pPdeDst   = pgmShwGet32BitPDEPtr(pVCpu, GCPtrPage);
    10711071
    10721072    /* Fetch the pgm pool shadow descriptor. */
     
    10761076# elif PGM_SHW_TYPE == PGM_TYPE_PAE
    10771077    const unsigned  iPdpt     = (GCPtrPage >> X86_PDPT_SHIFT);
    1078     PX86PDPT        pPdptDst  = pgmShwGetPaePDPTPtr(&pVCpu->pgm.s);
     1078    PX86PDPT        pPdptDst  = pgmShwGetPaePDPTPtr(pVCpu);
    10791079
    10801080    /* If the shadow PDPE isn't present, then skip the invalidate. */
     
    10911091
    10921092    /* Fetch the pgm pool shadow descriptor. */
    1093     rc = pgmShwGetPaePoolPagePD(&pVCpu->pgm.s, GCPtrPage, &pShwPde);
     1093    rc = pgmShwGetPaePoolPagePD(pVCpu, GCPtrPage, &pShwPde);
    10941094    AssertRCSuccessReturn(rc, rc);
    10951095    Assert(pShwPde);
    10961096
    1097     pPDDst             = (PX86PDPAE)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPde);
     1097    pPDDst             = (PX86PDPAE)PGMPOOL_PAGE_2_PTR(pVM, pShwPde);
    10981098    PX86PDEPAE pPdeDst = &pPDDst->a[iPDDst];
    10991099
     
    17271727# if PGM_SHW_TYPE == PGM_TYPE_32BIT
    17281728    const unsigned  iPDDst   = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK;
    1729     PX86PDE         pPdeDst  = pgmShwGet32BitPDEPtr(&pVCpu->pgm.s, GCPtrPage);
     1729    PX86PDE         pPdeDst  = pgmShwGet32BitPDEPtr(pVCpu, GCPtrPage);
    17301730
    17311731    /* Fetch the pgm pool shadow descriptor. */
     
    17391739
    17401740    /* Fetch the pgm pool shadow descriptor. */
    1741     int rc2 = pgmShwGetPaePoolPagePD(&pVCpu->pgm.s, GCPtrPage, &pShwPde);
     1741    int rc2 = pgmShwGetPaePoolPagePD(pVCpu, GCPtrPage, &pShwPde);
    17421742    AssertRCSuccessReturn(rc2, rc2);
    17431743    Assert(pShwPde);
    17441744
    1745     pPDDst             = (PX86PDPAE)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPde);
     1745    pPDDst             = (PX86PDPAE)PGMPOOL_PAGE_2_PTR(pVM, pShwPde);
    17461746    PX86PDEPAE pPdeDst = &pPDDst->a[iPDDst];
    17471747
     
    20572057     */
    20582058#  if PGM_SHW_TYPE == PGM_TYPE_32BIT
    2059     X86PDE          PdeDst = pgmShwGet32BitPDE(&pVCpu->pgm.s, GCPtrPage);
     2059    X86PDE          PdeDst = pgmShwGet32BitPDE(pVCpu, GCPtrPage);
    20602060
    20612061#  elif PGM_SHW_TYPE == PGM_TYPE_PAE
    2062     X86PDEPAE       PdeDst = pgmShwGetPaePDE(&pVCpu->pgm.s, GCPtrPage);
     2062    X86PDEPAE       PdeDst = pgmShwGetPaePDE(pVCpu, GCPtrPage);
    20632063
    20642064#  elif PGM_SHW_TYPE == PGM_TYPE_AMD64
     
    24802480# if PGM_SHW_TYPE == PGM_TYPE_32BIT
    24812481    const unsigned  iPDDst   = GCPtrPage >> SHW_PD_SHIFT;
    2482     PSHWPDE         pPdeDst  = pgmShwGet32BitPDEPtr(&pVCpu->pgm.s, GCPtrPage);
     2482    PSHWPDE         pPdeDst  = pgmShwGet32BitPDEPtr(pVCpu, GCPtrPage);
    24832483
    24842484    /* Fetch the pgm pool shadow descriptor. */
     
    24932493
    24942494    /* Fetch the pgm pool shadow descriptor. */
    2495     rc = pgmShwGetPaePoolPagePD(&pVCpu->pgm.s, GCPtrPage, &pShwPde);
     2495    rc = pgmShwGetPaePoolPagePD(pVCpu, GCPtrPage, &pShwPde);
    24962496    AssertRCSuccessReturn(rc, rc);
    24972497    Assert(pShwPde);
    24982498
    2499     pPDDst  = (PX86PDPAE)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPde);
     2499    pPDDst  = (PX86PDPAE)PGMPOOL_PAGE_2_PTR(pVM, pShwPde);
    25002500    pPdeDst = &pPDDst->a[iPDDst];
    25012501
     
    29342934# if PGM_SHW_TYPE == PGM_TYPE_32BIT
    29352935    const unsigned  iPDDst  = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK;
    2936     PSHWPDE         pPdeDst = pgmShwGet32BitPDEPtr(&pVCpu->pgm.s, GCPtrPage);
     2936    PSHWPDE         pPdeDst = pgmShwGet32BitPDEPtr(pVCpu, GCPtrPage);
    29372937
    29382938    /* Fetch the pgm pool shadow descriptor. */
     
    29472947
    29482948    /* Fetch the pgm pool shadow descriptor. */
    2949     rc = pgmShwGetPaePoolPagePD(&pVCpu->pgm.s, GCPtrPage, &pShwPde);
     2949    rc = pgmShwGetPaePoolPagePD(pVCpu, GCPtrPage, &pShwPde);
    29502950    AssertRCSuccessReturn(rc, rc);
    29512951    Assert(pShwPde);
    29522952
    2953     pPDDst  = (PX86PDPAE)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPde);
     2953    pPDDst  = (PX86PDPAE)PGMPOOL_PAGE_2_PTR(pVM, pShwPde);
    29542954    pPdeDst = &pPDDst->a[iPDDst];
    29552955
     
    31723172
    31733173# if PGM_SHW_TYPE == PGM_TYPE_32BIT
    3174         const X86PDE    PdeDst = pgmShwGet32BitPDE(&pVCpu->pgm.s, GCPtrPage);
     3174        const X86PDE    PdeDst = pgmShwGet32BitPDE(pVCpu, GCPtrPage);
    31753175# elif PGM_SHW_TYPE == PGM_TYPE_PAE
    31763176        const unsigned  iPDDst = ((GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK);
     
    33343334     */
    33353335# if PGM_SHW_TYPE == PGM_TYPE_32BIT
    3336     PX86PDE         pPdeDst = pgmShwGet32BitPDEPtr(&pVCpu->pgm.s, GCPtrPage);
     3336    PX86PDE         pPdeDst = pgmShwGet32BitPDEPtr(pVCpu, GCPtrPage);
    33373337
    33383338# elif PGM_SHW_TYPE == PGM_TYPE_PAE
     
    36563656
    36573657        pPml4eSrc     = pgmGstGetLongModePML4EPtr(pVCpu, iPml4);
    3658         pPml4eDst     = pgmShwGetLongModePML4EPtr(&pVCpu->pgm.s, iPml4);
     3658        pPml4eDst     = pgmShwGetLongModePML4EPtr(pVCpu, iPml4);
    36593659
    36603660        /* Fetch the pgm pool shadow descriptor if the shadow pml4e is present. */
     
    37123712            X86PDPE         PdpeSrc;
    37133713            PGSTPD          pPDSrc    = pgmGstGetPaePDPtr(pVCpu, GCPtr, &iPDSrc, &PdpeSrc);
    3714             PX86PDPT        pPdptDst  = pgmShwGetPaePDPTPtr(&pVCpu->pgm.s);
     3714            PX86PDPT        pPdptDst  = pgmShwGetPaePDPTPtr(pVCpu);
    37153715#  else
    37163716            PX86PML4E       pPml4eSrcIgn;
     
    37803780            GSTPD const    *pPDSrc = pgmGstGet32bitPDPtr(pVCpu);
    37813781#  if PGM_SHW_TYPE == PGM_TYPE_32BIT
    3782             PCX86PD         pPDDst = pgmShwGet32BitPDPtr(&pVCpu->pgm.s);
     3782            PCX86PD         pPDDst = pgmShwGet32BitPDPtr(pVCpu);
    37833783#  endif
    37843784# endif /* PGM_GST_TYPE == PGM_TYPE_32BIT */
     
    37943794            {
    37953795# if PGM_SHW_TYPE == PGM_TYPE_PAE
    3796                 const SHWPDE PdeDst = *pgmShwGetPaePDEPtr(pPGM, GCPtr);
     3796                const SHWPDE PdeDst = *pgmShwGetPaePDEPtr(pVCpu, GCPtr);
    37973797# else
    37983798                const SHWPDE PdeDst = pPDDst->a[iPDDst];
  • trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp

    r31123 r31167  
    245245            case PGMMODE_32_BIT:
    246246            {
    247                 PX86PD pShw32BitPd = pgmShwGet32BitPDPtr(&pVCpu->pgm.s);
     247                PX86PD pShw32BitPd = pgmShwGet32BitPDPtr(pVCpu);
    248248                AssertFatal(pShw32BitPd);
    249249#ifdef IN_RC    /* Lock mapping to prevent it from being reused during pgmPoolFree. */
     
    272272                const uint32_t  iPdPt     = iNewPDE / 256;
    273273                unsigned        iPaePde   = iNewPDE * 2 % 512;
    274                 PX86PDPT        pShwPdpt  = pgmShwGetPaePDPTPtr(&pVCpu->pgm.s);
     274                PX86PDPT        pShwPdpt  = pgmShwGetPaePDPTPtr(pVCpu);
    275275                Assert(pShwPdpt);
    276276#ifdef IN_RC    /* Lock mapping to prevent it from being reused during pgmShwSyncPaePDPtr. */
     
    284284                 *       accessed bit causes invalid VT-x guest state errors.
    285285                 */
    286                 PX86PDPAE pShwPaePd = pgmShwGetPaePDPtr(&pVCpu->pgm.s, iPdPt << X86_PDPT_SHIFT);
     286                PX86PDPAE pShwPaePd = pgmShwGetPaePDPtr(pVCpu, iPdPt << X86_PDPT_SHIFT);
    287287                if (!pShwPaePd)
    288288                {
     
    407407        &&  pShwPageCR3 != pVCpu->pgm.s.CTX_SUFF(pShwPageCR3))
    408408    {
    409         pCurrentShwPdpt = pgmShwGetPaePDPTPtr(&pVCpu->pgm.s);
     409        pCurrentShwPdpt = pgmShwGetPaePDPTPtr(pVCpu);
    410410#ifdef IN_RC    /* Lock mapping to prevent it from being reused (currently not possible). */
    411411        if (pCurrentShwPdpt)
     
    426426            case PGMMODE_32_BIT:
    427427            {
    428                 PX86PD          pShw32BitPd = (PX86PD)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3);
     428                PX86PD          pShw32BitPd = (PX86PD)PGMPOOL_PAGE_2_PTR(pVM, pShwPageCR3);
    429429                AssertFatal(pShw32BitPd);
    430430
     
    439439                const unsigned  iPdpt     = iOldPDE / 256;      /* iOldPDE * 2 / 512; iOldPDE is in 4 MB pages */
    440440                unsigned        iPaePde   = iOldPDE * 2 % 512;
    441                 PX86PDPT        pShwPdpt  = (PX86PDPT)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3);
    442                 PX86PDPAE       pShwPaePd = pgmShwGetPaePDPtr(&pVCpu->pgm.s, pShwPdpt, (iPdpt << X86_PDPT_SHIFT));
     441                PX86PDPT        pShwPdpt  = (PX86PDPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPageCR3);
     442                PX86PDPAE       pShwPaePd = pgmShwGetPaePDPtr(pVCpu, pShwPdpt, (iPdpt << X86_PDPT_SHIFT));
    443443
    444444                /*
     
    538538            case PGMMODE_32_BIT:
    539539            {
    540                 PCX86PD         pShw32BitPd = (PCX86PD)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3);
     540                PCX86PD         pShw32BitPd = (PCX86PD)PGMPOOL_PAGE_2_PTR(pVM, pShwPageCR3);
    541541                AssertFatal(pShw32BitPd);
    542542
     
    553553                const unsigned  iPdpt     = iPDE / 256;         /* iPDE * 2 / 512; iPDE is in 4 MB pages */
    554554                unsigned        iPaePDE   = iPDE * 2 % 512;
    555                 PX86PDPT        pShwPdpt  = (PX86PDPT)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3);
    556                 PCX86PDPAE      pShwPaePd = pgmShwGetPaePDPtr(&pVCpu->pgm.s, pShwPdpt, iPdpt << X86_PDPT_SHIFT);
     555                PX86PDPT        pShwPdpt  = (PX86PDPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPageCR3);
     556                PCX86PDPAE      pShwPaePd = pgmShwGetPaePDPtr(pVCpu, pShwPdpt, iPdpt << X86_PDPT_SHIFT);
    557557                AssertFatal(pShwPaePd);
    558558
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r31069 r31167  
    151151
    152152    /* PML4 */
    153     X86PML4E        Pml4e = pgmShwGetLongModePML4E(&pVCpu->pgm.s, GCPtr);
     153    X86PML4E        Pml4e = pgmShwGetLongModePML4E(pVCpu, GCPtr);
    154154    if (!Pml4e.n.u1Present)
    155155        return VERR_PAGE_TABLE_NOT_PRESENT;
     
    180180
    181181# elif PGM_SHW_TYPE == PGM_TYPE_PAE
    182     X86PDEPAE       Pde = pgmShwGetPaePDE(&pVCpu->pgm.s, GCPtr);
     182    X86PDEPAE       Pde = pgmShwGetPaePDE(pVCpu, GCPtr);
    183183
    184184# elif PGM_SHW_TYPE == PGM_TYPE_EPT
     
    197197
    198198# else /* PGM_TYPE_32BIT */
    199     X86PDE          Pde = pgmShwGet32BitPDE(&pVCpu->pgm.s, GCPtr);
     199    X86PDE          Pde = pgmShwGet32BitPDE(pVCpu, GCPtr);
    200200# endif
    201201    if (!Pde.n.u1Present)
     
    317317        X86PDEPAE       Pde;
    318318        /* PML4 */
    319         X86PML4E        Pml4e = pgmShwGetLongModePML4E(&pVCpu->pgm.s, GCPtr);
     319        X86PML4E        Pml4e = pgmShwGetLongModePML4E(pVCpu, GCPtr);
    320320        if (!Pml4e.n.u1Present)
    321321            return VERR_PAGE_TABLE_NOT_PRESENT;
     
    340340
    341341# elif PGM_SHW_TYPE == PGM_TYPE_PAE
    342         X86PDEPAE       Pde = pgmShwGetPaePDE(&pVCpu->pgm.s, GCPtr);
     342        X86PDEPAE       Pde = pgmShwGetPaePDE(pVCpu, GCPtr);
    343343
    344344# elif PGM_SHW_TYPE == PGM_TYPE_EPT
     
    357357
    358358# else /* PGM_TYPE_32BIT */
    359         X86PDE          Pde = pgmShwGet32BitPDE(&pVCpu->pgm.s, GCPtr);
     359        X86PDE          Pde = pgmShwGet32BitPDE(pVCpu, GCPtr);
    360360# endif
    361361        if (!Pde.n.u1Present)
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