VirtualBox

Changeset 2505 in vbox


Ignore:
Timestamp:
May 4, 2007 6:20:07 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
20936
Message:

Documented port I/O status code and fixed places where we didn't handle them correctly. (part 2)

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

Legend:

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

    r2232 r2505  
    965965}
    966966
     967
     968#ifdef DEBUG
     969
    967970/**
    968971 * Steps hardware accelerated mode.
     
    10191022}
    10201023
    1021 #ifdef DEBUG
     1024
    10221025void emR3SingleStepExecRaw(PVM pVM, uint32_t cIterations)
    10231026{
    10241027    EMSTATE  enmOldState = pVM->em.s.enmState;
    1025     PCPUMCTX pCtx        = pVM->em.s.pCtx;
    10261028
    10271029    pVM->em.s.enmState = EMSTATE_DEBUG_GUEST_RAW;
     
    10391041}
    10401042
     1043
    10411044void emR3SingleStepExecHwAcc(PVM pVM, uint32_t cIterations)
    10421045{
    10431046    EMSTATE  enmOldState = pVM->em.s.enmState;
    1044     PCPUMCTX pCtx        = pVM->em.s.pCtx;
    10451047
    10461048    pVM->em.s.enmState = EMSTATE_DEBUG_GUEST_HWACC;
     
    10581060}
    10591061
     1062
    10601063void emR3SingleStepExecRem(PVM pVM, uint32_t cIterations)
    10611064{
    10621065    EMSTATE  enmOldState = pVM->em.s.enmState;
    1063     PCPUMCTX pCtx        = pVM->em.s.pCtx;
    10641066
    10651067    pVM->em.s.enmState = EMSTATE_DEBUG_GUEST_REM;
     
    10761078    pVM->em.s.enmState = enmOldState;
    10771079}
    1078 #endif
     1080
     1081#endif /* DEBUG */
     1082
    10791083
    10801084/**
     
    12701274    if (VBOX_SUCCESS(rc))
    12711275    {
     1276        rc = VINF_EM_RESCHEDULE_REM;
     1277
    12721278        if (!(Cpu.prefix & (PREFIX_REP | PREFIX_REPNE)))
    12731279        {
     
    12771283                {
    12781284                    STAM_COUNTER_INC(&pVM->em.s.CTXSUFF(pStats)->StatIn);
    1279 
    12801285                    rc = IOMInterpretIN(pVM, CPUMCTX2CORE(pCtx), &Cpu);
    1281                     if (rc == VINF_SUCCESS)
    1282                     {
    1283                         pCtx->eip += Cpu.opsize;
    1284                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1285                         return VINF_SUCCESS;
    1286                     }
    1287                     else
    1288                     if (rc == VINF_EM_RAW_GUEST_TRAP)
    1289                     {
    1290                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1291                         rc = emR3RawGuestTrap(pVM);
    1292                         return rc;
    1293                     }
    1294                     /* emulate in the recompiler */
    12951286                    break;
    12961287                }
     
    12991290                {
    13001291                    STAM_COUNTER_INC(&pVM->em.s.CTXSUFF(pStats)->StatOut);
    1301 
    13021292                    rc = IOMInterpretOUT(pVM, CPUMCTX2CORE(pCtx), &Cpu);
    1303                     if (rc == VINF_SUCCESS)
    1304                     {
    1305                         pCtx->eip += Cpu.opsize;
    1306                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1307                         return VINF_SUCCESS;
    1308                     }
    1309                     else
    1310                     if (rc == VINF_EM_RAW_GUEST_TRAP)
    1311                     {
    1312                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1313                         rc = emR3RawGuestTrap(pVM);
    1314                         return rc;
    1315                     }
    1316                     /* emulate in the recompiler */
    13171293                    break;
    13181294                }
    1319 
    1320                 default:
    1321                     break;
    13221295            }
    1323         }//if(!(Cpu.prefix & (PREFIX_REP|PREFIX_REPNE))
     1296        }
    13241297        else if (Cpu.prefix & PREFIX_REP)
    13251298        {
     
    13311304                    STAM_COUNTER_INC(&pVM->em.s.CTXSUFF(pStats)->StatIn);
    13321305                    rc = IOMInterpretINS(pVM, CPUMCTX2CORE(pCtx), &Cpu);
    1333                     if (rc == VINF_SUCCESS)
    1334                     {
    1335                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1336                         pCtx->eip += Cpu.opsize;
    1337                         return rc;
    1338                     }
    1339                     else
    1340                     if (rc == VINF_EM_RAW_GUEST_TRAP)
    1341                     {
    1342                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1343                         rc = emR3RawGuestTrap(pVM);
    1344                         return rc;
    1345                     }
    1346                     /* emulate in the recompiler */
    13471306                    break;
    13481307                }
     1308
    13491309                case OP_OUTSB:
    13501310                case OP_OUTSWD:
     
    13521312                    STAM_COUNTER_INC(&pVM->em.s.CTXSUFF(pStats)->StatOut);
    13531313                    rc = IOMInterpretOUTS(pVM, CPUMCTX2CORE(pCtx), &Cpu);
    1354                     if (rc == VINF_SUCCESS)
    1355                     {
    1356                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1357                         pCtx->eip += Cpu.opsize;
    1358                         return rc;
    1359                     }
    1360                     else
    1361                     if (rc == VINF_EM_RAW_GUEST_TRAP)
    1362                     {
    1363                         STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
    1364                         rc = emR3RawGuestTrap(pVM);
    1365                         return rc;
    1366                     }
    1367                     /* emulate in the recompiler */
    13681314                    break;
    13691315                }
    13701316            }
    1371         }//if(Cpu.prefix & PREFIX_REP)
     1317        }
     1318
     1319        /*
     1320         * Handled the I/O return codes.
     1321         * (The unhandled cases ends up with rc == VINF_EM_RESCHEDULE_REM.)
     1322         */
     1323        if (    rc == VINF_SUCCESS
     1324            ||  (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST))
     1325        {
     1326            pCtx->eip += Cpu.opsize;
     1327            STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
     1328            return rc;
     1329        }
     1330        if (rc == VINF_EM_RAW_GUEST_TRAP)
     1331        {
     1332            STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
     1333            rc = emR3RawGuestTrap(pVM);
     1334            return rc;
     1335        }
     1336        AssertMsg(rc != VINF_TRPM_XCPT_DISPATCHED, ("Handle VINF_TRPM_XCPT_DISPATCHED\n"));
     1337        if (VBOX_FAILURE(rc))
     1338        {
     1339            STAM_PROFILE_STOP(&pVM->em.s.StatIOEmu, a);
     1340            return rc;
     1341        }
     1342        AssertMsg(rc == VINF_EM_RESCHEDULE_REM, ("rc=%Vrc\n", rc));
    13721343    }
    13731344
     
    21962167        case VINF_IOM_HC_IOPORT_READ:
    21972168        case VINF_IOM_HC_IOPORT_WRITE:
    2198         case VINF_IOM_HC_IOPORT_READWRITE:
    21992169            rc = emR3RawExecuteIOInstruction(pVM);
    22002170            break;
     
    25252495            ||  rc == VINF_IOM_HC_IOPORT_READ
    25262496            ||  rc == VINF_IOM_HC_IOPORT_WRITE
    2527             ||  rc == VINF_IOM_HC_IOPORT_READWRITE
    25282497            //||  rc == VINF_PATM_PATCH_INT3
    25292498           )
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r2136 r2505  
    4747#include <iprt/string.h>
    4848
     49
    4950/*******************************************************************************
    5051*   Structures and Typedefs                                                    *
     
    5455typedef EMDECL(uint32_t) PFN_EMULATE_PARAM3(uint32_t *pu32Param1, uint32_t val2, size_t val3);
    5556
     57
    5658/*******************************************************************************
    57  *   Internal Functions                                                        *
    58  *******************************************************************************/
    59 
     59*   Internal Functions                                                         *
     60*******************************************************************************/
    6061DECLINLINE(int) emInterpretInstructionCPU(PVM pVM, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize);
     62
    6163
    6264/**
     
    271273#ifdef IN_GC
    272274    int rc = IOMGCIOPortHandler(pVM, pCtxCore, pCpu);
    273     if (rc == VINF_SUCCESS)
     275    if (    rc == VINF_SUCCESS
     276        ||  (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST))
    274277        pCtxCore->eip += cbOp;
    275278    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette