Changeset 86704 in vbox for trunk/src/VBox/VMM/VMMR0/DBGFR0Bp.cpp
- Timestamp:
- Oct 26, 2020 12:04:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/DBGFR0Bp.cpp
r86700 r86704 62 62 } 63 63 64 for (uint32_t i = 0; i < RT_ELEMENTS(pGVM->dbgfr0.s.aBpL2TblChunks); i++) 65 { 66 PDBGFBPL2TBLCHUNKR0 pL2Chunk = &pGVM->dbgfr0.s.aBpL2TblChunks[i]; 67 68 pL2Chunk->hMemObj = NIL_RTR0MEMOBJ; 69 pL2Chunk->hMapObj = NIL_RTR0MEMOBJ; 70 //pL2Chunk->paBpL2TblBaseSharedR0 = NULL; 71 } 72 64 73 pGVM->dbgfr0.s.hMemObjBpLocL1 = NIL_RTR0MEMOBJ; 65 74 //pGVM->dbgfr0.s.paBpLocL1R0 = NULL; … … 112 121 } 113 122 123 for (uint32_t i = 0; i < RT_ELEMENTS(pGVM->dbgfr0.s.aBpL2TblChunks); i++) 124 { 125 PDBGFBPL2TBLCHUNKR0 pL2Chunk = &pGVM->dbgfr0.s.aBpL2TblChunks[i]; 126 127 if (pL2Chunk->hMemObj != NIL_RTR0MEMOBJ) 128 { 129 Assert(pL2Chunk->hMapObj != NIL_RTR0MEMOBJ); 130 131 pL2Chunk->paBpL2TblBaseSharedR0 = NULL; 132 133 hMemObj = pL2Chunk->hMapObj; 134 pL2Chunk->hMapObj = NIL_RTR0MEMOBJ; 135 RTR0MemObjFree(hMemObj, true); 136 137 hMemObj = pL2Chunk->hMemObj; 138 pL2Chunk->hMemObj = NIL_RTR0MEMOBJ; 139 RTR0MemObjFree(hMemObj, true); 140 } 141 } 142 114 143 pGVM->dbgfr0.s.fInit = false; 115 144 } … … 128 157 Assert(!pBpChunk->paBpBaseSharedR0); 129 158 Assert(!pBpChunk->paBpBaseR0Only); 159 } 160 161 for (uint32_t i = 0; i < RT_ELEMENTS(pGVM->dbgfr0.s.aBpL2TblChunks); i++) 162 { 163 PDBGFBPL2TBLCHUNKR0 pL2Chunk = &pGVM->dbgfr0.s.aBpL2TblChunks[i]; 164 165 Assert(pL2Chunk->hMemObj == NIL_RTR0MEMOBJ); 166 Assert(pL2Chunk->hMapObj == NIL_RTR0MEMOBJ); 167 Assert(!pL2Chunk->paBpL2TblBaseSharedR0); 130 168 } 131 169 } … … 239 277 240 278 /** 279 * Worker for DBGFR0BpL2TblChunkAllocReqHandler() that does the actual chunk allocation. 280 * 281 * @returns VBox status code. 282 * @param pGVM The global (ring-0) VM structure. 283 * @param idChunk The chunk ID to allocate. 284 * @param ppL2ChunkBaseR3 Where to return the ring-3 chunk base address on success. 285 * @thread EMT(0) 286 */ 287 static int dbgfR0BpL2TblChunkAllocWorker(PGVM pGVM, uint32_t idChunk, R3PTRTYPE(void *) *ppL2ChunkBaseR3) 288 { 289 /* 290 * Figure out how much memory we need for the chunk and allocate it. 291 */ 292 uint32_t const cbTotal = RT_ALIGN_32(DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK * sizeof(DBGFBPL2ENTRY), PAGE_SIZE); 293 294 RTR0MEMOBJ hMemObj; 295 int rc = RTR0MemObjAllocPage(&hMemObj, cbTotal, false /*fExecutable*/); 296 if (RT_FAILURE(rc)) 297 return rc; 298 RT_BZERO(RTR0MemObjAddress(hMemObj), cbTotal); 299 300 /* Map it. */ 301 RTR0MEMOBJ hMapObj; 302 rc = RTR0MemObjMapUserEx(&hMapObj, hMemObj, (RTR3PTR)-1, 0, RTMEM_PROT_READ | RTMEM_PROT_WRITE, RTR0ProcHandleSelf(), 303 0 /*offSub*/, cbTotal); 304 if (RT_SUCCESS(rc)) 305 { 306 PDBGFBPL2TBLCHUNKR0 pL2ChunkR0 = &pGVM->dbgfr0.s.aBpL2TblChunks[idChunk]; 307 308 pL2ChunkR0->hMemObj = hMemObj; 309 pL2ChunkR0->hMapObj = hMapObj; 310 pL2ChunkR0->paBpL2TblBaseSharedR0 = (PDBGFBPL2ENTRY)RTR0MemObjAddress(hMemObj); 311 312 /* 313 * We're done. 314 */ 315 *ppL2ChunkBaseR3 = RTR0MemObjAddressR3(hMapObj); 316 return rc; 317 } 318 319 RTR0MemObjFree(hMemObj, true); 320 return rc; 321 } 322 323 324 /** 241 325 * Used by ring-3 DBGF to fully initialize the breakpoint manager for operation. 242 326 * … … 293 377 } 294 378 379 380 /** 381 * Used by ring-3 DBGF to allocate a given chunk in the global L2 lookup table. 382 * 383 * @returns VBox status code. 384 * @param pGVM The global (ring-0) VM structure. 385 * @param pReq Pointer to the request buffer. 386 * @thread EMT(0) 387 */ 388 VMMR0_INT_DECL(int) DBGFR0BpL2TblChunkAllocReqHandler(PGVM pGVM, PDBGFBPL2TBLCHUNKALLOCREQ pReq) 389 { 390 LogFlow(("DBGFR0BpL2TblChunkAllocReqHandler:\n")); 391 392 /* 393 * Validate the request. 394 */ 395 AssertReturn(pReq->Hdr.cbReq == sizeof(*pReq), VERR_INVALID_PARAMETER); 396 397 uint32_t const idChunk = pReq->idChunk; 398 AssertReturn(idChunk < DBGF_BP_L2_TBL_CHUNK_COUNT, VERR_INVALID_PARAMETER); 399 400 int rc = GVMMR0ValidateGVMandEMT(pGVM, 0); 401 AssertRCReturn(rc, rc); 402 403 AssertReturn(pGVM->dbgfr0.s.fInit, VERR_WRONG_ORDER); 404 AssertReturn(pGVM->dbgfr0.s.aBpL2TblChunks[idChunk].hMemObj == NIL_RTR0MEMOBJ, VERR_INVALID_PARAMETER); 405 406 return dbgfR0BpL2TblChunkAllocWorker(pGVM, idChunk, &pReq->pChunkBaseR3); 407 } 408
Note:
See TracChangeset
for help on using the changeset viewer.