VirtualBox

Changeset 93635 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 7, 2022 10:43:45 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGM,VMM/PDM,VGA: Consolidate the user parameters of the physical access handlers into a single uint64_t value that shouldn't be a pointer, at least not for ring-0 callbacks. Special hack for devices where it's translated from a ring-0 device instance index into a current context PPDMDEVINS (not really tested yet). bugref:10094

Location:
trunk/src/VBox
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp

    r93115 r93635  
    358358 * @param   enmAccessType   The access type.
    359359 * @param   enmOrigin       Who is making the access.
    360  * @param   pvUser          User argument.
     360 * @param   pvUser          User argument - VMM sets this to the address of the
     361 *                          device instance.
    361362 */
    362363DECLCALLBACK(VBOXSTRICTRC)
    363364vmsvgaR3GboAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    364                          PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
     365                         PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
    365366{
    366367    RT_NOREF(pVM, pVCpu, pvPhys, enmAccessType);
     
    369370        return VINF_PGM_HANDLER_DO_DEFAULT;
    370371
    371     PPDMDEVINS  pDevIns = (PPDMDEVINS)pvUser;
    372     PVGASTATE   pThis   = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    373     PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC);
    374     PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
     372    PPDMDEVINS      pDevIns = (PPDMDEVINS)uUser;
     373    AssertPtrReturn(pDevIns, VERR_INTERNAL_ERROR_4);
     374    AssertReturn(pDevIns->u32Version == PDM_DEVINSR3_VERSION, VERR_INTERNAL_ERROR_5);
     375    PVGASTATE       pThis   = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     376    PVGASTATECC     pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC);
     377    PVMSVGAR3STATE  pSvgaR3State = pThisCC->svga.pSvgaR3State;
    375378
    376379    /*
     
    415418}
    416419
    417 
    418420#ifdef VBOX_WITH_VMSVGA3D
     421
    419422static int vmsvgaR3GboCreate(PVMSVGAR3STATE pSvgaR3State, SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, bool fGCPhys64, bool fWriteProtected, PVMSVGAGBO pGbo)
    420423{
     
    592595        for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
    593596        {
    594             rc = PDMDevHlpPGMHandlerPhysicalRegister(pSvgaR3State->pDevIns,
    595                                                      pGbo->paDescriptors[i].GCPhys, pGbo->paDescriptors[i].GCPhys + pGbo->paDescriptors[i].cPages * PAGE_SIZE - 1,
    596                                                      pSvgaR3State->hGboAccessHandlerType, pSvgaR3State->pDevIns, NIL_RTR0PTR, NIL_RTRCPTR, "VMSVGA GBO");
     597            rc = PDMDevHlpPGMHandlerPhysicalRegister(pSvgaR3State->pDevIns, pGbo->paDescriptors[i].GCPhys,
     598                                                     pGbo->paDescriptors[i].GCPhys + pGbo->paDescriptors[i].cPages * PAGE_SIZE - 1,
     599                                                     pSvgaR3State->hGboAccessHandlerType, "VMSVGA GBO");
    597600            AssertRC(rc);
    598601        }
     
    10351038    return rc;
    10361039}
     1040
    10371041#endif /* VBOX_WITH_VMSVGA3D */
    1038 
    10391042
    10401043/*
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-internal.h

    r93115 r93635  
    248248
    249249DECLCALLBACK(VBOXSTRICTRC) vmsvgaR3GboAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    250                                                     PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
     250                                                    PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser);
    251251
    252252void vmsvgaR3ResetScreens(PVGASTATE pThis, PVGASTATECC pThisCC);
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r93554 r93635  
    1636716367 * @callback_method_impl{FNPGMPHYSHANDLER, VMX APIC-access page accesses}
    1636816368 *
    16369  * @remarks The @a pvUser argument is currently unused.
     16369 * @remarks The @a uUser argument is currently unused.
    1637016370 */
    1637116371PGM_ALL_CB2_DECL(VBOXSTRICTRC) iemVmxApicAccessPageHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysFault, void *pvPhys,
    1637216372                                                           void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType,
    16373                                                            PGMACCESSORIGIN enmOrigin, void *pvUser)
    16374 {
    16375     RT_NOREF3(pvPhys, enmOrigin, pvUser);
     16373                                                           PGMACCESSORIGIN enmOrigin, uint64_t uUser)
     16374{
     16375    RT_NOREF3(pvPhys, enmOrigin, uUser);
    1637616376
    1637716377    RTGCPHYS const GCPhysAccessBase = GCPhysFault & ~(RTGCPHYS)GUEST_PAGE_OFFSET_MASK;
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r93554 r93635  
    68546854            PVMCPUCC pVCpu0 = VMCC_GET_CPU_0(pVM);
    68556855            int rc = PGMHandlerPhysicalRegister(pVM, GCPhysApicAccess, GCPhysApicAccess + X86_PAGE_4K_SIZE - 1,
    6856                                                 pVCpu0->iem.s.hVmxApicAccessPage, NIL_RTR3PTR /* pvUserR3 */,
    6857                                                 NIL_RTR0PTR /* pvUserR0 */, NIL_RTRCPTR /* pvUserRC */, NULL /* pszDesc */);
     6856                                                pVCpu0->iem.s.hVmxApicAccessPage, 0 /*uUser*/, NULL /*pszDesc*/);
    68586857            if (RT_SUCCESS(rc))
    68596858            { /* likely */ }
  • trunk/src/VBox/VMM/VMMAll/IOMAllMmioNew.cpp

    r93554 r93635  
    726726 *      \#PF access handler callback for MMIO pages.}
    727727 *
    728  * @remarks The @a pvUser argument is the MMIO handle.
     728 * @remarks The @a uUser argument is the MMIO handle.
    729729 */
    730730DECLEXPORT(VBOXSTRICTRC) iomMmioPfHandlerNew(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore,
    731                                              RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     731                                             RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser)
    732732{
    733733    STAM_PROFILE_START(&pVM->iom.s.StatMmioPfHandler, Prf);
     
    737737
    738738    /* Translate the MMIO handle to a registration entry for the current context. */
    739     AssertReturn((uintptr_t)pvUser < RT_MIN(pVM->iom.s.cMmioRegs, pVM->iom.s.cMmioAlloc), VERR_IOM_INVALID_MMIO_HANDLE);
     739    AssertReturn(uUser < RT_MIN(pVM->iom.s.cMmioRegs, pVM->iom.s.cMmioAlloc), VERR_IOM_INVALID_MMIO_HANDLE);
    740740# ifdef IN_RING0
    741     AssertReturn((uintptr_t)pvUser < pVM->iomr0.s.cMmioAlloc, VERR_IOM_INVALID_MMIO_HANDLE);
    742     CTX_SUFF(PIOMMMIOENTRY) pRegEntry = &pVM->iomr0.s.paMmioRegs[(uintptr_t)pvUser];
     741    AssertReturn(uUser < pVM->iomr0.s.cMmioAlloc, VERR_IOM_INVALID_MMIO_HANDLE);
     742    CTX_SUFF(PIOMMMIOENTRY) pRegEntry = &pVM->iomr0.s.paMmioRegs[uUser];
    743743# else
    744     CTX_SUFF(PIOMMMIOENTRY) pRegEntry = &pVM->iom.s.paMmioRegs[(uintptr_t)pvUser];
     744    CTX_SUFF(PIOMMMIOENTRY) pRegEntry = &pVM->iom.s.paMmioRegs[uUser];
    745745# endif
    746746
     
    795795 * @callback_method_impl{FNPGMPHYSHANDLER, MMIO page accesses}
    796796 *
    797  * @remarks The @a pvUser argument is the MMIO handle.
     797 * @remarks The @a uUser argument is the MMIO handle.
    798798 */
    799799PGM_ALL_CB2_DECL(VBOXSTRICTRC) iomMmioHandlerNew(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysFault, void *pvPhys, void *pvBuf,
    800                                                  size_t cbBuf, PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
     800                                                 size_t cbBuf, PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
    801801{
    802802    STAM_PROFILE_START(UnusedMacroArg, Prf);
    803803    STAM_COUNTER_INC(&pVM->iom.s.CTX_SUFF(StatMmioHandler));
    804     Log4(("iomMmioHandlerNew: GCPhysFault=%RGp cbBuf=%#x enmAccessType=%d enmOrigin=%d pvUser=%p\n", GCPhysFault, cbBuf, enmAccessType, enmOrigin, pvUser));
     804    Log4(("iomMmioHandlerNew: GCPhysFault=%RGp cbBuf=%#x enmAccessType=%d enmOrigin=%d uUser=%p\n", GCPhysFault, cbBuf, enmAccessType, enmOrigin, uUser));
    805805
    806806    Assert(enmAccessType == PGMACCESSTYPE_READ || enmAccessType == PGMACCESSTYPE_WRITE);
     
    815815
    816816    /*
    817      * Translate pvUser to an MMIO registration table entry.  We can do this
     817     * Translate uUser to an MMIO registration table entry.  We can do this
    818818     * without any locking as the data is static after VM creation.
    819819     */
    820     AssertReturn((uintptr_t)pvUser < RT_MIN(pVM->iom.s.cMmioRegs, pVM->iom.s.cMmioAlloc), VERR_IOM_INVALID_MMIO_HANDLE);
     820    AssertReturn(uUser < RT_MIN(pVM->iom.s.cMmioRegs, pVM->iom.s.cMmioAlloc), VERR_IOM_INVALID_MMIO_HANDLE);
    821821#ifdef IN_RING0
    822     AssertReturn((uintptr_t)pvUser < pVM->iomr0.s.cMmioAlloc, VERR_IOM_INVALID_MMIO_HANDLE);
    823     CTX_SUFF(PIOMMMIOENTRY) const pRegEntry    = &pVM->iomr0.s.paMmioRegs[(uintptr_t)pvUser];
    824     PIOMMMIOENTRYR3 const         pRegEntryR3  = &pVM->iomr0.s.paMmioRing3Regs[(uintptr_t)pvUser];
     822    AssertReturn(uUser < pVM->iomr0.s.cMmioAlloc, VERR_IOM_INVALID_MMIO_HANDLE);
     823    CTX_SUFF(PIOMMMIOENTRY) const pRegEntry    = &pVM->iomr0.s.paMmioRegs[uUser];
     824    PIOMMMIOENTRYR3 const         pRegEntryR3  = &pVM->iomr0.s.paMmioRing3Regs[uUser];
    825825#else
    826     CTX_SUFF(PIOMMMIOENTRY) const pRegEntry    = &pVM->iom.s.paMmioRegs[(uintptr_t)pvUser];
     826    CTX_SUFF(PIOMMMIOENTRY) const pRegEntry    = &pVM->iom.s.paMmioRegs[uUser];
    827827#endif
    828828#ifdef VBOX_WITH_STATISTICS
     
    854854        && pRegEntry->cbRegion != 0
    855855        && (  enmAccessType == PGMACCESSTYPE_READ
    856             ? pRegEntry->pfnReadCallback  != NULL || pVM->iomr0.s.paMmioRing3Regs[(uintptr_t)pvUser].pfnReadCallback == NULL
    857             : pRegEntry->pfnWriteCallback != NULL || pVM->iomr0.s.paMmioRing3Regs[(uintptr_t)pvUser].pfnWriteCallback == NULL)
     856            ? pRegEntry->pfnReadCallback  != NULL || pVM->iomr0.s.paMmioRing3Regs[uUser].pfnReadCallback == NULL
     857            : pRegEntry->pfnWriteCallback != NULL || pVM->iomr0.s.paMmioRing3Regs[uUser].pfnWriteCallback == NULL)
    858858        && pDevIns )
    859859    { /* likely */ }
    860860    else
    861861    {
    862         Log4(("iomMmioHandlerNew: to ring-3: to-big=%RTbool zero-size=%RTbool no-callback=%RTbool pDevIns=%p hRegion=%p\n",
     862        Log4(("iomMmioHandlerNew: to ring-3: to-big=%RTbool zero-size=%RTbool no-callback=%RTbool pDevIns=%p hRegion=%#RX64\n",
    863863              !(cbBuf <= sizeof(pVCpu->iom.s.PendingMmioWrite.abValue)), !(pRegEntry->cbRegion != 0),
    864864              !(  enmAccessType == PGMACCESSTYPE_READ
    865                 ? pRegEntry->pfnReadCallback  != NULL || pVM->iomr0.s.paMmioRing3Regs[(uintptr_t)pvUser].pfnReadCallback == NULL
    866                 : pRegEntry->pfnWriteCallback != NULL || pVM->iomr0.s.paMmioRing3Regs[(uintptr_t)pvUser].pfnWriteCallback == NULL),
    867               pDevIns, pvUser));
     865                ? pRegEntry->pfnReadCallback  != NULL || pVM->iomr0.s.paMmioRing3Regs[uUser].pfnReadCallback == NULL
     866                : pRegEntry->pfnWriteCallback != NULL || pVM->iomr0.s.paMmioRing3Regs[uUser].pfnWriteCallback == NULL),
     867              pDevIns, uUser));
    868868        STAM_COUNTER_INC(enmAccessType == PGMACCESSTYPE_READ ? &pStats->ReadRZToR3 : &pStats->WriteRZToR3);
    869869        STAM_COUNTER_INC(enmAccessType == PGMACCESSTYPE_READ ? &pVM->iom.s.StatMmioReadsR0ToR3 : &pVM->iom.s.StatMmioWritesR0ToR3);
  • trunk/src/VBox/VMM/VMMAll/PDMAll.cpp

    r93609 r93635  
    299299
    300300/**
     301 * Translates a ring-0 device instance index to a pointer.
     302 *
     303 * This is used by PGM for device access handlers.
     304 *
     305 * @returns Device instance pointer if valid index, otherwise NULL (asserted).
     306 * @param   pVM         The cross context VM structure.
     307 * @param   idxR0Device The ring-0 device instance index.
     308 */
     309VMM_INT_DECL(PPDMDEVINS) PDMDeviceRing0IdxToInstance(PVMCC pVM, uint64_t idxR0Device)
     310{
     311#ifdef IN_RING0
     312    AssertMsgReturn(idxR0Device < RT_ELEMENTS(pVM->pdmr0.s.apDevInstances), ("%#RX64\n", idxR0Device), NULL);
     313    PPDMDEVINS pDevIns = pVM->pdmr0.s.apDevInstances[idxR0Device];
     314#elif defined(IN_RING3)
     315    AssertMsgReturn(idxR0Device < RT_ELEMENTS(pVM->pdm.s.apDevRing0Instances), ("%#RX64\n", idxR0Device), NULL);
     316    PPDMDEVINS pDevIns = pVM->pdm.s.apDevRing0Instances[idxR0Device];
     317#else
     318# error "Unsupported context"
     319#endif
     320    AssertMsg(pDevIns, ("%#RX64\n", idxR0Device));
     321    return pDevIns;
     322}
     323
     324
     325/**
    301326 * Locks PDM.
    302327 *
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r93617 r93635  
    319319                {
    320320                    rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, GCPhysFault,
    321                                                                 pCur->CTX_SUFF(pvUser));
     321                                                                !pCurType->fRing0DevInsIdx ? pCur->uUser
     322                                                                : (uintptr_t)PDMDeviceRing0IdxToInstance(pVM, pCur->uUser));
    322323
    323324#  ifdef VBOX_WITH_STATISTICS
     
    329330                else
    330331                {
    331                     void * const pvUser = pCur->CTX_SUFF(pvUser);
     332                    uint64_t const uUser = !pCurType->fRing0DevInsIdx ? pCur->uUser
     333                                         : (uintptr_t)PDMDeviceRing0IdxToInstance(pVM, pCur->uUser);
    332334                    PGM_UNLOCK(pVM);
    333335                    *pfLockTaken = false;
    334336
    335                     rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, GCPhysFault, pvUser);
     337                    rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, GCPhysFault, uUser);
    336338
    337339#  ifdef VBOX_WITH_STATISTICS
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r93554 r93635  
    136136 * @param   pVM             The cross context VM structure.
    137137 * @param   hType           The handler type registration handle.
    138  * @param   pvUserR3        User argument to the R3 handler.
    139  * @param   pvUserR0        User argument to the R0 handler.
    140  * @param   pvUserRC        User argument to the RC handler. This can be a value
    141  *                          less that 0x10000 or a (non-null) pointer that is
    142  *                          automatically relocated.
     138 * @param   uUser           User argument to the handlers (not pointer).
    143139 * @param   pszDesc         Description of this handler.  If NULL, the type
    144140 *                          description will be used instead.
     
    146142 *                          success.
    147143 */
    148 int pgmHandlerPhysicalExCreate(PVMCC pVM, PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC,
     144int pgmHandlerPhysicalExCreate(PVMCC pVM, PGMPHYSHANDLERTYPE hType, uint64_t uUser,
    149145                               R3PTRTYPE(const char *) pszDesc, PPGMPHYSHANDLER *ppPhysHandler)
    150146{
    151147    PPGMPHYSHANDLERTYPEINT pType = PGMPHYSHANDLERTYPEINT_FROM_HANDLE(pVM, hType);
    152     Log(("pgmHandlerPhysicalExCreate: pvUserR3=%RHv pvUserR0=%RHv pvUserGC=%RRv hType=%#x (%d, %s) pszDesc=%RHv:%s\n",
    153          pvUserR3, pvUserR0, pvUserRC, hType, pType->enmKind, R3STRING(pType->pszDesc), pszDesc, R3STRING(pszDesc)));
     148    Log(("pgmHandlerPhysicalExCreate: uUser=%#RX64 hType=%#x (%d, %s) pszDesc=%RHv:%s\n",
     149         uUser, hType, pType->enmKind, R3STRING(pType->pszDesc), pszDesc, R3STRING(pszDesc)));
    154150
    155151    /*
     
    158154    AssertPtr(ppPhysHandler);
    159155    AssertReturn(pType->u32Magic == PGMPHYSHANDLERTYPEINT_MAGIC, VERR_INVALID_HANDLE);
    160 #ifdef VBOX_WITH_RAW_MODE_KEEP
    161     AssertMsgReturn(    (RTRCUINTPTR)pvUserRC < 0x10000
    162                     ||  MMHyperR3ToRC(pVM, MMHyperRCToR3(pVM, pvUserRC)) == pvUserRC,
    163                     ("Not RC pointer! pvUserRC=%RRv\n", pvUserRC),
    164                     VERR_INVALID_PARAMETER);
    165 #else
    166     RT_NOREF(pvUserRC);
    167 #endif
    168 #if 0 /* No longer valid. */
    169     AssertMsgReturn(    (RTR0UINTPTR)pvUserR0 < 0x10000
    170                     ||  MMHyperR3ToR0(pVM, MMHyperR0ToR3(pVM, pvUserR0)) == pvUserR0,
    171                     ("Not R0 pointer! pvUserR0=%RHv\n", pvUserR0),
    172                     VERR_INVALID_PARAMETER);
    173 #endif
    174156
    175157    /*
     
    185167        pNew->cAliasedPages = 0;
    186168        pNew->cTmpOffPages  = 0;
    187         pNew->pvUserR3      = pvUserR3;
    188         pNew->pvUserR0      = pvUserR0;
     169        pNew->uUser         = uUser;
    189170        pNew->hType         = hType;
    190171        pNew->pszDesc       = pszDesc != NIL_RTR3PTR ? pszDesc : pType->pszDesc;
     
    211192int pgmHandlerPhysicalExDup(PVMCC pVM, PPGMPHYSHANDLER pPhysHandlerSrc, PPGMPHYSHANDLER *ppPhysHandler)
    212193{
    213     return pgmHandlerPhysicalExCreate(pVM,
    214                                       pPhysHandlerSrc->hType,
    215                                       pPhysHandlerSrc->pvUserR3,
    216                                       pPhysHandlerSrc->pvUserR0,
    217                                       NIL_RTR0PTR,
    218                                       pPhysHandlerSrc->pszDesc,
    219                                       ppPhysHandler);
     194    return pgmHandlerPhysicalExCreate(pVM, pPhysHandlerSrc->hType, pPhysHandlerSrc->uUser,
     195                                      pPhysHandlerSrc->pszDesc, ppPhysHandler);
    220196}
    221197
     
    329305 * @param   GCPhysLast      Last physical address. (inclusive)
    330306 * @param   hType           The handler type registration handle.
    331  * @param   pvUserR3        User argument to the R3 handler.
    332  * @param   pvUserR0        User argument to the R0 handler.
    333  * @param   pvUserRC        User argument to the RC handler. This can be a value
    334  *                          less that 0x10000 or a (non-null) pointer that is
    335  *                          automatically relocated.
     307 * @param   uUser           User argument to the handler.
    336308 * @param   pszDesc         Description of this handler.  If NULL, the type
    337309 *                          description will be used instead.
    338310 */
    339311VMMDECL(int) PGMHandlerPhysicalRegister(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
    340                                         RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc)
     312                                        uint64_t uUser, R3PTRTYPE(const char *) pszDesc)
    341313{
    342314#ifdef LOG_ENABLED
    343315    PPGMPHYSHANDLERTYPEINT pType = PGMPHYSHANDLERTYPEINT_FROM_HANDLE(pVM, hType);
    344     Log(("PGMHandlerPhysicalRegister: GCPhys=%RGp GCPhysLast=%RGp pvUserR3=%RHv pvUserR0=%RHv pvUserGC=%RRv hType=%#x (%d, %s) pszDesc=%RHv:%s\n",
    345          GCPhys, GCPhysLast, pvUserR3, pvUserR0, pvUserRC, hType, pType->enmKind, R3STRING(pType->pszDesc), pszDesc, R3STRING(pszDesc)));
     316    Log(("PGMHandlerPhysicalRegister: GCPhys=%RGp GCPhysLast=%RGp uUser=%#RX64 hType=%#x (%d, %s) pszDesc=%RHv:%s\n",
     317         GCPhys, GCPhysLast, uUser, hType, pType->enmKind, R3STRING(pType->pszDesc), pszDesc, R3STRING(pszDesc)));
    346318#endif
    347319
    348320    PPGMPHYSHANDLER pNew;
    349     int rc = pgmHandlerPhysicalExCreate(pVM, hType, pvUserR3, pvUserR0, pvUserRC, pszDesc, &pNew);
     321    int rc = pgmHandlerPhysicalExCreate(pVM, hType, uUser, pszDesc, &pNew);
    350322    if (RT_SUCCESS(rc))
    351323    {
     
    970942 * @param   pVM             The cross context VM structure.
    971943 * @param   GCPhys          Start physical address of the handler.
    972  * @param   pvUserR3        User argument to the R3 handler.
    973  * @param   pvUserR0        User argument to the R0 handler.
    974  */
    975 VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVMCC pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0)
    976 {
    977     /*
    978      * Find the handler.
    979      */
    980     int rc = VINF_SUCCESS;
     944 * @param   uUser           User argument to the handlers.
     945 */
     946VMMDECL(int) PGMHandlerPhysicalChangeUserArg(PVMCC pVM, RTGCPHYS GCPhys, uint64_t uUser)
     947{
     948    /*
     949     * Find the handler and make the change.
     950     */
     951    int rc;
    981952    PGM_LOCK_VOID(pVM);
    982953    PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
    983954    if (pCur)
    984955    {
    985         /*
    986          * Change arguments.
    987          */
    988         pCur->pvUserR3 = pvUserR3;
    989         pCur->pvUserR0 = pvUserR0;
     956        pCur->uUser = uUser;
     957        rc = VINF_SUCCESS;
    990958    }
    991959    else
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r93593 r93635  
    122122DECLEXPORT(VBOXSTRICTRC)
    123123pgmPhysHandlerRedirectToHC(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    124                            PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
    125 {
    126     NOREF(pVM); NOREF(pVCpu); NOREF(GCPhys); NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf);
    127     NOREF(enmAccessType); NOREF(enmOrigin); NOREF(pvUser);
     124                           PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
     125{
     126    RT_NOREF(pVM, pVCpu, GCPhys, pvPhys, pvBuf, cbBuf, enmAccessType, enmOrigin, uUser);
    128127    return VINF_EM_RAW_EMULATE_INSTR;
    129128}
     
    135134 */
    136135VMMDECL(VBOXSTRICTRC) pgmPhysPfHandlerRedirectToHC(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
    137                                                    RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
    138 {
    139     NOREF(pVM); NOREF(pVCpu); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(GCPhysFault); NOREF(pvUser);
     136                                                   RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser)
     137{
     138    RT_NOREF(pVM, pVCpu, uErrorCode, pRegFrame, pvFault, GCPhysFault, uUser);
    140139    return VINF_EM_RAW_EMULATE_INSTR;
    141140}
    142141
     142#endif /* !IN_RING3 */
     143
     144/**
     145 * Looks up a ROM range by its PGMROMRANGE::GCPhys value.
     146 */
     147DECLINLINE(PPGMROMRANGE) pgmPhysRomLookupByBase(PVMCC pVM, RTGCPHYS GCPhys)
     148{
     149    for (PPGMROMRANGE pRom = pVM->pgm.s.CTX_SUFF(pRomRanges); pRom; pRom = pRom->CTX_SUFF(pNext))
     150        if (pRom->GCPhys == GCPhys)
     151            return pRom;
     152    return NULL;
     153}
     154
     155#ifndef IN_RING3
    143156
    144157/**
     
    146159 *      \#PF access handler callback for guest ROM range write access.}
    147160 *
    148  * @remarks The @a pvUser argument points to the PGMROMRANGE.
     161 * @remarks The @a uUser argument is the PGMROMRANGE::GCPhys value.
    149162 */
    150163DECLEXPORT(VBOXSTRICTRC) pgmPhysRomWritePfHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
    151                                                   RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
    152 {
    153     int             rc;
    154     PPGMROMRANGE    pRom = (PPGMROMRANGE)pvUser;
    155     uint32_t        iPage = (GCPhysFault - pRom->GCPhys) >> GUEST_PAGE_SHIFT;
    156     NOREF(uErrorCode); NOREF(pvFault);
     164                                                  RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser)
     165
     166{
     167    PPGMROMRANGE const  pRom  = pgmPhysRomLookupByBase(pVM, uUser);
     168    AssertReturn(pRom, VINF_EM_RAW_EMULATE_INSTR);
     169    uint32_t const      iPage = (GCPhysFault - pRom->GCPhys) >> GUEST_PAGE_SHIFT;
     170    int                 rc;
     171    RT_NOREF(uErrorCode, pvFault);
    157172
    158173    Assert(uErrorCode & X86_TRAP_PF_RW); /* This shall not be used for read access! */
     
    216231 *      Access handler callback for ROM write accesses.}
    217232 *
    218  * @remarks The @a pvUser argument points to the PGMROMRANGE.
     233 * @remarks The @a uUser argument is the PGMROMRANGE::GCPhys value.
    219234 */
    220235PGM_ALL_CB2_DECL(VBOXSTRICTRC)
    221236pgmPhysRomWriteHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    222                        PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
    223 {
    224     PPGMROMRANGE    pRom     = (PPGMROMRANGE)pvUser;
    225     const uint32_t  iPage    = (GCPhys - pRom->GCPhys) >> GUEST_PAGE_SHIFT;
     237                       PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
     238{
     239    PPGMROMRANGE const  pRom  = pgmPhysRomLookupByBase(pVM, uUser);
     240    AssertReturn(pRom, VERR_INTERNAL_ERROR_3);
     241    uint32_t const      iPage    = (GCPhys - pRom->GCPhys) >> GUEST_PAGE_SHIFT;
    226242    Assert(iPage < (pRom->cb >> GUEST_PAGE_SHIFT));
    227     PPGMROMPAGE     pRomPage = &pRom->aPages[iPage];
     243    PPGMROMPAGE const   pRomPage = &pRom->aPages[iPage];
     244
    228245    Log5(("pgmPhysRomWriteHandler: %d %c %#08RGp %#04zx\n", pRomPage->enmProt, enmAccessType == PGMACCESSTYPE_READ ? 'R' : 'W', GCPhys, cbBuf));
    229     NOREF(pVCpu); NOREF(pvPhys); NOREF(enmOrigin);
     246    RT_NOREF(pVCpu, pvPhys, enmOrigin);
    230247
    231248    if (enmAccessType == PGMACCESSTYPE_READ)
     
    328345 * Common worker for pgmPhysMmio2WriteHandler and pgmPhysMmio2WritePfHandler.
    329346 */
    330 static VBOXSTRICTRC pgmPhysMmio2WriteHandlerCommon(PVMCC pVM, PVMCPUCC pVCpu, uintptr_t hMmio2, RTGCPHYS GCPhys, RTGCPTR GCPtr)
     347static VBOXSTRICTRC pgmPhysMmio2WriteHandlerCommon(PVMCC pVM, PVMCPUCC pVCpu, uint64_t hMmio2, RTGCPHYS GCPhys, RTGCPTR GCPtr)
    331348{
    332349    /*
     
    377394 *      \#PF access handler callback for guest MMIO2 dirty page tracing.}
    378395 *
    379  * @remarks The @a pvUser is the MMIO2 index.
     396 * @remarks The @a uUser is the MMIO2 index.
    380397 */
    381398DECLEXPORT(VBOXSTRICTRC) pgmPhysMmio2WritePfHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
    382                                                     RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     399                                                    RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser)
    383400{
    384401    RT_NOREF(pVCpu, uErrorCode, pRegFrame);
     
    386403    if (RT_SUCCESS(rcStrict))
    387404    {
    388         rcStrict = pgmPhysMmio2WriteHandlerCommon(pVM, pVCpu, (uintptr_t)pvUser, GCPhysFault, pvFault);
     405        rcStrict = pgmPhysMmio2WriteHandlerCommon(pVM, pVCpu, uUser, GCPhysFault, pvFault);
    389406        PGM_UNLOCK(pVM);
    390407    }
     
    398415 *      Access handler callback for MMIO2 dirty page tracing.}
    399416 *
    400  * @remarks The @a pvUser is the MMIO2 index.
     417 * @remarks The @a uUser is the MMIO2 index.
    401418 */
    402419PGM_ALL_CB2_DECL(VBOXSTRICTRC)
    403420pgmPhysMmio2WriteHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    404                          PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
     421                         PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
    405422{
    406423    VBOXSTRICTRC rcStrict = PGM_LOCK(pVM); /* We should already have it, but just make sure we do. */
    407424    if (RT_SUCCESS(rcStrict))
    408425    {
    409         rcStrict = pgmPhysMmio2WriteHandlerCommon(pVM, pVCpu, (uintptr_t)pvUser, GCPhys, ~(RTGCPTR)0);
     426        rcStrict = pgmPhysMmio2WriteHandlerCommon(pVM, pVCpu, uUser, GCPhys, ~(RTGCPTR)0);
    410427        PGM_UNLOCK(pVM);
    411428        if (rcStrict == VINF_SUCCESS)
     
    24152432     */
    24162433    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    2417     PPGMPHYSHANDLER pPhys = NULL;
    24182434    if (   PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) == PGM_PAGE_HNDL_PHYS_STATE_ALL
    24192435        || PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage))
    24202436    {
    2421         pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    2422         AssertReleaseMsg(pPhys, ("GCPhys=%RGp cb=%#x\n", GCPhys, cb));
    2423         Assert(GCPhys >= pPhys->Core.Key && GCPhys <= pPhys->Core.KeyLast);
    2424         Assert((pPhys->Core.Key     & GUEST_PAGE_OFFSET_MASK) == 0);
    2425         Assert((pPhys->Core.KeyLast & GUEST_PAGE_OFFSET_MASK) == GUEST_PAGE_OFFSET_MASK);
     2437        PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
     2438        AssertReleaseMsg(pCur, ("GCPhys=%RGp cb=%#x\n", GCPhys, cb));
     2439        Assert(GCPhys >= pCur->Core.Key && GCPhys <= pCur->Core.KeyLast);
     2440        Assert((pCur->Core.Key     & GUEST_PAGE_OFFSET_MASK) == 0);
     2441        Assert((pCur->Core.KeyLast & GUEST_PAGE_OFFSET_MASK) == GUEST_PAGE_OFFSET_MASK);
    24262442#ifndef IN_RING3
    24272443        if (enmOrigin != PGMACCESSORIGIN_IEM)
     
    24322448        }
    24332449#endif
    2434         PFNPGMPHYSHANDLER pfnHandler = PGMPHYSHANDLER_GET_TYPE(pVM, pPhys)->CTX_SUFF(pfnHandler); Assert(pfnHandler);
    2435         void *pvUser = pPhys->CTX_SUFF(pvUser);
    2436 
    2437         Log5(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cb, pPage, R3STRING(pPhys->pszDesc) ));
    2438         STAM_PROFILE_START(&pPhys->Stat, h);
     2450        PPGMPHYSHANDLERTYPEINT const pCurType   = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
     2451        PFNPGMPHYSHANDLER const      pfnHandler = pCurType->CTX_SUFF(pfnHandler); Assert(pfnHandler);
     2452        uint64_t const               uUser      = !pCurType->fRing0DevInsIdx ? pCur->uUser
     2453                                                : (uintptr_t)PDMDeviceRing0IdxToInstance(pVM, pCur->uUser);
     2454
     2455        Log5(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cb, pPage, R3STRING(pCur->pszDesc) ));
     2456        STAM_PROFILE_START(&pCur->Stat, h);
    24392457        PGM_LOCK_ASSERT_OWNER(pVM);
    24402458
    24412459        /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
    24422460        PGM_UNLOCK(pVM);
    2443         rcStrict = pfnHandler(pVM, pVCpu, GCPhys, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, enmOrigin, pvUser);
     2461        rcStrict = pfnHandler(pVM, pVCpu, GCPhys, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, enmOrigin, uUser);
    24442462        PGM_LOCK_VOID(pVM);
    24452463
    24462464#ifdef VBOX_WITH_STATISTICS
    2447         pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    2448         if (pPhys)
    2449             STAM_PROFILE_STOP(&pPhys->Stat, h);
     2465        pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
     2466        if (pCur)
     2467            STAM_PROFILE_STOP(&pCur->Stat, h);
    24502468#else
    2451         pPhys = NULL; /* might not be valid anymore. */
     2469        pCur = NULL; /* might not be valid anymore. */
    24522470#endif
    24532471        AssertLogRelMsg(PGM_HANDLER_PHYS_IS_VALID_STATUS(rcStrict, false),
     
    26762694            PPGMPHYSHANDLERTYPEINT const pCurType   = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
    26772695            PFNPGMPHYSHANDLER const      pfnHandler = pCurType->CTX_SUFF(pfnHandler);
    2678             void * const                 pvUser     = pCur->CTX_SUFF(pvUser);
     2696            uint64_t const               uUser      = !pCurType->fRing0DevInsIdx ? pCur->uUser
     2697                                                    : (uintptr_t)PDMDeviceRing0IdxToInstance(pVM, pCur->uUser);
    26792698            STAM_PROFILE_START(&pCur->Stat, h);
    26802699
     
    26842703            PGM_LOCK_ASSERT_OWNER(pVM);
    26852704            if (pCurType->fKeepPgmLock)
    2686                 rcStrict = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
     2705                rcStrict = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, uUser);
    26872706            else
    26882707            {
    26892708                PGM_UNLOCK(pVM);
    2690                 rcStrict = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
     2709                rcStrict = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, uUser);
    26912710                PGM_LOCK_VOID(pVM);
    26922711            }
     
    28012820            PPGMPHYSHANDLERTYPEINT const pCurType   = PGMPHYSHANDLER_GET_TYPE(pVM, pPhys);
    28022821            PFNPGMPHYSHANDLER const      pfnHandler = pCurType->CTX_SUFF(pfnHandler);
    2803             void * const                 pvUser     = pPhys->CTX_SUFF(pvUser);
     2822            uint64_t const               uUser      = !pCurType->fRing0DevInsIdx ? pPhys->uUser
     2823                                                    : (uintptr_t)PDMDeviceRing0IdxToInstance(pVM, pPhys->uUser);
    28042824
    28052825            Log5(("pgmPhysWriteHandler: GCPhys=%RGp cbRange=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cbRange, pPage, R3STRING(pPhys->pszDesc) ));
     
    28112831            PGM_LOCK_ASSERT_OWNER(pVM);
    28122832            if (pCurType->fKeepPgmLock)
    2813                 rcStrict2 = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
     2833                rcStrict2 = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, uUser);
    28142834            else
    28152835            {
    28162836                PGM_UNLOCK(pVM);
    2817                 rcStrict2 = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
     2837                rcStrict2 = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, uUser);
    28182838                PGM_LOCK_VOID(pVM);
    28192839            }
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r93619 r93635  
    937937 *      \#PF access handler callback for page table pages.}
    938938 *
    939  * @remarks The @a pvUser argument points to the PGMPOOLPAGE.
     939 * @remarks The @a uUser argument is the index of the PGMPOOLPAGE.
    940940 */
    941941DECLEXPORT(VBOXSTRICTRC) pgmRZPoolAccessPfHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
    942                                                   RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     942                                                  RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser)
    943943{
    944944    STAM_PROFILE_START(&pVM->pgm.s.CTX_SUFF(pPool)->StatMonitorRZ, a);
    945     PPGMPOOL        pPool = pVM->pgm.s.CTX_SUFF(pPool);
    946     PPGMPOOLPAGE    pPage = (PPGMPOOLPAGE)pvUser;
    947     unsigned        cMaxModifications;
    948     bool            fForcedFlush = false;
    949     NOREF(uErrorCode);
     945    PPGMPOOL const      pPool = pVM->pgm.s.CTX_SUFF(pPool);
     946    AssertReturn(uUser < pPool->cCurPages, VERR_PGM_POOL_IPE);
     947    PPGMPOOLPAGE const  pPage = &pPool->aPages[uUser];
     948    unsigned            cMaxModifications;
     949    bool                fForcedFlush = false;
     950    RT_NOREF_PV(uErrorCode);
    950951
    951952    LogFlow(("pgmRZPoolAccessPfHandler: pvFault=%RGv pPage=%p:{.idx=%d} GCPhysFault=%RGp\n", pvFault, pPage, pPage->idx, GCPhysFault));
     
    12411242 *
    12421243 * @remarks Only uses the VINF_PGM_HANDLER_DO_DEFAULT status.
     1244 * @note    The @a uUser argument is the index of the PGMPOOLPAGE.
    12431245 */
    12441246PGM_ALL_CB2_DECL(VBOXSTRICTRC)
    12451247pgmPoolAccessHandler(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    1246                      PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
    1247 {
    1248     PPGMPOOL        pPool = pVM->pgm.s.CTX_SUFF(pPool);
     1248                     PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
     1249{
     1250    PPGMPOOL const      pPool = pVM->pgm.s.CTX_SUFF(pPool);
    12491251    STAM_PROFILE_START(&pPool->CTX_SUFF_Z(StatMonitor), a);
    1250     PPGMPOOLPAGE    pPage = (PPGMPOOLPAGE)pvUser;
     1252    AssertReturn(uUser < pPool->cCurPages, VERR_PGM_POOL_IPE);
     1253    PPGMPOOLPAGE const  pPage = &pPool->aPages[uUser];
    12511254    LogFlow(("PGM_ALL_CB_DECL: GCPhys=%RGp %p:{.Core=%RHp, .idx=%d, .GCPhys=%RGp, .enmType=%d}\n",
    12521255             GCPhys, pPage, pPage->Core.Key, pPage->idx, pPage->GCPhys, pPage->enmKind));
     
    24772480        const RTGCPHYS GCPhysPage = pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK;
    24782481        rc = PGMHandlerPhysicalRegister(pVM, GCPhysPage, GCPhysPage + PAGE_OFFSET_MASK, pPool->hAccessHandlerType,
    2479                                         pgmPoolConvertPageToR3(pPool, pPage), pgmPoolConvertPageToR0(pPool, pPage),
    2480                                         NIL_RTRCPTR, NIL_RTR3PTR /*pszDesc*/);
     2482                                        pPage - &pPool->aPages[0], NIL_RTR3PTR /*pszDesc*/);
    24812483        /** @todo we should probably deal with out-of-memory conditions here, but for now increasing
    24822484         * the heap size should suffice. */
     
    25552557            PPGMPOOLPAGE pNewHead = &pPool->aPages[pPage->iMonitoredNext];
    25562558            pNewHead->iMonitoredPrev = NIL_PGMPOOL_IDX;
    2557             rc = PGMHandlerPhysicalChangeUserArgs(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK,
    2558                                                   pgmPoolConvertPageToR3(pPool, pNewHead),
    2559                                                   pgmPoolConvertPageToR0(pPool, pNewHead));
     2559            rc = PGMHandlerPhysicalChangeUserArg(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK, pPage->iMonitoredNext);
    25602560
    25612561            AssertFatalRCSuccess(rc);
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r93609 r93635  
    421421            if (idxR0Device < RT_ELEMENTS(pGVM->pdmr0.s.apDevInstances))
    422422            {
    423                 pGVM->pdmr0.s.apDevInstances[idxR0Device] = pDevIns;
    424                 pGVM->pdmr0.s.cDevInstances = idxR0Device + 1;
     423                pGVM->pdmr0.s.apDevInstances[idxR0Device]    = pDevIns;
     424                pGVM->pdmr0.s.cDevInstances                  = idxR0Device + 1;
     425                pGVM->pdm.s.apDevRing0Instances[idxR0Device] = pDevIns->pDevInsForR3;
    425426                pDevIns->Internal.s.idxR0Device   = idxR0Device;
    426427                pDevInsR3->Internal.s.idxR0Device = idxR0Device;
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r93599 r93635  
    990990            if (pHandlerType->CTX_SUFF(pfnPfHandler))
    991991            {
    992                 void *pvUser = pHandler->CTX_SUFF(pvUser);
     992                uint64_t const uUser = !pHandlerType->fRing0DevInsIdx ? pHandler->uUser
     993                                     : (uintptr_t)PDMDeviceRing0IdxToInstance(pGVM, pHandler->uUser);
    993994                STAM_PROFILE_START(&pHandler->Stat, h);
    994995                PGM_UNLOCK(pGVM);
    995996
    996                 Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pHandlerType->CTX_SUFF(pfnPfHandler), uErr, GCPhysFault, pvUser));
     997                Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pHandlerType->CTX_SUFF(pfnPfHandler), uErr, GCPhysFault, uUser));
    997998                rc = pHandlerType->CTX_SUFF(pfnPfHandler)(pGVM, pGVCpu, uErr == UINT32_MAX ? RTGCPTR_MAX : uErr, pRegFrame,
    998                                                           GCPhysFault, GCPhysFault, pvUser);
     999                                                          GCPhysFault, GCPhysFault, uUser);
    9991000
    10001001#ifdef VBOX_WITH_STATISTICS
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r93115 r93635  
    172172    {
    173173        PVMCPU pVCpu0 = pVM->apCpusR3[0];
    174         int rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_ALL, false /*fKeepPgmLock*/,
     174        int rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_ALL, 0 /*fFlags*/,
    175175                                                  iemVmxApicAccessPageHandler,
    176176                                                  NULL /* pszModR0 */,
  • trunk/src/VBox/VMM/VMMR3/IOM.cpp

    r93115 r93635  
    159159     * Register the MMIO access handler type.
    160160     */
    161     rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_MMIO, false /*fKeepPgmLock*/,
     161    rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_MMIO, 0 /*fFlags*/,
    162162                                          iomMmioHandlerNew,
    163163                                          NULL, "iomMmioHandlerNew", "iomMmioPfHandlerNew",
  • trunk/src/VBox/VMM/VMMR3/IOMR3Mmio.cpp

    r93554 r93635  
    399399                        ASMAtomicWriteU64(&pRegEntry->GCPhysMapping, GCPhys);
    400400                        rc = PGMR3PhysMMIORegister(pVM, GCPhys, cbRegion, pVM->iom.s.hNewMmioHandlerType,
    401                                                    (void *)(uintptr_t)hRegion, hRegion, hRegion, pRegEntry->pszDesc);
     401                                                   hRegion, pRegEntry->pszDesc);
    402402                        AssertRCReturnStmt(rc, ASMAtomicWriteU64(&pRegEntry->GCPhysMapping, NIL_RTGCPHYS); IOM_UNLOCK_EXCL(pVM), rc);
    403403
     
    418418                        ASMAtomicWriteU64(&pRegEntry->GCPhysMapping, GCPhys);
    419419                        rc = PGMR3PhysMMIORegister(pVM, GCPhys, cbRegion, pVM->iom.s.hNewMmioHandlerType,
    420                                                    (void *)(uintptr_t)hRegion, hRegion, hRegion, pRegEntry->pszDesc);
     420                                                   hRegion, pRegEntry->pszDesc);
    421421                        AssertRCReturnStmt(rc, ASMAtomicWriteU64(&pRegEntry->GCPhysMapping, NIL_RTGCPHYS); IOM_UNLOCK_EXCL(pVM), rc);
    422422
     
    444444            /* First entry in the lookup table: */
    445445            ASMAtomicWriteU64(&pRegEntry->GCPhysMapping, GCPhys);
    446             rc = PGMR3PhysMMIORegister(pVM, GCPhys, cbRegion, pVM->iom.s.hNewMmioHandlerType,
    447                                        (void *)(uintptr_t)hRegion, hRegion, hRegion, pRegEntry->pszDesc);
     446            rc = PGMR3PhysMMIORegister(pVM, GCPhys, cbRegion, pVM->iom.s.hNewMmioHandlerType, hRegion, pRegEntry->pszDesc);
    448447            AssertRCReturnStmt(rc, ASMAtomicWriteU64(&pRegEntry->GCPhysMapping, NIL_RTGCPHYS); IOM_UNLOCK_EXCL(pVM), rc);
    449448
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r93611 r93635  
    873873             pszDesc, pszDesc, phType));
    874874
    875     int rc = PGMR3HandlerPhysicalTypeRegister(pVM, enmKind, false /*fKeepPgmLock*/, pfnHandlerR3,
     875    int rc = PGMR3HandlerPhysicalTypeRegister(pVM, enmKind,
     876                                              pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_R0_ENABLED
     877                                              ? PGMPHYSHANDLER_F_R0_DEVINS_IDX : 0,
     878                                              pfnHandlerR3,
    876879                                              pDevIns->pReg->pszR0Mod, pszHandlerR0, pszPfHandlerR0,
    877880                                              pDevIns->pReg->pszRCMod, pszHandlerRC, pszPfHandlerRC,
     
    886889/** @interface_method_impl{PDMDEVHLPR3,pfnPGMHandlerPhysicalRegister} */
    887890static DECLCALLBACK(int) pdmR3DevHlp_PGMHandlerPhysicalRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
    888                                                                 PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0,
    889                                                                 RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc)
     891                                                                PGMPHYSHANDLERTYPE hType, R3PTRTYPE(const char *) pszDesc)
    890892{
    891893    PDMDEV_ASSERT_DEVINS(pDevIns);
    892894    PVM  pVM = pDevIns->Internal.s.pVMR3;
    893     LogFlow(("pdmR3DevHlp_PGMHandlerPhysicalRegister: caller='%s'/%d: GCPhys=%RGp GCPhysLast=%RGp hType=%u pvUserR3=%p pvUserR0=%llx pvUsereRC=%llx pszDesc=%p:{%s}\n",
    894              pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, GCPhysLast, hType, pvUserR3, pvUserR0, pvUserRC, pszDesc, pszDesc));
    895 
    896     int rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, hType, pvUserR3, pvUserR0, pvUserRC, pszDesc);
     895    LogFlow(("pdmR3DevHlp_PGMHandlerPhysicalRegister: caller='%s'/%d: GCPhys=%RGp GCPhysLast=%RGp hType=%u pszDesc=%p:{%s}\n",
     896             pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, GCPhysLast, hType, pszDesc, pszDesc));
     897
     898    int rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, hType,
     899                                        pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_R0_ENABLED
     900                                        ? pDevIns->Internal.s.idxR0Device : (uintptr_t)pDevIns,
     901                                        pszDesc);
    897902
    898903    Log(("pdmR3DevHlp_PGMHandlerPhysicalRegister: caller='%s'/%d: returns %Rrc\n",
     
    57745779/** @interface_method_impl{PDMDEVHLPR3,pfnPGMHandlerPhysicalRegister} */
    57755780static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PGMHandlerPhysicalRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
    5776                                                                           PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0,
    5777                                                                           RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc)
    5778 {
    5779     PDMDEV_ASSERT_DEVINS(pDevIns);
    5780     RT_NOREF(GCPhys, GCPhysLast, hType, pvUserR3, pvUserR0, pvUserRC, pszDesc);
    5781     AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n",
    5782                             pDevIns->pReg->szName, pDevIns->iInstance));
     5781                                                                          PGMPHYSHANDLERTYPE hType, R3PTRTYPE(const char *) pszDesc)
     5782{
     5783    PDMDEV_ASSERT_DEVINS(pDevIns);
     5784    RT_NOREF(GCPhys, GCPhysLast, hType, pszDesc);
     5785    AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
    57835786    return VERR_ACCESS_DENIED;
    57845787}
  • trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp

    r93609 r93635  
    390390            rc = RTStrCopy(Req.szModName, sizeof(Req.szModName), pReg->pszR0Mod);
    391391            AssertLogRelRCReturn(rc, rc);
     392
    392393            rc = VMMR3CallR0Emt(pVM, pVM->apCpusR3[0], VMMR0_DO_PDM_DEVICE_CREATE, 0, &Req.Hdr);
    393394            AssertLogRelMsgRCReturn(rc, ("VMMR0_DO_PDM_DEVICE_CREATE for %s failed: %Rrc\n", pReg->szName, rc), rc);
     395
    394396            pDevIns = Req.pDevInsR3;
    395397            pCritSect = pDevIns->pCritSectRoR3;
     398
    396399            Assert(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_R0_ENABLED);
     400            AssertLogRelReturn(pDevIns->Internal.s.idxR0Device < PDM_MAX_RING0_DEVICE_INSTANCES, VERR_PDM_DEV_IPE_1);
     401            AssertLogRelReturn(pVM->pdm.s.apDevRing0Instances[pDevIns->Internal.s.idxR0Device] == pDevIns, VERR_PDM_DEV_IPE_1);
    397402        }
    398403        else
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r93596 r93635  
    954954    if (RT_SUCCESS(rc))
    955955        /** @todo why isn't pgmPhysRomWriteHandler registered for ring-0?   */
    956         rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, false /*fKeepPgmLock*/,
     956        rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, 0 /*fFlags*/,
    957957                                              pgmPhysRomWriteHandler,
    958958                                              NULL, NULL, "pgmPhysRomWritePfHandler",
     
    965965     */
    966966    if (RT_SUCCESS(rc))
    967         rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, true /*fKeepPgmLock*/,
     967        rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, PGMPHYSHANDLER_F_KEEP_PGM_LOCK,
    968968                                              pgmPhysMmio2WriteHandler,
    969969                                              NULL, "pgmPhysMmio2WriteHandler", "pgmPhysMmio2WritePfHandler",
  • trunk/src/VBox/VMM/VMMR3/PGMHandler.cpp

    r93554 r93635  
    6565 * @param   pVM             The cross context VM structure.
    6666 * @param   enmKind         The kind of access handler.
    67  * @param   fKeepPgmLock    Whether to hold the PGM lock while calling the
    68  *                          handler or not.  Mainly for PGM callers.
     67 * @param   fFlags          PGMPHYSHANDLER_F_XXX
    6968 * @param   pfnHandlerR3    Pointer to the ring-3 handler callback.
    7069 * @param   pfnHandlerR0    Pointer to the ring-0 handler callback.
     
    7574 *                          safe).
    7675 */
    77 VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind, bool fKeepPgmLock,
     76VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
    7877                                                       PFNPGMPHYSHANDLER pfnHandlerR3,
    7978                                                       R0PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR0,
     
    8988                 || enmKind == PGMPHYSHANDLERKIND_MMIO,
    9089                 VERR_INVALID_PARAMETER);
     90    AssertMsgReturn(!(fFlags & ~PGMPHYSHANDLER_F_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_FLAGS);
    9191
    9292    PPGMPHYSHANDLERTYPEINT pType;
     
    9999        pType->uState           = enmKind == PGMPHYSHANDLERKIND_WRITE
    100100                                ? PGM_PAGE_HNDL_PHYS_STATE_WRITE : PGM_PAGE_HNDL_PHYS_STATE_ALL;
    101         pType->fKeepPgmLock     = fKeepPgmLock;
     101        pType->fKeepPgmLock     = RT_BOOL(fFlags & PGMPHYSHANDLER_F_KEEP_PGM_LOCK);
     102        pType->fRing0DevInsIdx  = RT_BOOL(fFlags & PGMPHYSHANDLER_F_R0_DEVINS_IDX);
    102103        pType->pfnHandlerR3     = pfnHandlerR3;
    103104        pType->pfnHandlerR0     = pfnHandlerR0;
     
    125126 * @param   pVM             The cross context VM structure.
    126127 * @param   enmKind         The kind of access handler.
    127  * @param   fKeepPgmLock    Whether to hold the PGM lock while calling the
    128  *                          handler or not.  Mainly for PGM callers.
     128 * @param   fFlags          PGMPHYSHANDLER_F_XXX
    129129 * @param   pfnHandlerR3    Pointer to the ring-3 handler callback.
    130130 * @param   pszModR0        The name of the ring-0 module, NULL is an alias for
     
    144144 *                          safe).
    145145 */
    146 VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, bool fKeepPgmLock,
     146VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
    147147                                                R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
    148148                                                const char *pszModR0, const char *pszHandlerR0, const char *pszPfHandlerR0,
     
    209209        }
    210210        if (RT_SUCCESS(rc))
    211             return PGMR3HandlerPhysicalTypeRegisterEx(pVM, enmKind, fKeepPgmLock, pfnHandlerR3,
     211            return PGMR3HandlerPhysicalTypeRegisterEx(pVM, enmKind, fFlags, pfnHandlerR3,
    212212                                                      pfnHandlerR0, pfnPfHandlerR0, pszDesc, phType);
    213213    }
     
    365365    pHlp->pfnPrintf(pHlp,
    366366                    "Physical handlers: (PhysHandlers=%d (%#x))\n"
    367                     "%*s %*s %*s %*s HandlerGC UserGC    Type     Description\n",
     367                    "%*s %*s %*s %*s uUser              Type     Description\n",
    368368                    pVM->pgm.s.pTreesR3->PhysHandlers, pVM->pgm.s.pTreesR3->PhysHandlers,
    369369                    - (int)sizeof(RTGCPHYS) * 2,     "From",
    370370                    - (int)sizeof(RTGCPHYS) * 2 - 3, "- To (incl)",
    371                     - (int)sizeof(RTHCPTR)  * 2 - 1, "HandlerHC",
    372                     - (int)sizeof(RTHCPTR)  * 2 - 1, "UserHC");
     371                    - (int)sizeof(RTHCPTR)  * 2 - 1, "HandlerR3",
     372                    - (int)sizeof(RTHCPTR)  * 2 - 1, "HandlerR0");
    373373    RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers, true, pgmR3InfoHandlersPhysicalOne, &Args);
    374374}
     
    397397    }
    398398    pHlp->pfnPrintf(pHlp,
    399                     "%RGp - %RGp  %RHv  %RHv  %RHv  %RHv  %s  %s\n",
    400                     pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCur->pvUserR3,
    401                     pCurType->pfnPfHandlerR0, pCur->pvUserR0, pszType, pCur->pszDesc);
     399                    "%RGp - %RGp  %RHv  %RHv  %#018RX64  %s  %s\n",
     400                    pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCurType->pfnPfHandlerR0, pCur->uUser,
     401                    pszType, pCur->pszDesc);
    402402#ifdef VBOX_WITH_STATISTICS
    403403    if (pArgs->fStats)
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r93624 r93635  
    22572257 * @param   cb              The size of the MMIO region.
    22582258 * @param   hType           The physical access handler type registration.
    2259  * @param   pvUserR3        The user argument for R3.
    2260  * @param   pvUserR0        The user argument for R0.
    2261  * @param   pvUserRC        The user argument for RC.
     2259 * @param   uUser           The user argument.
    22622260 * @param   pszDesc         The description of the MMIO region.
    22632261 */
    22642262VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
    2265                                      RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc)
     2263                                     uint64_t uUser, const char *pszDesc)
    22662264{
    22672265    /*
     
    24032401     * Register the access handler.
    24042402     */
    2405     rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, hType, pvUserR3, pvUserR0, pvUserRC, pszDesc);
     2403    rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, hType, uUser, pszDesc);
    24062404    if (RT_SUCCESS(rc))
    24072405    {
     
    28472845
    28482846        {
    2849             rc = pgmHandlerPhysicalExCreate(pVM, pVM->pgm.s.hMmio2DirtyPhysHandlerType,
    2850                                             (RTR3PTR)(uintptr_t)idMmio2, idMmio2, idMmio2, pszDesc, &pNew->pPhysHandlerR3);
     2847            rc = pgmHandlerPhysicalExCreate(pVM, pVM->pgm.s.hMmio2DirtyPhysHandlerType, idMmio2, pszDesc, &pNew->pPhysHandlerR3);
    28512848            AssertLogRelMsgRCBreak(rc, ("idMmio2=%zu\n", idMmio2));
    28522849        }
     
    45184515         * Register the ROM access handler.
    45194516         */
    4520         rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, pVM->pgm.s.hRomPhysHandlerType,
    4521                                         pRomNew, pRomNewR0, NIL_RTRCPTR, pszDesc);
     4517        rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, pVM->pgm.s.hRomPhysHandlerType, GCPhys, pszDesc);
    45224518        if (RT_SUCCESS(rc))
    45234519        {
  • trunk/src/VBox/VMM/VMMR3/PGMPool.cpp

    r93617 r93635  
    283283
    284284    pPool->hAccessHandlerType = NIL_PGMPHYSHANDLERTYPE;
    285     rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, true /*fKeepPgmLock*/,
     285    rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, PGMPHYSHANDLER_F_KEEP_PGM_LOCK,
    286286                                          pgmPoolAccessHandler,
    287287                                          NULL, "pgmPoolAccessHandler", "pgmRZPoolAccessPfHandler",
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r93633 r93635  
    14331433
    14341434
     1435/** Max number of ring-0 device instances. */
     1436#define PDM_MAX_RING0_DEVICE_INSTANCES  190
     1437
     1438
    14351439/**
    14361440 * PDM VM Instance data.
     
    14701474    R3PTRTYPE(PPDMDEV)              pDevs;
    14711475    /** List of devices instances. (FIFO) */
    1472     R3PTRTYPE(PPDMDEVINS)           pDevInstances;
     1476    PPDMDEVINSR3                    pDevInstances;
     1477    /** This runs parallel to PDMR0PERVM::apDevInstances and is used with
     1478     *  physical access handlers to get the ring-3 device instance for passing down
     1479     *  as uUser. */
     1480    PPDMDEVINSR3                    apDevRing0Instances[PDM_MAX_RING0_DEVICE_INSTANCES];
     1481
    14731482    /** List of registered USB devices. (FIFO) */
    14741483    R3PTRTYPE(PPDMUSB)              pUsbDevs;
     
    15561565    bool volatile                   fNsUnchokeTimerArmed;
    15571566    /** Align aNsGroups on a cacheline.   */
    1558     bool                            afPadding2[19];
     1567    bool                            afPadding2[19+16];
    15591568    /** Number of network shaper groups.
    15601569     * @note Marked volatile to prevent re-reading after validation. */
     
    16131622    uint32_t                        u32Padding1;
    16141623    /** Pointer to ring-0 device instances. */
    1615     R0PTRTYPE(struct PDMDEVINSR0 *) apDevInstances[190];
     1624    R0PTRTYPE(struct PDMDEVINSR0 *) apDevInstances[PDM_MAX_RING0_DEVICE_INSTANCES];
    16161625    /** Number of valid ring-0 queue instances (aQueues). */
    16171626    uint32_t                        cQueues;
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r93624 r93635  
    498498    /** The PGM_PAGE_HNDL_PHYS_STATE_XXX value corresponding to enmKind. */
    499499    uint8_t                             uState;
    500     /** Whether to keep the PGM lock when calling the handler. */
     500    /** Whether to keep the PGM lock when calling the handler.
     501     * @sa PGMPHYSHANDLER_F_KEEP_PGM_LOCK  */
    501502    bool                                fKeepPgmLock;
    502     bool                                afPadding[2];
     503    /** Set if this is registered by a device instance and uUser should be
     504     * translated from a device instance ID to a pointer.
     505     * @sa PGMPHYSHANDLER_F_R0_DEVINS_IDX  */
     506    bool                                fRing0DevInsIdx;
     507    bool                                afPadding[1];
    503508    /** Pointer to R3 callback function. */
    504509    R3PTRTYPE(PFNPGMPHYSHANDLER)        pfnHandlerR3;
     
    543548    /** Registered handler type handle (heap offset). */
    544549    PGMPHYSHANDLERTYPE                  hType;
    545     /** User argument for R3 handlers. */
    546     R3PTRTYPE(void *)                   pvUserR3;
    547     /** User argument for R0 handlers. */
    548     R0PTRTYPE(void *)                   pvUserR0;
     550    /** User argument for the handlers. */
     551    uint64_t                            uUser;
    549552    /** Description / Name. For easing debugging. */
    550553    R3PTRTYPE(const char *)             pszDesc;
     
    35693572#define PGM_LOCK_ASSERT_OWNER_EX(a_pVM, a_pVCpu)  Assert(PDMCritSectIsOwnerEx((a_pVCpu), &(a_pVM)->pgm.s.CritSectX))
    35703573
    3571 int             pgmHandlerPhysicalExCreate(PVMCC pVM, PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0,
    3572                                            RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc, PPGMPHYSHANDLER *ppPhysHandler);
     3574int             pgmHandlerPhysicalExCreate(PVMCC pVM, PGMPHYSHANDLERTYPE hType, uint64_t uUser,
     3575                                           R3PTRTYPE(const char *) pszDesc, PPGMPHYSHANDLER *ppPhysHandler);
    35733576int             pgmHandlerPhysicalExDup(PVMCC pVM, PPGMPHYSHANDLER pPhysHandlerSrc, PPGMPHYSHANDLER *ppPhysHandler);
    35743577int             pgmHandlerPhysicalExRegister(PVMCC pVM, PPGMPHYSHANDLER pPhysHandler, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
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