Changeset 26717 in vbox
- Timestamp:
- Feb 23, 2010 4:04:28 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r26711 r26717 2939 2939 if (rc != VINF_SUCCESS) 2940 2940 { 2941 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2941 2942 AssertRC(rc); 2942 2943 return rc; … … 2955 2956 2956 2957 # if (PGM_SHW_TYPE == PGM_TYPE_EPT) && (HC_ARCH_BITS == 64) && defined(RT_OS_WINDOWS) 2957 if (PGMIsUsingLargePages(pVM)) 2958 { 2959 RTHCPHYS HCPhys; 2960 rc = pgmPhysAllocLargePage(pVM, GCPtrPage & SHW_PDE_PG_MASK, &HCPhys); 2958 { 2959 PPGMPAGE pPage; 2960 2961 /* Check if we allocated a big page before for this 2 MB range. */ 2962 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPtrPage & X86_PDE2M_PAE_PG_MASK, &pPage); 2961 2963 if (RT_SUCCESS(rc)) 2962 2964 { 2963 PdeDst.u &= X86_PDE_AVL_MASK; 2964 PdeDst.u |= HCPhys; 2965 PdeDst.n.u1Present = 1; 2966 PdeDst.n.u1Write = 1; 2967 PdeDst.n.u1Execute = 1; 2968 PdeDst.b.u1Size = 1; 2969 PdeDst.b.u1IgnorePAT = 1; 2970 PdeDst.b.u3EMT = VMX_EPT_MEMTYPE_WB; 2971 ASMAtomicWriteSize(pPdeDst, PdeDst.u); 2972 2973 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2974 return VINF_SUCCESS; 2975 2965 RTHCPHYS HCPhys = NIL_RTHCPHYS; 2966 2967 if (PGM_PAGE_GET_PDE_TYPE(pPage) == PGM_PAGE_PDE_TYPE_PDE) 2968 { 2969 AssertRelease(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED); 2970 HCPhys = PGM_PAGE_GET_HCPHYS(pPage); 2971 } 2972 else 2973 if (PGMIsUsingLargePages(pVM)) 2974 { 2975 rc = pgmPhysAllocLargePage(pVM, GCPtrPage); 2976 if (RT_SUCCESS(rc)) 2977 { 2978 Assert(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED); 2979 Assert(PGM_PAGE_GET_PDE_TYPE(pPage) == PGM_PAGE_PDE_TYPE_PDE); 2980 HCPhys = PGM_PAGE_GET_HCPHYS(pPage); 2981 } 2982 else 2983 LogFlow(("pgmPhysAllocLargePage failed with %Rrc\n", rc)); 2984 } 2985 2986 if (HCPhys != NIL_RTHCPHYS) 2987 { 2988 PdeDst.u &= X86_PDE_AVL_MASK; 2989 PdeDst.u |= HCPhys; 2990 PdeDst.n.u1Present = 1; 2991 PdeDst.n.u1Write = 1; 2992 PdeDst.n.u1Execute = 1; 2993 PdeDst.b.u1Size = 1; 2994 PdeDst.b.u1IgnorePAT = 1; 2995 PdeDst.b.u3EMT = VMX_EPT_MEMTYPE_WB; 2996 ASMAtomicWriteSize(pPdeDst, PdeDst.u); 2997 2998 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,SyncPT), a); 2999 return VINF_SUCCESS; 3000 } 2976 3001 } 2977 else2978 LogFlow(("pgmPhysAllocLargePage failed with %Rrc\n", rc));2979 3002 } 2980 3003 # endif -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r26686 r26717 371 371 && PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM) 372 372 { 373 RTHCPHYS HCPhysDummy; 374 375 int rc = pgmPhysAllocLargePage(pVM, GCPhys, &HCPhysDummy); 373 int rc = pgmPhysAllocLargePage(pVM, GCPhys); 376 374 if (rc == VINF_SUCCESS) 377 375 return rc; … … 468 466 * @param pVM The VM address. 469 467 * @param GCPhys The address of the page. 470 * @param pHCPhys Pointer to HC physical address (out)471 468 * 472 469 * @remarks Must be called from within the PGM critical section. It may 473 470 * nip back to ring-3/0 in some cases. 474 471 */ 475 int pgmPhysAllocLargePage(PVM pVM, RTGCPHYS GCPhys , RTHCPHYS *pHCPhys)472 int pgmPhysAllocLargePage(PVM pVM, RTGCPHYS GCPhys) 476 473 { 477 474 RTGCPHYS GCPhysBase = GCPhys & X86_PDE2M_PAE_PG_MASK; … … 483 480 Assert(PGMIsLocked(pVM)); 484 481 Assert(PGMIsUsingLargePages(pVM)); 485 Assert((GCPhys & X86_PD_PAE_MASK) == 0);486 AssertPtr(pHCPhys);487 482 488 483 PPGMPAGE pPage; … … 491 486 && PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM) 492 487 { 493 RTHCPHYS HCPhys = NIL_RTHCPHYS;494 488 unsigned uPDEType = PGM_PAGE_GET_PDE_TYPE(pPage); 495 489 496 if (uPDEType == PGM_PAGE_PDE_TYPE_PDE) 497 { 498 /* Previously allocated 2 MB range can be reused. */ 499 Assert(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED); 500 501 *pHCPhys = PGM_PAGE_GET_HCPHYS(pPage); 502 return VINF_SUCCESS; 503 } 504 else 490 /* Don't call this function for already allocated pages. */ 491 Assert(uPDEType != PGM_PAGE_PDE_TYPE_PDE); 492 505 493 if ( uPDEType == PGM_PAGE_PDE_TYPE_DONTCARE 506 494 && PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ZERO) … … 547 535 { 548 536 Assert(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED); 549 *pHCPhys = PGM_PAGE_GET_HCPHYS(pPage);550 537 STAM_COUNTER_INC(&pVM->pgm.s.StatLargePageUsed); 551 538 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.