Changeset 31870 in vbox
- Timestamp:
- Aug 23, 2010 3:42:59 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 65078
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMGstDefs.h
r31849 r31870 47 47 #undef GST_PDPT_MASK 48 48 #undef GST_PDPE_PG_MASK 49 #undef GST_GET_PTE_GCPHYS 49 50 #undef GST_GET_PDE_GCPHYS 50 51 #undef GST_GET_BIG_PDE_GCPHYS … … 106 107 # endif 107 108 # endif 108 # define GST_GET_PTE_SHW_FLAGS(pVCpu, Pte) (true && This_should_perhaps_not_be_used_in_this_context) //?? 109 # define GST_GET_PTE_GCPHYS(Pte) ((Pte).u & GST_PTE_PG_MASK) 110 # define GST_GET_PDE_GCPHYS(Pde) (true && This_should_perhaps_not_be_used_in_this_context) //?? 111 # define GST_GET_BIG_PDE_GCPHYS(Pde) (true && This_should_perhaps_not_be_used_in_this_context) //?? 112 # define GST_GET_PTE_SHW_FLAGS(pVCpu, Pte) ((Pte).u & (X86_PTE_P | X86_PTE_RW | X86_PTE_US | X86_PTE_A | X86_PTE_D | X86_PTE_G)) /**< @todo Could return P|RW|US|A|D here without consulting the PTE. */ 109 113 # define GST_GET_PDE_SHW_FLAGS(pVCpu, Pde) (true && This_should_perhaps_not_be_used_in_this_context) //?? 110 114 # define GST_GET_BIG_PDE_SHW_FLAGS(pVCpu, Pde) (true && This_should_perhaps_not_be_used_in_this_context) //?? … … 134 138 # define GST_PDE_PG_MASK X86_PDE_PG_MASK 135 139 # define GST_PDE_BIG_PG_MASK X86_PDE4M_PG_MASK 140 # define GST_GET_PTE_GCPHYS(Pte) ((Pte).u & GST_PDE_PG_MASK) 136 141 # define GST_GET_PDE_GCPHYS(Pde) ((Pde).u & GST_PDE_PG_MASK) 137 142 # define GST_GET_BIG_PDE_GCPHYS(pVM, Pde) pgmGstGet4MBPhysPage(&(pVM)->pgm.s, Pde) … … 173 178 # define GST_PDE_PG_MASK X86_PDE_PAE_PG_MASK_FULL 174 179 # define GST_PDE_BIG_PG_MASK X86_PDE2M_PAE_PG_MASK 175 # define GST_GET_PDE_GCPHYS(Pde) ((Pde).u & X86_PDE_PAE_PG_MASK_FULL) 180 # define GST_GET_PTE_GCPHYS(Pte) ((Pte).u & GST_PTE_PG_MASK) 181 # define GST_GET_PDE_GCPHYS(Pde) ((Pde).u & GST_PDE_PG_MASK) 176 182 # define GST_GET_BIG_PDE_GCPHYS(pVM, Pde) ((Pde).u & GST_PDE_BIG_PG_MASK) 177 183 # define GST_GET_PTE_SHW_FLAGS(pVCpu, Pte) ((Pte).u & (pVCpu)->pgm.s.fGst64ShadowedPteMask ) -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r31849 r31870 405 405 PVM pVM = pVCpu->CTX_SUFF(pVM); 406 406 407 Log(("PGMTrap0eHandler: uErr=%RGx pvFault=%RGv eip=%04x:%RGv \n", uErr, pvFault, pRegFrame->cs, (RTGCPTR)pRegFrame->rip));407 Log(("PGMTrap0eHandler: uErr=%RGx pvFault=%RGv eip=%04x:%RGv cr3=%RGp\n", uErr, pvFault, pRegFrame->cs, (RTGCPTR)pRegFrame->rip, (RTGCPHYS)CPUMGetGuestCR3(pVCpu))); 408 408 STAM_PROFILE_START(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0e, a); 409 409 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = NULL; } ); … … 1191 1191 1192 1192 *ppPD = (PX86PDPAE)PGMPOOL_PAGE_2_PTR_V2(pVM, pVCpu, pShwPage); 1193 Log4(("pgmShwGetLongModePDPtr %RGv -> *ppPD=%p PDE=%p/%RX64\n", GCPtr, *ppPD, &(*ppPD)->a[(GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK], (*ppPD)->a[(GCPtr >> X86_PD_PAE_SHIFT) & X86_PD_PAE_MASK].u)); 1193 1194 return VINF_SUCCESS; 1194 1195 } -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r31851 r31870 1479 1479 * @param pVM The VM handle. 1480 1480 * @param pPage The page in question. 1481 * @param fPteSrc The flags of the source PTE. 1481 * @param fPteSrc The shadowed flags of the source PTE. Must include the 1482 * A (accessed) bit so it can be emulated correctly. 1482 1483 * @param pPteDst The shadow PTE (output). This is temporary storage and 1483 1484 * does not need to be set atomically. 1484 1485 */ 1485 DECLINLINE(void) PGM_BTH_NAME(SyncHandlerPte)(PVM pVM, PCPGMPAGE pPage, uint 32_t fPteSrc, PSHWPTE pPteDst)1486 DECLINLINE(void) PGM_BTH_NAME(SyncHandlerPte)(PVM pVM, PCPGMPAGE pPage, uint64_t fPteSrc, PSHWPTE pPteDst) 1486 1487 { 1487 1488 /** @todo r=bird: Are we actually handling dirty and access bits for pages with access handlers correctly? No. … … 1498 1499 /* PteDst.n.u1Write = 0 && PteDst.n.u1Size = 0 */ 1499 1500 #else 1500 SHW_PTE_SET(*pPteDst, 1501 (fPteSrc & ~(X86_PTE_PAE_PG_MASK | X86_PTE_AVL_MASK | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT | X86_PTE_RW)) 1502 | PGM_PAGE_GET_HCPHYS(pPage)); 1501 if (fPteSrc & X86_PTE_A) 1502 { 1503 SHW_PTE_SET(*pPteDst, fPteSrc | PGM_PAGE_GET_HCPHYS(pPage)); 1504 SHW_PTE_SET_RO(*pPteDst); 1505 } 1506 else 1507 SHW_PTE_SET(*pPteDst, 0); 1503 1508 #endif 1504 1509 } … … 1580 1585 */ 1581 1586 PPGMPAGE pPage; 1582 int rc = pgmPhysGetPageEx(&pVM->pgm.s, PteSrc.u & GST_PTE_PG_MASK, &pPage);1587 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GST_GET_PTE_GCPHYS(PteSrc), &pPage); 1583 1588 if (RT_SUCCESS(rc)) 1584 1589 { … … 1608 1613 ) 1609 1614 { 1610 rc = pgmPhysPageMakeWritable(pVM, pPage, PteSrc.u & GST_PTE_PG_MASK);1615 rc = pgmPhysPageMakeWritable(pVM, pPage, GST_GET_PTE_GCPHYS(PteSrc)); 1611 1616 AssertRC(rc); 1612 1617 } … … 1618 1623 SHWPTE PteDst; 1619 1624 if (PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)) 1620 PGM_BTH_NAME(SyncHandlerPte)(pVM, pPage, 1621 PteSrc.u & ~( X86_PTE_PAE_PG_MASK | X86_PTE_AVL_MASK 1622 | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT), 1623 &PteDst); 1625 PGM_BTH_NAME(SyncHandlerPte)(pVM, pPage, GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc), &PteDst); 1624 1626 else 1625 1627 { … … 1643 1645 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,DirtyPage)); 1644 1646 SHW_PTE_SET(PteDst, 1645 (PteSrc.u & ~(X86_PTE_PAE_PG_MASK | X86_PTE_AVL_MASK | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT | X86_PTE_RW))1647 GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc) 1646 1648 | PGM_PAGE_GET_HCPHYS(pPage) 1647 1649 | PGM_PTFLAGS_TRACK_DIRTY); 1650 SHW_PTE_SET_RO(PteDst); 1648 1651 } 1649 1652 else … … 1660 1663 /* PteDst.n.u1Size = 0 */ 1661 1664 #else 1662 SHW_PTE_SET(PteDst, 1663 (PteSrc.u & ~(X86_PTE_PAE_PG_MASK | X86_PTE_AVL_MASK | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT)) 1664 | PGM_PAGE_GET_HCPHYS(pPage)); 1665 SHW_PTE_SET(PteDst, GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc) | PGM_PAGE_GET_HCPHYS(pPage)); 1665 1666 #endif 1666 1667 } … … 1675 1676 Assert(!PGM_PAGE_IS_ZERO(pPage)); 1676 1677 SHW_PTE_SET_RO(PteDst); /** @todo this isn't quite working yet. Why, isn't it? */ 1677 Log3(("SyncPageWorker: write-protecting %RGp pPage=%R[pgmpage]at iPTDst=%d\n", (RTGCPHYS) (PteSrc.u & X86_PTE_PAE_PG_MASK), pPage, iPTDst));1678 Log3(("SyncPageWorker: write-protecting %RGp pPage=%R[pgmpage]at iPTDst=%d\n", (RTGCPHYS)GST_GET_PTE_GCPHYS(PteSrc), pPage, iPTDst)); 1678 1679 } 1679 1680 } … … 1925 1926 GCPtrCurPage, PteSrc.n.u1Present, 1926 1927 PteSrc.n.u1Write & PdeSrc.n.u1Write, 1927 PteSrc.n.u1User & PdeSrc.n.u1User,1928 PteSrc.n.u1User & PdeSrc.n.u1User, 1928 1929 (uint64_t)PteSrc.u, 1929 1930 SHW_PTE_LOG64(pPTDst->a[iPTDst]), … … 1942 1943 GCPtrPage, PteSrc.n.u1Present, 1943 1944 PteSrc.n.u1Write & PdeSrc.n.u1Write, 1944 PteSrc.n.u1User & PdeSrc.n.u1User,1945 PteSrc.n.u1User & PdeSrc.n.u1User, 1945 1946 (uint64_t)PteSrc.u, 1946 1947 SHW_PTE_LOG64(pPTDst->a[iPTDst]), … … 2181 2182 GCPtrCurPage, PteSrc.n.u1Present, 2182 2183 PteSrc.n.u1Write & PdeSrc.n.u1Write, 2183 PteSrc.n.u1User & PdeSrc.n.u1User,2184 PteSrc.n.u1User & PdeSrc.n.u1User, 2184 2185 (uint64_t)PteSrc.u, 2185 2186 SHW_PTE_LOG64(pPTDst->a[iPTDst]), … … 2212 2213 GCPtrPage, PteSrc.n.u1Present, 2213 2214 PteSrc.n.u1Write & PdeSrc.n.u1Write, 2214 PteSrc.n.u1User & PdeSrc.n.u1User,2215 PteSrc.n.u1User & PdeSrc.n.u1User, 2215 2216 (uint64_t)PteSrc.u, 2216 2217 SHW_PTE_LOG64(pPTDst->a[iPTDst]), … … 2399 2400 if (SHW_PTE_IS_TRACK_DIRTY(*pPteDst)) 2400 2401 { 2401 PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, pPteSrc->u & GST_PTE_PG_MASK);2402 PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, GST_GET_PTE_GCPHYS(*pPteSrc)); 2402 2403 SHWPTE PteDst = *pPteDst; 2403 2404 … … 2425 2426 && PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM) 2426 2427 { 2427 rc = pgmPhysPageMakeWritable(pVM, pPage, pPteSrc->u & GST_PTE_PG_MASK);2428 rc = pgmPhysPageMakeWritable(pVM, pPage, GST_GET_PTE_GCPHYS(*pPteSrc)); 2428 2429 AssertRC(rc); 2429 2430 } … … 2749 2750 const unsigned iPTDstEnd = RT_ELEMENTS(pPTDst->a); 2750 2751 # endif /* !PGM_SYNC_N_PAGES */ 2752 RTGCPTR GCPtrCur = (GCPtrPage & ~(RTGCPTR)((1 << SHW_PD_SHIFT) - 1)) 2753 | ((RTGCPTR)iPTDst << PAGE_SHIFT); 2751 2754 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 2752 2755 /* Select the right PDE as we're emulating a 4kb page table with 2 shadow page tables. */ … … 2755 2758 const unsigned offPTSrc = 0; 2756 2759 # endif 2757 for (; iPTDst < iPTDstEnd; iPTDst++ )2760 for (; iPTDst < iPTDstEnd; iPTDst++, GCPtrCur += PAGE_SIZE) 2758 2761 { 2759 2762 const unsigned iPTSrc = iPTDst + offPTSrc; … … 2770 2773 PPGMPAGE pPage; 2771 2774 if ( ((PdeSrc.u & pPTSrc->a[iPTSrc].u) & (X86_PTE_RW | X86_PTE_US)) 2772 || !CSAMDoesPageNeedScanning(pVM, (iPDSrc << GST_PD_SHIFT) | (iPTSrc << PAGE_SHIFT))2773 || ( (pPage = pgmPhysGetPage(&pVM->pgm.s, PteSrc.u & GST_PTE_PG_MASK))2775 || !CSAMDoesPageNeedScanning(pVM, GCPtrCur) 2776 || ( (pPage = pgmPhysGetPage(&pVM->pgm.s, GST_GET_PTE_GCPHYS(PteSrc))) 2774 2777 && PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)) 2775 2778 ) … … 2777 2780 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst); 2778 2781 Log2(("SyncPT: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx}%s dst.raw=%08llx iPTSrc=%x PdeSrc.u=%x physpte=%RGp\n", 2779 (RTGCPTR)(((RTGCPTR)iPDSrc << GST_PD_SHIFT) | ((RTGCPTR)iPTSrc << PAGE_SHIFT)),2782 GCPtrCur, 2780 2783 PteSrc.n.u1Present, 2781 2784 PteSrc.n.u1Write & PdeSrc.n.u1Write, 2782 PteSrc.n.u1User & PdeSrc.n.u1User,2785 PteSrc.n.u1User & PdeSrc.n.u1User, 2783 2786 (uint64_t)PteSrc.u, 2784 2787 SHW_PTE_IS_TRACK_DIRTY(pPTDst->a[iPTDst]) ? " Track-Dirty" : "", SHW_PTE_LOG64(pPTDst->a[iPTDst]), iPTSrc, PdeSrc.au32[0], … … 3987 3990 /* match the physical addresses */ 3988 3991 HCPhysShw = SHW_PTE_GET_HCPHYS(PteDst); 3989 GCPhysGst = PteSrc.u & GST_PTE_PG_MASK;3992 GCPhysGst = GST_GET_PTE_GCPHYS(PteSrc); 3990 3993 3991 3994 # ifdef IN_RING3 -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r31851 r31870 174 174 void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, unsigned cbWrite) 175 175 { 176 AssertMsg(pPage->iMonitoredPrev == NIL_PGMPOOL_IDX, ("% #x (idx=%#x)\n", pPage->iMonitoredPrev, pPage->idx));176 AssertMsg(pPage->iMonitoredPrev == NIL_PGMPOOL_IDX, ("%u (idx=%u)\n", pPage->iMonitoredPrev, pPage->idx)); 177 177 const unsigned off = GCPhysFault & PAGE_OFFSET_MASK; 178 178 PVM pVM = pPool->CTX_SUFF(pVM); … … 1803 1803 if (i == NIL_PGMPOOL_IDX) 1804 1804 { 1805 AssertReleaseMsgFailed(("GCPhys=%RGp idx=% #x\n", pPage->GCPhys, pPage->idx));1805 AssertReleaseMsgFailed(("GCPhys=%RGp idx=%d\n", pPage->GCPhys, pPage->idx)); 1806 1806 break; 1807 1807 } … … 2006 2006 */ 2007 2007 unsigned i = pPool->aiHash[PGMPOOL_HASH(GCPhys)]; 2008 Log3(("pgmPoolCacheAlloc: %RGp kind %s iUser=% xiUserTable=%x SLOT=%d\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable, i));2008 Log3(("pgmPoolCacheAlloc: %RGp kind %s iUser=%d iUserTable=%x SLOT=%d\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable, i)); 2009 2009 if (i != NIL_PGMPOOL_IDX) 2010 2010 { … … 2624 2624 PPGMPOOLUSER paUsers = pPool->CTX_SUFF(paUsers); 2625 2625 2626 LogFlow(("pgmPoolTrackInsert GCPhys=%RGp iUser %x iUserTable%x\n", GCPhys, iUser, iUserTable));2626 LogFlow(("pgmPoolTrackInsert GCPhys=%RGp iUser=%d iUserTable=%x\n", GCPhys, iUser, iUserTable)); 2627 2627 2628 2628 #ifdef VBOX_STRICT … … 2813 2813 2814 2814 /* Fatal: didn't find it */ 2815 AssertFatalMsgFailed(("Didn't find the user entry! iUser=% #xiUserTable=%#x GCPhys=%RGp\n",2815 AssertFatalMsgFailed(("Didn't find the user entry! iUser=%d iUserTable=%#x GCPhys=%RGp\n", 2816 2816 iUser, iUserTable, pPage->GCPhys)); 2817 2817 } … … 3651 3651 3652 3652 default: 3653 AssertFatalMsgFailed(("enmKind=%d iUser=% #xiUserTable=%#x\n", pUserPage->enmKind, pUser->iUser, pUser->iUserTable));3653 AssertFatalMsgFailed(("enmKind=%d iUser=%d iUserTable=%#x\n", pUserPage->enmKind, pUser->iUser, pUser->iUserTable)); 3654 3654 } 3655 3655 PGM_DYNMAP_UNUSED_HINT_VM(pPool->CTX_SUFF(pVM), u.pau64); … … 4678 4678 4679 4679 STAM_PROFILE_START(&pPool->StatFree, a); 4680 LogFlow(("pgmPoolFreeByPage: pPage=%p:{.Key=%RHp, .idx=%d, enmKind=%s} iUser=% #xiUserTable=%#x\n",4680 LogFlow(("pgmPoolFreeByPage: pPage=%p:{.Key=%RHp, .idx=%d, enmKind=%s} iUser=%d iUserTable=%#x\n", 4681 4681 pPage, pPage->Core.Key, pPage->idx, pgmPoolPoolKindToStr(pPage->enmKind), iUser, iUserTable)); 4682 4682 Assert(pPage->idx >= PGMPOOL_IDX_FIRST); … … 4705 4705 PVM pVM = pPool->CTX_SUFF(pVM); 4706 4706 4707 LogFlow(("pgmPoolMakeMoreFreePages: iUser=% #x\n", iUser));4707 LogFlow(("pgmPoolMakeMoreFreePages: iUser=%d\n", iUser)); 4708 4708 4709 4709 /* … … 4763 4763 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 4764 4764 STAM_PROFILE_ADV_START(&pPool->StatAlloc, a); 4765 LogFlow(("pgmPoolAlloc : GCPhys=%RGp enmKind=%s iUser=%#xiUserTable=%#x\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable));4765 LogFlow(("pgmPoolAllocEx: GCPhys=%RGp enmKind=%s iUser=%d iUserTable=%#x\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable)); 4766 4766 *ppPage = NULL; 4767 4767 /** @todo CSAM/PGMPrefetchPage messes up here during CSAMR3CheckGates … … 4780 4780 pgmUnlock(pVM); 4781 4781 STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a); 4782 LogFlow(("pgmPoolAlloc : cached returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d}\n", rc2, *ppPage, (*ppPage)->Core.Key, (*ppPage)->idx));4782 LogFlow(("pgmPoolAllocEx: cached returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d}\n", rc2, *ppPage, (*ppPage)->Core.Key, (*ppPage)->idx)); 4783 4783 return rc2; 4784 4784 } … … 4796 4796 { 4797 4797 pgmUnlock(pVM); 4798 Log(("pgmPoolAlloc : returns %Rrc (Free)\n", rc));4798 Log(("pgmPoolAllocEx: returns %Rrc (Free)\n", rc)); 4799 4799 STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a); 4800 4800 return rc; … … 4847 4847 pgmUnlock(pVM); 4848 4848 STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a); 4849 Log(("pgmPoolAlloc : returns %Rrc (Insert)\n", rc3));4849 Log(("pgmPoolAllocEx: returns %Rrc (Insert)\n", rc3)); 4850 4850 return rc3; 4851 4851 } … … 4871 4871 pgmPoolLockPage(pPool, pPage); 4872 4872 pgmUnlock(pVM); 4873 LogFlow(("pgmPoolAlloc : returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d, .fCached=%RTbool, .fMonitored=%RTbool}\n",4873 LogFlow(("pgmPoolAllocEx: returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d, .fCached=%RTbool, .fMonitored=%RTbool}\n", 4874 4874 rc, pPage, pPage->Core.Key, pPage->idx, pPage->fCached, pPage->fMonitored)); 4875 4875 STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a); … … 4888 4888 void pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint32_t iUserTable) 4889 4889 { 4890 LogFlow(("pgmPoolFree: HCPhys=%RHp iUser=% #xiUserTable=%#x\n", HCPhys, iUser, iUserTable));4890 LogFlow(("pgmPoolFree: HCPhys=%RHp iUser=%d iUserTable=%#x\n", HCPhys, iUser, iUserTable)); 4891 4891 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 4892 4892 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, HCPhys), iUser, iUserTable);
Note:
See TracChangeset
for help on using the changeset viewer.