Changeset 14659 in vbox
- Timestamp:
- Nov 26, 2008 6:11:25 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp
r14607 r14659 23 23 * Internal Functions * 24 24 *******************************************************************************/ 25 #define LOG_GROUP LOG_GROUP_PGM 25 26 #include <VBox/pgm.h> 26 27 #include "../PGMInternal.h" … … 1112 1113 X86PGUINT uOld2 = uOld; NOREF(uOld2); 1113 1114 X86PGUINT uNew = (uOld & X86_PTE_G | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT) 1114 | X86_PTE_P | X86_PTE_ A | X86_PTE_D1115 | X86_PTE_P | X86_PTE_RW | X86_PTE_A | X86_PTE_D 1115 1116 | (HCPhys & X86_PTE_PG_MASK); 1116 1117 while (!ASMAtomicCmpXchgExU32(&paPages[iFreePage].uPte.pLegacy->u, uNew, uOld, &uOld)) … … 1122 1123 X86PGPAEUINT uOld2 = uOld; NOREF(uOld2); 1123 1124 X86PGPAEUINT uNew = (uOld & X86_PTE_G | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT) 1124 | X86_PTE_P | X86_PTE_ A | X86_PTE_D1125 | X86_PTE_P | X86_PTE_RW | X86_PTE_A | X86_PTE_D 1125 1126 | (HCPhys & X86_PTE_PAE_PG_MASK); 1126 1127 while (!ASMAtomicCmpXchgExU64(&paPages[iFreePage].uPte.pPae->u, uNew, uOld, &uOld)) 1127 1128 AssertMsgFailed(("uOld=%#llx uOld2=%#llx uNew=%#llx\n", uOld, uOld2, uNew)); 1129 Log6(("pgmR0DynMapPageSlow: #%x - %RHp %p %#llx\n", iFreePage, HCPhys, paPages[iFreePage].pvPage, uNew)); 1128 1130 } 1129 1131 return iFreePage; … … 1239 1241 VMMDECL(void) PGMDynMapStartAutoSet(PVMCPU pVCpu) 1240 1242 { 1243 Log6(("PGMDynMapStartAutoSet\n")); 1241 1244 Assert(pVCpu->pgm.s.AutoSet.cEntries == PGMMAPSET_CLOSED); 1242 1245 pVCpu->pgm.s.AutoSet.cEntries = 0; … … 1255 1258 1256 1259 /* close the set */ 1257 uint32_t i = p VCpu->pgm.s.AutoSet.cEntries;1258 AssertMsg(i <= RT_ELEMENTS(p VCpu->pgm.s.AutoSet.aEntries), ("%#x (%u)\n", i, i));1259 p VCpu->pgm.s.AutoSet.cEntries = PGMMAPSET_CLOSED;1260 uint32_t i = pSet->cEntries; 1261 AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i)); 1262 pSet->cEntries = PGMMAPSET_CLOSED; 1260 1263 1261 1264 /* release any pages we're referencing. */ 1262 if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(p VCpu->pgm.s.AutoSet.aEntries)))1265 if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries))) 1263 1266 { 1264 1267 PPGMR0DYNMAP pThis = g_pPGMR0DynMap; … … 1281 1284 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 1282 1285 } 1283 } 1284 1285 1286 /** 1287 * Migrates the automatic mapping set of the current vCPU if necessary. 1286 Log6(("PGMDynMapReleaseAutoSet\n")); 1287 } 1288 1289 1290 /** 1291 * Migrates the automatic mapping set of the current vCPU if it's active and 1292 * necessary. 1288 1293 * 1289 1294 * This is called when re-entering the hardware assisted execution mode after a … … 1299 1304 { 1300 1305 PPGMMAPSET pSet = &pVCpu->pgm.s.AutoSet; 1301 uint32_t i = pVCpu->pgm.s.AutoSet.cEntries; 1302 AssertMsg(i <= RT_ELEMENTS(pVCpu->pgm.s.AutoSet.aEntries), ("%#x (%u)\n", i, i)); 1303 if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pVCpu->pgm.s.AutoSet.aEntries))) 1304 { 1305 PPGMR0DYNMAP pThis = g_pPGMR0DynMap; 1306 RTCPUID idRealCpu = RTMpCpuId(); 1307 1308 while (i-- > 0) 1309 { 1310 Assert(pSet->aEntries[i].cRefs > 0); 1311 uint32_t iPage = pSet->aEntries[i].iPage; 1312 Assert(iPage < pThis->cPages); 1313 if (RTCpuSetIsMember(&pThis->paPages[iPage].PendingSet, idRealCpu)) 1314 { 1315 RTCpuSetDel(&pThis->paPages[iPage].PendingSet, idRealCpu); 1316 ASMInvalidatePage(pThis->paPages[iPage].pvPage); 1317 } 1318 } 1306 uint32_t i = pSet->cEntries; 1307 if (i != PGMMAPSET_CLOSED) 1308 { 1309 AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i)); 1310 if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries))) 1311 { 1312 PPGMR0DYNMAP pThis = g_pPGMR0DynMap; 1313 RTCPUID idRealCpu = RTMpCpuId(); 1314 1315 while (i-- > 0) 1316 { 1317 Assert(pSet->aEntries[i].cRefs > 0); 1318 uint32_t iPage = pSet->aEntries[i].iPage; 1319 Assert(iPage < pThis->cPages); 1320 if (RTCpuSetIsMember(&pThis->paPages[iPage].PendingSet, idRealCpu)) 1321 { 1322 RTCpuSetDel(&pThis->paPages[iPage].PendingSet, idRealCpu); 1323 ASMInvalidatePage(pThis->paPages[iPage].pvPage); 1324 } 1325 } 1326 } 1327 Log6(("PGMDynMapMigrateAutoSet\n")); 1319 1328 } 1320 1329 }
Note:
See TracChangeset
for help on using the changeset viewer.