Changeset 26606 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Feb 17, 2010 12:40:42 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/GMM.cpp
r26577 r26606 315 315 316 316 /** 317 * @see GMMR0AllocateLargePage318 */319 GMMR3DECL(int) GMMR3AllocateLargePage(PVM pVM, uint32_t cbPage, uint32_t *pidPage, RTHCPHYS *pHCPhys)320 {321 GMMALLOCLARGEPAGEREQ Req;322 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;323 Req.Hdr.cbReq = sizeof(Req);324 Req.cbPage = cbPage;325 Req.idPage = NIL_GMM_PAGEID;326 int rc = VMMR3CallR0(pVM, VMMR0_DO_GMM_ALLOC_LARGE_PAGE, 0, &Req.Hdr);327 if (RT_SUCCESS(rc) && pidPage)328 *pidPage = Req.idPage;329 330 if (RT_SUCCESS(rc) && pHCPhys)331 *pHCPhys = Req.HCPhys;332 return rc;333 }334 335 /**336 317 * @see GMMR0FreeLargePage 337 318 */ -
trunk/src/VBox/VMM/PGMInternal.h
r26577 r26606 612 612 * - [8-9]: u2HandlerVirtStateY - the virtual handler state 613 613 * (PGM_PAGE_HNDL_VIRT_STATE_*). 614 * - [14]: u1LargePage - flag indicating that it's part of a large (2 MB) page 614 615 * - [15]: fWrittenToY - flag indicating that a write monitored page was 615 616 * written to when set. 616 * - [10-1 4]: 5unused bits.617 * - [10-13]: 4 unused bits. 617 618 * @remarks Warning! All accesses to the bits are hardcoded. 618 619 * … … 813 814 814 815 /** 815 * Marks the page tas written to (for GMM change monitoring).816 * Marks the page as written to (for GMM change monitoring). 816 817 * @param pPage Pointer to the physical guest page tracking structure. 817 818 */ … … 831 832 #define PGM_PAGE_IS_WRITTEN_TO(pPage) ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x80)) ) 832 833 834 /** 835 * Marks the page as part of a large continuous page 836 * @param pPage Pointer to the physical guest page tracking structure. 837 */ 838 #define PGM_PAGE_SET_LARGE_PAGE(pPage) do { (pPage)->u16MiscY.au8[1] |= UINT8_C(0x40); } while (0) 839 840 /** 841 * Clears the page as part of a large continuous page indicator. 842 * @param pPage Pointer to the physical guest page tracking structure. 843 */ 844 #define PGM_PAGE_CLEAR_LARGE_PAGE(pPage) do { (pPage)->u16MiscY.au8[1] &= UINT8_C(0xbf); } while (0) 845 846 /** 847 * Checks if the page was marked being part of a large page 848 * @returns true/false. 849 * @param pPage Pointer to the physical guest page tracking structure. 850 */ 851 #define PGM_PAGE_IS_LARGE_PAGE(pPage) ( !!((pPage)->u16MiscY.au8[1] & UINT8_C(0x40)) ) 833 852 834 853 /** Enabled optimized access handler tests. -
trunk/src/VBox/VMM/PGMPhys.cpp
r26577 r26606 3174 3174 * @param pVM The VM handle. 3175 3175 */ 3176 VMMR3DECL(int) PGMR3PhysAllocateLargePage(PVM pVM) 3177 { 3178 int rc = VINF_SUCCESS; 3179 uint32_t idPage; 3180 RTHCPHYS HCPhys; 3181 void *pvDummy; 3182 3176 VMMR3DECL(int) PGMR3PhysAllocateLargeHandyPage(PVM pVM) 3177 { 3183 3178 pgmLock(pVM); 3184 3179 3185 rc = GMMR3AllocateLargePage(pVM, _2M, &idPage, &HCPhys);3180 int rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_ALLOCATE_LARGE_HANDY_PAGE, 0, NULL); 3186 3181 if (RT_SUCCESS(rc)) 3187 3182 { 3188 /* Map the large page into our address space. */ 3189 rc = pgmPhysPageMapByPageID(pVM, idPage, HCPhys, &pvDummy); 3183 Assert(pVM->pgm.s.cLargeHandyPages == 1); 3184 3185 uint32_t idPage = pVM->pgm.s.aLargeHandyPage[0].idPage; 3186 RTHCPHYS HCPhys = pVM->pgm.s.aLargeHandyPage[0].HCPhysGCPhys; 3187 3188 /* 3189 * Clear the pages. 3190 */ 3191 for (unsigned i = 0; i < _2M/PAGE_SIZE; i++) 3192 { 3193 void *pv; 3194 3195 /* Map the large page into our address space. Could only fail the first time */ 3196 rc = pgmPhysPageMapByPageID(pVM, idPage, HCPhys, &pv); 3197 AssertLogRelMsgBreak(RT_SUCCESS(rc), ("idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc", idPage, HCPhys, rc)); 3198 ASMMemZeroPage(pv); 3199 idPage++; 3200 HCPhys += PAGE_SIZE; 3201 Log3(("PGMR3PhysAllocateLargePage: idPage=%#x HCPhys=%RGp\n", idPage, HCPhys)); 3202 } 3203 pVM->pgm.s.cLargeHandyPages = 0; 3190 3204 } 3191 3205 -
trunk/src/VBox/VMM/VMM.cpp
r26577 r26606 2073 2073 * Allocates a large page. 2074 2074 */ 2075 case VMMCALLRING3_PGM_ALLOCATE_LARGE_ PAGE:2076 { 2077 pVCpu->vmm.s.rcCallRing3 = PGMR3PhysAllocateLarge Page(pVM);2075 case VMMCALLRING3_PGM_ALLOCATE_LARGE_HANDY_PAGE: 2076 { 2077 pVCpu->vmm.s.rcCallRing3 = PGMR3PhysAllocateLargeHandyPage(pVM); 2078 2078 break; 2079 2079 } -
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r26577 r26606 2290 2290 * @param idCpu VCPU id 2291 2291 * @param cbPage Large page size 2292 * @param pidPage Id of the page (out) 2293 * @param HCPhys Host physical address of the page (out) 2294 */ 2295 GMMR0DECL(int) GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pidPage, RTHCPHYS *pHCPhys) 2292 */ 2293 GMMR0DECL(int) GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pIdPage, RTHCPHYS *pHCPhys) 2296 2294 { 2297 2295 LogFlow(("GMMR0AllocateLargePage: pVM=%p cbPage=%x\n", pVM, cbPage)); 2298 2296 2299 2297 AssertReturn(cbPage == GMM_CHUNK_SIZE, VERR_INVALID_PARAMETER); 2300 AssertPtrReturn(p idPage, VERR_INVALID_PARAMETER);2298 AssertPtrReturn(pIdPage, VERR_INVALID_PARAMETER); 2301 2299 AssertPtrReturn(pHCPhys, VERR_INVALID_PARAMETER); 2302 2300 … … 2315 2313 return VERR_NOT_SUPPORTED; 2316 2314 2317 *pidPage = NIL_GMM_PAGEID;2318 2315 *pHCPhys = NIL_RTHCPHYS; 2316 *pIdPage = NIL_GMM_PAGEID; 2319 2317 2320 2318 rc = RTSemFastMutexRequest(pGMM->Mtx); … … 2348 2346 gmmR0AllocatePage(pGMM, pGVM->hSelf, pChunk, &PageDesc); 2349 2347 /* Return the first page as we'll use the whole chunk as one big page. */ 2350 *p idPage = PageDesc.idPage;2348 *pIdPage = PageDesc.idPage; 2351 2349 *pHCPhys = PageDesc.HCPhysGCPhys; 2352 2350 … … 2367 2365 LogFlow(("GMMR0AllocatePages: returns %Rrc\n", rc)); 2368 2366 return rc; 2369 }2370 2371 2372 /**2373 * VMMR0 request wrapper for GMMR0AllocateLargePage.2374 *2375 * @returns see GMMR0AllocateLargePage.2376 * @param pVM Pointer to the shared VM structure.2377 * @param idCpu VCPU id2378 * @param pReq The request packet.2379 */2380 GMMR0DECL(int) GMMR0AllocateLargePageReq(PVM pVM, VMCPUID idCpu, PGMMALLOCLARGEPAGEREQ pReq)2381 {2382 /*2383 * Validate input and pass it on.2384 */2385 AssertPtrReturn(pVM, VERR_INVALID_POINTER);2386 AssertPtrReturn(pReq, VERR_INVALID_POINTER);2387 AssertMsgReturn(pReq->Hdr.cbReq == sizeof(GMMALLOCATEPAGESREQ),2388 ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(GMMALLOCATEPAGESREQ)),2389 VERR_INVALID_PARAMETER);2390 2391 return GMMR0AllocateLargePage(pVM, idCpu, pReq->cbPage, &pReq->idPage, &pReq->HCPhys);2392 2367 } 2393 2368 -
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r26233 r26606 164 164 } 165 165 166 /** 167 * Worker function for PGMR3PhysAllocateLargeHandyPage 168 * 169 * @returns The following VBox status codes. 170 * @retval VINF_SUCCESS on success. 171 * @retval VINF_EM_NO_MEMORY if we're out of memory. 172 * 173 * @param pVM The VM handle. 174 * @param pVCpu The VMCPU handle. 175 * 176 * @remarks Must be called from within the PGM critical section. The caller 177 * must clear the new pages. 178 */ 179 VMMR0DECL(int) PGMR0PhysAllocateLargeHandyPage(PVM pVM, PVMCPU pVCpu) 180 { 181 Assert(PDMCritSectIsOwnerEx(&pVM->pgm.s.CritSect, pVCpu->idCpu)); 182 183 Assert(!pVM->pgm.s.cLargeHandyPages); 184 int rc = GMMR0AllocateLargePage(pVM, pVCpu->idCpu, _2M, &pVM->pgm.s.aLargeHandyPage[0].idPage, &pVM->pgm.s.aLargeHandyPage[0].HCPhysGCPhys); 185 if (RT_SUCCESS(rc)) 186 pVM->pgm.s.cLargeHandyPages = 1; 187 188 return rc; 189 } 166 190 167 191 /** -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r26563 r26606 877 877 return PGMR0PhysAllocateHandyPages(pVM, &pVM->aCpus[idCpu]); 878 878 879 case VMMR0_DO_PGM_ALLOCATE_LARGE_HANDY_PAGE: 880 if (idCpu == NIL_VMCPUID) 881 return VERR_INVALID_CPU_ID; 882 return PGMR0PhysAllocateLargeHandyPage(pVM, &pVM->aCpus[idCpu]); 883 879 884 /* 880 885 * GMM wrappers. … … 894 899 return VERR_INVALID_PARAMETER; 895 900 return GMMR0AllocatePagesReq(pVM, idCpu, (PGMMALLOCATEPAGESREQ)pReqHdr); 896 897 case VMMR0_DO_GMM_ALLOC_LARGE_PAGE:898 if (u64Arg)899 return VERR_INVALID_PARAMETER;900 return GMMR0AllocateLargePageReq(pVM, idCpu, (PGMMALLOCLARGEPAGEREQ)pReqHdr);901 901 902 902 case VMMR0_DO_GMM_FREE_PAGES:
Note:
See TracChangeset
for help on using the changeset viewer.