Changeset 93617 in vbox for trunk/src/VBox
- Timestamp:
- Feb 6, 2022 8:35:16 AM (3 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r93595 r93617 141 141 AssertRCReturn(rc, rc); 142 142 143 pVCpu->pgm.s.pShwPageCR3R3 = (R3PTRTYPE(PPGMPOOLPAGE))MMHyperCCToR3(pVM, pNewShwPageCR3);144 pVCpu->pgm.s.pShwPageCR3R0 = (R0PTRTYPE(PPGMPOOLPAGE))MMHyperCCToR0(pVM, pNewShwPageCR3);143 pVCpu->pgm.s.pShwPageCR3R3 = pgmPoolConvertPageToR3(pPool, pNewShwPageCR3); 144 pVCpu->pgm.s.pShwPageCR3R0 = pgmPoolConvertPageToR0(pPool, pNewShwPageCR3); 145 145 146 146 /* Mark the page as locked; disallow flushing. */ … … 4243 4243 AssertFatalRC(rc2); 4244 4244 4245 pVCpu->pgm.s.CTX_SUFF(pShwPageCR3) = pNewShwPageCR3; 4246 # ifdef IN_RING0 4247 pVCpu->pgm.s.pShwPageCR3R3 = MMHyperCCToR3(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)); 4248 # else 4249 pVCpu->pgm.s.pShwPageCR3R0 = MMHyperCCToR0(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)); 4250 # endif 4245 pVCpu->pgm.s.pShwPageCR3R3 = pgmPoolConvertPageToR3(pPool, pNewShwPageCR3); 4246 pVCpu->pgm.s.pShwPageCR3R0 = pgmPoolConvertPageToR0(pPool, pNewShwPageCR3); 4251 4247 4252 4248 /* Set the current hypervisor CR3. */ -
trunk/src/VBox/VMM/VMMAll/PGMAllShw.h
r93554 r93617 245 245 AssertLogRelRCReturnStmt(rc, PGM_UNLOCK(pVM), rc); 246 246 247 pVCpu->pgm.s.pShwPageCR3R3 = (R3PTRTYPE(PPGMPOOLPAGE))MMHyperCCToR3(pVM, pNewShwPageCR3);248 pVCpu->pgm.s.pShwPageCR3R0 = (R0PTRTYPE(PPGMPOOLPAGE))MMHyperCCToR0(pVM, pNewShwPageCR3);247 pVCpu->pgm.s.pShwPageCR3R3 = pgmPoolConvertPageToR3(pVM->pgm.s.CTX_SUFF(pPool), pNewShwPageCR3); 248 pVCpu->pgm.s.pShwPageCR3R0 = pgmPoolConvertPageToR0(pVM->pgm.s.CTX_SUFF(pPool), pNewShwPageCR3); 249 249 250 250 PGM_UNLOCK(pVM); -
trunk/src/VBox/VMM/VMMR3/PGMPool.cpp
r93554 r93617 233 233 cb += cMaxPhysExts * sizeof(PGMPOOLPHYSEXT); 234 234 PPGMPOOL pPool; 235 rc = MMR3HyperAllocOnceNoRel(pVM, cb, 0, MM_TAG_PGM_POOL, (void **)&pPool); 235 RTR0PTR pPoolR0; 236 rc = SUPR3PageAllocEx(RT_ALIGN_32(cb, HOST_PAGE_SIZE) >> HOST_PAGE_SHIFT, 0 /*fFlags*/, (void **)&pPool, &pPoolR0, NULL); 236 237 if (RT_FAILURE(rc)) 237 238 return rc; 238 pVM->pgm.s.pPoolR3 = pPool; 239 pVM->pgm.s.pPoolR0 = MMHyperR3ToR0(pVM, pPool); 239 Assert(ASMMemIsZero(pPool, cb)); 240 pVM->pgm.s.pPoolR3 = pPool->pPoolR3 = pPool; 241 pVM->pgm.s.pPoolR0 = pPool->pPoolR0 = pPoolR0; 240 242 241 243 /* … … 250 252 PPGMPOOLUSER paUsers = (PPGMPOOLUSER)&pPool->aPages[pPool->cMaxPages]; 251 253 pPool->paUsersR3 = paUsers; 252 pPool->paUsersR0 = MMHyperR3ToR0(pVM, paUsers);254 pPool->paUsersR0 = pPoolR0 + (uintptr_t)paUsers - (uintptr_t)pPool; 253 255 for (unsigned i = 0; i < cMaxUsers; i++) 254 256 { … … 262 264 PPGMPOOLPHYSEXT paPhysExts = (PPGMPOOLPHYSEXT)&paUsers[cMaxUsers]; 263 265 pPool->paPhysExtsR3 = paPhysExts; 264 pPool->paPhysExtsR0 = MMHyperR3ToR0(pVM, paPhysExts);266 pPool->paPhysExtsR0 = pPoolR0 + (uintptr_t)paPhysExts - (uintptr_t)pPool; 265 267 for (unsigned i = 0; i < cMaxPhysExts; i++) 266 268 { -
trunk/src/VBox/VMM/include/PGMInternal.h
r93593 r93617 1984 1984 /** The VM handle - R0 Ptr. */ 1985 1985 R0PTRTYPE(PVMCC) pVMR0; 1986 /** The ring-3 pointer to this structure. */ 1987 R3PTRTYPE(struct PGMPOOL *) pPoolR3; 1988 /** The ring-0 pointer to this structure. */ 1989 R0PTRTYPE(struct PGMPOOL *) pPoolR0; 1986 1990 /** The max pool size. This includes the special IDs. */ 1987 1991 uint16_t cMaxPages; … … 3666 3670 void pgmPoolResetDirtyPage(PVMCC pVM, RTGCPTR GCPtrPage); 3667 3671 3672 /** Gets the ring-0 pointer for the given pool page. */ 3673 DECLINLINE(R0PTRTYPE(PPGMPOOLPAGE)) pgmPoolConvertPageToR0(PPGMPOOL pPool, PPGMPOOLPAGE pPage) 3674 { 3675 #ifdef IN_RING3 3676 size_t offPage = (uintptr_t)pPage - (uintptr_t)pPool; 3677 # ifdef VBOX_STRICT 3678 size_t iPage = (offPage - RT_UOFFSETOF(PGMPOOL, aPages)) / sizeof(*pPage); 3679 AssertReturn(iPage < pPool->cMaxPages, NIL_RTR0PTR); 3680 AssertReturn(iPage * sizeof(*pPage) + RT_UOFFSETOF(PGMPOOL, aPages) == offPage, NIL_RTR0PTR); 3681 # endif 3682 return pPool->pPoolR0 + offPage; 3683 #else 3684 RT_NOREF(pPool); 3685 return pPage; 3686 #endif 3687 } 3688 3689 /** Gets the ring-3 pointer for the given pool page. */ 3690 DECLINLINE(R3PTRTYPE(PPGMPOOLPAGE)) pgmPoolConvertPageToR3(PPGMPOOL pPool, PPGMPOOLPAGE pPage) 3691 { 3692 #ifdef IN_RING3 3693 RT_NOREF(pPool); 3694 return pPage; 3695 #else 3696 size_t offPage = (uintptr_t)pPage - (uintptr_t)pPool; 3697 # ifdef VBOX_STRICT 3698 size_t iPage = (offPage - RT_UOFFSETOF(PGMPOOL, aPages)) / sizeof(*pPage); 3699 AssertReturn(iPage < pPool->cMaxPages, NIL_RTR3PTR); 3700 AssertReturn(iPage * sizeof(*pPage) + RT_UOFFSETOF(PGMPOOL, aPages) == offPage, NIL_RTR3PTR); 3701 # endif 3702 return pPool->pPoolR3 + offPage; 3703 #endif 3704 } 3705 3668 3706 int pgmR3ExitShadowModeBeforePoolFlush(PVMCPU pVCpu); 3669 3707 int pgmR3ReEnterShadowModeAfterPoolFlush(PVM pVM, PVMCPU pVCpu);
Note:
See TracChangeset
for help on using the changeset viewer.