VirtualBox

Changeset 19974 in vbox


Ignore:
Timestamp:
May 24, 2009 5:57:46 PM (16 years ago)
Author:
vboxsync
Message:

HostDVD/FreeBSD: Take the 64kb limit into account when reading from the disc in non SCSI passthrough mode

File:
1 edited

Legend:

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

    r19973 r19974  
    162162         * Issue a READ(12) request.
    163163         */
    164         const uint32_t  LBA       = off / pThis->cbBlock;
    165         AssertReturn(!(off % pThis->cbBlock), VERR_INVALID_PARAMETER);
    166         uint32_t        cbRead32  = (uint32_t)cbRead;
    167         const uint32_t  cBlocks   = cbRead32 / pThis->cbBlock;
    168         AssertReturn(!(cbRead % pThis->cbBlock), VERR_INVALID_PARAMETER);
    169         uint8_t         abCmd[16] =
    170         {
    171             SCSI_READ_12, 0,
    172             RT_BYTE4(LBA),     RT_BYTE3(LBA),     RT_BYTE2(LBA),     RT_BYTE1(LBA),
    173             RT_BYTE4(cBlocks), RT_BYTE3(cBlocks), RT_BYTE2(cBlocks), RT_BYTE1(cBlocks),
    174             0, 0, 0, 0, 0
    175         };
    176         rc = DRVHostBaseScsiCmd(pThis, abCmd, 12, PDMBLOCKTXDIR_FROM_DEVICE, pvBuf, &cbRead32, NULL, 0, 0);
     164        do
     165        {
     166            const uint32_t  LBA       = off / pThis->cbBlock;
     167            AssertReturn(!(off % pThis->cbBlock), VERR_INVALID_PARAMETER);
     168            uint32_t        cbRead32  =   cbRead > SCSI_MAX_BUFFER_SIZE
     169                                        ? SCSI_MAX_BUFFER_SIZE
     170                                        : (uint32_t)cbRead;
     171            const uint32_t  cBlocks   = cbRead32 / pThis->cbBlock;
     172            AssertReturn(!(cbRead % pThis->cbBlock), VERR_INVALID_PARAMETER);
     173            uint8_t         abCmd[16] =
     174            {
     175                SCSI_READ_12, 0,
     176                RT_BYTE4(LBA),     RT_BYTE3(LBA),     RT_BYTE2(LBA),     RT_BYTE1(LBA),
     177                RT_BYTE4(cBlocks), RT_BYTE3(cBlocks), RT_BYTE2(cBlocks), RT_BYTE1(cBlocks),
     178                0, 0, 0, 0, 0
     179            };
     180            rc = DRVHostBaseScsiCmd(pThis, abCmd, 12, PDMBLOCKTXDIR_FROM_DEVICE, pvBuf, &cbRead32, NULL, 0, 0);
     181
     182            off    += cbRead32;
     183            cbRead -= cbRead32;
     184            pvBuf   = (uint8_t *)pvBuf + cbRead32;
     185        } while ((cbRead > 0) && RT_SUCCESS(rc));
    177186
    178187#else
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