VirtualBox

Changeset 83574 in vbox for trunk/src


Ignore:
Timestamp:
Apr 5, 2020 10:39:18 PM (5 years ago)
Author:
vboxsync
Message:

DevVirtioSCSI.cpp: Cleaned up some uint64_t casting in virtioScsiR3IoReqCopyFromBuf and virtioScsiR3IoReqCopyToBuf. bugref:9440

File:
1 edited

Legend:

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

    r83573 r83574  
    10301030    size_t cbRemain = pReq->cbDataIn;
    10311031
     1032    /* Skip past the REQ_RESP_HDR_T and sense code if we're at the start of the buffer. */
    10321033    if (!pSgPhysReturn->idxSeg && pSgPhysReturn->cbSegLeft == pSgPhysReturn->paSegs[0].cbSeg)
    10331034        virtioCoreSgBufAdvance(pSgPhysReturn, pReq->uDataInOff);
     
    10351036    while (cbRemain)
    10361037    {
    1037         PVIRTIOSGSEG paSeg = &pSgPhysReturn->paSegs[pSgPhysReturn->idxSeg];
    1038         uint64_t dstSgStart = (uint64_t)paSeg->gcPhys;
    1039         uint64_t dstSgLen   = (uint64_t)paSeg->cbSeg;
    1040         uint64_t dstSgCur   = (uint64_t)pSgPhysReturn->gcPhysCur;
    1041         cbCopied = RT_MIN((uint64_t)pSgBuf->cbSegLeft, dstSgLen - (dstSgCur - dstSgStart));
    1042         PDMDevHlpPCIPhysWrite(pDevIns, (RTGCPHYS)pSgPhysReturn->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
     1038        PVIRTIOSGSEG pSeg = &pSgPhysReturn->paSegs[pSgPhysReturn->idxSeg];
     1039        /** @todo r=bird: add inline function for getting number of bytes left in the
     1040         *        current segment.  Actually, shouldn't pSgPhysReturn->cbSegLeft have
     1041         *        this value? */
     1042        cbCopied = RT_MIN(pSgBuf->cbSegLeft, pSeg->cbSeg - (size_t)(pSgPhysReturn->gcPhysCur - pSeg->gcPhys));
     1043        Assert(cbCopied > 0);
     1044        PDMDevHlpPCIPhysWrite(pDevIns, pSgPhysReturn->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
    10431045        RTSgBufAdvance(pSgBuf, cbCopied);
    10441046        virtioCoreSgBufAdvance(pSgPhysReturn, cbCopied);
     
    10481050
    10491051    Log3Func((".... Copied %lu bytes from %lu byte guest buffer, residual=%lu\n",
    1050          cbCopy, pReq->pDescChain->cbPhysReturn, pReq->pDescChain->cbPhysReturn - cbCopy));
     1052              cbCopy, pReq->pDescChain->cbPhysReturn, pReq->pDescChain->cbPhysReturn - cbCopy));
    10511053
    10521054    return VINF_SUCCESS;
     
    10761078    while (cbRemain)
    10771079    {
    1078         PVIRTIOSGSEG paSeg = &pSgPhysSend->paSegs[pSgPhysSend->idxSeg];
    1079         uint64_t srcSgStart = (uint64_t)paSeg->gcPhys;
    1080         uint64_t srcSgLen   = (uint64_t)paSeg->cbSeg;
    1081         uint64_t srcSgCur   = (uint64_t)pSgPhysSend->gcPhysCur;
    1082         cbCopied = RT_MIN((uint64_t)pSgBuf->cbSegLeft, srcSgLen - (srcSgCur - srcSgStart));
    1083         PDMDevHlpPCIPhysRead(pDevIns,
    1084                           (RTGCPHYS)pSgPhysSend->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
     1080        PVIRTIOSGSEG const pSeg = &pSgPhysSend->paSegs[pSgPhysSend->idxSeg];
     1081        /** @todo r=bird: add inline function for getting number of bytes left in the
     1082         *        current segment.  Actually, shouldn't pSgPhysSend->cbSegLeft have
     1083         *        this value? */
     1084        cbCopied = RT_MIN(pSgBuf->cbSegLeft, pSeg->cbSeg - (size_t)(pSgPhysSend->gcPhysCur - pSeg->gcPhys));
     1085        Assert(cbCopied > 0);
     1086        PDMDevHlpPCIPhysRead(pDevIns, pSgPhysSend->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
    10851087        RTSgBufAdvance(pSgBuf, cbCopied);
    10861088        virtioCoreSgBufAdvance(pSgPhysSend, cbCopied);
     
    10891091
    10901092    Log2Func((".... Copied %lu bytes to %lu byte guest buffer, residual=%lu\n",
    1091          cbCopy, pReq->pDescChain->cbPhysReturn, pReq->pDescChain->cbPhysReturn - cbCopy));
     1093              cbCopy, pReq->pDescChain->cbPhysReturn, pReq->pDescChain->cbPhysReturn - cbCopy));
    10921094
    10931095    return VINF_SUCCESS;
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