Changeset 100185 in vbox for trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
- Timestamp:
- Jun 16, 2023 6:54:50 AM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r98103 r100185 691 691 if (pPtr->cPages == 1) 692 692 return true; 693 RTGCPHYS64 Phys = pPtr->paPages[0] + GUEST_PAGE_SIZE;693 RTGCPHYS64 Phys = pPtr->paPages[0] + VMMDEV_PAGE_SIZE; 694 694 if (Phys != pPtr->paPages[1]) 695 695 return false; … … 699 699 do 700 700 { 701 Phys += GUEST_PAGE_SIZE;701 Phys += VMMDEV_PAGE_SIZE; 702 702 if (Phys != pPtr->paPages[iPage]) 703 703 return false; … … 734 734 for (uint32_t iPage = 0; iPage < pPtr->cPages && cbRemaining > 0; ++iPage) 735 735 { 736 uint32_t cbToRead = GUEST_PAGE_SIZE - offPage;736 uint32_t cbToRead = VMMDEV_PAGE_SIZE - offPage; 737 737 if (cbToRead > cbRemaining) 738 738 cbToRead = cbRemaining; … … 773 773 for (iPage = 0; iPage < pPtr->cPages && cbRemaining > 0; ++iPage) 774 774 { 775 uint32_t cbToWrite = GUEST_PAGE_SIZE - offPage;775 uint32_t cbToWrite = VMMDEV_PAGE_SIZE - offPage; 776 776 if (cbToWrite > cbRemaining) 777 777 cbToWrite = cbRemaining; … … 1098 1098 ASSERT_GUEST_RETURN(cbData <= VMMDEV_MAX_HGCM_DATA_SIZE, VERR_INVALID_PARAMETER); 1099 1099 1100 const uint32_t offFirstPage = cbData > 0 ? GCPtr & GUEST_PAGE_OFFSET_MASK : 0;1101 const uint32_t cPages = cbData > 0 ? (offFirstPage + cbData + GUEST_PAGE_SIZE - 1) / GUEST_PAGE_SIZE : 0;1100 const uint32_t offFirstPage = cbData > 0 ? GCPtr & VMMDEV_PAGE_OFFSET_MASK : 0; 1101 const uint32_t cPages = cbData > 0 ? (offFirstPage + cbData + VMMDEV_PAGE_SIZE - 1) / VMMDEV_PAGE_SIZE : 0; 1102 1102 1103 1103 pGuestParm->u.ptr.cbData = cbData; … … 1119 1119 1120 1120 /* Gonvert the guest linear pointers of pages to physical addresses. */ 1121 GCPtr &= ~(RTGCPTR) GUEST_PAGE_OFFSET_MASK;1121 GCPtr &= ~(RTGCPTR)VMMDEV_PAGE_OFFSET_MASK; 1122 1122 for (uint32_t iPage = 0; iPage < cPages; ++iPage) 1123 1123 { … … 1134 1134 1135 1135 pGuestParm->u.ptr.paPages[iPage] = GCPhys; 1136 GCPtr += GUEST_PAGE_SIZE;1136 GCPtr += VMMDEV_PAGE_SIZE; 1137 1137 } 1138 1138 } … … 1179 1179 ("%#x\n", pPageListInfo->flags), VERR_INVALID_FLAGS); 1180 1180 /* First page offset. */ 1181 ASSERT_GUEST_MSG_RETURN(pPageListInfo->offFirstPage < GUEST_PAGE_SIZE,1181 ASSERT_GUEST_MSG_RETURN(pPageListInfo->offFirstPage < VMMDEV_PAGE_SIZE, 1182 1182 ("%#x\n", pPageListInfo->offFirstPage), VERR_INVALID_PARAMETER); 1183 1183 … … 1187 1187 ASSERT_GUEST_MSG_RETURN( pPageListInfo->cPages 1188 1188 == (pGuestParm->enmType == VMMDevHGCMParmType_ContiguousPageList ? 1 1189 : RT_ALIGN_32(pPageListInfo->offFirstPage + cbData, GUEST_PAGE_SIZE)1190 >> GUEST_PAGE_SHIFT)1189 : RT_ALIGN_32(pPageListInfo->offFirstPage + cbData, VMMDEV_PAGE_SIZE) 1190 >> VMMDEV_PAGE_SHIFT) 1191 1191 || pGuestParm->enmType == VMMDevHGCMParmType_PageList, 1192 1192 ("offFirstPage=%#x cbData=%#x cPages=%#x enmType=%d\n", … … 1203 1203 { 1204 1204 /* Validate page offsets */ 1205 ASSERT_GUEST_MSG_RETURN( !(pPageListInfo->aPages[0] & GUEST_PAGE_OFFSET_MASK)1206 || (pPageListInfo->aPages[0] & GUEST_PAGE_OFFSET_MASK) == pPageListInfo->offFirstPage,1205 ASSERT_GUEST_MSG_RETURN( !(pPageListInfo->aPages[0] & VMMDEV_PAGE_OFFSET_MASK) 1206 || (pPageListInfo->aPages[0] & VMMDEV_PAGE_OFFSET_MASK) == pPageListInfo->offFirstPage, 1207 1207 ("%#RX64 offFirstPage=%#x\n", pPageListInfo->aPages[0], pPageListInfo->offFirstPage), 1208 1208 VERR_INVALID_POINTER); 1209 1209 uint32_t const cPages = pPageListInfo->cPages; 1210 1210 for (uint32_t iPage = 1; iPage < cPages; iPage++) 1211 ASSERT_GUEST_MSG_RETURN(!(pPageListInfo->aPages[iPage] & GUEST_PAGE_OFFSET_MASK),1211 ASSERT_GUEST_MSG_RETURN(!(pPageListInfo->aPages[iPage] & VMMDEV_PAGE_OFFSET_MASK), 1212 1212 ("[%#zx]=%#RX64\n", iPage, pPageListInfo->aPages[iPage]), VERR_INVALID_POINTER); 1213 1213 RT_UNTRUSTED_VALIDATED_FENCE();
Note:
See TracChangeset
for help on using the changeset viewer.