Changeset 26542 in vbox
- Timestamp:
- Feb 15, 2010 1:54:20 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r26413 r26542 366 366 /** Pointer to a GMM allocation chunk mapping. */ 367 367 typedef struct GMMCHUNKMAP *PGMMCHUNKMAP; 368 369 typedef enum GMMCHUNKTYPE 370 { 371 GMMCHUNKTYPE_INVALID = 0, 372 GMMCHUNKTYPE_NON_CONTINUOUS = 1, /* 4 kb pages */ 373 GMMCHUNKTYPE_CONTINUOUS = 2, /* one 2 MB continuous physical range. */ 374 GMMCHUNKTYPE_32BIT_HACK = 0x7fffffff 375 } GMMCHUNKTYPE; 368 376 369 377 … … 403 411 /** The number of shared pages. */ 404 412 uint16_t cShared; 405 #if HC_ARCH_BITS == 64 406 /** Reserved for later. */ 407 uint16_t au16Reserved[2]; 408 #endif 413 /** Chunk type */ 414 GMMCHUNKTYPE enmType; 409 415 /** The pages. */ 410 416 GMMPAGE aPages[GMM_CHUNK_SIZE >> PAGE_SHIFT]; … … 1527 1533 * 1528 1534 * @returns VBox status code. 1529 * @param pGMM Pointer to the GMM instance. 1530 * @param pSet Pointer to the set. 1531 * @param MemObj The memory object for the chunk. 1532 * @param hGVM The affinity of the chunk. NIL_GVM_HANDLE for no 1533 * affinity. 1534 */ 1535 static int gmmR0RegisterChunk(PGMM pGMM, PGMMCHUNKFREESET pSet, RTR0MEMOBJ MemObj, uint16_t hGVM) 1535 * @param pGMM Pointer to the GMM instance. 1536 * @param pSet Pointer to the set. 1537 * @param MemObj The memory object for the chunk. 1538 * @param hGVM The affinity of the chunk. NIL_GVM_HANDLE for no 1539 * affinity. 1540 * @param enmChunkType Chunk type (continuous or non-continuous) 1541 */ 1542 static int gmmR0RegisterChunk(PGMM pGMM, PGMMCHUNKFREESET pSet, RTR0MEMOBJ MemObj, uint16_t hGVM, GMMCHUNKTYPE enmChunkType) 1536 1543 { 1537 1544 Assert(hGVM != NIL_GVM_HANDLE || pGMM->fBoundMemoryMode); … … 1548 1555 pChunk->hGVM = hGVM; 1549 1556 pChunk->iFreeHead = 0; 1557 pChunk->enmType = enmChunkType; 1550 1558 for (unsigned iPage = 0; iPage < RT_ELEMENTS(pChunk->aPages) - 1; iPage++) 1551 1559 { … … 1599 1607 * 1600 1608 * @returns VBox status code. 1601 * @param pGMM Pointer to the GMM instance. 1602 * @param pSet Pointer to the set. 1603 * @param hGVM The affinity of the new chunk. 1609 * @param pGMM Pointer to the GMM instance. 1610 * @param pSet Pointer to the set. 1611 * @param hGVM The affinity of the new chunk. 1612 * @param enmChunkType Chunk type (continuous or non-continuous) 1604 1613 * 1605 1614 * @remarks Called without owning the mutex. 1606 1615 */ 1607 static int gmmR0AllocateOneChunk(PGMM pGMM, PGMMCHUNKFREESET pSet, uint16_t hGVM )1616 static int gmmR0AllocateOneChunk(PGMM pGMM, PGMMCHUNKFREESET pSet, uint16_t hGVM, GMMCHUNKTYPE enmChunkType) 1608 1617 { 1609 1618 /* … … 1611 1620 */ 1612 1621 RTR0MEMOBJ MemObj; 1613 int rc = RTR0MemObjAllocPhysNC(&MemObj, GMM_CHUNK_SIZE, NIL_RTHCPHYS); 1622 int rc; 1623 1624 AssertCompile(GMM_CHUNK_SIZE == _2M); 1625 AssertReturn(enmChunkType == GMMCHUNKTYPE_NON_CONTINUOUS || enmChunkType == GMMCHUNKTYPE_CONTINUOUS, VERR_INVALID_PARAMETER); 1626 1627 if (enmChunkType == GMMCHUNKTYPE_NON_CONTINUOUS) 1628 rc = RTR0MemObjAllocPhysNC(&MemObj, GMM_CHUNK_SIZE, NIL_RTHCPHYS); 1629 else 1630 rc = RTR0MemObjAllocPhysEx(&MemObj, GMM_CHUNK_SIZE, NIL_RTHCPHYS, GMM_CHUNK_SIZE); 1631 1614 1632 if (RT_SUCCESS(rc)) 1615 1633 { 1616 rc = gmmR0RegisterChunk(pGMM, pSet, MemObj, hGVM );1634 rc = gmmR0RegisterChunk(pGMM, pSet, MemObj, hGVM, enmChunkType); 1617 1635 if (RT_FAILURE(rc)) 1618 1636 RTR0MemObjFree(MemObj, false /* fFreeMappings */); … … 1670 1688 { 1671 1689 RTSemFastMutexRelease(pGMM->Mtx); 1672 int rc = gmmR0AllocateOneChunk(pGMM, pSet, pGVM->hSelf );1690 int rc = gmmR0AllocateOneChunk(pGMM, pSet, pGVM->hSelf, GMMCHUNKTYPE_NON_CONTINUOUS); 1673 1691 int rc2 = RTSemFastMutexRequest(pGMM->Mtx); 1674 1692 AssertRCReturn(rc2, rc2); … … 1707 1725 /* Allocate more. */ 1708 1726 RTSemFastMutexRelease(pGMM->Mtx); 1709 int rc = gmmR0AllocateOneChunk(pGMM, pSet, hGVM );1727 int rc = gmmR0AllocateOneChunk(pGMM, pSet, hGVM, GMMCHUNKTYPE_NON_CONTINUOUS); 1710 1728 int rc2 = RTSemFastMutexRequest(pGMM->Mtx); 1711 1729 AssertRCReturn(rc2, rc2); … … 3118 3136 * Add a new chunk with our hGVM. 3119 3137 */ 3120 rc = gmmR0RegisterChunk(pGMM, &pGMM->Private, MemObj, pGVM->hSelf );3138 rc = gmmR0RegisterChunk(pGMM, &pGMM->Private, MemObj, pGVM->hSelf, GMMCHUNKTYPE_NON_CONTINUOUS); 3121 3139 if (RT_FAILURE(rc)) 3122 3140 RTR0MemObjFree(MemObj, false /* fFreeMappings */);
Note:
See TracChangeset
for help on using the changeset viewer.

