VirtualBox

Changeset 81842 in vbox


Ignore:
Timestamp:
Nov 14, 2019 2:23:32 AM (5 years ago)
Author:
vboxsync
Message:

DevATA: Put the I/O buffers into the device state data to avoid having to navigate cross context pointers to heap. bugref:9218

File:
1 edited

Legend:

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

    r81839 r81842  
    183183typedef struct ATADevState
    184184{
     185    /** The I/O buffer.
     186     * @note Page aligned in case it helps.  */
     187    uint8_t                             abIOBuffer[ATA_MAX_IO_BUFFER_SIZE];
     188
    185189    /** Flag indicating whether the current command uses LBA48 mode. */
    186190    bool                                fLBA48;
     
    285289    /** Size of I/O buffer. */
    286290    uint32_t                            cbIOBuffer;
    287     /** Pointer to the I/O buffer. */
    288     R3PTRTYPE(uint8_t *)                pbIOBufferR3;
    289     /** Pointer to the I/O buffer. */
    290     R0PTRTYPE(uint8_t *)                pbIOBufferR0;
    291     /** Pointer to the I/O buffer. */
    292     RCPTRTYPE(uint8_t *)                pbIOBufferRC;
    293291
    294292    /*
     
    391389    R3PTRTYPE(PTRACKLIST)               pTrackList;
    392390
    393     uint8_t                             abAlignment4[HC_ARCH_BITS == 64 ? 7 : 3];
     391    uint8_t                             abAlignment4[HC_ARCH_BITS == 64 ? 7 + 3432 : 3 + 3432 + 13*4];
    394392} ATADevState;
    395393AssertCompileMemberAlignment(ATADevState, cTotalSectors, 8);
     
    398396AssertCompileMemberAlignment(ATADevState, pDevInsR3, 8);
    399397AssertCompileMemberAlignment(ATADevState, szSerialNumber, 8);
    400 AssertCompileSizeAlignment(ATADevState, 8);
     398AssertCompileSizeAlignment(ATADevState, 4096); /* To align the buffer on a page boundrary. */
    401399
    402400
     
    475473typedef struct ATACONTROLLER
    476474{
     475    /** The ATA/ATAPI interfaces of this controller. */
     476    ATADevState         aIfs[2];
     477
    477478    /** The base of the first I/O Port range. */
    478479    RTIOPORT            IOPortBase1;
     
    511512    uint32_t            cbRedoDMABuffer;
    512513
    513     /** The ATA/ATAPI interfaces of this controller. */
    514     ATADevState         aIfs[2];
    515 
    516514    /** Pointer to device instance. */
    517515    PPDMDEVINSR3        pDevInsR3;
     
    553551    STAMPROFILEADV      StatAsyncTime;
    554552    STAMPROFILE         StatLockWait;
     553    uint8_t             abAlignment4[3440];
    555554} ATACONTROLLER, *PATACONTROLLER;
    556555AssertCompileMemberAlignment(ATACONTROLLER, lock, 8);
     
    560559AssertCompileMemberAlignment(ATACONTROLLER, AsyncIORequestLock, 8);
    561560AssertCompileSizeAlignment(ATACONTROLLER, 8);
     561AssertCompileSizeAlignment(ATACONTROLLER, 4096); /* To align the controllers, devices and I/O buffers on page boundaries. */
     562
    562563
    563564typedef enum CHIPSET
     
    13031304    Assert(s->cbElementaryTransfer == 512);
    13041305
    1305     p = (uint16_t *)s->CTX_SUFF(pbIOBuffer);
     1306    p = (uint16_t *)&s->abIOBuffer[0];
    13061307    memset(p, 0, 512);
    13071308    p[0] = RT_H2LE_U16(0x0040);
     
    14361437    Assert(s->cbElementaryTransfer == 512);
    14371438
    1438     p = (uint16_t *)s->CTX_SUFF(pbIOBuffer);
     1439    p = (uint16_t *)&s->abIOBuffer[0];
    14391440    memset(p, 0, 512);
    14401441    /* Removable CDROM, 3ms response, 12 byte packets */
     
    17361737    iLBA = ataR3GetSector(s);
    17371738    Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
    1738     rc = ataR3ReadSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors, &fRedo);
     1739    rc = ataR3ReadSectors(s, iLBA, s->abIOBuffer, cSectors, &fRedo);
    17391740    if (RT_SUCCESS(rc))
    17401741    {
     
    17751776    iLBA = ataR3GetSector(s);
    17761777    Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
    1777     rc = ataR3WriteSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors, &fRedo);
     1778    rc = ataR3WriteSectors(s, iLBA, s->abIOBuffer, cSectors, &fRedo);
    17781779    if (RT_SUCCESS(rc))
    17791780    {
     
    18931894        if (cbBlockRegion == s->cbATAPISector)
    18941895            rc = s->pDrvMedia->pfnRead(s->pDrvMedia, (uint64_t)s->iATAPILBA * s->cbATAPISector,
    1895                                        s->CTX_SUFF(pbIOBuffer), s->cbATAPISector * cSectors);
     1896                                       s->abIOBuffer, s->cbATAPISector * cSectors);
    18961897        else
    18971898        {
     
    18991900            {
    19001901                /* Generate the sync bytes. */
    1901                 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     1902                uint8_t *pbBuf = s->abIOBuffer;
    19021903
    19031904                for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++)
     
    19301931            {
    19311932                /* Read only the user data portion. */
    1932                 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     1933                uint8_t *pbBuf = s->abIOBuffer;
    19331934
    19341935                for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++)
     
    19971998
    19981999    if (s->uTxDir == PDMMEDIATXDIR_TO_DEVICE)
    1999         Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
     2000        Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->abIOBuffer));
    20002001
    20012002    /* Simple heuristics: if there is at least one sector of data
     
    20262027        case SCSI_MODE_SELECT_10:
    20272028        {
    2028             size_t cbBlkDescLength = scsiBE2H_U16(&s->CTX_SUFF(pbIOBuffer)[6]);
     2029            size_t cbBlkDescLength = scsiBE2H_U16(&s->abIOBuffer[6]);
    20292030
    20302031            SCSILogModePage(szBuf, sizeof(szBuf) - 1,
    2031                             s->CTX_SUFF(pbIOBuffer) + 8 + cbBlkDescLength,
     2032                            s->abIOBuffer + 8 + cbBlkDescLength,
    20322033                            cbTransfer - 8 - cbBlkDescLength);
    20332034            break;
     
    20362037        {
    20372038            SCSILogCueSheet(szBuf, sizeof(szBuf) - 1,
    2038                             s->CTX_SUFF(pbIOBuffer), cbTransfer);
     2039                            s->abIOBuffer, cbTransfer);
    20392040            break;
    20402041        }
     
    20602061        uint8_t aATAPICmd[ATAPI_PACKET_SIZE];
    20612062        uint32_t iATAPILBA, cSectors, cReqSectors, cbCurrTX;
    2062         uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2063        uint8_t *pbBuf = s->abIOBuffer;
    20632064        uint32_t cSectorsMax; /**< Maximum amount of sectors to read without exceeding the I/O buffer. */
    20642065
     
    21702171    else
    21712172        rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, s->aATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir,
    2172                                       s->CTX_SUFF(pbIOBuffer), &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
     2173                                      s->abIOBuffer, &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
    21732174    if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); }
    21742175
     
    22022203
    22032204                if (RT_SUCCESS(rc))
    2204                     rc = ATAPIPassthroughTrackListUpdate(s->pTrackList, s->aATAPICmd, s->CTX_SUFF(pbIOBuffer));
     2205                    rc = ATAPIPassthroughTrackListUpdate(s->pTrackList, s->aATAPICmd, s->abIOBuffer);
    22052206
    22062207                if (   RT_FAILURE(rc)
     
    22332234                 * Motivation: changing the VM configuration should be as
    22342235                 *             invisible as possible to the guest. */
    2235                 Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
    2236                 scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 8, "VBOX", 8);
    2237                 scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 16, "CD-ROM", 16);
    2238                 scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 32, "1.0", 4);
     2236                Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->abIOBuffer));
     2237                scsiPadStr(&s->abIOBuffer[8], "VBOX", 8);
     2238                scsiPadStr(&s->abIOBuffer[16], "CD-ROM", 16);
     2239                scsiPadStr(&s->abIOBuffer[32], "1.0", 4);
    22392240            }
    22402241
    22412242            if (cbTransfer)
    2242                 Log3(("ATAPI PT data read (%d):\n%.*Rhxd\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
     2243                Log3(("ATAPI PT data read (%d):\n%.*Rhxd\n", cbTransfer, cbTransfer, s->abIOBuffer));
    22432244        }
    22442245
     
    22822283static bool atapiR3ReadDVDStructureSS(ATADevState *s)
    22832284{
    2284     uint8_t *buf = s->CTX_SUFF(pbIOBuffer);
     2285    uint8_t *buf = s->abIOBuffer;
    22852286    int media = s->aATAPICmd[1];
    22862287    int format = s->aATAPICmd[7];
     
    24502451static bool atapiR3ReadCapacitySS(ATADevState *s)
    24512452{
    2452     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2453    uint8_t *pbBuf = s->abIOBuffer;
    24532454
    24542455    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    24642465static bool atapiR3ReadDiscInformationSS(ATADevState *s)
    24652466{
    2466     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2467    uint8_t *pbBuf = s->abIOBuffer;
    24672468
    24682469    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    24902491static bool atapiR3ReadTrackInformationSS(ATADevState *s)
    24912492{
    2492     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2493    uint8_t *pbBuf = s->abIOBuffer;
    24932494    uint32_t u32LogAddr = scsiBE2H_U32(&s->aATAPICmd[2]);
    24942495    uint8_t u8LogAddrType = s->aATAPICmd[1] & 0x03;
     
    27452746{
    27462747    uint32_t const cbIOBuffer = RT_MIN(s->cbIOBuffer, ATA_MAX_IO_BUFFER_SIZE);
    2747     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2748    uint8_t *pbBuf = s->abIOBuffer;
    27482749    uint32_t cbBuf = cbIOBuffer;
    27492750    uint32_t cbCopied = 0;
     
    27962797
    27972798    /* Set data length now - the field is not included in the final length. */
    2798     scsiH2BE_U32(s->CTX_SUFF(pbIOBuffer), cbIOBuffer - cbBuf - 4);
     2799    scsiH2BE_U32(s->abIOBuffer, cbIOBuffer - cbBuf - 4);
    27992800
    28002801    /* Other profiles we might want to add in the future: 0x40 (BD-ROM) and 0x50 (HDDVD-ROM) */
     
    28072808static bool atapiR3GetEventStatusNotificationSS(ATADevState *s)
    28082809{
    2809     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2810    uint8_t *pbBuf = s->abIOBuffer;
    28102811
    28112812    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    28822883static bool atapiR3InquirySS(ATADevState *s)
    28832884{
    2884     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2885    uint8_t *pbBuf = s->abIOBuffer;
    28852886
    28862887    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    29102911static bool atapiR3ModeSenseErrorRecoverySS(ATADevState *s)
    29112912{
    2912     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2913    uint8_t *pbBuf = s->abIOBuffer;
    29132914
    29142915    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    29382939static bool atapiR3ModeSenseCDStatusSS(ATADevState *s)
    29392940{
    2940     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2941    uint8_t *pbBuf = s->abIOBuffer;
    29412942
    29422943    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    29862987static bool atapiR3RequestSenseSS(ATADevState *s)
    29872988{
    2988     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     2989    uint8_t *pbBuf = s->abIOBuffer;
    29892990
    29902991    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    29993000static bool atapiR3MechanismStatusSS(ATADevState *s)
    30003001{
    3001     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     3002    uint8_t *pbBuf = s->abIOBuffer;
    30023003
    30033004    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    30183019static bool atapiR3ReadTOCNormalSS(ATADevState *s)
    30193020{
    3020     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack;
     3021    uint8_t *pbBuf = s->abIOBuffer;
     3022    uint8_t *q;
     3023    uint8_t iStartTrack;
    30213024    bool fMSF;
    30223025    uint32_t cbSize;
     
    31063109static bool atapiR3ReadTOCMultiSS(ATADevState *s)
    31073110{
    3108     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
     3111    uint8_t *pbBuf = s->abIOBuffer;
    31093112    bool fMSF;
    31103113
     
    31503153static bool atapiR3ReadTOCRawSS(ATADevState *s)
    31513154{
    3152     uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack;
     3155    uint8_t *pbBuf = s->abIOBuffer;
     3156    uint8_t *q;
     3157    uint8_t iStartTrack;
    31533158    bool fMSF;
    31543159    uint32_t cbSize;
     
    32373242static void atapiR3ParseCmdVirtualATAPI(ATADevState *s)
    32383243{
    3239     const uint8_t *pbPacket;
    3240     uint8_t *pbBuf;
     3244    const uint8_t *pbPacket = s->aATAPICmd;
    32413245    uint32_t cbMax;
    32423246    uint32_t cSectors, iATAPILBA;
    32433247
    3244     pbPacket = s->aATAPICmd;
    3245     pbBuf = s->CTX_SUFF(pbIOBuffer);
    32463248    switch (pbPacket[0])
    32473249    {
     
    37913793{
    37923794    s->fDMA = !!(s->uATARegFeature & 1);
    3793     memcpy(s->aATAPICmd, s->CTX_SUFF(pbIOBuffer), ATAPI_PACKET_SIZE);
     3795    memcpy(s->aATAPICmd, s->abIOBuffer, ATAPI_PACKET_SIZE);
    37943796    s->uTxDir = PDMMEDIATXDIR_NONE;
    37953797    s->cbTotalTransfer = 0;
     
    40144016    int rc = VERR_GENERAL_FAILURE;
    40154017    uint32_t cRangesMax;
    4016     uint64_t *pu64Range = (uint64_t *)s->CTX_SUFF(pbIOBuffer);
     4018    uint64_t *pu64Range = (uint64_t *)&s->abIOBuffer[0];
    40174019    bool fRedo = false;
    40184020
     
    49324934 *
    49334935 * The two buffers are either stack (32-bit aligned) or somewhere within
    4934  * pIf->pbIOBuffer.
     4936 * pIf->abIOBuffer.
    49354937 *
    49364938 * @param   pIf         The device interface to work with.
     
    49424944{
    49434945    /*
    4944      * Quick bounds checking can be done by checking that the pbIOBuffer offset
     4946     * Quick bounds checking can be done by checking that the abIOBuffer offset
    49454947     * (iIOBufferPIODataStart) is aligned at the transfer size (which is ASSUMED
    49464948     * to be 1, 2 or 4).  However, since we're paranoid and don't currently
     
    49894991        {
    49904992            Assert(s->uTxDir == PDMMEDIATXDIR_TO_DEVICE);
    4991             uint8_t       *pbDst = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
     4993            uint8_t       *pbDst = &s->abIOBuffer[s->iIOBufferPIODataStart];
    49924994            uint8_t const *pbSrc = (uint8_t const *)&u32;
    49934995
     
    50625064        {
    50635065            Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
    5064             uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
     5066            uint8_t const *pbSrc = &s->abIOBuffer[s->iIOBufferPIODataStart];
    50655067            uint8_t       *pbDst = (uint8_t *)pu32;
    50665068
     
    51675169                     * Do the transfer.
    51685170                     */
    5169                     uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + offStart;
     5171                    uint8_t const *pbSrc = &s->abIOBuffer[offStart];
    51705172                    memcpy(pbDst, pbSrc, cbTransfer);
    51715173                    Log3(("%s: addr=%#x cb=%#x cbTransfer=%#x val=%.*Rhxd\n",
     
    52565258                     * Do the transfer.
    52575259                     */
    5258                     void *pvDst = s->CTX_SUFF(pbIOBuffer) + offStart;
     5260                    void *pvDst = &s->abIOBuffer[offStart];
    52595261                    memcpy(pvDst, pbSrc, cbTransfer);
    52605262                    Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, Port, cbTransfer, pvDst));
     
    53795381
    53805382                if (uTxDir == PDMMEDIATXDIR_FROM_DEVICE)
    5381                     PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, cbXfer);
     5383                    PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
    53825384                else
    5383                     PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, cbXfer);
     5385                    PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
    53845386
    53855387                iIOBufferCur    += cbXfer;
     
    64966498#ifdef IN_RING3
    64976499
    6498 
    6499 DECLINLINE(void) ataR3RelocBuffer(PPDMDEVINS pDevIns, ATADevState *s)
    6500 {
    6501     if (s->pbIOBufferR3)
    6502         s->pbIOBufferRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferR3);
    6503 }
    6504 
    6505 
    65066500/**
    65076501 * Detach notification.
     
    65506544 * @param   pIf         The ATA unit state.
    65516545 */
    6552 static int ataR3ConfigLun(PPDMDEVINS pDevIns, ATADevState *pIf)
    6553 {
    6554     int             rc = VINF_SUCCESS;
    6555     PDMMEDIATYPE    enmType;
    6556 
     6546static int ataR3ConfigLun(ATADevState *pIf)
     6547{
    65576548    /*
    65586549     * Query Block, Bios and Mount interfaces.
     
    65706561     * Validate type.
    65716562     */
    6572     enmType = pIf->pDrvMedia->pfnGetType(pIf->pDrvMedia);
     6563    PDMMEDIATYPE enmType = pIf->pDrvMedia->pfnGetType(pIf->pDrvMedia);
    65736564    if (    enmType != PDMMEDIATYPE_CDROM
    65746565        &&  enmType != PDMMEDIATYPE_DVD
     
    66016592    }
    66026593
    6603     PVM pVM = PDMDevHlpGetVM(pDevIns);
    66046594    if (pIf->cbIOBuffer)
    66056595    {
     
    66076597         * because memory corruption can also overwrite pIf->cbIOBuffer. */
    66086598        if (pIf->fATAPI)
    6609             AssertReleaseReturn(pIf->cbIOBuffer == _128K, VERR_BUFFER_OVERFLOW);
     6599            AssertLogRelReturn(pIf->cbIOBuffer == _128K, VERR_BUFFER_OVERFLOW);
    66106600        else
    6611             AssertReleaseReturn(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * pIf->cbSector, VERR_BUFFER_OVERFLOW);
    6612         Assert(pIf->pbIOBufferR3);
    6613         Assert(pIf->pbIOBufferR0 == MMHyperR3ToR0(pVM, pIf->pbIOBufferR3));
    6614         Assert(pIf->pbIOBufferRC == MMHyperR3ToRC(pVM, pIf->pbIOBufferR3));
     6601            AssertLogRelReturn(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * pIf->cbSector, VERR_BUFFER_OVERFLOW);
    66156602    }
    66166603    else
     
    66206607        else
    66216608            pIf->cbIOBuffer = ATA_MAX_MULT_SECTORS * pIf->cbSector;
    6622         AssertLogRelMsgReturn(pIf->cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE,
    6623                               ("LUN#%u: cbIOBuffer=%#x (%u)\n", pIf->iLUN, pIf->cbIOBuffer, pIf->cbIOBuffer),
    6624                               VERR_BUFFER_OVERFLOW);
    6625         Assert(!pIf->pbIOBufferR3);
    6626         rc = MMR3HyperAllocOnceNoRel(pVM, pIf->cbIOBuffer, 0, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3);
    6627         if (RT_FAILURE(rc))
    6628             return VERR_NO_MEMORY;
    6629         pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3);
    6630         pIf->pbIOBufferRC = MMHyperR3ToRC(pVM, pIf->pbIOBufferR3);
    6631     }
     6609    }
     6610    AssertCompile(_128K <= ATA_MAX_IO_BUFFER_SIZE);
     6611    AssertCompileSize(pIf->abIOBuffer, ATA_MAX_IO_BUFFER_SIZE);
     6612    AssertLogRelMsgReturn(pIf->cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE,
     6613                          ("LUN#%u: cbIOBuffer=%#x (%u)\n", pIf->iLUN, pIf->cbIOBuffer, pIf->cbIOBuffer),
     6614                          VERR_BUFFER_OVERFLOW);
    66326615
    66336616    /*
    66346617     * Init geometry (only for non-CD/DVD media).
    66356618     */
     6619    int rc = VINF_SUCCESS;
    66366620    uint32_t cRegions = pIf->pDrvMedia->pfnGetRegionCount(pIf->pDrvMedia);
    66376621    pIf->cTotalSectors = 0;
     
    67716755    if (RT_SUCCESS(rc))
    67726756    {
    6773         rc = ataR3ConfigLun(pDevIns, pIf);
     6757        rc = ataR3ConfigLun(pIf);
    67746758        /*
    67756759         * In case there is a medium inserted.
     
    69706954            pHlp->pfnSSMPutU32(pSSM, pThis->aCts[i].aIfs[j].cbIOBuffer);
    69716955            if (pThis->aCts[i].aIfs[j].cbIOBuffer)
    6972                 pHlp->pfnSSMPutMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer);
    6973             else
    6974                 Assert(pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer) == NULL);
     6956                pHlp->pfnSSMPutMem(pSSM, pThis->aCts[i].aIfs[j].abIOBuffer, pThis->aCts[i].aIfs[j].cbIOBuffer);
    69756957        }
    69766958    }
     
    71717153            if (cbIOBuffer)
    71727154            {
    7173                 if (   pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer)
    7174                     && cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE
     7155                if (   cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE
    71757156                    && cbIOBuffer <= pThis->aCts[i].aIfs[j].cbIOBuffer)
    71767157                {
    71777158                    pThis->aCts[i].aIfs[j].cbIOBuffer = cbIOBuffer;
    7178                     pHlp->pfnSSMGetMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), cbIOBuffer);
     7159                    pHlp->pfnSSMGetMem(pSSM, pThis->aCts[i].aIfs[j].abIOBuffer, cbIOBuffer);
    71797160                }
    71807161                else
     
    73997380        pThis->aCts[i].aIfs[0].pDevInsRC += offDelta;
    74007381        pThis->aCts[i].aIfs[0].pControllerRC += offDelta;
    7401         ataR3RelocBuffer(pDevIns, &pThis->aCts[i].aIfs[0]);
    74027382        pThis->aCts[i].aIfs[1].pDevInsRC += offDelta;
    74037383        pThis->aCts[i].aIfs[1].pControllerRC += offDelta;
    7404         ataR3RelocBuffer(pDevIns, &pThis->aCts[i].aIfs[1]);
    74057384    }
    74067385}
     
    78117790            if (RT_SUCCESS(rc))
    78127791            {
    7813                 rc = ataR3ConfigLun(pDevIns, pIf);
     7792                rc = ataR3ConfigLun(pIf);
    78147793                if (RT_SUCCESS(rc))
    78157794                {
     
    79257904                pIf->pDrvMedia = NULL;
    79267905                pIf->cbIOBuffer = 0;
    7927                 pIf->pbIOBufferR3 = NULL;
    7928                 pIf->pbIOBufferR0 = NIL_RTR0PTR;
    7929                 pIf->pbIOBufferRC = NIL_RTGCPTR;
    79307906                LogRel(("PIIX3 ATA: LUN#%d: no unit\n", pIf->iLUN));
    79317907            }
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