- Timestamp:
- Feb 18, 2009 10:53:14 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pgm.h
r16408 r16889 331 331 VMMDECL(int) PGMMapActivateAll(PVM pVM); 332 332 VMMDECL(int) PGMMapDeactivateAll(PVM pVM); 333 VMMDECL(bool) PGMMapHasConflicts(PVM pVM, uint64_t cr3, bool fResolveConflicts); 333 334 334 335 VMMDECL(int) PGMShwGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys); … … 549 550 VMMR3DECL(int) PGMR3MappingsDisable(PVM pVM); 550 551 VMMR3DECL(int) PGMR3MapIntermediate(PVM pVM, RTUINTPTR Addr, RTHCPHYS HCPhys, unsigned cbPages); 551 VMMR3DECL(bool) PGMR3MapHasConflicts(PVM pVM, uint64_t cr3, bool fRawR0);552 552 VMMR3DECL(int) PGMR3MapRead(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb); 553 553 -
trunk/src/VBox/VMM/EM.cpp
r16652 r16889 2607 2607 ("Tried to execute code with IF at EIP=%08x!\n", pCtx->eip)); 2608 2608 if ( !VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL) 2609 && PGM R3MapHasConflicts(pVM, pCtx->cr3, pVM->fRawR0Enabled))2609 && PGMMapHasConflicts(pVM, pCtx->cr3, false)) 2610 2610 { 2611 2611 AssertMsgFailed(("We should not get conflicts any longer!!!\n")); … … 2720 2720 */ 2721 2721 if ( !VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL) 2722 && PGM R3MapHasConflicts(pVM, pCtx->cr3, pVM->fRawR0Enabled))2722 && PGMMapHasConflicts(pVM, pCtx->cr3, false)) 2723 2723 { 2724 2724 AssertMsgFailed(("We should not get conflicts any longer!!!\n")); -
trunk/src/VBox/VMM/PGMMap.cpp
r16887 r16889 1303 1303 } 1304 1304 1305 1306 /**1307 * Checks guest PD for conflicts with VMM GC mappings.1308 *1309 * @returns true if conflict detected.1310 * @returns false if not.1311 * @param pVM The virtual machine.1312 * @param cr3 Guest context CR3 register.1313 * @param fRawR0 Whether RawR0 is enabled or not.1314 */1315 VMMR3DECL(bool) PGMR3MapHasConflicts(PVM pVM, uint64_t cr3, bool fRawR0) /** @todo how many HasConflict constructs do we really need? */1316 {1317 /*1318 * Can skip this if mappings are safely fixed.1319 */1320 if (pVM->pgm.s.fMappingsFixed)1321 return false;1322 1323 PGMMODE const enmGuestMode = PGMGetGuestMode(pVM);1324 Assert(enmGuestMode <= PGMMODE_PAE_NX);1325 1326 /*1327 * Iterate mappings.1328 */1329 if (enmGuestMode == PGMMODE_32_BIT)1330 {1331 /*1332 * Resolve the page directory.1333 */1334 PX86PD pPD = pVM->pgm.s.pGst32BitPdR3;1335 Assert(pPD);1336 Assert(pPD == (PX86PD)PGMPhysGCPhys2R3PtrAssert(pVM, cr3 & X86_CR3_PAGE_MASK, sizeof(*pPD)));1337 1338 for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)1339 {1340 unsigned iPDE = pCur->GCPtr >> X86_PD_SHIFT;1341 unsigned iPT = pCur->cPTs;1342 while (iPT-- > 0)1343 if ( pPD->a[iPDE + iPT].n.u1Present /** @todo PGMGstGetPDE. */1344 && (fRawR0 || pPD->a[iPDE + iPT].n.u1User))1345 {1346 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts);1347 Log(("PGMR3HasMappingConflicts: Conflict was detected at %08RX32 for mapping %s (32 bits)\n"1348 " iPDE=%#x iPT=%#x PDE=%RGp.\n",1349 (iPT + iPDE) << X86_PD_SHIFT, pCur->pszDesc,1350 iPDE, iPT, pPD->a[iPDE + iPT].au32[0]));1351 return true;1352 }1353 }1354 }1355 else if ( enmGuestMode == PGMMODE_PAE1356 || enmGuestMode == PGMMODE_PAE_NX)1357 {1358 for (PPGMMAPPING pCur = pVM->pgm.s.pMappingsR3; pCur; pCur = pCur->pNextR3)1359 {1360 RTGCPTR GCPtr = pCur->GCPtr;1361 1362 unsigned iPT = pCur->cb >> X86_PD_PAE_SHIFT;1363 while (iPT-- > 0)1364 {1365 X86PDEPAE Pde = pgmGstGetPaePDE(&pVM->pgm.s, GCPtr);1366 1367 if ( Pde.n.u1Present1368 && (fRawR0 || Pde.n.u1User))1369 {1370 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts);1371 Log(("PGMR3HasMappingConflicts: Conflict was detected at %RGv for mapping %s (PAE)\n"1372 " PDE=%016RX64.\n",1373 GCPtr, pCur->pszDesc, Pde.u));1374 return true;1375 }1376 GCPtr += (1 << X86_PD_PAE_SHIFT);1377 }1378 }1379 }1380 else1381 AssertFailed();1382 1383 return false;1384 }1385 1386 1305 /** 1387 1306 * Read memory from the guest mappings. -
trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp
r16887 r16889 524 524 #endif /* IN_RING0 */ 525 525 } 526 527 /** 528 * Checks guest PD for conflicts with VMM GC mappings. 529 * 530 * @returns true if conflict detected. 531 * @returns false if not. 532 * @param pVM The virtual machine. 533 * @param cr3 Guest context CR3 register. 534 * @param fResolveConflicts Whether to resolve found conflicts or not (only valid in ring 3) 535 */ 536 VMMDECL(bool) PGMMapHasConflicts(PVM pVM, uint64_t cr3, bool fResolveConflicts) 537 { 538 /* 539 * Can skip this if mappings are safely fixed. 540 */ 541 if (pVM->pgm.s.fMappingsFixed) 542 return false; 543 544 PGMMODE const enmGuestMode = PGMGetGuestMode(pVM); 545 Assert(enmGuestMode <= PGMMODE_PAE_NX); 546 547 /* 548 * Iterate mappings. 549 */ 550 if (enmGuestMode == PGMMODE_32_BIT) 551 { 552 /* 553 * Resolve the page directory. 554 */ 555 PX86PD pPD = pVM->pgm.s.CTX_SUFF(pGst32BitPd); 556 Assert(pPD); 557 Assert(pPD == (PX86PD)PGMPhysGCPhys2R3PtrAssert(pVM, cr3 & X86_CR3_PAGE_MASK, sizeof(*pPD))); 558 559 for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext)) 560 { 561 unsigned iPDE = pCur->GCPtr >> X86_PD_SHIFT; 562 unsigned iPT = pCur->cPTs; 563 while (iPT-- > 0) 564 if ( pPD->a[iPDE + iPT].n.u1Present /** @todo PGMGstGetPDE. */ 565 && (pVM->fRawR0Enabled || pPD->a[iPDE + iPT].n.u1User)) 566 { 567 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts); 568 Log(("PGMHasMappingConflicts: Conflict was detected at %08RX32 for mapping %s (32 bits)\n" 569 " iPDE=%#x iPT=%#x PDE=%RGp.\n", 570 (iPT + iPDE) << X86_PD_SHIFT, pCur->pszDesc, 571 iPDE, iPT, pPD->a[iPDE + iPT].au32[0])); 572 return true; 573 } 574 } 575 } 576 else if ( enmGuestMode == PGMMODE_PAE 577 || enmGuestMode == PGMMODE_PAE_NX) 578 { 579 for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext)) 580 { 581 RTGCPTR GCPtr = pCur->GCPtr; 582 583 unsigned iPT = pCur->cb >> X86_PD_PAE_SHIFT; 584 while (iPT-- > 0) 585 { 586 X86PDEPAE Pde = pgmGstGetPaePDE(&pVM->pgm.s, GCPtr); 587 588 if ( Pde.n.u1Present 589 && (pVM->fRawR0Enabled || Pde.n.u1User)) 590 { 591 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts); 592 Log(("PGMHasMappingConflicts: Conflict was detected at %RGv for mapping %s (PAE)\n" 593 " PDE=%016RX64.\n", 594 GCPtr, pCur->pszDesc, Pde.u)); 595 return true; 596 } 597 GCPtr += (1 << X86_PD_PAE_SHIFT); 598 } 599 } 600 } 601 else 602 AssertFailed(); 603 604 return false; 605 }
Note:
See TracChangeset
for help on using the changeset viewer.