Changeset 47786 in vbox for trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
- Timestamp:
- Aug 16, 2013 8:59:32 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 /*
Note:
See TracChangeset
for help on using the changeset viewer.