Changeset 31208 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jul 29, 2010 1:08:04 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r31178 r31208 230 230 pVM->pgm.s.PhysTlbHC.aEntries[i].pv = 0; 231 231 } 232 /* @todo clear the RC TLB whenever we add it. */232 /** @todo clear the RC TLB whenever we add it. */ 233 233 pgmUnlock(pVM); 234 234 } … … 390 390 return rc; 391 391 392 /* fall back to 4 kbpages. */392 /* fall back to 4KB pages. */ 393 393 } 394 394 # endif … … 471 471 if (pvSharedPage) 472 472 { 473 /* Get the virtual address of the new page. */ 473 474 void *pvNewPage; 474 475 /* Get the virtual address of the new page. */476 475 rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, &pvNewPage); 477 476 AssertRC(rc); 478 477 if (rc == VINF_SUCCESS) 479 478 { 480 /** todo write ASMMemCopy*/479 /** @todo todo write ASMMemCopyPage */ 481 480 memcpy(pvNewPage, pvSharedPage, PAGE_SIZE); 482 481 } … … 1021 1020 { 1022 1021 Assert(PGMIsLocked(PGM2VM(pPGM))); 1023 STAM_COUNTER_INC(&pPGM->CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbMisses)); 1024 1025 /* 1026 * Find the ram range. 1022 1023 /* 1024 * Find the ram range and page and hand it over to the with-page function. 1027 1025 * 99.8% of requests are expected to be in the first range. 1028 1026 */ … … 1035 1033 pRam = pRam->CTX_SUFF(pNext); 1036 1034 if (!pRam) 1035 { 1036 STAM_COUNTER_INC(&pPGM->CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbMisses)); 1037 1037 return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS; 1038 } 1038 1039 off = GCPhys - pRam->GCPhys; 1039 1040 } while (off >= pRam->cb); 1040 1041 } 1041 1042 1043 return pgmPhysPageLoadIntoTlbWithPage(pPGM, &pRam->aPages[off >> PAGE_SHIFT], GCPhys); 1044 } 1045 1046 1047 /** 1048 * Load a guest page into the ring-3 physical TLB. 1049 * 1050 * @returns VBox status code. 1051 * @retval VINF_SUCCESS on success 1052 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 1053 * 1054 * @param pPGM The PGM instance pointer. 1055 * @param pPage Pointer to the PGMPAGE structure corresponding to 1056 * GCPhys. 1057 * @param GCPhys The guest physical address in question. 1058 */ 1059 int pgmPhysPageLoadIntoTlbWithPage(PPGM pPGM, PPGMPAGE pPage, RTGCPHYS GCPhys) 1060 { 1061 Assert(PGMIsLocked(PGM2VM(pPGM))); 1062 STAM_COUNTER_INC(&pPGM->CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbMisses)); 1063 1042 1064 /* 1043 1065 * Map the page. 1044 1066 * Make a special case for the zero page as it is kind of special. 1045 1067 */ 1046 PPGMPAGE pPage = &pRam->aPages[off >> PAGE_SHIFT];1047 1068 PPGMPAGEMAPTLBE pTlbe = &pPGM->CTXSUFF(PhysTlb).aEntries[PGM_PAGEMAPTLB_IDX(GCPhys)]; 1048 1069 if ( !PGM_PAGE_IS_ZERO(pPage) … … 1065 1086 } 1066 1087 #ifdef PGM_WITH_PHYS_TLB 1067 pTlbe->GCPhys = GCPhys & X86_PTE_PAE_PG_MASK; 1068 #else 1069 pTlbe->GCPhys = NIL_RTGCPHYS; 1070 #endif 1071 pTlbe->pPage = pPage; 1072 return VINF_SUCCESS; 1073 } 1074 1075 1076 /** 1077 * Load a guest page into the ring-3 physical TLB. 1078 * 1079 * @returns VBox status code. 1080 * @retval VINF_SUCCESS on success 1081 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 1082 * 1083 * @param pPGM The PGM instance pointer. 1084 * @param pPage Pointer to the PGMPAGE structure corresponding to 1085 * GCPhys. 1086 * @param GCPhys The guest physical address in question. 1087 */ 1088 int pgmPhysPageLoadIntoTlbWithPage(PPGM pPGM, PPGMPAGE pPage, RTGCPHYS GCPhys) 1089 { 1090 Assert(PGMIsLocked(PGM2VM(pPGM))); 1091 STAM_COUNTER_INC(&pPGM->CTX_SUFF(pStats)->CTX_MID_Z(Stat,PageMapTlbMisses)); 1092 1093 /* 1094 * Map the page. 1095 * Make a special case for the zero page as it is kind of special. 1096 */ 1097 PPGMPAGEMAPTLBE pTlbe = &pPGM->CTXSUFF(PhysTlb).aEntries[PGM_PAGEMAPTLB_IDX(GCPhys)]; 1098 if ( !PGM_PAGE_IS_ZERO(pPage) 1099 && !PGM_PAGE_IS_BALLOONED(pPage)) 1100 { 1101 void *pv; 1102 PPGMPAGEMAP pMap; 1103 int rc = pgmPhysPageMapCommon(PGM2VM(pPGM), pPage, GCPhys, &pMap, &pv); 1104 if (RT_FAILURE(rc)) 1105 return rc; 1106 pTlbe->pMap = pMap; 1107 pTlbe->pv = pv; 1108 Assert(!((uintptr_t)pTlbe->pv & PAGE_OFFSET_MASK)); 1109 } 1088 if ( PGM_PAGE_GET_TYPE(pPage) < PGMPAGETYPE_ROM_SHADOW 1089 || PGM_PAGE_GET_TYPE(pPage) > PGMPAGETYPE_ROM) 1090 pTlbe->GCPhys = GCPhys & X86_PTE_PAE_PG_MASK; 1110 1091 else 1111 { 1112 Assert(PGM_PAGE_GET_HCPHYS(pPage) == pPGM->HCPhysZeroPg); 1113 pTlbe->pMap = NULL; 1114 pTlbe->pv = pPGM->CTXALLSUFF(pvZeroPg); 1115 } 1116 #ifdef PGM_WITH_PHYS_TLB 1117 pTlbe->GCPhys = GCPhys & X86_PTE_PAE_PG_MASK; 1092 pTlbe->GCPhys = NIL_RTGCPHYS; /* ROM: Problematic because of the two pages. :-/ */ 1118 1093 #else 1119 1094 pTlbe->GCPhys = NIL_RTGCPHYS;
Note:
See TracChangeset
for help on using the changeset viewer.