- Timestamp:
- Jun 7, 2010 1:54:47 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmapi.h
r30050 r30072 104 104 char *pszNearSym1, size_t cchNearSym1, PRTRCPTR pNearSym1, 105 105 char *pszNearSym2, size_t cchNearSym2, PRTRCPTR pNearSym2); 106 VMMR3DECL(int) PDMR3LdrQueryR0ModFromPC(PVM pVM, RTR0PTR uPC, 107 char *pszModName, size_t cchModName, PRTR0PTR pMod, 108 char *pszNearSym1, size_t cchNearSym1, PRTR0PTR pNearSym1, 109 char *pszNearSym2, size_t cchNearSym2, PRTR0PTR pNearSym2); 106 110 VMMR3DECL(int) PDMR3LdrGetInterfaceSymbols(PVM pVM, void *pvInterface, size_t cbInterface, 107 111 const char *pszModule, const char *pszSymPrefix, -
trunk/include/VBox/vmm.h
r29905 r30072 219 219 /** @} */ 220 220 VMMR3DECL(int) VMMR3EmtRendezvousFF(PVM pVM, PVMCPU pVCpu); 221 VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR pAddress, void *pvBuf, size_t cbRead);221 VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR R0Addr, void *pvBuf, size_t cbRead); 222 222 /** @} */ 223 223 #endif /* IN_RING3 */ -
trunk/src/VBox/VMM/DBGFInternal.h
r28800 r30072 268 268 /** Special address space aliases. (Protected by hAsDbLock.) */ 269 269 RTDBGAS volatile ahAsAliases[DBGF_AS_COUNT]; 270 /** For lazily populating the aliased address spaces. */ 271 bool volatile afAsAliasPopuplated[DBGF_AS_COUNT]; 272 /** Alignment padding. */ 273 bool afAlignment[2]; 270 274 271 275 /** The current Guest OS digger. */ -
trunk/src/VBox/VMM/PDMLdr.cpp
r28800 r30072 65 65 static char * pdmR3FileR0(const char *pszFile); 66 66 static char * pdmR3File(const char *pszFile, const char *pszDefaultExt, bool fShared); 67 static DECLCALLBACK(int) pdmR3QueryModFromEIPEnumSymbols(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser);68 67 69 68 … … 1038 1037 typedef struct QMFEIPARG 1039 1038 { 1040 RT RCUINTPTRuPC;1039 RTINTPTR uPC; 1041 1040 1042 1041 char *pszNearSym1; 1043 size_t cchNearSym1;1044 RT RCINTPTRoffNearSym1;1042 size_t cchNearSym1; 1043 RTINTPTR offNearSym1; 1045 1044 1046 1045 char *pszNearSym2; 1047 1046 size_t cchNearSym2; 1048 RT RCINTPTRoffNearSym2;1047 RTINTPTR offNearSym2; 1049 1048 } QMFEIPARG, *PQMFEIPARG; 1050 1049 1051 /** 1052 * Queries module information from an PC (eip/rip). 1050 1051 /** 1052 * Enumeration callback function used by RTLdrEnumSymbols(). 1053 * 1054 * @returns VBox status code. Failure will stop the enumeration. 1055 * @param hLdrMod The loader module handle. 1056 * @param pszSymbol Symbol name. NULL if ordinal only. 1057 * @param uSymbol Symbol ordinal, ~0 if not used. 1058 * @param Value Symbol value. 1059 * @param pvUser The user argument specified to RTLdrEnumSymbols(). 1060 */ 1061 static DECLCALLBACK(int) pdmR3QueryModFromEIPEnumSymbols(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser) 1062 { 1063 PQMFEIPARG pArgs = (PQMFEIPARG)pvUser; 1064 1065 RTINTPTR off = Value - pArgs->uPC; 1066 if (off <= 0) /* near1 is before or at same location. */ 1067 { 1068 if (off > pArgs->offNearSym1) 1069 { 1070 pArgs->offNearSym1 = off; 1071 if (pArgs->pszNearSym1 && pArgs->cchNearSym1) 1072 { 1073 *pArgs->pszNearSym1 = '\0'; 1074 if (pszSymbol) 1075 strncat(pArgs->pszNearSym1, pszSymbol, pArgs->cchNearSym1); 1076 else 1077 { 1078 char szOrd[32]; 1079 RTStrPrintf(szOrd, sizeof(szOrd), "#%#x", uSymbol); 1080 strncat(pArgs->pszNearSym1, szOrd, pArgs->cchNearSym1); 1081 } 1082 } 1083 } 1084 } 1085 else /* near2 is after */ 1086 { 1087 if (off < pArgs->offNearSym2) 1088 { 1089 pArgs->offNearSym2 = off; 1090 if (pArgs->pszNearSym2 && pArgs->cchNearSym2) 1091 { 1092 *pArgs->pszNearSym2 = '\0'; 1093 if (pszSymbol) 1094 strncat(pArgs->pszNearSym2, pszSymbol, pArgs->cchNearSym2); 1095 else 1096 { 1097 char szOrd[32]; 1098 RTStrPrintf(szOrd, sizeof(szOrd), "#%#x", uSymbol); 1099 strncat(pArgs->pszNearSym2, szOrd, pArgs->cchNearSym2); 1100 } 1101 } 1102 } 1103 } 1104 1105 return VINF_SUCCESS; 1106 } 1107 1108 1109 /** 1110 * Internal worker for PDMR3LdrQueryRCModFromPC and PDMR3LdrQueryR0ModFromPC. 1111 * 1112 * @returns VBox status code. 1113 * 1114 * @param pVM VM handle 1115 * @param uPC The program counter (eip/rip) to locate the module for. 1116 * @param enmType The module type. 1117 * @param pszModName Where to store the module name. 1118 * @param cchModName Size of the module name buffer. 1119 * @param pMod Base address of the module. 1120 * @param pszNearSym1 Name of the closes symbol from below. 1121 * @param cchNearSym1 Size of the buffer pointed to by pszNearSym1. 1122 * @param pNearSym1 The address of pszNearSym1. 1123 * @param pszNearSym2 Name of the closes symbol from below. 1124 * @param cchNearSym2 Size of the buffer pointed to by pszNearSym2. 1125 * @param pNearSym2 The address of pszNearSym2. 1126 */ 1127 static int pdmR3LdrQueryModFromPC(PVM pVM, RTUINTPTR uPC, PDMMODTYPE enmType, 1128 char *pszModName, size_t cchModName, PRTUINTPTR pMod, 1129 char *pszNearSym1, size_t cchNearSym1, PRTUINTPTR pNearSym1, 1130 char *pszNearSym2, size_t cchNearSym2, PRTUINTPTR pNearSym2) 1131 { 1132 PUVM pUVM = pVM->pUVM; 1133 int rc = VERR_MODULE_NOT_FOUND; 1134 RTCritSectEnter(&pUVM->pdm.s.ListCritSect); 1135 for (PPDMMOD pCur= pUVM->pdm.s.pModules; pCur; pCur = pCur->pNext) 1136 { 1137 if (pCur->eType != enmType) 1138 continue; 1139 1140 /* The following RTLdrOpen call is a dirty hack to get ring-0 module information. */ 1141 RTLDRMOD hLdrMod = pCur->hLdrMod; 1142 if (hLdrMod == NIL_RTLDRMOD && uPC >= pCur->ImageBase) 1143 { 1144 int rc2 = RTLdrOpen(pCur->szFilename, 0 /*fFlags*/, RTLDRARCH_HOST, &hLdrMod); 1145 if (RT_FAILURE(rc2)) 1146 hLdrMod = NIL_RTLDRMOD; 1147 } 1148 1149 if ( hLdrMod != NIL_RTLDRMOD 1150 && uPC - pCur->ImageBase < RTLdrSize(hLdrMod)) 1151 { 1152 if (pMod) 1153 *pMod = pCur->ImageBase; 1154 if (pszModName && cchModName) 1155 { 1156 *pszModName = '\0'; 1157 strncat(pszModName, pCur->szName, cchModName); 1158 } 1159 if (pNearSym1) *pNearSym1 = 0; 1160 if (pNearSym2) *pNearSym2 = 0; 1161 if (pszNearSym1) *pszNearSym1 = '\0'; 1162 if (pszNearSym2) *pszNearSym2 = '\0'; 1163 1164 /* 1165 * Locate the nearest symbols. 1166 */ 1167 QMFEIPARG Args; 1168 Args.uPC = uPC; 1169 Args.pszNearSym1 = pszNearSym1; 1170 Args.cchNearSym1 = cchNearSym1; 1171 Args.offNearSym1 = RTINTPTR_MIN; 1172 Args.pszNearSym2 = pszNearSym2; 1173 Args.cchNearSym2 = cchNearSym2; 1174 Args.offNearSym2 = RTINTPTR_MAX; 1175 1176 rc = RTLdrEnumSymbols(hLdrMod, RTLDR_ENUM_SYMBOL_FLAGS_ALL, pCur->pvBits, pCur->ImageBase, 1177 pdmR3QueryModFromEIPEnumSymbols, &Args); 1178 if (pNearSym1 && Args.offNearSym1 != RTINTPTR_MIN) 1179 *pNearSym1 = Args.offNearSym1 + uPC; 1180 if (pNearSym2 && Args.offNearSym2 != RTINTPTR_MAX) 1181 *pNearSym2 = Args.offNearSym2 + uPC; 1182 1183 rc = VINF_SUCCESS; 1184 } 1185 1186 if (hLdrMod != pCur->hLdrMod && hLdrMod != NIL_RTLDRMOD) 1187 RTLdrClose(hLdrMod); 1188 1189 if (RT_SUCCESS(rc)) 1190 break; 1191 } 1192 RTCritSectLeave(&pUVM->pdm.s.ListCritSect); 1193 return rc; 1194 } 1195 1196 1197 /** 1198 * Queries raw-mode context module information from an PC (eip/rip). 1053 1199 * 1054 1200 * This is typically used to locate a crash address. … … 1073 1219 char *pszNearSym2, size_t cchNearSym2, PRTRCPTR pNearSym2) 1074 1220 { 1075 PUVM pUVM = pVM->pUVM; 1076 int rc = VERR_MODULE_NOT_FOUND; 1077 RTCritSectEnter(&pUVM->pdm.s.ListCritSect); 1078 for (PPDMMOD pCur= pUVM->pdm.s.pModules; pCur; pCur = pCur->pNext) 1079 { 1080 /* Skip anything which isn't in GC. */ 1081 if (pCur->eType != PDMMOD_TYPE_RC) 1082 continue; 1083 if (uPC - pCur->ImageBase < RTLdrSize(pCur->hLdrMod)) 1084 { 1085 if (pMod) 1086 *pMod = pCur->ImageBase; 1087 if (pszModName && cchModName) 1088 { 1089 *pszModName = '\0'; 1090 strncat(pszModName, pCur->szName, cchModName); 1091 } 1092 if (pNearSym1) *pNearSym1 = 0; 1093 if (pNearSym2) *pNearSym2 = 0; 1094 if (pszNearSym1) *pszNearSym1 = '\0'; 1095 if (pszNearSym2) *pszNearSym2 = '\0'; 1096 1097 /* 1098 * Locate the nearest symbols. 1099 */ 1100 QMFEIPARG Args; 1101 Args.uPC = uPC; 1102 Args.pszNearSym1 = pszNearSym1; 1103 Args.cchNearSym1 = cchNearSym1; 1104 Args.offNearSym1 = RTRCINTPTR_MIN; 1105 Args.pszNearSym2 = pszNearSym2; 1106 Args.cchNearSym2 = cchNearSym2; 1107 Args.offNearSym2 = RTRCINTPTR_MAX; 1108 1109 rc = RTLdrEnumSymbols(pCur->hLdrMod, RTLDR_ENUM_SYMBOL_FLAGS_ALL, pCur->pvBits, pCur->ImageBase, 1110 pdmR3QueryModFromEIPEnumSymbols, &Args); 1111 if (pNearSym1 && Args.offNearSym1 != INT_MIN) 1112 *pNearSym1 = Args.offNearSym1 + uPC; 1113 if (pNearSym2 && Args.offNearSym2 != INT_MAX) 1114 *pNearSym2 = Args.offNearSym2 + uPC; 1115 1116 rc = VINF_SUCCESS; 1117 if (pCur->eType == PDMMOD_TYPE_RC) 1118 break; 1119 } 1120 1121 } 1122 RTCritSectLeave(&pUVM->pdm.s.ListCritSect); 1221 RTUINTPTR AddrMod = 0; 1222 RTUINTPTR AddrNear1 = 0; 1223 RTUINTPTR AddrNear2 = 0; 1224 int rc = pdmR3LdrQueryModFromPC(pVM, uPC, PDMMOD_TYPE_RC, 1225 pszModName, cchModName, &AddrMod, 1226 pszNearSym1, cchNearSym1, &AddrNear1, 1227 pszNearSym2, cchNearSym2, &AddrNear2); 1228 if (RT_SUCCESS(rc)) 1229 { 1230 if (pMod) 1231 *pMod = (RTRCPTR)AddrMod; 1232 if (pNearSym1) 1233 *pNearSym1 = (RTRCPTR)AddrNear1; 1234 if (pNearSym2) 1235 *pNearSym2 = (RTRCPTR)AddrNear2; 1236 } 1123 1237 return rc; 1124 1238 } … … 1126 1240 1127 1241 /** 1128 * Enumeration callback function used by RTLdrEnumSymbols(). 1129 * 1130 * @returns VBox status code. Failure will stop the enumeration. 1131 * @param hLdrMod The loader module handle. 1132 * @param pszSymbol Symbol name. NULL if ordinal only. 1133 * @param uSymbol Symbol ordinal, ~0 if not used. 1134 * @param Value Symbol value. 1135 * @param pvUser The user argument specified to RTLdrEnumSymbols(). 1136 */ 1137 static DECLCALLBACK(int) pdmR3QueryModFromEIPEnumSymbols(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser) 1138 { 1139 PQMFEIPARG pArgs = (PQMFEIPARG)pvUser; 1140 1141 RTINTPTR off = Value - pArgs->uPC; 1142 if (off <= 0) /* near1 is before or at same location. */ 1143 { 1144 if (off > pArgs->offNearSym1) 1145 { 1146 pArgs->offNearSym1 = off; 1147 if (pArgs->pszNearSym1 && pArgs->cchNearSym1) 1148 { 1149 *pArgs->pszNearSym1 = '\0'; 1150 if (pszSymbol) 1151 strncat(pArgs->pszNearSym1, pszSymbol, pArgs->cchNearSym1); 1152 else 1153 { 1154 char szOrd[32]; 1155 RTStrPrintf(szOrd, sizeof(szOrd), "#%#x", uSymbol); 1156 strncat(pArgs->pszNearSym1, szOrd, pArgs->cchNearSym1); 1157 } 1158 } 1159 } 1160 } 1161 else /* near2 is after */ 1162 { 1163 if (off < pArgs->offNearSym2) 1164 { 1165 pArgs->offNearSym2 = off; 1166 if (pArgs->pszNearSym2 && pArgs->cchNearSym2) 1167 { 1168 *pArgs->pszNearSym2 = '\0'; 1169 if (pszSymbol) 1170 strncat(pArgs->pszNearSym2, pszSymbol, pArgs->cchNearSym2); 1171 else 1172 { 1173 char szOrd[32]; 1174 RTStrPrintf(szOrd, sizeof(szOrd), "#%#x", uSymbol); 1175 strncat(pArgs->pszNearSym2, szOrd, pArgs->cchNearSym2); 1176 } 1177 } 1178 } 1179 } 1180 1181 return VINF_SUCCESS; 1242 * Queries ring-0 context module information from an PC (eip/rip). 1243 * 1244 * This is typically used to locate a crash address. 1245 * 1246 * @returns VBox status code. 1247 * 1248 * @param pVM VM handle 1249 * @param uPC The program counter (eip/rip) to locate the module for. 1250 * @param pszModName Where to store the module name. 1251 * @param cchModName Size of the module name buffer. 1252 * @param pMod Base address of the module. 1253 * @param pszNearSym1 Name of the closes symbol from below. 1254 * @param cchNearSym1 Size of the buffer pointed to by pszNearSym1. 1255 * @param pNearSym1 The address of pszNearSym1. 1256 * @param pszNearSym2 Name of the closes symbol from below. 1257 * @param cchNearSym2 Size of the buffer pointed to by pszNearSym2. Optional. 1258 * @param pNearSym2 The address of pszNearSym2. Optional. 1259 */ 1260 VMMR3DECL(int) PDMR3LdrQueryR0ModFromPC(PVM pVM, RTR0PTR uPC, 1261 char *pszModName, size_t cchModName, PRTR0PTR pMod, 1262 char *pszNearSym1, size_t cchNearSym1, PRTR0PTR pNearSym1, 1263 char *pszNearSym2, size_t cchNearSym2, PRTR0PTR pNearSym2) 1264 { 1265 RTUINTPTR AddrMod = 0; 1266 RTUINTPTR AddrNear1 = 0; 1267 RTUINTPTR AddrNear2 = 0; 1268 int rc = pdmR3LdrQueryModFromPC(pVM, uPC, PDMMOD_TYPE_R0, 1269 pszModName, cchModName, &AddrMod, 1270 pszNearSym1, cchNearSym1, &AddrNear1, 1271 pszNearSym2, cchNearSym2, &AddrNear2); 1272 if (RT_SUCCESS(rc)) 1273 { 1274 if (pMod) 1275 *pMod = (RTR0PTR)AddrMod; 1276 if (pNearSym1) 1277 *pNearSym1 = (RTR0PTR)AddrNear1; 1278 if (pNearSym2) 1279 *pNearSym2 = (RTR0PTR)AddrNear2; 1280 } 1281 return rc; 1182 1282 } 1183 1283 -
trunk/src/VBox/VMM/VMM.cpp
r29902 r30072 1779 1779 * @param pVM Pointer to the shared VM structure. 1780 1780 * @param idCpu The ID of the source CPU context (for the address). 1781 * @param pAddressWhere to start reading.1781 * @param R0Addr Where to start reading. 1782 1782 * @param pvBuf Where to store the data we've read. 1783 1783 * @param cbRead The number of bytes to read. 1784 1784 */ 1785 VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR pAddress, void *pvBuf, size_t cbRead)1786 { 1787 PVMCPU pVCpu= VMMGetCpuById(pVM, idCpu);1785 VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR R0Addr, void *pvBuf, size_t cbRead) 1786 { 1787 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu); 1788 1788 AssertReturn(pVCpu, VERR_INVALID_PARAMETER); 1789 1789 1790 RTHCUINTPTR offset = pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck - pAddress; 1791 if (offset >= pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack) 1790 #ifdef VMM_R0_SWITCH_STACK 1791 RTHCUINTPTR off = R0Addr - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3); 1792 #else 1793 RTHCUINTPTR off = pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack - (pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck - R0Addr); 1794 #endif 1795 if ( off > VMM_STACK_SIZE 1796 || off + cbRead >= VMM_STACK_SIZE) 1792 1797 return VERR_INVALID_POINTER; 1793 1798 1794 memcpy(pvBuf, pVCpu->vmm.s.pbEMTStackR3 + pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack - offset, cbRead);1799 memcpy(pvBuf, &pVCpu->vmm.s.pbEMTStackR3[off], cbRead); 1795 1800 return VINF_SUCCESS; 1796 1801 } … … 2127 2132 #else 2128 2133 pVCpu->vmm.s.CallRing3JmpBufR0.rip = 0; 2134 #endif 2135 #ifdef VMM_R0_SWITCH_STACK 2136 *(uint64_t *)pVCpu->vmm.s.pbEMTStackR3 = 0; /* clear marker */ 2129 2137 #endif 2130 2138 LogRel((pVM->vmm.s.szRing0AssertMsg1)); -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r30066 r30072 1245 1245 VMMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock) 1246 1246 { 1247 #if !(defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)) // for provoking guru - DO NOT COMMIT THIS! 1247 1248 int rc = pgmLock(pVM); 1248 1249 AssertRCReturn(rc, rc); 1250 #else 1251 int rc; 1252 #endif 1249 1253 1250 1254 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) … … 1325 1329 1326 1330 #endif /* IN_RING3 || IN_RING0 */ 1331 #if !(defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)) // for provoking guru - DO NOT COMMIT THIS! 1327 1332 pgmUnlock(pVM); 1333 #endif 1328 1334 return rc; 1329 1335 } -
trunk/src/VBox/VMM/VMMGuruMeditation.cpp
r30060 r30072 250 250 || strchr(pszMsg2, '\0')[-1] != '\n') 251 251 pHlp->pfnPrintf(pHlp, "\n"); 252 pHlp->pfnPrintf(pHlp, "!!\n");253 252 /* fall thru */ 254 253 } … … 288 287 289 288 /* 290 * The hypervisor dump is not relevant when we're in VT-x/AMD-V mode.289 * Dump the relevant hypervisor registers and stack. 291 290 */ 292 291 if (HWACCMIsEnabled(pVM)) 293 292 { 294 pHlp->pfnPrintf(pHlp, "\n"); 295 #if defined(RT_OS_WINDOWS) && HC_ARCH_BITS == 32 293 if ( rcErr == VERR_VMM_RING0_ASSERTION /* fInRing3Call has already been cleared here. */ 294 || pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call) 295 { 296 /* Dump the jmpbuf. */ 297 pHlp->pfnPrintf(pHlp, 298 "!!\n" 299 "!! CallRing3JmpBuf:\n" 300 "!!\n"); 301 pHlp->pfnPrintf(pHlp, 302 "SavedEsp=%RHv SavedEbp=%RHv SpResume=%RHv SpCheck=%RHv fInRing3Call=%RTbool\n", 303 pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp, 304 pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp, 305 pVCpu->vmm.s.CallRing3JmpBufR0.SpResume, 306 pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck, 307 pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call); 308 pHlp->pfnPrintf(pHlp, 309 "pvSavedStack=%RHv SavedEbp=%RX32 SpResume=%RHv SpCheck=%RHv\n", 310 pVCpu->vmm.s.CallRing3JmpBufR0.pvSavedStack, 311 pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack); 312 pHlp->pfnPrintf(pHlp, 313 "cbUsedMax=%#4x cbUsedAvg=%#4x cbUsedTotal=%#llx cUsedTotal=%#llx\n", 314 pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedMax, 315 pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedAvg, 316 pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedTotal, 317 pVCpu->vmm.s.CallRing3JmpBufR0.cUsedTotal); 318 319 /* Dump the resume register frame on the stack. */ 320 PRTHCUINTPTR pBP; 321 #ifdef VMM_R0_SWITCH_STACK 322 pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp 323 - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3)]; 324 #else 325 pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack 326 - pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck 327 + pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp]; 328 #endif 329 #if HC_ARCH_BITS == 32 330 pHlp->pfnPrintf(pHlp, 331 "eax=volatile ebx=%08x ecx=volatile edx=volatile esi=%08x edi=%08x\n" 332 "eip=%08x esp=%08x ebp=%08x efl=%08x\n" 333 , 334 pBP[-3], pBP[-2], pBP[-1], 335 pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 8, pBP[0], pBP[-4]); 336 #else 337 # ifdef RT_OS_WINDOWS 338 pHlp->pfnPrintf(pHlp, 339 "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" 340 "rsi=%016RX64 rdi=%016RX64 r8=volatile r9=volatile \n" 341 "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" 342 "r14=%016RX64 r15=%016RX64\n" 343 "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rfl=%08RX64\n" 344 , 345 pBP[-7], 346 pBP[-6], pBP[-5], 347 pBP[-4], pBP[-3], 348 pBP[-2], pBP[-1], 349 pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-8]); 350 # else 351 pHlp->pfnPrintf(pHlp, 352 "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" 353 "rsi=volatile rdi=volatile r8=volatile r9=volatile \n" 354 "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" 355 "r14=%016RX64 r15=%016RX64\n" 356 "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rflags=%08RX64\n" 357 , 358 pBP[-5], 359 pBP[-4], pBP[-3], 360 pBP[-2], pBP[-1], 361 pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-6]); 362 # endif 363 #endif 364 365 #if HC_ARCH_BITS == 32 366 /* Callstack. */ 367 DBGFADDRESS pc; 368 pc.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 369 # if HC_ARCH_BITS == 64 370 pc.FlatPtr = pc.off = pVCpu->vmm.s.CallRing3JmpBufR0.rip; 371 # else 372 pc.FlatPtr = pc.off = pVCpu->vmm.s.CallRing3JmpBufR0.eip; 373 # endif 374 pc.Sel = DBGF_SEL_FLAT; 375 376 DBGFADDRESS ebp; 377 ebp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 378 ebp.FlatPtr = ebp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp; 379 ebp.Sel = DBGF_SEL_FLAT; 380 381 DBGFADDRESS esp; 382 esp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 383 esp.Sel = DBGF_SEL_FLAT; 384 esp.FlatPtr = esp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp; 385 386 PCDBGFSTACKFRAME pFirstFrame; 387 rc2 = DBGFR3StackWalkBeginEx(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &pc, 388 DBGFRETURNTYPE_INVALID, &pFirstFrame); 389 if (RT_SUCCESS(rc2)) 390 { 391 pHlp->pfnPrintf(pHlp, 392 "!!\n" 393 "!! Call Stack:\n" 394 "!!\n" 395 "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n"); 396 for (PCDBGFSTACKFRAME pFrame = pFirstFrame; 397 pFrame; 398 pFrame = DBGFR3StackWalkNext(pFrame)) 399 { 400 pHlp->pfnPrintf(pHlp, 401 "%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32", 402 (uint32_t)pFrame->AddrFrame.off, 403 (uint32_t)pFrame->AddrReturnFrame.off, 404 (uint32_t)pFrame->AddrReturnPC.Sel, 405 (uint32_t)pFrame->AddrReturnPC.off, 406 pFrame->Args.au32[0], 407 pFrame->Args.au32[1], 408 pFrame->Args.au32[2], 409 pFrame->Args.au32[3]); 410 pHlp->pfnPrintf(pHlp, " %RTsel:%08RGv", pFrame->AddrPC.Sel, pFrame->AddrPC.off); 411 if (pFrame->pSymPC) 412 { 413 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value; 414 if (offDisp > 0) 415 pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp); 416 else if (offDisp < 0) 417 pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp); 418 else 419 pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName); 420 } 421 if (pFrame->pLinePC) 422 pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo); 423 pHlp->pfnPrintf(pHlp, "\n"); 424 } 425 DBGFR3StackWalkEnd(pFirstFrame); 426 } 427 #endif /* defined(RT_OS_WINDOWS) && HC_ARCH_BITS == 32 */ 428 429 /* raw stack */ 430 pHlp->pfnPrintf(pHlp, 431 "!!\n" 432 "!! Raw stack (mind the direction). \n" 433 "!! pbEMTStackR0=%RHv pbEMTStackBottomR0=%RHv VMM_STACK_SIZE=%#x\n" 434 "!!\n" 435 "%.*Rhxd\n", 436 MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3), 437 MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3) + VMM_STACK_SIZE, 438 VMM_STACK_SIZE, 439 VMM_STACK_SIZE, pVCpu->vmm.s.pbEMTStackR3); 440 } 441 else 442 { 443 pHlp->pfnPrintf(pHlp, 444 "!! Skipping ring-0 registers and stack, rcErr=%Rrc\n", rcErr); 445 } 446 } 447 else 448 { 449 /* 450 * Try figure out where eip is. 451 */ 452 /* core code? */ 453 if (uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC < pVM->vmm.s.cbCoreCode) 454 pHlp->pfnPrintf(pHlp, 455 "!! EIP is in CoreCode, offset %#x\n", 456 uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC); 457 else 458 { /* ask PDM */ /** @todo ask DBGFR3Sym later? */ 459 char szModName[64]; 460 RTRCPTR RCPtrMod; 461 char szNearSym1[260]; 462 RTRCPTR RCPtrNearSym1; 463 char szNearSym2[260]; 464 RTRCPTR RCPtrNearSym2; 465 int rc = PDMR3LdrQueryRCModFromPC(pVM, uEIP, 466 &szModName[0], sizeof(szModName), &RCPtrMod, 467 &szNearSym1[0], sizeof(szNearSym1), &RCPtrNearSym1, 468 &szNearSym2[0], sizeof(szNearSym2), &RCPtrNearSym2); 469 if (RT_SUCCESS(rc)) 470 pHlp->pfnPrintf(pHlp, 471 "!! EIP in %s (%RRv) at rva %x near symbols:\n" 472 "!! %RRv rva %RRv off %08x %s\n" 473 "!! %RRv rva %RRv off -%08x %s\n", 474 szModName, RCPtrMod, (unsigned)(uEIP - RCPtrMod), 475 RCPtrNearSym1, RCPtrNearSym1 - RCPtrMod, (unsigned)(uEIP - RCPtrNearSym1), szNearSym1, 476 RCPtrNearSym2, RCPtrNearSym2 - RCPtrMod, (unsigned)(RCPtrNearSym2 - uEIP), szNearSym2); 477 else 478 pHlp->pfnPrintf(pHlp, 479 "!! EIP is not in any code known to VMM!\n"); 480 } 481 482 /* Disassemble the instruction. */ 483 char szInstr[256]; 484 rc2 = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, 0, 0, DBGF_DISAS_FLAGS_CURRENT_HYPER, &szInstr[0], sizeof(szInstr), NULL); 485 if (RT_SUCCESS(rc2)) 486 pHlp->pfnPrintf(pHlp, 487 "!! %s\n", szInstr); 488 489 /* Dump the hypervisor cpu state. */ 490 pHlp->pfnPrintf(pHlp, 491 "!!\n" 492 "!!\n" 493 "!!\n"); 494 rc2 = DBGFR3Info(pVM, "cpumhyper", "verbose", pHlp); 495 fDoneHyper = true; 496 296 497 /* Callstack. */ 297 498 PCDBGFSTACKFRAME pFirstFrame; 298 DBGFADDRESS eip, ebp, esp; 299 300 eip.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 301 #if HC_ARCH_BITS == 64 302 eip.FlatPtr = eip.off = pVCpu->vmm.s.CallRing3JmpBufR0.rip; 303 #else 304 eip.FlatPtr = eip.off = pVCpu->vmm.s.CallRing3JmpBufR0.eip; 305 #endif 306 eip.Sel = DBGF_SEL_FLAT; 307 ebp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 308 ebp.FlatPtr = ebp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp; 309 ebp.Sel = DBGF_SEL_FLAT; 310 esp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 311 esp.Sel = DBGF_SEL_FLAT; 312 esp.FlatPtr = esp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp; 313 314 rc2 = DBGFR3StackWalkBeginEx(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &eip, 315 DBGFRETURNTYPE_INVALID, &pFirstFrame); 499 rc2 = DBGFR3StackWalkBegin(pVM, pVCpu->idCpu, DBGFCODETYPE_HYPER, &pFirstFrame); 316 500 if (RT_SUCCESS(rc2)) 317 501 { … … 352 536 DBGFR3StackWalkEnd(pFirstFrame); 353 537 } 354 #endif /* defined(RT_OS_WINDOWS) && HC_ARCH_BITS == 32 */355 }356 else357 {358 /*359 * Try figure out where eip is.360 */361 /* core code? */362 if (uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC < pVM->vmm.s.cbCoreCode)363 pHlp->pfnPrintf(pHlp,364 "!! EIP is in CoreCode, offset %#x\n",365 uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC);366 else367 { /* ask PDM */ /** @todo ask DBGFR3Sym later? */368 char szModName[64];369 RTRCPTR RCPtrMod;370 char szNearSym1[260];371 RTRCPTR RCPtrNearSym1;372 char szNearSym2[260];373 RTRCPTR RCPtrNearSym2;374 int rc = PDMR3LdrQueryRCModFromPC(pVM, uEIP,375 &szModName[0], sizeof(szModName), &RCPtrMod,376 &szNearSym1[0], sizeof(szNearSym1), &RCPtrNearSym1,377 &szNearSym2[0], sizeof(szNearSym2), &RCPtrNearSym2);378 if (RT_SUCCESS(rc))379 pHlp->pfnPrintf(pHlp,380 "!! EIP in %s (%RRv) at rva %x near symbols:\n"381 "!! %RRv rva %RRv off %08x %s\n"382 "!! %RRv rva %RRv off -%08x %s\n",383 szModName, RCPtrMod, (unsigned)(uEIP - RCPtrMod),384 RCPtrNearSym1, RCPtrNearSym1 - RCPtrMod, (unsigned)(uEIP - RCPtrNearSym1), szNearSym1,385 RCPtrNearSym2, RCPtrNearSym2 - RCPtrMod, (unsigned)(RCPtrNearSym2 - uEIP), szNearSym2);386 else387 pHlp->pfnPrintf(pHlp,388 "!! EIP is not in any code known to VMM!\n");389 }390 391 /* Disassemble the instruction. */392 char szInstr[256];393 rc2 = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, 0, 0, DBGF_DISAS_FLAGS_CURRENT_HYPER, &szInstr[0], sizeof(szInstr), NULL);394 if (RT_SUCCESS(rc2))395 pHlp->pfnPrintf(pHlp,396 "!! %s\n", szInstr);397 398 /* Dump the hypervisor cpu state. */399 pHlp->pfnPrintf(pHlp,400 "!!\n"401 "!!\n"402 "!!\n");403 rc2 = DBGFR3Info(pVM, "cpumhyper", "verbose", pHlp);404 fDoneHyper = true;405 406 /* Callstack. */407 PCDBGFSTACKFRAME pFirstFrame;408 rc2 = DBGFR3StackWalkBegin(pVM, pVCpu->idCpu, DBGFCODETYPE_HYPER, &pFirstFrame);409 if (RT_SUCCESS(rc2))410 {411 pHlp->pfnPrintf(pHlp,412 "!!\n"413 "!! Call Stack:\n"414 "!!\n"415 "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n");416 for (PCDBGFSTACKFRAME pFrame = pFirstFrame;417 pFrame;418 pFrame = DBGFR3StackWalkNext(pFrame))419 {420 pHlp->pfnPrintf(pHlp,421 "%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32",422 (uint32_t)pFrame->AddrFrame.off,423 (uint32_t)pFrame->AddrReturnFrame.off,424 (uint32_t)pFrame->AddrReturnPC.Sel,425 (uint32_t)pFrame->AddrReturnPC.off,426 pFrame->Args.au32[0],427 pFrame->Args.au32[1],428 pFrame->Args.au32[2],429 pFrame->Args.au32[3]);430 pHlp->pfnPrintf(pHlp, " %RTsel:%08RGv", pFrame->AddrPC.Sel, pFrame->AddrPC.off);431 if (pFrame->pSymPC)432 {433 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value;434 if (offDisp > 0)435 pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp);436 else if (offDisp < 0)437 pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp);438 else439 pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName);440 }441 if (pFrame->pLinePC)442 pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo);443 pHlp->pfnPrintf(pHlp, "\n");444 }445 DBGFR3StackWalkEnd(pFirstFrame);446 }447 538 448 539 /* raw stack */ … … 519 610 */ 520 611 vmmR3FatalDumpInfoHlpDelete(&Hlp); 521 522 /*523 * Reset the ring-0 long jump buffer and stack.524 */525 pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call = 0;526 #ifdef RT_ARCH_X86527 pVCpu->vmm.s.CallRing3JmpBufR0.eip = 0;528 #else529 pVCpu->vmm.s.CallRing3JmpBufR0.rip = 0;530 #endif531 *(uint64_t *)pVCpu->vmm.s.pbEMTStackR3 = 0; /* clear marker */532 612 } 533 613
Note:
See TracChangeset
for help on using the changeset viewer.