Changeset 53148 in vbox
- Timestamp:
- Oct 26, 2014 6:03:09 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmifs.h
r52023 r53148 1031 1031 1032 1032 /** 1033 * Read bits - version for DevPcBios. 1034 * 1035 * @returns VBox status code. 1036 * @param pInterface Pointer to the interface structure containing the called function pointer. 1037 * @param off Offset to start reading from. The offset must be aligned to a sector boundary. 1038 * @param pvBuf Where to store the read bits. 1039 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary. 1040 * @thread Any thread. 1041 * 1042 * @note: Special version of pfnRead which doesn't try to suspend the VM when the DEKs for encrypted disks 1043 * are missing but just returns an error. 1044 */ 1045 DECLR3CALLBACKMEMBER(int, pfnReadPcBios,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead)); 1046 1047 /** 1033 1048 * Write bits. 1034 1049 * … … 1366 1381 */ 1367 1382 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead)); 1383 1384 /** 1385 * Read bits - version for DevPcBios. 1386 * 1387 * @returns VBox status code. 1388 * @param pInterface Pointer to the interface structure containing the called function pointer. 1389 * @param off Offset to start reading from. The offset must be aligned to a sector boundary. 1390 * @param pvBuf Where to store the read bits. 1391 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary. 1392 * @thread Any thread. 1393 * 1394 * @note: Special version of pfnRead which doesn't try to suspend the VM when the DEKs for encrypted disks 1395 * are missing but just returns an error. 1396 */ 1397 DECLR3CALLBACKMEMBER(int, pfnReadPcBios,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead)); 1368 1398 1369 1399 /** -
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r51520 r53148 298 298 if (!pBlock) 299 299 return VERR_INVALID_PARAMETER; 300 rc = pBlock->pfnRead (pBlock, 0, aMBR, sizeof(aMBR));300 rc = pBlock->pfnReadPcBios(pBlock, 0, aMBR, sizeof(aMBR)); 301 301 if (RT_FAILURE(rc)) 302 302 return rc; -
trunk/src/VBox/Devices/Storage/DrvBlock.cpp
r52023 r53148 148 148 149 149 150 /** @copydoc PDMIBLOCK::pfnReadPcBios */ 151 static DECLCALLBACK(int) drvblockReadPcBios(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead) 152 { 153 PDRVBLOCK pThis = PDMIBLOCK_2_DRVBLOCK(pInterface); 154 155 /* 156 * Check the state. 157 */ 158 if (!pThis->pDrvMedia) 159 { 160 AssertMsgFailed(("Invalid state! Not mounted!\n")); 161 return VERR_PDM_MEDIA_NOT_MOUNTED; 162 } 163 164 int rc = pThis->pDrvMedia->pfnReadPcBios(pThis->pDrvMedia, off, pvBuf, cbRead); 165 return rc; 166 } 167 168 150 169 /** @copydoc PDMIBLOCK::pfnWrite */ 151 170 static DECLCALLBACK(int) drvblockWrite(PPDMIBLOCK pInterface, uint64_t off, const void *pvBuf, size_t cbWrite) … … 881 900 /* IBlock. */ 882 901 pThis->IBlock.pfnRead = drvblockRead; 902 pThis->IBlock.pfnReadPcBios = drvblockReadPcBios; 883 903 pThis->IBlock.pfnWrite = drvblockWrite; 884 904 pThis->IBlock.pfnFlush = drvblockFlush; -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r52063 r53148 1601 1601 } 1602 1602 1603 /** @copydoc PDMIMEDIA::pfnRead */ 1604 static DECLCALLBACK(int) drvvdReadPcBios(PPDMIMEDIA pInterface, 1605 uint64_t off, void *pvBuf, size_t cbRead) 1606 { 1607 int rc = VINF_SUCCESS; 1608 1609 LogFlowFunc(("off=%#llx pvBuf=%p cbRead=%d\n", off, pvBuf, cbRead)); 1610 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 1611 1612 if ( pThis->pCfgCrypto 1613 && !pThis->pIfSecKey) 1614 return VERR_VD_DEK_MISSING; 1615 1616 if (!pThis->fBootAccelActive) 1617 rc = VDRead(pThis->pDisk, off, pvBuf, cbRead); 1618 else 1619 { 1620 /* Can we serve the request from the buffer? */ 1621 if ( off >= pThis->offDisk 1622 && off - pThis->offDisk < pThis->cbDataValid) 1623 { 1624 size_t cbToCopy = RT_MIN(cbRead, pThis->offDisk + pThis->cbDataValid - off); 1625 1626 memcpy(pvBuf, pThis->pbData + (off - pThis->offDisk), cbToCopy); 1627 cbRead -= cbToCopy; 1628 off += cbToCopy; 1629 pvBuf = (char *)pvBuf + cbToCopy; 1630 } 1631 1632 if ( cbRead > 0 1633 && cbRead < pThis->cbBootAccelBuffer) 1634 { 1635 /* Increase request to the buffer size and read. */ 1636 pThis->cbDataValid = RT_MIN(pThis->cbDisk - off, pThis->cbBootAccelBuffer); 1637 pThis->offDisk = off; 1638 rc = VDRead(pThis->pDisk, off, pThis->pbData, pThis->cbDataValid); 1639 if (RT_FAILURE(rc)) 1640 pThis->cbDataValid = 0; 1641 else 1642 memcpy(pvBuf, pThis->pbData, cbRead); 1643 } 1644 else if (cbRead >= pThis->cbBootAccelBuffer) 1645 { 1646 pThis->fBootAccelActive = false; /* Deactiviate */ 1647 } 1648 } 1649 1650 if (RT_SUCCESS(rc)) 1651 Log2(("%s: off=%#llx pvBuf=%p cbRead=%d\n%.*Rhxd\n", __FUNCTION__, 1652 off, pvBuf, cbRead, cbRead, pvBuf)); 1653 LogFlowFunc(("returns %Rrc\n", rc)); 1654 return rc; 1655 } 1656 1657 1603 1658 /** @copydoc PDMIMEDIA::pfnWrite */ 1604 1659 static DECLCALLBACK(int) drvvdWrite(PPDMIMEDIA pInterface, … … 2422 2477 /* IMedia */ 2423 2478 pThis->IMedia.pfnRead = drvvdRead; 2479 pThis->IMedia.pfnReadPcBios = drvvdReadPcBios; 2424 2480 pThis->IMedia.pfnWrite = drvvdWrite; 2425 2481 pThis->IMedia.pfnFlush = drvvdFlush;
Note:
See TracChangeset
for help on using the changeset viewer.