Changeset 105410 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jul 19, 2024 12:28:25 AM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/IEMR3.cpp
r105376 r105410 1070 1070 1071 1071 1072 #define IEMR3INFOTLB_F_ONLY_VALID RT_BIT_32(0) 1073 1072 1074 /** Worker for iemR3InfoTlbPrintSlots and iemR3InfoTlbPrintAddress. */ 1073 static void iemR3InfoTlbPrintSlot(PCDBGFINFOHLP pHlp, IEMTLB const *pTlb, IEMTLBENTRY const *pTlbe, uint32_t uSlot) 1075 static void iemR3InfoTlbPrintSlot(PCDBGFINFOHLP pHlp, IEMTLB const *pTlb, IEMTLBENTRY const *pTlbe, 1076 uint32_t uSlot, uint32_t fFlags) 1074 1077 { 1075 pHlp->pfnPrintf(pHlp, "%02x: %s %#018RX64 -> %RGp / %p / %#05x %s%s%s%s%s/%s%s%s/%s %s\n", 1078 #ifndef VBOX_VMM_TARGET_ARMV8 1079 uint64_t const uTlbRevision = !(uSlot & 1) ? pTlb->uTlbRevision : pTlb->uTlbRevisionGlobal; 1080 #else 1081 uint64_t const uTlbRevision = pTlb->uTlbRevision; 1082 #endif 1083 if ((fFlags & IEMR3INFOTLB_F_ONLY_VALID) && (pTlbe->uTag & IEMTLB_REVISION_MASK) != uTlbRevision) 1084 return; 1085 1086 /* The address needs to be sign extended, thus the shifting fun here.*/ 1087 RTGCPTR const GCPtr = (RTGCINTPTR)((pTlbe->uTag & ~IEMTLB_REVISION_MASK) << (64 - IEMTLB_TAG_ADDR_WIDTH)) 1088 >> (64 - IEMTLB_TAG_ADDR_WIDTH - GUEST_PAGE_SHIFT); 1089 pHlp->pfnPrintf(pHlp, "%0*x: %s %#018RX64 -> %RGp / %p / %#05x %s%s%s%s%s%s/%s%s%s%s/%s %s\n", 1090 RT_ELEMENTS(pTlb->aEntries) >= 0x1000 ? 4 : RT_ELEMENTS(pTlb->aEntries) >= 0x100 ? 3 : 2, 1076 1091 uSlot, 1077 (pTlbe->uTag & IEMTLB_REVISION_MASK) == pTlb->uTlbRevision ? "valid "1078 : (pTlbe->uTag & IEMTLB_REVISION_MASK) == 0 1079 1080 (pTlbe->uTag & ~IEMTLB_REVISION_MASK) << X86_PAGE_SHIFT,1092 (pTlbe->uTag & IEMTLB_REVISION_MASK) == uTlbRevision ? "valid " 1093 : (pTlbe->uTag & IEMTLB_REVISION_MASK) == 0 ? "empty " 1094 : "expired", 1095 GCPtr, 1081 1096 pTlbe->GCPhys, pTlbe->pbMappingR3, 1082 1097 (uint32_t)(pTlbe->fFlagsAndPhysRev & ~IEMTLBE_F_PHYS_REV), 1083 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_EXEC ? "NX" : " X", 1084 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_WRITE ? "RO" : "RW", 1085 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_ACCESSED ? "-" : "A", 1086 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_DIRTY ? "-" : "D", 1087 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_LARGE_PAGE ? "-" : "S", 1088 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_NO_WRITE ? "-" : "w", 1089 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_NO_READ ? "-" : "r", 1090 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_UNASSIGNED ? "U" : "-", 1091 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_NO_MAPPINGR3 ? "S" : "M", 1098 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_WRITE ? "R-" : "RW", 1099 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_EXEC ? "-" : "X", 1100 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_ACCESSED ? "-" : "A", 1101 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_NO_DIRTY ? "-" : "D", 1102 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PT_LARGE_PAGE ? "-" : "S", 1103 !(uSlot & 1) ? "-" : "G", 1104 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_NO_WRITE ? "-" : "w", 1105 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_NO_READ ? "-" : "r", 1106 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_UNASSIGNED ? "U" : "-", 1107 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PG_CODE_PAGE ? "C" : "-", 1108 pTlbe->fFlagsAndPhysRev & IEMTLBE_F_NO_MAPPINGR3 ? "S" : "M", 1092 1109 (pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PHYS_REV) == pTlb->uTlbPhysRev ? "phys-valid" 1093 1110 : (pTlbe->fFlagsAndPhysRev & IEMTLBE_F_PHYS_REV) == 0 ? "phys-empty" : "phys-expired"); … … 1097 1114 /** Displays one or more TLB slots. */ 1098 1115 static void iemR3InfoTlbPrintSlots(PVMCPU pVCpu, PCDBGFINFOHLP pHlp, IEMTLB const *pTlb, 1099 uint32_t uSlot, uint32_t cSlots, bool *pfHeader)1116 uint32_t uSlot, uint32_t cSlots, uint32_t fFlags, bool *pfHeader) 1100 1117 { 1101 1118 if (uSlot < RT_ELEMENTS(pTlb->aEntries)) … … 1112 1129 { 1113 1130 IEMTLBENTRY const Tlbe = pTlb->aEntries[uSlot]; 1114 iemR3InfoTlbPrintSlot(pHlp, pTlb, &Tlbe, uSlot );1131 iemR3InfoTlbPrintSlot(pHlp, pTlb, &Tlbe, uSlot, fFlags); 1115 1132 uSlot = (uSlot + 1) % RT_ELEMENTS(pTlb->aEntries); 1116 1133 } … … 1124 1141 /** Displays the TLB slot for the given address. */ 1125 1142 static void iemR3InfoTlbPrintAddress(PVMCPU pVCpu, PCDBGFINFOHLP pHlp, IEMTLB const *pTlb, 1126 uint64_t uAddress, bool *pfHeader)1143 uint64_t uAddress, uint32_t fFlags, bool *pfHeader) 1127 1144 { 1128 1145 iemR3InfoTlbPrintHeader(pVCpu, pHlp, pTlb, pfHeader); … … 1134 1151 Tlbe.uTag == (uTag | pTlb->uTlbRevision) ? "match" 1135 1152 : (Tlbe.uTag & ~IEMTLB_REVISION_MASK) == uTag ? "expired" : "mismatch"); 1136 iemR3InfoTlbPrintSlot(pHlp, pTlb, &Tlbe, uSlot );1153 iemR3InfoTlbPrintSlot(pHlp, pTlb, &Tlbe, uSlot, fFlags); 1137 1154 } 1138 1155 … … 1146 1163 static RTGETOPTDEF const s_aOptions[] = 1147 1164 { 1148 { "--cpu", 'c', RTGETOPT_REQ_UINT32 }, 1149 { "--vcpu", 'c', RTGETOPT_REQ_UINT32 }, 1150 { "all", 'A', RTGETOPT_REQ_NOTHING }, 1151 { "--all", 'A', RTGETOPT_REQ_NOTHING }, 1152 { "--address", 'a', RTGETOPT_REQ_UINT64 | RTGETOPT_FLAG_HEX }, 1153 { "--range", 'r', RTGETOPT_REQ_UINT32_PAIR | RTGETOPT_FLAG_HEX }, 1154 { "--slot", 's', RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX }, 1165 { "--cpu", 'c', RTGETOPT_REQ_UINT32 }, 1166 { "--vcpu", 'c', RTGETOPT_REQ_UINT32 }, 1167 { "all", 'A', RTGETOPT_REQ_NOTHING }, 1168 { "--all", 'A', RTGETOPT_REQ_NOTHING }, 1169 { "--address", 'a', RTGETOPT_REQ_UINT64 | RTGETOPT_FLAG_HEX }, 1170 { "--range", 'r', RTGETOPT_REQ_UINT32_PAIR | RTGETOPT_FLAG_HEX }, 1171 { "--slot", 's', RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX }, 1172 { "--only-valid", 'v', RTGETOPT_REQ_NOTHING }, 1155 1173 }; 1156 1174 … … 1169 1187 bool fNeedHeader = true; 1170 1188 bool fAddressMode = true; 1189 uint32_t fFlags = 0; 1171 1190 PVMCPU pVCpu = VMMGetCpu(pVM); 1172 1191 if (!pVCpu) … … 1190 1209 case 'a': 1191 1210 iemR3InfoTlbPrintAddress(pVCpu, pHlp, fITlb ? &pVCpu->iem.s.CodeTlb : &pVCpu->iem.s.DataTlb, 1192 ValueUnion.u64, &fNeedHeader);1211 ValueUnion.u64, fFlags, &fNeedHeader); 1193 1212 fAddressMode = true; 1194 1213 break; … … 1196 1215 case 'A': 1197 1216 iemR3InfoTlbPrintSlots(pVCpu, pHlp, fITlb ? &pVCpu->iem.s.CodeTlb : &pVCpu->iem.s.DataTlb, 1198 0, RT_ELEMENTS(pVCpu->iem.s.CodeTlb.aEntries), &fNeedHeader);1217 0, RT_ELEMENTS(pVCpu->iem.s.CodeTlb.aEntries), fFlags, &fNeedHeader); 1199 1218 break; 1200 1219 1201 1220 case 'r': 1202 1221 iemR3InfoTlbPrintSlots(pVCpu, pHlp, fITlb ? &pVCpu->iem.s.CodeTlb : &pVCpu->iem.s.DataTlb, 1203 ValueUnion.PairU32.uFirst, ValueUnion.PairU32.uSecond, &fNeedHeader);1222 ValueUnion.PairU32.uFirst, ValueUnion.PairU32.uSecond, fFlags, &fNeedHeader); 1204 1223 fAddressMode = false; 1205 1224 break; … … 1207 1226 case 's': 1208 1227 iemR3InfoTlbPrintSlots(pVCpu, pHlp, fITlb ? &pVCpu->iem.s.CodeTlb : &pVCpu->iem.s.DataTlb, 1209 ValueUnion.u32, 1, &fNeedHeader);1228 ValueUnion.u32, 1, fFlags, &fNeedHeader); 1210 1229 fAddressMode = false; 1230 break; 1231 1232 case 'v': 1233 fFlags |= IEMR3INFOTLB_F_ONLY_VALID; 1211 1234 break; 1212 1235 … … 1218 1241 if (RT_SUCCESS(rc) && rc != VWRN_NUMBER_TOO_BIG) 1219 1242 iemR3InfoTlbPrintAddress(pVCpu, pHlp, fITlb ? &pVCpu->iem.s.CodeTlb : &pVCpu->iem.s.DataTlb, 1220 uAddr, &fNeedHeader);1243 uAddr, fFlags, &fNeedHeader); 1221 1244 else 1222 1245 pHlp->pfnPrintf(pHlp, "error: Invalid or malformed guest address '%s': %Rrc\n", ValueUnion.psz, rc); … … 1228 1251 if (RT_SUCCESS(rc) && rc != VWRN_NUMBER_TOO_BIG) 1229 1252 iemR3InfoTlbPrintSlots(pVCpu, pHlp, fITlb ? &pVCpu->iem.s.CodeTlb : &pVCpu->iem.s.DataTlb, 1230 uSlot, 1, &fNeedHeader);1253 uSlot, 1, fFlags, &fNeedHeader); 1231 1254 else 1232 1255 pHlp->pfnPrintf(pHlp, "error: Invalid or malformed TLB slot number '%s': %Rrc\n", ValueUnion.psz, rc); … … 1249 1272 " -s<slot>,--slot=<slot>\n" 1250 1273 " Shows the given TLB slot.\n" 1274 " -v,--only-valid\n" 1275 " Only show valid TLB entries (TAG, not phys)\n" 1251 1276 "\n" 1252 1277 "Non-options are interpreted according to the last -a, -r or -s option,\n"
Note:
See TracChangeset
for help on using the changeset viewer.