VirtualBox

Changeset 80182 in vbox for trunk/src


Ignore:
Timestamp:
Aug 7, 2019 11:17:11 AM (5 years ago)
Author:
vboxsync
Message:

VMM: Kicking out raw-mode - Eliminated more RCPTRTYPE use in PGM. bugref:9517

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

Legend:

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

    r80181 r80182  
    179179        pNew->pvUserR3      = pvUserR3;
    180180        pNew->pvUserR0      = pvUserR0;
    181         pNew->pvUserRC      = pvUserRC;
    182181        pNew->hType         = hType;
    183182        pNew->pszDesc       = pszDesc != NIL_RTR3PTR ? pszDesc : pType->pszDesc;
     
    208207                                      pPhysHandlerSrc->pvUserR3,
    209208                                      pPhysHandlerSrc->pvUserR0,
    210                                       pPhysHandlerSrc->pvUserRC,
     209                                      NIL_RTR0PTR,
    211210                                      pPhysHandlerSrc->pszDesc,
    212211                                      ppPhysHandler);
     
    951950
    952951/**
    953  * Changes the user callback arguments associated with a physical access
    954  * handler.
     952 * Changes the user callback arguments associated with a physical access handler.
    955953 *
    956954 * @returns VBox status code.
     
    959957 * @param   pvUserR3        User argument to the R3 handler.
    960958 * @param   pvUserR0        User argument to the R0 handler.
    961  * @param   pvUserRC        User argument to the RC handler. Values larger or
    962  *                          equal to 0x10000 will be relocated automatically.
    963  */
    964 VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC)
     959 */
     960VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0)
    965961{
    966962    /*
     
    977973        pCur->pvUserR3 = pvUserR3;
    978974        pCur->pvUserR0 = pvUserR0;
    979         pCur->pvUserRC = pvUserRC;
    980975    }
    981976    else
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r80177 r80182  
    25902590            PPGMPOOLPAGE pNewHead = &pPool->aPages[pPage->iMonitoredNext];
    25912591            pNewHead->iMonitoredPrev = NIL_PGMPOOL_IDX;
    2592             rc = PGMHandlerPhysicalChangeUserArgs(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK, MMHyperCCToR3(pVM, pNewHead),
    2593                                                   MMHyperCCToR0(pVM, pNewHead), MMHyperCCToRC(pVM, pNewHead));
     2592            rc = PGMHandlerPhysicalChangeUserArgs(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK,
     2593                                                  MMHyperCCToR3(pVM, pNewHead), MMHyperCCToR0(pVM, pNewHead));
    25942594
    25952595            AssertFatalRCSuccess(rc);
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r80181 r80182  
    673673static DECLCALLBACK(void) pgmR3InfoMode(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
    674674static DECLCALLBACK(void) pgmR3InfoCr3(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
    675 static DECLCALLBACK(int)  pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, void *pvUser);
    676675#ifdef VBOX_STRICT
    677676static FNVMATSTATE        pgmR3ResetNoMorePhysWritesFlag;
     
    18681867     */
    18691868    if (pVM->pgm.s.pRamRangesXR3)
    1870     {
    1871         /* Update the pSelfRC pointers and relink them. */
    1872         for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesXR3; pCur; pCur = pCur->pNextR3)
    1873             if (!(pCur->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING))
    1874                 pCur->pSelfRC = MMHyperCCToRC(pVM, pCur);
    18751869        pgmR3PhysRelinkRamRanges(pVM);
    1876     }
    1877 
    1878     /*
    1879      * Update the pSelfRC pointer of the MMIO2 ram ranges since they might not
    1880      * be mapped and thus not included in the above exercise.
    1881      */
    1882     for (PPGMREGMMIORANGE pCur = pVM->pgm.s.pRegMmioRangesR3; pCur; pCur = pCur->pNextR3)
    1883         if (!(pCur->RamRange.fFlags & PGM_RAM_RANGE_FLAGS_FLOATING))
    1884             pCur->RamRange.pSelfRC = MMHyperCCToRC(pVM, &pCur->RamRange);
    18851870
    18861871#ifndef PGM_WITHOUT_MAPPINGS
     
    19361921
    19371922    /*
    1938      * Physical and virtual handlers.
    1939      */
    1940     PGMRELOCHANDLERARGS Args = { offDelta, pVM };
    1941     RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers,     true, pgmR3RelocatePhysHandler,      &Args);
    1942 
    1943     PPGMPHYSHANDLERTYPEINT pCurPhysType;
    1944     RTListOff32ForEach(&pVM->pgm.s.pTreesR3->HeadPhysHandlerTypes, pCurPhysType, PGMPHYSHANDLERTYPEINT, ListNode)
    1945     {
    1946         if (pCurPhysType->pfnHandlerRC != NIL_RTRCPTR)
    1947             pCurPhysType->pfnHandlerRC += offDelta;
    1948         if (pCurPhysType->pfnPfHandlerRC != NIL_RTRCPTR)
    1949             pCurPhysType->pfnPfHandlerRC += offDelta;
    1950     }
    1951 
    1952     /*
    19531923     * The page pool.
    19541924     */
    19551925    pgmR3PoolRelocate(pVM);
    1956 }
    1957 
    1958 
    1959 /**
    1960  * Callback function for relocating a physical access handler.
    1961  *
    1962  * @returns 0 (continue enum)
    1963  * @param   pNode       Pointer to a PGMPHYSHANDLER node.
    1964  * @param   pvUser      Pointer to a PGMRELOCHANDLERARGS.
    1965  */
    1966 static DECLCALLBACK(int) pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, void *pvUser)
    1967 {
    1968     PPGMPHYSHANDLER         pHandler = (PPGMPHYSHANDLER)pNode;
    1969     PCPGMRELOCHANDLERARGS   pArgs    = (PCPGMRELOCHANDLERARGS)pvUser;
    1970     if (pHandler->pvUserRC >= 0x10000)
    1971         pHandler->pvUserRC += pArgs->offDelta;
    1972     return 0;
    19731926}
    19741927
  • trunk/src/VBox/VMM/VMMR3/PGMHandler.cpp

    r80166 r80182  
    8484                                                       R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0,
    8585                                                       R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
    86                                                        RCPTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerRC,
    87                                                        RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
    8886                                                       const char *pszDesc, PPGMPHYSHANDLERTYPE phType)
    8987{
     
    9189    AssertReturn(pfnHandlerR0   != NIL_RTR0PTR, VERR_INVALID_POINTER);
    9290    AssertReturn(pfnPfHandlerR0 != NIL_RTR0PTR, VERR_INVALID_POINTER);
    93     AssertReturn(pfnHandlerRC   != NIL_RTRCPTR || !VM_IS_RAW_MODE_ENABLED(pVM), VERR_INVALID_POINTER);
    94     AssertReturn(pfnPfHandlerRC != NIL_RTRCPTR || !VM_IS_RAW_MODE_ENABLED(pVM), VERR_INVALID_POINTER);
    9591    AssertPtrReturn(pszDesc, VERR_INVALID_POINTER);
    9692    AssertReturn(   enmKind == PGMPHYSHANDLERKIND_WRITE
     
    111107        pType->pfnHandlerR0     = pfnHandlerR0;
    112108        pType->pfnPfHandlerR0   = pfnPfHandlerR0;
    113         pType->pfnHandlerRC     = pfnHandlerRC;
    114         pType->pfnPfHandlerRC   = pfnPfHandlerRC;
    115109        pType->pszDesc          = pszDesc;
    116110
     
    120114
    121115        *phType = MMHyperHeapPtrToOffset(pVM, pType);
    122         LogFlow(("PGMR3HandlerPhysicalTypeRegisterEx: %p/%#x: enmKind=%d pfnHandlerR3=%RHv pfnHandlerR0=%RHv pfnHandlerRC=%RRv pszDesc=%s\n",
    123                  pType, *phType, enmKind, pfnHandlerR3, pfnPfHandlerR0, pfnPfHandlerRC, pszDesc));
     116        LogFlow(("PGMR3HandlerPhysicalTypeRegisterEx: %p/%#x: enmKind=%d pfnHandlerR3=%RHv pfnHandlerR0=%RHv pszDesc=%s\n",
     117                 pType, *phType, enmKind, pfnHandlerR3, pfnPfHandlerR0, pszDesc));
    124118        return VINF_SUCCESS;
    125119    }
     
    208202            if (RT_SUCCESS(rc))
    209203                return PGMR3HandlerPhysicalTypeRegisterEx(pVM, enmKind, pfnHandlerR3,
    210                                                           pfnHandlerR0, pfnPfHandlerR0,
    211                                                           pfnHandlerRC, pfnPfHandlerRC,
    212                                                           pszDesc, phType);
     204                                                          pfnHandlerR0, pfnPfHandlerR0, pszDesc, phType);
    213205        }
    214206        else
     
    397389    }
    398390    pHlp->pfnPrintf(pHlp,
    399         "%RGp - %RGp  %RHv  %RHv  %RRv  %RRv  %s  %s\n",
    400         pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCur->pvUserR3, pCurType->pfnPfHandlerRC, pCur->pvUserRC,
    401                     pszType, pCur->pszDesc);
     391                    "%RGp - %RGp  %RHv  %RHv  %RHv  %RHv  %s  %s\n",
     392                    pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCur->pvUserR3,
     393                    pCurType->pfnPfHandlerR0, pCur->pvUserR0, pszType, pCur->pszDesc);
    402394#ifdef VBOX_WITH_STATISTICS
    403395    if (pArgs->fStats)
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r80181 r80182  
    884884        (a_pNode)->pLeftR0  = NIL_RTR0PTR; \
    885885        (a_pNode)->pRightR0 = NIL_RTR0PTR; \
    886         (a_pNode)->pLeftRC  = NIL_RTRCPTR; \
    887         (a_pNode)->pRightRC = NIL_RTRCPTR; \
    888886    } while (0)
    889887
     
    892890        (a_pParent)->pLeftR3 = (a_pNode); \
    893891        (a_pParent)->pLeftR0 = (a_pNode)->pSelfR0; \
    894         (a_pParent)->pLeftRC = (a_pNode)->pSelfRC; \
    895892    } while (0)
    896893#define INSERT_RIGHT(a_pParent, a_pNode) \
     
    898895        (a_pParent)->pRightR3 = (a_pNode); \
    899896        (a_pParent)->pRightR0 = (a_pNode)->pSelfR0; \
    900         (a_pParent)->pRightRC = (a_pNode)->pSelfRC; \
    901897    } while (0)
    902898
     
    10321028    {
    10331029        Assert((pCur->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pCur->pSelfR0 == MMHyperCCToR0(pVM, pCur));
    1034         Assert((pCur->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pCur->pSelfRC == MMHyperCCToRC(pVM, pCur));
    10351030        Assert((pCur->GCPhys     & PAGE_OFFSET_MASK) == 0);
    10361031        Assert((pCur->GCPhysLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK);
     
    10491044
    10501045        for (; pCur->pNextR3; pCur = pCur->pNextR3)
    1051         {
    10521046            pCur->pNextR0 = pCur->pNextR3->pSelfR0;
    1053             pCur->pNextRC = pCur->pNextR3->pSelfRC;
    1054         }
    10551047
    10561048        Assert(pCur->pNextR0 == NIL_RTR0PTR);
    1057         Assert(pCur->pNextRC == NIL_RTRCPTR);
    10581049    }
    10591050    else
     
    10781069    AssertMsg(pNew->pszDesc, ("%RGp-%RGp\n", pNew->GCPhys, pNew->GCPhysLast));
    10791070    Assert((pNew->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pNew->pSelfR0 == MMHyperCCToR0(pVM, pNew));
    1080     Assert((pNew->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pNew->pSelfRC == MMHyperCCToRC(pVM, pNew));
    10811071
    10821072    pgmLock(pVM);
     
    10851075    pNew->pNextR3 = pRam;
    10861076    pNew->pNextR0 = pRam ? pRam->pSelfR0 : NIL_RTR0PTR;
    1087     pNew->pNextRC = pRam ? pRam->pSelfRC : NIL_RTRCPTR;
    10881077
    10891078    if (pPrev)
     
    10911080        pPrev->pNextR3 = pNew;
    10921081        pPrev->pNextR0 = pNew->pSelfR0;
    1093         pPrev->pNextRC = pNew->pSelfRC;
    10941082    }
    10951083    else
     
    11161104    Assert(pPrev ? pPrev->pNextR3 == pRam : pVM->pgm.s.pRamRangesXR3 == pRam);
    11171105    Assert((pRam->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pRam->pSelfR0 == MMHyperCCToR0(pVM, pRam));
    1118     Assert((pRam->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pRam->pSelfRC == MMHyperCCToRC(pVM, pRam));
    11191106
    11201107    pgmLock(pVM);
     
    11251112        pPrev->pNextR3 = pNext;
    11261113        pPrev->pNextR0 = pNext ? pNext->pSelfR0 : NIL_RTR0PTR;
    1127         pPrev->pNextRC = pNext ? pNext->pSelfRC : NIL_RTRCPTR;
    11281114    }
    11291115    else
     
    16661652     */
    16671653    pNew->pSelfR0       = R0PtrNew != NIL_RTR0PTR ? R0PtrNew : MMHyperCCToR0(pVM, pNew);
    1668     pNew->pSelfRC       = RCPtrNew != NIL_RTRCPTR ? RCPtrNew : MMHyperCCToRC(pVM, pNew);
    16691654    pNew->GCPhys        = GCPhys;
    16701655    pNew->GCPhysLast    = GCPhysLast;
     
    24462431        /* Initialize the range. */
    24472432        pNew->pSelfR0       = MMHyperCCToR0(pVM, pNew);
    2448         pNew->pSelfRC       = MMHyperCCToRC(pVM, pNew);
    24492433        pNew->GCPhys        = GCPhys;
    24502434        pNew->GCPhysLast    = GCPhysLast;
     
    27892773            pNew->RamRange.pSelfR0  = R0PtrChunk + RT_UOFFSETOF(PGMREGMMIORANGE, RamRange);
    27902774
    2791             /*
    2792              * If we might end up in raw-mode, make a HMA mapping of the range,
    2793              * just like we do for memory above 4GB.
    2794              */
    2795             if (!VM_IS_RAW_MODE_ENABLED(pVM))
    2796                 pNew->RamRange.pSelfRC  = NIL_RTRCPTR;
    2797             else
    2798             {
    2799                 RTGCPTR         GCPtrChunkMap = pVM->pgm.s.GCPtrPrevRamRangeMapping - RT_ALIGN_Z(cbChunk, _4M);
    2800                 RTGCPTR const   GCPtrChunk    = GCPtrChunkMap + PAGE_SIZE;
    2801 #ifndef PGM_WITHOUT_MAPPINGS
    2802                 rc = PGMR3MapPT(pVM, GCPtrChunkMap, (uint32_t)cbChunk, 0 /*fFlags*/, pgmR3PhysMMIOExRangeRelocate, pNew, pszDesc);
    2803                 if (RT_SUCCESS(rc))
    2804                 {
    2805 #endif /* !PGM_WITHOUT_MAPPINGS */
    2806                     pVM->pgm.s.GCPtrPrevRamRangeMapping = GCPtrChunkMap;
    2807 #ifndef PGM_WITHOUT_MAPPINGS
    2808                     RTGCPTR GCPtrPage  = GCPtrChunk;
    2809                     for (uint32_t iPage = 0; iPage < cChunkPages && RT_SUCCESS(rc); iPage++, GCPtrPage += PAGE_SIZE)
    2810                         rc = PGMMap(pVM, GCPtrPage, paChunkPages[iPage].Phys, PAGE_SIZE, 0);
    2811                 }
    2812                 if (RT_FAILURE(rc))
    2813                 {
    2814                     SUPR3PageFreeEx(pvChunk, cChunkPages);
    2815                     RTMemTmpFree(paChunkPages);
    2816                     break;
    2817                 }
    2818 #endif /* !PGM_WITHOUT_MAPPINGS */
    2819                 pNew->RamRange.pSelfRC  = GCPtrChunk + RT_UOFFSETOF(PGMREGMMIORANGE, RamRange);
    2820             }
    28212775            RTMemTmpFree(paChunkPages);
    28222776        }
     
    28342788            //pNew->RamRange.fFlags = 0;
    28352789            pNew->RamRange.pSelfR0  = MMHyperCCToR0(pVM, &pNew->RamRange);
    2836             pNew->RamRange.pSelfRC  = MMHyperCCToRC(pVM, &pNew->RamRange);
    28372790        }
    28382791
     
    42424195            {
    42434196                pRamNew->pSelfR0       = MMHyperCCToR0(pVM, pRamNew);
    4244                 pRamNew->pSelfRC       = MMHyperCCToRC(pVM, pRamNew);
    42454197                pRamNew->GCPhys        = GCPhys;
    42464198                pRamNew->GCPhysLast    = GCPhysLast;
     
    43944346                        pRomNew->pNextR3 = pRom;
    43954347                        pRomNew->pNextR0 = pRom ? MMHyperCCToR0(pVM, pRom) : NIL_RTR0PTR;
    4396                         pRomNew->pNextRC = pRom ? MMHyperCCToRC(pVM, pRom) : NIL_RTRCPTR;
    43974348
    43984349                        if (pRomPrev)
     
    44004351                            pRomPrev->pNextR3 = pRomNew;
    44014352                            pRomPrev->pNextR0 = MMHyperCCToR0(pVM, pRomNew);
    4402                             pRomPrev->pNextRC = MMHyperCCToRC(pVM, pRomNew);
    44034353                        }
    44044354                        else
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r80181 r80182  
    535535    /** Pointer to next entry. */
    536536    R0PTRTYPE(struct PGMMAPPING *)      pNextR0;
    537     /** Pointer to next entry. */
    538     RCPTRTYPE(struct PGMMAPPING *)      pNextRC;
    539537    /** Indicate whether this entry is finalized. */
    540538    bool                                fFinalized;
     539    bool                                afPadding[7];
    541540    /** Start Virtual address. */
    542541    RTGCPTR                             GCPtr;
     
    574573        /** The HC virtual address of the two PAE page table. (i.e 1024 entries instead of 512) */
    575574        R3PTRTYPE(PPGMSHWPTPAE)         paPaePTsR3;
    576         /** The RC virtual address of the 32-bit page table. */
    577         RCPTRTYPE(PX86PT)               pPTRC;
    578         /** The RC virtual address of the two PAE page table. */
    579         RCPTRTYPE(PPGMSHWPTPAE)         paPaePTsRC;
    580575        /** The R0 virtual address of the 32-bit page table. */
    581576        R0PTRTYPE(PX86PT)               pPTR0;
     
    605600    /** The PGM_PAGE_HNDL_PHYS_STATE_XXX value corresponding to enmKind. */
    606601    uint32_t                            uState;
    607     /** Pointer to RC callback function. */
    608     RCPTRTYPE(PFNPGMPHYSHANDLER)        pfnHandlerRC;
    609     /** Pointer to RC callback function for \#PFs. */
    610     RCPTRTYPE(PFNPGMRZPHYSPFHANDLER)    pfnPfHandlerRC;
    611602    /** Pointer to R3 callback function. */
    612603    R3PTRTYPE(PFNPGMPHYSHANDLER)        pfnHandlerR3;
     
    651642    /** Registered handler type handle (heap offset). */
    652643    PGMPHYSHANDLERTYPE                  hType;
    653     /** User argument for RC handlers. */
    654     RCPTRTYPE(void *)                   pvUserRC;
    655 #if HC_ARCH_BITS == 64
    656     RTRCPTR                             Padding0; /**< Explicit alignment padding. */
    657 #endif
    658644    /** User argument for R3 handlers. */
    659645    R3PTRTYPE(void *)                   pvUserR3;
     
    12981284    /** Pointer to the next RAM range - for R0. */
    12991285    R0PTRTYPE(struct PGMRAMRANGE *)     pNextR0;
    1300     /** Pointer to the next RAM range - for RC. */
    1301     RCPTRTYPE(struct PGMRAMRANGE *)     pNextRC;
    13021286    /** PGM_RAM_RANGE_FLAGS_* flags. */
    13031287    uint32_t                            fFlags;
     1288    uint32_t                            fPadding1;
    13041289    /** Last address in the range (inclusive). Page aligned (-1). */
    13051290    RTGCPHYS                            GCPhysLast;
     
    13121297    /** Pointer to self - R0 pointer. */
    13131298    R0PTRTYPE(struct PGMRAMRANGE *)     pSelfR0;
    1314     /** Pointer to self - RC pointer. */
    1315     RCPTRTYPE(struct PGMRAMRANGE *)     pSelfRC;
    1316 
    1317     /** Alignment padding. */
    1318     RTRCPTR                             Alignment0;
     1299
    13191300    /** Pointer to the left search three node - ring-3 context. */
    13201301    R3PTRTYPE(struct PGMRAMRANGE *)     pLeftR3;
     
    13251306    /** Pointer to the right search three node - ring-0 context. */
    13261307    R0PTRTYPE(struct PGMRAMRANGE *)     pRightR0;
    1327     /** Pointer to the left search three node - raw-mode context. */
    1328     RCPTRTYPE(struct PGMRAMRANGE *)     pLeftRC;
    1329     /** Pointer to the right search three node - raw-mode context. */
    1330     RCPTRTYPE(struct PGMRAMRANGE *)     pRightRC;
    13311308
    13321309    /** Padding to make aPage aligned on sizeof(PGMPAGE). */
     
    14241401    /** Pointer to the next range - R0. */
    14251402    R0PTRTYPE(struct PGMROMRANGE *)     pNextR0;
    1426     /** Pointer to the next range - RC. */
    1427     RCPTRTYPE(struct PGMROMRANGE *)     pNextRC;
    1428     /** Pointer alignment */
    1429     RTRCPTR                             RCPtrAlignment;
    14301403    /** Address of the range. */
    14311404    RTGCPHYS                            GCPhys;
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