VirtualBox

忽略:
時間撮記:
2007-5-4 下午06:12:30 (18 年 以前)
作者:
vboxsync
訊息:

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

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • 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
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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