- Timestamp:
- Apr 5, 2020 10:39:18 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp
r83573 r83574 1030 1030 size_t cbRemain = pReq->cbDataIn; 1031 1031 1032 /* Skip past the REQ_RESP_HDR_T and sense code if we're at the start of the buffer. */ 1032 1033 if (!pSgPhysReturn->idxSeg && pSgPhysReturn->cbSegLeft == pSgPhysReturn->paSegs[0].cbSeg) 1033 1034 virtioCoreSgBufAdvance(pSgPhysReturn, pReq->uDataInOff); … … 1035 1036 while (cbRemain) 1036 1037 { 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); 1043 1045 RTSgBufAdvance(pSgBuf, cbCopied); 1044 1046 virtioCoreSgBufAdvance(pSgPhysReturn, cbCopied); … … 1048 1050 1049 1051 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)); 1051 1053 1052 1054 return VINF_SUCCESS; … … 1076 1078 while (cbRemain) 1077 1079 { 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); 1085 1087 RTSgBufAdvance(pSgBuf, cbCopied); 1086 1088 virtioCoreSgBufAdvance(pSgPhysSend, cbCopied); … … 1089 1091 1090 1092 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)); 1092 1094 1093 1095 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.