Changeset 16898 in vbox
- Timestamp:
- Feb 18, 2009 12:27:00 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pgm.h
r16890 r16898 331 331 VMMDECL(int) PGMMapActivateAll(PVM pVM); 332 332 VMMDECL(int) PGMMapDeactivateAll(PVM pVM); 333 VMMDECL(bool) PGMMapHasConflicts(PVM pVM, bool fResolveConflicts); 334 333 #ifndef IN_RING0 334 VMMDECL(bool) PGMMapHasConflicts(PVM pVM); 335 VMMDECL(int) PGMMapResolveConflicts(PVM pVM); 336 #endif 335 337 VMMDECL(int) PGMShwGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys); 336 338 VMMDECL(int) PGMShwSetPage(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags); -
trunk/src/VBox/VMM/EM.cpp
r16890 r16898 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 && PGMMapHasConflicts(pVM , false))2609 && PGMMapHasConflicts(pVM)) 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 && PGMMapHasConflicts(pVM , false))2722 && PGMMapHasConflicts(pVM)) 2723 2723 { 2724 2724 AssertMsgFailed(("We should not get conflicts any longer!!!\n")); -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r16866 r16898 3299 3299 3300 3300 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 3301 # ifdef PGM_WITHOUT_MAPPINGS 3302 Assert(!pVM->pgm.s.fMappingsFixed); 3303 return VINF_SUCCESS; 3304 # else 3301 3305 /* Nothing to do when mappings are fixed. */ 3302 3306 if (pVM->pgm.s.fMappingsFixed) 3303 3307 return VINF_SUCCESS; 3304 # endif 3305 3308 3309 int rc = PGMMapResolveConflicts(pVM); 3310 Assert(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3); 3311 if (rc == VINF_PGM_SYNC_CR3) 3312 { 3313 LogFlow(("SyncCR3: detected conflict -> VINF_PGM_SYNC_CR3\n")); 3314 return VINF_PGM_SYNC_CR3; 3315 } 3316 # endif 3317 return VINF_SUCCESS; 3318 # else 3306 3319 /* 3307 3320 * PAE and 32-bit legacy mode (shadow). … … 3341 3354 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 3342 3355 3343 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY3344 /* Mappings are always enabled when we get here. */3345 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s));3346 pMapping = pVM->pgm.s.CTX_SUFF(pMappings);3347 iPdNoMapping = (pMapping) ? (pMapping->GCPtr >> GST_PD_SHIFT) : ~0U;3348 # else3349 3356 /* Only check mappings if they are supposed to be put into the shadow page table. */ 3350 3357 if (pgmMapAreMappingsEnabled(&pVM->pgm.s)) … … 3358 3365 iPdNoMapping = ~0U; 3359 3366 } 3360 # endif3361 3367 3362 3368 # if PGM_GST_TYPE == PGM_TYPE_PAE … … 3369 3375 PX86PDPT pPdptDst = pgmShwGetPaePDPTPtr(&pVM->pgm.s); 3370 3376 3371 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY3372 3377 if (pPDSrc == NULL) 3373 3378 { … … 3391 3396 continue; 3392 3397 } 3393 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */3394 3398 # else /* PGM_GST_TYPE != PGM_TYPE_PAE */ 3395 3399 { … … 3469 3473 # endif /* (PGM_GST_TYPE != PGM_TYPE_32BIT && PGM_GST_TYPE != PGM_TYPE_PAE) || PGM_WITHOUT_MAPPINGS */ 3470 3474 3471 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY3472 /* advance */3473 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT3474 pPDEDst += 2;3475 # else3476 pPDEDst++;3477 # endif3478 # else3479 3475 /* 3480 3476 * Sync page directory entry. … … 3565 3561 pPDEDst++; 3566 3562 } /* foreach 2MB PAE PDE in 4MB guest PDE */ 3567 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */3568 3563 } 3569 3564 # if PGM_GST_TYPE == PGM_TYPE_PAE … … 3576 3571 * Check if there is any page directory to mark not present here. 3577 3572 */ 3578 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY3579 /* advance */3580 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT3581 pPDEDst += 2;3582 # else3583 pPDEDst++;3584 # endif3585 # else3586 3573 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 3587 3574 for (unsigned i = 0, iPdShw = iPD * 2; i < 2; i++, iPdShw++) /* pray that the compiler unrolls this */ … … 3600 3587 pPDEDst++; 3601 3588 } 3602 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */3603 3589 } 3604 3590 else … … 3611 3597 3612 3598 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 3613 # ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY3614 3599 if (pVM->pgm.s.fMappingsFixed) 3615 3600 { … … 3619 3604 } 3620 3605 else 3621 # endif /* !VBOX_WITH_PGMPOOL_PAGING_ONLY */3622 3606 { 3623 3607 /* … … 3686 3670 return VINF_SUCCESS; 3687 3671 # endif 3672 #endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */ 3688 3673 #endif /* PGM_SHW_TYPE != PGM_TYPE_NESTED && PGM_SHW_TYPE != PGM_TYPE_EPT && PGM_SHW_TYPE != PGM_TYPE_AMD64 */ 3689 3674 } -
trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp
r16892 r16898 525 525 } 526 526 527 #ifndef IN_RING0 527 528 /** 528 529 * Checks guest PD for conflicts with VMM GC mappings. … … 531 532 * @returns false if not. 532 533 * @param pVM The virtual machine. 533 * @param fResolveConflicts Whether to resolve found conflicts or not (only valid in ring 3) 534 */ 535 VMMDECL(bool) PGMMapHasConflicts(PVM pVM, bool fResolveConflicts) 534 */ 535 VMMDECL(bool) PGMMapHasConflicts(PVM pVM) 536 536 { 537 537 /* … … 564 564 { 565 565 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts); 566 566 567 Log(("PGMHasMappingConflicts: Conflict was detected at %08RX32 for mapping %s (32 bits)\n" 567 568 " iPDE=%#x iPT=%#x PDE=%RGp.\n", … … 602 603 return false; 603 604 } 605 606 /** 607 * Checks and resolves (ring 3 only) guest conflicts with VMM GC mappings. 608 * 609 * @returns VBox status. 610 * @param pVM The virtual machine. 611 */ 612 VMMDECL(int) PGMMapResolveConflicts(PVM pVM) 613 { 614 /* 615 * Can skip this if mappings are safely fixed. 616 */ 617 if (pVM->pgm.s.fMappingsFixed) 618 return VINF_SUCCESS; 619 620 PGMMODE const enmGuestMode = PGMGetGuestMode(pVM); 621 Assert(enmGuestMode <= PGMMODE_PAE_NX); 622 623 /* 624 * Iterate mappings. 625 */ 626 if (enmGuestMode == PGMMODE_32_BIT) 627 { 628 /* 629 * Resolve the page directory. 630 */ 631 PX86PD pPD = pgmGstGet32bitPDPtr(&pVM->pgm.s); 632 Assert(pPD); 633 634 for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext)) 635 { 636 unsigned iPDE = pCur->GCPtr >> X86_PD_SHIFT; 637 unsigned iPT = pCur->cPTs; 638 while (iPT-- > 0) 639 { 640 if ( pPD->a[iPDE + iPT].n.u1Present /** @todo PGMGstGetPDE. */ 641 && (pVM->fRawR0Enabled || pPD->a[iPDE + iPT].n.u1User)) 642 { 643 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts); 644 645 Log(("PGMHasMappingConflicts: Conflict was detected at %08RX32 for mapping %s (32 bits)\n" 646 " iPDE=%#x iPT=%#x PDE=%RGp.\n", 647 (iPT + iPDE) << X86_PD_SHIFT, pCur->pszDesc, 648 iPDE, iPT, pPD->a[iPDE + iPT].au32[0])); 649 #ifdef IN_RING3 650 int rc = pgmR3SyncPTResolveConflict(pVM, pCur, pPD, iPDE << X86_PD_SHIFT); 651 AssertRCReturn(rc, rc); 652 653 /* 654 * Update pCur. 655 */ 656 pCur = pVM->pgm.s.CTX_SUFF(pMappings); 657 while (pCur && pCur->GCPtr < (iPDE << X86_PD_SHIFT)) 658 pCur = pCur->CTX_SUFF(pNext); 659 break; 660 #else 661 return VINF_PGM_SYNC_CR3; 662 #endif 663 } 664 } 665 if (!pCur) 666 break; 667 } 668 } 669 else if ( enmGuestMode == PGMMODE_PAE 670 || enmGuestMode == PGMMODE_PAE_NX) 671 { 672 for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext)) 673 { 674 RTGCPTR GCPtr = pCur->GCPtr; 675 676 unsigned iPT = pCur->cb >> X86_PD_PAE_SHIFT; 677 while (iPT-- > 0) 678 { 679 X86PDEPAE Pde = pgmGstGetPaePDE(&pVM->pgm.s, GCPtr); 680 681 if ( Pde.n.u1Present 682 && (pVM->fRawR0Enabled || Pde.n.u1User)) 683 { 684 STAM_COUNTER_INC(&pVM->pgm.s.StatR3DetectedConflicts); 685 Log(("PGMHasMappingConflicts: Conflict was detected at %RGv for mapping %s (PAE)\n" 686 " PDE=%016RX64.\n", 687 GCPtr, pCur->pszDesc, Pde.u)); 688 #ifdef IN_RING3 689 int rc = pgmR3SyncPTResolveConflictPAE(pVM, pCur, GCPtr); 690 AssertRCReturn(rc, rc); 691 692 /* 693 * Update pCur. 694 */ 695 pCur = pVM->pgm.s.CTX_SUFF(pMappings); 696 while (pCur && pCur->GCPtr < GCPtr) 697 pCur = pCur->CTX_SUFF(pNext); 698 break; 699 #else 700 return VINF_PGM_SYNC_CR3; 701 #endif 702 } 703 GCPtr += (1 << X86_PD_PAE_SHIFT); 704 } 705 if (!pCur) 706 break; 707 } 708 } 709 else 710 AssertFailed(); 711 712 return VINF_SUCCESS; 713 } 714 #endif /* IN_RING0 */ 715
Note:
See TracChangeset
for help on using the changeset viewer.