VirtualBox

Changeset 2504 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 4, 2007 6:12:30 PM (18 years ago)
Author:
vboxsync
Message:

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

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

Legend:

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

    r2270 r2504  
    719719 * Reads an I/O port register.
    720720 *
    721  * @returns VBox status code.
     721 * @returns Strict VBox status code. Informational status codes other than the one documented
     722 *          here are to be treated as internal failure.
     723 * @retval  VINF_SUCCESS                Success.
     724 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     725 * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
    722726 *
    723727 * @param   pVM         VM handle.
     
    857861 * Reads the string buffer of an I/O port register.
    858862 *
    859  * @returns VBox status code.
     863 * @returns Strict VBox status code. Informational status codes other than the one documented
     864 *          here are to be treated as internal failure.
     865 * @retval  VINF_SUCCESS                Success.
     866 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     867 * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
    860868 *
    861869 * @param   pVM         VM handle.
     
    978986 * Writes to an I/O port register.
    979987 *
    980  * @returns VBox status code.
     988 * @returns Strict VBox status code. Informational status codes other than the one documented
     989 *          here are to be treated as internal failure.
     990 * @retval  VINF_SUCCESS                Success.
     991 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     992 * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
    981993 *
    982994 * @param   pVM         VM handle.
     
    10891101    return VINF_SUCCESS;
    10901102}
     1103
     1104
    10911105/**
    10921106 * Writes the string buffer of an I/O port register.
    10931107 *
    1094  * @returns VBox status code.
     1108 * @returns Strict VBox status code. Informational status codes other than the one documented
     1109 *          here are to be treated as internal failure.
     1110 * @retval  VINF_SUCCESS                Success.
     1111 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1112 * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
    10951113 *
    10961114 * @param   pVM         VM handle.
     
    12081226}
    12091227
     1228
    12101229/**
    12111230 * Checks that the operation is allowed according to the IOPL
    12121231 * level and I/O bitmap.
    12131232 *
    1214  * @returns VBox status code.
    1215  *          If not VINF_SUCCESS a \#GP(0) was raised or an error occured.
     1233 * @returns Strict VBox status code. Informational status codes other than the one documented
     1234 *          here are to be treated as internal failure.
     1235 * @retval  VINF_SUCCESS                Success.
     1236 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1237 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1238 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    12161239 *
    12171240 * @param   pVM         VM handle.
     
    13031326 * IN <AL|AX|EAX>, <DX|imm16>
    13041327 *
    1305  * @returns VBox status code.
     1328 * @returns Strict VBox status code. Informational status codes other than the one documented
     1329 *          here are to be treated as internal failure.
     1330 * @retval  VINF_SUCCESS                Success.
     1331 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1332 * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
     1333 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1334 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1335 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    13061336 *
    13071337 * @param   pVM         The virtual machine (GC pointer ofcourse).
     
    13341364        uint32_t    u32Data = ~0U;
    13351365        rc = IOMIOPortRead(pVM, uPort, &u32Data, cbSize);
    1336         if (rc == VINF_SUCCESS)
     1366        if (    rc == VINF_SUCCESS
     1367            ||  (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST))
    13371368        {
    13381369            /*
     
    13421373            AssertMsg(fRc, ("Failed to store register value!\n")); NOREF(fRc);
    13431374        }
    1344     }
     1375        else
     1376            AssertMsg(rc == VINF_IOM_HC_IOPORT_READ || VBOX_FAILURE(rc), ("%Vrc\n", rc));
     1377    }
     1378    else
     1379        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
    13451380    return rc;
    13461381}
     
    13501385 * OUT <DX|imm16>, <AL|AX|EAX>
    13511386 *
    1352  * @returns VBox status code.
     1387 * @returns Strict VBox status code. Informational status codes other than the one documented
     1388 *          here are to be treated as internal failure.
     1389 * @retval  VINF_SUCCESS                Success.
     1390 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1391 * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
     1392 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1393 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1394 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    13531395 *
    13541396 * @param   pVM         The virtual machine (GC pointer ofcourse).
     
    13791421
    13801422        /*
    1381          * Attemp to write to the port.
     1423         * Attempt to write to the port.
    13821424         */
    13831425        rc = IOMIOPortWrite(pVM, uPort, u32Data, cbSize);
    1384     }
     1426        AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
     1427    }
     1428    else
     1429        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
    13851430    return rc;
    13861431}
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r2363 r2504  
    460460
    461461
    462 inline int iomRamRead(PVM pVM, void *pDest, RTGCPTR GCSrc, uint32_t cb)
     462DECLINLINE(int) iomRamRead(PVM pVM, void *pDest, RTGCPTR GCSrc, uint32_t cb)
    463463{
    464464#ifdef IN_GC
     
    479479}
    480480
    481 inline int iomRamWrite(PVM pVM, RTGCPTR GCDest, void *pSrc, uint32_t cb)
     481DECLINLINE(int) iomRamWrite(PVM pVM, RTGCPTR GCDest, void *pSrc, uint32_t cb)
    482482{
    483483#ifdef IN_GC
     
    15891589 * ES:EDI,DX[,ECX]
    15901590 *
    1591  * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
    1592  *
    1593  * @returns VBox status code.
     1591 * @remark Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
     1592 *
     1593 * @returns Strict VBox status code. Informational status codes other than the one documented
     1594 *          here are to be treated as internal failure.
     1595 * @retval  VINF_SUCCESS                Success.
     1596 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1597 * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
     1598 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1599 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1600 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    15941601 *
    15951602 * @param   pVM             The virtual machine (GC pointer ofcourse).
     
    16011608IOMDECL(int) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
    16021609{
    1603     int rc = VINF_SUCCESS;
    1604 
    16051610#ifdef VBOX_WITH_STATISTICS
    16061611    STAM_COUNTER_INC(&pVM->iom.s.StatGCInstIns);
     
    16281633    /* Convert destination address es:edi. */
    16291634    RTGCPTR GCPtrDst;
    1630     rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->es, (RTGCPTR)pRegFrame->edi, &pRegFrame->esHid,
    1631                       SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
    1632                       &GCPtrDst, NULL);
     1635    int rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->es, (RTGCPTR)pRegFrame->edi, &pRegFrame->esHid,
     1636                          SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
     1637                          &GCPtrDst, NULL);
    16331638    if (VBOX_FAILURE(rc))
    16341639    {
     
    16831688        pRegFrame->ecx = cTransfers;
    16841689
     1690    AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_READ || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
    16851691    return rc;
    16861692}
     
    16911697 * ES:EDI,DX[,ECX]
    16921698 *
    1693  * @returns VBox status code.
     1699 * @returns Strict VBox status code. Informational status codes other than the one documented
     1700 *          here are to be treated as internal failure.
     1701 * @retval  VINF_SUCCESS                Success.
     1702 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1703 * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
     1704 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1705 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1706 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    16941707 *
    16951708 * @param   pVM         The virtual machine (GC pointer ofcourse).
     
    17121725    int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
    17131726    if (RT_UNLIKELY(rc != VINF_SUCCESS))
     1727    {
     1728        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
    17141729        return rc;
     1730    }
    17151731
    17161732    return IOMInterpretINSEx(pVM, pRegFrame, uPort, pCpu->prefix, cbSize);
    17171733}
     1734
    17181735
    17191736/**
     
    17211738 * DS:ESI,DX[,ECX]
    17221739 *
    1723  * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
    1724  *
    1725  * @returns VBox status code.
     1740 * @remark  Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
     1741 *
     1742 * @returns Strict VBox status code. Informational status codes other than the one documented
     1743 *          here are to be treated as internal failure.
     1744 * @retval  VINF_SUCCESS                Success.
     1745 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1746 * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
     1747 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1748 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1749 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    17261750 *
    17271751 * @param   pVM             The virtual machine (GC pointer ofcourse).
     
    17331757IOMDECL(int) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
    17341758{
    1735     int rc = VINF_SUCCESS;
    1736 
    17371759#ifdef VBOX_WITH_STATISTICS
    17381760    STAM_COUNTER_INC(&pVM->iom.s.StatGCInstOuts);
     
    17601782    /* Convert source address ds:esi. */
    17611783    RTGCPTR GCPtrSrc;
    1762     rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->ds, (RTGCPTR)pRegFrame->esi, &pRegFrame->dsHid,
    1763                       SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
    1764                       &GCPtrSrc, NULL);
     1784    int rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->ds, (RTGCPTR)pRegFrame->esi, &pRegFrame->dsHid,
     1785                          SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
     1786                          &GCPtrSrc, NULL);
    17651787    if (VBOX_FAILURE(rc))
    17661788    {
    1767         Log(("OUTS source address conversion failed -> fallback, rc=%d\n", rc));
     1789        Log(("OUTS source address conversion failed -> fallback, rc=%Vrc\n", rc));
    17681790        return VINF_IOM_HC_IOPORT_WRITE;
    17691791    }
     
    17751797    if (rc != VINF_SUCCESS)
    17761798    {
    1777         Log(("OUTS will generate a trap -> fallback, rc=%d\n", rc));
     1799        Log(("OUTS will generate a trap -> fallback, rc=%Vrc\n", rc));
    17781800        return VINF_IOM_HC_IOPORT_WRITE;
    17791801    }
     
    17831805    {
    17841806        /*
    1785         * If the device supports string transfers, ask it to do as
    1786         * much as it wants. The rest is done with single-word transfers.
    1787         */
     1807         * If the device supports string transfers, ask it to do as
     1808         * much as it wants. The rest is done with single-word transfers.
     1809         */
    17881810        const RTGCUINTREG cTransfersOrg = cTransfers;
    17891811        rc = IOMIOPortWriteString(pVM, uPort, &GCPtrSrc, &cTransfers, cbTransfer);
     
    18031825            break;
    18041826        rc = IOMIOPortWrite(pVM, uPort, u32Value, cbTransfer);
    1805         if (rc == VINF_IOM_HC_IOPORT_WRITE)
     1827        if (rc == VINF_IOM_HC_IOPORT_WRITE || VBOX_FAILURE(rc))
    18061828            break;
    18071829        GCPtrSrc = (RTGCPTR)((RTUINTPTR)GCPtrSrc + cbTransfer);
     
    18171839    if (uPrefix & PREFIX_REP)
    18181840        pRegFrame->ecx = cTransfers;
     1841
     1842    AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
    18191843    return rc;
    18201844}
    1821 
    18221845
    18231846
     
    18261849 * DS:ESI,DX[,ECX]
    18271850 *
    1828  * @returns VBox status code.
     1851 * @returns Strict VBox status code. Informational status codes other than the one documented
     1852 *          here are to be treated as internal failure.
     1853 * @retval  VINF_SUCCESS                Success.
     1854 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     1855 * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
     1856 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     1857 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     1858 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    18291859 *
    18301860 * @param   pVM         The virtual machine (GC pointer ofcourse).
     
    18491879    int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
    18501880    if (RT_UNLIKELY(rc != VINF_SUCCESS))
     1881    {
     1882        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
    18511883        return rc;
     1884    }
    18521885
    18531886    return IOMInterpretOUTSEx(pVM, pRegFrame, uPort, pCpu->prefix, cbSize);
    18541887}
     1888
  • trunk/src/VBox/VMM/VMMGC/IOMGC.cpp

    r2231 r2504  
    5151 *
    5252 * The \#GP trap handler in GC will call this function if the opcode causing the
    53  * trap is a in or out type instruction.
     53 * trap is a in or out type instruction. (Call it indirectly via EM that is.)
    5454 *
    55  * @returns VBox status code.
     55 * @returns Strict VBox status code. Informational status codes other than the one documented
     56 *          here are to be treated as internal failure.
     57 * @retval  VINF_SUCCESS                Success.
     58 * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
     59 * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
     60 * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
     61 * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
     62 * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
    5663 *
    5764 * @param   pVM         The virtual machine (GC pointer ofcourse).
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