VirtualBox

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


Ignore:
Timestamp:
Aug 26, 2009 10:22:16 PM (15 years ago)
Author:
vboxsync
Message:

VMM,DevPCI,VBox/types.h: Added a VBOXSTRICTRC type for indicating strict VBox stuatus codes. Some expirmentation with making it a class in strict builds to get some help from the compiler with making sure the return code is treated correctly.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
3 edited

Legend:

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

    r22121 r22493  
    361361 * @remark  This may raise exceptions.
    362362 */
    363 VMMDECL(int) EMInterpretPortIO(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pDis, uint32_t cbOp)
     363VMMDECL(VBOXSTRICTRC) EMInterpretPortIO(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pDis, uint32_t cbOp)
    364364{
    365365    /*
     
    367367     */
    368368#ifdef IN_RC
    369     int rc = IOMGCIOPortHandler(pVM, pCtxCore, pDis);
    370     if (IOM_SUCCESS(rc))
     369    VBOXSTRICTRC rcStrict = IOMGCIOPortHandler(pVM, pCtxCore, pDis);
     370    if (IOM_SUCCESS(rcStrict))
    371371        pCtxCore->rip += cbOp;
    372     return rc;
     372    return rcStrict;
    373373#else
    374374    AssertReleaseMsgFailed(("not implemented\n"));
  • trunk/src/VBox/VMM/VMMAll/IOMAll.cpp

    r19807 r22493  
    259259 * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
    260260 */
    261 VMMDECL(int) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue)
     261VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue)
    262262{
    263263    /* Take the IOM lock before performing any device I/O. */
    264     int rc = iomLock(pVM);
    265 #ifndef IN_RING3
    266     if (rc == VERR_SEM_BUSY)
     264    int rc2 = iomLock(pVM);
     265#ifndef IN_RING3
     266    if (rc2 == VERR_SEM_BUSY)
    267267        return VINF_IOM_HC_IOPORT_READ;
    268 #else
    269     AssertRC(rc);
    270 #endif
     268#endif
     269    AssertRC(rc2);
    271270
    272271#ifdef VBOX_WITH_STATISTICS
     
    316315            STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfIn), a);
    317316#endif
    318         rc = pRange->pfnInCallback(pRange->pDevIns, pRange->pvUser, Port, pu32Value, (unsigned)cbValue);
     317        VBOXSTRICTRC rcStrict = pRange->pfnInCallback(pRange->pDevIns, pRange->pvUser, Port, pu32Value, (unsigned)cbValue);
    319318#ifdef VBOX_WITH_STATISTICS
    320319        if (pStats)
    321320            STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
    322         if (rc == VINF_SUCCESS && pStats)
     321        if (rcStrict == VINF_SUCCESS && pStats)
    323322            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
    324323# ifndef IN_RING3
    325         else if (rc == VINF_IOM_HC_IOPORT_READ && pStats)
     324        else if (rcStrict == VINF_IOM_HC_IOPORT_READ && pStats)
    326325            STAM_COUNTER_INC(&pStats->CTX_MID_Z(In,ToR3));
    327326# endif
    328327#endif
    329         if (rc == VERR_IOM_IOPORT_UNUSED)
     328        if (rcStrict == VERR_IOM_IOPORT_UNUSED)
    330329        {
    331330            /* make return value */
    332             rc = VINF_SUCCESS;
     331            rcStrict = VINF_SUCCESS;
    333332            switch (cbValue)
    334333            {
     
    342341            }
    343342        }
    344         Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=%Rrc\n", Port, *pu32Value, cbValue, rc));
    345         iomUnlock(pVM);
    346         return rc;
     343        Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=%Rrc\n", Port, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict)));
     344        iomUnlock(pVM);
     345        return rcStrict;
    347346    }
    348347
     
    415414 * @param   pcTransfers Pointer to the number of transfer units to read, on return remaining transfer units.
    416415 * @param   cb          Size of the transfer unit (1, 2 or 4 bytes).
    417  *   */
    418 VMMDECL(int) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb)
     416 */
     417VMMDECL(VBOXSTRICTRC) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb)
    419418{
    420419    /* Take the IOM lock before performing any device I/O. */
    421     int rc = iomLock(pVM);
    422 #ifndef IN_RING3
    423     if (rc == VERR_SEM_BUSY)
     420    int rc2 = iomLock(pVM);
     421#ifndef IN_RING3
     422    if (rc2 == VERR_SEM_BUSY)
    424423        return VINF_IOM_HC_IOPORT_READ;
    425424#endif
    426     AssertRC(rc);
     425    AssertRC(rc2);
    427426
    428427#ifdef LOG_ENABLED
     
    476475#endif
    477476
    478         int rc = pRange->pfnInStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrDst, pcTransfers, cb);
     477        VBOXSTRICTRC rcStrict = pRange->pfnInStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrDst, pcTransfers, cb);
    479478#ifdef VBOX_WITH_STATISTICS
    480479        if (pStats)
    481480            STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
    482         if (rc == VINF_SUCCESS && pStats)
     481        if (rcStrict == VINF_SUCCESS && pStats)
    483482            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
    484483# ifndef IN_RING3
    485         else if (rc == VINF_IOM_HC_IOPORT_READ && pStats)
     484        else if (rcStrict == VINF_IOM_HC_IOPORT_READ && pStats)
    486485            STAM_COUNTER_INC(&pStats->CTX_MID_Z(In, ToR3));
    487486# endif
    488487#endif
    489488        Log3(("IOMIOPortReadStr: Port=%RTiop pGCPtrDst=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=%Rrc\n",
    490               Port, pGCPtrDst, pcTransfers, cTransfers, *pcTransfers, cb, rc));
    491         iomUnlock(pVM);
    492         return rc;
     489              Port, pGCPtrDst, pcTransfers, cTransfers, *pcTransfers, cb, VBOXSTRICTRC_VAL(rcStrict)));
     490        iomUnlock(pVM);
     491        return rcStrict;
    493492    }
    494493
     
    551550 * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
    552551 */
    553 VMMDECL(int) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue)
     552VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue)
    554553{
    555554    /* Take the IOM lock before performing any device I/O. */
    556     int rc = iomLock(pVM);
    557 #ifndef IN_RING3
    558     if (rc == VERR_SEM_BUSY)
     555    int rc2 = iomLock(pVM);
     556#ifndef IN_RING3
     557    if (rc2 == VERR_SEM_BUSY)
    559558        return VINF_IOM_HC_IOPORT_WRITE;
    560559#endif
    561     AssertRC(rc);
    562 
    563 /** @todo bird: When I get time, I'll remove the GC tree and link the GC entries to the ring-3 node. */
     560    AssertRC(rc2);
     561
     562/** @todo bird: When I get time, I'll remove the RC/R0 trees and link the RC/R0
     563 *        entries to the ring-3 node. */
    564564#ifdef VBOX_WITH_STATISTICS
    565565    /*
     
    608608            STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfOut), a);
    609609#endif
    610         int rc = pRange->pfnOutCallback(pRange->pDevIns, pRange->pvUser, Port, u32Value, (unsigned)cbValue);
     610        VBOXSTRICTRC rcStrict = pRange->pfnOutCallback(pRange->pDevIns, pRange->pvUser, Port, u32Value, (unsigned)cbValue);
    611611
    612612#ifdef VBOX_WITH_STATISTICS
    613613        if (pStats)
    614614            STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
    615         if (rc == VINF_SUCCESS && pStats)
     615        if (rcStrict == VINF_SUCCESS && pStats)
    616616            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
    617617# ifndef IN_RING3
    618         else if (rc == VINF_IOM_HC_IOPORT_WRITE && pStats)
     618        else if (rcStrict == VINF_IOM_HC_IOPORT_WRITE && pStats)
    619619            STAM_COUNTER_INC(&pStats->CTX_MID_Z(Out, ToR3));
    620620# endif
    621621#endif
    622         Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d rc=%Rrc\n", Port, u32Value, cbValue, rc));
    623         iomUnlock(pVM);
    624         return rc;
     622        Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d rc=%Rrc\n", Port, u32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict)));
     623        iomUnlock(pVM);
     624        return rcStrict;
    625625    }
    626626
     
    683683 * @param   cb          Size of the transfer unit (1, 2 or 4 bytes).
    684684 *   */
    685 VMMDECL(int) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb)
     685VMMDECL(VBOXSTRICTRC) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb)
    686686{
    687687    /* Take the IOM lock before performing any device I/O. */
    688     int rc = iomLock(pVM);
    689 #ifndef IN_RING3
    690     if (rc == VERR_SEM_BUSY)
     688    int rc2 = iomLock(pVM);
     689#ifndef IN_RING3
     690    if (rc2 == VERR_SEM_BUSY)
    691691        return VINF_IOM_HC_IOPORT_WRITE;
    692692#endif
    693     AssertRC(rc);
     693    AssertRC(rc2);
    694694
    695695#ifdef LOG_ENABLED
     
    742742            STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfOut), a);
    743743#endif
    744         int rc = pRange->pfnOutStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrSrc, pcTransfers, cb);
     744        VBOXSTRICTRC rcStrict = pRange->pfnOutStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrSrc, pcTransfers, cb);
    745745#ifdef VBOX_WITH_STATISTICS
    746746        if (pStats)
    747747            STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
    748         if (rc == VINF_SUCCESS && pStats)
     748        if (rcStrict == VINF_SUCCESS && pStats)
    749749            STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
    750750# ifndef IN_RING3
    751         else if (rc == VINF_IOM_HC_IOPORT_WRITE && pStats)
     751        else if (rcStrict == VINF_IOM_HC_IOPORT_WRITE && pStats)
    752752            STAM_COUNTER_INC(&pStats->CTX_MID_Z(Out, ToR3));
    753753# endif
    754754#endif
    755         Log3(("IOMIOPortWriteStr: Port=%RTiop pGCPtrSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=%Rrc\n",
    756               Port, pGCPtrSrc, pcTransfers, cTransfers, *pcTransfers, cb, rc));
    757         iomUnlock(pVM);
    758         return rc;
     755        Log3(("IOMIOPortWriteStr: Port=%RTiop pGCPtrSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rcStrict=%Rrc\n",
     756              Port, pGCPtrSrc, pcTransfers, cTransfers, *pcTransfers, cb, VBOXSTRICTRC_VAL(rcStrict)));
     757        iomUnlock(pVM);
     758        return rcStrict;
    759759    }
    760760
     
    818818 * @param   cb          The access size.
    819819 */
    820 VMMDECL(int) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb)
     820VMMDECL(VBOXSTRICTRC) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb)
    821821{
    822822    PVMCPU pVCpu = VMMGetCpu(pVM);
     
    839839        RTGCUINTPTR cbTss;
    840840        bool        fCanHaveIOBitmap;
    841         int rc = SELMGetTSSInfo(pVM, pVCpu, &GCPtrTss, &cbTss, &fCanHaveIOBitmap);
    842         if (RT_FAILURE(rc))
    843         {
    844             Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d %Rrc -> #GP(0)\n", Port, cb, rc));
     841        int rc2 = SELMGetTSSInfo(pVM, pVCpu, &GCPtrTss, &cbTss, &fCanHaveIOBitmap);
     842        if (RT_FAILURE(rc2))
     843        {
     844            Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d %Rrc -> #GP(0)\n", Port, cb, rc2));
    845845            return TRPMRaiseXcptErr(pVCpu, pCtxCore, X86_XCPT_GP, 0);
    846846        }
     
    858858         */
    859859        uint16_t offIOPB;
    860         rc = PGMPhysInterpretedRead(pVCpu, pCtxCore, &offIOPB, GCPtrTss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(offIOPB));
    861         if (rc != VINF_SUCCESS)
     860        VBOXSTRICTRC rcStrict = PGMPhysInterpretedRead(pVCpu, pCtxCore, &offIOPB, GCPtrTss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(offIOPB));
     861        if (rcStrict != VINF_SUCCESS)
    862862        {
    863863            Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d GCPtrTss=%RGv %Rrc\n",
    864                  Port, cb, GCPtrTss, rc));
    865             return rc;
     864                 Port, cb, GCPtrTss, VBOXSTRICTRC_VAL(rcStrict)));
     865            return rcStrict;
    866866        }
    867867
     
    877877        }
    878878        uint16_t u16;
    879         rc = PGMPhysInterpretedRead(pVCpu, pCtxCore, &u16, GCPtrTss + offTss, sizeof(u16));
    880         if (rc != VINF_SUCCESS)
     879        rcStrict = PGMPhysInterpretedRead(pVCpu, pCtxCore, &u16, GCPtrTss + offTss, sizeof(u16));
     880        if (rcStrict != VINF_SUCCESS)
    881881        {
    882882            Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d GCPtrTss=%RGv offTss=%#x -> %Rrc\n",
    883                  Port, cb, GCPtrTss, offTss, rc));
    884             return rc;
     883                 Port, cb, GCPtrTss, offTss, VBOXSTRICTRC_VAL(rcStrict)));
     884            return rcStrict;
    885885        }
    886886
     
    918918 * @param   pCpu        Disassembler CPU state.
    919919 */
    920 VMMDECL(int) IOMInterpretIN(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
     920VMMDECL(VBOXSTRICTRC) IOMInterpretIN(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
    921921{
    922922#ifdef IN_RC
     
    935935    cbSize = DISGetParamSize(pCpu, &pCpu->param1);
    936936    Assert(cbSize > 0);
    937     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
    938     if (rc == VINF_SUCCESS)
     937    VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
     938    if (rcStrict == VINF_SUCCESS)
    939939    {
    940940        /*
     
    942942         */
    943943        uint32_t u32Data = UINT32_C(0xffffffff);
    944         rc = IOMIOPortRead(pVM, uPort, &u32Data, cbSize);
    945         if (IOM_SUCCESS(rc))
     944        rcStrict = IOMIOPortRead(pVM, uPort, &u32Data, cbSize);
     945        if (IOM_SUCCESS(rcStrict))
    946946        {
    947947            /*
     
    952952        }
    953953        else
    954             AssertMsg(rc == VINF_IOM_HC_IOPORT_READ || RT_FAILURE(rc), ("%Rrc\n", rc));
     954            AssertMsg(rcStrict == VINF_IOM_HC_IOPORT_READ || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
    955955    }
    956956    else
    957         AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));
    958     return rc;
     957        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     958
     959    return rcStrict;
    959960}
    960961
     
    977978 * @param   pCpu        Disassembler CPU state.
    978979 */
    979 VMMDECL(int) IOMInterpretOUT(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
     980VMMDECL(VBOXSTRICTRC) IOMInterpretOUT(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
    980981{
    981982#ifdef IN_RC
     
    992993    AssertMsg(fRc, ("Failed to get reg/imm port number!\n")); NOREF(fRc);
    993994
    994     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
    995     if (rc == VINF_SUCCESS)
     995    VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
     996    if (rcStrict == VINF_SUCCESS)
    996997    {
    997998        uint64_t u64Data = 0;
     
    10021003         * Attempt to write to the port.
    10031004         */
    1004         rc = IOMIOPortWrite(pVM, uPort, u64Data, cbSize);
    1005         AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || RT_FAILURE(rc), ("%Rrc\n", rc));
     1005        rcStrict = IOMIOPortWrite(pVM, uPort, u64Data, cbSize);
     1006        AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_HC_IOPORT_WRITE || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
    10061007    }
    10071008    else
    1008         AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));
    1009     return rc;
    1010 }
     1009        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     1010    return rcStrict;
     1011}
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r21134 r22493  
    12591259    LogFlow(("IOMMMIOHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n",
    12601260             GCPhysFault, (uint32_t)uErrorCode, pvFault, (RTGCPTR)pCtxCore->rip));
    1261     return iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, pvUser);
     1261    VBOXSTRICTRC rcStrict = iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, pvUser);
     1262    return VBOXSTRICTRC_VAL(rcStrict);
    12621263}
    12631264
     
    12711272 * @param   GCPhysFault The GC physical address.
    12721273 */
    1273 VMMDECL(int) IOMMMIOPhysHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault)
    1274 {
    1275     int rc;
    1276     rc = iomLock(pVM);
     1274VMMDECL(VBOXSTRICTRC) IOMMMIOPhysHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault)
     1275{
     1276    int rc2 = iomLock(pVM);
    12771277#ifndef IN_RING3
    1278     if (rc == VERR_SEM_BUSY)
     1278    if (rc2 == VERR_SEM_BUSY)
    12791279        return (uErrorCode & X86_TRAP_PF_RW) ? VINF_IOM_HC_MMIO_WRITE : VINF_IOM_HC_MMIO_READ;
    12801280#endif
    1281     rc = iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, iomMMIOGetRange(&pVM->iom.s, GCPhysFault));
     1281    VBOXSTRICTRC rcStrict = iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, iomMMIOGetRange(&pVM->iom.s, GCPhysFault));
    12821282    iomUnlock(pVM);
    1283     return rc;
     1283    return VBOXSTRICTRC_VAL(rcStrict);
    12841284}
    12851285
     
    13331333 * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
    13341334 */
    1335 VMMDECL(int) IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue)
     1335VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue)
    13361336{
    13371337    /* Take the IOM lock before performing any MMIO. */
     
    14541454 * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
    14551455 */
    1456 VMMDECL(int) IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue)
     1456VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue)
    14571457{
    14581458    /* Take the IOM lock before performing any MMIO. */
     
    15491549 * @param   cbTransfer      Size of transfer unit
    15501550 */
    1551 VMMDECL(int) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
     1551VMMDECL(VBOXSTRICTRC) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
    15521552{
    15531553#ifdef VBOX_WITH_STATISTICS
     
    15871587    /* Convert destination address es:edi. */
    15881588    RTGCPTR GCPtrDst;
    1589     int rc = SELMToFlatEx(pVM, DIS_SELREG_ES, pRegFrame, (RTGCPTR)pRegFrame->rdi,
    1590                           SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
    1591                           &GCPtrDst);
    1592     if (RT_FAILURE(rc))
    1593     {
    1594         Log(("INS destination address conversion failed -> fallback, rc=%d\n", rc));
     1589    int rc2 = SELMToFlatEx(pVM, DIS_SELREG_ES, pRegFrame, (RTGCPTR)pRegFrame->rdi,
     1590                           SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
     1591                           &GCPtrDst);
     1592    if (RT_FAILURE(rc2))
     1593    {
     1594        Log(("INS destination address conversion failed -> fallback, rc2=%d\n", rc2));
    15951595        return VINF_EM_RAW_EMULATE_INSTR;
    15961596    }
     
    15991599    uint32_t cpl = CPUMGetGuestCPL(pVCpu, pRegFrame);
    16001600
    1601     rc = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrDst, cTransfers * cbTransfer,
    1602                          X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0));
    1603     if (rc != VINF_SUCCESS)
    1604     {
    1605         Log(("INS will generate a trap -> fallback, rc=%d\n", rc));
     1601    rc2 = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrDst, cTransfers * cbTransfer,
     1602                          X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0));
     1603    if (rc2 != VINF_SUCCESS)
     1604    {
     1605        Log(("INS will generate a trap -> fallback, rc2=%d\n", rc2));
    16061606        return VINF_EM_RAW_EMULATE_INSTR;
    16071607    }
    16081608
    16091609    Log(("IOM: rep ins%d port %#x count %d\n", cbTransfer * 8, uPort, cTransfers));
     1610    VBOXSTRICTRC rcStrict = VINF_SUCCESS;
    16101611    if (cTransfers > 1)
    16111612    {
     
    16131614         * much as it wants. The rest is done with single-word transfers. */
    16141615        const RTGCUINTREG cTransfersOrg = cTransfers;
    1615         rc = IOMIOPortReadString(pVM, uPort, &GCPtrDst, &cTransfers, cbTransfer);
    1616         AssertRC(rc); Assert(cTransfers <= cTransfersOrg);
     1616        rcStrict = IOMIOPortReadString(pVM, uPort, &GCPtrDst, &cTransfers, cbTransfer);
     1617        AssertRC(VBOXSTRICTRC_VAL(rcStrict)); Assert(cTransfers <= cTransfersOrg);
    16171618        pRegFrame->rdi += (cTransfersOrg - cTransfers) * cbTransfer;
    16181619    }
     
    16211622    MMGCRamRegisterTrapHandler(pVM);
    16221623#endif
    1623 
    1624     while (cTransfers && rc == VINF_SUCCESS)
     1624    while (cTransfers && rcStrict == VINF_SUCCESS)
    16251625    {
    16261626        uint32_t u32Value;
    1627         rc = IOMIOPortRead(pVM, uPort, &u32Value, cbTransfer);
    1628         if (!IOM_SUCCESS(rc))
     1627        rcStrict = IOMIOPortRead(pVM, uPort, &u32Value, cbTransfer);
     1628        if (!IOM_SUCCESS(rcStrict))
    16291629            break;
    16301630        int rc2 = iomRamWrite(pVCpu, pRegFrame, GCPtrDst, &u32Value, cbTransfer);
     
    16421642        pRegFrame->ecx = cTransfers;
    16431643
    1644     AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_READ || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || RT_FAILURE(rc), ("%Rrc\n", rc));
    1645     return rc;
     1644    AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_HC_IOPORT_READ || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     1645    return rcStrict;
    16461646}
    16471647
     
    16661666 * @param   pCpu        Disassembler CPU state.
    16671667 */
    1668 VMMDECL(int) IOMInterpretINS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
     1668VMMDECL(VBOXSTRICTRC) IOMInterpretINS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
    16691669{
    16701670    /*
     
    16791679        cb = (pCpu->opmode == CPUMODE_16BIT) ? 2 : 4;       /* dword in both 32 & 64 bits mode */
    16801680
    1681     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
    1682     if (RT_UNLIKELY(rc != VINF_SUCCESS))
    1683     {
    1684         AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));
    1685         return rc;
     1681    VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
     1682    if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))
     1683    {
     1684        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     1685        return rcStrict;
    16861686    }
    16871687
     
    17121712 * @param   cbTransfer      Size of transfer unit
    17131713 */
    1714 VMMDECL(int) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
     1714VMMDECL(VBOXSTRICTRC) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
    17151715{
    17161716#ifdef VBOX_WITH_STATISTICS
     
    17491749    /* Convert source address ds:esi. */
    17501750    RTGCPTR GCPtrSrc;
    1751     int rc = SELMToFlatEx(pVM, DIS_SELREG_DS, pRegFrame, (RTGCPTR)pRegFrame->rsi,
    1752                           SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
    1753                           &GCPtrSrc);
    1754     if (RT_FAILURE(rc))
    1755     {
    1756         Log(("OUTS source address conversion failed -> fallback, rc=%Rrc\n", rc));
     1751    int rc2 = SELMToFlatEx(pVM, DIS_SELREG_DS, pRegFrame, (RTGCPTR)pRegFrame->rsi,
     1752                           SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
     1753                           &GCPtrSrc);
     1754    if (RT_FAILURE(rc2))
     1755    {
     1756        Log(("OUTS source address conversion failed -> fallback, rc2=%Rrc\n", rc2));
    17571757        return VINF_EM_RAW_EMULATE_INSTR;
    17581758    }
     
    17601760    /* Access verification first; we currently can't recover properly from traps inside this instruction */
    17611761    uint32_t cpl = CPUMGetGuestCPL(pVCpu, pRegFrame);
    1762     rc = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrSrc, cTransfers * cbTransfer,
    1763                          (cpl == 3) ? X86_PTE_US : 0);
    1764     if (rc != VINF_SUCCESS)
    1765     {
    1766         Log(("OUTS will generate a trap -> fallback, rc=%Rrc\n", rc));
     1762    rc2 = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrSrc, cTransfers * cbTransfer,
     1763                          (cpl == 3) ? X86_PTE_US : 0);
     1764    if (rc2 != VINF_SUCCESS)
     1765    {
     1766        Log(("OUTS will generate a trap -> fallback, rc2=%Rrc\n", rc2));
    17671767        return VINF_EM_RAW_EMULATE_INSTR;
    17681768    }
    17691769
    17701770    Log(("IOM: rep outs%d port %#x count %d\n", cbTransfer * 8, uPort, cTransfers));
     1771    VBOXSTRICTRC rcStrict = VINF_SUCCESS;
    17711772    if (cTransfers > 1)
    17721773    {
     
    17761777         */
    17771778        const RTGCUINTREG cTransfersOrg = cTransfers;
    1778         rc = IOMIOPortWriteString(pVM, uPort, &GCPtrSrc, &cTransfers, cbTransfer);
    1779         AssertRC(rc); Assert(cTransfers <= cTransfersOrg);
     1779        rcStrict = IOMIOPortWriteString(pVM, uPort, &GCPtrSrc, &cTransfers, cbTransfer);
     1780        AssertRC(VBOXSTRICTRC_VAL(rcStrict)); Assert(cTransfers <= cTransfersOrg);
    17801781        pRegFrame->rsi += (cTransfersOrg - cTransfers) * cbTransfer;
    17811782    }
     
    17851786#endif
    17861787
    1787     while (cTransfers && rc == VINF_SUCCESS)
     1788    while (cTransfers && rcStrict == VINF_SUCCESS)
    17881789    {
    17891790        uint32_t u32Value = 0;
    1790         rc = iomRamRead(pVCpu, &u32Value, GCPtrSrc, cbTransfer);
    1791         if (rc != VINF_SUCCESS)
     1791        rcStrict = iomRamRead(pVCpu, &u32Value, GCPtrSrc, cbTransfer);
     1792        if (rcStrict != VINF_SUCCESS)
    17921793            break;
    1793         rc = IOMIOPortWrite(pVM, uPort, u32Value, cbTransfer);
    1794         if (!IOM_SUCCESS(rc))
     1794        rcStrict = IOMIOPortWrite(pVM, uPort, u32Value, cbTransfer);
     1795        if (!IOM_SUCCESS(rcStrict))
    17951796            break;
    17961797        GCPtrSrc = (RTGCPTR)((RTUINTPTR)GCPtrSrc + cbTransfer);
     
    18071808        pRegFrame->ecx = cTransfers;
    18081809
    1809     AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || RT_FAILURE(rc), ("%Rrc\n", rc));
    1810     return rc;
     1810    AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_HC_IOPORT_WRITE || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     1811    return rcStrict;
    18111812}
    18121813
     
    18311832 * @param   pCpu        Disassembler CPU state.
    18321833 */
    1833 VMMDECL(int) IOMInterpretOUTS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
     1834VMMDECL(VBOXSTRICTRC) IOMInterpretOUTS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
    18341835{
    18351836    /*
     
    18461847        cb = (pCpu->opmode == CPUMODE_16BIT) ? 2 : 4;       /* dword in both 32 & 64 bits mode */
    18471848
    1848     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
    1849     if (RT_UNLIKELY(rc != VINF_SUCCESS))
    1850     {
    1851         AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));
    1852         return rc;
     1849    VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
     1850    if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))
     1851    {
     1852        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     1853        return rcStrict;
    18531854    }
    18541855
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