Changeset 6529 in vbox
- Timestamp:
- Jan 28, 2008 2:58:18 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MM.cpp
r5999 r6529 143 143 if (!pVM->mm.s.pHeap) 144 144 { 145 int rc = mm r3HeapCreate(pVM, &pVM->mm.s.pHeap);145 int rc = mmR3HeapCreate(pVM, &pVM->mm.s.pHeap); 146 146 if (!VBOX_SUCCESS(rc)) 147 147 return rc; … … 151 151 * Init the page pool. 152 152 */ 153 int rc = mm r3PagePoolInit(pVM);153 int rc = mmR3PagePoolInit(pVM); 154 154 if (VBOX_SUCCESS(rc)) 155 155 { … … 157 157 * Init the hypervisor related stuff. 158 158 */ 159 rc = mm r3HyperInit(pVM);159 rc = mmR3HyperInit(pVM); 160 160 if (VBOX_SUCCESS(rc)) 161 161 { … … 288 288 * Destroy the page pool. (first as it used the hyper heap) 289 289 */ 290 mm r3PagePoolTerm(pVM);290 mmR3PagePoolTerm(pVM); 291 291 292 292 /* … … 320 320 if (!fKeepTheHeap) 321 321 { 322 mm r3HeapDestroy(pVM->mm.s.pHeap);322 mmR3HeapDestroy(pVM->mm.s.pHeap); 323 323 pVM->mm.s.pHeap = NULL; 324 324 } … … 339 339 /** 340 340 * Reset notification. 341 * 342 * MM will reload shadow ROMs into RAM at this point and make 341 * 342 * MM will reload shadow ROMs into RAM at this point and make 343 343 * the ROM writable. 344 * 344 * 345 345 * @param pVM The VM handle. 346 346 */ … … 430 430 * @param fSilentFailure Don't raise an error when unsuccessful. Upper layer with deal with it. 431 431 */ 432 int mm r3LockMem(PVM pVM, void *pv, size_t cb, MMLOCKEDTYPE eType, PMMLOCKEDMEM *ppLockedMem, bool fSilentFailure)432 int mmR3LockMem(PVM pVM, void *pv, size_t cb, MMLOCKEDTYPE eType, PMMLOCKEDMEM *ppLockedMem, bool fSilentFailure) 433 433 { 434 434 Assert(RT_ALIGN_P(pv, PAGE_SIZE) == pv); … … 500 500 * @param fFlags See the fFlags argument of PGR3Map(). 501 501 */ 502 int mm r3MapLocked(PVM pVM, PMMLOCKEDMEM pLockedMem, RTGCPTR Addr, unsigned iPage, size_t cPages, unsigned fFlags)502 int mmR3MapLocked(PVM pVM, PMMLOCKEDMEM pLockedMem, RTGCPTR Addr, unsigned iPage, size_t cPages, unsigned fFlags) 503 503 { 504 504 /* -
trunk/src/VBox/VMM/MMHeap.cpp
r5999 r6529 37 37 * Internal Functions * 38 38 *******************************************************************************/ 39 static void * mmr3HeapAlloc(PMMHEAP pHeap, MMTAG enmTag, size_t cbSize, bool fZero);39 static void *mmR3HeapAlloc(PMMHEAP pHeap, MMTAG enmTag, size_t cbSize, bool fZero); 40 40 41 41 … … 48 48 * @param ppHeap Where to store the heap pointer. 49 49 */ 50 int mm r3HeapCreate(PVM pVM, PMMHEAP *ppHeap)50 int mmR3HeapCreate(PVM pVM, PMMHEAP *ppHeap) 51 51 { 52 52 PMMHEAP pHeap = (PMMHEAP)RTMemAllocZ(sizeof(MMHEAP) + sizeof(MMHEAPSTAT)); … … 89 89 * @param pHeap Heap handle. 90 90 */ 91 void mm r3HeapDestroy(PMMHEAP pHeap)91 void mmR3HeapDestroy(PMMHEAP pHeap) 92 92 { 93 93 /* … … 137 137 if (!pVM->mm.s.pHeap) 138 138 { 139 int rc = mm r3HeapCreate(pVM, &pVM->mm.s.pHeap);139 int rc = mmR3HeapCreate(pVM, &pVM->mm.s.pHeap); 140 140 if (VBOX_FAILURE(rc)) 141 141 return NULL; 142 142 } 143 return mm r3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, false);143 return mmR3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, false); 144 144 } 145 145 … … 161 161 if (!pVM->mm.s.pHeap) 162 162 { 163 int rc = mm r3HeapCreate(pVM, &pVM->mm.s.pHeap);163 int rc = mmR3HeapCreate(pVM, &pVM->mm.s.pHeap); 164 164 if (VBOX_FAILURE(rc)) 165 165 return rc; 166 166 } 167 void *pv = mm r3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, false);167 void *pv = mmR3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, false); 168 168 if (pv) 169 169 { … … 190 190 if (!pVM->mm.s.pHeap) 191 191 { 192 int rc = mm r3HeapCreate(pVM, &pVM->mm.s.pHeap);192 int rc = mmR3HeapCreate(pVM, &pVM->mm.s.pHeap); 193 193 if (VBOX_FAILURE(rc)) 194 194 return NULL; 195 195 } 196 return mm r3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, true);196 return mmR3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, true); 197 197 } 198 198 … … 214 214 if (!pVM->mm.s.pHeap) 215 215 { 216 int rc = mm r3HeapCreate(pVM, &pVM->mm.s.pHeap);216 int rc = mmR3HeapCreate(pVM, &pVM->mm.s.pHeap); 217 217 if (VBOX_FAILURE(rc)) 218 218 return rc; 219 219 } 220 void *pv = mm r3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, true);220 void *pv = mmR3HeapAlloc(pVM->mm.s.pHeap, enmTag, cbSize, true); 221 221 if (pv) 222 222 { … … 239 239 * @param fZero Whether or not to zero the memory block. 240 240 */ 241 void * mm r3HeapAlloc(PMMHEAP pHeap, MMTAG enmTag, size_t cbSize, bool fZero)241 void * mmR3HeapAlloc(PMMHEAP pHeap, MMTAG enmTag, size_t cbSize, bool fZero) 242 242 { 243 243 #ifdef MMR3HEAP_WITH_STATISTICS -
trunk/src/VBox/VMM/MMHyper.cpp
r5999 r6529 55 55 * @returns VBox status. 56 56 */ 57 int mm r3HyperInit(PVM pVM)58 { 59 LogFlow(("mm r3HyperInit:\n"));57 int mmR3HyperInit(PVM pVM) 58 { 59 LogFlow(("mmR3HyperInit:\n")); 60 60 61 61 /* … … 113 113 DBGFR3InfoRegisterInternal(pVM, "hma", "Show the layout of the Hypervisor Memory Area.", mmR3HyperInfoHma); 114 114 115 LogFlow(("mm r3HyperInit: returns VINF_SUCCESS\n"));115 LogFlow(("mmR3HyperInit: returns VINF_SUCCESS\n")); 116 116 return VINF_SUCCESS; 117 117 } … … 120 120 } 121 121 122 LogFlow(("mm r3HyperInit: returns %Vrc\n", rc));122 LogFlow(("mmR3HyperInit: returns %Vrc\n", rc)); 123 123 return rc; 124 124 } … … 159 159 { 160 160 case MMLOOKUPHYPERTYPE_LOCKED: 161 rc = mm r3MapLocked(pVM, pLookup->u.Locked.pLockedMem, GCPtr, 0, cPages, 0);161 rc = mmR3MapLocked(pVM, pLookup->u.Locked.pLockedMem, GCPtr, 0, cPages, 0); 162 162 break; 163 163 … … 432 432 */ 433 433 PMMLOCKEDMEM pLockedMem; 434 rc = mm r3LockMem(pVM, pvHCPage, cb, fFree ? MM_LOCKED_TYPE_HYPER : MM_LOCKED_TYPE_HYPER_NOFREE, &pLockedMem, false /* fSilentFailure */);434 rc = mmR3LockMem(pVM, pvHCPage, cb, fFree ? MM_LOCKED_TYPE_HYPER : MM_LOCKED_TYPE_HYPER_NOFREE, &pLockedMem, false /* fSilentFailure */); 435 435 if (VBOX_SUCCESS(rc)) 436 436 { 437 437 /* map the stuff into guest address space. */ 438 438 if (pVM->mm.s.fPGMInitialized) 439 rc = mm r3MapLocked(pVM, pLockedMem, GCPtr, 0, ~(size_t)0, 0);439 rc = mmR3MapLocked(pVM, pLockedMem, GCPtr, 0, ~(size_t)0, 0); 440 440 if (VBOX_SUCCESS(rc)) 441 441 { … … 473 473 MMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages, const char *pszDesc, PRTGCPTR pGCPtr) 474 474 { 475 LogFlow(("MMR3HyperMapPages: pvR3=%p pvR0=%p cPages=%zu paPages=%p pszDesc=%p:{%s} pGCPtr=%p\n", 475 LogFlow(("MMR3HyperMapPages: pvR3=%p pvR0=%p cPages=%zu paPages=%p pszDesc=%p:{%s} pGCPtr=%p\n", 476 476 pvR3, pvR0, cPages, paPages, pszDesc, pszDesc, pGCPtr)); 477 477 … … 514 514 /* map the stuff into guest address space. */ 515 515 if (pVM->mm.s.fPGMInitialized) 516 rc = mm r3MapLocked(pVM, pLockedMem, GCPtr, 0, ~(size_t)0, 0);516 rc = mmR3MapLocked(pVM, pLockedMem, GCPtr, 0, ~(size_t)0, 0); 517 517 if (VBOX_SUCCESS(rc)) 518 518 { … … 938 938 sizeof(RTHCPTR) * 2, 939 939 pLookup->u.Locked.pLockedMem->eType == MM_LOCKED_TYPE_HYPER_NOFREE ? "nofree" 940 : pLookup->u.Locked.pLockedMem->eType == MM_LOCKED_TYPE_HYPER ? "autofree" 940 : pLookup->u.Locked.pLockedMem->eType == MM_LOCKED_TYPE_HYPER ? "autofree" 941 941 : pLookup->u.Locked.pLockedMem->eType == MM_LOCKED_TYPE_HYPER_PAGES ? "pages" 942 942 : pLookup->u.Locked.pLockedMem->eType == MM_LOCKED_TYPE_PHYS ? "gstphys" -
trunk/src/VBox/VMM/MMInternal.h
r5999 r6529 504 504 /** 505 505 * A registered Rom range. 506 * 506 * 507 507 * This is used to track ROM registrations both for debug reasons 508 508 * and for resetting shadow ROM at reset. 509 * 509 * 510 510 * This is allocated of the MMR3Heap and thus only accessibel from ring-3. 511 511 */ … … 680 680 681 681 682 int mm r3PagePoolInit(PVM pVM);683 void mm r3PagePoolTerm(PVM pVM);684 685 int mm r3HeapCreate(PVM pVM, PMMHEAP *ppHeap);686 void mm r3HeapDestroy(PMMHEAP pHeap);687 688 int mm r3HyperInit(PVM pVM);682 int mmR3PagePoolInit(PVM pVM); 683 void mmR3PagePoolTerm(PVM pVM); 684 685 int mmR3HeapCreate(PVM pVM, PMMHEAP *ppHeap); 686 void mmR3HeapDestroy(PMMHEAP pHeap); 687 688 int mmR3HyperInit(PVM pVM); 689 689 int mmR3HyperInitPaging(PVM pVM); 690 690 691 int mm r3LockMem(PVM pVM, void *pv, size_t cb, MMLOCKEDTYPE eType, PMMLOCKEDMEM *ppLockedMem, bool fSilentFailure);692 int mm r3MapLocked(PVM pVM, PMMLOCKEDMEM pLockedMem, RTGCPTR Addr, unsigned iPage, size_t cPages, unsigned fFlags);691 int mmR3LockMem(PVM pVM, void *pv, size_t cb, MMLOCKEDTYPE eType, PMMLOCKEDMEM *ppLockedMem, bool fSilentFailure); 692 int mmR3MapLocked(PVM pVM, PMMLOCKEDMEM pLockedMem, RTGCPTR Addr, unsigned iPage, size_t cPages, unsigned fFlags); 693 693 694 694 const char *mmR3GetTagName(MMTAG enmTag); -
trunk/src/VBox/VMM/MMPagePool.cpp
r6298 r6529 42 42 *******************************************************************************/ 43 43 #ifdef IN_RING3 44 static void * mm r3PagePoolAlloc(PMMPAGEPOOL pPool);45 static void mm r3PagePoolFree(PMMPAGEPOOL pPool, void *pv);44 static void * mmR3PagePoolAlloc(PMMPAGEPOOL pPool); 45 static void mmR3PagePoolFree(PMMPAGEPOOL pPool, void *pv); 46 46 #endif 47 47 … … 54 54 * @thread The Emulation Thread. 55 55 */ 56 int mm r3PagePoolInit(PVM pVM)56 int mmR3PagePoolInit(PVM pVM) 57 57 { 58 58 AssertMsg(!pVM->mm.s.pPagePool, ("Already initialized!\n")); … … 99 99 * @thread The Emulation Thread. 100 100 */ 101 void mm r3PagePoolTerm(PVM pVM)101 void mmR3PagePoolTerm(PVM pVM) 102 102 { 103 103 if (pVM->mm.s.pPagePool) … … 152 152 * @thread The Emulation Thread. 153 153 */ 154 DECLINLINE(void *) mm r3PagePoolAlloc(PMMPAGEPOOL pPool)154 DECLINLINE(void *) mmR3PagePoolAlloc(PMMPAGEPOOL pPool) 155 155 { 156 156 VM_ASSERT_EMT(pPool->pVM); … … 219 219 unsigned cPages = !pPool->fLow ? 128 : 32; 220 220 PMMPAGESUBPOOL pSub; 221 int rc = MMHyperAlloc(pPool->pVM, 221 int rc = MMHyperAlloc(pPool->pVM, 222 222 RT_OFFSETOF(MMPAGESUBPOOL, auBitmap[cPages / (sizeof(pSub->auBitmap[0] * 8))]) 223 223 + (sizeof(SUPPAGE) + sizeof(MMPPLOOKUPHCPHYS)) * cPages … … 313 313 if (pPool->fLow) 314 314 VMSetError(pPool->pVM, rc, RT_SRC_POS, 315 N_("Failed to expand page pool for memory below 4GB. current size: %d pages"), 315 N_("Failed to expand page pool for memory below 4GB. current size: %d pages"), 316 316 pPool->cPages); 317 317 AssertMsgFailed(("Failed to expand pool%s. rc=%Vrc poolsize=%d\n", … … 326 326 * @param pPool Pointer to the page pool. 327 327 * @param pv Pointer to the page to free. 328 * I.e. pointer returned by mm r3PagePoolAlloc().329 * @thread The Emulation Thread. 330 */ 331 DECLINLINE(void) mm r3PagePoolFree(PMMPAGEPOOL pPool, void *pv)328 * I.e. pointer returned by mmR3PagePoolAlloc(). 329 * @thread The Emulation Thread. 330 */ 331 DECLINLINE(void) mmR3PagePoolFree(PMMPAGEPOOL pPool, void *pv) 332 332 { 333 333 VM_ASSERT_EMT(pPool->pVM); … … 388 388 MMR3DECL(void *) MMR3PageAlloc(PVM pVM) 389 389 { 390 return mm r3PagePoolAlloc(pVM->mm.s.pPagePool);390 return mmR3PagePoolAlloc(pVM->mm.s.pPagePool); 391 391 } 392 392 … … 407 407 { 408 408 /** @todo optimize this, it's the most common case now. */ 409 void *pv = mm r3PagePoolAlloc(pVM->mm.s.pPagePool);409 void *pv = mmR3PagePoolAlloc(pVM->mm.s.pPagePool); 410 410 if (pv) 411 411 return mmPagePoolPtr2Phys(pVM->mm.s.pPagePool, pv); … … 424 424 MMR3DECL(void) MMR3PageFree(PVM pVM, void *pvPage) 425 425 { 426 mm r3PagePoolFree(pVM->mm.s.pPagePool, pvPage);426 mmR3PagePoolFree(pVM->mm.s.pPagePool, pvPage); 427 427 } 428 428 … … 438 438 MMR3DECL(void *) MMR3PageAllocLow(PVM pVM) 439 439 { 440 return mm r3PagePoolAlloc(pVM->mm.s.pPagePoolLow);440 return mmR3PagePoolAlloc(pVM->mm.s.pPagePoolLow); 441 441 } 442 442 … … 451 451 MMR3DECL(void) MMR3PageFreeLow(PVM pVM, void *pvPage) 452 452 { 453 mm r3PagePoolFree(pVM->mm.s.pPagePoolLow, pvPage);453 mmR3PagePoolFree(pVM->mm.s.pPagePoolLow, pvPage); 454 454 } 455 455 … … 470 470 pvPage = mmPagePoolPhys2Ptr(pVM->mm.s.pPagePoolLow, HCPhysPage); 471 471 if (pvPage) 472 mm r3PagePoolFree(pVM->mm.s.pPagePool, pvPage);472 mmR3PagePoolFree(pVM->mm.s.pPagePool, pvPage); 473 473 else 474 474 AssertMsgFailed(("Invalid address HCPhysPT=%#x\n", HCPhysPage)); … … 491 491 if (!pVM->mm.s.pvDummyPage) 492 492 { 493 pVM->mm.s.pvDummyPage = mm r3PagePoolAlloc(pVM->mm.s.pPagePool);493 pVM->mm.s.pvDummyPage = mmR3PagePoolAlloc(pVM->mm.s.pPagePool); 494 494 AssertRelease(pVM->mm.s.pvDummyPage); 495 495 pVM->mm.s.HCPhysDummyPage = mmPagePoolPtr2Phys(pVM->mm.s.pPagePool, pVM->mm.s.pvDummyPage); -
trunk/src/VBox/VMM/MMPhys.cpp
r5999 r6529 144 144 */ 145 145 PMMLOCKEDMEM pLockedMem; 146 rc = mm r3LockMem(pVM, pvRam, cb, MM_LOCKED_TYPE_PHYS, &pLockedMem, enmType == MM_PHYS_TYPE_DYNALLOC_CHUNK /* fSilentFailure */);146 rc = mmR3LockMem(pVM, pvRam, cb, MM_LOCKED_TYPE_PHYS, &pLockedMem, enmType == MM_PHYS_TYPE_DYNALLOC_CHUNK /* fSilentFailure */); 147 147 if (VBOX_SUCCESS(rc)) 148 148 { … … 278 278 * This must be cbRange bytes big. 279 279 * It will be copied and doesn't have to stick around. 280 * It will be copied and doesn't have to stick around if fShadow is clear. 280 * It will be copied and doesn't have to stick around if fShadow is clear. 281 281 * @param fShadow Whether to emulate ROM shadowing. This involves leaving 282 282 * the ROM writable for a while during the POST and refreshing … … 287 287 * manually from the device yet. At present I doubt we need such features... 288 288 */ 289 MMR3DECL(int) MMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const void *pvBinary, 289 MMR3DECL(int) MMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const void *pvBinary, 290 290 bool fShadow, const char *pszDesc) 291 291 { … … 357 357 { 358 358 /* 359 * To prevent the shadow page table mappings from being RW in raw-mode, we 359 * To prevent the shadow page table mappings from being RW in raw-mode, we 360 360 * must currently employ a little hack. We register an write access handler 361 361 * and thereby ensures a RO mapping of the pages. This is NOT very nice, … … 487 487 488 488 489 /** 489 /** 490 490 * Called by MMR3Reset to reset the shadow ROM. 491 * 492 * Resetting involves reloading the ROM into RAM and make it 491 * 492 * Resetting involves reloading the ROM into RAM and make it 493 493 * wriable again (as it was made read only at the end of the POST). 494 * 494 * 495 495 * @param pVM The VM handle. 496 496 */ … … 518 518 /** 519 519 * Write-protects a shadow ROM range. 520 * 520 * 521 521 * This is called late in the POST for shadow ROM ranges. 522 * 522 * 523 523 * @returns VBox status code. 524 524 * @param pVM The VM handle. 525 * @param GCPhys Start of the registered shadow ROM range 525 * @param GCPhys Start of the registered shadow ROM range 526 526 * @param cbRange The length of the registered shadow ROM range. 527 527 * This can be NULL (not sure about the BIOS interface yet). … … 530 530 { 531 531 for (PMMROMRANGE pCur = pVM->mm.s.pRomHead; pCur; pCur = pCur->pNext) 532 if ( pCur->GCPhys == GCPhys 533 && ( pCur->cbRange == cbRange 532 if ( pCur->GCPhys == GCPhys 533 && ( pCur->cbRange == cbRange 534 534 || !cbRange)) 535 535 { … … 546 546 rc = PGMR3PhysSetFlags(pVM, GCPhys, cbRange, 0, ~MM_RAM_FLAGS_MMIO2); /* ROM + MMIO2 -> ROM */ 547 547 AssertRCReturn(rc, rc); 548 /* Don't bother with the MM page flags here because I don't think they are 548 /* Don't bother with the MM page flags here because I don't think they are 549 549 really used beyond conflict checking at ROM, RAM, Reservation, etc. */ 550 550 -
trunk/src/VBox/VMM/VMMAll/MMAllHyper.cpp
r5999 r6529 149 149 static int mmHyperFree(PMMHYPERHEAP pHeap, PMMHYPERCHUNK pChunk); 150 150 #ifdef MMHYPER_HEAP_STRICT 151 static void mm r3HyperHeapCheck(PMMHYPERHEAP pHeap);151 static void mmR3HyperHeapCheck(PMMHYPERHEAP pHeap); 152 152 #endif 153 153 … … 299 299 Log3(("mmHyperAllocChunk: Enter cb=%#x uAlignment=%#x\n", cb, uAlignment)); 300 300 #ifdef MMHYPER_HEAP_STRICT 301 mm r3HyperHeapCheck(pHeap);301 mmR3HyperHeapCheck(pHeap); 302 302 #endif 303 303 … … 510 510 511 511 #ifdef MMHYPER_HEAP_STRICT 512 mm r3HyperHeapCheck(pHeap);512 mmR3HyperHeapCheck(pHeap); 513 513 #endif 514 514 return pRet; … … 531 531 532 532 #ifdef MMHYPER_HEAP_STRICT 533 mm r3HyperHeapCheck(pHeap);533 mmR3HyperHeapCheck(pHeap); 534 534 #endif 535 535 … … 615 615 616 616 #ifdef MMHYPER_HEAP_STRICT 617 mm r3HyperHeapCheck(pHeap);617 mmR3HyperHeapCheck(pHeap); 618 618 #endif 619 619 return pvRet; … … 859 859 860 860 #ifdef MMHYPER_HEAP_STRICT 861 mm r3HyperHeapCheck(pHeap);861 mmR3HyperHeapCheck(pHeap); 862 862 #endif 863 863 … … 1009 1009 1010 1010 #ifdef MMHYPER_HEAP_STRICT 1011 mm r3HyperHeapCheck(pHeap);1011 mmR3HyperHeapCheck(pHeap); 1012 1012 #endif 1013 1013 return VINF_SUCCESS; … … 1019 1019 * Internal consitency check. 1020 1020 */ 1021 static void mm r3HyperHeapCheck(PMMHYPERHEAP pHeap)1021 static void mmR3HyperHeapCheck(PMMHYPERHEAP pHeap) 1022 1022 { 1023 1023 PMMHYPERCHUNKFREE pPrev = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.