VirtualBox

Changeset 17328 in vbox


Ignore:
Timestamp:
Mar 4, 2009 9:00:34 AM (16 years ago)
Author:
vboxsync
Message:

Deal with failed VINF_EM_RAW_EMULATE_IO_BLOCK attempts. Pointless to go back to ring 3.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/hwaccm.h

    r17303 r17328  
    7373 * @param   pCtx        CPU context
    7474 */
    75 #define HWACCMCanEmulateIoBlock(pCtx)    (!CPUMIsGuestInPagedProtectedModeEx(pCtx))
     75#define HWACCMCanEmulateIoBlock(pVM)       (!CPUMIsGuestInPagedProtectedMode(pVM))
     76#define HWACCMCanEmulateIoBlockEx(pCtx)    (!CPUMIsGuestInPagedProtectedModeEx(pCtx))
    7677
    7778VMMDECL(int)    HWACCMInvalidatePage(PVM pVM, RTGCPTR GCVirt);
  • trunk/src/VBox/VMM/HWACCM.cpp

    r17327 r17328  
    12041204
    12051205    /* This is primarily intended to speed up Grub, so we don't care about paged protected mode. */
    1206     if (HWACCMCanEmulateIoBlock(pCtx))
     1206    if (HWACCMCanEmulateIoBlockEx(pCtx))
    12071207    {
    12081208        Log(("HWACCMR3EmulateIoBlock -> enabled\n"));
  • trunk/src/VBox/VMM/IOM.cpp

    r16272 r17328  
    458458        {
    459459            /* register the statistics counters. */
    460             rc = STAMR3RegisterF(pVM, &pStats->ReadR3,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-R3", GCPhys); AssertRC(rc);
    461             rc = STAMR3RegisterF(pVM, &pStats->WriteR3,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-R3", GCPhys); AssertRC(rc);
    462             rc = STAMR3RegisterF(pVM, &pStats->ReadRZ,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZ", GCPhys); AssertRC(rc);
    463             rc = STAMR3RegisterF(pVM, &pStats->WriteRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZ", GCPhys); AssertRC(rc);
    464             rc = STAMR3RegisterF(pVM, &pStats->ReadRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZtoR3", GCPhys); AssertRC(rc);
    465             rc = STAMR3RegisterF(pVM, &pStats->WriteRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZtoR3", GCPhys); AssertRC(rc);
     460            rc = STAMR3RegisterF(pVM, &pStats->ReadR3,              STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-R3", GCPhys); AssertRC(rc);
     461            rc = STAMR3RegisterF(pVM, &pStats->WriteR3,             STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-R3", GCPhys); AssertRC(rc);
     462            rc = STAMR3RegisterF(pVM, &pStats->ReadRZ,              STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZ", GCPhys); AssertRC(rc);
     463            rc = STAMR3RegisterF(pVM, &pStats->WriteRZ,             STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZ", GCPhys); AssertRC(rc);
     464            rc = STAMR3RegisterF(pVM, &pStats->ReadRZToR3,          STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZtoR3", GCPhys); AssertRC(rc);
     465            rc = STAMR3RegisterF(pVM, &pStats->WriteRZToR3,         STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZtoR3", GCPhys); AssertRC(rc);
     466            rc = STAMR3RegisterF(pVM, &pStats->IOEmulateFailedR0,   STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-IOEmuFailedR0", GCPhys); AssertRC(rc);
    466467
    467468            /* Profiling */
  • trunk/src/VBox/VMM/IOMInternal.h

    r13413 r17328  
    128128    /** Number of writes to this address from R0/RC which was serviced in R3. */
    129129    STAMCOUNTER                 WriteRZToR3;
     130
     131    /** Number of failed IO block emulation attempts. */
     132    STAMCOUNTER                 IOEmulateFailedR0;
     133
    130134} IOMMMIOSTATS;
    131135/** Pointer to I/O port statistics. */
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r16567 r17328  
    13931393            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Write));
    13941394#endif
     1395#ifdef IN_RING0
     1396        if (    rc == VINF_EM_RAW_EMULATE_IO_BLOCK
     1397            &&  !HWACCMCanEmulateIoBlock(pVM))
     1398        {
     1399            /* Failed io emulation block attempt; just retry (a switch to ring 3 would jump right back) */
     1400# ifdef VBOX_WITH_STATISTICS
     1401            STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
     1402            STAM_COUNTER_INC(&pStats->IOEmulateFailedR0);
     1403# endif
     1404            int rc = pRange->CTX_SUFF(pfnWriteCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser), GCPhys, &u32Value, (unsigned)cbValue);
     1405# ifdef VBOX_WITH_STATISTICS
     1406            STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
     1407            if (rc != VINF_IOM_HC_MMIO_WRITE)
     1408                STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Write));
     1409# endif
     1410        }
     1411#endif
    13951412        Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, rc));
    13961413        return rc;
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