Changeset 14589 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Nov 25, 2008 6:16:51 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MMHyper.cpp
r14543 r14589 783 783 const uint32_t cbAligned = RT_ALIGN_32(cb, PAGE_SIZE); 784 784 AssertReturn(cbAligned >= cb, VERR_INVALID_PARAMETER); 785 uint32_t const cPages = cb >> PAGE_SHIFT; 785 786 int rc; 786 787 void *pv; 787 RTR0PTR pvR0; 788 #if 1 788 RTR0PTR pvR0 = NIL_RTR0PTR; 789 #if 0 790 PSUPPAGE paPages = NULL; 789 791 rc = SUPPageAlloc(cbAligned >> PAGE_SHIFT, &pv); /** @todo #1865: heap allocation must be changed for osx (only). */ 790 pvR0 = (uintptr_t)pv;791 792 #else /**@todo resume here. */ 792 if (VMMIsHwVirtExtForced(pVM)) 793 rc = SUPPageAllocKernel((cbAligned >> PAGE_SHIFT, &pv, &pvR0, paPages); 794 else 795 { 796 rc = SUPPageAllocLocked((cbAligned >> PAGE_SHIFT, &pv, paPages); 797 pvR0 = (uintptr_t)pv; 798 } 793 PSUPPAGE paPages = (PSUPPAGE)MMR3HeapAlloc(pVM, MM_TAG_MM, cPages * sizeof(paPages[0])); 794 if (!paPages) 795 return VERR_NO_MEMORY; 796 rc = SUPR3PageAllocEx(cPages, 797 0 /*fFlags*/, 798 &pv, 799 VMMIsHwVirtExtForced(pVM) ? &pvR0 : NULL, 800 paPages); 799 801 #endif 800 802 if (RT_SUCCESS(rc)) 801 803 { 804 if (!VMMIsHwVirtExtForced(pVM)) 805 pvR0 = (uintptr_t)pv; 806 memset(pv, 0, cbAligned); 807 802 808 /* 803 809 * Initialize the heap and first free chunk. … … 806 812 pHeap->u32Magic = MMHYPERHEAP_MAGIC; 807 813 pHeap->pbHeapR3 = (uint8_t *)pHeap + MMYPERHEAP_HDR_SIZE; 808 pHeap->pbHeapR0 = (uintptr_t)pHeap->pbHeapR3; /** @todo #1865: Map heap into ring-0 on darwin. */809 //pHeap->pbHeap GC = 0; // set by mmR3HyperHeapMap()814 pHeap->pbHeapR0 = pvR0 + MMYPERHEAP_HDR_SIZE; 815 //pHeap->pbHeapRC = 0; // set by mmR3HyperHeapMap() 810 816 pHeap->pVMR3 = pVM; 811 817 pHeap->pVMR0 = pVM->pVMR0; … … 817 823 pHeap->offPageAligned = pHeap->cbHeap; 818 824 //pHeap->HyperHeapStatTree = 0; 825 pHeap->paPages = paPages; 819 826 820 827 PMMHYPERCHUNKFREE pFree = (PMMHYPERCHUNKFREE)pHeap->pbHeapR3; … … 844 851 static int mmR3HyperHeapMap(PVM pVM, PMMHYPERHEAP pHeap, PRTGCPTR ppHeapGC) 845 852 { 846 int rc = MMR3HyperMapHCRam(pVM, pHeap, pHeap->cbHeap + MMYPERHEAP_HDR_SIZE, true, "Heap", ppHeapGC); 853 Assert(RT_ALIGN_Z(pHeap->cbHeap + MMYPERHEAP_HDR_SIZE, PAGE_SIZE) == pHeap->cbHeap + MMYPERHEAP_HDR_SIZE); 854 Assert(pHeap->paPages); 855 int rc = MMR3HyperMapPages(pVM, 856 pHeap, 857 pHeap->pbHeapR0 - MMYPERHEAP_HDR_SIZE, 858 (pHeap->cbHeap + MMYPERHEAP_HDR_SIZE) >> PAGE_SHIFT, 859 pHeap->paPages, 860 "Heap", ppHeapGC); 847 861 if (RT_SUCCESS(rc)) 848 862 { … … 851 865 /* Reserve a page for fencing. */ 852 866 MMR3HyperReserve(pVM, PAGE_SIZE, "fence", NULL); 867 868 /* We won't need these any more. */ 869 MMR3HeapFree(pHeap->paPages); 870 pHeap->paPages = NULL; 853 871 } 854 872 return rc; -
trunk/src/VBox/VMM/MMInternal.h
r14155 r14589 281 281 uint32_t u32Padding0; 282 282 #endif 283 /** The heap physical pages. */ 284 R3PTRTYPE(PSUPPAGE) paPages; 285 #if HC_ARCH_BITS == 32 286 /** Padding the structure to a 64-bit aligned size. */ 287 uint32_t u32Padding1; 288 #endif 283 289 } MMHYPERHEAP; 284 290 /** Pointer to the hypervisor heap. */ -
trunk/src/VBox/VMM/MMPagePool.cpp
r14157 r14589 68 68 * ring-0. Need to change the wasy we allocate it... */ 69 69 AssertReleaseReturn(sizeof(*pVM->mm.s.pPagePoolR3) + sizeof(*pVM->mm.s.pPagePoolLowR3) < PAGE_SIZE, VERR_INTERNAL_ERROR); 70 int rc = SUPPageAllocLocked (1, (void **)&pVM->mm.s.pPagePoolR3);70 int rc = SUPPageAllocLockedEx(1, (void **)&pVM->mm.s.pPagePoolR3, NULL); 71 71 if (RT_FAILURE(rc)) 72 72 return rc; -
trunk/src/VBox/VMM/PGMPhys.cpp
r14075 r14589 677 677 if (RT_SUCCESS(rc)) 678 678 { 679 memset(pvPages, 0, cPages * PAGE_SIZE); 680 679 681 /* 680 682 * Create the MMIO2 range record for it.
Note:
See TracChangeset
for help on using the changeset viewer.