Changeset 65299 in vbox for trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
- Timestamp:
- Jan 15, 2017 5:50:11 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112870
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r64911 r65299 2698 2698 pNew->RamRange.GCPhysLast = NIL_RTGCPHYS; 2699 2699 pNew->RamRange.pszDesc = pszDesc; 2700 pNew->RamRange.cb = (RTGCPHYS)cPagesTrackedByChunk << X86_PAGE_SHIFT;2700 pNew->RamRange.cb = pNew->cbReal = (RTGCPHYS)cPagesTrackedByChunk << X86_PAGE_SHIFT; 2701 2701 pNew->RamRange.fFlags |= PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO_EX; 2702 2702 //pNew->RamRange.pvR3 = NULL; … … 3163 3163 * Free the memory. 3164 3164 */ 3165 uint32_t const cPages = pCur-> RamRange.cb>> PAGE_SHIFT;3165 uint32_t const cPages = pCur->cbReal >> PAGE_SHIFT; 3166 3166 if (pCur->fFlags & PGMREGMMIORANGE_F_MMIO2) 3167 3167 { … … 3674 3674 3675 3675 return VINF_SUCCESS; 3676 } 3677 3678 3679 /** 3680 * Reduces the mapping size of a MMIO2 or pre-registered MMIO region. 3681 * 3682 * This is mainly for dealing with old saved states after changing the default 3683 * size of a mapping region. See PGMDevHlpMMIOExReduce and 3684 * PDMPCIDEV::pfnRegionLoadChangeHookR3. 3685 * 3686 * The region must not currently be mapped when making this call. The VM state 3687 * must be state restore or VM construction. 3688 * 3689 * @returns VBox status code. 3690 * @param pVM The cross context VM structure. 3691 * @param pDevIns The device instance owning the region. 3692 * @param iSubDev The sub-device number of the registered region. 3693 * @param iRegion The index of the registered region. 3694 * @param cbRegion The new mapping size. 3695 */ 3696 VMMR3_INT_DECL(int) PGMR3PhysMMIOExReduce(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion) 3697 { 3698 /* 3699 * Validate input 3700 */ 3701 VM_ASSERT_EMT_RETURN(pVM, VERR_VM_THREAD_NOT_EMT); 3702 AssertPtrReturn(pDevIns, VERR_INVALID_PARAMETER); 3703 AssertReturn(iSubDev <= UINT8_MAX, VERR_INVALID_PARAMETER); 3704 AssertReturn(iRegion <= UINT8_MAX, VERR_INVALID_PARAMETER); 3705 AssertReturn(cbRegion >= X86_PAGE_SIZE, VERR_INVALID_PARAMETER); 3706 AssertReturn(!(cbRegion & X86_PAGE_OFFSET_MASK), VERR_UNSUPPORTED_ALIGNMENT); 3707 VMSTATE enmVmState = VMR3GetState(pVM); 3708 AssertLogRelMsgReturn( enmVmState == VMSTATE_CREATING 3709 || enmVmState == VMSTATE_LOADING, 3710 ("enmVmState=%d (%s)\n", enmVmState, VMR3GetStateName(enmVmState)), 3711 VERR_VM_INVALID_VM_STATE); 3712 3713 int rc = pgmLock(pVM); 3714 AssertRCReturn(rc, rc); 3715 3716 PPGMREGMMIORANGE pFirstMmio = pgmR3PhysMMIOExFind(pVM, pDevIns, iSubDev, iRegion); 3717 if (pFirstMmio) 3718 { 3719 Assert(pFirstMmio->fFlags & PGMREGMMIORANGE_F_FIRST_CHUNK); 3720 if (!(pFirstMmio->fFlags & PGMREGMMIORANGE_F_MAPPED)) 3721 { 3722 /* 3723 * NOTE! Current implementation does not support multiple ranges. 3724 * Implement when there is a real world need and thus a testcase. 3725 */ 3726 AssertLogRelMsgStmt(pFirstMmio->fFlags & PGMREGMMIORANGE_F_LAST_CHUNK, 3727 ("%s: %#x\n", pFirstMmio->RamRange.pszDesc, pFirstMmio->fFlags), 3728 rc = VERR_NOT_SUPPORTED); 3729 if (RT_SUCCESS(rc)) 3730 { 3731 /* 3732 * Make the change. 3733 */ 3734 Log(("PGMR3PhysMMIOExReduce: %s changes from %RGp bytes (%RGp) to %RGp bytes.\n", 3735 pFirstMmio->RamRange.pszDesc, pFirstMmio->RamRange.cb, pFirstMmio->cbReal, cbRegion)); 3736 3737 AssertLogRelMsgStmt(cbRegion <= pFirstMmio->cbReal, 3738 ("%s: cbRegion=%#RGp cbReal=%#RGp\n", pFirstMmio->RamRange.pszDesc, cbRegion, pFirstMmio->cbReal), 3739 rc = VERR_OUT_OF_RANGE); 3740 if (RT_SUCCESS(rc)) 3741 { 3742 pFirstMmio->RamRange.cb = cbRegion; 3743 } 3744 } 3745 } 3746 else 3747 rc = VERR_WRONG_ORDER; 3748 } 3749 else 3750 rc = VERR_NOT_FOUND; 3751 3752 pgmUnlock(pVM); 3753 return rc; 3676 3754 } 3677 3755
Note:
See TracChangeset
for help on using the changeset viewer.