VirtualBox

Changeset 4718 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Sep 12, 2007 8:56:28 AM (17 years ago)
Author:
vboxsync
Message:

Real fix for the IDE device crash when huge blocks are read from CD. The
previous one was uneffective (and also incomplete).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r4706 r4718  
    892892    uint32_t cbLimit, cbTransfer;
    893893
    894     cbLimit = s->uATARegLCyl | (s->uATARegHCyl << 8);
     894    if (s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE)
     895        cbLimit = 0xfffe;
     896    else
     897        cbLimit = s->uATARegLCyl | (s->uATARegHCyl << 8);
    895898    Log2(("%s: byte count limit=%d\n", __FUNCTION__, cbLimit));
    896899    if (cbLimit == 0xffff)
    897900        cbLimit--;
    898     cbTransfer = s->cbTotalTransfer;
     901    cbTransfer = RT_MIN(s->cbTotalTransfer, s->iIOBufferEnd - s->iIOBufferCur);
    899902    if (cbTransfer > cbLimit)
    900903    {
     
    16181621    uint32_t cbTransfer, cSectors;
    16191622
    1620     s->iSourceSink = ATAFN_SS_NULL;
    16211623    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
    16221624    cbTransfer = RT_MIN(s->cbTotalTransfer, s->cbIOBuffer);
     
    16761678         * transfer size. But the I/O buffer size limits what can actually be
    16771679         * done in one transfer, so set the actual value of the buffer end. */
    1678         s->iIOBufferEnd = cbTransfer;
     1680        s->cbElementaryTransfer = cbTransfer;
     1681        if (cbTransfer >= s->cbTotalTransfer)
     1682            s->iSourceSink = ATAFN_SS_NULL;
    16791683        atapiCmdOK(s);
    16801684        s->iATAPILBA += cSectors;
     
    18361840             * transfer size. But the I/O buffer size limits what can actually be
    18371841             * done in one transfer, so set the actual value of the buffer end. */
    1838             s->iIOBufferEnd = cbTransfer;
     1842            s->cbElementaryTransfer = cbTransfer;
    18391843            if (s->aATAPICmd[0] == SCSI_INQUIRY)
    18401844            {
     
    36953699    if (s->cbTotalTransfer && s->iIOBufferCur > s->iIOBufferEnd)
    36963700    {
    3697         LogRel(("PIIX3 ATA: LUN#%d: %s data in the middle of a PIO transfer - VERY SLOW\n", s->iLUN, s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE ? "storing" : "loading"));
     3701        LogRel(("PIIX3 ATA: LUN#%d: %s data in the middle of a PIO transfer - VERY SLOW\n", s->iLUN, s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE ? "loading" : "storing"));
    36983702        /* Any guest OS that triggers this case has a pathetic ATA driver.
    36993703         * In a real system it would block the CPU via IORDY, here we do it
     
    37493753    }
    37503754
    3751     if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE || s->iSourceSink != ATAFN_SS_NULL)
     3755    if (   s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE
     3756        || (   s->iSourceSink != ATAFN_SS_NULL
     3757            && s->iIOBufferCur >= s->iIOBufferEnd))
    37523758    {
    37533759        /* Need to continue the transfer in the async I/O thread. This is
     
    37623768    else
    37633769    {
    3764         /* Everything finished (though maybe a couple of chunks need to be
    3765          * transferred, but all without source/sink callback). */
     3770        /* Either everything finished (though some data might still be pending)
     3771         * or some data is pending before the next read is due. */
    37663772
    37673773        /* Continue a previously started transfer. */
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