VirtualBox

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


Ignore:
Timestamp:
Mar 8, 2009 3:03:43 AM (16 years ago)
Author:
vboxsync
Message:

iomRamWrite: Added a todo about access handlers and evil shadowing/tlb trolls. Changed PGMPhysWriteGCPtr to PGMPhysInterpretedWriteNoHandlers for ring-0 (new phys code) so it will continue to work the way it did even if that isn't correct/safe.

File:
1 edited

Legend:

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

    r17332 r17533  
    271271DECLINLINE(int) iomRamRead(PVM pVM, void *pDest, RTGCPTR GCSrc, uint32_t cb)
    272272{
     273    /* Note: This will fail in R0 or RC if it hits an access handler. That
     274             isn't a problem though since the operation can be restarted in REM. */
    273275#ifdef IN_RC
    274276    return MMGCRamReadNoTrapHandler(pDest, (void *)GCSrc, cb);
     
    280282
    281283/** Wrapper for writing virtual memory. */
    282 DECLINLINE(int) iomRamWrite(PVM pVM, RTGCPTR GCDest, void *pSrc, uint32_t cb)
    283 {
     284DECLINLINE(int) iomRamWrite(PVM pVM, PCPUMCTXCORE pCtxCore, RTGCPTR GCPtrDst, void *pvSrc, uint32_t cb)
     285{
     286    /** @todo Need to update PGMVerifyAccess to take access handlers into account for Ring-0 and
     287     *        raw mode code. Some thought needs to be spent on theoretical concurrency issues as
     288     *        as well since we're not behind the pgm lock and handler may change between calls.
     289     *        MMGCRamWriteNoTrapHandler may also trap if the page isn't shadowed, or was kicked
     290     *        out from both the shadow pt (SMP or our changes) and TLB.
     291     *
     292     *        Currently MMGCRamWriteNoTrapHandler may also fail when it hits a write access handler.
     293     *        PGMPhysInterpretedWriteNoHandlers/PGMPhysWriteGCPtr OTOH may mess up the state
     294     *        of some shadowed structure in R0. */
    284295#ifdef IN_RC
    285     return MMGCRamWriteNoTrapHandler((void *)GCDest, pSrc, cb);
     296    NOREF(pCtxCore);
     297    return MMGCRamWriteNoTrapHandler((void *)GCPtrDst, pvSrc, cb);
     298#elif IN_RING0
     299# ifdef VBOX_WITH_NEW_PHYS_CODE /* PGMPhysWriteGCPtr will fail, make sure we ignore handlers here. */
     300    return PGMPhysInterpretedWriteNoHandlers(pVM, pCtxCore, GCPtrDst, pvSrc, cb, false /*fRaiseTrap*/);
     301# else
     302    NOREF(pCtxCore);
     303    return PGMPhysWriteGCPtr(pVM, GCPtrDst, pvSrc, cb);
     304# endif
    286305#else
    287     return PGMPhysWriteGCPtr(pVM, GCDest, pSrc, cb);
     306    NOREF(pCtxCore);
     307    return PGMPhysWriteGCPtr(pVM, GCPtrDst, pvSrc, cb);
    288308#endif
    289309}
     
    492512                if (rc != VINF_SUCCESS)
    493513                    break;
    494                 rc = iomRamWrite(pVM, (RTGCPTR)pu8Virt, &u32Data, cb);
     514                rc = iomRamWrite(pVM, pRegFrame, (RTGCPTR)pu8Virt, &u32Data, cb);
    495515                if (rc != VINF_SUCCESS)
    496516                {
     
    15151535        if (!IOM_SUCCESS(rc))
    15161536            break;
    1517         int rc2 = iomRamWrite(pVM, GCPtrDst, &u32Value, cbTransfer);
     1537        int rc2 = iomRamWrite(pVM, pRegFrame, GCPtrDst, &u32Value, cbTransfer);
    15181538        Assert(rc2 == VINF_SUCCESS); NOREF(rc2);
    15191539        GCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCPtrDst + cbTransfer);
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