Changeset 32785 in vbox for trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
- Timestamp:
- Sep 28, 2010 9:38:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r32778 r32785 37 37 static int PGM_BTH_NAME(CheckDirtyPageFault)(PVMCPU pVCpu, uint32_t uErr, PSHWPDE pPdeDst, GSTPDE const *pPdeSrc, RTGCPTR GCPtrPage); 38 38 static int PGM_BTH_NAME(SyncPT)(PVMCPU pVCpu, unsigned iPD, PGSTPD pPDSrc, RTGCPTR GCPtrPage); 39 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 39 40 static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, GSTPDE PdeSrc, GSTPTE PteSrc, PPGMPOOLPAGE pShwPage, unsigned iPTDst); 41 #else 42 static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, RTGCPHYS GCPhysPage, PPGMPOOLPAGE pShwPage, unsigned iPTDst); 43 #endif 40 44 PGM_BTH_DECL(int, VerifyAccessSyncPage)(PVMCPU pVCpu, RTGCPTR Addr, unsigned fPage, unsigned uErr); 41 45 PGM_BTH_DECL(int, PrefetchPage)(PVMCPU pVCpu, RTGCPTR GCPtrPage); … … 1581 1585 * @remark Not used for 2/4MB pages! 1582 1586 */ 1587 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1583 1588 static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, GSTPDE PdeSrc, GSTPTE PteSrc, 1584 1589 PPGMPOOLPAGE pShwPage, unsigned iPTDst) 1590 #else 1591 static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, RTGCPHYS GCPhysPage, PPGMPOOLPAGE pShwPage, unsigned iPTDst) 1592 #endif 1585 1593 { 1586 1594 PVM pVM = pVCpu->CTX_SUFF(pVM); … … 1604 1612 #endif 1605 1613 1614 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1606 1615 if ( PteSrc.n.u1Present 1607 1616 && GST_IS_PTE_VALID(pVCpu, PteSrc)) 1608 { 1617 #endif 1618 { 1619 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1620 RTGCPHYS GCPhysPage = GST_GET_PTE_GCPHYS(PteSrc); 1621 # endif 1609 1622 /* 1610 1623 * Find the ram range. 1611 1624 */ 1612 1625 PPGMPAGE pPage; 1613 int rc = pgmPhysGetPageEx(&pVM->pgm.s, G ST_GET_PTE_GCPHYS(PteSrc), &pPage);1626 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPhysPage, &pPage); 1614 1627 if (RT_SUCCESS(rc)) 1615 1628 { … … 1627 1640 if ( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM 1628 1641 && ( PGM_PAGE_IS_ZERO(pPage) 1642 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1629 1643 || ( PteSrc.n.u1Write 1644 # else 1645 || ( 1 1646 # endif 1630 1647 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED 1631 1648 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES … … 1639 1656 ) 1640 1657 { 1641 rc = pgmPhysPageMakeWritable(pVM, pPage, G ST_GET_PTE_GCPHYS(PteSrc));1658 rc = pgmPhysPageMakeWritable(pVM, pPage, GCPhysPage); 1642 1659 AssertRC(rc); 1643 1660 } … … 1648 1665 */ 1649 1666 SHWPTE PteDst; 1667 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1668 uint64_t fGstShwPteFlags = GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc); 1669 # else 1670 uint64_t fGstShwPteFlags = X86_PTE_P | X86_PTE_RW | X86_PTE_US | X86_PTE_A | X86_PTE_D; 1671 # endif 1650 1672 if (PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)) 1651 PGM_BTH_NAME(SyncHandlerPte)(pVM, pPage, GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc), &PteDst);1673 PGM_BTH_NAME(SyncHandlerPte)(pVM, pPage, fGstShwPteFlags, &PteDst); 1652 1674 else 1653 1675 { … … 1671 1693 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,DirtyPage)); 1672 1694 SHW_PTE_SET(PteDst, 1673 GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc)1695 fGstShwPteFlags 1674 1696 | PGM_PAGE_GET_HCPHYS(pPage) 1675 1697 | PGM_PTFLAGS_TRACK_DIRTY); … … 1689 1711 /* PteDst.n.u1Size = 0 */ 1690 1712 #else 1691 SHW_PTE_SET(PteDst, GST_GET_PTE_SHW_FLAGS(pVCpu, PteSrc)| PGM_PAGE_GET_HCPHYS(pPage));1713 SHW_PTE_SET(PteDst, fGstShwPteFlags | PGM_PAGE_GET_HCPHYS(pPage)); 1692 1714 #endif 1693 1715 } … … 1702 1724 Assert(!PGM_PAGE_IS_ZERO(pPage)); 1703 1725 SHW_PTE_SET_RO(PteDst); /** @todo this isn't quite working yet. Why, isn't it? */ 1704 Log3(("SyncPageWorker: write-protecting %RGp pPage=%R[pgmpage]at iPTDst=%d\n", (RTGCPHYS)GST_GET_PTE_GCPHYS(PteSrc), pPage, iPTDst));1726 Log3(("SyncPageWorker: write-protecting %RGp pPage=%R[pgmpage]at iPTDst=%d\n", GCPhysPage, pPage, iPTDst)); 1705 1727 } 1706 1728 } … … 1740 1762 Log2(("SyncPageWorker: invalid address in Pte\n")); 1741 1763 } 1764 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1742 1765 else if (!PteSrc.n.u1Present) 1743 1766 Log2(("SyncPageWorker: page not present in Pte\n")); 1744 1767 else 1745 1768 Log2(("SyncPageWorker: invalid Pte\n")); 1769 #endif 1746 1770 1747 1771 /* … … 2208 2232 { 2209 2233 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT); 2210 GSTPTE PteSrc; 2211 2212 /* Fake the page table entry */ 2213 PteSrc.u = GCPtrCurPage; 2214 PteSrc.n.u1Present = 1; 2215 PteSrc.n.u1Dirty = 1; 2216 PteSrc.n.u1Accessed = 1; 2217 PteSrc.n.u1Write = 1; 2218 PteSrc.n.u1User = 1; 2219 2220 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst); 2221 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx} PteDst=%08llx%s\n", 2222 GCPtrCurPage, PteSrc.n.u1Present, 2223 PteSrc.n.u1Write & PdeSrc.n.u1Write, 2224 PteSrc.n.u1User & PdeSrc.n.u1User, 2225 (uint64_t)PteSrc.u, 2234 2235 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], GCPtrCurPage, pShwPage, iPTDst); 2236 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=1 RW=1 U=1} PteDst=%08llx%s\n", 2237 GCPtrCurPage, 2226 2238 SHW_PTE_LOG64(pPTDst->a[iPTDst]), 2227 2239 SHW_PTE_IS_TRACK_DIRTY(pPTDst->a[iPTDst]) ? " Track-Dirty" : "")); … … 2239 2251 const unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK; 2240 2252 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT); 2241 GSTPTE PteSrc; 2242 2243 /* Fake the page table entry */ 2244 PteSrc.u = GCPtrCurPage; 2245 PteSrc.n.u1Present = 1; 2246 PteSrc.n.u1Dirty = 1; 2247 PteSrc.n.u1Accessed = 1; 2248 PteSrc.n.u1Write = 1; 2249 PteSrc.n.u1User = 1; 2250 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst); 2251 2252 Log2(("SyncPage: 4K %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx}PteDst=%08llx%s\n", 2253 GCPtrPage, PteSrc.n.u1Present, 2254 PteSrc.n.u1Write & PdeSrc.n.u1Write, 2255 PteSrc.n.u1User & PdeSrc.n.u1User, 2256 (uint64_t)PteSrc.u, 2253 2254 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], GCPtrCurPage, pShwPage, iPTDst); 2255 2256 Log2(("SyncPage: 4K %RGv PteSrc:{P=1 RW=1 U=1}PteDst=%08llx%s\n", 2257 GCPtrPage, 2257 2258 SHW_PTE_LOG64(pPTDst->a[iPTDst]), 2258 2259 SHW_PTE_IS_TRACK_DIRTY(pPTDst->a[iPTDst]) ? " Track-Dirty" : "")); … … 3134 3135 # endif /* HC_ARCH_BITS == 64 */ 3135 3136 3136 GSTPDE PdeSrc;3137 PdeSrc.u = 0; /* faked so we don't have to #ifdef everything */3138 PdeSrc.n.u1Present = 1;3139 PdeSrc.n.u1Write = 1;3140 PdeSrc.n.u1Accessed = 1;3141 PdeSrc.n.u1User = 1;3142 3143 3137 /* 3144 3138 * Allocate & map the page table. … … 3169 3163 { 3170 3164 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT); 3171 GSTPTE PteSrc; 3172 3173 /* Fake the page table entry */ 3174 PteSrc.u = GCPtrCurPage; 3175 PteSrc.n.u1Present = 1; 3176 PteSrc.n.u1Dirty = 1; 3177 PteSrc.n.u1Accessed = 1; 3178 PteSrc.n.u1Write = 1; 3179 PteSrc.n.u1User = 1; 3180 3181 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst); 3182 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx} PteDst=%08llx%s\n", 3183 GCPtrCurPage, PteSrc.n.u1Present, 3184 PteSrc.n.u1Write & PdeSrc.n.u1Write, 3185 PteSrc.n.u1User & PdeSrc.n.u1User, 3186 (uint64_t)PteSrc.u, 3165 3166 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], GCPtrCurPage, pShwPage, iPTDst); 3167 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=1 RW=1 U=1} PteDst=%08llx%s\n", 3168 GCPtrCurPage, 3187 3169 SHW_PTE_LOG64(pPTDst->a[iPTDst]), 3188 3170 SHW_PTE_IS_TRACK_DIRTY(pPTDst->a[iPTDst]) ? " Track-Dirty" : "")); … … 3208 3190 3209 3191 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,SyncPT), a); 3192 if (RT_FAILURE(rc)) 3193 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,SyncPTFailed)); 3210 3194 return rc; 3211 3195
Note:
See TracChangeset
for help on using the changeset viewer.