VirtualBox

Changeset 55899 in vbox


Ignore:
Timestamp:
May 18, 2015 9:47:57 AM (10 years ago)
Author:
vboxsync
Message:

PGM: Added an access origin to memory read & write calls that respects handlers. This will later be passed to the access handler, so that things like the page pool (and potentially others) can query IEM about instruction details when needed.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pgm.h

    r55897 r55899  
    205205 * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
    206206 * @param   pVM             VM Handle.
     207 * @param   pVCpu           Pointer to the cross context CPU context for the
     208 *                          calling EMT.
    207209 * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
    208210 * @param   pvPtr           The HC mapping of that address.
     
    398400VMMDECL(int)        PGMPhysGCPtr2GCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
    399401VMMDECL(void)       PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
    400 VMMDECL(int)        PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
    401 VMMDECL(int)        PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
     402/** Memory access origin. */
     403typedef enum PGMACCESSORIGIN
     404{
     405    PGMACCESSORIGIN_INVALID = 0,
     406    PGMACCESSORIGIN_IEM,
     407    PGMACCESSORIGIN_HM,
     408    PGMACCESSORIGIN_DEVICE,
     409    PGMACCESSORIGIN_DEBUGGER,
     410    PGMACCESSORIGIN_SELM,
     411    PGMACCESSORIGIN_FTM,
     412    PGMACCESSORIGIN_IOM,
     413    PGMACCESSORIGIN_REM,
     414    PGMACCESSORIGIN_END,
     415    PGMACCESSORIGIN_32BIT_HACK = 0x7fffffff
     416} PGMACCESSORIGIN;
     417VMMDECL(int)        PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
     418VMMDECL(int)        PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
     419VMMDECL(int)        PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
     420VMMDECL(int)        PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
    402421VMMDECL(int)        PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
    403422VMMDECL(int)        PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
    404423VMMDECL(int)        PGMPhysSimpleReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
    405424VMMDECL(int)        PGMPhysSimpleWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
    406 VMMDECL(int)        PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
    407 VMMDECL(int)        PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
    408425VMMDECL(int)        PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
    409426VMMDECL(int)        PGMPhysInterpretedRead(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
     
    567584
    568585VMMR3DECL(int)      PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
    569 VMMR3DECL(uint8_t)  PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys);
    570 VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys);
    571 VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys);
    572 VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys);
    573 VMMR3DECL(void)     PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value);
    574 VMMR3DECL(void)     PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value);
    575 VMMR3DECL(void)     PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value);
    576 VMMR3DECL(void)     PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value);
    577 VMMR3DECL(int)      PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
    578 VMMR3DECL(int)      PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, const char *pszWho);
     586VMMR3DECL(uint8_t)  PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
     587VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
     588VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
     589VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
     590VMMR3DECL(void)     PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
     591VMMR3DECL(void)     PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
     592VMMR3DECL(void)     PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
     593VMMR3DECL(void)     PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
     594VMMR3DECL(int)      PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
     595VMMR3DECL(int)      PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
    579596VMMR3DECL(int)      PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
    580597VMMR3DECL(int)      PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r55316 r55899  
    10271027
    10281028        if (!pIemCpu->fBypassHandlers)
    1029             rc = PGMPhysRead(pVM, GCPhys, pIemCpu->abOpcode, cbToTryRead);
     1029            rc = PGMPhysRead(pVM, GCPhys, pIemCpu->abOpcode, cbToTryRead, PGMACCESSORIGIN_IEM);
    10301030        else
    10311031            rc = PGMPhysSimpleReadGCPhys(pVM, pIemCpu->abOpcode, GCPhys, cbToTryRead);
     
    11451145     */
    11461146    if (!pIemCpu->fBypassHandlers)
    1147         rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhys, &pIemCpu->abOpcode[pIemCpu->cbOpcode], cbToTryRead);
     1147        rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhys, &pIemCpu->abOpcode[pIemCpu->cbOpcode], cbToTryRead, PGMACCESSORIGIN_IEM);
    11481148    else
    11491149        rc = PGMPhysSimpleReadGCPhys(IEMCPU_TO_VM(pIemCpu), &pIemCpu->abOpcode[pIemCpu->cbOpcode], GCPhys, cbToTryRead);
     
    64306430                              pIemCpu->aMemBbMappings[iMemMap].GCPhysFirst,
    64316431                              pbBuf,
    6432                               cbFirst);
     6432                              cbFirst,
     6433                              PGMACCESSORIGIN_IEM);
    64336434            if (cbSecond && rc == VINF_SUCCESS)
    64346435                rc = PGMPhysWrite(IEMCPU_TO_VM(pIemCpu),
    64356436                                  pIemCpu->aMemBbMappings[iMemMap].GCPhysSecond,
    64366437                                  pbBuf + cbFirst,
    6437                                   cbSecond);
     6438                                  cbSecond,
     6439                                  PGMACCESSORIGIN_IEM);
    64386440        }
    64396441        else
     
    65756577        if (!pIemCpu->fBypassHandlers)
    65766578        {
    6577             rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbFirstPage);
     6579            rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbFirstPage, PGMACCESSORIGIN_IEM);
    65786580            if (rc != VINF_SUCCESS)
    65796581            {
     
    65826584                return rc;
    65836585            }
    6584             rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysSecond, pbBuf + cbFirstPage, cbSecondPage);
     6586            rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysSecond, pbBuf + cbFirstPage, cbSecondPage, PGMACCESSORIGIN_IEM);
    65856587            if (rc != VINF_SUCCESS)
    65866588            {
     
    66956697            int rc;
    66966698            if (!pIemCpu->fBypassHandlers)
    6697                 rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbMem);
     6699                rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbMem, PGMACCESSORIGIN_IEM);
    66986700            else
    66996701                rc = PGMPhysSimpleReadGCPhys(IEMCPU_TO_VM(pIemCpu), pbBuf, GCPhysFirst, cbMem);
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r55896 r55899  
    678678    return rc;
    679679#else
    680     return PGMPhysReadGCPtr(pVCpu, pDest, GCSrc, cb);
     680    return PGMPhysReadGCPtr(pVCpu, pDest, GCSrc, cb, PGMACCESSORIGIN_IOM);
    681681#endif
    682682}
     
    696696#else
    697697    NOREF(pCtxCore);
    698     return PGMPhysWriteGCPtr(pVCpu, GCPtrDst, pvSrc, cb);
     698    return PGMPhysWriteGCPtr(pVCpu, GCPtrDst, pvSrc, cb, PGMACCESSORIGIN_IOM);
    699699#endif
    700700}
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r55896 r55899  
    22152215 * @param   pvBuf           Where to put the read bits.
    22162216 * @param   cbRead          How many bytes to read.
    2217  */
    2218 VMMDECL(int) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     2217 * @param   enmOrigin       The origin of this call.
     2218 */
     2219VMMDECL(int) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin)
    22192220{
    22202221    AssertMsgReturn(cbRead > 0, ("don't even think about reading zero bytes!\n"), VINF_SUCCESS);
     
    27602761 * @param   pvBuf           What to write.
    27612762 * @param   cbWrite         How many bytes to write.
    2762  */
    2763 VMMDECL(int) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
    2764 {
    2765     AssertMsg(!pVM->pgm.s.fNoMorePhysWrites, ("Calling PGMPhysWrite after pgmR3Save()!\n"));
     2763 * @param   enmOrigin       Who is calling.
     2764 */
     2765VMMDECL(int) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin)
     2766{
     2767    AssertMsg(!pVM->pgm.s.fNoMorePhysWrites, ("Calling PGMPhysWrite after pgmR3Save()! enmOrigin=%d\n", enmOrigin));
    27662768    AssertMsgReturn(cbWrite > 0, ("don't even think about writing zero bytes!\n"), VINF_SUCCESS);
    27672769    LogFlow(("PGMPhysWrite: %RGp %d\n", GCPhys, cbWrite));
     
    32713273 * @param   GCPtrSrc    The source address (GC pointer).
    32723274 * @param   cb          The number of bytes to read.
    3273  * @thread  The vCPU EMT.
    3274  */
    3275 VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb)
     3275 * @param   enmOrigin   Who is calling.
     3276 * @thread  EMT(pVCpu)
     3277 */
     3278VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin)
    32763279{
    32773280    RTGCPHYS    GCPhys;
     
    33063309        }
    33073310
    3308         return PGMPhysRead(pVM, GCPhys, pvDst, cb);
     3311        return PGMPhysRead(pVM, GCPhys, pvDst, cb, enmOrigin);
    33093312    }
    33103313
     
    33303333        if (cbRead < cb)
    33313334        {
    3332             rc = PGMPhysRead(pVM, GCPhys, pvDst, cbRead);
     3335            rc = PGMPhysRead(pVM, GCPhys, pvDst, cbRead, enmOrigin);
    33333336            if (RT_FAILURE(rc))
    33343337                return rc;
    33353338        }
    33363339        else    /* Last page (cbRead is PAGE_SIZE, we only need cb!) */
    3337             return PGMPhysRead(pVM, GCPhys, pvDst, cb);
     3340            return PGMPhysRead(pVM, GCPhys, pvDst, cb, enmOrigin);
    33383341
    33393342        /* next */
     
    33603363 * @param   pvSrc       The source address.
    33613364 * @param   cb          The number of bytes to write.
    3362  */
    3363 VMMDECL(int) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb)
     3365 * @param   enmOrigin       Who is calling.
     3366 */
     3367VMMDECL(int) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin)
    33643368{
    33653369    RTGCPHYS    GCPhys;
     
    33983402        }
    33993403
    3400         return PGMPhysWrite(pVM, GCPhys, pvSrc, cb);
     3404        return PGMPhysWrite(pVM, GCPhys, pvSrc, cb, enmOrigin);
    34013405    }
    34023406
     
    34263430        if (cbWrite < cb)
    34273431        {
    3428             rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cbWrite);
     3432            rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cbWrite, enmOrigin);
    34293433            if (RT_FAILURE(rc))
    34303434                return rc;
    34313435        }
    34323436        else    /* Last page (cbWrite is PAGE_SIZE, we only need cb!) */
    3433             rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cb);
     3437            rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cb, enmOrigin);
    34343438
    34353439        /* next */
  • trunk/src/VBox/VMM/VMMAll/SELMAll.cpp

    r52363 r55899  
    496496     */
    497497    X86DESC GstDesc;
    498     int rc = PGMPhysReadGCPtr(pVCpu, &GstDesc, GCPtrDesc, sizeof(GstDesc));
     498    int rc = PGMPhysReadGCPtr(pVCpu, &GstDesc, GCPtrDesc, sizeof(GstDesc), PGMACCESSORIGIN_IOM);
    499499    if (RT_FAILURE(rc))
    500500    {
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r55863 r55899  
    1206412064                    Assert(sizeof(Eflags.u32) >= cbParm);
    1206512065                    Eflags.u32 = 0;
    12066                     rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u32, cbParm);
     12066                    rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u32, cbParm, PGMACCESSORIGIN_HM);
    1206712067                }
    1206812068                if (RT_FAILURE(rc))
     
    1211712117                Eflags.Bits.u1VM = 0;
    1211812118
    12119                 rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u, cbParm);
     12119                rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u, cbParm, PGMACCESSORIGIN_HM);
    1212012120                if (RT_FAILURE(rc))
    1212112121                {
     
    1215212152                                  &GCPtrStack);
    1215312153                if (RT_SUCCESS(rc))
    12154                     rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &aIretFrame[0], sizeof(aIretFrame));
     12154                    rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &aIretFrame[0], sizeof(aIretFrame), PGMACCESSORIGIN_HM);
    1215512155                if (RT_FAILURE(rc))
    1215612156                {
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r53797 r55899  
    205205             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
    206206
    207     int rc = PGMPhysRead(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbRead);
     207    int rc = PGMPhysRead(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
    208208    AssertRC(rc); /** @todo track down the users for this bugger. */
    209209
     
    220220             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
    221221
    222     int rc = PGMPhysWrite(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbWrite);
     222    int rc = PGMPhysWrite(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
    223223    AssertRC(rc); /** @todo track down the users for this bugger. */
    224224
  • trunk/src/VBox/VMM/VMMR3/FTM.cpp

    r47786 r55899  
    925925    {
    926926        /* Update the guest memory of the standby VM. */
    927         int rc = PGMR3PhysWriteExternal(pVM, pNode->Core.Key, pNode->pPage, PAGE_SIZE, "FTMemSync");
     927        int rc = PGMR3PhysWriteExternal(pVM, pNode->Core.Key, pNode->pPage, PAGE_SIZE, PGMACCESSORIGIN_FTM);
    928928        AssertRC(rc);
    929929    }
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r54737 r55899  
    717717    int rc;
    718718    if (VM_IS_EMT(pVM))
    719         rc = PGMPhysRead(pVM, GCPhys, pvBuf, cbRead);
    720     else
    721         rc = PGMR3PhysReadExternal(pVM, GCPhys, pvBuf, cbRead);
     719        rc = PGMPhysRead(pVM, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
     720    else
     721        rc = PGMR3PhysReadExternal(pVM, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
    722722
    723723    Log(("pdmR3DevHlp_PhysRead: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
     
    745745    int rc;
    746746    if (VM_IS_EMT(pVM))
    747         rc = PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite);
    748     else
    749         rc = PGMR3PhysWriteExternal(pVM, GCPhys, pvBuf, cbWrite, pDevIns->pReg->szName);
     747        rc = PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
     748    else
     749        rc = PGMR3PhysWriteExternal(pVM, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
    750750
    751751    Log(("pdmR3DevHlp_PhysWrite: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r55493 r55899  
    8787 * EMT worker for PGMR3PhysReadExternal.
    8888 */
    89 static DECLCALLBACK(int) pgmR3PhysReadExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, void *pvBuf, size_t cbRead)
    90 {
    91     PGMPhysRead(pVM, *pGCPhys, pvBuf, cbRead);
     89static DECLCALLBACK(int) pgmR3PhysReadExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, void *pvBuf, size_t cbRead,
     90                                                  PGMACCESSORIGIN enmOrigin)
     91{
     92    PGMPhysRead(pVM, *pGCPhys, pvBuf, cbRead, enmOrigin);
    9293    return VINF_SUCCESS;
    9394}
     
    104105 * @param   pvBuf           Where to read into.
    105106 * @param   cbRead          How many bytes to read.
     107 * @param   enmOrigin       Who is calling.
    106108 *
    107109 * @thread  Any but EMTs.
    108110 */
    109 VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     111VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin)
    110112{
    111113    VM_ASSERT_OTHER_THREAD(pVM);
     
    143145                    pgmUnlock(pVM);
    144146
    145                     return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 4,
    146                                                    pVM, &GCPhys, pvBuf, cbRead);
     147                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 5,
     148                                                   pVM, &GCPhys, pvBuf, cbRead, enmOrigin);
    147149                }
    148150                Assert(!PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage));
     
    215217 * EMT worker for PGMR3PhysWriteExternal.
    216218 */
    217 static DECLCALLBACK(int) pgmR3PhysWriteExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, const void *pvBuf, size_t cbWrite)
     219static DECLCALLBACK(int) pgmR3PhysWriteExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, const void *pvBuf, size_t cbWrite,
     220                                                   PGMACCESSORIGIN enmOrigin)
    218221{
    219222    /** @todo VERR_EM_NO_MEMORY */
    220     PGMPhysWrite(pVM, *pGCPhys, pvBuf, cbWrite);
     223    PGMPhysWrite(pVM, *pGCPhys, pvBuf, cbWrite, enmOrigin);
    221224    return VINF_SUCCESS;
    222225}
     
    234237 * @param   pvBuf           What to write.
    235238 * @param   cbWrite         How many bytes to write.
    236  * @param   pszWho          Who is writing.  For tracking down who is writing
    237  *                          after we've saved the state.
     239 * @param   enmOrigin       Who is calling.
    238240 *
    239241 * @thread  Any but EMTs.
    240242 */
    241 VMMDECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, const char *pszWho)
     243VMMDECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin)
    242244{
    243245    VM_ASSERT_OTHER_THREAD(pVM);
    244246
    245247    AssertMsg(!pVM->pgm.s.fNoMorePhysWrites,
    246               ("Calling PGMR3PhysWriteExternal after pgmR3Save()! GCPhys=%RGp cbWrite=%#x pszWho=%s\n",
    247                GCPhys, cbWrite, pszWho));
     248              ("Calling PGMR3PhysWriteExternal after pgmR3Save()! GCPhys=%RGp cbWrite=%#x enmOrigin=%d\n",
     249               GCPhys, cbWrite, enmOrigin));
    248250    AssertMsgReturn(cbWrite > 0, ("don't even think about writing zero bytes!\n"), VINF_SUCCESS);
    249251    LogFlow(("PGMR3PhysWriteExternal: %RGp %d\n", GCPhys, cbWrite));
     
    287289                        pgmUnlock(pVM);
    288290
    289                         return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 4,
    290                                                        pVM, &GCPhys, pvBuf, cbWrite);
     291                        return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 5,
     292                                                       pVM, &GCPhys, pvBuf, cbWrite, enmOrigin);
    291293                    }
    292294                }
  • trunk/src/VBox/VMM/VMMR3/PGMPhysRWTmpl.h

    r44528 r55899  
    55
    66/*
    7  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525 * @param   pVM             Pointer to the VM.
    2626 * @param   GCPhys          Physical address start reading from.
     27 * @param   enmOrigin       Who is calling.
    2728 */
    28 VMMDECL(PGMPHYS_DATATYPE) PGMPHYSFN_READNAME(PVM pVM, RTGCPHYS GCPhys)
     29VMMDECL(PGMPHYS_DATATYPE) PGMPHYSFN_READNAME(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin)
    2930{
    3031    Assert(VM_IS_EMT(pVM));
    3132    PGMPHYS_DATATYPE val;
    32     PGMPhysRead(pVM, GCPhys, &val, sizeof(val));
     33    PGMPhysRead(pVM, GCPhys, &val, sizeof(val), enmOrigin);
    3334    return val;
    3435}
     
    4445 * @param   GCPhys          Physical address to write to.
    4546 * @param   val             What to write.
     47 * @param   enmOrigin       Who is calling.
    4648 */
    47 VMMDECL(void) PGMPHYSFN_WRITENAME(PVM pVM, RTGCPHYS GCPhys, PGMPHYS_DATATYPE val)
     49VMMDECL(void) PGMPHYSFN_WRITENAME(PVM pVM, RTGCPHYS GCPhys, PGMPHYS_DATATYPE val, PGMACCESSORIGIN enmOrigin)
    4850{
    4951    Assert(VM_IS_EMT(pVM));
    50     PGMPhysWrite(pVM, GCPhys, &val, sizeof(val));
     52    PGMPhysWrite(pVM, GCPhys, &val, sizeof(val), enmOrigin);
    5153}
    5254
  • trunk/src/VBox/VMM/VMMRC/PDMRCDevice.cpp

    r53797 r55899  
    201201             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
    202202
    203     int rc = PGMPhysRead(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbRead);
     203    int rc = PGMPhysRead(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
    204204    AssertRC(rc); /** @todo track down the users for this bugger. */
    205205
     
    216216             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
    217217
    218     int rc = PGMPhysWrite(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbWrite);
     218    int rc = PGMPhysWrite(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
    219219    AssertRC(rc); /** @todo track down the users for this bugger. */
    220220
  • trunk/src/VBox/VMM/testcase/tstAnimate.cpp

    r52931 r55899  
    311311            /* Write that page to the guest - skip known rom areas for now. */
    312312            if (GCPhys < 0xa0000 || GCPhys >= 0x100000) /* ASSUME size of a8Page is a power of 2. */
    313                 PGMPhysWrite(pVM, GCPhys, &au8Page, cbRead);
     313                PGMPhysWrite(pVM, GCPhys, &au8Page, cbRead, PGMACCESSORIGIN_DEBUGGER);
    314314            GCPhys += cbRead;
    315315        }
  • trunk/src/recompiler/VBoxREMWrapper.cpp

    r55493 r55899  
    832832    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
    833833    { REMPARMDESC_FLAGS_INT,        sizeof(void *),             NULL },
    834     { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL }
     834    { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL },
     835    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    835836};
    836837static const REMPARMDESC g_aArgsPGMPhysSimpleReadGCPtr[] =
     
    846847    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
    847848    { REMPARMDESC_FLAGS_INT,        sizeof(const void *),       NULL },
    848     { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL }
     849    { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL },
     850    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    849851};
    850852static const REMPARMDESC g_aArgsPGMChangeMode[] =
     
    864866{
    865867    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
    866     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL }
     868    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     869    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    867870};
    868871static const REMPARMDESC g_aArgsPGMR3PhysWriteU8[] =
     
    870873    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
    871874    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
    872     { REMPARMDESC_FLAGS_INT,        sizeof(uint8_t),            NULL }
     875    { REMPARMDESC_FLAGS_INT,        sizeof(uint8_t),            NULL },
     876    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    873877};
    874878static const REMPARMDESC g_aArgsPGMR3PhysWriteU16[] =
     
    876880    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
    877881    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
    878     { REMPARMDESC_FLAGS_INT,        sizeof(uint16_t),           NULL }
     882    { REMPARMDESC_FLAGS_INT,        sizeof(uint16_t),           NULL },
     883    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    879884};
    880885static const REMPARMDESC g_aArgsPGMR3PhysWriteU32[] =
     
    882887    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
    883888    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
    884     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL }
     889    { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
     890    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    885891};
    886892static const REMPARMDESC g_aArgsPGMR3PhysWriteU64[] =
     
    888894    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
    889895    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
    890     { REMPARMDESC_FLAGS_INT,        sizeof(uint64_t),           NULL }
     896    { REMPARMDESC_FLAGS_INT,        sizeof(uint64_t),           NULL },
     897    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
    891898};
    892899static const REMPARMDESC g_aArgsRTMemReallocTag[] =
  • trunk/src/recompiler/VBoxRecompiler.c

    r55493 r55899  
    35653565    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    35663566    VBOX_CHECK_ADDR(SrcGCPhys);
    3567     PGMPhysRead(cpu_single_env->pVM, SrcGCPhys, pvDst, cb);
     3567    PGMPhysRead(cpu_single_env->pVM, SrcGCPhys, pvDst, cb, PGMACCESSORIGIN_REM);
    35683568#ifdef VBOX_DEBUG_PHYS
    35693569    LogRel(("read(%d): %08x\n", cb, (uint32_t)SrcGCPhys));
     
    35833583    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    35843584    VBOX_CHECK_ADDR(SrcGCPhys);
    3585     val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys);
     3585    val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    35863586    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    35873587#ifdef VBOX_DEBUG_PHYS
     
    36023602    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    36033603    VBOX_CHECK_ADDR(SrcGCPhys);
    3604     val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys);
     3604    val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    36053605    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    36063606#ifdef VBOX_DEBUG_PHYS
     
    36213621    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    36223622    VBOX_CHECK_ADDR(SrcGCPhys);
    3623     val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys);
     3623    val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    36243624    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    36253625#ifdef VBOX_DEBUG_PHYS
     
    36403640    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    36413641    VBOX_CHECK_ADDR(SrcGCPhys);
    3642     val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys);
     3642    val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    36433643    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    36443644#ifdef VBOX_DEBUG_PHYS
     
    36593659    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    36603660    VBOX_CHECK_ADDR(SrcGCPhys);
    3661     val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys);
     3661    val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    36623662    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    36633663#ifdef VBOX_DEBUG_PHYS
     
    36783678    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    36793679    VBOX_CHECK_ADDR(SrcGCPhys);
    3680     val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys);
     3680    val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    36813681    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    36823682#ifdef VBOX_DEBUG_PHYS
     
    36973697    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    36983698    VBOX_CHECK_ADDR(SrcGCPhys);
    3699     val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys);
     3699    val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    37003700    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    37013701#ifdef VBOX_DEBUG_PHYS
     
    37163716    STAM_PROFILE_ADV_START(&gStatMemRead, a);
    37173717    VBOX_CHECK_ADDR(SrcGCPhys);
    3718     val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys);
     3718    val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
    37193719    STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
    37203720#ifdef VBOX_DEBUG_PHYS
     
    37363736    STAM_PROFILE_ADV_START(&gStatMemWrite, a);
    37373737    VBOX_CHECK_ADDR(DstGCPhys);
    3738     PGMPhysWrite(cpu_single_env->pVM, DstGCPhys, pvSrc, cb);
     3738    PGMPhysWrite(cpu_single_env->pVM, DstGCPhys, pvSrc, cb, PGMACCESSORIGIN_REM);
    37393739    STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
    37403740#ifdef VBOX_DEBUG_PHYS
     
    37543754    STAM_PROFILE_ADV_START(&gStatMemWrite, a);
    37553755    VBOX_CHECK_ADDR(DstGCPhys);
    3756     PGMR3PhysWriteU8(cpu_single_env->pVM, DstGCPhys, val);
     3756    PGMR3PhysWriteU8(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
    37573757    STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
    37583758#ifdef VBOX_DEBUG_PHYS
     
    37723772    STAM_PROFILE_ADV_START(&gStatMemWrite, a);
    37733773    VBOX_CHECK_ADDR(DstGCPhys);
    3774     PGMR3PhysWriteU16(cpu_single_env->pVM, DstGCPhys, val);
     3774    PGMR3PhysWriteU16(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
    37753775    STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
    37763776#ifdef VBOX_DEBUG_PHYS
     
    37903790    STAM_PROFILE_ADV_START(&gStatMemWrite, a);
    37913791    VBOX_CHECK_ADDR(DstGCPhys);
    3792     PGMR3PhysWriteU32(cpu_single_env->pVM, DstGCPhys, val);
     3792    PGMR3PhysWriteU32(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
    37933793    STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
    37943794#ifdef VBOX_DEBUG_PHYS
     
    38083808    STAM_PROFILE_ADV_START(&gStatMemWrite, a);
    38093809    VBOX_CHECK_ADDR(DstGCPhys);
    3810     PGMR3PhysWriteU64(cpu_single_env->pVM, DstGCPhys, val);
     3810    PGMR3PhysWriteU64(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
    38113811    STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
    38123812#ifdef VBOX_DEBUG_PHYS
     
    38913891    uint8_t u8;
    38923892    Log2(("remR3HandlerReadU8: GCPhys=%RGp\n", (RTGCPHYS)GCPhys));
    3893     PGMPhysRead((PVM)pvVM, GCPhys, &u8, sizeof(u8));
     3893    PGMPhysRead((PVM)pvVM, GCPhys, &u8, sizeof(u8), PGMACCESSORIGIN_REM);
    38943894    return u8;
    38953895}
     
    38993899    uint16_t u16;
    39003900    Log2(("remR3HandlerReadU16: GCPhys=%RGp\n", (RTGCPHYS)GCPhys));
    3901     PGMPhysRead((PVM)pvVM, GCPhys, &u16, sizeof(u16));
     3901    PGMPhysRead((PVM)pvVM, GCPhys, &u16, sizeof(u16), PGMACCESSORIGIN_REM);
    39023902    return u16;
    39033903}
     
    39073907    uint32_t u32;
    39083908    Log2(("remR3HandlerReadU32: GCPhys=%RGp\n", (RTGCPHYS)GCPhys));
    3909     PGMPhysRead((PVM)pvVM, GCPhys, &u32, sizeof(u32));
     3909    PGMPhysRead((PVM)pvVM, GCPhys, &u32, sizeof(u32), PGMACCESSORIGIN_REM);
    39103910    return u32;
    39113911}
     
    39143914{
    39153915    Log2(("remR3HandlerWriteU8: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
    3916     PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint8_t));
     3916    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint8_t), PGMACCESSORIGIN_REM);
    39173917}
    39183918
     
    39203920{
    39213921    Log2(("remR3HandlerWriteU16: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
    3922     PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint16_t));
     3922    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint16_t), PGMACCESSORIGIN_REM);
    39233923}
    39243924
     
    39263926{
    39273927    Log2(("remR3HandlerWriteU32: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
    3928     PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint32_t));
     3928    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint32_t), PGMACCESSORIGIN_REM);
    39293929}
    39303930
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