Changeset 97929 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Dec 31, 2022 1:31:41 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibPhysHeap.cpp
r97928 r97929 85 85 86 86 /* Heap block signature */ 87 #define VBGL_PH_BLOCKSIGNATURE UINT32_C(0xADDBBBBB)87 #define VBGL_PH_BLOCKSIGNATURE UINT32_C(0xADDBBBBB) 88 88 89 89 /* Heap chunk signature */ 90 #define VBGL_PH_CHUNKSIGNATURE UINT32_C(0xADDCCCCC)90 #define VBGL_PH_CHUNKSIGNATURE UINT32_C(0xADDCCCCC) 91 91 /* Heap chunk allocation unit */ 92 #define VBGL_PH_CHUNKSIZE (0x10000) 92 #define VBGL_PH_CHUNKSIZE (0x10000) 93 94 /** The allocation block alignment. 95 * 96 * This is also the the minimum block size. 97 */ 98 #define VBGL_PH_ALLOC_ALIGN (sizeof(void *)) 93 99 94 100 /** Max number of free nodes to search before just using the best fit. … … 244 250 245 251 246 DECLINLINE(void) vbglPhysHeapLeave(void)247 {248 RTSemFastMutexRelease(g_vbgldata.mutexHeap);249 }250 251 252 252 static void vbglPhysHeapInitFreeBlock(VBGLPHYSHEAPBLOCK *pBlock, VBGLPHYSHEAPCHUNK *pChunk, uint32_t cbDataSize) 253 253 { … … 316 316 pBlock->pChunk->acBlocks[fAllocated] += 1; 317 317 AssertMsg( (uint32_t)pBlock->pChunk->acBlocks[fAllocated] 318 <= pBlock->pChunk->cbSize / (sizeof(*pBlock) + sizeof(void *)),318 <= pBlock->pChunk->cbSize / (sizeof(*pBlock) + VBGL_PH_ALLOC_ALIGN), 319 319 ("pChunk=%p: cbSize=%#x acBlocks[%u]=%d\n", 320 320 pBlock->pChunk, pBlock->pChunk->cbSize, fAllocated, pBlock->pChunk->acBlocks[fAllocated])); … … 514 514 * Align the size to a pointer size to avoid getting misaligned header pointers and whatnot. 515 515 */ 516 cbSize = RT_ALIGN_32(cbSize, sizeof(void *));517 AssertStmt(cbSize > 0, cbSize = sizeof(void *));/* avoid allocating zero bytes */516 cbSize = RT_ALIGN_32(cbSize, VBGL_PH_ALLOC_ALIGN); 517 AssertStmt(cbSize > 0, cbSize = VBGL_PH_ALLOC_ALIGN); /* avoid allocating zero bytes */ 518 518 519 519 rc = RTSemFastMutexRequest(g_vbgldata.mutexHeap); … … 876 876 RTErrInfoSetF(pErrInfo, VERR_INTERNAL_ERROR_2, 877 877 "pCurBlock=%p: pChunk=%p, expected %p", pCurBlock, pCurBlock->pChunk, pCurChunk)); 878 AssertReturn( pCurBlock->cbDataSize >= sizeof(void *)878 AssertReturn( pCurBlock->cbDataSize >= VBGL_PH_ALLOC_ALIGN 879 879 && pCurBlock->cbDataSize < _128M 880 && RT_ALIGN_32(pCurBlock->cbDataSize, sizeof(void *)) == pCurBlock->cbDataSize,880 && RT_ALIGN_32(pCurBlock->cbDataSize, VBGL_PH_ALLOC_ALIGN) == pCurBlock->cbDataSize, 881 881 RTErrInfoSetF(pErrInfo, VERR_INTERNAL_ERROR_3, 882 882 "pCurBlock=%p: cbDataSize=%#x", pCurBlock, pCurBlock->cbDataSize));
Note:
See TracChangeset
for help on using the changeset viewer.