Changeset 97907 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Dec 29, 2022 6:33:45 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/alloc-r0drv.cpp
r96407 r97907 322 322 } 323 323 RT_EXPORT_SYMBOL(RTMemFreeZ); 324 325 326 327 328 329 330 RTDECL(void *) RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_DEF331 {332 PRTMEMHDR pHdr;333 #ifdef RT_OS_SOLARIS /** @todo figure out why */334 RT_ASSERT_INTS_ON();335 #else336 RT_ASSERT_PREEMPTIBLE();337 #endif338 RT_NOREF_PV(pszTag);339 340 341 pHdr = rtR0MemAlloc(cb + RTR0MEM_FENCE_EXTRA, RTMEMHDR_FLAG_EXEC);342 if (pHdr)343 {344 #ifdef RTR0MEM_STRICT345 pHdr->cbReq = (uint32_t)cb; Assert(pHdr->cbReq == cb);346 memcpy((uint8_t *)(pHdr + 1) + cb, &g_abFence[0], RTR0MEM_FENCE_EXTRA);347 #endif348 return pHdr + 1;349 }350 return NULL;351 }352 RT_EXPORT_SYMBOL(RTMemExecAllocTag);353 354 355 RTDECL(void) RTMemExecFree(void *pv, size_t cb) RT_NO_THROW_DEF356 {357 PRTMEMHDR pHdr;358 RT_ASSERT_INTS_ON();359 RT_NOREF_PV(cb);360 361 if (!pv)362 return;363 pHdr = (PRTMEMHDR)pv - 1;364 if (pHdr->u32Magic == RTMEMHDR_MAGIC)365 {366 Assert(!(pHdr->fFlags & RTMEMHDR_FLAG_ALLOC_EX));367 #ifdef RTR0MEM_STRICT368 AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA),369 ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n"370 "fence: %.*Rhxs\n"371 "expected: %.*Rhxs\n",372 pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags,373 RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq,374 RTR0MEM_FENCE_EXTRA, &g_abFence[0]));375 #endif376 rtR0MemFree(pHdr);377 }378 else379 AssertMsgFailed(("pHdr->u32Magic=%RX32 pv=%p\n", pHdr->u32Magic, pv));380 }381 RT_EXPORT_SYMBOL(RTMemExecFree);382 383 384 324 385 325
Note:
See TracChangeset
for help on using the changeset viewer.