Changeset 27575 in vbox
- Timestamp:
- Mar 22, 2010 9:37:43 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/alloc-ef.cpp
r27404 r27575 296 296 * counteracted by filling and checking the alignment padding. When the 297 297 * fence is in front then then no extra alignment is needed. */ 298 size_t cbAlign = RT_ALIGN_Z(cb, RTALLOC_EFENCE_ALIGNMENT);298 size_t cbAligned = RT_ALIGN_Z(cb, RTALLOC_EFENCE_ALIGNMENT); 299 299 #endif 300 300 … … 325 325 void *pvEFence = pvBlock; 326 326 void *pv = (char *)pvEFence + RTALLOC_EFENCE_SIZE; 327 # ifdef RTALLOC_EFENCE_NOMAN_FILLER327 # ifdef RTALLOC_EFENCE_NOMAN_FILLER 328 328 memset((char *)pv + cb, RTALLOC_EFENCE_NOMAN_FILLER, cbBlock - RTALLOC_EFENCE_SIZE - cb); 329 # endif329 # endif 330 330 #else 331 331 void *pvEFence = (char *)pvBlock + (cbBlock - RTALLOC_EFENCE_SIZE); 332 void *pv = (char *)pvEFence - cbAlign ;333 # ifdef RTALLOC_EFENCE_NOMAN_FILLER334 memset(pvBlock, RTALLOC_EFENCE_NOMAN_FILLER, cbBlock - RTALLOC_EFENCE_SIZE - cbAlign );335 memset((char *)pv + cb, RTALLOC_EFENCE_NOMAN_FILLER, cbAlign - cb);336 # endif332 void *pv = (char *)pvEFence - cbAligned; 333 # ifdef RTALLOC_EFENCE_NOMAN_FILLER 334 memset(pvBlock, RTALLOC_EFENCE_NOMAN_FILLER, cbBlock - RTALLOC_EFENCE_SIZE - cbAligned); 335 memset((char *)pv + cb, RTALLOC_EFENCE_NOMAN_FILLER, cbAligned - cb); 336 # endif 337 337 #endif 338 338 … … 402 402 */ 403 403 # ifdef RTALLOC_EFENCE_IN_FRONT 404 void *p = ASMMemIsAll8((char *)pv + pBlock->cb,405 RT_ALIGN_Z(pBlock->cb, PAGE_SIZE) - pBlock->cb,406 RTALLOC_EFENCE_NOMAN_FILLER);404 void *pvWrong = ASMMemIsAll8((char *)pv + pBlock->cb, 405 RT_ALIGN_Z(pBlock->cb, PAGE_SIZE) - pBlock->cb, 406 RTALLOC_EFENCE_NOMAN_FILLER); 407 407 # else 408 408 /* Alignment must match allocation alignment in rtMemAlloc(). */ 409 size_t cbAlign = RT_ALIGN_Z(pBlock->cb, RTALLOC_EFENCE_ALIGNMENT); 410 void *p = ASMMemIsAll8((char *)pv + pBlock->cb, 411 cbAlign - pBlock->cb, 409 size_t cbAligned = RT_ALIGN_Z(pBlock->cb, RTALLOC_EFENCE_ALIGNMENT); 410 void *pvWrong = ASMMemIsAll8((char *)pv + pBlock->cb, 411 cbAligned - pBlock->cb, 412 RTALLOC_EFENCE_NOMAN_FILLER); 413 if (pvWrong) 414 RTAssertDoPanic(); 415 pvWrong = ASMMemIsAll8((void *)((uintptr_t)pv & ~PAGE_OFFSET_MASK), 416 RT_ALIGN_Z(cbAligned, PAGE_SIZE) - cbAligned, 412 417 RTALLOC_EFENCE_NOMAN_FILLER); 413 if (p)414 RTAssertDoPanic();415 p = ASMMemIsAll8((void *)((uintptr_t)pv & ~PAGE_OFFSET_MASK),416 RT_ALIGN_Z(cbAlign, PAGE_SIZE) - cbAlign,417 RTALLOC_EFENCE_NOMAN_FILLER);418 418 # endif 419 if (p )419 if (pvWrong) 420 420 RTAssertDoPanic(); 421 421 #endif
Note:
See TracChangeset
for help on using the changeset viewer.