VirtualBox

Changeset 60854 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 5, 2016 6:18:02 PM (9 years ago)
Author:
vboxsync
Message:

iomMMIODoComplicatedWrite: Use VINF_IOM_R3_IOPORT_COMMIT_WRITE to deal correctly with VINF_IOM_R3_MMIO_READ/WRITE status codes handling complicated stuff.

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

Legend:

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

    r60852 r60854  
    439439static VBOXSTRICTRC iomIOPortRing3WritePending(PVMCPU pVCpu, RTIOPORT Port, uint32_t u32Value, size_t cbValue)
    440440{
    441     Log(("iomIOPortRing3WritePending: %#x LB %u -> %RTiop\n", u32Value, cbValue, Port));
     441    Log5(("iomIOPortRing3WritePending: %#x LB %u -> %RTiop\n", u32Value, cbValue, Port));
    442442    AssertReturn(pVCpu->iom.s.PendingIOPortWrite.cbValue == 0, VERR_IOM_IOPORT_IPE_1);
    443443    pVCpu->iom.s.PendingIOPortWrite.IOPort   = Port;
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r60852 r60854  
    249249static VBOXSTRICTRC iomMmioRing3WritePending(PVMCPU pVCpu, RTGCPHYS GCPhys, void const *pvBuf, size_t cbBuf, PIOMMMIORANGE pRange)
    250250{
    251     Log3(("iomMmioRing3WritePending: %RGp LB %#x\n", GCPhys, cbBuf));
     251    Log5(("iomMmioRing3WritePending: %RGp LB %#x\n", GCPhys, cbBuf));
    252252    AssertReturn(pVCpu->iom.s.PendingMmioWrite.cbValue == 0, VERR_IOM_MMIO_IPE_1);
    253253    pVCpu->iom.s.PendingMmioWrite.GCPhys  = GCPhys;
     
    271271 *          VINF_IOM_R3_MMIO_READ may be returned.
    272272 *
    273  * @param   pVM                 The cross context VM structure.
    274  * @param   pRange              The range to write to.
    275  * @param   GCPhys              The physical address to start writing.
    276  * @param   pvValue             Where to store the value.
    277  * @param   cbValue             The size of the value to write.
    278  */
    279 static VBOXSTRICTRC iomMMIODoComplicatedWrite(PVM pVM, PIOMMMIORANGE pRange, RTGCPHYS GCPhys, void const *pvValue, unsigned cbValue)
     273 * @param   pVM         The cross context VM structure.
     274 * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
     275 * @param   pRange      The range to write to.
     276 * @param   GCPhys      The physical address to start writing.
     277 * @param   pvValue     Where to store the value.
     278 * @param   cbValue     The size of the value to write.
     279 */
     280static VBOXSTRICTRC iomMMIODoComplicatedWrite(PVM pVM, PVMCPU pVCpu, PIOMMMIORANGE pRange, RTGCPHYS GCPhys,
     281                                              void const *pvValue, unsigned cbValue)
    280282{
    281283    AssertReturn(   (pRange->fFlags & IOMMMIO_FLAGS_WRITE_MODE) != IOMMMIO_FLAGS_WRITE_PASSTHRU
     
    349351                    u32MissingValue = 0;
    350352                    break;
     353#ifndef IN_RING3
    351354                case VINF_IOM_R3_MMIO_READ:
    352355                case VINF_IOM_R3_MMIO_READ_WRITE:
    353356                case VINF_IOM_R3_MMIO_WRITE:
    354                     /** @todo What if we've split a transfer and already read
    355                      * something?  Since writes generally have sideeffects we
    356                      * could be kind of screwed here...
    357                      *
    358                      * Fix: VINF_IOM_R3_IOPORT_COMMIT_WRITE (part 2) */
    359357                    LogFlow(("iomMMIODoComplicatedWrite: GCPhys=%RGp GCPhysStart=%RGp cbValue=%u rc=%Rrc [read]\n", GCPhys, GCPhysStart, cbValue, rc2));
    360                     return rc2;
     358                    rc2 = VBOXSTRICTRC_TODO(iomMmioRing3WritePending(pVCpu, GCPhys, pvValue, cbValue, pRange));
     359                    if (rc == VINF_SUCCESS || rc2 < rc)
     360                        rc = rc2;
     361                    return rc;
     362#endif
    361363                default:
    362364                    if (RT_FAILURE(rc2))
     
    417419            case VINF_SUCCESS:
    418420                break;
     421#ifndef IN_RING3
    419422            case VINF_IOM_R3_MMIO_READ:
    420423            case VINF_IOM_R3_MMIO_READ_WRITE:
    421424            case VINF_IOM_R3_MMIO_WRITE:
    422                 /** @todo What if we've split a transfer and already read
    423                  * something?  Since reads can have sideeffects we could be
    424                  * kind of screwed here...
    425                  *
    426                  * Fix: VINF_IOM_R3_IOPORT_COMMIT_WRITE (part 2) */
    427                 LogFlow(("iomMMIODoComplicatedWrite: GCPhys=%RGp GCPhysStart=%RGp cbValue=%u rc=%Rrc [write]\n", GCPhys, GCPhysStart, cbValue, rc2));
     425                Log3(("iomMMIODoComplicatedWrite: deferring GCPhys=%RGp GCPhysStart=%RGp cbValue=%u rc=%Rrc [write]\n", GCPhys, GCPhysStart, cbValue, rc2));
     426                AssertReturn(pVCpu->iom.s.PendingMmioWrite.cbValue == 0, VERR_IOM_MMIO_IPE_1);
     427                AssertReturn(cbValue + (GCPhys & 3) <= sizeof(pVCpu->iom.s.PendingMmioWrite.abValue), VERR_IOM_MMIO_IPE_2);
     428                pVCpu->iom.s.PendingMmioWrite.GCPhys  = GCPhys & ~(RTGCPHYS)3;
     429                pVCpu->iom.s.PendingMmioWrite.cbValue = cbValue + (GCPhys & 3);
     430                *(uint32_t *)pVCpu->iom.s.PendingMmioWrite.abValue = u32Value;
     431                if (cbValue > cbThisPart)
     432                    memcpy(&pVCpu->iom.s.PendingMmioWrite.abValue[4],
     433                           (uint8_t const *)pvValue + cbThisPart, cbValue - cbThisPart);
     434                VMCPU_FF_SET(pVCpu, VMCPU_FF_IOM);
     435                if (rc == VINF_SUCCESS)
     436                    rc = VINF_IOM_R3_MMIO_COMMIT_WRITE;
    428437                return rc2;
     438#endif
    429439            default:
    430440                if (RT_FAILURE(rc2))
     
    487497                                                          GCPhysFault, (void *)pvData, cb); /** @todo fix const!! */
    488498        else
    489             rcStrict = iomMMIODoComplicatedWrite(pVM, pRange, GCPhysFault, pvData, cb);
     499            rcStrict = iomMMIODoComplicatedWrite(pVM, pVCpu, pRange, GCPhysFault, pvData, cb);
    490500    }
    491501    else
     
    23112321                                                    GCPhys, &u32Value, (unsigned)cbValue);
    23122322        else
    2313             rc = iomMMIODoComplicatedWrite(pVM, pRange, GCPhys, &u32Value, (unsigned)cbValue);
     2323            rc = iomMMIODoComplicatedWrite(pVM, pVCpu, pRange, GCPhys, &u32Value, (unsigned)cbValue);
    23142324        STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
    23152325#ifndef IN_RING3
  • trunk/src/VBox/VMM/include/IOMInternal.h

    r60849 r60854  
    418418        RTGCPHYS                        GCPhys;
    419419        /** The value to write. */
    420         uint8_t                         abValue[16];
     420        uint8_t                         abValue[24];
    421421        /** The number of bytes to write (0 if nothing pending). */
    422422        uint32_t                        cbValue;
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