Changeset 29217 in vbox
- Timestamp:
- May 7, 2010 2:38:51 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r28800 r29217 1438 1438 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES 1439 1439 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_WRITE_MONITORED 1440 # endif 1441 # ifdef VBOX_WITH_PAGE_SHARING 1442 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_SHARED 1440 1443 # endif 1441 1444 ) … … 1834 1837 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_WRITE_MONITORED 1835 1838 # endif 1839 # ifdef VBOX_WITH_PAGE_SHARING 1840 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_SHARED 1841 # endif 1836 1842 ) 1837 1843 ) … … 2867 2873 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES 2868 2874 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_WRITE_MONITORED 2875 # endif 2876 # ifdef VBOX_WITH_PAGE_SHARING 2877 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_SHARED 2869 2878 # endif 2870 2879 && !PGM_PAGE_IS_BALLOONED(pPage)) -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r28800 r29217 434 434 pVM->pgm.s.aHandyPages[iHandyPage].HCPhysGCPhys = GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK; 435 435 436 const void *pvSharedPage = NULL; 437 436 438 if (PGM_PAGE_IS_SHARED(pPage)) 437 439 { … … 440 442 VM_FF_SET(pVM, VM_FF_PGM_NEED_HANDY_PAGES); 441 443 442 Log 2(("PGM: Replaced shared page %#x at %RGp with %#x / %RHp\n", PGM_PAGE_GET_PAGEID(pPage),443 444 Log(("PGM: Replaced shared page %#x at %RGp with %#x / %RHp\n", PGM_PAGE_GET_PAGEID(pPage), 445 GCPhys, pVM->pgm.s.aHandyPages[iHandyPage].idPage, HCPhys)); 444 446 STAM_COUNTER_INC(&pVM->pgm.s.CTX_MID_Z(Stat,PageReplaceShared)); 445 447 pVM->pgm.s.cSharedPages--; 446 AssertMsgFailed(("TODO: copy shared page content")); /** @todo err.. what about copying the page content? */ 448 449 /* Grab the address of the page so we can make a copy later on. */ 450 rc = pgmPhysGCPhys2CCPtrInternalReadOnly(pVM, pPage, GCPhys, &pvSharedPage); 451 AssertRC(rc); 447 452 } 448 453 else … … 463 468 PGM_PAGE_SET_PDE_TYPE(pPage, PGM_PAGE_PDE_TYPE_PT); 464 469 PGMPhysInvalidatePageMapTLBEntry(pVM, GCPhys); 470 471 /* Copy the shared page contents to the replacement page. */ 472 if (pvSharedPage) 473 { 474 void *pvNewPage; 475 476 /* Get the virtual address of the new page. */ 477 rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, &pvNewPage); 478 AssertRC(rc); 479 if (rc == VINF_SUCCESS) 480 { 481 /** todo write ASMMemCopy */ 482 memcpy(pvNewPage, pvSharedPage, PAGE_SIZE); 483 } 484 } 465 485 466 486 if ( fFlushTLBs -
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r29209 r29217 2620 2620 } 2621 2621 2622 /** 2623 * Converts a private page to a shared page, the page is known to exist and be valid and such. 2624 * 2625 * @param pGMM Pointer to the GMM instance. 2626 * @param pGVM Pointer to the GVM instance. 2627 * @param idPage The Page ID 2628 * @param pPage The page structure. 2629 */ 2630 DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, uint32_t idPage, PGMMPAGE pPage) 2631 { 2632 PGMMCHUNK pChunk = gmmR0GetChunk(pGMM, idPage >> GMM_CHUNKID_SHIFT); 2633 Assert(pChunk); 2634 Assert(pChunk->cFree < GMM_CHUNK_NUM_PAGES); 2635 Assert(GMM_PAGE_IS_PRIVATE(pPage)); 2636 2637 pChunk->cPrivate--; 2638 pChunk->cShared++; 2639 2640 pGMM->cSharedPages++; 2641 2642 pGVM->gmm.s.cSharedPages++; 2643 pGVM->gmm.s.cPrivatePages--; 2644 2645 /* Modify the page structure. */ 2646 pPage->Shared.pfn = pPage->Private.pfn; /* same location */ 2647 pPage->Shared.cRefs = 1; 2648 pPage->Common.u2State = GMM_PAGE_STATE_SHARED; 2649 } 2650 2651 /** 2652 * Increase the use count of a shared page, the page is known to exist and be valid and such. 2653 * 2654 * @param pGMM Pointer to the GMM instance. 2655 * @param pGVM Pointer to the GVM instance. 2656 * @param pPage The page structure. 2657 */ 2658 DECLINLINE(void) gmmR0UseSharedPage(PGMM pGMM, PGVM pGVM, PGMMPAGE pPage) 2659 { 2660 Assert(pGMM->cSharedPages > 0); 2661 Assert(pGMM->cAllocatedPages > 0); 2662 2663 pPage->Shared.cRefs++; 2664 pGVM->gmm.s.cSharedPages++; 2665 } 2622 2666 2623 2667 /** … … 2640 2684 gmmR0FreePageWorker(pGMM, pChunk, idPage, pPage); 2641 2685 } 2642 2643 2686 2644 2687 /** … … 3739 3782 3740 3783 Assert(paPageDesc[i].HCPhys == (pPage->Private.pfn << 12)); 3741 pPage->Shared.pfn = pPage->Private.pfn; /* same location */ 3742 pPage->Shared.cRefs = 1; 3743 pPage->Common.u2State = GMM_PAGE_STATE_SHARED; 3784 3785 gmmR0ConvertToSharedPage(pGMM, pGVM, paPageDesc[i].uHCPhysPageId, pPage); 3744 3786 3745 3787 /* Keep track of these references. */ … … 3815 3857 AssertRC(rc); 3816 3858 3817 /* Increase reference count. */ 3818 pPage->Shared.cRefs++; 3859 gmmR0UseSharedPage(pGMM, pGVM, pPage); 3819 3860 3820 3861 /* Pass along the new physical address & page id. */ -
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r29209 r29217 422 422 PGM_PAGE_SET_HCPHYS(pPage, paPageDesc[i].HCPhys); 423 423 PGM_PAGE_SET_PAGEID(pPage, paPageDesc[i].uHCPhysPageId); 424 425 /* Invalidate page map TLB entry for this page too. */ 426 PGMPhysInvalidatePageMapTLBEntry(pVM, paPageDesc[i].GCPhys); 424 427 } 425 428 /* else nothing changed (== this page is now a shared page), so no need to flush anything. */
Note:
See TracChangeset
for help on using the changeset viewer.