Changeset 15348 in vbox
- Timestamp:
- Dec 12, 2008 2:00:10 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r15346 r15348 1817 1817 1818 1818 1819 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 1820 DECLINLINE(void *) pgmPoolMapPageInlined(PVM pVM, PPGMPOOLPAGE pPage); 1821 #endif 1822 1819 1823 /** @def PGMPOOL_PAGE_2_PTR 1820 1824 * Maps a pool page pool into the current context. … … 1824 1828 * @param pPage The pool page. 1825 1829 * 1826 * @remark In HC this uses PGMGCDynMapHCPage(), so it will consume of the1830 * @remark In RC this uses PGMGCDynMapHCPage(), so it will consume of the 1827 1831 * small page window employeed by that function. Be careful. 1828 1832 * @remark There is no need to assert on the result. 1829 1833 */ 1830 1834 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 1831 # define PGMPOOL_PAGE_2_PTR(pVM, pPage) pgmPoolMapPage((pVM), (pPage)) 1835 # define PGMPOOL_PAGE_2_PTR(pVM, pPage) pgmPoolMapPageInlined(&(pVM)->pgm.s, (pPage)) 1836 #elif defined(VBOX_STRICT) 1837 # define PGMPOOL_PAGE_2_PTR(pVM, pPage) pgmPoolMapPageStrict(pPage) 1838 DECLINLINE(void *) pgmPoolMapPageStrict(PPGMPOOLPAGE pPage) 1839 { 1840 Assert(pPage->pvPageR3); 1841 return pPage->pvPageR3; 1842 } 1832 1843 #else 1833 DECLINLINE(R3R0PTRTYPE(void *)) PGMPOOL_PAGE_2_PTR(PVM pVM, PPGMPOOLPAGE pPage) 1834 { 1835 Assert(pPage->pvPageR3); 1836 return pPage->pvPageR3; 1837 } 1838 #endif 1844 # define PGMPOOL_PAGE_2_PTR(pVM, pPage) ((pPage)->pvPageR3) 1845 #endif 1846 1847 /** @def PGMPOOL_PAGE_2_PTR_BY_PGM 1848 * Maps a pool page pool into the current context. 1849 * 1850 * @returns VBox status code. 1851 * @param pPGM Pointer to the PGM instance data. 1852 * @param pPage The pool page. 1853 * 1854 * @remark In RC this uses PGMGCDynMapHCPage(), so it will consume of the 1855 * small page window employeed by that function. Be careful. 1856 * @remark There is no need to assert on the result. 1857 */ 1858 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 1859 # define PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pPage) pgmPoolMapPageInlined((pPGM), (pPage)) 1860 #else 1861 # define PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pPage) PGMPOOL_PAGE_2_PTR(PGM2VM(pPGM), pPage) 1862 #endif 1863 1839 1864 1840 1865 … … 2897 2922 #endif 2898 2923 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 2899 void *pgmPoolMapPage (PVM pVM, PPGMPOOLPAGE pPage);2924 void *pgmPoolMapPageFallback(PPGM pPGM, PPGMPOOLPAGE pPage); 2900 2925 #endif 2901 2926 int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage); … … 4076 4101 { 4077 4102 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 4078 return (PX86PD)PGMPOOL_PAGE_2_PTR (PGM2VM(pPGM), pPGM->CTX_SUFF(pShwPageCR3));4103 return (PX86PD)PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pPGM->CTX_SUFF(pShwPageCR3)); 4079 4104 #else 4080 4105 # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 … … 4139 4164 { 4140 4165 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 4141 return (PX86PDPT)PGMPOOL_PAGE_2_PTR (PGM2VM(pPGM), pPGM->CTX_SUFF(pShwPageCR3));4166 return (PX86PDPT)PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pPGM->CTX_SUFF(pShwPageCR3)); 4142 4167 #else 4143 4168 # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 … … 4171 4196 AssertReturn(pShwPde, NULL); 4172 4197 4173 return (PX86PDPAE)PGMPOOL_PAGE_2_PTR (PGM2VM(pPGM), pShwPde);4198 return (PX86PDPAE)PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pShwPde); 4174 4199 #else 4175 4200 const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE; … … 4236 4261 { 4237 4262 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 4238 return (PX86PML4)PGMPOOL_PAGE_2_PTR (PGM2VM(pPGM), pPGM->CTX_SUFF(pShwPageCR3));4263 return (PX86PML4)PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pPGM->CTX_SUFF(pShwPageCR3)); 4239 4264 #else 4240 4265 # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 … … 4587 4612 #endif /* PGMPOOL_WITH_CACHE */ 4588 4613 4614 4615 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) 4616 /** 4617 * Maps the page into current context (RC and maybe R0). 4618 * 4619 * @returns pointer to the mapping. 4620 * @param pVM Pointer to the PGM instance data. 4621 * @param pPage The page. 4622 */ 4623 DECLINLINE(void *) pgmPoolMapPageInlined(PPGM pPGM, PPGMPOOLPAGE pPage) 4624 { 4625 if (pPage->idx >= PGMPOOL_IDX_FIRST) 4626 { 4627 Assert(pPage->idx < pPGM->CTX_SUFF(pPool)->cCurPages); 4628 void *pv; 4629 # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 4630 int rc = pgmR0DynMapHCPageInlined(pPGM, pPage->Core.Key, &pv); 4631 # else 4632 int rc = PGMDynMapHCPage(PGM2VM(pPGM), pPage->Core.Key, &pv); 4633 # endif 4634 if (RT_SUCCESS(rc)) 4635 return pv; 4636 } 4637 return pgmPoolMapPageFallback(pPGM, pPage); 4638 } 4639 #endif 4640 4641 4589 4642 /** 4590 4643 * Tells if mappings are to be put into the shadow page table or not -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r15344 r15348 92 92 * 93 93 * @returns Pointer to the mapping. 94 * @param p VM The VM handle.94 * @param pPGM Pointer to the PGM instance data. 95 95 * @param pPage The page to map. 96 96 */ 97 void *pgmPoolMapPage(PVM pVM, PPGMPOOLPAGE pPage) 98 { 99 /* general pages. */ 100 if (pPage->idx >= PGMPOOL_IDX_FIRST) 101 { 102 Assert(pPage->idx < pVM->pgm.s.CTX_SUFF(pPool)->cCurPages); 103 void *pv; 104 # ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 105 int rc = pgmR0DynMapHCPageInlined(&pVM->pgm.s, pPage->Core.Key, &pv); 106 # else 107 int rc = PGMDynMapHCPage(pVM, pPage->Core.Key, &pv); 108 # endif 109 AssertReleaseRC(rc); 110 return pv; 111 } 112 97 void *pgmPoolMapPageFallback(PPGM pPGM, PPGMPOOLPAGE pPage) 98 { 99 /* general pages are take care of by the inlined part, it 100 only ends up here in case of failure. */ 101 AssertReleaseReturn(pPage->idx < PGMPOOL_IDX_FIRST, NULL); 102 103 /** @todo make sure HCPhys is valid for *all* indexes. */ 113 104 /* special pages. */ 114 105 # ifdef IN_RC … … 116 107 { 117 108 case PGMPOOL_IDX_PD: 118 return p VM->pgm.s.pShw32BitPdRC;109 return pPGM->pShw32BitPdRC; 119 110 case PGMPOOL_IDX_PAE_PD: 120 111 case PGMPOOL_IDX_PAE_PD_0: 121 return p VM->pgm.s.apShwPaePDsRC[0];112 return pPGM->apShwPaePDsRC[0]; 122 113 case PGMPOOL_IDX_PAE_PD_1: 123 return p VM->pgm.s.apShwPaePDsRC[1];114 return pPGM->apShwPaePDsRC[1]; 124 115 case PGMPOOL_IDX_PAE_PD_2: 125 return p VM->pgm.s.apShwPaePDsRC[2];116 return pPGM->apShwPaePDsRC[2]; 126 117 case PGMPOOL_IDX_PAE_PD_3: 127 return p VM->pgm.s.apShwPaePDsRC[3];118 return pPGM->apShwPaePDsRC[3]; 128 119 case PGMPOOL_IDX_PDPT: 129 return p VM->pgm.s.pShwPaePdptRC;120 return pPGM->pShwPaePdptRC; 130 121 default: 131 122 AssertReleaseMsgFailed(("Invalid index %d\n", pPage->idx)); … … 138 129 { 139 130 case PGMPOOL_IDX_PD: 140 HCPhys = p VM->pgm.s.HCPhysShw32BitPD;131 HCPhys = pPGM->HCPhysShw32BitPD; 141 132 break; 142 133 case PGMPOOL_IDX_PAE_PD_0: 143 HCPhys = p VM->pgm.s.aHCPhysPaePDs[0];134 HCPhys = pPGM->aHCPhysPaePDs[0]; 144 135 break; 145 136 case PGMPOOL_IDX_PAE_PD_1: 146 HCPhys = p VM->pgm.s.aHCPhysPaePDs[1];137 HCPhys = pPGM->aHCPhysPaePDs[1]; 147 138 break; 148 139 case PGMPOOL_IDX_PAE_PD_2: 149 HCPhys = p VM->pgm.s.aHCPhysPaePDs[2];140 HCPhys = pPGM->aHCPhysPaePDs[2]; 150 141 break; 151 142 case PGMPOOL_IDX_PAE_PD_3: 152 HCPhys = p VM->pgm.s.aHCPhysPaePDs[3];143 HCPhys = pPGM->aHCPhysPaePDs[3]; 153 144 break; 154 145 case PGMPOOL_IDX_PDPT: 155 HCPhys = p VM->pgm.s.HCPhysShwPaePdpt;146 HCPhys = pPGM->HCPhysShwPaePdpt; 156 147 break; 157 148 case PGMPOOL_IDX_PAE_PD: … … 163 154 } 164 155 void *pv; 165 int rc = pgmR0DynMapHCPageInlined( &pVM->pgm.s, HCPhys, &pv);166 AssertReleaseRC (rc);156 int rc = pgmR0DynMapHCPageInlined(pPGM, HCPhys, &pv); 157 AssertReleaseRCReturn(rc, NULL); 167 158 return pv; 168 159 # endif /* VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
Note:
See TracChangeset
for help on using the changeset viewer.