Changeset 21094 in vbox for trunk/src/VBox
- Timestamp:
- Jun 30, 2009 6:53:15 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MMHyper.cpp
r20874 r21094 875 875 VMMR3DECL(int) MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag, void **ppv) 876 876 { 877 return MMR3HyperAllocOnceNoRelEx(pVM, cb, uAlignment, enmTag, 0/*fFlags*/, ppv); 878 } 879 880 881 /** 882 * Allocates memory in the Hypervisor (GC VMM) area which never will 883 * be freed and doesn't have any offset based relation to other heap blocks. 884 * 885 * The latter means that two blocks allocated by this API will not have the 886 * same relative position to each other in GC and HC. In short, never use 887 * this API for allocating nodes for an offset based AVL tree! 888 * 889 * The returned memory is of course zeroed. 890 * 891 * @returns VBox status code. 892 * @param pVM The VM to operate on. 893 * @param cb Number of bytes to allocate. 894 * @param uAlignment Required memory alignment in bytes. 895 * Values are 0,8,16,32 and PAGE_SIZE. 896 * 0 -> default alignment, i.e. 8 bytes. 897 * @param enmTag The statistics tag. 898 * @param fFlags Flags, see MMHYPER_AONR_FLAGS_KERNEL_MAPPING. 899 * @param ppv Where to store the address to the allocated memory. 900 * @remark This is assumed not to be used at times when serialization is required. 901 */ 902 VMMR3DECL(int) MMR3HyperAllocOnceNoRelEx(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag, uint32_t fFlags, void **ppv) 903 { 877 904 AssertMsg(cb >= 8, ("Hey! Do you really mean to allocate less than 8 bytes?! cb=%d\n", cb)); 905 Assert(!(fFlags & ~(MMHYPER_AONR_FLAGS_KERNEL_MAPPING))); 878 906 879 907 /* … … 884 912 if ( ( cb < _64K 885 913 && ( uAlignment != PAGE_SIZE 886 || cb < 48*_1K)) 887 || VMR3GetState(pVM) != VMSTATE_CREATING) 888 { 914 || cb < 48*_1K) 915 && !(fFlags & MMHYPER_AONR_FLAGS_KERNEL_MAPPING) 916 ) 917 || VMR3GetState(pVM) != VMSTATE_CREATING 918 ) 919 { 920 Assert(!(fFlags & MMHYPER_AONR_FLAGS_KERNEL_MAPPING)); 889 921 int rc = MMHyperAlloc(pVM, cb, uAlignment, enmTag, ppv); 890 922 if ( rc != VERR_MM_HYPER_NO_MEMORY … … 896 928 } 897 929 } 930 931 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 932 /* 933 * Set MMHYPER_AONR_FLAGS_KERNEL_MAPPING if we're in going to execute in ring-0. 934 */ 935 if (VMMIsHwVirtExtForced(pVM)) 936 fFlags |= MMHYPER_AONR_FLAGS_KERNEL_MAPPING; 937 #endif 898 938 899 939 /* … … 927 967 0 /*fFlags*/, 928 968 &pvPages, 929 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 930 VMMIsHwVirtExtForced(pVM) ? &pvR0 : NULL, 931 #else 932 NULL, 933 #endif 969 fFlags & MMHYPER_AONR_FLAGS_KERNEL_MAPPING ? &pvR0 : NULL, 934 970 paPages); 935 971 if (RT_SUCCESS(rc)) 936 972 { 973 if (!(fFlags & MMHYPER_AONR_FLAGS_KERNEL_MAPPING)) 937 974 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 938 if (!VMMIsHwVirtExtForced(pVM))939 975 pvR0 = NIL_RTR0PTR; 940 976 #else 941 pvR0 = (uintptr_t)pvPages;977 pvR0 = (RTR0PTR)pvPages; 942 978 #endif 979 943 980 memset(pvPages, 0, cbAligned); 944 981 -
trunk/src/VBox/VMM/VMM.cpp
r20875 r21094 299 299 300 300 # ifdef VBOX_WITH_R0_LOGGING 301 for ( unsignedi = 0; i < pVM->cCPUs; i++)301 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 302 302 { 303 303 PVMCPU pVCpu = &pVM->aCpus[i]; 304 304 305 rc = MMR3HyperAllocOnceNoRel(pVM, RT_OFFSETOF(VMMR0LOGGER, Logger.afGroups[pLogger->cGroups]), 306 0, MM_TAG_VMM, (void **)&pVCpu->vmm.s.pR0LoggerR3); 305 rc = MMR3HyperAllocOnceNoRelEx(pVM, RT_OFFSETOF(VMMR0LOGGER, Logger.afGroups[pLogger->cGroups]), 306 0, MM_TAG_VMM, MMHYPER_AONR_FLAGS_KERNEL_MAPPING, 307 (void **)&pVCpu->vmm.s.pR0LoggerR3); 307 308 if (RT_FAILURE(rc)) 308 309 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.