VirtualBox

Changeset 21209 in vbox for trunk/src


Ignore:
Timestamp:
Jul 3, 2009 2:50:36 PM (16 years ago)
Author:
vboxsync
Message:

Updates for io instruction restarts

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/EM.cpp

    r21196 r21209  
    351351        EM_REG_COUNTER_USED(&pStats->StatIn,                     "/EM/CPU%d/R3/PrivInst/In",                 "Number of in instructions.");
    352352        EM_REG_COUNTER_USED(&pStats->StatOut,                    "/EM/CPU%d/R3/PrivInst/Out",                "Number of out instructions.");
     353        EM_REG_COUNTER_USED(&pStats->StatIoRestarted,            "/EM/CPU%d/R3/PrivInst/IoRestarted",        "Number of restarted i/o instructions.");       
    353354        EM_REG_COUNTER_USED(&pStats->StatHlt,                    "/EM/CPU%d/R3/PrivInst/Hlt",                "Number of hlt instructions not handled in GC because of PATM.");
    354355        EM_REG_COUNTER_USED(&pStats->StatInvlpg,                 "/EM/CPU%d/R3/PrivInst/Invlpg",             "Number of invlpg instructions.");
  • trunk/src/VBox/VMM/EMHwaccm.cpp

    r21208 r21209  
    300300    STAM_PROFILE_START(&pVCpu->em.s.StatIOEmu, a);
    301301
     302    /* Try to restart the io instruction that was refused in ring-0. */
     303    rc = HWACCMR3RestartPendingIOInstr(pVM, pVCpu);
     304    if (rc == VINF_SUCCESS)
     305    {
     306        STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->StatIoRestarted);
     307        STAM_PROFILE_STOP(&pVCpu->em.s.StatIOEmu, a);
     308        return rc;     /* rip already updated. */
     309    }
     310
    302311    /** @todo probably we should fall back to the recompiler; otherwise we'll go back and forth between HC & GC
    303312     *   as io instructions tend to come in packages of more than one
  • trunk/src/VBox/VMM/EMInternal.h

    r21196 r21209  
    249249    STAMCOUNTER             StatSti;
    250250    STAMCOUNTER             StatIn;
     251    STAMCOUNTER             StatIoRestarted;
    251252    STAMCOUNTER             StatOut;
    252253    STAMCOUNTER             StatInvlpg;
  • trunk/src/VBox/VMM/HWACCM.cpp

    r21125 r21209  
    16351635}
    16361636
     1637/**
     1638 * Restart an I/O instruction that was refused in ring-0
     1639 *
     1640 * @returns VBox status code
     1641 * @param   pVM         The VM to operate on.
     1642 * @param   pVM         The VM to operate on.
     1643 */
     1644VMMR3DECL(int)  HWACCMR3RestartPendingIOInstr(PVM pVM, PVMCPU pVCpu)
     1645{
     1646    return VERR_NOT_FOUND;
     1647}
    16371648
    16381649/**
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r21208 r21209  
    599599        HWACCMPENDINGIO         enmType;
    600600        uint32_t                uPadding;
     601        RTGCPTR                 GCPtrRip;
     602        RTGCPTR                 GCPtrRipNext;
    601603        union
    602604        {
    603605            struct
    604606            {
    605                 RTGCPTR         rip;
    606607                unsigned        uPort;
    607608                unsigned        uAndVal;
     
    610611            struct
    611612            {
    612                 RTGCPTR         rip;
    613613                unsigned        uPort;
    614614                unsigned        uValue;
    615615                unsigned        cbSize;
    616616            } Write;
    617             uint64_t            aRaw[4];
     617            uint64_t            aRaw[2];
    618618        } Port;
    619619    } PendingIO;
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r21208 r21209  
    12241224 *
    12251225 * @param   pVCpu           The VMCPU to operate on.
    1226  * @param   GCPtrRIP        Address of IO instruction
     1226 * @param   GCPtrRip        Address of IO instruction
     1227 * @param   GCPtrRipNext    Address of the next instruction
    12271228 * @param   uPort           Port address
    12281229 * @param   uAndVal         And mask for saving the result in eax
    12291230 * @param   cbSize          Read size
    12301231 */
    1231 VMMR0DECL(void) HWACCMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR GCPtrRIP, unsigned uPort, unsigned uAndVal, unsigned cbSize)
    1232 {
    1233     pVCpu->hwaccm.s.PendingIO.enmType       = HWACCMPENDINGIO_PORT_READ;
    1234     pVCpu->hwaccm.s.PendingIO.Port.Read.rip      = GCPtrRIP;
     1232VMMR0DECL(void) HWACCMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext, unsigned uPort, unsigned uAndVal, unsigned cbSize)
     1233{
     1234    pVCpu->hwaccm.s.PendingIO.enmType            = HWACCMPENDINGIO_PORT_READ;
     1235    pVCpu->hwaccm.s.PendingIO.GCPtrRip           = GCPtrRip;
     1236    pVCpu->hwaccm.s.PendingIO.GCPtrRipNext       = GCPtrRipNext;
    12351237    pVCpu->hwaccm.s.PendingIO.Port.Read.uPort    = uPort;
    12361238    pVCpu->hwaccm.s.PendingIO.Port.Read.uAndVal  = uAndVal;
     
    12481250 * @param   cbSize          Read size
    12491251 */
    1250 VMMR0DECL(void) HWACCMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR GCPtrRIP, unsigned uPort, unsigned uValue, unsigned cbSize)
    1251 {
    1252     pVCpu->hwaccm.s.PendingIO.enmType        = HWACCMPENDINGIO_PORT_WRITE;
    1253     pVCpu->hwaccm.s.PendingIO.Port.Write.rip      = GCPtrRIP;
     1252VMMR0DECL(void) HWACCMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext, unsigned uPort, unsigned uValue, unsigned cbSize)
     1253{
     1254    pVCpu->hwaccm.s.PendingIO.enmType             = HWACCMPENDINGIO_PORT_WRITE;
     1255    pVCpu->hwaccm.s.PendingIO.GCPtrRip            = GCPtrRip;
     1256    pVCpu->hwaccm.s.PendingIO.GCPtrRipNext        = GCPtrRipNext;
    12541257    pVCpu->hwaccm.s.PendingIO.Port.Write.uPort    = uPort;
    12551258    pVCpu->hwaccm.s.PendingIO.Port.Write.uValue   = uValue;
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r21208 r21209  
    21092109                rc = IOMIOPortWrite(pVM, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize);
    21102110                if (rc == VINF_IOM_HC_IOPORT_WRITE)
    2111                     HWACCMR0SavePendingIOPortWrite(pVCpu, pCtx->rip, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize);
     2111                    HWACCMR0SavePendingIOPortWrite(pVCpu, pCtx->rip, pVMCB->ctrl.u64ExitInfo2, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize);
    21122112            }
    21132113            else
     
    21252125                else
    21262126                if (rc == VINF_IOM_HC_IOPORT_READ)
    2127                     HWACCMR0SavePendingIOPortRead(pVCpu, pCtx->rip, IoExitInfo.n.u16Port, uAndVal, uIOSize);
     2127                    HWACCMR0SavePendingIOPortRead(pVCpu, pCtx->rip, pVMCB->ctrl.u64ExitInfo2, IoExitInfo.n.u16Port, uAndVal, uIOSize);
    21282128            }
    21292129        }
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r21208 r21209  
    33923392                rc = IOMIOPortWrite(pVM, uPort, pCtx->eax & uAndVal, cbSize);
    33933393                if (rc == VINF_IOM_HC_IOPORT_WRITE)
    3394                     HWACCMR0SavePendingIOPortWrite(pVCpu, pCtx->rip, uPort, pCtx->eax & uAndVal, cbSize);
     3394                    HWACCMR0SavePendingIOPortWrite(pVCpu, pCtx->rip, pCtx->rip + cbInstr, uPort, pCtx->eax & uAndVal, cbSize);
    33953395            }
    33963396            else
     
    34073407                else
    34083408                if (rc == VINF_IOM_HC_IOPORT_READ)
    3409                     HWACCMR0SavePendingIOPortRead(pVCpu, pCtx->rip, uPort, uAndVal, cbSize);
     3409                    HWACCMR0SavePendingIOPortRead(pVCpu, pCtx->rip, pCtx->rip + cbInstr, uPort, uAndVal, cbSize);
    34103410            }
    34113411        }
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