- Timestamp:
- Aug 26, 2010 10:04:54 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/mm.h
r30338 r31978 275 275 VMMR3DECL(void *) MMR3HyperHCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys); 276 276 VMMR3DECL(int) MMR3HyperHCPhys2HCVirtEx(PVM pVM, RTHCPHYS HCPhys, void **ppv); 277 VMMR3_INT_DECL(int) MMR3HyperQueryInfoFromHCPhys(PVM pVM, RTHCPHYS HCPhys, char *pszWhat, size_t cbWhat, uint32_t *pcbAlloc); 277 278 VMMR3DECL(int) MMR3HyperReadGCVirt(PVM pVM, void *pvDst, RTGCPTR GCPtr, size_t cb); 278 279 /** @} */ -
trunk/include/VBox/pgm.h
r31966 r31978 315 315 VMMDECL(VBOXSTRICTRC) PGMInterpretInstruction(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault); 316 316 VMMDECL(int) PGMMap(PVM pVM, RTGCPTR GCPtr, RTHCPHYS HCPhys, uint32_t cbPages, unsigned fFlags); 317 VMMDECL(int) PGMMapGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys); 317 318 VMMDECL(int) PGMMapSetPage(PVM pVM, RTGCPTR GCPtr, uint64_t cb, uint64_t fFlags); 318 319 VMMDECL(int) PGMMapModifyPage(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask); -
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r31973 r31978 2906 2906 2907 2907 uint64_t cbRange; 2908 rc = DBGCCmdHlpVarGetRange(pCmdHlp, pRange, 1, PAGE_SIZE * 8, &cbRange);2908 rc = DBGCCmdHlpVarGetRange(pCmdHlp, pRange, PAGE_SIZE, PAGE_SIZE * 8, &cbRange); 2909 2909 if (RT_FAILURE(rc)) 2910 2910 return DBGCCmdHlpFail(pCmdHlp, pCmd, "Failed to obtain the range of %DV: %Rrc", pRange, rc); -
trunk/src/VBox/VMM/MMHyper.cpp
r30493 r31978 1169 1169 1170 1170 1171 /** 1172 * Implements the return case of MMR3HyperQueryInfoFromHCPhys. 1173 * 1174 * @returns VINF_SUCCESS, VINF_BUFFER_OVERFLOW. 1175 * @param pVM The VM handle. 1176 * @param HCPhys The host physical address to look for. 1177 * @param pLookup The HMA lookup entry corresponding to HCPhys. 1178 * @param pszWhat Where to return the description. 1179 * @param cbWhat Size of the return buffer. 1180 * @param pcbAlloc Where to return the size of whatever it is. 1181 */ 1182 static int mmR3HyperQueryInfoFromHCPhysFound(PVM pVM, RTHCPHYS HCPhys, PMMLOOKUPHYPER pLookup, 1183 char *pszWhat, size_t cbWhat, uint32_t *pcbAlloc) 1184 { 1185 *pcbAlloc = pLookup->cb; 1186 int rc = RTStrCopy(pszWhat, cbWhat, pLookup->pszDesc); 1187 return rc == VERR_BUFFER_OVERFLOW ? VINF_BUFFER_OVERFLOW : rc; 1188 } 1189 1190 1191 /** 1192 * Scans the HMA for the physical page and reports back a description if found. 1193 * 1194 * @returns VINF_SUCCESS, VINF_BUFFER_OVERFLOW, VERR_NOT_FOUND. 1195 * @param pVM The VM handle. 1196 * @param HCPhys The host physical address to look for. 1197 * @param pszWhat Where to return the description. 1198 * @param cbWhat Size of the return buffer. 1199 * @param pcbAlloc Where to return the size of whatever it is. 1200 */ 1201 VMMR3_INT_DECL(int) MMR3HyperQueryInfoFromHCPhys(PVM pVM, RTHCPHYS HCPhys, char *pszWhat, size_t cbWhat, uint32_t *pcbAlloc) 1202 { 1203 RTHCPHYS HCPhysPage = HCPhys & ~(RTHCPHYS)PAGE_OFFSET_MASK; 1204 PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((uint8_t *)pVM->mm.s.pHyperHeapR3 + pVM->mm.s.offLookupHyper); 1205 for (;;) 1206 { 1207 switch (pLookup->enmType) 1208 { 1209 case MMLOOKUPHYPERTYPE_LOCKED: 1210 { 1211 uint32_t i = pLookup->cb >> PAGE_SHIFT; 1212 while (i-- > 0) 1213 if (pLookup->u.Locked.paHCPhysPages[i] == HCPhysPage) 1214 return mmR3HyperQueryInfoFromHCPhysFound(pVM, HCPhys, pLookup, pszWhat, cbWhat, pcbAlloc); 1215 break; 1216 } 1217 1218 case MMLOOKUPHYPERTYPE_HCPHYS: 1219 { 1220 if (pLookup->u.HCPhys.HCPhys - HCPhysPage < pLookup->cb) 1221 return mmR3HyperQueryInfoFromHCPhysFound(pVM, HCPhys, pLookup, pszWhat, cbWhat, pcbAlloc); 1222 break; 1223 } 1224 1225 case MMLOOKUPHYPERTYPE_MMIO2: 1226 case MMLOOKUPHYPERTYPE_GCPHYS: 1227 case MMLOOKUPHYPERTYPE_DYNAMIC: 1228 { 1229 /* brute force. */ 1230 uint32_t i = pLookup->cb >> PAGE_SHIFT; 1231 while (i-- > 0) 1232 { 1233 RTGCPTR GCPtr = pLookup->off + pVM->mm.s.pvHyperAreaGC; 1234 RTHCPHYS HCPhysCur; 1235 int rc = PGMMapGetPage(pVM, GCPtr, NULL, &HCPhysCur); 1236 if (RT_SUCCESS(rc) && HCPhysCur == HCPhysPage) 1237 return mmR3HyperQueryInfoFromHCPhysFound(pVM, HCPhys, pLookup, pszWhat, cbWhat, pcbAlloc); 1238 } 1239 break; 1240 } 1241 default: 1242 AssertMsgFailed(("enmType=%d\n", pLookup->enmType)); 1243 break; 1244 } 1245 1246 /* next */ 1247 if ((unsigned)pLookup->offNext == NIL_OFFSET) 1248 break; 1249 pLookup = (PMMLOOKUPHYPER)((uint8_t *)pLookup + pLookup->offNext); 1250 } 1251 return VERR_NOT_FOUND; 1252 } 1253 1254 1171 1255 #if 0 /* unused, not implemented */ 1172 1256 /** -
trunk/src/VBox/VMM/PGMDbg.cpp
r31975 r31978 945 945 static void pgmR3DumpHierarchyHcShwPageInfo(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys) 946 946 { 947 /* later */ 948 NOREF(pState); NOREF(HCPhys); 947 pgmLock(pState->pVM); 948 char szPage[80]; 949 PPGMPOOLPAGE pPage = pgmPoolQueryPageForDbg(pState->pVM->pgm.s.CTX_SUFF(pPool), HCPhys); 950 if (pPage) 951 RTStrPrintf(szPage, sizeof(szPage), " idx=0i%u", pPage->idx); 952 else 953 { 954 /* probably a mapping */ 955 strcpy(szPage, " not found"); 956 for (PPGMMAPPING pMap = pState->pVM->pgm.s.pMappingsR3; pMap; pMap = pMap->pNextR3) 957 { 958 uint64_t off = pState->u64Address - pMap->GCPtr; 959 if (off < pMap->cb) 960 { 961 const int iPDE = (uint32_t)(off >> X86_PD_SHIFT); 962 if (pMap->aPTs[iPDE].HCPhysPT == HCPhys) 963 RTStrPrintf(szPage, sizeof(szPage), " #%u: %s", iPDE, pMap->pszDesc); 964 else if (pMap->aPTs[iPDE].HCPhysPaePT0 == HCPhys) 965 RTStrPrintf(szPage, sizeof(szPage), " #%u/0: %s", iPDE, pMap->pszDesc); 966 else if (pMap->aPTs[iPDE].HCPhysPaePT1 == HCPhys) 967 RTStrPrintf(szPage, sizeof(szPage), " #%u/1: %s", iPDE, pMap->pszDesc); 968 else 969 continue; 970 break; 971 } 972 } 973 } 974 pgmUnlock(pState->pVM); 975 pState->pHlp->pfnPrintf(pState->pHlp, "%s", szPage); 949 976 } 950 977 … … 959 986 static void pgmR3DumpHierarchyHcPageInfo(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, uint32_t cbPage) 960 987 { 961 /* later */ 962 NOREF(pState); NOREF(HCPhys); NOREF(cbPage); 963 RTGCPHYS GCPhys; 988 char szPage[80]; 989 RTGCPHYS GCPhys; 964 990 int rc = PGMR3DbgHCPhys2GCPhys(pState->pVM, HCPhys, &GCPhys); 965 991 if (RT_SUCCESS(rc)) 966 992 { 967 993 pgmLock(pState->pVM); 968 char szPage[80];969 994 PCPGMPAGE pPage = pgmPhysGetPage(&pState->pVM->pgm.s, GCPhys); 970 995 if (pPage) … … 976 1001 } 977 1002 else 978 pState->pHlp->pfnPrintf(pState->pHlp, " not found"); 1003 { 1004 /* check the heap */ 1005 uint32_t cbAlloc; 1006 rc = MMR3HyperQueryInfoFromHCPhys(pState->pVM, HCPhys, szPage, sizeof(szPage), &cbAlloc); 1007 if (RT_SUCCESS(rc)) 1008 pState->pHlp->pfnPrintf(pState->pHlp, " %s %#x bytes", szPage, cbAlloc); 1009 else 1010 pState->pHlp->pfnPrintf(pState->pHlp, " not found"); 1011 } 979 1012 } 980 1013 … … 1112 1145 pState->pHlp->pfnPrintf(pState->pHlp, 1113 1146 pState->fLme /*P R S A D G WT CD AT NX 4M a p ? phys */ 1114 ? "%016llx 2 | P %c %c %c %c %c %s %s .. %s 4K%c%c%c %016llx"1115 : "%08llx 1 | P %c %c %c %c %c %s %s .. %s 4K%c%c%c %016llx",1147 ? "%016llx 2 | P %c %c %c %c %c %s %s .. %s .. %c%c%c %016llx" 1148 : "%08llx 1 | P %c %c %c %c %c %s %s .. %s .. %c%c%c %016llx", 1116 1149 pState->u64Address, 1117 1150 Pde.n.u1Write ? 'W' : 'R', -
trunk/src/VBox/VMM/PGMInternal.h
r31938 r31978 3836 3836 void pgmPoolFlushPageByGCPhys(PVM pVM, RTGCPHYS GCPhys); 3837 3837 PPGMPOOLPAGE pgmPoolGetPage(PPGMPOOL pPool, RTHCPHYS HCPhys); 3838 PPGMPOOLPAGE pgmPoolQueryPageForDbg(PPGMPOOL pPool, RTHCPHYS HCPhys); 3838 3839 int pgmPoolSyncCR3(PVMCPU pVCpu); 3839 3840 bool pgmPoolIsDirtyPage(PVM pVM, RTGCPHYS GCPhys); -
trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp
r31775 r31978 207 207 return VERR_INVALID_PARAMETER; 208 208 } 209 210 211 /** 212 * Get information about a page in a mapping. 213 * 214 * This differs from PGMShwGetPage and PGMGstGetPage in that it only consults 215 * the page table to calculate the flags. 216 * 217 * @returns VINF_SUCCESS, VERR_PAGE_NOT_PRESENT or VERR_NOT_FOUND. 218 * @param pVM The VM handle. 219 * @param GCPtr The page addresss. 220 * @param pfFlags Where to return the flags. Optional. 221 * @param pHCPhys Where to return the address. Optional. 222 */ 223 VMMDECL(int) PGMMapGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys) 224 { 225 /* 226 * Find the mapping. 227 */ 228 GCPtr &= PAGE_BASE_GC_MASK; 229 PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); 230 while (pCur) 231 { 232 RTGCUINTPTR off = (RTGCUINTPTR)GCPtr - (RTGCUINTPTR)pCur->GCPtr; 233 if (off < pCur->cb) 234 { 235 /* 236 * Dig out the information. 237 */ 238 int rc = VINF_SUCCESS; 239 unsigned iPT = off >> X86_PD_SHIFT; 240 unsigned iPTE = (off >> PAGE_SHIFT) & X86_PT_MASK; 241 PCPGMSHWPTEPAE pPtePae = &pCur->aPTs[iPT].CTX_SUFF(paPaePTs)[iPTE / 512].a[iPTE % 512]; 242 if (PGMSHWPTEPAE_IS_P(*pPtePae)) 243 { 244 if (pfFlags) 245 *pfFlags = PGMSHWPTEPAE_GET_U(*pPtePae) & ~X86_PTE_PAE_PG_MASK_FULL; 246 if (pHCPhys) 247 *pHCPhys = PGMSHWPTEPAE_GET_HCPHYS(*pPtePae); 248 } 249 else 250 rc = VERR_PAGE_NOT_PRESENT; 251 return rc; 252 } 253 /* next */ 254 pCur = pCur->CTX_SUFF(pNext); 255 } 256 257 return VERR_NOT_FOUND; 258 } 259 209 260 210 261 -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r31870 r31978 4915 4915 } 4916 4916 4917 4918 /** 4919 * Internal worker for finding a page for debugging purposes, no assertions. 4920 * 4921 * @returns Pointer to the shadow page structure. NULL on if not found. 4922 * @param pPool The pool. 4923 * @param HCPhys The HC physical address of the shadow page. 4924 */ 4925 PPGMPOOLPAGE pgmPoolQueryPageForDbg(PPGMPOOL pPool, RTHCPHYS HCPhys) 4926 { 4927 PVM pVM = pPool->CTX_SUFF(pVM); 4928 Assert(PGMIsLockOwner(pVM)); 4929 return (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, HCPhys & X86_PTE_PAE_PG_MASK_FULL); 4930 } 4931 4932 4917 4933 #ifdef IN_RING3 /* currently only used in ring 3; save some space in the R0 & GC modules (left it here as we might need it elsewhere later on) */ 4918 4934 /**
Note:
See TracChangeset
for help on using the changeset viewer.