Changeset 47786 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Aug 16, 2013 8:59:32 AM (11 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/FTM.cpp
r46788 r47786 717 717 718 718 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: 719 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: 719 720 AssertFailed(); 720 721 break; -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r46420 r47786 3952 3952 default: 3953 3953 AssertFailed(); 3954 case PGMPAGETYPE_MMIO: 3954 3955 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: 3955 case PGMPAGETYPE_ MMIO:3956 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: 3956 3957 if (fIncZeroPgs) 3957 3958 { -
trunk/src/VBox/VMM/VMMR3/PGMDbg.cpp
r46220 r47786 661 661 if ( ( !PGM_PAGE_IS_ZERO(pPage) 662 662 || fAllZero) 663 && !PGM_PAGE_IS_MMIO(pPage) 664 && PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO2_ALIAS_MMIO 663 && !PGM_PAGE_IS_MMIO_OR_ALIAS(pPage) 665 664 && !PGM_PAGE_IS_BALLOONED(pPage)) 666 665 { … … 807 806 && ( !PGM_PAGE_IS_ZERO(pPage) 808 807 || fAllZero) 809 && !PGM_PAGE_IS_MMIO(pPage) 810 && PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO2_ALIAS_MMIO 808 && !PGM_PAGE_IS_MMIO_OR_ALIAS(pPage) 811 809 && !PGM_PAGE_IS_BALLOONED(pPage)) 812 810 { -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r45618 r47786 144 144 * delegate the job to EMT. 145 145 */ 146 if (PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)) 146 if ( PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage) 147 || PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage)) 147 148 { 148 149 pgmUnlock(pVM); … … 151 152 pVM, &GCPhys, pvBuf, cbRead); 152 153 } 153 Assert(!PGM_PAGE_IS_MMIO (pPage));154 Assert(!PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage)); 154 155 155 156 /* … … 282 283 */ 283 284 if ( PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage) 284 || PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED) 285 || PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED 286 || PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage)) 285 287 { 286 288 if ( PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_WRITE_MONITORED … … 295 297 } 296 298 } 297 Assert(!PGM_PAGE_IS_MMIO (pPage));299 Assert(!PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage)); 298 300 299 301 /* … … 378 380 AssertFatalRC(rc2); 379 381 PPGMPAGE pPage = pTlbe->pPage; 380 if (PGM_PAGE_IS_MMIO (pPage))382 if (PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage)) 381 383 { 382 384 PGMPhysReleasePageMappingLock(pVM, pLock); … … 449 451 { 450 452 PPGMPAGE pPage = pTlbe->pPage; 451 if (PGM_PAGE_IS_MMIO (pPage))453 if (PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage)) 452 454 rc = VERR_PGM_PHYS_PAGE_RESERVED; 453 455 else … … 552 554 #if 1 553 555 /* MMIO pages doesn't have any readable backing. */ 554 if (PGM_PAGE_IS_MMIO (pPage))556 if (PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage)) 555 557 rc = VERR_PGM_PHYS_PAGE_RESERVED; 556 558 #else … … 1979 1981 1980 1982 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: 1983 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: /** @todo perhaps leave the special page alone? I don't think VT-x copes with this code. */ 1981 1984 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT), 1982 1985 true /*fDoAccounting*/); … … 2032 2035 2033 2036 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: 2037 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: /** @todo perhaps leave the special page alone? I don't think VT-x copes with this code. */ 2034 2038 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT), 2035 2039 true /*fDoAccounting*/); … … 2127 2131 2128 2132 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: 2133 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: 2129 2134 case PGMPAGETYPE_MMIO2: 2130 2135 case PGMPAGETYPE_ROM_SHADOW: /* handled by pgmR3PhysRomReset. */ … … 2149 2154 return VINF_SUCCESS; 2150 2155 } 2156 2151 2157 2152 2158 /** … … 2363 2369 { 2364 2370 PPGMPAGE pPage = &pRam->aPages[iPage]; 2365 if ( PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO2371 if ( !PGM_PAGE_IS_MMIO_OR_ALIAS(pPage) 2366 2372 /*|| not-out-of-action later */) 2367 2373 { 2368 2374 fAllMMIO = false; 2369 Assert(PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO2_ALIAS_MMIO);2370 2375 AssertMsgFailed(("%RGp %R[pgmpage]\n", pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT), pPage)); 2371 2376 break; 2372 2377 } 2373 Assert(PGM_PAGE_IS_ZERO(pPage)); 2378 Assert( PGM_PAGE_IS_ZERO(pPage) 2379 || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO2_ALIAS_MMIO 2380 || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_SPECIAL_ALIAS_MMIO); 2374 2381 pPage++; 2375 2382 } … … 2409 2416 { 2410 2417 PPGMPAGE pPage = &pRam->aPages[iPage]; 2411 AssertMsg(PGM_PAGE_IS_MMIO(pPage), ("%RGp %R[pgmpage]\n", pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT), pPage)); 2412 AssertMsg(PGM_PAGE_IS_ZERO(pPage), ("%RGp %R[pgmpage]\n", pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT), pPage)); 2413 if (PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO) 2418 AssertMsg( (PGM_PAGE_IS_MMIO(pPage) && PGM_PAGE_IS_ZERO(pPage)) 2419 || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO2_ALIAS_MMIO 2420 || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_SPECIAL_ALIAS_MMIO, 2421 ("%RGp %R[pgmpage]\n", pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT), pPage)); 2422 if (PGM_PAGE_IS_MMIO_OR_ALIAS(pPage)) 2414 2423 PGM_PAGE_SET_TYPE(pVM, pPage, PGMPAGETYPE_RAM); 2415 2424 } … … 2488 2497 * @param pszDesc The description. 2489 2498 */ 2490 VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc) 2499 VMMR3DECL(int) PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, 2500 void **ppv, const char *pszDesc) 2491 2501 { 2492 2502 /* … … 2506 2516 const uint32_t cPages = cb >> PAGE_SHIFT; 2507 2517 AssertLogRelReturn(((RTGCPHYS)cPages << PAGE_SHIFT) == cb, VERR_INVALID_PARAMETER); 2508 AssertLogRelReturn(cPages <= INT32_MAX / 2, VERR_NO_MEMORY);2518 AssertLogRelReturn(cPages <= PGM_MMIO2_MAX_PAGE_COUNT, VERR_NO_MEMORY); 2509 2519 2510 2520 /* … … 2517 2527 return VERR_NO_MEMORY; 2518 2528 } 2529 2530 /* 2531 * Allocate an MMIO2 range ID (not freed on failure). 2532 * The zero ID is not used as it could be confused with NIL_GMM_PAGEID. 2533 */ 2534 pgmLock(pVM); 2535 uint8_t idMmio2 = pVM->pgm.s.cMmio2Regions + 1; 2536 if (idMmio2 > PGM_MMIO2_MAX_RANGES) 2537 { 2538 pgmUnlock(pVM); 2539 AssertLogRelFailedReturn(VERR_PGM_TOO_MANY_MMIO2_RANGES); 2540 } 2541 pVM->pgm.s.cMmio2Regions = idMmio2; 2542 pgmUnlock(pVM); 2519 2543 2520 2544 /* … … 2549 2573 pNew->iRegion = iRegion; 2550 2574 pNew->idSavedState = UINT8_MAX; 2575 pNew->idMmio2 = idMmio2; 2551 2576 pNew->RamRange.pSelfR0 = MMHyperCCToR0(pVM, &pNew->RamRange); 2552 2577 pNew->RamRange.pSelfRC = MMHyperCCToRC(pVM, &pNew->RamRange); … … 2563 2588 { 2564 2589 PGM_PAGE_INIT(&pNew->RamRange.aPages[iPage], 2565 paPages[iPage].Phys, NIL_GMM_PAGEID, 2590 paPages[iPage].Phys, 2591 PGM_MMIO2_PAGEID_MAKE(idMmio2, iPage), 2566 2592 PGMPAGETYPE_MMIO2, PGM_PAGE_STATE_ALLOCATED); 2567 2593 } … … 2575 2601 * Since there is no particular order, just push it. 2576 2602 */ 2603 /** @todo we can save us the linked list now, just search the lookup table... */ 2577 2604 pgmLock(pVM); 2605 Assert(pVM->pgm.s.apMmio2RangesR3[idMmio2] == NULL); 2606 Assert(pVM->pgm.s.apMmio2RangesR0[idMmio2] == NIL_RTR0PTR); 2578 2607 pNew->pNextR3 = pVM->pgm.s.pMmio2RangesR3; 2579 2608 pVM->pgm.s.pMmio2RangesR3 = pNew; 2609 pVM->pgm.s.apMmio2RangesR3[idMmio2] = pNew; 2610 pVM->pgm.s.apMmio2RangesR0[idMmio2] = MMHyperCCToR0(pVM, pNew); 2580 2611 pgmUnlock(pVM); 2581 2612 … … 2650 2681 pVM->pgm.s.pMmio2RangesR3 = pNext; 2651 2682 pCur->pNextR3 = NULL; 2683 2684 uint8_t idMmio2 = pCur->idMmio2; 2685 Assert(pVM->pgm.s.apMmio2RangesR3[idMmio2] == pCur); 2686 pVM->pgm.s.apMmio2RangesR3[idMmio2] = NULL; 2687 pVM->pgm.s.apMmio2RangesR0[idMmio2] = NIL_RTR0PTR; 2652 2688 2653 2689 /* -
trunk/src/VBox/VMM/VMMR3/PGMSavedState.cpp
r44528 r47786 103 103 /** The CRC-32 for a zero half page. */ 104 104 #define PGM_STATE_CRC32_ZERO_HALF_PAGE UINT32_C(0xf1e8ba9e) 105 106 107 108 /** @name Old Page types used in older saved states. 109 * @{ */ 110 /** Old saved state: The usual invalid zero entry. */ 111 #define PGMPAGETYPE_OLD_INVALID 0 112 /** Old saved state: RAM page. (RWX) */ 113 #define PGMPAGETYPE_OLD_RAM 1 114 /** Old saved state: MMIO2 page. (RWX) */ 115 #define PGMPAGETYPE_OLD_MMIO2 1 116 /** Old saved state: MMIO2 page aliased over an MMIO page. (RWX) 117 * See PGMHandlerPhysicalPageAlias(). */ 118 #define PGMPAGETYPE_OLD_MMIO2_ALIAS_MMIO 2 119 /** Old saved state: Shadowed ROM. (RWX) */ 120 #define PGMPAGETYPE_OLD_ROM_SHADOW 3 121 /** Old saved state: ROM page. (R-X) */ 122 #define PGMPAGETYPE_OLD_ROM 4 123 /** Old saved state: MMIO page. (---) */ 124 #define PGMPAGETYPE_OLD_MMIO 5 125 /** @} */ 105 126 106 127 … … 1156 1177 1157 1178 case PGMPAGETYPE_MMIO: 1179 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: 1158 1180 paLSPages[iPage].fZero = 0; 1159 1181 paLSPages[iPage].fShared = 0; … … 2172 2194 2173 2195 /** 2196 * Compares a page with an old save type value. 2197 * 2198 * @returns true if equal, false if not. 2199 * @param pPage The page to compare. 2200 * @param uOldType The old type value from the saved state. 2201 */ 2202 DECLINLINE(bool) pgmR3CompareNewAndOldPageTypes(PPGMPAGE pPage, uint8_t uOldType) 2203 { 2204 uint8_t uOldPageType; 2205 switch (PGM_PAGE_GET_TYPE(pPage)) 2206 { 2207 case PGMPAGETYPE_INVALID: uOldPageType = PGMPAGETYPE_OLD_INVALID; break; 2208 case PGMPAGETYPE_RAM: uOldPageType = PGMPAGETYPE_OLD_RAM; break; 2209 case PGMPAGETYPE_MMIO2: uOldPageType = PGMPAGETYPE_OLD_MMIO2; break; 2210 case PGMPAGETYPE_MMIO2_ALIAS_MMIO: uOldPageType = PGMPAGETYPE_OLD_MMIO2_ALIAS_MMIO; break; 2211 case PGMPAGETYPE_ROM_SHADOW: uOldPageType = PGMPAGETYPE_OLD_ROM_SHADOW; break; 2212 case PGMPAGETYPE_ROM: uOldPageType = PGMPAGETYPE_OLD_ROM; break; 2213 case PGMPAGETYPE_SPECIAL_ALIAS_MMIO: /* fall thru */ 2214 case PGMPAGETYPE_MMIO: uOldPageType = PGMPAGETYPE_OLD_MMIO; break; 2215 default: 2216 AssertFailed(); 2217 uOldPageType = PGMPAGETYPE_OLD_INVALID; 2218 break; 2219 } 2220 return uOldPageType == uOldType; 2221 } 2222 2223 2224 /** 2174 2225 * Loads a page without any bits in the saved state, i.e. making sure it's 2175 2226 * really zero. … … 2177 2228 * @returns VBox status code. 2178 2229 * @param pVM Pointer to the VM. 2179 * @param u Type The page type or PGMPAGETYPE_INVALID (old saved2230 * @param uOldType The page type or PGMPAGETYPE_OLD_INVALID (old saved 2180 2231 * state). 2181 2232 * @param pPage The guest page tracking structure. … … 2183 2234 * @param pRam The ram range (logging). 2184 2235 */ 2185 static int pgmR3LoadPageZeroOld(PVM pVM, uint8_t u Type, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)2186 { 2187 if ( PGM_PAGE_GET_TYPE(pPage) != uType2188 && uType != PGMPAGETYPE_INVALID)2236 static int pgmR3LoadPageZeroOld(PVM pVM, uint8_t uOldType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam) 2237 { 2238 if ( uOldType != PGMPAGETYPE_OLD_INVALID 2239 && !pgmR3CompareNewAndOldPageTypes(pPage, uOldType)) 2189 2240 return VERR_SSM_UNEXPECTED_DATA; 2190 2241 … … 2207 2258 * @param pVM Pointer to the VM. 2208 2259 * @param pSSM The SSM handle. 2209 * @param u Type The page type or PGMPAGETYEP_INVALID (old saved2260 * @param uOldType The page type or PGMPAGETYPE_OLD_INVALID (old saved 2210 2261 * state). 2211 2262 * @param pPage The guest page tracking structure. … … 2213 2264 * @param pRam The ram range (logging). 2214 2265 */ 2215 static int pgmR3LoadPageBitsOld(PVM pVM, PSSMHANDLE pSSM, uint8_t u Type, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)2266 static int pgmR3LoadPageBitsOld(PVM pVM, PSSMHANDLE pSSM, uint8_t uOldType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam) 2216 2267 { 2217 2268 /* 2218 2269 * Match up the type, dealing with MMIO2 aliases (dropped). 2219 2270 */ 2220 AssertLogRelMsgReturn( PGM_PAGE_GET_TYPE(pPage) == uType2221 || uType == PGMPAGETYPE_INVALID2271 AssertLogRelMsgReturn( uOldType == PGMPAGETYPE_INVALID 2272 || pgmR3CompareNewAndOldPageTypes(pPage, uOldType) 2222 2273 /* kudge for the expanded PXE bios (r67885) - @bugref{5687}: */ 2223 || ( u Type == PGMPAGETYPE_RAM2274 || ( uOldType == PGMPAGETYPE_OLD_RAM 2224 2275 && GCPhys >= 0xed000 2225 2276 && GCPhys <= 0xeffff … … 2251 2302 * @param pVM Pointer to the VM. 2252 2303 * @param pSSM The SSM handle. 2253 * @param u TypeThe page type.2304 * @param uOldType The page type. 2254 2305 * @param pPage The page. 2255 2306 * @param GCPhys The page address. 2256 2307 * @param pRam The RAM range (for error messages). 2257 2308 */ 2258 static int pgmR3LoadPageOld(PVM pVM, PSSMHANDLE pSSM, uint8_t u Type, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)2309 static int pgmR3LoadPageOld(PVM pVM, PSSMHANDLE pSSM, uint8_t uOldType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam) 2259 2310 { 2260 2311 uint8_t uState; … … 2262 2313 AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] GCPhys=%#x %s rc=%Rrc\n", pPage, GCPhys, pRam->pszDesc, rc), rc); 2263 2314 if (uState == 0 /* zero */) 2264 rc = pgmR3LoadPageZeroOld(pVM, u Type, pPage, GCPhys, pRam);2315 rc = pgmR3LoadPageZeroOld(pVM, uOldType, pPage, GCPhys, pRam); 2265 2316 else if (uState == 1) 2266 rc = pgmR3LoadPageBitsOld(pVM, pSSM, u Type, pPage, GCPhys, pRam);2317 rc = pgmR3LoadPageBitsOld(pVM, pSSM, uOldType, pPage, GCPhys, pRam); 2267 2318 else 2268 2319 rc = VERR_PGM_INVALID_SAVED_PAGE_STATE; 2269 AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] uState=%d u Type=%d GCPhys=%RGp %s rc=%Rrc\n",2270 pPage, uState, u Type, GCPhys, pRam->pszDesc, rc),2320 AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] uState=%d uOldType=%d GCPhys=%RGp %s rc=%Rrc\n", 2321 pPage, uState, uOldType, GCPhys, pRam->pszDesc, rc), 2271 2322 rc); 2272 2323 return VINF_SUCCESS; … … 2440 2491 RTGCPHYS const GCPhysPage = ((RTGCPHYS)iPage << PAGE_SHIFT) + pRam->GCPhys; 2441 2492 PPGMPAGE pPage = &pRam->aPages[iPage]; 2442 uint8_t u Type;2443 rc = SSMR3GetU8(pSSM, &u Type);2493 uint8_t uOldType; 2494 rc = SSMR3GetU8(pSSM, &uOldType); 2444 2495 AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] iPage=%#x GCPhysPage=%#x %s\n", pPage, iPage, GCPhysPage, pRam->pszDesc), rc); 2445 if (u Type == PGMPAGETYPE_ROM_SHADOW)2496 if (uOldType == PGMPAGETYPE_OLD_ROM_SHADOW) 2446 2497 rc = pgmR3LoadShadowedRomPageOld(pVM, pSSM, pPage, GCPhysPage, pRam); 2447 2498 else 2448 rc = pgmR3LoadPageOld(pVM, pSSM, u Type, pPage, GCPhysPage, pRam);2499 rc = pgmR3LoadPageOld(pVM, pSSM, uOldType, pPage, GCPhysPage, pRam); 2449 2500 AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iPage=%#x GCPhysPage=%#x %s\n", rc, iPage, GCPhysPage, pRam->pszDesc), rc); 2450 2501 } … … 2494 2545 if (fPresent) 2495 2546 { 2496 if (PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO) 2547 if ( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO 2548 || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_SPECIAL_ALIAS_MMIO) 2497 2549 rc = pgmR3LoadPageToDevNullOld(pSSM); 2498 2550 else
Note:
See TracChangeset
for help on using the changeset viewer.