Changeset 9690 in vbox
- Timestamp:
- Jun 13, 2008 3:51:14 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r9596 r9690 1279 1279 /** The extended PAE page directory (2048 entries, works as root currently). */ 1280 1280 #define PGMPOOL_IDX_PAE_PD 2 1281 1281 /** PAE Page Directory Table 0. */ 1282 1282 #define PGMPOOL_IDX_PAE_PD_0 3 1283 1283 /** PAE Page Directory Table 1. */ 1284 1284 #define PGMPOOL_IDX_PAE_PD_1 4 1285 1285 /** PAE Page Directory Table 2. */ 1286 1286 #define PGMPOOL_IDX_PAE_PD_2 5 1287 1287 /** PAE Page Directory Table 3. */ 1288 1288 #define PGMPOOL_IDX_PAE_PD_3 6 1289 /** AMD64 Page Directory Table. */ 1290 #define PGMPOOL_IDX_AMD64_PD 7 1289 1291 /** Page Directory Pointer Table (PAE root, not currently used). */ 1290 #define PGMPOOL_IDX_PDPT 71292 #define PGMPOOL_IDX_PDPT 8 1291 1293 /** Page Map Level-4 (64-bit root). */ 1292 #define PGMPOOL_IDX_PML4 81294 #define PGMPOOL_IDX_PML4 9 1293 1295 /** The first normal index. */ 1294 #define PGMPOOL_IDX_FIRST 91296 #define PGMPOOL_IDX_FIRST 10 1295 1297 /** The last valid index. (inclusive, 14 bits) */ 1296 1298 #define PGMPOOL_IDX_LAST 0x3fff … … 1309 1311 uint16_t iNext; 1310 1312 /** The user page index. */ 1311 uint 16_t iUser;1313 uint32_t iUser; 1312 1314 /** Index into the user table. */ 1313 uint 16_t iUserTable;1315 uint32_t iUserTable; 1314 1316 } PGMPOOLUSER, *PPGMPOOLUSER; 1315 1317 typedef const PGMPOOLUSER *PCPGMPOOLUSER; … … 1369 1371 /** Shw: 64-bit page directory pointer table; Gst: 64-bit page directory pointer table. */ 1370 1372 PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT, 1373 /** Shw: 64-bit page directory table; Gst: 64-bit page directory table. */ 1374 PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD, 1371 1375 1372 1376 /** Shw: Root 32-bit page directory. */ … … 2623 2627 void *pgmGCPoolMapPage(PVM pVM, PPGMPOOLPAGE pPage); 2624 2628 #endif 2625 int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint 16_t iUserTable, PPPGMPOOLPAGE ppPage);2629 int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage); 2626 2630 PPGMPOOLPAGE pgmPoolGetPageByHCPhys(PVM pVM, RTHCPHYS HCPhys); 2627 void pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint 16_t iUserTable);2628 void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint 16_t iUserTable);2631 void pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint32_t iUserTable); 2632 void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable); 2629 2633 int pgmPoolFlushPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage); 2630 2634 void pgmPoolFlushAll(PVM pVM); -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r9686 r9690 779 779 780 780 Assert(!(pPdpe->u & X86_PDPE_PG_MASK)); 781 rc = pgmPoolAlloc(pVM, pPdptGst->a[iPdPt].u & X86_PDPE_PG_MASK, PGMPOOLKIND_ PAE_PD_FOR_PAE_PD, PGMPOOL_IDX_PDPT,iPdPt, &pShwPage);781 rc = pgmPoolAlloc(pVM, pPdptGst->a[iPdPt].u & X86_PDPE_PG_MASK, PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD, PGMPOOL_IDX_PDPT, iPml4e * X86_PG_PAE_ENTRIES + iPdPt, &pShwPage); 782 782 if (rc == VERR_PGM_POOL_FLUSHED) 783 783 return VINF_PGM_SYNC_CR3; -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r9684 r9690 2153 2153 PX86PDPAE pPDDst = pVM->pgm.s.CTXMID(ap,PaePDs)[0]; 2154 2154 # elif PGM_SHW_TYPE == PGM_TYPE_AMD64 2155 const unsigned iPml4e = (GCPtrPage >> X86_PML4_SHIFT) & X86_PML4_MASK; 2156 const unsigned iPdPte = (GCPtrPage >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64; 2155 2157 const unsigned iPDDst = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK; 2156 2158 PX86PDPAE pPDDst; … … 2166 2168 PSHWPDE pPdeDst = &pPDDst->a[iPDDst]; 2167 2169 SHWPDE PdeDst = *pPdeDst; 2170 2171 /* Calculate unique identifier for the PD pool allocations. */ 2172 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 2173 const unsigned iPoolIdx = (iPml4e * X86_PG_PAE_ENTRIES + iPdPte) * X86_PG_PAE_ENTRIES + iPDDst; 2174 # else 2175 const unsigned iPoolIdx = iPDDst; 2176 # endif 2168 2177 2169 2178 # ifndef PGM_WITHOUT_MAPPINGS … … 2227 2236 GCPhys |= (iPDDst & 1) * (PAGE_SIZE / 2); 2228 2237 # endif 2229 rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_PT, SHW_POOL_ROOT_IDX, iP DDst, &pShwPage);2238 rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_PT, SHW_POOL_ROOT_IDX, iPoolIdx, &pShwPage); 2230 2239 } 2231 2240 else … … 2236 2245 GCPhys |= GCPtrPage & (1 << X86_PD_PAE_SHIFT); 2237 2246 # endif 2238 rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_BIG, SHW_POOL_ROOT_IDX, iP DDst, &pShwPage);2247 rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_BIG, SHW_POOL_ROOT_IDX, iPoolIdx, &pShwPage); 2239 2248 } 2240 2249 if (rc == VINF_SUCCESS) … … 3008 3017 && !(pPDDst->a[iPD].u & PGM_PDFLAGS_MAPPING)) 3009 3018 { 3010 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDDst->a[iPD].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PAE_PD, (iPML4E * X86_PG_PAE_ENTRIES + iPDPTE) * X86_PG_PAE_ENTRIES + iPD); 3019 AssertCompile(PGMPOOL_IDX_AMD64_PD == SHW_POOL_ROOT_IDX); 3020 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDDst->a[iPD].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_AMD64_PD, (iPML4E * X86_PG_PAE_ENTRIES + iPDPTE) * X86_PG_PAE_ENTRIES + iPD); 3011 3021 pPDDst->a[iPD].u = 0; 3012 3022 } 3013 3023 } 3014 3024 3015 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPdptDst->a[iPDPTE].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PDPT, iP DPTE);3025 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPdptDst->a[iPDPTE].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PDPT, iPML4E * X86_PG_PAE_ENTRIES + iPDPTE); 3016 3026 pPdptDst->a[iPDPTE].u = 0; 3017 3027 } … … 3071 3081 { 3072 3082 # if PGM_GST_TYPE == PGM_TYPE_AMD64 3073 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDEDst[iPD].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PAE_PD, (iPML4E * X86_PG_PAE_ENTRIES + iPDPTE) * X86_PG_PAE_ENTRIES + iPD);3083 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDEDst[iPD].u & SHW_PDE_PG_MASK), SHW_POOL_ROOT_IDX, (iPML4E * X86_PG_PAE_ENTRIES + iPDPTE) * X86_PG_PAE_ENTRIES + iPD); 3074 3084 # else 3075 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDEDst[iPD].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PAE_PD, iPDPTE * X86_PG_PAE_ENTRIES + iPD);3085 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDEDst[iPD].u & SHW_PDE_PG_MASK), SHW_POOL_ROOT_IDX, iPDPTE * X86_PG_PAE_ENTRIES + iPD); 3076 3086 # endif 3077 3087 pPDEDst[iPD].u = 0; … … 3084 3094 if (!(pPdptDst->a[iPDPTE].u & PGM_PLXFLAGS_PERMANENT)) 3085 3095 { 3086 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPdptDst->a[iPDPTE].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PDPT, iPDPTE); 3096 # if PGM_GST_TYPE == PGM_TYPE_AMD64 3097 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPdptDst->a[iPDPTE].u & SHW_PDE_PG_MASK), PGMPOOL_IDX_PDPT, iPML4E * X86_PG_PAE_ENTRIES + iPDPTE); 3098 # else 3099 AssertFailed(); /* can't happen; the 4 pdpt pages are fixed! */ 3100 # endif 3087 3101 pPdptDst->a[iPDPTE].u = 0; 3088 3102 } … … 3162 3176 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 3163 3177 for (unsigned i = 0, iPdShw = iPD * 2; i < 2; i++, iPdShw++) /* pray that the compiler unrolls this */ 3164 # elif PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD643178 # elif PGM_GST_TYPE == PGM_TYPE_PAE 3165 3179 const unsigned iPdShw = iPD + iPDPTE * X86_PG_PAE_ENTRIES; NOREF(iPdShw); 3180 # elif PGM_GST_TYPE == PGM_TYPE_AMD64 3181 const unsigned iPdShw = iPD + (iPDPTE + iPML4E * X86_PG_PAE_ENTRIES) * X86_PG_PAE_ENTRIES; NOREF(iPdShw); 3166 3182 # else 3167 3183 const unsigned iPdShw = iPD; NOREF(iPdShw); -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r9689 r9690 55 55 #endif 56 56 #ifdef PGMPOOL_WITH_CACHE 57 static int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint 16_t iUserTable);57 static int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable); 58 58 #endif 59 59 #ifdef PGMPOOL_WITH_MONITORING … … 1047 1047 * @param ppPage Where to store the pointer to the page. 1048 1048 */ 1049 static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint 16_t iUserTable, PPPGMPOOLPAGE ppPage)1049 static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage) 1050 1050 { 1051 1051 #ifndef IN_GC … … 1816 1816 * @param iUserTable The user table index. 1817 1817 */ 1818 DECLINLINE(int) pgmPoolTrackInsert(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhys, uint16_t iUser, uint 16_t iUserTable)1818 DECLINLINE(int) pgmPoolTrackInsert(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhys, uint16_t iUser, uint32_t iUserTable) 1819 1819 { 1820 1820 int rc = VINF_SUCCESS; … … 1906 1906 * @param iUserTable The user table. 1907 1907 */ 1908 static int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint 16_t iUserTable)1908 static int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable) 1909 1909 { 1910 1910 PPGMPOOLUSER paUsers = pPool->CTXSUFF(paUsers); … … 1970 1970 * @param iUserTable The index into the user table (shadowed). 1971 1971 */ 1972 static void pgmPoolTrackFreeUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint 16_t iUserTable)1972 static void pgmPoolTrackFreeUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable) 1973 1973 { 1974 1974 /* … … 2393 2393 Assert(pUser->iUserTable < X86_PG_PAE_ENTRIES); 2394 2394 break; 2395 case PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD: 2396 Assert(!(u.pau64[pUser->iUser] & PGM_PDFLAGS_MAPPING)); 2397 Assert(pUser->iUserTable < X86_PG_PAE_ENTRIES*X86_PG_PAE_ENTRIES && pUser->iUser == PGMPOOL_IDX_PDPT); 2398 break; 2395 2399 case PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT: 2400 Assert(!(u.pau64[pUser->iUserTable] & PGM_PLXFLAGS_PERMANENT)); 2401 Assert(pUser->iUserTable < X86_PG_PAE_ENTRIES && pUser->iUser == PGMPOOL_IDX_PML4); 2402 break; 2396 2403 case PGMPOOLKIND_ROOT_PML4: 2397 2404 Assert(!(u.pau64[pUser->iUserTable] & PGM_PLXFLAGS_PERMANENT)); … … 3197 3204 paUsers[i].iNext = i + 1; 3198 3205 paUsers[i].iUser = NIL_PGMPOOL_IDX; 3199 paUsers[i].iUserTable = 0xfff e;3206 paUsers[i].iUserTable = 0xfffffffe; 3200 3207 } 3201 3208 paUsers[cMaxUsers - 1].iNext = NIL_PGMPOOL_USER_INDEX; … … 3374 3381 * @param iUserTable The index into the user table (shadowed). 3375 3382 */ 3376 void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint 16_t iUserTable)3383 void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable) 3377 3384 { 3378 3385 STAM_PROFILE_START(&pPool->StatFree, a); … … 3459 3466 * @param ppPage Where to store the pointer to the page. NULL is stored here on failure. 3460 3467 */ 3461 int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint 16_t iUserTable, PPPGMPOOLPAGE ppPage)3468 int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage) 3462 3469 { 3463 3470 PPGMPOOL pPool = pVM->pgm.s.CTXSUFF(pPool); … … 3579 3586 * @param iUserTable The index into the user table (shadowed). 3580 3587 */ 3581 void pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint 16_t iUserTable)3588 void pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint32_t iUserTable) 3582 3589 { 3583 3590 LogFlow(("pgmPoolFree: HCPhys=%VHp iUser=%#x iUserTable=%#x\n", HCPhys, iUser, iUserTable)); -
trunk/src/VBox/VMM/VMMAll/PGMAllShw.h
r9039 r9690 78 78 # define SHW_PDPT_MASK X86_PDPT_MASK_AMD64 79 79 # define SHW_TOTAL_PD_ENTRIES (X86_PG_AMD64_ENTRIES*X86_PG_AMD64_PDPE_ENTRIES) 80 # define SHW_POOL_ROOT_IDX PGMPOOL_IDX_ PML480 # define SHW_POOL_ROOT_IDX PGMPOOL_IDX_AMD64_PD 81 81 #else /* 32 bits PAE mode */ 82 82 # define SHW_PDPT_SHIFT X86_PDPT_SHIFT
Note:
See TracChangeset
for help on using the changeset viewer.