Changeset 97923 in vbox for trunk/src/VBox/Additions/common/VBoxGuest/lib/testcase
- Timestamp:
- Dec 30, 2022 10:24:20 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155013
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/testcase/tstVbglR0PhysHeap-1.cpp
r97921 r97923 87 87 g_cChunks++; 88 88 g_cbChunks += cb; 89 *pPhys = (uint32_t)(uintptr_t)pvRet ^ UINT32_C(0xf0f0f000); 89 *pPhys = (uint32_t)(uintptr_t)pvRet ^ (UINT32_C(0xf0f0f0f0) & ~(uint32_t)PAGE_OFFSET_MASK); 90 91 /* Avoid problematic values that won't happen in real life: */ 92 if (!*pPhys) 93 *pPhys = 4U << PAGE_SHIFT; 94 if (UINT32_MAX - *pPhys < cb) 95 *pPhys -= RT_ALIGN_32(cb, PAGE_SIZE); 96 90 97 return pvRet; 91 98 } … … 160 167 if (RT_FAILURE(rc)) 161 168 return RTTestSummaryAndDestroy(hTest); 169 170 #define CHECK_PHYS_ADDR(a_pv) do { \ 171 uint32_t const uPhys = VbglR0PhysHeapGetPhysAddr(a_pv); \ 172 if (uPhys == 0 || uPhys == UINT32_MAX || (uPhys & PAGE_OFFSET_MASK) != ((uintptr_t)(a_pv) & PAGE_OFFSET_MASK)) \ 173 RTTestIFailed("line %u: %s=%p: uPhys=%#x\n", __LINE__, #a_pv, (a_pv), uPhys); \ 174 } while (0) 162 175 163 176 /* … … 210 223 RTTESTI_CHECK_MSG(RT_ALIGN_P(s_aOps[i].pvAlloc, sizeof(void *)) == s_aOps[i].pvAlloc, 211 224 ("VbglR0PhysHeapAlloc(%#x) -> %p\n", s_aOps[i].cb, i)); 212 if (!s_aOps[i].pvAlloc) 213 return RTTestSummaryAndDestroy(hTest);225 226 CHECK_PHYS_ADDR(s_aOps[i].pvAlloc); 214 227 } 215 228 … … 230 243 if (!pv) 231 244 return RTTestSummaryAndDestroy(hTest); 245 CHECK_PHYS_ADDR(pv); 246 232 247 //RTPrintf("debug: i=%d pv=%p cbReal=%#zx cbBeforeSub=%#zx cbAfterSubFree=%#zx cbAfterSubAlloc=%#zx \n", i, pv, RTHeapOffsetSize(Heap, pv), 233 248 // cbBeforeSub, cbAfterSubFree, VbglR0PhysHeapGetFreeSize()); … … 283 298 } 284 299 if (s_aHistory[i].pv) 300 { 285 301 memset(s_aHistory[i].pv, 0xbb, s_aHistory[i].cb); 302 CHECK_PHYS_ADDR(s_aHistory[i].pv); 303 } 286 304 } 287 305 else … … 311 329 s_aHistory[i].pv = VbglR0PhysHeapAlloc(s_aHistory[i].cb); 312 330 if (s_aHistory[i].pv) 331 { 313 332 memset(s_aHistory[i].pv, 0x55, s_aHistory[i].cb); 333 CHECK_PHYS_ADDR(s_aHistory[i].pv); 334 } 314 335 } 315 336 … … 327 348 } 328 349 if (s_aHistory[i].pv) 350 { 329 351 memset(s_aHistory[i].pv, 0x55, s_aHistory[i].cb); 352 CHECK_PHYS_ADDR(s_aHistory[i].pv); 353 } 330 354 331 355 cbFree = VbglR0PhysHeapGetFreeSize();
Note:
See TracChangeset
for help on using the changeset viewer.