Changeset 23460 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 1, 2009 2:02:51 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53057
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r23453 r23460 1069 1069 if (pMap) 1070 1070 pMap->cRefs++; 1071 # if 0 /** @todo implement locking properly */ 1072 if (RT_LIKELY(pPage->cLocks != PGM_PAGE_MAX_LOCKS)) 1073 if (RT_UNLIKELY(++pPage->cLocks == PGM_PAGE_MAX_LOCKS)) 1074 { 1075 AssertMsgFailed(("%RGp is entering permanent locked state!\n", GCPhys)); 1076 if (pMap) 1077 pMap->cRefs++; /* Extra ref to prevent it from going away. */ 1078 } 1071 1072 # ifdef PGM_PAGE_WITH_LOCKS 1073 unsigned cLocks = PGM_PAGE_GET_WRITE_LOCKS(pPage); 1074 if (RT_LIKELY(cLocks < PGM_PAGE_MAX_LOCKS - 1)) 1075 PGM_PAGE_INC_WRITE_LOCKS(pPage); 1076 else if (cLocks != PGM_PAGE_GET_WRITE_LOCKS(pPage)) 1077 { 1078 PGM_PAGE_INC_WRITE_LOCKS(pPage); 1079 AssertMsgFailed(("%RGp / %R[pgmpage] is entering permanent write locked state!\n", GCPhys, pPage)); 1080 if (pMap) 1081 pMap->cRefs++; /* Extra ref to prevent it from going away. */ 1082 } 1079 1083 # endif 1084 1080 1085 *ppv = (void *)((uintptr_t)pTlbe->pv | (GCPhys & PAGE_OFFSET_MASK)); 1081 pLock-> pvPage = pPage;1086 pLock->uPageAndType = (uintptr_t)pPage | PGMPAGEMAPLOCK_TYPE_WRITE; 1082 1087 pLock->pvMap = pMap; 1083 1088 } … … 1164 1169 if (pMap) 1165 1170 pMap->cRefs++; 1166 # if 0 /** @todo implement locking properly */ 1167 if (RT_LIKELY(pPage->cLocks != PGM_PAGE_MAX_LOCKS)) 1168 if (RT_UNLIKELY(++pPage->cLocks == PGM_PAGE_MAX_LOCKS)) 1169 { 1170 AssertMsgFailed(("%RGp is entering permanent locked state!\n", GCPhys)); 1171 if (pMap) 1172 pMap->cRefs++; /* Extra ref to prevent it from going away. */ 1173 } 1171 1172 # ifdef PGM_PAGE_WITH_LOCKS 1173 unsigned cLocks = PGM_PAGE_GET_READ_LOCKS(pPage); 1174 if (RT_LIKELY(cLocks < PGM_PAGE_MAX_LOCKS - 1)) 1175 PGM_PAGE_INC_READ_LOCKS(pPage); 1176 else if (cLocks != PGM_PAGE_GET_READ_LOCKS(pPage)) 1177 { 1178 PGM_PAGE_INC_READ_LOCKS(pPage); 1179 AssertMsgFailed(("%RGp / %R[pgmpage] is entering permanent readonly locked state!\n", GCPhys, pPage)); 1180 if (pMap) 1181 pMap->cRefs++; /* Extra ref to prevent it from going away. */ 1182 } 1174 1183 # endif 1184 1175 1185 *ppv = (void *)((uintptr_t)pTlbe->pv | (GCPhys & PAGE_OFFSET_MASK)); 1176 pLock-> pvPage = pPage;1186 pLock->uPageAndType = (uintptr_t)pPage | PGMPAGEMAPLOCK_TYPE_READ; 1177 1187 pLock->pvMap = pMap; 1178 1188 } … … 1274 1284 1275 1285 #else /* IN_RING3 */ 1276 PPGMPAGEMAP pMap = (PPGMPAGEMAP)pLock->pvMap; 1277 if (!pMap) 1278 { 1279 /* The ZERO page and MMIO2 ends up here. */ 1280 Assert(pLock->pvPage); 1281 pLock->pvPage = NULL; 1286 PPGMPAGEMAP pMap = (PPGMPAGEMAP)pLock->pvMap; 1287 PPGMPAGE pPage = (PPGMPAGE)(pLock->uPageAndType & ~PGMPAGEMAPLOCK_TYPE_MASK); 1288 bool fWriteLock = (pLock->uPageAndType & PGMPAGEMAPLOCK_TYPE_MASK) == PGMPAGEMAPLOCK_TYPE_WRITE; 1289 1290 pLock->uPageAndType = 0; 1291 pLock->pvMap = NULL; 1292 1293 pgmLock(pVM); 1294 # ifdef PGM_PAGE_WITH_LOCKS 1295 if (fWriteLock) 1296 { 1297 unsigned cLocks = PGM_PAGE_GET_WRITE_LOCKS(pPage); 1298 Assert(cLocks > 0); 1299 if (RT_LIKELY(cLocks > 0 && cLocks < PGM_PAGE_MAX_LOCKS)) 1300 PGM_PAGE_DEC_WRITE_LOCKS(pPage); 1301 1302 if (PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_WRITE_MONITORED) 1303 { 1304 PGM_PAGE_SET_WRITTEN_TO(pPage); 1305 PGM_PAGE_SET_STATE(pPage, PGM_PAGE_STATE_ALLOCATED); 1306 Assert(pVM->pgm.s.cMonitoredPages > 0); 1307 pVM->pgm.s.cMonitoredPages--; 1308 pVM->pgm.s.cWrittenToPages++; 1309 } 1282 1310 } 1283 1311 else 1284 1312 { 1285 pgmLock(pVM);1286 1287 # if 0 /** @todo implement page locking */ 1288 PPGMPAGE pPage = (PPGMPAGE)pLock->pvPage;1289 Assert(pPage->cLocks >= 1);1290 if (pPage->cLocks != PGM_PAGE_MAX_LOCKS) 1291 pPage->cLocks--; 1292 # endif 1293 1313 unsigned cLocks = PGM_PAGE_GET_READ_LOCKS(pPage); 1314 Assert(cLocks > 0); 1315 if (RT_LIKELY(cLocks > 0 && cLocks < PGM_PAGE_MAX_LOCKS)) 1316 PGM_PAGE_DEC_READ_LOCKS(pPage); 1317 } 1318 #endif 1319 1320 if (pMap) 1321 { 1294 1322 Assert(pMap->cRefs >= 1); 1295 1323 pMap->cRefs--; 1296 1324 pMap->iAge = 0; 1297 1298 pgmUnlock(pVM); 1299 } 1325 } 1326 pgmUnlock(pVM); 1300 1327 #endif /* IN_RING3 */ 1301 1328 }
Note:
See TracChangeset
for help on using the changeset viewer.