Changeset 18430 in vbox
- Timestamp:
- Mar 28, 2009 2:03:31 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/VMM/MMHyper.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MMHyper.cpp
r18429 r18430 892 892 * Allocate the pages and map them into HMA space. 893 893 */ 894 cb = RT_ALIGN(cb, PAGE_SIZE); 895 uint32_t const cPages = cb >> PAGE_SHIFT; 896 PSUPPAGE paPages = (PSUPPAGE)RTMemTmpAlloc(cPages * sizeof(paPages[0])); 894 uint32_t const cbAligned = RT_ALIGN_32(cb, PAGE_SIZE); 895 AssertReturn(cbAligned >= cb, VERR_INVALID_PARAMETER); 896 uint32_t const cPages = cbAligned >> PAGE_SHIFT; 897 PSUPPAGE paPages = (PSUPPAGE)RTMemTmpAlloc(cPages * sizeof(paPages[0])); 897 898 if (!paPages) 898 899 return VERR_NO_TMP_MEMORY; … … 916 917 pvR0 = (uintptr_t)pvPages; 917 918 #endif 918 memset(pvPages, 0, cb );919 memset(pvPages, 0, cbAligned); 919 920 920 921 RTGCPTR GCPtr; … … 929 930 { 930 931 *ppv = pvPages; 931 Log2(("MMR3HyperAllocOnceNoRel: cb =%#x uAlignment=%#x returns VINF_SUCCESS and *ppv=%p\n",932 cb , uAlignment, *ppv));932 Log2(("MMR3HyperAllocOnceNoRel: cbAligned=%#x uAlignment=%#x returns VINF_SUCCESS and *ppv=%p\n", 933 cbAligned, uAlignment, *ppv)); 933 934 MMR3HyperReserve(pVM, PAGE_SIZE, "fence", NULL); 934 935 return rc; 935 936 } 936 AssertMsgFailed(("Failed to allocate %zd bytes! %Rrc\n", cb , rc));937 AssertMsgFailed(("Failed to allocate %zd bytes! %Rrc\n", cbAligned, rc)); 937 938 SUPR3PageFreeEx(pvPages, cPages); 938 939 … … 943 944 */ 944 945 /** @todo make a proper fix for this so we will never end up in this kind of situation! */ 945 Log(("MMR3HyperAllocOnceNoRel: MMR3HyperMapHCRam failed with rc=%Rrc, try MMHyperAlloc(,%# d,,) instead\n", rc, cb));946 Log(("MMR3HyperAllocOnceNoRel: MMR3HyperMapHCRam failed with rc=%Rrc, try MMHyperAlloc(,%#x,,) instead\n", rc, cb)); 946 947 int rc2 = MMHyperAlloc(pVM, cb, uAlignment, enmTag, ppv); 947 948 if (RT_SUCCESS(rc2)) … … 953 954 } 954 955 else 955 AssertMsgFailed(("Failed to allocate %zd bytes! %Rrc\n", cb , rc));956 AssertMsgFailed(("Failed to allocate %zd bytes! %Rrc\n", cbAligned, rc)); 956 957 957 958 if (rc == VERR_NO_MEMORY)
Note:
See TracChangeset
for help on using the changeset viewer.

