Changeset 20765 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jun 22, 2009 11:36:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r20709 r20765 901 901 LogFlow(("PGMHandlerPhysicalPageTempOff GCPhys=%RGp\n", GCPhys)); 902 902 903 pgmLock(pVM); 903 904 /* 904 905 * Validate the range. … … 913 914 Assert((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK); 914 915 915 AssertReturn ( pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE916 AssertReturnStmt( pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE 916 917 || pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL, 917 VERR_ACCESS_DENIED);918 pgmUnlock(pVM), VERR_ACCESS_DENIED); 918 919 919 920 /* … … 922 923 PPGMPAGE pPage; 923 924 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPhysPage, &pPage); 924 AssertR CReturn(rc, rc);925 AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc); 925 926 PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, PGM_PAGE_HNDL_PHYS_STATE_DISABLED); 927 pgmUnlock(pVM); 926 928 #ifndef IN_RC 927 929 HWACCMInvalidatePhysPage(pVM, GCPhysPage); … … 929 931 return VINF_SUCCESS; 930 932 } 931 933 pgmUnlock(pVM); 932 934 AssertMsgFailed(("The page %#x is outside the range %#x-%#x\n", 933 935 GCPhysPage, pCur->Core.Key, pCur->Core.KeyLast)); 934 936 return VERR_INVALID_PARAMETER; 935 937 } 936 938 pgmUnlock(pVM); 937 939 AssertMsgFailed(("Specified physical handler start address %#x is invalid.\n", GCPhys)); 938 940 return VERR_PGM_HANDLER_NOT_FOUND; … … 984 986 /// Assert(!IOMIsLockOwner(pVM)); /* We mustn't own any other locks when calling this */ 985 987 988 pgmLock(pVM); 986 989 /* 987 990 * Lookup and validate the range. … … 993 996 && GCPhysPage <= pCur->Core.KeyLast)) 994 997 { 995 AssertReturn (pCur->enmType == PGMPHYSHANDLERTYPE_MMIO, VERR_ACCESS_DENIED);996 AssertReturn (!(pCur->Core.Key & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);997 AssertReturn ((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, VERR_INVALID_PARAMETER);998 AssertReturnStmt(pCur->enmType == PGMPHYSHANDLERTYPE_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED); 999 AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), pgmUnlock(pVM), VERR_INVALID_PARAMETER); 1000 AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, pgmUnlock(pVM), VERR_INVALID_PARAMETER); 998 1001 999 1002 /* … … 1002 1005 PPGMPAGE pPageRemap; 1003 1006 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPhysPageRemap, &pPageRemap); 1004 AssertR CReturn(rc, rc);1005 AssertMsgReturn (PGM_PAGE_GET_TYPE(pPageRemap) == PGMPAGETYPE_MMIO2,1007 AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc); 1008 AssertMsgReturnStmt(PGM_PAGE_GET_TYPE(pPageRemap) == PGMPAGETYPE_MMIO2, 1006 1009 ("GCPhysPageRemap=%RGp %R[pgmpage]\n", GCPhysPageRemap, pPageRemap), 1007 VERR_PGM_PHYS_NOT_MMIO2);1010 pgmUnlock(pVM), VERR_PGM_PHYS_NOT_MMIO2); 1008 1011 1009 1012 PPGMPAGE pPage; 1010 1013 rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPhysPage, &pPage); 1011 AssertR CReturn(rc, rc);1014 AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc); 1012 1015 if (PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO) 1013 1016 { … … 1016 1019 VERR_PGM_PHYS_NOT_MMIO2); 1017 1020 if (PGM_PAGE_GET_HCPHYS(pPage) == PGM_PAGE_GET_HCPHYS(pPageRemap)) 1021 { 1022 pgmUnlock(pVM); 1018 1023 return VINF_PGM_HANDLER_ALREADY_ALIASED; 1024 } 1019 1025 1020 1026 /* … … 1041 1047 LogFlow(("PGMHandlerPhysicalPageAlias: => %R[pgmpage]\n", pPage)); 1042 1048 1049 pgmUnlock(pVM); 1043 1050 #ifndef IN_RC 1044 1051 HWACCMInvalidatePhysPage(pVM, GCPhysPage); … … 1047 1054 } 1048 1055 1056 pgmUnlock(pVM); 1049 1057 AssertMsgFailed(("The page %#x is outside the range %#x-%#x\n", 1050 1058 GCPhysPage, pCur->Core.Key, pCur->Core.KeyLast)); … … 1052 1060 } 1053 1061 1062 pgmUnlock(pVM); 1054 1063 AssertMsgFailed(("Specified physical handler start address %#x is invalid.\n", GCPhys)); 1055 1064 return VERR_PGM_HANDLER_NOT_FOUND; … … 1097 1106 * Lookup and validate the range. 1098 1107 */ 1108 pgmLock(pVM); 1099 1109 PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys); 1100 1110 if (RT_LIKELY(pCur)) … … 1103 1113 && GCPhysPage <= pCur->Core.KeyLast)) 1104 1114 { 1105 AssertReturn (pCur->enmType == PGMPHYSHANDLERTYPE_MMIO, VERR_ACCESS_DENIED);1106 AssertReturn (!(pCur->Core.Key & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);1107 AssertReturn ((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, VERR_INVALID_PARAMETER);1115 AssertReturnStmt(pCur->enmType == PGMPHYSHANDLERTYPE_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED); 1116 AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), pgmUnlock(pVM), VERR_INVALID_PARAMETER); 1117 AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, pgmUnlock(pVM), VERR_INVALID_PARAMETER); 1108 1118 1109 1119 /* … … 1112 1122 PPGMPAGE pPage; 1113 1123 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPhysPage, &pPage); 1114 AssertR CReturn(rc, rc);1124 AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc); 1115 1125 if (PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO) 1116 1126 { 1127 pgmUnlock(pVM); 1117 1128 AssertMsgReturn(PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO2_ALIAS_MMIO, 1118 1129 ("GCPhysPage=%RGp %R[pgmpage]\n", GCPhysPage, pPage), … … 1138 1149 PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, PGM_PAGE_HNDL_PHYS_STATE_DISABLED); 1139 1150 LogFlow(("PGMHandlerPhysicalPageAliasHC: => %R[pgmpage]\n", pPage)); 1140 1151 pgmUnlock(pVM); 1141 1152 #ifndef IN_RC 1142 1153 HWACCMInvalidatePhysPage(pVM, GCPhysPage); … … 1144 1155 return VINF_SUCCESS; 1145 1156 } 1146 1157 pgmUnlock(pVM); 1147 1158 AssertMsgFailed(("The page %#x is outside the range %#x-%#x\n", 1148 1159 GCPhysPage, pCur->Core.Key, pCur->Core.KeyLast)); 1149 1160 return VERR_INVALID_PARAMETER; 1150 1161 } 1162 pgmUnlock(pVM); 1151 1163 1152 1164 AssertMsgFailed(("Specified physical handler start address %#x is invalid.\n", GCPhys)); … … 1169 1181 * Find the handler. 1170 1182 */ 1183 pgmLock(pVM); 1171 1184 PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys); 1172 1185 if (pCur) … … 1176 1189 || pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL 1177 1190 || pCur->enmType == PGMPHYSHANDLERTYPE_MMIO); 1191 pgmUnlock(pVM); 1178 1192 return true; 1179 1193 } 1180 1194 pgmUnlock(pVM); 1181 1195 return false; 1182 1196 } … … 1196 1210 bool pgmHandlerPhysicalIsAll(PVM pVM, RTGCPHYS GCPhys) 1197 1211 { 1212 pgmLock(pVM); 1198 1213 PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys); 1199 AssertReturn(pCur, true); 1214 if (!pCur) 1215 { 1216 pgmUnlock(pVM); 1217 AssertFailed(); 1218 return true; 1219 } 1200 1220 Assert( pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE 1201 1221 || pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL … … 1204 1224 Assert( pCur->Core.Key <= (GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK) 1205 1225 && pCur->Core.KeyLast >= (GCPhys | PAGE_OFFSET_MASK)); 1206 return pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE; 1226 1227 bool bRet = pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE; 1228 pgmUnlock(pVM); 1229 return bRet; 1207 1230 } 1208 1231
Note:
See TracChangeset
for help on using the changeset viewer.