儲存庫 vbox 的更動 17285
- 時間撮記:
- 2009-3-3 下午02:34:35 (16 年 以前)
- 位置:
- trunk
- 檔案:
-
- 修改 5 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/VBox/mm.h
r17279 r17285 86 86 #define MM_RAM_FLAGS_DYNAMIC_ALLOC RT_BIT(11) 87 87 88 /** The shift used to get the reference count. */89 #define MM_RAM_FLAGS_CREFS_SHIFT 6290 /** The mask applied to the the page pool idx after using MM_RAM_FLAGS_CREFS_SHIFT to shift it down. */91 #define MM_RAM_FLAGS_CREFS_MASK 0x392 88 /** The (shifted) cRef value used to indiciate that the idx is the head of a 93 89 * physical cross reference extent list. */ 94 #define MM_RAM_FLAGS_CREFS_PHYSEXT MM_RAM_FLAGS_CREFS_MASK90 #define MM_RAM_FLAGS_CREFS_PHYSEXT 0x3 95 91 /** The shift used to get the page pool idx. (Apply MM_RAM_FLAGS_IDX_MASK to the result when shifting down). */ 96 92 #define MM_RAM_FLAGS_IDX_SHIFT 48 -
trunk/src/VBox/VMM/PGMInternal.h
r17279 r17285 1950 1950 * simply too many mappings of this page. */ 1951 1951 #define PGMPOOL_TD_IDX_OVERFLOWED PGMPOOL_TD_IDX_MASK 1952 1953 /** @def PGMPOOL_TD_MAKE 1954 * Makes a 16-bit tracking data word. 1955 * 1956 * @returns tracking data. 1957 * @param cRefs The @a cRefs field. Must be within bounds! 1958 * @param idx The @a idx field. Must also be within bounds! */ 1959 #define PGMPOOL_TD_MAKE(cRefs, idx) ( ((cRefs) << PGMPOOL_TD_CREFS_SHIFT) | (idx) ) 1960 1961 /** @def PGMPOOL_TD_GET_CREFS 1962 * Get the @a cRefs field from a tracking data word. 1963 * 1964 * @returns The @a cRefs field 1965 * @param u16 The tracking data word. */ 1966 #define PGMPOOL_TD_GET_CREFS(u16) ( ((u16) >> PGMPOOL_TD_CREFS_SHIFT) & PGMPOOL_TD_CREFS_MASK ) 1967 1968 /** @def PGMPOOL_TD_GET_IDX 1969 * Get the @a idx field from a tracking data word. 1970 * 1971 * @returns The @a idx field 1972 * @param u16 The tracking data word. */ 1973 #define PGMPOOL_TD_GET_IDX(u16) ( ((u16) >> PGMPOOL_TD_IDX_SHIFT) & PGMPOOL_TD_IDX_MASK ) 1952 1974 /** @} */ 1953 1975 1954 #ifdef MM_RAM_FLAGS_CREFS_SHIFT 1955 # if MM_RAM_FLAGS_CREFS_SHIFT - MM_RAM_FLAGS_IDX_SHIFT != PGMPOOL_TD_CREFS_SHIFT 1956 # error "MM_RAM_FLAGS_CREFS_SHIFT - MM_RAM_FLAGS_IDX_SHIFT != PGMPOOL_TD_CREFS_SHIFT" 1957 # endif 1958 # if MM_RAM_FLAGS_CREFS_MASK != MM_RAM_FLAGS_CREFS_MASK 1959 # error "MM_RAM_FLAGS_CREFS_MASK != MM_RAM_FLAGS_CREFS_MASK" 1960 # endif 1961 # if MM_RAM_FLAGS_CREFS_PHYSEXT != MM_RAM_FLAGS_CREFS_PHYSEXT 1962 # error "MM_RAM_FLAGS_CREFS_PHYSEXT != MM_RAM_FLAGS_CREFS_PHYSEXT" 1963 # endif 1976 #ifdef MM_RAM_FLAGS_IDX_SHIFT 1964 1977 # if MM_RAM_FLAGS_IDX_SHIFT - 48 != PGMPOOL_TD_IDX_SHIFT 1965 1978 # error "MM_RAM_FLAGS_IDX_SHIFT - 48 != PGMPOOL_TD_IDX_SHIFT" -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r17279 r17285 1414 1414 # ifdef PGMPOOL_WITH_GCPHYS_TRACKING 1415 1415 /* 1416 * We're making certain assumptions about the placement of cRef and idx.1417 */1418 Assert(MM_RAM_FLAGS_IDX_SHIFT == 48);1419 Assert(MM_RAM_FLAGS_CREFS_SHIFT > MM_RAM_FLAGS_IDX_SHIFT);1420 1421 /*1422 1416 * Just deal with the simple first time here. 1423 1417 */ … … 1425 1419 { 1426 1420 STAM_COUNTER_INC(&pVM->pgm.s.StatTrackVirgin); 1427 u16 = (1 << PGMPOOL_TD_CREFS_SHIFT) | pShwPage->idx;1421 u16 = PGMPOOL_TD_MAKE(1, pShwPage->idx); 1428 1422 } 1429 1423 else -
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r17279 r17285 233 233 234 234 #ifdef PGMPOOL_WITH_GCPHYS_TRACKING 235 /* This code also makes ASSUMPTIONS about the cRefs and stuff. */ 236 Assert(MM_RAM_FLAGS_IDX_SHIFT < MM_RAM_FLAGS_CREFS_SHIFT); 237 const uint16_t u16 = pRam->aPages[i].HCPhys >> MM_RAM_FLAGS_IDX_SHIFT; /** @todo PAGE FLAGS */ 235 const uint16_t u16 = PGM_PAGE_GET_TRACKING(&pRam->aPages[i]); 238 236 if (u16) 239 237 { … … 244 242 uint32_t iPrevSubset = PGMDynMapPushAutoSubset(pVCpu); 245 243 # endif 246 247 if ((u16 >> PGMPOOL_TD_CREFS_SHIFT) != MM_RAM_FLAGS_CREFS_PHYSEXT) 244 if (PGMPOOL_TD_GET_CREFS(u16) != PGMPOOL_TD_CREFS_PHYSEXT) 248 245 pgmPoolTrackFlushGCPhysPT(pVM, 249 246 pPage, 250 u16 & MM_RAM_FLAGS_IDX_MASK,251 u16 >> PGMPOOL_TD_CREFS_SHIFT);252 else if (u16 != ((MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT) | MM_RAM_FLAGS_IDX_OVERFLOWED))253 pgmPoolTrackFlushGCPhysPTs(pVM, pPage, u16 & MM_RAM_FLAGS_IDX_MASK);247 PGMPOOL_TD_GET_IDX(u16), 248 PGMPOOL_TD_GET_CREFS(u16)); 249 else if (u16 != PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, PGMPOOL_TD_IDX_OVERFLOWED)) 250 pgmPoolTrackFlushGCPhysPTs(pVM, pPage, PGMPOOL_TD_GET_IDX(u16)); 254 251 else 255 252 rc = pgmPoolTrackFlushGCPhysPTsSlow(pVM, pPage); -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r17279 r17285 3341 3341 * Insert a reference into a list of physical cross reference extents. 3342 3342 * 3343 * @returns The new ram range flags (top 16-bits).3343 * @returns The new tracking data for PGMPAGE. 3344 3344 * 3345 3345 * @param pVM The VM handle. … … 3359 3359 STAM_COUNTER_INC(&pVM->pgm.s.StatTrackAliasedMany); 3360 3360 LogFlow(("pgmPoolTrackPhysExtAddref: %d:{,,%d}\n", iPhysExt, iShwPT)); 3361 return iPhysExt | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3361 return PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, iPhysExt); 3362 3362 } 3363 3363 … … 3374 3374 STAM_COUNTER_INC(&pVM->pgm.s.StatTrackAliasedMany); 3375 3375 LogFlow(("pgmPoolTrackPhysExtAddref: %d:{%d} i=%d cMax=%d\n", iPhysExt, iShwPT, i, cMax)); 3376 return iPhysExtStart | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3376 return PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, iPhysExtStart); 3377 3377 } 3378 3378 if (!--cMax) … … 3381 3381 pgmPoolTrackPhysExtFreeList(pVM, iPhysExtStart); 3382 3382 LogFlow(("pgmPoolTrackPhysExtAddref: overflow (1) iShwPT=%d\n", iShwPT)); 3383 return MM_RAM_FLAGS_IDX_OVERFLOWED | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3383 return PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, PGMPOOL_TD_IDX_OVERFLOWED); 3384 3384 } 3385 3385 } … … 3391 3391 STAM_COUNTER_INC(&pVM->pgm.s.StatTrackOverflows); 3392 3392 pgmPoolTrackPhysExtFreeList(pVM, iPhysExtStart); 3393 return MM_RAM_FLAGS_IDX_OVERFLOWED | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3393 return PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, PGMPOOL_TD_IDX_OVERFLOWED); 3394 3394 } 3395 3395 pNew->iNext = iPhysExtStart; 3396 3396 pNew->aidx[0] = iShwPT; 3397 3397 LogFlow(("pgmPoolTrackPhysExtAddref: added new extent %d:{%d}->%d\n", iPhysExt, iShwPT, iPhysExtStart)); 3398 return iPhysExt | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3398 return PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, iPhysExt); 3399 3399 } 3400 3400 … … 3403 3403 * Add a reference to guest physical page where extents are in use. 3404 3404 * 3405 * @returns The new ram range flags (top 16-bits).3405 * @returns The new tracking data for PGMPAGE. 3406 3406 * 3407 3407 * @param pVM The VM handle. … … 3411 3411 uint16_t pgmPoolTrackPhysExtAddref(PVM pVM, uint16_t u16, uint16_t iShwPT) 3412 3412 { 3413 if ( (u16 >> PGMPOOL_TD_CREFS_SHIFT) != MM_RAM_FLAGS_CREFS_PHYSEXT)3413 if (PGMPOOL_TD_GET_CREFS(u16) != PGMPOOL_TD_CREFS_PHYSEXT) 3414 3414 { 3415 3415 /* 3416 3416 * Convert to extent list. 3417 3417 */ 3418 Assert( (u16 >> PGMPOOL_TD_CREFS_SHIFT) == 1);3418 Assert(PGMPOOL_TD_GET_CREFS(u16) == 1); 3419 3419 uint16_t iPhysExt; 3420 3420 PPGMPOOLPHYSEXT pPhysExt = pgmPoolTrackPhysExtAlloc(pVM, &iPhysExt); 3421 3421 if (pPhysExt) 3422 3422 { 3423 LogFlow(("pgmPoolTrackPhysExtAddref: new extent: %d:{%d, %d}\n", iPhysExt, u16 & MM_RAM_FLAGS_IDX_MASK, iShwPT));3423 LogFlow(("pgmPoolTrackPhysExtAddref: new extent: %d:{%d, %d}\n", iPhysExt, PGMPOOL_TD_GET_IDX(u16), iShwPT)); 3424 3424 STAM_COUNTER_INC(&pVM->pgm.s.StatTrackAliased); 3425 pPhysExt->aidx[0] = u16 & MM_RAM_FLAGS_IDX_MASK;3425 pPhysExt->aidx[0] = PGMPOOL_TD_GET_IDX(u16); 3426 3426 pPhysExt->aidx[1] = iShwPT; 3427 u16 = iPhysExt | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3427 u16 = PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, iPhysExt); 3428 3428 } 3429 3429 else 3430 u16 = MM_RAM_FLAGS_IDX_OVERFLOWED | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT);3431 } 3432 else if (u16 != (MM_RAM_FLAGS_IDX_OVERFLOWED | (MM_RAM_FLAGS_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT)))3430 u16 = PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, MM_RAM_FLAGS_IDX_OVERFLOWED); 3431 } 3432 else if (u16 != PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, MM_RAM_FLAGS_IDX_OVERFLOWED)) 3433 3433 { 3434 3434 /* 3435 3435 * Insert into the extent list. 3436 3436 */ 3437 u16 = pgmPoolTrackPhysExtInsert(pVM, u16 & MM_RAM_FLAGS_IDX_MASK, iShwPT);3437 u16 = pgmPoolTrackPhysExtInsert(pVM, PGMPOOL_TD_GET_IDX(u16), iShwPT); 3438 3438 } 3439 3439 else … … 3452 3452 void pgmPoolTrackPhysExtDerefGCPhys(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PPGMPAGE pPhysPage) 3453 3453 { 3454 const unsigned cRefs = pPhysPage->HCPhys >> MM_RAM_FLAGS_CREFS_SHIFT; /** @todo PAGE FLAGS */3455 AssertFatalMsg(cRefs == MM_RAM_FLAGS_CREFS_PHYSEXT, ("cRefs=%d HCPhys=%RHp pPage=%p:{.idx=%d}\n", cRefs, pPhysPage->HCPhys, pPage, pPage->idx));3456 3457 uint16_t iPhysExt = (pPhysPage->HCPhys >> MM_RAM_FLAGS_IDX_SHIFT) & MM_RAM_FLAGS_IDX_MASK;3458 if (iPhysExt != MM_RAM_FLAGS_IDX_OVERFLOWED)3454 const unsigned cRefs = PGM_PAGE_GET_TD_CREFS(pPhysPage); 3455 AssertFatalMsg(cRefs == PGMPOOL_TD_CREFS_PHYSEXT, ("cRefs=%d HCPhys=%RHp pPage=%p:{.idx=%d}\n", cRefs, pPhysPage->HCPhys, pPage, pPage->idx)); 3456 3457 uint16_t iPhysExt = PGM_PAGE_GET_TD_IDX(pPhysPage); 3458 if (iPhysExt != PGMPOOL_TD_IDX_OVERFLOWED) 3459 3459 { 3460 3460 uint16_t iPhysExtPrev = NIL_PGMPOOL_PHYSEXT_INDEX; … … 3495 3495 /* head */ 3496 3496 Log2(("pgmPoolTrackPhysExtDerefGCPhys: HCPhys=%RX64 idx=%d head\n", pPhysPage->HCPhys, pPage->idx)); 3497 PGM_PAGE_SET_TRACKING(pPhysPage, (PGMPOOL_TD_CREFS_PHYSEXT << PGMPOOL_TD_CREFS_SHIFT) 3498 | (iPhysExtNext << PGMPOOL_TD_IDX_SHIFT)); 3497 PGM_PAGE_SET_TRACKING(pPhysPage, PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, iPhysExtNext)); 3499 3498 pgmPoolTrackPhysExtFree(pVM, iPhysExt); 3500 3499 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器